stillwind 0.11.0 → 0.13.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/AGENTS_TEMPLATE.md +3 -2
- package/CHANGELOG.md +80 -0
- package/README.md +3 -3
- package/css/builtin-utilities/tw-borders.css +59 -59
- package/css/builtin-utilities/tw-effects.css +53 -53
- package/css/builtin-utilities/tw-typography.css +13 -13
- package/dist/class-object-C87DR3v2.js +6 -0
- package/dist/class-object-C87DR3v2.js.map +1 -0
- package/dist/class-object-CR0QHoF9.d.ts +10 -0
- package/dist/{class-string-C5YFtXQn.d.ts → class-string-BlClX8JK.d.ts} +2 -2
- package/dist/class-string-CiNTVHYm.js +6 -0
- package/dist/{class-string-KnYInbiw.js.map → class-string-CiNTVHYm.js.map} +1 -1
- package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
- package/dist/formats-DP9B9SG6.js.map +1 -0
- package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
- package/dist/frameworks/alpine.d.ts +5 -3
- package/dist/frameworks/alpine.js +3 -1
- package/dist/frameworks/alpine.js.map +1 -1
- package/dist/frameworks/astro.d.ts +3 -3
- package/dist/frameworks/astro.js +1 -1
- package/dist/frameworks/lit.d.ts +5 -3
- package/dist/frameworks/lit.js +3 -1
- package/dist/frameworks/lit.js.map +1 -1
- package/dist/frameworks/preact.d.ts +3 -3
- package/dist/frameworks/preact.js +1 -1
- package/dist/frameworks/qwik.d.ts +3 -3
- package/dist/frameworks/qwik.js +1 -1
- package/dist/frameworks/react.d.ts +2 -2
- package/dist/frameworks/react.js +1 -1
- package/dist/frameworks/solid.d.ts +3 -3
- package/dist/frameworks/solid.js +1 -1
- package/dist/frameworks/svelte.d.ts +3 -3
- package/dist/frameworks/svelte.js +1 -1
- package/dist/frameworks/vanilla.d.ts +5 -3
- package/dist/frameworks/vanilla.js +6 -1
- package/dist/frameworks/vanilla.js.map +1 -0
- package/dist/frameworks/vue.d.ts +3 -3
- package/dist/frameworks/vue.js +1 -1
- package/dist/{index-DBpgaaD7.d.ts → index-DpaDcczW.d.ts} +157 -57
- package/dist/macro/index.d.ts +2 -2
- package/dist/macro/index.js +1 -1
- package/dist/runtime/development.d.ts +16 -8
- package/dist/runtime/development.js +57 -21
- package/dist/runtime/development.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/style-dMBm8aX_.js +50 -0
- package/dist/style-dMBm8aX_.js.map +1 -0
- package/docs/agents.md +1 -0
- package/docs/at-rules/apply.md +1 -1
- package/docs/at-rules/custom-variant.md +1 -1
- package/docs/at-rules/slot.md +1 -1
- package/docs/at-rules/stillwind-property.md +1 -1
- package/docs/at-rules/stillwind-registry.md +7 -7
- 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 +43 -4
- package/docs/at-rules/variant.md +1 -1
- package/docs/cli.md +146 -51
- package/docs/concepts/css-ordering.md +46 -7
- package/docs/concepts/how-styles-compile.md +8 -8
- package/docs/configuration.md +63 -4
- package/docs/errors/SW01001.md +1 -1
- package/docs/errors/SW03001.md +1 -1
- package/docs/errors/SW10004.md +1 -1
- package/docs/errors/SW10005.md +1 -1
- package/docs/errors/SW10006.md +34 -0
- package/docs/errors/SW11001.md +1 -1
- package/docs/errors/SW12001.md +1 -1
- package/docs/errors/SW12002.md +1 -1
- package/docs/errors/SW13002.md +1 -1
- package/docs/errors/SW14001.md +1 -1
- package/docs/errors/SW14002.md +1 -1
- package/docs/errors/SW14003.md +1 -1
- package/docs/errors/SW14004.md +1 -1
- package/docs/errors/SW14007.md +1 -1
- package/docs/errors/SW32003.md +1 -1
- package/docs/errors/SW32005.md +1 -1
- package/docs/errors/index.md +1 -0
- package/docs/formatters.md +34 -2
- package/docs/guides/lint-adoption.md +2 -0
- package/docs/guides/migrating-from-tailwind.md +60 -9
- package/docs/guides/recommended-practices.md +18 -0
- package/docs/guides/reusable-styles.md +2 -2
- package/docs/guides/tailwind-compatibility.md +8 -0
- package/docs/index.md +4 -5
- package/docs/integrations.md +314 -79
- package/docs/lints/conflicting-utilities.md +9 -0
- package/docs/lints/cyclic-style-order.md +61 -0
- package/docs/lints/index.md +26 -10
- package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
- package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
- package/docs/lints/invalid-rule-group-input.md +1 -1
- package/docs/lints/missing-view-transition-name.md +1 -1
- package/docs/lints/multiple-style-forwards.md +59 -0
- package/docs/lints/partial-utility-override.md +77 -0
- package/docs/lints/prefer-direct-styling.md +1 -1
- package/docs/lints/suspending-macro-argument.md +1 -1
- package/docs/lints/utility-class-selector.md +72 -0
- package/docs/llms.txt +238 -0
- package/docs/macros/index.md +1 -1
- package/docs/macros/recipe.md +246 -0
- package/docs/macros/style.md +72 -0
- package/docs/macros/when.md +1 -1
- package/docs/plugins/iconify.md +2 -0
- package/docs/utilities-and-variants.md +2 -0
- package/package.json +6 -6
- package/skills/setup-stillwind/SKILL.md +1 -2
- package/skills/stillwind/SKILL.md +19 -12
- package/dist/class-object-BaK8uudd.d.ts +0 -9
- package/dist/class-object-DNcjzcfH.js +0 -6
- package/dist/class-object-DNcjzcfH.js.map +0 -1
- package/dist/class-string-KnYInbiw.js +0 -6
- package/dist/formats-Ctf2WFc-.js.map +0 -1
- package/dist/style-BE8vuLiO.js +0 -44
- package/dist/style-BE8vuLiO.js.map +0 -1
- package/docs/macros/cva.md +0 -155
package/docs/at-rules/utility.md
CHANGED
|
@@ -9,12 +9,22 @@ description: "Define a utility, or add declarations to a built-in utility with t
|
|
|
9
9
|
@utility name { ... }
|
|
10
10
|
@utility name-* { ... }
|
|
11
11
|
@utility name (implementation) { ... }
|
|
12
|
+
@utility name-* (exclusive) { ... }
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
`@utility` defines a utility for [`style()`](https://stillwind.dev/docs/macros/style),
|
|
15
16
|
[`@apply`](https://stillwind.dev/docs/at-rules/apply), and the other places that accept utilities.
|
|
16
17
|
Write it at the top level of the stylesheet.
|
|
17
18
|
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
- [Static and functional utilities](#static-and-functional-utilities)
|
|
22
|
+
- [Values and modifiers](#values-and-modifiers)
|
|
23
|
+
- [Definitions with the same name](#definitions-with-the-same-name)
|
|
24
|
+
- [Body](#body)
|
|
25
|
+
- [The implementation descriptor](#the-implementation-descriptor)
|
|
26
|
+
- [Conditions](#conditions)
|
|
27
|
+
|
|
18
28
|
## Static and functional utilities
|
|
19
29
|
|
|
20
30
|
A name without `*` defines a static utility. A name that ends in `-*` defines a
|
|
@@ -51,7 +61,7 @@ export const list = {className:"sw_l0qhr"};
|
|
|
51
61
|
### Generated stylesheet without preflight
|
|
52
62
|
|
|
53
63
|
```css
|
|
54
|
-
/*! stillwind v0.
|
|
64
|
+
/*! stillwind v0.13.0 | MIT License | https://stillwind.dev */
|
|
55
65
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
56
66
|
@layer properties, theme, base, components, utilities;
|
|
57
67
|
|
|
@@ -116,7 +126,7 @@ export const code = {className:"sw_vqs03"};
|
|
|
116
126
|
### Generated stylesheet without preflight
|
|
117
127
|
|
|
118
128
|
```css
|
|
119
|
-
/*! stillwind v0.
|
|
129
|
+
/*! stillwind v0.13.0 | MIT License | https://stillwind.dev */
|
|
120
130
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
121
131
|
@layer properties, theme, base, components, utilities;
|
|
122
132
|
|
|
@@ -172,7 +182,7 @@ export const page = {className:"sw_z5acf"};
|
|
|
172
182
|
### Generated stylesheet without preflight
|
|
173
183
|
|
|
174
184
|
```css
|
|
175
|
-
/*! stillwind v0.
|
|
185
|
+
/*! stillwind v0.13.0 | MIT License | https://stillwind.dev */
|
|
176
186
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
177
187
|
@layer properties, theme, base, components, utilities;
|
|
178
188
|
|
|
@@ -209,6 +219,35 @@ A static definition replaces a functional one for its exact name:
|
|
|
209
219
|
only. To remove built-in definitions, use
|
|
210
220
|
[`@stillwind-undef-utility`](https://stillwind.dev/docs/at-rules/stillwind-undef-utility).
|
|
211
221
|
|
|
222
|
+
### Read a value from one source
|
|
223
|
+
|
|
224
|
+
By default, every definition that accepts a named value contributes, even when
|
|
225
|
+
the definitions read the value from different theme namespaces. Add
|
|
226
|
+
`(exclusive)` to definitions that must read a named value from one source, as one
|
|
227
|
+
Tailwind utility does. The first `(exclusive)` definition, in source order, whose
|
|
228
|
+
`--value()` accepts the value decides the source. Other `(exclusive)` definitions
|
|
229
|
+
apply only when they read the value from the same source.
|
|
230
|
+
|
|
231
|
+
```css
|
|
232
|
+
@theme {
|
|
233
|
+
--size-wide: 40rem;
|
|
234
|
+
--color-wide: oklch(0.9 0.02 250);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@utility box-* (exclusive) {
|
|
238
|
+
width: --value(--size-*);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@utility box-* (exclusive) {
|
|
242
|
+
background-color: --value(--color-*);
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
`box-wide` sets only `width`. Without `(exclusive)`, it also sets
|
|
247
|
+
`background-color`. The descriptor does not change how arbitrary values and
|
|
248
|
+
variables select definitions. The built-in utilities that read a size and a
|
|
249
|
+
color, such as `shadow-*`, `text-*`, and `border-*`, use this descriptor.
|
|
250
|
+
|
|
212
251
|
## Body
|
|
213
252
|
|
|
214
253
|
A body can contain nested rules, [`@apply`](https://stillwind.dev/docs/at-rules/apply),
|
|
@@ -268,7 +307,7 @@ export const icon = {className:"sw_xg0pi"};
|
|
|
268
307
|
### Generated stylesheet without preflight
|
|
269
308
|
|
|
270
309
|
```css
|
|
271
|
-
/*! stillwind v0.
|
|
310
|
+
/*! stillwind v0.13.0 | MIT License | https://stillwind.dev */
|
|
272
311
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
273
312
|
@layer properties, theme, base, components, utilities;
|
|
274
313
|
|
package/docs/at-rules/variant.md
CHANGED
|
@@ -39,7 +39,7 @@ body, that element is the one that uses the utility.
|
|
|
39
39
|
### Generated stylesheet without preflight
|
|
40
40
|
|
|
41
41
|
```css
|
|
42
|
-
/*! stillwind v0.
|
|
42
|
+
/*! stillwind v0.13.0 | MIT License | https://stillwind.dev */
|
|
43
43
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
44
44
|
@layer properties, theme, base, components, utilities;
|
|
45
45
|
|
package/docs/cli.md
CHANGED
|
@@ -5,6 +5,8 @@ description: "Commands, options, file selection, exit codes, and output formats
|
|
|
5
5
|
|
|
6
6
|
# CLI
|
|
7
7
|
|
|
8
|
+
> Command examples use `vp` (Vite+); substitute your project's package manager (such as `pnpm`, `npm`, or `bun`).
|
|
9
|
+
|
|
8
10
|
`@stillwind/cli` sorts utilities, reports lint findings, applies automatic fixes,
|
|
9
11
|
shows generated CSS, lists the project's design system, and starts the language server. It reads the same `stillwind.config.ts` as the
|
|
10
12
|
build integration and the editor.
|
|
@@ -15,22 +17,72 @@ vp i -D @stillwind/cli
|
|
|
15
17
|
|
|
16
18
|
To run the CLI in CI, see [Checks in the editor and CI](https://stillwind.dev/docs/guides/lint-adoption).
|
|
17
19
|
|
|
20
|
+
## Contents
|
|
21
|
+
|
|
22
|
+
- [Commands](#commands)
|
|
23
|
+
- [stillwind check](#stillwind-check)
|
|
24
|
+
- [stillwind fmt](#stillwind-fmt)
|
|
25
|
+
- [stillwind lint](#stillwind-lint)
|
|
26
|
+
- [stillwind info](#stillwind-info)
|
|
27
|
+
- [stillwind inspect](#stillwind-inspect)
|
|
28
|
+
- [stillwind theme](#stillwind-theme)
|
|
29
|
+
- [stillwind utilities](#stillwind-utilities)
|
|
30
|
+
- [stillwind variants](#stillwind-variants)
|
|
31
|
+
- [stillwind lsp](#stillwind-lsp)
|
|
32
|
+
- [Shared options](#shared-options)
|
|
33
|
+
- [Select files](#select-files)
|
|
34
|
+
- [Saving files](#saving-files)
|
|
35
|
+
- [Exit codes](#exit-codes)
|
|
36
|
+
- [Output formats](#output-formats)
|
|
37
|
+
- [Colors and links](#colors-and-links)
|
|
38
|
+
- [JSON output](#json-output)
|
|
39
|
+
|
|
18
40
|
## Commands
|
|
19
41
|
|
|
20
|
-
| Command | Action
|
|
21
|
-
| --------------------- |
|
|
22
|
-
| `stillwind
|
|
23
|
-
| `stillwind
|
|
24
|
-
| `stillwind
|
|
25
|
-
| `stillwind
|
|
26
|
-
| `stillwind
|
|
27
|
-
| `stillwind
|
|
28
|
-
| `stillwind
|
|
42
|
+
| Command | Action |
|
|
43
|
+
| --------------------- | ---------------------------------------------------------------------- |
|
|
44
|
+
| `stillwind check` | Runs lint and utility sorting checks, and can fix and sort in one pass |
|
|
45
|
+
| `stillwind fmt` | Sorts utilities |
|
|
46
|
+
| `stillwind lint` | Reports lint findings, and can apply automatic fixes |
|
|
47
|
+
| `stillwind info` | Shows the resolved project configuration |
|
|
48
|
+
| `stillwind inspect` | Shows the CSS that source code generates |
|
|
49
|
+
| `stillwind theme` | Lists the theme tokens of the project |
|
|
50
|
+
| `stillwind utilities` | Checks or searches utilities |
|
|
51
|
+
| `stillwind variants` | Checks or searches variants |
|
|
52
|
+
| `stillwind lsp` | Starts the language server |
|
|
29
53
|
|
|
30
54
|
`stillwind --help` lists the commands, and `stillwind <command> --help` lists the
|
|
31
55
|
options of a command. `stillwind --version` prints the package version. The short
|
|
32
56
|
forms of these options are `-h` and `-v`.
|
|
33
57
|
|
|
58
|
+
## stillwind check
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
vp exec stillwind check
|
|
62
|
+
vp exec stillwind check --fix
|
|
63
|
+
vp exec stillwind check --max-warnings 0
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`check` runs lint checks and utility sorting checks in a single analysis pass,
|
|
67
|
+
and saves no files. It reports both lint findings and files whose utilities need
|
|
68
|
+
sorting, even when [prefer-sorted-utilities](https://stillwind.dev/docs/lints/prefer-sorted-utilities)
|
|
69
|
+
is disabled.
|
|
70
|
+
|
|
71
|
+
| Option | Effect |
|
|
72
|
+
| -------------------- | ----------------------------------------------------------------------- |
|
|
73
|
+
| `--fix` | Applies the enabled automatic fixes, sorts utilities, and saves changes |
|
|
74
|
+
| `--quiet` | Hides warnings, and keeps their count in the summary |
|
|
75
|
+
| `--max-warnings <n>` | Fails when the number of warnings exceeds `n`, a non-negative integer |
|
|
76
|
+
| `--limit <n>` | Shows at most `n` diagnostics (`0` prints only the summary) |
|
|
77
|
+
|
|
78
|
+
`check` also accepts the [shared options](#shared-options) and
|
|
79
|
+
[globs](#select-files). The `files` format is not available.
|
|
80
|
+
|
|
81
|
+
`--fix` repeats automatic fixes until the file stops changing (up to ten passes per file, respecting
|
|
82
|
+
suppression comments), sorts utilities with the configured
|
|
83
|
+
[`sort` options](https://stillwind.dev/docs/configuration#sorting), saves only changed files, and
|
|
84
|
+
reports findings for the final files.
|
|
85
|
+
|
|
34
86
|
## stillwind fmt
|
|
35
87
|
|
|
36
88
|
```sh
|
|
@@ -74,6 +126,7 @@ this website.
|
|
|
74
126
|
| `--fix` | Applies the enabled automatic fixes, and saves the changed files |
|
|
75
127
|
| `--quiet` | Hides warnings, and keeps their count in the summary |
|
|
76
128
|
| `--max-warnings <n>` | Fails when the number of warnings exceeds `n`, a non-negative integer |
|
|
129
|
+
| `--limit <n>` | Shows at most `n` diagnostics (`0` prints only the summary) |
|
|
77
130
|
|
|
78
131
|
`lint` also accepts the [shared options](#shared-options) and
|
|
79
132
|
[globs](#select-files).
|
|
@@ -87,6 +140,20 @@ Findings and the exit code describe the files after the last pass.
|
|
|
87
140
|
`--quiet` hides. When hidden warnings exceed the limit, the CLI still prints the
|
|
88
141
|
reason for the failure.
|
|
89
142
|
|
|
143
|
+
## stillwind info
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
vp exec stillwind info
|
|
147
|
+
vp exec stillwind info --format json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`info` evaluates `stillwind.config.*` and reports each project's resolved root,
|
|
151
|
+
stylesheet path, target and exclude globs, matched file count, registered plugins,
|
|
152
|
+
sorting and `typeFacts` settings, and active lint rules (omitting rules set to `off`).
|
|
153
|
+
It compiles no source files and accepts no positional arguments.
|
|
154
|
+
|
|
155
|
+
`info` accepts the [shared options](#shared-options). The `files` format is not available.
|
|
156
|
+
|
|
90
157
|
## stillwind inspect
|
|
91
158
|
|
|
92
159
|
```sh
|
|
@@ -149,36 +216,44 @@ leading `--`, because the CLI reads `--color-*` as an option.
|
|
|
149
216
|
`project` tokens come from an ordinary [`@theme`](https://stillwind.dev/docs/at-rules/theme). `default` tokens
|
|
150
217
|
come from `@theme default` or from a plugin, and an ordinary `@theme` can override them.
|
|
151
218
|
|
|
152
|
-
Each token shows its value as written, including references to other tokens.
|
|
219
|
+
Each token shows its value as written, including references to other tokens. When
|
|
220
|
+
the value references known theme tokens, text output appends the resolved value in
|
|
221
|
+
a comment and JSON output includes `resolvedValue`.
|
|
153
222
|
|
|
154
223
|
## stillwind utilities
|
|
155
224
|
|
|
156
225
|
```sh
|
|
157
226
|
vp exec stillwind utilities p-4 hover:bg-accent
|
|
158
227
|
vp exec stillwind utilities 'bg-*' '*-panel'
|
|
228
|
+
vp exec stillwind utilities 'p-*' --names-only
|
|
159
229
|
```
|
|
160
230
|
|
|
161
231
|
`utilities` shows the CSS of each utility. It reads no source files.
|
|
162
232
|
|
|
233
|
+
| Option | Effect |
|
|
234
|
+
| -------------- | ----------------------------------------- |
|
|
235
|
+
| `--names-only` | Lists matching names without CSS previews |
|
|
236
|
+
|
|
163
237
|
An argument without `*` is an exact check, and it can include variants, numeric values, and
|
|
164
238
|
arbitrary values. An unknown name shows the closest spelling when one is close enough. A valid
|
|
165
239
|
name also shows its canonical spelling when a different spelling produces the same CSS, so
|
|
166
240
|
`[padding:16px]` shows `p-4`. The `canonical` field of the JSON output contains that spelling.
|
|
167
241
|
|
|
168
242
|
An argument with `*` searches the names that editors complete, and a `*` inside brackets or
|
|
169
|
-
parentheses does not count.
|
|
170
|
-
`p
|
|
171
|
-
|
|
243
|
+
parentheses does not count. A search also includes placeholder patterns for functional
|
|
244
|
+
utilities' non-enumerable domains, such as `p-<number>` and `p-[<length-percentage>]` (`kind: "pattern"`
|
|
245
|
+
in JSON), so you can see which numeric or arbitrary values a family accepts before checking an
|
|
246
|
+
exact name. Without an argument, `utilities` lists every name.
|
|
172
247
|
|
|
173
248
|
## stillwind variants
|
|
174
249
|
|
|
175
250
|
```sh
|
|
176
251
|
vp exec stillwind variants hover
|
|
177
|
-
vp exec stillwind variants 'group-*'
|
|
252
|
+
vp exec stillwind variants 'group-*' --names-only
|
|
178
253
|
```
|
|
179
254
|
|
|
180
|
-
`variants` shows the selectors and at-rules that each variant adds. Its arguments
|
|
181
|
-
`utilities`. Write a variant name without the trailing `:`.
|
|
255
|
+
`variants` shows the selectors and at-rules that each variant adds. Its arguments and
|
|
256
|
+
`--names-only` option work as in `utilities`. Write a variant name without the trailing `:`.
|
|
182
257
|
|
|
183
258
|
## stillwind lsp
|
|
184
259
|
|
|
@@ -192,7 +267,7 @@ accepts `--config`, but no globs.
|
|
|
192
267
|
|
|
193
268
|
## Shared options
|
|
194
269
|
|
|
195
|
-
`fmt`, `lint`, `inspect`, `theme`, `utilities`, and `variants` accept these options:
|
|
270
|
+
`check`, `fmt`, `lint`, `info`, `inspect`, `theme`, `utilities`, and `variants` accept these options:
|
|
196
271
|
|
|
197
272
|
| Option | Effect |
|
|
198
273
|
| ----------------------- | --------------------------------------------------- |
|
|
@@ -225,7 +300,7 @@ it. When nothing matches, the CLI returns exit code `2`.
|
|
|
225
300
|
|
|
226
301
|
## Saving files
|
|
227
302
|
|
|
228
|
-
`fmt
|
|
303
|
+
`check --fix`, `fmt`, and `lint --fix` work out the changes for all selected files before they save
|
|
229
304
|
the first file. The CLI then saves only the files whose content changed, so
|
|
230
305
|
modification times of other files stay the same.
|
|
231
306
|
|
|
@@ -246,11 +321,11 @@ The CLI reports all failures and all saved files, and it returns exit code `2`.
|
|
|
246
321
|
|
|
247
322
|
## Exit codes
|
|
248
323
|
|
|
249
|
-
| Code | Meaning
|
|
250
|
-
| ---- |
|
|
251
|
-
| `0` | The command succeeded. `lint` may still report warnings when you set no `--max-warnings` limit
|
|
252
|
-
| `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 |
|
|
253
|
-
| `2` | The options were invalid, no files matched, or configuration, analysis, or file access failed
|
|
324
|
+
| Code | Meaning |
|
|
325
|
+
| ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
326
|
+
| `0` | The command succeeded. `check` and `lint` may still report warnings when you set no `--max-warnings` limit |
|
|
327
|
+
| `1` | `check` or `fmt --check` found files to sort, `check` or `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 |
|
|
328
|
+
| `2` | The options were invalid, no files matched, or configuration, analysis, or file access failed |
|
|
254
329
|
|
|
255
330
|
Code `2` takes priority over code `1`.
|
|
256
331
|
|
|
@@ -312,6 +387,7 @@ failures:
|
|
|
312
387
|
"failures": [],
|
|
313
388
|
"changed": [],
|
|
314
389
|
"previews": [],
|
|
390
|
+
"projects": [],
|
|
315
391
|
"tokens": [],
|
|
316
392
|
"candidates": [],
|
|
317
393
|
"unmatched": [],
|
|
@@ -323,33 +399,49 @@ failures:
|
|
|
323
399
|
"changed": 0,
|
|
324
400
|
"previews": 0,
|
|
325
401
|
"invalidPreviews": 0,
|
|
402
|
+
"projects": 0,
|
|
326
403
|
"tokens": 0,
|
|
327
404
|
"candidates": 0,
|
|
328
405
|
"invalidCandidates": 0,
|
|
329
406
|
"unmatched": 0,
|
|
407
|
+
"autofixable": 0,
|
|
330
408
|
"suggestions": 0,
|
|
409
|
+
"omittedDiagnostics": 0,
|
|
410
|
+
"byCode": {},
|
|
331
411
|
"warningLimitExceeded": false
|
|
332
412
|
},
|
|
333
413
|
"exitCode": 0
|
|
334
414
|
}
|
|
335
415
|
```
|
|
336
416
|
|
|
337
|
-
| Field | Value
|
|
338
|
-
| ------------- |
|
|
339
|
-
| `command` | The command name, or `null` when the CLI failed before it selected a command
|
|
340
|
-
| `config` | The configuration path, or `null` when the CLI failed before the analysis
|
|
341
|
-
| `diagnostics` | The findings; `--quiet` removes warnings
|
|
342
|
-
| `failures` | The execution failures
|
|
343
|
-
| `changed` | The files that the command changed; with `--check`, the files that
|
|
344
|
-
| `previews` | The generated CSS that `inspect` selected; empty for other commands
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
417
|
+
| Field | Value |
|
|
418
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
419
|
+
| `command` | The command name, or `null` when the CLI failed before it selected a command |
|
|
420
|
+
| `config` | The configuration path, or `null` when the CLI failed before the analysis |
|
|
421
|
+
| `diagnostics` | The findings; `--quiet` removes warnings and `--limit` truncates this list |
|
|
422
|
+
| `failures` | The execution failures |
|
|
423
|
+
| `changed` | The files that the command changed; with `check` (without `--fix`) or `fmt --check`, the files that need sorting |
|
|
424
|
+
| `previews` | The generated CSS that `inspect` selected; empty for other commands |
|
|
425
|
+
| `projects` | The resolved project configurations that `info` reported; empty for other commands |
|
|
426
|
+
| `tokens` | The tokens that `theme` selected; empty for other commands |
|
|
427
|
+
| `candidates` | The names that `utilities` or `variants` selected; empty for other commands |
|
|
428
|
+
| `unmatched` | The arguments of `theme`, `utilities`, or `variants` without a match in any project |
|
|
429
|
+
| `summary` | Counts for the fields above; includes full `errors`, `warnings`, `byCode`, and `omittedDiagnostics` counts |
|
|
430
|
+
| `exitCode` | The [exit code](#exit-codes) |
|
|
431
|
+
|
|
432
|
+
Each diagnostic contains `project`, a zero-based project index, `file` (a slash-separated path
|
|
433
|
+
relative to the working directory, or absolute on another filesystem volume), 1-based `line` and
|
|
434
|
+
`column` for range diagnostics (omitted for document-level diagnostics), and `report`. The
|
|
435
|
+
report contains the message, its zero-based locations, notes, and suggested edits (`actions`).
|
|
436
|
+
Each action has an `autofix` boolean: `true` when `--fix` applies it automatically,
|
|
437
|
+
and `false` for manual suggestions. `summary.autofixable` counts diagnostics with an
|
|
438
|
+
automatic fix, `summary.suggestions` counts diagnostics with manual suggestions,
|
|
439
|
+
`summary.omittedDiagnostics` counts diagnostics omitted by `--limit`, and `summary.byCode`
|
|
440
|
+
aggregates `{ errors, warnings, autofixable, docs? }` per diagnostic code across all findings
|
|
441
|
+
before `--quiet` or `--limit` filtering.
|
|
442
|
+
|
|
443
|
+
When `inspect` returns no previews and no execution failures, `emptyReason` explains why:
|
|
444
|
+
`"no-styles"`, `"line-out-of-range"`, `"column-out-of-range"`, or `"no-match-at-position"`.
|
|
353
445
|
|
|
354
446
|
`docs` names the page that explains the report code. It is the absolute path of the page in
|
|
355
447
|
the installed `stillwind` package, which matches that version. When the package has no such
|
|
@@ -359,20 +451,23 @@ Findings in `previews` contain `docs` in the same way.
|
|
|
359
451
|
Each failure contains `message` and `details`, and it can contain `project` and
|
|
360
452
|
`file`. `details` lists the dependency problems that caused the failure.
|
|
361
453
|
|
|
362
|
-
Each preview contains `project`, `
|
|
363
|
-
`location` contains the range of the occurrence,
|
|
364
|
-
range. `diagnostics` lists the `severity`, `code`, and
|
|
365
|
-
range. `valid` is `false` when the list contains an error or
|
|
366
|
-
occurrence requires failed. `css` can be empty for an occurrence with
|
|
367
|
-
is empty when `documentation` describes a marker class. `runtimeNames` lists
|
|
368
|
-
expressions that supply view-transition names, and it is absent when there are none.
|
|
454
|
+
Each preview contains `project`, `file`, 1-based `line` and `column`, `location`, `source`,
|
|
455
|
+
`css`, `valid`, and `diagnostics`. `location` contains the zero-based range of the occurrence,
|
|
456
|
+
and `source` contains the text of that range. `diagnostics` lists the `severity`, `code`, and
|
|
457
|
+
`message` of each finding in the range. `valid` is `false` when the list contains an error or
|
|
458
|
+
when a style that the occurrence requires failed. `css` can be empty for an occurrence with
|
|
459
|
+
findings, and it is empty when `documentation` describes a marker class. `runtimeNames` lists
|
|
460
|
+
the runtime expressions that supply view-transition names, and it is absent when there are none.
|
|
369
461
|
|
|
370
|
-
Each token contains `project`, `name`, `value`, `source`, and `inline
|
|
462
|
+
Each token contains `project`, `name`, `value`, `source`, and `inline`, and
|
|
463
|
+
`resolvedValue` when `value` references known theme tokens. `inline` is `true`
|
|
371
464
|
when utilities write the value of the token instead of a reference to it.
|
|
372
465
|
|
|
373
466
|
Each candidate contains `project`, `name`, `kind`, `valid`, and `css`. `kind` is `"utility"`,
|
|
374
|
-
`"variant"`, or `"
|
|
375
|
-
without CSS
|
|
467
|
+
`"variant"`, `"marker"`, or `"pattern"`, and `css` is empty for an unknown name, a pattern,
|
|
468
|
+
a marker class without CSS, or `--names-only`. An unknown name can contain `suggestion`, the
|
|
469
|
+
closest valid spelling.
|
|
376
470
|
|
|
377
|
-
|
|
378
|
-
|
|
471
|
+
Paths in `config`, `changed`, and `failures` are absolute; `file` on diagnostics and previews is
|
|
472
|
+
relative to the working directory with `/` separators. Nested `location` objects in reports and
|
|
473
|
+
previews use URIs and zero-based UTF-16 positions, and their ends are exclusive.
|
|
@@ -29,13 +29,13 @@ the base's CSS first.
|
|
|
29
29
|
Read the following table from top to bottom. Stillwind orders files first, then
|
|
30
30
|
calls within each file, then the rules that each call produces:
|
|
31
31
|
|
|
32
|
-
| Step | What Stillwind orders | Which CSS comes first
|
|
33
|
-
| ---- | ----------------------------------- |
|
|
34
|
-
| 1 | Different files | A file that defines a base comes before a file that uses it in `style(base, ...)`.
|
|
35
|
-
| 2 | `style()` calls in one file | The base's CSS comes before CSS added by `style(base, ...)`. Other calls follow the order in which they appear in the file.
|
|
36
|
-
| 3 | JavaScript conditions in one call | CSS without a JavaScript condition comes first. CSS for conditions follows in the order the conditions are written. If conditions are nested, CSS for the outer condition comes before CSS for the inner one.
|
|
37
|
-
| 4 | CSS variants on one generated class | Rules without variants come first. The stylesheet sets the order of variants, such as `hover:` before `disabled:` or `sm:` before `md:` in the default stylesheet.
|
|
38
|
-
| 5 | Utilities with the same variants | By default, utilities follow the order of their definitions in the stylesheet, regardless of their order in `style()`.
|
|
32
|
+
| Step | What Stillwind orders | Which CSS comes first |
|
|
33
|
+
| ---- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| 1 | Different files | A file that defines a base comes before a file that uses it in `style(base, ...)`. A file that declares an imported value, such as a component, comes before the file that imports it. Other files use a stable order based on their paths. |
|
|
35
|
+
| 2 | `style()` calls in one file | The base's CSS comes before CSS added by `style(base, ...)`. Other calls follow the order in which they appear in the file. |
|
|
36
|
+
| 3 | JavaScript conditions in one call | CSS without a JavaScript condition comes first. CSS for conditions follows in the order the conditions are written. If conditions are nested, CSS for the outer condition comes before CSS for the inner one. |
|
|
37
|
+
| 4 | CSS variants on one generated class | Rules without variants come first. The stylesheet sets the order of variants, such as `hover:` before `disabled:` or `sm:` before `md:` in the default stylesheet. |
|
|
38
|
+
| 5 | Utilities with the same variants | By default, utilities follow the order of their definitions in the stylesheet, regardless of their order in `style()`. |
|
|
39
39
|
|
|
40
40
|
For example, the variant order in step 4 only applies to rules for the same
|
|
41
41
|
class. It does not move a rule ahead of CSS from an earlier file or call.
|
|
@@ -92,6 +92,45 @@ plain classes, and none of the declarations uses `!important`. The red rule wins
|
|
|
92
92
|
because it comes last. The same rule applies when you import `base` from another
|
|
93
93
|
file.
|
|
94
94
|
|
|
95
|
+
### Files that pass styles to components
|
|
96
|
+
|
|
97
|
+
When a file imports a value from another file and uses it, the file that
|
|
98
|
+
declares the value comes first. For a component, this lets the caller's
|
|
99
|
+
utilities win over the component's own utilities:
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
// src/App.tsx
|
|
103
|
+
import { Button } from "./components/ui/button";
|
|
104
|
+
|
|
105
|
+
<Button {...style("w-full")} />;
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Here `src/components/ui/button.tsx` comes before `src/App.tsx`, although the
|
|
109
|
+
paths sort the other way. The import decides the order, so it does not matter
|
|
110
|
+
how the style reaches the component. The order is the same when the style is
|
|
111
|
+
stored in a variable first, or when it is passed to a child element that the
|
|
112
|
+
component renders, as with `asChild`.
|
|
113
|
+
|
|
114
|
+
Stillwind follows the imports that are read as values. It ignores type-only
|
|
115
|
+
imports, imports that the file does not use, and imports from packages. It
|
|
116
|
+
follows re-exports, such as an `index.ts` file that re-exports components, to
|
|
117
|
+
the file that declares the value. A namespace import, such as
|
|
118
|
+
`import * as ui from "./ui"`, orders the file after every file that `./ui`
|
|
119
|
+
re-exports. When the declaring file has no `style()` call, Stillwind follows
|
|
120
|
+
that file's imports instead. A file that imports `Wrapper`, which renders
|
|
121
|
+
`Button`, therefore comes after the file of `Button`. Imports in Vue, Svelte,
|
|
122
|
+
and Astro files work in the same way. Components that a framework imports
|
|
123
|
+
automatically, without an `import` declaration, do not order files.
|
|
124
|
+
|
|
125
|
+
This order only places CSS. The component still has to apply the props, for
|
|
126
|
+
example with [`style.forward()`](https://stillwind.dev/docs/macros/style#forward-props-to-a-components-element).
|
|
127
|
+
It does not add the component's CSS to a stylesheet that does not include the
|
|
128
|
+
component.
|
|
129
|
+
|
|
130
|
+
When two files import values from each other, directly or through other
|
|
131
|
+
files, both orders cannot hold. Stillwind keeps one of them and reports
|
|
132
|
+
[cyclic-style-order](https://stillwind.dev/docs/lints/cyclic-style-order).
|
|
133
|
+
|
|
95
134
|
### Within one call, conditional rules come last
|
|
96
135
|
|
|
97
136
|
In this call, the red utility has a JavaScript condition and the blue utility
|
|
@@ -97,14 +97,14 @@ custom property as an inline style.
|
|
|
97
97
|
The CSS for both classes is generated at build time. At runtime, the code only
|
|
98
98
|
chooses class names and sets property values.
|
|
99
99
|
|
|
100
|
-
| You write
|
|
101
|
-
|
|
|
102
|
-
| Static utilities and variants
|
|
103
|
-
| A condition, such as `active && "..."`
|
|
104
|
-
| A runtime custom property
|
|
105
|
-
| [`style.
|
|
106
|
-
| [`style.media()`](https://stillwind.dev/docs/macros/media)
|
|
107
|
-
| [`style.css()`](https://stillwind.dev/docs/macros/css)
|
|
100
|
+
| You write | JavaScript at runtime |
|
|
101
|
+
| --------------------------------------- | ------------------------------------------- |
|
|
102
|
+
| Static utilities and variants | A class name |
|
|
103
|
+
| A condition, such as `active && "..."` | A helper that joins class names |
|
|
104
|
+
| A runtime custom property | An inline `style` value |
|
|
105
|
+
| [`style.recipe()`](https://stillwind.dev/docs/macros/recipe) | A factory that selects compiled class names |
|
|
106
|
+
| [`style.media()`](https://stillwind.dev/docs/macros/media) | A string with the media query |
|
|
107
|
+
| [`style.css()`](https://stillwind.dev/docs/macros/css) | A CSS string that you place yourself |
|
|
108
108
|
|
|
109
109
|
Development builds import checked versions of the helpers from
|
|
110
110
|
`stillwind/runtime/development`. These versions report invalid values while you
|
package/docs/configuration.md
CHANGED
|
@@ -26,6 +26,18 @@ Most applications need one project. A monorepo can list one project for each
|
|
|
26
26
|
application, or keep a configuration file in each package and reference those
|
|
27
27
|
files.
|
|
28
28
|
|
|
29
|
+
## Contents
|
|
30
|
+
|
|
31
|
+
- [Reference other configuration files](#reference-other-configuration-files)
|
|
32
|
+
- [Where Stillwind finds the file](#where-stillwind-finds-the-file)
|
|
33
|
+
- [Project fields](#project-fields)
|
|
34
|
+
- [Lint](#lint)
|
|
35
|
+
- [Suppression comments](#suppression-comments)
|
|
36
|
+
- [Sorting](#sorting)
|
|
37
|
+
- [Hooks](#hooks)
|
|
38
|
+
- [Several projects](#several-projects)
|
|
39
|
+
- [Override settings in the integration](#override-settings-in-the-integration)
|
|
40
|
+
|
|
29
41
|
## Reference other configuration files
|
|
30
42
|
|
|
31
43
|
A string in `projects` references other configuration files, relative to the
|
|
@@ -96,10 +108,11 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
96
108
|
|
|
97
109
|
### Checks and sorting
|
|
98
110
|
|
|
99
|
-
| Field
|
|
100
|
-
|
|
|
101
|
-
| `lint`
|
|
102
|
-
| `sort`
|
|
111
|
+
| Field | Value |
|
|
112
|
+
| ------- | ------------------------------------------------------------------------------------------ |
|
|
113
|
+
| `lint` | Presets and rules; see [Lint](#lint) |
|
|
114
|
+
| `sort` | Where `stillwind fmt` sorts utilities, or `false` to disable them; see [Sorting](#sorting) |
|
|
115
|
+
| `hooks` | Project hooks for in-memory formatting in the CLI; see [Hooks](#hooks) |
|
|
103
116
|
|
|
104
117
|
### Generated CSS
|
|
105
118
|
|
|
@@ -310,6 +323,52 @@ only that rule keeps `stillwind fmt` working.
|
|
|
310
323
|
The CLI checks the files that `files` selects. File patterns on the command line
|
|
311
324
|
narrow that set; they cannot add files outside it.
|
|
312
325
|
|
|
326
|
+
## Hooks
|
|
327
|
+
|
|
328
|
+
Each project may define a `hooks` array of `AnalysisHook` objects for the CLI
|
|
329
|
+
`fmt` and `check` commands. Hooks run in array order and operate on in-memory
|
|
330
|
+
buffers, so `--check` compares the final formatted text without writing to disk.
|
|
331
|
+
Build integrations, the language server, `stillwind lint`, and
|
|
332
|
+
`prettier-plugin-stillwind` do not run project hooks.
|
|
333
|
+
|
|
334
|
+
```ts title="stillwind.config.ts"
|
|
335
|
+
import { format as oxfmt } from "oxfmt";
|
|
336
|
+
import { defineConfig, defineHook } from "stillwind/config";
|
|
337
|
+
|
|
338
|
+
const oxfmtHook = defineHook({
|
|
339
|
+
name: "oxfmt",
|
|
340
|
+
async format(file) {
|
|
341
|
+
const result = await oxfmt(file.path, file.code);
|
|
342
|
+
if (result.errors.length) {
|
|
343
|
+
throw new Error(result.errors.map((error) => error.message).join("\n"));
|
|
344
|
+
}
|
|
345
|
+
return result.code;
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export default defineConfig({
|
|
350
|
+
projects: [
|
|
351
|
+
{
|
|
352
|
+
css: "./src/stillwind.css",
|
|
353
|
+
files: ["src/**/*.{ts,tsx,vue,svelte,astro}"],
|
|
354
|
+
hooks: [oxfmtHook],
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
});
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
| Callback | Runs on | Role |
|
|
361
|
+
| ---------- | -------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
362
|
+
| `setup` | Hooks before `format` callbacks run | Initializes per-project resources once for the command |
|
|
363
|
+
| `teardown` | Initialized hooks in reverse order | Releases resources after callbacks finish, including when an earlier step fails |
|
|
364
|
+
| `format` | `fmt`, `fmt --check`, `check`, `check --fix` | Transforms one buffer `(file, context) => string \| void` after Stillwind sorting |
|
|
365
|
+
|
|
366
|
+
In a monorepo, import shared hooks into each project so running the CLI from the
|
|
367
|
+
workspace root or from a package directory produces the same result. When a file
|
|
368
|
+
belongs to overlapping projects that share the same `format` hook references in
|
|
369
|
+
the same order, the pipeline runs once; conflicting outputs from different hooks
|
|
370
|
+
fail that target.
|
|
371
|
+
|
|
313
372
|
## Several projects
|
|
314
373
|
|
|
315
374
|
When the file has several projects, each integration selects one:
|
package/docs/errors/SW01001.md
CHANGED
package/docs/errors/SW03001.md
CHANGED
package/docs/errors/SW10004.md
CHANGED
|
@@ -16,7 +16,7 @@ const card = style.ref("card");
|
|
|
16
16
|
const container = card.asContainer("inline-size");
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
> SW10004: asContainer(...) must be
|
|
19
|
+
> SW10004: asContainer(...) must be used as an input to style(); it cannot be used as a standalone runtime value
|
|
20
20
|
|
|
21
21
|
## Fixed
|
|
22
22
|
|
package/docs/errors/SW10005.md
CHANGED
|
@@ -19,7 +19,7 @@ const macro = style;
|
|
|
19
19
|
macro("p-4");
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
> SW10005: macro binding `style` has a reference that
|
|
22
|
+
> SW10005: macro binding `style` has a reference that could not be transformed
|
|
23
23
|
|
|
24
24
|
## Fixed
|
|
25
25
|
|