@symbo.ls/scratch 2.11.450 → 2.11.464
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 +112 -41
- package/dist/cjs/index.js +259 -88
- package/dist/cjs/set.js +259 -88
- package/dist/cjs/system/color.js +255 -85
- package/dist/cjs/system/document.js +255 -85
- package/dist/cjs/system/font.js +255 -85
- package/dist/cjs/system/index.js +259 -88
- package/dist/cjs/system/reset.js +255 -85
- package/dist/cjs/system/shadow.js +255 -85
- package/dist/cjs/system/spacing.js +255 -85
- package/dist/cjs/system/svg.js +259 -88
- package/dist/cjs/system/theme.js +255 -85
- package/dist/cjs/system/timing.js +255 -85
- package/dist/cjs/system/typography.js +255 -85
- package/dist/cjs/transforms/index.js +255 -85
- package/dist/cjs/utils/color.js +111 -40
- package/dist/cjs/utils/index.js +259 -88
- package/dist/cjs/utils/sequence.js +255 -85
- package/dist/cjs/utils/sprite.js +116 -44
- package/dist/cjs/utils/var.js +255 -85
- package/package.json +3 -3
- package/src/factory.js +1 -1
- package/src/utils/sprite.js +4 -3
|
@@ -325,6 +325,8 @@ var require_cjs = __commonJS({
|
|
|
325
325
|
arraysEqual: () => arraysEqual,
|
|
326
326
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
327
327
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
328
|
+
filterArrays: () => filterArrays,
|
|
329
|
+
filterArraysFast: () => filterArraysFast,
|
|
328
330
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
329
331
|
joinArrays: () => joinArrays,
|
|
330
332
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -433,6 +435,13 @@ var require_cjs = __commonJS({
|
|
|
433
435
|
}
|
|
434
436
|
return true;
|
|
435
437
|
};
|
|
438
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
439
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
440
|
+
};
|
|
441
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
442
|
+
const excludeSet = new Set(excludeArr);
|
|
443
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
444
|
+
};
|
|
436
445
|
}
|
|
437
446
|
});
|
|
438
447
|
var require_string2 = __commonJS2({
|
|
@@ -622,9 +631,11 @@ var require_cjs = __commonJS({
|
|
|
622
631
|
diff: () => diff,
|
|
623
632
|
diffArrays: () => diffArrays,
|
|
624
633
|
diffObjects: () => diffObjects,
|
|
634
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
625
635
|
exec: () => exec,
|
|
626
636
|
flattenRecursive: () => flattenRecursive,
|
|
627
637
|
hasOwnProperty: () => hasOwnProperty,
|
|
638
|
+
isCyclic: () => isCyclic,
|
|
628
639
|
isEmpty: () => isEmpty,
|
|
629
640
|
isEmptyObject: () => isEmptyObject,
|
|
630
641
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -750,28 +761,36 @@ var require_cjs = __commonJS({
|
|
|
750
761
|
}
|
|
751
762
|
return clone2;
|
|
752
763
|
};
|
|
753
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
764
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
765
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
766
|
+
if (visited.has(obj)) {
|
|
767
|
+
return obj;
|
|
768
|
+
}
|
|
769
|
+
visited.add(obj);
|
|
770
|
+
}
|
|
754
771
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
755
772
|
for (const prop in obj) {
|
|
756
773
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
757
774
|
continue;
|
|
758
775
|
const objProp = obj[prop];
|
|
759
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
776
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
760
777
|
continue;
|
|
778
|
+
}
|
|
761
779
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
762
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
780
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
763
781
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
764
782
|
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
765
|
-
} else
|
|
783
|
+
} else {
|
|
766
784
|
o[prop] = objProp;
|
|
785
|
+
}
|
|
767
786
|
}
|
|
768
787
|
return o;
|
|
769
788
|
};
|
|
770
789
|
var deepStringify = (obj, stringified = {}) => {
|
|
771
|
-
var _a;
|
|
790
|
+
var _a, _b;
|
|
772
791
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
773
|
-
|
|
774
|
-
obj = (
|
|
792
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
793
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
775
794
|
}
|
|
776
795
|
for (const prop in obj) {
|
|
777
796
|
const objProp = obj[prop];
|
|
@@ -841,7 +860,7 @@ var require_cjs = __commonJS({
|
|
|
841
860
|
if ((0, import_types.isArray)(value)) {
|
|
842
861
|
str += "[\n";
|
|
843
862
|
for (const element of value) {
|
|
844
|
-
if ((0, import_types.
|
|
863
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
845
864
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
846
865
|
`;
|
|
847
866
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -940,7 +959,7 @@ var require_cjs = __commonJS({
|
|
|
940
959
|
};
|
|
941
960
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
942
961
|
try {
|
|
943
|
-
return import_globals2.window.eval("(" + str + ")");
|
|
962
|
+
return str ? import_globals2.window.eval("(" + str + ")") : {};
|
|
944
963
|
} catch (e) {
|
|
945
964
|
if (opts.verbose)
|
|
946
965
|
console.warn(e);
|
|
@@ -1020,20 +1039,27 @@ var require_cjs = __commonJS({
|
|
|
1020
1039
|
return acc;
|
|
1021
1040
|
}, deletedValues);
|
|
1022
1041
|
};
|
|
1023
|
-
var overwrite = (element, params,
|
|
1024
|
-
const { ref } = element;
|
|
1025
|
-
const
|
|
1042
|
+
var overwrite = (element, params, opts = {}) => {
|
|
1043
|
+
const { __ref: ref } = element;
|
|
1044
|
+
const excl = opts.exclude || [];
|
|
1045
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
1046
|
+
const preventCaching = opts.preventCaching;
|
|
1026
1047
|
for (const e in params) {
|
|
1027
|
-
if (
|
|
1048
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
1028
1049
|
continue;
|
|
1029
1050
|
const elementProp = element[e];
|
|
1030
1051
|
const paramsProp = params[e];
|
|
1031
|
-
if (paramsProp) {
|
|
1032
|
-
|
|
1033
|
-
ref
|
|
1052
|
+
if (paramsProp !== void 0) {
|
|
1053
|
+
element[e] = paramsProp;
|
|
1054
|
+
if (ref && !preventCaching) {
|
|
1055
|
+
ref.__cache[e] = elementProp;
|
|
1056
|
+
}
|
|
1057
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
1058
|
+
diff[e] = elementProp;
|
|
1059
|
+
}
|
|
1034
1060
|
}
|
|
1035
1061
|
}
|
|
1036
|
-
return
|
|
1062
|
+
return element;
|
|
1037
1063
|
};
|
|
1038
1064
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
1039
1065
|
for (const e in params) {
|
|
@@ -1043,23 +1069,26 @@ var require_cjs = __commonJS({
|
|
|
1043
1069
|
}
|
|
1044
1070
|
return obj;
|
|
1045
1071
|
};
|
|
1046
|
-
var overwriteDeep = (obj, params,
|
|
1072
|
+
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1073
|
+
const excl = opts.exclude || [];
|
|
1074
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
1047
1075
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1048
1076
|
return params;
|
|
1049
1077
|
}
|
|
1050
|
-
if (visited.has(obj))
|
|
1078
|
+
if (visited.has(obj))
|
|
1051
1079
|
return visited.get(obj);
|
|
1052
|
-
}
|
|
1053
1080
|
visited.set(obj, obj);
|
|
1054
1081
|
for (const e in params) {
|
|
1055
|
-
if (
|
|
1082
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
1083
|
+
continue;
|
|
1084
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
1056
1085
|
continue;
|
|
1057
1086
|
const objProp = obj[e];
|
|
1058
1087
|
const paramsProp = params[e];
|
|
1059
1088
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1060
1089
|
obj[e] = paramsProp;
|
|
1061
1090
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1062
|
-
obj[e] = overwriteDeep(objProp, paramsProp,
|
|
1091
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
1063
1092
|
} else if (paramsProp !== void 0) {
|
|
1064
1093
|
obj[e] = paramsProp;
|
|
1065
1094
|
}
|
|
@@ -1222,6 +1251,30 @@ var require_cjs = __commonJS({
|
|
|
1222
1251
|
}
|
|
1223
1252
|
}
|
|
1224
1253
|
};
|
|
1254
|
+
var isCyclic = (obj) => {
|
|
1255
|
+
const seenObjects = [];
|
|
1256
|
+
function detect(obj2) {
|
|
1257
|
+
if (obj2 && typeof obj2 === "object") {
|
|
1258
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
seenObjects.push(obj2);
|
|
1262
|
+
for (const key in obj2) {
|
|
1263
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
1264
|
+
console.log(obj2, "cycle at " + key);
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
return false;
|
|
1270
|
+
}
|
|
1271
|
+
return detect(obj);
|
|
1272
|
+
};
|
|
1273
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
1274
|
+
const result = { ...obj };
|
|
1275
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
1276
|
+
return result;
|
|
1277
|
+
};
|
|
1225
1278
|
}
|
|
1226
1279
|
});
|
|
1227
1280
|
var require_function2 = __commonJS2({
|
|
@@ -1371,9 +1424,11 @@ var require_cjs = __commonJS({
|
|
|
1371
1424
|
var cookie_exports = {};
|
|
1372
1425
|
__export22(cookie_exports, {
|
|
1373
1426
|
getCookie: () => getCookie,
|
|
1427
|
+
getLocalStorage: () => getLocalStorage,
|
|
1374
1428
|
isMobile: () => isMobile,
|
|
1375
1429
|
removeCookie: () => removeCookie,
|
|
1376
|
-
setCookie: () => setCookie
|
|
1430
|
+
setCookie: () => setCookie,
|
|
1431
|
+
setLocalStorage: () => setLocalStorage
|
|
1377
1432
|
});
|
|
1378
1433
|
module22.exports = __toCommonJS22(cookie_exports);
|
|
1379
1434
|
var import_types = require_types2();
|
|
@@ -1407,6 +1462,27 @@ var require_cjs = __commonJS({
|
|
|
1407
1462
|
return;
|
|
1408
1463
|
import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1409
1464
|
};
|
|
1465
|
+
function getLocalStorage(key) {
|
|
1466
|
+
let savedJSON;
|
|
1467
|
+
if (window.localStorage) {
|
|
1468
|
+
try {
|
|
1469
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
1470
|
+
} catch (e) {
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
if (typeof savedJSON !== "undefined") {
|
|
1474
|
+
return savedJSON;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
function setLocalStorage(key, data) {
|
|
1478
|
+
if (data && window.localStorage) {
|
|
1479
|
+
if (typeof data === "object") {
|
|
1480
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
1481
|
+
} else {
|
|
1482
|
+
window.localStorage.setItem(key, data);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1410
1486
|
}
|
|
1411
1487
|
});
|
|
1412
1488
|
var require_tags2 = __commonJS2({
|
|
@@ -1606,7 +1682,9 @@ var require_cjs = __commonJS({
|
|
|
1606
1682
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1607
1683
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1608
1684
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1685
|
+
checkIfSugar: () => checkIfSugar,
|
|
1609
1686
|
extendizeByKey: () => extendizeByKey,
|
|
1687
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1610
1688
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1611
1689
|
getExtendsInElement: () => getExtendsInElement,
|
|
1612
1690
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -1631,6 +1709,8 @@ var require_cjs = __commonJS({
|
|
|
1631
1709
|
return /^[a-z]*$/.test(firstCharKey);
|
|
1632
1710
|
};
|
|
1633
1711
|
var addAdditionalExtend = (newExtend, element) => {
|
|
1712
|
+
if (!newExtend)
|
|
1713
|
+
return element;
|
|
1634
1714
|
const { extend: elementExtend } = element;
|
|
1635
1715
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1636
1716
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -1638,26 +1718,44 @@ var require_cjs = __commonJS({
|
|
|
1638
1718
|
return { ...element, extend };
|
|
1639
1719
|
};
|
|
1640
1720
|
var checkIfSugar = (element, parent, key) => {
|
|
1641
|
-
|
|
1721
|
+
var _a;
|
|
1722
|
+
const {
|
|
1723
|
+
extend,
|
|
1724
|
+
props,
|
|
1725
|
+
childExtend,
|
|
1726
|
+
extends: extendProps,
|
|
1727
|
+
childExtends,
|
|
1728
|
+
childProps,
|
|
1729
|
+
children,
|
|
1730
|
+
on,
|
|
1731
|
+
$collection,
|
|
1732
|
+
$stateCollection,
|
|
1733
|
+
$propsCollection
|
|
1734
|
+
} = element;
|
|
1642
1735
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1643
|
-
|
|
1736
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
1737
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
1738
|
+
if (logErr)
|
|
1739
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
1740
|
+
}
|
|
1741
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1644
1742
|
};
|
|
1645
1743
|
var extendizeByKey = (element, parent, key) => {
|
|
1646
1744
|
const { context } = parent;
|
|
1647
|
-
const { tag, extend,
|
|
1648
|
-
const isSugar = checkIfSugar(element);
|
|
1745
|
+
const { tag, extend, childExtends } = element;
|
|
1746
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
1649
1747
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1650
1748
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1651
1749
|
if (element === isExtendKeyComponent)
|
|
1652
1750
|
return element;
|
|
1653
1751
|
else if (isSugar) {
|
|
1654
|
-
const newElem = {
|
|
1752
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
1655
1753
|
extend: extendFromKey,
|
|
1656
1754
|
tag,
|
|
1657
1755
|
props: { ...element }
|
|
1658
|
-
};
|
|
1659
|
-
if (
|
|
1660
|
-
newElem.childExtend =
|
|
1756
|
+
});
|
|
1757
|
+
if (childExtends)
|
|
1758
|
+
newElem.childExtend = childExtends;
|
|
1661
1759
|
return newElem;
|
|
1662
1760
|
} else if (!extend || extend === true) {
|
|
1663
1761
|
return {
|
|
@@ -1686,23 +1784,24 @@ var require_cjs = __commonJS({
|
|
|
1686
1784
|
const childKey = childElems[i];
|
|
1687
1785
|
const childElem = element[childKey];
|
|
1688
1786
|
const newChild = element.props[childKey];
|
|
1787
|
+
const assignChild = (val) => {
|
|
1788
|
+
element[childKey] = val;
|
|
1789
|
+
delete element.props[childKey];
|
|
1790
|
+
};
|
|
1689
1791
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1690
1792
|
continue;
|
|
1691
|
-
if (
|
|
1692
|
-
|
|
1793
|
+
if (newChild === null)
|
|
1794
|
+
assignChild(null);
|
|
1795
|
+
else if (!childElem)
|
|
1796
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
1693
1797
|
else {
|
|
1694
|
-
const
|
|
1695
|
-
if (
|
|
1798
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1799
|
+
if (isSugarChildElem)
|
|
1696
1800
|
continue;
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
}
|
|
1701
|
-
element[childKey] = {
|
|
1702
|
-
extend: element[childKey],
|
|
1703
|
-
props: newChild
|
|
1704
|
-
};
|
|
1705
|
-
}
|
|
1801
|
+
assignChild({
|
|
1802
|
+
extend: element[childKey],
|
|
1803
|
+
props: newChild
|
|
1804
|
+
});
|
|
1706
1805
|
}
|
|
1707
1806
|
}
|
|
1708
1807
|
};
|
|
@@ -2311,6 +2410,8 @@ var require_array = __commonJS({
|
|
|
2311
2410
|
arraysEqual: () => arraysEqual,
|
|
2312
2411
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
2313
2412
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
2413
|
+
filterArrays: () => filterArrays,
|
|
2414
|
+
filterArraysFast: () => filterArraysFast,
|
|
2314
2415
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
2315
2416
|
joinArrays: () => joinArrays,
|
|
2316
2417
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -2419,6 +2520,13 @@ var require_array = __commonJS({
|
|
|
2419
2520
|
}
|
|
2420
2521
|
return true;
|
|
2421
2522
|
};
|
|
2523
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
2524
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
2525
|
+
};
|
|
2526
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
2527
|
+
const excludeSet = new Set(excludeArr);
|
|
2528
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
2529
|
+
};
|
|
2422
2530
|
}
|
|
2423
2531
|
});
|
|
2424
2532
|
|
|
@@ -2612,6 +2720,7 @@ var require_object = __commonJS({
|
|
|
2612
2720
|
diff: () => diff,
|
|
2613
2721
|
diffArrays: () => diffArrays,
|
|
2614
2722
|
diffObjects: () => diffObjects,
|
|
2723
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
2615
2724
|
exec: () => exec,
|
|
2616
2725
|
flattenRecursive: () => flattenRecursive,
|
|
2617
2726
|
hasOwnProperty: () => hasOwnProperty,
|
|
@@ -2767,10 +2876,10 @@ var require_object = __commonJS({
|
|
|
2767
2876
|
return o;
|
|
2768
2877
|
};
|
|
2769
2878
|
var deepStringify = (obj, stringified = {}) => {
|
|
2770
|
-
var _a;
|
|
2879
|
+
var _a, _b;
|
|
2771
2880
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
2772
|
-
|
|
2773
|
-
obj = (
|
|
2881
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
2882
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
2774
2883
|
}
|
|
2775
2884
|
for (const prop in obj) {
|
|
2776
2885
|
const objProp = obj[prop];
|
|
@@ -2840,7 +2949,7 @@ var require_object = __commonJS({
|
|
|
2840
2949
|
if ((0, import_types.isArray)(value)) {
|
|
2841
2950
|
str += "[\n";
|
|
2842
2951
|
for (const element of value) {
|
|
2843
|
-
if ((0, import_types.
|
|
2952
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
2844
2953
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
2845
2954
|
`;
|
|
2846
2955
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -2939,7 +3048,7 @@ var require_object = __commonJS({
|
|
|
2939
3048
|
};
|
|
2940
3049
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
2941
3050
|
try {
|
|
2942
|
-
return import_globals2.window.eval("(" + str + ")");
|
|
3051
|
+
return str ? import_globals2.window.eval("(" + str + ")") : {};
|
|
2943
3052
|
} catch (e) {
|
|
2944
3053
|
if (opts.verbose)
|
|
2945
3054
|
console.warn(e);
|
|
@@ -3019,20 +3128,27 @@ var require_object = __commonJS({
|
|
|
3019
3128
|
return acc;
|
|
3020
3129
|
}, deletedValues);
|
|
3021
3130
|
};
|
|
3022
|
-
var overwrite = (element, params,
|
|
3023
|
-
const { ref } = element;
|
|
3024
|
-
const
|
|
3131
|
+
var overwrite = (element, params, opts = {}) => {
|
|
3132
|
+
const { __ref: ref } = element;
|
|
3133
|
+
const excl = opts.exclude || [];
|
|
3134
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
3135
|
+
const preventCaching = opts.preventCaching;
|
|
3025
3136
|
for (const e in params) {
|
|
3026
|
-
if (
|
|
3137
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
3027
3138
|
continue;
|
|
3028
3139
|
const elementProp = element[e];
|
|
3029
3140
|
const paramsProp = params[e];
|
|
3030
|
-
if (paramsProp) {
|
|
3031
|
-
|
|
3032
|
-
ref
|
|
3141
|
+
if (paramsProp !== void 0) {
|
|
3142
|
+
element[e] = paramsProp;
|
|
3143
|
+
if (ref && !preventCaching) {
|
|
3144
|
+
ref.__cache[e] = elementProp;
|
|
3145
|
+
}
|
|
3146
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
3147
|
+
diff[e] = elementProp;
|
|
3148
|
+
}
|
|
3033
3149
|
}
|
|
3034
3150
|
}
|
|
3035
|
-
return
|
|
3151
|
+
return element;
|
|
3036
3152
|
};
|
|
3037
3153
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
3038
3154
|
for (const e in params) {
|
|
@@ -3042,23 +3158,26 @@ var require_object = __commonJS({
|
|
|
3042
3158
|
}
|
|
3043
3159
|
return obj;
|
|
3044
3160
|
};
|
|
3045
|
-
var overwriteDeep = (obj, params,
|
|
3161
|
+
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
3162
|
+
const excl = opts.exclude || [];
|
|
3163
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
3046
3164
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
3047
3165
|
return params;
|
|
3048
3166
|
}
|
|
3049
|
-
if (visited.has(obj))
|
|
3167
|
+
if (visited.has(obj))
|
|
3050
3168
|
return visited.get(obj);
|
|
3051
|
-
}
|
|
3052
3169
|
visited.set(obj, obj);
|
|
3053
3170
|
for (const e in params) {
|
|
3054
|
-
if (
|
|
3171
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
3172
|
+
continue;
|
|
3173
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
3055
3174
|
continue;
|
|
3056
3175
|
const objProp = obj[e];
|
|
3057
3176
|
const paramsProp = params[e];
|
|
3058
3177
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
3059
3178
|
obj[e] = paramsProp;
|
|
3060
3179
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
3061
|
-
obj[e] = overwriteDeep(objProp, paramsProp,
|
|
3180
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
3062
3181
|
} else if (paramsProp !== void 0) {
|
|
3063
3182
|
obj[e] = paramsProp;
|
|
3064
3183
|
}
|
|
@@ -3240,6 +3359,11 @@ var require_object = __commonJS({
|
|
|
3240
3359
|
}
|
|
3241
3360
|
return detect(obj);
|
|
3242
3361
|
};
|
|
3362
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
3363
|
+
const result = { ...obj };
|
|
3364
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
3365
|
+
return result;
|
|
3366
|
+
};
|
|
3243
3367
|
}
|
|
3244
3368
|
});
|
|
3245
3369
|
|
|
@@ -3395,9 +3519,11 @@ var require_cookie = __commonJS({
|
|
|
3395
3519
|
var cookie_exports = {};
|
|
3396
3520
|
__export2(cookie_exports, {
|
|
3397
3521
|
getCookie: () => getCookie,
|
|
3522
|
+
getLocalStorage: () => getLocalStorage,
|
|
3398
3523
|
isMobile: () => isMobile,
|
|
3399
3524
|
removeCookie: () => removeCookie,
|
|
3400
|
-
setCookie: () => setCookie
|
|
3525
|
+
setCookie: () => setCookie,
|
|
3526
|
+
setLocalStorage: () => setLocalStorage
|
|
3401
3527
|
});
|
|
3402
3528
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
3403
3529
|
var import_types = require_types();
|
|
@@ -3431,6 +3557,27 @@ var require_cookie = __commonJS({
|
|
|
3431
3557
|
return;
|
|
3432
3558
|
import_utils10.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
3433
3559
|
};
|
|
3560
|
+
function getLocalStorage(key) {
|
|
3561
|
+
let savedJSON;
|
|
3562
|
+
if (window.localStorage) {
|
|
3563
|
+
try {
|
|
3564
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
3565
|
+
} catch (e) {
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
if (typeof savedJSON !== "undefined") {
|
|
3569
|
+
return savedJSON;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
function setLocalStorage(key, data) {
|
|
3573
|
+
if (data && window.localStorage) {
|
|
3574
|
+
if (typeof data === "object") {
|
|
3575
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
3576
|
+
} else {
|
|
3577
|
+
window.localStorage.setItem(key, data);
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3434
3581
|
}
|
|
3435
3582
|
});
|
|
3436
3583
|
|
|
@@ -3634,7 +3781,9 @@ var require_component = __commonJS({
|
|
|
3634
3781
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3635
3782
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
3636
3783
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
3784
|
+
checkIfSugar: () => checkIfSugar,
|
|
3637
3785
|
extendizeByKey: () => extendizeByKey,
|
|
3786
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
3638
3787
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3639
3788
|
getExtendsInElement: () => getExtendsInElement,
|
|
3640
3789
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -3659,6 +3808,8 @@ var require_component = __commonJS({
|
|
|
3659
3808
|
return /^[a-z]*$/.test(firstCharKey);
|
|
3660
3809
|
};
|
|
3661
3810
|
var addAdditionalExtend = (newExtend, element) => {
|
|
3811
|
+
if (!newExtend)
|
|
3812
|
+
return element;
|
|
3662
3813
|
const { extend: elementExtend } = element;
|
|
3663
3814
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3664
3815
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -3666,26 +3817,44 @@ var require_component = __commonJS({
|
|
|
3666
3817
|
return { ...element, extend };
|
|
3667
3818
|
};
|
|
3668
3819
|
var checkIfSugar = (element, parent, key) => {
|
|
3669
|
-
|
|
3820
|
+
var _a;
|
|
3821
|
+
const {
|
|
3822
|
+
extend,
|
|
3823
|
+
props,
|
|
3824
|
+
childExtend,
|
|
3825
|
+
extends: extendProps,
|
|
3826
|
+
childExtends,
|
|
3827
|
+
childProps,
|
|
3828
|
+
children,
|
|
3829
|
+
on,
|
|
3830
|
+
$collection,
|
|
3831
|
+
$stateCollection,
|
|
3832
|
+
$propsCollection
|
|
3833
|
+
} = element;
|
|
3670
3834
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3671
|
-
|
|
3835
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
3836
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
3837
|
+
if (logErr)
|
|
3838
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
3839
|
+
}
|
|
3840
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
3672
3841
|
};
|
|
3673
3842
|
var extendizeByKey = (element, parent, key) => {
|
|
3674
3843
|
const { context } = parent;
|
|
3675
|
-
const { tag, extend,
|
|
3676
|
-
const isSugar = checkIfSugar(element);
|
|
3844
|
+
const { tag, extend, childExtends } = element;
|
|
3845
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
3677
3846
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3678
3847
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3679
3848
|
if (element === isExtendKeyComponent)
|
|
3680
3849
|
return element;
|
|
3681
3850
|
else if (isSugar) {
|
|
3682
|
-
const newElem = {
|
|
3851
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
3683
3852
|
extend: extendFromKey,
|
|
3684
3853
|
tag,
|
|
3685
3854
|
props: { ...element }
|
|
3686
|
-
};
|
|
3687
|
-
if (
|
|
3688
|
-
newElem.childExtend =
|
|
3855
|
+
});
|
|
3856
|
+
if (childExtends)
|
|
3857
|
+
newElem.childExtend = childExtends;
|
|
3689
3858
|
return newElem;
|
|
3690
3859
|
} else if (!extend || extend === true) {
|
|
3691
3860
|
return {
|
|
@@ -3714,23 +3883,24 @@ var require_component = __commonJS({
|
|
|
3714
3883
|
const childKey = childElems[i];
|
|
3715
3884
|
const childElem = element[childKey];
|
|
3716
3885
|
const newChild = element.props[childKey];
|
|
3886
|
+
const assignChild = (val) => {
|
|
3887
|
+
element[childKey] = val;
|
|
3888
|
+
delete element.props[childKey];
|
|
3889
|
+
};
|
|
3717
3890
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
3718
3891
|
continue;
|
|
3719
|
-
if (
|
|
3720
|
-
|
|
3892
|
+
if (newChild === null)
|
|
3893
|
+
assignChild(null);
|
|
3894
|
+
else if (!childElem)
|
|
3895
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
3721
3896
|
else {
|
|
3722
|
-
const
|
|
3723
|
-
if (
|
|
3897
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
3898
|
+
if (isSugarChildElem)
|
|
3724
3899
|
continue;
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
}
|
|
3729
|
-
element[childKey] = {
|
|
3730
|
-
extend: element[childKey],
|
|
3731
|
-
props: newChild
|
|
3732
|
-
};
|
|
3733
|
-
}
|
|
3900
|
+
assignChild({
|
|
3901
|
+
extend: element[childKey],
|
|
3902
|
+
props: newChild
|
|
3903
|
+
});
|
|
3734
3904
|
}
|
|
3735
3905
|
}
|
|
3736
3906
|
};
|
|
@@ -4114,7 +4284,7 @@ var CONFIG = {
|
|
|
4114
4284
|
useVariable: true,
|
|
4115
4285
|
useReset: true,
|
|
4116
4286
|
CSS_VARS,
|
|
4117
|
-
...defaultConfig_exports
|
|
4287
|
+
...void 0 || defaultConfig_exports
|
|
4118
4288
|
};
|
|
4119
4289
|
var cachedConfig = (0, import_utils.deepClone)(CONFIG);
|
|
4120
4290
|
var FACTORY = {
|