@symbo.ls/scratch 2.33.13 → 2.33.17
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 +168 -74
- package/dist/cjs/set.js +116 -26
- package/dist/cjs/system/index.js +148 -54
- package/dist/cjs/system/shadow.js +115 -17
- package/dist/cjs/system/spacing.js +147 -53
- package/dist/cjs/system/timing.js +101 -6
- package/dist/cjs/system/typography.js +101 -6
- package/dist/cjs/transforms/index.js +155 -120
- package/dist/cjs/utils/index.js +104 -6
- package/dist/cjs/utils/sequence.js +103 -6
- package/dist/cjs/utils/unit.js +53 -0
- package/package.json +4 -4
- package/src/system/spacing.js +61 -54
- package/src/transforms/index.js +21 -29
- package/src/utils/sequence.js +61 -19
- package/src/utils/unit.js +69 -2
package/dist/cjs/system/index.js
CHANGED
|
@@ -319,6 +319,7 @@ __export(system_exports, {
|
|
|
319
319
|
applySpacingSequence: () => applySpacingSequence,
|
|
320
320
|
applyTimingSequence: () => applyTimingSequence,
|
|
321
321
|
applyTypographySequence: () => applyTypographySequence,
|
|
322
|
+
checkIfBoxSize: () => checkIfBoxSize,
|
|
322
323
|
getColor: () => getColor,
|
|
323
324
|
getFontFamily: () => getFontFamily,
|
|
324
325
|
getFontSizeByKey: () => getFontSizeByKey,
|
|
@@ -339,7 +340,8 @@ __export(system_exports, {
|
|
|
339
340
|
setSVG: () => setSVG,
|
|
340
341
|
setShadow: () => setShadow,
|
|
341
342
|
setSvgIcon: () => setSvgIcon,
|
|
342
|
-
setTheme: () => setTheme
|
|
343
|
+
setTheme: () => setTheme,
|
|
344
|
+
splitSpacedValue: () => splitSpacedValue
|
|
343
345
|
});
|
|
344
346
|
module.exports = __toCommonJS(system_exports);
|
|
345
347
|
|
|
@@ -744,6 +746,58 @@ var getActiveConfig = (def) => {
|
|
|
744
746
|
var isScalingUnit = (unit) => {
|
|
745
747
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
746
748
|
};
|
|
749
|
+
var CSS_UNITS = [
|
|
750
|
+
// Absolute
|
|
751
|
+
"px",
|
|
752
|
+
"cm",
|
|
753
|
+
"mm",
|
|
754
|
+
"in",
|
|
755
|
+
"pt",
|
|
756
|
+
"pc",
|
|
757
|
+
// Font-relative
|
|
758
|
+
"em",
|
|
759
|
+
"rem",
|
|
760
|
+
"ex",
|
|
761
|
+
"cap",
|
|
762
|
+
"ch",
|
|
763
|
+
"ic",
|
|
764
|
+
"lh",
|
|
765
|
+
"rlh",
|
|
766
|
+
// Viewport-relative
|
|
767
|
+
"%",
|
|
768
|
+
"vw",
|
|
769
|
+
"vh",
|
|
770
|
+
"vmin",
|
|
771
|
+
"vmax",
|
|
772
|
+
"svw",
|
|
773
|
+
"svh",
|
|
774
|
+
"lvw",
|
|
775
|
+
"lvh",
|
|
776
|
+
"dvw",
|
|
777
|
+
"dvh",
|
|
778
|
+
// Container query units
|
|
779
|
+
"cqw",
|
|
780
|
+
"cqh",
|
|
781
|
+
"cqi",
|
|
782
|
+
"cqb",
|
|
783
|
+
"cqmin",
|
|
784
|
+
"cqmax",
|
|
785
|
+
// Angle
|
|
786
|
+
"deg",
|
|
787
|
+
"rad",
|
|
788
|
+
"grad",
|
|
789
|
+
"turn",
|
|
790
|
+
// Time
|
|
791
|
+
"s",
|
|
792
|
+
"ms",
|
|
793
|
+
// Resolution
|
|
794
|
+
"dpi",
|
|
795
|
+
"dpcm",
|
|
796
|
+
"dppx",
|
|
797
|
+
// Grid fractional
|
|
798
|
+
"fr",
|
|
799
|
+
"auto"
|
|
800
|
+
];
|
|
747
801
|
|
|
748
802
|
// src/utils/color.js
|
|
749
803
|
var colorStringToRgbaArray = (color) => {
|
|
@@ -899,6 +953,12 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
899
953
|
sequenceProps.scales[key] = scaling;
|
|
900
954
|
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
901
955
|
};
|
|
956
|
+
var getFnPrefixAndValue = (val) => {
|
|
957
|
+
if (!val.includes("(")) return val;
|
|
958
|
+
const prefix = val.split("(")[0];
|
|
959
|
+
const value = val.slice(val.indexOf("(") + 1, val.lastIndexOf(")"));
|
|
960
|
+
return [prefix, value];
|
|
961
|
+
};
|
|
902
962
|
var setScalingVar = (key, sequenceProps) => {
|
|
903
963
|
const { base, type, unit } = sequenceProps;
|
|
904
964
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
@@ -994,13 +1054,26 @@ var generateSequence = (sequenceProps) => {
|
|
|
994
1054
|
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
995
1055
|
const CONFIG2 = getActiveConfig();
|
|
996
1056
|
const { UNIT: UNIT2 } = CONFIG2;
|
|
997
|
-
const { sequence, unit = UNIT2.default, useVariable } = sequenceProps;
|
|
998
1057
|
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
999
|
-
const
|
|
1058
|
+
const { sequence, unit = UNIT2.default, useVariable } = sequenceProps;
|
|
1000
1059
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1001
1060
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1002
|
-
|
|
1003
|
-
|
|
1061
|
+
const hasUnits = CSS_UNITS.some((unit2) => value.includes(unit2));
|
|
1062
|
+
if (hasUnits || !startsWithDashOrLetter) return value;
|
|
1063
|
+
const skipArr = [
|
|
1064
|
+
"none",
|
|
1065
|
+
"auto",
|
|
1066
|
+
"max-content",
|
|
1067
|
+
"min-content",
|
|
1068
|
+
"fit-content",
|
|
1069
|
+
"inherit",
|
|
1070
|
+
"initial",
|
|
1071
|
+
"unset",
|
|
1072
|
+
"revert",
|
|
1073
|
+
"revert-layer"
|
|
1074
|
+
];
|
|
1075
|
+
if (skipArr.includes(value)) return value;
|
|
1076
|
+
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1004
1077
|
const letterVal = value.toUpperCase();
|
|
1005
1078
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1006
1079
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1042,14 +1115,38 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1042
1115
|
}
|
|
1043
1116
|
return isNegative + sequenceItem.scaling + unit;
|
|
1044
1117
|
};
|
|
1045
|
-
var
|
|
1118
|
+
var getSequenceValueBySymbols = (value, sequenceProps) => {
|
|
1119
|
+
const mathArr = ["+", "-", "*", "/", ","].filter(
|
|
1120
|
+
(v) => value.includes(v + " ")
|
|
1121
|
+
);
|
|
1122
|
+
if (!mathArr.length) return value;
|
|
1123
|
+
return mathArr.map((symbol) => {
|
|
1124
|
+
const valuesArr = value.split(symbol + " ").map((v) => v.trim());
|
|
1125
|
+
const transformedValues = valuesArr.map((v) => {
|
|
1126
|
+
return getSequenceValue(v, sequenceProps);
|
|
1127
|
+
});
|
|
1128
|
+
return transformedValues.join(symbol + " ");
|
|
1129
|
+
}).join("");
|
|
1130
|
+
};
|
|
1131
|
+
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps, fnPrefix) => {
|
|
1046
1132
|
if (typeof value !== "string") {
|
|
1047
1133
|
const CONFIG2 = getActiveConfig();
|
|
1048
1134
|
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1049
1135
|
return { [propertyName]: value };
|
|
1050
1136
|
}
|
|
1051
1137
|
if (value === "-" || value === "") return {};
|
|
1052
|
-
|
|
1138
|
+
if (!fnPrefix && value.includes("(")) {
|
|
1139
|
+
const fnArr = getFnPrefixAndValue(value);
|
|
1140
|
+
fnPrefix = fnArr[0];
|
|
1141
|
+
value = fnArr[1];
|
|
1142
|
+
}
|
|
1143
|
+
const mathArr = ["+", "-", "*", "/", ","].filter(
|
|
1144
|
+
(v) => value.includes(v + " ")
|
|
1145
|
+
);
|
|
1146
|
+
if (mathArr.length) {
|
|
1147
|
+
value = getSequenceValueBySymbols(value, sequenceProps);
|
|
1148
|
+
} else value = getSequenceValue(value, sequenceProps);
|
|
1149
|
+
return { [propertyName]: fnPrefix ? `${fnPrefix}(${value})` : value };
|
|
1053
1150
|
};
|
|
1054
1151
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
1055
1152
|
var findHeadings = (propertyNames) => {
|
|
@@ -1613,15 +1710,7 @@ var runThroughMedia2 = (FACTORY2) => {
|
|
|
1613
1710
|
const mediaProps = FACTORY2[prop];
|
|
1614
1711
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1615
1712
|
if (!isMediaName) continue;
|
|
1616
|
-
const {
|
|
1617
|
-
type,
|
|
1618
|
-
base,
|
|
1619
|
-
ratio,
|
|
1620
|
-
range,
|
|
1621
|
-
subSequence,
|
|
1622
|
-
h1Matches,
|
|
1623
|
-
unit
|
|
1624
|
-
} = FACTORY2;
|
|
1713
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
1625
1714
|
merge(mediaProps, {
|
|
1626
1715
|
type,
|
|
1627
1716
|
base,
|
|
@@ -1639,6 +1728,12 @@ var runThroughMedia2 = (FACTORY2) => {
|
|
|
1639
1728
|
applyMediaSequenceVars(FACTORY2, prop);
|
|
1640
1729
|
}
|
|
1641
1730
|
};
|
|
1731
|
+
var checkIfBoxSize = (propertyName) => {
|
|
1732
|
+
const prop = propertyName.toLowerCase();
|
|
1733
|
+
const includesWidth = prop.includes("width") || prop.includes("height");
|
|
1734
|
+
const includesBorder = prop.includes("border") || prop.includes("outline");
|
|
1735
|
+
return includesWidth && !includesBorder;
|
|
1736
|
+
};
|
|
1642
1737
|
var applySpacingSequence = () => {
|
|
1643
1738
|
const CONFIG2 = getActiveConfig();
|
|
1644
1739
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
@@ -1653,12 +1748,16 @@ var getSequence = (sequenceProps) => {
|
|
|
1653
1748
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1654
1749
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1655
1750
|
};
|
|
1656
|
-
var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
1751
|
+
var getSpacingByKey = (value, propertyName = "padding", sequenceProps, fnPrefix) => {
|
|
1657
1752
|
const sequence = getSequence(sequenceProps);
|
|
1658
|
-
if (isString(value)
|
|
1659
|
-
|
|
1753
|
+
if (isString(value)) {
|
|
1754
|
+
if (!fnPrefix && value.includes("(")) {
|
|
1755
|
+
const fnArray = getFnPrefixAndValue(value);
|
|
1756
|
+
fnPrefix = fnArray[0];
|
|
1757
|
+
value = fnArray[1];
|
|
1758
|
+
}
|
|
1660
1759
|
}
|
|
1661
|
-
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1760
|
+
const stack = fnPrefix ? [value] : (0, import_utils15.arrayzeValue)(value);
|
|
1662
1761
|
if (!isArray(stack)) return;
|
|
1663
1762
|
if (stack.length > 1) {
|
|
1664
1763
|
let suffix = "";
|
|
@@ -1674,45 +1773,40 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1674
1773
|
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
1675
1774
|
stack[i],
|
|
1676
1775
|
propertyName + direction + suffix,
|
|
1677
|
-
sequence
|
|
1776
|
+
sequence,
|
|
1777
|
+
fnPrefix
|
|
1778
|
+
);
|
|
1779
|
+
return directions[stack.length].map(
|
|
1780
|
+
(dir, key) => wrapSequenceValueByDirection(dir, key)
|
|
1678
1781
|
);
|
|
1679
|
-
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
|
|
1680
1782
|
}
|
|
1681
|
-
return getSequenceValuePropertyPair(
|
|
1682
|
-
value,
|
|
1683
|
-
propertyName,
|
|
1684
|
-
sequence
|
|
1685
|
-
);
|
|
1783
|
+
return getSequenceValuePropertyPair(value, propertyName, sequence, fnPrefix);
|
|
1686
1784
|
};
|
|
1687
|
-
var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
1785
|
+
var getSpacingBasedOnRatio = (props, propertyName, val, fnPrefix) => {
|
|
1688
1786
|
const CONFIG2 = getActiveConfig();
|
|
1689
1787
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
applySequenceVars(sequenceProps, { useDefault: false });
|
|
1713
|
-
return getSpacingByKey(value, propertyName, sequenceProps);
|
|
1714
|
-
}
|
|
1715
|
-
return getSpacingByKey(value, propertyName);
|
|
1788
|
+
let value = val || props[propertyName];
|
|
1789
|
+
if (!fnPrefix && isString(value) && value.includes("(")) {
|
|
1790
|
+
const fnArr = getFnPrefixAndValue(value);
|
|
1791
|
+
fnPrefix = fnArr[0];
|
|
1792
|
+
value = fnArr[1];
|
|
1793
|
+
}
|
|
1794
|
+
if (props.spacingRatio) {
|
|
1795
|
+
const sequenceProps = applyCustomSequence(props);
|
|
1796
|
+
return getSpacingByKey(value, propertyName, sequenceProps, fnPrefix);
|
|
1797
|
+
}
|
|
1798
|
+
return getSpacingByKey(value, propertyName, SPACING2, fnPrefix);
|
|
1799
|
+
};
|
|
1800
|
+
var splitSpacedValue = (val) => {
|
|
1801
|
+
const addDefault = (v) => {
|
|
1802
|
+
const isSymbol = ["+", "-", "*", "/"].includes(v);
|
|
1803
|
+
const hasUnits = CSS_UNITS.some((unit) => val.includes(unit));
|
|
1804
|
+
if (isSymbol || hasUnits) return v;
|
|
1805
|
+
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
1806
|
+
if (isSingleLetter) return v + "_default";
|
|
1807
|
+
return v;
|
|
1808
|
+
};
|
|
1809
|
+
return val.split(",").map((v) => v.trim()).map(addDefault).join(",").split(" ").map(addDefault).join(" ");
|
|
1716
1810
|
};
|
|
1717
1811
|
|
|
1718
1812
|
// src/system/shadow.js
|
|
@@ -681,6 +681,58 @@ var getActiveConfig = (def) => {
|
|
|
681
681
|
var isScalingUnit = (unit) => {
|
|
682
682
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
683
683
|
};
|
|
684
|
+
var CSS_UNITS = [
|
|
685
|
+
// Absolute
|
|
686
|
+
"px",
|
|
687
|
+
"cm",
|
|
688
|
+
"mm",
|
|
689
|
+
"in",
|
|
690
|
+
"pt",
|
|
691
|
+
"pc",
|
|
692
|
+
// Font-relative
|
|
693
|
+
"em",
|
|
694
|
+
"rem",
|
|
695
|
+
"ex",
|
|
696
|
+
"cap",
|
|
697
|
+
"ch",
|
|
698
|
+
"ic",
|
|
699
|
+
"lh",
|
|
700
|
+
"rlh",
|
|
701
|
+
// Viewport-relative
|
|
702
|
+
"%",
|
|
703
|
+
"vw",
|
|
704
|
+
"vh",
|
|
705
|
+
"vmin",
|
|
706
|
+
"vmax",
|
|
707
|
+
"svw",
|
|
708
|
+
"svh",
|
|
709
|
+
"lvw",
|
|
710
|
+
"lvh",
|
|
711
|
+
"dvw",
|
|
712
|
+
"dvh",
|
|
713
|
+
// Container query units
|
|
714
|
+
"cqw",
|
|
715
|
+
"cqh",
|
|
716
|
+
"cqi",
|
|
717
|
+
"cqb",
|
|
718
|
+
"cqmin",
|
|
719
|
+
"cqmax",
|
|
720
|
+
// Angle
|
|
721
|
+
"deg",
|
|
722
|
+
"rad",
|
|
723
|
+
"grad",
|
|
724
|
+
"turn",
|
|
725
|
+
// Time
|
|
726
|
+
"s",
|
|
727
|
+
"ms",
|
|
728
|
+
// Resolution
|
|
729
|
+
"dpi",
|
|
730
|
+
"dpcm",
|
|
731
|
+
"dppx",
|
|
732
|
+
// Grid fractional
|
|
733
|
+
"fr",
|
|
734
|
+
"auto"
|
|
735
|
+
];
|
|
684
736
|
|
|
685
737
|
// src/utils/color.js
|
|
686
738
|
var colorStringToRgbaArray = (color) => {
|
|
@@ -812,6 +864,12 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
812
864
|
sequenceProps.scales[key] = scaling;
|
|
813
865
|
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
814
866
|
};
|
|
867
|
+
var getFnPrefixAndValue = (val) => {
|
|
868
|
+
if (!val.includes("(")) return val;
|
|
869
|
+
const prefix = val.split("(")[0];
|
|
870
|
+
const value = val.slice(val.indexOf("(") + 1, val.lastIndexOf(")"));
|
|
871
|
+
return [prefix, value];
|
|
872
|
+
};
|
|
815
873
|
var setScalingVar = (key, sequenceProps) => {
|
|
816
874
|
const { base, type, unit } = sequenceProps;
|
|
817
875
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
@@ -904,13 +962,26 @@ var generateSequence = (sequenceProps) => {
|
|
|
904
962
|
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
905
963
|
const CONFIG2 = getActiveConfig();
|
|
906
964
|
const { UNIT: UNIT2 } = CONFIG2;
|
|
907
|
-
const { sequence, unit = UNIT2.default, useVariable } = sequenceProps;
|
|
908
965
|
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
909
|
-
const
|
|
966
|
+
const { sequence, unit = UNIT2.default, useVariable } = sequenceProps;
|
|
910
967
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
911
968
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
912
|
-
|
|
913
|
-
|
|
969
|
+
const hasUnits = CSS_UNITS.some((unit2) => value.includes(unit2));
|
|
970
|
+
if (hasUnits || !startsWithDashOrLetter) return value;
|
|
971
|
+
const skipArr = [
|
|
972
|
+
"none",
|
|
973
|
+
"auto",
|
|
974
|
+
"max-content",
|
|
975
|
+
"min-content",
|
|
976
|
+
"fit-content",
|
|
977
|
+
"inherit",
|
|
978
|
+
"initial",
|
|
979
|
+
"unset",
|
|
980
|
+
"revert",
|
|
981
|
+
"revert-layer"
|
|
982
|
+
];
|
|
983
|
+
if (skipArr.includes(value)) return value;
|
|
984
|
+
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
914
985
|
const letterVal = value.toUpperCase();
|
|
915
986
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
916
987
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -952,14 +1023,38 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
952
1023
|
}
|
|
953
1024
|
return isNegative + sequenceItem.scaling + unit;
|
|
954
1025
|
};
|
|
955
|
-
var
|
|
1026
|
+
var getSequenceValueBySymbols = (value, sequenceProps) => {
|
|
1027
|
+
const mathArr = ["+", "-", "*", "/", ","].filter(
|
|
1028
|
+
(v) => value.includes(v + " ")
|
|
1029
|
+
);
|
|
1030
|
+
if (!mathArr.length) return value;
|
|
1031
|
+
return mathArr.map((symbol) => {
|
|
1032
|
+
const valuesArr = value.split(symbol + " ").map((v) => v.trim());
|
|
1033
|
+
const transformedValues = valuesArr.map((v) => {
|
|
1034
|
+
return getSequenceValue(v, sequenceProps);
|
|
1035
|
+
});
|
|
1036
|
+
return transformedValues.join(symbol + " ");
|
|
1037
|
+
}).join("");
|
|
1038
|
+
};
|
|
1039
|
+
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps, fnPrefix) => {
|
|
956
1040
|
if (typeof value !== "string") {
|
|
957
1041
|
const CONFIG2 = getActiveConfig();
|
|
958
1042
|
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
959
1043
|
return { [propertyName]: value };
|
|
960
1044
|
}
|
|
961
1045
|
if (value === "-" || value === "") return {};
|
|
962
|
-
|
|
1046
|
+
if (!fnPrefix && value.includes("(")) {
|
|
1047
|
+
const fnArr = getFnPrefixAndValue(value);
|
|
1048
|
+
fnPrefix = fnArr[0];
|
|
1049
|
+
value = fnArr[1];
|
|
1050
|
+
}
|
|
1051
|
+
const mathArr = ["+", "-", "*", "/", ","].filter(
|
|
1052
|
+
(v) => value.includes(v + " ")
|
|
1053
|
+
);
|
|
1054
|
+
if (mathArr.length) {
|
|
1055
|
+
value = getSequenceValueBySymbols(value, sequenceProps);
|
|
1056
|
+
} else value = getSequenceValue(value, sequenceProps);
|
|
1057
|
+
return { [propertyName]: fnPrefix ? `${fnPrefix}(${value})` : value };
|
|
963
1058
|
};
|
|
964
1059
|
|
|
965
1060
|
// src/utils/sprite.js
|
|
@@ -1007,12 +1102,16 @@ var getSequence = (sequenceProps) => {
|
|
|
1007
1102
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1008
1103
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1009
1104
|
};
|
|
1010
|
-
var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
1105
|
+
var getSpacingByKey = (value, propertyName = "padding", sequenceProps, fnPrefix) => {
|
|
1011
1106
|
const sequence = getSequence(sequenceProps);
|
|
1012
|
-
if (isString(value)
|
|
1013
|
-
|
|
1107
|
+
if (isString(value)) {
|
|
1108
|
+
if (!fnPrefix && value.includes("(")) {
|
|
1109
|
+
const fnArray = getFnPrefixAndValue(value);
|
|
1110
|
+
fnPrefix = fnArray[0];
|
|
1111
|
+
value = fnArray[1];
|
|
1112
|
+
}
|
|
1014
1113
|
}
|
|
1015
|
-
const stack = (0, import_utils9.arrayzeValue)(value);
|
|
1114
|
+
const stack = fnPrefix ? [value] : (0, import_utils9.arrayzeValue)(value);
|
|
1016
1115
|
if (!isArray(stack)) return;
|
|
1017
1116
|
if (stack.length > 1) {
|
|
1018
1117
|
let suffix = "";
|
|
@@ -1028,15 +1127,14 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1028
1127
|
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
1029
1128
|
stack[i],
|
|
1030
1129
|
propertyName + direction + suffix,
|
|
1031
|
-
sequence
|
|
1130
|
+
sequence,
|
|
1131
|
+
fnPrefix
|
|
1132
|
+
);
|
|
1133
|
+
return directions[stack.length].map(
|
|
1134
|
+
(dir, key) => wrapSequenceValueByDirection(dir, key)
|
|
1032
1135
|
);
|
|
1033
|
-
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
|
|
1034
1136
|
}
|
|
1035
|
-
return getSequenceValuePropertyPair(
|
|
1036
|
-
value,
|
|
1037
|
-
propertyName,
|
|
1038
|
-
sequence
|
|
1039
|
-
);
|
|
1137
|
+
return getSequenceValuePropertyPair(value, propertyName, sequence, fnPrefix);
|
|
1040
1138
|
};
|
|
1041
1139
|
|
|
1042
1140
|
// src/system/shadow.js
|