@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/utils/font.js
CHANGED
|
@@ -32,10 +32,8 @@ __export(font_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(font_exports);
|
|
34
34
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
35
|
-
if (LIBRARY[key])
|
|
36
|
-
|
|
37
|
-
if (LIBRARY.default)
|
|
38
|
-
return LIBRARY[LIBRARY.default].value;
|
|
35
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
36
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
39
37
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
40
38
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
41
39
|
};
|
|
@@ -62,8 +60,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
62
60
|
};
|
|
63
61
|
var getFontFaceEachString = (name, weights) => {
|
|
64
62
|
const isArr = weights[0];
|
|
65
|
-
if (isArr)
|
|
66
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
63
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
67
64
|
return setCustomFontMedia(name, weights.url);
|
|
68
65
|
};
|
|
69
66
|
var getFontFaceString = (LIBRARY) => {
|
package/dist/cjs/utils/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: () => arrayzeValue,
|
|
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 arrayzeValue = (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
|
});
|
|
@@ -318,6 +309,11 @@ var isScalingUnit = (unit) => {
|
|
|
318
309
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
319
310
|
};
|
|
320
311
|
|
|
312
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
313
|
+
var NODE_ENV = "development";
|
|
314
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
315
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
316
|
+
|
|
321
317
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
322
318
|
var window2 = globalThis;
|
|
323
319
|
var document2 = window2.document;
|
|
@@ -334,8 +330,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
334
330
|
var isNull = (arg) => arg === null;
|
|
335
331
|
var isArray = (arg) => Array.isArray(arg);
|
|
336
332
|
var isObjectLike = (arg) => {
|
|
337
|
-
if (arg === null)
|
|
338
|
-
return false;
|
|
333
|
+
if (arg === null) return false;
|
|
339
334
|
return typeof arg === "object";
|
|
340
335
|
};
|
|
341
336
|
var isUndefined = (arg) => {
|
|
@@ -403,8 +398,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
403
398
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
404
399
|
visited.set(obj, clone2);
|
|
405
400
|
for (const key in obj) {
|
|
406
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
407
|
-
continue;
|
|
401
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
408
402
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
409
403
|
continue;
|
|
410
404
|
const value = obj[key];
|
|
@@ -437,12 +431,9 @@ var deepClone = (obj, options = {}) => {
|
|
|
437
431
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
438
432
|
|
|
439
433
|
// src/utils/color.js
|
|
440
|
-
var ENV = "development";
|
|
441
434
|
var colorStringToRgbaArray = (color) => {
|
|
442
|
-
if (color === "")
|
|
443
|
-
|
|
444
|
-
if (color.toLowerCase() === "transparent")
|
|
445
|
-
return [0, 0, 0, 0];
|
|
435
|
+
if (color === "") return [0, 0, 0, 0];
|
|
436
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
446
437
|
if (color[0] === "#") {
|
|
447
438
|
if (color.length < 7) {
|
|
448
439
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -473,8 +464,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
473
464
|
}
|
|
474
465
|
}
|
|
475
466
|
if (color.indexOf("rgb") === 0) {
|
|
476
|
-
if (color.indexOf("rgba") === -1)
|
|
477
|
-
color = `${color}, 1`;
|
|
467
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
478
468
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
479
469
|
}
|
|
480
470
|
return [0, 0, 0, 0];
|
|
@@ -511,10 +501,7 @@ var mixTwoRgb = (colorA, colorB, range = 0.5) => {
|
|
|
511
501
|
};
|
|
512
502
|
var changeLightness = (delta, hsl) => {
|
|
513
503
|
const [hue, saturation, lightness] = hsl;
|
|
514
|
-
const newLightness = Math.max(
|
|
515
|
-
0,
|
|
516
|
-
Math.min(100, lightness + parseFloat(delta))
|
|
517
|
-
);
|
|
504
|
+
const newLightness = Math.max(0, Math.min(100, lightness + parseFloat(delta)));
|
|
518
505
|
return [hue, saturation, newLightness];
|
|
519
506
|
};
|
|
520
507
|
var rgbToHSL = (r, g, b) => {
|
|
@@ -524,44 +511,32 @@ var rgbToHSL = (r, g, b) => {
|
|
|
524
511
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
525
512
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
526
513
|
};
|
|
527
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
528
|
-
Math.min(k - 3, 9 - k, 1),
|
|
529
|
-
-1
|
|
530
|
-
)) => [f(0), f(8), f(4)];
|
|
514
|
+
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)];
|
|
531
515
|
var getColorShade = (col, amt) => {
|
|
532
516
|
const num = parseInt(col, 16);
|
|
533
517
|
let r = (num >> 16) + amt;
|
|
534
|
-
if (r > 255)
|
|
535
|
-
|
|
536
|
-
else if (r < 0)
|
|
537
|
-
r = 0;
|
|
518
|
+
if (r > 255) r = 255;
|
|
519
|
+
else if (r < 0) r = 0;
|
|
538
520
|
let b = (num >> 8 & 255) + amt;
|
|
539
|
-
if (b > 255)
|
|
540
|
-
|
|
541
|
-
else if (b < 0)
|
|
542
|
-
b = 0;
|
|
521
|
+
if (b > 255) b = 255;
|
|
522
|
+
else if (b < 0) b = 0;
|
|
543
523
|
let g = (num & 255) + amt;
|
|
544
|
-
if (g > 255)
|
|
545
|
-
|
|
546
|
-
else if (g < 0)
|
|
547
|
-
g = 0;
|
|
524
|
+
if (g > 255) g = 255;
|
|
525
|
+
else if (g < 0) g = 0;
|
|
548
526
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
549
527
|
};
|
|
550
528
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
551
529
|
const arr = [];
|
|
552
530
|
for (let i = 0; i < 4; i++) {
|
|
553
531
|
const round = i === 3 ? (x) => x : Math.round;
|
|
554
|
-
arr[i] = round(
|
|
555
|
-
colorA[i] + (colorB[i] - colorA[i]) * range
|
|
556
|
-
);
|
|
532
|
+
arr[i] = round(colorA[i] + (colorB[i] - colorA[i]) * range);
|
|
557
533
|
}
|
|
558
534
|
return `rgba(${arr})`;
|
|
559
535
|
};
|
|
560
536
|
var opacify = (color, opacity) => {
|
|
561
537
|
const arr = colorStringToRgbaArray(color);
|
|
562
538
|
if (!arr) {
|
|
563
|
-
if (
|
|
564
|
-
console.warn(color + " color is not rgba");
|
|
539
|
+
if (isNotProduction()) console.warn(color + " color is not rgba");
|
|
565
540
|
return;
|
|
566
541
|
}
|
|
567
542
|
arr[3] = opacity;
|
|
@@ -570,10 +545,8 @@ var opacify = (color, opacity) => {
|
|
|
570
545
|
var getRgbTone = (rgb, tone) => {
|
|
571
546
|
if (isString(rgb) && rgb.includes("rgb"))
|
|
572
547
|
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
573
|
-
if (isString(rgb))
|
|
574
|
-
|
|
575
|
-
if (isNumber(tone))
|
|
576
|
-
tone += "";
|
|
548
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
549
|
+
if (isNumber(tone)) tone += "";
|
|
577
550
|
const toHex = rgbArrayToHex(rgb);
|
|
578
551
|
const abs = tone.slice(0, 1);
|
|
579
552
|
if (abs === "-" || abs === "+") {
|
|
@@ -590,21 +563,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
590
563
|
|
|
591
564
|
// src/utils/theme.js
|
|
592
565
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
593
|
-
if (!orig)
|
|
594
|
-
|
|
595
|
-
if (orig
|
|
596
|
-
return orig.themes[theme];
|
|
597
|
-
if (orig[theme])
|
|
598
|
-
return [orig, orig[theme]];
|
|
566
|
+
if (!orig) return;
|
|
567
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
568
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
599
569
|
return orig;
|
|
600
570
|
};
|
|
601
571
|
|
|
602
572
|
// src/utils/font.js
|
|
603
573
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
604
|
-
if (LIBRARY[key])
|
|
605
|
-
|
|
606
|
-
if (LIBRARY.default)
|
|
607
|
-
return LIBRARY[LIBRARY.default].value;
|
|
574
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
575
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
608
576
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
609
577
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
610
578
|
};
|
|
@@ -631,8 +599,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
631
599
|
};
|
|
632
600
|
var getFontFaceEachString = (name, weights) => {
|
|
633
601
|
const isArr = weights[0];
|
|
634
|
-
if (isArr)
|
|
635
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
602
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
636
603
|
return setCustomFontMedia(name, weights.url);
|
|
637
604
|
};
|
|
638
605
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -910,8 +877,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
910
877
|
var setScalingVar = (key, sequenceProps) => {
|
|
911
878
|
const { base, type, unit } = sequenceProps;
|
|
912
879
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
913
|
-
if (key === 0)
|
|
914
|
-
return defaultVal;
|
|
880
|
+
if (key === 0) return defaultVal;
|
|
915
881
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
916
882
|
const ratioVar = `${prefix}-ratio`;
|
|
917
883
|
if (key > 0) {
|
|
@@ -948,10 +914,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
948
914
|
const diffRounded = ~~next - ~~value;
|
|
949
915
|
let arr;
|
|
950
916
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
951
|
-
if (diffRounded > 16)
|
|
952
|
-
|
|
953
|
-
else
|
|
954
|
-
arr = [first, second];
|
|
917
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
918
|
+
else arr = [first, second];
|
|
955
919
|
arr.forEach((v, k) => {
|
|
956
920
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
957
921
|
const newVar = variable + (k + 1);
|
|
@@ -993,8 +957,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
993
957
|
index: key
|
|
994
958
|
};
|
|
995
959
|
setSequenceValue(props, sequenceProps);
|
|
996
|
-
if (subSequence)
|
|
997
|
-
generateSubSequence(props, sequenceProps);
|
|
960
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
998
961
|
}
|
|
999
962
|
return sequenceProps;
|
|
1000
963
|
};
|
|
@@ -1044,13 +1007,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1044
1007
|
unit = UNIT2.default,
|
|
1045
1008
|
useVariable
|
|
1046
1009
|
} = sequenceProps;
|
|
1047
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1048
|
-
return `var(${value})`;
|
|
1010
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1049
1011
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1050
1012
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1051
1013
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1052
|
-
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)
|
|
1053
|
-
return value;
|
|
1014
|
+
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;
|
|
1054
1015
|
const letterVal = value.toUpperCase();
|
|
1055
1016
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1056
1017
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1074,8 +1035,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1074
1035
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1075
1036
|
}
|
|
1076
1037
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1077
|
-
if (CONFIG2.verbose)
|
|
1078
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1038
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1079
1039
|
absValue = absValue.slice(0, 1);
|
|
1080
1040
|
}
|
|
1081
1041
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1083,8 +1043,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1083
1043
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1084
1044
|
}
|
|
1085
1045
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1086
|
-
if (!sequenceItem)
|
|
1087
|
-
return console.warn("can't find", sequence, absValue);
|
|
1046
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1088
1047
|
if (unit === "ms" || unit === "s") {
|
|
1089
1048
|
return isNegative + sequenceItem.val + unit;
|
|
1090
1049
|
}
|
|
@@ -1093,12 +1052,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1093
1052
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1094
1053
|
if (typeof value !== "string") {
|
|
1095
1054
|
const CONFIG2 = getActiveConfig();
|
|
1096
|
-
if (CONFIG2.verbose)
|
|
1097
|
-
console.warn(propertyName, value, "is not a string");
|
|
1055
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1098
1056
|
return { [propertyName]: value };
|
|
1099
1057
|
}
|
|
1100
|
-
if (value === "-" || value === "")
|
|
1101
|
-
return {};
|
|
1058
|
+
if (value === "-" || value === "") return {};
|
|
1102
1059
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1103
1060
|
};
|
|
1104
1061
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1166,39 +1123,32 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1166
1123
|
const { mediaRegenerate } = FACTORY2;
|
|
1167
1124
|
const { sequence, scales } = FACTORY2[media];
|
|
1168
1125
|
const query = MEDIA2[mediaName];
|
|
1169
|
-
if (!query && CONFIG2.verbose)
|
|
1170
|
-
console.warn("Can't find media query ", query);
|
|
1126
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1171
1127
|
if (!mediaRegenerate) {
|
|
1172
1128
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1173
|
-
if (!underMediaQuery)
|
|
1174
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1129
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1175
1130
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1176
1131
|
return;
|
|
1177
1132
|
}
|
|
1178
1133
|
for (const key in sequence) {
|
|
1179
1134
|
const item = sequence[key];
|
|
1180
1135
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1181
|
-
if (!query && CONFIG2.verbose)
|
|
1182
|
-
console.warn("Can't find query ", query);
|
|
1136
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1183
1137
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1184
|
-
if (!underMediaQuery)
|
|
1185
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1138
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1186
1139
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1187
1140
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1188
1141
|
}
|
|
1189
1142
|
};
|
|
1190
1143
|
|
|
1191
1144
|
// src/utils/sprite.js
|
|
1192
|
-
var
|
|
1193
|
-
var isDev = ENV2 === "development" || ENV2 === "testing";
|
|
1145
|
+
var isDev = isNotProduction();
|
|
1194
1146
|
var generateSprite = (icons) => {
|
|
1195
1147
|
const CONFIG2 = getActiveConfig();
|
|
1196
1148
|
let sprite = "";
|
|
1197
1149
|
for (const key in icons) {
|
|
1198
|
-
if (CONFIG2.__svg_cache[key])
|
|
1199
|
-
|
|
1200
|
-
else
|
|
1201
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1150
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1151
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1202
1152
|
sprite += icons[key];
|
|
1203
1153
|
}
|
|
1204
1154
|
return sprite;
|
|
@@ -1206,8 +1156,7 @@ var generateSprite = (icons) => {
|
|
|
1206
1156
|
var parseRootAttributes = (htmlString) => {
|
|
1207
1157
|
const val = htmlString.default || htmlString;
|
|
1208
1158
|
if (!isString(val)) {
|
|
1209
|
-
if (isDev)
|
|
1210
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1159
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1211
1160
|
return;
|
|
1212
1161
|
}
|
|
1213
1162
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -1215,7 +1164,9 @@ var parseRootAttributes = (htmlString) => {
|
|
|
1215
1164
|
return {};
|
|
1216
1165
|
}
|
|
1217
1166
|
const attrString = match[1];
|
|
1218
|
-
const attrs = attrString.match(
|
|
1167
|
+
const attrs = attrString.match(
|
|
1168
|
+
/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
|
|
1169
|
+
);
|
|
1219
1170
|
return attrs.reduce((acc, attr) => {
|
|
1220
1171
|
const [key, value] = attr.split("=");
|
|
1221
1172
|
acc[key] = value.replace(/['"]/g, "");
|
|
@@ -1250,3 +1201,4 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1250
1201
|
symbol = symbol.replace("</svg", "</symbol");
|
|
1251
1202
|
return symbol;
|
|
1252
1203
|
};
|
|
1204
|
+
// @preserve-env
|
|
@@ -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: () => arrayzeValue,
|
|
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 arrayzeValue = (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
|
});
|
|
@@ -296,8 +287,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
296
287
|
var isNull = (arg) => arg === null;
|
|
297
288
|
var isArray = (arg) => Array.isArray(arg);
|
|
298
289
|
var isObjectLike = (arg) => {
|
|
299
|
-
if (arg === null)
|
|
300
|
-
return false;
|
|
290
|
+
if (arg === null) return false;
|
|
301
291
|
return typeof arg === "object";
|
|
302
292
|
};
|
|
303
293
|
var isUndefined = (arg) => {
|
|
@@ -365,8 +355,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
365
355
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
366
356
|
visited.set(obj, clone2);
|
|
367
357
|
for (const key in obj) {
|
|
368
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
369
|
-
continue;
|
|
358
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
370
359
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
371
360
|
continue;
|
|
372
361
|
const value = obj[key];
|
|
@@ -673,8 +662,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
673
662
|
var setScalingVar = (key, sequenceProps) => {
|
|
674
663
|
const { base, type, unit } = sequenceProps;
|
|
675
664
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
676
|
-
if (key === 0)
|
|
677
|
-
return defaultVal;
|
|
665
|
+
if (key === 0) return defaultVal;
|
|
678
666
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
679
667
|
const ratioVar = `${prefix}-ratio`;
|
|
680
668
|
if (key > 0) {
|
|
@@ -711,10 +699,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
711
699
|
const diffRounded = ~~next - ~~value;
|
|
712
700
|
let arr;
|
|
713
701
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
714
|
-
if (diffRounded > 16)
|
|
715
|
-
|
|
716
|
-
else
|
|
717
|
-
arr = [first, second];
|
|
702
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
703
|
+
else arr = [first, second];
|
|
718
704
|
arr.forEach((v, k) => {
|
|
719
705
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
720
706
|
const newVar = variable + (k + 1);
|
|
@@ -756,8 +742,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
756
742
|
index: key
|
|
757
743
|
};
|
|
758
744
|
setSequenceValue(props, sequenceProps);
|
|
759
|
-
if (subSequence)
|
|
760
|
-
generateSubSequence(props, sequenceProps);
|
|
745
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
761
746
|
}
|
|
762
747
|
return sequenceProps;
|
|
763
748
|
};
|
|
@@ -807,13 +792,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
807
792
|
unit = UNIT2.default,
|
|
808
793
|
useVariable
|
|
809
794
|
} = sequenceProps;
|
|
810
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
811
|
-
return `var(${value})`;
|
|
795
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
812
796
|
const prefix = `--${(0, import_utils3.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
813
797
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
814
798
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
815
|
-
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)
|
|
816
|
-
return value;
|
|
799
|
+
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;
|
|
817
800
|
const letterVal = value.toUpperCase();
|
|
818
801
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
819
802
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -837,8 +820,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
837
820
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
838
821
|
}
|
|
839
822
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
840
|
-
if (CONFIG2.verbose)
|
|
841
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
823
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
842
824
|
absValue = absValue.slice(0, 1);
|
|
843
825
|
}
|
|
844
826
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -846,8 +828,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
846
828
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
847
829
|
}
|
|
848
830
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
849
|
-
if (!sequenceItem)
|
|
850
|
-
return console.warn("can't find", sequence, absValue);
|
|
831
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
851
832
|
if (unit === "ms" || unit === "s") {
|
|
852
833
|
return isNegative + sequenceItem.val + unit;
|
|
853
834
|
}
|
|
@@ -856,12 +837,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
856
837
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
857
838
|
if (typeof value !== "string") {
|
|
858
839
|
const CONFIG2 = getActiveConfig();
|
|
859
|
-
if (CONFIG2.verbose)
|
|
860
|
-
console.warn(propertyName, value, "is not a string");
|
|
840
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
861
841
|
return { [propertyName]: value };
|
|
862
842
|
}
|
|
863
|
-
if (value === "-" || value === "")
|
|
864
|
-
return {};
|
|
843
|
+
if (value === "-" || value === "") return {};
|
|
865
844
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
866
845
|
};
|
|
867
846
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -872,3 +851,4 @@ var findHeadings = (propertyNames) => {
|
|
|
872
851
|
return sequence[findLetter];
|
|
873
852
|
});
|
|
874
853
|
};
|
|
854
|
+
// @preserve-env
|