stillwind 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +1 -1
  3. package/css/builtin-utilities/tw-borders.css +59 -59
  4. package/css/builtin-utilities/tw-effects.css +53 -53
  5. package/css/builtin-utilities/tw-typography.css +13 -13
  6. package/dist/class-object-C87DR3v2.js +6 -0
  7. package/dist/class-object-C87DR3v2.js.map +1 -0
  8. package/dist/class-object-CR0QHoF9.d.ts +10 -0
  9. package/dist/{class-string-DQmH4PZX.d.ts → class-string-BlClX8JK.d.ts} +2 -2
  10. package/dist/class-string-CiNTVHYm.js +6 -0
  11. package/dist/{class-string-CrQnTRvI.js.map → class-string-CiNTVHYm.js.map} +1 -1
  12. package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
  13. package/dist/formats-DP9B9SG6.js.map +1 -0
  14. package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
  15. package/dist/frameworks/alpine.d.ts +5 -3
  16. package/dist/frameworks/alpine.js +3 -1
  17. package/dist/frameworks/alpine.js.map +1 -1
  18. package/dist/frameworks/astro.d.ts +3 -3
  19. package/dist/frameworks/astro.js +1 -1
  20. package/dist/frameworks/lit.d.ts +5 -3
  21. package/dist/frameworks/lit.js +3 -1
  22. package/dist/frameworks/lit.js.map +1 -1
  23. package/dist/frameworks/preact.d.ts +3 -3
  24. package/dist/frameworks/preact.js +1 -1
  25. package/dist/frameworks/qwik.d.ts +3 -3
  26. package/dist/frameworks/qwik.js +1 -1
  27. package/dist/frameworks/react.d.ts +2 -2
  28. package/dist/frameworks/react.js +1 -1
  29. package/dist/frameworks/solid.d.ts +3 -3
  30. package/dist/frameworks/solid.js +1 -1
  31. package/dist/frameworks/svelte.d.ts +3 -3
  32. package/dist/frameworks/svelte.js +1 -1
  33. package/dist/frameworks/vanilla.d.ts +5 -3
  34. package/dist/frameworks/vanilla.js +6 -1
  35. package/dist/frameworks/vanilla.js.map +1 -0
  36. package/dist/frameworks/vue.d.ts +3 -3
  37. package/dist/frameworks/vue.js +1 -1
  38. package/dist/{index-uw1R9t_P.d.ts → index-DpaDcczW.d.ts} +150 -50
  39. package/dist/macro/index.d.ts +2 -2
  40. package/dist/macro/index.js +1 -1
  41. package/dist/runtime/development.d.ts +16 -8
  42. package/dist/runtime/development.js +57 -21
  43. package/dist/runtime/development.js.map +1 -1
  44. package/dist/runtime/index.d.ts +2 -2
  45. package/dist/runtime/index.js +1 -1
  46. package/dist/{style-Bzuux32Y.js → style-dMBm8aX_.js} +6 -3
  47. package/dist/style-dMBm8aX_.js.map +1 -0
  48. package/docs/at-rules/apply.md +1 -1
  49. package/docs/at-rules/custom-variant.md +1 -1
  50. package/docs/at-rules/slot.md +1 -1
  51. package/docs/at-rules/stillwind-property.md +1 -1
  52. package/docs/at-rules/stillwind-registry.md +7 -7
  53. package/docs/at-rules/stillwind-require-properties.md +1 -1
  54. package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
  55. package/docs/at-rules/stillwind-undef-utility.md +1 -1
  56. package/docs/at-rules/stillwind-undef-variant.md +1 -1
  57. package/docs/at-rules/theme.md +5 -5
  58. package/docs/at-rules/utility.md +43 -4
  59. package/docs/at-rules/variant.md +1 -1
  60. package/docs/concepts/css-ordering.md +46 -7
  61. package/docs/concepts/how-styles-compile.md +8 -8
  62. package/docs/errors/SW10006.md +34 -0
  63. package/docs/errors/index.md +1 -0
  64. package/docs/guides/migrating-from-tailwind.md +52 -9
  65. package/docs/guides/reusable-styles.md +2 -2
  66. package/docs/integrations.md +20 -1
  67. package/docs/lints/conflicting-utilities.md +9 -0
  68. package/docs/lints/cyclic-style-order.md +61 -0
  69. package/docs/lints/index.md +14 -10
  70. package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
  71. package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
  72. package/docs/lints/multiple-style-forwards.md +59 -0
  73. package/docs/lints/partial-utility-override.md +77 -0
  74. package/docs/lints/utility-class-selector.md +72 -0
  75. package/docs/llms.txt +8 -3
  76. package/docs/macros/index.md +1 -1
  77. package/docs/macros/recipe.md +246 -0
  78. package/docs/macros/style.md +62 -0
  79. package/docs/macros/when.md +1 -1
  80. package/package.json +6 -6
  81. package/skills/stillwind/SKILL.md +1 -1
  82. package/dist/class-object-CXvJOi2z.d.ts +0 -9
  83. package/dist/class-object-CzD1oMD_.js +0 -6
  84. package/dist/class-object-CzD1oMD_.js.map +0 -1
  85. package/dist/class-string-CrQnTRvI.js +0 -6
  86. package/dist/formats-Ctf2WFc-.js.map +0 -1
  87. package/dist/style-Bzuux32Y.js.map +0 -1
  88. package/docs/macros/cva.md +0 -155
