@symbo.ls/scratch 2.25.3 → 2.27.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +8 -9
- package/dist/cjs/index.js +169 -335
- package/dist/cjs/set.js +120 -237
- package/dist/cjs/system/color.js +48 -86
- package/dist/cjs/system/document.js +20 -30
- package/dist/cjs/system/font.js +24 -38
- package/dist/cjs/system/index.js +120 -240
- package/dist/cjs/system/reset.js +27 -44
- package/dist/cjs/system/shadow.js +63 -116
- package/dist/cjs/system/spacing.js +35 -60
- package/dist/cjs/system/svg.js +25 -40
- package/dist/cjs/system/theme.js +61 -112
- package/dist/cjs/system/timing.js +28 -46
- package/dist/cjs/system/typography.js +37 -74
- package/dist/cjs/transforms/index.js +86 -162
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +54 -98
- package/dist/cjs/utils/sequence.js +28 -46
- package/dist/cjs/utils/sprite.js +9 -11
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +22 -34
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
package/dist/cjs/system/color.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
|
});
|
|
@@ -284,8 +275,7 @@ var isDOMNode = (obj) => {
|
|
|
284
275
|
|
|
285
276
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
286
277
|
var isObject = (arg) => {
|
|
287
|
-
if (arg === null)
|
|
288
|
-
return false;
|
|
278
|
+
if (arg === null) return false;
|
|
289
279
|
return typeof arg === "object" && arg.constructor === Object;
|
|
290
280
|
};
|
|
291
281
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -294,8 +284,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
294
284
|
var isNull = (arg) => arg === null;
|
|
295
285
|
var isArray = (arg) => Array.isArray(arg);
|
|
296
286
|
var isObjectLike = (arg) => {
|
|
297
|
-
if (arg === null)
|
|
298
|
-
return false;
|
|
287
|
+
if (arg === null) return false;
|
|
299
288
|
return typeof arg === "object";
|
|
300
289
|
};
|
|
301
290
|
var isUndefined = (arg) => {
|
|
@@ -304,7 +293,10 @@ var isUndefined = (arg) => {
|
|
|
304
293
|
|
|
305
294
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
306
295
|
var mergeArray = (arr, exclude = []) => {
|
|
307
|
-
return arr.reduce(
|
|
296
|
+
return arr.reduce(
|
|
297
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
298
|
+
{}
|
|
299
|
+
);
|
|
308
300
|
};
|
|
309
301
|
|
|
310
302
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -360,8 +352,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
360
352
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
361
353
|
visited.set(obj, clone2);
|
|
362
354
|
for (const key in obj) {
|
|
363
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
364
|
-
continue;
|
|
355
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
365
356
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
366
357
|
continue;
|
|
367
358
|
const value = obj[key];
|
|
@@ -616,10 +607,8 @@ var getActiveConfig = (def) => {
|
|
|
616
607
|
|
|
617
608
|
// src/utils/color.js
|
|
618
609
|
var colorStringToRgbaArray = (color) => {
|
|
619
|
-
if (color === "")
|
|
620
|
-
|
|
621
|
-
if (color.toLowerCase() === "transparent")
|
|
622
|
-
return [0, 0, 0, 0];
|
|
610
|
+
if (color === "") return [0, 0, 0, 0];
|
|
611
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
623
612
|
if (color[0] === "#") {
|
|
624
613
|
if (color.length < 7) {
|
|
625
614
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -650,8 +639,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
650
639
|
}
|
|
651
640
|
}
|
|
652
641
|
if (color.indexOf("rgb") === 0) {
|
|
653
|
-
if (color.indexOf("rgba") === -1)
|
|
654
|
-
color = `${color}, 1`;
|
|
642
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
655
643
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
656
644
|
}
|
|
657
645
|
return [0, 0, 0, 0];
|
|
@@ -677,29 +665,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
677
665
|
var getColorShade = (col, amt) => {
|
|
678
666
|
const num = parseInt(col, 16);
|
|
679
667
|
let r = (num >> 16) + amt;
|
|
680
|
-
if (r > 255)
|
|
681
|
-
|
|
682
|
-
else if (r < 0)
|
|
683
|
-
r = 0;
|
|
668
|
+
if (r > 255) r = 255;
|
|
669
|
+
else if (r < 0) r = 0;
|
|
684
670
|
let b = (num >> 8 & 255) + amt;
|
|
685
|
-
if (b > 255)
|
|
686
|
-
|
|
687
|
-
else if (b < 0)
|
|
688
|
-
b = 0;
|
|
671
|
+
if (b > 255) b = 255;
|
|
672
|
+
else if (b < 0) b = 0;
|
|
689
673
|
let g = (num & 255) + amt;
|
|
690
|
-
if (g > 255)
|
|
691
|
-
|
|
692
|
-
else if (g < 0)
|
|
693
|
-
g = 0;
|
|
674
|
+
if (g > 255) g = 255;
|
|
675
|
+
else if (g < 0) g = 0;
|
|
694
676
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
695
677
|
};
|
|
696
678
|
var getRgbTone = (rgb, tone) => {
|
|
697
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
698
|
-
|
|
699
|
-
if (
|
|
700
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
701
|
-
if (isNumber(tone))
|
|
702
|
-
tone += "";
|
|
679
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
680
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
681
|
+
if (isNumber(tone)) tone += "";
|
|
703
682
|
const toHex = rgbArrayToHex(rgb);
|
|
704
683
|
const abs = tone.slice(0, 1);
|
|
705
684
|
if (abs === "-" || abs === "+") {
|
|
@@ -721,27 +700,21 @@ var import_utils4 = __toESM(require_cjs(), 1);
|
|
|
721
700
|
var getColor = (value, key, config) => {
|
|
722
701
|
const CONFIG2 = config || getActiveConfig();
|
|
723
702
|
if (!isString(value)) {
|
|
724
|
-
if (CONFIG2.verbose)
|
|
725
|
-
console.warn(value, "- type for color is not valid");
|
|
703
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
726
704
|
return;
|
|
727
705
|
}
|
|
728
|
-
if (value.slice(0, 2) === "--")
|
|
729
|
-
|
|
730
|
-
if (key && value[key])
|
|
731
|
-
value = value[key];
|
|
706
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
707
|
+
if (key && value[key]) value = value[key];
|
|
732
708
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
733
709
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
734
710
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
735
711
|
if (!val) {
|
|
736
|
-
if (CONFIG2.verbose)
|
|
737
|
-
console.warn("Can't find color ", name);
|
|
712
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
738
713
|
return value;
|
|
739
714
|
}
|
|
740
715
|
if (key) {
|
|
741
|
-
if (val[key])
|
|
742
|
-
|
|
743
|
-
else if (CONFIG2.verbose)
|
|
744
|
-
console.warn(value, " - does not have ", key);
|
|
716
|
+
if (val[key]) val = val[key];
|
|
717
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
745
718
|
}
|
|
746
719
|
let rgb = val.rgb;
|
|
747
720
|
if (!rgb) {
|
|
@@ -751,32 +724,25 @@ var getColor = (value, key, config) => {
|
|
|
751
724
|
rgb = getRgbTone(rgb, tone);
|
|
752
725
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
753
726
|
}
|
|
754
|
-
if (val[tone])
|
|
755
|
-
|
|
756
|
-
if (alpha)
|
|
757
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
727
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
728
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
758
729
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
759
730
|
};
|
|
760
731
|
var getMediaColor = (value, globalTheme, config) => {
|
|
761
732
|
const CONFIG2 = config || getActiveConfig();
|
|
762
|
-
if (!globalTheme)
|
|
763
|
-
globalTheme = CONFIG2.globalTheme;
|
|
733
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
764
734
|
if (!isString(value)) {
|
|
765
|
-
if (CONFIG2.verbose)
|
|
766
|
-
console.warn(value, "- type for color is not valid");
|
|
735
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
767
736
|
return;
|
|
768
737
|
}
|
|
769
|
-
if (value.slice(0, 2) === "--")
|
|
770
|
-
return `var(${value})`;
|
|
738
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
771
739
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
772
740
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
773
741
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
774
742
|
const isObj = isObject(val);
|
|
775
|
-
if (isObj && val.value)
|
|
776
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
743
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
777
744
|
else if (isObj) {
|
|
778
|
-
if (globalTheme)
|
|
779
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
745
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
780
746
|
else {
|
|
781
747
|
const obj = {};
|
|
782
748
|
for (const mediaName in val) {
|
|
@@ -787,8 +753,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
787
753
|
return obj;
|
|
788
754
|
}
|
|
789
755
|
} else {
|
|
790
|
-
if (CONFIG2.verbose)
|
|
791
|
-
console.warn("Can't find color", value);
|
|
756
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
792
757
|
return value;
|
|
793
758
|
}
|
|
794
759
|
};
|
|
@@ -797,8 +762,7 @@ var setColor = (val, key, suffix) => {
|
|
|
797
762
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
798
763
|
val = getColor(val.slice(2));
|
|
799
764
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
800
|
-
if (CONFIG2.verbose)
|
|
801
|
-
console.warn(val, "- referred but does not exist");
|
|
765
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
802
766
|
val = val.split(" ")[0];
|
|
803
767
|
}
|
|
804
768
|
}
|
|
@@ -837,8 +801,7 @@ var setColor = (val, key, suffix) => {
|
|
|
837
801
|
};
|
|
838
802
|
var setGradient = (val, key, suffix) => {
|
|
839
803
|
const CONFIG2 = getActiveConfig();
|
|
840
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
841
|
-
val = getColor(val.slice(2));
|
|
804
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
842
805
|
if (isArray(val)) {
|
|
843
806
|
return {
|
|
844
807
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -847,8 +810,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
847
810
|
}
|
|
848
811
|
if (isObject(val)) {
|
|
849
812
|
const obj = {};
|
|
850
|
-
for (const variant in val)
|
|
851
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
813
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
852
814
|
return obj;
|
|
853
815
|
}
|
|
854
816
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -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
|
});
|
|
@@ -284,8 +275,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
284
275
|
var isNull = (arg) => arg === null;
|
|
285
276
|
var isArray = (arg) => Array.isArray(arg);
|
|
286
277
|
var isObjectLike = (arg) => {
|
|
287
|
-
if (arg === null)
|
|
288
|
-
return false;
|
|
278
|
+
if (arg === null) return false;
|
|
289
279
|
return typeof arg === "object";
|
|
290
280
|
};
|
|
291
281
|
var isUndefined = (arg) => {
|
|
@@ -294,7 +284,10 @@ var isUndefined = (arg) => {
|
|
|
294
284
|
|
|
295
285
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
296
286
|
var mergeArray = (arr, exclude = []) => {
|
|
297
|
-
return arr.reduce(
|
|
287
|
+
return arr.reduce(
|
|
288
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
289
|
+
{}
|
|
290
|
+
);
|
|
298
291
|
};
|
|
299
292
|
|
|
300
293
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -363,8 +356,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
363
356
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
364
357
|
visited.set(obj, clone2);
|
|
365
358
|
for (const key in obj) {
|
|
366
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
367
|
-
continue;
|
|
359
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
368
360
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
369
361
|
continue;
|
|
370
362
|
const value = obj[key];
|
|
@@ -619,10 +611,8 @@ var getActiveConfig = (def) => {
|
|
|
619
611
|
|
|
620
612
|
// src/utils/font.js
|
|
621
613
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
622
|
-
if (LIBRARY[key])
|
|
623
|
-
|
|
624
|
-
if (LIBRARY.default)
|
|
625
|
-
return LIBRARY[LIBRARY.default].value;
|
|
614
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
615
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
626
616
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
627
617
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
628
618
|
};
|
package/dist/cjs/system/font.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: () => arrayzeValue2,
|
|
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 arrayzeValue2 = (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
|
});
|
|
@@ -283,16 +274,14 @@ var isDOMNode = (obj) => {
|
|
|
283
274
|
|
|
284
275
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
285
276
|
var isObject = (arg) => {
|
|
286
|
-
if (arg === null)
|
|
287
|
-
return false;
|
|
277
|
+
if (arg === null) return false;
|
|
288
278
|
return typeof arg === "object" && arg.constructor === Object;
|
|
289
279
|
};
|
|
290
280
|
var isFunction = (arg) => typeof arg === "function";
|
|
291
281
|
var isNull = (arg) => arg === null;
|
|
292
282
|
var isArray = (arg) => Array.isArray(arg);
|
|
293
283
|
var isObjectLike = (arg) => {
|
|
294
|
-
if (arg === null)
|
|
295
|
-
return false;
|
|
284
|
+
if (arg === null) return false;
|
|
296
285
|
return typeof arg === "object";
|
|
297
286
|
};
|
|
298
287
|
var isUndefined = (arg) => {
|
|
@@ -301,7 +290,10 @@ var isUndefined = (arg) => {
|
|
|
301
290
|
|
|
302
291
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
303
292
|
var mergeArray = (arr, exclude = []) => {
|
|
304
|
-
return arr.reduce(
|
|
293
|
+
return arr.reduce(
|
|
294
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
295
|
+
{}
|
|
296
|
+
);
|
|
305
297
|
};
|
|
306
298
|
|
|
307
299
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -357,8 +349,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
357
349
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
358
350
|
visited.set(obj, clone2);
|
|
359
351
|
for (const key in obj) {
|
|
360
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
361
|
-
continue;
|
|
352
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
362
353
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
363
354
|
continue;
|
|
364
355
|
const value = obj[key];
|
|
@@ -616,10 +607,8 @@ var getActiveConfig = (def) => {
|
|
|
616
607
|
|
|
617
608
|
// src/utils/font.js
|
|
618
609
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
619
|
-
if (LIBRARY[key])
|
|
620
|
-
|
|
621
|
-
if (LIBRARY.default)
|
|
622
|
-
return LIBRARY[LIBRARY.default].value;
|
|
610
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
611
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
623
612
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
624
613
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
625
614
|
};
|
|
@@ -646,8 +635,7 @@ var import_utils4 = __toESM(require_cjs(), 1);
|
|
|
646
635
|
// src/system/font.js
|
|
647
636
|
var setFont = (val, key) => {
|
|
648
637
|
const CSSvar = `--font-${key}`;
|
|
649
|
-
if (!val || isArray(val) && !val[0])
|
|
650
|
-
return;
|
|
638
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
651
639
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
652
640
|
return { var: CSSvar, value: val, fontFace };
|
|
653
641
|
};
|
|
@@ -660,10 +648,8 @@ var setFontFamily = (val, key) => {
|
|
|
660
648
|
const CONFIG2 = getActiveConfig();
|
|
661
649
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
662
650
|
let { value, type } = val;
|
|
663
|
-
if (val.isDefault)
|
|
664
|
-
|
|
665
|
-
if (isObject(value))
|
|
666
|
-
value = (0, import_utils8.arrayzeValue)(value);
|
|
651
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
652
|
+
if (isObject(value)) value = (0, import_utils8.arrayzeValue)(value);
|
|
667
653
|
const CSSvar = `--font-family-${key}`;
|
|
668
654
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
669
655
|
return { var: CSSvar, value: str, arr: value, type };
|