@thi.ng/rdom 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +4 -2
- package/compile.d.ts +7 -0
- package/compile.js +3 -2
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-07-
|
|
3
|
+
- **Last updated**: 2024-07-16T13:09:33Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,14 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [1.5.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.5.1) (2024-07-06)
|
|
13
|
+
|
|
14
|
+
#### 🩹 Bug fixes
|
|
15
|
+
|
|
16
|
+
- update $compile() handling of embedded functions ([#477](https://github.com/thi-ng/umbrella/issues/477)) ([5ac2831](https://github.com/thi-ng/umbrella/commit/5ac2831))
|
|
17
|
+
- add fn checks & branches to call embedded fn and compile its result
|
|
18
|
+
- update docs
|
|
19
|
+
|
|
12
20
|
## [1.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.5.0) (2024-07-03)
|
|
13
21
|
|
|
14
22
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 188 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -315,7 +315,7 @@ Browser ESM import:
|
|
|
315
315
|
|
|
316
316
|
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
317
317
|
|
|
318
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 4.
|
|
318
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.27 KB
|
|
319
319
|
|
|
320
320
|
## Dependencies
|
|
321
321
|
|
|
@@ -377,6 +377,8 @@ directory are using this package:
|
|
|
377
377
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/stacked-layout.png" width="240"/> | Responsive & reactively computed stacked column layout | [Demo](https://demo.thi.ng/umbrella/stacked-layout/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/stacked-layout) |
|
|
378
378
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/svg-resample.png" width="240"/> | SVG path parsing & dynamic resampling | [Demo](https://demo.thi.ng/umbrella/svg-resample/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/svg-resample) |
|
|
379
379
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/trace-bitmap.jpg" width="240"/> | Multi-layer vectorization & dithering of bitmap images | [Demo](https://demo.thi.ng/umbrella/trace-bitmap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/trace-bitmap) |
|
|
380
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/viz-ridge-lines.avif" width="240"/> | Interactive ridge-line plot | [Demo](https://demo.thi.ng/umbrella/viz-ridge-lines/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/viz-ridge-lines) |
|
|
381
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/viz-scatter-plot.avif" width="240"/> | Interactive scatter & line plot of low-discrepancy samples | [Demo](https://demo.thi.ng/umbrella/viz-scatter-plot/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/viz-scatter-plot) |
|
|
380
382
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-channel-mixer.jpg" width="240"/> | rdom & WebGL-based image channel editor | [Demo](https://demo.thi.ng/umbrella/webgl-channel-mixer/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-channel-mixer) |
|
|
381
383
|
|
|
382
384
|
## API
|
package/compile.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ import type { IComponent } from "./api.js";
|
|
|
13
13
|
* instances
|
|
14
14
|
* - [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html)
|
|
15
15
|
* instances
|
|
16
|
+
* - functions embedded in hiccup, i.e. either:
|
|
17
|
+
* - `[fn, ...args]`
|
|
18
|
+
* - `["tag", {}, ... noArgFn ...]`
|
|
16
19
|
*
|
|
17
20
|
* Any other value type will be wrapped in a `<span>` element. Reactive
|
|
18
21
|
* `ISubscribable` values can be used as element attributes or element
|
|
@@ -20,6 +23,10 @@ import type { IComponent } from "./api.js";
|
|
|
20
23
|
* target attribute. If used as element body, the reactive value will be wrapped
|
|
21
24
|
* using a {@link $sub} `<span>` with the value as its reactive body.
|
|
22
25
|
*
|
|
26
|
+
* If given any of the supported embedded function forms, the function will be
|
|
27
|
+
* called with given args (or without) and the result passed back to
|
|
28
|
+
* `$compile()`.
|
|
29
|
+
*
|
|
23
30
|
* **Important:** Use {@link $replace}, {@link $refresh} or {@link $switch} to
|
|
24
31
|
* wrap any reactive values/subscriptions which produce actual HTML
|
|
25
32
|
* elements/components/subtrees (in hiccup format). See docs for these functions
|
package/compile.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
2
|
import { isAsyncIterable } from "@thi.ng/checks/is-async-iterable";
|
|
3
|
+
import { isFunction } from "@thi.ng/checks/is-function";
|
|
3
4
|
import { isPlainObject } from "@thi.ng/checks/is-plain-object";
|
|
4
5
|
import { isSubscribable } from "@thi.ng/rstream/checks";
|
|
5
6
|
import { $async, $asyncA } from "./async.js";
|
|
@@ -7,7 +8,7 @@ import { isComponent, isElement } from "./checks.js";
|
|
|
7
8
|
import { $el, $remove, $tree } from "./dom.js";
|
|
8
9
|
import { $SubA, $sub } from "./sub.js";
|
|
9
10
|
import { $wrapEl, $wrapText } from "./wrap.js";
|
|
10
|
-
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);
|
|
11
|
+
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);
|
|
11
12
|
const __walk = (f, x, path = []) => {
|
|
12
13
|
if (isPlainObject(x)) {
|
|
13
14
|
for (const k in x) {
|
|
@@ -26,7 +27,7 @@ const __isComplexComponent = (x) => {
|
|
|
26
27
|
if (__isComplexComponent(x[i])) return true;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
return isSubscribable(x) || isAsyncIterable(x) || isComponent(x) || isElement(x);
|
|
30
|
+
return isSubscribable(x) || isAsyncIterable(x) || isComponent(x) || isFunction(x) || isElement(x);
|
|
30
31
|
};
|
|
31
32
|
const __complexComponent = (tree) => ({
|
|
32
33
|
async mount(parent, index = -1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rdom",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@thi.ng/api": "^8.11.
|
|
41
|
-
"@thi.ng/checks": "^3.6.
|
|
42
|
-
"@thi.ng/errors": "^2.5.
|
|
43
|
-
"@thi.ng/hiccup": "^5.2.
|
|
44
|
-
"@thi.ng/paths": "^5.1.
|
|
45
|
-
"@thi.ng/prefixes": "^2.3.
|
|
46
|
-
"@thi.ng/rstream": "^8.5.
|
|
47
|
-
"@thi.ng/strings": "^3.7.
|
|
40
|
+
"@thi.ng/api": "^8.11.5",
|
|
41
|
+
"@thi.ng/checks": "^3.6.7",
|
|
42
|
+
"@thi.ng/errors": "^2.5.11",
|
|
43
|
+
"@thi.ng/hiccup": "^5.2.5",
|
|
44
|
+
"@thi.ng/paths": "^5.1.85",
|
|
45
|
+
"@thi.ng/prefixes": "^2.3.22",
|
|
46
|
+
"@thi.ng/rstream": "^8.5.5",
|
|
47
|
+
"@thi.ng/strings": "^3.7.37"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@microsoft/api-extractor": "^7.47.0",
|
|
51
|
-
"esbuild": "^0.
|
|
52
|
-
"typedoc": "^0.
|
|
53
|
-
"typescript": "^5.5.
|
|
51
|
+
"esbuild": "^0.23.0",
|
|
52
|
+
"typedoc": "^0.26.3",
|
|
53
|
+
"typescript": "^5.5.3"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
|
56
56
|
"async",
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
],
|
|
146
146
|
"year": 2020
|
|
147
147
|
},
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "ba4f2cd15eeb0cae30efe222524da4fed2a57267\n"
|
|
149
149
|
}
|