foldkit 0.141.0 → 0.141.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.
@@ -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 functions rendered in a loop. Each
22
- * key gets its own independent cache slot. On each render, only entries whose
23
- * function reference, dispatch, or arguments have changed by reference are
24
- * recomputed.
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 item needs to appear in multiple
28
- * positions, create one keyed lazy per position. */
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
@@ -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;;;;;;;qDAOqD;AACrD,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"}
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 functions rendered in a loop. Each
76
- * key gets its own independent cache slot. On each render, only entries whose
77
- * function reference, dispatch, or arguments have changed by reference are
78
- * recomputed.
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 item needs to appear in multiple
82
- * positions, create one keyed lazy per position. */
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 => {
@@ -212,12 +212,12 @@ export type FoldWithOutMessage<ParentModel, ParentMessage, Input, ParentOutMessa
212
212
  * of the child's:
213
213
  *
214
214
  * ```ts
215
- * const joinRoom = (roomId: string, player: Player): UpdateStep =>
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, player: Player) =>
220
- * Room.join(room, player, { roomId }),
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,
@@ -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 joinRoom = (roomId: string, player: Player): UpdateStep =>
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, player: Player) =>
96
- * Room.join(room, player, { roomId }),
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.141.0",
3
+ "version": "0.141.2",
4
4
  "description": "A TypeScript frontend framework, built on Effect and architected like Elm",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -154,14 +154,14 @@
154
154
  "THIRD-PARTY-NOTICES.md"
155
155
  ],
156
156
  "peerDependencies": {
157
- "@effect/platform-browser": "4.0.0-beta.105",
158
- "effect": "4.0.0-beta.105"
157
+ "@effect/platform-browser": "4.0.0-beta.106",
158
+ "effect": "4.0.0-beta.106"
159
159
  },
160
160
  "devDependencies": {
161
- "@effect/platform-browser": "4.0.0-beta.105",
162
- "@effect/vitest": "4.0.0-beta.105",
161
+ "@effect/platform-browser": "4.0.0-beta.106",
162
+ "@effect/vitest": "4.0.0-beta.106",
163
163
  "@vitest/coverage-v8": "^4.1.9",
164
- "effect": "4.0.0-beta.105",
164
+ "effect": "4.0.0-beta.106",
165
165
  "happy-dom": "^20.10.4",
166
166
  "rimraf": "^6.1.3",
167
167
  "typedoc": "^0.28.19",