@superrouteca/smap-react 1.2.16 → 1.5.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.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { DataOptions, BasemapOverride, Map, CustomStyleName, FileInput, PointOptions, LineOptions, PolygonOptions, GeoJSONFeature, PopupContent, FileFormat, StyleLayer as StyleLayer$1, StyleFlavor, BasemapOverrides, LngLatLike, PopupOptions, ToolsOptions, ToolsChangeEvent, LayerData, Slot, ToolPosition, ToolKind, RasterLayerOptions, CustomMarkerOptions, DrawToolOptions, DrawEvent, DrawTool as DrawTool$1, HeatmapOptions, ModelOptions, MapPlanEditorOptions, PlanCredentials, Plan, PlanChangeEvent, PlanEditorError, PlanSnapshotEvent, MapPlanEditor, PlanEditorState, ArcGisLayerOptions, ReadOptions, LayerDescription, StyleSource, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, GeoJSONFeatureCollection } from '@superrouteca/smap';
4
- export { ArcGisLayerOptions, BasemapOverrides, GeoJSONFeature, GeoJSONFeatureCollection, InsertChoice, InsertChoices, LayerData, LayerDescription, LineOptions, LngLatLike, MapPlanEditor, MapPlanEditorOptions, MarkerOptions, Plan, PlanChangeEvent, PlanCredentials, PlanEditOutcome, PlanEditorError, PlanEditorState, PlanJob, PlanLanguage, PlanLocation, PlanPreview, PlanResult, PlanRoute, PlanSnapshotEvent, PlanState, PlanSummary, PlanTextKey, PlanTokenAnswer, PlanVehicle, PlanViolation, PointOptions, PolygonOptions, PopupContent, PopupOptions, PricedRoute, PricedStop, RasterLayerOptions, ReadOptions, Slot, StyleFlavor, StyleSource, StyleValue, ToolKind, ToolLayers, ToolPosition, ToolState, ToolsChangeEvent, ToolsOptions, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, planTexts, popupTemplate } from '@superrouteca/smap';
3
+ import { DataOptions, BasemapOverride, Map, GeoJSONFeature, CustomStyleName, FileInput, PointOptions, LineOptions, PolygonOptions, PopupContent, FileFormat, StyleLayer as StyleLayer$1, StyleFlavor, BasemapOverrides, LngLatLike, PopupOptions, ToolsOptions, ToolsChangeEvent, UnavailableEvent, LayerData, Slot, LayerEvent, CircleOptions, ClusterInfo, SearchToolOptions, SearchResult, ToolPosition, ToolKind, RasterLayerOptions, CustomMarkerOptions, DrawToolOptions, DrawEvent, DrawingEvent, DrawTool as DrawTool$1, HeatmapOptions, ImageOptions, ImageInput, ModelOptions, ThreeLayerOptions, MapPlanEditorOptions, PlanCredentials, Plan, PlanChangeEvent, PlanEditorError, PlanSnapshotEvent, MapPlanEditor, PlanEditorState, ArcGisLayerOptions, ReadOptions, LayerDescription, StyleSource, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, GeoJSONFeatureCollection } from '@superrouteca/smap';
4
+ export { ArcGisLayerOptions, BasemapOverrides, CircleOptions, ClusterInfo, ClusterOptions, DrawEvent, DrawShape, DrawStyle, DrawToolOptions, DrawingEvent, EventLngLat, ExportOptions, FeatureAt, FitInput, FitOptions, FlyToOptions, GeoJSONFeature, GeoJSONFeatureCollection, HeatmapOptions, ImageInput, ImageOptions, InsertChoice, InsertChoices, LayerData, LayerDescription, LayerEvent, LineLook, LineOptions, LngLatLike, MapEvent, MapEventType, MapPlanEditor, MapPlanEditorOptions, MarkerOptions, ModelOptions, PinIcon, Plan, PlanChangeEvent, PlanCredentials, PlanEditOutcome, PlanEditorError, PlanEditorState, PlanJob, PlanLanguage, PlanLocation, PlanPreview, PlanResult, PlanRoute, PlanSnapshotEvent, PlanState, PlanSummary, PlanTextKey, PlanTokenAnswer, PlanVehicle, PlanViolation, PointLook, PointOptions, PolygonLook, PolygonOptions, PopupContent, PopupOptions, PricedRoute, PricedStop, RasterLayerOptions, ReadOptions, RotationAlignment, SearchResult, SearchToolOptions, Slot, StyleFlavor, StyleSource, StyleValue, ThreeLayerOptions, ToolKind, ToolLayers, ToolPosition, ToolState, ToolsChangeEvent, ToolsOptions, UnavailableEvent, UnavailableReason, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, planTexts, popupTemplate } from '@superrouteca/smap';
5
5
 
