@domql/utils 2.5.152 → 2.5.153
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/component.js +11 -12
- package/dist/cjs/component.js +14 -10
- package/package.json +2 -2
package/component.js
CHANGED
|
@@ -34,13 +34,13 @@ export const addAdditionalExtend = (newExtend, element) => {
|
|
|
34
34
|
return { ...element, extend }
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const checkIfSugar = (element, parent, key) => {
|
|
37
|
+
export const checkIfSugar = (element, parent, key) => {
|
|
38
38
|
const {
|
|
39
39
|
extend,
|
|
40
40
|
props,
|
|
41
41
|
childExtend,
|
|
42
42
|
extends: extendProps,
|
|
43
|
-
|
|
43
|
+
childExtends,
|
|
44
44
|
childProps,
|
|
45
45
|
children,
|
|
46
46
|
on,
|
|
@@ -49,15 +49,16 @@ const checkIfSugar = (element, parent, key) => {
|
|
|
49
49
|
$propsCollection
|
|
50
50
|
} = element
|
|
51
51
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection
|
|
52
|
-
if (hasComponentAttrs && (childProps || extendProps || children ||
|
|
53
|
-
|
|
52
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
53
|
+
const logErr = (parent || element)?.error
|
|
54
|
+
if (logErr) logErr('Sugar component includes params for builtin components', { verbose: true })
|
|
54
55
|
}
|
|
55
|
-
return !hasComponentAttrs || childProps || extendProps || children ||
|
|
56
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export const extendizeByKey = (element, parent, key) => {
|
|
59
60
|
const { context } = parent
|
|
60
|
-
const { tag, extend,
|
|
61
|
+
const { tag, extend, childExtends } = element
|
|
61
62
|
const isSugar = checkIfSugar(element, parent, key)
|
|
62
63
|
|
|
63
64
|
const extendFromKey = key.includes('+')
|
|
@@ -76,7 +77,7 @@ export const extendizeByKey = (element, parent, key) => {
|
|
|
76
77
|
tag,
|
|
77
78
|
props: { ...element }
|
|
78
79
|
})
|
|
79
|
-
if (
|
|
80
|
+
if (childExtends) newElem.childExtend = childExtends
|
|
80
81
|
return newElem
|
|
81
82
|
} else if (!extend || extend === true) {
|
|
82
83
|
return {
|
|
@@ -95,7 +96,7 @@ export const extendizeByKey = (element, parent, key) => {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
function getCapitalCaseKeys (obj) {
|
|
99
|
+
export function getCapitalCaseKeys (obj) {
|
|
99
100
|
return Object.keys(obj).filter(key => /^[A-Z]/.test(key))
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -114,10 +115,8 @@ export const addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
if (newChild?.ignoreExtend) continue
|
|
117
|
-
if (newChild === null
|
|
118
|
-
|
|
119
|
-
assignChild(null)
|
|
120
|
-
} else if (!childElem) assignChild(deepCloneWithExtend(newChild))
|
|
118
|
+
if (newChild === null) assignChild(null)
|
|
119
|
+
else if (!childElem) assignChild(deepCloneWithExtend(newChild))
|
|
121
120
|
else {
|
|
122
121
|
const isSugarChildElem = checkIfSugar(childElem, parent, key)
|
|
123
122
|
if (isSugarChildElem) continue
|
package/dist/cjs/component.js
CHANGED
|
@@ -24,7 +24,9 @@ __export(component_exports, {
|
|
|
24
24
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
25
25
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
26
26
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
27
|
+
checkIfSugar: () => checkIfSugar,
|
|
27
28
|
extendizeByKey: () => extendizeByKey,
|
|
29
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
28
30
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
29
31
|
getExtendsInElement: () => getExtendsInElement,
|
|
30
32
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -58,12 +60,13 @@ const addAdditionalExtend = (newExtend, element) => {
|
|
|
58
60
|
return { ...element, extend };
|
|
59
61
|
};
|
|
60
62
|
const checkIfSugar = (element, parent, key) => {
|
|
63
|
+
var _a;
|
|
61
64
|
const {
|
|
62
65
|
extend,
|
|
63
66
|
props,
|
|
64
67
|
childExtend,
|
|
65
68
|
extends: extendProps,
|
|
66
|
-
|
|
69
|
+
childExtends,
|
|
67
70
|
childProps,
|
|
68
71
|
children,
|
|
69
72
|
on,
|
|
@@ -72,14 +75,16 @@ const checkIfSugar = (element, parent, key) => {
|
|
|
72
75
|
$propsCollection
|
|
73
76
|
} = element;
|
|
74
77
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
75
|
-
if (hasComponentAttrs && (childProps || extendProps || children ||
|
|
76
|
-
|
|
78
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
79
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
80
|
+
if (logErr)
|
|
81
|
+
logErr("Sugar component includes params for builtin components", { verbose: true });
|
|
77
82
|
}
|
|
78
|
-
return !hasComponentAttrs || childProps || extendProps || children ||
|
|
83
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
79
84
|
};
|
|
80
85
|
const extendizeByKey = (element, parent, key) => {
|
|
81
86
|
const { context } = parent;
|
|
82
|
-
const { tag, extend,
|
|
87
|
+
const { tag, extend, childExtends } = element;
|
|
83
88
|
const isSugar = checkIfSugar(element, parent, key);
|
|
84
89
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
85
90
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
@@ -91,8 +96,8 @@ const extendizeByKey = (element, parent, key) => {
|
|
|
91
96
|
tag,
|
|
92
97
|
props: { ...element }
|
|
93
98
|
});
|
|
94
|
-
if (
|
|
95
|
-
newElem.childExtend =
|
|
99
|
+
if (childExtends)
|
|
100
|
+
newElem.childExtend = childExtends;
|
|
96
101
|
return newElem;
|
|
97
102
|
} else if (!extend || extend === true) {
|
|
98
103
|
return {
|
|
@@ -127,10 +132,9 @@ const addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
|
127
132
|
};
|
|
128
133
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
129
134
|
continue;
|
|
130
|
-
if (newChild === null
|
|
131
|
-
console.log("is null", element);
|
|
135
|
+
if (newChild === null)
|
|
132
136
|
assignChild(null);
|
|
133
|
-
|
|
137
|
+
else if (!childElem)
|
|
134
138
|
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
135
139
|
else {
|
|
136
140
|
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.153",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build": "yarn build:cjs",
|
|
26
26
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ebf5debf658fdae4ec5a99b541b2518c7767e6a8",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.12.0"
|
|
31
31
|
}
|