/** * State conformance. * * `inspectWidgetDom` asks whether a widget is shaped right. This asks whether it is *behaving* * right in a named state — which parts it grew, what it exposes to assistive technology, and * whether the behaviour actually changed or only the ARIA claiming it did. * * Driving a renderer into a state is the adapter's job: one sets a property, another pushes a * signal, a third sets an attribute, and no shared helper can do all three honestly. What is shared is * the *judgement* — every adapter drives its own control and then hands the DOM here. Cross-renderer * equivalence rests on that split: same judgement, different drivers. */ import { type MdyWidgetKind } from "../catalog.js"; import { type MdyWidgetState } from "../widget-states.js"; import { type MdyDomPartMap } from "./dom-tests.js"; export type MdyStateIssueCode = "STATE_NOT_SUPPORTED" | "STATE_ARIA_MISSING" | "STATE_ARIA_WRONG" | "STATE_NOT_APPLIED" | "STATE_PART_MISSING" | "STATE_PART_PRESENT" | "STATE_ARIA_UNSUPPORTED"; export interface MdyStateIssue { readonly code: MdyStateIssueCode; readonly state: MdyWidgetState; readonly message: string; } export interface MdyStateInspectOptions { /** Which elements materialize each part, as for `inspectWidgetDom`. */ readonly parts?: MdyDomPartMap; /** The element the state is really about — the focusable, operable control. */ readonly control?: Element | null; } /** * Every way a widget claiming to be in `state` departs from what the contract says that means. * * Pure: it reads the DOM it is handed and never drives anything. */ export declare function inspectWidgetState(root: Element, kind: MdyWidgetKind, state: MdyWidgetState, options?: MdyStateInspectOptions): readonly MdyStateIssue[]; /** * ARIA a kind exposes for a state it does not declare. * * `aria-readonly="false"` on a slider is not harmless noise — it is the signature of a common ARIA * shell applied mechanically to every control, and it tells a screen reader that read-only is a * meaningful axis for something where it is not. Checked separately from * {@link inspectWidgetState} because it is about the states a widget is *not* in. */ export declare function inspectUnsupportedStateAria(root: Element, kind: MdyWidgetKind): readonly MdyStateIssue[];