@symbo.ls/scratch 2.27.0 → 2.27.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +4 -8
- package/dist/cjs/index.js +165 -334
- package/dist/cjs/set.js +116 -236
- package/dist/cjs/system/color.js +44 -85
- package/dist/cjs/system/document.js +16 -29
- package/dist/cjs/system/font.js +20 -37
- package/dist/cjs/system/index.js +116 -239
- package/dist/cjs/system/reset.js +23 -43
- package/dist/cjs/system/shadow.js +59 -115
- package/dist/cjs/system/spacing.js +31 -59
- package/dist/cjs/system/svg.js +21 -39
- package/dist/cjs/system/theme.js +57 -111
- package/dist/cjs/system/timing.js +24 -45
- package/dist/cjs/system/typography.js +33 -73
- package/dist/cjs/transforms/index.js +82 -161
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +50 -97
- package/dist/cjs/utils/sequence.js +24 -45
- package/dist/cjs/utils/sprite.js +5 -10
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +18 -33
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
package/dist/cjs/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
|
});
|
|
@@ -334,8 +325,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
334
325
|
var isNull = (arg) => arg === null;
|
|
335
326
|
var isArray = (arg) => Array.isArray(arg);
|
|
336
327
|
var isObjectLike = (arg) => {
|
|
337
|
-
if (arg === null)
|
|
338
|
-
return false;
|
|
328
|
+
if (arg === null) return false;
|
|
339
329
|
return typeof arg === "object";
|
|
340
330
|
};
|
|
341
331
|
var isUndefined = (arg) => {
|
|
@@ -403,8 +393,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
403
393
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
404
394
|
visited.set(obj, clone2);
|
|
405
395
|
for (const key in obj) {
|
|
406
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
407
|
-
continue;
|
|
396
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
408
397
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
409
398
|
continue;
|
|
410
399
|
const value = obj[key];
|
|
@@ -439,10 +428,8 @@ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(nav
|
|
|
439
428
|
// src/utils/color.js
|
|
440
429
|
var ENV = "development";
|
|
441
430
|
var colorStringToRgbaArray = (color) => {
|
|
442
|
-
if (color === "")
|
|
443
|
-
|
|
444
|
-
if (color.toLowerCase() === "transparent")
|
|
445
|
-
return [0, 0, 0, 0];
|
|
431
|
+
if (color === "") return [0, 0, 0, 0];
|
|
432
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
446
433
|
if (color[0] === "#") {
|
|
447
434
|
if (color.length < 7) {
|
|
448
435
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -473,8 +460,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
473
460
|
}
|
|
474
461
|
}
|
|
475
462
|
if (color.indexOf("rgb") === 0) {
|
|
476
|
-
if (color.indexOf("rgba") === -1)
|
|
477
|
-
color = `${color}, 1`;
|
|
463
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
478
464
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
479
465
|
}
|
|
480
466
|
return [0, 0, 0, 0];
|
|
@@ -531,20 +517,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
531
517
|
var getColorShade = (col, amt) => {
|
|
532
518
|
const num = parseInt(col, 16);
|
|
533
519
|
let r = (num >> 16) + amt;
|
|
534
|
-
if (r > 255)
|
|
535
|
-
|
|
536
|
-
else if (r < 0)
|
|
537
|
-
r = 0;
|
|
520
|
+
if (r > 255) r = 255;
|
|
521
|
+
else if (r < 0) r = 0;
|
|
538
522
|
let b = (num >> 8 & 255) + amt;
|
|
539
|
-
if (b > 255)
|
|
540
|
-
|
|
541
|
-
else if (b < 0)
|
|
542
|
-
b = 0;
|
|
523
|
+
if (b > 255) b = 255;
|
|
524
|
+
else if (b < 0) b = 0;
|
|
543
525
|
let g = (num & 255) + amt;
|
|
544
|
-
if (g > 255)
|
|
545
|
-
|
|
546
|
-
else if (g < 0)
|
|
547
|
-
g = 0;
|
|
526
|
+
if (g > 255) g = 255;
|
|
527
|
+
else if (g < 0) g = 0;
|
|
548
528
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
549
529
|
};
|
|
550
530
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -560,20 +540,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
560
540
|
var opacify = (color, opacity) => {
|
|
561
541
|
const arr = colorStringToRgbaArray(color);
|
|
562
542
|
if (!arr) {
|
|
563
|
-
if (ENV === "testing" || ENV === "development")
|
|
564
|
-
console.warn(color + " color is not rgba");
|
|
543
|
+
if (ENV === "testing" || ENV === "development") console.warn(color + " color is not rgba");
|
|
565
544
|
return;
|
|
566
545
|
}
|
|
567
546
|
arr[3] = opacity;
|
|
568
547
|
return `rgba(${arr})`;
|
|
569
548
|
};
|
|
570
549
|
var getRgbTone = (rgb, tone) => {
|
|
571
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
572
|
-
|
|
573
|
-
if (
|
|
574
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
575
|
-
if (isNumber(tone))
|
|
576
|
-
tone += "";
|
|
550
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
551
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
552
|
+
if (isNumber(tone)) tone += "";
|
|
577
553
|
const toHex = rgbArrayToHex(rgb);
|
|
578
554
|
const abs = tone.slice(0, 1);
|
|
579
555
|
if (abs === "-" || abs === "+") {
|
|
@@ -590,21 +566,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
590
566
|
|
|
591
567
|
// src/utils/theme.js
|
|
592
568
|
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]];
|
|
569
|
+
if (!orig) return;
|
|
570
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
571
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
599
572
|
return orig;
|
|
600
573
|
};
|
|
601
574
|
|
|
602
575
|
// src/utils/font.js
|
|
603
576
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
604
|
-
if (LIBRARY[key])
|
|
605
|
-
|
|
606
|
-
if (LIBRARY.default)
|
|
607
|
-
return LIBRARY[LIBRARY.default].value;
|
|
577
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
578
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
608
579
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
609
580
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
610
581
|
};
|
|
@@ -631,8 +602,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
631
602
|
};
|
|
632
603
|
var getFontFaceEachString = (name, weights) => {
|
|
633
604
|
const isArr = weights[0];
|
|
634
|
-
if (isArr)
|
|
635
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
605
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
636
606
|
return setCustomFontMedia(name, weights.url);
|
|
637
607
|
};
|
|
638
608
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -910,8 +880,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
910
880
|
var setScalingVar = (key, sequenceProps) => {
|
|
911
881
|
const { base, type, unit } = sequenceProps;
|
|
912
882
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
913
|
-
if (key === 0)
|
|
914
|
-
return defaultVal;
|
|
883
|
+
if (key === 0) return defaultVal;
|
|
915
884
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
916
885
|
const ratioVar = `${prefix}-ratio`;
|
|
917
886
|
if (key > 0) {
|
|
@@ -948,10 +917,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
948
917
|
const diffRounded = ~~next - ~~value;
|
|
949
918
|
let arr;
|
|
950
919
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
951
|
-
if (diffRounded > 16)
|
|
952
|
-
|
|
953
|
-
else
|
|
954
|
-
arr = [first, second];
|
|
920
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
921
|
+
else arr = [first, second];
|
|
955
922
|
arr.forEach((v, k) => {
|
|
956
923
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
957
924
|
const newVar = variable + (k + 1);
|
|
@@ -993,8 +960,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
993
960
|
index: key
|
|
994
961
|
};
|
|
995
962
|
setSequenceValue(props, sequenceProps);
|
|
996
|
-
if (subSequence)
|
|
997
|
-
generateSubSequence(props, sequenceProps);
|
|
963
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
998
964
|
}
|
|
999
965
|
return sequenceProps;
|
|
1000
966
|
};
|
|
@@ -1044,13 +1010,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1044
1010
|
unit = UNIT2.default,
|
|
1045
1011
|
useVariable
|
|
1046
1012
|
} = sequenceProps;
|
|
1047
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1048
|
-
return `var(${value})`;
|
|
1013
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1049
1014
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1050
1015
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1051
1016
|
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;
|
|
1017
|
+
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
1018
|
const letterVal = value.toUpperCase();
|
|
1055
1019
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1056
1020
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1074,8 +1038,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1074
1038
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1075
1039
|
}
|
|
1076
1040
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1077
|
-
if (CONFIG2.verbose)
|
|
1078
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1041
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1079
1042
|
absValue = absValue.slice(0, 1);
|
|
1080
1043
|
}
|
|
1081
1044
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1083,8 +1046,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1083
1046
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1084
1047
|
}
|
|
1085
1048
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1086
|
-
if (!sequenceItem)
|
|
1087
|
-
return console.warn("can't find", sequence, absValue);
|
|
1049
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1088
1050
|
if (unit === "ms" || unit === "s") {
|
|
1089
1051
|
return isNegative + sequenceItem.val + unit;
|
|
1090
1052
|
}
|
|
@@ -1093,12 +1055,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1093
1055
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1094
1056
|
if (typeof value !== "string") {
|
|
1095
1057
|
const CONFIG2 = getActiveConfig();
|
|
1096
|
-
if (CONFIG2.verbose)
|
|
1097
|
-
console.warn(propertyName, value, "is not a string");
|
|
1058
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1098
1059
|
return { [propertyName]: value };
|
|
1099
1060
|
}
|
|
1100
|
-
if (value === "-" || value === "")
|
|
1101
|
-
return {};
|
|
1061
|
+
if (value === "-" || value === "") return {};
|
|
1102
1062
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1103
1063
|
};
|
|
1104
1064
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1166,23 +1126,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1166
1126
|
const { mediaRegenerate } = FACTORY2;
|
|
1167
1127
|
const { sequence, scales } = FACTORY2[media];
|
|
1168
1128
|
const query = MEDIA2[mediaName];
|
|
1169
|
-
if (!query && CONFIG2.verbose)
|
|
1170
|
-
console.warn("Can't find media query ", query);
|
|
1129
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1171
1130
|
if (!mediaRegenerate) {
|
|
1172
1131
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1173
|
-
if (!underMediaQuery)
|
|
1174
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1132
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1175
1133
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1176
1134
|
return;
|
|
1177
1135
|
}
|
|
1178
1136
|
for (const key in sequence) {
|
|
1179
1137
|
const item = sequence[key];
|
|
1180
1138
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1181
|
-
if (!query && CONFIG2.verbose)
|
|
1182
|
-
console.warn("Can't find query ", query);
|
|
1139
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1183
1140
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1184
|
-
if (!underMediaQuery)
|
|
1185
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1141
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1186
1142
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1187
1143
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1188
1144
|
}
|
|
@@ -1195,10 +1151,8 @@ var generateSprite = (icons) => {
|
|
|
1195
1151
|
const CONFIG2 = getActiveConfig();
|
|
1196
1152
|
let sprite = "";
|
|
1197
1153
|
for (const key in icons) {
|
|
1198
|
-
if (CONFIG2.__svg_cache[key])
|
|
1199
|
-
|
|
1200
|
-
else
|
|
1201
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1154
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1155
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1202
1156
|
sprite += icons[key];
|
|
1203
1157
|
}
|
|
1204
1158
|
return sprite;
|
|
@@ -1206,8 +1160,7 @@ var generateSprite = (icons) => {
|
|
|
1206
1160
|
var parseRootAttributes = (htmlString) => {
|
|
1207
1161
|
const val = htmlString.default || htmlString;
|
|
1208
1162
|
if (!isString(val)) {
|
|
1209
|
-
if (isDev)
|
|
1210
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1163
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1211
1164
|
return;
|
|
1212
1165
|
}
|
|
1213
1166
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -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];
|
package/dist/cjs/utils/sprite.js
CHANGED
|
@@ -40,8 +40,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
40
40
|
var isNull = (arg) => arg === null;
|
|
41
41
|
var isArray = (arg) => Array.isArray(arg);
|
|
42
42
|
var isObjectLike = (arg) => {
|
|
43
|
-
if (arg === null)
|
|
44
|
-
return false;
|
|
43
|
+
if (arg === null) return false;
|
|
45
44
|
return typeof arg === "object";
|
|
46
45
|
};
|
|
47
46
|
var isUndefined = (arg) => {
|
|
@@ -109,8 +108,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
109
108
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
110
109
|
visited.set(obj, clone2);
|
|
111
110
|
for (const key in obj) {
|
|
112
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
113
|
-
continue;
|
|
111
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
114
112
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
115
113
|
continue;
|
|
116
114
|
const value = obj[key];
|
|
@@ -370,10 +368,8 @@ var generateSprite = (icons) => {
|
|
|
370
368
|
const CONFIG2 = getActiveConfig();
|
|
371
369
|
let sprite = "";
|
|
372
370
|
for (const key in icons) {
|
|
373
|
-
if (CONFIG2.__svg_cache[key])
|
|
374
|
-
|
|
375
|
-
else
|
|
376
|
-
CONFIG2.__svg_cache[key] = true;
|
|
371
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
372
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
377
373
|
sprite += icons[key];
|
|
378
374
|
}
|
|
379
375
|
return sprite;
|
|
@@ -381,8 +377,7 @@ var generateSprite = (icons) => {
|
|
|
381
377
|
var parseRootAttributes = (htmlString) => {
|
|
382
378
|
const val = htmlString.default || htmlString;
|
|
383
379
|
if (!isString(val)) {
|
|
384
|
-
if (isDev)
|
|
385
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
380
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
386
381
|
return;
|
|
387
382
|
}
|
|
388
383
|
const match = val.match(/<svg\s+(.*?)>/);
|
package/dist/cjs/utils/theme.js
CHANGED
|
@@ -24,11 +24,8 @@ __export(theme_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(theme_exports);
|
|
26
26
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
27
|
-
if (!orig)
|
|
28
|
-
|
|
29
|
-
if (orig
|
|
30
|
-
return orig.themes[theme];
|
|
31
|
-
if (orig[theme])
|
|
32
|
-
return [orig, orig[theme]];
|
|
27
|
+
if (!orig) return;
|
|
28
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
29
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
33
30
|
return orig;
|
|
34
31
|
};
|