@@ -29,13 +29,13 @@ the base's CSS first.
29
29
  Read the following table from top to bottom. Stillwind orders files first, then
30
30
  calls within each file, then the rules that each call produces:
31
31
 
32
- | Step | What Stillwind orders | Which CSS comes first |
33
- | ---- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | 1 | Different files | A file that defines a base comes before a file that uses it in `style(base, ...)`. For files without this relationship, Stillwind uses a stable order based on their paths. |
35
- | 2 | `style()` calls in one file | The base's CSS comes before CSS added by `style(base, ...)`. Other calls follow the order in which they appear in the file. |
36
- | 3 | JavaScript conditions in one call | CSS without a JavaScript condition comes first. CSS for conditions follows in the order the conditions are written. If conditions are nested, CSS for the outer condition comes before CSS for the inner one. |
37
- | 4 | CSS variants on one generated class | Rules without variants come first. The stylesheet sets the order of variants, such as `hover:` before `disabled:` or `sm:` before `md:` in the default stylesheet. |
38
- | 5 | Utilities with the same variants | By default, utilities follow the order of their definitions in the stylesheet, regardless of their order in `style()`. |
32
+ | Step | What Stillwind orders | Which CSS comes first |
33
+ | ---- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | 1 | Different files | A file that defines a base comes before a file that uses it in `style(base, ...)`. A file that declares an imported value, such as a component, comes before the file that imports it. Other files use a stable order based on their paths. |
35
+ | 2 | `style()` calls in one file | The base's CSS comes before CSS added by `style(base, ...)`. Other calls follow the order in which they appear in the file. |
36
+ | 3 | JavaScript conditions in one call | CSS without a JavaScript condition comes first. CSS for conditions follows in the order the conditions are written. If conditions are nested, CSS for the outer condition comes before CSS for the inner one. |
37
+ | 4 | CSS variants on one generated class | Rules without variants come first. The stylesheet sets the order of variants, such as `hover:` before `disabled:` or `sm:` before `md:` in the default stylesheet. |
38
+ | 5 | Utilities with the same variants | By default, utilities follow the order of their definitions in the stylesheet, regardless of their order in `style()`. |
39
39
 
40
40
  For example, the variant order in step 4 only applies to rules for the same
41
41
  class. It does not move a rule ahead of CSS from an earlier file or call.
@@ -92,6 +92,45 @@ plain classes, and none of the declarations uses `!important`. The red rule wins
92
92
  because it comes last. The same rule applies when you import `base` from another
93
93
  file.
94
94
 
