- 216px 文字侧栏改为 60px 图标轨:金色渐变 Logo、当前页金色指示条滑动、350ms 延迟悬停提示,底部连接/模型/设置/语言 - 顶栏:标题+副标题、项目范围胶囊(全部项目列表/最近项目)、Ctrl/⌘K 搜索、减少动态开关、任务托盘胶囊、本次连接胶囊(名称+延迟) - ≤760px:隐藏图标轨,底部 项目/创作/生成/更多 四个标签,更多为底部抽屉(其余页面、搜索、减少动态、语言);删除「手机端暂不适配」拦截 - 新增 ShellPop(Esc/↑↓/Tab 循环/外部点击关闭、焦点归还)与 CommandPalette(复用 Modal) - 减少动态:跟随系统设置,另可手动开启并持久化(data-reduce) - .a-darkroom 背景接入 --page-glow;新增壳层尺寸 token 与 .a-kbd/.a-menu-* 公共类 - 生图/生视频顶栏去掉与全局胶囊重复的连接状态(参数栏仍显示所选连接与队列) - 路由 URL 不变(/projects 仍重定向到项目总览 /) Co-authored-by: multica-agent <github@multica.ai> Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { storageGet, storageSet } from './storage';
|
|
|
|
/**
|
|
* 减少动态效果 (HEL-649 §五). The OS setting always wins (app.css also reacts
|
|
* to `prefers-reduced-motion` directly, so it cannot be switched off here);
|
|
* otherwise the top-bar switch decides. The effective value is mirrored to
|
|
* `<html data-reduce="1">`, which is what every reduced-motion rule keys on.
|
|
*/
|
|
const STORAGE_KEY = 'aigc-reduce-motion';
|
|
const QUERY = '(prefers-reduced-motion: reduce)';
|
|
|
|
export const reduceMotion = $state({ system: false, manual: false });
|
|
|
|
let stop: (() => void) | null = null;
|
|
|
|
function apply() {
|
|
document.documentElement.dataset.reduce =
|
|
reduceMotion.system || reduceMotion.manual ? '1' : '0';
|
|
}
|
|
|
|
/** Call once on the client (root layout). Returns the teardown. */
|
|
export function initReduceMotion(): () => void {
|
|
if (typeof window === 'undefined') return () => {};
|
|
stop?.();
|
|
const mq = window.matchMedia(QUERY);
|
|
reduceMotion.system = mq.matches;
|
|
reduceMotion.manual = storageGet(STORAGE_KEY) === '1';
|
|
apply();
|
|
const onChange = (e: MediaQueryListEvent) => {
|
|
reduceMotion.system = e.matches;
|
|
apply();
|
|
};
|
|
mq.addEventListener('change', onChange);
|
|
stop = () => mq.removeEventListener('change', onChange);
|
|
return () => {
|
|
stop?.();
|
|
stop = null;
|
|
};
|
|
}
|
|
|
|
export function setReduceMotion(on: boolean) {
|
|
reduceMotion.manual = on;
|
|
storageSet(STORAGE_KEY, on ? '1' : '0');
|
|
apply();
|
|
}
|