fix(motion): DEC-N3 的 8 条动效违反归零,判据从令牌声明移到消费点
6 处写死贝塞尔收进 ease-ink [0.22,1,0.36,1](各处注释标 CONTEXT.md:77 出处); globals.css:1486 的裸时长 opacity 0.6s 改 var(--transition-slower)。 --transition-gentle = 1000ms 这一条量过再定:实测 src/ 里零消费 (只有 tailwind.config.js 的 duration-gentle 映射,无一处使用),入场消费点 0 ⇒ 原「令牌声明一律 ≤700ms」是把 CONTEXT.md:82 的**入场**红线读成了对调色板的禁令。 现口径改为按用途在消费点判红:非 infinite 的声明(含 var() 解析出的时长)>700ms 必红, infinite 循环环境动效维持豁免。 负对照(真树注入→还原):塞回 [0.16,1,0.3,1] + opacity 900ms 裸字面量 + opacity var(--transition-gentle) ⇒ check:motion EXIT=1,4 红命中 easing-palette×1、 css-transition-token×1、entrance-cap×2;还原后 EXIT=0、违规 0。 读数:check:motion EXIT=0(0 违反)、check:motion:test EXIT=0(21/21)。
This commit is contained in:
1 parent
f3e66f7d36
commit
4afab7c929
6 files changed
+73
-23
No files matched your search
@@ -272,7 +272,8 @@ describe('违规夹具:每条规则都必须能判红(防「常绿」)', (
|
||||
expect(result.byRule('token-band').map((v) => v.token)).toEqual(['250ms', '400ms']);
|
||||
});
|
||||
|
||||
it('R2 entrance-cap —— 令牌 1200ms / framer 1.4s / duration-900 类 / 配置串 1.1s', () => {
|
||||
it('R2 entrance-cap —— framer 1.4s / duration-900 类 / 内联 0.9s / 配置串 1.1s / 超上限令牌被非循环声明消费', () => {
|
||||
// DEC-N3(2026-10-08)后口径:令牌声明自身不判(声明无用途),**消费点**判红。
|
||||
const result = scanFixture({
|
||||
css: `
|
||||
:root {
|
||||
@@ -295,10 +296,10 @@ describe('违规夹具:每条规则都必须能判红(防「常绿」)', (
|
||||
config: `module.exports = { theme: { extend: { animation: { 'slow-in': 'fadeIn 1.1s var(--ease-ink) forwards' } } } };`,
|
||||
});
|
||||
expect(result.exitCode).toBe(EXIT_VIOLATION);
|
||||
// 令牌自身 + 经 var() 解析到该令牌的声明 + framer 1.4s + duration-900 类 + 内联 0.9s + 配置串 1.1s
|
||||
expect(result.countOf('entrance-cap')).toBe(6);
|
||||
// 经 var() 解析到超上限令牌的 .banner 声明 + framer 1.4s + duration-900 类 + 内联 0.9s + 配置串 1.1s。
|
||||
// `--transition-gentle: 1200ms` 声明本身**不再**计入(用途未知,判红在消费点)。
|
||||
expect(result.countOf('entrance-cap')).toBe(5);
|
||||
expect(result.byRule('entrance-cap').map((violation) => violation.file)).toEqual([
|
||||
'src/app/globals.css',
|
||||
'src/app/globals.css',
|
||||
'src/components/card.tsx',
|
||||
'src/components/card.tsx',
|
||||
@@ -307,6 +308,35 @@ describe('违规夹具:每条规则都必须能判红(防「常绿」)', (
|
||||
]);
|
||||
});
|
||||
|
||||
it('R2 按用途分类(DEC-N3)—— 超上限令牌:零消费不判红;被非循环声明消费必判红;仅 infinite 消费豁免', () => {
|
||||
const tokenCss = (usage: string) => `
|
||||
:root {
|
||||
--transition-instant: 100ms;
|
||||
--transition-fast: 180ms;
|
||||
--transition-normal: 280ms;
|
||||
--transition-gentle: 1000ms;
|
||||
--ease-ink: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
${usage}
|
||||
`;
|
||||
// ① 真实仓库形状:1000ms 档存在但 src/ 零消费 ⇒ 不得判红(这正是 DEC-N3 的拍定依据)
|
||||
const unconsumed = scanFixture({ css: tokenCss('') });
|
||||
expect(unconsumed.countOf('entrance-cap')).toBe(0);
|
||||
expect(unconsumed.exitCode).toBe(EXIT_CLEAN);
|
||||
|
||||
// ② 负对照:把它接入一个非循环 transition ⇒ **必须**在消费点判 entrance-cap
|
||||
const consumed = scanFixture({ css: tokenCss('.hero { transition: opacity var(--transition-gentle) var(--ease-ink); }') });
|
||||
expect(consumed.exitCode).toBe(EXIT_VIOLATION);
|
||||
expect(consumed.countOf('entrance-cap')).toBe(1);
|
||||
expect(consumed.byRule('entrance-cap')[0]?.file).toBe('src/app/globals.css');
|
||||
|
||||
// ③ 循环环境动效(infinite)消费 ⇒ 按既有豁免不属「入场」
|
||||
const ambient = scanFixture({
|
||||
css: tokenCss('.aura { animation: auraPulse var(--transition-gentle) var(--ease-ink) infinite; }'),
|
||||
});
|
||||
expect(ambient.countOf('entrance-cap')).toBe(0);
|
||||
});
|
||||
|
||||
it('R3 css-transition-token —— 裸 ms/s 字面量与悬空 var() 引用', () => {
|
||||
const result = scanFixture({
|
||||
css: `
|
||||
|
||||
Reference in new issue
Block a user