@domql/element 3.7.3 → 3.7.4
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/mixins/attr.js +4 -1
- package/dist/cjs/mixins/html.js +4 -1
- package/dist/esm/mixins/attr.js +5 -2
- package/dist/esm/mixins/html.js +5 -2
- package/dist/iife/index.js +15 -6
- package/mixins/attr.js +5 -2
- package/mixins/html.js +5 -2
- package/package.json +5 -5
package/dist/cjs/mixins/attr.js
CHANGED
|
@@ -32,7 +32,10 @@ function attr(params, element, node) {
|
|
|
32
32
|
const attrs = (0, import_utils.exec)(params, element);
|
|
33
33
|
if (props.attr) (0, import_utils.deepMerge)(attrs, props.attr);
|
|
34
34
|
for (const attr2 in attrs) {
|
|
35
|
-
|
|
35
|
+
let val = (0, import_utils.exec)(attrs[attr2], element);
|
|
36
|
+
if ((0, import_utils.isString)(val) && val.includes("{{") && element.call) {
|
|
37
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
38
|
+
}
|
|
36
39
|
if (val === __attr[attr2]) continue;
|
|
37
40
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
38
41
|
node.setAttribute(attr2, val);
|
package/dist/cjs/mixins/html.js
CHANGED
|
@@ -24,7 +24,10 @@ __export(html_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(html_exports);
|
|
25
25
|
var import_utils = require("@domql/utils");
|
|
26
26
|
function html(param, element, node) {
|
|
27
|
-
|
|
27
|
+
let prop = (0, import_utils.exec)(param ?? element?.props?.html, element);
|
|
28
|
+
if ((0, import_utils.isString)(prop) && prop.includes("{{") && element.call) {
|
|
29
|
+
prop = element.call("replaceLiteralsWithObjectFields", prop, element.state);
|
|
30
|
+
}
|
|
28
31
|
const { __ref } = element;
|
|
29
32
|
if (prop !== __ref.__html) {
|
|
30
33
|
if (node.nodeName === "SVG") node.textContent = prop;
|
package/dist/esm/mixins/attr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deepMerge, exec, isNot } from "@domql/utils";
|
|
1
|
+
import { deepMerge, exec, isNot, isString } from "@domql/utils";
|
|
2
2
|
import { report } from "@domql/report";
|
|
3
3
|
function attr(params, element, node) {
|
|
4
4
|
const { __ref: ref, props } = element;
|
|
@@ -8,7 +8,10 @@ function attr(params, element, node) {
|
|
|
8
8
|
const attrs = exec(params, element);
|
|
9
9
|
if (props.attr) deepMerge(attrs, props.attr);
|
|
10
10
|
for (const attr2 in attrs) {
|
|
11
|
-
|
|
11
|
+
let val = exec(attrs[attr2], element);
|
|
12
|
+
if (isString(val) && val.includes("{{") && element.call) {
|
|
13
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
14
|
+
}
|
|
12
15
|
if (val === __attr[attr2]) continue;
|
|
13
16
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
14
17
|
node.setAttribute(attr2, val);
|
package/dist/esm/mixins/html.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { exec } from "@domql/utils";
|
|
1
|
+
import { exec, isString } from "@domql/utils";
|
|
2
2
|
function html(param, element, node) {
|
|
3
|
-
|
|
3
|
+
let prop = exec(param ?? element?.props?.html, element);
|
|
4
|
+
if (isString(prop) && prop.includes("{{") && element.call) {
|
|
5
|
+
prop = element.call("replaceLiteralsWithObjectFields", prop, element.state);
|
|
6
|
+
}
|
|
4
7
|
const { __ref } = element;
|
|
5
8
|
if (prop !== __ref.__html) {
|
|
6
9
|
if (node.nodeName === "SVG") node.textContent = prop;
|
package/dist/iife/index.js
CHANGED
|
@@ -1080,14 +1080,17 @@ var DomqlElement = (() => {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
return element;
|
|
1082
1082
|
};
|
|
1083
|
-
trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
1083
|
+
trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
1084
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
1085
|
+
if (seen.has(obj)) return;
|
|
1086
|
+
seen.add(obj);
|
|
1084
1087
|
for (const key in obj) {
|
|
1085
1088
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
1086
1089
|
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
1087
1090
|
const val = obj[key];
|
|
1088
1091
|
if (isObject(val) && !isArray(val)) {
|
|
1089
1092
|
sourcemap[key] = sourcemap[key] || {};
|
|
1090
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
1093
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen);
|
|
1091
1094
|
} else {
|
|
1092
1095
|
sourcemap[key] = sourceName;
|
|
1093
1096
|
}
|
|
@@ -3451,12 +3454,12 @@ var DomqlElement = (() => {
|
|
|
3451
3454
|
const result = fn.call(this, ...args);
|
|
3452
3455
|
if (result && typeof result.then === "function") {
|
|
3453
3456
|
result.catch((err) => {
|
|
3454
|
-
this
|
|
3457
|
+
error.call(this, err);
|
|
3455
3458
|
});
|
|
3456
3459
|
}
|
|
3457
3460
|
return result;
|
|
3458
3461
|
} catch (err) {
|
|
3459
|
-
this
|
|
3462
|
+
error.call(this, err);
|
|
3460
3463
|
if (context?.strictMode) throw err;
|
|
3461
3464
|
}
|
|
3462
3465
|
}
|
|
@@ -4299,7 +4302,10 @@ ${element}` : "";
|
|
|
4299
4302
|
const attrs = exec(params, element);
|
|
4300
4303
|
if (props.attr) deepMerge(attrs, props.attr);
|
|
4301
4304
|
for (const attr2 in attrs) {
|
|
4302
|
-
|
|
4305
|
+
let val = exec(attrs[attr2], element);
|
|
4306
|
+
if (isString(val) && val.includes("{{") && element.call) {
|
|
4307
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
4308
|
+
}
|
|
4303
4309
|
if (val === __attr[attr2]) continue;
|
|
4304
4310
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
4305
4311
|
node.setAttribute(attr2, val);
|
|
@@ -4360,7 +4366,10 @@ ${element}` : "";
|
|
|
4360
4366
|
// mixins/html.js
|
|
4361
4367
|
init_esm();
|
|
4362
4368
|
function html(param, element, node) {
|
|
4363
|
-
|
|
4369
|
+
let prop = exec(param ?? element?.props?.html, element);
|
|
4370
|
+
if (isString(prop) && prop.includes("{{") && element.call) {
|
|
4371
|
+
prop = element.call("replaceLiteralsWithObjectFields", prop, element.state);
|
|
4372
|
+
}
|
|
4364
4373
|
const { __ref } = element;
|
|
4365
4374
|
if (prop !== __ref.__html) {
|
|
4366
4375
|
if (node.nodeName === "SVG") node.textContent = prop;
|
package/mixins/attr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { deepMerge, exec, isNot } from '@domql/utils'
|
|
3
|
+
import { deepMerge, exec, isNot, isString } from '@domql/utils'
|
|
4
4
|
import { report } from '@domql/report'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,7 +14,10 @@ export function attr (params, element, node) {
|
|
|
14
14
|
const attrs = exec(params, element)
|
|
15
15
|
if (props.attr) deepMerge(attrs, props.attr)
|
|
16
16
|
for (const attr in attrs) {
|
|
17
|
-
|
|
17
|
+
let val = exec(attrs[attr], element)
|
|
18
|
+
if (isString(val) && val.includes('{{') && element.call) {
|
|
19
|
+
val = element.call('replaceLiteralsWithObjectFields', val, element.state)
|
|
20
|
+
}
|
|
18
21
|
if (val === __attr[attr]) continue
|
|
19
22
|
if (
|
|
20
23
|
val !== false &&
|
package/mixins/html.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { exec } from '@domql/utils'
|
|
3
|
+
import { exec, isString } from '@domql/utils'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Appends raw HTML as content
|
|
7
7
|
* an original one as a child
|
|
8
8
|
*/
|
|
9
9
|
export function html (param, element, node) {
|
|
10
|
-
|
|
10
|
+
let prop = exec(param ?? element?.props?.html, element)
|
|
11
|
+
if (isString(prop) && prop.includes('{{') && element.call) {
|
|
12
|
+
prop = element.call('replaceLiteralsWithObjectFields', prop, element.state)
|
|
13
|
+
}
|
|
11
14
|
const { __ref } = element
|
|
12
15
|
if (prop !== __ref.__html) {
|
|
13
16
|
if (node.nodeName === 'SVG') node.textContent = prop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.4",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=DomqlElement --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@domql/report": "^3.7.
|
|
50
|
-
"@domql/state": "^3.7.
|
|
51
|
-
"@domql/utils": "^3.7.
|
|
52
|
-
"attrs-in-props": "^3.7.
|
|
49
|
+
"@domql/report": "^3.7.4",
|
|
50
|
+
"@domql/state": "^3.7.4",
|
|
51
|
+
"@domql/utils": "^3.7.4",
|
|
52
|
+
"attrs-in-props": "^3.7.4"
|
|
53
53
|
},
|
|
54
54
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
55
55
|
"devDependencies": {
|