@symbo.ls/scratch 2.27.0 → 2.27.10
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 +5 -8
- package/dist/cjs/index.js +177 -347
- package/dist/cjs/set.js +126 -241
- package/dist/cjs/system/color.js +53 -87
- package/dist/cjs/system/document.js +25 -29
- package/dist/cjs/system/font.js +29 -37
- package/dist/cjs/system/index.js +126 -244
- package/dist/cjs/system/reset.js +32 -43
- package/dist/cjs/system/shadow.js +68 -117
- package/dist/cjs/system/spacing.js +40 -59
- package/dist/cjs/system/svg.js +31 -42
- package/dist/cjs/system/theme.js +66 -113
- package/dist/cjs/system/timing.js +33 -45
- package/dist/cjs/system/typography.js +42 -73
- package/dist/cjs/transforms/index.js +91 -163
- package/dist/cjs/utils/color.js +21 -36
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +62 -110
- package/dist/cjs/utils/sequence.js +25 -45
- package/dist/cjs/utils/sprite.js +15 -13
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +19 -33
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
- package/src/utils/color.js +42 -31
- package/src/utils/sprite.js +12 -8
package/dist/cjs/set.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
|
});
|
|
@@ -273,6 +264,11 @@ __export(set_exports, {
|
|
|
273
264
|
});
|
|
274
265
|
module.exports = __toCommonJS(set_exports);
|
|
275
266
|
|
|
267
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
268
|
+
var NODE_ENV = "development";
|
|
269
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
270
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
271
|
+
|
|
276
272
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
277
273
|
var window2 = globalThis;
|
|
278
274
|
var document2 = window2.document;
|
|
@@ -284,8 +280,7 @@ var isDOMNode = (obj) => {
|
|
|
284
280
|
|
|
285
281
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
286
282
|
var isObject = (arg) => {
|
|
287
|
-
if (arg === null)
|
|
288
|
-
return false;
|
|
283
|
+
if (arg === null) return false;
|
|
289
284
|
return typeof arg === "object" && arg.constructor === Object;
|
|
290
285
|
};
|
|
291
286
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -294,8 +289,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
294
289
|
var isNull = (arg) => arg === null;
|
|
295
290
|
var isArray = (arg) => Array.isArray(arg);
|
|
296
291
|
var isObjectLike = (arg) => {
|
|
297
|
-
if (arg === null)
|
|
298
|
-
return false;
|
|
292
|
+
if (arg === null) return false;
|
|
299
293
|
return typeof arg === "object";
|
|
300
294
|
};
|
|
301
295
|
var isUndefined = (arg) => {
|
|
@@ -376,8 +370,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
376
370
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
377
371
|
visited.set(obj, clone2);
|
|
378
372
|
for (const key in obj) {
|
|
379
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
380
|
-
continue;
|
|
373
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
381
374
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
382
375
|
continue;
|
|
383
376
|
const value = obj[key];
|
|
@@ -411,14 +404,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
411
404
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
412
405
|
return params;
|
|
413
406
|
}
|
|
414
|
-
if (visited.has(obj))
|
|
415
|
-
return visited.get(obj);
|
|
407
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
416
408
|
visited.set(obj, obj);
|
|
417
409
|
for (const e in params) {
|
|
418
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
419
|
-
|
|
420
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
421
|
-
continue;
|
|
410
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
411
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
422
412
|
const objProp = obj[e];
|
|
423
413
|
const paramsProp = params[e];
|
|
424
414
|
if (isDOMNode(paramsProp)) {
|
|
@@ -656,8 +646,7 @@ var getActiveConfig = (def) => {
|
|
|
656
646
|
return FACTORY[def || FACTORY.active] || CONFIG;
|
|
657
647
|
};
|
|
658
648
|
var setActiveConfig = (newConfig) => {
|
|
659
|
-
if (!isObject(newConfig))
|
|
660
|
-
return;
|
|
649
|
+
if (!isObject(newConfig)) return;
|
|
661
650
|
FACTORY.active = "1";
|
|
662
651
|
FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
|
|
663
652
|
return newConfig;
|
|
@@ -670,10 +659,8 @@ var isScalingUnit = (unit) => {
|
|
|
670
659
|
|
|
671
660
|
// src/utils/color.js
|
|
672
661
|
var colorStringToRgbaArray = (color) => {
|
|
673
|
-
if (color === "")
|
|
674
|
-
|
|
675
|
-
if (color.toLowerCase() === "transparent")
|
|
676
|
-
return [0, 0, 0, 0];
|
|
662
|
+
if (color === "") return [0, 0, 0, 0];
|
|
663
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
677
664
|
if (color[0] === "#") {
|
|
678
665
|
if (color.length < 7) {
|
|
679
666
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -704,8 +691,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
704
691
|
}
|
|
705
692
|
}
|
|
706
693
|
if (color.indexOf("rgb") === 0) {
|
|
707
|
-
if (color.indexOf("rgba") === -1)
|
|
708
|
-
color = `${color}, 1`;
|
|
694
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
709
695
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
710
696
|
}
|
|
711
697
|
return [0, 0, 0, 0];
|
|
@@ -724,36 +710,25 @@ var rgbToHSL = (r, g, b) => {
|
|
|
724
710
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
725
711
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
726
712
|
};
|
|
727
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
728
|
-
Math.min(k - 3, 9 - k, 1),
|
|
729
|
-
-1
|
|
730
|
-
)) => [f(0), f(8), f(4)];
|
|
713
|
+
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
|
|
731
714
|
var getColorShade = (col, amt) => {
|
|
732
715
|
const num = parseInt(col, 16);
|
|
733
716
|
let r = (num >> 16) + amt;
|
|
734
|
-
if (r > 255)
|
|
735
|
-
|
|
736
|
-
else if (r < 0)
|
|
737
|
-
r = 0;
|
|
717
|
+
if (r > 255) r = 255;
|
|
718
|
+
else if (r < 0) r = 0;
|
|
738
719
|
let b = (num >> 8 & 255) + amt;
|
|
739
|
-
if (b > 255)
|
|
740
|
-
|
|
741
|
-
else if (b < 0)
|
|
742
|
-
b = 0;
|
|
720
|
+
if (b > 255) b = 255;
|
|
721
|
+
else if (b < 0) b = 0;
|
|
743
722
|
let g = (num & 255) + amt;
|
|
744
|
-
if (g > 255)
|
|
745
|
-
|
|
746
|
-
else if (g < 0)
|
|
747
|
-
g = 0;
|
|
723
|
+
if (g > 255) g = 255;
|
|
724
|
+
else if (g < 0) g = 0;
|
|
748
725
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
749
726
|
};
|
|
750
727
|
var getRgbTone = (rgb, tone) => {
|
|
751
728
|
if (isString(rgb) && rgb.includes("rgb"))
|
|
752
729
|
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
753
|
-
if (isString(rgb))
|
|
754
|
-
|
|
755
|
-
if (isNumber(tone))
|
|
756
|
-
tone += "";
|
|
730
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
731
|
+
if (isNumber(tone)) tone += "";
|
|
757
732
|
const toHex = rgbArrayToHex(rgb);
|
|
758
733
|
const abs = tone.slice(0, 1);
|
|
759
734
|
if (abs === "-" || abs === "+") {
|
|
@@ -770,10 +745,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
770
745
|
|
|
771
746
|
// src/utils/font.js
|
|
772
747
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
773
|
-
if (LIBRARY[key])
|
|
774
|
-
|
|
775
|
-
if (LIBRARY.default)
|
|
776
|
-
return LIBRARY[LIBRARY.default].value;
|
|
748
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
749
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
777
750
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
778
751
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
779
752
|
};
|
|
@@ -841,8 +814,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
841
814
|
var setScalingVar = (key, sequenceProps) => {
|
|
842
815
|
const { base, type, unit } = sequenceProps;
|
|
843
816
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
844
|
-
if (key === 0)
|
|
845
|
-
return defaultVal;
|
|
817
|
+
if (key === 0) return defaultVal;
|
|
846
818
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
847
819
|
const ratioVar = `${prefix}-ratio`;
|
|
848
820
|
if (key > 0) {
|
|
@@ -879,10 +851,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
879
851
|
const diffRounded = ~~next - ~~value;
|
|
880
852
|
let arr;
|
|
881
853
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
882
|
-
if (diffRounded > 16)
|
|
883
|
-
|
|
884
|
-
else
|
|
885
|
-
arr = [first, second];
|
|
854
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
855
|
+
else arr = [first, second];
|
|
886
856
|
arr.forEach((v, k) => {
|
|
887
857
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
888
858
|
const newVar = variable + (k + 1);
|
|
@@ -924,8 +894,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
924
894
|
index: key
|
|
925
895
|
};
|
|
926
896
|
setSequenceValue(props, sequenceProps);
|
|
927
|
-
if (subSequence)
|
|
928
|
-
generateSubSequence(props, sequenceProps);
|
|
897
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
929
898
|
}
|
|
930
899
|
return sequenceProps;
|
|
931
900
|
};
|
|
@@ -937,13 +906,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
937
906
|
unit = UNIT2.default,
|
|
938
907
|
useVariable
|
|
939
908
|
} = sequenceProps;
|
|
940
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
941
|
-
return `var(${value})`;
|
|
909
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
942
910
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
943
911
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
944
912
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
945
|
-
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)
|
|
946
|
-
return value;
|
|
913
|
+
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;
|
|
947
914
|
const letterVal = value.toUpperCase();
|
|
948
915
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
949
916
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -967,8 +934,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
967
934
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
968
935
|
}
|
|
969
936
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
970
|
-
if (CONFIG2.verbose)
|
|
971
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
937
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
972
938
|
absValue = absValue.slice(0, 1);
|
|
973
939
|
}
|
|
974
940
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -976,8 +942,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
976
942
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
977
943
|
}
|
|
978
944
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
979
|
-
if (!sequenceItem)
|
|
980
|
-
return console.warn("can't find", sequence, absValue);
|
|
945
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
981
946
|
if (unit === "ms" || unit === "s") {
|
|
982
947
|
return isNegative + sequenceItem.val + unit;
|
|
983
948
|
}
|
|
@@ -986,12 +951,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
986
951
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
987
952
|
if (typeof value !== "string") {
|
|
988
953
|
const CONFIG2 = getActiveConfig();
|
|
989
|
-
if (CONFIG2.verbose)
|
|
990
|
-
console.warn(propertyName, value, "is not a string");
|
|
954
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
991
955
|
return { [propertyName]: value };
|
|
992
956
|
}
|
|
993
|
-
if (value === "-" || value === "")
|
|
994
|
-
return {};
|
|
957
|
+
if (value === "-" || value === "") return {};
|
|
995
958
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
996
959
|
};
|
|
997
960
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1051,36 +1014,30 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1051
1014
|
const { mediaRegenerate } = FACTORY2;
|
|
1052
1015
|
const { sequence, scales } = FACTORY2[media];
|
|
1053
1016
|
const query = MEDIA2[mediaName];
|
|
1054
|
-
if (!query && CONFIG2.verbose)
|
|
1055
|
-
console.warn("Can't find media query ", query);
|
|
1017
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1056
1018
|
if (!mediaRegenerate) {
|
|
1057
1019
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1058
|
-
if (!underMediaQuery)
|
|
1059
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1020
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1060
1021
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1061
1022
|
return;
|
|
1062
1023
|
}
|
|
1063
1024
|
for (const key in sequence) {
|
|
1064
1025
|
const item = sequence[key];
|
|
1065
1026
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1066
|
-
if (!query && CONFIG2.verbose)
|
|
1067
|
-
console.warn("Can't find query ", query);
|
|
1027
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1068
1028
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1069
|
-
if (!underMediaQuery)
|
|
1070
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1029
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1071
1030
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1072
1031
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1073
1032
|
}
|
|
1074
1033
|
};
|
|
1075
1034
|
|
|
1076
1035
|
// src/utils/sprite.js
|
|
1077
|
-
var
|
|
1078
|
-
var isDev = ENV === "development" || ENV === "testing";
|
|
1036
|
+
var isDev = isNotProduction();
|
|
1079
1037
|
var parseRootAttributes = (htmlString) => {
|
|
1080
1038
|
const val = htmlString.default || htmlString;
|
|
1081
1039
|
if (!isString(val)) {
|
|
1082
|
-
if (isDev)
|
|
1083
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1040
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1084
1041
|
return;
|
|
1085
1042
|
}
|
|
1086
1043
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -1088,7 +1045,9 @@ var parseRootAttributes = (htmlString) => {
|
|
|
1088
1045
|
return {};
|
|
1089
1046
|
}
|
|
1090
1047
|
const attrString = match[1];
|
|
1091
|
-
const attrs = attrString.match(
|
|
1048
|
+
const attrs = attrString.match(
|
|
1049
|
+
/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
|
|
1050
|
+
);
|
|
1092
1051
|
return attrs.reduce((acc, attr) => {
|
|
1093
1052
|
const [key, value] = attr.split("=");
|
|
1094
1053
|
acc[key] = value.replace(/['"]/g, "");
|
|
@@ -1128,27 +1087,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1128
1087
|
var getColor = (value, key, config) => {
|
|
1129
1088
|
const CONFIG2 = config || getActiveConfig();
|
|
1130
1089
|
if (!isString(value)) {
|
|
1131
|
-
if (CONFIG2.verbose)
|
|
1132
|
-
console.warn(value, "- type for color is not valid");
|
|
1090
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1133
1091
|
return;
|
|
1134
1092
|
}
|
|
1135
|
-
if (value.slice(0, 2) === "--")
|
|
1136
|
-
|
|
1137
|
-
if (key && value[key])
|
|
1138
|
-
value = value[key];
|
|
1093
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1094
|
+
if (key && value[key]) value = value[key];
|
|
1139
1095
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1140
1096
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1141
1097
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1142
1098
|
if (!val) {
|
|
1143
|
-
if (CONFIG2.verbose)
|
|
1144
|
-
console.warn("Can't find color ", name);
|
|
1099
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1145
1100
|
return value;
|
|
1146
1101
|
}
|
|
1147
1102
|
if (key) {
|
|
1148
|
-
if (val[key])
|
|
1149
|
-
|
|
1150
|
-
else if (CONFIG2.verbose)
|
|
1151
|
-
console.warn(value, " - does not have ", key);
|
|
1103
|
+
if (val[key]) val = val[key];
|
|
1104
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1152
1105
|
}
|
|
1153
1106
|
let rgb = val.rgb;
|
|
1154
1107
|
if (!rgb) {
|
|
@@ -1158,10 +1111,8 @@ var getColor = (value, key, config) => {
|
|
|
1158
1111
|
rgb = getRgbTone(rgb, tone);
|
|
1159
1112
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1160
1113
|
}
|
|
1161
|
-
if (val[tone])
|
|
1162
|
-
|
|
1163
|
-
if (alpha)
|
|
1164
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1114
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1115
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1165
1116
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1166
1117
|
};
|
|
1167
1118
|
var setColor = (val, key, suffix) => {
|
|
@@ -1169,8 +1120,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1169
1120
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1170
1121
|
val = getColor(val.slice(2));
|
|
1171
1122
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1172
|
-
if (CONFIG2.verbose)
|
|
1173
|
-
console.warn(val, "- referred but does not exist");
|
|
1123
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1174
1124
|
val = val.split(" ")[0];
|
|
1175
1125
|
}
|
|
1176
1126
|
}
|
|
@@ -1209,8 +1159,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1209
1159
|
};
|
|
1210
1160
|
var setGradient = (val, key, suffix) => {
|
|
1211
1161
|
const CONFIG2 = getActiveConfig();
|
|
1212
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1213
|
-
val = getColor(val.slice(2));
|
|
1162
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1214
1163
|
if (isArray(val)) {
|
|
1215
1164
|
return {
|
|
1216
1165
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1219,8 +1168,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1219
1168
|
}
|
|
1220
1169
|
if (isObject(val)) {
|
|
1221
1170
|
const obj = {};
|
|
1222
|
-
for (const variant in val)
|
|
1223
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1171
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1224
1172
|
return obj;
|
|
1225
1173
|
}
|
|
1226
1174
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1246,22 +1194,19 @@ var setThemeValue = (theme) => {
|
|
|
1246
1194
|
return value;
|
|
1247
1195
|
};
|
|
1248
1196
|
var getThemeValue = (theme) => {
|
|
1249
|
-
if (theme.value)
|
|
1250
|
-
return theme.value;
|
|
1197
|
+
if (theme.value) return theme.value;
|
|
1251
1198
|
theme.value = setThemeValue(theme);
|
|
1252
1199
|
return theme.value;
|
|
1253
1200
|
};
|
|
1254
1201
|
var getTheme = (value, modifier) => {
|
|
1255
1202
|
const CONFIG2 = getActiveConfig();
|
|
1256
|
-
if (CONFIG2.useVariable)
|
|
1257
|
-
return getMediaTheme(value, modifier);
|
|
1203
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1258
1204
|
const { THEME: THEME2 } = CONFIG2;
|
|
1259
1205
|
if (isString(value)) {
|
|
1260
1206
|
const [theme, subtheme] = value.split(" ");
|
|
1261
1207
|
const isOurTheme = THEME2[theme];
|
|
1262
1208
|
if (isOurTheme) {
|
|
1263
|
-
if (!subtheme && !modifier)
|
|
1264
|
-
return getThemeValue(isOurTheme);
|
|
1209
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1265
1210
|
value = [theme, subtheme || modifier];
|
|
1266
1211
|
}
|
|
1267
1212
|
}
|
|
@@ -1269,14 +1214,10 @@ var getTheme = (value, modifier) => {
|
|
|
1269
1214
|
const themeName = value[0];
|
|
1270
1215
|
const subThemeName = value[1];
|
|
1271
1216
|
const { helpers, media, state } = THEME2[themeName];
|
|
1272
|
-
if (media && media[subThemeName])
|
|
1273
|
-
|
|
1274
|
-
if (
|
|
1275
|
-
|
|
1276
|
-
if (state && state[subThemeName])
|
|
1277
|
-
return getThemeValue(state[subThemeName]);
|
|
1278
|
-
} else if (isObject(value))
|
|
1279
|
-
return setThemeValue(value);
|
|
1217
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1218
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1219
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1220
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1280
1221
|
};
|
|
1281
1222
|
var setInverseTheme = (theme, variant, value) => {
|
|
1282
1223
|
if (isObject(variant)) {
|
|
@@ -1294,13 +1235,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1294
1235
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1295
1236
|
const result = getTheme(variant);
|
|
1296
1237
|
themeValue[`&:${key}`] = result;
|
|
1297
|
-
if (isObject(variant) && !variant.value)
|
|
1298
|
-
variant.value = result;
|
|
1238
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1299
1239
|
};
|
|
1300
1240
|
var setSelectors = (theme, value) => {
|
|
1301
1241
|
const { state } = theme;
|
|
1302
|
-
if (!state)
|
|
1303
|
-
return;
|
|
1242
|
+
if (!state) return;
|
|
1304
1243
|
const keys = Object.keys(state);
|
|
1305
1244
|
keys.map((key) => {
|
|
1306
1245
|
const variant = state[key];
|
|
@@ -1312,20 +1251,16 @@ var setSelectors = (theme, value) => {
|
|
|
1312
1251
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1313
1252
|
const result = getTheme(variant);
|
|
1314
1253
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1315
|
-
if (isObject(variant) && !variant.value)
|
|
1316
|
-
variant.value = result;
|
|
1254
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1317
1255
|
};
|
|
1318
1256
|
var setMedia = (theme, value) => {
|
|
1319
1257
|
const { media } = theme;
|
|
1320
|
-
if (!media)
|
|
1321
|
-
return;
|
|
1258
|
+
if (!media) return;
|
|
1322
1259
|
const keys = Object.keys(media);
|
|
1323
1260
|
keys.map((key) => {
|
|
1324
1261
|
const variant = media[key];
|
|
1325
|
-
if (key === "dark" || key === "light")
|
|
1326
|
-
|
|
1327
|
-
if (key === "inverse")
|
|
1328
|
-
setInverseTheme(theme, variant, value);
|
|
1262
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1263
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1329
1264
|
return theme;
|
|
1330
1265
|
});
|
|
1331
1266
|
return theme;
|
|
@@ -1333,23 +1268,19 @@ var setMedia = (theme, value) => {
|
|
|
1333
1268
|
var setHelpers = (theme, value) => {
|
|
1334
1269
|
const CONFIG2 = getActiveConfig();
|
|
1335
1270
|
const { helpers } = theme;
|
|
1336
|
-
if (!helpers)
|
|
1337
|
-
return;
|
|
1271
|
+
if (!helpers) return;
|
|
1338
1272
|
const keys = Object.keys(helpers);
|
|
1339
1273
|
keys.map((key) => {
|
|
1340
1274
|
const helper = helpers[key];
|
|
1341
|
-
if (isString(helper))
|
|
1342
|
-
|
|
1343
|
-
else
|
|
1344
|
-
getThemeValue(helpers[key]);
|
|
1275
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1276
|
+
else getThemeValue(helpers[key]);
|
|
1345
1277
|
return theme;
|
|
1346
1278
|
});
|
|
1347
1279
|
return theme;
|
|
1348
1280
|
};
|
|
1349
1281
|
var setTheme = (val, key) => {
|
|
1350
1282
|
const CONFIG2 = getActiveConfig();
|
|
1351
|
-
if (CONFIG2.useVariable)
|
|
1352
|
-
return setMediaTheme(val, key);
|
|
1283
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1353
1284
|
const { state, media, helpers } = val;
|
|
1354
1285
|
const value = setThemeValue(val, key);
|
|
1355
1286
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1411,24 +1342,19 @@ var recursiveTheme = (val) => {
|
|
|
1411
1342
|
} else if (symb === ":") {
|
|
1412
1343
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1413
1344
|
}
|
|
1414
|
-
} else
|
|
1415
|
-
obj[param] = val[param];
|
|
1345
|
+
} else obj[param] = val[param];
|
|
1416
1346
|
}
|
|
1417
1347
|
return obj;
|
|
1418
1348
|
};
|
|
1419
1349
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1420
1350
|
const currentMod = modifierArray.shift();
|
|
1421
|
-
if (val[currentMod])
|
|
1422
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1351
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1423
1352
|
return val;
|
|
1424
1353
|
};
|
|
1425
1354
|
var findModifier = (val, modifier) => {
|
|
1426
|
-
if (isArray(modifier))
|
|
1427
|
-
|
|
1428
|
-
else
|
|
1429
|
-
return val[modifier];
|
|
1430
|
-
else
|
|
1431
|
-
return val;
|
|
1355
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1356
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1357
|
+
else return val;
|
|
1432
1358
|
};
|
|
1433
1359
|
var getMediaTheme = (value, modifier) => {
|
|
1434
1360
|
const activeConfig = getActiveConfig();
|
|
@@ -1454,8 +1380,7 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1454
1380
|
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1455
1381
|
var setFont = (val, key) => {
|
|
1456
1382
|
const CSSvar = `--font-${key}`;
|
|
1457
|
-
if (!val || isArray(val) && !val[0])
|
|
1458
|
-
return;
|
|
1383
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1459
1384
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1460
1385
|
return { var: CSSvar, value: val, fontFace };
|
|
1461
1386
|
};
|
|
@@ -1463,10 +1388,8 @@ var setFontFamily = (val, key) => {
|
|
|
1463
1388
|
const CONFIG2 = getActiveConfig();
|
|
1464
1389
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1465
1390
|
let { value, type } = val;
|
|
1466
|
-
if (val.isDefault)
|
|
1467
|
-
|
|
1468
|
-
if (isObject(value))
|
|
1469
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1391
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1392
|
+
if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
|
|
1470
1393
|
const CSSvar = `--font-family-${key}`;
|
|
1471
1394
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1472
1395
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1479,19 +1402,10 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1479
1402
|
for (const prop in FACTORY2) {
|
|
1480
1403
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1481
1404
|
const mediaValue = FACTORY2[prop];
|
|
1482
|
-
if (!isPropMedia)
|
|
1483
|
-
continue;
|
|
1405
|
+
if (!isPropMedia) continue;
|
|
1484
1406
|
const { mediaRegenerate } = FACTORY2;
|
|
1485
1407
|
const mediaName = prop.slice(1);
|
|
1486
|
-
const {
|
|
1487
|
-
type,
|
|
1488
|
-
base,
|
|
1489
|
-
ratio,
|
|
1490
|
-
range,
|
|
1491
|
-
subSequence,
|
|
1492
|
-
h1Matches,
|
|
1493
|
-
unit
|
|
1494
|
-
} = FACTORY2;
|
|
1408
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
1495
1409
|
merge(mediaValue, {
|
|
1496
1410
|
type,
|
|
1497
1411
|
base,
|
|
@@ -1521,7 +1435,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1521
1435
|
}
|
|
1522
1436
|
};
|
|
1523
1437
|
var applyHeadings = (props) => {
|
|
1524
|
-
var _a;
|
|
1438
|
+
var _a, _b;
|
|
1525
1439
|
const CONFIG2 = getActiveConfig();
|
|
1526
1440
|
if (props.h1Matches) {
|
|
1527
1441
|
const unit = props.unit;
|
|
@@ -1530,10 +1444,8 @@ var applyHeadings = (props) => {
|
|
|
1530
1444
|
for (const k in HEADINGS) {
|
|
1531
1445
|
const headerName = `h${parseInt(k) + 1}`;
|
|
1532
1446
|
const headerStyle = templates[headerName];
|
|
1533
|
-
if (!HEADINGS[k])
|
|
1534
|
-
continue;
|
|
1535
1447
|
templates[headerName] = {
|
|
1536
|
-
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
|
|
1448
|
+
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
|
|
1537
1449
|
margin: headerStyle ? headerStyle.margin : 0,
|
|
1538
1450
|
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
1539
1451
|
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
|
@@ -1557,8 +1469,7 @@ var runThroughMedia2 = (FACTORY2) => {
|
|
|
1557
1469
|
for (const prop in FACTORY2) {
|
|
1558
1470
|
const mediaProps = FACTORY2[prop];
|
|
1559
1471
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1560
|
-
if (!isMediaName)
|
|
1561
|
-
continue;
|
|
1472
|
+
if (!isMediaName) continue;
|
|
1562
1473
|
const {
|
|
1563
1474
|
type,
|
|
1564
1475
|
base,
|
|
@@ -1595,8 +1506,7 @@ var applySpacingSequence = () => {
|
|
|
1595
1506
|
var getSequence = (sequenceProps) => {
|
|
1596
1507
|
const CONFIG2 = getActiveConfig();
|
|
1597
1508
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1598
|
-
if (!sequenceProps)
|
|
1599
|
-
return SPACING2;
|
|
1509
|
+
if (!sequenceProps) return SPACING2;
|
|
1600
1510
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1601
1511
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1602
1512
|
};
|
|
@@ -1606,8 +1516,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1606
1516
|
return { [propertyName]: value };
|
|
1607
1517
|
}
|
|
1608
1518
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1609
|
-
if (!isArray(stack))
|
|
1610
|
-
return;
|
|
1519
|
+
if (!isArray(stack)) return;
|
|
1611
1520
|
if (stack.length > 1) {
|
|
1612
1521
|
let suffix = "";
|
|
1613
1522
|
if (propertyName === "borderWidth") {
|
|
@@ -1656,15 +1565,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1656
1565
|
if (isString(value) && value.includes(",")) {
|
|
1657
1566
|
value = value.split(",").map((v) => {
|
|
1658
1567
|
v = v.trim();
|
|
1659
|
-
if (v.startsWith("--"))
|
|
1660
|
-
|
|
1661
|
-
if (
|
|
1662
|
-
return getColor(v);
|
|
1663
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1664
|
-
return v;
|
|
1568
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1569
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1570
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1665
1571
|
const arr = v.split(" ");
|
|
1666
|
-
if (!arr.length)
|
|
1667
|
-
return v;
|
|
1572
|
+
if (!arr.length) return v;
|
|
1668
1573
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1669
1574
|
}).join(" ");
|
|
1670
1575
|
}
|
|
@@ -1703,8 +1608,7 @@ var applyDocument = () => {
|
|
|
1703
1608
|
var setSVG = (val, key) => {
|
|
1704
1609
|
const CONFIG2 = getActiveConfig();
|
|
1705
1610
|
if (!val) {
|
|
1706
|
-
if (CONFIG2.verbose)
|
|
1707
|
-
console.warn("setSVG: val is not defined", key);
|
|
1611
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1708
1612
|
return;
|
|
1709
1613
|
}
|
|
1710
1614
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1742,8 +1646,7 @@ var applyReset = (reset = {}) => {
|
|
|
1742
1646
|
}
|
|
1743
1647
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1744
1648
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1745
|
-
if (RESET2.html)
|
|
1746
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1649
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1747
1650
|
return deepMerge(merge(RESET2, reset), {
|
|
1748
1651
|
html: {
|
|
1749
1652
|
position: "absolute",
|
|
@@ -1784,8 +1687,7 @@ var applyReset = (reset = {}) => {
|
|
|
1784
1687
|
|
|
1785
1688
|
// src/set.js
|
|
1786
1689
|
var setCases = (val, key) => {
|
|
1787
|
-
if (isFunction(val))
|
|
1788
|
-
return val();
|
|
1690
|
+
if (isFunction(val)) return val();
|
|
1789
1691
|
return val;
|
|
1790
1692
|
};
|
|
1791
1693
|
var setSameValue = (val, key) => val;
|
|
@@ -1821,12 +1723,10 @@ var setValue = (FACTORY_NAME, value, key) => {
|
|
|
1821
1723
|
FACTORY2[key] = result;
|
|
1822
1724
|
return FACTORY2;
|
|
1823
1725
|
} catch (error) {
|
|
1824
|
-
if (CONFIG2.verbose)
|
|
1825
|
-
console.warn("Error setting", factoryName, "value", value, key, error);
|
|
1726
|
+
if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
|
|
1826
1727
|
}
|
|
1827
1728
|
}
|
|
1828
|
-
if (CONFIG2.verbose)
|
|
1829
|
-
console.warn("Can not find", factoryName, "method in scratch");
|
|
1729
|
+
if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
|
|
1830
1730
|
};
|
|
1831
1731
|
var setEach = (factoryName, props) => {
|
|
1832
1732
|
const CONFIG2 = getActiveConfig();
|
|
@@ -1836,8 +1736,7 @@ var setEach = (factoryName, props) => {
|
|
|
1836
1736
|
try {
|
|
1837
1737
|
return setValue(FACTORY_NAME, props[key], key);
|
|
1838
1738
|
} catch (error) {
|
|
1839
|
-
if (CONFIG2.verbose)
|
|
1840
|
-
console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
|
|
1739
|
+
if (CONFIG2.verbose) console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
|
|
1841
1740
|
}
|
|
1842
1741
|
});
|
|
1843
1742
|
return CONFIG2[FACTORY_NAME];
|
|
@@ -1862,57 +1761,43 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
1862
1761
|
if (options.newConfig) {
|
|
1863
1762
|
CONFIG2 = setActiveConfig(options.newConfig);
|
|
1864
1763
|
}
|
|
1865
|
-
if (verbose !== void 0)
|
|
1866
|
-
|
|
1867
|
-
if (
|
|
1868
|
-
|
|
1869
|
-
if (
|
|
1870
|
-
|
|
1871
|
-
if (
|
|
1872
|
-
|
|
1873
|
-
if (
|
|
1874
|
-
|
|
1875
|
-
if (
|
|
1876
|
-
|
|
1877
|
-
if (useDocumentTheme !== void 0)
|
|
1878
|
-
CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
1879
|
-
if (globalTheme !== void 0)
|
|
1880
|
-
CONFIG2.globalTheme = globalTheme;
|
|
1881
|
-
if (useDefaultConfig !== void 0)
|
|
1882
|
-
CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
1883
|
-
if (SEMANTIC_ICONS2 !== void 0)
|
|
1884
|
-
CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
1885
|
-
if (CONFIG2.verbose)
|
|
1886
|
-
console.log(CONFIG2);
|
|
1887
|
-
if (!CONFIG2.__svg_cache)
|
|
1888
|
-
CONFIG2.__svg_cache = {};
|
|
1764
|
+
if (verbose !== void 0) CONFIG2.verbose = verbose;
|
|
1765
|
+
if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
|
|
1766
|
+
if (useReset !== void 0) CONFIG2.useReset = useReset;
|
|
1767
|
+
if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
|
|
1768
|
+
if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
|
|
1769
|
+
if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
|
|
1770
|
+
if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
1771
|
+
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
1772
|
+
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
1773
|
+
if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
1774
|
+
if (CONFIG2.verbose) console.log(CONFIG2);
|
|
1775
|
+
if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
|
|
1889
1776
|
const keys = Object.keys(config);
|
|
1890
1777
|
keys.map((key) => setEach(key, config[key]));
|
|
1891
1778
|
if (config.TYPOGRAPHY) {
|
|
1892
1779
|
try {
|
|
1893
1780
|
applyTypographySequence();
|
|
1894
1781
|
} catch (e) {
|
|
1895
|
-
if (CONFIG2.verbose)
|
|
1896
|
-
console.warn("Error applying typography sequence", e);
|
|
1782
|
+
if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
|
|
1897
1783
|
}
|
|
1898
1784
|
}
|
|
1899
1785
|
if (config.SPACING) {
|
|
1900
1786
|
try {
|
|
1901
1787
|
applySpacingSequence();
|
|
1902
1788
|
} catch (e) {
|
|
1903
|
-
if (CONFIG2.verbose)
|
|
1904
|
-
console.warn("Error applying typography sequence", e);
|
|
1789
|
+
if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
|
|
1905
1790
|
}
|
|
1906
1791
|
}
|
|
1907
1792
|
if (config.TIMING) {
|
|
1908
1793
|
try {
|
|
1909
1794
|
applyTimingSequence();
|
|
1910
1795
|
} catch (e) {
|
|
1911
|
-
if (CONFIG2.verbose)
|
|
1912
|
-
console.warn("Error applying typography sequence", e);
|
|
1796
|
+
if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
|
|
1913
1797
|
}
|
|
1914
1798
|
}
|
|
1915
1799
|
applyDocument();
|
|
1916
1800
|
applyReset();
|
|
1917
1801
|
return CONFIG2;
|
|
1918
1802
|
};
|
|
1803
|
+
// @preserve-env
|