@askrjs/askr 0.0.36 → 0.0.37

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.
Files changed (96) hide show
  1. package/README.md +17 -9
  2. package/dist/bench/components/benchmark-table.js +1 -1
  3. package/dist/bench/components/benchmark-table.js.map +1 -1
  4. package/dist/benchmark.js +3 -3
  5. package/dist/boot/index.d.ts +1 -7
  6. package/dist/boot/index.d.ts.map +1 -1
  7. package/dist/boot/index.js +22 -13
  8. package/dist/boot/index.js.map +1 -1
  9. package/dist/components/index.d.ts +2 -0
  10. package/dist/components/index.js +2 -0
  11. package/dist/components/link.d.ts +4 -5
  12. package/dist/components/link.d.ts.map +1 -1
  13. package/dist/components/link.js +2 -1
  14. package/dist/components/link.js.map +1 -1
  15. package/dist/foundations/icon/icon.d.ts.map +1 -1
  16. package/dist/foundations/icon/icon.js.map +1 -1
  17. package/dist/foundations/icon/icon.types.d.ts +2 -1
  18. package/dist/foundations/icon/icon.types.d.ts.map +1 -1
  19. package/dist/foundations/icon/index.d.ts +3 -0
  20. package/dist/foundations/icon/index.js +2 -0
  21. package/dist/foundations/index.d.ts +1 -18
  22. package/dist/foundations/index.js +2 -18
  23. package/dist/foundations/interactions/index.d.ts +7 -0
  24. package/dist/foundations/interactions/index.js +7 -0
  25. package/dist/foundations/interactions/interaction-policy.js +2 -2
  26. package/dist/foundations/state/index.d.ts +2 -0
  27. package/dist/foundations/state/index.js +2 -0
  28. package/dist/foundations/structures/index.d.ts +8 -0
  29. package/dist/foundations/structures/index.js +7 -0
  30. package/dist/foundations/utilities/index.d.ts +7 -0
  31. package/dist/foundations/utilities/index.js +6 -0
  32. package/dist/index.d.ts +2 -16
  33. package/dist/index.js +1 -17
  34. package/dist/index.js.map +1 -1
  35. package/dist/jsx-dev-runtime.d.ts +1 -1
  36. package/dist/jsx-dev-runtime.js.map +1 -1
  37. package/dist/jsx-runtime.d.ts +1 -1
  38. package/dist/jsx-runtime.js.map +1 -1
  39. package/dist/renderer/dom.js +26 -366
  40. package/dist/renderer/dom.js.map +1 -1
  41. package/dist/renderer/evaluate.js.map +1 -1
  42. package/dist/renderer/fastpath.js +20 -18
  43. package/dist/renderer/fastpath.js.map +1 -1
  44. package/dist/renderer/for-commit.js +486 -0
  45. package/dist/renderer/for-commit.js.map +1 -0
  46. package/dist/renderer/index.js.map +1 -1
  47. package/dist/renderer/keyed.js +84 -23
  48. package/dist/renderer/keyed.js.map +1 -1
  49. package/dist/renderer/reconcile.js +11 -18
  50. package/dist/renderer/reconcile.js.map +1 -1
  51. package/dist/renderer/utils.js +5 -1
  52. package/dist/renderer/utils.js.map +1 -1
  53. package/dist/resources/index.d.ts +1 -2
  54. package/dist/resources/index.js +1 -2
  55. package/dist/router/route.js +1 -1
  56. package/dist/runtime/for.d.ts.map +1 -1
  57. package/dist/runtime/for.js +33 -21
  58. package/dist/runtime/for.js.map +1 -1
  59. package/dist/runtime/operations.js +1 -1
  60. package/dist/runtime/selector.d.ts.map +1 -1
  61. package/dist/runtime/selector.js +180 -103
  62. package/dist/runtime/selector.js.map +1 -1
  63. package/dist/ssg/index.d.ts +1 -6
  64. package/dist/ssg/index.js +1 -6
  65. package/dist/ssr/context.d.ts +2 -1
  66. package/dist/ssr/context.d.ts.map +1 -1
  67. package/dist/ssr/context.js +28 -11
  68. package/dist/ssr/context.js.map +1 -1
  69. package/dist/ssr/index.d.ts +2 -31
  70. package/dist/ssr/index.d.ts.map +1 -1
  71. package/dist/ssr/index.js +4 -46
  72. package/dist/ssr/index.js.map +1 -1
  73. package/dist/ssr/render-keys.js +1 -12
  74. package/dist/ssr/render-keys.js.map +1 -1
  75. package/dist/ssr/verify-hydration.js +25 -0
  76. package/dist/ssr/verify-hydration.js.map +1 -0
  77. package/package.json +39 -16
  78. package/dist/_virtual/_rolldown/runtime.js +0 -7
  79. package/dist/foundations/core.d.ts +0 -15
  80. package/dist/foundations/core.js +0 -13
  81. package/dist/foundations/structures.d.ts +0 -7
  82. package/dist/foundations/structures.js +0 -6
  83. package/dist/ssg/batch-render.d.ts +0 -16
  84. package/dist/ssg/batch-render.d.ts.map +0 -1
  85. package/dist/ssg/generate-metadata.d.ts +0 -24
  86. package/dist/ssg/generate-metadata.d.ts.map +0 -1
  87. package/dist/ssg/resolve-ssg-data.d.ts +0 -23
  88. package/dist/ssg/resolve-ssg-data.d.ts.map +0 -1
  89. package/dist/ssg/route-utils.d.ts +0 -16
  90. package/dist/ssg/route-utils.d.ts.map +0 -1
  91. package/dist/ssg/write-static-files.d.ts +0 -15
  92. package/dist/ssg/write-static-files.d.ts.map +0 -1
  93. package/dist/ssr/render-keys.d.ts +0 -37
  94. package/dist/ssr/render-keys.d.ts.map +0 -1
  95. package/dist/ssr/stream-render.js +0 -88
  96. package/dist/ssr/stream-render.js.map +0 -1
