@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/set.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
|
});
|
|
@@ -309,19 +333,18 @@ __export(set_exports, {
|
|
|
309
333
|
});
|
|
310
334
|
module.exports = __toCommonJS(set_exports);
|
|
311
335
|
|
|
312
|
-
// ../../node_modules/@domql/utils/
|
|
336
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
313
337
|
var window2 = globalThis;
|
|
314
338
|
var document2 = window2.document;
|
|
315
339
|
|
|
316
|
-
// ../../node_modules/@domql/utils/
|
|
340
|
+
// ../../node_modules/@domql/utils/node.js
|
|
317
341
|
var isDOMNode = (obj) => {
|
|
318
342
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
319
343
|
};
|
|
320
344
|
|
|
321
|
-
// ../../node_modules/@domql/utils/
|
|
345
|
+
// ../../node_modules/@domql/utils/types.js
|
|
322
346
|
var isObject = (arg) => {
|
|
323
|
-
if (arg === null)
|
|
324
|
-
return false;
|
|
347
|
+
if (arg === null) return false;
|
|
325
348
|
return typeof arg === "object" && arg.constructor === Object;
|
|
326
349
|
};
|
|
327
350
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -330,44 +353,99 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
330
353
|
var isNull = (arg) => arg === null;
|
|
331
354
|
var isArray = (arg) => Array.isArray(arg);
|
|
332
355
|
var isObjectLike = (arg) => {
|
|
333
|
-
if (arg === null)
|
|
334
|
-
return false;
|
|
356
|
+
if (arg === null) return false;
|
|
335
357
|
return typeof arg === "object";
|
|
336
358
|
};
|
|
337
359
|
var isUndefined = (arg) => {
|
|
338
360
|
return arg === void 0;
|
|
339
361
|
};
|
|
340
362
|
|
|
341
|
-
// ../../node_modules/@domql/utils/
|
|
342
|
-
var
|
|
343
|
-
return arr.reduce(
|
|
363
|
+
// ../../node_modules/@domql/utils/array.js
|
|
364
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
365
|
+
return arr.reduce(
|
|
366
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
367
|
+
{}
|
|
368
|
+
);
|
|
344
369
|
};
|
|
345
370
|
|
|
346
|
-
// ../../node_modules/@domql/utils/
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
371
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
372
|
+
var STATE_METHODS = [
|
|
373
|
+
"update",
|
|
374
|
+
"parse",
|
|
375
|
+
"clean",
|
|
376
|
+
"create",
|
|
377
|
+
"destroy",
|
|
378
|
+
"add",
|
|
379
|
+
"toggle",
|
|
380
|
+
"remove",
|
|
381
|
+
"apply",
|
|
382
|
+
"set",
|
|
383
|
+
"reset",
|
|
384
|
+
"replace",
|
|
385
|
+
"quietReplace",
|
|
386
|
+
"quietUpdate",
|
|
387
|
+
"applyReplace",
|
|
388
|
+
"applyFunction",
|
|
389
|
+
"keys",
|
|
390
|
+
"values",
|
|
391
|
+
"ref",
|
|
392
|
+
"rootUpdate",
|
|
393
|
+
"parentUpdate",
|
|
394
|
+
"parent",
|
|
395
|
+
"__element",
|
|
396
|
+
"__depends",
|
|
397
|
+
"__ref",
|
|
398
|
+
"__children",
|
|
399
|
+
"root",
|
|
400
|
+
"setByPath",
|
|
401
|
+
"setPathCollection",
|
|
402
|
+
"removeByPath",
|
|
403
|
+
"removePathCollection",
|
|
404
|
+
"getByPath"
|
|
405
|
+
];
|
|
406
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
407
|
+
var METHODS = [
|
|
408
|
+
"set",
|
|
409
|
+
"reset",
|
|
410
|
+
"update",
|
|
411
|
+
"remove",
|
|
412
|
+
"updateContent",
|
|
413
|
+
"removeContent",
|
|
414
|
+
"lookup",
|
|
415
|
+
"lookdown",
|
|
416
|
+
"lookdownAll",
|
|
417
|
+
"getRef",
|
|
418
|
+
"getPath",
|
|
419
|
+
"setNodeStyles",
|
|
420
|
+
"spotByPath",
|
|
421
|
+
"keys",
|
|
422
|
+
"parse",
|
|
423
|
+
"setProps",
|
|
424
|
+
"parseDeep",
|
|
425
|
+
"variables",
|
|
426
|
+
"if",
|
|
427
|
+
"log",
|
|
428
|
+
"verbose",
|
|
429
|
+
"warn",
|
|
430
|
+
"error",
|
|
431
|
+
"call",
|
|
432
|
+
"nextElement",
|
|
433
|
+
"previousElement"
|
|
434
|
+
];
|
|
435
|
+
var METHODS_EXL = [
|
|
436
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
437
|
+
...METHODS,
|
|
438
|
+
...STATE_METHODS,
|
|
439
|
+
...PROPS_METHODS
|
|
440
|
+
];
|
|
441
|
+
|
|
442
|
+
// ../../node_modules/@domql/utils/object.js
|
|
366
443
|
var merge = (element, obj, excludeFrom = []) => {
|
|
367
444
|
for (const e in obj) {
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
445
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
446
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
370
447
|
continue;
|
|
448
|
+
}
|
|
371
449
|
const elementProp = element[e];
|
|
372
450
|
const objProp = obj[e];
|
|
373
451
|
if (elementProp === void 0) {
|
|
@@ -376,11 +454,12 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
376
454
|
}
|
|
377
455
|
return element;
|
|
378
456
|
};
|
|
379
|
-
var deepMerge = (element, extend, excludeFrom =
|
|
457
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
380
458
|
for (const e in extend) {
|
|
381
|
-
const
|
|
382
|
-
if (!
|
|
459
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
460
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
383
461
|
continue;
|
|
462
|
+
}
|
|
384
463
|
const elementProp = element[e];
|
|
385
464
|
const extendProp = extend[e];
|
|
386
465
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -398,7 +477,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
398
477
|
cleanNull = false,
|
|
399
478
|
window: targetWindow,
|
|
400
479
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
401
|
-
|
|
480
|
+
handleExtends = false
|
|
402
481
|
} = options;
|
|
403
482
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
404
483
|
return obj;
|
|
@@ -406,37 +485,39 @@ var deepClone = (obj, options = {}) => {
|
|
|
406
485
|
if (visited.has(obj)) {
|
|
407
486
|
return visited.get(obj);
|
|
408
487
|
}
|
|
409
|
-
const
|
|
410
|
-
visited.set(obj,
|
|
488
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
489
|
+
visited.set(obj, clone);
|
|
411
490
|
for (const key in obj) {
|
|
412
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
413
|
-
|
|
414
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
491
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
492
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
415
493
|
continue;
|
|
494
|
+
}
|
|
416
495
|
const value = obj[key];
|
|
417
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
496
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
418
497
|
continue;
|
|
498
|
+
}
|
|
419
499
|
if (isDOMNode(value)) {
|
|
420
|
-
|
|
500
|
+
clone[key] = value;
|
|
421
501
|
continue;
|
|
422
502
|
}
|
|
423
|
-
if (
|
|
424
|
-
|
|
503
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
504
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
425
505
|
continue;
|
|
426
506
|
}
|
|
427
507
|
if (isFunction(value) && targetWindow) {
|
|
428
|
-
|
|
508
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
429
509
|
continue;
|
|
430
510
|
}
|
|
431
511
|
if (isObjectLike(value)) {
|
|
432
|
-
|
|
512
|
+
clone[key] = deepClone(value, {
|
|
513
|
+
...options,
|
|
433
514
|
visited
|
|
434
|
-
})
|
|
515
|
+
});
|
|
435
516
|
} else {
|
|
436
|
-
|
|
517
|
+
clone[key] = value;
|
|
437
518
|
}
|
|
438
519
|
}
|
|
439
|
-
return
|
|
520
|
+
return clone;
|
|
440
521
|
};
|
|
441
522
|
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
442
523
|
const excl = opts.exclude || [];
|
|
@@ -444,14 +525,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
444
525
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
445
526
|
return params;
|
|
446
527
|
}
|
|
447
|
-
if (visited.has(obj))
|
|
448
|
-
return visited.get(obj);
|
|
528
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
449
529
|
visited.set(obj, obj);
|
|
450
530
|
for (const e in params) {
|
|
451
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
452
|
-
|
|
453
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
454
|
-
continue;
|
|
531
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
532
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
455
533
|
const objProp = obj[e];
|
|
456
534
|
const paramsProp = params[e];
|
|
457
535
|
if (isDOMNode(paramsProp)) {
|
|
@@ -465,7 +543,7 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
465
543
|
return obj;
|
|
466
544
|
};
|
|
467
545
|
|
|
468
|
-
// ../../node_modules/@domql/utils/
|
|
546
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
469
547
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
470
548
|
|
|
471
549
|
// src/defaultConfig/index.js
|
|
@@ -689,8 +767,7 @@ var getActiveConfig = (def) => {
|
|
|
689
767
|
return FACTORY[def || FACTORY.active] || CONFIG;
|
|
690
768
|
};
|
|
691
769
|
var setActiveConfig = (newConfig) => {
|
|
692
|
-
if (!isObject(newConfig))
|
|
693
|
-
return;
|
|
770
|
+
if (!isObject(newConfig)) return;
|
|
694
771
|
FACTORY.active = "1";
|
|
695
772
|
FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
|
|
696
773
|
return newConfig;
|
|
@@ -702,12 +779,9 @@ var isScalingUnit = (unit) => {
|
|
|
702
779
|
};
|
|
703
780
|
|
|
704
781
|
// src/utils/color.js
|
|
705
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
706
782
|
var colorStringToRgbaArray = (color) => {
|
|
707
|
-
if (color === "")
|
|
708
|
-
|
|
709
|
-
if (color.toLowerCase() === "transparent")
|
|
710
|
-
return [0, 0, 0, 0];
|
|
783
|
+
if (color === "") return [0, 0, 0, 0];
|
|
784
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
711
785
|
if (color[0] === "#") {
|
|
712
786
|
if (color.length < 7) {
|
|
713
787
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -720,26 +794,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
720
794
|
];
|
|
721
795
|
}
|
|
722
796
|
if (color.indexOf("rgb") === -1) {
|
|
723
|
-
if (
|
|
724
|
-
const elem =
|
|
797
|
+
if (document2 && window2) {
|
|
798
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
725
799
|
const flag = "rgb(1, 2, 3)";
|
|
726
800
|
elem.style.color = flag;
|
|
727
801
|
if (elem.style.color !== flag) {
|
|
728
|
-
|
|
802
|
+
document2.body.removeChild(elem);
|
|
729
803
|
return;
|
|
730
804
|
}
|
|
731
805
|
elem.style.color = color;
|
|
732
806
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
733
|
-
|
|
807
|
+
document2.body.removeChild(elem);
|
|
734
808
|
return [0, 0, 0, 0];
|
|
735
809
|
}
|
|
736
|
-
color =
|
|
737
|
-
|
|
810
|
+
color = window2.getComputedStyle(elem).color;
|
|
811
|
+
document2.body.removeChild(elem);
|
|
738
812
|
}
|
|
739
813
|
}
|
|
740
814
|
if (color.indexOf("rgb") === 0) {
|
|
741
|
-
if (color.indexOf("rgba") === -1)
|
|
742
|
-
color = `${color}, 1`;
|
|
815
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
743
816
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
744
817
|
}
|
|
745
818
|
return [0, 0, 0, 0];
|
|
@@ -765,29 +838,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
765
838
|
var getColorShade = (col, amt) => {
|
|
766
839
|
const num = parseInt(col, 16);
|
|
767
840
|
let r = (num >> 16) + amt;
|
|
768
|
-
if (r > 255)
|
|
769
|
-
|
|
770
|
-
else if (r < 0)
|
|
771
|
-
r = 0;
|
|
841
|
+
if (r > 255) r = 255;
|
|
842
|
+
else if (r < 0) r = 0;
|
|
772
843
|
let b = (num >> 8 & 255) + amt;
|
|
773
|
-
if (b > 255)
|
|
774
|
-
|
|
775
|
-
else if (b < 0)
|
|
776
|
-
b = 0;
|
|
844
|
+
if (b > 255) b = 255;
|
|
845
|
+
else if (b < 0) b = 0;
|
|
777
846
|
let g = (num & 255) + amt;
|
|
778
|
-
if (g > 255)
|
|
779
|
-
|
|
780
|
-
else if (g < 0)
|
|
781
|
-
g = 0;
|
|
847
|
+
if (g > 255) g = 255;
|
|
848
|
+
else if (g < 0) g = 0;
|
|
782
849
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
783
850
|
};
|
|
784
851
|
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 += "";
|
|
852
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
853
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
854
|
+
if (isNumber(tone)) tone += "";
|
|
791
855
|
const toHex = rgbArrayToHex(rgb);
|
|
792
856
|
const abs = tone.slice(0, 1);
|
|
793
857
|
if (abs === "-" || abs === "+") {
|
|
@@ -804,10 +868,8 @@ var getRgbTone = (rgb, tone) => {
|
|
|
804
868
|
|
|
805
869
|
// src/utils/font.js
|
|
806
870
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
807
|
-
if (LIBRARY[key])
|
|
808
|
-
|
|
809
|
-
if (LIBRARY.default)
|
|
810
|
-
return LIBRARY[LIBRARY.default].value;
|
|
871
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
872
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
811
873
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
812
874
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
813
875
|
};
|
|
@@ -829,7 +891,7 @@ var getFontFaceEach = (name, weights) => {
|
|
|
829
891
|
};
|
|
830
892
|
|
|
831
893
|
// src/utils/sequence.js
|
|
832
|
-
var
|
|
894
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
833
895
|
var numToLetterMap = {
|
|
834
896
|
"-6": "U",
|
|
835
897
|
"-5": "V",
|
|
@@ -875,8 +937,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
875
937
|
var setScalingVar = (key, sequenceProps) => {
|
|
876
938
|
const { base, type, unit } = sequenceProps;
|
|
877
939
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
878
|
-
if (key === 0)
|
|
879
|
-
return defaultVal;
|
|
940
|
+
if (key === 0) return defaultVal;
|
|
880
941
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
881
942
|
const ratioVar = `${prefix}-ratio`;
|
|
882
943
|
if (key > 0) {
|
|
@@ -913,10 +974,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
913
974
|
const diffRounded = ~~next - ~~value;
|
|
914
975
|
let arr;
|
|
915
976
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
916
|
-
if (diffRounded > 16)
|
|
917
|
-
|
|
918
|
-
else
|
|
919
|
-
arr = [first, second];
|
|
977
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
978
|
+
else arr = [first, second];
|
|
920
979
|
arr.forEach((v, k) => {
|
|
921
980
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
922
981
|
const newVar = variable + (k + 1);
|
|
@@ -958,8 +1017,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
958
1017
|
index: key
|
|
959
1018
|
};
|
|
960
1019
|
setSequenceValue(props, sequenceProps);
|
|
961
|
-
if (subSequence)
|
|
962
|
-
generateSubSequence(props, sequenceProps);
|
|
1020
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
963
1021
|
}
|
|
964
1022
|
return sequenceProps;
|
|
965
1023
|
};
|
|
@@ -971,13 +1029,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
971
1029
|
unit = UNIT2.default,
|
|
972
1030
|
useVariable
|
|
973
1031
|
} = sequenceProps;
|
|
974
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
975
|
-
|
|
976
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1032
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1033
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
977
1034
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
978
1035
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
979
|
-
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)
|
|
980
|
-
return value;
|
|
1036
|
+
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;
|
|
981
1037
|
const letterVal = value.toUpperCase();
|
|
982
1038
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
983
1039
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1001,8 +1057,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1001
1057
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1002
1058
|
}
|
|
1003
1059
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1004
|
-
if (CONFIG2.verbose)
|
|
1005
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1060
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1006
1061
|
absValue = absValue.slice(0, 1);
|
|
1007
1062
|
}
|
|
1008
1063
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1010,8 +1065,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1010
1065
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1011
1066
|
}
|
|
1012
1067
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1013
|
-
if (!sequenceItem)
|
|
1014
|
-
return console.warn("can't find", sequence, absValue);
|
|
1068
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1015
1069
|
if (unit === "ms" || unit === "s") {
|
|
1016
1070
|
return isNegative + sequenceItem.val + unit;
|
|
1017
1071
|
}
|
|
@@ -1020,12 +1074,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1020
1074
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1021
1075
|
if (typeof value !== "string") {
|
|
1022
1076
|
const CONFIG2 = getActiveConfig();
|
|
1023
|
-
if (CONFIG2.verbose)
|
|
1024
|
-
console.warn(propertyName, value, "is not a string");
|
|
1077
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1025
1078
|
return { [propertyName]: value };
|
|
1026
1079
|
}
|
|
1027
|
-
if (value === "-" || value === "")
|
|
1028
|
-
return {};
|
|
1080
|
+
if (value === "-" || value === "") return {};
|
|
1029
1081
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1030
1082
|
};
|
|
1031
1083
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1085,23 +1137,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1085
1137
|
const { mediaRegenerate } = FACTORY2;
|
|
1086
1138
|
const { sequence, scales } = FACTORY2[media];
|
|
1087
1139
|
const query = MEDIA2[mediaName];
|
|
1088
|
-
if (!query && CONFIG2.verbose)
|
|
1089
|
-
console.warn("Can't find media query ", query);
|
|
1140
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1090
1141
|
if (!mediaRegenerate) {
|
|
1091
1142
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1092
|
-
if (!underMediaQuery)
|
|
1093
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1143
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1094
1144
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1095
1145
|
return;
|
|
1096
1146
|
}
|
|
1097
1147
|
for (const key in sequence) {
|
|
1098
1148
|
const item = sequence[key];
|
|
1099
1149
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1100
|
-
if (!query && CONFIG2.verbose)
|
|
1101
|
-
console.warn("Can't find query ", query);
|
|
1150
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1102
1151
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1103
|
-
if (!underMediaQuery)
|
|
1104
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1152
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1105
1153
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1106
1154
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1107
1155
|
}
|
|
@@ -1158,27 +1206,21 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1158
1206
|
var getColor = (value, key, config) => {
|
|
1159
1207
|
const CONFIG2 = config || getActiveConfig();
|
|
1160
1208
|
if (!isString(value)) {
|
|
1161
|
-
if (CONFIG2.verbose)
|
|
1162
|
-
console.warn(value, "- type for color is not valid");
|
|
1209
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1163
1210
|
return;
|
|
1164
1211
|
}
|
|
1165
|
-
if (value.slice(0, 2) === "--")
|
|
1166
|
-
|
|
1167
|
-
if (key && value[key])
|
|
1168
|
-
value = value[key];
|
|
1212
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1213
|
+
if (key && value[key]) value = value[key];
|
|
1169
1214
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1170
1215
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1171
1216
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1172
1217
|
if (!val) {
|
|
1173
|
-
if (CONFIG2.verbose)
|
|
1174
|
-
console.warn("Can't find color ", name);
|
|
1218
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1175
1219
|
return value;
|
|
1176
1220
|
}
|
|
1177
1221
|
if (key) {
|
|
1178
|
-
if (val[key])
|
|
1179
|
-
|
|
1180
|
-
else if (CONFIG2.verbose)
|
|
1181
|
-
console.warn(value, " - does not have ", key);
|
|
1222
|
+
if (val[key]) val = val[key];
|
|
1223
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1182
1224
|
}
|
|
1183
1225
|
let rgb = val.rgb;
|
|
1184
1226
|
if (!rgb) {
|
|
@@ -1188,10 +1230,8 @@ var getColor = (value, key, config) => {
|
|
|
1188
1230
|
rgb = getRgbTone(rgb, tone);
|
|
1189
1231
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1190
1232
|
}
|
|
1191
|
-
if (val[tone])
|
|
1192
|
-
|
|
1193
|
-
if (alpha)
|
|
1194
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1233
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1234
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1195
1235
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1196
1236
|
};
|
|
1197
1237
|
var setColor = (val, key, suffix) => {
|
|
@@ -1199,8 +1239,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1199
1239
|
if (isString(val) && val.slice(0, 2) === "--") {
|
|
1200
1240
|
val = getColor(val.slice(2));
|
|
1201
1241
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1202
|
-
if (CONFIG2.verbose)
|
|
1203
|
-
console.warn(val, "- referred but does not exist");
|
|
1242
|
+
if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
|
|
1204
1243
|
val = val.split(" ")[0];
|
|
1205
1244
|
}
|
|
1206
1245
|
}
|
|
@@ -1239,8 +1278,7 @@ var setColor = (val, key, suffix) => {
|
|
|
1239
1278
|
};
|
|
1240
1279
|
var setGradient = (val, key, suffix) => {
|
|
1241
1280
|
const CONFIG2 = getActiveConfig();
|
|
1242
|
-
if (isString(val) && val.slice(0, 2) === "--")
|
|
1243
|
-
val = getColor(val.slice(2));
|
|
1281
|
+
if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
|
|
1244
1282
|
if (isArray(val)) {
|
|
1245
1283
|
return {
|
|
1246
1284
|
"@light": setGradient(val[0], key, "light"),
|
|
@@ -1249,8 +1287,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1249
1287
|
}
|
|
1250
1288
|
if (isObject(val)) {
|
|
1251
1289
|
const obj = {};
|
|
1252
|
-
for (const variant in val)
|
|
1253
|
-
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1290
|
+
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1254
1291
|
return obj;
|
|
1255
1292
|
}
|
|
1256
1293
|
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
@@ -1276,22 +1313,19 @@ var setThemeValue = (theme) => {
|
|
|
1276
1313
|
return value;
|
|
1277
1314
|
};
|
|
1278
1315
|
var getThemeValue = (theme) => {
|
|
1279
|
-
if (theme.value)
|
|
1280
|
-
return theme.value;
|
|
1316
|
+
if (theme.value) return theme.value;
|
|
1281
1317
|
theme.value = setThemeValue(theme);
|
|
1282
1318
|
return theme.value;
|
|
1283
1319
|
};
|
|
1284
1320
|
var getTheme = (value, modifier) => {
|
|
1285
1321
|
const CONFIG2 = getActiveConfig();
|
|
1286
|
-
if (CONFIG2.useVariable)
|
|
1287
|
-
return getMediaTheme(value, modifier);
|
|
1322
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1288
1323
|
const { THEME: THEME2 } = CONFIG2;
|
|
1289
1324
|
if (isString(value)) {
|
|
1290
1325
|
const [theme, subtheme] = value.split(" ");
|
|
1291
1326
|
const isOurTheme = THEME2[theme];
|
|
1292
1327
|
if (isOurTheme) {
|
|
1293
|
-
if (!subtheme && !modifier)
|
|
1294
|
-
return getThemeValue(isOurTheme);
|
|
1328
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1295
1329
|
value = [theme, subtheme || modifier];
|
|
1296
1330
|
}
|
|
1297
1331
|
}
|
|
@@ -1299,14 +1333,10 @@ var getTheme = (value, modifier) => {
|
|
|
1299
1333
|
const themeName = value[0];
|
|
1300
1334
|
const subThemeName = value[1];
|
|
1301
1335
|
const { helpers, media, state } = THEME2[themeName];
|
|
1302
|
-
if (media && media[subThemeName])
|
|
1303
|
-
|
|
1304
|
-
if (
|
|
1305
|
-
|
|
1306
|
-
if (state && state[subThemeName])
|
|
1307
|
-
return getThemeValue(state[subThemeName]);
|
|
1308
|
-
} else if (isObject(value))
|
|
1309
|
-
return setThemeValue(value);
|
|
1336
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
1337
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1338
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1339
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
1310
1340
|
};
|
|
1311
1341
|
var setInverseTheme = (theme, variant, value) => {
|
|
1312
1342
|
if (isObject(variant)) {
|
|
@@ -1324,13 +1354,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1324
1354
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1325
1355
|
const result = getTheme(variant);
|
|
1326
1356
|
themeValue[`&:${key}`] = result;
|
|
1327
|
-
if (isObject(variant) && !variant.value)
|
|
1328
|
-
variant.value = result;
|
|
1357
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1329
1358
|
};
|
|
1330
1359
|
var setSelectors = (theme, value) => {
|
|
1331
1360
|
const { state } = theme;
|
|
1332
|
-
if (!state)
|
|
1333
|
-
return;
|
|
1361
|
+
if (!state) return;
|
|
1334
1362
|
const keys = Object.keys(state);
|
|
1335
1363
|
keys.map((key) => {
|
|
1336
1364
|
const variant = state[key];
|
|
@@ -1342,20 +1370,16 @@ var setSelectors = (theme, value) => {
|
|
|
1342
1370
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1343
1371
|
const result = getTheme(variant);
|
|
1344
1372
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1345
|
-
if (isObject(variant) && !variant.value)
|
|
1346
|
-
variant.value = result;
|
|
1373
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1347
1374
|
};
|
|
1348
1375
|
var setMedia = (theme, value) => {
|
|
1349
1376
|
const { media } = theme;
|
|
1350
|
-
if (!media)
|
|
1351
|
-
return;
|
|
1377
|
+
if (!media) return;
|
|
1352
1378
|
const keys = Object.keys(media);
|
|
1353
1379
|
keys.map((key) => {
|
|
1354
1380
|
const variant = media[key];
|
|
1355
|
-
if (key === "dark" || key === "light")
|
|
1356
|
-
|
|
1357
|
-
if (key === "inverse")
|
|
1358
|
-
setInverseTheme(theme, variant, value);
|
|
1381
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
1382
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
1359
1383
|
return theme;
|
|
1360
1384
|
});
|
|
1361
1385
|
return theme;
|
|
@@ -1363,23 +1387,19 @@ var setMedia = (theme, value) => {
|
|
|
1363
1387
|
var setHelpers = (theme, value) => {
|
|
1364
1388
|
const CONFIG2 = getActiveConfig();
|
|
1365
1389
|
const { helpers } = theme;
|
|
1366
|
-
if (!helpers)
|
|
1367
|
-
return;
|
|
1390
|
+
if (!helpers) return;
|
|
1368
1391
|
const keys = Object.keys(helpers);
|
|
1369
1392
|
keys.map((key) => {
|
|
1370
1393
|
const helper = helpers[key];
|
|
1371
|
-
if (isString(helper))
|
|
1372
|
-
|
|
1373
|
-
else
|
|
1374
|
-
getThemeValue(helpers[key]);
|
|
1394
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
1395
|
+
else getThemeValue(helpers[key]);
|
|
1375
1396
|
return theme;
|
|
1376
1397
|
});
|
|
1377
1398
|
return theme;
|
|
1378
1399
|
};
|
|
1379
1400
|
var setTheme = (val, key) => {
|
|
1380
1401
|
const CONFIG2 = getActiveConfig();
|
|
1381
|
-
if (CONFIG2.useVariable)
|
|
1382
|
-
return setMediaTheme(val, key);
|
|
1402
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1383
1403
|
const { state, media, helpers } = val;
|
|
1384
1404
|
const value = setThemeValue(val, key);
|
|
1385
1405
|
const CSSvar = `--theme-${key}`;
|
|
@@ -1441,24 +1461,19 @@ var recursiveTheme = (val) => {
|
|
|
1441
1461
|
} else if (symb === ":") {
|
|
1442
1462
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1443
1463
|
}
|
|
1444
|
-
} else
|
|
1445
|
-
obj[param] = val[param];
|
|
1464
|
+
} else obj[param] = val[param];
|
|
1446
1465
|
}
|
|
1447
1466
|
return obj;
|
|
1448
1467
|
};
|
|
1449
1468
|
var findModifierFromArray = (val, modifierArray) => {
|
|
1450
1469
|
const currentMod = modifierArray.shift();
|
|
1451
|
-
if (val[currentMod])
|
|
1452
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1470
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
1453
1471
|
return val;
|
|
1454
1472
|
};
|
|
1455
1473
|
var findModifier = (val, modifier) => {
|
|
1456
|
-
if (isArray(modifier))
|
|
1457
|
-
|
|
1458
|
-
else
|
|
1459
|
-
return val[modifier];
|
|
1460
|
-
else
|
|
1461
|
-
return val;
|
|
1474
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1475
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1476
|
+
else return val;
|
|
1462
1477
|
};
|
|
1463
1478
|
var getMediaTheme = (value, modifier) => {
|
|
1464
1479
|
const activeConfig = getActiveConfig();
|
|
@@ -1481,11 +1496,10 @@ var getMediaTheme = (value, modifier) => {
|
|
|
1481
1496
|
};
|
|
1482
1497
|
|
|
1483
1498
|
// src/system/font.js
|
|
1484
|
-
var
|
|
1499
|
+
var import_utils13 = __toESM(require_cjs(), 1);
|
|
1485
1500
|
var setFont = (val, key) => {
|
|
1486
1501
|
const CSSvar = `--font-${key}`;
|
|
1487
|
-
if (!val || isArray(val) && !val[0])
|
|
1488
|
-
return;
|
|
1502
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
1489
1503
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1490
1504
|
return { var: CSSvar, value: val, fontFace };
|
|
1491
1505
|
};
|
|
@@ -1493,10 +1507,8 @@ var setFontFamily = (val, key) => {
|
|
|
1493
1507
|
const CONFIG2 = getActiveConfig();
|
|
1494
1508
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1495
1509
|
let { value, type } = val;
|
|
1496
|
-
if (val.isDefault)
|
|
1497
|
-
|
|
1498
|
-
if (isObject(value))
|
|
1499
|
-
value = (0, import_utils11.arrayzeValue)(value);
|
|
1510
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
1511
|
+
if (isObject(value)) value = (0, import_utils13.arrayzeValue)(value);
|
|
1500
1512
|
const CSSvar = `--font-family-${key}`;
|
|
1501
1513
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1502
1514
|
return { var: CSSvar, value: str, arr: value, type };
|
|
@@ -1509,8 +1521,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1509
1521
|
for (const prop in FACTORY2) {
|
|
1510
1522
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
1511
1523
|
const mediaValue = FACTORY2[prop];
|
|
1512
|
-
if (!isPropMedia)
|
|
1513
|
-
continue;
|
|
1524
|
+
if (!isPropMedia) continue;
|
|
1514
1525
|
const { mediaRegenerate } = FACTORY2;
|
|
1515
1526
|
const mediaName = prop.slice(1);
|
|
1516
1527
|
const {
|
|
@@ -1579,13 +1590,12 @@ var applyTypographySequence = () => {
|
|
|
1579
1590
|
};
|
|
1580
1591
|
|
|
1581
1592
|
// src/system/spacing.js
|
|
1582
|
-
var
|
|
1593
|
+
var import_utils17 = __toESM(require_cjs(), 1);
|
|
1583
1594
|
var runThroughMedia2 = (FACTORY2) => {
|
|
1584
1595
|
for (const prop in FACTORY2) {
|
|
1585
1596
|
const mediaProps = FACTORY2[prop];
|
|
1586
1597
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
1587
|
-
if (!isMediaName)
|
|
1588
|
-
continue;
|
|
1598
|
+
if (!isMediaName) continue;
|
|
1589
1599
|
const {
|
|
1590
1600
|
type,
|
|
1591
1601
|
base,
|
|
@@ -1622,8 +1632,7 @@ var applySpacingSequence = () => {
|
|
|
1622
1632
|
var getSequence = (sequenceProps) => {
|
|
1623
1633
|
const CONFIG2 = getActiveConfig();
|
|
1624
1634
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1625
|
-
if (!sequenceProps)
|
|
1626
|
-
return SPACING2;
|
|
1635
|
+
if (!sequenceProps) return SPACING2;
|
|
1627
1636
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1628
1637
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1629
1638
|
};
|
|
@@ -1632,9 +1641,8 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1632
1641
|
if (isString(value) && (value.includes("calc") || value.includes("var"))) {
|
|
1633
1642
|
return { [propertyName]: value };
|
|
1634
1643
|
}
|
|
1635
|
-
const stack = (0,
|
|
1636
|
-
if (!isArray(stack))
|
|
1637
|
-
return;
|
|
1644
|
+
const stack = (0, import_utils17.arrayzeValue)(value);
|
|
1645
|
+
if (!isArray(stack)) return;
|
|
1638
1646
|
if (stack.length > 1) {
|
|
1639
1647
|
let suffix = "";
|
|
1640
1648
|
if (propertyName === "borderWidth") {
|
|
@@ -1683,15 +1691,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1683
1691
|
if (isString(value) && value.includes(",")) {
|
|
1684
1692
|
value = value.split(",").map((v) => {
|
|
1685
1693
|
v = v.trim();
|
|
1686
|
-
if (v.startsWith("--"))
|
|
1687
|
-
|
|
1688
|
-
if (
|
|
1689
|
-
return getColor(v);
|
|
1690
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1691
|
-
return v;
|
|
1694
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
1695
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
1696
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1692
1697
|
const arr = v.split(" ");
|
|
1693
|
-
if (!arr.length)
|
|
1694
|
-
return v;
|
|
1698
|
+
if (!arr.length) return v;
|
|
1695
1699
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1696
1700
|
}).join(" ");
|
|
1697
1701
|
}
|
|
@@ -1706,7 +1710,7 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1706
1710
|
};
|
|
1707
1711
|
|
|
1708
1712
|
// src/system/timing.js
|
|
1709
|
-
var
|
|
1713
|
+
var import_utils21 = __toESM(require_cjs(), 1);
|
|
1710
1714
|
var applyTimingSequence = () => {
|
|
1711
1715
|
const CONFIG2 = getActiveConfig();
|
|
1712
1716
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -1727,12 +1731,10 @@ var applyDocument = () => {
|
|
|
1727
1731
|
};
|
|
1728
1732
|
|
|
1729
1733
|
// src/system/svg.js
|
|
1730
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
1731
1734
|
var setSVG = (val, key) => {
|
|
1732
1735
|
const CONFIG2 = getActiveConfig();
|
|
1733
1736
|
if (!val) {
|
|
1734
|
-
if (CONFIG2.verbose)
|
|
1735
|
-
console.warn("setSVG: val is not defined", key);
|
|
1737
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
1736
1738
|
return;
|
|
1737
1739
|
}
|
|
1738
1740
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -1770,8 +1772,7 @@ var applyReset = (reset = {}) => {
|
|
|
1770
1772
|
}
|
|
1771
1773
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
1772
1774
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
1773
|
-
if (RESET2.html)
|
|
1774
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
1775
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
1775
1776
|
return deepMerge(merge(RESET2, reset), {
|
|
1776
1777
|
html: {
|
|
1777
1778
|
position: "absolute",
|
|
@@ -1812,8 +1813,7 @@ var applyReset = (reset = {}) => {
|
|
|
1812
1813
|
|
|
1813
1814
|
// src/set.js
|
|
1814
1815
|
var setCases = (val, key) => {
|
|
1815
|
-
if (isFunction(val))
|
|
1816
|
-
return val();
|
|
1816
|
+
if (isFunction(val)) return val();
|
|
1817
1817
|
return val;
|
|
1818
1818
|
};
|
|
1819
1819
|
var setSameValue = (val, key) => val;
|
|
@@ -1849,12 +1849,10 @@ var setValue = (FACTORY_NAME, value, key) => {
|
|
|
1849
1849
|
FACTORY2[key] = result;
|
|
1850
1850
|
return FACTORY2;
|
|
1851
1851
|
} catch (error) {
|
|
1852
|
-
if (CONFIG2.verbose)
|
|
1853
|
-
console.warn("Error setting", factoryName, "value", value, key, error);
|
|
1852
|
+
if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
|
|
1854
1853
|
}
|
|
1855
1854
|
}
|
|
1856
|
-
if (CONFIG2.verbose)
|
|
1857
|
-
console.warn("Can not find", factoryName, "method in scratch");
|
|
1855
|
+
if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
|
|
1858
1856
|
};
|
|
1859
1857
|
var setEach = (factoryName, props) => {
|
|
1860
1858
|
const CONFIG2 = getActiveConfig();
|
|
@@ -1883,38 +1881,23 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
1883
1881
|
if (options.newConfig) {
|
|
1884
1882
|
CONFIG2 = setActiveConfig(options.newConfig);
|
|
1885
1883
|
}
|
|
1886
|
-
if (verbose !== void 0)
|
|
1887
|
-
|
|
1888
|
-
if (
|
|
1889
|
-
|
|
1890
|
-
if (
|
|
1891
|
-
|
|
1892
|
-
if (
|
|
1893
|
-
|
|
1894
|
-
if (
|
|
1895
|
-
|
|
1896
|
-
if (
|
|
1897
|
-
|
|
1898
|
-
if (useDocumentTheme !== void 0)
|
|
1899
|
-
CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
1900
|
-
if (globalTheme !== void 0)
|
|
1901
|
-
CONFIG2.globalTheme = globalTheme;
|
|
1902
|
-
if (useDefaultConfig !== void 0)
|
|
1903
|
-
CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
1904
|
-
if (SEMANTIC_ICONS2 !== void 0)
|
|
1905
|
-
CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
1906
|
-
if (CONFIG2.verbose)
|
|
1907
|
-
console.log(CONFIG2);
|
|
1908
|
-
if (!CONFIG2.__svg_cache)
|
|
1909
|
-
CONFIG2.__svg_cache = {};
|
|
1884
|
+
if (verbose !== void 0) CONFIG2.verbose = verbose;
|
|
1885
|
+
if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
|
|
1886
|
+
if (useReset !== void 0) CONFIG2.useReset = useReset;
|
|
1887
|
+
if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
|
|
1888
|
+
if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
|
|
1889
|
+
if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
|
|
1890
|
+
if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
1891
|
+
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
1892
|
+
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
1893
|
+
if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
|
|
1894
|
+
if (CONFIG2.verbose) console.log(CONFIG2);
|
|
1895
|
+
if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
|
|
1910
1896
|
const keys = Object.keys(config);
|
|
1911
1897
|
keys.map((key) => setEach(key, config[key]));
|
|
1912
|
-
if (config.TYPOGRAPHY)
|
|
1913
|
-
|
|
1914
|
-
if (config.
|
|
1915
|
-
applySpacingSequence();
|
|
1916
|
-
if (config.TIMING)
|
|
1917
|
-
applyTimingSequence();
|
|
1898
|
+
if (config.TYPOGRAPHY) applyTypographySequence();
|
|
1899
|
+
if (config.SPACING) applySpacingSequence();
|
|
1900
|
+
if (config.TIMING) applyTimingSequence();
|
|
1918
1901
|
applyDocument();
|
|
1919
1902
|
applyReset();
|
|
1920
1903
|
return CONFIG2;
|