stillwind 0.0.0 → 0.1.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 (305) hide show
  1. package/AGENTS_TEMPLATE.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +166 -0
  4. package/TAILWINDCSS-MIT-LICENSE +21 -0
  5. package/css/builtin-metadata/sw-motion-properties.css +186 -0
  6. package/css/builtin-metadata/tw-legacy-metadata.css +36 -0
  7. package/css/builtin-metadata/tw-properties.css +944 -0
  8. package/css/builtin-metadata/tw-registry-metadata.css +52 -0
  9. package/css/builtin-metadata/tw-relationship-metadata.css +10 -0
  10. package/css/builtin-utilities/sw-motion-contexts.css +1043 -0
  11. package/css/builtin-utilities/tw-backgrounds.css +606 -0
  12. package/css/builtin-utilities/tw-borders.css +954 -0
  13. package/css/builtin-utilities/tw-effects.css +1209 -0
  14. package/css/builtin-utilities/tw-flex-grid.css +749 -0
  15. package/css/builtin-utilities/tw-interactivity.css +680 -0
  16. package/css/builtin-utilities/tw-layout.css +943 -0
  17. package/css/builtin-utilities/tw-masks.css +1268 -0
  18. package/css/builtin-utilities/tw-motion.css +142 -0
  19. package/css/builtin-utilities/tw-spacing-sizing.css +621 -0
  20. package/css/builtin-utilities/tw-svg.css +50 -0
  21. package/css/builtin-utilities/tw-transforms.css +652 -0
  22. package/css/builtin-utilities/tw-typography.css +720 -0
  23. package/css/builtin-variants/sw-conditional.css +5 -0
  24. package/css/builtin-variants/sw-document.css +13 -0
  25. package/css/builtin-variants/tw-conditional.css +187 -0
  26. package/css/builtin-variants/tw-dynamic-selector.css +49 -0
  27. package/css/builtin-variants/tw-relationship.css +41 -0
  28. package/css/builtin-variants/tw-state.css +159 -0
  29. package/css/builtin-variants/tw-structural.css +121 -0
  30. package/css/builtins.css +111 -0
  31. package/css/preflight.css +401 -0
  32. package/css/templates.css +40 -0
  33. package/css/theme.css +546 -0
  34. package/css/utilities.css +9 -0
  35. package/dist/class-object-D24FFYqO.js +6 -0
  36. package/dist/class-object-D24FFYqO.js.map +1 -0
  37. package/dist/class-object-D7ZGJOf_.d.ts +9 -0
  38. package/dist/class-string-CQHnc9GN.d.ts +9 -0
  39. package/dist/class-string-Db8-oI4q.js +6 -0
  40. package/dist/class-string-Db8-oI4q.js.map +1 -0
  41. package/dist/config.d.ts +1 -0
  42. package/dist/config.js +2 -0
  43. package/dist/css.d.ts +100 -0
  44. package/dist/css.js +143 -0
  45. package/dist/css.js.map +1 -0
  46. package/dist/cva-BwX07CFw.js +204 -0
  47. package/dist/cva-BwX07CFw.js.map +1 -0
  48. package/dist/cva-DSpDNBYi.d.ts +9 -0
  49. package/dist/development-DttPQc71.d.ts +27 -0
  50. package/dist/development-J-JCSIm0.js +111 -0
  51. package/dist/development-J-JCSIm0.js.map +1 -0
  52. package/dist/frameworks/alpine.d.ts +20 -0
  53. package/dist/frameworks/alpine.js +18 -0
  54. package/dist/frameworks/alpine.js.map +1 -0
  55. package/dist/frameworks/astro.d.ts +3 -0
  56. package/dist/frameworks/astro.js +1 -0
  57. package/dist/frameworks/lit.d.ts +21 -0
  58. package/dist/frameworks/lit.js +38 -0
  59. package/dist/frameworks/lit.js.map +1 -0
  60. package/dist/frameworks/preact.d.ts +3 -0
  61. package/dist/frameworks/preact.js +1 -0
  62. package/dist/frameworks/qwik.d.ts +3 -0
  63. package/dist/frameworks/qwik.js +1 -0
  64. package/dist/frameworks/react.d.ts +10 -0
  65. package/dist/frameworks/react.js +6 -0
  66. package/dist/frameworks/react.js.map +1 -0
  67. package/dist/frameworks/solid.d.ts +3 -0
  68. package/dist/frameworks/solid.js +1 -0
  69. package/dist/frameworks/svelte.d.ts +3 -0
  70. package/dist/frameworks/svelte.js +1 -0
  71. package/dist/frameworks/vanilla.d.ts +27 -0
  72. package/dist/frameworks/vanilla.js +3 -0
  73. package/dist/frameworks/vue.d.ts +3 -0
  74. package/dist/frameworks/vue.js +1 -0
  75. package/dist/index-RwVFpxhE.d.ts +815 -0
  76. package/dist/macro/index.d.ts +2 -0
  77. package/dist/macro/index.js +1 -0
  78. package/dist/module-css.d.ts +30 -0
  79. package/dist/module-css.js +23 -0
  80. package/dist/module-css.js.map +1 -0
  81. package/dist/runtime/class-name-object-development.d.ts +10 -0
  82. package/dist/runtime/class-name-object-development.js +18 -0
  83. package/dist/runtime/class-name-object-development.js.map +1 -0
  84. package/dist/runtime/class-name-object.d.ts +16 -0
  85. package/dist/runtime/class-name-object.js +31 -0
  86. package/dist/runtime/class-name-object.js.map +1 -0
  87. package/dist/runtime/class-object-development.d.ts +10 -0
  88. package/dist/runtime/class-object-development.js +18 -0
  89. package/dist/runtime/class-object-development.js.map +1 -0
  90. package/dist/runtime/class-object.d.ts +16 -0
  91. package/dist/runtime/class-object.js +31 -0
  92. package/dist/runtime/class-object.js.map +1 -0
  93. package/dist/runtime/class-string-development.d.ts +10 -0
  94. package/dist/runtime/class-string-development.js +18 -0
  95. package/dist/runtime/class-string-development.js.map +1 -0
  96. package/dist/runtime/class-string.d.ts +16 -0
  97. package/dist/runtime/class-string.js +31 -0
  98. package/dist/runtime/class-string.js.map +1 -0
  99. package/dist/shared-B9IQXU6P.d.ts +32 -0
  100. package/dist/style-BV4ctkni.js +78 -0
  101. package/dist/style-BV4ctkni.js.map +1 -0
  102. package/dist/style-fTQbsVWZ.js +41 -0
  103. package/dist/style-fTQbsVWZ.js.map +1 -0
  104. package/docs/agents.md +76 -0
  105. package/docs/at-rules/apply.md +93 -0
  106. package/docs/at-rules/custom-variant.md +127 -0
  107. package/docs/at-rules/index.md +75 -0
  108. package/docs/at-rules/plugin.md +71 -0
  109. package/docs/at-rules/registry-directives.md +181 -0
  110. package/docs/at-rules/slot.md +58 -0
  111. package/docs/at-rules/stillwind-css-template.md +126 -0
  112. package/docs/at-rules/stillwind-property.md +133 -0
  113. package/docs/at-rules/stillwind-registry.md +115 -0
  114. package/docs/at-rules/stillwind-require-properties.md +91 -0
  115. package/docs/at-rules/stillwind-slot.md +85 -0
  116. package/docs/at-rules/stillwind-undef-arbitrary-property.md +75 -0
  117. package/docs/at-rules/stillwind-undef-utility.md +87 -0
  118. package/docs/at-rules/stillwind-undef-variant.md +55 -0
  119. package/docs/at-rules/theme.md +304 -0
  120. package/docs/at-rules/utility.md +286 -0
  121. package/docs/at-rules/variant.md +91 -0
  122. package/docs/concepts/css-ordering.md +245 -0
  123. package/docs/concepts/how-styles-compile.md +132 -0
  124. package/docs/configuration.md +298 -0
  125. package/docs/errors/SW01001.md +51 -0
  126. package/docs/errors/SW01002.md +52 -0
  127. package/docs/errors/SW01003.md +69 -0
  128. package/docs/errors/SW02001.md +23 -0
  129. package/docs/errors/SW02002.md +51 -0
  130. package/docs/errors/SW03001.md +71 -0
  131. package/docs/errors/SW03002.md +79 -0
  132. package/docs/errors/SW03003.md +36 -0
  133. package/docs/errors/SW10001.md +34 -0
  134. package/docs/errors/SW10002.md +36 -0
  135. package/docs/errors/SW10003.md +30 -0
  136. package/docs/errors/SW10004.md +39 -0
  137. package/docs/errors/SW10005.md +35 -0
  138. package/docs/errors/SW11001.md +37 -0
  139. package/docs/errors/SW11002.md +65 -0
  140. package/docs/errors/SW11003.md +20 -0
  141. package/docs/errors/SW12001.md +43 -0
  142. package/docs/errors/SW12002.md +42 -0
  143. package/docs/errors/SW13001.md +35 -0
  144. package/docs/errors/SW13002.md +33 -0
  145. package/docs/errors/SW13003.md +18 -0
  146. package/docs/errors/SW13004.md +45 -0
  147. package/docs/errors/SW14001.md +44 -0
  148. package/docs/errors/SW14002.md +47 -0
  149. package/docs/errors/SW14003.md +38 -0
  150. package/docs/errors/SW14004.md +48 -0
  151. package/docs/errors/SW14005.md +51 -0
  152. package/docs/errors/SW14006.md +19 -0
  153. package/docs/errors/SW14007.md +35 -0
  154. package/docs/errors/SW14008.md +41 -0
  155. package/docs/errors/SW15001.md +18 -0
  156. package/docs/errors/SW15002.md +19 -0
  157. package/docs/errors/SW15003.md +16 -0
  158. package/docs/errors/SW30001.md +21 -0
  159. package/docs/errors/SW30002.md +18 -0
  160. package/docs/errors/SW30003.md +17 -0
  161. package/docs/errors/SW30004.md +18 -0
  162. package/docs/errors/SW31001.md +20 -0
  163. package/docs/errors/SW31002.md +17 -0
  164. package/docs/errors/SW31003.md +18 -0
  165. package/docs/errors/SW31004.md +20 -0
  166. package/docs/errors/SW31005.md +18 -0
  167. package/docs/errors/SW31006.md +17 -0
  168. package/docs/errors/SW31007.md +18 -0
  169. package/docs/errors/SW31008.md +16 -0
  170. package/docs/errors/SW31009.md +18 -0
  171. package/docs/errors/SW31010.md +16 -0
  172. package/docs/errors/SW31011.md +17 -0
  173. package/docs/errors/SW32001.md +18 -0
  174. package/docs/errors/SW32002.md +45 -0
  175. package/docs/errors/SW32003.md +43 -0
  176. package/docs/errors/SW32004.md +17 -0
  177. package/docs/errors/SW32005.md +40 -0
  178. package/docs/errors/SW32006.md +18 -0
  179. package/docs/errors/SW32007.md +20 -0
  180. package/docs/errors/SW33001.md +17 -0
  181. package/docs/errors/SW33002.md +17 -0
  182. package/docs/errors/SW33003.md +17 -0
  183. package/docs/errors/SW33004.md +17 -0
  184. package/docs/errors/SW33005.md +20 -0
  185. package/docs/errors/SW34001.md +18 -0
  186. package/docs/errors/SW34002.md +17 -0
  187. package/docs/errors/SW34003.md +18 -0
  188. package/docs/errors/SW90001.md +17 -0
  189. package/docs/errors/SW90002.md +18 -0
  190. package/docs/errors/SW90003.md +17 -0
  191. package/docs/errors/SW90004.md +17 -0
  192. package/docs/errors/SW90005.md +16 -0
  193. package/docs/errors/SW90006.md +17 -0
  194. package/docs/errors/SW90007.md +17 -0
  195. package/docs/errors/SW90008.md +17 -0
  196. package/docs/errors/index.md +125 -0
  197. package/docs/guides/animations.md +73 -0
  198. package/docs/guides/design-systems.md +119 -0
  199. package/docs/guides/element-relationships.md +136 -0
  200. package/docs/guides/lint-adoption.md +128 -0
  201. package/docs/guides/migrating-from-css.md +126 -0
  202. package/docs/guides/migrating-from-tailwind.md +179 -0
  203. package/docs/guides/recommended-practices.md +338 -0
  204. package/docs/guides/responsive-styles.md +103 -0
  205. package/docs/guides/reusable-styles.md +110 -0
  206. package/docs/guides/style.md +181 -0
  207. package/docs/guides/tailwind-compatibility.md +126 -0
  208. package/docs/guides/view-transitions.md +84 -0
  209. package/docs/guides/web-components.md +216 -0
  210. package/docs/index.md +136 -0
  211. package/docs/integrations.md +190 -0
  212. package/docs/lints/ambiguous-style-base-order.md +50 -0
  213. package/docs/lints/bypassed-undefinition.md +50 -0
  214. package/docs/lints/clamped-value.md +44 -0
  215. package/docs/lints/conflicting-provider-properties.md +47 -0
  216. package/docs/lints/conflicting-utilities.md +55 -0
  217. package/docs/lints/document-scoped-selector.md +45 -0
  218. package/docs/lints/duplicate-definition.md +44 -0
  219. package/docs/lints/duplicate-utility.md +44 -0
  220. package/docs/lints/duplicate-view-transition-name.md +45 -0
  221. package/docs/lints/ignored-definition-condition.md +51 -0
  222. package/docs/lints/ignored-tailwind-feature.md +62 -0
  223. package/docs/lints/incompatible-property-value.md +60 -0
  224. package/docs/lints/incompatible-theme-value.md +46 -0
  225. package/docs/lints/index.md +140 -0
  226. package/docs/lints/ineffective-anchor-scope.md +46 -0
  227. package/docs/lints/interfering-imported-style-base.md +57 -0
  228. package/docs/lints/invalid-animation-option.md +47 -0
  229. package/docs/lints/invalid-css-directive.md +43 -0
  230. package/docs/lints/invalid-css-import.md +43 -0
  231. package/docs/lints/invalid-css-input.md +45 -0
  232. package/docs/lints/invalid-cva-config.md +46 -0
  233. package/docs/lints/invalid-cva-input.md +50 -0
  234. package/docs/lints/invalid-keyframes-definition.md +47 -0
  235. package/docs/lints/invalid-keyframes-use.md +47 -0
  236. package/docs/lints/invalid-keyframes-variant.md +48 -0
  237. package/docs/lints/invalid-lint-suppression.md +47 -0
  238. package/docs/lints/invalid-marker-use.md +53 -0
  239. package/docs/lints/invalid-media-query.md +52 -0
  240. package/docs/lints/invalid-ref-input.md +49 -0
  241. package/docs/lints/invalid-rule-group-input.md +58 -0
  242. package/docs/lints/invalid-runtime-condition.md +67 -0
  243. package/docs/lints/invalid-style-composition.md +52 -0
  244. package/docs/lints/invalid-style-input.md +47 -0
  245. package/docs/lints/invalid-theme-reference.md +52 -0
  246. package/docs/lints/invalid-utility.md +44 -0
  247. package/docs/lints/invalid-variant.md +45 -0
  248. package/docs/lints/invalid-view-transition-definition.md +46 -0
  249. package/docs/lints/invalid-view-transition-use.md +46 -0
  250. package/docs/lints/invalid-view-transition-variant.md +51 -0
  251. package/docs/lints/mismatched-framework-import.md +47 -0
  252. package/docs/lints/missing-document-target.md +44 -0
  253. package/docs/lints/missing-ref-attachment.md +44 -0
  254. package/docs/lints/missing-view-transition-name.md +46 -0
  255. package/docs/lints/mutating-macro-argument.md +48 -0
  256. package/docs/lints/no-arbitrary-breakpoints.md +50 -0
  257. package/docs/lints/no-arbitrary-colors.md +51 -0
  258. package/docs/lints/no-arbitrary-spacing.md +57 -0
  259. package/docs/lints/no-class-property.md +58 -0
  260. package/docs/lints/no-important.md +50 -0
  261. package/docs/lints/no-restricted-declarations.md +76 -0
  262. package/docs/lints/no-restricted-length-units.md +73 -0
  263. package/docs/lints/no-restricted-theme-tokens.md +73 -0
  264. package/docs/lints/no-restricted-utilities.md +73 -0
  265. package/docs/lints/prefer-canonical-utilities.md +69 -0
  266. package/docs/lints/prefer-direct-styling.md +47 -0
  267. package/docs/lints/prefer-explicit-nesting-selector.md +42 -0
  268. package/docs/lints/prefer-logical-properties.md +49 -0
  269. package/docs/lints/prefer-sorted-utilities.md +46 -0
  270. package/docs/lints/prefer-typed-relationships.md +48 -0
  271. package/docs/lints/prefer-typed-variables.md +43 -0
  272. package/docs/lints/prefer-variant-directive.md +59 -0
  273. package/docs/lints/redundant-variant.md +50 -0
  274. package/docs/lints/repeated-nesting-selector.md +59 -0
  275. package/docs/lints/runtime-condition-requires-css-if.md +59 -0
  276. package/docs/lints/split-view-transition-class.md +47 -0
  277. package/docs/lints/suspending-macro-argument.md +46 -0
  278. package/docs/lints/unknown-utility.md +47 -0
  279. package/docs/lints/unknown-variant.md +42 -0
  280. package/docs/lints/unsatisfiable-variants.md +42 -0
  281. package/docs/lints/unused-lint-suppression.md +57 -0
  282. package/docs/lints/unverified-style-base.md +64 -0
  283. package/docs/macros/anchor-scope.md +90 -0
  284. package/docs/macros/css.md +68 -0
  285. package/docs/macros/cva.md +153 -0
  286. package/docs/macros/index.md +30 -0
  287. package/docs/macros/keyframes.md +98 -0
  288. package/docs/macros/media.md +65 -0
  289. package/docs/macros/ref/as-anchor.md +70 -0
  290. package/docs/macros/ref/as-container.md +64 -0
  291. package/docs/macros/ref/at.md +68 -0
  292. package/docs/macros/ref/condition.md +86 -0
  293. package/docs/macros/ref/in.md +81 -0
  294. package/docs/macros/ref/index.md +115 -0
  295. package/docs/macros/ref/position-anchor.md +64 -0
  296. package/docs/macros/style.md +185 -0
  297. package/docs/macros/view-transition.md +159 -0
  298. package/docs/utilities.md +35 -0
  299. package/docs/why.md +144 -0
  300. package/index.css +7 -0
  301. package/package.json +135 -8
  302. package/skills/migrate-to-stillwind/SKILL.md +81 -0
  303. package/skills/setup-stillwind/SKILL.md +51 -0
  304. package/skills/stillwind/SKILL.md +54 -0
  305. package/index.js +0 -1
