import { type MdyStateName } from "./state.js"; /** * Version of the framework-agnostic UI contract implemented by this package. * * It names the **anatomy**, not the shape of the declaration: an adapter reads it to say *"the parts * I build are the parts this number describes"*, and the audits that check a renderer against the * catalogue refuse a version they were not written for. So it moves whenever a part a renderer was * told to build stops existing, changes its element, or gains a role — the changes * `contract:diff --since ` classifies major. * * It stayed at 1 across a release that removed `datepicker.actions` and `daterange.actions` and * turned `multiselect.searchButton` from a `button` into an `input` with `role="combobox"`. Two * renderers written against "contract version 1" would then have implemented two different * anatomies, and the number that exists to prevent exactly that said they were the same. * * 3 names an anatomy where `multiselect.popup` carries `role="dialog"`. A renderer built against 2 * emits that panel with no role, which is a conforming renderer under 2 and a non-conforming one * here — the case this number exists to make visible rather than to let pass. * * 4 moved a boolean's indicator and a toggle's track under the label. 5 gives a timepicker's dial * two more parts — the layer of stretches that carry no selectable time, and each stretch in it — * which sit between the face and the hand, so a renderer built against 4 draws them nowhere. */ export declare const MDY_WIDGET_CONTRACT_VERSION: 5; /** Semantic element categories that presenters can map to their native rendering API. */ export type MdyWidgetSemanticElement = "root" | "label" | "input" | "button" | "group" | "status" | "submission" | "listbox" | "option" | "radio" | "dialog" | "grid" | "gridcell" | "container" | "presentation" | "popup" | "text" | "affordance" | "columnheader" | "image"; /** * The conditions under which an optional part is on the page. * * Closed, and each entry is a question a renderer can already answer without asking the contract * anything further. Free text would be unreadable to a check, and a check is the whole point: an * unwritten condition is what let the same optional part appear under three different rules. */ /** * The conditions an optional part is on the page under. * * `undoIsOnOffer` was here and is not: the control it governed stopped coming and going when a * control that is part of a field's design became always present and merely unavailable. The word * still means something — it is what decides whether that button can act — but a condition on a * *state* is not a condition on presence, and a vocabulary that holds both is one a reader has to * ask which kind each word is. ADR 0171. */ export declare const MDY_PART_PRESENCES: readonly ["documentDeclaresIt", "fieldIsRequired", "fieldCanBeInvalid", "errorsAreVisible", "overlayIsOpen", "valueIsPresent", "valueIsAbsent", "kindOffersIt", "viewIsActive", "valuesOverflow", "inputWasRefused", "pointerIsOnAValue", "workIsInFlight"]; /** * Derived from the list above rather than written twice. * * A union restated beside the array it mirrors is a second declaration, and a check reading the * restatement passes while the array grows past it — which is how a vocabulary comes to have two * lengths. A test can only read the array, so the array is what everything reads. */ export type MdyPartPresence = (typeof MDY_PART_PRESENCES)[number]; /** * Who decides each presence condition, and where a consumer goes to ask. * * A condition with no way to decide it is a declaration each renderer interprets for itself, which is * how one of these came to mean one thing where chips are drawn and another where they are not. The * three the package answers today carry 85 of the 185 declarations, and that is the direction of the * causation rather than a coincidence: a condition a consumer can ask about is the one consumers read. * * Three will never have a resolver, and saying so here is the point of the table. A condition whose * answer restates an input the renderer already holds cannot be got wrong by anybody, and a function * over it would put a call between a consumer and a fact in their hand. Left as a blank they read as * gaps, and the next person counting resolvers reports three findings that are decisions. * * `owed` is the third state, and there is nothing in it today. It is kept in the shape because a * condition added to the contract arrives owed, and the table has to be able to say so rather than * force whoever adds it to invent an answer on the spot. ADR 0169. */ /** * Which message names a part that no relation points at. * * Most parts are named by being pointed at: a caption's `for`, an opener's `aria-controls`. Five are * not, and they are not machinery — a person types in a panel's search box, in the second date of a * range, in each half of a time. Nothing declared what those are called, so each renderer chose, and * they chose differently: one built `" — end"` by hand where another read `daterangeEndLabel` * from the message table, and a page in Italian said "end". * * The words already existed in the table for every one of them. What was missing was the sentence * saying which word belongs to which part — so this is a binding rather than a vocabulary, and the * translation of a control's name stops being a decision a renderer takes on its own. * * Keyed `kind.part`. A part named by a relation is not here and must not be: two ways to name one * element is the divergence this removes. */ export declare const MDY_PART_NAMES: Readonly>; export declare const MDY_PRESENCE_RESOLUTION: Readonly>; /** * When each optional part is on the page, by part name. * * Keyed by name because the anatomy is declared twice — derived per kind, and written out once for * the shell every field shares — and a table is the only shape in which the two cannot disagree. A part * called * `supportingText` is the same part wherever it appears, and a table is the only shape in which * seventeen kinds cannot disagree about it. * * A name missing from here is a part whose condition has not been decided. That is a gap, and the * audit records it — but a *wrong* entry is worse than a missing one, because it tells a renderer to * build something at a moment when it is not wanted and nothing notices until it is on the page. */ /** * What a part needs the kind to have been *given* before its presence question applies at all. * * `presentWhen` says when a part is on the page. This says whether the question is asked — a reorder * grip is present when there is a value, and only where a document asked for reordering, which is not * a state the widget is in but something the page decided before it existed. * * One entry today, and it is a correction rather than an addition: read without it the contract owed * a drag handle to every multiselect holding a value, and all three renderers drew it only where * reordering was asked for. Three adapters agreeing against a declaration is the evidence that the * declaration is what is wrong. */ /** * Three that were here and are not any more, and the reason is one rule. * * A control that is part of a field's design is always present, and disabled where it cannot act. * Absence is for what is not part of *this* field — a box a configuration left out. Removing a * control when it has nothing to do collapses two facts that change at different rates: whether it * exists, which is fixed, and whether it can act, which changes as somebody works. The tab stops * then move under their hands, and the one who has never used the field learns what it can do only * after filling it in. * * `clearAll`, `wayBackAction` and `file.clear` were declared present-when-there-is-something, and * all three renderers drew them always — right about the presence, and none of them said *dimmed*, * so an empty field carried two buttons that looked live and did nothing. A button that lies is * worse than one that says it is unavailable. * * `chipMove` and `chipRemove` stay conditional and are not exceptions: they belong to a chip, and * exist exactly when the chip does. The chip is the state. `overflowCount` stays too — it reports a * state rather than offering an act, and "+0" is noise where absence is legible. */ /** * Parts whose unavailability is announced rather than set, and why that is not the usual defect. * * `aria-disabled` on a control the platform could disable natively is normally a lie: the reader is * told one thing and the pointer and keyboard do another, and the inspector says so. These are the * exception, and the reason is the tab order. * * The native property takes a control out of the tab order. For a control that is part of a field's * design — always there, unavailable only sometimes — that means the number of stops changes as * somebody works, and it changes *under their focus* at the one moment they have just pressed the * button: they clear a field, the button becomes unavailable, and their focus is on the document. * Announced instead, the button keeps focus and they hear the state change, which is the confirmation * that it worked. * * What neither this declaration nor the inspector can see is whether the handler actually refuses. * That is a question about an act rather than about markup, and the check that would settle it presses * the control and reads the value. ADR 0171 records that, and records that this list is the narrow * form on purpose: twenty-one parts declare `disabled` among their states and most of them are * natively disabled, so keying the exemption on that would give the whole contract away. */ export declare const MDY_ARIA_DISABLED_PARTS: readonly string[]; /** * Capabilities that decide whether a part's presence question applies at all. * * Keyed by `kind.part` where the gate belongs to one kind, and by the bare part name where it * belongs to the part wherever it appears — a slider's `value` is not a select's. Read through * {@link partIsOwed} so that neither half of the question can be taken without the other. * * `chipMove` — a reorder grip is owed only where a document asked for reordering. Read without this, * the contract owes one to every multiselect holding a value, which all three renderers correctly * disobey. * * A select's `value` is the same shape of question and is deliberately **not** here: the element * showing what was chosen exists in the custom chooser and not in the platform's own `