diff --git a/app/app.vue b/app/app.vue index 790c6f6..1d2ad33 100644 --- a/app/app.vue +++ b/app/app.vue @@ -20,10 +20,6 @@ useHead({ diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue index 3d8d83e..08f42fe 100644 --- a/app/components/AppHeader.vue +++ b/app/components/AppHeader.vue @@ -1,33 +1,11 @@ + + + + +{ + "en": { + "language": "change language" + }, + "fr": { + "language": "changer de langue" + }, + "es": { + "language": "cambiar idioma" + } +} + diff --git a/app/components/ThemeSwitcher.vue b/app/components/ThemeSwitcher.vue index 652c373..e65e33c 100644 --- a/app/components/ThemeSwitcher.vue +++ b/app/components/ThemeSwitcher.vue @@ -7,8 +7,12 @@ function switchTheme() { colorMode.preference = nextTheme.value } -function startViewTransition(event: MouseEvent | { clientX: number, clientY: number }) { - if (!document.startViewTransition) { +function toggleDark(event: MouseEvent | { clientX: number, clientY: number }) { + // @ts-expect-error experimental API + const isAppearanceTransition = document.startViewTransition + && !window.matchMedia('(prefers-reduced-motion: reduce)').matches + + if (!isAppearanceTransition) { switchTheme() return } @@ -16,39 +20,38 @@ function startViewTransition(event: MouseEvent | { clientX: number, clientY: num const x = event.clientX const y = event.clientY const endRadius = Math.hypot( - Math.max(x, window.innerWidth - x), - Math.max(y, window.innerHeight - y), + Math.max(x, innerWidth - x), + Math.max(y, innerHeight - y), ) - const transition = document.startViewTransition(async () => { switchTheme() await nextTick() }) - - transition.ready.then(() => { - const clipPath = [ - `circle(0px at ${x}px ${y}px)`, - `circle(${endRadius}px at ${x}px ${y}px)`, - ] - document.documentElement.animate( - { - clipPath: colorMode.value === 'dark' - ? [...clipPath].reverse() - : clipPath, - }, - { - duration: 500, - easing: 'ease-out', - pseudoElement: colorMode.value === 'dark' - ? '::view-transition-old(root)' - : '::view-transition-new(root)', - }, - ) - }) + transition.ready + .then(() => { + const clipPath = [ + `circle(0px at ${x}px ${y}px)`, + `circle(${endRadius}px at ${x}px ${y}px)`, + ] + document.documentElement.animate( + { + clipPath: colorMode.value === 'dark' + ? [...clipPath].reverse() + : clipPath, + }, + { + duration: 400, + easing: 'ease-out', + pseudoElement: colorMode.value === 'dark' + ? '::view-transition-old(root)' + : '::view-transition-new(root)', + }, + ) + }) } defineShortcuts({ - t: () => startViewTransition({ clientX: window.innerWidth, clientY: 0 }), + t: () => toggleDark({ clientX: window.innerWidth, clientY: 0 }), }) @@ -65,7 +68,7 @@ defineShortcuts({ aria-label="switch theme" size="sm" variant="ghost" - @click="startViewTransition" + @click="toggleDark" /> @@ -80,6 +83,6 @@ defineShortcuts({ }, "es": { "theme": "cambiar tema" - }, + } } diff --git a/package.json b/package.json index 5a460ec..11d08aa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "artsite", "private": true, - "packageManager": "pnpm@9.5.0", + "packageManager": "pnpm@10.13.1", "scripts": { "build": "nuxt build", "dev": "nuxt dev --host", diff --git a/public/noise.png b/public/noise.png new file mode 100644 index 0000000..f23a15b Binary files /dev/null and b/public/noise.png differ diff --git a/types/index.ts b/types/index.ts index b2b2110..5e9139b 100644 --- a/types/index.ts +++ b/types/index.ts @@ -154,18 +154,6 @@ interface Nav { target?: string } -export interface NavColor { - color: string - x: number - y: number - radius: number -} - -interface NavColorGroup { - name: string - colors: NavColor[] -} - export const navs: readonly Nav[] = [ { label: { en: 'home', fr: 'accueil', es: 'inicio' }, to: '/', icon: 'house-duotone' }, { label: { en: 'uses', fr: 'usages', es: 'usos' }, to: '/uses', icon: 'backpack-duotone' }, @@ -178,10 +166,3 @@ export const navs: readonly Nav[] = [ target: '_blank', }, ] as const - -export const navColors: readonly NavColorGroup[] = [ - { name: 'index', colors: [{ color: '#ffa1ad', x: 20, y: 70, radius: 250 }, { color: '#e7000b', x: 80, y: 20, radius: 500 }] }, - { name: 'uses', colors: [{ color: '#00d492', x: 60, y: 25, radius: 500 }, { color: '#bbf451', x: 40, y: 80, radius: 300 }] }, - { name: 'writings', colors: [{ color: '#3b82f6', x: 20, y: 20, radius: 600 }, { color: '#ec4899', x: 80, y: 80, radius: 200 }] }, - { name: 'projects', colors: [{ color: '#ffd230', x: 20, y: 50, radius: 400 }, { color: '#fb64b6', x: 80, y: 50, radius: 400 }] }, -] as const