Skip to content

Commit

Permalink
run app-state migration (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Dec 16, 2024
1 parent 5d6586b commit 058089f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions apps/svelte.dev/src/lib/components/ModalDropdown.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/state';
import { focusable_children, trap } from '@sveltejs/site-kit/actions';
import { Icon } from '@sveltejs/site-kit/components';
import type { Snippet } from 'svelte';
Expand Down Expand Up @@ -46,7 +46,7 @@

// except parents of the current one
const current = details.querySelector(
`[href="${$page.url.pathname}"]`
`[href="${page.url.pathname}"]`
) as HTMLAnchorElement | null;
if (!current) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { mapbox_setup } from '../../../../config.js';
import AppControls from './AppControls.svelte';
import { compress_and_encode_text, decode_and_decompress_text } from './gzip.js';
import { page } from '$app/stores';
import { page } from '$app/state';
import type { File } from 'editor';
let { data } = $props();
Expand All @@ -20,12 +20,12 @@
let setting_hash: any = null;
// svelte-ignore non_reactive_update
let version = $page.url.searchParams.get('version') || 'latest';
let version = page.url.searchParams.get('version') || 'latest';
let is_pr_or_commit_version = version.startsWith('pr-') || version.startsWith('commit-');
// Hashed URLs are less safe (we can't delete malicious REPLs), therefore
// don't allow links to escape the sandbox restrictions
const can_escape = browser && !$page.url.hash;
const can_escape = browser && !page.url.hash;
if (version !== 'local' && !is_pr_or_commit_version) {
$effect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import UserMenu from './UserMenu.svelte';
import { Icon } from '@sveltejs/site-kit/components';
import { isMac } from '$lib/utils/compat.js';
Expand Down Expand Up @@ -193,7 +193,7 @@
<li>
<a
href="/playground/{example.slug}"
aria-current={$page.params.id === example.slug ? 'page' : undefined}
aria-current={page.params.id === example.slug ? 'page' : undefined}
>
{example.title}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import { theme } from '@sveltejs/site-kit/stores';
import { Repl } from '@sveltejs/repl';
import { mapbox_setup } from '../../../../../config.js';
import { page } from '$app/stores';
import { page } from '$app/state';
let { data } = $props();
let repl = $state() as ReturnType<typeof Repl>;
// svelte-ignore non_reactive_update
let version = $page.url.searchParams.get('version') || 'latest';
let version = page.url.searchParams.get('version') || 'latest';
let is_pr_or_commit_version = version.startsWith('pr-') || version.startsWith('commit-');
if (version !== 'local' && !is_pr_or_commit_version) {
Expand Down
4 changes: 2 additions & 2 deletions apps/svelte.dev/src/routes/tutorial/[...slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { solution } from './state.svelte';
import { needs_webcontainers, text_files } from './shared';
import OutputRollup from './OutputRollup.svelte';
import { page } from '$app/stores';
import { page } from '$app/state';
import Controls from './Controls.svelte';
import type { Item } from 'editor';
import type { Snapshot } from './$types.js';
Expand Down Expand Up @@ -319,7 +319,7 @@
</section>

<section slot="b" class="preview">
{#if needs_webcontainers($page.data.exercise)}
{#if needs_webcontainers(page.data.exercise)}
<Output exercise={data.exercise} {paused} {workspace} />
{:else}
<OutputRollup />
Expand Down
4 changes: 2 additions & 2 deletions apps/svelte.dev/src/routes/tutorial/[...slug]/Controls.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import SecondaryNav from '$lib/components/SecondaryNav.svelte';
import ModalDropdown from '$lib/components/ModalDropdown.svelte';
import type { Exercise, PartStub } from '$lib/tutorial';
Expand Down Expand Up @@ -30,7 +30,7 @@
{#each chapter.exercises as exercise}
<li value={exercise.slug}>
<a
aria-current={$page.url.pathname === `/tutorial/${exercise.slug}`
aria-current={page.url.pathname === `/tutorial/${exercise.slug}`
? 'page'
: undefined}
href="/tutorial/{exercise.slug}">{exercise.title}</a
Expand Down

0 comments on commit 058089f

Please sign in to comment.