@symbo.ls/scratch 2.11.523 → 3.0.1
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 +13 -20
- package/dist/cjs/index.js +193 -383
- package/dist/cjs/set.js +132 -282
- package/dist/cjs/system/color.js +61 -142
- package/dist/cjs/system/document.js +28 -84
- package/dist/cjs/system/font.js +29 -88
- package/dist/cjs/system/index.js +135 -285
- package/dist/cjs/system/reset.js +35 -98
- package/dist/cjs/system/shadow.js +77 -173
- package/dist/cjs/system/spacing.js +41 -112
- package/dist/cjs/system/svg.js +34 -94
- package/dist/cjs/system/theme.js +74 -168
- package/dist/cjs/system/timing.js +33 -96
- package/dist/cjs/system/typography.js +41 -110
- package/dist/cjs/transforms/index.js +112 -228
- package/dist/cjs/utils/color.js +22 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +67 -155
- package/dist/cjs/utils/sequence.js +34 -58
- package/dist/cjs/utils/sprite.js +13 -20
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +27 -45
- package/package.json +3 -3
- 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,44 +30,8 @@ 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
37
|
var __defProp3 = Object.defineProperty;
|
|
@@ -87,8 +51,8 @@ var require_cjs2 = __commonJS({
|
|
|
87
51
|
return to;
|
|
88
52
|
};
|
|
89
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90
|
-
var
|
|
91
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
92
56
|
arrayzeValue: () => arrayzeValue3,
|
|
93
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
94
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -109,12 +73,11 @@ 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";
|
|
@@ -139,13 +102,11 @@ var require_cjs2 = __commonJS({
|
|
|
139
102
|
};
|
|
140
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
141
104
|
val = parseFloat(val);
|
|
142
|
-
if (isObject2(factory))
|
|
143
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
144
106
|
return findClosestNumber(val, factory);
|
|
145
107
|
};
|
|
146
108
|
var formatDate = (timestamp) => {
|
|
147
|
-
if (!timestamp)
|
|
148
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
149
110
|
const d = new Date(timestamp);
|
|
150
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
151
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -212,8 +173,7 @@ var require_cjs2 = __commonJS({
|
|
|
212
173
|
scriptEle.type = type;
|
|
213
174
|
scriptEle.text = xhr.responseText;
|
|
214
175
|
doc.body.appendChild(scriptEle);
|
|
215
|
-
if (typeof fallback === "function")
|
|
216
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
217
177
|
} else {
|
|
218
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
219
179
|
}
|
|
@@ -281,20 +241,15 @@ var require_cjs2 = __commonJS({
|
|
|
281
241
|
);
|
|
282
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
283
243
|
var toDescriptionCase = (str = "") => {
|
|
284
|
-
if (typeof str !== "string")
|
|
285
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
286
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
287
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
288
247
|
};
|
|
289
248
|
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];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
298
253
|
};
|
|
299
254
|
}
|
|
300
255
|
});
|
|
@@ -306,6 +261,7 @@ __export(transforms_exports, {
|
|
|
306
261
|
splitTransition: () => splitTransition,
|
|
307
262
|
transformBackgroundImage: () => transformBackgroundImage,
|
|
308
263
|
transformBorder: () => transformBorder,
|
|
264
|
+
transformBorderRadius: () => transformBorderRadius,
|
|
309
265
|
transformBoxShadow: () => transformBoxShadow,
|
|
310
266
|
transformDuration: () => transformDuration,
|
|
311
267
|
transformShadow: () => transformShadow,
|
|
@@ -317,19 +273,18 @@ __export(transforms_exports, {
|
|
|
317
273
|
});
|
|
318
274
|
module.exports = __toCommonJS(transforms_exports);
|
|
319
275
|
|
|
320
|
-
//
|
|
276
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
321
277
|
var window2 = globalThis;
|
|
322
278
|
var document2 = window2.document;
|
|
323
279
|
|
|
324
|
-
//
|
|
280
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
325
281
|
var isDOMNode = (obj) => {
|
|
326
282
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
327
283
|
};
|
|
328
284
|
|
|
329
|
-
//
|
|
285
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
330
286
|
var isObject = (arg) => {
|
|
331
|
-
if (arg === null)
|
|
332
|
-
return false;
|
|
287
|
+
if (arg === null) return false;
|
|
333
288
|
return typeof arg === "object" && arg.constructor === Object;
|
|
334
289
|
};
|
|
335
290
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -338,20 +293,19 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
338
293
|
var isNull = (arg) => arg === null;
|
|
339
294
|
var isArray = (arg) => Array.isArray(arg);
|
|
340
295
|
var isObjectLike = (arg) => {
|
|
341
|
-
if (arg === null)
|
|
342
|
-
return false;
|
|
296
|
+
if (arg === null) return false;
|
|
343
297
|
return typeof arg === "object";
|
|
344
298
|
};
|
|
345
299
|
var isUndefined = (arg) => {
|
|
346
300
|
return arg === void 0;
|
|
347
301
|
};
|
|
348
302
|
|
|
349
|
-
//
|
|
303
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
350
304
|
var mergeArray = (arr, exclude = []) => {
|
|
351
305
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
352
306
|
};
|
|
353
307
|
|
|
354
|
-
//
|
|
308
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
355
309
|
var __defProp2 = Object.defineProperty;
|
|
356
310
|
var __defProps = Object.defineProperties;
|
|
357
311
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -374,8 +328,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
374
328
|
var merge = (element, obj, excludeFrom = []) => {
|
|
375
329
|
for (const e in obj) {
|
|
376
330
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
377
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
378
|
-
continue;
|
|
331
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
379
332
|
const elementProp = element[e];
|
|
380
333
|
const objProp = obj[e];
|
|
381
334
|
if (elementProp === void 0) {
|
|
@@ -387,8 +340,7 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
387
340
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
388
341
|
for (const e in extend) {
|
|
389
342
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
390
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
391
|
-
continue;
|
|
343
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
392
344
|
const elementProp = element[e];
|
|
393
345
|
const extendProp = extend[e];
|
|
394
346
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -417,13 +369,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
417
369
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
418
370
|
visited.set(obj, clone2);
|
|
419
371
|
for (const key in obj) {
|
|
420
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
421
|
-
|
|
422
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
423
|
-
continue;
|
|
372
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
373
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
424
374
|
const value = obj[key];
|
|
425
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
426
|
-
continue;
|
|
375
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
427
376
|
if (isDOMNode(value)) {
|
|
428
377
|
clone2[key] = value;
|
|
429
378
|
continue;
|
|
@@ -447,7 +396,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
447
396
|
return clone2;
|
|
448
397
|
};
|
|
449
398
|
|
|
450
|
-
//
|
|
399
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
451
400
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
452
401
|
|
|
453
402
|
// src/defaultConfig/index.js
|
|
@@ -677,12 +626,9 @@ var isScalingUnit = (unit) => {
|
|
|
677
626
|
};
|
|
678
627
|
|
|
679
628
|
// src/utils/color.js
|
|
680
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
681
629
|
var colorStringToRgbaArray = (color) => {
|
|
682
|
-
if (color === "")
|
|
683
|
-
|
|
684
|
-
if (color.toLowerCase() === "transparent")
|
|
685
|
-
return [0, 0, 0, 0];
|
|
630
|
+
if (color === "") return [0, 0, 0, 0];
|
|
631
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
686
632
|
if (color[0] === "#") {
|
|
687
633
|
if (color.length < 7) {
|
|
688
634
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -695,26 +641,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
695
641
|
];
|
|
696
642
|
}
|
|
697
643
|
if (color.indexOf("rgb") === -1) {
|
|
698
|
-
if (
|
|
699
|
-
const elem =
|
|
644
|
+
if (document2 && window2) {
|
|
645
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
700
646
|
const flag = "rgb(1, 2, 3)";
|
|
701
647
|
elem.style.color = flag;
|
|
702
648
|
if (elem.style.color !== flag) {
|
|
703
|
-
|
|
649
|
+
document2.body.removeChild(elem);
|
|
704
650
|
return;
|
|
705
651
|
}
|
|
706
652
|
elem.style.color = color;
|
|
707
653
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
708
|
-
|
|
654
|
+
document2.body.removeChild(elem);
|
|
709
655
|
return [0, 0, 0, 0];
|
|
710
656
|
}
|
|
711
|
-
color =
|
|
712
|
-
|
|
657
|
+
color = window2.getComputedStyle(elem).color;
|
|
658
|
+
document2.body.removeChild(elem);
|
|
713
659
|
}
|
|
714
660
|
}
|
|
715
661
|
if (color.indexOf("rgb") === 0) {
|
|
716
|
-
if (color.indexOf("rgba") === -1)
|
|
717
|
-
color = `${color}, 1`;
|
|
662
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
718
663
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
719
664
|
}
|
|
720
665
|
return [0, 0, 0, 0];
|
|
@@ -740,29 +685,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
740
685
|
var getColorShade = (col, amt) => {
|
|
741
686
|
const num = parseInt(col, 16);
|
|
742
687
|
let r = (num >> 16) + amt;
|
|
743
|
-
if (r > 255)
|
|
744
|
-
|
|
745
|
-
else if (r < 0)
|
|
746
|
-
r = 0;
|
|
688
|
+
if (r > 255) r = 255;
|
|
689
|
+
else if (r < 0) r = 0;
|
|
747
690
|
let b = (num >> 8 & 255) + amt;
|
|
748
|
-
if (b > 255)
|
|
749
|
-
|
|
750
|
-
else if (b < 0)
|
|
751
|
-
b = 0;
|
|
691
|
+
if (b > 255) b = 255;
|
|
692
|
+
else if (b < 0) b = 0;
|
|
752
693
|
let g = (num & 255) + amt;
|
|
753
|
-
if (g > 255)
|
|
754
|
-
|
|
755
|
-
else if (g < 0)
|
|
756
|
-
g = 0;
|
|
694
|
+
if (g > 255) g = 255;
|
|
695
|
+
else if (g < 0) g = 0;
|
|
757
696
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
758
697
|
};
|
|
759
698
|
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 += "";
|
|
699
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
700
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
701
|
+
if (isNumber(tone)) tone += "";
|
|
766
702
|
const toHex = rgbArrayToHex(rgb);
|
|
767
703
|
const abs = tone.slice(0, 1);
|
|
768
704
|
if (abs === "-" || abs === "+") {
|
|
@@ -778,7 +714,7 @@ var getRgbTone = (rgb, tone) => {
|
|
|
778
714
|
};
|
|
779
715
|
|
|
780
716
|
// src/utils/sequence.js
|
|
781
|
-
var import_utils4 = __toESM(
|
|
717
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
782
718
|
var numToLetterMap = {
|
|
783
719
|
"-6": "U",
|
|
784
720
|
"-5": "V",
|
|
@@ -824,8 +760,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
824
760
|
var setScalingVar = (key, sequenceProps) => {
|
|
825
761
|
const { base, type, unit } = sequenceProps;
|
|
826
762
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
827
|
-
if (key === 0)
|
|
828
|
-
return defaultVal;
|
|
763
|
+
if (key === 0) return defaultVal;
|
|
829
764
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
830
765
|
const ratioVar = `${prefix}-ratio`;
|
|
831
766
|
if (key > 0) {
|
|
@@ -862,10 +797,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
862
797
|
const diffRounded = ~~next - ~~value;
|
|
863
798
|
let arr;
|
|
864
799
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
865
|
-
if (diffRounded > 16)
|
|
866
|
-
|
|
867
|
-
else
|
|
868
|
-
arr = [first, second];
|
|
800
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
801
|
+
else arr = [first, second];
|
|
869
802
|
arr.forEach((v, k) => {
|
|
870
803
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
871
804
|
const newVar = variable + (k + 1);
|
|
@@ -907,8 +840,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
907
840
|
index: key
|
|
908
841
|
};
|
|
909
842
|
setSequenceValue(props, sequenceProps);
|
|
910
|
-
if (subSequence)
|
|
911
|
-
generateSubSequence(props, sequenceProps);
|
|
843
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
912
844
|
}
|
|
913
845
|
return sequenceProps;
|
|
914
846
|
};
|
|
@@ -920,13 +852,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
920
852
|
unit = UNIT2.default,
|
|
921
853
|
useVariable
|
|
922
854
|
} = sequenceProps;
|
|
923
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
924
|
-
return `var(${value})`;
|
|
855
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
925
856
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
926
857
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
927
858
|
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;
|
|
859
|
+
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
860
|
const letterVal = value.toUpperCase();
|
|
931
861
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
932
862
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -950,8 +880,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
950
880
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
951
881
|
}
|
|
952
882
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
953
|
-
if (CONFIG2.verbose)
|
|
954
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
883
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
955
884
|
absValue = absValue.slice(0, 1);
|
|
956
885
|
}
|
|
957
886
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -959,8 +888,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
959
888
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
960
889
|
}
|
|
961
890
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
962
|
-
if (!sequenceItem)
|
|
963
|
-
return console.warn("can't find", sequence, absValue);
|
|
891
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
964
892
|
if (unit === "ms" || unit === "s") {
|
|
965
893
|
return isNegative + sequenceItem.val + unit;
|
|
966
894
|
}
|
|
@@ -969,12 +897,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
969
897
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
970
898
|
if (typeof value !== "string") {
|
|
971
899
|
const CONFIG2 = getActiveConfig();
|
|
972
|
-
if (CONFIG2.verbose)
|
|
973
|
-
console.warn(propertyName, value, "is not a string");
|
|
900
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
974
901
|
return { [propertyName]: value };
|
|
975
902
|
}
|
|
976
|
-
if (value === "-" || value === "")
|
|
977
|
-
return {};
|
|
903
|
+
if (value === "-" || value === "") return {};
|
|
978
904
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
979
905
|
};
|
|
980
906
|
|
|
@@ -1023,27 +949,21 @@ var applySequenceVars = (FACTORY2, options = {}) => {
|
|
|
1023
949
|
var getColor = (value, key, config) => {
|
|
1024
950
|
const CONFIG2 = config || getActiveConfig();
|
|
1025
951
|
if (!isString(value)) {
|
|
1026
|
-
if (CONFIG2.verbose)
|
|
1027
|
-
console.warn(value, "- type for color is not valid");
|
|
952
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1028
953
|
return;
|
|
1029
954
|
}
|
|
1030
|
-
if (value.slice(0, 2) === "--")
|
|
1031
|
-
|
|
1032
|
-
if (key && value[key])
|
|
1033
|
-
value = value[key];
|
|
955
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
956
|
+
if (key && value[key]) value = value[key];
|
|
1034
957
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
1035
958
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1036
959
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1037
960
|
if (!val) {
|
|
1038
|
-
if (CONFIG2.verbose)
|
|
1039
|
-
console.warn("Can't find color ", name);
|
|
961
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1040
962
|
return value;
|
|
1041
963
|
}
|
|
1042
964
|
if (key) {
|
|
1043
|
-
if (val[key])
|
|
1044
|
-
|
|
1045
|
-
else if (CONFIG2.verbose)
|
|
1046
|
-
console.warn(value, " - does not have ", key);
|
|
965
|
+
if (val[key]) val = val[key];
|
|
966
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
1047
967
|
}
|
|
1048
968
|
let rgb = val.rgb;
|
|
1049
969
|
if (!rgb) {
|
|
@@ -1053,32 +973,25 @@ var getColor = (value, key, config) => {
|
|
|
1053
973
|
rgb = getRgbTone(rgb, tone);
|
|
1054
974
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1055
975
|
}
|
|
1056
|
-
if (val[tone])
|
|
1057
|
-
|
|
1058
|
-
if (alpha)
|
|
1059
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
976
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
977
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
1060
978
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1061
979
|
};
|
|
1062
980
|
var getMediaColor = (value, globalTheme, config) => {
|
|
1063
981
|
const CONFIG2 = config || getActiveConfig();
|
|
1064
|
-
if (!globalTheme)
|
|
1065
|
-
globalTheme = CONFIG2.globalTheme;
|
|
982
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1066
983
|
if (!isString(value)) {
|
|
1067
|
-
if (CONFIG2.verbose)
|
|
1068
|
-
console.warn(value, "- type for color is not valid");
|
|
984
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1069
985
|
return;
|
|
1070
986
|
}
|
|
1071
|
-
if (value.slice(0, 2) === "--")
|
|
1072
|
-
return `var(${value})`;
|
|
987
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1073
988
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1074
989
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1075
990
|
const val = COLOR2[name] || GRADIENT2[name];
|
|
1076
991
|
const isObj = isObject(val);
|
|
1077
|
-
if (isObj && val.value)
|
|
1078
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
992
|
+
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1079
993
|
else if (isObj) {
|
|
1080
|
-
if (globalTheme)
|
|
1081
|
-
return getColor(value, `@${globalTheme}`, config);
|
|
994
|
+
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
1082
995
|
else {
|
|
1083
996
|
const obj = {};
|
|
1084
997
|
for (const mediaName in val) {
|
|
@@ -1089,22 +1002,20 @@ var getMediaColor = (value, globalTheme, config) => {
|
|
|
1089
1002
|
return obj;
|
|
1090
1003
|
}
|
|
1091
1004
|
} else {
|
|
1092
|
-
if (CONFIG2.verbose)
|
|
1093
|
-
console.warn("Can't find color", value);
|
|
1005
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1094
1006
|
return value;
|
|
1095
1007
|
}
|
|
1096
1008
|
};
|
|
1097
1009
|
|
|
1098
1010
|
// src/system/font.js
|
|
1099
|
-
var import_utils11 = __toESM(
|
|
1011
|
+
var import_utils11 = __toESM(require_cjs(), 1);
|
|
1100
1012
|
|
|
1101
1013
|
// src/system/spacing.js
|
|
1102
|
-
var import_utils15 = __toESM(
|
|
1014
|
+
var import_utils15 = __toESM(require_cjs(), 1);
|
|
1103
1015
|
var getSequence = (sequenceProps) => {
|
|
1104
1016
|
const CONFIG2 = getActiveConfig();
|
|
1105
1017
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1106
|
-
if (!sequenceProps)
|
|
1107
|
-
return SPACING2;
|
|
1018
|
+
if (!sequenceProps) return SPACING2;
|
|
1108
1019
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1109
1020
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1110
1021
|
};
|
|
@@ -1114,8 +1025,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1114
1025
|
return { [propertyName]: value };
|
|
1115
1026
|
}
|
|
1116
1027
|
const stack = (0, import_utils15.arrayzeValue)(value);
|
|
1117
|
-
if (!isArray(stack))
|
|
1118
|
-
return;
|
|
1028
|
+
if (!isArray(stack)) return;
|
|
1119
1029
|
if (stack.length > 1) {
|
|
1120
1030
|
let suffix = "";
|
|
1121
1031
|
if (propertyName === "borderWidth") {
|
|
@@ -1174,32 +1084,25 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
|
1174
1084
|
// src/system/shadow.js
|
|
1175
1085
|
var getShadow = (value, globalTheme) => {
|
|
1176
1086
|
const CONFIG2 = getActiveConfig();
|
|
1177
|
-
if (!globalTheme)
|
|
1178
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1087
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1179
1088
|
if (!isString(value)) {
|
|
1180
|
-
if (CONFIG2.verbose)
|
|
1181
|
-
console.warn(value, "- type for color is not valid");
|
|
1089
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1182
1090
|
return;
|
|
1183
1091
|
}
|
|
1184
|
-
if (value.slice(0, 2) === "--")
|
|
1185
|
-
return `var(${value})`;
|
|
1092
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1186
1093
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1187
1094
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1188
1095
|
const val = SHADOW2[name];
|
|
1189
1096
|
const isObj = isObject(val);
|
|
1190
1097
|
if (!val) {
|
|
1191
|
-
if (CONFIG2.verbose)
|
|
1192
|
-
console.warn("Can't find color ", name);
|
|
1098
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1193
1099
|
return value;
|
|
1194
1100
|
}
|
|
1195
1101
|
if (globalTheme) {
|
|
1196
|
-
if (val[globalTheme])
|
|
1197
|
-
|
|
1198
|
-
else if (CONFIG2.verbose)
|
|
1199
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1102
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1103
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1200
1104
|
}
|
|
1201
|
-
if (isObj && val.value)
|
|
1202
|
-
return val.value;
|
|
1105
|
+
if (isObj && val.value) return val.value;
|
|
1203
1106
|
if (isObj) {
|
|
1204
1107
|
const obj = {};
|
|
1205
1108
|
for (const mediaName in val) {
|
|
@@ -1209,13 +1112,12 @@ var getShadow = (value, globalTheme) => {
|
|
|
1209
1112
|
}
|
|
1210
1113
|
return obj;
|
|
1211
1114
|
}
|
|
1212
|
-
if (CONFIG2.verbose)
|
|
1213
|
-
console.warn("Can't find color", value);
|
|
1115
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1214
1116
|
return value;
|
|
1215
1117
|
};
|
|
1216
1118
|
|
|
1217
1119
|
// src/system/timing.js
|
|
1218
|
-
var import_utils19 = __toESM(
|
|
1120
|
+
var import_utils19 = __toESM(require_cjs(), 1);
|
|
1219
1121
|
var getTimingFunction = (value) => {
|
|
1220
1122
|
const CONFIG2 = getActiveConfig();
|
|
1221
1123
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
@@ -1231,9 +1133,6 @@ var getTimingByKey = (value, property = "timing") => {
|
|
|
1231
1133
|
);
|
|
1232
1134
|
};
|
|
1233
1135
|
|
|
1234
|
-
// src/system/svg.js
|
|
1235
|
-
var import_globals5 = __toESM(require_cjs(), 1);
|
|
1236
|
-
|
|
1237
1136
|
// src/transforms/index.js
|
|
1238
1137
|
var isBorderStyle = (str) => [
|
|
1239
1138
|
"none",
|
|
@@ -1252,25 +1151,18 @@ var transformBorder = (border) => {
|
|
|
1252
1151
|
const arr = border.split(", ");
|
|
1253
1152
|
return arr.map((v) => {
|
|
1254
1153
|
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);
|
|
1154
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1155
|
+
else if (isBorderStyle(v)) return v || "solid";
|
|
1156
|
+
else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
|
|
1157
|
+
else if (getColor(v).length > 2) return getColor(v);
|
|
1263
1158
|
return getSpacingByKey(v, "border").border;
|
|
1264
1159
|
}).join(" ");
|
|
1265
1160
|
};
|
|
1266
1161
|
var transformTextStroke = (stroke) => {
|
|
1267
1162
|
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);
|
|
1163
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1164
|
+
if (v.includes("px")) return v;
|
|
1165
|
+
else if (getColor(v)) return getColor(v);
|
|
1274
1166
|
return v;
|
|
1275
1167
|
}).join(" ");
|
|
1276
1168
|
};
|
|
@@ -1278,64 +1170,52 @@ var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
|
|
|
1278
1170
|
var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
|
|
1279
1171
|
return shadow.split(",").map((v) => {
|
|
1280
1172
|
v = v.trim();
|
|
1281
|
-
if (v.slice(0, 2) === "--")
|
|
1282
|
-
return `var(${v})`;
|
|
1173
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1283
1174
|
if (getColor(v).length > 2) {
|
|
1284
1175
|
const color = getMediaColor(v, globalTheme);
|
|
1285
|
-
if (isObject(color))
|
|
1286
|
-
return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
1176
|
+
if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
|
|
1287
1177
|
return color;
|
|
1288
1178
|
}
|
|
1289
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1290
|
-
return v;
|
|
1179
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1291
1180
|
const arr = v.split(" ");
|
|
1292
|
-
if (!arr.length)
|
|
1293
|
-
return v;
|
|
1181
|
+
if (!arr.length) return v;
|
|
1294
1182
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1295
1183
|
}).join(" ");
|
|
1296
1184
|
}).join(",");
|
|
1297
1185
|
var transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
1298
1186
|
const CONFIG2 = getActiveConfig();
|
|
1299
1187
|
return backgroundImage.split(", ").map((v) => {
|
|
1300
|
-
if (v.slice(0, 2) === "--")
|
|
1301
|
-
|
|
1302
|
-
if (v.includes("url") || v.includes("gradient"))
|
|
1303
|
-
return v;
|
|
1188
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1189
|
+
if (v.includes("url") || v.includes("gradient")) return v;
|
|
1304
1190
|
else if (CONFIG2.GRADIENT[backgroundImage]) {
|
|
1305
1191
|
return {
|
|
1306
1192
|
backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
|
|
1307
1193
|
};
|
|
1308
|
-
} else if (v.includes("/") || v.startsWith("http") || v.includes("."))
|
|
1309
|
-
return `url(${v})`;
|
|
1194
|
+
} else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
|
|
1310
1195
|
return v;
|
|
1311
1196
|
}).join(" ");
|
|
1312
1197
|
};
|
|
1313
1198
|
var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
|
|
1314
1199
|
var transformTransition = (transition) => {
|
|
1315
1200
|
const arr = transition.split(" ");
|
|
1316
|
-
if (!arr.length)
|
|
1317
|
-
return transition;
|
|
1201
|
+
if (!arr.length) return transition;
|
|
1318
1202
|
return arr.map((v) => {
|
|
1319
|
-
if (v.slice(0, 2) === "--")
|
|
1320
|
-
return `var(${v})`;
|
|
1203
|
+
if (v.slice(0, 2) === "--") return `var(${v})`;
|
|
1321
1204
|
if (v.length < 3 || v.includes("ms")) {
|
|
1322
1205
|
const mapWithSequence = getTimingByKey(v);
|
|
1323
1206
|
return mapWithSequence.timing || v;
|
|
1324
1207
|
}
|
|
1325
|
-
if (getTimingFunction(v))
|
|
1326
|
-
return getTimingFunction(v);
|
|
1208
|
+
if (getTimingFunction(v)) return getTimingFunction(v);
|
|
1327
1209
|
return v;
|
|
1328
1210
|
}).join(" ");
|
|
1329
1211
|
};
|
|
1330
1212
|
var transformDuration = (duration, props, propertyName) => {
|
|
1331
|
-
if (!isString(duration))
|
|
1332
|
-
return;
|
|
1213
|
+
if (!isString(duration)) return;
|
|
1333
1214
|
return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
|
|
1334
1215
|
};
|
|
1335
1216
|
var splitTransition = (transition) => {
|
|
1336
1217
|
const arr = transition.split(",");
|
|
1337
|
-
if (!arr.length)
|
|
1338
|
-
return;
|
|
1218
|
+
if (!arr.length) return;
|
|
1339
1219
|
return arr.map(transformTransition).join(",");
|
|
1340
1220
|
};
|
|
1341
1221
|
var checkIfBoxSize = (propertyName) => {
|
|
@@ -1344,16 +1224,14 @@ var checkIfBoxSize = (propertyName) => {
|
|
|
1344
1224
|
};
|
|
1345
1225
|
var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
1346
1226
|
let value = val || props[propertyName];
|
|
1347
|
-
if (isUndefined(value) && isNull(value))
|
|
1348
|
-
return;
|
|
1227
|
+
if (isUndefined(value) && isNull(value)) return;
|
|
1349
1228
|
const shouldScaleBoxSize = props.scaleBoxSize;
|
|
1350
1229
|
const isBoxSize = checkIfBoxSize(propertyName);
|
|
1351
1230
|
if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
|
|
1352
1231
|
value = value.split(" ").map((v) => {
|
|
1353
1232
|
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
1354
1233
|
const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
|
|
1355
|
-
if (isSingleLetter && !hasUnits)
|
|
1356
|
-
return v + "_default";
|
|
1234
|
+
if (isSingleLetter && !hasUnits) return v + "_default";
|
|
1357
1235
|
return v;
|
|
1358
1236
|
}).join(" ");
|
|
1359
1237
|
}
|
|
@@ -1363,8 +1241,14 @@ var transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
|
1363
1241
|
return getSpacingByKey(value, propertyName);
|
|
1364
1242
|
}
|
|
1365
1243
|
};
|
|
1366
|
-
var transformSizeRatio = (propertyName, props) => {
|
|
1367
|
-
return transformSize(propertyName,
|
|
1244
|
+
var transformSizeRatio = (propertyName, val = null, props) => {
|
|
1245
|
+
return transformSize(propertyName, val, props, {
|
|
1368
1246
|
ratio: true
|
|
1369
1247
|
});
|
|
1370
1248
|
};
|
|
1249
|
+
var transformBorderRadius = (radius, props, propertyName) => {
|
|
1250
|
+
if (!isString(radius)) return;
|
|
1251
|
+
return {
|
|
1252
|
+
borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
|
|
1253
|
+
};
|
|
1254
|
+
};
|