Skip to content

Commit 9d4b2ca

Browse files
committed
Add migration notes to version history
1 parent c5bff64 commit 9d4b2ca

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

src/routes/docs/2.0/version-history.svx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
1+
## Migration from 1.0 to 2.0
2+
3+
The 2.0 release introduced a few breaking changes; see below.
4+
5+
### Switch to `bind:` for Listbox, RadioGroup, and Switch
6+
7+
These three components previously required you to use a `on:change` event listener to update their values. These have been changed to use two-way binding with the `bind:` directive.
8+
9+
#### Listbox
10+
11+
```svelte
12+
<!-- Old -->
13+
<Listbox value={foo} on:change={(e) => foo = e.detail}>
14+
...
15+
</Listbox>
16+
17+
<!-- New -->
18+
<Listbox bind:value={foo}>
19+
...
20+
</Listbox>
21+
```
22+
23+
#### RadioGroup
24+
25+
```svelte
26+
<!-- Old -->
27+
<RadioGroup value={foo} on:change={(e) => foo = e.detail}>
28+
...
29+
</RadioGroup>
30+
31+
<!-- New -->
32+
<RadioGroup bind:value={foo}>
33+
...
34+
</RadioGroup>
35+
```
36+
37+
#### Switch
38+
39+
```svelte
40+
<!-- Old -->
41+
<Switch checked={foo} on:change={(e) => foo = e.detail}>
42+
...
43+
</Switch>
44+
45+
<!-- New -->
46+
<Switch bind:checked={foo}>
47+
...
48+
</Switch>
49+
```
50+
51+
### Renamed transition events
52+
53+
Events emitted by the `Transition` components have been renamed for better consistency with the event names used natively in Svelte. Specifically,
54+
* `beforeEnter` is now `introstart`
55+
* `afterEnter` is now `introend`
56+
* `beforeLeave` is now `outrostart`
57+
* `afterLeave` is now `outroend`
58+
59+
## Full version history
60+
161
This is the release history of Svelte Headless UI and the correspondence with versions of Headless UI. Click on a version number to see the documentation for that version.
262

363
| Svelte Headless UI version | Date released | Headless UI version | Notes |
464
| -------------------------- | ------------- | ------------------- | ----- |
65+
| [2.0.0](../2.0) | 2023-??-?? | 1.4.2 | Switches to `bind:` for three components; renames transition events; uses `<svelte:element>` internally |
566
| [1.0.2](../1.0) | 2022-05-25 | 1.4.2 | Fixes TypeScript errors with some attributes |
667
| [1.0.1](../1.0) | 2022-05-16 | 1.4.2 | Fixes a SSR error when using the `as` prop on buttons |
768
| [1.0.0](../1.0) | 2022-05-06 | 1.4.2 | Much improved TypeScript support; much smaller bundle size |

0 commit comments

Comments
 (0)