@farm.js/react 0.1.0-beta.7 → 0.1.0-beta.9
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/README.md +409 -67
- package/dist/compiler-runtime.cjs +2690 -226
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +70 -3
- package/dist/compiler-runtime.d.ts +70 -3
- package/dist/compiler-runtime.mjs +2644 -227
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +1630 -111
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +1632 -113
- package/dist/vite.mjs.map +1 -1
- package/package.json +5 -4
|
@@ -19,6 +19,9 @@ function materializeIterable(source) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// src/compiler-runtime.tsx
|
|
22
|
+
function reversedCompilerKeyedArrayOrder(order) {
|
|
23
|
+
return order === 0 /* Reverse */ ? void 0 : order ?? 0 /* Reverse */;
|
|
24
|
+
}
|
|
22
25
|
var COMPILER_KEYED_COLLECTION_TOKENS = /* @__PURE__ */ new WeakMap();
|
|
23
26
|
var COMPILER_KEYED_MAP_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
24
27
|
var COMPILER_KEYED_ARRAY_APPENDS = /* @__PURE__ */ new WeakMap();
|
|
@@ -26,13 +29,17 @@ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
|
|
|
26
29
|
var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
|
|
27
30
|
var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
|
|
28
31
|
var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
var COMPILER_KEYED_ARRAY_BATCH_INSERTS = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
var COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS = /* @__PURE__ */ new WeakMap();
|
|
29
34
|
var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
|
|
30
35
|
var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
31
36
|
var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
32
37
|
var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
|
|
38
|
+
var COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS = /* @__PURE__ */ new WeakMap();
|
|
33
39
|
var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
|
|
34
40
|
var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
|
|
35
41
|
var NATIVE_ARRAY_FILTER = Array.prototype.filter;
|
|
42
|
+
var NATIVE_ARRAY_MAP = Array.prototype.map;
|
|
36
43
|
var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
37
44
|
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
38
45
|
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
@@ -58,6 +65,26 @@ function commitCompilerKeyedCollection(value) {
|
|
|
58
65
|
COMPILER_KEYED_COMMITTED_COLLECTIONS.add(target);
|
|
59
66
|
return compilerKeyedCollectionToken(target);
|
|
60
67
|
}
|
|
68
|
+
function commitCompilerKeyedCollectionWithItemSnapshot(value, instances) {
|
|
69
|
+
const token = commitCompilerKeyedCollection(value);
|
|
70
|
+
if (!token) return void 0;
|
|
71
|
+
if (!instances) {
|
|
72
|
+
COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.delete(token);
|
|
73
|
+
return token;
|
|
74
|
+
}
|
|
75
|
+
const items = [];
|
|
76
|
+
let index = 0;
|
|
77
|
+
for (const instance of instances.values()) {
|
|
78
|
+
if (instance.index !== index) {
|
|
79
|
+
COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.delete(token);
|
|
80
|
+
return token;
|
|
81
|
+
}
|
|
82
|
+
items.push(instance.item);
|
|
83
|
+
index += 1;
|
|
84
|
+
}
|
|
85
|
+
COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.set(token, items);
|
|
86
|
+
return token;
|
|
87
|
+
}
|
|
61
88
|
function compilerKeyedMapChangedIndices(value, sourceToken) {
|
|
62
89
|
const target = compilerObject(value);
|
|
63
90
|
if (!target || !sourceToken) return void 0;
|
|
@@ -87,11 +114,52 @@ function compilerKeyedArrayAppendStart(value, sourceToken, expectedStart) {
|
|
|
87
114
|
}
|
|
88
115
|
return length === value.length ? expectedStart : void 0;
|
|
89
116
|
}
|
|
117
|
+
function compilerKeyedArrayStructuralAppendUpdate(value, sourceToken, expectedStart) {
|
|
118
|
+
const target = compilerObject(value);
|
|
119
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
120
|
+
const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
|
|
121
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
122
|
+
const updates = [];
|
|
123
|
+
for (let current = update; current; current = current.previous) {
|
|
124
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
125
|
+
updates.push(current);
|
|
126
|
+
}
|
|
127
|
+
updates.reverse();
|
|
128
|
+
const structuralUpdate = update.structuralUpdate;
|
|
129
|
+
const first = updates[0];
|
|
130
|
+
const survivorResult = structuralUpdate ? compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
131
|
+
structuralUpdate,
|
|
132
|
+
sourceToken,
|
|
133
|
+
expectedStart,
|
|
134
|
+
first.startIndex
|
|
135
|
+
) : void 0;
|
|
136
|
+
if (structuralUpdate && !survivorResult) return void 0;
|
|
137
|
+
let length = structuralUpdate ? first.startIndex : expectedStart;
|
|
138
|
+
const startIndex = length;
|
|
139
|
+
for (const current of updates) {
|
|
140
|
+
if (current.startIndex !== length || current.resultLength < length) return void 0;
|
|
141
|
+
length = current.resultLength;
|
|
142
|
+
}
|
|
143
|
+
return length === value.length ? {
|
|
144
|
+
startIndex,
|
|
145
|
+
structuralUpdate,
|
|
146
|
+
...survivorResult ? { structuralSurvivors: survivorResult } : {}
|
|
147
|
+
} : void 0;
|
|
148
|
+
}
|
|
90
149
|
function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
|
|
91
150
|
const target = compilerObject(value);
|
|
92
151
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
93
152
|
const update = COMPILER_KEYED_ARRAY_FILTERS.get(target);
|
|
94
153
|
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
154
|
+
return compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
155
|
+
update,
|
|
156
|
+
sourceToken,
|
|
157
|
+
expectedLength,
|
|
158
|
+
value.length
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function compilerKeyedArrayFilterSurvivorsFromUpdate(update, sourceToken, expectedLength, resultLength) {
|
|
162
|
+
if (!sourceToken || update.sourceToken !== sourceToken) return void 0;
|
|
95
163
|
const updates = [];
|
|
96
164
|
for (let current = update; current; current = current.previous) {
|
|
97
165
|
if (current.sourceToken !== sourceToken) return void 0;
|
|
@@ -121,7 +189,80 @@ function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
|
|
|
121
189
|
if (current.resultLength !== current.sourceLength - removed.size) return void 0;
|
|
122
190
|
survivors = survivors.filter((_sourceIndex, index) => !removed.has(index));
|
|
123
191
|
}
|
|
124
|
-
return survivors.length ===
|
|
192
|
+
return survivors.length === resultLength ? { indices: survivors, keysStable } : void 0;
|
|
193
|
+
}
|
|
194
|
+
function compilerKeyedArraySliceSurvivorRangeFromUpdate(update, sourceToken, expectedLength, resultLength) {
|
|
195
|
+
if (!sourceToken || update.sourceToken !== sourceToken) return void 0;
|
|
196
|
+
const updates = [];
|
|
197
|
+
for (let current = update; current; current = current.previous) {
|
|
198
|
+
if (current.sourceToken !== sourceToken || current.kind !== "slice") return void 0;
|
|
199
|
+
updates.push(current);
|
|
200
|
+
}
|
|
201
|
+
let length = expectedLength;
|
|
202
|
+
let start = 0;
|
|
203
|
+
for (let index = updates.length - 1; index >= 0; index -= 1) {
|
|
204
|
+
const current = updates[index];
|
|
205
|
+
const retainedStart = current.retainedStart;
|
|
206
|
+
const retainedEnd = current.retainedEnd;
|
|
207
|
+
if (current.sourceLength !== length || retainedStart === void 0 || retainedEnd === void 0 || !Number.isSafeInteger(retainedStart) || !Number.isSafeInteger(retainedEnd) || retainedStart < 0 || retainedEnd < retainedStart || retainedEnd > current.sourceLength || current.resultLength !== retainedEnd - retainedStart) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
start += retainedStart;
|
|
211
|
+
length = current.resultLength;
|
|
212
|
+
}
|
|
213
|
+
return length === resultLength ? { end: start + length, start } : void 0;
|
|
214
|
+
}
|
|
215
|
+
function compilerKeyedArrayStructuralAppendMapUpdate(value, sourceToken, expectedStart, requireMappedUpdate = false) {
|
|
216
|
+
const target = compilerObject(value);
|
|
217
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
218
|
+
const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
|
|
219
|
+
if (!update || update.sourceToken !== sourceToken || !update.structuralUpdate || requireMappedUpdate && !update.mappedItemSources) {
|
|
220
|
+
return void 0;
|
|
221
|
+
}
|
|
222
|
+
const updates = [];
|
|
223
|
+
for (let current = update; current; current = current.previous) {
|
|
224
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
225
|
+
updates.push(current);
|
|
226
|
+
}
|
|
227
|
+
updates.reverse();
|
|
228
|
+
const first = updates[0];
|
|
229
|
+
const structuralSurvivorRange = compilerKeyedArraySliceSurvivorRangeFromUpdate(
|
|
230
|
+
update.structuralUpdate,
|
|
231
|
+
sourceToken,
|
|
232
|
+
expectedStart,
|
|
233
|
+
first.startIndex
|
|
234
|
+
);
|
|
235
|
+
const structuralSurvivors = structuralSurvivorRange ? void 0 : compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
236
|
+
update.structuralUpdate,
|
|
237
|
+
sourceToken,
|
|
238
|
+
expectedStart,
|
|
239
|
+
first.startIndex
|
|
240
|
+
)?.indices;
|
|
241
|
+
if (!structuralSurvivorRange && !structuralSurvivors) return void 0;
|
|
242
|
+
let length = first.startIndex;
|
|
243
|
+
const startIndex = length;
|
|
244
|
+
for (const current of updates) {
|
|
245
|
+
if (current.startIndex !== length || current.resultLength < length) return void 0;
|
|
246
|
+
length = current.resultLength;
|
|
247
|
+
}
|
|
248
|
+
return length === value.length ? {
|
|
249
|
+
startIndex,
|
|
250
|
+
...structuralSurvivorRange ? { structuralSurvivorRange } : {},
|
|
251
|
+
...structuralSurvivors ? { structuralSurvivors } : {},
|
|
252
|
+
...update.mappedItemSources ? { mappedItemSources: update.mappedItemSources } : {},
|
|
253
|
+
...update.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {}
|
|
254
|
+
} : void 0;
|
|
255
|
+
}
|
|
256
|
+
function compilerKeyedArrayFilterSource(update, resultLength) {
|
|
257
|
+
if (update.resultLength !== resultLength) return void 0;
|
|
258
|
+
let current = update;
|
|
259
|
+
while (current.previous) {
|
|
260
|
+
if (current.sourceToken !== current.previous.sourceToken || current.sourceLength !== current.previous.resultLength) {
|
|
261
|
+
return void 0;
|
|
262
|
+
}
|
|
263
|
+
current = current.previous;
|
|
264
|
+
}
|
|
265
|
+
return { sourceLength: current.sourceLength, sourceToken: current.sourceToken };
|
|
125
266
|
}
|
|
126
267
|
function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
|
|
127
268
|
const target = compilerObject(value);
|
|
@@ -145,29 +286,148 @@ function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
|
|
|
145
286
|
}
|
|
146
287
|
return length === value.length ? prefixLength : void 0;
|
|
147
288
|
}
|
|
148
|
-
function
|
|
289
|
+
function compilerKeyedArrayStructuralPrependUpdate(value, sourceToken, expectedLength) {
|
|
149
290
|
const target = compilerObject(value);
|
|
150
291
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
151
|
-
const update =
|
|
152
|
-
if (!update || update.sourceToken !== sourceToken
|
|
292
|
+
const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
|
|
293
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
294
|
+
const updates = [];
|
|
295
|
+
for (let current = update; current; current = current.previous) {
|
|
296
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
297
|
+
updates.push(current);
|
|
298
|
+
}
|
|
299
|
+
updates.reverse();
|
|
300
|
+
const structuralUpdate = update.structuralUpdate;
|
|
301
|
+
const first = updates[0];
|
|
302
|
+
const survivorResult = structuralUpdate ? compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
303
|
+
structuralUpdate,
|
|
304
|
+
sourceToken,
|
|
305
|
+
expectedLength,
|
|
306
|
+
first.sourceLength
|
|
307
|
+
) : void 0;
|
|
308
|
+
if (structuralUpdate && !survivorResult) return void 0;
|
|
309
|
+
let length = structuralUpdate ? first.sourceLength : expectedLength;
|
|
310
|
+
let prefixLength = 0;
|
|
311
|
+
for (const current of updates) {
|
|
312
|
+
if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
|
|
313
|
+
return void 0;
|
|
314
|
+
}
|
|
315
|
+
length = current.resultLength;
|
|
316
|
+
prefixLength += current.prefixLength;
|
|
317
|
+
}
|
|
318
|
+
return length === value.length ? {
|
|
319
|
+
prefixLength,
|
|
320
|
+
structuralUpdate,
|
|
321
|
+
...survivorResult ? { structuralSurvivors: survivorResult } : {}
|
|
322
|
+
} : void 0;
|
|
323
|
+
}
|
|
324
|
+
function compilerKeyedArrayStructuralPrependMapUpdate(value, sourceToken, expectedLength, requireMappedUpdate = false) {
|
|
325
|
+
const target = compilerObject(value);
|
|
326
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
327
|
+
const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
|
|
328
|
+
if (!update || update.sourceToken !== sourceToken || !update.structuralUpdate || requireMappedUpdate && !update.mappedItemSources) {
|
|
153
329
|
return void 0;
|
|
154
330
|
}
|
|
155
|
-
|
|
331
|
+
const updates = [];
|
|
332
|
+
for (let current = update; current; current = current.previous) {
|
|
333
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
334
|
+
updates.push(current);
|
|
335
|
+
}
|
|
336
|
+
updates.reverse();
|
|
337
|
+
const first = updates[0];
|
|
338
|
+
const structuralSurvivorRange = compilerKeyedArraySliceSurvivorRangeFromUpdate(
|
|
339
|
+
update.structuralUpdate,
|
|
340
|
+
sourceToken,
|
|
341
|
+
expectedLength,
|
|
342
|
+
first.sourceLength
|
|
343
|
+
);
|
|
344
|
+
const structuralSurvivors = structuralSurvivorRange ? void 0 : compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
345
|
+
update.structuralUpdate,
|
|
346
|
+
sourceToken,
|
|
347
|
+
expectedLength,
|
|
348
|
+
first.sourceLength
|
|
349
|
+
)?.indices;
|
|
350
|
+
if (!structuralSurvivorRange && !structuralSurvivors) return void 0;
|
|
351
|
+
let length = first.sourceLength;
|
|
352
|
+
let prefixLength = 0;
|
|
353
|
+
for (const current of updates) {
|
|
354
|
+
if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
|
|
355
|
+
return void 0;
|
|
356
|
+
}
|
|
357
|
+
length = current.resultLength;
|
|
358
|
+
prefixLength += current.prefixLength;
|
|
359
|
+
}
|
|
360
|
+
return length === value.length ? {
|
|
361
|
+
prefixLength,
|
|
362
|
+
...structuralSurvivorRange ? { structuralSurvivorRange } : {},
|
|
363
|
+
...structuralSurvivors ? { structuralSurvivors } : {},
|
|
364
|
+
...update.mappedItemSources ? { mappedItemSources: update.mappedItemSources } : {},
|
|
365
|
+
...update.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {}
|
|
366
|
+
} : void 0;
|
|
367
|
+
}
|
|
368
|
+
function compilerKeyedArrayRollingWindows(value, sourceToken, expectedLength) {
|
|
369
|
+
const target = compilerObject(value);
|
|
370
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
371
|
+
const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
|
|
372
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
373
|
+
const updates = [];
|
|
374
|
+
for (let current = update; current; current = current.previous) {
|
|
375
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
376
|
+
updates.push(current);
|
|
377
|
+
}
|
|
378
|
+
updates.reverse();
|
|
379
|
+
let length = expectedLength;
|
|
380
|
+
for (const current of updates) {
|
|
381
|
+
if (current.sourceLength !== length || current.retainedStart < 1 || current.retainedStart > current.sourceLength || current.retainedEnd !== current.sourceLength || current.resultLength <= current.retainedEnd - current.retainedStart) {
|
|
382
|
+
return void 0;
|
|
383
|
+
}
|
|
384
|
+
length = current.resultLength;
|
|
385
|
+
}
|
|
386
|
+
return length === value.length ? updates : void 0;
|
|
156
387
|
}
|
|
157
388
|
function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
|
|
158
389
|
const target = compilerObject(value);
|
|
159
390
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
160
391
|
const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
|
|
161
|
-
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.
|
|
392
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.resultLength >= expectedLength || update.position > update.resultLength) || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
|
|
393
|
+
return void 0;
|
|
394
|
+
}
|
|
395
|
+
return update;
|
|
396
|
+
}
|
|
397
|
+
function compilerKeyedArrayBatchInsert(value, sourceToken, expectedLength) {
|
|
398
|
+
const target = compilerObject(value);
|
|
399
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
400
|
+
const update = COMPILER_KEYED_ARRAY_BATCH_INSERTS.get(target);
|
|
401
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.resultLength < expectedLength + 2 || update.position < 0 || update.position > expectedLength) {
|
|
162
402
|
return void 0;
|
|
163
403
|
}
|
|
164
404
|
return update;
|
|
165
405
|
}
|
|
406
|
+
function compilerKeyedArrayWindowReplacements(value, sourceToken, expectedLength) {
|
|
407
|
+
const target = compilerObject(value);
|
|
408
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
409
|
+
const update = COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(target);
|
|
410
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
411
|
+
const updates = [];
|
|
412
|
+
for (let current = update; current; current = current.previous) {
|
|
413
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
414
|
+
updates.push(current);
|
|
415
|
+
}
|
|
416
|
+
updates.reverse();
|
|
417
|
+
let length = expectedLength;
|
|
418
|
+
for (const current of updates) {
|
|
419
|
+
if (current.sourceLength !== length || current.position < 0 || current.position >= current.sourceLength || current.removedCount < 1 || current.position + current.removedCount > current.sourceLength || current.insertedCount < 0 || current.resultLength !== current.sourceLength - current.removedCount + current.insertedCount) {
|
|
420
|
+
return void 0;
|
|
421
|
+
}
|
|
422
|
+
length = current.resultLength;
|
|
423
|
+
}
|
|
424
|
+
return length === value.length ? updates : void 0;
|
|
425
|
+
}
|
|
166
426
|
function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
|
|
167
427
|
const target = compilerObject(value);
|
|
168
428
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
169
429
|
const update = COMPILER_KEYED_ARRAY_REORDERS.get(target);
|
|
170
|
-
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== expectedLength || update.resultLength !== value.length) {
|
|
430
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || !update.structuralUpdate && update.resultLength !== expectedLength || update.resultLength !== value.length) {
|
|
171
431
|
return void 0;
|
|
172
432
|
}
|
|
173
433
|
return update;
|
|
@@ -184,7 +444,7 @@ function compilerKeyedCollectionChangedKeys(value, sourceToken, kind) {
|
|
|
184
444
|
}
|
|
185
445
|
return changedKeys;
|
|
186
446
|
}
|
|
187
|
-
function
|
|
447
|
+
function recordCompilerKeyedMapUpdate(previous, value, changedIndices) {
|
|
188
448
|
const previousTarget = compilerObject(previous);
|
|
189
449
|
const valueTarget = compilerObject(value);
|
|
190
450
|
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
@@ -198,6 +458,212 @@ function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
|
|
|
198
458
|
}
|
|
199
459
|
return value;
|
|
200
460
|
}
|
|
461
|
+
function executeCompilerKeyedMapPipeline(previous, pipeline, record) {
|
|
462
|
+
let eligible = true;
|
|
463
|
+
const applyMap = (collection, method, callback) => {
|
|
464
|
+
const value2 = NATIVE_REFLECT_APPLY(
|
|
465
|
+
method,
|
|
466
|
+
collection,
|
|
467
|
+
[callback]
|
|
468
|
+
);
|
|
469
|
+
if (method !== NATIVE_ARRAY_MAP) {
|
|
470
|
+
eligible = false;
|
|
471
|
+
return value2;
|
|
472
|
+
}
|
|
473
|
+
try {
|
|
474
|
+
if (!Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
475
|
+
eligible = false;
|
|
476
|
+
}
|
|
477
|
+
} catch {
|
|
478
|
+
eligible = false;
|
|
479
|
+
}
|
|
480
|
+
return value2;
|
|
481
|
+
};
|
|
482
|
+
const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
|
|
483
|
+
return eligible ? record(previous, value) : value;
|
|
484
|
+
}
|
|
485
|
+
function recordCompilerKeyedMapPipelineUpdate(previous, value) {
|
|
486
|
+
try {
|
|
487
|
+
if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
|
|
488
|
+
return value;
|
|
489
|
+
}
|
|
490
|
+
const finalChangedIndices = [];
|
|
491
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
492
|
+
const previousDescriptor = Object.getOwnPropertyDescriptor(previous, index);
|
|
493
|
+
const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
|
|
494
|
+
if (!previousDescriptor || !("value" in previousDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
|
|
495
|
+
return value;
|
|
496
|
+
}
|
|
497
|
+
if (mappedDescriptor.value !== previousDescriptor.value) finalChangedIndices.push(index);
|
|
498
|
+
}
|
|
499
|
+
return recordCompilerKeyedMapUpdate(previous, value, finalChangedIndices);
|
|
500
|
+
} catch {
|
|
501
|
+
return value;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function createCompilerKeyedMapUpdate(previous, valueOrPipeline, changedIndices) {
|
|
505
|
+
if (Array.isArray(changedIndices)) {
|
|
506
|
+
return recordCompilerKeyedMapUpdate(previous, valueOrPipeline, changedIndices);
|
|
507
|
+
}
|
|
508
|
+
if (changedIndices !== void 0 || typeof valueOrPipeline !== "function") {
|
|
509
|
+
return valueOrPipeline;
|
|
510
|
+
}
|
|
511
|
+
return executeCompilerKeyedMapPipeline(
|
|
512
|
+
previous,
|
|
513
|
+
valueOrPipeline,
|
|
514
|
+
recordCompilerKeyedMapPipelineUpdate
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function recordCompilerKeyedArrayMapPipeline(previous, value) {
|
|
518
|
+
try {
|
|
519
|
+
const previousTarget = compilerObject(previous);
|
|
520
|
+
const valueTarget = compilerObject(value);
|
|
521
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
|
|
522
|
+
return value;
|
|
523
|
+
}
|
|
524
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
525
|
+
const previousReorder = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
526
|
+
const structuralUpdate = previousReorder?.structuralUpdate || (!previousReorder ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0);
|
|
527
|
+
const structuralSource = structuralUpdate ? compilerKeyedArrayFilterSource(structuralUpdate, previous.length) : void 0;
|
|
528
|
+
const previousSource = previousReorder && !previousReorder.structuralUpdate ? previousReorder : void 0;
|
|
529
|
+
if (!committedSource && (!previousSource || previousSource.resultLength !== previous.length) && !structuralSource) {
|
|
530
|
+
return value;
|
|
531
|
+
}
|
|
532
|
+
const sourceToken = previousSource?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
533
|
+
if (!sourceToken) return value;
|
|
534
|
+
const previousMappedItemSources = previousReorder?.mappedItemSources || structuralUpdate?.mappedItemSources;
|
|
535
|
+
const mappedItemSources = /* @__PURE__ */ new Map();
|
|
536
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
537
|
+
const previousDescriptor = Object.getOwnPropertyDescriptor(previous, index);
|
|
538
|
+
const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
|
|
539
|
+
if (!previousDescriptor || !("value" in previousDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
|
|
540
|
+
return value;
|
|
541
|
+
}
|
|
542
|
+
const previousItem = previousDescriptor.value;
|
|
543
|
+
const sourceItem = previousMappedItemSources?.has(previousItem) ? previousMappedItemSources.get(previousItem) : previousItem;
|
|
544
|
+
const mappedItem = mappedDescriptor.value;
|
|
545
|
+
if (!Object.is(mappedItem, sourceItem)) mappedItemSources.set(mappedItem, sourceItem);
|
|
546
|
+
}
|
|
547
|
+
const hint = {
|
|
548
|
+
kind: committedSource ? void 0 : previousReorder?.kind,
|
|
549
|
+
sourceToken,
|
|
550
|
+
sourceLength: previousSource?.sourceLength ?? structuralSource?.sourceLength ?? previous.length,
|
|
551
|
+
resultLength: value.length,
|
|
552
|
+
mapped: true,
|
|
553
|
+
mappedItemSources,
|
|
554
|
+
...structuralUpdate ? { structuralUpdate } : {}
|
|
555
|
+
};
|
|
556
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, hint);
|
|
557
|
+
} catch {
|
|
558
|
+
}
|
|
559
|
+
return value;
|
|
560
|
+
}
|
|
561
|
+
function createCompilerKeyedArrayMapPipeline(previous, methodOrPipeline, callback) {
|
|
562
|
+
if (callback !== void 0) {
|
|
563
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
564
|
+
methodOrPipeline,
|
|
565
|
+
previous,
|
|
566
|
+
[callback]
|
|
567
|
+
);
|
|
568
|
+
if (methodOrPipeline !== NATIVE_ARRAY_MAP) return value;
|
|
569
|
+
return recordCompilerKeyedArrayMapPipeline(previous, value);
|
|
570
|
+
}
|
|
571
|
+
return executeCompilerKeyedMapPipeline(
|
|
572
|
+
previous,
|
|
573
|
+
methodOrPipeline,
|
|
574
|
+
recordCompilerKeyedArrayMapPipeline
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
function recordCompilerKeyedArrayQueuedMapPipeline(previous, value) {
|
|
578
|
+
try {
|
|
579
|
+
const previousTarget = compilerObject(previous);
|
|
580
|
+
const valueTarget = compilerObject(value);
|
|
581
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length) {
|
|
582
|
+
return value;
|
|
583
|
+
}
|
|
584
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
585
|
+
const previousReorder = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
586
|
+
if (!committedSource && (!previousReorder || previousReorder.structuralUpdate || previousReorder.resultLength !== previous.length)) {
|
|
587
|
+
return value;
|
|
588
|
+
}
|
|
589
|
+
const sourceToken = previousReorder?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
590
|
+
if (!sourceToken) return value;
|
|
591
|
+
const sourceItems = previousReorder?.mappedItemSources?.queuedSourceItems || previous;
|
|
592
|
+
let mappedItemSources;
|
|
593
|
+
const readMappedItemSources = () => {
|
|
594
|
+
if (mappedItemSources) return mappedItemSources;
|
|
595
|
+
const sources = /* @__PURE__ */ new Map();
|
|
596
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
597
|
+
const sourceDescriptor = Object.getOwnPropertyDescriptor(sourceItems, index);
|
|
598
|
+
const mappedDescriptor = Object.getOwnPropertyDescriptor(value, index);
|
|
599
|
+
if (!sourceDescriptor || !("value" in sourceDescriptor) || !mappedDescriptor || !("value" in mappedDescriptor)) {
|
|
600
|
+
throw new TypeError();
|
|
601
|
+
}
|
|
602
|
+
if (!Object.is(sourceDescriptor.value, mappedDescriptor.value)) {
|
|
603
|
+
sources.set(mappedDescriptor.value, sourceDescriptor.value);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
mappedItemSources = sources;
|
|
607
|
+
return sources;
|
|
608
|
+
};
|
|
609
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
610
|
+
kind: previousReorder?.kind,
|
|
611
|
+
sourceToken,
|
|
612
|
+
sourceLength: previousReorder?.sourceLength ?? previous.length,
|
|
613
|
+
resultLength: value.length,
|
|
614
|
+
mapped: true,
|
|
615
|
+
// Array.map preserves positions. Retain the first queued source collection and validate its
|
|
616
|
+
// data properties against the final collection once, immediately before the DOM commit.
|
|
617
|
+
// This avoids rescanning every intermediate Array produced by separately queued setters.
|
|
618
|
+
mappedItemSources: {
|
|
619
|
+
queuedSourceItems: sourceItems,
|
|
620
|
+
get: (item) => readMappedItemSources().get(item),
|
|
621
|
+
has: (item) => readMappedItemSources().has(item)
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
} catch {
|
|
625
|
+
}
|
|
626
|
+
return value;
|
|
627
|
+
}
|
|
628
|
+
function createCompilerKeyedArrayQueuedMapPipeline(previous, pipeline) {
|
|
629
|
+
return executeCompilerKeyedMapPipeline(
|
|
630
|
+
previous,
|
|
631
|
+
pipeline,
|
|
632
|
+
recordCompilerKeyedArrayQueuedMapPipeline
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
function createCompilerKeyedArrayMapReorder(previous, method, ...args) {
|
|
636
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
637
|
+
method,
|
|
638
|
+
previous,
|
|
639
|
+
args
|
|
640
|
+
);
|
|
641
|
+
try {
|
|
642
|
+
const previousTarget = compilerObject(previous);
|
|
643
|
+
const valueTarget = compilerObject(value);
|
|
644
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== previous.length || method !== NATIVE_ARRAY_TO_REVERSED && method !== NATIVE_ARRAY_TO_SORTED || method === NATIVE_ARRAY_TO_REVERSED && args.length !== 0 || method === NATIVE_ARRAY_TO_SORTED && (args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function")) {
|
|
645
|
+
return value;
|
|
646
|
+
}
|
|
647
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
648
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index) || !Object.prototype.hasOwnProperty.call(value, index)) {
|
|
649
|
+
return value;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const previousReorder = COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
653
|
+
const source = previousReorder?.mapped ? previousReorder : void 0;
|
|
654
|
+
if (!source || source.resultLength !== previous.length) return value;
|
|
655
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
656
|
+
kind: method !== NATIVE_ARRAY_TO_REVERSED ? 1 /* Permutation */ : reversedCompilerKeyedArrayOrder(source.kind),
|
|
657
|
+
sourceToken: source.sourceToken,
|
|
658
|
+
sourceLength: source.sourceLength,
|
|
659
|
+
resultLength: value.length,
|
|
660
|
+
mapped: true,
|
|
661
|
+
mappedItemSources: source.mappedItemSources
|
|
662
|
+
});
|
|
663
|
+
} catch {
|
|
664
|
+
}
|
|
665
|
+
return value;
|
|
666
|
+
}
|
|
201
667
|
function createCompilerKeyedArrayAppend(previous, value) {
|
|
202
668
|
try {
|
|
203
669
|
const previousTarget = compilerObject(previous);
|
|
@@ -221,24 +687,27 @@ function createCompilerKeyedArrayAppend(previous, value) {
|
|
|
221
687
|
return value;
|
|
222
688
|
}
|
|
223
689
|
}
|
|
224
|
-
function
|
|
690
|
+
function createCompilerKeyedArrayStructuralAppend(previous, value) {
|
|
225
691
|
try {
|
|
226
692
|
const previousTarget = compilerObject(previous);
|
|
227
693
|
const valueTarget = compilerObject(value);
|
|
228
694
|
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
229
695
|
return value;
|
|
230
696
|
}
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
697
|
+
const startIndex = previous.length;
|
|
698
|
+
if (value.length < startIndex) return value;
|
|
699
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
700
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget);
|
|
701
|
+
const directStructuralUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
|
|
702
|
+
const structuralSource = directStructuralUpdate ? compilerKeyedArrayFilterSource(directStructuralUpdate, previous.length) : void 0;
|
|
703
|
+
const structuralUpdate = previousUpdate?.structuralUpdate || (structuralSource ? directStructuralUpdate : void 0);
|
|
704
|
+
const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
235
705
|
if (!sourceToken) return value;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
sourceLength,
|
|
706
|
+
COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
|
|
707
|
+
sourceToken,
|
|
708
|
+
startIndex,
|
|
240
709
|
resultLength: value.length,
|
|
241
|
-
|
|
710
|
+
...structuralUpdate ? { structuralUpdate } : {},
|
|
242
711
|
...previousUpdate ? { previous: previousUpdate } : {}
|
|
243
712
|
});
|
|
244
713
|
return value;
|
|
@@ -246,48 +715,395 @@ function createCompilerKeyedArrayPrepend(previous, value) {
|
|
|
246
715
|
return value;
|
|
247
716
|
}
|
|
248
717
|
}
|
|
249
|
-
function
|
|
250
|
-
let canHint = false;
|
|
251
|
-
let sourceLength = 0;
|
|
252
|
-
try {
|
|
253
|
-
canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
|
|
254
|
-
if (canHint) sourceLength = previous.length;
|
|
255
|
-
} catch {
|
|
256
|
-
canHint = false;
|
|
257
|
-
}
|
|
258
|
-
if (!canHint) {
|
|
259
|
-
return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
|
|
260
|
-
}
|
|
261
|
-
const removedIndices = [];
|
|
262
|
-
let visited = 0;
|
|
263
|
-
const wrappedPredicate = function(item, index, collection) {
|
|
264
|
-
visited += 1;
|
|
265
|
-
const keep = NATIVE_REFLECT_APPLY(predicate, this, [
|
|
266
|
-
item,
|
|
267
|
-
index,
|
|
268
|
-
collection
|
|
269
|
-
]);
|
|
270
|
-
if (!keep) removedIndices.push(index);
|
|
271
|
-
return keep;
|
|
272
|
-
};
|
|
273
|
-
const value = NATIVE_REFLECT_APPLY(method, previous, [
|
|
274
|
-
wrappedPredicate
|
|
275
|
-
]);
|
|
718
|
+
function createCompilerKeyedArrayMappedStructuralAppend(previous, value) {
|
|
276
719
|
try {
|
|
277
720
|
const previousTarget = compilerObject(previous);
|
|
278
721
|
const valueTarget = compilerObject(value);
|
|
279
|
-
if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(
|
|
722
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
280
723
|
return value;
|
|
281
724
|
}
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
725
|
+
const startIndex = previous.length;
|
|
726
|
+
if (value.length < startIndex) return value;
|
|
727
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
728
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget);
|
|
729
|
+
const previousMappedUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget) : void 0;
|
|
730
|
+
const mappedStructuralUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.structuralUpdate && previousMappedUpdate.resultLength === previous.length ? previousMappedUpdate : void 0;
|
|
731
|
+
const structuralUpdate = previousUpdate?.structuralUpdate || mappedStructuralUpdate?.structuralUpdate;
|
|
732
|
+
const sourceToken = previousUpdate?.sourceToken || mappedStructuralUpdate?.sourceToken;
|
|
733
|
+
const mappedItemSources = previousUpdate?.mappedItemSources || mappedStructuralUpdate?.mappedItemSources;
|
|
734
|
+
if (!sourceToken || !structuralUpdate || !mappedItemSources) return value;
|
|
735
|
+
COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
|
|
736
|
+
sourceToken,
|
|
737
|
+
startIndex,
|
|
738
|
+
resultLength: value.length,
|
|
739
|
+
structuralUpdate,
|
|
740
|
+
mappedItemSources,
|
|
741
|
+
...previousUpdate?.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {},
|
|
742
|
+
...previousUpdate?.mappedItemValues ? { mappedItemValues: previousUpdate.mappedItemValues } : {},
|
|
743
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
744
|
+
});
|
|
745
|
+
return value;
|
|
746
|
+
} catch {
|
|
747
|
+
return value;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function createCompilerKeyedArrayStructuralAppendMapPipeline(previous, pipeline) {
|
|
751
|
+
let appendUpdate;
|
|
752
|
+
let committedItems;
|
|
753
|
+
let survivorRange;
|
|
754
|
+
let survivorIndices;
|
|
755
|
+
let mappedItemSources = /* @__PURE__ */ new Map();
|
|
756
|
+
let mappedItemValues = /* @__PURE__ */ new Map();
|
|
757
|
+
try {
|
|
758
|
+
const previousTarget = compilerObject(previous);
|
|
759
|
+
if (!previousTarget || !Array.isArray(previous) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || !(appendUpdate = COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget)) || !appendUpdate.structuralUpdate || appendUpdate.resultLength !== previous.length) {
|
|
760
|
+
appendUpdate = void 0;
|
|
761
|
+
} else {
|
|
762
|
+
committedItems = COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.get(appendUpdate.sourceToken);
|
|
763
|
+
const structuralAppend = committedItems ? compilerKeyedArrayStructuralAppendMapUpdate(
|
|
764
|
+
previous,
|
|
765
|
+
appendUpdate.sourceToken,
|
|
766
|
+
committedItems.length
|
|
767
|
+
) : void 0;
|
|
768
|
+
survivorRange = structuralAppend?.structuralSurvivorRange;
|
|
769
|
+
survivorIndices = structuralAppend?.structuralSurvivors;
|
|
770
|
+
if (!survivorRange && !survivorIndices) {
|
|
771
|
+
appendUpdate = void 0;
|
|
772
|
+
} else {
|
|
773
|
+
if (appendUpdate.mappedSurvivorsValidated && appendUpdate.mappedItemSources) {
|
|
774
|
+
mappedItemSources = new Map(
|
|
775
|
+
appendUpdate.mappedItemSources
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
if (appendUpdate.mappedItemValues) {
|
|
779
|
+
mappedItemValues = new Map(appendUpdate.mappedItemValues);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
} catch {
|
|
784
|
+
appendUpdate = void 0;
|
|
785
|
+
}
|
|
786
|
+
let eligible = appendUpdate !== void 0;
|
|
787
|
+
const applyMap = (collection, method, callback) => {
|
|
788
|
+
if (method !== NATIVE_ARRAY_MAP || !eligible) {
|
|
789
|
+
const value3 = NATIVE_REFLECT_APPLY(
|
|
790
|
+
method,
|
|
791
|
+
collection,
|
|
792
|
+
[callback]
|
|
793
|
+
);
|
|
794
|
+
if (method !== NATIVE_ARRAY_MAP) eligible = false;
|
|
795
|
+
return value3;
|
|
796
|
+
}
|
|
797
|
+
let expectedIndex = 0;
|
|
798
|
+
let expectedLength = -1;
|
|
799
|
+
try {
|
|
800
|
+
if (!Array.isArray(collection) || Object.getPrototypeOf(collection) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
801
|
+
eligible = false;
|
|
802
|
+
} else {
|
|
803
|
+
expectedLength = collection.length;
|
|
804
|
+
}
|
|
805
|
+
} catch {
|
|
806
|
+
eligible = false;
|
|
807
|
+
}
|
|
808
|
+
const wrappedCallback = (item, index, source) => {
|
|
809
|
+
if (index !== expectedIndex) eligible = false;
|
|
810
|
+
expectedIndex = index + 1;
|
|
811
|
+
const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
|
|
812
|
+
let committedItem;
|
|
813
|
+
if (index < survivorCount) {
|
|
814
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices?.[index];
|
|
815
|
+
committedItem = sourceIndex === void 0 ? void 0 : committedItems?.[sourceIndex];
|
|
816
|
+
if (mappedItemValues.has(index)) {
|
|
817
|
+
if (!Object.is(item, mappedItemValues.get(index))) eligible = false;
|
|
818
|
+
} else if (appendUpdate?.mappedItemSources && !appendUpdate.mappedSurvivorsValidated) {
|
|
819
|
+
const mappedStructuralSources = appendUpdate.mappedItemSources;
|
|
820
|
+
const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
|
|
821
|
+
if (!Object.is(sourceItem, committedItem)) eligible = false;
|
|
822
|
+
} else if (!Object.is(item, committedItem)) {
|
|
823
|
+
eligible = false;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
const mappedItem = NATIVE_REFLECT_APPLY(
|
|
827
|
+
callback,
|
|
828
|
+
void 0,
|
|
829
|
+
[item, index, source]
|
|
830
|
+
);
|
|
831
|
+
if (index < survivorCount) {
|
|
832
|
+
if (Object.is(mappedItem, committedItem)) {
|
|
833
|
+
mappedItemSources.delete(index);
|
|
834
|
+
mappedItemValues.delete(index);
|
|
835
|
+
} else {
|
|
836
|
+
mappedItemSources.set(index, committedItem);
|
|
837
|
+
mappedItemValues.set(index, mappedItem);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return mappedItem;
|
|
841
|
+
};
|
|
842
|
+
const value2 = NATIVE_REFLECT_APPLY(
|
|
843
|
+
method,
|
|
844
|
+
collection,
|
|
845
|
+
[wrappedCallback]
|
|
846
|
+
);
|
|
847
|
+
try {
|
|
848
|
+
if (expectedIndex !== expectedLength || !Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE || value2.length !== expectedLength) {
|
|
849
|
+
eligible = false;
|
|
850
|
+
}
|
|
851
|
+
} catch {
|
|
852
|
+
eligible = false;
|
|
853
|
+
}
|
|
854
|
+
return value2;
|
|
855
|
+
};
|
|
856
|
+
const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
|
|
857
|
+
if (!eligible || !appendUpdate) return value;
|
|
858
|
+
try {
|
|
859
|
+
const valueTarget = compilerObject(value);
|
|
860
|
+
if (!valueTarget) return value;
|
|
861
|
+
COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
|
|
862
|
+
...appendUpdate,
|
|
863
|
+
mappedItemSources,
|
|
864
|
+
mappedItemValues,
|
|
865
|
+
mappedSurvivorsValidated: true
|
|
866
|
+
});
|
|
867
|
+
} catch {
|
|
868
|
+
}
|
|
869
|
+
return value;
|
|
870
|
+
}
|
|
871
|
+
function createCompilerKeyedArrayPrepend(previous, value) {
|
|
872
|
+
try {
|
|
873
|
+
const previousTarget = compilerObject(previous);
|
|
874
|
+
const valueTarget = compilerObject(value);
|
|
875
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
876
|
+
return value;
|
|
877
|
+
}
|
|
878
|
+
const sourceLength = previous.length;
|
|
879
|
+
const prefixLength = value.length - sourceLength;
|
|
880
|
+
if (prefixLength < 1) return value;
|
|
881
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
882
|
+
if (!sourceToken) return value;
|
|
883
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
|
|
884
|
+
COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
|
|
885
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
886
|
+
sourceLength,
|
|
887
|
+
resultLength: value.length,
|
|
888
|
+
prefixLength,
|
|
889
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
890
|
+
});
|
|
891
|
+
return value;
|
|
892
|
+
} catch {
|
|
893
|
+
return value;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function createCompilerKeyedArrayStructuralPrepend(previous, value) {
|
|
897
|
+
try {
|
|
898
|
+
const previousTarget = compilerObject(previous);
|
|
899
|
+
const valueTarget = compilerObject(value);
|
|
900
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
901
|
+
return value;
|
|
902
|
+
}
|
|
903
|
+
const sourceLength = previous.length;
|
|
904
|
+
const prefixLength = value.length - sourceLength;
|
|
905
|
+
if (prefixLength < 1) return value;
|
|
906
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
907
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget);
|
|
908
|
+
const directStructuralUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
|
|
909
|
+
const structuralSource = directStructuralUpdate ? compilerKeyedArrayFilterSource(directStructuralUpdate, previous.length) : void 0;
|
|
910
|
+
const structuralUpdate = previousUpdate?.structuralUpdate || (structuralSource ? directStructuralUpdate : void 0);
|
|
911
|
+
const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
912
|
+
if (!sourceToken) return value;
|
|
913
|
+
COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
|
|
914
|
+
sourceToken,
|
|
915
|
+
sourceLength,
|
|
916
|
+
resultLength: value.length,
|
|
917
|
+
prefixLength,
|
|
918
|
+
...structuralUpdate ? { structuralUpdate } : {},
|
|
919
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
920
|
+
});
|
|
921
|
+
return value;
|
|
922
|
+
} catch {
|
|
923
|
+
return value;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function createCompilerKeyedArrayMappedStructuralPrepend(previous, value) {
|
|
927
|
+
try {
|
|
928
|
+
const previousTarget = compilerObject(previous);
|
|
929
|
+
const valueTarget = compilerObject(value);
|
|
930
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
931
|
+
return value;
|
|
932
|
+
}
|
|
933
|
+
const sourceLength = previous.length;
|
|
934
|
+
const prefixLength = value.length - sourceLength;
|
|
935
|
+
if (prefixLength < 1) return value;
|
|
936
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
937
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget);
|
|
938
|
+
const previousMappedUpdate = !committedSource && !previousUpdate ? COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget) : void 0;
|
|
939
|
+
const mappedStructuralUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.structuralUpdate && previousMappedUpdate.resultLength === previous.length ? previousMappedUpdate : void 0;
|
|
940
|
+
const structuralUpdate = previousUpdate?.structuralUpdate || mappedStructuralUpdate?.structuralUpdate;
|
|
941
|
+
const sourceToken = previousUpdate?.sourceToken || mappedStructuralUpdate?.sourceToken;
|
|
942
|
+
const mappedItemSources = previousUpdate?.mappedItemSources || mappedStructuralUpdate?.mappedItemSources;
|
|
943
|
+
if (!sourceToken || !structuralUpdate || !mappedItemSources) return value;
|
|
944
|
+
COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
|
|
945
|
+
sourceToken,
|
|
946
|
+
sourceLength,
|
|
947
|
+
resultLength: value.length,
|
|
948
|
+
prefixLength,
|
|
949
|
+
structuralUpdate,
|
|
950
|
+
mappedItemSources,
|
|
951
|
+
...previousUpdate?.mappedSurvivorsValidated ? { mappedSurvivorsValidated: true } : {},
|
|
952
|
+
...previousUpdate?.mappedItemValues ? { mappedItemValues: previousUpdate.mappedItemValues } : {},
|
|
953
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
954
|
+
});
|
|
955
|
+
return value;
|
|
956
|
+
} catch {
|
|
957
|
+
return value;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
function createCompilerKeyedArrayStructuralPrependMapPipeline(previous, pipeline) {
|
|
961
|
+
let prependUpdate;
|
|
962
|
+
let committedItems;
|
|
963
|
+
let survivorRange;
|
|
964
|
+
let survivorIndices;
|
|
965
|
+
let prefixLength = 0;
|
|
966
|
+
try {
|
|
967
|
+
const previousTarget = compilerObject(previous);
|
|
968
|
+
if (!previousTarget || !Array.isArray(previous) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || !(prependUpdate = COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget)) || !prependUpdate.structuralUpdate || prependUpdate.resultLength !== previous.length) {
|
|
969
|
+
prependUpdate = void 0;
|
|
970
|
+
} else {
|
|
971
|
+
committedItems = COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS.get(prependUpdate.sourceToken);
|
|
972
|
+
const structuralPrepend = committedItems ? compilerKeyedArrayStructuralPrependMapUpdate(
|
|
973
|
+
previous,
|
|
974
|
+
prependUpdate.sourceToken,
|
|
975
|
+
committedItems.length
|
|
976
|
+
) : void 0;
|
|
977
|
+
survivorRange = structuralPrepend?.structuralSurvivorRange;
|
|
978
|
+
survivorIndices = structuralPrepend?.structuralSurvivors;
|
|
979
|
+
prefixLength = structuralPrepend?.prefixLength || 0;
|
|
980
|
+
if (!survivorRange && !survivorIndices) {
|
|
981
|
+
prependUpdate = void 0;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
} catch {
|
|
985
|
+
prependUpdate = void 0;
|
|
986
|
+
}
|
|
987
|
+
let eligible = prependUpdate !== void 0;
|
|
988
|
+
const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
|
|
989
|
+
const applyMap = (collection, method, callback) => {
|
|
990
|
+
if (method !== NATIVE_ARRAY_MAP || !eligible) {
|
|
991
|
+
const value3 = NATIVE_REFLECT_APPLY(
|
|
992
|
+
method,
|
|
993
|
+
collection,
|
|
994
|
+
[callback]
|
|
995
|
+
);
|
|
996
|
+
if (method !== NATIVE_ARRAY_MAP) eligible = false;
|
|
997
|
+
return value3;
|
|
998
|
+
}
|
|
999
|
+
let expectedIndex = 0;
|
|
1000
|
+
let expectedLength = -1;
|
|
1001
|
+
try {
|
|
1002
|
+
if (!Array.isArray(collection) || Object.getPrototypeOf(collection) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
1003
|
+
eligible = false;
|
|
1004
|
+
} else {
|
|
1005
|
+
expectedLength = collection.length;
|
|
1006
|
+
}
|
|
1007
|
+
} catch {
|
|
1008
|
+
eligible = false;
|
|
1009
|
+
}
|
|
1010
|
+
const wrappedCallback = (item, index, source) => {
|
|
1011
|
+
if (index !== expectedIndex) eligible = false;
|
|
1012
|
+
expectedIndex = index + 1;
|
|
1013
|
+
return NATIVE_REFLECT_APPLY(
|
|
1014
|
+
callback,
|
|
1015
|
+
void 0,
|
|
1016
|
+
[item, index, source]
|
|
1017
|
+
);
|
|
1018
|
+
};
|
|
1019
|
+
const value2 = NATIVE_REFLECT_APPLY(
|
|
1020
|
+
method,
|
|
1021
|
+
collection,
|
|
1022
|
+
[wrappedCallback]
|
|
1023
|
+
);
|
|
1024
|
+
try {
|
|
1025
|
+
if (expectedIndex !== expectedLength || !Array.isArray(value2) || Object.getPrototypeOf(value2) !== NATIVE_ARRAY_PROTOTYPE || value2.length !== expectedLength) {
|
|
1026
|
+
eligible = false;
|
|
1027
|
+
}
|
|
1028
|
+
} catch {
|
|
1029
|
+
eligible = false;
|
|
1030
|
+
}
|
|
1031
|
+
return value2;
|
|
1032
|
+
};
|
|
1033
|
+
const value = NATIVE_REFLECT_APPLY(pipeline, void 0, [previous, applyMap]);
|
|
1034
|
+
if (!eligible || !prependUpdate) return value;
|
|
1035
|
+
try {
|
|
1036
|
+
const valueTarget = compilerObject(value);
|
|
1037
|
+
if (!valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || value.length !== prefixLength + survivorCount) {
|
|
1038
|
+
return value;
|
|
1039
|
+
}
|
|
1040
|
+
const mappedItemSources = /* @__PURE__ */ new Map();
|
|
1041
|
+
const mappedItemValues = /* @__PURE__ */ new Map();
|
|
1042
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
1043
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
|
|
1044
|
+
const committedItem = committedItems[sourceIndex];
|
|
1045
|
+
const mappedItem = value[prefixLength + index];
|
|
1046
|
+
if (Object.is(mappedItem, committedItem)) continue;
|
|
1047
|
+
mappedItemSources.set(index, committedItem);
|
|
1048
|
+
mappedItemValues.set(index, mappedItem);
|
|
1049
|
+
}
|
|
1050
|
+
COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
|
|
1051
|
+
...prependUpdate,
|
|
1052
|
+
mappedItemSources,
|
|
1053
|
+
mappedItemValues,
|
|
1054
|
+
mappedSurvivorsValidated: true
|
|
1055
|
+
});
|
|
1056
|
+
} catch {
|
|
1057
|
+
}
|
|
1058
|
+
return value;
|
|
1059
|
+
}
|
|
1060
|
+
function createCompilerKeyedArrayFilter(previous, method, predicate) {
|
|
1061
|
+
let canHint = false;
|
|
1062
|
+
let sourceLength = 0;
|
|
1063
|
+
try {
|
|
1064
|
+
canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
|
|
1065
|
+
if (canHint) sourceLength = previous.length;
|
|
1066
|
+
} catch {
|
|
1067
|
+
canHint = false;
|
|
1068
|
+
}
|
|
1069
|
+
if (!canHint) {
|
|
1070
|
+
return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
|
|
1071
|
+
}
|
|
1072
|
+
const removedIndices = [];
|
|
1073
|
+
let visited = 0;
|
|
1074
|
+
const wrappedPredicate = function(item, index, collection) {
|
|
1075
|
+
visited += 1;
|
|
1076
|
+
const keep = NATIVE_REFLECT_APPLY(predicate, this, [
|
|
1077
|
+
item,
|
|
1078
|
+
index,
|
|
1079
|
+
collection
|
|
1080
|
+
]);
|
|
1081
|
+
if (!keep) removedIndices.push(index);
|
|
1082
|
+
return keep;
|
|
1083
|
+
};
|
|
1084
|
+
const value = NATIVE_REFLECT_APPLY(method, previous, [
|
|
1085
|
+
wrappedPredicate
|
|
1086
|
+
]);
|
|
1087
|
+
try {
|
|
1088
|
+
const previousTarget = compilerObject(previous);
|
|
1089
|
+
const valueTarget = compilerObject(value);
|
|
1090
|
+
if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
|
|
1091
|
+
return value;
|
|
1092
|
+
}
|
|
1093
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1094
|
+
const previousMappedUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
1095
|
+
const mappedUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.resultLength === sourceLength ? previousMappedUpdate : void 0;
|
|
1096
|
+
const sourceToken = mappedUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
1097
|
+
if (!sourceToken) return value;
|
|
1098
|
+
const previousUpdate = !committedSource ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) || mappedUpdate?.structuralUpdate : void 0;
|
|
1099
|
+
const mappedItemSources = mappedUpdate?.mappedItemSources || previousUpdate?.mappedItemSources;
|
|
1100
|
+
COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
|
|
1101
|
+
kind: "filter",
|
|
1102
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
1103
|
+
sourceLength,
|
|
1104
|
+
resultLength: value.length,
|
|
1105
|
+
removedIndices,
|
|
1106
|
+
...mappedItemSources ? { mappedItemSources } : {},
|
|
291
1107
|
...previousUpdate ? { previous: previousUpdate } : {}
|
|
292
1108
|
});
|
|
293
1109
|
} catch {
|
|
@@ -316,9 +1132,13 @@ function createCompilerKeyedArraySlice(previous, method, ...args) {
|
|
|
316
1132
|
const retainedEnd = args.length === 2 ? normalize(args[1]) : sourceLength;
|
|
317
1133
|
const resultLength = Math.max(retainedEnd - retainedStart, 0);
|
|
318
1134
|
if (value.length !== resultLength || resultLength >= sourceLength) return value;
|
|
319
|
-
const
|
|
1135
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1136
|
+
const previousMappedUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
1137
|
+
const mappedUpdate = previousMappedUpdate?.mapped && previousMappedUpdate.kind === void 0 && previousMappedUpdate.resultLength === sourceLength ? previousMappedUpdate : void 0;
|
|
1138
|
+
const sourceToken = mappedUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
320
1139
|
if (!sourceToken) return value;
|
|
321
|
-
const previousUpdate = !
|
|
1140
|
+
const previousUpdate = !committedSource ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) || mappedUpdate?.structuralUpdate : void 0;
|
|
1141
|
+
const mappedItemSources = mappedUpdate?.mappedItemSources || previousUpdate?.mappedItemSources;
|
|
322
1142
|
COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
|
|
323
1143
|
kind: "slice",
|
|
324
1144
|
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
@@ -326,23 +1146,48 @@ function createCompilerKeyedArraySlice(previous, method, ...args) {
|
|
|
326
1146
|
resultLength,
|
|
327
1147
|
retainedEnd: Math.max(retainedEnd, retainedStart),
|
|
328
1148
|
retainedStart,
|
|
1149
|
+
...mappedItemSources ? { mappedItemSources } : {},
|
|
329
1150
|
...previousUpdate ? { previous: previousUpdate } : {}
|
|
330
1151
|
});
|
|
331
1152
|
} catch {
|
|
332
1153
|
}
|
|
333
1154
|
return value;
|
|
334
1155
|
}
|
|
1156
|
+
function finalizeCompilerKeyedArrayMappedStructuralUpdate(value) {
|
|
1157
|
+
try {
|
|
1158
|
+
const valueTarget = compilerObject(value);
|
|
1159
|
+
const structuralUpdate = valueTarget ? COMPILER_KEYED_ARRAY_FILTERS.get(valueTarget) : void 0;
|
|
1160
|
+
const mappedItemSources = structuralUpdate?.mappedItemSources;
|
|
1161
|
+
if (!valueTarget || !structuralUpdate || !mappedItemSources) return value;
|
|
1162
|
+
const source = compilerKeyedArrayFilterSource(structuralUpdate, structuralUpdate.resultLength);
|
|
1163
|
+
if (!source) return value;
|
|
1164
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
1165
|
+
sourceToken: source.sourceToken,
|
|
1166
|
+
sourceLength: source.sourceLength,
|
|
1167
|
+
resultLength: structuralUpdate.resultLength,
|
|
1168
|
+
mapped: true,
|
|
1169
|
+
mappedItemSources,
|
|
1170
|
+
structuralUpdate
|
|
1171
|
+
});
|
|
1172
|
+
} catch {
|
|
1173
|
+
}
|
|
1174
|
+
return value;
|
|
1175
|
+
}
|
|
335
1176
|
function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
|
|
336
1177
|
try {
|
|
337
1178
|
const previousTarget = compilerObject(previous);
|
|
338
1179
|
const retainedTarget = compilerObject(retained);
|
|
339
1180
|
const valueTarget = compilerObject(value);
|
|
340
|
-
if (!previousTarget || !retainedTarget || !valueTarget || !
|
|
1181
|
+
if (!previousTarget || !retainedTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(retained) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(retained) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
341
1182
|
return value;
|
|
342
1183
|
}
|
|
343
|
-
const
|
|
1184
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1185
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(previousTarget);
|
|
1186
|
+
if (!committedSource && !previousUpdate) return value;
|
|
1187
|
+
const immediateSourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
1188
|
+
const sourceToken = previousUpdate?.sourceToken || immediateSourceToken;
|
|
344
1189
|
const slice = COMPILER_KEYED_ARRAY_FILTERS.get(retainedTarget);
|
|
345
|
-
if (!sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !==
|
|
1190
|
+
if (!immediateSourceToken || !sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !== immediateSourceToken || slice.sourceLength !== previous.length || slice.retainedStart === void 0 || slice.retainedEnd !== previous.length || slice.retainedStart < 1 || slice.resultLength !== retained.length || previousUpdate && previousUpdate.resultLength !== previous.length || value.length <= retained.length) {
|
|
346
1191
|
return value;
|
|
347
1192
|
}
|
|
348
1193
|
for (let index = 0; index < retained.length; index += 1) {
|
|
@@ -353,7 +1198,8 @@ function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
|
|
|
353
1198
|
sourceLength: previous.length,
|
|
354
1199
|
resultLength: value.length,
|
|
355
1200
|
retainedEnd: slice.retainedEnd,
|
|
356
|
-
retainedStart: slice.retainedStart
|
|
1201
|
+
retainedStart: slice.retainedStart,
|
|
1202
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
357
1203
|
});
|
|
358
1204
|
} catch {
|
|
359
1205
|
}
|
|
@@ -374,9 +1220,11 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
374
1220
|
}
|
|
375
1221
|
const sourceLength = previous.length;
|
|
376
1222
|
const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
|
|
1223
|
+
const deleteCount = args[0];
|
|
1224
|
+
const removedCount = sourceLength - value.length;
|
|
377
1225
|
const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
|
|
378
|
-
const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 &&
|
|
379
|
-
const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength &&
|
|
1226
|
+
const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Number.isSafeInteger(deleteCount) && deleteCount > 0 && normalizedPosition < sourceLength && removedCount === Math.min(deleteCount, sourceLength - normalizedPosition);
|
|
1227
|
+
const validReplace = kind === "replace" && value.length === sourceLength && (method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength || method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 1) && normalizedPosition < sourceLength);
|
|
380
1228
|
if (!validInsert && !validRemove && !validReplace) return value;
|
|
381
1229
|
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
382
1230
|
if (!sourceToken) return value;
|
|
@@ -391,6 +1239,71 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
391
1239
|
}
|
|
392
1240
|
return value;
|
|
393
1241
|
}
|
|
1242
|
+
function createCompilerKeyedArrayBatchInsert(previous, method, position, ...items) {
|
|
1243
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
1244
|
+
method,
|
|
1245
|
+
previous,
|
|
1246
|
+
[position, 0, ...items]
|
|
1247
|
+
);
|
|
1248
|
+
try {
|
|
1249
|
+
const previousTarget = compilerObject(previous);
|
|
1250
|
+
const valueTarget = compilerObject(value);
|
|
1251
|
+
if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SPLICED || !Number.isSafeInteger(position) || items.length < 2 || value.length !== previous.length + items.length) {
|
|
1252
|
+
return value;
|
|
1253
|
+
}
|
|
1254
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
1255
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
1256
|
+
}
|
|
1257
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
1258
|
+
if (!sourceToken) return value;
|
|
1259
|
+
COMPILER_KEYED_ARRAY_BATCH_INSERTS.set(valueTarget, {
|
|
1260
|
+
sourceToken,
|
|
1261
|
+
sourceLength: previous.length,
|
|
1262
|
+
resultLength: value.length,
|
|
1263
|
+
position: position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length)
|
|
1264
|
+
});
|
|
1265
|
+
} catch {
|
|
1266
|
+
}
|
|
1267
|
+
return value;
|
|
1268
|
+
}
|
|
1269
|
+
function createCompilerKeyedArrayWindowReplace(previous, method, position, deleteCount, ...items) {
|
|
1270
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
1271
|
+
method,
|
|
1272
|
+
previous,
|
|
1273
|
+
[position, deleteCount, ...items]
|
|
1274
|
+
);
|
|
1275
|
+
try {
|
|
1276
|
+
const previousTarget = compilerObject(previous);
|
|
1277
|
+
const valueTarget = compilerObject(value);
|
|
1278
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SPLICED || !Number.isSafeInteger(position) || !Number.isSafeInteger(deleteCount) || deleteCount <= 0) {
|
|
1279
|
+
return value;
|
|
1280
|
+
}
|
|
1281
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
1282
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
1283
|
+
}
|
|
1284
|
+
const normalizedPosition = position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length);
|
|
1285
|
+
const removedCount = Math.min(deleteCount, previous.length - normalizedPosition);
|
|
1286
|
+
if (removedCount < 1 || value.length !== previous.length - removedCount + items.length) {
|
|
1287
|
+
return value;
|
|
1288
|
+
}
|
|
1289
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1290
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(previousTarget);
|
|
1291
|
+
if (!committedSource && !previousUpdate) return value;
|
|
1292
|
+
const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
1293
|
+
if (!sourceToken) return value;
|
|
1294
|
+
COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.set(valueTarget, {
|
|
1295
|
+
sourceToken,
|
|
1296
|
+
sourceLength: previous.length,
|
|
1297
|
+
resultLength: value.length,
|
|
1298
|
+
position: normalizedPosition,
|
|
1299
|
+
removedCount,
|
|
1300
|
+
insertedCount: items.length,
|
|
1301
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
1302
|
+
});
|
|
1303
|
+
} catch {
|
|
1304
|
+
}
|
|
1305
|
+
return value;
|
|
1306
|
+
}
|
|
394
1307
|
function createCompilerKeyedArrayReorder(previous, method) {
|
|
395
1308
|
const value = NATIVE_REFLECT_APPLY(
|
|
396
1309
|
method,
|
|
@@ -400,13 +1313,18 @@ function createCompilerKeyedArrayReorder(previous, method) {
|
|
|
400
1313
|
try {
|
|
401
1314
|
const previousTarget = compilerObject(previous);
|
|
402
1315
|
const valueTarget = compilerObject(value);
|
|
403
|
-
if (!previousTarget || !valueTarget || !
|
|
1316
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
|
|
404
1317
|
return value;
|
|
405
1318
|
}
|
|
406
|
-
const
|
|
1319
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1320
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
1321
|
+
if (!committedSource && (!previousUpdate || previousUpdate.sourceLength !== previous.length || previousUpdate.resultLength !== previous.length)) {
|
|
1322
|
+
return value;
|
|
1323
|
+
}
|
|
1324
|
+
const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
407
1325
|
if (!sourceToken) return value;
|
|
408
1326
|
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
409
|
-
kind:
|
|
1327
|
+
kind: reversedCompilerKeyedArrayOrder(previousUpdate?.kind),
|
|
410
1328
|
sourceToken,
|
|
411
1329
|
sourceLength: previous.length,
|
|
412
1330
|
resultLength: value.length
|
|
@@ -424,16 +1342,21 @@ function createCompilerKeyedArraySort(previous, method, ...args) {
|
|
|
424
1342
|
try {
|
|
425
1343
|
const previousTarget = compilerObject(previous);
|
|
426
1344
|
const valueTarget = compilerObject(value);
|
|
427
|
-
if (!previousTarget || !valueTarget || !
|
|
1345
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
|
|
428
1346
|
return value;
|
|
429
1347
|
}
|
|
430
1348
|
for (let index = 0; index < previous.length; index += 1) {
|
|
431
1349
|
if (!(index in previous)) return value;
|
|
432
1350
|
}
|
|
433
|
-
const
|
|
1351
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
1352
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
1353
|
+
if (!committedSource && (!previousUpdate || previousUpdate.sourceLength !== previous.length || previousUpdate.resultLength !== previous.length)) {
|
|
1354
|
+
return value;
|
|
1355
|
+
}
|
|
1356
|
+
const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
434
1357
|
if (!sourceToken) return value;
|
|
435
1358
|
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
436
|
-
kind:
|
|
1359
|
+
kind: 1 /* Permutation */,
|
|
437
1360
|
sourceToken,
|
|
438
1361
|
sourceLength: previous.length,
|
|
439
1362
|
resultLength: value.length
|
|
@@ -442,11 +1365,80 @@ function createCompilerKeyedArraySort(previous, method, ...args) {
|
|
|
442
1365
|
}
|
|
443
1366
|
return value;
|
|
444
1367
|
}
|
|
445
|
-
function
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
1368
|
+
function recordCompilerKeyedArrayStructuralReorder(previous, value, kind) {
|
|
1369
|
+
try {
|
|
1370
|
+
const previousTarget = compilerObject(previous);
|
|
1371
|
+
const valueTarget = compilerObject(value);
|
|
1372
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value)) {
|
|
1373
|
+
return value;
|
|
1374
|
+
}
|
|
1375
|
+
const previousUpdate = COMPILER_KEYED_ARRAY_REORDERS.get(previousTarget);
|
|
1376
|
+
const structuralUpdate = previousUpdate?.structuralUpdate || (!previousUpdate ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0);
|
|
1377
|
+
const structuralSource = structuralUpdate ? compilerKeyedArrayFilterSource(structuralUpdate, previous.length) : void 0;
|
|
1378
|
+
if (!structuralUpdate || !structuralSource || previousUpdate && previousUpdate.resultLength !== previous.length) {
|
|
1379
|
+
return value;
|
|
1380
|
+
}
|
|
1381
|
+
const sourceToken = previousUpdate?.sourceToken || structuralSource?.sourceToken;
|
|
1382
|
+
if (!sourceToken) return value;
|
|
1383
|
+
const mappedItemSources = previousUpdate?.mappedItemSources || structuralUpdate.mappedItemSources;
|
|
1384
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
1385
|
+
kind: kind === 0 /* Reverse */ ? reversedCompilerKeyedArrayOrder(previousUpdate?.kind) : 1 /* Permutation */,
|
|
1386
|
+
sourceToken,
|
|
1387
|
+
sourceLength: previousUpdate?.sourceLength || structuralSource.sourceLength,
|
|
1388
|
+
resultLength: value.length,
|
|
1389
|
+
structuralUpdate,
|
|
1390
|
+
...mappedItemSources ? { mappedItemSources } : {}
|
|
1391
|
+
});
|
|
1392
|
+
} catch {
|
|
1393
|
+
}
|
|
1394
|
+
return value;
|
|
1395
|
+
}
|
|
1396
|
+
function createCompilerKeyedArrayStructuralReorder(previous, method) {
|
|
1397
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
1398
|
+
method,
|
|
1399
|
+
previous,
|
|
1400
|
+
[]
|
|
1401
|
+
);
|
|
1402
|
+
try {
|
|
1403
|
+
if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
|
|
1404
|
+
return value;
|
|
1405
|
+
}
|
|
1406
|
+
} catch {
|
|
1407
|
+
return value;
|
|
1408
|
+
}
|
|
1409
|
+
return recordCompilerKeyedArrayStructuralReorder(
|
|
1410
|
+
previous,
|
|
1411
|
+
value,
|
|
1412
|
+
0 /* Reverse */
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
function createCompilerKeyedArrayStructuralSort(previous, method, ...args) {
|
|
1416
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
1417
|
+
method,
|
|
1418
|
+
previous,
|
|
1419
|
+
args
|
|
1420
|
+
);
|
|
1421
|
+
try {
|
|
1422
|
+
if (!Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
|
|
1423
|
+
return value;
|
|
1424
|
+
}
|
|
1425
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
1426
|
+
if (!(index in previous)) return value;
|
|
1427
|
+
}
|
|
1428
|
+
} catch {
|
|
1429
|
+
return value;
|
|
1430
|
+
}
|
|
1431
|
+
return recordCompilerKeyedArrayStructuralReorder(
|
|
1432
|
+
previous,
|
|
1433
|
+
value,
|
|
1434
|
+
1 /* Permutation */
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
|
|
1438
|
+
const args = operation === "map-set" ? [key, value] : [key];
|
|
1439
|
+
const result = NATIVE_REFLECT_APPLY(method, collection, args);
|
|
1440
|
+
const target = compilerObject(collection);
|
|
1441
|
+
if (!target) return result;
|
|
450
1442
|
const kind = operation.startsWith("set-") ? "set" : "map";
|
|
451
1443
|
const nativeMethod = operation === "set-add" ? NATIVE_SET_ADD : operation === "set-delete" ? NATIVE_SET_DELETE : operation === "map-set" ? NATIVE_MAP_SET : NATIVE_MAP_DELETE;
|
|
452
1444
|
const nativePrototype = kind === "set" ? NATIVE_SET_PROTOTYPE : NATIVE_MAP_PROTOTYPE;
|
|
@@ -859,6 +1851,9 @@ function applyStaticRangeBindings(bindings, segments, values) {
|
|
|
859
1851
|
}
|
|
860
1852
|
return true;
|
|
861
1853
|
}
|
|
1854
|
+
function keyedRowInstancesByKey(instances) {
|
|
1855
|
+
return new Map(instances.map((instance) => [instance.key, instance]));
|
|
1856
|
+
}
|
|
862
1857
|
var UNSET_KEYED_ROW_BINDING = /* @__PURE__ */ Symbol("unset interactive keyed-row binding");
|
|
863
1858
|
function keyedRowIdentity(key) {
|
|
864
1859
|
return String(key);
|
|
@@ -1126,6 +2121,32 @@ function applyKeyedRowBinding(props, instance, item, index, bindingIndex) {
|
|
|
1126
2121
|
updateAttribute(target, binding.name, rawValue);
|
|
1127
2122
|
}
|
|
1128
2123
|
}
|
|
2124
|
+
function prepareKeyedRowBindingUpdates(props, instance, item, index) {
|
|
2125
|
+
const updates = [];
|
|
2126
|
+
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
2127
|
+
const binding = props.bindings[bindingIndex];
|
|
2128
|
+
const rawValue = binding.read(item, index);
|
|
2129
|
+
const value = normalizedKeyedRowBindingValue(binding, rawValue);
|
|
2130
|
+
if (Object.is(instance.values[bindingIndex], value)) continue;
|
|
2131
|
+
const target = findCompilerHostTarget(instance.element, binding.path);
|
|
2132
|
+
if (!target || binding.kind !== "text" && !binding.name) return void 0;
|
|
2133
|
+
updates.push([bindingIndex, rawValue, target, value]);
|
|
2134
|
+
}
|
|
2135
|
+
return updates;
|
|
2136
|
+
}
|
|
2137
|
+
function applyPreparedKeyedRowBindingUpdates(props, instance, updates) {
|
|
2138
|
+
for (const [bindingIndex, rawValue, target, value] of updates) {
|
|
2139
|
+
const binding = props.bindings[bindingIndex];
|
|
2140
|
+
instance.values[bindingIndex] = value;
|
|
2141
|
+
if (binding.kind === "text") {
|
|
2142
|
+
target.textContent = value;
|
|
2143
|
+
} else if (binding.kind === "style") {
|
|
2144
|
+
updateStyle(target, binding.name, rawValue);
|
|
2145
|
+
} else {
|
|
2146
|
+
updateAttribute(target, binding.name, rawValue);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
1129
2150
|
function keyedRowConditionalSnapshot(conditional, item, index) {
|
|
1130
2151
|
const test = conditional.test(item, index);
|
|
1131
2152
|
if (conditional.logical && !test) {
|
|
@@ -1685,7 +2706,7 @@ var CompilerNestedKeyedRanges = class {
|
|
|
1685
2706
|
}
|
|
1686
2707
|
anchor = instance.element;
|
|
1687
2708
|
}
|
|
1688
|
-
this.instances[rangeIndex] =
|
|
2709
|
+
this.instances[rangeIndex] = keyedRowInstancesByKey(nextInstances);
|
|
1689
2710
|
return true;
|
|
1690
2711
|
}
|
|
1691
2712
|
updateStaticScopes(descriptor, rowsByRange) {
|
|
@@ -2013,7 +3034,7 @@ var CompilerNestedMixedRanges = class {
|
|
|
2013
3034
|
}
|
|
2014
3035
|
anchor = row.element;
|
|
2015
3036
|
}
|
|
2016
|
-
instance.value =
|
|
3037
|
+
instance.value = keyedRowInstancesByKey(nextInstances);
|
|
2017
3038
|
return true;
|
|
2018
3039
|
}
|
|
2019
3040
|
reconcileRange(rangeIndex, snapshot) {
|
|
@@ -2568,6 +3589,53 @@ function longestIncreasingSubsequencePositions(sequence) {
|
|
|
2568
3589
|
}
|
|
2569
3590
|
return positions;
|
|
2570
3591
|
}
|
|
3592
|
+
function reorderCompilerKeyedRows(root, instances, sequence, anchor) {
|
|
3593
|
+
const activeElement = compilerFocusedElement(root);
|
|
3594
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
3595
|
+
for (let index = instances.length - 1; index >= 0; index -= 1) {
|
|
3596
|
+
const instance = instances[index];
|
|
3597
|
+
if (sequence[index] < 0) {
|
|
3598
|
+
let start = index;
|
|
3599
|
+
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
3600
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
3601
|
+
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
3602
|
+
fragment.append(instances[itemIndex].element);
|
|
3603
|
+
}
|
|
3604
|
+
root.insertBefore(fragment, anchor);
|
|
3605
|
+
anchor = instances[start].element;
|
|
3606
|
+
index = start;
|
|
3607
|
+
} else {
|
|
3608
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
3609
|
+
root.insertBefore(instance.element, anchor);
|
|
3610
|
+
}
|
|
3611
|
+
anchor = instance.element;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
restoreCompilerFocus(activeElement);
|
|
3615
|
+
}
|
|
3616
|
+
function compilerFocusedElement(root) {
|
|
3617
|
+
const activeElement = root.ownerDocument.activeElement;
|
|
3618
|
+
return activeElement && root.contains(activeElement) ? activeElement : null;
|
|
3619
|
+
}
|
|
3620
|
+
function restoreCompilerFocus(activeElement) {
|
|
3621
|
+
if (activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
3622
|
+
activeElement.focus({ preventScroll: true });
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
function reverseCompilerKeyedRows(root, instances) {
|
|
3626
|
+
const activeElement = compilerFocusedElement(root);
|
|
3627
|
+
let anchor = instances[0]?.element || null;
|
|
3628
|
+
for (let sourceIndex = 1; sourceIndex < instances.length; sourceIndex += 1) {
|
|
3629
|
+
const element = instances[sourceIndex].element;
|
|
3630
|
+
root.insertBefore(element, anchor);
|
|
3631
|
+
anchor = element;
|
|
3632
|
+
}
|
|
3633
|
+
instances.reverse();
|
|
3634
|
+
for (let index = 0; index < instances.length; index += 1) {
|
|
3635
|
+
instances[index].index = index;
|
|
3636
|
+
}
|
|
3637
|
+
restoreCompilerFocus(activeElement);
|
|
3638
|
+
}
|
|
2571
3639
|
var keyedUpdateRuntime = {
|
|
2572
3640
|
append: reconcileCompilerKeyedArrayAppend,
|
|
2573
3641
|
commit: commitCompilerKeyedCollection,
|
|
@@ -2585,14 +3653,30 @@ var keyedFilterPrependUpdateRuntime = {
|
|
|
2585
3653
|
...keyedFilterUpdateRuntime,
|
|
2586
3654
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
2587
3655
|
};
|
|
3656
|
+
var keyedStructuralPrependUpdateRuntime = {
|
|
3657
|
+
...keyedFilterPrependUpdateRuntime,
|
|
3658
|
+
prepend: reconcileCompilerKeyedArrayPrependWithStructural
|
|
3659
|
+
};
|
|
2588
3660
|
var keyedPositionUpdateRuntime = {
|
|
2589
3661
|
...keyedUpdateRuntime,
|
|
2590
3662
|
position: reconcileCompilerKeyedArrayPosition
|
|
2591
3663
|
};
|
|
3664
|
+
var keyedBatchPositionUpdateRuntime = {
|
|
3665
|
+
...keyedUpdateRuntime,
|
|
3666
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
3667
|
+
};
|
|
3668
|
+
var keyedWindowPositionUpdateRuntime = {
|
|
3669
|
+
...keyedUpdateRuntime,
|
|
3670
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
3671
|
+
};
|
|
2592
3672
|
var keyedReorderUpdateRuntime = {
|
|
2593
3673
|
...keyedUpdateRuntime,
|
|
2594
3674
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
2595
3675
|
};
|
|
3676
|
+
var keyedMapReorderUpdateRuntime = {
|
|
3677
|
+
...keyedUpdateRuntime,
|
|
3678
|
+
reorder: reconcileCompilerKeyedArrayReorderWithMap
|
|
3679
|
+
};
|
|
2596
3680
|
var keyedCompleteUpdateRuntime = {
|
|
2597
3681
|
...keyedFilterPrependUpdateRuntime,
|
|
2598
3682
|
rollingWindow: reconcileCompilerKeyedArrayRollingWindow
|
|
@@ -2600,7 +3684,32 @@ var keyedCompleteUpdateRuntime = {
|
|
|
2600
3684
|
var keyedEveryUpdateRuntime = {
|
|
2601
3685
|
...keyedCompleteUpdateRuntime,
|
|
2602
3686
|
position: reconcileCompilerKeyedArrayPosition,
|
|
2603
|
-
reorder:
|
|
3687
|
+
reorder: reconcileCompilerKeyedArrayReorderWithMapAndStructural
|
|
3688
|
+
};
|
|
3689
|
+
var keyedBatchEveryUpdateRuntime = {
|
|
3690
|
+
...keyedEveryUpdateRuntime,
|
|
3691
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
3692
|
+
};
|
|
3693
|
+
var keyedWindowEveryUpdateRuntime = {
|
|
3694
|
+
...keyedEveryUpdateRuntime,
|
|
3695
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
3696
|
+
};
|
|
3697
|
+
var keyedWindowEveryStructuralAppendUpdateRuntime = {
|
|
3698
|
+
...keyedWindowEveryUpdateRuntime,
|
|
3699
|
+
append: reconcileCompilerKeyedArrayAppendWithStructural
|
|
3700
|
+
};
|
|
3701
|
+
var keyedWindowEveryStructuralAppendMapUpdateRuntime = {
|
|
3702
|
+
...keyedWindowEveryStructuralAppendUpdateRuntime,
|
|
3703
|
+
append: reconcileCompilerKeyedArrayAppendMapWithStructural,
|
|
3704
|
+
commit: commitCompilerKeyedCollectionWithItemSnapshot
|
|
3705
|
+
};
|
|
3706
|
+
var keyedCompleteCompatibilityUpdateRuntime = {
|
|
3707
|
+
...keyedWindowEveryStructuralAppendMapUpdateRuntime,
|
|
3708
|
+
prepend: reconcileCompilerKeyedArrayPrependWithStructural
|
|
3709
|
+
};
|
|
3710
|
+
var keyedCompleteStructuralPrependMapUpdateRuntime = {
|
|
3711
|
+
...keyedCompleteCompatibilityUpdateRuntime,
|
|
3712
|
+
prepend: reconcileCompilerKeyedArrayPrependMapWithStructural
|
|
2604
3713
|
};
|
|
2605
3714
|
function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
|
|
2606
3715
|
const dependency = props.collectionDependency;
|
|
@@ -2651,6 +3760,86 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
|
|
|
2651
3760
|
fallback: false
|
|
2652
3761
|
};
|
|
2653
3762
|
}
|
|
3763
|
+
function reconcileCompilerKeyedArrayMapReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
|
|
3764
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
3765
|
+
return void 0;
|
|
3766
|
+
}
|
|
3767
|
+
const collectionDependency = props.collectionDependency;
|
|
3768
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
3769
|
+
return void 0;
|
|
3770
|
+
}
|
|
3771
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
3772
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
3773
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
3774
|
+
return void 0;
|
|
3775
|
+
}
|
|
3776
|
+
const finalValue = preparedReorder?.value ?? props.items();
|
|
3777
|
+
const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
3778
|
+
if (!update?.mapped || !update.mappedItemSources || update.structuralUpdate || !Array.isArray(finalValue)) {
|
|
3779
|
+
return void 0;
|
|
3780
|
+
}
|
|
3781
|
+
const previousInstances = [...instances.values()];
|
|
3782
|
+
const reverse = update.kind === 0 /* Reverse */;
|
|
3783
|
+
const prepared = (() => {
|
|
3784
|
+
const changed = [];
|
|
3785
|
+
try {
|
|
3786
|
+
const instancesByItem = update.kind === 1 /* Permutation */ ? /* @__PURE__ */ new Map() : void 0;
|
|
3787
|
+
if (instancesByItem) {
|
|
3788
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
3789
|
+
const instance = previousInstances[sourceIndex];
|
|
3790
|
+
if (instance.index !== sourceIndex || instancesByItem.has(instance.item))
|
|
3791
|
+
return void 0;
|
|
3792
|
+
instancesByItem.set(instance.item, instance);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
const nextInstances = instancesByItem ? [] : previousInstances;
|
|
3796
|
+
const sequence = instancesByItem ? [] : void 0;
|
|
3797
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
3798
|
+
const item = finalValue[targetIndex];
|
|
3799
|
+
let instance;
|
|
3800
|
+
if (!instancesByItem) {
|
|
3801
|
+
const sourceIndex = reverse ? finalValue.length - targetIndex - 1 : targetIndex;
|
|
3802
|
+
instance = previousInstances[sourceIndex];
|
|
3803
|
+
if (!instance || instance.index !== sourceIndex) return void 0;
|
|
3804
|
+
if (Object.is(instance.item, item)) continue;
|
|
3805
|
+
if (!update.mappedItemSources.has(item) || !Object.is(instance.item, update.mappedItemSources.get(item))) {
|
|
3806
|
+
return void 0;
|
|
3807
|
+
}
|
|
3808
|
+
} else {
|
|
3809
|
+
const sourceItem = update.mappedItemSources.has(item) ? update.mappedItemSources.get(item) : item;
|
|
3810
|
+
instance = instancesByItem.get(sourceItem);
|
|
3811
|
+
if (!instance) return void 0;
|
|
3812
|
+
instancesByItem.delete(sourceItem);
|
|
3813
|
+
nextInstances.push(instance);
|
|
3814
|
+
sequence.push(instance.index);
|
|
3815
|
+
if (Object.is(instance.item, item)) continue;
|
|
3816
|
+
}
|
|
3817
|
+
if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
|
|
3818
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, targetIndex);
|
|
3819
|
+
if (!bindingUpdates) return void 0;
|
|
3820
|
+
changed.push({ bindingUpdates, instance, item });
|
|
3821
|
+
}
|
|
3822
|
+
if (instancesByItem?.size) return void 0;
|
|
3823
|
+
return { changed, nextInstances, sequence };
|
|
3824
|
+
} catch {
|
|
3825
|
+
return void 0;
|
|
3826
|
+
}
|
|
3827
|
+
})();
|
|
3828
|
+
if (!prepared) return void 0;
|
|
3829
|
+
if (prepared.sequence) {
|
|
3830
|
+
reorderCompilerKeyedRows(root, prepared.nextInstances, prepared.sequence, null);
|
|
3831
|
+
} else if (reverse) {
|
|
3832
|
+
reverseCompilerKeyedRows(root, prepared.nextInstances);
|
|
3833
|
+
}
|
|
3834
|
+
for (const { bindingUpdates, instance, item } of prepared.changed) {
|
|
3835
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
3836
|
+
instance.item = item;
|
|
3837
|
+
}
|
|
3838
|
+
for (let index = 0; index < prepared.nextInstances.length; index += 1) {
|
|
3839
|
+
prepared.nextInstances[index].index = index;
|
|
3840
|
+
}
|
|
3841
|
+
return reverse || prepared.sequence ? keyedRowInstancesByKey(prepared.nextInstances) : instances;
|
|
3842
|
+
}
|
|
2654
3843
|
function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2655
3844
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || props.collectionDependency === void 0) {
|
|
2656
3845
|
return void 0;
|
|
@@ -2696,7 +3885,7 @@ function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, i
|
|
|
2696
3885
|
}
|
|
2697
3886
|
return nextInstances;
|
|
2698
3887
|
}
|
|
2699
|
-
function
|
|
3888
|
+
function reconcileCompilerKeyedArrayStructuralAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2700
3889
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
2701
3890
|
return void 0;
|
|
2702
3891
|
}
|
|
@@ -2710,33 +3899,37 @@ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionT
|
|
|
2710
3899
|
return void 0;
|
|
2711
3900
|
}
|
|
2712
3901
|
const finalValue = props.items();
|
|
2713
|
-
const update =
|
|
2714
|
-
|
|
3902
|
+
const update = compilerKeyedArrayStructuralAppendUpdate(
|
|
3903
|
+
finalValue,
|
|
3904
|
+
collectionToken,
|
|
3905
|
+
instances.size
|
|
3906
|
+
);
|
|
3907
|
+
const structuralUpdate = update?.structuralUpdate;
|
|
3908
|
+
const survivorResult = update?.structuralSurvivors;
|
|
3909
|
+
if (!update || !structuralUpdate || !survivorResult || structuralUpdate.mappedItemSources || !Array.isArray(finalValue)) {
|
|
3910
|
+
return void 0;
|
|
3911
|
+
}
|
|
2715
3912
|
const previousInstances = [...instances.values()];
|
|
2716
|
-
const retainedLength = update.retainedEnd - update.retainedStart;
|
|
2717
3913
|
const survivors = [];
|
|
3914
|
+
const knownKeys = new Set(instances.keys());
|
|
3915
|
+
const appended = [];
|
|
2718
3916
|
try {
|
|
2719
|
-
for (let index = 0; index <
|
|
2720
|
-
const sourceIndex =
|
|
3917
|
+
for (let index = 0; index < survivorResult.indices.length; index += 1) {
|
|
3918
|
+
const sourceIndex = survivorResult.indices[index];
|
|
2721
3919
|
const instance = previousInstances[sourceIndex];
|
|
2722
|
-
|
|
3920
|
+
const item = finalValue[index];
|
|
3921
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !survivorResult.keysStable && keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
|
|
2723
3922
|
return void 0;
|
|
2724
3923
|
}
|
|
2725
3924
|
survivors.push(instance);
|
|
2726
3925
|
}
|
|
2727
|
-
|
|
2728
|
-
return void 0;
|
|
2729
|
-
}
|
|
2730
|
-
const knownKeys = new Set(instances.keys());
|
|
2731
|
-
const incoming = [];
|
|
2732
|
-
try {
|
|
2733
|
-
for (let index = retainedLength; index < finalValue.length; index += 1) {
|
|
3926
|
+
for (let index = update.startIndex; index < finalValue.length; index += 1) {
|
|
2734
3927
|
const item = finalValue[index];
|
|
2735
3928
|
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2736
3929
|
if (knownKeys.has(key)) return void 0;
|
|
2737
3930
|
knownKeys.add(key);
|
|
2738
3931
|
const descriptor = props.create(item, index);
|
|
2739
|
-
|
|
3932
|
+
appended.push({
|
|
2740
3933
|
key,
|
|
2741
3934
|
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2742
3935
|
values: readKeyedRowBindingValues(props, item, index),
|
|
@@ -2748,23 +3941,22 @@ function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionT
|
|
|
2748
3941
|
} catch {
|
|
2749
3942
|
return void 0;
|
|
2750
3943
|
}
|
|
2751
|
-
|
|
3944
|
+
const survivorSet = new Set(survivorResult.indices);
|
|
3945
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
3946
|
+
if (survivorSet.has(index)) continue;
|
|
2752
3947
|
previousInstances[index].scope?.cleanup();
|
|
2753
3948
|
previousInstances[index].element.remove();
|
|
2754
3949
|
}
|
|
2755
3950
|
for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
|
|
2756
|
-
if (
|
|
3951
|
+
if (appended.length > 0) {
|
|
2757
3952
|
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2758
|
-
for (const instance of
|
|
3953
|
+
for (const instance of appended) fragment.append(instance.element);
|
|
2759
3954
|
root.append(fragment);
|
|
2760
3955
|
}
|
|
2761
|
-
|
|
2762
|
-
[...survivors, ...incoming].map((instance) => [instance.key, instance])
|
|
2763
|
-
);
|
|
2764
|
-
return nextInstances;
|
|
3956
|
+
return keyedRowInstancesByKey([...survivors, ...appended]);
|
|
2765
3957
|
}
|
|
2766
|
-
function
|
|
2767
|
-
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.
|
|
3958
|
+
function reconcileCompilerKeyedArrayStructuralAppendMap(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
3959
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
2768
3960
|
return void 0;
|
|
2769
3961
|
}
|
|
2770
3962
|
const collectionDependency = props.collectionDependency;
|
|
@@ -2777,70 +3969,292 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2777
3969
|
return void 0;
|
|
2778
3970
|
}
|
|
2779
3971
|
const finalValue = props.items();
|
|
2780
|
-
const update =
|
|
2781
|
-
|
|
3972
|
+
const update = compilerKeyedArrayStructuralAppendMapUpdate(
|
|
3973
|
+
finalValue,
|
|
3974
|
+
collectionToken,
|
|
3975
|
+
instances.size,
|
|
3976
|
+
true
|
|
3977
|
+
);
|
|
3978
|
+
if (!update || !update.mappedItemSources || !Array.isArray(finalValue)) return void 0;
|
|
3979
|
+
const mappedItemSources = update.mappedSurvivorsValidated ? update.mappedItemSources : void 0;
|
|
3980
|
+
const mappedStructuralSources = update.mappedSurvivorsValidated ? void 0 : update.mappedItemSources;
|
|
2782
3981
|
const previousInstances = [...instances.values()];
|
|
2783
|
-
const
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
previousInstances[index].index = index;
|
|
2791
|
-
}
|
|
2792
|
-
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2793
|
-
}
|
|
2794
|
-
let item;
|
|
2795
|
-
let key;
|
|
3982
|
+
const survivorRange = update.structuralSurvivorRange;
|
|
3983
|
+
const survivorIndices = update.structuralSurvivors;
|
|
3984
|
+
const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
|
|
3985
|
+
if (!survivorRange && !survivorIndices) return void 0;
|
|
3986
|
+
const changed = [];
|
|
3987
|
+
const appendedKeys = /* @__PURE__ */ new Set();
|
|
3988
|
+
const appended = [];
|
|
2796
3989
|
try {
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
3990
|
+
if (mappedStructuralSources) {
|
|
3991
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
3992
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
|
|
3993
|
+
const instance = previousInstances[sourceIndex];
|
|
3994
|
+
const item = finalValue[index];
|
|
3995
|
+
const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
|
|
3996
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, sourceItem)) {
|
|
3997
|
+
return void 0;
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
4001
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
|
|
4002
|
+
const instance = previousInstances[sourceIndex];
|
|
4003
|
+
const item = finalValue[index];
|
|
4004
|
+
const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
|
|
4005
|
+
if (Object.is(item, sourceItem)) continue;
|
|
4006
|
+
if (keyedRowIdentity(props.rowKey(item, index)) !== instance.key) return void 0;
|
|
4007
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
|
|
4008
|
+
if (!bindingUpdates) return void 0;
|
|
4009
|
+
changed.push({ bindingUpdates, instance, item });
|
|
4010
|
+
}
|
|
4011
|
+
} else if (survivorIndices) {
|
|
4012
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
4013
|
+
const sourceIndex = survivorIndices[index];
|
|
4014
|
+
const instance = previousInstances[sourceIndex];
|
|
4015
|
+
const item = finalValue[index];
|
|
4016
|
+
const expectedItem = mappedItemSources.has(index) ? mappedItemSources.get(index) : item;
|
|
4017
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, expectedItem)) {
|
|
4018
|
+
return void 0;
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
for (const [index, sourceItem] of mappedItemSources || []) {
|
|
4023
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= survivorCount) {
|
|
4024
|
+
return void 0;
|
|
4025
|
+
}
|
|
4026
|
+
const instance = previousInstances[survivorRange ? survivorRange.start + index : survivorIndices[index]];
|
|
4027
|
+
const item = finalValue[index];
|
|
4028
|
+
if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
|
|
4029
|
+
return void 0;
|
|
4030
|
+
}
|
|
4031
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
|
|
4032
|
+
if (!bindingUpdates) return void 0;
|
|
4033
|
+
changed.push({ bindingUpdates, instance, item });
|
|
4034
|
+
}
|
|
4035
|
+
for (let index = update.startIndex; index < finalValue.length; index += 1) {
|
|
4036
|
+
const item = finalValue[index];
|
|
4037
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4038
|
+
if (instances.has(key) || appendedKeys.has(key)) return void 0;
|
|
4039
|
+
appendedKeys.add(key);
|
|
4040
|
+
const descriptor = props.create(item, index);
|
|
4041
|
+
appended.push({
|
|
2808
4042
|
key,
|
|
2809
4043
|
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2810
|
-
values: readKeyedRowBindingValues(props, item,
|
|
4044
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
2811
4045
|
item,
|
|
2812
|
-
index
|
|
4046
|
+
index,
|
|
2813
4047
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2814
|
-
};
|
|
2815
|
-
} catch {
|
|
2816
|
-
return void 0;
|
|
4048
|
+
});
|
|
2817
4049
|
}
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
4050
|
+
} catch {
|
|
4051
|
+
return void 0;
|
|
4052
|
+
}
|
|
4053
|
+
const mutableInstances = instances;
|
|
4054
|
+
if (survivorRange) {
|
|
4055
|
+
for (let index = 0; index < survivorRange.start; index += 1) {
|
|
4056
|
+
const instance = previousInstances[index];
|
|
4057
|
+
instance.scope?.cleanup();
|
|
4058
|
+
instance.element.remove();
|
|
4059
|
+
mutableInstances.delete(instance.key);
|
|
4060
|
+
}
|
|
4061
|
+
for (let index = survivorRange.end; index < previousInstances.length; index += 1) {
|
|
4062
|
+
const instance = previousInstances[index];
|
|
4063
|
+
instance.scope?.cleanup();
|
|
4064
|
+
instance.element.remove();
|
|
4065
|
+
mutableInstances.delete(instance.key);
|
|
4066
|
+
}
|
|
4067
|
+
for (let index = survivorRange.start; index < survivorRange.end; index += 1) {
|
|
4068
|
+
previousInstances[index].index = index - survivorRange.start;
|
|
4069
|
+
}
|
|
4070
|
+
} else {
|
|
4071
|
+
const survivorSet = new Set(survivorIndices);
|
|
4072
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
4073
|
+
if (survivorSet.has(index)) continue;
|
|
4074
|
+
const instance = previousInstances[index];
|
|
4075
|
+
instance.scope?.cleanup();
|
|
4076
|
+
instance.element.remove();
|
|
4077
|
+
mutableInstances.delete(instance.key);
|
|
4078
|
+
}
|
|
4079
|
+
for (let index = 0; index < survivorIndices.length; index += 1) {
|
|
4080
|
+
previousInstances[survivorIndices[index]].index = index;
|
|
2822
4081
|
}
|
|
2823
|
-
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2824
4082
|
}
|
|
2825
|
-
if (
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
return void 0;
|
|
4083
|
+
if (appended.length > 0) {
|
|
4084
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
4085
|
+
for (const instance of appended) {
|
|
4086
|
+
fragment.append(instance.element);
|
|
4087
|
+
mutableInstances.set(instance.key, instance);
|
|
2831
4088
|
}
|
|
2832
|
-
|
|
2833
|
-
return instances;
|
|
4089
|
+
root.append(fragment);
|
|
2834
4090
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
4091
|
+
for (const { bindingUpdates, instance, item } of changed) {
|
|
4092
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
4093
|
+
instance.item = item;
|
|
4094
|
+
}
|
|
4095
|
+
return mutableInstances;
|
|
4096
|
+
}
|
|
4097
|
+
function reconcileCompilerKeyedArrayAppendWithStructural(...args) {
|
|
4098
|
+
return reconcileCompilerKeyedArrayStructuralAppend(...args) || reconcileCompilerKeyedArrayAppend(...args);
|
|
4099
|
+
}
|
|
4100
|
+
function reconcileCompilerKeyedArrayAppendMapWithStructural(...args) {
|
|
4101
|
+
return reconcileCompilerKeyedArrayStructuralAppendMap(...args) || reconcileCompilerKeyedArrayStructuralAppend(...args) || reconcileCompilerKeyedArrayAppend(...args);
|
|
4102
|
+
}
|
|
4103
|
+
function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4104
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
4105
|
+
return void 0;
|
|
4106
|
+
}
|
|
4107
|
+
const collectionDependency = props.collectionDependency;
|
|
4108
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4109
|
+
return void 0;
|
|
4110
|
+
}
|
|
4111
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4112
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4113
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4114
|
+
return void 0;
|
|
4115
|
+
}
|
|
4116
|
+
const finalValue = props.items();
|
|
4117
|
+
const updates = compilerKeyedArrayRollingWindows(finalValue, collectionToken, instances.size);
|
|
4118
|
+
if (!updates || !Array.isArray(finalValue)) return void 0;
|
|
4119
|
+
const previousInstances = [...instances.values()];
|
|
4120
|
+
let retainedStart = 0;
|
|
4121
|
+
for (const update of updates) {
|
|
4122
|
+
retainedStart += Math.min(update.retainedStart, previousInstances.length - retainedStart);
|
|
4123
|
+
}
|
|
4124
|
+
const retainedLength = previousInstances.length - retainedStart;
|
|
4125
|
+
const survivors = [];
|
|
4126
|
+
try {
|
|
4127
|
+
for (let index = 0; index < retainedLength; index += 1) {
|
|
4128
|
+
const sourceIndex = retainedStart + index;
|
|
4129
|
+
const instance = previousInstances[sourceIndex];
|
|
4130
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
|
|
4131
|
+
return void 0;
|
|
4132
|
+
}
|
|
4133
|
+
survivors.push(instance);
|
|
4134
|
+
}
|
|
4135
|
+
} catch {
|
|
4136
|
+
return void 0;
|
|
4137
|
+
}
|
|
4138
|
+
const knownKeys = new Set(instances.keys());
|
|
4139
|
+
const incoming = [];
|
|
4140
|
+
try {
|
|
4141
|
+
for (let index = retainedLength; index < finalValue.length; index += 1) {
|
|
4142
|
+
const item = finalValue[index];
|
|
4143
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4144
|
+
if (knownKeys.has(key)) return void 0;
|
|
4145
|
+
knownKeys.add(key);
|
|
4146
|
+
const descriptor = props.create(item, index);
|
|
4147
|
+
incoming.push({
|
|
4148
|
+
key,
|
|
4149
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4150
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4151
|
+
item,
|
|
4152
|
+
index,
|
|
4153
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4154
|
+
});
|
|
4155
|
+
}
|
|
4156
|
+
} catch {
|
|
4157
|
+
return void 0;
|
|
4158
|
+
}
|
|
4159
|
+
for (let index = 0; index < retainedStart; index += 1) {
|
|
4160
|
+
previousInstances[index].scope?.cleanup();
|
|
4161
|
+
previousInstances[index].element.remove();
|
|
4162
|
+
}
|
|
4163
|
+
for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
|
|
4164
|
+
if (incoming.length > 0) {
|
|
4165
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
4166
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
4167
|
+
root.append(fragment);
|
|
4168
|
+
}
|
|
4169
|
+
const nextInstances = new Map(
|
|
4170
|
+
[...survivors, ...incoming].map((instance) => [instance.key, instance])
|
|
4171
|
+
);
|
|
4172
|
+
return nextInstances;
|
|
4173
|
+
}
|
|
4174
|
+
function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4175
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
4176
|
+
return void 0;
|
|
4177
|
+
}
|
|
4178
|
+
const collectionDependency = props.collectionDependency;
|
|
4179
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4180
|
+
return void 0;
|
|
4181
|
+
}
|
|
4182
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4183
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4184
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4185
|
+
return void 0;
|
|
4186
|
+
}
|
|
4187
|
+
const finalValue = props.items();
|
|
4188
|
+
const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
|
|
4189
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
4190
|
+
const previousInstances = [...instances.values()];
|
|
4191
|
+
const previous = previousInstances[update.position];
|
|
4192
|
+
if (update.kind === "remove") {
|
|
4193
|
+
const count = update.sourceLength - update.resultLength;
|
|
4194
|
+
const removed = previousInstances.slice(update.position, update.position + count);
|
|
4195
|
+
if (removed.some((instance, index) => instance.index !== update.position + index)) {
|
|
4196
|
+
return void 0;
|
|
4197
|
+
}
|
|
4198
|
+
for (const instance of removed) {
|
|
4199
|
+
instance.scope?.cleanup();
|
|
4200
|
+
instance.element.remove();
|
|
4201
|
+
}
|
|
4202
|
+
previousInstances.splice(update.position, count);
|
|
4203
|
+
for (let index = update.position; index < previousInstances.length; index += 1) {
|
|
4204
|
+
previousInstances[index].index = index;
|
|
4205
|
+
}
|
|
4206
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
4207
|
+
}
|
|
4208
|
+
let item;
|
|
4209
|
+
let key;
|
|
4210
|
+
try {
|
|
4211
|
+
item = finalValue[update.position];
|
|
4212
|
+
key = keyedRowIdentity(props.rowKey(item, update.position));
|
|
4213
|
+
} catch {
|
|
4214
|
+
return void 0;
|
|
4215
|
+
}
|
|
4216
|
+
if (update.kind === "insert") {
|
|
4217
|
+
if (instances.has(key)) return void 0;
|
|
4218
|
+
let inserted;
|
|
4219
|
+
try {
|
|
4220
|
+
const descriptor = props.create(item, update.position);
|
|
4221
|
+
inserted = {
|
|
4222
|
+
key,
|
|
4223
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4224
|
+
values: readKeyedRowBindingValues(props, item, update.position),
|
|
4225
|
+
item,
|
|
4226
|
+
index: update.position,
|
|
4227
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4228
|
+
};
|
|
4229
|
+
} catch {
|
|
4230
|
+
return void 0;
|
|
4231
|
+
}
|
|
4232
|
+
root.insertBefore(inserted.element, previous?.element || null);
|
|
4233
|
+
previousInstances.splice(update.position, 0, inserted);
|
|
4234
|
+
for (let index = update.position + 1; index < previousInstances.length; index += 1) {
|
|
4235
|
+
previousInstances[index].index = index;
|
|
4236
|
+
}
|
|
4237
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
4238
|
+
}
|
|
4239
|
+
if (!previous || previous.index !== update.position) return void 0;
|
|
4240
|
+
if (key === previous.key) {
|
|
4241
|
+
try {
|
|
4242
|
+
applyKeyedRowBindings(props, previous, item, update.position);
|
|
4243
|
+
} catch {
|
|
4244
|
+
return void 0;
|
|
4245
|
+
}
|
|
4246
|
+
previous.item = item;
|
|
4247
|
+
return instances;
|
|
4248
|
+
}
|
|
4249
|
+
if (instances.has(key)) return void 0;
|
|
4250
|
+
let replacement;
|
|
4251
|
+
try {
|
|
4252
|
+
const descriptor = props.create(item, update.position);
|
|
4253
|
+
replacement = {
|
|
4254
|
+
key,
|
|
4255
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4256
|
+
values: readKeyedRowBindingValues(props, item, update.position),
|
|
4257
|
+
item,
|
|
2844
4258
|
index: update.position,
|
|
2845
4259
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2846
4260
|
};
|
|
@@ -2850,10 +4264,10 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2850
4264
|
previous.scope?.cleanup();
|
|
2851
4265
|
previous.element.replaceWith(replacement.element);
|
|
2852
4266
|
previousInstances[update.position] = replacement;
|
|
2853
|
-
return
|
|
4267
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
2854
4268
|
}
|
|
2855
|
-
function
|
|
2856
|
-
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.
|
|
4269
|
+
function reconcileCompilerKeyedArrayBatchInsert(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4270
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
2857
4271
|
return void 0;
|
|
2858
4272
|
}
|
|
2859
4273
|
const collectionDependency = props.collectionDependency;
|
|
@@ -2866,10 +4280,502 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2866
4280
|
return void 0;
|
|
2867
4281
|
}
|
|
2868
4282
|
const finalValue = props.items();
|
|
2869
|
-
const update =
|
|
4283
|
+
const update = compilerKeyedArrayBatchInsert(finalValue, collectionToken, instances.size);
|
|
2870
4284
|
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2871
4285
|
const previousInstances = [...instances.values()];
|
|
2872
|
-
|
|
4286
|
+
const insertCount = update.resultLength - update.sourceLength;
|
|
4287
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
4288
|
+
const instance = previousInstances[sourceIndex];
|
|
4289
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex + insertCount;
|
|
4290
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[resultIndex])) {
|
|
4291
|
+
return void 0;
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
const knownKeys = new Set(instances.keys());
|
|
4295
|
+
const incoming = [];
|
|
4296
|
+
try {
|
|
4297
|
+
for (let offset = 0; offset < insertCount; offset += 1) {
|
|
4298
|
+
const index = update.position + offset;
|
|
4299
|
+
const item = finalValue[index];
|
|
4300
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4301
|
+
if (knownKeys.has(key)) return void 0;
|
|
4302
|
+
knownKeys.add(key);
|
|
4303
|
+
const descriptor = props.create(item, index);
|
|
4304
|
+
incoming.push({
|
|
4305
|
+
key,
|
|
4306
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4307
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4308
|
+
item,
|
|
4309
|
+
index,
|
|
4310
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
} catch {
|
|
4314
|
+
return void 0;
|
|
4315
|
+
}
|
|
4316
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
4317
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
4318
|
+
root.insertBefore(fragment, previousInstances[update.position]?.element || null);
|
|
4319
|
+
previousInstances.splice(update.position, 0, ...incoming);
|
|
4320
|
+
for (let index = update.position + insertCount; index < previousInstances.length; index += 1) {
|
|
4321
|
+
previousInstances[index].index = index;
|
|
4322
|
+
}
|
|
4323
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
4324
|
+
}
|
|
4325
|
+
function normalizeCompilerKeyedArrayDisjointWindows(updates) {
|
|
4326
|
+
const windows = [];
|
|
4327
|
+
for (const update of updates) {
|
|
4328
|
+
const updateEnd = update.position + update.removedCount;
|
|
4329
|
+
let sourcePosition = update.position;
|
|
4330
|
+
for (const window of windows) {
|
|
4331
|
+
const windowStart = window[1];
|
|
4332
|
+
const windowEnd = windowStart + window[3];
|
|
4333
|
+
const before = updateEnd <= windowStart;
|
|
4334
|
+
const after = window[3] === 0 ? update.position >= windowStart : update.position >= windowEnd;
|
|
4335
|
+
if (!before && !after) return void 0;
|
|
4336
|
+
if (after) sourcePosition -= window[3] - window[2];
|
|
4337
|
+
}
|
|
4338
|
+
const delta = update.insertedCount - update.removedCount;
|
|
4339
|
+
for (const window of windows) {
|
|
4340
|
+
if (updateEnd <= window[1]) window[1] += delta;
|
|
4341
|
+
}
|
|
4342
|
+
windows.push([sourcePosition, update.position, update.removedCount, update.insertedCount]);
|
|
4343
|
+
}
|
|
4344
|
+
windows.sort((left, right) => left[0] - right[0]);
|
|
4345
|
+
return windows;
|
|
4346
|
+
}
|
|
4347
|
+
function readCompilerKeyedArrayWindowItems(props, finalValue, resultPosition, insertedCount) {
|
|
4348
|
+
const items = [];
|
|
4349
|
+
const keys = [];
|
|
4350
|
+
try {
|
|
4351
|
+
for (let offset = 0; offset < insertedCount; offset += 1) {
|
|
4352
|
+
const index = resultPosition + offset;
|
|
4353
|
+
const item = finalValue[index];
|
|
4354
|
+
items.push(item);
|
|
4355
|
+
keys.push(keyedRowIdentity(props.rowKey(item, index)));
|
|
4356
|
+
}
|
|
4357
|
+
} catch {
|
|
4358
|
+
return void 0;
|
|
4359
|
+
}
|
|
4360
|
+
return [items, keys];
|
|
4361
|
+
}
|
|
4362
|
+
function prepareCompilerKeyedArrayWindow(props, instances, previousInstances, root, window, incoming, preparedIncomingKeys) {
|
|
4363
|
+
const removedEnd = window[0] + window[2];
|
|
4364
|
+
const removed = previousInstances.slice(window[0], removedEnd);
|
|
4365
|
+
const anchor = previousInstances[removedEnd]?.element || null;
|
|
4366
|
+
if (removed.length !== window[2] || removed.some(
|
|
4367
|
+
(instance, offset) => instance.index !== window[0] + offset || instance.element.parentNode !== root
|
|
4368
|
+
) || anchor && anchor.parentNode !== root) {
|
|
4369
|
+
return void 0;
|
|
4370
|
+
}
|
|
4371
|
+
const incomingKeySet = new Set(incoming[1]);
|
|
4372
|
+
if (incomingKeySet.size !== incoming[1].length) return void 0;
|
|
4373
|
+
for (const key of incomingKeySet) {
|
|
4374
|
+
if (preparedIncomingKeys.has(key)) return void 0;
|
|
4375
|
+
preparedIncomingKeys.add(key);
|
|
4376
|
+
}
|
|
4377
|
+
const hasLocalReuse = removed.some((instance) => incomingKeySet.has(instance.key));
|
|
4378
|
+
const removedByKey = hasLocalReuse ? new Map(removed.map((instance, offset) => [instance.key, { instance, offset }])) : void 0;
|
|
4379
|
+
const nextWindow = [];
|
|
4380
|
+
const sequence = [];
|
|
4381
|
+
const preparedBindings = [];
|
|
4382
|
+
try {
|
|
4383
|
+
for (let offset = 0; offset < window[3]; offset += 1) {
|
|
4384
|
+
const index = window[1] + offset;
|
|
4385
|
+
const item = incoming[0][offset];
|
|
4386
|
+
const key = incoming[1][offset];
|
|
4387
|
+
const retained = removedByKey?.get(key);
|
|
4388
|
+
if (retained) {
|
|
4389
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, retained.instance, item, index);
|
|
4390
|
+
if (!bindingUpdates) return void 0;
|
|
4391
|
+
nextWindow.push(retained.instance);
|
|
4392
|
+
sequence.push(retained.offset);
|
|
4393
|
+
preparedBindings.push(bindingUpdates);
|
|
4394
|
+
continue;
|
|
4395
|
+
}
|
|
4396
|
+
if (instances.has(key)) return void 0;
|
|
4397
|
+
const descriptor = props.create(item, index);
|
|
4398
|
+
nextWindow.push({
|
|
4399
|
+
key,
|
|
4400
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4401
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4402
|
+
item,
|
|
4403
|
+
index,
|
|
4404
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4405
|
+
});
|
|
4406
|
+
sequence.push(-1);
|
|
4407
|
+
preparedBindings.push(void 0);
|
|
4408
|
+
}
|
|
4409
|
+
} catch {
|
|
4410
|
+
return void 0;
|
|
4411
|
+
}
|
|
4412
|
+
return [removed, anchor, incoming[0], incomingKeySet, nextWindow, sequence, preparedBindings];
|
|
4413
|
+
}
|
|
4414
|
+
function commitCompilerKeyedArrayWindow(props, root, prepared) {
|
|
4415
|
+
for (const instance of prepared[0]) {
|
|
4416
|
+
if (prepared[3].has(instance.key)) continue;
|
|
4417
|
+
instance.scope?.cleanup();
|
|
4418
|
+
instance.element.remove();
|
|
4419
|
+
}
|
|
4420
|
+
for (let offset = 0; offset < prepared[4].length; offset += 1) {
|
|
4421
|
+
const bindingUpdates = prepared[6][offset];
|
|
4422
|
+
if (!bindingUpdates) continue;
|
|
4423
|
+
const instance = prepared[4][offset];
|
|
4424
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
4425
|
+
instance.item = prepared[2][offset];
|
|
4426
|
+
}
|
|
4427
|
+
reorderCompilerKeyedRows(root, prepared[4], prepared[5], prepared[1]);
|
|
4428
|
+
}
|
|
4429
|
+
function reconcileCompilerKeyedArrayWindowReplace(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4430
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
4431
|
+
return void 0;
|
|
4432
|
+
}
|
|
4433
|
+
const collectionDependency = props.collectionDependency;
|
|
4434
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4435
|
+
return void 0;
|
|
4436
|
+
}
|
|
4437
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4438
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4439
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4440
|
+
return void 0;
|
|
4441
|
+
}
|
|
4442
|
+
const finalValue = props.items();
|
|
4443
|
+
const updates = compilerKeyedArrayWindowReplacements(finalValue, collectionToken, instances.size);
|
|
4444
|
+
if (!updates || !Array.isArray(finalValue)) return void 0;
|
|
4445
|
+
const previousInstances = [...instances.values()];
|
|
4446
|
+
if (updates.length > 1) {
|
|
4447
|
+
if (updates.some((update2) => update2.insertedCount !== update2.removedCount)) {
|
|
4448
|
+
const windows = normalizeCompilerKeyedArrayDisjointWindows(updates);
|
|
4449
|
+
if (!windows) return void 0;
|
|
4450
|
+
let sourceCursor = 0;
|
|
4451
|
+
let resultCursor = 0;
|
|
4452
|
+
const preparedIncomingKeys = /* @__PURE__ */ new Set();
|
|
4453
|
+
const preparedWindows = [];
|
|
4454
|
+
const nextInstances = [];
|
|
4455
|
+
for (const window of windows) {
|
|
4456
|
+
if (window[0] < sourceCursor) return void 0;
|
|
4457
|
+
while (sourceCursor < window[0]) {
|
|
4458
|
+
const instance = previousInstances[sourceCursor];
|
|
4459
|
+
if (!instance || instance.index !== sourceCursor || !Object.is(instance.item, finalValue[resultCursor])) {
|
|
4460
|
+
return void 0;
|
|
4461
|
+
}
|
|
4462
|
+
nextInstances.push(instance);
|
|
4463
|
+
sourceCursor += 1;
|
|
4464
|
+
resultCursor += 1;
|
|
4465
|
+
}
|
|
4466
|
+
const incoming2 = readCompilerKeyedArrayWindowItems(
|
|
4467
|
+
props,
|
|
4468
|
+
finalValue,
|
|
4469
|
+
resultCursor,
|
|
4470
|
+
window[3]
|
|
4471
|
+
);
|
|
4472
|
+
if (!incoming2) return void 0;
|
|
4473
|
+
window[1] = resultCursor;
|
|
4474
|
+
const prepared3 = prepareCompilerKeyedArrayWindow(
|
|
4475
|
+
props,
|
|
4476
|
+
instances,
|
|
4477
|
+
previousInstances,
|
|
4478
|
+
root,
|
|
4479
|
+
window,
|
|
4480
|
+
incoming2,
|
|
4481
|
+
preparedIncomingKeys
|
|
4482
|
+
);
|
|
4483
|
+
if (!prepared3) return void 0;
|
|
4484
|
+
preparedWindows.push(prepared3);
|
|
4485
|
+
nextInstances.push(...prepared3[4]);
|
|
4486
|
+
sourceCursor += window[2];
|
|
4487
|
+
resultCursor += window[3];
|
|
4488
|
+
}
|
|
4489
|
+
while (sourceCursor < previousInstances.length) {
|
|
4490
|
+
const instance = previousInstances[sourceCursor];
|
|
4491
|
+
if (!instance || instance.index !== sourceCursor || !Object.is(instance.item, finalValue[resultCursor])) {
|
|
4492
|
+
return void 0;
|
|
4493
|
+
}
|
|
4494
|
+
nextInstances.push(instance);
|
|
4495
|
+
sourceCursor += 1;
|
|
4496
|
+
resultCursor += 1;
|
|
4497
|
+
}
|
|
4498
|
+
if (resultCursor !== finalValue.length) return void 0;
|
|
4499
|
+
for (const prepared3 of preparedWindows) {
|
|
4500
|
+
commitCompilerKeyedArrayWindow(props, root, prepared3);
|
|
4501
|
+
}
|
|
4502
|
+
for (let index = 0; index < nextInstances.length; index += 1) {
|
|
4503
|
+
nextInstances[index].index = index;
|
|
4504
|
+
}
|
|
4505
|
+
return keyedRowInstancesByKey(nextInstances);
|
|
4506
|
+
}
|
|
4507
|
+
const touchedIndices = /* @__PURE__ */ new Set();
|
|
4508
|
+
for (const update2 of updates) {
|
|
4509
|
+
for (let index = update2.position; index < update2.position + update2.removedCount; index += 1) {
|
|
4510
|
+
touchedIndices.add(index);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
4514
|
+
const instance = previousInstances[index];
|
|
4515
|
+
const touched = touchedIndices.has(index);
|
|
4516
|
+
if (!instance || instance.index !== index || (touched ? instance.element.parentNode !== root : !Object.is(instance.item, finalValue[index]))) {
|
|
4517
|
+
return void 0;
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
const knownKeys = new Set(instances.keys());
|
|
4521
|
+
const incomingKeys2 = /* @__PURE__ */ new Set();
|
|
4522
|
+
let replacesRows = false;
|
|
4523
|
+
const prepared2 = [];
|
|
4524
|
+
try {
|
|
4525
|
+
for (const index of [...touchedIndices].sort((left, right) => left - right)) {
|
|
4526
|
+
const instance = previousInstances[index];
|
|
4527
|
+
const item = finalValue[index];
|
|
4528
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4529
|
+
if (key !== instance.key) {
|
|
4530
|
+
if (knownKeys.has(key) || incomingKeys2.has(key)) return void 0;
|
|
4531
|
+
incomingKeys2.add(key);
|
|
4532
|
+
replacesRows = true;
|
|
4533
|
+
const descriptor = props.create(item, index);
|
|
4534
|
+
prepared2.push([
|
|
4535
|
+
index,
|
|
4536
|
+
instance,
|
|
4537
|
+
item,
|
|
4538
|
+
void 0,
|
|
4539
|
+
{
|
|
4540
|
+
key,
|
|
4541
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4542
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4543
|
+
item,
|
|
4544
|
+
index,
|
|
4545
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4546
|
+
}
|
|
4547
|
+
]);
|
|
4548
|
+
continue;
|
|
4549
|
+
}
|
|
4550
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
|
|
4551
|
+
if (!bindingUpdates) return void 0;
|
|
4552
|
+
prepared2.push([index, instance, item, bindingUpdates, void 0]);
|
|
4553
|
+
}
|
|
4554
|
+
} catch {
|
|
4555
|
+
return void 0;
|
|
4556
|
+
}
|
|
4557
|
+
for (const [index, instance, item, bindingUpdates, replacement] of prepared2) {
|
|
4558
|
+
if (replacement) {
|
|
4559
|
+
instance.scope?.cleanup();
|
|
4560
|
+
instance.element.replaceWith(replacement.element);
|
|
4561
|
+
previousInstances[index] = replacement;
|
|
4562
|
+
} else {
|
|
4563
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
4564
|
+
instance.item = item;
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
4567
|
+
return replacesRows ? keyedRowInstancesByKey(previousInstances) : instances;
|
|
4568
|
+
}
|
|
4569
|
+
const update = updates[0];
|
|
4570
|
+
const removedEnd = update.position + update.removedCount;
|
|
4571
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
4572
|
+
const instance = previousInstances[sourceIndex];
|
|
4573
|
+
if (!instance || instance.index !== sourceIndex) return void 0;
|
|
4574
|
+
if (sourceIndex >= update.position && sourceIndex < removedEnd) continue;
|
|
4575
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex - update.removedCount + update.insertedCount;
|
|
4576
|
+
if (!Object.is(instance.item, finalValue[resultIndex])) return void 0;
|
|
4577
|
+
}
|
|
4578
|
+
const removed = previousInstances.slice(update.position, removedEnd);
|
|
4579
|
+
const anchor = previousInstances[removedEnd]?.element;
|
|
4580
|
+
if (removed.length !== update.removedCount || removed.some((instance) => instance.element.parentNode !== root) || anchor && anchor.parentNode !== root) {
|
|
4581
|
+
return void 0;
|
|
4582
|
+
}
|
|
4583
|
+
const incoming = readCompilerKeyedArrayWindowItems(
|
|
4584
|
+
props,
|
|
4585
|
+
finalValue,
|
|
4586
|
+
update.position,
|
|
4587
|
+
update.insertedCount
|
|
4588
|
+
);
|
|
4589
|
+
if (!incoming) return void 0;
|
|
4590
|
+
const incomingItems = incoming[0];
|
|
4591
|
+
const incomingKeys = incoming[1];
|
|
4592
|
+
if (update.insertedCount === update.removedCount && incomingKeys.every((key, offset) => key === removed[offset].key)) {
|
|
4593
|
+
const prepared2 = [];
|
|
4594
|
+
try {
|
|
4595
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
4596
|
+
const updates2 = prepareKeyedRowBindingUpdates(
|
|
4597
|
+
props,
|
|
4598
|
+
removed[offset],
|
|
4599
|
+
incomingItems[offset],
|
|
4600
|
+
update.position + offset
|
|
4601
|
+
);
|
|
4602
|
+
if (!updates2) return void 0;
|
|
4603
|
+
prepared2.push(updates2);
|
|
4604
|
+
}
|
|
4605
|
+
} catch {
|
|
4606
|
+
return void 0;
|
|
4607
|
+
}
|
|
4608
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
4609
|
+
applyPreparedKeyedRowBindingUpdates(props, removed[offset], prepared2[offset]);
|
|
4610
|
+
removed[offset].item = incomingItems[offset];
|
|
4611
|
+
}
|
|
4612
|
+
return instances;
|
|
4613
|
+
}
|
|
4614
|
+
const prepared = prepareCompilerKeyedArrayWindow(
|
|
4615
|
+
props,
|
|
4616
|
+
instances,
|
|
4617
|
+
previousInstances,
|
|
4618
|
+
root,
|
|
4619
|
+
[update.position, update.position, update.removedCount, update.insertedCount],
|
|
4620
|
+
incoming,
|
|
4621
|
+
/* @__PURE__ */ new Set()
|
|
4622
|
+
);
|
|
4623
|
+
if (!prepared) return void 0;
|
|
4624
|
+
commitCompilerKeyedArrayWindow(props, root, prepared);
|
|
4625
|
+
previousInstances.splice(update.position, update.removedCount, ...prepared[4]);
|
|
4626
|
+
for (let index = update.position; index < previousInstances.length; index += 1) {
|
|
4627
|
+
previousInstances[index].index = index;
|
|
4628
|
+
}
|
|
4629
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
4630
|
+
}
|
|
4631
|
+
function reconcileCompilerKeyedArrayPositionWithBatch(...args) {
|
|
4632
|
+
return reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
4633
|
+
}
|
|
4634
|
+
function reconcileCompilerKeyedArrayPositionWithWindow(...args) {
|
|
4635
|
+
return reconcileCompilerKeyedArrayWindowReplace(...args) || reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
4636
|
+
}
|
|
4637
|
+
function reconcileCompilerKeyedArrayStructuralReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
|
|
4638
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
4639
|
+
return void 0;
|
|
4640
|
+
}
|
|
4641
|
+
const collectionDependency = props.collectionDependency;
|
|
4642
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4643
|
+
return void 0;
|
|
4644
|
+
}
|
|
4645
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4646
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4647
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4648
|
+
return void 0;
|
|
4649
|
+
}
|
|
4650
|
+
const finalValue = preparedReorder?.value ?? props.items();
|
|
4651
|
+
const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
4652
|
+
if (!update?.structuralUpdate || !Array.isArray(finalValue)) return void 0;
|
|
4653
|
+
const survivorResult = compilerKeyedArrayFilterSurvivorsFromUpdate(
|
|
4654
|
+
update.structuralUpdate,
|
|
4655
|
+
collectionToken,
|
|
4656
|
+
instances.size,
|
|
4657
|
+
finalValue.length
|
|
4658
|
+
);
|
|
4659
|
+
if (!survivorResult) return void 0;
|
|
4660
|
+
const previousInstances = [...instances.values()];
|
|
4661
|
+
const mappedItemSources = update.mappedItemSources;
|
|
4662
|
+
const prepared = (() => {
|
|
4663
|
+
try {
|
|
4664
|
+
const survivors = [];
|
|
4665
|
+
let previousSourceIndex = -1;
|
|
4666
|
+
for (const sourceIndex of survivorResult.indices) {
|
|
4667
|
+
const instance = previousInstances[sourceIndex];
|
|
4668
|
+
if (sourceIndex <= previousSourceIndex || !instance || instance.index !== sourceIndex) {
|
|
4669
|
+
return void 0;
|
|
4670
|
+
}
|
|
4671
|
+
previousSourceIndex = sourceIndex;
|
|
4672
|
+
survivors.push(instance);
|
|
4673
|
+
}
|
|
4674
|
+
const prepareChangedInstance = (instance, item, targetIndex) => {
|
|
4675
|
+
if (Object.is(instance.item, item)) return void 0;
|
|
4676
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, targetIndex);
|
|
4677
|
+
if (!bindingUpdates) throw new TypeError();
|
|
4678
|
+
return { bindingUpdates, instance, item };
|
|
4679
|
+
};
|
|
4680
|
+
let preservesSurvivorOrder = true;
|
|
4681
|
+
const directChanges = [];
|
|
4682
|
+
if (update.kind !== 1 /* Permutation */) {
|
|
4683
|
+
const positionalInstances = update.kind === 0 /* Reverse */ ? [...survivors].reverse() : survivors;
|
|
4684
|
+
const sequence2 = update.kind === 0 /* Reverse */ ? positionalInstances.map((instance) => instance.index) : void 0;
|
|
4685
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
4686
|
+
const item = finalValue[targetIndex];
|
|
4687
|
+
const instance = positionalInstances[targetIndex];
|
|
4688
|
+
if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
|
|
4689
|
+
const changed2 = prepareChangedInstance(instance, item, targetIndex);
|
|
4690
|
+
if (changed2) directChanges.push(changed2);
|
|
4691
|
+
}
|
|
4692
|
+
return { changed: directChanges, nextInstances: positionalInstances, sequence: sequence2 };
|
|
4693
|
+
}
|
|
4694
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
4695
|
+
const item = finalValue[targetIndex];
|
|
4696
|
+
const instance = survivors[targetIndex];
|
|
4697
|
+
const sourceItem = mappedItemSources?.has(item) ? mappedItemSources.get(item) : item;
|
|
4698
|
+
if (!Object.is(instance.item, sourceItem)) {
|
|
4699
|
+
preservesSurvivorOrder = false;
|
|
4700
|
+
break;
|
|
4701
|
+
}
|
|
4702
|
+
if (keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) return void 0;
|
|
4703
|
+
const changed2 = prepareChangedInstance(instance, item, targetIndex);
|
|
4704
|
+
if (changed2) directChanges.push(changed2);
|
|
4705
|
+
}
|
|
4706
|
+
if (preservesSurvivorOrder) {
|
|
4707
|
+
return { changed: directChanges, nextInstances: survivors, sequence: void 0 };
|
|
4708
|
+
}
|
|
4709
|
+
const survivorInstances = /* @__PURE__ */ new Map();
|
|
4710
|
+
for (const instance of survivors) {
|
|
4711
|
+
if (survivorInstances.has(instance.item)) return void 0;
|
|
4712
|
+
survivorInstances.set(instance.item, instance);
|
|
4713
|
+
}
|
|
4714
|
+
const nextInstances = [];
|
|
4715
|
+
const sequence = [];
|
|
4716
|
+
const changed = [];
|
|
4717
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
4718
|
+
const item = finalValue[targetIndex];
|
|
4719
|
+
const sourceItem = mappedItemSources?.has(item) ? mappedItemSources.get(item) : item;
|
|
4720
|
+
const instance = survivorInstances.get(sourceItem);
|
|
4721
|
+
if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, targetIndex)) !== instance.key) {
|
|
4722
|
+
return void 0;
|
|
4723
|
+
}
|
|
4724
|
+
survivorInstances.delete(sourceItem);
|
|
4725
|
+
nextInstances.push(instance);
|
|
4726
|
+
sequence.push(instance.index);
|
|
4727
|
+
const changedInstance = prepareChangedInstance(instance, item, targetIndex);
|
|
4728
|
+
if (changedInstance) changed.push(changedInstance);
|
|
4729
|
+
}
|
|
4730
|
+
if (survivorInstances.size > 0) return void 0;
|
|
4731
|
+
return { changed, nextInstances, sequence };
|
|
4732
|
+
} catch {
|
|
4733
|
+
return void 0;
|
|
4734
|
+
}
|
|
4735
|
+
})();
|
|
4736
|
+
if (!prepared) return void 0;
|
|
4737
|
+
let survivorCursor = 0;
|
|
4738
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
4739
|
+
if (survivorResult.indices[survivorCursor] === sourceIndex) {
|
|
4740
|
+
survivorCursor += 1;
|
|
4741
|
+
continue;
|
|
4742
|
+
}
|
|
4743
|
+
const instance = previousInstances[sourceIndex];
|
|
4744
|
+
instance.scope?.cleanup();
|
|
4745
|
+
instance.element.remove();
|
|
4746
|
+
}
|
|
4747
|
+
if (prepared.sequence) {
|
|
4748
|
+
reorderCompilerKeyedRows(root, prepared.nextInstances, prepared.sequence, null);
|
|
4749
|
+
}
|
|
4750
|
+
for (const { bindingUpdates, instance, item } of prepared.changed) {
|
|
4751
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
4752
|
+
instance.item = item;
|
|
4753
|
+
}
|
|
4754
|
+
for (let index = 0; index < prepared.nextInstances.length; index += 1) {
|
|
4755
|
+
prepared.nextInstances[index].index = index;
|
|
4756
|
+
}
|
|
4757
|
+
return keyedRowInstancesByKey(prepared.nextInstances);
|
|
4758
|
+
}
|
|
4759
|
+
function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows, preparedReorder) {
|
|
4760
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
4761
|
+
return void 0;
|
|
4762
|
+
}
|
|
4763
|
+
const collectionDependency = props.collectionDependency;
|
|
4764
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4765
|
+
return void 0;
|
|
4766
|
+
}
|
|
4767
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4768
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4769
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4770
|
+
return void 0;
|
|
4771
|
+
}
|
|
4772
|
+
const finalValue = preparedReorder?.value ?? props.items();
|
|
4773
|
+
const update = preparedReorder?.update || compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
4774
|
+
if (!update || update.mapped || update.structuralUpdate || !Array.isArray(finalValue)) {
|
|
4775
|
+
return void 0;
|
|
4776
|
+
}
|
|
4777
|
+
const previousInstances = [...instances.values()];
|
|
4778
|
+
if (update.kind === 1 /* Permutation */) {
|
|
2873
4779
|
const instancesByItem = /* @__PURE__ */ new Map();
|
|
2874
4780
|
try {
|
|
2875
4781
|
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
@@ -2888,30 +4794,19 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2888
4794
|
sequence.push(instance.index);
|
|
2889
4795
|
}
|
|
2890
4796
|
if (instancesByItem.size > 0) return void 0;
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
let anchor2 = null;
|
|
2895
|
-
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
2896
|
-
const instance = nextInstances[index];
|
|
2897
|
-
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
|
|
2898
|
-
root.insertBefore(instance.element, anchor2);
|
|
2899
|
-
}
|
|
2900
|
-
anchor2 = instance.element;
|
|
2901
|
-
instance.index = index;
|
|
4797
|
+
reorderCompilerKeyedRows(root, nextInstances, sequence, null);
|
|
4798
|
+
for (let index = 0; index < nextInstances.length; index += 1) {
|
|
4799
|
+
nextInstances[index].index = index;
|
|
2902
4800
|
}
|
|
2903
|
-
|
|
2904
|
-
activeElement2.focus({ preventScroll: true });
|
|
2905
|
-
}
|
|
2906
|
-
return new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
4801
|
+
return keyedRowInstancesByKey(nextInstances);
|
|
2907
4802
|
} catch {
|
|
2908
4803
|
return void 0;
|
|
2909
4804
|
}
|
|
2910
4805
|
}
|
|
2911
4806
|
try {
|
|
2912
|
-
for (let
|
|
4807
|
+
for (let targetIndex = 0; targetIndex < previousInstances.length; targetIndex += 1) {
|
|
4808
|
+
const sourceIndex = update.kind === 0 /* Reverse */ ? previousInstances.length - targetIndex - 1 : targetIndex;
|
|
2913
4809
|
const instance = previousInstances[sourceIndex];
|
|
2914
|
-
const targetIndex = previousInstances.length - sourceIndex - 1;
|
|
2915
4810
|
if (instance.index !== sourceIndex || !Object.is(instance.item, finalValue[targetIndex])) {
|
|
2916
4811
|
return void 0;
|
|
2917
4812
|
}
|
|
@@ -2919,22 +4814,41 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2919
4814
|
} catch {
|
|
2920
4815
|
return void 0;
|
|
2921
4816
|
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
4817
|
+
if (update.kind === void 0) return instances;
|
|
4818
|
+
reverseCompilerKeyedRows(root, previousInstances);
|
|
4819
|
+
return keyedRowInstancesByKey(previousInstances);
|
|
4820
|
+
}
|
|
4821
|
+
function prepareCompilerKeyedArrayReorder(args) {
|
|
4822
|
+
const [props, dirtyState, collectionToken, instances, , reactOwnedRows] = args;
|
|
4823
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
4824
|
+
return void 0;
|
|
2929
4825
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
4826
|
+
const collectionDependency = props.collectionDependency;
|
|
4827
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4828
|
+
return void 0;
|
|
2933
4829
|
}
|
|
2934
|
-
|
|
2935
|
-
|
|
4830
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4831
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4832
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4833
|
+
return void 0;
|
|
2936
4834
|
}
|
|
2937
|
-
|
|
4835
|
+
const value = props.items();
|
|
4836
|
+
return {
|
|
4837
|
+
update: compilerKeyedArrayReorder(value, collectionToken, instances.size),
|
|
4838
|
+
value
|
|
4839
|
+
};
|
|
4840
|
+
}
|
|
4841
|
+
function reconcileCompilerKeyedArrayReorderWithMap(...args) {
|
|
4842
|
+
const prepared = prepareCompilerKeyedArrayReorder(args);
|
|
4843
|
+
if (!prepared) return void 0;
|
|
4844
|
+
const reconcile = prepared.update?.mapped ? reconcileCompilerKeyedArrayMapReorder : reconcileCompilerKeyedArrayReorder;
|
|
4845
|
+
return reconcile(args[0], args[1], args[2], args[3], args[4], args[5], prepared);
|
|
4846
|
+
}
|
|
4847
|
+
function reconcileCompilerKeyedArrayReorderWithMapAndStructural(...args) {
|
|
4848
|
+
const prepared = prepareCompilerKeyedArrayReorder(args);
|
|
4849
|
+
if (!prepared) return void 0;
|
|
4850
|
+
const reconcile = prepared.update?.structuralUpdate ? reconcileCompilerKeyedArrayStructuralReorder : prepared.update?.mapped ? reconcileCompilerKeyedArrayMapReorder : reconcileCompilerKeyedArrayReorder;
|
|
4851
|
+
return reconcile(args[0], args[1], args[2], args[3], args[4], args[5], prepared);
|
|
2938
4852
|
}
|
|
2939
4853
|
function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2940
4854
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.prependIndexIndependent || props.collectionDependency === void 0) {
|
|
@@ -2962,7 +4876,192 @@ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken,
|
|
|
2962
4876
|
const knownKeys = new Set(instances.keys());
|
|
2963
4877
|
const prepended = [];
|
|
2964
4878
|
try {
|
|
2965
|
-
for (let index = 0; index < prefixLength; index += 1) {
|
|
4879
|
+
for (let index = 0; index < prefixLength; index += 1) {
|
|
4880
|
+
const item = finalValue[index];
|
|
4881
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4882
|
+
if (knownKeys.has(key)) return void 0;
|
|
4883
|
+
knownKeys.add(key);
|
|
4884
|
+
const descriptor = props.create(item, index);
|
|
4885
|
+
prepended.push({
|
|
4886
|
+
key,
|
|
4887
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4888
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4889
|
+
item,
|
|
4890
|
+
index,
|
|
4891
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4892
|
+
});
|
|
4893
|
+
}
|
|
4894
|
+
} catch {
|
|
4895
|
+
return void 0;
|
|
4896
|
+
}
|
|
4897
|
+
if (prepended.length > 0) {
|
|
4898
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
4899
|
+
for (const instance of prepended) fragment.append(instance.element);
|
|
4900
|
+
root.insertBefore(fragment, root.firstChild);
|
|
4901
|
+
}
|
|
4902
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
4903
|
+
previousInstances[index].index = prefixLength + index;
|
|
4904
|
+
}
|
|
4905
|
+
return keyedRowInstancesByKey([...prepended, ...previousInstances]);
|
|
4906
|
+
}
|
|
4907
|
+
function reconcileCompilerKeyedArrayStructuralPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4908
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.prependIndexIndependent || props.collectionDependency === void 0) {
|
|
4909
|
+
return void 0;
|
|
4910
|
+
}
|
|
4911
|
+
const collectionDependency = props.collectionDependency;
|
|
4912
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4913
|
+
return void 0;
|
|
4914
|
+
}
|
|
4915
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4916
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4917
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4918
|
+
return void 0;
|
|
4919
|
+
}
|
|
4920
|
+
const finalValue = props.items();
|
|
4921
|
+
const update = compilerKeyedArrayStructuralPrependUpdate(
|
|
4922
|
+
finalValue,
|
|
4923
|
+
collectionToken,
|
|
4924
|
+
instances.size
|
|
4925
|
+
);
|
|
4926
|
+
const structuralUpdate = update?.structuralUpdate;
|
|
4927
|
+
const survivorResult = update?.structuralSurvivors;
|
|
4928
|
+
if (!update || !structuralUpdate || !survivorResult || structuralUpdate.mappedItemSources || !Array.isArray(finalValue)) {
|
|
4929
|
+
return void 0;
|
|
4930
|
+
}
|
|
4931
|
+
const previousInstances = [...instances.values()];
|
|
4932
|
+
const survivors = [];
|
|
4933
|
+
const knownKeys = new Set(instances.keys());
|
|
4934
|
+
const prepended = [];
|
|
4935
|
+
try {
|
|
4936
|
+
for (let index = 0; index < survivorResult.indices.length; index += 1) {
|
|
4937
|
+
const sourceIndex = survivorResult.indices[index];
|
|
4938
|
+
const instance = previousInstances[sourceIndex];
|
|
4939
|
+
const item = finalValue[update.prefixLength + index];
|
|
4940
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !survivorResult.keysStable && keyedRowIdentity(props.rowKey(item, update.prefixLength + index)) !== instance.key) {
|
|
4941
|
+
return void 0;
|
|
4942
|
+
}
|
|
4943
|
+
survivors.push(instance);
|
|
4944
|
+
}
|
|
4945
|
+
for (let index = 0; index < update.prefixLength; index += 1) {
|
|
4946
|
+
const item = finalValue[index];
|
|
4947
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
4948
|
+
if (knownKeys.has(key)) return void 0;
|
|
4949
|
+
knownKeys.add(key);
|
|
4950
|
+
const descriptor = props.create(item, index);
|
|
4951
|
+
prepended.push({
|
|
4952
|
+
key,
|
|
4953
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
4954
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
4955
|
+
item,
|
|
4956
|
+
index,
|
|
4957
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
4958
|
+
});
|
|
4959
|
+
}
|
|
4960
|
+
} catch {
|
|
4961
|
+
return void 0;
|
|
4962
|
+
}
|
|
4963
|
+
const survivorSet = new Set(survivorResult.indices);
|
|
4964
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
4965
|
+
if (survivorSet.has(index)) continue;
|
|
4966
|
+
previousInstances[index].scope?.cleanup();
|
|
4967
|
+
previousInstances[index].element.remove();
|
|
4968
|
+
}
|
|
4969
|
+
if (prepended.length > 0) {
|
|
4970
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
4971
|
+
for (const instance of prepended) fragment.append(instance.element);
|
|
4972
|
+
root.insertBefore(fragment, survivors[0]?.element || root.firstChild);
|
|
4973
|
+
}
|
|
4974
|
+
for (let index = 0; index < survivors.length; index += 1) {
|
|
4975
|
+
survivors[index].index = update.prefixLength + index;
|
|
4976
|
+
}
|
|
4977
|
+
return keyedRowInstancesByKey([...prepended, ...survivors]);
|
|
4978
|
+
}
|
|
4979
|
+
function reconcileCompilerKeyedArrayStructuralPrependMap(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
4980
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || !props.prependIndexIndependent || props.collectionDependency === void 0) {
|
|
4981
|
+
return void 0;
|
|
4982
|
+
}
|
|
4983
|
+
const collectionDependency = props.collectionDependency;
|
|
4984
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
4985
|
+
return void 0;
|
|
4986
|
+
}
|
|
4987
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
4988
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
4989
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
4990
|
+
return void 0;
|
|
4991
|
+
}
|
|
4992
|
+
const finalValue = props.items();
|
|
4993
|
+
const update = compilerKeyedArrayStructuralPrependMapUpdate(
|
|
4994
|
+
finalValue,
|
|
4995
|
+
collectionToken,
|
|
4996
|
+
instances.size,
|
|
4997
|
+
true
|
|
4998
|
+
);
|
|
4999
|
+
if (!update || !update.mappedItemSources || !Array.isArray(finalValue)) return void 0;
|
|
5000
|
+
const mappedItemSources = update.mappedSurvivorsValidated ? update.mappedItemSources : void 0;
|
|
5001
|
+
const mappedStructuralSources = update.mappedSurvivorsValidated ? void 0 : update.mappedItemSources;
|
|
5002
|
+
const previousInstances = [...instances.values()];
|
|
5003
|
+
const survivorRange = update.structuralSurvivorRange;
|
|
5004
|
+
const survivorIndices = update.structuralSurvivors;
|
|
5005
|
+
const survivorCount = survivorRange ? survivorRange.end - survivorRange.start : survivorIndices?.length ?? 0;
|
|
5006
|
+
if (!survivorRange && !survivorIndices) return void 0;
|
|
5007
|
+
const changed = [];
|
|
5008
|
+
const knownKeys = new Set(instances.keys());
|
|
5009
|
+
const prepended = [];
|
|
5010
|
+
try {
|
|
5011
|
+
if (mappedStructuralSources) {
|
|
5012
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
5013
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
|
|
5014
|
+
const instance = previousInstances[sourceIndex];
|
|
5015
|
+
const item = finalValue[update.prefixLength + index];
|
|
5016
|
+
const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
|
|
5017
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, sourceItem)) {
|
|
5018
|
+
return void 0;
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
5022
|
+
const sourceIndex = survivorRange ? survivorRange.start + index : survivorIndices[index];
|
|
5023
|
+
const instance = previousInstances[sourceIndex];
|
|
5024
|
+
const item = finalValue[update.prefixLength + index];
|
|
5025
|
+
const sourceItem = mappedStructuralSources.has(item) ? mappedStructuralSources.get(item) : item;
|
|
5026
|
+
if (Object.is(item, sourceItem)) continue;
|
|
5027
|
+
if (keyedRowIdentity(props.rowKey(item, update.prefixLength + index)) !== instance.key) {
|
|
5028
|
+
return void 0;
|
|
5029
|
+
}
|
|
5030
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(
|
|
5031
|
+
props,
|
|
5032
|
+
instance,
|
|
5033
|
+
item,
|
|
5034
|
+
update.prefixLength + index
|
|
5035
|
+
);
|
|
5036
|
+
if (!bindingUpdates) return void 0;
|
|
5037
|
+
changed.push({ bindingUpdates, instance, item });
|
|
5038
|
+
}
|
|
5039
|
+
} else if (survivorIndices) {
|
|
5040
|
+
for (let index = 0; index < survivorCount; index += 1) {
|
|
5041
|
+
const sourceIndex = survivorIndices[index];
|
|
5042
|
+
const instance = previousInstances[sourceIndex];
|
|
5043
|
+
const item = finalValue[update.prefixLength + index];
|
|
5044
|
+
const expectedItem = mappedItemSources.has(index) ? mappedItemSources.get(index) : item;
|
|
5045
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, expectedItem)) {
|
|
5046
|
+
return void 0;
|
|
5047
|
+
}
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
for (const [index, sourceItem] of mappedItemSources || []) {
|
|
5051
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= survivorCount) {
|
|
5052
|
+
return void 0;
|
|
5053
|
+
}
|
|
5054
|
+
const instance = previousInstances[survivorRange ? survivorRange.start + index : survivorIndices[index]];
|
|
5055
|
+
const finalIndex = update.prefixLength + index;
|
|
5056
|
+
const item = finalValue[finalIndex];
|
|
5057
|
+
if (!instance || !Object.is(instance.item, sourceItem) || keyedRowIdentity(props.rowKey(item, finalIndex)) !== instance.key) {
|
|
5058
|
+
return void 0;
|
|
5059
|
+
}
|
|
5060
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, finalIndex);
|
|
5061
|
+
if (!bindingUpdates) return void 0;
|
|
5062
|
+
changed.push({ bindingUpdates, instance, item });
|
|
5063
|
+
}
|
|
5064
|
+
for (let index = 0; index < update.prefixLength; index += 1) {
|
|
2966
5065
|
const item = finalValue[index];
|
|
2967
5066
|
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2968
5067
|
if (knownKeys.has(key)) return void 0;
|
|
@@ -2980,15 +5079,43 @@ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken,
|
|
|
2980
5079
|
} catch {
|
|
2981
5080
|
return void 0;
|
|
2982
5081
|
}
|
|
5082
|
+
if (survivorRange) {
|
|
5083
|
+
for (let index = 0; index < survivorRange.start; index += 1) {
|
|
5084
|
+
previousInstances[index].scope?.cleanup();
|
|
5085
|
+
previousInstances[index].element.remove();
|
|
5086
|
+
}
|
|
5087
|
+
for (let index = survivorRange.end; index < previousInstances.length; index += 1) {
|
|
5088
|
+
previousInstances[index].scope?.cleanup();
|
|
5089
|
+
previousInstances[index].element.remove();
|
|
5090
|
+
}
|
|
5091
|
+
} else {
|
|
5092
|
+
const survivorSet = new Set(survivorIndices);
|
|
5093
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
5094
|
+
if (survivorSet.has(index)) continue;
|
|
5095
|
+
previousInstances[index].scope?.cleanup();
|
|
5096
|
+
previousInstances[index].element.remove();
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
const survivors = survivorRange ? previousInstances.slice(survivorRange.start, survivorRange.end) : survivorIndices.map((index) => previousInstances[index]);
|
|
2983
5100
|
if (prepended.length > 0) {
|
|
2984
5101
|
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2985
5102
|
for (const instance of prepended) fragment.append(instance.element);
|
|
2986
|
-
root.insertBefore(fragment, root.firstChild);
|
|
5103
|
+
root.insertBefore(fragment, survivors[0]?.element || root.firstChild);
|
|
2987
5104
|
}
|
|
2988
|
-
for (let index = 0; index <
|
|
2989
|
-
|
|
5105
|
+
for (let index = 0; index < survivors.length; index += 1) {
|
|
5106
|
+
survivors[index].index = update.prefixLength + index;
|
|
5107
|
+
}
|
|
5108
|
+
for (const { bindingUpdates, instance, item } of changed) {
|
|
5109
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
5110
|
+
instance.item = item;
|
|
2990
5111
|
}
|
|
2991
|
-
return
|
|
5112
|
+
return keyedRowInstancesByKey([...prepended, ...survivors]);
|
|
5113
|
+
}
|
|
5114
|
+
function reconcileCompilerKeyedArrayPrependWithStructural(...args) {
|
|
5115
|
+
return reconcileCompilerKeyedArrayStructuralPrepend(...args) || reconcileCompilerKeyedArrayPrepend(...args);
|
|
5116
|
+
}
|
|
5117
|
+
function reconcileCompilerKeyedArrayPrependMapWithStructural(...args) {
|
|
5118
|
+
return reconcileCompilerKeyedArrayStructuralPrependMap(...args) || reconcileCompilerKeyedArrayStructuralPrepend(...args) || reconcileCompilerKeyedArrayPrepend(...args);
|
|
2992
5119
|
}
|
|
2993
5120
|
function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, instances, reactOwnedRows) {
|
|
2994
5121
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
@@ -3035,7 +5162,7 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
|
|
|
3035
5162
|
for (let index = 0; index < survivors.length; index += 1) {
|
|
3036
5163
|
survivors[index].index = index;
|
|
3037
5164
|
}
|
|
3038
|
-
return
|
|
5165
|
+
return keyedRowInstancesByKey(survivors);
|
|
3039
5166
|
}
|
|
3040
5167
|
function createKeyedRowConditionalRuntime() {
|
|
3041
5168
|
class FarmKeyedRowConditional extends React.Component {
|
|
@@ -3209,7 +5336,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3209
5336
|
this.hasReactOwnedRows()
|
|
3210
5337
|
);
|
|
3211
5338
|
if (appendedInstances) {
|
|
3212
|
-
this.instances = new Map(appendedInstances);
|
|
5339
|
+
this.instances = appendedInstances instanceof Map ? appendedInstances : new Map(appendedInstances);
|
|
3213
5340
|
this.rebuildElementIndex(this.instances);
|
|
3214
5341
|
this.commitCurrentCollection(dirtyState);
|
|
3215
5342
|
afterCommit?.();
|
|
@@ -3242,8 +5369,14 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3242
5369
|
this.hasReactOwnedRows()
|
|
3243
5370
|
);
|
|
3244
5371
|
if (reorderedInstances) {
|
|
5372
|
+
const removedRows = reorderedInstances.size < this.instances.size;
|
|
3245
5373
|
this.instances = new Map(reorderedInstances);
|
|
3246
5374
|
this.rebuildElementIndex(this.instances);
|
|
5375
|
+
if (removedRows) {
|
|
5376
|
+
const keys = [...this.instances.keys()];
|
|
5377
|
+
this.pruneEventHandlers(keys);
|
|
5378
|
+
this.pruneConditionalListeners(keys);
|
|
5379
|
+
}
|
|
3247
5380
|
this.commitCurrentCollection(dirtyState);
|
|
3248
5381
|
afterCommit?.();
|
|
3249
5382
|
return;
|
|
@@ -3399,7 +5532,10 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3399
5532
|
}
|
|
3400
5533
|
}
|
|
3401
5534
|
commitCurrentCollection(dirtyState) {
|
|
3402
|
-
this.collectionToken = options.keyedUpdates?.commit(
|
|
5535
|
+
this.collectionToken = options.keyedUpdates?.commit(
|
|
5536
|
+
this.currentProps.items(),
|
|
5537
|
+
this.instances
|
|
5538
|
+
);
|
|
3403
5539
|
this.commitKeyedTargets(dirtyState);
|
|
3404
5540
|
}
|
|
3405
5541
|
hasSafeMembershipTargets(dirtyState) {
|
|
@@ -3831,8 +5967,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3831
5967
|
}
|
|
3832
5968
|
if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
|
|
3833
5969
|
if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
|
|
3834
|
-
const activeElement = this.root.ownerDocument.activeElement;
|
|
3835
|
-
const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
|
|
3836
5970
|
const nextKeys = new Set(rows.keys);
|
|
3837
5971
|
const hasSurvivingRows = rows.keys.some((key) => this.instances.has(key));
|
|
3838
5972
|
const oldIndices = /* @__PURE__ */ new Map();
|
|
@@ -3846,7 +5980,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3846
5980
|
}
|
|
3847
5981
|
}
|
|
3848
5982
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : rows.keys.map(() => -1);
|
|
3849
|
-
const stablePositions = hasSurvivingRows ? longestIncreasingSubsequencePositions(sequence) : /* @__PURE__ */ new Set();
|
|
3850
5983
|
const nextInstances = [];
|
|
3851
5984
|
const conditionalChanges = [];
|
|
3852
5985
|
for (let index = 0; index < rows.items.length; index += 1) {
|
|
@@ -3911,34 +6044,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3911
6044
|
for (const instance of nextInstances) fragment.append(instance.element);
|
|
3912
6045
|
this.root.replaceChildren(fragment);
|
|
3913
6046
|
} else {
|
|
3914
|
-
|
|
3915
|
-
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
3916
|
-
const instance = nextInstances[index];
|
|
3917
|
-
if (sequence[index] < 0) {
|
|
3918
|
-
let start = index;
|
|
3919
|
-
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
3920
|
-
const fragment = this.root.ownerDocument.createDocumentFragment();
|
|
3921
|
-
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
3922
|
-
fragment.append(nextInstances[itemIndex].element);
|
|
3923
|
-
}
|
|
3924
|
-
this.root.insertBefore(fragment, anchor);
|
|
3925
|
-
anchor = nextInstances[start].element;
|
|
3926
|
-
index = start;
|
|
3927
|
-
} else {
|
|
3928
|
-
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
3929
|
-
this.root.insertBefore(instance.element, anchor);
|
|
3930
|
-
}
|
|
3931
|
-
anchor = instance.element;
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
6047
|
+
reorderCompilerKeyedRows(this.root, nextInstances, sequence, null);
|
|
3934
6048
|
}
|
|
3935
|
-
this.instances =
|
|
6049
|
+
this.instances = keyedRowInstancesByKey(nextInstances);
|
|
3936
6050
|
this.rebuildElementIndex(this.instances);
|
|
3937
6051
|
this.pruneEventHandlers(rows.keys);
|
|
3938
6052
|
this.pruneConditionalListeners(rows.keys);
|
|
3939
|
-
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
3940
|
-
activeElement.focus({ preventScroll: true });
|
|
3941
|
-
}
|
|
3942
6053
|
this.commitCurrentCollection(dirtyState);
|
|
3943
6054
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
3944
6055
|
}
|
|
@@ -4428,6 +6539,22 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
4428
6539
|
})
|
|
4429
6540
|
})
|
|
4430
6541
|
};
|
|
6542
|
+
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
6543
|
+
name: "keyed-rows:batch-position-hinted",
|
|
6544
|
+
create: (owner) => ({
|
|
6545
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6546
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
6547
|
+
})
|
|
6548
|
+
})
|
|
6549
|
+
};
|
|
6550
|
+
var keyedRowsWindowPositionHintedRuntimeFeature = {
|
|
6551
|
+
name: "keyed-rows:window-position-hinted",
|
|
6552
|
+
create: (owner) => ({
|
|
6553
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6554
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
6555
|
+
})
|
|
6556
|
+
})
|
|
6557
|
+
};
|
|
4431
6558
|
var keyedRowsReorderHintedRuntimeFeature = {
|
|
4432
6559
|
name: "keyed-rows:reorder-hinted",
|
|
4433
6560
|
create: (owner) => ({
|
|
@@ -4436,6 +6563,14 @@ var keyedRowsReorderHintedRuntimeFeature = {
|
|
|
4436
6563
|
})
|
|
4437
6564
|
})
|
|
4438
6565
|
};
|
|
6566
|
+
var keyedRowsMapReorderHintedRuntimeFeature = {
|
|
6567
|
+
name: "keyed-rows:map-reorder-hinted",
|
|
6568
|
+
create: (owner) => ({
|
|
6569
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6570
|
+
keyedUpdates: keyedMapReorderUpdateRuntime
|
|
6571
|
+
})
|
|
6572
|
+
})
|
|
6573
|
+
};
|
|
4439
6574
|
var keyedRowsAllHintedRuntimeFeature = {
|
|
4440
6575
|
name: "keyed-rows:all-hinted",
|
|
4441
6576
|
create: (owner) => ({
|
|
@@ -4452,6 +6587,22 @@ var keyedRowsEveryHintedRuntimeFeature = {
|
|
|
4452
6587
|
})
|
|
4453
6588
|
})
|
|
4454
6589
|
};
|
|
6590
|
+
var keyedRowsBatchEveryHintedRuntimeFeature = {
|
|
6591
|
+
name: "keyed-rows:batch-every-hinted",
|
|
6592
|
+
create: (owner) => ({
|
|
6593
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6594
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
6595
|
+
})
|
|
6596
|
+
})
|
|
6597
|
+
};
|
|
6598
|
+
var keyedRowsWindowEveryHintedRuntimeFeature = {
|
|
6599
|
+
name: "keyed-rows:window-every-hinted",
|
|
6600
|
+
create: (owner) => ({
|
|
6601
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6602
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
6603
|
+
})
|
|
6604
|
+
})
|
|
6605
|
+
};
|
|
4455
6606
|
var keyedRowsFilterHintedRuntimeFeature = {
|
|
4456
6607
|
name: "keyed-rows:filter-hinted",
|
|
4457
6608
|
create: (owner) => ({
|
|
@@ -4460,6 +6611,38 @@ var keyedRowsFilterHintedRuntimeFeature = {
|
|
|
4460
6611
|
})
|
|
4461
6612
|
})
|
|
4462
6613
|
};
|
|
6614
|
+
var keyedRowsStructuralAppendHintedRuntimeFeature = {
|
|
6615
|
+
name: "keyed-rows:structural-append-hinted",
|
|
6616
|
+
create: (owner) => ({
|
|
6617
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6618
|
+
keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
|
|
6619
|
+
})
|
|
6620
|
+
})
|
|
6621
|
+
};
|
|
6622
|
+
var keyedRowsStructuralAppendMapHintedRuntimeFeature = {
|
|
6623
|
+
name: "keyed-rows:structural-append-map-hinted",
|
|
6624
|
+
create: (owner) => ({
|
|
6625
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6626
|
+
keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
|
|
6627
|
+
})
|
|
6628
|
+
})
|
|
6629
|
+
};
|
|
6630
|
+
var keyedRowsStructuralPrependHintedRuntimeFeature = {
|
|
6631
|
+
name: "keyed-rows:structural-prepend-hinted",
|
|
6632
|
+
create: (owner) => ({
|
|
6633
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6634
|
+
keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
|
|
6635
|
+
})
|
|
6636
|
+
})
|
|
6637
|
+
};
|
|
6638
|
+
var keyedRowsStructuralPrependMapHintedRuntimeFeature = {
|
|
6639
|
+
name: "keyed-rows:structural-prepend-map-hinted",
|
|
6640
|
+
create: (owner) => ({
|
|
6641
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6642
|
+
keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
|
|
6643
|
+
})
|
|
6644
|
+
})
|
|
6645
|
+
};
|
|
4463
6646
|
var keyedRowsPrependHintedRuntimeFeature = {
|
|
4464
6647
|
name: "keyed-rows:prepend-hinted",
|
|
4465
6648
|
create: (owner) => ({
|
|
@@ -4472,7 +6655,7 @@ var keyedRowsFilterPrependHintedRuntimeFeature = {
|
|
|
4472
6655
|
name: "keyed-rows:filter-prepend-hinted",
|
|
4473
6656
|
create: (owner) => ({
|
|
4474
6657
|
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4475
|
-
keyedUpdates:
|
|
6658
|
+
keyedUpdates: keyedStructuralPrependUpdateRuntime
|
|
4476
6659
|
})
|
|
4477
6660
|
})
|
|
4478
6661
|
};
|
|
@@ -4502,6 +6685,24 @@ var keyedRowsConditionalPositionHintedRuntimeFeature = {
|
|
|
4502
6685
|
})
|
|
4503
6686
|
})
|
|
4504
6687
|
};
|
|
6688
|
+
var keyedRowsConditionalBatchPositionHintedRuntimeFeature = {
|
|
6689
|
+
name: "keyed-rows:conditional:batch-position-hinted",
|
|
6690
|
+
create: (owner) => ({
|
|
6691
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6692
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6693
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
6694
|
+
})
|
|
6695
|
+
})
|
|
6696
|
+
};
|
|
6697
|
+
var keyedRowsConditionalWindowPositionHintedRuntimeFeature = {
|
|
6698
|
+
name: "keyed-rows:conditional:window-position-hinted",
|
|
6699
|
+
create: (owner) => ({
|
|
6700
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6701
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6702
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
6703
|
+
})
|
|
6704
|
+
})
|
|
6705
|
+
};
|
|
4505
6706
|
var keyedRowsConditionalReorderHintedRuntimeFeature = {
|
|
4506
6707
|
name: "keyed-rows:conditional:reorder-hinted",
|
|
4507
6708
|
create: (owner) => ({
|
|
@@ -4529,6 +6730,24 @@ var keyedRowsConditionalEveryHintedRuntimeFeature = {
|
|
|
4529
6730
|
})
|
|
4530
6731
|
})
|
|
4531
6732
|
};
|
|
6733
|
+
var keyedRowsConditionalBatchEveryHintedRuntimeFeature = {
|
|
6734
|
+
name: "keyed-rows:conditional:batch-every-hinted",
|
|
6735
|
+
create: (owner) => ({
|
|
6736
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6737
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6738
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
6739
|
+
})
|
|
6740
|
+
})
|
|
6741
|
+
};
|
|
6742
|
+
var keyedRowsConditionalWindowEveryHintedRuntimeFeature = {
|
|
6743
|
+
name: "keyed-rows:conditional:window-every-hinted",
|
|
6744
|
+
create: (owner) => ({
|
|
6745
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6746
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6747
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
6748
|
+
})
|
|
6749
|
+
})
|
|
6750
|
+
};
|
|
4532
6751
|
var keyedRowsConditionalFilterHintedRuntimeFeature = {
|
|
4533
6752
|
name: "keyed-rows:conditional:filter-hinted",
|
|
4534
6753
|
create: (owner) => ({
|
|
@@ -4538,6 +6757,42 @@ var keyedRowsConditionalFilterHintedRuntimeFeature = {
|
|
|
4538
6757
|
})
|
|
4539
6758
|
})
|
|
4540
6759
|
};
|
|
6760
|
+
var keyedRowsConditionalStructuralAppendHintedRuntimeFeature = {
|
|
6761
|
+
name: "keyed-rows:conditional:structural-append-hinted",
|
|
6762
|
+
create: (owner) => ({
|
|
6763
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6764
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6765
|
+
keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
|
|
6766
|
+
})
|
|
6767
|
+
})
|
|
6768
|
+
};
|
|
6769
|
+
var keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature = {
|
|
6770
|
+
name: "keyed-rows:conditional:structural-append-map-hinted",
|
|
6771
|
+
create: (owner) => ({
|
|
6772
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6773
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6774
|
+
keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
|
|
6775
|
+
})
|
|
6776
|
+
})
|
|
6777
|
+
};
|
|
6778
|
+
var keyedRowsConditionalStructuralPrependHintedRuntimeFeature = {
|
|
6779
|
+
name: "keyed-rows:conditional:structural-prepend-hinted",
|
|
6780
|
+
create: (owner) => ({
|
|
6781
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6782
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6783
|
+
keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
|
|
6784
|
+
})
|
|
6785
|
+
})
|
|
6786
|
+
};
|
|
6787
|
+
var keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature = {
|
|
6788
|
+
name: "keyed-rows:conditional:structural-prepend-map-hinted",
|
|
6789
|
+
create: (owner) => ({
|
|
6790
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6791
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
6792
|
+
keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
|
|
6793
|
+
})
|
|
6794
|
+
})
|
|
6795
|
+
};
|
|
4541
6796
|
var keyedRowsConditionalPrependHintedRuntimeFeature = {
|
|
4542
6797
|
name: "keyed-rows:conditional:prepend-hinted",
|
|
4543
6798
|
create: (owner) => ({
|
|
@@ -4582,6 +6837,24 @@ var keyedRowsHostPositionHintedRuntimeFeature = {
|
|
|
4582
6837
|
})
|
|
4583
6838
|
})
|
|
4584
6839
|
};
|
|
6840
|
+
var keyedRowsHostBatchPositionHintedRuntimeFeature = {
|
|
6841
|
+
name: "keyed-rows:host:batch-position-hinted",
|
|
6842
|
+
create: (owner) => ({
|
|
6843
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6844
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6845
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
6846
|
+
})
|
|
6847
|
+
})
|
|
6848
|
+
};
|
|
6849
|
+
var keyedRowsHostWindowPositionHintedRuntimeFeature = {
|
|
6850
|
+
name: "keyed-rows:host:window-position-hinted",
|
|
6851
|
+
create: (owner) => ({
|
|
6852
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6853
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6854
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
6855
|
+
})
|
|
6856
|
+
})
|
|
6857
|
+
};
|
|
4585
6858
|
var keyedRowsHostReorderHintedRuntimeFeature = {
|
|
4586
6859
|
name: "keyed-rows:host:reorder-hinted",
|
|
4587
6860
|
create: (owner) => ({
|
|
@@ -4609,6 +6882,24 @@ var keyedRowsHostEveryHintedRuntimeFeature = {
|
|
|
4609
6882
|
})
|
|
4610
6883
|
})
|
|
4611
6884
|
};
|
|
6885
|
+
var keyedRowsHostBatchEveryHintedRuntimeFeature = {
|
|
6886
|
+
name: "keyed-rows:host:batch-every-hinted",
|
|
6887
|
+
create: (owner) => ({
|
|
6888
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6889
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6890
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
6891
|
+
})
|
|
6892
|
+
})
|
|
6893
|
+
};
|
|
6894
|
+
var keyedRowsHostWindowEveryHintedRuntimeFeature = {
|
|
6895
|
+
name: "keyed-rows:host:window-every-hinted",
|
|
6896
|
+
create: (owner) => ({
|
|
6897
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6898
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6899
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
6900
|
+
})
|
|
6901
|
+
})
|
|
6902
|
+
};
|
|
4612
6903
|
var keyedRowsHostFilterHintedRuntimeFeature = {
|
|
4613
6904
|
name: "keyed-rows:host:filter-hinted",
|
|
4614
6905
|
create: (owner) => ({
|
|
@@ -4618,6 +6909,42 @@ var keyedRowsHostFilterHintedRuntimeFeature = {
|
|
|
4618
6909
|
})
|
|
4619
6910
|
})
|
|
4620
6911
|
};
|
|
6912
|
+
var keyedRowsHostStructuralAppendHintedRuntimeFeature = {
|
|
6913
|
+
name: "keyed-rows:host:structural-append-hinted",
|
|
6914
|
+
create: (owner) => ({
|
|
6915
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6916
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6917
|
+
keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
|
|
6918
|
+
})
|
|
6919
|
+
})
|
|
6920
|
+
};
|
|
6921
|
+
var keyedRowsHostStructuralAppendMapHintedRuntimeFeature = {
|
|
6922
|
+
name: "keyed-rows:host:structural-append-map-hinted",
|
|
6923
|
+
create: (owner) => ({
|
|
6924
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6925
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6926
|
+
keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
|
|
6927
|
+
})
|
|
6928
|
+
})
|
|
6929
|
+
};
|
|
6930
|
+
var keyedRowsHostStructuralPrependHintedRuntimeFeature = {
|
|
6931
|
+
name: "keyed-rows:host:structural-prepend-hinted",
|
|
6932
|
+
create: (owner) => ({
|
|
6933
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6934
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6935
|
+
keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
|
|
6936
|
+
})
|
|
6937
|
+
})
|
|
6938
|
+
};
|
|
6939
|
+
var keyedRowsHostStructuralPrependMapHintedRuntimeFeature = {
|
|
6940
|
+
name: "keyed-rows:host:structural-prepend-map-hinted",
|
|
6941
|
+
create: (owner) => ({
|
|
6942
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6943
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
6944
|
+
keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
|
|
6945
|
+
})
|
|
6946
|
+
})
|
|
6947
|
+
};
|
|
4621
6948
|
var keyedRowsHostPrependHintedRuntimeFeature = {
|
|
4622
6949
|
name: "keyed-rows:host:prepend-hinted",
|
|
4623
6950
|
create: (owner) => ({
|
|
@@ -4665,6 +6992,26 @@ var keyedRowsCompletePositionHintedRuntimeFeature = {
|
|
|
4665
6992
|
})
|
|
4666
6993
|
})
|
|
4667
6994
|
};
|
|
6995
|
+
var keyedRowsCompleteBatchPositionHintedRuntimeFeature = {
|
|
6996
|
+
name: "keyed-rows:complete:batch-position-hinted",
|
|
6997
|
+
create: (owner) => ({
|
|
6998
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
6999
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7000
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7001
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
7002
|
+
})
|
|
7003
|
+
})
|
|
7004
|
+
};
|
|
7005
|
+
var keyedRowsCompleteWindowPositionHintedRuntimeFeature = {
|
|
7006
|
+
name: "keyed-rows:complete:window-position-hinted",
|
|
7007
|
+
create: (owner) => ({
|
|
7008
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7009
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7010
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7011
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
7012
|
+
})
|
|
7013
|
+
})
|
|
7014
|
+
};
|
|
4668
7015
|
var keyedRowsCompleteReorderHintedRuntimeFeature = {
|
|
4669
7016
|
name: "keyed-rows:complete:reorder-hinted",
|
|
4670
7017
|
create: (owner) => ({
|
|
@@ -4695,6 +7042,26 @@ var keyedRowsCompleteEveryHintedRuntimeFeature = {
|
|
|
4695
7042
|
})
|
|
4696
7043
|
})
|
|
4697
7044
|
};
|
|
7045
|
+
var keyedRowsCompleteBatchEveryHintedRuntimeFeature = {
|
|
7046
|
+
name: "keyed-rows:complete:batch-every-hinted",
|
|
7047
|
+
create: (owner) => ({
|
|
7048
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7049
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7050
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7051
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
7052
|
+
})
|
|
7053
|
+
})
|
|
7054
|
+
};
|
|
7055
|
+
var keyedRowsCompleteWindowEveryHintedRuntimeFeature = {
|
|
7056
|
+
name: "keyed-rows:complete:window-every-hinted",
|
|
7057
|
+
create: (owner) => ({
|
|
7058
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7059
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7060
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7061
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
7062
|
+
})
|
|
7063
|
+
})
|
|
7064
|
+
};
|
|
4698
7065
|
var keyedRowsCompleteFilterHintedRuntimeFeature = {
|
|
4699
7066
|
name: "keyed-rows:complete:filter-hinted",
|
|
4700
7067
|
create: (owner) => ({
|
|
@@ -4705,6 +7072,46 @@ var keyedRowsCompleteFilterHintedRuntimeFeature = {
|
|
|
4705
7072
|
})
|
|
4706
7073
|
})
|
|
4707
7074
|
};
|
|
7075
|
+
var keyedRowsCompleteStructuralAppendHintedRuntimeFeature = {
|
|
7076
|
+
name: "keyed-rows:complete:structural-append-hinted",
|
|
7077
|
+
create: (owner) => ({
|
|
7078
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7079
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7080
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7081
|
+
keyedUpdates: keyedWindowEveryStructuralAppendUpdateRuntime
|
|
7082
|
+
})
|
|
7083
|
+
})
|
|
7084
|
+
};
|
|
7085
|
+
var keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature = {
|
|
7086
|
+
name: "keyed-rows:complete:structural-append-map-hinted",
|
|
7087
|
+
create: (owner) => ({
|
|
7088
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7089
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7090
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7091
|
+
keyedUpdates: keyedWindowEveryStructuralAppendMapUpdateRuntime
|
|
7092
|
+
})
|
|
7093
|
+
})
|
|
7094
|
+
};
|
|
7095
|
+
var keyedRowsCompleteStructuralPrependHintedRuntimeFeature = {
|
|
7096
|
+
name: "keyed-rows:complete:structural-prepend-hinted",
|
|
7097
|
+
create: (owner) => ({
|
|
7098
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7099
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7100
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7101
|
+
keyedUpdates: keyedCompleteCompatibilityUpdateRuntime
|
|
7102
|
+
})
|
|
7103
|
+
})
|
|
7104
|
+
};
|
|
7105
|
+
var keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature = {
|
|
7106
|
+
name: "keyed-rows:complete:structural-prepend-map-hinted",
|
|
7107
|
+
create: (owner) => ({
|
|
7108
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7109
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7110
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7111
|
+
keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
|
|
7112
|
+
})
|
|
7113
|
+
})
|
|
7114
|
+
};
|
|
4708
7115
|
var keyedRowsCompletePrependHintedRuntimeFeature = {
|
|
4709
7116
|
name: "keyed-rows:complete:prepend-hinted",
|
|
4710
7117
|
create: (owner) => ({
|
|
@@ -4725,6 +7132,16 @@ var keyedRowsCompleteFilterPrependHintedRuntimeFeature = {
|
|
|
4725
7132
|
})
|
|
4726
7133
|
})
|
|
4727
7134
|
};
|
|
7135
|
+
var keyedRowsCompleteCompatibilityRuntimeFeature = {
|
|
7136
|
+
name: "keyed-rows:complete:compatibility",
|
|
7137
|
+
create: (owner) => ({
|
|
7138
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
7139
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
7140
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
7141
|
+
keyedUpdates: keyedCompleteStructuralPrependMapUpdateRuntime
|
|
7142
|
+
})
|
|
7143
|
+
})
|
|
7144
|
+
};
|
|
4728
7145
|
var keyedRangesRuntimeFeature = {
|
|
4729
7146
|
name: "keyed-ranges",
|
|
4730
7147
|
create: (owner) => ({
|
|
@@ -5197,7 +7614,7 @@ var COMPLETE_RUNTIME_FEATURES = [
|
|
|
5197
7614
|
hostConditionalRuntimeFeature,
|
|
5198
7615
|
conditionalRangesRuntimeFeature,
|
|
5199
7616
|
keyedListRuntimeFeature,
|
|
5200
|
-
|
|
7617
|
+
keyedRowsCompleteCompatibilityRuntimeFeature,
|
|
5201
7618
|
keyedRangesRuntimeFeature,
|
|
5202
7619
|
mixedRangesRuntimeFeature,
|
|
5203
7620
|
componentRuntimeFeature
|
|
@@ -5206,6 +7623,6 @@ function createCompiledComponent(definition) {
|
|
|
5206
7623
|
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
5207
7624
|
}
|
|
5208
7625
|
|
|
5209
|
-
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
7626
|
+
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayBatchInsert, createCompilerKeyedArrayFilter, createCompilerKeyedArrayMapPipeline, createCompilerKeyedArrayMapReorder, createCompilerKeyedArrayMappedStructuralAppend, createCompilerKeyedArrayMappedStructuralPrepend, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayQueuedMapPipeline, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedArrayStructuralAppend, createCompilerKeyedArrayStructuralAppendMapPipeline, createCompilerKeyedArrayStructuralPrepend, createCompilerKeyedArrayStructuralPrependMapPipeline, createCompilerKeyedArrayStructuralReorder, createCompilerKeyedArrayStructuralSort, createCompilerKeyedArrayWindowReplace, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, finalizeCompilerKeyedArrayMappedStructuralUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsBatchEveryHintedRuntimeFeature, keyedRowsBatchPositionHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteBatchEveryHintedRuntimeFeature, keyedRowsCompleteBatchPositionHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsCompleteStructuralAppendHintedRuntimeFeature, keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature, keyedRowsCompleteStructuralPrependHintedRuntimeFeature, keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature, keyedRowsCompleteWindowEveryHintedRuntimeFeature, keyedRowsCompleteWindowPositionHintedRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalBatchEveryHintedRuntimeFeature, keyedRowsConditionalBatchPositionHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsConditionalStructuralAppendHintedRuntimeFeature, keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature, keyedRowsConditionalStructuralPrependHintedRuntimeFeature, keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature, keyedRowsConditionalWindowEveryHintedRuntimeFeature, keyedRowsConditionalWindowPositionHintedRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostBatchEveryHintedRuntimeFeature, keyedRowsHostBatchPositionHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsHostStructuralAppendHintedRuntimeFeature, keyedRowsHostStructuralAppendMapHintedRuntimeFeature, keyedRowsHostStructuralPrependHintedRuntimeFeature, keyedRowsHostStructuralPrependMapHintedRuntimeFeature, keyedRowsHostWindowEveryHintedRuntimeFeature, keyedRowsHostWindowPositionHintedRuntimeFeature, keyedRowsMapReorderHintedRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, keyedRowsStructuralAppendHintedRuntimeFeature, keyedRowsStructuralAppendMapHintedRuntimeFeature, keyedRowsStructuralPrependHintedRuntimeFeature, keyedRowsStructuralPrependMapHintedRuntimeFeature, keyedRowsWindowEveryHintedRuntimeFeature, keyedRowsWindowPositionHintedRuntimeFeature, mixedRangesRuntimeFeature };
|
|
5210
7627
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
5211
7628
|
//# sourceMappingURL=compiler-runtime.mjs.map
|