feat(hub): OPEN-01 落地,B 类原语 × 6 + R22 判据
hub 六页(products/solutions/services/cases/news/insights)首屏此前是纯白底 文字块,对标语法「每个入口页由构图立住」在这一层整段断掉。按 ADR-0011 §4.2 落地「一件原语 + 六组参数」,不引入任何照片。 - 新增 ui/span-field.tsx:层叠体块 + 水平线 + 竖向脊线,纯 currentColor, aria-hidden,器形不含可辨识建筑造型;宽度/错位取固定序列不随机 - 六页容器改 12 列栅格(文本 7 + 原语 5),移动端为 160px 带,任何断点不隐藏 - check-visual-grammar 新增 R22:六页剥注释后必须有 <SpanField 或 <Image, 文件缺失按分母缩水判红;四向自证(缺原语/齐全/注释/缺页) - 修 L2「卡片组件」脆性捕获:滚动落点钉到「头部下沿+8px」,与页面总高解耦 - 基线:hub 24 张(4 project)+ 卡片 2 张;firefox 六张因本机 newPage 阻塞未采 门禁:type-check 0 · lint 0 error/88 warning · jest 160 套件/1890 例 (89.93/88.43/89.57/89.93)· grammar 22/22 · accents 违规 0 · a11y 34 页 0 问题 · security 8/8 · e2e:fast 45 passed(18 红全为 firefox 建页超时)
This commit is contained in:
1 parent
9db24f68a3
commit
73abb07413
40 files changed
+549
-15
No files matched your search
@@ -52,6 +52,23 @@ const HOVER_LIFT_CEILING = 28;
|
||||
*/
|
||||
const EXTERNAL_OWNED = ["--radix-accordion-content-height"];
|
||||
|
||||
/**
|
||||
* R22 的六个落点:ADR-0011 §4.2 指定的「hub 六页引言区各一处原语」。
|
||||
*
|
||||
* 为什么这条判据存在:`OPEN-01` 的验收判据①是「六页首屏有 B 类原语且承担构图」。
|
||||
* 没有这条闸时,判据只活在 ADR 文字里 —— 把六处 `<SpanField>` 删掉,R12–R21 全绿,
|
||||
* 于是「复刻完成」可以在一夜之间退回「六张白底文字块」而没有任何仪器喊。
|
||||
* 分母为 0(路径全改)按「判据失去目标」判红,而不是静默通过。
|
||||
*/
|
||||
const HUB_HERO_FILES = [
|
||||
"src/app/(marketing)/products/products-content-v3.tsx",
|
||||
"src/app/(marketing)/solutions/solutions-content-v3.tsx",
|
||||
"src/app/(marketing)/services/services-content-v3.tsx",
|
||||
"src/app/(marketing)/cases/cases-content-v3.tsx",
|
||||
"src/app/(marketing)/news/news-content-v3.tsx",
|
||||
"src/app/(marketing)/insights/insights-content.tsx",
|
||||
];
|
||||
|
||||
/**
|
||||
* R12 的「测量值 ↔ 声明值」对账表。
|
||||
* 出处:2026-11-02 对 Porsche Consulting 中国站首页逐个 <img> 的 getBoundingClientRect 实测
|
||||
@@ -616,6 +633,33 @@ function checkGrammar(rawText, rawFiles, twConfig = "", opts = {}) {
|
||||
rule({ id: "R21", name: "自定义命名空间类名必须有 CSS 定义(防第三族死样式)", denominator: r21Den, red: r21Red,
|
||||
note: `扫描 ${r21Den} 处自定义类名 · 命名空间 ${CUSTOM_CLASS_PREFIXES.join("/")} + ${[...CUSTOM_CLASS_EXACT].join("/")}` });
|
||||
|
||||
/**
|
||||
* R22 hub 六页首屏必须有构图支点(ADR-0011 §5 判据①)。
|
||||
*
|
||||
* 判「有」的两种形态:B 类原语 `<SpanField`(本仓采纳的路线)或 `<Image`(A 类本地生成图)。
|
||||
* 两条都算,是因为 ADR 只禁止 C/D 类,没有禁止「哪天真做了 A 类图」。
|
||||
*
|
||||
* 为什么必须先剥注释:本仓踩过——`constants.ts` 注释里的示例 import 骗过了
|
||||
* `export { … } from` 正则。这里同理:一段被注释掉的 `<SpanField>` 不该算作构图支点。
|
||||
*
|
||||
* 为什么分母按「找到几页」而不是恒定 6:路径改名时若照常除以 6,一条红都不会出,
|
||||
* 判据就变成了空转。缺页本身判红,与 R13 的 `MARKETING_FLOOR` 同一纪律。
|
||||
*/
|
||||
const hubFloor = opts.hubFloor ?? HUB_HERO_FILES.length;
|
||||
const hubPresent = HUB_HERO_FILES.filter((rel) => files.has(rel));
|
||||
const r22Red = [];
|
||||
for (const rel of hubPresent) {
|
||||
const src = stripComments(files.get(rel) ?? "", { line: true });
|
||||
if (!/<SpanField\b|<Image\b/.test(src)) {
|
||||
r22Red.push(`${rel}:首屏既无 <SpanField> 也无 <Image> —— 该页退回「白底文字块」,构图支点缺失`);
|
||||
}
|
||||
}
|
||||
if (hubPresent.length < hubFloor) {
|
||||
r22Red.push(`hub 首屏只找到 ${hubPresent.length}/${hubFloor} 页 —— 路径改名或文件被移动,本条对缺的那几页空转`);
|
||||
}
|
||||
rule({ id: "R22", name: "hub 六页首屏必须有构图支点(B 类原语或影像)", denominator: hubPresent.length, red: r22Red,
|
||||
note: `找到 ${hubPresent.length}/${HUB_HERO_FILES.length} 页 · 判据 = 非注释行内出现 <SpanField 或 <Image` });
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -678,6 +722,42 @@ function selftest() {
|
||||
}
|
||||
console.log(" ✓ R11 双向:未声明引用判红、已声明引用不误报");
|
||||
|
||||
/**
|
||||
* R22 双向自证:六页都带原语 ⇒ 不判红;抽掉任意一页 ⇒ **恰好**判那一页。
|
||||
* 第三维单独测「注释掉的 <SpanField> 不算数」—— 这是本仓踩过的同一类坑
|
||||
* (`constants.ts` 注释里的示例 import 曾骗过再导出正则)。
|
||||
*/
|
||||
const hubSrc = "export function Hero(){ return (<div><SpanField layers={5} /></div>); }";
|
||||
const hubBare = "export function Hero(){ return (<div>纯白底文字块</div>); }";
|
||||
// 「文件在、原语没了」= 单页判红;「文件本身缺了」= 分母缩水,靠 hubFloor 判。
|
||||
// 两种失败形态分开测,否则一条闸看起来只防住了其中一半。
|
||||
const hubMapWithHole = (hole) =>
|
||||
new Map(HUB_HERO_FILES.map((rel) => [rel, rel === hole ? hubBare : hubSrc]));
|
||||
const r22RedFor = (map, opts) =>
|
||||
checkGrammar(bad, map, "", { floor: 0, ...opts }).find((x) => x.id === "R22").red;
|
||||
const r22Clean = r22RedFor(hubMapWithHole(null), { hubFloor: 0 });
|
||||
const r22Hole = r22RedFor(hubMapWithHole(HUB_HERO_FILES[0]), { hubFloor: 0 });
|
||||
const r22Commented = r22RedFor(
|
||||
new Map(HUB_HERO_FILES.map((rel, i) => [rel, i === 0 ? "// <SpanField layers={5} />" : hubSrc])),
|
||||
{ hubFloor: 0 },
|
||||
);
|
||||
// 只给 5 页、地板仍是 6 ⇒ 必须判「对缺的那页空转」
|
||||
const r22Short = r22RedFor(
|
||||
new Map(HUB_HERO_FILES.slice(0, 5).map((rel) => [rel, hubSrc])),
|
||||
{ hubFloor: HUB_HERO_FILES.length },
|
||||
);
|
||||
const r22Catches = r22Hole.length === 1 && r22Hole[0].includes(HUB_HERO_FILES[0]);
|
||||
const r22Ignores = r22Clean.length === 0;
|
||||
const r22StripsComments = r22Commented.length === 1 && r22Commented[0].includes(HUB_HERO_FILES[0]);
|
||||
const r22Floor = r22Short.length === 1 && r22Short[0].includes("5/6");
|
||||
if (!r22Catches || !r22Ignores || !r22StripsComments || !r22Floor) {
|
||||
console.log(
|
||||
` ✗ R22 不自证:缺原语判红 ${r22Catches}、齐全不误报 ${r22Ignores}、注释不算数 ${r22StripsComments}、缺页判红 ${r22Floor} ⇒ 这条闸没有约束力`,
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
console.log(" ✓ R22 四向:缺原语判红、六页齐全不误报、注释不算数、缺页按分母缩水判红");
|
||||
|
||||
// R10 单独两侧自证:它是存量棘轮,判据是「数量 > 上限」,所以负例要按数量构造。
|
||||
// 用真实 globals.css 做底,避免其它规则的红因混进来干扰这一维的读数。
|
||||
const cssText = existsSync(CSS) ? readFileSync(CSS, "utf8") : ":root { --radius-xs: 0px; }";
|
||||
|
||||
Reference in new issue
Block a user