@unocss/preset-uno 0.24.2 → 0.24.3
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/index.cjs +7 -5
- package/dist/index.mjs +8 -6
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,11 @@ const mixColor = (color1, color2, weight) => {
|
|
|
26
26
|
};
|
|
27
27
|
const tint = (color, weight) => mixColor("#fff", color, weight);
|
|
28
28
|
const shade = (color, weight) => mixColor("#000", color, weight);
|
|
29
|
-
const shift = (color, weight) =>
|
|
29
|
+
const shift = (color, weight) => {
|
|
30
|
+
const num = parseFloat(`${weight}`);
|
|
31
|
+
if (!Number.isNaN(num))
|
|
32
|
+
return num > 0 ? shade(color, weight) : tint(color, -num);
|
|
33
|
+
};
|
|
30
34
|
const fns = { tint, shade, shift };
|
|
31
35
|
const variantColorMix = (matcher) => {
|
|
32
36
|
const m = matcher.match(/^mix-(tint|shade|shift)-(-?\d{1,3})[-:]/);
|
|
@@ -39,10 +43,8 @@ const variantColorMix = (matcher) => {
|
|
|
39
43
|
const color = utils.parseCssColor(`${v[1]}`);
|
|
40
44
|
if (color) {
|
|
41
45
|
const mixed = fns[m[1]](color, m[2]);
|
|
42
|
-
if (mixed)
|
|
43
|
-
|
|
44
|
-
v[1] = `rgb(${components.join(",")},${alpha})`;
|
|
45
|
-
}
|
|
46
|
+
if (mixed)
|
|
47
|
+
v[1] = utils.colorToString(mixed);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { theme, rules, shortcuts, variants } from '@unocss/preset-wind';
|
|
2
|
-
import { parseCssColor } from '@unocss/preset-mini/utils';
|
|
2
|
+
import { parseCssColor, colorToString } from '@unocss/preset-mini/utils';
|
|
3
3
|
|
|
4
4
|
const mixComponent = (v1, v2, w) => `calc(${v2} + (${v1} - ${v2}) * ${w} / 100)`;
|
|
5
5
|
const mixColor = (color1, color2, weight) => {
|
|
@@ -22,7 +22,11 @@ const mixColor = (color1, color2, weight) => {
|
|
|
22
22
|
};
|
|
23
23
|
const tint = (color, weight) => mixColor("#fff", color, weight);
|
|
24
24
|
const shade = (color, weight) => mixColor("#000", color, weight);
|
|
25
|
-
const shift = (color, weight) =>
|
|
25
|
+
const shift = (color, weight) => {
|
|
26
|
+
const num = parseFloat(`${weight}`);
|
|
27
|
+
if (!Number.isNaN(num))
|
|
28
|
+
return num > 0 ? shade(color, weight) : tint(color, -num);
|
|
29
|
+
};
|
|
26
30
|
const fns = { tint, shade, shift };
|
|
27
31
|
const variantColorMix = (matcher) => {
|
|
28
32
|
const m = matcher.match(/^mix-(tint|shade|shift)-(-?\d{1,3})[-:]/);
|
|
@@ -35,10 +39,8 @@ const variantColorMix = (matcher) => {
|
|
|
35
39
|
const color = parseCssColor(`${v[1]}`);
|
|
36
40
|
if (color) {
|
|
37
41
|
const mixed = fns[m[1]](color, m[2]);
|
|
38
|
-
if (mixed)
|
|
39
|
-
|
|
40
|
-
v[1] = `rgb(${components.join(",")},${alpha})`;
|
|
41
|
-
}
|
|
42
|
+
if (mixed)
|
|
43
|
+
v[1] = colorToString(mixed);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-uno",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
4
4
|
"description": "The default preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"*.css"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@unocss/core": "0.24.
|
|
54
|
-
"@unocss/preset-wind": "0.24.
|
|
55
|
-
"@unocss/preset-mini": "0.24.
|
|
53
|
+
"@unocss/core": "0.24.3",
|
|
54
|
+
"@unocss/preset-wind": "0.24.3",
|
|
55
|
+
"@unocss/preset-mini": "0.24.3"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "unbuild",
|