6
6
  /** A Style Specification v8 layer object, passed through unchanged. */
7
7
  type StyleLayerSpec = StyleLayer$1;
@@ -76,6 +76,22 @@ interface SMapProps {
76
76
  tools?: ToolsOptions;
77
77
  /** Called after every change of the tools' visibility; the map keeps no state itself. */
78
78
  onToolsChange?: (event: ToolsChangeEvent) => void;
79
+ /**
80
+ * (G36) The wheel zooms only with Ctrl or ⌘ held and one finger scrolls the page (two move the map), with a hint in
81
+ * the map's language: for small maps in a page that scrolls. Read when the map is created.
82
+ */
83
+ cooperativeGestures?: boolean;
84
+ /**
85
+ * (G32) false: no notice in the map's area when the map cannot be shown (`onUnavailable` is still called). Read when
86
+ * the map is created.
87
+ */
88
+ unavailableNotice?: boolean;
89
+ /**
90
+ * (G32) The map cannot be shown: sMap refuses this site (`forbidden`), no node answers (`unreachable`) or the browser
91
+ * cannot draw it (`unsupported`). Called once per map, also when it happens before the map is ready (`onReady` may
92
+ * then never come); the page keeps working.
93
+ */
94
+ onUnavailable?: (event: UnavailableEvent) => void;
79
95
  /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */
80
96
  mapOptions?: Record<string, unknown>;
81
97
  /** Called once the first style has loaded, with the map. */
@@ -118,16 +134,50 @@ interface LayerProps<O> {
118
134
  * Without one the layer draws on top, in the order added, as in 1.0.
119
135
  */
120
136
  slot?: Slot;
137
+ /** The pointer came onto a feature of this layer, or left its features (null); same as `options.onHover`. */
138
+ onHover?: (feature: GeoJSONFeature | null, event: LayerEvent) => void;
139
+ /** A double click on a feature of this layer (the map does not zoom); same as `options.onDblClick`. */
140
+ onDblClick?: (feature: GeoJSONFeature, event: LayerEvent) => void;
141
+ /** A right click on a feature of this layer (the browser's menu stays closed); same as `options.onContextMenu`. */
142
+ onContextMenu?: (feature: GeoJSONFeature, event: LayerEvent) => void;
143
+ /**
144
+ * Feature states by feature id (the layer's idProperty value, else the feature's id, else `'#<index>'`), e.g.
145
+ * `{ [selectedId]: { selected: true } }`: drawn by the layer's `options.states` looks. Only the values that changed
146
+ * are sent (`setFeatureState` / `removeFeatureState`); values the component did not set (such as `hover` of
147
+ * `hoverState`) are left alone. Set again when the layer is drawn again.
148
+ */
149
+ featureStates?: FeatureStates;
150
+ }
151
+ /** Feature states by feature id: `{ 'stop-7': { selected: true } }`. */
152
+ type FeatureStates = Record<string, Record<string, unknown>>;
153
+ interface PointsProps extends LayerProps<PointOptions> {
154
+ /**
155
+ * A click on a cluster (with `options.cluster`): the cluster with its points (`leaves()`), its feature and the
156
+ * event. The map still zooms in unless `cluster.zoomOnClick` is false.
157
+ */
158
+ onClusterClick?: (cluster: ClusterInfo, feature: GeoJSONFeature, event: {
159
+ originalEvent: Event;
160
+ lngLat: [number, number];
161
+ point?: {
162
+ x: number;
163
+ y: number;
164
+ };
165
+ }) => void;
121
166
  }
122
- type PointsProps = LayerProps<PointOptions>;
123
167
  type LinesProps = LayerProps<LineOptions>;
124
168
  type PolygonsProps = LayerProps<PolygonOptions>;
169
+ type CirclesProps = LayerProps<CircleOptions>;
125
170
  /** Points at any scale, clustered or not. Must be inside `<SMap>`. */
126
171
  declare function Points(props: PointsProps): null;
127
172
  /** Lines (routes, tracks). Must be inside `<SMap>`. */
128
173
  declare function Lines(props: LinesProps): null;
129
174
  /** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */
130
175
  declare function Polygons(props: PolygonsProps): null;
176
+ /**
177
+ * Circles of a radius in metres around points (`addCircles`, G26), true to the ground at every zoom: every option of
178
+ * `<Polygons>` with `radius` (metres, per feature too) and `steps`. Must be inside `<SMap>`.
179
+ */
180
+ declare function Circles(props: CirclesProps): null;
131
181
 
132
182
  interface ToolProps {
133
183
  /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */
@@ -161,6 +211,21 @@ interface ToolProps {
161
211
  * Removing it removes the tool.
162
212
  */
163
213
  declare function Tool(props: ToolProps): react.JSX.Element | null;
214
+ interface SearchToolProps extends Omit<SearchToolOptions, 'search' | 'onPick' | 'options'> {
215
+ /** The tool id, unique on the map. */
216
+ id: string;
217
+ /** Your results for the text typed (the SDK never calls a geocoder); the newest function is called. */
218
+ search: (text: string) => SearchResult[] | Promise<SearchResult[]>;
219
+ /** Called with the result picked, after the map went to it. */
220
+ onPick?: (result: SearchResult) => void;
221
+ }
222
+ /**
223
+ * The search box tool (G35): your own results in a list, chosen with the keyboard or a click, the map flying to the
224
+ * pick (or fitting its `bounds`). Shown and hidden by the tools control as any tool; removing it removes the tool.
225
+ * `placeholder`, `minChars`, `maxResults`, `zoom`, `debounce`, `duration`, `label` or `position` changing makes the
226
+ * box again. Must be inside `<SMap>`.
227
+ */
228
+ declare function SearchTool(props: SearchToolProps): null;
164
229
 
165
230
  interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {
166
231
  /** The layer id, unique on the map. */
@@ -169,6 +234,11 @@ interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {
169
234
  data: LayerData;
170
235
  /** The React content of one marker (rendered again when the feature's properties change). */
171
236
  render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;
237
+ /**
238
+ * Feature states by marker id, e.g. `{ [selectedId]: { selected: true } }`: each true value puts the class
239
+ * `smap-state-<name>` on the marker's element. Only what changed is sent.
240
+ */
241
+ featureStates?: FeatureStates;
172
242
  }
173
243
  /**
174
244
  * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and
@@ -181,14 +251,20 @@ interface HeatmapProps {
181
251
  data: LayerData;
182
252
  options?: HeatmapOptions;
183
253
  }
184
- /** A heat map of points (G7). Must be inside `<SMap>`. */
254
+ /**
255
+ * A heat map of points (G7): `options.blur` and `options.minOpacity` (G33) beside radius, weight, intensity and
256
+ * colours. Must be inside `<SMap>`.
257
+ */
185
258
  declare function Heatmap(props: HeatmapProps): null;
186
259
  interface ModelsProps {
187
260
  id: string;
188
261
  data: LayerData;
189
262
  options: ModelOptions;
190
263
  }
191
- /** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */
264
+ /**
265
+ * glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`); `options.color` tints the model's
266
+ * `tint…` materials per feature (G30). Must be inside `<SMap>`.
267
+ */
192
268
  declare function Models(props: ModelsProps): null;
193
269
  interface CanvasTilesProps {
194
270
  id: string;
@@ -198,14 +274,54 @@ interface CanvasTilesProps {
198
274
  }
199
275
  /** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */
200
276
  declare function CanvasTiles(props: CanvasTilesProps): null;
201
- interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {
277
+ interface DrawToolProps extends Omit<DrawToolOptions, 'onChange' | 'onDrawing'> {
202
278
  /** Called after each change: created, edited or deleted, with every shape. */
203
279
  onChange?: (event: DrawEvent) => void;
280
+ /**
281
+ * (G28) The shape being drawn or edited, on every change: its length, area (and radius) so far and whether it is
282
+ * valid (`allowSelfIntersection: false`). `measure`, `style`, `allowSelfIntersection` and `snapLayers` are the
283
+ * tool's other G28 options.
284
+ */
285
+ onDrawing?: (event: DrawingEvent) => void;
204
286
  /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */
205
287
  onTool?: (tool: DrawTool$1 | null) => void;
206
288
  }
207
289
  /** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */
208
290
  declare function DrawTool(props: DrawToolProps): null;
291
+ /**
292
+ * Puts an image of yours on the map under `id` (`addImage`, G25) while the component using it is mounted, for
293
+ * `icon` / `iconProperty` of points and `marker.icon` of pins: an image, a canvas, ImageData, pixels or a URL loaded
294
+ * for you. A new `image` (another URL, or another object), `pixelRatio` or `sdf` puts it again; unmounting removes it.
295
+ * Answers whether the image is on the map. Must be inside `<SMap>`.
296
+ */
297
+ declare function useMapImage(id: string, image: ImageInput | null | undefined, options?: ImageOptions & {
298
+ onError?: (error: unknown) => void;
299
+ }): boolean;
300
+ interface MapImageProps extends ImageOptions {
301
+ /** The image id named by `icon`, `iconProperty` or `marker.icon`. */
302
+ id: string;
303
+ /** An image, a canvas, an ImageBitmap, ImageData, `{ width, height, data }` pixels, or a URL loaded for you. */
304
+ image: ImageInput;
305
+ /** Called once the image is on the map. */
306
+ onLoad?: () => void;
307
+ /** Called when the image cannot be loaded. */
308
+ onError?: (error: unknown) => void;
309
+ }
310
+ /** An image of yours on the map for as long as it is mounted (`useMapImage`). Must be inside `<SMap>`. */
311
+ declare function MapImage(props: MapImageProps): null;
312
+ interface ThreeLayerProps extends ThreeLayerOptions {
313
+ /** The layer id, unique on the map. */
314
+ id: string;
315
+ /** Called when the layer cannot be added (`sMap.useThree(THREE, GLTFLoader)` was not called first). */
316
+ onError?: (error: unknown) => void;
317
+ }
318
+ /**
319
+ * Your own three.js objects in the map's 3D view (`addThreeLayer`, G31; web and WebGL only): `onAdd(scene, camera,
320
+ * map)` adds them, `render` runs before each frame (return true for another frame), `onRemove` when the layer goes;
321
+ * place them with `sMap.mercator`. The newest callbacks are called; `slot`, `before`, `minzoom` or `zIndex` changing
322
+ * adds the layer again. Must be inside `<SMap>`.
323
+ */
324
+ declare function ThreeLayer(props: ThreeLayerProps): null;
209
325
 
210
326
  interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch' | 'now'> {
211
327
  /**
@@ -352,5 +468,5 @@ interface Formats {
352
468
  */
353
469
  declare const formats: Formats;
354
470
 
355
- export { ArcGisLayer, CanvasTiles, CustomMarkers, Data, DeckLayer, DrawTool, Heatmap, Layers, Lines, Models, PlanEditor, Points, Polygons, RasterLayer, SMap, Source, StyleLayer, Tool, VectorTiles, WmsLayer, WmtsLayer, formats, usePlanEditor, useRasterUrl, useSMap };
356
- export type { AddDataOptions, ArcGisLayerProps, BasemapClassOverride, CanvasTilesProps, CustomMarkersProps, CustomStyle, DataFormat, DataInput, DataLayerOptions, DataProps, DeckLayerLike, DeckLayerProps, DrawToolProps, HeatmapProps, InteropMethods, LayerProps, LayersProps, LinesProps, ModelsProps, PlanEditorProps, PointsProps, PolygonsProps, PopupFunction, RasterLayerProps, SMapMap, SMapProps, SourceProps, StyleLayerProps, StyleLayerSpec, TapHandler, ToolProps, UsePlanEditorResult, VectorTilesProps, WmsLayerProps, WmtsLayerProps };
471
+ export { ArcGisLayer, CanvasTiles, Circles, CustomMarkers, Data, DeckLayer, DrawTool, Heatmap, Layers, Lines, MapImage, Models, PlanEditor, Points, Polygons, RasterLayer, SMap, SearchTool, Source, StyleLayer, ThreeLayer, Tool, VectorTiles, WmsLayer, WmtsLayer, formats, useMapImage, usePlanEditor, useRasterUrl, useSMap };
472
+ export type { AddDataOptions, ArcGisLayerProps, BasemapClassOverride, CanvasTilesProps, CirclesProps, CustomMarkersProps, CustomStyle, DataFormat, DataInput, DataLayerOptions, DataProps, DeckLayerLike, DeckLayerProps, DrawToolProps, FeatureStates, HeatmapProps, InteropMethods, LayerProps, LayersProps, LinesProps, MapImageProps, ModelsProps, PlanEditorProps, PointsProps, PolygonsProps, PopupFunction, RasterLayerProps, SMapMap, SMapProps, SearchToolProps, SourceProps, StyleLayerProps, StyleLayerSpec, TapHandler, ThreeLayerProps, ToolProps, UsePlanEditorResult, VectorTilesProps, WmsLayerProps, WmtsLayerProps };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { DataOptions, BasemapOverride, Map, CustomStyleName, FileInput, PointOptions, LineOptions, PolygonOptions, GeoJSONFeature, PopupContent, FileFormat, StyleLayer as StyleLayer$1, StyleFlavor, BasemapOverrides, LngLatLike, PopupOptions, ToolsOptions, ToolsChangeEvent, LayerData, Slot, ToolPosition, ToolKind, RasterLayerOptions, CustomMarkerOptions, DrawToolOptions, DrawEvent, DrawTool as DrawTool$1, HeatmapOptions, ModelOptions, MapPlanEditorOptions, PlanCredentials, Plan, PlanChangeEvent, PlanEditorError, PlanSnapshotEvent, MapPlanEditor, PlanEditorState, ArcGisLayerOptions, ReadOptions, LayerDescription, StyleSource, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, GeoJSONFeatureCollection } from '@superrouteca/smap';
4
- export { ArcGisLayerOptions, BasemapOverrides, GeoJSONFeature, GeoJSONFeatureCollection, InsertChoice, InsertChoices, LayerData, LayerDescription, LineOptions, LngLatLike, MapPlanEditor, MapPlanEditorOptions, MarkerOptions, Plan, PlanChangeEvent, PlanCredentials, PlanEditOutcome, PlanEditorError, PlanEditorState, PlanJob, PlanLanguage, PlanLocation, PlanPreview, PlanResult, PlanRoute, PlanSnapshotEvent, PlanState, PlanSummary, PlanTextKey, PlanTokenAnswer, PlanVehicle, PlanViolation, PointOptions, PolygonOptions, PopupContent, PopupOptions, PricedRoute, PricedStop, RasterLayerOptions, ReadOptions, Slot, StyleFlavor, StyleSource, StyleValue, ToolKind, ToolLayers, ToolPosition, ToolState, ToolsChangeEvent, ToolsOptions, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, planTexts, popupTemplate } from '@superrouteca/smap';
3
+ import { DataOptions, BasemapOverride, Map, GeoJSONFeature, CustomStyleName, FileInput, PointOptions, LineOptions, PolygonOptions, PopupContent, FileFormat, StyleLayer as StyleLayer$1, StyleFlavor, BasemapOverrides, LngLatLike, PopupOptions, ToolsOptions, ToolsChangeEvent, UnavailableEvent, LayerData, Slot, LayerEvent, CircleOptions, ClusterInfo, SearchToolOptions, SearchResult, ToolPosition, ToolKind, RasterLayerOptions, CustomMarkerOptions, DrawToolOptions, DrawEvent, DrawingEvent, DrawTool as DrawTool$1, HeatmapOptions, ImageOptions, ImageInput, ModelOptions, ThreeLayerOptions, MapPlanEditorOptions, PlanCredentials, Plan, PlanChangeEvent, PlanEditorError, PlanSnapshotEvent, MapPlanEditor, PlanEditorState, ArcGisLayerOptions, ReadOptions, LayerDescription, StyleSource, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, GeoJSONFeatureCollection } from '@superrouteca/smap';
4
+ export { ArcGisLayerOptions, BasemapOverrides, CircleOptions, ClusterInfo, ClusterOptions, DrawEvent, DrawShape, DrawStyle, DrawToolOptions, DrawingEvent, EventLngLat, ExportOptions, FeatureAt, FitInput, FitOptions, FlyToOptions, GeoJSONFeature, GeoJSONFeatureCollection, HeatmapOptions, ImageInput, ImageOptions, InsertChoice, InsertChoices, LayerData, LayerDescription, LayerEvent, LineLook, LineOptions, LngLatLike, MapEvent, MapEventType, MapPlanEditor, MapPlanEditorOptions, MarkerOptions, ModelOptions, PinIcon, Plan, PlanChangeEvent, PlanCredentials, PlanEditOutcome, PlanEditorError, PlanEditorState, PlanJob, PlanLanguage, PlanLocation, PlanPreview, PlanResult, PlanRoute, PlanSnapshotEvent, PlanState, PlanSummary, PlanTextKey, PlanTokenAnswer, PlanVehicle, PlanViolation, PointLook, PointOptions, PolygonLook, PolygonOptions, PopupContent, PopupOptions, PricedRoute, PricedStop, RasterLayerOptions, ReadOptions, RotationAlignment, SearchResult, SearchToolOptions, Slot, StyleFlavor, StyleSource, StyleValue, ThreeLayerOptions, ToolKind, ToolLayers, ToolPosition, ToolState, ToolsChangeEvent, ToolsOptions, UnavailableEvent, UnavailableReason, VectorTilesOptions, WmsLayerOptions, WmtsLayerOptions, planTexts, popupTemplate } from '@superrouteca/smap';
5
5
 
6
6
  /** A Style Specification v8 layer object, passed through unchanged. */
7
7
  type StyleLayerSpec = StyleLayer$1;
@@ -76,6 +76,22 @@ interface SMapProps {
76
76
  tools?: ToolsOptions;
77
77
  /** Called after every change of the tools' visibility; the map keeps no state itself. */
78
78
  onToolsChange?: (event: ToolsChangeEvent) => void;
79
+ /**
80
+ * (G36) The wheel zooms only with Ctrl or ⌘ held and one finger scrolls the page (two move the map), with a hint in
81
+ * the map's language: for small maps in a page that scrolls. Read when the map is created.
82
+ */
83
+ cooperativeGestures?: boolean;
84
+ /**
85
+ * (G32) false: no notice in the map's area when the map cannot be shown (`onUnavailable` is still called). Read when
86
+ * the map is created.
87
+ */
88
+ unavailableNotice?: boolean;
89
+ /**
90
+ * (G32) The map cannot be shown: sMap refuses this site (`forbidden`), no node answers (`unreachable`) or the browser
91
+ * cannot draw it (`unsupported`). Called once per map, also when it happens before the map is ready (`onReady` may
92
+ * then never come); the page keeps working.
93
+ */
94
+ onUnavailable?: (event: UnavailableEvent) => void;
79
95
  /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */
80
96
  mapOptions?: Record<string, unknown>;
81
97
  /** Called once the first style has loaded, with the map. */
@@ -118,16 +134,50 @@ interface LayerProps<O> {
118
134
  * Without one the layer draws on top, in the order added, as in 1.0.
119
135
  */
120
136
  slot?: Slot;
137
+ /** The pointer came onto a feature of this layer, or left its features (null); same as `options.onHover`. */
138
+ onHover?: (feature: GeoJSONFeature | null, event: LayerEvent) => void;
139
+ /** A double click on a feature of this layer (the map does not zoom); same as `options.onDblClick`. */
140
+ onDblClick?: (feature: GeoJSONFeature, event: LayerEvent) => void;
141
+ /** A right click on a feature of this layer (the browser's menu stays closed); same as `options.onContextMenu`. */
142
+ onContextMenu?: (feature: GeoJSONFeature, event: LayerEvent) => void;
143
+ /**
144
+ * Feature states by feature id (the layer's idProperty value, else the feature's id, else `'#<index>'`), e.g.
145
+ * `{ [selectedId]: { selected: true } }`: drawn by the layer's `options.states` looks. Only the values that changed
146
+ * are sent (`setFeatureState` / `removeFeatureState`); values the component did not set (such as `hover` of
147
+ * `hoverState`) are left alone. Set again when the layer is drawn again.
148
+ */
149
+ featureStates?: FeatureStates;
150
+ }
151
+ /** Feature states by feature id: `{ 'stop-7': { selected: true } }`. */
152
+ type FeatureStates = Record<string, Record<string, unknown>>;
153
+ interface PointsProps extends LayerProps<PointOptions> {
154
+ /**
155
+ * A click on a cluster (with `options.cluster`): the cluster with its points (`leaves()`), its feature and the
156
+ * event. The map still zooms in unless `cluster.zoomOnClick` is false.
157
+ */
158
+ onClusterClick?: (cluster: ClusterInfo, feature: GeoJSONFeature, event: {
159
+ originalEvent: Event;
160
+ lngLat: [number, number];
161
+ point?: {
162
+ x: number;
163
+ y: number;
164
+ };
165
+ }) => void;
121
166
  }
122
- type PointsProps = LayerProps<PointOptions>;
123
167
  type LinesProps = LayerProps<LineOptions>;
124
168
  type PolygonsProps = LayerProps<PolygonOptions>;
169
+ type CirclesProps = LayerProps<CircleOptions>;
125
170
  /** Points at any scale, clustered or not. Must be inside `<SMap>`. */
126
171
  declare function Points(props: PointsProps): null;
127
172
  /** Lines (routes, tracks). Must be inside `<SMap>`. */
128
173
  declare function Lines(props: LinesProps): null;
129
174
  /** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */
130
175
  declare function Polygons(props: PolygonsProps): null;
176
+ /**
177
+ * Circles of a radius in metres around points (`addCircles`, G26), true to the ground at every zoom: every option of
178
+ * `<Polygons>` with `radius` (metres, per feature too) and `steps`. Must be inside `<SMap>`.
179
+ */
180
+ declare function Circles(props: CirclesProps): null;
131
181
 
132
182
  interface ToolProps {
133
183
  /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */
@@ -161,6 +211,21 @@ interface ToolProps {
161
211
  * Removing it removes the tool.
162
212
  */
163
213
  declare function Tool(props: ToolProps): react.JSX.Element | null;
214
+ interface SearchToolProps extends Omit<SearchToolOptions, 'search' | 'onPick' | 'options'> {
215
+ /** The tool id, unique on the map. */
216
+ id: string;
217
+ /** Your results for the text typed (the SDK never calls a geocoder); the newest function is called. */
218
+ search: (text: string) => SearchResult[] | Promise<SearchResult[]>;
219
+ /** Called with the result picked, after the map went to it. */
220
+ onPick?: (result: SearchResult) => void;
221
+ }
222
+ /**
223
+ * The search box tool (G35): your own results in a list, chosen with the keyboard or a click, the map flying to the
224
+ * pick (or fitting its `bounds`). Shown and hidden by the tools control as any tool; removing it removes the tool.
225
+ * `placeholder`, `minChars`, `maxResults`, `zoom`, `debounce`, `duration`, `label` or `position` changing makes the
226
+ * box again. Must be inside `<SMap>`.
227
+ */
228
+ declare function SearchTool(props: SearchToolProps): null;
164
229
 
165
230
  interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {
166
231
  /** The layer id, unique on the map. */
@@ -169,6 +234,11 @@ interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {
169
234
  data: LayerData;
170
235
  /** The React content of one marker (rendered again when the feature's properties change). */
171
236
  render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;
237
+ /**
238
+ * Feature states by marker id, e.g. `{ [selectedId]: { selected: true } }`: each true value puts the class
239
+ * `smap-state-<name>` on the marker's element. Only what changed is sent.
240
+ */
241
+ featureStates?: FeatureStates;
172
242
  }
173
243
  /**
174
244
  * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and
@@ -181,14 +251,20 @@ interface HeatmapProps {
181
251
  data: LayerData;
182
252
  options?: HeatmapOptions;
183
253
  }
184
- /** A heat map of points (G7). Must be inside `<SMap>`. */
254
+ /**
255
+ * A heat map of points (G7): `options.blur` and `options.minOpacity` (G33) beside radius, weight, intensity and
256
+ * colours. Must be inside `<SMap>`.
257
+ */
185
258
  declare function Heatmap(props: HeatmapProps): null;
186
259
  interface ModelsProps {
187
260
  id: string;
188
261
  data: LayerData;
189
262
  options: ModelOptions;
190
263
  }
191
- /** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */
264
+ /**
265
+ * glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`); `options.color` tints the model's
266
+ * `tint…` materials per feature (G30). Must be inside `<SMap>`.
267
+ */
192
268
  declare function Models(props: ModelsProps): null;
193
269
  interface CanvasTilesProps {
194
270
  id: string;
@@ -198,14 +274,54 @@ interface CanvasTilesProps {
198
274
  }
199
275
  /** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */
200
276
  declare function CanvasTiles(props: CanvasTilesProps): null;
201
- interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {
277
+ interface DrawToolProps extends Omit<DrawToolOptions, 'onChange' | 'onDrawing'> {
202
278
  /** Called after each change: created, edited or deleted, with every shape. */
203
279
  onChange?: (event: DrawEvent) => void;
280
+ /**
281
+ * (G28) The shape being drawn or edited, on every change: its length, area (and radius) so far and whether it is
282
+ * valid (`allowSelfIntersection: false`). `measure`, `style`, `allowSelfIntersection` and `snapLayers` are the
283
+ * tool's other G28 options.
284
+ */
285
+ onDrawing?: (event: DrawingEvent) => void;
204
286
  /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */
205
287
  onTool?: (tool: DrawTool$1 | null) => void;
206
288
  }
207
289
  /** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */
208
290
  declare function DrawTool(props: DrawToolProps): null;
291
+ /**
292
+ * Puts an image of yours on the map under `id` (`addImage`, G25) while the component using it is mounted, for
293
+ * `icon` / `iconProperty` of points and `marker.icon` of pins: an image, a canvas, ImageData, pixels or a URL loaded
294
+ * for you. A new `image` (another URL, or another object), `pixelRatio` or `sdf` puts it again; unmounting removes it.
295
+ * Answers whether the image is on the map. Must be inside `<SMap>`.
296
+ */
297
+ declare function useMapImage(id: string, image: ImageInput | null | undefined, options?: ImageOptions & {
298
+ onError?: (error: unknown) => void;
299
+ }): boolean;
300
+ interface MapImageProps extends ImageOptions {
301
+ /** The image id named by `icon`, `iconProperty` or `marker.icon`. */
302
+ id: string;
303
+ /** An image, a canvas, an ImageBitmap, ImageData, `{ width, height, data }` pixels, or a URL loaded for you. */
304
+ image: ImageInput;
305
+ /** Called once the image is on the map. */
306
+ onLoad?: () => void;
307
+ /** Called when the image cannot be loaded. */
308
+ onError?: (error: unknown) => void;
309
+ }
310
+ /** An image of yours on the map for as long as it is mounted (`useMapImage`). Must be inside `<SMap>`. */
311
+ declare function MapImage(props: MapImageProps): null;
312
+ interface ThreeLayerProps extends ThreeLayerOptions {
313
+ /** The layer id, unique on the map. */
314
+ id: string;
315
+ /** Called when the layer cannot be added (`sMap.useThree(THREE, GLTFLoader)` was not called first). */
316
+ onError?: (error: unknown) => void;
317
+ }
318
+ /**
319
+ * Your own three.js objects in the map's 3D view (`addThreeLayer`, G31; web and WebGL only): `onAdd(scene, camera,
320
+ * map)` adds them, `render` runs before each frame (return true for another frame), `onRemove` when the layer goes;
321
+ * place them with `sMap.mercator`. The newest callbacks are called; `slot`, `before`, `minzoom` or `zIndex` changing
322
+ * adds the layer again. Must be inside `<SMap>`.
323
+ */
324
+ declare function ThreeLayer(props: ThreeLayerProps): null;
209
325
 
210
326
  interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch' | 'now'> {
211
327
  /**
@@ -352,5 +468,5 @@ interface Formats {
352
468
  */
353
469
  declare const formats: Formats;
354
470
 
355
- export { ArcGisLayer, CanvasTiles, CustomMarkers, Data, DeckLayer, DrawTool, Heatmap, Layers, Lines, Models, PlanEditor, Points, Polygons, RasterLayer, SMap, Source, StyleLayer, Tool, VectorTiles, WmsLayer, WmtsLayer, formats, usePlanEditor, useRasterUrl, useSMap };
356
- export type { AddDataOptions, ArcGisLayerProps, BasemapClassOverride, CanvasTilesProps, CustomMarkersProps, CustomStyle, DataFormat, DataInput, DataLayerOptions, DataProps, DeckLayerLike, DeckLayerProps, DrawToolProps, HeatmapProps, InteropMethods, LayerProps, LayersProps, LinesProps, ModelsProps, PlanEditorProps, PointsProps, PolygonsProps, PopupFunction, RasterLayerProps, SMapMap, SMapProps, SourceProps, StyleLayerProps, StyleLayerSpec, TapHandler, ToolProps, UsePlanEditorResult, VectorTilesProps, WmsLayerProps, WmtsLayerProps };
471
+ export { ArcGisLayer, CanvasTiles, Circles, CustomMarkers, Data, DeckLayer, DrawTool, Heatmap, Layers, Lines, MapImage, Models, PlanEditor, Points, Polygons, RasterLayer, SMap, SearchTool, Source, StyleLayer, ThreeLayer, Tool, VectorTiles, WmsLayer, WmtsLayer, formats, useMapImage, usePlanEditor, useRasterUrl, useSMap };
472
+ export type { AddDataOptions, ArcGisLayerProps, BasemapClassOverride, CanvasTilesProps, CirclesProps, CustomMarkersProps, CustomStyle, DataFormat, DataInput, DataLayerOptions, DataProps, DeckLayerLike, DeckLayerProps, DrawToolProps, FeatureStates, HeatmapProps, InteropMethods, LayerProps, LayersProps, LinesProps, MapImageProps, ModelsProps, PlanEditorProps, PointsProps, PolygonsProps, PopupFunction, RasterLayerProps, SMapMap, SMapProps, SearchToolProps, SourceProps, StyleLayerProps, StyleLayerSpec, TapHandler, ThreeLayerProps, ToolProps, UsePlanEditorResult, VectorTilesProps, WmsLayerProps, WmtsLayerProps };