stillwind 0.5.0 → 0.6.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.
Files changed (110) hide show
  1. package/docs/at-rules/apply.md +3 -3
  2. package/docs/at-rules/custom-variant.md +7 -5
  3. package/docs/at-rules/index.md +28 -28
  4. package/docs/at-rules/plugin.md +5 -5
  5. package/docs/at-rules/registry-directives.md +13 -12
  6. package/docs/at-rules/slot.md +3 -3
  7. package/docs/at-rules/stillwind-css-template.md +8 -7
  8. package/docs/at-rules/stillwind-property.md +7 -6
  9. package/docs/at-rules/stillwind-registry.md +13 -12
  10. package/docs/at-rules/stillwind-require-properties.md +2 -2
  11. package/docs/at-rules/stillwind-slot.md +12 -12
  12. package/docs/at-rules/stillwind-undef-arbitrary-property.md +3 -3
  13. package/docs/at-rules/stillwind-undef-utility.md +10 -9
  14. package/docs/at-rules/stillwind-undef-variant.md +5 -5
  15. package/docs/at-rules/theme.md +6 -6
  16. package/docs/at-rules/utility.md +17 -12
  17. package/docs/at-rules/variant.md +11 -7
  18. package/docs/cli.md +5 -5
  19. package/docs/concepts/how-styles-compile.md +3 -3
  20. package/docs/concepts/stylesheets.md +30 -1
  21. package/docs/configuration.md +8 -8
  22. package/docs/editors.md +2 -2
  23. package/docs/errors/SW10004.md +8 -7
  24. package/docs/errors/SW10005.md +4 -4
  25. package/docs/errors/SW14002.md +3 -2
  26. package/docs/errors/SW14003.md +5 -3
  27. package/docs/errors/SW14004.md +3 -3
  28. package/docs/errors/SW14005.md +5 -4
  29. package/docs/errors/SW14008.md +6 -4
  30. package/docs/errors/SW90001.md +1 -1
  31. package/docs/errors/SW90006.md +3 -1
  32. package/docs/errors/index.md +6 -6
  33. package/docs/guides/animations.md +10 -8
  34. package/docs/guides/design-systems.md +2 -1
  35. package/docs/guides/element-relationships.md +17 -15
  36. package/docs/guides/lint-adoption.md +2 -1
  37. package/docs/guides/migrating-from-css.md +8 -5
  38. package/docs/guides/migrating-from-tailwind.md +101 -13
  39. package/docs/guides/recommended-practices.md +20 -17
  40. package/docs/guides/responsive-styles.md +9 -6
  41. package/docs/guides/reusable-styles.md +3 -3
  42. package/docs/guides/runtime-conditions.md +10 -5
  43. package/docs/guides/style.md +3 -3
  44. package/docs/guides/tailwind-compatibility.md +15 -15
  45. package/docs/guides/view-transitions.md +17 -15
  46. package/docs/guides/web-components.md +4 -4
  47. package/docs/index.md +4 -2
  48. package/docs/integrations.md +64 -0
  49. package/docs/lints/ambiguous-style-base-order.md +3 -3
  50. package/docs/lints/bypassed-undefinition.md +4 -4
  51. package/docs/lints/conflicting-provider-properties.md +4 -3
  52. package/docs/lints/duplicate-definition.md +2 -1
  53. package/docs/lints/duplicate-view-transition-name.md +4 -2
  54. package/docs/lints/ignored-definition-condition.md +4 -3
  55. package/docs/lints/ignored-tailwind-feature.md +1 -1
  56. package/docs/lints/implicit-nesting-selector.md +4 -3
  57. package/docs/lints/index.md +38 -38
  58. package/docs/lints/ineffective-anchor-scope.md +4 -2
  59. package/docs/lints/invalid-animation-option.md +3 -3
  60. package/docs/lints/invalid-css-directive.md +10 -2
  61. package/docs/lints/invalid-css-import.md +8 -0
  62. package/docs/lints/invalid-css-input.md +5 -4
  63. package/docs/lints/invalid-cva-config.md +16 -4
  64. package/docs/lints/invalid-cva-input.md +11 -6
  65. package/docs/lints/invalid-keyframes-definition.md +1 -1
  66. package/docs/lints/invalid-keyframes-variant.md +17 -9
  67. package/docs/lints/invalid-marker-use.md +1 -1
  68. package/docs/lints/invalid-media-query.md +8 -6
  69. package/docs/lints/invalid-ref-input.md +6 -5
  70. package/docs/lints/invalid-rule-group-input.md +13 -6
  71. package/docs/lints/invalid-style-input.md +1 -1
  72. package/docs/lints/invalid-theme-reference.md +2 -2
  73. package/docs/lints/invalid-view-transition-definition.md +1 -1
  74. package/docs/lints/invalid-view-transition-use.md +1 -1
  75. package/docs/lints/invalid-view-transition-variant.md +3 -3
  76. package/docs/lints/mismatched-framework-import.md +4 -4
  77. package/docs/lints/missing-document-target.md +1 -1
  78. package/docs/lints/missing-ref-attachment.md +6 -4
  79. package/docs/lints/missing-view-transition-name.md +7 -5
  80. package/docs/lints/no-arbitrary-breakpoints.md +1 -1
  81. package/docs/lints/no-class-property.md +4 -3
  82. package/docs/lints/prefer-canonical-utilities.md +3 -2
  83. package/docs/lints/prefer-direct-styling.md +2 -2
  84. package/docs/lints/prefer-variant-directive.md +8 -8
  85. package/docs/lints/split-view-transition-class.md +5 -4
  86. package/docs/lints/suspending-macro-argument.md +2 -2
  87. package/docs/lints/unknown-utility.md +2 -1
  88. package/docs/lints/unknown-variant.md +2 -2
  89. package/docs/lints/unverified-style-base.md +4 -3
  90. package/docs/macros/anchor-scope.md +13 -10
  91. package/docs/macros/css.md +11 -9
  92. package/docs/macros/cva.md +9 -8
  93. package/docs/macros/index.md +10 -10
  94. package/docs/macros/keyframes.md +5 -4
  95. package/docs/macros/media.md +6 -5
  96. package/docs/macros/ref/as-anchor.md +12 -7
  97. package/docs/macros/ref/as-container.md +7 -4
  98. package/docs/macros/ref/at.md +10 -9
  99. package/docs/macros/ref/condition.md +1 -1
  100. package/docs/macros/ref/in.md +6 -6
  101. package/docs/macros/ref/index.md +11 -11
  102. package/docs/macros/ref/position-anchor.md +7 -4
  103. package/docs/macros/style.md +3 -3
  104. package/docs/macros/view-transition.md +13 -12
  105. package/docs/plugins/iconify.md +95 -85
  106. package/docs/plugins/index.md +3 -3
  107. package/docs/utilities-and-variants.md +4 -4
  108. package/docs/why.md +2 -2
  109. package/package.json +29 -5
  110. package/skills/migrate-to-stillwind/SKILL.md +7 -2
