import { type GeoJsonBbox, type GeoJsonFeature } from "@trackunit/geo-json-utils"; import type { MapApi } from "../../core/types"; /** * Shared map view state consumed by adaptive rendering systems (marker render * medium selection and shape label resolution). Combines high-frequency camera * values with low-frequency tile size, so viewport reading is defined once. */ export type ViewportContext = Readonly<{ zoom: number; bounds: Readonly | null; tileSize: number; /** * Returns `true` when the current viewport bounds are fully contained inside * the given feature's geometry. Useful for suppressing edge labels and * triggering annotation fallbacks when the user has zoomed into a shape. * * Returns `false` when bounds are not yet available or the feature has no * polygon geometry. */ isViewportInsideFeature: (feature: GeoJsonFeature) => boolean; }>; /** * Reads `zoom` and `bounds` from the camera channel and `tileSize` from * `api.state`, returning a stable `ViewportContext` reference that only changes * when one of the underlying values changes. Falls back to sensible defaults * while `api` is initializing. * * Stability matters because the result flows into `useMemo` deps in both * `useAdaptiveMarkerResolution` and `useShapeDecorations` — if a new object * came back every render the downstream resolution work would re-run for no * reason. Bounds are projected to primitive deps so a fresh bbox array with * equal values does not invalidate the memo. */ export declare const useViewportContext: (api: MapApi | undefined) => ViewportContext;