@domql/element 2.5.117 → 2.5.118
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/extend.js +2 -1
- package/dist/cjs/utils/component.js +6 -19
- package/dist/cjs/utils/object.js +1 -1
- package/extend.js +2 -1
- package/package.json +2 -2
- package/utils/component.js +8 -19
- package/utils/object.js +1 -1
package/dist/cjs/extend.js
CHANGED
|
@@ -28,7 +28,8 @@ let mainExtend;
|
|
|
28
28
|
const applyExtend = (element, parent, options = {}) => {
|
|
29
29
|
if ((0, import_utils.isFunction)(element))
|
|
30
30
|
element = (0, import_utils.exec)(element, parent);
|
|
31
|
-
|
|
31
|
+
const { props, __ref } = element;
|
|
32
|
+
let extend = (props == null ? void 0 : props.extends) || element.extend;
|
|
32
33
|
const context = element.context || parent.context;
|
|
33
34
|
extend = (0, import_utils2.fallbackStringExtend)(extend, context, options);
|
|
34
35
|
const extendStack = (0, import_utils2.getExtendStack)(extend, context);
|
|
@@ -33,20 +33,8 @@ __export(component_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(component_exports);
|
|
34
34
|
var import_utils = require("@domql/utils");
|
|
35
35
|
var import_extend = require("../extend");
|
|
36
|
+
var import_mixins = require("../mixins");
|
|
36
37
|
const ENV = "development";
|
|
37
|
-
const DOMQL_BUILTINS = [
|
|
38
|
-
"extend",
|
|
39
|
-
"childExtend",
|
|
40
|
-
"childExtendRecursive",
|
|
41
|
-
"define",
|
|
42
|
-
"props",
|
|
43
|
-
"state",
|
|
44
|
-
"on",
|
|
45
|
-
"if",
|
|
46
|
-
"attr",
|
|
47
|
-
"key",
|
|
48
|
-
"tag"
|
|
49
|
-
];
|
|
50
38
|
const checkIfKeyIsComponent = (key) => {
|
|
51
39
|
const isFirstKeyString = (0, import_utils.isString)(key);
|
|
52
40
|
if (!isFirstKeyString)
|
|
@@ -77,17 +65,16 @@ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
77
65
|
for (const k in el) {
|
|
78
66
|
const prop = el[k];
|
|
79
67
|
const isEvent = k.startsWith("on");
|
|
80
|
-
const isMethod = k.startsWith("$");
|
|
81
68
|
if (isEvent) {
|
|
82
69
|
const onKey = replaceOnKeys(prop);
|
|
83
70
|
newElem.on[onKey] = prop;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
}
|
|
72
|
+
const isComponent = checkIfKeyIsComponent(k);
|
|
73
|
+
const isRegistry = import_mixins.registry[k];
|
|
74
|
+
if (isComponent || isRegistry) {
|
|
88
75
|
newElem[k] = prop;
|
|
89
76
|
} else {
|
|
90
|
-
newElem[k] = prop;
|
|
77
|
+
newElem.props[k] = prop;
|
|
91
78
|
}
|
|
92
79
|
}
|
|
93
80
|
return newElem;
|
package/dist/cjs/utils/object.js
CHANGED
|
@@ -68,7 +68,7 @@ const deepClone = (obj, exclude = METHODS_EXL, seen = /* @__PURE__ */ new WeakMa
|
|
|
68
68
|
if (obj === null || typeof obj !== "object") {
|
|
69
69
|
return obj;
|
|
70
70
|
}
|
|
71
|
-
if (obj instanceof Node || obj === window || obj instanceof Document) {
|
|
71
|
+
if (obj instanceof window.Node || obj === window || obj instanceof window.Document) {
|
|
72
72
|
return obj;
|
|
73
73
|
}
|
|
74
74
|
if (seen.has(obj)) {
|
package/extend.js
CHANGED
|
@@ -20,7 +20,8 @@ let mainExtend
|
|
|
20
20
|
export const applyExtend = (element, parent, options = {}) => {
|
|
21
21
|
if (isFunction(element)) element = exec(element, parent)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const { props, __ref } = element
|
|
24
|
+
let extend = props?.extends || element.extend
|
|
24
25
|
const context = element.context || parent.context
|
|
25
26
|
|
|
26
27
|
extend = fallbackStringExtend(extend, context, options)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.118",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "latest",
|
|
32
32
|
"@domql/utils": "latest"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "984906ba70b23710f6f1a1895b41b4e8710e4c3d",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/utils/component.js
CHANGED
|
@@ -2,22 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { exec, isArray, isFunction, isObject, isString, joinArrays, overwriteDeep } from '@domql/utils'
|
|
4
4
|
import { applyExtend } from '../extend'
|
|
5
|
+
import { registry } from '../mixins'
|
|
5
6
|
const ENV = process.env.NODE_ENV
|
|
6
7
|
|
|
7
|
-
const DOMQL_BUILTINS = [
|
|
8
|
-
'extend',
|
|
9
|
-
'childExtend',
|
|
10
|
-
'childExtendRecursive',
|
|
11
|
-
'define',
|
|
12
|
-
'props',
|
|
13
|
-
'state',
|
|
14
|
-
'on',
|
|
15
|
-
'if',
|
|
16
|
-
'attr',
|
|
17
|
-
'key',
|
|
18
|
-
'tag'
|
|
19
|
-
]
|
|
20
|
-
|
|
21
8
|
export const checkIfKeyIsComponent = (key) => {
|
|
22
9
|
const isFirstKeyString = isString(key)
|
|
23
10
|
if (!isFirstKeyString) return
|
|
@@ -50,16 +37,18 @@ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
50
37
|
for (const k in el) {
|
|
51
38
|
const prop = el[k]
|
|
52
39
|
const isEvent = k.startsWith('on')
|
|
53
|
-
const isMethod = k.startsWith('$')
|
|
54
40
|
if (isEvent) {
|
|
55
41
|
const onKey = replaceOnKeys(prop)
|
|
56
42
|
newElem.on[onKey] = prop
|
|
57
|
-
} else if (!isMethod && checkIfKeyIsProperty(k)) {
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
// } else if (!isMethod && checkIfKeyIsProperty(k)) {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const isComponent = checkIfKeyIsComponent(k)
|
|
47
|
+
const isRegistry = registry[k]
|
|
48
|
+
if (isComponent || isRegistry) {
|
|
60
49
|
newElem[k] = prop
|
|
61
50
|
} else {
|
|
62
|
-
newElem[k] = prop
|
|
51
|
+
newElem.props[k] = prop
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
54
|
return newElem
|
package/utils/object.js
CHANGED
|
@@ -45,7 +45,7 @@ export const deepClone = (obj, exclude = METHODS_EXL, seen = new WeakMap()) => {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Check for DOM nodes, Window, or Document
|
|
48
|
-
if (obj instanceof Node || obj === window || obj instanceof Document) {
|
|
48
|
+
if (obj instanceof window.Node || obj === window || obj instanceof window.Document) {
|
|
49
49
|
return obj
|
|
50
50
|
}
|
|
51
51
|
|