stillwind 0.1.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/css/builtin-utilities/tw-layout.css +2 -2
- package/css/logical/divide.css +67 -0
- package/css/logical/overflow.css +57 -0
- package/css/logical/overscroll.css +40 -0
- package/css/logical/resize.css +19 -0
- package/css/logical/snap.css +20 -0
- package/docs/at-rules/apply.md +1 -1
- package/docs/at-rules/custom-variant.md +3 -3
- package/docs/at-rules/plugin.md +2 -3
- 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 +8 -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 +6 -5
- package/docs/at-rules/variant.md +1 -1
- package/docs/cli.md +375 -0
- package/docs/concepts/stylesheets.md +89 -0
- package/docs/configuration.md +44 -6
- package/docs/editors.md +110 -0
- package/docs/errors/SW10002.md +1 -1
- package/docs/formatters.md +87 -0
- package/docs/guides/lint-adoption.md +3 -12
- package/docs/guides/migrating-from-css.md +2 -0
- package/docs/guides/runtime-conditions.md +187 -0
- package/docs/guides/style.md +6 -5
- package/docs/guides/tailwind-compatibility.md +22 -1
- package/docs/guides/web-components.md +29 -0
- package/docs/index.md +6 -4
- package/docs/integrations.md +3 -0
- package/docs/lints/{prefer-explicit-nesting-selector.md → implicit-nesting-selector.md} +3 -3
- package/docs/lints/index.md +44 -43
- package/docs/lints/invalid-runtime-condition.md +2 -1
- package/docs/lints/invalid-utility.md +1 -1
- package/docs/lints/prefer-canonical-utilities.md +21 -4
- package/docs/lints/prefer-logical-properties.md +18 -0
- package/docs/lints/runtime-condition-requires-css-if.md +2 -1
- package/docs/lints/unknown-utility.md +3 -2
- package/docs/lints/unknown-variant.md +1 -1
- package/docs/lints/unmatched-host-selector.md +44 -0
- package/docs/macros/css.md +3 -3
- package/docs/plugins/iconify.md +270 -0
- package/docs/plugins/index.md +26 -0
- package/docs/utilities-and-variants.md +75 -0
- package/docs/why.md +1 -1
- package/package.json +11 -6
- package/skills/migrate-to-stillwind/SKILL.md +3 -1
- package/skills/stillwind/SKILL.md +34 -19
- package/docs/utilities.md +0 -35
package/docs/cli.md
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "CLI"
|
|
3
|
+
description: "Commands, options, file selection, exit codes, and output formats of the Stillwind CLI."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI
|
|
7
|
+
|
|
8
|
+
`@stillwind/cli` sorts utilities, reports lint findings, applies automatic fixes,
|
|
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
|
+
build integration and the editor.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
vp i -D @stillwind/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
To run the CLI in CI, see [Checks in the editor and CI](guides/lint-adoption.md).
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
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 |
|
|
29
|
+
|
|
30
|
+
`stillwind --help` lists the commands, and `stillwind <command> --help` lists the
|
|
31
|
+
options of a command. `stillwind --version` prints the package version. The short
|
|
32
|
+
forms of these options are `-h` and `-v`.
|
|
33
|
+
|
|
34
|
+
## stillwind fmt
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
vp exec stillwind fmt
|
|
38
|
+
vp exec stillwind fmt --check
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`fmt` sorts utilities with the configured theme and
|
|
42
|
+
[`sort` options](configuration.md#sorting), and saves the changed files. It keeps
|
|
43
|
+
the source layout and the spelling of each token. Lint severity and suppression
|
|
44
|
+
comments do not affect `fmt`.
|
|
45
|
+
|
|
46
|
+
`fmt` does not change whitespace. To format whitespace too, see
|
|
47
|
+
[Formatters](formatters.md).
|
|
48
|
+
|
|
49
|
+
| Option | Effect |
|
|
50
|
+
| --------- | ------------------------------------------------------- |
|
|
51
|
+
| `--check` | Reports the files that need sorting, and saves no files |
|
|
52
|
+
|
|
53
|
+
`fmt` also accepts the [shared options](#shared-options) and
|
|
54
|
+
[globs](#select-files).
|
|
55
|
+
|
|
56
|
+
Text output shows a status for each listed file and a summary.
|
|
57
|
+
|
|
58
|
+
## stillwind lint
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
vp exec stillwind lint
|
|
62
|
+
vp exec stillwind lint --fix
|
|
63
|
+
vp exec stillwind lint --max-warnings 0
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`lint` reports findings and saves no files. Text output shows a `help:` message when
|
|
67
|
+
a finding has a suggested edit. Not every suggested edit is an automatic fix.
|
|
68
|
+
|
|
69
|
+
| Option | Effect |
|
|
70
|
+
| -------------------- | --------------------------------------------------------------------- |
|
|
71
|
+
| `--fix` | Applies the enabled automatic fixes, and saves the changed files |
|
|
72
|
+
| `--quiet` | Hides warnings, and keeps their count in the summary |
|
|
73
|
+
| `--max-warnings <n>` | Fails when the number of warnings exceeds `n`, a non-negative integer |
|
|
74
|
+
|
|
75
|
+
`lint` also accepts the [shared options](#shared-options) and
|
|
76
|
+
[globs](#select-files).
|
|
77
|
+
|
|
78
|
+
`--fix` respects suppression comments. It sorts utilities only when
|
|
79
|
+
[prefer-sorted-utilities](lints/prefer-sorted-utilities.md) is enabled. It
|
|
80
|
+
repeats until the files stop changing, with at most ten changing passes per file.
|
|
81
|
+
Findings and the exit code describe the files after the last pass.
|
|
82
|
+
|
|
83
|
+
`--max-warnings` counts distinct warnings in each project, including warnings that
|
|
84
|
+
`--quiet` hides. When hidden warnings exceed the limit, the CLI still prints the
|
|
85
|
+
reason for the failure.
|
|
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
|
+
|
|
180
|
+
## stillwind lsp
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
vp exec stillwind lsp --stdio
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`lsp` starts the [language server](editors.md#other-editors) over stdin and
|
|
187
|
+
stdout. `--stdio` is required, and stdout carries only protocol messages. `lsp`
|
|
188
|
+
accepts `--config`, but no globs.
|
|
189
|
+
|
|
190
|
+
## Shared options
|
|
191
|
+
|
|
192
|
+
`fmt`, `lint`, `inspect`, `theme`, `utilities`, and `variants` accept these options:
|
|
193
|
+
|
|
194
|
+
| Option | Effect |
|
|
195
|
+
| ----------------------- | --------------------------------------------------- |
|
|
196
|
+
| `-c`, `--config <path>` | Uses this [configuration file](#select-files) |
|
|
197
|
+
| `--format <format>` | Selects the [output format](#output-formats) |
|
|
198
|
+
| `--color <mode>` | Controls [colors](#colors-and-links) |
|
|
199
|
+
| `--hyperlinks <mode>` | Controls [links to source files](#colors-and-links) |
|
|
200
|
+
|
|
201
|
+
An unknown option, a missing value, or an unsupported value returns exit code `2`.
|
|
202
|
+
|
|
203
|
+
## Select files
|
|
204
|
+
|
|
205
|
+
The CLI searches upward from the working directory for `stillwind.config.*`. In each
|
|
206
|
+
directory, it tries the extensions `ts`, `mts`, `cts`, `js`, `mjs`, `cjs`, and `json`
|
|
207
|
+
in that order. `--config` selects a file directly.
|
|
208
|
+
|
|
209
|
+
The CLI checks every file that `files` selects in each project, including files that
|
|
210
|
+
your application never imports. It can read other imported files for analysis, but
|
|
211
|
+
it does not change them.
|
|
212
|
+
|
|
213
|
+
Globs narrow this selection to some of these files. A glob is relative to each project
|
|
214
|
+
root, and it cannot add files outside `files`. You can pass several globs:
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
vp exec stillwind lint 'src/**/*.tsx' 'src/**/*.css'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
A leading `./` is accepted. An absolute path selects that file when `files` includes
|
|
221
|
+
it. When nothing matches, the CLI returns exit code `2`.
|
|
222
|
+
|
|
223
|
+
## Saving files
|
|
224
|
+
|
|
225
|
+
`fmt` and `lint --fix` work out the changes for all selected files before they save
|
|
226
|
+
the first file. The CLI then saves only the files whose content changed, so
|
|
227
|
+
modification times of other files stay the same.
|
|
228
|
+
|
|
229
|
+
Outside edited ranges, UTF-8 BOMs, line endings, and trailing newlines stay intact.
|
|
230
|
+
Files must contain valid UTF-8.
|
|
231
|
+
|
|
232
|
+
When something fails:
|
|
233
|
+
|
|
234
|
+
- A file that cannot be read, analyzed, or rewritten stays unchanged. The CLI
|
|
235
|
+
continues with the other files, even after a saving failure.
|
|
236
|
+
- A file that changed while the CLI worked is rejected and stays as it is.
|
|
237
|
+
- A configuration or CSS failure affects every file that needs that configuration
|
|
238
|
+
or CSS.
|
|
239
|
+
- When projects overlap, every project that owns a file must produce the same final
|
|
240
|
+
text.
|
|
241
|
+
|
|
242
|
+
The CLI reports all failures and all saved files, and it returns exit code `2`.
|
|
243
|
+
|
|
244
|
+
## Exit codes
|
|
245
|
+
|
|
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 |
|
|
251
|
+
|
|
252
|
+
Code `2` takes priority over code `1`.
|
|
253
|
+
|
|
254
|
+
## Output formats
|
|
255
|
+
|
|
256
|
+
| Format | Output |
|
|
257
|
+
| -------- | ------------------------------------------------------------------------------------- |
|
|
258
|
+
| `text` | Messages for reading in a terminal; the default outside GitHub Actions |
|
|
259
|
+
| `github` | Annotations that link findings to files; the default when `GITHUB_ACTIONS=true` |
|
|
260
|
+
| `json` | [One JSON object](#json-output) for scripts and AI agents |
|
|
261
|
+
| `files` | One path per line for each file that `fmt` changes or needs to change; only for `fmt` |
|
|
262
|
+
|
|
263
|
+
Results use stdout, and execution failures in `text` and `files` formats use stderr.
|
|
264
|
+
Configuration logs use stderr in every format. Only `text` output contains colors
|
|
265
|
+
and links.
|
|
266
|
+
|
|
267
|
+
### Positions and paths
|
|
268
|
+
|
|
269
|
+
`text` and `github` output count lines and columns from one. Columns count UTF-16
|
|
270
|
+
code units.
|
|
271
|
+
|
|
272
|
+
`text` paths are relative to the working directory. `github` paths are relative to
|
|
273
|
+
`GITHUB_WORKSPACE`, or to the working directory when that variable is not set.
|
|
274
|
+
A path on another filesystem volume stays absolute.
|
|
275
|
+
|
|
276
|
+
### Source excerpts
|
|
277
|
+
|
|
278
|
+
A finding at a source range shows a source excerpt, related locations, notes, and
|
|
279
|
+
suggestions. Excerpts show tabs as four spaces, and they align wide characters and
|
|
280
|
+
emoji. A long range shows its first four lines.
|
|
281
|
+
|
|
282
|
+
A finding about a whole document has no position or excerpt. The CLI also omits the
|
|
283
|
+
excerpt when it cannot read the source, or when the source changed after the
|
|
284
|
+
analysis.
|
|
285
|
+
|
|
286
|
+
## Colors and links
|
|
287
|
+
|
|
288
|
+
`--color` and `--hyperlinks` accept `auto`, `always`, and `never`. `always` and
|
|
289
|
+
`never` ignore the environment.
|
|
290
|
+
|
|
291
|
+
With `--color auto`, the CLI uses colors in terminals and supported CI logs. It
|
|
292
|
+
respects `NO_COLOR`, `FORCE_COLOR`, and `TERM=dumb`.
|
|
293
|
+
|
|
294
|
+
`--hyperlinks` controls OSC 8 links, which open local source files from the
|
|
295
|
+
terminal. With `auto`, the CLI uses them in recognized terminals, including VS Code
|
|
296
|
+
and Windows Terminal, and not in CI or redirected output. Terminals without OSC 8
|
|
297
|
+
support can still detect the printed `path:line:column` locations.
|
|
298
|
+
|
|
299
|
+
## JSON output
|
|
300
|
+
|
|
301
|
+
`--format json` prints one object with the same fields in every case, including
|
|
302
|
+
failures:
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"command": "lint",
|
|
307
|
+
"config": "/project/stillwind.config.ts",
|
|
308
|
+
"diagnostics": [],
|
|
309
|
+
"failures": [],
|
|
310
|
+
"changed": [],
|
|
311
|
+
"previews": [],
|
|
312
|
+
"tokens": [],
|
|
313
|
+
"candidates": [],
|
|
314
|
+
"unmatched": [],
|
|
315
|
+
"summary": {
|
|
316
|
+
"files": 1,
|
|
317
|
+
"errors": 0,
|
|
318
|
+
"warnings": 0,
|
|
319
|
+
"failures": 0,
|
|
320
|
+
"changed": 0,
|
|
321
|
+
"previews": 0,
|
|
322
|
+
"invalidPreviews": 0,
|
|
323
|
+
"tokens": 0,
|
|
324
|
+
"candidates": 0,
|
|
325
|
+
"invalidCandidates": 0,
|
|
326
|
+
"unmatched": 0,
|
|
327
|
+
"suggestions": 0,
|
|
328
|
+
"warningLimitExceeded": false
|
|
329
|
+
},
|
|
330
|
+
"exitCode": 0
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
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) |
|
|
347
|
+
|
|
348
|
+
Each diagnostic contains `project`, a zero-based project index, and `report`. The
|
|
349
|
+
report contains the message, its locations, notes, and suggested edits.
|
|
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
|
+
|
|
356
|
+
Each failure contains `message` and `details`, and it can contain `project` and
|
|
357
|
+
`file`. `details` lists the dependency problems that caused the failure.
|
|
358
|
+
|
|
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
|
|
375
|
+
positions, and their ends are exclusive.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Stylesheets"
|
|
3
|
+
description: "See which CSS files the stillwind package provides, how to import them separately, and which optional files change built-in utilities."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Stylesheets
|
|
7
|
+
|
|
8
|
+
Most projects need one line:
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
@import "stillwind";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This page lists the CSS files behind that import. Read it when you leave out part
|
|
15
|
+
of the default stylesheet or add an optional file.
|
|
16
|
+
|
|
17
|
+
## Stylesheets of the package
|
|
18
|
+
|
|
19
|
+
| Import | Content |
|
|
20
|
+
| ------------------------- | -------------------------------------------------------- |
|
|
21
|
+
| `stillwind` | All of the files below except the optional ones |
|
|
22
|
+
| `stillwind/theme.css` | Theme tokens |
|
|
23
|
+
| `stillwind/preflight.css` | The reset of default element styles |
|
|
24
|
+
| `stillwind/utilities.css` | The slot where compiled utility rules go |
|
|
25
|
+
| `stillwind/builtins.css` | Built-in utilities and variants |
|
|
26
|
+
| `stillwind/templates.css` | Output templates of `style.css()` |
|
|
27
|
+
| `stillwind/logical/*.css` | Optional: logical properties for built-in axis utilities |
|
|
28
|
+
|
|
29
|
+
## Import the files separately
|
|
30
|
+
|
|
31
|
+
`@import "stillwind"` has the same effect as these lines:
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
@layer properties, theme, base, components, utilities;
|
|
35
|
+
|
|
36
|
+
@import "stillwind/theme.css" layer(theme);
|
|
37
|
+
@import "stillwind/preflight.css" layer(base);
|
|
38
|
+
@import "stillwind/utilities.css" layer(utilities);
|
|
39
|
+
@import "stillwind/builtins.css";
|
|
40
|
+
@import "stillwind/templates.css";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Write the `@layer` statement and keep the `layer()` assignments when you remove a
|
|
44
|
+
line. They decide how these files compete with the rest of your CSS. For example,
|
|
45
|
+
[Migrating from CSS](../guides/migrating-from-css.md) leaves out `preflight.css`
|
|
46
|
+
until the old styles are gone.
|
|
47
|
+
|
|
48
|
+
## Optional stylesheets
|
|
49
|
+
|
|
50
|
+
An optional stylesheet changes built-in utilities, so `stillwind` does not include
|
|
51
|
+
it. The default definitions stay compatible with Tailwind CSS.
|
|
52
|
+
|
|
53
|
+
Import an optional stylesheet after `stillwind` or `stillwind/builtins.css`. It
|
|
54
|
+
replaces only the definitions that come before it:
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
@import "stillwind";
|
|
58
|
+
@import "stillwind/logical/overflow.css";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Logical axis utilities
|
|
62
|
+
|
|
63
|
+
The files in `stillwind/logical/` make built-in axis utilities follow the writing
|
|
64
|
+
direction, as `px-*` and `py-*` do. Your class names stay the same, and each file
|
|
65
|
+
changes only its own utilities. Import the files that you need:
|
|
66
|
+
|
|
67
|
+
| File | Utility | Without the file | With the file |
|
|
68
|
+
| ---------------- | ---------------- | --------------------------------- | -------------------------------------------- |
|
|
69
|
+
| `overflow.css` | `overflow-x-*` | `overflow-x` | `overflow-inline` |
|
|
70
|
+
| `overflow.css` | `overflow-y-*` | `overflow-y` | `overflow-block` |
|
|
71
|
+
| `overscroll.css` | `overscroll-x-*` | `overscroll-behavior-x` | `overscroll-behavior-inline` |
|
|
72
|
+
| `overscroll.css` | `overscroll-y-*` | `overscroll-behavior-y` | `overscroll-behavior-block` |
|
|
73
|
+
| `divide.css` | `divide-y-*` | `border-top-*`, `border-bottom-*` | `border-block-start-*`, `border-block-end-*` |
|
|
74
|
+
| `snap.css` | `snap-x` | `scroll-snap-type: x` | `scroll-snap-type: inline` |
|
|
75
|
+
| `snap.css` | `snap-y` | `scroll-snap-type: y` | `scroll-snap-type: block` |
|
|
76
|
+
| `resize.css` | `resize-x` | `resize: horizontal` | `resize: inline` |
|
|
77
|
+
| `resize.css` | `resize-y` | `resize: vertical` | `resize: block` |
|
|
78
|
+
|
|
79
|
+
In a horizontal writing mode, the result is the same. In a vertical writing mode,
|
|
80
|
+
the utilities change axes, so `overflow-x-auto` scrolls vertically.
|
|
81
|
+
|
|
82
|
+
[prefer-logical-properties](../lints/prefer-logical-properties.md) does not report
|
|
83
|
+
the `overflow`, `overscroll`, and `divide` utilities after you import their files.
|
|
84
|
+
It still reports arbitrary properties such as `[overflow-x:auto]`, because these
|
|
85
|
+
files do not change them. Their logical forms, such as `[overflow-inline:auto]`,
|
|
86
|
+
are available.
|
|
87
|
+
|
|
88
|
+
The utilities keep their cascade order, so `overflow-x-auto` still overrides
|
|
89
|
+
`overflow-hidden`.
|
package/docs/configuration.md
CHANGED
|
@@ -23,7 +23,39 @@ export default defineConfig({
|
|
|
23
23
|
|
|
24
24
|
Each entry in `projects` selects a stylesheet and the files that belong to it.
|
|
25
25
|
Most applications need one project. A monorepo can list one project for each
|
|
26
|
-
application
|
|
26
|
+
application, or keep a configuration file in each package and reference those
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
## Reference other configuration files
|
|
30
|
+
|
|
31
|
+
A string in `projects` references other configuration files, relative to the
|
|
32
|
+
file that declares it. Strings and project objects can appear in the same list.
|
|
33
|
+
|
|
34
|
+
```ts title="stillwind.config.ts"
|
|
35
|
+
import { defineConfig } from "stillwind/config";
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
projects: ["apps/*", "!apps/legacy", "packages/ui", "tools/site.stillwind.ts"],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Entry | Selects |
|
|
43
|
+
| ------------------------- | ------------------------------------------------------------------------ |
|
|
44
|
+
| `tools/site.stillwind.ts` | That configuration file, with any name |
|
|
45
|
+
| `packages/ui` | The `stillwind.config.*` file in that directory |
|
|
46
|
+
| `apps/*` | `stillwind.config.*` files that the glob matches or finds in directories |
|
|
47
|
+
| `!apps/legacy` | Removes a path or a glob from the matches of glob entries |
|
|
48
|
+
|
|
49
|
+
A path or a directory that is missing causes an error. A glob skips directories
|
|
50
|
+
that have no configuration file, and it does not search `node_modules` or `.git`.
|
|
51
|
+
Stillwind reports an error only when no project remains in the list.
|
|
52
|
+
|
|
53
|
+
A relative `root` in a referenced file uses the directory of that file, so
|
|
54
|
+
packages keep working on their own. Referenced files must list project objects
|
|
55
|
+
because references do not nest. Project names must be unique across all files.
|
|
56
|
+
|
|
57
|
+
Build tools watch the referenced files, but they do not notice a new file that a
|
|
58
|
+
glob would match. Restart the build after you add a package.
|
|
27
59
|
|
|
28
60
|
## Where Stillwind finds the file
|
|
29
61
|
|
|
@@ -31,6 +63,11 @@ The build integration searches from the application root upward. The CLI and
|
|
|
31
63
|
the editor search from the working directory or the workspace upward. The file
|
|
32
64
|
in the nearest directory wins.
|
|
33
65
|
|
|
66
|
+
The editor also searches from each file that you open. A monorepo therefore
|
|
67
|
+
works without a configuration file at its root: when no open project includes
|
|
68
|
+
the file, the editor uses the nearest configuration file inside the workspace.
|
|
69
|
+
Setting an explicit configuration file turns this search off.
|
|
70
|
+
|
|
34
71
|
Stillwind accepts `stillwind.config.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`,
|
|
35
72
|
and `.json`. In one directory, it uses the first of these that exists.
|
|
36
73
|
|
|
@@ -74,7 +111,7 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
74
111
|
| `tailwind` | A Tailwind configuration object; see [Migrating from Tailwind CSS](guides/migrating-from-tailwind.md#move-configuration) |
|
|
75
112
|
| `plugins` | Plugin objects for the `@plugin` rules of your stylesheet |
|
|
76
113
|
| `rootFontSize` | Pixels per `rem`, used by lint fixes and editor previews; defaults to 16 |
|
|
77
|
-
| `useCssIf` | `true` lets runtime
|
|
114
|
+
| `useCssIf` | `true` lets [runtime conditions](guides/runtime-conditions.md) use the native CSS `if()` function; defaults to `false` |
|
|
78
115
|
|
|
79
116
|
### Generated names
|
|
80
117
|
|
|
@@ -90,9 +127,9 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
90
127
|
|
|
91
128
|
### Editor
|
|
92
129
|
|
|
93
|
-
| Field | Value
|
|
94
|
-
| --------- |
|
|
95
|
-
| `preview` | Which comments CSS previews show: `themeValues`, `pixelEquivalents`, and `colorEquivalents` |
|
|
130
|
+
| Field | Value |
|
|
131
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
132
|
+
| `preview` | Which comments [CSS previews](editors.md#settings) show: `themeValues`, `pixelEquivalents`, and `colorEquivalents` |
|
|
96
133
|
|
|
97
134
|
The [shared configuration API](https://github.com/SegaraRai/stillwind/blob/main/packages/config/src/compiler.ts)
|
|
98
135
|
describes the remaining fields for custom integrations, such as `sources`,
|
|
@@ -255,7 +292,8 @@ comment that suppresses nothing.
|
|
|
255
292
|
|
|
256
293
|
## Sorting
|
|
257
294
|
|
|
258
|
-
The `sort` field controls where `stillwind fmt
|
|
295
|
+
The `sort` field controls where `stillwind fmt`, the editor, and the
|
|
296
|
+
[Prettier plugin](formatters.md#prettier) sort utilities:
|
|
259
297
|
|
|
260
298
|
| Option | Sorts | Default |
|
|
261
299
|
| ----------------- | -------------------------------------------------- | ------- |
|
package/docs/editors.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Editors"
|
|
3
|
+
description: "Install the Stillwind extension, sort and fix on save, and connect other editors to the language server."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Editors
|
|
7
|
+
|
|
8
|
+
The Stillwind language server shows diagnostics, generated CSS, and completion
|
|
9
|
+
from the active design system while you edit. It reads the same
|
|
10
|
+
`stillwind.config.ts` as the CLI and the build, and it checks unsaved files too.
|
|
11
|
+
Create that file with [Getting started](index.md) first.
|
|
12
|
+
|
|
13
|
+
## VS Code
|
|
14
|
+
|
|
15
|
+
Install **Stillwind** from the
|
|
16
|
+
[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=stillwind.stillwind)
|
|
17
|
+
or [Open VSX](https://open-vsx.org/extension/stillwind/stillwind). An editor that
|
|
18
|
+
installs extensions from Open VSX uses the same package.
|
|
19
|
+
|
|
20
|
+
The extension needs a trusted workspace, because it runs your project
|
|
21
|
+
configuration as JavaScript.
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- Hover over utilities, `style()` calls, or bound variables to see the generated CSS.
|
|
26
|
+
- Complete utilities, variants, and theme values.
|
|
27
|
+
- Complete quoted `@plugin` paths, and follow links to their modules.
|
|
28
|
+
- See colors, and open color pickers in utilities and theme references.
|
|
29
|
+
- Apply compiler Quick Fixes.
|
|
30
|
+
- Run **Stillwind: Sort Utilities**.
|
|
31
|
+
|
|
32
|
+
Stylesheets have completion for Stillwind at-rules, and VS Code's CSS service does
|
|
33
|
+
not report these at-rules as unknown.
|
|
34
|
+
|
|
35
|
+
### Language server version
|
|
36
|
+
|
|
37
|
+
Desktop VS Code runs the `@stillwind/cli` version that the workspace installs, so
|
|
38
|
+
editor diagnostics match the compiler of that version. Install
|
|
39
|
+
[the CLI](cli.md) in the project to get this match.
|
|
40
|
+
|
|
41
|
+
The extension uses its bundled language server when the workspace has no CLI, or
|
|
42
|
+
when the CLI fails to start. The **Stillwind** output channel shows which server
|
|
43
|
+
is running.
|
|
44
|
+
|
|
45
|
+
### Settings
|
|
46
|
+
|
|
47
|
+
| Setting | Value |
|
|
48
|
+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `stillwind.configFile` | A configuration path relative to the workspace root; empty searches for `stillwind.config.*` |
|
|
50
|
+
| `stillwind.completion.registryDirectives` | `true` suggests [registry directives](at-rules/registry-directives.md) in utility libraries |
|
|
51
|
+
|
|
52
|
+
Run **Stillwind: Restart Language Server** to reload configuration and dependencies.
|
|
53
|
+
|
|
54
|
+
The `preview` field of each project in `stillwind.config.ts` controls the comments
|
|
55
|
+
after values in CSS previews:
|
|
56
|
+
|
|
57
|
+
| Option | Comment |
|
|
58
|
+
| ------------------ | ------------------------------------------------------------ |
|
|
59
|
+
| `themeValues` | Resolved theme values and evaluated `calc()` results |
|
|
60
|
+
| `pixelEquivalents` | Pixel values for `rem` |
|
|
61
|
+
| `colorEquivalents` | Hexadecimal sRGB colors; `"exact"` omits colors outside sRGB |
|
|
62
|
+
|
|
63
|
+
All three are enabled by default. With the default `colorEquivalents` value,
|
|
64
|
+
`"approximate"`, a `≈` marks colors that the preview maps into sRGB. `false` turns
|
|
65
|
+
off an option.
|
|
66
|
+
|
|
67
|
+
### Sort and fix on save
|
|
68
|
+
|
|
69
|
+
Use a [document formatter](formatters.md) for layout and whitespace, and add
|
|
70
|
+
Stillwind's Code Actions:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"editor.formatOnSave": true,
|
|
75
|
+
"editor.codeActionsOnSave": {
|
|
76
|
+
"source.fixAll.stillwind": "explicit",
|
|
77
|
+
"source.sort.stillwind": "explicit"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`source.fixAll.stillwind` applies the enabled lint fixes and respects suppression
|
|
83
|
+
comments. `source.sort.stillwind` sorts whatever the lint severity is.
|
|
84
|
+
|
|
85
|
+
`lint: false` in the project disables lint rules and fixes. `sort: false` also
|
|
86
|
+
disables explicit sorting commands. The
|
|
87
|
+
[`sort` field](configuration.md#sorting) selects what the editor sorts.
|
|
88
|
+
|
|
89
|
+
### Web VS Code
|
|
90
|
+
|
|
91
|
+
The Web extension always uses the bundled language server, and it needs a host with
|
|
92
|
+
cross-origin isolation. These limits apply:
|
|
93
|
+
|
|
94
|
+
- Project configuration can import browser-compatible modules. Node built-ins are
|
|
95
|
+
not available.
|
|
96
|
+
- The workspace filesystem must be able to read the dependencies.
|
|
97
|
+
- The default browser provider supports JS, JSX, TS, and TSX. Vue, Svelte, and
|
|
98
|
+
Astro files need a custom source or projection provider.
|
|
99
|
+
|
|
100
|
+
## Other editors
|
|
101
|
+
|
|
102
|
+
An editor with a Language Server Protocol client can start the language server from
|
|
103
|
+
the CLI. Install [the CLI](cli.md) in the project, and run this command in the
|
|
104
|
+
workspace:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
stillwind lsp --stdio
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The server discovers the configuration from each workspace folder.
|