diff --git a/documentation/docs/01-getting-started/meta.json b/documentation/docs/01-getting-started/meta.json
deleted file mode 100644
index 345e69a3c2..0000000000
--- a/documentation/docs/01-getting-started/meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "title": "Getting Started"
-}
diff --git a/documentation/docs/01-introduction/01-overview.md b/documentation/docs/01-introduction/01-overview.md
new file mode 100644
index 0000000000..a0901b9518
--- /dev/null
+++ b/documentation/docs/01-introduction/01-overview.md
@@ -0,0 +1,30 @@
+---
+title: Overview
+---
+
+- Short intro to what Svelte is and why it's the best ever
+- A few code examples to have a very rough understanding of how Svelte code looks like
+- Jump off points to tutorial, SvelteKit etc
+
+Svelte is a web UI framework that uses a compiler to turn declarative component code like this...
+
+```svelte
+
+
+
+
+ clicks: {count}
+
+```
+
+...into tightly optimized JavaScript that updates the document when state like count changes. Because the compiler can 'see' where count is referenced, the generated code is highly efficient, and because we're hijacking syntax like `$state(...)` and `=` instead of using cumbersome APIs, you can write less code.
+
+Besides being fun to work with, Svelte offers a lot of features built-in, such as animations and transitions. Once you've written your first components you can reach for our batteries included metaframework [SvelteKit](/docs/kit) which provides you with an opinionated router, data loading and more.
+
+If you're new to Svelte, visit the [interactive tutorial](/tutorial) before consulting this documentation. You can try Svelte online using the [REPL](/repl). Alternatively, if you'd like a more fully-featured environment, you can try Svelte on [StackBlitz](https://sveltekit.new).
diff --git a/documentation/docs/01-getting-started/01-introduction.md b/documentation/docs/01-introduction/02-getting-started.md
similarity index 52%
rename from documentation/docs/01-getting-started/01-introduction.md
rename to documentation/docs/01-introduction/02-getting-started.md
index 8d3c41ce1a..0f896abe18 100644
--- a/documentation/docs/01-getting-started/01-introduction.md
+++ b/documentation/docs/01-introduction/02-getting-started.md
@@ -1,10 +1,11 @@
---
-title: Introduction
+title: Getting started
---
-Welcome to the Svelte reference documentation! This is intended as a resource for people who already have some familiarity with Svelte and want to learn more about using it.
-
-If that's not you (yet), you may prefer to visit the [interactive tutorial](https://learn.svelte.dev) or the [examples](/examples) before consulting this reference. You can try Svelte online using the [REPL](/repl). Alternatively, if you'd like a more fully-featured environment, you can try Svelte on [StackBlitz](https://sveltekit.new).
+- `npm create svelte@latest`, describe that it scaffolds SvelteKit project
+- `npm create vite@latest`, describe that it scaffolds Svelte SPA powered by Vite
+- mention `svelte-add`
+- Jump off points to tutorial, SvelteKit etc
## Start a new project
@@ -19,15 +20,19 @@ npm run dev
SvelteKit will handle calling [the Svelte compiler](https://www.npmjs.com/package/svelte) to convert your `.svelte` files into `.js` files that create the DOM and `.css` files that style it. It also provides all the other pieces you need to build a web application such as a development server, routing, deployment, and SSR support. [SvelteKit](https://kit.svelte.dev/) uses [Vite](https://vitejs.dev/) to build your code.
+Don't worry if you don't know Svelte yet! You can ignore all the nice features SvelteKit brings on top for now and dive into it later.
+
### Alternatives to SvelteKit
-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. In most cases, you will probably need to [choose a routing library](/faq#is-there-a-router) as well.
+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.
-Alternatively, there are [plugins for all the major web bundlers](https://sveltesociety.dev/tools#bundling) to handle Svelte compilation — which will output `.js` and `.css` that you can insert into your HTML — but most others won't handle SSR.
+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.
## Editor tooling
-The Svelte team maintains a [VS Code extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) and there are integrations with various other [editors](https://sveltesociety.dev/tools#editor-support) and tools as well.
+The Svelte team maintains a [VS Code extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) and there are integrations with various other [editors](https://sveltesociety.dev/resources#editor-support) and tools as well.
+
+You can also check your code from the command line using [svelte-check](https://www.npmjs.com/package/svelte-check) (using the Svelte or Vite CLI setup will install this for you).
## Getting help
diff --git a/documentation/docs/01-introduction/03-reactivity-fundamentals.md b/documentation/docs/01-introduction/03-reactivity-fundamentals.md
new file mode 100644
index 0000000000..0f1c8e0799
--- /dev/null
+++ b/documentation/docs/01-introduction/03-reactivity-fundamentals.md
@@ -0,0 +1,88 @@
+---
+title: Reactivity fundamentals
+---
+
+Reactivity is at the heart of interactive UIs. When you click a button, you expect some kind of response. It's your job as a developer to make this happen. It's Svelte's job to make your job as intuitive as possible, by providing a good API to express reactive systems.
+
+## Runes
+
+Svelte 5 uses _runes_, a powerful set of primitives for controlling reactivity inside your Svelte components and inside `.svelte.js` and `.svelte.ts` modules.
+
+Runes are function-like symbols that provide instructions to the Svelte compiler. You don't need to import them from anywhere — when you use Svelte, they're part of the language.
+
+The following sections introduce the most important runes for declare state, derived state and side effects at a high level. For more details refer to the later sections on [state](/docs/svelte/runes/state) and [side effects](/docs/svelte/runes/side-effects).
+
+## `$state`
+
+Reactive state is declared with the `$state` rune:
+
+```svelte
+
+
+ count++}>
+ clicks: {count}
+
+```
+
+You can also use `$state` in class fields (whether public or private):
+
+```js
+// @errors: 7006 2554
+class Todo {
+ done = $state(false);
+ text = $state();
+
+ constructor(text) {
+ this.text = text;
+ }
+}
+```
+
+## `$derived`
+
+Derived state is declared with the `$derived` rune:
+
+```svelte
+
+
+ count++}>
+ {doubled}
+
+
+
{count} doubled is {doubled}
+```
+
+The expression inside `$derived(...)` should be free of side-effects. Svelte will disallow state changes (e.g. `count++`) inside derived expressions.
+
+As with `$state`, you can mark class fields as `$derived`.
+
+## `$effect`
+
+To run _side-effects_ when the component is mounted to the DOM, and when values change, we can use the `$effect` rune ([demo](/#H4sIAAAAAAAAE31T24rbMBD9lUG7kAQ2sbdlX7xOYNk_aB_rQhRpbAsU2UiTW0P-vbrYubSlYGzmzMzROTPymdVKo2PFjzMzfIusYB99z14YnfoQuD1qQh-7bmdFQEonrOppVZmKNBI49QthCc-OOOH0LZ-9jxnR6c7eUpOnuv6KeT5JFdcqbvbcBcgDz1jXKGg6ncFyBedYR6IzLrAZwiN5vtSxaJA-EzadfJEjKw11C6GR22-BLH8B_wxdByWpvUYtqqal2XB6RVkG1CoHB6U1WJzbnYFDiwb3aGEdDa3Bm1oH12sQLTcNPp7r56m_00mHocSG97_zd7ICUXonA5fwKbPbkE2ZtMJGGVkEdctzQi4QzSwr9prnFYNk5hpmqVuqPQjNnfOJoMF22lUsrq_UfIN6lfSVyvQ7grB3X2mjMZYO3XO9w-U5iLx42qg29md3BP_ni5P4gy9ikTBlHxjLzAtPDlyYZmRdjAbGq7HprEQ7p64v4LU_guu0kvAkhBim3nMplWl8FreQD-CW20aZR0wq12t-KqDWeBywhvexKC3memmDwlHAv9q4Vo2ZK8KtK0CgX7u9J8wXbzdKv-nRnfF_2baTqlYoWUF2h5efl9-n0O6koAMAAA==)):
+
+```svelte
+
+
+
+```
+
+The function passed to `$effect` will run when the component mounts, and will re-run after any changes to the values it reads that were declared with `$state` or `$derived` (including those passed in with `$props`). Re-runs are batched (i.e. changing `color` and `size` in the same moment won't cause two separate runs), and happen after any DOM updates have been applied.
diff --git a/documentation/docs/01-introduction/index.md b/documentation/docs/01-introduction/index.md
new file mode 100644
index 0000000000..8f14f7a7c9
--- /dev/null
+++ b/documentation/docs/01-introduction/index.md
@@ -0,0 +1,3 @@
+---
+title: Introduction
+---
diff --git a/documentation/docs/02-template-syntax/01-component-fundamentals.md b/documentation/docs/02-template-syntax/01-component-fundamentals.md
new file mode 100644
index 0000000000..5e4d78e59a
--- /dev/null
+++ b/documentation/docs/02-template-syntax/01-component-fundamentals.md
@@ -0,0 +1,184 @@
+---
+title: Component fundamentals
+---
+
+- script (module) / template / style (rough overview)
+- `$props` / `$state` (in the context of components)
+
+Components are the building blocks of Svelte applications. They are written into `.svelte` files, using a superset of HTML.
+
+All three sections — script, styles and markup — are optional.
+
+```svelte
+
+
+
+
+
+```
+
+## <script>
+
+A `
+```
+
+You can specify a fallback value for a prop. It will be used if the component's consumer doesn't specify the prop on the component when instantiating the component, or if the passed value is `undefined` at some point.
+
+```svelte
+
+```
+
+To get all properties, use rest syntax:
+
+```svelte
+
+```
+
+You can use reserved words as prop names.
+
+```svelte
+
+```
+
+If you're using TypeScript, you can declare the prop types:
+
+```svelte
+
+```
+
+If you export a `const`, `class` or `function`, it is readonly from outside the component.
+
+```svelte
+
+```
+
+Readonly props can be accessed as properties on the element, tied to the component using [`bind:this` syntax](/docs/component-directives#bind-this).
+
+### Reactive variables
+
+To change component state and trigger a re-render, just assign to a locally declared variable that was declared using the `$state` rune.
+
+Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect.
+
+```svelte
+
+```
+
+Svelte's `
+```
+
+If you'd like to react to changes to a prop, use the `$derived` or `$effect` runes instead.
+
+```svelte
+
+```
+
+For more information on reactivity, read the documentation around runes.
+
+## <script context="module">
+
+A `
+
+
+```
+
+## <style>
+
+CSS inside a `
+```
+
+For more information regarding styling, read the documentation around [styles and classes](styles-and-classes).
diff --git a/documentation/docs/02-template-syntax/01-svelte-components.md b/documentation/docs/02-template-syntax/01-svelte-components.md
deleted file mode 100644
index e05a90a4c4..0000000000
--- a/documentation/docs/02-template-syntax/01-svelte-components.md
+++ /dev/null
@@ -1,350 +0,0 @@
----
-title: Svelte components
----
-
-Components are the building blocks of Svelte applications. They are written into `.svelte` files, using a superset of HTML.
-
-All three sections — script, styles and markup — are optional.
-
-```svelte
-
-
-
-
-
-```
-
-## <script>
-
-A `
-```
-
-You can specify a default initial value for a prop. It will be used if the component's consumer doesn't specify the prop on the component (or if its initial value is `undefined`) when instantiating the component. Note that if the values of props are subsequently updated, then any prop whose value is not specified will be set to `undefined` (rather than its initial value).
-
-In development mode (see the [compiler options](/docs/svelte-compiler#compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
-
-```svelte
-
-```
-
-If you export a `const`, `class` or `function`, it is readonly from outside the component. Functions are valid prop values, however, as shown below.
-
-```svelte
-
-
-```
-
-Readonly props can be accessed as properties on the element, tied to the component using [`bind:this` syntax](/docs/component-directives#bind-this).
-
-You can use reserved words as prop names.
-
-```svelte
-
-
-```
-
-### 2. Assignments are 'reactive'
-
-To change component state and trigger a re-render, just assign to a locally declared variable.
-
-Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect.
-
-```svelte
-
-```
-
-Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates. A subsequent assignment is required to trigger the update. This and more details can also be found in the [tutorial](https://learn.svelte.dev/tutorial/updating-arrays-and-objects).
-
-```svelte
-
-```
-
-Svelte's `
-```
-
-### 3. `$:` marks a statement as reactive
-
-Any top-level statement (i.e. not inside a block or a function) can be made reactive by prefixing it with the `$:` [JS label syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label). Reactive statements run after other script code and before the component markup is rendered, whenever the values that they depend on have changed.
-
-```svelte
-
-```
-
-Only values which directly appear within the `$:` block will become dependencies of the reactive statement. For example, in the code below `total` will only update when `x` changes, but not `y`.
-
-```svelte
-
-
-
-Total: {total}
- x++}> Increment X
-
- y++}> Increment Y
-```
-
-It is important to note that the reactive blocks are ordered via simple static analysis at compile time, and all the compiler looks at are the variables that are assigned to and used within the block itself, not in any functions called by them. This means that `yDependent` will not be updated when `x` is updated in the following example:
-
-```svelte
-
-```
-
-Moving the line `$: yDependent = y` below `$: setY(x)` will cause `yDependent` to be updated when `x` is updated.
-
-If a statement consists entirely of an assignment to an undeclared variable, Svelte will inject a `let` declaration on your behalf.
-
-```svelte
-
-
-```
-
-### 4. Prefix stores with `$` to access their values
-
-A _store_ is an object that allows reactive access to a value via a simple _store contract_. The [`svelte/store` module](/docs/svelte-store) contains minimal store implementations which fulfil this contract.
-
-Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, subscribe to the store at component initialisation and unsubscribe when appropriate.
-
-Assignments to `$`-prefixed variables require that the variable be a writable store, and will result in a call to the store's `.set` method.
-
-Note that the store must be declared at the top level of the component — not inside an `if` block or a function, for example.
-
-Local variables (that do not represent store values) must _not_ have a `$` prefix.
-
-```svelte
-
-```
-
-#### Store contract
-
-```ts
-// @noErrors
-store = { subscribe: (subscription: (value: any) => void) => (() => void), set?: (value: any) => void }
-```
-
-You can create your own stores without relying on [`svelte/store`](/docs/svelte-store), by implementing the _store contract_:
-
-1. A store must contain a `.subscribe` method, which must accept as its argument a subscription function. This subscription function must be immediately and synchronously called with the store's current value upon calling `.subscribe`. All of a store's active subscription functions must later be synchronously called whenever the store's value changes.
-2. The `.subscribe` method must return an unsubscribe function. Calling an unsubscribe function must stop its subscription, and its corresponding subscription function must not be called again by the store.
-3. A store may _optionally_ contain a `.set` method, which must accept as its argument a new value for the store, and which synchronously calls all of the store's active subscription functions. Such a store is called a _writable store_.
-
-For interoperability with RxJS Observables, the `.subscribe` method is also allowed to return an object with an `.unsubscribe` method, rather than return the unsubscription function directly. Note however that unless `.subscribe` synchronously calls the subscription (which is not required by the Observable spec), Svelte will see the value of the store as `undefined` until it does.
-
-## <script context="module">
-
-A `
-
-
-```
-
-## <style>
-
-CSS inside a `
-```
-
-To apply styles to a selector globally, use the `:global(...)` modifier.
-
-```svelte
-
-```
-
-If you want to make @keyframes that are accessible globally, you need to prepend your keyframe names with `-global-`.
-
-The `-global-` part will be removed when compiled, and the keyframe will then be referenced using just `my-animation-name` elsewhere in your code.
-
-```svelte
-
-```
-
-There should only be 1 top-level `
-
-```
diff --git a/documentation/docs/02-template-syntax/02-basic-markup.md b/documentation/docs/02-template-syntax/02-basic-markup.md
index e6192230d4..9a002bf5a7 100644
--- a/documentation/docs/02-template-syntax/02-basic-markup.md
+++ b/documentation/docs/02-template-syntax/02-basic-markup.md
@@ -2,6 +2,8 @@
title: Basic markup
---
+- [basically what we have in the Svelte docs today](https://svelte.dev/docs/basic-markup)
+
## Tags
A lowercase tag, like ``, denotes a regular HTML element. A capitalised tag, such as `
` or ``, indicates a _component_.
@@ -54,7 +56,7 @@ All other attributes are included unless their value is [nullish](https://develo
This div has no title attribute
```
-An expression might include characters that would cause syntax highlighting to fail in regular HTML, so quoting the value is permitted. The quotes do not affect how the value is parsed:
+Quoting a singular expression does not affect how the value is parsed yet, but in Svelte 6 it will:
```svelte
@@ -86,23 +88,62 @@ An element or component can have multiple spread attributes, interspersed with r
```
-`$$props` references all props that are passed to a component, including ones that are not declared with `export`. Using `$$props` will not perform as well as references to a specific prop because changes to any prop will cause Svelte to recheck all usages of `$$props`. But it can be useful in some cases – for example, when you don't know at compile time what props might be passed to a component.
+> The `value` attribute of an `input` element or its children `option` elements must not be set with spread attributes when using `bind:group` or `bind:checked`. Svelte needs to be able to see the element's `value` directly in the markup in these cases so that it can link it to the bound variable.
-```svelte
-
-```
+> Sometimes, the attribute order matters as Svelte sets attributes sequentially in JavaScript. For example, ` `, Svelte will attempt to set the value to `1` (rounding up from 0.5 as the step by default is 1), and then set the step to `0.1`. To fix this, change it to ` `.
+
+> Another example is ` `. Svelte will set the img `src` before making the img element `loading="lazy"`, which is probably too late. Change this to ` ` to make the image lazily loaded.
-`$$restProps` contains only the props which are _not_ declared with `export`. It can be used to pass down other unknown attributes to an element in a component. It shares the same performance characteristics compared to specific property access as `$$props`.
+## Events
+
+Listening to DOM events is possible by adding attributes to the element that start with `on`. For example, to listen to the `click` event, add the `onclick` attribute to a button:
```svelte
-
+ console.log('clicked')}>click me
```
-> The `value` attribute of an `input` element or its children `option` elements must not be set with spread attributes when using `bind:group` or `bind:checked`. Svelte needs to be able to see the element's `value` directly in the markup in these cases so that it can link it to the bound variable.
+Event attributes are case sensitive. `onclick` listens to the `click` event, `onClick` listens to the `Click` event, which is different. This ensures you can listen to custom events that have uppercase characters in them.
-> Sometimes, the attribute order matters as Svelte sets attributes sequentially in JavaScript. For example, ` `, Svelte will attempt to set the value to `1` (rounding up from 0.5 as the step by default is 1), and then set the step to `0.1`. To fix this, change it to ` `.
+Because events are just attributes, the same rules as for attributes apply:
-> Another example is ` `. Svelte will set the img `src` before making the img element `loading="lazy"`, which is probably too late. Change this to ` ` to make the image lazily loaded.
+- you can use the shorthand form: `click me `
+- you can spread them: `click me `
+- component events are just (callback) properties and don't need a separate concept
+
+### Event delegation
+
+To reduce the memory footprint and increase performance, Svelte uses a technique called event delegation. This means that certain events are only listened to once at the application root, invoking a handler that then traverses the event call path and invokes listeners along the way.
+
+There are a few gotchas you need to be aware of when it comes to event delegation:
+
+- when you dispatch events manually, make sure to set the `{ bubbles: true }` option
+- when listening to events programmatically (i.e. not through `` but through `node.addEventListener`), be careful to not call `stopPropagation` or else the delegated event handler won't be reached and handlers won't be invoked. For this reaon it's best to use `on` (which properly handles `stopPropagation`) from `svelte/events` instead of `addEventListener` to make sure the chain of events is preserved
+
+The following events are delegated:
+
+- `beforeinput`
+- `click`
+- `change`
+- `dblclick`
+- `contextmenu`
+- `focusin`
+- `focusout`
+- `input`
+- `keydown`
+- `keyup`
+- `mousedown`
+- `mousemove`
+- `mouseout`
+- `mouseover`
+- `mouseup`
+- `pointerdown`
+- `pointermove`
+- `pointerout`
+- `pointerover`
+- `pointerup`
+- `touchend`
+- `touchmove`
+- `touchstart`
## Text expressions
@@ -114,7 +155,7 @@ A JavaScript expression can be included as text by surrounding it with curly bra
Curly braces can be included in a Svelte template by using their [HTML entity](https://developer.mozilla.org/docs/Glossary/Entity) strings: `{`, `{`, or `{` for `{` and `}`, `}`, or `}` for `}`.
-> If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.
+If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.
```svelte
@@ -124,6 +165,14 @@ Curly braces can be included in a Svelte template by using their [HTML entity](h
{(/^[A-Za-z ]+$/).test(value) ? x : y}
```
+The expression will be stringified and escaped to prevent code injections. If you want to render HTML, use the `{@html}` tag instead.
+
+```svelte
+{@html potentiallyUnsafeHtmlString}
+```
+
+> Make sure that you either escape the passed string or only populate it with values that are under your control in order to prevent [XSS attacks](https://owasp.org/www-community/attacks/xss/)
+
## Comments
You can use HTML comments inside components.
@@ -138,3 +187,26 @@ Comments beginning with `svelte-ignore` disable warnings for the next block of m
```
+
+You can add a special comment starting with `@component` that will show up when hovering over the component name in other files.
+
+````svelte
+
+
+
+
+
+ Hello, {name}
+
+
+````
diff --git a/documentation/docs/02-template-syntax/03-logic-blocks.md b/documentation/docs/02-template-syntax/03-control-flow.md
similarity index 52%
rename from documentation/docs/02-template-syntax/03-logic-blocks.md
rename to documentation/docs/02-template-syntax/03-control-flow.md
index af47f6dfa7..84c44568df 100644
--- a/documentation/docs/02-template-syntax/03-logic-blocks.md
+++ b/documentation/docs/02-template-syntax/03-control-flow.md
@@ -1,7 +1,20 @@
---
-title: Logic blocks
+title: Control flow
---
+- if
+- each
+- await (or move that into some kind of data loading section?)
+- NOT: key (move into transition section, because that's the common use case)
+
+Svelte augments HTML with control flow blocks to be able to express conditionally rendered content or lists.
+
+The syntax between these blocks is the same:
+
+- `{#` denotes the start of a block
+- `{:` denotes a different branch part of the block. Depending on the block, there can be multiple of these
+- `{/` denotes the end of a block
+
## {#if ...}
```svelte
@@ -128,96 +141,8 @@ An each block can also have an `{:else}` clause, which is rendered if the list i
{/each}
```
-Since Svelte 4 it is possible to iterate over iterables like `Map` or `Set`. Iterables need to be finite and static (they shouldn't change while being iterated over). Under the hood, they are transformed to an array using `Array.from` before being passed off to rendering. If you're writing performance-sensitive code, try to avoid iterables and use regular arrays as they are more performant.
-
-## {#await ...}
-
-```svelte
-
-{#await expression}...{:then name}...{:catch name}...{/await}
-```
-
-```svelte
-
-{#await expression}...{:then name}...{/await}
-```
-
-```svelte
-
-{#await expression then name}...{/await}
-```
-
-```svelte
-
-{#await expression catch name}...{/await}
-```
-
-Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected.
-In SSR mode, only the pending branch will be rendered on the server.
-If the provided expression is not a Promise only the fulfilled branch will be rendered, including in SSR mode.
-
-```svelte
-{#await promise}
-
- waiting for the promise to resolve...
-{:then value}
-
- The value is {value}
-{:catch error}
-
- Something went wrong: {error.message}
-{/await}
-```
+It is possible to iterate over iterables like `Map` or `Set`. Iterables need to be finite and static (they shouldn't change while being iterated over). Under the hood, they are transformed to an array using `Array.from` before being passed off to rendering. If you're writing performance-sensitive code, try to avoid iterables and use regular arrays as they are more performant.
-The `catch` block can be omitted if you don't need to render anything when the promise rejects (or no error is possible).
+## Other block types
-```svelte
-{#await promise}
-
- waiting for the promise to resolve...
-{:then value}
-
- The value is {value}
-{/await}
-```
-
-If you don't care about the pending state, you can also omit the initial block.
-
-```svelte
-{#await promise then value}
- The value is {value}
-{/await}
-```
-
-Similarly, if you only want to show the error state, you can omit the `then` block.
-
-```svelte
-{#await promise catch error}
- The error is {error}
-{/await}
-```
-
-## {#key ...}
-
-```svelte
-
-{#key expression}...{/key}
-```
-
-Key blocks destroy and recreate their contents when the value of an expression changes.
-
-This is useful if you want an element to play its transition whenever a value changes.
-
-```svelte
-{#key value}
- {value}
-{/key}
-```
-
-When used around components, this will cause them to be reinstantiated and reinitialised.
-
-```svelte
-{#key value}
-
-{/key}
-```
+Svelte also provides [`#snippet`](snippets), [`#key`](transitions-and-animations) and [`#await`](data-fetching) blocks. You can find out more about them in their respective sections.
diff --git a/documentation/docs/02-template-syntax/04-snippets.md b/documentation/docs/02-template-syntax/04-snippets.md
new file mode 100644
index 0000000000..ffaecd7a40
--- /dev/null
+++ b/documentation/docs/02-template-syntax/04-snippets.md
@@ -0,0 +1,253 @@
+---
+title: Snippets
+---
+
+Better title needed?
+
+- `#snippet`
+- `@render`
+- how they can be used to reuse markup
+- how they can be used to pass UI content to components
+
+Snippets, and _render tags_, are a way to create reusable chunks of markup inside your components. Instead of writing duplicative code like [this](/#H4sIAAAAAAAAE5VUYW-kIBD9K8Tmsm2yXXRzvQ-s3eR-R-0HqqOQKhAZb9sz_vdDkV1t000vRmHewMx7w2AflbIGG7GnPlK8gYhFv42JthG-m9Gwf6BGcLbVXZuPSGrzVho8ZirDGpDIhldgySN5GpEMez9kaNuckY1ANJZRamRuu2ZnhEZt6a84pvs43mzD4pMsUDDi8DMkQFYCGdkvsJwblFq5uCik9bmJ4JZwUkv1eoknWigX2eGNN6aGXa6bjV8ybP-X7sM36T58SVcrIIV2xVIaA41xeD5kKqWXuqpUJEefOqVuOkL9DfBchGrzWfu0vb-RpTd3o-zBR045Ga3HfuE5BmJpKauuhbPtENlUF2sqR9jqpsPSxWsMrlngyj3VJiyYjJXb1-lMa7IWC-iSk2M5Zzh-SJjShe-siq5kpZRPs55BbSGU5YPyte4vVV_VfFXxVb10dSLf17pS2lM5HnpPxw4Zpv6x-F57p0jI3OKlVnhv5V9wPQrNYQQ9D_f6aGHlC89fq1Z3qmDkJCTCweOGF4VUFSPJvD_DhreVdA0eu8ehJJ5x91dBaBkpWm3ureCFPt3uzRv56d4kdp-2euG38XZ6dsnd3ZmPG9yRBCrzRUvi-MccOdwz3qE-fOZ7AwAhlrtTUx3c76vRhSwlFBHDtoPhefgHX3dM0PkEAAA=)...
+
+```svelte
+{#each images as image}
+ {#if image.href}
+
+
+
+ {image.caption}
+
+
+ {:else}
+
+
+ {image.caption}
+
+ {/if}
+{/each}
+```
+
+...you can write [this](/#H4sIAAAAAAAAE5VUYW-bMBD9KxbRlERKY4jWfSA02n5H6QcXDmwVbMs-lnaI_z6D7TTt1moTAnPvzvfenQ_GpBEd2CS_HxPJekjy5IfWyS7BFz0b9id0CM62ajDVjBS2MkLjqZQldoBE9KwFS-7I_YyUOPqlRGuqnKw5orY5pVpUduj3mitUln5LU3pI0_UuBp9FjTwnDr9AHETLMSeHK6xiGoWSLi9yYT034cwSRjohn17zcQPNFTs8s153sK9Uv_Yh0-5_5d7-o9zbD-UqCaRWrllSYZQxLw_HUhb0ta-y4NnJUxfUvc7QuLJSaO0a3oh2MLBZat8u-wsPnXzKQvTtVVF34xK5d69ThFmHEQ4SpzeVRediTG8rjD5vBSeN3E5JyHh6R1DQK9-iml5kjzQUN_lSgVU8DhYLx7wwjSvRkMDvTjiwF4zM1kXZ7DlF1eN3A7IG85e-zRrYEjjm0FkI4Cc7Ripm0pHOChexhcWXzreeZyRMU6Mk3ljxC9w4QH-cQZ_b3T5pjHxk1VNr1CDrnJy5QDh6XLO6FrLNSRb2l9gz0wo3S6m7HErSgLsPGMHkpDZK31jOanXeHPQz-eruLHUP0z6yTbpbrn223V70uMXNSpQSZjpL0y8hcxxpNqA6_ql3BQAxlxvfpQ_uT9GrWjQC6iRHM8D0MP0GQsIi92QEAAA=):
+
+```svelte
+{#snippet figure(image)}
+
+
+ {image.caption}
+
+{/snippet}
+
+{#each images as image}
+ {#if image.href}
+
+ {@render figure(image)}
+
+ {:else}
+ {@render figure(image)}
+ {/if}
+{/each}
+```
+
+Like function declarations, snippets can have an arbitrary number of parameters, which can have default values, and you can destructure each parameter. You cannot use rest parameters however.
+
+## Snippet scope
+
+Snippets can be declared anywhere inside your component. They can reference values declared outside themselves, for example in the `
+
+{#snippet hello(name)}
+ hello {name}! {message}!
+{/snippet}
+
+{@render hello('alice')}
+{@render hello('bob')}
+```
+
+...and they are 'visible' to everything in the same lexical scope (i.e. siblings, and children of those siblings):
+
+```svelte
+
+ {#snippet x()}
+ {#snippet y()}...{/snippet}
+
+
+ {@render y()}
+ {/snippet}
+
+
+ {@render y()}
+
+
+
+{@render x()}
+```
+
+Snippets can reference themselves and each other ([demo](/#H4sIAAAAAAAAE2WPTQqDMBCFrxLiRqH1Zysi7TlqF1YnENBJSGJLCYGeo5tesUeosfYH3c2bee_jjaWMd6BpfrAU6x5oTvdS0g01V-mFPkNnYNRaDKrxGxto5FKCIaeu1kYwFkauwsoUWtZYPh_3W5FMY4U2mb3egL9kIwY0rbhgiO-sDTgjSEqSTvIDs-jiOP7i_MHuFGAL6p9BtiSbOTl0GtzCuihqE87cqtyam6WRGz_vRcsZh5bmRg3gju4Fptq_kzQBAAA=)):
+
+```svelte
+{#snippet blastoff()}
+ 🚀
+{/snippet}
+
+{#snippet countdown(n)}
+ {#if n > 0}
+ {n}...
+ {@render countdown(n - 1)}
+ {:else}
+ {@render blastoff()}
+ {/if}
+{/snippet}
+
+{@render countdown(10)}
+```
+
+## Passing snippets to components
+
+Within the template, snippets are values just like any other. As such, they can be passed to components as props ([demo](/#H4sIAAAAAAAAE41SwY6bMBD9lRGplKQlYRMpF5ZF7T_0ttmDwSZYJbZrT9pGlv-9g4Fkk-xhxYV5vHlvhjc-aWQnXJK_-kSxo0jy5IcxSZrg2fSF-yM6FFQ7fbJ1jxSuttJguVd7lEejLcJPVnUCGquPMF9nsVoPjfNnohGx1sohMU4SHbzAa4_t0UNvmcOcGUNDzFP4jeccdikYK2v6sIWQ3lErpui5cDdPF_LmkVy3wlp5Vd5e2U_rHYSe_kYjFtl1KeVnTkljBEIrGBd2sYy8AtsyLlBk9DYhJHtTR_UbBDWybkR8NkqHWyOr_y74ZMNLz9f9AoG6ePkOJLMHLBp-xISvcPf11r0YUuMM2Ysfkgngh5XphUYKkJWU_FFz2UjBkxztSYT0cihR4LOn0tGaPrql439N-7Uh0Dl8MVYbt1jeJ1Fg7xDb_Uw2Y18YQqZ_S2U5FH1pS__dCkWMa3C0uR0pfQRTg89kE4bLLLDS_Dxy_Eywuo1TAnPAw4fqY1rvtH3W9w35ZZMgvU3jq8LhedwkguCHRhT_cMU6eVA5dKLB5wGutCWjlTOslupAxxrxceKoD2hzhe2qbmXHF1v1bbOcNCtW_zpYfVI8h5kQ4qY3mueHTlesW2C7TOEO4hcdwzgf3Nc7cZxUKKC4yuNhvIX_MlV_Xk0EAAA=)):
+
+```svelte
+
+
+{#snippet header()}
+ fruit
+ qty
+ price
+ total
+{/snippet}
+
+{#snippet row(d)}
+ {d.name}
+ {d.qty}
+ {d.price}
+ {d.qty * d.price}
+{/snippet}
+
+
+```
+
+Think about it like passing content instead of data to a component. The concept is similar to slots in web components.
+
+As an authoring convenience, snippets declared directly _inside_ a component implicitly become props _on_ the component ([demo](/#H4sIAAAAAAAAE41Sy27bMBD8lYVcwHYrW4kBXxRFaP-htzgHSqQsojLJkuu2BqF_74qUrfhxCHQRh7MzO9z1SSM74ZL8zSeKHUSSJz-MSdIET2Y4uD-iQ0Fnp4-2HpDC1VYaLHdqh_JgtEX4yapOQGP1AebrLJzWsXD-QjQi1lo5JMZRooNXeBuwHXoYLHOYM2OoiXkKv_GUwzYFY2VNFxvo0xtqxRR9F-7z04X8fE-uW2GtnJQ3E_tpvYV-oL9Ti0U2hVJFjMMZslcfW-5DWj9zShojEFrBuLCLZR_9CmzLQCwy-psw8rxBgvkNhhpZd8F8NppE7Stbq_8u-GTKS8_XQ9Keqnl5BZP1AzTYP2bDV7i7_9hLEeda0iocNJeNFDzJ0R5Fn142JzA-uzsdBfLhldPxPdMhIPS0H1-M1cYtlnejwdBDfBXZjHXTFOg4BhuOtvTfrVDEmAZG2ew5ezYV-Ew2fVzVAivNTyPHzwSr29AlMAe8f6g-zuWDts-GusAmdBSkv3P7qnB4GpMEEHwsRPEPV6yTe5VDJxp8iXClLRmtnGG1VHva3oCPHQd9QJsrbFd1Kzu-2Khvz8uzZsXqX3urj4rnMBNCXNUG83zf6Yp1C2yXKdxA_KJjGOfRfb0Vh7MKDShEuV-M9_4_nq6svF4EAAA=)):
+
+```svelte
+
+
+ {#snippet header()}
+ fruit
+ qty
+ price
+ total
+ {/snippet}
+
+ {#snippet row(d)}
+ {d.name}
+ {d.qty}
+ {d.price}
+ {d.qty * d.price}
+ {/snippet}
+
+```
+
+Any content inside the component tags that is _not_ a snippet declaration implicitly becomes part of the `children` snippet ([demo](/#H4sIAAAAAAAAE41S247aMBD9lVFYCegGsiDxks1G7T_0bdkHJ3aI1cR27aEtsvzvtZ0LZeGhiiJ5js-cmTMemzS8YybJ320iSM-SPPmmVJImeFEhML9Yh8zHRp51HZDC1JorLI_iiLxXUiN8J1XHoNGyh-U2i9F2SFy-epon1lIY9IwzRwNv8B6wI1oIJXNYEqV8E8sUfuIlh0MKSvPaX-zBpZ-oFRH-m7m7l5m8uyfXLdOaX5X3V_bL9gAu0D98i0V2NSWKwQ4lSN7s0LKLbgtsyxgXmT9NiBe-iaP-DYISSTcj4bcLI7hSDEHL3yu6dkPfBdLS0m1o3nk-LW9gX-gBGss9ZsMXuLu32VjZBdfRaelft5eUN5zRJEd9Zi6dlyEy_ncdOm_IxsGlULe8o5qJNFgE5x_9SWmpzGp9N2-MXQxz4c2cOQ-lZWQyF0Jd2q_-mjI9U1fr4FBPE8iuKTbjjRt2sMBK0svIsQtG6jb2CsQAdQ_1x9f5R9tmIS-yPToK-tNkQRQGL6ObCIIdEpH9wQ3p-Enk0LEGXwe4ktoX2hhFai5Ofi0jPnYc9QF1LrDdRK-rvXjerSfNitQ_TlqeBc1hwRi7yY3F81MnK9KtsF2n8Amis44ilA7VtwfWTyr-kaKV-_X4cH8BTOhfRzcEAAA=)):
+
+```svelte
+
+click me
+```
+
+```svelte
+
+
+
+
+{@render children()}
+```
+
+> Note that you cannot have a prop called `children` if you also have content inside the component — for this reason, you should avoid having props with that name
+
+You can declare snippet props as being optional. You can either use optional chaining to not render anything if the snippet isn't set...
+
+```svelte
+
+
+{@render children?.()}
+```
+
+...or use an `#if` block to render fallback content:
+
+```svelte
+
+
+{#if children}
+ {@render children()}
+{:else}
+ fallback content
+{/if}
+```
+
+## Typing snippets
+
+Snippets implement the `Snippet` interface imported from `'svelte'`:
+
+```svelte
+
+```
+
+With this change, red squigglies will appear if you try and use the component without providing a `data` prop and a `row` snippet. Notice that the type argument provided to `Snippet` is a tuple, since snippets can have multiple parameters.
+
+We can tighten things up further by declaring a generic, so that `data` and `row` refer to the same type:
+
+```svelte
+
+```
+
+## Snippets and slots
+
+In Svelte 4, content can be passed to components using [slots](https://svelte.dev/docs/special-elements#slot). Snippets are more powerful and flexible, and as such slots are deprecated in Svelte 5.
diff --git a/documentation/docs/02-template-syntax/04-special-tags.md b/documentation/docs/02-template-syntax/04-special-tags.md
deleted file mode 100644
index 4145d8d6d6..0000000000
--- a/documentation/docs/02-template-syntax/04-special-tags.md
+++ /dev/null
@@ -1,88 +0,0 @@
----
-title: Special tags
----
-
-## {@html ...}
-
-```svelte
-
-{@html expression}
-```
-
-In a text expression, characters like `<` and `>` are escaped; however, with HTML expressions, they're not.
-
-The expression should be valid standalone HTML — `{@html ""}content{@html "
"}` will _not_ work, because ` ` is not valid HTML. It also will _not_ compile Svelte code.
-
-> Svelte does not sanitize expressions before injecting HTML. If the data comes from an untrusted source, you must sanitize it, or you are exposing your users to an XSS vulnerability.
-
-```svelte
-
-
{post.title}
- {@html post.content}
-
-```
-
-## {@debug ...}
-
-```svelte
-
-{@debug}
-```
-
-```svelte
-
-{@debug var1, var2, ..., varN}
-```
-
-The `{@debug ...}` tag offers an alternative to `console.log(...)`. It logs the values of specific variables whenever they change, and pauses code execution if you have devtools open.
-
-```svelte
-
-
-{@debug user}
-
-Hello {user.firstname}!
-```
-
-`{@debug ...}` accepts a comma-separated list of variable names (not arbitrary expressions).
-
-```svelte
-
-{@debug user}
-{@debug user1, user2, user3}
-
-
-{@debug user.firstname}
-{@debug myArray[0]}
-{@debug !isReady}
-{@debug typeof user === 'object'}
-```
-
-The `{@debug}` tag without any arguments will insert a `debugger` statement that gets triggered when _any_ state changes, as opposed to the specified variables.
-
-## {@const ...}
-
-```svelte
-
-{@const assignment}
-```
-
-The `{@const ...}` tag defines a local constant.
-
-```svelte
-
-
-{#each boxes as box}
- {@const area = box.width * box.height}
- {box.width} * {box.height} = {area}
-{/each}
-```
-
-`{@const}` is only allowed as direct child of `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, ` ` or ` `.
diff --git a/documentation/docs/02-template-syntax/05-element-directives.md b/documentation/docs/02-template-syntax/05-element-directives.md
deleted file mode 100644
index f9ff1821c8..0000000000
--- a/documentation/docs/02-template-syntax/05-element-directives.md
+++ /dev/null
@@ -1,863 +0,0 @@
----
-title: Element directives
----
-
-As well as attributes, elements can have _directives_, which control the element's behaviour in some way.
-
-## on:_eventname_
-
-```svelte
-
-on:eventname={handler}
-```
-
-```svelte
-
-on:eventname|modifiers={handler}
-```
-
-Use the `on:` directive to listen to DOM events.
-
-```svelte
-
-
-
-
- count: {count}
-
-```
-
-Handlers can be declared inline with no performance penalty. As with attributes, directive values may be quoted for the sake of syntax highlighters.
-
-```svelte
- (count += 1)}>
- count: {count}
-
-```
-
-Add _modifiers_ to DOM events with the `|` character.
-
-```svelte
-
-```
-
-The following modifiers are available:
-
-- `preventDefault` — calls `event.preventDefault()` before running the handler
-- `stopPropagation` — calls `event.stopPropagation()`, preventing the event reaching the next element
-- `stopImmediatePropagation` - calls `event.stopImmediatePropagation()`, preventing other listeners of the same event from being fired.
-- `passive` — improves scrolling performance on touch/wheel events (Svelte will add it automatically where it's safe to do so)
-- `nonpassive` — explicitly set `passive: false`
-- `capture` — fires the handler during the _capture_ phase instead of the _bubbling_ phase
-- `once` — remove the handler after the first time it runs
-- `self` — only trigger handler if `event.target` is the element itself
-- `trusted` — only trigger handler if `event.isTrusted` is `true`. I.e. if the event is triggered by a user action.
-
-Modifiers can be chained together, e.g. `on:click|once|capture={...}`.
-
-If the `on:` directive is used without a value, the component will _forward_ the event, meaning that a consumer of the component can listen for it.
-
-```svelte
- The component itself will emit the click event
-```
-
-It's possible to have multiple event listeners for the same event:
-
-```svelte
-
-
-Click me!
-```
-
-## bind:_property_
-
-```svelte
-
-bind:property={variable}
-```
-
-Data ordinarily flows down, from parent to child. The `bind:` directive allows data to flow the other way, from child to parent. Most bindings are specific to particular elements.
-
-The simplest bindings reflect the value of a property, such as `input.value`.
-
-```svelte
-
-
-
-
-```
-
-If the name matches the value, you can use a shorthand.
-
-```svelte
-
-
-```
-
-Numeric input values are coerced; even though `input.value` is a string as far as the DOM is concerned, Svelte will treat it as a number. If the input is empty or invalid (in the case of `type="number"`), the value is `undefined`.
-
-```svelte
-
-
-```
-
-On ` ` elements with `type="file"`, you can use `bind:files` to get the [`FileList` of selected files](https://developer.mozilla.org/en-US/docs/Web/API/FileList). It is readonly.
-
-```svelte
-Upload a picture:
-
-```
-
-If you're using `bind:` directives together with `on:` directives, the order that they're defined in affects the value of the bound variable when the event handler is called.
-
-```svelte
-
-
- console.log('Old value:', value)}
- bind:value
- on:input={() => console.log('New value:', value)}
-/>
-```
-
-Here we were binding to the value of a text input, which uses the `input` event. Bindings on other elements may use different events such as `change`.
-
-## Binding `` value
-
-A `` value binding corresponds to the `value` property on the selected ``, which can be any value (not just strings, as is normally the case in the DOM).
-
-```svelte
-
- a
- b
- c
-
-```
-
-A `` element behaves similarly to a checkbox group. The bound variable is an array with an entry corresponding to the `value` property of each selected ``.
-
-```svelte
-
- Rice
- Beans
- Cheese
- Guac (extra)
-
-```
-
-When the value of an ` ` matches its text content, the attribute can be omitted.
-
-```svelte
-
- Rice
- Beans
- Cheese
- Guac (extra)
-
-```
-
-Elements with the `contenteditable` attribute support the following bindings:
-
-- [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)
-- [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText)
-- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
-
-There are slight differences between each of these, read more about them [here](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#Differences_from_innerText).
-
-
-
-```svelte
-
-```
-
-`` elements support binding to the `open` property.
-
-```svelte
-
- Details
- Something small enough to escape casual notice.
-
-```
-
-## Media element bindings
-
-Media elements (`` and ``) have their own set of bindings — seven _readonly_ ones...
-
-- `duration` (readonly) — the total duration of the video, in seconds
-- `buffered` (readonly) — an array of `{start, end}` objects
-- `played` (readonly) — ditto
-- `seekable` (readonly) — ditto
-- `seeking` (readonly) — boolean
-- `ended` (readonly) — boolean
-- `readyState` (readonly) — number between (and including) 0 and 4
-
-...and five _two-way_ bindings:
-
-- `currentTime` — the current playback time in the video, in seconds
-- `playbackRate` — how fast or slow to play the video, where 1 is 'normal'
-- `paused` — this one should be self-explanatory
-- `volume` — a value between 0 and 1
-- `muted` — a boolean value indicating whether the player is muted
-
-Videos additionally have readonly `videoWidth` and `videoHeight` bindings.
-
-```svelte
-
-```
-
-## Image element bindings
-
-Image elements (` `) have two readonly bindings:
-
-- `naturalWidth` (readonly) — the original width of the image, available after the image has loaded
-- `naturalHeight` (readonly) — the original height of the image, available after the image has loaded
-
-```svelte
-
-```
-
-## Block-level element bindings
-
-Block-level elements have 4 read-only bindings, measured using a technique similar to [this one](http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/):
-
-- `clientWidth`
-- `clientHeight`
-- `offsetWidth`
-- `offsetHeight`
-
-```svelte
-
-
-
-```
-
-## bind:group
-
-```svelte
-
-bind:group={variable}
-```
-
-Inputs that work together can use `bind:group`.
-
-```svelte
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-> `bind:group` only works if the inputs are in the same Svelte component.
-
-## bind:this
-
-```svelte
-
-bind:this={dom_node}
-```
-
-To get a reference to a DOM node, use `bind:this`.
-
-```svelte
-
-
-
-```
-
-## class:_name_
-
-```svelte
-
-class:name={value}
-```
-
-```svelte
-
-class:name
-```
-
-A `class:` directive provides a shorter way of toggling a class on an element.
-
-```svelte
-
-...
-...
-
-
-...
-
-
-...
-```
-
-## style:_property_
-
-```svelte
-style:property={value}
-```
-
-```svelte
-style:property="value"
-```
-
-```svelte
-style:property
-```
-
-The `style:` directive provides a shorthand for setting multiple styles on an element.
-
-```svelte
-
-...
-...
-
-
-...
-
-
-...
-
-
-...
-
-
-...
-```
-
-When `style:` directives are combined with `style` attributes, the directives will take precedence:
-
-```svelte
-This will be red
-```
-
-## use:_action_
-
-```svelte
-
-use:action
-```
-
-```svelte
-
-use:action={parameters}
-```
-
-```ts
-/// copy: false
-// @noErrors
-action = (node: HTMLElement, parameters: any) => {
- update?: (parameters: any) => void,
- destroy?: () => void
-}
-```
-
-Actions are functions that are called when an element is created. They can return an object with a `destroy` method that is called after the element is unmounted:
-
-```svelte
-
-
-
-```
-
-An action can have a parameter. If the returned value has an `update` method, it will be called whenever that parameter changes, immediately after Svelte has applied updates to the markup.
-
-> Don't worry about the fact that we're redeclaring the `foo` function for every component instance — Svelte will hoist any functions that don't depend on local state out of the component definition.
-
-```svelte
-
-
-
-```
-
-Read more in the [`svelte/action`](/docs/svelte-action) page.
-
-## transition:_fn_
-
-```svelte
-
-transition:fn
-```
-
-```svelte
-
-transition:fn={params}
-```
-
-```svelte
-
-transition:fn|global
-```
-
-```svelte
-
-transition:fn|global={params}
-```
-
-```svelte
-
-transition:fn|local
-```
-
-```svelte
-
-transition:fn|local={params}
-```
-
-```js
-/// copy: false
-// @noErrors
-transition = (node: HTMLElement, params: any, options: { direction: 'in' | 'out' | 'both' }) => {
- delay?: number,
- duration?: number,
- easing?: (t: number) => number,
- css?: (t: number, u: number) => string,
- tick?: (t: number, u: number) => void
-}
-```
-
-A transition is triggered by an element entering or leaving the DOM as a result of a state change.
-
-When a block is transitioning out, all elements inside the block, including those that do not have their own transitions, are kept in the DOM until every transition in the block has been completed.
-
-The `transition:` directive indicates a _bidirectional_ transition, which means it can be smoothly reversed while the transition is in progress.
-
-```svelte
-{#if visible}
- fades in and out
-{/if}
-```
-
-Transitions are local by default (in Svelte 3, they were global by default). Local transitions only play when the block they belong to is created or destroyed, _not_ when parent blocks are created or destroyed.
-
-```svelte
-{#if x}
- {#if y}
-
- fades in and out only when y changes
-
-
- fades in and out when x or y change
- {/if}
-{/if}
-```
-
-> By default intro transitions will not play on first render. You can modify this behaviour by setting `intro: true` when you [create a component](/docs/client-side-component-api) and marking the transition as `global`.
-
-## Transition parameters
-
-Like actions, transitions can have parameters.
-
-(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
-
-```svelte
-{#if visible}
- fades in and out over two seconds
-{/if}
-```
-
-## Custom transition functions
-
-Transitions can use custom functions. If the returned object has a `css` function, Svelte will create a CSS animation that plays on the element.
-
-The `t` argument passed to `css` is a value between `0` and `1` after the `easing` function has been applied. _In_ transitions run from `0` to `1`, _out_ transitions run from `1` to `0` — in other words, `1` is the element's natural state, as though no transition had been applied. The `u` argument is equal to `1 - t`.
-
-The function is called repeatedly _before_ the transition begins, with different `t` and `u` arguments.
-
-```svelte
-
-
-{#if visible}
- whooshes in
-{/if}
-```
-
-A custom transition function can also return a `tick` function, which is called _during_ the transition with the same `t` and `u` arguments.
-
-> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
-
-```svelte
-
-
-
-{#if visible}
- The quick brown fox jumps over the lazy dog
-{/if}
-```
-
-If a transition returns a function instead of a transition object, the function will be called in the next microtask. This allows multiple transitions to coordinate, making [crossfade effects](https://learn.svelte.dev/tutorial/deferred-transitions) possible.
-
-Transition functions also receive a third argument, `options`, which contains information about the transition.
-
-Available values in the `options` object are:
-
-- `direction` - one of `in`, `out`, or `both` depending on the type of transition
-
-## Transition events
-
-An element with transitions will dispatch the following events in addition to any standard DOM events:
-
-- `introstart`
-- `introend`
-- `outrostart`
-- `outroend`
-
-```svelte
-{#if visible}
- (status = 'intro started')}
- on:outrostart={() => (status = 'outro started')}
- on:introend={() => (status = 'intro ended')}
- on:outroend={() => (status = 'outro ended')}
- >
- Flies in and out
-
-{/if}
-```
-
-## in:_fn_/out:_fn_
-
-```svelte
-
-in:fn
-```
-
-```svelte
-
-in:fn={params}
-```
-
-```svelte
-
-in:fn|global
-```
-
-```svelte
-
-in:fn|global={params}
-```
-
-```svelte
-
-in:fn|local
-```
-
-```svelte
-
-in:fn|local={params}
-```
-
-```svelte
-
-out:fn
-```
-
-```svelte
-
-out:fn={params}
-```
-
-```svelte
-
-out:fn|global
-```
-
-```svelte
-
-out:fn|global={params}
-```
-
-```svelte
-
-out:fn|local
-```
-
-```svelte
-
-out:fn|local={params}
-```
-
-Similar to `transition:`, but only applies to elements entering (`in:`) or leaving (`out:`) the DOM.
-
-Unlike with `transition:`, transitions applied with `in:` and `out:` are not bidirectional — an in transition will continue to 'play' alongside the out transition, rather than reversing, if the block is outroed while the transition is in progress. If an out transition is aborted, transitions will restart from scratch.
-
-```svelte
-{#if visible}
- flies in, fades out
-{/if}
-```
-
-## animate:_fn_
-
-```svelte
-
-animate:name
-```
-
-```svelte
-
-animate:name={params}
-```
-
-```js
-/// copy: false
-// @noErrors
-animation = (node: HTMLElement, { from: DOMRect, to: DOMRect } , params: any) => {
- delay?: number,
- duration?: number,
- easing?: (t: number) => number,
- css?: (t: number, u: number) => string,
- tick?: (t: number, u: number) => void
-}
-```
-
-```ts
-/// copy: false
-// @noErrors
-DOMRect {
- bottom: number,
- height: number,
- left: number,
- right: number,
- top: number,
- width: number,
- x: number,
- y: number
-}
-```
-
-An animation is triggered when the contents of a [keyed each block](/docs/logic-blocks#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.
-
-Animations can be used with Svelte's [built-in animation functions](/docs/svelte-animate) or [custom animation functions](/docs/element-directives#custom-animation-functions).
-
-```svelte
-
-{#each list as item, index (item)}
- {item}
-{/each}
-```
-
-## Animation Parameters
-
-As with actions and transitions, animations can have parameters.
-
-(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
-
-```svelte
-{#each list as item, index (item)}
- {item}
-{/each}
-```
-
-## Custom animation functions
-
-Animations can use custom functions that provide the `node`, an `animation` object and any `parameters` as arguments. The `animation` parameter is an object containing `from` and `to` properties each containing a [DOMRect](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect#Properties) describing the geometry of the element in its `start` and `end` positions. The `from` property is the DOMRect of the element in its starting position, and the `to` property is the DOMRect of the element in its final position after the list has been reordered and the DOM updated.
-
-If the returned object has a `css` method, Svelte will create a CSS animation that plays on the element.
-
-The `t` argument passed to `css` is a value that goes from `0` and `1` after the `easing` function has been applied. The `u` argument is equal to `1 - t`.
-
-The function is called repeatedly _before_ the animation begins, with different `t` and `u` arguments.
-
-
-
-```svelte
-
-
-{#each list as item, index (item)}
- {item}
-{/each}
-```
-
-A custom animation function can also return a `tick` function, which is called _during_ the animation with the same `t` and `u` arguments.
-
-> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
-
-```svelte
-
-
-{#each list as item, index (item)}
- {item}
-{/each}
-```
diff --git a/documentation/docs/02-template-syntax/05-styles-and-classes.md b/documentation/docs/02-template-syntax/05-styles-and-classes.md
new file mode 100644
index 0000000000..48cdeabce5
--- /dev/null
+++ b/documentation/docs/02-template-syntax/05-styles-and-classes.md
@@ -0,0 +1,214 @@
+---
+title: Styles & Classes
+---
+
+- style scoping
+- `:global`
+- `style:`
+- `class:`
+- `--css` props
+
+Styling is a fundamental part of UI components. Svelte helps you style your components with ease, providing useful features out of the box.
+
+## Scoped by default
+
+By default CSS inside a `
+```
+
+## :global
+
+To apply styles to a selector globally, use the `:global(...)` modifier.
+
+```svelte
+
+```
+
+If you want to make @keyframes that are accessible globally, you need to prepend your keyframe names with `-global-`.
+
+The `-global-` part will be removed when compiled, and the keyframe will then be referenced using just `my-animation-name` elsewhere in your code.
+
+```svelte
+
+```
+
+## Nested style tags
+
+There should only be 1 top-level `
+
+```
+
+## class:_name_
+
+```svelte
+
+class:name={value}
+```
+
+```svelte
+
+class:name
+```
+
+A `class:` directive provides a shorter way of toggling a class on an element.
+
+```svelte
+
+...
+...
+
+
+...
+
+
+...
+```
+
+## style:_property_
+
+```svelte
+
+style:property={value}
+```
+
+```svelte
+
+style:property="value"
+```
+
+```svelte
+
+style:property
+```
+
+The `style:` directive provides a shorthand for setting multiple styles on an element.
+
+```svelte
+
+...
+...
+
+
+...
+
+
+...
+
+
+...
+
+
+...
+```
+
+When `style:` directives are combined with `style` attributes, the directives will take precedence:
+
+```svelte
+This will be red
+```
+
+## --style-props
+
+```svelte
+
+--style-props="anycssvalue"
+```
+
+You can also pass styles as props to components for the purposes of theming, using CSS custom properties.
+
+Svelte's implementation is essentially syntactic sugar for adding a wrapper element. This example:
+
+```svelte
+
+```
+
+Desugars to this:
+
+```svelte
+
+
+
+```
+
+For SVG namespace, the example above desugars into using `` instead:
+
+```svelte
+
+
+
+```
+
+> Since this is an extra `` (or `
`), beware that your CSS structure might accidentally target this. Be mindful of this added wrapper element when using this feature.
+
+Svelte's CSS Variables support allows for easily themeable components:
+
+```svelte
+
+```
+
+So you can set a high-level theme color:
+
+```css
+/* global.css */
+html {
+ --theme-color: black;
+}
+```
+
+Or override it at the consumer level:
+
+```svelte
+
+```
diff --git a/documentation/docs/02-template-syntax/06-component-directives.md b/documentation/docs/02-template-syntax/06-component-directives.md
deleted file mode 100644
index 39bdf80010..0000000000
--- a/documentation/docs/02-template-syntax/06-component-directives.md
+++ /dev/null
@@ -1,129 +0,0 @@
----
-title: Component directives
----
-
-## on:_eventname_
-
-```svelte
-
-on:eventname={handler}
-```
-
-Components can emit events using [`createEventDispatcher`](/docs/svelte#createeventdispatcher) or by forwarding DOM events.
-
-```svelte
-
-
-
- dispatch('hello')}> one
-
-
- two
-```
-
-Listening for component events looks the same as listening for DOM events:
-
-```svelte
-
-```
-
-As with DOM events, if the `on:` directive is used without a value, the event will be forwarded, meaning that a consumer can listen for it.
-
-```svelte
-
-```
-
-## --style-props
-
-```svelte
-
---style-props="anycssvalue"
-```
-
-You can also pass styles as props to components for the purposes of theming, using CSS custom properties.
-
-Svelte's implementation is essentially syntactic sugar for adding a wrapper element. This example:
-
-```svelte
-
-```
-
-Desugars to this:
-
-```svelte
-
-
-
-```
-
-**Note**: Since this is an extra ``, beware that your CSS structure might accidentally target this. Be mindful of this added wrapper element when using this feature.
-
-For SVG namespace, the example above desugars into using `
` instead:
-
-```svelte
-
-
-
-```
-
-**Note**: Since this is an extra ``, beware that your CSS structure might accidentally target this. Be mindful of this added wrapper element when using this feature.
-
-Svelte's CSS Variables support allows for easily themeable components:
-
-```svelte
-
-```
-
-So you can set a high-level theme color:
-
-```css
-/* global.css */
-html {
- --theme-color: black;
-}
-```
-
-Or override it at the consumer level:
-
-```svelte
-
-```
-
-## bind:_property_
-
-```svelte
-bind:property={variable}
-```
-
-You can bind to component props using the same syntax as for elements.
-
-```svelte
-
-```
-
-While Svelte props are reactive without binding, that reactivity only flows downward into the component by default. Using `bind:property` allows changes to the property from within the component to flow back up out of the component.
-
-## bind:this
-
-```svelte
-
-bind:this={component_instance}
-```
-
-Components also support `bind:this`, allowing you to interact with component instances programmatically.
-
-```svelte
-
-
- cart.empty()}> Empty shopping cart
-```
-
-> Note that we can't do `{cart.empty}` since `cart` is `undefined` when the button is first rendered and throws an error.
diff --git a/documentation/docs/02-template-syntax/06-transitions-and-animations.md b/documentation/docs/02-template-syntax/06-transitions-and-animations.md
new file mode 100644
index 0000000000..8163d96a6e
--- /dev/null
+++ b/documentation/docs/02-template-syntax/06-transitions-and-animations.md
@@ -0,0 +1,432 @@
+---
+title: Transitions & Animations
+---
+
+- how to use (template syntax)
+- when to use
+- global vs local
+- easing & motion
+- mention imports
+- key block
+
+Svelte provides different techniques and syntax for incorporating motion into your Svelte projects.
+
+## transition:_fn_
+
+```svelte
+
+transition:fn
+```
+
+```svelte
+
+transition:fn={params}
+```
+
+```svelte
+
+transition:fn|global
+```
+
+```svelte
+
+transition:fn|global={params}
+```
+
+```svelte
+
+transition:fn|local
+```
+
+```svelte
+
+transition:fn|local={params}
+```
+
+```js
+/// copy: false
+// @noErrors
+transition = (node: HTMLElement, params: any, options: { direction: 'in' | 'out' | 'both' }) => {
+ delay?: number,
+ duration?: number,
+ easing?: (t: number) => number,
+ css?: (t: number, u: number) => string,
+ tick?: (t: number, u: number) => void
+}
+```
+
+A transition is triggered by an element entering or leaving the DOM as a result of a state change.
+
+When a block is transitioning out, all elements inside the block, including those that do not have their own transitions, are kept in the DOM until every transition in the block has been completed.
+
+The `transition:` directive indicates a _bidirectional_ transition, which means it can be smoothly reversed while the transition is in progress.
+
+```svelte
+{#if visible}
+ fades in and out
+{/if}
+```
+
+Transitions are local by default. Local transitions only play when the block they belong to is created or destroyed, _not_ when parent blocks are created or destroyed.
+
+```svelte
+{#if x}
+ {#if y}
+ fades in and out only when y changes
+
+ fades in and out when x or y change
+ {/if}
+{/if}
+```
+
+> By default intro transitions will not play on first render. You can modify this behaviour by setting `intro: true` when you [create a component](/docs/runtime/imperative-component-api) and marking the transition as `global`.
+
+## Transition parameters
+
+Transitions can have parameters.
+
+(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
+
+```svelte
+{#if visible}
+ fades in and out over two seconds
+{/if}
+```
+
+## Custom transition functions
+
+Transitions can use custom functions. If the returned object has a `css` function, Svelte will create a CSS animation that plays on the element.
+
+The `t` argument passed to `css` is a value between `0` and `1` after the `easing` function has been applied. _In_ transitions run from `0` to `1`, _out_ transitions run from `1` to `0` — in other words, `1` is the element's natural state, as though no transition had been applied. The `u` argument is equal to `1 - t`.
+
+The function is called repeatedly _before_ the transition begins, with different `t` and `u` arguments.
+
+```svelte
+
+
+{#if visible}
+ whooshes in
+{/if}
+```
+
+A custom transition function can also return a `tick` function, which is called _during_ the transition with the same `t` and `u` arguments.
+
+> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
+
+```svelte
+
+
+
+{#if visible}
+ The quick brown fox jumps over the lazy dog
+{/if}
+```
+
+If a transition returns a function instead of a transition object, the function will be called in the next microtask. This allows multiple transitions to coordinate, making [crossfade effects](/tutorial/deferred-transitions) possible.
+
+Transition functions also receive a third argument, `options`, which contains information about the transition.
+
+Available values in the `options` object are:
+
+- `direction` - one of `in`, `out`, or `both` depending on the type of transition
+
+## Transition events
+
+An element with transitions will dispatch the following events in addition to any standard DOM events:
+
+- `introstart`
+- `introend`
+- `outrostart`
+- `outroend`
+
+```svelte
+{#if visible}
+ (status = 'intro started')}
+ on:outrostart={() => (status = 'outro started')}
+ on:introend={() => (status = 'intro ended')}
+ on:outroend={() => (status = 'outro ended')}
+ >
+ Flies in and out
+
+{/if}
+```
+
+## in:_fn_/out:_fn_
+
+```svelte
+
+in:fn
+```
+
+```svelte
+
+in:fn={params}
+```
+
+```svelte
+
+in:fn|global
+```
+
+```svelte
+
+in:fn|global={params}
+```
+
+```svelte
+
+in:fn|local
+```
+
+```svelte
+
+in:fn|local={params}
+```
+
+```svelte
+
+out:fn
+```
+
+```svelte
+
+out:fn={params}
+```
+
+```svelte
+
+out:fn|global
+```
+
+```svelte
+
+out:fn|global={params}
+```
+
+```svelte
+
+out:fn|local
+```
+
+```svelte
+
+out:fn|local={params}
+```
+
+Similar to `transition:`, but only applies to elements entering (`in:`) or leaving (`out:`) the DOM.
+
+Unlike with `transition:`, transitions applied with `in:` and `out:` are not bidirectional — an in transition will continue to 'play' alongside the out transition, rather than reversing, if the block is outroed while the transition is in progress. If an out transition is aborted, transitions will restart from scratch.
+
+```svelte
+{#if visible}
+ flies in, fades out
+{/if}
+```
+
+## animate:_fn_
+
+```svelte
+
+animate:name
+```
+
+```svelte
+
+animate:name={params}
+```
+
+```js
+/// copy: false
+// @noErrors
+animation = (node: HTMLElement, { from: DOMRect, to: DOMRect } , params: any) => {
+ delay?: number,
+ duration?: number,
+ easing?: (t: number) => number,
+ css?: (t: number, u: number) => string,
+ tick?: (t: number, u: number) => void
+}
+```
+
+```ts
+/// copy: false
+// @noErrors
+DOMRect {
+ bottom: number,
+ height: number,
+ left: number,
+ right: number,
+ top: number,
+ width: number,
+ x: number,
+ y: number
+}
+```
+
+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.
+
+Animations can be used with Svelte's [built-in animation functions](/docs/svelte/reference/svelte-animate) or [custom animation functions](#custom-animation-functions).
+
+```svelte
+
+{#each list as item, index (item)}
+ {item}
+{/each}
+```
+
+## Animation Parameters
+
+As with actions and transitions, animations can have parameters.
+
+(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
+
+```svelte
+{#each list as item, index (item)}
+ {item}
+{/each}
+```
+
+## Custom animation functions
+
+Animations can use custom functions that provide the `node`, an `animation` object and any `parameters` as arguments. The `animation` parameter is an object containing `from` and `to` properties each containing a [DOMRect](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect#Properties) describing the geometry of the element in its `start` and `end` positions. The `from` property is the DOMRect of the element in its starting position, and the `to` property is the DOMRect of the element in its final position after the list has been reordered and the DOM updated.
+
+If the returned object has a `css` method, Svelte will create a CSS animation that plays on the element.
+
+The `t` argument passed to `css` is a value that goes from `0` and `1` after the `easing` function has been applied. The `u` argument is equal to `1 - t`.
+
+The function is called repeatedly _before_ the animation begins, with different `t` and `u` arguments.
+
+
+
+```svelte
+
+
+{#each list as item, index (item)}
+ {item}
+{/each}
+```
+
+A custom animation function can also return a `tick` function, which is called _during_ the animation with the same `t` and `u` arguments.
+
+> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
+
+```svelte
+
+
+{#each list as item, index (item)}
+ {item}
+{/each}
+```
+
+## {#key ...}
+
+```svelte
+
+{#key expression}...{/key}
+```
+
+Key blocks destroy and recreate their contents when the value of an expression changes.
+
+This is useful if you want an element to play its transition whenever a value changes.
+
+```svelte
+{#key value}
+ {value}
+{/key}
+```
+
+When used around components, this will cause them to be reinstantiated and reinitialised.
+
+```svelte
+{#key value}
+
+{/key}
+```
diff --git a/documentation/docs/03-runtime/07-svelte-action.md b/documentation/docs/02-template-syntax/07-actions.md
similarity index 77%
rename from documentation/docs/03-runtime/07-svelte-action.md
rename to documentation/docs/02-template-syntax/07-actions.md
index ebd4185774..5752b039fa 100644
--- a/documentation/docs/03-runtime/07-svelte-action.md
+++ b/documentation/docs/02-template-syntax/07-actions.md
@@ -1,10 +1,35 @@
---
-title: svelte/action
+title: Actions
---
+- template syntax
+- how to write
+- typings
+- adjust so that `$effect` is used instead of update/destroy?
+
+```svelte
+
+use:action
+```
+
+```svelte
+
+use:action={parameters}
+```
+
+```ts
+/// copy: false
+// @noErrors
+action = (node: HTMLElement, parameters: any) => {
+ update?: (parameters: any) => void,
+ destroy?: () => void
+}
+```
+
Actions are functions that are called when an element is created. They can return an object with a `destroy` method that is called after the element is unmounted:
```svelte
+
-
+
```
-
-## Types
-
-> TYPES: svelte/action
diff --git a/documentation/docs/02-template-syntax/08-bindings.md b/documentation/docs/02-template-syntax/08-bindings.md
new file mode 100644
index 0000000000..73b49cdd0e
--- /dev/null
+++ b/documentation/docs/02-template-syntax/08-bindings.md
@@ -0,0 +1,305 @@
+---
+title: Bindings
+---
+
+- how for dom elements
+- list of all bindings
+- how for components
+
+Most of the time a clear separation between data flowing down and events going up is worthwhile and results in more robust apps. But in some cases - especially when interacting with form elements - it's more ergonomic to declare a two way binding. Svelte provides many element bindings out of the box, and also allows component bindings.
+
+## bind:_property_ for elements
+
+```svelte
+
+bind:property={variable}
+```
+
+Data ordinarily flows down, from parent to child. The `bind:` directive allows data to flow the other way, from child to parent. Most bindings are specific to particular elements.
+
+The simplest bindings reflect the value of a property, such as `input.value`.
+
+```svelte
+
+
+
+
+```
+
+If the name matches the value, you can use a shorthand.
+
+```svelte
+
+
+```
+
+Numeric input values are coerced; even though `input.value` is a string as far as the DOM is concerned, Svelte will treat it as a number. If the input is empty or invalid (in the case of `type="number"`), the value is `undefined`.
+
+```svelte
+
+
+```
+
+On ` ` elements with `type="file"`, you can use `bind:files` to get the [`FileList` of selected files](https://developer.mozilla.org/en-US/docs/Web/API/FileList). It is readonly.
+
+```svelte
+Upload a picture:
+
+```
+
+If you're using `bind:` directives together with `on:` directives, the order that they're defined in affects the value of the bound variable when the event handler is called.
+
+```svelte
+
+
+ console.log('Old value:', value)}
+ bind:value
+ on:input={() => console.log('New value:', value)}
+/>
+```
+
+Here we were binding to the value of a text input, which uses the `input` event. Bindings on other elements may use different events such as `change`.
+
+## Binding `` value
+
+A `` value binding corresponds to the `value` property on the selected ``, which can be any value (not just strings, as is normally the case in the DOM).
+
+```svelte
+
+ a
+ b
+ c
+
+```
+
+A `` element behaves similarly to a checkbox group. The bound variable is an array with an entry corresponding to the `value` property of each selected ``.
+
+```svelte
+
+ Rice
+ Beans
+ Cheese
+ Guac (extra)
+
+```
+
+When the value of an ` ` matches its text content, the attribute can be omitted.
+
+```svelte
+
+ Rice
+ Beans
+ Cheese
+ Guac (extra)
+
+```
+
+Elements with the `contenteditable` attribute support the following bindings:
+
+- [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)
+- [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText)
+- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
+
+There are slight differences between each of these, read more about them [here](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#Differences_from_innerText).
+
+
+
+```svelte
+
+```
+
+`` elements support binding to the `open` property.
+
+```svelte
+
+ Details
+ Something small enough to escape casual notice.
+
+```
+
+## Media element bindings
+
+Media elements (`` and ``) have their own set of bindings — seven _readonly_ ones...
+
+- `duration` (readonly) — the total duration of the video, in seconds
+- `buffered` (readonly) — an array of `{start, end}` objects
+- `played` (readonly) — ditto
+- `seekable` (readonly) — ditto
+- `seeking` (readonly) — boolean
+- `ended` (readonly) — boolean
+- `readyState` (readonly) — number between (and including) 0 and 4
+
+...and five _two-way_ bindings:
+
+- `currentTime` — the current playback time in the video, in seconds
+- `playbackRate` — how fast or slow to play the video, where 1 is 'normal'
+- `paused` — this one should be self-explanatory
+- `volume` — a value between 0 and 1
+- `muted` — a boolean value indicating whether the player is muted
+
+Videos additionally have readonly `videoWidth` and `videoHeight` bindings.
+
+```svelte
+
+```
+
+## Image element bindings
+
+Image elements (` `) have two readonly bindings:
+
+- `naturalWidth` (readonly) — the original width of the image, available after the image has loaded
+- `naturalHeight` (readonly) — the original height of the image, available after the image has loaded
+
+```svelte
+
+```
+
+## Block-level element bindings
+
+Block-level elements have 4 read-only bindings, measured using a technique similar to [this one](http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/):
+
+- `clientWidth`
+- `clientHeight`
+- `offsetWidth`
+- `offsetHeight`
+
+```svelte
+
+
+
+```
+
+## bind:group
+
+```svelte
+
+bind:group={variable}
+```
+
+Inputs that work together can use `bind:group`.
+
+```svelte
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+> `bind:group` only works if the inputs are in the same Svelte component.
+
+## bind:this
+
+```svelte
+
+bind:this={dom_node}
+```
+
+To get a reference to a DOM node, use `bind:this`.
+
+```svelte
+
+
+
+```
+
+Components also support `bind:this`, allowing you to interact with component instances programmatically.
+
+```svelte
+
+
+
+ cart.empty()}> Empty shopping cart
+```
+
+```svelte
+
+
+```
+
+> Note that we can't do `{cart.empty}` since `cart` is `undefined` when the button is first rendered and throws an error.
+
+## bind:_property_ for components
+
+```svelte
+bind:property={variable}
+```
+
+You can bind to component props using the same syntax as for elements.
+
+```svelte
+
+```
+
+While Svelte props are reactive without binding, that reactivity only flows downward into the component by default. Using `bind:property` allows changes to the property from within the component to flow back up out of the component.
+
+To mark a property as bindable, use the `$bindable` rune:
+
+```svelte
+
+```
+
+Declaring a property as bindable means it _can_ be used using `bind:`, not that it _must_ be used using `bind:`.
+
+Bindable properties can have a fallback value:
+
+```svelte
+
+```
+
+This fallback value _only_ applies when the property is _not_ bound. When the property is bound and a fallback value is present, the parent is expected to provide a value other than `undefined`, else a runtime error is thrown. This prevents hard-to-reason-about situations where it's unclear which value should apply.
diff --git a/documentation/docs/02-template-syntax/07-special-elements.md b/documentation/docs/02-template-syntax/09-special-elements.md
similarity index 57%
rename from documentation/docs/02-template-syntax/07-special-elements.md
rename to documentation/docs/02-template-syntax/09-special-elements.md
index 20d7bcd7ea..a22b63ac48 100644
--- a/documentation/docs/02-template-syntax/07-special-elements.md
+++ b/documentation/docs/02-template-syntax/09-special-elements.md
@@ -2,149 +2,9 @@
title: Special elements
---
-## ``
+- [basically what we have in the docs today](https://svelte.dev/docs/special-elements)
-```svelte
-
-```
-
-```svelte
-
-```
-
-```svelte
-
-```
-
-Components can have child content, in the same way that elements can.
-
-The content is exposed in the child component using the `` element, which can contain fallback content that is rendered if no children are provided.
-
-```svelte
-
-
-
- this fallback content will be rendered when no content is provided, like in the first example
-
-
-
-
-
-
-
-
- this is some child content that will overwrite the default slot content
-
-```
-
-Note: If you want to render regular `` element, You can use ` `.
-
-### ``
-
-Named slots allow consumers to target specific areas. They can also have fallback content.
-
-```svelte
-
-
-
No header was provided
-
Some content between header and footer
-
-
-
-
-
- Hello
- Copyright (c) 2019 Svelte Industries
-
-```
-
-Components can be placed in a named slot using the syntax ` `.
-In order to place content in a slot without using a wrapper element, you can use the special element ``.
-
-```svelte
-
-
-
No header was provided
-
Some content between header and footer
-
-
-
-
-
-
-
- All rights reserved.
- Copyright (c) 2019 Svelte Industries
-
-
-```
-
-### $$slots
-
-`$$slots` is an object whose keys are the names of the slots passed into the component by the parent. If the parent does not pass in a slot with a particular name, that name will not be present in `$$slots`. This allows components to render a slot (and other elements, like wrappers for styling) only if the parent provides it.
-
-Note that explicitly passing in an empty named slot will add that slot's name to `$$slots`. For example, if a parent passes `
` to a child component, `$$slots.title` will be truthy within the child.
-
-```svelte
-
-
-
- {#if $$slots.description}
-
-
-
- {/if}
-
-
-
-
- Blog Post Title
-
-
-```
-
-### ``
-
-Slots can be rendered zero or more times and can pass values _back_ to the parent using props. The parent exposes the values to the slot template using the `let:` directive.
-
-The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}`, and `` is equivalent to ``.
-
-```svelte
-
-
- {#each items as item}
-
-
-
- {/each}
-
-
-
-
- {thing.text}
-
-```
-
-Named slots can also expose values. The `let:` directive goes on the element with the `slot` attribute.
-
-```svelte
-
-
- {#each items as item}
-
-
-
- {/each}
-
-
-
-
-
-
- {item.text}
- Copyright (c) 2019 Svelte Industries
-
-```
+Some of Svelte's concepts need special elements. Those are prefixed with `svelte:` and listed here.
## ``
@@ -324,25 +184,3 @@ The `` element provides a place to specify per-component compile
```svelte
```
-
-## ``
-
-The `` element allows you to place content in a [named slot](/docs/special-elements#slot-slot-name-name) without wrapping it in a container DOM element. This keeps the flow layout of your document intact.
-
-```svelte
-
-
-
No header was provided
-
Some content between header and footer
-
-
-
-
-
- Hello
-
- All rights reserved.
- Copyright (c) 2019 Svelte Industries
-
-
-```
diff --git a/documentation/docs/02-template-syntax/10-data-fetching.md b/documentation/docs/02-template-syntax/10-data-fetching.md
new file mode 100644
index 0000000000..4116772f7b
--- /dev/null
+++ b/documentation/docs/02-template-syntax/10-data-fetching.md
@@ -0,0 +1,85 @@
+---
+title: Data fetching
+---
+
+Fetching data is a fundamental part of apps interacting with the outside world. Svelte is unopinionated with how you fetch your data. The simplest way would be using the built-in `fetch` method:
+
+```svelte
+
+```
+
+While this works, it makes working with promises somewhat unergonomic. Svelte alleviates this problem using the `#await` block.
+
+## {#await ...}
+
+```svelte
+
+{#await expression}...{:then name}...{:catch name}...{/await}
+```
+
+```svelte
+
+{#await expression}...{:then name}...{/await}
+```
+
+```svelte
+
+{#await expression then name}...{/await}
+```
+
+```svelte
+
+{#await expression catch name}...{/await}
+```
+
+Await blocks allow you to branch on the three possible states of a Promise — pending, fulfilled or rejected.
+In SSR mode, only the pending branch will be rendered on the server.
+If the provided expression is not a Promise only the fulfilled branch will be rendered, including in SSR mode.
+
+```svelte
+{#await promise}
+
+ waiting for the promise to resolve...
+{:then value}
+
+ The value is {value}
+{:catch error}
+
+ Something went wrong: {error.message}
+{/await}
+```
+
+The `catch` block can be omitted if you don't need to render anything when the promise rejects (or no error is possible).
+
+```svelte
+{#await promise}
+
+ waiting for the promise to resolve...
+{:then value}
+
+ The value is {value}
+{/await}
+```
+
+If you don't care about the pending state, you can also omit the initial block.
+
+```svelte
+{#await promise then value}
+ The value is {value}
+{/await}
+```
+
+Similarly, if you only want to show the error state, you can omit the `then` block.
+
+```svelte
+{#await promise catch error}
+ The error is {error}
+{/await}
+```
+
+## SvelteKit loaders
+
+Fetching inside your components is great for simple use cases, but it's prone to data loading waterfalls and makes code harder to work with because of the promise handling. SvelteKit solves this problem by providing a opinionated data loading story that is coupled to its router. Learn more about it [in the docs](/docs/kit).
diff --git a/documentation/docs/02-template-syntax/index.md b/documentation/docs/02-template-syntax/index.md
new file mode 100644
index 0000000000..3c4523cb92
--- /dev/null
+++ b/documentation/docs/02-template-syntax/index.md
@@ -0,0 +1,3 @@
+---
+title: Template syntax
+---
diff --git a/documentation/docs/02-template-syntax/meta.json b/documentation/docs/02-template-syntax/meta.json
deleted file mode 100644
index e703825a0c..0000000000
--- a/documentation/docs/02-template-syntax/meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "title": "Template Syntax"
-}
diff --git a/documentation/docs/03-runes/01-state.md b/documentation/docs/03-runes/01-state.md
new file mode 100644
index 0000000000..241e6b71bf
--- /dev/null
+++ b/documentation/docs/03-runes/01-state.md
@@ -0,0 +1,234 @@
+---
+title: State
+---
+
+- `$state` (.frozen)
+- `$derived` (.by)
+- using classes
+- getters/setters (what to do to keep reactivity "alive")
+- universal reactivity
+
+Svelte 5 uses _runes_, a powerful set of primitives for controlling reactivity inside your Svelte components and inside `.svelte.js` and `.svelte.ts` modules.
+
+Runes are function-like symbols that provide instructions to the Svelte compiler. You don't need to import them from anywhere — when you use Svelte, they're part of the language. This page describes the runes that are concerned with managing state in your application.
+
+## `$state`
+
+The `$state` rune is the at the heart of the runes API. It is used to declare reactive state:
+
+```svelte
+
+
+ count++}>
+ clicks: {count}
+
+```
+
+Variables declared with `$state` are the variable _itself_, in other words there's no wrapper around the value that it contains. This is possible thanks to the compiler-nature of Svelte. As such, updating state is done through simple reassignment.
+
+You can also use `$state` in class fields (whether public or private):
+
+```js
+// @errors: 7006 2554
+class Todo {
+ done = $state(false);
+ text = $state();
+
+ constructor(text) {
+ this.text = text;
+ }
+
+ reset() {
+ this.text = '';
+ this.done = false;
+ }
+}
+```
+
+> In this example, the compiler transforms `done` and `text` into `get`/`set` methods on the class prototype referencing private fields
+
+Objects and arrays are made deeply reactive by wrapping them with [`Proxies`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy). What that means is that in the following example, we can mutate the `entries` object and the UI will still update - but only the list item that is actually changed will rerender:
+
+```svelte
+
+
+{#each entries as entry (entry.id)}
+ {entry.text}
+{/each}
+
+ (entries[1].text = 'baz')}>change second entry text
+```
+
+> Only POJOs (plain of JavaScript objects) are made deeply reactive. Reactivity will stop at class boundaries and leave those alone
+
+## `$state.frozen`
+
+State declared with `$state.frozen` cannot be mutated; it can only be _reassigned_. In other words, rather than assigning to a property of an object, or using an array method like `push`, replace the object or array altogether if you'd like to update it:
+
+```svelte
+
+
+{#each entries as entry (entry.id)}
+ {entry.text}
+{/each}
+
+ (entries = [entries[0], { id: entries[1].id, text: 'baz' }])}
+ >change second entry text
+```
+
+This can improve performance with large arrays and objects that you weren't planning to mutate anyway, since it avoids the cost of making them reactive. Note that frozen state can _contain_ reactive state (for example, a frozen array of reactive objects).
+
+> Objects and arrays passed to `$state.frozen` will be shallowly frozen using `Object.freeze()`. If you don't want this, pass in a clone of the object or array instead.
+
+## `$state.snapshot`
+
+To take a static snapshot of a deeply reactive `$state` proxy, use `$state.snapshot`:
+
+```svelte
+
+```
+
+This is handy when you want to pass some state to an external library or API that doesn't expect a proxy, such as `structuredClone`.
+
+> Note that `$state.snapshot` will clone the data when removing reactivity. If the value passed isn't a `$state` proxy, it will be returned as-is.
+
+## `$state.is`
+
+Sometimes you might need to compare two values, one of which is a reactive `$state(...)` proxy but the other is not. For this you can use `$state.is(a, b)`:
+
+```svelte
+
+```
+
+This is handy when you might want to check if the object exists within a deeply reactive object/array.
+
+Under the hood, `$state.is` uses [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) for comparing the values.
+
+> Use this as an escape hatch - most of the time you don't need this. Svelte will warn you at dev time if you happen to run into this problem
+
+## `$derived`
+
+Derived state is declared with the `$derived` rune:
+
+```svelte
+
+
+ count++}>
+ {doubled}
+
+
+{count} doubled is {doubled}
+```
+
+The expression inside `$derived(...)` should be free of side-effects. Svelte will disallow state changes (e.g. `count++`) inside derived expressions.
+
+As with `$state`, you can mark class fields as `$derived`.
+
+## `$derived.by`
+
+Sometimes you need to create complex derivations that don't fit inside a short expression. In these cases, you can use `$derived.by` which accepts a function as its argument.
+
+```svelte
+
+
+ numbers.push(numbers.length + 1)}>
+ {numbers.join(' + ')} = {total}
+
+```
+
+In essence, `$derived(expression)` is equivalent to `$derived.by(() => expression)`.
+
+## Universal reactivity
+
+In the examples above, `$state` and `$derived` only appear at the top level of components. You can also use them within functions or even outside Svelte components inside `.svelte.js` or `.svelte.ts` modules.
+
+```ts
+/// file: counter.svelte.ts
+export function createCounter(initial: number) {
+ let count = $state(initial);
+ let double = $derived(count * 2);
+ return {
+ get count() {
+ return count;
+ },
+ get double() {
+ return double;
+ },
+ increment: () => count++
+ };
+}
+```
+
+```svelte
+
+
+
+{counter.count} / {counter.double}
+```
+
+There are a few things to note in the above example:
+
+- We're using getters to transport reactivity across the function boundary. This way we keep reactivity "alive". If we were to return the value itself, it would be fixed to the value at that point in time. This is no different to how regular JavaScript variables behave.
+- We're not destructuring the counter at the usage site. Because we're using getters, destructuring would fix `count` and `double` to the value at that point in time. To keep the getters "alive", we're not using destructuring. Again, this is how regular JavaScript works.
+
+If you have shared state you want to manipulate from various places, you don't need to resort to getters. Instead, you can take advantage of `$state` being deeply reactive and only update its properties, not the value itself:
+
+```ts
+/// file: app-state.svelte.ts
+export const appState = $state({
+ loggedIn: true
+});
+```
+
+```svelte
+
+
+
+ (appState.loggedIn = false)}>Log out
+```
diff --git a/documentation/docs/03-runes/02-side-effects.md b/documentation/docs/03-runes/02-side-effects.md
new file mode 100644
index 0000000000..f7af6a6167
--- /dev/null
+++ b/documentation/docs/03-runes/02-side-effects.md
@@ -0,0 +1,360 @@
+---
+title: Side effects
+---
+
+- `$effect` (.pre)
+- when not to use it, better patterns for what to do instead
+
+Side effects play a crucial role in applications. They are triggered by state changes and can then interact with external systems, like logging something, setting up a server connection or synchronize with a third-party library that has no knowledge of Svelte's reactivity model.
+
+## `$effect` fundamentals
+
+To run _side-effects_ when the component is mounted to the DOM, and when values change, we can use the `$effect` rune ([demo](/#H4sIAAAAAAAAE31T24rbMBD9lUG7kAQ2sbdlX7xOYNk_aB_rQhRpbAsU2UiTW0P-vbrYubSlYGzmzMzROTPymdVKo2PFjzMzfIusYB99z14YnfoQuD1qQh-7bmdFQEonrOppVZmKNBI49QthCc-OOOH0LZ-9jxnR6c7eUpOnuv6KeT5JFdcqbvbcBcgDz1jXKGg6ncFyBedYR6IzLrAZwiN5vtSxaJA-EzadfJEjKw11C6GR22-BLH8B_wxdByWpvUYtqqal2XB6RVkG1CoHB6U1WJzbnYFDiwb3aGEdDa3Bm1oH12sQLTcNPp7r56m_00mHocSG97_zd7ICUXonA5fwKbPbkE2ZtMJGGVkEdctzQi4QzSwr9prnFYNk5hpmqVuqPQjNnfOJoMF22lUsrq_UfIN6lfSVyvQ7grB3X2mjMZYO3XO9w-U5iLx42qg29md3BP_ni5P4gy9ikTBlHxjLzAtPDlyYZmRdjAbGq7HprEQ7p64v4LU_guu0kvAkhBim3nMplWl8FreQD-CW20aZR0wq12t-KqDWeBywhvexKC3memmDwlHAv9q4Vo2ZK8KtK0CgX7u9J8wXbzdKv-nRnfF_2baTqlYoWUF2h5efl9-n0O6koAMAAA==)):
+
+```svelte
+
+
+
+```
+
+The function passed to `$effect` will run when the component mounts, and will re-run after any changes to the values it reads that were declared with `$state` or `$derived` (including those passed in with `$props`). Re-runs are batched (i.e. changing `color` and `size` in the same moment won't cause two separate runs), and happen after any DOM updates have been applied.
+
+You can return a function from `$effect`, which will run immediately before the effect re-runs, and before it is destroyed ([demo](/#H4sIAAAAAAAAE42SzW6DMBCEX2Vl5RDaVCQ9JoDUY--9lUox9lKsGBvZC1GEePcaKPnpqSe86_m0M2t6ViqNnu0_e2Z4jWzP3pqGbRhdmrHwHWrCUHvbOjF2Ei-caijLTU4aCYRtDUEKK0-ccL2NDstNrbRWHoU10t8Eu-121gTVCssSBa3XEaQZ9GMrpziGj0p5OAccCgSHwmEgJZwrNNihg6MyhK7j-gii4uYb_YyGUZ5guQwzPdL7b_U4ZNSOvp9T2B3m1rB5cLx4zMkhtc7AHz7YVCVwEFzrgosTBMuNs52SKDegaPbvWnMH8AhUXaNUIY6-hHCldQhUIcyLCFlfAuHvkCKaYk8iYevGGgy2wyyJnpy9oLwG0sjdNe2yhGhJN32HsUzi2xOapNpl_bSLIYnDeeoVLZE1YI3QSpzSfo7-8J5PKbwOmdf2jC6JZyD7HxpPaMk93aHhF6utVKVCyfbkWhy-hh9Z3o_2nQIAAA==)).
+
+```svelte
+
+
+{count}
+
+ (milliseconds *= 2)}>slower
+ (milliseconds /= 2)}>faster
+```
+
+## `$effect` dependencies
+
+`$effect` automatically picks up any reactivy values (`$state`, `$derived`, `$props`) that are _synchronously_ read inside its function body and registers them as dependencies. When those dependencies change, the `$effect` schedules a rerun.
+
+Values that are read asynchronously — after an `await` or inside a `setTimeout`, for example — will _not_ be tracked. Here, the canvas will be repainted when `color` changes, but not when `size` changes ([demo](/#H4sIAAAAAAAAE31T24rbMBD9lUG7kCxsbG_LvrhOoPQP2r7VhSjy2BbIspHGuTT436tLnMtSCiaOzpw5M2dGPrNaKrQs_3VmmnfIcvZ1GNgro9PgD3aPitCdbT8a4ZHCCiMH2pS6JIUEVv5BWMOzJU64fM9evswR0ave3EKLp7r-jFm2iIwri-s9tx5ywDPWNQpaLl9gvYFz4JHotfVqmvBITi9mJA3St4gtF5-qWZUuvEQo5Oa7F8tewT2XrIOsqL2eWpRNS7eGSkpToFZaOEilwODKjBoOLWrco4FtsLQF0XLdoE2S5LGmm6X6QSflBxKod8IW6afssB8_uAslndJuJNA9hWKw9VO91pmJ92XunHlu_J1nMDk8_p_8q0hvO9NFtA47qavcW12fIzJBmM26ZG9ZVjKIs7ke05hdyT0Ixa11Ad-P6ZUtWbgNheI7VJvYQiH14Bz5a-SYxvtwIqHonqsR12ff8ORkQ-chP70T-L9eGO4HvYAFwRh9UCxS13h0YP2CgmoyG5h3setNhWZF_ZDD23AE2ytZwZMQ4jLYgVeV1I2LYgfZBey4aaR-xCppB8VPOdQKjxes4UMgxcVcvwHf4dzAv9K4ko1eScLO5iDQXQFzL5gl7zdJt-nZnXYfbddXspZYsZzMiNPv6S8Bl41G7wMAAA==)):
+
+```ts
+// @filename: index.ts
+declare let canvas: {
+ width: number;
+ height: number;
+ getContext(type: '2d', options?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D;
+};
+declare let color: string;
+declare let size: number;
+
+// ---cut---
+$effect(() => {
+ const context = canvas.getContext('2d');
+ context.clearRect(0, 0, canvas.width, canvas.height);
+
+ // this will re-run whenever `color` changes...
+ context.fillStyle = color;
+
+ setTimeout(() => {
+ // ...but not when `size` changes
+ context.fillRect(0, 0, size, size);
+ }, 0);
+});
+```
+
+An effect only reruns when the object it reads changes, not when a property inside it changes. (If you want to observe changes _inside_ an object at dev time, you can use [`$inspect`](/docs/svelte/misc/debugging#$inspect).)
+
+```svelte
+
+
+ (state.value += 1)}>
+ {state.value}
+
+
+{state.value} doubled is {derived.value}
+```
+
+## When not to use `$effect`
+
+In general, `$effect` is best considered something of an escape hatch — useful for things like analytics and direct DOM manipulation — rather than a tool you should use frequently. In particular, avoid using it to synchronise state. Instead of this...
+
+```svelte
+
+```
+
+...do this:
+
+```svelte
+
+```
+
+> For things that are more complicated than a simple expression like `count * 2`, you can also use [`$derived.by`](#$derived-by).
+
+You might be tempted to do something convoluted with effects to link one value to another. The following example shows two inputs for "money spent" and "money left" that are connected to each other. If you update one, the other should update accordingly. Don't use effects for this ([demo](/#H4sIAAAAAAAACpVRy2rDMBD8lWXJwYE0dg-9KFYg31H3oNirIJBlYa1DjPG_F8l1XEop9LgzOzP7mFAbSwHF-4ROtYQCL97jAXn0sQh3skx4wNANfR2RMtS98XyuXMWWGLhjZUHCa1GcVix4cgwSdoEVU1bsn4wl_Y1I2kS6inekNdWcZXuQZ5giFDWpfwl5WYyT2fynbB1g1UWbTVbm2w6utOpKNq1TGucHhri6rLBX7kYVwtW4RtyVHUhOyXeGVj3klLxnyJP0i8lXNJUx6en-v6A48K85kTimpi0sYj-yAo-Wlh9FcL1LY4K3ahSgLT1OC3ZTXkBxfKN2uVC6T5LjAduuMdpQg4L7geaP-RNHPuClMQIAAA==)):
+
+```svelte
+
+
+
+
+ {spent}/{total} spent
+
+
+
+
+ {left}/{total} left
+
+```
+
+Instead, use callbacks where possible ([demo](/#H4sIAAAAAAAACo2SP2-DMBDFv8rp1CFR84cOXQhU6p6tY-ngwoEsGWPhI0pk8d0rG5yglqGj37v7veMJh7VUZDH9dKhFS5jiuzG4Q74Z_7AXUky4Q9sNfemVzJa9NPxW6IIVMXDHQkEOL0lyipo1pBlyeLIsmDbJ9u4oqhdG2A2mLrgedMmy0zCYSjB9eMaGtuC8WXBkPtOBRd8QHy5CDXSa3Jk7HbOfDgjWuAo_U71kz9vr6Bgc2X44orPjow2dKfFNKhSTSW0GBl9iXmAvdEMFQqDmLgBH6HQYyt3ie0doxTV3IWqEY2DN88eohqePvsf9O9mf_if4HMSVXD89NfEI99qvbMs3RdPv4MXYaSWtUeKWQq3oOlfZCJNCcnildlFgWMcdtl0la0kVptwPNH6NP_uzV0acAgAA)):
+
+```svelte
+
+
+
+
+ {spent}/{total} spent
+
+
+
+
+ {left}/{total} left
+
+```
+
+If you need to use bindings, for whatever reason (for example when you want some kind of "writable `$derived`"), consider using getters and setters to synchronise state ([demo](/#H4sIAAAAAAAACo2SQW-DMAyF_4pl7dBqXcsOu1CYtHtvO44dsmKqSCFExFRFiP8-xRCGth52tJ_9PecpA1bakMf0Y0CrasIU35zDHXLvQuGvZJhwh77p2nPoZP7casevhS3YEAM3rAzk8Jwkx9jzjixDDg-eFdMm2S6KoWolyK6ItuCqs2fWjYXOlYrpPTA2tIUhiAVH5iPtWbUX4v1VmY6Okzpzp2OepgNEGu_CT1St2fP2fXQ0juwwHNHZ4ScNmxn1RUaCybR1HUMIMS-wVfZCBYJQ80GAIzRWhvJh9d4RanXLB7Ea4SCsef4Qu1IG68Xu387h9D_GJ2ne8ZXpxTZUv1w994amjxCaMc1Se2dUn0Jl6DaHeFEuhWT_QvUqOlnHHdZNqStNJabcdjR-jt8IbC-7lgIAAA==)):
+
+```svelte
+
+
+
+
+ {spent}/{total} spent
+
+
+
+
+ {left.value}/{total} left
+
+```
+
+If you absolutely have to update `$state` within an effect and run into an infinite loop because you read and write to the same `$state`, use [untrack](functions#untrack).
+
+## `$effect.pre`
+
+In rare cases, you may need to run code _before_ the DOM updates. For this we can use the `$effect.pre` rune:
+
+```svelte
+
+
+
+ {#each messages as message}
+
{message}
+ {/each}
+
+```
+
+Apart from the timing, `$effect.pre` works exactly like [`$effect`](#$effect) — refer to its documentation for more info.
+
+## `$effect.tracking`
+
+The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template ([demo](/#H4sIAAAAAAAAE3XP0QrCMAwF0F-JRXAD595rLfgdzodRUyl0bVgzQcb-3VYFQfExl5tDMgvrPCYhT7MI_YBCiiOR2Aq-UxnSDT1jnlOcRlMSlczoiHUXOjYxpOhx5-O12rgAJg4UAwaGhDyR3Gxhjdai4V1v2N2wqus9tC3Y3ifMQjbehaqq4aBhLtEv_Or893icCsdLve-Caj8nBkU67zMO5HtGCfM3sKiWNKhV0zwVaBqd3x3ixVmHFyFLuJyXB-moOe8pAQAA)):
+
+```svelte
+
+
+in template: {$effect.tracking()}
+```
+
+This allows you to (for example) add things like subscriptions without causing memory leaks, by putting them in child effects. Here's a `readable` function that listens to changes from a callback function as long as it's inside a tracking context:
+
+```ts
+import { tick } from 'svelte';
+
+export default function readable(
+ initial_value: T,
+ start: (callback: (update: (v: T) => T) => T) => () => void
+) {
+ let value = $state(initial_value);
+
+ let subscribers = 0;
+ let stop: null | (() => void) = null;
+
+ return {
+ get value() {
+ // If in a tracking context ...
+ if ($effect.tracking()) {
+ $effect(() => {
+ // ...and there's no subscribers yet...
+ if (subscribers === 0) {
+ // ...invoke the function and listen to changes to update state
+ stop = start((fn) => (value = fn(value)));
+ }
+
+ subscribers++;
+
+ // The return callback is called once a listener unlistens
+ return () => {
+ tick().then(() => {
+ subscribers--;
+ // If it was the last subscriber...
+ if (subscribers === 0) {
+ // ...stop listening to changes
+ stop?.();
+ stop = null;
+ }
+ });
+ };
+ });
+ }
+
+ return value;
+ }
+ };
+}
+```
+
+## `$effect.root`
+
+The `$effect.root` rune is an advanced feature that creates a non-tracked scope that doesn't auto-cleanup. This is useful for
+nested effects that you want to manually control. This rune also allows for creation of effects outside of the component initialisation phase.
+
+```svelte
+
+```
diff --git a/documentation/docs/03-runes/index.md b/documentation/docs/03-runes/index.md
new file mode 100644
index 0000000000..8ade901351
--- /dev/null
+++ b/documentation/docs/03-runes/index.md
@@ -0,0 +1,3 @@
+---
+title: Runes
+---
diff --git a/documentation/docs/03-runtime/01-svelte.md b/documentation/docs/03-runtime/01-svelte.md
deleted file mode 100644
index da738b4594..0000000000
--- a/documentation/docs/03-runtime/01-svelte.md
+++ /dev/null
@@ -1,230 +0,0 @@
----
-title: svelte
----
-
-The `svelte` package exposes [lifecycle functions](https://learn.svelte.dev/tutorial/onmount) and the [context API](https://learn.svelte.dev/tutorial/context-api).
-
-## `onMount`
-
-> EXPORT_SNIPPET: svelte#onMount
-
-The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. It must be called during the component's initialisation (but doesn't need to live _inside_ the component; it can be called from an external module).
-
-`onMount` does not run inside a [server-side component](/docs/server-side-component-api).
-
-```svelte
-
-```
-
-If a function is returned from `onMount`, it will be called when the component is unmounted.
-
-```svelte
-
-```
-
-> This behaviour will only work when the function passed to `onMount` _synchronously_ returns a value. `async` functions always return a `Promise`, and as such cannot _synchronously_ return a function.
-
-## `beforeUpdate`
-
-> EXPORT_SNIPPET: svelte#beforeUpdate
-
-Schedules a callback to run immediately before the component is updated after any state change.
-
-> The first time the callback runs will be before the initial `onMount`
-
-```svelte
-
-```
-
-## `afterUpdate`
-
-> EXPORT_SNIPPET: svelte#afterUpdate
-
-Schedules a callback to run immediately after the component has been updated.
-
-> The first time the callback runs will be after the initial `onMount`
-
-```svelte
-
-```
-
-## `onDestroy`
-
-> EXPORT_SNIPPET: svelte#onDestroy
-
-Schedules a callback to run immediately before the component is unmounted.
-
-Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the only one that runs inside a server-side component.
-
-```svelte
-
-```
-
-## `tick`
-
-> EXPORT_SNIPPET: svelte#tick
-
-Returns a promise that resolves once any pending state changes have been applied, or in the next microtask if there are none.
-
-```svelte
-
-```
-
-## `setContext`
-
-> EXPORT_SNIPPET: svelte#setContext
-
-Associates an arbitrary `context` object with the current component and the specified `key` and returns that object. The context is then available to children of the component (including slotted content) with `getContext`.
-
-Like lifecycle functions, this must be called during component initialisation.
-
-```svelte
-
-```
-
-> Context is not inherently reactive. If you need reactive values in context then you can pass a store into context, which _will_ be reactive.
-
-## `getContext`
-
-> EXPORT_SNIPPET: svelte#getContext
-
-Retrieves the context that belongs to the closest parent component with the specified `key`. Must be called during component initialisation.
-
-```svelte
-
-```
-
-## `hasContext`
-
-> EXPORT_SNIPPET: svelte#hasContext
-
-Checks whether a given `key` has been set in the context of a parent component. Must be called during component initialisation.
-
-```svelte
-
-```
-
-## `getAllContexts`
-
-> EXPORT_SNIPPET: svelte#getAllContexts
-
-Retrieves the whole context map that belongs to the closest parent component. Must be called during component initialisation. Useful, for example, if you programmatically create a component and want to pass the existing context to it.
-
-```svelte
-
-```
-
-## `createEventDispatcher`
-
-> EXPORT_SNIPPET: svelte#createEventDispatcher
-
-Creates an event dispatcher that can be used to dispatch [component events](/docs/component-directives#on-eventname). Event dispatchers are functions that can take two arguments: `name` and `detail`.
-
-Component events created with `createEventDispatcher` create a [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture). The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) property and can contain any type of data.
-
-```svelte
-
-
- dispatch('notify', 'detail value')}>Fire Event
-```
-
-Events dispatched from child components can be listened to in their parent. Any data provided when the event was dispatched is available on the `detail` property of the event object.
-
-```svelte
-
-
-
-```
-
-Events can be cancelable by passing a third parameter to the dispatch function. The function returns `false` if the event is cancelled with `event.preventDefault()`, otherwise it returns `true`.
-
-```svelte
-
-```
-
-You can type the event dispatcher to define which events it can receive. This will make your code more type safe both within the component (wrong calls are flagged) and when using the component (types of the events are now narrowed). See [here](typescript#script-lang-ts-events) how to do it.
-
-## Types
-
-> TYPES: svelte
diff --git a/documentation/docs/03-runtime/03-svelte-motion.md b/documentation/docs/03-runtime/03-svelte-motion.md
deleted file mode 100644
index a0b8d95623..0000000000
--- a/documentation/docs/03-runtime/03-svelte-motion.md
+++ /dev/null
@@ -1,169 +0,0 @@
----
-title: 'svelte/motion'
----
-
-The `svelte/motion` module exports two functions, `tweened` and `spring`, for creating writable stores whose values change over time after `set` and `update`, rather than immediately.
-
-## `tweened`
-
-> EXPORT_SNIPPET: svelte/motion#tweened
-
-Tweened stores update their values over a fixed duration. The following options are available:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number` | `function`, default 400) — milliseconds the tween lasts
-- `easing` (`function`, default `t => t`) — an [easing function](/docs/svelte-easing)
-- `interpolate` (`function`) — see below
-
-`store.set` and `store.update` can accept a second `options` argument that will override the options passed in upon instantiation.
-
-Both functions return a Promise that resolves when the tween completes. If the tween is interrupted, the promise will never resolve.
-
-Out of the box, Svelte will interpolate between two numbers, two arrays or two objects (as long as the arrays and objects are the same 'shape', and their 'leaf' properties are also numbers).
-
-```svelte
-
-
-
- embiggen
-
-```
-
-If the initial value is `undefined` or `null`, the first value change will take effect immediately. This is useful when you have tweened values that are based on props, and don't want any motion when the component first renders.
-
-```ts
-// @filename: ambient.d.ts
-declare global {
- var $size: number;
- var big: number;
-}
-
-export {};
-// @filename: motion.ts
-// ---cut---
-import { tweened } from 'svelte/motion';
-import { cubicOut } from 'svelte/easing';
-
-const size = tweened(undefined, {
- duration: 300,
- easing: cubicOut
-});
-
-$: $size = big ? 100 : 10;
-```
-
-The `interpolate` option allows you to tween between _any_ arbitrary values. It must be an `(a, b) => t => value` function, where `a` is the starting value, `b` is the target value, `t` is a number between 0 and 1, and `value` is the result. For example, we can use the [d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours.
-
-```svelte
-
-
-{#each colors as c}
- color.set(c)}>
- {c}
-
-{/each}
-
-{$color}
-```
-
-## `spring`
-
-> EXPORT_SNIPPET: svelte/motion#spring
-
-A `spring` store gradually changes to its target value based on its `stiffness` and `damping` parameters. Whereas `tweened` stores change their values over a fixed duration, `spring` stores change over a duration that is determined by their existing velocity, allowing for more natural-seeming motion in many situations. The following options are available:
-
-- `stiffness` (`number`, default `0.15`) — a value between 0 and 1 where higher means a 'tighter' spring
-- `damping` (`number`, default `0.8`) — a value between 0 and 1 where lower means a 'springier' spring
-- `precision` (`number`, default `0.01`) — determines the threshold at which the spring is considered to have 'settled', where lower means more precise
-
-All of the options above can be changed while the spring is in motion, and will take immediate effect.
-
-```js
-import { spring } from 'svelte/motion';
-
-const size = spring(100);
-size.stiffness = 0.3;
-size.damping = 0.4;
-size.precision = 0.005;
-```
-
-As with [`tweened`](/docs/svelte-motion#tweened) stores, `set` and `update` return a Promise that resolves if the spring settles.
-
-Both `set` and `update` can take a second argument — an object with `hard` or `soft` properties. `{ hard: true }` sets the target value immediately; `{ soft: n }` preserves existing momentum for `n` seconds before settling. `{ soft: true }` is equivalent to `{ soft: 0.5 }`.
-
-```js
-import { spring } from 'svelte/motion';
-
-const coords = spring({ x: 50, y: 50 });
-// updates the value immediately
-coords.set({ x: 100, y: 200 }, { hard: true });
-// preserves existing momentum for 1s
-coords.update(
- (target_coords, coords) => {
- return { x: target_coords.x, y: coords.y };
- },
- { soft: 1 }
-);
-```
-
-[See a full example on the spring tutorial.](https://learn.svelte.dev/tutorial/springs)
-
-```svelte
-
-```
-
-If the initial value is `undefined` or `null`, the first value change will take effect immediately, just as with `tweened` values (see above).
-
-```ts
-// @filename: ambient.d.ts
-declare global {
- var $size: number;
- var big: number;
-}
-
-export {};
-
-// @filename: motion.ts
-// ---cut---
-import { spring } from 'svelte/motion';
-
-const size = spring();
-$: $size = big ? 100 : 10;
-```
-
-## Types
-
-> TYPES: svelte/motion
diff --git a/documentation/docs/03-runtime/04-svelte-transition.md b/documentation/docs/03-runtime/04-svelte-transition.md
deleted file mode 100644
index fe8d184e1a..0000000000
--- a/documentation/docs/03-runtime/04-svelte-transition.md
+++ /dev/null
@@ -1,300 +0,0 @@
----
-title: 'svelte/transition'
----
-
-The `svelte/transition` module exports seven functions: `fade`, `blur`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with Svelte [`transitions`](/docs/element-directives#transition-fn).
-
-## `fade`
-
-> EXPORT_SNIPPET: svelte/transition#fade
-
-```svelte
-
-transition:fade={params}
-```
-
-```svelte
-
-in:fade={params}
-```
-
-```svelte
-
-out:fade={params}
-```
-
-Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions.
-
-`fade` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number`, default 400) — milliseconds the transition lasts
-- `easing` (`function`, default `linear`) — an [easing function](/docs/svelte-easing)
-
-You can see the `fade` transition in action in the [transition tutorial](https://learn.svelte.dev/tutorial/transition).
-
-```svelte
-
-
-{#if condition}
- fades in and out
-{/if}
-```
-
-## `blur`
-
-> EXPORT_SNIPPET: svelte/transition#blur
-
-```svelte
-
-transition:blur={params}
-```
-
-```svelte
-
-in:blur={params}
-```
-
-```svelte
-
-out:blur={params}
-```
-
-Animates a `blur` filter alongside an element's opacity.
-
-`blur` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number`, default 400) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicInOut`) — an [easing function](/docs/svelte-easing)
-- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
-- `amount` (`number | string`, default 5) - the size of the blur. Supports css units (for example: `"4rem"`). The default unit is `px`
-
-```svelte
-
-
-{#if condition}
- fades in and out
-{/if}
-```
-
-## `fly`
-
-> EXPORT_SNIPPET: svelte/transition#fly
-
-```svelte
-
-transition:fly={params}
-```
-
-```svelte
-
-in:fly={params}
-```
-
-```svelte
-
-out:fly={params}
-```
-
-Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values.
-
-`fly` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number`, default 400) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
-- `x` (`number | string`, default 0) - the x offset to animate out to and in from
-- `y` (`number | string`, default 0) - the y offset to animate out to and in from
-- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
-
-x and y use `px` by default but support css units, for example `x: '100vw'` or `y: '50%'`.
-You can see the `fly` transition in action in the [transition tutorial](https://learn.svelte.dev/tutorial/adding-parameters-to-transitions).
-
-```svelte
-
-
-{#if condition}
-
- flies in and out
-
-{/if}
-```
-
-## `slide`
-
-> EXPORT_SNIPPET: svelte/transition#slide
-
-```svelte
-
-transition:slide={params}
-```
-
-```svelte
-
-in:slide={params}
-```
-
-```svelte
-
-out:slide={params}
-```
-
-Slides an element in and out.
-
-`slide` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number`, default 400) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
-
-* `axis` (`x` | `y`, default `y`) — the axis of motion along which the transition occurs
-
-```svelte
-
-
-{#if condition}
-
- slides in and out horizontally
-
-{/if}
-```
-
-## `scale`
-
-> EXPORT_SNIPPET: svelte/transition#scale
-
-```svelte
-
-transition:scale={params}
-```
-
-```svelte
-
-in:scale={params}
-```
-
-```svelte
-
-out:scale={params}
-```
-
-Animates the opacity and scale of an element. `in` transitions animate from an element's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element's default values.
-
-`scale` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number`, default 400) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
-- `start` (`number`, default 0) - the scale value to animate out to and in from
-- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
-
-```svelte
-
-
-{#if condition}
-
- scales in and out
-
-{/if}
-```
-
-## `draw`
-
-> EXPORT_SNIPPET: svelte/transition#draw
-
-```svelte
-
-transition:draw={params}
-```
-
-```svelte
-
-in:draw={params}
-```
-
-```svelte
-
-out:draw={params}
-```
-
-Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `` and ``.
-
-`draw` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `speed` (`number`, default undefined) - the speed of the animation, see below.
-- `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicInOut`) — an [easing function](/docs/svelte-easing)
-
-The `speed` parameter is a means of setting the duration of the transition relative to the path's length. It is a modifier that is applied to the length of the path: `duration = length / speed`. A path that is 1000 pixels with a speed of 1 will have a duration of `1000ms`, setting the speed to `0.5` will double that duration and setting it to `2` will halve it.
-
-```svelte
-
-
-
- {#if condition}
-
- {/if}
-
-```
-
-## `crossfade`
-
-> EXPORT_SNIPPET: svelte/transition#crossfade
-
-The `crossfade` function creates a pair of [transitions](/docs/element-directives#transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
-
-`crossfade` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
-- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
-- `fallback` (`function`) — A fallback [transition](/docs/element-directives#transition-fn) to use for send when there is no matching element being received, and for receive when there is no element being sent.
-
-```svelte
-
-
-{#if condition}
- BIG ELEM
-{:else}
- small elem
-{/if}
-```
-
-## Types
-
-> TYPES: svelte/transition
diff --git a/documentation/docs/03-runtime/05-svelte-animate.md b/documentation/docs/03-runtime/05-svelte-animate.md
deleted file mode 100644
index 44be6d448b..0000000000
--- a/documentation/docs/03-runtime/05-svelte-animate.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-title: 'svelte/animate'
----
-
-The `svelte/animate` module exports one function for use with Svelte [animations](/docs/element-directives#animate-fn).
-
-## `flip`
-
-> EXPORT_SNIPPET: svelte/animate#flip
-
-```svelte
-
-animate:flip={params}
-```
-
-The `flip` function calculates the start and end position of an element and animates between them, translating the `x` and `y` values. `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/).
-
-`flip` accepts the following parameters:
-
-- `delay` (`number`, default 0) — milliseconds before starting
-- `duration` (`number` | `function`, default `d => Math.sqrt(d) * 120`) — see below
-- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
-
-`duration` can be provided as either:
-
-- a `number`, in milliseconds.
-- a function, `distance: number => duration: number`, receiving the distance the element will travel in pixels and returning the duration in milliseconds. This allows you to assign a duration that is relative to the distance travelled by each element.
-
-You can see a full example on the [animations tutorial](https://learn.svelte.dev/tutorial/animate).
-
-```svelte
-
-
-{#each list as n (n)}
-
- {n}
-
-{/each}
-```
-
-## Types
-
-> TYPES: svelte/animate
diff --git a/documentation/docs/03-runtime/06-svelte-easing.md b/documentation/docs/03-runtime/06-svelte-easing.md
deleted file mode 100644
index f98d4001f0..0000000000
--- a/documentation/docs/03-runtime/06-svelte-easing.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: 'svelte/easing'
----
-
-Easing functions specify the rate of change over time and are useful when working with Svelte's built-in transitions and animations as well as the tweened and spring utilities. `svelte/easing` contains 31 named exports, a `linear` ease and 3 variants of 10 different easing functions: `in`, `out` and `inOut`.
-
-You can explore the various eases using the [ease visualiser](/examples/easing) in the [examples section](/examples).
-
-| ease | in | out | inOut |
-| ----------- | ----------- | ------------ | -------------- |
-| **back** | `backIn` | `backOut` | `backInOut` |
-| **bounce** | `bounceIn` | `bounceOut` | `bounceInOut` |
-| **circ** | `circIn` | `circOut` | `circInOut` |
-| **cubic** | `cubicIn` | `cubicOut` | `cubicInOut` |
-| **elastic** | `elasticIn` | `elasticOut` | `elasticInOut` |
-| **expo** | `expoIn` | `expoOut` | `expoInOut` |
-| **quad** | `quadIn` | `quadOut` | `quadInOut` |
-| **quart** | `quartIn` | `quartOut` | `quartInOut` |
-| **quint** | `quintIn` | `quintOut` | `quintInOut` |
-| **sine** | `sineIn` | `sineOut` | `sineInOut` |
-
-
-
-
diff --git a/documentation/docs/03-runtime/meta.json b/documentation/docs/03-runtime/meta.json
deleted file mode 100644
index 729784bc2b..0000000000
--- a/documentation/docs/03-runtime/meta.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "title": "Runtime"
-}
diff --git a/documentation/docs/04-compiler-and-api/01-svelte-compiler.md b/documentation/docs/04-compiler-and-api/01-svelte-compiler.md
deleted file mode 100644
index 014a2617a3..0000000000
--- a/documentation/docs/04-compiler-and-api/01-svelte-compiler.md
+++ /dev/null
@@ -1,302 +0,0 @@
----
-title: 'svelte/compiler'
----
-
-Typically, you won't interact with the Svelte compiler directly, but will instead integrate it into your build system using a bundler plugin. The bundler plugin that the Svelte team most recommends and invests in is [vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte). The [SvelteKit](https://kit.svelte.dev/) framework provides a setup leveraging `vite-plugin-svelte` to build applications as well as a [tool for packaging Svelte component libraries](https://kit.svelte.dev/docs/packaging). Svelte Society maintains a list of [other bundler plugins](https://sveltesociety.dev/tools/#bundling) for additional tools like Rollup and Webpack.
-
-Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you.
-
-## compile
-
-> EXPORT_SNIPPET: svelte/compiler#compile
-
-This is where the magic happens. `svelte.compile` takes your component source code, and turns it into a JavaScript module that exports a class.
-
-```js
-// @filename: ambient.d.ts
-declare global {
- var source: string
-}
-
-export {}
-
-// @filename: index.ts
-// ---cut---
-import { compile } from 'svelte/compiler';
-
-const result = compile(source, {
- // options
-});
-```
-
-Refer to [CompileOptions](#types-compileoptions) for all the available options.
-
-The returned `result` object contains the code for your component, along with useful bits of metadata.
-
-```ts
-// @filename: ambient.d.ts
-declare global {
- const source: string;
-}
-
-export {};
-
-// @filename: main.ts
-import { compile } from 'svelte/compiler';
-// ---cut---
-const { js, css, ast, warnings, vars, stats } = compile(source);
-```
-
-Refer to [CompileResult](#types-compileresult) for a full description of the compile result.
-
-## parse
-
-> EXPORT_SNIPPET: svelte/compiler#parse
-
-The `parse` function parses a component, returning only its abstract syntax tree. Unlike compiling with the `generate: false` option, this will not perform any validation or other analysis of the component beyond parsing it. Note that the returned AST is not considered public API, so breaking changes could occur at any point in time.
-
-```js
-// @filename: ambient.d.ts
-declare global {
- var source: string;
-}
-
-export {};
-
-// @filename: main.ts
-// ---cut---
-import { parse } from 'svelte/compiler';
-
-const ast = parse(source, { filename: 'App.svelte' });
-```
-
-## preprocess
-
-> EXPORT_SNIPPET: svelte/compiler#preprocess
-
-A number of [official and community-maintained preprocessing plugins](https://sveltesociety.dev/tools#preprocessors) are available to allow you to use Svelte with tools like TypeScript, PostCSS, SCSS, and Less.
-
-You can write your own preprocessor using the `svelte.preprocess` API.
-
-The `preprocess` function provides convenient hooks for arbitrarily transforming component source code. For example, it can be used to convert a `