@carto/ps-react-maps 3.0.0-canary.2 → 3.0.0-canary.3

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.
@@ -27,5 +27,6 @@ export declare const DEFAULT_MASK_LAYER_PROPS: {
27
27
  lineWidthUnits: string;
28
28
  getLineWidth: number;
29
29
  lineWidthMinPixels: number;
30
+ operation: string;
30
31
  };
31
32
  export declare const DEFAULT_LASSO_TOOLS_MODES: LassoToolsModes<LassoToolsMode>;
@@ -21,7 +21,7 @@ import { LassoToolsControls } from './lasso-tools-control';
21
21
  * </LassoTools>
22
22
  */
23
23
  export declare function LassoTools({ children, mapId, defaultProps: { styles, labels }, layerProps, defaultType, }: LassoToolsProps & {
24
- children: ReactNode;
24
+ children?: ReactNode;
25
25
  }): ReactNode;
26
26
  export declare namespace LassoTools {
27
27
  var Controls: typeof LassoToolsControls;
@@ -0,0 +1,4 @@
1
+ import { LassoToolsStore } from './provider/types';
2
+ export declare function getMaskValues({ values, }: {
3
+ values?: LassoToolsStore['data'][number]['values'];
4
+ }): import('./types').LassoToolsData[];
@@ -1,7 +1,7 @@
1
1
  import { MeasurementToolsControl } from './measurement-tools-control';
2
2
  import { MeasurementToolsProps } from './types';
3
3
  export declare function MeasurementTools({ children, mapId, defaultProps: { styles }, layerProps, textOptions, }: MeasurementToolsProps & {
4
- children: React.ReactNode;
4
+ children?: React.ReactNode;
5
5
  }): import('react').ReactNode;
6
6
  export declare namespace MeasurementTools {
7
7
  var Controls: typeof MeasurementToolsControl;
@@ -43,9 +43,11 @@ export { createMapStore } from './providers/map/store';
43
43
  export type { QuerySource, Source, SourceStore, TableSource, TilesetSource, } from './providers/sources/types';
44
44
  export { ApiBaseUrl, clientID } from './providers/sources/const';
45
45
  export { useSourceStore } from './providers/sources/store';
46
+ export { MapsProvider } from './provider';
46
47
  export { useLayers } from './use-layers';
47
48
  export { useLegend } from './use-legend';
48
49
  export { useMapScreenshot } from './use-map-screenshot';
50
+ export { useSpatialFilter, useLassoToolsSpatialFilter, useViewportSpatialFilter, } from './use-spatial-filter';
49
51
  export type { FieldFormatter, Formatter, Formatters, ObjectToHtmlOptions, Value, } from './utils/object-to-html/types';
50
52
  export { formatterTypes } from './utils/object-to-html/const';
51
53
  export { objectToHtml } from './utils/object-to-html/object-to-html';
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { CategoryRequestOptions, CategoryResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useCategories({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<CategoryRequestOptions, CategoryResponse>): UseQueryResult<CategoryResponse, Error>;
4
+ export declare function useCategories({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<CategoryRequestOptions, CategoryResponse>): UseQueryResult<CategoryResponse, Error>;
5
5
  export declare function CategoriesModel({ children, ...modelProps }: ModelProps<CategoryRequestOptions, CategoryResponse> & {
6
6
  children: (props: UseQueryResult<CategoryResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { FeaturesRequestOptions, FeaturesResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useFeatures({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<FeaturesRequestOptions, FeaturesResponse>): UseQueryResult<FeaturesResponse, Error>;
4
+ export declare function useFeatures({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<FeaturesRequestOptions, FeaturesResponse>): UseQueryResult<FeaturesResponse, Error>;
5
5
  export declare function FeaturesModel({ children, ...modelProps }: ModelProps<FeaturesRequestOptions, FeaturesResponse> & {
6
6
  children: (props: UseQueryResult<FeaturesResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { FormulaRequestOptions, FormulaResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useFormula({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<FormulaRequestOptions, FormulaResponse>): UseQueryResult<FormulaResponse, Error>;
4
+ export declare function useFormula({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<FormulaRequestOptions, FormulaResponse>): UseQueryResult<FormulaResponse, Error>;
5
5
  export declare function FormulaModel({ children, ...modelProps }: ModelProps<FormulaRequestOptions, FormulaResponse> & {
6
6
  children: (props: UseQueryResult<FormulaResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { HistogramRequestOptions, HistogramResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useHistogram({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<HistogramRequestOptions, HistogramResponse>): UseQueryResult<HistogramResponse, Error>;
4
+ export declare function useHistogram({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<HistogramRequestOptions, HistogramResponse>): UseQueryResult<HistogramResponse, Error>;
5
5
  export declare function HistogramModel({ children, ...modelProps }: ModelProps<HistogramRequestOptions, HistogramResponse> & {
6
6
  children: (props: UseQueryResult<HistogramResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { RangeRequestOptions, RangeResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useRange({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<RangeRequestOptions, RangeResponse>): UseQueryResult<RangeResponse, Error>;
4
+ export declare function useRange({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<RangeRequestOptions, RangeResponse>): UseQueryResult<RangeResponse, Error>;
5
5
  export declare function RangeModel({ children, ...modelProps }: ModelProps<RangeRequestOptions, RangeResponse> & {
6
6
  children: (props: UseQueryResult<RangeResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ScatterRequestOptions, ScatterResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useScatter({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<ScatterRequestOptions, ScatterResponse>): UseQueryResult<ScatterResponse, Error>;
4
+ export declare function useScatter({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<ScatterRequestOptions, ScatterResponse>): UseQueryResult<ScatterResponse, Error>;
5
5
  export declare function ScatterModel({ children, ...modelProps }: ModelProps<ScatterRequestOptions, ScatterResponse> & {
6
6
  children: (props: UseQueryResult<ScatterResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { TableRequestOptions, TableResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useTable({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<TableRequestOptions, TableResponse>): UseQueryResult<TableResponse, Error>;
4
+ export declare function useTable({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<TableRequestOptions, TableResponse>): UseQueryResult<TableResponse, Error>;
5
5
  export declare function TableModel({ children, ...modelProps }: ModelProps<TableRequestOptions, TableResponse> & {
6
6
  children: (props: UseQueryResult<TableResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { TimeSeriesRequestOptions, TimeSeriesResponse } from '@carto/api-client';
3
3
  import { ModelProps } from './types';
4
- export declare function useTimeSeries({ accessToken, sourceId, widgetProps, useQueryProps, }: ModelProps<TimeSeriesRequestOptions, TimeSeriesResponse>): UseQueryResult<TimeSeriesResponse, Error>;
4
+ export declare function useTimeSeries({ accessToken, sourceId, widgetProps, useQueryProps: { enabled, ...useQueryProps }, }: ModelProps<TimeSeriesRequestOptions, TimeSeriesResponse>): UseQueryResult<TimeSeriesResponse, Error>;
5
5
  export declare function TimeSeriesModel({ children, ...modelProps }: ModelProps<TimeSeriesRequestOptions, TimeSeriesResponse> & {
6
6
  children: (props: UseQueryResult<TimeSeriesResponse, Error>) => React.ReactNode;
7
7
  }): import('react').ReactNode;
@@ -1 +1 @@
1
- export declare function useWidgetModel(accessToken: string, sourceId: string): import('@carto/api-client').WidgetRemoteSource<import('node_modules/@carto/api-client/build/widget-sources/widget-source').WidgetSourceProps> | null;
1
+ export declare function useWidgetModel(accessToken: string, sourceId: string): import('@carto/api-client').WidgetRemoteSource<import('@carto/api-client').WidgetSourceProps> | null;
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { MapProviderProps } from './providers/map/types';
3
+ import { LassoToolsProviderProps } from './editable/lasso-tools/provider/types';
4
+ import { MeasurementToolsProviderProps } from './editable/measurement-tools/provider/types';
5
+ interface Props {
6
+ maps: MapProviderProps['values'];
7
+ lassoTools?: LassoToolsProviderProps['values'];
8
+ measureTools?: MeasurementToolsProviderProps['values'];
9
+ }
10
+ export declare function MapsProvider({ children, maps, lassoTools, measureTools, }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -1,19 +1,58 @@
1
- import { WidgetRemoteSource, WidgetRemoteSourceProps, VectorQuerySourceOptions, VectorTableSourceOptions, VectorTilesetSourceOptions, TileFormat } from '@carto/api-client';
1
+ import { WidgetRemoteSource, WidgetRemoteSourceProps, VectorQuerySourceOptions, VectorTableSourceOptions, VectorTilesetSourceOptions, TileFormat, BoundaryQuerySourceOptions, BoundaryTableSourceOptions, H3QuerySourceOptions, QuadbinQuerySourceOptions, H3TilesetSourceOptions, QuadbinTilesetSourceOptions, H3TableSourceOptions, QuadbinTableSourceOptions, RasterSourceOptions, RasterMetadata } from '@carto/api-client';
2
+ type _Omit<T, P extends string = ''> = Omit<T, 'accessToken' | P>;
3
+ type OmitQuery<T, P extends string = ''> = _Omit<T, 'sqlQuery' | P>;
4
+ type OmitTable<T, P extends string = ''> = _Omit<T, 'tableName' | P>;
2
5
  export type QuerySource = {
3
6
  type: 'query';
4
- } & Omit<VectorQuerySourceOptions, 'accessToken' | 'sqlQuery'>;
7
+ } & OmitQuery<VectorQuerySourceOptions>;
8
+ export type H3QuerySource = {
9
+ type: 'query+h3';
10
+ } & OmitQuery<H3QuerySourceOptions>;
11
+ export type QuadbinQuerySource = {
12
+ type: 'query+quadbin';
13
+ } & OmitQuery<QuadbinQuerySourceOptions>;
14
+ export type BoundaryQuerySource = {
15
+ type: 'query+boundary';
16
+ } & _Omit<BoundaryQuerySourceOptions, 'tilesetTableName'>;
17
+ export type AllQuerySource = QuerySource | H3QuerySource | QuadbinQuerySource | BoundaryQuerySource;
5
18
  export type TilesetSource = {
6
19
  type: 'tileset';
7
20
  tileFormat: TileFormat;
8
- } & Omit<VectorTilesetSourceOptions, 'accessToken' | 'tableName'>;
21
+ } & OmitTable<VectorTilesetSourceOptions>;
22
+ export type H3TilesetSource = {
23
+ type: 'tileset+h3';
24
+ tileFormat: TileFormat;
25
+ } & OmitTable<H3TilesetSourceOptions>;
26
+ export type QuadbinTilesetSource = {
27
+ type: 'tileset+quadbin';
28
+ tileFormat: TileFormat;
29
+ } & OmitTable<QuadbinTilesetSourceOptions>;
30
+ export type AllTilesetSource = TilesetSource | H3TilesetSource | QuadbinTilesetSource;
9
31
  export type TableSource = {
10
32
  type: 'table';
11
- } & Omit<VectorTableSourceOptions, 'accessToken' | 'tableName'>;
12
- export type Source = (QuerySource | TilesetSource | TableSource) & {
33
+ } & OmitTable<VectorTableSourceOptions>;
34
+ export type h3TableSource = {
35
+ type: 'table+h3';
36
+ } & OmitTable<H3TableSourceOptions>;
37
+ export type QuadbinTableSource = {
38
+ type: 'table+quadbin';
39
+ } & OmitTable<QuadbinTableSourceOptions>;
40
+ export type BoundaryTableSource = {
41
+ type: 'table+boundary';
42
+ } & _Omit<BoundaryTableSourceOptions, 'tilesetTableName'>;
43
+ export type AllTableSource = TableSource | h3TableSource | QuadbinTableSource | BoundaryTableSource;
44
+ export type RasterQuadbinTilesetSource = {
45
+ type: 'raster';
46
+ tileFormat: TileFormat;
47
+ rasterMetadata?: RasterMetadata;
48
+ } & OmitTable<RasterSourceOptions>;
49
+ export type AllRasterSource = RasterQuadbinTilesetSource;
50
+ export type Source = (AllQuerySource | AllTilesetSource | AllTableSource | AllRasterSource) & {
13
51
  data: string;
14
- widgets?: WidgetRemoteSource<WidgetRemoteSourceProps>;
52
+ widgets?: WidgetRemoteSource<WidgetRemoteSourceProps> | null;
15
53
  };
16
54
  export interface SourceStore {
17
55
  sources: Record<string, Source>;
18
56
  setSource: (id: string, source?: Partial<Source>) => void;
19
57
  }
58
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { Class, ValueOf } from 'type-fest';
2
- import { MutableRefObject, ReactNode, RefObject } from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
3
  import { Layer, LayerProps, MapViewState, PickingInfo, ViewStateChangeParameters } from '@deck.gl/core';
4
4
  import { DeckGLProps, DeckGLRef } from '@deck.gl/react';
5
5
  import { MapRef } from 'react-map-gl/maplibre';
@@ -9,7 +9,7 @@ import { ViewStateSlice } from './providers/map/types';
9
9
  export * from '../types/common';
10
10
  export type BasemapKey = keyof typeof CartoBasemaps | keyof typeof GmapsBasemap;
11
11
  export type BasemapType = ValueOf<typeof MapsTypes>;
12
- export interface Tooltip extends PickingInfo {
12
+ export interface Tooltip<T = unknown> extends PickingInfo<T> {
13
13
  text?: string | undefined;
14
14
  html?: string | undefined;
15
15
  className?: string | undefined;
@@ -17,7 +17,7 @@ export interface Tooltip extends PickingInfo {
17
17
  }
18
18
  export interface LayerType<T extends Class<Layer> = Class<Layer>, P extends LayerProps = LayerProps> {
19
19
  type: T | null;
20
- props?: Partial<P>;
20
+ props: Partial<P>;
21
21
  }
22
22
  export type InstanceRef = DeckGLRef;
23
23
  export type OverlayRef = MapRef | google.maps.Map | null | undefined;
@@ -28,7 +28,7 @@ export type GmapsProps = Omit<MapProps, 'mapTypeId'> & {
28
28
  export interface DeckGLComponentProps extends Omit<DeckGLProps, 'layers' | 'onLoad'> {
29
29
  basemap?: BasemapKey;
30
30
  instanceRef?: RefObject<InstanceRef>;
31
- overlayRef?: MutableRefObject<OverlayRef>;
31
+ overlayRef?: RefObject<OverlayRef>;
32
32
  layers: LayerType[];
33
33
  gmapsProps?: GmapsProps;
34
34
  onLoad?: (value: boolean) => void;
@@ -43,7 +43,7 @@ export interface LayersLoadedProps {
43
43
  id: MapComponentProps['id'];
44
44
  }
45
45
  export interface ZoomControl {
46
- id: MapComponentProps['id'];
46
+ mapId: MapComponentProps['id'];
47
47
  children: (props: ZoomControlChildrenProps) => ReactNode;
48
48
  }
49
49
  export interface ZoomControlChildrenProps {
@@ -1,4 +1,4 @@
1
1
  import { MapComponentProps } from './types';
2
- export declare function useLayers({ id }: {
3
- id: MapComponentProps['id'];
2
+ export declare function useLayers({ mapId }: {
3
+ mapId: MapComponentProps['id'];
4
4
  }): import('.').Layer[];
@@ -0,0 +1,15 @@
1
+ import { MapComponentProps } from './types';
2
+ import { SpatialFilter } from '@carto/api-client';
3
+ export declare function useSpatialFilter({ mapId, }: {
4
+ mapId: MapComponentProps['id'];
5
+ }): {
6
+ spatialFilter: SpatialFilter | undefined;
7
+ lassoToolsSpatialFilter: SpatialFilter | undefined;
8
+ viewportSpatialFilter: SpatialFilter | undefined;
9
+ };
10
+ export declare function useViewportSpatialFilter({ mapId, }: {
11
+ mapId: MapComponentProps['id'];
12
+ }): SpatialFilter | undefined;
13
+ export declare function useLassoToolsSpatialFilter({ mapId, }: {
14
+ mapId: MapComponentProps['id'];
15
+ }): import('geojson').MultiPolygon | undefined;
@@ -1,2 +1,2 @@
1
1
  import { ZoomControl } from './types';
2
- export declare function ZoomControls({ children, id }: ZoomControl): import('react').ReactNode;
2
+ export declare function ZoomControls({ children, mapId }: ZoomControl): import('react').ReactNode;
package/package.json CHANGED
@@ -1,37 +1,38 @@
1
1
  {
2
2
  "name": "@carto/ps-react-maps",
3
- "version": "3.0.0-canary.2",
3
+ "version": "3.0.0-canary.3",
4
4
  "description": "CARTO's Professional Service React DeckGL library",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@turf/turf": "7.1.0"
7
+ "@turf/turf": "7.2.0"
8
8
  },
9
9
  "devDependencies": {
10
- "@tanstack/react-query": "5.61.0",
11
- "@carto/api-client": "0.5.0-alpha.0",
10
+ "@tanstack/react-query": "5.64.2",
11
+ "@carto/api-client": "0.5.0-alpha.3",
12
12
  "@deck.gl-community/editable-layers": "9.0.3",
13
- "@deck.gl/aggregation-layers": "9.0.38",
14
- "@deck.gl/carto": "9.0.38",
15
- "@deck.gl/core": "9.0.38",
16
- "@deck.gl/extensions": "9.0.38",
17
- "@deck.gl/geo-layers": "9.0.38",
18
- "@deck.gl/google-maps": "9.0.38",
19
- "@deck.gl/layers": "9.0.38",
20
- "@deck.gl/mesh-layers": "9.0.38",
21
- "@deck.gl/react": "9.0.38",
13
+ "@deck.gl/aggregation-layers": "9.0.40",
14
+ "@deck.gl/carto": "9.0.40",
15
+ "@deck.gl/core": "9.0.40",
16
+ "@deck.gl/extensions": "9.0.40",
17
+ "@deck.gl/geo-layers": "9.0.40",
18
+ "@deck.gl/google-maps": "9.0.40",
19
+ "@deck.gl/layers": "9.0.40",
20
+ "@deck.gl/mesh-layers": "9.0.40",
21
+ "@deck.gl/react": "9.0.40",
22
+ "@turf/helpers": "7.2.0",
22
23
  "@types/geojson": "7946.0.15",
23
- "@vis.gl/react-google-maps": "1.4.3",
24
+ "@vis.gl/react-google-maps": "1.5.0",
24
25
  "convert-units": "3.0.0-beta.7",
25
26
  "html2canvas": "1.4.1",
26
27
  "maplibre-gl": "4.7.1",
27
28
  "react-map-gl": "7.1.8",
28
29
  "zustand": "5.0.3",
29
- "@carto/ps-utils": "2.0.0-canary.2"
30
+ "@carto/ps-utils": "2.0.0-canary.3"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "@tanstack/react-query": "^5.61.0",
33
- "@carto/api-client": "^0.5.0-alpha.0",
34
- "@deck.gl-community/editable-layers": "^9.0.0",
34
+ "@carto/api-client": "^0.5.0-alpha.1",
35
+ "@deck.gl-community/editable-layers": "^9.0.3",
35
36
  "@deck.gl/aggregation-layers": "^9.0.0",
36
37
  "@deck.gl/carto": "^9.0.0",
37
38
  "@deck.gl/core": "^9.0.0",
@@ -41,6 +42,7 @@
41
42
  "@deck.gl/layers": "^9.0.0",
42
43
  "@deck.gl/mesh-layers": "^9.0.0",
43
44
  "@deck.gl/react": "^9.0.0",
45
+ "@turf/helpers": "^7.2.0",
44
46
  "@vis.gl/react-google-maps": "^1.0.0",
45
47
  "convert-units": "3.0.0-beta.7",
46
48
  "html2canvas": "^1.4.1",
@@ -48,7 +50,7 @@
48
50
  "react": "^18.0.0 || ^19.0.0",
49
51
  "react-map-gl": "^7.1.8",
50
52
  "zustand": "^5.0.0",
51
- "@carto/ps-utils": "2.0.0-canary.2"
53
+ "@carto/ps-utils": "2.0.0-canary.3"
52
54
  },
53
55
  "exports": {
54
56
  ".": {