foldkit 0.141.0 → 0.141.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 +21 -6
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +21 -6
- package/dist/update/update.d.ts +3 -3
- package/dist/update/update.js +3 -3
- package/package.json +1 -1
package/dist/html/lazy.d.ts
CHANGED
|
@@ -18,13 +18,28 @@ import { type VNode } from '../vdom.js';
|
|
|
18
18
|
* DOM nodes. If the same content needs to appear in multiple positions,
|
|
19
19
|
* create one slot per position. */
|
|
20
20
|
export declare const createLazy: () => (<Args extends ReadonlyArray<unknown>>(fn: (...args: Args) => VNode | null, args: Args) => VNode | null);
|
|
21
|
-
/** Creates a keyed memoization map for view
|
|
22
|
-
* key gets its own independent cache slot
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
/** Creates a keyed memoization map for one view function rendered under many
|
|
22
|
+
* keys. Each key gets its own independent cache slot, compared exactly the way
|
|
23
|
+
* `createLazy` compares its single slot: on each render, only the keys whose
|
|
24
|
+
* function reference, dispatch, or arguments changed by reference are
|
|
25
|
+
* recomputed. For example: a list rendering one row view per item, a detail
|
|
26
|
+
* view rendering one entity per route, or one view function rendered at two
|
|
27
|
+
* call sites.
|
|
28
|
+
*
|
|
29
|
+
* Key by the identifier that already gives the rendered thing its DOM
|
|
30
|
+
* identity. A row keyed `todo.id` through `h.keyed` memoizes under `todo.id`;
|
|
31
|
+
* a detail page keyed `post.slug` memoizes under `post.slug`. Reusing that one
|
|
32
|
+
* identifier keeps the memo and the DOM invalidating together.
|
|
33
|
+
*
|
|
34
|
+
* Entries are never evicted, so keys are expected to be bounded, such as an
|
|
35
|
+
* entity registry, a route table, or a fixed set of call sites. A key drawn
|
|
36
|
+
* from something unbounded, such as a search query or a paged cursor, grows
|
|
37
|
+
* the map for the lifetime of the page. If that becomes the shape an app
|
|
38
|
+
* needs, the upgrade path is a variant that drops keys absent from the latest
|
|
39
|
+
* render pass, not a cap on this one.
|
|
25
40
|
*
|
|
26
41
|
* Like `createLazy`, each key's cached VNode must be rendered at a single
|
|
27
|
-
* position in the tree. If the same
|
|
28
|
-
* positions,
|
|
42
|
+
* position in the tree. If the same content needs to appear in multiple
|
|
43
|
+
* positions, give each position its own key. */
|
|
29
44
|
export declare const createKeyedLazy: () => (<Args extends ReadonlyArray<unknown>>(key: PropertyKey, fn: (...args: Args) => VNode | null, args: Args) => VNode | null);
|
|
30
45
|
//# 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":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAwC,MAAM,YAAY,CAAA;AAmF7E;;;;;;;;;;;;;;;;;oCAiBoC;AACpC,eAAO,MAAM,UAAU,QAAO,CAAC,CAAC,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EACjE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,KAAK,GAAG,IAAI,EACnC,IAAI,EAAE,IAAI,KACP,KAAK,GAAG,IAAI,CAUhB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/html/lazy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAwC,MAAM,YAAY,CAAA;AAmF7E;;;;;;;;;;;;;;;;;oCAiBoC;AACpC,eAAO,MAAM,UAAU,QAAO,CAAC,CAAC,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EACjE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,KAAK,GAAG,IAAI,EACnC,IAAI,EAAE,IAAI,KACP,KAAK,GAAG,IAAI,CAUhB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;iDAsBiD;AACjD,eAAO,MAAM,eAAe,QAAO,CAAC,CAAC,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EACtE,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,KAAK,GAAG,IAAI,EACnC,IAAI,EAAE,IAAI,KACP,KAAK,GAAG,IAAI,CAWhB,CAAA"}
|
package/dist/html/lazy.js
CHANGED
|
@@ -72,14 +72,29 @@ export const createLazy = () => {
|
|
|
72
72
|
cached = entry;
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
|
-
/** Creates a keyed memoization map for view
|
|
76
|
-
* key gets its own independent cache slot
|
|
77
|
-
*
|
|
78
|
-
*
|
|
75
|
+
/** Creates a keyed memoization map for one view function rendered under many
|
|
76
|
+
* keys. Each key gets its own independent cache slot, compared exactly the way
|
|
77
|
+
* `createLazy` compares its single slot: on each render, only the keys whose
|
|
78
|
+
* function reference, dispatch, or arguments changed by reference are
|
|
79
|
+
* recomputed. For example: a list rendering one row view per item, a detail
|
|
80
|
+
* view rendering one entity per route, or one view function rendered at two
|
|
81
|
+
* call sites.
|
|
82
|
+
*
|
|
83
|
+
* Key by the identifier that already gives the rendered thing its DOM
|
|
84
|
+
* identity. A row keyed `todo.id` through `h.keyed` memoizes under `todo.id`;
|
|
85
|
+
* a detail page keyed `post.slug` memoizes under `post.slug`. Reusing that one
|
|
86
|
+
* identifier keeps the memo and the DOM invalidating together.
|
|
87
|
+
*
|
|
88
|
+
* Entries are never evicted, so keys are expected to be bounded, such as an
|
|
89
|
+
* entity registry, a route table, or a fixed set of call sites. A key drawn
|
|
90
|
+
* from something unbounded, such as a search query or a paged cursor, grows
|
|
91
|
+
* the map for the lifetime of the page. If that becomes the shape an app
|
|
92
|
+
* needs, the upgrade path is a variant that drops keys absent from the latest
|
|
93
|
+
* render pass, not a cap on this one.
|
|
79
94
|
*
|
|
80
95
|
* Like `createLazy`, each key's cached VNode must be rendered at a single
|
|
81
|
-
* position in the tree. If the same
|
|
82
|
-
* positions,
|
|
96
|
+
* position in the tree. If the same content needs to appear in multiple
|
|
97
|
+
* positions, give each position its own key. */
|
|
83
98
|
export const createKeyedLazy = () => {
|
|
84
99
|
const cache = new Map();
|
|
85
100
|
return (key, fn, args) => resolveOrCache(cache.get(key), fn, args, entry => {
|
package/dist/update/update.d.ts
CHANGED
|
@@ -212,12 +212,12 @@ export type FoldWithOutMessage<ParentModel, ParentMessage, Input, ParentOutMessa
|
|
|
212
212
|
* of the child's:
|
|
213
213
|
*
|
|
214
214
|
* ```ts
|
|
215
|
-
* const
|
|
215
|
+
* const enterJoinedRoom = (roomId: string, player: Player): UpdateStep =>
|
|
216
216
|
* Update.combine([
|
|
217
217
|
* model => [model, [NavigateToRoom({ roomId })]],
|
|
218
218
|
* Update.foldChild({
|
|
219
|
-
* update: (room: Room.Model,
|
|
220
|
-
* Room.
|
|
219
|
+
* update: (room: Room.Model, joinedPlayer: Player) =>
|
|
220
|
+
* Room.informJoined(room, joinedPlayer, { roomId }),
|
|
221
221
|
* read: readRoom,
|
|
222
222
|
* write: writeRoom,
|
|
223
223
|
* toParentMessage: toGotRoomMessage,
|
package/dist/update/update.js
CHANGED
|
@@ -88,12 +88,12 @@ export const refresh = (refreshable) => model => pipe(refreshable.read(model), O
|
|
|
88
88
|
* of the child's:
|
|
89
89
|
*
|
|
90
90
|
* ```ts
|
|
91
|
-
* const
|
|
91
|
+
* const enterJoinedRoom = (roomId: string, player: Player): UpdateStep =>
|
|
92
92
|
* Update.combine([
|
|
93
93
|
* model => [model, [NavigateToRoom({ roomId })]],
|
|
94
94
|
* Update.foldChild({
|
|
95
|
-
* update: (room: Room.Model,
|
|
96
|
-
* Room.
|
|
95
|
+
* update: (room: Room.Model, joinedPlayer: Player) =>
|
|
96
|
+
* Room.informJoined(room, joinedPlayer, { roomId }),
|
|
97
97
|
* read: readRoom,
|
|
98
98
|
* write: writeRoom,
|
|
99
99
|
* toParentMessage: toGotRoomMessage,
|