/** * Finding a widget's parts in a rendered tree, from the contract and nothing else. * * A conformance harness that hardcodes where a part lives knows the widget from outside the * contract, and every such place is a rule the specification does not actually express — the suite * passes because the tester was told the answer, not because the contract said it. * * The hard case, and the reason this exists rather than a plain class lookup: a kind may declare two * parts with the same classes. A date range's `startControl` and `endControl` are the same input * twice, and no selector separates them. What separates them is already in the contract — the * anatomy declares their `order` — so they are resolved by their declared position among the * elements that share their classes, rather than by a harness counting to two. */ import { type MdyWidgetKind } from "../catalog.js"; export interface MdyPartLookupOptions { /** * Where a portalled popup went, when it is not inside the root. * * An adapter may lift its overlay to the document — a legitimate choice the contract does not * constrain — and a lookup that could not see it would report every portalled part as absent. */ readonly portalRoots?: readonly ParentNode[]; } /** * Every element rendered for a kind's part. * * The plural exists for the parts the anatomy marks `repeated` — options, grid cells, error items. * Mapping one of many makes each of its children look mis-parented, because the child belongs to a * sibling of the element that was mapped. * * Same derivation as {@link findPartElement}, and it deliberately does **not** apply the declared- * order tie-break: that picks one element out of a group sharing a class, which is the opposite of * what a caller asking for all of them wants. */ export declare function findPartElements(root: ParentNode, kind: MdyWidgetKind, part: string, options?: MdyPartLookupOptions): readonly Element[]; /** * The element rendered for a kind's part, or `null` when it is not in the tree. * * Document order is the tie-break, matched against the anatomy's declared order, because that is * the only thing distinguishing two parts a renderer draws with the same classes. A renderer that * emits them the other way round is reporting a different widget, and this returns the wrong * element for both — which is the correct outcome: the anatomy says which comes first. * * Where a part declares **no classes**, its declared semantic element answers instead: a text * field's `control` is a bare `` with nothing to select on, and the anatomy already says it * is an `input`. Falling back to the semantic is still deriving from the contract — the alternative * is a harness naming the tag itself, which is the thing this function exists to remove. */ export declare function findPartElement(root: ParentNode, kind: MdyWidgetKind, part: string, options?: MdyPartLookupOptions): Element | null;