/** Where the reviewer is: the slide ("1"-based) and whatever the page reports about itself. */ export type ViewState = Record; /** A deck's own way to say which slide shows and to go to one (both 1-based). */ export interface SlideHook { current(): number; go(n: number): void; } /** What finding the current slide needs from layout (faked in unit tests). */ export interface SlideLook { box(el: Element): { left: number; top: number; width: number; height: number; }; /** Not hidden by display:none, visibility:hidden or opacity:0, on it or an ancestor. */ shown(el: Element): boolean; /** Its own opacity, 0 to 1: in a cross-fade the more opaque of two slides wins. */ opacity(el: Element): number; viewport(): { width: number; height: number; }; } /** Where the reviewer is now, and how to go somewhere else. */ export interface Here { /** The current slide ("3"), or null on a page that isn't a deck. */ slide(): string | null; /** * What a new comment on `at` saves: { slide?, ...the page's state }, or undefined when there is nothing. The * slide is the marked slide holding `at`, else the current one. */ view(at?: Node): ViewState | undefined; /** A thread saved with view `saved` belongs here (its content is judged by the app). */ holds(saved: ViewState | undefined): boolean; /** The edition the page names (`data-pipeup-edition`), or null on a page that names none. */ edition(): string | null; /** A thread saved with view `saved` is from another edition (or from before the page named one). */ earlier(saved: ViewState | undefined): boolean; /** Goes to `view`; resolves true once it is here, false after 1 s (or at once when nothing can go there). */ navigate(view: ViewState): Promise; destroy(): void; } /** * Reports the page's own view, such as `{ tab: "pricing", label: "Pricing tab" }`: string values only, within * the anchor's limits (the slide is Pipeup's own). `label` is the readable name and is never compared. `null` * forgets it. */ export declare function setViewState(state: Record | null): void; /** Registers a handler called with a view when the reviewer chooses a thread elsewhere; returns its removal. */ export declare function onReveal(fn: (view: ViewState) => void): () => void; /** The deck hook from `mount({ slides })`, or null. */ export declare function setSlideHook(h: SlideHook | null): void; /** The marked slide showing most: the most of the window covered, then the more opaque; still tied, `was` stays. */ export declare function pickSlide(slides: readonly Element[], look: SlideLook, was: Element | null): Element | null; /** * The marked slides showing above or below `best` on a deck that scrolls: shown, partly in the window, and clear of it * (a deck that stacks its slides in one place never has any). */ export declare function besides(slides: readonly Element[], look: SlideLook, best: Element | null): Element[]; /** * On a deck, a thread is here when it is on this slide, on another one showing (`also`, on a deck that scrolls), or * on none; on other pages, when every key of its saved view but `label` matches the page's state (always, until the * page reports one). */ export declare function isHere(saved: ViewState | undefined, slide: string | null, state: ViewState | null, also?: readonly string[]): boolean; /** The edition the page names (`data-pipeup-edition`, wherever settings go), as written; null when it names none. */ export declare function pageEdition(): string | null; /** A comment saved with `saved` is from another edition than `now`; never on a page that names none. */ export declare const isEarlier: (saved: ViewState | undefined, now: string | null) => boolean; export declare function pageSlideLook(): SlideLook; /** * Follows here: the deck's hook, else reveal.js, else the marked slide that is showing; plus the page's * reported state. `onCheck` runs after every re-check (at most once a frame), so the app can re-sort threads. */ export declare function createHere(root: Element, onCheck: () => void, look?: SlideLook): Here;