@maptiler/geocoding-control 1.4.2-dev.2 → 2.0.0-rc.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/MapLibreBasedGeocodingControl.d.ts +2971 -35
- package/leaflet-controller.d.ts +1 -1
- package/leaflet-controller.js +580 -569
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -3
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.d.ts +74 -16
- package/leaflet.js +1344 -1311
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +7 -7
- package/maplibregl-controller.js +683 -661
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.js +1632 -1481
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +1642 -1488
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +1 -1
- package/openlayers-controller.js +308 -306
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.d.ts +21 -0
- package/openlayers.js +1301 -1313
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +18 -18
- package/react.d.ts +4 -4
- package/react.js +663 -644
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte.d.ts +1 -1
- package/svelte/GeocodingControl.svelte +64 -33
- package/svelte/GeocodingControl.svelte.d.ts +25 -9
- package/svelte/MapLibreBasedGeocodingControl.d.ts +2971 -35
- package/svelte/MapLibreBasedGeocodingControl.js +166 -58
- package/svelte/leaflet-controller.d.ts +1 -1
- package/svelte/leaflet-controller.js +50 -24
- package/svelte/leaflet.d.ts +74 -16
- package/svelte/leaflet.js +25 -15
- package/svelte/maplibregl-controller.d.ts +7 -7
- package/svelte/maplibregl-controller.js +96 -66
- package/svelte/maplibregl.js +10 -7
- package/svelte/maptilersdk.js +23 -18
- package/svelte/openlayers-controller.d.ts +1 -1
- package/svelte/openlayers-controller.js +4 -1
- package/svelte/openlayers.d.ts +21 -0
- package/svelte/openlayers.js +30 -45
- package/svelte/react.d.ts +4 -4
- package/svelte/types.d.ts +38 -12
- package/svelte/vanilla.d.ts +14 -1
- package/svelte/vanilla.js +31 -8
- package/types.d.ts +38 -12
- package/vanilla.d.ts +14 -1
- package/vanilla.js +838 -791
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
- package/maplibregl.d.ts +0 -16
- package/maptilersdk.d.ts +0 -11
- package/svelte/maplibregl.d.ts +0 -16
- package/svelte/maptilersdk.d.ts +0 -11
package/svelte/vanilla.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import GeocodingControlComponent from "./GeocodingControl.svelte";
|
|
2
2
|
const finalizationRegistry = new FinalizationRegistry((gc) => {
|
|
3
3
|
gc.$destroy();
|
|
4
4
|
});
|
|
@@ -6,22 +6,31 @@ export class GeocodingControl extends EventTarget {
|
|
|
6
6
|
#gc;
|
|
7
7
|
constructor({ target, ...options }) {
|
|
8
8
|
super();
|
|
9
|
-
this.#gc = new
|
|
9
|
+
this.#gc = new GeocodingControlComponent({
|
|
10
10
|
target,
|
|
11
11
|
props: options,
|
|
12
12
|
});
|
|
13
13
|
for (const eventName of [
|
|
14
14
|
"select",
|
|
15
15
|
"pick",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"featureslisted",
|
|
17
|
+
"featuresmarked",
|
|
18
18
|
"response",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
19
|
+
"optionsvisibilitychange",
|
|
20
|
+
"reversetoggle",
|
|
21
|
+
"querychange",
|
|
22
22
|
]) {
|
|
23
|
-
this.#gc.$on(eventName, (event) =>
|
|
23
|
+
this.#gc.$on(eventName, (event) => {
|
|
24
|
+
// Use the new `emit` method for type-safe dispatching
|
|
25
|
+
this.#emit(eventName, event.detail);
|
|
26
|
+
});
|
|
24
27
|
}
|
|
28
|
+
this.#gc.$on("select", (event) => {
|
|
29
|
+
const geocodingEvent = new CustomEvent(event.type, {
|
|
30
|
+
detail: event.detail,
|
|
31
|
+
});
|
|
32
|
+
this.dispatchEvent(geocodingEvent);
|
|
33
|
+
});
|
|
25
34
|
finalizationRegistry.register(this, this.#gc);
|
|
26
35
|
}
|
|
27
36
|
setOptions(options) {
|
|
@@ -42,4 +51,18 @@ export class GeocodingControl extends EventTarget {
|
|
|
42
51
|
blur() {
|
|
43
52
|
this.#gc?.blur();
|
|
44
53
|
}
|
|
54
|
+
addEventListener(type, callback, options) {
|
|
55
|
+
super.addEventListener(type, callback, options);
|
|
56
|
+
}
|
|
57
|
+
removeEventListener(type, callback, options) {
|
|
58
|
+
super.removeEventListener(type, callback, options);
|
|
59
|
+
}
|
|
60
|
+
dispatchEvent(event) {
|
|
61
|
+
return super.dispatchEvent(event);
|
|
62
|
+
}
|
|
63
|
+
#emit(type, detail) {
|
|
64
|
+
return super.dispatchEvent(new CustomEvent(type, {
|
|
65
|
+
detail,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
45
68
|
}
|
package/types.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export type ControlOptions = {
|
|
|
123
123
|
* Default value is `false`.
|
|
124
124
|
*/
|
|
125
125
|
showResultsWhileTyping?: boolean;
|
|
126
|
+
autocompleteTimeout?: number;
|
|
126
127
|
/**
|
|
127
128
|
* Set to `false` to disable fuzzy search.
|
|
128
129
|
* Default value is `true`
|
|
@@ -188,15 +189,16 @@ export type ControlOptions = {
|
|
|
188
189
|
clearButtonTitle?: string;
|
|
189
190
|
/**
|
|
190
191
|
* 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 `"
|
|
192
|
+
* If set to `"if-needed"` (deprecated `"ifNeeded"`) then type is shown only for places/POIs not determined from the icon.
|
|
193
|
+
* Default value is `"if-needed"`.
|
|
193
194
|
*/
|
|
194
|
-
showPlaceType?: false | "always" | "ifNeeded";
|
|
195
|
+
showPlaceType?: false | "always" | "ifNeeded" | "if-needed";
|
|
195
196
|
/**
|
|
196
197
|
* Set to `true` to show full feature geometry of the chosen result. Otherwise only marker will be shown.
|
|
198
|
+
* If `"polygon-with-marker"` is specified, then also a marker will be shown in the hotspot or center of polygon features.
|
|
197
199
|
* Default value is `true`.
|
|
198
200
|
*/
|
|
199
|
-
showFullGeometry?: boolean;
|
|
201
|
+
showFullGeometry?: boolean | "polygon-with-marker";
|
|
200
202
|
/**
|
|
201
203
|
* Limit search to specified country(ies).
|
|
202
204
|
* Default value is `undefined` - use all countries.
|
|
@@ -207,6 +209,12 @@ export type ControlOptions = {
|
|
|
207
209
|
* Default value is `undefined` - all available feature types are returned.
|
|
208
210
|
*/
|
|
209
211
|
types?: string[];
|
|
212
|
+
/**
|
|
213
|
+
* Use `limit` value for reverse geocoding even if `types` is not an array with a single element.
|
|
214
|
+
* Will work only if enabled on the server.
|
|
215
|
+
* Default value is `false`.
|
|
216
|
+
*/
|
|
217
|
+
exhaustiveReverseGeocoding?: boolean;
|
|
210
218
|
/**
|
|
211
219
|
* If set to `true` then use all types except for those listed in `types`.
|
|
212
220
|
* Default value is `false`.
|
|
@@ -251,16 +259,34 @@ export type ControlOptions = {
|
|
|
251
259
|
*/
|
|
252
260
|
markerOnSelected?: boolean;
|
|
253
261
|
};
|
|
254
|
-
export type
|
|
255
|
-
featuresListed:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
262
|
+
export type DispatcherTypeCC = {
|
|
263
|
+
featuresListed: {
|
|
264
|
+
features: Feature[] | undefined;
|
|
265
|
+
};
|
|
266
|
+
featuresMarked: {
|
|
267
|
+
features: Feature[] | undefined;
|
|
268
|
+
};
|
|
269
|
+
optionsVisibilityChange: {
|
|
270
|
+
optionsVisible: boolean;
|
|
271
|
+
};
|
|
272
|
+
pick: {
|
|
273
|
+
feature: Feature | undefined;
|
|
274
|
+
};
|
|
275
|
+
queryChange: {
|
|
276
|
+
query: string;
|
|
277
|
+
};
|
|
260
278
|
response: {
|
|
261
279
|
url: string;
|
|
262
280
|
featureCollection: FeatureCollection;
|
|
263
281
|
};
|
|
264
|
-
reverseToggle:
|
|
265
|
-
|
|
282
|
+
reverseToggle: {
|
|
283
|
+
reverse: boolean;
|
|
284
|
+
};
|
|
285
|
+
select: {
|
|
286
|
+
feature: Feature | undefined;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
export type DispatcherType = {
|
|
290
|
+
[T in keyof DispatcherTypeCC as Lowercase<T>]: DispatcherTypeCC[T];
|
|
266
291
|
};
|
|
292
|
+
export type EnsureMatchingKeys<T, U> = keyof T extends keyof U ? keyof U extends keyof T ? true : never : never;
|
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 {};
|