@domql/element 2.5.43 → 2.5.47
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 +9 -3
- package/dist/cjs/onlyResolveExtends.js +0 -1
- package/dist/cjs/utils/component.js +1 -1
- package/extend.js +10 -3
- package/onlyResolveExtends.js +1 -1
- package/package.json +2 -2
- package/utils/component.js +1 -1
package/dist/cjs/extend.js
CHANGED
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(extend_exports);
|
|
|
24
24
|
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_utils2 = require("./utils");
|
|
26
26
|
const ENV = "development";
|
|
27
|
+
let mainExtend;
|
|
27
28
|
const applyExtend = (element, parent, options = {}) => {
|
|
28
29
|
if ((0, import_utils.isFunction)(element))
|
|
29
30
|
element = (0, import_utils.exec)(element, parent);
|
|
@@ -60,8 +61,12 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
60
61
|
} else if (!options.extend)
|
|
61
62
|
return element;
|
|
62
63
|
if (options.extend) {
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
if (!mainExtend) {
|
|
65
|
+
const defaultOptionsExtend = (0, import_utils2.getExtendStack)(options.extend, context);
|
|
66
|
+
mainExtend = (0, import_utils2.cloneAndMergeArrayExtend)(defaultOptionsExtend);
|
|
67
|
+
delete mainExtend.extend;
|
|
68
|
+
}
|
|
69
|
+
stack = [].concat(stack, mainExtend);
|
|
65
70
|
}
|
|
66
71
|
if (__ref)
|
|
67
72
|
__ref.__extend = stack;
|
|
@@ -72,5 +77,6 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
72
77
|
const componentExtend = (0, import_utils2.cloneAndMergeArrayExtend)((0, import_utils2.getExtendStack)(COMPONENTS[component]));
|
|
73
78
|
mergedExtend = (0, import_utils2.deepMergeExtend)(componentExtend, mergedExtend);
|
|
74
79
|
}
|
|
75
|
-
|
|
80
|
+
const merged = (0, import_utils2.deepMergeExtend)(element, mergedExtend);
|
|
81
|
+
return merged;
|
|
76
82
|
};
|
|
@@ -36,7 +36,6 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
36
36
|
element.tag = (0, import_render.detectTag)(element);
|
|
37
37
|
{
|
|
38
38
|
const { __ref: ref2 } = element;
|
|
39
|
-
const { __ref: parentRef } = parent;
|
|
40
39
|
if (!ref2.__cached)
|
|
41
40
|
ref2.__cached = {};
|
|
42
41
|
if (!ref2.__defineCache)
|
|
@@ -49,7 +49,7 @@ const addAdditionalExtend = (newExtend, element) => {
|
|
|
49
49
|
const extendizeByKey = (element, parent, key) => {
|
|
50
50
|
const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element;
|
|
51
51
|
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr;
|
|
52
|
-
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : key;
|
|
52
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
|
|
53
53
|
const isExtendKeyComponent = context == null ? void 0 : context.components[extendFromKey];
|
|
54
54
|
if (element === isExtendKeyComponent)
|
|
55
55
|
return element;
|
package/extend.js
CHANGED
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
|
|
12
12
|
const ENV = process.env.NODE_ENV
|
|
13
13
|
|
|
14
|
+
let mainExtend
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* Checks whether element has `extend` or is a part
|
|
16
18
|
* of parent's `childExtend` extend
|
|
@@ -59,8 +61,12 @@ export const applyExtend = (element, parent, options = {}) => {
|
|
|
59
61
|
} else if (!options.extend) return element
|
|
60
62
|
|
|
61
63
|
if (options.extend) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (!mainExtend) {
|
|
65
|
+
const defaultOptionsExtend = getExtendStack(options.extend, context)
|
|
66
|
+
mainExtend = cloneAndMergeArrayExtend(defaultOptionsExtend)
|
|
67
|
+
delete mainExtend.extend
|
|
68
|
+
}
|
|
69
|
+
stack = [].concat(stack, mainExtend)
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
// check if array contains string extends
|
|
@@ -75,5 +81,6 @@ export const applyExtend = (element, parent, options = {}) => {
|
|
|
75
81
|
mergedExtend = deepMergeExtend(componentExtend, mergedExtend)
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
const merged = deepMergeExtend(element, mergedExtend)
|
|
85
|
+
return merged
|
|
79
86
|
}
|
package/onlyResolveExtends.js
CHANGED
|
@@ -20,7 +20,7 @@ export const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
20
20
|
// Copy-paste of addCaching()
|
|
21
21
|
{
|
|
22
22
|
const { __ref: ref } = element
|
|
23
|
-
const { __ref: parentRef } = parent
|
|
23
|
+
// const { __ref: parentRef } = parent
|
|
24
24
|
|
|
25
25
|
// enable TRANSFORM in data
|
|
26
26
|
// TODO: do we need this at all?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.47",
|
|
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": "c49194ab459d5e43b9d5fabdf3d0f3c7b8b32b5f",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|