/** * typography.ts — Typographic-scale audit module for audit_typography tool. * * Two modes: * url mode — renders a page in headless Chromium, collects text node metrics. * snapshot mode — analyzes a pre-collected nodes[] array without rendering. * * Analysis (all deterministic): * (a) MODULAR SCALE — distinct fontPx values; consecutive ratios; detect a * consistent ratio (~1.2/1.25/1.333/1.5); flag off-scale sizes. * (b) LINE-HEIGHT — unitless lh/fs ratio per node; flag outliers vs dominant. * (c) WEIGHT LADDER — distinct fontWeights; flag >4 weights or non-standard values. */ import { CaptureUnavailableError } from "./capture.js"; export { CaptureUnavailableError }; export type TypographyNode = { selector: string; fontPx: number; lineHeightPx?: number; fontWeight?: number; tag?: string; text?: string; }; export type TypographyFinding = { rule: string; severity: "error" | "warning" | "info"; selector?: string; message: string; fix: string; }; export type TypographyResult = { url?: string; scale: { sizes: number[]; ratios: number[]; detected_ratio: number | null; off_scale_sizes: number[]; }; line_height: { dominant_ratio: number | null; outliers: Array<{ selector: string; ratio: number; expected: number; }>; }; weight_ladder: { weights: number[]; issues: string[]; }; nodes_analyzed: number; findings: TypographyFinding[]; }; /** * Analyze a pre-collected array of text node metrics. No browser required. */ export declare function auditTypographySnapshot(nodes: TypographyNode[]): TypographyResult; /** * Render a URL in headless Chromium, collect text node font metrics, then * analyze them with auditTypographySnapshot. */ export declare function auditTypographyUrl(url: string, opts?: { viewport?: { w: number; h: number; }; timeoutMs?: number; theme?: "light" | "dark"; }): Promise;