@symbo.ls/scratch 2.11.450 → 2.11.453
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 +59 -17
- package/dist/cjs/index.js +150 -38
- package/dist/cjs/set.js +150 -38
- package/dist/cjs/system/color.js +150 -38
- package/dist/cjs/system/document.js +150 -38
- package/dist/cjs/system/font.js +150 -38
- package/dist/cjs/system/index.js +150 -38
- package/dist/cjs/system/reset.js +150 -38
- package/dist/cjs/system/shadow.js +150 -38
- package/dist/cjs/system/spacing.js +150 -38
- package/dist/cjs/system/svg.js +150 -38
- package/dist/cjs/system/theme.js +150 -38
- package/dist/cjs/system/timing.js +150 -38
- package/dist/cjs/system/typography.js +150 -38
- package/dist/cjs/transforms/index.js +150 -38
- package/dist/cjs/utils/color.js +59 -17
- package/dist/cjs/utils/index.js +150 -38
- package/dist/cjs/utils/sequence.js +150 -38
- package/dist/cjs/utils/sprite.js +59 -17
- package/dist/cjs/utils/var.js +150 -38
- package/package.json +3 -3
package/dist/cjs/factory.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,
|
|
@@ -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
|
|
|
@@ -1650,6 +1675,8 @@ var require_component = __commonJS({
|
|
|
1650
1675
|
return /^[a-z]*$/.test(firstCharKey);
|
|
1651
1676
|
};
|
|
1652
1677
|
var addAdditionalExtend = (newExtend, element) => {
|
|
1678
|
+
if (!newExtend)
|
|
1679
|
+
return element;
|
|
1653
1680
|
const { extend: elementExtend } = element;
|
|
1654
1681
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1655
1682
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -1657,8 +1684,23 @@ var require_component = __commonJS({
|
|
|
1657
1684
|
return { ...element, extend };
|
|
1658
1685
|
};
|
|
1659
1686
|
var checkIfSugar = (element, parent, key) => {
|
|
1660
|
-
const {
|
|
1687
|
+
const {
|
|
1688
|
+
extend,
|
|
1689
|
+
props,
|
|
1690
|
+
childExtend,
|
|
1691
|
+
extends: extendProps,
|
|
1692
|
+
childrenExtends,
|
|
1693
|
+
childProps,
|
|
1694
|
+
children,
|
|
1695
|
+
on,
|
|
1696
|
+
$collection,
|
|
1697
|
+
$stateCollection,
|
|
1698
|
+
$propsCollection
|
|
1699
|
+
} = element;
|
|
1661
1700
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1701
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
|
|
1702
|
+
element.error("Sugar component includes params for builtin components");
|
|
1703
|
+
}
|
|
1662
1704
|
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1663
1705
|
};
|
|
1664
1706
|
var extendizeByKey = (element, parent, key) => {
|
|
@@ -1670,11 +1712,11 @@ var require_component = __commonJS({
|
|
|
1670
1712
|
if (element === isExtendKeyComponent)
|
|
1671
1713
|
return element;
|
|
1672
1714
|
else if (isSugar) {
|
|
1673
|
-
const newElem = {
|
|
1715
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
1674
1716
|
extend: extendFromKey,
|
|
1675
1717
|
tag,
|
|
1676
1718
|
props: { ...element }
|
|
1677
|
-
};
|
|
1719
|
+
});
|
|
1678
1720
|
if (childrenExtends)
|
|
1679
1721
|
newElem.childExtend = childrenExtends;
|
|
1680
1722
|
return newElem;
|
package/dist/cjs/index.js
CHANGED
|
@@ -338,6 +338,8 @@ var require_array = __commonJS({
|
|
|
338
338
|
arraysEqual: () => arraysEqual,
|
|
339
339
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
340
340
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
341
|
+
filterArrays: () => filterArrays,
|
|
342
|
+
filterArraysFast: () => filterArraysFast,
|
|
341
343
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
342
344
|
joinArrays: () => joinArrays,
|
|
343
345
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -446,6 +448,13 @@ var require_array = __commonJS({
|
|
|
446
448
|
}
|
|
447
449
|
return true;
|
|
448
450
|
};
|
|
451
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
452
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
453
|
+
};
|
|
454
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
455
|
+
const excludeSet = new Set(excludeArr);
|
|
456
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
457
|
+
};
|
|
449
458
|
}
|
|
450
459
|
});
|
|
451
460
|
|
|
@@ -639,6 +648,7 @@ var require_object = __commonJS({
|
|
|
639
648
|
diff: () => diff,
|
|
640
649
|
diffArrays: () => diffArrays,
|
|
641
650
|
diffObjects: () => diffObjects,
|
|
651
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
642
652
|
exec: () => exec,
|
|
643
653
|
flattenRecursive: () => flattenRecursive,
|
|
644
654
|
hasOwnProperty: () => hasOwnProperty,
|
|
@@ -966,7 +976,7 @@ var require_object = __commonJS({
|
|
|
966
976
|
};
|
|
967
977
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
968
978
|
try {
|
|
969
|
-
return import_globals3.window.eval("(" + str + ")");
|
|
979
|
+
return str ? import_globals3.window.eval("(" + str + ")") : {};
|
|
970
980
|
} catch (e) {
|
|
971
981
|
if (opts.verbose)
|
|
972
982
|
console.warn(e);
|
|
@@ -1046,20 +1056,27 @@ var require_object = __commonJS({
|
|
|
1046
1056
|
return acc;
|
|
1047
1057
|
}, deletedValues);
|
|
1048
1058
|
};
|
|
1049
|
-
var overwrite = (element, params,
|
|
1050
|
-
const { ref } = element;
|
|
1051
|
-
const
|
|
1059
|
+
var overwrite = (element, params, opts = {}) => {
|
|
1060
|
+
const { __ref: ref } = element;
|
|
1061
|
+
const excl = opts.exclude || [];
|
|
1062
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
1063
|
+
const preventCaching = opts.preventCaching;
|
|
1052
1064
|
for (const e in params) {
|
|
1053
|
-
if (
|
|
1065
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
1054
1066
|
continue;
|
|
1055
1067
|
const elementProp = element[e];
|
|
1056
1068
|
const paramsProp = params[e];
|
|
1057
|
-
if (paramsProp) {
|
|
1058
|
-
|
|
1059
|
-
ref
|
|
1069
|
+
if (paramsProp !== void 0) {
|
|
1070
|
+
element[e] = paramsProp;
|
|
1071
|
+
if (ref && !preventCaching) {
|
|
1072
|
+
ref.__cache[e] = elementProp;
|
|
1073
|
+
}
|
|
1074
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
1075
|
+
diff[e] = elementProp;
|
|
1076
|
+
}
|
|
1060
1077
|
}
|
|
1061
1078
|
}
|
|
1062
|
-
return
|
|
1079
|
+
return element;
|
|
1063
1080
|
};
|
|
1064
1081
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
1065
1082
|
for (const e in params) {
|
|
@@ -1069,23 +1086,26 @@ var require_object = __commonJS({
|
|
|
1069
1086
|
}
|
|
1070
1087
|
return obj;
|
|
1071
1088
|
};
|
|
1072
|
-
var overwriteDeep2 = (obj, params,
|
|
1089
|
+
var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
1090
|
+
const excl = opts.exclude || [];
|
|
1091
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
1073
1092
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
1074
1093
|
return params;
|
|
1075
1094
|
}
|
|
1076
|
-
if (visited.has(obj))
|
|
1095
|
+
if (visited.has(obj))
|
|
1077
1096
|
return visited.get(obj);
|
|
1078
|
-
}
|
|
1079
1097
|
visited.set(obj, obj);
|
|
1080
1098
|
for (const e in params) {
|
|
1081
|
-
if (
|
|
1099
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
1100
|
+
continue;
|
|
1101
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
1082
1102
|
continue;
|
|
1083
1103
|
const objProp = obj[e];
|
|
1084
1104
|
const paramsProp = params[e];
|
|
1085
1105
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
1086
1106
|
obj[e] = paramsProp;
|
|
1087
1107
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
1088
|
-
obj[e] = overwriteDeep2(objProp, paramsProp,
|
|
1108
|
+
obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
|
|
1089
1109
|
} else if (paramsProp !== void 0) {
|
|
1090
1110
|
obj[e] = paramsProp;
|
|
1091
1111
|
}
|
|
@@ -1267,6 +1287,11 @@ var require_object = __commonJS({
|
|
|
1267
1287
|
}
|
|
1268
1288
|
return detect(obj);
|
|
1269
1289
|
};
|
|
1290
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
1291
|
+
const result = { ...obj };
|
|
1292
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
1293
|
+
return result;
|
|
1294
|
+
};
|
|
1270
1295
|
}
|
|
1271
1296
|
});
|
|
1272
1297
|
|
|
@@ -1686,6 +1711,8 @@ var require_component = __commonJS({
|
|
|
1686
1711
|
return /^[a-z]*$/.test(firstCharKey);
|
|
1687
1712
|
};
|
|
1688
1713
|
var addAdditionalExtend = (newExtend, element) => {
|
|
1714
|
+
if (!newExtend)
|
|
1715
|
+
return element;
|
|
1689
1716
|
const { extend: elementExtend } = element;
|
|
1690
1717
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
1691
1718
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -1693,8 +1720,23 @@ var require_component = __commonJS({
|
|
|
1693
1720
|
return { ...element, extend };
|
|
1694
1721
|
};
|
|
1695
1722
|
var checkIfSugar = (element, parent, key) => {
|
|
1696
|
-
const {
|
|
1723
|
+
const {
|
|
1724
|
+
extend,
|
|
1725
|
+
props,
|
|
1726
|
+
childExtend,
|
|
1727
|
+
extends: extendProps,
|
|
1728
|
+
childrenExtends,
|
|
1729
|
+
childProps,
|
|
1730
|
+
children,
|
|
1731
|
+
on,
|
|
1732
|
+
$collection,
|
|
1733
|
+
$stateCollection,
|
|
1734
|
+
$propsCollection
|
|
1735
|
+
} = element;
|
|
1697
1736
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1737
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
|
|
1738
|
+
element.error("Sugar component includes params for builtin components");
|
|
1739
|
+
}
|
|
1698
1740
|
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
1699
1741
|
};
|
|
1700
1742
|
var extendizeByKey = (element, parent, key) => {
|
|
@@ -1706,11 +1748,11 @@ var require_component = __commonJS({
|
|
|
1706
1748
|
if (element === isExtendKeyComponent)
|
|
1707
1749
|
return element;
|
|
1708
1750
|
else if (isSugar) {
|
|
1709
|
-
const newElem = {
|
|
1751
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
1710
1752
|
extend: extendFromKey,
|
|
1711
1753
|
tag,
|
|
1712
1754
|
props: { ...element }
|
|
1713
|
-
};
|
|
1755
|
+
});
|
|
1714
1756
|
if (childrenExtends)
|
|
1715
1757
|
newElem.childExtend = childrenExtends;
|
|
1716
1758
|
return newElem;
|
|
@@ -2181,6 +2223,8 @@ var require_cjs3 = __commonJS({
|
|
|
2181
2223
|
arraysEqual: () => arraysEqual,
|
|
2182
2224
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
2183
2225
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
2226
|
+
filterArrays: () => filterArrays,
|
|
2227
|
+
filterArraysFast: () => filterArraysFast,
|
|
2184
2228
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
2185
2229
|
joinArrays: () => joinArrays,
|
|
2186
2230
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -2289,6 +2333,13 @@ var require_cjs3 = __commonJS({
|
|
|
2289
2333
|
}
|
|
2290
2334
|
return true;
|
|
2291
2335
|
};
|
|
2336
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
2337
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
2338
|
+
};
|
|
2339
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
2340
|
+
const excludeSet = new Set(excludeArr);
|
|
2341
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
2342
|
+
};
|
|
2292
2343
|
}
|
|
2293
2344
|
});
|
|
2294
2345
|
var require_string2 = __commonJS2({
|
|
@@ -2478,9 +2529,11 @@ var require_cjs3 = __commonJS({
|
|
|
2478
2529
|
diff: () => diff,
|
|
2479
2530
|
diffArrays: () => diffArrays,
|
|
2480
2531
|
diffObjects: () => diffObjects,
|
|
2532
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
2481
2533
|
exec: () => exec,
|
|
2482
2534
|
flattenRecursive: () => flattenRecursive,
|
|
2483
2535
|
hasOwnProperty: () => hasOwnProperty,
|
|
2536
|
+
isCyclic: () => isCyclic,
|
|
2484
2537
|
isEmpty: () => isEmpty,
|
|
2485
2538
|
isEmptyObject: () => isEmptyObject,
|
|
2486
2539
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -2606,20 +2659,28 @@ var require_cjs3 = __commonJS({
|
|
|
2606
2659
|
}
|
|
2607
2660
|
return clone2;
|
|
2608
2661
|
};
|
|
2609
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2662
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
2663
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
2664
|
+
if (visited.has(obj)) {
|
|
2665
|
+
return obj;
|
|
2666
|
+
}
|
|
2667
|
+
visited.add(obj);
|
|
2668
|
+
}
|
|
2610
2669
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
2611
2670
|
for (const prop in obj) {
|
|
2612
2671
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2613
2672
|
continue;
|
|
2614
2673
|
const objProp = obj[prop];
|
|
2615
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
2674
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
2616
2675
|
continue;
|
|
2676
|
+
}
|
|
2617
2677
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2618
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2678
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
2619
2679
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2620
2680
|
o[prop] = (options.window || import_globals3.window).eval("(" + objProp.toString() + ")");
|
|
2621
|
-
} else
|
|
2681
|
+
} else {
|
|
2622
2682
|
o[prop] = objProp;
|
|
2683
|
+
}
|
|
2623
2684
|
}
|
|
2624
2685
|
return o;
|
|
2625
2686
|
};
|
|
@@ -2796,7 +2857,7 @@ var require_cjs3 = __commonJS({
|
|
|
2796
2857
|
};
|
|
2797
2858
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
2798
2859
|
try {
|
|
2799
|
-
return import_globals3.window.eval("(" + str + ")");
|
|
2860
|
+
return str ? import_globals3.window.eval("(" + str + ")") : {};
|
|
2800
2861
|
} catch (e) {
|
|
2801
2862
|
if (opts.verbose)
|
|
2802
2863
|
console.warn(e);
|
|
@@ -2876,20 +2937,27 @@ var require_cjs3 = __commonJS({
|
|
|
2876
2937
|
return acc;
|
|
2877
2938
|
}, deletedValues);
|
|
2878
2939
|
};
|
|
2879
|
-
var overwrite = (element, params,
|
|
2880
|
-
const { ref } = element;
|
|
2881
|
-
const
|
|
2940
|
+
var overwrite = (element, params, opts = {}) => {
|
|
2941
|
+
const { __ref: ref } = element;
|
|
2942
|
+
const excl = opts.exclude || [];
|
|
2943
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
2944
|
+
const preventCaching = opts.preventCaching;
|
|
2882
2945
|
for (const e in params) {
|
|
2883
|
-
if (
|
|
2946
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
2884
2947
|
continue;
|
|
2885
2948
|
const elementProp = element[e];
|
|
2886
2949
|
const paramsProp = params[e];
|
|
2887
|
-
if (paramsProp) {
|
|
2888
|
-
|
|
2889
|
-
ref
|
|
2950
|
+
if (paramsProp !== void 0) {
|
|
2951
|
+
element[e] = paramsProp;
|
|
2952
|
+
if (ref && !preventCaching) {
|
|
2953
|
+
ref.__cache[e] = elementProp;
|
|
2954
|
+
}
|
|
2955
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
2956
|
+
diff[e] = elementProp;
|
|
2957
|
+
}
|
|
2890
2958
|
}
|
|
2891
2959
|
}
|
|
2892
|
-
return
|
|
2960
|
+
return element;
|
|
2893
2961
|
};
|
|
2894
2962
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
2895
2963
|
for (const e in params) {
|
|
@@ -2899,23 +2967,26 @@ var require_cjs3 = __commonJS({
|
|
|
2899
2967
|
}
|
|
2900
2968
|
return obj;
|
|
2901
2969
|
};
|
|
2902
|
-
var overwriteDeep2 = (obj, params,
|
|
2970
|
+
var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2971
|
+
const excl = opts.exclude || [];
|
|
2972
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
2903
2973
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2904
2974
|
return params;
|
|
2905
2975
|
}
|
|
2906
|
-
if (visited.has(obj))
|
|
2976
|
+
if (visited.has(obj))
|
|
2907
2977
|
return visited.get(obj);
|
|
2908
|
-
}
|
|
2909
2978
|
visited.set(obj, obj);
|
|
2910
2979
|
for (const e in params) {
|
|
2911
|
-
if (
|
|
2980
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
2981
|
+
continue;
|
|
2982
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
2912
2983
|
continue;
|
|
2913
2984
|
const objProp = obj[e];
|
|
2914
2985
|
const paramsProp = params[e];
|
|
2915
2986
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2916
2987
|
obj[e] = paramsProp;
|
|
2917
2988
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2918
|
-
obj[e] = overwriteDeep2(objProp, paramsProp,
|
|
2989
|
+
obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
|
|
2919
2990
|
} else if (paramsProp !== void 0) {
|
|
2920
2991
|
obj[e] = paramsProp;
|
|
2921
2992
|
}
|
|
@@ -3078,6 +3149,30 @@ var require_cjs3 = __commonJS({
|
|
|
3078
3149
|
}
|
|
3079
3150
|
}
|
|
3080
3151
|
};
|
|
3152
|
+
var isCyclic = (obj) => {
|
|
3153
|
+
const seenObjects = [];
|
|
3154
|
+
function detect(obj2) {
|
|
3155
|
+
if (obj2 && typeof obj2 === "object") {
|
|
3156
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
3157
|
+
return true;
|
|
3158
|
+
}
|
|
3159
|
+
seenObjects.push(obj2);
|
|
3160
|
+
for (const key in obj2) {
|
|
3161
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
3162
|
+
console.log(obj2, "cycle at " + key);
|
|
3163
|
+
return true;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
return false;
|
|
3168
|
+
}
|
|
3169
|
+
return detect(obj);
|
|
3170
|
+
};
|
|
3171
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
3172
|
+
const result = { ...obj };
|
|
3173
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
3174
|
+
return result;
|
|
3175
|
+
};
|
|
3081
3176
|
}
|
|
3082
3177
|
});
|
|
3083
3178
|
var require_function2 = __commonJS2({
|
|
@@ -3487,6 +3582,8 @@ var require_cjs3 = __commonJS({
|
|
|
3487
3582
|
return /^[a-z]*$/.test(firstCharKey);
|
|
3488
3583
|
};
|
|
3489
3584
|
var addAdditionalExtend = (newExtend, element) => {
|
|
3585
|
+
if (!newExtend)
|
|
3586
|
+
return element;
|
|
3490
3587
|
const { extend: elementExtend } = element;
|
|
3491
3588
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3492
3589
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -3494,8 +3591,23 @@ var require_cjs3 = __commonJS({
|
|
|
3494
3591
|
return { ...element, extend };
|
|
3495
3592
|
};
|
|
3496
3593
|
var checkIfSugar = (element, parent, key) => {
|
|
3497
|
-
const {
|
|
3594
|
+
const {
|
|
3595
|
+
extend,
|
|
3596
|
+
props,
|
|
3597
|
+
childExtend,
|
|
3598
|
+
extends: extendProps,
|
|
3599
|
+
childrenExtends,
|
|
3600
|
+
childProps,
|
|
3601
|
+
children,
|
|
3602
|
+
on,
|
|
3603
|
+
$collection,
|
|
3604
|
+
$stateCollection,
|
|
3605
|
+
$propsCollection
|
|
3606
|
+
} = element;
|
|
3498
3607
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3608
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
|
|
3609
|
+
element.error("Sugar component includes params for builtin components");
|
|
3610
|
+
}
|
|
3499
3611
|
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
3500
3612
|
};
|
|
3501
3613
|
var extendizeByKey = (element, parent, key) => {
|
|
@@ -3507,11 +3619,11 @@ var require_cjs3 = __commonJS({
|
|
|
3507
3619
|
if (element === isExtendKeyComponent)
|
|
3508
3620
|
return element;
|
|
3509
3621
|
else if (isSugar) {
|
|
3510
|
-
const newElem = {
|
|
3622
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
3511
3623
|
extend: extendFromKey,
|
|
3512
3624
|
tag,
|
|
3513
3625
|
props: { ...element }
|
|
3514
|
-
};
|
|
3626
|
+
});
|
|
3515
3627
|
if (childrenExtends)
|
|
3516
3628
|
newElem.childExtend = childrenExtends;
|
|
3517
3629
|
return newElem;
|