import type { CameraState } from "./camera.js"; import { type CoordinateReferenceSystem, type CRSInput } from "./crs.js"; import { Evented } from "./events.js"; import { LatLng, LatLngBounds, Point, type LatLngBoundsLike, type LatLngLike, type PointLike } from "./geo.js"; import type { Layer, QueryHit, QueryOptions } from "./layer.js"; import { type Control } from "./ui/control.js"; import { type OrihonLocale, type LocaleInput } from "./ui/locale.js"; import type { ExportPngOptions, PrintMapOptions } from "./services/map-export.js"; import type { Popup, Tooltip } from "./overlays/div-overlay.js"; export interface MapOptions { center?: LatLngLike; zoom?: number; minZoom?: number; maxZoom?: number; zoomSnap?: number; wheelZoomStep?: number; maxBounds?: LatLngBoundsLike | null; maxBoundsViscosity?: number; inertia?: boolean; inertiaDeceleration?: number; inertiaMaxSpeed?: number; /** Camera animation duration in milliseconds. Default 250; zero jumps immediately. */ zoomAnimationDurationMs?: number; controls?: boolean; locale?: LocaleInput; ariaLabel?: string; keyboard?: boolean; keyboardPanDelta?: number; behaviors?: BehaviorOptions; crs?: CRSInput; } /** * Which animation a camera move runs. `"none"` jumps to the target; `"fly"` runs the `flyTo` * curve. A name rather than a boolean because the option selects an implementation, and the * set can grow without a second flag. */ export type CameraAnimation = "none" | "fly"; export interface CameraMotionOptions { /** Default `"none"`. */ animation?: CameraAnimation; /** Only meaningful for an animated move; defaults to `zoomAnimationDurationMs`. */ durationMs?: number; } export interface FitBoundsOptions extends CameraMotionOptions { /** Screen-space padding in CSS pixels kept around the fitted bounds. Default 32. */ padding?: number; } export interface MapSize { width: number; height: number; } export type ControlPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right"; export type MapBehaviorName = "drag" | "scrollZoom" | "pinchZoom" | "dblClick" | "boxZoom"; export type BehaviorOptions = Partial>; type ResolvedMapOptions = Required> & { behaviors: BehaviorOptions; maxBounds: LatLngBounds | null; crs: CoordinateReferenceSystem; }; export declare class BehaviorManager { #private; readonly map: Orihon; /** * Read-only view of every behavior flag. Writing one directly would skip the * `behaviorchange` event and the listener wiring, so changes go through * `enable` / `disable` / `toggle`; `isEnabled` and `getEnabled` read single values. */ get states(): Readonly>; constructor(map: Orihon, options?: BehaviorOptions); enable(name: MapBehaviorName): this; disable(name: MapBehaviorName): this; toggle(name: MapBehaviorName, enabled?: boolean): this; isEnabled(name: MapBehaviorName): boolean; getEnabled(): MapBehaviorName[]; } /** Payloads emitted by the map and its built-in controls. Custom events may augment this interface. */ export interface MapEventMap { click: { originalEvent: MouseEvent; containerPoint: Point; latlng: LatLng; }; movestart: { center: LatLng; }; move: { center: LatLng; }; moveend: { center: LatLng; }; zoomstart: { zoom: number; }; zoom: { zoom: number; }; zoomend: { zoom: number; }; resize: { oldSize: Point; newSize: Point; }; boxzoomstart: { containerPoint: Point; }; boxzoomend: { containerPoint: Point; bounds: LatLngBounds; }; behaviorchange: { name: MapBehaviorName; enabled: boolean; behaviors: MapBehaviorName[]; }; localechange: { locale: OrihonLocale; }; layeradd: { layer: Layer; }; layerremove: { layer: Layer; }; attributionchange: { attributions: string[]; }; locationfound: { latlng: LatLngLike; accuracy: number; position: GeolocationPosition; }; locationerror: { error: Error | GeolocationPositionError; }; unload: {}; popupopen: { popup: Popup; }; popupclose: { popup: Popup; }; tooltipopen: { tooltip: Tooltip; }; tooltipclose: { tooltip: Tooltip; }; } export declare class Orihon extends Evented { #private; /** * Read-only configuration view, matching `Layer.options`. Assigning a field * changes no live state — `controls` would not remove existing controls, `locale` would not * re-render them. Use `setLocale`, `setMaxBounds`, `setMinZoom` / `setMaxZoom` and * `map.behaviors` instead. * * `Readonly` is a TypeScript guarantee: this is a read-only view of the live configuration * object, not a copy, and the modifier disappears at runtime. */ get options(): Readonly; readonly container: HTMLElement; viewport: HTMLDivElement; /** Pane elements by name. Read-only view: create and drop panes with `createPane` / `removePane`. */ get panes(): Readonly>; /** Control anchor elements by position. Read-only view: `addControl` places controls for you. */ get controlCorners(): Readonly>; /** * Live camera. These are views on the state the render loop owns, so they read cheaply from * layers every frame but cannot be written: moving the camera without `setView` / `setZoom` * would skip clamping, the view session and the render pass. `getCamera()` returns a detached * snapshot when a value has to outlive the frame. */ get center(): LatLng; get zoom(): number; get size(): Readonly; get pixelOrigin(): Readonly; /** Screen-space pan velocity in px/s. Updated during drag / inertia; zero when idle. */ get panVelocity(): Readonly; /** Attached layers; iterate with `for (const layer of map.layers)`. Mutation goes through `addLayer` / `removeLayer`. */ get layers(): ReadonlySet; /** Attached controls; iterate with `for (const control of map.controls)`. Mutation goes through `addControl` / `removeControl`. */ get controls(): ReadonlySet; readonly locale: OrihonLocale; /** * Resolves once the locale requested by `options.locale` / `setLocale()` is actually applied. * Core loads non-English packs lazily, so `map.locale` starts as English strings tagged with * the requested `language`; Standard and Advanced register the packs at import and resolve * immediately. Await this before asserting on control or accessibility text. Rejects with the * import failure when the pack chunk cannot be loaded — the map keeps working in English. */ get localeReady(): Promise; readonly behaviors: BehaviorManager; readonly crs: CoordinateReferenceSystem; constructor(container: string | HTMLElement, options?: MapOptions); /** * Immutable snapshot of the live camera used by geographic renderers. * All panes must project through this state within a single paint frame. */ getCamera(): CameraState; /** * `destroy()` is terminal and idempotent. Afterwards camera and query methods are inert * (they return `this` / `null`), while anything that would attach to the map fails fast with * a `DestroyedError` (`code === "ERR_DESTROYED"`). Guard with `isDestroyed` when a map * reference may outlive the map. This method and `addLayer` / `addControl` / `createPane` * are the throwing side. */ get isDestroyed(): boolean; createPane(name: string, container?: HTMLElement, className?: string): HTMLElement; getPane(name?: string): HTMLElement | null; getPanes(): Readonly>; removePane(name: string): this; invalidateSize(): this; getContainer(): HTMLElement; getCenter(): LatLng; getZoom(): number; getSize(): Point; getMaxBounds(): LatLngBounds | null; distance(a: LatLngLike, b: LatLngLike): number; setLocale(input: LocaleInput): this; addLayer(layer: Layer): this; removeLayer(layer: Layer): this; hasLayer(layer: Layer): boolean; /** Visit a snapshot of attached layers. Prefer `for (const layer of map.layers)` in new code. */ eachLayer(callback: (layer: Layer) => void): this; query(containerPoint: PointLike, options?: QueryOptions): QueryHit[]; queryLatLng(value: LatLngLike, options?: QueryOptions): QueryHit[]; exportPng(options?: ExportPngOptions): Promise; print(options?: PrintMapOptions): Promise; addControl(control: Control): this; removeControl(control: Control): this; addAttribution(value: string): this; removeAttribution(value: string): this; getAttributions(): string[]; setMaxBounds(value: LatLngBoundsLike | null): this; /** * Narrow or widen the zoom range at runtime. The current zoom is re-clamped immediately, so * raising `minZoom` above the live zoom zooms in rather than leaving the map outside its own * limits until the next interaction. */ setMinZoom(zoom: number): this; setMaxZoom(zoom: number): this; panInsideBounds(value: LatLngBoundsLike, options?: CameraMotionOptions): this; /** * Move the camera and finish: the move is terminal, so `moveend` / `zoomend` fire and any * running `flyTo` or inertia is cancelled. Use `updateView` for one step of an ongoing motion. */ setView(center: LatLngLike, zoom?: number): this; /** * One step of a continuous motion — follow-cam, an animation frame, a live position feed. * The camera moves but the gesture stays open: `movestart` / `zoomstart` fire once, no * `moveend` follows, tiles keep CSS-translating instead of reloading per step, and a running * animation is left alone. Finish with `setView` (or let the next gesture end it), otherwise * consumers waiting on `moveend` never hear that the motion stopped. */ updateView(center: LatLngLike, zoom?: number): this; panTo(center: LatLngLike): this; panBy(offset: PointLike): this; setZoom(zoom: number): this; zoomIn(delta?: number): this; zoomOut(delta?: number): this; setZoomAround(anchor: PointLike, zoom: number): this; fitBounds(value: LatLngBoundsLike, options?: FitBoundsOptions): this; fitWorld(options?: FitBoundsOptions): this; flyTo(center: LatLngLike, zoom?: number, options?: { durationMs?: number; }): this; flyToBounds(value: LatLngBoundsLike, options?: { padding?: number; durationMs?: number; }): this; /** True while a `flyTo` / `panTo` animation or inertia is driving the camera. Pairs with `stop()`. */ get isAnimating(): boolean; stop(): this; latLngToLayerPoint(value: LatLngLike): Point; latLngToContainerPoint(value: LatLngLike): Point; containerPointToLatLng(value: PointLike): LatLng; getBounds(): LatLngBounds; /** * Ecosystem-compatible terminal alias of {@link destroy}. Leaflet-shaped code * reaches for `map.remove()`; both spellings do the same irreversible teardown. */ remove(): this; destroy(): this; } export declare function createMap(container: string | HTMLElement, options?: MapOptions): Orihon; export {}; //# sourceMappingURL=map.d.ts.map