@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/utils/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: () => 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
|
});
|
|
@@ -354,63 +378,115 @@ var isScalingUnit = (unit) => {
|
|
|
354
378
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
355
379
|
};
|
|
356
380
|
|
|
357
|
-
//
|
|
358
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
359
|
-
|
|
360
|
-
// ../../node_modules/@domql/utils/dist/esm/globals.js
|
|
381
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
361
382
|
var window2 = globalThis;
|
|
362
383
|
var document2 = window2.document;
|
|
363
384
|
|
|
364
|
-
// ../../node_modules/@domql/utils/
|
|
385
|
+
// ../../node_modules/@domql/utils/node.js
|
|
365
386
|
var isDOMNode = (obj) => {
|
|
366
387
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
367
388
|
};
|
|
368
389
|
|
|
369
|
-
// ../../node_modules/@domql/utils/
|
|
390
|
+
// ../../node_modules/@domql/utils/types.js
|
|
370
391
|
var isString = (arg) => typeof arg === "string";
|
|
371
392
|
var isNumber = (arg) => typeof arg === "number";
|
|
372
393
|
var isFunction = (arg) => typeof arg === "function";
|
|
373
394
|
var isNull = (arg) => arg === null;
|
|
374
395
|
var isArray = (arg) => Array.isArray(arg);
|
|
375
396
|
var isObjectLike = (arg) => {
|
|
376
|
-
if (arg === null)
|
|
377
|
-
return false;
|
|
397
|
+
if (arg === null) return false;
|
|
378
398
|
return typeof arg === "object";
|
|
379
399
|
};
|
|
380
400
|
var isUndefined = (arg) => {
|
|
381
401
|
return arg === void 0;
|
|
382
402
|
};
|
|
383
403
|
|
|
384
|
-
// ../../node_modules/@domql/utils/
|
|
385
|
-
var
|
|
386
|
-
return arr.reduce(
|
|
404
|
+
// ../../node_modules/@domql/utils/array.js
|
|
405
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
406
|
+
return arr.reduce(
|
|
407
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
408
|
+
{}
|
|
409
|
+
);
|
|
387
410
|
};
|
|
388
411
|
|
|
389
|
-
// ../../node_modules/@domql/utils/
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
412
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
413
|
+
var STATE_METHODS = [
|
|
414
|
+
"update",
|
|
415
|
+
"parse",
|
|
416
|
+
"clean",
|
|
417
|
+
"create",
|
|
418
|
+
"destroy",
|
|
419
|
+
"add",
|
|
420
|
+
"toggle",
|
|
421
|
+
"remove",
|
|
422
|
+
"apply",
|
|
423
|
+
"set",
|
|
424
|
+
"reset",
|
|
425
|
+
"replace",
|
|
426
|
+
"quietReplace",
|
|
427
|
+
"quietUpdate",
|
|
428
|
+
"applyReplace",
|
|
429
|
+
"applyFunction",
|
|
430
|
+
"keys",
|
|
431
|
+
"values",
|
|
432
|
+
"ref",
|
|
433
|
+
"rootUpdate",
|
|
434
|
+
"parentUpdate",
|
|
435
|
+
"parent",
|
|
436
|
+
"__element",
|
|
437
|
+
"__depends",
|
|
438
|
+
"__ref",
|
|
439
|
+
"__children",
|
|
440
|
+
"root",
|
|
441
|
+
"setByPath",
|
|
442
|
+
"setPathCollection",
|
|
443
|
+
"removeByPath",
|
|
444
|
+
"removePathCollection",
|
|
445
|
+
"getByPath"
|
|
446
|
+
];
|
|
447
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
448
|
+
var METHODS = [
|
|
449
|
+
"set",
|
|
450
|
+
"reset",
|
|
451
|
+
"update",
|
|
452
|
+
"remove",
|
|
453
|
+
"updateContent",
|
|
454
|
+
"removeContent",
|
|
455
|
+
"lookup",
|
|
456
|
+
"lookdown",
|
|
457
|
+
"lookdownAll",
|
|
458
|
+
"getRef",
|
|
459
|
+
"getPath",
|
|
460
|
+
"setNodeStyles",
|
|
461
|
+
"spotByPath",
|
|
462
|
+
"keys",
|
|
463
|
+
"parse",
|
|
464
|
+
"setProps",
|
|
465
|
+
"parseDeep",
|
|
466
|
+
"variables",
|
|
467
|
+
"if",
|
|
468
|
+
"log",
|
|
469
|
+
"verbose",
|
|
470
|
+
"warn",
|
|
471
|
+
"error",
|
|
472
|
+
"call",
|
|
473
|
+
"nextElement",
|
|
474
|
+
"previousElement"
|
|
475
|
+
];
|
|
476
|
+
var METHODS_EXL = [
|
|
477
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
478
|
+
...METHODS,
|
|
479
|
+
...STATE_METHODS,
|
|
480
|
+
...PROPS_METHODS
|
|
481
|
+
];
|
|
482
|
+
|
|
483
|
+
// ../../node_modules/@domql/utils/object.js
|
|
484
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
410
485
|
for (const e in extend) {
|
|
411
|
-
const
|
|
412
|
-
if (!
|
|
486
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
487
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
413
488
|
continue;
|
|
489
|
+
}
|
|
414
490
|
const elementProp = element[e];
|
|
415
491
|
const extendProp = extend[e];
|
|
416
492
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -428,7 +504,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
428
504
|
cleanNull = false,
|
|
429
505
|
window: targetWindow,
|
|
430
506
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
431
|
-
|
|
507
|
+
handleExtends = false
|
|
432
508
|
} = options;
|
|
433
509
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
434
510
|
return obj;
|
|
@@ -436,49 +512,49 @@ var deepClone = (obj, options = {}) => {
|
|
|
436
512
|
if (visited.has(obj)) {
|
|
437
513
|
return visited.get(obj);
|
|
438
514
|
}
|
|
439
|
-
const
|
|
440
|
-
visited.set(obj,
|
|
515
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
516
|
+
visited.set(obj, clone);
|
|
441
517
|
for (const key in obj) {
|
|
442
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
443
|
-
|
|
444
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
518
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
519
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
445
520
|
continue;
|
|
521
|
+
}
|
|
446
522
|
const value = obj[key];
|
|
447
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
523
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
448
524
|
continue;
|
|
525
|
+
}
|
|
449
526
|
if (isDOMNode(value)) {
|
|
450
|
-
|
|
527
|
+
clone[key] = value;
|
|
451
528
|
continue;
|
|
452
529
|
}
|
|
453
|
-
if (
|
|
454
|
-
|
|
530
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
531
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
455
532
|
continue;
|
|
456
533
|
}
|
|
457
534
|
if (isFunction(value) && targetWindow) {
|
|
458
|
-
|
|
535
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
459
536
|
continue;
|
|
460
537
|
}
|
|
461
538
|
if (isObjectLike(value)) {
|
|
462
|
-
|
|
539
|
+
clone[key] = deepClone(value, {
|
|
540
|
+
...options,
|
|
463
541
|
visited
|
|
464
|
-
})
|
|
542
|
+
});
|
|
465
543
|
} else {
|
|
466
|
-
|
|
544
|
+
clone[key] = value;
|
|
467
545
|
}
|
|
468
546
|
}
|
|
469
|
-
return
|
|
547
|
+
return clone;
|
|
470
548
|
};
|
|
471
549
|
|
|
472
|
-
// ../../node_modules/@domql/utils/
|
|
550
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
473
551
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
474
552
|
|
|
475
553
|
// src/utils/color.js
|
|
476
554
|
var ENV = "development";
|
|
477
555
|
var colorStringToRgbaArray = (color) => {
|
|
478
|
-
if (color === "")
|
|
479
|
-
|
|
480
|
-
if (color.toLowerCase() === "transparent")
|
|
481
|
-
return [0, 0, 0, 0];
|
|
556
|
+
if (color === "") return [0, 0, 0, 0];
|
|
557
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
482
558
|
if (color[0] === "#") {
|
|
483
559
|
if (color.length < 7) {
|
|
484
560
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -491,26 +567,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
491
567
|
];
|
|
492
568
|
}
|
|
493
569
|
if (color.indexOf("rgb") === -1) {
|
|
494
|
-
if (
|
|
495
|
-
const elem =
|
|
570
|
+
if (document2 && window2) {
|
|
571
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
496
572
|
const flag = "rgb(1, 2, 3)";
|
|
497
573
|
elem.style.color = flag;
|
|
498
574
|
if (elem.style.color !== flag) {
|
|
499
|
-
|
|
575
|
+
document2.body.removeChild(elem);
|
|
500
576
|
return;
|
|
501
577
|
}
|
|
502
578
|
elem.style.color = color;
|
|
503
579
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
504
|
-
|
|
580
|
+
document2.body.removeChild(elem);
|
|
505
581
|
return [0, 0, 0, 0];
|
|
506
582
|
}
|
|
507
|
-
color =
|
|
508
|
-
|
|
583
|
+
color = window2.getComputedStyle(elem).color;
|
|
584
|
+
document2.body.removeChild(elem);
|
|
509
585
|
}
|
|
510
586
|
}
|
|
511
587
|
if (color.indexOf("rgb") === 0) {
|
|
512
|
-
if (color.indexOf("rgba") === -1)
|
|
513
|
-
color = `${color}, 1`;
|
|
588
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
514
589
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
515
590
|
}
|
|
516
591
|
return [0, 0, 0, 0];
|
|
@@ -567,20 +642,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
567
642
|
var getColorShade = (col, amt) => {
|
|
568
643
|
const num = parseInt(col, 16);
|
|
569
644
|
let r = (num >> 16) + amt;
|
|
570
|
-
if (r > 255)
|
|
571
|
-
|
|
572
|
-
else if (r < 0)
|
|
573
|
-
r = 0;
|
|
645
|
+
if (r > 255) r = 255;
|
|
646
|
+
else if (r < 0) r = 0;
|
|
574
647
|
let b = (num >> 8 & 255) + amt;
|
|
575
|
-
if (b > 255)
|
|
576
|
-
|
|
577
|
-
else if (b < 0)
|
|
578
|
-
b = 0;
|
|
648
|
+
if (b > 255) b = 255;
|
|
649
|
+
else if (b < 0) b = 0;
|
|
579
650
|
let g = (num & 255) + amt;
|
|
580
|
-
if (g > 255)
|
|
581
|
-
|
|
582
|
-
else if (g < 0)
|
|
583
|
-
g = 0;
|
|
651
|
+
if (g > 255) g = 255;
|
|
652
|
+
else if (g < 0) g = 0;
|
|
584
653
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
585
654
|
};
|
|
586
655
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -596,20 +665,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
596
665
|
var opacify = (color, opacity) => {
|
|
597
666
|
const arr = colorStringToRgbaArray(color);
|
|
598
667
|
if (!arr) {
|
|
599
|
-
if (ENV === "test" || ENV === "development")
|
|
600
|
-
console.warn(color + " color is not rgba");
|
|
668
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
601
669
|
return;
|
|
602
670
|
}
|
|
603
671
|
arr[3] = opacity;
|
|
604
672
|
return `rgba(${arr})`;
|
|
605
673
|
};
|
|
606
674
|
var getRgbTone = (rgb, tone) => {
|
|
607
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
608
|
-
|
|
609
|
-
if (
|
|
610
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
611
|
-
if (isNumber(tone))
|
|
612
|
-
tone += "";
|
|
675
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
676
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
677
|
+
if (isNumber(tone)) tone += "";
|
|
613
678
|
const toHex = rgbArrayToHex(rgb);
|
|
614
679
|
const abs = tone.slice(0, 1);
|
|
615
680
|
if (abs === "-" || abs === "+") {
|
|
@@ -626,21 +691,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
626
691
|
|
|
627
692
|
// src/utils/theme.js
|
|
628
693
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
629
|
-
if (!orig)
|
|
630
|
-
|
|
631
|
-
if (orig
|
|
632
|
-
return orig.themes[theme];
|
|
633
|
-
if (orig[theme])
|
|
634
|
-
return [orig, orig[theme]];
|
|
694
|
+
if (!orig) return;
|
|
695
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
696
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
635
697
|
return orig;
|
|
636
698
|
};
|
|
637
699
|
|
|
638
700
|
// src/utils/font.js
|
|
639
701
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
640
|
-
if (LIBRARY[key])
|
|
641
|
-
|
|
642
|
-
if (LIBRARY.default)
|
|
643
|
-
return LIBRARY[LIBRARY.default].value;
|
|
702
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
703
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
644
704
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
645
705
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
646
706
|
};
|
|
@@ -667,8 +727,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
667
727
|
};
|
|
668
728
|
var getFontFaceEachString = (name, weights) => {
|
|
669
729
|
const isArr = weights[0];
|
|
670
|
-
if (isArr)
|
|
671
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
730
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
672
731
|
return setCustomFontMedia(name, weights.url);
|
|
673
732
|
};
|
|
674
733
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -677,7 +736,7 @@ var getFontFaceString = (LIBRARY) => {
|
|
|
677
736
|
};
|
|
678
737
|
|
|
679
738
|
// src/utils/sequence.js
|
|
680
|
-
var
|
|
739
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
681
740
|
|
|
682
741
|
// src/defaultConfig/index.js
|
|
683
742
|
var defaultConfig_exports = {};
|
|
@@ -946,8 +1005,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
946
1005
|
var setScalingVar = (key, sequenceProps) => {
|
|
947
1006
|
const { base, type, unit } = sequenceProps;
|
|
948
1007
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
949
|
-
if (key === 0)
|
|
950
|
-
return defaultVal;
|
|
1008
|
+
if (key === 0) return defaultVal;
|
|
951
1009
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
952
1010
|
const ratioVar = `${prefix}-ratio`;
|
|
953
1011
|
if (key > 0) {
|
|
@@ -984,10 +1042,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
984
1042
|
const diffRounded = ~~next - ~~value;
|
|
985
1043
|
let arr;
|
|
986
1044
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
987
|
-
if (diffRounded > 16)
|
|
988
|
-
|
|
989
|
-
else
|
|
990
|
-
arr = [first, second];
|
|
1045
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
1046
|
+
else arr = [first, second];
|
|
991
1047
|
arr.forEach((v, k) => {
|
|
992
1048
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
993
1049
|
const newVar = variable + (k + 1);
|
|
@@ -1029,14 +1085,13 @@ var generateSequence = (sequenceProps) => {
|
|
|
1029
1085
|
index: key
|
|
1030
1086
|
};
|
|
1031
1087
|
setSequenceValue(props, sequenceProps);
|
|
1032
|
-
if (subSequence)
|
|
1033
|
-
generateSubSequence(props, sequenceProps);
|
|
1088
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
1034
1089
|
}
|
|
1035
1090
|
return sequenceProps;
|
|
1036
1091
|
};
|
|
1037
1092
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
1038
1093
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
1039
|
-
const letterKey = isString
|
|
1094
|
+
const letterKey = (void 0).call("isString", position) ? position : numToLetterMap[position];
|
|
1040
1095
|
if (!letterKey) {
|
|
1041
1096
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
1042
1097
|
return null;
|
|
@@ -1076,13 +1131,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1076
1131
|
unit = UNIT2.default,
|
|
1077
1132
|
useVariable
|
|
1078
1133
|
} = sequenceProps;
|
|
1079
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1080
|
-
|
|
1081
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1134
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1135
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1082
1136
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1083
1137
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1084
|
-
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)
|
|
1085
|
-
return value;
|
|
1138
|
+
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;
|
|
1086
1139
|
const letterVal = value.toUpperCase();
|
|
1087
1140
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1088
1141
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1106,8 +1159,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1106
1159
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1107
1160
|
}
|
|
1108
1161
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1109
|
-
if (CONFIG2.verbose)
|
|
1110
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1162
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1111
1163
|
absValue = absValue.slice(0, 1);
|
|
1112
1164
|
}
|
|
1113
1165
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1115,8 +1167,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1115
1167
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1116
1168
|
}
|
|
1117
1169
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1118
|
-
if (!sequenceItem)
|
|
1119
|
-
return console.warn("can't find", sequence, absValue);
|
|
1170
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1120
1171
|
if (unit === "ms" || unit === "s") {
|
|
1121
1172
|
return isNegative + sequenceItem.val + unit;
|
|
1122
1173
|
}
|
|
@@ -1125,12 +1176,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1125
1176
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1126
1177
|
if (typeof value !== "string") {
|
|
1127
1178
|
const CONFIG2 = getActiveConfig();
|
|
1128
|
-
if (CONFIG2.verbose)
|
|
1129
|
-
console.warn(propertyName, value, "is not a string");
|
|
1179
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1130
1180
|
return { [propertyName]: value };
|
|
1131
1181
|
}
|
|
1132
|
-
if (value === "-" || value === "")
|
|
1133
|
-
return {};
|
|
1182
|
+
if (value === "-" || value === "") return {};
|
|
1134
1183
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1135
1184
|
};
|
|
1136
1185
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1198,23 +1247,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1198
1247
|
const { mediaRegenerate } = FACTORY2;
|
|
1199
1248
|
const { sequence, scales } = FACTORY2[media];
|
|
1200
1249
|
const query = MEDIA2[mediaName];
|
|
1201
|
-
if (!query && CONFIG2.verbose)
|
|
1202
|
-
console.warn("Can't find media query ", query);
|
|
1250
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1203
1251
|
if (!mediaRegenerate) {
|
|
1204
1252
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1205
|
-
if (!underMediaQuery)
|
|
1206
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1253
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1207
1254
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1208
1255
|
return;
|
|
1209
1256
|
}
|
|
1210
1257
|
for (const key in sequence) {
|
|
1211
1258
|
const item = sequence[key];
|
|
1212
1259
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1213
|
-
if (!query && CONFIG2.verbose)
|
|
1214
|
-
console.warn("Can't find query ", query);
|
|
1260
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1215
1261
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1216
|
-
if (!underMediaQuery)
|
|
1217
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1262
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1218
1263
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1219
1264
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1220
1265
|
}
|
|
@@ -1225,10 +1270,8 @@ var generateSprite = (icons) => {
|
|
|
1225
1270
|
const CONFIG2 = getActiveConfig();
|
|
1226
1271
|
let sprite = "";
|
|
1227
1272
|
for (const key in icons) {
|
|
1228
|
-
if (CONFIG2.__svg_cache[key])
|
|
1229
|
-
|
|
1230
|
-
else
|
|
1231
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1273
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1274
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1232
1275
|
sprite += icons[key];
|
|
1233
1276
|
}
|
|
1234
1277
|
return sprite;
|