stillwind 0.4.1 → 0.6.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/docs/at-rules/apply.md +3 -3
- package/docs/at-rules/custom-variant.md +7 -5
- package/docs/at-rules/index.md +28 -28
- package/docs/at-rules/plugin.md +5 -5
- package/docs/at-rules/registry-directives.md +13 -12
- package/docs/at-rules/slot.md +3 -3
- package/docs/at-rules/stillwind-css-template.md +8 -7
- package/docs/at-rules/stillwind-property.md +7 -6
- package/docs/at-rules/stillwind-registry.md +13 -12
- package/docs/at-rules/stillwind-require-properties.md +2 -2
- package/docs/at-rules/stillwind-slot.md +12 -12
- package/docs/at-rules/stillwind-undef-arbitrary-property.md +3 -3
- package/docs/at-rules/stillwind-undef-utility.md +10 -9
- package/docs/at-rules/stillwind-undef-variant.md +5 -5
- package/docs/at-rules/theme.md +6 -6
- package/docs/at-rules/utility.md +17 -12
- package/docs/at-rules/variant.md +11 -7
- package/docs/cli.md +5 -5
- package/docs/concepts/how-styles-compile.md +3 -3
- package/docs/concepts/stylesheets.md +30 -1
- package/docs/configuration.md +8 -8
- package/docs/editors.md +2 -2
- package/docs/errors/SW10004.md +8 -7
- package/docs/errors/SW10005.md +4 -4
- package/docs/errors/SW14002.md +3 -2
- package/docs/errors/SW14003.md +5 -3
- package/docs/errors/SW14004.md +3 -3
- package/docs/errors/SW14005.md +5 -4
- package/docs/errors/SW14008.md +6 -4
- package/docs/errors/SW90001.md +1 -1
- package/docs/errors/SW90006.md +3 -1
- package/docs/errors/index.md +6 -6
- package/docs/guides/animations.md +10 -8
- package/docs/guides/design-systems.md +2 -1
- package/docs/guides/element-relationships.md +17 -15
- package/docs/guides/lint-adoption.md +2 -1
- package/docs/guides/migrating-from-css.md +8 -5
- package/docs/guides/migrating-from-tailwind.md +101 -13
- package/docs/guides/recommended-practices.md +20 -17
- package/docs/guides/responsive-styles.md +9 -6
- package/docs/guides/reusable-styles.md +3 -3
- package/docs/guides/runtime-conditions.md +10 -5
- package/docs/guides/style.md +3 -3
- package/docs/guides/tailwind-compatibility.md +15 -15
- package/docs/guides/view-transitions.md +17 -15
- package/docs/guides/web-components.md +4 -4
- package/docs/index.md +4 -2
- package/docs/integrations.md +64 -0
- package/docs/lints/ambiguous-style-base-order.md +3 -3
- package/docs/lints/bypassed-undefinition.md +4 -4
- package/docs/lints/conflicting-provider-properties.md +4 -3
- package/docs/lints/duplicate-definition.md +2 -1
- package/docs/lints/duplicate-view-transition-name.md +4 -2
- package/docs/lints/ignored-definition-condition.md +4 -3
- package/docs/lints/ignored-tailwind-feature.md +1 -1
- package/docs/lints/implicit-nesting-selector.md +4 -3
- package/docs/lints/index.md +38 -38
- package/docs/lints/ineffective-anchor-scope.md +4 -2
- package/docs/lints/invalid-animation-option.md +3 -3
- package/docs/lints/invalid-css-directive.md +10 -2
- package/docs/lints/invalid-css-import.md +8 -0
- package/docs/lints/invalid-css-input.md +5 -4
- package/docs/lints/invalid-cva-config.md +16 -4
- package/docs/lints/invalid-cva-input.md +11 -6
- package/docs/lints/invalid-keyframes-definition.md +1 -1
- package/docs/lints/invalid-keyframes-variant.md +17 -9
- package/docs/lints/invalid-marker-use.md +1 -1
- package/docs/lints/invalid-media-query.md +8 -6
- package/docs/lints/invalid-ref-input.md +6 -5
- package/docs/lints/invalid-rule-group-input.md +13 -6
- package/docs/lints/invalid-style-input.md +1 -1
- package/docs/lints/invalid-theme-reference.md +2 -2
- package/docs/lints/invalid-view-transition-definition.md +1 -1
- package/docs/lints/invalid-view-transition-use.md +1 -1
- package/docs/lints/invalid-view-transition-variant.md +3 -3
- package/docs/lints/mismatched-framework-import.md +4 -4
- package/docs/lints/missing-document-target.md +1 -1
- package/docs/lints/missing-ref-attachment.md +6 -4
- package/docs/lints/missing-view-transition-name.md +7 -5
- package/docs/lints/no-arbitrary-breakpoints.md +1 -1
- package/docs/lints/no-class-property.md +4 -3
- package/docs/lints/prefer-canonical-utilities.md +3 -2
- package/docs/lints/prefer-direct-styling.md +2 -2
- package/docs/lints/prefer-variant-directive.md +8 -8
- package/docs/lints/split-view-transition-class.md +5 -4
- package/docs/lints/suspending-macro-argument.md +2 -2
- package/docs/lints/unknown-utility.md +2 -1
- package/docs/lints/unknown-variant.md +2 -2
- package/docs/lints/unverified-style-base.md +4 -3
- package/docs/macros/anchor-scope.md +13 -10
- package/docs/macros/css.md +11 -9
- package/docs/macros/cva.md +9 -8
- package/docs/macros/index.md +10 -10
- package/docs/macros/keyframes.md +5 -4
- package/docs/macros/media.md +6 -5
- package/docs/macros/ref/as-anchor.md +12 -7
- package/docs/macros/ref/as-container.md +7 -4
- package/docs/macros/ref/at.md +10 -9
- package/docs/macros/ref/condition.md +1 -1
- package/docs/macros/ref/in.md +6 -6
- package/docs/macros/ref/index.md +11 -11
- package/docs/macros/ref/position-anchor.md +7 -4
- package/docs/macros/style.md +3 -3
- package/docs/macros/view-transition.md +13 -12
- package/docs/plugins/iconify.md +95 -85
- package/docs/plugins/index.md +3 -3
- package/docs/utilities-and-variants.md +4 -4
- package/docs/why.md +2 -2
- package/package.json +29 -5
- package/skills/migrate-to-stillwind/SKILL.md +7 -2
package/docs/macros/style.md
CHANGED
|
@@ -23,9 +23,9 @@ other frameworks receive `class` and `style`. Spread the result onto the element
|
|
|
23
23
|
| A stored `style()` result | `base` | Adds the classes of the base |
|
|
24
24
|
|
|
25
25
|
`false`, `null`, and `undefined` add nothing. Ref, keyframes, and view transition
|
|
26
|
-
calls are also inputs; see [style.ref()](ref/index.md),
|
|
27
|
-
[style.keyframes()](keyframes.md), and
|
|
28
|
-
[style.viewTransition()](view-transition.md).
|
|
26
|
+
calls are also inputs; see [`style.ref()`](ref/index.md),
|
|
27
|
+
[`style.keyframes()`](keyframes.md), and
|
|
28
|
+
[`style.viewTransition()`](view-transition.md).
|
|
29
29
|
|
|
30
30
|
Write utility names as literals. The compiler reads them from the source, so a
|
|
31
31
|
name that your code builds at runtime produces no CSS.
|
|
@@ -6,8 +6,9 @@ description: "Define view transition snapshot styles, and give each element a tr
|
|
|
6
6
|
# style.viewTransition()
|
|
7
7
|
|
|
8
8
|
`style.viewTransition(definition)` defines the styles of view transition
|
|
9
|
-
snapshots. Passing the result to `style()` adds its
|
|
10
|
-
element. Calling `.for(key)` also gives the element a
|
|
9
|
+
snapshots. Passing the result to [`style()`](style.md) adds its
|
|
10
|
+
transition class to the element. Calling `.for(key)` also gives the element a
|
|
11
|
+
[`view-transition-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-name).
|
|
11
12
|
|
|
12
13
|
## Example
|
|
13
14
|
|
|
@@ -57,13 +58,13 @@ export const props = {className:"sw_krt7u"};
|
|
|
57
58
|
Write `style.viewTransition()` as the initial value of a variable, with an
|
|
58
59
|
object literal as its argument:
|
|
59
60
|
|
|
60
|
-
| Field | Styles
|
|
61
|
-
| ----------- |
|
|
62
|
-
| `group` | `::view-transition-group()`
|
|
63
|
-
| `imagePair` | `::view-transition-image-pair()`
|
|
64
|
-
| `old` | `::view-transition-old()`
|
|
65
|
-
| `new` | `::view-transition-new()`
|
|
66
|
-
| `label` | An optional string literal that appears in the generated name
|
|
61
|
+
| Field | Styles |
|
|
62
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `group` | [`::view-transition-group()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-group) |
|
|
64
|
+
| `imagePair` | [`::view-transition-image-pair()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-image-pair) |
|
|
65
|
+
| `old` | [`::view-transition-old()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-old) |
|
|
66
|
+
| `new` | [`::view-transition-new()`](https://developer.mozilla.org/docs/Web/CSS/Reference/Selectors/::view-transition-new) |
|
|
67
|
+
| `label` | An optional string literal that appears in the generated name |
|
|
67
68
|
|
|
68
69
|
Each field except `label` is a utility string literal. Timing utilities set
|
|
69
70
|
animation properties, such as `animation-duration`. Media and `supports-*`
|
|
@@ -77,9 +78,9 @@ the definition and import it in other modules.
|
|
|
77
78
|
|
|
78
79
|
## Name the element
|
|
79
80
|
|
|
80
|
-
`transition.for(key)` adds the transition class and sets
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
`transition.for(key)` adds the transition class and sets `view-transition-name`
|
|
82
|
+
from the key. The key is a string or a number. Without a key, Stillwind uses
|
|
83
|
+
an empty string.
|
|
83
84
|
|
|
84
85
|
Use a key that stays the same for the same item before and after the update.
|
|
85
86
|
Items on the page at the same time need different keys. Stillwind cannot check
|
package/docs/plugins/iconify.md
CHANGED
|
@@ -23,9 +23,9 @@ Load the plugin in the project stylesheet:
|
|
|
23
23
|
@plugin "@stillwind/plugin-iconify";
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Use `icon-<set>--<icon>` or `icon-[<set>--<icon>]` to select an icon. Variants
|
|
27
|
-
usual. The [prefer-canonical-utilities](../lints/prefer-canonical-utilities.md)
|
|
28
|
-
suggests the form without brackets:
|
|
26
|
+
Use `icon-<set>--<icon>` or `icon-[<set>--<icon>]` to select an icon. Variants
|
|
27
|
+
apply as usual. The [prefer-canonical-utilities](../lints/prefer-canonical-utilities.md)
|
|
28
|
+
lint suggests the form without brackets:
|
|
29
29
|
|
|
30
30
|
```tsx
|
|
31
31
|
<span {...style("icon-mdi--close", "hover:icon-[mdi--close-circle]")} />
|
|
@@ -33,8 +33,8 @@ suggests the form without brackets:
|
|
|
33
33
|
|
|
34
34
|
## Sizes
|
|
35
35
|
|
|
36
|
-
An icon is `1em` high by default, and its width follows the icon's aspect ratio.
|
|
37
|
-
height, add a size utility to the same element:
|
|
36
|
+
An icon is `1em` high by default, and its width follows the icon's aspect ratio.
|
|
37
|
+
To change the height, add a size utility to the same element:
|
|
38
38
|
|
|
39
39
|
| Utility | Height |
|
|
40
40
|
| ---------------------------------------- | ------------------------------------------- |
|
|
@@ -43,8 +43,9 @@ height, add a size utility to the same element:
|
|
|
43
43
|
| `icon-[<length>]`, `icon-[<percentage>]` | The given value |
|
|
44
44
|
| `icon-(<custom-property>)` | The value of the given custom property |
|
|
45
45
|
|
|
46
|
-
To add a named size, define a `--icon-size-<name>` token in
|
|
47
|
-
|
|
46
|
+
To add a named size, define a `--icon-size-<name>` token in
|
|
47
|
+
[`@theme`](../at-rules/theme.md). Its value must be a length or a percentage.
|
|
48
|
+
For example, this token adds the `icon-lg` utility:
|
|
48
49
|
|
|
49
50
|
```css
|
|
50
51
|
@theme {
|
|
@@ -56,15 +57,16 @@ or a percentage. For example, this token adds the `icon-lg` utility:
|
|
|
56
57
|
<span {...style("icon-mdi--close icon-lg")} />
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
`icon-full` needs a parent with a definite height. In a parent whose height
|
|
60
|
-
content, the icon is 0 high. To size an icon by its width instead,
|
|
61
|
-
`icon-mdi--close w-full h-auto` fills the parent's width
|
|
62
|
-
When other utilities, such as `size-full` or
|
|
63
|
-
aspect ratio and stays centered
|
|
60
|
+
`icon-full` needs a parent with a definite height. In a parent whose height
|
|
61
|
+
depends on its content, the icon is 0 high. To size an icon by its width instead,
|
|
62
|
+
override the height: `icon-mdi--close w-full h-auto` fills the parent's width
|
|
63
|
+
and keeps the icon's aspect ratio. When other utilities, such as `size-full` or
|
|
64
|
+
`max-w-full`, change the box, the SVG keeps its aspect ratio and stays centered
|
|
65
|
+
in the box.
|
|
64
66
|
|
|
65
|
-
A size utility changes only the icon on its own element. A size on a parent does
|
|
66
|
-
icons of its children. An icon on `::before` or `::after` also
|
|
67
|
-
size utility the same variant as the icon:
|
|
67
|
+
A size utility changes only the icon on its own element. A size on a parent does
|
|
68
|
+
not change the icons of its children. An icon on `::before` or `::after` also
|
|
69
|
+
needs its own size, so give the size utility the same variant as the icon:
|
|
68
70
|
|
|
69
71
|
```tsx
|
|
70
72
|
<span {...style("before:icon-mdi--close before:icon-lg")} />
|
|
@@ -73,8 +75,9 @@ size utility the same variant as the icon:
|
|
|
73
75
|
Size values follow lint policies configured for `height`. For example,
|
|
74
76
|
[no-restricted-length-units](../lints/no-restricted-length-units.md) with
|
|
75
77
|
`properties: ["height"]` checks their units, and
|
|
76
|
-
[no-arbitrary-spacing](../lints/no-arbitrary-spacing.md) with
|
|
77
|
-
reports arbitrary sizes, but not named sizes such as
|
|
78
|
+
[no-arbitrary-spacing](../lints/no-arbitrary-spacing.md) with
|
|
79
|
+
`properties: ["height"]` reports arbitrary sizes, but not named sizes such as
|
|
80
|
+
`icon-lg`.
|
|
78
81
|
|
|
79
82
|
## Icon sets
|
|
80
83
|
|
|
@@ -84,23 +87,24 @@ The plugin finds a set in this order:
|
|
|
84
87
|
2. The `@iconify-json/<set>` package.
|
|
85
88
|
3. The `@iconify/json` package, which contains every Iconify set.
|
|
86
89
|
|
|
87
|
-
Install icon set packages in the project that contains your stylesheet. Changes
|
|
88
|
-
set's JSON file update its icons automatically. Editors complete the icons
|
|
89
|
-
and of the `@iconify-json/*` packages listed in the project's
|
|
90
|
-
When `@iconify/json` is installed, editors also
|
|
91
|
-
and list the icons of a set after
|
|
90
|
+
Install icon set packages in the project that contains your stylesheet. Changes
|
|
91
|
+
to a set's JSON file update its icons automatically. Editors complete the icons
|
|
92
|
+
of configured sets and of the `@iconify-json/*` packages listed in the project's
|
|
93
|
+
`package.json` dependencies. When `@iconify/json` is installed, editors also
|
|
94
|
+
complete its set names, such as `icon-mdi--`, and list the icons of a set after
|
|
95
|
+
the input names it.
|
|
92
96
|
|
|
93
97
|
### License notices
|
|
94
98
|
|
|
95
|
-
The CSS output starts with a license notice for each icon set whose icons it
|
|
96
|
-
`/*! Material Design Icons | Pictogrammers | Apache 2.0 | ... */`.
|
|
97
|
-
name, author, and license from the set's metadata.
|
|
98
|
-
metadata in its `info.json` file.
|
|
99
|
-
their `info` field.
|
|
99
|
+
The CSS output starts with a license notice for each icon set whose icons it
|
|
100
|
+
contains, such as `/*! Material Design Icons | Pictogrammers | Apache 2.0 | ... */`.
|
|
101
|
+
The notice contains the set's name, author, and license from the set's metadata.
|
|
102
|
+
A `@iconify-json/<set>` package supplies the metadata in its `info.json` file.
|
|
103
|
+
The `@iconify/json` package and custom JSON sets supply it in their `info` field.
|
|
100
104
|
|
|
101
|
-
A custom set without metadata adds no notice. It does not use the metadata of an
|
|
102
|
-
with the same name. Pass the `info` option to `svgDirectory()` to
|
|
103
|
-
files.
|
|
105
|
+
A custom set without metadata adds no notice. It does not use the metadata of an
|
|
106
|
+
installed set with the same name. Pass the `info` option to `svgDirectory()` to
|
|
107
|
+
add a notice for a set of SVG files.
|
|
104
108
|
|
|
105
109
|
## Options
|
|
106
110
|
|
|
@@ -116,23 +120,25 @@ The options block of the statement sets these options:
|
|
|
116
120
|
}
|
|
117
121
|
```
|
|
118
122
|
|
|
119
|
-
- `prefix`: utility prefix without the trailing hyphen, such as `icon` or `i`.
|
|
120
|
-
The `--icon-size-*` tokens keep their names, so with
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
- `prefix`: utility prefix without the trailing hyphen, such as `icon` or `i`.
|
|
124
|
+
Defaults to `icon`. The `--icon-size-*` tokens keep their names, so with
|
|
125
|
+
`prefix: i`, `--icon-size-lg` adds `i-lg`.
|
|
126
|
+
- `syntax`: spellings that select an icon. `named` accepts `icon-mdi--close`,
|
|
127
|
+
`bracket` accepts `icon-[mdi--close]`, and `both`, the default, accepts both.
|
|
123
128
|
- `scale`: icon height in `em` when no size utility applies. Defaults to `1`.
|
|
124
|
-
- `mode`: `mask` paints the text color through the icon's shape, and
|
|
125
|
-
icon's own colors. `auto`, the default, selects
|
|
126
|
-
`currentColor`.
|
|
127
|
-
- `hash-length`: base36 hash length in generated CSS variable names. Accepts
|
|
128
|
-
from `1` to `7` and defaults to `4`. Increase it when using many
|
|
129
|
+
- `mode`: `mask` paints the text color through the icon's shape, and
|
|
130
|
+
`background` paints the icon's own colors. `auto`, the default, selects
|
|
131
|
+
`mask` for icons whose SVG uses `currentColor`.
|
|
132
|
+
- `hash-length`: base36 hash length in generated CSS variable names. Accepts
|
|
133
|
+
integers from `1` to `7` and defaults to `4`. Increase it when using many
|
|
134
|
+
icons to reduce collisions.
|
|
129
135
|
|
|
130
136
|
### Options in TypeScript
|
|
131
137
|
|
|
132
|
-
To set options in TypeScript, add `iconify()` to the `plugins` list of the
|
|
133
|
-
`@plugin "@stillwind/plugin-iconify";` in your stylesheet.
|
|
134
|
-
icon sets. A set can be data, an absolute
|
|
135
|
-
SVG directory:
|
|
138
|
+
To set options in TypeScript, add `iconify()` to the `plugins` list of the
|
|
139
|
+
project, and keep `@plugin "@stillwind/plugin-iconify";` in your stylesheet.
|
|
140
|
+
The `collections` option adds custom icon sets. A set can be data, an absolute
|
|
141
|
+
JSON file path, a function that returns data, or an SVG directory:
|
|
136
142
|
|
|
137
143
|
```ts
|
|
138
144
|
import { iconify } from "@stillwind/plugin-iconify";
|
|
@@ -155,16 +161,17 @@ export default defineConfig({
|
|
|
155
161
|
});
|
|
156
162
|
```
|
|
157
163
|
|
|
158
|
-
`iconify()` accepts the options of the `@plugin`
|
|
159
|
-
`hash-length`. When both set the same
|
|
164
|
+
`iconify()` accepts the options of the [`@plugin`](../at-rules/plugin.md)
|
|
165
|
+
block, with `hashLength` in place of `hash-length`. When both set the same
|
|
166
|
+
option, the `@plugin` block wins.
|
|
160
167
|
|
|
161
168
|
Only `iconify()` can set `collections` and [`svgo`](#svg-minification).
|
|
162
169
|
|
|
163
170
|
### Custom icon set format
|
|
164
171
|
|
|
165
172
|
A custom icon set uses the Iconify JSON format, which the `IconifyJSON` type of
|
|
166
|
-
`@iconify/types` describes. This is the same format as the `icons.json` file of
|
|
167
|
-
`@iconify-json/*` package:
|
|
173
|
+
`@iconify/types` describes. This is the same format as the `icons.json` file of
|
|
174
|
+
an `@iconify-json/*` package:
|
|
168
175
|
|
|
169
176
|
```json
|
|
170
177
|
{
|
|
@@ -190,30 +197,31 @@ A custom icon set uses the Iconify JSON format, which the `IconifyJSON` type of
|
|
|
190
197
|
}
|
|
191
198
|
```
|
|
192
199
|
|
|
193
|
-
- `icons` maps each icon name to its SVG content. `body` contains the elements
|
|
194
|
-
`<svg>` element, without the `<svg>` element itself.
|
|
195
|
-
- `left`, `top`, `width`, and `height` define the icon's `viewBox`. An icon can
|
|
196
|
-
the top level sets the default values for every icon. Missing
|
|
197
|
-
`16`, and `16`.
|
|
198
|
-
- `aliases` maps additional names to an existing icon in `parent`. An alias can
|
|
199
|
-
`viewBox` values and add `rotate` (quarter turns), `hFlip`, and
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
- `icons` maps each icon name to its SVG content. `body` contains the elements
|
|
201
|
+
inside the `<svg>` element, without the `<svg>` element itself.
|
|
202
|
+
- `left`, `top`, `width`, and `height` define the icon's `viewBox`. An icon can
|
|
203
|
+
set them, and the top level sets the default values for every icon. Missing
|
|
204
|
+
values default to `0`, `0`, `16`, and `16`.
|
|
205
|
+
- `aliases` maps additional names to an existing icon in `parent`. An alias can
|
|
206
|
+
override the `viewBox` values and add `rotate` (quarter turns), `hFlip`, and
|
|
207
|
+
`vFlip` transformations.
|
|
208
|
+
- The key in `collections` sets the set name in utilities, such as
|
|
209
|
+
`icon-brand--logo`. The plugin does not use the `prefix` field to find the set.
|
|
202
210
|
|
|
203
|
-
Set names and icon names must consist of lowercase letters and digits, separated
|
|
204
|
-
hyphens. Utilities cannot select other names, such as `Logo` or `logo_dark`.
|
|
211
|
+
Set names and icon names must consist of lowercase letters and digits, separated
|
|
212
|
+
by single hyphens. Utilities cannot select other names, such as `Logo` or `logo_dark`.
|
|
205
213
|
|
|
206
|
-
With the default `mode: auto`, an icon whose `body` contains `currentColor`
|
|
207
|
-
color, and the other icons keep their own colors. In the
|
|
208
|
-
color and `badge` stays red.
|
|
214
|
+
With the default `mode: auto`, an icon whose `body` contains `currentColor`
|
|
215
|
+
paints the text color, and the other icons keep their own colors. In the
|
|
216
|
+
example, `logo` follows the text color and `badge` stays red.
|
|
209
217
|
|
|
210
|
-
The plugin does not validate the data. A JSON file must contain valid JSON, but
|
|
211
|
-
treats an icon that it cannot find in the data as an unknown utility.
|
|
218
|
+
The plugin does not validate the data. A JSON file must contain valid JSON, but
|
|
219
|
+
the plugin treats an icon that it cannot find in the data as an unknown utility.
|
|
212
220
|
|
|
213
221
|
### Icon sets from SVG files
|
|
214
222
|
|
|
215
|
-
`svgDirectory()` creates an icon set from the SVG files in a directory. Each
|
|
216
|
-
icon, and the file name without `.svg` becomes the icon name:
|
|
223
|
+
`svgDirectory()` creates an icon set from the SVG files in a directory. Each
|
|
224
|
+
file becomes one icon, and the file name without `.svg` becomes the icon name:
|
|
217
225
|
|
|
218
226
|
```ts
|
|
219
227
|
import { iconify, svgDirectory } from "@stillwind/plugin-iconify";
|
|
@@ -229,32 +237,34 @@ iconify({
|
|
|
229
237
|
});
|
|
230
238
|
```
|
|
231
239
|
|
|
232
|
-
The directory can be an absolute path or a path relative to the project directory.
|
|
233
|
-
must contain an `<svg>` element with a `viewBox` attribute, which sets
|
|
234
|
-
The plugin keeps the `style` attribute of the `<svg>`
|
|
235
|
-
start with `fill` or `stroke`, such as
|
|
236
|
-
`<svg>` element.
|
|
237
|
-
|
|
238
|
-
- `recursive`: reads subdirectories. The default icon name joins the path
|
|
239
|
-
such as `arrows-left` for `arrows/left.svg`. Defaults to
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
The directory can be an absolute path or a path relative to the project directory.
|
|
241
|
+
Each file must contain an `<svg>` element with a `viewBox` attribute, which sets
|
|
242
|
+
the icon's dimensions. The plugin keeps the `style` attribute of the `<svg>`
|
|
243
|
+
element and its attributes whose names start with `fill` or `stroke`, such as
|
|
244
|
+
`fill-rule`. It drops the other attributes of the `<svg>` element.
|
|
245
|
+
|
|
246
|
+
- `recursive`: reads subdirectories. The default icon name joins the path
|
|
247
|
+
segments with `-`, such as `arrows-left` for `arrows/left.svg`. Defaults to
|
|
248
|
+
`false`.
|
|
249
|
+
- `name`: maps the file path relative to the directory, without `.svg` and with
|
|
250
|
+
`/` separators, to an icon name. Returning `undefined` skips the file.
|
|
242
251
|
- `transform`: rewrites the SVG text of each file before the plugin parses it.
|
|
243
|
-
- `info`: the set's name, author, and license in the format of the Iconify
|
|
244
|
-
plugin uses it for the [license notice](#license-notices).
|
|
252
|
+
- `info`: the set's name, author, and license in the format of the Iconify
|
|
253
|
+
`info` field. The plugin uses it for the [license notice](#license-notices).
|
|
245
254
|
|
|
246
|
-
Loading fails when an icon name is invalid, two files have the same icon name, or
|
|
247
|
-
no `viewBox`. The error names the file. Adding, removing, or editing an
|
|
248
|
-
icons while a development server or build watcher runs.
|
|
255
|
+
Loading fails when an icon name is invalid, two files have the same icon name, or
|
|
256
|
+
a file has no `viewBox`. The error names the file. Adding, removing, or editing an
|
|
257
|
+
SVG file reloads the icons while a development server or build watcher runs.
|
|
249
258
|
|
|
250
|
-
A function in `collections` receives the set name and the host's `read`, `list`,
|
|
251
|
-
operations, so you can write similar loaders. Watch each file and
|
|
252
|
-
reads, such as `context.watch(file)` and
|
|
259
|
+
A function in `collections` receives the set name and the host's `read`, `list`,
|
|
260
|
+
and `watch` operations, so you can write similar loaders. Watch each file and
|
|
261
|
+
directory that the function reads, such as `context.watch(file)` and
|
|
262
|
+
`context.watch(directory, "directory")`.
|
|
253
263
|
|
|
254
264
|
### SVG minification
|
|
255
265
|
|
|
256
|
-
The plugin minifies the SVG of each icon with [SVGO](https://svgo.dev/) before
|
|
257
|
-
SVG in CSS. The `svgo` TypeScript option controls this:
|
|
266
|
+
The plugin minifies the SVG of each icon with [SVGO](https://svgo.dev/) before
|
|
267
|
+
it embeds the SVG in CSS. The `svgo` TypeScript option controls this:
|
|
258
268
|
|
|
259
269
|
- `true`, the default, uses `preset-default` with `multipass` enabled.
|
|
260
270
|
- An SVGO configuration object replaces that default configuration.
|
package/docs/plugins/index.md
CHANGED
|
@@ -6,15 +6,15 @@ description: "Add utilities to your stylesheet with the plugins that the Stillwi
|
|
|
6
6
|
# Official plugins
|
|
7
7
|
|
|
8
8
|
A plugin adds utilities and variants to your stylesheet. Each project that loads
|
|
9
|
-
a plugin can use its definitions in `style()
|
|
10
|
-
like your own definitions.
|
|
9
|
+
a plugin can use its definitions in [`style()`](../macros/style.md), and the
|
|
10
|
+
editor and the CLI check them like your own definitions.
|
|
11
11
|
|
|
12
12
|
| Plugin | Adds |
|
|
13
13
|
| ---------------------------------------------------- | -------------------------- |
|
|
14
14
|
| [`@stillwind/plugin-iconify`](iconify.md) | Iconify icons as utilities |
|
|
15
15
|
|
|
16
16
|
Install the package, and load it in your stylesheet with
|
|
17
|
-
[
|
|
17
|
+
[`@plugin`](../at-rules/plugin.md):
|
|
18
18
|
|
|
19
19
|
```css
|
|
20
20
|
@import "stillwind";
|
|
@@ -30,10 +30,10 @@ does, so compare its declarations with your CSS before you replace it.
|
|
|
30
30
|
## What the lookup covers
|
|
31
31
|
|
|
32
32
|
The lookup runs the Stillwind compiler in your browser with the default theme.
|
|
33
|
-
It downloads the compiler when the page opens. Utilities from your own
|
|
34
|
-
tokens, such as `bg-brand`, do not resolve here.
|
|
35
|
-
[Design systems](guides/design-systems.md) to add them. To check a utility
|
|
36
|
-
your project, hover over it in the editor or run `stillwind utilities`.
|
|
33
|
+
It downloads the compiler when the page opens. Utilities from your own
|
|
34
|
+
[`@theme`](at-rules/theme.md) tokens, such as `bg-brand`, do not resolve here.
|
|
35
|
+
See [Design systems](guides/design-systems.md) to add them. To check a utility
|
|
36
|
+
in your project, hover over it in the editor or run `stillwind utilities`.
|
|
37
37
|
|
|
38
38
|
The built-in utilities and variants follow Tailwind CSS, so see the
|
|
39
39
|
[Tailwind CSS documentation](https://tailwindcss.com/docs) for their usage.
|
package/docs/why.md
CHANGED
|
@@ -128,8 +128,8 @@ only the small runtime helpers that they use. See
|
|
|
128
128
|
Stillwind supports Tailwind CSS v4 utilities, variants, and plugins. You write
|
|
129
129
|
them in a different place:
|
|
130
130
|
|
|
131
|
-
- You pass utilities to `style()` and spread the result onto
|
|
132
|
-
instead of writing a `className` string.
|
|
131
|
+
- You pass utilities to [`style()`](guides/style.md) and spread the result onto
|
|
132
|
+
the element, instead of writing a `className` string.
|
|
133
133
|
- Stillwind needs a build tool. It supports Vite, Astro, Next.js, SvelteKit,
|
|
134
134
|
Nuxt, webpack, Rspack, Rsbuild, and Turbopack.
|
|
135
135
|
- Some Tailwind settings move to `stillwind.config.ts`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stillwind",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "CSS
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Write Tailwind CSS v4 utilities in components, enforce your design system, and ship static CSS",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"alpinejs",
|
|
7
|
+
"astro",
|
|
8
|
+
"atomic-css",
|
|
9
|
+
"css",
|
|
10
|
+
"css-compiler",
|
|
11
|
+
"design-system",
|
|
12
|
+
"design-tokens",
|
|
13
|
+
"lit",
|
|
14
|
+
"preact",
|
|
15
|
+
"qwik",
|
|
16
|
+
"react",
|
|
17
|
+
"solid-js",
|
|
18
|
+
"static-css",
|
|
19
|
+
"stillwind",
|
|
20
|
+
"svelte",
|
|
21
|
+
"tailwind",
|
|
22
|
+
"tailwindcss",
|
|
23
|
+
"utility-classes",
|
|
24
|
+
"utility-first",
|
|
25
|
+
"vue",
|
|
26
|
+
"web-components",
|
|
27
|
+
"zero-runtime"
|
|
28
|
+
],
|
|
5
29
|
"homepage": "https://stillwind.dev",
|
|
6
30
|
"bugs": {
|
|
7
31
|
"url": "https://github.com/SegaraRai/stillwind/issues"
|
|
@@ -120,9 +144,9 @@
|
|
|
120
144
|
"./package.json": "./package.json"
|
|
121
145
|
},
|
|
122
146
|
"dependencies": {
|
|
123
|
-
"@stillwind/config": "0.
|
|
124
|
-
"@stillwind/native": "0.
|
|
125
|
-
"@stillwind/projection": "0.
|
|
147
|
+
"@stillwind/config": "0.6.0",
|
|
148
|
+
"@stillwind/native": "0.6.0",
|
|
149
|
+
"@stillwind/projection": "0.6.0"
|
|
126
150
|
},
|
|
127
151
|
"devDependencies": {
|
|
128
152
|
"@stillwind-internal/tools-workspace": "0.0.0",
|
|
@@ -70,8 +70,13 @@ unless the user agrees.
|
|
|
70
70
|
## Verify
|
|
71
71
|
|
|
72
72
|
- Build the project, and run `stillwind lint` and `stillwind fmt`.
|
|
73
|
-
-
|
|
74
|
-
|
|
73
|
+
- When you can use a browser, compare the computed styles of the migrated
|
|
74
|
+
components with the old version, as "Compare computed styles" in
|
|
75
|
+
`docs/guides/migrating-from-tailwind.md` describes. Use it for a migration
|
|
76
|
+
from CSS too. Compare each theme and each breakpoint that the project uses,
|
|
77
|
+
and do not rely on screenshots alone. Report each difference, and say whether
|
|
78
|
+
it is intended for the chosen level.
|
|
79
|
+
- When you cannot use a browser, list the pages that the user should check.
|
|
75
80
|
|
|
76
81
|
## Finish
|
|
77
82
|
|