@symbo.ls/scratch 2.11.523 → 3.0.1
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 +13 -20
- package/dist/cjs/index.js +193 -383
- package/dist/cjs/set.js +132 -282
- package/dist/cjs/system/color.js +61 -142
- package/dist/cjs/system/document.js +28 -84
- package/dist/cjs/system/font.js +29 -88
- package/dist/cjs/system/index.js +135 -285
- package/dist/cjs/system/reset.js +35 -98
- package/dist/cjs/system/shadow.js +77 -173
- package/dist/cjs/system/spacing.js +41 -112
- package/dist/cjs/system/svg.js +34 -94
- package/dist/cjs/system/theme.js +74 -168
- package/dist/cjs/system/timing.js +33 -96
- package/dist/cjs/system/typography.js +41 -110
- package/dist/cjs/transforms/index.js +112 -228
- package/dist/cjs/utils/color.js +22 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +67 -155
- package/dist/cjs/utils/sequence.js +34 -58
- package/dist/cjs/utils/sprite.js +13 -20
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +27 -45
- package/package.json +3 -3
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
- package/src/utils/sequence.js +1 -1
package/dist/cjs/system/index.js
CHANGED
|
@@ -30,44 +30,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
34
|
-
var require_cjs = __commonJS({
|
|
35
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var __defProp3 = Object.defineProperty;
|
|
38
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __export2 = (target, all) => {
|
|
42
|
-
for (var name in all)
|
|
43
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
44
|
-
};
|
|
45
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
-
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
49
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var globals_exports = {};
|
|
55
|
-
__export2(globals_exports, {
|
|
56
|
-
document: () => document5,
|
|
57
|
-
global: () => global,
|
|
58
|
-
self: () => self,
|
|
59
|
-
window: () => window4
|
|
60
|
-
});
|
|
61
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
-
var global = globalThis;
|
|
63
|
-
var self = globalThis;
|
|
64
|
-
var window4 = globalThis;
|
|
65
|
-
var document5 = window4.document;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
33
|
// ../utils/dist/cjs/index.js
|
|
70
|
-
var
|
|
34
|
+
var require_cjs = __commonJS({
|
|
71
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
72
36
|
"use strict";
|
|
73
37
|
var __defProp3 = Object.defineProperty;
|
|
@@ -87,8 +51,8 @@ var require_cjs2 = __commonJS({
|
|
|
87
51
|
return to;
|
|
88
52
|
};
|
|
89
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90
|
-
var
|
|
91
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
92
56
|
arrayzeValue: () => arrayzeValue3,
|
|
93
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
94
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -109,12 +73,11 @@ var require_cjs2 = __commonJS({
|
|
|
109
73
|
toTitleCase: () => toTitleCase,
|
|
110
74
|
toggleFullscreen: () => toggleFullscreen
|
|
111
75
|
});
|
|
112
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
113
77
|
var window22 = globalThis;
|
|
114
78
|
var document22 = window22.document;
|
|
115
79
|
var isObject2 = (arg) => {
|
|
116
|
-
if (arg === null)
|
|
117
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
118
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
119
82
|
};
|
|
120
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -139,13 +102,11 @@ var require_cjs2 = __commonJS({
|
|
|
139
102
|
};
|
|
140
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
141
104
|
val = parseFloat(val);
|
|
142
|
-
if (isObject2(factory))
|
|
143
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
144
106
|
return findClosestNumber(val, factory);
|
|
145
107
|
};
|
|
146
108
|
var formatDate = (timestamp) => {
|
|
147
|
-
if (!timestamp)
|
|
148
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
149
110
|
const d = new Date(timestamp);
|
|
150
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
151
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -212,8 +173,7 @@ var require_cjs2 = __commonJS({
|
|
|
212
173
|
scriptEle.type = type;
|
|
213
174
|
scriptEle.text = xhr.responseText;
|
|
214
175
|
doc.body.appendChild(scriptEle);
|
|
215
|
-
if (typeof fallback === "function")
|
|
216
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
217
177
|
} else {
|
|
218
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
219
179
|
}
|
|
@@ -281,20 +241,15 @@ var require_cjs2 = __commonJS({
|
|
|
281
241
|
);
|
|
282
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
283
243
|
var toDescriptionCase = (str = "") => {
|
|
284
|
-
if (typeof str !== "string")
|
|
285
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
286
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
287
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
288
247
|
};
|
|
289
248
|
var arrayzeValue3 = (val) => {
|
|
290
|
-
if (isArray2(val))
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (isObject2(val))
|
|
295
|
-
return Object.values(val);
|
|
296
|
-
if (isNumber2(val))
|
|
297
|
-
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];
|
|
298
253
|
};
|
|
299
254
|
}
|
|
300
255
|
});
|
|
@@ -334,19 +289,18 @@ __export(system_exports, {
|
|
|
334
289
|
});
|
|
335
290
|
module.exports = __toCommonJS(system_exports);
|
|
336
291
|
|
|
337
|
-
//
|
|
292
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
338
293
|
var window2 = globalThis;
|
|
339
294
|
var document2 = window2.document;
|
|
340
295
|
|
|
341
|
-
//
|
|
296
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
342
297
|
var isDOMNode = (obj) => {
|
|
343
298
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
344
299
|
};
|
|
345
300
|
|
|
346
|
-
//
|
|
301
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
347
302
|
var isObject = (arg) => {
|
|
348
|
-
if (arg === null)
|
|
349
|
-
return false;
|
|
303
|
+
if (arg === null) return false;
|
|
350
304
|
return typeof arg === "object" && arg.constructor === Object;
|
|
351
305
|
};
|
|
352
306
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -355,20 +309,19 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
355
309
|
var isNull = (arg) => arg === null;
|
|
356
310
|
var isArray = (arg) => Array.isArray(arg);
|
|
357
311
|
var isObjectLike = (arg) => {
|
|
358
|
-
if (arg === null)
|
|
359
|
-
return false;
|
|
312
|
+
if (arg === null) return false;
|
|
360
313
|
return typeof arg === "object";
|
|
361
314
|
};
|
|
362
315
|
var isUndefined = (arg) => {
|
|
363
316
|
return arg === void 0;
|
|
364
317
|
};
|
|
365
318
|
|
|
366
|
-
//
|
|
319
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
367
320
|
var mergeArray = (arr, exclude = []) => {
|
|
368
321
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
369
322
|
};
|
|
370
323
|
|
|
371
|
-
//
|
|
324
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
372
325
|
var __defProp2 = Object.defineProperty;
|
|
373
326
|
var __defProps = Object.defineProperties;
|
|
374
327
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -391,8 +344,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
391
344
|
var merge = (element, obj, excludeFrom = []) => {
|
|
392
345
|
for (const e in obj) {
|
|
393
346
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
394
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
395
|
-
continue;
|
|
347
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
396
348
|
const elementProp = element[e];
|
|
397
349
|
const objProp = obj[e];
|
|
398
350
|
if (elementProp === void 0) {
|
|
@@ -404,8 +356,7 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
404
356
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
405
357
|
for (const e in extend) {
|
|
406
358
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
407
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
408
|
-
continue;
|
|
359
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
409
360
|
const elementProp = element[e];
|
|
410
361
|
const extendProp = extend[e];
|
|
411
362
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -434,13 +385,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
434
385
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
435
386
|
visited.set(obj, clone2);
|
|
436
387
|
for (const key in obj) {
|
|
437
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
438
|
-
|
|
439
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
440
|
-
continue;
|
|
388
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
389
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
441
390
|
const value = obj[key];
|
|
442
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
443
|
-
continue;
|
|
391
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
444
392
|
if (isDOMNode(value)) {
|
|
445
393
|
clone2[key] = value;
|
|
446
394
|
continue;
|
|
@@ -469,14 +417,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
469
417
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
470
418
|
return params;
|
|
471
419
|
}
|
|
472
|
-
if (visited.has(obj))
|
|
473
|
-
return visited.get(obj);
|
|
420
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
474
421
|
visited.set(obj, obj);
|
|
475
422
|
for (const e in params) {
|
|
476
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
477
|
-
|
|
478
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
479
|
-
continue;
|
|
423
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
424
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
480
425
|
const objProp = obj[e];
|
|
481
426
|
const paramsProp = params[e];
|
|
482
427
|
if (isDOMNode(paramsProp)) {
|
|
@@ -490,7 +435,7 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
490
435
|
return obj;
|
|
491
436
|
};
|
|
492
437
|
|
|
493
|
-
//
|
|
438
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
494
439
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
495
440
|
|
|
496
441
|
// src/defaultConfig/index.js
|
|
@@ -720,12 +665,9 @@ var isScalingUnit = (unit) => {
|
|
|
720
665
|
};
|
|
721
666
|
|
|
722
667
|
// src/utils/color.js
|
|
723
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
724
668
|
var colorStringToRgbaArray = (color) => {
|
|
725
|
-
if (color === "")
|
|
726
|
-
|
|
727
|
-
if (color.toLowerCase() === "transparent")
|
|
728
|
-
return [0, 0, 0, 0];
|
|
669
|
+
if (color === "") return [0, 0, 0, 0];
|
|
670
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
729
671
|
if (color[0] === "#") {
|
|
730
672
|
if (color.length < 7) {
|
|
731
673
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -738,26 +680,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
738
680
|
];
|
|
739
681
|
}
|
|
740
682
|
if (color.indexOf("rgb") === -1) {
|
|
741
|
-
if (
|
|
742
|
-
const elem =
|
|
683
|
+
if (document2 && window2) {
|
|
684
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
743
685
|
const flag = "rgb(1, 2, 3)";
|
|
744
686
|
elem.style.color = flag;
|
|
745
687
|
if (elem.style.color !== flag) {
|
|
746
|
-
|
|
688
|
+
document2.body.removeChild(elem);
|
|
747
689
|
return;
|
|
748
690
|
}
|
|
749
691
|
elem.style.color = color;
|
|
750
692
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
751
|
-
|
|
693
|
+
document2.body.removeChild(elem);
|
|
752
694
|
return [0, 0, 0, 0];
|
|
753
695
|
}
|
|
754
|
-
color =
|
|
755
|
-
|
|
696
|
+
color = window2.getComputedStyle(elem).color;
|
|
697
|
+
document2.body.removeChild(elem);
|
|
756
698
|
}
|
|
757
699
|
}
|
|
758
700
|
if (color.indexOf("rgb") === 0) {
|
|
759
|
-
if (color.indexOf("rgba") === -1)
|
|
760
|
-
color = `${color}, 1`;
|
|
701
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
761
702
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
762
703
|
}
|
|
763
704
|
return [0, 0, 0, 0];
|
|
@@ -783,29 +724,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
783
724
|
var getColorShade = (col, amt) => {
|
|
784
725
|
const num = parseInt(col, 16);
|
|
785
726
|
let r = (num >> 16) + amt;
|
|
786
|
-
if (r > 255)
|
|
787
|
-
|
|
788
|
-
else if (r < 0)
|
|
789
|
-
r = 0;
|
|
727
|
+
if (r > 255) r = 255;
|
|
728
|
+
else if (r < 0) r = 0;
|
|
790
729
|
let b = (num >> 8 & 255) + amt;
|
|
791
|
-
if (b > 255)
|
|
792
|
-
|
|
793
|
-
else if (b < 0)
|
|
794
|
-
b = 0;
|
|
730
|
+
if (b > 255) b = 255;
|
|
731
|
+
else if (b < 0) b = 0;
|
|
795
732
|
let g = (num & 255) + amt;
|
|
796
|
-
if (g > 255)
|
|
797
|
-
|
|
798
|
-
else if (g < 0)
|
|
799
|
-
g = 0;
|
|
733
|
+
if (g > 255) g = 255;
|
|
734
|
+
else if (g < 0) g = 0;
|
|
800
735
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
801
736
|
};
|
|
802
737
|
var getRgbTone = (rgb, tone) => {
|
|
803
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
804
|
-
|
|
805
|
-
if (
|
|
806
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
807
|
-
if (isNumber(tone))
|
|
808
|
-
tone += "";
|
|
738
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
739
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
740
|
+
if (isNumber(tone)) tone += "";
|
|
809
741
|
const toHex = rgbArrayToHex(rgb);
|
|
810
742
|
const abs = tone.slice(0, 1);
|
|
811
743
|
if (abs === "-" || abs === "+") {
|
|
@@ -822,10 +754,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
822
754
|
|
|
823
755
|
// src/utils/font.js
|
|
824
756
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
825
|
-
if (LIBRARY[key])
|
|
826
|
-
|
|
827
|
-
if (LIBRARY.default)
|
|
828
|
-
return LIBRARY[LIBRARY.default].value;
|
|
757
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
758
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
829
759
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
830
760
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
831
761
|
};
|
|
@@ -847,7 +777,7 @@ var getFontFaceEach = (name, weights) => {
|
|
|
847
777
|
};
|
|
848
778
|
|
|
849
779
|
// src/utils/sequence.js
|
|
850
|
-
var import_utils4 = __toESM(
|
|
780
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
851
781
|
var numToLetterMap = {
|
|
852
782
|
"-6": "U",
|
|
853
783
|
"-5": "V",
|
|
@@ -893,8 +823,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
893
823
|
var setScalingVar = (key, sequenceProps) => {
|
|
894
824
|
const { base, type, unit } = sequenceProps;
|
|
895
825
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
896
|
-
if (key === 0)
|
|
897
|
-
return defaultVal;
|
|
826
|
+
if (key === 0) return defaultVal;
|
|
898
827
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
899
828
|
const ratioVar = `${prefix}-ratio`;
|
|
900
829
|
if (key > 0) {
|
|
@@ -931,10 +860,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
931
860
|
const diffRounded = ~~next - ~~value;
|
|
932
861
|
let arr;
|
|
933
862
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
934
|
-
if (diffRounded > 16)
|
|
935
|
-
|
|
936
|
-
else
|
|
937
|
-
arr = [first, second];
|
|
863
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
864
|
+
else arr = [first, second];
|
|
938
865
|
arr.forEach((v, k) => {
|
|
939
866
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
940
867
|
const newVar = variable + (k + 1);
|
|
@@ -976,8 +903,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
976
903
|
index: key
|
|
977
904
|
};
|
|
978
905
|
setSequenceValue(props, sequenceProps);
|
|
979
|
-
if (subSequence)
|
|
980
|
-
generateSubSequence(props, sequenceProps);
|
|
906
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
981
907
|
}
|
|
982
908
|
return sequenceProps;
|
|
983
909
|
};
|
|
@@ -989,13 +915,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
989
915
|
unit = UNIT2.default,
|
|
990
916
|
useVariable
|
|
991
917
|
} = sequenceProps;
|
|
992
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
993
|
-
return `var(${value})`;
|
|
918
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
994
919
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
995
920
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
996
921
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
997
|
-
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)
|
|
998
|
-
return value;
|
|
922
|
+
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;
|
|
999
923
|
const letterVal = value.toUpperCase();
|
|
1000
924
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1001
925
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1019,8 +943,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1019
943
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1020
944
|
}
|
|
1021
945
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1022
|
-
if (CONFIG2.verbose)
|
|
1023
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
946
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1024
947
|
absValue = absValue.slice(0, 1);
|
|
1025
948
|
}
|
|
1026
949
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1028,8 +951,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1028
951
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1029
952
|
}
|
|
1030
953
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1031
|
-
if (!sequenceItem)
|
|
1032
|
-
return console.warn("can't find", sequence, absValue);
|
|
954
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1033
955
|
if (unit === "ms" || unit === "s") {
|
|
1034
956
|
return isNegative + sequenceItem.val + unit;
|
|
1035
957
|
}
|
|
@@ -1038,12 +960,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1038
960
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1039
961
|
if (typeof value !== "string") {
|
|
1040
962
|
const CONFIG2 = getActiveConfig();
|
|
1041
|
-
if (CONFIG2.verbose)
|
|
1042
|
-
console.warn(propertyName, value, "is not a string");
|
|
963
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1043
964
|
return { [propertyName]: value };
|
|
1044
965
|
}
|
|
1045
|
-
if (value === "-" || value === "")
|
|
1046
|
-
return {};
|
|
966
|
+
if (value === "-" || value === "") return {};
|
|
1047
967
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1048
968
|
};
|
|
1049
969
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1103,23 +1023,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1103
1023
|
const { mediaRegenerate } = FACTORY2;
|
|
1104
1024
|
const { sequence, scales } = FACTORY2[media];
|
|
1105
1025
|
const query = MEDIA2[mediaName];
|
|
1106
|
-
if (!query && CONFIG2.verbose)
|
|
1107
|
-
console.warn("Can't find media query ", query);
|
|
1026
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1108
1027
|
if (!mediaRegenerate) {
|
|
1109
1028
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1110
|
-
if (!underMediaQuery)
|
|
1111
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1029
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1112
1030
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1113
1031
|
return;
|
|
1114
1032
|
}
|
|
1115
1033
|
for (const key in sequence) {
|
|
1116
1034
|
const item = sequence[key];
|
|
1117
1035
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1118
|
-
if (!query && CONFIG2.verbose)
|
|
1119
|
-
console.warn("Can't find query ", query);
|
|
1036
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1120
1037
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1121
|
-
if (!underMediaQuery)
|
|
1122
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1038
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1123
1039
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1124
1040
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1125
1041
|
}
|
|
@@ -1130,10 +1046,8 @@ var generateSprite = (icons) => {
|
|
|
1130
1046
|
const CONFIG2 = getActiveConfig();
|
|
1131
1047
|
let sprite = "";
|
|
1132
1048
|
for (const key in icons) {
|
|
1133
|
-
if (CONFIG2.__svg_cache[key])
|
|
1134
|
-
|
|
1135
|
-
else
|
|
1136
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1049
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1050
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1137
1051
|
sprite += icons[key];
|
|
1138
1052
|
}
|
|
1139
1053
|
return sprite;
|
|
@@ -1188,27 +1102,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1188
1102
|
var getColor = (value, key, config) => {
|
|
1189
1103
|
const CONFIG2 = config || getActiveConfig();
|
|
1190
1104
|
if (!isString(value)) {
|
|
1191
|
-
if (CONFIG2.verbose)
|
|
1192
|
-
console.warn(value, "- type for color is not valid");
|
|
1105
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1193
1106
|
return;
|
|
1194
1107
|
}
|
|
1195
|
-
if (value.slice(0, 2) === "--")
|
|
1196
|
-
|
|
1197
|
-
if (key && value[key])
|
|
1198
|
-
value = value[key];
|
|
1108
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1109
|
+
if (key && value[key]) value = value[key];
|
|
1199
1110
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1200
1111
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1201
1112
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1202
1113
|
if (!val) {
|
|
1203
|
-
if (CONFIG2.verbose)
|
|
1204
|
-
console.warn("Can't find color ", name);
|
|
1114
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1205
1115
|
return value;
|
|
1206
1116
|
}
|
|
1207
1117
|
if (key) {
|
|
1208
|
-
if (val[key])
|
|
1209
|
-
|
|
1210
|
-
else if (CONFIG2.verbose)
|
|
1211
|
-
console.warn(value, " - does not have ", key);
|
|
1118
|
+
if (val[key]) val = val[key];
|
|
1119
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1212
1120
|
}
|
|
1213
1121
|
let rgb = val.rgb;
|
|
1214
1122
|
if (!rgb) {
|
|
@@ -1218,32 +1126,25 @@ var getColor = (value, key, config) => {
|
|
|
1218
1126
|
rgb = getRgbTone(rgb, tone);
|
|
1219
1127
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1220
1128
|
}
|
|
1221
|
-
if (val[tone])
|
|
1222
|
-
|
|
1223
|
-
if (alpha)
|
|
1224
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1129
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1130
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1225
1131
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1226
1132
|
};
|
|
1227
1133
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1228
1134
|
const CONFIG2 = config || getActiveConfig();
|
|
1229
|
-
if (!globalTheme)
|
|
1230
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1135
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1231
1136
|
if (!isString(value)) {
|
|
1232
|
-
if (CONFIG2.verbose)
|
|
1233
|
-
console.warn(value, "- type for color is not valid");
|
|
1137
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1234
1138
|
return;
|
|
1235
1139
|
}
|
|
1236
|
-
if (value.slice(0, 2) === "--")
|
|
1237
|
-
return `var(${value})`;
|
|
1140
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1238
1141
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1239
1142
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1240
1143
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1241
1144
|
const isObj = isObject(val);
|
|
1242
|
-
if (isObj && val.value)
|
|
1243
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1145
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1244
1146
|
else if (isObj) {
|
|
1245
|
-
if (globalTheme)
|
|
1246
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1147
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1247
1148
|
else {
|
|
1248
1149
|
const obj = {};
|
|
1249
1150
|
for (const mediaName in val) {
|
|
@@ -1254,8 +1155,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1254
1155
|
return obj;
|
|
1255
1156
|
}
|
|
1256
1157
|
} else {
|
|
1257
|
-
if (CONFIG2.verbose)
|
|
1258
|
-
console.warn("Can't find color", value);
|
|
1158
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1259
1159
|
return value;
|
|
1260
1160
|
}
|
|
1261
1161
|
};
|
|
@@ -1264,8 +1164,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1264
1164
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1265
1165
|
val = getColor(val.slice(2));
|
|
1266
1166
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1267
|
-
if (CONFIG2.verbose)
|
|
1268
|
-
console.warn(val, "- referred but does not exist");
|
|
1167
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1269
1168
|
val = val.split(" ")[0];
|
|
1270
1169
|
}
|
|
1271
1170
|
}
|
|
@@ -1304,8 +1203,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1304
1203
|
};
|
|
1305
1204
|
var setGradient = (val, key, suffix) => {
|
|
1306
1205
|
const CONFIG2 = getActiveConfig();
|
|
1307
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1308
|
-
val = getColor(val.slice(2));
|
|
1206
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1309
1207
|
if (isArray(val)) {
|
|
1310
1208
|
return {
|
|
1311
1209
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1314,8 +1212,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1314
1212
|
}
|
|
1315
1213
|
if (isObject(val)) {
|
|
1316
1214
|
const obj = {};
|
|
1317
|
-
for (const variant in val)
|
|
1318
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1215
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1319
1216
|
return obj;
|
|
1320
1217
|
}
|
|
1321
1218
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1341,22 +1238,19 @@ var setThemeValue = (theme) => {
|
|
|
1341
1238
|
return value;
|
|
1342
1239
|
};
|
|
1343
1240
|
var getThemeValue = (theme) => {
|
|
1344
|
-
if (theme.value)
|
|
1345
|
-
return theme.value;
|
|
1241
|
+
if (theme.value) return theme.value;
|
|
1346
1242
|
theme.value = setThemeValue(theme);
|
|
1347
1243
|
return theme.value;
|
|
1348
1244
|
};
|
|
1349
1245
|
var getTheme = (value, modifier) => {
|
|
1350
1246
|
const CONFIG2 = getActiveConfig();
|
|
1351
|
-
if (CONFIG2.useVariable)
|
|
1352
|
-
return getMediaTheme(value, modifier);
|
|
1247
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1353
1248
|
const { THEME: THEME2 } = CONFIG2;
|
|
1354
1249
|
if (isString(value)) {
|
|
1355
1250
|
const [theme, subtheme] = value.split(" ");
|
|
1356
1251
|
const isOurTheme = THEME2[theme];
|
|
1357
1252
|
if (isOurTheme) {
|
|
1358
|
-
if (!subtheme && !modifier)
|
|
1359
|
-
return getThemeValue(isOurTheme);
|
|
1253
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1360
1254
|
value = [theme, subtheme || modifier];
|
|
1361
1255
|
}
|
|
1362
1256
|
}
|
|
@@ -1364,14 +1258,10 @@ var getTheme = (value, modifier) => {
|
|
|
1364
1258
|
const themeName = value[0];
|
|
1365
1259
|
const subThemeName = value[1];
|
|
1366
1260
|
const { helpers, media, state } = THEME2[themeName];
|
|
1367
|
-
if (media && media[subThemeName])
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
if (state && state[subThemeName])
|
|
1372
|
-
return getThemeValue(state[subThemeName]);
|
|
1373
|
-
} else if (isObject(value))
|
|
1374
|
-
return setThemeValue(value);
|
|
1261
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1262
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1263
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1264
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1375
1265
|
};
|
|
1376
1266
|
var setInverseTheme = (theme, variant, value) => {
|
|
1377
1267
|
if (isObject(variant)) {
|
|
@@ -1389,13 +1279,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1389
1279
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1390
1280
|
const result = getTheme(variant);
|
|
1391
1281
|
themeValue[`&:${key}`] = result;
|
|
1392
|
-
if (isObject(variant) && !variant.value)
|
|
1393
|
-
variant.value = result;
|
|
1282
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1394
1283
|
};
|
|
1395
1284
|
var setSelectors = (theme, value) => {
|
|
1396
1285
|
const { state } = theme;
|
|
1397
|
-
if (!state)
|
|
1398
|
-
return;
|
|
1286
|
+
if (!state) return;
|
|
1399
1287
|
const keys = Object.keys(state);
|
|
1400
1288
|
keys.map((key) => {
|
|
1401
1289
|
const variant = state[key];
|
|
@@ -1407,20 +1295,16 @@ var setSelectors = (theme, value) => {
|
|
|
1407
1295
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1408
1296
|
const result = getTheme(variant);
|
|
1409
1297
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1410
|
-
if (isObject(variant) && !variant.value)
|
|
1411
|
-
variant.value = result;
|
|
1298
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1412
1299
|
};
|
|
1413
1300
|
var setMedia = (theme, value) => {
|
|
1414
1301
|
const { media } = theme;
|
|
1415
|
-
if (!media)
|
|
1416
|
-
return;
|
|
1302
|
+
if (!media) return;
|
|
1417
1303
|
const keys = Object.keys(media);
|
|
1418
1304
|
keys.map((key) => {
|
|
1419
1305
|
const variant = media[key];
|
|
1420
|
-
if (key === "dark" || key === "light")
|
|
1421
|
-
|
|
1422
|
-
if (key === "inverse")
|
|
1423
|
-
setInverseTheme(theme, variant, value);
|
|
1306
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1307
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1424
1308
|
return theme;
|
|
1425
1309
|
});
|
|
1426
1310
|
return theme;
|
|
@@ -1428,23 +1312,19 @@ var setMedia = (theme, value) => {
|
|
|
1428
1312
|
var setHelpers = (theme, value) => {
|
|
1429
1313
|
const CONFIG2 = getActiveConfig();
|
|
1430
1314
|
const { helpers } = theme;
|
|
1431
|
-
if (!helpers)
|
|
1432
|
-
return;
|
|
1315
|
+
if (!helpers) return;
|
|
1433
1316
|
const keys = Object.keys(helpers);
|
|
1434
1317
|
keys.map((key) => {
|
|
1435
1318
|
const helper = helpers[key];
|
|
1436
|
-
if (isString(helper))
|
|
1437
|
-
|
|
1438
|
-
else
|
|
1439
|
-
getThemeValue(helpers[key]);
|
|
1319
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1320
|
+
else getThemeValue(helpers[key]);
|
|
1440
1321
|
return theme;
|
|
1441
1322
|
});
|
|
1442
1323
|
return theme;
|
|
1443
1324
|
};
|
|
1444
1325
|
var setTheme = (val, key) => {
|
|
1445
1326
|
const CONFIG2 = getActiveConfig();
|
|
1446
|
-
if (CONFIG2.useVariable)
|
|
1447
|
-
return setMediaTheme(val, key);
|
|
1327
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1448
1328
|
const { state, media, helpers } = val;
|
|
1449
1329
|
const value = setThemeValue(val, key);
|
|
1450
1330
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1506,24 +1386,19 @@ var recursiveTheme = (val) => {
|
|
|
1506
1386
|
} else if (symb === ":") {
|
|
1507
1387
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1508
1388
|
}
|
|
1509
|
-
} else
|
|
1510
|
-
obj[param] = val[param];
|
|
1389
|
+
} else obj[param] = val[param];
|
|
1511
1390
|
}
|
|
1512
1391
|
return obj;
|
|
1513
1392
|
};
|
|
1514
1393
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1515
1394
|
const currentMod = modifierArray.shift();
|
|
1516
|
-
if (val[currentMod])
|
|
1517
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1395
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1518
1396
|
return val;
|
|
1519
1397
|
};
|
|
1520
1398
|
var findModifier = (val, modifier) => {
|
|
1521
|
-
if (isArray(modifier))
|
|
1522
|
-
|
|
1523
|
-
else
|
|
1524
|
-
return val[modifier];
|
|
1525
|
-
else
|
|
1526
|
-
return val;
|
|
1399
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1400
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1401
|
+
else return val;
|
|
1527
1402
|
};
|
|
1528
1403
|
var getMediaTheme = (value, modifier) => {
|
|
1529
1404
|
const activeConfig = getActiveConfig();
|
|
@@ -1546,11 +1421,10 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1546
1421
|
};
|
|
1547
1422
|
|
|
1548
1423
|
// src/system/font.js
|
|
1549
|
-
var import_utils11 = __toESM(
|
|
1424
|
+
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1550
1425
|
var setFont = (val, key) => {
|
|
1551
1426
|
const CSSvar = `--font-${key}`;
|
|
1552
|
-
if (!val || isArray(val) && !val[0])
|
|
1553
|
-
return;
|
|
1427
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1554
1428
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1555
1429
|
return { var: CSSvar, value: val, fontFace };
|
|
1556
1430
|
};
|
|
@@ -1563,10 +1437,8 @@ var setFontFamily = (val, key) => {
|
|
|
1563
1437
|
const CONFIG2 = getActiveConfig();
|
|
1564
1438
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1565
1439
|
let { value, type } = val;
|
|
1566
|
-
if (val.isDefault)
|
|
1567
|
-
|
|
1568
|
-
if (isObject(value))
|
|
1569
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1440
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1441
|
+
if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
|
|
1570
1442
|
const CSSvar = `--font-family-${key}`;
|
|
1571
1443
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1572
1444
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1579,8 +1451,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1579
1451
|
for (const prop in FACTORY2) {
|
|
1580
1452
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1581
1453
|
const mediaValue = FACTORY2[prop];
|
|
1582
|
-
if (!isPropMedia)
|
|
1583
|
-
continue;
|
|
1454
|
+
if (!isPropMedia) continue;
|
|
1584
1455
|
const { mediaRegenerate } = FACTORY2;
|
|
1585
1456
|
const mediaName = prop.slice(1);
|
|
1586
1457
|
const {
|
|
@@ -1658,13 +1529,12 @@ var getFontSizeByKey = (value) => {
|
|
|
1658
1529
|
};
|
|
1659
1530
|
|
|
1660
1531
|
// src/system/spacing.js
|
|
1661
|
-
var import_utils15 = __toESM(
|
|
1532
|
+
var import_utils15 = __toESM(require_cjs(), 1);
|
|
1662
1533
|
var runThroughMedia2 = (FACTORY2) => {
|
|
1663
1534
|
for (const prop in FACTORY2) {
|
|
1664
1535
|
const mediaProps = FACTORY2[prop];
|
|
1665
1536
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1666
|
-
if (!isMediaName)
|
|
1667
|
-
continue;
|
|
1537
|
+
if (!isMediaName) continue;
|
|
1668
1538
|
const {
|
|
1669
1539
|
type,
|
|
1670
1540
|
base,
|
|
@@ -1701,8 +1571,7 @@ var applySpacingSequence = () => {
|
|
|
1701
1571
|
var getSequence = (sequenceProps) => {
|
|
1702
1572
|
const CONFIG2 = getActiveConfig();
|
|
1703
1573
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1704
|
-
if (!sequenceProps)
|
|
1705
|
-
return SPACING2;
|
|
1574
|
+
if (!sequenceProps) return SPACING2;
|
|
1706
1575
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1707
1576
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1708
1577
|
};
|
|
@@ -1712,8 +1581,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1712
1581
|
return { [propertyName]: value };
|
|
1713
1582
|
}
|
|
1714
1583
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1715
|
-
if (!isArray(stack))
|
|
1716
|
-
return;
|
|
1584
|
+
if (!isArray(stack)) return;
|
|
1717
1585
|
if (stack.length > 1) {
|
|
1718
1586
|
let suffix = "";
|
|
1719
1587
|
if (propertyName === "borderWidth") {
|
|
@@ -1792,15 +1660,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1792
1660
|
if (isString(value) && value.includes(",")) {
|
|
1793
1661
|
value = value.split(",").map((v) => {
|
|
1794
1662
|
v = v.trim();
|
|
1795
|
-
if (v.startsWith("--"))
|
|
1796
|
-
|
|
1797
|
-
if (
|
|
1798
|
-
return getColor(v);
|
|
1799
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1800
|
-
return v;
|
|
1663
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1664
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1665
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1801
1666
|
const arr = v.split(" ");
|
|
1802
|
-
if (!arr.length)
|
|
1803
|
-
return v;
|
|
1667
|
+
if (!arr.length) return v;
|
|
1804
1668
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1805
1669
|
}).join(" ");
|
|
1806
1670
|
}
|
|
@@ -1815,32 +1679,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1815
1679
|
};
|
|
1816
1680
|
var getShadow = (value, globalTheme) => {
|
|
1817
1681
|
const CONFIG2 = getActiveConfig();
|
|
1818
|
-
if (!globalTheme)
|
|
1819
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1682
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1820
1683
|
if (!isString(value)) {
|
|
1821
|
-
if (CONFIG2.verbose)
|
|
1822
|
-
console.warn(value, "- type for color is not valid");
|
|
1684
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1823
1685
|
return;
|
|
1824
1686
|
}
|
|
1825
|
-
if (value.slice(0, 2) === "--")
|
|
1826
|
-
return `var(${value})`;
|
|
1687
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1827
1688
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1828
1689
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1829
1690
|
const val = SHADOW2[name];
|
|
1830
1691
|
const isObj = isObject(val);
|
|
1831
1692
|
if (!val) {
|
|
1832
|
-
if (CONFIG2.verbose)
|
|
1833
|
-
console.warn("Can't find color ", name);
|
|
1693
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1834
1694
|
return value;
|
|
1835
1695
|
}
|
|
1836
1696
|
if (globalTheme) {
|
|
1837
|
-
if (val[globalTheme])
|
|
1838
|
-
|
|
1839
|
-
else if (CONFIG2.verbose)
|
|
1840
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1697
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1698
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1841
1699
|
}
|
|
1842
|
-
if (isObj && val.value)
|
|
1843
|
-
return val.value;
|
|
1700
|
+
if (isObj && val.value) return val.value;
|
|
1844
1701
|
if (isObj) {
|
|
1845
1702
|
const obj = {};
|
|
1846
1703
|
for (const mediaName in val) {
|
|
@@ -1850,13 +1707,12 @@ var getShadow = (value, globalTheme) => {
|
|
|
1850
1707
|
}
|
|
1851
1708
|
return obj;
|
|
1852
1709
|
}
|
|
1853
|
-
if (CONFIG2.verbose)
|
|
1854
|
-
console.warn("Can't find color", value);
|
|
1710
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1855
1711
|
return value;
|
|
1856
1712
|
};
|
|
1857
1713
|
|
|
1858
1714
|
// src/system/timing.js
|
|
1859
|
-
var import_utils19 = __toESM(
|
|
1715
|
+
var import_utils19 = __toESM(require_cjs(), 1);
|
|
1860
1716
|
var applyTimingSequence = () => {
|
|
1861
1717
|
const CONFIG2 = getActiveConfig();
|
|
1862
1718
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -1891,15 +1747,13 @@ var applyDocument = () => {
|
|
|
1891
1747
|
};
|
|
1892
1748
|
|
|
1893
1749
|
// src/system/svg.js
|
|
1894
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
1895
1750
|
var DEF_OPTIONS = {
|
|
1896
|
-
document:
|
|
1751
|
+
document: document2
|
|
1897
1752
|
};
|
|
1898
1753
|
var setSVG = (val, key) => {
|
|
1899
1754
|
const CONFIG2 = getActiveConfig();
|
|
1900
1755
|
if (!val) {
|
|
1901
|
-
if (CONFIG2.verbose)
|
|
1902
|
-
console.warn("setSVG: val is not defined", key);
|
|
1756
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1903
1757
|
return;
|
|
1904
1758
|
}
|
|
1905
1759
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1910,8 +1764,7 @@ var setSVG = (val, key) => {
|
|
|
1910
1764
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1911
1765
|
const CONFIG2 = getActiveConfig();
|
|
1912
1766
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
1913
|
-
for (const key in LIBRARY)
|
|
1914
|
-
lib[key] = CONFIG2.SVG[key];
|
|
1767
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
1915
1768
|
appendSVG(lib, options);
|
|
1916
1769
|
};
|
|
1917
1770
|
var setSvgIcon = (val, key) => {
|
|
@@ -1925,14 +1778,12 @@ var setSvgIcon = (val, key) => {
|
|
|
1925
1778
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1926
1779
|
const CONFIG2 = getActiveConfig();
|
|
1927
1780
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
1928
|
-
for (const key in LIBRARY)
|
|
1929
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
1781
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
1930
1782
|
appendSVG(lib, options);
|
|
1931
1783
|
};
|
|
1932
1784
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
1933
|
-
if (!
|
|
1934
|
-
|
|
1935
|
-
const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1785
|
+
if (!document2 || !document2.createElementNS) return;
|
|
1786
|
+
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1936
1787
|
if (options.isRoot) {
|
|
1937
1788
|
svgElem.setAttribute("aria-hidden", "true");
|
|
1938
1789
|
svgElem.setAttribute("width", "0");
|
|
@@ -1944,7 +1795,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
|
1944
1795
|
};
|
|
1945
1796
|
var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
1946
1797
|
const CONFIG2 = getActiveConfig();
|
|
1947
|
-
const doc = options.document ||
|
|
1798
|
+
const doc = options.document || document2;
|
|
1948
1799
|
if (!doc || !doc.documentElement) {
|
|
1949
1800
|
if (CONFIG2.verbose) {
|
|
1950
1801
|
console.warn("To append SVG sprites it should be run in browser environment");
|
|
@@ -1987,8 +1838,7 @@ var applyReset = (reset = {}) => {
|
|
|
1987
1838
|
}
|
|
1988
1839
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1989
1840
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1990
|
-
if (RESET2.html)
|
|
1991
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1841
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1992
1842
|
return deepMerge(merge(RESET2, reset), {
|
|
1993
1843
|
html: {
|
|
1994
1844
|
position: "absolute",
|