Skip to content

[ONE-67] 动效、微交互与响应式打磨 — 令牌化动效语言 + 键盘可达性 (ONE-71) - #141

Merged
mapxn merged 10 commits into
mainfrom
feat/ONE-71-motion-micro-responsive
Oct 24, 2026
Merged

mapxn merged 10 commits into
mainfrom
feat/ONE-71-motion-micro-responsive

Conversation

@mapxn

@mapxn mapxn commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

父单 ONE-67 Stage 4(ONE-71)。基于 ONE-70 分支(feat/ONE-70-page-visual),只含最顶部一个提交 a3ae6b5。

动效规范表(场景 / 时长 / 缓动 / 信息职责 / 实现位置)

场景 时长 缓动 信息职责 实现
页面/区块进场 320ms ease-out 建立导航连续性 .motion-enter(AppLayout 按路由 key 重放、AuthShell)
列表首屏 stagger 320ms + 40ms×≤6 ease-out 提示阅读顺序 .stagger(dashboard/detail/admin 骨架、items 首屏)
列表项删除退场 200ms ease-in 确认删除、保持空间连续性 animate-list-item-out + 延时移除(ItemList)
按钮按下 120ms ease-standard 按压反馈 active:scale-[0.98](ui/button,Stage 2 已有)
Dialog 入场 backdrop 200ms / panel 320ms ease-out 聚焦注意、建立浮层层级 animate-dialog-backdrop/panel(ConfirmDialog、PasswordPrompt、AdminUsers、History)
Popover 入场(tooltip/dropdown/筛选/更多菜单/TagCombobox) 200ms ease-out 反馈状态 animate-popover
状态切换反馈(渠道测试/保存结果) 200ms ease-out 反馈成功/失败,无位移 animate-status + role="status"
移动端底栏激活指示 200ms ease-out 指示当前位置(契约 §5 共享 pill) AppLayout 滑动 pill(transform-only)
骨架屏 → 内容 120ms pulse 保留 / stagger 进场 — 建立连续性 Skeleton stagger

全部引用 --duration-fast/standard/slow 与 --ease-* 令牌,无魔法值;位移类只用 transform/opacity;无 bounce/elastic;未引入任何依赖、未新增令牌。

六态走查(hover / focus-visible / active / disabled / loading / error)

  • Button/Switch/Tabs/Input:六态 Stage 2 已具备,本单无回归。
  • ConfirmDialog / PasswordPromptDialog:本单补齐——Esc 关闭、role=dialog + aria-modal、按钮 focus 环、ConfirmDialog 焦点陷阱 + 关闭后焦点归还 + 初始焦点落取消键。
  • AvatarDropdown:本单补齐 Esc 关闭、aria-haspopup/expanded、role=menu/menuitem、focus 态。
  • ItemList 更多菜单 / 移动端筛选 / 桌面 FilterIcon / HelpIcon:本单补齐 Esc 关闭;HelpIcon 补键盘 focus 触发(原来仅 hover)。
  • AdminUsers 编辑弹窗、History 详情弹层:本单补齐 Esc 关闭 + dialog 语义 + 进出场。
  • Channels 测试按钮:loading(disabled+文案)已有;结果反馈本单加 200ms 状态动画 + role="status"。
  • error 态:ErrorState(role=alert)/ FormError(200ms 滑入)已具备。

响应式三档走查(≤640 / 641-1023 / ≥1024)

  • 双布局骨架(移动底栏 / 桌面侧栏)+ 768 断点沿用 Stage 3 结构;平板档(768-1023)走桌面布局,侧栏 256px 下内容区 ≥512px 无挤压。
  • 表格窄屏降级:items/history 桌面表格 ↔ 移动卡片双布局(Stage 3);admin tab 栏横向滚动容器 overflow-x-auto no-scrollbar 明示。
  • 长文本:items 移动端备注补 break-words;settings 长密钥/URL 已有 break-all;表格列 truncate。
  • 弹层窄屏:ConfirmDialog/详情弹层 mx-4+max-w-*;tooltip max-w-80;均在视口内。
  • Playwright 实测 login 页 375/800/1440 三档 scrollWidth 无横向溢出(截图见附件)。受环境限制(无后端可登账号),其余 18 页为代码结构核查 + 三档布局类走查。

prefers-reduced-motion 实测

Playwright reducedMotion: 'reduce':.motion-enter 实测 animation: status-in 0.12s(位移动画 → 纯淡变),transform 无残留;animate-pulse/spin 收敛为单帧;transition 统一 120ms 保留状态反馈。

键盘走查

Tab/Shift+Tab 主路径可用;Esc 可关闭全部浮层(ConfirmDialog、PasswordPrompt、AvatarDropdown、更多菜单、筛选、TagCombobox、编辑/详情弹层);focus 环全程可见(focus-visible:ring-2,缺的全补齐);ConfirmDialog 焦点不外泄(焦点陷阱)。

质量门

  • pnpm build ✅ / pnpm typecheck ✅ / pnpm lint ✅(与基线相同的既有 warning×1,无新增)

