import { type StyleMap } from './capture.js'; /** * Structured diff between two style maps. Custom properties (--*) are * ignored: they are inputs, not outcomes — every visual effect of a variable * lands in a real longhand which is compared in full. */ export type PropChange = { prop: string; before: string; after: string; }; /** * The before dir carries a bundle MANIFEST but ZERO captures while the after dir * held some — a restore or capture that claims success yet delivered no maps (a * corrupt bundle, a wrong --base-dir pointed at a manifest-only dir). Without * this guard every after surface diffs as `missing: 'before'` (exit 3, "only new * surfaces") and a whole app of regressions becomes one approvable "🆕 all new" * report. The CLIs map this to exit 2 — a hard error, never the rubber-stampable * exit 3. A truly BARE base dir (no manifest, no maps) is different: it means * "never captured — no baseline exists yet", the first-adoption flow where the * base commit predates the capture spec, and it keeps the exit-3 review path. * (Both dirs empty stays the plain "no captures found" throw.) */ export declare class MissingBaseMapError extends Error { constructor(); } /** * The mirror case: the AFTER (head) dir held ZERO captures while the before dir * held some — a head capture or restore that produced nothing. Without this * guard every base surface marks `missing: 'after'`, the CLI's new-surface count * (which tallies BOTH directions) exits 3, and a head that rendered nothing * becomes an approvable "all new surfaces" report — and, once approved, the * next base. Same exit-2 path via the CLIs' existing catch. */ export declare class MissingHeadMapError extends Error { constructor(); } export type Finding = { kind: 'dom'; path: string; cls: string; change: 'added' | 'removed' | 'retagged'; detail?: string; component?: { name: string; props?: Record; }; } | { kind: 'style'; path: string; cls: string; pseudo: string | null; props: PropChange[]; /** * Whether normalized own-text length changed, or could not be compared * because at least one legacy map omitted the signal. */ contentLengthSignal?: 'changed' | 'unknown'; } | { kind: 'state'; path: string; cls: string; state: string; sub: string; props: PropChange[]; }; export type SurfaceDiff = { surface: string; /** Set when the surface was captured in only one of the two sets. */ missing?: 'before' | 'after'; findings: Finding[]; }; export type DiffCounts = { dom: number; style: number; state: number; }; export type DiffStyleOptions = { /** * Include DOM additions/removals/retags and style/state inventories for * one-sided elements. Defaults to true for low-level callers such as settle * detection and variant discovery. Certification passes false because * structure belongs to the opt-in advisory content layer. */ includeStructure?: boolean; }; /** Content and structural changes are an opt-in advisory layer. Kept out of * `Finding`/`DiffCounts` on purpose: neither affects style certification or * blocking counts when content comparison is disabled. */ export type ContentChange = { kind: 'text'; path: string; cls: string; before: string; after: string; } | { kind: 'structure'; path: string; cls: string; change: 'added' | 'removed' | 'retagged'; detail?: string; }; /** Diff two style maps of the same surface. */ export declare function diffStyleMaps(a: StyleMap, b: StyleMap, options?: DiffStyleOptions): Finding[]; /** Diff every same-named capture between two directories. `volatile` is the * count of live regions auto-excluded across all surfaces (union per surface). */ export declare function diffStyleMapDirs(dirA: string, dirB: string, options?: DiffStyleOptions): { surfaces: SurfaceDiff[]; counts: DiffCounts; volatile: number; statesUncertified: number; compared: number; }; export declare function diffContentMaps(a: StyleMap, b: StyleMap): ContentChange[]; /** Per-surface content diff across two capture dirs (opt-in layer). Mirrors * {@link diffStyleMapDirs} but content-only and non-gating; surfaces present on * just one side have no baseline and are skipped (the style diff reports those * as new surfaces). */ export declare function diffContentDirs(dirA: string, dirB: string): { surfaces: { surface: string; changes: ContentChange[]; }[]; count: number; }; /** Human label: structural path plus a truncated class hint. */ export declare function findingLabel(path: string, cls: string): string;