Socket
Socket
Sign inDemoInstall

@types/mapbox-gl

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/mapbox-gl - npm Package Compare versions

Comparing version 0.48.0 to 0.49.0

430

mapbox-gl/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for Mapbox GL JS v0.48.0
// Type definitions for Mapbox GL JS v0.49.0
// Project: https://github.com/mapbox/mapbox-gl-js

@@ -18,7 +18,7 @@ // Definitions by: Dominik Bruderer <https://github.com/dobrud>, Patrick Reames <https://github.com/patrickr>

export function setRTLTextPlugin(pluginURL: string, callback: Function): void;
export function setRTLTextPlugin(pluginURL: string, callback: (error: Error) => void): void;
type LngLatLike = number[] | LngLat;
type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds;
type PointLike = number[] | Point;
type LngLatLike = LngLat | { lng: number; lat: number; } | [number, number];
type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];
type PointLike = Point | [number, number];
type Expression = any[];

@@ -41,3 +41,3 @@ type Anchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

getMaxBounds(): LngLatBounds;
getMaxBounds(): LngLatBounds | null;

@@ -68,5 +68,5 @@ setMaxBounds(lnglatbounds?: LngLatBoundsLike): this;

queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature<GeoJSON.Geometry>[];
queryRenderedFeatures(pointOrBox?: PointLike | [PointLike, PointLike], parameters?: { layers?: string[], filter?: any[] }): MapboxGeoJSONFeature[];
querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature<GeoJSON.Geometry>[];
querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): MapboxGeoJSONFeature[];

@@ -89,3 +89,3 @@ setStyle(style: mapboxgl.Style | string, options?: { diff?: boolean, localIdeographFontFamily?: string }): this;

addImage(name: string, image: HTMLImageElement | ArrayBufferView | { width: number, height: number, data: Uint8Array | Uint8ClampedArray } | ImageData, options?: { pixelRatio?: number, sdf?: any }): this;
addImage(name: string, image: HTMLImageElement | ArrayBufferView | { width: number, height: number, data: Uint8Array | Uint8ClampedArray } | ImageData, options?: { pixelRatio?: number, sdf?: boolean }): this;

@@ -116,7 +116,7 @@ hasImage(name: string): boolean;

getPaintProperty(layer: string, name: string, klass?: string): any;
getPaintProperty(layer: string, name: string): any;
setLayoutProperty(layer: string, name: string, value: any): this;
getLayoutProperty(layer: string, name: string, klass?: string): any;
getLayoutProperty(layer: string, name: string): any;

@@ -127,5 +127,5 @@ setLight(options: mapboxgl.Light, lightOptions?: any): this;

setFeatureState(feature: {source?: string, sourceLayer?: string, id?: string}, state: any): void;
setFeatureState(feature: { source: string, sourceLayer?: string, id: string | number } | mapboxgl.MapboxGeoJSONFeature, state: { [key: string]: any }): void;
getFeatureState(feature: {source?: string, sourceLayer?: string, id?: string}): any;
getFeatureState(feature: { source: string, sourceLayer?: string, id: string | number } | mapboxgl.MapboxGeoJSONFeature): { [key: string]: any };

@@ -142,4 +142,2 @@ getContainer(): HTMLElement;

onError(): void;
showTileBoundaries: boolean;

@@ -183,16 +181,30 @@

cameraForBounds(bounds: LngLatBoundsLike, options?: {padding?: number | PaddingOptions, offset?: PointLike, maxZoom?: number}): CameraOptions;
cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CameraOptions | undefined;
fitBounds(bounds: LngLatBoundsLike, options?: mapboxgl.FitBoundsOptions, eventData?: mapboxgl.EventData): this;
fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: AnimationOptions & CameraOptions, eventData?: EventData): this;
jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this;
easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
easeTo(options: mapboxgl.CameraOptions & mapboxgl.AnimationOptions & {delayEndEvents?: number}, eventData?: mapboxgl.EventData): this;
flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this;
isMoving(): boolean;
isEasing(): boolean;
stop(): this;
on<T extends keyof MapLayerEventType>(type: T, layer: string, listener: (ev: MapLayerEventType[T] & EventData) => void): this;
on<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
on(type: string, listener: (ev: any) => void): this;
once<T extends keyof MapLayerEventType>(type: T, layer: string, listener: (ev: MapLayerEventType[T] & EventData) => void): this;
once<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
once(type: string, listener: (ev: any) => void): this;
off<T extends keyof MapLayerEventType>(type: T, layer: string, listener: (ev: MapLayerEventType[T] & EventData) => void): this;
off<T extends keyof MapEventType>(type: T, listener: (ev: MapEventType[T] & EventData) => void): this;
off(type: string, listener: (ev: any) => void): this;
scrollZoom: ScrollZoomHandler;

