stillwind 0.11.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 (120) hide show
  1. package/AGENTS_TEMPLATE.md +3 -2
  2. package/CHANGELOG.md +80 -0
  3. package/README.md +3 -3
  4. package/css/builtin-utilities/tw-borders.css +59 -59
  5. package/css/builtin-utilities/tw-effects.css +53 -53
  6. package/css/builtin-utilities/tw-typography.css +13 -13
  7. package/dist/class-object-C87DR3v2.js +6 -0
  8. package/dist/class-object-C87DR3v2.js.map +1 -0
  9. package/dist/class-object-CR0QHoF9.d.ts +10 -0
  10. package/dist/{class-string-C5YFtXQn.d.ts → class-string-BlClX8JK.d.ts} +2 -2
  11. package/dist/class-string-CiNTVHYm.js +6 -0
  12. package/dist/{class-string-KnYInbiw.js.map → class-string-CiNTVHYm.js.map} +1 -1
  13. package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
  14. package/dist/formats-DP9B9SG6.js.map +1 -0
  15. package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
  16. package/dist/frameworks/alpine.d.ts +5 -3
  17. package/dist/frameworks/alpine.js +3 -1
  18. package/dist/frameworks/alpine.js.map +1 -1
  19. package/dist/frameworks/astro.d.ts +3 -3
  20. package/dist/frameworks/astro.js +1 -1
  21. package/dist/frameworks/lit.d.ts +5 -3
  22. package/dist/frameworks/lit.js +3 -1
  23. package/dist/frameworks/lit.js.map +1 -1
  24. package/dist/frameworks/preact.d.ts +3 -3
  25. package/dist/frameworks/preact.js +1 -1
  26. package/dist/frameworks/qwik.d.ts +3 -3
  27. package/dist/frameworks/qwik.js +1 -1
  28. package/dist/frameworks/react.d.ts +2 -2
  29. package/dist/frameworks/react.js +1 -1
  30. package/dist/frameworks/solid.d.ts +3 -3
  31. package/dist/frameworks/solid.js +1 -1
  32. package/dist/frameworks/svelte.d.ts +3 -3
  33. package/dist/frameworks/svelte.js +1 -1
  34. package/dist/frameworks/vanilla.d.ts +5 -3
  35. package/dist/frameworks/vanilla.js +6 -1
  36. package/dist/frameworks/vanilla.js.map +1 -0
  37. package/dist/frameworks/vue.d.ts +3 -3
  38. package/dist/frameworks/vue.js +1 -1
  39. package/dist/{index-DBpgaaD7.d.ts → index-DpaDcczW.d.ts} +157 -57
  40. package/dist/macro/index.d.ts +2 -2
  41. package/dist/macro/index.js +1 -1
  42. package/dist/runtime/development.d.ts +16 -8
  43. package/dist/runtime/development.js +57 -21
  44. package/dist/runtime/development.js.map +1 -1
  45. package/dist/runtime/index.d.ts +2 -2
  46. package/dist/runtime/index.js +1 -1
  47. package/dist/style-dMBm8aX_.js +50 -0
  48. package/dist/style-dMBm8aX_.js.map +1 -0
  49. package/docs/agents.md +1 -0
  50. package/docs/at-rules/apply.md +1 -1
  51. package/docs/at-rules/custom-variant.md +1 -1
  52. package/docs/at-rules/slot.md +1 -1
  53. package/docs/at-rules/stillwind-property.md +1 -1
  54. package/docs/at-rules/stillwind-registry.md +7 -7
  55. package/docs/at-rules/stillwind-require-properties.md +1 -1
  56. package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
  57. package/docs/at-rules/stillwind-undef-utility.md +1 -1
  58. package/docs/at-rules/stillwind-undef-variant.md +1 -1
  59. package/docs/at-rules/theme.md +5 -5
  60. package/docs/at-rules/utility.md +43 -4
  61. package/docs/at-rules/variant.md +1 -1
  62. package/docs/cli.md +146 -51
  63. package/docs/concepts/css-ordering.md +46 -7
  64. package/docs/concepts/how-styles-compile.md +8 -8
  65. package/docs/configuration.md +63 -4
  66. package/docs/errors/SW01001.md +1 -1
  67. package/docs/errors/SW03001.md +1 -1
  68. package/docs/errors/SW10004.md +1 -1
  69. package/docs/errors/SW10005.md +1 -1
  70. package/docs/errors/SW10006.md +34 -0
  71. package/docs/errors/SW11001.md +1 -1
  72. package/docs/errors/SW12001.md +1 -1
  73. package/docs/errors/SW12002.md +1 -1
  74. package/docs/errors/SW13002.md +1 -1
  75. package/docs/errors/SW14001.md +1 -1
  76. package/docs/errors/SW14002.md +1 -1
  77. package/docs/errors/SW14003.md +1 -1
  78. package/docs/errors/SW14004.md +1 -1
  79. package/docs/errors/SW14007.md +1 -1
  80. package/docs/errors/SW32003.md +1 -1
  81. package/docs/errors/SW32005.md +1 -1
  82. package/docs/errors/index.md +1 -0
  83. package/docs/formatters.md +34 -2
  84. package/docs/guides/lint-adoption.md +2 -0
  85. package/docs/guides/migrating-from-tailwind.md +60 -9
  86. package/docs/guides/recommended-practices.md +18 -0
  87. package/docs/guides/reusable-styles.md +2 -2
  88. package/docs/guides/tailwind-compatibility.md +8 -0
  89. package/docs/index.md +4 -5
  90. package/docs/integrations.md +314 -79
  91. package/docs/lints/conflicting-utilities.md +9 -0
  92. package/docs/lints/cyclic-style-order.md +61 -0
  93. package/docs/lints/index.md +26 -10
  94. package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
  95. package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
  96. package/docs/lints/invalid-rule-group-input.md +1 -1
  97. package/docs/lints/missing-view-transition-name.md +1 -1
  98. package/docs/lints/multiple-style-forwards.md +59 -0
  99. package/docs/lints/partial-utility-override.md +77 -0
  100. package/docs/lints/prefer-direct-styling.md +1 -1
  101. package/docs/lints/suspending-macro-argument.md +1 -1
  102. package/docs/lints/utility-class-selector.md +72 -0
  103. package/docs/llms.txt +238 -0
  104. package/docs/macros/index.md +1 -1
  105. package/docs/macros/recipe.md +246 -0
  106. package/docs/macros/style.md +72 -0
  107. package/docs/macros/when.md +1 -1
  108. package/docs/plugins/iconify.md +2 -0
  109. package/docs/utilities-and-variants.md +2 -0
  110. package/package.json +6 -6
  111. package/skills/setup-stillwind/SKILL.md +1 -2
  112. package/skills/stillwind/SKILL.md +19 -12
  113. package/dist/class-object-BaK8uudd.d.ts +0 -9
  114. package/dist/class-object-DNcjzcfH.js +0 -6
  115. package/dist/class-object-DNcjzcfH.js.map +0 -1
  116. package/dist/class-string-KnYInbiw.js +0 -6
  117. package/dist/formats-Ctf2WFc-.js.map +0 -1
  118. package/dist/style-BE8vuLiO.js +0 -44
  119. package/dist/style-BE8vuLiO.js.map +0 -1
  120. package/docs/macros/cva.md +0 -155
