import type { Mention } from "../model/types"; import type { Ctx, Draft } from "./context"; import type { Person } from "./mentions"; export interface DraftOptions { /** What the comment is on: a quote or an element label. */ label: string; /** The writer's public key, which picks their animal. */ me: string; /** The writer's name; "" until they add one. */ name(): string; /** Saves a new name (the same path as the menu's Your name). */ rename(name: string): Promise; onSend(text: string, mentions: Mention[]): Promise; /** `words`: what Cancel or Esc threw away ("" for an empty box). */ onCancel(words: string): void; /** Who can be mentioned with `@`. */ people?(): Person[]; } export interface DraftBox { element: HTMLElement; focus(): void; setLabel(label: string): void; /** The naming bar already says what the box is on: its label row takes no space. */ hideLabel(on: boolean): void; /** Remembers the caret; the returned function focuses the box and puts it back. */ caret(): () => void; isEmpty(): boolean; /** Puts words back in the box (Undo), with the caret after them. */ fill(words: string): void; } /** * The box for a new comment, as a card: who is writing, what it's on, then the writing box. Nobody has to give a * name; the top line says who they are ("You're Otter ยท add your name") and opens a name field in its place. */ export declare function renderDraft(o: DraftOptions): DraftBox; /** * The box for the app's current draft. While it holds words, a click elsewhere won't throw them away. * The caller focuses it as soon as it is in the page: a deferred focus could land after the reader has * already moved on, taking their typing or the new selection they just made. */ export declare function draftBox(ctx: Ctx, d: Draft): DraftBox;