@types/mapbox__mapbox-gl-geocoder 5.0.0 → 5.1.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.
|
@@ -8,7 +8,7 @@ This package contains type definitions for @mapbox/mapbox-gl-geocoder (https://g
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__mapbox-gl-geocoder.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sat, 18 Oct 2025 03:38:37 GMT
|
|
12
12
|
* Dependencies: [@types/geojson](https://npmjs.com/package/@types/geojson), [@types/mapbox-gl](https://npmjs.com/package/@types/mapbox-gl)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -28,45 +28,54 @@ declare namespace MapboxGeocoder {
|
|
|
28
28
|
interface GeocoderOptions {
|
|
29
29
|
accessToken: string;
|
|
30
30
|
/**
|
|
31
|
-
* Use to set a custom API origin.
|
|
31
|
+
* Use to set a custom API origin.
|
|
32
|
+
* @default "https://api.mapbox.com"
|
|
32
33
|
*/
|
|
33
34
|
origin?: string | undefined;
|
|
34
35
|
/**
|
|
35
|
-
* A [mapbox-gl](https://github.com/mapbox/mapbox-gl-js) instance to use when creating [Markers](https://docs.mapbox.com/mapbox-gl-js/api/#marker).
|
|
36
|
+
* A [mapbox-gl](https://github.com/mapbox/mapbox-gl-js/api/#marker) instance to use when creating [Markers](https://docs.mapbox.com/mapbox-gl-js/api/#marker).
|
|
37
|
+
* Required if `options.marker` is `true`.
|
|
36
38
|
*/
|
|
37
39
|
mapboxgl?: typeof mapboxgl | undefined;
|
|
38
40
|
/**
|
|
39
|
-
* On geocoded result what zoom level should the map animate to when a bbox isn't found in the response. If a bbox is found the map will fit to the bbox.
|
|
41
|
+
* On geocoded result what zoom level should the map animate to when a bbox isn't found in the response. If a bbox is found the map will fit to the bbox.
|
|
42
|
+
* @default 16
|
|
40
43
|
*/
|
|
41
44
|
zoom?: number | undefined;
|
|
42
45
|
/**
|
|
43
|
-
* Override the default placeholder attribute value.
|
|
46
|
+
* Override the default placeholder attribute value.
|
|
47
|
+
* @default "Search"
|
|
44
48
|
*/
|
|
45
49
|
placeholder?: string | undefined;
|
|
46
50
|
/**
|
|
47
51
|
* If `false`, animating the map to a selected result is disabled. If `true`, animating the map will use the default animation parameters.
|
|
48
52
|
* If an object, it will be passed as `options` to the map [`flyTo`](https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto)
|
|
49
|
-
* or [`fitBounds`](https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds) method providing control over the animation of the transition.
|
|
53
|
+
* or [`fitBounds`](https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds) method providing control over the animation of the transition.
|
|
54
|
+
* @default true
|
|
50
55
|
*/
|
|
51
56
|
flyTo?: boolean | mapboxgl.FlyToOptions | mapboxgl.FitBoundsOptions | undefined;
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
58
|
+
* a geographical point given as an object with `latitude` and `longitude` properties, or the string 'ip' to use a user's IP address location. Search results closer to this point will be given higher priority.
|
|
54
59
|
*/
|
|
55
60
|
proximity?: LngLatLiteral | "ip" | undefined;
|
|
56
61
|
/**
|
|
57
|
-
* If `true`, the geocoder proximity will automatically update based on the map view.
|
|
62
|
+
* If `true`, the geocoder proximity will automatically update based on the map view.
|
|
63
|
+
* @default true
|
|
58
64
|
*/
|
|
59
65
|
trackProximity?: boolean | undefined;
|
|
60
66
|
/**
|
|
61
|
-
* If `true`, the geocoder control will collapse until hovered or in focus.
|
|
67
|
+
* If `true`, the geocoder control will collapse until hovered or in focus.
|
|
68
|
+
* @default false
|
|
62
69
|
*/
|
|
63
70
|
collapsed?: boolean | undefined;
|
|
64
71
|
/**
|
|
65
|
-
* If `true`, the geocoder control will clear it's contents and blur when user presses the escape key.
|
|
72
|
+
* If `true`, the geocoder control will clear it's contents and blur when user presses the escape key.
|
|
73
|
+
* @default false
|
|
66
74
|
*/
|
|
67
75
|
clearAndBlurOnEsc?: boolean | undefined;
|
|
68
76
|
/**
|
|
69
|
-
* If `true`, the geocoder control will clear its value when the input blurs.
|
|
77
|
+
* If `true`, the geocoder control will clear its value when the input blurs.
|
|
78
|
+
* @default false
|
|
70
79
|
*/
|
|
71
80
|
clearOnBlur?: boolean | undefined;
|
|
72
81
|
/**
|
|
@@ -75,7 +84,8 @@ declare namespace MapboxGeocoder {
|
|
|
75
84
|
*/
|
|
76
85
|
bbox?: Bbox | undefined;
|
|
77
86
|
/**
|
|
78
|
-
* If `true`, search input coordinates for reverse geocoding is expected to be in the form `lon, lat` instead of the default `lat, lon`.
|
|
87
|
+
* If `true`, search input coordinates for reverse geocoding is expected to be in the form `lon, lat` instead of the default `lat, lon`.
|
|
88
|
+
* @default false
|
|
79
89
|
*/
|
|
80
90
|
flipCoordinates?: boolean | undefined;
|
|
81
91
|
/**
|
|
@@ -87,11 +97,13 @@ declare namespace MapboxGeocoder {
|
|
|
87
97
|
*/
|
|
88
98
|
countries?: string | undefined;
|
|
89
99
|
/**
|
|
90
|
-
* Minimum number of characters to enter before results are shown.
|
|
100
|
+
* Minimum number of characters to enter before results are shown.
|
|
101
|
+
* @default 2
|
|
91
102
|
*/
|
|
92
103
|
minLength?: number | undefined;
|
|
93
104
|
/**
|
|
94
|
-
* Maximum number of results to show.
|
|
105
|
+
* Maximum number of results to show.
|
|
106
|
+
* @default 5
|
|
95
107
|
*/
|
|
96
108
|
limit?: number | undefined;
|
|
97
109
|
/**
|
|
@@ -114,29 +126,33 @@ declare namespace MapboxGeocoder {
|
|
|
114
126
|
| ((
|
|
115
127
|
searchInput: string,
|
|
116
128
|
features: GeoJSON.FeatureCollection<GeoJSON.Geometry>,
|
|
117
|
-
) => Promise<GeoJSON.FeatureCollection>)
|
|
129
|
+
) => Promise<GeoJSON.FeatureCollection["features"]>)
|
|
118
130
|
| undefined;
|
|
119
131
|
/**
|
|
120
132
|
* If `true`, enable reverse geocoding mode. In reverse geocoding, search input is expected to be coordinates in the form `lat, lon`, with suggestions being the reverse geocodes.
|
|
121
|
-
*
|
|
133
|
+
* @default false
|
|
122
134
|
*/
|
|
123
135
|
reverseGeocode?: boolean | undefined;
|
|
124
136
|
/**
|
|
125
|
-
* Allow Mapbox to collect anonymous usage statistics from the plugin.
|
|
137
|
+
* Allow Mapbox to collect anonymous usage statistics from the plugin.
|
|
138
|
+
* @default true
|
|
126
139
|
*/
|
|
127
140
|
enableEventLogging?: boolean | undefined;
|
|
128
141
|
/**
|
|
129
|
-
*
|
|
142
|
+
* If `true` enable user geolocation feature.
|
|
143
|
+
* @default false
|
|
130
144
|
*/
|
|
131
145
|
enableGeolocation?: boolean | undefined;
|
|
132
146
|
/**
|
|
133
|
-
*
|
|
147
|
+
* The accuracy for the geolocation feature with which we define the address line to fill. The browser API returns the user's position with accuracy, and sometimes we can get the neighbor's address. To prevent receiving an incorrect address, you can reduce the accuracy of the definition.
|
|
148
|
+
* @default "street"
|
|
134
149
|
*/
|
|
135
150
|
addressAccuracy?: "address" | "street" | "place" | "country" | undefined;
|
|
136
151
|
/**
|
|
137
152
|
* If `true`, a [Marker](https://docs.mapbox.com/mapbox-gl-js/api/#marker) will be added to the map at the location of the user-selected result using a default set of Marker options.
|
|
138
153
|
* If the value is an object, the marker will be constructed using these options. If `false`, no marker will be added to the map.
|
|
139
|
-
* Requires that `options.mapboxgl` also be set.
|
|
154
|
+
* Requires that `options.mapboxgl` also be set.
|
|
155
|
+
* @default true
|
|
140
156
|
*/
|
|
141
157
|
marker?: boolean | mapboxgl.Marker | undefined;
|
|
142
158
|
/**
|
|
@@ -148,12 +164,14 @@ declare namespace MapboxGeocoder {
|
|
|
148
164
|
/**
|
|
149
165
|
* A function that specifies how the selected result should be rendered in the search bar.
|
|
150
166
|
* This function should accept a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and return a string.
|
|
151
|
-
* HTML tags in the output string will not be rendered.
|
|
167
|
+
* HTML tags in the output string will not be rendered.
|
|
168
|
+
* @default (item) => item.place_name
|
|
152
169
|
*/
|
|
153
170
|
getItemValue?: ((feature: Result) => string) | undefined;
|
|
154
171
|
/**
|
|
155
172
|
* A string specifying the geocoding [endpoint](https://docs.mapbox.com/api/search/#endpoints) to query.
|
|
156
|
-
* Options are `mapbox.places` and `mapbox.places`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes.
|
|
173
|
+
* Options are `mapbox.places` and `mapbox.places`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes.
|
|
174
|
+
* @default "mapbox.places"
|
|
157
175
|
*/
|
|
158
176
|
mode?: "mapbox.places" | "mapbox.places-permanent" | undefined;
|
|
159
177
|
/**
|
|
@@ -163,68 +181,113 @@ declare namespace MapboxGeocoder {
|
|
|
163
181
|
localGeocoder?: ((query: string) => Result[]) | undefined;
|
|
164
182
|
/**
|
|
165
183
|
* If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user.
|
|
166
|
-
* If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher.
|
|
184
|
+
* If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher.
|
|
185
|
+
* @default false
|
|
167
186
|
*/
|
|
168
187
|
localGeocoderOnly?: boolean | undefined;
|
|
169
188
|
/**
|
|
170
189
|
* Specify whether to return autocomplete results or not. When autocomplete is enabled,
|
|
171
190
|
* results will be included that start with the requested string, rather than just responses
|
|
172
|
-
* that match it exactly.
|
|
191
|
+
* that match it exactly.
|
|
192
|
+
* @default true
|
|
173
193
|
*/
|
|
174
194
|
autocomplete?: boolean | undefined;
|
|
175
195
|
/**
|
|
176
196
|
* Specify whether the Geocoding API should attempt approximate, as well as exact, matching
|
|
177
197
|
* when performing searches, or whether it should opt out of this behavior and only attempt
|
|
178
|
-
* exact matching.
|
|
198
|
+
* exact matching.
|
|
199
|
+
* @default true
|
|
179
200
|
*/
|
|
180
201
|
fuzzyMatch?: boolean | undefined;
|
|
181
202
|
/**
|
|
182
203
|
* Specify whether to request additional metadata about the recommended navigation
|
|
183
204
|
* destination corresponding to the feature or not. Only applicable for address features.
|
|
184
|
-
*
|
|
205
|
+
* @default false
|
|
185
206
|
*/
|
|
186
207
|
routing?: boolean | undefined;
|
|
187
208
|
/**
|
|
188
209
|
* Filter results to geographic features whose characteristics are defined differently by
|
|
189
|
-
* audiences belonging to various regional, cultural, or political groups.
|
|
190
|
-
* default "us"
|
|
210
|
+
* audiences belonging to various regional, cultural, or political groups.
|
|
211
|
+
* @default "us"
|
|
191
212
|
*/
|
|
192
213
|
worldview?: string | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* If `true`, the geocoder will use the browser's focus event to show suggestions.
|
|
216
|
+
* If `false`, it will only highlight active suggestions and Tab will not propagate to the suggestions list.
|
|
217
|
+
* @default false
|
|
218
|
+
*/
|
|
219
|
+
useBrowserFocus?: boolean | undefined;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Set the factors that are used to sort nearby results.
|
|
223
|
+
* @default "distance"
|
|
224
|
+
*/
|
|
225
|
+
reverseMode?: "distance" | "score" | undefined;
|
|
193
226
|
}
|
|
194
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* A geocoder component using the [Mapbox Geocoding API](https://docs.mapbox.com/api/search/#geocoding)
|
|
230
|
+
*/
|
|
195
231
|
declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
196
232
|
constructor(options?: MapboxGeocoder.GeocoderOptions);
|
|
197
233
|
/**
|
|
198
234
|
* The input element created by the geocoder's internal operations.
|
|
199
235
|
*/
|
|
200
236
|
_inputEl?: HTMLInputElement;
|
|
237
|
+
/**
|
|
238
|
+
* Add the geocoder to a container. The container can be either a `mapboxgl.Map`, an `HTMLElement` or a CSS selector string.
|
|
239
|
+
*
|
|
240
|
+
* If the container is a [`mapboxgl.Map`](https://docs.mapbox.com/mapbox-gl-js/api/map/), this function will behave identically to [`Map.addControl(geocoder)`](https://docs.mapbox.com/mapbox-gl-js/api/map/#map#addcontrol).
|
|
241
|
+
* If the container is an instance of [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement), then the geocoder will be appended as a child of that [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement).
|
|
242
|
+
* If the container is a [CSS selector string](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors), the geocoder will be appended to the element returned from the query.
|
|
243
|
+
*
|
|
244
|
+
* This function will throw an error if the container is none of the above.
|
|
245
|
+
* It will also throw an error if the referenced HTML element cannot be found in the `document.body`.
|
|
246
|
+
*
|
|
247
|
+
* For example, if the HTML body contains the element `<div id='geocoder-container'></div>`, the following script will append the geocoder to `#geocoder-container`:
|
|
248
|
+
*
|
|
249
|
+
* ```javascript
|
|
250
|
+
* var geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken });
|
|
251
|
+
* geocoder.addTo('#geocoder-container');
|
|
252
|
+
* ```
|
|
253
|
+
* @param container A reference to the container to which to add the geocoder
|
|
254
|
+
*/
|
|
201
255
|
addTo(container: string | HTMLElement | mapboxgl.Map): this;
|
|
202
256
|
onAdd(map: mapboxgl.Map): HTMLElement;
|
|
203
257
|
/**
|
|
204
258
|
* Set the accessToken option used for the geocoding request endpoint.
|
|
205
|
-
* @param
|
|
259
|
+
* @param accessToken value
|
|
206
260
|
*/
|
|
207
261
|
setAccessToken(accessToken: string): MapboxGeocoder;
|
|
262
|
+
/**
|
|
263
|
+
* Create icon
|
|
264
|
+
* @param name The name of the icon
|
|
265
|
+
* @param path The SVG path of the icon
|
|
266
|
+
*/
|
|
208
267
|
createIcon(name: string, path: any): SVGSVGElement;
|
|
268
|
+
/**
|
|
269
|
+
* Remove control
|
|
270
|
+
*/
|
|
209
271
|
onRemove(): this;
|
|
210
272
|
/**
|
|
211
273
|
* Clear and then focus the input.
|
|
212
|
-
*
|
|
274
|
+
* @param ev the event that triggered the clear, if available
|
|
213
275
|
*/
|
|
214
276
|
clear(ev?: Event): void;
|
|
215
277
|
/**
|
|
216
278
|
* Set & query the input
|
|
279
|
+
* @param searchInput location name or other search input
|
|
217
280
|
*/
|
|
218
281
|
query(searchInput: string): this;
|
|
219
282
|
/**
|
|
220
283
|
* Set input
|
|
221
|
-
* @param
|
|
222
|
-
* @param
|
|
284
|
+
* @param searchInput location name or other search input
|
|
285
|
+
* @param showSuggestions display suggestion on setInput call
|
|
223
286
|
*/
|
|
224
287
|
setInput(searchInput: string, showSuggestions?: boolean): this;
|
|
225
288
|
/**
|
|
226
|
-
* @param
|
|
227
|
-
* @param
|
|
289
|
+
* @param proximity The new `options.proximity` value. This is a geographical point given as an object with `latitude` and `longitude` properties or the string 'ip'.
|
|
290
|
+
* @param disableTrackProximity If true, sets `trackProximity` to false. True by default to prevent `trackProximity` from unintentionally overriding an explicitly set proximity value.
|
|
228
291
|
*/
|
|
229
292
|
setProximity(proximity: MapboxGeocoder.LngLatLiteral | "ip", disableTrackProximity?: boolean): this;
|
|
230
293
|
/**
|
|
@@ -233,7 +296,7 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
233
296
|
getProximity(): MapboxGeocoder.LngLatLiteral;
|
|
234
297
|
/**
|
|
235
298
|
* Set the render function used in the results dropdown
|
|
236
|
-
* The function to use as a render function. This function accepts a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and returns a string.
|
|
299
|
+
* @param fn The function to use as a render function. This function accepts a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and returns a string.
|
|
237
300
|
*/
|
|
238
301
|
setRenderFunction(fn: (feature: MapboxGeocoder.Result) => string): this;
|
|
239
302
|
/**
|
|
@@ -244,7 +307,7 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
244
307
|
* Get the language to use in UI elements and when making search requests
|
|
245
308
|
*
|
|
246
309
|
* Look first at the explicitly set options otherwise use the browser's language settings
|
|
247
|
-
* language Specify the language to use for response text and query result weighting.
|
|
310
|
+
* @param language Specify the language to use for response text and query result weighting.
|
|
248
311
|
* Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script.
|
|
249
312
|
* More than one value can also be specified, separated by commas.
|
|
250
313
|
*/
|
|
@@ -259,11 +322,12 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
259
322
|
getZoom(): number;
|
|
260
323
|
/**
|
|
261
324
|
* Set the zoom level that the map should animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`.
|
|
325
|
+
* @param zoom The zoom level that the map should animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`.
|
|
262
326
|
*/
|
|
263
327
|
setZoom(zoom: number): this;
|
|
264
328
|
/**
|
|
265
329
|
* Set the flyTo options
|
|
266
|
-
* If false, animating the map to a selected result is disabled. If true, animating the map will use the default animation parameters.
|
|
330
|
+
* @param flyTo If false, animating the map to a selected result is disabled. If true, animating the map will use the default animation parameters.
|
|
267
331
|
* If an object, it will be passed as `options` to the map [`flyTo`](https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto) or [`fitBounds`](https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds)
|
|
268
332
|
* method providing control over the animation of the transition.
|
|
269
333
|
*/
|
|
@@ -278,41 +342,134 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
278
342
|
getPlaceholder(): string;
|
|
279
343
|
/**
|
|
280
344
|
* Set the value of the input element's placeholder
|
|
281
|
-
* placeholder the text to use as the input element's placeholder
|
|
345
|
+
* @param placeholder the text to use as the input element's placeholder
|
|
282
346
|
*/
|
|
283
347
|
setPlaceholder(placeholder: string): this;
|
|
348
|
+
/**
|
|
349
|
+
* Get the bounding box used by the plugin
|
|
350
|
+
*/
|
|
284
351
|
getBbox(): MapboxGeocoder.Bbox;
|
|
352
|
+
/**
|
|
353
|
+
* Set the bounding box to limit search results to
|
|
354
|
+
* @param bbox a bounding box given as an array in the format [minX, minY, maxX, maxY].
|
|
355
|
+
*/
|
|
285
356
|
setBbox(bbox: MapboxGeocoder.Bbox): this;
|
|
357
|
+
/**
|
|
358
|
+
* Get a list of the countries to limit search results to
|
|
359
|
+
*/
|
|
286
360
|
getCountries(): string;
|
|
361
|
+
/**
|
|
362
|
+
* Set the countries to limit search results to
|
|
363
|
+
* @param countries a comma separated list of countries to limit to
|
|
364
|
+
*/
|
|
287
365
|
setCountries(countries: string): this;
|
|
366
|
+
/**
|
|
367
|
+
* Get a list of the types to limit search results to
|
|
368
|
+
*/
|
|
288
369
|
getTypes(): string;
|
|
370
|
+
/**
|
|
371
|
+
* Set the types to limit search results to
|
|
372
|
+
* @param types a comma separated list of types to limit to
|
|
373
|
+
*/
|
|
289
374
|
setTypes(types: string): this;
|
|
375
|
+
/**
|
|
376
|
+
* Get the minimum number of characters typed to trigger results used in the plugin
|
|
377
|
+
*/
|
|
290
378
|
getMinLength(): number;
|
|
379
|
+
/**
|
|
380
|
+
* Set the minimum number of characters typed to trigger results used by the plugin
|
|
381
|
+
* @param minLength the minimum length in characters
|
|
382
|
+
*/
|
|
291
383
|
setMinLength(minLength: number): this;
|
|
384
|
+
/**
|
|
385
|
+
* Get the limit value for the number of results to display used by the plugin
|
|
386
|
+
*/
|
|
292
387
|
getLimit(): number;
|
|
388
|
+
/**
|
|
389
|
+
* Set the limit value for the number of results to display used by the plugin
|
|
390
|
+
* @param limit the number of search results to return
|
|
391
|
+
*/
|
|
293
392
|
setLimit(limit: number): this;
|
|
393
|
+
/**
|
|
394
|
+
* Get the filter function used by the plugin
|
|
395
|
+
*/
|
|
294
396
|
getFilter(): (feature: MapboxGeocoder.Result) => boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Set the filter function used by the plugin.
|
|
399
|
+
* @param filter A function which accepts a Feature in the [extended GeoJSON](https://docs.mapbox.com/api/search/geocoding-v5/#geocoding-response-object) format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise.
|
|
400
|
+
*/
|
|
295
401
|
setFilter(filter: (feature: MapboxGeocoder.Result) => boolean): this;
|
|
402
|
+
/**
|
|
403
|
+
* Set the geocoding endpoint used by the plugin.
|
|
404
|
+
* @param origin A function which accepts an HTTPS URL to specify the endpoint to query results from.
|
|
405
|
+
*/
|
|
296
406
|
setOrigin(origin: string): this;
|
|
407
|
+
/**
|
|
408
|
+
* Get the geocoding endpoint the plugin is currently set to
|
|
409
|
+
*/
|
|
297
410
|
getOrigin(): string;
|
|
411
|
+
/**
|
|
412
|
+
* Set the autocomplete option used for geocoding requests
|
|
413
|
+
* @param value The boolean value to set autocomplete to
|
|
414
|
+
*/
|
|
298
415
|
setAutocomplete(value: boolean): this;
|
|
416
|
+
/**
|
|
417
|
+
* Get the current autocomplete parameter value used for requests
|
|
418
|
+
*/
|
|
299
419
|
getAutocomplete(): boolean;
|
|
420
|
+
/**
|
|
421
|
+
* Set the fuzzyMatch option used for approximate matching in geocoding requests
|
|
422
|
+
* @param value The boolean value to set fuzzyMatch to
|
|
423
|
+
*/
|
|
300
424
|
setFuzzyMatch(value: boolean): this;
|
|
425
|
+
/**
|
|
426
|
+
* Get the current fuzzyMatch parameter value used for requests
|
|
427
|
+
*/
|
|
301
428
|
getFuzzyMatch(): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Set the routing parameter used to ask for routable point metadata in geocoding requests
|
|
431
|
+
* @param value The boolean value to set routing to
|
|
432
|
+
*/
|
|
302
433
|
setRouting(value: boolean): this;
|
|
434
|
+
/**
|
|
435
|
+
* Get the current routing parameter value used for requests
|
|
436
|
+
*/
|
|
303
437
|
getRouting(): boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Set the worldview parameter
|
|
440
|
+
* @param code The country code representing the worldview (e.g. "us" | "cn" | "jp", "in")
|
|
441
|
+
*/
|
|
304
442
|
setWorldview(code: string): this;
|
|
443
|
+
/**
|
|
444
|
+
* Get the current worldview parameter value used for requests
|
|
445
|
+
*/
|
|
305
446
|
getWorldview(): string;
|
|
306
447
|
/**
|
|
307
448
|
* Subscribe to events that happen within the plugin.
|
|
308
|
-
* type name of event. Available events and the data passed into their respective event objects are:
|
|
449
|
+
* @param type name of event. Available events and the data passed into their respective event objects are:
|
|
309
450
|
*
|
|
310
451
|
* - __clear__ `Emitted when the input is cleared`
|
|
311
452
|
* - __loading__ `{ query } Emitted when the geocoder is looking up a query`
|
|
312
453
|
* - __results__ `{ results } Fired when the geocoder returns a response`
|
|
313
454
|
* - __result__ `{ result } Fired when input is set`
|
|
314
455
|
* - __error__ `{ error } Error as string`
|
|
456
|
+
* @param fn function that's called when the event is emitted.
|
|
457
|
+
*/
|
|
458
|
+
on(type: "clear"): this;
|
|
459
|
+
on(type: "loading", listener: (args: { query: string }) => void): this;
|
|
460
|
+
on(type: "results", listener: (args: { results: MapboxGeocoder.Results }) => void): this;
|
|
461
|
+
on(type: "result", listener: (args: { result: MapboxGeocoder.Result }) => void): this;
|
|
462
|
+
on(type: "error", listener: (args: { error: unknown }) => void): this;
|
|
463
|
+
on(type: string, listener: (...args: any[]) => void): this;
|
|
464
|
+
/**
|
|
465
|
+
* Remove an event
|
|
466
|
+
* @param type Event name.
|
|
467
|
+
* @param fn Function that should unsubscribe to the event emitted.
|
|
315
468
|
*/
|
|
316
|
-
|
|
317
|
-
off(type:
|
|
469
|
+
off(type: "clear"): this;
|
|
470
|
+
off(type: "loading", listener: (args: { query: string }) => void): this;
|
|
471
|
+
off(type: "results", listener: (args: { results: MapboxGeocoder.Results }) => void): this;
|
|
472
|
+
off(type: "result", listener: (args: { result: MapboxGeocoder.Result }) => void): this;
|
|
473
|
+
off(type: "error", listener: (args: { error: unknown }) => void): this;
|
|
474
|
+
off(type: string, listener: (...args: any[]) => void): this;
|
|
318
475
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/mapbox__mapbox-gl-geocoder",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "TypeScript definitions for @mapbox/mapbox-gl-geocoder",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__mapbox-gl-geocoder",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@types/geojson": "*",
|
|
29
29
|
"@types/mapbox-gl": "*"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"peerDependencies": {},
|
|
32
|
+
"typesPublisherContentHash": "3e720878783c1433d40f8c57a80c901241731f080fd60464b9fa92f366d37a91",
|
|
33
|
+
"typeScriptVersion": "5.2"
|
|
33
34
|
}
|