@symbo.ls/scratch 2.11.470 → 2.11.497
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 -72
- package/dist/cjs/index.js +118 -144
- package/dist/cjs/set.js +118 -144
- package/dist/cjs/system/color.js +118 -144
- package/dist/cjs/system/document.js +118 -144
- package/dist/cjs/system/font.js +118 -144
- package/dist/cjs/system/index.js +118 -144
- package/dist/cjs/system/reset.js +118 -144
- package/dist/cjs/system/shadow.js +118 -144
- package/dist/cjs/system/spacing.js +118 -144
- package/dist/cjs/system/svg.js +118 -144
- package/dist/cjs/system/theme.js +118 -144
- package/dist/cjs/system/timing.js +118 -144
- package/dist/cjs/system/typography.js +118 -144
- package/dist/cjs/transforms/index.js +118 -144
- package/dist/cjs/utils/color.js +59 -72
- package/dist/cjs/utils/index.js +118 -144
- package/dist/cjs/utils/sequence.js +118 -144
- package/dist/cjs/utils/sprite.js +59 -72
- package/dist/cjs/utils/var.js +118 -144
- package/package.json +5 -5
package/dist/cjs/utils/sprite.js
CHANGED
|
@@ -300,6 +300,7 @@ var require_array = __commonJS({
|
|
|
300
300
|
addItemAfterEveryElement: () => addItemAfterEveryElement,
|
|
301
301
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
302
302
|
arraysEqual: () => arraysEqual,
|
|
303
|
+
checkIfStringIsInArray: () => checkIfStringIsInArray,
|
|
303
304
|
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
304
305
|
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
305
306
|
filterArrays: () => filterArrays,
|
|
@@ -346,11 +347,11 @@ var require_array = __commonJS({
|
|
|
346
347
|
var joinArrays = (...arrays) => {
|
|
347
348
|
return [].concat(...arrays);
|
|
348
349
|
};
|
|
349
|
-
var mergeArray = (arr,
|
|
350
|
-
return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.
|
|
350
|
+
var mergeArray = (arr, exclude = []) => {
|
|
351
|
+
return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
|
|
351
352
|
};
|
|
352
353
|
var mergeAndCloneIfArray = (obj) => {
|
|
353
|
-
return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.
|
|
354
|
+
return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
|
|
354
355
|
};
|
|
355
356
|
var cutArrayBeforeValue = (arr, value) => {
|
|
356
357
|
const index = arr.indexOf(value);
|
|
@@ -419,6 +420,11 @@ var require_array = __commonJS({
|
|
|
419
420
|
const excludeSet = new Set(excludeArr);
|
|
420
421
|
return sourceArr.filter((item) => !excludeSet.has(item));
|
|
421
422
|
};
|
|
423
|
+
var checkIfStringIsInArray = (string, arr) => {
|
|
424
|
+
if (!string)
|
|
425
|
+
return;
|
|
426
|
+
return arr.filter((v) => string.includes(v)).length;
|
|
427
|
+
};
|
|
422
428
|
}
|
|
423
429
|
});
|
|
424
430
|
|
|
@@ -473,14 +479,15 @@ var require_string = __commonJS({
|
|
|
473
479
|
2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
|
|
474
480
|
3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
|
|
475
481
|
};
|
|
476
|
-
|
|
482
|
+
function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
|
|
477
483
|
if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
|
|
478
484
|
return str;
|
|
479
485
|
const reg = brackRegex[options.bracketsLength || 2];
|
|
486
|
+
const obj = forcedState || this.state || {};
|
|
480
487
|
return str.replace(reg, (_, parentPath, variable) => {
|
|
481
488
|
if (parentPath) {
|
|
482
489
|
const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
|
|
483
|
-
let parentState =
|
|
490
|
+
let parentState = obj;
|
|
484
491
|
for (let i = 0; i < parentLevels; i++) {
|
|
485
492
|
parentState = parentState.parent;
|
|
486
493
|
if (!parentState) {
|
|
@@ -490,11 +497,11 @@ var require_string = __commonJS({
|
|
|
490
497
|
const value = parentState[variable.trim()];
|
|
491
498
|
return value !== void 0 ? `${value}` : "";
|
|
492
499
|
} else {
|
|
493
|
-
const value =
|
|
500
|
+
const value = obj[variable.trim()];
|
|
494
501
|
return value !== void 0 ? `${value}` : "";
|
|
495
502
|
}
|
|
496
503
|
});
|
|
497
|
-
}
|
|
504
|
+
}
|
|
498
505
|
var lowercaseFirstLetter = (inputString) => {
|
|
499
506
|
return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
|
|
500
507
|
};
|
|
@@ -599,8 +606,6 @@ var require_object = __commonJS({
|
|
|
599
606
|
createNestedObject: () => createNestedObject,
|
|
600
607
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
601
608
|
deepClone: () => deepClone2,
|
|
602
|
-
deepCloneExclude: () => deepCloneExclude,
|
|
603
|
-
deepCloneWithExtend: () => deepCloneWithExtend,
|
|
604
609
|
deepContains: () => deepContains,
|
|
605
610
|
deepDestringify: () => deepDestringify,
|
|
606
611
|
deepDiff: () => deepDiff,
|
|
@@ -694,78 +699,56 @@ var require_object = __commonJS({
|
|
|
694
699
|
}
|
|
695
700
|
return o;
|
|
696
701
|
};
|
|
697
|
-
var
|
|
698
|
-
|
|
699
|
-
return obj.map((x) => deepCloneExclude(x, excludeFrom));
|
|
700
|
-
}
|
|
701
|
-
const o = {};
|
|
702
|
-
for (const k in obj) {
|
|
703
|
-
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, k);
|
|
704
|
-
if (!hasOwnProperty2 || excludeFrom.includes(k) || k.startsWith("__"))
|
|
705
|
-
continue;
|
|
706
|
-
let v = obj[k];
|
|
707
|
-
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
708
|
-
v = mergeArrayExclude(v, excludeFrom);
|
|
709
|
-
}
|
|
710
|
-
if ((0, import_types.isArray)(v)) {
|
|
711
|
-
o[k] = v.map((x) => deepCloneExclude(x, excludeFrom));
|
|
712
|
-
} else if ((0, import_types.isObject)(v)) {
|
|
713
|
-
o[k] = deepCloneExclude(v, excludeFrom);
|
|
714
|
-
} else
|
|
715
|
-
o[k] = v;
|
|
716
|
-
}
|
|
717
|
-
return o;
|
|
718
|
-
};
|
|
719
|
-
var mergeArrayExclude = (arr, excl = []) => {
|
|
720
|
-
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
702
|
+
var mergeArrayExclude = (arr, exclude = []) => {
|
|
703
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepClone2(curr, { exclude })), {});
|
|
721
704
|
};
|
|
722
|
-
var deepClone2 = (obj,
|
|
723
|
-
|
|
705
|
+
var deepClone2 = (obj, options = {}) => {
|
|
706
|
+
const {
|
|
707
|
+
exclude = [],
|
|
708
|
+
cleanUndefined = false,
|
|
709
|
+
cleanNull = false,
|
|
710
|
+
window: targetWindow,
|
|
711
|
+
visited = /* @__PURE__ */ new WeakMap(),
|
|
712
|
+
handleExtend = false
|
|
713
|
+
} = options;
|
|
714
|
+
if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj)) {
|
|
724
715
|
return obj;
|
|
725
|
-
|
|
716
|
+
}
|
|
717
|
+
if (visited.has(obj)) {
|
|
726
718
|
return visited.get(obj);
|
|
727
|
-
|
|
719
|
+
}
|
|
720
|
+
const clone2 = targetWindow ? (0, import_types.isArray)(obj) ? new targetWindow.Array() : new targetWindow.Object() : (0, import_types.isArray)(obj) ? [] : {};
|
|
728
721
|
visited.set(obj, clone2);
|
|
729
722
|
for (const key in obj) {
|
|
730
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
return clone2;
|
|
744
|
-
};
|
|
745
|
-
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
746
|
-
if ((0, import_types.isObjectLike)(obj)) {
|
|
747
|
-
if (visited.has(obj)) {
|
|
748
|
-
return obj;
|
|
723
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
724
|
+
continue;
|
|
725
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
726
|
+
continue;
|
|
727
|
+
const value = obj[key];
|
|
728
|
+
if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
|
|
729
|
+
continue;
|
|
730
|
+
if ((0, import_node.isDOMNode)(value)) {
|
|
731
|
+
clone2[key] = value;
|
|
732
|
+
continue;
|
|
749
733
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
753
|
-
for (const prop in obj) {
|
|
754
|
-
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
734
|
+
if (handleExtend && key === "extend" && (0, import_types.isArray)(value)) {
|
|
735
|
+
clone2[key] = (0, import_array.mergeArray)(value, exclude);
|
|
755
736
|
continue;
|
|
756
|
-
|
|
757
|
-
if (
|
|
737
|
+
}
|
|
738
|
+
if ((0, import_types.isFunction)(value) && targetWindow) {
|
|
739
|
+
clone2[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
758
740
|
continue;
|
|
759
741
|
}
|
|
760
|
-
if ((0, import_types.isObjectLike)(
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
742
|
+
if ((0, import_types.isObjectLike)(value)) {
|
|
743
|
+
clone2[key] = deepClone2(value, {
|
|
744
|
+
...options,
|
|
745
|
+
visited
|
|
746
|
+
});
|
|
764
747
|
} else {
|
|
765
|
-
|
|
748
|
+
clone2[key] = value;
|
|
766
749
|
}
|
|
767
750
|
}
|
|
768
|
-
return
|
|
751
|
+
return clone2;
|
|
769
752
|
};
|
|
770
753
|
var deepStringify = (obj, stringified = {}) => {
|
|
771
754
|
var _a, _b;
|
|
@@ -1675,6 +1658,7 @@ var require_component = __commonJS({
|
|
|
1675
1658
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1676
1659
|
checkIfSugar: () => checkIfSugar,
|
|
1677
1660
|
extendizeByKey: () => extendizeByKey,
|
|
1661
|
+
extractComponentKeyFromKey: () => extractComponentKeyFromKey,
|
|
1678
1662
|
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1679
1663
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1680
1664
|
getExtendsInElement: () => getExtendsInElement,
|
|
@@ -1731,11 +1715,14 @@ var require_component = __commonJS({
|
|
|
1731
1715
|
}
|
|
1732
1716
|
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1733
1717
|
};
|
|
1718
|
+
var extractComponentKeyFromKey = (key) => {
|
|
1719
|
+
return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1720
|
+
};
|
|
1734
1721
|
var extendizeByKey = (element, parent, key) => {
|
|
1735
1722
|
const { context } = parent;
|
|
1736
1723
|
const { tag, extend, childExtends } = element;
|
|
1737
1724
|
const isSugar = checkIfSugar(element, parent, key);
|
|
1738
|
-
const extendFromKey =
|
|
1725
|
+
const extendFromKey = extractComponentKeyFromKey(key);
|
|
1739
1726
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1740
1727
|
if (element === isExtendKeyComponent)
|
|
1741
1728
|
return element;
|
|
@@ -1784,7 +1771,7 @@ var require_component = __commonJS({
|
|
|
1784
1771
|
if (newChild === null)
|
|
1785
1772
|
assignChild(null);
|
|
1786
1773
|
else if (!childElem)
|
|
1787
|
-
assignChild((0, import__.
|
|
1774
|
+
assignChild((0, import__.deepClone)(newChild));
|
|
1788
1775
|
else {
|
|
1789
1776
|
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1790
1777
|
if (isSugarChildElem)
|
|
@@ -1855,7 +1842,7 @@ var require_component = __commonJS({
|
|
|
1855
1842
|
if (checkIfKeyIsComponent(key)) {
|
|
1856
1843
|
result.push(key);
|
|
1857
1844
|
}
|
|
1858
|
-
if (key === "extend") {
|
|
1845
|
+
if (key === "extend" || key === "extends") {
|
|
1859
1846
|
if (typeof o[key] === "string") {
|
|
1860
1847
|
result.push(o[key]);
|
|
1861
1848
|
} else if (Array.isArray(o[key])) {
|