@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
|
@@ -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
|
});
|
|
@@ -306,6 +330,7 @@ __export(transforms_exports, {
|
|
|
306
330
|
splitTransition: () => splitTransition,
|
|
307
331
|
transformBackgroundImage: () => transformBackgroundImage,
|
|
308
332
|
transformBorder: () => transformBorder,
|
|
333
|
+
transformBorderRadius: () => transformBorderRadius,
|
|
309
334
|
transformBoxShadow: () => transformBoxShadow,
|
|
310
335
|
transformDuration: () => transformDuration,
|
|
311
336
|
transformShadow: () => transformShadow,
|
|
@@ -317,19 +342,18 @@ __export(transforms_exports, {
|
|
|
317
342
|
});
|
|
318
343
|
module.exports = __toCommonJS(transforms_exports);
|
|
319
344
|
|
|
320
|
-
// ../../node_modules/@domql/utils/
|
|
345
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
321
346
|
var window2 = globalThis;
|
|
322
347
|
var document2 = window2.document;
|
|
323
348
|
|
|
324
|
-
// ../../node_modules/@domql/utils/
|
|
349
|
+
// ../../node_modules/@domql/utils/node.js
|
|
325
350
|
var isDOMNode = (obj) => {
|
|
326
351
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
327
352
|
};
|
|
328
353
|
|
|
329
|
-
// ../../node_modules/@domql/utils/
|
|
354
|
+
// ../../node_modules/@domql/utils/types.js
|
|
330
355
|
var isObject = (arg) => {
|
|
331
|
-
if (arg === null)
|
|
332
|
-
return false;
|
|
356
|
+
if (arg === null) return false;
|
|
333
357
|
return typeof arg === "object" && arg.constructor === Object;
|
|
334
358
|
};
|
|
335
359
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -338,44 +362,99 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
338
362
|
var isNull = (arg) => arg === null;
|
|
339
363
|
var isArray = (arg) => Array.isArray(arg);
|
|
340
364
|
var isObjectLike = (arg) => {
|
|
341
|
-
if (arg === null)
|
|
342
|
-
return false;
|
|
365
|
+
if (arg === null) return false;
|
|
343
366
|
return typeof arg === "object";
|
|
344
367
|
};
|
|
345
368
|
var isUndefined = (arg) => {
|
|
346
369
|
return arg === void 0;
|
|
347
370
|
};
|
|
348
371
|
|
|
349
|
-
// ../../node_modules/@domql/utils/
|
|
350
|
-
var
|
|
351
|
-
return arr.reduce(
|
|
372
|
+
// ../../node_modules/@domql/utils/array.js
|
|
373
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
374
|
+
return arr.reduce(
|
|
375
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
376
|
+
{}
|
|
377
|
+
);
|
|
352
378
|
};
|
|
353
379
|
|
|
354
|
-
// ../../node_modules/@domql/utils/
|
|
355
|
-
var
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
380
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
381
|
+
var STATE_METHODS = [
|
|
382
|
+
"update",
|
|
383
|
+
"parse",
|
|
384
|
+
"clean",
|
|
385
|
+
"create",
|
|
386
|
+
"destroy",
|
|
387
|
+
"add",
|
|
388
|
+
"toggle",
|
|
389
|
+
"remove",
|
|
390
|
+
"apply",
|
|
391
|
+
"set",
|
|
392
|
+
"reset",
|
|
393
|
+
"replace",
|
|
394
|
+
"quietReplace",
|
|
395
|
+
"quietUpdate",
|
|
396
|
+
"applyReplace",
|
|
397
|
+
"applyFunction",
|
|
398
|
+
"keys",
|
|
399
|
+
"values",
|
|
400
|
+
"ref",
|
|
401
|
+
"rootUpdate",
|
|
402
|
+
"parentUpdate",
|
|
403
|
+
"parent",
|
|
404
|
+
"__element",
|
|
405
|
+
"__depends",
|
|
406
|
+
"__ref",
|
|
407
|
+
"__children",
|
|
408
|
+
"root",
|
|
409
|
+
"setByPath",
|
|
410
|
+
"setPathCollection",
|
|
411
|
+
"removeByPath",
|
|
412
|
+
"removePathCollection",
|
|
413
|
+
"getByPath"
|
|
414
|
+
];
|
|
415
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
416
|
+
var METHODS = [
|
|
417
|
+
"set",
|
|
418
|
+
"reset",
|
|
419
|
+
"update",
|
|
420
|
+
"remove",
|
|
421
|
+
"updateContent",
|
|
422
|
+
"removeContent",
|
|
423
|
+
"lookup",
|
|
424
|
+
"lookdown",
|
|
425
|
+
"lookdownAll",
|
|
426
|
+
"getRef",
|
|
427
|
+
"getPath",
|
|
428
|
+
"setNodeStyles",
|
|
429
|
+
"spotByPath",
|
|
430
|
+
"keys",
|
|
431
|
+
"parse",
|
|
432
|
+
"setProps",
|
|
433
|
+
"parseDeep",
|
|
434
|
+
"variables",
|
|
435
|
+
"if",
|
|
436
|
+
"log",
|
|
437
|
+
"verbose",
|
|
438
|
+
"warn",
|
|
439
|
+
"error",
|
|
440
|
+
"call",
|
|
441
|
+
"nextElement",
|
|
442
|
+
"previousElement"
|
|
443
|
+
];
|
|
444
|
+
var METHODS_EXL = [
|
|
445
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
446
|
+
...METHODS,
|
|
447
|
+
...STATE_METHODS,
|
|
448
|
+
...PROPS_METHODS
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
// ../../node_modules/@domql/utils/object.js
|
|
374
452
|
var merge = (element, obj, excludeFrom = []) => {
|
|
375
453
|
for (const e in obj) {
|
|
376
|
-
const
|
|
377
|
-
if (!
|
|
454
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
455
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
378
456
|
continue;
|
|
457
|
+
}
|
|
379
458
|
const elementProp = element[e];
|
|
380
459
|
const objProp = obj[e];
|
|
381
460
|
if (elementProp === void 0) {
|
|
@@ -384,11 +463,12 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
384
463
|
}
|
|
385
464
|
return element;
|
|
386
465
|
};
|
|
387
|
-
var deepMerge = (element, extend, excludeFrom =
|
|
466
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
388
467
|
for (const e in extend) {
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
468
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
469
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
391
470
|
continue;
|
|
471
|
+
}
|
|
392
472
|
const elementProp = element[e];
|
|
393
473
|
const extendProp = extend[e];
|
|
394
474
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -406,7 +486,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
406
486
|
cleanNull = false,
|
|
407
487
|
window: targetWindow,
|
|
408
488
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
409
|
-
|
|
489
|
+
handleExtends = false
|
|
410
490
|
} = options;
|
|
411
491
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
412
492
|
return obj;
|
|
@@ -414,40 +494,42 @@ var deepClone = (obj, options = {}) => {
|
|
|
414
494
|
if (visited.has(obj)) {
|
|
415
495
|
return visited.get(obj);
|
|
416
496
|
}
|
|
417
|
-
const
|
|
418
|
-
visited.set(obj,
|
|
497
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
498
|
+
visited.set(obj, clone);
|
|
419
499
|
for (const key in obj) {
|
|
420
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
421
|
-
|
|
422
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
500
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
501
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
423
502
|
continue;
|
|
503
|
+
}
|
|
424
504
|
const value = obj[key];
|
|
425
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
505
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
426
506
|
continue;
|
|
507
|
+
}
|
|
427
508
|
if (isDOMNode(value)) {
|
|
428
|
-
|
|
509
|
+
clone[key] = value;
|
|
429
510
|
continue;
|
|
430
511
|
}
|
|
431
|
-
if (
|
|
432
|
-
|
|
512
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
513
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
433
514
|
continue;
|
|
434
515
|
}
|
|
435
516
|
if (isFunction(value) && targetWindow) {
|
|
436
|
-
|
|
517
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
437
518
|
continue;
|
|
438
519
|
}
|
|
439
520
|
if (isObjectLike(value)) {
|
|
440
|
-
|
|
521
|
+
clone[key] = deepClone(value, {
|
|
522
|
+
...options,
|
|
441
523
|
visited
|
|
442
|
-
})
|
|
524
|
+
});
|
|
443
525
|
} else {
|
|
444
|
-
|
|
526
|
+
clone[key] = value;
|
|
445
527
|
}
|
|
446
528
|
}
|
|
447
|
-
return
|
|
529
|
+
return clone;
|
|
448
530
|
};
|
|
449
531
|
|
|
450
|
-
// ../../node_modules/@domql/utils/
|
|
532
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
451
533
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
452
534
|
|
|
453
535
|
// src/defaultConfig/index.js
|
|
@@ -677,12 +759,9 @@ var isScalingUnit = (unit) => {
|
|
|
677
759
|
};
|
|
678
760
|
|
|
679
761
|
// src/utils/color.js
|
|
680
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
681
762
|
var colorStringToRgbaArray = (color) => {
|
|
682
|
-
if (color === "")
|
|
683
|
-
|
|
684
|
-
if (color.toLowerCase() === "transparent")
|
|
685
|
-
return [0, 0, 0, 0];
|
|
763
|
+
if (color === "") return [0, 0, 0, 0];
|
|
764
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
686
765
|
if (color[0] === "#") {
|
|
687
766
|
if (color.length < 7) {
|
|
688
767
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -695,26 +774,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
695
774
|
];
|
|
696
775
|
}
|
|
697
776
|
if (color.indexOf("rgb") === -1) {
|
|
698
|
-
if (
|
|
699
|
-
const elem =
|
|
777
|
+
if (document2 && window2) {
|
|
778
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
700
779
|
const flag = "rgb(1, 2, 3)";
|
|
701
780
|
elem.style.color = flag;
|
|
702
781
|
if (elem.style.color !== flag) {
|
|
703
|
-
|
|
782
|
+
document2.body.removeChild(elem);
|
|
704
783
|
return;
|
|
705
784
|
}
|
|
706
785
|
elem.style.color = color;
|
|
707
786
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
708
|
-
|
|
787
|
+
document2.body.removeChild(elem);
|
|
709
788
|
return [0, 0, 0, 0];
|
|
710
789
|
}
|
|
711
|
-
color =
|
|
712
|
-
|
|
790
|
+
color = window2.getComputedStyle(elem).color;
|
|
791
|
+
document2.body.removeChild(elem);
|
|
713
792
|
}
|
|
714
793
|
}
|
|
715
794
|
if (color.indexOf("rgb") === 0) {
|
|
716
|
-
if (color.indexOf("rgba") === -1)
|
|
717
|
-
color = `${color}, 1`;
|
|
795
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
718
796
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
719
797
|
}
|
|
720
798
|
return [0, 0, 0, 0];
|
|
@@ -740,29 +818,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
740
818
|
var getColorShade = (col, amt) => {
|
|
741
819
|
const num = parseInt(col, 16);
|
|
742
820
|
let r = (num >> 16) + amt;
|
|
743
|
-
if (r > 255)
|
|
744
|
-
|
|
745
|
-
else if (r < 0)
|
|
746
|
-
r = 0;
|
|
821
|
+
if (r > 255) r = 255;
|
|
822
|
+
else if (r < 0) r = 0;
|
|
747
823
|
let b = (num >> 8 & 255) + amt;
|
|
748
|
-
if (b > 255)
|
|
749
|
-
|
|
750
|
-
else if (b < 0)
|
|
751
|
-
b = 0;
|
|
824
|
+
if (b > 255) b = 255;
|
|
825
|
+
else if (b < 0) b = 0;
|
|
752
826
|
let g = (num & 255) + amt;
|
|
753
|
-
if (g > 255)
|
|
754
|
-
|
|
755
|
-
else if (g < 0)
|
|
756
|
-
g = 0;
|
|
827
|
+
if (g > 255) g = 255;
|
|
828
|
+
else if (g < 0) g = 0;
|
|
757
829
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
758
830
|
};
|
|
759
831
|
var getRgbTone = (rgb, tone) => {
|
|
760
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
761
|
-
|
|
762
|
-
if (
|
|
763
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
764
|
-
if (isNumber(tone))
|
|
765
|
-
tone += "";
|
|
832
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
833
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
834
|
+
if (isNumber(tone)) tone += "";
|
|
766
835
|
const toHex = rgbArrayToHex(rgb);
|
|
767
836
|
const abs = tone.slice(0, 1);
|
|
768
837
|
if (abs === "-" || abs === "+") {
|
|
@@ -778,7 +847,7 @@ var getRgbTone = (rgb, tone) => {
|
|
|
778
847
|
};
|
|
779
848
|
|
|
780
849
|
// src/utils/sequence.js
|
|
781
|
-
var
|
|
850
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
782
851
|
var numToLetterMap = {
|
|
783
852
|
"-6": "U",
|
|
784
853
|
"-5": "V",
|
|
@@ -824,8 +893,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
824
893
|
var setScalingVar = (key, sequenceProps) => {
|
|
825
894
|
const { base, type, unit } = sequenceProps;
|
|
826
895
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
827
|
-
if (key === 0)
|
|
828
|
-
return defaultVal;
|
|
896
|
+
if (key === 0) return defaultVal;
|
|
829
897
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
830
898
|
const ratioVar = `${prefix}-ratio`;
|
|
831
899
|
if (key > 0) {
|
|
@@ -862,10 +930,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
862
930
|
const diffRounded = ~~next - ~~value;
|
|
863
931
|
let arr;
|
|
864
932
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
865
|
-
if (diffRounded > 16)
|
|
866
|
-
|
|
867
|
-
else
|
|
868
|
-
arr = [first, second];
|
|
933
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
934
|
+
else arr = [first, second];
|
|
869
935
|
arr.forEach((v, k) => {
|
|
870
936
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
871
937
|
const newVar = variable + (k + 1);
|
|
@@ -907,8 +973,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
907
973
|
index: key
|
|
908
974
|
};
|
|
909
975
|
setSequenceValue(props, sequenceProps);
|
|
910
|
-
if (subSequence)
|
|
911
|
-
generateSubSequence(props, sequenceProps);
|
|
976
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
912
977
|
}
|
|
913
978
|
return sequenceProps;
|
|
914
979
|
};
|
|
@@ -920,13 +985,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
920
985
|
unit = UNIT2.default,
|
|
921
986
|
useVariable
|
|
922
987
|
} = sequenceProps;
|
|
923
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
924
|
-
|
|
925
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
988
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
989
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
926
990
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
927
991
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
928
|
-
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)
|
|
929
|
-
return value;
|
|
992
|
+
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;
|
|
930
993
|
const letterVal = value.toUpperCase();
|
|
931
994
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
932
995
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -950,8 +1013,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
950
1013
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
951
1014
|
}
|
|
952
1015
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
953
|
-
if (CONFIG2.verbose)
|
|
954
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1016
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
955
1017
|
absValue = absValue.slice(0, 1);
|
|
956
1018
|
}
|
|
957
1019
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -959,8 +1021,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
959
1021
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
960
1022
|
}
|
|
961
1023
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
962
|
-
if (!sequenceItem)
|
|
963
|
-
return console.warn("can't find", sequence, absValue);
|
|
1024
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
964
1025
|
if (unit === "ms" || unit === "s") {
|
|
965
1026
|
return isNegative + sequenceItem.val + unit;
|
|
966
1027
|
}
|
|
@@ -969,12 +1030,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
969
1030
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
970
1031
|
if (typeof value !== "string") {
|
|
971
1032
|
const CONFIG2 = getActiveConfig();
|
|
972
|
-
if (CONFIG2.verbose)
|
|
973
|
-
console.warn(propertyName, value, "is not a string");
|
|
1033
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
974
1034
|
return { [propertyName]: value };
|
|
975
1035
|
}
|
|
976
|
-
if (value === "-" || value === "")
|
|
977
|
-
return {};
|
|
1036
|
+
if (value === "-" || value === "") return {};
|
|
978
1037
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
979
1038
|
};
|
|
980
1039
|
|
|
@@ -1023,27 +1082,21 @@ var applySequenceVars = (FACTORY2, options = {}) => {
|
|
|
1023
1082
|
var getColor = (value, key, config) => {
|
|
1024
1083
|
const CONFIG2 = config || getActiveConfig();
|
|
1025
1084
|
if (!isString(value)) {
|
|
1026
|
-
if (CONFIG2.verbose)
|
|
1027
|
-
console.warn(value, "- type for color is not valid");
|
|
1085
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1028
1086
|
return;
|
|
1029
1087
|
}
|
|
1030
|
-
if (value.slice(0, 2) === "--")
|
|
1031
|
-
|
|
1032
|
-
if (key && value[key])
|
|
1033
|
-
value = value[key];
|
|
1088
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1089
|
+
if (key && value[key]) value = value[key];
|
|
1034
1090
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1035
1091
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1036
1092
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1037
1093
|
if (!val) {
|
|
1038
|
-
if (CONFIG2.verbose)
|
|
1039
|
-
console.warn("Can't find color ", name);
|
|
1094
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1040
1095
|
return value;
|
|
1041
1096
|
}
|
|
1042
1097
|
if (key) {
|
|
1043
|
-
if (val[key])
|
|
1044
|
-
|
|
1045
|
-
else if (CONFIG2.verbose)
|
|
1046
|
-
console.warn(value, " - does not have ", key);
|
|
1098
|
+
if (val[key]) val = val[key];
|
|
1099
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1047
1100
|
}
|
|
1048
1101
|
let rgb = val.rgb;
|
|
1049
1102
|
if (!rgb) {
|
|
@@ -1053,32 +1106,25 @@ var getColor = (value, key, config) => {
|
|
|
1053
1106
|
rgb = getRgbTone(rgb, tone);
|
|
1054
1107
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1055
1108
|
}
|
|
1056
|
-
if (val[tone])
|
|
1057
|
-
|
|
1058
|
-
if (alpha)
|
|
1059
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
1109
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
1110
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1060
1111
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1061
1112
|
};
|
|
1062
1113
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1063
1114
|
const CONFIG2 = config || getActiveConfig();
|
|
1064
|
-
if (!globalTheme)
|
|
1065
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1115
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1066
1116
|
if (!isString(value)) {
|
|
1067
|
-
if (CONFIG2.verbose)
|
|
1068
|
-
console.warn(value, "- type for color is not valid");
|
|
1117
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1069
1118
|
return;
|
|
1070
1119
|
}
|
|
1071
|
-
if (value.slice(0, 2) === "--")
|
|
1072
|
-
return `var(${value})`;
|
|
1120
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1073
1121
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1074
1122
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1075
1123
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1076
1124
|
const isObj = isObject(val);
|
|
1077
|
-
if (isObj && val.value)
|
|
1078
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1125
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1079
1126
|
else if (isObj) {
|
|
1080
|
-
if (globalTheme)
|
|
1081
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
1127
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1082
1128
|
else {
|
|
1083
1129
|
const obj = {};
|
|
1084
1130
|
for (const mediaName in val) {
|
|
@@ -1089,22 +1135,20 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1089
1135
|
return obj;
|
|
1090
1136
|
}
|
|
1091
1137
|
} else {
|
|
1092
|
-
if (CONFIG2.verbose)
|
|
1093
|
-
console.warn("Can't find color", value);
|
|
1138
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1094
1139
|
return value;
|
|
1095
1140
|
}
|
|
1096
1141
|
};
|
|
1097
1142
|
|
|
1098
1143
|
// src/system/font.js
|
|
1099
|
-
var
|
|
1144
|
+
var import_utils13 = __toESM(require_cjs(), 1);
|
|
1100
1145
|
|
|
1101
1146
|
// src/system/spacing.js
|
|
1102
|
-
var
|
|
1147
|
+
var import_utils17 = __toESM(require_cjs(), 1);
|
|
1103
1148
|
var getSequence = (sequenceProps) => {
|
|
1104
1149
|
const CONFIG2 = getActiveConfig();
|
|
1105
1150
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1106
|
-
if (!sequenceProps)
|
|
1107
|
-
return SPACING2;
|
|
1151
|
+
if (!sequenceProps) return SPACING2;
|
|
1108
1152
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1109
1153
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1110
1154
|
};
|
|
@@ -1113,9 +1157,8 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1113
1157
|
if (isString(value) && (value.includes("calc") || value.includes("var"))) {
|
|
1114
1158
|
return { [propertyName]: value };
|
|
1115
1159
|
}
|
|
1116
|
-
const stack = (0,
|
|
1117
|
-
if (!isArray(stack))
|
|
1118
|
-
return;
|
|
1160
|
+
const stack = (0, import_utils17.arrayzeValue)(value);
|
|
1161
|
+
if (!isArray(stack)) return;
|
|
1119
1162
|
if (stack.length > 1) {
|
|
1120
1163
|
let suffix = "";
|
|
1121
1164
|
if (propertyName === "borderWidth") {
|
|
@@ -1174,32 +1217,25 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
|
1174
1217
|
// src/system/shadow.js
|
|
1175
1218
|
var getShadow = (value, globalTheme) => {
|
|
1176
1219
|
const CONFIG2 = getActiveConfig();
|
|
1177
|
-
if (!globalTheme)
|
|
1178
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1220
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1179
1221
|
if (!isString(value)) {
|
|
1180
|
-
if (CONFIG2.verbose)
|
|
1181
|
-
console.warn(value, "- type for color is not valid");
|
|
1222
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1182
1223
|
return;
|
|
1183
1224
|
}
|
|
1184
|
-
if (value.slice(0, 2) === "--")
|
|
1185
|
-
return `var(${value})`;
|
|
1225
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1186
1226
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1187
1227
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1188
1228
|
const val = SHADOW2[name];
|
|
1189
1229
|
const isObj = isObject(val);
|
|
1190
1230
|
if (!val) {
|
|
1191
|
-
if (CONFIG2.verbose)
|
|
1192
|
-
console.warn("Can't find color ", name);
|
|
1231
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1193
1232
|
return value;
|
|
1194
1233
|
}
|
|
1195
1234
|
if (globalTheme) {
|
|
1196
|
-
if (val[globalTheme])
|
|
1197
|
-
|
|
1198
|
-
else if (CONFIG2.verbose)
|
|
1199
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1235
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1236
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1200
1237
|
}
|
|
1201
|
-
if (isObj && val.value)
|
|
1202
|
-
return val.value;
|
|
1238
|
+
if (isObj && val.value) return val.value;
|
|
1203
1239
|
if (isObj) {
|
|
1204
1240
|
const obj = {};
|
|
1205
1241
|
for (const mediaName in val) {
|
|
@@ -1209,17 +1245,16 @@ var getShadow = (value, globalTheme) => {
|
|
|
1209
1245
|
}
|
|
1210
1246
|
return obj;
|
|
1211
1247
|
}
|
|
1212
|
-
if (CONFIG2.verbose)
|
|
1213
|
-
console.warn("Can't find color", value);
|
|
1248
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1214
1249
|
return value;
|
|
1215
1250
|
};
|
|
1216
1251
|
|
|
1217
1252
|
// src/system/timing.js
|
|
1218
|
-
var
|
|
1253
|
+
var import_utils21 = __toESM(require_cjs(), 1);
|
|
1219
1254
|
var getTimingFunction = (value) => {
|
|
1220
1255
|
const CONFIG2 = getActiveConfig();
|
|
1221
1256
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
1222
|
-
return TIMING2[value] || TIMING2[(0,
|
|
1257
|
+
return TIMING2[value] || TIMING2[(0, import_utils21.toCamelCase)(value)] || value;
|
|
1223
1258
|
};
|
|
1224
1259
|
var getTimingByKey = (value, property = "timing") => {
|
|
1225
1260
|
const CONFIG2 = getActiveConfig();
|
|
@@ -1231,9 +1266,6 @@ var getTimingByKey = (value, property = "timing") => {
|
|
|
1231
1266
|
);
|
|
1232
1267
|
};
|
|
1233
1268
|
|
|
1234
|
-
// src/system/svg.js
|
|
1235
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
1236
|
-
|
|
1237
1269
|
// src/transforms/index.js
|
|
1238
1270
|
var isBorderStyle = (str) => [
|
|
1239
1271
|
"none",
|
|
@@ -1252,25 +1284,18 @@ var transformBorder = (border) => {
|
|
|
1252
1284
|
const arr = border.split(", ");
|
|
1253
1285
|
return arr.map((v) => {
|
|
1254
1286
|
v = v.trim();
|
|
1255
|
-
if (v.slice(0, 2) === "--")
|
|
1256
|
-
|
|
1257
|
-
else if (
|
|
1258
|
-
|
|
1259
|
-
else if (v.slice(-2) === "px" || v.slice(-2) === "em")
|
|
1260
|
-
return v;
|
|
1261
|
-
else if (getColor(v).length > 2)
|
|
1262
|
-
return getColor(v);
|
|
1287
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1288
|
+
else if (isBorderStyle(v)) return v || "solid";
|
|
1289
|
+
else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
|
|
1290
|
+
else if (getColor(v).length > 2) return getColor(v);
|
|
1263
1291
|
return getSpacingByKey(v, "border").border;
|
|
1264
1292
|
}).join(" ");
|
|
1265
1293
|
};
|
|
1266
1294
|
var transformTextStroke = (stroke) => {
|
|
1267
1295
|
return stroke.split(", ").map((v) => {
|
|
1268
|
-
if (v.slice(0, 2) === "--")
|
|
1269
|
-
|
|
1270
|
-
if (v
|
|
1271
|
-
return v;
|
|
1272
|
-
else if (getColor(v))
|
|
1273
|
-
return getColor(v);
|
|
1296
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1297
|
+
if (v.includes("px")) return v;
|
|
1298
|
+
else if (getColor(v)) return getColor(v);
|
|
1274
1299
|
return v;
|
|
1275
1300
|
}).join(" ");
|
|
1276
1301
|
};
|
|
@@ -1278,64 +1303,52 @@ var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
|
|
|
1278
1303
|
var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
|
|
1279
1304
|
return shadow.split(",").map((v) => {
|
|
1280
1305
|
v = v.trim();
|
|
1281
|
-
if (v.slice(0, 2) === "--")
|
|
1282
|
-
return `var(${v})`;
|
|
1306
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1283
1307
|
if (getColor(v).length > 2) {
|
|
1284
1308
|
const color = getMediaColor(v, globalTheme);
|
|
1285
|
-
if (isObject(color))
|
|
1286
|
-
return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
1309
|
+
if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
1287
1310
|
return color;
|
|
1288
1311
|
}
|
|
1289
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1290
|
-
return v;
|
|
1312
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1291
1313
|
const arr = v.split(" ");
|
|
1292
|
-
if (!arr.length)
|
|
1293
|
-
return v;
|
|
1314
|
+
if (!arr.length) return v;
|
|
1294
1315
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1295
1316
|
}).join(" ");
|
|
1296
1317
|
}).join(",");
|
|
1297
1318
|
var transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
1298
1319
|
const CONFIG2 = getActiveConfig();
|
|
1299
1320
|
return backgroundImage.split(", ").map((v) => {
|
|
1300
|
-
if (v.slice(0, 2) === "--")
|
|
1301
|
-
|
|
1302
|
-
if (v.includes("url") || v.includes("gradient"))
|
|
1303
|
-
return v;
|
|
1321
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1322
|
+
if (v.includes("url") || v.includes("gradient")) return v;
|
|
1304
1323
|
else if (CONFIG2.GRADIENT[backgroundImage]) {
|
|
1305
1324
|
return {
|
|
1306
1325
|
backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
|
|
1307
1326
|
};
|
|
1308
|
-
} else if (v.includes("/") || v.startsWith("http") || v.includes("."))
|
|
1309
|
-
return `url(${v})`;
|
|
1327
|
+
} else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
|
|
1310
1328
|
return v;
|
|
1311
1329
|
}).join(" ");
|
|
1312
1330
|
};
|
|
1313
1331
|
var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
|
|
1314
1332
|
var transformTransition = (transition) => {
|
|
1315
1333
|
const arr = transition.split(" ");
|
|
1316
|
-
if (!arr.length)
|
|
1317
|
-
return transition;
|
|
1334
|
+
if (!arr.length) return transition;
|
|
1318
1335
|
return arr.map((v) => {
|
|
1319
|
-
if (v.slice(0, 2) === "--")
|
|
1320
|
-
return `var(${v})`;
|
|
1336
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1321
1337
|
if (v.length < 3 || v.includes("ms")) {
|
|
1322
1338
|
const mapWithSequence = getTimingByKey(v);
|
|
1323
1339
|
return mapWithSequence.timing || v;
|
|
1324
1340
|
}
|
|
1325
|
-
if (getTimingFunction(v))
|
|
1326
|
-
return getTimingFunction(v);
|
|
1341
|
+
if (getTimingFunction(v)) return getTimingFunction(v);
|
|
1327
1342
|
return v;
|
|
1328
1343
|
}).join(" ");
|
|
1329
1344
|
};
|
|
1330
1345
|
var transformDuration = (duration, props, propertyName) => {
|
|
1331
|
-
if (!isString(duration))
|
|
1332
|
-
return;
|
|
1346
|
+
if (!isString(duration)) return;
|
|
1333
1347
|
return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
|
|
1334
1348
|
};
|
|
1335
1349
|
var splitTransition = (transition) => {
|
|
1336
1350
|
const arr = transition.split(",");
|
|
1337
|
-
if (!arr.length)
|
|
1338
|
-
return;
|
|
1351
|
+
if (!arr.length) return;
|
|
1339
1352
|
return arr.map(transformTransition).join(",");
|
|
1340
1353
|
};
|
|
1341
1354
|
var checkIfBoxSize = (propertyName) => {
|
|
@@ -1344,16 +1357,14 @@ var checkIfBoxSize = (propertyName) => {
|
|
|
1344
1357
|
};
|
|
1345
1358
|
var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
1346
1359
|
let value = val || props[propertyName];
|
|
1347
|
-
if (isUndefined(value) && isNull(value))
|
|
1348
|
-
return;
|
|
1360
|
+
if (isUndefined(value) && isNull(value)) return;
|
|
1349
1361
|
const shouldScaleBoxSize = props.scaleBoxSize;
|
|
1350
1362
|
const isBoxSize = checkIfBoxSize(propertyName);
|
|
1351
1363
|
if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
|
|
1352
1364
|
value = value.split(" ").map((v) => {
|
|
1353
1365
|
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
1354
1366
|
const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
|
|
1355
|
-
if (isSingleLetter && !hasUnits)
|
|
1356
|
-
return v + "_default";
|
|
1367
|
+
if (isSingleLetter && !hasUnits) return v + "_default";
|
|
1357
1368
|
return v;
|
|
1358
1369
|
}).join(" ");
|
|
1359
1370
|
}
|
|
@@ -1363,8 +1374,14 @@ var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
|
1363
1374
|
return getSpacingByKey(value, propertyName);
|
|
1364
1375
|
}
|
|
1365
1376
|
};
|
|
1366
|
-
var transformSizeRatio = (propertyName, props) => {
|
|
1367
|
-
return transformSize(propertyName,
|
|
1377
|
+
var transformSizeRatio = (propertyName, val = null, props) => {
|
|
1378
|
+
return transformSize(propertyName, val, props, {
|
|
1368
1379
|
ratio: true
|
|
1369
1380
|
});
|
|
1370
1381
|
};
|
|
1382
|
+
var transformBorderRadius = (radius, props, propertyName) => {
|
|
1383
|
+
if (!isString(radius)) return;
|
|
1384
|
+
return {
|
|
1385
|
+
borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
|
|
1386
|
+
};
|
|
1387
|
+
};
|