@symbo.ls/scratch 2.11.523 → 3.0.2
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 +106 -51
- package/dist/cjs/index.js +366 -423
- package/dist/cjs/set.js +304 -321
- package/dist/cjs/system/color.js +231 -181
- package/dist/cjs/system/document.js +198 -121
- package/dist/cjs/system/font.js +199 -127
- package/dist/cjs/system/index.js +308 -325
- package/dist/cjs/system/reset.js +205 -135
- package/dist/cjs/system/shadow.js +247 -212
- package/dist/cjs/system/spacing.js +215 -153
- package/dist/cjs/system/svg.js +203 -132
- package/dist/cjs/system/theme.js +243 -206
- package/dist/cjs/system/timing.js +206 -138
- package/dist/cjs/system/typography.js +212 -148
- package/dist/cjs/transforms/index.js +285 -268
- package/dist/cjs/utils/color.js +93 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +236 -193
- package/dist/cjs/utils/sequence.js +206 -99
- package/dist/cjs/utils/sprite.js +106 -51
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +196 -83
- package/package.json +4 -4
- 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/index.js
CHANGED
|
@@ -30,65 +30,29 @@ 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
|
-
var
|
|
37
|
+
var __defProp2 = Object.defineProperty;
|
|
74
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
75
39
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
76
|
-
var
|
|
40
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
77
41
|
var __export2 = (target, all) => {
|
|
78
42
|
for (var name in all)
|
|
79
|
-
|
|
43
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
80
44
|
};
|
|
81
45
|
var __copyProps2 = (to, from, except, desc) => {
|
|
82
46
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
83
47
|
for (let key of __getOwnPropNames2(from))
|
|
84
|
-
if (!
|
|
85
|
-
|
|
48
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
49
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
86
50
|
}
|
|
87
51
|
return to;
|
|
88
52
|
};
|
|
89
|
-
var __toCommonJS2 = (mod) => __copyProps2(
|
|
90
|
-
var
|
|
91
|
-
__export2(
|
|
53
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var index_exports2 = {};
|
|
55
|
+
__export2(index_exports2, {
|
|
92
56
|
arrayzeValue: () => arrayzeValue3,
|
|
93
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
94
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -109,17 +73,85 @@ 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";
|
|
121
84
|
var isNumber2 = (arg) => typeof arg === "number";
|
|
122
85
|
var isArray2 = (arg) => Array.isArray(arg);
|
|
86
|
+
var STATE_METHODS2 = [
|
|
87
|
+
"update",
|
|
88
|
+
"parse",
|
|
89
|
+
"clean",
|
|
90
|
+
"create",
|
|
91
|
+
"destroy",
|
|
92
|
+
"add",
|
|
93
|
+
"toggle",
|
|
94
|
+
"remove",
|
|
95
|
+
"apply",
|
|
96
|
+
"set",
|
|
97
|
+
"reset",
|
|
98
|
+
"replace",
|
|
99
|
+
"quietReplace",
|
|
100
|
+
"quietUpdate",
|
|
101
|
+
"applyReplace",
|
|
102
|
+
"applyFunction",
|
|
103
|
+
"keys",
|
|
104
|
+
"values",
|
|
105
|
+
"ref",
|
|
106
|
+
"rootUpdate",
|
|
107
|
+
"parentUpdate",
|
|
108
|
+
"parent",
|
|
109
|
+
"__element",
|
|
110
|
+
"__depends",
|
|
111
|
+
"__ref",
|
|
112
|
+
"__children",
|
|
113
|
+
"root",
|
|
114
|
+
"setByPath",
|
|
115
|
+
"setPathCollection",
|
|
116
|
+
"removeByPath",
|
|
117
|
+
"removePathCollection",
|
|
118
|
+
"getByPath"
|
|
119
|
+
];
|
|
120
|
+
var PROPS_METHODS2 = ["update", "__element"];
|
|
121
|
+
var METHODS2 = [
|
|
122
|
+
"set",
|
|
123
|
+
"reset",
|
|
124
|
+
"update",
|
|
125
|
+
"remove",
|
|
126
|
+
"updateContent",
|
|
127
|
+
"removeContent",
|
|
128
|
+
"lookup",
|
|
129
|
+
"lookdown",
|
|
130
|
+
"lookdownAll",
|
|
131
|
+
"getRef",
|
|
132
|
+
"getPath",
|
|
133
|
+
"setNodeStyles",
|
|
134
|
+
"spotByPath",
|
|
135
|
+
"keys",
|
|
136
|
+
"parse",
|
|
137
|
+
"setProps",
|
|
138
|
+
"parseDeep",
|
|
139
|
+
"variables",
|
|
140
|
+
"if",
|
|
141
|
+
"log",
|
|
142
|
+
"verbose",
|
|
143
|
+
"warn",
|
|
144
|
+
"error",
|
|
145
|
+
"call",
|
|
146
|
+
"nextElement",
|
|
147
|
+
"previousElement"
|
|
148
|
+
];
|
|
149
|
+
var METHODS_EXL2 = [
|
|
150
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
151
|
+
...METHODS2,
|
|
152
|
+
...STATE_METHODS2,
|
|
153
|
+
...PROPS_METHODS2
|
|
154
|
+
];
|
|
123
155
|
var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
124
156
|
async function toggleFullscreen(opts) {
|
|
125
157
|
if (!document.fullscreenElement) {
|
|
@@ -139,13 +171,11 @@ var require_cjs2 = __commonJS({
|
|
|
139
171
|
};
|
|
140
172
|
var findClosestNumberInFactory = (val, factory) => {
|
|
141
173
|
val = parseFloat(val);
|
|
142
|
-
if (isObject2(factory))
|
|
143
|
-
factory = Object.values(factory);
|
|
174
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
144
175
|
return findClosestNumber(val, factory);
|
|
145
176
|
};
|
|
146
177
|
var formatDate = (timestamp) => {
|
|
147
|
-
if (!timestamp)
|
|
148
|
-
return "";
|
|
178
|
+
if (!timestamp) return "";
|
|
149
179
|
const d = new Date(timestamp);
|
|
150
180
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
151
181
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -212,8 +242,7 @@ var require_cjs2 = __commonJS({
|
|
|
212
242
|
scriptEle.type = type;
|
|
213
243
|
scriptEle.text = xhr.responseText;
|
|
214
244
|
doc.body.appendChild(scriptEle);
|
|
215
|
-
if (typeof fallback === "function")
|
|
216
|
-
fallback();
|
|
245
|
+
if (typeof fallback === "function") fallback();
|
|
217
246
|
} else {
|
|
218
247
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
219
248
|
}
|
|
@@ -281,27 +310,22 @@ var require_cjs2 = __commonJS({
|
|
|
281
310
|
);
|
|
282
311
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
283
312
|
var toDescriptionCase = (str = "") => {
|
|
284
|
-
if (typeof str !== "string")
|
|
285
|
-
return;
|
|
313
|
+
if (typeof str !== "string") return;
|
|
286
314
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
287
315
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
288
316
|
};
|
|
289
317
|
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];
|
|
318
|
+
if (isArray2(val)) return val;
|
|
319
|
+
if (isString2(val)) return val.split(" ");
|
|
320
|
+
if (isObject2(val)) return Object.values(val);
|
|
321
|
+
if (isNumber2(val)) return [val];
|
|
298
322
|
};
|
|
299
323
|
}
|
|
300
324
|
});
|
|
301
325
|
|
|
302
326
|
// src/index.js
|
|
303
|
-
var
|
|
304
|
-
__export(
|
|
327
|
+
var index_exports = {};
|
|
328
|
+
__export(index_exports, {
|
|
305
329
|
ANIMATION: () => ANIMATION,
|
|
306
330
|
BREAKPOINTS: () => BREAKPOINTS,
|
|
307
331
|
CASES: () => CASES,
|
|
@@ -418,6 +442,7 @@ __export(src_exports, {
|
|
|
418
442
|
splitTransition: () => splitTransition,
|
|
419
443
|
transformBackgroundImage: () => transformBackgroundImage,
|
|
420
444
|
transformBorder: () => transformBorder,
|
|
445
|
+
transformBorderRadius: () => transformBorderRadius,
|
|
421
446
|
transformBoxShadow: () => transformBoxShadow,
|
|
422
447
|
transformDuration: () => transformDuration,
|
|
423
448
|
transformShadow: () => transformShadow,
|
|
@@ -427,7 +452,7 @@ __export(src_exports, {
|
|
|
427
452
|
transformTransition: () => transformTransition,
|
|
428
453
|
transfromGap: () => transfromGap
|
|
429
454
|
});
|
|
430
|
-
module.exports = __toCommonJS(
|
|
455
|
+
module.exports = __toCommonJS(index_exports);
|
|
431
456
|
|
|
432
457
|
// src/utils/index.js
|
|
433
458
|
var utils_exports = {};
|
|
@@ -483,22 +508,18 @@ var isScalingUnit = (unit) => {
|
|
|
483
508
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
484
509
|
};
|
|
485
510
|
|
|
486
|
-
//
|
|
487
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
488
|
-
|
|
489
|
-
// ../../node_modules/@domql/utils/dist/esm/globals.js
|
|
511
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
490
512
|
var window2 = globalThis;
|
|
491
513
|
var document2 = window2.document;
|
|
492
514
|
|
|
493
|
-
// ../../node_modules/@domql/utils/
|
|
515
|
+
// ../../node_modules/@domql/utils/node.js
|
|
494
516
|
var isDOMNode = (obj) => {
|
|
495
517
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
496
518
|
};
|
|
497
519
|
|
|
498
|
-
// ../../node_modules/@domql/utils/
|
|
520
|
+
// ../../node_modules/@domql/utils/types.js
|
|
499
521
|
var isObject = (arg) => {
|
|
500
|
-
if (arg === null)
|
|
501
|
-
return false;
|
|
522
|
+
if (arg === null) return false;
|
|
502
523
|
return typeof arg === "object" && arg.constructor === Object;
|
|
503
524
|
};
|
|
504
525
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -509,8 +530,7 @@ var isNull = (arg) => arg === null;
|
|
|
509
530
|
var isArray = (arg) => Array.isArray(arg);
|
|
510
531
|
var isDate = (d) => d instanceof Date;
|
|
511
532
|
var isObjectLike = (arg) => {
|
|
512
|
-
if (arg === null)
|
|
513
|
-
return false;
|
|
533
|
+
if (arg === null) return false;
|
|
514
534
|
return typeof arg === "object";
|
|
515
535
|
};
|
|
516
536
|
var isDefined = (arg) => {
|
|
@@ -520,36 +540,92 @@ var isUndefined = (arg) => {
|
|
|
520
540
|
return arg === void 0;
|
|
521
541
|
};
|
|
522
542
|
|
|
523
|
-
// ../../node_modules/@domql/utils/
|
|
524
|
-
var
|
|
525
|
-
return arr.reduce(
|
|
543
|
+
// ../../node_modules/@domql/utils/array.js
|
|
544
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
545
|
+
return arr.reduce(
|
|
546
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
547
|
+
{}
|
|
548
|
+
);
|
|
526
549
|
};
|
|
527
550
|
|
|
528
|
-
// ../../node_modules/@domql/utils/
|
|
529
|
-
var
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
551
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
552
|
+
var STATE_METHODS = [
|
|
553
|
+
"update",
|
|
554
|
+
"parse",
|
|
555
|
+
"clean",
|
|
556
|
+
"create",
|
|
557
|
+
"destroy",
|
|
558
|
+
"add",
|
|
559
|
+
"toggle",
|
|
560
|
+
"remove",
|
|
561
|
+
"apply",
|
|
562
|
+
"set",
|
|
563
|
+
"reset",
|
|
564
|
+
"replace",
|
|
565
|
+
"quietReplace",
|
|
566
|
+
"quietUpdate",
|
|
567
|
+
"applyReplace",
|
|
568
|
+
"applyFunction",
|
|
569
|
+
"keys",
|
|
570
|
+
"values",
|
|
571
|
+
"ref",
|
|
572
|
+
"rootUpdate",
|
|
573
|
+
"parentUpdate",
|
|
574
|
+
"parent",
|
|
575
|
+
"__element",
|
|
576
|
+
"__depends",
|
|
577
|
+
"__ref",
|
|
578
|
+
"__children",
|
|
579
|
+
"root",
|
|
580
|
+
"setByPath",
|
|
581
|
+
"setPathCollection",
|
|
582
|
+
"removeByPath",
|
|
583
|
+
"removePathCollection",
|
|
584
|
+
"getByPath"
|
|
585
|
+
];
|
|
586
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
587
|
+
var METHODS = [
|
|
588
|
+
"set",
|
|
589
|
+
"reset",
|
|
590
|
+
"update",
|
|
591
|
+
"remove",
|
|
592
|
+
"updateContent",
|
|
593
|
+
"removeContent",
|
|
594
|
+
"lookup",
|
|
595
|
+
"lookdown",
|
|
596
|
+
"lookdownAll",
|
|
597
|
+
"getRef",
|
|
598
|
+
"getPath",
|
|
599
|
+
"setNodeStyles",
|
|
600
|
+
"spotByPath",
|
|
601
|
+
"keys",
|
|
602
|
+
"parse",
|
|
603
|
+
"setProps",
|
|
604
|
+
"parseDeep",
|
|
605
|
+
"variables",
|
|
606
|
+
"if",
|
|
607
|
+
"log",
|
|
608
|
+
"verbose",
|
|
609
|
+
"warn",
|
|
610
|
+
"error",
|
|
611
|
+
"call",
|
|
612
|
+
"nextElement",
|
|
613
|
+
"previousElement"
|
|
614
|
+
];
|
|
615
|
+
var METHODS_EXL = [
|
|
616
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
617
|
+
...METHODS,
|
|
618
|
+
...STATE_METHODS,
|
|
619
|
+
...PROPS_METHODS
|
|
620
|
+
];
|
|
621
|
+
|
|
622
|
+
// ../../node_modules/@domql/utils/object.js
|
|
548
623
|
var merge = (element, obj, excludeFrom = []) => {
|
|
549
624
|
for (const e in obj) {
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
625
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
626
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
552
627
|
continue;
|
|
628
|
+
}
|
|
553
629
|
const elementProp = element[e];
|
|
554
630
|
const objProp = obj[e];
|
|
555
631
|
if (elementProp === void 0) {
|
|
@@ -558,11 +634,12 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
558
634
|
}
|
|
559
635
|
return element;
|
|
560
636
|
};
|
|
561
|
-
var deepMerge = (element, extend, excludeFrom =
|
|
637
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
562
638
|
for (const e in extend) {
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
639
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
640
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
565
641
|
continue;
|
|
642
|
+
}
|
|
566
643
|
const elementProp = element[e];
|
|
567
644
|
const extendProp = extend[e];
|
|
568
645
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -580,7 +657,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
580
657
|
cleanNull = false,
|
|
581
658
|
window: targetWindow,
|
|
582
659
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
583
|
-
|
|
660
|
+
handleExtends = false
|
|
584
661
|
} = options;
|
|
585
662
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
586
663
|
return obj;
|
|
@@ -588,37 +665,39 @@ var deepClone = (obj, options = {}) => {
|
|
|
588
665
|
if (visited.has(obj)) {
|
|
589
666
|
return visited.get(obj);
|
|
590
667
|
}
|
|
591
|
-
const
|
|
592
|
-
visited.set(obj,
|
|
668
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
669
|
+
visited.set(obj, clone);
|
|
593
670
|
for (const key in obj) {
|
|
594
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
595
|
-
|
|
596
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
671
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
672
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
597
673
|
continue;
|
|
674
|
+
}
|
|
598
675
|
const value = obj[key];
|
|
599
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
676
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
600
677
|
continue;
|
|
678
|
+
}
|
|
601
679
|
if (isDOMNode(value)) {
|
|
602
|
-
|
|
680
|
+
clone[key] = value;
|
|
603
681
|
continue;
|
|
604
682
|
}
|
|
605
|
-
if (
|
|
606
|
-
|
|
683
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
684
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
607
685
|
continue;
|
|
608
686
|
}
|
|
609
687
|
if (isFunction(value) && targetWindow) {
|
|
610
|
-
|
|
688
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
611
689
|
continue;
|
|
612
690
|
}
|
|
613
691
|
if (isObjectLike(value)) {
|
|
614
|
-
|
|
692
|
+
clone[key] = deepClone(value, {
|
|
693
|
+
...options,
|
|
615
694
|
visited
|
|
616
|
-
})
|
|
695
|
+
});
|
|
617
696
|
} else {
|
|
618
|
-
|
|
697
|
+
clone[key] = value;
|
|
619
698
|
}
|
|
620
699
|
}
|
|
621
|
-
return
|
|
700
|
+
return clone;
|
|
622
701
|
};
|
|
623
702
|
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
624
703
|
const excl = opts.exclude || [];
|
|
@@ -626,14 +705,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
626
705
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
627
706
|
return params;
|
|
628
707
|
}
|
|
629
|
-
if (visited.has(obj))
|
|
630
|
-
return visited.get(obj);
|
|
708
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
631
709
|
visited.set(obj, obj);
|
|
632
710
|
for (const e in params) {
|
|
633
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
634
|
-
|
|
635
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
636
|
-
continue;
|
|
711
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
712
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
637
713
|
const objProp = obj[e];
|
|
638
714
|
const paramsProp = params[e];
|
|
639
715
|
if (isDOMNode(paramsProp)) {
|
|
@@ -647,16 +723,14 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
647
723
|
return obj;
|
|
648
724
|
};
|
|
649
725
|
|
|
650
|
-
// ../../node_modules/@domql/utils/
|
|
726
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
651
727
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
652
728
|
|
|
653
729
|
// src/utils/color.js
|
|
654
730
|
var ENV = "development";
|
|
655
731
|
var colorStringToRgbaArray = (color) => {
|
|
656
|
-
if (color === "")
|
|
657
|
-
|
|
658
|
-
if (color.toLowerCase() === "transparent")
|
|
659
|
-
return [0, 0, 0, 0];
|
|
732
|
+
if (color === "") return [0, 0, 0, 0];
|
|
733
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
660
734
|
if (color[0] === "#") {
|
|
661
735
|
if (color.length < 7) {
|
|
662
736
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -669,26 +743,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
669
743
|
];
|
|
670
744
|
}
|
|
671
745
|
if (color.indexOf("rgb") === -1) {
|
|
672
|
-
if (
|
|
673
|
-
const elem =
|
|
746
|
+
if (document2 && window2) {
|
|
747
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
674
748
|
const flag = "rgb(1, 2, 3)";
|
|
675
749
|
elem.style.color = flag;
|
|
676
750
|
if (elem.style.color !== flag) {
|
|
677
|
-
|
|
751
|
+
document2.body.removeChild(elem);
|
|
678
752
|
return;
|
|
679
753
|
}
|
|
680
754
|
elem.style.color = color;
|
|
681
755
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
682
|
-
|
|
756
|
+
document2.body.removeChild(elem);
|
|
683
757
|
return [0, 0, 0, 0];
|
|
684
758
|
}
|
|
685
|
-
color =
|
|
686
|
-
|
|
759
|
+
color = window2.getComputedStyle(elem).color;
|
|
760
|
+
document2.body.removeChild(elem);
|
|
687
761
|
}
|
|
688
762
|
}
|
|
689
763
|
if (color.indexOf("rgb") === 0) {
|
|
690
|
-
if (color.indexOf("rgba") === -1)
|
|
691
|
-
color = `${color}, 1`;
|
|
764
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
692
765
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
693
766
|
}
|
|
694
767
|
return [0, 0, 0, 0];
|
|
@@ -745,20 +818,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
745
818
|
var getColorShade = (col, amt) => {
|
|
746
819
|
const num = parseInt(col, 16);
|
|
747
820
|
let r = (num >> 16) + amt;
|
|
748
|
-
if (r > 255)
|
|
749
|
-
|
|
750
|
-
else if (r < 0)
|
|
751
|
-
r = 0;
|
|
821
|
+
if (r > 255) r = 255;
|
|
822
|
+
else if (r < 0) r = 0;
|
|
752
823
|
let b = (num >> 8 & 255) + amt;
|
|
753
|
-
if (b > 255)
|
|
754
|
-
|
|
755
|
-
else if (b < 0)
|
|
756
|
-
b = 0;
|
|
824
|
+
if (b > 255) b = 255;
|
|
825
|
+
else if (b < 0) b = 0;
|
|
757
826
|
let g = (num & 255) + amt;
|
|
758
|
-
if (g > 255)
|
|
759
|
-
|
|
760
|
-
else if (g < 0)
|
|
761
|
-
g = 0;
|
|
827
|
+
if (g > 255) g = 255;
|
|
828
|
+
else if (g < 0) g = 0;
|
|
762
829
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
763
830
|
};
|
|
764
831
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -774,20 +841,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
774
841
|
var opacify = (color, opacity) => {
|
|
775
842
|
const arr = colorStringToRgbaArray(color);
|
|
776
843
|
if (!arr) {
|
|
777
|
-
if (ENV === "test" || ENV === "development")
|
|
778
|
-
console.warn(color + " color is not rgba");
|
|
844
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
779
845
|
return;
|
|
780
846
|
}
|
|
781
847
|
arr[3] = opacity;
|
|
782
848
|
return `rgba(${arr})`;
|
|
783
849
|
};
|
|
784
850
|
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 += "";
|
|
851
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
852
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
853
|
+
if (isNumber(tone)) tone += "";
|
|
791
854
|
const toHex = rgbArrayToHex(rgb);
|
|
792
855
|
const abs = tone.slice(0, 1);
|
|
793
856
|
if (abs === "-" || abs === "+") {
|
|
@@ -804,21 +867,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
804
867
|
|
|
805
868
|
// src/utils/theme.js
|
|
806
869
|
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]];
|
|
870
|
+
if (!orig) return;
|
|
871
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
872
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
813
873
|
return orig;
|
|
814
874
|
};
|
|
815
875
|
|
|
816
876
|
// src/utils/font.js
|
|
817
877
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
818
|
-
if (LIBRARY[key])
|
|
819
|
-
|
|
820
|
-
if (LIBRARY.default)
|
|
821
|
-
return LIBRARY[LIBRARY.default].value;
|
|
878
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
879
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
822
880
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
823
881
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
824
882
|
};
|
|
@@ -845,8 +903,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
845
903
|
};
|
|
846
904
|
var getFontFaceEachString = (name, weights) => {
|
|
847
905
|
const isArr = weights[0];
|
|
848
|
-
if (isArr)
|
|
849
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
906
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
850
907
|
return setCustomFontMedia(name, weights.url);
|
|
851
908
|
};
|
|
852
909
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -855,7 +912,7 @@ var getFontFaceString = (LIBRARY) => {
|
|
|
855
912
|
};
|
|
856
913
|
|
|
857
914
|
// src/utils/sequence.js
|
|
858
|
-
var
|
|
915
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
859
916
|
|
|
860
917
|
// src/defaultConfig/index.js
|
|
861
918
|
var defaultConfig_exports = {};
|
|
@@ -1084,8 +1141,7 @@ var getActiveConfig = (def) => {
|
|
|
1084
1141
|
return FACTORY[def || FACTORY.active] || CONFIG;
|
|
1085
1142
|
};
|
|
1086
1143
|
var setActiveConfig = (newConfig) => {
|
|
1087
|
-
if (!isObject(newConfig))
|
|
1088
|
-
return;
|
|
1144
|
+
if (!isObject(newConfig)) return;
|
|
1089
1145
|
FACTORY.active = "1";
|
|
1090
1146
|
FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
|
|
1091
1147
|
return newConfig;
|
|
@@ -1137,8 +1193,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
1137
1193
|
var setScalingVar = (key, sequenceProps) => {
|
|
1138
1194
|
const { base, type, unit } = sequenceProps;
|
|
1139
1195
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
1140
|
-
if (key === 0)
|
|
1141
|
-
return defaultVal;
|
|
1196
|
+
if (key === 0) return defaultVal;
|
|
1142
1197
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1143
1198
|
const ratioVar = `${prefix}-ratio`;
|
|
1144
1199
|
if (key > 0) {
|
|
@@ -1175,10 +1230,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
1175
1230
|
const diffRounded = ~~next - ~~value;
|
|
1176
1231
|
let arr;
|
|
1177
1232
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
1178
|
-
if (diffRounded > 16)
|
|
1179
|
-
|
|
1180
|
-
else
|
|
1181
|
-
arr = [first, second];
|
|
1233
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
1234
|
+
else arr = [first, second];
|
|
1182
1235
|
arr.forEach((v, k) => {
|
|
1183
1236
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1184
1237
|
const newVar = variable + (k + 1);
|
|
@@ -1220,14 +1273,13 @@ var generateSequence = (sequenceProps) => {
|
|
|
1220
1273
|
index: key
|
|
1221
1274
|
};
|
|
1222
1275
|
setSequenceValue(props, sequenceProps);
|
|
1223
|
-
if (subSequence)
|
|
1224
|
-
generateSubSequence(props, sequenceProps);
|
|
1276
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
1225
1277
|
}
|
|
1226
1278
|
return sequenceProps;
|
|
1227
1279
|
};
|
|
1228
1280
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
1229
1281
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
1230
|
-
const letterKey = isString
|
|
1282
|
+
const letterKey = (void 0).call("isString", position) ? position : numToLetterMap[position];
|
|
1231
1283
|
if (!letterKey) {
|
|
1232
1284
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
1233
1285
|
return null;
|
|
@@ -1267,13 +1319,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1267
1319
|
unit = UNIT2.default,
|
|
1268
1320
|
useVariable
|
|
1269
1321
|
} = sequenceProps;
|
|
1270
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1271
|
-
|
|
1272
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1322
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1323
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1273
1324
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1274
1325
|
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;
|
|
1326
|
+
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
1327
|
const letterVal = value.toUpperCase();
|
|
1278
1328
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1279
1329
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1297,8 +1347,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1297
1347
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1298
1348
|
}
|
|
1299
1349
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1300
|
-
if (CONFIG2.verbose)
|
|
1301
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1350
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1302
1351
|
absValue = absValue.slice(0, 1);
|
|
1303
1352
|
}
|
|
1304
1353
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1306,8 +1355,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1306
1355
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1307
1356
|
}
|
|
1308
1357
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1309
|
-
if (!sequenceItem)
|
|
1310
|
-
return console.warn("can't find", sequence, absValue);
|
|
1358
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1311
1359
|
if (unit === "ms" || unit === "s") {
|
|
1312
1360
|
return isNegative + sequenceItem.val + unit;
|
|
1313
1361
|
}
|
|
@@ -1316,12 +1364,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1316
1364
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1317
1365
|
if (typeof value !== "string") {
|
|
1318
1366
|
const CONFIG2 = getActiveConfig();
|
|
1319
|
-
if (CONFIG2.verbose)
|
|
1320
|
-
console.warn(propertyName, value, "is not a string");
|
|
1367
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1321
1368
|
return { [propertyName]: value };
|
|
1322
1369
|
}
|
|
1323
|
-
if (value === "-" || value === "")
|
|
1324
|
-
return {};
|
|
1370
|
+
if (value === "-" || value === "") return {};
|
|
1325
1371
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1326
1372
|
};
|
|
1327
1373
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1389,23 +1435,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1389
1435
|
const { mediaRegenerate } = FACTORY2;
|
|
1390
1436
|
const { sequence, scales } = FACTORY2[media];
|
|
1391
1437
|
const query = MEDIA2[mediaName];
|
|
1392
|
-
if (!query && CONFIG2.verbose)
|
|
1393
|
-
console.warn("Can't find media query ", query);
|
|
1438
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1394
1439
|
if (!mediaRegenerate) {
|
|
1395
1440
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1396
|
-
if (!underMediaQuery)
|
|
1397
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1441
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1398
1442
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1399
1443
|
return;
|
|
1400
1444
|
}
|
|
1401
1445
|
for (const key in sequence) {
|
|
1402
1446
|
const item = sequence[key];
|
|
1403
1447
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1404
|
-
if (!query && CONFIG2.verbose)
|
|
1405
|
-
console.warn("Can't find query ", query);
|
|
1448
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1406
1449
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1407
|
-
if (!underMediaQuery)
|
|
1408
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1450
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1409
1451
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1410
1452
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1411
1453
|
}
|
|
@@ -1416,10 +1458,8 @@ var generateSprite = (icons) => {
|
|
|
1416
1458
|
const CONFIG2 = getActiveConfig();
|
|
1417
1459
|
let sprite = "";
|
|
1418
1460
|
for (const key in icons) {
|
|
1419
|
-
if (CONFIG2.__svg_cache[key])
|
|
1420
|
-
|
|
1421
|
-
else
|
|
1422
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1461
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1462
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1423
1463
|
sprite += icons[key];
|
|
1424
1464
|
}
|
|
1425
1465
|
return sprite;
|
|
@@ -1508,27 +1548,21 @@ __export(system_exports, {
|
|
|
1508
1548
|
var getColor = (value, key, config) => {
|
|
1509
1549
|
const CONFIG2 = config || getActiveConfig();
|
|
1510
1550
|
if (!isString(value)) {
|
|
1511
|
-
if (CONFIG2.verbose)
|
|
1512
|
-
console.warn(value, "- type for color is not valid");
|
|
1551
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1513
1552
|
return;
|
|
1514
1553
|
}
|
|
1515
|
-
if (value.slice(0, 2) === "--")
|
|
1516
|
-
|
|
1517
|
-
if (key && value[key])
|
|
1518
|
-
value = value[key];
|
|
1554
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1555
|
+
if (key && value[key]) value = value[key];
|
|
1519
1556
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1520
1557
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1521
1558
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1522
1559
|
if (!val) {
|
|
1523
|
-
if (CONFIG2.verbose)
|
|
1524
|
-
console.warn("Can't find color ", name);
|
|
1560
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1525
1561
|
return value;
|
|
1526
1562
|
}
|
|
1527
1563
|
if (key) {
|
|
1528
|
-
if (val[key])
|
|
1529
|
-
|
|
1530
|
-
else if (CONFIG2.verbose)
|
|
1531
|
-
console.warn(value, " - does not have ", key);
|
|
1564
|
+
if (val[key]) val = val[key];
|
|
1565
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1532
1566
|
}
|
|
1533
1567
|
let rgb = val.rgb;
|
|
1534
1568
|
if (!rgb) {
|
|
@@ -1538,32 +1572,25 @@ var getColor = (value, key, config) => {
|
|
|
1538
1572
|
rgb = getRgbTone(rgb, tone);
|
|
1539
1573
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1540
1574
|
}
|
|
1541
|
-
if (val[tone])
|
|
1542
|
-
|
|
1543
|
-
if (alpha)
|
|
1544
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1575
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1576
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1545
1577
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1546
1578
|
};
|
|
1547
1579
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1548
1580
|
const CONFIG2 = config || getActiveConfig();
|
|
1549
|
-
if (!globalTheme)
|
|
1550
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1581
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1551
1582
|
if (!isString(value)) {
|
|
1552
|
-
if (CONFIG2.verbose)
|
|
1553
|
-
console.warn(value, "- type for color is not valid");
|
|
1583
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1554
1584
|
return;
|
|
1555
1585
|
}
|
|
1556
|
-
if (value.slice(0, 2) === "--")
|
|
1557
|
-
return `var(${value})`;
|
|
1586
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1558
1587
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1559
1588
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1560
1589
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1561
1590
|
const isObj = isObject(val);
|
|
1562
|
-
if (isObj && val.value)
|
|
1563
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1591
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1564
1592
|
else if (isObj) {
|
|
1565
|
-
if (globalTheme)
|
|
1566
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1593
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1567
1594
|
else {
|
|
1568
1595
|
const obj = {};
|
|
1569
1596
|
for (const mediaName in val) {
|
|
@@ -1574,8 +1601,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1574
1601
|
return obj;
|
|
1575
1602
|
}
|
|
1576
1603
|
} else {
|
|
1577
|
-
if (CONFIG2.verbose)
|
|
1578
|
-
console.warn("Can't find color", value);
|
|
1604
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1579
1605
|
return value;
|
|
1580
1606
|
}
|
|
1581
1607
|
};
|
|
@@ -1584,8 +1610,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1584
1610
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1585
1611
|
val = getColor(val.slice(2));
|
|
1586
1612
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1587
|
-
if (CONFIG2.verbose)
|
|
1588
|
-
console.warn(val, "- referred but does not exist");
|
|
1613
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1589
1614
|
val = val.split(" ")[0];
|
|
1590
1615
|
}
|
|
1591
1616
|
}
|
|
@@ -1624,8 +1649,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1624
1649
|
};
|
|
1625
1650
|
var setGradient = (val, key, suffix) => {
|
|
1626
1651
|
const CONFIG2 = getActiveConfig();
|
|
1627
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1628
|
-
val = getColor(val.slice(2));
|
|
1652
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1629
1653
|
if (isArray(val)) {
|
|
1630
1654
|
return {
|
|
1631
1655
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1634,8 +1658,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1634
1658
|
}
|
|
1635
1659
|
if (isObject(val)) {
|
|
1636
1660
|
const obj = {};
|
|
1637
|
-
for (const variant in val)
|
|
1638
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1661
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1639
1662
|
return obj;
|
|
1640
1663
|
}
|
|
1641
1664
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1661,22 +1684,19 @@ var setThemeValue = (theme) => {
|
|
|
1661
1684
|
return value;
|
|
1662
1685
|
};
|
|
1663
1686
|
var getThemeValue = (theme) => {
|
|
1664
|
-
if (theme.value)
|
|
1665
|
-
return theme.value;
|
|
1687
|
+
if (theme.value) return theme.value;
|
|
1666
1688
|
theme.value = setThemeValue(theme);
|
|
1667
1689
|
return theme.value;
|
|
1668
1690
|
};
|
|
1669
1691
|
var getTheme = (value, modifier) => {
|
|
1670
1692
|
const CONFIG2 = getActiveConfig();
|
|
1671
|
-
if (CONFIG2.useVariable)
|
|
1672
|
-
return getMediaTheme(value, modifier);
|
|
1693
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1673
1694
|
const { THEME: THEME2 } = CONFIG2;
|
|
1674
1695
|
if (isString(value)) {
|
|
1675
1696
|
const [theme, subtheme] = value.split(" ");
|
|
1676
1697
|
const isOurTheme = THEME2[theme];
|
|
1677
1698
|
if (isOurTheme) {
|
|
1678
|
-
if (!subtheme && !modifier)
|
|
1679
|
-
return getThemeValue(isOurTheme);
|
|
1699
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1680
1700
|
value = [theme, subtheme || modifier];
|
|
1681
1701
|
}
|
|
1682
1702
|
}
|
|
@@ -1684,14 +1704,10 @@ var getTheme = (value, modifier) => {
|
|
|
1684
1704
|
const themeName = value[0];
|
|
1685
1705
|
const subThemeName = value[1];
|
|
1686
1706
|
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);
|
|
1707
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1708
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1709
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1710
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1695
1711
|
};
|
|
1696
1712
|
var setInverseTheme = (theme, variant, value) => {
|
|
1697
1713
|
if (isObject(variant)) {
|
|
@@ -1709,13 +1725,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1709
1725
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1710
1726
|
const result = getTheme(variant);
|
|
1711
1727
|
themeValue[`&:${key}`] = result;
|
|
1712
|
-
if (isObject(variant) && !variant.value)
|
|
1713
|
-
variant.value = result;
|
|
1728
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1714
1729
|
};
|
|
1715
1730
|
var setSelectors = (theme, value) => {
|
|
1716
1731
|
const { state } = theme;
|
|
1717
|
-
if (!state)
|
|
1718
|
-
return;
|
|
1732
|
+
if (!state) return;
|
|
1719
1733
|
const keys = Object.keys(state);
|
|
1720
1734
|
keys.map((key) => {
|
|
1721
1735
|
const variant = state[key];
|
|
@@ -1727,20 +1741,16 @@ var setSelectors = (theme, value) => {
|
|
|
1727
1741
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1728
1742
|
const result = getTheme(variant);
|
|
1729
1743
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1730
|
-
if (isObject(variant) && !variant.value)
|
|
1731
|
-
variant.value = result;
|
|
1744
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1732
1745
|
};
|
|
1733
1746
|
var setMedia = (theme, value) => {
|
|
1734
1747
|
const { media } = theme;
|
|
1735
|
-
if (!media)
|
|
1736
|
-
return;
|
|
1748
|
+
if (!media) return;
|
|
1737
1749
|
const keys = Object.keys(media);
|
|
1738
1750
|
keys.map((key) => {
|
|
1739
1751
|
const variant = media[key];
|
|
1740
|
-
if (key === "dark" || key === "light")
|
|
1741
|
-
|
|
1742
|
-
if (key === "inverse")
|
|
1743
|
-
setInverseTheme(theme, variant, value);
|
|
1752
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1753
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1744
1754
|
return theme;
|
|
1745
1755
|
});
|
|
1746
1756
|
return theme;
|
|
@@ -1748,23 +1758,19 @@ var setMedia = (theme, value) => {
|
|
|
1748
1758
|
var setHelpers = (theme, value) => {
|
|
1749
1759
|
const CONFIG2 = getActiveConfig();
|
|
1750
1760
|
const { helpers } = theme;
|
|
1751
|
-
if (!helpers)
|
|
1752
|
-
return;
|
|
1761
|
+
if (!helpers) return;
|
|
1753
1762
|
const keys = Object.keys(helpers);
|
|
1754
1763
|
keys.map((key) => {
|
|
1755
1764
|
const helper = helpers[key];
|
|
1756
|
-
if (isString(helper))
|
|
1757
|
-
|
|
1758
|
-
else
|
|
1759
|
-
getThemeValue(helpers[key]);
|
|
1765
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1766
|
+
else getThemeValue(helpers[key]);
|
|
1760
1767
|
return theme;
|
|
1761
1768
|
});
|
|
1762
1769
|
return theme;
|
|
1763
1770
|
};
|
|
1764
1771
|
var setTheme = (val, key) => {
|
|
1765
1772
|
const CONFIG2 = getActiveConfig();
|
|
1766
|
-
if (CONFIG2.useVariable)
|
|
1767
|
-
return setMediaTheme(val, key);
|
|
1773
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1768
1774
|
const { state, media, helpers } = val;
|
|
1769
1775
|
const value = setThemeValue(val, key);
|
|
1770
1776
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1826,24 +1832,19 @@ var recursiveTheme = (val) => {
|
|
|
1826
1832
|
} else if (symb === ":") {
|
|
1827
1833
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1828
1834
|
}
|
|
1829
|
-
} else
|
|
1830
|
-
obj[param] = val[param];
|
|
1835
|
+
} else obj[param] = val[param];
|
|
1831
1836
|
}
|
|
1832
1837
|
return obj;
|
|
1833
1838
|
};
|
|
1834
1839
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1835
1840
|
const currentMod = modifierArray.shift();
|
|
1836
|
-
if (val[currentMod])
|
|
1837
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1841
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1838
1842
|
return val;
|
|
1839
1843
|
};
|
|
1840
1844
|
var findModifier = (val, modifier) => {
|
|
1841
|
-
if (isArray(modifier))
|
|
1842
|
-
|
|
1843
|
-
else
|
|
1844
|
-
return val[modifier];
|
|
1845
|
-
else
|
|
1846
|
-
return val;
|
|
1845
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1846
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1847
|
+
else return val;
|
|
1847
1848
|
};
|
|
1848
1849
|
var getMediaTheme = (value, modifier) => {
|
|
1849
1850
|
const activeConfig = getActiveConfig();
|
|
@@ -1866,11 +1867,10 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1866
1867
|
};
|
|
1867
1868
|
|
|
1868
1869
|
// src/system/font.js
|
|
1869
|
-
var
|
|
1870
|
+
var import_utils13 = __toESM(require_cjs(), 1);
|
|
1870
1871
|
var setFont = (val, key) => {
|
|
1871
1872
|
const CSSvar = `--font-${key}`;
|
|
1872
|
-
if (!val || isArray(val) && !val[0])
|
|
1873
|
-
return;
|
|
1873
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1874
1874
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1875
1875
|
return { var: CSSvar, value: val, fontFace };
|
|
1876
1876
|
};
|
|
@@ -1883,10 +1883,8 @@ var setFontFamily = (val, key) => {
|
|
|
1883
1883
|
const CONFIG2 = getActiveConfig();
|
|
1884
1884
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1885
1885
|
let { value, type } = val;
|
|
1886
|
-
if (val.isDefault)
|
|
1887
|
-
|
|
1888
|
-
if (isObject(value))
|
|
1889
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1886
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1887
|
+
if (isObject(value)) value = (0, import_utils13.arrayzeValue)(value);
|
|
1890
1888
|
const CSSvar = `--font-family-${key}`;
|
|
1891
1889
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1892
1890
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1899,8 +1897,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1899
1897
|
for (const prop in FACTORY2) {
|
|
1900
1898
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1901
1899
|
const mediaValue = FACTORY2[prop];
|
|
1902
|
-
if (!isPropMedia)
|
|
1903
|
-
continue;
|
|
1900
|
+
if (!isPropMedia) continue;
|
|
1904
1901
|
const { mediaRegenerate } = FACTORY2;
|
|
1905
1902
|
const mediaName = prop.slice(1);
|
|
1906
1903
|
const {
|
|
@@ -1978,13 +1975,12 @@ var getFontSizeByKey = (value) => {
|
|
|
1978
1975
|
};
|
|
1979
1976
|
|
|
1980
1977
|
// src/system/spacing.js
|
|
1981
|
-
var
|
|
1978
|
+
var import_utils17 = __toESM(require_cjs(), 1);
|
|
1982
1979
|
var runThroughMedia2 = (FACTORY2) => {
|
|
1983
1980
|
for (const prop in FACTORY2) {
|
|
1984
1981
|
const mediaProps = FACTORY2[prop];
|
|
1985
1982
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1986
|
-
if (!isMediaName)
|
|
1987
|
-
continue;
|
|
1983
|
+
if (!isMediaName) continue;
|
|
1988
1984
|
const {
|
|
1989
1985
|
type,
|
|
1990
1986
|
base,
|
|
@@ -2021,8 +2017,7 @@ var applySpacingSequence = () => {
|
|
|
2021
2017
|
var getSequence = (sequenceProps) => {
|
|
2022
2018
|
const CONFIG2 = getActiveConfig();
|
|
2023
2019
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
2024
|
-
if (!sequenceProps)
|
|
2025
|
-
return SPACING2;
|
|
2020
|
+
if (!sequenceProps) return SPACING2;
|
|
2026
2021
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
2027
2022
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
2028
2023
|
};
|
|
@@ -2031,9 +2026,8 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
2031
2026
|
if (isString(value) && (value.includes("calc") || value.includes("var"))) {
|
|
2032
2027
|
return { [propertyName]: value };
|
|
2033
2028
|
}
|
|
2034
|
-
const stack = (0,
|
|
2035
|
-
if (!isArray(stack))
|
|
2036
|
-
return;
|
|
2029
|
+
const stack = (0, import_utils17.arrayzeValue)(value);
|
|
2030
|
+
if (!isArray(stack)) return;
|
|
2037
2031
|
if (stack.length > 1) {
|
|
2038
2032
|
let suffix = "";
|
|
2039
2033
|
if (propertyName === "borderWidth") {
|
|
@@ -2112,15 +2106,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
2112
2106
|
if (isString(value) && value.includes(",")) {
|
|
2113
2107
|
value = value.split(",").map((v) => {
|
|
2114
2108
|
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;
|
|
2109
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
2110
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
2111
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
2121
2112
|
const arr = v.split(" ");
|
|
2122
|
-
if (!arr.length)
|
|
2123
|
-
return v;
|
|
2113
|
+
if (!arr.length) return v;
|
|
2124
2114
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
2125
2115
|
}).join(" ");
|
|
2126
2116
|
}
|
|
@@ -2135,32 +2125,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
2135
2125
|
};
|
|
2136
2126
|
var getShadow = (value, globalTheme) => {
|
|
2137
2127
|
const CONFIG2 = getActiveConfig();
|
|
2138
|
-
if (!globalTheme)
|
|
2139
|
-
globalTheme = CONFIG2.globalTheme;
|
|
2128
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
2140
2129
|
if (!isString(value)) {
|
|
2141
|
-
if (CONFIG2.verbose)
|
|
2142
|
-
console.warn(value, "- type for color is not valid");
|
|
2130
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
2143
2131
|
return;
|
|
2144
2132
|
}
|
|
2145
|
-
if (value.slice(0, 2) === "--")
|
|
2146
|
-
return `var(${value})`;
|
|
2133
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
2147
2134
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
2148
2135
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
2149
2136
|
const val = SHADOW2[name];
|
|
2150
2137
|
const isObj = isObject(val);
|
|
2151
2138
|
if (!val) {
|
|
2152
|
-
if (CONFIG2.verbose)
|
|
2153
|
-
console.warn("Can't find color ", name);
|
|
2139
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
2154
2140
|
return value;
|
|
2155
2141
|
}
|
|
2156
2142
|
if (globalTheme) {
|
|
2157
|
-
if (val[globalTheme])
|
|
2158
|
-
|
|
2159
|
-
else if (CONFIG2.verbose)
|
|
2160
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
2143
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
2144
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
2161
2145
|
}
|
|
2162
|
-
if (isObj && val.value)
|
|
2163
|
-
return val.value;
|
|
2146
|
+
if (isObj && val.value) return val.value;
|
|
2164
2147
|
if (isObj) {
|
|
2165
2148
|
const obj = {};
|
|
2166
2149
|
for (const mediaName in val) {
|
|
@@ -2170,13 +2153,12 @@ var getShadow = (value, globalTheme) => {
|
|
|
2170
2153
|
}
|
|
2171
2154
|
return obj;
|
|
2172
2155
|
}
|
|
2173
|
-
if (CONFIG2.verbose)
|
|
2174
|
-
console.warn("Can't find color", value);
|
|
2156
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
2175
2157
|
return value;
|
|
2176
2158
|
};
|
|
2177
2159
|
|
|
2178
2160
|
// src/system/timing.js
|
|
2179
|
-
var
|
|
2161
|
+
var import_utils21 = __toESM(require_cjs(), 1);
|
|
2180
2162
|
var applyTimingSequence = () => {
|
|
2181
2163
|
const CONFIG2 = getActiveConfig();
|
|
2182
2164
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -2186,7 +2168,7 @@ var applyTimingSequence = () => {
|
|
|
2186
2168
|
var getTimingFunction = (value) => {
|
|
2187
2169
|
const CONFIG2 = getActiveConfig();
|
|
2188
2170
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
2189
|
-
return TIMING2[value] || TIMING2[(0,
|
|
2171
|
+
return TIMING2[value] || TIMING2[(0, import_utils21.toCamelCase)(value)] || value;
|
|
2190
2172
|
};
|
|
2191
2173
|
var getTimingByKey = (value, property = "timing") => {
|
|
2192
2174
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2211,15 +2193,13 @@ var applyDocument = () => {
|
|
|
2211
2193
|
};
|
|
2212
2194
|
|
|
2213
2195
|
// src/system/svg.js
|
|
2214
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
2215
2196
|
var DEF_OPTIONS = {
|
|
2216
|
-
document:
|
|
2197
|
+
document: document2
|
|
2217
2198
|
};
|
|
2218
2199
|
var setSVG = (val, key) => {
|
|
2219
2200
|
const CONFIG2 = getActiveConfig();
|
|
2220
2201
|
if (!val) {
|
|
2221
|
-
if (CONFIG2.verbose)
|
|
2222
|
-
console.warn("setSVG: val is not defined", key);
|
|
2202
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
2223
2203
|
return;
|
|
2224
2204
|
}
|
|
2225
2205
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -2230,8 +2210,7 @@ var setSVG = (val, key) => {
|
|
|
2230
2210
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2231
2211
|
const CONFIG2 = getActiveConfig();
|
|
2232
2212
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
2233
|
-
for (const key in LIBRARY)
|
|
2234
|
-
lib[key] = CONFIG2.SVG[key];
|
|
2213
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
2235
2214
|
appendSVG(lib, options);
|
|
2236
2215
|
};
|
|
2237
2216
|
var setSvgIcon = (val, key) => {
|
|
@@ -2245,14 +2224,12 @@ var setSvgIcon = (val, key) => {
|
|
|
2245
2224
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2246
2225
|
const CONFIG2 = getActiveConfig();
|
|
2247
2226
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
2248
|
-
for (const key in LIBRARY)
|
|
2249
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
2227
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
2250
2228
|
appendSVG(lib, options);
|
|
2251
2229
|
};
|
|
2252
2230
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
2253
|
-
if (!
|
|
2254
|
-
|
|
2255
|
-
const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2231
|
+
if (!document2 || !document2.createElementNS) return;
|
|
2232
|
+
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2256
2233
|
if (options.isRoot) {
|
|
2257
2234
|
svgElem.setAttribute("aria-hidden", "true");
|
|
2258
2235
|
svgElem.setAttribute("width", "0");
|
|
@@ -2264,7 +2241,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
|
2264
2241
|
};
|
|
2265
2242
|
var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
2266
2243
|
const CONFIG2 = getActiveConfig();
|
|
2267
|
-
const doc = options.document ||
|
|
2244
|
+
const doc = options.document || document2;
|
|
2268
2245
|
if (!doc || !doc.documentElement) {
|
|
2269
2246
|
if (CONFIG2.verbose) {
|
|
2270
2247
|
console.warn("To append SVG sprites it should be run in browser environment");
|
|
@@ -2307,8 +2284,7 @@ var applyReset = (reset = {}) => {
|
|
|
2307
2284
|
}
|
|
2308
2285
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
2309
2286
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
2310
|
-
if (RESET2.html)
|
|
2311
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
2287
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
2312
2288
|
return deepMerge(merge(RESET2, reset), {
|
|
2313
2289
|
html: {
|
|
2314
2290
|
position: "absolute",
|
|
@@ -2365,25 +2341,18 @@ var transformBorder = (border) => {
|
|
|
2365
2341
|
const arr = border.split(", ");
|
|
2366
2342
|
return arr.map((v) => {
|
|
2367
2343
|
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);
|
|
2344
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2345
|
+
else if (isBorderStyle(v)) return v || "solid";
|
|
2346
|
+
else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
|
|
2347
|
+
else if (getColor(v).length > 2) return getColor(v);
|
|
2376
2348
|
return getSpacingByKey(v, "border").border;
|
|
2377
2349
|
}).join(" ");
|
|
2378
2350
|
};
|
|
2379
2351
|
var transformTextStroke = (stroke) => {
|
|
2380
2352
|
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);
|
|
2353
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2354
|
+
if (v.includes("px")) return v;
|
|
2355
|
+
else if (getColor(v)) return getColor(v);
|
|
2387
2356
|
return v;
|
|
2388
2357
|
}).join(" ");
|
|
2389
2358
|
};
|
|
@@ -2391,64 +2360,52 @@ var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
|
|
|
2391
2360
|
var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
|
|
2392
2361
|
return shadow.split(",").map((v) => {
|
|
2393
2362
|
v = v.trim();
|
|
2394
|
-
if (v.slice(0, 2) === "--")
|
|
2395
|
-
return `var(${v})`;
|
|
2363
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2396
2364
|
if (getColor(v).length > 2) {
|
|
2397
2365
|
const color = getMediaColor(v, globalTheme);
|
|
2398
|
-
if (isObject(color))
|
|
2399
|
-
return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
2366
|
+
if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
2400
2367
|
return color;
|
|
2401
2368
|
}
|
|
2402
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
2403
|
-
return v;
|
|
2369
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
2404
2370
|
const arr = v.split(" ");
|
|
2405
|
-
if (!arr.length)
|
|
2406
|
-
return v;
|
|
2371
|
+
if (!arr.length) return v;
|
|
2407
2372
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
2408
2373
|
}).join(" ");
|
|
2409
2374
|
}).join(",");
|
|
2410
2375
|
var transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
2411
2376
|
const CONFIG2 = getActiveConfig();
|
|
2412
2377
|
return backgroundImage.split(", ").map((v) => {
|
|
2413
|
-
if (v.slice(0, 2) === "--")
|
|
2414
|
-
|
|
2415
|
-
if (v.includes("url") || v.includes("gradient"))
|
|
2416
|
-
return v;
|
|
2378
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2379
|
+
if (v.includes("url") || v.includes("gradient")) return v;
|
|
2417
2380
|
else if (CONFIG2.GRADIENT[backgroundImage]) {
|
|
2418
2381
|
return {
|
|
2419
2382
|
backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
|
|
2420
2383
|
};
|
|
2421
|
-
} else if (v.includes("/") || v.startsWith("http") || v.includes("."))
|
|
2422
|
-
return `url(${v})`;
|
|
2384
|
+
} else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
|
|
2423
2385
|
return v;
|
|
2424
2386
|
}).join(" ");
|
|
2425
2387
|
};
|
|
2426
2388
|
var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
|
|
2427
2389
|
var transformTransition = (transition) => {
|
|
2428
2390
|
const arr = transition.split(" ");
|
|
2429
|
-
if (!arr.length)
|
|
2430
|
-
return transition;
|
|
2391
|
+
if (!arr.length) return transition;
|
|
2431
2392
|
return arr.map((v) => {
|
|
2432
|
-
if (v.slice(0, 2) === "--")
|
|
2433
|
-
return `var(${v})`;
|
|
2393
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
2434
2394
|
if (v.length < 3 || v.includes("ms")) {
|
|
2435
2395
|
const mapWithSequence = getTimingByKey(v);
|
|
2436
2396
|
return mapWithSequence.timing || v;
|
|
2437
2397
|
}
|
|
2438
|
-
if (getTimingFunction(v))
|
|
2439
|
-
return getTimingFunction(v);
|
|
2398
|
+
if (getTimingFunction(v)) return getTimingFunction(v);
|
|
2440
2399
|
return v;
|
|
2441
2400
|
}).join(" ");
|
|
2442
2401
|
};
|
|
2443
2402
|
var transformDuration = (duration, props, propertyName) => {
|
|
2444
|
-
if (!isString(duration))
|
|
2445
|
-
return;
|
|
2403
|
+
if (!isString(duration)) return;
|
|
2446
2404
|
return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
|
|
2447
2405
|
};
|
|
2448
2406
|
var splitTransition = (transition) => {
|
|
2449
2407
|
const arr = transition.split(",");
|
|
2450
|
-
if (!arr.length)
|
|
2451
|
-
return;
|
|
2408
|
+
if (!arr.length) return;
|
|
2452
2409
|
return arr.map(transformTransition).join(",");
|
|
2453
2410
|
};
|
|
2454
2411
|
var checkIfBoxSize = (propertyName) => {
|
|
@@ -2457,16 +2414,14 @@ var checkIfBoxSize = (propertyName) => {
|
|
|
2457
2414
|
};
|
|
2458
2415
|
var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
2459
2416
|
let value = val || props[propertyName];
|
|
2460
|
-
if (isUndefined(value) && isNull(value))
|
|
2461
|
-
return;
|
|
2417
|
+
if (isUndefined(value) && isNull(value)) return;
|
|
2462
2418
|
const shouldScaleBoxSize = props.scaleBoxSize;
|
|
2463
2419
|
const isBoxSize = checkIfBoxSize(propertyName);
|
|
2464
2420
|
if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
|
|
2465
2421
|
value = value.split(" ").map((v) => {
|
|
2466
2422
|
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
2467
2423
|
const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
|
|
2468
|
-
if (isSingleLetter && !hasUnits)
|
|
2469
|
-
return v + "_default";
|
|
2424
|
+
if (isSingleLetter && !hasUnits) return v + "_default";
|
|
2470
2425
|
return v;
|
|
2471
2426
|
}).join(" ");
|
|
2472
2427
|
}
|
|
@@ -2476,16 +2431,21 @@ var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
|
2476
2431
|
return getSpacingByKey(value, propertyName);
|
|
2477
2432
|
}
|
|
2478
2433
|
};
|
|
2479
|
-
var transformSizeRatio = (propertyName, props) => {
|
|
2480
|
-
return transformSize(propertyName,
|
|
2434
|
+
var transformSizeRatio = (propertyName, val = null, props) => {
|
|
2435
|
+
return transformSize(propertyName, val, props, {
|
|
2481
2436
|
ratio: true
|
|
2482
2437
|
});
|
|
2483
2438
|
};
|
|
2439
|
+
var transformBorderRadius = (radius, props, propertyName) => {
|
|
2440
|
+
if (!isString(radius)) return;
|
|
2441
|
+
return {
|
|
2442
|
+
borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
|
|
2443
|
+
};
|
|
2444
|
+
};
|
|
2484
2445
|
|
|
2485
2446
|
// src/set.js
|
|
2486
2447
|
var setCases = (val, key) => {
|
|
2487
|
-
if (isFunction(val))
|
|
2488
|
-
return val();
|
|
2448
|
+
if (isFunction(val)) return val();
|
|
2489
2449
|
return val;
|
|
2490
2450
|
};
|
|
2491
2451
|
var setSameValue = (val, key) => val;
|
|
@@ -2521,12 +2481,10 @@ var setValue = (FACTORY_NAME, value, key) => {
|
|
|
2521
2481
|
FACTORY2[key] = result;
|
|
2522
2482
|
return FACTORY2;
|
|
2523
2483
|
} catch (error) {
|
|
2524
|
-
if (CONFIG2.verbose)
|
|
2525
|
-
console.warn("Error setting", factoryName, "value", value, key, error);
|
|
2484
|
+
if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
|
|
2526
2485
|
}
|
|
2527
2486
|
}
|
|
2528
|
-
if (CONFIG2.verbose)
|
|
2529
|
-
console.warn("Can not find", factoryName, "method in scratch");
|
|
2487
|
+
if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
|
|
2530
2488
|
};
|
|
2531
2489
|
var setEach = (factoryName, props) => {
|
|
2532
2490
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2555,38 +2513,23 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
2555
2513
|
if (options.newConfig) {
|
|
2556
2514
|
CONFIG2 = setActiveConfig(options.newConfig);
|
|
2557
2515
|
}
|
|
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 = {};
|
|
2516
|
+
if (verbose !== void 0) CONFIG2.verbose = verbose;
|
|
2517
|
+
if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
|
|
2518
|
+
if (useReset !== void 0) CONFIG2.useReset = useReset;
|
|
2519
|
+
if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
|
|
2520
|
+
if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
|
|
2521
|
+
if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
|
|
2522
|
+
if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
2523
|
+
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
2524
|
+
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
2525
|
+
if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
2526
|
+
if (CONFIG2.verbose) console.log(CONFIG2);
|
|
2527
|
+
if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
|
|
2582
2528
|
const keys = Object.keys(config);
|
|
2583
2529
|
keys.map((key) => setEach(key, config[key]));
|
|
2584
|
-
if (config.TYPOGRAPHY)
|
|
2585
|
-
|
|
2586
|
-
if (config.
|
|
2587
|
-
applySpacingSequence();
|
|
2588
|
-
if (config.TIMING)
|
|
2589
|
-
applyTimingSequence();
|
|
2530
|
+
if (config.TYPOGRAPHY) applyTypographySequence();
|
|
2531
|
+
if (config.SPACING) applySpacingSequence();
|
|
2532
|
+
if (config.TIMING) applyTimingSequence();
|
|
2590
2533
|
applyDocument();
|
|
2591
2534
|
applyReset();
|
|
2592
2535
|
return CONFIG2;
|