stillwind 0.7.0 → 0.9.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/CHANGELOG.md +193 -0
- package/css/builtin-variants/sw-conditional.css +10 -1
- package/css/builtin-variants/tw-relationship.css +4 -4
- package/css/builtins.css +1 -1
- package/dist/{class-object-D7ZGJOf_.d.ts → class-object-BaK8uudd.d.ts} +2 -2
- package/dist/class-object-DNcjzcfH.js +6 -0
- package/dist/{class-object-D24FFYqO.js.map → class-object-DNcjzcfH.js.map} +1 -1
- package/dist/{class-string-CQHnc9GN.d.ts → class-string-C5YFtXQn.d.ts} +2 -2
- package/dist/class-string-KnYInbiw.js +6 -0
- package/dist/{class-string-Db8-oI4q.js.map → class-string-KnYInbiw.js.map} +1 -1
- package/dist/{cva-BwX07CFw.js → formats-Ctf2WFc-.js} +87 -2
- package/dist/formats-Ctf2WFc-.js.map +1 -0
- package/dist/formats-aeLCNAXl.d.ts +73 -0
- package/dist/frameworks/alpine.d.ts +3 -3
- package/dist/frameworks/alpine.js +1 -1
- package/dist/frameworks/alpine.js.map +1 -1
- package/dist/frameworks/astro.d.ts +3 -3
- package/dist/frameworks/astro.js +1 -1
- package/dist/frameworks/lit.d.ts +3 -3
- package/dist/frameworks/lit.js +1 -1
- package/dist/frameworks/lit.js.map +1 -1
- package/dist/frameworks/preact.d.ts +3 -3
- package/dist/frameworks/preact.js +1 -1
- package/dist/frameworks/qwik.d.ts +3 -3
- package/dist/frameworks/qwik.js +1 -1
- package/dist/frameworks/react.d.ts +2 -2
- package/dist/frameworks/react.js +1 -1
- package/dist/frameworks/solid.d.ts +3 -3
- package/dist/frameworks/solid.js +1 -1
- package/dist/frameworks/svelte.d.ts +3 -3
- package/dist/frameworks/svelte.js +1 -1
- package/dist/frameworks/vanilla.d.ts +3 -3
- package/dist/frameworks/vanilla.js +1 -1
- package/dist/frameworks/vue.d.ts +3 -3
- package/dist/frameworks/vue.js +1 -1
- package/dist/{index-RwVFpxhE.d.ts → index-DBpgaaD7.d.ts} +54 -5
- package/dist/macro/index.d.ts +2 -2
- package/dist/macro/index.js +1 -1
- package/dist/runtime/development.d.ts +47 -0
- package/dist/{development-J-JCSIm0.js → runtime/development.js} +41 -5
- package/dist/runtime/development.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/{style-fTQbsVWZ.js → style-BE8vuLiO.js} +4 -1
- package/dist/style-BE8vuLiO.js.map +1 -0
- package/docs/at-rules/apply.md +5 -5
- package/docs/at-rules/custom-variant.md +12 -12
- package/docs/at-rules/index.md +19 -19
- package/docs/at-rules/plugin.md +7 -7
- package/docs/at-rules/registry-directives.md +9 -9
- package/docs/at-rules/slot.md +6 -6
- package/docs/at-rules/stillwind-css-template.md +7 -7
- package/docs/at-rules/stillwind-property.md +10 -10
- package/docs/at-rules/stillwind-registry.md +18 -18
- package/docs/at-rules/stillwind-require-properties.md +9 -9
- package/docs/at-rules/stillwind-slot.md +6 -6
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +9 -9
- package/docs/at-rules/stillwind-undef-utility.md +10 -10
- package/docs/at-rules/stillwind-undef-variant.md +6 -6
- package/docs/at-rules/theme.md +23 -23
- package/docs/at-rules/utility.md +30 -30
- package/docs/at-rules/variant.md +6 -6
- package/docs/cli.md +11 -8
- package/docs/concepts/css-ordering.md +19 -19
- package/docs/concepts/how-styles-compile.md +17 -17
- package/docs/concepts/stylesheets.md +4 -4
- package/docs/configuration.md +34 -34
- package/docs/editors.md +9 -8
- package/docs/errors/SW01003.md +1 -1
- package/docs/errors/SW10001.md +1 -1
- package/docs/errors/SW10002.md +1 -1
- package/docs/errors/SW10004.md +7 -6
- package/docs/errors/SW10005.md +1 -1
- package/docs/errors/SW11001.md +1 -1
- package/docs/errors/SW11003.md +1 -1
- package/docs/errors/SW12001.md +2 -2
- package/docs/errors/SW12002.md +1 -1
- package/docs/errors/SW13001.md +1 -1
- package/docs/errors/SW13003.md +2 -2
- package/docs/errors/SW14001.md +1 -1
- package/docs/errors/SW14003.md +4 -4
- package/docs/errors/SW14004.md +2 -2
- package/docs/errors/SW14005.md +1 -1
- package/docs/errors/SW14006.md +1 -1
- package/docs/errors/SW14007.md +2 -2
- package/docs/errors/SW14008.md +1 -1
- package/docs/errors/SW30001.md +1 -1
- package/docs/errors/SW31001.md +1 -1
- package/docs/errors/SW31004.md +1 -1
- package/docs/errors/SW33005.md +1 -1
- package/docs/errors/SW34002.md +1 -1
- package/docs/errors/SW90001.md +1 -1
- package/docs/errors/SW90005.md +1 -1
- package/docs/errors/SW90006.md +1 -1
- package/docs/errors/index.md +72 -72
- package/docs/formatters.md +5 -5
- package/docs/guides/animations.md +7 -8
- package/docs/guides/design-systems.md +7 -7
- package/docs/guides/element-relationships.md +15 -19
- package/docs/guides/lint-adoption.md +5 -5
- package/docs/guides/migrating-from-css.md +11 -11
- package/docs/guides/migrating-from-tailwind.md +16 -16
- package/docs/guides/recommended-practices.md +18 -18
- package/docs/guides/responsive-styles.md +7 -7
- package/docs/guides/reusable-styles.md +10 -5
- package/docs/guides/runtime-conditions.md +6 -6
- package/docs/guides/style.md +42 -10
- package/docs/guides/tailwind-compatibility.md +23 -22
- package/docs/guides/view-transitions.md +9 -11
- package/docs/guides/web-components.md +4 -4
- package/docs/index.md +14 -12
- package/docs/integrations.md +3 -3
- package/docs/lints/ambiguous-style-base-order.md +4 -2
- package/docs/lints/bypassed-undefinition.md +3 -3
- package/docs/lints/clamped-value.md +1 -1
- package/docs/lints/conflicting-provider-properties.md +2 -2
- package/docs/lints/conflicting-utilities.md +45 -3
- package/docs/lints/document-scoped-selector.md +1 -1
- package/docs/lints/duplicate-definition.md +3 -3
- package/docs/lints/duplicate-utility.md +2 -2
- package/docs/lints/duplicate-view-transition-name.md +3 -3
- package/docs/lints/ignored-definition-condition.md +2 -2
- package/docs/lints/ignored-tailwind-feature.md +3 -3
- package/docs/lints/implicit-nesting-selector.md +2 -2
- package/docs/lints/incompatible-property-value.md +3 -3
- package/docs/lints/incompatible-theme-value.md +1 -1
- package/docs/lints/index.md +74 -73
- package/docs/lints/ineffective-anchor-scope.md +2 -2
- package/docs/lints/interfering-imported-style-base.md +22 -4
- package/docs/lints/invalid-animation-option.md +3 -3
- package/docs/lints/invalid-css-directive.md +3 -3
- package/docs/lints/invalid-css-import.md +2 -2
- package/docs/lints/invalid-css-input.md +4 -4
- package/docs/lints/invalid-cva-config.md +2 -2
- package/docs/lints/invalid-cva-input.md +4 -4
- package/docs/lints/invalid-keyframes-definition.md +2 -2
- package/docs/lints/invalid-keyframes-use.md +2 -2
- package/docs/lints/invalid-keyframes-variant.md +4 -4
- package/docs/lints/invalid-lint-suppression.md +3 -3
- package/docs/lints/invalid-marker-use.md +2 -2
- package/docs/lints/invalid-media-query.md +4 -4
- package/docs/lints/invalid-ref-input.md +4 -4
- package/docs/lints/invalid-rule-group-input.md +2 -2
- package/docs/lints/invalid-runtime-condition.md +3 -3
- package/docs/lints/invalid-stored-variant.md +52 -0
- package/docs/lints/invalid-style-composition.md +2 -2
- package/docs/lints/invalid-style-input.md +2 -2
- package/docs/lints/invalid-theme-reference.md +3 -3
- package/docs/lints/invalid-utility.md +3 -3
- package/docs/lints/invalid-variant.md +2 -2
- package/docs/lints/invalid-view-transition-definition.md +2 -2
- package/docs/lints/invalid-view-transition-use.md +2 -2
- package/docs/lints/invalid-view-transition-variant.md +3 -3
- package/docs/lints/mismatched-framework-import.md +3 -3
- package/docs/lints/missing-document-target.md +2 -2
- package/docs/lints/missing-ref-attachment.md +4 -4
- package/docs/lints/missing-view-transition-name.md +3 -3
- package/docs/lints/mutating-macro-argument.md +2 -2
- package/docs/lints/no-arbitrary-breakpoints.md +2 -2
- package/docs/lints/no-arbitrary-colors.md +2 -2
- package/docs/lints/no-arbitrary-spacing.md +1 -1
- package/docs/lints/no-class-property.md +3 -3
- package/docs/lints/no-important.md +2 -2
- package/docs/lints/no-restricted-declarations.md +1 -1
- package/docs/lints/no-restricted-length-units.md +1 -1
- package/docs/lints/no-restricted-theme-tokens.md +1 -1
- package/docs/lints/no-restricted-utilities.md +2 -2
- package/docs/lints/prefer-canonical-utilities.md +2 -2
- package/docs/lints/prefer-direct-styling.md +3 -3
- package/docs/lints/prefer-logical-properties.md +3 -3
- package/docs/lints/prefer-sorted-utilities.md +2 -2
- package/docs/lints/prefer-typed-relationships.md +3 -3
- package/docs/lints/prefer-typed-variables.md +1 -1
- package/docs/lints/prefer-variant-directive.md +3 -3
- package/docs/lints/redundant-variant.md +2 -2
- package/docs/lints/repeated-nesting-selector.md +2 -2
- package/docs/lints/runtime-condition-requires-css-if.md +3 -3
- package/docs/lints/split-view-transition-class.md +3 -3
- package/docs/lints/suspending-macro-argument.md +2 -2
- package/docs/lints/unknown-utility.md +4 -4
- package/docs/lints/unknown-variant.md +2 -2
- package/docs/lints/unmatched-host-selector.md +2 -2
- package/docs/lints/unsatisfiable-variants.md +1 -1
- package/docs/lints/unused-lint-suppression.md +1 -1
- package/docs/lints/unverified-style-base.md +2 -2
- package/docs/macros/anchor-scope.md +13 -13
- package/docs/macros/css.md +7 -7
- package/docs/macros/cva.md +17 -16
- package/docs/macros/index.md +10 -9
- package/docs/macros/keyframes.md +9 -9
- package/docs/macros/media.md +2 -2
- package/docs/macros/ref/as-anchor.md +11 -11
- package/docs/macros/ref/as-container.md +8 -8
- package/docs/macros/ref/at.md +10 -10
- package/docs/macros/ref/condition.md +9 -8
- package/docs/macros/ref/in.md +11 -11
- package/docs/macros/ref/index.md +17 -16
- package/docs/macros/ref/position-anchor.md +9 -9
- package/docs/macros/style.md +53 -27
- package/docs/macros/view-transition.md +17 -17
- package/docs/macros/when.md +129 -0
- package/docs/plugins/iconify.md +5 -5
- package/docs/plugins/index.md +4 -4
- package/docs/utilities-and-variants.md +6 -6
- package/docs/why.md +13 -15
- package/package.json +14 -28
- package/dist/class-object-D24FFYqO.js +0 -6
- package/dist/class-string-Db8-oI4q.js +0 -6
- package/dist/cva-BwX07CFw.js.map +0 -1
- package/dist/cva-DSpDNBYi.d.ts +0 -9
- package/dist/development-DttPQc71.d.ts +0 -27
- package/dist/development-J-JCSIm0.js.map +0 -1
- package/dist/runtime/class-name-object-development.d.ts +0 -10
- package/dist/runtime/class-name-object-development.js +0 -18
- package/dist/runtime/class-name-object-development.js.map +0 -1
- package/dist/runtime/class-name-object.d.ts +0 -16
- package/dist/runtime/class-name-object.js +0 -31
- package/dist/runtime/class-name-object.js.map +0 -1
- package/dist/runtime/class-object-development.d.ts +0 -10
- package/dist/runtime/class-object-development.js +0 -18
- package/dist/runtime/class-object-development.js.map +0 -1
- package/dist/runtime/class-object.d.ts +0 -16
- package/dist/runtime/class-object.js +0 -31
- package/dist/runtime/class-object.js.map +0 -1
- package/dist/runtime/class-string-development.d.ts +0 -10
- package/dist/runtime/class-string-development.js +0 -18
- package/dist/runtime/class-string-development.js.map +0 -1
- package/dist/runtime/class-string.d.ts +0 -16
- package/dist/runtime/class-string.js +0 -31
- package/dist/runtime/class-string.js.map +0 -1
- package/dist/shared-B9IQXU6P.d.ts +0 -32
- package/dist/style-fTQbsVWZ.js.map +0 -1
|
@@ -10,7 +10,7 @@ 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()`](style
|
|
13
|
+
Write the utilities in a [`style()`](https://stillwind.dev/docs/guides/style) call on the element that
|
|
14
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
|
|
@@ -64,7 +64,7 @@ apply:
|
|
|
64
64
|
call, and read it in a utility such as `w-(--progress)`.
|
|
65
65
|
|
|
66
66
|
Use a condition such as `selected && "bg-blue-50"` only when no attribute fits.
|
|
67
|
-
[Reusable styles](reusable-styles
|
|
67
|
+
[Reusable styles](https://stillwind.dev/docs/guides/reusable-styles) shows each approach.
|
|
68
68
|
|
|
69
69
|
Do not track in JavaScript a state that CSS can detect, such as hover, focus,
|
|
70
70
|
or the width of a container. Use the matching variant, and keep component state
|
|
@@ -74,7 +74,7 @@ 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()`](
|
|
77
|
+
[`style.ref()`](https://stillwind.dev/docs/macros/ref). Do not use `group-*`, `peer-*`, named
|
|
78
78
|
containers, or hand-written parent and sibling selectors:
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
@@ -92,13 +92,13 @@ export function Card() {
|
|
|
92
92
|
|
|
93
93
|
A ref is a variable, so TypeScript reports a misspelled ref, and two components
|
|
94
94
|
cannot collide on the same name. Anchors for anchor positioning use refs too.
|
|
95
|
-
[Element relationships](element-relationships
|
|
95
|
+
[Element relationships](https://stillwind.dev/docs/guides/element-relationships) covers siblings,
|
|
96
96
|
containers, and anchors.
|
|
97
97
|
|
|
98
98
|
## Define animations in their components
|
|
99
99
|
|
|
100
|
-
Define keyframes with [`style.keyframes()`](
|
|
101
|
-
transitions with [`style.viewTransition()`](
|
|
100
|
+
Define keyframes with [`style.keyframes()`](https://stillwind.dev/docs/macros/keyframes) and view
|
|
101
|
+
transitions with [`style.viewTransition()`](https://stillwind.dev/docs/macros/view-transition) in
|
|
102
102
|
the code that uses them. Do not add global
|
|
103
103
|
[`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
|
|
104
104
|
rules or fixed
|
|
@@ -187,7 +187,7 @@ attribute form, the attribute selector adds specificity, and the variant order
|
|
|
187
187
|
places the rules after the common styles. In the lookup form, the compiler
|
|
188
188
|
places the utilities that a condition selects after the unconditional
|
|
189
189
|
utilities. More specific selectors and `!important` can still change the
|
|
190
|
-
result. [CSS ordering](
|
|
190
|
+
result. [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering) describes these rules.
|
|
191
191
|
|
|
192
192
|
## Group utilities by variant
|
|
193
193
|
|
|
@@ -217,21 +217,21 @@ from a long string.
|
|
|
217
217
|
> The value of `""` accepts only the inputs that a variant group accepts. Write ref attachments,
|
|
218
218
|
> `class` values, custom properties, and bases directly in the `style()` arguments, outside the
|
|
219
219
|
> object. Otherwise the CLI reports
|
|
220
|
-
> [invalid-rule-group-input](
|
|
220
|
+
> [invalid-rule-group-input](https://stillwind.dev/docs/lints/invalid-rule-group-input), and the compiler omits the whole
|
|
221
221
|
> group. Ref projections, keyframes uses, and view-transition uses can appear in the group.
|
|
222
222
|
|
|
223
223
|
## Keep values in the theme
|
|
224
224
|
|
|
225
|
-
Define colors, spacing, and breakpoints as [`@theme`](
|
|
225
|
+
Define colors, spacing, and breakpoints as [`@theme`](https://stillwind.dev/docs/at-rules/theme) tokens, and
|
|
226
226
|
use the utilities that they add. Avoid arbitrary values such as `text-[#abcdef]` and
|
|
227
|
-
`max-[768px]:`. [Design systems](design-systems
|
|
227
|
+
`max-[768px]:`. [Design systems](https://stillwind.dev/docs/guides/design-systems) enables lint
|
|
228
228
|
rules that report them.
|
|
229
229
|
|
|
230
230
|
## Choose how to define themes
|
|
231
231
|
|
|
232
232
|
When the application has only a light and a dark theme, define each color
|
|
233
233
|
token with `light-dark()`, and let `color-scheme` select the value.
|
|
234
|
-
[Design systems](design-systems
|
|
234
|
+
[Design systems](https://stillwind.dev/docs/guides/design-systems) shows this setup.
|
|
235
235
|
|
|
236
236
|
When the application can have more themes, `light-dark()` cannot express them.
|
|
237
237
|
Define the tokens as ordinary values, and override them for each theme with an
|
|
@@ -261,7 +261,7 @@ Set `data-theme` on the root element, or on a container to theme part of the
|
|
|
261
261
|
page. The utilities, such as `bg-surface`, stay the same in every theme.
|
|
262
262
|
|
|
263
263
|
When a theme needs styles beyond its tokens, define a variant for it with
|
|
264
|
-
[`@custom-variant`](
|
|
264
|
+
[`@custom-variant`](https://stillwind.dev/docs/at-rules/custom-variant), and use the variant instead
|
|
265
265
|
of a hand-written selector:
|
|
266
266
|
|
|
267
267
|
```css
|
|
@@ -271,7 +271,7 @@ of a hand-written selector:
|
|
|
271
271
|
## Use breakpoints from the theme in JavaScript
|
|
272
272
|
|
|
273
273
|
When JavaScript needs a breakpoint, get its media query with
|
|
274
|
-
[`style.media()`](
|
|
274
|
+
[`style.media()`](https://stillwind.dev/docs/macros/media) instead of repeating the value:
|
|
275
275
|
|
|
276
276
|
```ts
|
|
277
277
|
import { style } from "stillwind/react";
|
|
@@ -281,11 +281,11 @@ const sidebar = window.matchMedia(style.media("sidebar"));
|
|
|
281
281
|
|
|
282
282
|
A query such as `matchMedia("(width >= 52.5rem)")` does not follow a later
|
|
283
283
|
change of the breakpoint in the theme. Prefer a variant when CSS alone can make the
|
|
284
|
-
change. [Responsive styles](responsive-styles
|
|
284
|
+
change. [Responsive styles](https://stillwind.dev/docs/guides/responsive-styles) shows more uses.
|
|
285
285
|
|
|
286
286
|
## Define utilities with @apply
|
|
287
287
|
|
|
288
|
-
Write the body of a custom utility with [`@apply`](
|
|
288
|
+
Write the body of a custom utility with [`@apply`](https://stillwind.dev/docs/at-rules/apply), and
|
|
289
289
|
write its conditions as variants:
|
|
290
290
|
|
|
291
291
|
```css
|
|
@@ -298,14 +298,14 @@ Do not write selectors or media queries by hand. The variants follow your
|
|
|
298
298
|
theme, and they avoid differences that are easy to miss. For example, the
|
|
299
299
|
`hover:` variant applies only on devices that can hover, while a plain `:hover`
|
|
300
300
|
rule stays active after a tap on a touch screen. Inside a style rule, use
|
|
301
|
-
[`@variant`](
|
|
301
|
+
[`@variant`](https://stillwind.dev/docs/at-rules/variant) instead of a condition.
|
|
302
302
|
|
|
303
303
|
## Avoid separate CSS
|
|
304
304
|
|
|
305
305
|
Write styles in `style()` calls and custom utilities, not in CSS files with
|
|
306
306
|
your own class names. A custom utility works with every variant, such as
|
|
307
307
|
`hover:link`, and a fixed class name does not. For a reusable condition, define
|
|
308
|
-
a variant with [`@custom-variant`](
|
|
308
|
+
a variant with [`@custom-variant`](https://stillwind.dev/docs/at-rules/custom-variant) instead of
|
|
309
309
|
writing its selector in several rules.
|
|
310
310
|
|
|
311
311
|
For HTML that you do not control, such as rendered Markdown, define the styles
|
|
@@ -317,7 +317,7 @@ plugin such as `@tailwindcss/typography`.
|
|
|
317
317
|
Run `stillwind lint --fix` and `stillwind fmt` after you change styles, and fix
|
|
318
318
|
the remaining findings. Add a suppression comment only for a deliberate
|
|
319
319
|
exception, and give the reason. See
|
|
320
|
-
[Checks in the editor and CI](lint-adoption
|
|
320
|
+
[Checks in the editor and CI](https://stillwind.dev/docs/guides/lint-adoption).
|
|
321
321
|
|
|
322
322
|
## Mistakes that produce no CSS
|
|
323
323
|
|
|
@@ -52,14 +52,14 @@ export function Layout() {
|
|
|
52
52
|
|
|
53
53
|
## Use breakpoints in authored CSS
|
|
54
54
|
|
|
55
|
-
In a CSS rule, nest [`@variant`](
|
|
56
|
-
as in the `.navigation` rule above. In an [`@utility`](
|
|
57
|
-
definition, use the variant in [`@apply`](
|
|
55
|
+
In a CSS rule, nest [`@variant`](https://stillwind.dev/docs/at-rules/variant) with the breakpoint name,
|
|
56
|
+
as in the `.navigation` rule above. In an [`@utility`](https://stillwind.dev/docs/at-rules/utility)
|
|
57
|
+
definition, use the variant in [`@apply`](https://stillwind.dev/docs/at-rules/apply) instead, such as
|
|
58
58
|
`@apply inline:flex-row`.
|
|
59
59
|
|
|
60
60
|
## Use breakpoints in JavaScript
|
|
61
61
|
|
|
62
|
-
[`style.media()`](
|
|
62
|
+
[`style.media()`](https://stillwind.dev/docs/macros/media) returns the media query for a breakpoint name:
|
|
63
63
|
|
|
64
64
|
```ts
|
|
65
65
|
import { style } from "stillwind/react";
|
|
@@ -97,10 +97,10 @@ conditions only. Element states such as `hover` are not media conditions.
|
|
|
97
97
|
|
|
98
98
|
## Report widths outside your breakpoints
|
|
99
99
|
|
|
100
|
-
The [no-arbitrary-breakpoints](
|
|
100
|
+
The [no-arbitrary-breakpoints](https://stillwind.dev/docs/lints/no-arbitrary-breakpoints) rule
|
|
101
101
|
reports widths written as values, such as `min-[713px]:`. See
|
|
102
|
-
[Design systems](design-systems
|
|
102
|
+
[Design systems](https://stillwind.dev/docs/guides/design-systems#report-values-outside-the-theme)
|
|
103
103
|
to enable it.
|
|
104
104
|
|
|
105
105
|
To respond to the width of a component instead of the viewport, use a container
|
|
106
|
-
query. See [Element relationships](element-relationships
|
|
106
|
+
query. See [Element relationships](https://stillwind.dev/docs/guides/element-relationships#react-to-a-containers-size).
|
|
@@ -12,7 +12,7 @@ which styles apply.
|
|
|
12
12
|
|
|
13
13
|
## Share a base style
|
|
14
14
|
|
|
15
|
-
Store a [`style()`](style
|
|
15
|
+
Store a [`style()`](https://stillwind.dev/docs/guides/style) result, and pass it to other `style()`
|
|
16
16
|
calls. You can export the base and import it in other modules:
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
@@ -39,13 +39,18 @@ colors. Their CSS comes after the base's CSS, and their selectors have equal
|
|
|
39
39
|
specificity. The order of the class names does not affect the result.
|
|
40
40
|
|
|
41
41
|
A base's `hover:` selector can be more specific than a plain class in the
|
|
42
|
-
derived style. [CSS ordering](
|
|
42
|
+
derived style. [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering) explains variants,
|
|
43
43
|
conditions, and multiple bases.
|
|
44
44
|
|
|
45
45
|
A base passes on its classes only. Custom properties such as
|
|
46
46
|
`{ "--progress": value }` in the base do not carry over, and the CLI reports
|
|
47
47
|
them. Set custom properties in the `style()` call that is spread onto the element.
|
|
48
48
|
|
|
49
|
+
Keep the inferred type of an exported base. When TypeScript emits declaration
|
|
50
|
+
files, it writes that type with `StyleResultOf` from the framework's entrypoint.
|
|
51
|
+
A type annotation such as `StyleResult<string>` hides the identity of the base,
|
|
52
|
+
and Stillwind then cannot find the styles of the base.
|
|
53
|
+
|
|
49
54
|
## Express states with variants
|
|
50
55
|
|
|
51
56
|
Set the state as an attribute, and style it with a variant:
|
|
@@ -100,11 +105,11 @@ test queries.
|
|
|
100
105
|
|
|
101
106
|
For a value from a continuous range, such as a width or a progress percentage,
|
|
102
107
|
set a custom property instead. See
|
|
103
|
-
[Use runtime values](style
|
|
108
|
+
[Use runtime values](https://stillwind.dev/docs/guides/style#use-runtime-values).
|
|
104
109
|
|
|
105
110
|
## Migrate CVA components
|
|
106
111
|
|
|
107
112
|
`style.cva()` accepts the configuration of `cva` from class-variance-authority.
|
|
108
113
|
Use it to migrate existing CVA components. See
|
|
109
|
-
[Replace class helpers](migrating-from-tailwind
|
|
110
|
-
and the [`style.cva()` reference](
|
|
114
|
+
[Replace class helpers](https://stillwind.dev/docs/guides/migrating-from-tailwind#replace-class-helpers)
|
|
115
|
+
and the [`style.cva()` reference](https://stillwind.dev/docs/macros/cva).
|
|
@@ -42,7 +42,7 @@ element needs a second set of classes for the compact state.
|
|
|
42
42
|
|
|
43
43
|
## Choose an approach
|
|
44
44
|
|
|
45
|
-
[Style states](style
|
|
45
|
+
[Style states](https://stillwind.dev/docs/guides/style#style-states) shows the two approaches that most
|
|
46
46
|
states need:
|
|
47
47
|
|
|
48
48
|
- When an attribute represents the state, such as `disabled` or `aria-expanded`,
|
|
@@ -77,7 +77,7 @@ because the registration changes its initial value.
|
|
|
77
77
|
|
|
78
78
|
The browser evaluates the condition on the styled element. To test the state of
|
|
79
79
|
another element, pass that state down with the custom property. A condition inside a
|
|
80
|
-
[ref](
|
|
80
|
+
[ref](https://stillwind.dev/docs/macros/ref) wrapper is rejected, so write `if()` outside the wrapper.
|
|
81
81
|
|
|
82
82
|
## Combine conditions
|
|
83
83
|
|
|
@@ -162,12 +162,12 @@ registration of the custom property. A comparison value can contain a comma only
|
|
|
162
162
|
inside a CSS function or a quoted string.
|
|
163
163
|
|
|
164
164
|
The compiler leaves out a utility that it cannot express. Then
|
|
165
|
-
[runtime-condition-requires-css-if](
|
|
165
|
+
[runtime-condition-requires-css-if](https://stillwind.dev/docs/lints/runtime-condition-requires-css-if)
|
|
166
166
|
reports the utility. In a stylesheet,
|
|
167
|
-
[invalid-runtime-condition](
|
|
167
|
+
[invalid-runtime-condition](https://stillwind.dev/docs/lints/invalid-runtime-condition) reports the
|
|
168
168
|
declaration. A malformed condition reports
|
|
169
|
-
[invalid-variant](
|
|
170
|
-
[invalid-utility](
|
|
169
|
+
[invalid-variant](https://stillwind.dev/docs/lints/invalid-variant) or
|
|
170
|
+
[invalid-utility](https://stillwind.dev/docs/lints/invalid-utility).
|
|
171
171
|
|
|
172
172
|
## Browser support
|
|
173
173
|
|
package/docs/guides/style.md
CHANGED
|
@@ -8,7 +8,7 @@ description: "Apply utilities, variants, conditions, overrides, and runtime valu
|
|
|
8
8
|
`style()` takes Tailwind CSS v4 utilities and returns props for an element.
|
|
9
9
|
You spread the props onto the element instead of writing a `className` string.
|
|
10
10
|
This page uses React. For other frameworks, import `style` from the entrypoint
|
|
11
|
-
listed in [Framework integrations](
|
|
11
|
+
listed in [Framework integrations](https://stillwind.dev/docs/integrations).
|
|
12
12
|
|
|
13
13
|
## Apply utilities
|
|
14
14
|
|
|
@@ -29,7 +29,7 @@ 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`](
|
|
32
|
+
selects. A token that you add to [`@theme`](https://stillwind.dev/docs/at-rules/theme) adds utilities,
|
|
33
33
|
such as `bg-accent` for `--color-accent`.
|
|
34
34
|
|
|
35
35
|
## Add variants
|
|
@@ -63,6 +63,27 @@ export function Link() {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
### Match any of several variants
|
|
67
|
+
|
|
68
|
+
`or(...)` applies a utility when any of its variants matches. Separate the
|
|
69
|
+
variants with commas. Each one can contain several variants separated by colons:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { style } from "stillwind/react";
|
|
73
|
+
|
|
74
|
+
export function MenuItem() {
|
|
75
|
+
return <li {...style("px-4 py-2 or(hover,focus-within,md:aria-current):bg-gray-100")}>Inbox</li>;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`or(hover,md:focus):p-4` is the same as `hover:p-4 md:focus:p-4`. Each
|
|
80
|
+
variant keeps the position in the stylesheet that it has when you write it alone,
|
|
81
|
+
so [CSS order](https://stillwind.dev/docs/concepts/css-ordering) does not change. You can also use
|
|
82
|
+
`or(...)` in an object key, such as `{ "or(hover,focus):": "underline" }`.
|
|
83
|
+
To reuse alternatives that include
|
|
84
|
+
[ref conditions](https://stillwind.dev/docs/macros/ref/condition), pass several arguments to
|
|
85
|
+
[`style.when()`](https://stillwind.dev/docs/macros/when#alternatives).
|
|
86
|
+
|
|
66
87
|
## Style states
|
|
67
88
|
|
|
68
89
|
When the element has an attribute for the state, use a variant:
|
|
@@ -85,7 +106,7 @@ export function SaveButton({ loading }: { loading: boolean }) {
|
|
|
85
106
|
```
|
|
86
107
|
|
|
87
108
|
The element keeps the same classes, and the browser applies the `disabled:`
|
|
88
|
-
styles while the button is disabled. [Reusable styles](reusable-styles
|
|
109
|
+
styles while the button is disabled. [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles)
|
|
89
110
|
shows the same approach with `aria-*` and `data-*` attributes.
|
|
90
111
|
|
|
91
112
|
When no attribute represents the state, pass a condition and a string, as with `clsx`:
|
|
@@ -125,14 +146,25 @@ export function DeleteButton() {
|
|
|
125
146
|
In this example, `dangerButton` has a red background because both background
|
|
126
147
|
rules use equally specific selectors. The order of the class names does not
|
|
127
148
|
affect the result. You can export a stored style and use it in other modules.
|
|
149
|
+
When another module adds utilities that set the same property as the imported
|
|
150
|
+
style, [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base)
|
|
151
|
+
reports the call. Define the overriding style in the module that defines the
|
|
152
|
+
base, and import that style instead.
|
|
153
|
+
|
|
154
|
+
The order of the arguments does not affect the result either.
|
|
155
|
+
`style("bg-red-600", button)` also produces a red background, and
|
|
156
|
+
`style("p-4", "p-2")` produces the same CSS as `style("p-2", "p-4")`. To change
|
|
157
|
+
which utility wins, remove the other utility or build a new style on a base. Do
|
|
158
|
+
not reorder the arguments. See [Argument order](https://stillwind.dev/docs/macros/style#argument-order)
|
|
159
|
+
for the exceptions.
|
|
128
160
|
|
|
129
161
|
More specific selectors and `!important` can change which declaration wins.
|
|
130
|
-
See [CSS ordering](
|
|
162
|
+
See [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering) for variants, conditions, and multiple
|
|
131
163
|
bases.
|
|
132
164
|
|
|
133
165
|
Store the inner style in a variable first. A `style()` call written directly
|
|
134
166
|
inside another, such as `style(style("p-4"), "text-sm")`, is not supported.
|
|
135
|
-
[Reusable styles](reusable-styles
|
|
167
|
+
[Reusable styles](https://stillwind.dev/docs/guides/reusable-styles) covers shared styles and
|
|
136
168
|
component options in more detail.
|
|
137
169
|
|
|
138
170
|
## Use runtime values
|
|
@@ -152,7 +184,7 @@ export function Progress({ value }: { value: number }) {
|
|
|
152
184
|
|
|
153
185
|
The utility `w-(--progress)` stays the same, so its CSS is generated at build
|
|
154
186
|
time. Only the value of `--progress` changes at runtime. To change utilities with
|
|
155
|
-
a custom property, see [Runtime conditions](runtime-conditions
|
|
187
|
+
a custom property, see [Runtime conditions](https://stillwind.dev/docs/guides/runtime-conditions).
|
|
156
188
|
|
|
157
189
|
## Add classes from other stylesheets
|
|
158
190
|
|
|
@@ -176,7 +208,7 @@ such as state updates or I/O, before you call `style()`.
|
|
|
176
208
|
|
|
177
209
|
## Next steps
|
|
178
210
|
|
|
179
|
-
- [Reusable styles](reusable-styles
|
|
180
|
-
- [Responsive styles](responsive-styles
|
|
181
|
-
- [Checks in the editor and CI](lint-adoption
|
|
182
|
-
- [The `style()` reference](
|
|
211
|
+
- [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles): how to share styles and define component options
|
|
212
|
+
- [Responsive styles](https://stillwind.dev/docs/guides/responsive-styles): how to name breakpoints and use them in JavaScript
|
|
213
|
+
- [Checks in the editor and CI](https://stillwind.dev/docs/guides/lint-adoption): how to find misspelled utilities and other mistakes
|
|
214
|
+
- [The `style()` reference](https://stillwind.dev/docs/macros/style): every accepted input
|
|
@@ -7,12 +7,12 @@ description: "Check which Tailwind CSS v4 features, plugins, and CSS packages wo
|
|
|
7
7
|
|
|
8
8
|
Stillwind supports the utilities, variants, theme, CSS directives, and plugins of
|
|
9
9
|
Tailwind CSS v4. To move a project, follow
|
|
10
|
-
[Migrating from Tailwind CSS](migrating-from-tailwind
|
|
10
|
+
[Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind). This page
|
|
11
11
|
lists what works, how Stillwind checks it, what Stillwind adds, and where it differs.
|
|
12
12
|
|
|
13
13
|
For the usage of Tailwind features, see the
|
|
14
14
|
[Tailwind CSS documentation](https://tailwindcss.com/docs). To check the CSS of a
|
|
15
|
-
utility or variant, use [Built-in utilities and variants](
|
|
15
|
+
utility or variant, use [Built-in utilities and variants](https://stillwind.dev/docs/utilities-and-variants).
|
|
16
16
|
|
|
17
17
|
## What works
|
|
18
18
|
|
|
@@ -20,11 +20,11 @@ utility or variant, use [Built-in utilities and variants](../utilities-and-varia
|
|
|
20
20
|
| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
21
21
|
| Default theme and preflight | Included in `@import "stillwind"` |
|
|
22
22
|
| Utilities and variants | Supported, including arbitrary values, modifiers, and `!` |
|
|
23
|
-
| [`@theme`](
|
|
24
|
-
| [`@apply`](
|
|
23
|
+
| [`@theme`](https://stillwind.dev/docs/at-rules/theme), [`@utility`](https://stillwind.dev/docs/at-rules/utility), [`@custom-variant`](https://stillwind.dev/docs/at-rules/custom-variant) | Supported |
|
|
24
|
+
| [`@apply`](https://stillwind.dev/docs/at-rules/apply), [`@variant`](https://stillwind.dev/docs/at-rules/variant) | Supported |
|
|
25
25
|
| `--theme()`, `--spacing()`, `--alpha()` | Supported |
|
|
26
26
|
| `theme(--color-red-500)` | Supported; v3 paths such as `theme(colors.red.500)` are not |
|
|
27
|
-
| [`@plugin`](
|
|
27
|
+
| [`@plugin`](https://stillwind.dev/docs/at-rules/plugin) with JavaScript plugins | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
|
|
28
28
|
| `@import` of CSS packages | Supported; see [Plugins and CSS packages](#plugins-and-css-packages) |
|
|
29
29
|
| Tailwind configuration | Set the `tailwind` field of the project in `stillwind.config.ts` |
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ compilers on the same input and fails when their results differ:
|
|
|
39
39
|
and compares the computed styles in Chrome.
|
|
40
40
|
|
|
41
41
|
The declarations inside a rule can stand in a different order from Tailwind's, as
|
|
42
|
-
[CSS ordering](
|
|
42
|
+
[CSS ordering](https://stillwind.dev/docs/concepts/css-ordering) describes. The order of two declarations
|
|
43
43
|
that can affect each other stays the same, so the computed styles do not change.
|
|
44
44
|
|
|
45
45
|
## Plugins and CSS packages
|
|
@@ -64,7 +64,7 @@ Load these packages with `@plugin`:
|
|
|
64
64
|
| `@iconify/tailwind4` | `icon-[lucide--home]` |
|
|
65
65
|
|
|
66
66
|
For Iconify icons, Stillwind also provides the
|
|
67
|
-
[`@stillwind/plugin-iconify`](
|
|
67
|
+
[`@stillwind/plugin-iconify`](https://stillwind.dev/docs/plugins/iconify) plugin.
|
|
68
68
|
|
|
69
69
|
Load these packages with `@import`:
|
|
70
70
|
|
|
@@ -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`](
|
|
80
|
+
Other plugins can use the same features. [`@plugin`](https://stillwind.dev/docs/at-rules/plugin#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,24 +88,25 @@ 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()`](style
|
|
91
|
+
`prose` skip elements inside `not-prose`. [`style()`](https://stillwind.dev/docs/guides/style) keeps
|
|
92
92
|
such a class in the `class` attribute, so `style("not-prose")` adds the class
|
|
93
93
|
`not-prose`. The class keeps its name only without variants, so
|
|
94
|
-
[invalid-marker-use](
|
|
94
|
+
[invalid-marker-use](https://stillwind.dev/docs/lints/invalid-marker-use) reports `hover:not-prose`.
|
|
95
95
|
|
|
96
96
|
## What Stillwind adds
|
|
97
97
|
|
|
98
98
|
These features have no equivalent in Tailwind CSS:
|
|
99
99
|
|
|
100
|
-
| Feature | Page
|
|
101
|
-
| --------------------------------------- |
|
|
102
|
-
| `if()` variant and `--if()` function | [Runtime conditions](runtime-conditions
|
|
103
|
-
| `host:` variant | [Style the shadow host](web-components
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
100
|
+
| Feature | Page |
|
|
101
|
+
| --------------------------------------- | --------------------------------------------------------------------------------- |
|
|
102
|
+
| `if()` variant and `--if()` function | [Runtime conditions](https://stillwind.dev/docs/guides/runtime-conditions) |
|
|
103
|
+
| `host:` variant | [Style the shadow host](https://stillwind.dev/docs/guides/web-components#style-the-shadow-host) |
|
|
104
|
+
| `or(...)` variant | [Match any of several variants](https://stillwind.dev/docs/guides/style#match-any-of-several-variants) |
|
|
105
|
+
| Keyframes defined in a component | [Animations](https://stillwind.dev/docs/guides/animations) |
|
|
106
|
+
| View transitions defined in a component | [View transitions](https://stillwind.dev/docs/guides/view-transitions) |
|
|
107
|
+
| Refs to other elements | [Element relationships](https://stillwind.dev/docs/guides/element-relationships) |
|
|
108
|
+
| Logical properties for axis utilities | [Logical axis utilities](https://stillwind.dev/docs/concepts/stylesheets#logical-axis-utilities) |
|
|
109
|
+
| Lint rules | [Checks in the editor and CI](https://stillwind.dev/docs/guides/lint-adoption) |
|
|
109
110
|
|
|
110
111
|
## What Stillwind does not support
|
|
111
112
|
|
|
@@ -123,14 +124,14 @@ features have no replacement:
|
|
|
123
124
|
|
|
124
125
|
Write each utility that you need in a `style()` call in your own code. For HTML
|
|
125
126
|
that you do not control, see
|
|
126
|
-
[Avoid separate CSS](recommended-practices
|
|
127
|
+
[Avoid separate CSS](https://stillwind.dev/docs/guides/recommended-practices#avoid-separate-css).
|
|
127
128
|
|
|
128
129
|
### The tw: class prefix
|
|
129
130
|
|
|
130
131
|
Stillwind generates unique class names, so utilities do not need a prefix. Write
|
|
131
132
|
`p-4` instead of `tw:p-4`. Theme variables can still collide with other CSS in the
|
|
132
133
|
page. To prefix them, set `themePrefix` on the project, as
|
|
133
|
-
[Migrating from Tailwind CSS](migrating-from-tailwind
|
|
134
|
+
[Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind#move-configuration)
|
|
134
135
|
describes. In a plugin, `prefix()` returns the class name unchanged.
|
|
135
136
|
|
|
136
137
|
### Other differences
|
|
@@ -143,5 +144,5 @@ describes. In a plugin, `prefix()` returns the class name unchanged.
|
|
|
143
144
|
| Utilities that generate invalid CSS | Rejected, such as `justify-baseline`, because `justify-content` has no such value |
|
|
144
145
|
| `addVariant()` with the v3 `:merge()` form | Skipped, as in Tailwind CSS v4 |
|
|
145
146
|
|
|
146
|
-
[ignored-tailwind-feature](
|
|
147
|
+
[ignored-tailwind-feature](https://stillwind.dev/docs/lints/ignored-tailwind-feature) reports the
|
|
147
148
|
features in your stylesheet that have no effect.
|
|
@@ -18,17 +18,16 @@ and name each item with a key.
|
|
|
18
18
|
```tsx
|
|
19
19
|
import { style } from "stillwind/react";
|
|
20
20
|
|
|
21
|
-
const productTransition = style.viewTransition({
|
|
22
|
-
old: "duration-150 motion-reduce:duration-0",
|
|
23
|
-
new: "delay-150 duration-150 motion-reduce:delay-0 motion-reduce:duration-0",
|
|
24
|
-
});
|
|
25
|
-
|
|
26
21
|
export function Product({ id, name }: { id: string; name: string }) {
|
|
22
|
+
const productTransition = style.viewTransition({
|
|
23
|
+
old: "duration-150 motion-reduce:duration-0",
|
|
24
|
+
new: "delay-150 duration-150 motion-reduce:delay-0 motion-reduce:duration-0",
|
|
25
|
+
});
|
|
27
26
|
return <article {...style(productTransition.for(id), "rounded-lg p-4")}>{name}</article>;
|
|
28
27
|
}
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
[`style.viewTransition()`](
|
|
30
|
+
[`style.viewTransition()`](https://stillwind.dev/docs/macros/view-transition) defines the styles of
|
|
32
31
|
the snapshots. Each field styles one pseudo-element:
|
|
33
32
|
|
|
34
33
|
| Field | Pseudo-element |
|
|
@@ -64,16 +63,15 @@ the View Transition API run the update without animation.
|
|
|
64
63
|
|
|
65
64
|
## Give each element one name
|
|
66
65
|
|
|
67
|
-
Use `.for()` once for each element, in one [`style()`](style
|
|
66
|
+
Use `.for()` once for each element, in one [`style()`](https://stillwind.dev/docs/guides/style) call.
|
|
68
67
|
To combine several transitions on one element, pass the others without `.for()`:
|
|
69
68
|
|
|
70
69
|
```tsx
|
|
71
70
|
import { style } from "stillwind/react";
|
|
72
71
|
|
|
73
|
-
const fade = style.viewTransition({ old: "duration-150" });
|
|
74
|
-
const slide = style.viewTransition({ new: "duration-300" });
|
|
75
|
-
|
|
76
72
|
export function Card({ id }: { id: string }) {
|
|
73
|
+
const fade = style.viewTransition({ old: "duration-150" });
|
|
74
|
+
const slide = style.viewTransition({ new: "duration-300" });
|
|
77
75
|
return <article {...style(fade, slide.for(id))}>Card</article>;
|
|
78
76
|
}
|
|
79
77
|
```
|
|
@@ -82,5 +80,5 @@ The CLI reports a `style()` call that applies a transition without `.for()`, a
|
|
|
82
80
|
call with two `.for()` calls, and transitions split across separate `style()`
|
|
83
81
|
calls. It cannot check that keys are unique across the whole page.
|
|
84
82
|
|
|
85
|
-
The [`style.viewTransition()` reference](
|
|
83
|
+
The [`style.viewTransition()` reference](https://stillwind.dev/docs/macros/view-transition) covers
|
|
86
84
|
dynamic keys and the generated CSS.
|
|
@@ -41,7 +41,7 @@ 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()`](style
|
|
44
|
+
contains the styles of the [`style()`](https://stillwind.dev/docs/guides/style) calls in that module
|
|
45
45
|
and the styles that those calls compose from other modules. It also contains the
|
|
46
46
|
theme values, the preflight reset, and the other rules of your stylesheet.
|
|
47
47
|
|
|
@@ -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](
|
|
202
|
+
`CSSStyleSheet.replaceSync()`. The [`style.css()` reference](https://stillwind.dev/docs/macros/css)
|
|
203
203
|
describes variants that choose their own element and the `template` option.
|
|
204
204
|
|
|
205
205
|
## Style the shadow host
|
|
@@ -225,11 +225,11 @@ inside `:host` generates `&:host(:hover)`.
|
|
|
225
225
|
|
|
226
226
|
A selector in a shadow tree cannot read the elements around the host, so `host:in-*:`
|
|
227
227
|
and `host:group-*:` cannot match.
|
|
228
|
-
[unmatched-host-selector](
|
|
228
|
+
[unmatched-host-selector](https://stillwind.dev/docs/lints/unmatched-host-selector) reports them.
|
|
229
229
|
|
|
230
230
|
In `style()`, `host:` does not select the element that receives the classes. The
|
|
231
231
|
rule applies to the host of every shadow root that contains the CSS, and
|
|
232
|
-
[document-scoped-selector](
|
|
232
|
+
[document-scoped-selector](https://stillwind.dev/docs/lints/document-scoped-selector) reports it.
|
|
233
233
|
|
|
234
234
|
## Constraints
|
|
235
235
|
|
package/docs/index.md
CHANGED
|
@@ -8,8 +8,8 @@ description: "Add Stillwind to a Vite and React application, style a component,
|
|
|
8
8
|
This guide adds Stillwind to a Vite application that uses React. At the end, a
|
|
9
9
|
button uses Stillwind styles, and the CLI checks them. For another framework or
|
|
10
10
|
build tool, follow the same steps and use the build setup from
|
|
11
|
-
[Framework integrations](integrations
|
|
12
|
-
setup, see [Coding agents](agents
|
|
11
|
+
[Framework integrations](https://stillwind.dev/docs/integrations). To let a coding agent do the
|
|
12
|
+
setup, see [Coding agents](https://stillwind.dev/docs/agents).
|
|
13
13
|
|
|
14
14
|
> **Early development**
|
|
15
15
|
>
|
|
@@ -39,7 +39,7 @@ 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`](at-rules/theme
|
|
42
|
+
Each token in [`@theme`](https://stillwind.dev/docs/at-rules/theme) adds utilities. For example,
|
|
43
43
|
`--color-accent` adds `bg-accent` and `text-accent`.
|
|
44
44
|
|
|
45
45
|
## Configure the project
|
|
@@ -62,11 +62,13 @@ export default defineConfig({
|
|
|
62
62
|
`css` selects the stylesheet. `files` selects the files that the CLI and the
|
|
63
63
|
editor check.
|
|
64
64
|
|
|
65
|
-
> **Builds
|
|
65
|
+
> **Builds compile imports**
|
|
66
66
|
>
|
|
67
67
|
> The build compiles every module that your application imports, whether or not `files` matches it.
|
|
68
68
|
> The CLI and the language server (LSP) use `files` to find source files, including files that the
|
|
69
|
-
> application does not import.
|
|
69
|
+
> application does not import. A Vite build also loads the files that `files` matches into the type
|
|
70
|
+
> checker before it compiles the first module, so pages that the application loads through dynamic
|
|
71
|
+
> imports share one checker project. The dev server does not read these files in advance.
|
|
70
72
|
|
|
71
73
|
Add Stillwind to `vite.config.ts`:
|
|
72
74
|
|
|
@@ -126,15 +128,15 @@ Run the CLI in CI to catch such mistakes before you merge them.
|
|
|
126
128
|
|
|
127
129
|
## Next steps
|
|
128
130
|
|
|
129
|
-
- [Why Stillwind](why
|
|
130
|
-
- [The basics of style()](guides/style
|
|
131
|
-
- [Design systems](guides/design-systems
|
|
132
|
-
- [Checks in the editor and CI](guides/lint-adoption
|
|
133
|
-
- [Editors](editors
|
|
134
|
-
- [Formatters](formatters
|
|
131
|
+
- [Why Stillwind](https://stillwind.dev/docs/why): what Stillwind checks and why
|
|
132
|
+
- [The basics of style()](https://stillwind.dev/docs/guides/style): variants, conditions, and reusable styles
|
|
133
|
+
- [Design systems](https://stillwind.dev/docs/guides/design-systems): how to restrict colors, spacing, and breakpoints to your theme
|
|
134
|
+
- [Checks in the editor and CI](https://stillwind.dev/docs/guides/lint-adoption): how to run the checks in CI and the editor
|
|
135
|
+
- [Editors](https://stillwind.dev/docs/editors): how to install the extension
|
|
136
|
+
- [Formatters](https://stillwind.dev/docs/formatters): how to sort utilities with your formatter
|
|
135
137
|
|
|
136
138
|
## Set up with an AI agent
|
|
137
139
|
|
|
138
|
-
[Coding agents](agents
|
|
140
|
+
[Coding agents](https://stillwind.dev/docs/agents) gives a prompt that sets up Stillwind or migrates
|
|
139
141
|
an existing project. The `stillwind` package includes this documentation and
|
|
140
142
|
skills for the agent.
|
package/docs/integrations.md
CHANGED
|
@@ -7,7 +7,7 @@ description: "Import style() for your framework, and add Stillwind to your build
|
|
|
7
7
|
|
|
8
8
|
Each application needs two things: the `style` import for its component framework,
|
|
9
9
|
and the Stillwind integration for its build tool. This page assumes that you have
|
|
10
|
-
created the stylesheet and `stillwind.config.ts` from [Getting started](
|
|
10
|
+
created the stylesheet and `stillwind.config.ts` from [Getting started](https://stillwind.dev/docs).
|
|
11
11
|
Each integration finds `stillwind.config.ts` in the application root.
|
|
12
12
|
|
|
13
13
|
## Import style() for your framework
|
|
@@ -50,7 +50,7 @@ Alpine uses the `stillwind` plugin from `stillwind/alpine`. Register it with
|
|
|
50
50
|
Lit uses `html` element bindings such as
|
|
51
51
|
`` html`<button ${applyStyle(style("px-4 py-2"))}>Save</button>` ``.
|
|
52
52
|
Import both helpers from `stillwind/lit`. To add the styles to a shadow root,
|
|
53
|
-
see [Web Components](guides/web-components
|
|
53
|
+
see [Web Components](https://stillwind.dev/docs/guides/web-components). The Lit directive supports
|
|
54
54
|
browser rendering; Lit SSR is unsupported.
|
|
55
55
|
|
|
56
56
|
Gatsby uses `stillwind/react`, and Fresh 2 with Vite uses `stillwind/preact`.
|
|
@@ -254,4 +254,4 @@ standalone Turbopack, list every entry module of the application in `entries`.
|
|
|
254
254
|
|
|
255
255
|
The [build integration reference](https://github.com/SegaraRai/stillwind/blob/main/docs/integrations.md)
|
|
256
256
|
describes every option.
|
|
257
|
-
[How styles compile](concepts/how-styles-compile
|
|
257
|
+
[How styles compile](https://stillwind.dev/docs/concepts/how-styles-compile) explains how the CSS reaches the page.
|