@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/sprite.js
CHANGED
|
@@ -597,6 +597,7 @@ var require_object = __commonJS({
|
|
|
597
597
|
deepDiff: () => deepDiff,
|
|
598
598
|
deepMerge: () => deepMerge2,
|
|
599
599
|
deepStringify: () => deepStringify,
|
|
600
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
600
601
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
601
602
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
602
603
|
diff: () => diff,
|
|
@@ -605,6 +606,7 @@ var require_object = __commonJS({
|
|
|
605
606
|
exec: () => exec,
|
|
606
607
|
flattenRecursive: () => flattenRecursive,
|
|
607
608
|
hasOwnProperty: () => hasOwnProperty,
|
|
609
|
+
isCyclic: () => isCyclic,
|
|
608
610
|
isEmpty: () => isEmpty,
|
|
609
611
|
isEmptyObject: () => isEmptyObject,
|
|
610
612
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -630,7 +632,8 @@ var require_object = __commonJS({
|
|
|
630
632
|
var ENV = "development";
|
|
631
633
|
var exec = (param, element, state, context) => {
|
|
632
634
|
if ((0, import_types.isFunction)(param)) {
|
|
633
|
-
return param(
|
|
635
|
+
return param.call(
|
|
636
|
+
element,
|
|
634
637
|
element,
|
|
635
638
|
state || element.state,
|
|
636
639
|
context || element.context
|
|
@@ -729,24 +732,37 @@ var require_object = __commonJS({
|
|
|
729
732
|
}
|
|
730
733
|
return clone2;
|
|
731
734
|
};
|
|
732
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
735
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
736
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
737
|
+
if (visited.has(obj)) {
|
|
738
|
+
return obj;
|
|
739
|
+
}
|
|
740
|
+
visited.add(obj);
|
|
741
|
+
}
|
|
733
742
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
734
743
|
for (const prop in obj) {
|
|
735
744
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
736
745
|
continue;
|
|
737
746
|
const objProp = obj[prop];
|
|
738
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
747
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
739
748
|
continue;
|
|
749
|
+
}
|
|
740
750
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
741
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
751
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
742
752
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
743
753
|
o[prop] = (options.window || import_globals.window).eval("(" + objProp.toString() + ")");
|
|
744
|
-
} else
|
|
754
|
+
} else {
|
|
745
755
|
o[prop] = objProp;
|
|
756
|
+
}
|
|
746
757
|
}
|
|
747
758
|
return o;
|
|
748
759
|
};
|
|
749
760
|
var deepStringify = (obj, stringified = {}) => {
|
|
761
|
+
var _a;
|
|
762
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
763
|
+
console.warn("Trying to clone element or state at", obj);
|
|
764
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
765
|
+
}
|
|
750
766
|
for (const prop in obj) {
|
|
751
767
|
const objProp = obj[prop];
|
|
752
768
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -772,6 +788,39 @@ var require_object = __commonJS({
|
|
|
772
788
|
}
|
|
773
789
|
return stringified;
|
|
774
790
|
};
|
|
791
|
+
var MAX_DEPTH = 100;
|
|
792
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
793
|
+
if (depth > MAX_DEPTH) {
|
|
794
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
795
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
796
|
+
}
|
|
797
|
+
for (const prop in obj) {
|
|
798
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
799
|
+
const objProp = obj[prop];
|
|
800
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
801
|
+
stringified[prop] = objProp.toString();
|
|
802
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
803
|
+
stringified[prop] = {};
|
|
804
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
805
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
806
|
+
stringified[prop] = [];
|
|
807
|
+
objProp.forEach((v, i) => {
|
|
808
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
809
|
+
if ((0, import_types.isObject)(v)) {
|
|
810
|
+
stringified[prop][i] = {};
|
|
811
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
812
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
813
|
+
stringified[prop][i] = v.toString();
|
|
814
|
+
} else {
|
|
815
|
+
stringified[prop][i] = v;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
} else {
|
|
819
|
+
stringified[prop] = objProp;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return stringified;
|
|
823
|
+
};
|
|
775
824
|
var objectToString = (obj = {}, indent = 0) => {
|
|
776
825
|
const spaces = " ".repeat(indent);
|
|
777
826
|
let str = "{\n";
|
|
@@ -1163,6 +1212,25 @@ var require_object = __commonJS({
|
|
|
1163
1212
|
}
|
|
1164
1213
|
}
|
|
1165
1214
|
};
|
|
1215
|
+
var isCyclic = (obj) => {
|
|
1216
|
+
const seenObjects = [];
|
|
1217
|
+
function detect(obj2) {
|
|
1218
|
+
if (obj2 && typeof obj2 === "object") {
|
|
1219
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
1220
|
+
return true;
|
|
1221
|
+
}
|
|
1222
|
+
seenObjects.push(obj2);
|
|
1223
|
+
for (const key in obj2) {
|
|
1224
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
1225
|
+
console.log(obj2, "cycle at " + key);
|
|
1226
|
+
return true;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
return detect(obj);
|
|
1233
|
+
};
|
|
1166
1234
|
}
|
|
1167
1235
|
});
|
|
1168
1236
|
|
|
@@ -1319,6 +1387,7 @@ var require_cookie = __commonJS({
|
|
|
1319
1387
|
__export2(cookie_exports, {
|
|
1320
1388
|
getCookie: () => getCookie,
|
|
1321
1389
|
isMobile: () => isMobile,
|
|
1390
|
+
removeCookie: () => removeCookie,
|
|
1322
1391
|
setCookie: () => setCookie
|
|
1323
1392
|
});
|
|
1324
1393
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
@@ -1348,6 +1417,11 @@ var require_cookie = __commonJS({
|
|
|
1348
1417
|
}
|
|
1349
1418
|
return "";
|
|
1350
1419
|
};
|
|
1420
|
+
var removeCookie = (cname) => {
|
|
1421
|
+
if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
|
|
1422
|
+
return;
|
|
1423
|
+
import_utils3.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1424
|
+
};
|
|
1351
1425
|
}
|
|
1352
1426
|
});
|
|
1353
1427
|
|
|
@@ -1387,10 +1461,13 @@ var require_tags = __commonJS({
|
|
|
1387
1461
|
"title",
|
|
1388
1462
|
"base",
|
|
1389
1463
|
"meta",
|
|
1390
|
-
"style"
|
|
1464
|
+
"style",
|
|
1465
|
+
"noscript",
|
|
1466
|
+
"script"
|
|
1391
1467
|
],
|
|
1392
1468
|
body: [
|
|
1393
1469
|
"string",
|
|
1470
|
+
"style",
|
|
1394
1471
|
"fragment",
|
|
1395
1472
|
"a",
|
|
1396
1473
|
"abbr",
|
|
@@ -1543,6 +1620,7 @@ var require_component = __commonJS({
|
|
|
1543
1620
|
var component_exports = {};
|
|
1544
1621
|
__export2(component_exports, {
|
|
1545
1622
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
1623
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
1546
1624
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
1547
1625
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1548
1626
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -1551,7 +1629,8 @@ var require_component = __commonJS({
|
|
|
1551
1629
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1552
1630
|
getExtendsInElement: () => getExtendsInElement,
|
|
1553
1631
|
hasVariantProp: () => hasVariantProp,
|
|
1554
|
-
isVariant: () => isVariant
|
|
1632
|
+
isVariant: () => isVariant,
|
|
1633
|
+
setContentKey: () => setContentKey
|
|
1555
1634
|
});
|
|
1556
1635
|
module2.exports = __toCommonJS2(component_exports);
|
|
1557
1636
|
var import__ = require_cjs();
|
|
@@ -1577,20 +1656,28 @@ var require_component = __commonJS({
|
|
|
1577
1656
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1578
1657
|
return { ...element, extend };
|
|
1579
1658
|
};
|
|
1659
|
+
var checkIfSugar = (element, parent, key) => {
|
|
1660
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
1661
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1662
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1663
|
+
};
|
|
1580
1664
|
var extendizeByKey = (element, parent, key) => {
|
|
1581
1665
|
const { context } = parent;
|
|
1582
|
-
const { tag, extend,
|
|
1583
|
-
const
|
|
1666
|
+
const { tag, extend, childrenExtends } = element;
|
|
1667
|
+
const isSugar = checkIfSugar(element);
|
|
1584
1668
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1585
1669
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1586
1670
|
if (element === isExtendKeyComponent)
|
|
1587
1671
|
return element;
|
|
1588
|
-
else if (
|
|
1589
|
-
|
|
1672
|
+
else if (isSugar) {
|
|
1673
|
+
const newElem = {
|
|
1590
1674
|
extend: extendFromKey,
|
|
1591
1675
|
tag,
|
|
1592
1676
|
props: { ...element }
|
|
1593
1677
|
};
|
|
1678
|
+
if (childrenExtends)
|
|
1679
|
+
newElem.childExtend = childrenExtends;
|
|
1680
|
+
return newElem;
|
|
1594
1681
|
} else if (!extend || extend === true) {
|
|
1595
1682
|
return {
|
|
1596
1683
|
...element,
|
|
@@ -1607,6 +1694,37 @@ var require_component = __commonJS({
|
|
|
1607
1694
|
};
|
|
1608
1695
|
}
|
|
1609
1696
|
};
|
|
1697
|
+
function getCapitalCaseKeys(obj) {
|
|
1698
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
1699
|
+
}
|
|
1700
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
1701
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
1702
|
+
if (!childElems.length)
|
|
1703
|
+
return element;
|
|
1704
|
+
for (const i in childElems) {
|
|
1705
|
+
const childKey = childElems[i];
|
|
1706
|
+
const childElem = element[childKey];
|
|
1707
|
+
const newChild = element.props[childKey];
|
|
1708
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1709
|
+
continue;
|
|
1710
|
+
if (!childElem)
|
|
1711
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
1712
|
+
else {
|
|
1713
|
+
const isSugar = checkIfSugar(childElem);
|
|
1714
|
+
if (!isSugar)
|
|
1715
|
+
continue;
|
|
1716
|
+
const inheritedChildElem = element[childKey].props;
|
|
1717
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
1718
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
1719
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
1720
|
+
element[childKey] = {
|
|
1721
|
+
extend: element[childKey],
|
|
1722
|
+
props: newChild
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1610
1728
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1611
1729
|
return extendizeByKey(element, parent, key) || element;
|
|
1612
1730
|
};
|
|
@@ -1682,6 +1800,17 @@ var require_component = __commonJS({
|
|
|
1682
1800
|
traverse(obj);
|
|
1683
1801
|
return result;
|
|
1684
1802
|
};
|
|
1803
|
+
var setContentKey = (el, opts = {}) => {
|
|
1804
|
+
const { __ref: ref } = el;
|
|
1805
|
+
const contentElementKey = opts.contentElementKey;
|
|
1806
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
1807
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
1808
|
+
} else
|
|
1809
|
+
ref.contentElementKey = "content";
|
|
1810
|
+
if (contentElementKey !== "content")
|
|
1811
|
+
opts.contentElementKey = "content";
|
|
1812
|
+
return ref.contentElementKey;
|
|
1813
|
+
};
|
|
1685
1814
|
}
|
|
1686
1815
|
});
|
|
1687
1816
|
|