@symbo.ls/scratch 2.11.522 → 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 +192 -382
- 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 +66 -154
- package/dist/cjs/utils/sequence.js +33 -57
- 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
|
@@ -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: () => 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
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: () => arrayzeValue2,
|
|
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 arrayzeValue2 = (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
|
});
|
|
@@ -307,19 +262,18 @@ __export(shadow_exports, {
|
|
|
307
262
|
});
|
|
308
263
|
module.exports = __toCommonJS(shadow_exports);
|
|
309
264
|
|
|
310
|
-
//
|
|
265
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
311
266
|
var window2 = globalThis;
|
|
312
267
|
var document2 = window2.document;
|
|
313
268
|
|
|
314
|
-
//
|
|
269
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
315
270
|
var isDOMNode = (obj) => {
|
|
316
271
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
317
272
|
};
|
|
318
273
|
|
|
319
|
-
//
|
|
274
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
320
275
|
var isObject = (arg) => {
|
|
321
|
-
if (arg === null)
|
|
322
|
-
return false;
|
|
276
|
+
if (arg === null) return false;
|
|
323
277
|
return typeof arg === "object" && arg.constructor === Object;
|
|
324
278
|
};
|
|
325
279
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -328,20 +282,19 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
328
282
|
var isNull = (arg) => arg === null;
|
|
329
283
|
var isArray = (arg) => Array.isArray(arg);
|
|
330
284
|
var isObjectLike = (arg) => {
|
|
331
|
-
if (arg === null)
|
|
332
|
-
return false;
|
|
285
|
+
if (arg === null) return false;
|
|
333
286
|
return typeof arg === "object";
|
|
334
287
|
};
|
|
335
288
|
var isUndefined = (arg) => {
|
|
336
289
|
return arg === void 0;
|
|
337
290
|
};
|
|
338
291
|
|
|
339
|
-
//
|
|
292
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
340
293
|
var mergeArray = (arr, exclude = []) => {
|
|
341
294
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
342
295
|
};
|
|
343
296
|
|
|
344
|
-
//
|
|
297
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
345
298
|
var __defProp2 = Object.defineProperty;
|
|
346
299
|
var __defProps = Object.defineProperties;
|
|
347
300
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -364,8 +317,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
364
317
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
365
318
|
for (const e in extend) {
|
|
366
319
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
367
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
368
|
-
continue;
|
|
320
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
369
321
|
const elementProp = element[e];
|
|
370
322
|
const extendProp = extend[e];
|
|
371
323
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -394,13 +346,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
394
346
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
395
347
|
visited.set(obj, clone2);
|
|
396
348
|
for (const key in obj) {
|
|
397
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
398
|
-
|
|
399
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
400
|
-
continue;
|
|
349
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
350
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
401
351
|
const value = obj[key];
|
|
402
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
403
|
-
continue;
|
|
352
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
404
353
|
if (isDOMNode(value)) {
|
|
405
354
|
clone2[key] = value;
|
|
406
355
|
continue;
|
|
@@ -424,7 +373,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
424
373
|
return clone2;
|
|
425
374
|
};
|
|
426
375
|
|
|
427
|
-
//
|
|
376
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
428
377
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
429
378
|
|
|
430
379
|
// src/defaultConfig/index.js
|
|
@@ -654,12 +603,9 @@ var isScalingUnit = (unit) => {
|
|
|
654
603
|
};
|
|
655
604
|
|
|
656
605
|
// src/utils/color.js
|
|
657
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
658
606
|
var colorStringToRgbaArray = (color) => {
|
|
659
|
-
if (color === "")
|
|
660
|
-
|
|
661
|
-
if (color.toLowerCase() === "transparent")
|
|
662
|
-
return [0, 0, 0, 0];
|
|
607
|
+
if (color === "") return [0, 0, 0, 0];
|
|
608
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
663
609
|
if (color[0] === "#") {
|
|
664
610
|
if (color.length < 7) {
|
|
665
611
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -672,26 +618,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
672
618
|
];
|
|
673
619
|
}
|
|
674
620
|
if (color.indexOf("rgb") === -1) {
|
|
675
|
-
if (
|
|
676
|
-
const elem =
|
|
621
|
+
if (document2 && window2) {
|
|
622
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
677
623
|
const flag = "rgb(1, 2, 3)";
|
|
678
624
|
elem.style.color = flag;
|
|
679
625
|
if (elem.style.color !== flag) {
|
|
680
|
-
|
|
626
|
+
document2.body.removeChild(elem);
|
|
681
627
|
return;
|
|
682
628
|
}
|
|
683
629
|
elem.style.color = color;
|
|
684
630
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
685
|
-
|
|
631
|
+
document2.body.removeChild(elem);
|
|
686
632
|
return [0, 0, 0, 0];
|
|
687
633
|
}
|
|
688
|
-
color =
|
|
689
|
-
|
|
634
|
+
color = window2.getComputedStyle(elem).color;
|
|
635
|
+
document2.body.removeChild(elem);
|
|
690
636
|
}
|
|
691
637
|
}
|
|
692
638
|
if (color.indexOf("rgb") === 0) {
|
|
693
|
-
if (color.indexOf("rgba") === -1)
|
|
694
|
-
color = `${color}, 1`;
|
|
639
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
695
640
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
696
641
|
}
|
|
697
642
|
return [0, 0, 0, 0];
|
|
@@ -717,29 +662,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
717
662
|
var getColorShade = (col, amt) => {
|
|
718
663
|
const num = parseInt(col, 16);
|
|
719
664
|
let r = (num >> 16) + amt;
|
|
720
|
-
if (r > 255)
|
|
721
|
-
|
|
722
|
-
else if (r < 0)
|
|
723
|
-
r = 0;
|
|
665
|
+
if (r > 255) r = 255;
|
|
666
|
+
else if (r < 0) r = 0;
|
|
724
667
|
let b = (num >> 8 & 255) + amt;
|
|
725
|
-
if (b > 255)
|
|
726
|
-
|
|
727
|
-
else if (b < 0)
|
|
728
|
-
b = 0;
|
|
668
|
+
if (b > 255) b = 255;
|
|
669
|
+
else if (b < 0) b = 0;
|
|
729
670
|
let g = (num & 255) + amt;
|
|
730
|
-
if (g > 255)
|
|
731
|
-
|
|
732
|
-
else if (g < 0)
|
|
733
|
-
g = 0;
|
|
671
|
+
if (g > 255) g = 255;
|
|
672
|
+
else if (g < 0) g = 0;
|
|
734
673
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
735
674
|
};
|
|
736
675
|
var getRgbTone = (rgb, tone) => {
|
|
737
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
738
|
-
|
|
739
|
-
if (
|
|
740
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
741
|
-
if (isNumber(tone))
|
|
742
|
-
tone += "";
|
|
676
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
677
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
678
|
+
if (isNumber(tone)) tone += "";
|
|
743
679
|
const toHex = rgbArrayToHex(rgb);
|
|
744
680
|
const abs = tone.slice(0, 1);
|
|
745
681
|
if (abs === "-" || abs === "+") {
|
|
@@ -755,7 +691,7 @@ var getRgbTone = (rgb, tone) => {
|
|
|
755
691
|
};
|
|
756
692
|
|
|
757
693
|
// src/utils/sequence.js
|
|
758
|
-
var import_utils4 = __toESM(
|
|
694
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
759
695
|
var numToLetterMap = {
|
|
760
696
|
"-6": "U",
|
|
761
697
|
"-5": "V",
|
|
@@ -801,8 +737,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
801
737
|
var setScalingVar = (key, sequenceProps) => {
|
|
802
738
|
const { base, type, unit } = sequenceProps;
|
|
803
739
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
804
|
-
if (key === 0)
|
|
805
|
-
return defaultVal;
|
|
740
|
+
if (key === 0) return defaultVal;
|
|
806
741
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
807
742
|
const ratioVar = `${prefix}-ratio`;
|
|
808
743
|
if (key > 0) {
|
|
@@ -836,10 +771,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
836
771
|
const diffRounded = ~~next - ~~value;
|
|
837
772
|
let arr;
|
|
838
773
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
839
|
-
if (diffRounded > 16)
|
|
840
|
-
|
|
841
|
-
else
|
|
842
|
-
arr = [first, second];
|
|
774
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
775
|
+
else arr = [first, second];
|
|
843
776
|
arr.forEach((v, k) => {
|
|
844
777
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
845
778
|
const newVar = variable + (k + 1);
|
|
@@ -881,8 +814,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
881
814
|
index: key
|
|
882
815
|
};
|
|
883
816
|
setSequenceValue(props, sequenceProps);
|
|
884
|
-
if (subSequence)
|
|
885
|
-
generateSubSequence(props, sequenceProps);
|
|
817
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
886
818
|
}
|
|
887
819
|
return sequenceProps;
|
|
888
820
|
};
|
|
@@ -894,13 +826,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
894
826
|
unit = UNIT2.default,
|
|
895
827
|
useVariable
|
|
896
828
|
} = sequenceProps;
|
|
897
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
898
|
-
return `var(${value})`;
|
|
829
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
899
830
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
900
831
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
901
832
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
902
|
-
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)
|
|
903
|
-
return value;
|
|
833
|
+
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;
|
|
904
834
|
const letterVal = value.toUpperCase();
|
|
905
835
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
906
836
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -924,8 +854,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
924
854
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
925
855
|
}
|
|
926
856
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
927
|
-
if (CONFIG2.verbose)
|
|
928
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
857
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
929
858
|
absValue = absValue.slice(0, 1);
|
|
930
859
|
}
|
|
931
860
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -933,8 +862,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
933
862
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
934
863
|
}
|
|
935
864
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
936
|
-
if (!sequenceItem)
|
|
937
|
-
return console.warn("can't find", sequence, absValue);
|
|
865
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
938
866
|
if (unit === "ms" || unit === "s") {
|
|
939
867
|
return isNegative + sequenceItem.val + unit;
|
|
940
868
|
}
|
|
@@ -943,12 +871,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
943
871
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
944
872
|
if (typeof value !== "string") {
|
|
945
873
|
const CONFIG2 = getActiveConfig();
|
|
946
|
-
if (CONFIG2.verbose)
|
|
947
|
-
console.warn(propertyName, value, "is not a string");
|
|
874
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
948
875
|
return { [propertyName]: value };
|
|
949
876
|
}
|
|
950
|
-
if (value === "-" || value === "")
|
|
951
|
-
return {};
|
|
877
|
+
if (value === "-" || value === "") return {};
|
|
952
878
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
953
879
|
};
|
|
954
880
|
|
|
@@ -956,27 +882,21 @@ var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
|
956
882
|
var getColor = (value, key, config) => {
|
|
957
883
|
const CONFIG2 = config || getActiveConfig();
|
|
958
884
|
if (!isString(value)) {
|
|
959
|
-
if (CONFIG2.verbose)
|
|
960
|
-
console.warn(value, "- type for color is not valid");
|
|
885
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
961
886
|
return;
|
|
962
887
|
}
|
|
963
|
-
if (value.slice(0, 2) === "--")
|
|
964
|
-
|
|
965
|
-
if (key && value[key])
|
|
966
|
-
value = value[key];
|
|
888
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
889
|
+
if (key && value[key]) value = value[key];
|
|
967
890
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
968
891
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
969
892
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
970
893
|
if (!val) {
|
|
971
|
-
if (CONFIG2.verbose)
|
|
972
|
-
console.warn("Can't find color ", name);
|
|
894
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
973
895
|
return value;
|
|
974
896
|
}
|
|
975
897
|
if (key) {
|
|
976
|
-
if (val[key])
|
|
977
|
-
|
|
978
|
-
else if (CONFIG2.verbose)
|
|
979
|
-
console.warn(value, " - does not have ", key);
|
|
898
|
+
if (val[key]) val = val[key];
|
|
899
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
980
900
|
}
|
|
981
901
|
let rgb = val.rgb;
|
|
982
902
|
if (!rgb) {
|
|
@@ -986,20 +906,17 @@ var getColor = (value, key, config) => {
|
|
|
986
906
|
rgb = getRgbTone(rgb, tone);
|
|
987
907
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
988
908
|
}
|
|
989
|
-
if (val[tone])
|
|
990
|
-
|
|
991
|
-
if (alpha)
|
|
992
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
909
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
910
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
993
911
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
994
912
|
};
|
|
995
913
|
|
|
996
914
|
// src/system/spacing.js
|
|
997
|
-
var import_utils9 = __toESM(
|
|
915
|
+
var import_utils9 = __toESM(require_cjs(), 1);
|
|
998
916
|
var getSequence = (sequenceProps) => {
|
|
999
917
|
const CONFIG2 = getActiveConfig();
|
|
1000
918
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
1001
|
-
if (!sequenceProps)
|
|
1002
|
-
return SPACING2;
|
|
919
|
+
if (!sequenceProps) return SPACING2;
|
|
1003
920
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1004
921
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1005
922
|
};
|
|
@@ -1009,8 +926,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1009
926
|
return { [propertyName]: value };
|
|
1010
927
|
}
|
|
1011
928
|
const stack = (0, import_utils9.arrayzeValue)(value);
|
|
1012
|
-
if (!isArray(stack))
|
|
1013
|
-
return;
|
|
929
|
+
if (!isArray(stack)) return;
|
|
1014
930
|
if (stack.length > 1) {
|
|
1015
931
|
let suffix = "";
|
|
1016
932
|
if (propertyName === "borderWidth") {
|
|
@@ -1059,15 +975,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1059
975
|
if (isString(value) && value.includes(",")) {
|
|
1060
976
|
value = value.split(",").map((v) => {
|
|
1061
977
|
v = v.trim();
|
|
1062
|
-
if (v.startsWith("--"))
|
|
1063
|
-
|
|
1064
|
-
if (
|
|
1065
|
-
return getColor(v);
|
|
1066
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1067
|
-
return v;
|
|
978
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
979
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
980
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1068
981
|
const arr = v.split(" ");
|
|
1069
|
-
if (!arr.length)
|
|
1070
|
-
return v;
|
|
982
|
+
if (!arr.length) return v;
|
|
1071
983
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1072
984
|
}).join(" ");
|
|
1073
985
|
}
|
|
@@ -1082,32 +994,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1082
994
|
};
|
|
1083
995
|
var getShadow = (value, globalTheme) => {
|
|
1084
996
|
const CONFIG2 = getActiveConfig();
|
|
1085
|
-
if (!globalTheme)
|
|
1086
|
-
globalTheme = CONFIG2.globalTheme;
|
|
997
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1087
998
|
if (!isString(value)) {
|
|
1088
|
-
if (CONFIG2.verbose)
|
|
1089
|
-
console.warn(value, "- type for color is not valid");
|
|
999
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1090
1000
|
return;
|
|
1091
1001
|
}
|
|
1092
|
-
if (value.slice(0, 2) === "--")
|
|
1093
|
-
return `var(${value})`;
|
|
1002
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1094
1003
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1095
1004
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1096
1005
|
const val = SHADOW2[name];
|
|
1097
1006
|
const isObj = isObject(val);
|
|
1098
1007
|
if (!val) {
|
|
1099
|
-
if (CONFIG2.verbose)
|
|
1100
|
-
console.warn("Can't find color ", name);
|
|
1008
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1101
1009
|
return value;
|
|
1102
1010
|
}
|
|
1103
1011
|
if (globalTheme) {
|
|
1104
|
-
if (val[globalTheme])
|
|
1105
|
-
|
|
1106
|
-
else if (CONFIG2.verbose)
|
|
1107
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1012
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1013
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1108
1014
|
}
|
|
1109
|
-
if (isObj && val.value)
|
|
1110
|
-
return val.value;
|
|
1015
|
+
if (isObj && val.value) return val.value;
|
|
1111
1016
|
if (isObj) {
|
|
1112
1017
|
const obj = {};
|
|
1113
1018
|
for (const mediaName in val) {
|
|
@@ -1117,7 +1022,6 @@ var getShadow = (value, globalTheme) => {
|
|
|
1117
1022
|
}
|
|
1118
1023
|
return obj;
|
|
1119
1024
|
}
|
|
1120
|
-
if (CONFIG2.verbose)
|
|
1121
|
-
console.warn("Can't find color", value);
|
|
1025
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1122
1026
|
return value;
|
|
1123
1027
|
};
|