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.
- package/docs/at-rules/apply.md +3 -3
- package/docs/at-rules/custom-variant.md +7 -5
- package/docs/at-rules/index.md +28 -28
- package/docs/at-rules/plugin.md +5 -5
- package/docs/at-rules/registry-directives.md +13 -12
- package/docs/at-rules/slot.md +3 -3
- package/docs/at-rules/stillwind-css-template.md +8 -7
- package/docs/at-rules/stillwind-property.md +7 -6
- package/docs/at-rules/stillwind-registry.md +13 -12
- package/docs/at-rules/stillwind-require-properties.md +2 -2
- package/docs/at-rules/stillwind-slot.md +12 -12
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +3 -3
- package/docs/at-rules/stillwind-undef-utility.md +10 -9
- package/docs/at-rules/stillwind-undef-variant.md +5 -5
- package/docs/at-rules/theme.md +6 -6
- package/docs/at-rules/utility.md +17 -12
- package/docs/at-rules/variant.md +11 -7
- package/docs/cli.md +5 -5
- package/docs/concepts/how-styles-compile.md +3 -3
- package/docs/concepts/stylesheets.md +30 -1
- package/docs/configuration.md +8 -8
- package/docs/editors.md +2 -2
- package/docs/errors/SW10004.md +8 -7
- package/docs/errors/SW10005.md +4 -4
- package/docs/errors/SW14002.md +3 -2
- package/docs/errors/SW14003.md +5 -3
- package/docs/errors/SW14004.md +3 -3
- package/docs/errors/SW14005.md +5 -4
- package/docs/errors/SW14008.md +6 -4
- package/docs/errors/SW90001.md +1 -1
- package/docs/errors/SW90006.md +3 -1
- package/docs/errors/index.md +6 -6
- package/docs/guides/animations.md +10 -8
- package/docs/guides/design-systems.md +2 -1
- package/docs/guides/element-relationships.md +17 -15
- package/docs/guides/lint-adoption.md +2 -1
- package/docs/guides/migrating-from-css.md +8 -5
- package/docs/guides/migrating-from-tailwind.md +101 -13
- package/docs/guides/recommended-practices.md +20 -17
- package/docs/guides/responsive-styles.md +9 -6
- package/docs/guides/reusable-styles.md +3 -3
- package/docs/guides/runtime-conditions.md +10 -5
- package/docs/guides/style.md +3 -3
- package/docs/guides/tailwind-compatibility.md +15 -15
- package/docs/guides/view-transitions.md +17 -15
- package/docs/guides/web-components.md +4 -4
- package/docs/index.md +4 -2
- package/docs/integrations.md +64 -0
- package/docs/lints/ambiguous-style-base-order.md +3 -3
- package/docs/lints/bypassed-undefinition.md +4 -4
- package/docs/lints/conflicting-provider-properties.md +4 -3
- package/docs/lints/duplicate-definition.md +2 -1
- package/docs/lints/duplicate-view-transition-name.md +4 -2
- package/docs/lints/ignored-definition-condition.md +4 -3
- package/docs/lints/ignored-tailwind-feature.md +1 -1
- package/docs/lints/implicit-nesting-selector.md +4 -3
- package/docs/lints/index.md +38 -38
- package/docs/lints/ineffective-anchor-scope.md +4 -2
- package/docs/lints/invalid-animation-option.md +3 -3
- package/docs/lints/invalid-css-directive.md +10 -2
- package/docs/lints/invalid-css-import.md +8 -0
- package/docs/lints/invalid-css-input.md +5 -4
- package/docs/lints/invalid-cva-config.md +16 -4
- package/docs/lints/invalid-cva-input.md +11 -6
- package/docs/lints/invalid-keyframes-definition.md +1 -1
- package/docs/lints/invalid-keyframes-variant.md +17 -9
- package/docs/lints/invalid-marker-use.md +1 -1
- package/docs/lints/invalid-media-query.md +8 -6
- package/docs/lints/invalid-ref-input.md +6 -5
- package/docs/lints/invalid-rule-group-input.md +13 -6
- package/docs/lints/invalid-style-input.md +1 -1
- package/docs/lints/invalid-theme-reference.md +2 -2
- package/docs/lints/invalid-view-transition-definition.md +1 -1
- package/docs/lints/invalid-view-transition-use.md +1 -1
- package/docs/lints/invalid-view-transition-variant.md +3 -3
- package/docs/lints/mismatched-framework-import.md +4 -4
- package/docs/lints/missing-document-target.md +1 -1
- package/docs/lints/missing-ref-attachment.md +6 -4
- package/docs/lints/missing-view-transition-name.md +7 -5
- package/docs/lints/no-arbitrary-breakpoints.md +1 -1
- package/docs/lints/no-class-property.md +4 -3
- package/docs/lints/prefer-canonical-utilities.md +3 -2
- package/docs/lints/prefer-direct-styling.md +2 -2
- package/docs/lints/prefer-variant-directive.md +8 -8
- package/docs/lints/split-view-transition-class.md +5 -4
- package/docs/lints/suspending-macro-argument.md +2 -2
- package/docs/lints/unknown-utility.md +2 -1
- package/docs/lints/unknown-variant.md +2 -2
- package/docs/lints/unverified-style-base.md +4 -3
- package/docs/macros/anchor-scope.md +13 -10
- package/docs/macros/css.md +11 -9
- package/docs/macros/cva.md +9 -8
- package/docs/macros/index.md +10 -10
- package/docs/macros/keyframes.md +5 -4
- package/docs/macros/media.md +6 -5
- package/docs/macros/ref/as-anchor.md +12 -7
- package/docs/macros/ref/as-container.md +7 -4
- package/docs/macros/ref/at.md +10 -9
- package/docs/macros/ref/condition.md +1 -1
- package/docs/macros/ref/in.md +6 -6
- package/docs/macros/ref/index.md +11 -11
- package/docs/macros/ref/position-anchor.md +7 -4
- package/docs/macros/style.md +3 -3
- package/docs/macros/view-transition.md +13 -12
- package/docs/plugins/iconify.md +95 -85
- package/docs/plugins/index.md +3 -3
- package/docs/utilities-and-variants.md +4 -4
- package/docs/why.md +2 -2
- package/package.json +29 -5
- package/skills/migrate-to-stillwind/SKILL.md +7 -2
package/docs/at-rules/utility.md
CHANGED
|
@@ -11,8 +11,9 @@ description: "Define a utility, or add declarations to a built-in utility with t
|
|
|
11
11
|
@utility name (implementation) { ... }
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
`@utility` defines a utility for `style()
|
|
15
|
-
|
|
14
|
+
`@utility` defines a utility for [`style()`](../macros/style.md),
|
|
15
|
+
[`@apply`](apply.md), and the other places that accept utilities.
|
|
16
|
+
Write it at the top level of the stylesheet.
|
|
16
17
|
|
|
17
18
|
## Static and functional utilities
|
|
18
19
|
|
|
@@ -50,7 +51,7 @@ export const list = {className:"sw_70m3s"};
|
|
|
50
51
|
### Generated stylesheet without preflight
|
|
51
52
|
|
|
52
53
|
```css
|
|
53
|
-
/*! stillwind v0.
|
|
54
|
+
/*! stillwind v0.6.0 | MIT License | https://stillwind.dev */
|
|
54
55
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
55
56
|
@layer properties, theme, base, components, utilities;
|
|
56
57
|
|
|
@@ -115,7 +116,7 @@ export const code = {className:"sw_9jkuo"};
|
|
|
115
116
|
### Generated stylesheet without preflight
|
|
116
117
|
|
|
117
118
|
```css
|
|
118
|
-
/*! stillwind v0.
|
|
119
|
+
/*! stillwind v0.6.0 | MIT License | https://stillwind.dev */
|
|
119
120
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
120
121
|
@layer properties, theme, base, components, utilities;
|
|
121
122
|
|
|
@@ -171,7 +172,7 @@ export const page = {className:"sw_5yksj"};
|
|
|
171
172
|
### Generated stylesheet without preflight
|
|
172
173
|
|
|
173
174
|
```css
|
|
174
|
-
/*! stillwind v0.
|
|
175
|
+
/*! stillwind v0.6.0 | MIT License | https://stillwind.dev */
|
|
175
176
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
176
177
|
@layer properties, theme, base, components, utilities;
|
|
177
178
|
|
|
@@ -206,22 +207,26 @@ export const page = {className:"sw_5yksj"};
|
|
|
206
207
|
A static definition replaces a functional one for its exact name:
|
|
207
208
|
`@utility shadow-lg { ... }` replaces the built-in `shadow-*` for `shadow-lg`
|
|
208
209
|
only. To remove built-in definitions, use
|
|
209
|
-
[
|
|
210
|
+
[`@stillwind-undef-utility`](stillwind-undef-utility.md).
|
|
210
211
|
|
|
211
212
|
## Body
|
|
212
213
|
|
|
213
|
-
A body can contain nested rules, `@apply
|
|
214
|
-
|
|
214
|
+
A body can contain nested rules, [`@apply`](apply.md),
|
|
215
|
+
[`@variant`](variant.md) blocks,
|
|
216
|
+
[`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes), and
|
|
217
|
+
[`@property`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@property).
|
|
218
|
+
A nested selector without `&` selects descendants: `[data-icon]` means
|
|
215
219
|
`& [data-icon]`. Variants select the utility element, and the nested selector
|
|
216
|
-
applies inside them.
|
|
220
|
+
applies inside them. A `@variant` block applies its variants to the utility
|
|
221
|
+
element, or to the selector of the nested rule that contains it.
|
|
217
222
|
|
|
218
223
|
The compiler moves `@keyframes` and `@property` rules of a used utility to the
|
|
219
224
|
`keyframes` slot, because browsers ignore them inside a style rule. An unused
|
|
220
225
|
utility adds no such rules.
|
|
221
226
|
|
|
222
227
|
To use a registered custom property, register it with
|
|
223
|
-
[
|
|
224
|
-
[
|
|
228
|
+
[`@stillwind-property`](stillwind-property.md) and require it with
|
|
229
|
+
[`@stillwind-require-properties`](stillwind-require-properties.md).
|
|
225
230
|
|
|
226
231
|
## The implementation descriptor
|
|
227
232
|
|
|
@@ -263,7 +268,7 @@ export const icon = {className:"sw_smxmp"};
|
|
|
263
268
|
### Generated stylesheet without preflight
|
|
264
269
|
|
|
265
270
|
```css
|
|
266
|
-
/*! stillwind v0.
|
|
271
|
+
/*! stillwind v0.6.0 | MIT License | https://stillwind.dev */
|
|
267
272
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
268
273
|
@layer properties, theme, base, components, utilities;
|
|
269
274
|
|
package/docs/at-rules/variant.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "@variant"
|
|
3
|
-
description: "Apply variants, such as hover or dark, to a block of declarations in a rule of your stylesheet."
|
|
3
|
+
description: "Apply variants, such as hover or dark, to a block of declarations in a rule or custom utility of your stylesheet."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# @variant
|
|
@@ -14,7 +14,9 @@ selector {
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
`@variant` wraps its block in the rules of the listed variants. Write it inside
|
|
17
|
-
a style rule.
|
|
17
|
+
a style rule or the body of a [`@utility`](utility.md). The variants
|
|
18
|
+
apply to the element that the enclosing rule selects. Directly in a `@utility`
|
|
19
|
+
body, that element is the one that uses the utility.
|
|
18
20
|
|
|
19
21
|
## Example
|
|
20
22
|
|
|
@@ -37,7 +39,7 @@ a style rule.
|
|
|
37
39
|
### Generated stylesheet without preflight
|
|
38
40
|
|
|
39
41
|
```css
|
|
40
|
-
/*! stillwind v0.
|
|
42
|
+
/*! stillwind v0.6.0 | MIT License | https://stillwind.dev */
|
|
41
43
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
42
44
|
@layer properties, theme, base, components, utilities;
|
|
43
45
|
|
|
@@ -82,10 +84,12 @@ a style rule.
|
|
|
82
84
|
- A `@variant` statement without a block stays in the output unchanged.
|
|
83
85
|
|
|
84
86
|
[prefer-variant-directive](../lints/prefer-variant-directive.md) reports an
|
|
85
|
-
`@media` query that a variant of your theme can replace, such as a breakpoint
|
|
87
|
+
`@media` query that a variant of your theme can replace, such as a breakpoint,
|
|
88
|
+
in a style rule or a `@utility` body.
|
|
86
89
|
|
|
87
90
|
## Variant definitions
|
|
88
91
|
|
|
89
|
-
At the top level of the stylesheet, a `@variant` block that contains
|
|
90
|
-
defines a variant, for compatibility with older
|
|
91
|
-
[
|
|
92
|
+
At the top level of the stylesheet, a `@variant` block that contains
|
|
93
|
+
[`@slot`](slot.md) defines a variant, for compatibility with older
|
|
94
|
+
Tailwind CSS stylesheets. Use [`@custom-variant`](custom-variant.md)
|
|
95
|
+
for new definitions.
|
package/docs/cli.md
CHANGED
|
@@ -93,9 +93,9 @@ vp exec stillwind inspect src/Button.tsx:12:8
|
|
|
93
93
|
vp exec stillwind inspect 'src/**/*.tsx' src/App.tsx:30 --format json
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
`inspect` shows the CSS that `style()` calls, keyframes, and
|
|
97
|
-
generate. The CSS writes the styled element as `&`, and it includes
|
|
98
|
-
the call composes. `inspect` saves no files.
|
|
96
|
+
`inspect` shows the CSS that [`style()`](macros/style.md) calls, keyframes, and
|
|
97
|
+
view transitions generate. The CSS writes the styled element as `&`, and it includes
|
|
98
|
+
the styles that the call composes. `inspect` saves no files.
|
|
99
99
|
|
|
100
100
|
Each target is a [path or glob](#select-files), and you can pass several targets.
|
|
101
101
|
Without a target, `inspect` covers every file that `files` selects.
|
|
@@ -143,8 +143,8 @@ leading `--`, because the CLI reads `--color-*` as an option.
|
|
|
143
143
|
| ------------------- | ----------------------------------------------- |
|
|
144
144
|
| `--source <origin>` | Shows only `project` tokens or `default` tokens |
|
|
145
145
|
|
|
146
|
-
`project` tokens come from an ordinary `@theme
|
|
147
|
-
or from a plugin, and an ordinary `@theme` can override them.
|
|
146
|
+
`project` tokens come from an ordinary [`@theme`](at-rules/theme.md). `default` tokens
|
|
147
|
+
come from `@theme default` or from a plugin, and an ordinary `@theme` can override them.
|
|
148
148
|
|
|
149
149
|
Each token shows its value as written, including references to other tokens.
|
|
150
150
|
|
|
@@ -5,7 +5,7 @@ description: "See what Stillwind generates at build time, what JavaScript remain
|
|
|
5
5
|
|
|
6
6
|
# How styles compile
|
|
7
7
|
|
|
8
|
-
Stillwind compiles `style()` calls when your bundler builds the application.
|
|
8
|
+
Stillwind compiles [`style()`](../guides/style.md) calls when your bundler builds the application.
|
|
9
9
|
This page shows what the compiler generates, what JavaScript remains at
|
|
10
10
|
runtime, and how the CSS reaches the page.
|
|
11
11
|
|
|
@@ -102,8 +102,8 @@ chooses class names and sets property values.
|
|
|
102
102
|
| Static utilities and variants | A class name |
|
|
103
103
|
| A condition, such as `active && "..."` | A helper that joins class names |
|
|
104
104
|
| A runtime custom property | An inline `style` value |
|
|
105
|
-
| `style.cva()`
|
|
106
|
-
| `style.media()`
|
|
105
|
+
| [`style.cva()`](../macros/cva.md) | A factory that selects compiled class names |
|
|
106
|
+
| [`style.media()`](../macros/media.md) | A string with the media query |
|
|
107
107
|
| [`style.css()`](../macros/css.md) | A CSS string that you place yourself |
|
|
108
108
|
|
|
109
109
|
Development builds import checked versions of the helpers from
|
|
@@ -23,7 +23,7 @@ of the default stylesheet or add an optional file.
|
|
|
23
23
|
| `stillwind/preflight.css` | The reset of default element styles |
|
|
24
24
|
| `stillwind/utilities.css` | The slot where compiled utility rules go |
|
|
25
25
|
| `stillwind/builtins.css` | Built-in utilities and variants |
|
|
26
|
-
| `stillwind/templates.css` | Output templates of `style.css()`
|
|
26
|
+
| `stillwind/templates.css` | Output templates of [`style.css()`](../macros/css.md) |
|
|
27
27
|
| `stillwind/logical/*.css` | Optional: logical properties for built-in axis utilities |
|
|
28
28
|
|
|
29
29
|
## Import the files separately
|
|
@@ -45,6 +45,35 @@ line. They decide how these files compete with the rest of your CSS. For example
|
|
|
45
45
|
[Migrating from CSS](../guides/migrating-from-css.md) leaves out `preflight.css`
|
|
46
46
|
until the old styles are gone.
|
|
47
47
|
|
|
48
|
+
## Reset only part of the page
|
|
49
|
+
|
|
50
|
+
Some pages already have base styles from a site theme or a host application. To
|
|
51
|
+
reset only the elements inside one container, write the `@import` inside a style
|
|
52
|
+
rule:
|
|
53
|
+
|
|
54
|
+
```css
|
|
55
|
+
@import "stillwind/theme.css" layer(theme);
|
|
56
|
+
@import "stillwind/utilities.css" layer(utilities);
|
|
57
|
+
@import "stillwind/builtins.css";
|
|
58
|
+
|
|
59
|
+
@layer base {
|
|
60
|
+
.widget {
|
|
61
|
+
@import "stillwind/preflight.css";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Stillwind inlines the imported file in place, so each of its rules nests under
|
|
67
|
+
`.widget` and applies only to the descendants of that element. The `html` and
|
|
68
|
+
`:host` rules of `preflight.css` then match no element. The `.widget` element
|
|
69
|
+
inherits its font and line height from the page, unless you set them on it.
|
|
70
|
+
|
|
71
|
+
Import only plain CSS in this way, such as `preflight.css`. Keep `stillwind`,
|
|
72
|
+
`theme.css`, `utilities.css`, `builtins.css`, and other files with Stillwind
|
|
73
|
+
definitions or `@layer` statements at the top level of the stylesheet. The
|
|
74
|
+
compiler leaves out a nested import of such a file and reports it with
|
|
75
|
+
[invalid-css-import](../lints/invalid-css-import.md).
|
|
76
|
+
|
|
48
77
|
## Optional stylesheets
|
|
49
78
|
|
|
50
79
|
An optional stylesheet changes built-in utilities, so `stillwind` does not include
|
package/docs/configuration.md
CHANGED
|
@@ -109,7 +109,7 @@ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
|
|
|
109
109
|
| `utilityOrder` | `"authored"` orders utilities as your stylesheet defines them; `"tailwind"` orders them as Tailwind does |
|
|
110
110
|
| `important` | `true` makes every utility `!important`; a selector nests utilities under that selector |
|
|
111
111
|
| `tailwind` | A Tailwind configuration object; see [Migrating from Tailwind CSS](guides/migrating-from-tailwind.md#move-configuration) |
|
|
112
|
-
| `plugins` | Plugin objects for the `@plugin` rules of your stylesheet
|
|
112
|
+
| `plugins` | Plugin objects for the [`@plugin`](at-rules/plugin.md) rules of your stylesheet |
|
|
113
113
|
| `rootFontSize` | Pixels per `rem`, used by lint fixes and editor previews; defaults to 16 |
|
|
114
114
|
| `useCssIf` | `true` lets [runtime conditions](guides/runtime-conditions.md) use the native CSS `if()` function; defaults to `false` |
|
|
115
115
|
|
|
@@ -295,13 +295,13 @@ comment that suppresses nothing.
|
|
|
295
295
|
The `sort` field controls where `stillwind fmt`, the editor, and the
|
|
296
296
|
[Prettier plugin](formatters.md#prettier) sort utilities:
|
|
297
297
|
|
|
298
|
-
| Option | Sorts
|
|
299
|
-
| ----------------- |
|
|
300
|
-
| `stringLiterals` | Utilities inside each string
|
|
301
|
-
| `arrays` | Arguments, array items, and object entries by kind
|
|
302
|
-
| `applyUtilities` | Utilities inside each `@apply` rule
|
|
303
|
-
| `applyStatements` | Adjacent `@apply` rules
|
|
304
|
-
| `variantBlocks` | Adjacent `@variant` blocks
|
|
298
|
+
| Option | Sorts | Default |
|
|
299
|
+
| ----------------- | ----------------------------------------------------------- | ------- |
|
|
300
|
+
| `stringLiterals` | Utilities inside each string | `true` |
|
|
301
|
+
| `arrays` | Arguments, array items, and object entries by kind | `true` |
|
|
302
|
+
| `applyUtilities` | Utilities inside each [`@apply`](at-rules/apply.md) rule | `true` |
|
|
303
|
+
| `applyStatements` | Adjacent `@apply` rules | `false` |
|
|
304
|
+
| `variantBlocks` | Adjacent [`@variant`](at-rules/variant.md) blocks | `false` |
|
|
305
305
|
|
|
306
306
|
`sort: false` disables sorting, including `stillwind fmt` and the
|
|
307
307
|
[prefer-sorted-utilities](lints/prefer-sorted-utilities.md) rule. Turning off
|
package/docs/editors.md
CHANGED
|
@@ -22,9 +22,9 @@ configuration as JavaScript.
|
|
|
22
22
|
|
|
23
23
|
### Features
|
|
24
24
|
|
|
25
|
-
- Hover over utilities, `style()` calls, or bound variables to see the generated CSS.
|
|
25
|
+
- Hover over utilities, [`style()`](guides/style.md) calls, or bound variables to see the generated CSS.
|
|
26
26
|
- Complete utilities, variants, and theme values.
|
|
27
|
-
- Complete quoted `@plugin` paths, and follow links to their modules.
|
|
27
|
+
- Complete quoted [`@plugin`](at-rules/plugin.md) paths, and follow links to their modules.
|
|
28
28
|
- See colors, and open color pickers in utilities and theme references.
|
|
29
29
|
- Apply compiler Quick Fixes.
|
|
30
30
|
- Run **Stillwind: Sort Utilities**.
|
package/docs/errors/SW10004.md
CHANGED
|
@@ -6,7 +6,7 @@ description: "A ref method, ref condition, or animation call is stored or passed
|
|
|
6
6
|
# SW10004: Unconsumed macro use
|
|
7
7
|
|
|
8
8
|
Some calls have no value of their own. The compiler turns them into CSS at the
|
|
9
|
-
place where `style()` uses them. This error occurs when such a call is stored in
|
|
9
|
+
place where [`style()`](../macros/style.md) uses them. This error occurs when such a call is stored in
|
|
10
10
|
a variable or passed to another function instead.
|
|
11
11
|
|
|
12
12
|
## Reported
|
|
@@ -29,11 +29,12 @@ const props = style(card, card.asContainer("inline-size"));
|
|
|
29
29
|
|
|
30
30
|
Write the call directly where `style()` uses it:
|
|
31
31
|
|
|
32
|
-
| Call
|
|
33
|
-
|
|
|
34
|
-
| `card.asContainer()
|
|
35
|
-
| An animation such as `fade("duration-300")
|
|
36
|
-
| `card()`, `card("hover")
|
|
32
|
+
| Call | Where to write it |
|
|
33
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
|
|
34
|
+
| [`card.asContainer()`](../macros/ref/as-container.md), [`card.asAnchor()`](../macros/ref/as-anchor.md), [`card.positionAnchor()`](../macros/ref/position-anchor.md), [`style.anchorScope()`](../macros/anchor-scope.md) | An argument of `style()` |
|
|
35
|
+
| An animation such as [`fade("duration-300")`](../macros/keyframes.md#apply-the-animation), and [`transition.for(key)`](../macros/view-transition.md) | An argument of `style()` |
|
|
36
|
+
| [`card()`, `card("hover")`](../macros/ref/condition.md), [`.in()`](../macros/ref/in.md), and [`card.at()`](../macros/ref/at.md) | A computed key, or a utility template |
|
|
37
37
|
|
|
38
38
|
You can still store and pass the definitions themselves, such as the result of
|
|
39
|
-
`style.ref()` or `style.keyframes()
|
|
39
|
+
[`style.ref()`](../macros/ref/index.md) or [`style.keyframes()`](../macros/keyframes.md),
|
|
40
|
+
and the result of `style()`.
|
package/docs/errors/SW10005.md
CHANGED
|
@@ -5,10 +5,10 @@ description: "The style function is used as a value instead of being called."
|
|
|
5
5
|
|
|
6
6
|
# SW10005: Untransformed macro reference
|
|
7
7
|
|
|
8
|
-
This error occurs when the code uses `style` or another
|
|
9
|
-
by storing it in a variable or passing it to a function.
|
|
10
|
-
macro calls at build time and removes the import, so the
|
|
11
|
-
at runtime.
|
|
8
|
+
This error occurs when the code uses [`style`](../macros/style.md) or another
|
|
9
|
+
macro as a value, such as by storing it in a variable or passing it to a function.
|
|
10
|
+
The compiler replaces macro calls at build time and removes the import, so the
|
|
11
|
+
function does not exist at runtime.
|
|
12
12
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
package/docs/errors/SW14002.md
CHANGED
|
@@ -6,8 +6,9 @@ description: "Your stylesheet has no place for CSS that a feature needs, such as
|
|
|
6
6
|
# SW14002: Missing support slot
|
|
7
7
|
|
|
8
8
|
This error occurs when the compiler generates supporting CSS, such as the
|
|
9
|
-
`@keyframes`
|
|
10
|
-
|
|
9
|
+
[`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
|
|
10
|
+
of an animation, but your stylesheet has no slot for it. The message names
|
|
11
|
+
the missing slot.
|
|
11
12
|
|
|
12
13
|
## Reported
|
|
13
14
|
|
package/docs/errors/SW14003.md
CHANGED
|
@@ -5,9 +5,11 @@ description: "An @stillwind-require-properties directive in your stylesheet has
|
|
|
5
5
|
|
|
6
6
|
# SW14003: Malformed property requirement
|
|
7
7
|
|
|
8
|
-
This error occurs when an
|
|
9
|
-
|
|
10
|
-
directive
|
|
8
|
+
This error occurs when an
|
|
9
|
+
[`@stillwind-require-properties`](../at-rules/stillwind-require-properties.md)
|
|
10
|
+
directive in your stylesheet has invalid syntax, such as an incomplete custom
|
|
11
|
+
property name. The directive lists the registered custom properties that a
|
|
12
|
+
utility needs.
|
|
11
13
|
|
|
12
14
|
## Reported
|
|
13
15
|
|
package/docs/errors/SW14004.md
CHANGED
|
@@ -6,9 +6,9 @@ description: "A utility that you use has an @stillwind-require-properties direct
|
|
|
6
6
|
# SW14004: Malformed utility property requirement
|
|
7
7
|
|
|
8
8
|
This error occurs when you use a utility whose definition contains an invalid
|
|
9
|
-
`@stillwind-require-properties`
|
|
10
|
-
|
|
11
|
-
plugin.
|
|
9
|
+
[`@stillwind-require-properties`](../at-rules/stillwind-require-properties.md)
|
|
10
|
+
directive. The message names the utility and the position in its definition.
|
|
11
|
+
The definition can be in your stylesheet or in a plugin.
|
|
12
12
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
package/docs/errors/SW14005.md
CHANGED
|
@@ -6,9 +6,9 @@ description: "A utility requires a custom property that no @stillwind-property r
|
|
|
6
6
|
# SW14005: Required property is unregistered
|
|
7
7
|
|
|
8
8
|
This error occurs when a utility requires a custom property, but no
|
|
9
|
-
`@stillwind-property` in the loaded
|
|
10
|
-
|
|
11
|
-
rule does not register it.
|
|
9
|
+
[`@stillwind-property`](../at-rules/stillwind-property.md) in the loaded
|
|
10
|
+
stylesheets registers it. The registration provides the initial value and
|
|
11
|
+
other support CSS. Assigning the property in a rule does not register it.
|
|
12
12
|
|
|
13
13
|
## Reported
|
|
14
14
|
|
|
@@ -46,6 +46,7 @@ style("spin-x");
|
|
|
46
46
|
|
|
47
47
|
## How to fix
|
|
48
48
|
|
|
49
|
-
- Register the property with `@stillwind-property`,
|
|
49
|
+
- Register the property with `@stillwind-property`,
|
|
50
|
+
as in the example.
|
|
50
51
|
- If the property comes from Stillwind or a plugin, check that the stylesheet
|
|
51
52
|
imports the file that registers it, and check the spelling of the name.
|
package/docs/errors/SW14008.md
CHANGED
|
@@ -5,8 +5,9 @@ description: "A utility applies itself directly or through another utility."
|
|
|
5
5
|
|
|
6
6
|
# SW14008: Circular utility application
|
|
7
7
|
|
|
8
|
-
This error occurs when an `@apply` dependency returns
|
|
9
|
-
being expanded. The cycle can pass through
|
|
8
|
+
This error occurs when an [`@apply`](../at-rules/apply.md) dependency returns
|
|
9
|
+
to a utility that is already being expanded. The cycle can pass through
|
|
10
|
+
several utilities.
|
|
10
11
|
|
|
11
12
|
## Reported
|
|
12
13
|
|
|
@@ -37,5 +38,6 @@ being expanded. The cycle can pass through several utilities.
|
|
|
37
38
|
|
|
38
39
|
## How to fix
|
|
39
40
|
|
|
40
|
-
Remove the `@apply` that closes the dependency cycle. A shared utility can
|
|
41
|
-
the common declarations, provided that it does not apply the utilities
|
|
41
|
+
Remove the `@apply` that closes the dependency cycle. A shared utility can
|
|
42
|
+
contain the common declarations, provided that it does not apply the utilities
|
|
43
|
+
that use it.
|
package/docs/errors/SW90001.md
CHANGED
|
@@ -12,6 +12,6 @@ This error occurs when the CSS that the compiler generates for a style cannot be
|
|
|
12
12
|
[Open an issue](https://github.com/SegaraRai/stillwind/issues) with the error
|
|
13
13
|
message and:
|
|
14
14
|
|
|
15
|
-
- The `style()` call or utility that causes the error
|
|
15
|
+
- The [`style()`](../macros/style.md) call or utility that causes the error
|
|
16
16
|
- Your stylesheet, or the parts that the utility uses
|
|
17
17
|
- The version of the Stillwind packages
|
package/docs/errors/SW90006.md
CHANGED
|
@@ -5,7 +5,9 @@ description: "The compiler generated a code edit with an invalid link to the ori
|
|
|
5
5
|
|
|
6
6
|
# SW90006: Invalid transform expression mapping
|
|
7
7
|
|
|
8
|
-
This error occurs when an edit that the compiler generates links to the
|
|
8
|
+
This error occurs when an edit that the compiler generates links to the
|
|
9
|
+
original expression incorrectly. The message names the
|
|
10
|
+
[`style()`](../macros/style.md) call.
|
|
9
11
|
|
|
10
12
|
## How to report
|
|
11
13
|
|
package/docs/errors/index.md
CHANGED
|
@@ -11,12 +11,12 @@ causes the error and how to fix it.
|
|
|
11
11
|
|
|
12
12
|
The first digits of a code tell you what to do next:
|
|
13
13
|
|
|
14
|
-
| Codes | What to do
|
|
15
|
-
| ----------------- |
|
|
16
|
-
| SW01xxx – SW03xxx | Fix `stillwind.config.ts` or the integration options
|
|
17
|
-
| SW10xxx – SW15xxx | Fix your components, `style()` calls, or stylesheet
|
|
18
|
-
| SW30xxx – SW34xxx | Check your integration, or report a bug
|
|
19
|
-
| SW90xxx | Report a bug
|
|
14
|
+
| Codes | What to do |
|
|
15
|
+
| ----------------- | ------------------------------------------------------------------------- |
|
|
16
|
+
| SW01xxx – SW03xxx | Fix `stillwind.config.ts` or the integration options |
|
|
17
|
+
| SW10xxx – SW15xxx | Fix your components, [`style()`](../macros/style.md) calls, or stylesheet |
|
|
18
|
+
| SW30xxx – SW34xxx | Check your integration, or report a bug |
|
|
19
|
+
| SW90xxx | Report a bug |
|
|
20
20
|
|
|
21
21
|
## Fix the configuration
|
|
22
22
|
|
|
@@ -6,9 +6,10 @@ description: "Define keyframes in the component that uses them, and respect redu
|
|
|
6
6
|
# Animations
|
|
7
7
|
|
|
8
8
|
You want to animate a component. With Tailwind, as with plain CSS, you write
|
|
9
|
-
`@keyframes`
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
[`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
|
|
10
|
+
in a global stylesheet and register the animation in the theme. In Stillwind,
|
|
11
|
+
you can define the keyframes in the component that uses them, so the animation
|
|
12
|
+
stays next to the code that uses it.
|
|
12
13
|
|
|
13
14
|
## Define and apply keyframes
|
|
14
15
|
|
|
@@ -29,9 +30,9 @@ export function Notice() {
|
|
|
29
30
|
}
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
`style.keyframes()` defines the frames with utilities.
|
|
33
|
-
animation, and its utilities set the animation's options.
|
|
34
|
-
`duration-300` sets `animation-duration`.
|
|
33
|
+
[`style.keyframes()`](../macros/keyframes.md) defines the frames with utilities.
|
|
34
|
+
`enter(...)` applies the animation, and its utilities set the animation's options.
|
|
35
|
+
For example, `duration-300` sets `animation-duration`.
|
|
35
36
|
|
|
36
37
|
The compiler generates a unique animation name, so two components can both
|
|
37
38
|
define an `enter` animation. When you delete the component, its keyframes are no
|
|
@@ -67,7 +68,8 @@ here. Container queries are not supported.
|
|
|
67
68
|
|
|
68
69
|
Export the keyframes from their module, and import them in other components.
|
|
69
70
|
Write the call that applies them, such as `enter("duration-300")`, directly in
|
|
70
|
-
`style()
|
|
71
|
+
[`style()`](style.md). You cannot store that call in a variable and
|
|
72
|
+
use it later.
|
|
71
73
|
|
|
72
|
-
The [style.keyframes() reference](../macros/keyframes.md) shows the generated
|
|
74
|
+
The [`style.keyframes()` reference](../macros/keyframes.md) shows the generated
|
|
73
75
|
JavaScript and CSS.
|
|
@@ -61,7 +61,8 @@ export function Panel() {
|
|
|
61
61
|
|
|
62
62
|
When a theme changes, you edit the stylesheet. The components stay the same.
|
|
63
63
|
|
|
64
|
-
To use a breakpoint in JavaScript, pass its name to
|
|
64
|
+
To use a breakpoint in JavaScript, pass its name to
|
|
65
|
+
[`style.media()`](../macros/media.md). See
|
|
65
66
|
[Responsive styles](responsive-styles.md).
|
|
66
67
|
|
|
67
68
|
## Report values outside the theme
|
|
@@ -12,8 +12,8 @@ Tailwind connects the two elements by name, such as `group/card` and
|
|
|
12
12
|
they match. Nested groups or containers may also need names to target the right
|
|
13
13
|
ancestor. You must avoid name collisions when nesting components.
|
|
14
14
|
|
|
15
|
-
In Stillwind, you create the name as a variable with `style.ref()
|
|
16
|
-
ref is an undefined variable, so TypeScript reports it.
|
|
15
|
+
In Stillwind, you create the name as a variable with [`style.ref()`](../macros/ref/index.md).
|
|
16
|
+
A misspelled ref is an undefined variable, so TypeScript reports it.
|
|
17
17
|
|
|
18
18
|
## React to a parent's state
|
|
19
19
|
|
|
@@ -43,8 +43,8 @@ components can use the label `"card"` without affecting each other.
|
|
|
43
43
|
|
|
44
44
|
## React to a sibling's state
|
|
45
45
|
|
|
46
|
-
Without `.in()
|
|
47
|
-
sibling, add `.in()` with a ref on an element that contains both:
|
|
46
|
+
Without [`.in()`](../macros/ref/in.md), the ref must be on an ancestor of the styled
|
|
47
|
+
element. To use a sibling, add `.in()` with a ref on an element that contains both:
|
|
48
48
|
|
|
49
49
|
```tsx
|
|
50
50
|
import { style } from "stillwind/react";
|
|
@@ -69,7 +69,8 @@ export function Card() {
|
|
|
69
69
|
|
|
70
70
|
## React to a container's size
|
|
71
71
|
|
|
72
|
-
Make the element a container with `asContainer()
|
|
72
|
+
Make the element a container with [`asContainer()`](../macros/ref/as-container.md),
|
|
73
|
+
and query it with [`at()`](../macros/ref/at.md):
|
|
73
74
|
|
|
74
75
|
```tsx
|
|
75
76
|
import { style } from "stillwind/react";
|
|
@@ -87,14 +88,15 @@ export function Card() {
|
|
|
87
88
|
}
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
Pass `card` and `card.asContainer()` in the same `style()`
|
|
91
|
-
applies only to an element that has the ref, and the CLI warns
|
|
92
|
-
missing.
|
|
91
|
+
Pass `card` and `card.asContainer()` in the same [`style()`](style.md)
|
|
92
|
+
call. The container applies only to an element that has the ref, and the CLI warns
|
|
93
|
+
when the ref is missing.
|
|
93
94
|
|
|
94
95
|
## Position an element at an anchor
|
|
95
96
|
|
|
96
|
-
Make an element an anchor with `asAnchor()
|
|
97
|
-
against it with
|
|
97
|
+
Make an element an anchor with [`asAnchor()`](../macros/ref/as-anchor.md), and
|
|
98
|
+
position another element against it with
|
|
99
|
+
[`positionAnchor()`](../macros/ref/position-anchor.md):
|
|
98
100
|
|
|
99
101
|
```tsx
|
|
100
102
|
import { style } from "stillwind/react";
|
|
@@ -115,10 +117,10 @@ export function AnchoredHint() {
|
|
|
115
117
|
}
|
|
116
118
|
```
|
|
117
119
|
|
|
118
|
-
`style.anchorScope([trigger])` limits the anchor
|
|
119
|
-
each rendered `AnchoredHint` positions against its
|
|
120
|
-
generates CSS anchor positioning only. Check that the
|
|
121
|
-
implement it.
|
|
120
|
+
[`style.anchorScope([trigger])`](/docs/macros/anchor-scope) limits the anchor
|
|
121
|
+
name to the `<section>`, so each rendered `AnchoredHint` positions against its
|
|
122
|
+
own button. Stillwind generates CSS anchor positioning only. Check that the
|
|
123
|
+
browsers you support implement it.
|
|
122
124
|
|
|
123
125
|
## Share refs between components
|
|
124
126
|
|
|
@@ -132,5 +134,5 @@ The `stylistic` preset includes
|
|
|
132
134
|
[prefer-typed-relationships](../lints/prefer-typed-relationships.md). The rule
|
|
133
135
|
reports `group-*` and `peer-*` variants so that you can replace them with refs.
|
|
134
136
|
|
|
135
|
-
The [style.ref() reference](../macros/ref/index.md) lists every method and its
|
|
137
|
+
The [`style.ref()` reference](../macros/ref/index.md) lists every method and its
|
|
136
138
|
accepted inputs.
|
|
@@ -13,7 +13,8 @@ The CLI, CI, the editor, and AI agents all use the same rules from
|
|
|
13
13
|
## What the build checks
|
|
14
14
|
|
|
15
15
|
The build stops on compiler errors, such as a JavaScript syntax error or a
|
|
16
|
-
`style()` call that cannot compile. See
|
|
16
|
+
[`style()`](style.md) call that cannot compile. See
|
|
17
|
+
[Compiler errors](../errors/index.md).
|
|
17
18
|
|
|
18
19
|
The build does not run lint rules. A misspelled utility such as `bg-acent`
|
|
19
20
|
produces no CSS, and the page still renders without that style. Run the CLI or
|
|
@@ -40,7 +40,7 @@ you move its declarations.
|
|
|
40
40
|
|
|
41
41
|
Collect the colors, spacing, font sizes, radii, and breakpoints that the old
|
|
42
42
|
CSS repeats, such as Sass variables or custom properties in `:root`. Define them
|
|
43
|
-
as `@theme` tokens by role:
|
|
43
|
+
as [`@theme`](../at-rules/theme.md) tokens by role:
|
|
44
44
|
|
|
45
45
|
```css
|
|
46
46
|
@theme {
|
|
@@ -57,7 +57,7 @@ mean the same thing. Keep values separate when they are equal by chance.
|
|
|
57
57
|
## Move rules into style()
|
|
58
58
|
|
|
59
59
|
Translate the declarations of each rule into utilities, and apply them with
|
|
60
|
-
`style()` on the element:
|
|
60
|
+
[`style()`](style.md) on the element:
|
|
61
61
|
|
|
62
62
|
```css title="Button.module.css"
|
|
63
63
|
.button {
|
|
@@ -109,8 +109,8 @@ utility instead.
|
|
|
109
109
|
|
|
110
110
|
- Keep resets and base element styles until you enable the preflight reset.
|
|
111
111
|
Then remove the rules that it replaces.
|
|
112
|
-
- Move `@keyframes`
|
|
113
|
-
[style.keyframes()](../macros/keyframes.md).
|
|
112
|
+
- Move [`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
|
|
113
|
+
next to the component that uses them with [`style.keyframes()`](../macros/keyframes.md).
|
|
114
114
|
- Move styles for HTML that you do not control, such as rendered Markdown, into
|
|
115
115
|
a custom utility. See [Recommended practices](recommended-practices.md#avoid-separate-css).
|
|
116
116
|
|
|
@@ -124,5 +124,8 @@ custom property in `style()`.
|
|
|
124
124
|
## Check the migrated code
|
|
125
125
|
|
|
126
126
|
Run the [CLI checks](lint-adoption.md) over the migrated files, and
|
|
127
|
-
compare the pages with the old version in the browser.
|
|
127
|
+
compare the pages with the old version in the browser. To compare them
|
|
128
|
+
precisely, use the method in
|
|
129
|
+
[Compare computed styles](migrating-from-tailwind.md#compare-computed-styles),
|
|
130
|
+
which works the same way for a migration from CSS. After you remove the last
|
|
128
131
|
old stylesheet, switch to `@import "stillwind"` and check the pages again.
|