-
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.
- Loading branch information
1 parent
1bf032b
commit dfe6a5d
Showing
11 changed files
with
496 additions
and
389 deletions.
There are no files selected for viewing
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
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,49 @@ | ||
body.page-loading { | ||
margin: 0; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
.loading-screen { | ||
display: none; | ||
} | ||
|
||
.page-loading .loading-screen { | ||
position: absolute; | ||
z-index: 1000; | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
background-color: #f9f9f9; | ||
color: #5e6278; | ||
line-height: 1; | ||
font-size: 16px; | ||
} | ||
|
||
.page-loading .loading-screen span { | ||
color: #5e6278; | ||
transition: none !important; | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
|
||
.page-loading .loading-screen img { | ||
margin-left: calc(100vw - 100%); | ||
margin-bottom: 30px; | ||
height: 40px !important; | ||
} | ||
|
||
html[class="dark"] .page-loading .loading-screen { | ||
background-color: #151521; | ||
color: #ffffff; | ||
} | ||
|
||
.loading-screen .dark-logo { | ||
display: none; | ||
} | ||
|
||
.loading-screen .light-logo { | ||
display: block; | ||
} |
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
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 |
---|---|---|
@@ -1,4 +1,32 @@ | ||
body { | ||
font-family: "CascadiaCode"; | ||
background-color: skyblue; | ||
} | ||
|
||
/* toggle theme */ | ||
::view-transition-old(root), | ||
::view-transition-new(root) { | ||
animation: none; | ||
mix-blend-mode: normal; | ||
} | ||
::view-transition-old(root) { | ||
z-index: 1; | ||
} | ||
::view-transition-new(root) { | ||
z-index: 9999; | ||
} | ||
.dark::view-transition-old(root) { | ||
z-index: 9999; | ||
} | ||
.dark::view-transition-new(root) { | ||
z-index: 1; | ||
} | ||
|
||
.v-enter-active, | ||
.v-leave-active { | ||
transition: opacity 0.5s ease; | ||
} | ||
|
||
.v-enter-from, | ||
.v-leave-to { | ||
opacity: 0; | ||
} |
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
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,57 @@ | ||
import { nextTick } from "vue"; | ||
import { useDark } from "@vueuse/core"; | ||
|
||
export const isDark = useDark(); | ||
|
||
/** | ||
* @param event | ||
*/ | ||
export function toggleDark(event: MouseEvent): void { | ||
const isAppearanceTransition = | ||
// @ts-expect-error experimental API | ||
document.startViewTransition && | ||
!window.matchMedia("(prefers-reduced-motion: reduce)").matches; | ||
|
||
if (!isAppearanceTransition) { | ||
isDark.value = !isDark.value; | ||
return; | ||
} | ||
|
||
// Get the click position, or fallback to the middle of the screen | ||
const x: number = event.clientX; | ||
const y: number = event.clientY; | ||
// Get the distance to the furthest corner | ||
const endRadius: number = Math.hypot( | ||
Math.max(x, innerWidth - x), | ||
Math.max(y, innerHeight - y), | ||
); | ||
|
||
// @ts-expect-error experimental API | ||
const transition = document.startViewTransition(async () => { | ||
isDark.value = !isDark.value; | ||
await nextTick(); | ||
}); | ||
|
||
// Wait for the pseudo-elements to be created: | ||
transition.ready.then(() => { | ||
// Animate the root’s new view | ||
const clipPath: string[] = [ | ||
`circle(0px at ${x}px ${y}px)`, | ||
`circle(${endRadius}px at ${x}px ${y}px)`, | ||
]; | ||
|
||
document.documentElement.animate( | ||
{ | ||
clipPath: isDark.value ? [...clipPath].reverse() : clipPath, | ||
}, | ||
{ | ||
duration: 400, | ||
easing: "ease-out", | ||
// Specify which pseudo-element to animate | ||
pseudoElement: isDark.value | ||
? "::view-transition-old(root)" | ||
: "::view-transition-new(root)", | ||
}, | ||
); | ||
}); | ||
} |
Oops, something went wrong.