stillwind 0.3.0 → 0.5.0
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/docs/at-rules/apply.md +1 -1
- package/docs/at-rules/custom-variant.md +2 -2
- package/docs/at-rules/slot.md +1 -1
- package/docs/at-rules/stillwind-css-template.md +2 -2
- package/docs/at-rules/stillwind-property.md +1 -1
- package/docs/at-rules/stillwind-registry.md +1 -1
- package/docs/at-rules/stillwind-require-properties.md +1 -1
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
- package/docs/at-rules/stillwind-undef-utility.md +1 -1
- package/docs/at-rules/stillwind-undef-variant.md +1 -1
- package/docs/at-rules/theme.md +5 -5
- package/docs/at-rules/utility.md +4 -4
- package/docs/at-rules/variant.md +1 -1
- package/docs/cli.md +153 -22
- package/docs/configuration.md +1 -1
- package/docs/guides/runtime-conditions.md +187 -0
- package/docs/guides/style.md +2 -1
- package/docs/guides/tailwind-compatibility.md +19 -1
- package/docs/guides/web-components.md +29 -0
- package/docs/lints/index.md +1 -0
- package/docs/lints/invalid-runtime-condition.md +2 -1
- package/docs/lints/invalid-utility.md +1 -1
- package/docs/lints/prefer-canonical-utilities.md +7 -4
- package/docs/lints/runtime-condition-requires-css-if.md +2 -1
- package/docs/lints/unknown-utility.md +2 -1
- package/docs/lints/unmatched-host-selector.md +44 -0
- package/docs/macros/css.md +3 -3
- package/docs/utilities-and-variants.md +75 -0
- package/package.json +4 -4
- package/skills/migrate-to-stillwind/SKILL.md +3 -1
- package/skills/stillwind/SKILL.md +30 -18
- package/docs/utilities.md +0 -35
package/docs/at-rules/apply.md
CHANGED
|
@@ -27,7 +27,7 @@ inside a style rule or a utility definition. Whitespace separates the utilities.
|
|
|
27
27
|
### Generated stylesheet without preflight
|
|
28
28
|
|
|
29
29
|
```css
|
|
30
|
-
/*! stillwind v0.
|
|
30
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
31
31
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
32
32
|
@layer properties, theme, base, components, utilities;
|
|
33
33
|
|
|
@@ -53,7 +53,7 @@ export const link = {className:"sw_r7v8w"};
|
|
|
53
53
|
### Generated stylesheet without preflight
|
|
54
54
|
|
|
55
55
|
```css
|
|
56
|
-
/*! stillwind v0.
|
|
56
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
57
57
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
58
58
|
@layer properties, theme, base, components, utilities;
|
|
59
59
|
|
|
@@ -109,7 +109,7 @@ export const css = style.css("shell:block shell:p-4 [button]:rounded-md");
|
|
|
109
109
|
### Compiled code
|
|
110
110
|
|
|
111
111
|
```ts
|
|
112
|
-
export const css = "/*! stillwind v0.
|
|
112
|
+
export const css = "/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n:where(:root, :host){--spacing:0.25rem;--radius-md:0.375rem;}:host{display:block;}:host{padding:calc(var(--spacing) * 4);}button{border-radius:var(--radius-md);}";
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
In `style.css()`, the first such variant selects the element that the utility
|
package/docs/at-rules/slot.md
CHANGED
|
@@ -42,7 +42,7 @@ export const link = {className:"sw_4x5c3"};
|
|
|
42
42
|
### Generated stylesheet without preflight
|
|
43
43
|
|
|
44
44
|
```css
|
|
45
|
-
/*! stillwind v0.
|
|
45
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
46
46
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
47
47
|
@layer properties, theme, base, components, utilities;
|
|
48
48
|
|
|
@@ -47,7 +47,7 @@ export const css = style.css("p-4 text-blue-600", {
|
|
|
47
47
|
### Compiled code
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
|
-
export const css = "/*! stillwind v0.
|
|
50
|
+
export const css = "/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer component{:host{--color-blue-600:oklch(54.6% 0.245 262.881);--spacing:0.25rem;}:host{padding:calc(var(--spacing) * 4);}:host{color:var(--color-blue-600);}}";
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
The string contains the template's own CSS, and each slot receives the output of
|
|
@@ -82,7 +82,7 @@ export const css = style.css("p-4 text-blue-600", {
|
|
|
82
82
|
### Compiled code
|
|
83
83
|
|
|
84
84
|
```ts
|
|
85
|
-
export const css = "/*! stillwind v0.
|
|
85
|
+
export const css = "/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n:host{padding:calc(var(--spacing) * 4);}:host{color:var(--color-blue-600);}";
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
## The default template
|
|
@@ -51,7 +51,7 @@ export const icon = {className:"sw_7ic77"};
|
|
|
51
51
|
### Generated stylesheet without preflight
|
|
52
52
|
|
|
53
53
|
```css
|
|
54
|
-
/*! stillwind v0.
|
|
54
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
55
55
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
56
56
|
@layer properties, theme, base, components, utilities;
|
|
57
57
|
|
|
@@ -62,7 +62,7 @@ export const panel = {className:"sw_2wahw"};
|
|
|
62
62
|
### Generated stylesheet without preflight
|
|
63
63
|
|
|
64
64
|
```css
|
|
65
|
-
/*! stillwind v0.
|
|
65
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
66
66
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
67
67
|
@layer properties, theme, base, components, utilities;
|
|
68
68
|
|
|
@@ -54,7 +54,7 @@ export const icon = {className:"sw_7ic77"};
|
|
|
54
54
|
### Generated stylesheet without preflight
|
|
55
55
|
|
|
56
56
|
```css
|
|
57
|
-
/*! stillwind v0.
|
|
57
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
58
58
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
59
59
|
@layer properties, theme, base, components, utilities;
|
|
60
60
|
|
|
@@ -45,7 +45,7 @@ export const accepted = {className:"sw_obysi"};
|
|
|
45
45
|
### Generated stylesheet without preflight
|
|
46
46
|
|
|
47
47
|
```css
|
|
48
|
-
/*! stillwind v0.
|
|
48
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
49
49
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
50
50
|
@layer properties, theme, base, components, utilities;
|
|
51
51
|
|
|
@@ -48,7 +48,7 @@ export const replaced = {className:"sw_vofby"};
|
|
|
48
48
|
### Generated stylesheet without preflight
|
|
49
49
|
|
|
50
50
|
```css
|
|
51
|
-
/*! stillwind v0.
|
|
51
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
52
52
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
53
53
|
@layer properties, theme, base, components, utilities;
|
|
54
54
|
|
|
@@ -42,7 +42,7 @@ export const toolbar = {};
|
|
|
42
42
|
### Generated stylesheet without preflight
|
|
43
43
|
|
|
44
44
|
```css
|
|
45
|
-
/*! stillwind v0.
|
|
45
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
46
46
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
47
47
|
@layer properties, theme, base, components, utilities;
|
|
48
48
|
```
|
package/docs/at-rules/theme.md
CHANGED
|
@@ -44,7 +44,7 @@ export const card = {className:"sw_j7rat"};
|
|
|
44
44
|
### Generated stylesheet without preflight
|
|
45
45
|
|
|
46
46
|
```css
|
|
47
|
-
/*! stillwind v0.
|
|
47
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
48
48
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
49
49
|
@layer properties, theme, base, components, utilities;
|
|
50
50
|
|
|
@@ -110,7 +110,7 @@ export const label = {className:"sw_4zrwj"};
|
|
|
110
110
|
### Generated stylesheet without preflight
|
|
111
111
|
|
|
112
112
|
```css
|
|
113
|
-
/*! stillwind v0.
|
|
113
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
114
114
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
115
115
|
@layer properties, theme, base, components, utilities;
|
|
116
116
|
|
|
@@ -163,7 +163,7 @@ export const title = {className:"sw_mjcfr"};
|
|
|
163
163
|
### Generated stylesheet without preflight
|
|
164
164
|
|
|
165
165
|
```css
|
|
166
|
-
/*! stillwind v0.
|
|
166
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
167
167
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
168
168
|
@layer properties, theme, base, components, utilities;
|
|
169
169
|
|
|
@@ -216,7 +216,7 @@ export const done = {className:"sw_j94hj"};
|
|
|
216
216
|
### Generated stylesheet without preflight
|
|
217
217
|
|
|
218
218
|
```css
|
|
219
|
-
/*! stillwind v0.
|
|
219
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
220
220
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
221
221
|
@layer properties, theme, base, components, utilities;
|
|
222
222
|
|
|
@@ -269,7 +269,7 @@ export const page = {className:"sw_rjnyv"};
|
|
|
269
269
|
### Generated stylesheet without preflight
|
|
270
270
|
|
|
271
271
|
```css
|
|
272
|
-
/*! stillwind v0.
|
|
272
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
273
273
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
274
274
|
@layer properties, theme, base, components, utilities;
|
|
275
275
|
|
package/docs/at-rules/utility.md
CHANGED
|
@@ -50,7 +50,7 @@ export const list = {className:"sw_70m3s"};
|
|
|
50
50
|
### Generated stylesheet without preflight
|
|
51
51
|
|
|
52
52
|
```css
|
|
53
|
-
/*! stillwind v0.
|
|
53
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
54
54
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
55
55
|
@layer properties, theme, base, components, utilities;
|
|
56
56
|
|
|
@@ -115,7 +115,7 @@ export const code = {className:"sw_9jkuo"};
|
|
|
115
115
|
### Generated stylesheet without preflight
|
|
116
116
|
|
|
117
117
|
```css
|
|
118
|
-
/*! stillwind v0.
|
|
118
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
119
119
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
120
120
|
@layer properties, theme, base, components, utilities;
|
|
121
121
|
|
|
@@ -171,7 +171,7 @@ export const page = {className:"sw_5yksj"};
|
|
|
171
171
|
### Generated stylesheet without preflight
|
|
172
172
|
|
|
173
173
|
```css
|
|
174
|
-
/*! stillwind v0.
|
|
174
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
175
175
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
176
176
|
@layer properties, theme, base, components, utilities;
|
|
177
177
|
|
|
@@ -263,7 +263,7 @@ export const icon = {className:"sw_smxmp"};
|
|
|
263
263
|
### Generated stylesheet without preflight
|
|
264
264
|
|
|
265
265
|
```css
|
|
266
|
-
/*! stillwind v0.
|
|
266
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
267
267
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
268
268
|
@layer properties, theme, base, components, utilities;
|
|
269
269
|
|
package/docs/at-rules/variant.md
CHANGED
|
@@ -37,7 +37,7 @@ a style rule.
|
|
|
37
37
|
### Generated stylesheet without preflight
|
|
38
38
|
|
|
39
39
|
```css
|
|
40
|
-
/*! stillwind v0.
|
|
40
|
+
/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */
|
|
41
41
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
42
42
|
@layer properties, theme, base, components, utilities;
|
|
43
43
|
|
package/docs/cli.md
CHANGED
|
@@ -6,7 +6,7 @@ description: "Commands, options, file selection, exit codes, and output formats
|
|
|
6
6
|
# CLI
|
|
7
7
|
|
|
8
8
|
`@stillwind/cli` sorts utilities, reports lint findings, applies automatic fixes,
|
|
9
|
-
and starts the language server. It reads the same `stillwind.config.ts` as the
|
|
9
|
+
shows generated CSS, lists the project's design system, and starts the language server. It reads the same `stillwind.config.ts` as the
|
|
10
10
|
build integration and the editor.
|
|
11
11
|
|
|
12
12
|
```sh
|
|
@@ -17,11 +17,15 @@ To run the CLI in CI, see [Checks in the editor and CI](guides/lint-adoption.md)
|
|
|
17
17
|
|
|
18
18
|
## Commands
|
|
19
19
|
|
|
20
|
-
| Command
|
|
21
|
-
|
|
|
22
|
-
| `stillwind fmt`
|
|
23
|
-
| `stillwind lint`
|
|
24
|
-
| `stillwind
|
|
20
|
+
| Command | Action |
|
|
21
|
+
| --------------------- | ---------------------------------------------------- |
|
|
22
|
+
| `stillwind fmt` | Sorts utilities |
|
|
23
|
+
| `stillwind lint` | Reports lint findings, and can apply automatic fixes |
|
|
24
|
+
| `stillwind inspect` | Shows the CSS that source code generates |
|
|
25
|
+
| `stillwind theme` | Lists the theme tokens of the project |
|
|
26
|
+
| `stillwind utilities` | Checks or searches utilities |
|
|
27
|
+
| `stillwind variants` | Checks or searches variants |
|
|
28
|
+
| `stillwind lsp` | Starts the language server |
|
|
25
29
|
|
|
26
30
|
`stillwind --help` lists the commands, and `stillwind <command> --help` lists the
|
|
27
31
|
options of a command. `stillwind --version` prints the package version. The short
|
|
@@ -80,6 +84,99 @@ Findings and the exit code describe the files after the last pass.
|
|
|
80
84
|
`--quiet` hides. When hidden warnings exceed the limit, the CLI still prints the
|
|
81
85
|
reason for the failure.
|
|
82
86
|
|
|
87
|
+
## stillwind inspect
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
vp exec stillwind inspect src/Button.tsx
|
|
91
|
+
vp exec stillwind inspect src/Button.tsx:12
|
|
92
|
+
vp exec stillwind inspect src/Button.tsx:12:8
|
|
93
|
+
vp exec stillwind inspect 'src/**/*.tsx' src/App.tsx:30 --format json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`inspect` shows the CSS that `style()` calls, keyframes, and view transitions
|
|
97
|
+
generate. The CSS writes the styled element as `&`, and it includes the styles that
|
|
98
|
+
the call composes. `inspect` saves no files.
|
|
99
|
+
|
|
100
|
+
Each target is a [path or glob](#select-files), and you can pass several targets.
|
|
101
|
+
Without a target, `inspect` covers every file that `files` selects.
|
|
102
|
+
|
|
103
|
+
| Suffix | Selected CSS |
|
|
104
|
+
| -------------- | ------------------------------------------------------------- |
|
|
105
|
+
| None | Every generated occurrence in the file |
|
|
106
|
+
| `:line` | The occurrences that overlap the line |
|
|
107
|
+
| `:line:column` | The utility at the position, or else the occurrence around it |
|
|
108
|
+
|
|
109
|
+
Lines and columns count from one, and columns count UTF-16 code units. A suffix on a
|
|
110
|
+
glob applies to each matched file.
|
|
111
|
+
|
|
112
|
+
`inspect` does not accept stylesheets, and a glob skips them. A target that matches no
|
|
113
|
+
file fails the command.
|
|
114
|
+
|
|
115
|
+
The output lists the findings in the range of each occurrence. An occurrence with an
|
|
116
|
+
error is marked as failed, and `inspect` returns exit code `1`. A warning does not fail
|
|
117
|
+
the occurrence or change the exit code. With `unknown-utility` set to `warn`, an
|
|
118
|
+
occurrence stays valid even though its CSS omits the unknown utility, so check the
|
|
119
|
+
findings as well. A file with incomplete analysis has no occurrences in the output, and
|
|
120
|
+
`inspect` reports it as a failure.
|
|
121
|
+
|
|
122
|
+
The output shows the CSS of each occurrence and not the result of the cascade. Runtime
|
|
123
|
+
values and rules from other occurrences can still change the applied styles.
|
|
124
|
+
|
|
125
|
+
`inspect` also accepts the [shared options](#shared-options). The `files` format is
|
|
126
|
+
not available.
|
|
127
|
+
|
|
128
|
+
## stillwind theme
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
vp exec stillwind theme
|
|
132
|
+
vp exec stillwind theme 'color-*' spacing-panel
|
|
133
|
+
vp exec stillwind theme --source project
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`theme` lists the active tokens of the CSS that the configuration selects. It reads no
|
|
137
|
+
source files, and `files` does not affect it.
|
|
138
|
+
|
|
139
|
+
Each argument selects tokens by name, and `*` matches any text. Write names without the
|
|
140
|
+
leading `--`, because the CLI reads `--color-*` as an option.
|
|
141
|
+
|
|
142
|
+
| Option | Effect |
|
|
143
|
+
| ------------------- | ----------------------------------------------- |
|
|
144
|
+
| `--source <origin>` | Shows only `project` tokens or `default` tokens |
|
|
145
|
+
|
|
146
|
+
`project` tokens come from an ordinary `@theme`. `default` tokens come from `@theme default`
|
|
147
|
+
or from a plugin, and an ordinary `@theme` can override them.
|
|
148
|
+
|
|
149
|
+
Each token shows its value as written, including references to other tokens.
|
|
150
|
+
|
|
151
|
+
## stillwind utilities
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
vp exec stillwind utilities p-4 hover:bg-accent
|
|
155
|
+
vp exec stillwind utilities 'bg-*' '*-panel'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`utilities` shows the CSS of each utility. It reads no source files.
|
|
159
|
+
|
|
160
|
+
An argument without `*` is an exact check, and it can include variants, numeric values, and
|
|
161
|
+
arbitrary values. An unknown name shows the closest spelling when one is close enough. A valid
|
|
162
|
+
name also shows its canonical spelling when a different spelling produces the same CSS, so
|
|
163
|
+
`[padding:16px]` shows `p-4`. The `canonical` field of the JSON output contains that spelling.
|
|
164
|
+
|
|
165
|
+
An argument with `*` searches the names that editors complete, and a `*` inside brackets or
|
|
166
|
+
parentheses does not count. **A search omits numeric and arbitrary values.** For example,
|
|
167
|
+
`p-*` lists `p-px` but not `p-4`, so check such a value with its exact name. Without an
|
|
168
|
+
argument, `utilities` lists every name.
|
|
169
|
+
|
|
170
|
+
## stillwind variants
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
vp exec stillwind variants hover
|
|
174
|
+
vp exec stillwind variants 'group-*'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`variants` shows the selectors and at-rules that each variant adds. Its arguments work as in
|
|
178
|
+
`utilities`. Write a variant name without the trailing `:`.
|
|
179
|
+
|
|
83
180
|
## stillwind lsp
|
|
84
181
|
|
|
85
182
|
```sh
|
|
@@ -92,7 +189,7 @@ accepts `--config`, but no globs.
|
|
|
92
189
|
|
|
93
190
|
## Shared options
|
|
94
191
|
|
|
95
|
-
`fmt` and `
|
|
192
|
+
`fmt`, `lint`, `inspect`, `theme`, `utilities`, and `variants` accept these options:
|
|
96
193
|
|
|
97
194
|
| Option | Effect |
|
|
98
195
|
| ----------------------- | --------------------------------------------------- |
|
|
@@ -146,11 +243,11 @@ The CLI reports all failures and all saved files, and it returns exit code `2`.
|
|
|
146
243
|
|
|
147
244
|
## Exit codes
|
|
148
245
|
|
|
149
|
-
| Code | Meaning
|
|
150
|
-
| ---- |
|
|
151
|
-
| `0` | The command succeeded. `lint` may still report warnings when you set no `--max-warnings` limit
|
|
152
|
-
| `1` | `fmt --check` found files to sort, `lint` found errors,
|
|
153
|
-
| `2` | The options were invalid, no files matched, or configuration, analysis, or file access failed
|
|
246
|
+
| Code | Meaning |
|
|
247
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
248
|
+
| `0` | The command succeeded. `lint` may still report warnings when you set no `--max-warnings` limit |
|
|
249
|
+
| `1` | `fmt --check` found files to sort, `lint` found errors, the warnings exceeded `--max-warnings`, `inspect` found a failed occurrence or no occurrence, or `theme`, `utilities`, or `variants` found an unknown name or a target without a match |
|
|
250
|
+
| `2` | The options were invalid, no files matched, or configuration, analysis, or file access failed |
|
|
154
251
|
|
|
155
252
|
Code `2` takes priority over code `1`.
|
|
156
253
|
|
|
@@ -211,12 +308,22 @@ failures:
|
|
|
211
308
|
"diagnostics": [],
|
|
212
309
|
"failures": [],
|
|
213
310
|
"changed": [],
|
|
311
|
+
"previews": [],
|
|
312
|
+
"tokens": [],
|
|
313
|
+
"candidates": [],
|
|
314
|
+
"unmatched": [],
|
|
214
315
|
"summary": {
|
|
215
316
|
"files": 1,
|
|
216
317
|
"errors": 0,
|
|
217
318
|
"warnings": 0,
|
|
218
319
|
"failures": 0,
|
|
219
320
|
"changed": 0,
|
|
321
|
+
"previews": 0,
|
|
322
|
+
"invalidPreviews": 0,
|
|
323
|
+
"tokens": 0,
|
|
324
|
+
"candidates": 0,
|
|
325
|
+
"invalidCandidates": 0,
|
|
326
|
+
"unmatched": 0,
|
|
220
327
|
"suggestions": 0,
|
|
221
328
|
"warningLimitExceeded": false
|
|
222
329
|
},
|
|
@@ -224,21 +331,45 @@ failures:
|
|
|
224
331
|
}
|
|
225
332
|
```
|
|
226
333
|
|
|
227
|
-
| Field | Value
|
|
228
|
-
| ------------- |
|
|
229
|
-
| `command` |
|
|
230
|
-
| `config` | The configuration path, or `null` when the CLI failed before the analysis
|
|
231
|
-
| `diagnostics` | The findings; `--quiet` removes warnings from this list
|
|
232
|
-
| `failures` | The execution failures
|
|
233
|
-
| `changed` | The files that the command changed; with `--check`, the files that it would change
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
334
|
+
| Field | Value |
|
|
335
|
+
| ------------- | ----------------------------------------------------------------------------------- |
|
|
336
|
+
| `command` | The command name, or `null` when the CLI failed before it selected a command |
|
|
337
|
+
| `config` | The configuration path, or `null` when the CLI failed before the analysis |
|
|
338
|
+
| `diagnostics` | The findings; `--quiet` removes warnings from this list |
|
|
339
|
+
| `failures` | The execution failures |
|
|
340
|
+
| `changed` | The files that the command changed; with `--check`, the files that it would change |
|
|
341
|
+
| `previews` | The generated CSS that `inspect` selected; empty for other commands |
|
|
342
|
+
| `tokens` | The tokens that `theme` selected; empty for other commands |
|
|
343
|
+
| `candidates` | The names that `utilities` or `variants` selected; empty for other commands |
|
|
344
|
+
| `unmatched` | The arguments of `theme`, `utilities`, or `variants` without a match in any project |
|
|
345
|
+
| `summary` | Counts for the fields above; `warnings` includes warnings that `--quiet` hides |
|
|
346
|
+
| `exitCode` | The [exit code](#exit-codes) |
|
|
236
347
|
|
|
237
348
|
Each diagnostic contains `project`, a zero-based project index, and `report`. The
|
|
238
349
|
report contains the message, its locations, notes, and suggested edits.
|
|
239
350
|
|
|
351
|
+
`docs` names the page that explains the report code. It is the absolute path of the page in
|
|
352
|
+
the installed `stillwind` package, which matches that version. When the package has no such
|
|
353
|
+
page, `docs` is the URL of the page on this website. A code without a page has no `docs`.
|
|
354
|
+
Findings in `previews` contain `docs` in the same way.
|
|
355
|
+
|
|
240
356
|
Each failure contains `message` and `details`, and it can contain `project` and
|
|
241
357
|
`file`. `details` lists the dependency problems that caused the failure.
|
|
242
358
|
|
|
243
|
-
|
|
359
|
+
Each preview contains `project`, `location`, `source`, `css`, `valid`, and `diagnostics`.
|
|
360
|
+
`location` contains the range of the occurrence, and `source` contains the text of that
|
|
361
|
+
range. `diagnostics` lists the `severity`, `code`, and `message` of each finding in the
|
|
362
|
+
range. `valid` is `false` when the list contains an error or when a style that the
|
|
363
|
+
occurrence requires failed. `css` can be empty for an occurrence with findings, and it
|
|
364
|
+
is empty when `documentation` describes a marker class. `runtimeNames` lists the runtime
|
|
365
|
+
expressions that supply view-transition names, and it is absent when there are none.
|
|
366
|
+
|
|
367
|
+
Each token contains `project`, `name`, `value`, `source`, and `inline`. `inline` is `true`
|
|
368
|
+
when utilities write the value of the token instead of a reference to it.
|
|
369
|
+
|
|
370
|
+
Each candidate contains `project`, `name`, `kind`, `valid`, and `css`. `kind` is `"utility"`,
|
|
371
|
+
`"variant"`, or `"marker"`, and `css` is empty for an unknown name and for a marker class
|
|
372
|
+
without CSS. An unknown name can contain `suggestion`, the closest valid spelling.
|
|
373
|
+
|
|
374
|
+
File paths are absolute. Locations in reports and previews use URIs and zero-based UTF-16
|
|
244
375
|
positions, and their ends are exclusive.
|
package/docs/configuration.md
CHANGED
|
@@ -111,7 +111,7 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
111
111
|
| `tailwind` | A Tailwind configuration object; see [Migrating from Tailwind CSS](guides/migrating-from-tailwind.md#move-configuration) |
|
|
112
112
|
| `plugins` | Plugin objects for the `@plugin` rules of your stylesheet |
|
|
113
113
|
| `rootFontSize` | Pixels per `rem`, used by lint fixes and editor previews; defaults to 16 |
|
|
114
|
-
| `useCssIf` | `true` lets runtime
|
|
114
|
+
| `useCssIf` | `true` lets [runtime conditions](guides/runtime-conditions.md) use the native CSS `if()` function; defaults to `false` |
|
|
115
115
|
|
|
116
116
|
### Generated names
|
|
117
117
|
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Runtime conditions"
|
|
3
|
+
description: "Change utilities and values with a custom property, without changing the classes of an element."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Runtime conditions
|
|
7
|
+
|
|
8
|
+
A runtime condition reads a CSS custom property when the browser computes styles.
|
|
9
|
+
The class list of an element stays the same when the property changes, and the
|
|
10
|
+
property reaches descendants through ordinary CSS inheritance.
|
|
11
|
+
|
|
12
|
+
> **Experimental**
|
|
13
|
+
>
|
|
14
|
+
> Runtime conditions can change between releases. The `if()` variant needs a browser
|
|
15
|
+
> that supports the CSS keyword `revert-rule`, which became Baseline in 2026. Check
|
|
16
|
+
> [Browser support](#browser-support) before you use it.
|
|
17
|
+
|
|
18
|
+
## Write a condition
|
|
19
|
+
|
|
20
|
+
Stillwind has two forms:
|
|
21
|
+
|
|
22
|
+
- The `if()` variant applies a utility when the condition holds.
|
|
23
|
+
- The `--if()` function chooses between two values. It takes a condition, the
|
|
24
|
+
value for a true condition, and the value for a false condition.
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { style } from "stillwind/react";
|
|
28
|
+
|
|
29
|
+
export function Sidebar({ compact }: { compact: boolean }) {
|
|
30
|
+
return (
|
|
31
|
+
<aside {...style("block w-[--if(--compact,4rem,16rem)]", { "--compact": compact })}>
|
|
32
|
+
<span {...style("if(--compact):hidden")}>Projects</span>
|
|
33
|
+
</aside>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`style()` writes `--compact` on the `<aside>`, and both elements read it. Neither
|
|
39
|
+
element needs a second set of classes for the compact state.
|
|
40
|
+
|
|
41
|
+
## Choose an approach
|
|
42
|
+
|
|
43
|
+
[Style states](style.md#style-states) shows the two approaches that most
|
|
44
|
+
states need:
|
|
45
|
+
|
|
46
|
+
- When an attribute represents the state, such as `disabled` or `aria-expanded`,
|
|
47
|
+
use a variant of that attribute.
|
|
48
|
+
- When one element changes and your component knows the state, pass a JavaScript
|
|
49
|
+
condition to `style()`.
|
|
50
|
+
|
|
51
|
+
Use a runtime condition when a state must reach several elements through CSS.
|
|
52
|
+
|
|
53
|
+
## Set the custom property
|
|
54
|
+
|
|
55
|
+
A condition without a comparison tests a boolean custom property. Pass a boolean in
|
|
56
|
+
`style()`, as in the first example. `true` becomes one space, and `false` becomes
|
|
57
|
+
`initial`. A custom property that no element sets is false.
|
|
58
|
+
|
|
59
|
+
In a stylesheet, write the same values yourself:
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
.compact {
|
|
63
|
+
--compact: ;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wide {
|
|
67
|
+
--compact: initial;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Other values do not work as booleans. For example, `"true"` and `1` produce invalid
|
|
72
|
+
CSS without `useCssIf`. Do not register a boolean custom property with `@property`,
|
|
73
|
+
because the registration changes its initial value.
|
|
74
|
+
|
|
75
|
+
The browser evaluates the condition on the styled element. To test the state of
|
|
76
|
+
another element, pass that state down with the custom property. A condition inside a
|
|
77
|
+
[ref](../macros/ref/index.md) wrapper is rejected, so write `if()` outside the wrapper.
|
|
78
|
+
|
|
79
|
+
## Combine conditions
|
|
80
|
+
|
|
81
|
+
Variants combine as usual. Repeated `if()` variants must all hold:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
style("if(--compact):if(--docked):hidden hover:if(--compact):w-64");
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`--if()` can stand inside another `--if()` and inside a CSS function:
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
style("w-[--if(--a,--if(--b,30px,20px),10px)] h-[calc(--if(--wide,20,10)*1px)]");
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Each branch must suit the utility. When a utility accepts several types, name the
|
|
94
|
+
type as with other arbitrary values, such as
|
|
95
|
+
`bg-[image:--if(--on,var(--image),none)]`.
|
|
96
|
+
|
|
97
|
+
## Use conditions in CSS
|
|
98
|
+
|
|
99
|
+
The same forms work in your stylesheet:
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
.panel {
|
|
103
|
+
width: --if(--compact, 4rem, 16rem);
|
|
104
|
+
|
|
105
|
+
@apply grid if(--compact):flex;
|
|
106
|
+
|
|
107
|
+
@variant if(--docked) {
|
|
108
|
+
position: sticky;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Put braces around a branch that contains a top-level comma:
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
.title {
|
|
117
|
+
font-family: --if(--brand, {Arial, sans-serif}, serif);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Enable native CSS if()
|
|
122
|
+
|
|
123
|
+
By default, the compiler expresses conditions with `var()`. The `useCssIf` option
|
|
124
|
+
makes it write the native CSS `if()` function instead, for values and variants:
|
|
125
|
+
|
|
126
|
+
```ts title="stillwind.config.ts"
|
|
127
|
+
import { defineConfig } from "stillwind/config";
|
|
128
|
+
|
|
129
|
+
export default defineConfig({
|
|
130
|
+
projects: [
|
|
131
|
+
{
|
|
132
|
+
css: "./src/stillwind.css",
|
|
133
|
+
files: ["src/**/*.{ts,tsx}"],
|
|
134
|
+
useCssIf: true,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Set this option only when the browsers that you support implement CSS `if()`. These
|
|
141
|
+
forms work only with it:
|
|
142
|
+
|
|
143
|
+
| Form | Example |
|
|
144
|
+
| ------------------------------------------ | ------------------------------------ |
|
|
145
|
+
| Negated variant | `if(!--compact):flex` |
|
|
146
|
+
| Comparison with a value | `if(--mode:compact):flex` |
|
|
147
|
+
| Comparison in `--if()` | `w-[--if(--mode:compact,20px,10px)]` |
|
|
148
|
+
| CSS-wide keyword for a set custom property | `w-[--if(--compact,inherit,10px)]` |
|
|
149
|
+
|
|
150
|
+
> **Negated values work without this option**
|
|
151
|
+
>
|
|
152
|
+
> The compiler swaps the branches of a negated `--if()`, so `--if(!--a,x,y)` does not
|
|
153
|
+
> need `useCssIf`. The restriction on CSS-wide keywords then applies to `y`.
|
|
154
|
+
|
|
155
|
+
A comparison follows the rules of CSS style queries, including any `@property`
|
|
156
|
+
registration of the custom property. A comparison value can contain a comma only
|
|
157
|
+
inside a CSS function or a quoted string.
|
|
158
|
+
|
|
159
|
+
The compiler leaves out a utility that it cannot express. Then
|
|
160
|
+
[runtime-condition-requires-css-if](../lints/runtime-condition-requires-css-if.md)
|
|
161
|
+
reports the utility. In a stylesheet,
|
|
162
|
+
[invalid-runtime-condition](../lints/invalid-runtime-condition.md) reports the
|
|
163
|
+
declaration. A malformed condition reports
|
|
164
|
+
[invalid-variant](../lints/invalid-variant.md) or
|
|
165
|
+
[invalid-utility](../lints/invalid-utility.md).
|
|
166
|
+
|
|
167
|
+
## Browser support
|
|
168
|
+
|
|
169
|
+
The `if()` variant needs `revert-rule`, with or without `useCssIf`. These versions
|
|
170
|
+
are the first to support it:
|
|
171
|
+
|
|
172
|
+
| Browser | Version |
|
|
173
|
+
| ------------ | ------- |
|
|
174
|
+
| Chrome, Edge | 148 |
|
|
175
|
+
| Firefox | 150 |
|
|
176
|
+
| Safari | 27 |
|
|
177
|
+
|
|
178
|
+
The compiler wraps the rule of the variant in `@supports (x:revert-rule)`. An older
|
|
179
|
+
browser skips the rule, and the styles without the variant stay. For example,
|
|
180
|
+
`grid if(--compact):flex` stays `grid` there. Make sure that these styles are usable.
|
|
181
|
+
|
|
182
|
+
`--if()` does not need `revert-rule`, unless a branch contains it. Without `useCssIf`,
|
|
183
|
+
it also works in browsers without CSS `if()`.
|
|
184
|
+
|
|
185
|
+
A custom CSS minifier must keep these `@supports` rules separate. Each rule has a
|
|
186
|
+
generated custom property in its condition, such as `(--iphw2:)`, and merging rules
|
|
187
|
+
with different conditions can remove styles from the page.
|
package/docs/guides/style.md
CHANGED
|
@@ -151,7 +151,8 @@ export function Progress({ value }: { value: number }) {
|
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
The utility `w-(--progress)` stays the same, so its CSS is generated at build
|
|
154
|
-
time. Only the value of `--progress` changes at runtime.
|
|
154
|
+
time. Only the value of `--progress` changes at runtime. To change utilities with
|
|
155
|
+
a custom property, see [Runtime conditions](runtime-conditions.md).
|
|
155
156
|
|
|
156
157
|
## Add classes from other stylesheets
|
|
157
158
|
|
|
@@ -8,7 +8,11 @@ description: "Check which Tailwind CSS v4 features, plugins, and CSS packages wo
|
|
|
8
8
|
Stillwind supports the utilities, variants, theme, CSS directives, and plugins of
|
|
9
9
|
Tailwind CSS v4. To move a project, follow
|
|
10
10
|
[Migrating from Tailwind CSS](migrating-from-tailwind.md). This page
|
|
11
|
-
lists what works, how Stillwind checks it, and where
|
|
11
|
+
lists what works, how Stillwind checks it, what Stillwind adds, and where it differs.
|
|
12
|
+
|
|
13
|
+
For the usage of Tailwind features, see the
|
|
14
|
+
[Tailwind CSS documentation](https://tailwindcss.com/docs). To check the CSS of a
|
|
15
|
+
utility or variant, use [Built-in utilities and variants](../utilities-and-variants.md).
|
|
12
16
|
|
|
13
17
|
## What works
|
|
14
18
|
|
|
@@ -89,6 +93,20 @@ A plugin can select an element by a fixed class name. For example, the rules of
|
|
|
89
93
|
keeps its name only without variants, so
|
|
90
94
|
[invalid-marker-use](../lints/invalid-marker-use.md) reports `hover:not-prose`.
|
|
91
95
|
|
|
96
|
+
## What Stillwind adds
|
|
97
|
+
|
|
98
|
+
These features have no equivalent in Tailwind CSS:
|
|
99
|
+
|
|
100
|
+
| Feature | Page |
|
|
101
|
+
| --------------------------------------- | --------------------------------------------------------------------------- |
|
|
102
|
+
| `if()` variant and `--if()` function | [Runtime conditions](runtime-conditions.md) |
|
|
103
|
+
| `host:` variant | [Style the shadow host](web-components.md#style-the-shadow-host) |
|
|
104
|
+
| Keyframes defined in a component | [Animations](animations.md) |
|
|
105
|
+
| View transitions defined in a component | [View transitions](view-transitions.md) |
|
|
106
|
+
| Refs to other elements | [Element relationships](element-relationships.md) |
|
|
107
|
+
| Logical properties for axis utilities | [Logical axis utilities](../concepts/stylesheets.md#logical-axis-utilities) |
|
|
108
|
+
| Lint rules | [Checks in the editor and CI](lint-adoption.md) |
|
|
109
|
+
|
|
92
110
|
## What Stillwind does not support
|
|
93
111
|
|
|
94
112
|
These differences come from the design of Stillwind. No setting changes them.
|
|
@@ -202,6 +202,35 @@ the `css` string from `stillwind/module-css`, or create a stylesheet from it wit
|
|
|
202
202
|
`CSSStyleSheet.replaceSync()`. The [style.css() reference](../macros/css.md)
|
|
203
203
|
describes variants that choose their own element and the `template` option.
|
|
204
204
|
|
|
205
|
+
## Style the shadow host
|
|
206
|
+
|
|
207
|
+
`host:` styles the shadow host with the `:host` selector. Use it in `style.css()` to
|
|
208
|
+
style the host and the elements of `selector` in one stylesheet:
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
import { style } from "stillwind/vanilla";
|
|
212
|
+
|
|
213
|
+
export const buttonCss = style.css("p-4 host:block host:hover:bg-gray-100", {
|
|
214
|
+
selector: "button",
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`p-4` styles `button`, and the other utilities style the host.
|
|
219
|
+
|
|
220
|
+
Inside its shadow tree, the host matches only `:host`, `:host()`, and
|
|
221
|
+
`:host-context()`. For this reason, the compiler moves conditions on the host into
|
|
222
|
+
`:host()`. `host:hover:` generates `:host(:hover)`, `hover:` with
|
|
223
|
+
`selector: ":host(.active)"` generates `:host(.active:hover)`, and `@apply hover:flex`
|
|
224
|
+
inside `:host` generates `&:host(:hover)`.
|
|
225
|
+
|
|
226
|
+
A selector in a shadow tree cannot read the elements around the host, so `host:in-*:`
|
|
227
|
+
and `host:group-*:` cannot match.
|
|
228
|
+
[unmatched-host-selector](../lints/unmatched-host-selector.md) reports them.
|
|
229
|
+
|
|
230
|
+
In `style()`, `host:` does not select the element that receives the classes. The
|
|
231
|
+
rule applies to the host of every shadow root that contains the CSS, and
|
|
232
|
+
[document-scoped-selector](../lints/document-scoped-selector.md) reports it.
|
|
233
|
+
|
|
205
234
|
## Constraints
|
|
206
235
|
|
|
207
236
|
- The CSS of a module contains only the styles of that module and the styles
|
package/docs/lints/index.md
CHANGED
|
@@ -84,6 +84,7 @@ report never matches.
|
|
|
84
84
|
| [missing-view-transition-name](missing-view-transition-name.md) | A view transition applied without `.for()` | warn |
|
|
85
85
|
| [repeated-nesting-selector](repeated-nesting-selector.md) | A selector that repeats `&` to relate two elements | warn |
|
|
86
86
|
| [split-view-transition-class](split-view-transition-class.md) | View transitions split across separate `style()` calls | warn |
|
|
87
|
+
| [unmatched-host-selector](unmatched-host-selector.md) | A variant that tests a shadow host through the elements around it | warn |
|
|
87
88
|
| [unsatisfiable-variants](unsatisfiable-variants.md) | Variants that can never match together, such as `portrait:landscape:` | warn |
|
|
88
89
|
|
|
89
90
|
## Stylesheet definitions
|
|
@@ -54,7 +54,8 @@ export default defineConfig({
|
|
|
54
54
|
|
|
55
55
|
A condition that only needs `useCssIf` is reported by
|
|
56
56
|
[runtime-condition-requires-css-if](runtime-condition-requires-css-if.md)
|
|
57
|
-
instead.
|
|
57
|
+
instead. See [Runtime conditions](../guides/runtime-conditions.md) for the supported
|
|
58
|
+
forms.
|
|
58
59
|
|
|
59
60
|
## Rule settings
|
|
60
61
|
|
|
@@ -28,7 +28,7 @@ style("flex");
|
|
|
28
28
|
## How to fix
|
|
29
29
|
|
|
30
30
|
- Remove the modifier or value that the utility does not accept.
|
|
31
|
-
- Check the accepted forms in [Built-in utilities](../utilities.md).
|
|
31
|
+
- Check the accepted forms in [Built-in utilities and variants](../utilities-and-variants.md).
|
|
32
32
|
|
|
33
33
|
A utility name or theme value that does not exist is reported by
|
|
34
34
|
[unknown-utility](unknown-utility.md) instead.
|
|
@@ -5,10 +5,13 @@ description: "Suggests standard utility spellings and combines equivalent utilit
|
|
|
5
5
|
|
|
6
6
|
# prefer-canonical-utilities
|
|
7
7
|
|
|
8
|
-
This rule suggests standard spellings, such as `px-4` for `px-[16px]
|
|
9
|
-
removes unnecessary spaces from arbitrary values, simplifies
|
|
10
|
-
and replaces legacy Tailwind spellings. Suggestions use your
|
|
11
|
-
definitions.
|
|
8
|
+
This rule suggests standard spellings, such as `px-4` for `px-[16px]` and `p-4` for
|
|
9
|
+
`[padding:16px]`. It also removes unnecessary spaces from arbitrary values, simplifies
|
|
10
|
+
variants and modifiers, and replaces legacy Tailwind spellings. Suggestions use your
|
|
11
|
+
active theme and custom definitions.
|
|
12
|
+
|
|
13
|
+
The rule also finds the utility for CSS that you know. Write the declaration as an
|
|
14
|
+
arbitrary property, and let `stillwind lint --fix` replace it.
|
|
12
15
|
|
|
13
16
|
Within one string or one CSS `@apply` statement, it can combine utilities such as
|
|
14
17
|
`w-4 h-4` into `size-4`. Utilities must have the same variants and importance.
|
|
@@ -46,7 +46,8 @@ style("if(--state:active):block");
|
|
|
46
46
|
- Otherwise, represent the state with an attribute and use an attribute variant.
|
|
47
47
|
That requires changing the code that sets the state as well.
|
|
48
48
|
|
|
49
|
-
See [
|
|
49
|
+
See [Runtime conditions](../guides/runtime-conditions.md#enable-native-css-if) and
|
|
50
|
+
[Configuration](../configuration.md#generated-css).
|
|
50
51
|
|
|
51
52
|
## Rule settings
|
|
52
53
|
|
|
@@ -34,7 +34,8 @@ style("bg-red-950");
|
|
|
34
34
|
- For a class that another stylesheet defines, pass it in a `class` field, such as
|
|
35
35
|
`style({ class: "external-card" })`.
|
|
36
36
|
|
|
37
|
-
[Built-in utilities](../utilities.md) looks up the
|
|
37
|
+
[Built-in utilities and variants](../utilities-and-variants.md) looks up the
|
|
38
|
+
utilities of the default theme.
|
|
38
39
|
|
|
39
40
|
## Rule settings
|
|
40
41
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "unmatched-host-selector"
|
|
3
|
+
description: "Reports a variant that tests a shadow host through the elements around it."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# unmatched-host-selector
|
|
7
|
+
|
|
8
|
+
This rule reports a variant stack that tests a shadow host through the elements
|
|
9
|
+
around it, such as `host:in-[.page]:` or `host:group-hover:`. A selector in a shadow
|
|
10
|
+
tree cannot read those elements, so the rule never matches.
|
|
11
|
+
|
|
12
|
+
## Reported
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
style.css("host:in-[.page]:block");
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> unmatched-host-selector: `:where(:is(.page)) :host` cannot match the shadow host; pass the state down with a custom property
|
|
19
|
+
>
|
|
20
|
+
> Example:1:17
|
|
21
|
+
|
|
22
|
+
## Fixed
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
style.css("[:host(.page)]:block");
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## How to fix
|
|
29
|
+
|
|
30
|
+
- Add a class or an attribute to the host, and test it inside `:host()`, as in the
|
|
31
|
+
example.
|
|
32
|
+
- Set a custom property on the outer element, and read it on the host with
|
|
33
|
+
[`--if()`](../guides/runtime-conditions.md). Custom properties inherit into a
|
|
34
|
+
shadow tree.
|
|
35
|
+
|
|
36
|
+
## Rule settings
|
|
37
|
+
|
|
38
|
+
| Preset | Severity |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `recommended` | warn |
|
|
41
|
+
| `strict` | deny |
|
|
42
|
+
| `stylistic` | off |
|
|
43
|
+
|
|
44
|
+
[Configure lint](../configuration.md#lint) to change the severity or options.
|
package/docs/macros/css.md
CHANGED
|
@@ -24,7 +24,7 @@ export const css = style.css("p-4 text-blue-600", {
|
|
|
24
24
|
### Compiled code
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
export const css = "/*! stillwind v0.
|
|
27
|
+
export const css = "/*! stillwind v0.5.0 | MIT License | https://stillwind.dev */\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n:where(:root, :host){--color-blue-600:oklch(54.6% 0.245 262.881);--spacing:0.25rem;}:host{padding:calc(var(--spacing) * 4);}:host{color:var(--color-blue-600);}";
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
### Generated CSS
|
|
@@ -60,8 +60,8 @@ the template and the utilities need. It never contains the preflight reset.
|
|
|
60
60
|
|
|
61
61
|
Add the string to the page yourself, for example with
|
|
62
62
|
`CSSStyleSheet.replaceSync()` and a shadow root's `adoptedStyleSheets`. The
|
|
63
|
-
results in [Built-in utilities](../utilities.md)
|
|
64
|
-
so they cannot replace this string.
|
|
63
|
+
results in [Built-in utilities and variants](../utilities-and-variants.md)
|
|
64
|
+
leave out the supporting CSS, so they cannot replace this string.
|
|
65
65
|
|
|
66
66
|
To add all styles of a module to a shadow root, including the preflight reset,
|
|
67
67
|
import them from `stillwind/module-css` instead. See
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Built-in utilities and variants"
|
|
3
|
+
description: "Look up the CSS of a utility or variant, or find the canonical utility for CSS declarations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Built-in utilities and variants
|
|
7
|
+
|
|
8
|
+
Type a utility to see its CSS, or type CSS declarations to find the utility that
|
|
9
|
+
produces them. Arbitrary values, such as `p-[16px]`, resolve to their canonical
|
|
10
|
+
spelling. Arbitrary variants resolve too, so `[&:focus]` finds `focus:`. Part of
|
|
11
|
+
a variant name or its CSS finds the variant: `:hover`, `@media (hover: hover)`,
|
|
12
|
+
and `media hover` all find `hover:`. The URL keeps your input, so you can share
|
|
13
|
+
the results.
|
|
14
|
+
|
|
15
|
+
## Read the results
|
|
16
|
+
|
|
17
|
+
Each result shows one utility and its declarations. `&` stands for the styled
|
|
18
|
+
element. Comments show the resolved theme values and pixel sizes. A result for
|
|
19
|
+
CSS declarations names the declaration that it comes from. A variant result
|
|
20
|
+
shows where the variant places the declarations of a utility.
|
|
21
|
+
|
|
22
|
+
The results leave out the theme variables and other supporting CSS that the full
|
|
23
|
+
stylesheet contains. The [macro reference](macros/index.md) shows complete
|
|
24
|
+
generated stylesheets.
|
|
25
|
+
|
|
26
|
+
A declaration without a matching utility becomes an arbitrary property, such as
|
|
27
|
+
`[hyphens:manual]`. Variants and shorthand properties can change what a utility
|
|
28
|
+
does, so compare its declarations with your CSS before you replace it.
|
|
29
|
+
|
|
30
|
+
## What the lookup covers
|
|
31
|
+
|
|
32
|
+
The lookup runs the Stillwind compiler in your browser with the default theme.
|
|
33
|
+
It downloads the compiler when the page opens. Utilities from your own `@theme`
|
|
34
|
+
tokens, such as `bg-brand`, do not resolve here. See
|
|
35
|
+
[Design systems](guides/design-systems.md) to add them. To check a utility in
|
|
36
|
+
your project, hover over it in the editor or run `stillwind utilities`.
|
|
37
|
+
|
|
38
|
+
The built-in utilities and variants follow Tailwind CSS, so see the
|
|
39
|
+
[Tailwind CSS documentation](https://tailwindcss.com/docs) for their usage.
|
|
40
|
+
[Tailwind CSS compatibility](guides/tailwind-compatibility.md#what-stillwind-adds)
|
|
41
|
+
lists what Stillwind adds.
|
|
42
|
+
|
|
43
|
+
The editor and the CLI report non-canonical spellings with
|
|
44
|
+
[prefer-canonical-utilities](lints/prefer-canonical-utilities.md).
|
|
45
|
+
|
|
46
|
+
## Look up names from the command line
|
|
47
|
+
|
|
48
|
+
The lookup needs a browser. In a terminal or a coding agent, the
|
|
49
|
+
[CLI](cli.md#stillwind-utilities) shows the CSS of utilities and variants:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
vp exec stillwind utilities p-4 hover:underline
|
|
53
|
+
vp exec stillwind utilities 'bg-*'
|
|
54
|
+
vp exec stillwind variants hover 'group-*'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The commands read the CSS of your project, so they also resolve utilities from
|
|
58
|
+
your own `@theme` tokens. An exact name shows its CSS, or the closest spelling
|
|
59
|
+
when the name is unknown.
|
|
60
|
+
|
|
61
|
+
A `*` pattern searches names only. It omits numeric and arbitrary values, so
|
|
62
|
+
`p-*` does not list `p-4`, and you check `p-4` with its exact name. The commands
|
|
63
|
+
do not search CSS, so `stillwind variants ':hover'` reports an unknown variant.
|
|
64
|
+
|
|
65
|
+
To find the utility for a CSS declaration, write the declaration as an arbitrary
|
|
66
|
+
property. Variants can precede it:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
vp exec stillwind utilities '[padding:16px]' '[&:focus]:[display:flex]'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The output names the canonical spellings, `p-4` and `focus:flex`. You can also
|
|
73
|
+
write arbitrary properties in your source and run `stillwind lint --fix`, which
|
|
74
|
+
replaces them with the same spellings. An arbitrary property that stays has no
|
|
75
|
+
equivalent utility.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stillwind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CSS definitions and framework adapters for Stillwind",
|
|
5
5
|
"homepage": "https://stillwind.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
"./package.json": "./package.json"
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@stillwind/config": "0.
|
|
124
|
-
"@stillwind/native": "0.
|
|
125
|
-
"@stillwind/projection": "0.
|
|
123
|
+
"@stillwind/config": "0.5.0",
|
|
124
|
+
"@stillwind/native": "0.5.0",
|
|
125
|
+
"@stillwind/projection": "0.5.0"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@stillwind-internal/tools-workspace": "0.0.0",
|
|
@@ -53,7 +53,9 @@ next steps.
|
|
|
53
53
|
CSS project, leave out the preflight reset until the old CSS is gone, as
|
|
54
54
|
`docs/guides/migrating-from-css.md` describes.
|
|
55
55
|
2. Migrate in batches, such as one directory or one group of components. After
|
|
56
|
-
each batch, build the project and run `stillwind lint`.
|
|
56
|
+
each batch, build the project and run `stillwind lint`. To move a CSS
|
|
57
|
+
declaration, write it as an arbitrary property, such as `[padding:16px]`, and
|
|
58
|
+
run `stillwind lint --fix`, which replaces it when an equivalent utility exists.
|
|
57
59
|
3. For many mechanical changes, you can write a one-off codemod for this
|
|
58
60
|
project. Keep it outside the source directories, review its diff, and delete
|
|
59
61
|
it afterward.
|
|
@@ -5,13 +5,13 @@ description: Write and fix styles in a project that uses Stillwind, by loading t
|
|
|
5
5
|
|
|
6
6
|
# Stillwind
|
|
7
7
|
|
|
8
|
-
Read only the pages that the task needs. Use the documentation of the installed
|
|
9
|
-
|
|
8
|
+
Read only the pages that the task needs. Use the documentation of the installed package
|
|
9
|
+
in `node_modules/stillwind/docs/`, so that it matches the project's
|
|
10
10
|
Stillwind version. The `docs/` paths below are relative to the package root.
|
|
11
11
|
When this skill is installed without a local package, follow the skill's link to
|
|
12
|
-
its real directory and use `../../docs/` in the same package. If the skill was
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
its real directory and use `../../docs/` in the same package. If the skill was copied
|
|
13
|
+
without the package, start from https://stillwind.dev/docs/llms.txt, which lists the
|
|
14
|
+
Markdown version of each page.
|
|
15
15
|
|
|
16
16
|
## Task routing
|
|
17
17
|
|
|
@@ -28,7 +28,7 @@ which lists the Markdown version of each page.
|
|
|
28
28
|
| View transitions | `docs/guides/view-transitions.md`, `docs/macros/view-transition.md` |
|
|
29
29
|
| Theme tokens and design-system rules | `docs/guides/design-systems.md` |
|
|
30
30
|
| Custom utilities and variants | `docs/at-rules/index.md`, then the page of the at-rule |
|
|
31
|
-
| Available utilities
|
|
31
|
+
| Available utilities and variants | `docs/utilities-and-variants.md` |
|
|
32
32
|
| `stillwind.config.ts` | `docs/configuration.md` |
|
|
33
33
|
| CLI, CI, and lint presets | `docs/guides/lint-adoption.md`, `docs/cli.md` |
|
|
34
34
|
| Editor setup and language server | `docs/editors.md` |
|
|
@@ -42,16 +42,28 @@ which lists the Markdown version of each page.
|
|
|
42
42
|
|
|
43
43
|
## Working rules
|
|
44
44
|
|
|
45
|
-
- Follow `docs/guides/recommended-practices.md`. Keep styles in `style()` calls
|
|
46
|
-
|
|
47
|
-
- Use theme tokens instead of arbitrary values.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
- Follow `docs/guides/recommended-practices.md`. Keep styles in `style()` calls on their
|
|
46
|
+
elements, and express states with attributes and variants.
|
|
47
|
+
- Use theme tokens instead of arbitrary values. Run `stillwind theme --source project`
|
|
48
|
+
to read the tokens of the project. When a value is missing, ask the user before you
|
|
49
|
+
add a token.
|
|
50
|
+
- Run `stillwind utilities <name>` to check a utility before you use it, such as
|
|
51
|
+
`stillwind utilities p-4 hover:bg-accent`. A `*` pattern searches names, but it omits
|
|
52
|
+
numeric and arbitrary values. `stillwind variants` works in the same way.
|
|
53
|
+
- When you know the CSS but not the utility, pass the declaration as an arbitrary property,
|
|
54
|
+
such as `stillwind utilities '[padding:16px]' '[&:focus]:[display:flex]'`, and use the
|
|
55
|
+
canonical spelling that the output names. An arbitrary property in the source is only an
|
|
56
|
+
intermediate step, which `stillwind lint --fix` also replaces. When no canonical spelling
|
|
57
|
+
exists, the declaration has no equivalent utility.
|
|
58
|
+
- Write custom utilities with `@apply` and variants, not with hand-written selectors or
|
|
59
|
+
media queries.
|
|
60
|
+
- After you change styles, run `stillwind lint --fix` and `stillwind fmt` through the
|
|
61
|
+
project's package manager, such as `vp exec stillwind lint`. Add `--format json` when
|
|
62
|
+
you parse the output.
|
|
63
|
+
- Run `stillwind inspect <file>:<line> --format json` to check the CSS that a
|
|
64
|
+
`style()` call generates. Paths, globs, and several targets also work.
|
|
65
|
+
- Read the page of each remaining finding before you fix it. With `--format json`,
|
|
66
|
+
the `docs` field of a finding names that page. Do not add a suppression comment or
|
|
67
|
+
relax the `lint` setting unless the user agrees. A suppression comment names the rule
|
|
68
|
+
and gives the reason after `--`.
|
|
57
69
|
- Check the result in the browser when a change can affect the layout.
|
package/docs/utilities.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Built-in utilities"
|
|
3
|
-
description: "Look up the CSS of a utility, or find the canonical utility for CSS declarations."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Built-in utilities
|
|
7
|
-
|
|
8
|
-
Type a utility to see its CSS, or type CSS declarations to find the utility that
|
|
9
|
-
produces them. Arbitrary values, such as `p-[16px]`, resolve to their canonical
|
|
10
|
-
spelling. The URL keeps your input, so you can share the results.
|
|
11
|
-
|
|
12
|
-
## Read the results
|
|
13
|
-
|
|
14
|
-
Each result shows one utility and its declarations. `&` stands for the styled
|
|
15
|
-
element. Comments show the resolved theme values and pixel sizes. A result for
|
|
16
|
-
CSS declarations names the declaration that it comes from.
|
|
17
|
-
|
|
18
|
-
The results leave out the theme variables and other supporting CSS that the full
|
|
19
|
-
stylesheet contains. The [macro reference](macros/index.md) shows complete
|
|
20
|
-
generated stylesheets.
|
|
21
|
-
|
|
22
|
-
A declaration without a matching utility becomes an arbitrary property, such as
|
|
23
|
-
`[hyphens:manual]`. Variants and shorthand properties can change what a utility
|
|
24
|
-
does, so compare its declarations with your CSS before you replace it.
|
|
25
|
-
|
|
26
|
-
## What the lookup covers
|
|
27
|
-
|
|
28
|
-
The lookup runs the Stillwind compiler in your browser with the default theme.
|
|
29
|
-
It downloads the compiler when the page opens. Utilities from your own `@theme`
|
|
30
|
-
tokens, such as `bg-brand`, do not resolve here. See
|
|
31
|
-
[Design systems](guides/design-systems.md) to add them, and hover over a
|
|
32
|
-
utility in the editor to check it in your project.
|
|
33
|
-
|
|
34
|
-
The editor and the CLI report non-canonical spellings with
|
|
35
|
-
[prefer-canonical-utilities](lints/prefer-canonical-utilities.md).
|