foldkit 0.97.0 → 0.97.1
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/dist/html/lazy.d.ts +13 -2
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +13 -2
- package/package.json +1 -1
package/dist/html/lazy.d.ts
CHANGED
|
@@ -4,11 +4,22 @@ import type { Html } from './index.js';
|
|
|
4
4
|
* equal (`===`) to the previous call, the cached VNode is returned without
|
|
5
5
|
* re-running the view function. Snabbdom's `patchVnode` short-circuits when
|
|
6
6
|
* it sees the same VNode reference, so both VNode construction and subtree
|
|
7
|
-
* diffing are skipped.
|
|
7
|
+
* diffing are skipped.
|
|
8
|
+
*
|
|
9
|
+
* The cached VNode must be rendered at a single position in the tree.
|
|
10
|
+
* Snabbdom tracks the real DOM through each VNode's mutable `.elm` field
|
|
11
|
+
* and assumes one VNode per position. Rendering the same cached VNode at
|
|
12
|
+
* two positions causes patches to collide and can duplicate or misplace
|
|
13
|
+
* DOM nodes. If the same content needs to appear in multiple positions,
|
|
14
|
+
* create one slot per position. */
|
|
8
15
|
export declare const createLazy: () => (<Args extends ReadonlyArray<unknown>>(fn: (...args: Args) => Html, args: Args) => Html);
|
|
9
16
|
/** Creates a keyed memoization map for view functions rendered in a loop. Each
|
|
10
17
|
* key gets its own independent cache slot. On each render, only entries whose
|
|
11
18
|
* function reference, dispatch context, or arguments have changed by reference
|
|
12
|
-
* are recomputed.
|
|
19
|
+
* are recomputed.
|
|
20
|
+
*
|
|
21
|
+
* Like `createLazy`, each key's cached VNode must be rendered at a single
|
|
22
|
+
* position in the tree. If the same item needs to appear in multiple
|
|
23
|
+
* positions, create one keyed lazy per position. */
|
|
13
24
|
export declare const createKeyedLazy: () => (<Args extends ReadonlyArray<unknown>>(key: string, fn: (...args: Args) => Html, args: Args) => Html);
|
|
14
25
|
//# sourceMappingURL=lazy.d.ts.map
|
package/dist/html/lazy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/html/lazy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAsCtC
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/html/lazy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAsCtC;;;;;;;;;;;;oCAYoC;AACpC,eAAO,MAAM,UAAU,QAAO,CAAC,CAAC,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EACjE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EAC3B,IAAI,EAAE,IAAI,KACP,IAAI,CAUR,CAAA;AAED;;;;;;;qDAOqD;AACrD,eAAO,MAAM,eAAe,QAAO,CAAC,CAAC,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EACtE,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EAC3B,IAAI,EAAE,IAAI,KACP,IAAI,CAWR,CAAA"}
|
package/dist/html/lazy.js
CHANGED
|
@@ -19,7 +19,14 @@ const resolveOrCache = (previousEntry, fn, args, onCache) => Effect.gen(function
|
|
|
19
19
|
* equal (`===`) to the previous call, the cached VNode is returned without
|
|
20
20
|
* re-running the view function. Snabbdom's `patchVnode` short-circuits when
|
|
21
21
|
* it sees the same VNode reference, so both VNode construction and subtree
|
|
22
|
-
* diffing are skipped.
|
|
22
|
+
* diffing are skipped.
|
|
23
|
+
*
|
|
24
|
+
* The cached VNode must be rendered at a single position in the tree.
|
|
25
|
+
* Snabbdom tracks the real DOM through each VNode's mutable `.elm` field
|
|
26
|
+
* and assumes one VNode per position. Rendering the same cached VNode at
|
|
27
|
+
* two positions causes patches to collide and can duplicate or misplace
|
|
28
|
+
* DOM nodes. If the same content needs to appear in multiple positions,
|
|
29
|
+
* create one slot per position. */
|
|
23
30
|
export const createLazy = () => {
|
|
24
31
|
let cached;
|
|
25
32
|
return (fn, args) => resolveOrCache(cached, fn, args, entry => {
|
|
@@ -29,7 +36,11 @@ export const createLazy = () => {
|
|
|
29
36
|
/** Creates a keyed memoization map for view functions rendered in a loop. Each
|
|
30
37
|
* key gets its own independent cache slot. On each render, only entries whose
|
|
31
38
|
* function reference, dispatch context, or arguments have changed by reference
|
|
32
|
-
* are recomputed.
|
|
39
|
+
* are recomputed.
|
|
40
|
+
*
|
|
41
|
+
* Like `createLazy`, each key's cached VNode must be rendered at a single
|
|
42
|
+
* position in the tree. If the same item needs to appear in multiple
|
|
43
|
+
* positions, create one keyed lazy per position. */
|
|
33
44
|
export const createKeyedLazy = () => {
|
|
34
45
|
const cache = new Map();
|
|
35
46
|
return (key, fn, args) => resolveOrCache(cache.get(key), fn, args, entry => {
|