Skip to content

Commit 5ee3ae4

Browse files
authored
update diffs (#13575)
* update diffs * gah * fix
1 parent 3f0b41b commit 5ee3ae4

File tree

5 files changed

+42
-43
lines changed

5 files changed

+42
-43
lines changed

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_9943cNvEArHfAjxeBTovvXiNpFynfEDpIIZs9kFbg52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QjHceys8R7PMFms4HwD2lRhzeEe-EsvluSrHe2TJdo4wMTLY48XKwPzm0KGm2r5ajFtRYU4TWOY7-ddWHfxhDP0QkQhnf5PWRnVVkKnIx8fZsOb5dR16nwG4TCCRdCMphWQ7z1_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/98-reference/.generated/compile-warnings.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,24 +774,27 @@ In some cases `<object.property>` syntax can be used as a replacement; a lowerca
774774

775775
For complex component resolution logic, an intermediary, capitalized variable may be necessary. E.g. in places where `@const` can be used:
776776

777-
```diff
777+
<!-- prettier-ignore -->
778+
```svelte
778779
{#each items as item}
779-
- <svelte:component this={item.condition ? Y : Z} />
780-
+ {@const Component = item.condition ? Y : Z}
781-
+ <Component />
780+
---<svelte:component this={item.condition ? Y : Z} />---
781+
+++{@const Component = item.condition ? Y : Z}+++
782+
+++<Component />+++
782783
{/each}
783784
```
784785

785786
A derived value may be used in other contexts:
786787

787-
```diff
788+
<!-- prettier-ignore -->
789+
```svelte
788790
<script>
789-
...
791+
// ...
790792
let condition = $state(false);
791-
+ const Component = $derived(condition ? Y : Z);
793+
+++const Component = $derived(condition ? Y : Z);+++
792794
</script>
793-
- <svelte:component this={condition ? Y : Z} />
794-
+ <Component />
795+
796+
---<svelte:component this={condition ? Y : Z} />---
797+
+++<Component />+++
795798
```
796799

797800
### svelte_element_invalid_this

packages/svelte/messages/compile-warnings/template.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,27 @@ In some cases `<object.property>` syntax can be used as a replacement; a lowerca
7474

7575
For complex component resolution logic, an intermediary, capitalized variable may be necessary. E.g. in places where `@const` can be used:
7676

77-
```diff
77+
<!-- prettier-ignore -->
78+
```svelte
7879
{#each items as item}
79-
- <svelte:component this={item.condition ? Y : Z} />
80-
+ {@const Component = item.condition ? Y : Z}
81-
+ <Component />
80+
---<svelte:component this={item.condition ? Y : Z} />---
81+
+++{@const Component = item.condition ? Y : Z}+++
82+
+++<Component />+++
8283
{/each}
8384
```
8485

8586
A derived value may be used in other contexts:
8687

87-
```diff
88+
<!-- prettier-ignore -->
89+
```svelte
8890
<script>
89-
...
91+
// ...
9092
let condition = $state(false);
91-
+ const Component = $derived(condition ? Y : Z);
93+
+++const Component = $derived(condition ? Y : Z);+++
9294
</script>
93-
- <svelte:component this={condition ? Y : Z} />
94-
+ <Component />
95+
96+
---<svelte:component this={condition ? Y : Z} />---
97+
+++<Component />+++
9598
```
9699

97100
## svelte_element_invalid_this

0 commit comments

Comments
 (0)