@symbo.ls/utils 2.11.453 → 2.11.470
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/index.js +55 -26
- package/dist/cjs/scaling.js +55 -26
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -768,10 +768,10 @@ var require_object = __commonJS({
|
|
|
768
768
|
return o;
|
|
769
769
|
};
|
|
770
770
|
var deepStringify = (obj, stringified = {}) => {
|
|
771
|
-
var _a;
|
|
771
|
+
var _a, _b;
|
|
772
772
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
773
|
-
|
|
774
|
-
obj = (
|
|
773
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
774
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
775
775
|
}
|
|
776
776
|
for (const prop in obj) {
|
|
777
777
|
const objProp = obj[prop];
|
|
@@ -841,7 +841,7 @@ var require_object = __commonJS({
|
|
|
841
841
|
if ((0, import_types.isArray)(value)) {
|
|
842
842
|
str += "[\n";
|
|
843
843
|
for (const element of value) {
|
|
844
|
-
if ((0, import_types.
|
|
844
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
845
845
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
846
846
|
`;
|
|
847
847
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -1411,9 +1411,11 @@ var require_cookie = __commonJS({
|
|
|
1411
1411
|
var cookie_exports = {};
|
|
1412
1412
|
__export2(cookie_exports, {
|
|
1413
1413
|
getCookie: () => getCookie,
|
|
1414
|
+
getLocalStorage: () => getLocalStorage,
|
|
1414
1415
|
isMobile: () => isMobile,
|
|
1415
1416
|
removeCookie: () => removeCookie,
|
|
1416
|
-
setCookie: () => setCookie
|
|
1417
|
+
setCookie: () => setCookie,
|
|
1418
|
+
setLocalStorage: () => setLocalStorage
|
|
1417
1419
|
});
|
|
1418
1420
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
1419
1421
|
var import_types = require_types();
|
|
@@ -1447,6 +1449,27 @@ var require_cookie = __commonJS({
|
|
|
1447
1449
|
return;
|
|
1448
1450
|
import_utils3.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1449
1451
|
};
|
|
1452
|
+
function getLocalStorage(key) {
|
|
1453
|
+
let savedJSON;
|
|
1454
|
+
if (window.localStorage) {
|
|
1455
|
+
try {
|
|
1456
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
1457
|
+
} catch (e) {
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (typeof savedJSON !== "undefined") {
|
|
1461
|
+
return savedJSON;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
function setLocalStorage(key, data) {
|
|
1465
|
+
if (data && window.localStorage) {
|
|
1466
|
+
if (typeof data === "object") {
|
|
1467
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
1468
|
+
} else {
|
|
1469
|
+
window.localStorage.setItem(key, data);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1450
1473
|
}
|
|
1451
1474
|
});
|
|
1452
1475
|
|
|
@@ -1650,7 +1673,9 @@ var require_component = __commonJS({
|
|
|
1650
1673
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1651
1674
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1652
1675
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1676
|
+
checkIfSugar: () => checkIfSugar,
|
|
1653
1677
|
extendizeByKey: () => extendizeByKey,
|
|
1678
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1654
1679
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1655
1680
|
getExtendsInElement: () => getExtendsInElement,
|
|
1656
1681
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -1684,12 +1709,13 @@ var require_component = __commonJS({
|
|
|
1684
1709
|
return { ...element, extend };
|
|
1685
1710
|
};
|
|
1686
1711
|
var checkIfSugar = (element, parent, key) => {
|
|
1712
|
+
var _a;
|
|
1687
1713
|
const {
|
|
1688
1714
|
extend,
|
|
1689
1715
|
props,
|
|
1690
1716
|
childExtend,
|
|
1691
1717
|
extends: extendProps,
|
|
1692
|
-
|
|
1718
|
+
childExtends,
|
|
1693
1719
|
childProps,
|
|
1694
1720
|
children,
|
|
1695
1721
|
on,
|
|
@@ -1698,15 +1724,17 @@ var require_component = __commonJS({
|
|
|
1698
1724
|
$propsCollection
|
|
1699
1725
|
} = element;
|
|
1700
1726
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1701
|
-
if (hasComponentAttrs && (childProps || extendProps || children ||
|
|
1702
|
-
|
|
1727
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
1728
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
1729
|
+
if (logErr)
|
|
1730
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
1703
1731
|
}
|
|
1704
|
-
return !hasComponentAttrs || childProps || extendProps || children ||
|
|
1732
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1705
1733
|
};
|
|
1706
1734
|
var extendizeByKey = (element, parent, key) => {
|
|
1707
1735
|
const { context } = parent;
|
|
1708
|
-
const { tag, extend,
|
|
1709
|
-
const isSugar = checkIfSugar(element);
|
|
1736
|
+
const { tag, extend, childExtends } = element;
|
|
1737
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
1710
1738
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1711
1739
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1712
1740
|
if (element === isExtendKeyComponent)
|
|
@@ -1717,8 +1745,8 @@ var require_component = __commonJS({
|
|
|
1717
1745
|
tag,
|
|
1718
1746
|
props: { ...element }
|
|
1719
1747
|
});
|
|
1720
|
-
if (
|
|
1721
|
-
newElem.childExtend =
|
|
1748
|
+
if (childExtends)
|
|
1749
|
+
newElem.childExtend = childExtends;
|
|
1722
1750
|
return newElem;
|
|
1723
1751
|
} else if (!extend || extend === true) {
|
|
1724
1752
|
return {
|
|
@@ -1747,23 +1775,24 @@ var require_component = __commonJS({
|
|
|
1747
1775
|
const childKey = childElems[i];
|
|
1748
1776
|
const childElem = element[childKey];
|
|
1749
1777
|
const newChild = element.props[childKey];
|
|
1778
|
+
const assignChild = (val) => {
|
|
1779
|
+
element[childKey] = val;
|
|
1780
|
+
delete element.props[childKey];
|
|
1781
|
+
};
|
|
1750
1782
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1751
1783
|
continue;
|
|
1752
|
-
if (
|
|
1753
|
-
|
|
1784
|
+
if (newChild === null)
|
|
1785
|
+
assignChild(null);
|
|
1786
|
+
else if (!childElem)
|
|
1787
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
1754
1788
|
else {
|
|
1755
|
-
const
|
|
1756
|
-
if (
|
|
1789
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1790
|
+
if (isSugarChildElem)
|
|
1757
1791
|
continue;
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
}
|
|
1762
|
-
element[childKey] = {
|
|
1763
|
-
extend: element[childKey],
|
|
1764
|
-
props: newChild
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1792
|
+
assignChild({
|
|
1793
|
+
extend: element[childKey],
|
|
1794
|
+
props: newChild
|
|
1795
|
+
});
|
|
1767
1796
|
}
|
|
1768
1797
|
}
|
|
1769
1798
|
};
|
package/dist/cjs/scaling.js
CHANGED
|
@@ -768,10 +768,10 @@ var require_object = __commonJS({
|
|
|
768
768
|
return o;
|
|
769
769
|
};
|
|
770
770
|
var deepStringify = (obj, stringified = {}) => {
|
|
771
|
-
var _a;
|
|
771
|
+
var _a, _b;
|
|
772
772
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
773
|
-
|
|
774
|
-
obj = (
|
|
773
|
+
(obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
|
|
774
|
+
obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
|
|
775
775
|
}
|
|
776
776
|
for (const prop in obj) {
|
|
777
777
|
const objProp = obj[prop];
|
|
@@ -841,7 +841,7 @@ var require_object = __commonJS({
|
|
|
841
841
|
if ((0, import_types.isArray)(value)) {
|
|
842
842
|
str += "[\n";
|
|
843
843
|
for (const element of value) {
|
|
844
|
-
if ((0, import_types.
|
|
844
|
+
if ((0, import_types.isObjectLike)(element) && element !== null) {
|
|
845
845
|
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
846
846
|
`;
|
|
847
847
|
} else if ((0, import_types.isString)(element)) {
|
|
@@ -1411,9 +1411,11 @@ var require_cookie = __commonJS({
|
|
|
1411
1411
|
var cookie_exports = {};
|
|
1412
1412
|
__export2(cookie_exports, {
|
|
1413
1413
|
getCookie: () => getCookie,
|
|
1414
|
+
getLocalStorage: () => getLocalStorage,
|
|
1414
1415
|
isMobile: () => isMobile,
|
|
1415
1416
|
removeCookie: () => removeCookie,
|
|
1416
|
-
setCookie: () => setCookie
|
|
1417
|
+
setCookie: () => setCookie,
|
|
1418
|
+
setLocalStorage: () => setLocalStorage
|
|
1417
1419
|
});
|
|
1418
1420
|
module2.exports = __toCommonJS2(cookie_exports);
|
|
1419
1421
|
var import_types = require_types();
|
|
@@ -1447,6 +1449,27 @@ var require_cookie = __commonJS({
|
|
|
1447
1449
|
return;
|
|
1448
1450
|
import_utils2.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1449
1451
|
};
|
|
1452
|
+
function getLocalStorage(key) {
|
|
1453
|
+
let savedJSON;
|
|
1454
|
+
if (window.localStorage) {
|
|
1455
|
+
try {
|
|
1456
|
+
savedJSON = JSON.parse(window.localStorage.getItem(key));
|
|
1457
|
+
} catch (e) {
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (typeof savedJSON !== "undefined") {
|
|
1461
|
+
return savedJSON;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
function setLocalStorage(key, data) {
|
|
1465
|
+
if (data && window.localStorage) {
|
|
1466
|
+
if (typeof data === "object") {
|
|
1467
|
+
window.localStorage.setItem(key, JSON.stringify(data));
|
|
1468
|
+
} else {
|
|
1469
|
+
window.localStorage.setItem(key, data);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1450
1473
|
}
|
|
1451
1474
|
});
|
|
1452
1475
|
|
|
@@ -1650,7 +1673,9 @@ var require_component = __commonJS({
|
|
|
1650
1673
|
applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
|
|
1651
1674
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
1652
1675
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
1676
|
+
checkIfSugar: () => checkIfSugar,
|
|
1653
1677
|
extendizeByKey: () => extendizeByKey,
|
|
1678
|
+
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
1654
1679
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
1655
1680
|
getExtendsInElement: () => getExtendsInElement,
|
|
1656
1681
|
hasVariantProp: () => hasVariantProp,
|
|
@@ -1684,12 +1709,13 @@ var require_component = __commonJS({
|
|
|
1684
1709
|
return { ...element, extend };
|
|
1685
1710
|
};
|
|
1686
1711
|
var checkIfSugar = (element, parent, key) => {
|
|
1712
|
+
var _a;
|
|
1687
1713
|
const {
|
|
1688
1714
|
extend,
|
|
1689
1715
|
props,
|
|
1690
1716
|
childExtend,
|
|
1691
1717
|
extends: extendProps,
|
|
1692
|
-
|
|
1718
|
+
childExtends,
|
|
1693
1719
|
childProps,
|
|
1694
1720
|
children,
|
|
1695
1721
|
on,
|
|
@@ -1698,15 +1724,17 @@ var require_component = __commonJS({
|
|
|
1698
1724
|
$propsCollection
|
|
1699
1725
|
} = element;
|
|
1700
1726
|
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
|
|
1701
|
-
if (hasComponentAttrs && (childProps || extendProps || children ||
|
|
1702
|
-
|
|
1727
|
+
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
|
|
1728
|
+
const logErr = (_a = parent || element) == null ? void 0 : _a.error;
|
|
1729
|
+
if (logErr)
|
|
1730
|
+
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
|
|
1703
1731
|
}
|
|
1704
|
-
return !hasComponentAttrs || childProps || extendProps || children ||
|
|
1732
|
+
return !hasComponentAttrs || childProps || extendProps || children || childExtends;
|
|
1705
1733
|
};
|
|
1706
1734
|
var extendizeByKey = (element, parent, key) => {
|
|
1707
1735
|
const { context } = parent;
|
|
1708
|
-
const { tag, extend,
|
|
1709
|
-
const isSugar = checkIfSugar(element);
|
|
1736
|
+
const { tag, extend, childExtends } = element;
|
|
1737
|
+
const isSugar = checkIfSugar(element, parent, key);
|
|
1710
1738
|
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
|
|
1711
1739
|
const isExtendKeyComponent = context && context.components[extendFromKey];
|
|
1712
1740
|
if (element === isExtendKeyComponent)
|
|
@@ -1717,8 +1745,8 @@ var require_component = __commonJS({
|
|
|
1717
1745
|
tag,
|
|
1718
1746
|
props: { ...element }
|
|
1719
1747
|
});
|
|
1720
|
-
if (
|
|
1721
|
-
newElem.childExtend =
|
|
1748
|
+
if (childExtends)
|
|
1749
|
+
newElem.childExtend = childExtends;
|
|
1722
1750
|
return newElem;
|
|
1723
1751
|
} else if (!extend || extend === true) {
|
|
1724
1752
|
return {
|
|
@@ -1747,23 +1775,24 @@ var require_component = __commonJS({
|
|
|
1747
1775
|
const childKey = childElems[i];
|
|
1748
1776
|
const childElem = element[childKey];
|
|
1749
1777
|
const newChild = element.props[childKey];
|
|
1778
|
+
const assignChild = (val) => {
|
|
1779
|
+
element[childKey] = val;
|
|
1780
|
+
delete element.props[childKey];
|
|
1781
|
+
};
|
|
1750
1782
|
if (newChild == null ? void 0 : newChild.ignoreExtend)
|
|
1751
1783
|
continue;
|
|
1752
|
-
if (
|
|
1753
|
-
|
|
1784
|
+
if (newChild === null)
|
|
1785
|
+
assignChild(null);
|
|
1786
|
+
else if (!childElem)
|
|
1787
|
+
assignChild((0, import__.deepCloneWithExtend)(newChild));
|
|
1754
1788
|
else {
|
|
1755
|
-
const
|
|
1756
|
-
if (
|
|
1789
|
+
const isSugarChildElem = checkIfSugar(childElem, parent, key);
|
|
1790
|
+
if (isSugarChildElem)
|
|
1757
1791
|
continue;
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
}
|
|
1762
|
-
element[childKey] = {
|
|
1763
|
-
extend: element[childKey],
|
|
1764
|
-
props: newChild
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1792
|
+
assignChild({
|
|
1793
|
+
extend: element[childKey],
|
|
1794
|
+
props: newChild
|
|
1795
|
+
});
|
|
1767
1796
|
}
|
|
1768
1797
|
}
|
|
1769
1798
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.470",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@domql/utils": "^2.5.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "726524dbb01cfa6ead1c95bd8f930a85169c70fe"
|
|
30
30
|
}
|