@farm.js/react 0.1.0-beta.31 → 0.1.0-beta.33
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/dist/client.d.mts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/compiler-runtime.cjs +70 -35
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +4 -1
- package/dist/compiler-runtime.d.ts +4 -1
- package/dist/compiler-runtime.mjs +70 -36
- 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 +72 -12
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +72 -12
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -3
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -1766,8 +1766,11 @@ var JAVASCRIPT_URL = (
|
|
|
1766
1766
|
);
|
|
1767
1767
|
var BLOCKS_JAVASCRIPT_URLS = Number.parseInt(React__default.default.version, 10) > 18;
|
|
1768
1768
|
function compilerAttributeValue(element, name, value) {
|
|
1769
|
+
if (!BLOCKS_JAVASCRIPT_URLS || name !== "href" && name !== "src" && name !== "action" && name !== "formAction" && name !== "data") {
|
|
1770
|
+
return value;
|
|
1771
|
+
}
|
|
1769
1772
|
const tag = element.localName;
|
|
1770
|
-
return
|
|
1773
|
+
return (name !== "data" || tag === "object") && !tag.includes("-") && JAVASCRIPT_URL.test(value) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : value;
|
|
1771
1774
|
}
|
|
1772
1775
|
function createConditionalBlockComponent(owner) {
|
|
1773
1776
|
class FarmConditionalBlock extends React__default.default.Component {
|
|
@@ -2547,7 +2550,7 @@ function readKeyedRowBindingValues(props, item, index) {
|
|
|
2547
2550
|
var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
|
|
2548
2551
|
function createKeyedRowInstance(props, document, key, item, index) {
|
|
2549
2552
|
const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
|
|
2550
|
-
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));
|
|
2551
2554
|
const instance = {
|
|
2552
2555
|
key,
|
|
2553
2556
|
element,
|
|
@@ -2557,16 +2560,21 @@ function createKeyedRowInstance(props, document, key, item, index) {
|
|
|
2557
2560
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2558
2561
|
};
|
|
2559
2562
|
if (props.cloneRows) {
|
|
2560
|
-
|
|
2563
|
+
let targets = props.targets?.(element);
|
|
2561
2564
|
let found = true;
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2565
|
+
if (!targets || targets.length !== props.bindings.length || !props.bindings.every((_, index2) => targets[index2] != null)) {
|
|
2566
|
+
targets = [];
|
|
2567
|
+
for (const binding of props.bindings) {
|
|
2568
|
+
const target = findCompilerHostTarget(element, binding.path);
|
|
2569
|
+
found && (found = target !== null);
|
|
2570
|
+
targets.push(target);
|
|
2571
|
+
}
|
|
2566
2572
|
}
|
|
2567
2573
|
if (found) instance.targets = targets;
|
|
2568
2574
|
if (template) {
|
|
2569
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;
|
|
2570
2578
|
commitKeyedRowBinding(
|
|
2571
2579
|
props.bindings[bindingIndex],
|
|
2572
2580
|
instance,
|
|
@@ -2592,10 +2600,20 @@ function keyedRowTemplate(props, element, targets) {
|
|
|
2592
2600
|
}
|
|
2593
2601
|
}
|
|
2594
2602
|
const template = element.cloneNode(true);
|
|
2595
|
-
|
|
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];
|
|
2596
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
|
+
}
|
|
2597
2615
|
}
|
|
2598
|
-
return template;
|
|
2616
|
+
return { element: template, classNames };
|
|
2599
2617
|
}
|
|
2600
2618
|
function applyKeyedRowBindings(props, instance, item, index) {
|
|
2601
2619
|
if (props.bindings.length < 2) {
|
|
@@ -6154,14 +6172,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6154
6172
|
const eventTarget = event.target;
|
|
6155
6173
|
if (!instance || !eventTarget) return;
|
|
6156
6174
|
const capture = name.endsWith("Capture");
|
|
6157
|
-
const
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
)
|
|
6164
|
-
|
|
6175
|
+
const descriptors = this.currentProps.events || [];
|
|
6176
|
+
const matches = [];
|
|
6177
|
+
for (let index = 0, length = descriptors.length; index < length; index += 1) {
|
|
6178
|
+
if (!(index in descriptors)) continue;
|
|
6179
|
+
const descriptor = descriptors[index];
|
|
6180
|
+
if (descriptor.name !== name || descriptor.path === void 0) continue;
|
|
6181
|
+
const target = findCompilerHostTarget(instance.element, descriptor.path || []);
|
|
6182
|
+
if (target && (target === eventTarget || target.contains(eventTarget))) {
|
|
6183
|
+
matches.push({ descriptor, target });
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
matches.sort(
|
|
6165
6187
|
(left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
|
|
6166
6188
|
);
|
|
6167
6189
|
for (const match of matches) {
|
|
@@ -6665,22 +6687,24 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6665
6687
|
} else {
|
|
6666
6688
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6667
6689
|
}
|
|
6668
|
-
|
|
6669
|
-
this.
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
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
|
+
}
|
|
6681
6705
|
}
|
|
6706
|
+
existing.conditionalValues = conditionalValues;
|
|
6682
6707
|
}
|
|
6683
|
-
existing.conditionalValues = conditionalValues;
|
|
6684
6708
|
existing.item = rows.items[index];
|
|
6685
6709
|
existing.index = index;
|
|
6686
6710
|
}
|
|
@@ -6885,10 +6909,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6885
6909
|
let oldIndex = 0;
|
|
6886
6910
|
for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
|
|
6887
6911
|
}
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6912
|
+
if (hasSurvivingRows || options.hostBlocks) {
|
|
6913
|
+
for (const [key, instance] of this.instances) {
|
|
6914
|
+
if (!nextKeys.has(key)) {
|
|
6915
|
+
instance.scope?.cleanup();
|
|
6916
|
+
if (hasSurvivingRows) instance.element.remove();
|
|
6917
|
+
}
|
|
6892
6918
|
}
|
|
6893
6919
|
}
|
|
6894
6920
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
|
|
@@ -7643,6 +7669,14 @@ var keyedRowsPlainReorderHintedRuntimeFeature = {
|
|
|
7643
7669
|
})
|
|
7644
7670
|
})
|
|
7645
7671
|
};
|
|
7672
|
+
var keyedRowsPlainMapReorderHintedRuntimeFeature = {
|
|
7673
|
+
name: "keyed-rows:plain-map-reorder-hinted",
|
|
7674
|
+
create: (owner) => ({
|
|
7675
|
+
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7676
|
+
keyedUpdates: keyedMapReorderUpdateRuntime
|
|
7677
|
+
})
|
|
7678
|
+
})
|
|
7679
|
+
};
|
|
7646
7680
|
var keyedRowsMapReorderHintedRuntimeFeature = {
|
|
7647
7681
|
name: "keyed-rows:map-reorder-hinted",
|
|
7648
7682
|
create: (owner) => ({
|
|
@@ -8867,6 +8901,7 @@ exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
|
|
|
8867
8901
|
exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
|
|
8868
8902
|
exports.keyedRowsMappedRollingWindowHintedRuntimeFeature = keyedRowsMappedRollingWindowHintedRuntimeFeature;
|
|
8869
8903
|
exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
|
|
8904
|
+
exports.keyedRowsPlainMapReorderHintedRuntimeFeature = keyedRowsPlainMapReorderHintedRuntimeFeature;
|
|
8870
8905
|
exports.keyedRowsPlainReorderHintedRuntimeFeature = keyedRowsPlainReorderHintedRuntimeFeature;
|
|
8871
8906
|
exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
|
|
8872
8907
|
exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
|