@symbo.ls/scratch 2.27.0 → 2.27.8
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 +4 -8
- package/dist/cjs/index.js +165 -334
- package/dist/cjs/set.js +116 -236
- package/dist/cjs/system/color.js +44 -85
- package/dist/cjs/system/document.js +16 -29
- package/dist/cjs/system/font.js +20 -37
- package/dist/cjs/system/index.js +116 -239
- package/dist/cjs/system/reset.js +23 -43
- package/dist/cjs/system/shadow.js +59 -115
- package/dist/cjs/system/spacing.js +31 -59
- package/dist/cjs/system/svg.js +21 -39
- package/dist/cjs/system/theme.js +57 -111
- package/dist/cjs/system/timing.js +24 -45
- package/dist/cjs/system/typography.js +33 -73
- package/dist/cjs/transforms/index.js +82 -161
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +50 -97
- package/dist/cjs/utils/sequence.js +24 -45
- package/dist/cjs/utils/sprite.js +5 -10
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +18 -33
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
package/dist/cjs/system/index.js
CHANGED
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue3,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue3 = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -309,8 +300,7 @@ var isDOMNode = (obj) => {
|
|
|
309
300
|
|
|
310
301
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
311
302
|
var isObject = (arg) => {
|
|
312
|
-
if (arg === null)
|
|
313
|
-
return false;
|
|
303
|
+
if (arg === null) return false;
|
|
314
304
|
return typeof arg === "object" && arg.constructor === Object;
|
|
315
305
|
};
|
|
316
306
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -319,8 +309,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
319
309
|
var isNull = (arg) => arg === null;
|
|
320
310
|
var isArray = (arg) => Array.isArray(arg);
|
|
321
311
|
var isObjectLike = (arg) => {
|
|
322
|
-
if (arg === null)
|
|
323
|
-
return false;
|
|
312
|
+
if (arg === null) return false;
|
|
324
313
|
return typeof arg === "object";
|
|
325
314
|
};
|
|
326
315
|
var isUndefined = (arg) => {
|
|
@@ -401,8 +390,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
401
390
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
402
391
|
visited.set(obj, clone2);
|
|
403
392
|
for (const key in obj) {
|
|
404
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
405
|
-
continue;
|
|
393
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
406
394
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
407
395
|
continue;
|
|
408
396
|
const value = obj[key];
|
|
@@ -436,14 +424,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
436
424
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
437
425
|
return params;
|
|
438
426
|
}
|
|
439
|
-
if (visited.has(obj))
|
|
440
|
-
return visited.get(obj);
|
|
427
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
441
428
|
visited.set(obj, obj);
|
|
442
429
|
for (const e in params) {
|
|
443
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
444
|
-
|
|
445
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
446
|
-
continue;
|
|
430
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
431
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
447
432
|
const objProp = obj[e];
|
|
448
433
|
const paramsProp = params[e];
|
|
449
434
|
if (isDOMNode(paramsProp)) {
|
|
@@ -688,10 +673,8 @@ var isScalingUnit = (unit) => {
|
|
|
688
673
|
|
|
689
674
|
// src/utils/color.js
|
|
690
675
|
var colorStringToRgbaArray = (color) => {
|
|
691
|
-
if (color === "")
|
|
692
|
-
|
|
693
|
-
if (color.toLowerCase() === "transparent")
|
|
694
|
-
return [0, 0, 0, 0];
|
|
676
|
+
if (color === "") return [0, 0, 0, 0];
|
|
677
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
695
678
|
if (color[0] === "#") {
|
|
696
679
|
if (color.length < 7) {
|
|
697
680
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -722,8 +705,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
722
705
|
}
|
|
723
706
|
}
|
|
724
707
|
if (color.indexOf("rgb") === 0) {
|
|
725
|
-
if (color.indexOf("rgba") === -1)
|
|
726
|
-
color = `${color}, 1`;
|
|
708
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
727
709
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
728
710
|
}
|
|
729
711
|
return [0, 0, 0, 0];
|
|
@@ -749,29 +731,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
749
731
|
var getColorShade = (col, amt) => {
|
|
750
732
|
const num = parseInt(col, 16);
|
|
751
733
|
let r = (num >> 16) + amt;
|
|
752
|
-
if (r > 255)
|
|
753
|
-
|
|
754
|
-
else if (r < 0)
|
|
755
|
-
r = 0;
|
|
734
|
+
if (r > 255) r = 255;
|
|
735
|
+
else if (r < 0) r = 0;
|
|
756
736
|
let b = (num >> 8 & 255) + amt;
|
|
757
|
-
if (b > 255)
|
|
758
|
-
|
|
759
|
-
else if (b < 0)
|
|
760
|
-
b = 0;
|
|
737
|
+
if (b > 255) b = 255;
|
|
738
|
+
else if (b < 0) b = 0;
|
|
761
739
|
let g = (num & 255) + amt;
|
|
762
|
-
if (g > 255)
|
|
763
|
-
|
|
764
|
-
else if (g < 0)
|
|
765
|
-
g = 0;
|
|
740
|
+
if (g > 255) g = 255;
|
|
741
|
+
else if (g < 0) g = 0;
|
|
766
742
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
767
743
|
};
|
|
768
744
|
var getRgbTone = (rgb, tone) => {
|
|
769
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
770
|
-
|
|
771
|
-
if (
|
|
772
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
773
|
-
if (isNumber(tone))
|
|
774
|
-
tone += "";
|
|
745
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
746
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
747
|
+
if (isNumber(tone)) tone += "";
|
|
775
748
|
const toHex = rgbArrayToHex(rgb);
|
|
776
749
|
const abs = tone.slice(0, 1);
|
|
777
750
|
if (abs === "-" || abs === "+") {
|
|
@@ -788,10 +761,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
788
761
|
|
|
789
762
|
// src/utils/font.js
|
|
790
763
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
791
|
-
if (LIBRARY[key])
|
|
792
|
-
|
|
793
|
-
if (LIBRARY.default)
|
|
794
|
-
return LIBRARY[LIBRARY.default].value;
|
|
764
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
765
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
795
766
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
796
767
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
797
768
|
};
|
|
@@ -859,8 +830,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
859
830
|
var setScalingVar = (key, sequenceProps) => {
|
|
860
831
|
const { base, type, unit } = sequenceProps;
|
|
861
832
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
862
|
-
if (key === 0)
|
|
863
|
-
return defaultVal;
|
|
833
|
+
if (key === 0) return defaultVal;
|
|
864
834
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
865
835
|
const ratioVar = `${prefix}-ratio`;
|
|
866
836
|
if (key > 0) {
|
|
@@ -897,10 +867,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
897
867
|
const diffRounded = ~~next - ~~value;
|
|
898
868
|
let arr;
|
|
899
869
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
900
|
-
if (diffRounded > 16)
|
|
901
|
-
|
|
902
|
-
else
|
|
903
|
-
arr = [first, second];
|
|
870
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
871
|
+
else arr = [first, second];
|
|
904
872
|
arr.forEach((v, k) => {
|
|
905
873
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
906
874
|
const newVar = variable + (k + 1);
|
|
@@ -942,8 +910,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
942
910
|
index: key
|
|
943
911
|
};
|
|
944
912
|
setSequenceValue(props, sequenceProps);
|
|
945
|
-
if (subSequence)
|
|
946
|
-
generateSubSequence(props, sequenceProps);
|
|
913
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
947
914
|
}
|
|
948
915
|
return sequenceProps;
|
|
949
916
|
};
|
|
@@ -955,13 +922,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
955
922
|
unit = UNIT2.default,
|
|
956
923
|
useVariable
|
|
957
924
|
} = sequenceProps;
|
|
958
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
959
|
-
return `var(${value})`;
|
|
925
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
960
926
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
961
927
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
962
928
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
963
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
|
|
964
|
-
return value;
|
|
929
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
|
|
965
930
|
const letterVal = value.toUpperCase();
|
|
966
931
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
967
932
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -985,8 +950,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
985
950
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
986
951
|
}
|
|
987
952
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
988
|
-
if (CONFIG2.verbose)
|
|
989
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
953
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
990
954
|
absValue = absValue.slice(0, 1);
|
|
991
955
|
}
|
|
992
956
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -994,8 +958,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
994
958
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
995
959
|
}
|
|
996
960
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
997
|
-
if (!sequenceItem)
|
|
998
|
-
return console.warn("can't find", sequence, absValue);
|
|
961
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
999
962
|
if (unit === "ms" || unit === "s") {
|
|
1000
963
|
return isNegative + sequenceItem.val + unit;
|
|
1001
964
|
}
|
|
@@ -1004,12 +967,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1004
967
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1005
968
|
if (typeof value !== "string") {
|
|
1006
969
|
const CONFIG2 = getActiveConfig();
|
|
1007
|
-
if (CONFIG2.verbose)
|
|
1008
|
-
console.warn(propertyName, value, "is not a string");
|
|
970
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1009
971
|
return { [propertyName]: value };
|
|
1010
972
|
}
|
|
1011
|
-
if (value === "-" || value === "")
|
|
1012
|
-
return {};
|
|
973
|
+
if (value === "-" || value === "") return {};
|
|
1013
974
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1014
975
|
};
|
|
1015
976
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1069,23 +1030,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1069
1030
|
const { mediaRegenerate } = FACTORY2;
|
|
1070
1031
|
const { sequence, scales } = FACTORY2[media];
|
|
1071
1032
|
const query = MEDIA2[mediaName];
|
|
1072
|
-
if (!query && CONFIG2.verbose)
|
|
1073
|
-
console.warn("Can't find media query ", query);
|
|
1033
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1074
1034
|
if (!mediaRegenerate) {
|
|
1075
1035
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1076
|
-
if (!underMediaQuery)
|
|
1077
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1036
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1078
1037
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1079
1038
|
return;
|
|
1080
1039
|
}
|
|
1081
1040
|
for (const key in sequence) {
|
|
1082
1041
|
const item = sequence[key];
|
|
1083
1042
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1084
|
-
if (!query && CONFIG2.verbose)
|
|
1085
|
-
console.warn("Can't find query ", query);
|
|
1043
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1086
1044
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1087
|
-
if (!underMediaQuery)
|
|
1088
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1045
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1089
1046
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1090
1047
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1091
1048
|
}
|
|
@@ -1098,10 +1055,8 @@ var generateSprite = (icons) => {
|
|
|
1098
1055
|
const CONFIG2 = getActiveConfig();
|
|
1099
1056
|
let sprite = "";
|
|
1100
1057
|
for (const key in icons) {
|
|
1101
|
-
if (CONFIG2.__svg_cache[key])
|
|
1102
|
-
|
|
1103
|
-
else
|
|
1104
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1058
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1059
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1105
1060
|
sprite += icons[key];
|
|
1106
1061
|
}
|
|
1107
1062
|
return sprite;
|
|
@@ -1109,8 +1064,7 @@ var generateSprite = (icons) => {
|
|
|
1109
1064
|
var parseRootAttributes = (htmlString) => {
|
|
1110
1065
|
const val = htmlString.default || htmlString;
|
|
1111
1066
|
if (!isString(val)) {
|
|
1112
|
-
if (isDev)
|
|
1113
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1067
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1114
1068
|
return;
|
|
1115
1069
|
}
|
|
1116
1070
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -1158,27 +1112,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1158
1112
|
var getColor = (value, key, config) => {
|
|
1159
1113
|
const CONFIG2 = config || getActiveConfig();
|
|
1160
1114
|
if (!isString(value)) {
|
|
1161
|
-
if (CONFIG2.verbose)
|
|
1162
|
-
console.warn(value, "- type for color is not valid");
|
|
1115
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1163
1116
|
return;
|
|
1164
1117
|
}
|
|
1165
|
-
if (value.slice(0, 2) === "--")
|
|
1166
|
-
|
|
1167
|
-
if (key && value[key])
|
|
1168
|
-
value = value[key];
|
|
1118
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1119
|
+
if (key && value[key]) value = value[key];
|
|
1169
1120
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1170
1121
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1171
1122
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1172
1123
|
if (!val) {
|
|
1173
|
-
if (CONFIG2.verbose)
|
|
1174
|
-
console.warn("Can't find color ", name);
|
|
1124
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1175
1125
|
return value;
|
|
1176
1126
|
}
|
|
1177
1127
|
if (key) {
|
|
1178
|
-
if (val[key])
|
|
1179
|
-
|
|
1180
|
-
else if (CONFIG2.verbose)
|
|
1181
|
-
console.warn(value, " - does not have ", key);
|
|
1128
|
+
if (val[key]) val = val[key];
|
|
1129
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1182
1130
|
}
|
|
1183
1131
|
let rgb = val.rgb;
|
|
1184
1132
|
if (!rgb) {
|
|
@@ -1188,32 +1136,25 @@ var getColor = (value, key, config) => {
|
|
|
1188
1136
|
rgb = getRgbTone(rgb, tone);
|
|
1189
1137
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1190
1138
|
}
|
|
1191
|
-
if (val[tone])
|
|
1192
|
-
|
|
1193
|
-
if (alpha)
|
|
1194
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1139
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1140
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1195
1141
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1196
1142
|
};
|
|
1197
1143
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1198
1144
|
const CONFIG2 = config || getActiveConfig();
|
|
1199
|
-
if (!globalTheme)
|
|
1200
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1145
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1201
1146
|
if (!isString(value)) {
|
|
1202
|
-
if (CONFIG2.verbose)
|
|
1203
|
-
console.warn(value, "- type for color is not valid");
|
|
1147
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1204
1148
|
return;
|
|
1205
1149
|
}
|
|
1206
|
-
if (value.slice(0, 2) === "--")
|
|
1207
|
-
return `var(${value})`;
|
|
1150
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1208
1151
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1209
1152
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1210
1153
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1211
1154
|
const isObj = isObject(val);
|
|
1212
|
-
if (isObj && val.value)
|
|
1213
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1155
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1214
1156
|
else if (isObj) {
|
|
1215
|
-
if (globalTheme)
|
|
1216
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1157
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1217
1158
|
else {
|
|
1218
1159
|
const obj = {};
|
|
1219
1160
|
for (const mediaName in val) {
|
|
@@ -1224,8 +1165,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1224
1165
|
return obj;
|
|
1225
1166
|
}
|
|
1226
1167
|
} else {
|
|
1227
|
-
if (CONFIG2.verbose)
|
|
1228
|
-
console.warn("Can't find color", value);
|
|
1168
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1229
1169
|
return value;
|
|
1230
1170
|
}
|
|
1231
1171
|
};
|
|
@@ -1234,8 +1174,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1234
1174
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1235
1175
|
val = getColor(val.slice(2));
|
|
1236
1176
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1237
|
-
if (CONFIG2.verbose)
|
|
1238
|
-
console.warn(val, "- referred but does not exist");
|
|
1177
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1239
1178
|
val = val.split(" ")[0];
|
|
1240
1179
|
}
|
|
1241
1180
|
}
|
|
@@ -1274,8 +1213,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1274
1213
|
};
|
|
1275
1214
|
var setGradient = (val, key, suffix) => {
|
|
1276
1215
|
const CONFIG2 = getActiveConfig();
|
|
1277
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1278
|
-
val = getColor(val.slice(2));
|
|
1216
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1279
1217
|
if (isArray(val)) {
|
|
1280
1218
|
return {
|
|
1281
1219
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1284,8 +1222,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1284
1222
|
}
|
|
1285
1223
|
if (isObject(val)) {
|
|
1286
1224
|
const obj = {};
|
|
1287
|
-
for (const variant in val)
|
|
1288
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1225
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1289
1226
|
return obj;
|
|
1290
1227
|
}
|
|
1291
1228
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1311,22 +1248,19 @@ var setThemeValue = (theme) => {
|
|
|
1311
1248
|
return value;
|
|
1312
1249
|
};
|
|
1313
1250
|
var getThemeValue = (theme) => {
|
|
1314
|
-
if (theme.value)
|
|
1315
|
-
return theme.value;
|
|
1251
|
+
if (theme.value) return theme.value;
|
|
1316
1252
|
theme.value = setThemeValue(theme);
|
|
1317
1253
|
return theme.value;
|
|
1318
1254
|
};
|
|
1319
1255
|
var getTheme = (value, modifier) => {
|
|
1320
1256
|
const CONFIG2 = getActiveConfig();
|
|
1321
|
-
if (CONFIG2.useVariable)
|
|
1322
|
-
return getMediaTheme(value, modifier);
|
|
1257
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1323
1258
|
const { THEME: THEME2 } = CONFIG2;
|
|
1324
1259
|
if (isString(value)) {
|
|
1325
1260
|
const [theme, subtheme] = value.split(" ");
|
|
1326
1261
|
const isOurTheme = THEME2[theme];
|
|
1327
1262
|
if (isOurTheme) {
|
|
1328
|
-
if (!subtheme && !modifier)
|
|
1329
|
-
return getThemeValue(isOurTheme);
|
|
1263
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1330
1264
|
value = [theme, subtheme || modifier];
|
|
1331
1265
|
}
|
|
1332
1266
|
}
|
|
@@ -1334,14 +1268,10 @@ var getTheme = (value, modifier) => {
|
|
|
1334
1268
|
const themeName = value[0];
|
|
1335
1269
|
const subThemeName = value[1];
|
|
1336
1270
|
const { helpers, media, state } = THEME2[themeName];
|
|
1337
|
-
if (media && media[subThemeName])
|
|
1338
|
-
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
1341
|
-
if (state && state[subThemeName])
|
|
1342
|
-
return getThemeValue(state[subThemeName]);
|
|
1343
|
-
} else if (isObject(value))
|
|
1344
|
-
return setThemeValue(value);
|
|
1271
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1272
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1273
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1274
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1345
1275
|
};
|
|
1346
1276
|
var setInverseTheme = (theme, variant, value) => {
|
|
1347
1277
|
if (isObject(variant)) {
|
|
@@ -1359,13 +1289,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1359
1289
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1360
1290
|
const result = getTheme(variant);
|
|
1361
1291
|
themeValue[`&:${key}`] = result;
|
|
1362
|
-
if (isObject(variant) && !variant.value)
|
|
1363
|
-
variant.value = result;
|
|
1292
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1364
1293
|
};
|
|
1365
1294
|
var setSelectors = (theme, value) => {
|
|
1366
1295
|
const { state } = theme;
|
|
1367
|
-
if (!state)
|
|
1368
|
-
return;
|
|
1296
|
+
if (!state) return;
|
|
1369
1297
|
const keys = Object.keys(state);
|
|
1370
1298
|
keys.map((key) => {
|
|
1371
1299
|
const variant = state[key];
|
|
@@ -1377,20 +1305,16 @@ var setSelectors = (theme, value) => {
|
|
|
1377
1305
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1378
1306
|
const result = getTheme(variant);
|
|
1379
1307
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1380
|
-
if (isObject(variant) && !variant.value)
|
|
1381
|
-
variant.value = result;
|
|
1308
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1382
1309
|
};
|
|
1383
1310
|
var setMedia = (theme, value) => {
|
|
1384
1311
|
const { media } = theme;
|
|
1385
|
-
if (!media)
|
|
1386
|
-
return;
|
|
1312
|
+
if (!media) return;
|
|
1387
1313
|
const keys = Object.keys(media);
|
|
1388
1314
|
keys.map((key) => {
|
|
1389
1315
|
const variant = media[key];
|
|
1390
|
-
if (key === "dark" || key === "light")
|
|
1391
|
-
|
|
1392
|
-
if (key === "inverse")
|
|
1393
|
-
setInverseTheme(theme, variant, value);
|
|
1316
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1317
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1394
1318
|
return theme;
|
|
1395
1319
|
});
|
|
1396
1320
|
return theme;
|
|
@@ -1398,23 +1322,19 @@ var setMedia = (theme, value) => {
|
|
|
1398
1322
|
var setHelpers = (theme, value) => {
|
|
1399
1323
|
const CONFIG2 = getActiveConfig();
|
|
1400
1324
|
const { helpers } = theme;
|
|
1401
|
-
if (!helpers)
|
|
1402
|
-
return;
|
|
1325
|
+
if (!helpers) return;
|
|
1403
1326
|
const keys = Object.keys(helpers);
|
|
1404
1327
|
keys.map((key) => {
|
|
1405
1328
|
const helper = helpers[key];
|
|
1406
|
-
if (isString(helper))
|
|
1407
|
-
|
|
1408
|
-
else
|
|
1409
|
-
getThemeValue(helpers[key]);
|
|
1329
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1330
|
+
else getThemeValue(helpers[key]);
|
|
1410
1331
|
return theme;
|
|
1411
1332
|
});
|
|
1412
1333
|
return theme;
|
|
1413
1334
|
};
|
|
1414
1335
|
var setTheme = (val, key) => {
|
|
1415
1336
|
const CONFIG2 = getActiveConfig();
|
|
1416
|
-
if (CONFIG2.useVariable)
|
|
1417
|
-
return setMediaTheme(val, key);
|
|
1337
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1418
1338
|
const { state, media, helpers } = val;
|
|
1419
1339
|
const value = setThemeValue(val, key);
|
|
1420
1340
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1476,24 +1396,19 @@ var recursiveTheme = (val) => {
|
|
|
1476
1396
|
} else if (symb === ":") {
|
|
1477
1397
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1478
1398
|
}
|
|
1479
|
-
} else
|
|
1480
|
-
obj[param] = val[param];
|
|
1399
|
+
} else obj[param] = val[param];
|
|
1481
1400
|
}
|
|
1482
1401
|
return obj;
|
|
1483
1402
|
};
|
|
1484
1403
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1485
1404
|
const currentMod = modifierArray.shift();
|
|
1486
|
-
if (val[currentMod])
|
|
1487
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1405
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1488
1406
|
return val;
|
|
1489
1407
|
};
|
|
1490
1408
|
var findModifier = (val, modifier) => {
|
|
1491
|
-
if (isArray(modifier))
|
|
1492
|
-
|
|
1493
|
-
else
|
|
1494
|
-
return val[modifier];
|
|
1495
|
-
else
|
|
1496
|
-
return val;
|
|
1409
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1410
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1411
|
+
else return val;
|
|
1497
1412
|
};
|
|
1498
1413
|
var getMediaTheme = (value, modifier) => {
|
|
1499
1414
|
const activeConfig = getActiveConfig();
|
|
@@ -1519,8 +1434,7 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1519
1434
|
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1520
1435
|
var setFont = (val, key) => {
|
|
1521
1436
|
const CSSvar = `--font-${key}`;
|
|
1522
|
-
if (!val || isArray(val) && !val[0])
|
|
1523
|
-
return;
|
|
1437
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1524
1438
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1525
1439
|
return { var: CSSvar, value: val, fontFace };
|
|
1526
1440
|
};
|
|
@@ -1533,10 +1447,8 @@ var setFontFamily = (val, key) => {
|
|
|
1533
1447
|
const CONFIG2 = getActiveConfig();
|
|
1534
1448
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1535
1449
|
let { value, type } = val;
|
|
1536
|
-
if (val.isDefault)
|
|
1537
|
-
|
|
1538
|
-
if (isObject(value))
|
|
1539
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1450
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1451
|
+
if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
|
|
1540
1452
|
const CSSvar = `--font-family-${key}`;
|
|
1541
1453
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1542
1454
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1549,19 +1461,10 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1549
1461
|
for (const prop in FACTORY2) {
|
|
1550
1462
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1551
1463
|
const mediaValue = FACTORY2[prop];
|
|
1552
|
-
if (!isPropMedia)
|
|
1553
|
-
continue;
|
|
1464
|
+
if (!isPropMedia) continue;
|
|
1554
1465
|
const { mediaRegenerate } = FACTORY2;
|
|
1555
1466
|
const mediaName = prop.slice(1);
|
|
1556
|
-
const {
|
|
1557
|
-
type,
|
|
1558
|
-
base,
|
|
1559
|
-
ratio,
|
|
1560
|
-
range,
|
|
1561
|
-
subSequence,
|
|
1562
|
-
h1Matches,
|
|
1563
|
-
unit
|
|
1564
|
-
} = FACTORY2;
|
|
1467
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
1565
1468
|
merge(mediaValue, {
|
|
1566
1469
|
type,
|
|
1567
1470
|
base,
|
|
@@ -1591,7 +1494,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1591
1494
|
}
|
|
1592
1495
|
};
|
|
1593
1496
|
var applyHeadings = (props) => {
|
|
1594
|
-
var _a;
|
|
1497
|
+
var _a, _b;
|
|
1595
1498
|
const CONFIG2 = getActiveConfig();
|
|
1596
1499
|
if (props.h1Matches) {
|
|
1597
1500
|
const unit = props.unit;
|
|
@@ -1600,10 +1503,8 @@ var applyHeadings = (props) => {
|
|
|
1600
1503
|
for (const k in HEADINGS) {
|
|
1601
1504
|
const headerName = `h${parseInt(k) + 1}`;
|
|
1602
1505
|
const headerStyle = templates[headerName];
|
|
1603
|
-
if (!HEADINGS[k])
|
|
1604
|
-
continue;
|
|
1605
1506
|
templates[headerName] = {
|
|
1606
|
-
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
|
|
1507
|
+
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
|
|
1607
1508
|
margin: headerStyle ? headerStyle.margin : 0,
|
|
1608
1509
|
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
1609
1510
|
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
|
@@ -1623,11 +1524,7 @@ var applyTypographySequence = () => {
|
|
|
1623
1524
|
var getFontSizeByKey = (value) => {
|
|
1624
1525
|
const CONFIG2 = getActiveConfig();
|
|
1625
1526
|
const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
1626
|
-
return getSequenceValuePropertyPair(
|
|
1627
|
-
value,
|
|
1628
|
-
"fontSize",
|
|
1629
|
-
TYPOGRAPHY2
|
|
1630
|
-
);
|
|
1527
|
+
return getSequenceValuePropertyPair(value, "fontSize", TYPOGRAPHY2);
|
|
1631
1528
|
};
|
|
1632
1529
|
|
|
1633
1530
|
// src/system/spacing.js
|
|
@@ -1636,8 +1533,7 @@ var runThroughMedia2 = (FACTORY2) => {
|
|
|
1636
1533
|
for (const prop in FACTORY2) {
|
|
1637
1534
|
const mediaProps = FACTORY2[prop];
|
|
1638
1535
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1639
|
-
if (!isMediaName)
|
|
1640
|
-
continue;
|
|
1536
|
+
if (!isMediaName) continue;
|
|
1641
1537
|
const {
|
|
1642
1538
|
type,
|
|
1643
1539
|
base,
|
|
@@ -1674,8 +1570,7 @@ var applySpacingSequence = () => {
|
|
|
1674
1570
|
var getSequence = (sequenceProps) => {
|
|
1675
1571
|
const CONFIG2 = getActiveConfig();
|
|
1676
1572
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1677
|
-
if (!sequenceProps)
|
|
1678
|
-
return SPACING2;
|
|
1573
|
+
if (!sequenceProps) return SPACING2;
|
|
1679
1574
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1680
1575
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1681
1576
|
};
|
|
@@ -1685,8 +1580,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1685
1580
|
return { [propertyName]: value };
|
|
1686
1581
|
}
|
|
1687
1582
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1688
|
-
if (!isArray(stack))
|
|
1689
|
-
return;
|
|
1583
|
+
if (!isArray(stack)) return;
|
|
1690
1584
|
if (stack.length > 1) {
|
|
1691
1585
|
let suffix = "";
|
|
1692
1586
|
if (propertyName === "borderWidth") {
|
|
@@ -1765,15 +1659,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1765
1659
|
if (isString(value) && value.includes(",")) {
|
|
1766
1660
|
value = value.split(",").map((v) => {
|
|
1767
1661
|
v = v.trim();
|
|
1768
|
-
if (v.startsWith("--"))
|
|
1769
|
-
|
|
1770
|
-
if (
|
|
1771
|
-
return getColor(v);
|
|
1772
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1773
|
-
return v;
|
|
1662
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1663
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1664
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1774
1665
|
const arr = v.split(" ");
|
|
1775
|
-
if (!arr.length)
|
|
1776
|
-
return v;
|
|
1666
|
+
if (!arr.length) return v;
|
|
1777
1667
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1778
1668
|
}).join(" ");
|
|
1779
1669
|
}
|
|
@@ -1788,32 +1678,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1788
1678
|
};
|
|
1789
1679
|
var getShadow = (value, globalTheme) => {
|
|
1790
1680
|
const CONFIG2 = getActiveConfig();
|
|
1791
|
-
if (!globalTheme)
|
|
1792
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1681
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1793
1682
|
if (!isString(value)) {
|
|
1794
|
-
if (CONFIG2.verbose)
|
|
1795
|
-
console.warn(value, "- type for color is not valid");
|
|
1683
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1796
1684
|
return;
|
|
1797
1685
|
}
|
|
1798
|
-
if (value.slice(0, 2) === "--")
|
|
1799
|
-
return `var(${value})`;
|
|
1686
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1800
1687
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1801
1688
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1802
1689
|
const val = SHADOW2[name];
|
|
1803
1690
|
const isObj = isObject(val);
|
|
1804
1691
|
if (!val) {
|
|
1805
|
-
if (CONFIG2.verbose)
|
|
1806
|
-
console.warn("Can't find color ", name);
|
|
1692
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1807
1693
|
return value;
|
|
1808
1694
|
}
|
|
1809
1695
|
if (globalTheme) {
|
|
1810
|
-
if (val[globalTheme])
|
|
1811
|
-
|
|
1812
|
-
else if (CONFIG2.verbose)
|
|
1813
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1696
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1697
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1814
1698
|
}
|
|
1815
|
-
if (isObj && val.value)
|
|
1816
|
-
return val.value;
|
|
1699
|
+
if (isObj && val.value) return val.value;
|
|
1817
1700
|
if (isObj) {
|
|
1818
1701
|
const obj = {};
|
|
1819
1702
|
for (const mediaName in val) {
|
|
@@ -1823,8 +1706,7 @@ var getShadow = (value, globalTheme) => {
|
|
|
1823
1706
|
}
|
|
1824
1707
|
return obj;
|
|
1825
1708
|
}
|
|
1826
|
-
if (CONFIG2.verbose)
|
|
1827
|
-
console.warn("Can't find color", value);
|
|
1709
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1828
1710
|
return value;
|
|
1829
1711
|
};
|
|
1830
1712
|
|
|
@@ -1870,8 +1752,7 @@ var DEF_OPTIONS = {
|
|
|
1870
1752
|
var setSVG = (val, key) => {
|
|
1871
1753
|
const CONFIG2 = getActiveConfig();
|
|
1872
1754
|
if (!val) {
|
|
1873
|
-
if (CONFIG2.verbose)
|
|
1874
|
-
console.warn("setSVG: val is not defined", key);
|
|
1755
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1875
1756
|
return;
|
|
1876
1757
|
}
|
|
1877
1758
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1882,8 +1763,7 @@ var setSVG = (val, key) => {
|
|
|
1882
1763
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1883
1764
|
const CONFIG2 = getActiveConfig();
|
|
1884
1765
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
1885
|
-
for (const key in LIBRARY)
|
|
1886
|
-
lib[key] = CONFIG2.SVG[key];
|
|
1766
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
1887
1767
|
appendSVG(lib, options);
|
|
1888
1768
|
};
|
|
1889
1769
|
var setSvgIcon = (val, key) => {
|
|
@@ -1897,13 +1777,11 @@ var setSvgIcon = (val, key) => {
|
|
|
1897
1777
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1898
1778
|
const CONFIG2 = getActiveConfig();
|
|
1899
1779
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
1900
|
-
for (const key in LIBRARY)
|
|
1901
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
1780
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
1902
1781
|
appendSVG(lib, options);
|
|
1903
1782
|
};
|
|
1904
1783
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
1905
|
-
if (!document2 || !document2.createElementNS)
|
|
1906
|
-
return;
|
|
1784
|
+
if (!document2 || !document2.createElementNS) return;
|
|
1907
1785
|
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1908
1786
|
if (options.isRoot) {
|
|
1909
1787
|
svgElem.setAttribute("aria-hidden", "true");
|
|
@@ -1959,8 +1837,7 @@ var applyReset = (reset = {}) => {
|
|
|
1959
1837
|
}
|
|
1960
1838
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1961
1839
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1962
|
-
if (RESET2.html)
|
|
1963
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1840
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1964
1841
|
return deepMerge(merge(RESET2, reset), {
|
|
1965
1842
|
html: {
|
|
1966
1843
|
position: "absolute",
|