@maptiler/geocoding-control 3.0.0-rc.4 → 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 +343 -341
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +41 -41
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/controls/leaflet-events.d.ts +55 -26
- package/dist/src/controls/leaflet-options.d.ts +11 -1
- package/dist/src/controls/maplibregl-events.d.ts +54 -25
- package/dist/src/controls/maplibregl-options.d.ts +12 -2
- package/dist/src/controls/maptilersdk-control.d.ts +11 -1
- package/dist/src/controls/maptilersdk-events.d.ts +72 -2
- package/dist/src/controls/openlayers-control.d.ts +4 -4
- package/dist/src/controls/openlayers-events.d.ts +55 -25
- package/dist/src/controls/openlayers-options.d.ts +11 -1
- package/dist/src/geocoder/geocoder-events.d.ts +41 -27
- package/dist/src/geocoder/geocoder-options.d.ts +1 -3
- package/dist/src/leaflet.public.d.ts +1 -1
- package/dist/src/maplibregl.d.ts +1 -1
- package/dist/src/maptilersdk.d.ts +1 -1
- package/dist/src/openlayers.public.d.ts +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/maplibregl.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { css as I, LitElement as M, svg as z, html as m, unsafeCSS as ce, nothing as X } from "lit";
|
|
2
|
-
import { customElement as O, property as p, state as
|
|
3
|
-
import { convert as
|
|
2
|
+
import { customElement as O, property as p, state as k, query as We } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ve } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as D } from "lit/directives/class-map.js";
|
|
5
|
-
import { repeat as
|
|
5
|
+
import { repeat as qe } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
|
-
import { styleMap as
|
|
8
|
-
import { featureCollection as q, polygon as
|
|
9
|
-
import
|
|
7
|
+
import { styleMap as Ne } from "lit/directives/style-map.js";
|
|
8
|
+
import { featureCollection as q, polygon as Ze, feature as Qe } from "@turf/helpers";
|
|
9
|
+
import $e from "@turf/union";
|
|
10
10
|
import he from "maplibre-gl";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
(
|
|
17
|
-
return
|
|
11
|
+
import ke from "@turf/bbox";
|
|
12
|
+
import Ke from "@turf/difference";
|
|
13
|
+
import Ye from "@turf/flatten";
|
|
14
|
+
var He = Object.getOwnPropertyDescriptor, Je = (t, e, i, a) => {
|
|
15
|
+
for (var s = a > 1 ? void 0 : a ? He(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
16
|
+
(r = t[o]) && (s = r(s) || s);
|
|
17
|
+
return s;
|
|
18
18
|
};
|
|
19
19
|
let ee = class extends M {
|
|
20
20
|
render() {
|
|
@@ -33,13 +33,13 @@ ee.styles = I`
|
|
|
33
33
|
fill: var(--color-icon-button);
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
|
-
ee =
|
|
36
|
+
ee = Je([
|
|
37
37
|
O("maptiler-geocode-clear-icon")
|
|
38
38
|
], ee);
|
|
39
|
-
var
|
|
40
|
-
for (var
|
|
41
|
-
(
|
|
42
|
-
return
|
|
39
|
+
var Xe = Object.getOwnPropertyDescriptor, et = (t, e, i, a) => {
|
|
40
|
+
for (var s = a > 1 ? void 0 : a ? Xe(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
41
|
+
(r = t[o]) && (s = r(s) || s);
|
|
42
|
+
return s;
|
|
43
43
|
};
|
|
44
44
|
let te = class extends M {
|
|
45
45
|
render() {
|
|
@@ -58,13 +58,13 @@ te.styles = I`
|
|
|
58
58
|
fill: #e15042;
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
-
te =
|
|
61
|
+
te = et([
|
|
62
62
|
O("maptiler-geocode-fail-icon")
|
|
63
63
|
], te);
|
|
64
|
-
var
|
|
65
|
-
for (var
|
|
66
|
-
(
|
|
67
|
-
return
|
|
64
|
+
var tt = Object.getOwnPropertyDescriptor, it = (t, e, i, a) => {
|
|
65
|
+
for (var s = a > 1 ? void 0 : a ? tt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
66
|
+
(r = t[o]) && (s = r(s) || s);
|
|
67
|
+
return s;
|
|
68
68
|
};
|
|
69
69
|
let ie = class extends M {
|
|
70
70
|
render() {
|
|
@@ -105,13 +105,13 @@ ie.styles = I`
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
|
-
ie =
|
|
108
|
+
ie = it([
|
|
109
109
|
O("maptiler-geocode-loading-icon")
|
|
110
110
|
], ie);
|
|
111
|
-
var
|
|
112
|
-
for (var
|
|
113
|
-
(
|
|
114
|
-
return
|
|
111
|
+
var st = Object.getOwnPropertyDescriptor, rt = (t, e, i, a) => {
|
|
112
|
+
for (var s = a > 1 ? void 0 : a ? st(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
113
|
+
(r = t[o]) && (s = r(s) || s);
|
|
114
|
+
return s;
|
|
115
115
|
};
|
|
116
116
|
let se = class extends M {
|
|
117
117
|
render() {
|
|
@@ -130,13 +130,13 @@ se.styles = I`
|
|
|
130
130
|
fill: var(--color-icon-button);
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
|
-
se =
|
|
133
|
+
se = rt([
|
|
134
134
|
O("maptiler-geocode-reverse-geocoding-icon")
|
|
135
135
|
], se);
|
|
136
|
-
var
|
|
137
|
-
for (var
|
|
138
|
-
(
|
|
139
|
-
return
|
|
136
|
+
var ot = Object.getOwnPropertyDescriptor, at = (t, e, i, a) => {
|
|
137
|
+
for (var s = a > 1 ? void 0 : a ? ot(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
138
|
+
(r = t[o]) && (s = r(s) || s);
|
|
139
|
+
return s;
|
|
140
140
|
};
|
|
141
141
|
let re = class extends M {
|
|
142
142
|
render() {
|
|
@@ -169,74 +169,74 @@ re.styles = I`
|
|
|
169
169
|
stroke: var(--color-icon-button);
|
|
170
170
|
}
|
|
171
171
|
`;
|
|
172
|
-
re =
|
|
172
|
+
re = at([
|
|
173
173
|
O("maptiler-geocode-search-icon")
|
|
174
174
|
], re);
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
return t ===
|
|
175
|
+
function lt(t, e, i) {
|
|
176
|
+
const a = e[1], s = e[0], o = a - s;
|
|
177
|
+
return t === a && i ? t : ((t - s) % o + o) % o + s;
|
|
178
178
|
}
|
|
179
179
|
function N(t) {
|
|
180
180
|
const e = [...t];
|
|
181
181
|
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
182
182
|
}
|
|
183
183
|
let U;
|
|
184
|
-
async function
|
|
185
|
-
for (const
|
|
186
|
-
if (!(t && (
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
189
|
-
if (
|
|
190
|
-
if (U &&
|
|
184
|
+
async function nt(t, e, i) {
|
|
185
|
+
for (const a of e ?? [])
|
|
186
|
+
if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
|
|
187
|
+
if (a.type === "fixed")
|
|
188
|
+
return a.coordinates.join(",");
|
|
189
|
+
if (a.type === "client-geolocation")
|
|
190
|
+
if (U && a.cachedLocationExpiry && U.time + a.cachedLocationExpiry > Date.now()) {
|
|
191
191
|
if (U.coords)
|
|
192
192
|
return U.coords;
|
|
193
193
|
} else {
|
|
194
|
-
let
|
|
194
|
+
let s;
|
|
195
195
|
try {
|
|
196
|
-
return
|
|
196
|
+
return s = await new Promise((o, r) => {
|
|
197
197
|
i.signal.addEventListener("abort", () => {
|
|
198
|
-
|
|
198
|
+
r(Error("aborted"));
|
|
199
199
|
}), navigator.geolocation.getCurrentPosition(
|
|
200
|
-
(
|
|
201
|
-
|
|
200
|
+
(u) => {
|
|
201
|
+
o([u.coords.longitude, u.coords.latitude].map((y) => y.toFixed(6)).join(","));
|
|
202
202
|
},
|
|
203
|
-
(
|
|
204
|
-
|
|
203
|
+
(u) => {
|
|
204
|
+
r(u);
|
|
205
205
|
},
|
|
206
|
-
|
|
206
|
+
a
|
|
207
207
|
);
|
|
208
|
-
}),
|
|
208
|
+
}), s;
|
|
209
209
|
} catch {
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
a.cachedLocationExpiry && (U = {
|
|
212
212
|
time: Date.now(),
|
|
213
|
-
coords:
|
|
213
|
+
coords: s
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
if (i.signal.aborted)
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
|
-
if (
|
|
219
|
+
if (a.type === "server-geolocation")
|
|
220
220
|
return "ip";
|
|
221
|
-
if (t &&
|
|
221
|
+
if (t && a.type === "map-center")
|
|
222
222
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
var
|
|
225
|
+
const ct = ".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)}}";
|
|
226
|
+
var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, Ie = (t) => {
|
|
227
227
|
throw TypeError(t);
|
|
228
|
-
},
|
|
229
|
-
for (var
|
|
230
|
-
(
|
|
231
|
-
return
|
|
232
|
-
},
|
|
233
|
-
const
|
|
234
|
-
let
|
|
228
|
+
}, L = (t, e, i, a) => {
|
|
229
|
+
for (var s = a > 1 ? void 0 : a ? pt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
230
|
+
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
231
|
+
return a && s && ht(e, i, s), s;
|
|
232
|
+
}, Me = (t, e, i) => e.has(t) || Ie("Cannot " + i), f = (t, e, i) => (Me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), dt = (t, e, i) => e.has(t) ? Ie("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Me(t, e, "access private method"), i), d, Z, B, g, Oe, Te, pe, oe;
|
|
233
|
+
const Fe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Fe ? "@2x" : "", S = Fe ? 2 : 1;
|
|
234
|
+
let F, Ce, w = class extends M {
|
|
235
235
|
constructor() {
|
|
236
|
-
super(...arguments),
|
|
236
|
+
super(...arguments), dt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
237
237
|
}
|
|
238
238
|
willUpdate(t) {
|
|
239
|
-
t.has("feature") &&
|
|
239
|
+
t.has("feature") && f(this, d, Z) && (this.index = f(this, d, Z).length, E(this, d, pe).call(this));
|
|
240
240
|
}
|
|
241
241
|
render() {
|
|
242
242
|
return m`
|
|
@@ -248,28 +248,28 @@ let T, Fe, k = class extends M {
|
|
|
248
248
|
class=${this.itemStyle}
|
|
249
249
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
250
250
|
>
|
|
251
|
-
${
|
|
251
|
+
${F && this.spriteIcon ? m`
|
|
252
252
|
<div
|
|
253
253
|
class="sprite-icon"
|
|
254
|
-
style=${
|
|
255
|
-
width: `${this.spriteIcon.width /
|
|
256
|
-
height: `${this.spriteIcon.height /
|
|
254
|
+
style=${Ne({
|
|
255
|
+
width: `${this.spriteIcon.width / S}px`,
|
|
256
|
+
height: `${this.spriteIcon.height / S}px`,
|
|
257
257
|
backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
|
|
258
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
259
|
-
backgroundSize: `${
|
|
258
|
+
backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
|
|
259
|
+
backgroundSize: `${F.width / S}px ${F.height / S}px`
|
|
260
260
|
})}
|
|
261
|
-
title=${
|
|
261
|
+
title=${f(this, d, g)}
|
|
262
262
|
/>
|
|
263
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${
|
|
263
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${E(this, d, Te)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : f(this, d, B) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> `}
|
|
264
264
|
|
|
265
265
|
<span class="texts">
|
|
266
266
|
<span>
|
|
267
|
-
<span class="primary"> ${
|
|
267
|
+
<span class="primary"> ${f(this, d, B) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
268
268
|
|
|
269
|
-
${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) && !
|
|
269
|
+
${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) && !f(this, d, B) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : X}
|
|
270
270
|
</span>
|
|
271
271
|
|
|
272
|
-
<span class="line2"> ${
|
|
272
|
+
<span class="line2"> ${f(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
273
273
|
</span>
|
|
274
274
|
</li>
|
|
275
275
|
`;
|
|
@@ -285,69 +285,69 @@ B = function() {
|
|
|
285
285
|
g = function() {
|
|
286
286
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
287
287
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
Oe = function() {
|
|
289
|
+
Ce ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
|
|
290
|
+
F = t;
|
|
291
291
|
}).catch(() => {
|
|
292
|
-
|
|
292
|
+
F = null;
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
|
-
|
|
295
|
+
Te = function() {
|
|
296
296
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
|
|
297
297
|
};
|
|
298
298
|
pe = function() {
|
|
299
|
-
|
|
299
|
+
F !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Oe).call(this), Ce?.then(() => {
|
|
300
300
|
E(this, d, oe).call(this);
|
|
301
301
|
}));
|
|
302
302
|
};
|
|
303
303
|
oe = function() {
|
|
304
304
|
do {
|
|
305
|
-
if (this.index--, this.category =
|
|
305
|
+
if (this.index--, this.category = f(this, d, Z)?.[this.index], this.spriteIcon = this.category ? F?.icons[this.category] : void 0, this.spriteIcon)
|
|
306
306
|
break;
|
|
307
307
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
308
308
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
309
309
|
};
|
|
310
|
-
|
|
311
|
-
${ce(
|
|
310
|
+
w.styles = I`
|
|
311
|
+
${ce(ct)}
|
|
312
312
|
`;
|
|
313
|
-
|
|
313
|
+
L([
|
|
314
314
|
p({ type: Object })
|
|
315
|
-
],
|
|
316
|
-
|
|
315
|
+
], w.prototype, "feature", 2);
|
|
316
|
+
L([
|
|
317
317
|
p({ type: String })
|
|
318
|
-
],
|
|
319
|
-
|
|
318
|
+
], w.prototype, "itemStyle", 2);
|
|
319
|
+
L([
|
|
320
320
|
p({ type: String })
|
|
321
|
-
],
|
|
322
|
-
|
|
321
|
+
], w.prototype, "showPlaceType", 2);
|
|
322
|
+
L([
|
|
323
323
|
p({ attribute: !1 })
|
|
324
|
-
],
|
|
325
|
-
|
|
324
|
+
], w.prototype, "missingIconsCache", 2);
|
|
325
|
+
L([
|
|
326
326
|
p({ type: String })
|
|
327
|
-
],
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
],
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
],
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
],
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
],
|
|
340
|
-
|
|
327
|
+
], w.prototype, "iconsBaseUrl", 2);
|
|
328
|
+
L([
|
|
329
|
+
k()
|
|
330
|
+
], w.prototype, "category", 2);
|
|
331
|
+
L([
|
|
332
|
+
k()
|
|
333
|
+
], w.prototype, "imageUrl", 2);
|
|
334
|
+
L([
|
|
335
|
+
k()
|
|
336
|
+
], w.prototype, "spriteIcon", 2);
|
|
337
|
+
L([
|
|
338
|
+
k()
|
|
339
|
+
], w.prototype, "index", 2);
|
|
340
|
+
w = L([
|
|
341
341
|
O("maptiler-geocoder-feature-item")
|
|
342
|
-
],
|
|
343
|
-
const
|
|
344
|
-
var
|
|
342
|
+
], w);
|
|
343
|
+
const ut = "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}";
|
|
344
|
+
var ft = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, Ee = (t) => {
|
|
345
345
|
throw TypeError(t);
|
|
346
|
-
}, c = (t, e, i,
|
|
347
|
-
for (var
|
|
348
|
-
(
|
|
349
|
-
return
|
|
350
|
-
}, de = (t, e, i) => e.has(t) ||
|
|
346
|
+
}, c = (t, e, i, a) => {
|
|
347
|
+
for (var s = a > 1 ? void 0 : a ? mt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
348
|
+
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
349
|
+
return a && s && ft(e, i, s), s;
|
|
350
|
+
}, de = (t, e, i) => e.has(t) || Ee("Cannot " + i), b = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), C = (t, e, i) => e.has(t) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, a) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), Q, V, G, ae, R, l, K, Pe, Ue, ue, x, fe, Y, me, ge, $, ye, H, Be, le, Ge, Re, ze, je, De;
|
|
351
351
|
let n = class extends M {
|
|
352
352
|
constructor() {
|
|
353
353
|
super(...arguments), C(this, l), 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, Q, !1), C(this, V, !1), C(this, G), C(this, ae, /* @__PURE__ */ new Set()), C(this, R);
|
|
@@ -363,7 +363,7 @@ let n = class extends M {
|
|
|
363
363
|
setOptions(t) {
|
|
364
364
|
const e = { ...t };
|
|
365
365
|
for (const i of Object.keys(e))
|
|
366
|
-
|
|
366
|
+
gt.includes(i) || delete e[i];
|
|
367
367
|
Object.assign(this, e);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
@@ -372,7 +372,7 @@ let n = class extends M {
|
|
|
372
372
|
* @param value text to set
|
|
373
373
|
*/
|
|
374
374
|
setQuery(t) {
|
|
375
|
-
h(this, l, ge).call(this, t), h(this, l, me).call(this);
|
|
375
|
+
h(this, l, ge).call(this, t, { external: !0 }), h(this, l, me).call(this);
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
378
|
* Set the content of search input box and immediately submit it.
|
|
@@ -414,19 +414,19 @@ let n = class extends M {
|
|
|
414
414
|
}
|
|
415
415
|
/** @internal */
|
|
416
416
|
handleMapClick(t) {
|
|
417
|
-
this.reverseActive && h(this, l,
|
|
417
|
+
this.reverseActive && h(this, l, Be).call(this, t);
|
|
418
418
|
}
|
|
419
419
|
willUpdate(t) {
|
|
420
|
-
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) &&
|
|
420
|
+
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && b(this, l, ue) && (h(this, l, $).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
|
|
421
421
|
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
422
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, l,
|
|
422
|
+
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, l, x).call(this, "select", { feature: b(this, l, K) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, l, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
423
423
|
() => {
|
|
424
|
-
h(this, l,
|
|
424
|
+
h(this, l, x).call(this, "pick", { feature: this.picked });
|
|
425
425
|
},
|
|
426
426
|
(e) => {
|
|
427
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l,
|
|
427
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, x).call(this, "pick", { feature: this.picked }));
|
|
428
428
|
}
|
|
429
|
-
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (
|
|
429
|
+
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (b(this, l, Pe) ? (h(this, l, x).call(this, "featuresshow"), W(this, V, !0)) : b(this, V) && h(this, l, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, x).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
430
430
|
}
|
|
431
431
|
render() {
|
|
432
432
|
return m`
|
|
@@ -448,15 +448,15 @@ let n = class extends M {
|
|
|
448
448
|
@blur=${() => this.focused = !1}
|
|
449
449
|
@click=${() => this.focused = !0}
|
|
450
450
|
@keydown=${h(this, l, le)}
|
|
451
|
-
@input=${h(this, l,
|
|
451
|
+
@input=${h(this, l, Ge)}
|
|
452
452
|
@change=${() => this.picked = void 0}
|
|
453
453
|
placeholder=${this.placeholder ?? "Search"}
|
|
454
454
|
aria-label=${this.placeholder ?? "Search"}
|
|
455
455
|
/>
|
|
456
456
|
|
|
457
457
|
<div class="clear-button-container ${D({ displayable: this.searchValue !== "" })}">
|
|
458
|
-
${
|
|
459
|
-
<button type="button" @click=${h(this, l,
|
|
458
|
+
${b(this, l, Ue) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
|
|
459
|
+
<button type="button" @click=${h(this, l, De)} title=${this.clearButtonTitle ?? "clear"}>
|
|
460
460
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
461
461
|
</button>
|
|
462
462
|
`}
|
|
@@ -495,8 +495,8 @@ let n = class extends M {
|
|
|
495
495
|
</div>
|
|
496
496
|
</div>
|
|
497
497
|
` : m`
|
|
498
|
-
<ul class="options ${D({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l,
|
|
499
|
-
${
|
|
498
|
+
<ul class="options ${D({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l, je)} @keydown=${h(this, l, le)} role="listbox">
|
|
499
|
+
${qe(
|
|
500
500
|
this.listFeatures,
|
|
501
501
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
502
502
|
(t, e) => m`
|
|
@@ -505,13 +505,13 @@ let n = class extends M {
|
|
|
505
505
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
506
506
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
507
507
|
@mouseenter=${() => {
|
|
508
|
-
h(this, l,
|
|
508
|
+
h(this, l, ze).call(this, e);
|
|
509
509
|
}}
|
|
510
510
|
@select=${() => {
|
|
511
|
-
h(this, l,
|
|
511
|
+
h(this, l, Re).call(this, t);
|
|
512
512
|
}}
|
|
513
|
-
.missingIconsCache=${
|
|
514
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
513
|
+
.missingIconsCache=${b(this, ae)}
|
|
514
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
|
|
515
515
|
>
|
|
516
516
|
${t.place_name}
|
|
517
517
|
</maptiler-geocoder-feature-item>
|
|
@@ -532,17 +532,17 @@ l = /* @__PURE__ */ new WeakSet();
|
|
|
532
532
|
K = function() {
|
|
533
533
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
534
534
|
};
|
|
535
|
-
|
|
535
|
+
Pe = function() {
|
|
536
536
|
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
537
537
|
};
|
|
538
|
-
|
|
538
|
+
Ue = function() {
|
|
539
539
|
return this.abortController !== void 0;
|
|
540
540
|
};
|
|
541
541
|
ue = function() {
|
|
542
542
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
543
543
|
};
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
x = function(t, ...[e]) {
|
|
545
|
+
b(this, Q) && this.dispatchEvent(
|
|
546
546
|
new CustomEvent(t, {
|
|
547
547
|
bubbles: !0,
|
|
548
548
|
composed: !0,
|
|
@@ -551,13 +551,13 @@ v = function(t, ...[e]) {
|
|
|
551
551
|
);
|
|
552
552
|
};
|
|
553
553
|
fe = function(t) {
|
|
554
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
554
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(b(this, G)), 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 && h(this, l, H).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
|
|
555
555
|
this.picked = void 0;
|
|
556
556
|
}).catch((e) => this.error = e);
|
|
557
557
|
};
|
|
558
558
|
Y = function(t) {
|
|
559
559
|
try {
|
|
560
|
-
return
|
|
560
|
+
return Ve(t, 6);
|
|
561
561
|
} catch {
|
|
562
562
|
return !1;
|
|
563
563
|
}
|
|
@@ -567,87 +567,87 @@ me = function() {
|
|
|
567
567
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
568
568
|
});
|
|
569
569
|
};
|
|
570
|
-
ge = function(t) {
|
|
571
|
-
if (this.searchValue = t, h(this, l,
|
|
572
|
-
if (clearTimeout(
|
|
570
|
+
ge = function(t, { external: e = !1 } = {}) {
|
|
571
|
+
if (this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
572
|
+
if (clearTimeout(b(this, G)), b(this, l, ue))
|
|
573
573
|
return;
|
|
574
|
-
const
|
|
574
|
+
const i = this.searchValue;
|
|
575
575
|
W(this, G, window.setTimeout(() => {
|
|
576
|
-
h(this, l, H).call(this, e).catch((
|
|
576
|
+
h(this, l, H).call(this, i, { external: e }).catch((a) => this.error = a);
|
|
577
577
|
}, this.debounceSearch ?? 200));
|
|
578
578
|
} else
|
|
579
579
|
h(this, l, $).call(this);
|
|
580
580
|
};
|
|
581
581
|
$ = function() {
|
|
582
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l,
|
|
582
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, x).call(this, "featuresclear"));
|
|
583
583
|
};
|
|
584
584
|
ye = function(t) {
|
|
585
|
-
this.searchValue = t, h(this, l,
|
|
585
|
+
this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, l, fe).call(this);
|
|
586
586
|
};
|
|
587
|
-
H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
587
|
+
H = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
588
588
|
this.error = void 0, this.abortController?.abort();
|
|
589
|
-
const
|
|
590
|
-
this.abortController =
|
|
589
|
+
const s = new AbortController();
|
|
590
|
+
this.abortController = s;
|
|
591
591
|
try {
|
|
592
|
-
const
|
|
593
|
-
this.language !== void 0 &&
|
|
594
|
-
const [
|
|
595
|
-
let
|
|
596
|
-
(
|
|
597
|
-
).filter((
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
601
|
-
const
|
|
602
|
-
|
|
592
|
+
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, Y).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
593
|
+
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
594
|
+
const [T] = b(this, R) ?? [void 0];
|
|
595
|
+
let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
596
|
+
(v) => typeof v == "string" ? v : T === void 0 || (v[0] ?? 0) <= T && T < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
597
|
+
).filter((v) => v !== void 0);
|
|
598
|
+
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
599
|
+
const ve = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
600
|
+
if (ve && y.set("excludeTypes", String(ve)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !r) {
|
|
601
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], be = await nt(b(this, R), v, s);
|
|
602
|
+
be && y.set("proximity", be), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
603
603
|
}
|
|
604
|
-
const
|
|
605
|
-
J > 1 &&
|
|
606
|
-
const
|
|
604
|
+
const xe = this.limit ?? 5, J = this.reverseGeocodingLimit ?? xe;
|
|
605
|
+
J > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (J === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(J)) : y.set("limit", String(xe)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
606
|
+
const Ae = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
|
|
607
607
|
if (j === this.lastSearchUrl) {
|
|
608
|
-
e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l,
|
|
608
|
+
e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.listFeatures[this.selectedItemIndex]?.id !== b(this, l, K)?.id && (this.selectedItemIndex = -1));
|
|
609
609
|
return;
|
|
610
610
|
}
|
|
611
|
-
h(this, l,
|
|
611
|
+
h(this, l, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
|
|
612
612
|
let P;
|
|
613
|
-
if (
|
|
613
|
+
if (Ae)
|
|
614
614
|
P = { type: "FeatureCollection", features: [] };
|
|
615
615
|
else {
|
|
616
|
-
const
|
|
617
|
-
signal:
|
|
616
|
+
const v = await fetch(j, {
|
|
617
|
+
signal: s.signal,
|
|
618
618
|
...this.fetchParameters
|
|
619
619
|
});
|
|
620
|
-
if (!
|
|
621
|
-
throw new Error(await
|
|
622
|
-
P = await
|
|
620
|
+
if (!v.ok)
|
|
621
|
+
throw new Error(await v.text());
|
|
622
|
+
P = await v.json();
|
|
623
623
|
}
|
|
624
|
-
h(this, l,
|
|
624
|
+
h(this, l, x).call(this, "response", { url: j, featureCollection: P }), e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
|
|
625
625
|
type: "Feature",
|
|
626
626
|
properties: {},
|
|
627
627
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
628
|
-
id: `reverse_${
|
|
629
|
-
text: `${
|
|
630
|
-
place_name:
|
|
628
|
+
id: `reverse_${r.decimalLongitude}_${r.decimalLatitude}`,
|
|
629
|
+
text: `${r.decimalLatitude}, ${r.decimalLongitude}`,
|
|
630
|
+
place_name: r.toCoordinateFormat("DMS"),
|
|
631
631
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
632
632
|
place_type: ["reverse"],
|
|
633
633
|
place_type_name: ["reverse"],
|
|
634
|
-
center: [
|
|
635
|
-
bbox: [
|
|
634
|
+
center: [r.decimalLongitude, r.decimalLatitude],
|
|
635
|
+
bbox: [r.decimalLongitude, r.decimalLatitude, r.decimalLongitude, r.decimalLatitude],
|
|
636
636
|
geometry: {
|
|
637
637
|
type: "Point",
|
|
638
|
-
coordinates: [
|
|
638
|
+
coordinates: [r.decimalLongitude, r.decimalLatitude]
|
|
639
639
|
}
|
|
640
|
-
}), h(this, l,
|
|
641
|
-
} catch (
|
|
642
|
-
if (
|
|
640
|
+
}), h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, l, K)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
|
|
641
|
+
} catch (o) {
|
|
642
|
+
if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
|
|
643
643
|
return;
|
|
644
|
-
throw
|
|
644
|
+
throw o;
|
|
645
645
|
} finally {
|
|
646
|
-
|
|
646
|
+
s === this.abortController && (this.abortController = void 0);
|
|
647
647
|
}
|
|
648
648
|
};
|
|
649
|
-
|
|
650
|
-
this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ye).call(this, `${t[1].toFixed(6)}, ${
|
|
649
|
+
Be = function(t) {
|
|
650
|
+
this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ye).call(this, `${t[1].toFixed(6)}, ${lt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, me).call(this);
|
|
651
651
|
};
|
|
652
652
|
le = function(t) {
|
|
653
653
|
if (!this.listFeatures)
|
|
@@ -655,23 +655,23 @@ le = function(t) {
|
|
|
655
655
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
656
656
|
e && (this.input.focus(), this.focused = !0, t.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) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
|
|
657
657
|
};
|
|
658
|
-
|
|
658
|
+
Ge = function(t) {
|
|
659
659
|
h(this, l, ge).call(this, t.target.value);
|
|
660
660
|
};
|
|
661
|
-
|
|
661
|
+
Re = function(t) {
|
|
662
662
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
663
663
|
};
|
|
664
|
-
|
|
664
|
+
ze = function(t) {
|
|
665
665
|
this.selectedItemIndex = t;
|
|
666
666
|
};
|
|
667
|
-
|
|
667
|
+
je = function() {
|
|
668
668
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
|
|
669
669
|
};
|
|
670
|
-
|
|
671
|
-
this.searchValue = "", h(this, l,
|
|
670
|
+
De = function() {
|
|
671
|
+
this.searchValue = "", h(this, l, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
672
672
|
};
|
|
673
673
|
n.styles = I`
|
|
674
|
-
${ce(
|
|
674
|
+
${ce(ut)}
|
|
675
675
|
`;
|
|
676
676
|
c([
|
|
677
677
|
p({ attribute: !1 })
|
|
@@ -785,42 +785,42 @@ c([
|
|
|
785
785
|
p({ type: String })
|
|
786
786
|
], n.prototype, "worldview", 2);
|
|
787
787
|
c([
|
|
788
|
-
|
|
788
|
+
We("input")
|
|
789
789
|
], n.prototype, "input", 2);
|
|
790
790
|
c([
|
|
791
|
-
|
|
791
|
+
k()
|
|
792
792
|
], n.prototype, "searchValue", 2);
|
|
793
793
|
c([
|
|
794
|
-
|
|
794
|
+
k()
|
|
795
795
|
], n.prototype, "listFeatures", 2);
|
|
796
796
|
c([
|
|
797
|
-
|
|
797
|
+
k()
|
|
798
798
|
], n.prototype, "selectedItemIndex", 2);
|
|
799
799
|
c([
|
|
800
|
-
|
|
800
|
+
k()
|
|
801
801
|
], n.prototype, "picked", 2);
|
|
802
802
|
c([
|
|
803
|
-
|
|
803
|
+
k()
|
|
804
804
|
], n.prototype, "cachedFeatures", 2);
|
|
805
805
|
c([
|
|
806
|
-
|
|
806
|
+
k()
|
|
807
807
|
], n.prototype, "lastSearchUrl", 2);
|
|
808
808
|
c([
|
|
809
|
-
|
|
809
|
+
k()
|
|
810
810
|
], n.prototype, "error", 2);
|
|
811
811
|
c([
|
|
812
|
-
|
|
812
|
+
k()
|
|
813
813
|
], n.prototype, "abortController", 2);
|
|
814
814
|
c([
|
|
815
|
-
|
|
815
|
+
k()
|
|
816
816
|
], n.prototype, "focused", 2);
|
|
817
817
|
c([
|
|
818
|
-
|
|
818
|
+
k()
|
|
819
819
|
], n.prototype, "focusedDelayed", 2);
|
|
820
820
|
n = c([
|
|
821
821
|
O("maptiler-geocoder")
|
|
822
822
|
], n);
|
|
823
|
-
const
|
|
823
|
+
const gt = [
|
|
824
824
|
"adjustUrl",
|
|
825
825
|
"apiKey",
|
|
826
826
|
"apiUrl",
|
|
@@ -858,11 +858,11 @@ const mt = [
|
|
|
858
858
|
"types",
|
|
859
859
|
"reverseGeocodingTypes",
|
|
860
860
|
"worldview"
|
|
861
|
-
],
|
|
862
|
-
var
|
|
863
|
-
for (var
|
|
864
|
-
(
|
|
865
|
-
return
|
|
861
|
+
], yt = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
|
|
862
|
+
var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
|
|
863
|
+
for (var s = a > 1 ? void 0 : a ? vt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
864
|
+
(r = t[o]) && (s = r(s) || s);
|
|
865
|
+
return s;
|
|
866
866
|
};
|
|
867
867
|
let ne = class extends M {
|
|
868
868
|
render() {
|
|
@@ -881,15 +881,15 @@ let ne = class extends M {
|
|
|
881
881
|
}
|
|
882
882
|
};
|
|
883
883
|
ne.styles = I`
|
|
884
|
-
${ce(
|
|
884
|
+
${ce(yt)}
|
|
885
885
|
`;
|
|
886
|
-
ne =
|
|
886
|
+
ne = xt([
|
|
887
887
|
O("maptiler-geocode-marker")
|
|
888
888
|
], ne);
|
|
889
|
-
function
|
|
890
|
-
const e =
|
|
889
|
+
function we(t) {
|
|
890
|
+
const e = Ke(
|
|
891
891
|
q([
|
|
892
|
-
|
|
892
|
+
Ze([
|
|
893
893
|
[
|
|
894
894
|
[180, 90],
|
|
895
895
|
[-180, 90],
|
|
@@ -904,22 +904,22 @@ function ke(t) {
|
|
|
904
904
|
if (!e)
|
|
905
905
|
return;
|
|
906
906
|
e.properties = { isMask: !0 };
|
|
907
|
-
const i = N(
|
|
908
|
-
if (
|
|
909
|
-
for (const
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
for (const
|
|
913
|
-
for (const
|
|
914
|
-
|
|
915
|
-
if (
|
|
916
|
-
for (const
|
|
917
|
-
for (const
|
|
918
|
-
|
|
907
|
+
const i = N(ke(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = Ye(t);
|
|
908
|
+
if (r.features.length > 1 && (s || o))
|
|
909
|
+
for (const u of r.features) {
|
|
910
|
+
const y = N(ke(u));
|
|
911
|
+
if (o && y[0] < -180 + a)
|
|
912
|
+
for (const T of u.geometry.coordinates)
|
|
913
|
+
for (const _ of T)
|
|
914
|
+
_[0] += 360 - a;
|
|
915
|
+
if (s && y[2] > 180 - a)
|
|
916
|
+
for (const T of u.geometry.coordinates)
|
|
917
|
+
for (const _ of T)
|
|
918
|
+
_[0] -= 360 - a;
|
|
919
919
|
}
|
|
920
|
-
return q([
|
|
920
|
+
return q([r.features.length < 2 ? t : $e(r) ?? t, e]);
|
|
921
921
|
}
|
|
922
|
-
const
|
|
922
|
+
const bt = {
|
|
923
923
|
continental_marine: 4,
|
|
924
924
|
country: 4,
|
|
925
925
|
major_landform: 8,
|
|
@@ -943,7 +943,7 @@ const xt = {
|
|
|
943
943
|
"poi.restaurant": 18,
|
|
944
944
|
"poi.aerodrome": 13
|
|
945
945
|
// TODO add many more
|
|
946
|
-
},
|
|
946
|
+
}, kt = {
|
|
947
947
|
fill: {
|
|
948
948
|
paint: {
|
|
949
949
|
"fill-color": "#000",
|
|
@@ -962,8 +962,8 @@ const xt = {
|
|
|
962
962
|
},
|
|
963
963
|
filter: ["!", ["has", "isMask"]]
|
|
964
964
|
}
|
|
965
|
-
}, A = "mtlr-gc-full-geom",
|
|
966
|
-
class
|
|
965
|
+
}, A = "mtlr-gc-full-geom", _e = "mtlr-gc-full-geom-fill", Le = "mtlr-gc-full-geom-line", wt = he.Evented, _t = he.Marker, Lt = he.Popup;
|
|
966
|
+
class Rt extends wt {
|
|
967
967
|
#e = {};
|
|
968
968
|
#t;
|
|
969
969
|
#i;
|
|
@@ -1053,7 +1053,7 @@ class Gt extends kt {
|
|
|
1053
1053
|
},
|
|
1054
1054
|
featureslisted: (e) => {
|
|
1055
1055
|
const i = e.detail.features;
|
|
1056
|
-
this.#o = i, this.#p(this.#o, void 0), this.#$(
|
|
1056
|
+
this.#o = i, this.#p(this.#o, void 0), this.#$(e), this.#s("featureslisted", e.detail);
|
|
1057
1057
|
},
|
|
1058
1058
|
featuresclear: () => {
|
|
1059
1059
|
this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
|
|
@@ -1104,22 +1104,23 @@ class Gt extends kt {
|
|
|
1104
1104
|
#L(e) {
|
|
1105
1105
|
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(N(e.bbox), 50, this.#h(e));
|
|
1106
1106
|
}
|
|
1107
|
-
#$(e) {
|
|
1108
|
-
if (!e || e.length === 0 || !this.#d)
|
|
1109
|
-
|
|
1110
|
-
|
|
1107
|
+
#$({ detail: { features: e, external: i } }) {
|
|
1108
|
+
if (!e || e.length === 0 || !this.#d || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
|
|
1109
|
+
return;
|
|
1110
|
+
const a = e.every((r) => r.matching_text), s = e.reduce(
|
|
1111
|
+
(r, u) => a || !u.matching_text ? [Math.min(r[0], u.bbox[0]), Math.min(r[1], u.bbox[1]), Math.max(r[2], u.bbox[2]), Math.max(r[3], u.bbox[3])] : r,
|
|
1111
1112
|
[180, 90, -180, -90]
|
|
1112
|
-
),
|
|
1113
|
-
this.#b(N(
|
|
1113
|
+
), o = e.map((r) => this.#h(r)).filter((r) => r !== void 0).reduce((r, u) => r === void 0 ? u : Math.max(r, u), void 0);
|
|
1114
|
+
this.#b(N(s), 50, o);
|
|
1114
1115
|
}
|
|
1115
1116
|
#h(e) {
|
|
1116
1117
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1117
1118
|
return;
|
|
1118
|
-
const i = e.id.replace(/\..*/, ""),
|
|
1119
|
-
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((
|
|
1120
|
-
const
|
|
1121
|
-
return
|
|
1122
|
-
}, void 0) : void 0) ??
|
|
1119
|
+
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? bt;
|
|
1120
|
+
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
|
|
1121
|
+
const r = a[i + "." + o];
|
|
1122
|
+
return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
|
|
1123
|
+
}, void 0) : void 0) ?? a[i];
|
|
1123
1124
|
}
|
|
1124
1125
|
get #d() {
|
|
1125
1126
|
return !!this.#e.flyTo || this.#e.flyTo === void 0;
|
|
@@ -1133,13 +1134,13 @@ class Gt extends kt {
|
|
|
1133
1134
|
#x(e, i) {
|
|
1134
1135
|
this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#I });
|
|
1135
1136
|
}
|
|
1136
|
-
#b(e, i,
|
|
1137
|
+
#b(e, i, a) {
|
|
1137
1138
|
this.#t?.fitBounds(
|
|
1138
1139
|
[
|
|
1139
1140
|
[e[0], e[1]],
|
|
1140
1141
|
[e[2], e[3]]
|
|
1141
1142
|
],
|
|
1142
|
-
{ padding: i, ...
|
|
1143
|
+
{ padding: i, ...a ? { maxZoom: a } : {}, ...this.#M }
|
|
1143
1144
|
);
|
|
1144
1145
|
}
|
|
1145
1146
|
#k(e) {
|
|
@@ -1154,62 +1155,62 @@ class Gt extends kt {
|
|
|
1154
1155
|
#p(e, i) {
|
|
1155
1156
|
if (!this.#t)
|
|
1156
1157
|
return;
|
|
1157
|
-
for (const
|
|
1158
|
-
|
|
1158
|
+
for (const s of this.#l.values())
|
|
1159
|
+
s.remove();
|
|
1159
1160
|
this.#l = /* @__PURE__ */ new Map(), this.#n(void 0);
|
|
1160
|
-
const
|
|
1161
|
+
const a = () => {
|
|
1161
1162
|
if (!i || !this.#t || this.#e.marker === !1 || this.#e.marker === null) return;
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1163
|
+
const s = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
|
|
1164
|
+
s && this.#l.set(i, s);
|
|
1164
1165
|
};
|
|
1165
1166
|
if (i?.geometry.type === "GeometryCollection") {
|
|
1166
|
-
const
|
|
1167
|
-
(
|
|
1167
|
+
const s = i.geometry.geometries.filter(
|
|
1168
|
+
(o) => o.type === "Polygon" || o.type === "MultiPolygon"
|
|
1168
1169
|
);
|
|
1169
|
-
if (
|
|
1170
|
-
const
|
|
1171
|
-
if (
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1170
|
+
if (s.length > 0) {
|
|
1171
|
+
const o = $e(q(s.map((r) => Qe(r))));
|
|
1172
|
+
if (o) {
|
|
1173
|
+
const r = we({ ...i, geometry: o.geometry });
|
|
1174
|
+
r && this.#n(r);
|
|
1174
1175
|
}
|
|
1175
1176
|
} else {
|
|
1176
|
-
const
|
|
1177
|
-
(
|
|
1177
|
+
const o = i.geometry.geometries.filter(
|
|
1178
|
+
(r) => r.type === "LineString" || r.type === "MultiLineString"
|
|
1178
1179
|
);
|
|
1179
|
-
|
|
1180
|
+
o.length > 0 && this.#n({
|
|
1180
1181
|
...i,
|
|
1181
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1182
|
+
geometry: { type: "GeometryCollection", geometries: o }
|
|
1182
1183
|
});
|
|
1183
1184
|
}
|
|
1184
1185
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
} else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") &&
|
|
1186
|
+
const s = we(i);
|
|
1187
|
+
s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
|
|
1188
|
+
} else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
|
|
1188
1189
|
if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
|
|
1189
|
-
for (const
|
|
1190
|
-
if (
|
|
1190
|
+
for (const s of e ?? []) {
|
|
1191
|
+
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
1191
1192
|
continue;
|
|
1192
|
-
let
|
|
1193
|
+
let o;
|
|
1193
1194
|
if (this.#e.showResultMarkers instanceof Function) {
|
|
1194
|
-
if (
|
|
1195
|
+
if (o = this.#e.showResultMarkers(this.#t, s), !o)
|
|
1195
1196
|
continue;
|
|
1196
1197
|
} else
|
|
1197
|
-
|
|
1198
|
-
new
|
|
1198
|
+
o = this.#f(this.#e.showResultMarkers).setLngLat(s.center).setPopup(
|
|
1199
|
+
new Lt({
|
|
1199
1200
|
offset: [1, -27],
|
|
1200
1201
|
closeButton: !1,
|
|
1201
1202
|
closeOnMove: !0,
|
|
1202
1203
|
className: "maptiler-gc-popup"
|
|
1203
|
-
}).setText(
|
|
1204
|
-
).addTo(this.#t),
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
}),
|
|
1209
|
-
this.#s("markermouseenter", { feature:
|
|
1210
|
-
}),
|
|
1211
|
-
this.#s("markermouseleave", { feature:
|
|
1212
|
-
}),
|
|
1204
|
+
}).setText(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
|
|
1205
|
+
).addTo(this.#t), o.getElement().classList.add("marker-interactive");
|
|
1206
|
+
const r = o.getElement();
|
|
1207
|
+
r.addEventListener("click", (u) => {
|
|
1208
|
+
u.stopPropagation(), this.#s("markerclick", { feature: s, marker: o });
|
|
1209
|
+
}), r.addEventListener("mouseenter", () => {
|
|
1210
|
+
this.#s("markermouseenter", { feature: s, marker: o }), o.togglePopup();
|
|
1211
|
+
}), r.addEventListener("mouseleave", () => {
|
|
1212
|
+
this.#s("markermouseleave", { feature: s, marker: o }), o.togglePopup();
|
|
1213
|
+
}), r.classList.toggle("marker-fuzzy", !!s.matching_text), this.#l.set(s, o);
|
|
1213
1214
|
}
|
|
1214
1215
|
}
|
|
1215
1216
|
#O(e) {
|
|
@@ -1226,14 +1227,14 @@ class Gt extends kt {
|
|
|
1226
1227
|
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(A, {
|
|
1227
1228
|
type: "geojson",
|
|
1228
1229
|
data: this.#a
|
|
1229
|
-
}), !this.#t.getLayer(
|
|
1230
|
+
}), !this.#t.getLayer(_e) && e.fill && this.#t.addLayer({
|
|
1230
1231
|
...e.fill,
|
|
1231
|
-
id:
|
|
1232
|
+
id: _e,
|
|
1232
1233
|
type: "fill",
|
|
1233
1234
|
source: A
|
|
1234
|
-
}), !this.#t.getLayer(
|
|
1235
|
+
}), !this.#t.getLayer(Le) && e.line && this.#t.addLayer({
|
|
1235
1236
|
...e.line,
|
|
1236
|
-
id:
|
|
1237
|
+
id: Le,
|
|
1237
1238
|
type: "line",
|
|
1238
1239
|
source: A
|
|
1239
1240
|
}));
|
|
@@ -1242,19 +1243,19 @@ class Gt extends kt {
|
|
|
1242
1243
|
this.#a = e, this.#u();
|
|
1243
1244
|
}
|
|
1244
1245
|
#f(e) {
|
|
1245
|
-
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new
|
|
1246
|
+
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new _t(e);
|
|
1246
1247
|
}
|
|
1247
1248
|
#T() {
|
|
1248
1249
|
const { fullGeometryStyle: e } = this.#e;
|
|
1249
|
-
if (e === !0 || e === void 0) return
|
|
1250
|
+
if (e === !0 || e === void 0) return kt;
|
|
1250
1251
|
if (!(e === !1 || e === null))
|
|
1251
1252
|
return e;
|
|
1252
1253
|
}
|
|
1253
1254
|
}
|
|
1254
1255
|
export {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
kt as DEFAULT_GEOMETRY_STYLE,
|
|
1257
|
+
Rt as GeocodingControl,
|
|
1258
|
+
Rt as MaplibreglGeocodingControl,
|
|
1258
1259
|
ee as MaptilerGeocodeClearIconElement,
|
|
1259
1260
|
te as MaptilerGeocodeFailIconElement,
|
|
1260
1261
|
ie as MaptilerGeocodeLoadingIconElement,
|
|
@@ -1262,9 +1263,9 @@ export {
|
|
|
1262
1263
|
se as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1263
1264
|
re as MaptilerGeocodeSearchIconElement,
|
|
1264
1265
|
n as MaptilerGeocoderElement,
|
|
1265
|
-
|
|
1266
|
-
|
|
1266
|
+
_e as RESULT_LAYER_FILL,
|
|
1267
|
+
Le as RESULT_LAYER_LINE,
|
|
1267
1268
|
A as RESULT_SOURCE,
|
|
1268
|
-
|
|
1269
|
+
bt as ZOOM_DEFAULTS
|
|
1269
1270
|
};
|
|
1270
1271
|
//# sourceMappingURL=maplibregl.js.map
|