@@ -7,7 +7,7 @@ description: "Move a Tailwind CSS v4 project to Stillwind, from the stylesheet a
7
7
 
8
8
  You want to move an existing Tailwind CSS v4 project to Stillwind. Your utilities,
9
9
  variants, theme, and plugins keep working. What changes is where you write them:
10
- in `style()` calls instead of `className` strings.
10
+ in [`style()`](style.md) calls instead of `className` strings.
11
11
  [Tailwind CSS compatibility](tailwind-compatibility.md) lists the tested
12
12
  plugins and the differences.
13
13
 
@@ -28,14 +28,21 @@ In your stylesheet, replace `@import "tailwindcss"` with `@import "stillwind"`:
28
28
  }
29
29
  ```
30
30
 
31
- Keep your `@theme`, `@utility`, `@custom-variant`, `@variant`, `@apply`, and
32
- `@plugin` rules.
31
+ Keep your [`@theme`](../at-rules/theme.md), [`@utility`](../at-rules/utility.md),
32
+ [`@custom-variant`](../at-rules/custom-variant.md), [`@variant`](../at-rules/variant.md),
33
+ [`@apply`](../at-rules/apply.md), and [`@plugin`](../at-rules/plugin.md) rules.
33
34
 
34
35
  Replace the Tailwind build plugin, such as `@tailwindcss/vite`, with the
35
36
  Stillwind integration. Then create `stillwind.config.ts`, as described in
36
37
  [Getting started](../index.md#configure-the-project), and set up your framework, as
37
38
  described in [Framework integrations](../integrations.md).
38
39
 
40
+ With Tailwind, your code or framework configuration imports the stylesheet, for
41
+ example with `import "./app.css"` or in Starlight's `customCss`. With Vite and the
42
+ frameworks that run on it, remove these imports. The integration reads the
43
+ stylesheet that `css` selects and adds the compiled CSS to the page. If the
44
+ import remains, the page also receives the raw stylesheet.
45
+
39
46
  ## Move classes into style()
40
47
 
41
48
  Replace each `className` string with a `style()` call that you spread onto the
@@ -58,14 +65,14 @@ write a one-off codemod for your repository that converts them in one pass.
58
65
 
59
66
  ## Replace class helpers
60
67
 
61
- `style()` and `style.cva()` replace the libraries that Tailwind projects use to
62
- build class strings:
68
+ [`style()`](../macros/style.md) and [`style.cva()`](../macros/cva.md) replace
69
+ the libraries that Tailwind projects use to build class strings:
63
70
 
64
- | Library | Stillwind |
65
- | ----------------------------------- | ----------------------------------------- |
66
- | `clsx`, `classnames` | `style()` with conditions |
67
- | `tailwind-merge` | Compose a base with new utilities |
68
- | `cva` from class-variance-authority | `style.cva()` with the same configuration |
71
+ | Library | Stillwind |
72
+ | ------------------------------------------------------------------------------------------------- | ----------------------------------------- |
73
+ | [`clsx`](https://github.com/lukeed/clsx), [`classnames`](https://github.com/JedWatson/classnames) | `style()` with conditions |
74
+ | [`tailwind-merge`](https://github.com/dcastil/tailwind-merge) | Compose a base with new utilities |
75
+ | `cva` from [Class Variance Authority](https://cva.style/) | `style.cva()` with the same configuration |
69
76
 
70
77
  ### clsx and classnames
71
78
 
@@ -123,8 +130,8 @@ export function Button({ tone }: VariantProps<typeof button>) {
123
130
  `variants`, `defaultVariants`, and `compoundVariants` work as in
124
131
  class-variance-authority. Write each option value as a plain utility string,
125
132
  without `&&` or a ternary. The props that the factory returns cannot be passed
126
- to `style()` as a base. The [style.cva() reference](../macros/cva.md) lists the
127
- other differences.
133
+ to `style()` as a base. The [`style.cva()` reference](../macros/cva.md) lists
134
+ the other differences.
128
135
 
129
136
  For new components, consider state variants and `data-*` attributes instead of
130
137
  options. See [Reusable styles](reusable-styles.md).
@@ -176,4 +183,85 @@ lists the packages that the test suite covers.
176
183
 
177
184
  Run the [CLI checks](lint-adoption.md) over the migrated files. They
178
185
  report utilities that Stillwind cannot resolve and Tailwind features that it
179
- ignores. Then test the production build and your pages in the browser.
186
+ ignores. Then test the production build, and compare your pages with the old
187
+ version as described in the next section.
188
+
189
+ ### Compare computed styles
190
+
191
+ A successful build and clean CLI checks do not prove that the pages look the
192
+ same. For example, a class outside `style()` gets no CSS, and no check reports
193
+ it. A diff of the generated CSS or HTML does not help either, because Stillwind
194
+ renames the classes and reorders the rules. Instead, compare the computed styles
195
+ of the migrated components in a build from before the migration and a build from
196
+ after it. The test suite checks plugins in the same way, as
197
+ [Tailwind CSS compatibility](tailwind-compatibility.md#how-stillwind-checks-compatibility)
198
+ describes.
199
+
200
+ 1. Build the project before and after the migration, and serve both builds.
201
+ 2. Open the same page in both builds, with the same viewport size, theme, and
202
+ other state.
203
+ 3. In each build, run the following function in the browser console. Pass a
204
+ selector that matches the root elements of the migrated components. In
205
+ Chrome DevTools, `copy(await snapshotStyles(".card"))` copies the result.
206
+ 4. Save the two results to files, and compare them with a diff tool, such as
207
+ `git diff --no-index before.txt after.txt`.
208
+
209
+ ```js
210
+ async function snapshotStyles(rootSelector) {
211
+ await document.fonts.ready;
212
+ // Finishing a transition can start another one in a descendant that
213
+ // inherits the value, so repeat until no animation runs.
214
+ for (let round = 0; round < 20; round++) {
215
+ document.documentElement.getBoundingClientRect();
216
+ const running = document
217
+ .getAnimations()
218
+ .filter((animation) => animation.playState === "running");
219
+ if (running.length === 0) {
220
+ break;
221
+ }
222
+ for (const animation of running) {
223
+ if (animation.effect.getComputedTiming().endTime === Infinity) {
224
+ animation.pause();
225
+ animation.currentTime = 0;
226
+ } else {
227
+ animation.finish();
228
+ }
229
+ }
230
+ }
231
+ const lines = [];
232
+ document.querySelectorAll(rootSelector).forEach((root, rootIndex) => {
233
+ [root, ...root.querySelectorAll("*")].forEach((element, index) => {
234
+ for (const pseudo of ["", "::before", "::after"]) {
235
+ const style = getComputedStyle(element, pseudo);
236
+ if (pseudo && style.content === "none") {
237
+ continue;
238
+ }
239
+ for (const name of [...style].filter((name) => !name.startsWith("--")).sort()) {
240
+ const value = style.getPropertyValue(name);
241
+ lines.push(`${rootIndex}.${index} ${element.localName}${pseudo} ${name}: ${value}`);
242
+ }
243
+ }
244
+ });
245
+ });
246
+ return lines.join("\n");
247
+ }
248
+ ```
249
+
250
+ Each line of the result contains the position of the element, the element or
251
+ pseudo-element, and one property with its value. The function finishes running
252
+ transitions and animations, and stops infinite animations at their start, so
253
+ a theme change just before the call does not leave intermediate values. It
254
+ skips custom properties, because their names usually change in a migration.
255
+
256
+ Repeat the comparison for each theme and for each breakpoint that the project
257
+ uses. Then review the differences:
258
+
259
+ - Some differences do not change the look. For example, when you move a margin
260
+ from one element to its neighbor, the lines of both elements differ, but the
261
+ layout stays the same.
262
+ - The function reads only the current state. To compare states such as `:hover`
263
+ and `:focus-visible`, force the state in the browser's developer tools, or
264
+ hover and focus the element with a browser automation tool such as Playwright.
265
+ - The function matches elements by their order inside each root. When the
266
+ migration adds or removes an element, the lines that follow it no longer
267
+ match, so compare that part by hand.
@@ -10,8 +10,8 @@ It also lists the mistakes that silently produce no CSS. The examples use React.
10
10
 
11
11
  ## Keep styles next to their elements
12
12
 
13
- Write the utilities in a `style()` call on the element that they style. When
14
- several places need the same styles, reuse them in this order:
13
+ Write the utilities in a [`style()`](style.md) call on the element that
14
+ they style. When several places need the same styles, reuse them in this order:
15
15
 
16
16
  1. Extract a component of your framework, and keep the `style()` call on its
17
17
  element. The styles stay next to the markup that they depend on.
@@ -74,8 +74,8 @@ for what the application needs.
74
74
 
75
75
  When an element's style depends on another element, such as a hovered parent, a
76
76
  sibling, a container, or an anchor, connect them with a ref from
77
- `style.ref()`. Do not use `group-*`, `peer-*`, named containers, or hand-written
78
- parent and sibling selectors:
77
+ [`style.ref()`](../macros/ref/index.md). Do not use `group-*`, `peer-*`, named
78
+ containers, or hand-written parent and sibling selectors:
79
79
 
80
80
  ```tsx
