@symbo.ls/scratch 2.25.3 → 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 +8 -9
- package/dist/cjs/index.js +169 -335
- package/dist/cjs/set.js +120 -237
- package/dist/cjs/system/color.js +48 -86
- package/dist/cjs/system/document.js +20 -30
- package/dist/cjs/system/font.js +24 -38
- package/dist/cjs/system/index.js +120 -240
- package/dist/cjs/system/reset.js +27 -44
- package/dist/cjs/system/shadow.js +63 -116
- package/dist/cjs/system/spacing.js +35 -60
- package/dist/cjs/system/svg.js +25 -40
- package/dist/cjs/system/theme.js +61 -112
- package/dist/cjs/system/timing.js +28 -46
- package/dist/cjs/system/typography.js +37 -74
- package/dist/cjs/transforms/index.js +86 -162
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +54 -98
- package/dist/cjs/utils/sequence.js +28 -46
- package/dist/cjs/utils/sprite.js +9 -11
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +22 -34
- 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) => {
|
|
@@ -329,7 +318,10 @@ var isUndefined = (arg) => {
|
|
|
329
318
|
|
|
330
319
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
331
320
|
var mergeArray = (arr, exclude = []) => {
|
|
332
|
-
return arr.reduce(
|
|
321
|
+
return arr.reduce(
|
|
322
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
323
|
+
{}
|
|
324
|
+
);
|
|
333
325
|
};
|
|
334
326
|
|
|
335
327
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -398,8 +390,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
398
390
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
399
391
|
visited.set(obj, clone2);
|
|
400
392
|
for (const key in obj) {
|
|
401
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
402
|
-
continue;
|
|
393
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
403
394
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
404
395
|
continue;
|
|
405
396
|
const value = obj[key];
|
|
@@ -433,14 +424,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
433
424
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
434
425
|
return params;
|
|
435
426
|
}
|
|
436
|
-
if (visited.has(obj))
|
|
437
|
-
return visited.get(obj);
|
|
427
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
438
428
|
visited.set(obj, obj);
|
|
439
429
|
for (const e in params) {
|
|
440
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
441
|
-
|
|
442
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
443
|
-
continue;
|
|
430
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
431
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
444
432
|
const objProp = obj[e];
|
|
445
433
|
const paramsProp = params[e];
|
|
446
434
|
if (isDOMNode(paramsProp)) {
|
|
@@ -685,10 +673,8 @@ var isScalingUnit = (unit) => {
|
|
|
685
673
|
|
|
686
674
|
// src/utils/color.js
|
|
687
675
|
var colorStringToRgbaArray = (color) => {
|
|
688
|
-
if (color === "")
|
|
689
|
-
|
|
690
|
-
if (color.toLowerCase() === "transparent")
|
|
691
|
-
return [0, 0, 0, 0];
|
|
676
|
+
if (color === "") return [0, 0, 0, 0];
|
|
677
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
692
678
|
if (color[0] === "#") {
|
|
693
679
|
if (color.length < 7) {
|
|
694
680
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -719,8 +705,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
719
705
|
}
|
|
720
706
|
}
|
|
721
707
|
if (color.indexOf("rgb") === 0) {
|
|
722
|
-
if (color.indexOf("rgba") === -1)
|
|
723
|
-
color = `${color}, 1`;
|
|
708
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
724
709
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
725
710
|
}
|
|
726
711
|
return [0, 0, 0, 0];
|
|
@@ -746,29 +731,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
746
731
|
var getColorShade = (col, amt) => {
|
|
747
732
|
const num = parseInt(col, 16);
|
|
748
733
|
let r = (num >> 16) + amt;
|
|
749
|
-
if (r > 255)
|
|
750
|
-
|
|
751
|
-
else if (r < 0)
|
|
752
|
-
r = 0;
|
|
734
|
+
if (r > 255) r = 255;
|
|
735
|
+
else if (r < 0) r = 0;
|
|
753
736
|
let b = (num >> 8 & 255) + amt;
|
|
754
|
-
if (b > 255)
|
|
755
|
-
|
|
756
|
-
else if (b < 0)
|
|
757
|
-
b = 0;
|
|
737
|
+
if (b > 255) b = 255;
|
|
738
|
+
else if (b < 0) b = 0;
|
|
758
739
|
let g = (num & 255) + amt;
|
|
759
|
-
if (g > 255)
|
|
760
|
-
|
|
761
|
-
else if (g < 0)
|
|
762
|
-
g = 0;
|
|
740
|
+
if (g > 255) g = 255;
|
|
741
|
+
else if (g < 0) g = 0;
|
|
763
742
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
764
743
|
};
|
|
765
744
|
var getRgbTone = (rgb, tone) => {
|
|
766
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
767
|
-
|
|
768
|
-
if (
|
|
769
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
770
|
-
if (isNumber(tone))
|
|
771
|
-
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 += "";
|
|
772
748
|
const toHex = rgbArrayToHex(rgb);
|
|
773
749
|
const abs = tone.slice(0, 1);
|
|
774
750
|
if (abs === "-" || abs === "+") {
|
|
@@ -785,10 +761,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
785
761
|
|
|
786
762
|
// src/utils/font.js
|
|
787
763
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
788
|
-
if (LIBRARY[key])
|
|
789
|
-
|
|
790
|
-
if (LIBRARY.default)
|
|
791
|
-
return LIBRARY[LIBRARY.default].value;
|
|
764
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
765
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
792
766
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
793
767
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
794
768
|
};
|
|
@@ -856,8 +830,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
856
830
|
var setScalingVar = (key, sequenceProps) => {
|
|
857
831
|
const { base, type, unit } = sequenceProps;
|
|
858
832
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
859
|
-
if (key === 0)
|
|
860
|
-
return defaultVal;
|
|
833
|
+
if (key === 0) return defaultVal;
|
|
861
834
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
862
835
|
const ratioVar = `${prefix}-ratio`;
|
|
863
836
|
if (key > 0) {
|
|
@@ -894,10 +867,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
894
867
|
const diffRounded = ~~next - ~~value;
|
|
895
868
|
let arr;
|
|
896
869
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
897
|
-
if (diffRounded > 16)
|
|
898
|
-
|
|
899
|
-
else
|
|
900
|
-
arr = [first, second];
|
|
870
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
871
|
+
else arr = [first, second];
|
|
901
872
|
arr.forEach((v, k) => {
|
|
902
873
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
903
874
|
const newVar = variable + (k + 1);
|
|
@@ -939,8 +910,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
939
910
|
index: key
|
|
940
911
|
};
|
|
941
912
|
setSequenceValue(props, sequenceProps);
|
|
942
|
-
if (subSequence)
|
|
943
|
-
generateSubSequence(props, sequenceProps);
|
|
913
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
944
914
|
}
|
|
945
915
|
return sequenceProps;
|
|
946
916
|
};
|
|
@@ -952,13 +922,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
952
922
|
unit = UNIT2.default,
|
|
953
923
|
useVariable
|
|
954
924
|
} = sequenceProps;
|
|
955
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
956
|
-
return `var(${value})`;
|
|
925
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
957
926
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
958
927
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
959
928
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
960
|
-
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)
|
|
961
|
-
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;
|
|
962
930
|
const letterVal = value.toUpperCase();
|
|
963
931
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
964
932
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -982,8 +950,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
982
950
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
983
951
|
}
|
|
984
952
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
985
|
-
if (CONFIG2.verbose)
|
|
986
|
-
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");
|
|
987
954
|
absValue = absValue.slice(0, 1);
|
|
988
955
|
}
|
|
989
956
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -991,8 +958,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
991
958
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
992
959
|
}
|
|
993
960
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
994
|
-
if (!sequenceItem)
|
|
995
|
-
return console.warn("can't find", sequence, absValue);
|
|
961
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
996
962
|
if (unit === "ms" || unit === "s") {
|
|
997
963
|
return isNegative + sequenceItem.val + unit;
|
|
998
964
|
}
|
|
@@ -1001,12 +967,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1001
967
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1002
968
|
if (typeof value !== "string") {
|
|
1003
969
|
const CONFIG2 = getActiveConfig();
|
|
1004
|
-
if (CONFIG2.verbose)
|
|
1005
|
-
console.warn(propertyName, value, "is not a string");
|
|
970
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1006
971
|
return { [propertyName]: value };
|
|
1007
972
|
}
|
|
1008
|
-
if (value === "-" || value === "")
|
|
1009
|
-
return {};
|
|
973
|
+
if (value === "-" || value === "") return {};
|
|
1010
974
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1011
975
|
};
|
|
1012
976
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1066,23 +1030,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1066
1030
|
const { mediaRegenerate } = FACTORY2;
|
|
1067
1031
|
const { sequence, scales } = FACTORY2[media];
|
|
1068
1032
|
const query = MEDIA2[mediaName];
|
|
1069
|
-
if (!query && CONFIG2.verbose)
|
|
1070
|
-
console.warn("Can't find media query ", query);
|
|
1033
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1071
1034
|
if (!mediaRegenerate) {
|
|
1072
1035
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1073
|
-
if (!underMediaQuery)
|
|
1074
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1036
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1075
1037
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1076
1038
|
return;
|
|
1077
1039
|
}
|
|
1078
1040
|
for (const key in sequence) {
|
|
1079
1041
|
const item = sequence[key];
|
|
1080
1042
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1081
|
-
if (!query && CONFIG2.verbose)
|
|
1082
|
-
console.warn("Can't find query ", query);
|
|
1043
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1083
1044
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1084
|
-
if (!underMediaQuery)
|
|
1085
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1045
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1086
1046
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1087
1047
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1088
1048
|
}
|
|
@@ -1095,10 +1055,8 @@ var generateSprite = (icons) => {
|
|
|
1095
1055
|
const CONFIG2 = getActiveConfig();
|
|
1096
1056
|
let sprite = "";
|
|
1097
1057
|
for (const key in icons) {
|
|
1098
|
-
if (CONFIG2.__svg_cache[key])
|
|
1099
|
-
|
|
1100
|
-
else
|
|
1101
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1058
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1059
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1102
1060
|
sprite += icons[key];
|
|
1103
1061
|
}
|
|
1104
1062
|
return sprite;
|
|
@@ -1106,8 +1064,7 @@ var generateSprite = (icons) => {
|
|
|
1106
1064
|
var parseRootAttributes = (htmlString) => {
|
|
1107
1065
|
const val = htmlString.default || htmlString;
|
|
1108
1066
|
if (!isString(val)) {
|
|
1109
|
-
if (isDev)
|
|
1110
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1067
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1111
1068
|
return;
|
|
1112
1069
|
}
|
|
1113
1070
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -1155,27 +1112,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1155
1112
|
var getColor = (value, key, config) => {
|
|
1156
1113
|
const CONFIG2 = config || getActiveConfig();
|
|
1157
1114
|
if (!isString(value)) {
|
|
1158
|
-
if (CONFIG2.verbose)
|
|
1159
|
-
console.warn(value, "- type for color is not valid");
|
|
1115
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1160
1116
|
return;
|
|
1161
1117
|
}
|
|
1162
|
-
if (value.slice(0, 2) === "--")
|
|
1163
|
-
|
|
1164
|
-
if (key && value[key])
|
|
1165
|
-
value = value[key];
|
|
1118
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1119
|
+
if (key && value[key]) value = value[key];
|
|
1166
1120
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1167
1121
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1168
1122
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1169
1123
|
if (!val) {
|
|
1170
|
-
if (CONFIG2.verbose)
|
|
1171
|
-
console.warn("Can't find color ", name);
|
|
1124
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1172
1125
|
return value;
|
|
1173
1126
|
}
|
|
1174
1127
|
if (key) {
|
|
1175
|
-
if (val[key])
|
|
1176
|
-
|
|
1177
|
-
else if (CONFIG2.verbose)
|
|
1178
|
-
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);
|
|
1179
1130
|
}
|
|
1180
1131
|
let rgb = val.rgb;
|
|
1181
1132
|
if (!rgb) {
|
|
@@ -1185,32 +1136,25 @@ var getColor = (value, key, config) => {
|
|
|
1185
1136
|
rgb = getRgbTone(rgb, tone);
|
|
1186
1137
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1187
1138
|
}
|
|
1188
|
-
if (val[tone])
|
|
1189
|
-
|
|
1190
|
-
if (alpha)
|
|
1191
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1139
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1140
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1192
1141
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1193
1142
|
};
|
|
1194
1143
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1195
1144
|
const CONFIG2 = config || getActiveConfig();
|
|
1196
|
-
if (!globalTheme)
|
|
1197
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1145
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1198
1146
|
if (!isString(value)) {
|
|
1199
|
-
if (CONFIG2.verbose)
|
|
1200
|
-
console.warn(value, "- type for color is not valid");
|
|
1147
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1201
1148
|
return;
|
|
1202
1149
|
}
|
|
1203
|
-
if (value.slice(0, 2) === "--")
|
|
1204
|
-
return `var(${value})`;
|
|
1150
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1205
1151
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1206
1152
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1207
1153
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1208
1154
|
const isObj = isObject(val);
|
|
1209
|
-
if (isObj && val.value)
|
|
1210
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1155
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1211
1156
|
else if (isObj) {
|
|
1212
|
-
if (globalTheme)
|
|
1213
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1157
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1214
1158
|
else {
|
|
1215
1159
|
const obj = {};
|
|
1216
1160
|
for (const mediaName in val) {
|
|
@@ -1221,8 +1165,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1221
1165
|
return obj;
|
|
1222
1166
|
}
|
|
1223
1167
|
} else {
|
|
1224
|
-
if (CONFIG2.verbose)
|
|
1225
|
-
console.warn("Can't find color", value);
|
|
1168
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1226
1169
|
return value;
|
|
1227
1170
|
}
|
|
1228
1171
|
};
|
|
@@ -1231,8 +1174,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1231
1174
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1232
1175
|
val = getColor(val.slice(2));
|
|
1233
1176
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1234
|
-
if (CONFIG2.verbose)
|
|
1235
|
-
console.warn(val, "- referred but does not exist");
|
|
1177
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1236
1178
|
val = val.split(" ")[0];
|
|
1237
1179
|
}
|
|
1238
1180
|
}
|
|
@@ -1271,8 +1213,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1271
1213
|
};
|
|
1272
1214
|
var setGradient = (val, key, suffix) => {
|
|
1273
1215
|
const CONFIG2 = getActiveConfig();
|
|
1274
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1275
|
-
val = getColor(val.slice(2));
|
|
1216
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1276
1217
|
if (isArray(val)) {
|
|
1277
1218
|
return {
|
|
1278
1219
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1281,8 +1222,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1281
1222
|
}
|
|
1282
1223
|
if (isObject(val)) {
|
|
1283
1224
|
const obj = {};
|
|
1284
|
-
for (const variant in val)
|
|
1285
|
-
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);
|
|
1286
1226
|
return obj;
|
|
1287
1227
|
}
|
|
1288
1228
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1308,22 +1248,19 @@ var setThemeValue = (theme) => {
|
|
|
1308
1248
|
return value;
|
|
1309
1249
|
};
|
|
1310
1250
|
var getThemeValue = (theme) => {
|
|
1311
|
-
if (theme.value)
|
|
1312
|
-
return theme.value;
|
|
1251
|
+
if (theme.value) return theme.value;
|
|
1313
1252
|
theme.value = setThemeValue(theme);
|
|
1314
1253
|
return theme.value;
|
|
1315
1254
|
};
|
|
1316
1255
|
var getTheme = (value, modifier) => {
|
|
1317
1256
|
const CONFIG2 = getActiveConfig();
|
|
1318
|
-
if (CONFIG2.useVariable)
|
|
1319
|
-
return getMediaTheme(value, modifier);
|
|
1257
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1320
1258
|
const { THEME: THEME2 } = CONFIG2;
|
|
1321
1259
|
if (isString(value)) {
|
|
1322
1260
|
const [theme, subtheme] = value.split(" ");
|
|
1323
1261
|
const isOurTheme = THEME2[theme];
|
|
1324
1262
|
if (isOurTheme) {
|
|
1325
|
-
if (!subtheme && !modifier)
|
|
1326
|
-
return getThemeValue(isOurTheme);
|
|
1263
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1327
1264
|
value = [theme, subtheme || modifier];
|
|
1328
1265
|
}
|
|
1329
1266
|
}
|
|
@@ -1331,14 +1268,10 @@ var getTheme = (value, modifier) => {
|
|
|
1331
1268
|
const themeName = value[0];
|
|
1332
1269
|
const subThemeName = value[1];
|
|
1333
1270
|
const { helpers, media, state } = THEME2[themeName];
|
|
1334
|
-
if (media && media[subThemeName])
|
|
1335
|
-
|
|
1336
|
-
if (
|
|
1337
|
-
|
|
1338
|
-
if (state && state[subThemeName])
|
|
1339
|
-
return getThemeValue(state[subThemeName]);
|
|
1340
|
-
} else if (isObject(value))
|
|
1341
|
-
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);
|
|
1342
1275
|
};
|
|
1343
1276
|
var setInverseTheme = (theme, variant, value) => {
|
|
1344
1277
|
if (isObject(variant)) {
|
|
@@ -1356,13 +1289,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1356
1289
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1357
1290
|
const result = getTheme(variant);
|
|
1358
1291
|
themeValue[`&:${key}`] = result;
|
|
1359
|
-
if (isObject(variant) && !variant.value)
|
|
1360
|
-
variant.value = result;
|
|
1292
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1361
1293
|
};
|
|
1362
1294
|
var setSelectors = (theme, value) => {
|
|
1363
1295
|
const { state } = theme;
|
|
1364
|
-
if (!state)
|
|
1365
|
-
return;
|
|
1296
|
+
if (!state) return;
|
|
1366
1297
|
const keys = Object.keys(state);
|
|
1367
1298
|
keys.map((key) => {
|
|
1368
1299
|
const variant = state[key];
|
|
@@ -1374,20 +1305,16 @@ var setSelectors = (theme, value) => {
|
|
|
1374
1305
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1375
1306
|
const result = getTheme(variant);
|
|
1376
1307
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1377
|
-
if (isObject(variant) && !variant.value)
|
|
1378
|
-
variant.value = result;
|
|
1308
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1379
1309
|
};
|
|
1380
1310
|
var setMedia = (theme, value) => {
|
|
1381
1311
|
const { media } = theme;
|
|
1382
|
-
if (!media)
|
|
1383
|
-
return;
|
|
1312
|
+
if (!media) return;
|
|
1384
1313
|
const keys = Object.keys(media);
|
|
1385
1314
|
keys.map((key) => {
|
|
1386
1315
|
const variant = media[key];
|
|
1387
|
-
if (key === "dark" || key === "light")
|
|
1388
|
-
|
|
1389
|
-
if (key === "inverse")
|
|
1390
|
-
setInverseTheme(theme, variant, value);
|
|
1316
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1317
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1391
1318
|
return theme;
|
|
1392
1319
|
});
|
|
1393
1320
|
return theme;
|
|
@@ -1395,23 +1322,19 @@ var setMedia = (theme, value) => {
|
|
|
1395
1322
|
var setHelpers = (theme, value) => {
|
|
1396
1323
|
const CONFIG2 = getActiveConfig();
|
|
1397
1324
|
const { helpers } = theme;
|
|
1398
|
-
if (!helpers)
|
|
1399
|
-
return;
|
|
1325
|
+
if (!helpers) return;
|
|
1400
1326
|
const keys = Object.keys(helpers);
|
|
1401
1327
|
keys.map((key) => {
|
|
1402
1328
|
const helper = helpers[key];
|
|
1403
|
-
if (isString(helper))
|
|
1404
|
-
|
|
1405
|
-
else
|
|
1406
|
-
getThemeValue(helpers[key]);
|
|
1329
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1330
|
+
else getThemeValue(helpers[key]);
|
|
1407
1331
|
return theme;
|
|
1408
1332
|
});
|
|
1409
1333
|
return theme;
|
|
1410
1334
|
};
|
|
1411
1335
|
var setTheme = (val, key) => {
|
|
1412
1336
|
const CONFIG2 = getActiveConfig();
|
|
1413
|
-
if (CONFIG2.useVariable)
|
|
1414
|
-
return setMediaTheme(val, key);
|
|
1337
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1415
1338
|
const { state, media, helpers } = val;
|
|
1416
1339
|
const value = setThemeValue(val, key);
|
|
1417
1340
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1473,24 +1396,19 @@ var recursiveTheme = (val) => {
|
|
|
1473
1396
|
} else if (symb === ":") {
|
|
1474
1397
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1475
1398
|
}
|
|
1476
|
-
} else
|
|
1477
|
-
obj[param] = val[param];
|
|
1399
|
+
} else obj[param] = val[param];
|
|
1478
1400
|
}
|
|
1479
1401
|
return obj;
|
|
1480
1402
|
};
|
|
1481
1403
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1482
1404
|
const currentMod = modifierArray.shift();
|
|
1483
|
-
if (val[currentMod])
|
|
1484
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1405
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1485
1406
|
return val;
|
|
1486
1407
|
};
|
|
1487
1408
|
var findModifier = (val, modifier) => {
|
|
1488
|
-
if (isArray(modifier))
|
|
1489
|
-
|
|
1490
|
-
else
|
|
1491
|
-
return val[modifier];
|
|
1492
|
-
else
|
|
1493
|
-
return val;
|
|
1409
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1410
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1411
|
+
else return val;
|
|
1494
1412
|
};
|
|
1495
1413
|
var getMediaTheme = (value, modifier) => {
|
|
1496
1414
|
const activeConfig = getActiveConfig();
|
|
@@ -1516,8 +1434,7 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1516
1434
|
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1517
1435
|
var setFont = (val, key) => {
|
|
1518
1436
|
const CSSvar = `--font-${key}`;
|
|
1519
|
-
if (!val || isArray(val) && !val[0])
|
|
1520
|
-
return;
|
|
1437
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1521
1438
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1522
1439
|
return { var: CSSvar, value: val, fontFace };
|
|
1523
1440
|
};
|
|
@@ -1530,10 +1447,8 @@ var setFontFamily = (val, key) => {
|
|
|
1530
1447
|
const CONFIG2 = getActiveConfig();
|
|
1531
1448
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1532
1449
|
let { value, type } = val;
|
|
1533
|
-
if (val.isDefault)
|
|
1534
|
-
|
|
1535
|
-
if (isObject(value))
|
|
1536
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1450
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1451
|
+
if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
|
|
1537
1452
|
const CSSvar = `--font-family-${key}`;
|
|
1538
1453
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1539
1454
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1546,19 +1461,10 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1546
1461
|
for (const prop in FACTORY2) {
|
|
1547
1462
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1548
1463
|
const mediaValue = FACTORY2[prop];
|
|
1549
|
-
if (!isPropMedia)
|
|
1550
|
-
continue;
|
|
1464
|
+
if (!isPropMedia) continue;
|
|
1551
1465
|
const { mediaRegenerate } = FACTORY2;
|
|
1552
1466
|
const mediaName = prop.slice(1);
|
|
1553
|
-
const {
|
|
1554
|
-
type,
|
|
1555
|
-
base,
|
|
1556
|
-
ratio,
|
|
1557
|
-
range,
|
|
1558
|
-
subSequence,
|
|
1559
|
-
h1Matches,
|
|
1560
|
-
unit
|
|
1561
|
-
} = FACTORY2;
|
|
1467
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
1562
1468
|
merge(mediaValue, {
|
|
1563
1469
|
type,
|
|
1564
1470
|
base,
|
|
@@ -1588,7 +1494,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1588
1494
|
}
|
|
1589
1495
|
};
|
|
1590
1496
|
var applyHeadings = (props) => {
|
|
1591
|
-
var _a;
|
|
1497
|
+
var _a, _b;
|
|
1592
1498
|
const CONFIG2 = getActiveConfig();
|
|
1593
1499
|
if (props.h1Matches) {
|
|
1594
1500
|
const unit = props.unit;
|
|
@@ -1597,10 +1503,8 @@ var applyHeadings = (props) => {
|
|
|
1597
1503
|
for (const k in HEADINGS) {
|
|
1598
1504
|
const headerName = `h${parseInt(k) + 1}`;
|
|
1599
1505
|
const headerStyle = templates[headerName];
|
|
1600
|
-
if (!HEADINGS[k])
|
|
1601
|
-
continue;
|
|
1602
1506
|
templates[headerName] = {
|
|
1603
|
-
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}`,
|
|
1604
1508
|
margin: headerStyle ? headerStyle.margin : 0,
|
|
1605
1509
|
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
1606
1510
|
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
|
@@ -1620,11 +1524,7 @@ var applyTypographySequence = () => {
|
|
|
1620
1524
|
var getFontSizeByKey = (value) => {
|
|
1621
1525
|
const CONFIG2 = getActiveConfig();
|
|
1622
1526
|
const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
1623
|
-
return getSequenceValuePropertyPair(
|
|
1624
|
-
value,
|
|
1625
|
-
"fontSize",
|
|
1626
|
-
TYPOGRAPHY2
|
|
1627
|
-
);
|
|
1527
|
+
return getSequenceValuePropertyPair(value, "fontSize", TYPOGRAPHY2);
|
|
1628
1528
|
};
|
|
1629
1529
|
|
|
1630
1530
|
// src/system/spacing.js
|
|
@@ -1633,8 +1533,7 @@ var runThroughMedia2 = (FACTORY2) => {
|
|
|
1633
1533
|
for (const prop in FACTORY2) {
|
|
1634
1534
|
const mediaProps = FACTORY2[prop];
|
|
1635
1535
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1636
|
-
if (!isMediaName)
|
|
1637
|
-
continue;
|
|
1536
|
+
if (!isMediaName) continue;
|
|
1638
1537
|
const {
|
|
1639
1538
|
type,
|
|
1640
1539
|
base,
|
|
@@ -1671,8 +1570,7 @@ var applySpacingSequence = () => {
|
|
|
1671
1570
|
var getSequence = (sequenceProps) => {
|
|
1672
1571
|
const CONFIG2 = getActiveConfig();
|
|
1673
1572
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1674
|
-
if (!sequenceProps)
|
|
1675
|
-
return SPACING2;
|
|
1573
|
+
if (!sequenceProps) return SPACING2;
|
|
1676
1574
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1677
1575
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1678
1576
|
};
|
|
@@ -1682,8 +1580,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1682
1580
|
return { [propertyName]: value };
|
|
1683
1581
|
}
|
|
1684
1582
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1685
|
-
if (!isArray(stack))
|
|
1686
|
-
return;
|
|
1583
|
+
if (!isArray(stack)) return;
|
|
1687
1584
|
if (stack.length > 1) {
|
|
1688
1585
|
let suffix = "";
|
|
1689
1586
|
if (propertyName === "borderWidth") {
|
|
@@ -1762,15 +1659,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1762
1659
|
if (isString(value) && value.includes(",")) {
|
|
1763
1660
|
value = value.split(",").map((v) => {
|
|
1764
1661
|
v = v.trim();
|
|
1765
|
-
if (v.startsWith("--"))
|
|
1766
|
-
|
|
1767
|
-
if (
|
|
1768
|
-
return getColor(v);
|
|
1769
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1770
|
-
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;
|
|
1771
1665
|
const arr = v.split(" ");
|
|
1772
|
-
if (!arr.length)
|
|
1773
|
-
return v;
|
|
1666
|
+
if (!arr.length) return v;
|
|
1774
1667
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1775
1668
|
}).join(" ");
|
|
1776
1669
|
}
|
|
@@ -1785,32 +1678,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1785
1678
|
};
|
|
1786
1679
|
var getShadow = (value, globalTheme) => {
|
|
1787
1680
|
const CONFIG2 = getActiveConfig();
|
|
1788
|
-
if (!globalTheme)
|
|
1789
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1681
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1790
1682
|
if (!isString(value)) {
|
|
1791
|
-
if (CONFIG2.verbose)
|
|
1792
|
-
console.warn(value, "- type for color is not valid");
|
|
1683
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1793
1684
|
return;
|
|
1794
1685
|
}
|
|
1795
|
-
if (value.slice(0, 2) === "--")
|
|
1796
|
-
return `var(${value})`;
|
|
1686
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1797
1687
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1798
1688
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1799
1689
|
const val = SHADOW2[name];
|
|
1800
1690
|
const isObj = isObject(val);
|
|
1801
1691
|
if (!val) {
|
|
1802
|
-
if (CONFIG2.verbose)
|
|
1803
|
-
console.warn("Can't find color ", name);
|
|
1692
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1804
1693
|
return value;
|
|
1805
1694
|
}
|
|
1806
1695
|
if (globalTheme) {
|
|
1807
|
-
if (val[globalTheme])
|
|
1808
|
-
|
|
1809
|
-
else if (CONFIG2.verbose)
|
|
1810
|
-
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);
|
|
1811
1698
|
}
|
|
1812
|
-
if (isObj && val.value)
|
|
1813
|
-
return val.value;
|
|
1699
|
+
if (isObj && val.value) return val.value;
|
|
1814
1700
|
if (isObj) {
|
|
1815
1701
|
const obj = {};
|
|
1816
1702
|
for (const mediaName in val) {
|
|
@@ -1820,8 +1706,7 @@ var getShadow = (value, globalTheme) => {
|
|
|
1820
1706
|
}
|
|
1821
1707
|
return obj;
|
|
1822
1708
|
}
|
|
1823
|
-
if (CONFIG2.verbose)
|
|
1824
|
-
console.warn("Can't find color", value);
|
|
1709
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1825
1710
|
return value;
|
|
1826
1711
|
};
|
|
1827
1712
|
|
|
@@ -1867,8 +1752,7 @@ var DEF_OPTIONS = {
|
|
|
1867
1752
|
var setSVG = (val, key) => {
|
|
1868
1753
|
const CONFIG2 = getActiveConfig();
|
|
1869
1754
|
if (!val) {
|
|
1870
|
-
if (CONFIG2.verbose)
|
|
1871
|
-
console.warn("setSVG: val is not defined", key);
|
|
1755
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1872
1756
|
return;
|
|
1873
1757
|
}
|
|
1874
1758
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1879,8 +1763,7 @@ var setSVG = (val, key) => {
|
|
|
1879
1763
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1880
1764
|
const CONFIG2 = getActiveConfig();
|
|
1881
1765
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
1882
|
-
for (const key in LIBRARY)
|
|
1883
|
-
lib[key] = CONFIG2.SVG[key];
|
|
1766
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
1884
1767
|
appendSVG(lib, options);
|
|
1885
1768
|
};
|
|
1886
1769
|
var setSvgIcon = (val, key) => {
|
|
@@ -1894,13 +1777,11 @@ var setSvgIcon = (val, key) => {
|
|
|
1894
1777
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1895
1778
|
const CONFIG2 = getActiveConfig();
|
|
1896
1779
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
1897
|
-
for (const key in LIBRARY)
|
|
1898
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
1780
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
1899
1781
|
appendSVG(lib, options);
|
|
1900
1782
|
};
|
|
1901
1783
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
1902
|
-
if (!document2 || !document2.createElementNS)
|
|
1903
|
-
return;
|
|
1784
|
+
if (!document2 || !document2.createElementNS) return;
|
|
1904
1785
|
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1905
1786
|
if (options.isRoot) {
|
|
1906
1787
|
svgElem.setAttribute("aria-hidden", "true");
|
|
@@ -1956,8 +1837,7 @@ var applyReset = (reset = {}) => {
|
|
|
1956
1837
|
}
|
|
1957
1838
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1958
1839
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1959
|
-
if (RESET2.html)
|
|
1960
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1840
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1961
1841
|
return deepMerge(merge(RESET2, reset), {
|
|
1962
1842
|
html: {
|
|
1963
1843
|
position: "absolute",
|