@@ -228,10 +240,30 @@

/**
* The max number of pixels a user can shift the mouse pointer during a click for it to be
* considered a valid click (as opposed to a mouse drag).
*
* @default 3
*/
clickTolerance?: number;
/**
* If `true`, Resource Timing API information will be collected for requests made by GeoJSON
* and Vector Tile web workers (this information is normally inaccessible from the main
* Javascript thread). Information will be returned in a `resourceTiming` property of
* relevant `data` events.
*
* @default false
*/
collectResourceTiming?: boolean;
/**
* If `true`, symbols from multiple sources can collide with each other during collision
* detection. If `false`, collision detection is run separately for the symbols in each source.
*
* @default true
*/
crossSourceCollisions?: boolean;
/** ID of the container element */
container?: string | Element;
container: string | Element;

@@ -254,2 +286,9 @@ /** String or strings to show in an AttributionControl.

/**
* Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds.
* This setting affects all symbol layers. This setting does not affect the duration of runtime
* styling transitions or raster tile cross-fading.
*
* @default 300
*/
fadeDuration?: number;

@@ -266,4 +305,17 @@

/**
* If specified, defines a CSS font-family for locally overriding generation of glyphs in the
* 'CJK Unified Ideographs' and 'Hangul Syllables' ranges. In these ranges, font settings from
* the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).
* The purpose of this option is to avoid bandwidth-intensive glyph server requests.
*
* @default null
*/
localIdeographFontFamily?: string;
/**
* A string representing the position of the Mapbox wordmark on the map.
*
* @default "bottom-left"
*/
logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

@@ -283,8 +335,30 @@

/**
* The initial pitch (tilt) of the map, measured in degrees away from the plane of the
* screen (0-60).
*
* @default 0
*/
pitch?: number;
/**
* If `false`, the map's pitch (tilt) control with "drag to rotate" interaction will be disabled.
*
* @default true
*/
pitchWithRotate?: boolean;
/**
* If `false`, the map won't attempt to re-request tiles once they expire per their HTTP
* `cacheControl`/`expires` headers.
*
* @default true
*/
refreshExpiredTiles?: boolean;
/**
* If `true`, multiple copies of the world will be rendered, when zoomed out.
*
* @default true
*/
renderWorldCopies?: boolean;

@@ -301,3 +375,9 @@

transformRequest?: Function;
/**
* A callback run before the Map makes a request for an external URL. The callback can be
* used to modify the url, set headers, or set the credentials property for cross-origin requests.
*
* @default null
*/
transformRequest?: TransformRequestFunction;

@@ -310,6 +390,44 @@ /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */

/** Maximum tile cache size for each layer. */
/**
* The maximum number of tiles stored in the tile cache for a given source. If omitted, the
* cache will be dynamically sized based on the current viewport.
*
* @default null
*/
maxTileCacheSize?: number;
}
export type ResourceType =
| 'Unknown'
| 'Style'
| 'Source'
| 'Tile'
| 'Glyphs'
| 'SpriteImage'
| 'SpriteJSON'
| 'Image';
export interface RequestParameters {
/**
* The URL to be requested.
*/
url: string;
/**
* Use `'include'` to send cookies with cross-origin requests.
*/
credentials?: 'same-origin' | 'include';
/**
* The headers to be sent with the request.
*/
headers?: { [header: string]: any };
method?: 'GET' | 'POST' | 'PUT';
collectResourceTiming?: boolean;
}
export type TransformRequestFunction = (url: string, resourceType: ResourceType) => RequestParameters;
export interface PaddingOptions {

@@ -428,3 +546,3 @@ top: number;

getDefaultPosition(): string;
getDefaultPosition?: () => string;
}

@@ -728,3 +846,4 @@

constructor(sw?: LngLatLike, ne?: LngLatLike);
constructor(boundsLike?: [LngLatLike, LngLatLike] | [number, number, number, number]);
constructor(sw: LngLatLike, ne: LngLatLike);

