refactor(detail): 详情五页旧语法清账(P4-B2)+ R16 补内联通道
范围:products / solutions / services 详情、cases/[slug]、news 详情五页。
B1 之后棘轮剩下的存量基本都在这里。
清掉的(棘轮读数 → 实况)
- R13 67→48:rounded-2xl/xl/3xl 共 19 处 → 直角
- R14 17→13:hover:-translate-y 4 处
- R15 16→13:hover:shadow-lg 3 处
- R16 22→8:bg-brand-soft 彩砖 14 处 → bg-bg-secondary;剩余 8 处为类名通道存量
- R17 43→39:font-black 4 处 → font-bold
- R19 11→7:font-extrabold 4 处 → font-bold
- transition-all → transition-colors(去掉位移/阴影后不该再接 all)
- delay 1.2s → 0.15s;时间轴圆点 rounded-full → 直角
**R16 补上内联通道**(本批最重要的判据修复)
B2 抓到一处类名通道完全看不见的违反:`case-detail-page.tsx` 把整整一个 `<section>`
刷成 `style={{ background: "var(--color-brand)" }}` —— 类名零命中、闸全绿、而那是
「饱和红从不用作面」最严重的一种。现在 R16 同时看两条通道:
`bg-brand-(soft|section)` 类名 + `background(Color): "var(--color-brand*)"` 内联。
selftest 的 dirty 夹具已补内联样本,两条通道各自可失败。
该页顺带修掉三处
- 满幅红面 → ink 底(`bg-[#0B0A08]`,走 class 而不是内联 style)
- 两枚 `rounded-full ... blur-[120px]` 白色光晕球删除(玻璃拟态/彩色光晕在禁止清单里)
- 两处内联 `--color-brand-soft` 徽章改用 DESIGN 许可的双通道写法
`--color-brand-bg`(blush) + `--color-brand-ink`(红做底 / 红做字必须分通道)
- 指标数字的 `group-hover:scale-110` 删除(hover 只改线/色)
验证
- check:grammar --selftest 全通过;check:grammar 19/19 EXIT=0(R16 实测 8 = 类名 8 + 内联 0)
- check:accents / check:a11y / check:motion 全 EXIT=0
- type-check EXIT=0;eslint 0 error;jest 157 套件 / 1849 例全通过
- e2e(prod) @smoke|@critical chromium+chromium-mobile:39 passed / 3 skipped
- 视觉 --workers=2 只读:**130 passed / 0 failed**
一条纪律被自己的顺序打脸(写进 docs/acceptance/)
- 本轮先 build 再跑 @smoke(含写库用例)再跑视觉 ⇒ /news 又在 5 个 project 一致判红。
这次库里是干净的,脏的是**产物**:ISR 在测试数据存在期间重生成了 /news 并写回 dist
(grep 产物 = 2 命中)。根因与「build 时脏」同源,触发点从构建期换到运行期。
⇒ 视觉认证轮不与写库型 E2E 同轮:先 E2E、后 build、再只跑视觉;跑前先 grep 产物为 0。
This commit is contained in:
1 parent
88638054ae
commit
09b78369eb
7 files changed
+113
-76
No files matched your search
@@ -100,8 +100,11 @@ const MARKETING_FLOOR = 60;
|
||||
* 按「只降不升」的纪律在同一提交里把上限跟着降下来(否则棘轮成了永久豁免)。
|
||||
* 同日 hub 六页(P4-B1)清账后再次下调:R13 71→67 · R14 21→17 · R15 20→16 ·
|
||||
* R16 26→22 · R17 53→43 · R19 21→11。降的是**真实存量**,不是为了让闸变绿而改数。
|
||||
* 同日详情五页(P4-B2)清账后再降:R13 67→48 · R14 17→13 · R15 16→13 ·
|
||||
* R16 22→8(其中 2 处来自新开的**内联通道**,见 BRAND_SURFACE_INLINE_RE)·
|
||||
* R17 43→39 · R19 11→7。
|
||||
*/
|
||||
const MARKETING_HIT_CEILINGS = { R13: 67, R14: 17, R15: 16, R16: 22, R17: 43, R18: 0, R19: 11 };
|
||||
const MARKETING_HIT_CEILINGS = { R13: 48, R14: 13, R15: 13, R16: 8, R17: 39, R18: 0, R19: 7 };
|
||||
|
||||
/**
|
||||
* 判据正则一律**不带 g 旗标**。
|
||||
@@ -115,7 +118,16 @@ const ROUNDED_UTILITY_RE = /\brounded-(?:md|lg|xl|2xl|3xl|full)\b/;
|
||||
const HOVER_LIFT_RE = /hover:-translate-y\b/;
|
||||
/** 装饰阴影:任意 hover:shadow*(含 hover:shadow-[…] 带值那族)+ lg/xl/2xl 档 */
|
||||
const DECOR_SHADOW_RE = /(?:hover:shadow(?:-[a-z0-9]+)?(?::\[[^\]]+\])?|\bshadow-(?:2xl|xl|lg)\b)/;
|
||||
/**
|
||||
* R16 的**两条通道**。为什么必须两条:类名通道可以被内联样式整条绕过 ——
|
||||
* 实测案例 `src/components/sections/case-detail-page.tsx` 把整整一个 section 刷成
|
||||
* `style={{ background: "var(--color-brand)" }}`,类名通道零命中,闸看不见,
|
||||
* 而那正是「饱和红从不用作面」最严重的一种违反。
|
||||
* 内联通道只认**品牌底色**写法:`background` / `backgroundColor` 取 `var(--color-brand*)`。
|
||||
* 不认 `color:`(文字通道由 check:brand-token 管)也不认任意色值(避免与 accents 闸重叠)。
|
||||
*/
|
||||
const BRAND_SURFACE_RE = /\bbg-brand-(?:soft|section)\b/;
|
||||
const BRAND_SURFACE_INLINE_RE = /\bbackground(?:Color)?\s*:\s*["'`]\s*var\(\s*--color-brand(?:-soft|-section)?\s*\)/;
|
||||
const FONT_BLACK_RE = /\bfont-black\b/;
|
||||
const FONT_EXTRA_BOLD_RE = /\bfont-extrabold\b/;
|
||||
/**
|
||||
@@ -442,10 +454,15 @@ function checkGrammar(rawText, rawFiles, twConfig = "", opts = {}) {
|
||||
|
||||
// R16 饱和/浅色品牌红不得做「面」。两家实测红只出现在按钮上;本仓把它铺成图标砖
|
||||
// (bg-brand-soft) 与满幅段 (bg-brand-section),是决策一「红是结论电压」最直接的稀释。
|
||||
const r16Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_RE), 0);
|
||||
rule({ id: "R16", name: "营销面零品牌红彩色面(bg-brand-soft / bg-brand-section)", denominator: rScan,
|
||||
red: r16Count > ceilings.R16 ? [`营销面彩色面 ${r16Count} 处 > 上限 ${ceilings.R16}(红只做:实心 CTA 填充 / eyebrow 短线 / hairline hover / 角牌;中性底走 bg-bg-secondary)`] : [],
|
||||
note: `实测 ${r16Count} 处 · 上限 ${ceilings.R16}${r16Count < ceilings.R16 ? " ⇒ 请把上限下调" : ""}` });
|
||||
const r16ClassCount = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_RE), 0);
|
||||
const r16InlineCount = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_INLINE_RE), 0);
|
||||
const r16Count = r16ClassCount + r16InlineCount;
|
||||
const r16InlineFiles = marketingFiles.filter(([, f]) => countHits(f, BRAND_SURFACE_INLINE_RE) > 0);
|
||||
rule({ id: "R16", name: "营销面零品牌红彩色面(类名 + 内联两条通道)", denominator: rScan,
|
||||
red: r16Count > ceilings.R16
|
||||
? [`营销面彩色面 ${r16Count} 处 > 上限 ${ceilings.R16}(类名 ${r16ClassCount} + 内联 ${r16InlineCount}${r16InlineFiles.length ? ` 内联位于 ${r16InlineFiles.map(([p]) => p).join(", ")}` : ""};红只做:实心 CTA 填充 / eyebrow 短线 / hairline hover / 角牌;中性底走 bg-bg-secondary)`]
|
||||
: [],
|
||||
note: `实测 ${r16Count} 处(类名 ${r16ClassCount} + 内联 ${r16InlineCount})· 上限 ${ceilings.R16}${r16Count < ceilings.R16 ? " ⇒ 请把上限下调" : ""}` });
|
||||
|
||||
// R17 字重集合。对标实测层级来自 字号 × 字重 两轴,字重只用 400/500/700;
|
||||
// 本仓 53 处 font-black(900) 是「靠更粗建立层级」的单轴做法,与 statement 档冲突。
|
||||
@@ -544,7 +561,7 @@ function selftest() {
|
||||
* 夹具一律带 `opts.floor = 0`:合成样本只有一两个文件,
|
||||
* 不关掉地板就会把「扫描面太小」的红混进这一维,读数不再单义。
|
||||
*/
|
||||
const dirty = `<div className="rounded-full rounded-2xl hover:-translate-y-1 hover:shadow-lg shadow-xl bg-brand-soft bg-brand-section font-black font-extrabold" style={{ backgroundImage: 'url(tile_hatching.svg)', transform: 'rotate(140deg)' }}><path d="M22 14.204v-3.948" /></div>`;
|
||||
const dirty = `<div className="rounded-full rounded-2xl hover:-translate-y-1 hover:shadow-lg shadow-xl bg-brand-soft bg-brand-section font-black font-extrabold" style={{ backgroundImage: 'url(tile_hatching.svg)', transform: 'rotate(140deg)', background: "var(--color-brand)" }}><path d="M22 14.204v-3.948" /></div>`;
|
||||
const inScope = (rel) => new Map([[rel, dirty]]);
|
||||
const hitRed = (rel, id, ceiling) =>
|
||||
checkGrammar(cssText, inScope(rel), "", { floor: 0, hitCeilings: { [id]: ceiling } })
|
||||
|
||||
Reference in new issue
Block a user