Skip to content

Commit 37f10e6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into scope-not
2 parents 7383239 + eb6488c commit 37f10e6

File tree

32 files changed

+454
-96
lines changed

32 files changed

+454
-96
lines changed

.changeset/eleven-humans-kneel.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: cleanup non-branch effects created inside block effects

.changeset/ninety-months-laugh.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: ensure effects destroy owned deriveds upon teardown

.changeset/pink-shirts-film.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: ensure proxied arrays correctly update their length upon deletions

.changeset/pre.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"angry-weeks-design",
2323
"beige-clocks-notice",
2424
"beige-cobras-smoke",
25+
"beige-donkeys-exercise",
2526
"beige-flies-wash",
2627
"beige-gifts-appear",
2728
"beige-lamps-ring",
@@ -184,6 +185,7 @@
184185
"eleven-cycles-applaud",
185186
"eleven-donuts-sit",
186187
"eleven-hounds-pump",
188+
"eleven-humans-kneel",
187189
"eleven-icons-sniff",
188190
"eleven-peaches-tap",
189191
"eleven-teachers-drive",
@@ -448,6 +450,7 @@
448450
"loud-penguins-unite",
449451
"loud-ravens-drop",
450452
"loud-socks-look",
453+
"loud-walls-wave",
451454
"lovely-bugs-sneeze",
452455
"lovely-carpets-lick",
453456
"lovely-houses-own",
@@ -526,6 +529,7 @@
526529
"ninety-days-visit",
527530
"ninety-dingos-walk",
528531
"ninety-dots-train",
532+
"ninety-months-laugh",
529533
"ninety-rockets-battle",
530534
"odd-buckets-lie",
531535
"odd-needles-joke",
@@ -571,6 +575,7 @@
571575
"pink-countries-repair",
572576
"pink-goats-promise",
573577
"pink-mayflies-tie",
578+
"pink-shirts-film",
574579
"plenty-clouds-reply",
575580
"plenty-elephants-fry",
576581
"plenty-items-build",
@@ -731,6 +736,7 @@
731736
"slimy-news-help",
732737
"slimy-onions-approve",
733738
"slimy-walls-draw",
739+
"slow-badgers-invite",
734740
"slow-beds-shave",
735741
"slow-chefs-dream",
736742
"slow-gorillas-yawn",
@@ -764,6 +770,7 @@
764770
"soft-clocks-remember",
765771
"soft-geese-learn",
766772
"soft-months-grab",
773+
"soft-stingrays-attend",
767774
"soft-tigers-wink",
768775
"sour-bags-fail",
769776
"sour-forks-stare",
@@ -899,6 +906,7 @@
899906
"twelve-bears-worry",
900907
"twelve-cows-learn",
901908
"twelve-dragons-join",
909+
"twelve-mayflies-decide",
902910
"twelve-onions-juggle",
903911
"twelve-scissors-kneel",
904912
"twelve-shrimps-run",

.changeset/slow-badgers-invite.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: avoid assigning input.value if the value is the same to fix `minlength`

documentation/docs/01-introduction/02-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Don't worry if you don't know Svelte yet! You can ignore all the nice features S
2424

2525
### Alternatives to SvelteKit
2626

27-
If you don't want to use SvelteKit for some reason, you can also use Svelte with Vite (but without SvelteKit) by running `npm create vite@latest` and selecting the `svelte` option. With this, `npm run build` will generate HTML, JS and CSS files inside the `dist` directory thanks using [vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte). In most cases, you will probably need to [choose a routing library](faq#is-there-a-router) as well.
27+
If you don't want to use SvelteKit for some reason, you can also use Svelte with Vite (but without SvelteKit) by running `npm create vite@latest` and selecting the `svelte` option. With this, `npm run build` will generate HTML, JS and CSS files inside the `dist` directory thanks using [vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte). In most cases, you will probably need to [choose a routing library](faq#Is-there-a-router) as well.
2828

