@maptiler/geocoding-control 0.0.83 → 0.0.84

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.
@@ -0,0 +1,14 @@
1
+ import type { Feature, FeatureCollection } from "./types";
2
+ export type DispatcherType = {
3
+ featuresListed: Feature[];
4
+ featuresMarked: Feature[];
5
+ optionsVisibilityChange: boolean;
6
+ pick: Feature;
7
+ queryChange: string;
8
+ response: {
9
+ url: string;
10
+ featureCollection: FeatureCollection;
11
+ };
12
+ reverseToggle: boolean;
13
+ select: Feature;
14
+ };
@@ -1,9 +1,8 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import { onDestroy } from "svelte/internal";
3
- import ReverseGeocodingIcon from "./ReverseGeocodingIcon.svelte";
4
3
  import ClearIcon from "./ClearIcon.svelte";
5
4
  import LoadingIcon from "./LoadingIcon.svelte";
6
- import MarkerIcon from "./MarkerIcon.svelte";
5
+ import ReverseGeocodingIcon from "./ReverseGeocodingIcon.svelte";
7
6
  import SearchIcon from "./SearchIcon.svelte";
8
7
  let className = undefined;
9
8
  export { className as class };
@@ -259,7 +258,10 @@ async function search(searchValue, { byId = false, exact = false, } = {}) {
259
258
  });
260
259
  }
261
260
  catch (e) {
262
- if (e && typeof e === "object" && e.name === "AbortError") {
261
+ if (e &&
262
+ typeof e === "object" &&
263
+ "name" in e &&
264
+ e.name === "AbortError") {
263
265
  return;
264
266
  }
265
267
  throw new Error();
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Feature, FeatureCollection, MapController, Proximity } from "./types";
2
+ import type { Feature, MapController, Proximity } from "./types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  class?: string | undefined;
@@ -37,17 +37,14 @@ declare const __propDef: {
37
37
  setQuery?: ((value: string, submit?: boolean) => void) | undefined;
38
38
  };
39
39
  events: {
40
- select: CustomEvent<Feature>;
41
- pick: CustomEvent<Feature>;
42
- optionsVisibilityChange: CustomEvent<boolean>;
43
- featuresListed: CustomEvent<Feature[]>;
44
- featuresMarked: CustomEvent<Feature[]>;
45
- response: CustomEvent<{
46
- url: string;
47
- featureCollection: FeatureCollection;
48
- }>;
49
- reverseToggle: CustomEvent<boolean>;
50
- queryChange: CustomEvent<string>;
40
+ select: CustomEvent<any>;
41
+ pick: CustomEvent<any>;
42
+ optionsVisibilityChange: CustomEvent<any>;
43
+ featuresListed: CustomEvent<any>;
44
+ featuresMarked: CustomEvent<any>;
45
+ reverseToggle: CustomEvent<any>;
46
+ queryChange: CustomEvent<any>;
47
+ response: CustomEvent<any>;
51
48
  } & {
52
49
  [evt: string]: CustomEvent<any>;
53
50
  };
package/README.md CHANGED
@@ -8,6 +8,29 @@ Geocoding control is also provided as [React component](#react-component) and a
8
8
 
9
9
  ## Usage
10
10
 
11
+ ### Example for MapTiler SDK using module bundler
12
+
13
+ ```
14
+ npm install --save @maptiler/geocoding-control @maptiler/sdk
15
+ ```
16
+
17
+ ```js
18
+ import * as maptilersdk from "@maptiler/sdk";
19
+ import { GeocodingControl } from "@maptiler/geocoding-control/maplibregl";
20
+ import "@maptiler/sdk/dist/maptiler-sdk.css";
21
+ import "@maptiler/geocoding-control/style.css";
22
+
23
+ maptilersdk.config.apiKey = "YOUR_MAPTILER_API_KEY_HERE";
24
+
25
+ const map = new maptilersdk.Map({
26
+ container: "map", // id of HTML container element
27
+ });
28
+
29
+ const gc = new GeocodingControl();
30
+
31
+ map.addControl(gc);
32
+ ```
33
+
11
34
  ### Example for MapLibre GL JS using module bundler
12
35
 
13
36
  ```bash
@@ -34,7 +57,7 @@ const gc = new GeocodingControl({ apiKey, maplibregl });
34
57
  map.addControl(gc);
35
58
  ```
36
59
 
37
- ### Example for Leaflet using module bundler
60
+ ### Example for Leaflet using module bundler
38
61
 
39
62
  ```bash
40
63
  npm install --save @maptiler/geocoding-control leaflet
@@ -112,6 +135,7 @@ For examples without using bundler see `demo-maplibregl.html` or `demo-leaflet.h
112
135
  - `focus(): void` - focus the query input box
113
136
  - `blur(): void` - blur the query input box
114
137
  - `setReverseMode(value: boolean | "always"): void` - set reverse mode
138
+ - `setOptions(options: Partial<Options>): void` - change one or more options of existing control
115
139
 
116
140
  ### Events
117
141
 
@@ -123,8 +147,8 @@ Events are implemented using [EventTarget](https://developer.mozilla.org/en-US/d
123
147
  - `featuresListed` - Fired after features are retrieved from the server. Event value contains list of features or `undefined`.
124
148
  - `featuresMarked` - Fired after features are marked on the map. Event value contains list of features or `undefined`.
125
149
  - `response` - Fired after HTTP response of the geocoding server. Event value contains object with requested `url` and responded `featureCollection`.
126
- - `reversetoggle` - Fired if reverse geocoding button is toggled. Event value is `true` if reverse geocoding mode is active, otherwise `false`.
127
- - `querychange` - Fired if query was changed. Event value is the query string.
150
+ - `reverseToggle` - Fired if reverse geocoding button is toggled. Event value is `true` if reverse geocoding mode is active, otherwise `false`.
151
+ - `queryChange` - Fired if query was changed. Event value is the query string.
128
152
 
129
153
  Example:
130
154
 
@@ -175,7 +199,10 @@ export function App() {
175
199
  <div>
176
200
  <GeocodingControl apiKey={apiKey} mapController={mapController} />
177
201
 
178
- <div ref={mapContainerRef} style={{ width: "800px", height: "600px", marginTop: "8px" }} />
202
+ <div
203
+ ref={mapContainerRef}
204
+ style={{ width: "800px", height: "600px", marginTop: "8px" }}
205
+ />
179
206
  </div>
180
207
  );
181
208
  }
@@ -210,7 +237,7 @@ Component API matches API described above where options and events are exposed a
210
237
  });
211
238
 
212
239
  mapController = createMaplibreglMapController(map, maplibregl);
213
- }
240
+ });
214
241
  </script>
215
242
 
216
243
  <div class="map" bind:this={container} />