import { type LeafThroughOptions, type Layout, type PageChangeDetail } from './options.js'; export interface LeafThroughEventMap { pagechange: CustomEvent; ready: CustomEvent; pageload: CustomEvent<{ page: number; }>; error: CustomEvent<{ error: unknown; page?: number; }>; } export interface GoToOptions { /** Turn the pages one by one instead of jumping. Default `false`. */ animate?: boolean; } /** * A 3D magazine rendered into `container`. Size the container with CSS; the magazine * fits inside it (a container without a height takes its height from its width). * * ```ts * const magazine = new LeafThrough(document.querySelector('#magazine'), { * pages: ['/pages/01.jpg', '/pages/02.jpg', '/pages/03.jpg'], * }) * magazine.addEventListener('pagechange', (e) => console.log(e.detail.page)) * ``` */ export declare class LeafThrough extends EventTarget { readonly container: HTMLElement; /** The element the magazine renders into; focusable, labelled, and styleable via `[data-leafthrough]`. */ readonly element: HTMLDivElement; private options; private readonly canvas; private readonly hitArea; private readonly live; private readonly content; private readonly renderer; private frameRequest; private readonly paper; private loader; private view; private spreadMedia; private readonly motionMedia; private readonly abort; private readonly resizeObserver; private readonly metrics; private hitBox; private hitSide; private readonly intersection; private visible; private needsRender; private running; private readonly riffle; private lastPagesKey; private loadVersion; private ready; private disposed; constructor(container: HTMLElement, options: LeafThroughOptions); /** First visible page, 0-based. */ get page(): number; get pageCount(): number; get layout(): Layout; get visiblePages(): number[]; /** True while showing flat pages: the `plain` option is on, or the browser can't run WebGL. */ get plain(): boolean; /** True while a page is being dragged or is completing its turn. */ get turning(): boolean; /** Turns to the next page. Returns false at the end. */ next(): boolean; /** Turns to the previous page. Returns false at the start. */ prev(): boolean; /** Shows `page` (0-based), jumping there or turning the pages one by one. */ goTo(page: number, { animate }?: GoToOptions): void; /** Loads the pages that failed again. Also happens by itself when the browser comes back online. */ retry(): void; /** Changes some options and keeps the rest. Structural changes rebuild the scene and keep the current page. */ update(options: Partial): void; /** * Replaces every option at once: anything left out goes back to its default. Bindings * use this, since props describe the whole state. Structural changes rebuild the scene * and keep the current page. */ setOptions(options: LeafThroughOptions): void; private applyOptions; addEventListener(type: K, listener: (event: LeafThroughEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (event: LeafThroughEventMap[K]) => void, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void; dispose(): void; private pickLayout; private watchSpreadQuery; private remount; private createPlain; private createScene; private layoutBox; private pagesKey; private loadPages; private startPages; private inView; private followReader; private resetReady; private pageLoaded; private fail; private pageToPosition; private pagesAt; private detail; private lastDetailKey; private emitPageChange; private syncContent; private applyLabel; private bindKeyboard; private syncLoop; private setLoop; private placeHitArea; private frame; }