@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/theme.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: () => document4,
|
|
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 document4 = 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: () => arrayzeValue,
|
|
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 arrayzeValue = (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(theme_exports, {
|
|
|
309
333
|
});
|
|
310
334
|
module.exports = __toCommonJS(theme_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(
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var __defProp2 = Object.defineProperty;
|
|
348
|
-
var __defProps = Object.defineProperties;
|
|
349
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
350
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
351
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
352
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
353
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
354
|
-
var __spreadValues = (a, b) => {
|
|
355
|
-
for (var prop in b || (b = {}))
|
|
356
|
-
if (__hasOwnProp2.call(b, prop))
|
|
357
|
-
__defNormalProp(a, prop, b[prop]);
|
|
358
|
-
if (__getOwnPropSymbols)
|
|
359
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
360
|
-
if (__propIsEnum.call(b, prop))
|
|
361
|
-
__defNormalProp(a, prop, b[prop]);
|
|
362
|
-
}
|
|
363
|
-
return a;
|
|
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
|
+
);
|
|
364
369
|
};
|
|
365
|
-
|
|
366
|
-
|
|
370
|
+
|
|
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
|
|
443
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
367
444
|
for (const e in extend) {
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
445
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
446
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
370
447
|
continue;
|
|
448
|
+
}
|
|
371
449
|
const elementProp = element[e];
|
|
372
450
|
const extendProp = extend[e];
|
|
373
451
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -385,7 +463,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
385
463
|
cleanNull = false,
|
|
386
464
|
window: targetWindow,
|
|
387
465
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
388
|
-
|
|
466
|
+
handleExtends = false
|
|
389
467
|
} = options;
|
|
390
468
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
391
469
|
return obj;
|
|
@@ -393,40 +471,42 @@ var deepClone = (obj, options = {}) => {
|
|
|
393
471
|
if (visited.has(obj)) {
|
|
394
472
|
return visited.get(obj);
|
|
395
473
|
}
|
|
396
|
-
const
|
|
397
|
-
visited.set(obj,
|
|
474
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
475
|
+
visited.set(obj, clone);
|
|
398
476
|
for (const key in obj) {
|
|
399
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
400
|
-
|
|
401
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
477
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
478
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
402
479
|
continue;
|
|
480
|
+
}
|
|
403
481
|
const value = obj[key];
|
|
404
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
482
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
405
483
|
continue;
|
|
484
|
+
}
|
|
406
485
|
if (isDOMNode(value)) {
|
|
407
|
-
|
|
486
|
+
clone[key] = value;
|
|
408
487
|
continue;
|
|
409
488
|
}
|
|
410
|
-
if (
|
|
411
|
-
|
|
489
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
490
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
412
491
|
continue;
|
|
413
492
|
}
|
|
414
493
|
if (isFunction(value) && targetWindow) {
|
|
415
|
-
|
|
494
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
416
495
|
continue;
|
|
417
496
|
}
|
|
418
497
|
if (isObjectLike(value)) {
|
|
419
|
-
|
|
498
|
+
clone[key] = deepClone(value, {
|
|
499
|
+
...options,
|
|
420
500
|
visited
|
|
421
|
-
})
|
|
501
|
+
});
|
|
422
502
|
} else {
|
|
423
|
-
|
|
503
|
+
clone[key] = value;
|
|
424
504
|
}
|
|
425
505
|
}
|
|
426
|
-
return
|
|
506
|
+
return clone;
|
|
427
507
|
};
|
|
428
508
|
|
|
429
|
-
// ../../node_modules/@domql/utils/
|
|
509
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
430
510
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
431
511
|
|
|
432
512
|
// src/defaultConfig/index.js
|
|
@@ -651,12 +731,9 @@ var getActiveConfig = (def) => {
|
|
|
651
731
|
};
|
|
652
732
|
|
|
653
733
|
// src/utils/color.js
|
|
654
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
655
734
|
var colorStringToRgbaArray = (color) => {
|
|
656
|
-
if (color === "")
|
|
657
|
-
|
|
658
|
-
if (color.toLowerCase() === "transparent")
|
|
659
|
-
return [0, 0, 0, 0];
|
|
735
|
+
if (color === "") return [0, 0, 0, 0];
|
|
736
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
660
737
|
if (color[0] === "#") {
|
|
661
738
|
if (color.length < 7) {
|
|
662
739
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -669,26 +746,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
669
746
|
];
|
|
670
747
|
}
|
|
671
748
|
if (color.indexOf("rgb") === -1) {
|
|
672
|
-
if (
|
|
673
|
-
const elem =
|
|
749
|
+
if (document2 && window2) {
|
|
750
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
674
751
|
const flag = "rgb(1, 2, 3)";
|
|
675
752
|
elem.style.color = flag;
|
|
676
753
|
if (elem.style.color !== flag) {
|
|
677
|
-
|
|
754
|
+
document2.body.removeChild(elem);
|
|
678
755
|
return;
|
|
679
756
|
}
|
|
680
757
|
elem.style.color = color;
|
|
681
758
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
682
|
-
|
|
759
|
+
document2.body.removeChild(elem);
|
|
683
760
|
return [0, 0, 0, 0];
|
|
684
761
|
}
|
|
685
|
-
color =
|
|
686
|
-
|
|
762
|
+
color = window2.getComputedStyle(elem).color;
|
|
763
|
+
document2.body.removeChild(elem);
|
|
687
764
|
}
|
|
688
765
|
}
|
|
689
766
|
if (color.indexOf("rgb") === 0) {
|
|
690
|
-
if (color.indexOf("rgba") === -1)
|
|
691
|
-
color = `${color}, 1`;
|
|
767
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
692
768
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
693
769
|
}
|
|
694
770
|
return [0, 0, 0, 0];
|
|
@@ -714,29 +790,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
714
790
|
var getColorShade = (col, amt) => {
|
|
715
791
|
const num = parseInt(col, 16);
|
|
716
792
|
let r = (num >> 16) + amt;
|
|
717
|
-
if (r > 255)
|
|
718
|
-
|
|
719
|
-
else if (r < 0)
|
|
720
|
-
r = 0;
|
|
793
|
+
if (r > 255) r = 255;
|
|
794
|
+
else if (r < 0) r = 0;
|
|
721
795
|
let b = (num >> 8 & 255) + amt;
|
|
722
|
-
if (b > 255)
|
|
723
|
-
|
|
724
|
-
else if (b < 0)
|
|
725
|
-
b = 0;
|
|
796
|
+
if (b > 255) b = 255;
|
|
797
|
+
else if (b < 0) b = 0;
|
|
726
798
|
let g = (num & 255) + amt;
|
|
727
|
-
if (g > 255)
|
|
728
|
-
|
|
729
|
-
else if (g < 0)
|
|
730
|
-
g = 0;
|
|
799
|
+
if (g > 255) g = 255;
|
|
800
|
+
else if (g < 0) g = 0;
|
|
731
801
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
732
802
|
};
|
|
733
803
|
var getRgbTone = (rgb, tone) => {
|
|
734
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
735
|
-
|
|
736
|
-
if (
|
|
737
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
738
|
-
if (isNumber(tone))
|
|
739
|
-
tone += "";
|
|
804
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
805
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
806
|
+
if (isNumber(tone)) tone += "";
|
|
740
807
|
const toHex = rgbArrayToHex(rgb);
|
|
741
808
|
const abs = tone.slice(0, 1);
|
|
742
809
|
if (abs === "-" || abs === "+") {
|
|
@@ -752,33 +819,27 @@ var getRgbTone = (rgb, tone) => {
|
|
|
752
819
|
};
|
|
753
820
|
|
|
754
821
|
// src/utils/sequence.js
|
|
755
|
-
var
|
|
822
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
756
823
|
|
|
757
824
|
// src/system/color.js
|
|
758
825
|
var getColor = (value, key, config) => {
|
|
759
826
|
const CONFIG2 = config || getActiveConfig();
|
|
760
827
|
if (!isString(value)) {
|
|
761
|
-
if (CONFIG2.verbose)
|
|
762
|
-
console.warn(value, "- type for color is not valid");
|
|
828
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
763
829
|
return;
|
|
764
830
|
}
|
|
765
|
-
if (value.slice(0, 2) === "--")
|
|
766
|
-
|
|
767
|
-
if (key && value[key])
|
|
768
|
-
value = value[key];
|
|
831
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
832
|
+
if (key && value[key]) value = value[key];
|
|
769
833
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
770
834
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
771
835
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
772
836
|
if (!val) {
|
|
773
|
-
if (CONFIG2.verbose)
|
|
774
|
-
console.warn("Can't find color ", name);
|
|
837
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
775
838
|
return value;
|
|
776
839
|
}
|
|
777
840
|
if (key) {
|
|
778
|
-
if (val[key])
|
|
779
|
-
|
|
780
|
-
else if (CONFIG2.verbose)
|
|
781
|
-
console.warn(value, " - does not have ", key);
|
|
841
|
+
if (val[key]) val = val[key];
|
|
842
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
782
843
|
}
|
|
783
844
|
let rgb = val.rgb;
|
|
784
845
|
if (!rgb) {
|
|
@@ -788,10 +849,8 @@ var getColor = (value, key, config) => {
|
|
|
788
849
|
rgb = getRgbTone(rgb, tone);
|
|
789
850
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
790
851
|
}
|
|
791
|
-
if (val[tone])
|
|
792
|
-
|
|
793
|
-
if (alpha)
|
|
794
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
852
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
853
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
795
854
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
796
855
|
};
|
|
797
856
|
|
|
@@ -808,22 +867,19 @@ var setThemeValue = (theme) => {
|
|
|
808
867
|
return value;
|
|
809
868
|
};
|
|
810
869
|
var getThemeValue = (theme) => {
|
|
811
|
-
if (theme.value)
|
|
812
|
-
return theme.value;
|
|
870
|
+
if (theme.value) return theme.value;
|
|
813
871
|
theme.value = setThemeValue(theme);
|
|
814
872
|
return theme.value;
|
|
815
873
|
};
|
|
816
874
|
var getTheme = (value, modifier) => {
|
|
817
875
|
const CONFIG2 = getActiveConfig();
|
|
818
|
-
if (CONFIG2.useVariable)
|
|
819
|
-
return getMediaTheme(value, modifier);
|
|
876
|
+
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
820
877
|
const { THEME: THEME2 } = CONFIG2;
|
|
821
878
|
if (isString(value)) {
|
|
822
879
|
const [theme, subtheme] = value.split(" ");
|
|
823
880
|
const isOurTheme = THEME2[theme];
|
|
824
881
|
if (isOurTheme) {
|
|
825
|
-
if (!subtheme && !modifier)
|
|
826
|
-
return getThemeValue(isOurTheme);
|
|
882
|
+
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
827
883
|
value = [theme, subtheme || modifier];
|
|
828
884
|
}
|
|
829
885
|
}
|
|
@@ -831,14 +887,10 @@ var getTheme = (value, modifier) => {
|
|
|
831
887
|
const themeName = value[0];
|
|
832
888
|
const subThemeName = value[1];
|
|
833
889
|
const { helpers, media, state } = THEME2[themeName];
|
|
834
|
-
if (media && media[subThemeName])
|
|
835
|
-
|
|
836
|
-
if (
|
|
837
|
-
|
|
838
|
-
if (state && state[subThemeName])
|
|
839
|
-
return getThemeValue(state[subThemeName]);
|
|
840
|
-
} else if (isObject(value))
|
|
841
|
-
return setThemeValue(value);
|
|
890
|
+
if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
|
|
891
|
+
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
892
|
+
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
893
|
+
} else if (isObject(value)) return setThemeValue(value);
|
|
842
894
|
};
|
|
843
895
|
var setInverseTheme = (theme, variant, value) => {
|
|
844
896
|
if (isObject(variant)) {
|
|
@@ -856,13 +908,11 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
856
908
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
857
909
|
const result = getTheme(variant);
|
|
858
910
|
themeValue[`&:${key}`] = result;
|
|
859
|
-
if (isObject(variant) && !variant.value)
|
|
860
|
-
variant.value = result;
|
|
911
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
861
912
|
};
|
|
862
913
|
var setSelectors = (theme, value) => {
|
|
863
914
|
const { state } = theme;
|
|
864
|
-
if (!state)
|
|
865
|
-
return;
|
|
915
|
+
if (!state) return;
|
|
866
916
|
const keys = Object.keys(state);
|
|
867
917
|
keys.map((key) => {
|
|
868
918
|
const variant = state[key];
|
|
@@ -874,20 +924,16 @@ var setSelectors = (theme, value) => {
|
|
|
874
924
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
875
925
|
const result = getTheme(variant);
|
|
876
926
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
877
|
-
if (isObject(variant) && !variant.value)
|
|
878
|
-
variant.value = result;
|
|
927
|
+
if (isObject(variant) && !variant.value) variant.value = result;
|
|
879
928
|
};
|
|
880
929
|
var setMedia = (theme, value) => {
|
|
881
930
|
const { media } = theme;
|
|
882
|
-
if (!media)
|
|
883
|
-
return;
|
|
931
|
+
if (!media) return;
|
|
884
932
|
const keys = Object.keys(media);
|
|
885
933
|
keys.map((key) => {
|
|
886
934
|
const variant = media[key];
|
|
887
|
-
if (key === "dark" || key === "light")
|
|
888
|
-
|
|
889
|
-
if (key === "inverse")
|
|
890
|
-
setInverseTheme(theme, variant, value);
|
|
935
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
|
|
936
|
+
if (key === "inverse") setInverseTheme(theme, variant, value);
|
|
891
937
|
return theme;
|
|
892
938
|
});
|
|
893
939
|
return theme;
|
|
@@ -895,23 +941,19 @@ var setMedia = (theme, value) => {
|
|
|
895
941
|
var setHelpers = (theme, value) => {
|
|
896
942
|
const CONFIG2 = getActiveConfig();
|
|
897
943
|
const { helpers } = theme;
|
|
898
|
-
if (!helpers)
|
|
899
|
-
return;
|
|
944
|
+
if (!helpers) return;
|
|
900
945
|
const keys = Object.keys(helpers);
|
|
901
946
|
keys.map((key) => {
|
|
902
947
|
const helper = helpers[key];
|
|
903
|
-
if (isString(helper))
|
|
904
|
-
|
|
905
|
-
else
|
|
906
|
-
getThemeValue(helpers[key]);
|
|
948
|
+
if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
|
|
949
|
+
else getThemeValue(helpers[key]);
|
|
907
950
|
return theme;
|
|
908
951
|
});
|
|
909
952
|
return theme;
|
|
910
953
|
};
|
|
911
954
|
var setTheme = (val, key) => {
|
|
912
955
|
const CONFIG2 = getActiveConfig();
|
|
913
|
-
if (CONFIG2.useVariable)
|
|
914
|
-
return setMediaTheme(val, key);
|
|
956
|
+
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
915
957
|
const { state, media, helpers } = val;
|
|
916
958
|
const value = setThemeValue(val, key);
|
|
917
959
|
const CSSvar = `--theme-${key}`;
|
|
@@ -973,24 +1015,19 @@ var recursiveTheme = (val) => {
|
|
|
973
1015
|
} else if (symb === ":") {
|
|
974
1016
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
975
1017
|
}
|
|
976
|
-
} else
|
|
977
|
-
obj[param] = val[param];
|
|
1018
|
+
} else obj[param] = val[param];
|
|
978
1019
|
}
|
|
979
1020
|
return obj;
|
|
980
1021
|
};
|
|
981
1022
|
var findModifierFromArray = (val, modifierArray) => {
|
|
982
1023
|
const currentMod = modifierArray.shift();
|
|
983
|
-
if (val[currentMod])
|
|
984
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1024
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
985
1025
|
return val;
|
|
986
1026
|
};
|
|
987
1027
|
var findModifier = (val, modifier) => {
|
|
988
|
-
if (isArray(modifier))
|
|
989
|
-
|
|
990
|
-
else
|
|
991
|
-
return val[modifier];
|
|
992
|
-
else
|
|
993
|
-
return val;
|
|
1028
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
1029
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
1030
|
+
else return val;
|
|
994
1031
|
};
|
|
995
1032
|
var getMediaTheme = (value, modifier) => {
|
|
996
1033
|
const activeConfig = getActiveConfig();
|