stillwind 0.8.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.
- package/CHANGELOG.md +193 -0
- package/css/builtin-variants/tw-relationship.css +4 -4
- package/css/builtins.css +1 -1
- package/dist/frameworks/alpine.d.ts +1 -1
- package/dist/frameworks/astro.d.ts +1 -1
- package/dist/frameworks/lit.d.ts +1 -1
- package/dist/frameworks/preact.d.ts +1 -1
- package/dist/frameworks/qwik.d.ts +1 -1
- package/dist/frameworks/solid.d.ts +1 -1
- package/dist/frameworks/svelte.d.ts +1 -1
- package/dist/frameworks/vanilla.d.ts +1 -1
- package/dist/frameworks/vue.d.ts +1 -1
- package/docs/at-rules/apply.md +5 -5
- package/docs/at-rules/custom-variant.md +12 -12
- package/docs/at-rules/index.md +19 -19
- package/docs/at-rules/plugin.md +7 -7
- package/docs/at-rules/registry-directives.md +9 -9
- package/docs/at-rules/slot.md +6 -6
- package/docs/at-rules/stillwind-css-template.md +7 -7
- package/docs/at-rules/stillwind-property.md +10 -10
- package/docs/at-rules/stillwind-registry.md +18 -18
- package/docs/at-rules/stillwind-require-properties.md +9 -9
- package/docs/at-rules/stillwind-slot.md +6 -6
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +9 -9
- package/docs/at-rules/stillwind-undef-utility.md +10 -10
- package/docs/at-rules/stillwind-undef-variant.md +6 -6
- package/docs/at-rules/theme.md +23 -23
- package/docs/at-rules/utility.md +30 -30
- package/docs/at-rules/variant.md +6 -6
- package/docs/cli.md +7 -7
- package/docs/concepts/css-ordering.md +17 -17
- package/docs/concepts/how-styles-compile.md +14 -14
- package/docs/concepts/stylesheets.md +4 -4
- package/docs/configuration.md +19 -19
- package/docs/editors.md +8 -8
- package/docs/errors/SW01003.md +1 -1
- package/docs/errors/SW10001.md +1 -1
- package/docs/errors/SW10002.md +1 -1
- package/docs/errors/SW10004.md +6 -6
- package/docs/errors/SW10005.md +1 -1
- package/docs/errors/SW11001.md +1 -1
- package/docs/errors/SW11003.md +1 -1
- package/docs/errors/SW12001.md +2 -2
- package/docs/errors/SW12002.md +1 -1
- package/docs/errors/SW13001.md +1 -1
- package/docs/errors/SW13003.md +2 -2
- package/docs/errors/SW14001.md +1 -1
- package/docs/errors/SW14003.md +4 -4
- package/docs/errors/SW14004.md +2 -2
- package/docs/errors/SW14005.md +1 -1
- package/docs/errors/SW14006.md +1 -1
- package/docs/errors/SW14007.md +2 -2
- package/docs/errors/SW14008.md +1 -1
- package/docs/errors/SW30001.md +1 -1
- package/docs/errors/SW31001.md +1 -1
- package/docs/errors/SW31004.md +1 -1
- package/docs/errors/SW33005.md +1 -1
- package/docs/errors/SW34002.md +1 -1
- package/docs/errors/SW90001.md +1 -1
- package/docs/errors/SW90005.md +1 -1
- package/docs/errors/SW90006.md +1 -1
- package/docs/errors/index.md +72 -72
- package/docs/formatters.md +5 -5
- package/docs/guides/animations.md +7 -8
- package/docs/guides/design-systems.md +7 -7
- package/docs/guides/element-relationships.md +15 -19
- package/docs/guides/lint-adoption.md +5 -5
- package/docs/guides/migrating-from-css.md +11 -11
- package/docs/guides/migrating-from-tailwind.md +16 -16
- package/docs/guides/recommended-practices.md +18 -18
- package/docs/guides/responsive-styles.md +7 -7
- package/docs/guides/reusable-styles.md +5 -5
- package/docs/guides/runtime-conditions.md +6 -6
- package/docs/guides/style.md +15 -15
- package/docs/guides/tailwind-compatibility.md +21 -21
- package/docs/guides/view-transitions.md +9 -11
- package/docs/guides/web-components.md +4 -4
- package/docs/index.md +14 -12
- package/docs/integrations.md +3 -3
- package/docs/lints/ambiguous-style-base-order.md +2 -2
- package/docs/lints/bypassed-undefinition.md +3 -3
- package/docs/lints/clamped-value.md +1 -1
- package/docs/lints/conflicting-provider-properties.md +2 -2
- package/docs/lints/conflicting-utilities.md +2 -2
- package/docs/lints/document-scoped-selector.md +1 -1
- package/docs/lints/duplicate-definition.md +3 -3
- package/docs/lints/duplicate-utility.md +2 -2
- package/docs/lints/duplicate-view-transition-name.md +3 -3
- package/docs/lints/ignored-definition-condition.md +2 -2
- package/docs/lints/ignored-tailwind-feature.md +3 -3
- package/docs/lints/implicit-nesting-selector.md +2 -2
- package/docs/lints/incompatible-property-value.md +3 -3
- package/docs/lints/incompatible-theme-value.md +1 -1
- package/docs/lints/index.md +74 -74
- package/docs/lints/ineffective-anchor-scope.md +2 -2
- package/docs/lints/interfering-imported-style-base.md +1 -1
- package/docs/lints/invalid-animation-option.md +3 -3
- package/docs/lints/invalid-css-directive.md +3 -3
- package/docs/lints/invalid-css-import.md +2 -2
- package/docs/lints/invalid-css-input.md +4 -4
- package/docs/lints/invalid-cva-config.md +2 -2
- package/docs/lints/invalid-cva-input.md +4 -4
- package/docs/lints/invalid-keyframes-definition.md +2 -2
- package/docs/lints/invalid-keyframes-use.md +2 -2
- package/docs/lints/invalid-keyframes-variant.md +4 -4
- package/docs/lints/invalid-lint-suppression.md +3 -3
- package/docs/lints/invalid-marker-use.md +2 -2
- package/docs/lints/invalid-media-query.md +4 -4
- package/docs/lints/invalid-ref-input.md +4 -4
- package/docs/lints/invalid-rule-group-input.md +2 -2
- package/docs/lints/invalid-runtime-condition.md +3 -3
- package/docs/lints/invalid-stored-variant.md +3 -3
- package/docs/lints/invalid-style-composition.md +2 -2
- package/docs/lints/invalid-style-input.md +2 -2
- package/docs/lints/invalid-theme-reference.md +3 -3
- package/docs/lints/invalid-utility.md +3 -3
- package/docs/lints/invalid-variant.md +2 -2
- package/docs/lints/invalid-view-transition-definition.md +2 -2
- package/docs/lints/invalid-view-transition-use.md +2 -2
- package/docs/lints/invalid-view-transition-variant.md +3 -3
- package/docs/lints/mismatched-framework-import.md +3 -3
- package/docs/lints/missing-document-target.md +2 -2
- package/docs/lints/missing-ref-attachment.md +4 -4
- package/docs/lints/missing-view-transition-name.md +3 -3
- package/docs/lints/mutating-macro-argument.md +2 -2
- package/docs/lints/no-arbitrary-breakpoints.md +2 -2
- package/docs/lints/no-arbitrary-colors.md +2 -2
- package/docs/lints/no-arbitrary-spacing.md +1 -1
- package/docs/lints/no-class-property.md +3 -3
- package/docs/lints/no-important.md +2 -2
- package/docs/lints/no-restricted-declarations.md +1 -1
- package/docs/lints/no-restricted-length-units.md +1 -1
- package/docs/lints/no-restricted-theme-tokens.md +1 -1
- package/docs/lints/no-restricted-utilities.md +2 -2
- package/docs/lints/prefer-canonical-utilities.md +2 -2
- package/docs/lints/prefer-direct-styling.md +3 -3
- package/docs/lints/prefer-logical-properties.md +3 -3
- package/docs/lints/prefer-sorted-utilities.md +2 -2
- package/docs/lints/prefer-typed-relationships.md +3 -3
- package/docs/lints/prefer-typed-variables.md +1 -1
- package/docs/lints/prefer-variant-directive.md +3 -3
- package/docs/lints/redundant-variant.md +2 -2
- package/docs/lints/repeated-nesting-selector.md +2 -2
- package/docs/lints/runtime-condition-requires-css-if.md +3 -3
- package/docs/lints/split-view-transition-class.md +3 -3
- package/docs/lints/suspending-macro-argument.md +2 -2
- package/docs/lints/unknown-utility.md +4 -4
- package/docs/lints/unknown-variant.md +2 -2
- package/docs/lints/unmatched-host-selector.md +2 -2
- package/docs/lints/unsatisfiable-variants.md +1 -1
- package/docs/lints/unused-lint-suppression.md +1 -1
- package/docs/lints/unverified-style-base.md +2 -2
- package/docs/macros/anchor-scope.md +13 -13
- package/docs/macros/css.md +7 -7
- package/docs/macros/cva.md +13 -13
- package/docs/macros/index.md +10 -10
- package/docs/macros/keyframes.md +9 -9
- package/docs/macros/media.md +2 -2
- package/docs/macros/ref/as-anchor.md +11 -11
- package/docs/macros/ref/as-container.md +8 -8
- package/docs/macros/ref/at.md +10 -10
- package/docs/macros/ref/condition.md +8 -8
- package/docs/macros/ref/in.md +11 -11
- package/docs/macros/ref/index.md +16 -16
- package/docs/macros/ref/position-anchor.md +9 -9
- package/docs/macros/style.md +24 -24
- package/docs/macros/view-transition.md +16 -16
- package/docs/macros/when.md +13 -13
- package/docs/plugins/iconify.md +5 -5
- package/docs/plugins/index.md +4 -4
- package/docs/utilities-and-variants.md +6 -6
- package/docs/why.md +13 -15
- package/package.json +8 -6
|
@@ -31,7 +31,7 @@ Run `stillwind fmt`, or `stillwind lint --fix` with this rule enabled. The edito
|
|
|
31
31
|
also sorts on save with `source.sort.stillwind`.
|
|
32
32
|
|
|
33
33
|
`stillwind fmt` sorts even when this rule is off. To stop all sorting, set
|
|
34
|
-
`sort: false`. See [Sorting](
|
|
34
|
+
`sort: false`. See [Sorting](https://stillwind.dev/docs/configuration#sorting).
|
|
35
35
|
|
|
36
36
|
## Rule settings
|
|
37
37
|
|
|
@@ -41,6 +41,6 @@ also sorts on save with `source.sort.stillwind`.
|
|
|
41
41
|
| `strict` | off |
|
|
42
42
|
| `stylistic` | warn |
|
|
43
43
|
|
|
44
|
-
[Configure lint](
|
|
44
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
45
45
|
|
|
46
46
|
The CLI and the editor report this rule only when they analyze the whole project.
|
|
@@ -33,9 +33,9 @@ const title = style({ [card("hover")]: "text-red-500" });
|
|
|
33
33
|
- Replace `group` with a ref on the parent, and `group-hover:` with a condition on
|
|
34
34
|
that ref, as in the example.
|
|
35
35
|
- Replace `peer` with a ref on the sibling, and use
|
|
36
|
-
[`.in()`](
|
|
36
|
+
[`.in()`](https://stillwind.dev/docs/macros/ref/in) with a ref on a shared ancestor.
|
|
37
37
|
|
|
38
|
-
See [Element relationships](
|
|
38
|
+
See [Element relationships](https://stillwind.dev/docs/guides/element-relationships).
|
|
39
39
|
|
|
40
40
|
## Rule settings
|
|
41
41
|
|
|
@@ -45,4 +45,4 @@ See [Element relationships](../guides/element-relationships.md).
|
|
|
45
45
|
| `strict` | off |
|
|
46
46
|
| `stylistic` | warn |
|
|
47
47
|
|
|
48
|
-
[Configure lint](
|
|
48
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -40,4 +40,4 @@ does not check the value that the property receives at runtime.
|
|
|
40
40
|
| `strict` | off |
|
|
41
41
|
| `stylistic` | warn |
|
|
42
42
|
|
|
43
|
-
[Configure lint](
|
|
43
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -5,7 +5,7 @@ description: "Reports a condition in your stylesheet that a named variant can re
|
|
|
5
5
|
|
|
6
6
|
# prefer-variant-directive
|
|
7
7
|
|
|
8
|
-
This rule reports a condition in a rule or a [`@utility`](
|
|
8
|
+
This rule reports a condition in a rule or a [`@utility`](https://stillwind.dev/docs/at-rules/utility)
|
|
9
9
|
body of your stylesheet, such as an `@media` query, that a variant of your theme
|
|
10
10
|
expresses with the same meaning. The named variant keeps the stylesheet in sync
|
|
11
11
|
when the theme changes the breakpoint. The `stylistic` preset enables this rule.
|
|
@@ -36,7 +36,7 @@ when the theme changes the breakpoint. The `stylistic` preset enables this rule.
|
|
|
36
36
|
|
|
37
37
|
## How to fix
|
|
38
38
|
|
|
39
|
-
Replace the condition with [`@variant`](
|
|
39
|
+
Replace the condition with [`@variant`](https://stillwind.dev/docs/at-rules/variant) and the name of
|
|
40
40
|
the variant, as in the example. The automatic fix applies it.
|
|
41
41
|
|
|
42
42
|
## Options
|
|
@@ -56,4 +56,4 @@ With it, `@media (width >= 768px)` also matches `md`.
|
|
|
56
56
|
| --- | --- |
|
|
57
57
|
| `pxToRem` | `false` |
|
|
58
58
|
|
|
59
|
-
[Configure lint](
|
|
59
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -37,7 +37,7 @@ style("md:p-4");
|
|
|
37
37
|
Remove the extra variant, and keep the others. The automatic fix removes it.
|
|
38
38
|
|
|
39
39
|
Variants that can never match together are reported by
|
|
40
|
-
[unsatisfiable-variants](unsatisfiable-variants
|
|
40
|
+
[unsatisfiable-variants](https://stillwind.dev/docs/lints/unsatisfiable-variants) instead.
|
|
41
41
|
|
|
42
42
|
## Rule settings
|
|
43
43
|
|
|
@@ -47,4 +47,4 @@ Variants that can never match together are reported by
|
|
|
47
47
|
| `strict` | deny |
|
|
48
48
|
| `stylistic` | off |
|
|
49
49
|
|
|
50
|
-
[Configure lint](
|
|
50
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -46,7 +46,7 @@ function Items({ labels }: { labels: string[] }) {
|
|
|
46
46
|
|
|
47
47
|
- To space items in a list, put `gap` on the list, as in the example.
|
|
48
48
|
- To style an element from the state of a sibling, use refs with
|
|
49
|
-
[`.in()`](
|
|
49
|
+
[`.in()`](https://stillwind.dev/docs/macros/ref/in).
|
|
50
50
|
|
|
51
51
|
## Rule settings
|
|
52
52
|
|
|
@@ -56,4 +56,4 @@ function Items({ labels }: { labels: string[] }) {
|
|
|
56
56
|
| `strict` | deny |
|
|
57
57
|
| `stylistic` | off |
|
|
58
58
|
|
|
59
|
-
[Configure lint](
|
|
59
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -46,8 +46,8 @@ style("if(--state:active):block");
|
|
|
46
46
|
- Otherwise, represent the state with an attribute and use an attribute variant.
|
|
47
47
|
That requires changing the code that sets the state as well.
|
|
48
48
|
|
|
49
|
-
See [Runtime conditions](
|
|
50
|
-
[Configuration](
|
|
49
|
+
See [Runtime conditions](https://stillwind.dev/docs/guides/runtime-conditions#enable-native-css-if) and
|
|
50
|
+
[Configuration](https://stillwind.dev/docs/configuration#generated-css).
|
|
51
51
|
|
|
52
52
|
## Rule settings
|
|
53
53
|
|
|
@@ -57,4 +57,4 @@ See [Runtime conditions](../guides/runtime-conditions.md#enable-native-css-if) a
|
|
|
57
57
|
| `strict` | deny |
|
|
58
58
|
| `stylistic` | off |
|
|
59
59
|
|
|
60
|
-
[Configure lint](
|
|
60
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -6,7 +6,7 @@ description: "Reports view transitions split across separate style() calls."
|
|
|
6
6
|
# split-view-transition-class
|
|
7
7
|
|
|
8
8
|
This rule reports view transitions that reach one element through separate
|
|
9
|
-
[`style()`](
|
|
9
|
+
[`style()`](https://stillwind.dev/docs/macros/style) calls, such as a base style and the call that
|
|
10
10
|
receives it. Each call sets the whole `view-transition-class` list, so one list
|
|
11
11
|
replaces the other.
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ style(first, second.for("card"));
|
|
|
34
34
|
## How to fix
|
|
35
35
|
|
|
36
36
|
Pass every transition of the element to the same `style()` call, with one
|
|
37
|
-
[`.for()`](
|
|
37
|
+
[`.for()`](https://stillwind.dev/docs/macros/view-transition) call, as in the example. You can
|
|
38
38
|
still store and share the transition definitions themselves.
|
|
39
39
|
|
|
40
40
|
## Rule settings
|
|
@@ -45,4 +45,4 @@ still store and share the transition definitions themselves.
|
|
|
45
45
|
| `strict` | deny |
|
|
46
46
|
| `stylistic` | off |
|
|
47
47
|
|
|
48
|
-
[Configure lint](
|
|
48
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -6,7 +6,7 @@ description: "Reports await, yield, or import() inside an argument of style() or
|
|
|
6
6
|
# suspending-macro-argument
|
|
7
7
|
|
|
8
8
|
This rule reports `await`, `yield`, or a dynamic `import()` inside an argument of
|
|
9
|
-
[`style()`](
|
|
9
|
+
[`style()`](https://stillwind.dev/docs/macros/style) or another macro. The compiler can move or skip
|
|
10
10
|
argument expressions, so the code would not wait or load where you wrote it.
|
|
11
11
|
|
|
12
12
|
## Reported
|
|
@@ -43,4 +43,4 @@ variable, as in the example.
|
|
|
43
43
|
| `strict` | deny |
|
|
44
44
|
| `stylistic` | off |
|
|
45
45
|
|
|
46
|
-
[Configure lint](
|
|
46
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -30,12 +30,12 @@ style("bg-red-950");
|
|
|
30
30
|
- Check the spelling against the theme. In the example, the last character is
|
|
31
31
|
the letter `O` instead of zero. The intended token is `--color-red-950`.
|
|
32
32
|
- To use a value that the theme does not have, add a token to your stylesheet,
|
|
33
|
-
such as `--color-red-999` in [`@theme`](
|
|
34
|
-
utility with [`@utility`](
|
|
33
|
+
such as `--color-red-999` in [`@theme`](https://stillwind.dev/docs/at-rules/theme), or define the
|
|
34
|
+
utility with [`@utility`](https://stillwind.dev/docs/at-rules/utility).
|
|
35
35
|
- For a class that another stylesheet defines, pass it in a `class` field, such as
|
|
36
36
|
`style({ class: "external-card" })`.
|
|
37
37
|
|
|
38
|
-
[Built-in utilities and variants](
|
|
38
|
+
[Built-in utilities and variants](https://stillwind.dev/docs/utilities-and-variants) looks up the
|
|
39
39
|
utilities of the default theme.
|
|
40
40
|
|
|
41
41
|
## Rule settings
|
|
@@ -46,4 +46,4 @@ utilities of the default theme.
|
|
|
46
46
|
| `strict` | deny |
|
|
47
47
|
| `stylistic` | off |
|
|
48
48
|
|
|
49
|
-
[Configure lint](
|
|
49
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -29,7 +29,7 @@ style("hover:p-4");
|
|
|
29
29
|
|
|
30
30
|
- Correct the spelling of the variant.
|
|
31
31
|
- To use a variant of your own, define it with
|
|
32
|
-
[`@custom-variant`](
|
|
32
|
+
[`@custom-variant`](https://stillwind.dev/docs/at-rules/custom-variant) in your stylesheet.
|
|
33
33
|
|
|
34
34
|
## Rule settings
|
|
35
35
|
|
|
@@ -39,4 +39,4 @@ style("hover:p-4");
|
|
|
39
39
|
| `strict` | deny |
|
|
40
40
|
| `stylistic` | off |
|
|
41
41
|
|
|
42
|
-
[Configure lint](
|
|
42
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -30,7 +30,7 @@ style.css("[:host(.page)]:block");
|
|
|
30
30
|
- Add a class or an attribute to the host, and test it inside `:host()`, as in the
|
|
31
31
|
example.
|
|
32
32
|
- Set a custom property on the outer element, and read it on the host with
|
|
33
|
-
[`--if()`](
|
|
33
|
+
[`--if()`](https://stillwind.dev/docs/guides/runtime-conditions). Custom properties inherit into a
|
|
34
34
|
shadow tree.
|
|
35
35
|
|
|
36
36
|
## Rule settings
|
|
@@ -41,4 +41,4 @@ style.css("[:host(.page)]:block");
|
|
|
41
41
|
| `strict` | deny |
|
|
42
42
|
| `stylistic` | off |
|
|
43
43
|
|
|
44
|
-
[Configure lint](
|
|
44
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -39,4 +39,4 @@ style("portrait:p-4 landscape:p-4");
|
|
|
39
39
|
| `strict` | deny |
|
|
40
40
|
| `stylistic` | off |
|
|
41
41
|
|
|
42
|
-
[Configure lint](
|
|
42
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
@@ -52,6 +52,6 @@ check that the comment is on the right line and names the right rule.
|
|
|
52
52
|
| `strict` | deny |
|
|
53
53
|
| `stylistic` | off |
|
|
54
54
|
|
|
55
|
-
[Configure lint](
|
|
55
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
56
56
|
|
|
57
57
|
The CLI and the editor report this rule only when they analyze the whole project.
|
|
@@ -6,7 +6,7 @@ description: "Reports a base style whose source the CLI cannot find from its typ
|
|
|
6
6
|
# unverified-style-base
|
|
7
7
|
|
|
8
8
|
This rule reports a base style whose type does not show which
|
|
9
|
-
[`style()`](
|
|
9
|
+
[`style()`](https://stillwind.dev/docs/macros/style) call created it, such as a value declared as
|
|
10
10
|
`ReturnType<typeof style>`. The compiler cannot find the CSS of the base, so
|
|
11
11
|
it cannot order the later utilities after it.
|
|
12
12
|
|
|
@@ -60,6 +60,6 @@ export const props = style(base, "p-4");
|
|
|
60
60
|
| `strict` | deny |
|
|
61
61
|
| `stylistic` | off |
|
|
62
62
|
|
|
63
|
-
[Configure lint](
|
|
63
|
+
[Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
|
|
64
64
|
|
|
65
65
|
The CLI and the editor report this rule only when they analyze the whole project.
|
|
@@ -28,25 +28,25 @@ export const popover = style("absolute", trigger.positionAnchor(), "top-[anchor(
|
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
const trigger = undefined;
|
|
31
|
-
export const provider = {className:"
|
|
32
|
-
export const scope = {className:"
|
|
33
|
-
export const popover = {className:"
|
|
31
|
+
export const provider = {className:"sw_7u6im sw_trigger_xnhw0"};
|
|
32
|
+
export const scope = {className:"sw_at8ic"};
|
|
33
|
+
export const popover = {className:"sw_e3wyz"};
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Generated CSS
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
```css
|
|
40
|
-
.
|
|
41
|
-
anchor-name: --sw-a-trigger-
|
|
40
|
+
.sw_7u6im:where(.sw_trigger_xnhw0) {
|
|
41
|
+
anchor-name: --sw-a-trigger-xnhw0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
45
|
-
anchor-scope: --sw-a-trigger-
|
|
44
|
+
.sw_at8ic {
|
|
45
|
+
anchor-scope: --sw-a-trigger-xnhw0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.
|
|
49
|
-
position-anchor: --sw-a-trigger-
|
|
48
|
+
.sw_e3wyz {
|
|
49
|
+
position-anchor: --sw-a-trigger-xnhw0;
|
|
50
50
|
position: absolute;
|
|
51
51
|
top: anchor(bottom);
|
|
52
52
|
}
|
|
@@ -74,14 +74,14 @@ Write the array or keyword directly in the call. When a variable in the array
|
|
|
74
74
|
can hold one of several refs, the scope includes every ref that it can hold.
|
|
75
75
|
|
|
76
76
|
An empty array sets nothing, and repeated refs add nothing.
|
|
77
|
-
[ineffective-anchor-scope](
|
|
77
|
+
[ineffective-anchor-scope](https://stillwind.dev/docs/lints/ineffective-anchor-scope) reports both.
|
|
78
78
|
|
|
79
79
|
`style.anchorScope()` only sets the CSS property. It does not attach a ref, it
|
|
80
80
|
does not create an anchor name, and it does not affect
|
|
81
|
-
[`.in()`](ref/in
|
|
81
|
+
[`.in()`](https://stillwind.dev/docs/macros/ref/in) conditions.
|
|
82
82
|
|
|
83
83
|
You can also set the scope on the anchor itself with
|
|
84
|
-
`trigger.asAnchor(scope)`. See [`ref.asAnchor()`](ref/as-anchor
|
|
84
|
+
`trigger.asAnchor(scope)`. See [`ref.asAnchor()`](https://stillwind.dev/docs/macros/ref/as-anchor).
|
|
85
85
|
|
|
86
86
|
## Generated code
|
|
87
87
|
|
|
@@ -89,5 +89,5 @@ The compiler turns the scope into generated anchor names or the keyword. When
|
|
|
89
89
|
it knows every ref, no JavaScript reads the refs at runtime. Stillwind does not
|
|
90
90
|
position elements with JavaScript; the browser's CSS anchor positioning does.
|
|
91
91
|
|
|
92
|
-
See [Element relationships](
|
|
92
|
+
See [Element relationships](https://stillwind.dev/docs/guides/element-relationships#position-an-element-at-an-anchor)
|
|
93
93
|
for a complete example.
|
package/docs/macros/css.md
CHANGED
|
@@ -6,7 +6,7 @@ description: "Compile utilities into a CSS string that you place yourself, such
|
|
|
6
6
|
# style.css()
|
|
7
7
|
|
|
8
8
|
`style.css(...rules, options?)` compiles utilities into a CSS string. Unlike
|
|
9
|
-
[`style()`](style
|
|
9
|
+
[`style()`](https://stillwind.dev/docs/macros/style), it adds nothing to the page's stylesheet. You
|
|
10
10
|
decide where the string goes, such as a shadow root.
|
|
11
11
|
|
|
12
12
|
## Example
|
|
@@ -24,7 +24,7 @@ export const css = style.css("p-4 text-blue-600", {
|
|
|
24
24
|
### Compiled code
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
export const css = ":where(:root,:host){--color-blue-600:oklch(54.6% .245 262.881);--spacing:.25rem}:host{padding:calc(var(--spacing)
|
|
27
|
+
export const css = ":where(:root,:host){--color-blue-600:oklch(54.6% .245 262.881);--spacing:.25rem}:host{padding:calc(var(--spacing)*4);color:var(--color-blue-600)}";
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
### Generated CSS
|
|
@@ -36,7 +36,7 @@ This macro adds no CSS to the stylesheet.
|
|
|
36
36
|
`rules` accepts utility strings, arrays, objects with variant keys, and `false`,
|
|
37
37
|
`null`, or `undefined`. All of them must be known at build time. Runtime
|
|
38
38
|
conditions, refs, `class` fields, custom properties, and stored `style()`
|
|
39
|
-
results are not accepted, and [invalid-css-input](
|
|
39
|
+
results are not accepted, and [invalid-css-input](https://stillwind.dev/docs/lints/invalid-css-input)
|
|
40
40
|
reports them.
|
|
41
41
|
|
|
42
42
|
The last argument can be an options object literal:
|
|
@@ -44,11 +44,11 @@ The last argument can be an options object literal:
|
|
|
44
44
|
| Option | Value |
|
|
45
45
|
| ---------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
46
46
|
| `selector` | The selector that utilities without their own selector style, such as `:host` |
|
|
47
|
-
| `template` | The name of an [`@stillwind-css-template`](
|
|
47
|
+
| `template` | The name of an [`@stillwind-css-template`](https://stillwind.dev/docs/at-rules/stillwind-css-template) in your stylesheet; defaults to `default` |
|
|
48
48
|
|
|
49
49
|
A variant that sets its own selector, such as `host:` or `[button]:`, keeps that
|
|
50
50
|
selector. A utility without `selector` and without such a variant produces no
|
|
51
|
-
CSS, and [missing-document-target](
|
|
51
|
+
CSS, and [missing-document-target](https://stillwind.dev/docs/lints/missing-document-target) reports it.
|
|
52
52
|
|
|
53
53
|
## Output
|
|
54
54
|
|
|
@@ -63,9 +63,9 @@ Add the string to the page yourself, for example with
|
|
|
63
63
|
[`CSSStyleSheet.replaceSync()`](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replaceSync)
|
|
64
64
|
and a shadow root's
|
|
65
65
|
[`adoptedStyleSheets`](https://developer.mozilla.org/docs/Web/API/ShadowRoot/adoptedStyleSheets).
|
|
66
|
-
The results in [Built-in utilities and variants](
|
|
66
|
+
The results in [Built-in utilities and variants](https://stillwind.dev/docs/utilities-and-variants)
|
|
67
67
|
leave out the supporting CSS, so they cannot replace this string.
|
|
68
68
|
|
|
69
69
|
To add all styles of a module to a shadow root, including the preflight reset,
|
|
70
70
|
import them from `stillwind/module-css` instead. See
|
|
71
|
-
[Web Components](
|
|
71
|
+
[Web Components](https://stillwind.dev/docs/guides/web-components).
|
package/docs/macros/cva.md
CHANGED
|
@@ -11,7 +11,7 @@ generates the CSS for every option at build time. Calling the factory selects
|
|
|
11
11
|
the compiled classes for the chosen options and returns props for an element.
|
|
12
12
|
|
|
13
13
|
`style.cva()` exists mainly to migrate existing CVA components. For new
|
|
14
|
-
components, see [Reusable styles](
|
|
14
|
+
components, see [Reusable styles](https://stillwind.dev/docs/guides/reusable-styles).
|
|
15
15
|
|
|
16
16
|
## Example
|
|
17
17
|
|
|
@@ -46,11 +46,11 @@ export const props = button({ size: "large" });
|
|
|
46
46
|
```ts
|
|
47
47
|
import { stillwindClassNameObjectCva } from "stillwind/runtime";
|
|
48
48
|
|
|
49
|
-
export const button = stillwindClassNameObjectCva("
|
|
49
|
+
export const button = stillwindClassNameObjectCva("sw_6tzpq", {
|
|
50
50
|
variants: {
|
|
51
51
|
size: {
|
|
52
|
-
small: "
|
|
53
|
-
large: "
|
|
52
|
+
small: "sw_gzwci",
|
|
53
|
+
large: "sw_w6696",
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
defaultVariants: {
|
|
@@ -59,7 +59,7 @@ export const button = stillwindClassNameObjectCva("sw_ilpwh", {
|
|
|
59
59
|
compoundVariants: [
|
|
60
60
|
{
|
|
61
61
|
size: "large",
|
|
62
|
-
class: "
|
|
62
|
+
class: "sw_v1iw3",
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
65
|
});
|
|
@@ -71,22 +71,22 @@ export const props = button({ size: "large" });
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
```css
|
|
74
|
-
.
|
|
74
|
+
.sw_6tzpq {
|
|
75
75
|
display: inline-flex;
|
|
76
76
|
border-radius: var(--radius-md);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.
|
|
79
|
+
.sw_gzwci {
|
|
80
80
|
padding-inline: calc(var(--spacing) * 2);
|
|
81
81
|
padding-block: calc(var(--spacing) * 1);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.
|
|
84
|
+
.sw_w6696 {
|
|
85
85
|
padding-inline: calc(var(--spacing) * 4);
|
|
86
86
|
padding-block: calc(var(--spacing) * 2);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
.
|
|
89
|
+
.sw_v1iw3 {
|
|
90
90
|
--tw-font-weight: var(--font-weight-medium);
|
|
91
91
|
font-weight: var(--font-weight-medium);
|
|
92
92
|
}
|
|
@@ -114,11 +114,11 @@ options.
|
|
|
114
114
|
The base and each option value accept utility strings, arrays, objects with
|
|
115
115
|
variant keys, `true`, `false`, `null`, `undefined`, and custom properties.
|
|
116
116
|
|
|
117
|
-
They do not accept `&&`, ternaries, stored [`style()`](style
|
|
117
|
+
They do not accept `&&`, ternaries, stored [`style()`](https://stillwind.dev/docs/macros/style)
|
|
118
118
|
results, refs, animations, or `class` fields. To choose a style at runtime,
|
|
119
119
|
pass a different option to the factory.
|
|
120
|
-
[invalid-cva-input](
|
|
121
|
-
[invalid-cva-config](
|
|
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
122
|
configuration.
|
|
123
123
|
|
|
124
124
|
A custom property value can be an expression. The factory evaluates it once,
|
|
@@ -151,5 +151,5 @@ Factory calls stay ordinary JavaScript.
|
|
|
151
151
|
The development build checks the selected values and the classes from other
|
|
152
152
|
stylesheets.
|
|
153
153
|
|
|
154
|
-
See [Migrating from Tailwind CSS](
|
|
154
|
+
See [Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind#cva) to
|
|
155
155
|
convert existing `cva` calls.
|
package/docs/macros/index.md
CHANGED
|
@@ -11,15 +11,15 @@ and it shows the generated JavaScript and CSS for its examples.
|
|
|
11
11
|
|
|
12
12
|
| Macro | Use it to | Guide |
|
|
13
13
|
| -------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
14
|
-
| [`style()`](style
|
|
15
|
-
| [`style.ref()`](ref
|
|
16
|
-
| [`style.anchorScope()`](anchor-scope
|
|
17
|
-
| [`style.keyframes()`](keyframes
|
|
18
|
-
| [`style.viewTransition()`](view-transition
|
|
19
|
-
| [`style.when()`](when
|
|
20
|
-
| [`style.media()`](media
|
|
21
|
-
| [`style.css()`](css
|
|
22
|
-
| [`style.cva()`](cva
|
|
14
|
+
| [`style()`](https://stillwind.dev/docs/macros/style) | Style an element | [The basics of style()](https://stillwind.dev/docs/guides/style) |
|
|
15
|
+
| [`style.ref()`](https://stillwind.dev/docs/macros/ref) | Style an element from another element's state, size, or position | [Element relationships](https://stillwind.dev/docs/guides/element-relationships) |
|
|
16
|
+
| [`style.anchorScope()`](https://stillwind.dev/docs/macros/anchor-scope) | Limit where an anchor name is visible | [Element relationships](https://stillwind.dev/docs/guides/element-relationships) |
|
|
17
|
+
| [`style.keyframes()`](https://stillwind.dev/docs/macros/keyframes) | Define an animation in a component | [Animations](https://stillwind.dev/docs/guides/animations) |
|
|
18
|
+
| [`style.viewTransition()`](https://stillwind.dev/docs/macros/view-transition) | Style view transition snapshots and name each item | [View transitions](https://stillwind.dev/docs/guides/view-transitions) |
|
|
19
|
+
| [`style.when()`](https://stillwind.dev/docs/macros/when) | Reuse a variant sequence, such as a ref condition | [Element relationships](https://stillwind.dev/docs/guides/element-relationships) |
|
|
20
|
+
| [`style.media()`](https://stillwind.dev/docs/macros/media) | Use a named breakpoint as a media query in JavaScript | [Responsive styles](https://stillwind.dev/docs/guides/responsive-styles) |
|
|
21
|
+
| [`style.css()`](https://stillwind.dev/docs/macros/css) | Compile utilities into a CSS string for a shadow root | [Web Components](https://stillwind.dev/docs/guides/web-components) |
|
|
22
|
+
| [`style.cva()`](https://stillwind.dev/docs/macros/cva) | Migrate components that use `cva` | [Migrating from Tailwind CSS](https://stillwind.dev/docs/guides/migrating-from-tailwind) |
|
|
23
23
|
|
|
24
24
|
Import the macros from the entrypoint of your framework, such as
|
|
25
25
|
`stillwind/react`. The examples on these pages use React.
|
|
@@ -27,5 +27,5 @@ Import the macros from the entrypoint of your framework, such as
|
|
|
27
27
|
Each example shows the source, the compiled code, and the CSS that it adds to
|
|
28
28
|
the stylesheet. In development, Stillwind also adds checks that report invalid
|
|
29
29
|
values at runtime. The compiled code on these pages leaves them out.
|
|
30
|
-
[How styles compile](
|
|
30
|
+
[How styles compile](https://stillwind.dev/docs/concepts/how-styles-compile) explains the generated code in
|
|
31
31
|
general.
|
package/docs/macros/keyframes.md
CHANGED
|
@@ -6,7 +6,7 @@ description: "Define keyframes in a component, and apply them with animation opt
|
|
|
6
6
|
# style.keyframes()
|
|
7
7
|
|
|
8
8
|
`style.keyframes(definition)` defines an animation. Calling the result inside
|
|
9
|
-
[`style()`](style
|
|
9
|
+
[`style()`](https://stillwind.dev/docs/macros/style) applies the animation, and its argument sets
|
|
10
10
|
the animation's options. The compiler generates a unique animation name.
|
|
11
11
|
|
|
12
12
|
## Example
|
|
@@ -27,14 +27,14 @@ export const props = style(fade("duration-300 ease-in-out"));
|
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
29
|
const fade = undefined;
|
|
30
|
-
export const props = {className:"
|
|
30
|
+
export const props = {className:"sw_tcsva"};
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Generated CSS
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
```css
|
|
37
|
-
@keyframes sw-kf-
|
|
37
|
+
@keyframes sw-kf-zylc1 {
|
|
38
38
|
from {
|
|
39
39
|
opacity: 0;
|
|
40
40
|
}
|
|
@@ -44,8 +44,8 @@ export const props = {className:"sw_4y7y6"};
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.
|
|
48
|
-
animation-name: sw-kf-
|
|
47
|
+
.sw_tcsva {
|
|
48
|
+
animation-name: sw-kf-zylc1;
|
|
49
49
|
animation-duration: .3s;
|
|
50
50
|
animation-timing-function: var(--ease-in-out);
|
|
51
51
|
}
|
|
@@ -78,10 +78,10 @@ The argument is a string literal of animation options. Timing utilities set
|
|
|
78
78
|
animation properties here: `duration-300` sets `animation-duration`, not
|
|
79
79
|
`transition-duration`. A utility that is not an animation option, such as
|
|
80
80
|
`p-4`, produces no CSS, and
|
|
81
|
-
[invalid-animation-option](
|
|
81
|
+
[invalid-animation-option](https://stillwind.dev/docs/lints/invalid-animation-option) reports it.
|
|
82
82
|
|
|
83
83
|
Write the call directly in `style()`. Storing `fade("duration-300")` in a
|
|
84
|
-
variable causes [SW10004](
|
|
84
|
+
variable causes [SW10004](https://stillwind.dev/docs/errors/SW10004).
|
|
85
85
|
|
|
86
86
|
To turn the animation on or off by condition, put the call under a variant, such
|
|
87
87
|
as `{ "motion-safe:": fade("duration-300") }`.
|
|
@@ -94,6 +94,6 @@ The compiler writes every
|
|
|
94
94
|
[`@keyframes`](https://developer.mozilla.org/docs/Web/CSS/Reference/At-rules/@keyframes)
|
|
95
95
|
rule that the calls need, together with the theme values that the frames use.
|
|
96
96
|
|
|
97
|
-
See [Animations](
|
|
98
|
-
[invalid-keyframes-variant](
|
|
97
|
+
See [Animations](https://stillwind.dev/docs/guides/animations) for task-based examples, and
|
|
98
|
+
[invalid-keyframes-variant](https://stillwind.dev/docs/lints/invalid-keyframes-variant) for
|
|
99
99
|
unsupported variants.
|
package/docs/macros/media.md
CHANGED
|
@@ -48,7 +48,7 @@ It contains one or more variants. The final colon is optional.
|
|
|
48
48
|
Only variants that are media conditions are accepted. `hover` and other element
|
|
49
49
|
states, `supports-*`, and container queries are not media conditions. An
|
|
50
50
|
argument that is not a media condition is left out, and
|
|
51
|
-
[invalid-media-query](
|
|
51
|
+
[invalid-media-query](https://stillwind.dev/docs/lints/invalid-media-query) reports it. When no
|
|
52
52
|
argument remains, the result is `not all`.
|
|
53
53
|
|
|
54
54
|
Write `style.media()` outside other Stillwind calls.
|
|
@@ -63,4 +63,4 @@ time the module compiles.
|
|
|
63
63
|
|
|
64
64
|
`matchMedia()` is a browser API. Call it on the client, and remove its
|
|
65
65
|
listeners when their component unmounts. See
|
|
66
|
-
[Responsive styles](
|
|
66
|
+
[Responsive styles](https://stillwind.dev/docs/guides/responsive-styles).
|
|
@@ -8,7 +8,7 @@ description: "Make the element that has a ref a named anchor for CSS anchor posi
|
|
|
8
8
|
`trigger.asAnchor(scope?)` sets
|
|
9
9
|
[`anchor-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/anchor-name)
|
|
10
10
|
on the element. Position another element against it with
|
|
11
|
-
[`trigger.positionAnchor()`](position-anchor
|
|
11
|
+
[`trigger.positionAnchor()`](https://stillwind.dev/docs/macros/ref/position-anchor).
|
|
12
12
|
|
|
13
13
|
## Example
|
|
14
14
|
|
|
@@ -26,20 +26,20 @@ export const popover = style("absolute", trigger.positionAnchor(), "top-[anchor(
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
const trigger = undefined;
|
|
29
|
-
export const button = {className:"
|
|
30
|
-
export const popover = {className:"
|
|
29
|
+
export const button = {className:"sw_6x3gz sw_trigger_xnhw0"};
|
|
30
|
+
export const popover = {className:"sw_e3wyz"};
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Generated CSS
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
```css
|
|
37
|
-
.
|
|
38
|
-
anchor-name: --sw-a-trigger-
|
|
37
|
+
.sw_6x3gz:where(.sw_trigger_xnhw0) {
|
|
38
|
+
anchor-name: --sw-a-trigger-xnhw0;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.
|
|
42
|
-
position-anchor: --sw-a-trigger-
|
|
41
|
+
.sw_e3wyz {
|
|
42
|
+
position-anchor: --sw-a-trigger-xnhw0;
|
|
43
43
|
position: absolute;
|
|
44
44
|
top: anchor(bottom);
|
|
45
45
|
}
|
|
@@ -60,16 +60,16 @@ on the element:
|
|
|
60
60
|
|
|
61
61
|
Write the array directly in the call. The array includes the `trigger` ref only
|
|
62
62
|
when you list it. An empty array sets nothing, and
|
|
63
|
-
[ineffective-anchor-scope](
|
|
63
|
+
[ineffective-anchor-scope](https://stillwind.dev/docs/lints/ineffective-anchor-scope) reports it.
|
|
64
64
|
|
|
65
65
|
## Behavior
|
|
66
66
|
|
|
67
67
|
Pass `trigger` and `trigger.asAnchor()` in the same
|
|
68
|
-
[`style()`](
|
|
68
|
+
[`style()`](https://stillwind.dev/docs/macros/style) call. The anchor name applies only to an
|
|
69
69
|
element that has the ref, and
|
|
70
|
-
[missing-ref-attachment](
|
|
70
|
+
[missing-ref-attachment](https://stillwind.dev/docs/lints/missing-ref-attachment) reports a call
|
|
71
71
|
without it.
|
|
72
72
|
|
|
73
73
|
To limit the anchor name from an ancestor instead, use
|
|
74
|
-
[`style.anchorScope()`](
|
|
74
|
+
[`style.anchorScope()`](https://stillwind.dev/docs/macros/anchor-scope). Stillwind generates CSS
|
|
75
75
|
only, so check that the browsers you support implement anchor positioning.
|