From d7848388b9482bbc77115510018df12192271716 Mon Sep 17 00:00:00 2001 From: Bryan Johnson Date: Wed, 22 Nov 2017 14:24:33 -0700 Subject: [PATCH] update mapbox-gl to handle expressions and heatmaps --- types/mapbox-gl/index.d.ts | 1646 ++++++++++++++++++------------------ 1 file changed, 838 insertions(+), 808 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index ddaafced3d..520f267b5f 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.41.0 +// Type definitions for Mapbox GL JS v0.42.2 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer , Patrick Reames // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,1080 +7,1110 @@ /// declare namespace mapboxgl { - let accessToken: string; - let version: string; - export function supported(options?: {failIfMajorPerformanceCaveat?: boolean}): boolean; - export function setRTLTextPlugin(pluginURL: string, callback: Function): void; + let accessToken: string; + let version: string; - type LngLatLike = number[] | LngLat; - type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds; - type PointLike = number[] | Point; + export function supported(options?: { failIfMajorPerformanceCaveat?: boolean }): boolean; - /** - * Map - */ - export class Map extends Evented { - constructor(options?: MapboxOptions); + export function setRTLTextPlugin(pluginURL: string, callback: Function): void; - addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; + type LngLatLike = number[] | LngLat; + type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds; + type PointLike = number[] | Point; + type Expression = any[]; - removeControl(control: Control): this; + /** + * Map + */ + export class Map extends Evented { + constructor(options?: MapboxOptions); - addClass(klass: string, options?: mapboxgl.StyleOptions): this; + addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; - removeClass(klass: string, options?: mapboxgl.StyleOptions): this; + removeControl(control: Control): this; - setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this; + addClass(klass: string, options?: mapboxgl.StyleOptions): this; - hasClass(klass: string): boolean; + removeClass(klass: string, options?: mapboxgl.StyleOptions): this; - getClasses(): string[]; + setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this; - resize(): this; + hasClass(klass: string): boolean; - getBounds(): mapboxgl.LngLatBounds; + getClasses(): string[]; - setMaxBounds(lnglatbounds?: LngLatBoundsLike): this; + resize(): this; - setMinZoom(minZoom?: number): this; + getBounds(): mapboxgl.LngLatBounds; - getMinZoom(): number; + setMaxBounds(lnglatbounds?: LngLatBoundsLike): this; - setMaxZoom(maxZoom?: number): this; + setMinZoom(minZoom?: number): this; - getMaxZoom(): number; + getMinZoom(): number; - project(lnglat: LngLatLike): mapboxgl.Point; + setMaxZoom(maxZoom?: number): this; - unproject(point: PointLike): mapboxgl.LngLat; + getMaxZoom(): number; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + project(lnglat: LngLatLike): mapboxgl.Point; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + unproject(point: PointLike): mapboxgl.LngLat; - setStyle(style: mapboxgl.Style | string): this; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature[]; - getStyle(): mapboxgl.Style; + querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature[]; - isStyleLoaded(): boolean; + setStyle(style: mapboxgl.Style | string): this; - addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; + getStyle(): mapboxgl.Style; - isSourceLoaded(id: string): boolean; + isStyleLoaded(): boolean; - areTilesLoaded(): boolean; + addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; - removeSource(id: string): this; + isSourceLoaded(id: string): boolean; - getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; + areTilesLoaded(): boolean; - addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: {width?: number, height?: number, pixelRatio?: number}): this; + removeSource(id: string): this; - removeImage(name: string): this; + getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; - loadImage(url: string, callback: Function): this; + addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: { width?: number, height?: number, pixelRatio?: number }): this; - addLayer(layer: mapboxgl.Layer, before?: string): this; + removeImage(name: string): this; - moveLayer(id: string, beforeId?: string): this; + loadImage(url: string, callback: Function): this; - removeLayer(id: string): this; + addLayer(layer: mapboxgl.Layer, before?: string): this; - getLayer(id: string): mapboxgl.Layer; + moveLayer(id: string, beforeId?: string): this; - setFilter(layer: string, filter?: any[]): this; + removeLayer(id: string): this; - setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; + getLayer(id: string): mapboxgl.Layer; - getFilter(layer: string): any[]; + setFilter(layer: string, filter?: any[]): this; - setPaintProperty(layer: string, name: string, value: any, klass?: string): this; + setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; - getPaintProperty(layer: string, name: string, klass?: string): any; + getFilter(layer: string): any[]; - setLayoutProperty(layer: string, name: string, value: any): this; + setPaintProperty(layer: string, name: string, value: any, klass?: string): this; - getLayoutProperty(layer: string, name: string, klass?: string): any; + getPaintProperty(layer: string, name: string, klass?: string): any; - setLight(options: mapboxgl.Light, lightOptions: any): this; + setLayoutProperty(layer: string, name: string, value: any): this; - getLight(): mapboxgl.Light; + getLayoutProperty(layer: string, name: string, klass?: string): any; - getContainer(): HTMLElement; + setLight(options: mapboxgl.Light, lightOptions: any): this; - getCanvasContainer(): HTMLElement; + getLight(): mapboxgl.Light; - getCanvas(): HTMLCanvasElement; + getContainer(): HTMLElement; - loaded(): boolean; + getCanvasContainer(): HTMLElement; - remove(): void; + getCanvas(): HTMLCanvasElement; - onError(): void; + loaded(): boolean; - showTileBoundaries: boolean; + remove(): void; - showCollisionBoxes: boolean; + onError(): void; - repaint: boolean; + showTileBoundaries: boolean; - getCenter(): mapboxgl.LngLat; + showCollisionBoxes: boolean; - setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this; + repaint: boolean; - panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + getCenter(): mapboxgl.LngLat; - panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; + setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this; - getZoom(): number; + panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setZoom(zoom: number, eventData?: mapboxgl.EventData): this; + panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; - zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + getZoom(): number; - zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + setZoom(zoom: number, eventData?: mapboxgl.EventData): this; - zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - getBearing(): number; + zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setBearing(bearing: number, eventData?: mapboxgl.EventData): this; + zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; + getBearing(): number; - resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + setBearing(bearing: number, eventData?: mapboxgl.EventData): this; - snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; - getPitch(): number; + resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setPitch(pitch: number, eventData?: EventData): this; + snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - fitBounds(bounds: LngLatBoundsLike, options?: { linear?: boolean, easing?: Function, padding?: number | mapboxgl.PaddingOptions, offset?: PointLike, maxZoom?: number }, eventData?: mapboxgl.EventData): this; + getPitch(): number; - jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; + setPitch(pitch: number, eventData?: EventData): this; - easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + fitBounds(bounds: LngLatBoundsLike, options?: { linear?: boolean, easing?: Function, padding?: number | mapboxgl.PaddingOptions, offset?: PointLike, maxZoom?: number }, eventData?: mapboxgl.EventData): this; - flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; + jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; - isMoving(): boolean; + easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - stop(): this; + flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; - scrollZoom: ScrollZoomHandler; + isMoving(): boolean; - boxZoom: BoxZoomHandler; + stop(): this; - dragRotate: DragRotateHandler; + scrollZoom: ScrollZoomHandler; - dragPan: DragPanHandler; + boxZoom: BoxZoomHandler; - keyboard: KeyboardHandler; + dragRotate: DragRotateHandler; - doubleClickZoom: DoubleClickZoomHandler; + dragPan: DragPanHandler; - touchZoomRotate: TouchZoomRotateHandler; - } + keyboard: KeyboardHandler; - export interface MapboxOptions { - /** If true, an attribution control will be added to the map. */ - attributionControl?: boolean; + doubleClickZoom: DoubleClickZoomHandler; - bearing?: number; + touchZoomRotate: TouchZoomRotateHandler; + } - /** Snap to north threshold in degrees. */ - bearingSnap?: number; + export interface MapboxOptions { + /** If true, an attribution control will be added to the map. */ + attributionControl?: boolean; - /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */ - boxZoom?: boolean; + bearing?: number; - /** initial map center */ - center?: LngLatLike; + /** Snap to north threshold in degrees. */ + bearingSnap?: number; - /** Style class names with which to initialize the map */ - classes?: string[]; + /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */ + boxZoom?: boolean; - /** ID of the container element */ - container?: string | Element; + /** initial map center */ + center?: LngLatLike; - /** If true, enable the "drag to pan" interaction (see DragPanHandler). */ - dragPan?: boolean; + /** Style class names with which to initialize the map */ + classes?: string[]; - /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */ - dragRotate?: boolean; + /** ID of the container element */ + container?: string | Element; - /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */ - doubleClickZoom?: boolean; + /** If true, enable the "drag to pan" interaction (see DragPanHandler). */ + dragPan?: boolean; - /** If true, the map will track and update the page URL according to map position */ - hash?: boolean; + /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */ + dragRotate?: boolean; - /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ - failIfMayorPerformanceCaveat?: boolean; + /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */ + doubleClickZoom?: boolean; - /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ - interactive?: boolean; + /** If true, the map will track and update the page URL according to map position */ + hash?: boolean; - /** If true, enable keyboard shortcuts (see KeyboardHandler). */ - keyboard?: boolean; + /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ + failIfMayorPerformanceCaveat?: boolean; - logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ + interactive?: boolean; - /** If set, the map is constrained to the given bounds. */ - maxBounds?: LngLatBoundsLike; + /** If true, enable keyboard shortcuts (see KeyboardHandler). */ + keyboard?: boolean; - /** Maximum zoom of the map */ - maxZoom?: number; + logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; - /** Minimum zoom of the map */ - minZoom?: number; + /** If set, the map is constrained to the given bounds. */ + maxBounds?: LngLatBoundsLike; - /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */ - preserveDrawingBuffer?: boolean; + /** Maximum zoom of the map */ + maxZoom?: number; - pitch?: number; + /** Minimum zoom of the map */ + minZoom?: number; - refreshExpiredTiles?: boolean; + /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */ + preserveDrawingBuffer?: boolean; - renderWorldCopies?: boolean; + pitch?: number; - /** If true, enable the "scroll to zoom" interaction */ - scrollZoom?: boolean; + refreshExpiredTiles?: boolean; - /** stylesheet location */ - style?: mapboxgl.Style | string; + renderWorldCopies?: boolean; - /** If true, the map will automatically resize when the browser window resizes */ - trackResize?: boolean; + /** If true, enable the "scroll to zoom" interaction */ + scrollZoom?: boolean; - /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */ - touchZoomRotate?: boolean; + /** stylesheet location */ + style?: mapboxgl.Style | string; - /** Initial zoom level */ - zoom?: number; + /** If true, the map will automatically resize when the browser window resizes */ + trackResize?: boolean; - /** Maximum tile cache size for each layer. */ - maxTileCacheSize?: number; - } + /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */ + touchZoomRotate?: boolean; - export interface PaddingOptions { - top: number; - bottom: number; - left: number; - right: number; - } + /** Initial zoom level */ + zoom?: number; - /** - * BoxZoomHandler - */ - export class BoxZoomHandler { - constructor(map: mapboxgl.Map); + /** Maximum tile cache size for each layer. */ + maxTileCacheSize?: number; + } - isEnabled(): boolean; + export interface PaddingOptions { + top: number; + bottom: number; + left: number; + right: number; + } - isActive(): boolean; + /** + * BoxZoomHandler + */ + export class BoxZoomHandler { + constructor(map: mapboxgl.Map); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * ScrollZoomHandler - */ - export class ScrollZoomHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * ScrollZoomHandler + */ + export class ScrollZoomHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * DragPenHandler - */ - export class DragPanHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - isActive(): boolean; + /** + * DragPenHandler + */ + export class DragPanHandler { + constructor(map: mapboxgl.Map); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * DragRotateHandler - */ - export class DragRotateHandler { - constructor(map: mapboxgl.Map, options?: {bearingSnap?: number, pitchWithRotate?: boolean}); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - isActive(): boolean; + /** + * DragRotateHandler + */ + export class DragRotateHandler { + constructor(map: mapboxgl.Map, options?: { bearingSnap?: number, pitchWithRotate?: boolean }); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * KeyboardHandler - */ - export class KeyboardHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * KeyboardHandler + */ + export class KeyboardHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * DoubleClickZoomHandler - */ - export class DoubleClickZoomHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * DoubleClickZoomHandler + */ + export class DoubleClickZoomHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * TouchZoomRotateHandler - */ - export class TouchZoomRotateHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * TouchZoomRotateHandler + */ + export class TouchZoomRotateHandler { + constructor(map: mapboxgl.Map); - disable(): void; + isEnabled(): boolean; - disableRotation(): void; + enable(): void; - enableRotation(): void; - } + disable(): void; - export interface IControl { - onAdd(map: Map): HTMLElement; - onRemove(map: Map): any; - getDefaultPosition(): string; - } + disableRotation(): void; - /** - * Control - */ - export class Control extends Evented { - } + enableRotation(): void; + } - /** - * Navigation - */ - export class NavigationControl extends Control { - constructor(); - } + export interface IControl { + onAdd(map: Map): HTMLElement; - export class PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; - } + onRemove(map: Map): any; - export class FitBoundsOptions { - maxZoom?: number; - } + getDefaultPosition(): string; + } - /** - * Geolocate - */ - export class GeolocateControl extends Control { - constructor(options?: {positionOptions?: PositionOptions, fitBoundsOptions?: FitBoundsOptions, trackUserLocation?: boolean, showUserLocation?: boolean}); - } + /** + * Control + */ + export class Control extends Evented { + } - /** - * Attribution - */ - export class AttributionControl extends Control { - constructor(options?: {compact?: boolean}); - } + /** + * Navigation + */ + export class NavigationControl extends Control { + constructor(); + } - /** - * Scale - */ - export class ScaleControl extends Control { - constructor(options?: {maxWidth?: number, unit?: string}) - } + export class PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; + } - /** - * Fullscreen - */ - export class FullscreenControl extends Control { - constructor(); - } + export class FitBoundsOptions { + maxZoom?: number; + } - /** - * Popup - */ - export class Popup extends Evented { - constructor(options?: mapboxgl.PopupOptions); + /** + * Geolocate + */ + export class GeolocateControl extends Control { + constructor(options?: { positionOptions?: PositionOptions, fitBoundsOptions?: FitBoundsOptions, trackUserLocation?: boolean, showUserLocation?: boolean }); + } - addTo(map: mapboxgl.Map): this; + /** + * Attribution + */ + export class AttributionControl extends Control { + constructor(options?: { compact?: boolean }); + } - isOpen(): boolean; + /** + * Scale + */ + export class ScaleControl extends Control { + constructor(options?: { maxWidth?: number, unit?: string }) + } - remove(): this; + /** + * Fullscreen + */ + export class FullscreenControl extends Control { + constructor(); + } - getLngLat(): mapboxgl.LngLat; + /** + * Popup + */ + export class Popup extends Evented { + constructor(options?: mapboxgl.PopupOptions); - setLngLat(lnglat: LngLatLike): this; + addTo(map: mapboxgl.Map): this; - setText(text: string): this; + isOpen(): boolean; - setHTML(html: string): this; + remove(): this; - setDOMContent(htmlNode: Node): this; - } + getLngLat(): mapboxgl.LngLat; - export interface PopupOptions { - closeButton?: boolean; + setLngLat(lnglat: LngLatLike): this; - closeOnClick?: boolean; + setText(text: string): this; - anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + setHTML(html: string): this; - offset?: number | PointLike | { [key:string]: PointLike;}; - } + setDOMContent(htmlNode: Node): this; + } - export interface Style { - bearing?: number; - center?: number[]; - glyphs?: string; - layers?: Layer[]; - metadata?: any; - name?: string; - pitch?: number; - light?: Light; - sources?: any; - sprite?: string; - transition?: Transition; - version: number; - zoom?: number; - } + export interface PopupOptions { + closeButton?: boolean; - export interface Transition { - delay?: number; - duration?: number; - } + closeOnClick?: boolean; - export interface Light { - "anchor"?: "map" | "viewport"; - "position"?: number[]; - "color"?: string; - "intensity"?: number; - } + anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; - export interface Source { - type: "vector" | "raster" | "geojson" | "image" | "video" | "canvas"; - } + offset?: number | PointLike | { [key: string]: PointLike; }; + } - /** - * GeoJSONSource - */ + export interface Style { + bearing?: number; + center?: number[]; + glyphs?: string; + layers?: Layer[]; + metadata?: any; + name?: string; + pitch?: number; + light?: Light; + sources?: any; + sprite?: string; + transition?: Transition; + version: number; + zoom?: number; + } - export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions { - type: "geojson"; - } + export interface Transition { + delay?: number; + duration?: number; + } - export class GeoJSONSource implements GeoJSONSourceRaw { - type: "geojson"; + export interface Light { + 'anchor'?: 'map' | 'viewport'; + 'position'?: number[]; + 'color'?: string; + 'intensity'?: number; + } - constructor(options?: mapboxgl.GeoJSONSourceOptions); + export interface Source { + type: 'vector' | 'raster' | 'geojson' | 'image' | 'video' | 'canvas'; + } - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; - } + /** + * GeoJSONSource + */ - export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions { + type: 'geojson'; + } - maxzoom?: number; + export class GeoJSONSource implements GeoJSONSourceRaw { + type: 'geojson'; - buffer?: number; + constructor(options?: mapboxgl.GeoJSONSourceOptions); - tolerance?: number; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + } - cluster?: number | boolean; + export interface GeoJSONSourceOptions { + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; - clusterRadius?: number; + maxzoom?: number; - clusterMaxZoom?: number; - } + buffer?: number; - /** - * VideoSource - */ - export interface VideoSource extends VideoSourceOptions { } - export class VideoSource implements Source { - type: "video"; + tolerance?: number; - constructor(options?: mapboxgl.VideoSourceOptions); + cluster?: number | boolean; - getVideo(): HTMLVideoElement; + clusterRadius?: number; - setCoordinates(coordinates: number[][]): this; - } + clusterMaxZoom?: number; + } - export interface VideoSourceOptions { - urls?: string[]; + /** + * VideoSource + */ + export interface VideoSource extends VideoSourceOptions { + } - coordinates?: number[][]; - } + export class VideoSource implements Source { + type: 'video'; - /** - * ImageSource - */ - export interface ImageSource extends ImageSourceOptions { } - export class ImageSource implements Source { - type: "image"; + constructor(options?: mapboxgl.VideoSourceOptions); - constructor(options?: mapboxgl.ImageSourceOptions); + getVideo(): HTMLVideoElement; - setCoordinates(coordinates: number[][]): this; - } + setCoordinates(coordinates: number[][]): this; + } - export interface ImageSourceOptions { - url?: string; + export interface VideoSourceOptions { + urls?: string[]; - coordinates?: number[][]; - } + coordinates?: number[][]; + } - /** - * CanvasSource - */ - export class CanvasSource implements Source, CanvasSourceOptions { - type: "canvas"; + /** + * ImageSource + */ + export interface ImageSource extends ImageSourceOptions { + } - coordinates: number[][]; + export class ImageSource implements Source { + type: 'image'; - canvas: string; + constructor(options?: mapboxgl.ImageSourceOptions); - getCanvas(): HTMLCanvasElement; + setCoordinates(coordinates: number[][]): this; + } - setCoordinates(coordinates: number[][]): this; - } + export interface ImageSourceOptions { + url?: string; - export interface CanvasSourceOptions { - coordinates: number[][]; + coordinates?: number[][]; + } - animate?: boolean; + /** + * CanvasSource + */ + export class CanvasSource implements Source, CanvasSourceOptions { + type: 'canvas'; - canvas: string; - } + coordinates: number[][]; - interface VectorSource extends Source { - type: "vector"; - url?: string; - tiles?: string[]; - minzoom?: number; - maxzoom?: number; - } + canvas: string; - interface RasterSource extends Source { - type: "raster"; - url: string; - tiles?: string[]; - minzoom?: number; - maxzoom?: number; - tileSize?: number; - } + getCanvas(): HTMLCanvasElement; - /** - * LngLat - */ - export class LngLat { - lng: number; - lat: number; + setCoordinates(coordinates: number[][]): this; + } - constructor(lng: number, lat: number); + export interface CanvasSourceOptions { + coordinates: number[][]; - /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ - wrap(): mapboxgl.LngLat; + animate?: boolean; - /** Return a LngLat as an array */ - toArray(): number[]; + canvas: string; + } - /** Return a LngLat as a string */ - toString(): string; + interface VectorSource extends Source { + type: 'vector'; + url?: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + } - toBounds(radius: number): LngLatBounds; + interface RasterSource extends Source { + type: 'raster'; + url: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + tileSize?: number; + } - static convert(input: LngLatLike): mapboxgl.LngLat; - } + /** + * LngLat + */ + export class LngLat { + lng: number; + lat: number; - /** - * LngLatBounds - */ - export class LngLatBounds { - sw: LngLatLike; - ne: LngLatLike; - constructor(sw?: LngLatLike, ne?: LngLatLike); + constructor(lng: number, lat: number); - setNorthEast(ne: LngLatLike): this; + /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ + wrap(): mapboxgl.LngLat; - setSouthWest(sw: LngLatLike): this; + /** Return a LngLat as an array */ + toArray(): number[]; - /** Extend the bounds to include a given LngLat or LngLatBounds. */ - extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this; + /** Return a LngLat as a string */ + toString(): string; - /** Get the point equidistant from this box's corners */ - getCenter(): mapboxgl.LngLat; + toBounds(radius: number): LngLatBounds; - /** Get southwest corner */ - getSouthWest(): mapboxgl.LngLat; + static convert(input: LngLatLike): mapboxgl.LngLat; + } - /** Get northeast corner */ - getNorthEast(): mapboxgl.LngLat; + /** + * LngLatBounds + */ + export class LngLatBounds { + sw: LngLatLike; + ne: LngLatLike; - /** Get northwest corner */ - getNorthWest(): mapboxgl.LngLat; + constructor(sw?: LngLatLike, ne?: LngLatLike); - /** Get southeast corner */ - getSouthEast(): mapboxgl.LngLat; + setNorthEast(ne: LngLatLike): this; - /** Get west edge longitude */ - getWest(): number; + setSouthWest(sw: LngLatLike): this; - /** Get south edge latitude */ - getSouth(): number; + /** Extend the bounds to include a given LngLat or LngLatBounds. */ + extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this; - /** Get east edge longitude */ - getEast(): number; + /** Get the point equidistant from this box's corners */ + getCenter(): mapboxgl.LngLat; - /** Get north edge latitude */ - getNorth(): number; + /** Get southwest corner */ + getSouthWest(): mapboxgl.LngLat; - /** Returns a LngLatBounds as an array */ - toArray(): number[][]; + /** Get northeast corner */ + getNorthEast(): mapboxgl.LngLat; - /** Return a LngLatBounds as a string */ - toString(): string; + /** Get northwest corner */ + getNorthWest(): mapboxgl.LngLat; - /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ - static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds; - } + /** Get southeast corner */ + getSouthEast(): mapboxgl.LngLat; - /** - * Point - */ - // Todo: Pull out class to seperate definition for Module "point-geometry" - export class Point { - x: number; - y: number; + /** Get west edge longitude */ + getWest(): number; - constructor(x: number, y: number); + /** Get south edge latitude */ + getSouth(): number; - clone(): Point; + /** Get east edge longitude */ + getEast(): number; - add(p: number): Point; + /** Get north edge latitude */ + getNorth(): number; - sub(p: number): Point; + /** Returns a LngLatBounds as an array */ + toArray(): number[][]; - mult(k: number): Point; + /** Return a LngLatBounds as a string */ + toString(): string; - div(k: number): Point; + /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ + static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds; + } - rotate(a: number): Point; + /** + * Point + */ + // Todo: Pull out class to seperate definition for Module "point-geometry" + export class Point { + x: number; + y: number; - matMult(m: number): Point; + constructor(x: number, y: number); - unit(): Point; + clone(): Point; - perp(): Point; + add(p: number): Point; - round(): Point; + sub(p: number): Point; - mag(): number; + mult(k: number): Point; - equals(p: Point): boolean; + div(k: number): Point; - dist(p: Point): number; + rotate(a: number): Point; - distSqr(p: Point): number; + matMult(m: number): Point; - angle(): number; + unit(): Point; - angleTo(p: Point): number; + perp(): Point; - angleWidth(p: Point): number; + round(): Point; - angleWithSep(x: number, y: number): number; + mag(): number; - static convert(a: PointLike): Point; - } + equals(p: Point): boolean; - export class Marker { - constructor(element?: HTMLElement, options?: { offset?: PointLike }); + dist(p: Point): number; - addTo(map: Map): this; + distSqr(p: Point): number; - remove(): this; + angle(): number; - getLngLat(): LngLat; + angleTo(p: Point): number; - setLngLat(lngLat: LngLatLike): this; + angleWidth(p: Point): number; - setPopup(popup?: Popup): this; + angleWithSep(x: number, y: number): number; - getPopup(): Popup; + static convert(a: PointLike): Point; + } - togglePopup(): this; - } + export class Marker { + constructor(element?: HTMLElement, options?: { offset?: PointLike }); - /** - * Evented - */ - export class Evented { - on(type: string, listener: Function): this; + addTo(map: Map): this; - on(type: string, layer: string, listener: Function): this; + remove(): this; - off(type?: string | any, listener?: Function): this; + getLngLat(): LngLat; - off(type?: string | any, layer?: string, listener?: Function): this; + setLngLat(lngLat: LngLatLike): this; - once(type: string, listener: Function): this; + setPopup(popup?: Popup): this; - fire(type: string, data?: mapboxgl.EventData | Object): this; + getPopup(): Popup; - listens(type: string): boolean; - } + togglePopup(): this; + } - /** - * StyleOptions - */ - export interface StyleOptions { - transition?: boolean; - } - - /** - * EventData - */ - export class EventData { - type: string; - target: Map; - originalEvent: Event; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - } - - export class MapMouseEvent { - type: string; - target: Map; - originalEvent: MouseEvent; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - } - - export class MapTouchEvent { - type: string; - target: Map; - originalEvent: TouchEvent; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - points: Point[]; - lngLats: LngLat[]; - } - - export class MapBoxZoomEvent { - originalEvent: MouseEvent; - boxZoomBounds: LngLatBounds; - } - - export class MapDataEvent { - type: string; - dataType: "source" | "style" | "tile"; - isSourceLoaded?: boolean; - source?: mapboxgl.Source; - coord?: any; - } - - /** - * AnimationOptions - */ - export interface AnimationOptions { - /** Number in milliseconds */ - duration?: number; - easing?: Function; - /** point, origin of movement relative to map center */ - offset?: PointLike; - /** When set to false, no animation happens */ - animate?: boolean; - } - - /** - * CameraOptions - */ - export interface CameraOptions { - /** Map center */ - center?: LngLatLike; - /** Map zoom level */ - zoom?: number; - /** Map rotation bearing in degrees counter-clockwise from north */ - bearing?: number; - /** Map angle in degrees at which the camera is looking at the ground */ - pitch?: number; - /** If zooming, the zoom center (defaults to map center) */ - around?: LngLatLike; - } - - /** - * FlyToOptions - */ - export interface FlyToOptions extends AnimationOptions, CameraOptions { - curve?: number; - minZoom?: number; - speed?: number; - screenSpeed?: number; - easing?: Function; - } - - /** - * MapEvent - */ - export interface MapEvent { - resize?: void; - webglcontextlost?: {originalEvent: WebGLContextEvent}; - webglcontextrestored?: {originalEvent: WebGLContextEvent}; - remove?: void; - dataloading?: {data: mapboxgl.MapDataEvent}; - data?: {data: mapboxgl.MapDataEvent}; - render?: void; - contextmenu?: {data: mapboxgl.MapMouseEvent}; - dblclick?: {data: mapboxgl.MapMouseEvent}; - click?: {data: mapboxgl.MapMouseEvent}; - tiledataloading?: {data: mapboxgl.MapDataEvent}; - sourcedataloading?: {data: mapboxgl.MapDataEvent}; - styledataloading?: {data: mapboxgl.MapDataEvent}; - touchcancel?: {data: mapboxgl.MapTouchEvent}; - touchmove?: {data: mapboxgl.MapTouchEvent}; - touchend?: {data: mapboxgl.MapTouchEvent}; - touchstart?: {data: mapboxgl.MapTouchEvent}; - mousemove?: {data: mapboxgl.MapMouseEvent}; - mouseup?: {data: mapboxgl.MapMouseEvent}; - mousedown?: {data: mapboxgl.MapMouseEvent}; - moveend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - move?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - movestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - mouseout?:{data: mapboxgl.MapMouseEvent}; - load?: void; - sourcedata?: {data: mapboxgl.MapDataEvent}; - styledata?: {data: mapboxgl.MapDataEvent}; - zoomend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - zoom?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - zoomstart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - boxzoomcancel?: {data: mapboxgl.MapBoxZoomEvent}; - boxzoomstart?: {data: mapboxgl.MapBoxZoomEvent}; - boxzoomend?: {data: mapboxgl.MapBoxZoomEvent}; - rotate?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - rotatestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - rotateend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - drag?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - dragend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - pitch?: {data: mapboxgl.EventData}; - } - - export interface Layer { - id: string; - type?: "fill" | "line" | "symbol" | "circle" | "fill-extrusion" | "raster" | "background" | "heatmap"; - - metadata?: any; - ref?: string; - - source?: string | VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw; - - "source-layer"?: string; - - minzoom?: number; - maxzoom?: number; - - interactive?: boolean; - - filter?: any[]; - layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout; - paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint; - } - - export interface StyleFunction { - stops?: any[][]; - property?: string; - base?: number; - type?: "identity" | "exponential" | "interval" | "categorical"; - default?: any; - "colorSpace"?: "rgb" | "lab" | "interval"; - } - - export interface BackgroundLayout { - visibility?: "visible" | "none"; - } - export interface BackgroundPaint { - "background-color"?: string; - "background-pattern"?: string; - "background-opacity"?: number; - } - - export interface FillLayout { - visibility?: "visible" | "none"; - } - export interface FillPaint { - "fill-antialias"?: boolean; - "fill-opacity"?: number | StyleFunction; - "fill-color"?: string | StyleFunction; - "fill-outline-color"?: string | StyleFunction; - "fill-translate"?: number[]; - "fill-translate-anchor"?: "map" | "viewport"; - "fill-pattern"?: "string"; - } - - export interface FillExtrusionLayout { - visibility?: "visible" | "none"; - } - export interface FillExtrusionPaint { - "fill-extrusion-opacity"?: number; - "fill-extrusion-color"?: string | StyleFunction; - "fill-extrusion-translate"?: number[]; - "fill-extrusion-translate-anchor"?: "map" | "viewport"; - "fill-extrusion-pattern"?: string; - "fill-extrusion-height"?: number | StyleFunction; - "fill-extrusion-base"?: number | StyleFunction; - } - - export interface LineLayout { - visibility?: "visible" | "none"; - - "line-cap"?: "butt" | "round" | "square"; - "line-join"?: "bevel" | "round" | "miter"; - "line-miter-limit"?: number; - "line-round-limit"?: number; - } - export interface LinePaint { - "line-opacity"?: number | StyleFunction; - "line-color"?: string | StyleFunction; - "line-translate"?: number[]; - "line-translate-anchor"?: "map" | "viewport"; - "line-width"?: number | StyleFunction; - "line-gap-width"?: number | StyleFunction; - "line-offset"?: number | StyleFunction; - "line-blur"?: number | StyleFunction; - "line-dasharray"?: number[]; - "line-dasharray-transition"?: Transition; - "line-pattern"?: string; - } - - export interface SymbolLayout { - visibility?: "visible" | "none"; - - "symbol-placement"?: "point" | "line"; - "symbol-spacing"?: number; - "symbol-avoid-edges"?: boolean; - "icon-allow-overlap"?: boolean; - "icon-ignore-placement"?: boolean; - "icon-optional"?: boolean; - "icon-rotation-alignment"?: "map" | "viewport" | "auto"; - "icon-pitch-alignment"?: "map" | "viewport"| "auto"; - "icon-size"?: number | StyleFunction; - "icon-text-fit"?: "none" | "both" | "width" | "height"; - "icon-text-fit-padding"?: number[]; - "icon-image"?: string | StyleFunction; - "icon-rotate"?: number | StyleFunction; - "icon-padding"?: number; - "icon-keep-upright"?: boolean; - "icon-offset"?: number[] | StyleFunction; - "text-pitch-alignment"?: "map" | "viewport" | "auto"; - "text-rotation-alignment"?: "map" | "viewport" | "auto"; - "text-field"?: string | StyleFunction; - "text-font"?: string | string[]; - "text-size"?: number | StyleFunction; - "text-max-width"?: number; - "text-line-height"?: number; - "text-letter-spacing"?: number; - "text-justify"?: "left" | "center" | "right"; - "text-anchor"?: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right"; - "text-max-angle"?: number; - "text-rotate"?: number | StyleFunction; - "text-padding"?: number; - "text-keep-upright"?: boolean; - "text-transform"?: "none" | "uppercase" | "lowercase" | StyleFunction; - "text-offset"?: number[]; - "text-allow-overlap"?: boolean; - "text-ignore-placement"?: boolean; - "text-optional"?: boolean; - - } - export interface SymbolPaint { - "icon-opacity"?: number | StyleFunction; - "icon-color"?: string | StyleFunction; - "icon-halo-color"?: string | StyleFunction; - "icon-halo-width"?: number | StyleFunction; - "icon-halo-blur"?: number | StyleFunction; - "icon-translate"?: number[]; - "icon-translate-anchor"?: "map" | "viewport"; - "text-opacity"?: number | StyleFunction; - "text-color"?: string | StyleFunction; - "text-halo-color"?: string | StyleFunction; - "text-halo-width"?: number | StyleFunction; - "text-halo-blur"?: number | StyleFunction; - "text-translate"?: number[]; - "text-translate-anchor"?: "map" | "viewport"; - } - - export interface RasterLayout { - visibility?: "visible" | "none"; - } - - export interface RasterPaint { - "raster-opacity"?: number; - "raster-hue-rotate"?: number; - "raster-brightness-min"?: number; - "raster-brightness-max"?: number; - "raster-saturation"?: number; - "raster-contrast"?: number; - "raster-fade-duration"?: number; - } - - export interface CircleLayout { - visibility?: "visible" | "none"; - } - - export interface CirclePaint { - "circle-radius"?: number | StyleFunction; - "circle-radius-transition"?: Transition; - "circle-color"?: string | StyleFunction; - "circle-blur"?: number | StyleFunction; - "circle-opacity"?: number | StyleFunction; - "circle-translate"?: number[]; - "circle-translate-anchor"?: "map" | "viewport"; - "circle-pitch-scale"?: "map" | "viewport"; - "circle-pitch-alignment"?: "map" | "viewport"; - "circle-stroke-width"?: number | StyleFunction; - "circle-stroke-color"?: string | StyleFunction; - "circle-stroke-opacity"?: number | StyleFunction; - } + /** + * Evented + */ + export class Evented { + on(type: string, listener: Function): this; + + on(type: string, layer: string, listener: Function): this; + + off(type?: string | any, listener?: Function): this; + + off(type?: string | any, layer?: string, listener?: Function): this; + + once(type: string, listener: Function): this; + + fire(type: string, data?: mapboxgl.EventData | Object): this; + + listens(type: string): boolean; + } + + /** + * StyleOptions + */ + export interface StyleOptions { + transition?: boolean; + } + + /** + * EventData + */ + export class EventData { + type: string; + target: Map; + originalEvent: Event; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapMouseEvent { + type: string; + target: Map; + originalEvent: MouseEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapTouchEvent { + type: string; + target: Map; + originalEvent: TouchEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + points: Point[]; + lngLats: LngLat[]; + } + + export class MapBoxZoomEvent { + originalEvent: MouseEvent; + boxZoomBounds: LngLatBounds; + } + + export class MapDataEvent { + type: string; + dataType: 'source' | 'style' | 'tile'; + isSourceLoaded?: boolean; + source?: mapboxgl.Source; + coord?: any; + } + + /** + * AnimationOptions + */ + export interface AnimationOptions { + /** Number in milliseconds */ + duration?: number; + easing?: Function; + /** point, origin of movement relative to map center */ + offset?: PointLike; + /** When set to false, no animation happens */ + animate?: boolean; + } + + /** + * CameraOptions + */ + export interface CameraOptions { + /** Map center */ + center?: LngLatLike; + /** Map zoom level */ + zoom?: number; + /** Map rotation bearing in degrees counter-clockwise from north */ + bearing?: number; + /** Map angle in degrees at which the camera is looking at the ground */ + pitch?: number; + /** If zooming, the zoom center (defaults to map center) */ + around?: LngLatLike; + } + + /** + * FlyToOptions + */ + export interface FlyToOptions extends AnimationOptions, CameraOptions { + curve?: number; + minZoom?: number; + speed?: number; + screenSpeed?: number; + easing?: Function; + } + + /** + * MapEvent + */ + export interface MapEvent { + resize?: void; + webglcontextlost?: { originalEvent: WebGLContextEvent }; + webglcontextrestored?: { originalEvent: WebGLContextEvent }; + remove?: void; + dataloading?: { data: mapboxgl.MapDataEvent }; + data?: { data: mapboxgl.MapDataEvent }; + render?: void; + contextmenu?: { data: mapboxgl.MapMouseEvent }; + dblclick?: { data: mapboxgl.MapMouseEvent }; + click?: { data: mapboxgl.MapMouseEvent }; + tiledataloading?: { data: mapboxgl.MapDataEvent }; + sourcedataloading?: { data: mapboxgl.MapDataEvent }; + styledataloading?: { data: mapboxgl.MapDataEvent }; + touchcancel?: { data: mapboxgl.MapTouchEvent }; + touchmove?: { data: mapboxgl.MapTouchEvent }; + touchend?: { data: mapboxgl.MapTouchEvent }; + touchstart?: { data: mapboxgl.MapTouchEvent }; + mousemove?: { data: mapboxgl.MapMouseEvent }; + mouseup?: { data: mapboxgl.MapMouseEvent }; + mousedown?: { data: mapboxgl.MapMouseEvent }; + moveend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + move?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + movestart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + mouseout?: { data: mapboxgl.MapMouseEvent }; + load?: void; + sourcedata?: { data: mapboxgl.MapDataEvent }; + styledata?: { data: mapboxgl.MapDataEvent }; + zoomend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + zoom?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + zoomstart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + boxzoomcancel?: { data: mapboxgl.MapBoxZoomEvent }; + boxzoomstart?: { data: mapboxgl.MapBoxZoomEvent }; + boxzoomend?: { data: mapboxgl.MapBoxZoomEvent }; + rotate?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + rotatestart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + rotateend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + drag?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + dragend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + pitch?: { data: mapboxgl.EventData }; + } + + export interface Layer { + id: string; + type?: 'fill' | 'line' | 'symbol' | 'circle' | 'fill-extrusion' | 'raster' | 'background' | 'heatmap'; + + metadata?: any; + ref?: string; + + source?: string | VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw; + + 'source-layer'?: string; + + minzoom?: number; + maxzoom?: number; + + interactive?: boolean; + + filter?: any[]; + layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout | HeatmapLayout; + paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint; + } + + export interface StyleFunction { + stops?: any[][]; + property?: string; + base?: number; + type?: 'identity' | 'exponential' | 'interval' | 'categorical'; + default?: any; + 'colorSpace'?: 'rgb' | 'lab' | 'interval'; + } + + export interface BackgroundLayout { + visibility?: 'visible' | 'none'; + } + + export interface BackgroundPaint { + 'background-color'?: string | Expression; + 'background-pattern'?: string; + 'background-opacity'?: number | Expression; + } + + export interface FillLayout { + visibility?: 'visible' | 'none'; + } + + export interface FillPaint { + 'fill-antialias'?: boolean; + 'fill-opacity'?: number | StyleFunction | Expression; + 'fill-color'?: string | StyleFunction | Expression; + 'fill-outline-color'?: string | StyleFunction | Expression; + 'fill-translate'?: number[] | Expression; + 'fill-translate-anchor'?: 'map' | 'viewport'; + 'fill-pattern'?: string; + } + + export interface FillExtrusionLayout { + visibility?: 'visible' | 'none'; + } + + export interface FillExtrusionPaint { + 'fill-extrusion-opacity'?: number | Expression; + 'fill-extrusion-color'?: string | StyleFunction | Expression; + 'fill-extrusion-translate'?: number[] | Expression; + 'fill-extrusion-translate-anchor'?: 'map' | 'viewport'; + 'fill-extrusion-pattern'?: string; + 'fill-extrusion-height'?: number | StyleFunction | Expression; + 'fill-extrusion-base'?: number | StyleFunction | Expression; + } + + export interface LineLayout { + visibility?: 'visible' | 'none'; + + 'line-cap'?: 'butt' | 'round' | 'square'; + 'line-join'?: 'bevel' | 'round' | 'miter'; + 'line-miter-limit'?: number | Expression; + 'line-round-limit'?: number | Expression; + } + + export interface LinePaint { + 'line-opacity'?: number | StyleFunction | Expression; + 'line-color'?: string | StyleFunction | Expression; + 'line-translate'?: number[] | Expression; + 'line-translate-anchor'?: 'map' | 'viewport'; + 'line-width'?: number | StyleFunction | Expression; + 'line-gap-width'?: number | StyleFunction | Expression; + 'line-offset'?: number | StyleFunction | Expression; + 'line-blur'?: number | StyleFunction | Expression; + 'line-dasharray'?: number[]; + 'line-dasharray-transition'?: Transition; + 'line-pattern'?: string; + } + + export interface SymbolLayout { + visibility?: 'visible' | 'none'; + + 'symbol-placement'?: 'point' | 'line'; + 'symbol-spacing'?: number | Expression; + 'symbol-avoid-edges'?: boolean; + 'icon-allow-overlap'?: boolean; + 'icon-ignore-placement'?: boolean; + 'icon-optional'?: boolean; + 'icon-rotation-alignment'?: 'map' | 'viewport' | 'auto'; + 'icon-pitch-alignment'?: 'map' | 'viewport' | 'auto'; + 'icon-size'?: number | StyleFunction | Expression; + 'icon-text-fit'?: 'none' | 'both' | 'width' | 'height'; + 'icon-text-fit-padding'?: number[] | Expression; + 'icon-image'?: string | StyleFunction; + 'icon-rotate'?: number | StyleFunction | Expression; + 'icon-padding'?: number | Expression; + 'icon-keep-upright'?: boolean; + 'icon-offset'?: number[] | StyleFunction | Expression; + 'text-pitch-alignment'?: 'map' | 'viewport' | 'auto'; + 'text-rotation-alignment'?: 'map' | 'viewport' | 'auto'; + 'text-field'?: string | StyleFunction; + 'text-font'?: string | string[]; + 'text-size'?: number | StyleFunction | Expression; + 'text-max-width'?: number | Expression; + 'text-line-height'?: number | Expression; + 'text-letter-spacing'?: number | Expression; + 'text-justify'?: 'left' | 'center' | 'right'; + 'text-anchor'?: 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + 'text-max-angle'?: number | Expression; + 'text-rotate'?: number | StyleFunction | Expression; + 'text-padding'?: number | Expression; + 'text-keep-upright'?: boolean; + 'text-transform'?: 'none' | 'uppercase' | 'lowercase' | StyleFunction | Expression; + 'text-offset'?: number[] | Expression; + 'text-allow-overlap'?: boolean; + 'text-ignore-placement'?: boolean; + 'text-optional'?: boolean; + + } + + export interface SymbolPaint { + 'icon-opacity'?: number | StyleFunction | Expression; + 'icon-color'?: string | StyleFunction | Expression; + 'icon-halo-color'?: string | StyleFunction | Expression; + 'icon-halo-width'?: number | StyleFunction | Expression; + 'icon-halo-blur'?: number | StyleFunction | Expression; + 'icon-translate'?: number[] | Expression; + 'icon-translate-anchor'?: 'map' | 'viewport'; + 'text-opacity'?: number | StyleFunction | Expression; + 'text-color'?: string | StyleFunction | Expression; + 'text-halo-color'?: string | StyleFunction | Expression; + 'text-halo-width'?: number | StyleFunction | Expression; + 'text-halo-blur'?: number | StyleFunction | Expression; + 'text-translate'?: number[] | Expression; + 'text-translate-anchor'?: 'map' | 'viewport'; + } + + export interface RasterLayout { + visibility?: 'visible' | 'none'; + } + + export interface RasterPaint { + 'raster-opacity'?: number | Expression; + 'raster-hue-rotate'?: number | Expression; + 'raster-brightness-min'?: number | Expression; + 'raster-brightness-max'?: number | Expression; + 'raster-saturation'?: number | Expression; + 'raster-contrast'?: number | Expression; + 'raster-fade-duration'?: number | Expression; + } + + export interface CircleLayout { + visibility?: 'visible' | 'none'; + } + + export interface CirclePaint { + 'circle-radius'?: number | StyleFunction | Expression; + 'circle-radius-transition'?: Transition; + 'circle-color'?: string | StyleFunction | Expression; + 'circle-blur'?: number | StyleFunction | Expression; + 'circle-opacity'?: number | StyleFunction | Expression; + 'circle-translate'?: number[] | Expression; + 'circle-translate-anchor'?: 'map' | 'viewport'; + 'circle-pitch-scale'?: 'map' | 'viewport'; + 'circle-pitch-alignment'?: 'map' | 'viewport'; + 'circle-stroke-width'?: number | StyleFunction | Expression; + 'circle-stroke-color'?: string | StyleFunction | Expression; + 'circle-stroke-opacity'?: number | StyleFunction | Expression; + } + + export interface HeatmapLayout { + visibility?: 'visible' | 'none'; + } + + export interface HeatmapPaint { + 'heatmap-radius'?: number | Expression; + 'heatmap-transition'?: Transition; + 'heatmap-weight'?: number | StyleFunction | Expression; + 'heatmap-intensity'?: number | Expression; + 'heatmap-color'?: string | Expression; + 'heatmap-color-transition'?: Transition; + 'heatmap-opacity'?: number | Expression; + 'heatmap-opacity-transition'?: Transition; + } } declare module 'mapbox-gl' { - export = mapboxgl; + export = mapboxgl; } declare module 'mapbox-gl/dist/mapbox-gl' { - export = mapboxgl; + export = mapboxgl; }