@carto/ps-react-maps 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -10
- package/dist/index.js +484 -481
- package/dist/types/common-stories/maps/google-maps.component.d.ts +1 -1
- package/dist/types/map-measurement-tool/custom-editable-geojson-layer.class.d.ts +1 -1
- package/dist/types/map-measurement-tool/custom-measurement-distance-mode.class.d.ts +2 -2
- package/dist/types/map-measurement-tool/map-measurement-tool.layer.d.ts +1 -1
- package/dist/types/map-measurement-tool/map-measurement-tool.types.d.ts +1 -1
- package/dist/types/map-measurement-tool/map-measurement-tool.util.d.ts +1 -1
- package/dist/types/map-provider/map-provider.hook.d.ts +18 -7
- package/dist/types/map-provider/map-provider.reducer.d.ts +6 -2
- package/dist/types/map-provider/map-provider.types.d.ts +14 -16
- package/package.json +9 -11
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GoogleMapsProps } from '@/map-provider';
|
|
2
2
|
export declare function GoogleMapsComponent(props: GoogleMapsProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare function GoogleMap({ apiKey, basemap, instanceRef, layers, overlayRef, initialViewState, viewState, controller,
|
|
3
|
+
export declare function GoogleMap({ apiKey, basemap, instanceRef, layers, overlayRef, initialViewState, viewState, controller, id, language, mapId, mapOptions, style, version, getTooltip, onResize, onViewStateChange, ...rest }: GoogleMapsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditableGeoJsonLayer } from '@
|
|
1
|
+
import { EditableGeoJsonLayer } from '@deck.gl-community/editable-layers';
|
|
2
2
|
import { EventManager } from 'mjolnir.js';
|
|
3
3
|
import type { CustomEditableLayerProps } from './map-measurement-tool.types';
|
|
4
4
|
export declare class CustomEditableGeojsonLayer extends EditableGeoJsonLayer {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FeatureCollection, MeasureDistanceMode, type ModeProps } from '@
|
|
2
|
-
import type { BasePointerEvent } from '@
|
|
1
|
+
import { FeatureCollection, MeasureDistanceMode, type ModeProps } from '@deck.gl-community/editable-layers';
|
|
2
|
+
import type { BasePointerEvent } from '@deck.gl-community/editable-layers/dist/edit-modes/types';
|
|
3
3
|
export declare class CustomMeasureDistanceMode extends MeasureDistanceMode {
|
|
4
4
|
handleClick(event: BasePointerEvent, props: ModeProps<FeatureCollection>): void;
|
|
5
5
|
handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { EditableGeojsonLayerProps } from '@nebula.gl/layers/dist-types/layers/editable-geojson-layer';
|
|
2
1
|
import type { EventManager } from 'mjolnir.js';
|
|
3
2
|
import type { ReactNode } from 'react';
|
|
4
3
|
import type { Tooltip } from '@/map-provider';
|
|
4
|
+
import type { EditableGeojsonLayerProps } from '@deck.gl-community/editable-layers/dist/editable-layers/editable-geojson-layer';
|
|
5
5
|
export declare enum MapMeasurementUnit {
|
|
6
6
|
milimeter = "milimeter",
|
|
7
7
|
centimeter = "centimeter",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MapMeasurementUnit } from './map-measurement-tool.types';
|
|
2
2
|
import type { MapsProps } from '@/map-provider';
|
|
3
|
-
import type { ControllerOptions } from '@deck.gl/core/
|
|
3
|
+
import type { ControllerOptions } from '@deck.gl/core/dist/controllers/controller';
|
|
4
4
|
export declare function convertMetersTo(distance: number, unit: MapMeasurementUnit): number;
|
|
5
5
|
export declare function getTextLayerFormattedDistance({ meters, unit, locale, }: {
|
|
6
6
|
meters: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DeckGLMapsProps, MapProviderMapProps, MapReferences, MapResize, OverlayMapRef, ViewportRect } from './map-provider.types';
|
|
2
|
-
import type { Deck, WebMercatorViewport } from '@deck.gl/core
|
|
1
|
+
import type { DeckGLMapsProps, MapProviderMapProps, MapReferences, MapResize, MapViewState, OverlayMapRef, ViewportRect } from './map-provider.types';
|
|
2
|
+
import type { Deck, WebMercatorViewport } from '@deck.gl/core';
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook that retrieves the map configuration for a given ID.
|
|
5
5
|
* @param id - The ID of the map.
|
|
@@ -27,7 +27,7 @@ export declare function useMapReferences(id: string): MapReferences & {
|
|
|
27
27
|
export declare function useMapActions(id: string): {
|
|
28
28
|
setBasemap: (basemap: any) => void;
|
|
29
29
|
setResize: (props: MapResize) => void;
|
|
30
|
-
setViewState: (viewState:
|
|
30
|
+
setViewState: (viewState: MapViewState) => void;
|
|
31
31
|
setZoom: (zoom: number) => void;
|
|
32
32
|
setLoaded: (loaded: boolean) => void;
|
|
33
33
|
fitBounds: (bounds: Parameters<WebMercatorViewport['fitBounds']>[0], { boundsOptions, viewStateOptions, }?: {
|
|
@@ -47,9 +47,20 @@ export declare function useMapByID(id: string): MapProviderMapProps;
|
|
|
47
47
|
* @deprecated Use `useMapReferences` with id param instead.
|
|
48
48
|
*/
|
|
49
49
|
export declare function useMapReferencesByID(id: string): MapReferences & {
|
|
50
|
-
getDeckInstance: () => Deck | undefined;
|
|
50
|
+
getDeckInstance: () => Deck<null> | undefined;
|
|
51
51
|
getOverlayInstance: () => OverlayMapRef | undefined;
|
|
52
|
-
getViewState: () =>
|
|
52
|
+
getViewState: () => ({
|
|
53
|
+
longitude: number;
|
|
54
|
+
latitude: number;
|
|
55
|
+
zoom: number;
|
|
56
|
+
pitch?: number | undefined;
|
|
57
|
+
bearing?: number | undefined;
|
|
58
|
+
minZoom?: number | undefined;
|
|
59
|
+
maxZoom?: number | undefined;
|
|
60
|
+
minPitch?: number | undefined;
|
|
61
|
+
maxPitch?: number | undefined;
|
|
62
|
+
position?: number[] | undefined;
|
|
63
|
+
} & import("@deck.gl/core/dist/controllers/transition-manager").TransitionProps) | undefined;
|
|
53
64
|
getViewports: (rect?: ViewportRect | undefined) => WebMercatorViewport[];
|
|
54
65
|
getViewport: (index?: number | undefined, rect?: ViewportRect | undefined) => WebMercatorViewport;
|
|
55
66
|
};
|
|
@@ -59,7 +70,7 @@ export declare function useMapReferencesByID(id: string): MapReferences & {
|
|
|
59
70
|
export declare function useMapActionsByID(id: string): {
|
|
60
71
|
setBasemap: (basemap: any) => void;
|
|
61
72
|
setResize: (props: MapResize) => void;
|
|
62
|
-
setViewState: (viewState:
|
|
73
|
+
setViewState: (viewState: import("@deck.gl/core").MapViewState) => void;
|
|
63
74
|
setZoom: (zoom: number) => void;
|
|
64
75
|
setLoaded: (loaded: boolean) => void;
|
|
65
76
|
fitBounds: (bounds: [[number, number], [number, number]], { boundsOptions, viewStateOptions, }?: {
|
|
@@ -68,7 +79,7 @@ export declare function useMapActionsByID(id: string): {
|
|
|
68
79
|
height?: number | undefined;
|
|
69
80
|
minExtent?: number | undefined;
|
|
70
81
|
maxZoom?: number | undefined;
|
|
71
|
-
padding?: number | Required<import("@deck.gl/core/
|
|
82
|
+
padding?: number | Required<import("@deck.gl/core/dist/viewports/viewport").Padding> | undefined;
|
|
72
83
|
offset?: number[] | undefined;
|
|
73
84
|
} | undefined;
|
|
74
85
|
viewStateOptions?: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MapsProps, MapState } from './map-provider.types';
|
|
1
|
+
import type { MapResize, MapsProps, MapState, MapViewState } from './map-provider.types';
|
|
2
2
|
export declare enum Actions {
|
|
3
3
|
SetViewState = "SetViewState",
|
|
4
4
|
SetBasemap = "SetBasemap",
|
|
@@ -8,7 +8,11 @@ export declare enum Actions {
|
|
|
8
8
|
}
|
|
9
9
|
type Action = {
|
|
10
10
|
type: Actions;
|
|
11
|
-
payload: MapsProps
|
|
11
|
+
payload: MapsProps | MapResize | {
|
|
12
|
+
viewState: MapViewState;
|
|
13
|
+
} | {
|
|
14
|
+
zoom: MapViewState['zoom'];
|
|
15
|
+
} | boolean;
|
|
12
16
|
};
|
|
13
17
|
/**
|
|
14
18
|
* Reducer function for the MapProvider component.
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
-
import type { PickingInfo } from '@deck.gl/core
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { DeckGLProps, DeckGLRef } from '@deck.gl/react/typed';
|
|
2
|
+
import type { MapViewState as _MapViewState, PickingInfo } from '@deck.gl/core';
|
|
3
|
+
import type { GoogleMapsOverlay, GoogleMapsOverlayProps } from '@deck.gl/google-maps';
|
|
4
|
+
import type { DeckGLProps, DeckGLRef } from '@deck.gl/react';
|
|
6
5
|
import type { Properties } from 'csstype';
|
|
7
6
|
import type { MutableRefObject, ReactNode } from 'react';
|
|
8
7
|
import type { MapRef } from 'react-map-gl';
|
|
9
8
|
import { CartoBasemapsNames, GMapsBasemap } from './map-provider.const';
|
|
10
9
|
import type { Actions } from './map-provider.reducer';
|
|
10
|
+
import type { ControllerOptions } from '@deck.gl/core/dist/controllers/controller';
|
|
11
|
+
export type MapViewState = _MapViewState;
|
|
11
12
|
export type MapProviderMapProps = {
|
|
12
13
|
id: MapsProps['id'];
|
|
13
14
|
basemap: MapsProps['basemap'];
|
|
14
|
-
viewState:
|
|
15
|
+
viewState: MapViewState;
|
|
15
16
|
isLoaded?: boolean;
|
|
16
|
-
}
|
|
17
|
+
} & Partial<MapResize>;
|
|
17
18
|
/**
|
|
18
19
|
* Props for the MapProvider component.
|
|
19
20
|
*/
|
|
@@ -24,11 +25,8 @@ export type MapProviderProps = {
|
|
|
24
25
|
};
|
|
25
26
|
export type ExternalSync = (data: ExternalSyncProps) => void;
|
|
26
27
|
export type ExternalSyncProps = {
|
|
27
|
-
type: Actions.SetViewState;
|
|
28
|
-
payload:
|
|
29
|
-
} | {
|
|
30
|
-
type: Actions.SetResize;
|
|
31
|
-
payload: MapResize;
|
|
28
|
+
type: Actions.SetViewState | Actions.SetResize;
|
|
29
|
+
payload: MapViewState | MapResize;
|
|
32
30
|
};
|
|
33
31
|
/**
|
|
34
32
|
* State for the MapProvider component.
|
|
@@ -40,8 +38,8 @@ export type MapState = {
|
|
|
40
38
|
* Resize properties for the map.
|
|
41
39
|
*/
|
|
42
40
|
export type MapResize = {
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
41
|
+
width: MapsProps['width'];
|
|
42
|
+
height: MapsProps['height'];
|
|
45
43
|
};
|
|
46
44
|
export type MapReferences = {
|
|
47
45
|
instanceRef: MutableRefObject<InstanceMapRef>;
|
|
@@ -52,7 +50,7 @@ export type MapReferencesState = Record<MapsProps['id'], MapReferences>;
|
|
|
52
50
|
* Actions that can be performed on the map.
|
|
53
51
|
*/
|
|
54
52
|
export type MapActionsState = {
|
|
55
|
-
setViewState: (viewState:
|
|
53
|
+
setViewState: (viewState: MapViewState, id: MapsProps['id']) => void;
|
|
56
54
|
setResize: (props: MapResize, id: MapsProps['id']) => void;
|
|
57
55
|
setBasemap: (basemap: Basemap, id: MapsProps['id']) => void;
|
|
58
56
|
setZoom: (zoom: number, id: MapsProps['id']) => void;
|
|
@@ -76,6 +74,8 @@ export type Basemap = (typeof GMapsBasemap)[keyof typeof GMapsBasemap] | (typeof
|
|
|
76
74
|
export type CommonProps = {
|
|
77
75
|
id: string;
|
|
78
76
|
basemap: Basemap;
|
|
77
|
+
viewState?: MapViewState;
|
|
78
|
+
initialViewState?: MapViewState;
|
|
79
79
|
controller?: ControllerOptions;
|
|
80
80
|
} & DeckGLProps & Partial<MapReferences>;
|
|
81
81
|
/**
|
|
@@ -99,13 +99,11 @@ export type DeckGLMapsProps = CommonProps;
|
|
|
99
99
|
*/
|
|
100
100
|
export type GoogleMapsProps = {
|
|
101
101
|
apiKey?: string;
|
|
102
|
-
height?: string | undefined;
|
|
103
102
|
language?: string;
|
|
104
103
|
mapId?: string;
|
|
105
104
|
mapOptions?: Record<string, number | string>;
|
|
106
105
|
style?: Properties;
|
|
107
106
|
version?: string;
|
|
108
|
-
width?: string | undefined;
|
|
109
107
|
} & CommonProps & GoogleMapsOverlayProps;
|
|
110
108
|
/**
|
|
111
109
|
* Tooltip properties.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carto/ps-react-maps",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "CARTO's Professional Service React Maps library",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -29,24 +29,22 @@
|
|
|
29
29
|
"storybook:build": "storybook build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@nebula.gl/layers": "1.0.4",
|
|
32
|
+
"@deck.gl-community/editable-layers": "9.0.0-alpha.1",
|
|
34
33
|
"convert-units": "3.0.0-beta.6",
|
|
35
34
|
"mjolnir.js": "2.7.1"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@deck.gl/google-maps": "
|
|
39
|
-
"@deck.gl/react": "
|
|
37
|
+
"@deck.gl/google-maps": "9.0.10",
|
|
38
|
+
"@deck.gl/react": "9.0.10",
|
|
40
39
|
"@react-google-maps/api": "2.19.3",
|
|
41
|
-
"@types/google.maps": "3.55.
|
|
42
|
-
"maplibre-gl": "
|
|
40
|
+
"@types/google.maps": "3.55.7",
|
|
41
|
+
"maplibre-gl": "4.1.3",
|
|
43
42
|
"react-map-gl": "7.1.7"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
|
-
"@deck.gl/core": "
|
|
47
|
-
"@deck.gl/layers": "
|
|
48
|
-
"@
|
|
49
|
-
"@nebula.gl/layers": "1.x",
|
|
45
|
+
"@deck.gl/core": "9.x",
|
|
46
|
+
"@deck.gl/layers": "9.x",
|
|
47
|
+
"@deck.gl-community/editable-layers": "9.x",
|
|
50
48
|
"convert-units": "3.x",
|
|
51
49
|
"mjolnir.js": "2.x",
|
|
52
50
|
"react": "17.x || 18.x",
|