/**
* CSS Extractor — Fetches a URL's HTML and stylesheets, then parses
* them into raw design tokens (colors, typography, spacing, radii, shadows).
*
* Used by `memi design-doc` to build a DESIGN.md from any public URL
* without requiring a headless browser.
*/
import type { DesignToken } from "../engine/registry.js";
import { type TokenExtractionReport } from "../tokens/extractor.js";
export type WcagLevel = 'AAA' | 'AA' | 'AA-large' | 'fail';
export interface ContrastPair {
fg: string;
bg: string;
ratio: number;
level: WcagLevel;
}
export interface RawDesignTokens {
colors: string[];
fonts: string[];
fontSizes: string[];
spacing: string[];
radii: string[];
shadows: string[];
cssVars: Record;
contrastPairs: ContrastPair[];
designTokens?: DesignToken[];
tokenReport?: TokenExtractionReport;
}
export interface PageAssets {
url: string;
title: string;
html: string;
cssBlocks: string[];
}
/**
* Fetch a page's HTML and all linked/inline CSS blocks.
* Follows up to MAX_STYLESHEETS hrefs
* and one level of @import rules within each stylesheet.
*/
export declare function fetchPageAssets(url: string, timeoutMs?: number): Promise;
/**
* Convert a 3-digit or 6-digit hex color to [r, g, b] tuple (0–255 each).
* Returns null for invalid input.
*/
export declare function hexToRgb(hex: string): [number, number, number] | null;
/**
* Compute WCAG relative luminance for a linearized RGB channel value (0–255).
* Formula: 0.2126R + 0.7152G + 0.0722B with sRGB linearization.
*/
export declare function relativeLuminance(r: number, g: number, b: number): number;
/**
* Compute WCAG contrast ratio between two relative luminance values.
* Returns a value like 4.52 (range 1–21).
*/
export declare function contrastRatio(l1: number, l2: number): number;
/**
* Map a contrast ratio to a WCAG level.
* AAA ≥ 7, AA ≥ 4.5, AA-large ≥ 3, else fail.
*/
export declare function wcagLevel(ratio: number): WcagLevel;
/**
* Parse CSS blocks into raw design tokens.
*/
export declare function parseCSSTokens(cssBlocks: string[]): RawDesignTokens;