@farm.js/react 0.1.0-beta.6 → 0.1.0-beta.8
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 +79 -13
- package/dist/compiler-runtime.cjs +713 -31
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +25 -3
- package/dist/compiler-runtime.d.ts +25 -3
- package/dist/compiler-runtime.mjs +695 -32
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +206 -15
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +206 -15
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -26,6 +26,8 @@ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
|
|
|
26
26
|
var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
|
|
27
27
|
var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
|
|
28
28
|
var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
var COMPILER_KEYED_ARRAY_BATCH_INSERTS = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
var COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS = /* @__PURE__ */ new WeakMap();
|
|
29
31
|
var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
|
|
30
32
|
var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
31
33
|
var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
@@ -37,6 +39,7 @@ var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
|
37
39
|
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
38
40
|
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
39
41
|
var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
|
|
42
|
+
var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
|
|
40
43
|
var NATIVE_REFLECT_APPLY = Reflect.apply;
|
|
41
44
|
function compilerObject(value) {
|
|
42
45
|
return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
|
|
@@ -157,11 +160,40 @@ function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
|
|
|
157
160
|
const target = compilerObject(value);
|
|
158
161
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
159
162
|
const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
|
|
160
|
-
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 === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
|
|
163
|
+
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)) {
|
|
161
164
|
return void 0;
|
|
162
165
|
}
|
|
163
166
|
return update;
|
|
164
167
|
}
|
|
168
|
+
function compilerKeyedArrayBatchInsert(value, sourceToken, expectedLength) {
|
|
169
|
+
const target = compilerObject(value);
|
|
170
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
171
|
+
const update = COMPILER_KEYED_ARRAY_BATCH_INSERTS.get(target);
|
|
172
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.resultLength < expectedLength + 2 || update.position < 0 || update.position > expectedLength) {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
return update;
|
|
176
|
+
}
|
|
177
|
+
function compilerKeyedArrayWindowReplacements(value, sourceToken, expectedLength) {
|
|
178
|
+
const target = compilerObject(value);
|
|
179
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
180
|
+
const update = COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(target);
|
|
181
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
182
|
+
const updates = [];
|
|
183
|
+
for (let current = update; current; current = current.previous) {
|
|
184
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
185
|
+
updates.push(current);
|
|
186
|
+
}
|
|
187
|
+
updates.reverse();
|
|
188
|
+
let length = expectedLength;
|
|
189
|
+
for (const current of updates) {
|
|
190
|
+
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) {
|
|
191
|
+
return void 0;
|
|
192
|
+
}
|
|
193
|
+
length = current.resultLength;
|
|
194
|
+
}
|
|
195
|
+
return length === value.length ? updates : void 0;
|
|
196
|
+
}
|
|
165
197
|
function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
|
|
166
198
|
const target = compilerObject(value);
|
|
167
199
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
@@ -373,9 +405,12 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
373
405
|
}
|
|
374
406
|
const sourceLength = previous.length;
|
|
375
407
|
const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
|
|
408
|
+
const deleteCount = args[0];
|
|
409
|
+
const removedCount = sourceLength - value.length;
|
|
376
410
|
const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
|
|
377
|
-
const
|
|
378
|
-
|
|
411
|
+
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);
|
|
412
|
+
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);
|
|
413
|
+
if (!validInsert && !validRemove && !validReplace) return value;
|
|
379
414
|
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
380
415
|
if (!sourceToken) return value;
|
|
381
416
|
COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
|
|
@@ -389,6 +424,71 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
389
424
|
}
|
|
390
425
|
return value;
|
|
391
426
|
}
|
|
427
|
+
function createCompilerKeyedArrayBatchInsert(previous, method, position, ...items) {
|
|
428
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
429
|
+
method,
|
|
430
|
+
previous,
|
|
431
|
+
[position, 0, ...items]
|
|
432
|
+
);
|
|
433
|
+
try {
|
|
434
|
+
const previousTarget = compilerObject(previous);
|
|
435
|
+
const valueTarget = compilerObject(value);
|
|
436
|
+
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) {
|
|
437
|
+
return value;
|
|
438
|
+
}
|
|
439
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
440
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
441
|
+
}
|
|
442
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
443
|
+
if (!sourceToken) return value;
|
|
444
|
+
COMPILER_KEYED_ARRAY_BATCH_INSERTS.set(valueTarget, {
|
|
445
|
+
sourceToken,
|
|
446
|
+
sourceLength: previous.length,
|
|
447
|
+
resultLength: value.length,
|
|
448
|
+
position: position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length)
|
|
449
|
+
});
|
|
450
|
+
} catch {
|
|
451
|
+
}
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
function createCompilerKeyedArrayWindowReplace(previous, method, position, deleteCount, ...items) {
|
|
455
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
456
|
+
method,
|
|
457
|
+
previous,
|
|
458
|
+
[position, deleteCount, ...items]
|
|
459
|
+
);
|
|
460
|
+
try {
|
|
461
|
+
const previousTarget = compilerObject(previous);
|
|
462
|
+
const valueTarget = compilerObject(value);
|
|
463
|
+
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) {
|
|
464
|
+
return value;
|
|
465
|
+
}
|
|
466
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
467
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
468
|
+
}
|
|
469
|
+
const normalizedPosition = position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length);
|
|
470
|
+
const removedCount = Math.min(deleteCount, previous.length - normalizedPosition);
|
|
471
|
+
if (removedCount < 1 || value.length !== previous.length - removedCount + items.length) {
|
|
472
|
+
return value;
|
|
473
|
+
}
|
|
474
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
475
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(previousTarget);
|
|
476
|
+
if (!committedSource && !previousUpdate) return value;
|
|
477
|
+
const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
478
|
+
if (!sourceToken) return value;
|
|
479
|
+
COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.set(valueTarget, {
|
|
480
|
+
sourceToken,
|
|
481
|
+
sourceLength: previous.length,
|
|
482
|
+
resultLength: value.length,
|
|
483
|
+
position: normalizedPosition,
|
|
484
|
+
removedCount,
|
|
485
|
+
insertedCount: items.length,
|
|
486
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
487
|
+
});
|
|
488
|
+
} catch {
|
|
489
|
+
}
|
|
490
|
+
return value;
|
|
491
|
+
}
|
|
392
492
|
function createCompilerKeyedArrayReorder(previous, method) {
|
|
393
493
|
const value = NATIVE_REFLECT_APPLY(
|
|
394
494
|
method,
|
|
@@ -413,6 +513,33 @@ function createCompilerKeyedArrayReorder(previous, method) {
|
|
|
413
513
|
}
|
|
414
514
|
return value;
|
|
415
515
|
}
|
|
516
|
+
function createCompilerKeyedArraySort(previous, method, ...args) {
|
|
517
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
518
|
+
method,
|
|
519
|
+
previous,
|
|
520
|
+
args
|
|
521
|
+
);
|
|
522
|
+
try {
|
|
523
|
+
const previousTarget = compilerObject(previous);
|
|
524
|
+
const valueTarget = compilerObject(value);
|
|
525
|
+
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_SORTED || args.length > 1 || args.length === 1 && args[0] !== void 0 && typeof args[0] !== "function" || value.length !== previous.length) {
|
|
526
|
+
return value;
|
|
527
|
+
}
|
|
528
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
529
|
+
if (!(index in previous)) return value;
|
|
530
|
+
}
|
|
531
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
532
|
+
if (!sourceToken) return value;
|
|
533
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
534
|
+
kind: "sort",
|
|
535
|
+
sourceToken,
|
|
536
|
+
sourceLength: previous.length,
|
|
537
|
+
resultLength: value.length
|
|
538
|
+
});
|
|
539
|
+
} catch {
|
|
540
|
+
}
|
|
541
|
+
return value;
|
|
542
|
+
}
|
|
416
543
|
function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
|
|
417
544
|
const args = operation === "map-set" ? [key, value] : [key];
|
|
418
545
|
const result = NATIVE_REFLECT_APPLY(method, collection, args);
|
|
@@ -1097,6 +1224,32 @@ function applyKeyedRowBinding(props, instance, item, index, bindingIndex) {
|
|
|
1097
1224
|
updateAttribute(target, binding.name, rawValue);
|
|
1098
1225
|
}
|
|
1099
1226
|
}
|
|
1227
|
+
function prepareKeyedRowBindingUpdates(props, instance, item, index) {
|
|
1228
|
+
const updates = [];
|
|
1229
|
+
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
1230
|
+
const binding = props.bindings[bindingIndex];
|
|
1231
|
+
const rawValue = binding.read(item, index);
|
|
1232
|
+
const value = normalizedKeyedRowBindingValue(binding, rawValue);
|
|
1233
|
+
if (Object.is(instance.values[bindingIndex], value)) continue;
|
|
1234
|
+
const target = findCompilerHostTarget(instance.element, binding.path);
|
|
1235
|
+
if (!target || binding.kind !== "text" && !binding.name) return void 0;
|
|
1236
|
+
updates.push([bindingIndex, rawValue, target, value]);
|
|
1237
|
+
}
|
|
1238
|
+
return updates;
|
|
1239
|
+
}
|
|
1240
|
+
function applyPreparedKeyedRowBindingUpdates(props, instance, updates) {
|
|
1241
|
+
for (const [bindingIndex, rawValue, target, value] of updates) {
|
|
1242
|
+
const binding = props.bindings[bindingIndex];
|
|
1243
|
+
instance.values[bindingIndex] = value;
|
|
1244
|
+
if (binding.kind === "text") {
|
|
1245
|
+
target.textContent = value;
|
|
1246
|
+
} else if (binding.kind === "style") {
|
|
1247
|
+
updateStyle(target, binding.name, rawValue);
|
|
1248
|
+
} else {
|
|
1249
|
+
updateAttribute(target, binding.name, rawValue);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1100
1253
|
function keyedRowConditionalSnapshot(conditional, item, index) {
|
|
1101
1254
|
const test = conditional.test(item, index);
|
|
1102
1255
|
if (conditional.logical && !test) {
|
|
@@ -2539,6 +2692,33 @@ function longestIncreasingSubsequencePositions(sequence) {
|
|
|
2539
2692
|
}
|
|
2540
2693
|
return positions;
|
|
2541
2694
|
}
|
|
2695
|
+
function reorderCompilerKeyedRows(root, instances, sequence, anchor) {
|
|
2696
|
+
const activeElement = root.ownerDocument.activeElement;
|
|
2697
|
+
const restoreFocus = Boolean(activeElement && root.contains(activeElement));
|
|
2698
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
2699
|
+
for (let index = instances.length - 1; index >= 0; index -= 1) {
|
|
2700
|
+
const instance = instances[index];
|
|
2701
|
+
if (sequence[index] < 0) {
|
|
2702
|
+
let start = index;
|
|
2703
|
+
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
2704
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2705
|
+
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
2706
|
+
fragment.append(instances[itemIndex].element);
|
|
2707
|
+
}
|
|
2708
|
+
root.insertBefore(fragment, anchor);
|
|
2709
|
+
anchor = instances[start].element;
|
|
2710
|
+
index = start;
|
|
2711
|
+
} else {
|
|
2712
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
2713
|
+
root.insertBefore(instance.element, anchor);
|
|
2714
|
+
}
|
|
2715
|
+
anchor = instance.element;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
2719
|
+
activeElement.focus({ preventScroll: true });
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2542
2722
|
var keyedUpdateRuntime = {
|
|
2543
2723
|
append: reconcileCompilerKeyedArrayAppend,
|
|
2544
2724
|
commit: commitCompilerKeyedCollection,
|
|
@@ -2560,6 +2740,14 @@ var keyedPositionUpdateRuntime = {
|
|
|
2560
2740
|
...keyedUpdateRuntime,
|
|
2561
2741
|
position: reconcileCompilerKeyedArrayPosition
|
|
2562
2742
|
};
|
|
2743
|
+
var keyedBatchPositionUpdateRuntime = {
|
|
2744
|
+
...keyedUpdateRuntime,
|
|
2745
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
2746
|
+
};
|
|
2747
|
+
var keyedWindowPositionUpdateRuntime = {
|
|
2748
|
+
...keyedUpdateRuntime,
|
|
2749
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
2750
|
+
};
|
|
2563
2751
|
var keyedReorderUpdateRuntime = {
|
|
2564
2752
|
...keyedUpdateRuntime,
|
|
2565
2753
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
@@ -2573,6 +2761,14 @@ var keyedEveryUpdateRuntime = {
|
|
|
2573
2761
|
position: reconcileCompilerKeyedArrayPosition,
|
|
2574
2762
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
2575
2763
|
};
|
|
2764
|
+
var keyedBatchEveryUpdateRuntime = {
|
|
2765
|
+
...keyedEveryUpdateRuntime,
|
|
2766
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
2767
|
+
};
|
|
2768
|
+
var keyedWindowEveryUpdateRuntime = {
|
|
2769
|
+
...keyedEveryUpdateRuntime,
|
|
2770
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
2771
|
+
};
|
|
2576
2772
|
function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
|
|
2577
2773
|
const dependency = props.collectionDependency;
|
|
2578
2774
|
if (dependency === void 0) return void 0;
|
|
@@ -2752,6 +2948,22 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2752
2948
|
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2753
2949
|
const previousInstances = [...instances.values()];
|
|
2754
2950
|
const previous = previousInstances[update.position];
|
|
2951
|
+
if (update.kind === "remove") {
|
|
2952
|
+
const count = update.sourceLength - update.resultLength;
|
|
2953
|
+
const removed = previousInstances.slice(update.position, update.position + count);
|
|
2954
|
+
if (removed.some((instance, index) => instance.index !== update.position + index)) {
|
|
2955
|
+
return void 0;
|
|
2956
|
+
}
|
|
2957
|
+
for (const instance of removed) {
|
|
2958
|
+
instance.scope?.cleanup();
|
|
2959
|
+
instance.element.remove();
|
|
2960
|
+
}
|
|
2961
|
+
previousInstances.splice(update.position, count);
|
|
2962
|
+
for (let index = update.position; index < previousInstances.length; index += 1) {
|
|
2963
|
+
previousInstances[index].index = index;
|
|
2964
|
+
}
|
|
2965
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2966
|
+
}
|
|
2755
2967
|
let item;
|
|
2756
2968
|
let key;
|
|
2757
2969
|
try {
|
|
@@ -2813,6 +3025,299 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2813
3025
|
previousInstances[update.position] = replacement;
|
|
2814
3026
|
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2815
3027
|
}
|
|
3028
|
+
function reconcileCompilerKeyedArrayBatchInsert(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
3029
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
3030
|
+
return void 0;
|
|
3031
|
+
}
|
|
3032
|
+
const collectionDependency = props.collectionDependency;
|
|
3033
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
3034
|
+
return void 0;
|
|
3035
|
+
}
|
|
3036
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
3037
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
3038
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
3039
|
+
return void 0;
|
|
3040
|
+
}
|
|
3041
|
+
const finalValue = props.items();
|
|
3042
|
+
const update = compilerKeyedArrayBatchInsert(finalValue, collectionToken, instances.size);
|
|
3043
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
3044
|
+
const previousInstances = [...instances.values()];
|
|
3045
|
+
const insertCount = update.resultLength - update.sourceLength;
|
|
3046
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
3047
|
+
const instance = previousInstances[sourceIndex];
|
|
3048
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex + insertCount;
|
|
3049
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[resultIndex])) {
|
|
3050
|
+
return void 0;
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
const knownKeys = new Set(instances.keys());
|
|
3054
|
+
const incoming = [];
|
|
3055
|
+
try {
|
|
3056
|
+
for (let offset = 0; offset < insertCount; offset += 1) {
|
|
3057
|
+
const index = update.position + offset;
|
|
3058
|
+
const item = finalValue[index];
|
|
3059
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3060
|
+
if (knownKeys.has(key)) return void 0;
|
|
3061
|
+
knownKeys.add(key);
|
|
3062
|
+
const descriptor = props.create(item, index);
|
|
3063
|
+
incoming.push({
|
|
3064
|
+
key,
|
|
3065
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3066
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3067
|
+
item,
|
|
3068
|
+
index,
|
|
3069
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
} catch {
|
|
3073
|
+
return void 0;
|
|
3074
|
+
}
|
|
3075
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
3076
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
3077
|
+
root.insertBefore(fragment, previousInstances[update.position]?.element || null);
|
|
3078
|
+
previousInstances.splice(update.position, 0, ...incoming);
|
|
3079
|
+
for (let index = update.position + insertCount; index < previousInstances.length; index += 1) {
|
|
3080
|
+
previousInstances[index].index = index;
|
|
3081
|
+
}
|
|
3082
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3083
|
+
}
|
|
3084
|
+
function reconcileCompilerKeyedArrayWindowReplace(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
3085
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
3086
|
+
return void 0;
|
|
3087
|
+
}
|
|
3088
|
+
const collectionDependency = props.collectionDependency;
|
|
3089
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
3090
|
+
return void 0;
|
|
3091
|
+
}
|
|
3092
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
3093
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
3094
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
3095
|
+
return void 0;
|
|
3096
|
+
}
|
|
3097
|
+
const finalValue = props.items();
|
|
3098
|
+
const updates = compilerKeyedArrayWindowReplacements(finalValue, collectionToken, instances.size);
|
|
3099
|
+
if (!updates || !Array.isArray(finalValue)) return void 0;
|
|
3100
|
+
const previousInstances = [...instances.values()];
|
|
3101
|
+
if (updates.length > 1) {
|
|
3102
|
+
const touchedIndices = /* @__PURE__ */ new Set();
|
|
3103
|
+
for (const update2 of updates) {
|
|
3104
|
+
if (update2.insertedCount !== update2.removedCount) return void 0;
|
|
3105
|
+
for (let index = update2.position; index < update2.position + update2.removedCount; index += 1) {
|
|
3106
|
+
touchedIndices.add(index);
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
3110
|
+
const instance = previousInstances[index];
|
|
3111
|
+
const touched = touchedIndices.has(index);
|
|
3112
|
+
if (!instance || instance.index !== index || (touched ? instance.element.parentNode !== root : !Object.is(instance.item, finalValue[index]))) {
|
|
3113
|
+
return void 0;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
const knownKeys2 = new Set(instances.keys());
|
|
3117
|
+
const incomingKeys2 = /* @__PURE__ */ new Set();
|
|
3118
|
+
let replacesRows = false;
|
|
3119
|
+
const prepared = [];
|
|
3120
|
+
try {
|
|
3121
|
+
for (const index of [...touchedIndices].sort((left, right) => left - right)) {
|
|
3122
|
+
const instance = previousInstances[index];
|
|
3123
|
+
const item = finalValue[index];
|
|
3124
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3125
|
+
if (key !== instance.key) {
|
|
3126
|
+
if (knownKeys2.has(key) || incomingKeys2.has(key)) return void 0;
|
|
3127
|
+
incomingKeys2.add(key);
|
|
3128
|
+
replacesRows = true;
|
|
3129
|
+
const descriptor = props.create(item, index);
|
|
3130
|
+
prepared.push([
|
|
3131
|
+
index,
|
|
3132
|
+
instance,
|
|
3133
|
+
item,
|
|
3134
|
+
void 0,
|
|
3135
|
+
{
|
|
3136
|
+
key,
|
|
3137
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3138
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3139
|
+
item,
|
|
3140
|
+
index,
|
|
3141
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3142
|
+
}
|
|
3143
|
+
]);
|
|
3144
|
+
continue;
|
|
3145
|
+
}
|
|
3146
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
|
|
3147
|
+
if (!bindingUpdates) return void 0;
|
|
3148
|
+
prepared.push([index, instance, item, bindingUpdates, void 0]);
|
|
3149
|
+
}
|
|
3150
|
+
} catch {
|
|
3151
|
+
return void 0;
|
|
3152
|
+
}
|
|
3153
|
+
for (const [index, instance, item, bindingUpdates, replacement] of prepared) {
|
|
3154
|
+
if (replacement) {
|
|
3155
|
+
instance.scope?.cleanup();
|
|
3156
|
+
instance.element.replaceWith(replacement.element);
|
|
3157
|
+
previousInstances[index] = replacement;
|
|
3158
|
+
} else {
|
|
3159
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
3160
|
+
instance.item = item;
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
return replacesRows ? new Map(previousInstances.map((instance) => [instance.key, instance])) : instances;
|
|
3164
|
+
}
|
|
3165
|
+
const update = updates[0];
|
|
3166
|
+
const removedEnd = update.position + update.removedCount;
|
|
3167
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
3168
|
+
const instance = previousInstances[sourceIndex];
|
|
3169
|
+
if (!instance || instance.index !== sourceIndex) return void 0;
|
|
3170
|
+
if (sourceIndex >= update.position && sourceIndex < removedEnd) continue;
|
|
3171
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex - update.removedCount + update.insertedCount;
|
|
3172
|
+
if (!Object.is(instance.item, finalValue[resultIndex])) return void 0;
|
|
3173
|
+
}
|
|
3174
|
+
const removed = previousInstances.slice(update.position, removedEnd);
|
|
3175
|
+
const anchor = previousInstances[removedEnd]?.element;
|
|
3176
|
+
if (removed.length !== update.removedCount || removed.some((instance) => instance.element.parentNode !== root) || anchor && anchor.parentNode !== root) {
|
|
3177
|
+
return void 0;
|
|
3178
|
+
}
|
|
3179
|
+
const incomingItems = [];
|
|
3180
|
+
const incomingKeys = [];
|
|
3181
|
+
try {
|
|
3182
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3183
|
+
const index = update.position + offset;
|
|
3184
|
+
const item = finalValue[index];
|
|
3185
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3186
|
+
incomingItems.push(item);
|
|
3187
|
+
incomingKeys.push(key);
|
|
3188
|
+
}
|
|
3189
|
+
} catch {
|
|
3190
|
+
return void 0;
|
|
3191
|
+
}
|
|
3192
|
+
if (update.insertedCount === update.removedCount && incomingKeys.every((key, offset) => key === removed[offset].key)) {
|
|
3193
|
+
const prepared = [];
|
|
3194
|
+
try {
|
|
3195
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3196
|
+
const updates2 = prepareKeyedRowBindingUpdates(
|
|
3197
|
+
props,
|
|
3198
|
+
removed[offset],
|
|
3199
|
+
incomingItems[offset],
|
|
3200
|
+
update.position + offset
|
|
3201
|
+
);
|
|
3202
|
+
if (!updates2) return void 0;
|
|
3203
|
+
prepared.push(updates2);
|
|
3204
|
+
}
|
|
3205
|
+
} catch {
|
|
3206
|
+
return void 0;
|
|
3207
|
+
}
|
|
3208
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3209
|
+
applyPreparedKeyedRowBindingUpdates(props, removed[offset], prepared[offset]);
|
|
3210
|
+
removed[offset].item = incomingItems[offset];
|
|
3211
|
+
}
|
|
3212
|
+
return instances;
|
|
3213
|
+
}
|
|
3214
|
+
if (update.insertedCount === update.removedCount) {
|
|
3215
|
+
const incomingKeySet = new Set(incomingKeys);
|
|
3216
|
+
if (incomingKeySet.size !== incomingKeys.length) return void 0;
|
|
3217
|
+
const removedByKey = new Map(
|
|
3218
|
+
removed.map((instance, offset) => [instance.key, { instance, offset }])
|
|
3219
|
+
);
|
|
3220
|
+
if (incomingKeys.some((key) => removedByKey.has(key))) {
|
|
3221
|
+
const nextWindow = [];
|
|
3222
|
+
const sequence = [];
|
|
3223
|
+
const preparedBindings = [];
|
|
3224
|
+
try {
|
|
3225
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3226
|
+
const index = update.position + offset;
|
|
3227
|
+
const item = incomingItems[offset];
|
|
3228
|
+
const key = incomingKeys[offset];
|
|
3229
|
+
const retained = removedByKey.get(key);
|
|
3230
|
+
if (retained) {
|
|
3231
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(
|
|
3232
|
+
props,
|
|
3233
|
+
retained.instance,
|
|
3234
|
+
item,
|
|
3235
|
+
index
|
|
3236
|
+
);
|
|
3237
|
+
if (!bindingUpdates) return void 0;
|
|
3238
|
+
nextWindow.push(retained.instance);
|
|
3239
|
+
sequence.push(retained.offset);
|
|
3240
|
+
preparedBindings.push(bindingUpdates);
|
|
3241
|
+
continue;
|
|
3242
|
+
}
|
|
3243
|
+
if (instances.has(key)) return void 0;
|
|
3244
|
+
const descriptor = props.create(item, index);
|
|
3245
|
+
nextWindow.push({
|
|
3246
|
+
key,
|
|
3247
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3248
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3249
|
+
item,
|
|
3250
|
+
index,
|
|
3251
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3252
|
+
});
|
|
3253
|
+
sequence.push(-1);
|
|
3254
|
+
preparedBindings.push(void 0);
|
|
3255
|
+
}
|
|
3256
|
+
} catch {
|
|
3257
|
+
return void 0;
|
|
3258
|
+
}
|
|
3259
|
+
for (const instance of removed) {
|
|
3260
|
+
if (incomingKeySet.has(instance.key)) continue;
|
|
3261
|
+
instance.scope?.cleanup();
|
|
3262
|
+
instance.element.remove();
|
|
3263
|
+
}
|
|
3264
|
+
for (let offset = 0; offset < nextWindow.length; offset += 1) {
|
|
3265
|
+
const bindingUpdates = preparedBindings[offset];
|
|
3266
|
+
if (bindingUpdates) {
|
|
3267
|
+
const instance = nextWindow[offset];
|
|
3268
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
3269
|
+
instance.item = incomingItems[offset];
|
|
3270
|
+
instance.index = update.position + offset;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
reorderCompilerKeyedRows(root, nextWindow, sequence, anchor || null);
|
|
3274
|
+
previousInstances.splice(update.position, update.removedCount, ...nextWindow);
|
|
3275
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
const knownKeys = new Set(instances.keys());
|
|
3279
|
+
const incoming = [];
|
|
3280
|
+
try {
|
|
3281
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3282
|
+
const index = update.position + offset;
|
|
3283
|
+
const item = incomingItems[offset];
|
|
3284
|
+
const key = incomingKeys[offset];
|
|
3285
|
+
if (knownKeys.has(key)) return void 0;
|
|
3286
|
+
knownKeys.add(key);
|
|
3287
|
+
const descriptor = props.create(item, index);
|
|
3288
|
+
incoming.push({
|
|
3289
|
+
key,
|
|
3290
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3291
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3292
|
+
item,
|
|
3293
|
+
index,
|
|
3294
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
} catch {
|
|
3298
|
+
return void 0;
|
|
3299
|
+
}
|
|
3300
|
+
for (const instance of removed) {
|
|
3301
|
+
instance.scope?.cleanup();
|
|
3302
|
+
instance.element.remove();
|
|
3303
|
+
}
|
|
3304
|
+
if (incoming.length > 0) {
|
|
3305
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
3306
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
3307
|
+
root.insertBefore(fragment, anchor || null);
|
|
3308
|
+
}
|
|
3309
|
+
previousInstances.splice(update.position, update.removedCount, ...incoming);
|
|
3310
|
+
for (let index = update.position + update.insertedCount; index < previousInstances.length; index += 1) {
|
|
3311
|
+
previousInstances[index].index = index;
|
|
3312
|
+
}
|
|
3313
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3314
|
+
}
|
|
3315
|
+
function reconcileCompilerKeyedArrayPositionWithBatch(...args) {
|
|
3316
|
+
return reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
3317
|
+
}
|
|
3318
|
+
function reconcileCompilerKeyedArrayPositionWithWindow(...args) {
|
|
3319
|
+
return reconcileCompilerKeyedArrayWindowReplace(...args) || reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
3320
|
+
}
|
|
2816
3321
|
function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2817
3322
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
2818
3323
|
return void 0;
|
|
@@ -2828,8 +3333,47 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2828
3333
|
}
|
|
2829
3334
|
const finalValue = props.items();
|
|
2830
3335
|
const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
2831
|
-
if (!update ||
|
|
3336
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2832
3337
|
const previousInstances = [...instances.values()];
|
|
3338
|
+
if (update.kind === "sort") {
|
|
3339
|
+
const instancesByItem = /* @__PURE__ */ new Map();
|
|
3340
|
+
try {
|
|
3341
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
3342
|
+
const instance = previousInstances[sourceIndex];
|
|
3343
|
+
if (instance.index !== sourceIndex || instancesByItem.has(instance.item)) return void 0;
|
|
3344
|
+
instancesByItem.set(instance.item, instance);
|
|
3345
|
+
}
|
|
3346
|
+
const nextInstances = [];
|
|
3347
|
+
const sequence = [];
|
|
3348
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
3349
|
+
const item = finalValue[targetIndex];
|
|
3350
|
+
const instance = instancesByItem.get(item);
|
|
3351
|
+
if (!instance || !Object.is(instance.item, item)) return void 0;
|
|
3352
|
+
instancesByItem.delete(item);
|
|
3353
|
+
nextInstances.push(instance);
|
|
3354
|
+
sequence.push(instance.index);
|
|
3355
|
+
}
|
|
3356
|
+
if (instancesByItem.size > 0) return void 0;
|
|
3357
|
+
const activeElement2 = root.ownerDocument.activeElement;
|
|
3358
|
+
const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
|
|
3359
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
3360
|
+
let anchor2 = null;
|
|
3361
|
+
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
3362
|
+
const instance = nextInstances[index];
|
|
3363
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
|
|
3364
|
+
root.insertBefore(instance.element, anchor2);
|
|
3365
|
+
}
|
|
3366
|
+
anchor2 = instance.element;
|
|
3367
|
+
instance.index = index;
|
|
3368
|
+
}
|
|
3369
|
+
if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
|
|
3370
|
+
activeElement2.focus({ preventScroll: true });
|
|
3371
|
+
}
|
|
3372
|
+
return new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
3373
|
+
} catch {
|
|
3374
|
+
return void 0;
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
2833
3377
|
try {
|
|
2834
3378
|
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2835
3379
|
const instance = previousInstances[sourceIndex];
|
|
@@ -3753,8 +4297,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3753
4297
|
}
|
|
3754
4298
|
if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
|
|
3755
4299
|
if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
|
|
3756
|
-
const activeElement = this.root.ownerDocument.activeElement;
|
|
3757
|
-
const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
|
|
3758
4300
|
const nextKeys = new Set(rows.keys);
|
|
3759
4301
|
const hasSurvivingRows = rows.keys.some((key) => this.instances.has(key));
|
|
3760
4302
|
const oldIndices = /* @__PURE__ */ new Map();
|
|
@@ -3768,7 +4310,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3768
4310
|
}
|
|
3769
4311
|
}
|
|
3770
4312
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : rows.keys.map(() => -1);
|
|
3771
|
-
const stablePositions = hasSurvivingRows ? longestIncreasingSubsequencePositions(sequence) : /* @__PURE__ */ new Set();
|
|
3772
4313
|
const nextInstances = [];
|
|
3773
4314
|
const conditionalChanges = [];
|
|
3774
4315
|
for (let index = 0; index < rows.items.length; index += 1) {
|
|
@@ -3833,34 +4374,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3833
4374
|
for (const instance of nextInstances) fragment.append(instance.element);
|
|
3834
4375
|
this.root.replaceChildren(fragment);
|
|
3835
4376
|
} else {
|
|
3836
|
-
|
|
3837
|
-
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
3838
|
-
const instance = nextInstances[index];
|
|
3839
|
-
if (sequence[index] < 0) {
|
|
3840
|
-
let start = index;
|
|
3841
|
-
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
3842
|
-
const fragment = this.root.ownerDocument.createDocumentFragment();
|
|
3843
|
-
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
3844
|
-
fragment.append(nextInstances[itemIndex].element);
|
|
3845
|
-
}
|
|
3846
|
-
this.root.insertBefore(fragment, anchor);
|
|
3847
|
-
anchor = nextInstances[start].element;
|
|
3848
|
-
index = start;
|
|
3849
|
-
} else {
|
|
3850
|
-
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
3851
|
-
this.root.insertBefore(instance.element, anchor);
|
|
3852
|
-
}
|
|
3853
|
-
anchor = instance.element;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
4377
|
+
reorderCompilerKeyedRows(this.root, nextInstances, sequence, null);
|
|
3856
4378
|
}
|
|
3857
4379
|
this.instances = new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
3858
4380
|
this.rebuildElementIndex(this.instances);
|
|
3859
4381
|
this.pruneEventHandlers(rows.keys);
|
|
3860
4382
|
this.pruneConditionalListeners(rows.keys);
|
|
3861
|
-
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
3862
|
-
activeElement.focus({ preventScroll: true });
|
|
3863
|
-
}
|
|
3864
4383
|
this.commitCurrentCollection(dirtyState);
|
|
3865
4384
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
3866
4385
|
}
|
|
@@ -4350,6 +4869,22 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
4350
4869
|
})
|
|
4351
4870
|
})
|
|
4352
4871
|
};
|
|
4872
|
+
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
4873
|
+
name: "keyed-rows:batch-position-hinted",
|
|
4874
|
+
create: (owner) => ({
|
|
4875
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4876
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
4877
|
+
})
|
|
4878
|
+
})
|
|
4879
|
+
};
|
|
4880
|
+
var keyedRowsWindowPositionHintedRuntimeFeature = {
|
|
4881
|
+
name: "keyed-rows:window-position-hinted",
|
|
4882
|
+
create: (owner) => ({
|
|
4883
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4884
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
4885
|
+
})
|
|
4886
|
+
})
|
|
4887
|
+
};
|
|
4353
4888
|
var keyedRowsReorderHintedRuntimeFeature = {
|
|
4354
4889
|
name: "keyed-rows:reorder-hinted",
|
|
4355
4890
|
create: (owner) => ({
|
|
@@ -4374,6 +4909,22 @@ var keyedRowsEveryHintedRuntimeFeature = {
|
|
|
4374
4909
|
})
|
|
4375
4910
|
})
|
|
4376
4911
|
};
|
|
4912
|
+
var keyedRowsBatchEveryHintedRuntimeFeature = {
|
|
4913
|
+
name: "keyed-rows:batch-every-hinted",
|
|
4914
|
+
create: (owner) => ({
|
|
4915
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4916
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
4917
|
+
})
|
|
4918
|
+
})
|
|
4919
|
+
};
|
|
4920
|
+
var keyedRowsWindowEveryHintedRuntimeFeature = {
|
|
4921
|
+
name: "keyed-rows:window-every-hinted",
|
|
4922
|
+
create: (owner) => ({
|
|
4923
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4924
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
4925
|
+
})
|
|
4926
|
+
})
|
|
4927
|
+
};
|
|
4377
4928
|
var keyedRowsFilterHintedRuntimeFeature = {
|
|
4378
4929
|
name: "keyed-rows:filter-hinted",
|
|
4379
4930
|
create: (owner) => ({
|
|
@@ -4424,6 +4975,24 @@ var keyedRowsConditionalPositionHintedRuntimeFeature = {
|
|
|
4424
4975
|
})
|
|
4425
4976
|
})
|
|
4426
4977
|
};
|
|
4978
|
+
var keyedRowsConditionalBatchPositionHintedRuntimeFeature = {
|
|
4979
|
+
name: "keyed-rows:conditional:batch-position-hinted",
|
|
4980
|
+
create: (owner) => ({
|
|
4981
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4982
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4983
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
4984
|
+
})
|
|
4985
|
+
})
|
|
4986
|
+
};
|
|
4987
|
+
var keyedRowsConditionalWindowPositionHintedRuntimeFeature = {
|
|
4988
|
+
name: "keyed-rows:conditional:window-position-hinted",
|
|
4989
|
+
create: (owner) => ({
|
|
4990
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4991
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4992
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
4993
|
+
})
|
|
4994
|
+
})
|
|
4995
|
+
};
|
|
4427
4996
|
var keyedRowsConditionalReorderHintedRuntimeFeature = {
|
|
4428
4997
|
name: "keyed-rows:conditional:reorder-hinted",
|
|
4429
4998
|
create: (owner) => ({
|
|
@@ -4451,6 +5020,24 @@ var keyedRowsConditionalEveryHintedRuntimeFeature = {
|
|
|
4451
5020
|
})
|
|
4452
5021
|
})
|
|
4453
5022
|
};
|
|
5023
|
+
var keyedRowsConditionalBatchEveryHintedRuntimeFeature = {
|
|
5024
|
+
name: "keyed-rows:conditional:batch-every-hinted",
|
|
5025
|
+
create: (owner) => ({
|
|
5026
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5027
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5028
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5029
|
+
})
|
|
5030
|
+
})
|
|
5031
|
+
};
|
|
5032
|
+
var keyedRowsConditionalWindowEveryHintedRuntimeFeature = {
|
|
5033
|
+
name: "keyed-rows:conditional:window-every-hinted",
|
|
5034
|
+
create: (owner) => ({
|
|
5035
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5036
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5037
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5038
|
+
})
|
|
5039
|
+
})
|
|
5040
|
+
};
|
|
4454
5041
|
var keyedRowsConditionalFilterHintedRuntimeFeature = {
|
|
4455
5042
|
name: "keyed-rows:conditional:filter-hinted",
|
|
4456
5043
|
create: (owner) => ({
|
|
@@ -4504,6 +5091,24 @@ var keyedRowsHostPositionHintedRuntimeFeature = {
|
|
|
4504
5091
|
})
|
|
4505
5092
|
})
|
|
4506
5093
|
};
|
|
5094
|
+
var keyedRowsHostBatchPositionHintedRuntimeFeature = {
|
|
5095
|
+
name: "keyed-rows:host:batch-position-hinted",
|
|
5096
|
+
create: (owner) => ({
|
|
5097
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5098
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5099
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
5100
|
+
})
|
|
5101
|
+
})
|
|
5102
|
+
};
|
|
5103
|
+
var keyedRowsHostWindowPositionHintedRuntimeFeature = {
|
|
5104
|
+
name: "keyed-rows:host:window-position-hinted",
|
|
5105
|
+
create: (owner) => ({
|
|
5106
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5107
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5108
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
5109
|
+
})
|
|
5110
|
+
})
|
|
5111
|
+
};
|
|
4507
5112
|
var keyedRowsHostReorderHintedRuntimeFeature = {
|
|
4508
5113
|
name: "keyed-rows:host:reorder-hinted",
|
|
4509
5114
|
create: (owner) => ({
|
|
@@ -4531,6 +5136,24 @@ var keyedRowsHostEveryHintedRuntimeFeature = {
|
|
|
4531
5136
|
})
|
|
4532
5137
|
})
|
|
4533
5138
|
};
|
|
5139
|
+
var keyedRowsHostBatchEveryHintedRuntimeFeature = {
|
|
5140
|
+
name: "keyed-rows:host:batch-every-hinted",
|
|
5141
|
+
create: (owner) => ({
|
|
5142
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5143
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5144
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5145
|
+
})
|
|
5146
|
+
})
|
|
5147
|
+
};
|
|
5148
|
+
var keyedRowsHostWindowEveryHintedRuntimeFeature = {
|
|
5149
|
+
name: "keyed-rows:host:window-every-hinted",
|
|
5150
|
+
create: (owner) => ({
|
|
5151
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5152
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5153
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5154
|
+
})
|
|
5155
|
+
})
|
|
5156
|
+
};
|
|
4534
5157
|
var keyedRowsHostFilterHintedRuntimeFeature = {
|
|
4535
5158
|
name: "keyed-rows:host:filter-hinted",
|
|
4536
5159
|
create: (owner) => ({
|
|
@@ -4587,6 +5210,26 @@ var keyedRowsCompletePositionHintedRuntimeFeature = {
|
|
|
4587
5210
|
})
|
|
4588
5211
|
})
|
|
4589
5212
|
};
|
|
5213
|
+
var keyedRowsCompleteBatchPositionHintedRuntimeFeature = {
|
|
5214
|
+
name: "keyed-rows:complete:batch-position-hinted",
|
|
5215
|
+
create: (owner) => ({
|
|
5216
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5217
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5218
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5219
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
5220
|
+
})
|
|
5221
|
+
})
|
|
5222
|
+
};
|
|
5223
|
+
var keyedRowsCompleteWindowPositionHintedRuntimeFeature = {
|
|
5224
|
+
name: "keyed-rows:complete:window-position-hinted",
|
|
5225
|
+
create: (owner) => ({
|
|
5226
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5227
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5228
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5229
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
5230
|
+
})
|
|
5231
|
+
})
|
|
5232
|
+
};
|
|
4590
5233
|
var keyedRowsCompleteReorderHintedRuntimeFeature = {
|
|
4591
5234
|
name: "keyed-rows:complete:reorder-hinted",
|
|
4592
5235
|
create: (owner) => ({
|
|
@@ -4617,6 +5260,26 @@ var keyedRowsCompleteEveryHintedRuntimeFeature = {
|
|
|
4617
5260
|
})
|
|
4618
5261
|
})
|
|
4619
5262
|
};
|
|
5263
|
+
var keyedRowsCompleteBatchEveryHintedRuntimeFeature = {
|
|
5264
|
+
name: "keyed-rows:complete:batch-every-hinted",
|
|
5265
|
+
create: (owner) => ({
|
|
5266
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5267
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5268
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5269
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5270
|
+
})
|
|
5271
|
+
})
|
|
5272
|
+
};
|
|
5273
|
+
var keyedRowsCompleteWindowEveryHintedRuntimeFeature = {
|
|
5274
|
+
name: "keyed-rows:complete:window-every-hinted",
|
|
5275
|
+
create: (owner) => ({
|
|
5276
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5277
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5278
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5279
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5280
|
+
})
|
|
5281
|
+
})
|
|
5282
|
+
};
|
|
4620
5283
|
var keyedRowsCompleteFilterHintedRuntimeFeature = {
|
|
4621
5284
|
name: "keyed-rows:complete:filter-hinted",
|
|
4622
5285
|
create: (owner) => ({
|
|
@@ -5119,7 +5782,7 @@ var COMPLETE_RUNTIME_FEATURES = [
|
|
|
5119
5782
|
hostConditionalRuntimeFeature,
|
|
5120
5783
|
conditionalRangesRuntimeFeature,
|
|
5121
5784
|
keyedListRuntimeFeature,
|
|
5122
|
-
|
|
5785
|
+
keyedRowsCompleteWindowEveryHintedRuntimeFeature,
|
|
5123
5786
|
keyedRangesRuntimeFeature,
|
|
5124
5787
|
mixedRangesRuntimeFeature,
|
|
5125
5788
|
componentRuntimeFeature
|
|
@@ -5128,6 +5791,6 @@ function createCompiledComponent(definition) {
|
|
|
5128
5791
|
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
5129
5792
|
}
|
|
5130
5793
|
|
|
5131
|
-
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, 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 };
|
|
5794
|
+
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayBatchInsert, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedArrayWindowReplace, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsBatchEveryHintedRuntimeFeature, keyedRowsBatchPositionHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteBatchEveryHintedRuntimeFeature, keyedRowsCompleteBatchPositionHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsCompleteWindowEveryHintedRuntimeFeature, keyedRowsCompleteWindowPositionHintedRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalBatchEveryHintedRuntimeFeature, keyedRowsConditionalBatchPositionHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsConditionalWindowEveryHintedRuntimeFeature, keyedRowsConditionalWindowPositionHintedRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostBatchEveryHintedRuntimeFeature, keyedRowsHostBatchPositionHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsHostWindowEveryHintedRuntimeFeature, keyedRowsHostWindowPositionHintedRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, keyedRowsWindowEveryHintedRuntimeFeature, keyedRowsWindowPositionHintedRuntimeFeature, mixedRangesRuntimeFeature };
|
|
5132
5795
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
5133
5796
|
//# sourceMappingURL=compiler-runtime.mjs.map
|