Skip to content

Commit 4da37f6

Browse files
committed
merge main
2 parents 1123629 + 4aadb34 commit 4da37f6

File tree

408 files changed

+11025
-12182
lines changed

Some content is hidden

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

408 files changed

+11025
-12182
lines changed

.changeset/tidy-zebras-begin.md

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

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: pnpm lint
6060
- name: build and check generated types
6161
if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail
62-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
62+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
6363
Benchmarks:
6464
runs-on: ubuntu-latest
6565
timeout-minutes: 15

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: pnpm install --frozen-lockfile
3434

3535
- name: Build
36-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
36+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
3737

3838
- name: Create Release Pull Request or Publish to npm
3939
id: changesets

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-24 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
1+
Copyright (c) 2016-2025 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ You may view [our roadmap](https://svelte.dev/roadmap) if you'd like to see what
2424

2525
Please see the [Contributing Guide](CONTRIBUTING.md) and the [`svelte`](packages/svelte) package for information on contributing to Svelte.
2626

27-
### svelte.dev
28-
29-
The source code for https://svelte.dev lives in the [sites](https://github.com/sveltejs/svelte/tree/master/sites/svelte.dev) folder, with all the documentation right [here](https://github.com/sveltejs/svelte/tree/master/documentation). The site is built with [SvelteKit](https://svelte.dev/docs/kit).
30-
3127
## Is svelte.dev down?
3228

3329
Probably not, but it's possible. If you can't seem to access any `.dev` sites, check out [this SuperUser question and answer](https://superuser.com/q/1413402).

documentation/docs/02-runes/02-$state.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ todos[0].done = !todos[0].done;
4444
If you push a new object to the array, it will also be proxified:
4545

4646
```js
47-
// @filename: ambient.d.ts
48-
declare global {
49-
const todos: Array<{ done: boolean, text: string }>
50-
}
51-
52-
// @filename: index.js
47+
let todos = [{ done: false, text: 'add more todos' }];
5348
// ---cut---
5449
todos.push({
5550
done: false,

documentation/docs/02-runes/03-$derived.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,20 @@ In essence, `$derived(expression)` is equivalent to `$derived.by(() => expressio
5151
Anything read synchronously inside the `$derived` expression (or `$derived.by` function body) is considered a _dependency_ of the derived state. When the state changes, the derived will be marked as _dirty_ and recalculated when it is next read.
5252

5353
To exempt a piece of state from being treated as a dependency, use [`untrack`](svelte#untrack).
54+
55+
## Update propagation
56+
57+
Svelte uses something called _push-pull reactivity_ — when state is updated, everything that depends on the state (whether directly or indirectly) is immediately notified of the change (the 'push'), but derived values are not re-evaluated until they are actually read (the 'pull').
58+
59+
If the new value of a derived is referentially identical to its previous value, downstream updates will be skipped. In other words, Svelte will only update the text inside the button when `large` changes, not when `count` changes, even though `large` depends on `count`:
60+
61+
```svelte
62+
<script>
63+
let count = $state(0);
64+
let large = $derived(count > 10);
65+
</script>
66+
67+
<button onclick={() => count++}>
68+
{large}
69+
</button>
70+
```

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,6 @@ You can, of course, separate the type declaration from the annotation:
196196
</script>
197197
```
198198

199+
> [!NOTE] Interfaces for native DOM elements are provided in the `svelte/elements` module (see [Typing wrapper components](typescript#Typing-wrapper-components))
200+
199201
Adding types is recommended, as it ensures that people using your component can easily discover which props they should provide.

documentation/docs/02-runes/07-$inspect.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,20 @@ A convenient way to find the origin of some change is to pass `console.trace` to
4242
// @errors: 2304
4343
$inspect(stuff).with(console.trace);
4444
```
45+
46+
## $inspect.trace(...)
47+
48+
This rune, added in 5.14, causes the surrounding function to be _traced_ in development. Any time the function re-runs as part of an [effect]($effect) or a [derived]($derived), information will be printed to the console about which pieces of reactive state caused the effect to fire.
49+
50+
```svelte
51+
<script>
52+
import { doSomeWork } from './elsewhere';
53+
54+
$effect(() => {
55+
+++$inspect.trace();+++
56+
doSomeWork();
57+
});
58+
</script>
59+
```
60+
61+
`$inspect.trace` takes an optional first argument which will be used as the label.

documentation/docs/03-template-syntax/03-each.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Iterating over values can be done with an each block. The values in question can
2323
</ul>
2424
```
2525

26-
You can use each blocks to iterate over any array or array-like value — that is, any object with a `length` property.
27-
2826
An each block can also specify an _index_, equivalent to the second argument in an `array.map(...)` callback:
2927

3028
```svelte

0 commit comments

Comments
 (0)