Skip to content

Commit 11b5259

Browse files
committed
Merge branch 'main' into revert-15196-corepack-bullshit
2 parents f098008 + 8b97725 commit 11b5259

File tree

75 files changed

+1326
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1326
-544
lines changed

.changeset/long-moles-join.md

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

.changeset/short-fireants-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ignore typescript abstract methods

.changeset/thirty-feet-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: correctly ssr component in `svelte:head` with `$props.id()` or `css='injected'`

documentation/docs/02-runes/05-$props.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,24 @@ You can, of course, separate the type declaration from the annotation:
199199
> [!NOTE] Interfaces for native DOM elements are provided in the `svelte/elements` module (see [Typing wrapper components](typescript#Typing-wrapper-components))
200200
201201
Adding types is recommended, as it ensures that people using your component can easily discover which props they should provide.
202+
203+
204+
## `$props.id()`
205+
206+
This rune, added in version 5.20.0, generates an ID that is unique to the current component instance. When hydrating a server-rendered component, the value will be consistent between server and client.
207+
208+
This is useful for linking elements via attributes like `for` and `aria-labelledby`.
209+
210+
```svelte
211+
<script>
212+
const uid = $props.id();
213+
</script>
214+
215+
<form>
216+
<label for="{uid}-firstname">First Name: </label>
217+
<input id="{uid}-firstname" type="text" />
218+
219+
<label for="{uid}-lastname">Last Name: </label>
220+
<input id="{uid}-lastname" type="text" />
221+
</form>
222+
```

documentation/docs/06-runtime/03-lifecycle-hooks.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ If a function is returned from `onMount`, it will be called when the component i
4545
4646
## `onDestroy`
4747

48-
> EXPORT_SNIPPET: svelte#onDestroy
49-
5048
Schedules a callback to run immediately before the component is unmounted.
5149

5250
Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the only one that runs inside a server-side component.

documentation/docs/98-reference/.generated/compile-errors.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,13 @@ Unrecognised compiler option %keypath%
573573
### props_duplicate
574574

575575
```
576-
Cannot use `$props()` more than once
576+
Cannot use `%rune%()` more than once
577+
```
578+
579+
### props_id_invalid_placement
580+
581+
```
582+
`$props.id()` can only be used at the top level of components as a variable declaration initializer
577583
```
578584

579585
### props_illegal_name

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"packageManager": "[email protected]",
99
"engines": {
10-
"pnpm": "^9.0.0"
10+
"pnpm": ">=9.0.0"
1111
},
1212
"repository": {
1313
"type": "git",
@@ -44,6 +44,6 @@
4444
"typescript": "^5.5.4",
4545
"typescript-eslint": "^8.2.0",
4646
"v8-natives": "^1.2.5",
47-
"vitest": "^2.0.5"
47+
"vitest": "^2.1.9"
4848
}
4949
}

packages/svelte/CHANGELOG.md

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

3+
## 5.20.0
4+
5+
### Minor Changes
6+
7+
- feat: SSR-safe ID generation with `$props.id()` ([#15185](https://github.com/sveltejs/svelte/pull/15185))
8+
9+
### Patch Changes
10+
11+
- fix: take private and public into account for `constant_assignment` of derived state ([#15276](https://github.com/sveltejs/svelte/pull/15276))
12+
13+
- fix: value/checked not correctly set using spread ([#15239](https://github.com/sveltejs/svelte/pull/15239))
14+
15+
- chore: tweak effect self invalidation logic, run transition dispatches without reactive context ([#15275](https://github.com/sveltejs/svelte/pull/15275))
16+
17+
- fix: use `importNode` to clone templates for Firefox ([#15272](https://github.com/sveltejs/svelte/pull/15272))
18+
19+
- fix: recurse into `$derived` for ownership validation ([#15166](https://github.com/sveltejs/svelte/pull/15166))
20+
21+
## 5.19.10
22+
23+
### Patch Changes
24+
25+
- fix: when re-connecting unowned deriveds, remove their unowned flag ([#15255](https://github.com/sveltejs/svelte/pull/15255))
26+
27+
- fix: allow mutation of private derived state ([#15228](https://github.com/sveltejs/svelte/pull/15228))
28+
29+
## 5.19.9
30+
31+
### Patch Changes
32+
33+
- fix: ensure unowned derived dependencies are not duplicated when reactions are skipped ([#15232](https://github.com/sveltejs/svelte/pull/15232))
34+
35+
- fix: hydrate `href` that is part of spread attributes ([#15226](https://github.com/sveltejs/svelte/pull/15226))
36+
37+
## 5.19.8
38+
39+
### Patch Changes
40+
41+
- fix: properly set `value` property of custom elements ([#15206](https://github.com/sveltejs/svelte/pull/15206))
42+
43+
- fix: ensure custom element updates don't run in hydration mode ([#15217](https://github.com/sveltejs/svelte/pull/15217))
44+
45+
- fix: ensure tracking returns true, even if in unowned ([#15214](https://github.com/sveltejs/svelte/pull/15214))
46+
347
## 5.19.7
448

549
### Patch Changes

packages/svelte/messages/compile-errors/script.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ This turned out to be buggy and unpredictable, particularly when working with de
120120
121121
## props_duplicate
122122

123-
> Cannot use `$props()` more than once
123+
> Cannot use `%rune%()` more than once
124+
125+
## props_id_invalid_placement
126+
127+
> `$props.id()` can only be used at the top level of components as a variable declaration initializer
124128
125129
## props_illegal_name
126130

packages/svelte/package.json

Lines changed: 2 additions & 2 deletions
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.19.7",
5+
"version": "5.20.0",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {
@@ -143,7 +143,7 @@
143143
"source-map": "^0.7.4",
144144
"tiny-glob": "^0.2.9",
145145
"typescript": "^5.5.4",
146-
"vitest": "^2.0.5"
146+
"vitest": "^2.1.9"
147147
},
148148
"dependencies": {
149149
"@ampproject/remapping": "^2.3.0",

0 commit comments

Comments
 (0)