more use cases

pull/16867/head
Stanislav Khromov 2 months ago
parent 865d49cc41
commit d0d7c5629f

@ -1,5 +1,6 @@
---
title: Stores
use_cases: "reactive state management, cross-component state, async data streams, RxJS patterns"
---
<!-- - how to use

@ -1,5 +1,6 @@
---
title: Context
use_cases: "component communication, dependency injection, avoiding prop drilling, theme providers"
---
Context allows components to access values owned by parent components without passing them down as props (potentially through many layers of intermediate components, known as 'prop-drilling'). The parent component sets context with `setContext(key, value)`...

@ -1,5 +1,6 @@
---
title: Lifecycle hooks
use_cases: "initialization logic, cleanup, DOM access, third-party library setup"
---
<!-- - onMount/onDestroy

@ -1,5 +1,6 @@
---
title: Imperative component API
use_cases: "programmatic component control, testing, framework integration, dynamic component creation"
---
<!-- better title needed?

@ -1,3 +1,4 @@
---
title: Runtime
use_cases: "always: runtime behavior, component lifecycle, state management"
---

@ -1,5 +1,6 @@
---
title: Testing
use_cases: "unit testing, integration testing, E2E testing, test-driven development, CI/CD"
---
Testing helps you write and maintain your code and guard against regressions. Testing frameworks help you with that, allowing you to describe assertions or expectations about how your code should behave. Svelte is unopinionated about which testing framework you use — you can write unit tests, integration tests, and end-to-end tests using solutions like [Vitest](https://vitest.dev/), [Jasmine](https://jasmine.github.io/), [Cypress](https://www.cypress.io/) and [Playwright](https://playwright.dev/).

@ -1,5 +1,6 @@
---
title: TypeScript
use_cases: "type safety, IDE support, component APIs, prop validation, large applications"
---
<!-- - [basically what we have today](https://svelte.dev/docs/typescript)

@ -1,5 +1,6 @@
---
title: Custom elements
use_cases: "web components, framework-agnostic components, micro-frontends, design systems"
---
<!-- - [basically what we have today](https://svelte.dev/docs/custom-elements-api) -->

@ -1,5 +1,6 @@
---
title: Svelte 4 migration guide
use_cases: "upgrading from Svelte 3, migration, breaking changes, version updates"
---
This migration guide provides an overview of how to migrate from Svelte version 3 to 4. See the linked PRs for more details about each change. Use the migration script to migrate some of these automatically: `npx svelte-migrate@latest svelte-4`

@ -1,5 +1,6 @@
---
title: Frequently asked questions
use_cases: "troubleshooting, best practices, common questions, learning resources"
---
## I'm new to Svelte. Where should I start?

@ -1,3 +1,4 @@
---
title: Misc
use_cases: "additional resources, guides, troubleshooting"
---

@ -1,5 +1,6 @@
---
title: svelte
use_cases: "always: main API reference, core functions, component utilities"
---
> MODULE: svelte

@ -1,5 +1,6 @@
---
title: svelte/action
use_cases: "legacy actions, DOM manipulation, typing actions"
---
This module provides types for [actions](use), which have been superseded by [attachments](@attach).

@ -1,5 +1,6 @@
---
title: svelte/animate
use_cases: "flip animations, list transitions, keyed blocks"
---
> MODULE: svelte/animate

@ -1,5 +1,6 @@
---
title: svelte/attachments
use_cases: "DOM manipulation, third-party libraries, modern alternative to actions"
---
> MODULE: svelte/attachments

@ -1,5 +1,6 @@
---
title: svelte/compiler
use_cases: "build tools, preprocessors, custom compilation, bundler plugins"
---
> MODULE: svelte/compiler

@ -1,5 +1,6 @@
---
title: svelte/easing
use_cases: "animation curves, transition timing, smooth animations"
---
> MODULE: svelte/easing

@ -1,5 +1,6 @@
---
title: svelte/events
use_cases: "event handling, event delegation, custom events"
---
> MODULE: svelte/events

@ -1,5 +1,6 @@
---
title: svelte/legacy
use_cases: "migration helpers, backwards compatibility, gradual migration"
---
This module provides various functions for use during the migration, since some features can't be replaced one to one with new features. All imports are marked as deprecated and should be migrated away from over time.

@ -1,5 +1,6 @@
---
title: svelte/motion
use_cases: "spring animations, tweened values, physics-based animations"
---
> MODULE: svelte/motion

@ -1,5 +1,6 @@
---
title: svelte/reactivity/window
use_cases: "window properties, reactive viewport dimensions, scroll position"
---
This module exports reactive versions of various `window` values, each of which has a reactive `current` property that you can reference in reactive contexts (templates, [deriveds]($derived) and [effects]($effect)) without using [`<svelte:window>`](svelte-window) bindings or manually creating your own event listeners.

@ -1,5 +1,6 @@
---
title: svelte/reactivity
use_cases: "reactive collections, Map/Set alternatives, reactive URLs, reactive utilities"
---
Svelte provides reactive versions of various built-ins like [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) and [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) that can be used just like their native counterparts, as well as a handful of additional utilities for handling reactivity.

@ -1,5 +1,6 @@
---
title: svelte/server
use_cases: "SSR, server-side rendering, static generation"
---
> MODULE: svelte/server

@ -1,5 +1,6 @@
---
title: svelte/store
use_cases: "writable stores, readable stores, derived stores, store contract"
---
> MODULE: svelte/store

@ -1,5 +1,6 @@
---
title: svelte/transition
use_cases: "fade, fly, slide, scale, draw transitions, crossfade"
---
> MODULE: svelte/transition

@ -1,5 +1,6 @@
---
title: 'Compiler errors'
use_cases: "error reference, debugging, troubleshooting compilation"
---
@include .generated/compile-errors.md

@ -1,5 +1,6 @@
---
title: 'Compiler warnings'
use_cases: "warning reference, best practices, code quality"
---
Svelte warns you at compile time if it catches potential mistakes, such as writing inaccessible markup.

@ -1,5 +1,6 @@
---
title: 'Runtime errors'
use_cases: "error reference, debugging runtime issues, troubleshooting"
---
## Client errors

@ -1,5 +1,6 @@
---
title: 'Runtime warnings'
use_cases: "warning reference, performance optimization, best practices"
---
## Client warnings

@ -1,3 +1,4 @@
---
title: Reference
use_cases: "API reference, module documentation, error reference"
---

@ -1,5 +1,6 @@
---
title: Overview
use_cases: "Svelte 3/4 documentation, legacy syntax, migration reference"
---
Svelte 5 introduced some significant changes to Svelte's API, including [runes](what-are-runes), [snippets](snippet) and event attributes. As a result, some Svelte 3/4 features are deprecated (though supported for now, unless otherwise specified) and will eventually be removed. We recommend that you incrementally [migrate your existing code](v5-migration-guide).

@ -1,5 +1,6 @@
---
title: Reactive let/var declarations
use_cases: "legacy: reactive variables, Svelte 3/4 state"
---
In runes mode, reactive state is explicitly declared with the [`$state` rune]($state).

@ -1,5 +1,6 @@
---
title: Reactive $: statements
use_cases: "legacy: reactive statements, derived values, side effects"
---
In runes mode, reactions to state updates are handled with the [`$derived`]($derived) and [`$effect`]($effect) runes.

@ -1,5 +1,6 @@
---
title: export let
use_cases: "legacy: component props, Svelte 3/4 props"
---
In runes mode, [component props](basic-markup#Component-props) are declared with the [`$props`]($props) rune, allowing parent components to pass in data.

@ -1,5 +1,6 @@
---
title: $$props and $$restProps
title: $props and $restProps
use_cases: "legacy: spread props, rest props, prop forwarding"
---
In runes mode, getting an object containing all the props that were passed in is easy, using the [`$props`]($props) rune.

@ -1,5 +1,6 @@
---
title: on:
use_cases: "legacy: event handling, event modifiers, component events"
---
In runes mode, event handlers are just like any other attribute or prop.

@ -1,5 +1,6 @@
---
title: <slot>
use_cases: "legacy: content projection, component composition, slot props"
---
In Svelte 5, content can be passed to components in the form of [snippets](snippet) and rendered using [render tags](@render).

@ -1,5 +1,6 @@
---
title: $$slots
title: $slots
use_cases: "legacy: slot detection, conditional slots"
---
In runes mode, we know which [snippets](snippet) were provided to a component, as they're just normal props.

@ -1,5 +1,6 @@
---
title: <svelte:fragment>
use_cases: "legacy: wrapper-free slots, multiple slot elements"
---
The `<svelte:fragment>` element allows you to place content in a [named slot](legacy-slots) without wrapping it in a container DOM element. This keeps the flow layout of your document intact.

@ -1,5 +1,6 @@
---
title: <svelte:component>
use_cases: "legacy: dynamic components, component switching"
---
In runes mode, `<MyComponent>` will re-render if the value of `MyComponent` changes. See the [Svelte 5 migration guide](/docs/svelte/v5-migration-guide#svelte:component-is-no-longer-necessary) for an example.

@ -1,5 +1,6 @@
---
title: <svelte:self>
use_cases: "legacy: recursive components, self-referencing"
---
The `<svelte:self>` element allows a component to include itself, recursively.

Loading…
Cancel
Save