@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/system/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_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
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_exports);
|
|
113
77
|
var window22 = globalThis;
|
|
114
78
|
var document22 = window22.document;
|
|
115
79
|
var isObject2 = (arg) => {
|
|
116
|
-
if (arg === null)
|
|
117
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
118
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
119
82
|
};
|
|
120
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
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,20 +310,15 @@ 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
|
});
|
|
@@ -334,19 +358,18 @@ __export(system_exports, {
|
|
|
334
358
|
});
|
|
335
359
|
module.exports = __toCommonJS(system_exports);
|
|
336
360
|
|
|
337
|
-
// ../../node_modules/@domql/utils/
|
|
361
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
338
362
|
var window2 = globalThis;
|
|
339
363
|
var document2 = window2.document;
|
|
340
364
|
|
|
341
|
-
// ../../node_modules/@domql/utils/
|
|
365
|
+
// ../../node_modules/@domql/utils/node.js
|
|
342
366
|
var isDOMNode = (obj) => {
|
|
343
367
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
344
368
|
};
|
|
345
369
|
|
|
346
|
-
// ../../node_modules/@domql/utils/
|
|
370
|
+
// ../../node_modules/@domql/utils/types.js
|
|
347
371
|
var isObject = (arg) => {
|
|
348
|
-
if (arg === null)
|
|
349
|
-
return false;
|
|
372
|
+
if (arg === null) return false;
|
|
350
373
|
return typeof arg === "object" && arg.constructor === Object;
|
|
351
374
|
};
|
|
352
375
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -355,44 +378,99 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
355
378
|
var isNull = (arg) => arg === null;
|
|
356
379
|
var isArray = (arg) => Array.isArray(arg);
|
|
357
380
|
var isObjectLike = (arg) => {
|
|
358
|
-
if (arg === null)
|
|
359
|
-
return false;
|
|
381
|
+
if (arg === null) return false;
|
|
360
382
|
return typeof arg === "object";
|
|
361
383
|
};
|
|
362
384
|
var isUndefined = (arg) => {
|
|
363
385
|
return arg === void 0;
|
|
364
386
|
};
|
|
365
387
|
|
|
366
|
-
// ../../node_modules/@domql/utils/
|
|
367
|
-
var
|
|
368
|
-
return arr.reduce(
|
|
388
|
+
// ../../node_modules/@domql/utils/array.js
|
|
389
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
390
|
+
return arr.reduce(
|
|
391
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
392
|
+
{}
|
|
393
|
+
);
|
|
369
394
|
};
|
|
370
395
|
|
|
371
|
-
// ../../node_modules/@domql/utils/
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
396
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
397
|
+
var STATE_METHODS = [
|
|
398
|
+
"update",
|
|
399
|
+
"parse",
|
|
400
|
+
"clean",
|
|
401
|
+
"create",
|
|
402
|
+
"destroy",
|
|
403
|
+
"add",
|
|
404
|
+
"toggle",
|
|
405
|
+
"remove",
|
|
406
|
+
"apply",
|
|
407
|
+
"set",
|
|
408
|
+
"reset",
|
|
409
|
+
"replace",
|
|
410
|
+
"quietReplace",
|
|
411
|
+
"quietUpdate",
|
|
412
|
+
"applyReplace",
|
|
413
|
+
"applyFunction",
|
|
414
|
+
"keys",
|
|
415
|
+
"values",
|
|
416
|
+
"ref",
|
|
417
|
+
"rootUpdate",
|
|
418
|
+
"parentUpdate",
|
|
419
|
+
"parent",
|
|
420
|
+
"__element",
|
|
421
|
+
"__depends",
|
|
422
|
+
"__ref",
|
|
423
|
+
"__children",
|
|
424
|
+
"root",
|
|
425
|
+
"setByPath",
|
|
426
|
+
"setPathCollection",
|
|
427
|
+
"removeByPath",
|
|
428
|
+
"removePathCollection",
|
|
429
|
+
"getByPath"
|
|
430
|
+
];
|
|
431
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
432
|
+
var METHODS = [
|
|
433
|
+
"set",
|
|
434
|
+
"reset",
|
|
435
|
+
"update",
|
|
436
|
+
"remove",
|
|
437
|
+
"updateContent",
|
|
438
|
+
"removeContent",
|
|
439
|
+
"lookup",
|
|
440
|
+
"lookdown",
|
|
441
|
+
"lookdownAll",
|
|
442
|
+
"getRef",
|
|
443
|
+
"getPath",
|
|
444
|
+
"setNodeStyles",
|
|
445
|
+
"spotByPath",
|
|
446
|
+
"keys",
|
|
447
|
+
"parse",
|
|
448
|
+
"setProps",
|
|
449
|
+
"parseDeep",
|
|
450
|
+
"variables",
|
|
451
|
+
"if",
|
|
452
|
+
"log",
|
|
453
|
+
"verbose",
|
|
454
|
+
"warn",
|
|
455
|
+
"error",
|
|
456
|
+
"call",
|
|
457
|
+
"nextElement",
|
|
458
|
+
"previousElement"
|
|
459
|
+
];
|
|
460
|
+
var METHODS_EXL = [
|
|
461
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
462
|
+
...METHODS,
|
|
463
|
+
...STATE_METHODS,
|
|
464
|
+
...PROPS_METHODS
|
|
465
|
+
];
|
|
466
|
+
|
|
467
|
+
// ../../node_modules/@domql/utils/object.js
|
|
391
468
|
var merge = (element, obj, excludeFrom = []) => {
|
|
392
469
|
for (const e in obj) {
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
470
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
471
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
395
472
|
continue;
|
|
473
|
+
}
|
|
396
474
|
const elementProp = element[e];
|
|
397
475
|
const objProp = obj[e];
|
|
398
476
|
if (elementProp === void 0) {
|
|
@@ -401,11 +479,12 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
401
479
|
}
|
|
402
480
|
return element;
|
|
403
481
|
};
|
|
404
|
-
var deepMerge = (element, extend, excludeFrom =
|
|
482
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
405
483
|
for (const e in extend) {
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
484
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
485
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
408
486
|
continue;
|
|
487
|
+
}
|
|
409
488
|
const elementProp = element[e];
|
|
410
489
|
const extendProp = extend[e];
|
|
411
490
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -423,7 +502,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
423
502
|
cleanNull = false,
|
|
424
503
|
window: targetWindow,
|
|
425
504
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
426
|
-
|
|
505
|
+
handleExtends = false
|
|
427
506
|
} = options;
|
|
428
507
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
429
508
|
return obj;
|
|
@@ -431,37 +510,39 @@ var deepClone = (obj, options = {}) => {
|
|
|
431
510
|
if (visited.has(obj)) {
|
|
432
511
|
return visited.get(obj);
|
|
433
512
|
}
|
|
434
|
-
const
|
|
435
|
-
visited.set(obj,
|
|
513
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
514
|
+
visited.set(obj, clone);
|
|
436
515
|
for (const key in obj) {
|
|
437
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
438
|
-
|
|
439
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
516
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
517
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
440
518
|
continue;
|
|
519
|
+
}
|
|
441
520
|
const value = obj[key];
|
|
442
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
521
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
443
522
|
continue;
|
|
523
|
+
}
|
|
444
524
|
if (isDOMNode(value)) {
|
|
445
|
-
|
|
525
|
+
clone[key] = value;
|
|
446
526
|
continue;
|
|
447
527
|
}
|
|
448
|
-
if (
|
|
449
|
-
|
|
528
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
529
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
450
530
|
continue;
|
|
451
531
|
}
|
|
452
532
|
if (isFunction(value) && targetWindow) {
|
|
453
|
-
|
|
533
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
454
534
|
continue;
|
|
455
535
|
}
|
|
456
536
|
if (isObjectLike(value)) {
|
|
457
|
-
|
|
537
|
+
clone[key] = deepClone(value, {
|
|
538
|
+
...options,
|
|
458
539
|
visited
|
|
459
|
-
})
|
|
540
|
+
});
|
|
460
541
|
} else {
|
|
461
|
-
|
|
542
|
+
clone[key] = value;
|
|
462
543
|
}
|
|
463
544
|
}
|
|
464
|
-
return
|
|
545
|
+
return clone;
|
|
465
546
|
};
|
|
466
547
|
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
467
548
|
const excl = opts.exclude || [];
|
|
@@ -469,14 +550,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
469
550
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
470
551
|
return params;
|
|
471
552
|
}
|
|
472
|
-
if (visited.has(obj))
|
|
473
|
-
return visited.get(obj);
|
|
553
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
474
554
|
visited.set(obj, obj);
|
|
475
555
|
for (const e in params) {
|
|
476
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
477
|
-
|
|
478
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
479
|
-
continue;
|
|
556
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
557
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
480
558
|
const objProp = obj[e];
|
|
481
559
|
const paramsProp = params[e];
|
|
482
560
|
if (isDOMNode(paramsProp)) {
|
|
@@ -490,7 +568,7 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
490
568
|
return obj;
|
|
491
569
|
};
|
|
492
570
|
|
|
493
|
-
// ../../node_modules/@domql/utils/
|
|
571
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
494
572
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
495
573
|
|
|
496
574
|
// src/defaultConfig/index.js
|
|
@@ -720,12 +798,9 @@ var isScalingUnit = (unit) => {
|
|
|
720
798
|
};
|
|
721
799
|
|
|
722
800
|
// src/utils/color.js
|
|
723
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
724
801
|
var colorStringToRgbaArray = (color) => {
|
|
725
|
-
if (color === "")
|
|
726
|
-
|
|
727
|
-
if (color.toLowerCase() === "transparent")
|
|
728
|
-
return [0, 0, 0, 0];
|
|
802
|
+
if (color === "") return [0, 0, 0, 0];
|
|
803
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
729
804
|
if (color[0] === "#") {
|
|
730
805
|
if (color.length < 7) {
|
|
731
806
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -738,26 +813,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
738
813
|
];
|
|
739
814
|
}
|
|
740
815
|
if (color.indexOf("rgb") === -1) {
|
|
741
|
-
if (
|
|
742
|
-
const elem =
|
|
816
|
+
if (document2 && window2) {
|
|
817
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
743
818
|
const flag = "rgb(1, 2, 3)";
|
|
744
819
|
elem.style.color = flag;
|
|
745
820
|
if (elem.style.color !== flag) {
|
|
746
|
-
|
|
821
|
+
document2.body.removeChild(elem);
|
|
747
822
|
return;
|
|
748
823
|
}
|
|
749
824
|
elem.style.color = color;
|
|
750
825
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
751
|
-
|
|
826
|
+
document2.body.removeChild(elem);
|
|
752
827
|
return [0, 0, 0, 0];
|
|
753
828
|
}
|
|
754
|
-
color =
|
|
755
|
-
|
|
829
|
+
color = window2.getComputedStyle(elem).color;
|
|
830
|
+
document2.body.removeChild(elem);
|
|
756
831
|
}
|
|
757
832
|
}
|
|
758
833
|
if (color.indexOf("rgb") === 0) {
|
|
759
|
-
if (color.indexOf("rgba") === -1)
|
|
760
|
-
color = `${color}, 1`;
|
|
834
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
761
835
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
762
836
|
}
|
|
763
837
|
return [0, 0, 0, 0];
|
|
@@ -783,29 +857,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
783
857
|
var getColorShade = (col, amt) => {
|
|
784
858
|
const num = parseInt(col, 16);
|
|
785
859
|
let r = (num >> 16) + amt;
|
|
786
|
-
if (r > 255)
|
|
787
|
-
|
|
788
|
-
else if (r < 0)
|
|
789
|
-
r = 0;
|
|
860
|
+
if (r > 255) r = 255;
|
|
861
|
+
else if (r < 0) r = 0;
|
|
790
862
|
let b = (num >> 8 & 255) + amt;
|
|
791
|
-
if (b > 255)
|
|
792
|
-
|
|
793
|
-
else if (b < 0)
|
|
794
|
-
b = 0;
|
|
863
|
+
if (b > 255) b = 255;
|
|
864
|
+
else if (b < 0) b = 0;
|
|
795
865
|
let g = (num & 255) + amt;
|
|
796
|
-
if (g > 255)
|
|
797
|
-
|
|
798
|
-
else if (g < 0)
|
|
799
|
-
g = 0;
|
|
866
|
+
if (g > 255) g = 255;
|
|
867
|
+
else if (g < 0) g = 0;
|
|
800
868
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
801
869
|
};
|
|
802
870
|
var getRgbTone = (rgb, tone) => {
|
|
803
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
804
|
-
|
|
805
|
-
if (
|
|
806
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
807
|
-
if (isNumber(tone))
|
|
808
|
-
tone += "";
|
|
871
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
872
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
873
|
+
if (isNumber(tone)) tone += "";
|
|
809
874
|
const toHex = rgbArrayToHex(rgb);
|
|
810
875
|
const abs = tone.slice(0, 1);
|
|
811
876
|
if (abs === "-" || abs === "+") {
|
|
@@ -822,10 +887,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
822
887
|
|
|
823
888
|
// src/utils/font.js
|
|
824
889
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
825
|
-
if (LIBRARY[key])
|
|
826
|
-
|
|
827
|
-
if (LIBRARY.default)
|
|
828
|
-
return LIBRARY[LIBRARY.default].value;
|
|
890
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
891
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
829
892
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
830
893
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
831
894
|
};
|
|
@@ -847,7 +910,7 @@ var getFontFaceEach = (name, weights) => {
|
|
|
847
910
|
};
|
|
848
911
|
|
|
849
912
|
// src/utils/sequence.js
|
|
850
|
-
var
|
|
913
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
851
914
|
var numToLetterMap = {
|
|
852
915
|
"-6": "U",
|
|
853
916
|
"-5": "V",
|
|
@@ -893,8 +956,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
893
956
|
var setScalingVar = (key, sequenceProps) => {
|
|
894
957
|
const { base, type, unit } = sequenceProps;
|
|
895
958
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
896
|
-
if (key === 0)
|
|
897
|
-
return defaultVal;
|
|
959
|
+
if (key === 0) return defaultVal;
|
|
898
960
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
899
961
|
const ratioVar = `${prefix}-ratio`;
|
|
900
962
|
if (key > 0) {
|
|
@@ -931,10 +993,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
931
993
|
const diffRounded = ~~next - ~~value;
|
|
932
994
|
let arr;
|
|
933
995
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
934
|
-
if (diffRounded > 16)
|
|
935
|
-
|
|
936
|
-
else
|
|
937
|
-
arr = [first, second];
|
|
996
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
997
|
+
else arr = [first, second];
|
|
938
998
|
arr.forEach((v, k) => {
|
|
939
999
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
940
1000
|
const newVar = variable + (k + 1);
|
|
@@ -976,8 +1036,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
976
1036
|
index: key
|
|
977
1037
|
};
|
|
978
1038
|
setSequenceValue(props, sequenceProps);
|
|
979
|
-
if (subSequence)
|
|
980
|
-
generateSubSequence(props, sequenceProps);
|
|
1039
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
981
1040
|
}
|
|
982
1041
|
return sequenceProps;
|
|
983
1042
|
};
|
|
@@ -989,13 +1048,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
989
1048
|
unit = UNIT2.default,
|
|
990
1049
|
useVariable
|
|
991
1050
|
} = sequenceProps;
|
|
992
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
993
|
-
|
|
994
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1051
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1052
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
995
1053
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
996
1054
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
997
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
|
|
998
|
-
return value;
|
|
1055
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
|
|
999
1056
|
const letterVal = value.toUpperCase();
|
|
1000
1057
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1001
1058
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1019,8 +1076,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1019
1076
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1020
1077
|
}
|
|
1021
1078
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1022
|
-
if (CONFIG2.verbose)
|
|
1023
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1079
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1024
1080
|
absValue = absValue.slice(0, 1);
|
|
1025
1081
|
}
|
|
1026
1082
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1028,8 +1084,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1028
1084
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1029
1085
|
}
|
|
1030
1086
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1031
|
-
if (!sequenceItem)
|
|
1032
|
-
return console.warn("can't find", sequence, absValue);
|
|
1087
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1033
1088
|
if (unit === "ms" || unit === "s") {
|
|
1034
1089
|
return isNegative + sequenceItem.val + unit;
|
|
1035
1090
|
}
|
|
@@ -1038,12 +1093,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1038
1093
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1039
1094
|
if (typeof value !== "string") {
|
|
1040
1095
|
const CONFIG2 = getActiveConfig();
|
|
1041
|
-
if (CONFIG2.verbose)
|
|
1042
|
-
console.warn(propertyName, value, "is not a string");
|
|
1096
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1043
1097
|
return { [propertyName]: value };
|
|
1044
1098
|
}
|
|
1045
|
-
if (value === "-" || value === "")
|
|
1046
|
-
return {};
|
|
1099
|
+
if (value === "-" || value === "") return {};
|
|
1047
1100
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1048
1101
|
};
|
|
1049
1102
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1103,23 +1156,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1103
1156
|
const { mediaRegenerate } = FACTORY2;
|
|
1104
1157
|
const { sequence, scales } = FACTORY2[media];
|
|
1105
1158
|
const query = MEDIA2[mediaName];
|
|
1106
|
-
if (!query && CONFIG2.verbose)
|
|
1107
|
-
console.warn("Can't find media query ", query);
|
|
1159
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1108
1160
|
if (!mediaRegenerate) {
|
|
1109
1161
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1110
|
-
if (!underMediaQuery)
|
|
1111
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1162
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1112
1163
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1113
1164
|
return;
|
|
1114
1165
|
}
|
|
1115
1166
|
for (const key in sequence) {
|
|
1116
1167
|
const item = sequence[key];
|
|
1117
1168
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1118
|
-
if (!query && CONFIG2.verbose)
|
|
1119
|
-
console.warn("Can't find query ", query);
|
|
1169
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1120
1170
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1121
|
-
if (!underMediaQuery)
|
|
1122
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1171
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1123
1172
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1124
1173
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1125
1174
|
}
|
|
@@ -1130,10 +1179,8 @@ var generateSprite = (icons) => {
|
|
|
1130
1179
|
const CONFIG2 = getActiveConfig();
|
|
1131
1180
|
let sprite = "";
|
|
1132
1181
|
for (const key in icons) {
|
|
1133
|
-
if (CONFIG2.__svg_cache[key])
|
|
1134
|
-
|
|
1135
|
-
else
|
|
1136
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1182
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1183
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1137
1184
|
sprite += icons[key];
|
|
1138
1185
|
}
|
|
1139
1186
|
return sprite;
|
|
@@ -1188,27 +1235,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1188
1235
|
var getColor = (value, key, config) => {
|
|
1189
1236
|
const CONFIG2 = config || getActiveConfig();
|
|
1190
1237
|
if (!isString(value)) {
|
|
1191
|
-
if (CONFIG2.verbose)
|
|
1192
|
-
console.warn(value, "- type for color is not valid");
|
|
1238
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1193
1239
|
return;
|
|
1194
1240
|
}
|
|
1195
|
-
if (value.slice(0, 2) === "--")
|
|
1196
|
-
|
|
1197
|
-
if (key && value[key])
|
|
1198
|
-
value = value[key];
|
|
1241
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1242
|
+
if (key && value[key]) value = value[key];
|
|
1199
1243
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1200
1244
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1201
1245
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1202
1246
|
if (!val) {
|
|
1203
|
-
if (CONFIG2.verbose)
|
|
1204
|
-
console.warn("Can't find color ", name);
|
|
1247
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1205
1248
|
return value;
|
|
1206
1249
|
}
|
|
1207
1250
|
if (key) {
|
|
1208
|
-
if (val[key])
|
|
1209
|
-
|
|
1210
|
-
else if (CONFIG2.verbose)
|
|
1211
|
-
console.warn(value, " - does not have ", key);
|
|
1251
|
+
if (val[key]) val = val[key];
|
|
1252
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1212
1253
|
}
|
|
1213
1254
|
let rgb = val.rgb;
|
|
1214
1255
|
if (!rgb) {
|
|
@@ -1218,32 +1259,25 @@ var getColor = (value, key, config) => {
|
|
|
1218
1259
|
rgb = getRgbTone(rgb, tone);
|
|
1219
1260
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1220
1261
|
}
|
|
1221
|
-
if (val[tone])
|
|
1222
|
-
|
|
1223
|
-
if (alpha)
|
|
1224
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1262
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1263
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1225
1264
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1226
1265
|
};
|
|
1227
1266
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1228
1267
|
const CONFIG2 = config || getActiveConfig();
|
|
1229
|
-
if (!globalTheme)
|
|
1230
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1268
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1231
1269
|
if (!isString(value)) {
|
|
1232
|
-
if (CONFIG2.verbose)
|
|
1233
|
-
console.warn(value, "- type for color is not valid");
|
|
1270
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1234
1271
|
return;
|
|
1235
1272
|
}
|
|
1236
|
-
if (value.slice(0, 2) === "--")
|
|
1237
|
-
return `var(${value})`;
|
|
1273
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1238
1274
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1239
1275
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1240
1276
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1241
1277
|
const isObj = isObject(val);
|
|
1242
|
-
if (isObj && val.value)
|
|
1243
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1278
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1244
1279
|
else if (isObj) {
|
|
1245
|
-
if (globalTheme)
|
|
1246
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1280
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1247
1281
|
else {
|
|
1248
1282
|
const obj = {};
|
|
1249
1283
|
for (const mediaName in val) {
|
|
@@ -1254,8 +1288,7 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1254
1288
|
return obj;
|
|
1255
1289
|
}
|
|
1256
1290
|
} else {
|
|
1257
|
-
if (CONFIG2.verbose)
|
|
1258
|
-
console.warn("Can't find color", value);
|
|
1291
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1259
1292
|
return value;
|
|
1260
1293
|
}
|
|
1261
1294
|
};
|
|
@@ -1264,8 +1297,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1264
1297
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1265
1298
|
val = getColor(val.slice(2));
|
|
1266
1299
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1267
|
-
if (CONFIG2.verbose)
|
|
1268
|
-
console.warn(val, "- referred but does not exist");
|
|
1300
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1269
1301
|
val = val.split(" ")[0];
|
|
1270
1302
|
}
|
|
1271
1303
|
}
|
|
@@ -1304,8 +1336,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1304
1336
|
};
|
|
1305
1337
|
var setGradient = (val, key, suffix) => {
|
|
1306
1338
|
const CONFIG2 = getActiveConfig();
|
|
1307
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1308
|
-
val = getColor(val.slice(2));
|
|
1339
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1309
1340
|
if (isArray(val)) {
|
|
1310
1341
|
return {
|
|
1311
1342
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1314,8 +1345,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1314
1345
|
}
|
|
1315
1346
|
if (isObject(val)) {
|
|
1316
1347
|
const obj = {};
|
|
1317
|
-
for (const variant in val)
|
|
1318
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1348
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1319
1349
|
return obj;
|
|
1320
1350
|
}
|
|
1321
1351
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1341,22 +1371,19 @@ var setThemeValue = (theme) => {
|
|
|
1341
1371
|
return value;
|
|
1342
1372
|
};
|
|
1343
1373
|
var getThemeValue = (theme) => {
|
|
1344
|
-
if (theme.value)
|
|
1345
|
-
return theme.value;
|
|
1374
|
+
if (theme.value) return theme.value;
|
|
1346
1375
|
theme.value = setThemeValue(theme);
|
|
1347
1376
|
return theme.value;
|
|
1348
1377
|
};
|
|
1349
1378
|
var getTheme = (value, modifier) => {
|
|
1350
1379
|
const CONFIG2 = getActiveConfig();
|
|
1351
|
-
if (CONFIG2.useVariable)
|
|
1352
|
-
return getMediaTheme(value, modifier);
|
|
1380
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1353
1381
|
const { THEME: THEME2 } = CONFIG2;
|
|
1354
1382
|
if (isString(value)) {
|
|
1355
1383
|
const [theme, subtheme] = value.split(" ");
|
|
1356
1384
|
const isOurTheme = THEME2[theme];
|
|
1357
1385
|
if (isOurTheme) {
|
|
1358
|
-
if (!subtheme && !modifier)
|
|
1359
|
-
return getThemeValue(isOurTheme);
|
|
1386
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1360
1387
|
value = [theme, subtheme || modifier];
|
|
1361
1388
|
}
|
|
1362
1389
|
}
|
|
@@ -1364,14 +1391,10 @@ var getTheme = (value, modifier) => {
|
|
|
1364
1391
|
const themeName = value[0];
|
|
1365
1392
|
const subThemeName = value[1];
|
|
1366
1393
|
const { helpers, media, state } = THEME2[themeName];
|
|
1367
|
-
if (media && media[subThemeName])
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
if (state && state[subThemeName])
|
|
1372
|
-
return getThemeValue(state[subThemeName]);
|
|
1373
|
-
} else if (isObject(value))
|
|
1374
|
-
return setThemeValue(value);
|
|
1394
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1395
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1396
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1397
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1375
1398
|
};
|
|
1376
1399
|
var setInverseTheme = (theme, variant, value) => {
|
|
1377
1400
|
if (isObject(variant)) {
|
|
@@ -1389,13 +1412,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1389
1412
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1390
1413
|
const result = getTheme(variant);
|
|
1391
1414
|
themeValue[`&:${key}`] = result;
|
|
1392
|
-
if (isObject(variant) && !variant.value)
|
|
1393
|
-
variant.value = result;
|
|
1415
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1394
1416
|
};
|
|
1395
1417
|
var setSelectors = (theme, value) => {
|
|
1396
1418
|
const { state } = theme;
|
|
1397
|
-
if (!state)
|
|
1398
|
-
return;
|
|
1419
|
+
if (!state) return;
|
|
1399
1420
|
const keys = Object.keys(state);
|
|
1400
1421
|
keys.map((key) => {
|
|
1401
1422
|
const variant = state[key];
|
|
@@ -1407,20 +1428,16 @@ var setSelectors = (theme, value) => {
|
|
|
1407
1428
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1408
1429
|
const result = getTheme(variant);
|
|
1409
1430
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1410
|
-
if (isObject(variant) && !variant.value)
|
|
1411
|
-
variant.value = result;
|
|
1431
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1412
1432
|
};
|
|
1413
1433
|
var setMedia = (theme, value) => {
|
|
1414
1434
|
const { media } = theme;
|
|
1415
|
-
if (!media)
|
|
1416
|
-
return;
|
|
1435
|
+
if (!media) return;
|
|
1417
1436
|
const keys = Object.keys(media);
|
|
1418
1437
|
keys.map((key) => {
|
|
1419
1438
|
const variant = media[key];
|
|
1420
|
-
if (key === "dark" || key === "light")
|
|
1421
|
-
|
|
1422
|
-
if (key === "inverse")
|
|
1423
|
-
setInverseTheme(theme, variant, value);
|
|
1439
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1440
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1424
1441
|
return theme;
|
|
1425
1442
|
});
|
|
1426
1443
|
return theme;
|
|
@@ -1428,23 +1445,19 @@ var setMedia = (theme, value) => {
|
|
|
1428
1445
|
var setHelpers = (theme, value) => {
|
|
1429
1446
|
const CONFIG2 = getActiveConfig();
|
|
1430
1447
|
const { helpers } = theme;
|
|
1431
|
-
if (!helpers)
|
|
1432
|
-
return;
|
|
1448
|
+
if (!helpers) return;
|
|
1433
1449
|
const keys = Object.keys(helpers);
|
|
1434
1450
|
keys.map((key) => {
|
|
1435
1451
|
const helper = helpers[key];
|
|
1436
|
-
if (isString(helper))
|
|
1437
|
-
|
|
1438
|
-
else
|
|
1439
|
-
getThemeValue(helpers[key]);
|
|
1452
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1453
|
+
else getThemeValue(helpers[key]);
|
|
1440
1454
|
return theme;
|
|
1441
1455
|
});
|
|
1442
1456
|
return theme;
|
|
1443
1457
|
};
|
|
1444
1458
|
var setTheme = (val, key) => {
|
|
1445
1459
|
const CONFIG2 = getActiveConfig();
|
|
1446
|
-
if (CONFIG2.useVariable)
|
|
1447
|
-
return setMediaTheme(val, key);
|
|
1460
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1448
1461
|
const { state, media, helpers } = val;
|
|
1449
1462
|
const value = setThemeValue(val, key);
|
|
1450
1463
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1506,24 +1519,19 @@ var recursiveTheme = (val) => {
|
|
|
1506
1519
|
} else if (symb === ":") {
|
|
1507
1520
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1508
1521
|
}
|
|
1509
|
-
} else
|
|
1510
|
-
obj[param] = val[param];
|
|
1522
|
+
} else obj[param] = val[param];
|
|
1511
1523
|
}
|
|
1512
1524
|
return obj;
|
|
1513
1525
|
};
|
|
1514
1526
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1515
1527
|
const currentMod = modifierArray.shift();
|
|
1516
|
-
if (val[currentMod])
|
|
1517
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1528
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1518
1529
|
return val;
|
|
1519
1530
|
};
|
|
1520
1531
|
var findModifier = (val, modifier) => {
|
|
1521
|
-
if (isArray(modifier))
|
|
1522
|
-
|
|
1523
|
-
else
|
|
1524
|
-
return val[modifier];
|
|
1525
|
-
else
|
|
1526
|
-
return val;
|
|
1532
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1533
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1534
|
+
else return val;
|
|
1527
1535
|
};
|
|
1528
1536
|
var getMediaTheme = (value, modifier) => {
|
|
1529
1537
|
const activeConfig = getActiveConfig();
|
|
@@ -1546,11 +1554,10 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1546
1554
|
};
|
|
1547
1555
|
|
|
1548
1556
|
// src/system/font.js
|
|
1549
|
-
var
|
|
1557
|
+
var import_utils13 = __toESM(require_cjs(), 1);
|
|
1550
1558
|
var setFont = (val, key) => {
|
|
1551
1559
|
const CSSvar = `--font-${key}`;
|
|
1552
|
-
if (!val || isArray(val) && !val[0])
|
|
1553
|
-
return;
|
|
1560
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1554
1561
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1555
1562
|
return { var: CSSvar, value: val, fontFace };
|
|
1556
1563
|
};
|
|
@@ -1563,10 +1570,8 @@ var setFontFamily = (val, key) => {
|
|
|
1563
1570
|
const CONFIG2 = getActiveConfig();
|
|
1564
1571
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1565
1572
|
let { value, type } = val;
|
|
1566
|
-
if (val.isDefault)
|
|
1567
|
-
|
|
1568
|
-
if (isObject(value))
|
|
1569
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1573
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1574
|
+
if (isObject(value)) value = (0, import_utils13.arrayzeValue)(value);
|
|
1570
1575
|
const CSSvar = `--font-family-${key}`;
|
|
1571
1576
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1572
1577
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1579,8 +1584,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1579
1584
|
for (const prop in FACTORY2) {
|
|
1580
1585
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1581
1586
|
const mediaValue = FACTORY2[prop];
|
|
1582
|
-
if (!isPropMedia)
|
|
1583
|
-
continue;
|
|
1587
|
+
if (!isPropMedia) continue;
|
|
1584
1588
|
const { mediaRegenerate } = FACTORY2;
|
|
1585
1589
|
const mediaName = prop.slice(1);
|
|
1586
1590
|
const {
|
|
@@ -1658,13 +1662,12 @@ var getFontSizeByKey = (value) => {
|
|
|
1658
1662
|
};
|
|
1659
1663
|
|
|
1660
1664
|
// src/system/spacing.js
|
|
1661
|
-
var
|
|
1665
|
+
var import_utils17 = __toESM(require_cjs(), 1);
|
|
1662
1666
|
var runThroughMedia2 = (FACTORY2) => {
|
|
1663
1667
|
for (const prop in FACTORY2) {
|
|
1664
1668
|
const mediaProps = FACTORY2[prop];
|
|
1665
1669
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1666
|
-
if (!isMediaName)
|
|
1667
|
-
continue;
|
|
1670
|
+
if (!isMediaName) continue;
|
|
1668
1671
|
const {
|
|
1669
1672
|
type,
|
|
1670
1673
|
base,
|
|
@@ -1701,8 +1704,7 @@ var applySpacingSequence = () => {
|
|
|
1701
1704
|
var getSequence = (sequenceProps) => {
|
|
1702
1705
|
const CONFIG2 = getActiveConfig();
|
|
1703
1706
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1704
|
-
if (!sequenceProps)
|
|
1705
|
-
return SPACING2;
|
|
1707
|
+
if (!sequenceProps) return SPACING2;
|
|
1706
1708
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1707
1709
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1708
1710
|
};
|
|
@@ -1711,9 +1713,8 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1711
1713
|
if (isString(value) && (value.includes("calc") || value.includes("var"))) {
|
|
1712
1714
|
return { [propertyName]: value };
|
|
1713
1715
|
}
|
|
1714
|
-
const stack = (0,
|
|
1715
|
-
if (!isArray(stack))
|
|
1716
|
-
return;
|
|
1716
|
+
const stack = (0, import_utils17.arrayzeValue)(value);
|
|
1717
|
+
if (!isArray(stack)) return;
|
|
1717
1718
|
if (stack.length > 1) {
|
|
1718
1719
|
let suffix = "";
|
|
1719
1720
|
if (propertyName === "borderWidth") {
|
|
@@ -1792,15 +1793,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1792
1793
|
if (isString(value) && value.includes(",")) {
|
|
1793
1794
|
value = value.split(",").map((v) => {
|
|
1794
1795
|
v = v.trim();
|
|
1795
|
-
if (v.startsWith("--"))
|
|
1796
|
-
|
|
1797
|
-
if (
|
|
1798
|
-
return getColor(v);
|
|
1799
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1800
|
-
return v;
|
|
1796
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1797
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1798
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1801
1799
|
const arr = v.split(" ");
|
|
1802
|
-
if (!arr.length)
|
|
1803
|
-
return v;
|
|
1800
|
+
if (!arr.length) return v;
|
|
1804
1801
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1805
1802
|
}).join(" ");
|
|
1806
1803
|
}
|
|
@@ -1815,32 +1812,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1815
1812
|
};
|
|
1816
1813
|
var getShadow = (value, globalTheme) => {
|
|
1817
1814
|
const CONFIG2 = getActiveConfig();
|
|
1818
|
-
if (!globalTheme)
|
|
1819
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1815
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1820
1816
|
if (!isString(value)) {
|
|
1821
|
-
if (CONFIG2.verbose)
|
|
1822
|
-
console.warn(value, "- type for color is not valid");
|
|
1817
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1823
1818
|
return;
|
|
1824
1819
|
}
|
|
1825
|
-
if (value.slice(0, 2) === "--")
|
|
1826
|
-
return `var(${value})`;
|
|
1820
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1827
1821
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1828
1822
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1829
1823
|
const val = SHADOW2[name];
|
|
1830
1824
|
const isObj = isObject(val);
|
|
1831
1825
|
if (!val) {
|
|
1832
|
-
if (CONFIG2.verbose)
|
|
1833
|
-
console.warn("Can't find color ", name);
|
|
1826
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1834
1827
|
return value;
|
|
1835
1828
|
}
|
|
1836
1829
|
if (globalTheme) {
|
|
1837
|
-
if (val[globalTheme])
|
|
1838
|
-
|
|
1839
|
-
else if (CONFIG2.verbose)
|
|
1840
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1830
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1831
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1841
1832
|
}
|
|
1842
|
-
if (isObj && val.value)
|
|
1843
|
-
return val.value;
|
|
1833
|
+
if (isObj && val.value) return val.value;
|
|
1844
1834
|
if (isObj) {
|
|
1845
1835
|
const obj = {};
|
|
1846
1836
|
for (const mediaName in val) {
|
|
@@ -1850,13 +1840,12 @@ var getShadow = (value, globalTheme) => {
|
|
|
1850
1840
|
}
|
|
1851
1841
|
return obj;
|
|
1852
1842
|
}
|
|
1853
|
-
if (CONFIG2.verbose)
|
|
1854
|
-
console.warn("Can't find color", value);
|
|
1843
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1855
1844
|
return value;
|
|
1856
1845
|
};
|
|
1857
1846
|
|
|
1858
1847
|
// src/system/timing.js
|
|
1859
|
-
var
|
|
1848
|
+
var import_utils21 = __toESM(require_cjs(), 1);
|
|
1860
1849
|
var applyTimingSequence = () => {
|
|
1861
1850
|
const CONFIG2 = getActiveConfig();
|
|
1862
1851
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -1866,7 +1855,7 @@ var applyTimingSequence = () => {
|
|
|
1866
1855
|
var getTimingFunction = (value) => {
|
|
1867
1856
|
const CONFIG2 = getActiveConfig();
|
|
1868
1857
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
1869
|
-
return TIMING2[value] || TIMING2[(0,
|
|
1858
|
+
return TIMING2[value] || TIMING2[(0, import_utils21.toCamelCase)(value)] || value;
|
|
1870
1859
|
};
|
|
1871
1860
|
var getTimingByKey = (value, property = "timing") => {
|
|
1872
1861
|
const CONFIG2 = getActiveConfig();
|
|
@@ -1891,15 +1880,13 @@ var applyDocument = () => {
|
|
|
1891
1880
|
};
|
|
1892
1881
|
|
|
1893
1882
|
// src/system/svg.js
|
|
1894
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
1895
1883
|
var DEF_OPTIONS = {
|
|
1896
|
-
document:
|
|
1884
|
+
document: document2
|
|
1897
1885
|
};
|
|
1898
1886
|
var setSVG = (val, key) => {
|
|
1899
1887
|
const CONFIG2 = getActiveConfig();
|
|
1900
1888
|
if (!val) {
|
|
1901
|
-
if (CONFIG2.verbose)
|
|
1902
|
-
console.warn("setSVG: val is not defined", key);
|
|
1889
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1903
1890
|
return;
|
|
1904
1891
|
}
|
|
1905
1892
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1910,8 +1897,7 @@ var setSVG = (val, key) => {
|
|
|
1910
1897
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1911
1898
|
const CONFIG2 = getActiveConfig();
|
|
1912
1899
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
1913
|
-
for (const key in LIBRARY)
|
|
1914
|
-
lib[key] = CONFIG2.SVG[key];
|
|
1900
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
1915
1901
|
appendSVG(lib, options);
|
|
1916
1902
|
};
|
|
1917
1903
|
var setSvgIcon = (val, key) => {
|
|
@@ -1925,14 +1911,12 @@ var setSvgIcon = (val, key) => {
|
|
|
1925
1911
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
1926
1912
|
const CONFIG2 = getActiveConfig();
|
|
1927
1913
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
1928
|
-
for (const key in LIBRARY)
|
|
1929
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
1914
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
1930
1915
|
appendSVG(lib, options);
|
|
1931
1916
|
};
|
|
1932
1917
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
1933
|
-
if (!
|
|
1934
|
-
|
|
1935
|
-
const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1918
|
+
if (!document2 || !document2.createElementNS) return;
|
|
1919
|
+
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1936
1920
|
if (options.isRoot) {
|
|
1937
1921
|
svgElem.setAttribute("aria-hidden", "true");
|
|
1938
1922
|
svgElem.setAttribute("width", "0");
|
|
@@ -1944,7 +1928,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
|
1944
1928
|
};
|
|
1945
1929
|
var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
1946
1930
|
const CONFIG2 = getActiveConfig();
|
|
1947
|
-
const doc = options.document ||
|
|
1931
|
+
const doc = options.document || document2;
|
|
1948
1932
|
if (!doc || !doc.documentElement) {
|
|
1949
1933
|
if (CONFIG2.verbose) {
|
|
1950
1934
|
console.warn("To append SVG sprites it should be run in browser environment");
|
|
@@ -1987,8 +1971,7 @@ var applyReset = (reset = {}) => {
|
|
|
1987
1971
|
}
|
|
1988
1972
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1989
1973
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1990
|
-
if (RESET2.html)
|
|
1991
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1974
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1992
1975
|
return deepMerge(merge(RESET2, reset), {
|
|
1993
1976
|
html: {
|
|
1994
1977
|
position: "absolute",
|