@maptiler/geocoding-control 0.0.81 → 0.0.83
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/GeocodingControl.svelte +5 -0
- package/README.md +13 -14
- package/leaflet.js +13 -13
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +1 -1
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +4 -2
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +9 -5
- package/maplibregl.js +805 -795
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +5 -5
- package/maplibregl.umd.js.map +1 -1
- package/package.json +6 -2
- package/react.js +217 -217
- 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/GeocodingControl.svelte
CHANGED
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# MapTiler Geocoding control for MapLibre GL JS and Leaflet
|
|
1
|
+
# MapTiler Geocoding control for MapTiler SDK, MapLibre GL JS and Leaflet
|
|
2
2
|
|
|
3
|
-
A geocoding control for [
|
|
3
|
+
A geocoding control for [MapTiler SDK](https://github.com/maptiler/maptiler-sdk-js), [MapLibre GL JS](https://github.com/maplibre/maplibre-gl-js) and [Leaflet](https://leafletjs.com) utilizes [MapTiler Cloud Geocoding API](https://www.maptiler.com/cloud/geocoding/). With this control, users of your application can find any place on Earth (States, Cities, Streets, ...) down to the address level, restrict the search area to a specific country, highlight searched results on the map, autocomplete words while typing, and much more.
|
|
4
4
|
|
|
5
5
|
The component can be used as an ES module or UMD module.
|
|
6
6
|
|
|
7
|
-
Geocoding control is also provided as [React component](#react) and a [Svelte component](#svelte).
|
|
7
|
+
Geocoding control is also provided as [React component](#react-component) and a [Svelte component](#svelte-component).
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
### Example for
|
|
11
|
+
### Example for MapLibre GL JS using module bundler
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install --save @maptiler/geocoding-control maplibre-gl
|
|
@@ -69,15 +69,15 @@ L.control.maptilerGeocoding({ apiKey }).addTo(map);
|
|
|
69
69
|
|
|
70
70
|
For examples without using bundler see `demo-maplibregl.html` or `demo-leaflet.html`. After building this library (`npm install && npm run build`) you can open it in the browser:
|
|
71
71
|
|
|
72
|
-
-
|
|
72
|
+
- MapLibre GL JS: `sensible-browser file://$(pwd)/demo-maplibregl.html#key=YOUR_MAPTILER_API_KEY_HERE`
|
|
73
73
|
- Leaflet: `sensible-browser file://$(pwd)/demo-leaflet.html#key=YOUR_MAPTILER_API_KEY_HERE`
|
|
74
74
|
|
|
75
75
|
## API Documentation
|
|
76
76
|
|
|
77
77
|
### Options
|
|
78
78
|
|
|
79
|
-
- `apiKey`<sup>\*</sup>: `string` - Maptiler API key
|
|
80
|
-
- `maplibregl`: `MapLibreGL` - A
|
|
79
|
+
- `apiKey`<sup>\*</sup>: `string` - Maptiler API key. Not needed if used with MapTiler SDK.
|
|
80
|
+
- `maplibregl`: `MapLibreGL` - A MapLibre GL instance to use when creating [Markers](https://maplibre.org/maplibre-gl-js-docs/api/markers/#marker). Used if `options.marker` is `true` with MapLibre GL library. If not provided it will be autodetected. Not needed if used with MapTiler SDK.
|
|
81
81
|
- `debounceSearch`: `number` - Sets the amount of time, in milliseconds, to wait before querying the server when a user types into the Geocoder input box. This parameter may be useful for reducing the total number of API calls made for a single query. Default `200`.
|
|
82
82
|
- `proximity`: `[number, number]` - A proximity argument: this is a geographical point given as an object with latitude and longitude properties. Search results closer to this point will be given higher priority.
|
|
83
83
|
- `placeholder`: `string` - Override the default placeholder attribute value. Default `"Search"`.
|
|
@@ -134,7 +134,7 @@ geocodingControl.addEventListener("optionsVisibilityChange", (e) => {
|
|
|
134
134
|
});
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
##
|
|
137
|
+
## React component
|
|
138
138
|
|
|
139
139
|
In addition to using the component as MapLibre GL or Leaflet Control it is also possible to use it stand-alone in React projects with or without MapLibre GL or Leaflet integration.
|
|
140
140
|
|
|
@@ -146,7 +146,7 @@ Component API matches API described above where options and events are exposed a
|
|
|
146
146
|
import { useEffect, useRef, useState } from "react";
|
|
147
147
|
import { GeocodingControl } from "@maptiler/geocoding-control/react";
|
|
148
148
|
import { createMaplibreglMapController } from "@maptiler/geocoding-control/maplibregl-controller";
|
|
149
|
-
import type { MapController } from "@maptiler/geocoding-control/
|
|
149
|
+
import type { MapController } from "@maptiler/geocoding-control/types";
|
|
150
150
|
import "@maptiler/geocoding-control/style.css";
|
|
151
151
|
import maplibregl from "maplibre-gl";
|
|
152
152
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
@@ -181,7 +181,7 @@ export function App() {
|
|
|
181
181
|
}
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
##
|
|
184
|
+
## Svelte component
|
|
185
185
|
|
|
186
186
|
In addition to using the component as MapLibre GL or Leaflet Control it is also possible to use it stand-alone in Svelte projects with or without MapLibre GL or Leaflet integration.
|
|
187
187
|
|
|
@@ -191,9 +191,9 @@ Component API matches API described above where options and events are exposed a
|
|
|
191
191
|
|
|
192
192
|
```svelte
|
|
193
193
|
<script lang="ts">
|
|
194
|
-
import GeocodingControl from "@maptiler/geocoding-control/
|
|
195
|
-
import { createMaplibreglMapController } from "@maptiler/geocoding-control/
|
|
196
|
-
import type { MapController } from "@maptiler/geocoding-control/
|
|
194
|
+
import GeocodingControl from "@maptiler/geocoding-control/GeocodingControl.svelte";
|
|
195
|
+
import { createMaplibreglMapController } from "@maptiler/geocoding-control/maplibregl";
|
|
196
|
+
import type { MapController } from "@maptiler/geocoding-control/types";
|
|
197
197
|
import maplibregl from "maplibre-gl";
|
|
198
198
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
199
199
|
|
|
@@ -204,7 +204,6 @@ Component API matches API described above where options and events are exposed a
|
|
|
204
204
|
let container: HTMLElement;
|
|
205
205
|
|
|
206
206
|
onMount(() => {
|
|
207
|
-
|
|
208
207
|
const map = new maplibregl.Map({
|
|
209
208
|
style: "https://api.maptiler.com/maps/streets/style.json?key=" + apiKey,
|
|
210
209
|
container,
|
package/leaflet.js
CHANGED
|
@@ -475,7 +475,7 @@ function ua(r) {
|
|
|
475
475
|
"title",
|
|
476
476
|
/*reverseButtonTitle*/
|
|
477
477
|
r[9]
|
|
478
|
-
), B(t, "class", "svelte-
|
|
478
|
+
), B(t, "class", "svelte-gpexd2"), en(
|
|
479
479
|
t,
|
|
480
480
|
"active",
|
|
481
481
|
/*reverseActive*/
|
|
@@ -528,7 +528,7 @@ function Tl(r) {
|
|
|
528
528
|
t = oe("ul");
|
|
529
529
|
for (let s = 0; s < o.length; s += 1)
|
|
530
530
|
o[s].c();
|
|
531
|
-
B(t, "class", "svelte-
|
|
531
|
+
B(t, "class", "svelte-gpexd2");
|
|
532
532
|
},
|
|
533
533
|
m(s, a) {
|
|
534
534
|
We(s, t, a);
|
|
@@ -576,7 +576,7 @@ function Ml(r) {
|
|
|
576
576
|
t = oe("div"), e = Ur(
|
|
577
577
|
/*noResultsMessage*/
|
|
578
578
|
r[7]
|
|
579
|
-
), B(t, "class", "no-results svelte-
|
|
579
|
+
), B(t, "class", "no-results svelte-gpexd2");
|
|
580
580
|
},
|
|
581
581
|
m(n, i) {
|
|
582
582
|
We(n, t, i), ct(t, e);
|
|
@@ -616,7 +616,7 @@ function Fl(r) {
|
|
|
616
616
|
t = oe("div"), e = Ur(
|
|
617
617
|
/*errorMessage*/
|
|
618
618
|
r[6]
|
|
619
|
-
), B(t, "class", "error svelte-
|
|
619
|
+
), B(t, "class", "error svelte-gpexd2");
|
|
620
620
|
},
|
|
621
621
|
m(n, i) {
|
|
622
622
|
We(n, t, i), ct(t, e);
|
|
@@ -643,7 +643,7 @@ function la(r) {
|
|
|
643
643
|
), n;
|
|
644
644
|
return {
|
|
645
645
|
c() {
|
|
646
|
-
t = oe("span"), n = Ur(e), B(t, "class", "line2 svelte-
|
|
646
|
+
t = oe("span"), n = Ur(e), B(t, "class", "line2 svelte-gpexd2");
|
|
647
647
|
},
|
|
648
648
|
m(s, a) {
|
|
649
649
|
We(s, t, a), ct(t, n);
|
|
@@ -691,9 +691,9 @@ function ca(r) {
|
|
|
691
691
|
}
|
|
692
692
|
return {
|
|
693
693
|
c() {
|
|
694
|
-
t = oe("li"), e = oe("span"), n = oe("span"), i = oe("span"), s = Ur(o), a = er(), u = oe("span"), c = Ur(l), f = er(), d && d.c(), h = er(), B(i, "class", "primary svelte-
|
|
694
|
+
t = oe("li"), e = oe("span"), n = oe("span"), i = oe("span"), s = Ur(o), a = er(), u = oe("span"), c = Ur(l), f = er(), d && d.c(), h = er(), B(i, "class", "primary svelte-gpexd2"), B(u, "class", "secondary svelte-gpexd2"), B(n, "class", "line1 svelte-gpexd2"), B(e, "class", "texts svelte-gpexd2"), B(t, "tabindex", "0"), B(t, "data-selected", g = /*selectedItemIndex*/
|
|
695
695
|
r[13] === /*i*/
|
|
696
|
-
r[71]), B(t, "class", "svelte-
|
|
696
|
+
r[71]), B(t, "class", "svelte-gpexd2"), en(
|
|
697
697
|
t,
|
|
698
698
|
"selected",
|
|
699
699
|
/*selectedItemIndex*/
|
|
@@ -775,7 +775,7 @@ function Bl(r) {
|
|
|
775
775
|
let F = A(r), D = F && F(r);
|
|
776
776
|
return {
|
|
777
777
|
c() {
|
|
778
|
-
t = oe("form"), e = oe("div"), n = oe("button"), Do(i.$$.fragment), o = er(), s = oe("input"), a = er(), u = oe("div"), l = oe("button"), Do(c.$$.fragment), f = er(), E && E.c(), h = er(), N && N.c(), g = er(), b && b.c(), p = er(), D && D.c(), B(n, "type", "button"), B(n, "class", "svelte-
|
|
778
|
+
t = oe("form"), e = oe("div"), n = oe("button"), Do(i.$$.fragment), o = er(), s = oe("input"), a = er(), u = oe("div"), l = oe("button"), Do(c.$$.fragment), f = er(), E && E.c(), h = er(), N && N.c(), g = er(), b && b.c(), p = er(), D && D.c(), B(n, "type", "button"), B(n, "class", "svelte-gpexd2"), B(
|
|
779
779
|
s,
|
|
780
780
|
"placeholder",
|
|
781
781
|
/*placeholder*/
|
|
@@ -785,20 +785,20 @@ function Bl(r) {
|
|
|
785
785
|
"aria-label",
|
|
786
786
|
/*placeholder*/
|
|
787
787
|
r[8]
|
|
788
|
-
), B(s, "class", "svelte-
|
|
788
|
+
), B(s, "class", "svelte-gpexd2"), B(l, "type", "button"), B(
|
|
789
789
|
l,
|
|
790
790
|
"title",
|
|
791
791
|
/*clearButtonTitle*/
|
|
792
792
|
r[3]
|
|
793
|
-
), B(l, "class", "svelte-
|
|
793
|
+
), B(l, "class", "svelte-gpexd2"), en(
|
|
794
794
|
l,
|
|
795
795
|
"displayable",
|
|
796
796
|
/*searchValue*/
|
|
797
797
|
r[1] !== ""
|
|
798
|
-
), B(u, "class", "clear-button-container svelte-
|
|
798
|
+
), B(u, "class", "clear-button-container svelte-gpexd2"), B(e, "class", "input-group svelte-gpexd2"), B(t, "tabindex", "0"), B(t, "class", _ = ea(
|
|
799
799
|
/*className*/
|
|
800
800
|
r[2]
|
|
801
|
-
) + " svelte-
|
|
801
|
+
) + " svelte-gpexd2"), en(
|
|
802
802
|
t,
|
|
803
803
|
"can-collapse",
|
|
804
804
|
/*collapsed*/
|
|
@@ -921,7 +921,7 @@ function Bl(r) {
|
|
|
921
921
|
4 && _ !== (_ = ea(
|
|
922
922
|
/*className*/
|
|
923
923
|
R[2]
|
|
924
|
-
) + " svelte-
|
|
924
|
+
) + " svelte-gpexd2")) && B(t, "class", _), (!d || z[0] & /*className, collapsed, searchValue*/
|
|
925
925
|
22) && en(
|
|
926
926
|
t,
|
|
927
927
|
"can-collapse",
|