diff --git a/.vscode/settings.json b/.vscode/settings.json
index eb5941b5..9e955890 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -70,5 +70,6 @@
},
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
- }
+ },
+ "i18n-ally.localesPaths": ["src/locales", "src/locales/lang"]
}
diff --git a/src/components/common/dark-mode-switch.vue b/src/components/common/dark-mode-switch.vue
index 9fa01fe6..3342c484 100644
--- a/src/components/common/dark-mode-switch.vue
+++ b/src/components/common/dark-mode-switch.vue
@@ -34,9 +34,51 @@ const darkMode = computed({
}
});
-function handleSwitch() {
- darkMode.value = !darkMode.value;
+function handleSwitch(event: MouseEvent) {
+ const x = event.clientX;
+ const y = event.clientY;
+ const endRadius = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y));
+ // @ts-expect-error: Transition API
+ if (!document.startViewTransition) {
+ darkMode.value = !darkMode.value;
+ return;
+ }
+ // @ts-expect-error: Transition API
+ const transition = document.startViewTransition(() => {
+ darkMode.value = !darkMode.value;
+ });
+ transition.ready.then(() => {
+ const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`];
+ document.documentElement.animate(
+ {
+ clipPath: darkMode.value ? clipPath : [...clipPath].reverse()
+ },
+ {
+ duration: 300,
+ easing: 'ease-in',
+ pseudoElement: darkMode.value ? '::view-transition-new(root)' : '::view-transition-old(root)'
+ }
+ );
+ });
}
-
+