@symbo.ls/scratch 2.11.442 → 2.11.450
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 +140 -11
- package/dist/cjs/index.js +248 -18
- package/dist/cjs/set.js +248 -18
- package/dist/cjs/system/color.js +248 -18
- package/dist/cjs/system/document.js +248 -18
- package/dist/cjs/system/font.js +248 -18
- package/dist/cjs/system/index.js +248 -18
- package/dist/cjs/system/reset.js +248 -18
- package/dist/cjs/system/shadow.js +248 -18
- package/dist/cjs/system/spacing.js +248 -18
- package/dist/cjs/system/svg.js +248 -18
- package/dist/cjs/system/theme.js +248 -18
- package/dist/cjs/system/timing.js +248 -18
- package/dist/cjs/system/typography.js +248 -18
- package/dist/cjs/transforms/index.js +248 -18
- package/dist/cjs/utils/color.js +140 -11
- package/dist/cjs/utils/index.js +248 -18
- package/dist/cjs/utils/sequence.js +248 -18
- package/dist/cjs/utils/sprite.js +140 -11
- package/dist/cjs/utils/var.js +248 -18
- package/package.json +4 -4
package/dist/cjs/utils/color.js
CHANGED
|
@@ -633,6 +633,7 @@ var require_object = __commonJS({
|
|
|
633
633
|
deepDiff: () => deepDiff,
|
|
634
634
|
deepMerge: () => deepMerge,
|
|
635
635
|
deepStringify: () => deepStringify,
|
|
636
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
636
637
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
637
638
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
638
639
|
diff: () => diff,
|
|
@@ -641,6 +642,7 @@ var require_object = __commonJS({
|
|
|
641
642
|
exec: () => exec,
|
|
642
643
|
flattenRecursive: () => flattenRecursive,
|
|
643
644
|
hasOwnProperty: () => hasOwnProperty,
|
|
645
|
+
isCyclic: () => isCyclic,
|
|
644
646
|
isEmpty: () => isEmpty,
|
|
645
647
|
isEmptyObject: () => isEmptyObject,
|
|
646
648
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -666,7 +668,8 @@ var require_object = __commonJS({
|
|
|
666
668
|
var ENV2 = "development";
|
|
667
669
|
var exec = (param, element, state, context) => {
|
|
668
670
|
if ((0, import_types.isFunction)(param)) {
|
|
669
|
-
return param(
|
|
671
|
+
return param.call(
|
|
672
|
+
element,
|
|
670
673
|
element,
|
|
671
674
|
state || element.state,
|
|
672
675
|
context || element.context
|
|
@@ -765,24 +768,37 @@ var require_object = __commonJS({
|
|
|
765
768
|
}
|
|
766
769
|
return clone2;
|
|
767
770
|
};
|
|
768
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
771
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
772
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
773
|
+
if (visited.has(obj)) {
|
|
774
|
+
return obj;
|
|
775
|
+
}
|
|
776
|
+
visited.add(obj);
|
|
777
|
+
}
|
|
769
778
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
770
779
|
for (const prop in obj) {
|
|
771
780
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
772
781
|
continue;
|
|
773
782
|
const objProp = obj[prop];
|
|
774
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
783
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
775
784
|
continue;
|
|
785
|
+
}
|
|
776
786
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
777
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
787
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
778
788
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
779
789
|
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
780
|
-
} else
|
|
790
|
+
} else {
|
|
781
791
|
o[prop] = objProp;
|
|
792
|
+
}
|
|
782
793
|
}
|
|
783
794
|
return o;
|
|
784
795
|
};
|
|
785
796
|
var deepStringify = (obj, stringified = {}) => {
|
|
797
|
+
var _a;
|
|
798
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
799
|
+
console.warn("Trying to clone element or state at", obj);
|
|
800
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
801
|
+
}
|
|
786
802
|
for (const prop in obj) {
|
|
787
803
|
const objProp = obj[prop];
|
|
788
804
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -808,6 +824,39 @@ var require_object = __commonJS({
|
|
|
808
824
|
}
|
|
809
825
|
return stringified;
|
|
810
826
|
};
|
|
827
|
+
var MAX_DEPTH = 100;
|
|
828
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
829
|
+
if (depth > MAX_DEPTH) {
|
|
830
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
831
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
832
|
+
}
|
|
833
|
+
for (const prop in obj) {
|
|
834
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
835
|
+
const objProp = obj[prop];
|
|
836
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
837
|
+
stringified[prop] = objProp.toString();
|
|
838
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
839
|
+
stringified[prop] = {};
|
|
840
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
841
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
842
|
+
stringified[prop] = [];
|
|
843
|
+
objProp.forEach((v, i) => {
|
|
844
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
845
|
+
if ((0, import_types.isObject)(v)) {
|
|
846
|
+
stringified[prop][i] = {};
|
|
847
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
848
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
849
|
+
stringified[prop][i] = v.toString();
|
|
850
|
+
} else {
|
|
851
|
+
stringified[prop][i] = v;
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
} else {
|
|
855
|
+
stringified[prop] = objProp;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return stringified;
|
|
859
|
+
};
|
|
811
860
|
var objectToString = (obj = {}, indent = 0) => {
|
|
812
861
|
const spaces = " ".repeat(indent);
|
|
813
862
|
let str = "{\n";
|
|
@@ -1199,6 +1248,25 @@ var require_object = __commonJS({
|
|
|
1199
1248
|
}
|
|
1200
1249
|
}
|
|
1201
1250
|
};
|
|
1251
|
+
var isCyclic = (obj) => {
|
|
1252
|
+
const seenObjects = [];
|
|
1253
|
+
function detect(obj2) {
|
|
1254
|
+
if (obj2 && typeof obj2 === "object") {
|
|
1255
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
1256
|
+
return true;
|
|
1257
|
+
}
|
|
1258
|
+
seenObjects.push(obj2);
|
|
1259
|
+
for (const key in obj2) {
|
|
1260
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
1261
|
+
console.log(obj2, "cycle at " + key);
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
return detect(obj);
|
|
1269
|
+
};
|
|
1202
1270
|
}
|
|
1203
1271
|
});
|
|
1204
1272
|
|
|
@@ -1355,6 +1423,7 @@ var require_cookie = __commonJS({
|
|
|
1355
1423
|
__export2(cookie_exports, {
|
|
1356
1424
|
getCookie: () => getCookie,
|
|
1357
1425
|
isMobile: () => isMobile,
|
|
1426
|
+
removeCookie: () => removeCookie,
|
|
1358
1427
|
setCookie: () => setCookie
|
|
1359
1428
|
});
|
|
1360
1429
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
@@ -1384,6 +1453,11 @@ var require_cookie = __commonJS({
|
|
|
1384
1453
|
}
|
|
1385
1454
|
return "";
|
|
1386
1455
|
};
|
|
1456
|
+
var removeCookie = (cname) => {
|
|
1457
|
+
if ((0, import_types.isUndefined)(import_utils2.document) || (0, import_types.isUndefined)(import_utils2.document.cookie))
|
|
1458
|
+
return;
|
|
1459
|
+
import_utils2.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1460
|
+
};
|
|
1387
1461
|
}
|
|
1388
1462
|
});
|
|
1389
1463
|
|
|
@@ -1423,10 +1497,13 @@ var require_tags = __commonJS({
|
|
|
1423
1497
|
"title",
|
|
1424
1498
|
"base",
|
|
1425
1499
|
"meta",
|
|
1426
|
-
"style"
|
|
1500
|
+
"style",
|
|
1501
|
+
"noscript",
|
|
1502
|
+
"script"
|
|
1427
1503
|
],
|
|
1428
1504
|
body: [
|
|
1429
1505
|
"string",
|
|
1506
|
+
"style",
|
|
1430
1507
|
"fragment",
|
|
1431
1508
|
"a",
|
|
1432
1509
|
"abbr",
|
|
@@ -1579,6 +1656,7 @@ var require_component = __commonJS({
|
|
|
1579
1656
|
var component_exports = {};
|
|
1580
1657
|
__export2(component_exports, {
|
|
1581
1658
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
1659
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
1582
1660
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
1583
1661
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1584
1662
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -1587,7 +1665,8 @@ var require_component = __commonJS({
|
|
|
1587
1665
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1588
1666
|
getExtendsInElement: () => getExtendsInElement,
|
|
1589
1667
|
hasVariantProp: () => hasVariantProp,
|
|
1590
|
-
isVariant: () => isVariant
|
|
1668
|
+
isVariant: () => isVariant,
|
|
1669
|
+
setContentKey: () => setContentKey
|
|
1591
1670
|
});
|
|
1592
1671
|
module2.exports = __toCommonJS2(component_exports);
|
|
1593
1672
|
var import__ = require_cjs2();
|
|
@@ -1613,20 +1692,28 @@ var require_component = __commonJS({
|
|
|
1613
1692
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1614
1693
|
return { ...element, extend };
|
|
1615
1694
|
};
|
|
1695
|
+
var checkIfSugar = (element, parent, key) => {
|
|
1696
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
1697
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1698
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1699
|
+
};
|
|
1616
1700
|
var extendizeByKey = (element, parent, key) => {
|
|
1617
1701
|
const { context } = parent;
|
|
1618
|
-
const { tag, extend,
|
|
1619
|
-
const
|
|
1702
|
+
const { tag, extend, childrenExtends } = element;
|
|
1703
|
+
const isSugar = checkIfSugar(element);
|
|
1620
1704
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1621
1705
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1622
1706
|
if (element === isExtendKeyComponent)
|
|
1623
1707
|
return element;
|
|
1624
|
-
else if (
|
|
1625
|
-
|
|
1708
|
+
else if (isSugar) {
|
|
1709
|
+
const newElem = {
|
|
1626
1710
|
extend: extendFromKey,
|
|
1627
1711
|
tag,
|
|
1628
1712
|
props: { ...element }
|
|
1629
1713
|
};
|
|
1714
|
+
if (childrenExtends)
|
|
1715
|
+
newElem.childExtend = childrenExtends;
|
|
1716
|
+
return newElem;
|
|
1630
1717
|
} else if (!extend || extend === true) {
|
|
1631
1718
|
return {
|
|
1632
1719
|
...element,
|
|
@@ -1643,6 +1730,37 @@ var require_component = __commonJS({
|
|
|
1643
1730
|
};
|
|
1644
1731
|
}
|
|
1645
1732
|
};
|
|
1733
|
+
function getCapitalCaseKeys(obj) {
|
|
1734
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
1735
|
+
}
|
|
1736
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
1737
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
1738
|
+
if (!childElems.length)
|
|
1739
|
+
return element;
|
|
1740
|
+
for (const i in childElems) {
|
|
1741
|
+
const childKey = childElems[i];
|
|
1742
|
+
const childElem = element[childKey];
|
|
1743
|
+
const newChild = element.props[childKey];
|
|
1744
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1745
|
+
continue;
|
|
1746
|
+
if (!childElem)
|
|
1747
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
1748
|
+
else {
|
|
1749
|
+
const isSugar = checkIfSugar(childElem);
|
|
1750
|
+
if (!isSugar)
|
|
1751
|
+
continue;
|
|
1752
|
+
const inheritedChildElem = element[childKey].props;
|
|
1753
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
1754
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
1755
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
1756
|
+
element[childKey] = {
|
|
1757
|
+
extend: element[childKey],
|
|
1758
|
+
props: newChild
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1646
1764
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1647
1765
|
return extendizeByKey(element, parent, key) || element;
|
|
1648
1766
|
};
|
|
@@ -1718,6 +1836,17 @@ var require_component = __commonJS({
|
|
|
1718
1836
|
traverse(obj);
|
|
1719
1837
|
return result;
|
|
1720
1838
|
};
|
|
1839
|
+
var setContentKey = (el, opts = {}) => {
|
|
1840
|
+
const { __ref: ref } = el;
|
|
1841
|
+
const contentElementKey = opts.contentElementKey;
|
|
1842
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
1843
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
1844
|
+
} else
|
|
1845
|
+
ref.contentElementKey = "content";
|
|
1846
|
+
if (contentElementKey !== "content")
|
|
1847
|
+
opts.contentElementKey = "content";
|
|
1848
|
+
return ref.contentElementKey;
|
|
1849
|
+
};
|
|
1721
1850
|
}
|
|
1722
1851
|
});
|
|
1723
1852
|
|