diff --git a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md
index dfa211ee96..9778e16a2f 100644
--- a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md
+++ b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md
@@ -102,13 +102,6 @@ function parse(
-## parse
-
-The parse function parses a component, returning only its abstract syntax tree.
-
-The `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.
-`modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7.
-
```ts
diff --git a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-events.md b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-events.md
index 1078efa675..e589af673d 100644
--- a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-events.md
+++ b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-events.md
@@ -32,12 +32,6 @@ function on(
-## on
-
-Attaches an event handler to the document and returns a function that removes the handler. Using this
-rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
-(with attributes like `onclick`), which use event delegation for performance reasons
-
```ts
@@ -55,12 +49,6 @@ function on(
-## on
-
-Attaches an event handler to an element and returns a function that removes the handler. Using this
-rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
-(with attributes like `onclick`), which use event delegation for performance reasons
-
```ts
@@ -81,12 +69,6 @@ function on<
-## on
-
-Attaches an event handler to an element and returns a function that removes the handler. Using this
-rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
-(with attributes like `onclick`), which use event delegation for performance reasons
-
```ts
@@ -107,12 +89,6 @@ function on<
-## on
-
-Attaches an event handler to an element and returns a function that removes the handler. Using this
-rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
-(with attributes like `onclick`), which use event delegation for performance reasons
-
```ts
diff --git a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-store.md b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-store.md
index 8dbd5f5777..72d8908bc9 100644
--- a/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-store.md
+++ b/apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-store.md
@@ -39,11 +39,6 @@ function derived(
-## derived
-
-Derived value store by synchronizing one or more readable stores and
-applying an aggregation function over its input values.
-
```ts
@@ -72,10 +67,6 @@ function fromStore(store: Writable): {
-## fromStore
-
-
-
```ts
@@ -145,10 +136,6 @@ function toStore(
-## toStore
-
-
-
```ts
diff --git a/apps/svelte.dev/scripts/sync-docs/index.ts b/apps/svelte.dev/scripts/sync-docs/index.ts
index b22357b0ed..af88aad0fa 100644
--- a/apps/svelte.dev/scripts/sync-docs/index.ts
+++ b/apps/svelte.dev/scripts/sync-docs/index.ts
@@ -33,11 +33,12 @@ const packages: Package[] = [
m.types!.find((t) => t?.name === 'ActionReturn')
);
const new_children =
- module_with_ActionReturn?.types![1].children!.filter((c) => c.name !== '$$_attributes') ||
- [];
+ module_with_ActionReturn?.types![1].overloads[0].children!.filter(
+ (c) => c.name !== '$$_attributes'
+ ) || [];
if (module_with_ActionReturn) {
- module_with_ActionReturn.types![1].children = new_children;
+ module_with_ActionReturn.types![1].overloads[0].children = new_children;
}
return modules;
diff --git a/apps/svelte.dev/scripts/sync-docs/types.ts b/apps/svelte.dev/scripts/sync-docs/types.ts
index 8b93079723..d7986688af 100644
--- a/apps/svelte.dev/scripts/sync-docs/types.ts
+++ b/apps/svelte.dev/scripts/sync-docs/types.ts
@@ -1,18 +1,8 @@
import fs from 'node:fs';
import ts from 'typescript';
import { format } from 'prettier';
-import { type Modules } from '@sveltejs/site-kit/markdown';
import { strip_origin } from './utils';
-
-interface Extracted {
- name: string;
- comment: string;
- markdown?: string;
- snippet: string;
- deprecated?: string | null;
- children: Extracted[];
- bullets?: string[];
-}
+import type { Modules, Declaration, TypeElement } from '@sveltejs/site-kit/markdown';
export async function read_types(base: string, modules: Modules) {
{
@@ -51,8 +41,8 @@ export async function read_types(base: string, modules: Modules) {
}
export async function get_types(code: string, statements: ts.NodeArray) {
- const exports: Extracted[] = [];
- const types: Extracted[] = [];
+ const exports: Declaration[] = [];
+ const types: Declaration[] = [];
if (statements) {
for (const statement of statements) {
@@ -116,7 +106,7 @@ export async function get_types(code: string, statements: ts.NodeArray statement.name === name);
+
+ if (declaration) {
+ // TODO tidy these up in the source
+ if (cleanup_comment(comment) !== declaration.comment) {
+ console.warn(`${name} overload has mismatched comment`);
+ }
+
+ if (deprecated_notice !== declaration.deprecated) {
+ console.warn(`${name} overload has mismatched deprecation notices`);
+ }
+ } else {
+ declaration = {
+ name,
+ comment: cleanup_comment(comment),
+ deprecated: deprecated_notice,
+ overloads: []
+ };
+
+ collection.push(declaration);
+ }
+
+ declaration.overloads.push({
snippet,
- children,
- deprecated: deprecated_notice
+ children
});
}
}
@@ -179,13 +188,13 @@ export async function get_types(code: string, statements: ts.NodeArray {\n let result = 0;\n for (const n of numbers) {\n result += n;\n }\n return result;\n});\n```\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$derived-by",
- "snippet": "function by(fn: () => T): T;",
- "children": []
- },
- {
- "name": "call",
- "snippet": "const call: never;",
- "children": []
- },
- {
- "name": "caller",
- "snippet": "const caller: never;",
- "children": []
- },
- {
- "name": "length",
- "snippet": "const length: never;",
- "children": []
- },
- {
- "name": "name",
- "snippet": "const name: never;",
- "children": []
- },
- {
- "name": "prototype",
- "snippet": "const prototype: never;",
- "children": []
- },
- {
- "name": "toString",
- "snippet": "const toString: never;",
- "children": []
- }
- ]
- },
- {
- "name": "$effect",
- "comment": "",
- "types": [],
- "exports": [
- {
- "name": "active",
- "comment": "The `$effect.active` rune is an advanced feature that tells you whether or not the code is running inside an effect or inside your template.\n\nExample:\n```svelte\n\n\n
in template: {$effect.active()}
\n```\n\nThis allows you to (for example) add things like subscriptions without causing memory leaks, by putting them in child effects.\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$effect-active",
- "snippet": "function active(): boolean;",
- "children": []
- },
- {
- "name": "apply",
- "snippet": "const apply: never;",
- "children": []
- },
- {
- "name": "arguments",
- "snippet": "const arguments: never;",
- "children": []
- },
- {
- "name": "bind",
- "snippet": "const bind: never;",
- "children": []
- },
- {
- "name": "call",
- "snippet": "const call: never;",
- "children": []
- },
- {
- "name": "caller",
- "snippet": "const caller: never;",
- "children": []
- },
- {
- "name": "length",
- "snippet": "const length: never;",
- "children": []
- },
- {
- "name": "name",
- "snippet": "const name: never;",
- "children": []
- },
- {
- "name": "pre",
- "comment": "Runs code right before a component is mounted to the DOM, and then whenever its dependencies change, i.e. `$state` or `$derived` values.\nThe timing of the execution is right before the DOM is updated.\n\nExample:\n```ts\n$effect.pre(() => console.log('The count is now ' + count));\n```\n\nIf you return a function from the effect, it will be called right before the effect is run again, or when the component is unmounted.\n\nDoes not run during server side rendering.\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$effect-pre",
- "snippet": "function pre(fn: () => void | (() => void)): void;",
- "children": []
- },
- {
- "name": "prototype",
- "snippet": "const prototype: never;",
- "children": []
- },
- {
- "name": "root",
- "comment": "The `$effect.root` rune is an advanced feature that creates a non-tracked scope that doesn't auto-cleanup. This is useful for\nnested effects that you want to manually control. This rune also allows for creation of effects outside of the component\ninitialisation phase.\n\nExample:\n```svelte\n\n\n\n```\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$effect-root",
- "snippet": "function root(fn: () => void | (() => void)): () => void;",
- "children": []
- },
- {
- "name": "toString",
- "snippet": "const toString: never;",
- "children": []
- }
- ]
- },
- {
- "name": "$state",
- "comment": "",
- "types": [],
- "exports": [
- {
- "name": "apply",
- "snippet": "const apply: never;",
- "children": []
- },
- {
- "name": "arguments",
- "snippet": "const arguments: never;",
- "children": []
- },
- {
- "name": "bind",
- "snippet": "const bind: never;",
- "children": []
- },
- {
- "name": "call",
- "snippet": "const call: never;",
- "children": []
- },
- {
- "name": "caller",
- "snippet": "const caller: never;",
- "children": []
- },
- {
- "name": "frozen",
- "comment": "Declares reactive read-only state that is shallowly immutable.\n\nExample:\n```ts\n\n\n\n```\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$state-raw",
- "snippet": "function frozen(initial: T): Readonly;",
- "children": []
- },
- {
- "name": "frozen",
- "comment": "",
- "snippet": "function frozen(): Readonly | undefined;",
- "children": []
- },
- {
- "name": "length",
- "snippet": "const length: never;",
- "children": []
- },
- {
- "name": "name",
- "snippet": "const name: never;",
- "children": []
- },
- {
- "name": "prototype",
- "snippet": "const prototype: never;",
- "children": []
- },
- {
- "name": "snapshot",
- "comment": "To take a static snapshot of a deeply reactive `$state` proxy, use `$state.snapshot`:\n\nExample:\n```ts\n\n```\n\nhttps://svelte-5-preview.vercel.app/docs/runes#$state.snapshot",
- "snippet": "function snapshot(state: T): T;",
- "children": []
- },
- {
- "name": "toString",
- "snippet": "const toString: never;",
- "children": []
- }
- ]
- },
- {
- "name": "svelte",
- "comment": "",
- "types": [
- {
- "name": "ComponentConstructorOptions",
- "snippet": "interface ComponentConstructorOptions<\n\tProps extends Record = Record\n> {/*…*/}",
- "children": [
- {
- "name": "target",
- "snippet": "target: Element | Document | ShadowRoot;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "anchor",
- "snippet": "anchor?: Element;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "props",
- "snippet": "props?: Props;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "context",
- "snippet": "context?: Map;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "hydrate",
- "snippet": "hydrate?: boolean;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "intro",
- "snippet": "intro?: boolean;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "$$inline",
- "snippet": "$$inline?: boolean;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ],
- "deprecated": "Svelte components were classes in Svelte 4. In Svelte 5, thy are not anymore.\nUse `mount` or `createRoot` instead to instantiate components.\nSee [breaking changes](https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes)\nfor more info."
- },
- {
- "name": "ComponentEvents",
- "comment": "Convenience type to get the events the given component expects. Example:\n```html\n\n\n\n```",
- "snippet": "type ComponentEvents =\n\tComp extends SvelteComponent\n\t\t? Events\n\t\t: never;",
- "children": []
- },
- {
- "name": "ComponentProps",
- "comment": "Convenience type to get the props the given component expects. Example:\n```html\n\n```",
- "snippet": "type ComponentProps =\n\tComp extends SvelteComponent ? Props : never;",
- "children": []
- },
- {
- "name": "ComponentType",
- "comment": "Convenience type to get the type of a Svelte component. Useful for example in combination with\ndynamic components using ``.\n\nExample:\n```html\n\n\n\n\n```",
- "snippet": "type ComponentType<\n\tComp extends SvelteComponent = SvelteComponent\n> = (new (\n\toptions: ComponentConstructorOptions<\n\t\tComp extends SvelteComponent\n\t\t\t? Props\n\t\t\t: Record\n\t>\n) => Comp) & {\n\t/** The custom element version of the component. Only present if compiled with the `customElement` compiler option */\n\telement?: typeof HTMLElement;\n};",
- "children": []
- },
- {
- "name": "EventDispatcher",
- "comment": "",
- "snippet": "interface EventDispatcher<\n\tEventMap extends Record\n> {/*…*/}",
- "children": [
- {
- "snippet": "(\n\t...args: null extends EventMap[Type]\n\t\t? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions]\n\t\t: undefined extends EventMap[Type]\n\t\t\t? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions]\n\t\t\t: [type: Type, parameter: EventMap[Type], options?: DispatchOptions]\n): boolean;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- },
- {
- "name": "Snippet",
- "comment": "The type of a `#snippet` block. You can use it to (for example) express that your component expects a snippet of a certain type:\n```ts\nlet { banner }: { banner: Snippet<{ text: string }> } = $props();\n```\nYou can only call a snippet through the `{@render ...}` tag.",
- "snippet": "type Snippet =\n\t// this conditional allows tuples but not arrays. Arrays would indicate a\n\t// rest parameter type, which is not supported. If rest parameters are added\n\t// in the future, the condition can be removed.\n\tnumber extends T['length']\n\t\t? never\n\t\t: {\n\t\t\t\t(\n\t\t\t\t\tthis: void,\n\t\t\t\t\t...args: T\n\t\t\t\t): typeof SnippetReturn & {\n\t\t\t\t\t_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"';\n\t\t\t\t};\n\t\t\t};",
- "children": []
- },
- {
- "name": "SvelteComponent",
- "comment": "Can be used to create strongly typed Svelte components.\n\n#### Example:\n\nYou have component library on npm called `component-library`, from which\nyou export a component called `MyComponent`. For Svelte+TypeScript users,\nyou want to provide typings. Therefore you create a `index.d.ts`:\n```ts\nimport { SvelteComponent } from \"svelte\";\nexport class MyComponent extends SvelteComponent<{foo: string}> {}\n```\nTyping this makes it possible for IDEs like VS Code with the Svelte extension\nto provide intellisense and to use the component like this in a Svelte file\nwith TypeScript:\n```svelte\n\n\n```\n\nThis was the base class for Svelte components in Svelte 4. Svelte 5+ components\nare completely different under the hood. You should only use this type for typing,\nnot actually instantiate components with `new` - use `mount` or `createRoot` instead.\nSee [breaking changes](https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes)\nfor more info.",
- "snippet": "class SvelteComponent<\n\tProps extends Record = Record,\n\tEvents extends Record = any,\n\tSlots extends Record = any\n> {/*…*/}",
- "children": [
- {
- "name": "element",
- "snippet": "static element?: typeof HTMLElement;",
- "comment": "The custom element version of the component. Only present if compiled with the `customElement` compiler option",
- "bullets": [],
- "children": []
- },
- {
- "snippet": "[prop: string]: any;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "snippet": "constructor(options: ComponentConstructorOptions>);",
- "comment": "",
- "bullets": [
- "- deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which\nis a stop-gap solution. Migrate towards using `mount` or `createRoot` instead. See\nhttps://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more info."
- ],
- "children": []
- },
- {
- "name": "$destroy",
- "snippet": "$destroy(): void;",
- "comment": "",
- "bullets": [
- "- deprecated This method only exists when using one of the legacy compatibility helpers, which\nis a stop-gap solution. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes\nfor more info."
- ],
- "children": []
- },
- {
- "name": "$on",
- "snippet": "$on>(\n\ttype: K,\n\tcallback: (e: Events[K]) => void\n): () => void;",
- "comment": "",
- "bullets": [
- "- deprecated This method only exists when using one of the legacy compatibility helpers, which\nis a stop-gap solution. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes\nfor more info."
- ],
- "children": []
- },
- {
- "name": "$set",
- "snippet": "$set(props: Partial): void;",
- "comment": "",
- "bullets": [
- "- deprecated This method only exists when using one of the legacy compatibility helpers, which\nis a stop-gap solution. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes\nfor more info."
- ],
- "children": []
- }
- ]
- },
- {
- "name": "SvelteComponentTyped",
- "snippet": "class SvelteComponentTyped<\n\tProps extends Record = Record,\n\tEvents extends Record = any,\n\tSlots extends Record = any\n> extends SvelteComponent {}",
- "children": [],
- "deprecated": "Use `SvelteComponent` instead. See TODO for more information."
- }
- ],
- "exports": [
- {
- "name": "afterUpdate",
- "comment": "Schedules a callback to run immediately after the component has been updated.\n\nThe first time the callback runs will be after the initial `onMount`.\n\nIn runes mode use `$effect` instead.\n\nhttps://svelte.dev/docs/svelte#afterupdate",
- "snippet": "function afterUpdate(fn: () => void): void;",
- "children": [],
- "deprecated": "Use `$effect` instead — see https://svelte-5-preview.vercel.app/docs/deprecations#beforeupdate-and-afterupdate"
- },
- {
- "name": "beforeUpdate",
- "comment": "Schedules a callback to run immediately before the component is updated after any state change.\n\nThe first time the callback runs will be before the initial `onMount`.\n\nIn runes mode use `$effect.pre` instead.\n\nhttps://svelte.dev/docs/svelte#beforeupdate",
- "snippet": "function beforeUpdate(fn: () => void): void;",
- "children": [],
- "deprecated": "Use `$effect.pre` instead — see https://svelte-5-preview.vercel.app/docs/deprecations#beforeupdate-and-afterupdate"
- },
- {
- "name": "createEventDispatcher",
- "comment": "Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname).\nEvent dispatchers are functions that can take two arguments: `name` and `detail`.\n\nComponent events created with `createEventDispatcher` create a\n[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\nThese events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\nThe `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\nproperty and can contain any type of data.\n\nThe event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:\n```ts\nconst dispatch = createEventDispatcher<{\n loaded: never; // does not take a detail argument\n change: string; // takes a detail argument of type string, which is required\n optional: number | null; // takes an optional detail argument of type number\n}>();\n```\n\nhttps://svelte.dev/docs/svelte#createeventdispatcher",
- "snippet": "function createEventDispatcher<\n\tEventMap extends Record = any\n>(): EventDispatcher;",
- "children": [],
- "deprecated": "Use callback props and/or the `$host()` rune instead — see https://svelte-5-preview.vercel.app/docs/deprecations#createeventdispatcher"
- },
- {
- "name": "flushSync",
- "comment": "Synchronously flushes any pending state changes and those that result from it.",
- "snippet": "function flushSync(fn?: (() => void) | undefined): void;",
- "children": []
- },
- {
- "name": "getAllContexts",
- "comment": "Retrieves the whole context map that belongs to the closest parent component.\nMust be called during component initialisation. Useful, for example, if you\nprogrammatically create a component and want to pass the existing context to it.\n\nhttps://svelte.dev/docs/svelte#getallcontexts",
- "snippet": "function getAllContexts<\n\tT extends Map = Map\n>(): T;",
- "children": []
- },
- {
- "name": "getContext",
- "comment": "Retrieves the context that belongs to the closest parent component with the specified `key`.\nMust be called during component initialisation.\n\nhttps://svelte.dev/docs/svelte#getcontext",
- "snippet": "function getContext(key: any): T;",
- "children": []
- },
- {
- "name": "hasContext",
- "comment": "Checks whether a given `key` has been set in the context of a parent component.\nMust be called during component initialisation.\n\nhttps://svelte.dev/docs/svelte#hascontext",
- "snippet": "function hasContext(key: any): boolean;",
- "children": []
- },
- {
- "name": "hydrate",
- "comment": "Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component",
- "snippet": "function hydrate<\n\tProps extends Record,\n\tExports extends Record,\n\tEvents extends Record\n>(\n\tcomponent: ComponentType<\n\t\tSvelteComponent\n\t>,\n\toptions: {\n\t\ttarget: Document | Element | ShadowRoot;\n\t\tprops?: Props | undefined;\n\t\tevents?:\n\t\t\t| {\n\t\t\t\t\t[Property in keyof Events]: (\n\t\t\t\t\t\te: Events[Property]\n\t\t\t\t\t) => any;\n\t\t\t }\n\t\t\t| undefined;\n\t\tcontext?: Map | undefined;\n\t\tintro?: boolean | undefined;\n\t\trecover?: boolean | undefined;\n\t}\n): Exports;",
- "children": []
- },
- {
- "name": "mount",
- "comment": "Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component",
- "snippet": "function mount<\n\tProps extends Record,\n\tExports extends Record,\n\tEvents extends Record\n>(\n\tcomponent: ComponentType<\n\t\tSvelteComponent\n\t>,\n\toptions: {\n\t\ttarget: Document | Element | ShadowRoot;\n\t\tanchor?: Node | undefined;\n\t\tprops?: Props | undefined;\n\t\tevents?:\n\t\t\t| {\n\t\t\t\t\t[Property in keyof Events]: (\n\t\t\t\t\t\te: Events[Property]\n\t\t\t\t\t) => any;\n\t\t\t }\n\t\t\t| undefined;\n\t\tcontext?: Map | undefined;\n\t\tintro?: boolean | undefined;\n\t}\n): Exports;",
- "children": []
- },
- {
- "name": "onDestroy",
- "comment": "Schedules a callback to run immediately before the component is unmounted.\n\nOut of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\nonly one that runs inside a server-side component.\n\nhttps://svelte.dev/docs/svelte#ondestroy",
- "snippet": "function onDestroy(fn: () => any): void;",
- "children": []
- },
- {
- "name": "onMount",
- "comment": "The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.\nIt must be called during the component's initialisation (but doesn't need to live *inside* the component;\nit can be called from an external module).\n\nIf a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.\n\n`onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).\n\nhttps://svelte.dev/docs/svelte#onmount",
- "snippet": "function onMount(\n\tfn: () =>\n\t\t| NotFunction\n\t\t| Promise>\n\t\t| (() => any)\n): void;",
- "children": []
- },
- {
- "name": "setContext",
- "comment": "Associates an arbitrary `context` object with the current component and the specified `key`\nand returns that object. The context is then available to children of the component\n(including slotted content) with `getContext`.\n\nLike lifecycle functions, this must be called during component initialisation.\n\nhttps://svelte.dev/docs/svelte#setcontext",
- "snippet": "function setContext(key: any, context: T): T;",
- "children": []
- },
- {
- "name": "tick",
- "comment": "Returns a promise that resolves once any pending state changes have been applied.",
- "snippet": "function tick(): Promise;",
- "children": []
- },
- {
- "name": "unmount",
- "comment": "Unmounts a component that was previously mounted using `mount` or `hydrate`.",
- "snippet": "function unmount(component: Record): void;",
- "children": []
- },
- {
- "name": "untrack",
- "comment": "Use `untrack` to prevent something from being treated as an `$effect`/`$derived` dependency.\n\nhttps://svelte-5-preview.vercel.app/docs/functions#untrack",
- "snippet": "function untrack(fn: () => T): T;",
- "children": []
- }
- ]
- },
- {
- "name": "svelte/action",
- "comment": "",
- "types": [
- {
- "name": "Action",
- "comment": "Actions are functions that are called when an element is created.\nYou can use this interface to type such actions.\nThe following example defines an action that only works on `
` elements\nand optionally accepts a parameter which it has a default value for:\n```ts\nexport const myAction: Action = (node, param = { someProperty: true }) => {\n // ...\n}\n```\n`Action` and `Action` both signal that the action accepts no parameters.\n\nYou can return an object with methods `update` and `destroy` from the function and type which additional attributes and events it has.\nSee interface `ActionReturn` for more details.\n\nDocs: https://svelte.dev/docs/svelte-action",
- "snippet": "interface Action<\n\tElement = HTMLElement,\n\tParameter = undefined,\n\tAttributes extends Record = Record<\n\t\tnever,\n\t\tany\n\t>\n> {/*…*/}",
- "children": [
- {
- "snippet": "(\n\t...args: undefined extends Parameter\n\t\t? [node: Node, parameter?: Parameter]\n\t\t: [node: Node, parameter: Parameter]\n): void | ActionReturn;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- },
- {
- "name": "ActionReturn",
- "comment": "Actions can return an object containing the two properties defined in this interface. Both are optional.\n- update: An action can have a parameter. This method will be called whenever that parameter changes,\n immediately after Svelte has applied updates to the markup. `ActionReturn` and `ActionReturn` both\n mean that the action accepts no parameters.\n- destroy: Method that is called after the element is unmounted\n\nAdditionally, you can specify which additional attributes and events the action enables on the applied element.\nThis applies to TypeScript typings only and has no effect at runtime.\n\nExample usage:\n```ts\ninterface Attributes {\n\tnewprop?: string;\n\t'on:event': (e: CustomEvent) => void;\n}\n\nexport function myAction(node: HTMLElement, parameter: Parameter): ActionReturn {\n\t// ...\n\treturn {\n\t\tupdate: (updatedParameter) => {...},\n\t\tdestroy: () => {...}\n\t};\n}\n```\n\nDocs: https://svelte.dev/docs/svelte-action",
- "snippet": "interface ActionReturn<\n\tParameter = undefined,\n\tAttributes extends Record = Record<\n\t\tnever,\n\t\tany\n\t>\n> {/*…*/}",
- "children": [
- {
- "name": "update",
- "snippet": "update?: (parameter: Parameter) => void;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "destroy",
- "snippet": "destroy?: () => void;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- }
- ],
- "exports": []
- },
- {
- "name": "svelte/animate",
- "comment": "",
- "types": [
- {
- "name": "AnimationConfig",
- "comment": "",
- "snippet": "interface AnimationConfig {/*…*/}",
- "children": [
- {
- "name": "delay",
- "snippet": "delay?: number;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "duration",
- "snippet": "duration?: number;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "easing",
- "snippet": "easing?: (t: number) => number;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "css",
- "snippet": "css?: (t: number, u: number) => string;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "tick",
- "snippet": "tick?: (t: number, u: number) => void;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- },
- {
- "name": "FlipParams",
- "comment": "",
- "snippet": "interface FlipParams {/*…*/}",
- "children": [
- {
- "name": "delay",
- "snippet": "delay?: number;",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "duration",
- "snippet": "duration?: number | ((len: number) => number);",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "easing",
- "snippet": "easing?: (t: number) => number;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- }
- ],
- "exports": [
- {
- "name": "flip",
- "comment": "The flip function calculates the start and end position of an element and animates between them, translating the x and y values.\n`flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/).\n\nhttps://svelte.dev/docs/svelte-animate#flip",
- "snippet": "function flip(\n\tnode: Element,\n\t{\n\t\tfrom,\n\t\tto\n\t}: {\n\t\tfrom: DOMRect;\n\t\tto: DOMRect;\n\t},\n\tparams?: FlipParams\n): AnimationConfig;",
- "children": []
- }
- ]
- },
- {
- "name": "svelte/compiler",
- "comment": "",
- "types": [
- {
- "name": "CompileError",
- "comment": "",
- "snippet": "class CompileError extends Error {/*…*/}",
- "children": [
- {
- "snippet": "constructor(code: string, message: string, position: [number, number] | undefined);",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "filename",
- "snippet": "filename: CompileError_1['filename'];",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "position",
- "snippet": "position: CompileError_1['position'];",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "start",
- "snippet": "start: CompileError_1['start'];",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "end",
- "snippet": "end: CompileError_1['end'];",
- "comment": "",
- "bullets": [],
- "children": []
- },
- {
- "name": "code",
- "snippet": "code: string;",
- "comment": "",
- "bullets": [],
- "children": []
- }
- ]
- }
- ],
- "exports": [
- {
- "name": "VERSION",
- "comment": "The current version, as set in package.json.\n\nhttps://svelte.dev/docs/svelte-compiler#svelte-version",
- "snippet": "const VERSION: string;",
- "children": []
- },
- {
- "name": "compile",
- "comment": "`compile` converts your `.svelte` source code into a JavaScript module that exports a component\n\nhttps://svelte.dev/docs/svelte-compiler#svelte-compile",
- "snippet": "function compile(\n\tsource: string,\n\toptions: CompileOptions\n): CompileResult;",
- "children": []
- },
- {
- "name": "compileModule",
- "comment": "`compileModule` takes your JavaScript source code containing runes, and turns it into a JavaScript module.\n\nhttps://svelte.dev/docs/svelte-compiler#svelte-compile",
- "snippet": "function compileModule(\n\tsource: string,\n\toptions: ModuleCompileOptions\n): CompileResult;",
- "children": []
- },
- {
- "name": "migrate",
- "comment": "Does a best-effort migration of Svelte code towards using runes, event attributes and render tags.\nMay throw an error if the code is too complex to migrate automatically.",
- "snippet": "function migrate(source: string): {\n\tcode: string;\n};",
- "children": []
- },
- {
- "name": "parse",
- "comment": "The parse function parses a component, returning only its abstract syntax tree.\n\nThe `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.\n`modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7.\n\nhttps://svelte.dev/docs/svelte-compiler#svelte-parse",
- "snippet": "function parse(\n\tsource: string,\n\toptions: {\n\t\tfilename?: string;\n\t\tmodern: true;\n\t}\n): Root;",
- "children": []
- },
- {
- "name": "parse",
- "comment": "The parse function parses a component, returning only its abstract syntax tree.\n\nThe `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.\n`modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7.\n\nhttps://svelte.dev/docs/svelte-compiler#svelte-parse",
- "snippet": "function parse(\n\tsource: string,\n\toptions?:\n\t\t| {\n\t\t\t\tfilename?: string | undefined;\n\t\t\t\tmodern?: false | undefined;\n\t\t }\n\t\t| undefined\n): LegacyRoot;",
- "children": []
- },
- {
- "name": "preprocess",
- "comment": "The preprocess function provides convenient hooks for arbitrarily transforming component source code.\nFor example, it can be used to convert a