From aad714e26845b25b59dd7bdce9720cc8d9d51b8d Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Thu, 3 Sep 2026 22:58:51 +0800 Subject: [PATCH] refactor(animations): annotate design-system.ts compliance trap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task #16 残留陷阱治理(保留待用、不动代码): scope: src/lib/constants/design-system.ts(零生产消费者的死代码) action: 仅加注释,不改令牌值、不动 design-system.test.ts、零行为变化 - 文件头警示块:声明本文件为合规陷阱、令牌与 CONTEXT.md 冲突、 test 用 // @ts-nocheck 断言错误值、勿在新代码 import - 7 处冲突令牌行内 ⚠️ 注释: normal 0.4s 超目标 / slow 0.6s P1 / slower 0.8s P0 硬上限 / smooth 非 ease-ink / bounce 弹性缓动 / stagger 0.08 P2 / scroll 0.6s P1 verified: - eslint design-system.ts: 0 errors (ESLINT_EXIT=0) - jest design-system.test.ts: 20/20 passed (JEST_EXIT=0) - 纯注释改动,tsc 无语法变化(已隔离单文件 diff) note: 此前决策「保留待用、不动代码」——本提交仅显性化陷阱, 未来修正须同步改测试,否则必挂(P1 阶段已实践过该回退)。 --- src/lib/constants/design-system.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/lib/constants/design-system.ts b/src/lib/constants/design-system.ts index 61aae6b..c58e770 100644 --- a/src/lib/constants/design-system.ts +++ b/src/lib/constants/design-system.ts @@ -1,24 +1,31 @@ // Design System Constants — L3 Detail Pages // Color tokens reference global CSS variables for dark-mode support. // Layout / spacing / animation / easing remain as JS constants. +// +// ⚠️ COMPLIANCE TRAP(Task #16 残留,刻意保留待用): +// 本文件动画令牌与 CONTEXT.md 动效约束冲突(见下方各 ⚠️ 行),且 +// design-system.test.ts 用 `// @ts-nocheck` 断言了这些「错误值」。 +// 它是零生产消费者的死代码,仅作历史参考。请勿照抄带 ⚠️ 的令牌; +// 新代码请直接用 ScrollReveal 默认(duration 0.3 / stagger 0.05 / +// easing ease-ink [0.22, 1, 0.36, 1])。要修正须同步改测试,否则必挂。 export const DESIGN_SYSTEM = Object.freeze({ animation: { duration: { fast: '0.2s', - normal: '0.4s', - slow: '0.6s', - slower: '0.8s', + normal: '0.4s', // ⚠️ 超目标:CONTEXT.md 入场目标 200-300ms,0.4s=400ms 超时 + slow: '0.6s', // ⚠️ P1:>300ms 目标(仍 ≤700ms 硬上限) + slower: '0.8s', // ⚠️ P0:>700ms 硬上限违规(最严重) countUp: '2s', }, easing: { - smooth: 'cubic-bezier(0.4, 0, 0.2, 1)', - bounce: 'cubic-bezier(0.34, 1.56, 0.64, 1)', + smooth: 'cubic-bezier(0.4, 0, 0.2, 1)', // ⚠️ 非 ease-ink [0.22,1,0.36,1] + bounce: 'cubic-bezier(0.34, 1.56, 0.64, 1)', // ⚠️ 弹性缓动,违反「禁 spring 内容入场」 easeOut: 'cubic-bezier(0, 0, 0.2, 1)', easeInOut: 'cubic-bezier(0.4, 0, 0.6, 1)', }, delay: { - stagger: 0.08, + stagger: 0.08, // ⚠️ P2:>60ms(应为 ≤0.06,对齐 ScrollReveal 0.05) section: 0.15, }, }, @@ -73,7 +80,7 @@ export const DESIGN_SYSTEM = Object.freeze({ initial: { opacity: 0, y: 24 }, animate: { opacity: 1, y: 0 }, viewport: { once: true, margin: '-80px' }, - transition: { duration: 0.6, ease: [0.16, 1, 0.3, 1] as const }, + transition: { duration: 0.6, ease: [0.16, 1, 0.3, 1] as const }, // ⚠️ P1:0.6s 超 300ms 目标 }, staggerChildren: { delay: 0.08,