svelte-maplibre-gl
Version:
Build interactive web maps effortlessly with MapLibre GL JS and Svelte
58 lines (57 loc) • 2.59 kB
TypeScript
import type { Map as MapLibre, Marker, AddLayerObject, SourceSpecification, CanvasSourceSpecification, StyleSpecification, SkySpecification, TerrainSpecification, ProjectionSpecification, LightSpecification } from 'maplibre-gl';
declare class MapContext {
/** Map instance */
_map: MapLibre | null;
/** Callbacks to be called when the map style is loaded */
private _listener?;
private _pending;
/** Names of layers dynamically added */
userLayers: Set<string>;
/** Names of sources dynamically added */
userSources: Set<string>;
/** Terrain specification of the current base style */
baseTerrain?: TerrainSpecification | undefined;
/** Sky specification set by user */
userTerrain?: TerrainSpecification | undefined;
/** Sky specification of the current base style */
baseSky?: SkySpecification | undefined;
/** Sky specification set by user */
userSky?: SkySpecification | undefined;
/** Light specification of the current base style */
baseLight?: LightSpecification | undefined;
/** Light specification set by user */
userLight?: LightSpecification | undefined;
/** Projection specification of the current base style */
baseProjection?: ProjectionSpecification | undefined;
/** Projection specification set by user */
userProjection?: ProjectionSpecification | undefined;
get map(): maplibregl.Map | null;
set map(value: maplibregl.Map | null);
addLayer(addLayerObject: AddLayerObject, beforeId?: string): void;
removeLayer(id: string): void;
addSource(id: string, source: SourceSpecification | CanvasSourceSpecification): void;
removeSource(id: string): void;
/** Wait for the style to be loaded before calling the function */
waitForStyleLoaded(func: (map: maplibregl.Map) => void): void;
private _onstyledata;
setStyle(style: string | StyleSpecification | null): void;
}
export declare function prepareMapContext(): MapContext;
export declare function getMapContext(): MapContext;
declare class SourceContext {
/** sourceId */
id: string;
}
export declare function prepareSourceContext(): SourceContext;
export declare function getSourceContext(): SourceContext;
declare class LayerContext {
id: string;
}
export declare function prepareLayerContext(): LayerContext;
export declare function getLayerContext(): LayerContext | null;
declare class MarkerContext {
marker: Marker | null;
}
export declare function prepareMarkerContext(): MarkerContext;
export declare function getMarkerContext(): MarkerContext | null;
export {};