@domql/element 2.4.8 → 2.4.10
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/create.js +12 -9
- package/dist/cjs/create.js +9 -9
- package/dist/cjs/extend.js +3 -3
- package/extend.js +3 -3
- package/package.json +2 -2
package/create.js
CHANGED
|
@@ -103,7 +103,7 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
|
|
|
103
103
|
|
|
104
104
|
// Only resolve extends, skip everything else
|
|
105
105
|
if (options.onlyResolveExtends) {
|
|
106
|
-
return
|
|
106
|
+
return onlyResolveExtends(element, parent, options)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (Object.keys(options).length) {
|
|
@@ -241,7 +241,7 @@ const addCaching = (element, parent) => {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
const
|
|
244
|
+
const onlyResolveExtends = (element, parent, options) => {
|
|
245
245
|
const { __ref } = element
|
|
246
246
|
element.tag = detectTag(element)
|
|
247
247
|
|
|
@@ -249,9 +249,9 @@ const resolveExtends = (element, parent, options) => {
|
|
|
249
249
|
if (!__ref.__attr) __ref.__attr = {}
|
|
250
250
|
|
|
251
251
|
if (!element.props) element.props = {}
|
|
252
|
-
if (!element.state) element.state = {}
|
|
252
|
+
if (!element.state) element.state = element.parent.state || {}
|
|
253
253
|
|
|
254
|
-
createState(element, parent, { skipApplyMethods: true })
|
|
254
|
+
createState(element, parent, { skipApplyMethods: true, ...options })
|
|
255
255
|
createProps(element, parent)
|
|
256
256
|
applyVariant(element, parent)
|
|
257
257
|
|
|
@@ -266,11 +266,14 @@ const resolveExtends = (element, parent, options) => {
|
|
|
266
266
|
isVariant(param)
|
|
267
267
|
) continue
|
|
268
268
|
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
const hasDefine = element.define && element.define[param]
|
|
270
|
+
const contextHasDefine = element.context && element.context.define &&
|
|
271
|
+
element.context.define[param]
|
|
272
|
+
const optionsHasDefine = options.define && options.define[param]
|
|
273
|
+
|
|
274
|
+
if (registry[param] && !optionsHasDefine) {
|
|
275
|
+
continue
|
|
276
|
+
} else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
274
277
|
create(exec(prop, element), element, param, options)
|
|
275
278
|
}
|
|
276
279
|
}
|
package/dist/cjs/create.js
CHANGED
|
@@ -100,7 +100,7 @@ const create = (element, parent, key, options = import_options.default.create ||
|
|
|
100
100
|
(0, import_extend.applyExtend)(element, parent, options);
|
|
101
101
|
element.key = assignedKey;
|
|
102
102
|
if (options.onlyResolveExtends) {
|
|
103
|
-
return
|
|
103
|
+
return onlyResolveExtends(element, parent, options);
|
|
104
104
|
}
|
|
105
105
|
if (Object.keys(options).length) {
|
|
106
106
|
import_mixins.registry.defaultOptions = options;
|
|
@@ -200,7 +200,7 @@ const addCaching = (element, parent) => {
|
|
|
200
200
|
ref.__path = parentRef.__path.concat(element.key);
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
|
-
const
|
|
203
|
+
const onlyResolveExtends = (element, parent, options) => {
|
|
204
204
|
const { __ref } = element;
|
|
205
205
|
element.tag = (0, import_node2.detectTag)(element);
|
|
206
206
|
if (!__ref.__exec)
|
|
@@ -210,8 +210,8 @@ const resolveExtends = (element, parent, options) => {
|
|
|
210
210
|
if (!element.props)
|
|
211
211
|
element.props = {};
|
|
212
212
|
if (!element.state)
|
|
213
|
-
element.state = {};
|
|
214
|
-
(0, import_state.createState)(element, parent, { skipApplyMethods: true });
|
|
213
|
+
element.state = element.parent.state || {};
|
|
214
|
+
(0, import_state.createState)(element, parent, { skipApplyMethods: true, ...options });
|
|
215
215
|
(0, import_props.createProps)(element, parent);
|
|
216
216
|
(0, import_component.applyVariant)(element, parent);
|
|
217
217
|
(0, import_iterate.throughInitialExec)(element, options.propsExcludedFromExec);
|
|
@@ -219,12 +219,12 @@ const resolveExtends = (element, parent, options) => {
|
|
|
219
219
|
const prop = element[param];
|
|
220
220
|
if ((0, import_utils.isUndefined)(prop) || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_component.isVariant)(param))
|
|
221
221
|
continue;
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
222
|
+
const hasDefine = element.define && element.define[param];
|
|
223
|
+
const contextHasDefine = element.context && element.context.define && element.context.define[param];
|
|
224
|
+
const optionsHasDefine = options.define && options.define[param];
|
|
225
|
+
if (import_mixins.registry[param] && !optionsHasDefine) {
|
|
226
226
|
continue;
|
|
227
|
-
else if (element[param] && !
|
|
227
|
+
} else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
228
228
|
create((0, import_utils.exec)(prop, element), element, param, options);
|
|
229
229
|
}
|
|
230
230
|
}
|
package/dist/cjs/extend.js
CHANGED
|
@@ -49,9 +49,9 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
49
49
|
if (props && props.ignoreChildExtend)
|
|
50
50
|
return;
|
|
51
51
|
childExtendStack = (0, import_utils2.getExtendStack)(parent.childExtend);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const canExtendRecursive =
|
|
52
|
+
const ignoreChildExtendRecursive = props && props.ignoreChildExtendRecursive;
|
|
53
|
+
if (parent.childExtendRecursive && !ignoreChildExtendRecursive) {
|
|
54
|
+
const canExtendRecursive = element.key !== "__text";
|
|
55
55
|
if (canExtendRecursive) {
|
|
56
56
|
const childExtendRecursiveStack = (0, import_utils2.getExtendStack)(parent.childExtendRecursive);
|
|
57
57
|
childExtendStack = childExtendStack.concat(childExtendRecursiveStack);
|
package/extend.js
CHANGED
|
@@ -44,9 +44,9 @@ export const applyExtend = (element, parent, options = {}) => {
|
|
|
44
44
|
childExtendStack = getExtendStack(parent.childExtend)
|
|
45
45
|
|
|
46
46
|
// if (parent.childExtendRecursive && (props && !props.ignoreChildExtendRecursive)) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const canExtendRecursive =
|
|
47
|
+
const ignoreChildExtendRecursive = props && props.ignoreChildExtendRecursive
|
|
48
|
+
if (parent.childExtendRecursive && !ignoreChildExtendRecursive) {
|
|
49
|
+
const canExtendRecursive = element.key !== '__text'
|
|
50
50
|
if (canExtendRecursive) {
|
|
51
51
|
const childExtendRecursiveStack = getExtendStack(parent.childExtendRecursive)
|
|
52
52
|
// add error if childExtendRecursive contains element which goes to infinite loop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.10",
|
|
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": "0b2e301e066ed1745f29966e05bca8531c3487f6",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|