2929
Alternatively, there are plugins for [Rollup](https://github.com/sveltejs/rollup-plugin-svelte), [Webpack](https://github.com/sveltejs/svelte-loader) [and a few others](https://sveltesociety.dev/packages?category=build-plugins) to handle Svelte compilation — which will output `.js` and `.css` that you can insert into your HTML — but setting up SSR with them requires more manual work.
3030

documentation/docs/02-template-syntax/01-component-fundamentals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ All three sections — script, styles and markup — are optional.
2121
</style>
2222
```
2323

24-
## &lt;script&gt;
24+
## `<script>`
2525

2626
A `<script>` block contains JavaScript (or TypeScript, when adding the `lang="ts"` attribute) that runs when a component instance is created. Variables declared (or imported) at the top level are 'visible' from the component's markup.
2727

@@ -161,7 +161,7 @@ If you'd like to react to changes to a prop, use the `$derived` or `$effect` run
161161

162162
For more information on reactivity, read the documentation around runes.
163163

164-
## &lt;script module&gt;
164+
## `<script module>`
165165

166166
A `<script>` tag with a `module` attribute runs once when the module first evaluates, rather than for each component instance. Values declared in this block are accessible from a regular `<script>` (and the component markup) but not vice versa.
167167

@@ -186,7 +186,7 @@ You cannot `export default`, since the default export is the component itself.
186186
</script>
187187
```
188188

189-
## &lt;style&gt;
189+
## `<style>`
190190

191191
CSS inside a `<style>` block will be scoped to that component.
192192

documentation/docs/02-template-syntax/06-transitions-and-animations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ DOMRect {
312312

313313
An animation is triggered when the contents of a [keyed each block](control-flow#each) are re-ordered. Animations do not run when an element is added or removed, only when the index of an existing data item within the each block changes. Animate directives must be on an element that is an _immediate_ child of a keyed each block.
314314

315-
Animations can be used with Svelte's [built-in animation functions](svelte-animate) or [custom animation functions](#custom-animation-functions).
315+
Animations can be used with Svelte's [built-in animation functions](svelte-animate) or [custom animation functions](#Custom-animation-functions).
316316

317317
```svelte
318318
<!-- When `list` is reordered the animation will run-->

documentation/docs/04-runtime/02-context.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Most state is component-level state that lives as long as its component lives. T
1010
The easiest way to do that is to create global state and just import that.
1111

1212
```ts
13-
/// file: state.svelte.ts
14-
13+
/// file: state.svelte.js
1514
export const myGlobalState = $state({
1615
user: {
1716
/* ... */

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

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,21 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
110110
- [Before](/#H4sIAAAAAAAAE31WXa_bNgz9K6yL1QmWOLlrC-w6H8MeBgwY9tY9NfdBtmlbiywZkpyPBfnvo2zLcZK28AWuRPGI5OGhkEuQc4EmiL9eAskqDOLg97oOZoE9125jDigs0t6oRqfOsjap5rXd7uTO8qpW2sIFEsyVxn_qjFmcAcstar-xPN3DFXKtKgi768IVgQku0ELj3Lgs_kZjWIEGNpAzYXDlHWyJFZI1zJjeh4O5uvl_DY8oUkVeVoFuJKYls-_CGYS25Aboj0EtWNqel0wWoBoLTGZgmdgDS9zW4Uz4NsrswPHoyutN4xInkylstnBxdmIhh8m7xzqmoNE2Wq46n1RJQzEbq4g-JQSl7e-HDx-GdaTy3KD9E3lRWvj5Zu9QX1QN20dj7zyHz8s-1S6lW7Cpz3RnXTcm04hIlfdFuO8p2mQ5-3a06cqjrn559bF_2NHOnRZ5I1PLlXQNyQT-hedMHeUEDyjtdMxsa4n2eIbNhlTwhyRthaOKOmYtniwF6pwt0wXa6MBEg0OibZec27gz_dk3UrZ6hB2LLYoiv521Yd8Gt-foTrfhiCDP0lC9VUUhcDLU49Xe_9943cNvEArHfAjxeBTovvXiNpFynfEDpIIZs9kFbg52QbeNHWZzebz32s7xHco3nJAJl1nshmhz8dYOQJDyZetnbb2gTWe-vEeWlrfpZMavr56ldb29eNt6UXvgwg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WHfxhDP0QkQhnf5PWRnVVkKnIx8fZsOb5dR16nwG4TCCRdCMphWQ7z1_DoOcp3zA2SCGbPZBa5jd0G_TRxmc36Me-mG6A7l60XIlMs8ce2-OXtrDyBItdz6qVjPadObzx-RZdV1nJjx64tXad1sz962njceOHfAzmk9JzrbXqg1lw3NkZL7vgE257t-uMDcO6attSSokpmgFqVMO2U93e_dDlzOUKsc-3t6zNZp6K9cG3sS2KGSUqiUiUmq8tNYoJwbmvpTAoXA96GyjCojI26xNglk6DpwOPm7NdRYp4ia0JL94bTqRiGB5WJxqFY37RGPoz3c6i4jP3rcUA7wmhqNywQW7om_YQ2L4UQdUBdCHSPiOQJ8bFcxHzeK0jKBY0XcV95SkCWlD9t-9eOM3TLKucauiyktJdpaPqT19ddF4wFHntsqgS-_XE01e48GMwnw02AtWZP02QyGVOkcNfk072CU4PkduZSWpVYt9SkcmJ64hPwHpWF5ziVls3wIFmmW89Y83vMeGf5PBxjcyPSkXNy10J18t3x6-a6CDtBq6SGklNKeazFyLahB3PVIGo2UbhOgGi9vKjzW_j6xVFFD17difXx5ebll0vwvkcGpn4sZ9MN3vqFYsJoL6gUuK9TcPrO_PxgzWMRfflSEr2NHPJf6lj1957rRpH8CNMG84JgHidUtXt4u_wK21LXERAgAAA==)
112112

113-
```diff
113+
<!-- prettier-ignore -->
114+
```svelte
114115
<script>
115-
- import { beforeUpdate, afterUpdate, tick } from 'svelte';
116-
+ import { tick } from 'svelte';
116+
import { ---beforeUpdate, afterUpdate,--- tick } from 'svelte';
117117
118-
- let updatingMessages = false;
119-
- let theme = 'dark';
120-
- let messages = [];
121-
+ let theme = $state('dark');
122-
+ let messages = $state([]);
118+
---let updatingMessages = false;---
119+
let theme = +++$state('dark')+++;
120+
let messages = +++$state([])+++;
123121
124122
let viewport;
125123
126-
- beforeUpdate(() => {
127-
+ $effect.pre(() => {
128-
- if (!updatingMessages) return;
129-
+ messages;
124+
---beforeUpdate(() => {---
125+
+++$effect.pre(() => {+++
126+
---if (!updatingMessages) return;---
127+
+++messages;+++
130128
const autoscroll = viewport && viewport.offsetHeight + viewport.scrollTop > viewport.scrollHeight - 50;
131129
132130
if (autoscroll) {
@@ -135,15 +133,15 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
135133
});
136134
}
137135
138-
- updatingMessages = false;
136+
---updatingMessages = false;---
139137
});
140138
141139
function handleKeydown(event) {
142140
if (event.key === 'Enter') {
143141
const text = event.target.value;
144142
if (!text) return;
145143
146-
- updatingMessages = true;
144+
---updatingMessages = true;---
147145
messages = [...messages, text];
148146
event.target.value = '';
149147
}
@@ -161,12 +159,8 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
161159
{/each}
162160
</div>
163161
164-
- <input on:keydown={handleKeydown} />
165-
+ <input onkeydown={handleKeydown} />
162+
<input +++onkeydown+++={handleKeydown} />
166163
167-
- <button on:click={toggle}>
168-
+ <button onclick={toggle}>
169-
Toggle dark mode
170-
</button>
164+
<button +++onclick+++={toggle}> Toggle dark mode </button>
171165
</div>
172166
```

documentation/docs/05-misc/02-testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ npm install -D vitest
1616

1717
Then adjust your `vite.config.js`:
1818

19-
```diff
19+
<!-- prettier-ignore -->
20+
```js
2021
/// file: vite.config.js
21-
- import { defineConfig } from 'vite';
22-
+ import { defineConfig } from 'vitest/config';
22+
import { defineConfig } from +++'vitest/config'+++;
2323

2424
export default defineConfig({ /* ... */ })
2525
```

documentation/docs/05-misc/04-custom-elements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ el.name = 'everybody';
5353

5454
Custom elements are created from Svelte components using a wrapper approach. This means the inner Svelte component has no knowledge that it is a custom element. The custom element wrapper takes care of handling its lifecycle appropriately.
5555

56-
When a custom element is created, the Svelte component it wraps is _not_ created right away. It is only created in the next tick after the `connectedCallback` is invoked. Properties assigned to the custom element before it is inserted into the DOM are temporarily saved and then set on component creation, so their values are not lost. The same does not work for invoking exported functions on the custom element though, they are only available after the element has mounted. If you need to invoke functions before component creation, you can work around it by using the [`extend` option](#component-options).
56+
When a custom element is created, the Svelte component it wraps is _not_ created right away. It is only created in the next tick after the `connectedCallback` is invoked. Properties assigned to the custom element before it is inserted into the DOM are temporarily saved and then set on component creation, so their values are not lost. The same does not work for invoking exported functions on the custom element though, they are only available after the element has mounted. If you need to invoke functions before component creation, you can work around it by using the [`extend` option](#Component-options).
5757

5858
When a custom element written with Svelte is created or updated, the shadow DOM will reflect the value in the next tick, not immediately. This way updates can be batched, and DOM moves which temporarily (but synchronously) detach the element from the DOM don't lead to unmounting the inner component.
5959

0 commit comments

Comments
 (0)