@farm.js/react 0.1.0-beta.31 → 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 +30 -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 +30 -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
|
@@ -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 {
|
|
@@ -2557,12 +2560,15 @@ 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) {
|
|
@@ -6154,14 +6160,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6154
6160
|
const eventTarget = event.target;
|
|
6155
6161
|
if (!instance || !eventTarget) return;
|
|
6156
6162
|
const capture = name.endsWith("Capture");
|
|
6157
|
-
const
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
)
|
|
6164
|
-
|
|
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(
|
|
6165
6175
|
(left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
|
|
6166
6176
|
);
|
|
6167
6177
|
for (const match of matches) {
|
|
@@ -6885,10 +6895,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6885
6895
|
let oldIndex = 0;
|
|
6886
6896
|
for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
|
|
6887
6897
|
}
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
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
|
+
}
|
|
6892
6904
|
}
|
|
6893
6905
|
}
|
|
6894
6906
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
|