@symbo.ls/scratch 2.11.430 → 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/factory.js +246 -67
- package/dist/cjs/index.js +572 -170
- 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 +569 -168
- 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/dist/cjs/system/font.js
CHANGED
|
@@ -300,7 +300,6 @@ var require_array = __commonJS({
|
|
|
300
300
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
301
301
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
302
302
|
arraysEqual: () => arraysEqual,
|
|
303
|
-
createNestedObject: () => createNestedObject,
|
|
304
303
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
305
304
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
306
305
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -367,22 +366,6 @@ var require_array = __commonJS({
|
|
|
367
366
|
}
|
|
368
367
|
return arr;
|
|
369
368
|
};
|
|
370
|
-
var createNestedObject = (arr, lastValue) => {
|
|
371
|
-
const nestedObject = {};
|
|
372
|
-
if (arr.length === 0) {
|
|
373
|
-
return lastValue;
|
|
374
|
-
}
|
|
375
|
-
arr.reduce((obj, value, index) => {
|
|
376
|
-
if (!obj[value]) {
|
|
377
|
-
obj[value] = {};
|
|
378
|
-
}
|
|
379
|
-
if (index === arr.length - 1 && lastValue) {
|
|
380
|
-
obj[value] = lastValue;
|
|
381
|
-
}
|
|
382
|
-
return obj[value];
|
|
383
|
-
}, nestedObject);
|
|
384
|
-
return nestedObject;
|
|
385
|
-
};
|
|
386
369
|
var removeValueFromArray = (arr, value) => {
|
|
387
370
|
const index = arr.indexOf(value);
|
|
388
371
|
if (index > -1) {
|
|
@@ -603,8 +586,8 @@ var require_object = __commonJS({
|
|
|
603
586
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
604
587
|
var object_exports = {};
|
|
605
588
|
__export2(object_exports, {
|
|
606
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
607
589
|
clone: () => clone,
|
|
590
|
+
createNestedObject: () => createNestedObject,
|
|
608
591
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
609
592
|
deepClone: () => deepClone2,
|
|
610
593
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -615,13 +598,12 @@ var require_object = __commonJS({
|
|
|
615
598
|
deepMerge: () => deepMerge2,
|
|
616
599
|
deepStringify: () => deepStringify,
|
|
617
600
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
601
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
618
602
|
diff: () => diff,
|
|
619
603
|
diffArrays: () => diffArrays,
|
|
620
604
|
diffObjects: () => diffObjects,
|
|
621
605
|
exec: () => exec,
|
|
622
606
|
flattenRecursive: () => flattenRecursive,
|
|
623
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
624
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
625
607
|
hasOwnProperty: () => hasOwnProperty,
|
|
626
608
|
isEmpty: () => isEmpty,
|
|
627
609
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -636,6 +618,7 @@ var require_object = __commonJS({
|
|
|
636
618
|
overwriteDeep: () => overwriteDeep,
|
|
637
619
|
overwriteShallow: () => overwriteShallow,
|
|
638
620
|
removeFromObject: () => removeFromObject,
|
|
621
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
639
622
|
stringToObject: () => stringToObject
|
|
640
623
|
});
|
|
641
624
|
module2.exports = __toCommonJS2(object_exports);
|
|
@@ -644,6 +627,7 @@ var require_object = __commonJS({
|
|
|
644
627
|
var import_array = require_array();
|
|
645
628
|
var import_string = require_string();
|
|
646
629
|
var import_node = require_node();
|
|
630
|
+
var ENV = "development";
|
|
647
631
|
var exec = (param, element, state, context) => {
|
|
648
632
|
if ((0, import_types.isFunction)(param)) {
|
|
649
633
|
return param(
|
|
@@ -755,6 +739,8 @@ var require_object = __commonJS({
|
|
|
755
739
|
continue;
|
|
756
740
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
757
741
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
742
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
743
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
758
744
|
} else
|
|
759
745
|
o[prop] = objProp;
|
|
760
746
|
}
|
|
@@ -998,16 +984,23 @@ var require_object = __commonJS({
|
|
|
998
984
|
}
|
|
999
985
|
return obj;
|
|
1000
986
|
};
|
|
1001
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
987
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
988
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
989
|
+
return params;
|
|
990
|
+
}
|
|
991
|
+
if (visited.has(obj)) {
|
|
992
|
+
return visited.get(obj);
|
|
993
|
+
}
|
|
994
|
+
visited.set(obj, obj);
|
|
1002
995
|
for (const e in params) {
|
|
1003
|
-
if (e === "__ref")
|
|
1004
|
-
continue;
|
|
1005
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
996
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
1006
997
|
continue;
|
|
1007
998
|
const objProp = obj[e];
|
|
1008
999
|
const paramsProp = params[e];
|
|
1009
|
-
if ((0,
|
|
1010
|
-
|
|
1000
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1001
|
+
obj[e] = paramsProp;
|
|
1002
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1003
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
1011
1004
|
} else if (paramsProp !== void 0) {
|
|
1012
1005
|
obj[e] = paramsProp;
|
|
1013
1006
|
}
|
|
@@ -1115,53 +1108,60 @@ var require_object = __commonJS({
|
|
|
1115
1108
|
}
|
|
1116
1109
|
return newObj;
|
|
1117
1110
|
};
|
|
1118
|
-
var
|
|
1119
|
-
const
|
|
1120
|
-
if (
|
|
1121
|
-
return;
|
|
1122
|
-
|
|
1123
|
-
|
|
1111
|
+
var createNestedObject = (arr, lastValue) => {
|
|
1112
|
+
const nestedObject = {};
|
|
1113
|
+
if (arr.length === 0) {
|
|
1114
|
+
return lastValue;
|
|
1115
|
+
}
|
|
1116
|
+
arr.reduce((obj, value, index) => {
|
|
1117
|
+
if (!obj[value]) {
|
|
1118
|
+
obj[value] = {};
|
|
1119
|
+
}
|
|
1120
|
+
if (index === arr.length - 1 && lastValue) {
|
|
1121
|
+
obj[value] = lastValue;
|
|
1122
|
+
}
|
|
1123
|
+
return obj[value];
|
|
1124
|
+
}, nestedObject);
|
|
1125
|
+
return nestedObject;
|
|
1124
1126
|
};
|
|
1125
|
-
var
|
|
1126
|
-
if (
|
|
1127
|
-
|
|
1127
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
1128
|
+
if (!Array.isArray(path)) {
|
|
1129
|
+
throw new Error("Path must be an array.");
|
|
1128
1130
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1131
|
+
let current = obj;
|
|
1132
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1133
|
+
if (current[path[i]] === void 0) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
current = current[path[i]];
|
|
1134
1137
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
if (foundString || foundInArray)
|
|
1139
|
-
return el;
|
|
1138
|
+
const lastKey = path[path.length - 1];
|
|
1139
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
1140
|
+
delete current[lastKey];
|
|
1140
1141
|
}
|
|
1141
1142
|
};
|
|
1142
|
-
var
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
if (
|
|
1158
|
-
|
|
1143
|
+
var detectInfiniteLoop = (arr) => {
|
|
1144
|
+
const maxRepeats = 10;
|
|
1145
|
+
let pattern = [];
|
|
1146
|
+
let repeatCount = 0;
|
|
1147
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1148
|
+
if (pattern.length < 2) {
|
|
1149
|
+
pattern.push(arr[i]);
|
|
1150
|
+
} else {
|
|
1151
|
+
if (arr[i] === pattern[i % 2]) {
|
|
1152
|
+
repeatCount++;
|
|
1153
|
+
} else {
|
|
1154
|
+
pattern = [arr[i - 1], arr[i]];
|
|
1155
|
+
repeatCount = 1;
|
|
1156
|
+
}
|
|
1157
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
1158
|
+
if (ENV === "test" || ENV === "development") {
|
|
1159
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
1159
1160
|
}
|
|
1161
|
+
return true;
|
|
1160
1162
|
}
|
|
1161
1163
|
}
|
|
1162
1164
|
}
|
|
1163
|
-
traverse(obj);
|
|
1164
|
-
return result;
|
|
1165
1165
|
};
|
|
1166
1166
|
}
|
|
1167
1167
|
});
|
|
@@ -1189,6 +1189,7 @@ var require_function = __commonJS({
|
|
|
1189
1189
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1190
1190
|
var function_exports = {};
|
|
1191
1191
|
__export2(function_exports, {
|
|
1192
|
+
cloneFunction: () => cloneFunction,
|
|
1192
1193
|
debounce: () => debounce,
|
|
1193
1194
|
debounceOnContext: () => debounceOnContext,
|
|
1194
1195
|
isStringFunction: () => isStringFunction,
|
|
@@ -1238,6 +1239,17 @@ var require_function = __commonJS({
|
|
|
1238
1239
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
1239
1240
|
return functionRegex.test(inputString);
|
|
1240
1241
|
};
|
|
1242
|
+
function cloneFunction(fn, win = window) {
|
|
1243
|
+
const temp = function() {
|
|
1244
|
+
return fn.apply(win, arguments);
|
|
1245
|
+
};
|
|
1246
|
+
for (const key in fn) {
|
|
1247
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
1248
|
+
temp[key] = fn[key];
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
return temp;
|
|
1252
|
+
}
|
|
1241
1253
|
}
|
|
1242
1254
|
});
|
|
1243
1255
|
|
|
@@ -1507,6 +1519,172 @@ var require_tags = __commonJS({
|
|
|
1507
1519
|
}
|
|
1508
1520
|
});
|
|
1509
1521
|
|
|
1522
|
+
// ../../../domql/packages/utils/dist/cjs/component.js
|
|
1523
|
+
var require_component = __commonJS({
|
|
1524
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports, module2) {
|
|
1525
|
+
"use strict";
|
|
1526
|
+
var __defProp2 = Object.defineProperty;
|
|
1527
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1528
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1529
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1530
|
+
var __export2 = (target, all) => {
|
|
1531
|
+
for (var name in all)
|
|
1532
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1533
|
+
};
|
|
1534
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
1535
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1536
|
+
for (let key of __getOwnPropNames2(from))
|
|
1537
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1538
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1539
|
+
}
|
|
1540
|
+
return to;
|
|
1541
|
+
};
|
|
1542
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1543
|
+
var component_exports = {};
|
|
1544
|
+
__export2(component_exports, {
|
|
1545
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
1546
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
1547
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1548
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1549
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1550
|
+
extendizeByKey: () => extendizeByKey,
|
|
1551
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1552
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
1553
|
+
hasVariantProp: () => hasVariantProp,
|
|
1554
|
+
isVariant: () => isVariant
|
|
1555
|
+
});
|
|
1556
|
+
module2.exports = __toCommonJS2(component_exports);
|
|
1557
|
+
var import__ = require_cjs();
|
|
1558
|
+
var ENV = "development";
|
|
1559
|
+
var checkIfKeyIsComponent = (key) => {
|
|
1560
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1561
|
+
if (!isFirstKeyString)
|
|
1562
|
+
return;
|
|
1563
|
+
const firstCharKey = key.slice(0, 1);
|
|
1564
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
1565
|
+
};
|
|
1566
|
+
var checkIfKeyIsProperty = (key) => {
|
|
1567
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
1568
|
+
if (!isFirstKeyString)
|
|
1569
|
+
return;
|
|
1570
|
+
const firstCharKey = key.slice(0, 1);
|
|
1571
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
1572
|
+
};
|
|
1573
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
1574
|
+
const { extend: elementExtend } = element;
|
|
1575
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1576
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
1577
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1578
|
+
return { ...element, extend };
|
|
1579
|
+
};
|
|
1580
|
+
var extendizeByKey = (element, parent, key) => {
|
|
1581
|
+
const { context } = parent;
|
|
1582
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
1583
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
1584
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1585
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1586
|
+
if (element === isExtendKeyComponent)
|
|
1587
|
+
return element;
|
|
1588
|
+
else if (!hasComponentAttrs || childProps) {
|
|
1589
|
+
return {
|
|
1590
|
+
extend: extendFromKey,
|
|
1591
|
+
tag,
|
|
1592
|
+
props: { ...element }
|
|
1593
|
+
};
|
|
1594
|
+
} else if (!extend || extend === true) {
|
|
1595
|
+
return {
|
|
1596
|
+
...element,
|
|
1597
|
+
tag,
|
|
1598
|
+
extend: extendFromKey
|
|
1599
|
+
};
|
|
1600
|
+
} else if (extend) {
|
|
1601
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
1602
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
1603
|
+
return {
|
|
1604
|
+
extend: extendFromKey,
|
|
1605
|
+
tag,
|
|
1606
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1611
|
+
return extendizeByKey(element, parent, key) || element;
|
|
1612
|
+
};
|
|
1613
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
1614
|
+
const { context } = element;
|
|
1615
|
+
if (!context || !context.components)
|
|
1616
|
+
return;
|
|
1617
|
+
const { components } = context;
|
|
1618
|
+
const { extend } = element;
|
|
1619
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
1620
|
+
if ((0, import__.isString)(execExtend)) {
|
|
1621
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
1622
|
+
if (componentExists)
|
|
1623
|
+
element.extend = componentExists;
|
|
1624
|
+
else {
|
|
1625
|
+
if ((ENV === "test" || ENV === "development") && options.verbose) {
|
|
1626
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
1627
|
+
console.warn("replacing with ", {});
|
|
1628
|
+
}
|
|
1629
|
+
element.extend = {};
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
var isVariant = (param) => {
|
|
1634
|
+
if (!(0, import__.isString)(param))
|
|
1635
|
+
return;
|
|
1636
|
+
const firstCharKey = param.slice(0, 1);
|
|
1637
|
+
return firstCharKey === ".";
|
|
1638
|
+
};
|
|
1639
|
+
var hasVariantProp = (element) => {
|
|
1640
|
+
const { props } = element;
|
|
1641
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
1642
|
+
return true;
|
|
1643
|
+
};
|
|
1644
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
1645
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
1646
|
+
return el;
|
|
1647
|
+
}
|
|
1648
|
+
if (el.extend) {
|
|
1649
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
1650
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
1651
|
+
if (foundString || foundInArray)
|
|
1652
|
+
return el;
|
|
1653
|
+
}
|
|
1654
|
+
if (el.parent && el.parent.childExtend) {
|
|
1655
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1656
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1657
|
+
if (foundString || foundInArray)
|
|
1658
|
+
return el;
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
var getExtendsInElement = (obj) => {
|
|
1662
|
+
let result = [];
|
|
1663
|
+
function traverse(o) {
|
|
1664
|
+
for (const key in o) {
|
|
1665
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
1666
|
+
if (checkIfKeyIsComponent(key)) {
|
|
1667
|
+
result.push(key);
|
|
1668
|
+
}
|
|
1669
|
+
if (key === "extend") {
|
|
1670
|
+
if (typeof o[key] === "string") {
|
|
1671
|
+
result.push(o[key]);
|
|
1672
|
+
} else if (Array.isArray(o[key])) {
|
|
1673
|
+
result = result.concat(o[key]);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
1677
|
+
traverse(o[key]);
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
traverse(obj);
|
|
1683
|
+
return result;
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1510
1688
|
// ../../../domql/packages/utils/dist/cjs/index.js
|
|
1511
1689
|
var require_cjs = __commonJS({
|
|
1512
1690
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports, module2) {
|
|
@@ -1539,6 +1717,7 @@ var require_cjs = __commonJS({
|
|
|
1539
1717
|
__reExport(utils_exports, require_globals(), module2.exports);
|
|
1540
1718
|
__reExport(utils_exports, require_cookie(), module2.exports);
|
|
1541
1719
|
__reExport(utils_exports, require_tags(), module2.exports);
|
|
1720
|
+
__reExport(utils_exports, require_component(), module2.exports);
|
|
1542
1721
|
}
|
|
1543
1722
|
});
|
|
1544
1723
|
|
|
@@ -1705,6 +1884,7 @@ var require_cjs2 = __commonJS({
|
|
|
1705
1884
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
1706
1885
|
var node_exports = {};
|
|
1707
1886
|
__export22(node_exports, {
|
|
1887
|
+
isDOMNode: () => isDOMNode,
|
|
1708
1888
|
isHtmlElement: () => isHtmlElement,
|
|
1709
1889
|
isNode: () => isNode
|
|
1710
1890
|
});
|
|
@@ -1716,6 +1896,9 @@ var require_cjs2 = __commonJS({
|
|
|
1716
1896
|
var isHtmlElement = (obj) => {
|
|
1717
1897
|
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
1718
1898
|
};
|
|
1899
|
+
var isDOMNode = (obj) => {
|
|
1900
|
+
return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
|
|
1901
|
+
};
|
|
1719
1902
|
}
|
|
1720
1903
|
});
|
|
1721
1904
|
var require_types2 = __commonJS2({
|
|
@@ -1831,7 +2014,6 @@ var require_cjs2 = __commonJS({
|
|
|
1831
2014
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
1832
2015
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
1833
2016
|
arraysEqual: () => arraysEqual,
|
|
1834
|
-
createNestedObject: () => createNestedObject,
|
|
1835
2017
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
1836
2018
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
1837
2019
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
@@ -1898,22 +2080,6 @@ var require_cjs2 = __commonJS({
|
|
|
1898
2080
|
}
|
|
1899
2081
|
return arr;
|
|
1900
2082
|
};
|
|
1901
|
-
var createNestedObject = (arr, lastValue) => {
|
|
1902
|
-
const nestedObject = {};
|
|
1903
|
-
if (arr.length === 0) {
|
|
1904
|
-
return lastValue;
|
|
1905
|
-
}
|
|
1906
|
-
arr.reduce((obj, value, index) => {
|
|
1907
|
-
if (!obj[value]) {
|
|
1908
|
-
obj[value] = {};
|
|
1909
|
-
}
|
|
1910
|
-
if (index === arr.length - 1 && lastValue) {
|
|
1911
|
-
obj[value] = lastValue;
|
|
1912
|
-
}
|
|
1913
|
-
return obj[value];
|
|
1914
|
-
}, nestedObject);
|
|
1915
|
-
return nestedObject;
|
|
1916
|
-
};
|
|
1917
2083
|
var removeValueFromArray = (arr, value) => {
|
|
1918
2084
|
const index = arr.indexOf(value);
|
|
1919
2085
|
if (index > -1) {
|
|
@@ -2130,8 +2296,8 @@ var require_cjs2 = __commonJS({
|
|
|
2130
2296
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
2131
2297
|
var object_exports = {};
|
|
2132
2298
|
__export22(object_exports, {
|
|
2133
|
-
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
2134
2299
|
clone: () => clone,
|
|
2300
|
+
createNestedObject: () => createNestedObject,
|
|
2135
2301
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
2136
2302
|
deepClone: () => deepClone2,
|
|
2137
2303
|
deepCloneExclude: () => deepCloneExclude,
|
|
@@ -2142,13 +2308,12 @@ var require_cjs2 = __commonJS({
|
|
|
2142
2308
|
deepMerge: () => deepMerge2,
|
|
2143
2309
|
deepStringify: () => deepStringify,
|
|
2144
2310
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
2311
|
+
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
2145
2312
|
diff: () => diff,
|
|
2146
2313
|
diffArrays: () => diffArrays,
|
|
2147
2314
|
diffObjects: () => diffObjects,
|
|
2148
2315
|
exec: () => exec,
|
|
2149
2316
|
flattenRecursive: () => flattenRecursive,
|
|
2150
|
-
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
2151
|
-
getExtendsInElement: () => getExtendsInElement,
|
|
2152
2317
|
hasOwnProperty: () => hasOwnProperty,
|
|
2153
2318
|
isEmpty: () => isEmpty,
|
|
2154
2319
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -2163,6 +2328,7 @@ var require_cjs2 = __commonJS({
|
|
|
2163
2328
|
overwriteDeep: () => overwriteDeep,
|
|
2164
2329
|
overwriteShallow: () => overwriteShallow,
|
|
2165
2330
|
removeFromObject: () => removeFromObject,
|
|
2331
|
+
removeNestedKeyByPath: () => removeNestedKeyByPath,
|
|
2166
2332
|
stringToObject: () => stringToObject
|
|
2167
2333
|
});
|
|
2168
2334
|
module22.exports = __toCommonJS22(object_exports);
|
|
@@ -2170,6 +2336,8 @@ var require_cjs2 = __commonJS({
|
|
|
2170
2336
|
var import_types = require_types2();
|
|
2171
2337
|
var import_array = require_array2();
|
|
2172
2338
|
var import_string = require_string2();
|
|
2339
|
+
var import_node = require_node2();
|
|
2340
|
+
var ENV = "development";
|
|
2173
2341
|
var exec = (param, element, state, context) => {
|
|
2174
2342
|
if ((0, import_types.isFunction)(param)) {
|
|
2175
2343
|
return param(
|
|
@@ -2248,27 +2416,28 @@ var require_cjs2 = __commonJS({
|
|
|
2248
2416
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
2249
2417
|
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
2250
2418
|
};
|
|
2251
|
-
var deepClone2 = (obj,
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2419
|
+
var deepClone2 = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2420
|
+
if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
|
|
2421
|
+
return obj;
|
|
2422
|
+
if (visited.has(obj))
|
|
2423
|
+
return visited.get(obj);
|
|
2424
|
+
const clone2 = (0, import_types.isArray)(obj) ? [] : {};
|
|
2425
|
+
visited.set(obj, clone2);
|
|
2426
|
+
for (const key in obj) {
|
|
2427
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
|
|
2428
|
+
const value = obj[key];
|
|
2429
|
+
if ((0, import_node.isDOMNode)(value)) {
|
|
2430
|
+
clone2[key] = value;
|
|
2431
|
+
} else if (key === "extend" && (0, import_types.isArray)(value)) {
|
|
2432
|
+
clone2[key] = (0, import_array.mergeArray)(value, exclude);
|
|
2433
|
+
} else if ((0, import_types.isObjectLike)(value)) {
|
|
2434
|
+
clone2[key] = deepClone2(value, exclude, cleanUndefined, visited);
|
|
2435
|
+
} else {
|
|
2436
|
+
clone2[key] = value;
|
|
2437
|
+
}
|
|
2265
2438
|
}
|
|
2266
|
-
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2267
|
-
o[prop] = deepClone2(objProp, excludeFrom, cleanUndefined);
|
|
2268
|
-
} else
|
|
2269
|
-
o[prop] = objProp;
|
|
2270
2439
|
}
|
|
2271
|
-
return
|
|
2440
|
+
return clone2;
|
|
2272
2441
|
};
|
|
2273
2442
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2274
2443
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
@@ -2280,6 +2449,8 @@ var require_cjs2 = __commonJS({
|
|
|
2280
2449
|
continue;
|
|
2281
2450
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2282
2451
|
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2452
|
+
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2453
|
+
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
2283
2454
|
} else
|
|
2284
2455
|
o[prop] = objProp;
|
|
2285
2456
|
}
|
|
@@ -2523,16 +2694,23 @@ var require_cjs2 = __commonJS({
|
|
|
2523
2694
|
}
|
|
2524
2695
|
return obj;
|
|
2525
2696
|
};
|
|
2526
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
2697
|
+
var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2698
|
+
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2699
|
+
return params;
|
|
2700
|
+
}
|
|
2701
|
+
if (visited.has(obj)) {
|
|
2702
|
+
return visited.get(obj);
|
|
2703
|
+
}
|
|
2704
|
+
visited.set(obj, obj);
|
|
2527
2705
|
for (const e in params) {
|
|
2528
|
-
if (e === "__ref")
|
|
2529
|
-
continue;
|
|
2530
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
2706
|
+
if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
|
|
2531
2707
|
continue;
|
|
2532
2708
|
const objProp = obj[e];
|
|
2533
2709
|
const paramsProp = params[e];
|
|
2534
|
-
if ((0,
|
|
2535
|
-
|
|
2710
|
+
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2711
|
+
obj[e] = paramsProp;
|
|
2712
|
+
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2713
|
+
obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
|
|
2536
2714
|
} else if (paramsProp !== void 0) {
|
|
2537
2715
|
obj[e] = paramsProp;
|
|
2538
2716
|
}
|
|
@@ -2579,30 +2757,40 @@ var require_cjs2 = __commonJS({
|
|
|
2579
2757
|
}
|
|
2580
2758
|
return true;
|
|
2581
2759
|
};
|
|
2582
|
-
var deepContains = (obj1, obj2) => {
|
|
2583
|
-
if (
|
|
2760
|
+
var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
|
|
2761
|
+
if (obj1 === obj2)
|
|
2762
|
+
return true;
|
|
2763
|
+
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
|
|
2584
2764
|
return false;
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2765
|
+
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
|
|
2766
|
+
return obj1 === obj2;
|
|
2767
|
+
const stack = [[obj1, obj2]];
|
|
2768
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
2769
|
+
while (stack.length > 0) {
|
|
2770
|
+
const [current1, current2] = stack.pop();
|
|
2771
|
+
if (visited.has(current1))
|
|
2772
|
+
continue;
|
|
2773
|
+
visited.add(current1);
|
|
2774
|
+
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
|
|
2775
|
+
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
|
|
2776
|
+
if (keys1.length !== keys2.length)
|
|
2777
|
+
return false;
|
|
2778
|
+
for (const key of keys1) {
|
|
2779
|
+
if (!Object.prototype.hasOwnProperty.call(current2, key))
|
|
2589
2780
|
return false;
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
} else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
|
|
2597
|
-
for (const key in obj1) {
|
|
2598
|
-
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
|
|
2599
|
-
if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
|
|
2781
|
+
const value1 = current1[key];
|
|
2782
|
+
const value2 = current2[key];
|
|
2783
|
+
if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
|
|
2784
|
+
if (value1 !== value2)
|
|
2600
2785
|
return false;
|
|
2786
|
+
} else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
|
|
2787
|
+
if (value1 !== value2) {
|
|
2788
|
+
stack.push([value1, value2]);
|
|
2601
2789
|
}
|
|
2790
|
+
} else if (value1 !== value2) {
|
|
2791
|
+
return false;
|
|
2602
2792
|
}
|
|
2603
2793
|
}
|
|
2604
|
-
} else {
|
|
2605
|
-
return obj2 === obj1;
|
|
2606
2794
|
}
|
|
2607
2795
|
return true;
|
|
2608
2796
|
};
|
|
@@ -2630,53 +2818,60 @@ var require_cjs2 = __commonJS({
|
|
|
2630
2818
|
}
|
|
2631
2819
|
return newObj;
|
|
2632
2820
|
};
|
|
2633
|
-
var
|
|
2634
|
-
const
|
|
2635
|
-
if (
|
|
2636
|
-
return;
|
|
2637
|
-
|
|
2638
|
-
|
|
2821
|
+
var createNestedObject = (arr, lastValue) => {
|
|
2822
|
+
const nestedObject = {};
|
|
2823
|
+
if (arr.length === 0) {
|
|
2824
|
+
return lastValue;
|
|
2825
|
+
}
|
|
2826
|
+
arr.reduce((obj, value, index) => {
|
|
2827
|
+
if (!obj[value]) {
|
|
2828
|
+
obj[value] = {};
|
|
2829
|
+
}
|
|
2830
|
+
if (index === arr.length - 1 && lastValue) {
|
|
2831
|
+
obj[value] = lastValue;
|
|
2832
|
+
}
|
|
2833
|
+
return obj[value];
|
|
2834
|
+
}, nestedObject);
|
|
2835
|
+
return nestedObject;
|
|
2639
2836
|
};
|
|
2640
|
-
var
|
|
2641
|
-
if (
|
|
2642
|
-
|
|
2837
|
+
var removeNestedKeyByPath = (obj, path) => {
|
|
2838
|
+
if (!Array.isArray(path)) {
|
|
2839
|
+
throw new Error("Path must be an array.");
|
|
2643
2840
|
}
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2841
|
+
let current = obj;
|
|
2842
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
2843
|
+
if (current[path[i]] === void 0) {
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
current = current[path[i]];
|
|
2649
2847
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
if (foundString || foundInArray)
|
|
2654
|
-
return el;
|
|
2848
|
+
const lastKey = path[path.length - 1];
|
|
2849
|
+
if (current && Object.hasOwnProperty.call(current, lastKey)) {
|
|
2850
|
+
delete current[lastKey];
|
|
2655
2851
|
}
|
|
2656
2852
|
};
|
|
2657
|
-
var
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
if (
|
|
2673
|
-
|
|
2853
|
+
var detectInfiniteLoop = (arr) => {
|
|
2854
|
+
const maxRepeats = 10;
|
|
2855
|
+
let pattern = [];
|
|
2856
|
+
let repeatCount = 0;
|
|
2857
|
+
for (let i = 0; i < arr.length; i++) {
|
|
2858
|
+
if (pattern.length < 2) {
|
|
2859
|
+
pattern.push(arr[i]);
|
|
2860
|
+
} else {
|
|
2861
|
+
if (arr[i] === pattern[i % 2]) {
|
|
2862
|
+
repeatCount++;
|
|
2863
|
+
} else {
|
|
2864
|
+
pattern = [arr[i - 1], arr[i]];
|
|
2865
|
+
repeatCount = 1;
|
|
2866
|
+
}
|
|
2867
|
+
if (repeatCount >= maxRepeats * 2) {
|
|
2868
|
+
if (ENV === "test" || ENV === "development") {
|
|
2869
|
+
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
2674
2870
|
}
|
|
2871
|
+
return true;
|
|
2675
2872
|
}
|
|
2676
2873
|
}
|
|
2677
2874
|
}
|
|
2678
|
-
traverse(obj);
|
|
2679
|
-
return result;
|
|
2680
2875
|
};
|
|
2681
2876
|
}
|
|
2682
2877
|
});
|
|
@@ -2702,6 +2897,7 @@ var require_cjs2 = __commonJS({
|
|
|
2702
2897
|
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
2703
2898
|
var function_exports = {};
|
|
2704
2899
|
__export22(function_exports, {
|
|
2900
|
+
cloneFunction: () => cloneFunction,
|
|
2705
2901
|
debounce: () => debounce,
|
|
2706
2902
|
debounceOnContext: () => debounceOnContext,
|
|
2707
2903
|
isStringFunction: () => isStringFunction,
|
|
@@ -2751,6 +2947,17 @@ var require_cjs2 = __commonJS({
|
|
|
2751
2947
|
const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
|
|
2752
2948
|
return functionRegex.test(inputString);
|
|
2753
2949
|
};
|
|
2950
|
+
function cloneFunction(fn, win = window) {
|
|
2951
|
+
const temp = function() {
|
|
2952
|
+
return fn.apply(win, arguments);
|
|
2953
|
+
};
|
|
2954
|
+
for (const key in fn) {
|
|
2955
|
+
if (Object.hasOwnProperty.call(fn, key)) {
|
|
2956
|
+
temp[key] = fn[key];
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
return temp;
|
|
2960
|
+
}
|
|
2754
2961
|
}
|
|
2755
2962
|
});
|
|
2756
2963
|
var require_log2 = __commonJS2({
|
|
@@ -3013,6 +3220,170 @@ var require_cjs2 = __commonJS({
|
|
|
3013
3220
|
var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
|
3014
3221
|
}
|
|
3015
3222
|
});
|
|
3223
|
+
var require_component2 = __commonJS2({
|
|
3224
|
+
"../../../domql/packages/utils/dist/cjs/component.js"(exports2, module22) {
|
|
3225
|
+
"use strict";
|
|
3226
|
+
var __defProp22 = Object.defineProperty;
|
|
3227
|
+
var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
|
|
3228
|
+
var __getOwnPropNames22 = Object.getOwnPropertyNames;
|
|
3229
|
+
var __hasOwnProp22 = Object.prototype.hasOwnProperty;
|
|
3230
|
+
var __export22 = (target, all) => {
|
|
3231
|
+
for (var name in all)
|
|
3232
|
+
__defProp22(target, name, { get: all[name], enumerable: true });
|
|
3233
|
+
};
|
|
3234
|
+
var __copyProps22 = (to, from, except, desc) => {
|
|
3235
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3236
|
+
for (let key of __getOwnPropNames22(from))
|
|
3237
|
+
if (!__hasOwnProp22.call(to, key) && key !== except)
|
|
3238
|
+
__defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
|
|
3239
|
+
}
|
|
3240
|
+
return to;
|
|
3241
|
+
};
|
|
3242
|
+
var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
|
|
3243
|
+
var component_exports = {};
|
|
3244
|
+
__export22(component_exports, {
|
|
3245
|
+
addAdditionalExtend: () => addAdditionalExtend,
|
|
3246
|
+
applyComponentFromContext: () => applyComponentFromContext,
|
|
3247
|
+
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3248
|
+
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
3249
|
+
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
3250
|
+
extendizeByKey: () => extendizeByKey,
|
|
3251
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3252
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
3253
|
+
hasVariantProp: () => hasVariantProp,
|
|
3254
|
+
isVariant: () => isVariant
|
|
3255
|
+
});
|
|
3256
|
+
module22.exports = __toCommonJS22(component_exports);
|
|
3257
|
+
var import__ = require_cjs4();
|
|
3258
|
+
var ENV = "development";
|
|
3259
|
+
var checkIfKeyIsComponent = (key) => {
|
|
3260
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3261
|
+
if (!isFirstKeyString)
|
|
3262
|
+
return;
|
|
3263
|
+
const firstCharKey = key.slice(0, 1);
|
|
3264
|
+
return /^[A-Z]*$/.test(firstCharKey);
|
|
3265
|
+
};
|
|
3266
|
+
var checkIfKeyIsProperty = (key) => {
|
|
3267
|
+
const isFirstKeyString = (0, import__.isString)(key);
|
|
3268
|
+
if (!isFirstKeyString)
|
|
3269
|
+
return;
|
|
3270
|
+
const firstCharKey = key.slice(0, 1);
|
|
3271
|
+
return /^[a-z]*$/.test(firstCharKey);
|
|
3272
|
+
};
|
|
3273
|
+
var addAdditionalExtend = (newExtend, element) => {
|
|
3274
|
+
const { extend: elementExtend } = element;
|
|
3275
|
+
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3276
|
+
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
3277
|
+
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
3278
|
+
return { ...element, extend };
|
|
3279
|
+
};
|
|
3280
|
+
var extendizeByKey = (element, parent, key) => {
|
|
3281
|
+
const { context } = parent;
|
|
3282
|
+
const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
|
|
3283
|
+
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
|
|
3284
|
+
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3285
|
+
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3286
|
+
if (element === isExtendKeyComponent)
|
|
3287
|
+
return element;
|
|
3288
|
+
else if (!hasComponentAttrs || childProps) {
|
|
3289
|
+
return {
|
|
3290
|
+
extend: extendFromKey,
|
|
3291
|
+
tag,
|
|
3292
|
+
props: { ...element }
|
|
3293
|
+
};
|
|
3294
|
+
} else if (!extend || extend === true) {
|
|
3295
|
+
return {
|
|
3296
|
+
...element,
|
|
3297
|
+
tag,
|
|
3298
|
+
extend: extendFromKey
|
|
3299
|
+
};
|
|
3300
|
+
} else if (extend) {
|
|
3301
|
+
return addAdditionalExtend(extendFromKey, element);
|
|
3302
|
+
} else if ((0, import__.isFunction)(element)) {
|
|
3303
|
+
return {
|
|
3304
|
+
extend: extendFromKey,
|
|
3305
|
+
tag,
|
|
3306
|
+
props: { ...(0, import__.exec)(element, parent) }
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
};
|
|
3310
|
+
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
3311
|
+
return extendizeByKey(element, parent, key) || element;
|
|
3312
|
+
};
|
|
3313
|
+
var applyComponentFromContext = (element, parent, options) => {
|
|
3314
|
+
const { context } = element;
|
|
3315
|
+
if (!context || !context.components)
|
|
3316
|
+
return;
|
|
3317
|
+
const { components } = context;
|
|
3318
|
+
const { extend } = element;
|
|
3319
|
+
const execExtend = (0, import__.exec)(extend, element);
|
|
3320
|
+
if ((0, import__.isString)(execExtend)) {
|
|
3321
|
+
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
3322
|
+
if (componentExists)
|
|
3323
|
+
element.extend = componentExists;
|
|
3324
|
+
else {
|
|
3325
|
+
if ((ENV === "test" || ENV === "development") && options.verbose) {
|
|
3326
|
+
console.warn(execExtend, "is not in library", components, element);
|
|
3327
|
+
console.warn("replacing with ", {});
|
|
3328
|
+
}
|
|
3329
|
+
element.extend = {};
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
var isVariant = (param) => {
|
|
3334
|
+
if (!(0, import__.isString)(param))
|
|
3335
|
+
return;
|
|
3336
|
+
const firstCharKey = param.slice(0, 1);
|
|
3337
|
+
return firstCharKey === ".";
|
|
3338
|
+
};
|
|
3339
|
+
var hasVariantProp = (element) => {
|
|
3340
|
+
const { props } = element;
|
|
3341
|
+
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
|
|
3342
|
+
return true;
|
|
3343
|
+
};
|
|
3344
|
+
var getChildrenComponentsByKey = (key, el) => {
|
|
3345
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
3346
|
+
return el;
|
|
3347
|
+
}
|
|
3348
|
+
if (el.extend) {
|
|
3349
|
+
const foundString = (0, import__.isString)(el.extend) && el.extend === key;
|
|
3350
|
+
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
3351
|
+
if (foundString || foundInArray)
|
|
3352
|
+
return el;
|
|
3353
|
+
}
|
|
3354
|
+
if (el.parent && el.parent.childExtend) {
|
|
3355
|
+
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
3356
|
+
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
3357
|
+
if (foundString || foundInArray)
|
|
3358
|
+
return el;
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
var getExtendsInElement = (obj) => {
|
|
3362
|
+
let result = [];
|
|
3363
|
+
function traverse(o) {
|
|
3364
|
+
for (const key in o) {
|
|
3365
|
+
if (Object.hasOwnProperty.call(o, key)) {
|
|
3366
|
+
if (checkIfKeyIsComponent(key)) {
|
|
3367
|
+
result.push(key);
|
|
3368
|
+
}
|
|
3369
|
+
if (key === "extend") {
|
|
3370
|
+
if (typeof o[key] === "string") {
|
|
3371
|
+
result.push(o[key]);
|
|
3372
|
+
} else if (Array.isArray(o[key])) {
|
|
3373
|
+
result = result.concat(o[key]);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
if (typeof o[key] === "object" && o[key] !== null) {
|
|
3377
|
+
traverse(o[key]);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
traverse(obj);
|
|
3383
|
+
return result;
|
|
3384
|
+
};
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3016
3387
|
var require_cjs4 = __commonJS2({
|
|
3017
3388
|
"../../../domql/packages/utils/dist/cjs/index.js"(exports2, module22) {
|
|
3018
3389
|
"use strict";
|
|
@@ -3044,6 +3415,7 @@ var require_cjs2 = __commonJS({
|
|
|
3044
3415
|
__reExport(utils_exports, require_globals2(), module22.exports);
|
|
3045
3416
|
__reExport(utils_exports, require_cookie2(), module22.exports);
|
|
3046
3417
|
__reExport(utils_exports, require_tags2(), module22.exports);
|
|
3418
|
+
__reExport(utils_exports, require_component2(), module22.exports);
|
|
3047
3419
|
}
|
|
3048
3420
|
});
|
|
3049
3421
|
var src_exports = {};
|
|
@@ -3059,7 +3431,9 @@ var require_cjs2 = __commonJS({
|
|
|
3059
3431
|
loadCssFile: () => loadCssFile,
|
|
3060
3432
|
loadJavascript: () => loadJavascript,
|
|
3061
3433
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
3434
|
+
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
3062
3435
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
3436
|
+
registerFrameListener: () => registerFrameListener,
|
|
3063
3437
|
removeChars: () => removeChars,
|
|
3064
3438
|
toCamelCase: () => toCamelCase,
|
|
3065
3439
|
toDashCase: () => toDashCase2,
|
|
@@ -3132,7 +3506,27 @@ var require_cjs2 = __commonJS({
|
|
|
3132
3506
|
}
|
|
3133
3507
|
});
|
|
3134
3508
|
};
|
|
3135
|
-
var loadJavascriptFileSync = (
|
|
3509
|
+
var loadJavascriptFileSync = (fileUrl, doc = document, type = "text/javascript") => {
|
|
3510
|
+
return new Promise((resolve, reject) => {
|
|
3511
|
+
const scriptEle = doc.createElement("script");
|
|
3512
|
+
scriptEle.type = type;
|
|
3513
|
+
scriptEle.src = fileUrl;
|
|
3514
|
+
const blocker = doc.createElement("div");
|
|
3515
|
+
blocker.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.8);z-index:9999;";
|
|
3516
|
+
doc.body.appendChild(blocker);
|
|
3517
|
+
scriptEle.onload = () => {
|
|
3518
|
+
console.log(`Successfully loaded: ${fileUrl}`);
|
|
3519
|
+
doc.body.removeChild(blocker);
|
|
3520
|
+
resolve();
|
|
3521
|
+
};
|
|
3522
|
+
scriptEle.onerror = () => {
|
|
3523
|
+
doc.body.removeChild(blocker);
|
|
3524
|
+
reject(new Error(`Failed to load: ${fileUrl}`));
|
|
3525
|
+
};
|
|
3526
|
+
doc.body.appendChild(scriptEle);
|
|
3527
|
+
});
|
|
3528
|
+
};
|
|
3529
|
+
var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
3136
3530
|
const xhr = new window.XMLHttpRequest();
|
|
3137
3531
|
xhr.open("GET", FILE_URL, false);
|
|
3138
3532
|
xhr.send();
|
|
@@ -3177,6 +3571,13 @@ var require_cjs2 = __commonJS({
|
|
|
3177
3571
|
}
|
|
3178
3572
|
};
|
|
3179
3573
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
3574
|
+
var registerFrameListener = (el) => {
|
|
3575
|
+
const { __ref: ref } = el;
|
|
3576
|
+
const { frameListeners } = ref.root.data;
|
|
3577
|
+
if (frameListeners && !frameListeners.has(el)) {
|
|
3578
|
+
frameListeners.add(el);
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3180
3581
|
var copyStringToClipboard = async (str) => {
|
|
3181
3582
|
try {
|
|
3182
3583
|
await navigator.clipboard.writeText(str);
|