@farm.js/react 0.1.0-beta.30 → 0.1.0-beta.32
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/compiler-runtime.cjs +33 -18
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +2 -0
- package/dist/compiler-runtime.d.ts +2 -0
- package/dist/compiler-runtime.mjs +33 -18
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +69 -12
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +69 -12
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1731,6 +1731,9 @@ function updateAttribute(element, name, value) {
|
|
|
1731
1731
|
if (name === "value" && (isInputElement(element) || isTextAreaElement(element))) {
|
|
1732
1732
|
const nextValue = value === null || value === void 0 ? "" : String(value);
|
|
1733
1733
|
if (element.value !== nextValue) element.value = nextValue;
|
|
1734
|
+
if (value != null && isInputElement(element) && (element.type !== "number" || element.ownerDocument.activeElement !== element) && element.defaultValue !== nextValue) {
|
|
1735
|
+
element.defaultValue = nextValue;
|
|
1736
|
+
}
|
|
1734
1737
|
return;
|
|
1735
1738
|
}
|
|
1736
1739
|
if (name === "value" && isSelectElement(element)) {
|
|
@@ -1763,8 +1766,11 @@ var JAVASCRIPT_URL = (
|
|
|
1763
1766
|
);
|
|
1764
1767
|
var BLOCKS_JAVASCRIPT_URLS = Number.parseInt(React__default.default.version, 10) > 18;
|
|
1765
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
|
+
}
|
|
1766
1772
|
const tag = element.localName;
|
|
1767
|
-
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;
|
|
1768
1774
|
}
|
|
1769
1775
|
function createConditionalBlockComponent(owner) {
|
|
1770
1776
|
class FarmConditionalBlock extends React__default.default.Component {
|
|
@@ -2554,12 +2560,15 @@ function createKeyedRowInstance(props, document, key, item, index) {
|
|
|
2554
2560
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2555
2561
|
};
|
|
2556
2562
|
if (props.cloneRows) {
|
|
2557
|
-
|
|
2563
|
+
let targets = props.targets?.(element);
|
|
2558
2564
|
let found = true;
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
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
|
+
}
|
|
2563
2572
|
}
|
|
2564
2573
|
if (found) instance.targets = targets;
|
|
2565
2574
|
if (template) {
|
|
@@ -6151,14 +6160,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6151
6160
|
const eventTarget = event.target;
|
|
6152
6161
|
if (!instance || !eventTarget) return;
|
|
6153
6162
|
const capture = name.endsWith("Capture");
|
|
6154
|
-
const
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
)
|
|
6161
|
-
|
|
6163
|
+
const descriptors = this.currentProps.events || [];
|
|
6164
|
+
const matches = [];
|
|
6165
|
+
for (let index = 0, length = descriptors.length; index < length; index += 1) {
|
|
6166
|
+
if (!(index in descriptors)) continue;
|
|
6167
|
+
const descriptor = descriptors[index];
|
|
6168
|
+
if (descriptor.name !== name || descriptor.path === void 0) continue;
|
|
6169
|
+
const target = findCompilerHostTarget(instance.element, descriptor.path || []);
|
|
6170
|
+
if (target && (target === eventTarget || target.contains(eventTarget))) {
|
|
6171
|
+
matches.push({ descriptor, target });
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
matches.sort(
|
|
6162
6175
|
(left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
|
|
6163
6176
|
);
|
|
6164
6177
|
for (const match of matches) {
|
|
@@ -6882,10 +6895,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6882
6895
|
let oldIndex = 0;
|
|
6883
6896
|
for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
|
|
6884
6897
|
}
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6898
|
+
if (hasSurvivingRows || options.hostBlocks) {
|
|
6899
|
+
for (const [key, instance] of this.instances) {
|
|
6900
|
+
if (!nextKeys.has(key)) {
|
|
6901
|
+
instance.scope?.cleanup();
|
|
6902
|
+
if (hasSurvivingRows) instance.element.remove();
|
|
6903
|
+
}
|
|
6889
6904
|
}
|
|
6890
6905
|
}
|
|
6891
6906
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
|