@maptiler/geocoding-control 3.0.0-rc.5 → 3.0.0-rc.7
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/dist/index.js +336 -326
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +54 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +394 -383
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +50 -45
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +354 -343
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +49 -44
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +370 -359
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +61 -56
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +399 -388
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +52 -47
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/controls/leaflet-options.d.ts +11 -1
- package/dist/src/controls/maplibregl-options.d.ts +12 -2
- package/dist/src/controls/openlayers-options.d.ts +11 -1
- package/dist/src/geocoder/geocoder-events.d.ts +1 -0
- package/dist/src/geocoder/geocoder.d.ts +4 -2
- package/dist/src/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
3
|
-
import { convert as
|
|
1
|
+
import { css as L, LitElement as F, svg as D, html as f, unsafeCSS as fe, nothing as Z } from "lit";
|
|
2
|
+
import { customElement as O, property as h, state as v, query as Ue } from "lit/decorators.js";
|
|
3
|
+
import { convert as Be } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as j } from "lit/directives/class-map.js";
|
|
5
|
-
import { repeat as
|
|
5
|
+
import { repeat as Me } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
|
-
import { styleMap as
|
|
8
|
-
var
|
|
9
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
10
|
-
(
|
|
7
|
+
import { styleMap as Ee } from "lit/directives/style-map.js";
|
|
8
|
+
var Ge = Object.getOwnPropertyDescriptor, We = (e, t, i, n) => {
|
|
9
|
+
for (var s = n > 1 ? void 0 : n ? Ge(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
10
|
+
(l = e[p]) && (s = l(s) || s);
|
|
11
11
|
return s;
|
|
12
12
|
};
|
|
13
|
-
let
|
|
13
|
+
let Q = class extends F {
|
|
14
14
|
render() {
|
|
15
|
-
return
|
|
15
|
+
return D`
|
|
16
16
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
17
17
|
<path
|
|
18
18
|
d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
|
|
@@ -21,23 +21,23 @@ let H = class extends L {
|
|
|
21
21
|
`;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
Q.styles = L`
|
|
25
25
|
svg {
|
|
26
26
|
display: block;
|
|
27
27
|
fill: var(--color-icon-button);
|
|
28
28
|
}
|
|
29
29
|
`;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
],
|
|
33
|
-
var
|
|
34
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
35
|
-
(
|
|
30
|
+
Q = We([
|
|
31
|
+
O("maptiler-geocode-clear-icon")
|
|
32
|
+
], Q);
|
|
33
|
+
var je = Object.getOwnPropertyDescriptor, Ae = (e, t, i, n) => {
|
|
34
|
+
for (var s = n > 1 ? void 0 : n ? je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
35
|
+
(l = e[p]) && (s = l(s) || s);
|
|
36
36
|
return s;
|
|
37
37
|
};
|
|
38
|
-
let
|
|
38
|
+
let H = class extends F {
|
|
39
39
|
render() {
|
|
40
|
-
return
|
|
40
|
+
return D`
|
|
41
41
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
42
42
|
<path
|
|
43
43
|
d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
|
|
@@ -46,21 +46,21 @@ let J = class extends L {
|
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
H.styles = L`
|
|
50
50
|
svg {
|
|
51
51
|
display: block;
|
|
52
52
|
fill: #e15042;
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
var
|
|
59
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
60
|
-
(
|
|
55
|
+
H = Ae([
|
|
56
|
+
O("maptiler-geocode-fail-icon")
|
|
57
|
+
], H);
|
|
58
|
+
var Re = Object.getOwnPropertyDescriptor, Ve = (e, t, i, n) => {
|
|
59
|
+
for (var s = n > 1 ? void 0 : n ? Re(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
60
|
+
(l = e[p]) && (s = l(s) || s);
|
|
61
61
|
return s;
|
|
62
62
|
};
|
|
63
|
-
let
|
|
63
|
+
let J = class extends F {
|
|
64
64
|
render() {
|
|
65
65
|
return f`
|
|
66
66
|
<div>
|
|
@@ -72,7 +72,7 @@ let X = class extends L {
|
|
|
72
72
|
`;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
J.styles = L`
|
|
76
76
|
div {
|
|
77
77
|
position: absolute;
|
|
78
78
|
left: 50%;
|
|
@@ -99,17 +99,17 @@ X.styles = I`
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
`;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
],
|
|
105
|
-
var
|
|
106
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
107
|
-
(
|
|
102
|
+
J = Ve([
|
|
103
|
+
O("maptiler-geocode-loading-icon")
|
|
104
|
+
], J);
|
|
105
|
+
var De = Object.getOwnPropertyDescriptor, ze = (e, t, i, n) => {
|
|
106
|
+
for (var s = n > 1 ? void 0 : n ? De(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
107
|
+
(l = e[p]) && (s = l(s) || s);
|
|
108
108
|
return s;
|
|
109
109
|
};
|
|
110
|
-
let
|
|
110
|
+
let X = class extends F {
|
|
111
111
|
render() {
|
|
112
|
-
return
|
|
112
|
+
return D`
|
|
113
113
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
114
114
|
<path
|
|
115
115
|
d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
|
|
@@ -118,23 +118,23 @@ let Y = class extends L {
|
|
|
118
118
|
`;
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
X.styles = L`
|
|
122
122
|
svg {
|
|
123
123
|
display: block;
|
|
124
124
|
fill: var(--color-icon-button);
|
|
125
125
|
}
|
|
126
126
|
`;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
],
|
|
130
|
-
var
|
|
131
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
132
|
-
(
|
|
127
|
+
X = ze([
|
|
128
|
+
O("maptiler-geocode-reverse-geocoding-icon")
|
|
129
|
+
], X);
|
|
130
|
+
var qe = Object.getOwnPropertyDescriptor, Ne = (e, t, i, n) => {
|
|
131
|
+
for (var s = n > 1 ? void 0 : n ? qe(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
132
|
+
(l = e[p]) && (s = l(s) || s);
|
|
133
133
|
return s;
|
|
134
134
|
};
|
|
135
|
-
let
|
|
135
|
+
let Y = class extends F {
|
|
136
136
|
render() {
|
|
137
|
-
return
|
|
137
|
+
return D`
|
|
138
138
|
<svg
|
|
139
139
|
xmlns="http://www.w3.org/2000/svg"
|
|
140
140
|
width="13"
|
|
@@ -147,7 +147,7 @@ let ee = class extends L {
|
|
|
147
147
|
`;
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
Y.styles = L`
|
|
151
151
|
circle {
|
|
152
152
|
stroke-width: 1.875;
|
|
153
153
|
fill: none;
|
|
@@ -163,42 +163,42 @@ ee.styles = I`
|
|
|
163
163
|
stroke: var(--color-icon-button);
|
|
164
164
|
}
|
|
165
165
|
`;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
],
|
|
169
|
-
function
|
|
170
|
-
const n = t[1], s = t[0],
|
|
171
|
-
return e === n && i ? e : ((e - s) %
|
|
166
|
+
Y = Ne([
|
|
167
|
+
O("maptiler-geocode-search-icon")
|
|
168
|
+
], Y);
|
|
169
|
+
function Ke(e, t, i) {
|
|
170
|
+
const n = t[1], s = t[0], p = n - s;
|
|
171
|
+
return e === n && i ? e : ((e - s) % p + p) % p + s;
|
|
172
172
|
}
|
|
173
|
-
let
|
|
174
|
-
async function
|
|
173
|
+
let U;
|
|
174
|
+
async function Ze(e, t, i) {
|
|
175
175
|
for (const n of t ?? [])
|
|
176
176
|
if (!(e && (n.minZoom != null && n.minZoom > e[0] || n.maxZoom != null && n.maxZoom < e[0]))) {
|
|
177
177
|
if (n.type === "fixed")
|
|
178
178
|
return n.coordinates.join(",");
|
|
179
179
|
if (n.type === "client-geolocation")
|
|
180
|
-
if (
|
|
181
|
-
if (
|
|
182
|
-
return
|
|
180
|
+
if (U && n.cachedLocationExpiry && U.time + n.cachedLocationExpiry > Date.now()) {
|
|
181
|
+
if (U.coords)
|
|
182
|
+
return U.coords;
|
|
183
183
|
} else {
|
|
184
184
|
let s;
|
|
185
185
|
try {
|
|
186
|
-
return s = await new Promise((
|
|
186
|
+
return s = await new Promise((p, l) => {
|
|
187
187
|
i.signal.addEventListener("abort", () => {
|
|
188
|
-
|
|
188
|
+
l(Error("aborted"));
|
|
189
189
|
}), navigator.geolocation.getCurrentPosition(
|
|
190
|
-
(
|
|
191
|
-
|
|
190
|
+
($) => {
|
|
191
|
+
p([$.coords.longitude, $.coords.latitude].map((x) => x.toFixed(6)).join(","));
|
|
192
192
|
},
|
|
193
|
-
(
|
|
194
|
-
|
|
193
|
+
($) => {
|
|
194
|
+
l($);
|
|
195
195
|
},
|
|
196
196
|
n
|
|
197
197
|
);
|
|
198
198
|
}), s;
|
|
199
199
|
} catch {
|
|
200
200
|
} finally {
|
|
201
|
-
n.cachedLocationExpiry && (
|
|
201
|
+
n.cachedLocationExpiry && (U = {
|
|
202
202
|
time: Date.now(),
|
|
203
203
|
coords: s
|
|
204
204
|
});
|
|
@@ -212,21 +212,21 @@ async function Ke(e, t, i) {
|
|
|
212
212
|
return e[1].toFixed(6) + "," + e[2].toFixed(6);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const
|
|
216
|
-
var
|
|
215
|
+
const Qe = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
|
|
216
|
+
var He = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, ge = (e) => {
|
|
217
217
|
throw TypeError(e);
|
|
218
218
|
}, _ = (e, t, i, n) => {
|
|
219
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
220
|
-
(
|
|
221
|
-
return n && s &&
|
|
222
|
-
}, me = (e, t, i) => t.has(e) || ge("Cannot " + i), u = (e, t, i) => (me(e, t, "read from private field"), i ? i.call(e) : t.get(e)),
|
|
223
|
-
const xe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, be = xe ? "@2x" : "",
|
|
224
|
-
let
|
|
219
|
+
for (var s = n > 1 ? void 0 : n ? Je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
220
|
+
(l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
|
|
221
|
+
return n && s && He(t, i, s), s;
|
|
222
|
+
}, me = (e, t, i) => t.has(e) || ge("Cannot " + i), u = (e, t, i) => (me(e, t, "read from private field"), i ? i.call(e) : t.get(e)), Xe = (e, t, i) => t.has(e) ? ge("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), C = (e, t, i) => (me(e, t, "access private method"), i), d, A, M, g, ye, ve, re, ee;
|
|
223
|
+
const xe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, be = xe ? "@2x" : "", T = xe ? 2 : 1;
|
|
224
|
+
let I, we, w = class extends F {
|
|
225
225
|
constructor() {
|
|
226
|
-
super(...arguments),
|
|
226
|
+
super(...arguments), Xe(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
227
227
|
}
|
|
228
228
|
willUpdate(e) {
|
|
229
|
-
e.has("feature") && u(this, d,
|
|
229
|
+
e.has("feature") && u(this, d, A) && (this.index = u(this, d, A).length, C(this, d, re).call(this));
|
|
230
230
|
}
|
|
231
231
|
render() {
|
|
232
232
|
return f`
|
|
@@ -238,38 +238,38 @@ let k, we, w = class extends L {
|
|
|
238
238
|
class=${this.itemStyle}
|
|
239
239
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
240
240
|
>
|
|
241
|
-
${
|
|
241
|
+
${I && this.spriteIcon ? f`
|
|
242
242
|
<div
|
|
243
243
|
class="sprite-icon"
|
|
244
|
-
style=${
|
|
245
|
-
width: `${this.spriteIcon.width /
|
|
246
|
-
height: `${this.spriteIcon.height /
|
|
244
|
+
style=${Ee({
|
|
245
|
+
width: `${this.spriteIcon.width / T}px`,
|
|
246
|
+
height: `${this.spriteIcon.height / T}px`,
|
|
247
247
|
backgroundImage: `url(${this.iconsBaseUrl}sprite${be}.png)`,
|
|
248
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
249
|
-
backgroundSize: `${
|
|
248
|
+
backgroundPosition: `-${this.spriteIcon.x / T}px -${this.spriteIcon.y / T}px`,
|
|
249
|
+
backgroundSize: `${I.width / T}px ${I.height / T}px`
|
|
250
250
|
})}
|
|
251
251
|
title=${u(this, d, g)}
|
|
252
252
|
/>
|
|
253
|
-
` : this.imageUrl ? f` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${C(this, d, ve)} />` : this.feature?.address ? f` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? f` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? f` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? f` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? f` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d,
|
|
253
|
+
` : this.imageUrl ? f` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${C(this, d, ve)} />` : this.feature?.address ? f` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? f` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? f` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? f` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? f` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d, M) ? f` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : f` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> `}
|
|
254
254
|
|
|
255
255
|
<span class="texts">
|
|
256
256
|
<span>
|
|
257
|
-
<span class="primary"> ${u(this, d,
|
|
257
|
+
<span class="primary"> ${u(this, d, M) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
258
258
|
|
|
259
|
-
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !u(this, d,
|
|
259
|
+
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !u(this, d, M) ? f` <span class="secondary"> ${u(this, d, g)} </span> ` : Z}
|
|
260
260
|
</span>
|
|
261
261
|
|
|
262
|
-
<span class="line2"> ${u(this, d,
|
|
262
|
+
<span class="line2"> ${u(this, d, M) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
263
263
|
</span>
|
|
264
264
|
</li>
|
|
265
265
|
`;
|
|
266
266
|
}
|
|
267
267
|
};
|
|
268
268
|
d = /* @__PURE__ */ new WeakSet();
|
|
269
|
-
|
|
269
|
+
A = function() {
|
|
270
270
|
return this.feature?.properties?.categories;
|
|
271
271
|
};
|
|
272
|
-
|
|
272
|
+
M = function() {
|
|
273
273
|
return this.feature?.place_type[0] === "reverse";
|
|
274
274
|
};
|
|
275
275
|
g = function() {
|
|
@@ -277,28 +277,28 @@ g = function() {
|
|
|
277
277
|
};
|
|
278
278
|
ye = function() {
|
|
279
279
|
we ??= fetch(`${this.iconsBaseUrl}sprite${be}.json`).then((e) => e.json()).then((e) => {
|
|
280
|
-
|
|
280
|
+
I = e;
|
|
281
281
|
}).catch(() => {
|
|
282
|
-
|
|
282
|
+
I = null;
|
|
283
283
|
});
|
|
284
284
|
};
|
|
285
285
|
ve = function() {
|
|
286
286
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, re).call(this);
|
|
287
287
|
};
|
|
288
288
|
re = function() {
|
|
289
|
-
|
|
290
|
-
C(this, d,
|
|
289
|
+
I !== void 0 ? C(this, d, ee).call(this) : (C(this, d, ye).call(this), we?.then(() => {
|
|
290
|
+
C(this, d, ee).call(this);
|
|
291
291
|
}));
|
|
292
292
|
};
|
|
293
|
-
|
|
293
|
+
ee = function() {
|
|
294
294
|
do {
|
|
295
|
-
if (this.index--, this.category = u(this, d,
|
|
295
|
+
if (this.index--, this.category = u(this, d, A)?.[this.index], this.spriteIcon = this.category ? I?.icons[this.category] : void 0, this.spriteIcon)
|
|
296
296
|
break;
|
|
297
297
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
298
298
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
299
299
|
};
|
|
300
|
-
w.styles =
|
|
301
|
-
${fe(
|
|
300
|
+
w.styles = L`
|
|
301
|
+
${fe(Qe)}
|
|
302
302
|
`;
|
|
303
303
|
_([
|
|
304
304
|
h({ type: Object })
|
|
@@ -316,34 +316,34 @@ _([
|
|
|
316
316
|
h({ type: String })
|
|
317
317
|
], w.prototype, "iconsBaseUrl", 2);
|
|
318
318
|
_([
|
|
319
|
-
|
|
319
|
+
v()
|
|
320
320
|
], w.prototype, "category", 2);
|
|
321
321
|
_([
|
|
322
|
-
|
|
322
|
+
v()
|
|
323
323
|
], w.prototype, "imageUrl", 2);
|
|
324
324
|
_([
|
|
325
|
-
|
|
325
|
+
v()
|
|
326
326
|
], w.prototype, "spriteIcon", 2);
|
|
327
327
|
_([
|
|
328
|
-
|
|
328
|
+
v()
|
|
329
329
|
], w.prototype, "index", 2);
|
|
330
330
|
w = _([
|
|
331
|
-
|
|
331
|
+
O("maptiler-geocoder-feature-item")
|
|
332
332
|
], w);
|
|
333
|
-
const
|
|
334
|
-
var
|
|
333
|
+
const Ye = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
|
|
334
|
+
var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, $e = (e) => {
|
|
335
335
|
throw TypeError(e);
|
|
336
|
-
},
|
|
337
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
338
|
-
(
|
|
339
|
-
return n && s &&
|
|
340
|
-
}, oe = (e, t, i) => t.has(e) ||
|
|
341
|
-
let
|
|
336
|
+
}, a = (e, t, i, n) => {
|
|
337
|
+
for (var s = n > 1 ? void 0 : n ? tt(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
338
|
+
(l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
|
|
339
|
+
return n && s && et(t, i, s), s;
|
|
340
|
+
}, oe = (e, t, i) => t.has(e) || $e("Cannot " + i), b = (e, t, i) => (oe(e, t, "read from private field"), i ? i.call(e) : t.get(e)), B = (e, t, i) => t.has(e) ? $e("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), te = (e, t, i, n) => (oe(e, t, "write to private field"), t.set(e, i), i), c = (e, t, i) => (oe(e, t, "access private method"), i), R, E, ie, G, r, V, _e, ae, y, le, z, ne, ce, k, he, q, ke, se, Ie, Le, Fe, Oe, Se, Te, Ce;
|
|
341
|
+
let o = class extends F {
|
|
342
342
|
constructor() {
|
|
343
|
-
super(...arguments),
|
|
343
|
+
super(...arguments), B(this, r), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, B(this, R, !1), B(this, E), B(this, ie, /* @__PURE__ */ new Set()), B(this, G);
|
|
344
344
|
}
|
|
345
345
|
firstUpdated() {
|
|
346
|
-
|
|
346
|
+
te(this, R, !0);
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Set the options of this instance.
|
|
@@ -353,7 +353,7 @@ let a = class extends L {
|
|
|
353
353
|
setOptions(e) {
|
|
354
354
|
const t = { ...e };
|
|
355
355
|
for (const i of Object.keys(t))
|
|
356
|
-
|
|
356
|
+
it.includes(i) || delete t[i];
|
|
357
357
|
Object.assign(this, t);
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
@@ -362,7 +362,7 @@ let a = class extends L {
|
|
|
362
362
|
* @param value text to set
|
|
363
363
|
*/
|
|
364
364
|
setQuery(e) {
|
|
365
|
-
c(this,
|
|
365
|
+
c(this, r, ce).call(this, e, { external: !0 }), c(this, r, ne).call(this);
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Set the content of search input box and immediately submit it.
|
|
@@ -370,13 +370,13 @@ let a = class extends L {
|
|
|
370
370
|
* @param value text to set and submit
|
|
371
371
|
*/
|
|
372
372
|
submitQuery(e) {
|
|
373
|
-
c(this,
|
|
373
|
+
c(this, r, he).call(this, e);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Clear search result list.
|
|
377
377
|
*/
|
|
378
378
|
clearList() {
|
|
379
|
-
c(this,
|
|
379
|
+
c(this, r, k).call(this), this.picked = void 0, this.selectedItemIndex = -1;
|
|
380
380
|
}
|
|
381
381
|
/**
|
|
382
382
|
* Focus the search input box.
|
|
@@ -400,27 +400,25 @@ let a = class extends L {
|
|
|
400
400
|
}
|
|
401
401
|
/** @internal */
|
|
402
402
|
handleMapChange(e) {
|
|
403
|
-
|
|
403
|
+
te(this, G, e);
|
|
404
404
|
}
|
|
405
405
|
/** @internal */
|
|
406
406
|
handleMapClick(e) {
|
|
407
|
-
this.reverseActive && c(this,
|
|
407
|
+
this.reverseActive && c(this, r, ke).call(this, e);
|
|
408
408
|
}
|
|
409
409
|
willUpdate(e) {
|
|
410
|
-
e.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), e.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((t) => e.has(t)) && this.picked && (this.clearListOnPick && c(this,
|
|
411
|
-
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
412
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((t) => e.has(t)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((t) => e.has(t)) && c(this, o, v).call(this, "select", { feature: x(this, o, z) }), ["picked"].some((t) => e.has(t)) && this.picked && this.picked.id !== e.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? c(this, o, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
410
|
+
e.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), e.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((t) => e.has(t)) && this.picked && (this.clearListOnPick && c(this, r, k).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((t) => e.has(t)) && b(this, r, ae) && (c(this, r, k).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((t) => e.has(t)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((t) => e.has(t)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((t) => e.has(t)) && c(this, r, y).call(this, "select", { feature: b(this, r, V) }), ["picked"].some((t) => e.has(t)) && this.picked && this.picked.id !== e.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? c(this, r, q).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
413
411
|
() => {
|
|
414
|
-
c(this,
|
|
412
|
+
c(this, r, y).call(this, "pick", { feature: this.picked });
|
|
415
413
|
},
|
|
416
414
|
(t) => {
|
|
417
|
-
t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this,
|
|
415
|
+
t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this, r, y).call(this, "pick", { feature: this.picked }));
|
|
418
416
|
}
|
|
419
|
-
), ["listFeatures", "
|
|
417
|
+
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((t) => e.has(t)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((t) => e.has(t)) && (this.isFeatureListVisible ? c(this, r, y).call(this, "featuresshow") : c(this, r, y).call(this, "featureshide")), ["reverseActive"].some((t) => e.has(t)) && c(this, r, y).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
420
418
|
}
|
|
421
419
|
render() {
|
|
422
420
|
return f`
|
|
423
|
-
<form @submit=${c(this,
|
|
421
|
+
<form @submit=${c(this, r, le)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
|
|
424
422
|
<div class="input-group">
|
|
425
423
|
<button
|
|
426
424
|
class="search-button"
|
|
@@ -437,16 +435,16 @@ let a = class extends L {
|
|
|
437
435
|
@focus=${() => this.focused = !0}
|
|
438
436
|
@blur=${() => this.focused = !1}
|
|
439
437
|
@click=${() => this.focused = !0}
|
|
440
|
-
@keydown=${c(this,
|
|
441
|
-
@input=${c(this,
|
|
438
|
+
@keydown=${c(this, r, se)}
|
|
439
|
+
@input=${c(this, r, Ie)}
|
|
442
440
|
@change=${() => this.picked = void 0}
|
|
443
441
|
placeholder=${this.placeholder ?? "Search"}
|
|
444
442
|
aria-label=${this.placeholder ?? "Search"}
|
|
445
443
|
/>
|
|
446
444
|
|
|
447
445
|
<div class="clear-button-container ${j({ displayable: this.searchValue !== "" })}">
|
|
448
|
-
${
|
|
449
|
-
<button type="button" @click=${c(this,
|
|
446
|
+
${b(this, r, _e) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
|
|
447
|
+
<button type="button" @click=${c(this, r, Ce)} title=${this.clearButtonTitle ?? "clear"}>
|
|
450
448
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
451
449
|
</button>
|
|
452
450
|
`}
|
|
@@ -461,7 +459,7 @@ let a = class extends L {
|
|
|
461
459
|
>
|
|
462
460
|
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
463
461
|
</button>
|
|
464
|
-
` :
|
|
462
|
+
` : Z}
|
|
465
463
|
|
|
466
464
|
<!-- <slot /> -->
|
|
467
465
|
</div>
|
|
@@ -476,7 +474,7 @@ let a = class extends L {
|
|
|
476
474
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
477
475
|
</button>
|
|
478
476
|
</div>
|
|
479
|
-
` : !this.
|
|
477
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? Z : this.listFeatures.length === 0 ? f`
|
|
480
478
|
<div class="no-results">
|
|
481
479
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
482
480
|
|
|
@@ -485,8 +483,15 @@ let a = class extends L {
|
|
|
485
483
|
</div>
|
|
486
484
|
</div>
|
|
487
485
|
` : f`
|
|
488
|
-
<ul
|
|
489
|
-
${
|
|
486
|
+
<ul
|
|
487
|
+
class="options ${j({ "open-on-top": this.openListOnTop })}"
|
|
488
|
+
@pointerleave=${c(this, r, Oe)}
|
|
489
|
+
@pointerdown=${c(this, r, Se)}
|
|
490
|
+
@pointerup=${c(this, r, Te)}
|
|
491
|
+
@keydown=${c(this, r, se)}
|
|
492
|
+
role="listbox"
|
|
493
|
+
>
|
|
494
|
+
${Me(
|
|
490
495
|
this.listFeatures,
|
|
491
496
|
(e) => e.id + (e.address ? "," + e.address : ""),
|
|
492
497
|
(e, t) => f`
|
|
@@ -494,17 +499,15 @@ let a = class extends L {
|
|
|
494
499
|
.feature=${e}
|
|
495
500
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
496
501
|
itemStyle=${this.selectedItemIndex === t ? "selected" : this.picked?.id === e.id ? "picked" : "default"}
|
|
497
|
-
@
|
|
498
|
-
c(this,
|
|
502
|
+
@pointerenter=${() => {
|
|
503
|
+
c(this, r, Fe).call(this, t);
|
|
499
504
|
}}
|
|
500
505
|
@select=${() => {
|
|
501
|
-
c(this,
|
|
506
|
+
c(this, r, Le).call(this, e);
|
|
502
507
|
}}
|
|
503
|
-
.missingIconsCache=${
|
|
504
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
505
|
-
|
|
506
|
-
${e.place_name}
|
|
507
|
-
</maptiler-geocoder-feature-item>
|
|
508
|
+
.missingIconsCache=${b(this, ie)}
|
|
509
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
|
|
510
|
+
/>
|
|
508
511
|
`
|
|
509
512
|
)}
|
|
510
513
|
</ul>
|
|
@@ -513,26 +516,22 @@ let a = class extends L {
|
|
|
513
516
|
`;
|
|
514
517
|
}
|
|
515
518
|
};
|
|
516
|
-
V = /* @__PURE__ */ new WeakMap();
|
|
517
519
|
R = /* @__PURE__ */ new WeakMap();
|
|
518
520
|
E = /* @__PURE__ */ new WeakMap();
|
|
519
521
|
ie = /* @__PURE__ */ new WeakMap();
|
|
520
522
|
G = /* @__PURE__ */ new WeakMap();
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
r = /* @__PURE__ */ new WeakSet();
|
|
524
|
+
V = function() {
|
|
523
525
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
524
526
|
};
|
|
525
|
-
|
|
526
|
-
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
527
|
-
};
|
|
528
|
-
ke = function() {
|
|
527
|
+
_e = function() {
|
|
529
528
|
return this.abortController !== void 0;
|
|
530
529
|
};
|
|
531
530
|
ae = function() {
|
|
532
531
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
533
532
|
};
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
y = function(e, ...[t]) {
|
|
534
|
+
b(this, R) && this.dispatchEvent(
|
|
536
535
|
new CustomEvent(e, {
|
|
537
536
|
bubbles: !0,
|
|
538
537
|
composed: !0,
|
|
@@ -541,13 +540,13 @@ v = function(e, ...[t]) {
|
|
|
541
540
|
);
|
|
542
541
|
};
|
|
543
542
|
le = function(e) {
|
|
544
|
-
e?.preventDefault(), this.focused = !1, clearTimeout(
|
|
543
|
+
e?.preventDefault(), this.focused = !1, clearTimeout(b(this, E)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && c(this, r, q).call(this, this.searchValue, { exact: !0, external: e === void 0 }).then(() => {
|
|
545
544
|
this.picked = void 0;
|
|
546
545
|
}).catch((t) => this.error = t);
|
|
547
546
|
};
|
|
548
|
-
|
|
547
|
+
z = function(e) {
|
|
549
548
|
try {
|
|
550
|
-
return
|
|
549
|
+
return Be(e, 6);
|
|
551
550
|
} catch {
|
|
552
551
|
return !1;
|
|
553
552
|
}
|
|
@@ -557,87 +556,87 @@ ne = function() {
|
|
|
557
556
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
558
557
|
});
|
|
559
558
|
};
|
|
560
|
-
ce = function(e) {
|
|
561
|
-
if (this.searchValue = e, c(this,
|
|
562
|
-
if (clearTimeout(
|
|
559
|
+
ce = function(e, { external: t = !1 } = {}) {
|
|
560
|
+
if (this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, z).call(this, e) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
561
|
+
if (clearTimeout(b(this, E)), b(this, r, ae))
|
|
563
562
|
return;
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
c(this,
|
|
563
|
+
const i = this.searchValue;
|
|
564
|
+
te(this, E, window.setTimeout(() => {
|
|
565
|
+
c(this, r, q).call(this, i, { external: t }).catch((n) => this.error = n);
|
|
567
566
|
}, this.debounceSearch ?? 200));
|
|
568
567
|
} else
|
|
569
|
-
c(this,
|
|
568
|
+
c(this, r, k).call(this);
|
|
570
569
|
};
|
|
571
|
-
|
|
572
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this,
|
|
570
|
+
k = function() {
|
|
571
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, r, y).call(this, "featuresclear"));
|
|
573
572
|
};
|
|
574
573
|
he = function(e) {
|
|
575
|
-
this.searchValue = e, c(this,
|
|
574
|
+
this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, z).call(this, e) }), this.selectedItemIndex = -1, c(this, r, le).call(this);
|
|
576
575
|
};
|
|
577
|
-
|
|
576
|
+
q = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
|
|
578
577
|
this.error = void 0, this.abortController?.abort();
|
|
579
|
-
const
|
|
580
|
-
this.abortController =
|
|
578
|
+
const s = new AbortController();
|
|
579
|
+
this.abortController = s;
|
|
581
580
|
try {
|
|
582
|
-
const
|
|
583
|
-
this.language !== void 0 &&
|
|
584
|
-
const [
|
|
585
|
-
let
|
|
586
|
-
(
|
|
587
|
-
).filter((
|
|
588
|
-
|
|
589
|
-
const pe = !
|
|
590
|
-
if (pe &&
|
|
591
|
-
const
|
|
592
|
-
ue &&
|
|
581
|
+
const p = this.apiUrl ?? "https://api.maptiler.com/geocoding", l = c(this, r, z).call(this, e), $ = new URL(p + "/" + encodeURIComponent(l ? `${l.decimalLongitude},${l.decimalLatitude}` : e) + ".json"), x = $.searchParams;
|
|
582
|
+
this.language !== void 0 && x.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
583
|
+
const [N] = b(this, G) ?? [void 0];
|
|
584
|
+
let S = (!l || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
585
|
+
(m) => typeof m == "string" ? m : N === void 0 || (m[0] ?? 0) <= N && N < (m[1] ?? 1 / 0) ? m[2] : void 0
|
|
586
|
+
).filter((m) => m !== void 0);
|
|
587
|
+
S && (S = [...new Set(S)], x.set("types", S.join(",")));
|
|
588
|
+
const pe = !l || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
589
|
+
if (pe && x.set("excludeTypes", String(pe)), this.bbox && x.set("bbox", this.bbox.map((m) => m.toFixed(6)).join(",")), this.country && x.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && x.set("worldview", this.worldview), !t && !l) {
|
|
590
|
+
const m = this.proximity ?? [{ type: "server-geolocation" }], ue = await Ze(b(this, G), m, s);
|
|
591
|
+
ue && x.set("proximity", ue), (i || this.showResultsWhileTyping === !1) && x.set("autocomplete", "false"), x.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
593
592
|
}
|
|
594
|
-
const de = this.limit ?? 5,
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
t ? (this.clearListOnPick && c(this,
|
|
593
|
+
const de = this.limit ?? 5, K = this.reverseGeocodingLimit ?? de;
|
|
594
|
+
K > 1 && S?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), l ? (K === 1 || this.exhaustiveReverseGeocoding || S?.length === 1) && x.set("limit", String(K)) : x.set("limit", String(de)), this.apiKey && x.set("key", this.apiKey), this.adjustUrl?.($);
|
|
595
|
+
const Pe = $.searchParams.get("types") === "" && $.searchParams.get("excludeTypes") !== "true", W = $.toString();
|
|
596
|
+
if (W === this.lastSearchUrl) {
|
|
597
|
+
t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.listFeatures[this.selectedItemIndex]?.id !== b(this, r, V)?.id && (this.selectedItemIndex = -1));
|
|
599
598
|
return;
|
|
600
599
|
}
|
|
601
|
-
c(this,
|
|
602
|
-
let
|
|
603
|
-
if (
|
|
604
|
-
|
|
600
|
+
c(this, r, y).call(this, "request", { urlObj: $ }), this.lastSearchUrl = W;
|
|
601
|
+
let P;
|
|
602
|
+
if (Pe)
|
|
603
|
+
P = { type: "FeatureCollection", features: [] };
|
|
605
604
|
else {
|
|
606
|
-
const
|
|
607
|
-
signal:
|
|
605
|
+
const m = await fetch(W, {
|
|
606
|
+
signal: s.signal,
|
|
608
607
|
...this.fetchParameters
|
|
609
608
|
});
|
|
610
|
-
if (!
|
|
611
|
-
throw new Error(await
|
|
612
|
-
|
|
609
|
+
if (!m.ok)
|
|
610
|
+
throw new Error(await m.text());
|
|
611
|
+
P = await m.json();
|
|
613
612
|
}
|
|
614
|
-
c(this,
|
|
613
|
+
c(this, r, y).call(this, "response", { url: W, featureCollection: P }), t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), l && this.listFeatures.unshift({
|
|
615
614
|
type: "Feature",
|
|
616
615
|
properties: {},
|
|
617
616
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
618
|
-
id: `reverse_${
|
|
619
|
-
text: `${
|
|
620
|
-
place_name:
|
|
617
|
+
id: `reverse_${l.decimalLongitude}_${l.decimalLatitude}`,
|
|
618
|
+
text: `${l.decimalLatitude}, ${l.decimalLongitude}`,
|
|
619
|
+
place_name: l.toCoordinateFormat("DMS"),
|
|
621
620
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
622
621
|
place_type: ["reverse"],
|
|
623
622
|
place_type_name: ["reverse"],
|
|
624
|
-
center: [
|
|
625
|
-
bbox: [
|
|
623
|
+
center: [l.decimalLongitude, l.decimalLatitude],
|
|
624
|
+
bbox: [l.decimalLongitude, l.decimalLatitude, l.decimalLongitude, l.decimalLatitude],
|
|
626
625
|
geometry: {
|
|
627
626
|
type: "Point",
|
|
628
|
-
coordinates: [
|
|
627
|
+
coordinates: [l.decimalLongitude, l.decimalLatitude]
|
|
629
628
|
}
|
|
630
|
-
}), c(this,
|
|
631
|
-
} catch (
|
|
632
|
-
if (
|
|
629
|
+
}), c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, r, V)?.id && (this.selectedItemIndex = -1), l && this.input.focus());
|
|
630
|
+
} catch (p) {
|
|
631
|
+
if (p && typeof p == "object" && "name" in p && p.name === "AbortError")
|
|
633
632
|
return;
|
|
634
|
-
throw
|
|
633
|
+
throw p;
|
|
635
634
|
} finally {
|
|
636
|
-
|
|
635
|
+
s === this.abortController && (this.abortController = void 0);
|
|
637
636
|
}
|
|
638
637
|
};
|
|
639
|
-
|
|
640
|
-
this.reverseActive = this.enableReverse === "always", c(this,
|
|
638
|
+
ke = function(e) {
|
|
639
|
+
this.reverseActive = this.enableReverse === "always", c(this, r, k).call(this), this.picked = void 0, c(this, r, he).call(this, `${e[1].toFixed(6)}, ${Ke(e[0], [-180, 180], !0).toFixed(6)}`), c(this, r, ne).call(this);
|
|
641
640
|
};
|
|
642
641
|
se = function(e) {
|
|
643
642
|
if (!this.listFeatures)
|
|
@@ -645,172 +644,183 @@ se = function(e) {
|
|
|
645
644
|
const t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
|
|
646
645
|
t && (this.input.focus(), this.focused = !0, e.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && t === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += t, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
|
|
647
646
|
};
|
|
648
|
-
|
|
649
|
-
c(this,
|
|
647
|
+
Ie = function(e) {
|
|
648
|
+
c(this, r, ce).call(this, e.target.value);
|
|
650
649
|
};
|
|
651
|
-
|
|
650
|
+
Le = function(e) {
|
|
652
651
|
(!this.picked || this.picked.id !== e.id) && (this.picked = e, this.searchValue = e.place_name);
|
|
653
652
|
};
|
|
654
|
-
|
|
653
|
+
Fe = function(e) {
|
|
655
654
|
this.selectedItemIndex = e;
|
|
656
655
|
};
|
|
656
|
+
Oe = function() {
|
|
657
|
+
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
658
|
+
};
|
|
657
659
|
Se = function() {
|
|
658
|
-
|
|
660
|
+
this.isFeatureListInteractedWith = !0;
|
|
659
661
|
};
|
|
660
662
|
Te = function() {
|
|
661
|
-
|
|
663
|
+
setTimeout(() => {
|
|
664
|
+
this.isFeatureListInteractedWith = !1;
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
Ce = function() {
|
|
668
|
+
this.searchValue = "", c(this, r, y).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
662
669
|
};
|
|
663
|
-
|
|
664
|
-
${fe(
|
|
670
|
+
o.styles = L`
|
|
671
|
+
${fe(Ye)}
|
|
665
672
|
`;
|
|
666
|
-
|
|
673
|
+
a([
|
|
667
674
|
h({ attribute: !1 })
|
|
668
|
-
],
|
|
669
|
-
|
|
675
|
+
], o.prototype, "adjustUrl", 2);
|
|
676
|
+
a([
|
|
670
677
|
h({ type: String })
|
|
671
|
-
],
|
|
672
|
-
|
|
678
|
+
], o.prototype, "apiKey", 2);
|
|
679
|
+
a([
|
|
673
680
|
h({ type: String })
|
|
674
|
-
],
|
|
675
|
-
|
|
681
|
+
], o.prototype, "apiUrl", 2);
|
|
682
|
+
a([
|
|
676
683
|
h({ type: Array })
|
|
677
|
-
],
|
|
678
|
-
|
|
684
|
+
], o.prototype, "bbox", 2);
|
|
685
|
+
a([
|
|
679
686
|
h({ type: String })
|
|
680
|
-
],
|
|
681
|
-
|
|
687
|
+
], o.prototype, "clearButtonTitle", 2);
|
|
688
|
+
a([
|
|
682
689
|
h({ type: Boolean })
|
|
683
|
-
],
|
|
684
|
-
|
|
690
|
+
], o.prototype, "clearListOnPick", 2);
|
|
691
|
+
a([
|
|
685
692
|
h({ type: Boolean })
|
|
686
|
-
],
|
|
687
|
-
|
|
693
|
+
], o.prototype, "clearOnBlur", 2);
|
|
694
|
+
a([
|
|
688
695
|
h({ type: Boolean })
|
|
689
|
-
],
|
|
690
|
-
|
|
696
|
+
], o.prototype, "collapsed", 2);
|
|
697
|
+
a([
|
|
691
698
|
h({ attribute: !1 })
|
|
692
|
-
],
|
|
693
|
-
|
|
699
|
+
], o.prototype, "country", 2);
|
|
700
|
+
a([
|
|
694
701
|
h({ type: Number })
|
|
695
|
-
],
|
|
696
|
-
|
|
702
|
+
], o.prototype, "debounceSearch", 2);
|
|
703
|
+
a([
|
|
697
704
|
h({ type: String })
|
|
698
|
-
],
|
|
699
|
-
|
|
705
|
+
], o.prototype, "enableReverse", 2);
|
|
706
|
+
a([
|
|
700
707
|
h({ type: String })
|
|
701
|
-
],
|
|
702
|
-
|
|
708
|
+
], o.prototype, "errorMessage", 2);
|
|
709
|
+
a([
|
|
703
710
|
h({ type: Boolean })
|
|
704
|
-
],
|
|
705
|
-
|
|
711
|
+
], o.prototype, "excludeTypes", 2);
|
|
712
|
+
a([
|
|
706
713
|
h({ type: Boolean })
|
|
707
|
-
],
|
|
708
|
-
|
|
714
|
+
], o.prototype, "exhaustiveReverseGeocoding", 2);
|
|
715
|
+
a([
|
|
709
716
|
h({ type: Boolean })
|
|
710
|
-
],
|
|
711
|
-
|
|
717
|
+
], o.prototype, "fetchFullGeometryOnPick", 2);
|
|
718
|
+
a([
|
|
712
719
|
h({ type: Object })
|
|
713
|
-
],
|
|
714
|
-
|
|
720
|
+
], o.prototype, "fetchParameters", 2);
|
|
721
|
+
a([
|
|
715
722
|
h({ attribute: !1 })
|
|
716
|
-
],
|
|
717
|
-
|
|
723
|
+
], o.prototype, "filter", 2);
|
|
724
|
+
a([
|
|
718
725
|
h({ type: Object })
|
|
719
|
-
],
|
|
720
|
-
|
|
726
|
+
], o.prototype, "fuzzyMatch", 2);
|
|
727
|
+
a([
|
|
721
728
|
h({ type: String })
|
|
722
|
-
],
|
|
723
|
-
|
|
729
|
+
], o.prototype, "iconsBaseUrl", 2);
|
|
730
|
+
a([
|
|
724
731
|
h({ type: Boolean })
|
|
725
|
-
],
|
|
726
|
-
|
|
732
|
+
], o.prototype, "keepListOpen", 2);
|
|
733
|
+
a([
|
|
727
734
|
h({ attribute: !1 })
|
|
728
|
-
],
|
|
729
|
-
|
|
735
|
+
], o.prototype, "language", 2);
|
|
736
|
+
a([
|
|
730
737
|
h({ type: Number })
|
|
731
|
-
],
|
|
732
|
-
|
|
738
|
+
], o.prototype, "limit", 2);
|
|
739
|
+
a([
|
|
733
740
|
h({ type: Number })
|
|
734
|
-
],
|
|
735
|
-
|
|
741
|
+
], o.prototype, "minLength", 2);
|
|
742
|
+
a([
|
|
736
743
|
h({ type: String })
|
|
737
|
-
],
|
|
738
|
-
|
|
744
|
+
], o.prototype, "noResultsMessage", 2);
|
|
745
|
+
a([
|
|
739
746
|
h({ type: Boolean })
|
|
740
|
-
],
|
|
741
|
-
|
|
747
|
+
], o.prototype, "openListOnTop", 2);
|
|
748
|
+
a([
|
|
742
749
|
h({ type: String })
|
|
743
|
-
],
|
|
744
|
-
|
|
750
|
+
], o.prototype, "placeholder", 2);
|
|
751
|
+
a([
|
|
745
752
|
h({ type: Array })
|
|
746
|
-
],
|
|
747
|
-
|
|
753
|
+
], o.prototype, "proximity", 2);
|
|
754
|
+
a([
|
|
748
755
|
h({ type: Boolean })
|
|
749
|
-
],
|
|
750
|
-
|
|
756
|
+
], o.prototype, "reverseActive", 2);
|
|
757
|
+
a([
|
|
751
758
|
h({ type: String })
|
|
752
|
-
],
|
|
753
|
-
|
|
759
|
+
], o.prototype, "reverseButtonTitle", 2);
|
|
760
|
+
a([
|
|
754
761
|
h({ type: Object })
|
|
755
|
-
],
|
|
756
|
-
|
|
762
|
+
], o.prototype, "reverseGeocodingExcludeTypes", 2);
|
|
763
|
+
a([
|
|
757
764
|
h({ type: Number })
|
|
758
|
-
],
|
|
759
|
-
|
|
765
|
+
], o.prototype, "reverseGeocodingLimit", 2);
|
|
766
|
+
a([
|
|
760
767
|
h({ type: Array })
|
|
761
|
-
],
|
|
762
|
-
|
|
768
|
+
], o.prototype, "reverseGeocodingTypes", 2);
|
|
769
|
+
a([
|
|
763
770
|
h({ type: Object })
|
|
764
|
-
],
|
|
765
|
-
|
|
771
|
+
], o.prototype, "selectFirst", 2);
|
|
772
|
+
a([
|
|
766
773
|
h({ type: String })
|
|
767
|
-
],
|
|
768
|
-
|
|
774
|
+
], o.prototype, "showPlaceType", 2);
|
|
775
|
+
a([
|
|
769
776
|
h({ type: Object })
|
|
770
|
-
],
|
|
771
|
-
|
|
777
|
+
], o.prototype, "showResultsWhileTyping", 2);
|
|
778
|
+
a([
|
|
772
779
|
h({ type: Array })
|
|
773
|
-
],
|
|
774
|
-
|
|
780
|
+
], o.prototype, "types", 2);
|
|
781
|
+
a([
|
|
775
782
|
h({ type: String })
|
|
776
|
-
],
|
|
777
|
-
|
|
783
|
+
], o.prototype, "worldview", 2);
|
|
784
|
+
a([
|
|
778
785
|
Ue("input")
|
|
779
|
-
],
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
],
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
],
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
],
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
],
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
],
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
],
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
],
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
],
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
],
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
],
|
|
810
|
-
a
|
|
811
|
-
|
|
812
|
-
],
|
|
813
|
-
|
|
786
|
+
], o.prototype, "input", 2);
|
|
787
|
+
a([
|
|
788
|
+
v()
|
|
789
|
+
], o.prototype, "searchValue", 2);
|
|
790
|
+
a([
|
|
791
|
+
v()
|
|
792
|
+
], o.prototype, "listFeatures", 2);
|
|
793
|
+
a([
|
|
794
|
+
v()
|
|
795
|
+
], o.prototype, "selectedItemIndex", 2);
|
|
796
|
+
a([
|
|
797
|
+
v()
|
|
798
|
+
], o.prototype, "picked", 2);
|
|
799
|
+
a([
|
|
800
|
+
v()
|
|
801
|
+
], o.prototype, "cachedFeatures", 2);
|
|
802
|
+
a([
|
|
803
|
+
v()
|
|
804
|
+
], o.prototype, "lastSearchUrl", 2);
|
|
805
|
+
a([
|
|
806
|
+
v()
|
|
807
|
+
], o.prototype, "error", 2);
|
|
808
|
+
a([
|
|
809
|
+
v()
|
|
810
|
+
], o.prototype, "abortController", 2);
|
|
811
|
+
a([
|
|
812
|
+
v()
|
|
813
|
+
], o.prototype, "focused", 2);
|
|
814
|
+
a([
|
|
815
|
+
v()
|
|
816
|
+
], o.prototype, "isFeatureListVisible", 2);
|
|
817
|
+
a([
|
|
818
|
+
v()
|
|
819
|
+
], o.prototype, "isFeatureListInteractedWith", 2);
|
|
820
|
+
o = a([
|
|
821
|
+
O("maptiler-geocoder")
|
|
822
|
+
], o);
|
|
823
|
+
const it = [
|
|
814
824
|
"adjustUrl",
|
|
815
825
|
"apiKey",
|
|
816
826
|
"apiUrl",
|
|
@@ -850,11 +860,11 @@ const tt = [
|
|
|
850
860
|
"worldview"
|
|
851
861
|
];
|
|
852
862
|
export {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
863
|
+
Q as MaptilerGeocodeClearIconElement,
|
|
864
|
+
H as MaptilerGeocodeFailIconElement,
|
|
865
|
+
J as MaptilerGeocodeLoadingIconElement,
|
|
866
|
+
X as MaptilerGeocodeReverseGeocodingIconElement,
|
|
867
|
+
Y as MaptilerGeocodeSearchIconElement,
|
|
868
|
+
o as MaptilerGeocoderElement
|
|
859
869
|
};
|
|
860
870
|
//# sourceMappingURL=index.js.map
|