@farm.js/react 0.1.0-beta.6 → 0.1.0-beta.7
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 +40 -13
- package/dist/compiler-runtime.cjs +82 -3
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +5 -3
- package/dist/compiler-runtime.d.ts +5 -3
- package/dist/compiler-runtime.mjs +82 -4
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +120 -9
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +120 -9
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -16,10 +16,12 @@ declare function createCompilerKeyedArrayFilter(previous: unknown, method: unkno
|
|
|
16
16
|
declare function createCompilerKeyedArraySlice(previous: unknown, method: unknown, ...args: readonly number[]): unknown;
|
|
17
17
|
/** @internal Records a compiler-proven retained tail followed by incoming keyed rows. */
|
|
18
18
|
declare function createCompilerKeyedArrayRollingWindow(previous: unknown, retained: unknown, value: unknown): unknown;
|
|
19
|
-
/** @internal Executes a native known-position insert or replacement and records
|
|
20
|
-
declare function createCompilerKeyedArrayPositionUpdate(previous: unknown, method: unknown, kind: "insert" | "replace", position: number, ...args: readonly unknown[]): unknown;
|
|
19
|
+
/** @internal Executes a native known-position insert, removal, or replacement and records it. */
|
|
20
|
+
declare function createCompilerKeyedArrayPositionUpdate(previous: unknown, method: unknown, kind: "insert" | "remove" | "replace", position: number, ...args: readonly unknown[]): unknown;
|
|
21
21
|
/** @internal Executes a native reverse and records its exact keyed-row permutation. */
|
|
22
22
|
declare function createCompilerKeyedArrayReorder(previous: unknown, method: unknown): unknown;
|
|
23
|
+
/** @internal Executes a native immutable sort and records its keyed-row permutation. */
|
|
24
|
+
declare function createCompilerKeyedArraySort(previous: unknown, method: unknown, ...args: readonly unknown[]): unknown;
|
|
23
25
|
/** @internal Preserves a proven native collection mutation while recording its executed key. */
|
|
24
26
|
declare function applyCompilerKeyedCollectionMutation(collection: unknown, method: unknown, operation: CompilerKeyedCollectionMutation, key: unknown, value?: unknown): unknown;
|
|
25
27
|
/** @internal Connects compiler-owned immutable Set/Map mutations to their committed source. */
|
|
@@ -361,4 +363,4 @@ declare function createCompiledComponentWithFeatures<Props>(definition: Compiled
|
|
|
361
363
|
*/
|
|
362
364
|
declare function createCompiledComponent<Props>(definition: CompiledComponentDefinition<Props>): React.ComponentType<Props>;
|
|
363
365
|
|
|
364
|
-
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, 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 };
|
|
366
|
+
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
@@ -16,10 +16,12 @@ declare function createCompilerKeyedArrayFilter(previous: unknown, method: unkno
|
|
|
16
16
|
declare function createCompilerKeyedArraySlice(previous: unknown, method: unknown, ...args: readonly number[]): unknown;
|
|
17
17
|
/** @internal Records a compiler-proven retained tail followed by incoming keyed rows. */
|
|
18
18
|
declare function createCompilerKeyedArrayRollingWindow(previous: unknown, retained: unknown, value: unknown): unknown;
|
|
19
|
-
/** @internal Executes a native known-position insert or replacement and records
|
|
20
|
-
declare function createCompilerKeyedArrayPositionUpdate(previous: unknown, method: unknown, kind: "insert" | "replace", position: number, ...args: readonly unknown[]): unknown;
|
|
19
|
+
/** @internal Executes a native known-position insert, removal, or replacement and records it. */
|
|
20
|
+
declare function createCompilerKeyedArrayPositionUpdate(previous: unknown, method: unknown, kind: "insert" | "remove" | "replace", position: number, ...args: readonly unknown[]): unknown;
|
|
21
21
|
/** @internal Executes a native reverse and records its exact keyed-row permutation. */
|
|
22
22
|
declare function createCompilerKeyedArrayReorder(previous: unknown, method: unknown): unknown;
|
|
23
|
+
/** @internal Executes a native immutable sort and records its keyed-row permutation. */
|
|
24
|
+
declare function createCompilerKeyedArraySort(previous: unknown, method: unknown, ...args: readonly unknown[]): unknown;
|
|
23
25
|
/** @internal Preserves a proven native collection mutation while recording its executed key. */
|
|
24
26
|
declare function applyCompilerKeyedCollectionMutation(collection: unknown, method: unknown, operation: CompilerKeyedCollectionMutation, key: unknown, value?: unknown): unknown;
|
|
25
27
|
/** @internal Connects compiler-owned immutable Set/Map mutations to their committed source. */
|
|
@@ -361,4 +363,4 @@ declare function createCompiledComponentWithFeatures<Props>(definition: Compiled
|
|
|
361
363
|
*/
|
|
362
364
|
declare function createCompiledComponent<Props>(definition: CompiledComponentDefinition<Props>): React.ComponentType<Props>;
|
|
363
365
|
|
|
364
|
-
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, 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 };
|
|
366
|
+
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
@@ -37,6 +37,7 @@ var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
|
37
37
|
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
38
38
|
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
39
39
|
var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
|
|
40
|
+
var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
|
|
40
41
|
var NATIVE_REFLECT_APPLY = Reflect.apply;
|
|
41
42
|
function compilerObject(value) {
|
|
42
43
|
return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
|
|
@@ -157,7 +158,7 @@ function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
|
|
|
157
158
|
const target = compilerObject(value);
|
|
158
159
|
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
159
160
|
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)) {
|
|
161
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "remove" && (update.position >= expectedLength || update.resultLength !== expectedLength - 1) || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
|
|
161
162
|
return void 0;
|
|
162
163
|
}
|
|
163
164
|
return update;
|
|
@@ -374,8 +375,9 @@ function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position
|
|
|
374
375
|
const sourceLength = previous.length;
|
|
375
376
|
const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
|
|
376
377
|
const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
|
|
378
|
+
const validRemove = kind === "remove" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 1 && Object.is(args[0], 1) && normalizedPosition < sourceLength && value.length === sourceLength - 1;
|
|
377
379
|
const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength && value.length === sourceLength;
|
|
378
|
-
if (!validInsert && !validReplace) return value;
|
|
380
|
+
if (!validInsert && !validRemove && !validReplace) return value;
|
|
379
381
|
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
380
382
|
if (!sourceToken) return value;
|
|
381
383
|
COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
|
|
@@ -413,6 +415,33 @@ function createCompilerKeyedArrayReorder(previous, method) {
|
|
|
413
415
|
}
|
|
414
416
|
return value;
|
|
415
417
|
}
|
|
418
|
+
function createCompilerKeyedArraySort(previous, method, ...args) {
|
|
419
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
420
|
+
method,
|
|
421
|
+
previous,
|
|
422
|
+
args
|
|
423
|
+
);
|
|
424
|
+
try {
|
|
425
|
+
const previousTarget = compilerObject(previous);
|
|
426
|
+
const valueTarget = compilerObject(value);
|
|
427
|
+
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) {
|
|
428
|
+
return value;
|
|
429
|
+
}
|
|
430
|
+
for (let index = 0; index < previous.length; index += 1) {
|
|
431
|
+
if (!(index in previous)) return value;
|
|
432
|
+
}
|
|
433
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
434
|
+
if (!sourceToken) return value;
|
|
435
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
436
|
+
kind: "sort",
|
|
437
|
+
sourceToken,
|
|
438
|
+
sourceLength: previous.length,
|
|
439
|
+
resultLength: value.length
|
|
440
|
+
});
|
|
441
|
+
} catch {
|
|
442
|
+
}
|
|
443
|
+
return value;
|
|
444
|
+
}
|
|
416
445
|
function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
|
|
417
446
|
const args = operation === "map-set" ? [key, value] : [key];
|
|
418
447
|
const result = NATIVE_REFLECT_APPLY(method, collection, args);
|
|
@@ -2752,6 +2781,16 @@ function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken,
|
|
|
2752
2781
|
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2753
2782
|
const previousInstances = [...instances.values()];
|
|
2754
2783
|
const previous = previousInstances[update.position];
|
|
2784
|
+
if (update.kind === "remove") {
|
|
2785
|
+
if (!previous || previous.index !== update.position) return void 0;
|
|
2786
|
+
previous.scope?.cleanup();
|
|
2787
|
+
previous.element.remove();
|
|
2788
|
+
previousInstances.splice(update.position, 1);
|
|
2789
|
+
for (let index = update.position; index < previousInstances.length; index += 1) {
|
|
2790
|
+
previousInstances[index].index = index;
|
|
2791
|
+
}
|
|
2792
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2793
|
+
}
|
|
2755
2794
|
let item;
|
|
2756
2795
|
let key;
|
|
2757
2796
|
try {
|
|
@@ -2828,8 +2867,47 @@ function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken,
|
|
|
2828
2867
|
}
|
|
2829
2868
|
const finalValue = props.items();
|
|
2830
2869
|
const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
2831
|
-
if (!update ||
|
|
2870
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2832
2871
|
const previousInstances = [...instances.values()];
|
|
2872
|
+
if (update.kind === "sort") {
|
|
2873
|
+
const instancesByItem = /* @__PURE__ */ new Map();
|
|
2874
|
+
try {
|
|
2875
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2876
|
+
const instance = previousInstances[sourceIndex];
|
|
2877
|
+
if (instance.index !== sourceIndex || instancesByItem.has(instance.item)) return void 0;
|
|
2878
|
+
instancesByItem.set(instance.item, instance);
|
|
2879
|
+
}
|
|
2880
|
+
const nextInstances = [];
|
|
2881
|
+
const sequence = [];
|
|
2882
|
+
for (let targetIndex = 0; targetIndex < finalValue.length; targetIndex += 1) {
|
|
2883
|
+
const item = finalValue[targetIndex];
|
|
2884
|
+
const instance = instancesByItem.get(item);
|
|
2885
|
+
if (!instance || !Object.is(instance.item, item)) return void 0;
|
|
2886
|
+
instancesByItem.delete(item);
|
|
2887
|
+
nextInstances.push(instance);
|
|
2888
|
+
sequence.push(instance.index);
|
|
2889
|
+
}
|
|
2890
|
+
if (instancesByItem.size > 0) return void 0;
|
|
2891
|
+
const activeElement2 = root.ownerDocument.activeElement;
|
|
2892
|
+
const restoreFocus2 = Boolean(activeElement2 && root.contains(activeElement2));
|
|
2893
|
+
const stablePositions = longestIncreasingSubsequencePositions(sequence);
|
|
2894
|
+
let anchor2 = null;
|
|
2895
|
+
for (let index = nextInstances.length - 1; index >= 0; index -= 1) {
|
|
2896
|
+
const instance = nextInstances[index];
|
|
2897
|
+
if (!stablePositions.has(index) && instance.element.nextSibling !== anchor2) {
|
|
2898
|
+
root.insertBefore(instance.element, anchor2);
|
|
2899
|
+
}
|
|
2900
|
+
anchor2 = instance.element;
|
|
2901
|
+
instance.index = index;
|
|
2902
|
+
}
|
|
2903
|
+
if (restoreFocus2 && activeElement2?.isConnected && activeElement2.ownerDocument.activeElement !== activeElement2 && "focus" in activeElement2) {
|
|
2904
|
+
activeElement2.focus({ preventScroll: true });
|
|
2905
|
+
}
|
|
2906
|
+
return new Map(nextInstances.map((instance) => [instance.key, instance]));
|
|
2907
|
+
} catch {
|
|
2908
|
+
return void 0;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2833
2911
|
try {
|
|
2834
2912
|
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2835
2913
|
const instance = previousInstances[sourceIndex];
|
|
@@ -5128,6 +5206,6 @@ function createCompiledComponent(definition) {
|
|
|
5128
5206
|
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
5129
5207
|
}
|
|
5130
5208
|
|
|
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 };
|
|
5209
|
+
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
5132
5210
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
5133
5211
|
//# sourceMappingURL=compiler-runtime.mjs.map
|