81
81
  import { style } from "stillwind/react";
@@ -97,11 +97,14 @@ containers, and anchors.
97
97
 
98
98
  ## Define animations in their components
99
99
 
100
- Define keyframes with [style.keyframes()](../macros/keyframes.md) and view
101
- transitions with [style.viewTransition()](../macros/view-transition.md) in the
102
- code that uses them. Do not add global `@keyframes` rules or fixed
103
- `view-transition-name` values. The macros generate unique names, so you can
104
- add, move, or remove a component without checking other code.
100
+ Define keyframes with [`style.keyframes()`](../macros/keyframes.md) and view
101
+ transitions with [`style.viewTransition()`](../macros/view-transition.md) in
102
+ the code that uses them. Do not add global
103
+ [`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
104
+ rules or fixed
105
+ [`view-transition-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-name)
106
+ values. The macros generate unique names, so you can add, move, or remove a
107
+ component without checking other code.
105
108
 
106
109
  ## Declare refs and animations in the smallest scope
107
110
 
@@ -219,8 +222,8 @@ from a long string.
219
222
 
220
223
  ## Keep values in the theme
221
224
 
222
- Define colors, spacing, and breakpoints as `@theme` tokens, and use the
223
- utilities that they add. Avoid arbitrary values such as `text-[#abcdef]` and
225
+ Define colors, spacing, and breakpoints as [`@theme`](../at-rules/theme.md) tokens, and
226
+ use the utilities that they add. Avoid arbitrary values such as `text-[#abcdef]` and
224
227
  `max-[768px]:`. [Design systems](design-systems.md) enables lint
