/** * The framework-agnostic API layer. * * Everything asynchronous lives here — module instantiation, fetching, image decoding, * font loading — so the Rust side can stay synchronous. A synchronous wasm call cannot * await an `ImageBitmap`, so the shape of the contract is: Rust says what it needs, this * layer gets it, hands it back, and only then asks for a frame. */ import { type PresentationInfo, type RenderOptions, type WasmSource, type SearchMatch, type SearchOptions, type SlideHit, type TextLayerRun } from './types.js'; export interface OpenOptions { /** Where to load the WASM module from. */ wasm?: WasmSource; /** Install the deck's embedded fonts as `FontFace`s. Default true. */ useEmbeddedFonts?: boolean; signal?: AbortSignal; } /** An open presentation. Call {@link Presentation.destroy} when finished with it. */ export declare class Presentation { #private; private constructor(); /** Opens a presentation from a URL, `File`/`Blob`, or raw bytes. */ static open(src: string | File | Blob | ArrayBuffer | Uint8Array, options?: OpenOptions): Promise; /** * Subscribes to "the assets a frame was missing have arrived". * * Images decode asynchronously, so the first frame of a slide with pictures draws * without them. Rather than have callers guess a delay and redraw on a timer, this * fires once the outstanding decodes for a slide have finished. Returns an * unsubscribe function. */ onAssetsReady(listener: () => void): () => void; /** * How many images are still decoding. * * Zero does not mean a slide is fully drawn — it means nothing is outstanding. Test * harnesses use it to know when a frame is final; application code should prefer * {@link Presentation.onAssetsReady}. */ pendingAssetCount(): number; get info(): PresentationInfo; get slideCount(): number; /** Slide size in points. */ get slideSize(): { width: number; height: number; }; /** * Lays a slide out without drawing it. * * Worth calling on the next and previous slides after a navigation: layout is the * expensive half, and doing it ahead of time is what makes arrow-key navigation feel * instant rather than merely fast. */ prepare(index: number): void; /** * Draws a slide into a canvas. * * Resolves once the slide is drawn *with everything that was ready*. Images and fonts * that were not decoded yet are fetched, and the caller is told to draw again via the * returned `complete` flag — a viewer typically renders once for the layout and once * more when the assets arrive, rather than blocking on them. */ render(index: number, canvas: HTMLCanvasElement, options?: RenderOptions): Promise<{ complete: boolean; }>; /** A slide's text, in draw order. For search, selection and accessibility. */ text(index: number): string; /** Speaker notes for a slide. */ notes(index: number): string; /** * A textual dump of a slide's draw commands. * * Diagnostic, not API: it is how you tell a layout bug from a rasterisation bug when a * slide looks wrong. The format is not stable. */ debugTrace(index: number, width?: number, height?: number): string; /** * Where the text is on a slide, in device pixels, for building a selectable layer. * * The positions come from the same walk the renderer uses, so a run culled from the * canvas is absent here too — the overlay can never offer selectable text where * nothing was painted. * * Pass the same options you passed to {@link render}, or the boxes will not line up. */ textLayer(index: number, options?: RenderOptions): TextLayerRun[]; /** * Finds `query` on one slide, with the rectangles to highlight each occurrence. * * Pass the same options you passed to {@link render}, or the boxes will not line up. * Matches are positioned by the same walk that painted the glyphs, so a highlight * cannot land where the text is not. * * A phrase is not matched across a line break: the words are not adjacent on screen, * and boxing them as one would cover the unrelated text between them. */ searchSlide(index: number, query: string, options?: SearchOptions): SearchMatch[]; /** * Which slides contain `query`, and how many times. * * Cheaper than {@link searchSlide} per slide — it compares text and never asks for * rectangles — but it still lays out every slide it has not seen, so on a large deck * the first call is the expensive one. Use it to drive a result list, then ask * {@link searchSlide} for boxes only on the slide actually being shown. */ findSlides(query: string, options?: { caseSensitive?: boolean; }): SlideHit[]; /** What a WebGPU backend would need for this slide. Diagnostic. */ gpuRequirements(index: number): string; /** Drops cached layouts. Rebuilt on demand. */ evict(): void; /** Frees the WASM-side presentation and uninstalls any embedded fonts. */ destroy(): void; } //# sourceMappingURL=presentation.d.ts.map