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.
Files changed (232) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/css/builtin-variants/sw-conditional.css +10 -1
  3. package/css/builtin-variants/tw-relationship.css +4 -4
  4. package/css/builtins.css +1 -1
  5. package/dist/{class-object-D7ZGJOf_.d.ts → class-object-BaK8uudd.d.ts} +2 -2
  6. package/dist/class-object-DNcjzcfH.js +6 -0
  7. package/dist/{class-object-D24FFYqO.js.map → class-object-DNcjzcfH.js.map} +1 -1
  8. package/dist/{class-string-CQHnc9GN.d.ts → class-string-C5YFtXQn.d.ts} +2 -2
  9. package/dist/class-string-KnYInbiw.js +6 -0
  10. package/dist/{class-string-Db8-oI4q.js.map → class-string-KnYInbiw.js.map} +1 -1
  11. package/dist/{cva-BwX07CFw.js → formats-Ctf2WFc-.js} +87 -2
  12. package/dist/formats-Ctf2WFc-.js.map +1 -0
  13. package/dist/formats-aeLCNAXl.d.ts +73 -0
  14. package/dist/frameworks/alpine.d.ts +3 -3
  15. package/dist/frameworks/alpine.js +1 -1
  16. package/dist/frameworks/alpine.js.map +1 -1
  17. package/dist/frameworks/astro.d.ts +3 -3
  18. package/dist/frameworks/astro.js +1 -1
  19. package/dist/frameworks/lit.d.ts +3 -3
  20. package/dist/frameworks/lit.js +1 -1
  21. package/dist/frameworks/lit.js.map +1 -1
  22. package/dist/frameworks/preact.d.ts +3 -3
  23. package/dist/frameworks/preact.js +1 -1
  24. package/dist/frameworks/qwik.d.ts +3 -3
  25. package/dist/frameworks/qwik.js +1 -1
  26. package/dist/frameworks/react.d.ts +2 -2
  27. package/dist/frameworks/react.js +1 -1
  28. package/dist/frameworks/solid.d.ts +3 -3
  29. package/dist/frameworks/solid.js +1 -1
  30. package/dist/frameworks/svelte.d.ts +3 -3
  31. package/dist/frameworks/svelte.js +1 -1
  32. package/dist/frameworks/vanilla.d.ts +3 -3
  33. package/dist/frameworks/vanilla.js +1 -1
  34. package/dist/frameworks/vue.d.ts +3 -3
  35. package/dist/frameworks/vue.js +1 -1
  36. package/dist/{index-RwVFpxhE.d.ts → index-DBpgaaD7.d.ts} +54 -5
  37. package/dist/macro/index.d.ts +2 -2
  38. package/dist/macro/index.js +1 -1
  39. package/dist/runtime/development.d.ts +47 -0
  40. package/dist/{development-J-JCSIm0.js → runtime/development.js} +41 -5
  41. package/dist/runtime/development.js.map +1 -0
  42. package/dist/runtime/index.d.ts +2 -0
  43. package/dist/runtime/index.js +1 -0
  44. package/dist/{style-fTQbsVWZ.js → style-BE8vuLiO.js} +4 -1
  45. package/dist/style-BE8vuLiO.js.map +1 -0
  46. package/docs/at-rules/apply.md +5 -5
  47. package/docs/at-rules/custom-variant.md +12 -12
  48. package/docs/at-rules/index.md +19 -19
  49. package/docs/at-rules/plugin.md +7 -7
  50. package/docs/at-rules/registry-directives.md +9 -9
  51. package/docs/at-rules/slot.md +6 -6
  52. package/docs/at-rules/stillwind-css-template.md +7 -7
  53. package/docs/at-rules/stillwind-property.md +10 -10
  54. package/docs/at-rules/stillwind-registry.md +18 -18
  55. package/docs/at-rules/stillwind-require-properties.md +9 -9
  56. package/docs/at-rules/stillwind-slot.md +6 -6
  57. package/docs/at-rules/stillwind-undef-arbitrary-property.md +9 -9
  58. package/docs/at-rules/stillwind-undef-utility.md +10 -10
  59. package/docs/at-rules/stillwind-undef-variant.md +6 -6
  60. package/docs/at-rules/theme.md +23 -23
  61. package/docs/at-rules/utility.md +30 -30
  62. package/docs/at-rules/variant.md +6 -6
  63. package/docs/cli.md +11 -8
  64. package/docs/concepts/css-ordering.md +19 -19
  65. package/docs/concepts/how-styles-compile.md +17 -17
  66. package/docs/concepts/stylesheets.md +4 -4
  67. package/docs/configuration.md +34 -34
  68. package/docs/editors.md +9 -8
  69. package/docs/errors/SW01003.md +1 -1
  70. package/docs/errors/SW10001.md +1 -1
  71. package/docs/errors/SW10002.md +1 -1
  72. package/docs/errors/SW10004.md +7 -6
  73. package/docs/errors/SW10005.md +1 -1
  74. package/docs/errors/SW11001.md +1 -1
  75. package/docs/errors/SW11003.md +1 -1
  76. package/docs/errors/SW12001.md +2 -2
  77. package/docs/errors/SW12002.md +1 -1
  78. package/docs/errors/SW13001.md +1 -1
  79. package/docs/errors/SW13003.md +2 -2
  80. package/docs/errors/SW14001.md +1 -1
  81. package/docs/errors/SW14003.md +4 -4
  82. package/docs/errors/SW14004.md +2 -2
  83. package/docs/errors/SW14005.md +1 -1
  84. package/docs/errors/SW14006.md +1 -1
  85. package/docs/errors/SW14007.md +2 -2
  86. package/docs/errors/SW14008.md +1 -1
  87. package/docs/errors/SW30001.md +1 -1
  88. package/docs/errors/SW31001.md +1 -1
  89. package/docs/errors/SW31004.md +1 -1
  90. package/docs/errors/SW33005.md +1 -1
  91. package/docs/errors/SW34002.md +1 -1
  92. package/docs/errors/SW90001.md +1 -1
  93. package/docs/errors/SW90005.md +1 -1
  94. package/docs/errors/SW90006.md +1 -1
  95. package/docs/errors/index.md +72 -72
  96. package/docs/formatters.md +5 -5
  97. package/docs/guides/animations.md +7 -8
  98. package/docs/guides/design-systems.md +7 -7
  99. package/docs/guides/element-relationships.md +15 -19
  100. package/docs/guides/lint-adoption.md +5 -5
  101. package/docs/guides/migrating-from-css.md +11 -11
  102. package/docs/guides/migrating-from-tailwind.md +16 -16
  103. package/docs/guides/recommended-practices.md +18 -18
  104. package/docs/guides/responsive-styles.md +7 -7
  105. package/docs/guides/reusable-styles.md +10 -5
  106. package/docs/guides/runtime-conditions.md +6 -6
  107. package/docs/guides/style.md +42 -10
  108. package/docs/guides/tailwind-compatibility.md +23 -22
  109. package/docs/guides/view-transitions.md +9 -11
  110. package/docs/guides/web-components.md +4 -4
  111. package/docs/index.md +14 -12
  112. package/docs/integrations.md +3 -3
  113. package/docs/lints/ambiguous-style-base-order.md +4 -2
  114. package/docs/lints/bypassed-undefinition.md +3 -3
  115. package/docs/lints/clamped-value.md +1 -1
  116. package/docs/lints/conflicting-provider-properties.md +2 -2
  117. package/docs/lints/conflicting-utilities.md +45 -3
  118. package/docs/lints/document-scoped-selector.md +1 -1
  119. package/docs/lints/duplicate-definition.md +3 -3
  120. package/docs/lints/duplicate-utility.md +2 -2
  121. package/docs/lints/duplicate-view-transition-name.md +3 -3
  122. package/docs/lints/ignored-definition-condition.md +2 -2
  123. package/docs/lints/ignored-tailwind-feature.md +3 -3
  124. package/docs/lints/implicit-nesting-selector.md +2 -2
  125. package/docs/lints/incompatible-property-value.md +3 -3
  126. package/docs/lints/incompatible-theme-value.md +1 -1
  127. package/docs/lints/index.md +74 -73
  128. package/docs/lints/ineffective-anchor-scope.md +2 -2
  129. package/docs/lints/interfering-imported-style-base.md +22 -4
  130. package/docs/lints/invalid-animation-option.md +3 -3
  131. package/docs/lints/invalid-css-directive.md +3 -3
  132. package/docs/lints/invalid-css-import.md +2 -2
  133. package/docs/lints/invalid-css-input.md +4 -4
  134. package/docs/lints/invalid-cva-config.md +2 -2
  135. package/docs/lints/invalid-cva-input.md +4 -4
  136. package/docs/lints/invalid-keyframes-definition.md +2 -2
  137. package/docs/lints/invalid-keyframes-use.md +2 -2
  138. package/docs/lints/invalid-keyframes-variant.md +4 -4
  139. package/docs/lints/invalid-lint-suppression.md +3 -3
  140. package/docs/lints/invalid-marker-use.md +2 -2
  141. package/docs/lints/invalid-media-query.md +4 -4
  142. package/docs/lints/invalid-ref-input.md +4 -4
  143. package/docs/lints/invalid-rule-group-input.md +2 -2
  144. package/docs/lints/invalid-runtime-condition.md +3 -3
  145. package/docs/lints/invalid-stored-variant.md +52 -0
  146. package/docs/lints/invalid-style-composition.md +2 -2
  147. package/docs/lints/invalid-style-input.md +2 -2
  148. package/docs/lints/invalid-theme-reference.md +3 -3
  149. package/docs/lints/invalid-utility.md +3 -3
  150. package/docs/lints/invalid-variant.md +2 -2
  151. package/docs/lints/invalid-view-transition-definition.md +2 -2
  152. package/docs/lints/invalid-view-transition-use.md +2 -2
  153. package/docs/lints/invalid-view-transition-variant.md +3 -3
  154. package/docs/lints/mismatched-framework-import.md +3 -3
  155. package/docs/lints/missing-document-target.md +2 -2
  156. package/docs/lints/missing-ref-attachment.md +4 -4
  157. package/docs/lints/missing-view-transition-name.md +3 -3
  158. package/docs/lints/mutating-macro-argument.md +2 -2
  159. package/docs/lints/no-arbitrary-breakpoints.md +2 -2
  160. package/docs/lints/no-arbitrary-colors.md +2 -2
  161. package/docs/lints/no-arbitrary-spacing.md +1 -1
  162. package/docs/lints/no-class-property.md +3 -3
  163. package/docs/lints/no-important.md +2 -2
  164. package/docs/lints/no-restricted-declarations.md +1 -1
  165. package/docs/lints/no-restricted-length-units.md +1 -1
  166. package/docs/lints/no-restricted-theme-tokens.md +1 -1
  167. package/docs/lints/no-restricted-utilities.md +2 -2
  168. package/docs/lints/prefer-canonical-utilities.md +2 -2
  169. package/docs/lints/prefer-direct-styling.md +3 -3
  170. package/docs/lints/prefer-logical-properties.md +3 -3
  171. package/docs/lints/prefer-sorted-utilities.md +2 -2
  172. package/docs/lints/prefer-typed-relationships.md +3 -3
  173. package/docs/lints/prefer-typed-variables.md +1 -1
  174. package/docs/lints/prefer-variant-directive.md +3 -3
  175. package/docs/lints/redundant-variant.md +2 -2
  176. package/docs/lints/repeated-nesting-selector.md +2 -2
  177. package/docs/lints/runtime-condition-requires-css-if.md +3 -3
  178. package/docs/lints/split-view-transition-class.md +3 -3
  179. package/docs/lints/suspending-macro-argument.md +2 -2
  180. package/docs/lints/unknown-utility.md +4 -4
  181. package/docs/lints/unknown-variant.md +2 -2
  182. package/docs/lints/unmatched-host-selector.md +2 -2
  183. package/docs/lints/unsatisfiable-variants.md +1 -1
  184. package/docs/lints/unused-lint-suppression.md +1 -1
  185. package/docs/lints/unverified-style-base.md +2 -2
  186. package/docs/macros/anchor-scope.md +13 -13
  187. package/docs/macros/css.md +7 -7
  188. package/docs/macros/cva.md +17 -16
  189. package/docs/macros/index.md +10 -9
  190. package/docs/macros/keyframes.md +9 -9
  191. package/docs/macros/media.md +2 -2
  192. package/docs/macros/ref/as-anchor.md +11 -11
  193. package/docs/macros/ref/as-container.md +8 -8
  194. package/docs/macros/ref/at.md +10 -10
  195. package/docs/macros/ref/condition.md +9 -8
  196. package/docs/macros/ref/in.md +11 -11
  197. package/docs/macros/ref/index.md +17 -16
  198. package/docs/macros/ref/position-anchor.md +9 -9
  199. package/docs/macros/style.md +53 -27
  200. package/docs/macros/view-transition.md +17 -17
  201. package/docs/macros/when.md +129 -0
  202. package/docs/plugins/iconify.md +5 -5
  203. package/docs/plugins/index.md +4 -4
  204. package/docs/utilities-and-variants.md +6 -6
  205. package/docs/why.md +13 -15
  206. package/package.json +14 -28
  207. package/dist/class-object-D24FFYqO.js +0 -6
  208. package/dist/class-string-Db8-oI4q.js +0 -6
  209. package/dist/cva-BwX07CFw.js.map +0 -1
  210. package/dist/cva-DSpDNBYi.d.ts +0 -9
  211. package/dist/development-DttPQc71.d.ts +0 -27
  212. package/dist/development-J-JCSIm0.js.map +0 -1
  213. package/dist/runtime/class-name-object-development.d.ts +0 -10
  214. package/dist/runtime/class-name-object-development.js +0 -18
  215. package/dist/runtime/class-name-object-development.js.map +0 -1
  216. package/dist/runtime/class-name-object.d.ts +0 -16
  217. package/dist/runtime/class-name-object.js +0 -31
  218. package/dist/runtime/class-name-object.js.map +0 -1
  219. package/dist/runtime/class-object-development.d.ts +0 -10
  220. package/dist/runtime/class-object-development.js +0 -18
  221. package/dist/runtime/class-object-development.js.map +0 -1
  222. package/dist/runtime/class-object.d.ts +0 -16
  223. package/dist/runtime/class-object.js +0 -31
  224. package/dist/runtime/class-object.js.map +0 -1
  225. package/dist/runtime/class-string-development.d.ts +0 -10
  226. package/dist/runtime/class-string-development.js +0 -18
  227. package/dist/runtime/class-string-development.js.map +0 -1
  228. package/dist/runtime/class-string.d.ts +0 -16
  229. package/dist/runtime/class-string.js +0 -31
  230. package/dist/runtime/class-string.js.map +0 -1
  231. package/dist/shared-B9IQXU6P.d.ts +0 -32
  232. package/dist/style-fTQbsVWZ.js.map +0 -1
