@symbo.ls/scratch 2.11.442 → 2.11.446
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 +108 -7
- package/dist/cjs/index.js +216 -14
- package/dist/cjs/set.js +216 -14
- package/dist/cjs/system/color.js +216 -14
- package/dist/cjs/system/document.js +216 -14
- package/dist/cjs/system/font.js +216 -14
- package/dist/cjs/system/index.js +216 -14
- package/dist/cjs/system/reset.js +216 -14
- package/dist/cjs/system/shadow.js +216 -14
- package/dist/cjs/system/spacing.js +216 -14
- package/dist/cjs/system/svg.js +216 -14
- package/dist/cjs/system/theme.js +216 -14
- package/dist/cjs/system/timing.js +216 -14
- package/dist/cjs/system/typography.js +216 -14
- package/dist/cjs/transforms/index.js +216 -14
- package/dist/cjs/utils/color.js +108 -7
- package/dist/cjs/utils/index.js +216 -14
- package/dist/cjs/utils/sequence.js +216 -14
- package/dist/cjs/utils/sprite.js +108 -7
- package/dist/cjs/utils/var.js +216 -14
- package/package.json +5 -5
|
@@ -597,6 +597,7 @@ var require_object = __commonJS({
|
|
|
597
597
|
deepDiff: () => deepDiff,
|
|
598
598
|
deepMerge: () => deepMerge3,
|
|
599
599
|
deepStringify: () => deepStringify,
|
|
600
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
600
601
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
601
602
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
602
603
|
diff: () => diff,
|
|
@@ -630,7 +631,8 @@ var require_object = __commonJS({
|
|
|
630
631
|
var ENV = "development";
|
|
631
632
|
var exec = (param, element, state, context) => {
|
|
632
633
|
if ((0, import_types.isFunction)(param)) {
|
|
633
|
-
return param(
|
|
634
|
+
return param.call(
|
|
635
|
+
element,
|
|
634
636
|
element,
|
|
635
637
|
state || element.state,
|
|
636
638
|
context || element.context
|
|
@@ -747,6 +749,11 @@ var require_object = __commonJS({
|
|
|
747
749
|
return o;
|
|
748
750
|
};
|
|
749
751
|
var deepStringify = (obj, stringified = {}) => {
|
|
752
|
+
var _a;
|
|
753
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
754
|
+
console.warn("Trying to clone element or state at", obj);
|
|
755
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
756
|
+
}
|
|
750
757
|
for (const prop in obj) {
|
|
751
758
|
const objProp = obj[prop];
|
|
752
759
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -772,6 +779,39 @@ var require_object = __commonJS({
|
|
|
772
779
|
}
|
|
773
780
|
return stringified;
|
|
774
781
|
};
|
|
782
|
+
var MAX_DEPTH = 100;
|
|
783
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
784
|
+
if (depth > MAX_DEPTH) {
|
|
785
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
786
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
787
|
+
}
|
|
788
|
+
for (const prop in obj) {
|
|
789
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
790
|
+
const objProp = obj[prop];
|
|
791
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
792
|
+
stringified[prop] = objProp.toString();
|
|
793
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
794
|
+
stringified[prop] = {};
|
|
795
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
796
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
797
|
+
stringified[prop] = [];
|
|
798
|
+
objProp.forEach((v, i) => {
|
|
799
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
800
|
+
if ((0, import_types.isObject)(v)) {
|
|
801
|
+
stringified[prop][i] = {};
|
|
802
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
803
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
804
|
+
stringified[prop][i] = v.toString();
|
|
805
|
+
} else {
|
|
806
|
+
stringified[prop][i] = v;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
} else {
|
|
810
|
+
stringified[prop] = objProp;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return stringified;
|
|
814
|
+
};
|
|
775
815
|
var objectToString = (obj = {}, indent = 0) => {
|
|
776
816
|
const spaces = " ".repeat(indent);
|
|
777
817
|
let str = "{\n";
|
|
@@ -1319,6 +1359,7 @@ var require_cookie = __commonJS({
|
|
|
1319
1359
|
__export2(cookie_exports, {
|
|
1320
1360
|
getCookie: () => getCookie,
|
|
1321
1361
|
isMobile: () => isMobile,
|
|
1362
|
+
removeCookie: () => removeCookie,
|
|
1322
1363
|
setCookie: () => setCookie
|
|
1323
1364
|
});
|
|
1324
1365
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
@@ -1348,6 +1389,11 @@ var require_cookie = __commonJS({
|
|
|
1348
1389
|
}
|
|
1349
1390
|
return "";
|
|
1350
1391
|
};
|
|
1392
|
+
var removeCookie = (cname) => {
|
|
1393
|
+
if ((0, import_types.isUndefined)(import_utils26.document) || (0, import_types.isUndefined)(import_utils26.document.cookie))
|
|
1394
|
+
return;
|
|
1395
|
+
import_utils26.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1396
|
+
};
|
|
1351
1397
|
}
|
|
1352
1398
|
});
|
|
1353
1399
|
|
|
@@ -1387,10 +1433,13 @@ var require_tags = __commonJS({
|
|
|
1387
1433
|
"title",
|
|
1388
1434
|
"base",
|
|
1389
1435
|
"meta",
|
|
1390
|
-
"style"
|
|
1436
|
+
"style",
|
|
1437
|
+
"noscript",
|
|
1438
|
+
"script"
|
|
1391
1439
|
],
|
|
1392
1440
|
body: [
|
|
1393
1441
|
"string",
|
|
1442
|
+
"style",
|
|
1394
1443
|
"fragment",
|
|
1395
1444
|
"a",
|
|
1396
1445
|
"abbr",
|
|
@@ -1543,6 +1592,7 @@ var require_component = __commonJS({
|
|
|
1543
1592
|
var component_exports = {};
|
|
1544
1593
|
__export2(component_exports, {
|
|
1545
1594
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
1595
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
1546
1596
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
1547
1597
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1548
1598
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -1551,7 +1601,8 @@ var require_component = __commonJS({
|
|
|
1551
1601
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1552
1602
|
getExtendsInElement: () => getExtendsInElement,
|
|
1553
1603
|
hasVariantProp: () => hasVariantProp,
|
|
1554
|
-
isVariant: () => isVariant
|
|
1604
|
+
isVariant: () => isVariant,
|
|
1605
|
+
setContentKey: () => setContentKey
|
|
1555
1606
|
});
|
|
1556
1607
|
module2.exports = __toCommonJS2(component_exports);
|
|
1557
1608
|
var import__ = require_cjs();
|
|
@@ -1577,20 +1628,28 @@ var require_component = __commonJS({
|
|
|
1577
1628
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1578
1629
|
return { ...element, extend };
|
|
1579
1630
|
};
|
|
1631
|
+
var checkIfSugar = (element, parent, key) => {
|
|
1632
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
1633
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1634
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1635
|
+
};
|
|
1580
1636
|
var extendizeByKey = (element, parent, key) => {
|
|
1581
1637
|
const { context } = parent;
|
|
1582
|
-
const { tag, extend,
|
|
1583
|
-
const
|
|
1638
|
+
const { tag, extend, childrenExtends } = element;
|
|
1639
|
+
const isSugar = checkIfSugar(element);
|
|
1584
1640
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1585
1641
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1586
1642
|
if (element === isExtendKeyComponent)
|
|
1587
1643
|
return element;
|
|
1588
|
-
else if (
|
|
1589
|
-
|
|
1644
|
+
else if (isSugar) {
|
|
1645
|
+
const newElem = {
|
|
1590
1646
|
extend: extendFromKey,
|
|
1591
1647
|
tag,
|
|
1592
1648
|
props: { ...element }
|
|
1593
1649
|
};
|
|
1650
|
+
if (childrenExtends)
|
|
1651
|
+
newElem.childExtend = childrenExtends;
|
|
1652
|
+
return newElem;
|
|
1594
1653
|
} else if (!extend || extend === true) {
|
|
1595
1654
|
return {
|
|
1596
1655
|
...element,
|
|
@@ -1607,6 +1666,37 @@ var require_component = __commonJS({
|
|
|
1607
1666
|
};
|
|
1608
1667
|
}
|
|
1609
1668
|
};
|
|
1669
|
+
function getCapitalCaseKeys(obj) {
|
|
1670
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
1671
|
+
}
|
|
1672
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
1673
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
1674
|
+
if (!childElems.length)
|
|
1675
|
+
return element;
|
|
1676
|
+
for (const i in childElems) {
|
|
1677
|
+
const childKey = childElems[i];
|
|
1678
|
+
const childElem = element[childKey];
|
|
1679
|
+
const newChild = element.props[childKey];
|
|
1680
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1681
|
+
continue;
|
|
1682
|
+
if (!childElem)
|
|
1683
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
1684
|
+
else {
|
|
1685
|
+
const isSugar = checkIfSugar(childElem);
|
|
1686
|
+
if (!isSugar)
|
|
1687
|
+
continue;
|
|
1688
|
+
const inheritedChildElem = element[childKey].props;
|
|
1689
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
1690
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
1691
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
1692
|
+
element[childKey] = {
|
|
1693
|
+
extend: element[childKey],
|
|
1694
|
+
props: newChild
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1610
1700
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1611
1701
|
return extendizeByKey(element, parent, key) || element;
|
|
1612
1702
|
};
|
|
@@ -1682,6 +1772,17 @@ var require_component = __commonJS({
|
|
|
1682
1772
|
traverse(obj);
|
|
1683
1773
|
return result;
|
|
1684
1774
|
};
|
|
1775
|
+
var setContentKey = (el, opts = {}) => {
|
|
1776
|
+
const { __ref: ref } = el;
|
|
1777
|
+
const contentElementKey = opts.contentElementKey;
|
|
1778
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
1779
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
1780
|
+
} else
|
|
1781
|
+
ref.contentElementKey = "content";
|
|
1782
|
+
if (contentElementKey !== "content")
|
|
1783
|
+
opts.contentElementKey = "content";
|
|
1784
|
+
return ref.contentElementKey;
|
|
1785
|
+
};
|
|
1685
1786
|
}
|
|
1686
1787
|
});
|
|
1687
1788
|
|
|
@@ -2343,6 +2444,7 @@ var require_cjs3 = __commonJS({
|
|
|
2343
2444
|
deepDiff: () => deepDiff,
|
|
2344
2445
|
deepMerge: () => deepMerge3,
|
|
2345
2446
|
deepStringify: () => deepStringify,
|
|
2447
|
+
deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
|
|
2346
2448
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
2347
2449
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
2348
2450
|
diff: () => diff,
|
|
@@ -2376,7 +2478,8 @@ var require_cjs3 = __commonJS({
|
|
|
2376
2478
|
var ENV = "development";
|
|
2377
2479
|
var exec = (param, element, state, context) => {
|
|
2378
2480
|
if ((0, import_types.isFunction)(param)) {
|
|
2379
|
-
return param(
|
|
2481
|
+
return param.call(
|
|
2482
|
+
element,
|
|
2380
2483
|
element,
|
|
2381
2484
|
state || element.state,
|
|
2382
2485
|
context || element.context
|
|
@@ -2493,6 +2596,11 @@ var require_cjs3 = __commonJS({
|
|
|
2493
2596
|
return o;
|
|
2494
2597
|
};
|
|
2495
2598
|
var deepStringify = (obj, stringified = {}) => {
|
|
2599
|
+
var _a;
|
|
2600
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
2601
|
+
console.warn("Trying to clone element or state at", obj);
|
|
2602
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
2603
|
+
}
|
|
2496
2604
|
for (const prop in obj) {
|
|
2497
2605
|
const objProp = obj[prop];
|
|
2498
2606
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -2518,6 +2626,39 @@ var require_cjs3 = __commonJS({
|
|
|
2518
2626
|
}
|
|
2519
2627
|
return stringified;
|
|
2520
2628
|
};
|
|
2629
|
+
var MAX_DEPTH = 100;
|
|
2630
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
2631
|
+
if (depth > MAX_DEPTH) {
|
|
2632
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
2633
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
2634
|
+
}
|
|
2635
|
+
for (const prop in obj) {
|
|
2636
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
2637
|
+
const objProp = obj[prop];
|
|
2638
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
2639
|
+
stringified[prop] = objProp.toString();
|
|
2640
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
2641
|
+
stringified[prop] = {};
|
|
2642
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
2643
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
2644
|
+
stringified[prop] = [];
|
|
2645
|
+
objProp.forEach((v, i) => {
|
|
2646
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
2647
|
+
if ((0, import_types.isObject)(v)) {
|
|
2648
|
+
stringified[prop][i] = {};
|
|
2649
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
2650
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
2651
|
+
stringified[prop][i] = v.toString();
|
|
2652
|
+
} else {
|
|
2653
|
+
stringified[prop][i] = v;
|
|
2654
|
+
}
|
|
2655
|
+
});
|
|
2656
|
+
} else {
|
|
2657
|
+
stringified[prop] = objProp;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
return stringified;
|
|
2661
|
+
};
|
|
2521
2662
|
var objectToString = (obj = {}, indent = 0) => {
|
|
2522
2663
|
const spaces = " ".repeat(indent);
|
|
2523
2664
|
let str = "{\n";
|
|
@@ -3059,6 +3200,7 @@ var require_cjs3 = __commonJS({
|
|
|
3059
3200
|
__export22(cookie_exports, {
|
|
3060
3201
|
getCookie: () => getCookie,
|
|
3061
3202
|
isMobile: () => isMobile,
|
|
3203
|
+
removeCookie: () => removeCookie,
|
|
3062
3204
|
setCookie: () => setCookie
|
|
3063
3205
|
});
|
|
3064
3206
|
module22.exports = __toCommonJS22(cookie_exports);
|
|
@@ -3088,6 +3230,11 @@ var require_cjs3 = __commonJS({
|
|
|
3088
3230
|
}
|
|
3089
3231
|
return "";
|
|
3090
3232
|
};
|
|
3233
|
+
var removeCookie = (cname) => {
|
|
3234
|
+
if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
|
|
3235
|
+
return;
|
|
3236
|
+
import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
3237
|
+
};
|
|
3091
3238
|
}
|
|
3092
3239
|
});
|
|
3093
3240
|
var require_tags2 = __commonJS2({
|
|
@@ -3125,10 +3272,13 @@ var require_cjs3 = __commonJS({
|
|
|
3125
3272
|
"title",
|
|
3126
3273
|
"base",
|
|
3127
3274
|
"meta",
|
|
3128
|
-
"style"
|
|
3275
|
+
"style",
|
|
3276
|
+
"noscript",
|
|
3277
|
+
"script"
|
|
3129
3278
|
],
|
|
3130
3279
|
body: [
|
|
3131
3280
|
"string",
|
|
3281
|
+
"style",
|
|
3132
3282
|
"fragment",
|
|
3133
3283
|
"a",
|
|
3134
3284
|
"abbr",
|
|
@@ -3279,6 +3429,7 @@ var require_cjs3 = __commonJS({
|
|
|
3279
3429
|
var component_exports = {};
|
|
3280
3430
|
__export22(component_exports, {
|
|
3281
3431
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
3432
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
3282
3433
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
3283
3434
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
3284
3435
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -3287,7 +3438,8 @@ var require_cjs3 = __commonJS({
|
|
|
3287
3438
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
3288
3439
|
getExtendsInElement: () => getExtendsInElement,
|
|
3289
3440
|
hasVariantProp: () => hasVariantProp,
|
|
3290
|
-
isVariant: () => isVariant
|
|
3441
|
+
isVariant: () => isVariant,
|
|
3442
|
+
setContentKey: () => setContentKey
|
|
3291
3443
|
});
|
|
3292
3444
|
module22.exports = __toCommonJS22(component_exports);
|
|
3293
3445
|
var import__ = require_cjs4();
|
|
@@ -3313,20 +3465,28 @@ var require_cjs3 = __commonJS({
|
|
|
3313
3465
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
3314
3466
|
return { ...element, extend };
|
|
3315
3467
|
};
|
|
3468
|
+
var checkIfSugar = (element, parent, key) => {
|
|
3469
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
3470
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3471
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
3472
|
+
};
|
|
3316
3473
|
var extendizeByKey = (element, parent, key) => {
|
|
3317
3474
|
const { context } = parent;
|
|
3318
|
-
const { tag, extend,
|
|
3319
|
-
const
|
|
3475
|
+
const { tag, extend, childrenExtends } = element;
|
|
3476
|
+
const isSugar = checkIfSugar(element);
|
|
3320
3477
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
3321
3478
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
3322
3479
|
if (element === isExtendKeyComponent)
|
|
3323
3480
|
return element;
|
|
3324
|
-
else if (
|
|
3325
|
-
|
|
3481
|
+
else if (isSugar) {
|
|
3482
|
+
const newElem = {
|
|
3326
3483
|
extend: extendFromKey,
|
|
3327
3484
|
tag,
|
|
3328
3485
|
props: { ...element }
|
|
3329
3486
|
};
|
|
3487
|
+
if (childrenExtends)
|
|
3488
|
+
newElem.childExtend = childrenExtends;
|
|
3489
|
+
return newElem;
|
|
3330
3490
|
} else if (!extend || extend === true) {
|
|
3331
3491
|
return {
|
|
3332
3492
|
...element,
|
|
@@ -3343,6 +3503,37 @@ var require_cjs3 = __commonJS({
|
|
|
3343
3503
|
};
|
|
3344
3504
|
}
|
|
3345
3505
|
};
|
|
3506
|
+
function getCapitalCaseKeys(obj) {
|
|
3507
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
3508
|
+
}
|
|
3509
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
3510
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
3511
|
+
if (!childElems.length)
|
|
3512
|
+
return element;
|
|
3513
|
+
for (const i in childElems) {
|
|
3514
|
+
const childKey = childElems[i];
|
|
3515
|
+
const childElem = element[childKey];
|
|
3516
|
+
const newChild = element.props[childKey];
|
|
3517
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
3518
|
+
continue;
|
|
3519
|
+
if (!childElem)
|
|
3520
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
3521
|
+
else {
|
|
3522
|
+
const isSugar = checkIfSugar(childElem);
|
|
3523
|
+
if (!isSugar)
|
|
3524
|
+
continue;
|
|
3525
|
+
const inheritedChildElem = element[childKey].props;
|
|
3526
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
3527
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
3528
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
3529
|
+
element[childKey] = {
|
|
3530
|
+
extend: element[childKey],
|
|
3531
|
+
props: newChild
|
|
3532
|
+
};
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3346
3537
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
3347
3538
|
return extendizeByKey(element, parent, key) || element;
|
|
3348
3539
|
};
|
|
@@ -3418,6 +3609,17 @@ var require_cjs3 = __commonJS({
|
|
|
3418
3609
|
traverse(obj);
|
|
3419
3610
|
return result;
|
|
3420
3611
|
};
|
|
3612
|
+
var setContentKey = (el, opts = {}) => {
|
|
3613
|
+
const { __ref: ref } = el;
|
|
3614
|
+
const contentElementKey = opts.contentElementKey;
|
|
3615
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
3616
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
3617
|
+
} else
|
|
3618
|
+
ref.contentElementKey = "content";
|
|
3619
|
+
if (contentElementKey !== "content")
|
|
3620
|
+
opts.contentElementKey = "content";
|
|
3621
|
+
return ref.contentElementKey;
|
|
3622
|
+
};
|
|
3421
3623
|
}
|
|
3422
3624
|
});
|
|
3423
3625
|
var require_cjs4 = __commonJS2({
|
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,
|
|
@@ -666,7 +667,8 @@ var require_object = __commonJS({
|
|
|
666
667
|
var ENV2 = "development";
|
|
667
668
|
var exec = (param, element, state, context) => {
|
|
668
669
|
if ((0, import_types.isFunction)(param)) {
|
|
669
|
-
return param(
|
|
670
|
+
return param.call(
|
|
671
|
+
element,
|
|
670
672
|
element,
|
|
671
673
|
state || element.state,
|
|
672
674
|
context || element.context
|
|
@@ -783,6 +785,11 @@ var require_object = __commonJS({
|
|
|
783
785
|
return o;
|
|
784
786
|
};
|
|
785
787
|
var deepStringify = (obj, stringified = {}) => {
|
|
788
|
+
var _a;
|
|
789
|
+
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
790
|
+
console.warn("Trying to clone element or state at", obj);
|
|
791
|
+
obj = (_a = obj.parse) == null ? void 0 : _a.call(obj);
|
|
792
|
+
}
|
|
786
793
|
for (const prop in obj) {
|
|
787
794
|
const objProp = obj[prop];
|
|
788
795
|
if ((0, import_types.isFunction)(objProp)) {
|
|
@@ -808,6 +815,39 @@ var require_object = __commonJS({
|
|
|
808
815
|
}
|
|
809
816
|
return stringified;
|
|
810
817
|
};
|
|
818
|
+
var MAX_DEPTH = 100;
|
|
819
|
+
var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
|
|
820
|
+
if (depth > MAX_DEPTH) {
|
|
821
|
+
console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
|
|
822
|
+
return "[MAX_DEPTH_EXCEEDED]";
|
|
823
|
+
}
|
|
824
|
+
for (const prop in obj) {
|
|
825
|
+
const currentPath = path ? `${path}.${prop}` : prop;
|
|
826
|
+
const objProp = obj[prop];
|
|
827
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
828
|
+
stringified[prop] = objProp.toString();
|
|
829
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
830
|
+
stringified[prop] = {};
|
|
831
|
+
deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
|
|
832
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
833
|
+
stringified[prop] = [];
|
|
834
|
+
objProp.forEach((v, i) => {
|
|
835
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
836
|
+
if ((0, import_types.isObject)(v)) {
|
|
837
|
+
stringified[prop][i] = {};
|
|
838
|
+
deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
|
|
839
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
840
|
+
stringified[prop][i] = v.toString();
|
|
841
|
+
} else {
|
|
842
|
+
stringified[prop][i] = v;
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
} else {
|
|
846
|
+
stringified[prop] = objProp;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return stringified;
|
|
850
|
+
};
|
|
811
851
|
var objectToString = (obj = {}, indent = 0) => {
|
|
812
852
|
const spaces = " ".repeat(indent);
|
|
813
853
|
let str = "{\n";
|
|
@@ -1355,6 +1395,7 @@ var require_cookie = __commonJS({
|
|
|
1355
1395
|
__export2(cookie_exports, {
|
|
1356
1396
|
getCookie: () => getCookie,
|
|
1357
1397
|
isMobile: () => isMobile,
|
|
1398
|
+
removeCookie: () => removeCookie,
|
|
1358
1399
|
setCookie: () => setCookie
|
|
1359
1400
|
});
|
|
1360
1401
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
@@ -1384,6 +1425,11 @@ var require_cookie = __commonJS({
|
|
|
1384
1425
|
}
|
|
1385
1426
|
return "";
|
|
1386
1427
|
};
|
|
1428
|
+
var removeCookie = (cname) => {
|
|
1429
|
+
if ((0, import_types.isUndefined)(import_utils2.document) || (0, import_types.isUndefined)(import_utils2.document.cookie))
|
|
1430
|
+
return;
|
|
1431
|
+
import_utils2.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1432
|
+
};
|
|
1387
1433
|
}
|
|
1388
1434
|
});
|
|
1389
1435
|
|
|
@@ -1423,10 +1469,13 @@ var require_tags = __commonJS({
|
|
|
1423
1469
|
"title",
|
|
1424
1470
|
"base",
|
|
1425
1471
|
"meta",
|
|
1426
|
-
"style"
|
|
1472
|
+
"style",
|
|
1473
|
+
"noscript",
|
|
1474
|
+
"script"
|
|
1427
1475
|
],
|
|
1428
1476
|
body: [
|
|
1429
1477
|
"string",
|
|
1478
|
+
"style",
|
|
1430
1479
|
"fragment",
|
|
1431
1480
|
"a",
|
|
1432
1481
|
"abbr",
|
|
@@ -1579,6 +1628,7 @@ var require_component = __commonJS({
|
|
|
1579
1628
|
var component_exports = {};
|
|
1580
1629
|
__export2(component_exports, {
|
|
1581
1630
|
addAdditionalExtend: () => addAdditionalExtend,
|
|
1631
|
+
addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
|
|
1582
1632
|
applyComponentFromContext: () => applyComponentFromContext,
|
|
1583
1633
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1584
1634
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
@@ -1587,7 +1637,8 @@ var require_component = __commonJS({
|
|
|
1587
1637
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1588
1638
|
getExtendsInElement: () => getExtendsInElement,
|
|
1589
1639
|
hasVariantProp: () => hasVariantProp,
|
|
1590
|
-
isVariant: () => isVariant
|
|
1640
|
+
isVariant: () => isVariant,
|
|
1641
|
+
setContentKey: () => setContentKey
|
|
1591
1642
|
});
|
|
1592
1643
|
module2.exports = __toCommonJS2(component_exports);
|
|
1593
1644
|
var import__ = require_cjs2();
|
|
@@ -1613,20 +1664,28 @@ var require_component = __commonJS({
|
|
|
1613
1664
|
const extend = (0, import__.joinArrays)(receivedArray, originalArray);
|
|
1614
1665
|
return { ...element, extend };
|
|
1615
1666
|
};
|
|
1667
|
+
var checkIfSugar = (element, parent, key) => {
|
|
1668
|
+
const { extend, props, childExtend, extends: extendProps, childrenExtends, childProps, children, on, $collection, $stateCollection, $propsCollection } = element;
|
|
1669
|
+
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1670
|
+
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1671
|
+
};
|
|
1616
1672
|
var extendizeByKey = (element, parent, key) => {
|
|
1617
1673
|
const { context } = parent;
|
|
1618
|
-
const { tag, extend,
|
|
1619
|
-
const
|
|
1674
|
+
const { tag, extend, childrenExtends } = element;
|
|
1675
|
+
const isSugar = checkIfSugar(element);
|
|
1620
1676
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1621
1677
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1622
1678
|
if (element === isExtendKeyComponent)
|
|
1623
1679
|
return element;
|
|
1624
|
-
else if (
|
|
1625
|
-
|
|
1680
|
+
else if (isSugar) {
|
|
1681
|
+
const newElem = {
|
|
1626
1682
|
extend: extendFromKey,
|
|
1627
1683
|
tag,
|
|
1628
1684
|
props: { ...element }
|
|
1629
1685
|
};
|
|
1686
|
+
if (childrenExtends)
|
|
1687
|
+
newElem.childExtend = childrenExtends;
|
|
1688
|
+
return newElem;
|
|
1630
1689
|
} else if (!extend || extend === true) {
|
|
1631
1690
|
return {
|
|
1632
1691
|
...element,
|
|
@@ -1643,6 +1702,37 @@ var require_component = __commonJS({
|
|
|
1643
1702
|
};
|
|
1644
1703
|
}
|
|
1645
1704
|
};
|
|
1705
|
+
function getCapitalCaseKeys(obj) {
|
|
1706
|
+
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
1707
|
+
}
|
|
1708
|
+
var addChildrenIfNotInOriginal = (element, parent, key) => {
|
|
1709
|
+
const childElems = getCapitalCaseKeys(element.props);
|
|
1710
|
+
if (!childElems.length)
|
|
1711
|
+
return element;
|
|
1712
|
+
for (const i in childElems) {
|
|
1713
|
+
const childKey = childElems[i];
|
|
1714
|
+
const childElem = element[childKey];
|
|
1715
|
+
const newChild = element.props[childKey];
|
|
1716
|
+
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1717
|
+
continue;
|
|
1718
|
+
if (!childElem)
|
|
1719
|
+
element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
|
|
1720
|
+
else {
|
|
1721
|
+
const isSugar = checkIfSugar(childElem);
|
|
1722
|
+
if (!isSugar)
|
|
1723
|
+
continue;
|
|
1724
|
+
const inheritedChildElem = element[childKey].props;
|
|
1725
|
+
if ((0, import__.isObjectLike)(newChild)) {
|
|
1726
|
+
(0, import__.overwriteDeep)(inheritedChildElem, newChild);
|
|
1727
|
+
} else if ((0, import__.isFunction)(newChild)) {
|
|
1728
|
+
element[childKey] = {
|
|
1729
|
+
extend: element[childKey],
|
|
1730
|
+
props: newChild
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1646
1736
|
var applyKeyComponentAsExtend = (element, parent, key) => {
|
|
1647
1737
|
return extendizeByKey(element, parent, key) || element;
|
|
1648
1738
|
};
|
|
@@ -1718,6 +1808,17 @@ var require_component = __commonJS({
|
|
|
1718
1808
|
traverse(obj);
|
|
1719
1809
|
return result;
|
|
1720
1810
|
};
|
|
1811
|
+
var setContentKey = (el, opts = {}) => {
|
|
1812
|
+
const { __ref: ref } = el;
|
|
1813
|
+
const contentElementKey = opts.contentElementKey;
|
|
1814
|
+
if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
|
|
1815
|
+
ref.contentElementKey = contentElementKey || "content";
|
|
1816
|
+
} else
|
|
1817
|
+
ref.contentElementKey = "content";
|
|
1818
|
+
if (contentElementKey !== "content")
|
|
1819
|
+
opts.contentElementKey = "content";
|
|
1820
|
+
return ref.contentElementKey;
|
|
1821
|
+
};
|
|
1721
1822
|
}
|
|
1722
1823
|
});
|
|
1723
1824
|
|