@symbo.ls/scratch 3.8.0 → 3.8.6
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/README.md +50 -1
- package/dist/cjs/defaultConfig/index.js +3 -2
- package/dist/cjs/set.js +35 -20
- package/dist/cjs/system/color.js +6 -1
- package/dist/cjs/system/font.js +6 -2
- package/dist/cjs/system/theme.js +184 -0
- package/dist/cjs/utils/font.js +17 -9
- package/dist/esm/defaultConfig/index.js +3 -2
- package/dist/esm/set.js +36 -21
- package/dist/esm/system/color.js +6 -1
- package/dist/esm/system/font.js +6 -2
- package/dist/esm/system/theme.js +184 -0
- package/dist/esm/utils/font.js +17 -9
- package/dist/iife/index.js +273 -47
- package/package.json +3 -3
- package/src/defaultConfig/index.js +1 -1
- package/src/set.js +50 -30
- package/src/system/color.js +7 -1
- package/src/system/font.js +8 -2
- package/src/system/theme.js +68 -0
- package/src/utils/font.js +22 -10
package/dist/iife/index.js
CHANGED
|
@@ -197,6 +197,17 @@ var SmblsScratch = (() => {
|
|
|
197
197
|
}
|
|
198
198
|
return result;
|
|
199
199
|
}
|
|
200
|
+
if (param != null && element?.context?.plugins && (isArray(param) || isObject(param) && !isDOMNode(param))) {
|
|
201
|
+
const plugins = element.context.plugins;
|
|
202
|
+
for (const plugin of plugins) {
|
|
203
|
+
if (plugin.resolveHandler) {
|
|
204
|
+
const resolved = plugin.resolveHandler(param, element);
|
|
205
|
+
if (typeof resolved === "function") {
|
|
206
|
+
return exec(resolved, element, state, context);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
200
211
|
return param;
|
|
201
212
|
};
|
|
202
213
|
merge = (element, obj, excludeFrom = []) => {
|
|
@@ -467,7 +478,6 @@ var SmblsScratch = (() => {
|
|
|
467
478
|
applyTimingSequence: () => applyTimingSequence,
|
|
468
479
|
applyTypographySequence: () => applyTypographySequence,
|
|
469
480
|
breakpoints: () => breakpoints,
|
|
470
|
-
cases: () => cases,
|
|
471
481
|
changeGlobalTheme: () => changeGlobalTheme,
|
|
472
482
|
changeLightness: () => changeLightness,
|
|
473
483
|
checkIfBoxSize: () => checkIfBoxSize,
|
|
@@ -584,7 +594,8 @@ var SmblsScratch = (() => {
|
|
|
584
594
|
transformTransition: () => transformTransition,
|
|
585
595
|
transfromGap: () => transfromGap,
|
|
586
596
|
typography: () => typography,
|
|
587
|
-
unit: () => unit
|
|
597
|
+
unit: () => unit,
|
|
598
|
+
vars: () => vars
|
|
588
599
|
});
|
|
589
600
|
|
|
590
601
|
// src/utils/index.js
|
|
@@ -905,24 +916,28 @@ var SmblsScratch = (() => {
|
|
|
905
916
|
var setFontImport = (url) => `@import url('${url}');`;
|
|
906
917
|
var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
|
|
907
918
|
var setCustomFont = (name, url, weight, options = {}) => {
|
|
908
|
-
const
|
|
909
|
-
const
|
|
919
|
+
const urls = Array.isArray(url) ? url : [url];
|
|
920
|
+
const srcList = urls.map((u) => {
|
|
921
|
+
const format = getFontFormat(u);
|
|
922
|
+
const formatStr = format ? ` format('${format}')` : "";
|
|
923
|
+
return `url('${u}')${formatStr}`;
|
|
924
|
+
}).join(",\n ");
|
|
910
925
|
return `
|
|
911
926
|
font-family: '${name}';
|
|
912
|
-
font-style: normal;${weight ? `
|
|
927
|
+
font-style: ${options.fontStyle || "normal"};${weight ? `
|
|
913
928
|
font-weight: ${weight};` : ""}${options.fontStretch ? `
|
|
914
929
|
font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
|
|
915
930
|
font-display: ${options.fontDisplay};` : ""}
|
|
916
|
-
src:
|
|
931
|
+
src: ${srcList};`;
|
|
917
932
|
};
|
|
918
933
|
var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
|
|
919
934
|
}`;
|
|
920
935
|
var getFontFaceEach = (name, weights, files) => {
|
|
921
936
|
const keys = Object.keys(weights);
|
|
922
937
|
return keys.map((key) => {
|
|
923
|
-
const { url, fontWeight } = weights[key];
|
|
924
|
-
const resolvedUrl = resolveFileUrl(url, files) || url;
|
|
925
|
-
return setCustomFont(name, resolvedUrl, fontWeight);
|
|
938
|
+
const { url, fontWeight, fontStyle, fontDisplay, fontStretch } = weights[key];
|
|
939
|
+
const resolvedUrl = Array.isArray(url) ? url.map((u) => resolveFileUrl(u, files) || u) : resolveFileUrl(url, files) || url;
|
|
940
|
+
return setCustomFont(name, resolvedUrl, fontWeight, { fontStyle, fontDisplay, fontStretch });
|
|
926
941
|
});
|
|
927
942
|
};
|
|
928
943
|
var getFontFace = (LIBRARY) => {
|
|
@@ -942,8 +957,12 @@ var SmblsScratch = (() => {
|
|
|
942
957
|
}
|
|
943
958
|
const isArr = weights[0];
|
|
944
959
|
if (isArr) return getFontFaceEach(name, weights, files).map(setInCustomFontMedia);
|
|
945
|
-
const url = resolveFileUrl(weights.url, files) || weights.url;
|
|
946
|
-
return setCustomFontMedia(name, url
|
|
960
|
+
const url = Array.isArray(weights.url) ? weights.url.map((u) => resolveFileUrl(u, files) || u) : resolveFileUrl(weights.url, files) || weights.url;
|
|
961
|
+
return setCustomFontMedia(name, url, weights.fontWeight, {
|
|
962
|
+
fontStyle: weights.fontStyle,
|
|
963
|
+
fontDisplay: weights.fontDisplay,
|
|
964
|
+
fontStretch: weights.fontStretch
|
|
965
|
+
});
|
|
947
966
|
};
|
|
948
967
|
var getFontFaceString = (LIBRARY, files) => {
|
|
949
968
|
const keys = Object.keys(LIBRARY);
|
|
@@ -956,9 +975,10 @@ var SmblsScratch = (() => {
|
|
|
956
975
|
// ../smbls-utils/dist/esm/index.js
|
|
957
976
|
init_esm();
|
|
958
977
|
var toCamelCase = (str) => {
|
|
978
|
+
if (typeof str !== "string") str = String(str || "");
|
|
959
979
|
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
|
|
960
980
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
961
|
-
}).
|
|
981
|
+
}).replace(/\s+/g, "");
|
|
962
982
|
};
|
|
963
983
|
var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
964
984
|
var arrayzeValue = (val) => {
|
|
@@ -977,7 +997,6 @@ var SmblsScratch = (() => {
|
|
|
977
997
|
CLASS: () => CLASS,
|
|
978
998
|
animation: () => animation,
|
|
979
999
|
breakpoints: () => breakpoints,
|
|
980
|
-
cases: () => cases,
|
|
981
1000
|
color: () => color,
|
|
982
1001
|
devices: () => devices,
|
|
983
1002
|
document: () => document3,
|
|
@@ -1000,7 +1019,8 @@ var SmblsScratch = (() => {
|
|
|
1000
1019
|
theme: () => theme,
|
|
1001
1020
|
timing: () => timing,
|
|
1002
1021
|
typography: () => typography,
|
|
1003
|
-
unit: () => unit
|
|
1022
|
+
unit: () => unit,
|
|
1023
|
+
vars: () => vars
|
|
1004
1024
|
});
|
|
1005
1025
|
|
|
1006
1026
|
// src/defaultConfig/sequence.js
|
|
@@ -1150,9 +1170,6 @@ var SmblsScratch = (() => {
|
|
|
1150
1170
|
mobileXS: [375, 768]
|
|
1151
1171
|
};
|
|
1152
1172
|
|
|
1153
|
-
// src/defaultConfig/cases.js
|
|
1154
|
-
var cases = {};
|
|
1155
|
-
|
|
1156
1173
|
// src/defaultConfig/animation.js
|
|
1157
1174
|
var animation = {};
|
|
1158
1175
|
|
|
@@ -1173,6 +1190,7 @@ var SmblsScratch = (() => {
|
|
|
1173
1190
|
|
|
1174
1191
|
// src/defaultConfig/index.js
|
|
1175
1192
|
var reset = {};
|
|
1193
|
+
var vars = {};
|
|
1176
1194
|
|
|
1177
1195
|
// src/factory.js
|
|
1178
1196
|
var CSS_VARS = {};
|
|
@@ -1514,20 +1532,20 @@ var SmblsScratch = (() => {
|
|
|
1514
1532
|
CSS_VARS2[result.var] = result.value;
|
|
1515
1533
|
}
|
|
1516
1534
|
};
|
|
1517
|
-
var applySequenceGlobalVars = (
|
|
1535
|
+
var applySequenceGlobalVars = (vars2, obj, options) => {
|
|
1518
1536
|
const CONFIG2 = getActiveConfig();
|
|
1519
1537
|
const { unit: UNIT } = CONFIG2;
|
|
1520
1538
|
const unit2 = obj.unit || UNIT.default;
|
|
1521
1539
|
const { base, ratio, type } = obj;
|
|
1522
1540
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1523
|
-
|
|
1524
|
-
|
|
1541
|
+
vars2[`${prefix}-base`] = base;
|
|
1542
|
+
vars2[`${prefix}-unit`] = unit2;
|
|
1525
1543
|
const ratioVar = `${prefix}-ratio`;
|
|
1526
|
-
|
|
1544
|
+
vars2[ratioVar] = ratio;
|
|
1527
1545
|
const [first, middle, second] = getSubratio(base, ratio);
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1546
|
+
vars2[`${prefix}-sub-ratio-1`] = `calc(var(${prefix}-ratio) * ${first / ratio})`;
|
|
1547
|
+
vars2[`${prefix}-sub-ratio-2`] = `calc(var(${prefix}-ratio) * ${middle / ratio})`;
|
|
1548
|
+
vars2[`${prefix}-sub-ratio-3`] = `calc(var(${prefix}-ratio) * ${second / ratio})`;
|
|
1531
1549
|
};
|
|
1532
1550
|
var applySequenceVars = (FACTORY2, options = {}) => {
|
|
1533
1551
|
const CONFIG2 = getActiveConfig();
|
|
@@ -1692,7 +1710,12 @@ var SmblsScratch = (() => {
|
|
|
1692
1710
|
[name, alpha, tone] = value;
|
|
1693
1711
|
} else {
|
|
1694
1712
|
const parsed = parseColorToken(value);
|
|
1695
|
-
if (!parsed)
|
|
1713
|
+
if (!parsed) {
|
|
1714
|
+
const { color: COLOR2, gradient: GRADIENT2 } = CONFIG2;
|
|
1715
|
+
const directVal = GRADIENT2[value] || COLOR2[value];
|
|
1716
|
+
if (directVal) return CONFIG2.useVariable ? `var(${directVal.var})` : directVal.value;
|
|
1717
|
+
return value;
|
|
1718
|
+
}
|
|
1696
1719
|
if (parsed.passthrough) return parsed.passthrough;
|
|
1697
1720
|
if (parsed.cssVar) return `var(${parsed.cssVar})`;
|
|
1698
1721
|
name = parsed.name;
|
|
@@ -1856,6 +1879,163 @@ var SmblsScratch = (() => {
|
|
|
1856
1879
|
|
|
1857
1880
|
// src/system/theme.js
|
|
1858
1881
|
init_esm();
|
|
1882
|
+
var CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
|
|
1883
|
+
"black",
|
|
1884
|
+
"white",
|
|
1885
|
+
"red",
|
|
1886
|
+
"green",
|
|
1887
|
+
"blue",
|
|
1888
|
+
"yellow",
|
|
1889
|
+
"orange",
|
|
1890
|
+
"purple",
|
|
1891
|
+
"pink",
|
|
1892
|
+
"brown",
|
|
1893
|
+
"gray",
|
|
1894
|
+
"grey",
|
|
1895
|
+
"cyan",
|
|
1896
|
+
"magenta",
|
|
1897
|
+
"lime",
|
|
1898
|
+
"olive",
|
|
1899
|
+
"navy",
|
|
1900
|
+
"teal",
|
|
1901
|
+
"aqua",
|
|
1902
|
+
"maroon",
|
|
1903
|
+
"silver",
|
|
1904
|
+
"fuchsia",
|
|
1905
|
+
"transparent",
|
|
1906
|
+
"currentColor",
|
|
1907
|
+
"currentcolor",
|
|
1908
|
+
"inherit",
|
|
1909
|
+
"initial",
|
|
1910
|
+
"unset",
|
|
1911
|
+
"none",
|
|
1912
|
+
"aliceblue",
|
|
1913
|
+
"antiquewhite",
|
|
1914
|
+
"aquamarine",
|
|
1915
|
+
"azure",
|
|
1916
|
+
"beige",
|
|
1917
|
+
"bisque",
|
|
1918
|
+
"blanchedalmond",
|
|
1919
|
+
"blueviolet",
|
|
1920
|
+
"burlywood",
|
|
1921
|
+
"cadetblue",
|
|
1922
|
+
"chartreuse",
|
|
1923
|
+
"chocolate",
|
|
1924
|
+
"coral",
|
|
1925
|
+
"cornflowerblue",
|
|
1926
|
+
"cornsilk",
|
|
1927
|
+
"crimson",
|
|
1928
|
+
"darkblue",
|
|
1929
|
+
"darkcyan",
|
|
1930
|
+
"darkgoldenrod",
|
|
1931
|
+
"darkgray",
|
|
1932
|
+
"darkgreen",
|
|
1933
|
+
"darkgrey",
|
|
1934
|
+
"darkkhaki",
|
|
1935
|
+
"darkmagenta",
|
|
1936
|
+
"darkolivegreen",
|
|
1937
|
+
"darkorange",
|
|
1938
|
+
"darkorchid",
|
|
1939
|
+
"darkred",
|
|
1940
|
+
"darksalmon",
|
|
1941
|
+
"darkseagreen",
|
|
1942
|
+
"darkslateblue",
|
|
1943
|
+
"darkslategray",
|
|
1944
|
+
"darkslategrey",
|
|
1945
|
+
"darkturquoise",
|
|
1946
|
+
"darkviolet",
|
|
1947
|
+
"deeppink",
|
|
1948
|
+
"deepskyblue",
|
|
1949
|
+
"dimgray",
|
|
1950
|
+
"dimgrey",
|
|
1951
|
+
"dodgerblue",
|
|
1952
|
+
"firebrick",
|
|
1953
|
+
"floralwhite",
|
|
1954
|
+
"forestgreen",
|
|
1955
|
+
"gainsboro",
|
|
1956
|
+
"ghostwhite",
|
|
1957
|
+
"gold",
|
|
1958
|
+
"goldenrod",
|
|
1959
|
+
"greenyellow",
|
|
1960
|
+
"honeydew",
|
|
1961
|
+
"hotpink",
|
|
1962
|
+
"indianred",
|
|
1963
|
+
"indigo",
|
|
1964
|
+
"ivory",
|
|
1965
|
+
"khaki",
|
|
1966
|
+
"lavender",
|
|
1967
|
+
"lavenderblush",
|
|
1968
|
+
"lawngreen",
|
|
1969
|
+
"lemonchiffon",
|
|
1970
|
+
"lightblue",
|
|
1971
|
+
"lightcoral",
|
|
1972
|
+
"lightcyan",
|
|
1973
|
+
"lightgoldenrodyellow",
|
|
1974
|
+
"lightgray",
|
|
1975
|
+
"lightgreen",
|
|
1976
|
+
"lightgrey",
|
|
1977
|
+
"lightpink",
|
|
1978
|
+
"lightsalmon",
|
|
1979
|
+
"lightseagreen",
|
|
1980
|
+
"lightskyblue",
|
|
1981
|
+
"lightslategray",
|
|
1982
|
+
"lightslategrey",
|
|
1983
|
+
"lightsteelblue",
|
|
1984
|
+
"lightyellow",
|
|
1985
|
+
"limegreen",
|
|
1986
|
+
"linen",
|
|
1987
|
+
"mediumaquamarine",
|
|
1988
|
+
"mediumblue",
|
|
1989
|
+
"mediumorchid",
|
|
1990
|
+
"mediumpurple",
|
|
1991
|
+
"mediumseagreen",
|
|
1992
|
+
"mediumslateblue",
|
|
1993
|
+
"mediumspringgreen",
|
|
1994
|
+
"mediumturquoise",
|
|
1995
|
+
"mediumvioletred",
|
|
1996
|
+
"midnightblue",
|
|
1997
|
+
"mintcream",
|
|
1998
|
+
"mistyrose",
|
|
1999
|
+
"moccasin",
|
|
2000
|
+
"navajowhite",
|
|
2001
|
+
"oldlace",
|
|
2002
|
+
"olivedrab",
|
|
2003
|
+
"orangered",
|
|
2004
|
+
"orchid",
|
|
2005
|
+
"palegoldenrod",
|
|
2006
|
+
"palegreen",
|
|
2007
|
+
"paleturquoise",
|
|
2008
|
+
"palevioletred",
|
|
2009
|
+
"papayawhip",
|
|
2010
|
+
"peachpuff",
|
|
2011
|
+
"peru",
|
|
2012
|
+
"plum",
|
|
2013
|
+
"powderblue",
|
|
2014
|
+
"rosybrown",
|
|
2015
|
+
"royalblue",
|
|
2016
|
+
"saddlebrown",
|
|
2017
|
+
"salmon",
|
|
2018
|
+
"sandybrown",
|
|
2019
|
+
"seagreen",
|
|
2020
|
+
"seashell",
|
|
2021
|
+
"sienna",
|
|
2022
|
+
"skyblue",
|
|
2023
|
+
"slateblue",
|
|
2024
|
+
"slategray",
|
|
2025
|
+
"slategrey",
|
|
2026
|
+
"snow",
|
|
2027
|
+
"springgreen",
|
|
2028
|
+
"steelblue",
|
|
2029
|
+
"tan",
|
|
2030
|
+
"thistle",
|
|
2031
|
+
"tomato",
|
|
2032
|
+
"turquoise",
|
|
2033
|
+
"violet",
|
|
2034
|
+
"wheat",
|
|
2035
|
+
"whitesmoke",
|
|
2036
|
+
"yellowgreen",
|
|
2037
|
+
"rebeccapurple"
|
|
2038
|
+
]);
|
|
1859
2039
|
var setThemeValue = (theme2) => {
|
|
1860
2040
|
const value = {};
|
|
1861
2041
|
const { state, media: media2, helpers, ...rest } = theme2;
|
|
@@ -1973,6 +2153,23 @@ var SmblsScratch = (() => {
|
|
|
1973
2153
|
for (const scheme in schemes) {
|
|
1974
2154
|
if (schemes[scheme]) for (const k of Object.keys(schemes[scheme])) allKeys.add(k);
|
|
1975
2155
|
}
|
|
2156
|
+
const brokenSchemes = /* @__PURE__ */ new Set();
|
|
2157
|
+
if (globalTheme === "auto") {
|
|
2158
|
+
for (const param of allKeys) {
|
|
2159
|
+
const symb = param.slice(0, 1);
|
|
2160
|
+
if (symb === "@" || symb === "." || symb === ":") continue;
|
|
2161
|
+
for (const scheme in schemes) {
|
|
2162
|
+
if (brokenSchemes.has(scheme)) continue;
|
|
2163
|
+
const val = schemes[scheme]?.[param];
|
|
2164
|
+
if (val === void 0) continue;
|
|
2165
|
+
const color2 = getColor(val, `@${scheme}`);
|
|
2166
|
+
if (color2 === void 0) continue;
|
|
2167
|
+
if (isString(color2) && /^[a-z][a-zA-Z]+$/.test(color2) && !CSS_NAMED_COLORS.has(color2)) {
|
|
2168
|
+
brokenSchemes.add(scheme);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
1976
2173
|
for (const param of allKeys) {
|
|
1977
2174
|
const symb = param.slice(0, 1);
|
|
1978
2175
|
const hasObject = Object.values(schemes).some((s) => isObjectLike(s?.[param]));
|
|
@@ -1993,11 +2190,16 @@ var SmblsScratch = (() => {
|
|
|
1993
2190
|
} else if (symb !== "@" && symb !== "." && symb !== ":") {
|
|
1994
2191
|
const autoVar = `--theme-${varPrefix}-${param}`;
|
|
1995
2192
|
if (globalTheme === "auto") {
|
|
2193
|
+
let fallbackColor;
|
|
1996
2194
|
for (const scheme in schemes) {
|
|
2195
|
+
if (brokenSchemes.has(scheme)) continue;
|
|
1997
2196
|
const val = schemes[scheme]?.[param];
|
|
1998
2197
|
if (val === void 0) continue;
|
|
1999
2198
|
const color2 = getColor(val, `@${scheme}`);
|
|
2000
2199
|
if (color2 === void 0) continue;
|
|
2200
|
+
if (scheme === "light" || fallbackColor === void 0) {
|
|
2201
|
+
fallbackColor = color2;
|
|
2202
|
+
}
|
|
2001
2203
|
const selector = `[data-theme="${scheme}"]`;
|
|
2002
2204
|
if (!MEDIA_VARS[selector]) MEDIA_VARS[selector] = {};
|
|
2003
2205
|
MEDIA_VARS[selector][autoVar] = color2;
|
|
@@ -2007,6 +2209,9 @@ var SmblsScratch = (() => {
|
|
|
2007
2209
|
MEDIA_VARS[mq][autoVar] = color2;
|
|
2008
2210
|
}
|
|
2009
2211
|
}
|
|
2212
|
+
if (fallbackColor !== void 0) {
|
|
2213
|
+
CSS_VARS2[autoVar] = fallbackColor;
|
|
2214
|
+
}
|
|
2010
2215
|
} else {
|
|
2011
2216
|
const forced = String(globalTheme).replace(/^'|'$/g, "");
|
|
2012
2217
|
const source = schemes[forced]?.[param];
|
|
@@ -2090,6 +2295,8 @@ var SmblsScratch = (() => {
|
|
|
2090
2295
|
continue;
|
|
2091
2296
|
} else if (symb === ":") {
|
|
2092
2297
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
2298
|
+
} else if (symb === ".") {
|
|
2299
|
+
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
2093
2300
|
}
|
|
2094
2301
|
} else obj[param] = val[param];
|
|
2095
2302
|
}
|
|
@@ -2147,8 +2354,12 @@ var SmblsScratch = (() => {
|
|
|
2147
2354
|
} else if (val[0]) {
|
|
2148
2355
|
fontFace = getFontFaceEach(key, val, CONFIG2.files);
|
|
2149
2356
|
} else {
|
|
2150
|
-
const url = resolveFileUrl(val.url, CONFIG2.files) || val.url;
|
|
2151
|
-
fontFace = setCustomFontMedia(key, url
|
|
2357
|
+
const url = Array.isArray(val.url) ? val.url.map((u) => resolveFileUrl(u, CONFIG2.files) || u) : resolveFileUrl(val.url, CONFIG2.files) || val.url;
|
|
2358
|
+
fontFace = setCustomFontMedia(key, url, val.fontWeight, {
|
|
2359
|
+
fontStyle: val.fontStyle,
|
|
2360
|
+
fontDisplay: val.fontDisplay,
|
|
2361
|
+
fontStretch: val.fontStretch
|
|
2362
|
+
});
|
|
2152
2363
|
}
|
|
2153
2364
|
return { var: CSSvar, value: val, fontFace };
|
|
2154
2365
|
};
|
|
@@ -2783,11 +2994,14 @@ var SmblsScratch = (() => {
|
|
|
2783
2994
|
|
|
2784
2995
|
// src/set.js
|
|
2785
2996
|
init_esm();
|
|
2786
|
-
var
|
|
2787
|
-
|
|
2997
|
+
var setVars = (val, key) => {
|
|
2998
|
+
const CONFIG2 = getActiveConfig();
|
|
2999
|
+
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
3000
|
+
const varName = key.startsWith("--") ? key : `--${key}`;
|
|
3001
|
+
CSS_VARS2[varName] = val;
|
|
2788
3002
|
return val;
|
|
2789
3003
|
};
|
|
2790
|
-
var
|
|
3004
|
+
var asIs = (val) => val;
|
|
2791
3005
|
var VALUE_TRANSFORMERS = {
|
|
2792
3006
|
color: setColor,
|
|
2793
3007
|
gradient: setGradient,
|
|
@@ -2796,21 +3010,21 @@ var SmblsScratch = (() => {
|
|
|
2796
3010
|
fontfamily: setFontFamily,
|
|
2797
3011
|
theme: setTheme,
|
|
2798
3012
|
icons: setSvgIcon,
|
|
2799
|
-
semantic_icons:
|
|
2800
|
-
semanticicons:
|
|
3013
|
+
semantic_icons: asIs,
|
|
3014
|
+
semanticicons: asIs,
|
|
2801
3015
|
svg: setSVG,
|
|
2802
|
-
svg_data:
|
|
2803
|
-
typography:
|
|
2804
|
-
cases: setCases,
|
|
3016
|
+
svg_data: asIs,
|
|
3017
|
+
typography: asIs,
|
|
2805
3018
|
shadow: setShadow,
|
|
2806
|
-
spacing:
|
|
2807
|
-
media:
|
|
2808
|
-
grid:
|
|
2809
|
-
class:
|
|
2810
|
-
timing:
|
|
2811
|
-
reset:
|
|
2812
|
-
unit:
|
|
2813
|
-
animation:
|
|
3019
|
+
spacing: asIs,
|
|
3020
|
+
media: asIs,
|
|
3021
|
+
grid: asIs,
|
|
3022
|
+
class: asIs,
|
|
3023
|
+
timing: asIs,
|
|
3024
|
+
reset: asIs,
|
|
3025
|
+
unit: asIs,
|
|
3026
|
+
animation: asIs,
|
|
3027
|
+
vars: setVars
|
|
2814
3028
|
};
|
|
2815
3029
|
var setValue = (factoryName, value, key) => {
|
|
2816
3030
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2822,10 +3036,12 @@ var SmblsScratch = (() => {
|
|
|
2822
3036
|
FACTORY2[key] = result;
|
|
2823
3037
|
return FACTORY2;
|
|
2824
3038
|
} catch (error) {
|
|
2825
|
-
if (CONFIG2.verbose)
|
|
3039
|
+
if (CONFIG2.verbose)
|
|
3040
|
+
console.warn("Error setting", lowerName, "value", value, key, error);
|
|
2826
3041
|
}
|
|
2827
3042
|
}
|
|
2828
|
-
if (CONFIG2.verbose)
|
|
3043
|
+
if (CONFIG2.verbose)
|
|
3044
|
+
console.warn("Can not find", lowerName, "method in scratch");
|
|
2829
3045
|
};
|
|
2830
3046
|
var setEach = (factoryName, props) => {
|
|
2831
3047
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2835,7 +3051,15 @@ var SmblsScratch = (() => {
|
|
|
2835
3051
|
try {
|
|
2836
3052
|
return setValue(lowerName, props[key], key);
|
|
2837
3053
|
} catch (error) {
|
|
2838
|
-
if (CONFIG2.verbose)
|
|
3054
|
+
if (CONFIG2.verbose)
|
|
3055
|
+
console.warn(
|
|
3056
|
+
"Error setting",
|
|
3057
|
+
lowerName,
|
|
3058
|
+
"value",
|
|
3059
|
+
props[key],
|
|
3060
|
+
key,
|
|
3061
|
+
error
|
|
3062
|
+
);
|
|
2839
3063
|
}
|
|
2840
3064
|
});
|
|
2841
3065
|
return CONFIG2[lowerName] || CONFIG2[factoryName];
|
|
@@ -2870,6 +3094,7 @@ var SmblsScratch = (() => {
|
|
|
2870
3094
|
useDefaultConfig,
|
|
2871
3095
|
semanticIcons,
|
|
2872
3096
|
SEMANTIC_ICONS,
|
|
3097
|
+
// deprecated
|
|
2873
3098
|
semantic_icons: semantic_icons2,
|
|
2874
3099
|
files,
|
|
2875
3100
|
...config
|
|
@@ -2886,7 +3111,8 @@ var SmblsScratch = (() => {
|
|
|
2886
3111
|
if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
|
|
2887
3112
|
if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
2888
3113
|
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
2889
|
-
if (recivedConfig.useThemeSuffixedVars !== void 0)
|
|
3114
|
+
if (recivedConfig.useThemeSuffixedVars !== void 0)
|
|
3115
|
+
CONFIG2.useThemeSuffixedVars = recivedConfig.useThemeSuffixedVars;
|
|
2890
3116
|
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
2891
3117
|
const _semanticIcons = semanticIcons || SEMANTIC_ICONS || semantic_icons2;
|
|
2892
3118
|
if (_semanticIcons !== void 0) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symbo.ls/scratch",
|
|
3
3
|
"description": "Φ / CSS framework and methodology.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "3.8.
|
|
5
|
+
"version": "3.8.6",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
8
|
"*.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@domql/utils": "^3.8.
|
|
37
|
-
"@symbo.ls/smbls-utils": "^3.8.
|
|
36
|
+
"@domql/utils": "^3.8.6",
|
|
37
|
+
"@symbo.ls/smbls-utils": "^3.8.6",
|
|
38
38
|
"color-contrast-checker": "^1.5.0"
|
|
39
39
|
},
|
|
40
40
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
@@ -14,7 +14,6 @@ export * from './icons.js'
|
|
|
14
14
|
export * from './timing.js'
|
|
15
15
|
export * from './document.js'
|
|
16
16
|
export * from './responsive.js'
|
|
17
|
-
export * from './cases.js'
|
|
18
17
|
export * from './animation.js'
|
|
19
18
|
export * from './svg.js'
|
|
20
19
|
export * from './templates.js'
|
|
@@ -22,3 +21,4 @@ export * from './grid.js'
|
|
|
22
21
|
export * from './class.js'
|
|
23
22
|
|
|
24
23
|
export const reset = {}
|
|
24
|
+
export const vars = {}
|