Skip to content

Commit 8b63b6e

Browse files
Sync svelte docs (#1014)
sync svelte docs Co-authored-by: Rich-Harris <[email protected]>
1 parent 09b9b2c commit 8b63b6e

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

apps/svelte.dev/content/docs/svelte/06-runtime/04-imperative-component-api.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,22 @@ Note that unlike calling `new App(...)` in Svelte 4, things like effects (includ
3434

3535
## `unmount`
3636

37-
Unmounts a component created with [`mount`](#mount) or [`hydrate`](#hydrate):
37+
Unmounts a component that was previously created with [`mount`](#mount) or [`hydrate`](#hydrate).
38+
39+
If `options.outro` is `true`, [transitions](transition) will play before the component is removed from the DOM:
3840

3941
```js
40-
// @errors: 1109
4142
import { mount, unmount } from 'svelte';
4243
import App from './App.svelte';
4344

44-
const app = mount(App, {...});
45+
const app = mount(App, { target: document.body });
4546

4647
// later
47-
unmount(app);
48+
unmount(app, { outro: true });
4849
```
4950

51+
Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise.
52+
5053
## `render`
5154

5255
Only available on the server and when compiling with the `server` option. Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app:

apps/svelte.dev/content/docs/svelte/98-reference/20-svelte.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,32 @@ function tick(): Promise<void>;
477477

478478
Unmounts a component that was previously mounted using `mount` or `hydrate`.
479479

480+
Since 5.13.0, if `options.outro` is `true`, [transitions](/docs/svelte/transition) will play before the component is removed from the DOM.
481+
482+
Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).
483+
484+
```js
485+
// @errors: 7031
486+
import { mount, unmount } from 'svelte';
487+
import App from './App.svelte';
488+
489+
const app = mount(App, { target: document.body });
490+
491+
// later...
492+
unmount(app, { outro: true });
493+
```
494+
480495
<div class="ts-block">
481496

482497
```dts
483-
function unmount(component: Record<string, any>): void;
498+
function unmount(
499+
component: Record<string, any>,
500+
options?:
501+
| {
502+
outro?: boolean;
503+
}
504+
| undefined
505+
): Promise<void>;
484506
```
485507

486508
</div>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function parse(
111111
options: {
112112
filename?: string;
113113
modern: true;
114+
loose?: boolean;
114115
}
115116
): AST.Root;
116117
```
@@ -126,6 +127,7 @@ function parse(
126127
| {
127128
filename?: string;
128129
modern?: false;
130+
loose?: boolean;
129131
}
130132
| undefined
131133
): Record<string, any>;

0 commit comments

Comments
 (0)