@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/utils/sprite.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_globals.window.eval("(" + str + ")");
|
|
943
|
+
return str ? import_globals.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_utils3.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
|
};
|
|
@@ -2067,7 +2138,7 @@ var CONFIG = {
|
|
|
2067
2138
|
useVariable: true,
|
|
2068
2139
|
useReset: true,
|
|
2069
2140
|
CSS_VARS,
|
|
2070
|
-
...defaultConfig_exports
|
|
2141
|
+
...void 0 || defaultConfig_exports
|
|
2071
2142
|
};
|
|
2072
2143
|
var cachedConfig = (0, import_utils.deepClone)(CONFIG);
|
|
2073
2144
|
var FACTORY = {
|
|
@@ -2092,10 +2163,11 @@ var generateSprite = (icons) => {
|
|
|
2092
2163
|
return sprite;
|
|
2093
2164
|
};
|
|
2094
2165
|
var parseRootAttributes = (htmlString) => {
|
|
2095
|
-
|
|
2096
|
-
|
|
2166
|
+
const val = htmlString.default || htmlString;
|
|
2167
|
+
if (!(0, import_utils2.isString)(val)) {
|
|
2168
|
+
return console.warn(`parseRootAttributes: ${val} is not a string`);
|
|
2097
2169
|
}
|
|
2098
|
-
const match =
|
|
2170
|
+
const match = val.match(/<svg\s+(.*?)>/);
|
|
2099
2171
|
if (!match || !match[1]) {
|
|
2100
2172
|
return {};
|
|
2101
2173
|
}
|