@@ -0,0 +1,486 @@
1
+ import { canUseDirectReplaceChildrenSpread } from "./utils.js";
2
+ import { keyedElements } from "./keyed.js";
3
+ import { teardownNodeSubtree } from "./cleanup.js";
4
+ import { recordBenchCounter, recordBenchEvent, recordBenchTiming, withBenchMetricScope } from "../runtime/for-bench.js";
5
+ import { clearForDomUpdateState } from "../runtime/for.js";
6
+ //#region src/renderer/for-commit.ts
7
+ function getOrBuildDomKeyMap(parent) {
8
+ let keyMap = keyedElements.get(parent);
9
+ if (!keyMap) {
10
+ keyMap = /* @__PURE__ */ new Map();
11
+ for (let child = parent.firstElementChild; child; child = child.nextElementSibling) {
12
+ const key = child.getAttribute("data-key");
13
+ if (key !== null) {
14
+ keyMap.set(key, child);
15
+ const numericKey = Number(key);
16
+ if (!Number.isNaN(numericKey)) keyMap.set(numericKey, child);
17
+ }
18
+ }
19
+ if (keyMap.size > 0) keyedElements.set(parent, keyMap);
20
+ }
21
+ return keyMap.size > 0 ? keyMap : void 0;
22
+ }
23
+ function hydrateExistingForDomInOrder(parent, forState) {
24
+ if (parent.children.length !== forState.orderedKeys.length) return false;
25
+ for (let i = 0; i < forState.orderedKeys.length; i += 1) {
26
+ const itemKey = forState.orderedKeys[i];
27
+ const itemInstance = forState.items.get(itemKey);
28
+ const currentDom = parent.children[i];
29
+ if (!itemInstance || currentDom.getAttribute("data-key") !== String(itemKey)) return false;
30
+ itemInstance.scope.dom = currentDom;
31
+ itemInstance.scope.needsDomUpdate = true;
32
+ }
33
+ return true;
34
+ }
35
+ function removeForBoundaryNodes(parent, removedNodes) {
36
+ if (removedNodes.length > 0 && removedNodes.length === parent.childNodes.length) {
37
+ let canBulkClear = true;
38
+ for (let i = 0; i < removedNodes.length; i++) if (removedNodes[i].parentNode !== parent) {
39
+ canBulkClear = false;
40
+ break;
41
+ }
42
+ if (canBulkClear) {
43
+ for (let i = 0; i < removedNodes.length; i++) {
44
+ recordBenchEvent("domRemove");
45
+ teardownNodeSubtree(removedNodes[i]);
46
+ }
47
+ withBenchMetricScope("fullClear", () => {
48
+ recordBenchCounter("bulkClearCommits");
49
+ parent.textContent = "";
50
+ });
51
+ return;
52
+ }
53
+ }
54
+ for (let i = 0; i < removedNodes.length; i++) {
55
+ const node = removedNodes[i];
56
+ if (node.parentNode === parent) {
57
+ recordBenchEvent("domRemove");
58
+ teardownNodeSubtree(node);
59
+ parent.removeChild(node);
60
+ }
61
+ }
62
+ }
63
+ function syncKeyedMapFromForState(parent, forState, strategy, removedNodes) {
64
+ const existing = keyedElements.get(parent);
65
+ const ensureMapEntry = (map, key, element) => {
66
+ map.set(key, element);
67
+ const keyString = String(key);
68
+ map.set(keyString, element);
69
+ const keyNumber = Number(keyString);
70
+ if (!Number.isNaN(keyNumber)) map.set(keyNumber, element);
71
+ };
72
+ if (strategy === "SWAP") {
73
+ if (existing) return;
74
+ }
75
+ if (strategy === "FULL_KEYED" && existing && removedNodes.length === 0) return;
76
+ if (strategy === "NO_REORDER") {
77
+ if (existing && removedNodes.length === 0) return;
78
+ if (existing) {
79
+ for (const [mapKey, element] of existing) if (element.parentNode !== parent) existing.delete(mapKey);
80
+ if (existing.size > 0) keyedElements.set(parent, existing);
81
+ else keyedElements.delete(parent);
82
+ return;
83
+ }
84
+ }
85
+ if (strategy === "TRUNCATE" && forState.orderedKeys.length === 0) {
86
+ if (existing) existing.clear();
87
+ keyedElements.delete(parent);
88
+ return;
89
+ }
90
+ if (strategy === "APPEND" && existing) {
91
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
92
+ const key = forState.orderedKeys[i];
93
+ if (key === null || existing.has(key)) continue;
94
+ const itemInstance = forState.items.get(key);
95
+ if (itemInstance?.scope.dom instanceof Element) ensureMapEntry(existing, key, itemInstance.scope.dom);
96
+ }
97
+ if (existing.size > 0) keyedElements.set(parent, existing);
98
+ else keyedElements.delete(parent);
99
+ return;
100
+ }
101
+ const nextMap = existing ?? /* @__PURE__ */ new Map();
102
+ nextMap.clear();
103
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
104
+ const key = forState.orderedKeys[i];
105
+ if (key === null) continue;
106
+ const itemInstance = forState.items.get(key);
107
+ if (itemInstance?.scope.dom instanceof Element) ensureMapEntry(nextMap, key, itemInstance.scope.dom);
108
+ }
109
+ if (nextMap.size > 0) keyedElements.set(parent, nextMap);
110
+ else keyedElements.delete(parent);
111
+ }
112
+ function replaceChildrenInOrder(parent, nodes, allowDirectSpread) {
113
+ if (allowDirectSpread && canUseDirectReplaceChildrenSpread(nodes.length)) {
114
+ parent.replaceChildren(...nodes);
115
+ return;
116
+ }
117
+ const fragment = parent.ownerDocument.createDocumentFragment();
118
+ for (let i = 0; i < nodes.length; i++) fragment.appendChild(nodes[i]);
119
+ parent.replaceChildren(fragment);
120
+ }
121
+ function getLISIndices(sequence) {
122
+ if (sequence.length === 0) return [];
123
+ const predecessors = sequence.slice();
124
+ const lisIndices = [0];
125
+ for (let i = 1; i < sequence.length; i += 1) {
126
+ const current = sequence[i];
127
+ const lastLisIndex = lisIndices[lisIndices.length - 1];
128
+ if (sequence[lastLisIndex] < current) {
129
+ predecessors[i] = lastLisIndex;
130
+ lisIndices.push(i);
131
+ continue;
132
+ }
133
+ let lo = 0;
134
+ let hi = lisIndices.length - 1;
135
+ while (lo < hi) {
136
+ const mid = lo + hi >> 1;
137
+ if (sequence[lisIndices[mid]] < current) lo = mid + 1;
138
+ else hi = mid;
139
+ }
140
+ if (current < sequence[lisIndices[lo]]) {
141
+ if (lo > 0) predecessors[i] = lisIndices[lo - 1];
142
+ lisIndices[lo] = i;
143
+ }
144
+ }
145
+ let cursor = lisIndices.length - 1;
146
+ let index = lisIndices[cursor];
147
+ while (cursor >= 0) {
148
+ lisIndices[cursor] = index;
149
+ index = predecessors[index];
150
+ cursor -= 1;
151
+ }
152
+ return lisIndices;
153
+ }
154
+ function commitMoveOnlyReorder(parent, nodes) {
155
+ const currentNodes = Array.from(parent.childNodes);
156
+ if (currentNodes.length !== nodes.length) return false;
157
+ const currentIndexByNode = /* @__PURE__ */ new Map();
158
+ for (let i = 0; i < currentNodes.length; i += 1) currentIndexByNode.set(currentNodes[i], i);
159
+ const positions = Array.from({ length: nodes.length }, () => 0);
160
+ for (let i = 0; i < nodes.length; i += 1) {
161
+ const position = currentIndexByNode.get(nodes[i]);
162
+ if (position === void 0) return false;
163
+ positions[i] = position;
164
+ }
165
+ const lisIndices = getLISIndices(positions);
166
+ if (lisIndices.length === nodes.length) return true;
167
+ let lisCursor = lisIndices.length - 1;
168
+ let anchor = null;
169
+ for (let i = nodes.length - 1; i >= 0; i -= 1) {
170
+ const node = nodes[i];
171
+ if (lisCursor >= 0 && i === lisIndices[lisCursor]) {
172
+ anchor = node;
173
+ lisCursor -= 1;
174
+ continue;
175
+ }
176
+ if (node.nextSibling !== anchor) {
177
+ recordBenchEvent("domMove");
178
+ parent.insertBefore(node, anchor);
179
+ }
180
+ anchor = node;
181
+ }
182
+ return true;
183
+ }
184
+ function commitForStateBoundaryChildren(parent, forState, childrenVNodes, runtime) {
185
+ const domCommitStart = performance.now();
186
+ const hydrateExistingForDom = () => {
187
+ if (hydrateExistingForDomInOrder(parent, forState)) return;
188
+ const domKeyMap = getOrBuildDomKeyMap(parent);
189
+ if (!domKeyMap) return;
190
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
191
+ const itemKey = forState.orderedKeys[i];
192
+ const itemInstance = forState.items.get(itemKey);
193
+ if (!itemInstance || itemInstance.scope.dom) continue;
194
+ const existingDom = domKeyMap.get(itemKey);
195
+ if (!existingDom) continue;
196
+ itemInstance.scope.dom = existingDom;
197
+ itemInstance.scope.needsDomUpdate = true;
198
+ }
199
+ };
200
+ if (forState.orderedKeys.length === 0) {
201
+ removeForBoundaryNodes(parent, forState.lastRemovedNodes);
202
+ const fallbackScope = forState.fallbackScope;
203
+ const fallbackVNode = childrenVNodes[0];
204
+ const nextDom = fallbackScope && fallbackVNode !== void 0 ? runtime.syncForItemDom(parent, fallbackScope, fallbackVNode) : null;
205
+ if (nextDom) {
206
+ if (parent.childNodes.length !== 1 || parent.firstChild !== nextDom || forState.lastRemovedNodes.length > 0) parent.replaceChildren(nextDom);
207
+ } else if (parent.firstChild) parent.textContent = "";
208
+ keyedElements.delete(parent);
209
+ forState._hasResolvedItemDom = false;
210
+ recordBenchTiming("domCommit", performance.now() - domCommitStart);
211
+ clearForDomUpdateState(forState);
212
+ return;
213
+ }
214
+ if (!forState._hasResolvedItemDom && parent.childNodes.length > 0) hydrateExistingForDom();
215
+ const getDirtyForIndices = () => {
216
+ const pendingDirtyIndices = forState.pendingDirtyIndices;
217
+ if (pendingDirtyIndices && pendingDirtyIndices.length > 0) return pendingDirtyIndices;
218
+ const dirtyIndices = [];
219
+ for (let index = 0; index < forState.orderedKeys.length; index += 1) if (forState.orderedItems[index]?.scope.needsDomUpdate) dirtyIndices.push(index);
220
+ return dirtyIndices;
221
+ };
222
+ let dirtyIndicesCache = null;
223
+ const ensureDirtyIndices = () => {
224
+ if (dirtyIndicesCache) return dirtyIndicesCache;
225
+ dirtyIndicesCache = getDirtyForIndices();
226
+ return dirtyIndicesCache;
227
+ };
228
+ const dirtyIndices = forState.lastCommitStrategy === "NO_REORDER" ? ensureDirtyIndices() : [];
229
+ let boundaryChildrenExact = false;
230
+ const commitDirtyNoReorder = (dirtyIndices) => {
231
+ if (dirtyIndices.length === 0) {
232
+ boundaryChildrenExact = true;
233
+ return;
234
+ }
235
+ const orderedItems = forState.orderedItems;
236
+ const childNodes = parent.childNodes;
237
+ for (let dirtyIndex = 0; dirtyIndex < dirtyIndices.length; dirtyIndex++) {
238
+ const i = dirtyIndices[dirtyIndex];
239
+ const itemInstance = orderedItems[i];
240
+ if (!itemInstance) continue;
241
+ if (runtime.tryPatchStableForDirtyItem(itemInstance.scope)) continue;
242
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
243
+ if (!dom) continue;
244
+ const anchor = childNodes[i] ?? null;
245
+ if (dom.parentNode !== parent || dom !== anchor) {
246
+ recordBenchEvent("domInsert");
247
+ parent.insertBefore(dom, anchor);
248
+ }
249
+ }
250
+ boundaryChildrenExact = true;
251
+ };
252
+ const commitPositional = () => {
253
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
254
+ const itemInstance = forState.orderedItems[i];
255
+ if (!itemInstance) continue;
256
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
257
+ if (!dom) continue;
258
+ if (dom.parentNode !== parent) {
259
+ const anchor = parent.childNodes[i] ?? null;
260
+ recordBenchEvent("domInsert");
261
+ parent.insertBefore(dom, anchor);
262
+ }
263
+ }
264
+ boundaryChildrenExact = true;
265
+ };
266
+ const commitAppend = () => {
267
+ if (!forState._hasResolvedItemDom && forState.lastRemovedNodes.length === 0 && parent.childNodes.length === forState.orderedKeys.length) {
268
+ let exactOrder = true;
269
+ let currentNode = parent.firstChild;
270
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
271
+ const itemInstance = forState.orderedItems[i];
272
+ if (!itemInstance) {
273
+ exactOrder = false;
274
+ currentNode = currentNode?.nextSibling ?? null;
275
+ continue;
276
+ }
277
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
278
+ if (!dom || dom.parentNode !== parent || dom !== currentNode) exactOrder = false;
279
+ currentNode = currentNode?.nextSibling ?? null;
280
+ }
281
+ if (exactOrder) {
282
+ boundaryChildrenExact = true;
283
+ return;
284
+ }
285
+ }
286
+ withBenchMetricScope("coldCreate", () => {
287
+ const fragment = parent.ownerDocument.createDocumentFragment();
288
+ let hasPendingAppend = false;
289
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
290
+ const itemInstance = forState.orderedItems[i];
291
+ if (!itemInstance) continue;
292
+ if (itemInstance.scope.dom?.parentNode === parent && !itemInstance.scope.needsDomUpdate) continue;
293
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
294
+ if (!dom) continue;
295
+ if (dom.parentNode !== parent) {
296
+ recordBenchEvent("domInsert");
297
+ fragment.appendChild(dom);
298
+ hasPendingAppend = true;
299
+ }
300
+ }
301
+ if (hasPendingAppend) parent.appendChild(fragment);
302
+ });
303
+ boundaryChildrenExact = true;
304
+ };
305
+ const commitSwap = () => {
306
+ const swapIndices = forState.pendingSwapIndices;
307
+ if (!swapIndices) return;
308
+ let [firstIndex, secondIndex] = swapIndices;
309
+ if (firstIndex === secondIndex) return;
310
+ if (firstIndex > secondIndex) [firstIndex, secondIndex] = [secondIndex, firstIndex];
311
+ const firstKey = forState.orderedKeys[firstIndex];
312
+ const secondKey = forState.orderedKeys[secondIndex];
313
+ const firstItem = forState.items.get(firstKey);
314
+ const secondItem = forState.items.get(secondKey);
315
+ if (!firstItem || !secondItem) {
316
+ commitReorder();
317
+ return;
318
+ }
319
+ const firstDom = runtime.syncForItemDom(parent, firstItem.scope, childrenVNodes[firstIndex]);
320
+ const secondDom = runtime.syncForItemDom(parent, secondItem.scope, childrenVNodes[secondIndex]);
321
+ if (!firstDom || !secondDom) {
322
+ commitReorder();
323
+ return;
324
+ }
325
+ if (firstDom.parentNode !== parent || secondDom.parentNode !== parent) {
326
+ commitReorder();
327
+ return;
328
+ }
329
+ if ((firstDom.compareDocumentPosition(secondDom) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0) {
330
+ boundaryChildrenExact = true;
331
+ return;
332
+ }
333
+ const firstNextSibling = firstDom.nextSibling;
334
+ recordBenchEvent("domMove");
335
+ parent.insertBefore(firstDom, secondDom);
336
+ recordBenchEvent("domMove");
337
+ parent.insertBefore(secondDom, firstNextSibling);
338
+ boundaryChildrenExact = true;
339
+ };
340
+ const commitReorder = () => {
341
+ const items = forState.orderedItems;
342
+ const count = items.length;
343
+ if (forState.pendingMoveOnly && forState.lastRemovedNodes.length === 0) {
344
+ const nodes = Array(count);
345
+ let movedCount = 0;
346
+ let insertedCount = 0;
347
+ for (let i = 0; i < count; i++) {
348
+ const itemInstance = items[i];
349
+ if (!itemInstance) return;
350
+ const scope = itemInstance.scope;
351
+ const dom = scope.dom && !scope.needsDomUpdate ? scope.dom : runtime.syncForItemDom(parent, scope, childrenVNodes[i]);
352
+ if (!dom) return;
353
+ if (dom.parentNode === parent) movedCount++;
354
+ else insertedCount++;
355
+ nodes[i] = dom;
356
+ }
357
+ if (!canUseDirectReplaceChildrenSpread(count)) {
358
+ if (movedCount > 0) recordBenchEvent("domMove", movedCount);
359
+ if (insertedCount > 0) recordBenchEvent("domInsert", insertedCount);
360
+ replaceChildrenInOrder(parent, nodes, false);
361
+ boundaryChildrenExact = true;
362
+ return;
363
+ }
364
+ if (insertedCount > 0) {
365
+ if (movedCount > 0) recordBenchEvent("domMove", movedCount);
366
+ recordBenchEvent("domInsert", insertedCount);
367
+ replaceChildrenInOrder(parent, nodes, true);
368
+ boundaryChildrenExact = true;
369
+ return;
370
+ }
371
+ if (count > 1 && commitMoveOnlyReorder(parent, nodes)) {
372
+ boundaryChildrenExact = true;
373
+ return;
374
+ }
375
+ if (movedCount > 0) recordBenchEvent("domMove", movedCount);
376
+ if (insertedCount > 0) recordBenchEvent("domInsert", insertedCount);
377
+ replaceChildrenInOrder(parent, nodes, true);
378
+ boundaryChildrenExact = true;
379
+ return;
380
+ }
381
+ let hasExistingChild = false;
382
+ for (let i = 0; i < count; i++) if (items[i]?.scope.dom?.parentNode === parent) {
383
+ hasExistingChild = true;
384
+ break;
385
+ }
386
+ if (!hasExistingChild) {
387
+ withBenchMetricScope("coldCreate", () => {
388
+ const nodes = [];
389
+ for (let i = 0; i < count; i++) {
390
+ const itemInstance = items[i];
391
+ if (!itemInstance) continue;
392
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
393
+ if (dom) {
394
+ recordBenchEvent("domInsert");
395
+ nodes.push(dom);
396
+ }
397
+ }
398
+ recordBenchCounter("replaceChildrenCommits");
399
+ replaceChildrenInOrder(parent, nodes, false);
400
+ });
401
+ boundaryChildrenExact = true;
402
+ return;
403
+ }
404
+ if (forState.lastRemovedNodes.length === 0) {
405
+ const nodes = [];
406
+ for (let i = 0; i < count; i++) {
407
+ const itemInstance = items[i];
408
+ if (!itemInstance) continue;
409
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
410
+ if (!dom) continue;
411
+ recordBenchEvent(dom.parentNode === parent ? "domMove" : "domInsert");
412
+ nodes.push(dom);
413
+ }
414
+ replaceChildrenInOrder(parent, nodes, false);
415
+ boundaryChildrenExact = true;
416
+ return;
417
+ }
418
+ for (let i = 0; i < count; i++) {
419
+ const itemInstance = items[i];
420
+ if (!itemInstance) continue;
421
+ const dom = runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
422
+ if (!dom) continue;
423
+ const anchor = parent.childNodes[i] ?? null;
424
+ if (dom !== anchor) {
425
+ recordBenchEvent("domMove");
426
+ parent.insertBefore(dom, anchor);
427
+ }
428
+ }
429
+ boundaryChildrenExact = true;
430
+ };
431
+ if (forState.lastCommitStrategy === "NO_REORDER" && dirtyIndices.length > 0 && forState.pendingDirtyIndices === null && forState.pendingSwapIndices === null && !forState.pendingMoveOnly && forState.lastRemovedNodes.length === 0 && parent.childNodes.length === forState.orderedKeys.length) {
432
+ commitDirtyNoReorder(dirtyIndices);
433
+ syncKeyedMapFromForState(parent, forState, "NO_REORDER", []);
434
+ recordBenchTiming("domCommit", performance.now() - domCommitStart);
435
+ clearForDomUpdateState(forState);
436
+ return;
437
+ }
438
+ switch (forState.lastCommitStrategy) {
439
+ case "NO_REORDER":
440
+ commitDirtyNoReorder(dirtyIndices);
441
+ break;
442
+ case "TRUNCATE":
443
+ commitPositional();
444
+ break;
445
+ case "APPEND":
446
+ commitAppend();
447
+ break;
448
+ case "SWAP":
449
+ commitSwap();
450
+ break;
451
+ default:
452
+ commitReorder();
453
+ break;
454
+ }
455
+ removeForBoundaryNodes(parent, forState.lastRemovedNodes);
456
+ syncKeyedMapFromForState(parent, forState, forState.lastCommitStrategy, forState.lastRemovedNodes);
457
+ const syncExactForBoundaryChildren = () => {
458
+ const expectedNodes = [];
459
+ for (let i = 0; i < forState.orderedKeys.length; i++) {
460
+ const itemInstance = forState.orderedItems[i];
461
+ if (!itemInstance) continue;
462
+ const dom = itemInstance.scope.dom && !itemInstance.scope.needsDomUpdate ? itemInstance.scope.dom : runtime.syncForItemDom(parent, itemInstance.scope, childrenVNodes[i]);
463
+ if (dom) expectedNodes.push(dom);
464
+ }
465
+ const currentNodes = Array.from(parent.childNodes);
466
+ if (currentNodes.length === expectedNodes.length && currentNodes.every((node, index) => node === expectedNodes[index])) return;
467
+ const expectedNodeSet = new Set(expectedNodes);
468
+ for (const currentNode of currentNodes) {
469
+ if (expectedNodeSet.has(currentNode)) continue;
470
+ teardownNodeSubtree(currentNode);
471
+ if (currentNode.parentNode === parent) {
472
+ recordBenchEvent("domRemove");
473
+ currentNode.remove();
474
+ }
475
+ }
476
+ replaceChildrenInOrder(parent, expectedNodes, true);
477
+ };
478
+ if (!boundaryChildrenExact) syncExactForBoundaryChildren();
479
+ forState._hasResolvedItemDom = true;
480
+ recordBenchTiming("domCommit", performance.now() - domCommitStart);
481
+ clearForDomUpdateState(forState);
482
+ }
483
+ //#endregion
484
+ export { commitForStateBoundaryChildren };
485
+
486
+ //# sourceMappingURL=for-commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"for-commit.js","names":[],"sources":["../../src/renderer/for-commit.ts"],"sourcesContent":["import type { ChildScope } from '../runtime/child-scope';\nimport {\n clearForDomUpdateState,\n recordBenchCounter,\n recordBenchEvent,\n recordBenchTiming,\n type ForCommitStrategy,\n type ForState,\n withBenchMetricScope,\n} from '../runtime/for';\nimport { teardownNodeSubtree } from './cleanup';\nimport { keyedElements } from './keyed';\nimport type { VNode } from './types';\nimport { canUseDirectReplaceChildrenSpread } from './utils';\n\nexport interface ForCommitRuntime {\n isProduction(): boolean;\n syncForItemDom(parent: Element, scope: ChildScope, vnode: VNode): Node | null;\n tryPatchStableForDirtyItem(scope: ChildScope): boolean;\n}\n\nfunction getOrBuildDomKeyMap(\n parent: Element\n): Map<string | number, Element> | undefined {\n let keyMap = keyedElements.get(parent);\n if (!keyMap) {\n keyMap = new Map<string | number, Element>();\n for (\n let child = parent.firstElementChild;\n child;\n child = child.nextElementSibling\n ) {\n const key = child.getAttribute('data-key');\n if (key !== null) {\n keyMap.set(key, child);\n const numericKey = Number(key);\n if (!Number.isNaN(numericKey)) {\n keyMap.set(numericKey, child);\n }\n }\n }\n if (keyMap.size > 0) {\n keyedElements.set(parent, keyMap);\n }\n }\n return keyMap.size > 0 ? keyMap : undefined;\n}\n\nfunction hydrateExistingForDomInOrder(\n parent: Element,\n forState: ForState<unknown>\n): boolean {\n if (parent.children.length !== forState.orderedKeys.length) {\n return false;\n }\n\n for (let i = 0; i < forState.orderedKeys.length; i += 1) {\n const itemKey = forState.orderedKeys[i];\n const itemInstance = forState.items.get(itemKey);\n const currentDom = parent.children[i];\n\n if (\n !itemInstance ||\n currentDom.getAttribute('data-key') !== String(itemKey)\n ) {\n return false;\n }\n\n itemInstance.scope.dom = currentDom;\n itemInstance.scope.needsDomUpdate = true;\n }\n\n return true;\n}\n\nfunction removeForBoundaryNodes(parent: Element, removedNodes: Node[]): void {\n if (\n removedNodes.length > 0 &&\n removedNodes.length === parent.childNodes.length\n ) {\n let canBulkClear = true;\n for (let i = 0; i < removedNodes.length; i++) {\n if (removedNodes[i].parentNode !== parent) {\n canBulkClear = false;\n break;\n }\n }\n\n if (canBulkClear) {\n for (let i = 0; i < removedNodes.length; i++) {\n recordBenchEvent('domRemove');\n teardownNodeSubtree(removedNodes[i]);\n }\n withBenchMetricScope('fullClear', () => {\n recordBenchCounter('bulkClearCommits');\n parent.textContent = '';\n });\n return;\n }\n }\n\n for (let i = 0; i < removedNodes.length; i++) {\n const node = removedNodes[i];\n if (node.parentNode === parent) {\n recordBenchEvent('domRemove');\n teardownNodeSubtree(node);\n parent.removeChild(node);\n }\n }\n}\n\nfunction syncKeyedMapFromForState(\n parent: Element,\n forState: ForState<unknown>,\n strategy: ForCommitStrategy,\n removedNodes: Node[]\n): void {\n const existing = keyedElements.get(parent);\n const ensureMapEntry = (\n map: Map<string | number, Element>,\n key: string | number,\n element: Element\n ): void => {\n map.set(key, element);\n const keyString = String(key);\n map.set(keyString, element);\n const keyNumber = Number(keyString);\n if (!Number.isNaN(keyNumber)) {\n map.set(keyNumber, element);\n }\n };\n\n if (strategy === 'SWAP') {\n if (existing) {\n return;\n }\n }\n\n if (strategy === 'FULL_KEYED' && existing && removedNodes.length === 0) {\n return;\n }\n\n if (strategy === 'NO_REORDER') {\n if (existing && removedNodes.length === 0) {\n return;\n }\n\n if (existing) {\n for (const [mapKey, element] of existing) {\n if (element.parentNode !== parent) {\n existing.delete(mapKey);\n }\n }\n\n if (existing.size > 0) {\n keyedElements.set(parent, existing);\n } else {\n keyedElements.delete(parent);\n }\n return;\n }\n }\n\n if (strategy === 'TRUNCATE' && forState.orderedKeys.length === 0) {\n if (existing) {\n existing.clear();\n }\n keyedElements.delete(parent);\n return;\n }\n\n if (strategy === 'APPEND' && existing) {\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const key = forState.orderedKeys[i];\n if (key === null || existing.has(key)) continue;\n const itemInstance = forState.items.get(key);\n if (itemInstance?.scope.dom instanceof Element) {\n ensureMapEntry(existing, key, itemInstance.scope.dom);\n }\n }\n\n if (existing.size > 0) {\n keyedElements.set(parent, existing);\n } else {\n keyedElements.delete(parent);\n }\n return;\n }\n\n const nextMap = existing ?? new Map<string | number, Element>();\n nextMap.clear();\n\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const key = forState.orderedKeys[i];\n if (key === null) continue;\n const itemInstance = forState.items.get(key);\n if (itemInstance?.scope.dom instanceof Element) {\n ensureMapEntry(nextMap, key, itemInstance.scope.dom);\n }\n }\n\n if (nextMap.size > 0) {\n keyedElements.set(parent, nextMap);\n } else {\n keyedElements.delete(parent);\n }\n}\n\nfunction replaceChildrenInOrder(\n parent: Element,\n nodes: Node[],\n allowDirectSpread: boolean\n): void {\n if (allowDirectSpread && canUseDirectReplaceChildrenSpread(nodes.length)) {\n parent.replaceChildren(...nodes);\n return;\n }\n\n const fragment = parent.ownerDocument.createDocumentFragment();\n for (let i = 0; i < nodes.length; i++) {\n fragment.appendChild(nodes[i]);\n }\n parent.replaceChildren(fragment);\n}\n\nfunction getLISIndices(sequence: number[]): number[] {\n if (sequence.length === 0) {\n return [];\n }\n\n const predecessors = sequence.slice();\n const lisIndices: number[] = [0];\n\n for (let i = 1; i < sequence.length; i += 1) {\n const current = sequence[i];\n const lastLisIndex = lisIndices[lisIndices.length - 1];\n\n if (sequence[lastLisIndex] < current) {\n predecessors[i] = lastLisIndex;\n lisIndices.push(i);\n continue;\n }\n\n let lo = 0;\n let hi = lisIndices.length - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (sequence[lisIndices[mid]] < current) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n\n if (current < sequence[lisIndices[lo]]) {\n if (lo > 0) {\n predecessors[i] = lisIndices[lo - 1];\n }\n lisIndices[lo] = i;\n }\n }\n\n let cursor = lisIndices.length - 1;\n let index = lisIndices[cursor];\n while (cursor >= 0) {\n lisIndices[cursor] = index;\n index = predecessors[index];\n cursor -= 1;\n }\n\n return lisIndices;\n}\n\nfunction commitMoveOnlyReorder(parent: Element, nodes: Node[]): boolean {\n const currentNodes = Array.from(parent.childNodes);\n if (currentNodes.length !== nodes.length) {\n return false;\n }\n\n const currentIndexByNode = new Map<Node, number>();\n for (let i = 0; i < currentNodes.length; i += 1) {\n currentIndexByNode.set(currentNodes[i], i);\n }\n\n const positions = Array.from({ length: nodes.length }, () => 0);\n for (let i = 0; i < nodes.length; i += 1) {\n const position = currentIndexByNode.get(nodes[i]);\n if (position === undefined) {\n return false;\n }\n positions[i] = position;\n }\n\n const lisIndices = getLISIndices(positions);\n if (lisIndices.length === nodes.length) {\n return true;\n }\n\n let lisCursor = lisIndices.length - 1;\n let anchor: Node | null = null;\n\n for (let i = nodes.length - 1; i >= 0; i -= 1) {\n const node = nodes[i];\n if (lisCursor >= 0 && i === lisIndices[lisCursor]) {\n anchor = node;\n lisCursor -= 1;\n continue;\n }\n\n if (node.nextSibling !== anchor) {\n recordBenchEvent('domMove');\n parent.insertBefore(node, anchor);\n }\n\n anchor = node;\n }\n\n return true;\n}\n\nexport function commitForStateBoundaryChildren(\n parent: Element,\n forState: ForState<unknown>,\n childrenVNodes: VNode[],\n runtime: ForCommitRuntime\n): void {\n const domCommitStart = performance.now();\n\n const hydrateExistingForDom = (): void => {\n if (hydrateExistingForDomInOrder(parent, forState)) {\n return;\n }\n\n const domKeyMap = getOrBuildDomKeyMap(parent);\n if (!domKeyMap) {\n return;\n }\n\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const itemKey = forState.orderedKeys[i];\n const itemInstance = forState.items.get(itemKey);\n if (!itemInstance || itemInstance.scope.dom) {\n continue;\n }\n\n const existingDom = domKeyMap.get(itemKey);\n if (!existingDom) {\n continue;\n }\n\n itemInstance.scope.dom = existingDom;\n itemInstance.scope.needsDomUpdate = true;\n }\n };\n\n if (forState.orderedKeys.length === 0) {\n removeForBoundaryNodes(parent, forState.lastRemovedNodes);\n\n const fallbackScope = forState.fallbackScope;\n const fallbackVNode = childrenVNodes[0];\n const nextDom =\n fallbackScope && fallbackVNode !== undefined\n ? runtime.syncForItemDom(parent, fallbackScope, fallbackVNode)\n : null;\n\n if (nextDom) {\n if (\n parent.childNodes.length !== 1 ||\n parent.firstChild !== nextDom ||\n forState.lastRemovedNodes.length > 0\n ) {\n parent.replaceChildren(nextDom);\n }\n } else if (parent.firstChild) {\n parent.textContent = '';\n }\n\n keyedElements.delete(parent);\n forState._hasResolvedItemDom = false;\n recordBenchTiming('domCommit', performance.now() - domCommitStart);\n clearForDomUpdateState(forState);\n return;\n }\n\n if (!forState._hasResolvedItemDom && parent.childNodes.length > 0) {\n hydrateExistingForDom();\n }\n\n const getDirtyForIndices = (): number[] => {\n const pendingDirtyIndices = forState.pendingDirtyIndices;\n if (pendingDirtyIndices && pendingDirtyIndices.length > 0) {\n return pendingDirtyIndices;\n }\n\n const dirtyIndices: number[] = [];\n for (let index = 0; index < forState.orderedKeys.length; index += 1) {\n const itemInstance = forState.orderedItems[index];\n if (itemInstance?.scope.needsDomUpdate) {\n dirtyIndices.push(index);\n }\n }\n\n return dirtyIndices;\n };\n\n let dirtyIndicesCache: number[] | null = null;\n const ensureDirtyIndices = (): number[] => {\n if (dirtyIndicesCache) {\n return dirtyIndicesCache;\n }\n\n dirtyIndicesCache = getDirtyForIndices();\n return dirtyIndicesCache;\n };\n\n const dirtyIndices =\n forState.lastCommitStrategy === 'NO_REORDER' ? ensureDirtyIndices() : [];\n let boundaryChildrenExact = false;\n\n const commitDirtyNoReorder = (dirtyIndices: number[]): void => {\n if (dirtyIndices.length === 0) {\n boundaryChildrenExact = true;\n return;\n }\n\n const orderedItems = forState.orderedItems;\n const childNodes = parent.childNodes;\n\n for (let dirtyIndex = 0; dirtyIndex < dirtyIndices.length; dirtyIndex++) {\n const i = dirtyIndices[dirtyIndex];\n const itemInstance = orderedItems[i];\n if (!itemInstance) {\n continue;\n }\n\n if (runtime.tryPatchStableForDirtyItem(itemInstance.scope)) {\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom) {\n continue;\n }\n\n const anchor = childNodes[i] ?? null;\n if (dom.parentNode !== parent || dom !== anchor) {\n recordBenchEvent('domInsert');\n parent.insertBefore(dom, anchor);\n }\n }\n\n boundaryChildrenExact = true;\n };\n\n const commitPositional = (): void => {\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const itemInstance = forState.orderedItems[i];\n if (!itemInstance) {\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom) {\n continue;\n }\n\n if (dom.parentNode !== parent) {\n const anchor = parent.childNodes[i] ?? null;\n recordBenchEvent('domInsert');\n parent.insertBefore(dom, anchor);\n }\n }\n\n boundaryChildrenExact = true;\n };\n\n const commitAppend = (): void => {\n const canHydrateInPlace =\n !forState._hasResolvedItemDom &&\n forState.lastRemovedNodes.length === 0 &&\n parent.childNodes.length === forState.orderedKeys.length;\n if (canHydrateInPlace) {\n let exactOrder = true;\n let currentNode = parent.firstChild;\n\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const itemInstance = forState.orderedItems[i];\n if (!itemInstance) {\n exactOrder = false;\n currentNode = currentNode?.nextSibling ?? null;\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom || dom.parentNode !== parent || dom !== currentNode) {\n exactOrder = false;\n }\n\n currentNode = currentNode?.nextSibling ?? null;\n }\n\n if (exactOrder) {\n boundaryChildrenExact = true;\n return;\n }\n }\n\n withBenchMetricScope('coldCreate', () => {\n const fragment = parent.ownerDocument.createDocumentFragment();\n let hasPendingAppend = false;\n\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const itemInstance = forState.orderedItems[i];\n if (!itemInstance) {\n continue;\n }\n\n if (\n itemInstance.scope.dom?.parentNode === parent &&\n !itemInstance.scope.needsDomUpdate\n ) {\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom) {\n continue;\n }\n\n if (dom.parentNode !== parent) {\n recordBenchEvent('domInsert');\n fragment.appendChild(dom);\n hasPendingAppend = true;\n }\n }\n\n if (hasPendingAppend) {\n parent.appendChild(fragment);\n }\n });\n\n boundaryChildrenExact = true;\n };\n\n const commitSwap = (): void => {\n const swapIndices = forState.pendingSwapIndices;\n if (!swapIndices) {\n return;\n }\n\n let [firstIndex, secondIndex] = swapIndices;\n if (firstIndex === secondIndex) {\n return;\n }\n\n if (firstIndex > secondIndex) {\n [firstIndex, secondIndex] = [secondIndex, firstIndex];\n }\n\n const firstKey = forState.orderedKeys[firstIndex];\n const secondKey = forState.orderedKeys[secondIndex];\n const firstItem = forState.items.get(firstKey);\n const secondItem = forState.items.get(secondKey);\n\n if (!firstItem || !secondItem) {\n commitReorder();\n return;\n }\n\n const firstDom = runtime.syncForItemDom(\n parent,\n firstItem.scope,\n childrenVNodes[firstIndex]\n );\n const secondDom = runtime.syncForItemDom(\n parent,\n secondItem.scope,\n childrenVNodes[secondIndex]\n );\n\n if (!firstDom || !secondDom) {\n commitReorder();\n return;\n }\n\n if (firstDom.parentNode !== parent || secondDom.parentNode !== parent) {\n commitReorder();\n return;\n }\n\n const firstBeforeSecond =\n (firstDom.compareDocumentPosition(secondDom) &\n Node.DOCUMENT_POSITION_FOLLOWING) !==\n 0;\n if (firstBeforeSecond) {\n boundaryChildrenExact = true;\n return;\n }\n\n const firstNextSibling = firstDom.nextSibling;\n recordBenchEvent('domMove');\n parent.insertBefore(firstDom, secondDom);\n recordBenchEvent('domMove');\n parent.insertBefore(secondDom, firstNextSibling);\n\n boundaryChildrenExact = true;\n };\n\n const commitReorder = (): void => {\n const items = forState.orderedItems;\n const count = items.length;\n\n if (forState.pendingMoveOnly && forState.lastRemovedNodes.length === 0) {\n const nodes = Array<Node>(count);\n let movedCount = 0;\n let insertedCount = 0;\n\n for (let i = 0; i < count; i++) {\n const itemInstance = items[i];\n if (!itemInstance) {\n return;\n }\n\n const scope = itemInstance.scope;\n const dom =\n scope.dom && !scope.needsDomUpdate\n ? scope.dom\n : runtime.syncForItemDom(parent, scope, childrenVNodes[i]);\n\n if (!dom) {\n return;\n }\n\n if (dom.parentNode === parent) {\n movedCount++;\n } else {\n insertedCount++;\n }\n nodes[i] = dom;\n }\n\n if (!canUseDirectReplaceChildrenSpread(count)) {\n if (movedCount > 0) {\n recordBenchEvent('domMove', movedCount);\n }\n if (insertedCount > 0) {\n recordBenchEvent('domInsert', insertedCount);\n }\n replaceChildrenInOrder(parent, nodes, false);\n boundaryChildrenExact = true;\n return;\n }\n\n if (insertedCount > 0) {\n if (movedCount > 0) {\n recordBenchEvent('domMove', movedCount);\n }\n recordBenchEvent('domInsert', insertedCount);\n replaceChildrenInOrder(parent, nodes, true);\n boundaryChildrenExact = true;\n return;\n }\n\n if (count > 1 && commitMoveOnlyReorder(parent, nodes)) {\n boundaryChildrenExact = true;\n return;\n }\n\n if (movedCount > 0) {\n recordBenchEvent('domMove', movedCount);\n }\n if (insertedCount > 0) {\n recordBenchEvent('domInsert', insertedCount);\n }\n\n replaceChildrenInOrder(parent, nodes, true);\n boundaryChildrenExact = true;\n return;\n }\n\n let hasExistingChild = false;\n for (let i = 0; i < count; i++) {\n const itemInstance = items[i];\n if (itemInstance?.scope.dom?.parentNode === parent) {\n hasExistingChild = true;\n break;\n }\n }\n\n if (!hasExistingChild) {\n withBenchMetricScope('coldCreate', () => {\n const nodes: Node[] = [];\n for (let i = 0; i < count; i++) {\n const itemInstance = items[i];\n if (!itemInstance) continue;\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (dom) {\n recordBenchEvent('domInsert');\n nodes.push(dom);\n }\n }\n recordBenchCounter('replaceChildrenCommits');\n replaceChildrenInOrder(parent, nodes, false);\n });\n\n boundaryChildrenExact = true;\n return;\n }\n\n if (forState.lastRemovedNodes.length === 0) {\n const nodes: Node[] = [];\n\n for (let i = 0; i < count; i++) {\n const itemInstance = items[i];\n if (!itemInstance) {\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom) {\n continue;\n }\n\n recordBenchEvent(dom.parentNode === parent ? 'domMove' : 'domInsert');\n nodes.push(dom);\n }\n\n replaceChildrenInOrder(parent, nodes, false);\n boundaryChildrenExact = true;\n return;\n }\n\n for (let i = 0; i < count; i++) {\n const itemInstance = items[i];\n if (!itemInstance) {\n continue;\n }\n\n const dom = runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (!dom) {\n continue;\n }\n\n const anchor = parent.childNodes[i] ?? null;\n if (dom !== anchor) {\n recordBenchEvent('domMove');\n parent.insertBefore(dom, anchor);\n }\n }\n\n boundaryChildrenExact = true;\n };\n\n const isLocalOnlyDirtyCommit =\n forState.lastCommitStrategy === 'NO_REORDER' &&\n dirtyIndices.length > 0 &&\n forState.pendingDirtyIndices === null &&\n forState.pendingSwapIndices === null &&\n !forState.pendingMoveOnly &&\n forState.lastRemovedNodes.length === 0 &&\n parent.childNodes.length === forState.orderedKeys.length;\n\n if (isLocalOnlyDirtyCommit) {\n commitDirtyNoReorder(dirtyIndices);\n syncKeyedMapFromForState(parent, forState, 'NO_REORDER', []);\n\n recordBenchTiming('domCommit', performance.now() - domCommitStart);\n clearForDomUpdateState(forState);\n return;\n }\n\n switch (forState.lastCommitStrategy) {\n case 'NO_REORDER':\n commitDirtyNoReorder(dirtyIndices);\n break;\n case 'TRUNCATE':\n commitPositional();\n break;\n case 'APPEND':\n commitAppend();\n break;\n case 'SWAP':\n commitSwap();\n break;\n case 'FULL_KEYED':\n default:\n commitReorder();\n break;\n }\n\n removeForBoundaryNodes(parent, forState.lastRemovedNodes);\n syncKeyedMapFromForState(\n parent,\n forState,\n forState.lastCommitStrategy,\n forState.lastRemovedNodes\n );\n\n const syncExactForBoundaryChildren = (): void => {\n const expectedNodes: Node[] = [];\n\n for (let i = 0; i < forState.orderedKeys.length; i++) {\n const itemInstance = forState.orderedItems[i];\n if (!itemInstance) {\n continue;\n }\n\n const dom =\n itemInstance.scope.dom && !itemInstance.scope.needsDomUpdate\n ? itemInstance.scope.dom\n : runtime.syncForItemDom(\n parent,\n itemInstance.scope,\n childrenVNodes[i]\n );\n if (dom) {\n expectedNodes.push(dom);\n }\n }\n\n const currentNodes = Array.from(parent.childNodes);\n if (\n currentNodes.length === expectedNodes.length &&\n currentNodes.every((node, index) => node === expectedNodes[index])\n ) {\n return;\n }\n\n const expectedNodeSet = new Set(expectedNodes);\n for (const currentNode of currentNodes) {\n if (expectedNodeSet.has(currentNode)) {\n continue;\n }\n\n teardownNodeSubtree(currentNode);\n\n if (currentNode.parentNode === parent) {\n recordBenchEvent('domRemove');\n currentNode.remove();\n }\n }\n\n replaceChildrenInOrder(parent, expectedNodes, true);\n };\n\n if (!boundaryChildrenExact) {\n syncExactForBoundaryChildren();\n }\n forState._hasResolvedItemDom = true;\n recordBenchTiming('domCommit', performance.now() - domCommitStart);\n clearForDomUpdateState(forState);\n}\n"],"mappings":";;;;;;AAqBA,SAAS,oBACP,QAC2C;CAC3C,IAAI,SAAS,cAAc,IAAI,OAAO;CACtC,IAAI,CAAC,QAAQ;EACX,yBAAS,IAAI,KAA+B;EAC5C,KACE,IAAI,QAAQ,OAAO,mBACnB,OACA,QAAQ,MAAM,oBACd;GACA,MAAM,MAAM,MAAM,aAAa,WAAW;GAC1C,IAAI,QAAQ,MAAM;IAChB,OAAO,IAAI,KAAK,MAAM;IACtB,MAAM,aAAa,OAAO,IAAI;IAC9B,IAAI,CAAC,OAAO,MAAM,WAAW,EAC3B,OAAO,IAAI,YAAY,MAAM;;;EAInC,IAAI,OAAO,OAAO,GAChB,cAAc,IAAI,QAAQ,OAAO;;CAGrC,OAAO,OAAO,OAAO,IAAI,SAAS;;AAGpC,SAAS,6BACP,QACA,UACS;CACT,IAAI,OAAO,SAAS,WA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,CAAC;EAE5D,kBAAkB,aAAa,YAAY,KAAK,GAAG,eAAe;EAClE,uBAAuB,SAAS;EAChC;;CAGF,QAAQ,SAAS,oBAAjB;EACE,KAAK;GACH,qBAAqB,aAAa;GAClC;EACF,KAAK;GACH,kBAAkB;GAClB;EACF,KAAK;GACH,cAAc;GACd;EACF,KAAK;GACH,YAAY;GACZ;EAEF;GACE,eAAe;GACf;;CAGJ,uBAAuB,QAAQ,SAAS,iBAAiB;CACzD,yBACE,QACA,UACA,SAAS,oBACT,SAAS,iBACV;CAED,MAAM,qCAA2C;EAC/C,MAAM,gBAAwB,EAAE;EAEhC,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,YAAY,QAAQ,KAAK;GACpD,MAAM,eAAe,SAAS,aAAa;GAC3C,IAAI,CAAC,cACH;GAGF,MAAM,MACJ,aAAa,MAAM,OAAO,CAAC,aAAa,MAAM,iBAC1C,aAAa,MAAM,MACnB,QAAQ,eACN,QACA,aAAa,OACb,eAAe,GAChB;GACP,IAAI,KACF,cAAc,KAAK,IAAI;;EAI3B,MAAM,eAAe,MAAM,KAAK,OAAO,WAAW;EAClD,IACE,aAAa,WAAW,cAAc,UACtC,aAAa,OAAO,MAAM,UAAU,SAAS,cAAc,OAAO,EAElE;EAGF,MAAM,kBAAkB,IAAI,IAAI,cAAc;EAC9C,KAAK,MAAM,eAAe,cAAc;GACtC,IAAI,gBAAgB,IAAI,YAAY,EAClC;GAGF,oBAAoB,YAAY;GAEhC,IAAI,YAAY,eAAe,QAAQ;IACrC,iBAAiB,YAAY;IAC7B,YAAY,QAAQ;;;EAIxB,uBAAuB,QAAQ,eAAe,KAAK;;CAGrD,IAAI,CAAC,uBACH,8BAA8B;CAEhC,SAAS,sBAAsB;CAC/B,kBAAkB,aAAa,YAAY,KAAK,GAAG,eAAe;CAClE,uBAAuB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_evaluate","_markReactivePropsDirtySource"],"sources":["../../src/renderer/index.ts"],"sourcesContent":["// Renderer barrel entrypoint.\n// Keep this file small: re-export the public surface and attach the runtime\n// fast-lane bridge on import.\n\nexport * from './types';\nexport * from './cleanup';\nexport * from './keyed';\nexport * from './dom';\nexport { evaluate, clearDOMRange } from './evaluate';\n\nimport { evaluate as _evaluate } from './evaluate';\nimport { isKeyedReorderFastPathEligible, getKeyMapForElement } from './keyed';\nimport { markReactivePropsDirtySource as _markReactivePropsDirtySource } from './dom';\n\nexport function installRendererBridge(): true {\n if (typeof globalThis !== 'undefined') {\n const _g = globalThis as Record<string, unknown>;\n _g.__ASKR_RENDERER = {\n evaluate: _evaluate,\n isKeyedReorderFastPathEligible,\n getKeyMapForElement,\n markReactivePropsDirtySource: _markReactivePropsDirtySource,\n };\n }\n return true;\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,wBAA8B;CAC5C,IAAI,OAAO,eAAe,aAAa;EACrC,MAAM,KAAK;EACX,GAAG,kBAAkB;GACTA;GACV;GACA;GAC8BC;GAC/B;;CAEH,OAAO"}
1
+ {"version":3,"file":"index.js","names":["_evaluate","_markReactivePropsDirtySource"],"sources":["../../src/renderer/index.ts"],"sourcesContent":["// Renderer barrel entrypoint.\n// Keep this file small: re-export the public surface and attach the runtime\n// fast-lane bridge on import.\n\nexport * from './types';\nexport * from './cleanup';\nexport {\n keyedElements,\n getKeyMapForElement,\n populateKeyMapForElement,\n _reconcilerRecordedParents,\n isKeyedReorderFastPathEligible,\n} from './keyed';\nexport * from './dom';\nexport { evaluate, clearDOMRange } from './evaluate';\n\nimport { evaluate as _evaluate } from './evaluate';\nimport { isKeyedReorderFastPathEligible, getKeyMapForElement } from './keyed';\nimport { markReactivePropsDirtySource as _markReactivePropsDirtySource } from './dom';\n\nexport function installRendererBridge(): true {\n if (typeof globalThis !== 'undefined') {\n const _g = globalThis as Record<string, unknown>;\n _g.__ASKR_RENDERER = {\n evaluate: _evaluate,\n isKeyedReorderFastPathEligible,\n getKeyMapForElement,\n markReactivePropsDirtySource: _markReactivePropsDirtySource,\n };\n }\n return true;\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,wBAA8B;CAC5C,IAAI,OAAO,eAAe,aAAa;EACrC,MAAM,KAAK;EACX,GAAG,kBAAkB;GACTA;GACV;GACA;GAC8BC;GAC/B;;CAEH,OAAO"}