import type { InitialInputSelections } from "./inputValidation"; /** Selected option ids by choice input `field_id`. */ export type InputSelectionsByFieldId = InitialInputSelections; /** A mounted choice input, as the selections store sees it. */ export interface InputSelectionSource { fieldId: string; /** * The option ids this input publishes for `answer` while rules see * `selections`, or null while the input is hidden. */ publish: (selections: InputSelectionsByFieldId, answer: string[]) => string[] | null; } /** * A list that components join at init and leave on destroy without notifying * readers right away. Ancestors read it while their block is still creating * the joining component, and Svelte drops invalidations raised at that point, * so readers are notified after mount (or after destroy) instead. */ export declare class Registry { #private; readonly items: T[]; /** Reads the list's version so a reactive caller re-runs on changes. */ track(): void; /** Adds `item` until the calling component is destroyed. */ join(item: T): void; } /** * Choice input selections that input conditions match against, in two layers: * the seed (answers from earlier screens) and this screen's answers (given * here, or restored through `initialInputSelections`). A field reads this * screen's answer once it's answered, and the seed otherwise. A mounted but * hidden input publishes nothing, so its field falls back to the seed. */ export declare class InputSelectionsStore { #private; constructor(seed?: () => InputSelectionsByFieldId); /** The selections rules match against. */ get current(): InputSelectionsByFieldId; /** * The selections for rules on a choice input and everything inside it: * `fieldIds` (the input's field and those of enclosing inputs) resolve from * the seed alone, so an input can't show or hide itself or its contents * through its own answer. */ excluding(fieldIds: readonly string[], selections?: InputSelectionsByFieldId): InputSelectionsByFieldId; /** This screen's answer for `fieldId`, or undefined until it's answered. */ answerFor(fieldId: string): string[] | undefined; answer(fieldId: string, optionIds: string[]): void; /** * Sets this screen's restored answers. Empty ones leave their field * unanswered, and an answer only counts once an input for its field mounts. */ restore(selections: InputSelectionsByFieldId): void; /** * A snapshot of this screen's answers, hidden ones included, for restoring * its inputs. */ answers(): InputSelectionsByFieldId; /** * A snapshot of what this screen publishes over the seed for rules. Hidden * inputs and options are left out, so their fields keep the seed's answer. */ published(): InputSelectionsByFieldId; /** Forgets this screen's answers, e.g. when a workflow changes screens. */ clearAnswers(): void; /** Registers a choice input until the calling component is destroyed. */ register(source: InputSelectionSource): void; } export declare function setInputSelectionsContext(store: InputSelectionsStore): void; export declare function getOptionalInputSelectionsContext(): InputSelectionsStore | undefined; /** Isolated mounts (stories, unit tests) get a store of their own. */ export declare function getInputSelectionsContext(): InputSelectionsStore; /** Sets the field ids of the choice inputs enclosing descendants, innermost last. */ export declare function setEnclosingFieldIdsContext(fieldIds: readonly string[]): void; /** The field ids of the choice inputs enclosing the calling component. */ export declare function getEnclosingFieldIdsContext(): readonly string[];