@symbo.ls/scratch 2.11.429 → 2.11.438
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/defaultConfig/index.js +3 -1
- package/dist/cjs/defaultConfig/responsive.js +3 -1
- package/dist/cjs/factory.js +303 -106
- package/dist/cjs/index.js +655 -219
- package/dist/cjs/set.js +653 -217
- package/dist/cjs/system/color.js +651 -216
- package/dist/cjs/system/document.js +650 -215
- package/dist/cjs/system/font.js +650 -215
- package/dist/cjs/system/index.js +655 -219
- package/dist/cjs/system/reset.js +651 -216
- package/dist/cjs/system/shadow.js +651 -216
- package/dist/cjs/system/spacing.js +650 -215
- package/dist/cjs/system/svg.js +650 -215
- package/dist/cjs/system/theme.js +651 -216
- package/dist/cjs/system/timing.js +650 -215
- package/dist/cjs/system/typography.js +652 -216
- package/dist/cjs/transforms/index.js +652 -217
- package/dist/cjs/utils/color.js +304 -109
- package/dist/cjs/utils/index.js +650 -215
- package/dist/cjs/utils/sequence.js +650 -215
- package/dist/cjs/utils/sprite.js +303 -106
- package/dist/cjs/utils/var.js +650 -215
- package/package.json +2 -2
- package/src/defaultConfig/responsive.js +3 -1
- package/src/system/color.js +1 -1
- package/src/system/shadow.js +1 -1
- package/src/system/theme.js +1 -1
- package/src/system/typography.js +2 -1
package/dist/cjs/utils/color.js
CHANGED
|
@@ -53,16 +53,16 @@ var require_cjs = __commonJS({
|
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
54
54
|
var globals_exports = {};
|
|
55
55
|
__export2(globals_exports, {
|
|
56
|
-
document: () =>
|
|
56
|
+
document: () => document3,
|
|
57
57
|
global: () => global,
|
|
58
58
|
self: () => self,
|
|
59
|
-
window: () =>
|
|
59
|
+
window: () => window3
|
|
60
60
|
});
|
|
61
61
|
module2.exports = __toCommonJS2(globals_exports);
|
|
62
62
|
var global = globalThis;
|
|
63
63
|
var self = globalThis;
|
|
64
|
-
var
|
|
65
|
-
var
|
|
64
|
+
var window3 = globalThis;
|
|
65
|
+
var document3 = window3.document;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -166,16 +166,16 @@ var require_globals = __commonJS({
|
|
|
166
166
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
167
167
|
var globals_exports = {};
|
|
168
168
|
__export2(globals_exports, {
|
|
169
|
-
document: () =>
|
|
169
|
+
document: () => document3,
|
|
170
170
|
global: () => global,
|
|
171
171
|
self: () => self,
|
|
172
|
-
window: () =>
|
|
172
|
+
window: () => window3
|
|
173
173
|
});
|
|
174
174
|
module2.exports = __toCommonJS2(globals_exports);
|
|
175
175
|
var global = globalThis;
|
|
176
176
|
var self = globalThis;
|
|
177
|
-
var
|
|
178
|
-
var
|
|
177
|
+
var window3 = globalThis;
|
|
178
|
+
var document3 = window3.document;
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
@@ -202,6 +202,7 @@ var require_node = __commonJS({
|
|
|
202
202
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
203
203
|
var node_exports = {};
|
|
204
204
|
__export2(node_exports, {
|
|
205
|
+
isDOMNode: () => isDOMNode,
|
|
205
206
|
isHtmlElement: () => isHtmlElement,
|
|
206
207
|
isNode: () => isNode
|
|
207
208
|
});
|
|
@@ -213,6 +214,9 @@ var require_node = __commonJS({
|
|
|
213
214
|
var isHtmlElement = (obj) => {
|
|
214
215
|
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
215
216
|
};
|
|
217
|
+
var isDOMNode = (obj) => {
|
|
218
|
+
return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
|
|
219
|
+
};
|
|
216
220
|
}
|
|
217
221
|
});
|
|
218
222
|
|
|
@@ -332,7 +336,6 @@ var require_array = __commonJS({
|
|
|
332
336
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
333
337
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
334
338
|
arraysEqual: () => arraysEqual,
|
|
335
|
-
createNestedObject: () => createNestedObject,
|
|
336
339
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
337
340
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
338
341
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -399,22 +402,6 @@ var require_array = __commonJS({
|
|
|
399
402
|
}
|
|
400
403
|
return arr;
|
|
401
404
|
};
|
|
402
|
-
var createNestedObject = (arr, lastValue) => {
|
|
403
|
-
const nestedObject = {};
|
|
404
|
-
if (arr.length === 0) {
|
|
405
|
-
return lastValue;
|
|
406
|
-
}
|
|
407
|
-
arr.reduce((obj, value, index) => {
|
|
408
|
-
if (!obj[value]) {
|
|
409
|
-
obj[value] = {};
|
|
410
|
-
}
|
|
411
|
-
if (index === arr.length - 1 && lastValue) {
|
|
412
|
-
obj[value] = lastValue;
|
|
413
|
-
}
|
|
414
|
-
return obj[value];
|
|
415
|
-
}, nestedObject);
|
|
416
|
-
return nestedObject;
|
|
417
|
-
};
|
|
418
405
|
var removeValueFromArray = (arr, value) => {
|
|
419
406
|
const index = arr.indexOf(value);
|
|
420
407
|
if (index > -1) {
|
|
@@ -635,8 +622,8 @@ var require_object = __commonJS({
|
|
|
635
622
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
636
623
|
var object_exports = {};
|
|
637
624
|
__export2(object_exports, {
|
|
638
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
639
625
|
clone: () => clone,
|
|
626
|
+
createNestedObject: () => createNestedObject,
|
|
640
627
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
641
628
|
deepClone: () => deepClone,
|
|
642
629
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -647,13 +634,12 @@ var require_object = __commonJS({
|
|
|
647
634
|
deepMerge: () => deepMerge,
|
|
648
635
|
deepStringify: () => deepStringify,
|
|
649
636
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
637
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
650
638
|
diff: () => diff,
|
|
651
639
|
diffArrays: () => diffArrays,
|
|
652
640
|
diffObjects: () => diffObjects,
|
|
653
641
|
exec: () => exec,
|
|
654
642
|
flattenRecursive: () => flattenRecursive,
|
|
655
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
656
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
657
643
|
hasOwnProperty: () => hasOwnProperty,
|
|
658
644
|
isEmpty: () => isEmpty,
|
|
659
645
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -668,6 +654,7 @@ var require_object = __commonJS({
|
|
|
668
654
|
overwriteDeep: () => overwriteDeep,
|
|
669
655
|
overwriteShallow: () => overwriteShallow,
|
|
670
656
|
removeFromObject: () => removeFromObject,
|
|
657
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
671
658
|
stringToObject: () => stringToObject
|
|
672
659
|
});
|
|
673
660
|
module2.exports = __toCommonJS2(object_exports);
|
|
@@ -675,6 +662,8 @@ var require_object = __commonJS({
|
|
|
675
662
|
var import_types = require_types();
|
|
676
663
|
var import_array = require_array();
|
|
677
664
|
var import_string = require_string();
|
|
665
|
+
var import_node = require_node();
|
|
666
|
+
var ENV2 = "development";
|
|
678
667
|
var exec = (param, element, state, context) => {
|
|
679
668
|
if ((0, import_types.isFunction)(param)) {
|
|
680
669
|
return param(
|
|
@@ -753,27 +742,28 @@ var require_object = __commonJS({
|
|
|
753
742
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
754
743
|
return arr.reduce((acc, curr) => deepMerge(acc, deepCloneExclude(curr, excl)), {});
|
|
755
744
|
};
|
|
756
|
-
var deepClone = (obj,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
745
|
+
var deepClone = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
746
|
+
if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
|
|
747
|
+
return obj;
|
|
748
|
+
if (visited.has(obj))
|
|
749
|
+
return visited.get(obj);
|
|
750
|
+
const clone2 = (0, import_types.isArray)(obj) ? [] : {};
|
|
751
|
+
visited.set(obj, clone2);
|
|
752
|
+
for (const key in obj) {
|
|
753
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
|
|
754
|
+
const value = obj[key];
|
|
755
|
+
if ((0, import_node.isDOMNode)(value)) {
|
|
756
|
+
clone2[key] = value;
|
|
757
|
+
} else if (key === "extend" && (0, import_types.isArray)(value)) {
|
|
758
|
+
clone2[key] = (0, import_array.mergeArray)(value, exclude);
|
|
759
|
+
} else if ((0, import_types.isObjectLike)(value)) {
|
|
760
|
+
clone2[key] = deepClone(value, exclude, cleanUndefined, visited);
|
|
761
|
+
} else {
|
|
762
|
+
clone2[key] = value;
|
|
763
|
+
}
|
|
770
764
|
}
|
|
771
|
-
if ((0, import_types.isObjectLike)(objProp)) {
|
|
772
|
-
o[prop] = deepClone(objProp, excludeFrom, cleanUndefined);
|
|
773
|
-
} else
|
|
774
|
-
o[prop] = objProp;
|
|
775
765
|
}
|
|
776
|
-
return
|
|
766
|
+
return clone2;
|
|
777
767
|
};
|
|
778
768
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
779
769
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
@@ -785,6 +775,8 @@ var require_object = __commonJS({
|
|
|
785
775
|
continue;
|
|
786
776
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
787
777
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
778
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
779
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
788
780
|
} else
|
|
789
781
|
o[prop] = objProp;
|
|
790
782
|
}
|
|
@@ -1028,16 +1020,23 @@ var require_object = __commonJS({
|
|
|
1028
1020
|
}
|
|
1029
1021
|
return obj;
|
|
1030
1022
|
};
|
|
1031
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
1023
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1024
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1025
|
+
return params;
|
|
1026
|
+
}
|
|
1027
|
+
if (visited.has(obj)) {
|
|
1028
|
+
return visited.get(obj);
|
|
1029
|
+
}
|
|
1030
|
+
visited.set(obj, obj);
|
|
1032
1031
|
for (const e in params) {
|
|
1033
|
-
if (e === "__ref")
|
|
1034
|
-
continue;
|
|
1035
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
1032
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
1036
1033
|
continue;
|
|
1037
1034
|
const objProp = obj[e];
|
|
1038
1035
|
const paramsProp = params[e];
|
|
1039
|
-
if ((0,
|
|
1040
|
-
|
|
1036
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1037
|
+
obj[e] = paramsProp;
|
|
1038
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1039
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
1041
1040
|
} else if (paramsProp !== void 0) {
|
|
1042
1041
|
obj[e] = paramsProp;
|
|
1043
1042
|
}
|
|
@@ -1084,30 +1083,40 @@ var require_object = __commonJS({
|
|
|
1084
1083
|
}
|
|
1085
1084
|
return true;
|
|
1086
1085
|
};
|
|
1087
|
-
var deepContains = (obj1, obj2) => {
|
|
1088
|
-
if (
|
|
1086
|
+
var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
|
|
1087
|
+
if (obj1 === obj2)
|
|
1088
|
+
return true;
|
|
1089
|
+
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
|
|
1089
1090
|
return false;
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1091
|
+
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
|
|
1092
|
+
return obj1 === obj2;
|
|
1093
|
+
const stack = [[obj1, obj2]];
|
|
1094
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
1095
|
+
while (stack.length > 0) {
|
|
1096
|
+
const [current1, current2] = stack.pop();
|
|
1097
|
+
if (visited.has(current1))
|
|
1098
|
+
continue;
|
|
1099
|
+
visited.add(current1);
|
|
1100
|
+
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
|
|
1101
|
+
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
|
|
1102
|
+
if (keys1.length !== keys2.length)
|
|
1103
|
+
return false;
|
|
1104
|
+
for (const key of keys1) {
|
|
1105
|
+
if (!Object.prototype.hasOwnProperty.call(current2, key))
|
|
1094
1106
|
return false;
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
} else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
|
|
1102
|
-
for (const key in obj1) {
|
|
1103
|
-
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
|
|
1104
|
-
if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
|
|
1107
|
+
const value1 = current1[key];
|
|
1108
|
+
const value2 = current2[key];
|
|
1109
|
+
if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
|
|
1110
|
+
if (value1 !== value2)
|
|
1105
1111
|
return false;
|
|
1112
|
+
} else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
|
|
1113
|
+
if (value1 !== value2) {
|
|
1114
|
+
stack.push([value1, value2]);
|
|
1106
1115
|
}
|
|
1116
|
+
} else if (value1 !== value2) {
|
|
1117
|
+
return false;
|
|
1107
1118
|
}
|
|
1108
1119
|
}
|
|
1109
|
-
} else {
|
|
1110
|
-
return obj2 === obj1;
|
|
1111
1120
|
}
|
|
1112
1121
|
return true;
|
|
1113
1122
|
};
|
|
@@ -1135,53 +1144,60 @@ var require_object = __commonJS({
|
|
|
1135
1144
|
}
|
|
1136
1145
|
return newObj;
|
|
1137
1146
|
};
|
|
1138
|
-
var
|
|
1139
|
-
const
|
|
1140
|
-
if (
|
|
1141
|
-
return;
|
|
1142
|
-
|
|
1143
|
-
|
|
1147
|
+
var createNestedObject = (arr, lastValue) => {
|
|
1148
|
+
const nestedObject = {};
|
|
1149
|
+
if (arr.length === 0) {
|
|
1150
|
+
return lastValue;
|
|
1151
|
+
}
|
|
1152
|
+
arr.reduce((obj, value, index) => {
|
|
1153
|
+
if (!obj[value]) {
|
|
1154
|
+
obj[value] = {};
|
|
1155
|
+
}
|
|
1156
|
+
if (index === arr.length - 1 && lastValue) {
|
|
1157
|
+
obj[value] = lastValue;
|
|
1158
|
+
}
|
|
1159
|
+
return obj[value];
|
|
1160
|
+
}, nestedObject);
|
|
1161
|
+
return nestedObject;
|
|
1144
1162
|
};
|
|
1145
|
-
var
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1163
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
1164
|
+
if (!Array.isArray(path)) {
|
|
1165
|
+
throw new Error("Path must be an array.");
|
|
1148
1166
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1167
|
+
let current = obj;
|
|
1168
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1169
|
+
if (current[path[i]] === void 0) {
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
current = current[path[i]];
|
|
1154
1173
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
if (foundString || foundInArray)
|
|
1159
|
-
return el;
|
|
1174
|
+
const lastKey = path[path.length - 1];
|
|
1175
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
1176
|
+
delete current[lastKey];
|
|
1160
1177
|
}
|
|
1161
1178
|
};
|
|
1162
|
-
var
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
if (
|
|
1178
|
-
|
|
1179
|
+
var detectInfiniteLoop = (arr) => {
|
|
1180
|
+
const maxRepeats = 10;
|
|
1181
|
+
let pattern = [];
|
|
1182
|
+
let repeatCount = 0;
|
|
1183
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1184
|
+
if (pattern.length < 2) {
|
|
1185
|
+
pattern.push(arr[i]);
|
|
1186
|
+
} else {
|
|
1187
|
+
if (arr[i] === pattern[i % 2]) {
|
|
1188
|
+
repeatCount++;
|
|
1189
|
+
} else {
|
|
1190
|
+
pattern = [arr[i - 1], arr[i]];
|
|
1191
|
+
repeatCount = 1;
|
|
1192
|
+
}
|
|
1193
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
1194
|
+
if (ENV2 === "test" || ENV2 === "development") {
|
|
1195
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
1179
1196
|
}
|
|
1197
|
+
return true;
|
|
1180
1198
|
}
|
|
1181
1199
|
}
|
|
1182
1200
|
}
|
|
1183
|
-
traverse(obj);
|
|
1184
|
-
return result;
|
|
1185
1201
|
};
|
|
1186
1202
|
}
|
|
1187
1203
|
});
|
|
@@ -1209,6 +1225,7 @@ var require_function = __commonJS({
|
|
|
1209
1225
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1210
1226
|
var function_exports = {};
|
|
1211
1227
|
__export2(function_exports, {
|
|
1228
|
+
cloneFunction: () => cloneFunction,
|
|
1212
1229
|
debounce: () => debounce,
|
|
1213
1230
|
debounceOnContext: () => debounceOnContext,
|
|
1214
1231
|
isStringFunction: () => isStringFunction,
|
|
@@ -1258,6 +1275,17 @@ var require_function = __commonJS({
|
|
|
1258
1275
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
1259
1276
|
return functionRegex.test(inputString);
|
|
1260
1277
|
};
|
|
1278
|
+
function cloneFunction(fn, win = window) {
|
|
1279
|
+
const temp = function() {
|
|
1280
|
+
return fn.apply(win, arguments);
|
|
1281
|
+
};
|
|
1282
|
+
for (const key in fn) {
|
|
1283
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
1284
|
+
temp[key] = fn[key];
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return temp;
|
|
1288
|
+
}
|
|
1261
1289
|
}
|
|
1262
1290
|
});
|
|
1263
1291
|
|
|
@@ -1527,6 +1555,172 @@ var require_tags = __commonJS({
|
|
|
1527
1555
|
}
|
|
1528
1556
|
});
|
|
1529
1557
|
|
|
1558
|
+
// ../../../domql/packages/utils/dist/cjs/component.js
|
|
1559
|
+
var require_component = __commonJS({
|
|
1560
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports, module2) {
|
|
1561
|
+
"use strict";
|
|
1562
|
+
var __defProp2 = Object.defineProperty;
|
|
1563
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1564
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1565
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1566
|
+
var __export2 = (target, all) => {
|
|
1567
|
+
for (var name in all)
|
|
1568
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1569
|
+
};
|
|
1570
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
1571
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1572
|
+
for (let key of __getOwnPropNames2(from))
|
|
1573
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1574
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1575
|
+
}
|
|
1576
|
+
return to;
|
|
1577
|
+
};
|
|
1578
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1579
|
+
var component_exports = {};
|
|
1580
|
+
__export2(component_exports, {
|
|
1581
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
1582
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
1583
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1584
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1585
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1586
|
+
extendizeByKey: () => extendizeByKey,
|
|
1587
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1588
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
1589
|
+
hasVariantProp: () => hasVariantProp,
|
|
1590
|
+
isVariant: () => isVariant
|
|
1591
|
+
});
|
|
1592
|
+
module2.exports = __toCommonJS2(component_exports);
|
|
1593
|
+
var import__ = require_cjs2();
|
|
1594
|
+
var ENV2 = "development";
|
|
1595
|
+
var checkIfKeyIsComponent = (key) => {
|
|
1596
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1597
|
+
if (!isFirstKeyString)
|
|
1598
|
+
return;
|
|
1599
|
+
const firstCharKey = key.slice(0, 1);
|
|
1600
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
1601
|
+
};
|
|
1602
|
+
var checkIfKeyIsProperty = (key) => {
|
|
1603
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1604
|
+
if (!isFirstKeyString)
|
|
1605
|
+
return;
|
|
1606
|
+
const firstCharKey = key.slice(0, 1);
|
|
1607
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
1608
|
+
};
|
|
1609
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
1610
|
+
const { extend: elementExtend } = element;
|
|
1611
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1612
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
1613
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1614
|
+
return { ...element, extend };
|
|
1615
|
+
};
|
|
1616
|
+
var extendizeByKey = (element, parent, key) => {
|
|
1617
|
+
const { context } = parent;
|
|
1618
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
1619
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
1620
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1621
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1622
|
+
if (element === isExtendKeyComponent)
|
|
1623
|
+
return element;
|
|
1624
|
+
else if (!hasComponentAttrs || childProps) {
|
|
1625
|
+
return {
|
|
1626
|
+
extend: extendFromKey,
|
|
1627
|
+
tag,
|
|
1628
|
+
props: { ...element }
|
|
1629
|
+
};
|
|
1630
|
+
} else if (!extend || extend === true) {
|
|
1631
|
+
return {
|
|
1632
|
+
...element,
|
|
1633
|
+
tag,
|
|
1634
|
+
extend: extendFromKey
|
|
1635
|
+
};
|
|
1636
|
+
} else if (extend) {
|
|
1637
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
1638
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
1639
|
+
return {
|
|
1640
|
+
extend: extendFromKey,
|
|
1641
|
+
tag,
|
|
1642
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1647
|
+
return extendizeByKey(element, parent, key) || element;
|
|
1648
|
+
};
|
|
1649
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
1650
|
+
const { context } = element;
|
|
1651
|
+
if (!context || !context.components)
|
|
1652
|
+
return;
|
|
1653
|
+
const { components } = context;
|
|
1654
|
+
const { extend } = element;
|
|
1655
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
1656
|
+
if ((0, import__.isString)(execExtend)) {
|
|
1657
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
1658
|
+
if (componentExists)
|
|
1659
|
+
element.extend = componentExists;
|
|
1660
|
+
else {
|
|
1661
|
+
if ((ENV2 === "test" || ENV2 === "development") && options.verbose) {
|
|
1662
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
1663
|
+
console.warn("replacing with ", {});
|
|
1664
|
+
}
|
|
1665
|
+
element.extend = {};
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
var isVariant = (param) => {
|
|
1670
|
+
if (!(0, import__.isString)(param))
|
|
1671
|
+
return;
|
|
1672
|
+
const firstCharKey = param.slice(0, 1);
|
|
1673
|
+
return firstCharKey === ".";
|
|
1674
|
+
};
|
|
1675
|
+
var hasVariantProp = (element) => {
|
|
1676
|
+
const { props } = element;
|
|
1677
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
1678
|
+
return true;
|
|
1679
|
+
};
|
|
1680
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
1681
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
1682
|
+
return el;
|
|
1683
|
+
}
|
|
1684
|
+
if (el.extend) {
|
|
1685
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
1686
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
1687
|
+
if (foundString || foundInArray)
|
|
1688
|
+
return el;
|
|
1689
|
+
}
|
|
1690
|
+
if (el.parent && el.parent.childExtend) {
|
|
1691
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1692
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1693
|
+
if (foundString || foundInArray)
|
|
1694
|
+
return el;
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
var getExtendsInElement = (obj) => {
|
|
1698
|
+
let result = [];
|
|
1699
|
+
function traverse(o) {
|
|
1700
|
+
for (const key in o) {
|
|
1701
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
1702
|
+
if (checkIfKeyIsComponent(key)) {
|
|
1703
|
+
result.push(key);
|
|
1704
|
+
}
|
|
1705
|
+
if (key === "extend") {
|
|
1706
|
+
if (typeof o[key] === "string") {
|
|
1707
|
+
result.push(o[key]);
|
|
1708
|
+
} else if (Array.isArray(o[key])) {
|
|
1709
|
+
result = result.concat(o[key]);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
1713
|
+
traverse(o[key]);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
traverse(obj);
|
|
1719
|
+
return result;
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
|
|
1530
1724
|
// ../../../domql/packages/utils/dist/cjs/index.js
|
|
1531
1725
|
var require_cjs2 = __commonJS({
|
|
1532
1726
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports, module2) {
|
|
@@ -1559,6 +1753,7 @@ var require_cjs2 = __commonJS({
|
|
|
1559
1753
|
__reExport(utils_exports, require_globals(), module2.exports);
|
|
1560
1754
|
__reExport(utils_exports, require_cookie(), module2.exports);
|
|
1561
1755
|
__reExport(utils_exports, require_tags(), module2.exports);
|
|
1756
|
+
__reExport(utils_exports, require_component(), module2.exports);
|
|
1562
1757
|
}
|
|
1563
1758
|
});
|
|
1564
1759
|
|