vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
54 lines (53 loc) • 2.35 kB
TypeScript
import { MapCreationStatus } from '../../enums';
import { CreateMaplibreActions } from '../../types';
import { MaybeRef } from 'vue';
import { Map, MapOptions, LngLatBoundsLike, LngLatLike, StyleSpecification, CameraOptions } from 'maplibre-gl';
interface CreateMapboxProps extends MapOptions {
register?: (actions: SimplifiedCreateMaplibreActions) => void;
debug?: boolean;
onLoad?: (map: Map) => void;
onError?: (error: any) => void;
}
interface SimplifiedCreateMaplibreActions extends CreateMaplibreActions {
getCurrentCamera: () => CameraOptions | null;
mapCreationStatus: Readonly<MapCreationStatus>;
isMapReady: boolean;
isMapLoading: boolean;
hasMapError: boolean;
getCurrentStyle: () => StyleSpecification | string | null;
}
/**
* Composable for creating and managing MapLibre GL Maps with enhanced error handling
* Provides reactive map management with validation, debugging, and comprehensive state management
*
* @param elRef - Reference to the HTML element container
* @param styleRef - Reference to the map style
* @param props - Configuration options for the map
* @returns Enhanced actions and state for map management
*/
export declare function useCreateMapbox(elRef: MaybeRef<HTMLElement | undefined>, styleRef: MaybeRef<StyleSpecification | string>, props?: Omit<CreateMapboxProps, 'container' | 'style'>): {
getCurrentCamera: () => CameraOptions | null;
mapCreationStatus: Readonly<MapCreationStatus>;
isMapReady: boolean;
isMapLoading: boolean;
hasMapError: boolean;
getCurrentStyle: () => StyleSpecification | string | null;
mapInstance: import('vue').ComputedRef<Map | null>;
setStyle: (style: string | StyleSpecification) => void;
setCenter: (center: LngLatLike) => void;
setBearing: (bearing: number) => void;
setZoom: (zoom: number) => void;
setMinZoom: (zoom: number) => void;
setMaxZoom: (zoom: number) => void;
setPitch: (pitch: number) => void;
setMinPitch: (pitch: number) => void;
setMaxPitch: (pitch: number) => void;
setMaxBounds: (bounds: LngLatBoundsLike) => void;
setRenderWorldCopies: (renderWorldCopies: boolean) => void;
initMap: () => void;
removeMap: () => void;
checkInitMap: () => void;
destroyMap: () => void;
};
export {};
//# sourceMappingURL=useCreateMapbox.d.ts.map