import { Evented, IControl, Map as MLMap, PopupOptions } from 'maplibre-gl'; import { Feature, Position } from '../types.js'; import { GeocodingControlBase } from './base-control.js'; import { MaplibreglGeocodingControlEventName } from './maplibregl-events.js'; import { MaplibreglGeocodingControlOptions } from './maplibregl-options.js'; /** Part of the `Marker` API of MapLibre GL JS / MapTiler SDK used by the control */ export type MarkerLike = { setLngLat(lngLat: Position): unknown; getElement(): HTMLElement; togglePopup(): unknown; remove(): unknown; }; /** Options of the control's default marker */ export type DefaultMarkerOptions = { element: HTMLElement; offset: [number, number]; }; /** Marker options with the types of the map library */ type MarkerOptionsOf = { marker?: null | boolean | MarkerOptionsType | ((map: MapType, feature?: Feature) => undefined | null | MarkerType); showResultMarkers?: null | boolean | MarkerOptionsType | ((map: MapType, feature: Feature) => undefined | null | MarkerType); }; /** * Implementation of the control shared by MapLibre GL JS and MapTiler SDK. It doesn't use any classes of the map libraries directly: * the subclass creates the markers and popups, and copies the methods of the map library's `Evented` (see `mixinEvented()` in `utils/mixin-evented.ts`). */ export declare abstract class MaplibreglGeocodingControlBase & MarkerOptionsOf, EventNameMap extends Record, MapType extends MLMap, MarkerType extends MarkerLike, MarkerOptionsType extends object> implements IControl, GeocodingControlBase { #private; constructor(options: Options); /** Creates a marker using the `Marker` of the map library */ protected abstract createMarker(options: MarkerOptionsType | DefaultMarkerOptions): MarkerType; /** Adds the marker to the map */ protected abstract addMarker(map: MapType, marker: MarkerType): void; /** Sets a popup with the text to the marker, using the `Popup` of the map library */ protected abstract setMarkerPopup(marker: MarkerType, options: PopupOptions, text: string): void; /** Adjusts the URL of each geocoding request, after the `adjustUrl` option */ protected adjustRequestUrl?(url: URL): void; /** @internal Not to be called directly */ onAdd(map: MapType): HTMLElement; /** @internal Not to be called directly */ onRemove(): void; getOptions(): Options; setOptions(options: Options): void; setQuery(value: string): void; submitQuery(value: string): void; clearMap(): void; clearList(): void; setReverseMode(reverseActive: boolean): void; focus(options?: FocusOptions): void; blur(): void; } /** The control is `Evented`, but only by the methods copied with `mixinEvented()` in the subclass (type parameters must match the class) */ export interface MaplibreglGeocodingControlBase & MarkerOptionsOf, EventNameMap extends Record, MapType extends MLMap, MarkerType extends MarkerLike, MarkerOptionsType extends object> extends Evented { } export {};