@symbo.ls/scratch 2.25.3 → 2.27.8
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 +8 -9
- package/dist/cjs/index.js +169 -335
- package/dist/cjs/set.js +120 -237
- package/dist/cjs/system/color.js +48 -86
- package/dist/cjs/system/document.js +20 -30
- package/dist/cjs/system/font.js +24 -38
- package/dist/cjs/system/index.js +120 -240
- package/dist/cjs/system/reset.js +27 -44
- package/dist/cjs/system/shadow.js +63 -116
- package/dist/cjs/system/spacing.js +35 -60
- package/dist/cjs/system/svg.js +25 -40
- package/dist/cjs/system/theme.js +61 -112
- package/dist/cjs/system/timing.js +28 -46
- package/dist/cjs/system/typography.js +37 -74
- package/dist/cjs/transforms/index.js +86 -162
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +54 -98
- package/dist/cjs/utils/sequence.js +28 -46
- package/dist/cjs/utils/sprite.js +9 -11
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +22 -34
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
package/dist/cjs/system/reset.js
CHANGED
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
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];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -285,8 +276,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
285
276
|
var isNull = (arg) => arg === null;
|
|
286
277
|
var isArray = (arg) => Array.isArray(arg);
|
|
287
278
|
var isObjectLike = (arg) => {
|
|
288
|
-
if (arg === null)
|
|
289
|
-
return false;
|
|
279
|
+
if (arg === null) return false;
|
|
290
280
|
return typeof arg === "object";
|
|
291
281
|
};
|
|
292
282
|
var isUndefined = (arg) => {
|
|
@@ -295,7 +285,10 @@ var isUndefined = (arg) => {
|
|
|
295
285
|
|
|
296
286
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
297
287
|
var mergeArray = (arr, exclude = []) => {
|
|
298
|
-
return arr.reduce(
|
|
288
|
+
return arr.reduce(
|
|
289
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
290
|
+
{}
|
|
291
|
+
);
|
|
299
292
|
};
|
|
300
293
|
|
|
301
294
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -364,8 +357,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
364
357
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
365
358
|
visited.set(obj, clone2);
|
|
366
359
|
for (const key in obj) {
|
|
367
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
368
|
-
continue;
|
|
360
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
369
361
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
370
362
|
continue;
|
|
371
363
|
const value = obj[key];
|
|
@@ -399,14 +391,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
399
391
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
400
392
|
return params;
|
|
401
393
|
}
|
|
402
|
-
if (visited.has(obj))
|
|
403
|
-
return visited.get(obj);
|
|
394
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
404
395
|
visited.set(obj, obj);
|
|
405
396
|
for (const e in params) {
|
|
406
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
407
|
-
|
|
408
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
409
|
-
continue;
|
|
397
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
398
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
410
399
|
const objProp = obj[e];
|
|
411
400
|
const paramsProp = params[e];
|
|
412
401
|
if (isDOMNode(paramsProp)) {
|
|
@@ -661,24 +650,19 @@ var recursiveTheme = (val) => {
|
|
|
661
650
|
} else if (symb === ":") {
|
|
662
651
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
663
652
|
}
|
|
664
|
-
} else
|
|
665
|
-
obj[param] = val[param];
|
|
653
|
+
} else obj[param] = val[param];
|
|
666
654
|
}
|
|
667
655
|
return obj;
|
|
668
656
|
};
|
|
669
657
|
var findModifierFromArray = (val, modifierArray) => {
|
|
670
658
|
const currentMod = modifierArray.shift();
|
|
671
|
-
if (val[currentMod])
|
|
672
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
659
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
673
660
|
return val;
|
|
674
661
|
};
|
|
675
662
|
var findModifier = (val, modifier) => {
|
|
676
|
-
if (isArray(modifier))
|
|
677
|
-
|
|
678
|
-
else
|
|
679
|
-
return val[modifier];
|
|
680
|
-
else
|
|
681
|
-
return val;
|
|
663
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
664
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
665
|
+
else return val;
|
|
682
666
|
};
|
|
683
667
|
var getMediaTheme = (value, modifier) => {
|
|
684
668
|
const activeConfig = getActiveConfig();
|
|
@@ -721,8 +705,7 @@ var applyReset = (reset = {}) => {
|
|
|
721
705
|
}
|
|
722
706
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
723
707
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
724
|
-
if (RESET2.html)
|
|
725
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
708
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
726
709
|
return deepMerge(merge(RESET2, reset), {
|
|
727
710
|
html: {
|
|
728
711
|
position: "absolute",
|
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue2,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue2 = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
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];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -282,8 +273,7 @@ var isDOMNode = (obj) => {
|
|
|
282
273
|
|
|
283
274
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
284
275
|
var isObject = (arg) => {
|
|
285
|
-
if (arg === null)
|
|
286
|
-
return false;
|
|
276
|
+
if (arg === null) return false;
|
|
287
277
|
return typeof arg === "object" && arg.constructor === Object;
|
|
288
278
|
};
|
|
289
279
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -292,8 +282,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
292
282
|
var isNull = (arg) => arg === null;
|
|
293
283
|
var isArray = (arg) => Array.isArray(arg);
|
|
294
284
|
var isObjectLike = (arg) => {
|
|
295
|
-
if (arg === null)
|
|
296
|
-
return false;
|
|
285
|
+
if (arg === null) return false;
|
|
297
286
|
return typeof arg === "object";
|
|
298
287
|
};
|
|
299
288
|
var isUndefined = (arg) => {
|
|
@@ -302,7 +291,10 @@ var isUndefined = (arg) => {
|
|
|
302
291
|
|
|
303
292
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
304
293
|
var mergeArray = (arr, exclude = []) => {
|
|
305
|
-
return arr.reduce(
|
|
294
|
+
return arr.reduce(
|
|
295
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
296
|
+
{}
|
|
297
|
+
);
|
|
306
298
|
};
|
|
307
299
|
|
|
308
300
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -358,8 +350,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
358
350
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
359
351
|
visited.set(obj, clone2);
|
|
360
352
|
for (const key in obj) {
|
|
361
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
362
|
-
continue;
|
|
353
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
363
354
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
364
355
|
continue;
|
|
365
356
|
const value = obj[key];
|
|
@@ -619,10 +610,8 @@ var isScalingUnit = (unit) => {
|
|
|
619
610
|
|
|
620
611
|
// src/utils/color.js
|
|
621
612
|
var colorStringToRgbaArray = (color) => {
|
|
622
|
-
if (color === "")
|
|
623
|
-
|
|
624
|
-
if (color.toLowerCase() === "transparent")
|
|
625
|
-
return [0, 0, 0, 0];
|
|
613
|
+
if (color === "") return [0, 0, 0, 0];
|
|
614
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
626
615
|
if (color[0] === "#") {
|
|
627
616
|
if (color.length < 7) {
|
|
628
617
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -653,8 +642,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
653
642
|
}
|
|
654
643
|
}
|
|
655
644
|
if (color.indexOf("rgb") === 0) {
|
|
656
|
-
if (color.indexOf("rgba") === -1)
|
|
657
|
-
color = `${color}, 1`;
|
|
645
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
658
646
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
659
647
|
}
|
|
660
648
|
return [0, 0, 0, 0];
|
|
@@ -680,29 +668,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
680
668
|
var getColorShade = (col, amt) => {
|
|
681
669
|
const num = parseInt(col, 16);
|
|
682
670
|
let r = (num >> 16) + amt;
|
|
683
|
-
if (r > 255)
|
|
684
|
-
|
|
685
|
-
else if (r < 0)
|
|
686
|
-
r = 0;
|
|
671
|
+
if (r > 255) r = 255;
|
|
672
|
+
else if (r < 0) r = 0;
|
|
687
673
|
let b = (num >> 8 & 255) + amt;
|
|
688
|
-
if (b > 255)
|
|
689
|
-
|
|
690
|
-
else if (b < 0)
|
|
691
|
-
b = 0;
|
|
674
|
+
if (b > 255) b = 255;
|
|
675
|
+
else if (b < 0) b = 0;
|
|
692
676
|
let g = (num & 255) + amt;
|
|
693
|
-
if (g > 255)
|
|
694
|
-
|
|
695
|
-
else if (g < 0)
|
|
696
|
-
g = 0;
|
|
677
|
+
if (g > 255) g = 255;
|
|
678
|
+
else if (g < 0) g = 0;
|
|
697
679
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
698
680
|
};
|
|
699
681
|
var getRgbTone = (rgb, tone) => {
|
|
700
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
701
|
-
|
|
702
|
-
if (
|
|
703
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
704
|
-
if (isNumber(tone))
|
|
705
|
-
tone += "";
|
|
682
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
683
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
684
|
+
if (isNumber(tone)) tone += "";
|
|
706
685
|
const toHex = rgbArrayToHex(rgb);
|
|
707
686
|
const abs = tone.slice(0, 1);
|
|
708
687
|
if (abs === "-" || abs === "+") {
|
|
@@ -764,8 +743,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
764
743
|
var setScalingVar = (key, sequenceProps) => {
|
|
765
744
|
const { base, type, unit } = sequenceProps;
|
|
766
745
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
767
|
-
if (key === 0)
|
|
768
|
-
return defaultVal;
|
|
746
|
+
if (key === 0) return defaultVal;
|
|
769
747
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
770
748
|
const ratioVar = `${prefix}-ratio`;
|
|
771
749
|
if (key > 0) {
|
|
@@ -799,10 +777,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
799
777
|
const diffRounded = ~~next - ~~value;
|
|
800
778
|
let arr;
|
|
801
779
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
802
|
-
if (diffRounded > 16)
|
|
803
|
-
|
|
804
|
-
else
|
|
805
|
-
arr = [first, second];
|
|
780
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
781
|
+
else arr = [first, second];
|
|
806
782
|
arr.forEach((v, k) => {
|
|
807
783
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
808
784
|
const newVar = variable + (k + 1);
|
|
@@ -844,8 +820,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
844
820
|
index: key
|
|
845
821
|
};
|
|
846
822
|
setSequenceValue(props, sequenceProps);
|
|
847
|
-
if (subSequence)
|
|
848
|
-
generateSubSequence(props, sequenceProps);
|
|
823
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
849
824
|
}
|
|
850
825
|
return sequenceProps;
|
|
851
826
|
};
|
|
@@ -857,13 +832,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
857
832
|
unit = UNIT2.default,
|
|
858
833
|
useVariable
|
|
859
834
|
} = sequenceProps;
|
|
860
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
861
|
-
return `var(${value})`;
|
|
835
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
862
836
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
863
837
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
864
838
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
865
|
-
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)
|
|
866
|
-
return value;
|
|
839
|
+
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;
|
|
867
840
|
const letterVal = value.toUpperCase();
|
|
868
841
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
869
842
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -887,8 +860,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
887
860
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
888
861
|
}
|
|
889
862
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
890
|
-
if (CONFIG2.verbose)
|
|
891
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
863
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
892
864
|
absValue = absValue.slice(0, 1);
|
|
893
865
|
}
|
|
894
866
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -896,8 +868,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
896
868
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
897
869
|
}
|
|
898
870
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
899
|
-
if (!sequenceItem)
|
|
900
|
-
return console.warn("can't find", sequence, absValue);
|
|
871
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
901
872
|
if (unit === "ms" || unit === "s") {
|
|
902
873
|
return isNegative + sequenceItem.val + unit;
|
|
903
874
|
}
|
|
@@ -906,12 +877,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
906
877
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
907
878
|
if (typeof value !== "string") {
|
|
908
879
|
const CONFIG2 = getActiveConfig();
|
|
909
|
-
if (CONFIG2.verbose)
|
|
910
|
-
console.warn(propertyName, value, "is not a string");
|
|
880
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
911
881
|
return { [propertyName]: value };
|
|
912
882
|
}
|
|
913
|
-
if (value === "-" || value === "")
|
|
914
|
-
return {};
|
|
883
|
+
if (value === "-" || value === "") return {};
|
|
915
884
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
916
885
|
};
|
|
917
886
|
|
|
@@ -919,27 +888,21 @@ var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
|
919
888
|
var getColor = (value, key, config) => {
|
|
920
889
|
const CONFIG2 = config || getActiveConfig();
|
|
921
890
|
if (!isString(value)) {
|
|
922
|
-
if (CONFIG2.verbose)
|
|
923
|
-
console.warn(value, "- type for color is not valid");
|
|
891
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
924
892
|
return;
|
|
925
893
|
}
|
|
926
|
-
if (value.slice(0, 2) === "--")
|
|
927
|
-
|
|
928
|
-
if (key && value[key])
|
|
929
|
-
value = value[key];
|
|
894
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
895
|
+
if (key && value[key]) value = value[key];
|
|
930
896
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
931
897
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
932
898
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
933
899
|
if (!val) {
|
|
934
|
-
if (CONFIG2.verbose)
|
|
935
|
-
console.warn("Can't find color ", name);
|
|
900
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
936
901
|
return value;
|
|
937
902
|
}
|
|
938
903
|
if (key) {
|
|
939
|
-
if (val[key])
|
|
940
|
-
|
|
941
|
-
else if (CONFIG2.verbose)
|
|
942
|
-
console.warn(value, " - does not have ", key);
|
|
904
|
+
if (val[key]) val = val[key];
|
|
905
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
943
906
|
}
|
|
944
907
|
let rgb = val.rgb;
|
|
945
908
|
if (!rgb) {
|
|
@@ -949,10 +912,8 @@ var getColor = (value, key, config) => {
|
|
|
949
912
|
rgb = getRgbTone(rgb, tone);
|
|
950
913
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
951
914
|
}
|
|
952
|
-
if (val[tone])
|
|
953
|
-
|
|
954
|
-
if (alpha)
|
|
955
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
915
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
916
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
956
917
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
957
918
|
};
|
|
958
919
|
|
|
@@ -961,8 +922,7 @@ var import_utils9 = __toESM(require_cjs(), 1);
|
|
|
961
922
|
var getSequence = (sequenceProps) => {
|
|
962
923
|
const CONFIG2 = getActiveConfig();
|
|
963
924
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
964
|
-
if (!sequenceProps)
|
|
965
|
-
return SPACING2;
|
|
925
|
+
if (!sequenceProps) return SPACING2;
|
|
966
926
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
967
927
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
968
928
|
};
|
|
@@ -972,8 +932,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
972
932
|
return { [propertyName]: value };
|
|
973
933
|
}
|
|
974
934
|
const stack = (0, import_utils9.arrayzeValue)(value);
|
|
975
|
-
if (!isArray(stack))
|
|
976
|
-
return;
|
|
935
|
+
if (!isArray(stack)) return;
|
|
977
936
|
if (stack.length > 1) {
|
|
978
937
|
let suffix = "";
|
|
979
938
|
if (propertyName === "borderWidth") {
|
|
@@ -1022,15 +981,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1022
981
|
if (isString(value) && value.includes(",")) {
|
|
1023
982
|
value = value.split(",").map((v) => {
|
|
1024
983
|
v = v.trim();
|
|
1025
|
-
if (v.startsWith("--"))
|
|
1026
|
-
|
|
1027
|
-
if (
|
|
1028
|
-
return getColor(v);
|
|
1029
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1030
|
-
return v;
|
|
984
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
985
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
986
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1031
987
|
const arr = v.split(" ");
|
|
1032
|
-
if (!arr.length)
|
|
1033
|
-
return v;
|
|
988
|
+
if (!arr.length) return v;
|
|
1034
989
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1035
990
|
}).join(" ");
|
|
1036
991
|
}
|
|
@@ -1045,32 +1000,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1045
1000
|
};
|
|
1046
1001
|
var getShadow = (value, globalTheme) => {
|
|
1047
1002
|
const CONFIG2 = getActiveConfig();
|
|
1048
|
-
if (!globalTheme)
|
|
1049
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1003
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1050
1004
|
if (!isString(value)) {
|
|
1051
|
-
if (CONFIG2.verbose)
|
|
1052
|
-
console.warn(value, "- type for color is not valid");
|
|
1005
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1053
1006
|
return;
|
|
1054
1007
|
}
|
|
1055
|
-
if (value.slice(0, 2) === "--")
|
|
1056
|
-
return `var(${value})`;
|
|
1008
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1057
1009
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1058
1010
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1059
1011
|
const val = SHADOW2[name];
|
|
1060
1012
|
const isObj = isObject(val);
|
|
1061
1013
|
if (!val) {
|
|
1062
|
-
if (CONFIG2.verbose)
|
|
1063
|
-
console.warn("Can't find color ", name);
|
|
1014
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1064
1015
|
return value;
|
|
1065
1016
|
}
|
|
1066
1017
|
if (globalTheme) {
|
|
1067
|
-
if (val[globalTheme])
|
|
1068
|
-
|
|
1069
|
-
else if (CONFIG2.verbose)
|
|
1070
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1018
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1019
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1071
1020
|
}
|
|
1072
|
-
if (isObj && val.value)
|
|
1073
|
-
return val.value;
|
|
1021
|
+
if (isObj && val.value) return val.value;
|
|
1074
1022
|
if (isObj) {
|
|
1075
1023
|
const obj = {};
|
|
1076
1024
|
for (const mediaName in val) {
|
|
@@ -1080,7 +1028,6 @@ var getShadow = (value, globalTheme) => {
|
|
|
1080
1028
|
}
|
|
1081
1029
|
return obj;
|
|
1082
1030
|
}
|
|
1083
|
-
if (CONFIG2.verbose)
|
|
1084
|
-
console.warn("Can't find color", value);
|
|
1031
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1085
1032
|
return value;
|
|
1086
1033
|
};
|