vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
66 lines (65 loc) • 2.22 kB
TypeScript
import { Popup, LngLatLike, Map, PopupOptions, PointLike } from 'maplibre-gl';
import { Nullable } from '../../types';
import { Ref, MaybeRef } from 'vue';
/**
* Popup creation status enum for better state management
*/
export declare enum PopupStatus {
NotCreated = "not-created",
Creating = "creating",
Created = "created",
Open = "open",
Closed = "closed",
Error = "error",
Removed = "removed"
}
interface PopupEventHandlers {
open?: (popup: Popup) => void;
close?: (popup: Popup) => void;
}
interface CreatePopupProps {
map: MaybeRef<Nullable<Map>>;
options?: PopupOptions;
el?: Ref<HTMLElement | undefined>;
lnglat?: MaybeRef<LngLatLike | undefined>;
show?: boolean;
withMap?: boolean;
html?: MaybeRef<string | undefined>;
on?: PopupEventHandlers;
debug?: boolean;
autoCreate?: boolean;
closeOnClick?: boolean;
closeButton?: boolean;
}
interface CreatePopupActions {
popup: Readonly<Nullable<Popup>>;
popupStatus: Readonly<PopupStatus>;
isPopupCreated: boolean;
isPopupOpen: boolean;
setLngLat: (lnglat: LngLatLike) => void;
setOffset: (offset: PointLike) => void;
addClassName: (className: string) => void;
removeClassName: (className: string) => void;
setMaxWidth: (width: string) => void;
show: () => void;
hide: () => void;
toggle: () => void;
addToMap: () => void;
setHTMLContent: (html?: string) => void;
setDOMContent: (element: HTMLElement) => void;
setText: (text: string) => void;
removePopup: () => void;
createPopup: () => void;
getLngLat: () => LngLatLike | null;
getElement: () => HTMLElement | null;
}
/**
* Composable for managing MapLibre GL Popups
* Provides reactive popup with error handling, performance optimizations, and enhanced API
*
* @param props - Configuration options for the popup
* @returns Enhanced actions and state for the popup
*/
export declare function useCreatePopup({ map: mapRef, lnglat: lnglatVal, html, el, show: showVal, withMap: withMapVal, options, on, debug, autoCreate, closeOnClick, closeButton, }: CreatePopupProps): CreatePopupActions;
export {};
//# sourceMappingURL=useCreatePopup.d.ts.map