File tree Expand file tree Collapse file tree 6 files changed +75
-23
lines changed Expand file tree Collapse file tree 6 files changed +75
-23
lines changed Original file line number Diff line number Diff line change 2929 "devDependencies" : {
3030 "@resvg/resvg-js" : " ^2.4.1" ,
3131 "@sveltejs/adapter-vercel" : " ^3.0.3" ,
32- "@sveltejs/kit" : " ^1.22.6 " ,
32+ "@sveltejs/kit" : " ^1.24.0 " ,
3333 "@sveltejs/site-kit" : " 6.0.0-next.36" ,
3434 "@sveltejs/vite-plugin-svelte" : " ^2.4.5" ,
3535 "@types/cookie" : " ^0.5.1" ,
Original file line number Diff line number Diff line change 1+ declare global {
2+ namespace App {
3+ // interface Error {}
4+ // interface Locals {}
5+ // interface PageData {}
6+ // interface Platform {}
7+ }
8+
9+ // add these lines
10+ interface ViewTransition {
11+ updateCallbackDone : Promise < void > ;
12+ ready : Promise < void > ;
13+ finished : Promise < void > ;
14+ skipTransition : ( ) => void ;
15+ }
16+
17+ interface Document {
18+ startViewTransition ( updateCallback : ( ) => Promise < void > ) : ViewTransition ;
19+ }
20+ }
21+
22+ export { } ;
Original file line number Diff line number Diff line change 1+ <script >
2+ import { onNavigate } from ' $app/navigation' ;
3+
4+ onNavigate ((navigation ) => {
5+ if (! document .startViewTransition ) return ;
6+
7+ return new Promise ((resolve ) => {
8+ document .startViewTransition (async () => {
9+ resolve ();
10+ await navigation .complete ;
11+ });
12+ });
13+ });
14+ </script >
15+
16+ <slot />
Original file line number Diff line number Diff line change 2222 {#if ! post .draft }
2323 <article class ="post" data-pubdate ={post .date }>
2424 <a class ="no-underline" href ="/blog/ {post .slug }" title =" Read the article »" >
25- <h2 >{post .title }</h2 >
26- <p >{post .description }</p >
25+ <h2 style:--name = "post-title- { post . slug } " >{post .title }</h2 >
26+ <p class = "description" style:--name = "post-description- { post . slug } " >{post .description }</p >
2727 </a >
2828 </article >
2929 {/if }
4949 font-weight : 400 ;
5050 }
5151
52+ @media (prefers-reduced-motion: no-preference) {
53+ h2 ,
54+ .description {
55+ view-transition-name : var (--name );
56+ }
57+ }
58+
5259 .post :first-child {
5360 margin : 0 0 2rem 0 ;
5461 padding : 0 0 4rem 0 ;
Original file line number Diff line number Diff line change 2020</svelte:head >
2121
2222<article class =" post listify text" >
23- <h1 >{data .post .title }</h1 >
24- <p class ="standfirst" >{data .post .description }</p >
23+ <h1 style:--name ="post-title- {$page .params .slug }" >{data .post .title }</h1 >
24+ <p class ="standfirst" style:--name ="post-description- {$page .params .slug }" >
25+ {data .post .description }
26+ </p >
2527
2628 <p class =" byline" >
2729 <a href ={data .post .author .url }>{data .post .author .name }</a >
5254 margin : 0 0 1em 0 ;
5355 }
5456
57+ @media (prefers-reduced-motion: no-preference) {
58+ h1 ,
59+ .standfirst {
60+ view-transition-name : var (--name );
61+ }
62+ }
63+
5564 .byline {
5665 margin : 0 0 6rem 0 ;
5766 padding : 1.6rem 0 0 0 ;
You can’t perform that action at this time.
0 commit comments