import { type AdapterConfig } from "@trackunit/react-map-adapter-shared"; import { type UseMapReturn } from "./types"; /** * useMap hook - the main entry point for using the map * * Returns a tuple of [Map, api] where Map is the component to render * and api contains map status, actions, event subscriptions, containerRef, and * controls configuration. `api.state` is MapStatus only: use it for readiness, * initialization failure, appearance, and tile size. * * Camera state (center, zoom, bounds, isIdle) is exposed through * `useCameraState(api)` so components opt in to high-frequency viewport updates. * * All action functions and the Map component reference are stable across re-renders. * * @param adapterConfig - Adapter configuration from an adapter factory (e.g., googleMapsAdapter) * @returns Tuple of [Map component, API object] * @example Basic usage * ```tsx * import { useMap, DefaultControls } from "@trackunit/react-map"; * import { googleMapsAdapter } from "@trackunit/react-map-adapter-google"; * * const MyMap = () => { * const [Map, api] = useMap(googleMapsAdapter({ * apiKey: "...", * theme: "light", * })); * * return ( * * * * ); * }; * ``` * @example Accessing camera state (center, zoom, bounds) * Camera state (viewport) can update continuously during panning and zooming. * Use `useCameraState` only from components that render or react to viewport changes: * ```tsx * import { useDebounce } from "@trackunit/react-components"; * import { useMap, useCameraState } from "@trackunit/react-map"; * import { googleMapsAdapter } from "@trackunit/react-map-adapter-google"; * * const MyComponent = () => { * const [Map, api] = useMap(googleMapsAdapter({ apiKey: "..." })); * const { center, zoom, bounds } = useCameraState(api); * * // Debounce bounds for API calls (wait 200ms after map stops moving) * const debouncedBounds = useDebounce(bounds, { delay: 200 }); * * return ...; * }; * ``` */ export declare const useMap: >(adapterConfig: AdapterConfig) => UseMapReturn;