@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
|
@@ -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;
|
|
@@ -2145,6 +2187,8 @@ var require_cjs2 = __commonJS({
|
|
|
2145
2187
|
arraysEqual: () => arraysEqual,
|
|
2146
2188
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
2147
2189
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
2190
|
+
filterArrays: () => filterArrays,
|
|
2191
|
+
filterArraysFast: () => filterArraysFast,
|
|
2148
2192
|
getFrequencyInArray: () => getFrequencyInArray,
|
|
2149
2193
|
joinArrays: () => joinArrays,
|
|
2150
2194
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
@@ -2253,6 +2297,13 @@ var require_cjs2 = __commonJS({
|
|
|
2253
2297
|
}
|
|
2254
2298
|
return true;
|
|
2255
2299
|
};
|
|
2300
|
+
var filterArrays = (sourceArr, excludeArr) => {
|
|
2301
|
+
return sourceArr.filter((item) => !excludeArr.includes(item));
|
|
2302
|
+
};
|
|
2303
|
+
var filterArraysFast = (sourceArr, excludeArr) => {
|
|
2304
|
+
const excludeSet = new Set(excludeArr);
|
|
2305
|
+
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
2306
|
+
};
|
|
2256
2307
|
}
|
|
2257
2308
|
});
|
|
2258
2309
|
var require_string2 = __commonJS2({
|
|
@@ -2442,9 +2493,11 @@ var require_cjs2 = __commonJS({
|
|
|
2442
2493
|
diff: () => diff,
|
|
2443
2494
|
diffArrays: () => diffArrays,
|
|
2444
2495
|
diffObjects: () => diffObjects,
|
|
2496
|
+
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
2445
2497
|
exec: () => exec,
|
|
2446
2498
|
flattenRecursive: () => flattenRecursive,
|
|
2447
2499
|
hasOwnProperty: () => hasOwnProperty,
|
|
2500
|
+
isCyclic: () => isCyclic,
|
|
2448
2501
|
isEmpty: () => isEmpty,
|
|
2449
2502
|
isEmptyObject: () => isEmptyObject,
|
|
2450
2503
|
isEqualDeep: () => isEqualDeep,
|
|
@@ -2570,20 +2623,28 @@ var require_cjs2 = __commonJS({
|
|
|
2570
2623
|
}
|
|
2571
2624
|
return clone2;
|
|
2572
2625
|
};
|
|
2573
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
2626
|
+
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
2627
|
+
if ((0, import_types.isObjectLike)(obj)) {
|
|
2628
|
+
if (visited.has(obj)) {
|
|
2629
|
+
return obj;
|
|
2630
|
+
}
|
|
2631
|
+
visited.add(obj);
|
|
2632
|
+
}
|
|
2574
2633
|
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
2575
2634
|
for (const prop in obj) {
|
|
2576
2635
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2577
2636
|
continue;
|
|
2578
2637
|
const objProp = obj[prop];
|
|
2579
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
|
|
2638
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
|
|
2580
2639
|
continue;
|
|
2640
|
+
}
|
|
2581
2641
|
if ((0, import_types.isObjectLike)(objProp)) {
|
|
2582
|
-
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
|
|
2642
|
+
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options, visited);
|
|
2583
2643
|
} else if ((0, import_types.isFunction)(objProp) && options.window) {
|
|
2584
2644
|
o[prop] = (options.window || import_globals.window).eval("(" + objProp.toString() + ")");
|
|
2585
|
-
} else
|
|
2645
|
+
} else {
|
|
2586
2646
|
o[prop] = objProp;
|
|
2647
|
+
}
|
|
2587
2648
|
}
|
|
2588
2649
|
return o;
|
|
2589
2650
|
};
|
|
@@ -2760,7 +2821,7 @@ var require_cjs2 = __commonJS({
|
|
|
2760
2821
|
};
|
|
2761
2822
|
var stringToObject = (str, opts = { verbose: true }) => {
|
|
2762
2823
|
try {
|
|
2763
|
-
return import_globals.window.eval("(" + str + ")");
|
|
2824
|
+
return str ? import_globals.window.eval("(" + str + ")") : {};
|
|
2764
2825
|
} catch (e) {
|
|
2765
2826
|
if (opts.verbose)
|
|
2766
2827
|
console.warn(e);
|
|
@@ -2840,20 +2901,27 @@ var require_cjs2 = __commonJS({
|
|
|
2840
2901
|
return acc;
|
|
2841
2902
|
}, deletedValues);
|
|
2842
2903
|
};
|
|
2843
|
-
var overwrite = (element, params,
|
|
2844
|
-
const { ref } = element;
|
|
2845
|
-
const
|
|
2904
|
+
var overwrite = (element, params, opts = {}) => {
|
|
2905
|
+
const { __ref: ref } = element;
|
|
2906
|
+
const excl = opts.exclude || [];
|
|
2907
|
+
const allowUnderscore = opts.preventUnderscore;
|
|
2908
|
+
const preventCaching = opts.preventCaching;
|
|
2846
2909
|
for (const e in params) {
|
|
2847
|
-
if (
|
|
2910
|
+
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
|
|
2848
2911
|
continue;
|
|
2849
2912
|
const elementProp = element[e];
|
|
2850
2913
|
const paramsProp = params[e];
|
|
2851
|
-
if (paramsProp) {
|
|
2852
|
-
|
|
2853
|
-
ref
|
|
2914
|
+
if (paramsProp !== void 0) {
|
|
2915
|
+
element[e] = paramsProp;
|
|
2916
|
+
if (ref && !preventCaching) {
|
|
2917
|
+
ref.__cache[e] = elementProp;
|
|
2918
|
+
}
|
|
2919
|
+
if ((0, import_types.isObject)(opts.diff)) {
|
|
2920
|
+
diff[e] = elementProp;
|
|
2921
|
+
}
|
|
2854
2922
|
}
|
|
2855
2923
|
}
|
|
2856
|
-
return
|
|
2924
|
+
return element;
|
|
2857
2925
|
};
|
|
2858
2926
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
2859
2927
|
for (const e in params) {
|
|
@@ -2863,23 +2931,26 @@ var require_cjs2 = __commonJS({
|
|
|
2863
2931
|
}
|
|
2864
2932
|
return obj;
|
|
2865
2933
|
};
|
|
2866
|
-
var overwriteDeep = (obj, params,
|
|
2934
|
+
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
2935
|
+
const excl = opts.exclude || [];
|
|
2936
|
+
const forcedExclude = opts.preventForce ? [] : ["node", "window"];
|
|
2867
2937
|
if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
|
|
2868
2938
|
return params;
|
|
2869
2939
|
}
|
|
2870
|
-
if (visited.has(obj))
|
|
2940
|
+
if (visited.has(obj))
|
|
2871
2941
|
return visited.get(obj);
|
|
2872
|
-
}
|
|
2873
2942
|
visited.set(obj, obj);
|
|
2874
2943
|
for (const e in params) {
|
|
2875
|
-
if (
|
|
2944
|
+
if (!Object.hasOwnProperty.call(params, e))
|
|
2945
|
+
continue;
|
|
2946
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
2876
2947
|
continue;
|
|
2877
2948
|
const objProp = obj[e];
|
|
2878
2949
|
const paramsProp = params[e];
|
|
2879
2950
|
if ((0, import_node.isDOMNode)(paramsProp)) {
|
|
2880
2951
|
obj[e] = paramsProp;
|
|
2881
2952
|
} else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
2882
|
-
obj[e] = overwriteDeep(objProp, paramsProp,
|
|
2953
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
2883
2954
|
} else if (paramsProp !== void 0) {
|
|
2884
2955
|
obj[e] = paramsProp;
|
|
2885
2956
|
}
|
|
@@ -3042,6 +3113,30 @@ var require_cjs2 = __commonJS({
|
|
|
3042
3113
|
}
|
|
3043
3114
|
}
|
|
3044
3115
|
};
|
|
3116
|
+
var isCyclic = (obj) => {
|
|
3117
|
+
const seenObjects = [];
|
|
3118
|
+
function detect(obj2) {
|
|
3119
|
+
if (obj2 && typeof obj2 === "object") {
|
|
3120
|
+
if (seenObjects.indexOf(obj2) !== -1) {
|
|
3121
|
+
return true;
|
|
3122
|
+
}
|
|
3123
|
+
seenObjects.push(obj2);
|
|
3124
|
+
for (const key in obj2) {
|
|
3125
|
+
if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
|
|
3126
|
+
console.log(obj2, "cycle at " + key);
|
|
3127
|
+
return true;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
return false;
|
|
3132
|
+
}
|
|
3133
|
+
return detect(obj);
|
|
3134
|
+
};
|
|
3135
|
+
var excludeKeysFromObject = (obj, excludedKeys) => {
|
|
3136
|
+
const result = { ...obj };
|
|
3137
|
+
excludedKeys.forEach((key) => delete result[key]);
|
|
3138
|
+
return result;
|
|
3139
|
+
};
|
|
3045
3140
|
}
|
|
3046
3141
|
});
|
|
3047
3142
|
var require_function2 = __commonJS2({
|
|
@@ -3451,6 +3546,8 @@ var require_cjs2 = __commonJS({
|
|
|
3451
3546
|
return /^[a-z]*$/.test(firstCharKey);
|
|
3452
3547
|
};
|
|
3453
3548
|
var addAdditionalExtend = (newExtend, element) => {
|
|
3549
|
+
if (!newExtend)
|
|
3550
|
+
return element;
|
|
3454
3551
|
const { extend: elementExtend } = element;
|
|
3455
3552
|
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
|
|
3456
3553
|
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
|
|
@@ -3458,8 +3555,23 @@ var require_cjs2 = __commonJS({
|
|
|
3458
3555
|
return { ...element, extend };
|
|
3459
3556
|
};
|
|
3460
3557
|
var checkIfSugar = (element, parent, key) => {
|
|
3461
|
-
const {
|
|
3558
|
+
const {
|
|
3559
|
+
extend,
|
|
3560
|
+
props,
|
|
3561
|
+
childExtend,
|
|
3562
|
+
extends: extendProps,
|
|
3563
|
+
childrenExtends,
|
|
3564
|
+
childProps,
|
|
3565
|
+
children,
|
|
3566
|
+
on,
|
|
3567
|
+
$collection,
|
|
3568
|
+
$stateCollection,
|
|
3569
|
+
$propsCollection
|
|
3570
|
+
} = element;
|
|
3462
3571
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
3572
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
|
|
3573
|
+
element.error("Sugar component includes params for builtin components");
|
|
3574
|
+
}
|
|
3463
3575
|
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
|
|
3464
3576
|
};
|
|
3465
3577
|
var extendizeByKey = (element, parent, key) => {
|
|
@@ -3471,11 +3583,11 @@ var require_cjs2 = __commonJS({
|
|
|
3471
3583
|
if (element === isExtendKeyComponent)
|
|
3472
3584
|
return element;
|
|
3473
3585
|
else if (isSugar) {
|
|
3474
|
-
const newElem = {
|
|
3586
|
+
const newElem = addAdditionalExtend(element.extends, {
|
|
3475
3587
|
extend: extendFromKey,
|
|
3476
3588
|
tag,
|
|
3477
3589
|
props: { ...element }
|
|
3478
|
-
};
|
|
3590
|
+
});
|
|
3479
3591
|
if (childrenExtends)
|
|
3480
3592
|
newElem.childExtend = childrenExtends;
|
|
3481
3593
|
return newElem;
|
package/dist/cjs/utils/sprite.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;
|