@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/index.js
CHANGED
|
@@ -338,6 +338,8 @@ var require_array = __commonJS({
|
|
|
338
338
|
arraysEqual: () => arraysEqual,
|
|
339
339
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
340
340
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
341
|
+
filterArrays: () => filterArrays,
|
|
342
|
+
filterArraysFast: () => filterArraysFast,
|
|
341
343
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
342
344
|
joinArrays: () => joinArrays,
|
|
343
345
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -446,6 +448,13 @@ var require_array = __commonJS({
|
|
|
446
448
|
}
|
|
447
449
|
return true;
|
|
448
450
|
};
|
|
451
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
452
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
453
|
+
};
|
|
454
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
455
|
+
const excludeSet = new Set(excludeArr);
|
|
456
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
457
|
+
};
|
|
449
458
|
}
|
|
450
459
|
});
|
|
451
460
|
|
|
@@ -639,6 +648,7 @@ var require_object = __commonJS({
|
|
|
639
648
|
diff: () => diff,
|
|
640
649
|
diffArrays: () => diffArrays,
|
|
641
650
|
diffObjects: () => diffObjects,
|
|
651
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
642
652
|
exec: () => exec,
|
|
643
653
|
flattenRecursive: () => flattenRecursive,
|
|
644
654
|
hasOwnProperty: () => hasOwnProperty,
|
|
@@ -794,10 +804,10 @@ var require_object = __commonJS({
|
|
|
794
804
|
return o;
|
|
795
805
|
};
|
|
796
806
|
var deepStringify = (obj, stringified = {}) => {
|
|
797
|
-
var _a;
|
|
807
|
+
var _a, _b;
|
|
798
808
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
799
|
-
|
|
800
|
-
obj = (
|
|
809
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
810
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
801
811
|
}
|
|
802
812
|
for (const prop in obj) {
|
|
803
813
|
const objProp = obj[prop];
|
|
@@ -867,7 +877,7 @@ var require_object = __commonJS({
|
|
|
867
877
|
if ((0, import_types.isArray)(value)) {
|
|
868
878
|
str += "[\n";
|
|
869
879
|
for (const element of value) {
|
|
870
|
-
if ((0, import_types.
|
|
880
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
871
881
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
872
882
|
`;
|
|
873
883
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -966,7 +976,7 @@ var require_object = __commonJS({
|
|
|
966
976
|
};
|
|
967
977
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
968
978
|
try {
|
|
969
|
-
return import_globals3.window.eval("(" + str + ")");
|
|
979
|
+
return str ? import_globals3.window.eval("(" + str + ")") : {};
|
|
970
980
|
} catch (e) {
|
|
971
981
|
if (opts.verbose)
|
|
972
982
|
console.warn(e);
|
|
@@ -1046,20 +1056,27 @@ var require_object = __commonJS({
|
|
|
1046
1056
|
return acc;
|
|
1047
1057
|
}, deletedValues);
|
|
1048
1058
|
};
|
|
1049
|
-
var overwrite = (element, params,
|
|
1050
|
-
const { ref } = element;
|
|
1051
|
-
const
|
|
1059
|
+
var overwrite = (element, params, opts = {}) => {
|
|
1060
|
+
const { __ref: ref } = element;
|
|
1061
|
+
const excl = opts.exclude || [];
|
|
1062
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
1063
|
+
const preventCaching = opts.preventCaching;
|
|
1052
1064
|
for (const e in params) {
|
|
1053
|
-
if (
|
|
1065
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
1054
1066
|
continue;
|
|
1055
1067
|
const elementProp = element[e];
|
|
1056
1068
|
const paramsProp = params[e];
|
|
1057
|
-
if (paramsProp) {
|
|
1058
|
-
|
|
1059
|
-
ref
|
|
1069
|
+
if (paramsProp !== void 0) {
|
|
1070
|
+
element[e] = paramsProp;
|
|
1071
|
+
if (ref && !preventCaching) {
|
|
1072
|
+
ref.__cache[e] = elementProp;
|
|
1073
|
+
}
|
|
1074
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
1075
|
+
diff[e] = elementProp;
|
|
1076
|
+
}
|
|
1060
1077
|
}
|
|
1061
1078
|
}
|
|
1062
|
-
return
|
|
1079
|
+
return element;
|
|
1063
1080
|
};
|
|
1064
1081
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
1065
1082
|
for (const e in params) {
|
|
@@ -1069,23 +1086,26 @@ var require_object = __commonJS({
|
|
|
1069
1086
|
}
|
|
1070
1087
|
return obj;
|
|
1071
1088
|
};
|
|
1072
|
-
var overwriteDeep2 = (obj, params,
|
|
1089
|
+
var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1090
|
+
const excl = opts.exclude || [];
|
|
1091
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
1073
1092
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1074
1093
|
return params;
|
|
1075
1094
|
}
|
|
1076
|
-
if (visited.has(obj))
|
|
1095
|
+
if (visited.has(obj))
|
|
1077
1096
|
return visited.get(obj);
|
|
1078
|
-
}
|
|
1079
1097
|
visited.set(obj, obj);
|
|
1080
1098
|
for (const e in params) {
|
|
1081
|
-
if (
|
|
1099
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
1100
|
+
continue;
|
|
1101
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
1082
1102
|
continue;
|
|
1083
1103
|
const objProp = obj[e];
|
|
1084
1104
|
const paramsProp = params[e];
|
|
1085
1105
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1086
1106
|
obj[e] = paramsProp;
|
|
1087
1107
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1088
|
-
obj[e] = overwriteDeep2(objProp, paramsProp,
|
|
1108
|
+
obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
|
|
1089
1109
|
} else if (paramsProp !== void 0) {
|
|
1090
1110
|
obj[e] = paramsProp;
|
|
1091
1111
|
}
|
|
@@ -1267,6 +1287,11 @@ var require_object = __commonJS({
|
|
|
1267
1287
|
}
|
|
1268
1288
|
return detect(obj);
|
|
1269
1289
|
};
|
|
1290
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
1291
|
+
const result = { ...obj };
|
|
1292
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
1293
|
+
return result;
|
|
1294
|
+
};
|
|
1270
1295
|
}
|
|
1271
1296
|
});
|
|
1272
1297
|
|
|
@@ -1422,9 +1447,11 @@ var require_cookie = __commonJS({
|
|
|
1422
1447
|
var cookie_exports = {};
|
|
1423
1448
|
__export2(cookie_exports, {
|
|
1424
1449
|
getCookie: () => getCookie,
|
|
1450
|
+
getLocalStorage: () => getLocalStorage,
|
|
1425
1451
|
isMobile: () => isMobile,
|
|
1426
1452
|
removeCookie: () => removeCookie,
|
|
1427
|
-
setCookie: () => setCookie
|
|
1453
|
+
setCookie: () => setCookie,
|
|
1454
|
+
setLocalStorage: () => setLocalStorage
|
|
1428
1455
|
});
|
|
1429
1456
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
1430
1457
|
var import_types = require_types();
|
|
@@ -1458,6 +1485,27 @@ var require_cookie = __commonJS({
|
|
|
1458
1485
|
return;
|
|
1459
1486
|
import_utils27.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1460
1487
|
};
|
|
1488
|
+
function getLocalStorage(key) {
|
|
1489
|
+
let savedJSON;
|
|
1490
|
+
if (window.localStorage) {
|
|
1491
|
+
try {
|
|
1492
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
1493
|
+
} catch (e) {
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
if (typeof savedJSON !== "undefined") {
|
|
1497
|
+
return savedJSON;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function setLocalStorage(key, data) {
|
|
1501
|
+
if (data && window.localStorage) {
|
|
1502
|
+
if (typeof data === "object") {
|
|
1503
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
1504
|
+
} else {
|
|
1505
|
+
window.localStorage.setItem(key, data);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1461
1509
|
}
|
|
1462
1510
|
});
|
|
1463
1511
|
|
|
@@ -1661,7 +1709,9 @@ var require_component = __commonJS({
|
|
|
1661
1709
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1662
1710
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1663
1711
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1712
|
+
checkIfSugar: () => checkIfSugar,
|
|
1664
1713
|
extendizeByKey: () => extendizeByKey,
|
|
1714
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1665
1715
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1666
1716
|
getExtendsInElement: () => getExtendsInElement,
|
|
1667
1717
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -1686,6 +1736,8 @@ var require_component = __commonJS({
|
|
|
1686
1736
|
return /^[a-z]*$/.test(firstCharKey);
|
|
1687
1737
|
};
|
|
1688
1738
|
var addAdditionalExtend = (newExtend, element) => {
|
|
1739
|
+
if (!newExtend)
|
|
1740
|
+
return element;
|
|
1689
1741
|
const { extend: elementExtend } = element;
|
|
1690
1742
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1691
1743
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -1693,26 +1745,44 @@ var require_component = __commonJS({
|
|
|
1693
1745
|
return { ...element, extend };
|
|
1694
1746
|
};
|
|
1695
1747
|
var checkIfSugar = (element, parent, key) => {
|
|
1696
|
-
|
|
1748
|
+
var _a;
|
|
1749
|
+
const {
|
|
1750
|
+
extend,
|
|
1751
|
+
props,
|
|
1752
|
+
childExtend,
|
|
1753
|
+
extends: extendProps,
|
|
1754
|
+
childExtends,
|
|
1755
|
+
childProps,
|
|
1756
|
+
children,
|
|
1757
|
+
on,
|
|
1758
|
+
$collection,
|
|
1759
|
+
$stateCollection,
|
|
1760
|
+
$propsCollection
|
|
1761
|
+
} = element;
|
|
1697
1762
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1698
|
-
|
|
1763
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
1764
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
1765
|
+
if (logErr)
|
|
1766
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
1767
|
+
}
|
|
1768
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1699
1769
|
};
|
|
1700
1770
|
var extendizeByKey = (element, parent, key) => {
|
|
1701
1771
|
const { context } = parent;
|
|
1702
|
-
const { tag, extend,
|
|
1703
|
-
const isSugar = checkIfSugar(element);
|
|
1772
|
+
const { tag, extend, childExtends } = element;
|
|
1773
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
1704
1774
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1705
1775
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1706
1776
|
if (element === isExtendKeyComponent)
|
|
1707
1777
|
return element;
|
|
1708
1778
|
else if (isSugar) {
|
|
1709
|
-
const newElem = {
|
|
1779
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
1710
1780
|
extend: extendFromKey,
|
|
1711
1781
|
tag,
|
|
1712
1782
|
props: { ...element }
|
|
1713
|
-
};
|
|
1714
|
-
if (
|
|
1715
|
-
newElem.childExtend =
|
|
1783
|
+
});
|
|
1784
|
+
if (childExtends)
|
|
1785
|
+
newElem.childExtend = childExtends;
|
|
1716
1786
|
return newElem;
|
|
1717
1787
|
} else if (!extend || extend === true) {
|
|
1718
1788
|
return {
|
|
@@ -1741,23 +1811,24 @@ var require_component = __commonJS({
|
|
|
1741
1811
|
const childKey = childElems[i];
|
|
1742
1812
|
const childElem = element[childKey];
|
|
1743
1813
|
const newChild = element.props[childKey];
|
|
1814
|
+
const assignChild = (val) => {
|
|
1815
|
+
element[childKey] = val;
|
|
1816
|
+
delete element.props[childKey];
|
|
1817
|
+
};
|
|
1744
1818
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1745
1819
|
continue;
|
|
1746
|
-
if (
|
|
1747
|
-
|
|
1820
|
+
if (newChild === null)
|
|
1821
|
+
assignChild(null);
|
|
1822
|
+
else if (!childElem)
|
|
1823
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
1748
1824
|
else {
|
|
1749
|
-
const
|
|
1750
|
-
if (
|
|
1825
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1826
|
+
if (isSugarChildElem)
|
|
1751
1827
|
continue;
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
}
|
|
1756
|
-
element[childKey] = {
|
|
1757
|
-
extend: element[childKey],
|
|
1758
|
-
props: newChild
|
|
1759
|
-
};
|
|
1760
|
-
}
|
|
1828
|
+
assignChild({
|
|
1829
|
+
extend: element[childKey],
|
|
1830
|
+
props: newChild
|
|
1831
|
+
});
|
|
1761
1832
|
}
|
|
1762
1833
|
}
|
|
1763
1834
|
};
|
|
@@ -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_globals3.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_globals3.window.eval("(" + str + ")");
|
|
2889
|
+
return str ? import_globals3.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 overwriteDeep2 = (obj, params,
|
|
2999
|
+
var overwriteDeep2 = (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] = overwriteDeep2(objProp, paramsProp,
|
|
3018
|
+
obj[e] = overwriteDeep2(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
|
};
|
|
@@ -4494,7 +4664,7 @@ var CONFIG = {
|
|
|
4494
4664
|
useVariable: true,
|
|
4495
4665
|
useReset: true,
|
|
4496
4666
|
CSS_VARS,
|
|
4497
|
-
...defaultConfig_exports
|
|
4667
|
+
...void 0 || defaultConfig_exports
|
|
4498
4668
|
};
|
|
4499
4669
|
var cachedConfig = (0, import_utils2.deepClone)(CONFIG);
|
|
4500
4670
|
var FACTORY = {
|
|
@@ -4820,10 +4990,11 @@ var generateSprite = (icons) => {
|
|
|
4820
4990
|
return sprite;
|
|
4821
4991
|
};
|
|
4822
4992
|
var parseRootAttributes = (htmlString) => {
|
|
4823
|
-
|
|
4824
|
-
|
|
4993
|
+
const val = htmlString.default || htmlString;
|
|
4994
|
+
if (!(0, import_utils6.isString)(val)) {
|
|
4995
|
+
return console.warn(`parseRootAttributes: ${val} is not a string`);
|
|
4825
4996
|
}
|
|
4826
|
-
const match =
|
|
4997
|
+
const match = val.match(/<svg\s+(.*?)>/);
|
|
4827
4998
|
if (!match || !match[1]) {
|
|
4828
4999
|
return {};
|
|
4829
5000
|
}
|