@thi.ng/transducers-hdom 3.1.88 → 3.1.89
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 +1 -1
- package/index.js +24 -58
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -2,62 +2,28 @@ import { DEFAULT_IMPL } from "@thi.ng/hdom/default";
|
|
|
2
2
|
import { resolveRoot } from "@thi.ng/hdom/resolve";
|
|
3
3
|
import { derefContext } from "@thi.ng/hiccup/deref";
|
|
4
4
|
import { scan } from "@thi.ng/transducers/scan";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* [`thi.ng/rstream`](https://thi.ng/rstream) dataflow graph based applications,
|
|
30
|
-
* where it can be used as final leaf subscription to reactively reflect UI
|
|
31
|
-
* changes back to the user, without using the usual RAF update loop used by
|
|
32
|
-
* hdom by default. In this setup, DOM updates will only be performed when the
|
|
33
|
-
* stream this transducer is attached to emits new values (i.e. hdom component
|
|
34
|
-
* trees).
|
|
35
|
-
*
|
|
36
|
-
* Please see here for further details:
|
|
37
|
-
* [`start()`](https://docs.thi.ng/umbrella/hdom/functions/start.html)
|
|
38
|
-
*
|
|
39
|
-
* @param opts - hdom options
|
|
40
|
-
*/
|
|
41
|
-
export const updateDOM = (opts = {}, impl = DEFAULT_IMPL) => {
|
|
42
|
-
const _opts = { root: "app", ...opts };
|
|
43
|
-
const root = resolveRoot(_opts.root, impl);
|
|
44
|
-
return scan([
|
|
45
|
-
() => [],
|
|
46
|
-
(acc) => acc,
|
|
47
|
-
(prev, curr) => {
|
|
48
|
-
_opts.ctx = derefContext(opts.ctx, _opts.autoDerefKeys);
|
|
49
|
-
curr = impl.normalizeTree(_opts, curr);
|
|
50
|
-
if (curr != null) {
|
|
51
|
-
if (_opts.hydrate) {
|
|
52
|
-
impl.hydrateTree(_opts, root, curr);
|
|
53
|
-
_opts.hydrate = false;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
impl.diffTree(_opts, root, prev, curr, 0);
|
|
57
|
-
}
|
|
58
|
-
return curr;
|
|
59
|
-
}
|
|
60
|
-
return prev;
|
|
61
|
-
},
|
|
62
|
-
]);
|
|
5
|
+
const updateDOM = (opts = {}, impl = DEFAULT_IMPL) => {
|
|
6
|
+
const _opts = { root: "app", ...opts };
|
|
7
|
+
const root = resolveRoot(_opts.root, impl);
|
|
8
|
+
return scan([
|
|
9
|
+
() => [],
|
|
10
|
+
(acc) => acc,
|
|
11
|
+
(prev, curr) => {
|
|
12
|
+
_opts.ctx = derefContext(opts.ctx, _opts.autoDerefKeys);
|
|
13
|
+
curr = impl.normalizeTree(_opts, curr);
|
|
14
|
+
if (curr != null) {
|
|
15
|
+
if (_opts.hydrate) {
|
|
16
|
+
impl.hydrateTree(_opts, root, curr);
|
|
17
|
+
_opts.hydrate = false;
|
|
18
|
+
} else {
|
|
19
|
+
impl.diffTree(_opts, root, prev, curr, 0);
|
|
20
|
+
}
|
|
21
|
+
return curr;
|
|
22
|
+
}
|
|
23
|
+
return prev;
|
|
24
|
+
}
|
|
25
|
+
]);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
updateDOM
|
|
63
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transducers-hdom",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.89",
|
|
4
4
|
"description": "Transducer based UI updater for @thi.ng/hdom",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn
|
|
27
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
28
30
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
29
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
@@ -33,12 +35,13 @@
|
|
|
33
35
|
"test": "bun test"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@thi.ng/hdom": "^9.
|
|
37
|
-
"@thi.ng/hiccup": "^5.1.
|
|
38
|
-
"@thi.ng/transducers": "^8.8.
|
|
38
|
+
"@thi.ng/hdom": "^9.4.0",
|
|
39
|
+
"@thi.ng/hiccup": "^5.1.1",
|
|
40
|
+
"@thi.ng/transducers": "^8.8.15"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"@microsoft/api-extractor": "^7.38.3",
|
|
44
|
+
"esbuild": "^0.19.8",
|
|
42
45
|
"rimraf": "^5.0.5",
|
|
43
46
|
"tools": "^0.0.1",
|
|
44
47
|
"typedoc": "^0.25.4",
|
|
@@ -77,5 +80,5 @@
|
|
|
77
80
|
],
|
|
78
81
|
"year": 2018
|
|
79
82
|
},
|
|
80
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
|
|
81
84
|
}
|