225
228
  rules that report them.
226
229
 
@@ -258,7 +261,7 @@ Set `data-theme` on the root element, or on a container to theme part of the
258
261
  page. The utilities, such as `bg-surface`, stay the same in every theme.
259
262
 
260
263
  When a theme needs styles beyond its tokens, define a variant for it with
261
- [@custom-variant](../at-rules/custom-variant.md), and use the variant instead
264
+ [`@custom-variant`](../at-rules/custom-variant.md), and use the variant instead
262
265
  of a hand-written selector:
263
266
 
264
267
  ```css
@@ -268,7 +271,7 @@ of a hand-written selector:
268
271
  ## Use breakpoints from the theme in JavaScript
269
272
 
270
273
  When JavaScript needs a breakpoint, get its media query with
271
- [style.media()](../macros/media.md) instead of repeating the value:
274
+ [`style.media()`](../macros/media.md) instead of repeating the value:
272
275
 
273
276
  ```ts
274
277
  import { style } from "stillwind/react";
@@ -282,8 +285,8 @@ change. [Responsive styles](responsive-styles.md) shows more uses.
282
285
 
283
286
  ## Define utilities with @apply
284
287
 
285
- Write the body of a custom utility with `@apply`, and write its conditions as
286
- variants:
288
+ Write the body of a custom utility with [`@apply`](../at-rules/apply.md), and
289
+ write its conditions as variants:
287
290
 
