@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
|
@@ -32,6 +32,8 @@ var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
|
|
|
32
32
|
var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
|
|
33
33
|
var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
|
|
34
34
|
var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
var COMPILER_KEYED_ARRAY_BATCH_INSERTS = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
var COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS = /* @__PURE__ */ new WeakMap();
|
|
35
37
|
var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
|
|
36
38
|
var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
37
39
|
var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
@@ -43,6 +45,7 @@ var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
|
43
45
|
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
44
46
|
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
45
47
|
var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
|
|
48
|
+
var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
|
|
46
49
|
var NATIVE_REFLECT_APPLY = Reflect.apply;
|
|
47
50
|
function compilerObject(value) {
|
|
48
51
|
return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
|
|
@@ -163,11 +166,40 @@ function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
|
|
|
163
166
|
const target = compilerObject(value);
|
|
164
167
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
165
168
|
const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
|
|
166
|
-
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)) {
|
|
169
|
+
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)) {
|
|
167
170
|
return void 0;
|
|
168
171
|
}
|
|
169
172
|
return update;
|
|
170
173
|
}
|
|
174
|
+
function compilerKeyedArrayBatchInsert(value, sourceToken, expectedLength) {
|
|
175
|
+
const target = compilerObject(value);
|
|
176
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
177
|
+
const update = COMPILER_KEYED_ARRAY_BATCH_INSERTS.get(target);
|
|
178
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.resultLength < expectedLength + 2 || update.position < 0 || update.position > expectedLength) {
|
|
179
|
+
return void 0;
|
|
180
|
+
}
|
|
181
|
+
return update;
|
|
182
|
+
}
|
|
183
|
+
function compilerKeyedArrayWindowReplacements(value, sourceToken, expectedLength) {
|
|
184
|
+
const target = compilerObject(value);
|
|
185
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
186
|
+
const update = COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(target);
|
|
187
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
188
|
+
const updates = [];
|
|
189
|
+
for (let current = update; current; current = current.previous) {
|
|
190
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
191
|
+
updates.push(current);
|
|
192
|
+
}
|
|
193
|
+
updates.reverse();
|
|
194
|
+
let length = expectedLength;
|
|
195
|
+
for (const current of updates) {
|
|
196
|
+
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) {
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
length = current.resultLength;
|
|
200
|
+
}
|
|
201
|
+
return length === value.length ? updates : void 0;
|
|
202
|
+
}
|
|
171
203
|
function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
|
|
172
204
|
const target = compilerObject(value);
|
|
173
205
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
@@ -379,9 +411,12 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
379
411
|
}
|
|
380
412
|
const sourceLength = previous.length;
|
|
381
413
|
const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
|
|
414
|
+
const deleteCount = args[0];
|
|
415
|
+
const removedCount = sourceLength - value.length;
|
|
382
416
|
const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
|
|
383
|
-
const
|
|
384
|
-
|
|
417
|
+
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);
|
|
418
|
+
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);
|
|
419
|
+
if (!validInsert && !validRemove && !validReplace) return value;
|
|
385
420
|
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
386
421
|
if (!sourceToken) return value;
|
|
387
422
|
COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
|
|
@@ -395,6 +430,71 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
395
430
|
}
|
|
396
431
|
return value;
|
|
397
432
|
}
|
|
433
|
+
function createCompilerKeyedArrayBatchInsert(previous, method, position, ...items) {
|
|
434
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
435
|
+
method,
|
|
436
|
+
previous,
|
|
437
|
+
[position, 0, ...items]
|
|
438
|
+
);
|
|
439
|
+
try {
|
|
440
|
+
const previousTarget = compilerObject(previous);
|
|
441
|
+
const valueTarget = compilerObject(value);
|
|
442
|
+
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) {
|
|
443
|
+
return value;
|
|
444
|
+
}
|
|
445
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
446
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
447
|
+
}
|
|
448
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
449
|
+
if (!sourceToken) return value;
|
|
450
|
+
COMPILER_KEYED_ARRAY_BATCH_INSERTS.set(valueTarget, {
|
|
451
|
+
sourceToken,
|
|
452
|
+
sourceLength: previous.length,
|
|
453
|
+
resultLength: value.length,
|
|
454
|
+
position: position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length)
|
|
455
|
+
});
|
|
456
|
+
} catch {
|
|
457
|
+
}
|
|
458
|
+
return value;
|
|
459
|
+
}
|
|
460
|
+
function createCompilerKeyedArrayWindowReplace(previous, method, position, deleteCount, ...items) {
|
|
461
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
462
|
+
method,
|
|
463
|
+
previous,
|
|
464
|
+
[position, deleteCount, ...items]
|
|
465
|
+
);
|
|
466
|
+
try {
|
|
467
|
+
const previousTarget = compilerObject(previous);
|
|
468
|
+
const valueTarget = compilerObject(value);
|
|
469
|
+
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) {
|
|
470
|
+
return value;
|
|
471
|
+
}
|
|
472
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
473
|
+
if (!Object.prototype.hasOwnProperty.call(previous, index)) return value;
|
|
474
|
+
}
|
|
475
|
+
const normalizedPosition = position < 0 ? Math.max(previous.length + position, 0) : Math.min(position, previous.length);
|
|
476
|
+
const removedCount = Math.min(deleteCount, previous.length - normalizedPosition);
|
|
477
|
+
if (removedCount < 1 || value.length !== previous.length - removedCount + items.length) {
|
|
478
|
+
return value;
|
|
479
|
+
}
|
|
480
|
+
const committedSource = COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget);
|
|
481
|
+
const previousUpdate = committedSource ? void 0 : COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.get(previousTarget);
|
|
482
|
+
if (!committedSource && !previousUpdate) return value;
|
|
483
|
+
const sourceToken = previousUpdate?.sourceToken || compilerKeyedCollectionToken(previousTarget);
|
|
484
|
+
if (!sourceToken) return value;
|
|
485
|
+
COMPILER_KEYED_ARRAY_WINDOW_REPLACEMENTS.set(valueTarget, {
|
|
486
|
+
sourceToken,
|
|
487
|
+
sourceLength: previous.length,
|
|
488
|
+
resultLength: value.length,
|
|
489
|
+
position: normalizedPosition,
|
|
490
|
+
removedCount,
|
|
491
|
+
insertedCount: items.length,
|
|
492
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
493
|
+
});
|
|
494
|
+
} catch {
|
|
495
|
+
}
|
|
496
|
+
return value;
|
|
497
|
+
}
|
|
398
498
|
function createCompilerKeyedArrayReorder(previous, method) {
|
|
399
499
|
const value = NATIVE_REFLECT_APPLY(
|
|
400
500
|
method,
|
|
@@ -419,6 +519,33 @@ function createCompilerKeyedArrayReorder(previous, method) {
|
|
|
419
519
|
}
|
|
420
520
|
return value;
|
|
421
521
|
}
|
|
522
|
+
function createCompilerKeyedArraySort(previous, method, ...args) {
|
|
523
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
524
|
+
method,
|
|
525
|
+
previous,
|
|
526
|
+
args
|
|
527
|
+
);
|
|
528
|
+
try {
|
|
529
|
+
const previousTarget = compilerObject(previous);
|
|
530
|
+
const valueTarget = compilerObject(value);
|
|
531
|
+
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) {
|
|
532
|
+
return value;
|
|
533
|
+
}
|
|
534
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
535
|
+
if (!(index in previous)) return value;
|
|
536
|
+
}
|
|
537
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
538
|
+
if (!sourceToken) return value;
|
|
539
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
540
|
+
kind: "sort",
|
|
541
|
+
sourceToken,
|
|
542
|
+
sourceLength: previous.length,
|
|
543
|
+
resultLength: value.length
|
|
544
|
+
});
|
|
545
|
+
} catch {
|
|
546
|
+
}
|
|
547
|
+
return value;
|
|
548
|
+
}
|
|
422
549
|
function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
|
|
423
550
|
const args = operation === "map-set" ? [key, value] : [key];
|
|
424
551
|
const result = NATIVE_REFLECT_APPLY(method, collection, args);
|
|
@@ -1103,6 +1230,32 @@ function applyKeyedRowBinding(props, instance, item, index, bindingIndex) {
|
|
|
1103
1230
|
updateAttribute(target, binding.name, rawValue);
|
|
1104
1231
|
}
|
|
1105
1232
|
}
|
|
1233
|
+
function prepareKeyedRowBindingUpdates(props, instance, item, index) {
|
|
1234
|
+
const updates = [];
|
|
1235
|
+
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
1236
|
+
const binding = props.bindings[bindingIndex];
|
|
1237
|
+
const rawValue = binding.read(item, index);
|
|
1238
|
+
const value = normalizedKeyedRowBindingValue(binding, rawValue);
|
|
1239
|
+
if (Object.is(instance.values[bindingIndex], value)) continue;
|
|
1240
|
+
const target = findCompilerHostTarget(instance.element, binding.path);
|
|
1241
|
+
if (!target || binding.kind !== "text" && !binding.name) return void 0;
|
|
1242
|
+
updates.push([bindingIndex, rawValue, target, value]);
|
|
1243
|
+
}
|
|
1244
|
+
return updates;
|
|
1245
|
+
}
|
|
1246
|
+
function applyPreparedKeyedRowBindingUpdates(props, instance, updates) {
|
|
1247
|
+
for (const [bindingIndex, rawValue, target, value] of updates) {
|
|
1248
|
+
const binding = props.bindings[bindingIndex];
|
|
1249
|
+
instance.values[bindingIndex] = value;
|
|
1250
|
+
if (binding.kind === "text") {
|
|
1251
|
+
target.textContent = value;
|
|
1252
|
+
} else if (binding.kind === "style") {
|
|
1253
|
+
updateStyle(target, binding.name, rawValue);
|
|
1254
|
+
} else {
|
|
1255
|
+
updateAttribute(target, binding.name, rawValue);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1106
1259
|
function keyedRowConditionalSnapshot(conditional, item, index) {
|
|
1107
1260
|
const test = conditional.test(item, index);
|
|
1108
1261
|
if (conditional.logical && !test) {
|
|
@@ -2545,6 +2698,33 @@ function longestIncreasingSubsequencePositions(sequence) {
|
|
|
2545
2698
|
}
|
|
2546
2699
|
return positions;
|
|
2547
2700
|
}
|
|
2701
|
+
function reorderCompilerKeyedRows(root, instances, sequence, anchor) {
|
|
2702
|
+
const activeElement = root.ownerDocument.activeElement;
|
|
2703
|
+
const restoreFocus = Boolean(activeElement && root.contains(activeElement));
|
|
2704
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
2705
|
+
for (let index = instances.length - 1; index >= 0; index -= 1) {
|
|
2706
|
+
const instance = instances[index];
|
|
2707
|
+
if (sequence[index] < 0) {
|
|
2708
|
+
let start = index;
|
|
2709
|
+
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
2710
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2711
|
+
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
2712
|
+
fragment.append(instances[itemIndex].element);
|
|
2713
|
+
}
|
|
2714
|
+
root.insertBefore(fragment, anchor);
|
|
2715
|
+
anchor = instances[start].element;
|
|
2716
|
+
index = start;
|
|
2717
|
+
} else {
|
|
2718
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
2719
|
+
root.insertBefore(instance.element, anchor);
|
|
2720
|
+
}
|
|
2721
|
+
anchor = instance.element;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
2725
|
+
activeElement.focus({ preventScroll: true });
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2548
2728
|
var keyedUpdateRuntime = {
|
|
2549
2729
|
append: reconcileCompilerKeyedArrayAppend,
|
|
2550
2730
|
commit: commitCompilerKeyedCollection,
|
|
@@ -2566,6 +2746,14 @@ var keyedPositionUpdateRuntime = {
|
|
|
2566
2746
|
...keyedUpdateRuntime,
|
|
2567
2747
|
position: reconcileCompilerKeyedArrayPosition
|
|
2568
2748
|
};
|
|
2749
|
+
var keyedBatchPositionUpdateRuntime = {
|
|
2750
|
+
...keyedUpdateRuntime,
|
|
2751
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
2752
|
+
};
|
|
2753
|
+
var keyedWindowPositionUpdateRuntime = {
|
|
2754
|
+
...keyedUpdateRuntime,
|
|
2755
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
2756
|
+
};
|
|
2569
2757
|
var keyedReorderUpdateRuntime = {
|
|
2570
2758
|
...keyedUpdateRuntime,
|
|
2571
2759
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
@@ -2579,6 +2767,14 @@ var keyedEveryUpdateRuntime = {
|
|
|
2579
2767
|
position: reconcileCompilerKeyedArrayPosition,
|
|
2580
2768
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
2581
2769
|
};
|
|
2770
|
+
var keyedBatchEveryUpdateRuntime = {
|
|
2771
|
+
...keyedEveryUpdateRuntime,
|
|
2772
|
+
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
2773
|
+
};
|
|
2774
|
+
var keyedWindowEveryUpdateRuntime = {
|
|
2775
|
+
...keyedEveryUpdateRuntime,
|
|
2776
|
+
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
2777
|
+
};
|
|
2582
2778
|
function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
|
|
2583
2779
|
const dependency = props.collectionDependency;
|
|
2584
2780
|
if (dependency === void 0) return void 0;
|
|
@@ -2758,6 +2954,22 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2758
2954
|
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2759
2955
|
const previousInstances = [...instances.values()];
|
|
2760
2956
|
const previous = previousInstances[update.position];
|
|
2957
|
+
if (update.kind === "remove") {
|
|
2958
|
+
const count = update.sourceLength - update.resultLength;
|
|
2959
|
+
const removed = previousInstances.slice(update.position, update.position + count);
|
|
2960
|
+
if (removed.some((instance, index) => instance.index !== update.position + index)) {
|
|
2961
|
+
return void 0;
|
|
2962
|
+
}
|
|
2963
|
+
for (const instance of removed) {
|
|
2964
|
+
instance.scope?.cleanup();
|
|
2965
|
+
instance.element.remove();
|
|
2966
|
+
}
|
|
2967
|
+
previousInstances.splice(update.position, count);
|
|
2968
|
+
for (let index = update.position; index < previousInstances.length; index += 1) {
|
|
2969
|
+
previousInstances[index].index = index;
|
|
2970
|
+
}
|
|
2971
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2972
|
+
}
|
|
2761
2973
|
let item;
|
|
2762
2974
|
let key;
|
|
2763
2975
|
try {
|
|
@@ -2819,6 +3031,299 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2819
3031
|
previousInstances[update.position] = replacement;
|
|
2820
3032
|
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2821
3033
|
}
|
|
3034
|
+
function reconcileCompilerKeyedArrayBatchInsert(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
3035
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
3036
|
+
return void 0;
|
|
3037
|
+
}
|
|
3038
|
+
const collectionDependency = props.collectionDependency;
|
|
3039
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
3040
|
+
return void 0;
|
|
3041
|
+
}
|
|
3042
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
3043
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
3044
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
3045
|
+
return void 0;
|
|
3046
|
+
}
|
|
3047
|
+
const finalValue = props.items();
|
|
3048
|
+
const update = compilerKeyedArrayBatchInsert(finalValue, collectionToken, instances.size);
|
|
3049
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
3050
|
+
const previousInstances = [...instances.values()];
|
|
3051
|
+
const insertCount = update.resultLength - update.sourceLength;
|
|
3052
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
3053
|
+
const instance = previousInstances[sourceIndex];
|
|
3054
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex + insertCount;
|
|
3055
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[resultIndex])) {
|
|
3056
|
+
return void 0;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
const knownKeys = new Set(instances.keys());
|
|
3060
|
+
const incoming = [];
|
|
3061
|
+
try {
|
|
3062
|
+
for (let offset = 0; offset < insertCount; offset += 1) {
|
|
3063
|
+
const index = update.position + offset;
|
|
3064
|
+
const item = finalValue[index];
|
|
3065
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3066
|
+
if (knownKeys.has(key)) return void 0;
|
|
3067
|
+
knownKeys.add(key);
|
|
3068
|
+
const descriptor = props.create(item, index);
|
|
3069
|
+
incoming.push({
|
|
3070
|
+
key,
|
|
3071
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3072
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3073
|
+
item,
|
|
3074
|
+
index,
|
|
3075
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
} catch {
|
|
3079
|
+
return void 0;
|
|
3080
|
+
}
|
|
3081
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
3082
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
3083
|
+
root.insertBefore(fragment, previousInstances[update.position]?.element || null);
|
|
3084
|
+
previousInstances.splice(update.position, 0, ...incoming);
|
|
3085
|
+
for (let index = update.position + insertCount; index < previousInstances.length; index += 1) {
|
|
3086
|
+
previousInstances[index].index = index;
|
|
3087
|
+
}
|
|
3088
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3089
|
+
}
|
|
3090
|
+
function reconcileCompilerKeyedArrayWindowReplace(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
3091
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
3092
|
+
return void 0;
|
|
3093
|
+
}
|
|
3094
|
+
const collectionDependency = props.collectionDependency;
|
|
3095
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
3096
|
+
return void 0;
|
|
3097
|
+
}
|
|
3098
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
3099
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
3100
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
3101
|
+
return void 0;
|
|
3102
|
+
}
|
|
3103
|
+
const finalValue = props.items();
|
|
3104
|
+
const updates = compilerKeyedArrayWindowReplacements(finalValue, collectionToken, instances.size);
|
|
3105
|
+
if (!updates || !Array.isArray(finalValue)) return void 0;
|
|
3106
|
+
const previousInstances = [...instances.values()];
|
|
3107
|
+
if (updates.length > 1) {
|
|
3108
|
+
const touchedIndices = /* @__PURE__ */ new Set();
|
|
3109
|
+
for (const update2 of updates) {
|
|
3110
|
+
if (update2.insertedCount !== update2.removedCount) return void 0;
|
|
3111
|
+
for (let index = update2.position; index < update2.position + update2.removedCount; index += 1) {
|
|
3112
|
+
touchedIndices.add(index);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
3116
|
+
const instance = previousInstances[index];
|
|
3117
|
+
const touched = touchedIndices.has(index);
|
|
3118
|
+
if (!instance || instance.index !== index || (touched ? instance.element.parentNode !== root : !Object.is(instance.item, finalValue[index]))) {
|
|
3119
|
+
return void 0;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
const knownKeys2 = new Set(instances.keys());
|
|
3123
|
+
const incomingKeys2 = /* @__PURE__ */ new Set();
|
|
3124
|
+
let replacesRows = false;
|
|
3125
|
+
const prepared = [];
|
|
3126
|
+
try {
|
|
3127
|
+
for (const index of [...touchedIndices].sort((left, right) => left - right)) {
|
|
3128
|
+
const instance = previousInstances[index];
|
|
3129
|
+
const item = finalValue[index];
|
|
3130
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3131
|
+
if (key !== instance.key) {
|
|
3132
|
+
if (knownKeys2.has(key) || incomingKeys2.has(key)) return void 0;
|
|
3133
|
+
incomingKeys2.add(key);
|
|
3134
|
+
replacesRows = true;
|
|
3135
|
+
const descriptor = props.create(item, index);
|
|
3136
|
+
prepared.push([
|
|
3137
|
+
index,
|
|
3138
|
+
instance,
|
|
3139
|
+
item,
|
|
3140
|
+
void 0,
|
|
3141
|
+
{
|
|
3142
|
+
key,
|
|
3143
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3144
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3145
|
+
item,
|
|
3146
|
+
index,
|
|
3147
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3148
|
+
}
|
|
3149
|
+
]);
|
|
3150
|
+
continue;
|
|
3151
|
+
}
|
|
3152
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(props, instance, item, index);
|
|
3153
|
+
if (!bindingUpdates) return void 0;
|
|
3154
|
+
prepared.push([index, instance, item, bindingUpdates, void 0]);
|
|
3155
|
+
}
|
|
3156
|
+
} catch {
|
|
3157
|
+
return void 0;
|
|
3158
|
+
}
|
|
3159
|
+
for (const [index, instance, item, bindingUpdates, replacement] of prepared) {
|
|
3160
|
+
if (replacement) {
|
|
3161
|
+
instance.scope?.cleanup();
|
|
3162
|
+
instance.element.replaceWith(replacement.element);
|
|
3163
|
+
previousInstances[index] = replacement;
|
|
3164
|
+
} else {
|
|
3165
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
3166
|
+
instance.item = item;
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
return replacesRows ? new Map(previousInstances.map((instance) => [instance.key, instance])) : instances;
|
|
3170
|
+
}
|
|
3171
|
+
const update = updates[0];
|
|
3172
|
+
const removedEnd = update.position + update.removedCount;
|
|
3173
|
+
for (let sourceIndex = 0; sourceIndex < update.sourceLength; sourceIndex += 1) {
|
|
3174
|
+
const instance = previousInstances[sourceIndex];
|
|
3175
|
+
if (!instance || instance.index !== sourceIndex) return void 0;
|
|
3176
|
+
if (sourceIndex >= update.position && sourceIndex < removedEnd) continue;
|
|
3177
|
+
const resultIndex = sourceIndex < update.position ? sourceIndex : sourceIndex - update.removedCount + update.insertedCount;
|
|
3178
|
+
if (!Object.is(instance.item, finalValue[resultIndex])) return void 0;
|
|
3179
|
+
}
|
|
3180
|
+
const removed = previousInstances.slice(update.position, removedEnd);
|
|
3181
|
+
const anchor = previousInstances[removedEnd]?.element;
|
|
3182
|
+
if (removed.length !== update.removedCount || removed.some((instance) => instance.element.parentNode !== root) || anchor && anchor.parentNode !== root) {
|
|
3183
|
+
return void 0;
|
|
3184
|
+
}
|
|
3185
|
+
const incomingItems = [];
|
|
3186
|
+
const incomingKeys = [];
|
|
3187
|
+
try {
|
|
3188
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3189
|
+
const index = update.position + offset;
|
|
3190
|
+
const item = finalValue[index];
|
|
3191
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
3192
|
+
incomingItems.push(item);
|
|
3193
|
+
incomingKeys.push(key);
|
|
3194
|
+
}
|
|
3195
|
+
} catch {
|
|
3196
|
+
return void 0;
|
|
3197
|
+
}
|
|
3198
|
+
if (update.insertedCount === update.removedCount && incomingKeys.every((key, offset) => key === removed[offset].key)) {
|
|
3199
|
+
const prepared = [];
|
|
3200
|
+
try {
|
|
3201
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3202
|
+
const updates2 = prepareKeyedRowBindingUpdates(
|
|
3203
|
+
props,
|
|
3204
|
+
removed[offset],
|
|
3205
|
+
incomingItems[offset],
|
|
3206
|
+
update.position + offset
|
|
3207
|
+
);
|
|
3208
|
+
if (!updates2) return void 0;
|
|
3209
|
+
prepared.push(updates2);
|
|
3210
|
+
}
|
|
3211
|
+
} catch {
|
|
3212
|
+
return void 0;
|
|
3213
|
+
}
|
|
3214
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3215
|
+
applyPreparedKeyedRowBindingUpdates(props, removed[offset], prepared[offset]);
|
|
3216
|
+
removed[offset].item = incomingItems[offset];
|
|
3217
|
+
}
|
|
3218
|
+
return instances;
|
|
3219
|
+
}
|
|
3220
|
+
if (update.insertedCount === update.removedCount) {
|
|
3221
|
+
const incomingKeySet = new Set(incomingKeys);
|
|
3222
|
+
if (incomingKeySet.size !== incomingKeys.length) return void 0;
|
|
3223
|
+
const removedByKey = new Map(
|
|
3224
|
+
removed.map((instance, offset) => [instance.key, { instance, offset }])
|
|
3225
|
+
);
|
|
3226
|
+
if (incomingKeys.some((key) => removedByKey.has(key))) {
|
|
3227
|
+
const nextWindow = [];
|
|
3228
|
+
const sequence = [];
|
|
3229
|
+
const preparedBindings = [];
|
|
3230
|
+
try {
|
|
3231
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3232
|
+
const index = update.position + offset;
|
|
3233
|
+
const item = incomingItems[offset];
|
|
3234
|
+
const key = incomingKeys[offset];
|
|
3235
|
+
const retained = removedByKey.get(key);
|
|
3236
|
+
if (retained) {
|
|
3237
|
+
const bindingUpdates = prepareKeyedRowBindingUpdates(
|
|
3238
|
+
props,
|
|
3239
|
+
retained.instance,
|
|
3240
|
+
item,
|
|
3241
|
+
index
|
|
3242
|
+
);
|
|
3243
|
+
if (!bindingUpdates) return void 0;
|
|
3244
|
+
nextWindow.push(retained.instance);
|
|
3245
|
+
sequence.push(retained.offset);
|
|
3246
|
+
preparedBindings.push(bindingUpdates);
|
|
3247
|
+
continue;
|
|
3248
|
+
}
|
|
3249
|
+
if (instances.has(key)) return void 0;
|
|
3250
|
+
const descriptor = props.create(item, index);
|
|
3251
|
+
nextWindow.push({
|
|
3252
|
+
key,
|
|
3253
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3254
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3255
|
+
item,
|
|
3256
|
+
index,
|
|
3257
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3258
|
+
});
|
|
3259
|
+
sequence.push(-1);
|
|
3260
|
+
preparedBindings.push(void 0);
|
|
3261
|
+
}
|
|
3262
|
+
} catch {
|
|
3263
|
+
return void 0;
|
|
3264
|
+
}
|
|
3265
|
+
for (const instance of removed) {
|
|
3266
|
+
if (incomingKeySet.has(instance.key)) continue;
|
|
3267
|
+
instance.scope?.cleanup();
|
|
3268
|
+
instance.element.remove();
|
|
3269
|
+
}
|
|
3270
|
+
for (let offset = 0; offset < nextWindow.length; offset += 1) {
|
|
3271
|
+
const bindingUpdates = preparedBindings[offset];
|
|
3272
|
+
if (bindingUpdates) {
|
|
3273
|
+
const instance = nextWindow[offset];
|
|
3274
|
+
applyPreparedKeyedRowBindingUpdates(props, instance, bindingUpdates);
|
|
3275
|
+
instance.item = incomingItems[offset];
|
|
3276
|
+
instance.index = update.position + offset;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
reorderCompilerKeyedRows(root, nextWindow, sequence, anchor || null);
|
|
3280
|
+
previousInstances.splice(update.position, update.removedCount, ...nextWindow);
|
|
3281
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
const knownKeys = new Set(instances.keys());
|
|
3285
|
+
const incoming = [];
|
|
3286
|
+
try {
|
|
3287
|
+
for (let offset = 0; offset < update.insertedCount; offset += 1) {
|
|
3288
|
+
const index = update.position + offset;
|
|
3289
|
+
const item = incomingItems[offset];
|
|
3290
|
+
const key = incomingKeys[offset];
|
|
3291
|
+
if (knownKeys.has(key)) return void 0;
|
|
3292
|
+
knownKeys.add(key);
|
|
3293
|
+
const descriptor = props.create(item, index);
|
|
3294
|
+
incoming.push({
|
|
3295
|
+
key,
|
|
3296
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
3297
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
3298
|
+
item,
|
|
3299
|
+
index,
|
|
3300
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
} catch {
|
|
3304
|
+
return void 0;
|
|
3305
|
+
}
|
|
3306
|
+
for (const instance of removed) {
|
|
3307
|
+
instance.scope?.cleanup();
|
|
3308
|
+
instance.element.remove();
|
|
3309
|
+
}
|
|
3310
|
+
if (incoming.length > 0) {
|
|
3311
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
3312
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
3313
|
+
root.insertBefore(fragment, anchor || null);
|
|
3314
|
+
}
|
|
3315
|
+
previousInstances.splice(update.position, update.removedCount, ...incoming);
|
|
3316
|
+
for (let index = update.position + update.insertedCount; index < previousInstances.length; index += 1) {
|
|
3317
|
+
previousInstances[index].index = index;
|
|
3318
|
+
}
|
|
3319
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
3320
|
+
}
|
|
3321
|
+
function reconcileCompilerKeyedArrayPositionWithBatch(...args) {
|
|
3322
|
+
return reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
3323
|
+
}
|
|
3324
|
+
function reconcileCompilerKeyedArrayPositionWithWindow(...args) {
|
|
3325
|
+
return reconcileCompilerKeyedArrayWindowReplace(...args) || reconcileCompilerKeyedArrayBatchInsert(...args) || reconcileCompilerKeyedArrayPosition(...args);
|
|
3326
|
+
}
|
|
2822
3327
|
function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2823
3328
|
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
2824
3329
|
return void 0;
|
|
@@ -2834,8 +3339,47 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2834
3339
|
}
|
|
2835
3340
|
const finalValue = props.items();
|
|
2836
3341
|
const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
2837
|
-
if (!update ||
|
|
3342
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2838
3343
|
const previousInstances = [...instances.values()];
|
|
3344
|
+
if (update.kind === "sort") {
|
|
3345
|
+
const instancesByItem = /* @__PURE__ */ new Map();
|
|
3346
|
+
try {
|
|
3347
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
3348
|
+
const instance = previousInstances[sourceIndex];
|
|
3349
|
+
if (instance.index !== sourceIndex || instancesByItem.has(instance.item)) return void 0;
|
|
3350
|
+
instancesByItem.set(instance.item, instance);
|
|
3351
|
+
}
|
|
3352
|
+
const nextInstances = [];
|
|
3353
|
+
const sequence = [];
|
|
3354
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
3355
|
+
const item = finalValue[targetIndex];
|
|
3356
|
+
const instance = instancesByItem.get(item);
|
|
3357
|
+
if (!instance || !Object.is(instance.item, item)) return void 0;
|
|
3358
|
+
instancesByItem.delete(item);
|
|
3359
|
+
nextInstances.push(instance);
|
|
3360
|
+
sequence.push(instance.index);
|
|
3361
|
+
}
|
|
3362
|
+
if (instancesByItem.size > 0) return void 0;
|
|
3363
|
+
const activeElement2 = root.ownerDocument.activeElement;
|
|
3364
|
+
const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
|
|
3365
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
3366
|
+
let anchor2 = null;
|
|
3367
|
+
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
3368
|
+
const instance = nextInstances[index];
|
|
3369
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
|
|
3370
|
+
root.insertBefore(instance.element, anchor2);
|
|
3371
|
+
}
|
|
3372
|
+
anchor2 = instance.element;
|
|
3373
|
+
instance.index = index;
|
|
3374
|
+
}
|
|
3375
|
+
if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
|
|
3376
|
+
activeElement2.focus({ preventScroll: true });
|
|
3377
|
+
}
|
|
3378
|
+
return new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
3379
|
+
} catch {
|
|
3380
|
+
return void 0;
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
2839
3383
|
try {
|
|
2840
3384
|
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2841
3385
|
const instance = previousInstances[sourceIndex];
|
|
@@ -3759,8 +4303,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3759
4303
|
}
|
|
3760
4304
|
if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
|
|
3761
4305
|
if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
|
|
3762
|
-
const activeElement = this.root.ownerDocument.activeElement;
|
|
3763
|
-
const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
|
|
3764
4306
|
const nextKeys = new Set(rows.keys);
|
|
3765
4307
|
const hasSurvivingRows = rows.keys.some((key) => this.instances.has(key));
|
|
3766
4308
|
const oldIndices = /* @__PURE__ */ new Map();
|
|
@@ -3774,7 +4316,6 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3774
4316
|
}
|
|
3775
4317
|
}
|
|
3776
4318
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : rows.keys.map(() => -1);
|
|
3777
|
-
const stablePositions = hasSurvivingRows ? longestIncreasingSubsequencePositions(sequence) : /* @__PURE__ */ new Set();
|
|
3778
4319
|
const nextInstances = [];
|
|
3779
4320
|
const conditionalChanges = [];
|
|
3780
4321
|
for (let index = 0; index < rows.items.length; index += 1) {
|
|
@@ -3839,34 +4380,12 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
3839
4380
|
for (const instance of nextInstances) fragment.append(instance.element);
|
|
3840
4381
|
this.root.replaceChildren(fragment);
|
|
3841
4382
|
} else {
|
|
3842
|
-
|
|
3843
|
-
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
3844
|
-
const instance = nextInstances[index];
|
|
3845
|
-
if (sequence[index] < 0) {
|
|
3846
|
-
let start = index;
|
|
3847
|
-
while (start > 0 && sequence[start - 1] < 0) start -= 1;
|
|
3848
|
-
const fragment = this.root.ownerDocument.createDocumentFragment();
|
|
3849
|
-
for (let itemIndex = start; itemIndex <= index; itemIndex += 1) {
|
|
3850
|
-
fragment.append(nextInstances[itemIndex].element);
|
|
3851
|
-
}
|
|
3852
|
-
this.root.insertBefore(fragment, anchor);
|
|
3853
|
-
anchor = nextInstances[start].element;
|
|
3854
|
-
index = start;
|
|
3855
|
-
} else {
|
|
3856
|
-
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor) {
|
|
3857
|
-
this.root.insertBefore(instance.element, anchor);
|
|
3858
|
-
}
|
|
3859
|
-
anchor = instance.element;
|
|
3860
|
-
}
|
|
3861
|
-
}
|
|
4383
|
+
reorderCompilerKeyedRows(this.root, nextInstances, sequence, null);
|
|
3862
4384
|
}
|
|
3863
4385
|
this.instances = new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
3864
4386
|
this.rebuildElementIndex(this.instances);
|
|
3865
4387
|
this.pruneEventHandlers(rows.keys);
|
|
3866
4388
|
this.pruneConditionalListeners(rows.keys);
|
|
3867
|
-
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
3868
|
-
activeElement.focus({ preventScroll: true });
|
|
3869
|
-
}
|
|
3870
4389
|
this.commitCurrentCollection(dirtyState);
|
|
3871
4390
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
3872
4391
|
}
|
|
@@ -4356,6 +4875,22 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
4356
4875
|
})
|
|
4357
4876
|
})
|
|
4358
4877
|
};
|
|
4878
|
+
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
4879
|
+
name: "keyed-rows:batch-position-hinted",
|
|
4880
|
+
create: (owner) => ({
|
|
4881
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4882
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
4883
|
+
})
|
|
4884
|
+
})
|
|
4885
|
+
};
|
|
4886
|
+
var keyedRowsWindowPositionHintedRuntimeFeature = {
|
|
4887
|
+
name: "keyed-rows:window-position-hinted",
|
|
4888
|
+
create: (owner) => ({
|
|
4889
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4890
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
4891
|
+
})
|
|
4892
|
+
})
|
|
4893
|
+
};
|
|
4359
4894
|
var keyedRowsReorderHintedRuntimeFeature = {
|
|
4360
4895
|
name: "keyed-rows:reorder-hinted",
|
|
4361
4896
|
create: (owner) => ({
|
|
@@ -4380,6 +4915,22 @@ var keyedRowsEveryHintedRuntimeFeature = {
|
|
|
4380
4915
|
})
|
|
4381
4916
|
})
|
|
4382
4917
|
};
|
|
4918
|
+
var keyedRowsBatchEveryHintedRuntimeFeature = {
|
|
4919
|
+
name: "keyed-rows:batch-every-hinted",
|
|
4920
|
+
create: (owner) => ({
|
|
4921
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4922
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
4923
|
+
})
|
|
4924
|
+
})
|
|
4925
|
+
};
|
|
4926
|
+
var keyedRowsWindowEveryHintedRuntimeFeature = {
|
|
4927
|
+
name: "keyed-rows:window-every-hinted",
|
|
4928
|
+
create: (owner) => ({
|
|
4929
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4930
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
4931
|
+
})
|
|
4932
|
+
})
|
|
4933
|
+
};
|
|
4383
4934
|
var keyedRowsFilterHintedRuntimeFeature = {
|
|
4384
4935
|
name: "keyed-rows:filter-hinted",
|
|
4385
4936
|
create: (owner) => ({
|
|
@@ -4430,6 +4981,24 @@ var keyedRowsConditionalPositionHintedRuntimeFeature = {
|
|
|
4430
4981
|
})
|
|
4431
4982
|
})
|
|
4432
4983
|
};
|
|
4984
|
+
var keyedRowsConditionalBatchPositionHintedRuntimeFeature = {
|
|
4985
|
+
name: "keyed-rows:conditional:batch-position-hinted",
|
|
4986
|
+
create: (owner) => ({
|
|
4987
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4988
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4989
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
4990
|
+
})
|
|
4991
|
+
})
|
|
4992
|
+
};
|
|
4993
|
+
var keyedRowsConditionalWindowPositionHintedRuntimeFeature = {
|
|
4994
|
+
name: "keyed-rows:conditional:window-position-hinted",
|
|
4995
|
+
create: (owner) => ({
|
|
4996
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4997
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4998
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
4999
|
+
})
|
|
5000
|
+
})
|
|
5001
|
+
};
|
|
4433
5002
|
var keyedRowsConditionalReorderHintedRuntimeFeature = {
|
|
4434
5003
|
name: "keyed-rows:conditional:reorder-hinted",
|
|
4435
5004
|
create: (owner) => ({
|
|
@@ -4457,6 +5026,24 @@ var keyedRowsConditionalEveryHintedRuntimeFeature = {
|
|
|
4457
5026
|
})
|
|
4458
5027
|
})
|
|
4459
5028
|
};
|
|
5029
|
+
var keyedRowsConditionalBatchEveryHintedRuntimeFeature = {
|
|
5030
|
+
name: "keyed-rows:conditional:batch-every-hinted",
|
|
5031
|
+
create: (owner) => ({
|
|
5032
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5033
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5034
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5035
|
+
})
|
|
5036
|
+
})
|
|
5037
|
+
};
|
|
5038
|
+
var keyedRowsConditionalWindowEveryHintedRuntimeFeature = {
|
|
5039
|
+
name: "keyed-rows:conditional:window-every-hinted",
|
|
5040
|
+
create: (owner) => ({
|
|
5041
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5042
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5043
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5044
|
+
})
|
|
5045
|
+
})
|
|
5046
|
+
};
|
|
4460
5047
|
var keyedRowsConditionalFilterHintedRuntimeFeature = {
|
|
4461
5048
|
name: "keyed-rows:conditional:filter-hinted",
|
|
4462
5049
|
create: (owner) => ({
|
|
@@ -4510,6 +5097,24 @@ var keyedRowsHostPositionHintedRuntimeFeature = {
|
|
|
4510
5097
|
})
|
|
4511
5098
|
})
|
|
4512
5099
|
};
|
|
5100
|
+
var keyedRowsHostBatchPositionHintedRuntimeFeature = {
|
|
5101
|
+
name: "keyed-rows:host:batch-position-hinted",
|
|
5102
|
+
create: (owner) => ({
|
|
5103
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5104
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5105
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
5106
|
+
})
|
|
5107
|
+
})
|
|
5108
|
+
};
|
|
5109
|
+
var keyedRowsHostWindowPositionHintedRuntimeFeature = {
|
|
5110
|
+
name: "keyed-rows:host:window-position-hinted",
|
|
5111
|
+
create: (owner) => ({
|
|
5112
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5113
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5114
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
5115
|
+
})
|
|
5116
|
+
})
|
|
5117
|
+
};
|
|
4513
5118
|
var keyedRowsHostReorderHintedRuntimeFeature = {
|
|
4514
5119
|
name: "keyed-rows:host:reorder-hinted",
|
|
4515
5120
|
create: (owner) => ({
|
|
@@ -4537,6 +5142,24 @@ var keyedRowsHostEveryHintedRuntimeFeature = {
|
|
|
4537
5142
|
})
|
|
4538
5143
|
})
|
|
4539
5144
|
};
|
|
5145
|
+
var keyedRowsHostBatchEveryHintedRuntimeFeature = {
|
|
5146
|
+
name: "keyed-rows:host:batch-every-hinted",
|
|
5147
|
+
create: (owner) => ({
|
|
5148
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5149
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5150
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5151
|
+
})
|
|
5152
|
+
})
|
|
5153
|
+
};
|
|
5154
|
+
var keyedRowsHostWindowEveryHintedRuntimeFeature = {
|
|
5155
|
+
name: "keyed-rows:host:window-every-hinted",
|
|
5156
|
+
create: (owner) => ({
|
|
5157
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5158
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5159
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5160
|
+
})
|
|
5161
|
+
})
|
|
5162
|
+
};
|
|
4540
5163
|
var keyedRowsHostFilterHintedRuntimeFeature = {
|
|
4541
5164
|
name: "keyed-rows:host:filter-hinted",
|
|
4542
5165
|
create: (owner) => ({
|
|
@@ -4593,6 +5216,26 @@ var keyedRowsCompletePositionHintedRuntimeFeature = {
|
|
|
4593
5216
|
})
|
|
4594
5217
|
})
|
|
4595
5218
|
};
|
|
5219
|
+
var keyedRowsCompleteBatchPositionHintedRuntimeFeature = {
|
|
5220
|
+
name: "keyed-rows:complete:batch-position-hinted",
|
|
5221
|
+
create: (owner) => ({
|
|
5222
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5223
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5224
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5225
|
+
keyedUpdates: keyedBatchPositionUpdateRuntime
|
|
5226
|
+
})
|
|
5227
|
+
})
|
|
5228
|
+
};
|
|
5229
|
+
var keyedRowsCompleteWindowPositionHintedRuntimeFeature = {
|
|
5230
|
+
name: "keyed-rows:complete:window-position-hinted",
|
|
5231
|
+
create: (owner) => ({
|
|
5232
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5233
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5234
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5235
|
+
keyedUpdates: keyedWindowPositionUpdateRuntime
|
|
5236
|
+
})
|
|
5237
|
+
})
|
|
5238
|
+
};
|
|
4596
5239
|
var keyedRowsCompleteReorderHintedRuntimeFeature = {
|
|
4597
5240
|
name: "keyed-rows:complete:reorder-hinted",
|
|
4598
5241
|
create: (owner) => ({
|
|
@@ -4623,6 +5266,26 @@ var keyedRowsCompleteEveryHintedRuntimeFeature = {
|
|
|
4623
5266
|
})
|
|
4624
5267
|
})
|
|
4625
5268
|
};
|
|
5269
|
+
var keyedRowsCompleteBatchEveryHintedRuntimeFeature = {
|
|
5270
|
+
name: "keyed-rows:complete:batch-every-hinted",
|
|
5271
|
+
create: (owner) => ({
|
|
5272
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5273
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5274
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5275
|
+
keyedUpdates: keyedBatchEveryUpdateRuntime
|
|
5276
|
+
})
|
|
5277
|
+
})
|
|
5278
|
+
};
|
|
5279
|
+
var keyedRowsCompleteWindowEveryHintedRuntimeFeature = {
|
|
5280
|
+
name: "keyed-rows:complete:window-every-hinted",
|
|
5281
|
+
create: (owner) => ({
|
|
5282
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
5283
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
5284
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
5285
|
+
keyedUpdates: keyedWindowEveryUpdateRuntime
|
|
5286
|
+
})
|
|
5287
|
+
})
|
|
5288
|
+
};
|
|
4626
5289
|
var keyedRowsCompleteFilterHintedRuntimeFeature = {
|
|
4627
5290
|
name: "keyed-rows:complete:filter-hinted",
|
|
4628
5291
|
create: (owner) => ({
|
|
@@ -5125,7 +5788,7 @@ var COMPLETE_RUNTIME_FEATURES = [
|
|
|
5125
5788
|
hostConditionalRuntimeFeature,
|
|
5126
5789
|
conditionalRangesRuntimeFeature,
|
|
5127
5790
|
keyedListRuntimeFeature,
|
|
5128
|
-
|
|
5791
|
+
keyedRowsCompleteWindowEveryHintedRuntimeFeature,
|
|
5129
5792
|
keyedRangesRuntimeFeature,
|
|
5130
5793
|
mixedRangesRuntimeFeature,
|
|
5131
5794
|
componentRuntimeFeature
|
|
@@ -5141,19 +5804,26 @@ exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
|
|
|
5141
5804
|
exports.createCompiledComponent = createCompiledComponent;
|
|
5142
5805
|
exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
|
|
5143
5806
|
exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
|
|
5807
|
+
exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
|
|
5144
5808
|
exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
|
|
5145
5809
|
exports.createCompilerKeyedArrayPositionUpdate = createCompilerKeyedArrayPositionUpdate;
|
|
5146
5810
|
exports.createCompilerKeyedArrayPrepend = createCompilerKeyedArrayPrepend;
|
|
5147
5811
|
exports.createCompilerKeyedArrayReorder = createCompilerKeyedArrayReorder;
|
|
5148
5812
|
exports.createCompilerKeyedArrayRollingWindow = createCompilerKeyedArrayRollingWindow;
|
|
5149
5813
|
exports.createCompilerKeyedArraySlice = createCompilerKeyedArraySlice;
|
|
5814
|
+
exports.createCompilerKeyedArraySort = createCompilerKeyedArraySort;
|
|
5815
|
+
exports.createCompilerKeyedArrayWindowReplace = createCompilerKeyedArrayWindowReplace;
|
|
5150
5816
|
exports.createCompilerKeyedCollectionUpdate = createCompilerKeyedCollectionUpdate;
|
|
5151
5817
|
exports.createCompilerKeyedMapUpdate = createCompilerKeyedMapUpdate;
|
|
5152
5818
|
exports.hostConditionalRuntimeFeature = hostConditionalRuntimeFeature;
|
|
5153
5819
|
exports.keyedListRuntimeFeature = keyedListRuntimeFeature;
|
|
5154
5820
|
exports.keyedRangesRuntimeFeature = keyedRangesRuntimeFeature;
|
|
5155
5821
|
exports.keyedRowsAllHintedRuntimeFeature = keyedRowsAllHintedRuntimeFeature;
|
|
5822
|
+
exports.keyedRowsBatchEveryHintedRuntimeFeature = keyedRowsBatchEveryHintedRuntimeFeature;
|
|
5823
|
+
exports.keyedRowsBatchPositionHintedRuntimeFeature = keyedRowsBatchPositionHintedRuntimeFeature;
|
|
5156
5824
|
exports.keyedRowsCompleteAllHintedRuntimeFeature = keyedRowsCompleteAllHintedRuntimeFeature;
|
|
5825
|
+
exports.keyedRowsCompleteBatchEveryHintedRuntimeFeature = keyedRowsCompleteBatchEveryHintedRuntimeFeature;
|
|
5826
|
+
exports.keyedRowsCompleteBatchPositionHintedRuntimeFeature = keyedRowsCompleteBatchPositionHintedRuntimeFeature;
|
|
5157
5827
|
exports.keyedRowsCompleteEveryHintedRuntimeFeature = keyedRowsCompleteEveryHintedRuntimeFeature;
|
|
5158
5828
|
exports.keyedRowsCompleteFilterHintedRuntimeFeature = keyedRowsCompleteFilterHintedRuntimeFeature;
|
|
5159
5829
|
exports.keyedRowsCompleteFilterPrependHintedRuntimeFeature = keyedRowsCompleteFilterPrependHintedRuntimeFeature;
|
|
@@ -5162,7 +5832,11 @@ exports.keyedRowsCompletePositionHintedRuntimeFeature = keyedRowsCompletePositio
|
|
|
5162
5832
|
exports.keyedRowsCompletePrependHintedRuntimeFeature = keyedRowsCompletePrependHintedRuntimeFeature;
|
|
5163
5833
|
exports.keyedRowsCompleteReorderHintedRuntimeFeature = keyedRowsCompleteReorderHintedRuntimeFeature;
|
|
5164
5834
|
exports.keyedRowsCompleteRuntimeFeature = keyedRowsCompleteRuntimeFeature;
|
|
5835
|
+
exports.keyedRowsCompleteWindowEveryHintedRuntimeFeature = keyedRowsCompleteWindowEveryHintedRuntimeFeature;
|
|
5836
|
+
exports.keyedRowsCompleteWindowPositionHintedRuntimeFeature = keyedRowsCompleteWindowPositionHintedRuntimeFeature;
|
|
5165
5837
|
exports.keyedRowsConditionalAllHintedRuntimeFeature = keyedRowsConditionalAllHintedRuntimeFeature;
|
|
5838
|
+
exports.keyedRowsConditionalBatchEveryHintedRuntimeFeature = keyedRowsConditionalBatchEveryHintedRuntimeFeature;
|
|
5839
|
+
exports.keyedRowsConditionalBatchPositionHintedRuntimeFeature = keyedRowsConditionalBatchPositionHintedRuntimeFeature;
|
|
5166
5840
|
exports.keyedRowsConditionalEveryHintedRuntimeFeature = keyedRowsConditionalEveryHintedRuntimeFeature;
|
|
5167
5841
|
exports.keyedRowsConditionalFilterHintedRuntimeFeature = keyedRowsConditionalFilterHintedRuntimeFeature;
|
|
5168
5842
|
exports.keyedRowsConditionalFilterPrependHintedRuntimeFeature = keyedRowsConditionalFilterPrependHintedRuntimeFeature;
|
|
@@ -5171,11 +5845,15 @@ exports.keyedRowsConditionalPositionHintedRuntimeFeature = keyedRowsConditionalP
|
|
|
5171
5845
|
exports.keyedRowsConditionalPrependHintedRuntimeFeature = keyedRowsConditionalPrependHintedRuntimeFeature;
|
|
5172
5846
|
exports.keyedRowsConditionalReorderHintedRuntimeFeature = keyedRowsConditionalReorderHintedRuntimeFeature;
|
|
5173
5847
|
exports.keyedRowsConditionalRuntimeFeature = keyedRowsConditionalRuntimeFeature;
|
|
5848
|
+
exports.keyedRowsConditionalWindowEveryHintedRuntimeFeature = keyedRowsConditionalWindowEveryHintedRuntimeFeature;
|
|
5849
|
+
exports.keyedRowsConditionalWindowPositionHintedRuntimeFeature = keyedRowsConditionalWindowPositionHintedRuntimeFeature;
|
|
5174
5850
|
exports.keyedRowsEveryHintedRuntimeFeature = keyedRowsEveryHintedRuntimeFeature;
|
|
5175
5851
|
exports.keyedRowsFilterHintedRuntimeFeature = keyedRowsFilterHintedRuntimeFeature;
|
|
5176
5852
|
exports.keyedRowsFilterPrependHintedRuntimeFeature = keyedRowsFilterPrependHintedRuntimeFeature;
|
|
5177
5853
|
exports.keyedRowsHintedRuntimeFeature = keyedRowsHintedRuntimeFeature;
|
|
5178
5854
|
exports.keyedRowsHostAllHintedRuntimeFeature = keyedRowsHostAllHintedRuntimeFeature;
|
|
5855
|
+
exports.keyedRowsHostBatchEveryHintedRuntimeFeature = keyedRowsHostBatchEveryHintedRuntimeFeature;
|
|
5856
|
+
exports.keyedRowsHostBatchPositionHintedRuntimeFeature = keyedRowsHostBatchPositionHintedRuntimeFeature;
|
|
5179
5857
|
exports.keyedRowsHostEveryHintedRuntimeFeature = keyedRowsHostEveryHintedRuntimeFeature;
|
|
5180
5858
|
exports.keyedRowsHostFilterHintedRuntimeFeature = keyedRowsHostFilterHintedRuntimeFeature;
|
|
5181
5859
|
exports.keyedRowsHostFilterPrependHintedRuntimeFeature = keyedRowsHostFilterPrependHintedRuntimeFeature;
|
|
@@ -5184,10 +5862,14 @@ exports.keyedRowsHostPositionHintedRuntimeFeature = keyedRowsHostPositionHintedR
|
|
|
5184
5862
|
exports.keyedRowsHostPrependHintedRuntimeFeature = keyedRowsHostPrependHintedRuntimeFeature;
|
|
5185
5863
|
exports.keyedRowsHostReorderHintedRuntimeFeature = keyedRowsHostReorderHintedRuntimeFeature;
|
|
5186
5864
|
exports.keyedRowsHostRuntimeFeature = keyedRowsHostRuntimeFeature;
|
|
5865
|
+
exports.keyedRowsHostWindowEveryHintedRuntimeFeature = keyedRowsHostWindowEveryHintedRuntimeFeature;
|
|
5866
|
+
exports.keyedRowsHostWindowPositionHintedRuntimeFeature = keyedRowsHostWindowPositionHintedRuntimeFeature;
|
|
5187
5867
|
exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
|
|
5188
5868
|
exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;
|
|
5189
5869
|
exports.keyedRowsReorderHintedRuntimeFeature = keyedRowsReorderHintedRuntimeFeature;
|
|
5190
5870
|
exports.keyedRowsRuntimeFeature = keyedRowsRuntimeFeature;
|
|
5871
|
+
exports.keyedRowsWindowEveryHintedRuntimeFeature = keyedRowsWindowEveryHintedRuntimeFeature;
|
|
5872
|
+
exports.keyedRowsWindowPositionHintedRuntimeFeature = keyedRowsWindowPositionHintedRuntimeFeature;
|
|
5191
5873
|
exports.mixedRangesRuntimeFeature = mixedRangesRuntimeFeature;
|
|
5192
5874
|
//# sourceMappingURL=compiler-runtime.cjs.map
|
|
5193
5875
|
//# sourceMappingURL=compiler-runtime.cjs.map
|