@maptiler/geocoding-control 3.0.0-rc.6 → 3.0.0-rc.8
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/check-version.js +69 -0
- package/dist/check-version.d.ts +1 -0
- package/dist/index.js +188 -178
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +55 -50
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +313 -303
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +51 -46
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +188 -178
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +50 -45
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +243 -233
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +62 -57
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +225 -214
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +51 -46
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/components/clear-icon.d.ts +1 -0
- package/dist/src/components/fail-icon.d.ts +1 -0
- package/dist/src/components/loading-icon.d.ts +1 -0
- package/dist/src/components/marker.d.ts +1 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +1 -0
- package/dist/src/components/search-icon.d.ts +1 -0
- package/dist/src/controls/maplibregl-control.d.ts +2 -7
- package/dist/src/controls/maplibregl-events.d.ts +2 -3
- package/dist/src/controls/maplibregl-options.d.ts +1 -9
- package/dist/src/geocoder/geocoder-feature-item.d.ts +1 -0
- package/dist/src/geocoder/geocoder.d.ts +5 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/leaflet.public.d.ts +1 -0
- package/dist/src/maplibregl.d.ts +1 -0
- package/dist/src/maptilersdk.d.ts +1 -0
- package/dist/src/openlayers.public.d.ts +1 -0
- package/package.json +20 -10
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { css as L, LitElement as F, svg as
|
|
2
|
-
import { customElement as O, property as h, state 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
7
|
import { styleMap as Ee } from "lit/directives/style-map.js";
|
|
8
|
-
var Ge = Object.getOwnPropertyDescriptor,
|
|
8
|
+
var Ge = Object.getOwnPropertyDescriptor, We = (e, t, i, n) => {
|
|
9
9
|
for (var s = n > 1 ? void 0 : n ? Ge(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
10
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 J = class extends F {
|
|
|
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
|
-
|
|
30
|
+
Q = We([
|
|
31
31
|
O("maptiler-geocode-clear-icon")
|
|
32
|
-
],
|
|
32
|
+
], Q);
|
|
33
33
|
var je = Object.getOwnPropertyDescriptor, Ae = (e, t, i, n) => {
|
|
34
34
|
for (var s = n > 1 ? void 0 : n ? je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
35
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 X = class extends F {
|
|
|
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
|
-
|
|
55
|
+
H = Ae([
|
|
56
56
|
O("maptiler-geocode-fail-icon")
|
|
57
|
-
],
|
|
58
|
-
var Re = Object.getOwnPropertyDescriptor,
|
|
57
|
+
], H);
|
|
58
|
+
var Re = Object.getOwnPropertyDescriptor, Ve = (e, t, i, n) => {
|
|
59
59
|
for (var s = n > 1 ? void 0 : n ? Re(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
60
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 Y = class extends F {
|
|
|
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 @@ Y.styles = L`
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
`;
|
|
102
|
-
|
|
102
|
+
J = Ve([
|
|
103
103
|
O("maptiler-geocode-loading-icon")
|
|
104
|
-
],
|
|
105
|
-
var
|
|
106
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
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
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 ee = class extends F {
|
|
|
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
|
-
|
|
127
|
+
X = ze([
|
|
128
128
|
O("maptiler-geocode-reverse-geocoding-icon")
|
|
129
|
-
],
|
|
129
|
+
], X);
|
|
130
130
|
var qe = Object.getOwnPropertyDescriptor, Ne = (e, t, i, n) => {
|
|
131
131
|
for (var s = n > 1 ? void 0 : n ? qe(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
132
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 te = class extends F {
|
|
|
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,23 +163,23 @@ te.styles = L`
|
|
|
163
163
|
stroke: var(--color-icon-button);
|
|
164
164
|
}
|
|
165
165
|
`;
|
|
166
|
-
|
|
166
|
+
Y = Ne([
|
|
167
167
|
O("maptiler-geocode-search-icon")
|
|
168
|
-
],
|
|
168
|
+
], Y);
|
|
169
169
|
function Ke(e, t, i) {
|
|
170
170
|
const n = t[1], s = t[0], p = n - s;
|
|
171
171
|
return e === n && i ? e : ((e - s) % p + p) % p + s;
|
|
172
172
|
}
|
|
173
|
-
let
|
|
173
|
+
let U;
|
|
174
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 {
|
|
@@ -187,18 +187,18 @@ async function Ze(e, t, i) {
|
|
|
187
187
|
i.signal.addEventListener("abort", () => {
|
|
188
188
|
l(Error("aborted"));
|
|
189
189
|
}), navigator.geolocation.getCurrentPosition(
|
|
190
|
-
(
|
|
191
|
-
p([
|
|
190
|
+
($) => {
|
|
191
|
+
p([$.coords.longitude, $.coords.latitude].map((x) => x.toFixed(6)).join(","));
|
|
192
192
|
},
|
|
193
|
-
(
|
|
194
|
-
l(
|
|
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
|
});
|
|
@@ -213,20 +213,20 @@ async function Ze(e, t, i) {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
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,
|
|
216
|
+
var He = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, ge = (e) => {
|
|
217
217
|
throw TypeError(e);
|
|
218
|
-
},
|
|
218
|
+
}, _ = (e, t, i, n) => {
|
|
219
219
|
for (var s = n > 1 ? void 0 : n ? Je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
220
220
|
(l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
|
|
221
221
|
return n && s && He(t, i, s), s;
|
|
222
|
-
},
|
|
223
|
-
const
|
|
224
|
-
let I,
|
|
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
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`
|
|
@@ -244,90 +244,90 @@ let I, _e, w = class extends F {
|
|
|
244
244
|
style=${Ee({
|
|
245
245
|
width: `${this.spriteIcon.width / T}px`,
|
|
246
246
|
height: `${this.spriteIcon.height / T}px`,
|
|
247
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
247
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${be}.png)`,
|
|
248
248
|
backgroundPosition: `-${this.spriteIcon.x / T}px -${this.spriteIcon.y / T}px`,
|
|
249
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=${
|
|
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() {
|
|
276
276
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
277
277
|
};
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
ye = function() {
|
|
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
|
-
|
|
286
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
285
|
+
ve = function() {
|
|
286
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, re).call(this);
|
|
287
287
|
};
|
|
288
|
-
|
|
289
|
-
I !== void 0 ?
|
|
290
|
-
|
|
288
|
+
re = function() {
|
|
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
300
|
w.styles = L`
|
|
301
|
-
${
|
|
301
|
+
${fe(Qe)}
|
|
302
302
|
`;
|
|
303
|
-
|
|
303
|
+
_([
|
|
304
304
|
h({ type: Object })
|
|
305
305
|
], w.prototype, "feature", 2);
|
|
306
|
-
|
|
306
|
+
_([
|
|
307
307
|
h({ type: String })
|
|
308
308
|
], w.prototype, "itemStyle", 2);
|
|
309
|
-
|
|
309
|
+
_([
|
|
310
310
|
h({ type: String })
|
|
311
311
|
], w.prototype, "showPlaceType", 2);
|
|
312
|
-
|
|
312
|
+
_([
|
|
313
313
|
h({ attribute: !1 })
|
|
314
314
|
], w.prototype, "missingIconsCache", 2);
|
|
315
|
-
|
|
315
|
+
_([
|
|
316
316
|
h({ type: String })
|
|
317
317
|
], w.prototype, "iconsBaseUrl", 2);
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
_([
|
|
319
|
+
v()
|
|
320
320
|
], w.prototype, "category", 2);
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
_([
|
|
322
|
+
v()
|
|
323
323
|
], w.prototype, "imageUrl", 2);
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
_([
|
|
325
|
+
v()
|
|
326
326
|
], w.prototype, "spriteIcon", 2);
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
_([
|
|
328
|
+
v()
|
|
329
329
|
], w.prototype, "index", 2);
|
|
330
|
-
w =
|
|
330
|
+
w = _([
|
|
331
331
|
O("maptiler-geocoder-feature-item")
|
|
332
332
|
], w);
|
|
333
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}";
|
|
@@ -337,13 +337,13 @@ var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, $e = (e) =
|
|
|
337
337
|
for (var s = n > 1 ? void 0 : n ? tt(t, i) : t, p = e.length - 1, l; p >= 0; p--)
|
|
338
338
|
(l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
|
|
339
339
|
return n && s && et(t, i, s), s;
|
|
340
|
-
},
|
|
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
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.
|
|
@@ -362,7 +362,7 @@ let o = class extends F {
|
|
|
362
362
|
* @param value text to set
|
|
363
363
|
*/
|
|
364
364
|
setQuery(e) {
|
|
365
|
-
c(this, r,
|
|
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,7 +370,7 @@ let o = class extends F {
|
|
|
370
370
|
* @param value text to set and submit
|
|
371
371
|
*/
|
|
372
372
|
submitQuery(e) {
|
|
373
|
-
c(this, r,
|
|
373
|
+
c(this, r, he).call(this, e, { external: !0 });
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Clear search result list.
|
|
@@ -400,27 +400,25 @@ let o = class extends F {
|
|
|
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, r,
|
|
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, r, k).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((t) => e.has(t)) &&
|
|
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, r, y).call(this, "select", { feature: x(this, r, 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, r, 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
412
|
c(this, r, y).call(this, "pick", { feature: this.picked });
|
|
415
413
|
},
|
|
416
414
|
(t) => {
|
|
417
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, r,
|
|
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,15 +435,15 @@ let o = class extends F {
|
|
|
437
435
|
@focus=${() => this.focused = !0}
|
|
438
436
|
@blur=${() => this.focused = !1}
|
|
439
437
|
@click=${() => this.focused = !0}
|
|
440
|
-
@keydown=${c(this, r,
|
|
441
|
-
@input=${c(this, r,
|
|
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
|
-
${
|
|
446
|
+
${b(this, r, _e) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
|
|
449
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>
|
|
@@ -461,7 +459,7 @@ let o = class extends F {
|
|
|
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 o = class extends F {
|
|
|
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 o = class extends F {
|
|
|
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 o = class extends F {
|
|
|
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, r,
|
|
502
|
+
@pointerenter=${() => {
|
|
503
|
+
c(this, r, Fe).call(this, t);
|
|
499
504
|
}}
|
|
500
505
|
@select=${() => {
|
|
501
|
-
c(this, r,
|
|
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.8/icons/"}
|
|
510
|
+
/>
|
|
508
511
|
`
|
|
509
512
|
)}
|
|
510
513
|
</ul>
|
|
@@ -513,26 +516,22 @@ let o = class extends F {
|
|
|
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
523
|
r = /* @__PURE__ */ new WeakSet();
|
|
522
|
-
|
|
524
|
+
V = function() {
|
|
523
525
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
524
526
|
};
|
|
525
|
-
|
|
526
|
-
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
527
|
-
};
|
|
528
|
-
Ie = 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
533
|
y = function(e, ...[t]) {
|
|
535
|
-
|
|
534
|
+
b(this, R) && this.dispatchEvent(
|
|
536
535
|
new CustomEvent(e, {
|
|
537
536
|
bubbles: !0,
|
|
538
537
|
composed: !0,
|
|
@@ -540,30 +539,30 @@ y = function(e, ...[t]) {
|
|
|
540
539
|
})
|
|
541
540
|
);
|
|
542
541
|
};
|
|
543
|
-
|
|
544
|
-
e?.preventDefault(), this.focused = !1, clearTimeout(
|
|
542
|
+
le = function(e, { external: t = !1 } = {}) {
|
|
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: t }).then(() => {
|
|
545
544
|
this.picked = void 0;
|
|
546
|
-
}).catch((
|
|
545
|
+
}).catch((i) => this.error = i);
|
|
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
|
}
|
|
554
553
|
};
|
|
555
|
-
|
|
554
|
+
ne = function() {
|
|
556
555
|
setTimeout(() => {
|
|
557
556
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
558
557
|
});
|
|
559
558
|
};
|
|
560
|
-
|
|
561
|
-
if (this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r,
|
|
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
563
|
const i = this.searchValue;
|
|
565
|
-
|
|
566
|
-
c(this, r,
|
|
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
568
|
c(this, r, k).call(this);
|
|
@@ -571,53 +570,53 @@ he = function(e, { external: t = !1 } = {}) {
|
|
|
571
570
|
k = function() {
|
|
572
571
|
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, r, y).call(this, "featuresclear"));
|
|
573
572
|
};
|
|
574
|
-
|
|
575
|
-
this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r,
|
|
573
|
+
he = function(e, { external: t = !1 } = {}) {
|
|
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, void 0, { external: t });
|
|
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
578
|
const s = new AbortController();
|
|
580
579
|
this.abortController = s;
|
|
581
580
|
try {
|
|
582
|
-
const p = this.apiUrl ?? "https://api.maptiler.com/geocoding", l = c(this, r,
|
|
583
|
-
this.language !== void 0 &&
|
|
584
|
-
const [
|
|
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];
|
|
585
584
|
let S = (!l || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
586
|
-
(m) => typeof m == "string" ? m :
|
|
585
|
+
(m) => typeof m == "string" ? m : N === void 0 || (m[0] ?? 0) <= N && N < (m[1] ?? 1 / 0) ? m[2] : void 0
|
|
587
586
|
).filter((m) => m !== void 0);
|
|
588
|
-
S && (S = [...new Set(S)],
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
const m = this.proximity ?? [{ type: "server-geolocation" }],
|
|
592
|
-
|
|
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
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
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 !==
|
|
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, r, y).call(this, "request", { urlObj:
|
|
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 m = await fetch(
|
|
605
|
+
const m = await fetch(W, {
|
|
607
606
|
signal: s.signal,
|
|
608
607
|
...this.fetchParameters
|
|
609
608
|
});
|
|
610
609
|
if (!m.ok)
|
|
611
610
|
throw new Error(await m.text());
|
|
612
|
-
|
|
611
|
+
P = await m.json();
|
|
613
612
|
}
|
|
614
|
-
c(this, r, y).call(this, "response", { url:
|
|
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
617
|
id: `reverse_${l.decimalLongitude}_${l.decimalLatitude}`,
|
|
619
|
-
|
|
620
|
-
|
|
618
|
+
place_name: `${l.decimalLatitude}, ${l.decimalLongitude}`,
|
|
619
|
+
text: l.toCoordinateFormat("DMS"),
|
|
621
620
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
622
621
|
place_type: ["reverse"],
|
|
623
622
|
place_type_name: ["reverse"],
|
|
@@ -627,7 +626,7 @@ K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
|
|
|
627
626
|
type: "Point",
|
|
628
627
|
coordinates: [l.decimalLongitude, l.decimalLatitude]
|
|
629
628
|
}
|
|
630
|
-
}), c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !==
|
|
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());
|
|
631
630
|
} catch (p) {
|
|
632
631
|
if (p && typeof p == "object" && "name" in p && p.name === "AbortError")
|
|
633
632
|
return;
|
|
@@ -636,32 +635,40 @@ K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
|
|
|
636
635
|
s === this.abortController && (this.abortController = void 0);
|
|
637
636
|
}
|
|
638
637
|
};
|
|
639
|
-
|
|
640
|
-
this.reverseActive = this.enableReverse === "always", c(this, r, k).call(this), this.picked = void 0, c(this, r,
|
|
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)
|
|
644
643
|
return;
|
|
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, r,
|
|
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
|
+
};
|
|
659
|
+
Se = function() {
|
|
660
|
+
this.isFeatureListInteractedWith = !0;
|
|
661
|
+
};
|
|
657
662
|
Te = function() {
|
|
658
|
-
(
|
|
663
|
+
setTimeout(() => {
|
|
664
|
+
this.isFeatureListInteractedWith = !1;
|
|
665
|
+
});
|
|
659
666
|
};
|
|
660
667
|
Ce = function() {
|
|
661
668
|
this.searchValue = "", c(this, r, y).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
662
669
|
};
|
|
663
670
|
o.styles = L`
|
|
664
|
-
${
|
|
671
|
+
${fe(Ye)}
|
|
665
672
|
`;
|
|
666
673
|
a([
|
|
667
674
|
h({ attribute: !1 })
|
|
@@ -775,38 +782,41 @@ a([
|
|
|
775
782
|
h({ type: String })
|
|
776
783
|
], o.prototype, "worldview", 2);
|
|
777
784
|
a([
|
|
778
|
-
|
|
785
|
+
Ue("input")
|
|
779
786
|
], o.prototype, "input", 2);
|
|
780
787
|
a([
|
|
781
|
-
|
|
788
|
+
v()
|
|
782
789
|
], o.prototype, "searchValue", 2);
|
|
783
790
|
a([
|
|
784
|
-
|
|
791
|
+
v()
|
|
785
792
|
], o.prototype, "listFeatures", 2);
|
|
786
793
|
a([
|
|
787
|
-
|
|
794
|
+
v()
|
|
788
795
|
], o.prototype, "selectedItemIndex", 2);
|
|
789
796
|
a([
|
|
790
|
-
|
|
797
|
+
v()
|
|
791
798
|
], o.prototype, "picked", 2);
|
|
792
799
|
a([
|
|
793
|
-
|
|
800
|
+
v()
|
|
794
801
|
], o.prototype, "cachedFeatures", 2);
|
|
795
802
|
a([
|
|
796
|
-
|
|
803
|
+
v()
|
|
797
804
|
], o.prototype, "lastSearchUrl", 2);
|
|
798
805
|
a([
|
|
799
|
-
|
|
806
|
+
v()
|
|
800
807
|
], o.prototype, "error", 2);
|
|
801
808
|
a([
|
|
802
|
-
|
|
809
|
+
v()
|
|
803
810
|
], o.prototype, "abortController", 2);
|
|
804
811
|
a([
|
|
805
|
-
|
|
812
|
+
v()
|
|
806
813
|
], o.prototype, "focused", 2);
|
|
807
814
|
a([
|
|
808
|
-
|
|
809
|
-
], o.prototype, "
|
|
815
|
+
v()
|
|
816
|
+
], o.prototype, "isFeatureListVisible", 2);
|
|
817
|
+
a([
|
|
818
|
+
v()
|
|
819
|
+
], o.prototype, "isFeatureListInteractedWith", 2);
|
|
810
820
|
o = a([
|
|
811
821
|
O("maptiler-geocoder")
|
|
812
822
|
], o);
|
|
@@ -850,11 +860,11 @@ const it = [
|
|
|
850
860
|
"worldview"
|
|
851
861
|
];
|
|
852
862
|
export {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
863
|
+
Q as MaptilerGeocodeClearIconElement,
|
|
864
|
+
H as MaptilerGeocodeFailIconElement,
|
|
865
|
+
J as MaptilerGeocodeLoadingIconElement,
|
|
866
|
+
X as MaptilerGeocodeReverseGeocodingIconElement,
|
|
867
|
+
Y as MaptilerGeocodeSearchIconElement,
|
|
858
868
|
o as MaptilerGeocoderElement
|
|
859
869
|
};
|
|
860
870
|
//# sourceMappingURL=index.js.map
|