@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
package/dist/cjs/utils/index.js
CHANGED
|
@@ -336,7 +336,6 @@ var require_array = __commonJS({
|
|
|
336
336
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
337
337
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
338
338
|
arraysEqual: () => arraysEqual,
|
|
339
|
-
createNestedObject: () => createNestedObject,
|
|
340
339
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
341
340
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
342
341
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -403,22 +402,6 @@ var require_array = __commonJS({
|
|
|
403
402
|
}
|
|
404
403
|
return arr;
|
|
405
404
|
};
|
|
406
|
-
var createNestedObject = (arr, lastValue) => {
|
|
407
|
-
const nestedObject = {};
|
|
408
|
-
if (arr.length === 0) {
|
|
409
|
-
return lastValue;
|
|
410
|
-
}
|
|
411
|
-
arr.reduce((obj, value, index) => {
|
|
412
|
-
if (!obj[value]) {
|
|
413
|
-
obj[value] = {};
|
|
414
|
-
}
|
|
415
|
-
if (index === arr.length - 1 && lastValue) {
|
|
416
|
-
obj[value] = lastValue;
|
|
417
|
-
}
|
|
418
|
-
return obj[value];
|
|
419
|
-
}, nestedObject);
|
|
420
|
-
return nestedObject;
|
|
421
|
-
};
|
|
422
405
|
var removeValueFromArray = (arr, value) => {
|
|
423
406
|
const index = arr.indexOf(value);
|
|
424
407
|
if (index > -1) {
|
|
@@ -639,8 +622,8 @@ var require_object = __commonJS({
|
|
|
639
622
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
640
623
|
var object_exports = {};
|
|
641
624
|
__export2(object_exports, {
|
|
642
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
643
625
|
clone: () => clone,
|
|
626
|
+
createNestedObject: () => createNestedObject,
|
|
644
627
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
645
628
|
deepClone: () => deepClone2,
|
|
646
629
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -651,13 +634,12 @@ var require_object = __commonJS({
|
|
|
651
634
|
deepMerge: () => deepMerge2,
|
|
652
635
|
deepStringify: () => deepStringify,
|
|
653
636
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
637
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
654
638
|
diff: () => diff,
|
|
655
639
|
diffArrays: () => diffArrays,
|
|
656
640
|
diffObjects: () => diffObjects,
|
|
657
641
|
exec: () => exec,
|
|
658
642
|
flattenRecursive: () => flattenRecursive,
|
|
659
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
660
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
661
643
|
hasOwnProperty: () => hasOwnProperty,
|
|
662
644
|
isEmpty: () => isEmpty,
|
|
663
645
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -672,6 +654,7 @@ var require_object = __commonJS({
|
|
|
672
654
|
overwriteDeep: () => overwriteDeep,
|
|
673
655
|
overwriteShallow: () => overwriteShallow,
|
|
674
656
|
removeFromObject: () => removeFromObject,
|
|
657
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
675
658
|
stringToObject: () => stringToObject
|
|
676
659
|
});
|
|
677
660
|
module2.exports = __toCommonJS2(object_exports);
|
|
@@ -680,6 +663,7 @@ var require_object = __commonJS({
|
|
|
680
663
|
var import_array = require_array();
|
|
681
664
|
var import_string = require_string();
|
|
682
665
|
var import_node = require_node();
|
|
666
|
+
var ENV2 = "development";
|
|
683
667
|
var exec = (param, element, state, context) => {
|
|
684
668
|
if ((0, import_types.isFunction)(param)) {
|
|
685
669
|
return param(
|
|
@@ -791,6 +775,8 @@ var require_object = __commonJS({
|
|
|
791
775
|
continue;
|
|
792
776
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
793
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() + ")");
|
|
794
780
|
} else
|
|
795
781
|
o[prop] = objProp;
|
|
796
782
|
}
|
|
@@ -1034,16 +1020,23 @@ var require_object = __commonJS({
|
|
|
1034
1020
|
}
|
|
1035
1021
|
return obj;
|
|
1036
1022
|
};
|
|
1037
|
-
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);
|
|
1038
1031
|
for (const e in params) {
|
|
1039
|
-
if (e === "__ref")
|
|
1040
|
-
continue;
|
|
1041
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
1032
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
1042
1033
|
continue;
|
|
1043
1034
|
const objProp = obj[e];
|
|
1044
1035
|
const paramsProp = params[e];
|
|
1045
|
-
if ((0,
|
|
1046
|
-
|
|
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);
|
|
1047
1040
|
} else if (paramsProp !== void 0) {
|
|
1048
1041
|
obj[e] = paramsProp;
|
|
1049
1042
|
}
|
|
@@ -1151,53 +1144,60 @@ var require_object = __commonJS({
|
|
|
1151
1144
|
}
|
|
1152
1145
|
return newObj;
|
|
1153
1146
|
};
|
|
1154
|
-
var
|
|
1155
|
-
const
|
|
1156
|
-
if (
|
|
1157
|
-
return;
|
|
1158
|
-
|
|
1159
|
-
|
|
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;
|
|
1160
1162
|
};
|
|
1161
|
-
var
|
|
1162
|
-
if (
|
|
1163
|
-
|
|
1163
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
1164
|
+
if (!Array.isArray(path)) {
|
|
1165
|
+
throw new Error("Path must be an array.");
|
|
1164
1166
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
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]];
|
|
1170
1173
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
if (foundString || foundInArray)
|
|
1175
|
-
return el;
|
|
1174
|
+
const lastKey = path[path.length - 1];
|
|
1175
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
1176
|
+
delete current[lastKey];
|
|
1176
1177
|
}
|
|
1177
1178
|
};
|
|
1178
|
-
var
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
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);
|
|
1195
1196
|
}
|
|
1197
|
+
return true;
|
|
1196
1198
|
}
|
|
1197
1199
|
}
|
|
1198
1200
|
}
|
|
1199
|
-
traverse(obj);
|
|
1200
|
-
return result;
|
|
1201
1201
|
};
|
|
1202
1202
|
}
|
|
1203
1203
|
});
|
|
@@ -1225,6 +1225,7 @@ var require_function = __commonJS({
|
|
|
1225
1225
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1226
1226
|
var function_exports = {};
|
|
1227
1227
|
__export2(function_exports, {
|
|
1228
|
+
cloneFunction: () => cloneFunction,
|
|
1228
1229
|
debounce: () => debounce,
|
|
1229
1230
|
debounceOnContext: () => debounceOnContext,
|
|
1230
1231
|
isStringFunction: () => isStringFunction,
|
|
@@ -1274,6 +1275,17 @@ var require_function = __commonJS({
|
|
|
1274
1275
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
1275
1276
|
return functionRegex.test(inputString);
|
|
1276
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
|
+
}
|
|
1277
1289
|
}
|
|
1278
1290
|
});
|
|
1279
1291
|
|
|
@@ -1543,6 +1555,172 @@ var require_tags = __commonJS({
|
|
|
1543
1555
|
}
|
|
1544
1556
|
});
|
|
1545
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
|
+
|
|
1546
1724
|
// ../../../domql/packages/utils/dist/cjs/index.js
|
|
1547
1725
|
var require_cjs2 = __commonJS({
|
|
1548
1726
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports, module2) {
|
|
@@ -1575,6 +1753,7 @@ var require_cjs2 = __commonJS({
|
|
|
1575
1753
|
__reExport(utils_exports2, require_globals(), module2.exports);
|
|
1576
1754
|
__reExport(utils_exports2, require_cookie(), module2.exports);
|
|
1577
1755
|
__reExport(utils_exports2, require_tags(), module2.exports);
|
|
1756
|
+
__reExport(utils_exports2, require_component(), module2.exports);
|
|
1578
1757
|
}
|
|
1579
1758
|
});
|
|
1580
1759
|
|
|
@@ -1741,6 +1920,7 @@ var require_cjs3 = __commonJS({
|
|
|
1741
1920
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
1742
1921
|
var node_exports = {};
|
|
1743
1922
|
__export22(node_exports, {
|
|
1923
|
+
isDOMNode: () => isDOMNode,
|
|
1744
1924
|
isHtmlElement: () => isHtmlElement,
|
|
1745
1925
|
isNode: () => isNode
|
|
1746
1926
|
});
|
|
@@ -1752,6 +1932,9 @@ var require_cjs3 = __commonJS({
|
|
|
1752
1932
|
var isHtmlElement = (obj) => {
|
|
1753
1933
|
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
1754
1934
|
};
|
|
1935
|
+
var isDOMNode = (obj) => {
|
|
1936
|
+
return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
|
|
1937
|
+
};
|
|
1755
1938
|
}
|
|
1756
1939
|
});
|
|
1757
1940
|
var require_types2 = __commonJS2({
|
|
@@ -1867,7 +2050,6 @@ var require_cjs3 = __commonJS({
|
|
|
1867
2050
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
1868
2051
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
1869
2052
|
arraysEqual: () => arraysEqual,
|
|
1870
|
-
createNestedObject: () => createNestedObject,
|
|
1871
2053
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
1872
2054
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
1873
2055
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -1934,22 +2116,6 @@ var require_cjs3 = __commonJS({
|
|
|
1934
2116
|
}
|
|
1935
2117
|
return arr;
|
|
1936
2118
|
};
|
|
1937
|
-
var createNestedObject = (arr, lastValue) => {
|
|
1938
|
-
const nestedObject = {};
|
|
1939
|
-
if (arr.length === 0) {
|
|
1940
|
-
return lastValue;
|
|
1941
|
-
}
|
|
1942
|
-
arr.reduce((obj, value, index) => {
|
|
1943
|
-
if (!obj[value]) {
|
|
1944
|
-
obj[value] = {};
|
|
1945
|
-
}
|
|
1946
|
-
if (index === arr.length - 1 && lastValue) {
|
|
1947
|
-
obj[value] = lastValue;
|
|
1948
|
-
}
|
|
1949
|
-
return obj[value];
|
|
1950
|
-
}, nestedObject);
|
|
1951
|
-
return nestedObject;
|
|
1952
|
-
};
|
|
1953
2119
|
var removeValueFromArray = (arr, value) => {
|
|
1954
2120
|
const index = arr.indexOf(value);
|
|
1955
2121
|
if (index > -1) {
|
|
@@ -2166,8 +2332,8 @@ var require_cjs3 = __commonJS({
|
|
|
2166
2332
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
2167
2333
|
var object_exports = {};
|
|
2168
2334
|
__export22(object_exports, {
|
|
2169
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
2170
2335
|
clone: () => clone,
|
|
2336
|
+
createNestedObject: () => createNestedObject,
|
|
2171
2337
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
2172
2338
|
deepClone: () => deepClone2,
|
|
2173
2339
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -2178,13 +2344,12 @@ var require_cjs3 = __commonJS({
|
|
|
2178
2344
|
deepMerge: () => deepMerge2,
|
|
2179
2345
|
deepStringify: () => deepStringify,
|
|
2180
2346
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
2347
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
2181
2348
|
diff: () => diff,
|
|
2182
2349
|
diffArrays: () => diffArrays,
|
|
2183
2350
|
diffObjects: () => diffObjects,
|
|
2184
2351
|
exec: () => exec,
|
|
2185
2352
|
flattenRecursive: () => flattenRecursive,
|
|
2186
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
2187
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
2188
2353
|
hasOwnProperty: () => hasOwnProperty,
|
|
2189
2354
|
isEmpty: () => isEmpty,
|
|
2190
2355
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -2199,6 +2364,7 @@ var require_cjs3 = __commonJS({
|
|
|
2199
2364
|
overwriteDeep: () => overwriteDeep,
|
|
2200
2365
|
overwriteShallow: () => overwriteShallow,
|
|
2201
2366
|
removeFromObject: () => removeFromObject,
|
|
2367
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
2202
2368
|
stringToObject: () => stringToObject
|
|
2203
2369
|
});
|
|
2204
2370
|
module22.exports = __toCommonJS22(object_exports);
|
|
@@ -2206,6 +2372,8 @@ var require_cjs3 = __commonJS({
|
|
|
2206
2372
|
var import_types = require_types2();
|
|
2207
2373
|
var import_array = require_array2();
|
|
2208
2374
|
var import_string = require_string2();
|
|
2375
|
+
var import_node = require_node2();
|
|
2376
|
+
var ENV2 = "development";
|
|
2209
2377
|
var exec = (param, element, state, context) => {
|
|
2210
2378
|
if ((0, import_types.isFunction)(param)) {
|
|
2211
2379
|
return param(
|
|
@@ -2284,27 +2452,28 @@ var require_cjs3 = __commonJS({
|
|
|
2284
2452
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
2285
2453
|
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
2286
2454
|
};
|
|
2287
|
-
var deepClone2 = (obj,
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2455
|
+
var deepClone2 = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2456
|
+
if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
|
|
2457
|
+
return obj;
|
|
2458
|
+
if (visited.has(obj))
|
|
2459
|
+
return visited.get(obj);
|
|
2460
|
+
const clone2 = (0, import_types.isArray)(obj) ? [] : {};
|
|
2461
|
+
visited.set(obj, clone2);
|
|
2462
|
+
for (const key in obj) {
|
|
2463
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
|
|
2464
|
+
const value = obj[key];
|
|
2465
|
+
if ((0, import_node.isDOMNode)(value)) {
|
|
2466
|
+
clone2[key] = value;
|
|
2467
|
+
} else if (key === "extend" && (0, import_types.isArray)(value)) {
|
|
2468
|
+
clone2[key] = (0, import_array.mergeArray)(value, exclude);
|
|
2469
|
+
} else if ((0, import_types.isObjectLike)(value)) {
|
|
2470
|
+
clone2[key] = deepClone2(value, exclude, cleanUndefined, visited);
|
|
2471
|
+
} else {
|
|
2472
|
+
clone2[key] = value;
|
|
2473
|
+
}
|
|
2301
2474
|
}
|
|
2302
|
-
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2303
|
-
o[prop] = deepClone2(objProp, excludeFrom, cleanUndefined);
|
|
2304
|
-
} else
|
|
2305
|
-
o[prop] = objProp;
|
|
2306
2475
|
}
|
|
2307
|
-
return
|
|
2476
|
+
return clone2;
|
|
2308
2477
|
};
|
|
2309
2478
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2310
2479
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
@@ -2316,6 +2485,8 @@ var require_cjs3 = __commonJS({
|
|
|
2316
2485
|
continue;
|
|
2317
2486
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2318
2487
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2488
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2489
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
2319
2490
|
} else
|
|
2320
2491
|
o[prop] = objProp;
|
|
2321
2492
|
}
|
|
@@ -2559,16 +2730,23 @@ var require_cjs3 = __commonJS({
|
|
|
2559
2730
|
}
|
|
2560
2731
|
return obj;
|
|
2561
2732
|
};
|
|
2562
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
2733
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2734
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2735
|
+
return params;
|
|
2736
|
+
}
|
|
2737
|
+
if (visited.has(obj)) {
|
|
2738
|
+
return visited.get(obj);
|
|
2739
|
+
}
|
|
2740
|
+
visited.set(obj, obj);
|
|
2563
2741
|
for (const e in params) {
|
|
2564
|
-
if (e === "__ref")
|
|
2565
|
-
continue;
|
|
2566
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
2742
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
2567
2743
|
continue;
|
|
2568
2744
|
const objProp = obj[e];
|
|
2569
2745
|
const paramsProp = params[e];
|
|
2570
|
-
if ((0,
|
|
2571
|
-
|
|
2746
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2747
|
+
obj[e] = paramsProp;
|
|
2748
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2749
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
2572
2750
|
} else if (paramsProp !== void 0) {
|
|
2573
2751
|
obj[e] = paramsProp;
|
|
2574
2752
|
}
|
|
@@ -2615,30 +2793,40 @@ var require_cjs3 = __commonJS({
|
|
|
2615
2793
|
}
|
|
2616
2794
|
return true;
|
|
2617
2795
|
};
|
|
2618
|
-
var deepContains = (obj1, obj2) => {
|
|
2619
|
-
if (
|
|
2796
|
+
var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
|
|
2797
|
+
if (obj1 === obj2)
|
|
2798
|
+
return true;
|
|
2799
|
+
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
|
|
2620
2800
|
return false;
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2801
|
+
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
|
|
2802
|
+
return obj1 === obj2;
|
|
2803
|
+
const stack = [[obj1, obj2]];
|
|
2804
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
2805
|
+
while (stack.length > 0) {
|
|
2806
|
+
const [current1, current2] = stack.pop();
|
|
2807
|
+
if (visited.has(current1))
|
|
2808
|
+
continue;
|
|
2809
|
+
visited.add(current1);
|
|
2810
|
+
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
|
|
2811
|
+
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
|
|
2812
|
+
if (keys1.length !== keys2.length)
|
|
2813
|
+
return false;
|
|
2814
|
+
for (const key of keys1) {
|
|
2815
|
+
if (!Object.prototype.hasOwnProperty.call(current2, key))
|
|
2625
2816
|
return false;
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
} else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
|
|
2633
|
-
for (const key in obj1) {
|
|
2634
|
-
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
|
|
2635
|
-
if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
|
|
2817
|
+
const value1 = current1[key];
|
|
2818
|
+
const value2 = current2[key];
|
|
2819
|
+
if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
|
|
2820
|
+
if (value1 !== value2)
|
|
2636
2821
|
return false;
|
|
2822
|
+
} else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
|
|
2823
|
+
if (value1 !== value2) {
|
|
2824
|
+
stack.push([value1, value2]);
|
|
2637
2825
|
}
|
|
2826
|
+
} else if (value1 !== value2) {
|
|
2827
|
+
return false;
|
|
2638
2828
|
}
|
|
2639
2829
|
}
|
|
2640
|
-
} else {
|
|
2641
|
-
return obj2 === obj1;
|
|
2642
2830
|
}
|
|
2643
2831
|
return true;
|
|
2644
2832
|
};
|
|
@@ -2666,53 +2854,60 @@ var require_cjs3 = __commonJS({
|
|
|
2666
2854
|
}
|
|
2667
2855
|
return newObj;
|
|
2668
2856
|
};
|
|
2669
|
-
var
|
|
2670
|
-
const
|
|
2671
|
-
if (
|
|
2672
|
-
return;
|
|
2673
|
-
|
|
2674
|
-
|
|
2857
|
+
var createNestedObject = (arr, lastValue) => {
|
|
2858
|
+
const nestedObject = {};
|
|
2859
|
+
if (arr.length === 0) {
|
|
2860
|
+
return lastValue;
|
|
2861
|
+
}
|
|
2862
|
+
arr.reduce((obj, value, index) => {
|
|
2863
|
+
if (!obj[value]) {
|
|
2864
|
+
obj[value] = {};
|
|
2865
|
+
}
|
|
2866
|
+
if (index === arr.length - 1 && lastValue) {
|
|
2867
|
+
obj[value] = lastValue;
|
|
2868
|
+
}
|
|
2869
|
+
return obj[value];
|
|
2870
|
+
}, nestedObject);
|
|
2871
|
+
return nestedObject;
|
|
2675
2872
|
};
|
|
2676
|
-
var
|
|
2677
|
-
if (
|
|
2678
|
-
|
|
2873
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
2874
|
+
if (!Array.isArray(path)) {
|
|
2875
|
+
throw new Error("Path must be an array.");
|
|
2679
2876
|
}
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2877
|
+
let current = obj;
|
|
2878
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
2879
|
+
if (current[path[i]] === void 0) {
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
current = current[path[i]];
|
|
2685
2883
|
}
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
if (foundString || foundInArray)
|
|
2690
|
-
return el;
|
|
2884
|
+
const lastKey = path[path.length - 1];
|
|
2885
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
2886
|
+
delete current[lastKey];
|
|
2691
2887
|
}
|
|
2692
2888
|
};
|
|
2693
|
-
var
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
if (
|
|
2709
|
-
|
|
2889
|
+
var detectInfiniteLoop = (arr) => {
|
|
2890
|
+
const maxRepeats = 10;
|
|
2891
|
+
let pattern = [];
|
|
2892
|
+
let repeatCount = 0;
|
|
2893
|
+
for (let i = 0; i < arr.length; i++) {
|
|
2894
|
+
if (pattern.length < 2) {
|
|
2895
|
+
pattern.push(arr[i]);
|
|
2896
|
+
} else {
|
|
2897
|
+
if (arr[i] === pattern[i % 2]) {
|
|
2898
|
+
repeatCount++;
|
|
2899
|
+
} else {
|
|
2900
|
+
pattern = [arr[i - 1], arr[i]];
|
|
2901
|
+
repeatCount = 1;
|
|
2902
|
+
}
|
|
2903
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
2904
|
+
if (ENV2 === "test" || ENV2 === "development") {
|
|
2905
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
2710
2906
|
}
|
|
2907
|
+
return true;
|
|
2711
2908
|
}
|
|
2712
2909
|
}
|
|
2713
2910
|
}
|
|
2714
|
-
traverse(obj);
|
|
2715
|
-
return result;
|
|
2716
2911
|
};
|
|
2717
2912
|
}
|
|
2718
2913
|
});
|
|
@@ -2738,6 +2933,7 @@ var require_cjs3 = __commonJS({
|
|
|
2738
2933
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
2739
2934
|
var function_exports = {};
|
|
2740
2935
|
__export22(function_exports, {
|
|
2936
|
+
cloneFunction: () => cloneFunction,
|
|
2741
2937
|
debounce: () => debounce,
|
|
2742
2938
|
debounceOnContext: () => debounceOnContext,
|
|
2743
2939
|
isStringFunction: () => isStringFunction,
|
|
@@ -2787,6 +2983,17 @@ var require_cjs3 = __commonJS({
|
|
|
2787
2983
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
2788
2984
|
return functionRegex.test(inputString);
|
|
2789
2985
|
};
|
|
2986
|
+
function cloneFunction(fn, win = window) {
|
|
2987
|
+
const temp = function() {
|
|
2988
|
+
return fn.apply(win, arguments);
|
|
2989
|
+
};
|
|
2990
|
+
for (const key in fn) {
|
|
2991
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
2992
|
+
temp[key] = fn[key];
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
return temp;
|
|
2996
|
+
}
|
|
2790
2997
|
}
|
|
2791
2998
|
});
|
|
2792
2999
|
var require_log2 = __commonJS2({
|
|
@@ -3049,6 +3256,170 @@ var require_cjs3 = __commonJS({
|
|
|
3049
3256
|
var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
|
3050
3257
|
}
|
|
3051
3258
|
});
|
|
3259
|
+
var require_component2 = __commonJS2({
|
|
3260
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports2, module22) {
|
|
3261
|
+
"use strict";
|
|
3262
|
+
var __defProp22 = Object.defineProperty;
|
|
3263
|
+
var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
|
|
3264
|
+
var __getOwnPropNames22 = Object.getOwnPropertyNames;
|
|
3265
|
+
var __hasOwnProp22 = Object.prototype.hasOwnProperty;
|
|
3266
|
+
var __export22 = (target, all) => {
|
|
3267
|
+
for (var name in all)
|
|
3268
|
+
__defProp22(target, name, { get: all[name], enumerable: true });
|
|
3269
|
+
};
|
|
3270
|
+
var __copyProps22 = (to, from, except, desc) => {
|
|
3271
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3272
|
+
for (let key of __getOwnPropNames22(from))
|
|
3273
|
+
if (!__hasOwnProp22.call(to, key) && key !== except)
|
|
3274
|
+
__defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
|
|
3275
|
+
}
|
|
3276
|
+
return to;
|
|
3277
|
+
};
|
|
3278
|
+
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
3279
|
+
var component_exports = {};
|
|
3280
|
+
__export22(component_exports, {
|
|
3281
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
3282
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
3283
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3284
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
3285
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
3286
|
+
extendizeByKey: () => extendizeByKey,
|
|
3287
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3288
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
3289
|
+
hasVariantProp: () => hasVariantProp,
|
|
3290
|
+
isVariant: () => isVariant
|
|
3291
|
+
});
|
|
3292
|
+
module22.exports = __toCommonJS22(component_exports);
|
|
3293
|
+
var import__ = require_cjs4();
|
|
3294
|
+
var ENV2 = "development";
|
|
3295
|
+
var checkIfKeyIsComponent = (key) => {
|
|
3296
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3297
|
+
if (!isFirstKeyString)
|
|
3298
|
+
return;
|
|
3299
|
+
const firstCharKey = key.slice(0, 1);
|
|
3300
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
3301
|
+
};
|
|
3302
|
+
var checkIfKeyIsProperty = (key) => {
|
|
3303
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3304
|
+
if (!isFirstKeyString)
|
|
3305
|
+
return;
|
|
3306
|
+
const firstCharKey = key.slice(0, 1);
|
|
3307
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
3308
|
+
};
|
|
3309
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
3310
|
+
const { extend: elementExtend } = element;
|
|
3311
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3312
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
3313
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
3314
|
+
return { ...element, extend };
|
|
3315
|
+
};
|
|
3316
|
+
var extendizeByKey = (element, parent, key) => {
|
|
3317
|
+
const { context } = parent;
|
|
3318
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
3319
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
3320
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3321
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3322
|
+
if (element === isExtendKeyComponent)
|
|
3323
|
+
return element;
|
|
3324
|
+
else if (!hasComponentAttrs || childProps) {
|
|
3325
|
+
return {
|
|
3326
|
+
extend: extendFromKey,
|
|
3327
|
+
tag,
|
|
3328
|
+
props: { ...element }
|
|
3329
|
+
};
|
|
3330
|
+
} else if (!extend || extend === true) {
|
|
3331
|
+
return {
|
|
3332
|
+
...element,
|
|
3333
|
+
tag,
|
|
3334
|
+
extend: extendFromKey
|
|
3335
|
+
};
|
|
3336
|
+
} else if (extend) {
|
|
3337
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
3338
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
3339
|
+
return {
|
|
3340
|
+
extend: extendFromKey,
|
|
3341
|
+
tag,
|
|
3342
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
};
|
|
3346
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
3347
|
+
return extendizeByKey(element, parent, key) || element;
|
|
3348
|
+
};
|
|
3349
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
3350
|
+
const { context } = element;
|
|
3351
|
+
if (!context || !context.components)
|
|
3352
|
+
return;
|
|
3353
|
+
const { components } = context;
|
|
3354
|
+
const { extend } = element;
|
|
3355
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
3356
|
+
if ((0, import__.isString)(execExtend)) {
|
|
3357
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
3358
|
+
if (componentExists)
|
|
3359
|
+
element.extend = componentExists;
|
|
3360
|
+
else {
|
|
3361
|
+
if ((ENV2 === "test" || ENV2 === "development") && options.verbose) {
|
|
3362
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
3363
|
+
console.warn("replacing with ", {});
|
|
3364
|
+
}
|
|
3365
|
+
element.extend = {};
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3369
|
+
var isVariant = (param) => {
|
|
3370
|
+
if (!(0, import__.isString)(param))
|
|
3371
|
+
return;
|
|
3372
|
+
const firstCharKey = param.slice(0, 1);
|
|
3373
|
+
return firstCharKey === ".";
|
|
3374
|
+
};
|
|
3375
|
+
var hasVariantProp = (element) => {
|
|
3376
|
+
const { props } = element;
|
|
3377
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
3378
|
+
return true;
|
|
3379
|
+
};
|
|
3380
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
3381
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
3382
|
+
return el;
|
|
3383
|
+
}
|
|
3384
|
+
if (el.extend) {
|
|
3385
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
3386
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
3387
|
+
if (foundString || foundInArray)
|
|
3388
|
+
return el;
|
|
3389
|
+
}
|
|
3390
|
+
if (el.parent && el.parent.childExtend) {
|
|
3391
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
3392
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
3393
|
+
if (foundString || foundInArray)
|
|
3394
|
+
return el;
|
|
3395
|
+
}
|
|
3396
|
+
};
|
|
3397
|
+
var getExtendsInElement = (obj) => {
|
|
3398
|
+
let result = [];
|
|
3399
|
+
function traverse(o) {
|
|
3400
|
+
for (const key in o) {
|
|
3401
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
3402
|
+
if (checkIfKeyIsComponent(key)) {
|
|
3403
|
+
result.push(key);
|
|
3404
|
+
}
|
|
3405
|
+
if (key === "extend") {
|
|
3406
|
+
if (typeof o[key] === "string") {
|
|
3407
|
+
result.push(o[key]);
|
|
3408
|
+
} else if (Array.isArray(o[key])) {
|
|
3409
|
+
result = result.concat(o[key]);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
3413
|
+
traverse(o[key]);
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
traverse(obj);
|
|
3419
|
+
return result;
|
|
3420
|
+
};
|
|
3421
|
+
}
|
|
3422
|
+
});
|
|
3052
3423
|
var require_cjs4 = __commonJS2({
|
|
3053
3424
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports2, module22) {
|
|
3054
3425
|
"use strict";
|
|
@@ -3080,6 +3451,7 @@ var require_cjs3 = __commonJS({
|
|
|
3080
3451
|
__reExport(utils_exports2, require_globals2(), module22.exports);
|
|
3081
3452
|
__reExport(utils_exports2, require_cookie2(), module22.exports);
|
|
3082
3453
|
__reExport(utils_exports2, require_tags2(), module22.exports);
|
|
3454
|
+
__reExport(utils_exports2, require_component2(), module22.exports);
|
|
3083
3455
|
}
|
|
3084
3456
|
});
|
|
3085
3457
|
var src_exports = {};
|
|
@@ -3095,7 +3467,9 @@ var require_cjs3 = __commonJS({
|
|
|
3095
3467
|
loadCssFile: () => loadCssFile,
|
|
3096
3468
|
loadJavascript: () => loadJavascript,
|
|
3097
3469
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
3470
|
+
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
3098
3471
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
3472
|
+
registerFrameListener: () => registerFrameListener,
|
|
3099
3473
|
removeChars: () => removeChars,
|
|
3100
3474
|
toCamelCase: () => toCamelCase,
|
|
3101
3475
|
toDashCase: () => toDashCase2,
|
|
@@ -3168,7 +3542,27 @@ var require_cjs3 = __commonJS({
|
|
|
3168
3542
|
}
|
|
3169
3543
|
});
|
|
3170
3544
|
};
|
|
3171
|
-
var loadJavascriptFileSync = (
|
|
3545
|
+
var loadJavascriptFileSync = (fileUrl, doc = document, type = "text/javascript") => {
|
|
3546
|
+
return new Promise((resolve, reject) => {
|
|
3547
|
+
const scriptEle = doc.createElement("script");
|
|
3548
|
+
scriptEle.type = type;
|
|
3549
|
+
scriptEle.src = fileUrl;
|
|
3550
|
+
const blocker = doc.createElement("div");
|
|
3551
|
+
blocker.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.8);z-index:9999;";
|
|
3552
|
+
doc.body.appendChild(blocker);
|
|
3553
|
+
scriptEle.onload = () => {
|
|
3554
|
+
console.log(`Successfully loaded: ${fileUrl}`);
|
|
3555
|
+
doc.body.removeChild(blocker);
|
|
3556
|
+
resolve();
|
|
3557
|
+
};
|
|
3558
|
+
scriptEle.onerror = () => {
|
|
3559
|
+
doc.body.removeChild(blocker);
|
|
3560
|
+
reject(new Error(`Failed to load: ${fileUrl}`));
|
|
3561
|
+
};
|
|
3562
|
+
doc.body.appendChild(scriptEle);
|
|
3563
|
+
});
|
|
3564
|
+
};
|
|
3565
|
+
var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
3172
3566
|
const xhr = new window.XMLHttpRequest();
|
|
3173
3567
|
xhr.open("GET", FILE_URL, false);
|
|
3174
3568
|
xhr.send();
|
|
@@ -3213,6 +3607,13 @@ var require_cjs3 = __commonJS({
|
|
|
3213
3607
|
}
|
|
3214
3608
|
};
|
|
3215
3609
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
3610
|
+
var registerFrameListener = (el) => {
|
|
3611
|
+
const { __ref: ref } = el;
|
|
3612
|
+
const { frameListeners } = ref.root.data;
|
|
3613
|
+
if (frameListeners && !frameListeners.has(el)) {
|
|
3614
|
+
frameListeners.add(el);
|
|
3615
|
+
}
|
|
3616
|
+
};
|
|
3216
3617
|
var copyStringToClipboard = async (str) => {
|
|
3217
3618
|
try {
|
|
3218
3619
|
await navigator.clipboard.writeText(str);
|