@thi.ng/rdom
Advanced tools
Comparing version 1.5.0 to 1.5.1
# Change Log | ||
- **Last updated**: 2024-07-03T08:50:04Z | ||
- **Last updated**: 2024-07-06T12:02:19Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,10 @@ | ||
### [1.5.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.5.1) (2024-07-06) | ||
#### 🩹 Bug fixes | ||
- update $compile() handling of embedded functions ([#477](https://github.com/thi-ng/umbrella/issues/477)) ([5ac2831](https://github.com/thi-ng/umbrella/commit/5ac2831)) | ||
- add fn checks & branches to call embedded fn and compile its result | ||
- update docs | ||
## [1.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.5.0) (2024-07-03) | ||
@@ -14,0 +22,0 @@ |
@@ -16,2 +16,5 @@ import type { IComponent } from "./api.js"; | ||
* instances | ||
* - functions embedded in hiccup, i.e. either: | ||
* - `[fn, ...args]` | ||
* - `["tag", {}, ... noArgFn ...]` | ||
* | ||
@@ -24,2 +27,6 @@ * Any other value type will be wrapped in a `<span>` element. Reactive | ||
* | ||
* If given any of the supported embedded function forms, the function will be | ||
* called with given args (or without) and the result passed back to | ||
* `$compile()`. | ||
* | ||
* **Important:** Use {@link $replace}, {@link $refresh} or {@link $switch} to | ||
@@ -26,0 +33,0 @@ * wrap any reactive values/subscriptions which produce actual HTML |
import { isArray } from "@thi.ng/checks/is-array"; | ||
import { isAsyncIterable } from "@thi.ng/checks/is-async-iterable"; | ||
import { isFunction } from "@thi.ng/checks/is-function"; | ||
import { isPlainObject } from "@thi.ng/checks/is-plain-object"; | ||
@@ -10,3 +11,3 @@ import { isSubscribable } from "@thi.ng/rstream/checks"; | ||
import { $wrapEl, $wrapText } from "./wrap.js"; | ||
const $compile = (tree) => isArray(tree) ? __isComplexComponent(tree) ? __complexComponent(tree) : __basicComponent(tree) : isComponent(tree) ? tree : isSubscribable(tree) ? $sub(tree, "span") : isAsyncIterable(tree) ? $async(tree, "span") : tree instanceof Element ? $wrapEl(tree) : $wrapText("span", null, tree); | ||
const $compile = (tree) => isArray(tree) ? isFunction(tree[0]) ? $compile(tree[0].apply(null, tree.slice(1))) : __isComplexComponent(tree) ? __complexComponent(tree) : __basicComponent(tree) : isComponent(tree) ? tree : isSubscribable(tree) ? $sub(tree, "span") : isAsyncIterable(tree) ? $async(tree, "span") : isFunction(tree) ? $compile(tree()) : tree instanceof Element ? $wrapEl(tree) : $wrapText("span", null, tree); | ||
const __walk = (f, x, path = []) => { | ||
@@ -30,3 +31,3 @@ if (isPlainObject(x)) { | ||
} | ||
return isSubscribable(x) || isAsyncIterable(x) || isComponent(x) || isElement(x); | ||
return isSubscribable(x) || isAsyncIterable(x) || isComponent(x) || isFunction(x) || isElement(x); | ||
}; | ||
@@ -33,0 +34,0 @@ const __complexComponent = (tree) => ({ |
{ | ||
"name": "@thi.ng/rdom", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible", | ||
@@ -40,16 +40,16 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.11.4", | ||
"@thi.ng/checks": "^3.6.6", | ||
"@thi.ng/errors": "^2.5.9", | ||
"@thi.ng/hiccup": "^5.2.3", | ||
"@thi.ng/paths": "^5.1.83", | ||
"@thi.ng/prefixes": "^2.3.21", | ||
"@thi.ng/rstream": "^8.5.3", | ||
"@thi.ng/strings": "^3.7.35" | ||
"@thi.ng/api": "^8.11.5", | ||
"@thi.ng/checks": "^3.6.7", | ||
"@thi.ng/errors": "^2.5.10", | ||
"@thi.ng/hiccup": "^5.2.4", | ||
"@thi.ng/paths": "^5.1.84", | ||
"@thi.ng/prefixes": "^2.3.22", | ||
"@thi.ng/rstream": "^8.5.4", | ||
"@thi.ng/strings": "^3.7.36" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.47.0", | ||
"esbuild": "^0.21.5", | ||
"typedoc": "^0.25.13", | ||
"typescript": "^5.5.2" | ||
"esbuild": "^0.23.0", | ||
"typedoc": "^0.26.3", | ||
"typescript": "^5.5.3" | ||
}, | ||
@@ -149,3 +149,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "4e1794f6c951adb73c27c3e6c08f7138d9445e8b\n" | ||
"gitHead": "70f493d9ccc97c5df5dda7e808e96cd1691097fc\n" | ||
} |
@@ -10,3 +10,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
> [!NOTE] | ||
> This is one of 189 standalone projects, maintained as part | ||
> This is one of 188 standalone projects, maintained as part | ||
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo | ||
@@ -319,3 +319,3 @@ > and anti-framework. | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.24 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.27 KB | ||
@@ -322,0 +322,0 @@ ## Dependencies |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134920
2162
Updated@thi.ng/api@^8.11.5
Updated@thi.ng/checks@^3.6.7
Updated@thi.ng/errors@^2.5.10
Updated@thi.ng/hiccup@^5.2.4
Updated@thi.ng/paths@^5.1.84
Updated@thi.ng/prefixes@^2.3.22
Updated@thi.ng/rstream@^8.5.4
Updated@thi.ng/strings@^3.7.36