import type { Comment, Mention, Thread } from "../model/types"; import { type Person } from "./mentions"; import { type ReactionPicker } from "./reactions"; export interface ThreadActions { /** This reviewer's key, to mark their own reactions. */ readonly me: string; reply(parentId: string, text: string, mentions?: Mention[]): Promise; /** Changes the words of one of this reviewer's comments. */ edit(commentId: string, text: string, mentions?: Mention[]): Promise; /** Deletes one of this reviewer's comments. */ remove(commentId: string): Promise; /** Who can be mentioned with `@` in a reply. */ people(): Person[]; /** Gives (`on`) or takes back this reviewer's reaction to a comment. */ react(commentId: string, emoji: string, on: boolean): Promise; /** The full emoji picker, when an add-on provides one. */ picker(): ReactionPicker | null; resolve(threadId: string): Promise; reopen(threadId: string): Promise; /** "Still not right" on an addressed thread: reopens it and puts the cursor in its reply line. */ notRight(threadId: string): Promise; copy(threadId: string): void; /** Answers where a re-found or lost thread belongs: here, somewhere to pick, or gone (ยง8). */ place?(threadId: string, how: "confirmed" | "pick" | "gone"): void; /** Cancel or Esc threw away the words in thread `threadId`'s reply line: offers them back. */ drop(threadId: string, words: string): void; /** Esc in an empty reply line: closes the thread. */ close(): void; /** Who put an agent's reply here when the agent didn't sign it ("pasted by you"); "" otherwise. */ pasted?(c: { author: string; name: string; }): string; } export interface ThreadViewOptions { /** `card`: a closed card in All comments, only its first comment: words cut to two lines, no replies or reply box. */ variant: "column" | "popover" | "card"; quote?: string | null; /** Snapshot of content that can't be shown: gone from the page, or somewhere it couldn't be reached. */ lost?: string | null; /** Where that content is, when it isn't gone ("On slide 3"); default "No longer on the page". */ place?: string | null; /** Its content was found changed or nearby: flagged Moved, with what it was about, for someone to confirm. */ moved?: boolean; /** Found by looking alike: it asks whether this is the right place. */ alike?: boolean; /** A card's line about what it's on, as written (in place of the quote). */ note?: string | null; /** A card's quiet last line (its replies and reactions), as written. */ rest?: string | null; now?: () => number; } export declare const plural: (n: number) => string; /** A thread's replies that haven't been deleted: a deleted comment goes away. */ export declare const replies: (t: Thread) => Comment[]; export interface ThreadView { readonly element: HTMLElement; /** Shows a newer copy of the thread. The reply line is kept, so what's being typed in it (and focus) survives. */ update(t: Thread, o?: Partial): void; } /** * One thread, as a compact card: who and how long ago, then the words; its actions sit at the top right (on hover, * and always when open). Replies sit one level in beneath the comment, oldest first, and the thread ends with its * reply box at the same indent. */ export declare function threadView(first: Thread, actions: ThreadActions, options: ThreadViewOptions): ThreadView;