/** * Custom renderer registry (#8). * * A renderer is a plain object that claims a subset of item types * and knows how to mount them inside the viewer slot. The default * image path stays hard-wired in `PencereViewer.renderSlide` for * performance, but every other type (video, iframe, html, custom:*) * flows through this registry. * * First-party renderers ship as separate subpaths (`pencere/video`, * `pencere/iframe`, …). Consumers register any additional renderer * via `PencereViewerOptions.renderers`. */ import type { Item } from "../types.mjs"; export interface RendererContext { /** The current document — useful for `createElement` on shadow-root setups. */ document: Document; /** AbortSignal that fires when the slide is replaced; renderers must * cancel any pending work attached to it. */ signal: AbortSignal; } export interface Renderer { /** * Return `true` if this renderer can mount the given item. The * registry walks renderers in order and picks the first match. */ canHandle(item: Item): item is I; /** Mount the item into a fresh element; the viewer inserts the result into the slot. */ mount(item: I, ctx: RendererContext): HTMLElement | Promise; /** * Optional teardown. Called with the element returned from * `mount` when the viewer navigates away or closes. Useful for * releasing Blob URLs, detaching event listeners, stopping * videos, etc. */ unmount?(element: HTMLElement, item: I): void; } /** * Default first-party iframe renderer. Sandboxed by default to keep * untrusted remote content from reaching the parent document. */ export declare const iframeRenderer: Renderer; /** * Default first-party HTML renderer. Accepts either a raw HTML string * (routed through textContent to avoid XSS — consumers should pre- * sanitize via Trusted Types if they need rich content) or a builder * function returning an HTMLElement. */ export declare const htmlRenderer: Renderer; /** * Default first-party `