@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/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
|
});
|
|
@@ -273,6 +264,11 @@ __export(color_exports, {
|
|
|
273
264
|
});
|
|
274
265
|
module.exports = __toCommonJS(color_exports);
|
|
275
266
|
|
|
267
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
268
|
+
var NODE_ENV = "development";
|
|
269
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
270
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
271
|
+
|
|
276
272
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
277
273
|
var window2 = globalThis;
|
|
278
274
|
var document2 = window2.document;
|
|
@@ -284,8 +280,7 @@ var isDOMNode = (obj) => {
|
|
|
284
280
|
|
|
285
281
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
286
282
|
var isObject = (arg) => {
|
|
287
|
-
if (arg === null)
|
|
288
|
-
return false;
|
|
283
|
+
if (arg === null) return false;
|
|
289
284
|
return typeof arg === "object" && arg.constructor === Object;
|
|
290
285
|
};
|
|
291
286
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -294,8 +289,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
294
289
|
var isNull = (arg) => arg === null;
|
|
295
290
|
var isArray = (arg) => Array.isArray(arg);
|
|
296
291
|
var isObjectLike = (arg) => {
|
|
297
|
-
if (arg === null)
|
|
298
|
-
return false;
|
|
292
|
+
if (arg === null) return false;
|
|
299
293
|
return typeof arg === "object";
|
|
300
294
|
};
|
|
301
295
|
var isUndefined = (arg) => {
|
|
@@ -363,8 +357,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
363
357
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
364
358
|
visited.set(obj, clone2);
|
|
365
359
|
for (const key in obj) {
|
|
366
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
367
|
-
continue;
|
|
360
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
368
361
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
369
362
|
continue;
|
|
370
363
|
const value = obj[key];
|
|
@@ -619,10 +612,8 @@ var getActiveConfig = (def) => {
|
|
|
619
612
|
|
|
620
613
|
// src/utils/color.js
|
|
621
614
|
var colorStringToRgbaArray = (color) => {
|
|
622
|
-
if (color === "")
|
|
623
|
-
|
|
624
|
-
if (color.toLowerCase() === "transparent")
|
|
625
|
-
return [0, 0, 0, 0];
|
|
615
|
+
if (color === "") return [0, 0, 0, 0];
|
|
616
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
626
617
|
if (color[0] === "#") {
|
|
627
618
|
if (color.length < 7) {
|
|
628
619
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -653,8 +644,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
653
644
|
}
|
|
654
645
|
}
|
|
655
646
|
if (color.indexOf("rgb") === 0) {
|
|
656
|
-
if (color.indexOf("rgba") === -1)
|
|
657
|
-
color = `${color}, 1`;
|
|
647
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
658
648
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
659
649
|
}
|
|
660
650
|
return [0, 0, 0, 0];
|
|
@@ -673,36 +663,25 @@ var rgbToHSL = (r, g, b) => {
|
|
|
673
663
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
674
664
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
675
665
|
};
|
|
676
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
677
|
-
Math.min(k - 3, 9 - k, 1),
|
|
678
|
-
-1
|
|
679
|
-
)) => [f(0), f(8), f(4)];
|
|
666
|
+
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)];
|
|
680
667
|
var getColorShade = (col, amt) => {
|
|
681
668
|
const num = parseInt(col, 16);
|
|
682
669
|
let r = (num >> 16) + amt;
|
|
683
|
-
if (r > 255)
|
|
684
|
-
|
|
685
|
-
else if (r < 0)
|
|
686
|
-
r = 0;
|
|
670
|
+
if (r > 255) r = 255;
|
|
671
|
+
else if (r < 0) r = 0;
|
|
687
672
|
let b = (num >> 8 & 255) + amt;
|
|
688
|
-
if (b > 255)
|
|
689
|
-
|
|
690
|
-
else if (b < 0)
|
|
691
|
-
b = 0;
|
|
673
|
+
if (b > 255) b = 255;
|
|
674
|
+
else if (b < 0) b = 0;
|
|
692
675
|
let g = (num & 255) + amt;
|
|
693
|
-
if (g > 255)
|
|
694
|
-
|
|
695
|
-
else if (g < 0)
|
|
696
|
-
g = 0;
|
|
676
|
+
if (g > 255) g = 255;
|
|
677
|
+
else if (g < 0) g = 0;
|
|
697
678
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
698
679
|
};
|
|
699
680
|
var getRgbTone = (rgb, tone) => {
|
|
700
681
|
if (isString(rgb) && rgb.includes("rgb"))
|
|
701
682
|
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
702
|
-
if (isString(rgb))
|
|
703
|
-
|
|
704
|
-
if (isNumber(tone))
|
|
705
|
-
tone += "";
|
|
683
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
684
|
+
if (isNumber(tone)) tone += "";
|
|
706
685
|
const toHex = rgbArrayToHex(rgb);
|
|
707
686
|
const abs = tone.slice(0, 1);
|
|
708
687
|
if (abs === "-" || abs === "+") {
|
|
@@ -720,31 +699,28 @@ var getRgbTone = (rgb, tone) => {
|
|
|
720
699
|
// src/utils/sequence.js
|
|
721
700
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
722
701
|
|
|
702
|
+
// src/utils/sprite.js
|
|
703
|
+
var isDev = isNotProduction();
|
|
704
|
+
|
|
723
705
|
// src/system/color.js
|
|
724
706
|
var getColor = (value, key, config) => {
|
|
725
707
|
const CONFIG2 = config || getActiveConfig();
|
|
726
708
|
if (!isString(value)) {
|
|
727
|
-
if (CONFIG2.verbose)
|
|
728
|
-
console.warn(value, "- type for color is not valid");
|
|
709
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
729
710
|
return;
|
|
730
711
|
}
|
|
731
|
-
if (value.slice(0, 2) === "--")
|
|
732
|
-
|
|
733
|
-
if (key && value[key])
|
|
734
|
-
value = value[key];
|
|
712
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
713
|
+
if (key && value[key]) value = value[key];
|
|
735
714
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
736
715
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
737
716
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
738
717
|
if (!val) {
|
|
739
|
-
if (CONFIG2.verbose)
|
|
740
|
-
console.warn("Can't find color ", name);
|
|
718
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
741
719
|
return value;
|
|
742
720
|
}
|
|
743
721
|
if (key) {
|
|
744
|
-
if (val[key])
|
|
745
|
-
|
|
746
|
-
else if (CONFIG2.verbose)
|
|
747
|
-
console.warn(value, " - does not have ", key);
|
|
722
|
+
if (val[key]) val = val[key];
|
|
723
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
748
724
|
}
|
|
749
725
|
let rgb = val.rgb;
|
|
750
726
|
if (!rgb) {
|
|
@@ -754,32 +730,25 @@ var getColor = (value, key, config) => {
|
|
|
754
730
|
rgb = getRgbTone(rgb, tone);
|
|
755
731
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
756
732
|
}
|
|
757
|
-
if (val[tone])
|
|
758
|
-
|
|
759
|
-
if (alpha)
|
|
760
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
733
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
734
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
761
735
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
762
736
|
};
|
|
763
737
|
var getMediaColor = (value, globalTheme, config) => {
|
|
764
738
|
const CONFIG2 = config || getActiveConfig();
|
|
765
|
-
if (!globalTheme)
|
|
766
|
-
globalTheme = CONFIG2.globalTheme;
|
|
739
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
767
740
|
if (!isString(value)) {
|
|
768
|
-
if (CONFIG2.verbose)
|
|
769
|
-
console.warn(value, "- type for color is not valid");
|
|
741
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
770
742
|
return;
|
|
771
743
|
}
|
|
772
|
-
if (value.slice(0, 2) === "--")
|
|
773
|
-
return `var(${value})`;
|
|
744
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
774
745
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
775
746
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
776
747
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
777
748
|
const isObj = isObject(val);
|
|
778
|
-
if (isObj && val.value)
|
|
779
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
749
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
780
750
|
else if (isObj) {
|
|
781
|
-
if (globalTheme)
|
|
782
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
751
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
783
752
|
else {
|
|
784
753
|
const obj = {};
|
|
785
754
|
for (const mediaName in val) {
|
|
@@ -790,8 +759,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
790
759
|
return obj;
|
|
791
760
|
}
|
|
792
761
|
} else {
|
|
793
|
-
if (CONFIG2.verbose)
|
|
794
|
-
console.warn("Can't find color", value);
|
|
762
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
795
763
|
return value;
|
|
796
764
|
}
|
|
797
765
|
};
|
|
@@ -800,8 +768,7 @@ var setColor = (val, key, suffix) => {
|
|
|
800
768
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
801
769
|
val = getColor(val.slice(2));
|
|
802
770
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
803
|
-
if (CONFIG2.verbose)
|
|
804
|
-
console.warn(val, "- referred but does not exist");
|
|
771
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
805
772
|
val = val.split(" ")[0];
|
|
806
773
|
}
|
|
807
774
|
}
|
|
@@ -840,8 +807,7 @@ var setColor = (val, key, suffix) => {
|
|
|
840
807
|
};
|
|
841
808
|
var setGradient = (val, key, suffix) => {
|
|
842
809
|
const CONFIG2 = getActiveConfig();
|
|
843
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
844
|
-
val = getColor(val.slice(2));
|
|
810
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
845
811
|
if (isArray(val)) {
|
|
846
812
|
return {
|
|
847
813
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -850,8 +816,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
850
816
|
}
|
|
851
817
|
if (isObject(val)) {
|
|
852
818
|
const obj = {};
|
|
853
|
-
for (const variant in val)
|
|
854
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
819
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
855
820
|
return obj;
|
|
856
821
|
}
|
|
857
822
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -863,3 +828,4 @@ var setGradient = (val, key, suffix) => {
|
|
|
863
828
|
value: val.value || val
|
|
864
829
|
};
|
|
865
830
|
};
|
|
831
|
+
// @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
|
});
|
|
@@ -270,6 +261,11 @@ __export(document_exports, {
|
|
|
270
261
|
});
|
|
271
262
|
module.exports = __toCommonJS(document_exports);
|
|
272
263
|
|
|
264
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
265
|
+
var NODE_ENV = "development";
|
|
266
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
267
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
268
|
+
|
|
273
269
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
274
270
|
var window2 = globalThis;
|
|
275
271
|
var document2 = window2.document;
|
|
@@ -284,8 +280,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
284
280
|
var isNull = (arg) => arg === null;
|
|
285
281
|
var isArray = (arg) => Array.isArray(arg);
|
|
286
282
|
var isObjectLike = (arg) => {
|
|
287
|
-
if (arg === null)
|
|
288
|
-
return false;
|
|
283
|
+
if (arg === null) return false;
|
|
289
284
|
return typeof arg === "object";
|
|
290
285
|
};
|
|
291
286
|
var isUndefined = (arg) => {
|
|
@@ -366,8 +361,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
366
361
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
367
362
|
visited.set(obj, clone2);
|
|
368
363
|
for (const key in obj) {
|
|
369
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
370
|
-
continue;
|
|
364
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
371
365
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
372
366
|
continue;
|
|
373
367
|
const value = obj[key];
|
|
@@ -622,10 +616,8 @@ var getActiveConfig = (def) => {
|
|
|
622
616
|
|
|
623
617
|
// src/utils/font.js
|
|
624
618
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
625
|
-
if (LIBRARY[key])
|
|
626
|
-
|
|
627
|
-
if (LIBRARY.default)
|
|
628
|
-
return LIBRARY[LIBRARY.default].value;
|
|
619
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
620
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
629
621
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
630
622
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
631
623
|
};
|
|
@@ -633,6 +625,9 @@ var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
|
633
625
|
// src/utils/sequence.js
|
|
634
626
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
635
627
|
|
|
628
|
+
// src/utils/sprite.js
|
|
629
|
+
var isDev = isNotProduction();
|
|
630
|
+
|
|
636
631
|
// src/system/document.js
|
|
637
632
|
var applyDocument = () => {
|
|
638
633
|
const CONFIG2 = getActiveConfig();
|
|
@@ -644,3 +639,4 @@ var applyDocument = () => {
|
|
|
644
639
|
lineHeight: TYPOGRAPHY2.lineHeight
|
|
645
640
|
});
|
|
646
641
|
};
|
|
642
|
+
// @preserve-env
|
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
|
});
|
|
@@ -272,6 +263,11 @@ __export(font_exports, {
|
|
|
272
263
|
});
|
|
273
264
|
module.exports = __toCommonJS(font_exports);
|
|
274
265
|
|
|
266
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
267
|
+
var NODE_ENV = "development";
|
|
268
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
269
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
270
|
+
|
|
275
271
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
276
272
|
var window2 = globalThis;
|
|
277
273
|
var document2 = window2.document;
|
|
@@ -283,16 +279,14 @@ var isDOMNode = (obj) => {
|
|
|
283
279
|
|
|
284
280
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
285
281
|
var isObject = (arg) => {
|
|
286
|
-
if (arg === null)
|
|
287
|
-
return false;
|
|
282
|
+
if (arg === null) return false;
|
|
288
283
|
return typeof arg === "object" && arg.constructor === Object;
|
|
289
284
|
};
|
|
290
285
|
var isFunction = (arg) => typeof arg === "function";
|
|
291
286
|
var isNull = (arg) => arg === null;
|
|
292
287
|
var isArray = (arg) => Array.isArray(arg);
|
|
293
288
|
var isObjectLike = (arg) => {
|
|
294
|
-
if (arg === null)
|
|
295
|
-
return false;
|
|
289
|
+
if (arg === null) return false;
|
|
296
290
|
return typeof arg === "object";
|
|
297
291
|
};
|
|
298
292
|
var isUndefined = (arg) => {
|
|
@@ -360,8 +354,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
360
354
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
361
355
|
visited.set(obj, clone2);
|
|
362
356
|
for (const key in obj) {
|
|
363
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
364
|
-
continue;
|
|
357
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
365
358
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
366
359
|
continue;
|
|
367
360
|
const value = obj[key];
|
|
@@ -619,10 +612,8 @@ var getActiveConfig = (def) => {
|
|
|
619
612
|
|
|
620
613
|
// src/utils/font.js
|
|
621
614
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
622
|
-
if (LIBRARY[key])
|
|
623
|
-
|
|
624
|
-
if (LIBRARY.default)
|
|
625
|
-
return LIBRARY[LIBRARY.default].value;
|
|
615
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
616
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
626
617
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
627
618
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
628
619
|
};
|
|
@@ -646,11 +637,13 @@ var getFontFaceEach = (name, weights) => {
|
|
|
646
637
|
// src/utils/sequence.js
|
|
647
638
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
648
639
|
|
|
640
|
+
// src/utils/sprite.js
|
|
641
|
+
var isDev = isNotProduction();
|
|
642
|
+
|
|
649
643
|
// src/system/font.js
|
|
650
644
|
var setFont = (val, key) => {
|
|
651
645
|
const CSSvar = `--font-${key}`;
|
|
652
|
-
if (!val || isArray(val) && !val[0])
|
|
653
|
-
return;
|
|
646
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
654
647
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
655
648
|
return { var: CSSvar, value: val, fontFace };
|
|
656
649
|
};
|
|
@@ -663,11 +656,10 @@ var setFontFamily = (val, key) => {
|
|
|
663
656
|
const CONFIG2 = getActiveConfig();
|
|
664
657
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
665
658
|
let { value, type } = val;
|
|
666
|
-
if (val.isDefault)
|
|
667
|
-
|
|
668
|
-
if (isObject(value))
|
|
669
|
-
value = (0, import_utils8.arrayzeValue)(value);
|
|
659
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
660
|
+
if (isObject(value)) value = (0, import_utils8.arrayzeValue)(value);
|
|
670
661
|
const CSSvar = `--font-family-${key}`;
|
|
671
662
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
672
663
|
return { var: CSSvar, value: str, arr: value, type };
|
|
673
664
|
};
|
|
665
|
+
// @preserve-env
|