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:
zhangxiang committed 2026-12-01 17:03:36 +08:00
1 parent 9db24f68a3
commit 73abb07413
40 files changed
+549 -15

No files matched your search

+11 -2
View File
@@ -8,6 +8,7 @@ import {
type CaseStudy,
} from '@/lib/constants/cases';
import { EARLY_ACCESS } from '@/lib/constants/company';
import { SpanField } from '@/components/ui/span-field';
import { cn } from '@/lib/utils';
const EASE_OUT = [0.22, 1, 0.36, 1] as const;
@@ -128,8 +129,8 @@ export default function CasesContentV3({
<div className="min-h-screen bg-bg-primary text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative min-h-[70vh] flex items-center overflow-hidden bg-bg-primary">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-40">
<div className="max-w-4xl">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-40 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-12 lg:gap-10">
<div className="max-w-4xl lg:col-span-7">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
@@ -196,6 +197,14 @@ export default function CasesContentV3({
</span>
</motion.div>
</div>
{/* B 类原语,第四组参数:六层、贴左 —— 案例页首屏此前完全没有视觉支点。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[30rem]"
layers={6}
density="regular"
align="left"
/>
</div>
</section>
@@ -6,6 +6,7 @@ import { ScrollReveal } from '@/components/ui/scroll-reveal';
import { CTAButton } from '@/components/ui/cta-button';
import { COMPANY_INFO } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { SpanField } from '@/components/ui/span-field';
import { ArrowRight } from 'lucide-react';
export type InsightKind = 'methodology' | 'case' | 'writing';
@@ -76,7 +77,8 @@ export default function InsightsContent({ entries }: { entries: InsightEntry[] }
<div data-testid="insights-page">
{/* L1 —— 结论式主张,不是口号 */}
<section className="bg-bg-primary border-b border-border-primary" data-testid="hero-section">
<div className="container-x py-16 md:py-24">
<div className="container-x py-16 md:py-24 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-10 md:gap-12">
<div className="lg:col-span-7">
<ScrollReveal>
<p className="text-sm font-medium text-brand-ink tracking-wider mb-4">洞察</p>
<h1 className="text-4xl md:text-5xl font-bold text-text-primary leading-tight max-w-4xl">
@@ -89,6 +91,15 @@ export default function InsightsContent({ entries }: { entries: InsightEntry[] }
<strong className="font-medium text-text-primary">已验证结果</strong>。
</p>
</ScrollReveal>
</div>
{/* B 类原语,第六组参数:六层、线密、贴左。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[24rem]"
layers={6}
density="dense"
align="left"
/>
</div>
</section>
+11 -2
View File
@@ -13,6 +13,7 @@ import { Search, Calendar, ArrowRight, Newspaper, ChevronLeft, ChevronRight } fr
import { COMPANY_INFO } from '@/lib/constants';
import { type NewsItem } from '@/lib/constants/news';
import { SectionLabel, EASE_OUT } from '@/components/ui/page-decoration';
import { SpanField } from '@/components/ui/span-field';
const categories = ['全部', '公司新闻', '研发动态'];
const ITEMS_PER_PAGE = 9;
@@ -123,8 +124,8 @@ export default function NewsContentV3({ news, pageCopy }: { news?: NewsItem[]; p
<div className="min-h-screen bg-bg-primary text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative min-h-[75vh] flex items-center overflow-hidden bg-bg-primary">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-44 lg:py-56">
<div className="max-w-4xl">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-44 lg:py-56 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-12 lg:gap-10">
<div className="max-w-4xl lg:col-span-7">
<ScrollReveal>
<SectionLabel>{heroEyebrow}</SectionLabel>
</ScrollReveal>
@@ -145,6 +146,14 @@ export default function NewsContentV3({ news, pageCopy }: { news?: NewsItem[]; p
</p>
</ScrollReveal>
</div>
{/* B 类原语,第五组参数:八层、线疏 —— 与其余五页错开,避免六页同一个图章。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[30rem]"
layers={8}
density="sparse"
align="right"
/>
</div>
</section>
@@ -6,6 +6,7 @@ import { EASE_OUT } from '@/components/ui/page-decoration';
import { StaticLink } from '@/components/ui/static-link';
import { CTAButton } from '@/components/ui/cta-button';
import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
import { SpanField } from '@/components/ui/span-field';
import { BentoGrid, BentoItem } from '@/components/sections/bento-grid';
import { ArrowRight, ArrowUpRight, Package, Cpu, TrendingUp, Users, Settings, FileText } from 'lucide-react';
import type { Product } from '@/lib/constants/products';
@@ -38,8 +39,8 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
return (
<section className="relative overflow-hidden bg-bg-primary">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28">
<div className="max-w-4xl">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-12 lg:gap-10">
<div className="max-w-4xl lg:col-span-7">
<motion.h1
initial={{ opacity: 0, y: 70 }}
animate={{ opacity: 1, y: 0 }}
@@ -90,6 +91,15 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
</CTAButton>
</motion.div>
</div>
{/* B 类原语:承担首屏构图支点(ADR-0011 §4.2)。移动端是文字下方的一条带,
桌面占据右 5 列;任何断点都不隐藏 —— 判据要求它「不能被 CSS 隐藏」。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[30rem]"
layers={5}
density="regular"
align="right"
/>
</div>
</section>
);
@@ -8,6 +8,7 @@ import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
import { CTA_LABELS, canonicalCtaLabel } from '@/lib/constants/cta-labels';
import type { Service, ServiceMetric } from '@/lib/constants/services';
import { weakestBasis } from '@/lib/constants/metrics-basis';
import { SpanField } from '@/components/ui/span-field';
const EASE_OUT = [0.22, 1, 0.36, 1] as const;
@@ -85,8 +86,8 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
return (
<section className="relative overflow-hidden bg-bg-primary">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28">
<div className="max-w-4xl">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-12 lg:gap-10">
<div className="max-w-4xl lg:col-span-7">
<motion.h1
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
@@ -138,6 +139,14 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
</CTAButton>
</motion.div>
</div>
{/* B 类原语,第三组参数:层数最少、线最疏、贴左 —— 与产品/方案两页拉开差异。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[30rem]"
layers={4}
density="sparse"
align="left"
/>
</div>
</section>
);
@@ -7,6 +7,7 @@ import { CTAButton } from '@/components/ui/cta-button';
import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
import { CTA_LABELS, canonicalCtaLabel } from '@/lib/constants/cta-labels';
import { weakestBasis } from '@/lib/constants/metrics-basis';
import { SpanField } from '@/components/ui/span-field';
import { type Solution } from '@/lib/constants/solutions';
import type { Product } from '@/lib/constants/products';
@@ -33,8 +34,8 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
return (
<section className="relative overflow-hidden bg-bg-primary">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28">
<div className="max-w-4xl">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 lg:py-28 grid grid-cols-1 lg:grid-cols-12 lg:items-center gap-12 lg:gap-10">
<div className="max-w-4xl lg:col-span-7">
<motion.h1
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
@@ -86,6 +87,14 @@ function HeroSection({ pageCopy }: { pageCopy?: PageCopy | null }) {
</CTAButton>
</motion.div>
</div>
{/* B 类原语,第二组参数(ADR-0011 §4.2):层数更多、水平线更密。 */}
<SpanField
className="h-40 w-full sm:h-56 lg:col-span-5 lg:h-[30rem]"
layers={7}
density="dense"
align="right"
/>
</div>
</section>
);
+75
View File
@@ -0,0 +1,75 @@
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';
import { SpanField } from './span-field';
/**
* 原语的判据只锁 ADR-0011 允许它存在的理由,不锁实现细节:
* ① 一律 aria-hidden 且不接交互(它是装饰位,不是证据位);
* ② 不含品牌红(B 类原语只走 currentColor,否则 R16 的面积纪律会被绕过);
* ③ 层数受控(2–9),参数不同必须真的画得不一样 —— 六页复用一件原语的前提是
* 「参数能拉开差异」,否则就是六个一样的图章;
* ④ align 两档镜像(体块贴边与脊线同时翻转)。
*/
describe('SpanField', () => {
it('一律 aria-hidden,且不接任何交互', () => {
const { container } = render(<SpanField />);
const el = container.firstElementChild as HTMLElement;
expect(el).toHaveAttribute('aria-hidden', 'true');
expect(el.className).toContain('pointer-events-none');
});
it('不含品牌红:颜色只走 currentColor,不出现品牌色变量', () => {
const { container } = render(<SpanField />);
const html = container.innerHTML;
expect(html).not.toMatch(/--color-brand/);
expect(html).not.toMatch(/#C41E3A/i);
expect(container.querySelectorAll('rect').length).toBeGreaterThan(0);
Array.from(container.querySelectorAll('rect')).forEach((rect) => {
expect(rect.getAttribute('fill')).toBe('currentColor');
});
});
it('层数受控:默认 5 层 + 1 条脊线,参数不同则几何不同', () => {
const five = render(<SpanField layers={5} />).container;
const eight = render(<SpanField layers={8} />).container;
const countSlabs = (root: HTMLElement) =>
root.querySelectorAll('rect').length - 1; // 减掉脊线
expect(countSlabs(five)).toBe(5);
expect(countSlabs(eight)).toBe(8);
expect(five.querySelector('svg')?.getAttribute('viewBox')).not.toBe(
eight.querySelector('svg')?.getAttribute('viewBox'),
);
});
it('层数越界时收进 2–9,不产生空图', () => {
const low = render(<SpanField layers={0} />).container;
const high = render(<SpanField layers={99} />).container;
expect(low.querySelectorAll('rect').length - 1).toBe(2);
expect(high.querySelectorAll('rect').length - 1).toBe(9);
});
it('align 两档镜像:首块 x 与脊线位置同时翻转', () => {
const left = render(<SpanField align="left" />).container;
const right = render(<SpanField align="right" />).container;
const firstSlabX = (root: HTMLElement) =>
Number(root.querySelectorAll('rect')[1]?.getAttribute('x') ?? NaN);
const spineX = (root: HTMLElement) =>
Number(root.querySelector('rect')?.getAttribute('x'));
expect(firstSlabX(left)).toBeLessThan(firstSlabX(right));
expect(spineX(left)).toBe(0);
expect(spineX(right)).toBeGreaterThan(0);
});
it('密度档位控制水平线条数(不多画、不少画)', () => {
const countLines = (density: 'sparse' | 'regular' | 'dense') =>
render(<SpanField density={density} />).container.querySelectorAll('line').length;
expect(countLines('sparse')).toBe(2);
expect(countLines('regular')).toBe(4);
expect(countLines('dense')).toBe(6);
});
it('外部 className 原样并入(用于控制占位尺寸)', () => {
const { container } = render(<SpanField className="h-40 w-full" />);
expect((container.firstElementChild as HTMLElement).className).toContain('h-40 w-full');
});
});
+120
View File
@@ -0,0 +1,120 @@
import { cn } from '@/lib/utils';
/**
* SpanField —— B 类自有矢量原语(ADR-0011 §4.1/§4.2):层叠体块 + 水平线的建筑抽象。
*
* 它要解决的问题不是「缺张好看的图」,而是一个结构缺口:hub 六页的引言区此前
* 只有白底文字块,没有任何承担构图的元素(`public/images/hub/` 自 2026-11-02 建目录起
* 始终 `total 0`)。ADR-0011 把 `OPEN-01` 的资产路线从「生成 ~10 张氛围照片」改判为
* 「1 件原语 + 6 组参数」,理由是纯装饰的抽象几何在本仓被弃用过一次
* (`ui/brand-visuals.tsx` 的 GeometricDecoration 零非测试消费者),
* ⇒ **原语必须承担构图功能,而不是当背景花纹**。
*
* 边界(B 类准入四条的第三条):
* - **不含任何可辨识建筑的造型**:只有矩形体块与直线,没有坡顶、没有飞檐、没有塔身、
* 没有可读文字;体块宽度/错位取自固定序列,不做随机(随机会让视觉基线逐次抖动)。
* - 一律 `aria-hidden`:它不承载信息,读屏不该知道它存在。
* - 不碰品牌红:颜色只走 `currentColor`(`text-ink`),面积纪律因此天然满足(R16 零命中)。
* - 零圆角/零投影/零 hover(R13–R15):rect 不带 rx,SVG 不挂 shadow。
*
* 为什么用 SVG 而不是渐变:渐变画不出「体块之间的缝」,而缝才是这套语法的骨。
*/
export type SpanFieldDensity = 'sparse' | 'regular' | 'dense';
export type SpanFieldAlign = 'left' | 'right';
/** 体块高度与行距(viewBox 单位,非像素;实际尺寸由外层高度决定)。 */
const SLAB_H = 46;
const SLAB_GAP = 28;
const VB_W = 320;
/** 宽度占比序列:够长,六页各取不同 `layers` 就不会撞成同一张图。 */
const WIDTH_SEQ = [0.62, 0.9, 0.48, 0.76, 0.56, 0.84, 0.7, 0.44, 0.66];
/** 错位占比序列:0 = 贴齐对齐边,越大越往内缩。 */
const OFFSET_SEQ = [0, 0.14, 0.04, 0.22, 0.08, 0.3, 0.02, 0.18, 0.1];
/** 水平线条数:密度档位。 */
const HAIRLINE_COUNT: Record<SpanFieldDensity, number> = { sparse: 2, regular: 4, dense: 6 };
export function SpanField({
layers = 5,
density = 'regular',
align = 'right',
className,
}: {
/** 体块层数(2–9)。承载页面「密度」,六页各取不同值。 */
layers?: number;
/** 背景水平线的疏密。 */
density?: SpanFieldDensity;
/** 对齐边:决定体块贴哪一侧,以及竖向脊线的位置。 */
align?: SpanFieldAlign;
/** 只用于控制占位尺寸(高度/列宽),不参与几何定义。 */
className?: string;
}) {
const n = Math.min(9, Math.max(2, Math.round(layers)));
const rowH = SLAB_H + SLAB_GAP;
const vbH = n * rowH - SLAB_GAP;
const slabs = Array.from({ length: n }, (_, i) => {
// 序列长度固定且非空,`?? ` 分支只是给 noUncheckedIndexedAccess 一个出口。
const w = (WIDTH_SEQ[i % WIDTH_SEQ.length] ?? 0.6) * VB_W;
const offset = (OFFSET_SEQ[i % OFFSET_SEQ.length] ?? 0) * (VB_W - w);
return {
x: align === 'right' ? VB_W - w - offset : offset,
y: i * rowH,
w,
// 越往下越淡:视线从顶部体块开始读,底部退成底纹。
opacity: Number((0.82 - (i / Math.max(1, n - 1)) * 0.6).toFixed(2)),
};
});
const hairlineCount = HAIRLINE_COUNT[density];
const hairlines = Array.from(
{ length: hairlineCount },
(_, i) => ((i + 0.5) * vbH) / hairlineCount,
);
return (
<div aria-hidden="true" className={cn('pointer-events-none relative text-ink', className)}>
<svg
viewBox={`0 0 ${VB_W} ${vbH}`}
preserveAspectRatio="none"
className="h-full w-full"
focusable="false"
role="presentation"
>
{hairlines.map((y, i) => (
<line
key={`hairline-${i}`}
x1={0}
x2={VB_W}
y1={y}
y2={y}
stroke="currentColor"
strokeWidth={1}
opacity={0.18}
/>
))}
{slabs.map((s, i) => (
<rect
key={`slab-${i}`}
x={s.x}
y={s.y}
width={s.w}
height={SLAB_H}
fill="currentColor"
opacity={s.opacity}
/>
))}
{/* 竖向脊线:给这摞体块一条「落地」的边,避免读成一堆悬空色块。 */}
<rect
x={align === 'right' ? VB_W - 3 : 0}
y={0}
width={3}
height={vbH}
fill="currentColor"
opacity={0.9}
/>
</svg>
</div>
);
}