import type { QuestionAnswer, QuestionData } from "../tool/types.js"; import type { WrappingSelectItem } from "../view/components/wrapping-select.ts"; import type { RowKind } from "./row-intent.ts"; export type InlineInputOwner = Extract; /** * Canonical state for the questionnaire dialog. Single source of truth — both the * dispatcher (`routeKey`) and the view layer read this same shape. */ export interface QuestionnaireState { currentTab: number; optionIndex: number; inputMode: boolean; notesVisible: boolean; chatFocused: boolean; /** Active owner of the shared inline input, or null when no inline row is being edited. */ inlineInputOwner: InlineInputOwner | null; answers: ReadonlyMap; multiSelectChecked: ReadonlySet; /** * Pre-answer notes side-band, keyed by tab index. Decoupled from `answers` so adding * notes does NOT mark a question answered (the Submit-tab missing-check would falsely * pass otherwise). Merged into the answer at confirm time. */ notesByTab: ReadonlyMap; /** True iff the focused option carries a non-empty `preview` string. Gates `notes_enter` and the "n to add notes" hint chip. */ focusedOptionHasPreview: boolean; /** Focused row in the Submit-tab picker (0 = Submit, 1 = Cancel). Reset on tab switch. */ submitChoiceIndex: number; /** Canonical mirror of the in-flight notes editor; runtime mirrors after `forward_notes_keystroke`. */ notesDraft: string; /** In-flight custom "Type something." drafts keyed by question tab. Preserved when focus leaves the row. */ customDraftByTab: ReadonlyMap; /** Caret offsets for in-flight custom drafts keyed by question tab. */ customCaretByTab: ReadonlyMap; /** In-flight "Chat about this" inline drafts keyed by question tab. */ chatDraftByTab: ReadonlyMap; /** Caret offsets for in-flight chat drafts keyed by question tab. */ chatCaretByTab: ReadonlyMap; } /** * Per-tick context the dispatcher needs alongside canonical state. Held separately * because `keybindings` / `inputBuffer` must never reach view setProps consumers. */ export interface QuestionnaireRuntime { keybindings: { matches(data: string, name: string): boolean; }; inputBuffer: string; questions: readonly QuestionData[]; isMulti: boolean; currentItem: WrappingSelectItem | undefined; items: readonly WrappingSelectItem[]; } //# sourceMappingURL=state.d.ts.map