未验证说明

  • 录屏:本环境无可登录的后端实例,authed 页面的动效以关键帧截图(login 页 focus 环 / 错误态 / reduced-motion 实测值)代替;三档响应式截图同样覆盖 login 页,其余页面建议在预览环境复验。
  • 未做新的静态视觉重构;未发现需要上报的新静态视觉问题。

mapxn added 6 commits October 23, 2026 21:18
按 ONE-82 裁决的新契约 docs/design-system.md(「时间账本 Ledger of Time」)重做:

- index.css: @font-face 自托管 Inter Variable(woff2 入仓,font-display: swap,weight 100-900);@theme inline 落 8 组 token——字体族(Inter→系统栈→CJK / mono)、8 级字阶(含行高/字重/字距,字重含 Inter Variable 原生 650)、六级圆角阶梯(4/6/8/12/16/full)、四级阴影(dark 改边框+微光补偿)、n-* 中性色阶为唯一来源 + n→role 显式映射、indigo 品牌色(#4f46e5 / #818cf8)、success/warning/info 语义色、due-far/soon/close/over 倒计时紧迫梯度、三档时长 + 三条缓动;prefers-reduced-motion 全局降级
- docs/design-system.md: 修正 §4.6 两处错误 HSL 字面量(按回填冻结值 0 73.7% 41.8% / 0 90.6% 70.8%)
- n-* 不对称键集:落地为「同名全覆盖」,.dark 覆盖全部 12 键并在注释中记录映射,不依赖回退
- ui/{button,card,input,label,switch,tabs}: 按新令牌重做——button press 0.98 + 120ms ease-standard、icon 尺寸 44px 触控目标、default/destructive 挂 shadow-1;card 去边框改 shadow-1、padding 16/24 移动桌面分档、CardTitle 走 --text-title;input 圆角 6px + 200ms 状态过渡;switch 120ms;tabs 200ms 过渡 + shadow-1;props/导出名全部不变
- AppLayout: 容器 max-w-6xl→max-w-5xl、首屏留白 pt-6/pt-8;appName 改 --text-title + primary 圆点品牌签名;桌面侧栏激活项加左侧 2px primary 指示条;impersonation/PWA 横幅改 warning/info token;底部导航激活态字重 400→500 + 44px 触控目标;去 aside 裸 hsl 阴影;shadow-lg→shadow-3
- ThemeProvider: meta theme-color 对齐新底色(dark #0a0a0c)

质量门: pnpm build / typecheck / biome lint(web 侧)全绿;19 页面零改动
- 起手契约修订(Mike 授权):亮色 n-500 4.39:1 → 5.17:1 达标 AA,
  同步 muted-foreground / due-far,design-system.md 附录 A 记录
- 新增共享件:DueRing/DueCount(倒计时环形进度 + display 级 tabular
  数字,due-* 紧迫梯度)、Skeleton/EmptyState/ErrorState(三态)、
  AuthShell/FormError(auth 居中卡 + 错误 200ms 滑入)
- dashboard:最近到期主视觉(环形 + display-lg 倒计时)、统计卡
  数字 display 化、账本式分录行、同形态骨架、空态/错误态
- items 列表:状态徽章与倒计时全部接 due-*/success/warning 语义
  token,桌面行倒计时环形 + tabular 日期,移动卡主行大数字 +
  操作收进溢出菜单(可见 ≤2),空态排版化
- items new/detail:表单分区(基本/周期到期/提醒渠道),详情页
  头部实时到期预览环 + display 倒计时,支付/续期表 tabular
- channels:渠道卡标题 text-title + 启用状态语义徽章
- history:成功/失败徽章语义化、骨架同形态、排版空态、详情弹层
  shadow-4
- me:账本头(头像 + 邮箱 + 本月到期 display 数字)
- settings/admin×5:骨架全部改同形态,success/warning/destructive
  token 替换硬编码绿黄红,表格表头 caption 化
- about:分录式定义列表;setup/auth×5:AuthShell 400px 卡 +
  shadow-2 + display logo 区 + 错误滑入
- i18n:新增 common.retry/more、dashboard/items/history/me/detail
  等键(中英同步)
…omptDialog 焦点陷阱 (ONE-69)

- docs/design-system.md:4 处 #60606b → #666670(与冻结 HSL 240 4.9% 42% 等值,实测 on muted 5.16:1 / on 白 6.10:1 达标),代码侧 index.css 不动(Mike 裁决)
- PasswordPromptDialog:接入既有 useFocusTrap(Tab/Shift+Tab 循环 + Escape 关闭 + 关闭后焦点还原);ConfirmDialog 重复声明清理
- nit:ThemeProvider meta theme-color 收敛为 META_THEME_COLOR 常量(注释标明与 index.css token 对应);DueRing aria-label 本地化(新增 common.daysLeftShort / common.overdueBy 双语 key)
blocking·数据源(后端 7 天窗口字段曾被当 30 天/已逾期/本月展示):
- dashboard: 「30 天内到期」→「7 天内到期」; 恒为 0 的「已逾期」卡
  (upcoming_renewals 不含逾期)替换为真实「活跃条目」
- me: 「本月到期」改用 expiring_soon 直读并改文案「7 天内到期」
- 按族全量排查:全站 expiring_soon/upcoming_*/时间衍生计算共 14 处,
  逐一核对语义(清单见交付评论);localToday/daysUntil 收敛到
  lib/utils 单点

should-fix:
- 魔法色清零:ItemList text-green-500→text-success、ItemDetail
  bg-gray-300→bg-input、Settings amber×2→warning token、
  AdminUsers purple 角色徽章→bg-info/10 text-info
- 键盘可达性:抽公共 useFocusTrap(焦点陷阱/初始焦点/Esc/焦点归还),
  接入 history 详情浮层、AdminUsers 编辑浮层、ConfirmDialog
  (PasswordPromptDialog 已在 0acd352 接入,本次修其声明顺序 bug)

设计契约 §5 结构:
- items/new: 桌面双栏(左表单右 sticky 到期预览卡 DueRing+DueCount)
  + 移动端三分区手风琴
- items/:id: 头部内联预览改为右栏摘要卡(环形+倒计时+到期日/周期/
  金额分录行)
- history: 按日分组 + sticky 组标题(桌面表格 rowgroup/移动端 sticky 标题)
- setup: DueRing 环形语言步骤指示器(初始化→完成)
@mapxn mapxn closed this Oct 23, 2026
@mapxn mapxn reopened this Oct 23, 2026
@mapxn
mapxn force-pushed the feat/ONE-71-motion-micro-responsive branch from 737b73c to c9f7a43 Compare October 23, 2026 16:17
mapxn added 3 commits October 24, 2026 03:12
- index.css: 动效语言落地契约 §4.7——motion-enter/stagger(40ms×6)/dialog/
  popover/list-item/status 六组 keyframes,全部引用 --duration-*/--ease-*
  令牌;prefers-reduced-motion 下位移动画降级为 opacity 淡变
- AppLayout: 页面/区块进场 motion-enter(按路由 key 重放);移动端底栏
  共享 pill 指示器 200ms ease-out 滑动(契约 §5,transform-only);
  AvatarDropdown 补 Esc 关闭 / aria-haspopup / role=menu / 焦点环
- ConfirmDialog / PasswordPromptDialog: 320ms 面板入场(契约 §5 admin),
  role=dialog + aria-modal,Esc 关闭,ConfirmDialog 焦点陷阱 + 关闭后焦点归还
- AdminUsers 编辑弹窗、History 详情弹层: 同款 dialog 动效 + Esc
- ItemList: 删除退场动画(200ms ease-in)后移除;首屏行/卡片 stagger 进场;
  全部浮层(工具提示/筛选/更多菜单/移动端筛选)接 animate-popover + Esc;
  HelpIcon 补键盘 focus 触发;移动端备注 break-words 防溢出
- Channels: 测试/保存反馈 200ms 状态动画 + role=status;裸 loading 文本
  换同形态骨架(stagger)
- Settings 桌面 tab 栏: 过渡令牌化 + focus 环; auth 卡 motion-enter 进场
- 骨架屏 stagger 进场 (dashboard/detail/admin×3)
- 未引入任何依赖、未新增令牌;路由/API/i18n/worker 未动
上轮提交两个编辑因目标文本不匹配未落盘(AppLayout 底栏仍是静态激活色、
Settings tab 仍是 per-button border-b),Tony 评审 (ONE-72) 指出,本次修复:

- AppLayout 移动底栏:共享 pill 指示器 200ms ease-out 滑动到激活 tab
  (transform-only,非 tab 路径淡出),焦点环补齐
- SettingsPage 桌面 tab 栏:per-button border 改为共享下划线滑动动画,
  位置/宽度 useLayoutEffect 实测 active 按钮(换语言自适应),
  200ms ease-out,transition-[transform,width]
- 确认 key={location.pathname} 无状态/滚动回归(keep-alive tab 页不受影响,
  桌面滚动容器在 main 上)

验收: pnpm build / typecheck / lint 全绿
纯格式改动(import/属性拆行),无语义变更;本地 format:check / lint /
typecheck / build 全绿。
@mapxn
mapxn force-pushed the feat/ONE-71-motion-micro-responsive branch from c9f7a43 to d734e50 Compare October 23, 2026 19:13
- 删除 zh/en 的 dashboard.expiring30、dashboard.overdue、me.dueThisMonth(均 0 引用,冻结范围)
- MePage.tsx 注释 this-month due count → 7-day due count(与 expiring_soon 求和实现一致)
- 零行为变化:仅 locale 删除 + 1 行注释
@mapxn
mapxn changed the base branch from feat/ONE-70-page-visual to main October 24, 2026 00:03
@mapxn
mapxn merged commit 7467381 into main Oct 24, 2026
1 check passed
@mapxn
mapxn deleted the feat/ONE-71-motion-micro-responsive branch November 8, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant