@maptiler/geocoding-control 1.4.2-dev.3 → 2.0.0-rc.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.
Files changed (74) hide show
  1. package/MapLibreBasedGeocodingControl.d.ts +2659 -35
  2. package/leaflet-controller.d.ts +1 -1
  3. package/leaflet-controller.js +580 -569
  4. package/leaflet-controller.js.map +1 -1
  5. package/leaflet-controller.umd.js +3 -3
  6. package/leaflet-controller.umd.js.map +1 -1
  7. package/leaflet.d.ts +74 -16
  8. package/leaflet.js +1396 -1369
  9. package/leaflet.js.map +1 -1
  10. package/leaflet.umd.js +3 -3
  11. package/leaflet.umd.js.map +1 -1
  12. package/maplibregl-controller.d.ts +7 -7
  13. package/maplibregl-controller.js +683 -661
  14. package/maplibregl-controller.js.map +1 -1
  15. package/maplibregl-controller.umd.js +3 -3
  16. package/maplibregl-controller.umd.js.map +1 -1
  17. package/maplibregl.d.ts +2614 -5
  18. package/maplibregl.js +1563 -1418
  19. package/maplibregl.js.map +1 -1
  20. package/maplibregl.umd.js +3 -3
  21. package/maplibregl.umd.js.map +1 -1
  22. package/maptilersdk.d.ts +2614 -5
  23. package/maptilersdk.js +1574 -1426
  24. package/maptilersdk.js.map +1 -1
  25. package/maptilersdk.umd.js +3 -3
  26. package/maptilersdk.umd.js.map +1 -1
  27. package/openlayers-controller.d.ts +1 -1
  28. package/openlayers-controller.js +308 -306
  29. package/openlayers-controller.js.map +1 -1
  30. package/openlayers-controller.umd.js +3 -3
  31. package/openlayers-controller.umd.js.map +1 -1
  32. package/openlayers.d.ts +21 -0
  33. package/openlayers.js +1300 -1318
  34. package/openlayers.js.map +1 -1
  35. package/openlayers.umd.js +3 -3
  36. package/openlayers.umd.js.map +1 -1
  37. package/package.json +17 -17
  38. package/react.d.ts +4 -4
  39. package/react.js +811 -798
  40. package/react.js.map +1 -1
  41. package/react.umd.js +1 -1
  42. package/react.umd.js.map +1 -1
  43. package/style.css +1 -1
  44. package/svelte/FeatureItem.svelte +1 -1
  45. package/svelte/FeatureItem.svelte.d.ts +1 -1
  46. package/svelte/GeocodingControl.svelte +68 -46
  47. package/svelte/GeocodingControl.svelte.d.ts +25 -11
  48. package/svelte/MapLibreBasedGeocodingControl.d.ts +2659 -35
  49. package/svelte/MapLibreBasedGeocodingControl.js +165 -58
  50. package/svelte/leaflet-controller.d.ts +1 -1
  51. package/svelte/leaflet-controller.js +50 -24
  52. package/svelte/leaflet.d.ts +74 -16
  53. package/svelte/leaflet.js +26 -15
  54. package/svelte/maplibregl-controller.d.ts +7 -7
  55. package/svelte/maplibregl-controller.js +96 -66
  56. package/svelte/maplibregl.d.ts +2614 -5
  57. package/svelte/maplibregl.js +10 -7
  58. package/svelte/maptilersdk.d.ts +2614 -5
  59. package/svelte/maptilersdk.js +23 -18
  60. package/svelte/openlayers-controller.d.ts +1 -1
  61. package/svelte/openlayers-controller.js +4 -1
  62. package/svelte/openlayers.d.ts +21 -0
  63. package/svelte/openlayers.js +31 -45
  64. package/svelte/react.d.ts +4 -4
  65. package/svelte/react.js +5 -5
  66. package/svelte/types.d.ts +72 -30
  67. package/svelte/vanilla.d.ts +14 -1
  68. package/svelte/vanilla.js +31 -8
  69. package/types.d.ts +72 -30
  70. package/vanilla.d.ts +14 -1
  71. package/vanilla.js +837 -796
  72. package/vanilla.js.map +1 -1
  73. package/vanilla.umd.js +1 -1
  74. package/vanilla.umd.js.map +1 -1
package/types.d.ts CHANGED
@@ -68,27 +68,32 @@ export type ControlOptions = {
68
68
  /**
69
69
  * Sets the amount of time, in milliseconds, to wait before querying the server when a user types into the Geocoder input box.
70
70
  * This parameter may be useful for reducing the total number of API calls made for a single query.
71
+ *
71
72
  * Default value is `200`.
72
73
  */
73
74
  debounceSearch?: number;
74
75
  /**
75
76
  * Search results closer to the proximity point will be given higher priority. First matching rule from the array will be used.
76
77
  * Set to `null` to disable the proximity.
78
+ *
77
79
  * Default value is `[{ type: "server-geolocation" }]`.
78
80
  */
79
81
  proximity?: ProximityRule[] | null;
80
82
  /**
81
83
  * Override the default placeholder attribute value.
84
+ *
82
85
  * Default value is `"Search"`.
83
86
  */
84
87
  placeholder?: string;
85
88
  /**
86
89
  * Override the default error message.
90
+ *
87
91
  * Default value is `"Something went wrong…"`.
88
92
  */
89
93
  errorMessage?: string;
90
94
  /**
91
95
  * Override the default message if no results are found.
96
+ *
92
97
  * Default value is `"Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"`.
93
98
  */
94
99
  noResultsMessage?: string;
@@ -100,11 +105,13 @@ export type ControlOptions = {
100
105
  /**
101
106
  * A bounding box argument: this is a bounding box given as an array in the format [minX, minY, maxX, maxY].
102
107
  * Search results will be limited to the bounding box.
108
+ *
103
109
  * Default value is `undefined`.
104
110
  */
105
111
  bbox?: BBox;
106
112
  /**
107
113
  * Maximum number of results to show.
114
+ *
108
115
  * Default value is `5`.
109
116
  */
110
117
  limit?: number;
@@ -113,18 +120,21 @@ export type ControlOptions = {
113
120
  * 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.
114
121
  * More than one value can also be specified, separated by commas.
115
122
  * Set to `null` or empty string for disabling language-specific searching.
116
- * Defaults to the browser's language settings.
117
- * Default value is `undefined`.
123
+ *
124
+ * Default value is `undefined` which means to use the browser's language settings.
118
125
  */
119
126
  language?: string | string[] | null;
120
127
  /**
121
128
  * If `false`, indicates that search will only occur on enter key press.
122
129
  * If `true`, indicates that the Geocoder will search on the input box being updated above the minLength option.
130
+ *
123
131
  * Default value is `false`.
124
132
  */
125
133
  showResultsWhileTyping?: boolean;
134
+ autocompleteTimeout?: number;
126
135
  /**
127
136
  * Set to `false` to disable fuzzy search.
137
+ *
128
138
  * Default value is `true`
129
139
  */
130
140
  fuzzyMatch?: boolean;
@@ -132,20 +142,11 @@ export type ControlOptions = {
132
142
  * On geocoded result what zoom level should the map animate to when a bbox in the response isn't present or is a point.
133
143
  * If a bbox is present and not a point then the map will fit to the bbox.
134
144
  *
135
- * Value can be a number (deprecated) or key-value pairs, where key is a <type> or <type>.<categoy> and value is the zoom level.
145
+ * Value is key-value pairs, where key is a <type> or <type>.<categoy> and the value is the zoom level.
136
146
  *
137
147
  * Default value is `GeocodingControl.ZOOM_DEFAULTS`.
138
148
  */
139
- zoom?: number | Record<string, number>;
140
- /**
141
- * On geocoded result what max zoom level should the map animate to when a bbox in the response isn't present or is a point.
142
- * Used for small features.
143
- *
144
- * If a bbox is present and not a point then the map will fit to the bbox.
145
- *
146
- * @deprecated use `zoom` option
147
- */
148
- maxZoom?: number;
149
+ zoom?: Record<string, number>;
149
150
  /**
150
151
  * If `true`, the geocoder control will collapse until hovered or in focus.
151
152
  * Default value is `false`.
@@ -163,78 +164,97 @@ export type ControlOptions = {
163
164
  filter?: (feature: Feature) => boolean;
164
165
  /**
165
166
  * Class of the root element.
167
+ *
166
168
  * Default value is `undefined`.
167
169
  */
168
170
  class?: string;
169
171
  /**
170
172
  * Set to `true` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active.
173
+ *
171
174
  * Default value is `false`
172
175
  */
173
176
  enableReverse?: boolean | "always";
174
177
  /**
175
- * Toggle reverse mode.
178
+ * Reverse mode.
179
+ *
176
180
  * Default value is `false`.
177
181
  */
178
182
  reverseActive?: boolean;
179
183
  /**
180
- * Reverse toggle button title.
184
+ * Title of the reverse toggle button.
185
+ *
181
186
  * Default value is `"toggle reverse geocoding"`.
182
187
  */
183
188
  reverseButtonTitle?: string;
184
189
  /**
185
- * Clear button title.
190
+ * Title of the clear button.
191
+ *
186
192
  * Default value is `"clear"`.
187
193
  */
188
194
  clearButtonTitle?: string;
189
195
  /**
190
- * Set to `false` to hide place/POI type. If set to `"always"` then type is shown for all items.
191
- * If set to `"ifNeeded"` then type is shown only for places/POIs not determined from the icon.
192
- * Default value is `"ifNeeded"`.
196
+ * Set to `"never"` to hide place/POI type. If set to `"always"` then type is shown for all items.
197
+ * If set to `"if-needed"` then type is shown only for places/POIs not determined from the icon.
198
+ *
199
+ * Default value is `"if-needed"`.
193
200
  */
194
- showPlaceType?: false | "always" | "ifNeeded";
201
+ showPlaceType?: "never" | "always" | "if-needed";
195
202
  /**
196
- * Set to `true` to show full feature geometry of the chosen result. Otherwise only marker will be shown.
203
+ * Style of the picked result on the map:
204
+ *
205
+ * - `"marker-only"` - show only marker at the center of the feature
206
+ * - `"full-geometry"` - show full feature geometry of the chosen result
207
+ * - `"full-geometry-including-polygon-center-marker"` - show full feature geometry of the chosen result together with a marker in the center of polygon feature
208
+ *
197
209
  * Default value is `true`.
198
210
  */
199
- showFullGeometry?: boolean;
211
+ pickedResultStyle?: "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
200
212
  /**
201
213
  * Limit search to specified country(ies).
214
+ *
202
215
  * Default value is `undefined` - use all countries.
203
216
  */
204
217
  country?: string | string[];
205
218
  /**
206
219
  * Filter of feature types to return.
220
+ *
207
221
  * Default value is `undefined` - all available feature types are returned.
208
222
  */
209
223
  types?: string[];
210
224
  /**
211
225
  * Use `limit` value for reverse geocoding even if `types` is not an array with a single element.
212
226
  * Will work only if enabled on the server.
227
+ *
213
228
  * Default value is `false`.
214
229
  */
215
230
  exhaustiveReverseGeocoding?: boolean;
216
231
  /**
217
232
  * If set to `true` then use all types except for those listed in `types`.
233
+ *
218
234
  * Default value is `false`.
219
235
  */
220
236
  excludeTypes?: boolean;
221
237
  /**
222
238
  * Geocoding API URL.
239
+ *
223
240
  * Default value is MapTiler Geocoding API URL.
224
241
  */
225
242
  apiUrl?: string;
226
243
  /**
227
244
  * Extra fetch parameters.
245
+ *
228
246
  * Default value is `undefined`.
229
247
  */
230
248
  fetchParameters?: RequestInit;
231
249
  /**
232
250
  * Base URL for POI icons.
251
+ *
233
252
  * Default value is `"icons/"` for Svelte apps, otherwise `"https://cdn.maptiler.com/maptiler-geocoding-control/v${version}/icons/"`.
234
253
  */
235
254
  iconsBaseUrl?: string;
236
255
  /**
237
256
  * Function to adjust URL search parameters.
257
+ *
238
258
  * Default value is empty function.
239
259
  */
240
260
  adjustUrlQuery?: (sp: URLSearchParams) => void;
@@ -257,16 +277,38 @@ export type ControlOptions = {
257
277
  */
258
278
  markerOnSelected?: boolean;
259
279
  };
260
- export type DispatcherType = {
261
- featuresListed: Feature[] | undefined;
262
- featuresMarked: Feature[] | undefined;
263
- optionsVisibilityChange: boolean;
264
- pick: Feature | undefined;
265
- queryChange: string;
280
+ export type DispatcherTypeCC = {
281
+ featuresListed: {
282
+ features: Feature[] | undefined;
283
+ };
284
+ featuresMarked: {
285
+ features: Feature[] | undefined;
286
+ };
287
+ optionsVisibilityChange: {
288
+ optionsVisible: boolean;
289
+ };
290
+ pick: {
291
+ feature: Feature | undefined;
292
+ };
293
+ queryChange: {
294
+ query: string;
295
+ };
266
296
  response: {
267
297
  url: string;
268
298
  featureCollection: FeatureCollection;
269
299
  };
270
- reverseToggle: boolean;
271
- select: Feature | undefined;
300
+ reverseToggle: {
301
+ reverse: boolean;
302
+ };
303
+ select: {
304
+ feature: Feature | undefined;
305
+ };
306
+ };
307
+ export type DispatcherType = {
308
+ [T in keyof DispatcherTypeCC as Lowercase<T>]: DispatcherTypeCC[T];
272
309
  };
310
+ export type RedefineType<OriginalType, UpdatedType extends {
311
+ [K in keyof OriginalType]: OriginalType[K];
312
+ } & {
313
+ [K in Exclude<keyof UpdatedType, keyof OriginalType>]: never;
314
+ }> = UpdatedType;
package/vanilla.d.ts CHANGED
@@ -1,7 +1,17 @@
1
- import type { ControlOptions, MapController } from "./types";
1
+ import type { ControlOptions, DispatcherType, MapController } from "./types";
2
2
  type Options = ControlOptions & {
3
3
  mapController?: MapController;
4
4
  };
5
+ interface GeocodingControlEvent<T> extends CustomEvent<T> {
6
+ readonly target: GeocodingControl;
7
+ readonly currentTarget: GeocodingControl;
8
+ }
9
+ type CustomEventListenerOrEventListenerObject<K extends keyof CustomEventMap> = ((evt: CustomEventMap[K]) => void) | {
10
+ handleEvent(object: CustomEventMap[K]): void;
11
+ };
12
+ type CustomEventMap = {
13
+ [T in keyof DispatcherType]: GeocodingControlEvent<DispatcherType[T]>;
14
+ };
5
15
  export declare class GeocodingControl extends EventTarget {
6
16
  #private;
7
17
  constructor({ target, ...options }: Options & {
@@ -13,5 +23,8 @@ export declare class GeocodingControl extends EventTarget {
13
23
  clearList(): void;
14
24
  focus(): void;
15
25
  blur(): void;
26
+ addEventListener<K extends keyof CustomEventMap>(type: K, callback: CustomEventListenerOrEventListenerObject<K> | null, options?: AddEventListenerOptions | boolean): void;
27
+ removeEventListener<K extends keyof CustomEventMap>(type: K, callback: CustomEventListenerOrEventListenerObject<K> | null, options?: EventListenerOptions | boolean): void;
28
+ dispatchEvent<K extends keyof CustomEventMap>(event: CustomEventMap[K]): boolean;
16
29
  }
17
30
  export {};