Skip to content

Commit d97b170

Browse files
authored
Merge branch 'main' into feat/tizu-crossfade-strategy
2 parents 478126b + 74917ae commit d97b170

11 files changed

+40
-56
lines changed

.changeset/brown-rockets-shake.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/cuddly-chefs-refuse.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/curvy-countries-flow.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/gold-hairs-jog.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/hungry-dancers-tap.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/plenty-bats-lay.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/two-spies-lie.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

documentation/docs/07-misc/07-v5-migration-guide.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ You don't have to migrate to the new syntax right away - Svelte 5 still supports
1010

1111
At the heart of Svelte 5 is the new runes API. Runes are basically compiler instructions that inform Svelte about reactivity. Syntactically, runes are functions starting with a dollar-sign.
1212

13-
### let -> $state
13+
### let $state
1414

1515
In Svelte 4, a `let` declaration at the top level of a component was implicitly reactive. In Svelte 5, things are more explicit: a variable is reactive when created using the `$state` rune. Let's migrate the counter to runes mode by wrapping the counter in `$state`:
1616

1717
```svelte
1818
<script>
19-
let count = +++$state(+++0+++)+++;
19+
let count = +++$state(0)+++;
2020
</script>
2121
```
2222

@@ -25,14 +25,14 @@ Nothing else changes. `count` is still the number itself, and you read and write
2525
> [!DETAILS] Why we did this
2626
> `let` being implicitly reactive at the top level worked great, but it meant that reactivity was constrained - a `let` declaration anywhere else was not reactive. This forced you to resort to using stores when refactoring code out of the top level of components for reuse. This meant you had to learn an entirely separate reactivity model, and the result often wasn't as nice to work with. Because reactivity is more explicit in Svelte 5, you can keep using the same API outside the top level of components. Head to [the tutorial](/tutorial) to learn more.
2727
28-
### $: -> $derived/$effect
28+
### $: $derived/$effect
2929

3030
In Svelte 4, a `$:` statement at the top level of a component could be used to declare a derivation, i.e. state that is entirely defined through a computation of other state. In Svelte 5, this is achieved using the `$derived` rune:
3131

3232
```svelte
3333
<script>
34-
let count = +++$state(+++0+++)+++;
35-
---$:--- +++const+++ double = +++$derived(+++count * 2+++)+++;
34+
let count = $state(0);
35+
---$:--- +++const+++ double = +++$derived(count * 2)+++;
3636
</script>
3737
```
3838

@@ -42,7 +42,8 @@ A `$:` statement could also be used to create side effects. In Svelte 5, this is
4242

4343
```svelte
4444
<script>
45-
let count = +++$state(+++0+++)+++;
45+
let count = $state(0);
46+
4647
---$:---+++$effect(() =>+++ {
4748
if (count > 5) {
4849
alert('Count is too high!');
@@ -73,14 +74,14 @@ Note that [when `$effect` runs is different]($effect#Understanding-dependencies)
7374
> - executing dependencies as needed and therefore being immune to ordering problems
7475
> - being TypeScript-friendly
7576
76-
### export let -> $props
77+
### export let $props
7778

7879
In Svelte 4, properties of a component were declared using `export let`. Each property was one declaration. In Svelte 5, all properties are declared through the `$props` rune, through destructuring:
7980

8081
```svelte
8182
<script>
82-
---export let optional = 'unset';
83-
export let required;---
83+
---export let optional = 'unset';---
84+
---export let required;---
8485
+++let { optional = 'unset', required } = $props();+++
8586
</script>
8687
```
@@ -105,8 +106,8 @@ In Svelte 5, the `$props` rune makes this straightforward without any additional
105106

106107
```svelte
107108
<script>
108-
---let klass = '';
109-
export { klass as class};---
109+
---let klass = '';---
110+
---export { klass as class};---
110111
+++let { class: klass, ...rest } = $props();+++
111112
</script>
112113
<button class={klass} {...---$$restProps---+++rest+++}>click me</button>
@@ -192,9 +193,9 @@ This function is deprecated in Svelte 5. Instead, components should accept _call
192193
```svelte
193194
<!--- file: Pump.svelte --->
194195
<script>
195-
---import { createEventDispatcher } from 'svelte';
196-
const dispatch = createEventDispatcher();
197-
---
196+
---import { createEventDispatcher } from 'svelte';---
197+
---const dispatch = createEventDispatcher();---
198+
198199
+++let { inflate, deflate } = $props();+++
199200
let power = $state(5);
200201
</script>
@@ -466,11 +467,11 @@ By now you should have a pretty good understanding of the before/after and how t
466467
We thought the same, which is why we provide a migration script to do most of the migration automatically. You can upgrade your project by using `npx sv migrate svelte-5`. This will do the following things:
467468

468469
- bump core dependencies in your `package.json`
469-
- migrate to runes (`let` -> `$state` etc)
470-
- migrate to event attributes for DOM elements (`on:click` -> `onclick`)
471-
- migrate slot creations to render tags (`<slot />` -> `{@render children()}`)
472-
- migrate slot usages to snippets (`<div slot="x">...</div>` -> `{#snippet x()}<div>...</div>{/snippet}`)
473-
- migrate obvious component creations (`new Component(...)` -> `mount(Component, ...)`)
470+
- migrate to runes (`let` `$state` etc)
471+
- migrate to event attributes for DOM elements (`on:click` `onclick`)
472+
- migrate slot creations to render tags (`<slot />` `{@render children()}`)
473+
- migrate slot usages to snippets (`<div slot="x">...</div>` `{#snippet x()}<div>...</div>{/snippet}`)
474+
- migrate obvious component creations (`new Component(...)` `mount(Component, ...)`)
474475

475476
You can also migrate a single component in VS Code through the `Migrate Component to Svelte 5 Syntax` command, or in our Playground through the `Migrate` button.
476477

packages/svelte/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# svelte
22

3+
## 5.23.1
4+
5+
### Patch Changes
6+
7+
- fix: invalidate parent effects when child effects update parent dependencies ([#15506](https://github.com/sveltejs/svelte/pull/15506))
8+
9+
- fix: correctly match `:has()` selector during css pruning ([#15277](https://github.com/sveltejs/svelte/pull/15277))
10+
11+
- fix: replace `undefined` with `void 0` to avoid edge case ([#15511](https://github.com/sveltejs/svelte/pull/15511))
12+
13+
- fix: allow global-like pseudo-selectors refinement ([#15313](https://github.com/sveltejs/svelte/pull/15313))
14+
15+
- chore: don't distribute unused types definitions ([#15473](https://github.com/sveltejs/svelte/pull/15473))
16+
17+
- fix: add `files` and `group` to HTMLInputAttributes in elements.d.ts ([#15492](https://github.com/sveltejs/svelte/pull/15492))
18+
19+
- fix: throw rune_invalid_arguments_length when $state.raw() is used with more than 1 arg ([#15516](https://github.com/sveltejs/svelte/pull/15516))
20+
321
## 5.23.0
422

523
### Minor Changes

packages/svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svelte",
33
"description": "Cybernetically enhanced web apps",
44
"license": "MIT",
5-
"version": "5.23.0",
5+
"version": "5.23.1",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {

packages/svelte/src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
* The current version, as set in package.json.
55
* @type {string}
66
*/
7-
export const VERSION = '5.23.0';
7+
export const VERSION = '5.23.1';
88
export const PUBLIC_VERSION = '5';

0 commit comments

Comments
 (0)