@@ -1,155 +0,0 @@
1
- ---
2
- title: "style.cva()"
3
- description: "Create a factory that selects compiled styles by option, with the configuration of class-variance-authority."
4
- ---
5
-
6
- # style.cva()
7
-
8
- `style.cva(base?, config?)` creates a factory with the configuration format of
9
- `cva` from [Class Variance Authority](https://cva.style/). The compiler
10
- generates the CSS for every option at build time. Calling the factory selects
11
- the compiled classes for the chosen options and returns props for an element.
12
-
13
- `style.cva()` exists mainly to migrate existing CVA components. For new
14
- components, see [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles).
15
-
16
- ## Example
17
-
18
- ### Source
19
-
20
- ```tsx
21
- import { style } from "stillwind/react";
22
-
23
- export const button = style.cva("inline-flex rounded-md", {
24
- variants: {
25
- size: {
26
- small: "px-2 py-1",
27
- large: "px-4 py-2",
28
- },
29
- },
30
- defaultVariants: {
31
- size: "small",
32
- },
33
- compoundVariants: [
34
- {
35
- size: "large",
36
- class: "font-medium",
37
- },
38
- ],
39
- });
40
-
41
- export const props = button({ size: "large" });
42
- ```
43
-
44
- ### Compiled code
45
-
46
- ```ts
47
- import { stillwindClassNameObjectCva } from "stillwind/runtime";
48
-
49
- export const button = stillwindClassNameObjectCva("sw_6tzpq", {
50
- variants: {
51
- size: {
52
- small: "sw_gzwci",
53
- large: "sw_w6696",
54
- },
55
- },
56
- defaultVariants: {
57
- size: "small",
58
- },
59
- compoundVariants: [
60
- {
61
- size: "large",
62
- class: "sw_v1iw3",
63
- },
64
- ],
65
- });
66
-
67
- export const props = button({ size: "large" });
68
- ```
69
-
70
- ### Generated CSS
71
-
72
-
73
- ```css
74
- .sw_6tzpq {
75
- display: inline-flex;
76
- border-radius: var(--radius-md);
77
- }
78
-
79
- .sw_gzwci {
80
- padding-inline: calc(var(--spacing) * 2);
81
- padding-block: calc(var(--spacing) * 1);
82
- }
83
-
84
- .sw_w6696 {
85
- padding-inline: calc(var(--spacing) * 4);
86
- padding-block: calc(var(--spacing) * 2);
87
- }
88
-
89
- .sw_v1iw3 {
90
- --tw-font-weight: var(--font-weight-medium);
91
- font-weight: var(--font-weight-medium);
92
- }
93
- ```
94
-
95
- ## Configuration
96
-
97
- Write the configuration as an object literal in the call:
98
-
99
- | Field | Value |
100
- | ------------------ | ---------------------------------------------------------------- |
101
- | `variants` | Each option name maps each value to a style |
102
- | `defaultVariants` | The value that each option uses when the call passes `undefined` |
103
- | `compoundVariants` | Entries that add `class` when every listed option matches |
104
-
105
- `class` and `className` cannot be option names, because the factory uses them
106
- for classes from other stylesheets. An option with the values `true` and
107
- `false` accepts booleans.
108
-
109
- Use `VariantProps<typeof button>` from your framework's entrypoint to type the
110
- options.
111
-
112
- ## Style values
113
-
114
- The base and each option value accept utility strings, arrays, objects with
115
- variant keys, `true`, `false`, `null`, `undefined`, and custom properties.
116
-
117
- They do not accept `&&`, ternaries, stored [`style()`](https://stillwind.dev/docs/macros/style)
118
- results, refs, animations, or `class` fields. To choose a style at runtime,
119
- pass a different option to the factory.
120
- [invalid-cva-input](https://stillwind.dev/docs/lints/invalid-cva-input) reports these values, and
121
- [invalid-cva-config](https://stillwind.dev/docs/lints/invalid-cva-config) reports a malformed
122
- configuration.
123
-
124
- A custom property value can be an expression. The factory evaluates it once,
125
- when the factory is created. Custom properties stay in the inline style, so a
126
- later option can replace them.
127
-
128
- ## Calling the factory
129
-
130
- | Option value | Result |
131
- | ------------ | ------------------------------------- |
132
- | `undefined` | Uses the value from `defaultVariants` |
133
- | `null` | Adds nothing for that option |
134
- | A value | Adds the style of that value |
135
-
136
- The result combines, in order: the base, the selected values in the order of
137
- the keys of `variants`, every matching compound variant in array order, and the
138
- `class` or `className` from the call. The option values are not passed to the
139
- element. Each call returns a new props object.
140
-
141
- The factory does not merge utilities at runtime. When two selected styles set
142
- the same property, the compiler's CSS order decides which one wins.
143
-
144
- The props that the factory returns cannot be passed to `style()` as a base.
145
-
146
- ## Generated code
147
-
148
- The compiler creates the factory with a helper from `stillwind/runtime`, such as
149
- `stillwindClassNameObjectCva` for React, together with the compiled class names.
150
- Factory calls stay ordinary JavaScript.
151
- The development build checks the selected values and the classes from other
152
- stylesheets.
153
-
154
- See [Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind#cva) to
155
- convert existing `cva` calls.