Skip to content

Commit 59c1623

Browse files
authored
Merge pull request #2 from tomoam/sync-fork
2024-10-24 迄の更新に追従
2 parents f1a9f42 + feb2ae3 commit 59c1623

File tree

71 files changed

+409
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+409
-287
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ dist
55
pnpm-lock.yaml
66
.vercel
77
_generated.md
8-
land-110m.json
8+
land-110m.json
9+
/apps/svelte.dev/content/docs

apps/kit.svelte.dev/vercel.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
},
99
{
1010
"source": "/docs/modules",
11-
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit",
12-
"permanent": true
11+
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit"
1312
},
1413
{
1514
"source": "/docs/types",
16-
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit",
15+
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit"
16+
},
17+
{
18+
"source": "/docs",
19+
"destination": "https://svelte.dev/docs/kit",
1720
"permanent": true
1821
},
1922
{

apps/svelte.dev/content/docs/kit/10-getting-started/10-introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ title: イントロダクション
44

55
## Before we begin
66

7-
> [!NOTE] Svelte や SvelteKit が初めてなら、こちらの[インタラクティブなチュートリアル](/tutorial)をチェックしてみることをおすすめします。
7+
> [!NOTE] Svelte や SvelteKit が初めてなら、こちらの[インタラクティブなチュートリアル](/tutorial/kit)をチェックしてみることをおすすめします。
88
>
99
> 行き詰まったら、[Discord chatroom](https://svelte.dev/chat) でヘルプを求めてください。
1010
1111
## What is SvelteKit?
1212

13-
SvelteKit は、[Svelte](https://svelte.dev/) を使用して堅牢でハイパフォーマンスな web アプリケーションを迅速に開発するためのフレームワークです。もしあなたが React 界隈から来たのであれば、SvelteKit は Next に似ているものです。Vue 界隈から来たのであれば、Nuxt に似ています。
13+
SvelteKit は、[Svelte](../svelte) を使用して堅牢でハイパフォーマンスな web アプリケーションを迅速に開発するためのフレームワークです。もしあなたが React 界隈から来たのであれば、SvelteKit は Next に似ているものです。Vue 界隈から来たのであれば、Nuxt に似ています。
1414

1515
SvelteKit で構築することのできるアプリケーションの種類については、[FAQ](faq#What-can-I-make-with-SvelteKit) をご覧ください。
1616

1717
## What is Svelte?
1818

19-
In short, Svelte is a way of writing user interface components — like a navigation bar, comment section, or contact form — that users see and interact with in their browsers. The Svelte compiler converts your components to JavaScript that can be run to render the HTML for the page and to CSS that styles the page. You don't need to know Svelte to understand the rest of this guide, but it will help. If you'd like to learn more, check out [the Svelte tutorial](https://svelte.dev/tutorial).
19+
In short, Svelte is a way of writing user interface components — like a navigation bar, comment section, or contact form — that users see and interact with in their browsers. The Svelte compiler converts your components to JavaScript that can be run to render the HTML for the page and to CSS that styles the page. You don't need to know Svelte to understand the rest of this guide, but it will help. If you'd like to learn more, check out [the Svelte tutorial](/tutorial).
2020

2121
## SvelteKit vs Svelte
2222

apps/svelte.dev/content/docs/kit/10-getting-started/20-creating-a-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The first command will scaffold a new project in the `my-app` directory asking y
1515

1616
There are two basic concepts:
1717

18-
- Each page of your app is a [Svelte](https://svelte.dev) component
18+
- Each page of your app is a [Svelte](../svelte) component
1919
- You create pages by adding files to the `src/routes` directory of your project. These will be server-rendered so that a user's first visit to your app is as fast as possible, then a client-side app takes over
2020

2121
Try editing the files to get a feel for how everything works.

apps/svelte.dev/content/docs/kit/20-core-concepts/10-routing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ In turn, annotating the `load` function with `PageLoad`, `PageServerLoad`, `Layo
384384
385385
If you're using VS Code or any IDE that supports the language server protocol and TypeScript plugins then you can omit these types _entirely_! Svelte's IDE tooling will insert the correct types for you, so you'll get type checking without writing them yourself. It also works with our command line tool `svelte-check`.
386386
387-
You can read more about omitting `$types` in our [blog post](https://svelte.dev/blog/zero-config-type-safety) about it.
387+
You can read more about omitting `$types` in our [blog post](/blog/zero-config-type-safety) about it.
388388
389389
## Other files
390390
@@ -394,6 +394,6 @@ If components and modules are needed by multiple routes, it's a good idea to put
394394
395395
## Further reading
396396
397-
- [Tutorial: Routing](https://learn.svelte.dev/tutorial/pages)
398-
- [Tutorial: API routes](https://learn.svelte.dev/tutorial/get-handlers)
397+
- [Tutorial: Routing](/tutorial/kit/pages)
398+
- [Tutorial: API routes](/tutorial/kit/get-handlers)
399399
- [Docs: Advanced routing](advanced-routing)

apps/svelte.dev/content/docs/kit/20-core-concepts/20-load.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function load({ params }) {
3434

3535
Thanks to the generated `$types` module, we get full type safety.
3636

37-
A `load` function in a `+page.js` file runs both on the server and in the browser (unless combined with `export const ssr = false`, in which case it will [only run in the browser](https://kit.svelte.dev/docs/page-options#ssr)). If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
37+
A `load` function in a `+page.js` file runs both on the server and in the browser (unless combined with `export const ssr = false`, in which case it will [only run in the browser](page-options#ssr)). If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
3838

3939
A more realistic version of your blog post's `load` function, that only runs on the server and pulls data from a database, might look like this:
4040

@@ -120,8 +120,8 @@ Data returned from layout `load` functions is available to child `+layout.svelte
120120
121121
+++ // we can access `data.posts` because it's returned from
122122
// the parent layout `load` function
123-
$: index = data.posts.findIndex(post => post.slug === $page.params.slug);
124-
$: next = data.posts[index - 1];+++
123+
let index = $derived(data.posts.findIndex(post => post.slug === $page.params.slug));
124+
let next = $derived(data.posts[index - 1];)+++
125125
</script>
126126
127127
<h1>{data.post.title}</h1>
@@ -675,7 +675,7 @@ To summarize, a `load` function will rerun in the following situations:
675675

676676
`params` and `url` can change in response to a `<a href="..">` link click, a [`<form>` interaction](form-actions#GET-vs-POST), a [`goto`]($app-navigation#goto) invocation, or a [`redirect`](@sveltejs-kit#redirect).
677677

678-
Note that rerunning a `load` function will update the `data` prop inside the corresponding `+layout.svelte` or `+page.svelte`; it does _not_ cause the component to be recreated. As a result, internal state is preserved. If this isn't what you want, you can reset whatever you need to reset inside an [`afterNavigate`]($app-navigation#afterNavigate) callback, and/or wrap your component in a [`{#key ...}`](https://svelte.dev/docs#template-syntax-key) block.
678+
Note that rerunning a `load` function will update the `data` prop inside the corresponding `+layout.svelte` or `+page.svelte`; it does _not_ cause the component to be recreated. As a result, internal state is preserved. If this isn't what you want, you can reset whatever you need to reset inside an [`afterNavigate`]($app-navigation#afterNavigate) callback, and/or wrap your component in a [`{#key ...}`](../svelte/key) block.
679679

680680
## Implications for authentication
681681

@@ -693,6 +693,6 @@ Putting an auth guard in `+layout.server.js` requires all child pages to call `a
693693

694694
## Further reading
695695

696-
- [Tutorial: Loading data](https://learn.svelte.dev/tutorial/page-data)
697-
- [Tutorial: Errors and redirects](https://learn.svelte.dev/tutorial/error-basics)
698-
- [Tutorial: Advanced loading](https://learn.svelte.dev/tutorial/await-parent)
696+
- [Tutorial: Loading data](/tutorial/kit/page-data)
697+
- [Tutorial: Errors and redirects](/tutorial/kit/error-basics)
698+
- [Tutorial: Advanced loading](/tutorial/kit/await-parent)

apps/svelte.dev/content/docs/kit/20-core-concepts/30-form-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,4 +518,4 @@ Submitting this form will navigate to `/search?q=...` and invoke your load funct
518518
519519
## Further reading
520520
521-
- [Tutorial: Forms](https://learn.svelte.dev/tutorial/the-form-element)
521+
- [Tutorial: Forms](/tutorial/kit/the-form-element)

apps/svelte.dev/content/docs/kit/20-core-concepts/40-page-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ export const config = {
219219

220220
## Further reading
221221

222-
- [Tutorial: Page options](https://learn.svelte.dev/tutorial/page-options)
222+
- [Tutorial: Page options](/tutorial/kit/page-options)

apps/svelte.dev/content/docs/kit/20-core-concepts/50-state-management.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If you're not using SSR, then there's no risk of accidentally exposing one user'
8282

8383
## Using stores with context
8484

85-
You might wonder how we're able to use `$page.data` and other [app stores]($app-stores) if we can't use our own stores. The answer is that app stores on the server use Svelte's [context API](https://learn.svelte.dev/tutorial/context-api) — the store is attached to the component tree with `setContext`, and when you subscribe you retrieve it with `getContext`. We can do the same thing with our own stores:
85+
You might wonder how we're able to use `$page.data` and other [app stores]($app-stores) if we can't use our own stores. The answer is that app stores on the server use Svelte's [context API](/tutorial/svelte/context-api) — the store is attached to the component tree with `setContext`, and when you subscribe you retrieve it with `getContext`. We can do the same thing with our own stores:
8686

8787
```svelte
8888
<!--- file: src/routes/+layout.svelte --->
@@ -143,16 +143,16 @@ When you navigate around your application, SvelteKit reuses existing layout and
143143

144144
...then navigating from `/blog/my-short-post` to `/blog/my-long-post` won't cause the layout, page and any other components within to be destroyed and recreated. Instead the `data` prop (and by extension `data.title` and `data.content`) will update (as it would with any other Svelte component) and, because the code isn't rerunning, lifecycle methods like `onMount` and `onDestroy` won't rerun and `estimatedReadingTime` won't be recalculated.
145145

146-
Instead, we need to make the value [_reactive_](https://learn.svelte.dev/tutorial/reactive-assignments):
146+
Instead, we need to make the value [_reactive_](/tutorial/svelte/state):
147147

148148
```svelte
149149
/// file: src/routes/blog/[slug]/+page.svelte
150150
<script>
151151
/** @type {import('./$types').PageData} */
152152
export let data;
153153
154-
+++ $: wordCount = data.content.split(' ').length;
155-
$: estimatedReadingTime = wordCount / 250;+++
154+
+++ let wordCount = $state(data.content.split(' ').length);
155+
let estimatedReadingTime = $derived(wordCount / 250);+++
156156
</script>
157157
```
158158

0 commit comments

Comments
 (0)