@llui/dom 0.0.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/addressed.d.ts +16 -0
- package/dist/addressed.d.ts.map +1 -0
- package/dist/addressed.js +40 -0
- package/dist/addressed.js.map +1 -0
- package/dist/binding.d.ts +18 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +62 -0
- package/dist/binding.js.map +1 -0
- package/dist/chain-update.d.ts +7 -0
- package/dist/chain-update.d.ts.map +1 -0
- package/dist/chain-update.js +16 -0
- package/dist/chain-update.js.map +1 -0
- package/dist/component.d.ts +3 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +4 -0
- package/dist/component.js.map +1 -0
- package/dist/devtools.d.ts +113 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +390 -0
- package/dist/devtools.js.map +1 -0
- package/dist/el-split.d.ts +3 -0
- package/dist/el-split.d.ts.map +1 -0
- package/dist/el-split.js +54 -0
- package/dist/el-split.js.map +1 -0
- package/dist/el-template.d.ts +17 -0
- package/dist/el-template.d.ts.map +1 -0
- package/dist/el-template.js +64 -0
- package/dist/el-template.js.map +1 -0
- package/dist/elements.d.ts +80 -0
- package/dist/elements.d.ts.map +1 -0
- package/dist/elements.js +234 -0
- package/dist/elements.js.map +1 -0
- package/dist/form.d.ts +30 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +12 -0
- package/dist/form.js.map +1 -0
- package/dist/hmr.d.ts +20 -0
- package/dist/hmr.d.ts.map +1 -0
- package/dist/hmr.js +98 -0
- package/dist/hmr.js.map +1 -0
- package/dist/hydrate.d.ts +29 -0
- package/dist/hydrate.d.ts.map +1 -0
- package/dist/hydrate.js +96 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/merge-handlers.d.ts +7 -0
- package/dist/merge-handlers.d.ts.map +1 -0
- package/dist/merge-handlers.js +16 -0
- package/dist/merge-handlers.js.map +1 -0
- package/dist/mount.d.ts +14 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/mount.js +182 -0
- package/dist/mount.js.map +1 -0
- package/dist/primitives/branch.d.ts +3 -0
- package/dist/primitives/branch.d.ts.map +1 -0
- package/dist/primitives/branch.js +94 -0
- package/dist/primitives/branch.js.map +1 -0
- package/dist/primitives/child.d.ts +3 -0
- package/dist/primitives/child.d.ts.map +1 -0
- package/dist/primitives/child.js +77 -0
- package/dist/primitives/child.js.map +1 -0
- package/dist/primitives/context.d.ts +45 -0
- package/dist/primitives/context.d.ts.map +1 -0
- package/dist/primitives/context.js +87 -0
- package/dist/primitives/context.js.map +1 -0
- package/dist/primitives/each.d.ts +3 -0
- package/dist/primitives/each.d.ts.map +1 -0
- package/dist/primitives/each.js +515 -0
- package/dist/primitives/each.js.map +1 -0
- package/dist/primitives/error-boundary.d.ts +6 -0
- package/dist/primitives/error-boundary.d.ts.map +1 -0
- package/dist/primitives/error-boundary.js +32 -0
- package/dist/primitives/error-boundary.js.map +1 -0
- package/dist/primitives/foreign.d.ts +3 -0
- package/dist/primitives/foreign.d.ts.map +1 -0
- package/dist/primitives/foreign.js +80 -0
- package/dist/primitives/foreign.js.map +1 -0
- package/dist/primitives/memo.d.ts +3 -0
- package/dist/primitives/memo.d.ts.map +1 -0
- package/dist/primitives/memo.js +30 -0
- package/dist/primitives/memo.js.map +1 -0
- package/dist/primitives/on-mount.d.ts +2 -0
- package/dist/primitives/on-mount.d.ts.map +1 -0
- package/dist/primitives/on-mount.js +23 -0
- package/dist/primitives/on-mount.js.map +1 -0
- package/dist/primitives/portal.d.ts +3 -0
- package/dist/primitives/portal.d.ts.map +1 -0
- package/dist/primitives/portal.js +31 -0
- package/dist/primitives/portal.js.map +1 -0
- package/dist/primitives/selector.d.ts +22 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/primitives/selector.js +104 -0
- package/dist/primitives/selector.js.map +1 -0
- package/dist/primitives/show.d.ts +3 -0
- package/dist/primitives/show.d.ts.map +1 -0
- package/dist/primitives/show.js +12 -0
- package/dist/primitives/show.js.map +1 -0
- package/dist/primitives/slice.d.ts +23 -0
- package/dist/primitives/slice.d.ts.map +1 -0
- package/dist/primitives/slice.js +57 -0
- package/dist/primitives/slice.js.map +1 -0
- package/dist/primitives/text.d.ts +2 -0
- package/dist/primitives/text.d.ts.map +1 -0
- package/dist/primitives/text.js +35 -0
- package/dist/primitives/text.js.map +1 -0
- package/dist/render-context.d.ts +14 -0
- package/dist/render-context.d.ts.map +1 -0
- package/dist/render-context.js +14 -0
- package/dist/render-context.js.map +1 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +14 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scope.d.ts +24 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +102 -0
- package/dist/scope.js.map +1 -0
- package/dist/slice-handler.d.ts +31 -0
- package/dist/slice-handler.d.ts.map +1 -0
- package/dist/slice-handler.js +34 -0
- package/dist/slice-handler.js.map +1 -0
- package/dist/ssr-dom.d.ts +12 -0
- package/dist/ssr-dom.d.ts.map +1 -0
- package/dist/ssr-dom.js +36 -0
- package/dist/ssr-dom.js.map +1 -0
- package/dist/ssr.d.ts +11 -0
- package/dist/ssr.d.ts.map +1 -0
- package/dist/ssr.js +127 -0
- package/dist/ssr.js.map +1 -0
- package/dist/structural.d.ts +4 -0
- package/dist/structural.d.ts.map +1 -0
- package/dist/structural.js +2 -0
- package/dist/structural.js.map +1 -0
- package/dist/types.d.ts +145 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update-loop.d.ts +31 -0
- package/dist/update-loop.d.ts.map +1 -0
- package/dist/update-loop.js +236 -0
- package/dist/update-loop.js.map +1 -0
- package/dist/view-helpers.d.ts +44 -0
- package/dist/view-helpers.d.ts.map +1 -0
- package/dist/view-helpers.js +24 -0
- package/dist/view-helpers.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { getRenderContext, setRenderContext, clearRenderContext, } from '../render-context';
|
|
2
|
+
import { createScope, disposeScope, addDisposer, removeOrphanedChildren } from '../scope';
|
|
3
|
+
import { getFlatBindings, setFlatBindings } from '../binding';
|
|
4
|
+
// Reusable render context for buildEntry — avoids object allocation per entry
|
|
5
|
+
const buildCtx = {
|
|
6
|
+
rootScope: null,
|
|
7
|
+
state: null,
|
|
8
|
+
allBindings: [],
|
|
9
|
+
structuralBlocks: [],
|
|
10
|
+
};
|
|
11
|
+
export function each(opts) {
|
|
12
|
+
const ctx = getRenderContext();
|
|
13
|
+
const parentScope = ctx.rootScope;
|
|
14
|
+
const blocks = ctx.structuralBlocks;
|
|
15
|
+
const anchor = document.createComment('each');
|
|
16
|
+
const entries = [];
|
|
17
|
+
// Entries whose leave animation is still in progress. Their DOM nodes
|
|
18
|
+
// remain in the parent until the leave Promise resolves.
|
|
19
|
+
const leaving = [];
|
|
20
|
+
const initialItems = opts.items(ctx.state);
|
|
21
|
+
for (let i = 0; i < initialItems.length; i++) {
|
|
22
|
+
const item = initialItems[i];
|
|
23
|
+
const entry = buildEntry(item, i, opts, parentScope, ctx);
|
|
24
|
+
entries.push(entry);
|
|
25
|
+
}
|
|
26
|
+
// Fire initial enter for mount-time items
|
|
27
|
+
if (opts.enter) {
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
if (entry.nodes.length > 0)
|
|
30
|
+
opts.enter(entry.nodes);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let lastItemsRef = initialItems;
|
|
34
|
+
const block = {
|
|
35
|
+
reconcile(state) {
|
|
36
|
+
const parent = anchor.parentNode;
|
|
37
|
+
if (!parent)
|
|
38
|
+
return;
|
|
39
|
+
const newItems = opts.items(state);
|
|
40
|
+
// Fast path: same array reference → skip entirely
|
|
41
|
+
if (newItems === lastItemsRef) {
|
|
42
|
+
for (const entry of entries)
|
|
43
|
+
entry.scope.eachItemStable = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
lastItemsRef = newItems;
|
|
47
|
+
const report = opts.onTransition ? { entering: [], leaving: [] } : null;
|
|
48
|
+
reconcileEntries(entries, newItems, opts, parentScope, parent, anchor, ctx, state, leaving, report);
|
|
49
|
+
if (opts.onTransition && report) {
|
|
50
|
+
opts.onTransition({ entering: report.entering, leaving: report.leaving, parent });
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
blocks.push(block);
|
|
55
|
+
addDisposer(parentScope, () => {
|
|
56
|
+
const idx = blocks.indexOf(block);
|
|
57
|
+
if (idx !== -1)
|
|
58
|
+
blocks.splice(idx, 1);
|
|
59
|
+
// parentScope is being disposed — its children array is about to be
|
|
60
|
+
// cleared by the recursive dispose pass, so skip per-entry parent
|
|
61
|
+
// removal (avoids O(N²) indexOf+splice).
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
disposeScope(entry.scope, true);
|
|
64
|
+
}
|
|
65
|
+
entries.length = 0;
|
|
66
|
+
// Force-remove any mid-leave entries immediately
|
|
67
|
+
for (const entry of leaving) {
|
|
68
|
+
for (const node of entry.nodes) {
|
|
69
|
+
if (node.parentNode)
|
|
70
|
+
node.parentNode.removeChild(node);
|
|
71
|
+
}
|
|
72
|
+
disposeScope(entry.scope, true);
|
|
73
|
+
}
|
|
74
|
+
leaving.length = 0;
|
|
75
|
+
});
|
|
76
|
+
const result = [anchor];
|
|
77
|
+
for (const entry of entries) {
|
|
78
|
+
result.push(...entry.nodes);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Remove an entry's DOM + dispose its scope, running opts.leave first if
|
|
84
|
+
* provided. When leave returns a Promise, the DOM removal is deferred until
|
|
85
|
+
* resolution (entry is tracked in `leaving`).
|
|
86
|
+
*/
|
|
87
|
+
function removeEntry(entry, opts, leaving) {
|
|
88
|
+
const removeNow = () => {
|
|
89
|
+
for (const node of entry.nodes) {
|
|
90
|
+
if (node.parentNode)
|
|
91
|
+
node.parentNode.removeChild(node);
|
|
92
|
+
}
|
|
93
|
+
disposeScope(entry.scope);
|
|
94
|
+
const idx = leaving.indexOf(entry);
|
|
95
|
+
if (idx !== -1)
|
|
96
|
+
leaving.splice(idx, 1);
|
|
97
|
+
};
|
|
98
|
+
if (opts.leave && entry.nodes.length > 0) {
|
|
99
|
+
const result = opts.leave(entry.nodes);
|
|
100
|
+
if (result && typeof result.then === 'function') {
|
|
101
|
+
leaving.push(entry);
|
|
102
|
+
result.then(removeNow);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
removeNow();
|
|
107
|
+
}
|
|
108
|
+
function fireEnter(entry, opts) {
|
|
109
|
+
if (opts.enter && entry.nodes.length > 0) {
|
|
110
|
+
void opts.enter(entry.nodes);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function buildEntry(item, index, opts, parentScope, ctx, state) {
|
|
114
|
+
const key = opts.key(item);
|
|
115
|
+
const scope = createScope(parentScope);
|
|
116
|
+
const currentState = (state ?? ctx.state);
|
|
117
|
+
const send = ctx.send;
|
|
118
|
+
// Create entry before render so itemAccessor closures can capture it
|
|
119
|
+
const entry = { key, item, current: item, index, scope, nodes: null };
|
|
120
|
+
// Base callable: item(selector) for computed expressions
|
|
121
|
+
const itemFn = (selector) => {
|
|
122
|
+
const accessor = () => selector(entry.current);
|
|
123
|
+
accessor.__perItem = true;
|
|
124
|
+
return accessor;
|
|
125
|
+
};
|
|
126
|
+
// Proxy for item.field shorthand: LAZILY created. Compiled code uses
|
|
127
|
+
// `acc(fn)` instead (the compiler rewrites item.x → acc(r => r.x)),
|
|
128
|
+
// so the Proxy is never constructed in the common case. This saves
|
|
129
|
+
// ~300ns × N Proxy allocations per create cycle.
|
|
130
|
+
let itemProxy = null;
|
|
131
|
+
const getItemProxy = () => {
|
|
132
|
+
if (itemProxy)
|
|
133
|
+
return itemProxy;
|
|
134
|
+
let fieldCache = null;
|
|
135
|
+
itemProxy = new Proxy(itemFn, {
|
|
136
|
+
get(target, prop) {
|
|
137
|
+
if (typeof prop === 'symbol' || prop === 'then' || prop === 'prototype') {
|
|
138
|
+
return Reflect.get(target, prop);
|
|
139
|
+
}
|
|
140
|
+
const key = prop;
|
|
141
|
+
if (fieldCache) {
|
|
142
|
+
const cached = fieldCache.get(key);
|
|
143
|
+
if (cached)
|
|
144
|
+
return cached;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
fieldCache = new Map();
|
|
148
|
+
}
|
|
149
|
+
const accessor = () => entry.current[key];
|
|
150
|
+
accessor.__perItem = true;
|
|
151
|
+
fieldCache.set(key, accessor);
|
|
152
|
+
return accessor;
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
return itemProxy;
|
|
156
|
+
};
|
|
157
|
+
const indexAccessor = () => entry.index;
|
|
158
|
+
// Reuse a single context object to avoid allocation per entry
|
|
159
|
+
buildCtx.rootScope = scope;
|
|
160
|
+
buildCtx.state = currentState;
|
|
161
|
+
buildCtx.allBindings = ctx.allBindings;
|
|
162
|
+
buildCtx.structuralBlocks = ctx.structuralBlocks;
|
|
163
|
+
const prevFlatBindings = getFlatBindings();
|
|
164
|
+
setFlatBindings(ctx.allBindings);
|
|
165
|
+
setRenderContext(buildCtx);
|
|
166
|
+
// The render bag exposes `item` as a getter so the Proxy is only
|
|
167
|
+
// created when the callback actually accesses item.field. Compiled
|
|
168
|
+
// code uses `acc(fn)` exclusively, avoiding the Proxy entirely.
|
|
169
|
+
const renderBag = {
|
|
170
|
+
send,
|
|
171
|
+
get item() {
|
|
172
|
+
return getItemProxy();
|
|
173
|
+
},
|
|
174
|
+
acc: itemFn,
|
|
175
|
+
index: indexAccessor,
|
|
176
|
+
};
|
|
177
|
+
entry.nodes = opts.render(renderBag);
|
|
178
|
+
clearRenderContext();
|
|
179
|
+
setFlatBindings(prevFlatBindings);
|
|
180
|
+
setRenderContext(ctx);
|
|
181
|
+
return entry;
|
|
182
|
+
}
|
|
183
|
+
function collectNodes(target, nodes) {
|
|
184
|
+
for (const n of nodes)
|
|
185
|
+
target.push(n);
|
|
186
|
+
}
|
|
187
|
+
function reconcileEntries(entries, newItems, opts, parentScope, parent, anchor, ctx, state, leaving, report) {
|
|
188
|
+
const oldLen = entries.length;
|
|
189
|
+
const newLen = newItems.length;
|
|
190
|
+
const hasLeave = !!opts.leave;
|
|
191
|
+
// Fast path 1: clear all — bulk DOM removal.
|
|
192
|
+
// When opts.leave is set, each item needs its own leave animation, so
|
|
193
|
+
// fall through to per-item removal instead of Range.deleteContents().
|
|
194
|
+
if (newLen === 0) {
|
|
195
|
+
if (report) {
|
|
196
|
+
for (const entry of entries)
|
|
197
|
+
collectNodes(report.leaving, entry.nodes);
|
|
198
|
+
}
|
|
199
|
+
if (hasLeave) {
|
|
200
|
+
const toRemove = entries.slice();
|
|
201
|
+
entries.length = 0;
|
|
202
|
+
for (const entry of toRemove)
|
|
203
|
+
removeEntry(entry, opts, leaving);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
// Remove all DOM nodes in one operation using Range
|
|
207
|
+
if (entries.length > 0) {
|
|
208
|
+
const range = document.createRange();
|
|
209
|
+
range.setStartAfter(anchor);
|
|
210
|
+
const lastEntry = entries[entries.length - 1];
|
|
211
|
+
const lastNode = lastEntry.nodes[lastEntry.nodes.length - 1];
|
|
212
|
+
range.setEndAfter(lastNode);
|
|
213
|
+
range.deleteContents();
|
|
214
|
+
}
|
|
215
|
+
// Dispose scopes in bulk. Individual disposeScope → removeFromParent
|
|
216
|
+
// does parent.children.indexOf+splice per scope, which is O(N²) when
|
|
217
|
+
// clearing 1000 sibling entries. Pass skipParentRemoval=true and
|
|
218
|
+
// collapse all detachments into one O(N) scan.
|
|
219
|
+
for (const entry of entries)
|
|
220
|
+
disposeScope(entry.scope, true);
|
|
221
|
+
removeOrphanedChildren(parentScope);
|
|
222
|
+
entries.length = 0;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
// Fast path 2: append-only — old keys are a prefix of new keys
|
|
226
|
+
if (newLen > oldLen && isAppendOnly(entries, newItems, opts)) {
|
|
227
|
+
for (let i = 0; i < oldLen; i++) {
|
|
228
|
+
updateEntry(entries[i], newItems[i], i);
|
|
229
|
+
}
|
|
230
|
+
// Find insertion point: after last existing entry's last node, or after anchor
|
|
231
|
+
const lastEntry = oldLen > 0 ? entries[oldLen - 1] : null;
|
|
232
|
+
const ref = lastEntry
|
|
233
|
+
? lastEntry.nodes[lastEntry.nodes.length - 1].nextSibling
|
|
234
|
+
: anchor.nextSibling;
|
|
235
|
+
const frag = document.createDocumentFragment();
|
|
236
|
+
const newlyAdded = [];
|
|
237
|
+
for (let i = oldLen; i < newLen; i++) {
|
|
238
|
+
const entry = buildEntry(newItems[i], i, opts, parentScope, ctx, state);
|
|
239
|
+
entries.push(entry);
|
|
240
|
+
newlyAdded.push(entry);
|
|
241
|
+
for (const node of entry.nodes)
|
|
242
|
+
frag.appendChild(node);
|
|
243
|
+
}
|
|
244
|
+
parent.insertBefore(frag, ref);
|
|
245
|
+
if (report) {
|
|
246
|
+
for (const entry of newlyAdded)
|
|
247
|
+
collectNodes(report.entering, entry.nodes);
|
|
248
|
+
}
|
|
249
|
+
for (const entry of newlyAdded)
|
|
250
|
+
fireEnter(entry, opts);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
// Fast path 3: same length, same keys in order — update items in place.
|
|
254
|
+
// This is the dominant path for partial updates (e.g., "update every 10th
|
|
255
|
+
// row"): the array length is unchanged, every key at position i still
|
|
256
|
+
// matches. Skip the Map/Set/reorder machinery entirely — just call
|
|
257
|
+
// updateEntry per item. updateEntry checks item-ref identity internally
|
|
258
|
+
// and only fires per-item updaters for actually-changed items.
|
|
259
|
+
if (newLen === oldLen) {
|
|
260
|
+
let allSameKeys = true;
|
|
261
|
+
for (let i = 0; i < newLen; i++) {
|
|
262
|
+
// If the item ref is identical, the key is guaranteed unchanged —
|
|
263
|
+
// skip the (potentially expensive) opts.key() call.
|
|
264
|
+
if (entries[i].item === newItems[i])
|
|
265
|
+
continue;
|
|
266
|
+
if (entries[i].key !== opts.key(newItems[i])) {
|
|
267
|
+
allSameKeys = false;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (allSameKeys) {
|
|
272
|
+
for (let i = 0; i < newLen; i++) {
|
|
273
|
+
updateEntry(entries[i], newItems[i], i);
|
|
274
|
+
}
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// Fast path 4: two-element swap — same keys, exactly two positions differ
|
|
279
|
+
if (newLen === oldLen && oldLen >= 2) {
|
|
280
|
+
const swapResult = detectSwap(entries, newItems, opts);
|
|
281
|
+
if (swapResult) {
|
|
282
|
+
const [i, j] = swapResult;
|
|
283
|
+
const entryI = entries[i];
|
|
284
|
+
const entryJ = entries[j];
|
|
285
|
+
// Capture reference nodes before any DOM mutation
|
|
286
|
+
const refI = entryI.nodes[0];
|
|
287
|
+
const refAfterJ = entryJ.nodes[entryJ.nodes.length - 1].nextSibling;
|
|
288
|
+
// Move J's nodes to where I was
|
|
289
|
+
for (const node of entryJ.nodes)
|
|
290
|
+
parent.insertBefore(node, refI);
|
|
291
|
+
// Move I's nodes to where J was (after J's last node's original position)
|
|
292
|
+
for (const node of entryI.nodes)
|
|
293
|
+
parent.insertBefore(node, refAfterJ);
|
|
294
|
+
// Swap entries in the array
|
|
295
|
+
entries[i] = entryJ;
|
|
296
|
+
entries[j] = entryI;
|
|
297
|
+
// Update all entries' refs
|
|
298
|
+
for (let k = 0; k < oldLen; k++) {
|
|
299
|
+
updateEntry(entries[k], newItems[k], k);
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
// Fast path 5: full replace — no shared keys between old and new.
|
|
305
|
+
// Skipped when opts.leave is set so departing items can animate individually.
|
|
306
|
+
if (!hasLeave && oldLen > 0 && opts.key(newItems[0]) !== entries[0].key) {
|
|
307
|
+
const oldKeys = new Set();
|
|
308
|
+
for (const entry of entries)
|
|
309
|
+
oldKeys.add(entry.key);
|
|
310
|
+
let anyShared = false;
|
|
311
|
+
for (let i = 0; i < newLen; i++) {
|
|
312
|
+
if (oldKeys.has(opts.key(newItems[i]))) {
|
|
313
|
+
anyShared = true;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (!anyShared) {
|
|
318
|
+
if (report) {
|
|
319
|
+
for (const entry of entries)
|
|
320
|
+
collectNodes(report.leaving, entry.nodes);
|
|
321
|
+
}
|
|
322
|
+
// Bulk DOM removal using Range
|
|
323
|
+
const range = document.createRange();
|
|
324
|
+
range.setStartAfter(anchor);
|
|
325
|
+
const lastEntry = entries[entries.length - 1];
|
|
326
|
+
range.setEndAfter(lastEntry.nodes[lastEntry.nodes.length - 1]);
|
|
327
|
+
range.deleteContents();
|
|
328
|
+
// Bulk detach — see comment at the clear-all path above.
|
|
329
|
+
for (const entry of entries)
|
|
330
|
+
disposeScope(entry.scope, true);
|
|
331
|
+
removeOrphanedChildren(parentScope);
|
|
332
|
+
entries.length = 0;
|
|
333
|
+
// Build all new entries into a fragment
|
|
334
|
+
const frag = document.createDocumentFragment();
|
|
335
|
+
const newlyAdded = [];
|
|
336
|
+
for (let i = 0; i < newLen; i++) {
|
|
337
|
+
const entry = buildEntry(newItems[i], i, opts, parentScope, ctx, state);
|
|
338
|
+
entries.push(entry);
|
|
339
|
+
newlyAdded.push(entry);
|
|
340
|
+
for (const node of entry.nodes)
|
|
341
|
+
frag.appendChild(node);
|
|
342
|
+
}
|
|
343
|
+
parent.insertBefore(frag, anchor.nextSibling);
|
|
344
|
+
if (report) {
|
|
345
|
+
for (const entry of newlyAdded)
|
|
346
|
+
collectNodes(report.entering, entry.nodes);
|
|
347
|
+
}
|
|
348
|
+
for (const entry of newlyAdded)
|
|
349
|
+
fireEnter(entry, opts);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// General path: keyed reconciliation
|
|
354
|
+
const oldByKey = new Map();
|
|
355
|
+
for (const entry of entries) {
|
|
356
|
+
oldByKey.set(entry.key, entry);
|
|
357
|
+
}
|
|
358
|
+
const newEntries = [];
|
|
359
|
+
const usedKeys = new Set();
|
|
360
|
+
const newlyAdded = [];
|
|
361
|
+
for (let i = 0; i < newLen; i++) {
|
|
362
|
+
const item = newItems[i];
|
|
363
|
+
const key = opts.key(item);
|
|
364
|
+
usedKeys.add(key);
|
|
365
|
+
const existing = oldByKey.get(key);
|
|
366
|
+
if (existing) {
|
|
367
|
+
updateEntry(existing, item, i);
|
|
368
|
+
newEntries.push(existing);
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
const entry = buildEntry(item, i, opts, parentScope, ctx, state);
|
|
372
|
+
newEntries.push(entry);
|
|
373
|
+
newlyAdded.push(entry);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Remove entries not in the new list. Use bulk-detach pattern so
|
|
377
|
+
// disposing K removals costs O(K+P) rather than O(K*P) where P is
|
|
378
|
+
// parentScope.children.length (avoids K * indexOf+splice).
|
|
379
|
+
let didBulkDetach = false;
|
|
380
|
+
for (const entry of entries) {
|
|
381
|
+
if (!usedKeys.has(entry.key)) {
|
|
382
|
+
if (report)
|
|
383
|
+
collectNodes(report.leaving, entry.nodes);
|
|
384
|
+
if (hasLeave) {
|
|
385
|
+
removeEntry(entry, opts, leaving);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
for (const node of entry.nodes)
|
|
389
|
+
parent.removeChild(node);
|
|
390
|
+
disposeScope(entry.scope, true);
|
|
391
|
+
didBulkDetach = true;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (didBulkDetach)
|
|
396
|
+
removeOrphanedChildren(parentScope);
|
|
397
|
+
// Reorder DOM
|
|
398
|
+
const hasSurvivors = newEntries.some((e) => oldByKey.has(e.key));
|
|
399
|
+
if (!hasSurvivors || !survivorsInOrder(entries, newEntries, usedKeys)) {
|
|
400
|
+
// Full fragment rebuild — one reflow
|
|
401
|
+
const frag = document.createDocumentFragment();
|
|
402
|
+
for (const entry of newEntries) {
|
|
403
|
+
for (const node of entry.nodes)
|
|
404
|
+
frag.appendChild(node);
|
|
405
|
+
}
|
|
406
|
+
parent.insertBefore(frag, anchor.nextSibling);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
// Survivors in order — batch-insert new entries between survivors
|
|
410
|
+
let frag = null;
|
|
411
|
+
let insertRef = anchor.nextSibling;
|
|
412
|
+
for (const entry of newEntries) {
|
|
413
|
+
if (oldByKey.has(entry.key)) {
|
|
414
|
+
// Flush any pending fragment before this survivor
|
|
415
|
+
if (frag) {
|
|
416
|
+
parent.insertBefore(frag, insertRef);
|
|
417
|
+
frag = null;
|
|
418
|
+
}
|
|
419
|
+
// Skip past survivor's nodes
|
|
420
|
+
const lastNode = entry.nodes[entry.nodes.length - 1];
|
|
421
|
+
insertRef = lastNode ? lastNode.nextSibling : insertRef;
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
// Batch new entries into a fragment
|
|
425
|
+
if (!frag)
|
|
426
|
+
frag = document.createDocumentFragment();
|
|
427
|
+
for (const node of entry.nodes)
|
|
428
|
+
frag.appendChild(node);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (frag)
|
|
432
|
+
parent.insertBefore(frag, insertRef);
|
|
433
|
+
}
|
|
434
|
+
entries.length = 0;
|
|
435
|
+
entries.push(...newEntries);
|
|
436
|
+
if (report) {
|
|
437
|
+
for (const entry of newlyAdded)
|
|
438
|
+
collectNodes(report.entering, entry.nodes);
|
|
439
|
+
}
|
|
440
|
+
// Fire enter for newly-added entries (after DOM insertion)
|
|
441
|
+
if (opts.enter) {
|
|
442
|
+
for (const entry of newlyAdded)
|
|
443
|
+
fireEnter(entry, opts);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function updateEntry(entry, item, index) {
|
|
447
|
+
const changed = !Object.is(entry.item, item);
|
|
448
|
+
entry.item = item;
|
|
449
|
+
entry.current = item;
|
|
450
|
+
entry.index = index;
|
|
451
|
+
entry.scope.eachItemStable = !changed;
|
|
452
|
+
// Directly run per-item updaters when item changed — bypasses Phase 2
|
|
453
|
+
if (changed) {
|
|
454
|
+
const updaters = entry.scope.itemUpdaters;
|
|
455
|
+
for (let i = 0; i < updaters.length; i++) {
|
|
456
|
+
updaters[i]();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function isAppendOnly(entries, newItems, opts) {
|
|
461
|
+
for (let i = 0; i < entries.length; i++) {
|
|
462
|
+
if (entries[i].key !== opts.key(newItems[i]))
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
function detectSwap(entries, newItems, opts) {
|
|
468
|
+
let diff1 = -1;
|
|
469
|
+
let diff2 = -1;
|
|
470
|
+
let diffCount = 0;
|
|
471
|
+
for (let i = 0; i < entries.length; i++) {
|
|
472
|
+
const newKey = opts.key(newItems[i]);
|
|
473
|
+
if (entries[i].key !== newKey) {
|
|
474
|
+
diffCount++;
|
|
475
|
+
if (diffCount === 1)
|
|
476
|
+
diff1 = i;
|
|
477
|
+
else if (diffCount === 2)
|
|
478
|
+
diff2 = i;
|
|
479
|
+
else
|
|
480
|
+
return null; // more than 2 differences
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (diffCount !== 2)
|
|
484
|
+
return null;
|
|
485
|
+
// Verify it's actually a swap (keys are exchanged)
|
|
486
|
+
const oldKey1 = entries[diff1].key;
|
|
487
|
+
const oldKey2 = entries[diff2].key;
|
|
488
|
+
const newKey1 = opts.key(newItems[diff1]);
|
|
489
|
+
const newKey2 = opts.key(newItems[diff2]);
|
|
490
|
+
if (oldKey1 === newKey2 && oldKey2 === newKey1) {
|
|
491
|
+
return [diff1, diff2];
|
|
492
|
+
}
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
function survivorsInOrder(oldEntries, newEntries, usedKeys) {
|
|
496
|
+
// Build old-index map for survivors
|
|
497
|
+
const oldIndexMap = new Map();
|
|
498
|
+
for (let i = 0; i < oldEntries.length; i++) {
|
|
499
|
+
if (usedKeys.has(oldEntries[i].key)) {
|
|
500
|
+
oldIndexMap.set(oldEntries[i].key, i);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
// Check that survivors appear in increasing old-index order in newEntries
|
|
504
|
+
let maxOldIndex = -1;
|
|
505
|
+
for (const entry of newEntries) {
|
|
506
|
+
const oldIdx = oldIndexMap.get(entry.key);
|
|
507
|
+
if (oldIdx === undefined)
|
|
508
|
+
continue; // new entry, skip
|
|
509
|
+
if (oldIdx < maxOldIndex)
|
|
510
|
+
return false;
|
|
511
|
+
maxOldIndex = oldIdx;
|
|
512
|
+
}
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
//# sourceMappingURL=each.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"each.js","sourceRoot":"","sources":["../../src/primitives/each.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAG7D,8EAA8E;AAC9E,MAAM,QAAQ,GAAkB;IAC9B,SAAS,EAAE,IAAwB;IACnC,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,EAAE;CACrB,CAAA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IAAI,EAAE,CAAA;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC,GAAG,IAAI,EAAE,CA+BT"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getRenderContext, setRenderContext, clearRenderContext } from '../render-context';
|
|
2
|
+
import { createScope, disposeScope } from '../scope';
|
|
3
|
+
export function errorBoundary(opts) {
|
|
4
|
+
const ctx = getRenderContext();
|
|
5
|
+
const parentScope = ctx.rootScope;
|
|
6
|
+
const childScope = createScope(parentScope);
|
|
7
|
+
try {
|
|
8
|
+
const buildCtx = { ...ctx, rootScope: childScope };
|
|
9
|
+
setRenderContext(buildCtx);
|
|
10
|
+
const nodes = opts.render();
|
|
11
|
+
clearRenderContext();
|
|
12
|
+
setRenderContext(ctx);
|
|
13
|
+
return nodes;
|
|
14
|
+
}
|
|
15
|
+
catch (thrown) {
|
|
16
|
+
// Clean up the partially-created scope
|
|
17
|
+
disposeScope(childScope);
|
|
18
|
+
const error = thrown instanceof Error ? thrown : new Error(String(thrown));
|
|
19
|
+
if (opts.onError) {
|
|
20
|
+
opts.onError(error);
|
|
21
|
+
}
|
|
22
|
+
// Build fallback in a fresh scope
|
|
23
|
+
const fallbackScope = createScope(parentScope);
|
|
24
|
+
const fallbackCtx = { ...ctx, rootScope: fallbackScope };
|
|
25
|
+
setRenderContext(fallbackCtx);
|
|
26
|
+
const fallbackNodes = opts.fallback(error);
|
|
27
|
+
clearRenderContext();
|
|
28
|
+
setRenderContext(ctx);
|
|
29
|
+
return fallbackNodes;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=error-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../../src/primitives/error-boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;A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