288
291
  ```css
289
292
  @utility link {
@@ -295,14 +298,14 @@ Do not write selectors or media queries by hand. The variants follow your
295
298
  theme, and they avoid differences that are easy to miss. For example, the
296
299
  `hover:` variant applies only on devices that can hover, while a plain `:hover`
297
300
  rule stays active after a tap on a touch screen. Inside a style rule, use
298
- [@variant](../at-rules/variant.md) instead of a condition.
301
+ [`@variant`](../at-rules/variant.md) instead of a condition.
299
302
 
300
303
  ## Avoid separate CSS
301
304
 
302
305
  Write styles in `style()` calls and custom utilities, not in CSS files with
303
306
  your own class names. A custom utility works with every variant, such as
304
307
  `hover:link`, and a fixed class name does not. For a reusable condition, define
305
- a variant with [@custom-variant](../at-rules/custom-variant.md) instead of
308
+ a variant with [`@custom-variant`](../at-rules/custom-variant.md) instead of
306
309
  writing its selector in several rules.
307
310
 
308
311
  For HTML that you do not control, such as rendered Markdown, define the styles
@@ -52,13 +52,14 @@ export function Layout() {
52
52
 
53
53
  ## Use breakpoints in authored CSS
54
54
 
55
- In a CSS rule, nest `@variant` with the breakpoint name, as in the `.navigation`
56
- rule above. In an `@utility` definition, use the variant in `@apply` instead,
57
- such as `@apply inline:flex-row`.
55
+ In a CSS rule, nest [`@variant`](../at-rules/variant.md) with the breakpoint name,
56
+ as in the `.navigation` rule above. In an [`@utility`](../at-rules/utility.md)
57
+ definition, use the variant in [`@apply`](../at-rules/apply.md) instead, such as
58
+ `@apply inline:flex-row`.
58
59
 
59
60
  ## Use breakpoints in JavaScript
60
61
 
61
- `style.media()` returns the media query for a breakpoint name:
62
+ [`style.media()`](../macros/media.md) returns the media query for a breakpoint name:
62
63
 
63
64
  ```ts
64
65
  import { style } from "stillwind/react";