@@ -878,9 +997,8 @@ setNorthEast(ne: LngLatLike): 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;
once(type: string, listener: Function): this;
// https://github.com/mapbox/mapbox-gl-js/issues/6522
fire(type: string, properties?: { [key: string]: any }): this;
}

@@ -895,19 +1013,32 @@

/**
* EventData
*/
export class EventData {
export type MapboxGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
layer: Layer;
source: string;
sourceLayer: string;
state: { [key: string]: any };
};
export type EventData = { [key: string]: any };
export class MapboxEvent<TOrig = undefined> {
type: string;
target: Map;
originalEvent: Event;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
originalEvent: TOrig;
}
export class MapMouseEvent {
type: string;
target: Map;
originalEvent: MouseEvent;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
export class MapMouseEvent extends MapboxEvent<MouseEvent> {
type: 'mousedown'
| 'mouseup'
| 'click'
| 'dblclick'
| 'mousemove'
| 'mouseover'
| 'mouseenter'
| 'mouseleave'
| 'mouseout'
| 'contextmenu';
point: Point;
lngLat: LngLat;
preventDefault(): void;

@@ -917,11 +1048,14 @@ defaultPrevented: boolean;

export class MapTouchEvent {
type: string;
target: Map;
map: Map;
originalEvent: TouchEvent;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
export type MapLayerMouseEvent = MapMouseEvent & { features?: MapboxGeoJSONFeature[]; };
export class MapTouchEvent extends MapboxEvent<TouchEvent> {
type: 'touchstart'
| 'touchend'
| 'touchcancel';
point: Point;
lngLat: LngLat;
points: Point[];
lngLats: LngLat[];
preventDefault(): void;

@@ -931,25 +1065,58 @@ defaultPrevented: boolean;

export class MapBoxZoomEvent {
originalEvent: MouseEvent;
export type MapLayerTouchEvent = MapTouchEvent & { features?: MapboxGeoJSONFeature[]; };
export class MapWheelEvent extends MapboxEvent<WheelEvent> {
type: 'wheel';
preventDefault(): void;
defaultPrevented: boolean;
}
export interface MapBoxZoomEvent extends MapboxEvent<MouseEvent> {
type: 'boxzoomstart'
| 'boxzoomend'
| 'boxzoomcancel';
boxZoomBounds: LngLatBounds;
}
export class MapDataEvent {
type: string;
dataType: 'source' | 'style' | 'tile';
isSourceLoaded?: boolean;
source?: mapboxgl.Source;
sourceDataType?: string;
tile?: any;
coord?: any;
export type MapDataEvent = MapSourceDataEvent | MapStyleDataEvent;
export interface MapStyleDataEvent extends MapboxEvent {
dataType: 'style';
}
export class MapWheelEvent {
type: string;
map: Map;
originalEvent: MouseEvent;
preventDefault(): void;
defaultPrevented: boolean;
export interface MapSourceDataEvent extends MapboxEvent {
dataType: 'source';
isSourceLoaded: boolean;
source: Style;
sourceId: string;
sourceDataType: 'metadata' | 'content';
tile: any;
coord: Coordinate;
}
export interface Coordinate {
canonical: CanonicalCoordinate;
wrap: number;
key: number;
}
export interface CanonicalCoordinate {
x: number;
y: number;
z: number;
key: number;
equals(coord: CanonicalCoordinate): boolean;
}
export interface MapContextEvent extends MapboxEvent<WebGLContextEvent> {
type: 'webglcontextlost' | 'webglcontextrestored';
}
export class ErrorEvent extends MapboxEvent {
type: 'error';
error: Error;
}
/**

@@ -961,3 +1128,7 @@ * AnimationOptions

duration?: number;
easing?: Function;
/**
* A function taking a time in the range 0..1 and returning a number where 0 is the initial
* state and 1 is the final state.
*/
easing?: (time: number) => number;
/** point, origin of movement relative to map center */

@@ -985,2 +1156,8 @@ offset?: PointLike;

export interface CameraForBoundsOptions extends CameraOptions {
padding?: number | PaddingOptions;
offset?: PointLike;
maxZoom?: number;
}
/**

@@ -994,3 +1171,2 @@ * FlyToOptions

screenSpeed?: number;
easing?: Function;
maxDuration?: number;

@@ -1001,3 +1177,2 @@ }

linear?: boolean;
easing?: Function;
padding?: number | mapboxgl.PaddingOptions;

@@ -1012,45 +1187,79 @@ offset?: mapboxgl.PointLike;

*/
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 };
wheel?: { data: mapboxgl.MapWheelEvent };
export type MapEventType = {
error: ErrorEvent;
load: MapboxEvent;
remove: MapboxEvent;
render: MapboxEvent;
resize: MapboxEvent;
webglcontextlost: MapContextEvent;
webglcontextrestored: MapContextEvent;
dataloading: MapDataEvent;
data: MapDataEvent;
tiledataloading: MapDataEvent;
sourcedataloading: MapSourceDataEvent;
styledataloading: MapStyleDataEvent;
sourcedata: MapSourceDataEvent;
styledata: MapStyleDataEvent;
boxzoomcancel: MapBoxZoomEvent;
boxzoomstart: MapBoxZoomEvent;
boxzoomend: MapBoxZoomEvent;
touchcancel: MapTouchEvent;
touchmove: MapTouchEvent;
touchend: MapTouchEvent;
touchstart: MapTouchEvent;
click: MapMouseEvent;
contextmenu: MapMouseEvent;
dblclick: MapMouseEvent;
mousemove: MapMouseEvent;
mouseup: MapMouseEvent;
mousedown: MapMouseEvent;
mouseout: MapMouseEvent;
mouseover: MapMouseEvent;
movestart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
move: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
moveend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
zoomstart: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
zoom: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
zoomend: MapboxEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
rotatestart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
rotate: MapboxEvent<MouseEvent | TouchEvent | undefined>;
rotateend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
dragstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
drag: MapboxEvent<MouseEvent | TouchEvent | undefined>;
dragend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
pitchstart: MapboxEvent<MouseEvent | TouchEvent | undefined>;
pitch: MapboxEvent<MouseEvent | TouchEvent | undefined>;
pitchend: MapboxEvent<MouseEvent | TouchEvent | undefined>;
wheel: MapWheelEvent;
}
export type MapLayerEventType = {
click: MapLayerMouseEvent;
dblclick: MapLayerMouseEvent;
mousedown: MapLayerMouseEvent;
mouseup: MapLayerMouseEvent;
mousemove: MapLayerMouseEvent;
mouseenter: MapLayerMouseEvent;
mouseleave: MapLayerMouseEvent;
mouseover: MapLayerMouseEvent;
mouseout: MapLayerMouseEvent;
contextmenu: MapLayerMouseEvent;
touchstart: MapLayerTouchEvent;
touchend: MapLayerTouchEvent;
touchcancel: MapLayerTouchEvent;
}
export interface Layer {

@@ -1114,3 +1323,3 @@ id: string;

'fill-translate-anchor'?: 'map' | 'viewport';
'fill-pattern'?: string;
'fill-pattern'?: string | Expression;
'fill-pattern-transition'?: Transition;

@@ -1131,3 +1340,3 @@ }

'fill-extrusion-translate-anchor'?: 'map' | 'viewport';
'fill-extrusion-pattern'?: string;
'fill-extrusion-pattern'?: string | Expression;
'fill-extrusion-pattern-transition'?: Transition;

@@ -1167,3 +1376,3 @@ 'fill-extrusion-height'?: number | StyleFunction | Expression;

'line-dasharray-transition'?: Transition;
'line-pattern'?: string;
'line-pattern'?: string | Expression;
'line-pattern-transition'?: Transition;

@@ -1179,2 +1388,3 @@ 'line-gradient'?: Expression;

'symbol-avoid-edges'?: boolean;
'symbol-z-order'?: 'viewport-y' | 'source';
'icon-allow-overlap'?: boolean | StyleFunction;

@@ -1181,0 +1391,0 @@ 'icon-ignore-placement'?: boolean;

{
"name": "@types/mapbox-gl",
"version": "0.48.0",
"version": "0.49.0",
"description": "TypeScript definitions for Mapbox GL JS",

@@ -27,4 +27,4 @@ "license": "MIT",

},
"typesPublisherContentHash": "25584af44e6e693e44291c029c91a6d01bad60a3bd3e678d42f9335d5fc2598c",
"typesPublisherContentHash": "da3aec0532975a0adb04aed093fedb8d91b428e495b746187888fbf89cc4125d",
"typeScriptVersion": "2.3"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Wed, 29 Aug 2018 22:57:58 GMT
* Last updated: Wed, 03 Oct 2018 17:56:18 GMT
* Dependencies: geojson

@@ -14,0 +14,0 @@ * Global values: mapboxgl

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc