import { type SyntheticEvent } from "react"; import { type ZoomPinch, type ZoomPoint, type ZoomSize, type ZoomView } from "../lib/zoom-pan.js"; export type ZoomPanController = { /** Null until both the image's pixel size and the viewport are known. */ view: ZoomView | null; image: ZoomSize | null; viewport: ZoomSize | null; percent: number | null; canZoomIn: boolean; canZoomOut: boolean; setImage(size: ZoomSize): void; setViewport(size: ZoomSize): void; zoomIn(point?: ZoomPoint): void; zoomOut(point?: ZoomPoint): void; zoomBy(factor: number, point: ZoomPoint): void; /** One two-finger step from one spread and midpoint to the next. */ pinch(from: ZoomPinch, to: ZoomPinch): void; fit(): void; toggleAt(point: ZoomPoint): void; panBy(dx: number, dy: number): void; }; /** * Zoom and pan state for one image. A new `resetKey` (the next artifact or * screenshot) starts again from fitted, so zoom never carries over. */ export declare function useZoomPan(resetKey: string): ZoomPanController; /** Which zoom a key press asks for: Cmd/Ctrl with plus, minus or zero. */ export declare function zoomShortcut(event: KeyboardEvent): "in" | "out" | "fit" | null; /** * While an image is on screen, Cmd/Ctrl + plus, minus and zero zoom the image * instead of the page or the desktop window. The listener runs first and * claims the key, so the browser's and the desktop menu's zoom never see it; * elsewhere in the app they work as usual. */ export declare function useZoomPanShortcuts(controller: ZoomPanController, enabled: boolean): void; /** * An image that fills its (positioned) parent, fitted and centred, and can be * zoomed and panned: click toggles fitted and actual size at the click point, * Cmd/Ctrl + wheel and trackpad or touch pinch zoom around the pointer, and a * drag or plain scroll pans a zoomed image. The image is laid out at its * zoomed pixel size (not a CSS transform scale), so it stays sharp. * * Only a click on the image itself zooms. A click beside it, at any zoom, * calls `onBackdropClick` (closing a lightbox) or does nothing. The zoom * cursor sits on the image, so the backdrop keeps a plain arrow and the * image shows the zoom its click will actually make. */ export declare function ZoomPanSurface({ controller, src, alt, naturalSize, onBackdropClick, onError, className, imageClassName, }: { controller: ZoomPanController; src: string; alt: string; /** The image's pixel size when known up front, so it is laid out before it loads. */ naturalSize?: ZoomSize | null | undefined; /** A click beside the image, at any zoom, such as closing a lightbox. */ onBackdropClick?: (() => void) | undefined; onError?: ((event: SyntheticEvent) => void) | undefined; className?: string | undefined; imageClassName?: string | undefined; }): import("react").JSX.Element; export type ZoomControlLabels = { zoomIn?: string | undefined; zoomOut?: string | undefined; fit?: string | undefined; }; /** Zoom out, the zoom percentage, zoom in and Fit, for a header or caption. */ export declare function ZoomControls({ controller, labels, className, buttonClassName, }: { controller: ZoomPanController; labels?: ZoomControlLabels | undefined; className?: string | undefined; buttonClassName?: string | undefined; }): import("react").JSX.Element;