@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/leaflet.d.ts CHANGED
@@ -1,34 +1,92 @@
1
1
  import * as L from "leaflet";
2
- import type { ControlOptions } from "./types";
2
+ import type { ControlOptions, DispatcherType, Feature } from "./types";
3
3
  export { createLeafletMapController } from "./leaflet-controller";
4
4
  type LeafletControlOptions = ControlOptions & L.ControlOptions & {
5
5
  /**
6
- * If `true`, a [Marker](https://leafletjs.com/reference.html#marker) will be added to the map at the location of the user-selected result using a default set of Marker options.
7
- * If the value is an object, the marker will be constructed using these options.
8
- * If `false`, no marker will be added to the map.
6
+ * Marker to be added to the map at the location of the user-selected result using a default set of Marker options.
7
+ *
8
+ * - If `true` or `undefined` then a default marker will be used.\
9
+ * - If the value is [MarkerOptions](https://leafletjs.com/reference.html#marker-option) then the marker will be constructed using these options.
10
+ * - If the value is a function then it can create and configure custom [Marker](https://leafletjs.com/reference.html#marker),
11
+ * add it to the [Map](https://leafletjs.com/reference.html#map) and return it.
12
+ * Function accepts [Map](https://leafletjs.com/reference.html#map) and `Feature` as parameters.
13
+ * Feature is `undefined` for the reverse location marker.
14
+ * - If `false` or `null` then no marker will be added to the map.
15
+ *
9
16
  * Default value is `true`.
10
17
  */
11
- marker?: boolean | L.MarkerOptions;
18
+ marker?: null | boolean | L.MarkerOptions | ((map: L.Map, feature?: Feature) => L.Marker | undefined | null);
12
19
  /**
13
- * If `true`, [Markers](https://leafletjs.com/reference.html#marker) will be added to the map at the location the top results for the query.
14
- * If the value is an object, the marker will be constructed using these options.
15
- * If `false`, no marker will be added to the map.
20
+ * Marker be added to the map at the location the geocoding results.
21
+ *
22
+ * - If `true` or `undefined` then a default marker will be used.
23
+ * - If the value is [MarkerOptions](https://leafletjs.com/reference.html#marker-option) then the marker will be constructed using these options.
24
+ * - If the value is a function then it can create and configure custom [Marker](https://leafletjs.com/reference.html#marker),
25
+ * add it to the [Map](https://leafletjs.com/reference.html#map) and return it.
26
+ * In this case the default pop-up won't be added to the marker.
27
+ * Function accepts [Map](https://leafletjs.com/reference.html#map) and `Feature` as parameters.
28
+ * - If `false` or `null` then no marker will be added to the map.
29
+ *
16
30
  * Default value is `true`.
17
31
  */
18
- showResultMarkers?: boolean | L.MarkerOptions;
32
+ showResultMarkers?: null | boolean | L.MarkerOptions | ((map: L.Map, feature: Feature) => L.Marker | undefined | null);
19
33
  /**
20
- * If `false`, animating the map to a selected result is disabled.
21
- * If `true`, animating the map will use the default animation parameters.
22
- * If an object, it will be passed as options to the map `flyTo` or `fitBounds` method providing control over the animation of the transition.
34
+ * Animation to selected feature on the map.
35
+ *
36
+ * - If `false` or `null` then animating the map to a selected result is disabled.
37
+ * - If `true` or `undefined` then animating the map will use the default animation parameters.
38
+ * - If an [ZoomPanOptions](https://leafletjs.com/reference.html#zoom/pan-options)
39
+ * ` & `[FitBoundsOptions](https://leafletjs.com/reference.html#fitbounds-options) then it will be passed as options
40
+ * to the map [flyTo](https://leafletjs.com/reference.html#map-flyto)
41
+ * or [fitBounds](https://leafletjs.com/reference.html#map-fitbounds) method providing control over the animation of the transition.
42
+ *
23
43
  * Default value is `true`.
24
44
  */
25
- flyTo?: boolean | (L.ZoomPanOptions & L.FitBoundsOptions);
45
+ flyTo?: null | boolean | (L.ZoomPanOptions & L.FitBoundsOptions);
26
46
  /**
27
- * Style for full feature geometry GeoJSON.
47
+ * Style for the full feature geometry.
48
+ *
49
+ * - If `false` or `null` then no full geometry is drawn.
50
+ * - If `true` or `undefined` then default-styled full geometry is drawn.
51
+ * - If an [PathOptions](https://leafletjs.com/reference.html#path-option) then it will be used to style the full geometry.
52
+ * - If a function accepting a `Feature` and returning [PathOptions](https://leafletjs.com/reference.html#path-option)
53
+ * then it must teturn the style and will be used to style the full geometry.
28
54
  */
29
- fullGeometryStyle?: L.PathOptions | L.StyleFunction;
55
+ fullGeometryStyle?: null | boolean | L.PathOptions | L.StyleFunction;
30
56
  };
31
- export declare class GeocodingControl extends L.Control {
57
+ type LeafletEvent<T> = {
58
+ type: T;
59
+ target: GeocodingControl;
60
+ sourceTarget: GeocodingControl;
61
+ };
62
+ type CustomEventMap = {
63
+ [T in keyof DispatcherType]: DispatcherType[T] & LeafletEvent<T>;
64
+ };
65
+ /**
66
+ * Leaflet mixins https://leafletjs.com/reference.html#class
67
+ * for TypeScript https://www.typescriptlang.org/docs/handbook/mixins.html
68
+ * @internal
69
+ */
70
+ declare class EventedControl extends L.Control {
71
+ }
72
+ interface EventedControl extends L.Control {
73
+ on<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
74
+ addEventListener<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
75
+ once<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
76
+ addOneTimeEventListener<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
77
+ off<T extends keyof CustomEventMap>(type?: T, fn?: (event: CustomEventMap[T]) => void, context?: unknown): this;
78
+ off(eventMap?: {
79
+ [T in keyof CustomEventMap]?: (event: CustomEventMap[T]) => void;
80
+ }): this;
81
+ removeEventListener<T extends keyof CustomEventMap>(type?: T, fn?: (event: CustomEventMap[T]) => void, context?: unknown): this;
82
+ listens<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown, propagate?: boolean): boolean;
83
+ fire(type: string, data?: unknown, propagate?: boolean): this;
84
+ addEventParent(obj: L.Evented): this;
85
+ removeEventParent(obj: L.Evented): this;
86
+ fireEvent(type: string, data?: unknown, propagate?: boolean): this;
87
+ hasEventListeners<T extends keyof CustomEventMap>(type: T): boolean;
88
+ }
89
+ export declare class GeocodingControl extends EventedControl {
32
90
  #private;
33
91
  constructor(options: LeafletControlOptions);
34
92
  onAdd(map: L.Map): HTMLDivElement;