vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
40 lines (39 loc) • 1.49 kB
TypeScript
import { MaybeRef, ShallowRef } from 'vue';
import { Nullable } from '../../types';
import { Map, GeoJSONSource, GeoJSONSourceSpecification } from 'maplibre-gl';
/**
* Source creation status enum for better state management
*/
export declare enum SourceStatus {
NotCreated = "not-created",
Creating = "creating",
Created = "created",
Error = "error"
}
export interface CreateGeoJsonSourceActions {
sourceId: string;
getSource: ShallowRef<Nullable<GeoJSONSource>>;
setData: (data: GeoJSONSourceSpecification['data']) => void;
removeSource: () => void;
refreshSource: () => void;
sourceStatus: Readonly<SourceStatus>;
isSourceReady: boolean;
}
interface CreateGeoJsonSourceProps {
map: MaybeRef<Nullable<Map>>;
id?: string;
data: GeoJSONSourceSpecification['data'];
options?: Partial<GeoJSONSourceSpecification>;
debug?: boolean;
register?: (actions: CreateGeoJsonSourceActions, map: Map) => void;
}
/**
* Composable for creating and managing MapLibre GL GeoJSON Sources
* Provides reactive GeoJSON source with error handling, performance optimizations, and enhanced API
*
* @param props - Configuration options for the GeoJSON source
* @returns Enhanced actions and state for the GeoJSON source
*/
export declare function useCreateGeoJsonSource({ map: mapRef, id, data, options, debug, register, }: CreateGeoJsonSourceProps): CreateGeoJsonSourceActions;
export {};
//# sourceMappingURL=useCreateGeoJsonSource.d.ts.map