@carto/ps-react-maps 1.1.1 → 1.1.2-alpha.1

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.
@@ -2,5 +2,5 @@ export * from './map-provider.const';
2
2
  export * from './map-provider.types';
3
3
  export { INITIAL_STATE, MapContext, MapActionsContext, } from './map-provider.context';
4
4
  export { reducer } from './map-provider.reducer';
5
- export { useMap, useMapActions, useMapByID, useMapActionsByID, } from './map-provider.hook';
5
+ export { useMap, useMapActions, useMapByID, useMapActionsByID, useMapReferencesByID, } from './map-provider.hook';
6
6
  export { MapProvider } from './map-provider.provider';
@@ -1,4 +1,5 @@
1
1
  import type { MapContextInterface } from './map-provider.types';
2
2
  export declare const INITIAL_STATE: MapContextInterface;
3
3
  export declare const MapContext: import("react").Context<import("./map-provider.types").MapState>;
4
+ export declare const MapReferencesContext: import("react").Context<import("react").MutableRefObject<import("./map-provider.types").MapReferencesState>>;
4
5
  export declare const MapActionsContext: import("react").Context<import("./map-provider.types").MapActionsState>;
@@ -1,8 +1,10 @@
1
+ import type { Deck } from '@deck.gl/core/typed';
1
2
  /**
2
3
  * Returns the current map state from the MapContext.
3
4
  * @returns {MapContextInterface['state']} The current map state.
4
5
  */
5
6
  export declare function useMap(): import("./map-provider.types").MapState;
7
+ export declare function useRefences(): import("react").MutableRefObject<import("./map-provider.types").MapReferencesState>;
6
8
  /**
7
9
  * Returns the map actions from the MapActionsContext.
8
10
  * @returns {MapContextInterface['actions']} The map actions.
@@ -14,9 +16,16 @@ export declare function useMapActions(): import("./map-provider.types").MapActio
14
16
  * @returns {MapContextInterface['state']['maps'][string]} The map with the given ID.
15
17
  */
16
18
  export declare function useMapByID(id: string): import("./map-provider.types").MapsProps;
19
+ export declare function useMapReferencesByID(id: string): {
20
+ instanceRef: import("react").MutableRefObject<import("./map-provider.types").InstanceMapRef>;
21
+ overlayRef: import("react").MutableRefObject<import("./map-provider.types").OverlayMapRef>;
22
+ getDeckInstance: () => Deck | undefined;
23
+ getOverlayInstance: () => import("./map-provider.types").OverlayMapRef;
24
+ getViewState: () => any;
25
+ };
17
26
  export declare function useMapActionsByID(id: string): {
18
27
  setBasemap: (basemap: import("./map-provider.types").Basemap) => void;
19
28
  setResize: (props: import("./map-provider.types").MapResize) => void;
20
- setViewState: (viewState: import("@deck.gl/core/typed").MapViewState) => void;
29
+ setViewState: (viewState: any) => void;
21
30
  setZoom: (zoom: number) => void;
22
31
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { PickingInfo, MapViewState } from '@deck.gl/core/typed';
2
+ import type { PickingInfo } from '@deck.gl/core/typed';
3
3
  import type { GoogleMapsOverlay, GoogleMapsOverlayProps } from '@deck.gl/google-maps/typed';
4
4
  import type { DeckGLProps, DeckGLRef } from '@deck.gl/react/typed';
5
5
  import type { StyleSpecification } from 'maplibre-gl';
@@ -41,11 +41,16 @@ export type MapResize = {
41
41
  width: number | string;
42
42
  height: number | string;
43
43
  };
44
+ export type MapReferences = {
45
+ instanceRef: MutableRefObject<InstanceMapRef>;
46
+ overlayRef: MutableRefObject<OverlayMapRef>;
47
+ };
48
+ export type MapReferencesState = Record<MapsProps['id'], MapReferences>;
44
49
  /**
45
50
  * Actions that can be performed on the map.
46
51
  */
47
52
  export type MapActionsState = {
48
- setViewState: (id: MapsProps['id'], viewState: MapViewState) => void;
53
+ setViewState: (id: MapsProps['id'], viewState: DeckGLMapsProps['viewState']) => void;
49
54
  setResize: (id: MapsProps['id'], props: MapResize) => void;
50
55
  setBasemap: (id: MapsProps['id'], basemap: Basemap) => void;
51
56
  setZoom: (id: MapsProps['id'], zoom: number) => void;
@@ -55,6 +60,7 @@ export type MapActionsState = {
55
60
  */
56
61
  export type MapContextInterface = {
57
62
  state: MapState;
63
+ references: MutableRefObject<MapReferencesState>;
58
64
  actions: MapActionsState;
59
65
  };
60
66
  /**
@@ -67,9 +73,7 @@ export type Basemap = (typeof GMapsBasemap)[keyof typeof GMapsBasemap] | (typeof
67
73
  export type CommonProps = {
68
74
  id: string;
69
75
  basemap: Basemap;
70
- instanceRef?: MutableRefObject<InstanceMapRef>;
71
- overlayRef?: MutableRefObject<OverlayMapRef>;
72
- } & DeckGLProps;
76
+ } & DeckGLProps & Partial<MapReferences>;
73
77
  /**
74
78
  * Properties for the maps.
75
79
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/ps-react-maps",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-alpha.1",
4
4
  "description": "CARTO's Professional Service React Maps library",
5
5
  "files": [
6
6
  "dist"