Skip to content

Commit d160b19

Browse files
Sync svelte docs (sveltejs#1104)
sync svelte docs Co-authored-by: Rich-Harris <[email protected]>
1 parent 78f401b commit d160b19

File tree

6 files changed

+15
-57
lines changed

6 files changed

+15
-57
lines changed

apps/svelte.dev/content/docs/svelte/03-template-syntax/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ The `{@const ...}` tag defines a local constant.
1212
{/each}
1313
```
1414

15-
`{@const}` is only allowed as an immediate child of a block — `{#if ...}`, `{#each ...}`, `{#snippet ...}` and so on — or a `<Component />`.
15+
`{@const}` is only allowed as an immediate child of a block — `{#if ...}`, `{#each ...}`, `{#snippet ...}` and so on — a `<Component />` or a `<svelte:boundary`.

apps/svelte.dev/content/docs/svelte/03-template-syntax/18-class.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ The user of this component has the same flexibility to use a mixture of objects,
7272
</Button>
7373
```
7474

75+
Svelte also exposes the `ClassValue` type, which is the type of value that the `class` attribute on elements accept. This is useful if you want to use a type-safe class name in component props:
76+
77+
```svelte
78+
<script lang="ts">
79+
import type { ClassValue } from 'svelte/elements';
80+
81+
const props: { class: ClassValue } = $props();
82+
</script>
83+
84+
<div class={['original', props.class]}>...</div>
85+
```
86+
7587
## The `class:` directive
7688

7789
Prior to Svelte 5.16, the `class:` directive was the most convenient way to set classes on elements conditionally.

apps/svelte.dev/content/docs/svelte/98-reference/.generated/compile-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Cyclical dependency detected: %cycle%
187187
### const_tag_invalid_placement
188188

189189
```
190-
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>` or `<Component>`
190+
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
191191
```
192192

193193
### constant_assignment

apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-motion.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,6 @@ set target(v: T);
252252
get target(): T;
253253
```
254254

255-
<div class="ts-block-property-details"></div>
256-
</div>
257-
258-
<div class="ts-block-property">
259-
260-
```dts
261-
#private;
262-
```
263-
264255
<div class="ts-block-property-details"></div>
265256
</div></div>
266257

apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-reactivity.md

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,6 @@ class SvelteDate extends Date {/*…*/}
101101
constructor(...params: any[]);
102102
```
103103

104-
<div class="ts-block-property-details"></div>
105-
</div>
106-
107-
<div class="ts-block-property">
108-
109-
```dts
110-
#private;
111-
```
112-
113104
<div class="ts-block-property-details"></div>
114105
</div></div>
115106

@@ -138,15 +129,6 @@ constructor(value?: Iterable<readonly [K, V]> | null | undefined);
138129
set(key: K, value: V): this;
139130
```
140131

141-
<div class="ts-block-property-details"></div>
142-
</div>
143-
144-
<div class="ts-block-property">
145-
146-
```dts
147-
#private;
148-
```
149-
150132
<div class="ts-block-property-details"></div>
151133
</div></div>
152134

@@ -175,15 +157,6 @@ constructor(value?: Iterable<T> | null | undefined);
175157
add(value: T): this;
176158
```
177159

178-
<div class="ts-block-property-details"></div>
179-
</div>
180-
181-
<div class="ts-block-property">
182-
183-
```dts
184-
#private;
185-
```
186-
187160
<div class="ts-block-property-details"></div>
188161
</div></div>
189162

@@ -203,15 +176,6 @@ class SvelteURL extends URL {/*…*/}
203176
get searchParams(): SvelteURLSearchParams;
204177
```
205178

206-
<div class="ts-block-property-details"></div>
207-
</div>
208-
209-
<div class="ts-block-property">
210-
211-
```dts
212-
#private;
213-
```
214-
215179
<div class="ts-block-property-details"></div>
216180
</div></div>
217181

@@ -231,15 +195,6 @@ class SvelteURLSearchParams extends URLSearchParams {/*…*/}
231195
[REPLACE](params: URLSearchParams): void;
232196
```
233197

234-
<div class="ts-block-property-details"></div>
235-
</div>
236-
237-
<div class="ts-block-property">
238-
239-
```dts
240-
#private;
241-
```
242-
243198
<div class="ts-block-property-details"></div>
244199
</div></div>
245200

apps/svelte.dev/content/docs/svelte/98-reference/30-compiler-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Cyclical dependency detected: %cycle%
192192
### const_tag_invalid_placement
193193

194194
```
195-
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>` or `<Component>`
195+
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
196196
```
197197

198198
### constant_assignment

0 commit comments

Comments
 (0)