/** * React integration (doc 19, §48). React owns the container; the engine owns everything spatial. * No GIS logic here (Decision: React is the integration layer only). * * Two ways to use it: * - ``: MapView creates the runtime (once per provider, realtime, * ontology and history) and destroys it on unmount. `config.layers` changes are applied through the runtime API, * `config.basemap` changes through setBasemap() — neither remounts. * - ``: a runtime made outside React (shared, headless-first, or kept across views). MapView * only mounts it into its container and unmounts it again; the owner destroys it. * * `config.viewport` is the initial camera; move the camera with `runtime.setViewport` / `fitBounds` / `flyTo`. * `selection` makes selection controlled: the application owns it and pushes it in. */ import { type CSSProperties, type ReactNode } from 'react'; import { MapEngineError } from '../core/errors.js'; import type { Geofence, GeofenceEvent, MapConfig, MapViewport, Position, SelectionContext, TimeSetting } from '../core/types.js'; import type { AnnotationProvider, AuthContext, JournalProvider, LinkProvider, OntologySpatialResolver, RealtimeProvider, SpatialDataProvider, TrackProvider } from '../data/contracts.js'; import type { PickEvent, Renderer } from '../render/renderer.js'; import { type MapRuntime, type MapRuntimeOptions } from '../runtime/runtime.js'; /** Props for both forms. With `map={runtime}`, time, geofences and selectable are pushed only when given. */ export interface MapViewCommonProps { /** Application-owned time (ADR-010): live, or replay at a time. Omit for live. */ time?: TimeSetting; /** Geofences evaluated on the client for display (doc 15). Authoritative alerts belong to the server. */ geofences?: Geofence[]; /** Live geofence transitions. In replay, read them with `useGeofences()`. */ onGeofence?: (event: GeofenceEvent) => void; /** Controlled selection. Omit for uncontrolled (the map selects on click). */ selection?: { objectIds: string[]; primaryObjectId?: string; source?: string; }; onSelect?: (selection: SelectionContext) => void; onViewportChange?: (viewport: MapViewport) => void; onMapClick?: (position: Position) => void; /** Every click, with what it hit (null on empty map). Use this for tools that need positions over objects. */ onClick?: (event: { position: Position; hit: { objectId: string; layerId: string; } | null; }) => void; /** Click-to-select on/off (default on). Turn off while an app tool uses clicks. */ selectable?: boolean; onHover?: (hover: PickEvent | null) => void; onError?: (error: MapEngineError) => void; /** Non-fatal problems (a layer without a spatial capability, a mismatched visualization), from the first load on. */ onWarning?: (warning: MapEngineError) => void; /** After the first load. */ onReady?: (runtime: MapRuntime) => void; className?: string; style?: CSSProperties; /** Overlays (controls, popups). They can use the hooks from this module. */ children?: ReactNode; } /** MapView creates and owns the runtime. */ export interface MapViewOwnedProps extends MapViewCommonProps { map?: undefined; config: MapConfig; provider: SpatialDataProvider; /** Snapshot + stream: changes arrive without reloading. Often the same object as `provider`. */ realtime?: RealtimeProvider; /** Resolves layer ontology types to spatial bindings; missing capabilities are reported, not guessed. */ ontology?: OntologySpatialResolver; /** Historical positions for track layers and replay. */ history?: TrackProvider; /** Relations between objects, for link layers (doc 28 G4). */ links?: LinkProvider; /** The event journal: replay rebuilds whole objects at a time (doc 29 §7–8). */ journal?: JournalProvider; /** Where annotations are kept and shared (doc 28 G10). */ annotations?: AnnotationProvider; /** Who is looking (doc 28 G13). Changing it hands the new identity to the providers and reloads, in place. */ auth?: AuthContext | null; /** Called once per runtime. Keeps this module renderer-agnostic (e.g. `() => new MapLibreRenderer()`). */ createRenderer: () => Renderer; runtimeOptions?: MapRuntimeOptions; } /** MapView shows a runtime it does not own (doc §48: ``). */ export interface MapViewRuntimeProps extends MapViewCommonProps { map: MapRuntime; } export type MapViewProps = MapViewOwnedProps | MapViewRuntimeProps; export declare function MapView(props: MapViewProps): import("react").JSX.Element;