/** * AccessibilityChecker — WCAG 2.2 conformance checking from design system data. * * Computes contrast ratios, validates touch targets, checks focus styles, * and audits heading hierarchy — all from tokens and specs without needing * a running Figma connection. */ import type { DesignToken, DesignSystem } from "./registry.js"; import type { AnySpec, ComponentSpec, PageSpec } from "../specs/types.js"; export type WcagLevel = "A" | "AA" | "AAA"; export interface A11yIssue { rule: string; severity: "critical" | "major" | "minor"; wcagCriteria: string; level: WcagLevel; target: string; message: string; fix?: string; } export interface A11yReport { passed: number; failed: number; warnings: number; issues: A11yIssue[]; score: number; level: WcagLevel; } export interface ContrastResult { ratio: number; passesAA: boolean; passesAAA: boolean; passesAALarge: boolean; foreground: string; background: string; } /** Parse a hex color (#RGB, #RRGGBB, #RRGGBBAA) to {r, g, b} in 0-255 range. */ export declare function parseHex(hex: string): { r: number; g: number; b: number; } | null; /** Compute relative luminance per WCAG 2.2 (sRGB). */ export declare function relativeLuminance(r: number, g: number, b: number): number; /** Compute WCAG contrast ratio between two colors (hex, rgb, hsl, or oklch). */ export declare function contrastRatio(color1: string, color2: string): number; /** Check a foreground/background pair against WCAG criteria. */ export declare function checkContrast(foreground: string, background: string): ContrastResult; /** Find color token pairs that fail WCAG contrast requirements. */ export declare function auditTokenContrast(tokens: DesignToken[]): A11yIssue[]; /** Check that essential semantic tokens are defined. */ export declare function auditTokenCompleteness(tokens: DesignToken[]): A11yIssue[]; /** Audit a component spec for accessibility requirements. */ export declare function auditComponentSpec(spec: ComponentSpec): A11yIssue[]; /** Audit a page spec for page-level accessibility requirements. */ export declare function auditPageSpec(spec: PageSpec): A11yIssue[]; /** Run a complete accessibility audit across the design system and all specs. */ export declare function runFullAudit(designSystem: DesignSystem, specs: AnySpec[]): A11yReport;