Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 锁定 Splash 品牌布局避免启动瞬间缩小 (#3584)

Dasha4d4200dbf68
diff --git a/apps/desktop/src/renderer/components/login/LoginBrandStage.tsx b/apps/desktop/src/renderer/components/login/LoginBrandStage.tsx
index d2ac7a92fd..391b2750f5 100644
--- a/apps/desktop/src/renderer/components/login/LoginBrandStage.tsx
+++ b/apps/desktop/src/renderer/components/login/LoginBrandStage.tsx
@@ -16,15 +16,8 @@ import sloganPng2x from '@/assets/login/[email protected]';
import sloganDarkPng from '@/assets/login/slogan-dark.png';
import sloganDarkPng2x from '@/assets/login/[email protected]';
-import { brandPlacement, sloganShiftX } from './loginScale';
-import {
- HERO,
- LOGIN_COLORS,
- LOGIN_LOCAL_MODE,
- SLOGAN,
- STAGE,
- WORDMARK,
-} from './loginDesignTokens';
+import { brandPlacement, sloganShiftX, splashBrandPlacement } from './loginScale';
+import { HERO, LOGIN_COLORS, LOGIN_LOCAL_MODE, SLOGAN, STAGE, WORDMARK } from './loginDesignTokens';
import { useViewportSize } from './LoginStage';
/**
@@ -53,9 +46,13 @@ export function LoginBrandStage() {
const handoff = useLoginHandoff();
const { width, height } = useViewportSize();
const panelBottomReserve =
- handoff.panelBottomReserve ?? LOGIN_LOCAL_MODE.reservedHeight;
+ handoff.panelBottomReserve ??
+ (handoff.brandLayout === 'login' ? LOGIN_LOCAL_MODE.reservedHeight : 0);
// 品牌块整体让位(scale+translateY,构图冻结;用户拍板 2026-07-23,design.md §11)
- const { scale, translateY } = brandPlacement(width, height, panelBottomReserve);
+ const { scale, translateY } =
+ handoff.brandLayout === 'splash'
+ ? splashBrandPlacement(width, height)
+ : brandPlacement(width, height, panelBottomReserve);
const sloganShift = sloganShiftX(width, scale);
// 暗色画布用白字版字标/SLOGAN(figma 532:585 CINDY_Standard_White / SLOGAN #FBFBFB;
// 深浅判定同 useBrandLogo:跟随 theme-service 挂的 dark class)。立绘两模式同资产。
@@ -93,7 +90,10 @@ export function LoginBrandStage() {
if (!handoff.brandStageMounted) return null;
- const rootStyle: CSSProperties = handoff.brandExiting
+ // The background must stay opaque while the authenticated brand content
+ // fades. Otherwise the transparent macOS vibrancy backing shows through as
+ // a gray veil during the Splash → app handoff.
+ const contentStyle: CSSProperties = handoff.brandExiting
? {
opacity: 0,
transition: 'opacity var(--splash-fade-duration) var(--splash-fade-easing)',
@@ -118,7 +118,6 @@ export function LoginBrandStage() {
aria-hidden
data-testid="login-stage-root"
className="pointer-events-none fixed inset-0 z-[9980] overflow-hidden"
- style={rootStyle}
>
{/* 静态背景子层:纯平底(--login-bg-base 二态,亮 #EDEDED / 暗 #1F1F1E;
PR #104 撤渐变口径),viewport 锚定铺满,不参与 handoff 变换(v6.12 分层冻结) */}
@@ -131,7 +130,7 @@ export function LoginBrandStage() {
}}
/>
{/* 可动画内容子层:立绘/字标/Slogan(1819×2098 画布居中等比缩放) */}
- <div data-testid="login-brand-content" className="absolute inset-0">
+ <div data-testid="login-brand-content" className="absolute inset-0" style={contentStyle}>
<div
data-testid="login-brand-canvas"
className="absolute left-1/2 top-1/2"
@@ -140,6 +139,14 @@ export function LoginBrandStage() {
height: STAGE.height,
transform: `translate(-50%, calc(-50% + ${translateY}px)) scale(${scale})`,
transformOrigin: '50% 50%',
+ // The layout switch is synchronized with panel/slogan playback;
+ // shift and terminal states remain immediate.
+ transition:
+ handoff.isPlaying &&
+ handoff.brandLayout === 'login' &&
+ (handoff.phase === 'panel' || handoff.phase === 'slogan')
+ ? `transform ${LOGIN_HANDOFF_TIMINGS.panelMs}ms ${LOGIN_HANDOFF_TIMINGS.panelEasing}`
+ : undefined,
}}
>
<img
diff --git a/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts b/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts
index cd0b719461..139401bdc7 100644
--- a/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts
+++ b/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts
@@ -6,8 +6,9 @@ import {
panelPlacement,
PANEL_FIXED_SCALE,
sloganShiftX,
+ splashBrandPlacement,
} from '../loginScale';
-import { CONTROL, PANEL, SSO_ORG_HISTORY } from '../loginDesignTokens';
+import { CONTROL, HERO, LOGIN_GROUP, PANEL, SSO_ORG_HISTORY, WORDMARK } from '../loginDesignTokens';
/**
* 缩放公式行为单测(implementation-plan Step 2 WHAT1 锚点数值,demo v3.1 拍板)。
@@ -91,11 +92,9 @@ describe('panelPlacement(面板恒定 1x,用户拍板 2026-07-23,design.md §11)
['16 寸级大窗口', 1728, 1117],
])('%s下 SSO 候选层都锚定输入框下沿并收在面板内', (_label, width, height) => {
const placement = panelPlacement(width, height, 1227);
- const inputBottom =
- placement.topY + (CONTROL.inputY + CONTROL.height) * placement.scale;
+ const inputBottom = placement.topY + (CONTROL.inputY + CONTROL.height) * placement.scale;
const historyTop = placement.topY + SSO_ORG_HISTORY.y * placement.scale;
- const historyBottom =
- historyTop + SSO_ORG_HISTORY.maxHeight * placement.scale;
+ const historyBottom = historyTop + SSO_ORG_HISTORY.maxHeight * placement.scale;
const panelBottom = placement.topY + PANEL.height * placement.scale;
expect(historyTop - inputBottom).toBe(8 * placement.scale);
@@ -135,12 +134,64 @@ describe('brandPlacement(品牌块整体让位,用户拍板 2026-07-23 第二轮
expect(blockBottomAfter).toBeCloseTo(366 - 12, 2);
});
- it('品牌让位与登录 footer 使用同一 bottom reserve,避免面板上移后再次遮挡品牌', () => {
- const panelTop = panelPlacement(800, 600, 1229, 124).topY;
- const r = brandPlacement(800, 600, 124);
- const blockBottomAfter = 300 + 160 * r.scale + r.translateY;
- // 组高 620 后本组合落进压缩档:块底代数上恰好等于 limit(= panelTop-12),
- // 浮点余量 1e-9(压缩档 scale = (limit-12)/934,乘回 934 未必位精确;实测误差 ~1e-13)。
- expect(blockBottomAfter).toBeLessThanOrEqual(panelTop - 12 + 1e-9);
+ it('短窗口以字标底部为碰撞边界,立绘尾部可自然落入面板下方', () => {
+ const width = 1280;
+ const height = 600;
+ const panelTop = panelPlacement(width, height, 1229, 124).topY;
+ const r = brandPlacement(width, height, 124);
+ const blockTopAfter = height / 2 + (275 - 2098 / 2) * r.scale + r.translateY;
+ const wordmarkBottomAfter = height / 2 + (1191 - 2098 / 2) * r.scale + r.translateY;
+ const heroBottomAfter = height / 2 + (1209 - 2098 / 2) * r.scale + r.translateY;
+
+ expect(blockTopAfter).toBeCloseTo(12, 6);
+ expect(wordmarkBottomAfter).toBeLessThanOrEqual(panelTop + 1e-9);
+ expect(heroBottomAfter).toBeGreaterThan(panelTop);
+ });
+
+ it('768px 与 769px 之间按可用空间连续变化,没有高度阈值 scale cliff', () => {
+ const width = 1280;
+ const reserve = 124;
+ const at768 = brandPlacement(width, 768, reserve);
+ const at769 = brandPlacement(width, 769, reserve);
+ const panelTop768 = panelPlacement(width, 768, 1229, reserve).topY;
+ const panelTop769 = panelPlacement(width, 769, 1229, reserve).topY;
+ const expected768 = (panelTop768 - 12) / (WORDMARK.inner.y + WORDMARK.inner.height - HERO.y);
+ const expected769 = (panelTop769 - 12) / (WORDMARK.inner.y + WORDMARK.inner.height - HERO.y);
+
+ expect(at768.scale).toBeCloseTo(expected768, 6);
+ expect(at769.scale).toBeCloseTo(expected769, 6);
+ expect(at769.scale - at768.scale).toBeCloseTo(
+ 1 / (WORDMARK.inner.y + WORDMARK.inner.height - HERO.y),
+ 6,
+ );
+
+ for (const [height, placement, panelTop] of [
+ [768, at768, panelTop768],
+ [769, at769, panelTop769],
+ ] as const) {
+ const wordmarkBottom =
+ height / 2 +
+ (WORDMARK.inner.y + WORDMARK.inner.height - 2098 / 2) * placement.scale +
+ placement.translateY;
+ expect(wordmarkBottom).toBeLessThanOrEqual(panelTop + 1e-9);
+ }
+ });
+});
+
+describe('splashBrandPlacement(Splash 使用 desktopScale 的品牌块布局)', () => {
+ it.each([
+ ['4:3 小窗口', 800, 600],
+ ['4:3 常见窗口', 1024, 768],
+ ['16:9 窗口', 1280, 720],
+ ['16:10 窗口', 1280, 800],
+ ['16 寸级窗口', 1728, 1117],
+ ])('%s保持原始 desktopScale,并与 Splash 面板保留安全间距', (_label, width, height) => {
+ const base = desktopScale(width, height).scale;
+ const placement = splashBrandPlacement(width, height);
+ expect(placement.scale).toBe(base);
+
+ const splashPanelTop = height / 2 + (LOGIN_GROUP.yDefault - 2098 / 2) * base;
+ const brandBottom = height / 2 + (1209 - 2098 / 2) * base + placement.translateY;
+ expect(brandBottom).toBeLessThanOrEqual(splashPanelTop - 12 + 1e-9);
});
});
diff --git a/apps/desktop/src/renderer/components/login/loginScale.ts b/apps/desktop/src/renderer/components/login/loginScale.ts
index 36127b2e36..d5bb427e3e 100644
--- a/apps/desktop/src/renderer/components/login/loginScale.ts
+++ b/apps/desktop/src/renderer/components/login/loginScale.ts
@@ -11,7 +11,7 @@
* (1280, 800) → ≈0.3813;(800, 600) → ≈0.2860;宽度拉伸不改 scale。
*/
-import { LOGIN_GROUP } from './loginDesignTokens';
+import { HERO, LOGIN_GROUP, WORDMARK } from './loginDesignTokens';
/** 设计画布尺寸(figma §5.1 桌面通用画板 1819×2098)。 */
export const LOGIN_STAGE_WIDTH = 1819;
@@ -94,28 +94,65 @@ export interface BrandPlacement {
translateY: number;
}
+function brandPlacementForPanelTop(
+ h: number,
+ base: number,
+ panelTop: number,
+ protectedBottomDesignY: number,
+ panelGap: number,
+): BrandPlacement {
+ const blockTop = h / 2 + (HERO.y - LOGIN_STAGE_HEIGHT / 2) * base;
+ const blockBottom = h / 2 + (protectedBottomDesignY - LOGIN_STAGE_HEIGHT / 2) * base;
+ // The collision boundary is the actual protected brand element, not a
+ // viewport-height mode switch. This keeps the layout continuous around
+ // neighboring heights (for example 768px and 769px).
+ const limit = panelTop - panelGap;
+ const overflow = blockBottom - limit;
+ if (overflow <= 0) return { scale: base, translateY: 0 };
+ const maxShift = blockTop - 12;
+ if (overflow <= maxShift) return { scale: base, translateY: -overflow };
+ // 压缩档:受保护品牌范围恰好塞进 [12, limit];画布仍中心缩放,
+ // 位移把立绘顶放到 12。登录短窗保护字标底部(1191),所以立绘尾部
+ // 比字标多出的 18 设计单位可以自然地落入面板下方。
+ const protectedHeight = protectedBottomDesignY - HERO.y;
+ const scale2 = Math.max(limit - 12, 0) / protectedHeight;
+ const blockTop2 = h / 2 + (HERO.y - LOGIN_STAGE_HEIGHT / 2) * scale2;
+ return { scale: scale2, translateY: 12 - blockTop2 };
+}
+
/**
* 品牌块整体让位(用户拍板 2026-07-23 第二轮,design.md §11):
- * 字标任何窗口必须完整可见,且绝不遮挡立绘脸部/黑猫——后者由「构图冻结」保证:
+ * 字标任何窗口必须完整可见,且优先保护立绘脸部/黑猫——后者由「构图冻结」保证:
* 品牌块(立绘 275..1209,字标底 1191 / Slogan 底 995 均在其内)只作为整体
* 移动/缩放,字标与立绘的设计相对位(压胸口渐隐区)永不改变。三级规则:
* ① 常态:v3.1 desktopScale + 画布居中(translateY=0),大窗零变化;
- * ② 面板上侵:块底越过面板顶-12 → 整块上移补偿,至块顶触及视口顶 12 为止;
- * ③ 极矮窗:上移仍不够 → 整块等比压缩至恰好塞进 [12, 面板顶-12]。
+ * ② 面板上侵:有登录底部预留时以字标底部为碰撞边界,允许立绘尾部
+ * (立绘底部比字标底部低 18 个设计单位)自然落入面板下方;不再按窗口高度硬切档;
+ * ③ 极矮窗:上移仍不够 → 受保护的品牌范围等比压缩至恰好塞进
+ * [12, 面板顶-当前安全间距]。
* 面板锚点取 yDefault(sso 态差 2 设计px,由 12px gap 吸收)。
*/
export function brandPlacement(w: number, h: number, bottomReserve = 0): BrandPlacement {
const { scale: base } = desktopScale(w, h);
const { topY: panelTop } = panelPlacement(w, h, 1229, bottomReserve);
- const blockTop = h / 2 + (275 - LOGIN_STAGE_HEIGHT / 2) * base;
- const blockBottom = h / 2 + (1209 - LOGIN_STAGE_HEIGHT / 2) * base;
- const limit = panelTop - 12;
- const overflow = blockBottom - limit;
- if (overflow <= 0) return { scale: base, translateY: 0 };
- const maxShift = blockTop - 12;
- if (overflow <= maxShift) return { scale: base, translateY: -overflow };
- // 压缩档:块高(934 设计px)恰好塞进 [12, limit];画布仍中心缩放,位移把块顶放到 12。
- const scale2 = Math.max(limit - 12, 0) / 934;
- const blockTop2 = h / 2 + (275 - LOGIN_STAGE_HEIGHT / 2) * scale2;
- return { scale: scale2, translateY: 12 - blockTop2 };
+ const protectsWordmark = bottomReserve > 0;
+ return brandPlacementForPanelTop(
+ h,
+ base,
+ panelTop,
+ protectsWordmark ? WORDMARK.inner.y + WORDMARK.inner.height : HERO.y + HERO.size,
+ protectsWordmark ? 0 : 12,
+ );
+}
+
+/**
+ * Splash 品牌块让位:品牌画布与 Splash 状态面板都使用 desktopScale,
+ * 因此不能复用登录页固定 0.5 面板的 bottom clamp。Splash 面板顶边在同一
+ * 设计画布坐标系的 LOGIN_GROUP.yDefault,仅保留品牌块与状态面板之间的
+ * 12px 屏幕安全间距;这样小窗口不会因为登录 footer reserve 被过度压缩。
+ */
+export function splashBrandPlacement(w: number, h: number): BrandPlacement {
+ const { scale: base } = desktopScale(w, h);
+ const splashPanelTop = h / 2 + (LOGIN_GROUP.yDefault - LOGIN_STAGE_HEIGHT / 2) * base;
+ return brandPlacementForPanelTop(h, base, splashPanelTop, HERO.y + HERO.size, 12);
}
diff --git a/apps/desktop/src/renderer/components/splash/SplashScreen.tsx b/apps/desktop/src/renderer/components/splash/SplashScreen.tsx
index 0553f5b075..30dddfbe98 100644
--- a/apps/desktop/src/renderer/components/splash/SplashScreen.tsx
+++ b/apps/desktop/src/renderer/components/splash/SplashScreen.tsx
@@ -127,8 +127,9 @@ export function SplashScreen() {
const reducedMotion = useReducedMotion();
const handoff = useLoginHandoff();
const [shellCoverFading, setShellCoverFading] = useState(false);
- const [dbCleanupProgress, setDbCleanupProgress] =
- useState<DbSlimmingStartupProgress | null>(null);
+ const [dbCleanupProgress, setDbCleanupProgress] = useState<DbSlimmingStartupProgress | null>(
+ null,
+ );
const [dbCleanupNow, setDbCleanupNow] = useState(() => Date.now());
const [dbCleanupCancelPending, setDbCleanupCancelPending] = useState(false);
const prevCoverHeldRef = useRef(coverHeld);
@@ -197,18 +198,19 @@ export function SplashScreen() {
});
const splashLifecycleActive =
- realPhase !== 'fading_out' &&
- realPhase !== 'splash_done' &&
- realPhase !== 'splash_skipped';
+ realPhase !== 'fading_out' && realPhase !== 'splash_done' && realPhase !== 'splash_skipped';
useEffect(() => {
- if (prevCoverHeldRef.current && !coverHeld && (realPhase === 'splash_done' || realPhase === 'splash_skipped')) {
- // reduced-motion 把 --splash-fade-duration 置 0ms。再留 500ms 透明全屏层
- // 会吞掉主界面刚露出时的点击(层未 pointer-events:none)。
- if (reducedMotion) {
- prevCoverHeldRef.current = coverHeld;
- return;
- }
+ const splashFinished = realPhase === 'splash_done' || realPhase === 'splash_skipped';
+ // If reduced-motion is enabled while the shell fade is in progress, the
+ // effect cleanup cancels its timer. Clear the in-flight fade explicitly so
+ // the Splash can still report completion and unmount.
+ if (reducedMotion && !coverHeld && splashFinished) {
+ setShellCoverFading(false);
+ prevCoverHeldRef.current = coverHeld;
+ return;
+ }
+ if (prevCoverHeldRef.current && !coverHeld && splashFinished) {
setShellCoverFading(true);
const timer = window.setTimeout(() => setShellCoverFading(false), 500);
prevCoverHeldRef.current = coverHeld;
@@ -219,6 +221,20 @@ export function SplashScreen() {
}, [coverHeld, holdAfterDone, realPhase, reducedMotion]);
const shellCoverVisible = holdAfterDone || shellCoverFading;
+ // The cover-release effect below sets shellCoverFading in a subsequent
+ // render. Include that one-render handoff window in the lock so completion
+ // cannot be reported before the fade state is visible to this component.
+ const shellCoverFadePending =
+ !reducedMotion &&
+ prevCoverHeldRef.current &&
+ !coverHeld &&
+ (realPhase === 'splash_done' || realPhase === 'splash_skipped');
+ const splashCanUnmount =
+ !fixture &&
+ (realPhase === 'splash_done' || realPhase === 'splash_skipped') &&
+ !shellCoverVisible &&
+ !shellCoverFadePending &&
+ !dbCleanupProgress;
useEffect(() => {
const root = document.documentElement;
@@ -246,14 +262,20 @@ export function SplashScreen() {
}
}, [realPhase, handoff]);
+ // 布局锁定要覆盖整个 opacity fade;只有 Splash 真正进入 done/skipped 并卸载后,
+ // 未登录分支才允许 LoginBrandStage 切到带面板避让的登录布局。
+ const splashExitCompletedRef = useRef(false);
+ useEffect(() => {
+ if (splashExitCompletedRef.current) return;
+ if (splashCanUnmount) {
+ splashExitCompletedRef.current = true;
+ handoff.reportSplashExitCompleted();
+ }
+ }, [handoff, splashCanUnmount]);
+
// dev fixture 激活时冻结停留:真实生命周期跑完也不退场,供状态遍历/视觉走查
// (readSplashPhaseFixture 在 PROD 恒 null,本分支不可达)。
- if (
- !fixture &&
- (realPhase === 'splash_done' || realPhase === 'splash_skipped') &&
- !shellCoverVisible &&
- !dbCleanupProgress
- ) {
+ if (splashCanUnmount) {
return null;
}
@@ -387,12 +409,12 @@ export function SplashScreen() {
dbCleanupProgress
? `${t(dbCleanupPhaseTranslationKey(dbCleanupProgress.phase))} · ${dbCleanupPercent}%`
: dialogKind === 'manifest'
- ? t('splash.manifestFailed.description')
- : dialogKind === 'download'
- ? t('splash.downloadFailed.description')
- : dialogKind === 'spawn'
- ? t('splash.spawnFailed.description')
- : undefined
+ ? t('splash.manifestFailed.description')
+ : dialogKind === 'download'
+ ? t('splash.downloadFailed.description')
+ : dialogKind === 'spawn'
+ ? t('splash.spawnFailed.description')
+ : undefined
}
/>
)}
diff --git a/apps/desktop/src/renderer/components/splash/__tests__/SplashScreen.test.tsx b/apps/desktop/src/renderer/components/splash/__tests__/SplashScreen.test.tsx
index 8507233a49..3f42c3cdce 100644
--- a/apps/desktop/src/renderer/components/splash/__tests__/SplashScreen.test.tsx
+++ b/apps/desktop/src/renderer/components/splash/__tests__/SplashScreen.test.tsx
@@ -4,7 +4,7 @@ import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
-import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { DbSlimmingStartupProgress } from '../../../../shared/localDbMaintenance';
@@ -45,6 +45,10 @@ const mocks = vi.hoisted(() => ({
},
env: { step: undefined as 1 | 2 | undefined, totalSteps: undefined as 2 | undefined },
coverHeld: false,
+ handoff: {
+ reportSplashExited: vi.fn(),
+ reportSplashExitCompleted: vi.fn(),
+ },
}));
vi.mock('react-i18next', () => ({
@@ -80,6 +84,10 @@ vi.mock('@/contexts/AppShellCoverContext', () => ({
useAppShellCover: () => ({ coverHeld: mocks.coverHeld, reportLocalDbGate: () => {} }),
}));
+vi.mock('@/contexts/LoginHandoffContext', () => ({
+ useLoginHandoff: () => mocks.handoff,
+}));
+
vi.mock('@/components/title-bar/WindowControls', () => ({
WindowControls: () => <div data-testid="window-controls" />,
}));
@@ -448,6 +456,28 @@ describe('SplashScreen wave4 统一面板', () => {
expect(screen.getByTestId('splash-root').className).toContain('opacity-0');
});
+ it('等待 Splash 淡出层完成并可卸载后才上报退场完成', () => {
+ vi.useFakeTimers();
+ try {
+ mocks.coverHeld = true;
+ const view = renderSplash('splash_done');
+ expect(mocks.handoff.reportSplashExitCompleted).not.toHaveBeenCalled();
+
+ mocks.coverHeld = false;
+ view.rerender(<SplashScreen />);
+ expect(mocks.handoff.reportSplashExitCompleted).not.toHaveBeenCalled();
+
+ act(() => vi.advanceTimersByTime(499));
+ expect(mocks.handoff.reportSplashExitCompleted).not.toHaveBeenCalled();
+
+ act(() => vi.advanceTimersByTime(1));
+ expect(mocks.handoff.reportSplashExitCompleted).toHaveBeenCalledTimes(1);
+ expect(view.container.firstElementChild).toBeNull();
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it('reduced-motion 下 cover 放行立即卸载,不留 500ms 透明遮罩', () => {
window.matchMedia = vi.fn().mockImplementation((query: string) => ({
matches: String(query).includes('prefers-reduced-motion'),
@@ -466,6 +496,50 @@ describe('SplashScreen wave4 统一面板', () => {
expect(view.container.firstElementChild).toBeNull();
});
+ it('淡出期间开启 reduced-motion 时释放淡出锁并完成卸载', () => {
+ vi.useFakeTimers();
+ const previousMatchMedia = window.matchMedia;
+ let reducedMotion = false;
+ const listeners = new Set<(event: MediaQueryListEvent) => void>();
+ const mediaQuery = {
+ get matches() {
+ return reducedMotion;
+ },
+ media: '(prefers-reduced-motion: reduce)',
+ addEventListener: (_type: string, listener: (event: MediaQueryListEvent) => void) => {
+ listeners.add(listener);
+ },
+ removeEventListener: (_type: string, listener: (event: MediaQueryListEvent) => void) => {
+ listeners.delete(listener);
+ },
+ addListener: (listener: (event: MediaQueryListEvent) => void) => listeners.add(listener),
+ removeListener: (listener: (event: MediaQueryListEvent) => void) =>
+ listeners.delete(listener),
+ dispatchEvent: () => false,
+ } as unknown as MediaQueryList;
+ window.matchMedia = vi.fn(() => mediaQuery) as unknown as typeof window.matchMedia;
+
+ try {
+ mocks.coverHeld = true;
+ const view = renderSplash('splash_done');
+ mocks.coverHeld = false;
+ view.rerender(<SplashScreen />);
+ expect(screen.getByTestId('splash-root').className).toContain('opacity-0');
+ expect(mocks.handoff.reportSplashExitCompleted).not.toHaveBeenCalled();
+
+ reducedMotion = true;
+ act(() => {
+ for (const listener of listeners) listener({ matches: true } as MediaQueryListEvent);
+ });
+
+ expect(mocks.handoff.reportSplashExitCompleted).toHaveBeenCalledTimes(1);
+ expect(view.container.firstElementChild).toBeNull();
+ } finally {
+ window.matchMedia = previousMatchMedia;
+ vi.useRealTimers();
+ }
+ });
+
it('shows startup database cleanup progress, time estimate, and a safe cancel action', async () => {
const progress: DbSlimmingStartupProgress = {
requestId: 'request-1',
diff --git a/apps/desktop/src/renderer/contexts/LoginHandoffContext.tsx b/apps/desktop/src/renderer/contexts/LoginHandoffContext.tsx
index f9a2121b5c..1840b9a98b 100644
--- a/apps/desktop/src/renderer/contexts/LoginHandoffContext.tsx
+++ b/apps/desktop/src/renderer/contexts/LoginHandoffContext.tsx
@@ -55,13 +55,14 @@ export const LOGIN_HANDOFF_TIMINGS = Object.freeze({
/** demo 收尾 buffer(300+moveMs+100+500+60 后 commit)。 */
doneBufferMs: 60,
/** authenticated 分支品牌淡出时长(与 splash fade 同步,--splash-fade-duration)。 */
- brandExitMs: 500,
+ brandExitMs: 400,
} as const);
export type LoginHandoffPhase =
| 'boot' // 等推进锚(品牌资产 ∧ auth init ∧ splash 退场)
| 'settle' // t=0~300ms
| 'shift' // t=300~950ms
+ | 'awaiting-splash-exit' // handoff 尚未等到 Splash 实际卸载(例如数据库清理)
| 'awaiting-panel' // shift 结束但「面板已挂载」信号未到(仅未登录)
| 'panel' // 面板入场中
| 'slogan' // Slogan 入场中(面板开始 +100ms)
@@ -69,10 +70,13 @@ export type LoginHandoffPhase =
| 'done';
export type LoginHandoffBranch = 'unauthenticated' | 'authenticated' | null;
+export type LoginBrandLayout = 'splash' | 'login';
export interface LoginHandoffContextValue {
phase: LoginHandoffPhase;
branch: LoginHandoffBranch;
+ /** Splash 与已登录淡出期间保持 Splash 布局,未登录面板入场流程再切到登录避让布局。 */
+ brandLayout: LoginBrandLayout;
/**
* 登录面板下方内容需要预留的高度;null 表示 LoginPage 尚未上报,
* 品牌层应使用常态本地模式 footer 的预留值。
@@ -89,7 +93,10 @@ export interface LoginHandoffContextValue {
/** Slogan 已进入可见段(slogan/done)——必须最后出现。 */
sloganRevealed: boolean;
reportBrandAssetsReady: () => void;
+ /** Splash 开始淡出;用于启动 handoff 时序,但不代表布局可以切换。 */
reportSplashExited: () => void;
+ /** Splash 淡出完成并卸载后,未登录分支才允许切到登录布局。 */
+ reportSplashExitCompleted: () => void;
reportLoginPanelMounted: () => void;
reportLoginPanelUnmounted: () => void;
reportPanelBottomReserve: (reserve: number | null) => void;
@@ -104,6 +111,7 @@ const LoginHandoffContext = createContext<LoginHandoffContextValue | null>(null)
const FALLBACK_VALUE: LoginHandoffContextValue = Object.freeze({
phase: 'done',
branch: null,
+ brandLayout: 'login',
panelBottomReserve: null,
isPlaying: false,
brandStageMounted: true,
@@ -112,6 +120,7 @@ const FALLBACK_VALUE: LoginHandoffContextValue = Object.freeze({
sloganRevealed: true,
reportBrandAssetsReady: () => {},
reportSplashExited: () => {},
+ reportSplashExitCompleted: () => {},
reportLoginPanelMounted: () => {},
reportLoginPanelUnmounted: () => {},
reportPanelBottomReserve: () => {},
@@ -143,12 +152,15 @@ export function LoginHandoffProvider({
const [branch, setBranch] = useState<LoginHandoffBranch>(null);
const [brandReady, setBrandReady] = useState(false);
const [splashExited, setSplashExited] = useState(false);
+ const [splashExitCompleted, setSplashExitCompleted] = useState(false);
const [panelMounted, setPanelMounted] = useState(false);
const [panelBottomReserve, setPanelBottomReserve] = useState<number | null>(null);
// 冷启动只播一次:进程生命周期内 resize/reset/登出重回 /login 均不重播。
const playedRef = useRef(false);
const panelMountedRef = useRef(false);
+ const reducedMotionRef = useRef(false);
+ const splashExitCompletedRef = useRef(false);
const timersRef = useRef<ReturnType<typeof setTimeout>[]>([]);
const schedule = useCallback((fn: () => void, ms: number) => {
@@ -167,6 +179,10 @@ export function LoginHandoffProvider({
const reportBrandAssetsReady = useCallback(() => setBrandReady(true), []);
const reportSplashExited = useCallback(() => setSplashExited(true), []);
+ const reportSplashExitCompleted = useCallback(() => {
+ splashExitCompletedRef.current = true;
+ setSplashExitCompleted(true);
+ }, []);
const reportLoginPanelMounted = useCallback(() => {
panelMountedRef.current = true;
setPanelMounted(true);
@@ -189,8 +205,15 @@ export function LoginHandoffProvider({
const nextBranch: LoginHandoffBranch = authenticated ? 'authenticated' : 'unauthenticated';
setBranch(nextBranch);
- // reduced-motion 直落终态:无位移/无渐入过程。
- if (prefersReducedMotion()) {
+ // reduced-motion 直落终态:无位移/无渐入过程;但仍要等 Splash 实际卸载,
+ // 否则延迟的数据库清理会让登录面板/品牌布局在 Splash 上方提前显现。
+ const reducedMotion = prefersReducedMotion();
+ reducedMotionRef.current = reducedMotion;
+ if (reducedMotion) {
+ if (!splashExitCompletedRef.current) {
+ setPhase('awaiting-splash-exit');
+ return;
+ }
setPhase('done');
return;
}
@@ -205,12 +228,29 @@ export function LoginHandoffProvider({
setPhase('settle');
schedule(() => setPhase('shift'), LOGIN_HANDOFF_TIMINGS.settleMs);
schedule(
- // 未登录分支另需「面板已挂载」信号后才进 panel 步。
- () => setPhase(panelMountedRef.current ? 'panel' : 'awaiting-panel'),
+ // 未登录分支必须等 Splash 真正卸载后才进入 panel,否则延迟卸载的
+ // 数据库清理会让 phase 先走完,随后 brandLayout 在 done 终态硬切。
+ () => {
+ if (!splashExitCompletedRef.current) {
+ setPhase('awaiting-splash-exit');
+ return;
+ }
+ setPhase(panelMountedRef.current ? 'panel' : 'awaiting-panel');
+ },
LOGIN_HANDOFF_TIMINGS.settleMs + LOGIN_HANDOFF_TIMINGS.shiftMs,
);
}, [brandReady, splashExited, authResolved, authenticated, schedule]);
+ // Splash 延迟卸载时冻结;实际卸载后再恢复终态或 panel/awaiting-panel。
+ useEffect(() => {
+ if (phase !== 'awaiting-splash-exit' || !splashExitCompleted) return;
+ if (reducedMotionRef.current) {
+ setPhase('done');
+ return;
+ }
+ setPhase(panelMountedRef.current ? 'panel' : 'awaiting-panel');
+ }, [phase, splashExitCompleted]);
+
// awaiting-panel → panel:面板挂载信号到达即刻放行。
useEffect(() => {
if (phase === 'awaiting-panel' && panelMounted) setPhase('panel');
@@ -232,9 +272,20 @@ export function LoginHandoffProvider({
const value = useMemo<LoginHandoffContextValue>(() => {
const isPlaying = phase !== 'boot' && phase !== 'done';
+ const panelRevealed = phase === 'panel' || phase === 'slogan' || phase === 'done';
return {
phase,
branch,
+ // Keep the exact Splash composition through the whole exit fade and the
+ // settle/shift handoff. The login geometry is only needed once the
+ // unauthenticated panel is actually revealed; switching earlier makes
+ // the artwork shrink while the panel is still hidden. Authenticated
+ // startup has no login panel, so it never switches to login geometry.
+ brandLayout:
+ (branch === 'unauthenticated' && splashExitCompleted && panelRevealed) ||
+ (phase === 'done' && panelMounted)
+ ? 'login'
+ : 'splash',
panelBottomReserve,
isPlaying,
// startup 期(含 boot/播放中/brand-exit)恒挂以维持不透明白底全盖;done 后
@@ -249,6 +300,7 @@ export function LoginHandoffProvider({
sloganRevealed: phase === 'slogan' || phase === 'done',
reportBrandAssetsReady,
reportSplashExited,
+ reportSplashExitCompleted,
reportLoginPanelMounted,
reportLoginPanelUnmounted,
reportPanelBottomReserve,
@@ -258,9 +310,12 @@ export function LoginHandoffProvider({
branch,
panelMounted,
coverHeld,
+ splashExited,
+ splashExitCompleted,
panelBottomReserve,
reportBrandAssetsReady,
reportSplashExited,
+ reportSplashExitCompleted,
reportLoginPanelMounted,
reportLoginPanelUnmounted,
reportPanelBottomReserve,
diff --git a/apps/desktop/src/renderer/contexts/__tests__/LoginHandoffContext.test.tsx b/apps/desktop/src/renderer/contexts/__tests__/LoginHandoffContext.test.tsx
index f35bce8a55..4d4ff4a3db 100644
--- a/apps/desktop/src/renderer/contexts/__tests__/LoginHandoffContext.test.tsx
+++ b/apps/desktop/src/renderer/contexts/__tests__/LoginHandoffContext.test.tsx
@@ -77,7 +77,13 @@ import { AuthProvider, useAuth } from '../AuthContext';
import { LoginBrandStage } from '@/components/login/LoginBrandStage';
import { SplashScreen } from '@/components/splash/SplashScreen';
import { LoginPage } from '@/components/login/LoginPage';
-import { brandPlacement, panelPlacement } from '@/components/login/loginScale';
+import {
+ brandPlacement,
+ panelPlacement,
+ splashBrandPlacement,
+} from '@/components/login/loginScale';
+import '@/themes/colors';
+import { colorRegistry } from '@/themes/color-registry';
/* ── 探针:抓取 context 值供命令式驱动 ── */
const probe: { current: LoginHandoffContextValue | null } = { current: null };
@@ -130,10 +136,11 @@ afterEach(() => {
const T = LOGIN_HANDOFF_TIMINGS;
-function fireAnchors() {
+function fireAnchors({ splashComplete = true }: { splashComplete?: boolean } = {}) {
act(() => {
probe.current!.reportBrandAssetsReady();
probe.current!.reportSplashExited();
+ if (splashComplete) probe.current!.reportSplashExitCompleted();
});
}
@@ -145,12 +152,16 @@ describe('LoginHandoff 时序(fake-timer)', () => {
</LoginHandoffProvider>,
);
expect(probe.current!.phase).toBe('boot');
+ expect(probe.current!.brandLayout).toBe('splash');
// 面板先挂载(未登录冷启动 LoginPage 在 env passed 后即挂,handoff 前不显示)
act(() => probe.current!.reportLoginPanelMounted());
expect(probe.current!.panelRevealed).toBe(false);
fireAnchors();
expect(probe.current!.phase).toBe('settle');
+ // Handoff timing starts with Splash fading, but the composition stays
+ // frozen until Splash reports that the fade has completed.
+ expect(probe.current!.brandLayout).toBe('splash');
expect(probe.current!.panelRevealed).toBe(false);
expect(probe.current!.sloganRevealed).toBe(false);
@@ -256,6 +267,79 @@ describe('LoginHandoff 时序(fake-timer)', () => {
expect(vi.getTimerCount()).toBe(0);
});
+ it('reduced-motion 下 Splash 延迟卸载仍冻结布局,完成后才落终态', () => {
+ setReducedMotion(true);
+ render(
+ <LoginHandoffProvider authResolved authenticated={false}>
+ <LoginBrandStage />
+ <Probe />
+ </LoginHandoffProvider>,
+ );
+ act(() => probe.current!.reportLoginPanelMounted());
+ fireAnchors({ splashComplete: false });
+
+ expect(probe.current!.phase).toBe('awaiting-splash-exit');
+ expect(probe.current!.brandLayout).toBe('splash');
+ expect(probe.current!.panelRevealed).toBe(false);
+ expect(probe.current!.isPlaying).toBe(true);
+
+ act(() => vi.runAllTimers());
+ expect(probe.current!.phase).toBe('awaiting-splash-exit');
+
+ act(() => probe.current!.reportSplashExitCompleted());
+ expect(probe.current!.phase).toBe('done');
+ expect(probe.current!.brandLayout).toBe('login');
+ expect(probe.current!.panelRevealed).toBe(true);
+ expect(probe.current!.sloganRevealed).toBe(true);
+ expect(probe.current!.isPlaying).toBe(false);
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe('');
+ });
+
+ it('reduced-motion 下品牌布局切换不挂 transform transition', () => {
+ setReducedMotion(true);
+ render(
+ <LoginHandoffProvider authResolved authenticated={false}>
+ <LoginBrandStage />
+ <Probe />
+ </LoginHandoffProvider>,
+ );
+ act(() => probe.current!.reportLoginPanelMounted());
+ fireAnchors();
+ act(() => probe.current!.reportSplashExitCompleted());
+
+ expect(probe.current!.phase).toBe('done');
+ expect(probe.current!.brandLayout).toBe('login');
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe('');
+ });
+
+ it('已登录分支没有登录面板,始终保持 Splash 构图且不使用 footer 预留', () => {
+ render(
+ <LoginHandoffProvider authResolved authenticated coverHeld>
+ <LoginBrandStage />
+ <Probe />
+ </LoginHandoffProvider>,
+ );
+ act(() => {
+ probe.current!.reportBrandAssetsReady();
+ probe.current!.reportSplashExited();
+ probe.current!.reportSplashExitCompleted();
+ });
+ expect(probe.current!.branch).toBe('authenticated');
+ expect(probe.current!.brandLayout).toBe('splash');
+ const splash = splashBrandPlacement(window.innerWidth, window.innerHeight);
+ expect(screen.getByTestId('login-brand-canvas').style.transform).toBe(
+ `translate(-50%, calc(-50% + ${splash.translateY}px)) scale(${splash.scale})`,
+ );
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe('');
+
+ act(() => vi.advanceTimersByTime(LOGIN_HANDOFF_TIMINGS.brandExitMs));
+ expect(probe.current!.phase).toBe('done');
+ expect(probe.current!.brandLayout).toBe('splash');
+ expect(screen.getByTestId('login-brand-canvas').style.transform).toBe(
+ `translate(-50%, calc(-50% + ${splash.translateY}px)) scale(${splash.scale})`,
+ );
+ });
+
it('登录面板与品牌层通过 context 共享同一 bottom reserve', () => {
render(
<LoginHandoffProvider authResolved authenticated={false}>
@@ -270,6 +354,49 @@ describe('LoginHandoff 时序(fake-timer)', () => {
act(() => probe.current!.reportPanelBottomReserve(null));
expect(probe.current!.panelBottomReserve).toBeNull();
});
+
+ it('Splash 退场及 shift 期间锁定 Splash 布局,面板显示时才切到登录布局', () => {
+ render(
+ <LoginHandoffProvider authResolved authenticated={false}>
+ <Probe />
+ </LoginHandoffProvider>,
+ );
+ act(() => probe.current!.reportLoginPanelMounted());
+ fireAnchors();
+ expect(probe.current!.phase).toBe('settle');
+ expect(probe.current!.brandLayout).toBe('splash');
+
+ act(() => probe.current!.reportSplashExitCompleted());
+ expect(probe.current!.brandLayout).toBe('splash');
+
+ act(() => vi.advanceTimersByTime(T.settleMs + T.shiftMs));
+ expect(probe.current!.phase).toBe('panel');
+ expect(probe.current!.brandLayout).toBe('login');
+ });
+
+ it('Splash 延迟卸载时冻结在 Splash 布局,实际卸载后才进入 panel', () => {
+ render(
+ <LoginHandoffProvider authResolved authenticated={false}>
+ <Probe />
+ </LoginHandoffProvider>,
+ );
+ act(() => probe.current!.reportLoginPanelMounted());
+ fireAnchors({ splashComplete: false });
+
+ act(() => vi.advanceTimersByTime(T.settleMs + T.shiftMs));
+ expect(probe.current!.phase).toBe('awaiting-splash-exit');
+ expect(probe.current!.brandLayout).toBe('splash');
+ expect(probe.current!.panelRevealed).toBe(false);
+ expect(probe.current!.isPlaying).toBe(true);
+
+ act(() => vi.runAllTimers());
+ expect(probe.current!.phase).toBe('awaiting-splash-exit');
+
+ act(() => probe.current!.reportSplashExitCompleted());
+ expect(probe.current!.phase).toBe('panel');
+ expect(probe.current!.brandLayout).toBe('login');
+ expect(probe.current!.panelRevealed).toBe(true);
+ });
});
/* ── 冷启动集成(real AuthProvider + LoginBrandStage + SplashScreen + LoginPage) ── */
@@ -336,10 +463,11 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
const panel = panelPlacement(window.innerWidth, window.innerHeight, 1229, 0);
expect(screen.getByTestId('login-stage').style.top).toBe(`${panel.topY}px`);
- const brand = brandPlacement(window.innerWidth, window.innerHeight, 0);
+ const brand = splashBrandPlacement(window.innerWidth, window.innerHeight);
expect(screen.getByTestId('login-brand-canvas').style.transform).toBe(
`translate(-50%, calc(-50% + ${brand.translateY}px)) scale(${brand.scale})`,
);
+ expect(probe.current!.brandLayout).toBe('splash');
});
it('unauthenticated 冷启动:品牌屏→完整衔接播放;全程单一品牌 DOM/最多一个可见 panel/done 后可点击/overlay 不拦截', async () => {
@@ -366,7 +494,10 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
expect(group.style.pointerEvents).toBe('none');
// 单一品牌 DOM:LoginPage 面板宿主层内不含任何品牌图(所有权契约)
const panelHost = screen.getByTestId('login-panel-stage-root');
- expect(panelHost.querySelectorAll('img[src*="hero"], img[src*="wordmark"], img[src*="slogan"]').length).toBe(0);
+ expect(
+ panelHost.querySelectorAll('img[src*="hero"], img[src*="wordmark"], img[src*="slogan"]')
+ .length,
+ ).toBe(0);
// overlay 不拦截 hit-test
expect(screen.getByTestId('login-stage-root').className).toContain('pointer-events-none');
@@ -377,6 +508,7 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
});
expect(probe.current!.phase).toBe('settle');
expect(probe.current!.branch).toBe('unauthenticated');
+ expect(probe.current!.brandLayout).toBe('splash');
// splash fade 500ms 后卸载;handoff 尚在 shift 段(t=500 < 950)
await act(async () => {
@@ -384,13 +516,19 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
});
expect(screen.queryByTestId('splash-panel')).toBeNull();
expect(probe.current!.phase).toBe('shift');
+ expect(probe.current!.brandLayout).toBe('splash');
expect(screen.getByTestId('login-group').style.opacity).toBe('0');
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe('');
// t=950:面板入场(420ms 上滑 20px);Slogan 仍未出现
await act(async () => {
vi.advanceTimersByTime(450);
});
expect(probe.current!.phase).toBe('panel');
+ expect(probe.current!.brandLayout).toBe('login');
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe(
+ `transform ${LOGIN_HANDOFF_TIMINGS.panelMs}ms ${LOGIN_HANDOFF_TIMINGS.panelEasing}`,
+ );
const groupIn = screen.getByTestId('login-group');
expect(groupIn.style.opacity).toBe('1');
expect(groupIn.style.transform).toContain('translateY(0px)');
@@ -412,6 +550,8 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
});
expect(probe.current!.phase).toBe('done');
expect(screen.getByTestId('login-brand-hero').style.left).toBe('443px');
+ expect(probe.current!.brandLayout).toBe('login');
+ expect(screen.getByTestId('login-brand-canvas').style.transition).toBe('');
const doneGroup = screen.getByTestId('login-group');
expect(doneGroup.style.opacity).toBe('1');
expect(doneGroup.style.pointerEvents).not.toBe('none');
@@ -447,13 +587,34 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
});
expect(probe.current!.branch).toBe('authenticated');
expect(probe.current!.phase).toBe('brand-exit');
- // 淡出中:overlay 仍挂载(平滑),opacity → 0
+ // 淡出中:保持 Splash 品牌布局,只淡出内容层;背景仍不透明,避免透出
+ // macOS transparent/vibrancy backing。
+ expect(probe.current!.brandLayout).toBe('splash');
const overlay = screen.getByTestId('login-stage-root');
- expect(overlay.style.opacity).toBe('0');
- expect(overlay.style.transition).toContain('--splash-fade-duration');
+ expect(overlay.style.opacity).toBe('');
+ expect(overlay.style.transition).toBe('');
+ const content = screen.getByTestId('login-brand-content');
+ expect(content.style.opacity).toBe('0');
+ expect(content.style.transition).toContain('--splash-fade-duration');
+ const splashPlacement = splashBrandPlacement(window.innerWidth, window.innerHeight);
+ expect(screen.getByTestId('login-brand-canvas').style.transform).toBe(
+ `translate(-50%, calc(-50% + ${splashPlacement.translateY}px)) scale(${splashPlacement.scale})`,
+ );
+ expect(screen.getByTestId('login-brand-bg').style.backgroundColor).toContain(
+ 'var(--login-bg-base)',
+ );
+ expect(`${LOGIN_HANDOFF_TIMINGS.brandExitMs}ms`).toBe(
+ colorRegistry.resolveDefault('splash-fade-duration', 'light'),
+ );
await act(async () => {
- vi.advanceTimersByTime(500);
+ vi.advanceTimersByTime(LOGIN_HANDOFF_TIMINGS.brandExitMs - 1);
+ });
+ expect(probe.current!.phase).toBe('brand-exit');
+ expect(screen.getByTestId('login-brand-bg')).toBeTruthy();
+
+ await act(async () => {
+ vi.advanceTimersByTime(1);
});
expect(probe.current!.phase).toBe('done');
// overlay 卸载,主界面接管;全程未出现登录面板
@@ -508,6 +669,7 @@ describe('冷启动集成(resolved snapshot,禁 mock-reject)', () => {
expect(group.style.transform).toBe('translateY(0px)');
expect(group.style.transition).toBe('');
expect(group.style.pointerEvents).not.toBe('none');
+ expect(probe.current!.brandLayout).toBe('login');
// phase 恒 done;跑空全部在途 timer(仅剩 jsdom input focus 的 0ms 内部 timer)
// 后 phase/视觉零变化 = 不重播(playedRef 语义)
expect(probe.current!.phase).toBe('done');