@windi-ui/core 0.8.0-beta.1 → 0.8.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/README.md +88 -57
- package/dist/components.d.cts +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/index.cjs +560 -163
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +560 -164
- package/dist/nuxt-ui-CvNwRMiY.cjs +104 -0
- package/dist/nuxt-ui-S3tspIeQ.mjs +93 -0
- package/dist/presets.cjs +4 -0
- package/dist/presets.d.cts +4 -0
- package/dist/presets.d.mts +4 -0
- package/dist/presets.mjs +1 -0
- package/dist/{types-DKL2Gqrn.d.mts → types-7pMUZGLb.d.mts} +170 -13
- package/dist/{vars-BQT8iude.d.cts → vars-D-T56h9H.d.cts} +170 -13
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/windi-ui/windi-ui/main/docs/public/logo-lockup.svg" alt="WindiUI" width="
|
|
2
|
+
<img src="https://raw.githubusercontent.com/windi-ui/windi-ui/main/docs/public/logo-lockup-npm.svg" alt="WindiUI" width="306">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# WindiUI
|
|
6
6
|
|
|
7
7
|
🚧 under development 🚧
|
|
8
8
|
|
|
9
|
-
WindiUI is a
|
|
9
|
+
WindiUI is a Tailwind CSS plugin that adds three axes to your classes: a color (`c-*`), a variant (`v-*`) and a size
|
|
10
|
+
(`s-*`). Each one is a class that sets CSS variables, so `btn c-blue v-solid s-lg` is a large, solid, blue button, and
|
|
11
|
+
the same `btn` takes every palette of your theme, in light and dark mode.
|
|
12
|
+
|
|
13
|
+
**[Documentation](https://windi-ui.github.io/windi-ui/guide/introduction)** ·
|
|
14
|
+
[Installation](https://windi-ui.github.io/windi-ui/guide/installation) ·
|
|
15
|
+
[Options](https://windi-ui.github.io/windi-ui/reference/options) ·
|
|
16
|
+
[Builder API](https://windi-ui.github.io/windi-ui/reference/builder) ·
|
|
17
|
+
[Changes in 0.8](https://windi-ui.github.io/windi-ui/changes-0.8)
|
|
10
18
|
|
|
11
19
|
## Features
|
|
12
20
|
|
|
13
|
-
- **
|
|
14
|
-
|
|
15
|
-
- **
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
- **Three axes.** `c-*` picks one of your palettes, `v-*` a variant and `s-*` a size. They combine freely, and colors
|
|
22
|
+
and sizes inherit down the tree.
|
|
23
|
+
- **Calibrated variants.** `default`, `solid`, `outline` and `light` pick shades of the 11-shade palette for the
|
|
24
|
+
background, border and text, with soft, muted and accent levels, a hover state and dark values. A variant can use
|
|
25
|
+
other shades for some colors, such as a darker `solid` yellow.
|
|
26
|
+
- **Presets.** `nuxt-ui` adds `soft`, `subtle`, `ghost` and `link`, with text that passes a contrast of 4.5:1.
|
|
27
|
+
- **Components and utilities.** `btn`, `badge`, `bg-v`, `text-v`, `border-v`, and `apply-v` for your own CSS.
|
|
28
|
+
- **Builder API.** Add, replace, change or remove colors, variants, sizes and components.
|
|
29
|
+
- **Runtime palettes.** A color given by CSS variables follows a theme set at runtime.
|
|
30
|
+
- **Dark mode.** Follows the dark variant of your Tailwind setup, with nothing to configure.
|
|
31
|
+
- **Tailwind v3 and v4**, with the same class names.
|
|
18
32
|
|
|
19
33
|
## Getting Started
|
|
20
34
|
|
|
21
35
|
### Prerequisites
|
|
22
36
|
|
|
23
|
-
- Node.js
|
|
24
|
-
-
|
|
37
|
+
- Node.js 22 or higher, or 22.12 or higher to load a
|
|
38
|
+
[config file](https://windi-ui.github.io/windi-ui/reference/config-file). The tests run on Node.js 26.
|
|
39
|
+
- Tailwind CSS v3.3 or higher, or v4. The tests run on Tailwind CSS 3.4, 4.1.16 and the current 4.3.
|
|
25
40
|
|
|
26
41
|
### Installation
|
|
27
42
|
|
|
@@ -36,87 +51,100 @@ On Tailwind v4, load it from your stylesheet:
|
|
|
36
51
|
@plugin "@windi-ui/tailwind";
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
|
|
40
|
-
a `windiui.plugin.ts` plugin module that exports `windiui({ ... })` and is loaded with `@plugin "./windiui.plugin.ts"`;
|
|
41
|
-
see [Installation](https://windi-ui.github.io/windi-ui/guide/installation) and [Config file and plugin module](https://windi-ui.github.io/windi-ui/reference/config-file).
|
|
42
|
-
|
|
43
|
-
On Tailwind v3, add the plugin to your `tailwind.config.ts` / `tailwind.config.js` file:
|
|
54
|
+
On Tailwind v3, add it to the plugins of your Tailwind config:
|
|
44
55
|
|
|
45
56
|
```ts
|
|
46
57
|
import type { Config } from 'tailwindcss';
|
|
47
58
|
import windiui from '@windi-ui/tailwind';
|
|
48
59
|
|
|
49
60
|
export default {
|
|
50
|
-
|
|
51
|
-
plugins: [
|
|
52
|
-
windiui()
|
|
53
|
-
],
|
|
61
|
+
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
|
|
62
|
+
plugins: [windiui()],
|
|
54
63
|
} satisfies Config;
|
|
55
64
|
```
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
WindiUI automatically detect all the colors in your theme and make them available to be used with components and utility classes.
|
|
66
|
+
Options go in the `@plugin` block, in a `windiui.config.ts` config file, or in a plugin module; see
|
|
67
|
+
[Installation](https://windi-ui.github.io/windi-ui/guide/installation) and
|
|
68
|
+
[Options](https://windi-ui.github.io/windi-ui/reference/options).
|
|
62
69
|
|
|
63
|
-
|
|
70
|
+
### Usage
|
|
64
71
|
|
|
65
72
|
```html
|
|
66
|
-
<
|
|
73
|
+
<button class="btn c-blue v-solid">Save</button>
|
|
74
|
+
<button class="btn c-red v-outline s-sm">Delete</button>
|
|
75
|
+
<button class="btn c-blue v-light s-lg">Inbox <span class="badge c-red v-solid">3</span></button>
|
|
76
|
+
<div class="c-green v-light bg-v text-v border border-v-muted rounded p-4">A box painted by its variant</div>
|
|
77
|
+
<div class="c-amber bg-c-100 text-c-800 p-4">Shades of the current color</div>
|
|
67
78
|
```
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
A plugin module configures WindiUI with the builder API. This one adds the `nuxt-ui` variants, gives `solid` a darker
|
|
81
|
+
background with yellow, and adds a `c-primary` color whose shades are CSS variables set at runtime:
|
|
70
82
|
|
|
71
|
-
|
|
83
|
+
```ts
|
|
84
|
+
// windiui.plugin.ts
|
|
85
|
+
import windiui from '@windi-ui/tailwind';
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
export default windiui({
|
|
88
|
+
presets: ['nuxt-ui'],
|
|
89
|
+
build: (builder) => builder
|
|
90
|
+
.overrideVariant('solid', 'yellow', { bg: '700', pseudos: { ':hover': { bg: '800' } } })
|
|
91
|
+
.addColor('primary', { vars: '--ui-color-primary' }),
|
|
92
|
+
});
|
|
75
93
|
```
|
|
76
94
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
```css
|
|
96
|
+
@import "tailwindcss";
|
|
97
|
+
@plugin "./windiui.plugin.ts";
|
|
98
|
+
```
|
|
80
99
|
|
|
81
100
|
```html
|
|
82
|
-
<button class="btn
|
|
83
|
-
|
|
84
|
-
<span class="badge v-solid c-red leading-none rounded-full absolute top-0 start-full -translate-1/2">32</span>
|
|
85
|
-
</button>
|
|
101
|
+
<button class="btn c-yellow v-solid">Solid yellow, on shade 700</button>
|
|
102
|
+
<button class="btn c-primary v-soft">Soft, in the runtime color</button>
|
|
86
103
|
```
|
|
87
104
|
|
|
88
|
-
|
|
105
|
+
The [guide](https://windi-ui.github.io/windi-ui/guide/introduction) covers each part, with live examples. The
|
|
106
|
+
[playground](https://github.com/windi-ui/windi-ui/blob/main/playground/vue-tailwindv4/src/App.vue) has more.
|
|
89
107
|
|
|
90
|
-
####
|
|
108
|
+
#### Variants and sizes in your own CSS
|
|
91
109
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
On Tailwind v4, add one line to the stylesheet. `safelistSource()` returns the string for your config:
|
|
110
|
+
`apply-v` paints the background, border and text from the current variant, at rest and on hover, as `btn` does. A
|
|
111
|
+
list in brackets chooses the properties and the states. The `s-*` classes set size variables that a control of your
|
|
112
|
+
own can read:
|
|
96
113
|
|
|
97
114
|
```css
|
|
98
|
-
@
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
import { safelistSource } from '@windi-ui/tailwind';
|
|
115
|
+
@import "tailwindcss";
|
|
116
|
+
@plugin "@windi-ui/tailwind";
|
|
103
117
|
|
|
104
|
-
|
|
118
|
+
.card-action { @apply apply-v; } /* bg, border, text + :hover */
|
|
119
|
+
.tab { @apply apply-v-[bg,text,hover,focus-visible]; } /* chosen properties and states */
|
|
120
|
+
.my-input { /* as tall as a btn of the same size */
|
|
121
|
+
padding: calc(var(--wui-s-spacing-1\.5) - 1px) calc(var(--wui-s-spacing-3) - 1px);
|
|
122
|
+
border: 1px solid;
|
|
123
|
+
font-size: var(--wui-s-text);
|
|
124
|
+
line-height: var(--wui-s-line-height);
|
|
125
|
+
}
|
|
105
126
|
```
|
|
106
127
|
|
|
107
|
-
|
|
128
|
+
| Size variable | Meaning |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| `--wui-s-spacing-1`, `-1\.5`, `-2`, `-3`, `-4` | Spacing slots |
|
|
131
|
+
| `--wui-s-text`, `--wui-s-line-height` | Font size and line height |
|
|
132
|
+
| `--wui-s-<key>` | A key of your own on a size, such as `height` for an app that wants a fixed control height |
|
|
108
133
|
|
|
109
|
-
|
|
134
|
+
The `variantUtilities` option adds color utilities painted from a variant, such as `bg-yellow` with the `solid`
|
|
135
|
+
background of yellow, overrides and dark values included. See
|
|
136
|
+
[Utilities](https://windi-ui.github.io/windi-ui/guide/utilities) and
|
|
137
|
+
[Sizes](https://windi-ui.github.io/windi-ui/guide/sizes).
|
|
110
138
|
|
|
111
139
|
## Upgrading from 0.7
|
|
112
140
|
|
|
113
|
-
See [Changes in 0.8](https://windi-ui.github.io/windi-ui/changes-0.8). The one thing to check: 0.8
|
|
114
|
-
element with a `*` rule (the new `variantScope` option, default
|
|
115
|
-
`text-v`, `border-v` utilities look the same, but your own CSS that
|
|
116
|
-
`background: var(--wui-v-bg)`, on an element without a `v-*` class no
|
|
117
|
-
`windiui({ variantScope: 'universal' })` to keep the 0.7 output, or give the rule a
|
|
118
|
-
`@apply v-default v-scope`. A rule that uses `@apply v-*` should also apply `v-scope`, so its children
|
|
119
|
-
inherit the variant.
|
|
141
|
+
See [Changes in 0.8](https://windi-ui.github.io/windi-ui/changes-0.8#upgrading-from-0-7). The one thing to check: 0.8
|
|
142
|
+
no longer sets the default variant on every element with a `*` rule (the new `variantScope` option, default
|
|
143
|
+
`'element'`). `btn`, `badge` and the `bg-v`, `text-v`, `border-v` utilities look the same, but your own CSS that
|
|
144
|
+
reads a variant variable directly, such as `background: var(--wui-v-bg)`, on an element without a `v-*` class no
|
|
145
|
+
longer gets a value. Either set `windiui({ variantScope: 'universal' })` to keep the 0.7 output, or give the rule a
|
|
146
|
+
variant with `@apply v-default v-scope`. A rule that uses `@apply v-*` should also apply `v-scope`, so its children
|
|
147
|
+
do not inherit the variant.
|
|
120
148
|
|
|
121
149
|
## Documentation
|
|
122
150
|
|
|
@@ -169,6 +197,9 @@ The tests are in `test/` and run on Vitest.
|
|
|
169
197
|
snapshot diff with the code, so the review shows what changed for users.
|
|
170
198
|
- **Browser.** `test/browser.test.ts` checks what a snapshot cannot: how the CSS cascades and inherits.
|
|
171
199
|
It drives the Chrome or Edge already installed on the machine, and is skipped locally if there is neither.
|
|
200
|
+
- **README.** `test/readme.ts` compiles every TypeScript sample of this file on each fixture and every CSS sample
|
|
201
|
+
on the Tailwind v4 ones, and checks that the classes of its HTML samples exist. Keep the samples compilable when
|
|
202
|
+
you change them.
|
|
172
203
|
- A test file works with one fixture only, because the helper that loads a fixture changes the working directory.
|
|
173
204
|
|
|
174
205
|
### Project Structure
|
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as ComponentBuilderContext, S as ComponentBuilder, w as IComponent } from "./vars-D-T56h9H.cjs";
|
|
2
2
|
export declare function defineComponent(component: IComponent | ComponentBuilder): ComponentBuilder;
|
|
3
3
|
declare const _default$1: ComponentBuilder;
|
|
4
4
|
declare const _default: ComponentBuilder;
|
package/dist/components.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ComponentBuilderContext, r as IComponent, t as ComponentBuilder } from "./types-
|
|
1
|
+
import { n as ComponentBuilderContext, r as IComponent, t as ComponentBuilder } from "./types-7pMUZGLb.mjs";
|
|
2
2
|
export declare function defineComponent(component: IComponent | ComponentBuilder): ComponentBuilder;
|
|
3
3
|
declare const _default$1: ComponentBuilder;
|
|
4
4
|
declare const _default: ComponentBuilder;
|