@@ -0,0 +1,132 @@
1
+ ---
2
+ title: "How styles compile"
3
+ description: "See what Stillwind generates at build time, what JavaScript remains at runtime, and how CSS reaches the page."
4
+ ---
5
+
6
+ # How styles compile
7
+
8
+ Stillwind compiles `style()` calls when your bundler builds the application.
9
+ This page shows what the compiler generates, what JavaScript remains at
10
+ runtime, and how the CSS reaches the page.
11
+
12
+ ## Static styles
13
+
14
+ A call with only static utilities and CSS variants compiles to an object literal:
15
+
16
+ ### Source
17
+
18
+ ```tsx
19
+ import { style } from "stillwind/react";
20
+
21
+ export const props = style("rounded-md p-4 text-blue-600 hover:text-blue-800 md:p-6");
22
+ ```
23
+
24
+ ### Compiled code
25
+
26
+ ```ts
27
+ export const props = {className:"sw_hk649"};
28
+ ```
29
+
30
+ ### Generated CSS
31
+
32
+
33
+ ```css
34
+ .sw_hk649 {
35
+ padding: calc(var(--spacing) * 4);
36
+ color: var(--color-blue-600);
37
+ border-radius: var(--radius-md);
38
+ }
39
+
40
+ @media (hover: hover) {
41
+ .sw_hk649:hover {
42
+ color: var(--color-blue-800);
43
+ }
44
+ }
45
+
46
+ @media (width >= 48rem) {
47
+ .sw_hk649 {
48
+ padding: calc(var(--spacing) * 6);
49
+ }
50
+ }
51
+ ```
52
+
53
+ In this example, the utilities compile to one class. The browser applies
54
+ `hover:` through a selector and `md:` through a media query. Both stay in CSS,
55
+ so the compiled JavaScript contains only the class name.
56
+
57
+ ## Conditions and runtime values
58
+
59
+ A condition or a runtime value needs a small amount of JavaScript:
60
+
61
+ ### Source
62
+
63
+ ```tsx
64
+ import { style } from "stillwind/react";
65
+
66
+ declare const active: boolean;
67
+ declare const progress: number;
68
+ export const props = style("p-4", active && "bg-blue-500", { "--progress": progress });
69
+ ```
70
+
71
+ ### Compiled code
72
+
73
+ ```ts
74
+ import { stillwindClsx, stillwindCssValue } from "stillwind/runtime/class-name-object";
75
+
76
+ declare const active: boolean;
77
+ declare const progress: number;
78
+ export const props = {className:stillwindClsx("sw_zwy1n",(active) && ("sw_h7hj9")),style:{"--progress":stillwindCssValue(progress)}};
79
+ ```
80
+
81
+ ### Generated CSS
82
+
83
+
84
+ ```css
85
+ .sw_zwy1n {
86
+ padding: calc(var(--spacing) * 4);
87
+ }
88
+
89
+ .sw_h7hj9 {
90
+ background-color: var(--color-blue-500);
91
+ }
92
+ ```
93
+
94
+ The compiled call imports helpers to join the class names and pass the runtime
95
+ custom property as an inline style.
96
+
97
+ The CSS for both classes is generated at build time. At runtime, the code only
98
+ chooses class names and sets property values.
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()` | A factory that selects compiled class names |
106
+ | `style.media()` | A string with the media query |
107
+ | [`style.css()`](../macros/css.md) | A CSS string that you place yourself |
108
+
109
+ Development builds import checked versions of the helpers from
110
+ `stillwind/runtime/class-name-object-development`. These versions report invalid values
111
+ while you develop. Production builds use the unchecked helpers.
112
+
113
+ ## The generated stylesheet
114
+
115
+ The stylesheet contains utility CSS only for the `style()` calls that the build
116
+ compiles. Utilities that no compiled call uses produce no CSS.
117
+
118
+ Stillwind fixes the precedence of its generated rules at build time. Class-name
119
+ order and module-loading order do not change it. Production optimizations can
120
+ combine or move rules without changing the cascade. See
121
+ [CSS ordering](css-ordering.md) for base styles, conditions, and variants.
122
+
123
+ ## Delivering CSS to the page
124
+
125
+ The build integration adds the generated CSS to your application. For Vite and
126
+ the frameworks built on it, the build writes one stylesheet by default.
127
+ The Astro integration also adds the styles to server-rendered pages and islands.
128
+ SvelteKit needs a server hook to add them to server-rendered pages in development.
129
+ See [Framework integrations](../integrations.md) for the setup of each framework.
130
+
131
+ `style.css()` returns its CSS as a string instead of adding it to this stylesheet.
132
+ To add the styles of a module to a shadow root, see [Web Components](../guides/web-components.md).
@@ -0,0 +1,298 @@
1
+ ---
2
+ title: "Configuration"
3
+ description: "Set up projects in stillwind.config.ts, choose lint rules, and look up every project field."
4
+ ---
5
+
6
+ # Configuration
7
+
8
+ `stillwind.config.ts` describes your projects. The build integration, the CLI,
9
+ and the editor all read the same file.
10
+
11
+ ```ts title="stillwind.config.ts"
12
+ import { defineConfig } from "stillwind/config";
13
+
14
+ export default defineConfig({
15
+ projects: [
16
+ {
17
+ css: "./src/stillwind.css",
18
+ files: ["src/**/*.{ts,tsx,vue,svelte,astro}"],
19
+ },
20
+ ],
21
+ });
22
+ ```
23
+
24
+ Each entry in `projects` selects a stylesheet and the files that belong to it.
25
+ Most applications need one project. A monorepo can list one project for each
26
+ application.
27
+
28
+ ## Where Stillwind finds the file
29
+
30
+ The build integration searches from the application root upward. The CLI and
31
+ the editor search from the working directory or the workspace upward. The file
32
+ in the nearest directory wins.
33
+
34
+ Stillwind accepts `stillwind.config.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`,
35
+ and `.json`. In one directory, it uses the first of these that exists.
36
+
37
+ `defineConfig()` also accepts a function or an async function that returns the
38
+ settings. Stillwind calls it once and uses the result.
39
+
40
+ ## Project fields
41
+
42
+ ### Required
43
+
44
+ | Field | Value |
45
+ | ------- | ---------------------------------------------------------------------------------- |
46
+ | `css` | Path to the stylesheet that defines the theme, utilities, and variants |
47
+ | `files` | Globs for the files that the CLI and the editor check; the build does not use them |
48
+
49
+ ### Scope
50
+
51
+ | Field | Value |
52
+ | ---------- | ------------------------------------------------------------------------------------ |
53
+ | `name` | A unique name that selects this project from an integration or the CLI |
54
+ | `root` | The project directory, relative to the configuration file; defaults to its directory |
55
+ | `exclude` | Globs that remove files from `files`; `node_modules` and `.git` are always excluded |
56
+ | `tsconfig` | Path to the TypeScript configuration; defaults to `tsconfig.json` in the root |
57
+
58
+ Paths in `css`, `files`, `exclude`, and `tsconfig` are relative to `root`.
59
+
60
+ ### Checks and sorting
61
+
62
+ | Field | Value |
63
+ | ------ | ------------------------------------------------------------------------------------------ |
64
+ | `lint` | Presets and rules; see [Lint](#lint) |
65
+ | `sort` | Where `stillwind fmt` sorts utilities, or `false` to disable them; see [Sorting](#sorting) |
66
+
67
+ ### Generated CSS
68
+
69
+ | Field | Value |
70
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
71
+ | `target` | Minimum browser versions, such as `["chrome111", "safari17"]`; removes fallbacks they do not need |
72
+ | `utilityOrder` | `"authored"` orders utilities as your stylesheet defines them; `"tailwind"` orders them as Tailwind does |
73
+ | `important` | `true` makes every utility `!important`; a selector nests utilities under that selector |
74
+ | `tailwind` | A Tailwind configuration object; see [Migrating from Tailwind CSS](guides/migrating-from-tailwind.md#move-configuration) |
75
+ | `plugins` | Plugin objects for the `@plugin` rules of your stylesheet |
76
+ | `rootFontSize` | Pixels per `rem`, used by lint fixes and editor previews; defaults to 16 |
77
+ | `useCssIf` | `true` lets runtime CSS conditions use the native CSS `if()` function; defaults to `false` |
78
+
79
+ ### Generated names
80
+
81
+ | Field | Value |
82
+ | ---------------- | ----------------------------------------------------------------------------------- |
83
+ | `classNamespace` | Text added to generated class names; use the same value in client and server builds |
84
+ | `hashLength` | Number of hash characters in generated names, from 1 to 50; defaults to 5 |
85
+ | `prefix` | Prefix for Stillwind's custom properties; defaults to `--sw-` |
86
+ | `tailwindPrefix` | Prefix for Tailwind-compatible internal custom properties; defaults to `--tw-` |
87
+ | `themePrefix` | Prefix for theme variables in generated CSS, such as `--tw-`; omit it to keep names |
88
+ | `naming` | Functions that choose generated names yourself |
89
+ | `namingRevision` | A string that you change whenever you change the `naming` functions |
90
+
91
+ ### Editor
92
+
93
+ | Field | Value |
94
+ | --------- | ------------------------------------------------------------------------------------------- |
95
+ | `preview` | Which comments CSS previews show: `themeValues`, `pixelEquivalents`, and `colorEquivalents` |
96
+
97
+ The [shared configuration API](https://github.com/SegaraRai/stillwind/blob/main/packages/config/src/compiler.ts)
98
+ describes the remaining fields for custom integrations, such as `sources`,
99
+ `projection`, `typeFacts`, and `automatic`.
100
+
101
+ ## Lint
102
+
103
+ The `lint` field of a project selects the rules that the CLI and the editor
104
+ report. [Checks in the editor and CI](guides/lint-adoption.md) explains
105
+ where the rules run.
106
+
107
+ ### Presets and severities
108
+
109
+ ```ts title="stillwind.config.ts"
110
+ import { defineConfig, lintPresets } from "stillwind/config";
111
+
112
+ export default defineConfig({
113
+ projects: [
114
+ {
115
+ css: "./src/stillwind.css",
116
+ files: ["src/**/*.{ts,tsx,vue,svelte,astro}"],
117
+ lint: {
118
+ extends: [lintPresets.recommended, lintPresets.stylistic],
119
+ rules: {
120
+ "unknown-utility": "deny",
121
+ "no-arbitrary-colors": "warn",
122
+ },
123
+ },
124
+ },
125
+ ],
126
+ });
127
+ ```
128
+
129
+ | Preset | Contents |
130
+ | ------------- | ---------------------------------------------------------------------- |
131
+ | `recommended` | Invalid input, conflicting styles, and other likely mistakes |
132
+ | `strict` | Every `recommended` rule as an error, and unused suppression comments |
133
+ | `stylistic` | Preferred spellings and utility sorting; combine it with `recommended` |
134
+
135
+ The [lint rule reference](lints/index.md) shows the severity of each rule in
136
+ `recommended`. Each rule page shows its severity in every preset.
137
+
138
+ Each rule has one of three severities:
139
+
140
+ | Severity | Effect |
141
+ | -------- | --------------------------------------------------------- |
142
+ | `warn` | Reports a warning, which does not fail the CLI by default |
143
+ | `deny` | Reports an error, which fails the CLI |
144
+ | `off` | Reports nothing and applies no fixes |
145
+
146
+ ### How the settings combine
147
+
148
+ | `lint` value | Result |
149
+ | --------------------------- | ------------------------------------ |
150
+ | Not set | The `recommended` preset |
151
+ | An object without `extends` | No preset; only the rules in `rules` |
152
+ | `false` or `{}` | No rules and no fixes |
153
+
154
+ Stillwind applies the presets in `extends` in order, and then `rules`. A later
155
+ setting replaces the severity of an earlier one. Options in objects merge, and
156
+ arrays replace earlier arrays. A severity alone, such as `"deny"`, keeps the
157
+ rule's options from the presets.
158
+
159
+ An unknown rule name is a configuration error. Turning off rules does not turn
160
+ off [compiler errors](errors/index.md).
161
+
162
+ ### Rule options
163
+
164
+ Some rules accept options. Write the rule as an object with `severity` and the
165
+ options:
166
+
167
+ ```ts
168
+ const rules = {
169
+ "no-restricted-utilities": {
170
+ severity: "deny",
171
+ utilities: [{ pattern: "absolute", message: "Use the positioned component." }],
172
+ },
173
+ "no-restricted-declarations": {
174
+ severity: "deny",
175
+ rules: [{ properties: ["position"], values: ["absolute"] }],
176
+ },
177
+ "no-restricted-length-units": {
178
+ severity: "warn",
179
+ rules: [{ properties: ["width", "height"], disallow: ["px"] }],
180
+ },
181
+ "no-restricted-theme-tokens": {
182
+ severity: "deny",
183
+ tokens: ["--color-blue-*"],
184
+ },
185
+ };
186
+ ```
187
+
188
+ | Rule | Options |
189
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
190
+ | `conflicting-utilities` | `allowShorthandOverrides`: allows the supported overrides between shorthand and longhand utilities; defaults to `false` |
191
+ | `invalid-marker-use` | `ignoredClasses`: marker class names that the rule ignores |
192
+ | `no-arbitrary-spacing` | `properties`: properties to check in addition to margin, padding, and gap |
193
+ | `no-restricted-utilities` | `utilities`: utility patterns, each with an optional message |
194
+ | `no-restricted-declarations` | `rules`: patterns for properties and values; every matching entry applies |
195
+ | `no-restricted-length-units` | `rules`: property patterns and the units to `disallow`; the last matching entry applies |
196
+ | `no-restricted-theme-tokens` | `tokens`: patterns for theme custom properties; required when the rule is on |
197
+ | `prefer-canonical-utilities` | `pxToRem` and `collapse` default to `true`; `logicalToPhysical` defaults to `false`; `preserveSpecificity` defaults to `true`. See the [rule options](lints/prefer-canonical-utilities.md#options). |
198
+ | `prefer-variant-directive` | `pxToRem`: treats `px` and `rem` in media queries as equal at 16px per `rem`; defaults to `false` |
199
+
200
+ Patterns accept `*` for any text and `?` for one character. Utility and theme
201
+ token patterns are case-sensitive. Property and value patterns are not.
202
+
203
+ ### Definitions of packages and plugins
204
+
205
+ [incompatible-property-value](lints/incompatible-property-value.md) checks
206
+ the declarations that utility definitions write. By default, it checks only your
207
+ own definitions: your stylesheet, the stylesheets that it imports by a relative
208
+ or absolute path, and the plugin files that it loads by path. Two project-level
209
+ fields of `lint` add the definitions of packages and plugins. Presets cannot set
210
+ them.
211
+
212
+ ```ts
213
+ lint: {
214
+ extends: [lintPresets.recommended],
215
+ checkLibraries: ["@acme/*"],
216
+ checkPlugins: ["brand"],
217
+ }
218
+ ```
219
+
220
+ | Field | Checks the definitions of |
221
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
222
+ | `checkLibraries` | Stylesheets that you import by package name, and stylesheets under `node_modules`, matched by package name, such as `stillwind` |
223
+ | `checkPlugins` | Plugins that you load by package name or configure in `plugins`, matched by the name in the `@plugin` rule |
224
+
225
+ Each field accepts `true` for every package or plugin, `false` for none, or a
226
+ list of case-sensitive patterns. Both fields default to `false`. Use them to
227
+ check a package of your own, such as a design system in the same repository, or
228
+ to find problems to report upstream.
229
+
230
+ ## Suppression comments
231
+
232
+ To allow one exception, add a comment that names the rule. Give the reason after
233
+ `--`:
234
+
235
+ ```ts
236
+ import { style } from "stillwind/react";
237
+
238
+ // swlint-disable-next-line no-arbitrary-colors -- External brand color.
239
+ export const badge = style("bg-[#123456]");
240
+ ```
241
+
242
+ | Comment | Applies to |
243
+ | ------------------------------------------------ | ---------------------------------- |
244
+ | `swlint-disable-next-line <rule>` | The next line |
245
+ | `swlint-disable-line <rule>` | The same line |
246
+ | `swlint-disable <rule>` … `swlint-enable <rule>` | The lines between the two comments |
247
+
248
+ In stylesheets, write the same text in `/* ... */` comments.
249
+
250
+ A comment hides the finding only. A misspelled utility still produces no CSS.
251
+ [invalid-lint-suppression](lints/invalid-lint-suppression.md) reports a
252
+ malformed comment, and
253
+ [unused-lint-suppression](lints/unused-lint-suppression.md) reports a
254
+ comment that suppresses nothing.
255
+
256
+ ## Sorting
257
+
258
+ The `sort` field controls where `stillwind fmt` and the editor sort utilities:
259
+
260
+ | Option | Sorts | Default |
261
+ | ----------------- | -------------------------------------------------- | ------- |
262
+ | `stringLiterals` | Utilities inside each string | `true` |
263
+ | `arrays` | Arguments, array items, and object entries by kind | `true` |
264
+ | `applyUtilities` | Utilities inside each `@apply` rule | `true` |
265
+ | `applyStatements` | Adjacent `@apply` rules | `false` |
266
+ | `variantBlocks` | Adjacent `@variant` blocks | `false` |
267
+
268
+ `sort: false` disables sorting, including `stillwind fmt` and the
269
+ [prefer-sorted-utilities](lints/prefer-sorted-utilities.md) rule. Turning off
270
+ only that rule keeps `stillwind fmt` working.
271
+
272
+ The CLI checks the files that `files` selects. File patterns on the command line
273
+ narrow that set; they cannot add files outside it.
274
+
275
+ ## Several projects
276
+
277
+ When the file has several projects, each integration selects one:
278
+
279
+ 1. If the integration has a `project` option, it selects the project with that `name`.
280
+ 2. Otherwise, it selects the project whose `root` is the deepest directory that
281
+ contains the application root.
282
+
283
+ If no project or more than one project matches, the build fails with a
284
+ configuration error. The CLI and the editor check every project.
285
+
286
+ ## Override settings in the integration
287
+
288
+ The integration accepts options that change how it reads the file:
289
+
290
+ ```ts
291
+ import { stillwind } from "@stillwind/integration/vite";
292
+
293
+ stillwind({ configFile: "config/stillwind.config.ts", project: "web" });
294
+ ```
295
+
296
+ `configFile` selects another file, relative to the application root. Other
297
+ options, such as `css` or `lint`, replace the values of the selected project.
298
+ Objects merge with the file's values, and arrays replace them.
@@ -0,0 +1,51 @@
1
+ ---
2
+ title: "SW01001: Invalid property prefix"
3
+ description: "The prefix, tailwindPrefix, or themePrefix setting does not start with -- and end with -."
4
+ ---
5
+
6
+ # SW01001: Invalid property prefix
7
+
8
+ This error occurs when `prefix`, `tailwindPrefix`, or `themePrefix` is not a valid prefix for
9
+ custom properties. A prefix must start with `--`, end with `-`, and contain no
10
+ whitespace. The message names the setting.
11
+
12
+ ## Reported
13
+
14
+ **stillwind.config.ts**
15
+
16
+ ```ts
17
+ import { defineConfig } from "stillwind/config";
18
+
19
+ export default defineConfig({
20
+ projects: [
21
+ {
22
+ css: "./src/stillwind.css",
23
+ files: ["src/**/*.tsx"],
24
+ prefix: "sw",
25
+ },
26
+ ],
27
+ });
28
+ ```
29
+
30
+ > SW01001: prefix must start with `--` and end with `-`
31
+
32
+ ## Fixed
33
+
34
+ ```ts title="stillwind.config.ts"
35
+ import { defineConfig } from "stillwind/config";
36
+
37
+ export default defineConfig({
38
+ projects: [
39
+ {
40
+ css: "./src/stillwind.css",
41
+ files: ["src/**/*.tsx"],
42
+ prefix: "--sw-",
43
+ },
44
+ ],
45
+ });
46
+ ```
47
+
48
+ ## How to fix
49
+
50
+ - Add `--` at the start and `-` at the end, as in the example.
51
+ - Use the same value in client and server builds that share styles.
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: "SW01002: Invalid hash length"
3
+ description: "The hashLength setting is outside the supported range."
4
+ ---
5
+
6
+ # SW01002: Invalid hash length
7
+
8
+ This error occurs when `hashLength` is not an integer from 1 to 50. The setting
9
+ chooses the number of hash characters in generated names. The message shows the
10
+ value and the maximum.
11
+
12
+ ## Reported
13
+
14
+ **stillwind.config.ts**
15
+
16
+ ```ts
17
+ import { defineConfig } from "stillwind/config";
18
+
19
+ export default defineConfig({
20
+ projects: [
21
+ {
22
+ css: "./src/stillwind.css",
23
+ files: ["src/**/*.tsx"],
24
+ hashLength: 0,
25
+ },
26
+ ],
27
+ });
28
+ ```
29
+
30
+ > SW01002: hashLength must be between 1 and 50 base-36 digits, not 0
31
+
32
+ ## Fixed
33
+
34
+ ```ts title="stillwind.config.ts"
35
+ import { defineConfig } from "stillwind/config";
36
+
37
+ export default defineConfig({
38
+ projects: [
39
+ {
40
+ css: "./src/stillwind.css",
41
+ files: ["src/**/*.tsx"],
42
+ hashLength: 5,
43
+ },
44
+ ],
45
+ });
46
+ ```
47
+
48
+ ## How to fix
49
+
50
+ - Use an integer from 1 to 50. The default is 5.
51
+ - To shorten names, lower the value. To make collisions less likely, raise it.
52
+ - Use the same value in client and server builds that share styles.
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: "SW01003: Invalid lint configuration"
3
+ description: "A lint rule has an option value that the compiler cannot use."
4
+ ---
5
+
6
+ # SW01003: Invalid lint configuration
7
+
8
+ This error occurs when a lint rule has an option value that the compiler cannot
9
+ use, such as an unknown unit or an empty list that the rule requires. The message
10
+ names the rule and the value.
11
+
12
+ ## Reported
13
+
14
+ **stillwind.config.ts**
15
+
16
+ ```ts
17
+ import { defineConfig } from "stillwind/config";
18
+
19
+ export default defineConfig({
20
+ projects: [
21
+ {
22
+ css: "./src/stillwind.css",
23
+ files: ["src/**/*.tsx"],
24
+ lint: {
25
+ rules: {
26
+ "no-restricted-length-units": {
27
+ severity: "warn",
28
+ rules: [{ properties: ["width"], disallow: ["pixels"] }],
29
+ },
30
+ },
31
+ },
32
+ },
33
+ ],
34
+ });
35
+ ```
36
+
37
+ > SW01003: invalid `no-restricted-length-units` lint configuration: rules require property patterns and valid CSS length units
38
+
39
+ ## Fixed
40
+
41
+ ```ts title="stillwind.config.ts"
42
+ import { defineConfig } from "stillwind/config";
43
+
44
+ export default defineConfig({
45
+ projects: [
46
+ {
47
+ css: "./src/stillwind.css",
48
+ files: ["src/**/*.tsx"],
49
+ lint: {
50
+ rules: {
51
+ "no-restricted-length-units": {
52
+ severity: "warn",
53
+ rules: [{ properties: ["width"], disallow: ["px"] }],
54
+ },
55
+ },
56
+ },
57
+ },
58
+ ],
59
+ });
60
+ ```
61
+
62
+ ## How to fix
63
+
64
+ - Correct the value named in the message. In the example, the unit is `px`, not
65
+ `pixels`.
66
+ - Give the rules that need a list, such as `no-restricted-theme-tokens`, at least
67
+ one entry.
68
+
69
+ Each [lint rule page](../lints/index.md) describes its options.
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: "SW02001: Framework constraint conflict"
3
+ description: "The prepared source selects a framework that differs from the component format."
4
+ ---
5
+
6
+ # SW02001: Framework constraint conflict
7
+
8
+ This error occurs when a custom integration supplies a source `framework` that
9
+ conflicts with the component's original format. For example, a Vue component
10
+ cannot be projected with an explicit Svelte framework constraint.
11
+
12
+ ## How to fix
13
+
14
+ Set the prepared source's `framework` field to the component's framework, or omit
15
+ it when the integration does not need a source constraint. The converter must also
16
+ match the component format.
17
+
18
+ Macro imports select each call's output format independently. A file can import
19
+ several framework macros, including React and vanilla DOM macros.
20
+
21
+ `framework` is not a project option in `stillwind.config.ts`. If an official
22
+ integration supplies the wrong constraint, report the error with the component
23
+ and the Stillwind package versions.
@@ -0,0 +1,51 @@
1
+ ---
2
+ title: "SW02002: Unresolved root stylesheet"
3
+ description: "The stylesheet that the css setting selects cannot be found."
4
+ ---
5
+
6
+ # SW02002: Unresolved root stylesheet
7
+
8
+ This error occurs when the stylesheet that the `css` setting of the project
9
+ selects cannot be found. Stillwind reads the theme, utilities, and variants from
10
+ that stylesheet, so it cannot compile without it.
11
+
12
+ ## Reported
13
+
14
+ **stillwind.config.ts**
15
+
16
+ ```ts
17
+ import { defineConfig } from "stillwind/config";
18
+
19
+ export default defineConfig({
20
+ projects: [
21
+ {
22
+ css: "./src/stilwind.css",
23
+ files: ["src/**/*.tsx"],
24
+ },
25
+ ],
26
+ });
27
+ ```
28
+
29
+ > SW02002: the root CSS source cannot be unresolved
30
+
31
+ ## Fixed
32
+
33
+ ```ts title="stillwind.config.ts"
34
+ import { defineConfig } from "stillwind/config";
35
+
36
+ export default defineConfig({
37
+ projects: [
38
+ {
39
+ css: "./src/stillwind.css",
40
+ files: ["src/**/*.tsx"],
41
+ },
42
+ ],
43
+ });
44
+ ```
45
+
46
+ ## How to fix
47
+
48
+ - Check the path in `css`. It is relative to the `root` of the project, or to the
49
+ configuration file when `root` is not set.
50
+ - If you write your own integration, answer the request for the root stylesheet
51
+ with its source text. Only imported stylesheets may be unresolved.