Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support for mapbox v3.5.0 and beyond #2454

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@
"update-release-branch": "scripts/update-release-branch.sh"
},
"dependencies": {
"@maplibre/maplibre-gl-style-spec": "^19.2.1",
"@types/mapbox-gl": ">=1.0.0"
"@maplibre/maplibre-gl-style-spec": "^19.2.1"
},
"peerDependencies": {
"mapbox-gl": ">=1.13.0",
"mapbox-gl": ">=3.9.0",
"maplibre-gl": ">=1.13.0",
"react": ">=16.3.0",
"react-dom": ">=16.3.0"
Expand All @@ -68,16 +67,17 @@
}
},
"devDependencies": {
"@types/node": "^18.19.68",
"@types/react": "^16.0.0",
"jsdom": "^16.5.0",
"mapbox-gl": "^2.14.0",
"maplibre-gl": "^2.4.0",
"mapbox-gl": "^3.9.0",
"maplibre-gl": "^3.6.2",
"ocular-dev-tools": "2.0.0-alpha.15",
"pre-commit": "^1.2.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-test-renderer": "^18.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"pre-commit": [
"test-fast"
Expand Down
2 changes: 1 addition & 1 deletion src/exports-mapbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import type {
Map as MapboxMap,
MapboxOptions,
MapOptions as MapboxOptions,
Marker as MapboxMarker,
MarkerOptions,
Popup as MapboxPopup,
Expand Down
10 changes: 5 additions & 5 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export type MapGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
};

export type PaddingOptions = {
top: number;
bottom: number;
left: number;
right: number;
readonly top?: number;
readonly bottom?: number;
readonly right?: number;
readonly left?: number;
};

/* Public */
Expand All @@ -87,7 +87,7 @@ export type ViewState = {
padding: PaddingOptions;
};

export type ControlPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
export type ControlPosition = 'top-left' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left';

export interface ImmutableLike<T> {
toJS: () => T;
Expand Down
7 changes: 4 additions & 3 deletions src/types/events-mapbox.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {
Map,
MapboxEvent as MapEvent,
MapEvent as MapEvent,
MapMouseEvent,
MapLayerMouseEvent,
MapMouseEvent as MapLayerMouseEvent,
MapTouchEvent,
MapLayerTouchEvent,
MapTouchEvent as MapLayerTouchEvent,
MapStyleDataEvent,
MapSourceDataEvent,
MapWheelEvent,
// @ts-ignore
MapBoxZoomEvent
} from 'mapbox-gl';
import {ErrorEvent as _ErrorEvent, ViewStateChangeEvent as _ViewStateChangeEvent} from './events';
Expand Down
6 changes: 3 additions & 3 deletions src/types/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface IControl<MapT extends MapInstance = MapInstance> {

onRemove(map: MapT): void;

getDefaultPosition?: (() => string) | undefined;
getDefaultPosition?: (() => ControlPosition) | undefined;
}

type Listener = (event?: any) => any;
Expand Down Expand Up @@ -71,7 +71,7 @@ export interface MapInstance extends Evented {

unproject(point: any): LngLat;

queryTerrainElevation?(lngLat: any, options?: any): number | null;
queryTerrainElevation?(lngLat: any, options?: any): number | null | undefined;

getContainer(): HTMLElement;

Expand Down Expand Up @@ -145,7 +145,7 @@ export interface PopupInstance extends Evented {
getLngLat(): LngLat;
setLngLat(lnglat: LngLatLike): this;

getElement(): HTMLElement;
getElement(): HTMLElement | undefined;

setDOMContent(htmlNode: any): this;

Expand Down
42 changes: 21 additions & 21 deletions src/types/style-spec-mapbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*/
// Layers
import type {
BackgroundLayer,
SkyLayer,
CircleLayer,
FillLayer,
FillExtrusionLayer,
HeatmapLayer,
HillshadeLayer,
LineLayer,
RasterLayer,
SymbolLayer
BackgroundLayerSpecification as BackgroundLayer,
SkyLayerSpecification as SkyLayer,
CircleLayerSpecification as CircleLayer,
FillLayerSpecification as FillLayer,
FillExtrusionLayerSpecification as FillExtrusionLayer,
HeatmapLayerSpecification as HeatmapLayer,
HillshadeLayerSpecification as HillshadeLayer,
LineLayerSpecification as LineLayer,
RasterLayerSpecification as RasterLayer,
SymbolLayerSpecification as SymbolLayer
} from 'mapbox-gl';

export type AnyLayer =
Expand Down Expand Up @@ -42,13 +42,13 @@ export type {

// Sources
import type {
GeoJSONSourceRaw,
VideoSourceRaw,
ImageSourceRaw,
VectorSource as VectorSourceRaw,
RasterSource,
CanvasSourceRaw,
RasterDemSource
GeoJSONSourceSpecification as GeoJSONSourceRaw,
VideoSourceSpecification as VideoSourceRaw,
ImageSourceSpecification as ImageSourceRaw,
VectorSourceSpecification as VectorSourceRaw,
RasterSourceSpecification as RasterSource,
CanvasSourceSpecification as CanvasSourceRaw,
RasterDEMSourceSpecification as RasterDemSource
} from 'mapbox-gl';

export type AnySource =
Expand All @@ -72,9 +72,9 @@ export type {

// Other
export type {
Style as MapStyle,
Light,
Fog,
StyleSpecification as MapStyle,
LightsSpecification as Light,
FogSpecification as Fog,
TerrainSpecification as Terrain,
Projection
ProjectionSpecification as Projection
} from 'mapbox-gl';
Loading