vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
48 lines (47 loc) • 1.99 kB
TypeScript
import { AnyLayout, AnyPaint, CreateLayerActions, Nullable } from '../../types';
import { FilterSpecification, Map, StyleSetterOptions, LayerSpecification } from 'maplibre-gl';
import { ComputedRef } from 'vue';
/**
* Layer management status enum for better state management
*/
export declare enum LayerManagementStatus {
NotRegistered = "not-registered",
Registering = "registering",
Registered = "registered",
Error = "error",
Disposed = "disposed"
}
interface LayerManagementProps {
debug?: boolean;
autoCleanup?: boolean;
}
interface LayerManagementActions {
register: (instance: CreateLayerActions<any>, map: Map) => void;
layerId: ComputedRef<string | undefined>;
layer: ComputedRef<Nullable<LayerSpecification>>;
layerStatus: ComputedRef<LayerManagementStatus>;
isLayerRegistered: ComputedRef<boolean>;
isLayerReady: ComputedRef<boolean>;
getFilter: () => void | FilterSpecification;
getLayoutProperty: (name: keyof AnyLayout) => any;
getPaintProperty: (name: keyof AnyPaint) => any;
setBeforeId: (beforeId?: string) => void;
setFilter: (filter?: FilterSpecification) => void;
setPaintProperty: (name: string, value: any, options?: StyleSetterOptions) => void;
setLayoutProperty: (name: string, value: any, options?: StyleSetterOptions) => void;
setZoomRange: (minzoom?: number, maxzoom?: number) => void;
removeLayer: () => void;
setStyle: (styleVal: AnyLayout & AnyPaint) => void;
dispose: () => void;
refresh: () => void;
}
/**
* Composable for managing MapLibre GL Layer instances
* Provides reactive layer management with error handling, performance optimizations, and enhanced API
*
* @param props - Configuration options for layer management
* @returns Enhanced actions and state for layer management
*/
export declare function useLayer<T extends LayerSpecification>(props?: LayerManagementProps): LayerManagementActions;
export {};
//# sourceMappingURL=useLayer.d.ts.map