import type { ImageItem } from "../types.mjs"; export interface ImageLoadResult { /** * The element to mount into the viewer slot. A `` when the * item declared `sources`, otherwise the bare `` itself. */ element: HTMLImageElement | HTMLPictureElement; /** * The actual `` that received the load. Always an * HTMLImageElement — the viewer uses this to apply transforms * and read natural dimensions regardless of whether the wrapper * is a picture. */ image: HTMLImageElement; width: number; height: number; } export interface ImageLoaderOptions { /** * CORS attribute applied to created elements. * Default: null (no attribute) for maximum compatibility. */ crossOrigin?: "anonymous" | "use-credentials" | null; /** * Referrer-policy applied to created elements. * Default: "strict-origin-when-cross-origin" — safer than the * browser default which leaks the full URL cross-origin. */ referrerPolicy?: ReferrerPolicy; } /** * Pluggable image loader contract (#9). Default implementation * below uses `new Image()` + `decode()`, but consumers can inject * their own loader to add CDN signing, blur-up previews, custom * AVIF fallbacks, service-worker caching, etc. The loader MUST * honor the provided AbortSignal so rapid slide navigation can * cancel in-flight loads. */ export interface ImageLoader { load(item: ImageItem, signal: AbortSignal, options?: ImageLoaderOptions & { priority?: "high" | "low" | "auto"; }): Promise; } /** The built-in default loader. Wraps `loadImage` in the interface. */ export declare const defaultImageLoader: ImageLoader; /** * Load an image and await decode(), racing a timeout so a stalled * server cannot block the pipeline forever. Applies fetchpriority, * decoding hints, and referrer policy for safer defaults (issues * #27, #29 security axis). * * The loader is pure: it does NOT attach the element to the DOM. * Callers mount it wherever they need. */ export declare function loadImage(item: ImageItem, signal: AbortSignal, opts?: ImageLoaderOptions & { priority?: "high" | "low" | "auto"; }): Promise; /** * Compute the CSS `aspect-ratio` string for a slot based on item * dimensions. Falls back to 3:2 when unknown. */ export declare function computeAspectRatio(item: { width?: number; height?: number; }): string;