import { type ReactNode } from "react"; import type { MediaViewerProps } from "../MediaViewerProps"; import { type MediaItem, type ResolveUrl, type ViewerFile } from "../mediaItems"; /** MediaViewer props passed through; items, index and title come from `open`. */ export type UseFileViewerOptions = Omit; export interface FileViewerApi { /** Opens `files` (app-stored paths) resolved through `resolveUrl`, at `index`. */ open: (files: ViewerFile[], index: number, title: string, resolveUrl: ResolveUrl) => void; /** Opens an already-built `MediaItem[]`, e.g. from `buildMediaItems`. */ openItems: (items: MediaItem[], index: number, title: string) => void; /** Opens local, unsaved `File`s via object URLs; the hook owns their lifecycle. */ openLocal: (files: File[], index: number, title: string) => void; /** Closes the viewer and revokes the object URLs made for local files. */ close: () => void; /** Mount this once; it renders nothing until `open`/`openItems`/`openLocal` is called. */ viewer: ReactNode; } /** Imperative open/close for `MediaViewer`, with object-URL lifecycle management for local files. */ export declare function useFileViewer(options?: UseFileViewerOptions): FileViewerApi; export default useFileViewer;