@maptiler/geocoding-control 3.0.0-rc.5 → 3.0.0-rc.6
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 +307 -307
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +25 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +314 -313
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +28 -28
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +296 -295
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +26 -26
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +310 -309
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +29 -29
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +341 -340
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +33 -33
- 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/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
3
|
-
import { convert as
|
|
1
|
+
import { css as L, LitElement as F, svg as q, html as f, unsafeCSS as ge, nothing as H } from "lit";
|
|
2
|
+
import { customElement as O, property as h, state as b, query as Me } from "lit/decorators.js";
|
|
3
|
+
import { convert as Pe } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as j } from "lit/directives/class-map.js";
|
|
5
|
-
import { repeat as
|
|
5
|
+
import { repeat as Be } 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, De = (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 J = class extends F {
|
|
14
14
|
render() {
|
|
15
15
|
return q`
|
|
16
16
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
@@ -21,21 +21,21 @@ let H = class extends L {
|
|
|
21
21
|
`;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
J.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
|
+
J = De([
|
|
31
|
+
O("maptiler-geocode-clear-icon")
|
|
32
|
+
], J);
|
|
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 X = class extends F {
|
|
39
39
|
render() {
|
|
40
40
|
return q`
|
|
41
41
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -46,21 +46,21 @@ let J = class extends L {
|
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
X.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
|
+
X = Ae([
|
|
56
|
+
O("maptiler-geocode-fail-icon")
|
|
57
|
+
], X);
|
|
58
|
+
var Re = Object.getOwnPropertyDescriptor, We = (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 Y = 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
|
+
Y.styles = L`
|
|
76
76
|
div {
|
|
77
77
|
position: absolute;
|
|
78
78
|
left: 50%;
|
|
@@ -99,15 +99,15 @@ 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
|
+
Y = We([
|
|
103
|
+
O("maptiler-geocode-loading-icon")
|
|
104
|
+
], Y);
|
|
105
|
+
var Ve = Object.getOwnPropertyDescriptor, ze = (e, t, i, n) => {
|
|
106
|
+
for (var s = n > 1 ? void 0 : n ? Ve(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 ee = class extends F {
|
|
111
111
|
render() {
|
|
112
112
|
return q`
|
|
113
113
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
@@ -118,21 +118,21 @@ let Y = class extends L {
|
|
|
118
118
|
`;
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
ee.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
|
+
ee = ze([
|
|
128
|
+
O("maptiler-geocode-reverse-geocoding-icon")
|
|
129
|
+
], ee);
|
|
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 te = class extends F {
|
|
136
136
|
render() {
|
|
137
137
|
return q`
|
|
138
138
|
<svg
|
|
@@ -147,7 +147,7 @@ let ee = class extends L {
|
|
|
147
147
|
`;
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
te.styles = L`
|
|
151
151
|
circle {
|
|
152
152
|
stroke-width: 1.875;
|
|
153
153
|
fill: none;
|
|
@@ -163,15 +163,15 @@ 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
|
+
te = Ne([
|
|
167
|
+
O("maptiler-geocode-search-icon")
|
|
168
|
+
], te);
|
|
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
173
|
let P;
|
|
174
|
-
async function
|
|
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")
|
|
@@ -183,15 +183,15 @@ async function Ke(e, t, i) {
|
|
|
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((v) => v.toFixed(6)).join(","));
|
|
192
192
|
},
|
|
193
|
-
(
|
|
194
|
-
|
|
193
|
+
(_) => {
|
|
194
|
+
l(_);
|
|
195
195
|
},
|
|
196
196
|
n
|
|
197
197
|
);
|
|
@@ -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, me = (e) => {
|
|
217
217
|
throw TypeError(e);
|
|
218
|
-
},
|
|
219
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
220
|
-
(
|
|
221
|
-
return n && s &&
|
|
222
|
-
},
|
|
223
|
-
const
|
|
224
|
-
let
|
|
218
|
+
}, $ = (e, t, i, n) => {
|
|
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
|
+
}, ye = (e, t, i) => t.has(e) || me("Cannot " + i), u = (e, t, i) => (ye(e, t, "read from private field"), i ? i.call(e) : t.get(e)), Xe = (e, t, i) => t.has(e) ? me("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), U = (e, t, i) => (ye(e, t, "access private method"), i), d, W, B, g, ve, xe, oe, ie;
|
|
223
|
+
const be = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, we = be ? "@2x" : "", T = be ? 2 : 1;
|
|
224
|
+
let I, _e, 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, W) && (this.index = u(this, d, W).length,
|
|
229
|
+
e.has("feature") && u(this, d, W) && (this.index = u(this, d, W).length, U(this, d, oe).call(this));
|
|
230
230
|
}
|
|
231
231
|
render() {
|
|
232
232
|
return f`
|
|
@@ -238,25 +238,25 @@ 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 /
|
|
247
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
248
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
249
|
-
backgroundSize: `${
|
|
244
|
+
style=${Ee({
|
|
245
|
+
width: `${this.spriteIcon.width / T}px`,
|
|
246
|
+
height: `${this.spriteIcon.height / T}px`,
|
|
247
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${we}.png)`,
|
|
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=${
|
|
253
|
+
` : this.imageUrl ? f` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${U(this, d, xe)} />` : 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, B) ? 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
257
|
<span class="primary"> ${u(this, d, B) ? 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, B) ? f` <span class="secondary"> ${u(this, d, g)} </span> ` :
|
|
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, B) ? f` <span class="secondary"> ${u(this, d, g)} </span> ` : H}
|
|
260
260
|
</span>
|
|
261
261
|
|
|
262
262
|
<span class="line2"> ${u(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
@@ -275,72 +275,72 @@ B = function() {
|
|
|
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
|
-
|
|
280
|
-
|
|
278
|
+
ve = function() {
|
|
279
|
+
_e ??= fetch(`${this.iconsBaseUrl}sprite${we}.json`).then((e) => e.json()).then((e) => {
|
|
280
|
+
I = e;
|
|
281
281
|
}).catch(() => {
|
|
282
|
-
|
|
282
|
+
I = null;
|
|
283
283
|
});
|
|
284
284
|
};
|
|
285
|
-
|
|
286
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
285
|
+
xe = function() {
|
|
286
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), U(this, d, oe).call(this);
|
|
287
287
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
oe = function() {
|
|
289
|
+
I !== void 0 ? U(this, d, ie).call(this) : (U(this, d, ve).call(this), _e?.then(() => {
|
|
290
|
+
U(this, d, ie).call(this);
|
|
291
291
|
}));
|
|
292
292
|
};
|
|
293
|
-
|
|
293
|
+
ie = function() {
|
|
294
294
|
do {
|
|
295
|
-
if (this.index--, this.category = u(this, d, W)?.[this.index], this.spriteIcon = this.category ?
|
|
295
|
+
if (this.index--, this.category = u(this, d, W)?.[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
|
-
${
|
|
300
|
+
w.styles = L`
|
|
301
|
+
${ge(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
|
-
|
|
318
|
+
$([
|
|
319
319
|
b()
|
|
320
320
|
], w.prototype, "category", 2);
|
|
321
|
-
|
|
321
|
+
$([
|
|
322
322
|
b()
|
|
323
323
|
], w.prototype, "imageUrl", 2);
|
|
324
|
-
|
|
324
|
+
$([
|
|
325
325
|
b()
|
|
326
326
|
], w.prototype, "spriteIcon", 2);
|
|
327
|
-
|
|
327
|
+
$([
|
|
328
328
|
b()
|
|
329
329
|
], w.prototype, "index", 2);
|
|
330
|
-
w =
|
|
331
|
-
|
|
330
|
+
w = $([
|
|
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
|
-
},
|
|
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
|
+
}, ae = (e, t, i) => t.has(e) || $e("Cannot " + i), x = (e, t, i) => (ae(e, t, "read from private field"), i ? i.call(e) : t.get(e)), C = (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), A = (e, t, i, n) => (ae(e, t, "write to private field"), t.set(e, i), i), c = (e, t, i) => (ae(e, t, "access private method"), i), V, R, E, se, G, r, z, ke, Ie, le, y, ne, N, ce, he, k, pe, K, Le, re, Fe, Oe, Se, Te, Ce;
|
|
341
|
+
let o = class extends F {
|
|
342
342
|
constructor() {
|
|
343
|
-
super(...arguments),
|
|
343
|
+
super(...arguments), C(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.focusedDelayed = !1, C(this, V, !1), C(this, R, !1), C(this, E), C(this, se, /* @__PURE__ */ new Set()), C(this, G);
|
|
344
344
|
}
|
|
345
345
|
firstUpdated() {
|
|
346
346
|
A(this, V, !0);
|
|
@@ -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, he).call(this, e, { external: !0 }), c(this, r, ce).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, pe).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.
|
|
@@ -404,23 +404,23 @@ let a = class extends L {
|
|
|
404
404
|
}
|
|
405
405
|
/** @internal */
|
|
406
406
|
handleMapClick(e) {
|
|
407
|
-
this.reverseActive && c(this,
|
|
407
|
+
this.reverseActive && c(this, r, Le).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,
|
|
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)) && x(this, r, le) && (c(this, r, k).call(this), this.error = void 0), ["focused"].some((t) => e.has(t)) && setTimeout(() => {
|
|
411
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,
|
|
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(
|
|
413
413
|
() => {
|
|
414
|
-
c(this,
|
|
414
|
+
c(this, r, y).call(this, "pick", { feature: this.picked });
|
|
415
415
|
},
|
|
416
416
|
(t) => {
|
|
417
|
-
t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this,
|
|
417
|
+
t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this, r, y).call(this, "pick", { feature: this.picked }));
|
|
418
418
|
}
|
|
419
|
-
), ["listFeatures", "focusedDelayed"].some((t) => e.has(t)) && (x(this,
|
|
419
|
+
), ["listFeatures", "focusedDelayed"].some((t) => e.has(t)) && (x(this, r, ke) ? (c(this, r, y).call(this, "featuresshow"), A(this, R, !0)) : x(this, R) && c(this, r, y).call(this, "featureshide")), ["reverseActive"].some((t) => e.has(t)) && c(this, r, y).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
420
420
|
}
|
|
421
421
|
render() {
|
|
422
422
|
return f`
|
|
423
|
-
<form @submit=${c(this,
|
|
423
|
+
<form @submit=${c(this, r, ne)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
|
|
424
424
|
<div class="input-group">
|
|
425
425
|
<button
|
|
426
426
|
class="search-button"
|
|
@@ -437,16 +437,16 @@ let a = class extends L {
|
|
|
437
437
|
@focus=${() => this.focused = !0}
|
|
438
438
|
@blur=${() => this.focused = !1}
|
|
439
439
|
@click=${() => this.focused = !0}
|
|
440
|
-
@keydown=${c(this,
|
|
441
|
-
@input=${c(this,
|
|
440
|
+
@keydown=${c(this, r, re)}
|
|
441
|
+
@input=${c(this, r, Fe)}
|
|
442
442
|
@change=${() => this.picked = void 0}
|
|
443
443
|
placeholder=${this.placeholder ?? "Search"}
|
|
444
444
|
aria-label=${this.placeholder ?? "Search"}
|
|
445
445
|
/>
|
|
446
446
|
|
|
447
447
|
<div class="clear-button-container ${j({ displayable: this.searchValue !== "" })}">
|
|
448
|
-
${x(this,
|
|
449
|
-
<button type="button" @click=${c(this,
|
|
448
|
+
${x(this, r, Ie) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
|
|
449
|
+
<button type="button" @click=${c(this, r, Ce)} title=${this.clearButtonTitle ?? "clear"}>
|
|
450
450
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
451
451
|
</button>
|
|
452
452
|
`}
|
|
@@ -461,7 +461,7 @@ let a = class extends L {
|
|
|
461
461
|
>
|
|
462
462
|
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
463
463
|
</button>
|
|
464
|
-
` :
|
|
464
|
+
` : H}
|
|
465
465
|
|
|
466
466
|
<!-- <slot /> -->
|
|
467
467
|
</div>
|
|
@@ -476,7 +476,7 @@ let a = class extends L {
|
|
|
476
476
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
477
477
|
</button>
|
|
478
478
|
</div>
|
|
479
|
-
` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ?
|
|
479
|
+
` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? f`
|
|
480
480
|
<div class="no-results">
|
|
481
481
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
482
482
|
|
|
@@ -485,8 +485,8 @@ let a = class extends L {
|
|
|
485
485
|
</div>
|
|
486
486
|
</div>
|
|
487
487
|
` : f`
|
|
488
|
-
<ul class="options ${j({ "open-on-top": this.openListOnTop })}" @mouseleave=${c(this,
|
|
489
|
-
${
|
|
488
|
+
<ul class="options ${j({ "open-on-top": this.openListOnTop })}" @mouseleave=${c(this, r, Te)} @keydown=${c(this, r, re)} role="listbox">
|
|
489
|
+
${Be(
|
|
490
490
|
this.listFeatures,
|
|
491
491
|
(e) => e.id + (e.address ? "," + e.address : ""),
|
|
492
492
|
(e, t) => f`
|
|
@@ -495,13 +495,13 @@ let a = class extends L {
|
|
|
495
495
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
496
496
|
itemStyle=${this.selectedItemIndex === t ? "selected" : this.picked?.id === e.id ? "picked" : "default"}
|
|
497
497
|
@mouseenter=${() => {
|
|
498
|
-
c(this,
|
|
498
|
+
c(this, r, Se).call(this, t);
|
|
499
499
|
}}
|
|
500
500
|
@select=${() => {
|
|
501
|
-
c(this,
|
|
501
|
+
c(this, r, Oe).call(this, e);
|
|
502
502
|
}}
|
|
503
|
-
.missingIconsCache=${x(this,
|
|
504
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
503
|
+
.missingIconsCache=${x(this, se)}
|
|
504
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
|
|
505
505
|
>
|
|
506
506
|
${e.place_name}
|
|
507
507
|
</maptiler-geocoder-feature-item>
|
|
@@ -516,22 +516,22 @@ let a = class extends L {
|
|
|
516
516
|
V = /* @__PURE__ */ new WeakMap();
|
|
517
517
|
R = /* @__PURE__ */ new WeakMap();
|
|
518
518
|
E = /* @__PURE__ */ new WeakMap();
|
|
519
|
-
|
|
519
|
+
se = /* @__PURE__ */ new WeakMap();
|
|
520
520
|
G = /* @__PURE__ */ new WeakMap();
|
|
521
|
-
|
|
521
|
+
r = /* @__PURE__ */ new WeakSet();
|
|
522
522
|
z = function() {
|
|
523
523
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
524
524
|
};
|
|
525
|
-
|
|
525
|
+
ke = function() {
|
|
526
526
|
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
527
527
|
};
|
|
528
|
-
|
|
528
|
+
Ie = function() {
|
|
529
529
|
return this.abortController !== void 0;
|
|
530
530
|
};
|
|
531
|
-
|
|
531
|
+
le = function() {
|
|
532
532
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
533
533
|
};
|
|
534
|
-
|
|
534
|
+
y = function(e, ...[t]) {
|
|
535
535
|
x(this, V) && this.dispatchEvent(
|
|
536
536
|
new CustomEvent(e, {
|
|
537
537
|
bubbles: !0,
|
|
@@ -540,277 +540,277 @@ v = function(e, ...[t]) {
|
|
|
540
540
|
})
|
|
541
541
|
);
|
|
542
542
|
};
|
|
543
|
-
|
|
544
|
-
e?.preventDefault(), this.focused = !1, clearTimeout(x(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,
|
|
543
|
+
ne = function(e) {
|
|
544
|
+
e?.preventDefault(), this.focused = !1, clearTimeout(x(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, K).call(this, this.searchValue, { exact: !0, external: e === void 0 }).then(() => {
|
|
545
545
|
this.picked = void 0;
|
|
546
546
|
}).catch((t) => this.error = t);
|
|
547
547
|
};
|
|
548
548
|
N = function(e) {
|
|
549
549
|
try {
|
|
550
|
-
return
|
|
550
|
+
return Pe(e, 6);
|
|
551
551
|
} catch {
|
|
552
552
|
return !1;
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
ce = function() {
|
|
556
556
|
setTimeout(() => {
|
|
557
557
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
558
558
|
});
|
|
559
559
|
};
|
|
560
|
-
|
|
561
|
-
if (this.searchValue = e, c(this,
|
|
562
|
-
if (clearTimeout(x(this, E)), x(this,
|
|
560
|
+
he = function(e, { external: t = !1 } = {}) {
|
|
561
|
+
if (this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, N).call(this, e) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
562
|
+
if (clearTimeout(x(this, E)), x(this, r, le))
|
|
563
563
|
return;
|
|
564
|
-
const
|
|
564
|
+
const i = this.searchValue;
|
|
565
565
|
A(this, E, window.setTimeout(() => {
|
|
566
|
-
c(this,
|
|
566
|
+
c(this, r, K).call(this, i, { external: t }).catch((n) => this.error = n);
|
|
567
567
|
}, this.debounceSearch ?? 200));
|
|
568
568
|
} else
|
|
569
|
-
c(this,
|
|
569
|
+
c(this, r, k).call(this);
|
|
570
570
|
};
|
|
571
|
-
|
|
572
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this,
|
|
571
|
+
k = function() {
|
|
572
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, r, y).call(this, "featuresclear"));
|
|
573
573
|
};
|
|
574
|
-
|
|
575
|
-
this.searchValue = e, c(this,
|
|
574
|
+
pe = function(e) {
|
|
575
|
+
this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, N).call(this, e) }), this.selectedItemIndex = -1, c(this, r, ne).call(this);
|
|
576
576
|
};
|
|
577
|
-
K = async function(e, { byId: t = !1, exact: i = !1 } = {}) {
|
|
577
|
+
K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
|
|
578
578
|
this.error = void 0, this.abortController?.abort();
|
|
579
|
-
const
|
|
580
|
-
this.abortController =
|
|
579
|
+
const s = new AbortController();
|
|
580
|
+
this.abortController = s;
|
|
581
581
|
try {
|
|
582
|
-
const
|
|
583
|
-
this.language !== void 0 &&
|
|
584
|
-
const [
|
|
585
|
-
let
|
|
586
|
-
(
|
|
587
|
-
).filter((
|
|
588
|
-
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
const
|
|
592
|
-
|
|
582
|
+
const p = this.apiUrl ?? "https://api.maptiler.com/geocoding", l = c(this, r, N).call(this, e), _ = new URL(p + "/" + encodeURIComponent(l ? `${l.decimalLongitude},${l.decimalLatitude}` : e) + ".json"), v = _.searchParams;
|
|
583
|
+
this.language !== void 0 && v.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
584
|
+
const [Z] = x(this, G) ?? [void 0];
|
|
585
|
+
let S = (!l || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
586
|
+
(m) => typeof m == "string" ? m : Z === void 0 || (m[0] ?? 0) <= Z && Z < (m[1] ?? 1 / 0) ? m[2] : void 0
|
|
587
|
+
).filter((m) => m !== void 0);
|
|
588
|
+
S && (S = [...new Set(S)], v.set("types", S.join(",")));
|
|
589
|
+
const de = !l || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
590
|
+
if (de && v.set("excludeTypes", String(de)), this.bbox && v.set("bbox", this.bbox.map((m) => m.toFixed(6)).join(",")), this.country && v.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && v.set("worldview", this.worldview), !t && !l) {
|
|
591
|
+
const m = this.proximity ?? [{ type: "server-geolocation" }], fe = await Ze(x(this, G), m, s);
|
|
592
|
+
fe && v.set("proximity", fe), (i || this.showResultsWhileTyping === !1) && v.set("autocomplete", "false"), v.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
593
593
|
}
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
const
|
|
594
|
+
const ue = this.limit ?? 5, Q = this.reverseGeocodingLimit ?? ue;
|
|
595
|
+
Q > 1 && S?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), l ? (Q === 1 || this.exhaustiveReverseGeocoding || S?.length === 1) && v.set("limit", String(Q)) : v.set("limit", String(ue)), this.apiKey && v.set("key", this.apiKey), this.adjustUrl?.(_);
|
|
596
|
+
const Ue = _.searchParams.get("types") === "" && _.searchParams.get("excludeTypes") !== "true", D = _.toString();
|
|
597
597
|
if (D === this.lastSearchUrl) {
|
|
598
|
-
t ? (this.clearListOnPick && c(this,
|
|
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 !== x(this, r, z)?.id && (this.selectedItemIndex = -1));
|
|
599
599
|
return;
|
|
600
600
|
}
|
|
601
|
-
c(this,
|
|
601
|
+
c(this, r, y).call(this, "request", { urlObj: _ }), this.lastSearchUrl = D;
|
|
602
602
|
let M;
|
|
603
|
-
if (
|
|
603
|
+
if (Ue)
|
|
604
604
|
M = { type: "FeatureCollection", features: [] };
|
|
605
605
|
else {
|
|
606
|
-
const
|
|
607
|
-
signal:
|
|
606
|
+
const m = await fetch(D, {
|
|
607
|
+
signal: s.signal,
|
|
608
608
|
...this.fetchParameters
|
|
609
609
|
});
|
|
610
|
-
if (!
|
|
611
|
-
throw new Error(await
|
|
612
|
-
M = await
|
|
610
|
+
if (!m.ok)
|
|
611
|
+
throw new Error(await m.text());
|
|
612
|
+
M = await m.json();
|
|
613
613
|
}
|
|
614
|
-
c(this,
|
|
614
|
+
c(this, r, y).call(this, "response", { url: D, featureCollection: M }), t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = M.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = M.features.filter(this.filter ?? (() => !0)), l && this.listFeatures.unshift({
|
|
615
615
|
type: "Feature",
|
|
616
616
|
properties: {},
|
|
617
617
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
618
|
-
id: `reverse_${
|
|
619
|
-
text: `${
|
|
620
|
-
place_name:
|
|
618
|
+
id: `reverse_${l.decimalLongitude}_${l.decimalLatitude}`,
|
|
619
|
+
text: `${l.decimalLatitude}, ${l.decimalLongitude}`,
|
|
620
|
+
place_name: l.toCoordinateFormat("DMS"),
|
|
621
621
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
622
622
|
place_type: ["reverse"],
|
|
623
623
|
place_type_name: ["reverse"],
|
|
624
|
-
center: [
|
|
625
|
-
bbox: [
|
|
624
|
+
center: [l.decimalLongitude, l.decimalLatitude],
|
|
625
|
+
bbox: [l.decimalLongitude, l.decimalLatitude, l.decimalLongitude, l.decimalLatitude],
|
|
626
626
|
geometry: {
|
|
627
627
|
type: "Point",
|
|
628
|
-
coordinates: [
|
|
628
|
+
coordinates: [l.decimalLongitude, l.decimalLatitude]
|
|
629
629
|
}
|
|
630
|
-
}), c(this,
|
|
631
|
-
} catch (
|
|
632
|
-
if (
|
|
630
|
+
}), c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, r, z)?.id && (this.selectedItemIndex = -1), l && this.input.focus());
|
|
631
|
+
} catch (p) {
|
|
632
|
+
if (p && typeof p == "object" && "name" in p && p.name === "AbortError")
|
|
633
633
|
return;
|
|
634
|
-
throw
|
|
634
|
+
throw p;
|
|
635
635
|
} finally {
|
|
636
|
-
|
|
636
|
+
s === this.abortController && (this.abortController = void 0);
|
|
637
637
|
}
|
|
638
638
|
};
|
|
639
|
-
|
|
640
|
-
this.reverseActive = this.enableReverse === "always", c(this,
|
|
639
|
+
Le = function(e) {
|
|
640
|
+
this.reverseActive = this.enableReverse === "always", c(this, r, k).call(this), this.picked = void 0, c(this, r, pe).call(this, `${e[1].toFixed(6)}, ${Ke(e[0], [-180, 180], !0).toFixed(6)}`), c(this, r, ce).call(this);
|
|
641
641
|
};
|
|
642
|
-
|
|
642
|
+
re = function(e) {
|
|
643
643
|
if (!this.listFeatures)
|
|
644
644
|
return;
|
|
645
645
|
const t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
|
|
646
646
|
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
647
|
};
|
|
648
|
-
Le = function(e) {
|
|
649
|
-
c(this, o, ce).call(this, e.target.value);
|
|
650
|
-
};
|
|
651
648
|
Fe = function(e) {
|
|
652
|
-
(
|
|
649
|
+
c(this, r, he).call(this, e.target.value);
|
|
653
650
|
};
|
|
654
651
|
Oe = function(e) {
|
|
652
|
+
(!this.picked || this.picked.id !== e.id) && (this.picked = e, this.searchValue = e.place_name);
|
|
653
|
+
};
|
|
654
|
+
Se = function(e) {
|
|
655
655
|
this.selectedItemIndex = e;
|
|
656
656
|
};
|
|
657
|
-
|
|
657
|
+
Te = function() {
|
|
658
658
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
|
|
659
659
|
};
|
|
660
|
-
|
|
661
|
-
this.searchValue = "", c(this,
|
|
660
|
+
Ce = function() {
|
|
661
|
+
this.searchValue = "", c(this, r, y).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
662
662
|
};
|
|
663
|
-
|
|
664
|
-
${
|
|
663
|
+
o.styles = L`
|
|
664
|
+
${ge(Ye)}
|
|
665
665
|
`;
|
|
666
|
-
|
|
666
|
+
a([
|
|
667
667
|
h({ attribute: !1 })
|
|
668
|
-
],
|
|
669
|
-
|
|
668
|
+
], o.prototype, "adjustUrl", 2);
|
|
669
|
+
a([
|
|
670
670
|
h({ type: String })
|
|
671
|
-
],
|
|
672
|
-
|
|
671
|
+
], o.prototype, "apiKey", 2);
|
|
672
|
+
a([
|
|
673
673
|
h({ type: String })
|
|
674
|
-
],
|
|
675
|
-
|
|
674
|
+
], o.prototype, "apiUrl", 2);
|
|
675
|
+
a([
|
|
676
676
|
h({ type: Array })
|
|
677
|
-
],
|
|
678
|
-
|
|
677
|
+
], o.prototype, "bbox", 2);
|
|
678
|
+
a([
|
|
679
679
|
h({ type: String })
|
|
680
|
-
],
|
|
681
|
-
|
|
680
|
+
], o.prototype, "clearButtonTitle", 2);
|
|
681
|
+
a([
|
|
682
682
|
h({ type: Boolean })
|
|
683
|
-
],
|
|
684
|
-
|
|
683
|
+
], o.prototype, "clearListOnPick", 2);
|
|
684
|
+
a([
|
|
685
685
|
h({ type: Boolean })
|
|
686
|
-
],
|
|
687
|
-
|
|
686
|
+
], o.prototype, "clearOnBlur", 2);
|
|
687
|
+
a([
|
|
688
688
|
h({ type: Boolean })
|
|
689
|
-
],
|
|
690
|
-
|
|
689
|
+
], o.prototype, "collapsed", 2);
|
|
690
|
+
a([
|
|
691
691
|
h({ attribute: !1 })
|
|
692
|
-
],
|
|
693
|
-
|
|
692
|
+
], o.prototype, "country", 2);
|
|
693
|
+
a([
|
|
694
694
|
h({ type: Number })
|
|
695
|
-
],
|
|
696
|
-
|
|
695
|
+
], o.prototype, "debounceSearch", 2);
|
|
696
|
+
a([
|
|
697
697
|
h({ type: String })
|
|
698
|
-
],
|
|
699
|
-
|
|
698
|
+
], o.prototype, "enableReverse", 2);
|
|
699
|
+
a([
|
|
700
700
|
h({ type: String })
|
|
701
|
-
],
|
|
702
|
-
|
|
701
|
+
], o.prototype, "errorMessage", 2);
|
|
702
|
+
a([
|
|
703
703
|
h({ type: Boolean })
|
|
704
|
-
],
|
|
705
|
-
|
|
704
|
+
], o.prototype, "excludeTypes", 2);
|
|
705
|
+
a([
|
|
706
706
|
h({ type: Boolean })
|
|
707
|
-
],
|
|
708
|
-
|
|
707
|
+
], o.prototype, "exhaustiveReverseGeocoding", 2);
|
|
708
|
+
a([
|
|
709
709
|
h({ type: Boolean })
|
|
710
|
-
],
|
|
711
|
-
|
|
710
|
+
], o.prototype, "fetchFullGeometryOnPick", 2);
|
|
711
|
+
a([
|
|
712
712
|
h({ type: Object })
|
|
713
|
-
],
|
|
714
|
-
|
|
713
|
+
], o.prototype, "fetchParameters", 2);
|
|
714
|
+
a([
|
|
715
715
|
h({ attribute: !1 })
|
|
716
|
-
],
|
|
717
|
-
|
|
716
|
+
], o.prototype, "filter", 2);
|
|
717
|
+
a([
|
|
718
718
|
h({ type: Object })
|
|
719
|
-
],
|
|
720
|
-
|
|
719
|
+
], o.prototype, "fuzzyMatch", 2);
|
|
720
|
+
a([
|
|
721
721
|
h({ type: String })
|
|
722
|
-
],
|
|
723
|
-
|
|
722
|
+
], o.prototype, "iconsBaseUrl", 2);
|
|
723
|
+
a([
|
|
724
724
|
h({ type: Boolean })
|
|
725
|
-
],
|
|
726
|
-
|
|
725
|
+
], o.prototype, "keepListOpen", 2);
|
|
726
|
+
a([
|
|
727
727
|
h({ attribute: !1 })
|
|
728
|
-
],
|
|
729
|
-
|
|
728
|
+
], o.prototype, "language", 2);
|
|
729
|
+
a([
|
|
730
730
|
h({ type: Number })
|
|
731
|
-
],
|
|
732
|
-
|
|
731
|
+
], o.prototype, "limit", 2);
|
|
732
|
+
a([
|
|
733
733
|
h({ type: Number })
|
|
734
|
-
],
|
|
735
|
-
|
|
734
|
+
], o.prototype, "minLength", 2);
|
|
735
|
+
a([
|
|
736
736
|
h({ type: String })
|
|
737
|
-
],
|
|
738
|
-
|
|
737
|
+
], o.prototype, "noResultsMessage", 2);
|
|
738
|
+
a([
|
|
739
739
|
h({ type: Boolean })
|
|
740
|
-
],
|
|
741
|
-
|
|
740
|
+
], o.prototype, "openListOnTop", 2);
|
|
741
|
+
a([
|
|
742
742
|
h({ type: String })
|
|
743
|
-
],
|
|
744
|
-
|
|
743
|
+
], o.prototype, "placeholder", 2);
|
|
744
|
+
a([
|
|
745
745
|
h({ type: Array })
|
|
746
|
-
],
|
|
747
|
-
|
|
746
|
+
], o.prototype, "proximity", 2);
|
|
747
|
+
a([
|
|
748
748
|
h({ type: Boolean })
|
|
749
|
-
],
|
|
750
|
-
|
|
749
|
+
], o.prototype, "reverseActive", 2);
|
|
750
|
+
a([
|
|
751
751
|
h({ type: String })
|
|
752
|
-
],
|
|
753
|
-
|
|
752
|
+
], o.prototype, "reverseButtonTitle", 2);
|
|
753
|
+
a([
|
|
754
754
|
h({ type: Object })
|
|
755
|
-
],
|
|
756
|
-
|
|
755
|
+
], o.prototype, "reverseGeocodingExcludeTypes", 2);
|
|
756
|
+
a([
|
|
757
757
|
h({ type: Number })
|
|
758
|
-
],
|
|
759
|
-
|
|
758
|
+
], o.prototype, "reverseGeocodingLimit", 2);
|
|
759
|
+
a([
|
|
760
760
|
h({ type: Array })
|
|
761
|
-
],
|
|
762
|
-
|
|
761
|
+
], o.prototype, "reverseGeocodingTypes", 2);
|
|
762
|
+
a([
|
|
763
763
|
h({ type: Object })
|
|
764
|
-
],
|
|
765
|
-
|
|
764
|
+
], o.prototype, "selectFirst", 2);
|
|
765
|
+
a([
|
|
766
766
|
h({ type: String })
|
|
767
|
-
],
|
|
768
|
-
|
|
767
|
+
], o.prototype, "showPlaceType", 2);
|
|
768
|
+
a([
|
|
769
769
|
h({ type: Object })
|
|
770
|
-
],
|
|
771
|
-
|
|
770
|
+
], o.prototype, "showResultsWhileTyping", 2);
|
|
771
|
+
a([
|
|
772
772
|
h({ type: Array })
|
|
773
|
-
],
|
|
774
|
-
|
|
773
|
+
], o.prototype, "types", 2);
|
|
774
|
+
a([
|
|
775
775
|
h({ type: String })
|
|
776
|
-
],
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
],
|
|
780
|
-
|
|
776
|
+
], o.prototype, "worldview", 2);
|
|
777
|
+
a([
|
|
778
|
+
Me("input")
|
|
779
|
+
], o.prototype, "input", 2);
|
|
780
|
+
a([
|
|
781
781
|
b()
|
|
782
|
-
],
|
|
783
|
-
|
|
782
|
+
], o.prototype, "searchValue", 2);
|
|
783
|
+
a([
|
|
784
784
|
b()
|
|
785
|
-
],
|
|
786
|
-
|
|
785
|
+
], o.prototype, "listFeatures", 2);
|
|
786
|
+
a([
|
|
787
787
|
b()
|
|
788
|
-
],
|
|
789
|
-
|
|
788
|
+
], o.prototype, "selectedItemIndex", 2);
|
|
789
|
+
a([
|
|
790
790
|
b()
|
|
791
|
-
],
|
|
792
|
-
|
|
791
|
+
], o.prototype, "picked", 2);
|
|
792
|
+
a([
|
|
793
793
|
b()
|
|
794
|
-
],
|
|
795
|
-
|
|
794
|
+
], o.prototype, "cachedFeatures", 2);
|
|
795
|
+
a([
|
|
796
796
|
b()
|
|
797
|
-
],
|
|
798
|
-
|
|
797
|
+
], o.prototype, "lastSearchUrl", 2);
|
|
798
|
+
a([
|
|
799
799
|
b()
|
|
800
|
-
],
|
|
801
|
-
|
|
800
|
+
], o.prototype, "error", 2);
|
|
801
|
+
a([
|
|
802
802
|
b()
|
|
803
|
-
],
|
|
804
|
-
|
|
803
|
+
], o.prototype, "abortController", 2);
|
|
804
|
+
a([
|
|
805
805
|
b()
|
|
806
|
-
],
|
|
807
|
-
|
|
806
|
+
], o.prototype, "focused", 2);
|
|
807
|
+
a([
|
|
808
808
|
b()
|
|
809
|
-
],
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
],
|
|
813
|
-
const
|
|
809
|
+
], o.prototype, "focusedDelayed", 2);
|
|
810
|
+
o = a([
|
|
811
|
+
O("maptiler-geocoder")
|
|
812
|
+
], o);
|
|
813
|
+
const it = [
|
|
814
814
|
"adjustUrl",
|
|
815
815
|
"apiKey",
|
|
816
816
|
"apiUrl",
|
|
@@ -850,11 +850,11 @@ const tt = [
|
|
|
850
850
|
"worldview"
|
|
851
851
|
];
|
|
852
852
|
export {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
853
|
+
J as MaptilerGeocodeClearIconElement,
|
|
854
|
+
X as MaptilerGeocodeFailIconElement,
|
|
855
|
+
Y as MaptilerGeocodeLoadingIconElement,
|
|
856
|
+
ee as MaptilerGeocodeReverseGeocodingIconElement,
|
|
857
|
+
te as MaptilerGeocodeSearchIconElement,
|
|
858
|
+
o as MaptilerGeocoderElement
|
|
859
859
|
};
|
|
860
860
|
//# sourceMappingURL=index.js.map
|