From ced9a261ba533ba2078921a829562eccbbf49c3e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 19 Oct 2024 10:26:06 -0400 Subject: [PATCH] more --- documentation/docs/02-runes/05-$props.md | 2 +- documentation/docs/02-runes/06-$bindable.md | 2 +- documentation/docs/02-runes/07-$inspect.md | 2 +- documentation/docs/02-runes/08-$host.md | 2 +- .../01-component-fundamentals.md | 202 ------------------ 5 files changed, 4 insertions(+), 206 deletions(-) delete mode 100644 documentation/docs/03-template-syntax/01-component-fundamentals.md diff --git a/documentation/docs/02-runes/05-$props.md b/documentation/docs/02-runes/05-$props.md index 3041884254..1ac90662c7 100644 --- a/documentation/docs/02-runes/05-$props.md +++ b/documentation/docs/02-runes/05-$props.md @@ -2,4 +2,4 @@ title: $props --- -TODO +Coming soon! diff --git a/documentation/docs/02-runes/06-$bindable.md b/documentation/docs/02-runes/06-$bindable.md index 35d0d9143d..b2b5661eb4 100644 --- a/documentation/docs/02-runes/06-$bindable.md +++ b/documentation/docs/02-runes/06-$bindable.md @@ -2,4 +2,4 @@ title: $bindable --- -TODO +Coming soon! diff --git a/documentation/docs/02-runes/07-$inspect.md b/documentation/docs/02-runes/07-$inspect.md index ad256ede14..8bfb708bce 100644 --- a/documentation/docs/02-runes/07-$inspect.md +++ b/documentation/docs/02-runes/07-$inspect.md @@ -2,4 +2,4 @@ title: $inspect --- -TODO +Coming soon! diff --git a/documentation/docs/02-runes/08-$host.md b/documentation/docs/02-runes/08-$host.md index c8cd21c58b..dee06943b5 100644 --- a/documentation/docs/02-runes/08-$host.md +++ b/documentation/docs/02-runes/08-$host.md @@ -2,4 +2,4 @@ title: $host --- -TODO +Coming soon! diff --git a/documentation/docs/03-template-syntax/01-component-fundamentals.md b/documentation/docs/03-template-syntax/01-component-fundamentals.md deleted file mode 100644 index 0e5597c020..0000000000 --- a/documentation/docs/03-template-syntax/01-component-fundamentals.md +++ /dev/null @@ -1,202 +0,0 @@ ---- -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 - - - - - -``` - -## ` -``` - -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're using JavaScript, you can declare the prop types using JSDoc: - -```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](bindings#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. - -## ` - - -``` - -## ` -``` - -For more information regarding styling, read the documentation around [styles and classes](styles-and-classes).