import { Cell } from "@mdxeditor/gurx"; import type { Binding } from "@lexical/yjs"; import type { ChangeStore } from "./changes"; import type { ContentSwapMotion } from "./content-swap"; import type { Research } from "@chopin/protocol"; import type { ResearchDraftStore } from "./research-draft"; import type { QuestionnaireStore } from "./questionnaires"; import type { ThreadStore } from "./threads"; import type { Transport } from "./transport"; export type CommentPresentation = "popover" | "sheet"; export type QuestionStepMotion = { contract: ContentSwapMotion; immediately: () => boolean; }; export type ResearchOpener = { readonly current: HTMLElement | null }; /** App-owned HTTP state and actions for durable Research Workspace references. */ export type ResearchStore = { subscribe(listener: () => void): () => void; retain(id: string): () => void; get(id: string): Research.RequestView | undefined; mutating(id: string): boolean; refresh(id: string): void; create(question: string, requestId: string): Promise; cancel(id: string): Promise; retry(id: string): Promise; opener(id: string, current?: HTMLElement | null): ResearchOpener; open(child: Research.ReadyChild, opener: ResearchOpener): void; }; export type WidgetOptions = { binding?: Binding; commentPresentation?: CommentPresentation; motionImmediately?: () => boolean; questionMotion?: QuestionStepMotion; questions?: QuestionnaireStore; research?: ResearchStore; researchDrafts?: ResearchDraftStore; threads?: ThreadStore; changes?: ChangeStore; wire?: Transport; connected?: boolean; canEdit?: boolean; }; export const widgets$ = Cell({});