import type { MapMarkerData } from './map-marker'; import type { GeoJsonInput } from './map-geojson'; export interface MapSnapshotLegendItem { color: string; label: string; } export interface MapSnapshotOptions { /** @default true */ withLegend?: boolean; /** @default true */ withScaleBar?: boolean; /** @default true */ withAttribution?: boolean; /** Device pixel multiplier. @default 2 */ scale?: number; /** @default 960 */ width?: number; /** @default 540 */ height?: number; background?: string; foreground?: string; mutedForeground?: string; legendItems?: MapSnapshotLegendItem[]; legendTitle?: string; attribution?: string; } export interface MapSnapshotSource { markers: MapMarkerData[]; baseGeojson?: GeoJsonInput | null; /** Resolved literal colors keyed by token name. */ colors: Record; defaultColor: string; outlineColor: string; } /** * Renders the map's data layer to a PNG, with no new dependency. * * @description * **What this can and cannot capture, stated plainly.** The Google basemap * tiles are served cross-origin and painted into a canvas the page does not * own; drawing them into a canvas of ours taints it, and `toDataURL` then * throws. There is no client-side way around that without either a DOM- * rasterizing dependency (`html2canvas` and friends) or a separate billed call * to the Static Maps API. Both were out of scope, so this composes the layer * the library itself draws: the reference outline, the markers at their true * projected positions, and the legend, scale bar and attribution that a report * needs in the image rather than beside it. * * The result is a clean cartographic figure without tile imagery — which is * frequently what a dossier wants anyway. When the basemap must be in the * picture, capture it server-side or through the Static Maps API. */ export declare function useMapSnapshot(source: MapSnapshotSource): { toPng: (options?: MapSnapshotOptions) => Promise; toDataUrl: (options?: MapSnapshotOptions) => string | null; toCanvas: (options?: MapSnapshotOptions) => HTMLCanvasElement | null; };