import { type PipeupDocument } from "../document"; import type { Ctx, UiState, View } from "./context"; import { type Appearance } from "./legible"; import { type FieldHost } from "./field"; export interface AppOptions { doc: PipeupDocument; root: Element; onName(name: string): Promise; /** Called on every render: the page's code hears comment mode and the name changing (ยง4a). */ onRender?(): void; /** Pipeup's stylesheet (passed in so the bundles can carry it last, where it compresses best). */ styles: string; /** Where the reviewer's choices for this page are kept (look, Hide comments). Default: the page's localStorage. */ prefs?: Prefs; /** * A host shows Pipeup's threads itself (the browser extension's side panel): Pipeup opens none on the page, and tells * the host when one is opened there. New comments are still written on the page, beside what they're about. */ host?: Host; /** Pipeup's UI is in a closed shadow root, out of the page's scripts' reach (the browser extension). */ closed?: boolean; /** A host's own stand-in for Pipeup's text fields, typed in where the page can't hear (the browser extension). */ field?: FieldHost; } /** What Pipeup tells a host that shows its threads. */ export interface Host { /** A thread was opened on the page (its highlight clicked, or just written). */ open(id: string): void; } /** A place for the reviewer's small choices, read as Pipeup starts: localStorage, or the host's own. */ export type Prefs = Pick; export interface App { readonly ctx: Ctx; /** Goes to a thread's place: scrolls it into view and marks it, as choosing it in All comments does. */ goTo(id: string): void; /** How Pipeup looks and why: its look, who chose it, and what the page's styles do to it. */ appearance(): Appearance; destroy(): void; } /** Documents with free space beside them get a column; everything else gets bubbles and popovers. */ export declare function chooseMode(root: Element, showing?: boolean): UiState["mode"]; export declare function viewsFor(ctx: Ctx): View[]; export declare function startApp(o: AppOptions): App;