@types/mapbox__mapbox-gl-draw
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -8,3 +8,3 @@ // Type definitions for @mapbox/mapbox-gl-draw 1.4 | ||
import { BBox, Feature, FeatureCollection, GeoJSON, GeoJsonTypes, Geometry, Point, Position } from 'geojson'; | ||
import { BBox, Feature, FeatureCollection, GeoJSON, GeoJsonTypes, Geometry, Point, Position } from "geojson"; | ||
import { | ||
@@ -19,3 +19,3 @@ CircleLayer, | ||
MapTouchEvent as MapboxMapTouchEvent, | ||
} from 'mapbox-gl'; | ||
} from "mapbox-gl"; | ||
@@ -29,19 +29,19 @@ export = MapboxDraw; | ||
type DrawEventType = | ||
| 'draw.create' | ||
| 'draw.delete' | ||
| 'draw.update' | ||
| 'draw.render' | ||
| 'draw.combine' | ||
| 'draw.uncombine' | ||
| 'draw.modechange' | ||
| 'draw.actionable' | ||
| 'draw.selectionchange'; | ||
| "draw.create" | ||
| "draw.delete" | ||
| "draw.update" | ||
| "draw.render" | ||
| "draw.combine" | ||
| "draw.uncombine" | ||
| "draw.modechange" | ||
| "draw.actionable" | ||
| "draw.selectionchange"; | ||
interface DrawModes { | ||
DRAW_LINE_STRING: 'draw_line_string'; | ||
DRAW_POLYGON: 'draw_polygon'; | ||
DRAW_POINT: 'draw_point'; | ||
SIMPLE_SELECT: 'simple_select'; | ||
DIRECT_SELECT: 'direct_select'; | ||
STATIC: 'static'; | ||
DRAW_LINE_STRING: "draw_line_string"; | ||
DRAW_POLYGON: "draw_polygon"; | ||
DRAW_POINT: "draw_point"; | ||
SIMPLE_SELECT: "simple_select"; | ||
DIRECT_SELECT: "direct_select"; | ||
STATIC: "static"; | ||
} | ||
@@ -65,5 +65,5 @@ | ||
interface DrawFeatureBase<Coordinates> { | ||
readonly properties: Readonly<Feature['properties']>; | ||
readonly properties: Readonly<Feature["properties"]>; | ||
readonly coordinates: Coordinates; | ||
readonly id: NonNullable<Feature['id']>; | ||
readonly id: NonNullable<Feature["id"]>; | ||
readonly type: GeoJsonTypes; | ||
@@ -73,3 +73,3 @@ | ||
isValid(): boolean; | ||
incomingCoords: this['setCoordinates']; | ||
incomingCoords: this["setCoordinates"]; | ||
setCoordinates(coords: Coordinates): void; | ||
@@ -83,22 +83,23 @@ getCoordinates(): Coordinates; | ||
interface DrawMultiFeature<Type extends 'MultiPoint' | 'MultiLineString' | 'MultiPolygon'> | ||
extends Omit< | ||
interface DrawMultiFeature<Type extends "MultiPoint" | "MultiLineString" | "MultiPolygon"> extends | ||
Omit< | ||
DrawFeatureBase< | ||
| (Type extends 'MultiPoint' ? Array<DrawPoint['coordinates']> : never) | ||
| (Type extends 'MultiLineString' ? Array<DrawLineString['coordinates']> : never) | ||
| (Type extends 'MultiPolygon' ? Array<DrawPolygon['coordinates']> : never) | ||
| (Type extends "MultiPoint" ? Array<DrawPoint["coordinates"]> : never) | ||
| (Type extends "MultiLineString" ? Array<DrawLineString["coordinates"]> : never) | ||
| (Type extends "MultiPolygon" ? Array<DrawPolygon["coordinates"]> : never) | ||
>, | ||
'coordinates' | ||
> { | ||
"coordinates" | ||
> | ||
{ | ||
readonly type: Type; | ||
readonly features: Array< | ||
| (Type extends 'MultiPoint' ? DrawPoint : never) | ||
| (Type extends 'MultiLineString' ? DrawLineString : never) | ||
| (Type extends 'MultiPolygon' ? DrawPolygon : never) | ||
| (Type extends "MultiPoint" ? DrawPoint : never) | ||
| (Type extends "MultiLineString" ? DrawLineString : never) | ||
| (Type extends "MultiPolygon" ? DrawPolygon : never) | ||
>; | ||
getFeatures(): this['features']; | ||
getFeatures(): this["features"]; | ||
} | ||
interface DrawPoint extends DrawFeatureBase<Position> { | ||
readonly type: 'Point'; | ||
readonly type: "Point"; | ||
getCoordinate(): Position; | ||
@@ -110,3 +111,3 @@ updateCoordinate(lng: number, lat: number): void; | ||
interface DrawLineString extends DrawFeatureBase<Position[]> { | ||
readonly type: 'LineString'; | ||
readonly type: "LineString"; | ||
addCoordinate(path: string | number, lng: number, lat: number): void; | ||
@@ -117,3 +118,3 @@ removeCoordinate(path: string | number): void; | ||
interface DrawPolygon extends DrawFeatureBase<Position[][]> { | ||
readonly type: 'Polygon'; | ||
readonly type: "Polygon"; | ||
addCoordinate(path: string, lng: number, lat: number): void; | ||
@@ -127,5 +128,5 @@ removeCoordinate(path: string): void; | ||
| DrawPolygon | ||
| DrawMultiFeature<'MultiPoint'> | ||
| DrawMultiFeature<'MultiLineString'> | ||
| DrawMultiFeature<'MultiPolygon'>; | ||
| DrawMultiFeature<"MultiPoint"> | ||
| DrawMultiFeature<"MultiLineString"> | ||
| DrawMultiFeature<"MultiPolygon">; | ||
@@ -148,3 +149,3 @@ interface MapMouseEvent extends MapboxMapMouseEvent { | ||
features: Feature[]; | ||
type: 'draw.create'; | ||
type: "draw.create"; | ||
} | ||
@@ -155,3 +156,3 @@ | ||
features: Feature[]; | ||
type: 'draw.delete'; | ||
type: "draw.delete"; | ||
} | ||
@@ -162,3 +163,3 @@ | ||
createdFeatures: Feature[]; // Array of created multifeatures | ||
type: 'draw.combine'; | ||
type: "draw.combine"; | ||
} | ||
@@ -169,3 +170,3 @@ | ||
createdFeatures: Feature[]; // Array of created features | ||
type: 'draw.uncombine'; | ||
type: "draw.uncombine"; | ||
} | ||
@@ -176,3 +177,3 @@ | ||
action: string; // Name of the action that triggered the update | ||
type: 'draw.update'; | ||
type: "draw.update"; | ||
} | ||
@@ -183,3 +184,3 @@ | ||
points: Array<Feature<Point>>; | ||
type: 'draw.selectionchange'; | ||
type: "draw.selectionchange"; | ||
} | ||
@@ -189,7 +190,7 @@ | ||
mode: DrawMode; // The next mode, i.e. the mode that Draw is changing to | ||
type: 'draw.modechange'; | ||
type: "draw.modechange"; | ||
} | ||
interface DrawRenderEvent extends DrawEvent { | ||
type: 'draw.render'; | ||
type: "draw.render"; | ||
} | ||
@@ -199,3 +200,3 @@ | ||
actions: DrawActionableState; | ||
type: 'draw.actionable'; | ||
type: "draw.actionable"; | ||
} | ||
@@ -240,3 +241,3 @@ | ||
featuresAt(event: Event, bbox: BBox, bufferType: 'click' | 'tap'): DrawFeature[]; | ||
featuresAt(event: Event, bbox: BBox, bufferType: "click" | "tap"): DrawFeature[]; | ||
@@ -303,93 +304,93 @@ newFeature(geojson: GeoJSON): DrawFeature; | ||
readonly classes: { | ||
CONTROL_BASE: 'mapboxgl-ctrl'; | ||
CONTROL_PREFIX: 'mapboxgl-ctrl-'; | ||
CONTROL_BUTTON: 'mapbox-gl-draw_ctrl-draw-btn'; | ||
CONTROL_BUTTON_LINE: 'mapbox-gl-draw_line'; | ||
CONTROL_BUTTON_POLYGON: 'mapbox-gl-draw_polygon'; | ||
CONTROL_BUTTON_POINT: 'mapbox-gl-draw_point'; | ||
CONTROL_BUTTON_TRASH: 'mapbox-gl-draw_trash'; | ||
CONTROL_BUTTON_COMBINE_FEATURES: 'mapbox-gl-draw_combine'; | ||
CONTROL_BUTTON_UNCOMBINE_FEATURES: 'mapbox-gl-draw_uncombine'; | ||
CONTROL_GROUP: 'mapboxgl-ctrl-group'; | ||
ATTRIBUTION: 'mapboxgl-ctrl-attrib'; | ||
ACTIVE_BUTTON: 'active'; | ||
BOX_SELECT: 'mapbox-gl-draw_boxselect'; | ||
CONTROL_BASE: "mapboxgl-ctrl"; | ||
CONTROL_PREFIX: "mapboxgl-ctrl-"; | ||
CONTROL_BUTTON: "mapbox-gl-draw_ctrl-draw-btn"; | ||
CONTROL_BUTTON_LINE: "mapbox-gl-draw_line"; | ||
CONTROL_BUTTON_POLYGON: "mapbox-gl-draw_polygon"; | ||
CONTROL_BUTTON_POINT: "mapbox-gl-draw_point"; | ||
CONTROL_BUTTON_TRASH: "mapbox-gl-draw_trash"; | ||
CONTROL_BUTTON_COMBINE_FEATURES: "mapbox-gl-draw_combine"; | ||
CONTROL_BUTTON_UNCOMBINE_FEATURES: "mapbox-gl-draw_uncombine"; | ||
CONTROL_GROUP: "mapboxgl-ctrl-group"; | ||
ATTRIBUTION: "mapboxgl-ctrl-attrib"; | ||
ACTIVE_BUTTON: "active"; | ||
BOX_SELECT: "mapbox-gl-draw_boxselect"; | ||
}; | ||
readonly sources: { | ||
HOT: 'mapbox-gl-draw-hot'; | ||
COLD: 'mapbox-gl-draw-cold'; | ||
HOT: "mapbox-gl-draw-hot"; | ||
COLD: "mapbox-gl-draw-cold"; | ||
}; | ||
readonly cursors: { | ||
ADD: 'add'; | ||
MOVE: 'move'; | ||
DRAG: 'drag'; | ||
POINTER: 'pointer'; | ||
NONE: 'none'; | ||
ADD: "add"; | ||
MOVE: "move"; | ||
DRAG: "drag"; | ||
POINTER: "pointer"; | ||
NONE: "none"; | ||
}; | ||
readonly types: { | ||
POLYGON: 'polygon'; | ||
LINE: 'line_string'; | ||
POINT: 'point'; | ||
POLYGON: "polygon"; | ||
LINE: "line_string"; | ||
POINT: "point"; | ||
}; | ||
readonly geojsonTypes: { | ||
FEATURE: 'Feature'; | ||
POLYGON: 'Polygon'; | ||
LINE_STRING: 'LineString'; | ||
POINT: 'Point'; | ||
FEATURE_COLLECTION: 'FeatureCollection'; | ||
MULTI_PREFIX: 'Multi'; | ||
MULTI_POINT: 'MultiPoint'; | ||
MULTI_LINE_STRING: 'MultiLineString'; | ||
MULTI_POLYGON: 'MultiPolygon'; | ||
FEATURE: "Feature"; | ||
POLYGON: "Polygon"; | ||
LINE_STRING: "LineString"; | ||
POINT: "Point"; | ||
FEATURE_COLLECTION: "FeatureCollection"; | ||
MULTI_PREFIX: "Multi"; | ||
MULTI_POINT: "MultiPoint"; | ||
MULTI_LINE_STRING: "MultiLineString"; | ||
MULTI_POLYGON: "MultiPolygon"; | ||
}; | ||
readonly modes: { | ||
DRAW_LINE_STRING: 'draw_line_string'; | ||
DRAW_POLYGON: 'draw_polygon'; | ||
DRAW_POINT: 'draw_point'; | ||
SIMPLE_SELECT: 'simple_select'; | ||
DIRECT_SELECT: 'direct_select'; | ||
STATIC: 'static'; | ||
DRAW_LINE_STRING: "draw_line_string"; | ||
DRAW_POLYGON: "draw_polygon"; | ||
DRAW_POINT: "draw_point"; | ||
SIMPLE_SELECT: "simple_select"; | ||
DIRECT_SELECT: "direct_select"; | ||
STATIC: "static"; | ||
}; | ||
readonly events: { | ||
CREATE: 'draw.create'; | ||
DELETE: 'draw.delete'; | ||
UPDATE: 'draw.update'; | ||
SELECTION_CHANGE: 'draw.selectionchange'; | ||
MODE_CHANGE: 'draw.modechange'; | ||
ACTIONABLE: 'draw.actionable'; | ||
RENDER: 'draw.render'; | ||
COMBINE_FEATURES: 'draw.combine'; | ||
UNCOMBINE_FEATURES: 'draw.uncombine'; | ||
CREATE: "draw.create"; | ||
DELETE: "draw.delete"; | ||
UPDATE: "draw.update"; | ||
SELECTION_CHANGE: "draw.selectionchange"; | ||
MODE_CHANGE: "draw.modechange"; | ||
ACTIONABLE: "draw.actionable"; | ||
RENDER: "draw.render"; | ||
COMBINE_FEATURES: "draw.combine"; | ||
UNCOMBINE_FEATURES: "draw.uncombine"; | ||
}; | ||
readonly updateActions: { | ||
MOVE: 'move'; | ||
CHANGE_COORDINATES: 'change_coordinates'; | ||
MOVE: "move"; | ||
CHANGE_COORDINATES: "change_coordinates"; | ||
}; | ||
readonly meta: { | ||
FEATURE: 'feature'; | ||
MIDPOINT: 'midpoint'; | ||
VERTEX: 'vertex'; | ||
FEATURE: "feature"; | ||
MIDPOINT: "midpoint"; | ||
VERTEX: "vertex"; | ||
}; | ||
readonly activeStates: { | ||
ACTIVE: 'true'; | ||
INACTIVE: 'false'; | ||
ACTIVE: "true"; | ||
INACTIVE: "false"; | ||
}; | ||
readonly interactions: [ | ||
'scrollZoom', | ||
'boxZoom', | ||
'dragRotate', | ||
'dragPan', | ||
'keyboard', | ||
'doubleClickZoom', | ||
'touchZoomRotate', | ||
"scrollZoom", | ||
"boxZoom", | ||
"dragRotate", | ||
"dragPan", | ||
"keyboard", | ||
"doubleClickZoom", | ||
"touchZoomRotate", | ||
]; | ||
@@ -414,3 +415,5 @@ | ||
CommonSelectors: { | ||
isOfMetaType: (type: Constants['meta'][keyof Constants['meta']]) => (e: MapMouseEvent | MapTouchEvent) => boolean; | ||
isOfMetaType: ( | ||
type: Constants["meta"][keyof Constants["meta"]], | ||
) => (e: MapMouseEvent | MapTouchEvent) => boolean; | ||
isShiftMousedown: (e: MapboxEvent) => boolean; | ||
@@ -523,3 +526,3 @@ isActiveFeature: (e: MapMouseEvent | MapTouchEvent) => boolean; | ||
stringSetsAreEqual(a: Array<Pick<Feature, 'id'>>, b: Array<Pick<Feature, 'id'>>): boolean; | ||
stringSetsAreEqual(a: Array<Pick<Feature, "id">>, b: Array<Pick<Feature, "id">>): boolean; | ||
@@ -537,19 +540,19 @@ StringSet(items?: Array<string | number>): StringSet; | ||
type ThemeLayerId = | ||
| 'gl-draw-polygon-fill-static' | ||
| 'gl-draw-polygon-fill-active' | ||
| 'gl-draw-polygon-fill-inactive' | ||
| 'gl-draw-polygon-stroke-static' | ||
| 'gl-draw-polygon-stroke-active' | ||
| 'gl-draw-polygon-stroke-inactive' | ||
| 'gl-draw-polygon-midpoint' | ||
| 'gl-draw-polygon-and-line-vertex-inactive' | ||
| 'gl-draw-polygon-and-line-vertex-stroke-inactive' | ||
| 'gl-draw-line-static' | ||
| 'gl-draw-line-active' | ||
| 'gl-draw-line-inactive' | ||
| 'gl-draw-point-static' | ||
| 'gl-draw-point-active' | ||
| 'gl-draw-point-inactive' | ||
| 'gl-draw-point-stroke-active' | ||
| 'gl-draw-point-point-stroke-inactive'; | ||
| "gl-draw-polygon-fill-static" | ||
| "gl-draw-polygon-fill-active" | ||
| "gl-draw-polygon-fill-inactive" | ||
| "gl-draw-polygon-stroke-static" | ||
| "gl-draw-polygon-stroke-active" | ||
| "gl-draw-polygon-stroke-inactive" | ||
| "gl-draw-polygon-midpoint" | ||
| "gl-draw-polygon-and-line-vertex-inactive" | ||
| "gl-draw-polygon-and-line-vertex-stroke-inactive" | ||
| "gl-draw-line-static" | ||
| "gl-draw-line-active" | ||
| "gl-draw-line-inactive" | ||
| "gl-draw-point-static" | ||
| "gl-draw-point-active" | ||
| "gl-draw-point-inactive" | ||
| "gl-draw-point-stroke-active" | ||
| "gl-draw-point-point-stroke-inactive"; | ||
@@ -610,9 +613,9 @@ interface MapboxDrawOptions { | ||
changeMode(mode: 'simple_select', options?: { featureIds: string[] }): this; | ||
changeMode(mode: 'direct_select', options: { featureId: string }): this; | ||
changeMode(mode: "simple_select", options?: { featureIds: string[] }): this; | ||
changeMode(mode: "direct_select", options: { featureId: string }): this; | ||
changeMode( | ||
mode: 'draw_line_string', | ||
mode: "draw_line_string", | ||
options?: { featureId: string; from: Feature<Point> | Point | number[] }, | ||
): this; | ||
changeMode(mode: Exclude<MapboxDraw.DrawMode, 'direct_select' | 'simple_select' | 'draw_line_string'>): this; | ||
changeMode(mode: Exclude<MapboxDraw.DrawMode, "direct_select" | "simple_select" | "draw_line_string">): this; | ||
changeMode<T extends string>(mode: T & (T extends MapboxDraw.DrawMode ? never : T), options?: object): this; | ||
@@ -619,0 +622,0 @@ |
{ | ||
"name": "@types/mapbox__mapbox-gl-draw", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "TypeScript definitions for @mapbox/mapbox-gl-draw", | ||
@@ -36,4 +36,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__mapbox-gl-draw", | ||
}, | ||
"typesPublisherContentHash": "9d694067b3f4a490b04aaf292f62cdae2b279659a182c37021538c4b8571c73e", | ||
"typesPublisherContentHash": "906c5209f1f514d6e36d3962933e043f3466ab8e3a0a3bf02bebfcfba311be84", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Sun, 17 Sep 2023 12:40:30 GMT | ||
* Last updated: Wed, 27 Sep 2023 09:42:15 GMT | ||
* Dependencies: [@types/geojson](https://npmjs.com/package/@types/geojson), [@types/mapbox-gl](https://npmjs.com/package/@types/mapbox-gl) | ||
@@ -14,0 +14,0 @@ * Global values: `MapboxDraw` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23879
481