Skip to content

Commit 1f8a6c7

Browse files
committed
update diffs
1 parent 3f0b41b commit 1f8a6c7

File tree

5 files changed

+34
-43
lines changed

5 files changed

+34
-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: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,20 @@ 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_9943cNvEArHfAjxeBTovvXiNpFynfEDpIIZs9kFbg52QbeNHWZzebz32s7xHco3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lRhzeEe-EsvluSrHe2TJdo4wMTLY48XKwPzm0KGm2r5ajFtRYU4TWOY7-ddWHfxhDP0QkQhnf5PWRnVVkKnIx8fZsOb5dR16nwG4TCCRdCMphWQ7z1_DoOcp3zA2SCGbPZBa5jd0G_TRxmc36Me-mG6A7l60XIlMs8ce2-OXtrDyBItdz6qVjPadObzx-RZdV1nJjx64tXad1sz962njceOHfAzmk9JzrbXqg1lw3NkZL7vgE257t-uMDcO6attSSokpmgFqVMO2U93e_dDlzOUKsc-3t6zNZp6K9cG3sS2KGSUqiUiUmq8tNYoJwbmvpTAoXA96GyjCojI26xNglk6DpwOPm7NdRYp4ia0JL94bTqRiGB5WJxqFY37RGPoz3c6i4jP3rcUA7wmhqNywQW7om_YQ2L4UQdUBdCHSPiOQJ8bFcxHzeK0jKBY0XcV95SkCWlD9t-9eOM3TLKucauiyktJdpaPqT19ddF4wFHntsqgS-_XE01e48GMwnw02AtWZP02QyGVOkcNfk072CU4PkduZSWpVYt9SkcmJ64hPwHpWF5ziVls3wIFmmW89Y83vMeGf5PBxjcyPSkXNy10J18t3x6-a6CDtBq6SGklNKeazFyLahB3PVIGo2UbhOgGi9vKjzW_j6xVFFD17difXx5ebll0vwvkcGpn4sZ9MN3vqFYsJoL6gUuK9TcPrO_PxgzWMRfflSEr2NHPJf6lj1957rRpH8CNMG84JgHidUtXt4u_wK21LXERAgAAA==)
112112

113-
```diff
113+
```svelte
114114
<script>
115-
- import { beforeUpdate, afterUpdate, tick } from 'svelte';
116-
+ import { tick } from 'svelte';
115+
import { ---beforeUpdate, afterUpdate,--- tick } from 'svelte';
117116
118-
- let updatingMessages = false;
119-
- let theme = 'dark';
120-
- let messages = [];
121-
+ let theme = $state('dark');
122-
+ let messages = $state([]);
117+
---let updatingMessages = false;---
118+
let theme = +++$state('dark')+++;
119+
let messages = +++$state([])+++;
123120
124121
let viewport;
125122
126-
- beforeUpdate(() => {
127-
+ $effect.pre(() => {
128-
- if (!updatingMessages) return;
129-
+ messages;
123+
---beforeUpdate(() => {---
124+
+++$effect.pre(() => {+++
125+
---if (!updatingMessages) return;---
126+
+++messages;+++
130127
const autoscroll = viewport && viewport.offsetHeight + viewport.scrollTop > viewport.scrollHeight - 50;
131128
132129
if (autoscroll) {
@@ -135,15 +132,15 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
135132
});
136133
}
137134
138-
- updatingMessages = false;
135+
---updatingMessages = false;---
139136
});
140137
141138
function handleKeydown(event) {
142139
if (event.key === 'Enter') {
143140
const text = event.target.value;
144141
if (!text) return;
145142
146-
- updatingMessages = true;
143+
---updatingMessages = true;---
147144
messages = [...messages, text];
148145
event.target.value = '';
149146
}
@@ -161,12 +158,8 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
161158
{/each}
162159
</div>
163160
164-
- <input on:keydown={handleKeydown} />
165-
+ <input onkeydown={handleKeydown} />
161+
<input +++onkeydown+++={handleKeydown} />
166162
167-
- <button on:click={toggle}>
168-
+ <button onclick={toggle}>
169-
Toggle dark mode
170-
</button>
163+
<button +++onclick+++={toggle}> Toggle dark mode </button>
171164
</div>
172165
```

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

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

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

19-
```diff
19+
```js
2020
/// file: vite.config.js
21-
- import { defineConfig } from 'vite';
22-
+ import { defineConfig } from 'vitest/config';
21+
import { defineConfig } from +++'vitest/config'+++;
2322

2423
export default defineConfig({ /* ... */ })
2524
```

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,24 +774,24 @@ 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+
```svelte
778778
{#each items as item}
779-
- <svelte:component this={item.condition ? Y : Z} />
780-
+ {@const Component = item.condition ? Y : Z}
781-
+ <Component />
779+
---<svelte:component this={item.condition ? Y : Z} />---
780+
+++{@const Component = item.condition ? Y : Z}+++
781+
+++<Component />+++
782782
{/each}
783783
```
784784

785785
A derived value may be used in other contexts:
786786

787-
```diff
787+
```svelte
788788
<script>
789-
...
789+
// ...
790790
let condition = $state(false);
791-
+ const Component = $derived(condition ? Y : Z);
791+
+++const Component = $derived(condition ? Y : Z);+++
792792
</script>
793-
- <svelte:component this={condition ? Y : Z} />
794-
+ <Component />
793+
---<svelte:component this={condition ? Y : Z} />---
794+
+++<Component />+++
795795
```
796796

797797
### svelte_element_invalid_this

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,24 @@ 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+
```svelte
7878
{#each items as item}
79-
- <svelte:component this={item.condition ? Y : Z} />
80-
+ {@const Component = item.condition ? Y : Z}
81-
+ <Component />
79+
---<svelte:component this={item.condition ? Y : Z} />---
80+
+++{@const Component = item.condition ? Y : Z}+++
81+
+++<Component />+++
8282
{/each}
8383
```
8484

8585
A derived value may be used in other contexts:
8686

87-
```diff
87+
```svelte
8888
<script>
89-
...
89+
// ...
9090
let condition = $state(false);
91-
+ const Component = $derived(condition ? Y : Z);
91+
+++const Component = $derived(condition ? Y : Z);+++
9292
</script>
93-
- <svelte:component this={condition ? Y : Z} />
94-
+ <Component />
93+
---<svelte:component this={condition ? Y : Z} />---
94+
+++<Component />+++
9595
```
9696

9797
## svelte_element_invalid_this

0 commit comments

Comments
 (0)