UNPKG

svelte-maplibre-gl

Version:

Build interactive web maps effortlessly with MapLibre GL JS and Svelte

68 lines (67 loc) 2.92 kB
import type * as maplibregl from 'maplibre-gl'; import type { AddLayerObject, CanvasSourceSpecification, LightSpecification, Marker, ProjectionSpecification, SkySpecification, SourceSpecification, StyleSpecification, TerrainSpecification } from 'maplibre-gl'; import { SvelteSet } from 'svelte/reactivity'; declare class MapContext { /** Map instance */ _map: maplibregl.Map | null; /** Callbacks to be called when the map style is loaded */ private _listener?; private _pending; /** Names of layers dynamically added */ userLayers: SvelteSet<string>; /** Names of sources dynamically added */ userSources: SvelteSet<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; /** * Waits for the style to be loaded before calling the function. * * If an abort signal is provided, the function call will be cancelled * if the signal is aborted before the style is loaded. */ waitForStyleLoaded(func: (map: maplibregl.Map) => void, { signal }?: { signal?: AbortSignal; }): void; private _onstyledata; private _mergeUserLayers; 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 {};