domql 1.6.56 → 1.6.58
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/cjs/element/iterate.js +9 -3
- package/dist/esm/index.js +29 -3
- package/dist/iife/index.js +29 -3
- package/package.json +1 -1
- package/src/element/iterate.js +4 -1
|
@@ -49,9 +49,15 @@ const throughUpdatedExec = (element, options = { excludes: import_utils2.METHODS
|
|
|
49
49
|
continue;
|
|
50
50
|
const newExec = ref.__exec[param](element, element.state, element.context);
|
|
51
51
|
const execReturnsString = (0, import_utils.isString)(newExec) || (0, import_utils.isNumber)(newExec);
|
|
52
|
-
if (prop && prop.node
|
|
53
|
-
(
|
|
54
|
-
|
|
52
|
+
if (prop && prop.node) {
|
|
53
|
+
if (execReturnsString) {
|
|
54
|
+
(0, import_utils2.overwrite)(prop, { text: newExec }, options);
|
|
55
|
+
} else if ((0, import_utils2.checkIfKeyIsComponent)(param)) {
|
|
56
|
+
const { extend, ...newElem } = (0, import_utils2.extendizeByKey)(newExec, element, param);
|
|
57
|
+
console.log(newElem);
|
|
58
|
+
(0, import_utils2.overwrite)(prop, newElem, options);
|
|
59
|
+
}
|
|
60
|
+
} else if (!execReturnsString && newExec !== prop) {
|
|
55
61
|
ref.__cached[param] = changes[param] = prop;
|
|
56
62
|
element[param] = newExec;
|
|
57
63
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -2590,6 +2590,7 @@ var require_string2 = __commonJS({
|
|
|
2590
2590
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
2591
2591
|
var string_exports = {};
|
|
2592
2592
|
__export2(string_exports, {
|
|
2593
|
+
replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
|
|
2593
2594
|
stringIncludesAny: () => stringIncludesAny
|
|
2594
2595
|
});
|
|
2595
2596
|
module.exports = __toCommonJS2(string_exports);
|
|
@@ -2601,6 +2602,25 @@ var require_string2 = __commonJS({
|
|
|
2601
2602
|
}
|
|
2602
2603
|
return false;
|
|
2603
2604
|
};
|
|
2605
|
+
var replaceLiteralsWithObjectFields = (str, state2) => {
|
|
2606
|
+
return str.replace(/\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g, (_, parentPath, variable) => {
|
|
2607
|
+
if (parentPath) {
|
|
2608
|
+
const parentLevels = parentPath.match(/\.\.\//g).length;
|
|
2609
|
+
let parentState = state2;
|
|
2610
|
+
for (let i = 0; i < parentLevels; i++) {
|
|
2611
|
+
parentState = parentState.parent;
|
|
2612
|
+
if (!parentState) {
|
|
2613
|
+
return "";
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
const value = parentState[variable.trim()];
|
|
2617
|
+
return value !== void 0 ? `${value}` : "";
|
|
2618
|
+
} else {
|
|
2619
|
+
const value = state2[variable.trim()];
|
|
2620
|
+
return value !== void 0 ? `${value}` : "";
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
};
|
|
2604
2624
|
}
|
|
2605
2625
|
});
|
|
2606
2626
|
|
|
@@ -5304,9 +5324,15 @@ var throughUpdatedExec = (element, options = { excludes: METHODS_EXL }) => {
|
|
|
5304
5324
|
continue;
|
|
5305
5325
|
const newExec = ref.__exec[param](element, element.state, element.context);
|
|
5306
5326
|
const execReturnsString = (0, import_utils7.isString)(newExec) || (0, import_utils7.isNumber)(newExec);
|
|
5307
|
-
if (prop && prop.node
|
|
5308
|
-
|
|
5309
|
-
|
|
5327
|
+
if (prop && prop.node) {
|
|
5328
|
+
if (execReturnsString) {
|
|
5329
|
+
overwrite(prop, { text: newExec }, options);
|
|
5330
|
+
} else if (checkIfKeyIsComponent(param)) {
|
|
5331
|
+
const { extend, ...newElem } = extendizeByKey(newExec, element, param);
|
|
5332
|
+
console.log(newElem);
|
|
5333
|
+
overwrite(prop, newElem, options);
|
|
5334
|
+
}
|
|
5335
|
+
} else if (!execReturnsString && newExec !== prop) {
|
|
5310
5336
|
ref.__cached[param] = changes[param] = prop;
|
|
5311
5337
|
element[param] = newExec;
|
|
5312
5338
|
}
|
package/dist/iife/index.js
CHANGED
|
@@ -2592,6 +2592,7 @@ ${element}` : ""
|
|
|
2592
2592
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
2593
2593
|
var string_exports = {};
|
|
2594
2594
|
__export2(string_exports, {
|
|
2595
|
+
replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
|
|
2595
2596
|
stringIncludesAny: () => stringIncludesAny
|
|
2596
2597
|
});
|
|
2597
2598
|
module.exports = __toCommonJS2(string_exports);
|
|
@@ -2603,6 +2604,25 @@ ${element}` : ""
|
|
|
2603
2604
|
}
|
|
2604
2605
|
return false;
|
|
2605
2606
|
};
|
|
2607
|
+
var replaceLiteralsWithObjectFields = (str, state2) => {
|
|
2608
|
+
return str.replace(/\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g, (_, parentPath, variable) => {
|
|
2609
|
+
if (parentPath) {
|
|
2610
|
+
const parentLevels = parentPath.match(/\.\.\//g).length;
|
|
2611
|
+
let parentState = state2;
|
|
2612
|
+
for (let i = 0; i < parentLevels; i++) {
|
|
2613
|
+
parentState = parentState.parent;
|
|
2614
|
+
if (!parentState) {
|
|
2615
|
+
return "";
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
const value = parentState[variable.trim()];
|
|
2619
|
+
return value !== void 0 ? `${value}` : "";
|
|
2620
|
+
} else {
|
|
2621
|
+
const value = state2[variable.trim()];
|
|
2622
|
+
return value !== void 0 ? `${value}` : "";
|
|
2623
|
+
}
|
|
2624
|
+
});
|
|
2625
|
+
};
|
|
2606
2626
|
}
|
|
2607
2627
|
});
|
|
2608
2628
|
|
|
@@ -5306,9 +5326,15 @@ ${element}` : ""
|
|
|
5306
5326
|
continue;
|
|
5307
5327
|
const newExec = ref.__exec[param](element, element.state, element.context);
|
|
5308
5328
|
const execReturnsString = (0, import_utils7.isString)(newExec) || (0, import_utils7.isNumber)(newExec);
|
|
5309
|
-
if (prop && prop.node
|
|
5310
|
-
|
|
5311
|
-
|
|
5329
|
+
if (prop && prop.node) {
|
|
5330
|
+
if (execReturnsString) {
|
|
5331
|
+
overwrite(prop, { text: newExec }, options);
|
|
5332
|
+
} else if (checkIfKeyIsComponent(param)) {
|
|
5333
|
+
const { extend, ...newElem } = extendizeByKey(newExec, element, param);
|
|
5334
|
+
console.log(newElem);
|
|
5335
|
+
overwrite(prop, newElem, options);
|
|
5336
|
+
}
|
|
5337
|
+
} else if (!execReturnsString && newExec !== prop) {
|
|
5312
5338
|
ref.__cached[param] = changes[param] = prop;
|
|
5313
5339
|
element[param] = newExec;
|
|
5314
5340
|
}
|
package/package.json
CHANGED
package/src/element/iterate.js
CHANGED
|
@@ -33,8 +33,11 @@ export const throughUpdatedExec = (element, options = { excludes: METHODS_EXL })
|
|
|
33
33
|
if (execReturnsString) {
|
|
34
34
|
overwrite(prop, { text: newExec }, options)
|
|
35
35
|
} else if (checkIfKeyIsComponent(param)) {
|
|
36
|
-
const { extend, ...newElem } = extendizeByKey(newExec)
|
|
36
|
+
const { extend, ...newElem } = extendizeByKey(newExec, element, param)
|
|
37
|
+
console.log(newElem)
|
|
37
38
|
overwrite(prop, newElem, options)
|
|
39
|
+
} else {
|
|
40
|
+
overwrite(prop, newExec, options)
|
|
38
41
|
}
|
|
39
42
|
} else if (!execReturnsString && newExec !== prop) {
|
|
40
43
|
ref.__cached[param] = changes[param] = prop
|