@farm.js/react 0.1.0-beta.32 → 0.1.0-beta.34
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 +7 -0
- package/dist/client.d.mts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/compiler-runtime.cjs +49 -17
- 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 +48 -18
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/server.d.mts +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/vite.cjs +6 -0
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +6 -0
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -518,6 +518,13 @@ setItems((current) => current.toSpliced(firstIndex, 25, ...firstRefresh));
|
|
|
518
518
|
setItems((current) => current.toSpliced(secondIndex, 25, ...secondRefresh));
|
|
519
519
|
```
|
|
520
520
|
|
|
521
|
+
When every keyed list in a component is plain and has no identity, `Set` membership, or `Map`
|
|
522
|
+
lookup targets, single-item position hints (including range removal) select a smaller runtime
|
|
523
|
+
without target tracking. Ordinary map and append updates and complete reconciliation remain
|
|
524
|
+
available. Any sibling with targets, conditional content, host scopes, or broader structural hints
|
|
525
|
+
retains the corresponding full-capability runtime. Batch insertion and window replacement keep
|
|
526
|
+
their existing runtimes. This changes payload size, not array-method or React behavior.
|
|
527
|
+
|
|
521
528
|
The compiler recognizes a concise functional setter or a setter block containing exactly one direct
|
|
522
529
|
`return`. Its position must be either a safe-integer literal or a compiler-safe runtime expression,
|
|
523
530
|
such as an identifier, property read, arithmetic, conditional, or safe `Math` call. The update must insert
|
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -2550,7 +2550,7 @@ function readKeyedRowBindingValues(props, item, index) {
|
|
|
2550
2550
|
var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
|
|
2551
2551
|
function createKeyedRowInstance(props, document, key, item, index) {
|
|
2552
2552
|
const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
|
|
2553
|
-
const element = template ? template.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
|
|
2553
|
+
const element = template ? template.element.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
|
|
2554
2554
|
const instance = {
|
|
2555
2555
|
key,
|
|
2556
2556
|
element,
|
|
@@ -2573,6 +2573,8 @@ function createKeyedRowInstance(props, document, key, item, index) {
|
|
|
2573
2573
|
if (found) instance.targets = targets;
|
|
2574
2574
|
if (template) {
|
|
2575
2575
|
for (let bindingIndex = 0; bindingIndex < targets.length; bindingIndex += 1) {
|
|
2576
|
+
const value = instance.values[bindingIndex];
|
|
2577
|
+
if (typeof value === "string" && value === template.classNames[bindingIndex]) continue;
|
|
2576
2578
|
commitKeyedRowBinding(
|
|
2577
2579
|
props.bindings[bindingIndex],
|
|
2578
2580
|
instance,
|
|
@@ -2598,10 +2600,20 @@ function keyedRowTemplate(props, element, targets) {
|
|
|
2598
2600
|
}
|
|
2599
2601
|
}
|
|
2600
2602
|
const template = element.cloneNode(true);
|
|
2601
|
-
|
|
2603
|
+
const classNames = [];
|
|
2604
|
+
const classTargets = /* @__PURE__ */ new Set();
|
|
2605
|
+
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
2606
|
+
const binding = props.bindings[bindingIndex];
|
|
2602
2607
|
if (binding.kind === "text") findCompilerHostTarget(template, binding.path).textContent = "";
|
|
2608
|
+
if (binding.kind === "attribute" && (binding.name === "className" || binding.name === "class")) {
|
|
2609
|
+
const target = targets[bindingIndex];
|
|
2610
|
+
if (!classTargets.has(target)) {
|
|
2611
|
+
classNames[bindingIndex] = target.getAttribute("class") ?? void 0;
|
|
2612
|
+
classTargets.add(target);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2603
2615
|
}
|
|
2604
|
-
return template;
|
|
2616
|
+
return { element: template, classNames };
|
|
2605
2617
|
}
|
|
2606
2618
|
function applyKeyedRowBindings(props, instance, item, index) {
|
|
2607
2619
|
if (props.bindings.length < 2) {
|
|
@@ -6675,22 +6687,24 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6675
6687
|
} else {
|
|
6676
6688
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6677
6689
|
}
|
|
6678
|
-
|
|
6679
|
-
this.
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6690
|
+
if (options.conditionals) {
|
|
6691
|
+
const conditionalValues = this.readConditionalValues(
|
|
6692
|
+
this.currentProps,
|
|
6693
|
+
rows.items[index],
|
|
6694
|
+
index
|
|
6695
|
+
);
|
|
6696
|
+
for (const [id, values] of conditionalValues) {
|
|
6697
|
+
if (options.conditionals.changed(existing.conditionalValues.get(id), values)) {
|
|
6698
|
+
conditionalChanges.push({
|
|
6699
|
+
key,
|
|
6700
|
+
id,
|
|
6701
|
+
item: rows.items[index],
|
|
6702
|
+
index
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6691
6705
|
}
|
|
6706
|
+
existing.conditionalValues = conditionalValues;
|
|
6692
6707
|
}
|
|
6693
|
-
existing.conditionalValues = conditionalValues;
|
|
6694
6708
|
existing.item = rows.items[index];
|
|
6695
6709
|
existing.index = index;
|
|
6696
6710
|
}
|
|
@@ -7623,6 +7637,14 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
7623
7637
|
})
|
|
7624
7638
|
})
|
|
7625
7639
|
};
|
|
7640
|
+
var keyedRowsPlainPositionHintedRuntimeFeature = {
|
|
7641
|
+
name: "keyed-rows:plain-position-hinted",
|
|
7642
|
+
create: (owner) => ({
|
|
7643
|
+
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7644
|
+
keyedUpdates: keyedPositionUpdateRuntime
|
|
7645
|
+
})
|
|
7646
|
+
})
|
|
7647
|
+
};
|
|
7626
7648
|
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
7627
7649
|
name: "keyed-rows:batch-position-hinted",
|
|
7628
7650
|
create: (owner) => ({
|
|
@@ -7655,6 +7677,14 @@ var keyedRowsPlainReorderHintedRuntimeFeature = {
|
|
|
7655
7677
|
})
|
|
7656
7678
|
})
|
|
7657
7679
|
};
|
|
7680
|
+
var keyedRowsPlainMapReorderHintedRuntimeFeature = {
|
|
7681
|
+
name: "keyed-rows:plain-map-reorder-hinted",
|
|
7682
|
+
create: (owner) => ({
|
|
7683
|
+
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7684
|
+
keyedUpdates: keyedMapReorderUpdateRuntime
|
|
7685
|
+
})
|
|
7686
|
+
})
|
|
7687
|
+
};
|
|
7658
7688
|
var keyedRowsMapReorderHintedRuntimeFeature = {
|
|
7659
7689
|
name: "keyed-rows:map-reorder-hinted",
|
|
7660
7690
|
create: (owner) => ({
|
|
@@ -8879,6 +8909,8 @@ exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
|
|
|
8879
8909
|
exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
|
|
8880
8910
|
exports.keyedRowsMappedRollingWindowHintedRuntimeFeature = keyedRowsMappedRollingWindowHintedRuntimeFeature;
|
|
8881
8911
|
exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
|
|
8912
|
+
exports.keyedRowsPlainMapReorderHintedRuntimeFeature = keyedRowsPlainMapReorderHintedRuntimeFeature;
|
|
8913
|
+
exports.keyedRowsPlainPositionHintedRuntimeFeature = keyedRowsPlainPositionHintedRuntimeFeature;
|
|
8882
8914
|
exports.keyedRowsPlainReorderHintedRuntimeFeature = keyedRowsPlainReorderHintedRuntimeFeature;
|
|
8883
8915
|
exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
|
|
8884
8916
|
exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
|