@symbo.ls/scratch 2.25.3 → 2.27.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +8 -9
- package/dist/cjs/index.js +169 -335
- package/dist/cjs/set.js +120 -237
- package/dist/cjs/system/color.js +48 -86
- package/dist/cjs/system/document.js +20 -30
- package/dist/cjs/system/font.js +24 -38
- package/dist/cjs/system/index.js +120 -240
- package/dist/cjs/system/reset.js +27 -44
- package/dist/cjs/system/shadow.js +63 -116
- package/dist/cjs/system/spacing.js +35 -60
- package/dist/cjs/system/svg.js +25 -40
- package/dist/cjs/system/theme.js +61 -112
- package/dist/cjs/system/timing.js +28 -46
- package/dist/cjs/system/typography.js +37 -74
- package/dist/cjs/transforms/index.js +86 -162
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +54 -98
- package/dist/cjs/utils/sequence.js +28 -46
- package/dist/cjs/utils/sprite.js +9 -11
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +22 -34
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
package/dist/cjs/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) => {
|
|
@@ -344,7 +334,10 @@ var isUndefined = (arg) => {
|
|
|
344
334
|
|
|
345
335
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
346
336
|
var mergeArray = (arr, exclude = []) => {
|
|
347
|
-
return arr.reduce(
|
|
337
|
+
return arr.reduce(
|
|
338
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
339
|
+
{}
|
|
340
|
+
);
|
|
348
341
|
};
|
|
349
342
|
|
|
350
343
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -400,8 +393,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
400
393
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
401
394
|
visited.set(obj, clone2);
|
|
402
395
|
for (const key in obj) {
|
|
403
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
404
|
-
continue;
|
|
396
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
405
397
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
406
398
|
continue;
|
|
407
399
|
const value = obj[key];
|
|
@@ -436,10 +428,8 @@ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(nav
|
|
|
436
428
|
// src/utils/color.js
|
|
437
429
|
var ENV = "development";
|
|
438
430
|
var colorStringToRgbaArray = (color) => {
|
|
439
|
-
if (color === "")
|
|
440
|
-
|
|
441
|
-
if (color.toLowerCase() === "transparent")
|
|
442
|
-
return [0, 0, 0, 0];
|
|
431
|
+
if (color === "") return [0, 0, 0, 0];
|
|
432
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
443
433
|
if (color[0] === "#") {
|
|
444
434
|
if (color.length < 7) {
|
|
445
435
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -470,8 +460,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
470
460
|
}
|
|
471
461
|
}
|
|
472
462
|
if (color.indexOf("rgb") === 0) {
|
|
473
|
-
if (color.indexOf("rgba") === -1)
|
|
474
|
-
color = `${color}, 1`;
|
|
463
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
475
464
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
476
465
|
}
|
|
477
466
|
return [0, 0, 0, 0];
|
|
@@ -528,20 +517,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
528
517
|
var getColorShade = (col, amt) => {
|
|
529
518
|
const num = parseInt(col, 16);
|
|
530
519
|
let r = (num >> 16) + amt;
|
|
531
|
-
if (r > 255)
|
|
532
|
-
|
|
533
|
-
else if (r < 0)
|
|
534
|
-
r = 0;
|
|
520
|
+
if (r > 255) r = 255;
|
|
521
|
+
else if (r < 0) r = 0;
|
|
535
522
|
let b = (num >> 8 & 255) + amt;
|
|
536
|
-
if (b > 255)
|
|
537
|
-
|
|
538
|
-
else if (b < 0)
|
|
539
|
-
b = 0;
|
|
523
|
+
if (b > 255) b = 255;
|
|
524
|
+
else if (b < 0) b = 0;
|
|
540
525
|
let g = (num & 255) + amt;
|
|
541
|
-
if (g > 255)
|
|
542
|
-
|
|
543
|
-
else if (g < 0)
|
|
544
|
-
g = 0;
|
|
526
|
+
if (g > 255) g = 255;
|
|
527
|
+
else if (g < 0) g = 0;
|
|
545
528
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
546
529
|
};
|
|
547
530
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -557,20 +540,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
557
540
|
var opacify = (color, opacity) => {
|
|
558
541
|
const arr = colorStringToRgbaArray(color);
|
|
559
542
|
if (!arr) {
|
|
560
|
-
if (ENV === "testing" || ENV === "development")
|
|
561
|
-
console.warn(color + " color is not rgba");
|
|
543
|
+
if (ENV === "testing" || ENV === "development") console.warn(color + " color is not rgba");
|
|
562
544
|
return;
|
|
563
545
|
}
|
|
564
546
|
arr[3] = opacity;
|
|
565
547
|
return `rgba(${arr})`;
|
|
566
548
|
};
|
|
567
549
|
var getRgbTone = (rgb, tone) => {
|
|
568
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
572
|
-
if (isNumber(tone))
|
|
573
|
-
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 += "";
|
|
574
553
|
const toHex = rgbArrayToHex(rgb);
|
|
575
554
|
const abs = tone.slice(0, 1);
|
|
576
555
|
if (abs === "-" || abs === "+") {
|
|
@@ -587,21 +566,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
587
566
|
|
|
588
567
|
// src/utils/theme.js
|
|
589
568
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
590
|
-
if (!orig)
|
|
591
|
-
|
|
592
|
-
if (orig
|
|
593
|
-
return orig.themes[theme];
|
|
594
|
-
if (orig[theme])
|
|
595
|
-
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]];
|
|
596
572
|
return orig;
|
|
597
573
|
};
|
|
598
574
|
|
|
599
575
|
// src/utils/font.js
|
|
600
576
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
601
|
-
if (LIBRARY[key])
|
|
602
|
-
|
|
603
|
-
if (LIBRARY.default)
|
|
604
|
-
return LIBRARY[LIBRARY.default].value;
|
|
577
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
578
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
605
579
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
606
580
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
607
581
|
};
|
|
@@ -628,8 +602,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
628
602
|
};
|
|
629
603
|
var getFontFaceEachString = (name, weights) => {
|
|
630
604
|
const isArr = weights[0];
|
|
631
|
-
if (isArr)
|
|
632
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
605
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
633
606
|
return setCustomFontMedia(name, weights.url);
|
|
634
607
|
};
|
|
635
608
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -907,8 +880,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
907
880
|
var setScalingVar = (key, sequenceProps) => {
|
|
908
881
|
const { base, type, unit } = sequenceProps;
|
|
909
882
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
910
|
-
if (key === 0)
|
|
911
|
-
return defaultVal;
|
|
883
|
+
if (key === 0) return defaultVal;
|
|
912
884
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
913
885
|
const ratioVar = `${prefix}-ratio`;
|
|
914
886
|
if (key > 0) {
|
|
@@ -945,10 +917,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
945
917
|
const diffRounded = ~~next - ~~value;
|
|
946
918
|
let arr;
|
|
947
919
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
948
|
-
if (diffRounded > 16)
|
|
949
|
-
|
|
950
|
-
else
|
|
951
|
-
arr = [first, second];
|
|
920
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
921
|
+
else arr = [first, second];
|
|
952
922
|
arr.forEach((v, k) => {
|
|
953
923
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
954
924
|
const newVar = variable + (k + 1);
|
|
@@ -990,8 +960,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
990
960
|
index: key
|
|
991
961
|
};
|
|
992
962
|
setSequenceValue(props, sequenceProps);
|
|
993
|
-
if (subSequence)
|
|
994
|
-
generateSubSequence(props, sequenceProps);
|
|
963
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
995
964
|
}
|
|
996
965
|
return sequenceProps;
|
|
997
966
|
};
|
|
@@ -1041,13 +1010,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1041
1010
|
unit = UNIT2.default,
|
|
1042
1011
|
useVariable
|
|
1043
1012
|
} = sequenceProps;
|
|
1044
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1045
|
-
return `var(${value})`;
|
|
1013
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1046
1014
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1047
1015
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1048
1016
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1049
|
-
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)
|
|
1050
|
-
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;
|
|
1051
1018
|
const letterVal = value.toUpperCase();
|
|
1052
1019
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1053
1020
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1071,8 +1038,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1071
1038
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1072
1039
|
}
|
|
1073
1040
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1074
|
-
if (CONFIG2.verbose)
|
|
1075
|
-
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");
|
|
1076
1042
|
absValue = absValue.slice(0, 1);
|
|
1077
1043
|
}
|
|
1078
1044
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1080,8 +1046,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1080
1046
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1081
1047
|
}
|
|
1082
1048
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1083
|
-
if (!sequenceItem)
|
|
1084
|
-
return console.warn("can't find", sequence, absValue);
|
|
1049
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1085
1050
|
if (unit === "ms" || unit === "s") {
|
|
1086
1051
|
return isNegative + sequenceItem.val + unit;
|
|
1087
1052
|
}
|
|
@@ -1090,12 +1055,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1090
1055
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1091
1056
|
if (typeof value !== "string") {
|
|
1092
1057
|
const CONFIG2 = getActiveConfig();
|
|
1093
|
-
if (CONFIG2.verbose)
|
|
1094
|
-
console.warn(propertyName, value, "is not a string");
|
|
1058
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1095
1059
|
return { [propertyName]: value };
|
|
1096
1060
|
}
|
|
1097
|
-
if (value === "-" || value === "")
|
|
1098
|
-
return {};
|
|
1061
|
+
if (value === "-" || value === "") return {};
|
|
1099
1062
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1100
1063
|
};
|
|
1101
1064
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1163,23 +1126,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1163
1126
|
const { mediaRegenerate } = FACTORY2;
|
|
1164
1127
|
const { sequence, scales } = FACTORY2[media];
|
|
1165
1128
|
const query = MEDIA2[mediaName];
|
|
1166
|
-
if (!query && CONFIG2.verbose)
|
|
1167
|
-
console.warn("Can't find media query ", query);
|
|
1129
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1168
1130
|
if (!mediaRegenerate) {
|
|
1169
1131
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1170
|
-
if (!underMediaQuery)
|
|
1171
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1132
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1172
1133
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1173
1134
|
return;
|
|
1174
1135
|
}
|
|
1175
1136
|
for (const key in sequence) {
|
|
1176
1137
|
const item = sequence[key];
|
|
1177
1138
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1178
|
-
if (!query && CONFIG2.verbose)
|
|
1179
|
-
console.warn("Can't find query ", query);
|
|
1139
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1180
1140
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1181
|
-
if (!underMediaQuery)
|
|
1182
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1141
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1183
1142
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1184
1143
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1185
1144
|
}
|
|
@@ -1192,10 +1151,8 @@ var generateSprite = (icons) => {
|
|
|
1192
1151
|
const CONFIG2 = getActiveConfig();
|
|
1193
1152
|
let sprite = "";
|
|
1194
1153
|
for (const key in icons) {
|
|
1195
|
-
if (CONFIG2.__svg_cache[key])
|
|
1196
|
-
|
|
1197
|
-
else
|
|
1198
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1154
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1155
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1199
1156
|
sprite += icons[key];
|
|
1200
1157
|
}
|
|
1201
1158
|
return sprite;
|
|
@@ -1203,8 +1160,7 @@ var generateSprite = (icons) => {
|
|
|
1203
1160
|
var parseRootAttributes = (htmlString) => {
|
|
1204
1161
|
const val = htmlString.default || htmlString;
|
|
1205
1162
|
if (!isString(val)) {
|
|
1206
|
-
if (isDev)
|
|
1207
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
1163
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
1208
1164
|
return;
|
|
1209
1165
|
}
|
|
1210
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) => {
|
|
@@ -306,7 +296,10 @@ var isUndefined = (arg) => {
|
|
|
306
296
|
|
|
307
297
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
308
298
|
var mergeArray = (arr, exclude = []) => {
|
|
309
|
-
return arr.reduce(
|
|
299
|
+
return arr.reduce(
|
|
300
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
301
|
+
{}
|
|
302
|
+
);
|
|
310
303
|
};
|
|
311
304
|
|
|
312
305
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -362,8 +355,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
362
355
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
363
356
|
visited.set(obj, clone2);
|
|
364
357
|
for (const key in obj) {
|
|
365
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
366
|
-
continue;
|
|
358
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
367
359
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
368
360
|
continue;
|
|
369
361
|
const value = obj[key];
|
|
@@ -670,8 +662,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
670
662
|
var setScalingVar = (key, sequenceProps) => {
|
|
671
663
|
const { base, type, unit } = sequenceProps;
|
|
672
664
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
673
|
-
if (key === 0)
|
|
674
|
-
return defaultVal;
|
|
665
|
+
if (key === 0) return defaultVal;
|
|
675
666
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
676
667
|
const ratioVar = `${prefix}-ratio`;
|
|
677
668
|
if (key > 0) {
|
|
@@ -708,10 +699,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
708
699
|
const diffRounded = ~~next - ~~value;
|
|
709
700
|
let arr;
|
|
710
701
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
711
|
-
if (diffRounded > 16)
|
|
712
|
-
|
|
713
|
-
else
|
|
714
|
-
arr = [first, second];
|
|
702
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
703
|
+
else arr = [first, second];
|
|
715
704
|
arr.forEach((v, k) => {
|
|
716
705
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
717
706
|
const newVar = variable + (k + 1);
|
|
@@ -753,8 +742,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
753
742
|
index: key
|
|
754
743
|
};
|
|
755
744
|
setSequenceValue(props, sequenceProps);
|
|
756
|
-
if (subSequence)
|
|
757
|
-
generateSubSequence(props, sequenceProps);
|
|
745
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
758
746
|
}
|
|
759
747
|
return sequenceProps;
|
|
760
748
|
};
|
|
@@ -804,13 +792,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
804
792
|
unit = UNIT2.default,
|
|
805
793
|
useVariable
|
|
806
794
|
} = sequenceProps;
|
|
807
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
808
|
-
return `var(${value})`;
|
|
795
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
809
796
|
const prefix = `--${(0, import_utils3.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
810
797
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
811
798
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
812
|
-
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)
|
|
813
|
-
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;
|
|
814
800
|
const letterVal = value.toUpperCase();
|
|
815
801
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
816
802
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -834,8 +820,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
834
820
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
835
821
|
}
|
|
836
822
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
837
|
-
if (CONFIG2.verbose)
|
|
838
|
-
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");
|
|
839
824
|
absValue = absValue.slice(0, 1);
|
|
840
825
|
}
|
|
841
826
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -843,8 +828,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
843
828
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
844
829
|
}
|
|
845
830
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
846
|
-
if (!sequenceItem)
|
|
847
|
-
return console.warn("can't find", sequence, absValue);
|
|
831
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
848
832
|
if (unit === "ms" || unit === "s") {
|
|
849
833
|
return isNegative + sequenceItem.val + unit;
|
|
850
834
|
}
|
|
@@ -853,12 +837,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
853
837
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
854
838
|
if (typeof value !== "string") {
|
|
855
839
|
const CONFIG2 = getActiveConfig();
|
|
856
|
-
if (CONFIG2.verbose)
|
|
857
|
-
console.warn(propertyName, value, "is not a string");
|
|
840
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
858
841
|
return { [propertyName]: value };
|
|
859
842
|
}
|
|
860
|
-
if (value === "-" || value === "")
|
|
861
|
-
return {};
|
|
843
|
+
if (value === "-" || value === "") return {};
|
|
862
844
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
863
845
|
};
|
|
864
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) => {
|
|
@@ -50,7 +49,10 @@ var isUndefined = (arg) => {
|
|
|
50
49
|
|
|
51
50
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
52
51
|
var mergeArray = (arr, exclude = []) => {
|
|
53
|
-
return arr.reduce(
|
|
52
|
+
return arr.reduce(
|
|
53
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
54
|
+
{}
|
|
55
|
+
);
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -106,8 +108,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
106
108
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
107
109
|
visited.set(obj, clone2);
|
|
108
110
|
for (const key in obj) {
|
|
109
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
110
|
-
continue;
|
|
111
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
111
112
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
112
113
|
continue;
|
|
113
114
|
const value = obj[key];
|
|
@@ -367,10 +368,8 @@ var generateSprite = (icons) => {
|
|
|
367
368
|
const CONFIG2 = getActiveConfig();
|
|
368
369
|
let sprite = "";
|
|
369
370
|
for (const key in icons) {
|
|
370
|
-
if (CONFIG2.__svg_cache[key])
|
|
371
|
-
|
|
372
|
-
else
|
|
373
|
-
CONFIG2.__svg_cache[key] = true;
|
|
371
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
372
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
374
373
|
sprite += icons[key];
|
|
375
374
|
}
|
|
376
375
|
return sprite;
|
|
@@ -378,8 +377,7 @@ var generateSprite = (icons) => {
|
|
|
378
377
|
var parseRootAttributes = (htmlString) => {
|
|
379
378
|
const val = htmlString.default || htmlString;
|
|
380
379
|
if (!isString(val)) {
|
|
381
|
-
if (isDev)
|
|
382
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
380
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
383
381
|
return;
|
|
384
382
|
}
|
|
385
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
|
};
|