@domql/utils 2.29.65 → 2.29.67
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 +18 -18
- package/dist/cjs/component.js +2 -1
- package/dist/cjs/object.js +2 -1
- package/dist/esm/component.js +2 -1
- package/dist/esm/object.js +2 -1
- package/object.js +372 -372
- package/package.json +2 -2
package/component.js
CHANGED
|
@@ -5,14 +5,14 @@ import { joinArrays } from './array.js'
|
|
|
5
5
|
import { deepClone, exec } from './object.js'
|
|
6
6
|
import { isArray, isFunction, isObject, isString } from './types.js'
|
|
7
7
|
|
|
8
|
-
export const checkIfKeyIsComponent = key => {
|
|
8
|
+
export const checkIfKeyIsComponent = (key) => {
|
|
9
9
|
const isFirstKeyString = isString(key)
|
|
10
10
|
if (!isFirstKeyString) return
|
|
11
11
|
const firstCharKey = key.slice(0, 1)
|
|
12
12
|
return /^[A-Z]*$/.test(firstCharKey)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const checkIfKeyIsProperty = key => {
|
|
15
|
+
export const checkIfKeyIsProperty = (key) => {
|
|
16
16
|
const isFirstKeyString = isString(key)
|
|
17
17
|
if (!isFirstKeyString) return
|
|
18
18
|
const firstCharKey = key.slice(0, 1)
|
|
@@ -68,14 +68,14 @@ export const checkIfSugar = (element, parent, key) => {
|
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export const extractComponentKeyFromKey = key => {
|
|
71
|
+
export const extractComponentKeyFromKey = (key) => {
|
|
72
72
|
return key.includes('+')
|
|
73
73
|
? key.split('+') // get array of componentKeys
|
|
74
74
|
: key.includes('_')
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
? [key.split('_')[0]] // get component key split _
|
|
76
|
+
: key.includes('.') && !checkIfKeyIsComponent(key.split('.')[1])
|
|
77
|
+
? [key.split('.')[0]] // get component key split .
|
|
78
|
+
: [key]
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export const extendizeByKey = (element, parent, key) => {
|
|
@@ -126,8 +126,8 @@ export const extendizeByKey = (element, parent, key) => {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export function getCapitalCaseKeys
|
|
130
|
-
return Object.keys(obj).filter(key => /^[A-Z]/.test(key))
|
|
129
|
+
export function getCapitalCaseKeys(obj) {
|
|
130
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key))
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export const addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
@@ -139,7 +139,7 @@ export const addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
|
139
139
|
const childElem = element[childKey]
|
|
140
140
|
const newChild = element.props[childKey]
|
|
141
141
|
|
|
142
|
-
const assignChild = val => {
|
|
142
|
+
const assignChild = (val) => {
|
|
143
143
|
element[childKey] = val
|
|
144
144
|
delete element.props[childKey]
|
|
145
145
|
}
|
|
@@ -184,20 +184,20 @@ export const applyComponentFromContext = (element, parent, options) => {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export const isVariant = param => {
|
|
187
|
+
export const isVariant = (param) => {
|
|
188
188
|
if (!isString(param)) return
|
|
189
189
|
const firstCharKey = param.slice(0, 1)
|
|
190
190
|
// return (firstCharKey === '.' || firstCharKey === '$')
|
|
191
191
|
return firstCharKey === '.'
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
export const hasVariantProp = element => {
|
|
194
|
+
export const hasVariantProp = (element) => {
|
|
195
195
|
const { props } = element
|
|
196
196
|
if (isObject(props) && isString(props.variant)) return true
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
export function getChildrenComponentsByKey
|
|
200
|
-
if (key === this.key || this.__ref
|
|
199
|
+
export function getChildrenComponentsByKey(key) {
|
|
200
|
+
if (key === this.key || this.__ref?.__componentKey === key) {
|
|
201
201
|
return this
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -206,7 +206,7 @@ export function getChildrenComponentsByKey (key) {
|
|
|
206
206
|
// Add the value of the extend key to the result array
|
|
207
207
|
const foundString = isString(this.extend) && this.extend === key
|
|
208
208
|
const foundInArray =
|
|
209
|
-
isArray(this.extend) && this.extend.filter(v => v === key).length
|
|
209
|
+
isArray(this.extend) && this.extend.filter((v) => v === key).length
|
|
210
210
|
if (foundString || foundInArray) return this
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -216,15 +216,15 @@ export function getChildrenComponentsByKey (key) {
|
|
|
216
216
|
isString(this.parent.childExtend) && this.parent.childExtend === key
|
|
217
217
|
const foundInArray =
|
|
218
218
|
isArray(this.parent.childExtend) &&
|
|
219
|
-
this.parent.childExtend.filter(v => v === key).length
|
|
219
|
+
this.parent.childExtend.filter((v) => v === key).length
|
|
220
220
|
if (foundString || foundInArray) return this
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
export const getExtendsInElement = obj => {
|
|
224
|
+
export const getExtendsInElement = (obj) => {
|
|
225
225
|
let result = []
|
|
226
226
|
|
|
227
|
-
function traverse
|
|
227
|
+
function traverse(o) {
|
|
228
228
|
for (const key in o) {
|
|
229
229
|
if (Object.hasOwnProperty.call(o, key)) {
|
|
230
230
|
// Check if the key starts with a capital letter and exclude keys like @mobileL, $propsCollection
|
package/dist/cjs/component.js
CHANGED
|
@@ -195,7 +195,8 @@ const hasVariantProp = (element) => {
|
|
|
195
195
|
if ((0, import_types.isObject)(props) && (0, import_types.isString)(props.variant)) return true;
|
|
196
196
|
};
|
|
197
197
|
function getChildrenComponentsByKey(key) {
|
|
198
|
-
|
|
198
|
+
var _a;
|
|
199
|
+
if (key === this.key || ((_a = this.__ref) == null ? void 0 : _a.__componentKey) === key) {
|
|
199
200
|
return this;
|
|
200
201
|
}
|
|
201
202
|
if (this.extend) {
|
package/dist/cjs/object.js
CHANGED
|
@@ -186,6 +186,7 @@ const deepClone = (obj, options = {}) => {
|
|
|
186
186
|
const deepStringify = (obj, stringified = {}) => {
|
|
187
187
|
var _a, _b;
|
|
188
188
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
189
|
+
;
|
|
189
190
|
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn(
|
|
190
191
|
"Trying to clone element or state at",
|
|
191
192
|
obj
|
|
@@ -693,7 +694,7 @@ const getInObjectByPath = (obj, path) => {
|
|
|
693
694
|
return current;
|
|
694
695
|
};
|
|
695
696
|
const detectInfiniteLoop = (arr) => {
|
|
696
|
-
const maxRepeats =
|
|
697
|
+
const maxRepeats = 3;
|
|
697
698
|
let pattern = [];
|
|
698
699
|
let repeatCount = 0;
|
|
699
700
|
for (let i = 0; i < arr.length; i++) {
|
package/dist/esm/component.js
CHANGED
|
@@ -176,7 +176,8 @@ const hasVariantProp = (element) => {
|
|
|
176
176
|
if (isObject(props) && isString(props.variant)) return true;
|
|
177
177
|
};
|
|
178
178
|
function getChildrenComponentsByKey(key) {
|
|
179
|
-
|
|
179
|
+
var _a;
|
|
180
|
+
if (key === this.key || ((_a = this.__ref) == null ? void 0 : _a.__componentKey) === key) {
|
|
180
181
|
return this;
|
|
181
182
|
}
|
|
182
183
|
if (this.extend) {
|
package/dist/esm/object.js
CHANGED
|
@@ -154,6 +154,7 @@ const deepClone = (obj, options = {}) => {
|
|
|
154
154
|
const deepStringify = (obj, stringified = {}) => {
|
|
155
155
|
var _a, _b;
|
|
156
156
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
157
|
+
;
|
|
157
158
|
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn(
|
|
158
159
|
"Trying to clone element or state at",
|
|
159
160
|
obj
|
|
@@ -661,7 +662,7 @@ const getInObjectByPath = (obj, path) => {
|
|
|
661
662
|
return current;
|
|
662
663
|
};
|
|
663
664
|
const detectInfiniteLoop = (arr) => {
|
|
664
|
-
const maxRepeats =
|
|
665
|
+
const maxRepeats = 3;
|
|
665
666
|
let pattern = [];
|
|
666
667
|
let repeatCount = 0;
|
|
667
668
|
for (let i = 0; i < arr.length; i++) {
|