@@ -23,16 +23,16 @@ other frameworks receive `class` and `style`. Spread the result onto the element
23
23
  | A stored `style()` result | `base` | Adds the classes of the base |
24
24
 
25
25
  `false`, `null`, and `undefined` add nothing. Ref, keyframes, and view transition
26
- calls are also inputs; see [`style.ref()`](ref/index.md),
27
- [`style.keyframes()`](keyframes.md), and
28
- [`style.viewTransition()`](view-transition.md).
26
+ calls are also inputs; see [`style.ref()`](https://stillwind.dev/docs/macros/ref),
27
+ [`style.keyframes()`](https://stillwind.dev/docs/macros/keyframes), and
28
+ [`style.viewTransition()`](https://stillwind.dev/docs/macros/view-transition).
29
29
 
30
30
  Write utility names as literals. The compiler reads them from the source, so a
31
31
  name that your code builds at runtime produces no CSS.
32
32
 
33
33
  Inside an object with variant keys, write utilities only. A `class` field, a
34
34
  custom property, a ref, or a stored `style()` result belongs outside that object.
35
- [invalid-rule-group-input](../lints/invalid-rule-group-input.md) reports these
35
+ [invalid-rule-group-input](https://stillwind.dev/docs/lints/invalid-rule-group-input) reports these
36
36
  inputs.
37
37
 
38
38
  ## Static input
@@ -51,14 +51,14 @@ export const props = style("rounded-md p-4 text-blue-600");
51
51
  ### Compiled code
52
52
 
53
53
  ```ts
54
- export const props = {className:"sw_ad8bv"};
54
+ export const props = {className:"sw_7hd93"};
55
55
  ```
56
56
 
57
57
  ### Generated CSS
58
58
 
59
59
 
60
60
  ```css
61
- .sw_ad8bv {
61
+ .sw_7hd93 {
62
62
  padding: calc(var(--spacing) * 4);
63
63
  color: var(--color-blue-600);
64
64
  border-radius: var(--radius-md);
@@ -85,21 +85,21 @@ export const props = style("p-4", active && "bg-blue-500", {
85
85
  ### Compiled code
86
86
 
87
87
  ```ts
88
- import { stillwindClsx } from "stillwind/runtime/class-name-object";
88
+ import { stillwindClsx } from "stillwind/runtime";
89
89
 
90
90
  declare const active: boolean;
91
- export const props = {className:stillwindClsx("sw_4td0b",(active) && ("sw_dq3t9")),style:{"--progress":"0.5"}};
91
+ export const props = {className:stillwindClsx("sw_gmm8m",(active) && ("sw_661jk")),style:{"--progress":"0.5"}};
92
92
  ```
93
93
 
94
94
  ### Generated CSS
95
95
 
96
96
 
97
97
  ```css
98
- .sw_4td0b {
98
+ .sw_gmm8m {
99
99
  padding: calc(var(--spacing) * 4);
100
100
  }
101
101
 
102
- .sw_dq3t9 {
102
+ .sw_661jk {
103
103
  background-color: var(--color-blue-500);
104
104
  }
105
105
  ```
@@ -112,7 +112,7 @@ Stillwind imports a checked version that reports invalid values.
112
112
  A stored `style()` result passed to another call is a base. The compiler places
113
113
  the base's CSS before the CSS generated by the call that receives it. The later
114
114
  declarations win when the other cascade criteria, such as specificity and
115
- importance, are equal. See [CSS ordering](../concepts/css-ordering.md).
115
+ importance, are equal. See [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering).
116
116
 
117
117
  ### Source
118
118
 
@@ -126,22 +126,22 @@ export const props = style(base, "p-4 bg-blue-600 text-white");
126
126
  ### Compiled code
127
127
 
128
128
  ```ts
129
- import { stillwindClassKey, stillwindMerge, stillwindToFragment } from "stillwind/runtime/class-name-object";
129
+ import { stillwindClassNameObjectClassKey, stillwindClassNameObjectMerge, stillwindClassNameObjectToFragment } from "stillwind/runtime";
130
130
 
131
- const base = {className:"sw_lqeqi"};
132
- export const props = stillwindMerge({[stillwindClassKey]:"sw_cb2cz"},stillwindToFragment((base)));
131
+ const base = {className:"sw_8pxd9"};
132
+ export const props = stillwindClassNameObjectMerge({[stillwindClassNameObjectClassKey]:"sw_sba7k"},stillwindClassNameObjectToFragment((base)));
133
133
  ```
134
134
 
135
135
  ### Generated CSS
136
136
 
137
137
 
138
138
  ```css
139
- .sw_lqeqi {
139
+ .sw_8pxd9 {
140
140
  padding: calc(var(--spacing) * 2);
141
141
  border-radius: var(--radius-md);
142
142
  }
143
143
 
144
- .sw_cb2cz {
144
+ .sw_sba7k {
145
145
  padding: calc(var(--spacing) * 4);
146
146
  color: var(--color-white);
147
147
  background-color: var(--color-blue-600);
@@ -150,17 +150,43 @@ export const props = stillwindMerge({[stillwindClassKey]:"sw_cb2cz"},stillwindTo
150
150
 
151
151
  A base can come from any framework entrypoint and passes on its classes only.
152
152
  The receiving call returns its own framework's props. The base's inline style and
153
- custom properties do not carry over, and [invalid-style-composition](../lints/invalid-style-composition.md)
153
+ custom properties do not carry over, and [invalid-style-composition](https://stillwind.dev/docs/lints/invalid-style-composition)
154
154
  reports them. Set them in the call that receives the base.
155
155
 
156
- When two independent bases in one call set the same property, their argument
157
- order does not decide which one wins.
158
- [ambiguous-style-base-order](../lints/ambiguous-style-base-order.md) reports
159
- this case.
160
-
161
156
  Store a base in a variable before you pass it. A `style()` call written
162
157
  directly inside another call produces no CSS, and
163
- [invalid-style-input](../lints/invalid-style-input.md) reports it.
158
+ [invalid-style-input](https://stillwind.dev/docs/lints/invalid-style-input) reports it.
159
+
160
+ ## Argument order
161
+
162
+ For utilities and bases, the position of an argument does not decide which
163
+ declaration wins. A later argument does not override an earlier one:
164
+
165
+ | Arguments | Which CSS comes later |
166
+ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
167
+ | Utilities without a condition, in strings, arrays, or variant keys | The stylesheet's order of utility definitions decides. The order in the call and in each string does not. |
168
+ | A base and the utilities of the call | The utilities of the call. `style("p-4", base)` and `style(base, "p-4")` produce the same CSS. |
169
+ | Two bases | The base that is built on the other one. When neither is built on the other, the argument order does not decide. |
170
+ | Items with a condition | They come after the items without a condition, in the order in which you write them. |
171
+
172
+ These calls produce the same CSS, and `p-4` wins in both:
173
+
174
+ ```tsx
175
+ style("p-2", "p-4");
176
+ style("p-4", "p-2");
177
+ ```
178
+
179
+ Custom properties in the inline style follow argument order. When two
180
+ arguments set the same custom property, the later one wins.
181
+
182
+ Do not reorder arguments to fix a conflict. Reordering does not change the
183
+ result, and it does not remove a finding of
184
+ [conflicting-utilities](https://stillwind.dev/docs/lints/conflicting-utilities),
185
+ [ambiguous-style-base-order](https://stillwind.dev/docs/lints/ambiguous-style-base-order), or
186
+ [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base).
187
+ Remove the utility that should not apply, or build the overriding style on the
188
+ other style. [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering) describes the complete
189
+ rules.
164
190
 
165
191
  ## How props combine at runtime
166
192
 
@@ -177,9 +203,9 @@ combines the inputs:
177
203
  The compiler can evaluate arguments in any order, and it can skip arguments
178
204
  whose result is not used. Arguments must not perform I/O, change shared state,
179
205
  or depend on how often they run. Calculate such values before the call.
180
- [mutating-macro-argument](../lints/mutating-macro-argument.md) and
181
- [suspending-macro-argument](../lints/suspending-macro-argument.md) report the
206
+ [mutating-macro-argument](https://stillwind.dev/docs/lints/mutating-macro-argument) and
207
+ [suspending-macro-argument](https://stillwind.dev/docs/lints/suspending-macro-argument) report the
182
208
  cases that the CLI can detect.
183
209
 
184
- See [The basics of style()](../guides/style.md) and
185
- [Reusable styles](../guides/reusable-styles.md) for task-based guides.
210
+ See [The basics of style()](https://stillwind.dev/docs/guides/style) and
211
+ [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles) for task-based guides.
@@ -6,7 +6,7 @@ description: "Define view transition snapshot styles, and give each element a tr
6
6
  # style.viewTransition()
7
7
 
8
8
  `style.viewTransition(definition)` defines the styles of view transition
9
- snapshots. Passing the result to [`style()`](style.md) adds its
9
+ snapshots. Passing the result to [`style()`](https://stillwind.dev/docs/macros/style) adds its
10
10
  transition class to the element. Calling `.for(key)` also gives the element a
11
11
  [`view-transition-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-name).
12
12
 
@@ -28,28 +28,28 @@ export const props = style(transition.for("product-42"));
28
28
 
29
29
  ```ts
30
30
  const transition = undefined;
31
- export const props = {className:"sw_krt7u"};
31
+ export const props = {className:"sw_vue90"};
32
32
  ```
33
33
 
34
34
  ### Generated CSS
35
35
 
36
36
 
37
37
  ```css
38
- ::view-transition-old(.sw-vt-szy06) {
38
+ ::view-transition-old(.sw-vt-6lpts) {
39
39
  animation-duration: .15s;
40
40
  }
41
41
 
42
- ::view-transition-new(.sw-vt-szy06) {
42
+ ::view-transition-new(.sw-vt-6lpts) {
43
43
  animation-delay: .15s;
44
44
  animation-duration: .15s;
45
45
  }
46
46
 
47
- .sw_krt7u {
48
- view-transition-class: sw-vt-szy06;
47
+ .sw_vue90 {
48
+ view-transition-class: sw-vt-6lpts;
49
49
  }
50
50
 
51
- .sw_krt7u {
52
- view-transition-name: sw-vt-szy06-product-42;
51
+ .sw_vue90 {
52
+ view-transition-name: sw-vt-6lpts-product-42;
53
53
  }
54
54
  ```
55
55
 
@@ -113,28 +113,28 @@ export const props = style(transition.for(id));
113
113
  ### Compiled code
114
114
 
115
115
  ```ts
116
- import { stillwindViewTransitionName } from "stillwind/runtime/class-name-object";
116
+ import { stillwindViewTransitionName } from "stillwind/runtime";
117
117
 
118
118
  const transition = undefined;
119
119
 
120
120
  declare const id: string;
121
- export const props = {className:"sw_zhaz3",style:{"view-transition-name":stillwindViewTransitionName("sw-vt-szy06",id)}};
121
+ export const props = {className:"sw_gpjrb",style:{"view-transition-name":stillwindViewTransitionName("sw-vt-6lpts",id)}};
122
122
  ```
123
123
 
124
124
  ### Generated CSS
125
125
 
126
126
 
127
127
  ```css
128
- ::view-transition-old(.sw-vt-szy06) {
128
+ ::view-transition-old(.sw-vt-6lpts) {
129
129
  animation-duration: .15s;
130
130
  }
131
131
 
132
- ::view-transition-new(.sw-vt-szy06) {
132
+ ::view-transition-new(.sw-vt-6lpts) {
133
133
  animation-duration: .15s;
134
134
  }
135
135
 
136
- .sw_zhaz3 {
137
- view-transition-class: sw-vt-szy06;
136
+ .sw_gpjrb {
137
+ view-transition-class: sw-vt-6lpts;
138
138
  }
139
139
  ```
140
140
 
@@ -152,9 +152,9 @@ Pass the other definitions without `.for()`, such as `style(fade, slide.for(id))
152
152
 
153
153
  Transition classes from separate `style()` calls do not combine. Each call sets
154
154
  the whole `view-transition-class` list, so one list replaces the other.
155
- [split-view-transition-class](../lints/split-view-transition-class.md) and
156
- [duplicate-view-transition-name](../lints/duplicate-view-transition-name.md)
155
+ [split-view-transition-class](https://stillwind.dev/docs/lints/split-view-transition-class) and
156
+ [duplicate-view-transition-name](https://stillwind.dev/docs/lints/duplicate-view-transition-name)
157
157
  report these cases.
158
158
 
159
- See [View transitions](../guides/view-transitions.md) to start a transition
159
+ See [View transitions](https://stillwind.dev/docs/guides/view-transitions) to start a transition
160
160
  from your application.
@@ -0,0 +1,129 @@
1
+ ---
2
+ title: "style.when()"
3
+ description: "Store a variant sequence or alternatives, such as a ref condition, and use them in several style() calls."
4
+ ---
5
+
6
+ # style.when()
7
+
8
+ `style.when(...variants)` stores a sequence of variants in a variable. Use the
9
+ variable in [`style()`](https://stillwind.dev/docs/macros/style) where you would write the variants.
10
+ This helps when several elements need the same
11
+ [ref condition](https://stillwind.dev/docs/macros/ref/condition), because a ref call must otherwise
12
+ be repeated in each `style()` call.
13
+
14
+ ## Example
15
+
16
+ ### Source
17
+
18
+ ```tsx
19
+ import { style } from "stillwind/react";
20
+
21
+ const card = style.ref("card");
22
+ const cardHover = style.when(card("hover"));
23
+
24
+ export const root = style(card, "rounded-lg border");
25
+ export const title = style({ [cardHover]: "text-blue-600" });
26
+ export const arrow = style(`${cardHover}:translate-x-1`);
27
+ ```
28
+
29
+ ### Compiled code
30
+
31
+ ```ts
32
+ const card = undefined;
33
+ const cardHover = undefined;
34
+
35
+ export const root = {className:"sw_1tsgv sw_card_nudp9"};
36
+ export const title = {className:"sw_0m922"};
37
+ export const arrow = {className:"sw_nlo24"};
38
+ ```
39
+
40
+ ### Generated CSS
41
+
42
+
43
+ ```css
44
+ .sw_1tsgv {
45
+ border-radius: var(--radius-lg);
46
+ border-style: var(--tw-border-style);
47
+ border-width: 1px;
48
+ }
49
+
50
+ @media (hover: hover) {
51
+ .sw_0m922:is(:where(.sw_card_nudp9):hover *) {
52
+ color: var(--color-blue-600);
53
+ }
54
+ }
55
+
56
+ @media (hover: hover) {
57
+ .sw_nlo24:is(:where(.sw_card_nudp9):hover *) {
58
+ --tw-translate-x: calc(var(--spacing) * 1);
59
+ translate: var(--tw-translate-x) var(--tw-translate-y);
60
+ }
61
+ }
62
+ ```
63
+
64
+ `title` and `arrow` change while the card is hovered, as if each one wrote
65
+ `card("hover")` itself.
66
+
67
+ ## Inputs
68
+
69
+ Each argument is one sequence of variants, and every variant in it must match.
70
+ The final colon is optional.
71
+
72
+ | Form | Example |
73
+ | ------------------------------------------------------------- | --------------------------------------- |
74
+ | A string literal of variants | `style.when("hover:md")` |
75
+ | A [ref condition](https://stillwind.dev/docs/macros/ref/condition), with `.in()` | `style.when(card("hover").in(list))` |
76
+ | A [container query](https://stillwind.dev/docs/macros/ref/at) | `style.when(card.at("width >= 40rem"))` |
77
+ | A template literal whose interpolations are complete variants | ``style.when(`md:${card("hover")}`)`` |
78
+ | Another stored variant | `style.when(cardHover)` |
79
+
80
+ The rules for each variant are the same as when you write it directly in
81
+ `style()`. An interpolation in a template literal must be a ref condition, a
82
+ container query, or a stored variant, followed by `:` or at the end.
83
+
84
+ Write the call as the initial value of a variable, outside other Stillwind
85
+ calls. Declare a stored variant before another `style.when()` call uses it.
86
+ A `style()` call can use one that is declared later in the module.
87
+
88
+ [invalid-stored-variant](https://stillwind.dev/docs/lints/invalid-stored-variant) reports an
89
+ argument that is not a sequence of variants.
90
+
91
+ ## Alternatives
92
+
93
+ With several arguments, the stored variant matches when any argument matches:
94
+
95
+ ```tsx
96
+ const card = style.ref("card");
97
+ const active = style.when("hover", card("focus-within"));
98
+
99
+ export const title = style({ [active]: "text-blue-600" });
100
+ ```
101
+
102
+ A use means the same as writing the use once for each argument, in argument
103
+ order. `title` is equal to
104
+ `style({ "hover:": "text-blue-600", [card("focus-within")]: "text-blue-600" })`.
105
+ Unlike an [`or(...)`](https://stillwind.dev/docs/guides/style#match-any-of-several-variants)
106
+ variant, the arguments can be ref conditions and container queries.
107
+
108
+ ## Uses
109
+
110
+ Use a stored variant in these positions:
111
+
112
+ - a computed key in a `style()` object, such as `{ [cardHover]: "underline" }`;
113
+ - an interpolation in a utility template, followed by `:`, such as
114
+ `` `${cardHover}:underline` ``;
115
+ - the argument of another `style.when()`.
116
+
117
+ You can export the variable and import it in another module. Each use must
118
+ refer to one stored variant. A choice at runtime, such as
119
+ `[active ? cardHover : cardFocus]`, does not work, because the compiler
120
+ expands the variants at build time. Write a key for each stored variant instead.
121
+
122
+ [`style.cva()`](https://stillwind.dev/docs/macros/cva) values and [`.in()`](https://stillwind.dev/docs/macros/ref/in)
123
+ do not accept a stored variant.
124
+
125
+ ## Output
126
+
127
+ The compiler replaces the call with `undefined`, and each use with the stored
128
+ variants. The call adds no CSS by itself. JavaScript that reads the variable at
129
+ runtime gets `undefined`.
@@ -24,7 +24,7 @@ Load the plugin in the project stylesheet:
24
24
  ```
25
25
 
26
26
  Use `icon-<set>--<icon>` or `icon-[<set>--<icon>]` to select an icon. Variants
27
- apply as usual. The [prefer-canonical-utilities](../lints/prefer-canonical-utilities.md)
27
+ apply as usual. The [prefer-canonical-utilities](https://stillwind.dev/docs/lints/prefer-canonical-utilities)
28
28
  lint suggests the form without brackets:
29
29
 
30
30
  ```tsx
@@ -44,7 +44,7 @@ To change the height, add a size utility to the same element:
44
44
  | `icon-(<custom-property>)` | The value of the given custom property |
45
45
 
46
46
  To add a named size, define a `--icon-size-<name>` token in
47
- [`@theme`](../at-rules/theme.md). Its value must be a length or a percentage.
47
+ [`@theme`](https://stillwind.dev/docs/at-rules/theme). Its value must be a length or a percentage.
48
48
  For example, this token adds the `icon-lg` utility:
49
49
 
50
50
  ```css
@@ -73,9 +73,9 @@ needs its own size, so give the size utility the same variant as the icon:
73
73
  ```
74
74
 
75
75
  Size values follow lint policies configured for `height`. For example,
76
- [no-restricted-length-units](../lints/no-restricted-length-units.md) with
76
+ [no-restricted-length-units](https://stillwind.dev/docs/lints/no-restricted-length-units) with
77
77
  `properties: ["height"]` checks their units, and
78
- [no-arbitrary-spacing](../lints/no-arbitrary-spacing.md) with
78
+ [no-arbitrary-spacing](https://stillwind.dev/docs/lints/no-arbitrary-spacing) with
79
79
  `properties: ["height"]` reports arbitrary sizes, but not named sizes such as
80
80
  `icon-lg`.
81
81
 
@@ -161,7 +161,7 @@ export default defineConfig({
161
161
  });
162
162
  ```
163
163
 
164
- `iconify()` accepts the options of the [`@plugin`](../at-rules/plugin.md)
164
+ `iconify()` accepts the options of the [`@plugin`](https://stillwind.dev/docs/at-rules/plugin)
165
165
  block, with `hashLength` in place of `hash-length`. When both set the same
166
166
  option, the `@plugin` block wins.
167
167
 
@@ -6,15 +6,15 @@ description: "Add utilities to your stylesheet with the plugins that the Stillwi
6
6
  # Official plugins
7
7
 
8
8
  A plugin adds utilities and variants to your stylesheet. Each project that loads
9
- a plugin can use its definitions in [`style()`](../macros/style.md), and the
9
+ a plugin can use its definitions in [`style()`](https://stillwind.dev/docs/macros/style), and the
10
10
  editor and the CLI check them like your own definitions.
11
11
 
12
12
  | Plugin | Adds |
13
13
  | ---------------------------------------------------- | -------------------------- |
14
- | [`@stillwind/plugin-iconify`](iconify.md) | Iconify icons as utilities |
14
+ | [`@stillwind/plugin-iconify`](https://stillwind.dev/docs/plugins/iconify) | Iconify icons as utilities |
15
15
 
16
16
  Install the package, and load it in your stylesheet with
17
- [`@plugin`](../at-rules/plugin.md):
17
+ [`@plugin`](https://stillwind.dev/docs/at-rules/plugin):
18
18
 
19
19
  ```css
20
20
  @import "stillwind";
@@ -22,5 +22,5 @@ Install the package, and load it in your stylesheet with
22
22
  ```
23
23
 
24
24
  Tailwind CSS v4 JavaScript plugins use the same statement.
25
- [Tailwind CSS compatibility](../guides/tailwind-compatibility.md) lists the tested
25
+ [Tailwind CSS compatibility](https://stillwind.dev/docs/guides/tailwind-compatibility) lists the tested
26
26
  plugins.
@@ -20,7 +20,7 @@ CSS declarations names the declaration that it comes from. A variant result
20
20
  shows where the variant places the declarations of a utility.
21
21
 
22
22
  The results leave out the theme variables and other supporting CSS that the full
23
- stylesheet contains. The [macro reference](macros/index.md) shows complete
23
+ stylesheet contains. The [macro reference](https://stillwind.dev/docs/macros) shows complete
24
24
  generated stylesheets.
25
25
 
26
26
  A declaration without a matching utility becomes an arbitrary property, such as
@@ -31,22 +31,22 @@ does, so compare its declarations with your CSS before you replace it.
31
31
 
32
32
  The lookup runs the Stillwind compiler in your browser with the default theme.
33
33
  It downloads the compiler when the page opens. Utilities from your own
34
- [`@theme`](at-rules/theme.md) tokens, such as `bg-brand`, do not resolve here.
35
- See [Design systems](guides/design-systems.md) to add them. To check a utility
34
+ [`@theme`](https://stillwind.dev/docs/at-rules/theme) tokens, such as `bg-brand`, do not resolve here.
35
+ See [Design systems](https://stillwind.dev/docs/guides/design-systems) to add them. To check a utility
36
36
  in your project, hover over it in the editor or run `stillwind utilities`.
37
37
 
38
38
  The built-in utilities and variants follow Tailwind CSS, so see the
39
39
  [Tailwind CSS documentation](https://tailwindcss.com/docs) for their usage.
40
- [Tailwind CSS compatibility](guides/tailwind-compatibility.md#what-stillwind-adds)
40
+ [Tailwind CSS compatibility](https://stillwind.dev/docs/guides/tailwind-compatibility#what-stillwind-adds)
41
41
  lists what Stillwind adds.
42
42
 
43
43
  The editor and the CLI report non-canonical spellings with
44
- [prefer-canonical-utilities](lints/prefer-canonical-utilities.md).
44
+ [prefer-canonical-utilities](https://stillwind.dev/docs/lints/prefer-canonical-utilities).
45
45
 
46
46
  ## Look up names from the command line
47
47
 
48
48
  The lookup needs a browser. In a terminal or a coding agent, the
49
- [CLI](cli.md#stillwind-utilities) shows the CSS of utilities and variants:
49
+ [CLI](https://stillwind.dev/docs/cli#stillwind-utilities) shows the CSS of utilities and variants:
50
50
 
51
51
  ```sh
52
52
  vp exec stillwind utilities p-4 hover:underline
package/docs/why.md CHANGED
@@ -34,7 +34,7 @@ lint: {
34
34
  },
35
35
  ```
36
36
 
37
- To use a breakpoint in JavaScript, call [`style.media()`](macros/media.md) with its name. You do
37
+ To use a breakpoint in JavaScript, call [`style.media()`](https://stillwind.dev/docs/macros/media) with its name. You do
38
38
  not need to copy the breakpoint value into your code.
39
39
 
40
40
  ## Connect elements through variables
@@ -43,14 +43,13 @@ Tailwind connects elements by name: `group/card` on the parent and
43
43
  `group-hover/card:` on the child. Tailwind reads these names as strings, so it
44
44
  does not check that the two names agree.
45
45
 
46
- In Stillwind, you create the name as a variable with [`style.ref()`](macros/ref/index.md):
46
+ In Stillwind, you create the name as a variable with [`style.ref()`](https://stillwind.dev/docs/macros/ref):
47
47
 
48
48
  ```tsx
49
49
  import { style } from "stillwind/react";
50
50
 
51
- const card = style.ref("card");
52
-
53
51
  export function Card() {
52
+ const card = style.ref("card");
54
53
  return (
55
54
  <article {...style(card, "rounded-lg p-4")}>
56
55
  <h2 {...style({ [card("hover")]: "text-blue-600" })}>Project</h2>
@@ -74,12 +73,11 @@ In Stillwind, you define them in the component that uses them:
74
73
  ```tsx
75
74
  import { style } from "stillwind/react";
76
75
 
77
- const enter = style.keyframes({
78
- from: "opacity-0",
79
- to: "opacity-100",
80
- });
81
-
82
76
  export function Notice() {
77
+ const enter = style.keyframes({
78
+ from: "opacity-0",
79
+ to: "opacity-100",
80
+ });
83
81
  return <aside {...style(enter("duration-300"))}>Your changes are saved.</aside>;
84
82
  }
85
83
  ```
@@ -114,21 +112,21 @@ stillwind fmt
114
112
  ```
115
113
 
116
114
  AI agents can run the same commands as you, and CI can run them on every change.
117
- The [VS Code extension](editors.md) shows the same findings while you edit.
115
+ The [VS Code extension](https://stillwind.dev/docs/editors) shows the same findings while you edit.
118
116
 
119
117
  ## Ship static CSS
120
118
 
121
119
  The compiler turns static utilities into CSS files and class names at build time.
122
120
  These styles need no JavaScript at runtime. Conditions and dynamic values add
123
121
  only the small runtime helpers that they use. See
124
- [How styles compile](concepts/how-styles-compile.md) for the generated code.
122
+ [How styles compile](https://stillwind.dev/docs/concepts/how-styles-compile) for the generated code.
125
123
 
126
124
  ## What changes from Tailwind
127
125
 
128
126
  Stillwind supports Tailwind CSS v4 utilities, variants, and plugins. You write
129
127
  them in a different place:
130
128
 
131
- - You pass utilities to [`style()`](guides/style.md) and spread the result onto
129
+ - You pass utilities to [`style()`](https://stillwind.dev/docs/guides/style) and spread the result onto
132
130
  the element, instead of writing a `className` string.
133
131
  - Stillwind needs a build tool. It supports Vite, Astro, Next.js, SvelteKit,
134
132
  Nuxt, webpack, Rspack, Rsbuild, and Turbopack.
@@ -136,9 +134,9 @@ them in a different place:
136
134
 
137
135
  Tailwind CSS remains the better fit when a project has no build tool, or when
138
136
  classes come from places that Stillwind does not compile, such as HTML from a
139
- CMS. [Tailwind CSS compatibility](guides/tailwind-compatibility.md) lists the
137
+ CMS. [Tailwind CSS compatibility](https://stillwind.dev/docs/guides/tailwind-compatibility) lists the
140
138
  tested plugins and the differences.
141
139
 
142
- [Getting started](index.md) adds Stillwind to a new application.
143
- [Migrating from Tailwind CSS](guides/migrating-from-tailwind.md) moves an
140
+ [Getting started](https://stillwind.dev/docs) adds Stillwind to a new application.
141
+ [Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind) moves an
144
142
  existing Tailwind project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stillwind",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Write Tailwind CSS v4 utilities in components, enforce your design system, and ship static CSS",
5
5
  "keywords": [
6
6
  "alpinejs",
@@ -43,6 +43,8 @@
43
43
  "css",
44
44
  "docs",
45
45
  "skills",
46
+ "README.md",
47
+ "CHANGELOG.md",
46
48
  "AGENTS_TEMPLATE.md",
47
49
  "TAILWINDCSS-MIT-LICENSE"
48
50
  ],
@@ -119,44 +121,28 @@
119
121
  "types": "./dist/frameworks/vue.d.ts",
120
122
  "default": "./dist/frameworks/vue.js"
121
123
  },
122
- "./runtime/class-name-object": {
123
- "types": "./dist/runtime/class-name-object.d.ts",
124
- "default": "./dist/runtime/class-name-object.js"
124
+ "./runtime": {
125
+ "types": "./dist/runtime/index.d.ts",
126
+ "default": "./dist/runtime/index.js"
125
127
  },
126
- "./runtime/class-name-object-development": {
127
- "types": "./dist/runtime/class-name-object-development.d.ts",
128
- "default": "./dist/runtime/class-name-object-development.js"
129
- },
130
- "./runtime/class-object": {
131
- "types": "./dist/runtime/class-object.d.ts",
132
- "default": "./dist/runtime/class-object.js"
133
- },
134
- "./runtime/class-object-development": {
135
- "types": "./dist/runtime/class-object-development.d.ts",
136
- "default": "./dist/runtime/class-object-development.js"
137
- },
138
- "./runtime/class-string": {
139
- "types": "./dist/runtime/class-string.d.ts",
140
- "default": "./dist/runtime/class-string.js"
141
- },
142
- "./runtime/class-string-development": {
143
- "types": "./dist/runtime/class-string-development.d.ts",
144
- "default": "./dist/runtime/class-string-development.js"
128
+ "./runtime/development": {
129
+ "types": "./dist/runtime/development.d.ts",
130
+ "default": "./dist/runtime/development.js"
145
131
  },
146
132
  "./package.json": "./package.json"
147
133
  },
148
134
  "dependencies": {
149
- "@stillwind/config": "0.7.0",
150
- "@stillwind/native": "0.7.0",
151
- "@stillwind/projection": "0.7.0"
135
+ "@stillwind/config": "0.9.0",
136
+ "@stillwind/native": "0.9.0",
137
+ "@stillwind/projection": "0.9.0"
152
138
  },
153
139
  "devDependencies": {
154
140
  "@stillwind-internal/tools-workspace": "0.0.0",
155
141
  "@types/node": "^26.6.6",
156
142
  "lit": "^3.3.3",
157
143
  "typescript": "^6.0.3",
158
- "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
159
- "vite-plus": "1.4.0"
144
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
145
+ "vite-plus": "1.5.1"
160
146
  },
161
147
  "peerDependencies": {
162
148
  "lit": "^3.3.0"
@@ -1,6 +0,0 @@
1
- import { createStyleMacro } from "./style-fTQbsVWZ.js";
2
- // src/outputs/class-object.ts
3
- const style = createStyleMacro();
4
- export { style };
5
-
6
- //# sourceMappingURL=class-object-D24FFYqO.js.map
@@ -1,6 +0,0 @@
1
- import { createStyleMacro } from "./style-fTQbsVWZ.js";
2
- // src/outputs/class-string.ts
3
- const style = createStyleMacro();
4
- export { style };
5
-
6
- //# sourceMappingURL=class-string-Db8-oI4q.js.map