Skip to content

Commit 4003546

Browse files
committed
Merge remote-tracking branch 'sveltejs/main' into update-up-to-20230606
2 parents 13e169c + 0dabafd commit 4003546

File tree

8 files changed

+69
-93
lines changed

8 files changed

+69
-93
lines changed

content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ let count = 0;
1212
+++$: doubled = count * 2;+++
1313
```
1414

15+
リアクティブステートメント(reactive statement)が未宣言の変数への代入だけで構成されている場合、Svelte はあなたのかわりに `let` 宣言を注入します。
16+
1517
> これが少し異質に見えても心配しないでください。これは(見慣れないかもしれませんが) [正しい](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/label) JavaScript で、Svelte は「参照される値が変わるたびにこのコードを再実行する」という意味だと解釈します。一度慣れてしまえば、もう戻れません。
1618
1719
マークアップで `doubled` を使ってみましょう。

content/tutorial/01-svelte/04-logic/04-each-blocks/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: Each blocks
1111
<div>
1212
+++{#each colors as color}+++
1313
<button
14-
aria-current="{selected === 'red' ? 'true' : undefined}"
14+
aria-current={selected === 'red'}
1515
aria-label="red"
1616
style="background: red"
1717
on:click={() => selected = 'red'}
@@ -29,7 +29,7 @@ title: Each blocks
2929
<div>
3030
{#each colors as color}
3131
<button
32-
aria-current="{selected === +++color+++ ? 'true' : undefined}"
32+
aria-current={selected === +++color+++}
3333
aria-label=+++{color}+++
3434
style="background: +++{color}+++"
3535
on:click={() => selected = +++color+++}
@@ -45,7 +45,7 @@ title: Each blocks
4545
<div>
4646
{#each colors as color, +++i}+++
4747
<button
48-
aria-current="{selected === color ? 'true' : undefined}"
48+
aria-current={selected === color}
4949
aria-label={color}
5050
style="background: {color}"
5151
on:click={() => selected = color}

content/tutorial/03-sveltekit/05-shared-modules/01-lib/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ SvelteKit はディレクトリベースのルーティングを使用してい
2828
2929
<h1>home</h1>
3030
<p>{message}</p>
31-
```
31+
```

content/tutorial/04-advanced-sveltekit/05-advanced-loading/03-await-parent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function load(+++{ parent }+++) {
3030
最後に、`src/routes/sum/+page.js` で、両方の `load` 関数から返される親のデータを取得しましょう。
3131

3232
```js
33-
/// file: src/sum/+page.js
33+
/// file: src/routes/sum/+page.js
3434
export async function load(+++{ parent }+++) {
3535
+++const { a, b } = await parent();+++
3636
return { +++c: a + b+++ };

content/tutorial/common/src/__client.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ window.addEventListener('focusin', (e) => {
4949
post({ type: 'iframe_took_focus' });
5050
});
5151

52+
let previous_href = location.href;
53+
5254
window.addEventListener('click', (e) => {
5355
let node = e.target;
5456
while (node) {
@@ -60,7 +62,10 @@ window.addEventListener('click', (e) => {
6062
e.preventDefault();
6163
window.open(url, '_blank');
6264
} else {
63-
update_path(url.pathname + url.search + url.hash);
65+
if (location.href !== url.href) {
66+
previous_href = url.href;
67+
update_path(url.pathname + url.search + url.hash);
68+
}
6469
}
6570
}
6671
node = node.parent;
@@ -75,8 +80,6 @@ window.addEventListener('visibilitychange', () => {
7580
}
7681
});
7782

78-
let previous_href = location.href;
79-
8083
const url_observer = new MutationObserver(() => {
8184
if (location.href !== previous_href) {
8285
previous_href = location.href;

src/lib/client/adapters/webcontainer/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import AnsiToHtml from 'ansi-to-html';
44
import * as yootils from 'yootils';
55
import { escape_html, get_depth } from '../../../utils.js';
66
import { ready } from '../common/index.js';
7-
import { isWebContainerSupported } from './utils.js';
87

98
/**
109
* @typedef {import("../../../../routes/tutorial/[slug]/state.js").CompilerWarning} CompilerWarning
@@ -26,10 +25,6 @@ let vm;
2625
* @returns {Promise<import('$lib/types').Adapter>}
2726
*/
2827
export async function create(base, error, progress, logs, warnings) {
29-
if (!isWebContainerSupported()) {
30-
throw new Error('WebContainers are not supported by Safari 16.3 or earlier');
31-
}
32-
3328
progress.set({ value: 0, text: 'loading files' });
3429

3530
const q = yootils.queue(1);

src/lib/client/adapters/webcontainer/utils.js

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

src/routes/tutorial/[slug]/Loading.svelte

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script>
2-
import { isWebContainerSupported } from "$lib/client/adapters/webcontainer/utils.js";
3-
42
/** @type {boolean} */
53
export let initial;
64
@@ -14,54 +12,59 @@
1412
export let status;
1513
</script>
1614

17-
<div class="loading" class:error>
15+
<div class="loading">
1816
{#if error}
19-
{#if !isWebContainerSupported()}
20-
<p>This app requires modern web platform features. Please use a browser other than Safari.</p>
21-
{:else}
17+
<div class="error">
18+
<div>
19+
<h2>Yikes!</h2>
20+
{#if error.message === 'Your browser does not support all necessary features'}
21+
<p>
22+
This app requires modern web platform features. Please use a browser other than Safari.
23+
</p>
24+
{:else if /firefox/i.test(navigator.userAgent)}
25+
<p>
26+
We couldn't start the app. Please ensure
27+
<a
28+
target="_blank"
29+
rel="noreferrer"
30+
href="https://support.mozilla.org/en-US/kb/third-party-cookies-firefox-tracking-protection"
31+
>
32+
third party cookies
33+
</a> are enabled for this site, and disable Enhanced Tracking Protection.
34+
</p>
35+
<p>
36+
If you have 'Delete cookies and site data when Firefox is closed' enabled in
37+
<code>about:preferences#privacy</code>, make sure <code>learn.svelte.dev</code> is included
38+
as an exception.
39+
</p>
40+
{:else if /chrome/i.test(navigator.userAgent) && !/edg/i.test(navigator.userAgent)}
41+
<p>
42+
We couldn't start the app. Please ensure third party cookies are enabled for this site —
43+
click the
44+
<svg
45+
xmlns="http://www.w3.org/2000/svg"
46+
viewBox="0 0 24 24"
47+
style="width: 1em; height: 1em; position: relative; top: 0.1em; margin: 0 0.2em; transform: scale(1.2)"
48+
>
49+
<title>eye</title>
50+
<path
51+
fill="#666"
52+
d="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z"
53+
/>
54+
</svg>
55+
icon in the URL bar or go to
56+
<code>chrome://settings/cookies</code> and add <code>learn.svelte.jp</code> to 'Sites that
57+
can always use cookies'.
58+
</p>
59+
{:else}
60+
<p>
61+
We couldn't start the app. Please ensure third party cookies are enabled for this site.
62+
</p>
63+
{/if}
64+
</div>
65+
2266
<small>{error.message}</small>
23-
<h2>Yikes!</h2>
24-
{#if /firefox/i.test(navigator.userAgent)}
25-
<p>
26-
We couldn't start the app. Please ensure
27-
<a
28-
target="_blank"
29-
rel="noreferrer"
30-
href="https://support.mozilla.org/en-US/kb/third-party-cookies-firefox-tracking-protection"
31-
>
32-
third party cookies
33-
</a> are enabled for this site, and disable Enhanced Tracking Protection.
34-
</p>
35-
<p>
36-
If you have 'Delete cookies and site data when Firefox is closed' enabled in
37-
<code>about:preferences#privacy</code>, make sure <code>learn.svelte.jp</code> is included
38-
as an exception.
39-
</p>
40-
{:else if /chrome/i.test(navigator.userAgent) && !/edg/i.test(navigator.userAgent)}
41-
<p>
42-
We couldn't start the app. Please ensure third party cookies are enabled for this site —
43-
click the
44-
<svg
45-
xmlns="http://www.w3.org/2000/svg"
46-
viewBox="0 0 24 24"
47-
style="width: 1em; height: 1em; position: relative; top: 0.1em; margin: 0 0.2em; transform: scale(1.2)"
48-
>
49-
<title>eye</title>
50-
<path
51-
fill="#666"
52-
d="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z"
53-
/>
54-
</svg>
55-
icon in the URL bar or go to
56-
<code>chrome://settings/cookies</code> and add <code>learn.svelte.jp</code> to 'Sites that
57-
can always use cookies'.
58-
</p>
59-
{:else}
60-
<p>
61-
We couldn't start the app. Please ensure third party cookies are enabled for this site.
62-
</p>
63-
{/if}
64-
{/if}
67+
</div>
6568
{:else}
6669
<svg width="107" height="128" viewBox="0 0 107 128">
6770
<path
@@ -118,8 +121,11 @@
118121
}
119122
120123
.error {
121-
align-items: start;
122-
justify-content: start;
124+
width: 100%;
125+
height: 100%;
126+
display: flex;
127+
flex-direction: column;
128+
justify-content: space-between;
123129
}
124130
125131
h2 {

0 commit comments

Comments
 (0)