@symbo.ls/scratch 2.11.430 → 2.11.439
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/factory.js +246 -67
- package/dist/cjs/index.js +584 -178
- package/dist/cjs/set.js +570 -168
- package/dist/cjs/system/color.js +568 -167
- package/dist/cjs/system/document.js +567 -166
- package/dist/cjs/system/font.js +567 -166
- package/dist/cjs/system/index.js +572 -170
- package/dist/cjs/system/reset.js +568 -167
- package/dist/cjs/system/shadow.js +568 -167
- package/dist/cjs/system/spacing.js +567 -166
- package/dist/cjs/system/svg.js +567 -166
- package/dist/cjs/system/theme.js +568 -167
- package/dist/cjs/system/timing.js +567 -166
- package/dist/cjs/system/typography.js +569 -167
- package/dist/cjs/transforms/index.js +581 -176
- package/dist/cjs/utils/color.js +249 -70
- package/dist/cjs/utils/index.js +567 -166
- package/dist/cjs/utils/sequence.js +567 -166
- package/dist/cjs/utils/sprite.js +246 -67
- package/dist/cjs/utils/var.js +567 -166
- package/package.json +2 -2
- 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/src/transforms/index.js +8 -4
|
@@ -193,6 +193,7 @@ var require_cjs = __commonJS({
|
|
|
193
193
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
194
194
|
var node_exports = {};
|
|
195
195
|
__export22(node_exports, {
|
|
196
|
+
isDOMNode: () => isDOMNode,
|
|
196
197
|
isHtmlElement: () => isHtmlElement,
|
|
197
198
|
isNode: () => isNode
|
|
198
199
|
});
|
|
@@ -204,6 +205,9 @@ var require_cjs = __commonJS({
|
|
|
204
205
|
var isHtmlElement = (obj) => {
|
|
205
206
|
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
206
207
|
};
|
|
208
|
+
var isDOMNode = (obj) => {
|
|
209
|
+
return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
|
|
210
|
+
};
|
|
207
211
|
}
|
|
208
212
|
});
|
|
209
213
|
var require_types2 = __commonJS2({
|
|
@@ -319,7 +323,6 @@ var require_cjs = __commonJS({
|
|
|
319
323
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
320
324
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
321
325
|
arraysEqual: () => arraysEqual,
|
|
322
|
-
createNestedObject: () => createNestedObject,
|
|
323
326
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
324
327
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
325
328
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -386,22 +389,6 @@ var require_cjs = __commonJS({
|
|
|
386
389
|
}
|
|
387
390
|
return arr;
|
|
388
391
|
};
|
|
389
|
-
var createNestedObject = (arr, lastValue) => {
|
|
390
|
-
const nestedObject = {};
|
|
391
|
-
if (arr.length === 0) {
|
|
392
|
-
return lastValue;
|
|
393
|
-
}
|
|
394
|
-
arr.reduce((obj, value, index) => {
|
|
395
|
-
if (!obj[value]) {
|
|
396
|
-
obj[value] = {};
|
|
397
|
-
}
|
|
398
|
-
if (index === arr.length - 1 && lastValue) {
|
|
399
|
-
obj[value] = lastValue;
|
|
400
|
-
}
|
|
401
|
-
return obj[value];
|
|
402
|
-
}, nestedObject);
|
|
403
|
-
return nestedObject;
|
|
404
|
-
};
|
|
405
392
|
var removeValueFromArray = (arr, value) => {
|
|
406
393
|
const index = arr.indexOf(value);
|
|
407
394
|
if (index > -1) {
|
|
@@ -618,8 +605,8 @@ var require_cjs = __commonJS({
|
|
|
618
605
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
619
606
|
var object_exports = {};
|
|
620
607
|
__export22(object_exports, {
|
|
621
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
622
608
|
clone: () => clone,
|
|
609
|
+
createNestedObject: () => createNestedObject,
|
|
623
610
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
624
611
|
deepClone: () => deepClone2,
|
|
625
612
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -630,13 +617,12 @@ var require_cjs = __commonJS({
|
|
|
630
617
|
deepMerge: () => deepMerge2,
|
|
631
618
|
deepStringify: () => deepStringify,
|
|
632
619
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
620
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
633
621
|
diff: () => diff,
|
|
634
622
|
diffArrays: () => diffArrays,
|
|
635
623
|
diffObjects: () => diffObjects,
|
|
636
624
|
exec: () => exec,
|
|
637
625
|
flattenRecursive: () => flattenRecursive,
|
|
638
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
639
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
640
626
|
hasOwnProperty: () => hasOwnProperty,
|
|
641
627
|
isEmpty: () => isEmpty,
|
|
642
628
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -651,6 +637,7 @@ var require_cjs = __commonJS({
|
|
|
651
637
|
overwriteDeep: () => overwriteDeep,
|
|
652
638
|
overwriteShallow: () => overwriteShallow,
|
|
653
639
|
removeFromObject: () => removeFromObject,
|
|
640
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
654
641
|
stringToObject: () => stringToObject
|
|
655
642
|
});
|
|
656
643
|
module22.exports = __toCommonJS22(object_exports);
|
|
@@ -658,6 +645,8 @@ var require_cjs = __commonJS({
|
|
|
658
645
|
var import_types = require_types2();
|
|
659
646
|
var import_array = require_array2();
|
|
660
647
|
var import_string = require_string2();
|
|
648
|
+
var import_node = require_node2();
|
|
649
|
+
var ENV = "development";
|
|
661
650
|
var exec = (param, element, state, context) => {
|
|
662
651
|
if ((0, import_types.isFunction)(param)) {
|
|
663
652
|
return param(
|
|
@@ -736,27 +725,28 @@ var require_cjs = __commonJS({
|
|
|
736
725
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
737
726
|
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
738
727
|
};
|
|
739
|
-
var deepClone2 = (obj,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
728
|
+
var deepClone2 = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
729
|
+
if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
|
|
730
|
+
return obj;
|
|
731
|
+
if (visited.has(obj))
|
|
732
|
+
return visited.get(obj);
|
|
733
|
+
const clone2 = (0, import_types.isArray)(obj) ? [] : {};
|
|
734
|
+
visited.set(obj, clone2);
|
|
735
|
+
for (const key in obj) {
|
|
736
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
|
|
737
|
+
const value = obj[key];
|
|
738
|
+
if ((0, import_node.isDOMNode)(value)) {
|
|
739
|
+
clone2[key] = value;
|
|
740
|
+
} else if (key === "extend" && (0, import_types.isArray)(value)) {
|
|
741
|
+
clone2[key] = (0, import_array.mergeArray)(value, exclude);
|
|
742
|
+
} else if ((0, import_types.isObjectLike)(value)) {
|
|
743
|
+
clone2[key] = deepClone2(value, exclude, cleanUndefined, visited);
|
|
744
|
+
} else {
|
|
745
|
+
clone2[key] = value;
|
|
746
|
+
}
|
|
753
747
|
}
|
|
754
|
-
if ((0, import_types.isObjectLike)(objProp)) {
|
|
755
|
-
o[prop] = deepClone2(objProp, excludeFrom, cleanUndefined);
|
|
756
|
-
} else
|
|
757
|
-
o[prop] = objProp;
|
|
758
748
|
}
|
|
759
|
-
return
|
|
749
|
+
return clone2;
|
|
760
750
|
};
|
|
761
751
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
762
752
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
@@ -768,6 +758,8 @@ var require_cjs = __commonJS({
|
|
|
768
758
|
continue;
|
|
769
759
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
770
760
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
761
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
762
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
771
763
|
} else
|
|
772
764
|
o[prop] = objProp;
|
|
773
765
|
}
|
|
@@ -1011,16 +1003,23 @@ var require_cjs = __commonJS({
|
|
|
1011
1003
|
}
|
|
1012
1004
|
return obj;
|
|
1013
1005
|
};
|
|
1014
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
1006
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1007
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1008
|
+
return params;
|
|
1009
|
+
}
|
|
1010
|
+
if (visited.has(obj)) {
|
|
1011
|
+
return visited.get(obj);
|
|
1012
|
+
}
|
|
1013
|
+
visited.set(obj, obj);
|
|
1015
1014
|
for (const e in params) {
|
|
1016
|
-
if (e === "__ref")
|
|
1017
|
-
continue;
|
|
1018
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
1015
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
1019
1016
|
continue;
|
|
1020
1017
|
const objProp = obj[e];
|
|
1021
1018
|
const paramsProp = params[e];
|
|
1022
|
-
if ((0,
|
|
1023
|
-
|
|
1019
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1020
|
+
obj[e] = paramsProp;
|
|
1021
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1022
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
1024
1023
|
} else if (paramsProp !== void 0) {
|
|
1025
1024
|
obj[e] = paramsProp;
|
|
1026
1025
|
}
|
|
@@ -1067,30 +1066,40 @@ var require_cjs = __commonJS({
|
|
|
1067
1066
|
}
|
|
1068
1067
|
return true;
|
|
1069
1068
|
};
|
|
1070
|
-
var deepContains = (obj1, obj2) => {
|
|
1071
|
-
if (
|
|
1069
|
+
var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
|
|
1070
|
+
if (obj1 === obj2)
|
|
1071
|
+
return true;
|
|
1072
|
+
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
|
|
1072
1073
|
return false;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1074
|
+
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
|
|
1075
|
+
return obj1 === obj2;
|
|
1076
|
+
const stack = [[obj1, obj2]];
|
|
1077
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
1078
|
+
while (stack.length > 0) {
|
|
1079
|
+
const [current1, current2] = stack.pop();
|
|
1080
|
+
if (visited.has(current1))
|
|
1081
|
+
continue;
|
|
1082
|
+
visited.add(current1);
|
|
1083
|
+
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
|
|
1084
|
+
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
|
|
1085
|
+
if (keys1.length !== keys2.length)
|
|
1086
|
+
return false;
|
|
1087
|
+
for (const key of keys1) {
|
|
1088
|
+
if (!Object.prototype.hasOwnProperty.call(current2, key))
|
|
1077
1089
|
return false;
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
} else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
|
|
1085
|
-
for (const key in obj1) {
|
|
1086
|
-
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
|
|
1087
|
-
if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
|
|
1090
|
+
const value1 = current1[key];
|
|
1091
|
+
const value2 = current2[key];
|
|
1092
|
+
if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
|
|
1093
|
+
if (value1 !== value2)
|
|
1088
1094
|
return false;
|
|
1095
|
+
} else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
|
|
1096
|
+
if (value1 !== value2) {
|
|
1097
|
+
stack.push([value1, value2]);
|
|
1089
1098
|
}
|
|
1099
|
+
} else if (value1 !== value2) {
|
|
1100
|
+
return false;
|
|
1090
1101
|
}
|
|
1091
1102
|
}
|
|
1092
|
-
} else {
|
|
1093
|
-
return obj2 === obj1;
|
|
1094
1103
|
}
|
|
1095
1104
|
return true;
|
|
1096
1105
|
};
|
|
@@ -1118,53 +1127,60 @@ var require_cjs = __commonJS({
|
|
|
1118
1127
|
}
|
|
1119
1128
|
return newObj;
|
|
1120
1129
|
};
|
|
1121
|
-
var
|
|
1122
|
-
const
|
|
1123
|
-
if (
|
|
1124
|
-
return;
|
|
1125
|
-
|
|
1126
|
-
|
|
1130
|
+
var createNestedObject = (arr, lastValue) => {
|
|
1131
|
+
const nestedObject = {};
|
|
1132
|
+
if (arr.length === 0) {
|
|
1133
|
+
return lastValue;
|
|
1134
|
+
}
|
|
1135
|
+
arr.reduce((obj, value, index) => {
|
|
1136
|
+
if (!obj[value]) {
|
|
1137
|
+
obj[value] = {};
|
|
1138
|
+
}
|
|
1139
|
+
if (index === arr.length - 1 && lastValue) {
|
|
1140
|
+
obj[value] = lastValue;
|
|
1141
|
+
}
|
|
1142
|
+
return obj[value];
|
|
1143
|
+
}, nestedObject);
|
|
1144
|
+
return nestedObject;
|
|
1127
1145
|
};
|
|
1128
|
-
var
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1146
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
1147
|
+
if (!Array.isArray(path)) {
|
|
1148
|
+
throw new Error("Path must be an array.");
|
|
1131
1149
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1150
|
+
let current = obj;
|
|
1151
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1152
|
+
if (current[path[i]] === void 0) {
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
current = current[path[i]];
|
|
1137
1156
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
if (foundString || foundInArray)
|
|
1142
|
-
return el;
|
|
1157
|
+
const lastKey = path[path.length - 1];
|
|
1158
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
1159
|
+
delete current[lastKey];
|
|
1143
1160
|
}
|
|
1144
1161
|
};
|
|
1145
|
-
var
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
if (
|
|
1161
|
-
|
|
1162
|
+
var detectInfiniteLoop = (arr) => {
|
|
1163
|
+
const maxRepeats = 10;
|
|
1164
|
+
let pattern = [];
|
|
1165
|
+
let repeatCount = 0;
|
|
1166
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1167
|
+
if (pattern.length < 2) {
|
|
1168
|
+
pattern.push(arr[i]);
|
|
1169
|
+
} else {
|
|
1170
|
+
if (arr[i] === pattern[i % 2]) {
|
|
1171
|
+
repeatCount++;
|
|
1172
|
+
} else {
|
|
1173
|
+
pattern = [arr[i - 1], arr[i]];
|
|
1174
|
+
repeatCount = 1;
|
|
1175
|
+
}
|
|
1176
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
1177
|
+
if (ENV === "test" || ENV === "development") {
|
|
1178
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
1162
1179
|
}
|
|
1180
|
+
return true;
|
|
1163
1181
|
}
|
|
1164
1182
|
}
|
|
1165
1183
|
}
|
|
1166
|
-
traverse(obj);
|
|
1167
|
-
return result;
|
|
1168
1184
|
};
|
|
1169
1185
|
}
|
|
1170
1186
|
});
|
|
@@ -1190,6 +1206,7 @@ var require_cjs = __commonJS({
|
|
|
1190
1206
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
1191
1207
|
var function_exports = {};
|
|
1192
1208
|
__export22(function_exports, {
|
|
1209
|
+
cloneFunction: () => cloneFunction,
|
|
1193
1210
|
debounce: () => debounce,
|
|
1194
1211
|
debounceOnContext: () => debounceOnContext,
|
|
1195
1212
|
isStringFunction: () => isStringFunction,
|
|
@@ -1239,6 +1256,17 @@ var require_cjs = __commonJS({
|
|
|
1239
1256
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
1240
1257
|
return functionRegex.test(inputString);
|
|
1241
1258
|
};
|
|
1259
|
+
function cloneFunction(fn, win = window) {
|
|
1260
|
+
const temp = function() {
|
|
1261
|
+
return fn.apply(win, arguments);
|
|
1262
|
+
};
|
|
1263
|
+
for (const key in fn) {
|
|
1264
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
1265
|
+
temp[key] = fn[key];
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return temp;
|
|
1269
|
+
}
|
|
1242
1270
|
}
|
|
1243
1271
|
});
|
|
1244
1272
|
var require_log2 = __commonJS2({
|
|
@@ -1501,6 +1529,170 @@ var require_cjs = __commonJS({
|
|
|
1501
1529
|
var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
|
1502
1530
|
}
|
|
1503
1531
|
});
|
|
1532
|
+
var require_component2 = __commonJS2({
|
|
1533
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports2, module22) {
|
|
1534
|
+
"use strict";
|
|
1535
|
+
var __defProp22 = Object.defineProperty;
|
|
1536
|
+
var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
|
|
1537
|
+
var __getOwnPropNames22 = Object.getOwnPropertyNames;
|
|
1538
|
+
var __hasOwnProp22 = Object.prototype.hasOwnProperty;
|
|
1539
|
+
var __export22 = (target, all) => {
|
|
1540
|
+
for (var name in all)
|
|
1541
|
+
__defProp22(target, name, { get: all[name], enumerable: true });
|
|
1542
|
+
};
|
|
1543
|
+
var __copyProps22 = (to, from, except, desc) => {
|
|
1544
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1545
|
+
for (let key of __getOwnPropNames22(from))
|
|
1546
|
+
if (!__hasOwnProp22.call(to, key) && key !== except)
|
|
1547
|
+
__defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
|
|
1548
|
+
}
|
|
1549
|
+
return to;
|
|
1550
|
+
};
|
|
1551
|
+
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
1552
|
+
var component_exports = {};
|
|
1553
|
+
__export22(component_exports, {
|
|
1554
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
1555
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
1556
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1557
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1558
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1559
|
+
extendizeByKey: () => extendizeByKey,
|
|
1560
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1561
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
1562
|
+
hasVariantProp: () => hasVariantProp,
|
|
1563
|
+
isVariant: () => isVariant
|
|
1564
|
+
});
|
|
1565
|
+
module22.exports = __toCommonJS22(component_exports);
|
|
1566
|
+
var import__ = require_cjs4();
|
|
1567
|
+
var ENV = "development";
|
|
1568
|
+
var checkIfKeyIsComponent = (key) => {
|
|
1569
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1570
|
+
if (!isFirstKeyString)
|
|
1571
|
+
return;
|
|
1572
|
+
const firstCharKey = key.slice(0, 1);
|
|
1573
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
1574
|
+
};
|
|
1575
|
+
var checkIfKeyIsProperty = (key) => {
|
|
1576
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1577
|
+
if (!isFirstKeyString)
|
|
1578
|
+
return;
|
|
1579
|
+
const firstCharKey = key.slice(0, 1);
|
|
1580
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
1581
|
+
};
|
|
1582
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
1583
|
+
const { extend: elementExtend } = element;
|
|
1584
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1585
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
1586
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1587
|
+
return { ...element, extend };
|
|
1588
|
+
};
|
|
1589
|
+
var extendizeByKey = (element, parent, key) => {
|
|
1590
|
+
const { context } = parent;
|
|
1591
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
1592
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
1593
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1594
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1595
|
+
if (element === isExtendKeyComponent)
|
|
1596
|
+
return element;
|
|
1597
|
+
else if (!hasComponentAttrs || childProps) {
|
|
1598
|
+
return {
|
|
1599
|
+
extend: extendFromKey,
|
|
1600
|
+
tag,
|
|
1601
|
+
props: { ...element }
|
|
1602
|
+
};
|
|
1603
|
+
} else if (!extend || extend === true) {
|
|
1604
|
+
return {
|
|
1605
|
+
...element,
|
|
1606
|
+
tag,
|
|
1607
|
+
extend: extendFromKey
|
|
1608
|
+
};
|
|
1609
|
+
} else if (extend) {
|
|
1610
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
1611
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
1612
|
+
return {
|
|
1613
|
+
extend: extendFromKey,
|
|
1614
|
+
tag,
|
|
1615
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1620
|
+
return extendizeByKey(element, parent, key) || element;
|
|
1621
|
+
};
|
|
1622
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
1623
|
+
const { context } = element;
|
|
1624
|
+
if (!context || !context.components)
|
|
1625
|
+
return;
|
|
1626
|
+
const { components } = context;
|
|
1627
|
+
const { extend } = element;
|
|
1628
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
1629
|
+
if ((0, import__.isString)(execExtend)) {
|
|
1630
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
1631
|
+
if (componentExists)
|
|
1632
|
+
element.extend = componentExists;
|
|
1633
|
+
else {
|
|
1634
|
+
if ((ENV === "test" || ENV === "development") && options.verbose) {
|
|
1635
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
1636
|
+
console.warn("replacing with ", {});
|
|
1637
|
+
}
|
|
1638
|
+
element.extend = {};
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
var isVariant = (param) => {
|
|
1643
|
+
if (!(0, import__.isString)(param))
|
|
1644
|
+
return;
|
|
1645
|
+
const firstCharKey = param.slice(0, 1);
|
|
1646
|
+
return firstCharKey === ".";
|
|
1647
|
+
};
|
|
1648
|
+
var hasVariantProp = (element) => {
|
|
1649
|
+
const { props } = element;
|
|
1650
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
1651
|
+
return true;
|
|
1652
|
+
};
|
|
1653
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
1654
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
1655
|
+
return el;
|
|
1656
|
+
}
|
|
1657
|
+
if (el.extend) {
|
|
1658
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
1659
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
1660
|
+
if (foundString || foundInArray)
|
|
1661
|
+
return el;
|
|
1662
|
+
}
|
|
1663
|
+
if (el.parent && el.parent.childExtend) {
|
|
1664
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1665
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1666
|
+
if (foundString || foundInArray)
|
|
1667
|
+
return el;
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
var getExtendsInElement = (obj) => {
|
|
1671
|
+
let result = [];
|
|
1672
|
+
function traverse(o) {
|
|
1673
|
+
for (const key in o) {
|
|
1674
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
1675
|
+
if (checkIfKeyIsComponent(key)) {
|
|
1676
|
+
result.push(key);
|
|
1677
|
+
}
|
|
1678
|
+
if (key === "extend") {
|
|
1679
|
+
if (typeof o[key] === "string") {
|
|
1680
|
+
result.push(o[key]);
|
|
1681
|
+
} else if (Array.isArray(o[key])) {
|
|
1682
|
+
result = result.concat(o[key]);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
1686
|
+
traverse(o[key]);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
traverse(obj);
|
|
1692
|
+
return result;
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1504
1696
|
var require_cjs4 = __commonJS2({
|
|
1505
1697
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports2, module22) {
|
|
1506
1698
|
"use strict";
|
|
@@ -1532,6 +1724,7 @@ var require_cjs = __commonJS({
|
|
|
1532
1724
|
__reExport(utils_exports, require_globals2(), module22.exports);
|
|
1533
1725
|
__reExport(utils_exports, require_cookie2(), module22.exports);
|
|
1534
1726
|
__reExport(utils_exports, require_tags2(), module22.exports);
|
|
1727
|
+
__reExport(utils_exports, require_component2(), module22.exports);
|
|
1535
1728
|
}
|
|
1536
1729
|
});
|
|
1537
1730
|
var src_exports = {};
|
|
@@ -1547,7 +1740,9 @@ var require_cjs = __commonJS({
|
|
|
1547
1740
|
loadCssFile: () => loadCssFile,
|
|
1548
1741
|
loadJavascript: () => loadJavascript,
|
|
1549
1742
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
1743
|
+
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
1550
1744
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
1745
|
+
registerFrameListener: () => registerFrameListener,
|
|
1551
1746
|
removeChars: () => removeChars,
|
|
1552
1747
|
toCamelCase: () => toCamelCase2,
|
|
1553
1748
|
toDashCase: () => toDashCase2,
|
|
@@ -1620,7 +1815,27 @@ var require_cjs = __commonJS({
|
|
|
1620
1815
|
}
|
|
1621
1816
|
});
|
|
1622
1817
|
};
|
|
1623
|
-
var loadJavascriptFileSync = (
|
|
1818
|
+
var loadJavascriptFileSync = (fileUrl, doc = document, type = "text/javascript") => {
|
|
1819
|
+
return new Promise((resolve, reject) => {
|
|
1820
|
+
const scriptEle = doc.createElement("script");
|
|
1821
|
+
scriptEle.type = type;
|
|
1822
|
+
scriptEle.src = fileUrl;
|
|
1823
|
+
const blocker = doc.createElement("div");
|
|
1824
|
+
blocker.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.8);z-index:9999;";
|
|
1825
|
+
doc.body.appendChild(blocker);
|
|
1826
|
+
scriptEle.onload = () => {
|
|
1827
|
+
console.log(`Successfully loaded: ${fileUrl}`);
|
|
1828
|
+
doc.body.removeChild(blocker);
|
|
1829
|
+
resolve();
|
|
1830
|
+
};
|
|
1831
|
+
scriptEle.onerror = () => {
|
|
1832
|
+
doc.body.removeChild(blocker);
|
|
1833
|
+
reject(new Error(`Failed to load: ${fileUrl}`));
|
|
1834
|
+
};
|
|
1835
|
+
doc.body.appendChild(scriptEle);
|
|
1836
|
+
});
|
|
1837
|
+
};
|
|
1838
|
+
var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
1624
1839
|
const xhr = new window.XMLHttpRequest();
|
|
1625
1840
|
xhr.open("GET", FILE_URL, false);
|
|
1626
1841
|
xhr.send();
|
|
@@ -1665,6 +1880,13 @@ var require_cjs = __commonJS({
|
|
|
1665
1880
|
}
|
|
1666
1881
|
};
|
|
1667
1882
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
1883
|
+
var registerFrameListener = (el) => {
|
|
1884
|
+
const { __ref: ref } = el;
|
|
1885
|
+
const { frameListeners } = ref.root.data;
|
|
1886
|
+
if (frameListeners && !frameListeners.has(el)) {
|
|
1887
|
+
frameListeners.add(el);
|
|
1888
|
+
}
|
|
1889
|
+
};
|
|
1668
1890
|
var copyStringToClipboard = async (str) => {
|
|
1669
1891
|
try {
|
|
1670
1892
|
await navigator.clipboard.writeText(str);
|
|
@@ -1986,7 +2208,6 @@ var require_array = __commonJS({
|
|
|
1986
2208
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
1987
2209
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
1988
2210
|
arraysEqual: () => arraysEqual,
|
|
1989
|
-
createNestedObject: () => createNestedObject,
|
|
1990
2211
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
1991
2212
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
1992
2213
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -2053,22 +2274,6 @@ var require_array = __commonJS({
|
|
|
2053
2274
|
}
|
|
2054
2275
|
return arr;
|
|
2055
2276
|
};
|
|
2056
|
-
var createNestedObject = (arr, lastValue) => {
|
|
2057
|
-
const nestedObject = {};
|
|
2058
|
-
if (arr.length === 0) {
|
|
2059
|
-
return lastValue;
|
|
2060
|
-
}
|
|
2061
|
-
arr.reduce((obj, value, index) => {
|
|
2062
|
-
if (!obj[value]) {
|
|
2063
|
-
obj[value] = {};
|
|
2064
|
-
}
|
|
2065
|
-
if (index === arr.length - 1 && lastValue) {
|
|
2066
|
-
obj[value] = lastValue;
|
|
2067
|
-
}
|
|
2068
|
-
return obj[value];
|
|
2069
|
-
}, nestedObject);
|
|
2070
|
-
return nestedObject;
|
|
2071
|
-
};
|
|
2072
2277
|
var removeValueFromArray = (arr, value) => {
|
|
2073
2278
|
const index = arr.indexOf(value);
|
|
2074
2279
|
if (index > -1) {
|
|
@@ -2289,8 +2494,8 @@ var require_object = __commonJS({
|
|
|
2289
2494
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
2290
2495
|
var object_exports = {};
|
|
2291
2496
|
__export2(object_exports, {
|
|
2292
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
2293
2497
|
clone: () => clone,
|
|
2498
|
+
createNestedObject: () => createNestedObject,
|
|
2294
2499
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
2295
2500
|
deepClone: () => deepClone2,
|
|
2296
2501
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -2301,13 +2506,12 @@ var require_object = __commonJS({
|
|
|
2301
2506
|
deepMerge: () => deepMerge2,
|
|
2302
2507
|
deepStringify: () => deepStringify,
|
|
2303
2508
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
2509
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
2304
2510
|
diff: () => diff,
|
|
2305
2511
|
diffArrays: () => diffArrays,
|
|
2306
2512
|
diffObjects: () => diffObjects,
|
|
2307
2513
|
exec: () => exec,
|
|
2308
2514
|
flattenRecursive: () => flattenRecursive,
|
|
2309
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
2310
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
2311
2515
|
hasOwnProperty: () => hasOwnProperty,
|
|
2312
2516
|
isEmpty: () => isEmpty,
|
|
2313
2517
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -2322,6 +2526,7 @@ var require_object = __commonJS({
|
|
|
2322
2526
|
overwriteDeep: () => overwriteDeep,
|
|
2323
2527
|
overwriteShallow: () => overwriteShallow,
|
|
2324
2528
|
removeFromObject: () => removeFromObject,
|
|
2529
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
2325
2530
|
stringToObject: () => stringToObject
|
|
2326
2531
|
});
|
|
2327
2532
|
module2.exports = __toCommonJS2(object_exports);
|
|
@@ -2330,6 +2535,7 @@ var require_object = __commonJS({
|
|
|
2330
2535
|
var import_array = require_array();
|
|
2331
2536
|
var import_string = require_string();
|
|
2332
2537
|
var import_node = require_node();
|
|
2538
|
+
var ENV = "development";
|
|
2333
2539
|
var exec = (param, element, state, context) => {
|
|
2334
2540
|
if ((0, import_types.isFunction)(param)) {
|
|
2335
2541
|
return param(
|
|
@@ -2441,6 +2647,8 @@ var require_object = __commonJS({
|
|
|
2441
2647
|
continue;
|
|
2442
2648
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2443
2649
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2650
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2651
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
2444
2652
|
} else
|
|
2445
2653
|
o[prop] = objProp;
|
|
2446
2654
|
}
|
|
@@ -2684,16 +2892,23 @@ var require_object = __commonJS({
|
|
|
2684
2892
|
}
|
|
2685
2893
|
return obj;
|
|
2686
2894
|
};
|
|
2687
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
2895
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2896
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2897
|
+
return params;
|
|
2898
|
+
}
|
|
2899
|
+
if (visited.has(obj)) {
|
|
2900
|
+
return visited.get(obj);
|
|
2901
|
+
}
|
|
2902
|
+
visited.set(obj, obj);
|
|
2688
2903
|
for (const e in params) {
|
|
2689
|
-
if (e === "__ref")
|
|
2690
|
-
continue;
|
|
2691
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
2904
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
2692
2905
|
continue;
|
|
2693
2906
|
const objProp = obj[e];
|
|
2694
2907
|
const paramsProp = params[e];
|
|
2695
|
-
if ((0,
|
|
2696
|
-
|
|
2908
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2909
|
+
obj[e] = paramsProp;
|
|
2910
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2911
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
2697
2912
|
} else if (paramsProp !== void 0) {
|
|
2698
2913
|
obj[e] = paramsProp;
|
|
2699
2914
|
}
|
|
@@ -2801,53 +3016,60 @@ var require_object = __commonJS({
|
|
|
2801
3016
|
}
|
|
2802
3017
|
return newObj;
|
|
2803
3018
|
};
|
|
2804
|
-
var
|
|
2805
|
-
const
|
|
2806
|
-
if (
|
|
2807
|
-
return;
|
|
2808
|
-
|
|
2809
|
-
|
|
3019
|
+
var createNestedObject = (arr, lastValue) => {
|
|
3020
|
+
const nestedObject = {};
|
|
3021
|
+
if (arr.length === 0) {
|
|
3022
|
+
return lastValue;
|
|
3023
|
+
}
|
|
3024
|
+
arr.reduce((obj, value, index) => {
|
|
3025
|
+
if (!obj[value]) {
|
|
3026
|
+
obj[value] = {};
|
|
3027
|
+
}
|
|
3028
|
+
if (index === arr.length - 1 && lastValue) {
|
|
3029
|
+
obj[value] = lastValue;
|
|
3030
|
+
}
|
|
3031
|
+
return obj[value];
|
|
3032
|
+
}, nestedObject);
|
|
3033
|
+
return nestedObject;
|
|
2810
3034
|
};
|
|
2811
|
-
var
|
|
2812
|
-
if (
|
|
2813
|
-
|
|
3035
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
3036
|
+
if (!Array.isArray(path)) {
|
|
3037
|
+
throw new Error("Path must be an array.");
|
|
2814
3038
|
}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
3039
|
+
let current = obj;
|
|
3040
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
3041
|
+
if (current[path[i]] === void 0) {
|
|
3042
|
+
return;
|
|
3043
|
+
}
|
|
3044
|
+
current = current[path[i]];
|
|
2820
3045
|
}
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
if (foundString || foundInArray)
|
|
2825
|
-
return el;
|
|
3046
|
+
const lastKey = path[path.length - 1];
|
|
3047
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
3048
|
+
delete current[lastKey];
|
|
2826
3049
|
}
|
|
2827
3050
|
};
|
|
2828
|
-
var
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
if (
|
|
2844
|
-
|
|
3051
|
+
var detectInfiniteLoop = (arr) => {
|
|
3052
|
+
const maxRepeats = 10;
|
|
3053
|
+
let pattern = [];
|
|
3054
|
+
let repeatCount = 0;
|
|
3055
|
+
for (let i = 0; i < arr.length; i++) {
|
|
3056
|
+
if (pattern.length < 2) {
|
|
3057
|
+
pattern.push(arr[i]);
|
|
3058
|
+
} else {
|
|
3059
|
+
if (arr[i] === pattern[i % 2]) {
|
|
3060
|
+
repeatCount++;
|
|
3061
|
+
} else {
|
|
3062
|
+
pattern = [arr[i - 1], arr[i]];
|
|
3063
|
+
repeatCount = 1;
|
|
3064
|
+
}
|
|
3065
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
3066
|
+
if (ENV === "test" || ENV === "development") {
|
|
3067
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
2845
3068
|
}
|
|
3069
|
+
return true;
|
|
2846
3070
|
}
|
|
2847
3071
|
}
|
|
2848
3072
|
}
|
|
2849
|
-
traverse(obj);
|
|
2850
|
-
return result;
|
|
2851
3073
|
};
|
|
2852
3074
|
}
|
|
2853
3075
|
});
|
|
@@ -2875,6 +3097,7 @@ var require_function = __commonJS({
|
|
|
2875
3097
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
2876
3098
|
var function_exports = {};
|
|
2877
3099
|
__export2(function_exports, {
|
|
3100
|
+
cloneFunction: () => cloneFunction,
|
|
2878
3101
|
debounce: () => debounce,
|
|
2879
3102
|
debounceOnContext: () => debounceOnContext,
|
|
2880
3103
|
isStringFunction: () => isStringFunction,
|
|
@@ -2924,6 +3147,17 @@ var require_function = __commonJS({
|
|
|
2924
3147
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
2925
3148
|
return functionRegex.test(inputString);
|
|
2926
3149
|
};
|
|
3150
|
+
function cloneFunction(fn, win = window) {
|
|
3151
|
+
const temp = function() {
|
|
3152
|
+
return fn.apply(win, arguments);
|
|
3153
|
+
};
|
|
3154
|
+
for (const key in fn) {
|
|
3155
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
3156
|
+
temp[key] = fn[key];
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
return temp;
|
|
3160
|
+
}
|
|
2927
3161
|
}
|
|
2928
3162
|
});
|
|
2929
3163
|
|
|
@@ -3193,6 +3427,172 @@ var require_tags = __commonJS({
|
|
|
3193
3427
|
}
|
|
3194
3428
|
});
|
|
3195
3429
|
|
|
3430
|
+
// ../../../domql/packages/utils/dist/cjs/component.js
|
|
3431
|
+
var require_component = __commonJS({
|
|
3432
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports, module2) {
|
|
3433
|
+
"use strict";
|
|
3434
|
+
var __defProp2 = Object.defineProperty;
|
|
3435
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
3436
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
3437
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
3438
|
+
var __export2 = (target, all) => {
|
|
3439
|
+
for (var name in all)
|
|
3440
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
3441
|
+
};
|
|
3442
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
3443
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3444
|
+
for (let key of __getOwnPropNames2(from))
|
|
3445
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
3446
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
3447
|
+
}
|
|
3448
|
+
return to;
|
|
3449
|
+
};
|
|
3450
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
3451
|
+
var component_exports = {};
|
|
3452
|
+
__export2(component_exports, {
|
|
3453
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
3454
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
3455
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3456
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
3457
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
3458
|
+
extendizeByKey: () => extendizeByKey,
|
|
3459
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3460
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
3461
|
+
hasVariantProp: () => hasVariantProp,
|
|
3462
|
+
isVariant: () => isVariant
|
|
3463
|
+
});
|
|
3464
|
+
module2.exports = __toCommonJS2(component_exports);
|
|
3465
|
+
var import__ = require_cjs2();
|
|
3466
|
+
var ENV = "development";
|
|
3467
|
+
var checkIfKeyIsComponent = (key) => {
|
|
3468
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3469
|
+
if (!isFirstKeyString)
|
|
3470
|
+
return;
|
|
3471
|
+
const firstCharKey = key.slice(0, 1);
|
|
3472
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
3473
|
+
};
|
|
3474
|
+
var checkIfKeyIsProperty = (key) => {
|
|
3475
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3476
|
+
if (!isFirstKeyString)
|
|
3477
|
+
return;
|
|
3478
|
+
const firstCharKey = key.slice(0, 1);
|
|
3479
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
3480
|
+
};
|
|
3481
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
3482
|
+
const { extend: elementExtend } = element;
|
|
3483
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3484
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
3485
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
3486
|
+
return { ...element, extend };
|
|
3487
|
+
};
|
|
3488
|
+
var extendizeByKey = (element, parent, key) => {
|
|
3489
|
+
const { context } = parent;
|
|
3490
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
3491
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
3492
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3493
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3494
|
+
if (element === isExtendKeyComponent)
|
|
3495
|
+
return element;
|
|
3496
|
+
else if (!hasComponentAttrs || childProps) {
|
|
3497
|
+
return {
|
|
3498
|
+
extend: extendFromKey,
|
|
3499
|
+
tag,
|
|
3500
|
+
props: { ...element }
|
|
3501
|
+
};
|
|
3502
|
+
} else if (!extend || extend === true) {
|
|
3503
|
+
return {
|
|
3504
|
+
...element,
|
|
3505
|
+
tag,
|
|
3506
|
+
extend: extendFromKey
|
|
3507
|
+
};
|
|
3508
|
+
} else if (extend) {
|
|
3509
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
3510
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
3511
|
+
return {
|
|
3512
|
+
extend: extendFromKey,
|
|
3513
|
+
tag,
|
|
3514
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
3515
|
+
};
|
|
3516
|
+
}
|
|
3517
|
+
};
|
|
3518
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
3519
|
+
return extendizeByKey(element, parent, key) || element;
|
|
3520
|
+
};
|
|
3521
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
3522
|
+
const { context } = element;
|
|
3523
|
+
if (!context || !context.components)
|
|
3524
|
+
return;
|
|
3525
|
+
const { components } = context;
|
|
3526
|
+
const { extend } = element;
|
|
3527
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
3528
|
+
if ((0, import__.isString)(execExtend)) {
|
|
3529
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
3530
|
+
if (componentExists)
|
|
3531
|
+
element.extend = componentExists;
|
|
3532
|
+
else {
|
|
3533
|
+
if ((ENV === "test" || ENV === "development") && options.verbose) {
|
|
3534
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
3535
|
+
console.warn("replacing with ", {});
|
|
3536
|
+
}
|
|
3537
|
+
element.extend = {};
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
};
|
|
3541
|
+
var isVariant = (param) => {
|
|
3542
|
+
if (!(0, import__.isString)(param))
|
|
3543
|
+
return;
|
|
3544
|
+
const firstCharKey = param.slice(0, 1);
|
|
3545
|
+
return firstCharKey === ".";
|
|
3546
|
+
};
|
|
3547
|
+
var hasVariantProp = (element) => {
|
|
3548
|
+
const { props } = element;
|
|
3549
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
3550
|
+
return true;
|
|
3551
|
+
};
|
|
3552
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
3553
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
3554
|
+
return el;
|
|
3555
|
+
}
|
|
3556
|
+
if (el.extend) {
|
|
3557
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
3558
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
3559
|
+
if (foundString || foundInArray)
|
|
3560
|
+
return el;
|
|
3561
|
+
}
|
|
3562
|
+
if (el.parent && el.parent.childExtend) {
|
|
3563
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
3564
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
3565
|
+
if (foundString || foundInArray)
|
|
3566
|
+
return el;
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3569
|
+
var getExtendsInElement = (obj) => {
|
|
3570
|
+
let result = [];
|
|
3571
|
+
function traverse(o) {
|
|
3572
|
+
for (const key in o) {
|
|
3573
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
3574
|
+
if (checkIfKeyIsComponent(key)) {
|
|
3575
|
+
result.push(key);
|
|
3576
|
+
}
|
|
3577
|
+
if (key === "extend") {
|
|
3578
|
+
if (typeof o[key] === "string") {
|
|
3579
|
+
result.push(o[key]);
|
|
3580
|
+
} else if (Array.isArray(o[key])) {
|
|
3581
|
+
result = result.concat(o[key]);
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
3585
|
+
traverse(o[key]);
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
traverse(obj);
|
|
3591
|
+
return result;
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3594
|
+
});
|
|
3595
|
+
|
|
3196
3596
|
// ../../../domql/packages/utils/dist/cjs/index.js
|
|
3197
3597
|
var require_cjs2 = __commonJS({
|
|
3198
3598
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports, module2) {
|
|
@@ -3225,6 +3625,7 @@ var require_cjs2 = __commonJS({
|
|
|
3225
3625
|
__reExport(utils_exports, require_globals(), module2.exports);
|
|
3226
3626
|
__reExport(utils_exports, require_cookie(), module2.exports);
|
|
3227
3627
|
__reExport(utils_exports, require_tags(), module2.exports);
|
|
3628
|
+
__reExport(utils_exports, require_component(), module2.exports);
|
|
3228
3629
|
}
|
|
3229
3630
|
});
|
|
3230
3631
|
|