/** * WCAG Token Checker — WA-401 * Post-pull audit utility that checks design tokens against WCAG contrast * and spacing criteria. Self-contained: no external color libraries required. */ import type { DesignSystem } from "../engine/registry.js"; export interface TokenWcagResult { tokenName: string; type: "color" | "spacing" | "other"; issue: string | null; wcagCriterion: string | null; status: "pass" | "warn" | "fail"; } export interface WcagTokenReport { results: TokenWcagResult[]; summary: { pass: number; warn: number; fail: number; total: number; }; hasFailures: boolean; } /** * WCAG relative luminance for an RGB triplet (each 0-255). */ export declare function relativeLuminance(r: number, g: number, b: number): number; /** * WCAG contrast ratio between two relative luminance values. * Returns value in [1, 21]. */ export declare function contrastRatio(l1: number, l2: number): number; /** * Parse a hex color string (#rgb, #rrggbb, #rrggbbaa) into {r,g,b} (0-255). * Returns null if the string is not a valid hex color. */ export declare function parseHex(hex: string): { r: number; g: number; b: number; } | null; /** * Compute the maximum contrast ratio between a hex color and * pure white (#fff, luminance ~1) and pure black (#000, luminance 0). * Returns null when hex is not parseable. */ export declare function maxContrastAgainstExtremes(hex: string): number | null; /** * Audit design tokens for WCAG violations. * * - Color tokens (name contains color/fg/bg/text/fill/surface/brand): * checks hex values against white and black for contrast compliance. * fail < 3.0:1 — inaccessible for any text use * warn 3.0–4.49 — AA-large only * pass ≥ 4.5 — meets WCAG 1.4.3 AA * * - Spacing tokens: warns on values < 24px (WCAG 2.5.8). * * - All other tokens: pass (no applicable WCAG check). */ export declare function auditTokensForWcag(tokens: DesignSystem["tokens"]): WcagTokenReport;