@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
|
@@ -616,6 +616,7 @@ var require_cjs = __commonJS({
|
|
|
616
616
|
deepDiff: () => deepDiff,
|
|
617
617
|
deepMerge: () => deepMerge2,
|
|
618
618
|
deepStringify: () => deepStringify,
|
|
619
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
619
620
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
620
621
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
621
622
|
diff: () => diff,
|
|
@@ -649,7 +650,8 @@ var require_cjs = __commonJS({
|
|
|
649
650
|
var ENV = "development";
|
|
650
651
|
var exec = (param, element, state, context) => {
|
|
651
652
|
if ((0, import_types.isFunction)(param)) {
|
|
652
|
-
return param(
|
|
653
|
+
return param.call(
|
|
654
|
+
element,
|
|
653
655
|
element,
|
|
654
656
|
state || element.state,
|
|
655
657
|
context || element.context
|
|
@@ -766,6 +768,11 @@ var require_cjs = __commonJS({
|
|
|
766
768
|
return o;
|
|
767
769
|
};
|
|
768
770
|
var deepStringify = (obj, stringified = {}) => {
|
|
771
|
+
var _a;
|
|
772
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
773
|
+
console.warn("Trying to clone element or state at", obj);
|
|
774
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
775
|
+
}
|
|
769
776
|
for (const prop in obj) {
|
|
770
777
|
const objProp = obj[prop];
|
|
771
778
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -791,6 +798,39 @@ var require_cjs = __commonJS({
|
|
|
791
798
|
}
|
|
792
799
|
return stringified;
|
|
793
800
|
};
|
|
801
|
+
var MAX_DEPTH = 100;
|
|
802
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
803
|
+
if (depth > MAX_DEPTH) {
|
|
804
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
805
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
806
|
+
}
|
|
807
|
+
for (const prop in obj) {
|
|
808
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
809
|
+
const objProp = obj[prop];
|
|
810
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
811
|
+
stringified[prop] = objProp.toString();
|
|
812
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
813
|
+
stringified[prop] = {};
|
|
814
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
815
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
816
|
+
stringified[prop] = [];
|
|
817
|
+
objProp.forEach((v, i) => {
|
|
818
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
819
|
+
if ((0, import_types.isObject)(v)) {
|
|
820
|
+
stringified[prop][i] = {};
|
|
821
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
822
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
823
|
+
stringified[prop][i] = v.toString();
|
|
824
|
+
} else {
|
|
825
|
+
stringified[prop][i] = v;
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
} else {
|
|
829
|
+
stringified[prop] = objProp;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return stringified;
|
|
833
|
+
};
|
|
794
834
|
var objectToString = (obj = {}, indent = 0) => {
|
|
795
835
|
const spaces = " ".repeat(indent);
|
|
796
836
|
let str = "{\n";
|
|
@@ -1332,6 +1372,7 @@ var require_cjs = __commonJS({
|
|
|
1332
1372
|
__export22(cookie_exports, {
|
|
1333
1373
|
getCookie: () => getCookie,
|
|
1334
1374
|
isMobile: () => isMobile,
|
|
1375
|
+
removeCookie: () => removeCookie,
|
|
1335
1376
|
setCookie: () => setCookie
|
|
1336
1377
|
});
|
|
1337
1378
|
module22.exports = __toCommonJS22(cookie_exports);
|
|
@@ -1361,6 +1402,11 @@ var require_cjs = __commonJS({
|
|
|
1361
1402
|
}
|
|
1362
1403
|
return "";
|
|
1363
1404
|
};
|
|
1405
|
+
var removeCookie = (cname) => {
|
|
1406
|
+
if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
|
|
1407
|
+
return;
|
|
1408
|
+
import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1409
|
+
};
|
|
1364
1410
|
}
|
|
1365
1411
|
});
|
|
1366
1412
|
var require_tags2 = __commonJS2({
|
|
@@ -1398,10 +1444,13 @@ var require_cjs = __commonJS({
|
|
|
1398
1444
|
"title",
|
|
1399
1445
|
"base",
|
|
1400
1446
|
"meta",
|
|
1401
|
-
"style"
|
|
1447
|
+
"style",
|
|
1448
|
+
"noscript",
|
|
1449
|
+
"script"
|
|
1402
1450
|
],
|
|
1403
1451
|
body: [
|
|
1404
1452
|
"string",
|
|
1453
|
+
"style",
|
|
1405
1454
|
"fragment",
|
|
1406
1455
|
"a",
|
|
1407
1456
|
"abbr",
|
|
@@ -1552,6 +1601,7 @@ var require_cjs = __commonJS({
|
|
|
1552
1601
|
var component_exports = {};
|
|
1553
1602
|
__export22(component_exports, {
|
|
1554
1603
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
1604
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
1555
1605
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
1556
1606
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1557
1607
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -1560,7 +1610,8 @@ var require_cjs = __commonJS({
|
|
|
1560
1610
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1561
1611
|
getExtendsInElement: () => getExtendsInElement,
|
|
1562
1612
|
hasVariantProp: () => hasVariantProp,
|
|
1563
|
-
isVariant: () => isVariant
|
|
1613
|
+
isVariant: () => isVariant,
|
|
1614
|
+
setContentKey: () => setContentKey
|
|
1564
1615
|
});
|
|
1565
1616
|
module22.exports = __toCommonJS22(component_exports);
|
|
1566
1617
|
var import__ = require_cjs4();
|
|
@@ -1586,20 +1637,28 @@ var require_cjs = __commonJS({
|
|
|
1586
1637
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1587
1638
|
return { ...element, extend };
|
|
1588
1639
|
};
|
|
1640
|
+
var checkIfSugar = (element, parent, key) => {
|
|
1641
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
1642
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1643
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1644
|
+
};
|
|
1589
1645
|
var extendizeByKey = (element, parent, key) => {
|
|
1590
1646
|
const { context } = parent;
|
|
1591
|
-
const { tag, extend,
|
|
1592
|
-
const
|
|
1647
|
+
const { tag, extend, childrenExtends } = element;
|
|
1648
|
+
const isSugar = checkIfSugar(element);
|
|
1593
1649
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1594
1650
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1595
1651
|
if (element === isExtendKeyComponent)
|
|
1596
1652
|
return element;
|
|
1597
|
-
else if (
|
|
1598
|
-
|
|
1653
|
+
else if (isSugar) {
|
|
1654
|
+
const newElem = {
|
|
1599
1655
|
extend: extendFromKey,
|
|
1600
1656
|
tag,
|
|
1601
1657
|
props: { ...element }
|
|
1602
1658
|
};
|
|
1659
|
+
if (childrenExtends)
|
|
1660
|
+
newElem.childExtend = childrenExtends;
|
|
1661
|
+
return newElem;
|
|
1603
1662
|
} else if (!extend || extend === true) {
|
|
1604
1663
|
return {
|
|
1605
1664
|
...element,
|
|
@@ -1616,6 +1675,37 @@ var require_cjs = __commonJS({
|
|
|
1616
1675
|
};
|
|
1617
1676
|
}
|
|
1618
1677
|
};
|
|
1678
|
+
function getCapitalCaseKeys(obj) {
|
|
1679
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
1680
|
+
}
|
|
1681
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
1682
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
1683
|
+
if (!childElems.length)
|
|
1684
|
+
return element;
|
|
1685
|
+
for (const i in childElems) {
|
|
1686
|
+
const childKey = childElems[i];
|
|
1687
|
+
const childElem = element[childKey];
|
|
1688
|
+
const newChild = element.props[childKey];
|
|
1689
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1690
|
+
continue;
|
|
1691
|
+
if (!childElem)
|
|
1692
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
1693
|
+
else {
|
|
1694
|
+
const isSugar = checkIfSugar(childElem);
|
|
1695
|
+
if (!isSugar)
|
|
1696
|
+
continue;
|
|
1697
|
+
const inheritedChildElem = element[childKey].props;
|
|
1698
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
1699
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
1700
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
1701
|
+
element[childKey] = {
|
|
1702
|
+
extend: element[childKey],
|
|
1703
|
+
props: newChild
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1619
1709
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1620
1710
|
return extendizeByKey(element, parent, key) || element;
|
|
1621
1711
|
};
|
|
@@ -1691,6 +1781,17 @@ var require_cjs = __commonJS({
|
|
|
1691
1781
|
traverse(obj);
|
|
1692
1782
|
return result;
|
|
1693
1783
|
};
|
|
1784
|
+
var setContentKey = (el, opts = {}) => {
|
|
1785
|
+
const { __ref: ref } = el;
|
|
1786
|
+
const contentElementKey = opts.contentElementKey;
|
|
1787
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
1788
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
1789
|
+
} else
|
|
1790
|
+
ref.contentElementKey = "content";
|
|
1791
|
+
if (contentElementKey !== "content")
|
|
1792
|
+
opts.contentElementKey = "content";
|
|
1793
|
+
return ref.contentElementKey;
|
|
1794
|
+
};
|
|
1694
1795
|
}
|
|
1695
1796
|
});
|
|
1696
1797
|
var require_cjs4 = __commonJS2({
|
|
@@ -2505,6 +2606,7 @@ var require_object = __commonJS({
|
|
|
2505
2606
|
deepDiff: () => deepDiff,
|
|
2506
2607
|
deepMerge: () => deepMerge2,
|
|
2507
2608
|
deepStringify: () => deepStringify,
|
|
2609
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
2508
2610
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
2509
2611
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
2510
2612
|
diff: () => diff,
|
|
@@ -2513,6 +2615,7 @@ var require_object = __commonJS({
|
|
|
2513
2615
|
exec: () => exec,
|
|
2514
2616
|
flattenRecursive: () => flattenRecursive,
|
|
2515
2617
|
hasOwnProperty: () => hasOwnProperty,
|
|
2618
|
+
isCyclic: () => isCyclic,
|
|
2516
2619
|
isEmpty: () => isEmpty,
|
|
2517
2620
|
isEmptyObject: () => isEmptyObject,
|
|
2518
2621
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -2538,7 +2641,8 @@ var require_object = __commonJS({
|
|
|
2538
2641
|
var ENV = "development";
|
|
2539
2642
|
var exec = (param, element, state, context) => {
|
|
2540
2643
|
if ((0, import_types.isFunction)(param)) {
|
|
2541
|
-
return param(
|
|
2644
|
+
return param.call(
|
|
2645
|
+
element,
|
|
2542
2646
|
element,
|
|
2543
2647
|
state || element.state,
|
|
2544
2648
|
context || element.context
|
|
@@ -2637,24 +2741,37 @@ var require_object = __commonJS({
|
|
|
2637
2741
|
}
|
|
2638
2742
|
return clone2;
|
|
2639
2743
|
};
|
|
2640
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2744
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
2745
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
2746
|
+
if (visited.has(obj)) {
|
|
2747
|
+
return obj;
|
|
2748
|
+
}
|
|
2749
|
+
visited.add(obj);
|
|
2750
|
+
}
|
|
2641
2751
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
2642
2752
|
for (const prop in obj) {
|
|
2643
2753
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2644
2754
|
continue;
|
|
2645
2755
|
const objProp = obj[prop];
|
|
2646
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
2756
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
2647
2757
|
continue;
|
|
2758
|
+
}
|
|
2648
2759
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2649
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2760
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
2650
2761
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2651
2762
|
o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
|
|
2652
|
-
} else
|
|
2763
|
+
} else {
|
|
2653
2764
|
o[prop] = objProp;
|
|
2765
|
+
}
|
|
2654
2766
|
}
|
|
2655
2767
|
return o;
|
|
2656
2768
|
};
|
|
2657
2769
|
var deepStringify = (obj, stringified = {}) => {
|
|
2770
|
+
var _a;
|
|
2771
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
2772
|
+
console.warn("Trying to clone element or state at", obj);
|
|
2773
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
2774
|
+
}
|
|
2658
2775
|
for (const prop in obj) {
|
|
2659
2776
|
const objProp = obj[prop];
|
|
2660
2777
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -2680,6 +2797,39 @@ var require_object = __commonJS({
|
|
|
2680
2797
|
}
|
|
2681
2798
|
return stringified;
|
|
2682
2799
|
};
|
|
2800
|
+
var MAX_DEPTH = 100;
|
|
2801
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
2802
|
+
if (depth > MAX_DEPTH) {
|
|
2803
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
2804
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
2805
|
+
}
|
|
2806
|
+
for (const prop in obj) {
|
|
2807
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
2808
|
+
const objProp = obj[prop];
|
|
2809
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
2810
|
+
stringified[prop] = objProp.toString();
|
|
2811
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
2812
|
+
stringified[prop] = {};
|
|
2813
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
2814
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
2815
|
+
stringified[prop] = [];
|
|
2816
|
+
objProp.forEach((v, i) => {
|
|
2817
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
2818
|
+
if ((0, import_types.isObject)(v)) {
|
|
2819
|
+
stringified[prop][i] = {};
|
|
2820
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
2821
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
2822
|
+
stringified[prop][i] = v.toString();
|
|
2823
|
+
} else {
|
|
2824
|
+
stringified[prop][i] = v;
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
} else {
|
|
2828
|
+
stringified[prop] = objProp;
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
return stringified;
|
|
2832
|
+
};
|
|
2683
2833
|
var objectToString = (obj = {}, indent = 0) => {
|
|
2684
2834
|
const spaces = " ".repeat(indent);
|
|
2685
2835
|
let str = "{\n";
|
|
@@ -3071,6 +3221,25 @@ var require_object = __commonJS({
|
|
|
3071
3221
|
}
|
|
3072
3222
|
}
|
|
3073
3223
|
};
|
|
3224
|
+
var isCyclic = (obj) => {
|
|
3225
|
+
const seenObjects = [];
|
|
3226
|
+
function detect(obj2) {
|
|
3227
|
+
if (obj2 && typeof obj2 === "object") {
|
|
3228
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
3229
|
+
return true;
|
|
3230
|
+
}
|
|
3231
|
+
seenObjects.push(obj2);
|
|
3232
|
+
for (const key in obj2) {
|
|
3233
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
3234
|
+
console.log(obj2, "cycle at " + key);
|
|
3235
|
+
return true;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
return false;
|
|
3240
|
+
}
|
|
3241
|
+
return detect(obj);
|
|
3242
|
+
};
|
|
3074
3243
|
}
|
|
3075
3244
|
});
|
|
3076
3245
|
|
|
@@ -3227,6 +3396,7 @@ var require_cookie = __commonJS({
|
|
|
3227
3396
|
__export2(cookie_exports, {
|
|
3228
3397
|
getCookie: () => getCookie,
|
|
3229
3398
|
isMobile: () => isMobile,
|
|
3399
|
+
removeCookie: () => removeCookie,
|
|
3230
3400
|
setCookie: () => setCookie
|
|
3231
3401
|
});
|
|
3232
3402
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
@@ -3256,6 +3426,11 @@ var require_cookie = __commonJS({
|
|
|
3256
3426
|
}
|
|
3257
3427
|
return "";
|
|
3258
3428
|
};
|
|
3429
|
+
var removeCookie = (cname) => {
|
|
3430
|
+
if ((0, import_types.isUndefined)(import_utils9.document) || (0, import_types.isUndefined)(import_utils9.document.cookie))
|
|
3431
|
+
return;
|
|
3432
|
+
import_utils9.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
3433
|
+
};
|
|
3259
3434
|
}
|
|
3260
3435
|
});
|
|
3261
3436
|
|
|
@@ -3295,10 +3470,13 @@ var require_tags = __commonJS({
|
|
|
3295
3470
|
"title",
|
|
3296
3471
|
"base",
|
|
3297
3472
|
"meta",
|
|
3298
|
-
"style"
|
|
3473
|
+
"style",
|
|
3474
|
+
"noscript",
|
|
3475
|
+
"script"
|
|
3299
3476
|
],
|
|
3300
3477
|
body: [
|
|
3301
3478
|
"string",
|
|
3479
|
+
"style",
|
|
3302
3480
|
"fragment",
|
|
3303
3481
|
"a",
|
|
3304
3482
|
"abbr",
|
|
@@ -3451,6 +3629,7 @@ var require_component = __commonJS({
|
|
|
3451
3629
|
var component_exports = {};
|
|
3452
3630
|
__export2(component_exports, {
|
|
3453
3631
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
3632
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
3454
3633
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
3455
3634
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3456
3635
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -3459,7 +3638,8 @@ var require_component = __commonJS({
|
|
|
3459
3638
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3460
3639
|
getExtendsInElement: () => getExtendsInElement,
|
|
3461
3640
|
hasVariantProp: () => hasVariantProp,
|
|
3462
|
-
isVariant: () => isVariant
|
|
3641
|
+
isVariant: () => isVariant,
|
|
3642
|
+
setContentKey: () => setContentKey
|
|
3463
3643
|
});
|
|
3464
3644
|
module2.exports = __toCommonJS2(component_exports);
|
|
3465
3645
|
var import__ = require_cjs2();
|
|
@@ -3485,20 +3665,28 @@ var require_component = __commonJS({
|
|
|
3485
3665
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
3486
3666
|
return { ...element, extend };
|
|
3487
3667
|
};
|
|
3668
|
+
var checkIfSugar = (element, parent, key) => {
|
|
3669
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
3670
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3671
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
3672
|
+
};
|
|
3488
3673
|
var extendizeByKey = (element, parent, key) => {
|
|
3489
3674
|
const { context } = parent;
|
|
3490
|
-
const { tag, extend,
|
|
3491
|
-
const
|
|
3675
|
+
const { tag, extend, childrenExtends } = element;
|
|
3676
|
+
const isSugar = checkIfSugar(element);
|
|
3492
3677
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3493
3678
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3494
3679
|
if (element === isExtendKeyComponent)
|
|
3495
3680
|
return element;
|
|
3496
|
-
else if (
|
|
3497
|
-
|
|
3681
|
+
else if (isSugar) {
|
|
3682
|
+
const newElem = {
|
|
3498
3683
|
extend: extendFromKey,
|
|
3499
3684
|
tag,
|
|
3500
3685
|
props: { ...element }
|
|
3501
3686
|
};
|
|
3687
|
+
if (childrenExtends)
|
|
3688
|
+
newElem.childExtend = childrenExtends;
|
|
3689
|
+
return newElem;
|
|
3502
3690
|
} else if (!extend || extend === true) {
|
|
3503
3691
|
return {
|
|
3504
3692
|
...element,
|
|
@@ -3515,6 +3703,37 @@ var require_component = __commonJS({
|
|
|
3515
3703
|
};
|
|
3516
3704
|
}
|
|
3517
3705
|
};
|
|
3706
|
+
function getCapitalCaseKeys(obj) {
|
|
3707
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
3708
|
+
}
|
|
3709
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
3710
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
3711
|
+
if (!childElems.length)
|
|
3712
|
+
return element;
|
|
3713
|
+
for (const i in childElems) {
|
|
3714
|
+
const childKey = childElems[i];
|
|
3715
|
+
const childElem = element[childKey];
|
|
3716
|
+
const newChild = element.props[childKey];
|
|
3717
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
3718
|
+
continue;
|
|
3719
|
+
if (!childElem)
|
|
3720
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
3721
|
+
else {
|
|
3722
|
+
const isSugar = checkIfSugar(childElem);
|
|
3723
|
+
if (!isSugar)
|
|
3724
|
+
continue;
|
|
3725
|
+
const inheritedChildElem = element[childKey].props;
|
|
3726
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
3727
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
3728
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
3729
|
+
element[childKey] = {
|
|
3730
|
+
extend: element[childKey],
|
|
3731
|
+
props: newChild
|
|
3732
|
+
};
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
};
|
|
3518
3737
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
3519
3738
|
return extendizeByKey(element, parent, key) || element;
|
|
3520
3739
|
};
|
|
@@ -3590,6 +3809,17 @@ var require_component = __commonJS({
|
|
|
3590
3809
|
traverse(obj);
|
|
3591
3810
|
return result;
|
|
3592
3811
|
};
|
|
3812
|
+
var setContentKey = (el, opts = {}) => {
|
|
3813
|
+
const { __ref: ref } = el;
|
|
3814
|
+
const contentElementKey = opts.contentElementKey;
|
|
3815
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
3816
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
3817
|
+
} else
|
|
3818
|
+
ref.contentElementKey = "content";
|
|
3819
|
+
if (contentElementKey !== "content")
|
|
3820
|
+
opts.contentElementKey = "content";
|
|
3821
|
+
return ref.contentElementKey;
|
|
3822
|
+
};
|
|
3593
3823
|
}
|
|
3594
3824
|
});
|
|
3595
3825
|
|