@symbo.ls/scratch 2.11.522 → 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 +192 -382
- 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 +66 -154
- package/dist/cjs/utils/sequence.js +33 -57
- 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/dist/cjs/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_exports2 = {};
|
|
55
|
+
__export2(index_exports2, {
|
|
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_exports2);
|
|
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,27 +241,22 @@ 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
|
});
|
|
301
256
|
|
|
302
257
|
// src/index.js
|
|
303
|
-
var
|
|
304
|
-
__export(
|
|
258
|
+
var index_exports = {};
|
|
259
|
+
__export(index_exports, {
|
|
305
260
|
ANIMATION: () => ANIMATION,
|
|
306
261
|
BREAKPOINTS: () => BREAKPOINTS,
|
|
307
262
|
CASES: () => CASES,
|
|
@@ -418,6 +373,7 @@ __export(src_exports, {
|
|
|
418
373
|
splitTransition: () => splitTransition,
|
|
419
374
|
transformBackgroundImage: () => transformBackgroundImage,
|
|
420
375
|
transformBorder: () => transformBorder,
|
|
376
|
+
transformBorderRadius: () => transformBorderRadius,
|
|
421
377
|
transformBoxShadow: () => transformBoxShadow,
|
|
422
378
|
transformDuration: () => transformDuration,
|
|
423
379
|
transformShadow: () => transformShadow,
|
|
@@ -427,7 +383,7 @@ __export(src_exports, {
|
|
|
427
383
|
transformTransition: () => transformTransition,
|
|
428
384
|
transfromGap: () => transfromGap
|
|
429
385
|
});
|
|
430
|
-
module.exports = __toCommonJS(
|
|
386
|
+
module.exports = __toCommonJS(index_exports);
|
|
431
387
|
|
|
432
388
|
// src/utils/index.js
|
|
433
389
|
var utils_exports = {};
|
|
@@ -483,22 +439,18 @@ var isScalingUnit = (unit) => {
|
|
|
483
439
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
484
440
|
};
|
|
485
441
|
|
|
486
|
-
//
|
|
487
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
488
|
-
|
|
489
|
-
// ../../node_modules/@domql/utils/dist/esm/globals.js
|
|
442
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
490
443
|
var window2 = globalThis;
|
|
491
444
|
var document2 = window2.document;
|
|
492
445
|
|
|
493
|
-
//
|
|
446
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
494
447
|
var isDOMNode = (obj) => {
|
|
495
448
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
496
449
|
};
|
|
497
450
|
|
|
498
|
-
//
|
|
451
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
499
452
|
var isObject = (arg) => {
|
|
500
|
-
if (arg === null)
|
|
501
|
-
return false;
|
|
453
|
+
if (arg === null) return false;
|
|
502
454
|
return typeof arg === "object" && arg.constructor === Object;
|
|
503
455
|
};
|
|
504
456
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -509,8 +461,7 @@ var isNull = (arg) => arg === null;
|
|
|
509
461
|
var isArray = (arg) => Array.isArray(arg);
|
|
510
462
|
var isDate = (d) => d instanceof Date;
|
|
511
463
|
var isObjectLike = (arg) => {
|
|
512
|
-
if (arg === null)
|
|
513
|
-
return false;
|
|
464
|
+
if (arg === null) return false;
|
|
514
465
|
return typeof arg === "object";
|
|
515
466
|
};
|
|
516
467
|
var isDefined = (arg) => {
|
|
@@ -520,12 +471,12 @@ var isUndefined = (arg) => {
|
|
|
520
471
|
return arg === void 0;
|
|
521
472
|
};
|
|
522
473
|
|
|
523
|
-
//
|
|
474
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
524
475
|
var mergeArray = (arr, exclude = []) => {
|
|
525
476
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
526
477
|
};
|
|
527
478
|
|
|
528
|
-
//
|
|
479
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
529
480
|
var __defProp2 = Object.defineProperty;
|
|
530
481
|
var __defProps = Object.defineProperties;
|
|
531
482
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -548,8 +499,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
548
499
|
var merge = (element, obj, excludeFrom = []) => {
|
|
549
500
|
for (const e in obj) {
|
|
550
501
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
551
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
552
|
-
continue;
|
|
502
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
553
503
|
const elementProp = element[e];
|
|
554
504
|
const objProp = obj[e];
|
|
555
505
|
if (elementProp === void 0) {
|
|
@@ -561,8 +511,7 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
561
511
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
562
512
|
for (const e in extend) {
|
|
563
513
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
564
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
565
|
-
continue;
|
|
514
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
566
515
|
const elementProp = element[e];
|
|
567
516
|
const extendProp = extend[e];
|
|
568
517
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -591,13 +540,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
591
540
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
592
541
|
visited.set(obj, clone2);
|
|
593
542
|
for (const key in obj) {
|
|
594
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
595
|
-
|
|
596
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
597
|
-
continue;
|
|
543
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
544
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
598
545
|
const value = obj[key];
|
|
599
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
600
|
-
continue;
|
|
546
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
601
547
|
if (isDOMNode(value)) {
|
|
602
548
|
clone2[key] = value;
|
|
603
549
|
continue;
|
|
@@ -626,14 +572,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
626
572
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
627
573
|
return params;
|
|
628
574
|
}
|
|
629
|
-
if (visited.has(obj))
|
|
630
|
-
return visited.get(obj);
|
|
575
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
631
576
|
visited.set(obj, obj);
|
|
632
577
|
for (const e in params) {
|
|
633
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
634
|
-
|
|
635
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
636
|
-
continue;
|
|
578
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
579
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
637
580
|
const objProp = obj[e];
|
|
638
581
|
const paramsProp = params[e];
|
|
639
582
|
if (isDOMNode(paramsProp)) {
|
|
@@ -647,16 +590,14 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
647
590
|
return obj;
|
|
648
591
|
};
|
|
649
592
|
|
|
650
|
-
//
|
|
593
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
651
594
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
652
595
|
|
|
653
596
|
// src/utils/color.js
|
|
654
597
|
var ENV = "development";
|
|
655
598
|
var colorStringToRgbaArray = (color) => {
|
|
656
|
-
if (color === "")
|
|
657
|
-
|
|
658
|
-
if (color.toLowerCase() === "transparent")
|
|
659
|
-
return [0, 0, 0, 0];
|
|
599
|
+
if (color === "") return [0, 0, 0, 0];
|
|
600
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
660
601
|
if (color[0] === "#") {
|
|
661
602
|
if (color.length < 7) {
|
|
662
603
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -669,26 +610,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
669
610
|
];
|
|
670
611
|
}
|
|
671
612
|
if (color.indexOf("rgb") === -1) {
|
|
672
|
-
if (
|
|
673
|
-
const elem =
|
|
613
|
+
if (document2 && window2) {
|
|
614
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
674
615
|
const flag = "rgb(1, 2, 3)";
|
|
675
616
|
elem.style.color = flag;
|
|
676
617
|
if (elem.style.color !== flag) {
|
|
677
|
-
|
|
618
|
+
document2.body.removeChild(elem);
|
|
678
619
|
return;
|
|
679
620
|
}
|
|
680
621
|
elem.style.color = color;
|
|
681
622
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
682
|
-
|
|
623
|
+
document2.body.removeChild(elem);
|
|
683
624
|
return [0, 0, 0, 0];
|
|
684
625
|
}
|
|
685
|
-
color =
|
|
686
|
-
|
|
626
|
+
color = window2.getComputedStyle(elem).color;
|
|
627
|
+
document2.body.removeChild(elem);
|
|
687
628
|
}
|
|
688
629
|
}
|
|
689
630
|
if (color.indexOf("rgb") === 0) {
|
|
690
|
-
if (color.indexOf("rgba") === -1)
|
|
691
|
-
color = `${color}, 1`;
|
|
631
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
692
632
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
693
633
|
}
|
|
694
634
|
return [0, 0, 0, 0];
|
|
@@ -745,20 +685,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
745
685
|
var getColorShade = (col, amt) => {
|
|
746
686
|
const num = parseInt(col, 16);
|
|
747
687
|
let r = (num >> 16) + amt;
|
|
748
|
-
if (r > 255)
|
|
749
|
-
|
|
750
|
-
else if (r < 0)
|
|
751
|
-
r = 0;
|
|
688
|
+
if (r > 255) r = 255;
|
|
689
|
+
else if (r < 0) r = 0;
|
|
752
690
|
let b = (num >> 8 & 255) + amt;
|
|
753
|
-
if (b > 255)
|
|
754
|
-
|
|
755
|
-
else if (b < 0)
|
|
756
|
-
b = 0;
|
|
691
|
+
if (b > 255) b = 255;
|
|
692
|
+
else if (b < 0) b = 0;
|
|
757
693
|
let g = (num & 255) + amt;
|
|
758
|
-
if (g > 255)
|
|
759
|
-
|
|
760
|
-
else if (g < 0)
|
|
761
|
-
g = 0;
|
|
694
|
+
if (g > 255) g = 255;
|
|
695
|
+
else if (g < 0) g = 0;
|
|
762
696
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
763
697
|
};
|
|
764
698
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -774,20 +708,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
774
708
|
var opacify = (color, opacity) => {
|
|
775
709
|
const arr = colorStringToRgbaArray(color);
|
|
776
710
|
if (!arr) {
|
|
777
|
-
if (ENV === "test" || ENV === "development")
|
|
778
|
-
console.warn(color + " color is not rgba");
|
|
711
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
779
712
|
return;
|
|
780
713
|
}
|
|
781
714
|
arr[3] = opacity;
|
|
782
715
|
return `rgba(${arr})`;
|
|
783
716
|
};
|
|
784
717
|
var getRgbTone = (rgb, tone) => {
|
|
785
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
786
|
-
|
|
787
|
-
if (
|
|
788
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
789
|
-
if (isNumber(tone))
|
|
790
|
-
tone += "";
|
|
718
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
719
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
720
|
+
if (isNumber(tone)) tone += "";
|
|
791
721
|
const toHex = rgbArrayToHex(rgb);
|
|
792
722
|
const abs = tone.slice(0, 1);
|
|
793
723
|
if (abs === "-" || abs === "+") {
|
|
@@ -804,21 +734,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
804
734
|
|
|
805
735
|
// src/utils/theme.js
|
|
806
736
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
807
|
-
if (!orig)
|
|
808
|
-
|
|
809
|
-
if (orig
|
|
810
|
-
return orig.themes[theme];
|
|
811
|
-
if (orig[theme])
|
|
812
|
-
return [orig, orig[theme]];
|
|
737
|
+
if (!orig) return;
|
|
738
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
739
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
813
740
|
return orig;
|
|
814
741
|
};
|
|
815
742
|
|
|
816
743
|
// src/utils/font.js
|
|
817
744
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
818
|
-
if (LIBRARY[key])
|
|
819
|
-
|
|
820
|
-
if (LIBRARY.default)
|
|
821
|
-
return LIBRARY[LIBRARY.default].value;
|
|
745
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
746
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
822
747
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
823
748
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
824
749
|
};
|
|
@@ -845,8 +770,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
845
770
|
};
|
|
846
771
|
var getFontFaceEachString = (name, weights) => {
|
|
847
772
|
const isArr = weights[0];
|
|
848
|
-
if (isArr)
|
|
849
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
773
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
850
774
|
return setCustomFontMedia(name, weights.url);
|
|
851
775
|
};
|
|
852
776
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -855,7 +779,7 @@ var getFontFaceString = (LIBRARY) => {
|
|
|
855
779
|
};
|
|
856
780
|
|
|
857
781
|
// src/utils/sequence.js
|
|
858
|
-
var import_utils4 = __toESM(
|
|
782
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
859
783
|
|
|
860
784
|
// src/defaultConfig/index.js
|
|
861
785
|
var defaultConfig_exports = {};
|
|
@@ -1084,8 +1008,7 @@ var getActiveConfig = (def) => {
|
|
|
1084
1008
|
return FACTORY[def || FACTORY.active] || CONFIG;
|
|
1085
1009
|
};
|
|
1086
1010
|
var setActiveConfig = (newConfig) => {
|
|
1087
|
-
if (!isObject(newConfig))
|
|
1088
|
-
return;
|
|
1011
|
+
if (!isObject(newConfig)) return;
|
|
1089
1012
|
FACTORY.active = "1";
|
|
1090
1013
|
FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
|
|
1091
1014
|
return newConfig;
|
|
@@ -1137,8 +1060,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
1137
1060
|
var setScalingVar = (key, sequenceProps) => {
|
|
1138
1061
|
const { base, type, unit } = sequenceProps;
|
|
1139
1062
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
1140
|
-
if (key === 0)
|
|
1141
|
-
return defaultVal;
|
|
1063
|
+
if (key === 0) return defaultVal;
|
|
1142
1064
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1143
1065
|
const ratioVar = `${prefix}-ratio`;
|
|
1144
1066
|
if (key > 0) {
|
|
@@ -1175,10 +1097,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
1175
1097
|
const diffRounded = ~~next - ~~value;
|
|
1176
1098
|
let arr;
|
|
1177
1099
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
1178
|
-
if (diffRounded > 16)
|
|
1179
|
-
|
|
1180
|
-
else
|
|
1181
|
-
arr = [first, second];
|
|
1100
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
1101
|
+
else arr = [first, second];
|
|
1182
1102
|
arr.forEach((v, k) => {
|
|
1183
1103
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1184
1104
|
const newVar = variable + (k + 1);
|
|
@@ -1220,8 +1140,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
1220
1140
|
index: key
|
|
1221
1141
|
};
|
|
1222
1142
|
setSequenceValue(props, sequenceProps);
|
|
1223
|
-
if (subSequence)
|
|
1224
|
-
generateSubSequence(props, sequenceProps);
|
|
1143
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
1225
1144
|
}
|
|
1226
1145
|
return sequenceProps;
|
|
1227
1146
|
};
|
|
@@ -1267,13 +1186,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1267
1186
|
unit = UNIT2.default,
|
|
1268
1187
|
useVariable
|
|
1269
1188
|
} = sequenceProps;
|
|
1270
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1271
|
-
return `var(${value})`;
|
|
1189
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1272
1190
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1273
1191
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1274
1192
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1275
|
-
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)
|
|
1276
|
-
return value;
|
|
1193
|
+
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;
|
|
1277
1194
|
const letterVal = value.toUpperCase();
|
|
1278
1195
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1279
1196
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1297,8 +1214,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1297
1214
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1298
1215
|
}
|
|
1299
1216
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1300
|
-
if (CONFIG2.verbose)
|
|
1301
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1217
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1302
1218
|
absValue = absValue.slice(0, 1);
|
|
1303
1219
|
}
|
|
1304
1220
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1306,8 +1222,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1306
1222
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1307
1223
|
}
|
|
1308
1224
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1309
|
-
if (!sequenceItem)
|
|
1310
|
-
return console.warn("can't find", sequence, absValue);
|
|
1225
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1311
1226
|
if (unit === "ms" || unit === "s") {
|
|
1312
1227
|
return isNegative + sequenceItem.val + unit;
|
|
1313
1228
|
}
|
|
@@ -1316,12 +1231,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1316
1231
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1317
1232
|
if (typeof value !== "string") {
|
|
1318
1233
|
const CONFIG2 = getActiveConfig();
|
|
1319
|
-
if (CONFIG2.verbose)
|
|
1320
|
-
console.warn(propertyName, value, "is not a string");
|
|
1234
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1321
1235
|
return { [propertyName]: value };
|
|
1322
1236
|
}
|
|
1323
|
-
if (value === "-" || value === "")
|
|
1324
|
-
return {};
|
|
1237
|
+
if (value === "-" || value === "") return {};
|
|
1325
1238
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1326
1239
|
};
|
|
1327
1240
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1389,23 +1302,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1389
1302
|
const { mediaRegenerate } = FACTORY2;
|
|
1390
1303
|
const { sequence, scales } = FACTORY2[media];
|
|
1391
1304
|
const query = MEDIA2[mediaName];
|
|
1392
|
-
if (!query && CONFIG2.verbose)
|
|
1393
|
-
console.warn("Can't find media query ", query);
|
|
1305
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1394
1306
|
if (!mediaRegenerate) {
|
|
1395
1307
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1396
|
-
if (!underMediaQuery)
|
|
1397
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1308
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1398
1309
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1399
1310
|
return;
|
|
1400
1311
|
}
|
|
1401
1312
|
for (const key in sequence) {
|
|
1402
1313
|
const item = sequence[key];
|
|
1403
1314
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1404
|
-
if (!query && CONFIG2.verbose)
|
|
1405
|
-
console.warn("Can't find query ", query);
|
|
1315
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1406
1316
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1407
|
-
if (!underMediaQuery)
|
|
1408
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1317
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1409
1318
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1410
1319
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1411
1320
|
}
|
|
@@ -1416,10 +1325,8 @@ var generateSprite = (icons) => {
|
|
|
1416
1325
|
const CONFIG2 = getActiveConfig();
|
|
1417
1326
|
let sprite = "";
|
|
1418
1327
|
for (const key in icons) {
|
|
1419
|
-
if (CONFIG2.__svg_cache[key])
|
|
1420
|
-
|
|
1421
|
-
else
|
|
1422
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1328
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1329
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1423
1330
|
sprite += icons[key];
|
|
1424
1331
|
}
|
|
1425
1332
|
return sprite;
|
|
@@ -1508,27 +1415,21 @@ __export(system_exports, {
|
|
|
1508
1415
|
var getColor = (value, key, config) => {
|
|
1509
1416
|
const CONFIG2 = config || getActiveConfig();
|
|
1510
1417
|
if (!isString(value)) {
|
|
1511
|
-
if (CONFIG2.verbose)
|
|
1512
|
-
console.warn(value, "- type for color is not valid");
|
|
1418
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1513
1419
|
return;
|
|
1514
1420
|
}
|
|
1515
|
-
if (value.slice(0, 2) === "--")
|
|
1516
|
-
|
|
1517
|
-
if (key && value[key])
|
|
1518
|
-
value = value[key];
|
|
1421
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1422
|
+
if (key && value[key]) value = value[key];
|
|
1519
1423
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1520
1424
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1521
1425
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1522
1426
|
if (!val) {
|
|
1523
|
-
if (CONFIG2.verbose)
|
|
1524
|
-
console.warn("Can't find color ", name);
|
|
1427
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1525
1428
|
return value;
|
|
1526
1429
|
}
|
|
1527
1430
|
if (key) {
|
|
1528
|
-
if (val[key])
|
|
1529
|
-
|
|
1530
|
-
else if (CONFIG2.verbose)
|
|
1531
|
-
console.warn(value, " - does not have ", key);
|
|
1431
|
+
if (val[key]) val = val[key];
|
|
1432
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1532
1433
|
}
|
|
1533
1434
|
let rgb = val.rgb;
|
|
1534
1435
|
if (!rgb) {
|
|
@@ -1538,32 +1439,25 @@ var getColor = (value, key, config) => {
|
|
|
1538
1439
|
rgb = getRgbTone(rgb, tone);
|
|
1539
1440
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1540
1441
|
}
|
|
1541
|
-
if (val[tone])
|
|
1542
|
-
|
|
1543
|
-
if (alpha)
|
|
1544
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1442
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1443
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1545
1444
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1546
1445
|
};
|
|
1547
1446
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1548
1447
|
const CONFIG2 = config || getActiveConfig();
|
|
1549
|
-
if (!globalTheme)
|
|
1550
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1448
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1551
1449
|
if (!isString(value)) {
|
|
1552
|
-
if (CONFIG2.verbose)
|
|
1553
|
-
console.warn(value, "- type for color is not valid");
|
|
1450
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1554
1451
|
return;
|
|
1555
1452
|
}
|
|
1556
|
-
if (value.slice(0, 2) === "--")
|
|
1557
|
-
return `var(${value})`;
|
|
1453
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1558
1454
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1559
1455
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1560
1456
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1561
1457
|
const isObj = isObject(val);
|
|
1562
|
-
if (isObj && val.value)
|
|
1563
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1458
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1564
1459
|
else if (isObj) {
|
|
1565
|
-
if (globalTheme)
|
|
1566
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1460
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1567
1461
|
else {
|
|
1568
1462
|
const obj = {};
|
|
1569
1463
|
for (const mediaName in val) {
|
|
@@ -1574,8 +1468,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1574
1468
|
return obj;
|
|
1575
1469
|
}
|
|
1576
1470
|
} else {
|
|
1577
|
-
if (CONFIG2.verbose)
|
|
1578
|
-
console.warn("Can't find color", value);
|
|
1471
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1579
1472
|
return value;
|
|
1580
1473
|
}
|
|
1581
1474
|
};
|
|
@@ -1584,8 +1477,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1584
1477
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1585
1478
|
val = getColor(val.slice(2));
|
|
1586
1479
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1587
|
-
if (CONFIG2.verbose)
|
|
1588
|
-
console.warn(val, "- referred but does not exist");
|
|
1480
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1589
1481
|
val = val.split(" ")[0];
|
|
1590
1482
|
}
|
|
1591
1483
|
}
|
|
@@ -1624,8 +1516,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1624
1516
|
};
|
|
1625
1517
|
var setGradient = (val, key, suffix) => {
|
|
1626
1518
|
const CONFIG2 = getActiveConfig();
|
|
1627
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1628
|
-
val = getColor(val.slice(2));
|
|
1519
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1629
1520
|
if (isArray(val)) {
|
|
1630
1521
|
return {
|
|
1631
1522
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1634,8 +1525,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1634
1525
|
}
|
|
1635
1526
|
if (isObject(val)) {
|
|
1636
1527
|
const obj = {};
|
|
1637
|
-
for (const variant in val)
|
|
1638
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1528
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1639
1529
|
return obj;
|
|
1640
1530
|
}
|
|
1641
1531
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1661,22 +1551,19 @@ var setThemeValue = (theme) => {
|
|
|
1661
1551
|
return value;
|
|
1662
1552
|
};
|
|
1663
1553
|
var getThemeValue = (theme) => {
|
|
1664
|
-
if (theme.value)
|
|
1665
|
-
return theme.value;
|
|
1554
|
+
if (theme.value) return theme.value;
|
|
1666
1555
|
theme.value = setThemeValue(theme);
|
|
1667
1556
|
return theme.value;
|
|
1668
1557
|
};
|
|
1669
1558
|
var getTheme = (value, modifier) => {
|
|
1670
1559
|
const CONFIG2 = getActiveConfig();
|
|
1671
|
-
if (CONFIG2.useVariable)
|
|
1672
|
-
return getMediaTheme(value, modifier);
|
|
1560
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1673
1561
|
const { THEME: THEME2 } = CONFIG2;
|
|
1674
1562
|
if (isString(value)) {
|
|
1675
1563
|
const [theme, subtheme] = value.split(" ");
|
|
1676
1564
|
const isOurTheme = THEME2[theme];
|
|
1677
1565
|
if (isOurTheme) {
|
|
1678
|
-
if (!subtheme && !modifier)
|
|
1679
|
-
return getThemeValue(isOurTheme);
|
|
1566
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1680
1567
|
value = [theme, subtheme || modifier];
|
|
1681
1568
|
}
|
|
1682
1569
|
}
|
|
@@ -1684,14 +1571,10 @@ var getTheme = (value, modifier) => {
|
|
|
1684
1571
|
const themeName = value[0];
|
|
1685
1572
|
const subThemeName = value[1];
|
|
1686
1573
|
const { helpers, media, state } = THEME2[themeName];
|
|
1687
|
-
if (media && media[subThemeName])
|
|
1688
|
-
|
|
1689
|
-
if (
|
|
1690
|
-
|
|
1691
|
-
if (state && state[subThemeName])
|
|
1692
|
-
return getThemeValue(state[subThemeName]);
|
|
1693
|
-
} else if (isObject(value))
|
|
1694
|
-
return setThemeValue(value);
|
|
1574
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1575
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1576
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1577
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1695
1578
|
};
|
|
1696
1579
|
var setInverseTheme = (theme, variant, value) => {
|
|
1697
1580
|
if (isObject(variant)) {
|
|
@@ -1709,13 +1592,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1709
1592
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1710
1593
|
const result = getTheme(variant);
|
|
1711
1594
|
themeValue[`&:${key}`] = result;
|
|
1712
|
-
if (isObject(variant) && !variant.value)
|
|
1713
|
-
variant.value = result;
|
|
1595
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1714
1596
|
};
|
|
1715
1597
|
var setSelectors = (theme, value) => {
|
|
1716
1598
|
const { state } = theme;
|
|
1717
|
-
if (!state)
|
|
1718
|
-
return;
|
|
1599
|
+
if (!state) return;
|
|
1719
1600
|
const keys = Object.keys(state);
|
|
1720
1601
|
keys.map((key) => {
|
|
1721
1602
|
const variant = state[key];
|
|
@@ -1727,20 +1608,16 @@ var setSelectors = (theme, value) => {
|
|
|
1727
1608
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1728
1609
|
const result = getTheme(variant);
|
|
1729
1610
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1730
|
-
if (isObject(variant) && !variant.value)
|
|
1731
|
-
variant.value = result;
|
|
1611
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1732
1612
|
};
|
|
1733
1613
|
var setMedia = (theme, value) => {
|
|
1734
1614
|
const { media } = theme;
|
|
1735
|
-
if (!media)
|
|
1736
|
-
return;
|
|
1615
|
+
if (!media) return;
|
|
1737
1616
|
const keys = Object.keys(media);
|
|
1738
1617
|
keys.map((key) => {
|
|
1739
1618
|
const variant = media[key];
|
|
1740
|
-
if (key === "dark" || key === "light")
|
|
1741
|
-
|
|
1742
|
-
if (key === "inverse")
|
|
1743
|
-
setInverseTheme(theme, variant, value);
|
|
1619
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1620
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1744
1621
|
return theme;
|
|
1745
1622
|
});
|
|
1746
1623
|
return theme;
|
|
@@ -1748,23 +1625,19 @@ var setMedia = (theme, value) => {
|
|
|
1748
1625
|
var setHelpers = (theme, value) => {
|
|
1749
1626
|
const CONFIG2 = getActiveConfig();
|
|
1750
1627
|
const { helpers } = theme;
|
|
1751
|
-
if (!helpers)
|
|
1752
|
-
return;
|
|
1628
|
+
if (!helpers) return;
|
|
1753
1629
|
const keys = Object.keys(helpers);
|
|
1754
1630
|
keys.map((key) => {
|
|
1755
1631
|
const helper = helpers[key];
|
|
1756
|
-
if (isString(helper))
|
|
1757
|
-
|
|
1758
|
-
else
|
|
1759
|
-
getThemeValue(helpers[key]);
|
|
1632
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1633
|
+
else getThemeValue(helpers[key]);
|
|
1760
1634
|
return theme;
|
|
1761
1635
|
});
|
|
1762
1636
|
return theme;
|
|
1763
1637
|
};
|
|
1764
1638
|
var setTheme = (val, key) => {
|
|
1765
1639
|
const CONFIG2 = getActiveConfig();
|
|
1766
|
-
if (CONFIG2.useVariable)
|
|
1767
|
-
return setMediaTheme(val, key);
|
|
1640
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1768
1641
|
const { state, media, helpers } = val;
|
|
1769
1642
|
const value = setThemeValue(val, key);
|
|
1770
1643
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1826,24 +1699,19 @@ var recursiveTheme = (val) => {
|
|
|
1826
1699
|
} else if (symb === ":") {
|
|
1827
1700
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1828
1701
|
}
|
|
1829
|
-
} else
|
|
1830
|
-
obj[param] = val[param];
|
|
1702
|
+
} else obj[param] = val[param];
|
|
1831
1703
|
}
|
|
1832
1704
|
return obj;
|
|
1833
1705
|
};
|
|
1834
1706
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1835
1707
|
const currentMod = modifierArray.shift();
|
|
1836
|
-
if (val[currentMod])
|
|
1837
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1708
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1838
1709
|
return val;
|
|
1839
1710
|
};
|
|
1840
1711
|
var findModifier = (val, modifier) => {
|
|
1841
|
-
if (isArray(modifier))
|
|
1842
|
-
|
|
1843
|
-
else
|
|
1844
|
-
return val[modifier];
|
|
1845
|
-
else
|
|
1846
|
-
return val;
|
|
1712
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1713
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1714
|
+
else return val;
|
|
1847
1715
|
};
|
|
1848
1716
|
var getMediaTheme = (value, modifier) => {
|
|
1849
1717
|
const activeConfig = getActiveConfig();
|
|
@@ -1866,11 +1734,10 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1866
1734
|
};
|
|
1867
1735
|
|
|
1868
1736
|
// src/system/font.js
|
|
1869
|
-
var import_utils11 = __toESM(
|
|
1737
|
+
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1870
1738
|
var setFont = (val, key) => {
|
|
1871
1739
|
const CSSvar = `--font-${key}`;
|
|
1872
|
-
if (!val || isArray(val) && !val[0])
|
|
1873
|
-
return;
|
|
1740
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1874
1741
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1875
1742
|
return { var: CSSvar, value: val, fontFace };
|
|
1876
1743
|
};
|
|
@@ -1883,10 +1750,8 @@ var setFontFamily = (val, key) => {
|
|
|
1883
1750
|
const CONFIG2 = getActiveConfig();
|
|
1884
1751
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1885
1752
|
let { value, type } = val;
|
|
1886
|
-
if (val.isDefault)
|
|
1887
|
-
|
|
1888
|
-
if (isObject(value))
|
|
1889
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1753
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1754
|
+
if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
|
|
1890
1755
|
const CSSvar = `--font-family-${key}`;
|
|
1891
1756
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1892
1757
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1899,8 +1764,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1899
1764
|
for (const prop in FACTORY2) {
|
|
1900
1765
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1901
1766
|
const mediaValue = FACTORY2[prop];
|
|
1902
|
-
if (!isPropMedia)
|
|
1903
|
-
continue;
|
|
1767
|
+
if (!isPropMedia) continue;
|
|
1904
1768
|
const { mediaRegenerate } = FACTORY2;
|
|
1905
1769
|
const mediaName = prop.slice(1);
|
|
1906
1770
|
const {
|
|
@@ -1978,13 +1842,12 @@ var getFontSizeByKey = (value) => {
|
|
|
1978
1842
|
};
|
|
1979
1843
|
|
|
1980
1844
|
// src/system/spacing.js
|
|
1981
|
-
var import_utils15 = __toESM(
|
|
1845
|
+
var import_utils15 = __toESM(require_cjs(), 1);
|
|
1982
1846
|
var runThroughMedia2 = (FACTORY2) => {
|
|
1983
1847
|
for (const prop in FACTORY2) {
|
|
1984
1848
|
const mediaProps = FACTORY2[prop];
|
|
1985
1849
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1986
|
-
if (!isMediaName)
|
|
1987
|
-
continue;
|
|
1850
|
+
if (!isMediaName) continue;
|
|
1988
1851
|
const {
|
|
1989
1852
|
type,
|
|
1990
1853
|
base,
|
|
@@ -2021,8 +1884,7 @@ var applySpacingSequence = () => {
|
|
|
2021
1884
|
var getSequence = (sequenceProps) => {
|
|
2022
1885
|
const CONFIG2 = getActiveConfig();
|
|
2023
1886
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
2024
|
-
if (!sequenceProps)
|
|
2025
|
-
return SPACING2;
|
|
1887
|
+
if (!sequenceProps) return SPACING2;
|
|
2026
1888
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
2027
1889
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
2028
1890
|
};
|
|
@@ -2032,8 +1894,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
2032
1894
|
return { [propertyName]: value };
|
|
2033
1895
|
}
|
|
2034
1896
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
2035
|
-
if (!isArray(stack))
|
|
2036
|
-
return;
|
|
1897
|
+
if (!isArray(stack)) return;
|
|
2037
1898
|
if (stack.length > 1) {
|
|
2038
1899
|
let suffix = "";
|
|
2039
1900
|
if (propertyName === "borderWidth") {
|
|
@@ -2112,15 +1973,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
2112
1973
|
if (isString(value) && value.includes(",")) {
|
|
2113
1974
|
value = value.split(",").map((v) => {
|
|
2114
1975
|
v = v.trim();
|
|
2115
|
-
if (v.startsWith("--"))
|
|
2116
|
-
|
|
2117
|
-
if (
|
|
2118
|
-
return getColor(v);
|
|
2119
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
2120
|
-
return v;
|
|
1976
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1977
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1978
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
2121
1979
|
const arr = v.split(" ");
|
|
2122
|
-
if (!arr.length)
|
|
2123
|
-
return v;
|
|
1980
|
+
if (!arr.length) return v;
|
|
2124
1981
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
2125
1982
|
}).join(" ");
|
|
2126
1983
|
}
|
|
@@ -2135,32 +1992,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
2135
1992
|
};
|
|
2136
1993
|
var getShadow = (value, globalTheme) => {
|
|
2137
1994
|
const CONFIG2 = getActiveConfig();
|
|
2138
|
-
if (!globalTheme)
|
|
2139
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1995
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
2140
1996
|
if (!isString(value)) {
|
|
2141
|
-
if (CONFIG2.verbose)
|
|
2142
|
-
console.warn(value, "- type for color is not valid");
|
|
1997
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
2143
1998
|
return;
|
|
2144
1999
|
}
|
|
2145
|
-
if (value.slice(0, 2) === "--")
|
|
2146
|
-
return `var(${value})`;
|
|
2000
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
2147
2001
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
2148
2002
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
2149
2003
|
const val = SHADOW2[name];
|
|
2150
2004
|
const isObj = isObject(val);
|
|
2151
2005
|
if (!val) {
|
|
2152
|
-
if (CONFIG2.verbose)
|
|
2153
|
-
console.warn("Can't find color ", name);
|
|
2006
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
2154
2007
|
return value;
|
|
2155
2008
|
}
|
|
2156
2009
|
if (globalTheme) {
|
|
2157
|
-
if (val[globalTheme])
|
|
2158
|
-
|
|
2159
|
-
else if (CONFIG2.verbose)
|
|
2160
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
2010
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
2011
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
2161
2012
|
}
|
|
2162
|
-
if (isObj && val.value)
|
|
2163
|
-
return val.value;
|
|
2013
|
+
if (isObj && val.value) return val.value;
|
|
2164
2014
|
if (isObj) {
|
|
2165
2015
|
const obj = {};
|
|
2166
2016
|
for (const mediaName in val) {
|
|
@@ -2170,13 +2020,12 @@ var getShadow = (value, globalTheme) => {
|
|
|
2170
2020
|
}
|
|
2171
2021
|
return obj;
|
|
2172
2022
|
}
|
|
2173
|
-
if (CONFIG2.verbose)
|
|
2174
|
-
console.warn("Can't find color", value);
|
|
2023
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
2175
2024
|
return value;
|
|
2176
2025
|
};
|
|
2177
2026
|
|
|
2178
2027
|
// src/system/timing.js
|
|
2179
|
-
var import_utils19 = __toESM(
|
|
2028
|
+
var import_utils19 = __toESM(require_cjs(), 1);
|
|
2180
2029
|
var applyTimingSequence = () => {
|
|
2181
2030
|
const CONFIG2 = getActiveConfig();
|
|
2182
2031
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -2211,15 +2060,13 @@ var applyDocument = () => {
|
|
|
2211
2060
|
};
|
|
2212
2061
|
|
|
2213
2062
|
// src/system/svg.js
|
|
2214
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
2215
2063
|
var DEF_OPTIONS = {
|
|
2216
|
-
document:
|
|
2064
|
+
document: document2
|
|
2217
2065
|
};
|
|
2218
2066
|
var setSVG = (val, key) => {
|
|
2219
2067
|
const CONFIG2 = getActiveConfig();
|
|
2220
2068
|
if (!val) {
|
|
2221
|
-
if (CONFIG2.verbose)
|
|
2222
|
-
console.warn("setSVG: val is not defined", key);
|
|
2069
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
2223
2070
|
return;
|
|
2224
2071
|
}
|
|
2225
2072
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -2230,8 +2077,7 @@ var setSVG = (val, key) => {
|
|
|
2230
2077
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2231
2078
|
const CONFIG2 = getActiveConfig();
|
|
2232
2079
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
2233
|
-
for (const key in LIBRARY)
|
|
2234
|
-
lib[key] = CONFIG2.SVG[key];
|
|
2080
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
2235
2081
|
appendSVG(lib, options);
|
|
2236
2082
|
};
|
|
2237
2083
|
var setSvgIcon = (val, key) => {
|
|
@@ -2245,14 +2091,12 @@ var setSvgIcon = (val, key) => {
|
|
|
2245
2091
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2246
2092
|
const CONFIG2 = getActiveConfig();
|
|
2247
2093
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
2248
|
-
for (const key in LIBRARY)
|
|
2249
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
2094
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
2250
2095
|
appendSVG(lib, options);
|
|
2251
2096
|
};
|
|
2252
2097
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
2253
|
-
if (!
|
|
2254
|
-
|
|
2255
|
-
const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2098
|
+
if (!document2 || !document2.createElementNS) return;
|
|
2099
|
+
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2256
2100
|
if (options.isRoot) {
|
|
2257
2101
|
svgElem.setAttribute("aria-hidden", "true");
|
|
2258
2102
|
svgElem.setAttribute("width", "0");
|
|
@@ -2264,7 +2108,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
|
2264
2108
|
};
|
|
2265
2109
|
var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
2266
2110
|
const CONFIG2 = getActiveConfig();
|
|
2267
|
-
const doc = options.document ||
|
|
2111
|
+
const doc = options.document || document2;
|
|
2268
2112
|
if (!doc || !doc.documentElement) {
|
|
2269
2113
|
if (CONFIG2.verbose) {
|
|
2270
2114
|
console.warn("To append SVG sprites it should be run in browser environment");
|
|
@@ -2307,8 +2151,7 @@ var applyReset = (reset = {}) => {
|
|
|
2307
2151
|
}
|
|
2308
2152
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
2309
2153
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
2310
|
-
if (RESET2.html)
|
|
2311
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
2154
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
2312
2155
|
return deepMerge(merge(RESET2, reset), {
|
|
2313
2156
|
html: {
|
|
2314
2157
|
position: "absolute",
|
|
@@ -2365,25 +2208,18 @@ var transformBorder = (border) => {
|
|
|
2365
2208
|
const arr = border.split(", ");
|
|
2366
2209
|
return arr.map((v) => {
|
|
2367
2210
|
v = v.trim();
|
|
2368
|
-
if (v.slice(0, 2) === "--")
|
|
2369
|
-
|
|
2370
|
-
else if (
|
|
2371
|
-
|
|
2372
|
-
else if (v.slice(-2) === "px" || v.slice(-2) === "em")
|
|
2373
|
-
return v;
|
|
2374
|
-
else if (getColor(v).length > 2)
|
|
2375
|
-
return getColor(v);
|
|
2211
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2212
|
+
else if (isBorderStyle(v)) return v || "solid";
|
|
2213
|
+
else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
|
|
2214
|
+
else if (getColor(v).length > 2) return getColor(v);
|
|
2376
2215
|
return getSpacingByKey(v, "border").border;
|
|
2377
2216
|
}).join(" ");
|
|
2378
2217
|
};
|
|
2379
2218
|
var transformTextStroke = (stroke) => {
|
|
2380
2219
|
return stroke.split(", ").map((v) => {
|
|
2381
|
-
if (v.slice(0, 2) === "--")
|
|
2382
|
-
|
|
2383
|
-
if (v
|
|
2384
|
-
return v;
|
|
2385
|
-
else if (getColor(v))
|
|
2386
|
-
return getColor(v);
|
|
2220
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2221
|
+
if (v.includes("px")) return v;
|
|
2222
|
+
else if (getColor(v)) return getColor(v);
|
|
2387
2223
|
return v;
|
|
2388
2224
|
}).join(" ");
|
|
2389
2225
|
};
|
|
@@ -2391,64 +2227,52 @@ var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
|
|
|
2391
2227
|
var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
|
|
2392
2228
|
return shadow.split(",").map((v) => {
|
|
2393
2229
|
v = v.trim();
|
|
2394
|
-
if (v.slice(0, 2) === "--")
|
|
2395
|
-
return `var(${v})`;
|
|
2230
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2396
2231
|
if (getColor(v).length > 2) {
|
|
2397
2232
|
const color = getMediaColor(v, globalTheme);
|
|
2398
|
-
if (isObject(color))
|
|
2399
|
-
return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
2233
|
+
if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
2400
2234
|
return color;
|
|
2401
2235
|
}
|
|
2402
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
2403
|
-
return v;
|
|
2236
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
2404
2237
|
const arr = v.split(" ");
|
|
2405
|
-
if (!arr.length)
|
|
2406
|
-
return v;
|
|
2238
|
+
if (!arr.length) return v;
|
|
2407
2239
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
2408
2240
|
}).join(" ");
|
|
2409
2241
|
}).join(",");
|
|
2410
2242
|
var transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
2411
2243
|
const CONFIG2 = getActiveConfig();
|
|
2412
2244
|
return backgroundImage.split(", ").map((v) => {
|
|
2413
|
-
if (v.slice(0, 2) === "--")
|
|
2414
|
-
|
|
2415
|
-
if (v.includes("url") || v.includes("gradient"))
|
|
2416
|
-
return v;
|
|
2245
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2246
|
+
if (v.includes("url") || v.includes("gradient")) return v;
|
|
2417
2247
|
else if (CONFIG2.GRADIENT[backgroundImage]) {
|
|
2418
2248
|
return {
|
|
2419
2249
|
backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
|
|
2420
2250
|
};
|
|
2421
|
-
} else if (v.includes("/") || v.startsWith("http") || v.includes("."))
|
|
2422
|
-
return `url(${v})`;
|
|
2251
|
+
} else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
|
|
2423
2252
|
return v;
|
|
2424
2253
|
}).join(" ");
|
|
2425
2254
|
};
|
|
2426
2255
|
var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
|
|
2427
2256
|
var transformTransition = (transition) => {
|
|
2428
2257
|
const arr = transition.split(" ");
|
|
2429
|
-
if (!arr.length)
|
|
2430
|
-
return transition;
|
|
2258
|
+
if (!arr.length) return transition;
|
|
2431
2259
|
return arr.map((v) => {
|
|
2432
|
-
if (v.slice(0, 2) === "--")
|
|
2433
|
-
return `var(${v})`;
|
|
2260
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2434
2261
|
if (v.length < 3 || v.includes("ms")) {
|
|
2435
2262
|
const mapWithSequence = getTimingByKey(v);
|
|
2436
2263
|
return mapWithSequence.timing || v;
|
|
2437
2264
|
}
|
|
2438
|
-
if (getTimingFunction(v))
|
|
2439
|
-
return getTimingFunction(v);
|
|
2265
|
+
if (getTimingFunction(v)) return getTimingFunction(v);
|
|
2440
2266
|
return v;
|
|
2441
2267
|
}).join(" ");
|
|
2442
2268
|
};
|
|
2443
2269
|
var transformDuration = (duration, props, propertyName) => {
|
|
2444
|
-
if (!isString(duration))
|
|
2445
|
-
return;
|
|
2270
|
+
if (!isString(duration)) return;
|
|
2446
2271
|
return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
|
|
2447
2272
|
};
|
|
2448
2273
|
var splitTransition = (transition) => {
|
|
2449
2274
|
const arr = transition.split(",");
|
|
2450
|
-
if (!arr.length)
|
|
2451
|
-
return;
|
|
2275
|
+
if (!arr.length) return;
|
|
2452
2276
|
return arr.map(transformTransition).join(",");
|
|
2453
2277
|
};
|
|
2454
2278
|
var checkIfBoxSize = (propertyName) => {
|
|
@@ -2457,16 +2281,14 @@ var checkIfBoxSize = (propertyName) => {
|
|
|
2457
2281
|
};
|
|
2458
2282
|
var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
2459
2283
|
let value = val || props[propertyName];
|
|
2460
|
-
if (isUndefined(value) && isNull(value))
|
|
2461
|
-
return;
|
|
2284
|
+
if (isUndefined(value) && isNull(value)) return;
|
|
2462
2285
|
const shouldScaleBoxSize = props.scaleBoxSize;
|
|
2463
2286
|
const isBoxSize = checkIfBoxSize(propertyName);
|
|
2464
2287
|
if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
|
|
2465
2288
|
value = value.split(" ").map((v) => {
|
|
2466
2289
|
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
2467
2290
|
const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
|
|
2468
|
-
if (isSingleLetter && !hasUnits)
|
|
2469
|
-
return v + "_default";
|
|
2291
|
+
if (isSingleLetter && !hasUnits) return v + "_default";
|
|
2470
2292
|
return v;
|
|
2471
2293
|
}).join(" ");
|
|
2472
2294
|
}
|
|
@@ -2476,16 +2298,21 @@ var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
|
2476
2298
|
return getSpacingByKey(value, propertyName);
|
|
2477
2299
|
}
|
|
2478
2300
|
};
|
|
2479
|
-
var transformSizeRatio = (propertyName, props) => {
|
|
2480
|
-
return transformSize(propertyName,
|
|
2301
|
+
var transformSizeRatio = (propertyName, val = null, props) => {
|
|
2302
|
+
return transformSize(propertyName, val, props, {
|
|
2481
2303
|
ratio: true
|
|
2482
2304
|
});
|
|
2483
2305
|
};
|
|
2306
|
+
var transformBorderRadius = (radius, props, propertyName) => {
|
|
2307
|
+
if (!isString(radius)) return;
|
|
2308
|
+
return {
|
|
2309
|
+
borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
|
|
2310
|
+
};
|
|
2311
|
+
};
|
|
2484
2312
|
|
|
2485
2313
|
// src/set.js
|
|
2486
2314
|
var setCases = (val, key) => {
|
|
2487
|
-
if (isFunction(val))
|
|
2488
|
-
return val();
|
|
2315
|
+
if (isFunction(val)) return val();
|
|
2489
2316
|
return val;
|
|
2490
2317
|
};
|
|
2491
2318
|
var setSameValue = (val, key) => val;
|
|
@@ -2521,12 +2348,10 @@ var setValue = (FACTORY_NAME, value, key) => {
|
|
|
2521
2348
|
FACTORY2[key] = result;
|
|
2522
2349
|
return FACTORY2;
|
|
2523
2350
|
} catch (error) {
|
|
2524
|
-
if (CONFIG2.verbose)
|
|
2525
|
-
console.warn("Error setting", factoryName, "value", value, key, error);
|
|
2351
|
+
if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
|
|
2526
2352
|
}
|
|
2527
2353
|
}
|
|
2528
|
-
if (CONFIG2.verbose)
|
|
2529
|
-
console.warn("Can not find", factoryName, "method in scratch");
|
|
2354
|
+
if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
|
|
2530
2355
|
};
|
|
2531
2356
|
var setEach = (factoryName, props) => {
|
|
2532
2357
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2555,38 +2380,23 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
2555
2380
|
if (options.newConfig) {
|
|
2556
2381
|
CONFIG2 = setActiveConfig(options.newConfig);
|
|
2557
2382
|
}
|
|
2558
|
-
if (verbose !== void 0)
|
|
2559
|
-
|
|
2560
|
-
if (
|
|
2561
|
-
|
|
2562
|
-
if (
|
|
2563
|
-
|
|
2564
|
-
if (
|
|
2565
|
-
|
|
2566
|
-
if (
|
|
2567
|
-
|
|
2568
|
-
if (
|
|
2569
|
-
|
|
2570
|
-
if (useDocumentTheme !== void 0)
|
|
2571
|
-
CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
2572
|
-
if (globalTheme !== void 0)
|
|
2573
|
-
CONFIG2.globalTheme = globalTheme;
|
|
2574
|
-
if (useDefaultConfig !== void 0)
|
|
2575
|
-
CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
2576
|
-
if (SEMANTIC_ICONS2 !== void 0)
|
|
2577
|
-
CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
2578
|
-
if (CONFIG2.verbose)
|
|
2579
|
-
console.log(CONFIG2);
|
|
2580
|
-
if (!CONFIG2.__svg_cache)
|
|
2581
|
-
CONFIG2.__svg_cache = {};
|
|
2383
|
+
if (verbose !== void 0) CONFIG2.verbose = verbose;
|
|
2384
|
+
if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
|
|
2385
|
+
if (useReset !== void 0) CONFIG2.useReset = useReset;
|
|
2386
|
+
if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
|
|
2387
|
+
if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
|
|
2388
|
+
if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
|
|
2389
|
+
if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
2390
|
+
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
2391
|
+
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
2392
|
+
if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
2393
|
+
if (CONFIG2.verbose) console.log(CONFIG2);
|
|
2394
|
+
if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
|
|
2582
2395
|
const keys = Object.keys(config);
|
|
2583
2396
|
keys.map((key) => setEach(key, config[key]));
|
|
2584
|
-
if (config.TYPOGRAPHY)
|
|
2585
|
-
|
|
2586
|
-
if (config.
|
|
2587
|
-
applySpacingSequence();
|
|
2588
|
-
if (config.TIMING)
|
|
2589
|
-
applyTimingSequence();
|
|
2397
|
+
if (config.TYPOGRAPHY) applyTypographySequence();
|
|
2398
|
+
if (config.SPACING) applySpacingSequence();
|
|
2399
|
+
if (config.TIMING) applyTimingSequence();
|
|
2590
2400
|
applyDocument();
|
|
2591
2401
|
applyReset();
|
|
2592
2402
|
return CONFIG2;
|