95
+ ### Files that pass styles to components
96
+
97
+ When a file imports a value from another file and uses it, the file that
98
+ declares the value comes first. For a component, this lets the caller's
99
+ utilities win over the component's own utilities:
100
+
101
+ ```tsx
102
+ // src/App.tsx
103
+ import { Button } from "./components/ui/button";
104
+
105
+ <Button {...style("w-full")} />;
106
+ ```
107
+
108
+ Here `src/components/ui/button.tsx` comes before `src/App.tsx`, although the
109
+ paths sort the other way. The import decides the order, so it does not matter
110
+ how the style reaches the component. The order is the same when the style is
111
+ stored in a variable first, or when it is passed to a child element that the
112
+ component renders, as with `asChild`.
113
+
114
+ Stillwind follows the imports that are read as values. It ignores type-only
115
+ imports, imports that the file does not use, and imports from packages. It
116
+ follows re-exports, such as an `index.ts` file that re-exports components, to
117
+ the file that declares the value. A namespace import, such as
118
+ `import * as ui from "./ui"`, orders the file after every file that `./ui`
119
+ re-exports. When the declaring file has no `style()` call, Stillwind follows
120
+ that file's imports instead. A file that imports `Wrapper`, which renders
121
+ `Button`, therefore comes after the file of `Button`. Imports in Vue, Svelte,
122
+ and Astro files work in the same way. Components that a framework imports
123
+ automatically, without an `import` declaration, do not order files.
124
+
125
+ This order only places CSS. The component still has to apply the props, for
126
+ example with [`style.forward()`](https://stillwind.dev/docs/macros/style#forward-props-to-a-components-element).
127
+ It does not add the component's CSS to a stylesheet that does not include the
128
+ component.
129
+
130
+ When two files import values from each other, directly or through other
131
+ files, both orders cannot hold. Stillwind keeps one of them and reports
132
+ [cyclic-style-order](https://stillwind.dev/docs/lints/cyclic-style-order).
133
+
95
134
  ### Within one call, conditional rules come last
96
135
 
97
136
  In this call, the red utility has a JavaScript condition and the blue utility
@@ -97,14 +97,14 @@ custom property as an inline style.
97
97
  The CSS for both classes is generated at build time. At runtime, the code only
98
98
  chooses class names and sets property values.
99
99
 
100
- | You write | JavaScript at runtime |
101
- | -------------------------------------- | ------------------------------------------- |
102
- | Static utilities and variants | A class name |
103
- | A condition, such as `active && "..."` | A helper that joins class names |
104
- | A runtime custom property | An inline `style` value |
105
- | [`style.cva()`](https://stillwind.dev/docs/macros/cva) | A factory that selects compiled class names |
106
- | [`style.media()`](https://stillwind.dev/docs/macros/media) | A string with the media query |
107
- | [`style.css()`](https://stillwind.dev/docs/macros/css) | A CSS string that you place yourself |
100
+ | You write | JavaScript at runtime |
101
+ | --------------------------------------- | ------------------------------------------- |
102
+ | Static utilities and variants | A class name |
103
+ | A condition, such as `active && "..."` | A helper that joins class names |
104
+ | A runtime custom property | An inline `style` value |
105
+ | [`style.recipe()`](https://stillwind.dev/docs/macros/recipe) | A factory that selects compiled class names |
106
+ | [`style.media()`](https://stillwind.dev/docs/macros/media) | A string with the media query |
107
+ | [`style.css()`](https://stillwind.dev/docs/macros/css) | A CSS string that you place yourself |
108
108
 
109
109
  Development builds import checked versions of the helpers from
110
110
  `stillwind/runtime/development`. These versions report invalid values while you
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: "SW10006: Unavailable style.forward()"
3
+ description: "style.forward() is used through an entrypoint that does not provide it."
4
+ ---
5
+
6
+ # SW10006: Unavailable style.forward()
7
+
8
+ This error occurs when the code calls `style.forward()` through the Lit,
9
+ Alpine, or vanilla entrypoint. These entrypoints have no component props to
10
+ forward, so they do not provide `style.forward()`.
11
+
12
+ ## Reported
13
+
14
+ ```ts
15
+ import { style } from "stillwind/vanilla";
16
+
17
+ export const props = (attributes: { class?: string }) => style("p-4", style.forward(attributes));
18
+ ```
19
+
20
+ > SW10006: style.forward() is not available from `stillwind/vanilla`
21
+
22
+ ## Fixed
23
+
24
+ ```ts
25
+ import { style } from "stillwind/vanilla";
26
+
27
+ export const props = (attributes: { class?: string }) => style("p-4", { class: attributes.class });
28
+ ```
29
+
30
+ ## How to fix
31
+
32
+ - Pass the received classes in a `class` field, as in `{ class: attributes.class }`.
33
+ A `class` field passes classes only. To set inline style values, use custom
34
+ properties such as `{ "--size": value }`.
@@ -36,6 +36,7 @@ The first digits of a code tell you what to do next:
36
36
  - [SW10003](https://stillwind.dev/docs/errors/SW10003): Invalid Unicode string
37
37
  - [SW10004](https://stillwind.dev/docs/errors/SW10004): Unconsumed macro use
38
38
  - [SW10005](https://stillwind.dev/docs/errors/SW10005): Untransformed macro reference
39
+ - [SW10006](https://stillwind.dev/docs/errors/SW10006): Unavailable style.forward()
39
40
  - [SW11001](https://stillwind.dev/docs/errors/SW11001): Style composition cycle
40
41
  - [SW11002](https://stillwind.dev/docs/errors/SW11002): CSS module ordering cycle
41
42
  - [SW11003](https://stillwind.dev/docs/errors/SW11003): Unavailable style base
@@ -73,14 +73,15 @@ write a one-off codemod for your repository that converts them in one pass.
73
73
 
74
74
  ## Replace class helpers
75
75
 
76
- [`style()`](https://stillwind.dev/docs/macros/style) and [`style.cva()`](https://stillwind.dev/docs/macros/cva) replace
76
+ [`style()`](https://stillwind.dev/docs/macros/style) and [`style.recipe()`](https://stillwind.dev/docs/macros/recipe) replace
77
77
  the libraries that Tailwind projects use to build class strings:
78
78
 
79
- | Library | Stillwind |
80
- | ------------------------------------------------------------------------------------------------- | ----------------------------------------- |
81
- | [`clsx`](https://github.com/lukeed/clsx), [`classnames`](https://github.com/JedWatson/classnames) | `style()` with conditions |
82
- | [`tailwind-merge`](https://github.com/dcastil/tailwind-merge) | Compose a base with new utilities |
83
- | `cva` from [Class Variance Authority](https://cva.style/) | `style.cva()` with the same configuration |
79
+ | Library | Stillwind |
80
+ | ------------------------------------------------------------------------------------------------- | -------------------------------------------- |
81
+ | [`clsx`](https://github.com/lukeed/clsx), [`classnames`](https://github.com/JedWatson/classnames) | `style()` with conditions |
82
+ | [`tailwind-merge`](https://github.com/dcastil/tailwind-merge) | Compose a base with new utilities |
83
+ | `cva` from [Class Variance Authority](https://cva.style/) | `style.recipe()` with the same configuration |
84
+ | `tv` from [tailwind-variants](https://www.tailwind-variants.org/) | `style.recipe()` with `slots` |
84
85
 
85
86
  ### clsx and classnames
86
87
 
@@ -110,15 +111,21 @@ competing declarations when the other cascade criteria, such as specificity
110
111
  and importance, are equal. See [Override a style](https://stillwind.dev/docs/guides/style#override-a-style)
111
112
  and [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering).
112
113
 
114
+ `twMerge()` removes the overridden utility, but Stillwind keeps its CSS. When the
115
+ overriding utility sets fewer properties, the other properties keep their values.
116
+ For example, `text-[0.8rem]` over `text-sm` leaves the line height of `text-sm`.
117
+ [partial-utility-override](https://stillwind.dev/docs/lints/partial-utility-override) reports these
118
+ overrides in bases, conditions, and recipe options.
119
+
113
120
  ### cva
114
121
 
115
- Replace `cva(` with `style.cva(`, and import `VariantProps` from your framework's
122
+ Replace `cva(` with `style.recipe(`, and import `VariantProps` from your framework's
116
123
  entrypoint:
117
124
 
118
125
  ```tsx
119
126
  import { style, type VariantProps } from "stillwind/react";
120
127
 
121
- const button = style.cva("rounded-md px-4 py-2", {
128
+ const button = style.recipe("rounded-md px-4 py-2", {
122
129
  variants: {
123
130
  tone: {
124
131
  neutral: "bg-gray-100",
@@ -138,9 +145,39 @@ export function Button({ tone }: VariantProps<typeof button>) {
138
145
  `variants`, `defaultVariants`, and `compoundVariants` work as in
139
146
  class-variance-authority. Write each option value as a plain utility string,
140
147
  without `&&` or a ternary. The props that the factory returns cannot be passed
141
- to `style()` as a base. The [`style.cva()` reference](https://stillwind.dev/docs/macros/cva) lists
148
+ to `style()` as a base. The [`style.recipe()` reference](https://stillwind.dev/docs/macros/recipe) lists
142
149
  the other differences.
143
150
 
151
+ ### tailwind-variants
152
+
153
+ Replace `tv({ base, ... })` with `style.recipe(base, { ... })`. Move `base` to the
154
+ first argument, and keep `slots`, `variants`, `defaultVariants`,
155
+ `compoundVariants`, and `compoundSlots`. Each slot function returns props
156
+ instead of a class string, so spread it onto the element:
157
+
158
+ ```tsx
159
+ import { style } from "stillwind/react";
160
+
161
+ const card = style.recipe("flex gap-2", {
162
+ slots: {
163
+ icon: "size-4",
164
+ },
165
+ });
166
+
167
+ export function Card() {
168
+ const { base, icon } = card();
169
+ return (
170
+ <div {...base()}>
171
+ <span {...icon()} />
172
+ </div>
173
+ );
174
+ }
175
+ ```
176
+
177
+ `extend` and the `twMerge` options are not supported. Utilities do not need a
178
+ runtime merge, because the compiler's CSS order decides which declaration wins.
179
+ See [Slots](https://stillwind.dev/docs/macros/recipe#slots).
180
+
144
181
  For new components, consider state variants and `data-*` attributes instead of
145
182
  options. See [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles).
146
183
 
@@ -199,6 +236,12 @@ with its modifier classes, such as `btn btn-outline` in daisyUI. The
199
236
  [Plugins](https://stillwind.dev/docs/lints/conflicting-utilities#plugins) section of the rule page
200
237
  lists a setting for each tested plugin that stops these reports.
201
238
 
239
+ Selectors that read utility names from the `class` attribute, such as
240
+ `[&_svg:not([class*='size-'])]:size-4` in shadcn/ui components, do not work, because
241
+ Stillwind writes generated class names. The
242
+ [utility-class-selector](https://stillwind.dev/docs/lints/utility-class-selector) lint rule reports them,
243
+ and `stillwind check --fix` rewrites the common default-size form.
244
+
202
245
  ### Compare computed styles
203
246
 
204
247
  A successful build and clean CLI checks do not prove that the pages look the
@@ -109,7 +109,7 @@ set a custom property instead. See
109
109
 
110
110
  ## Migrate CVA components
111
111
 
112
- `style.cva()` accepts the configuration of `cva` from class-variance-authority.
112
+ `style.recipe()` accepts the configuration of `cva` from class-variance-authority.
113
113
  Use it to migrate existing CVA components. See
114
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).
115
+ and the [`style.recipe()` reference](https://stillwind.dev/docs/macros/recipe).
@@ -59,6 +59,23 @@ A component uses the entrypoint of its own framework. For example, a React
59
59
  island inside an Astro page imports `stillwind/react`, Gatsby uses
60
60
  `stillwind/react`, and Fresh 2 uses `stillwind/preact`.
61
61
 
62
+ ### Install the component converters
63
+
64
+ Stillwind reads Vue, Svelte, and Astro components through converter packages.
65
+ These packages are optional peer dependencies, so package managers do not
66
+ install them automatically. Install the packages for each component format that
67
+ the application uses:
68
+
69
+ | Format | Packages |
70
+ | ------ | -------------------------------------------------------------- |
71
+ | Vue | `@vue/compiler-dom`, `@vue/compiler-sfc`, `@vue/language-core` |
72
+ | Svelte | `svelte`, `svelte2tsx` |
73
+ | Astro | `@astrojs/astro2tsx` |
74
+
75
+ For example, a Svelte application installs `svelte2tsx` as a development
76
+ dependency. If a package is missing, the build fails with an error such as
77
+ `Cannot find package 'svelte2tsx'`.
78
+
62
79
  ### Alpine
63
80
 
64
81
  Register the `stillwind` plugin from `stillwind/alpine` before `Alpine.start()`,
@@ -409,7 +426,9 @@ every webpack stage:
409
426
  import { StillwindPlugin } from "@stillwind/integration/webpack";
410
427
 
411
428
  export function onCreateWebpackConfig({ actions, stage }) {
412
- actions.setWebpackConfig({ plugins: [new StillwindPlugin()] });
429
+ actions.setWebpackConfig({
430
+ plugins: [new StillwindPlugin()],
431
+ });
413
432
  if (stage === "develop") {
414
433
  actions.setWebpackConfig({
415
434
  optimization: {
@@ -9,6 +9,15 @@ This rule reports two utilities that set the same CSS property under the same
9
9
  conditions. Only one of them takes effect. The order of the generated CSS decides
10
10
  which one, not the order in your code, so the code does not show the result.
11
11
 
12
+ The rule does not report a utility under a JavaScript condition that is written
13
+ after the other utility and under more conditions, as in
14
+ `style("p-2", wide && "p-4")`. Its CSS comes later, so it overrides the other
15
+ utility when the condition is true, as the code shows.
16
+ [partial-utility-override](https://stillwind.dev/docs/lints/partial-utility-override) checks such
17
+ overrides. When the utility under more conditions is written first, as in
18
+ `style(wide && "p-4", "p-2")`, the rule still reports the pair, because that
19
+ utility wins although `p-2` is written last.
20
+
12
21
  ## Reported
13
22
 
14
23
  ```tsx
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: "cyclic-style-order"
3
+ description: "Reports files that import values from each other, so their CSS order cannot follow both."
4
+ ---
5
+
6
+ # cyclic-style-order
7
+
8
+ This rule reports a file whose CSS must come after another file's CSS, while
9
+ that file's CSS must also come after this file, directly or through other
10
+ files. A file must come after another file when it imports and uses a value,
11
+ such as a component or a base style, that the other file declares. See
12
+ [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering#files-that-pass-styles-to-components).
13
+
14
+ When the order forms a cycle, Stillwind keeps one of the orders, and the build
15
+ continues. The utilities that a caller passes to a component can then lose to
16
+ the component's own utilities.
17
+
18
+ ## Reported
19
+
20
+ ```tsx title="card.tsx"
21
+ import { style } from "stillwind/react";
22
+ import { Button } from "./button";
23
+
24
+ export function Card(props: CardProps) {
25
+ return (
26
+ <div {...style("rounded p-4", style.forward(props))}>
27
+ <Button {...style("w-full")} />
28
+ </div>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ```tsx title="button.tsx"
34
+ import { style } from "stillwind/react";
35
+ import { Card } from "./card";
36
+
37
+ export function Button(props: ButtonProps) {
38
+ return <Card {...style("p-2", style.forward(props))} />;
39
+ }
40
+ ```
41
+
42
+ `card.tsx` imports `Button`, and `button.tsx` imports `Card`.
43
+
44
+ ## How to fix
45
+
46
+ - Move the shared parts to a file that neither file imports from, so that the
47
+ imports go in one direction.
48
+ - Or remove the import in one direction, for example by passing the component
49
+ as a prop or a slot.
50
+
51
+ ## Rule settings
52
+
53
+ | Preset | Severity |
54
+ | --- | --- |
55
+ | `recommended` | warn |
56
+ | `strict` | deny |
57
+ | `stylistic` | off |
58
+
59
+ [Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
60
+
61
+ The CLI and the editor report this rule only when they analyze the whole project.
@@ -47,12 +47,12 @@ report never matches.
47
47
  | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | ------- |
48
48
  | [invalid-animation-option](https://stillwind.dev/docs/lints/invalid-animation-option) | A utility that is not an animation option, such as `p-4` | deny |
49
49
  | [invalid-css-input](https://stillwind.dev/docs/lints/invalid-css-input) | A [`style.css()`](https://stillwind.dev/docs/macros/css) argument that is not a static utility | deny |
50
- | [invalid-cva-config](https://stillwind.dev/docs/lints/invalid-cva-config) | An unknown or malformed field in a [`style.cva()`](https://stillwind.dev/docs/macros/cva) configuration | deny |
51
- | [invalid-cva-input](https://stillwind.dev/docs/lints/invalid-cva-input) | `&&` or a ternary inside a `style.cva()` value | deny |
52
50
  | [invalid-keyframes-definition](https://stillwind.dev/docs/lints/invalid-keyframes-definition) | A frame key that is not a keyframe position, such as `middle` | deny |
53
51
  | [invalid-keyframes-use](https://stillwind.dev/docs/lints/invalid-keyframes-use) | An animation applied with an argument that is not an options string | deny |
54
52
  | [invalid-keyframes-variant](https://stillwind.dev/docs/lints/invalid-keyframes-variant) | A selector or container variant around a keyframes definition | deny |
55
53
  | [invalid-media-query](https://stillwind.dev/docs/lints/invalid-media-query) | A condition in [`style.media()`](https://stillwind.dev/docs/macros/media) that is not a media query, such as `hover` | deny |
54
+ | [invalid-recipe-config](https://stillwind.dev/docs/lints/invalid-recipe-config) | An unknown or malformed field in a [`style.recipe()`](https://stillwind.dev/docs/macros/recipe) configuration | deny |
55
+ | [invalid-recipe-input](https://stillwind.dev/docs/lints/invalid-recipe-input) | `&&` or a ternary inside a `style.recipe()` value | deny |
56
56
  | [invalid-ref-input](https://stillwind.dev/docs/lints/invalid-ref-input) | A [`style.ref()`](https://stillwind.dev/docs/macros/ref) label or ref method argument that is not a literal | deny |
57
57
  | [invalid-rule-group-input](https://stillwind.dev/docs/lints/invalid-rule-group-input) | A `class` field or ref inside a variant key of [`style()`](https://stillwind.dev/docs/macros/style) | deny |
58
58
  | [invalid-runtime-condition](https://stillwind.dev/docs/lints/invalid-runtime-condition) | A runtime CSS condition that Stillwind cannot compile | deny |
@@ -75,14 +75,17 @@ report never matches.
75
75
 
76
76
  ## Conflicting or duplicated styles
77
77
 
78
- | Rule | Reports | Default |
79
- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------- |
80
- | [ambiguous-style-base-order](https://stillwind.dev/docs/lints/ambiguous-style-base-order) | Two base styles in one call that set the same property | warn |
81
- | [conflicting-provider-properties](https://stillwind.dev/docs/lints/conflicting-provider-properties) | A container or anchor property that a ref method and a utility both set | warn |
82
- | [conflicting-utilities](https://stillwind.dev/docs/lints/conflicting-utilities) | Utilities that set the same property, such as `p-2 p-4` | warn |
83
- | [duplicate-utility](https://stillwind.dev/docs/lints/duplicate-utility) | The same utility twice under the same conditions | warn |
84
- | [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base) | An imported base style that sets the same property as another style | warn |
85
- | [unverified-style-base](https://stillwind.dev/docs/lints/unverified-style-base) | A base style whose origin the CLI cannot determine from its type | warn |
78
+ | Rule | Reports | Default |
79
+ | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ------- |
80
+ | [ambiguous-style-base-order](https://stillwind.dev/docs/lints/ambiguous-style-base-order) | Two base styles in one call that set the same property | warn |
81
+ | [conflicting-provider-properties](https://stillwind.dev/docs/lints/conflicting-provider-properties) | A container or anchor property that a ref method and a utility both set | warn |
82
+ | [conflicting-utilities](https://stillwind.dev/docs/lints/conflicting-utilities) | Utilities that set the same property, such as `p-2 p-4` | warn |
83
+ | [cyclic-style-order](https://stillwind.dev/docs/lints/cyclic-style-order) | Files that pass styles to components of each other | warn |
84
+ | [duplicate-utility](https://stillwind.dev/docs/lints/duplicate-utility) | The same utility twice under the same conditions | warn |
85
+ | [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base) | An imported base style that sets the same property as another style | warn |
86
+ | [multiple-style-forwards](https://stillwind.dev/docs/lints/multiple-style-forwards) | A `style()` call with more than one `style.forward()` argument | warn |
87
+ | [partial-utility-override](https://stillwind.dev/docs/lints/partial-utility-override) | An override that leaves properties of the overridden utility, such as the line height of `text-sm` | warn |
88
+ | [unverified-style-base](https://stillwind.dev/docs/lints/unverified-style-base) | A base style whose origin the CLI cannot determine from its type | warn |
86
89
 
87
90
  ## Styles that do not apply as written
88
91
 
@@ -99,6 +102,7 @@ report never matches.
99
102
  | [split-view-transition-class](https://stillwind.dev/docs/lints/split-view-transition-class) | View transitions split across separate [`style()`](https://stillwind.dev/docs/macros/style) calls | warn |
100
103
  | [unmatched-host-selector](https://stillwind.dev/docs/lints/unmatched-host-selector) | A variant that tests a shadow host through the elements around it | warn |
101
104
  | [unsatisfiable-variants](https://stillwind.dev/docs/lints/unsatisfiable-variants) | Variants that can never match together, such as `portrait:landscape:` | warn |
105
+ | [utility-class-selector](https://stillwind.dev/docs/lints/utility-class-selector) | A selector that tests the class attribute for a utility name, such as `[class*='size-']` | warn |
102
106
 
103
107
  ## Stylesheet definitions
104
108
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: "invalid-cva-config"
3
- description: "Reports an unknown or malformed field in a style.cva() configuration."
2
+ title: "invalid-recipe-config"
3
+ description: "Reports an unknown or malformed field in a style.recipe() configuration."
4
4
  ---
5
5
 
6
- # invalid-cva-config
6
+ # invalid-recipe-config
7
7
 
8
- This rule reports a `style.cva()` configuration that the compiler cannot read,
8
+ This rule reports a `style.recipe()` configuration that the compiler cannot read,
9
9
  such as an unknown field, a default for an option that does not exist, or a
10
10
  configuration that is not written in the call. The factory ignores the invalid
11
11
  part.
@@ -13,7 +13,7 @@ part.
13
13
  ## Reported
14
14
 
15
15
  ```tsx
16
- style.cva("p-4", {
16
+ style.recipe("p-4", {
17
17
  variant: {
18
18
  size: {
19
19
  small: "p-2",
@@ -22,14 +22,14 @@ style.cva("p-4", {
22
22
  });
23
23
  ```
24
24
 
25
- > invalid-cva-config: invalid style.cva() configuration: unknown configuration property
25
+ > invalid-recipe-config: invalid style.recipe() configuration: unknown configuration property
26
26
  >
27
27
  > Example:2:12
28
28
 
29
29
  ## Fixed
30
30
 
31
31
  ```tsx
32
- style.cva("p-4", {
32
+ style.recipe("p-4", {
33
33
  variants: {
34
34
  size: {
35
35
  small: "p-2",
@@ -45,7 +45,7 @@ style.cva("p-4", {
45
45
  - In `defaultVariants` and `compoundVariants`, use only options and values that
46
46
  `variants` declares.
47
47
 
48
- See [`style.cva()`](https://stillwind.dev/docs/macros/cva#configuration).
48
+ See [`style.recipe()`](https://stillwind.dev/docs/macros/recipe#configuration).
49
49
 
50
50
  ## Rule settings
51
51
 
@@ -1,30 +1,30 @@
1
1
  ---
2
- title: "invalid-cva-input"
3
- description: "Reports && or a ternary inside a style.cva() value."
2
+ title: "invalid-recipe-input"
3
+ description: "Reports && or a ternary inside a style.recipe() value."
4
4
  ---
5
5
 
6
- # invalid-cva-input
6
+ # invalid-recipe-input
7
7
 
8
8
  This rule reports a runtime condition, such as `&&` or a ternary, inside the base
9
- or an option value of [`style.cva()`](https://stillwind.dev/docs/macros/cva). The compiler generates
9
+ or an option value of [`style.recipe()`](https://stillwind.dev/docs/macros/recipe). The compiler generates
10
10
  every value when it creates the factory, so the condition cannot choose a style.
11
11
 
12
12
  ## Reported
13
13
 
14
14
  ```tsx
15
15
  declare const active: boolean;
16
- style.cva(active && "bg-blue-500");
16
+ style.recipe(active && "bg-blue-500");
17
17
  ```
18
18
 
19
- > invalid-cva-input: style.cva() values require static utilities, arrays, CSS variants, or custom properties; utility inputs cannot use `&&` or ternary expressions
19
+ > invalid-recipe-input: style.recipe() values require static utilities, arrays, CSS variants, or custom properties; utility inputs cannot use `&&` or ternary expressions
20
20
  >
21
- > Example:2:11
21
+ > Example:2:14
22
22
 
23
23
  ## Fixed
24
24
 
25
25
  ```tsx
26
26
  declare const active: boolean;
27
- const button = style.cva("", {
27
+ const button = style.recipe("", {
28
28
  variants: {
29
29
  active: {
30
30
  true: "bg-blue-500",
@@ -42,7 +42,7 @@ button({ active });
42
42
  - Stored [`style()`](https://stillwind.dev/docs/macros/style) results, refs, animations, and `class`
43
43
  fields are not accepted either. Use them in `style()` instead.
44
44
 
45
- See [`style.cva()`](https://stillwind.dev/docs/macros/cva#style-values).
45
+ See [`style.recipe()`](https://stillwind.dev/docs/macros/recipe#style-values).
46
46
 
47
47
  ## Rule settings
48
48
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: "multiple-style-forwards"
3
+ description: "Reports a style() call with more than one style.forward() argument."
4
+ ---
5
+
6
+ # multiple-style-forwards
7
+
8
+ This rule reports a `style()` call that has more than one
9
+ [`style.forward()`](https://stillwind.dev/docs/macros/style#forward-props-to-a-components-element)
10
+ argument. The call is valid, but the forwarded values combine in two different
11
+ ways:
12
+
13
+ - Inline styles and custom properties apply in argument order. A later value
14
+ replaces an earlier value with the same name.
15
+ - Classes are joined in the class attribute. As with several base styles, the
16
+ CSS order of the files that generated them decides which class wins. The
17
+ argument order does not decide it.
18
+
19
+ ## Reported
20
+
21
+ ```tsx
22
+ import { style } from "stillwind/react";
23
+
24
+ export const Panel = ({ outer, inner }: PanelProps) => (
25
+ <div {...style("p-4", style.forward(outer), style.forward(inner))} />
26
+ );
27
+ ```
28
+
29
+ > multiple-style-forwards: this call has more than one style.forward() argument; CSS order, not argument order, decides which forwarded class wins
30
+ >
31
+ > Example:4:47
32
+
33
+ ## Fixed
34
+
35
+ ```tsx
36
+ import { style } from "stillwind/react";
37
+
38
+ export const Panel = ({ outer, inner }: PanelProps) => (
39
+ <div {...style("p-4", style.forward(outer))}>
40
+ <div {...style(style.forward(inner))} />
41
+ </div>
42
+ );
43
+ ```
44
+
45
+ ## How to fix
46
+
47
+ - Forward each set of props to its own element.
48
+ - When one element must receive both sets, make sure that their classes do not
49
+ set the same properties, and suppress the finding.
50
+
51
+ ## Rule settings
52
+
53
+ | Preset | Severity |
54
+ | --- | --- |
55
+ | `recommended` | warn |
56
+ | `strict` | deny |
57
+ | `stylistic` | off |
58
+
59
+ [Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.