@types/mapbox__mapbox-gl-geocoder 4.7.7 → 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
|
-
* a
|
|
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
|
-
proximity?: LngLatLiteral | undefined;
|
|
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
|
/**
|
|
@@ -74,6 +83,11 @@ declare namespace MapboxGeocoder {
|
|
|
74
83
|
* Search results will be limited to the bounding box.
|
|
75
84
|
*/
|
|
76
85
|
bbox?: Bbox | undefined;
|
|
86
|
+
/**
|
|
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
|
|
89
|
+
*/
|
|
90
|
+
flipCoordinates?: boolean | undefined;
|
|
77
91
|
/**
|
|
78
92
|
* a comma seperated list of types that filter results to match those specified. See https://www.mapbox.com/developers/api/geocoding/#filter-type for available types.
|
|
79
93
|
*/
|
|
@@ -83,11 +97,13 @@ declare namespace MapboxGeocoder {
|
|
|
83
97
|
*/
|
|
84
98
|
countries?: string | undefined;
|
|
85
99
|
/**
|
|
86
|
-
* Minimum number of characters to enter before results are shown.
|
|
100
|
+
* Minimum number of characters to enter before results are shown.
|
|
101
|
+
* @default 2
|
|
87
102
|
*/
|
|
88
103
|
minLength?: number | undefined;
|
|
89
104
|
/**
|
|
90
|
-
* Maximum number of results to show.
|
|
105
|
+
* Maximum number of results to show.
|
|
106
|
+
* @default 5
|
|
91
107
|
*/
|
|
92
108
|
limit?: number | undefined;
|
|
93
109
|
/**
|
|
@@ -110,21 +126,33 @@ declare namespace MapboxGeocoder {
|
|
|
110
126
|
| ((
|
|
111
127
|
searchInput: string,
|
|
112
128
|
features: GeoJSON.FeatureCollection<GeoJSON.Geometry>,
|
|
113
|
-
) => Promise<GeoJSON.FeatureCollection>)
|
|
129
|
+
) => Promise<GeoJSON.FeatureCollection["features"]>)
|
|
114
130
|
| undefined;
|
|
115
131
|
/**
|
|
116
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.
|
|
117
|
-
*
|
|
133
|
+
* @default false
|
|
118
134
|
*/
|
|
119
135
|
reverseGeocode?: boolean | undefined;
|
|
120
136
|
/**
|
|
121
|
-
* Allow Mapbox to collect anonymous usage statistics from the plugin.
|
|
137
|
+
* Allow Mapbox to collect anonymous usage statistics from the plugin.
|
|
138
|
+
* @default true
|
|
122
139
|
*/
|
|
123
140
|
enableEventLogging?: boolean | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* If `true` enable user geolocation feature.
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
enableGeolocation?: boolean | undefined;
|
|
146
|
+
/**
|
|
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"
|
|
149
|
+
*/
|
|
150
|
+
addressAccuracy?: "address" | "street" | "place" | "country" | undefined;
|
|
124
151
|
/**
|
|
125
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.
|
|
126
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.
|
|
127
|
-
* Requires that `options.mapboxgl` also be set.
|
|
154
|
+
* Requires that `options.mapboxgl` also be set.
|
|
155
|
+
* @default true
|
|
128
156
|
*/
|
|
129
157
|
marker?: boolean | mapboxgl.Marker | undefined;
|
|
130
158
|
/**
|
|
@@ -136,12 +164,14 @@ declare namespace MapboxGeocoder {
|
|
|
136
164
|
/**
|
|
137
165
|
* A function that specifies how the selected result should be rendered in the search bar.
|
|
138
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.
|
|
139
|
-
* 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
|
|
140
169
|
*/
|
|
141
170
|
getItemValue?: ((feature: Result) => string) | undefined;
|
|
142
171
|
/**
|
|
143
172
|
* A string specifying the geocoding [endpoint](https://docs.mapbox.com/api/search/#endpoints) to query.
|
|
144
|
-
* 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"
|
|
145
175
|
*/
|
|
146
176
|
mode?: "mapbox.places" | "mapbox.places-permanent" | undefined;
|
|
147
177
|
/**
|
|
@@ -151,66 +181,122 @@ declare namespace MapboxGeocoder {
|
|
|
151
181
|
localGeocoder?: ((query: string) => Result[]) | undefined;
|
|
152
182
|
/**
|
|
153
183
|
* If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user.
|
|
154
|
-
* 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
|
|
155
186
|
*/
|
|
156
187
|
localGeocoderOnly?: boolean | undefined;
|
|
157
188
|
/**
|
|
158
189
|
* Specify whether to return autocomplete results or not. When autocomplete is enabled,
|
|
159
190
|
* results will be included that start with the requested string, rather than just responses
|
|
160
|
-
* that match it exactly.
|
|
191
|
+
* that match it exactly.
|
|
192
|
+
* @default true
|
|
161
193
|
*/
|
|
162
194
|
autocomplete?: boolean | undefined;
|
|
163
195
|
/**
|
|
164
196
|
* Specify whether the Geocoding API should attempt approximate, as well as exact, matching
|
|
165
197
|
* when performing searches, or whether it should opt out of this behavior and only attempt
|
|
166
|
-
* exact matching.
|
|
198
|
+
* exact matching.
|
|
199
|
+
* @default true
|
|
167
200
|
*/
|
|
168
201
|
fuzzyMatch?: boolean | undefined;
|
|
169
202
|
/**
|
|
170
203
|
* Specify whether to request additional metadata about the recommended navigation
|
|
171
204
|
* destination corresponding to the feature or not. Only applicable for address features.
|
|
172
|
-
*
|
|
205
|
+
* @default false
|
|
173
206
|
*/
|
|
174
207
|
routing?: boolean | undefined;
|
|
175
208
|
/**
|
|
176
209
|
* Filter results to geographic features whose characteristics are defined differently by
|
|
177
|
-
* audiences belonging to various regional, cultural, or political groups.
|
|
178
|
-
* default "us"
|
|
210
|
+
* audiences belonging to various regional, cultural, or political groups.
|
|
211
|
+
* @default "us"
|
|
179
212
|
*/
|
|
180
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;
|
|
181
226
|
}
|
|
182
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* A geocoder component using the [Mapbox Geocoding API](https://docs.mapbox.com/api/search/#geocoding)
|
|
230
|
+
*/
|
|
183
231
|
declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
184
232
|
constructor(options?: MapboxGeocoder.GeocoderOptions);
|
|
233
|
+
/**
|
|
234
|
+
* The input element created by the geocoder's internal operations.
|
|
235
|
+
*/
|
|
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
|
+
*/
|
|
185
255
|
addTo(container: string | HTMLElement | mapboxgl.Map): this;
|
|
186
256
|
onAdd(map: mapboxgl.Map): HTMLElement;
|
|
257
|
+
/**
|
|
258
|
+
* Set the accessToken option used for the geocoding request endpoint.
|
|
259
|
+
* @param accessToken value
|
|
260
|
+
*/
|
|
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
|
+
*/
|
|
187
267
|
createIcon(name: string, path: any): SVGSVGElement;
|
|
268
|
+
/**
|
|
269
|
+
* Remove control
|
|
270
|
+
*/
|
|
188
271
|
onRemove(): this;
|
|
189
272
|
/**
|
|
190
273
|
* Clear and then focus the input.
|
|
191
|
-
*
|
|
274
|
+
* @param ev the event that triggered the clear, if available
|
|
192
275
|
*/
|
|
193
276
|
clear(ev?: Event): void;
|
|
194
277
|
/**
|
|
195
278
|
* Set & query the input
|
|
279
|
+
* @param searchInput location name or other search input
|
|
196
280
|
*/
|
|
197
281
|
query(searchInput: string): this;
|
|
198
282
|
/**
|
|
199
283
|
* Set input
|
|
200
|
-
* searchInput location name or other search input
|
|
284
|
+
* @param searchInput location name or other search input
|
|
285
|
+
* @param showSuggestions display suggestion on setInput call
|
|
201
286
|
*/
|
|
202
|
-
setInput(searchInput: string): this;
|
|
287
|
+
setInput(searchInput: string, showSuggestions?: boolean): this;
|
|
203
288
|
/**
|
|
204
|
-
*
|
|
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.
|
|
205
291
|
*/
|
|
206
|
-
setProximity(proximity: MapboxGeocoder.LngLatLiteral): this;
|
|
292
|
+
setProximity(proximity: MapboxGeocoder.LngLatLiteral | "ip", disableTrackProximity?: boolean): this;
|
|
207
293
|
/**
|
|
208
294
|
* Get the geocoder proximity
|
|
209
295
|
*/
|
|
210
296
|
getProximity(): MapboxGeocoder.LngLatLiteral;
|
|
211
297
|
/**
|
|
212
298
|
* Set the render function used in the results dropdown
|
|
213
|
-
* 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.
|
|
214
300
|
*/
|
|
215
301
|
setRenderFunction(fn: (feature: MapboxGeocoder.Result) => string): this;
|
|
216
302
|
/**
|
|
@@ -221,7 +307,7 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
221
307
|
* Get the language to use in UI elements and when making search requests
|
|
222
308
|
*
|
|
223
309
|
* Look first at the explicitly set options otherwise use the browser's language settings
|
|
224
|
-
* 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.
|
|
225
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.
|
|
226
312
|
* More than one value can also be specified, separated by commas.
|
|
227
313
|
*/
|
|
@@ -236,11 +322,12 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
236
322
|
getZoom(): number;
|
|
237
323
|
/**
|
|
238
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`.
|
|
239
326
|
*/
|
|
240
327
|
setZoom(zoom: number): this;
|
|
241
328
|
/**
|
|
242
329
|
* Set the flyTo options
|
|
243
|
-
* 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.
|
|
244
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)
|
|
245
332
|
* method providing control over the animation of the transition.
|
|
246
333
|
*/
|
|
@@ -255,41 +342,134 @@ declare class MapboxGeocoder implements mapboxgl.IControl {
|
|
|
255
342
|
getPlaceholder(): string;
|
|
256
343
|
/**
|
|
257
344
|
* Set the value of the input element's placeholder
|
|
258
|
-
* placeholder the text to use as the input element's placeholder
|
|
345
|
+
* @param placeholder the text to use as the input element's placeholder
|
|
259
346
|
*/
|
|
260
347
|
setPlaceholder(placeholder: string): this;
|
|
348
|
+
/**
|
|
349
|
+
* Get the bounding box used by the plugin
|
|
350
|
+
*/
|
|
261
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
|
+
*/
|
|
262
356
|
setBbox(bbox: MapboxGeocoder.Bbox): this;
|
|
357
|
+
/**
|
|
358
|
+
* Get a list of the countries to limit search results to
|
|
359
|
+
*/
|
|
263
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
|
+
*/
|
|
264
365
|
setCountries(countries: string): this;
|
|
366
|
+
/**
|
|
367
|
+
* Get a list of the types to limit search results to
|
|
368
|
+
*/
|
|
265
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
|
+
*/
|
|
266
374
|
setTypes(types: string): this;
|
|
375
|
+
/**
|
|
376
|
+
* Get the minimum number of characters typed to trigger results used in the plugin
|
|
377
|
+
*/
|
|
267
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
|
+
*/
|
|
268
383
|
setMinLength(minLength: number): this;
|
|
384
|
+
/**
|
|
385
|
+
* Get the limit value for the number of results to display used by the plugin
|
|
386
|
+
*/
|
|
269
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
|
+
*/
|
|
270
392
|
setLimit(limit: number): this;
|
|
393
|
+
/**
|
|
394
|
+
* Get the filter function used by the plugin
|
|
395
|
+
*/
|
|
271
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
|
+
*/
|
|
272
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
|
+
*/
|
|
273
406
|
setOrigin(origin: string): this;
|
|
407
|
+
/**
|
|
408
|
+
* Get the geocoding endpoint the plugin is currently set to
|
|
409
|
+
*/
|
|
274
410
|
getOrigin(): string;
|
|
411
|
+
/**
|
|
412
|
+
* Set the autocomplete option used for geocoding requests
|
|
413
|
+
* @param value The boolean value to set autocomplete to
|
|
414
|
+
*/
|
|
275
415
|
setAutocomplete(value: boolean): this;
|
|
416
|
+
/**
|
|
417
|
+
* Get the current autocomplete parameter value used for requests
|
|
418
|
+
*/
|
|
276
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
|
+
*/
|
|
277
424
|
setFuzzyMatch(value: boolean): this;
|
|
425
|
+
/**
|
|
426
|
+
* Get the current fuzzyMatch parameter value used for requests
|
|
427
|
+
*/
|
|
278
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
|
+
*/
|
|
279
433
|
setRouting(value: boolean): this;
|
|
434
|
+
/**
|
|
435
|
+
* Get the current routing parameter value used for requests
|
|
436
|
+
*/
|
|
280
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
|
+
*/
|
|
281
442
|
setWorldview(code: string): this;
|
|
443
|
+
/**
|
|
444
|
+
* Get the current worldview parameter value used for requests
|
|
445
|
+
*/
|
|
282
446
|
getWorldview(): string;
|
|
283
447
|
/**
|
|
284
448
|
* Subscribe to events that happen within the plugin.
|
|
285
|
-
* 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:
|
|
286
450
|
*
|
|
287
451
|
* - __clear__ `Emitted when the input is cleared`
|
|
288
452
|
* - __loading__ `{ query } Emitted when the geocoder is looking up a query`
|
|
289
453
|
* - __results__ `{ results } Fired when the geocoder returns a response`
|
|
290
454
|
* - __result__ `{ result } Fired when input is set`
|
|
291
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.
|
|
292
468
|
*/
|
|
293
|
-
|
|
294
|
-
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;
|
|
295
475
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/mapbox__mapbox-gl-geocoder",
|
|
3
|
-
"version": "
|
|
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
|
}
|