fix(motion): ScrollReveal 默认入场 400ms→300ms,对齐动效四原则目标值

约束纠正:CONTEXT.md L49-61 规定入场 200-300ms 为**目标值**,700ms 只是
「禁止超过」的**硬上限**(L58)。此前按 700ms 执行属最低限度合规。

杠杆点改动:
- src/components/ui/scroll-reveal.tsx:69 duration 0.4 → 0.3
  该默认值被 22 个文件消费,一行改动即把全站默认入场拉到目标区间
- 同文件 staggerDelay/delayChildren = 0.05 已在 30-60ms 目标内,未动

新增审计工具(Task #16 各批次复用):
- scripts/audit/motion-duration-audit.mjs:扫 273 文件,抓 framer duration /
  默认参数 / Tailwind duration-NNN / staggerDelay·delayChildren·delay,
  按 P0(>700ms) / P1(300-700ms) / P2(stagger>60ms) 分级
  - 已修正两处自身缺陷:漏掉默认参数赋值 duration=N;CountUp/toast 的
    毫秒值误判为秒(加 >10 判毫秒排除 7 处误报)
- scripts/audit/motion-smoke.mjs:多路由 × 浅深运行时冒烟(hydration + 0 报错)

盘点基线(本次审计):P0 硬违规 99 / P1 超目标 164 / P2 stagger 28
- 其中 animations.tsx 20 处为死代码(生产零消费方,仅自家 test import),
  按「保留待用」决策不动,不计入用户可见违规 → 用户可见 P0 89 / P1 157 / P2 25

验证:tsc 0 错 · eslint 0 错(50 既有 warnings) · jest 129 套件/1628 通过
      冒烟 5 路由 × 浅深 = 10/10 PASS(hydration=true, errors=0)
This commit is contained in:
2026-09-20 11:50:58 +08:00
parent 62e6b6ea81
commit 5159862e96
3 changed files with 221 additions and 1 deletions
+5 -1
View File
@@ -66,7 +66,11 @@ export function ScrollReveal({
xOffset = 0,
margin = '-40px',
variant = 'fadeIn',
duration = 0.4,
// 入场时长默认值:CONTEXT.md L52「动效设计四原则 · Fast」规定入场 200-300ms。
// 原值 0.4(400ms)超出目标区间,改为 300ms(目标上限)。
// 注意:700ms 是「禁止超过」的硬上限(CONTEXT.md L58),不是目标值。
// 本默认值被 22 个文件消费,改动影响面大,需视觉回归。
duration = 0.3,
once = true,
amount = 0,
}: ScrollRevealProps) {