@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
package/dist/cjs/system/theme.js
CHANGED
|
@@ -302,6 +302,8 @@ var require_array = __commonJS({
|
|
|
302
302
|
arraysEqual: () => arraysEqual,
|
|
303
303
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
304
304
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
305
|
+
filterArrays: () => filterArrays,
|
|
306
|
+
filterArraysFast: () => filterArraysFast,
|
|
305
307
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
306
308
|
joinArrays: () => joinArrays,
|
|
307
309
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -410,6 +412,13 @@ var require_array = __commonJS({
|
|
|
410
412
|
}
|
|
411
413
|
return true;
|
|
412
414
|
};
|
|
415
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
416
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
417
|
+
};
|
|
418
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
419
|
+
const excludeSet = new Set(excludeArr);
|
|
420
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
421
|
+
};
|
|
413
422
|
}
|
|
414
423
|
});
|
|
415
424
|
|
|
@@ -603,6 +612,7 @@ var require_object = __commonJS({
|
|
|
603
612
|
diff: () => diff,
|
|
604
613
|
diffArrays: () => diffArrays,
|
|
605
614
|
diffObjects: () => diffObjects,
|
|
615
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
606
616
|
exec: () => exec,
|
|
607
617
|
flattenRecursive: () => flattenRecursive,
|
|
608
618
|
hasOwnProperty: () => hasOwnProperty,
|
|
@@ -758,10 +768,10 @@ var require_object = __commonJS({
|
|
|
758
768
|
return o;
|
|
759
769
|
};
|
|
760
770
|
var deepStringify = (obj, stringified = {}) => {
|
|
761
|
-
var _a;
|
|
771
|
+
var _a, _b;
|
|
762
772
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
763
|
-
|
|
764
|
-
obj = (
|
|
773
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
774
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
765
775
|
}
|
|
766
776
|
for (const prop in obj) {
|
|
767
777
|
const objProp = obj[prop];
|
|
@@ -831,7 +841,7 @@ var require_object = __commonJS({
|
|
|
831
841
|
if ((0, import_types.isArray)(value)) {
|
|
832
842
|
str += "[\n";
|
|
833
843
|
for (const element of value) {
|
|
834
|
-
if ((0, import_types.
|
|
844
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
835
845
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
836
846
|
`;
|
|
837
847
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -930,7 +940,7 @@ var require_object = __commonJS({
|
|
|
930
940
|
};
|
|
931
941
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
932
942
|
try {
|
|
933
|
-
return import_globals2.window.eval("(" + str + ")");
|
|
943
|
+
return str ? import_globals2.window.eval("(" + str + ")") : {};
|
|
934
944
|
} catch (e) {
|
|
935
945
|
if (opts.verbose)
|
|
936
946
|
console.warn(e);
|
|
@@ -1010,20 +1020,27 @@ var require_object = __commonJS({
|
|
|
1010
1020
|
return acc;
|
|
1011
1021
|
}, deletedValues);
|
|
1012
1022
|
};
|
|
1013
|
-
var overwrite = (element, params,
|
|
1014
|
-
const { ref } = element;
|
|
1015
|
-
const
|
|
1023
|
+
var overwrite = (element, params, opts = {}) => {
|
|
1024
|
+
const { __ref: ref } = element;
|
|
1025
|
+
const excl = opts.exclude || [];
|
|
1026
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
1027
|
+
const preventCaching = opts.preventCaching;
|
|
1016
1028
|
for (const e in params) {
|
|
1017
|
-
if (
|
|
1029
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
1018
1030
|
continue;
|
|
1019
1031
|
const elementProp = element[e];
|
|
1020
1032
|
const paramsProp = params[e];
|
|
1021
|
-
if (paramsProp) {
|
|
1022
|
-
|
|
1023
|
-
ref
|
|
1033
|
+
if (paramsProp !== void 0) {
|
|
1034
|
+
element[e] = paramsProp;
|
|
1035
|
+
if (ref && !preventCaching) {
|
|
1036
|
+
ref.__cache[e] = elementProp;
|
|
1037
|
+
}
|
|
1038
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
1039
|
+
diff[e] = elementProp;
|
|
1040
|
+
}
|
|
1024
1041
|
}
|
|
1025
1042
|
}
|
|
1026
|
-
return
|
|
1043
|
+
return element;
|
|
1027
1044
|
};
|
|
1028
1045
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
1029
1046
|
for (const e in params) {
|
|
@@ -1033,23 +1050,26 @@ var require_object = __commonJS({
|
|
|
1033
1050
|
}
|
|
1034
1051
|
return obj;
|
|
1035
1052
|
};
|
|
1036
|
-
var overwriteDeep = (obj, params,
|
|
1053
|
+
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1054
|
+
const excl = opts.exclude || [];
|
|
1055
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
1037
1056
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1038
1057
|
return params;
|
|
1039
1058
|
}
|
|
1040
|
-
if (visited.has(obj))
|
|
1059
|
+
if (visited.has(obj))
|
|
1041
1060
|
return visited.get(obj);
|
|
1042
|
-
}
|
|
1043
1061
|
visited.set(obj, obj);
|
|
1044
1062
|
for (const e in params) {
|
|
1045
|
-
if (
|
|
1063
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
1064
|
+
continue;
|
|
1065
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
1046
1066
|
continue;
|
|
1047
1067
|
const objProp = obj[e];
|
|
1048
1068
|
const paramsProp = params[e];
|
|
1049
1069
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1050
1070
|
obj[e] = paramsProp;
|
|
1051
1071
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1052
|
-
obj[e] = overwriteDeep(objProp, paramsProp,
|
|
1072
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
1053
1073
|
} else if (paramsProp !== void 0) {
|
|
1054
1074
|
obj[e] = paramsProp;
|
|
1055
1075
|
}
|
|
@@ -1231,6 +1251,11 @@ var require_object = __commonJS({
|
|
|
1231
1251
|
}
|
|
1232
1252
|
return detect(obj);
|
|
1233
1253
|
};
|
|
1254
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
1255
|
+
const result = { ...obj };
|
|
1256
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
1257
|
+
return result;
|
|
1258
|
+
};
|
|
1234
1259
|
}
|
|
1235
1260
|
});
|
|
1236
1261
|
|
|
@@ -1386,9 +1411,11 @@ var require_cookie = __commonJS({
|
|
|
1386
1411
|
var cookie_exports = {};
|
|
1387
1412
|
__export2(cookie_exports, {
|
|
1388
1413
|
getCookie: () => getCookie,
|
|
1414
|
+
getLocalStorage: () => getLocalStorage,
|
|
1389
1415
|
isMobile: () => isMobile,
|
|
1390
1416
|
removeCookie: () => removeCookie,
|
|
1391
|
-
setCookie: () => setCookie
|
|
1417
|
+
setCookie: () => setCookie,
|
|
1418
|
+
setLocalStorage: () => setLocalStorage
|
|
1392
1419
|
});
|
|
1393
1420
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
1394
1421
|
var import_types = require_types();
|
|
@@ -1422,6 +1449,27 @@ var require_cookie = __commonJS({
|
|
|
1422
1449
|
return;
|
|
1423
1450
|
import_utils10.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1424
1451
|
};
|
|
1452
|
+
function getLocalStorage(key) {
|
|
1453
|
+
let savedJSON;
|
|
1454
|
+
if (window.localStorage) {
|
|
1455
|
+
try {
|
|
1456
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
1457
|
+
} catch (e) {
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (typeof savedJSON !== "undefined") {
|
|
1461
|
+
return savedJSON;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
function setLocalStorage(key, data) {
|
|
1465
|
+
if (data && window.localStorage) {
|
|
1466
|
+
if (typeof data === "object") {
|
|
1467
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
1468
|
+
} else {
|
|
1469
|
+
window.localStorage.setItem(key, data);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1425
1473
|
}
|
|
1426
1474
|
});
|
|
1427
1475
|
|
|
@@ -1625,7 +1673,9 @@ var require_component = __commonJS({
|
|
|
1625
1673
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1626
1674
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1627
1675
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1676
|
+
checkIfSugar: () => checkIfSugar,
|
|
1628
1677
|
extendizeByKey: () => extendizeByKey,
|
|
1678
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1629
1679
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1630
1680
|
getExtendsInElement: () => getExtendsInElement,
|
|
1631
1681
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -1650,6 +1700,8 @@ var require_component = __commonJS({
|
|
|
1650
1700
|
return /^[a-z]*$/.test(firstCharKey);
|
|
1651
1701
|
};
|
|
1652
1702
|
var addAdditionalExtend = (newExtend, element) => {
|
|
1703
|
+
if (!newExtend)
|
|
1704
|
+
return element;
|
|
1653
1705
|
const { extend: elementExtend } = element;
|
|
1654
1706
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1655
1707
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -1657,26 +1709,44 @@ var require_component = __commonJS({
|
|
|
1657
1709
|
return { ...element, extend };
|
|
1658
1710
|
};
|
|
1659
1711
|
var checkIfSugar = (element, parent, key) => {
|
|
1660
|
-
|
|
1712
|
+
var _a;
|
|
1713
|
+
const {
|
|
1714
|
+
extend,
|
|
1715
|
+
props,
|
|
1716
|
+
childExtend,
|
|
1717
|
+
extends: extendProps,
|
|
1718
|
+
childExtends,
|
|
1719
|
+
childProps,
|
|
1720
|
+
children,
|
|
1721
|
+
on,
|
|
1722
|
+
$collection,
|
|
1723
|
+
$stateCollection,
|
|
1724
|
+
$propsCollection
|
|
1725
|
+
} = element;
|
|
1661
1726
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1662
|
-
|
|
1727
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
1728
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
1729
|
+
if (logErr)
|
|
1730
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
1731
|
+
}
|
|
1732
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1663
1733
|
};
|
|
1664
1734
|
var extendizeByKey = (element, parent, key) => {
|
|
1665
1735
|
const { context } = parent;
|
|
1666
|
-
const { tag, extend,
|
|
1667
|
-
const isSugar = checkIfSugar(element);
|
|
1736
|
+
const { tag, extend, childExtends } = element;
|
|
1737
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
1668
1738
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1669
1739
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1670
1740
|
if (element === isExtendKeyComponent)
|
|
1671
1741
|
return element;
|
|
1672
1742
|
else if (isSugar) {
|
|
1673
|
-
const newElem = {
|
|
1743
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
1674
1744
|
extend: extendFromKey,
|
|
1675
1745
|
tag,
|
|
1676
1746
|
props: { ...element }
|
|
1677
|
-
};
|
|
1678
|
-
if (
|
|
1679
|
-
newElem.childExtend =
|
|
1747
|
+
});
|
|
1748
|
+
if (childExtends)
|
|
1749
|
+
newElem.childExtend = childExtends;
|
|
1680
1750
|
return newElem;
|
|
1681
1751
|
} else if (!extend || extend === true) {
|
|
1682
1752
|
return {
|
|
@@ -1705,23 +1775,24 @@ var require_component = __commonJS({
|
|
|
1705
1775
|
const childKey = childElems[i];
|
|
1706
1776
|
const childElem = element[childKey];
|
|
1707
1777
|
const newChild = element.props[childKey];
|
|
1778
|
+
const assignChild = (val) => {
|
|
1779
|
+
element[childKey] = val;
|
|
1780
|
+
delete element.props[childKey];
|
|
1781
|
+
};
|
|
1708
1782
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1709
1783
|
continue;
|
|
1710
|
-
if (
|
|
1711
|
-
|
|
1784
|
+
if (newChild === null)
|
|
1785
|
+
assignChild(null);
|
|
1786
|
+
else if (!childElem)
|
|
1787
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
1712
1788
|
else {
|
|
1713
|
-
const
|
|
1714
|
-
if (
|
|
1789
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1790
|
+
if (isSugarChildElem)
|
|
1715
1791
|
continue;
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
}
|
|
1720
|
-
element[childKey] = {
|
|
1721
|
-
extend: element[childKey],
|
|
1722
|
-
props: newChild
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1792
|
+
assignChild({
|
|
1793
|
+
extend: element[childKey],
|
|
1794
|
+
props: newChild
|
|
1795
|
+
});
|
|
1725
1796
|
}
|
|
1726
1797
|
}
|
|
1727
1798
|
};
|
|
@@ -2181,6 +2252,8 @@ var require_cjs3 = __commonJS({
|
|
|
2181
2252
|
arraysEqual: () => arraysEqual,
|
|
2182
2253
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
2183
2254
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
2255
|
+
filterArrays: () => filterArrays,
|
|
2256
|
+
filterArraysFast: () => filterArraysFast,
|
|
2184
2257
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
2185
2258
|
joinArrays: () => joinArrays,
|
|
2186
2259
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -2289,6 +2362,13 @@ var require_cjs3 = __commonJS({
|
|
|
2289
2362
|
}
|
|
2290
2363
|
return true;
|
|
2291
2364
|
};
|
|
2365
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
2366
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
2367
|
+
};
|
|
2368
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
2369
|
+
const excludeSet = new Set(excludeArr);
|
|
2370
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
2371
|
+
};
|
|
2292
2372
|
}
|
|
2293
2373
|
});
|
|
2294
2374
|
var require_string2 = __commonJS2({
|
|
@@ -2478,9 +2558,11 @@ var require_cjs3 = __commonJS({
|
|
|
2478
2558
|
diff: () => diff,
|
|
2479
2559
|
diffArrays: () => diffArrays,
|
|
2480
2560
|
diffObjects: () => diffObjects,
|
|
2561
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
2481
2562
|
exec: () => exec,
|
|
2482
2563
|
flattenRecursive: () => flattenRecursive,
|
|
2483
2564
|
hasOwnProperty: () => hasOwnProperty,
|
|
2565
|
+
isCyclic: () => isCyclic,
|
|
2484
2566
|
isEmpty: () => isEmpty,
|
|
2485
2567
|
isEmptyObject: () => isEmptyObject,
|
|
2486
2568
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -2606,28 +2688,36 @@ var require_cjs3 = __commonJS({
|
|
|
2606
2688
|
}
|
|
2607
2689
|
return clone2;
|
|
2608
2690
|
};
|
|
2609
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2691
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
2692
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
2693
|
+
if (visited.has(obj)) {
|
|
2694
|
+
return obj;
|
|
2695
|
+
}
|
|
2696
|
+
visited.add(obj);
|
|
2697
|
+
}
|
|
2610
2698
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
2611
2699
|
for (const prop in obj) {
|
|
2612
2700
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2613
2701
|
continue;
|
|
2614
2702
|
const objProp = obj[prop];
|
|
2615
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
2703
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
2616
2704
|
continue;
|
|
2705
|
+
}
|
|
2617
2706
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2618
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2707
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
2619
2708
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2620
2709
|
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
2621
|
-
} else
|
|
2710
|
+
} else {
|
|
2622
2711
|
o[prop] = objProp;
|
|
2712
|
+
}
|
|
2623
2713
|
}
|
|
2624
2714
|
return o;
|
|
2625
2715
|
};
|
|
2626
2716
|
var deepStringify = (obj, stringified = {}) => {
|
|
2627
|
-
var _a;
|
|
2717
|
+
var _a, _b;
|
|
2628
2718
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
2629
|
-
|
|
2630
|
-
obj = (
|
|
2719
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
2720
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
2631
2721
|
}
|
|
2632
2722
|
for (const prop in obj) {
|
|
2633
2723
|
const objProp = obj[prop];
|
|
@@ -2697,7 +2787,7 @@ var require_cjs3 = __commonJS({
|
|
|
2697
2787
|
if ((0, import_types.isArray)(value)) {
|
|
2698
2788
|
str += "[\n";
|
|
2699
2789
|
for (const element of value) {
|
|
2700
|
-
if ((0, import_types.
|
|
2790
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
2701
2791
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
2702
2792
|
`;
|
|
2703
2793
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -2796,7 +2886,7 @@ var require_cjs3 = __commonJS({
|
|
|
2796
2886
|
};
|
|
2797
2887
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
2798
2888
|
try {
|
|
2799
|
-
return import_globals2.window.eval("(" + str + ")");
|
|
2889
|
+
return str ? import_globals2.window.eval("(" + str + ")") : {};
|
|
2800
2890
|
} catch (e) {
|
|
2801
2891
|
if (opts.verbose)
|
|
2802
2892
|
console.warn(e);
|
|
@@ -2876,20 +2966,27 @@ var require_cjs3 = __commonJS({
|
|
|
2876
2966
|
return acc;
|
|
2877
2967
|
}, deletedValues);
|
|
2878
2968
|
};
|
|
2879
|
-
var overwrite = (element, params,
|
|
2880
|
-
const { ref } = element;
|
|
2881
|
-
const
|
|
2969
|
+
var overwrite = (element, params, opts = {}) => {
|
|
2970
|
+
const { __ref: ref } = element;
|
|
2971
|
+
const excl = opts.exclude || [];
|
|
2972
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
2973
|
+
const preventCaching = opts.preventCaching;
|
|
2882
2974
|
for (const e in params) {
|
|
2883
|
-
if (
|
|
2975
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
2884
2976
|
continue;
|
|
2885
2977
|
const elementProp = element[e];
|
|
2886
2978
|
const paramsProp = params[e];
|
|
2887
|
-
if (paramsProp) {
|
|
2888
|
-
|
|
2889
|
-
ref
|
|
2979
|
+
if (paramsProp !== void 0) {
|
|
2980
|
+
element[e] = paramsProp;
|
|
2981
|
+
if (ref && !preventCaching) {
|
|
2982
|
+
ref.__cache[e] = elementProp;
|
|
2983
|
+
}
|
|
2984
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
2985
|
+
diff[e] = elementProp;
|
|
2986
|
+
}
|
|
2890
2987
|
}
|
|
2891
2988
|
}
|
|
2892
|
-
return
|
|
2989
|
+
return element;
|
|
2893
2990
|
};
|
|
2894
2991
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
2895
2992
|
for (const e in params) {
|
|
@@ -2899,23 +2996,26 @@ var require_cjs3 = __commonJS({
|
|
|
2899
2996
|
}
|
|
2900
2997
|
return obj;
|
|
2901
2998
|
};
|
|
2902
|
-
var overwriteDeep = (obj, params,
|
|
2999
|
+
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
3000
|
+
const excl = opts.exclude || [];
|
|
3001
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
2903
3002
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2904
3003
|
return params;
|
|
2905
3004
|
}
|
|
2906
|
-
if (visited.has(obj))
|
|
3005
|
+
if (visited.has(obj))
|
|
2907
3006
|
return visited.get(obj);
|
|
2908
|
-
}
|
|
2909
3007
|
visited.set(obj, obj);
|
|
2910
3008
|
for (const e in params) {
|
|
2911
|
-
if (
|
|
3009
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
3010
|
+
continue;
|
|
3011
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
2912
3012
|
continue;
|
|
2913
3013
|
const objProp = obj[e];
|
|
2914
3014
|
const paramsProp = params[e];
|
|
2915
3015
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2916
3016
|
obj[e] = paramsProp;
|
|
2917
3017
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2918
|
-
obj[e] = overwriteDeep(objProp, paramsProp,
|
|
3018
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
2919
3019
|
} else if (paramsProp !== void 0) {
|
|
2920
3020
|
obj[e] = paramsProp;
|
|
2921
3021
|
}
|
|
@@ -3078,6 +3178,30 @@ var require_cjs3 = __commonJS({
|
|
|
3078
3178
|
}
|
|
3079
3179
|
}
|
|
3080
3180
|
};
|
|
3181
|
+
var isCyclic = (obj) => {
|
|
3182
|
+
const seenObjects = [];
|
|
3183
|
+
function detect(obj2) {
|
|
3184
|
+
if (obj2 && typeof obj2 === "object") {
|
|
3185
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
3186
|
+
return true;
|
|
3187
|
+
}
|
|
3188
|
+
seenObjects.push(obj2);
|
|
3189
|
+
for (const key in obj2) {
|
|
3190
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
3191
|
+
console.log(obj2, "cycle at " + key);
|
|
3192
|
+
return true;
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
return false;
|
|
3197
|
+
}
|
|
3198
|
+
return detect(obj);
|
|
3199
|
+
};
|
|
3200
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
3201
|
+
const result = { ...obj };
|
|
3202
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
3203
|
+
return result;
|
|
3204
|
+
};
|
|
3081
3205
|
}
|
|
3082
3206
|
});
|
|
3083
3207
|
var require_function2 = __commonJS2({
|
|
@@ -3227,9 +3351,11 @@ var require_cjs3 = __commonJS({
|
|
|
3227
3351
|
var cookie_exports = {};
|
|
3228
3352
|
__export22(cookie_exports, {
|
|
3229
3353
|
getCookie: () => getCookie,
|
|
3354
|
+
getLocalStorage: () => getLocalStorage,
|
|
3230
3355
|
isMobile: () => isMobile,
|
|
3231
3356
|
removeCookie: () => removeCookie,
|
|
3232
|
-
setCookie: () => setCookie
|
|
3357
|
+
setCookie: () => setCookie,
|
|
3358
|
+
setLocalStorage: () => setLocalStorage
|
|
3233
3359
|
});
|
|
3234
3360
|
module22.exports = __toCommonJS22(cookie_exports);
|
|
3235
3361
|
var import_types = require_types2();
|
|
@@ -3263,6 +3389,27 @@ var require_cjs3 = __commonJS({
|
|
|
3263
3389
|
return;
|
|
3264
3390
|
import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
3265
3391
|
};
|
|
3392
|
+
function getLocalStorage(key) {
|
|
3393
|
+
let savedJSON;
|
|
3394
|
+
if (window.localStorage) {
|
|
3395
|
+
try {
|
|
3396
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
3397
|
+
} catch (e) {
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
if (typeof savedJSON !== "undefined") {
|
|
3401
|
+
return savedJSON;
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
function setLocalStorage(key, data) {
|
|
3405
|
+
if (data && window.localStorage) {
|
|
3406
|
+
if (typeof data === "object") {
|
|
3407
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
3408
|
+
} else {
|
|
3409
|
+
window.localStorage.setItem(key, data);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3266
3413
|
}
|
|
3267
3414
|
});
|
|
3268
3415
|
var require_tags2 = __commonJS2({
|
|
@@ -3462,7 +3609,9 @@ var require_cjs3 = __commonJS({
|
|
|
3462
3609
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3463
3610
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
3464
3611
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
3612
|
+
checkIfSugar: () => checkIfSugar,
|
|
3465
3613
|
extendizeByKey: () => extendizeByKey,
|
|
3614
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
3466
3615
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3467
3616
|
getExtendsInElement: () => getExtendsInElement,
|
|
3468
3617
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -3487,6 +3636,8 @@ var require_cjs3 = __commonJS({
|
|
|
3487
3636
|
return /^[a-z]*$/.test(firstCharKey);
|
|
3488
3637
|
};
|
|
3489
3638
|
var addAdditionalExtend = (newExtend, element) => {
|
|
3639
|
+
if (!newExtend)
|
|
3640
|
+
return element;
|
|
3490
3641
|
const { extend: elementExtend } = element;
|
|
3491
3642
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3492
3643
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -3494,26 +3645,44 @@ var require_cjs3 = __commonJS({
|
|
|
3494
3645
|
return { ...element, extend };
|
|
3495
3646
|
};
|
|
3496
3647
|
var checkIfSugar = (element, parent, key) => {
|
|
3497
|
-
|
|
3648
|
+
var _a;
|
|
3649
|
+
const {
|
|
3650
|
+
extend,
|
|
3651
|
+
props,
|
|
3652
|
+
childExtend,
|
|
3653
|
+
extends: extendProps,
|
|
3654
|
+
childExtends,
|
|
3655
|
+
childProps,
|
|
3656
|
+
children,
|
|
3657
|
+
on,
|
|
3658
|
+
$collection,
|
|
3659
|
+
$stateCollection,
|
|
3660
|
+
$propsCollection
|
|
3661
|
+
} = element;
|
|
3498
3662
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3499
|
-
|
|
3663
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
3664
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
3665
|
+
if (logErr)
|
|
3666
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
3667
|
+
}
|
|
3668
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
3500
3669
|
};
|
|
3501
3670
|
var extendizeByKey = (element, parent, key) => {
|
|
3502
3671
|
const { context } = parent;
|
|
3503
|
-
const { tag, extend,
|
|
3504
|
-
const isSugar = checkIfSugar(element);
|
|
3672
|
+
const { tag, extend, childExtends } = element;
|
|
3673
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
3505
3674
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3506
3675
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3507
3676
|
if (element === isExtendKeyComponent)
|
|
3508
3677
|
return element;
|
|
3509
3678
|
else if (isSugar) {
|
|
3510
|
-
const newElem = {
|
|
3679
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
3511
3680
|
extend: extendFromKey,
|
|
3512
3681
|
tag,
|
|
3513
3682
|
props: { ...element }
|
|
3514
|
-
};
|
|
3515
|
-
if (
|
|
3516
|
-
newElem.childExtend =
|
|
3683
|
+
});
|
|
3684
|
+
if (childExtends)
|
|
3685
|
+
newElem.childExtend = childExtends;
|
|
3517
3686
|
return newElem;
|
|
3518
3687
|
} else if (!extend || extend === true) {
|
|
3519
3688
|
return {
|
|
@@ -3542,23 +3711,24 @@ var require_cjs3 = __commonJS({
|
|
|
3542
3711
|
const childKey = childElems[i];
|
|
3543
3712
|
const childElem = element[childKey];
|
|
3544
3713
|
const newChild = element.props[childKey];
|
|
3714
|
+
const assignChild = (val) => {
|
|
3715
|
+
element[childKey] = val;
|
|
3716
|
+
delete element.props[childKey];
|
|
3717
|
+
};
|
|
3545
3718
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
3546
3719
|
continue;
|
|
3547
|
-
if (
|
|
3548
|
-
|
|
3720
|
+
if (newChild === null)
|
|
3721
|
+
assignChild(null);
|
|
3722
|
+
else if (!childElem)
|
|
3723
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
3549
3724
|
else {
|
|
3550
|
-
const
|
|
3551
|
-
if (
|
|
3725
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
3726
|
+
if (isSugarChildElem)
|
|
3552
3727
|
continue;
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
}
|
|
3557
|
-
element[childKey] = {
|
|
3558
|
-
extend: element[childKey],
|
|
3559
|
-
props: newChild
|
|
3560
|
-
};
|
|
3561
|
-
}
|
|
3728
|
+
assignChild({
|
|
3729
|
+
extend: element[childKey],
|
|
3730
|
+
props: newChild
|
|
3731
|
+
});
|
|
3562
3732
|
}
|
|
3563
3733
|
}
|
|
3564
3734
|
};
|
|
@@ -4116,7 +4286,7 @@ var CONFIG = {
|
|
|
4116
4286
|
useVariable: true,
|
|
4117
4287
|
useReset: true,
|
|
4118
4288
|
CSS_VARS,
|
|
4119
|
-
...defaultConfig_exports
|
|
4289
|
+
...void 0 || defaultConfig_exports
|
|
4120
4290
|
};
|
|
4121
4291
|
var cachedConfig = (0, import_utils.deepClone)(CONFIG);
|
|
4122
4292
|
var FACTORY = {
|