@unocss/preset-uno 0.50.6 → 0.50.7
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/README.md +2 -33
- package/dist/index.cjs +17 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +17 -11
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,40 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The default preset for [UnoCSS](https://github.com/unocss/unocss).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
> - [@unocss/preset-wind](https://github.com/antfu/unocss/tree/main/packages/preset-wind)
|
|
7
|
-
> - [@unocss/preset-mini](https://github.com/antfu/unocss/tree/main/packages/preset-mini)
|
|
5
|
+
## Documentation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm i -D @unocss/preset-uno
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import presetUno from '@unocss/preset-uno'
|
|
17
|
-
|
|
18
|
-
UnoCSS({
|
|
19
|
-
presets: [
|
|
20
|
-
presetUno(),
|
|
21
|
-
],
|
|
22
|
-
})
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Usages
|
|
26
|
-
|
|
27
|
-
This preset is trying to provide a common superset of the popular utilities-first framework, including Tailwind CSS, Windi CSS, Bootstrap, Tachyons, etc.
|
|
28
|
-
|
|
29
|
-
For example, both `ml-3` (Tailwind), `ms-2` (Bootstrap), `ma4` (Tachyons), `mt-10px` (Windi CSS) are valid.
|
|
30
|
-
|
|
31
|
-
```css
|
|
32
|
-
.ma4 { margin: 1rem; }
|
|
33
|
-
.ml-3 { margin-left: 0.75rem; }
|
|
34
|
-
.ms-2 { margin-inline-start: 0.5rem; }
|
|
35
|
-
.mt-10px { margin-top: 10px; }
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
For more details about the default preset, you can check out our [playground](https://uno.antfu.me/play/) and try out. Meanwhile, you can also check out [the implementations](https://github.com/unocss/unocss/tree/main/packages).
|
|
7
|
+
Please refer to the [documentation](https://unocss.dev/presets/uno).
|
|
39
8
|
|
|
40
9
|
## License
|
|
41
10
|
|
package/dist/index.cjs
CHANGED
|
@@ -6,8 +6,10 @@ const presetWind = require('@unocss/preset-wind');
|
|
|
6
6
|
const presetMini = require('@unocss/preset-mini');
|
|
7
7
|
const utils = require('@unocss/preset-mini/utils');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
function mixComponent(v1, v2, w) {
|
|
10
|
+
return `calc(${v2} + (${v1} - ${v2}) * ${w} / 100)`;
|
|
11
|
+
}
|
|
12
|
+
function mixColor(color1, color2, weight) {
|
|
11
13
|
const colors = [color1, color2];
|
|
12
14
|
const cssColors = [];
|
|
13
15
|
for (let c = 0; c < 2; ++c) {
|
|
@@ -24,16 +26,20 @@ const mixColor = (color1, color2, weight) => {
|
|
|
24
26
|
components: newComponents,
|
|
25
27
|
alpha: mixComponent(cssColors[0].alpha ?? 1, cssColors[1].alpha ?? 1, weight)
|
|
26
28
|
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
}
|
|
30
|
+
function tint(color, weight) {
|
|
31
|
+
return mixColor("#fff", color, weight);
|
|
32
|
+
}
|
|
33
|
+
function shade(color, weight) {
|
|
34
|
+
return mixColor("#000", color, weight);
|
|
35
|
+
}
|
|
36
|
+
function shift(color, weight) {
|
|
31
37
|
const num = parseFloat(`${weight}`);
|
|
32
38
|
if (!Number.isNaN(num))
|
|
33
39
|
return num > 0 ? shade(color, weight) : tint(color, -num);
|
|
34
|
-
}
|
|
40
|
+
}
|
|
35
41
|
const fns = { tint, shade, shift };
|
|
36
|
-
|
|
42
|
+
function variantColorMix() {
|
|
37
43
|
let re;
|
|
38
44
|
return {
|
|
39
45
|
name: "mix",
|
|
@@ -61,9 +67,9 @@ const variantColorMix = () => {
|
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
|
-
}
|
|
70
|
+
}
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
function presetUno(options = {}) {
|
|
67
73
|
options.dark = options.dark ?? "class";
|
|
68
74
|
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
69
75
|
options.preflight = options.preflight ?? true;
|
|
@@ -82,7 +88,7 @@ const presetUno = (options = {}) => {
|
|
|
82
88
|
preflights: options.preflight ? presetMini.normalizePreflights(presetMini.preflights, options.variablePrefix) : [],
|
|
83
89
|
prefix: options.prefix
|
|
84
90
|
};
|
|
85
|
-
}
|
|
91
|
+
}
|
|
86
92
|
|
|
87
93
|
exports["default"] = presetUno;
|
|
88
94
|
exports.presetUno = presetUno;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { Theme } from '@unocss/preset-mini';
|
|
|
4
4
|
|
|
5
5
|
interface PresetUnoOptions extends PresetMiniOptions {
|
|
6
6
|
}
|
|
7
|
-
declare
|
|
7
|
+
declare function presetUno(options?: PresetUnoOptions): Preset<Theme>;
|
|
8
8
|
|
|
9
9
|
export { PresetUnoOptions, presetUno as default, presetUno };
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import { theme, rules, shortcuts, variants } from '@unocss/preset-wind';
|
|
|
2
2
|
import { VarPrefixPostprocessor, normalizePreflights, preflights } from '@unocss/preset-mini';
|
|
3
3
|
import { parseCssColor, colorToString } from '@unocss/preset-mini/utils';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function mixComponent(v1, v2, w) {
|
|
6
|
+
return `calc(${v2} + (${v1} - ${v2}) * ${w} / 100)`;
|
|
7
|
+
}
|
|
8
|
+
function mixColor(color1, color2, weight) {
|
|
7
9
|
const colors = [color1, color2];
|
|
8
10
|
const cssColors = [];
|
|
9
11
|
for (let c = 0; c < 2; ++c) {
|
|
@@ -20,16 +22,20 @@ const mixColor = (color1, color2, weight) => {
|
|
|
20
22
|
components: newComponents,
|
|
21
23
|
alpha: mixComponent(cssColors[0].alpha ?? 1, cssColors[1].alpha ?? 1, weight)
|
|
22
24
|
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
}
|
|
26
|
+
function tint(color, weight) {
|
|
27
|
+
return mixColor("#fff", color, weight);
|
|
28
|
+
}
|
|
29
|
+
function shade(color, weight) {
|
|
30
|
+
return mixColor("#000", color, weight);
|
|
31
|
+
}
|
|
32
|
+
function shift(color, weight) {
|
|
27
33
|
const num = parseFloat(`${weight}`);
|
|
28
34
|
if (!Number.isNaN(num))
|
|
29
35
|
return num > 0 ? shade(color, weight) : tint(color, -num);
|
|
30
|
-
}
|
|
36
|
+
}
|
|
31
37
|
const fns = { tint, shade, shift };
|
|
32
|
-
|
|
38
|
+
function variantColorMix() {
|
|
33
39
|
let re;
|
|
34
40
|
return {
|
|
35
41
|
name: "mix",
|
|
@@ -57,9 +63,9 @@ const variantColorMix = () => {
|
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
};
|
|
60
|
-
}
|
|
66
|
+
}
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
function presetUno(options = {}) {
|
|
63
69
|
options.dark = options.dark ?? "class";
|
|
64
70
|
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
65
71
|
options.preflight = options.preflight ?? true;
|
|
@@ -78,6 +84,6 @@ const presetUno = (options = {}) => {
|
|
|
78
84
|
preflights: options.preflight ? normalizePreflights(preflights, options.variablePrefix) : [],
|
|
79
85
|
prefix: options.prefix
|
|
80
86
|
};
|
|
81
|
-
}
|
|
87
|
+
}
|
|
82
88
|
|
|
83
89
|
export { presetUno as default, presetUno };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-uno",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.7",
|
|
4
4
|
"description": "The default preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"*.css"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@unocss/core": "0.50.
|
|
54
|
-
"@unocss/preset-mini": "0.50.
|
|
55
|
-
"@unocss/preset-wind": "0.50.
|
|
53
|
+
"@unocss/core": "0.50.7",
|
|
54
|
+
"@unocss/preset-mini": "0.50.7",
|
|
55
|
+
"@unocss/preset-wind": "0.50.7"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "unbuild",
|