import { PptxData, PptxSlide } from 'pptx-viewer-core'; import { CanvasSize } from 'pptx-viewer-shared'; import { ExportGifOptions } from './export-gif'; import { OpenPrintWindow, PrintOptions } from './export-print'; import { ExportVideoOptions } from './export-video'; /** Rasterise the slide at `index` to an `HTMLCanvasElement`. Injected so the * controller stays DOM-capture-free and unit-testable. */ export type RasterizeSlide = (index: number) => Promise; /** Per-slide progress callback: `(currentSlideIndex, totalSlides)`. */ export type ExportProgress = (current: number, total: number) => void; /** Options for the multi-slide PDF export (progress + cooperative cancel). */ export interface ExportPdfOptions { /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */ onProgress?: ExportProgress; /** Abort the export early; the loop checks this between slides. */ signal?: AbortSignal; } export interface ExportControllerDeps { /** Live slide count; read fresh on every call. */ getSlideCount(): number; /** Active slide index (0-based); the PNG export's default target. */ getCurrent(): number; /** Live slide canvas size (px), for the PDF page size. */ getCanvasSize(): CanvasSize; /** Live slide list (print needs slide notes/titles, not just the count). */ getSlides(): PptxSlide[]; rasterizeSlide: RasterizeSlide; /** Print-surface opener override; see `export-print.ts` for the default. */ openPrintWindow?: OpenPrintWindow; /** Base file name (without extension) for downloads. Defaults to `presentation`. */ fileName?: string; /** Live presentation data for the deck-JSON export; undefined before a load. */ getDeckData?(): PptxData | undefined; /** Source file name for the deck-JSON download (`deck.pptx` -> `deck.json`). */ getFileName?(): string | undefined; } /** * Export controller (runes class): render slides to PNG / PDF / animated GIF / * WebM video, plus the print flow. Started as a Svelte port of Vue's * `useExport` composable (`packages/vue/src/viewer/composables/useExport.ts`) * and now also covers React's `useExportHandlers` GIF/video surface (via * `export-gif.ts` / `export-video.ts`) and Vue's `usePrint` * (`export-print.ts`), reshaped as a `$state`-backed class to match this * package's runes-class convention (see `EditorState` in * `../editor/editor-state.svelte.ts`) rather than Vue `Ref`s. * * Rasterisation is delegated to the injected `rasterizeSlide` (the host owns * the off-screen `SlideStage` mount + `html2canvas-pro`, see * `rasterize-slide.ts`). `jspdf` is loaded lazily so it stays out of the main * bundle. */ export declare class ExportController { #private; /** True while an export is running (disable UI / show a spinner). */ exporting: boolean; constructor(deps: ExportControllerDeps); /** Export a single slide as a PNG download. Defaults to the current slide. */ exportSlidePng(index?: number): Promise; /** Copy a slide to the system clipboard as a PNG image. */ copySlideAsImage(index?: number): Promise; /** * Serialize the live deck to `pptx-viewer-json` and trigger the download. * Pure data serialization (shared `exportDeckJson`): synchronous, no * rasterization pipeline, no progress modal, no `exporting` toggle. */ exportJson(): void; /** Export every slide as a multi-page PDF download (one slide per page). */ exportPdf(options?: ExportPdfOptions): Promise; /** * Export every slide as an animated GIF download. Frame delays come from * the shared `planGifFrames` plan (default duration + per-slide overrides); * see `export-gif.ts`. Supports progress + AbortSignal like `exportPdf`. */ exportGif(options?: ExportGifOptions): Promise; /** * Export every slide as a WebM video download (MediaRecorder over a canvas * capture stream, timing from the shared `planVideoSegments` plan); see * `export-video.ts`. Supports progress + AbortSignal like `exportPdf`. */ exportVideo(options?: ExportVideoOptions): Promise; /** * Assemble the shared print document for the given (partial) settings and * open it in the print surface (hidden iframe by default; see * `export-print.ts` for the popup-blocker caveats of custom openers). * Resolves `true` when the print surface opened. */ print(options?: PrintOptions): Promise; } //# sourceMappingURL=export-controller.svelte.d.ts.map