forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
site: add view transitions and transition blog title (sveltejs#9164)
* Add view transitions and transition blog title * Scope view transitions to /blog routes
- Loading branch information
Showing
6 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
declare global { | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface Platform {} | ||
} | ||
|
||
// add these lines | ||
interface ViewTransition { | ||
updateCallbackDone: Promise<void>; | ||
ready: Promise<void>; | ||
finished: Promise<void>; | ||
skipTransition: () => void; | ||
} | ||
|
||
interface Document { | ||
startViewTransition(updateCallback: () => Promise<void>): ViewTransition; | ||
} | ||
} | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import { onNavigate } from '$app/navigation'; | ||
onNavigate((navigation) => { | ||
if (!document.startViewTransition) return; | ||
return new Promise((resolve) => { | ||
document.startViewTransition(async () => { | ||
resolve(); | ||
await navigation.complete; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters