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.
- package/AGENTS_TEMPLATE.md +3 -2
- package/CHANGELOG.md +80 -0
- package/README.md +3 -3
- package/css/builtin-utilities/tw-borders.css +59 -59
- package/css/builtin-utilities/tw-effects.css +53 -53
- package/css/builtin-utilities/tw-typography.css +13 -13
- package/dist/class-object-C87DR3v2.js +6 -0
- package/dist/class-object-C87DR3v2.js.map +1 -0
- package/dist/class-object-CR0QHoF9.d.ts +10 -0
- package/dist/{class-string-C5YFtXQn.d.ts → class-string-BlClX8JK.d.ts} +2 -2
- package/dist/class-string-CiNTVHYm.js +6 -0
- package/dist/{class-string-KnYInbiw.js.map → class-string-CiNTVHYm.js.map} +1 -1
- package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
- package/dist/formats-DP9B9SG6.js.map +1 -0
- package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
- package/dist/frameworks/alpine.d.ts +5 -3
- package/dist/frameworks/alpine.js +3 -1
- package/dist/frameworks/alpine.js.map +1 -1
- package/dist/frameworks/astro.d.ts +3 -3
- package/dist/frameworks/astro.js +1 -1
- package/dist/frameworks/lit.d.ts +5 -3
- package/dist/frameworks/lit.js +3 -1
- package/dist/frameworks/lit.js.map +1 -1
- package/dist/frameworks/preact.d.ts +3 -3
- package/dist/frameworks/preact.js +1 -1
- package/dist/frameworks/qwik.d.ts +3 -3
- package/dist/frameworks/qwik.js +1 -1
- package/dist/frameworks/react.d.ts +2 -2
- package/dist/frameworks/react.js +1 -1
- package/dist/frameworks/solid.d.ts +3 -3
- package/dist/frameworks/solid.js +1 -1
- package/dist/frameworks/svelte.d.ts +3 -3
- package/dist/frameworks/svelte.js +1 -1
- package/dist/frameworks/vanilla.d.ts +5 -3
- package/dist/frameworks/vanilla.js +6 -1
- package/dist/frameworks/vanilla.js.map +1 -0
- package/dist/frameworks/vue.d.ts +3 -3
- package/dist/frameworks/vue.js +1 -1
- package/dist/{index-DBpgaaD7.d.ts → index-DpaDcczW.d.ts} +157 -57
- package/dist/macro/index.d.ts +2 -2
- package/dist/macro/index.js +1 -1
- package/dist/runtime/development.d.ts +16 -8
- package/dist/runtime/development.js +57 -21
- package/dist/runtime/development.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/style-dMBm8aX_.js +50 -0
- package/dist/style-dMBm8aX_.js.map +1 -0
- package/docs/agents.md +1 -0
- package/docs/at-rules/apply.md +1 -1
- package/docs/at-rules/custom-variant.md +1 -1
- package/docs/at-rules/slot.md +1 -1
- package/docs/at-rules/stillwind-property.md +1 -1
- package/docs/at-rules/stillwind-registry.md +7 -7
- package/docs/at-rules/stillwind-require-properties.md +1 -1
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
- package/docs/at-rules/stillwind-undef-utility.md +1 -1
- package/docs/at-rules/stillwind-undef-variant.md +1 -1
- package/docs/at-rules/theme.md +5 -5
- package/docs/at-rules/utility.md +43 -4
- package/docs/at-rules/variant.md +1 -1
- package/docs/cli.md +146 -51
- package/docs/concepts/css-ordering.md +46 -7
- package/docs/concepts/how-styles-compile.md +8 -8
- package/docs/configuration.md +63 -4
- package/docs/errors/SW01001.md +1 -1
- package/docs/errors/SW03001.md +1 -1
- package/docs/errors/SW10004.md +1 -1
- package/docs/errors/SW10005.md +1 -1
- package/docs/errors/SW10006.md +34 -0
- package/docs/errors/SW11001.md +1 -1
- package/docs/errors/SW12001.md +1 -1
- package/docs/errors/SW12002.md +1 -1
- package/docs/errors/SW13002.md +1 -1
- package/docs/errors/SW14001.md +1 -1
- package/docs/errors/SW14002.md +1 -1
- package/docs/errors/SW14003.md +1 -1
- package/docs/errors/SW14004.md +1 -1
- package/docs/errors/SW14007.md +1 -1
- package/docs/errors/SW32003.md +1 -1
- package/docs/errors/SW32005.md +1 -1
- package/docs/errors/index.md +1 -0
- package/docs/formatters.md +34 -2
- package/docs/guides/lint-adoption.md +2 -0
- package/docs/guides/migrating-from-tailwind.md +60 -9
- package/docs/guides/recommended-practices.md +18 -0
- package/docs/guides/reusable-styles.md +2 -2
- package/docs/guides/tailwind-compatibility.md +8 -0
- package/docs/index.md +4 -5
- package/docs/integrations.md +314 -79
- package/docs/lints/conflicting-utilities.md +9 -0
- package/docs/lints/cyclic-style-order.md +61 -0
- package/docs/lints/index.md +26 -10
- package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
- package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
- package/docs/lints/invalid-rule-group-input.md +1 -1
- package/docs/lints/missing-view-transition-name.md +1 -1
- package/docs/lints/multiple-style-forwards.md +59 -0
- package/docs/lints/partial-utility-override.md +77 -0
- package/docs/lints/prefer-direct-styling.md +1 -1
- package/docs/lints/suspending-macro-argument.md +1 -1
- package/docs/lints/utility-class-selector.md +72 -0
- package/docs/llms.txt +238 -0
- package/docs/macros/index.md +1 -1
- package/docs/macros/recipe.md +246 -0
- package/docs/macros/style.md +72 -0
- package/docs/macros/when.md +1 -1
- package/docs/plugins/iconify.md +2 -0
- package/docs/utilities-and-variants.md +2 -0
- package/package.json +6 -6
- package/skills/setup-stillwind/SKILL.md +1 -2
- package/skills/stillwind/SKILL.md +19 -12
- package/dist/class-object-BaK8uudd.d.ts +0 -9
- package/dist/class-object-DNcjzcfH.js +0 -6
- package/dist/class-object-DNcjzcfH.js.map +0 -1
- package/dist/class-string-KnYInbiw.js +0 -6
- package/dist/formats-Ctf2WFc-.js.map +0 -1
- package/dist/style-BE8vuLiO.js +0 -44
- package/dist/style-BE8vuLiO.js.map +0 -1
- package/docs/macros/cva.md +0 -155
package/docs/macros/cva.md
DELETED
|
@@ -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.
|