@maptiler/geocoding-control 2.1.0-with-autocomplete-timeout → 2.1.2
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/MapLibreBasedGeocodingControl.d.ts +35 -69
- package/leaflet-controller.js +1942 -1523
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +1 -22
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +2798 -2385
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +1 -22
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.js +1918 -1498
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +1 -22
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +34 -68
- package/maplibregl.js +2892 -2478
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +1 -22
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +34 -68
- package/maptilersdk.js +2896 -2481
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +1 -22
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.js +1686 -1264
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +1 -22
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +2778 -2365
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +1 -22
- package/openlayers.umd.js.map +1 -1
- package/package.json +23 -23
- package/react.js +753 -756
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +71 -58
- package/svelte/GeocodingControl.svelte.d.ts +5 -3
- package/svelte/MapLibreBasedGeocodingControl.d.ts +35 -69
- package/svelte/info.json +1 -0
- package/svelte/maplibregl.d.ts +34 -68
- package/svelte/maptilersdk.d.ts +34 -68
- package/svelte/maptilersdk.js +2 -0
- package/svelte/react.js +3 -0
- package/svelte/types.d.ts +175 -128
- package/types.d.ts +175 -128
- package/vanilla.js +847 -853
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/svelte/types.d.ts
CHANGED
|
@@ -62,247 +62,289 @@ export type ProximityRule = {
|
|
|
62
62
|
} & PositionOptions));
|
|
63
63
|
export type ControlOptions = {
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Callback function to adjust URL search parameters.
|
|
66
|
+
*
|
|
67
|
+
* Default: Empty function.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated Use `adjustUrl` instead.
|
|
66
70
|
*/
|
|
67
|
-
|
|
71
|
+
adjustUrlQuery?: (sp: URLSearchParams) => void;
|
|
68
72
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
73
|
+
* Callback function to adjust the geocoding URL before fetching.
|
|
74
|
+
*
|
|
75
|
+
* @param url [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) parameter that can be modified.
|
|
71
76
|
*
|
|
72
|
-
* Default
|
|
77
|
+
* Default: Empty function.
|
|
73
78
|
*/
|
|
74
|
-
|
|
79
|
+
adjustUrl?: (url: URL) => void;
|
|
75
80
|
/**
|
|
76
|
-
*
|
|
77
|
-
* Set to `null` to disable the proximity.
|
|
78
|
-
*
|
|
79
|
-
* Default value is `[{ type: "server-geolocation" }]`.
|
|
81
|
+
* MapTiler API key.
|
|
80
82
|
*/
|
|
81
|
-
|
|
83
|
+
apiKey: string;
|
|
82
84
|
/**
|
|
83
|
-
*
|
|
85
|
+
* Geocoding API URL.
|
|
84
86
|
*
|
|
85
|
-
* Default
|
|
87
|
+
* Default: MapTiler Geocoding API URL.
|
|
86
88
|
*/
|
|
87
|
-
|
|
89
|
+
apiUrl?: string;
|
|
88
90
|
/**
|
|
89
|
-
*
|
|
91
|
+
* Bounding box in the format `[minX, minY, maxX, maxY]` to limit search results.
|
|
90
92
|
*
|
|
91
|
-
* Default
|
|
93
|
+
* Default: `undefined`.
|
|
92
94
|
*/
|
|
93
|
-
|
|
95
|
+
bbox?: BBox;
|
|
94
96
|
/**
|
|
95
|
-
*
|
|
97
|
+
* CSS class for the root element.
|
|
96
98
|
*
|
|
97
|
-
* Default
|
|
99
|
+
* Default: `undefined`.
|
|
98
100
|
*/
|
|
99
|
-
|
|
101
|
+
class?: string;
|
|
100
102
|
/**
|
|
101
|
-
*
|
|
103
|
+
* Title of the clear button.
|
|
102
104
|
*
|
|
103
|
-
* Default
|
|
105
|
+
* Default: `"clear"`.
|
|
104
106
|
*/
|
|
105
|
-
|
|
107
|
+
clearButtonTitle?: string;
|
|
106
108
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
+
* Clears the result list after picking an item.
|
|
110
|
+
* Prevents redisplaying the list when the input box is focused.
|
|
109
111
|
*
|
|
110
|
-
* Default
|
|
112
|
+
* Default: `false`.
|
|
111
113
|
*/
|
|
112
|
-
|
|
114
|
+
clearListOnPick?: boolean;
|
|
113
115
|
/**
|
|
114
|
-
*
|
|
116
|
+
* Clears the input value when it loses focus.
|
|
115
117
|
*
|
|
116
|
-
* Default
|
|
118
|
+
* Default: `false`.
|
|
117
119
|
*/
|
|
118
|
-
|
|
120
|
+
clearOnBlur?: boolean;
|
|
119
121
|
/**
|
|
120
|
-
*
|
|
121
|
-
* 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.
|
|
122
|
-
* More than one value can also be specified, separated by commas.
|
|
123
|
-
* Set to `null` or empty string for disabling language-specific searching.
|
|
122
|
+
* Collapses the geocoder control until hovered or focused.
|
|
124
123
|
*
|
|
125
|
-
* Default
|
|
124
|
+
* Default: `false`.
|
|
126
125
|
*/
|
|
127
|
-
|
|
126
|
+
collapsed?: boolean;
|
|
128
127
|
/**
|
|
129
|
-
*
|
|
130
|
-
* If `true`, indicates that the Geocoder will search on the input box being updated above the minLength option.
|
|
128
|
+
* Limits search to the specified country or countries.
|
|
131
129
|
*
|
|
132
|
-
* Default
|
|
130
|
+
* Default: `undefined` (all countries).
|
|
133
131
|
*/
|
|
134
|
-
|
|
135
|
-
autocompleteTimeout?: number;
|
|
132
|
+
country?: string | string[];
|
|
136
133
|
/**
|
|
137
|
-
*
|
|
134
|
+
* Time delay (in milliseconds) before querying the server after typing in the input box.
|
|
135
|
+
* Useful for reducing the number of API calls.
|
|
138
136
|
*
|
|
139
|
-
* Default
|
|
137
|
+
* Default: `200`.
|
|
140
138
|
*/
|
|
141
|
-
|
|
139
|
+
debounceSearch?: number;
|
|
142
140
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
141
|
+
* Enables reverse geocoding:
|
|
142
|
+
* - `"button"`: Enables reverse geocoding button.
|
|
143
|
+
* - `"always"`: Reverse geocoding is always active.
|
|
145
144
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* Default value is `GeocodingControl.ZOOM_DEFAULTS`.
|
|
145
|
+
* Default: `"never"`.
|
|
149
146
|
*/
|
|
150
|
-
|
|
147
|
+
enableReverse?: EnableReverse;
|
|
151
148
|
/**
|
|
152
|
-
*
|
|
149
|
+
* Custom error message.
|
|
153
150
|
*
|
|
154
|
-
* Default
|
|
151
|
+
* Default: `"Something went wrong…"`.
|
|
155
152
|
*/
|
|
156
|
-
|
|
153
|
+
errorMessage?: string;
|
|
157
154
|
/**
|
|
158
|
-
*
|
|
155
|
+
* Includes all available types except those listed in the `types` option.
|
|
156
|
+
*
|
|
157
|
+
* See `reverseGeocodingExcludeTypes` for reverse geocoding exclusion.
|
|
159
158
|
*
|
|
160
|
-
* Default
|
|
159
|
+
* Default: `false`.
|
|
161
160
|
*/
|
|
162
|
-
|
|
161
|
+
excludeTypes?: boolean;
|
|
163
162
|
/**
|
|
164
|
-
*
|
|
163
|
+
* Uses the `limit` option value for reverse geocoding even if the `types` option has multiple elements.
|
|
164
|
+
* Works only if enabled on the server.
|
|
165
165
|
*
|
|
166
|
-
* Default
|
|
166
|
+
* Default: `false`.
|
|
167
167
|
*/
|
|
168
|
-
|
|
168
|
+
exhaustiveReverseGeocoding?: boolean;
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* Additional parameters for fetch requests.
|
|
171
171
|
*
|
|
172
|
-
* Default
|
|
172
|
+
* Default: `undefined`.
|
|
173
173
|
*/
|
|
174
|
-
|
|
174
|
+
fetchParameters?: RequestInit;
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
176
|
+
* Callback function to filter results from the Geocoding API response.
|
|
177
|
+
* The function should return `true` to keep an item, or `false` to exclude it.
|
|
178
178
|
*
|
|
179
|
-
* Default
|
|
179
|
+
* Default: A function that always returns `true`.
|
|
180
180
|
*/
|
|
181
181
|
filter?: (feature: Feature) => boolean;
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
183
|
+
* Animates the map to the selected feature from the result list.
|
|
184
184
|
*
|
|
185
|
-
* Default
|
|
185
|
+
* Default: `false`.
|
|
186
186
|
*/
|
|
187
|
-
|
|
187
|
+
flyToSelected?: boolean;
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
189
|
+
* Enables fuzzy search.
|
|
190
190
|
*
|
|
191
|
-
* Default
|
|
191
|
+
* Default: `true`.
|
|
192
192
|
*/
|
|
193
|
-
|
|
193
|
+
fuzzyMatch?: boolean;
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Base URL for POI icons.
|
|
196
196
|
*
|
|
197
|
-
* Default
|
|
197
|
+
* Default:
|
|
198
|
+
* - `"icons/"` for Svelte apps.
|
|
199
|
+
* - `"https://cdn.maptiler.com/maptiler-geocoding-control/v${version}/icons/"` for others.
|
|
198
200
|
*/
|
|
199
|
-
|
|
201
|
+
iconsBaseUrl?: string;
|
|
200
202
|
/**
|
|
201
|
-
*
|
|
203
|
+
* Keeps the result list open even if the control is unfocused.
|
|
202
204
|
*
|
|
203
|
-
* Default
|
|
205
|
+
* Default: `false`.
|
|
204
206
|
*/
|
|
205
|
-
|
|
207
|
+
keepListOpen?: boolean;
|
|
206
208
|
/**
|
|
207
|
-
*
|
|
209
|
+
* Language for response text and query weighting.
|
|
210
|
+
* Accepts IETF language tags.
|
|
211
|
+
* Set to `null` or an empty string to disable language-specific searching.
|
|
208
212
|
*
|
|
209
|
-
* Default
|
|
213
|
+
* Default: `undefined` (uses the browser's language settings).
|
|
210
214
|
*/
|
|
211
|
-
|
|
215
|
+
language?: string | string[] | null;
|
|
212
216
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
217
|
+
* Maximum number of results to display.
|
|
218
|
+
*
|
|
219
|
+
* See `reverseGeocodingLimit` for reverse geocoding limits.
|
|
215
220
|
*
|
|
216
|
-
* Default
|
|
221
|
+
* Default: `5`.
|
|
217
222
|
*/
|
|
218
|
-
|
|
223
|
+
limit?: number;
|
|
219
224
|
/**
|
|
220
|
-
*
|
|
225
|
+
* Displays a marker on the selected feature from the result list.
|
|
221
226
|
*
|
|
222
|
-
*
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
* Default: `true`.
|
|
228
|
+
*/
|
|
229
|
+
markerOnSelected?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Minimum number of characters required to start a search.
|
|
225
232
|
*
|
|
226
|
-
* Default
|
|
233
|
+
* Default: `2`.
|
|
227
234
|
*/
|
|
228
|
-
|
|
235
|
+
minLength?: number;
|
|
229
236
|
/**
|
|
230
|
-
*
|
|
237
|
+
* Custom message for when no results are found.
|
|
231
238
|
*
|
|
232
|
-
* Default
|
|
239
|
+
* Default:
|
|
240
|
+
* ```
|
|
241
|
+
* "Oops! Looks like you're trying to predict something that's not quite right.
|
|
242
|
+
* We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term.
|
|
243
|
+
* Keep on typing - we'll do our best to get you where you need to go!"
|
|
244
|
+
* ```
|
|
233
245
|
*/
|
|
234
|
-
|
|
246
|
+
noResultsMessage?: string;
|
|
235
247
|
/**
|
|
236
|
-
*
|
|
248
|
+
* Style of the picked result on the map:
|
|
249
|
+
* - `"marker-only"`: Show only a marker at the center of the feature.
|
|
250
|
+
* - `"full-geometry"`: Display the full feature geometry.
|
|
251
|
+
* - `"full-geometry-including-polygon-center-marker"`: Display full geometry with a marker at the polygon center.
|
|
237
252
|
*
|
|
238
|
-
* Default
|
|
253
|
+
* Default: `"full-geometry"`.
|
|
239
254
|
*/
|
|
240
|
-
|
|
255
|
+
pickedResultStyle?: PickedResultStyle;
|
|
241
256
|
/**
|
|
242
|
-
*
|
|
243
|
-
* Will work only if enabled on the server.
|
|
257
|
+
* Custom placeholder for the input box.
|
|
244
258
|
*
|
|
245
|
-
* Default
|
|
259
|
+
* Default: `"Search"`.
|
|
246
260
|
*/
|
|
247
|
-
|
|
261
|
+
placeholder?: string;
|
|
248
262
|
/**
|
|
249
|
-
*
|
|
263
|
+
* Prioritizes search results closer to a proximity point.
|
|
264
|
+
* The first matching rule in the array is used.
|
|
265
|
+
* Set to `null` to disable proximity.
|
|
250
266
|
*
|
|
251
|
-
* Default
|
|
267
|
+
* Default: `[ { type: "server-geolocation" } ]`.
|
|
252
268
|
*/
|
|
253
|
-
|
|
269
|
+
proximity?: ProximityRule[] | null;
|
|
254
270
|
/**
|
|
255
|
-
*
|
|
271
|
+
* Activates reverse geocoding.
|
|
256
272
|
*
|
|
257
|
-
* Default
|
|
273
|
+
* Default: `false`.
|
|
258
274
|
*/
|
|
259
|
-
|
|
275
|
+
reverseActive?: boolean;
|
|
260
276
|
/**
|
|
261
|
-
*
|
|
277
|
+
* Title of the reverse geocoding toggle button.
|
|
262
278
|
*
|
|
263
|
-
* Default
|
|
279
|
+
* Default: `"toggle reverse geocoding"`.
|
|
264
280
|
*/
|
|
265
|
-
|
|
281
|
+
reverseButtonTitle?: string;
|
|
266
282
|
/**
|
|
267
|
-
*
|
|
283
|
+
* Excludes types for reverse geocoding.
|
|
268
284
|
*
|
|
269
|
-
* Default
|
|
285
|
+
* Default: Same as `excludeTypes`.
|
|
270
286
|
*/
|
|
271
|
-
|
|
287
|
+
reverseGeocodingExcludeTypes?: boolean;
|
|
272
288
|
/**
|
|
273
|
-
*
|
|
289
|
+
* Limits results for reverse geocoding.
|
|
290
|
+
* Applied only if value is 1 or effective types contain a single value.
|
|
274
291
|
*
|
|
275
|
-
*
|
|
292
|
+
* See also `reverseGeocodingTypes` option.
|
|
276
293
|
*
|
|
277
|
-
*
|
|
294
|
+
* Default: The value of the `limit` option if set. If effective types contain a single value, the default is `1`. In all other cases, this option is not used.
|
|
278
295
|
*/
|
|
279
|
-
|
|
296
|
+
reverseGeocodingLimit?: number;
|
|
280
297
|
/**
|
|
281
|
-
*
|
|
298
|
+
* Specifies types for reverse geocoding.
|
|
299
|
+
*
|
|
300
|
+
* If effective types are multiple values, the `limit`/`reverseGeocodingLimit` option is ignored.
|
|
282
301
|
*
|
|
283
|
-
*
|
|
302
|
+
* See also `reverseGeocodingLimit` option.
|
|
284
303
|
*
|
|
285
|
-
* Default
|
|
304
|
+
* Default: Same as `types`.
|
|
286
305
|
*/
|
|
287
|
-
|
|
306
|
+
reverseGeocodingTypes?: TypeRule[];
|
|
288
307
|
/**
|
|
289
|
-
* Automatically
|
|
308
|
+
* Automatically selects the first feature in the result list.
|
|
290
309
|
*
|
|
291
|
-
* Default
|
|
310
|
+
* Default: `true`.
|
|
292
311
|
*/
|
|
293
312
|
selectFirst?: boolean;
|
|
294
313
|
/**
|
|
295
|
-
*
|
|
314
|
+
* Indicates when to show place/POI types in the dropdown:
|
|
315
|
+
* - `"never"`: Hide the type.
|
|
316
|
+
* - `"always"`: Always show the type.
|
|
317
|
+
* - `"if-needed"`: Show the type only if it cannot be determined from the icon.
|
|
296
318
|
*
|
|
297
|
-
* Default
|
|
319
|
+
* Default: `"if-needed"`.
|
|
298
320
|
*/
|
|
299
|
-
|
|
321
|
+
showPlaceType?: ShowPlaceType;
|
|
300
322
|
/**
|
|
301
|
-
*
|
|
323
|
+
* Displays results while typing:
|
|
324
|
+
* - `false`: Search occurs only on pressing the Enter key.
|
|
325
|
+
* - `true`: Search begins when the input meets the `minLength` requirement.
|
|
302
326
|
*
|
|
303
|
-
* Default
|
|
327
|
+
* Default: `false`.
|
|
304
328
|
*/
|
|
305
|
-
|
|
329
|
+
showResultsWhileTyping?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Types to query, either as an array or `[minZoom, maxZoom, type]` format.
|
|
332
|
+
* `minZoom` is inclusive, `maxZoom` is exclusive, and either can be `null` or `undefined` for unbounded values.
|
|
333
|
+
*
|
|
334
|
+
* See `reverseGeocodingTypes` option for reverse geocoding types.
|
|
335
|
+
*
|
|
336
|
+
* Default: `undefined` (uses server default feature types).
|
|
337
|
+
*/
|
|
338
|
+
types?: TypeRule[];
|
|
339
|
+
/**
|
|
340
|
+
* Specifies the zoom level to animate the map to for a geocoded result when no bounding box is present or when the result is a point.
|
|
341
|
+
* If a bounding box is present and not a point, the map will fit to the bounding box.
|
|
342
|
+
*
|
|
343
|
+
* Values are key-value pairs where the key is a `<type>` or `<type>.<category>` and the value is the zoom level.
|
|
344
|
+
*
|
|
345
|
+
* Default: `GeocodingControl.ZOOM_DEFAULTS`.
|
|
346
|
+
*/
|
|
347
|
+
zoom?: Record<string, number>;
|
|
306
348
|
};
|
|
307
349
|
export type PickedResultStyle = "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
|
|
308
350
|
export type EnableReverse = "never" | "always" | "button";
|
|
@@ -342,3 +384,8 @@ export type RedefineType<OriginalType, UpdatedType extends {
|
|
|
342
384
|
} & {
|
|
343
385
|
[K in Exclude<keyof UpdatedType, keyof OriginalType>]: never;
|
|
344
386
|
}> = UpdatedType;
|
|
387
|
+
export type TypeRule = string | [
|
|
388
|
+
minZoom: number | null | undefined,
|
|
389
|
+
maxZoom: number | null | undefined,
|
|
390
|
+
type: string
|
|
391
|
+
];
|