From fab9db405c9de40549c08559a554b5690ae1f7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 25 May 2025 08:37:39 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E3=82=BF=E3=83=96=E9=96=93?= =?UTF-8?q?=E5=90=8C=E6=9C=9F=E3=81=8C=E8=A1=8C=E3=82=8F=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=81=A8=E3=83=86=E3=83=BC=E3=83=9E=E3=81=8C=E5=88=87=E3=82=8A?= =?UTF-8?q?=E6=9B=BF=E3=82=8F=E3=82=8A=E7=B6=9A=E3=81=91=E3=82=8B=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=20(#16094)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/style.scss | 16 ++-------------- packages/frontend/src/theme.ts | 5 +++++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/frontend/src/style.scss b/packages/frontend/src/style.scss index 12879e63b3..6a9aa08b30 100644 --- a/packages/frontend/src/style.scss +++ b/packages/frontend/src/style.scss @@ -101,27 +101,15 @@ html._themeChanging_ { } html::view-transition-new(theme-changing) { - z-index: 4000001; - animation: themeChangingNew 0.5s ease; - animation-fill-mode: forwards; + z-index: 4000000; } html::view-transition-old(theme-changing) { - z-index: 4000000; + z-index: 4000001; animation: themeChangingOld 0.5s ease; animation-fill-mode: forwards; } -@keyframes themeChangingNew { - 0% { - opacity: 0; - } - - 100% { - opacity: 1; - } -} - @keyframes themeChangingOld { 0% { opacity: 1; diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts index 9562f69cf3..e48eb04103 100644 --- a/packages/frontend/src/theme.ts +++ b/packages/frontend/src/theme.ts @@ -15,6 +15,7 @@ import { globalEvents } from '@/events.js'; import { miLocalStorage } from '@/local-storage.js'; import { $i } from '@/i.js'; import { prefer } from '@/preferences.js'; +import { deepEqual } from '@/utility/deep-equal.js'; export type Theme = { id: string; @@ -127,6 +128,7 @@ function applyThemeInternal(theme: Theme, persist: boolean) { } let timeout: number | null = null; +let currentTheme: Theme | null = null; export function applyTheme(theme: Theme, persist = true) { if (timeout) { @@ -134,6 +136,9 @@ export function applyTheme(theme: Theme, persist = true) { timeout = null; } + if (deepEqual(currentTheme, theme)) return; + currentTheme = theme; + if (window.document.startViewTransition != null && prefer.s.animation) { window.document.documentElement.classList.add('_themeChanging_'); window.document.startViewTransition(async () => {