@farm.js/react 0.1.0-beta.24 → 0.1.0-beta.25
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 +13 -0
- package/dist/compiler-runtime.cjs +46 -4
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +3 -1
- package/dist/compiler-runtime.d.ts +3 -1
- package/dist/compiler-runtime.mjs +45 -5
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +8 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +8 -1
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -295,6 +295,12 @@ and keyed-target fast paths, not support for other state changes: opaque updates
|
|
|
295
295
|
still use complete keyed reconciliation. Mixed hints, targeted bindings, conditional rows, and host
|
|
296
296
|
blocks keep their existing runtime. No additional option is required.
|
|
297
297
|
|
|
298
|
+
The same component-wide proof selects a smaller removal-only runtime when the only emitted
|
|
299
|
+
update hints are `filter()` and/or `slice()`. It omits unused append, map-update, and keyed-target
|
|
300
|
+
fast paths while retaining complete keyed reconciliation for opaque updates or rejected hints.
|
|
301
|
+
A sibling list requiring broader hints, targeted bindings, conditional rows, or host blocks keeps
|
|
302
|
+
the existing combined runtime. This changes bundle selection, not native array or React semantics.
|
|
303
|
+
|
|
298
304
|
Adjacent removal and append setters can share the same committed-row proof:
|
|
299
305
|
|
|
300
306
|
```tsx
|
|
@@ -380,6 +386,13 @@ positions into the prepend. The runtime removes only rejected rows, preserves ev
|
|
|
380
386
|
node, and creates only the final prefix instead of rescanning and rebinding the whole result.
|
|
381
387
|
Multiple adjacent prepends share the same proof.
|
|
382
388
|
|
|
389
|
+
When every keyed list in a component is plain and has no targeted bindings, and prepend is
|
|
390
|
+
the only emitted update hint, Farm selects a smaller prepend-only runtime. It omits unused
|
|
391
|
+
target and map/append fast paths, but keeps the same prepend validation and complete keyed
|
|
392
|
+
reconciliation for opaque or rejected updates. Mixed hints, conditional/host rows, and targeted
|
|
393
|
+
bindings on any sibling list keep their existing runtime. This changes bundle size, not the
|
|
394
|
+
supported update semantics or the prepend algorithm.
|
|
395
|
+
|
|
383
396
|
The setter may be concise or use a block containing exactly one direct value-returning `return`.
|
|
384
397
|
Extra statements, conditional returns, and missing returns keep complete keyed reconciliation.
|
|
385
398
|
|
|
@@ -177,7 +177,8 @@ function compilerKeyedArrayFilterSurvivorsFromUpdate(update, sourceToken, expect
|
|
|
177
177
|
if (current.sourceToken !== sourceToken) return void 0;
|
|
178
178
|
updates.push(current);
|
|
179
179
|
}
|
|
180
|
-
let survivors = Array
|
|
180
|
+
let survivors = new Array(expectedLength);
|
|
181
|
+
for (let index = 0; index < expectedLength; index += 1) survivors[index] = index;
|
|
181
182
|
let keysStable = true;
|
|
182
183
|
for (let updateIndex = updates.length - 1; updateIndex >= 0; updateIndex -= 1) {
|
|
183
184
|
const current = updates[updateIndex];
|
|
@@ -2645,17 +2646,34 @@ function prepareKeyedRowBindingUpdate(props, instance, item, index, bindingIndex
|
|
|
2645
2646
|
return [bindingIndex, target, value];
|
|
2646
2647
|
}
|
|
2647
2648
|
function prepareKeyedRowBindingUpdates(props, instance, item, index) {
|
|
2649
|
+
let first;
|
|
2648
2650
|
let updates;
|
|
2649
2651
|
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
2650
2652
|
const update = prepareKeyedRowBindingUpdate(props, instance, item, index, bindingIndex);
|
|
2651
2653
|
if (update === void 0) return void 0;
|
|
2652
|
-
if (update)
|
|
2654
|
+
if (update) {
|
|
2655
|
+
if (updates) updates.push(update);
|
|
2656
|
+
else if (first) {
|
|
2657
|
+
updates = [];
|
|
2658
|
+
updates.push(first);
|
|
2659
|
+
updates.push(update);
|
|
2660
|
+
} else first = update;
|
|
2661
|
+
}
|
|
2653
2662
|
}
|
|
2654
|
-
return updates || NO_KEYED_ROW_BINDING_UPDATES;
|
|
2663
|
+
return updates || first || NO_KEYED_ROW_BINDING_UPDATES;
|
|
2655
2664
|
}
|
|
2656
2665
|
var NO_KEYED_ROW_BINDING_UPDATES = [];
|
|
2657
2666
|
function applyPreparedKeyedRowBindingUpdates(props, instance, updates) {
|
|
2658
|
-
|
|
2667
|
+
if (typeof updates[0] === "number") {
|
|
2668
|
+
const [bindingIndex, target, value] = updates;
|
|
2669
|
+
commitKeyedRowBinding(props.bindings[bindingIndex], instance, bindingIndex, value, target);
|
|
2670
|
+
return;
|
|
2671
|
+
}
|
|
2672
|
+
for (const [
|
|
2673
|
+
bindingIndex,
|
|
2674
|
+
target,
|
|
2675
|
+
value
|
|
2676
|
+
] of updates) {
|
|
2659
2677
|
commitKeyedRowBinding(props.bindings[bindingIndex], instance, bindingIndex, value, target);
|
|
2660
2678
|
}
|
|
2661
2679
|
}
|
|
@@ -4446,6 +4464,12 @@ var keyedPrependUpdateRuntime = {
|
|
|
4446
4464
|
...keyedUpdateRuntime,
|
|
4447
4465
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
4448
4466
|
};
|
|
4467
|
+
var keyedPrependOnlyUpdateRuntime = {
|
|
4468
|
+
append: () => void 0,
|
|
4469
|
+
commit: commitCompilerKeyedCollection,
|
|
4470
|
+
reconcile: () => void 0,
|
|
4471
|
+
prepend: reconcileCompilerKeyedArrayPrepend
|
|
4472
|
+
};
|
|
4449
4473
|
var keyedFilterPrependUpdateRuntime = {
|
|
4450
4474
|
...keyedFilterUpdateRuntime,
|
|
4451
4475
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
@@ -7652,6 +7676,14 @@ var keyedRowsFilterHintedRuntimeFeature = {
|
|
|
7652
7676
|
})
|
|
7653
7677
|
})
|
|
7654
7678
|
};
|
|
7679
|
+
var keyedRowsFilterOnlyRuntimeFeature = {
|
|
7680
|
+
name: "keyed-rows:filter-only",
|
|
7681
|
+
create: (owner) => ({
|
|
7682
|
+
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7683
|
+
keyedUpdates: keyedFilterOnlyUpdateRuntime
|
|
7684
|
+
})
|
|
7685
|
+
})
|
|
7686
|
+
};
|
|
7655
7687
|
var keyedRowsIdentityFilterHintedRuntimeFeature = {
|
|
7656
7688
|
name: "keyed-rows:identity-filter-hinted",
|
|
7657
7689
|
create: (owner) => ({
|
|
@@ -7710,6 +7742,14 @@ var keyedRowsPrependHintedRuntimeFeature = {
|
|
|
7710
7742
|
})
|
|
7711
7743
|
})
|
|
7712
7744
|
};
|
|
7745
|
+
var keyedRowsPrependOnlyRuntimeFeature = {
|
|
7746
|
+
name: "keyed-rows:prepend-only",
|
|
7747
|
+
create: (owner) => ({
|
|
7748
|
+
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7749
|
+
keyedUpdates: keyedPrependOnlyUpdateRuntime
|
|
7750
|
+
})
|
|
7751
|
+
})
|
|
7752
|
+
};
|
|
7713
7753
|
var keyedRowsFilterPrependHintedRuntimeFeature = {
|
|
7714
7754
|
name: "keyed-rows:filter-prepend-hinted",
|
|
7715
7755
|
create: (owner) => ({
|
|
@@ -8785,6 +8825,7 @@ exports.keyedRowsConditionalWindowEveryHintedRuntimeFeature = keyedRowsCondition
|
|
|
8785
8825
|
exports.keyedRowsConditionalWindowPositionHintedRuntimeFeature = keyedRowsConditionalWindowPositionHintedRuntimeFeature;
|
|
8786
8826
|
exports.keyedRowsEveryHintedRuntimeFeature = keyedRowsEveryHintedRuntimeFeature;
|
|
8787
8827
|
exports.keyedRowsFilterHintedRuntimeFeature = keyedRowsFilterHintedRuntimeFeature;
|
|
8828
|
+
exports.keyedRowsFilterOnlyRuntimeFeature = keyedRowsFilterOnlyRuntimeFeature;
|
|
8788
8829
|
exports.keyedRowsFilterPrependHintedRuntimeFeature = keyedRowsFilterPrependHintedRuntimeFeature;
|
|
8789
8830
|
exports.keyedRowsHintedRuntimeFeature = keyedRowsHintedRuntimeFeature;
|
|
8790
8831
|
exports.keyedRowsHostAllHintedRuntimeFeature = keyedRowsHostAllHintedRuntimeFeature;
|
|
@@ -8815,6 +8856,7 @@ exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
|
|
|
8815
8856
|
exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
|
|
8816
8857
|
exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
|
|
8817
8858
|
exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;
|
|
8859
|
+
exports.keyedRowsPrependOnlyRuntimeFeature = keyedRowsPrependOnlyRuntimeFeature;
|
|
8818
8860
|
exports.keyedRowsReorderHintedRuntimeFeature = keyedRowsReorderHintedRuntimeFeature;
|
|
8819
8861
|
exports.keyedRowsRuntimeFeature = keyedRowsRuntimeFeature;
|
|
8820
8862
|
exports.keyedRowsStructuralAppendHintedRuntimeFeature = keyedRowsStructuralAppendHintedRuntimeFeature;
|