@@ -76,8 +77,10 @@ export function dispose() {
76
77
  ```
77
78
 
78
79
  The compiler replaces `style.media("sidebar")` with the query string, so the
79
- JavaScript always matches the CSS. `matchMedia()` is a browser API, so call it on
80
- the client. Remove the listener when its component unmounts.
80
+ JavaScript always matches the CSS.
81
+ [`matchMedia()`](https://developer.mozilla.org/docs/Web/API/Window/matchMedia)
82
+ is a browser API, so call it on the client. Remove the listener when its
83
+ component unmounts.
81
84
 
82
85
  To combine conditions, write them in one argument. To accept alternatives, pass
83
86
  several arguments:
@@ -12,8 +12,8 @@ which styles apply.
12
12
 
13
13
  ## Share a base style
14
14
 
15
- Store a `style()` result, and pass it to other `style()` calls. You can export
16
- the base and import it in other modules:
15
+ Store a [`style()`](style.md) result, and pass it to other `style()`
16
+ calls. You can export the base and import it in other modules:
17
17
 
18
18
  ```tsx
19
19
  import { style } from "stillwind/react";
@@ -107,4 +107,4 @@ set a custom property instead. See
107
107
  `style.cva()` accepts the configuration of `cva` from class-variance-authority.
108
108
  Use it to migrate existing CVA components. See
109
109
  [Replace class helpers](migrating-from-tailwind.md#replace-class-helpers)
110
- and the [style.cva() reference](../macros/cva.md).
110
+ and the [`style.cva()` reference](../macros/cva.md).
@@ -12,8 +12,10 @@ property reaches descendants through ordinary CSS inheritance.
12
12
  > **Experimental**
13
13
  >
14
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.
15
+ > that supports the CSS keyword
16
+ > [`revert-rule`](https://developer.mozilla.org/docs/Web/CSS/Reference/Values/revert-rule),
17
+ > which became Baseline in 2026. Check [Browser support](#browser-support)
18
+ > before you use it.
17
19
 
18
20
  ## Write a condition
19
21
 
@@ -69,7 +71,8 @@ In a stylesheet, write the same values yourself:
69
71
  ```
70
72
 
71
73
  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`,
74
+ CSS without `useCssIf`. Do not register a boolean custom property with
75
+ [`@property`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@property),
73
76
  because the registration changes its initial value.
74
77
 
75
78
  The browser evaluates the condition on the styled element. To test the state of
@@ -120,8 +123,10 @@ Put braces around a branch that contains a top-level comma:
120
123
 
121
124
  ## Enable native CSS if()
122
125
 
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:
126
+ By default, the compiler expresses conditions with `var()`. The `useCssIf`
127
+ option makes it write the native CSS
128
+ [`if()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Values/if)
129
+ function instead, for values and variants:
125
130
 
126
131
  ```ts title="stillwind.config.ts"
127
132
  import { defineConfig } from "stillwind/config";
@@ -29,8 +29,8 @@ The compiler reads the utilities at build time and generates their CSS.
29
29
  In React, `style()` returns a `className` prop.
30
30
 
31
31
  Utilities and variants come from the stylesheet that `stillwind.config.ts`
32
- selects. A token that you add to `@theme` adds utilities, such as `bg-accent`
33
- for `--color-accent`.
32
+ selects. A token that you add to [`@theme`](../at-rules/theme.md) adds utilities,
33
+ such as `bg-accent` for `--color-accent`.
34
34
 
35
35
  ## Add variants
36
36
 
@@ -179,4 +179,4 @@ such as state updates or I/O, before you call `style()`.
179
179
  - [Reusable styles](reusable-styles.md): how to share styles and define component options
180
180
  - [Responsive styles](responsive-styles.md): how to name breakpoints and use them in JavaScript
181
181
  - [Checks in the editor and CI](lint-adoption.md): how to find misspelled utilities and other mistakes
182
- - [The style() reference](../macros/style.md): every accepted input
182
+ - [The `style()` reference](../macros/style.md): every accepted input
@@ -16,17 +16,17 @@ utility or variant, use [Built-in utilities and variants](../utilities-and-varia
16
16
 
17
17
  ## What works
18
18
 
19
- | Tailwind feature | Support |
20
- | --------------------------------------- | -------------------------------------------------------------------- |
21
- | Default theme and preflight | Included in `@import "stillwind"` |
22
- | Utilities and variants | Supported, including arbitrary values, modifiers, and `!` |
23
- | `@theme`, `@utility`, `@custom-variant` | Supported |
24
- | `@apply`, `@variant` | Supported |
25
- | `--theme()`, `--spacing()`, `--alpha()` | Supported |
26
- | `theme(--color-red-500)` | Supported; v3 paths such as `theme(colors.red.500)` are not |
27
- | `@plugin` with JavaScript plugins | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
28
- | `@import` of CSS packages | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
29
- | Tailwind configuration | Set the `tailwind` field of the project in `stillwind.config.ts` |
19
+ | Tailwind feature | Support |
20
+ | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
21
+ | Default theme and preflight | Included in `@import "stillwind"` |
22
+ | Utilities and variants | Supported, including arbitrary values, modifiers, and `!` |
23
+ | [`@theme`](../at-rules/theme.md), [`@utility`](../at-rules/utility.md), [`@custom-variant`](../at-rules/custom-variant.md) | Supported |
24
+ | [`@apply`](../at-rules/apply.md), [`@variant`](../at-rules/variant.md) | Supported |
25
+ | `--theme()`, `--spacing()`, `--alpha()` | Supported |
26
+ | `theme(--color-red-500)` | Supported; v3 paths such as `theme(colors.red.500)` are not |
27
+ | [`@plugin`](../at-rules/plugin.md) with JavaScript plugins | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
28
+ | `@import` of CSS packages | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
29
+ | Tailwind configuration | Set the `tailwind` field of the project in `stillwind.config.ts` |
30
30
 
31
31
  ## How Stillwind checks compatibility
32
32
 
@@ -77,7 +77,7 @@ Load these packages with `@import`:
77
77
  | `tailwind-scrollbar-hide/v4` | `scrollbar-hide` |
78
78
  | `preline/variants.css` | `hs-dropdown-open:` |
79
79
 
80
- Other plugins can use the same features. [@plugin](../at-rules/plugin.md#tailwind-css-plugins)
80
+ Other plugins can use the same features. [`@plugin`](../at-rules/plugin.md#tailwind-css-plugins)
81
81
  lists the supported plugin API. JavaScript plugins need the `tailwindcss` package,
82
82
  and CSS packages do not.
83
83
 
@@ -88,9 +88,9 @@ these combinations in your application.
88
88
  ### Class names that a plugin's selectors use
89
89
 
90
90
  A plugin can select an element by a fixed class name. For example, the rules of
91
- `prose` skip elements inside `not-prose`. `style()` keeps such a class in the
92
- `class` attribute, so `style("not-prose")` adds the class `not-prose`. The class
93
- keeps its name only without variants, so
91
+ `prose` skip elements inside `not-prose`. [`style()`](style.md) keeps
92
+ such a class in the `class` attribute, so `style("not-prose")` adds the class
93
+ `not-prose`. The class keeps its name only without variants, so
94
94
  [invalid-marker-use](../lints/invalid-marker-use.md) reports `hover:not-prose`.
95
95
 
96
96
  ## What Stillwind adds
@@ -6,10 +6,12 @@ description: "Style view transition snapshots in the component, and give each it
6
6
  # View transitions
7
7
 
8
8
  You want an item to animate between two states of the page with the browser's
9
- View Transition API. In plain CSS, you write `view-transition-name` and the
10
- `::view-transition-*` rules in a global stylesheet, and you keep every name
11
- unique by hand. In Stillwind, you define the transition in the component and
12
- name each item with a key.
9
+ [View Transition API](https://developer.mozilla.org/docs/Web/API/View_Transition_API).
10
+ In plain CSS, you write
11
+ [`view-transition-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-name)
12
+ and the `::view-transition-*` rules in a global stylesheet, and you keep every
13
+ name unique by hand. In Stillwind, you define the transition in the component
14
+ and name each item with a key.
13
15
 
14
16
  ## Define the transition and name each item
15
17
 
@@ -26,15 +28,15 @@ export function Product({ id, name }: { id: string; name: string }) {
26
28
  }
27
29
  ```
28
30
 
29
- `style.viewTransition()` defines the styles of the snapshots. Each field styles
30
- one pseudo-element:
31
+ [`style.viewTransition()`](../macros/view-transition.md) defines the styles of
32
+ the snapshots. Each field styles one pseudo-element:
31
33
 
32
- | Field | Pseudo-element |
33
- | ----------- | -------------------------------- |
34
- | `group` | `::view-transition-group()` |
35
- | `imagePair` | `::view-transition-image-pair()` |
36
- | `old` | `::view-transition-old()` |
37
- | `new` | `::view-transition-new()` |
34
+ | Field | Pseudo-element |
35
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `group` | [`::view-transition-group()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-group) |
37
+ | `imagePair` | [`::view-transition-image-pair()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-image-pair) |
38
+ | `old` | [`::view-transition-old()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-old) |
39
+ | `new` | [`::view-transition-new()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-new) |
38
40
 
39
41
  Timing utilities in these fields set animation properties. For example,
40
42
  `duration-150` sets `animation-duration`.
@@ -62,8 +64,8 @@ the View Transition API run the update without animation.
62
64
 
63
65
  ## Give each element one name
64
66
 
65
- Use `.for()` once for each element, in one `style()` call. To combine several
66
- transitions on one element, pass the others without `.for()`:
67
+ Use `.for()` once for each element, in one [`style()`](style.md) call.
68
+ To combine several transitions on one element, pass the others without `.for()`:
67
69
 
68
70
  ```tsx
69
71
  import { style } from "stillwind/react";
@@ -80,5 +82,5 @@ The CLI reports a `style()` call that applies a transition without `.for()`, a
80
82
  call with two `.for()` calls, and transitions split across separate `style()`
81
83
  calls. It cannot check that keys are unique across the whole page.
82
84
 
83
- The [style.viewTransition() reference](../macros/view-transition.md) covers
85
+ The [`style.viewTransition()` reference](../macros/view-transition.md) covers
84
86
  dynamic keys and the generated CSS.
@@ -41,9 +41,9 @@ import { css, parts } from "stillwind/module-css";
41
41
  ```
42
42
 
43
43
  The compiler replaces this import in each module that contains it. The CSS
44
- contains the styles of the `style()` calls in that module and the styles that
45
- those calls compose from other modules. It also contains the theme values, the
46
- preflight reset, and the other rules of your stylesheet.
44
+ contains the styles of the [`style()`](style.md) calls in that module
45
+ and the styles that those calls compose from other modules. It also contains the
46
+ theme values, the preflight reset, and the other rules of your stylesheet.
47
47
 
48
48
  The import provides the CSS in two forms:
49
49
 
@@ -199,7 +199,7 @@ The `selector` option chooses the element that the utilities style. The string
199
199
  contains the theme values and keyframes that its utilities need, and it adds
200
200
  nothing to the page's stylesheet. Add it to the shadow root in the same way as
201
201
  the `css` string from `stillwind/module-css`, or create a stylesheet from it with
202
- `CSSStyleSheet.replaceSync()`. The [style.css() reference](../macros/css.md)
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
205
  ## Style the shadow host
package/docs/index.md CHANGED
@@ -39,8 +39,8 @@ Create `src/stillwind.css`:
39
39
  ```
40
40
 
41
41
  `@import "stillwind"` loads the default Tailwind CSS v4 theme and utilities.
42
- Each token in `@theme` adds utilities. For example, `--color-accent` adds
43
- `bg-accent` and `text-accent`.
42
+ Each token in [`@theme`](at-rules/theme.md) adds utilities. For example,
43
+ `--color-accent` adds `bg-accent` and `text-accent`.
44
44
 
45
45
  ## Configure the project
46
46
 
@@ -82,6 +82,8 @@ export default defineConfig({
82
82
 
83
83
  Place `stillwind()` before `react()`. Stillwind must compile styles before React
84
84
  compiles JSX. The plugin finds `stillwind.config.ts` in the application root.
85
+ It also adds the compiled CSS of your stylesheet to the page, so do not import
86
+ the stylesheet from your code.
85
87
 
86
88
  ## Style a component
87
89
 
@@ -102,6 +102,15 @@ Some plugins split routes or server functions before compilation, such as the
102
102
  TanStack Start plugin. Place those plugins before `stillwind()`:
103
103
  `[tanstackStart(), stillwind(), react()]`.
104
104
 
105
+ The plugin reads the stylesheet that `css` selects in `stillwind.config.ts` and
106
+ adds the compiled CSS to the page. Do not import that stylesheet anywhere else:
107
+ not from JavaScript, not from another stylesheet, and not from framework options
108
+ such as Starlight's `customCss`. If you import it, Vite also bundles it as plain
109
+ CSS, and the page receives the raw `@theme` and `@utility` rules. Stillwind warns
110
+ when JavaScript or a framework option imports the stylesheet. It cannot detect
111
+ an `@import` in another stylesheet. This rule also applies to Astro, SvelteKit,
112
+ Nuxt, and other frameworks that run on Vite.
113
+
105
114
  ## Astro
106
115
 
107
116
  Add the integration to `astro.config.ts`:
@@ -118,6 +127,61 @@ export default defineConfig({
118
127
  The integration also adds styles to server-rendered pages and islands. Keep your
119
128
  other integrations, such as `@astrojs/react`.
120
129
 
130
+ The integration inserts the styles at the end of `<head>` in each HTML page: an
131
+ inline `<style>` element in development, and `<link rel="stylesheet">` elements
132
+ in production builds. The styles therefore come after the stylesheets that Astro
133
+ and your other integrations add.
134
+
135
+ The browser orders cascade layers by the first place that declares them. If an
136
+ earlier stylesheet declares its own layers, Stillwind's `theme`, `base`, and
137
+ `utilities` layers come after them and win over them. To choose a different
138
+ order, declare all layers in a stylesheet that loads before Stillwind's styles.
139
+
140
+ ### Starlight
141
+
142
+ Starlight declares its `starlight` layers in its own stylesheet, which loads
143
+ before Stillwind's styles. Without an earlier layer order, Stillwind's base styles
144
+ would override Starlight's content styles. Create a stylesheet that contains only
145
+ the layer order, and make it the only entry in `customCss`:
146
+
147
+ ```css
148
+ /* src/styles/layers.css */
149
+ @layer properties, base, starlight, theme, components, utilities;
150
+ ```
151
+
152
+ ```js
153
+ // astro.config.mjs
154
+ import starlight from "@astrojs/starlight";
155
+ import { stillwind } from "@stillwind/integration/astro";
156
+ import { defineConfig } from "astro/config";
157
+
158
+ export default defineConfig({
159
+ integrations: [
160
+ starlight({
161
+ title: "Docs",
162
+ customCss: ["./src/styles/layers.css"],
163
+ }),
164
+ stillwind(),
165
+ ],
166
+ });
167
+ ```
168
+
169
+ Put the Stillwind stylesheet in a separate file, select it with `css` in
170
+ `stillwind.config.ts`, and keep it out of `customCss`:
171
+
172
+ ```css
173
+ /* src/styles/stillwind.css */
174
+ @import "@astrojs/starlight-tailwind";
175
+ @import "stillwind/theme.css" layer(theme);
176
+ @import "stillwind/utilities.css" layer(utilities);
177
+ @import "stillwind/builtins.css";
178
+ @import "stillwind/templates.css";
179
+ ```
180
+
181
+ `@astrojs/starlight-tailwind` adds the `dark` variant and theme tokens for
182
+ Starlight's colors and fonts. The stylesheet leaves out `stillwind/preflight.css`,
183
+ because Starlight resets the page styles itself.
184
+
121
185
  ## Next.js
122
186
 
123
187
  Wrap your configuration in `next.config.mjs`:
@@ -5,9 +5,9 @@ description: "Reports two independent base styles in one call that set the same
5
5
 
6
6
  # ambiguous-style-base-order
7
7
 
8
- This rule reports a `style()` call with two base styles that set the same
9
- property, when neither base is built on the other. The order of the arguments
10
- does not decide which base wins, so the result is not defined.
8
+ This rule reports a [`style()`](../macros/style.md) call with two base styles
9
+ that set the same property, when neither base is built on the other. The order
10
+ of the arguments does not decide which base wins, so the result is not defined.
11
11
 
12
12
  ## Reported
13
13
 
@@ -5,8 +5,8 @@ description: "Reports a top-level utility definition that also applies where the
5
5
 
6
6
  # bypassed-undefinition
7
7
 
8
- This rule reports a top-level `@utility` that also applies where Stillwind
9
- removes the utility on purpose. Inside animation options, for example,
8
+ This rule reports a top-level [`@utility`](../at-rules/utility.md) that also applies
9
+ where Stillwind removes the utility on purpose. Inside animation options, for example,
10
10
  `duration-*` sets `animation-duration`, and the built-in definitions remove the
11
11
  `transition-duration` meaning there. A top-level `duration-slow` would bring that
12
12
  meaning back.
@@ -36,8 +36,8 @@ meaning back.
36
36
  ## How to fix
37
37
 
38
38
  Define the utility inside `@stillwind-registry default`, as in the example. Then
39
- it applies in ordinary `style()` calls, and animation options keep their own
40
- meaning of `duration-*`.
39
+ it applies in ordinary [`style()`](../macros/style.md) calls, and animation options
40
+ keep their own meaning of `duration-*`.
41
41
 
42
42
  ## Rule settings
43
43
 
@@ -6,9 +6,10 @@ description: "Reports a container or anchor property that a ref method and a uti
6
6
  # conflicting-provider-properties
7
7
 
8
8
  This rule reports a container or anchor property that a ref method, such as
9
- `asContainer()`, and another utility both set on the same element. For example,
10
- `asContainer("size")` sets `container-type: size`, and `@container` sets it to
11
- `inline-size`. Only one value takes effect, and the code does not show which.
9
+ [`asContainer()`](../macros/ref/as-container.md), and another utility both set
10
+ on the same element. For example, `asContainer("size")` sets
11
+ `container-type: size`, and `@container` sets it to `inline-size`. Only one
12
+ value takes effect, and the code does not show which.
12
13
 
13
14
  ## Reported
14
15