@maptiler/geocoding-control 3.0.0-rc.3 → 3.0.0-rc.5
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/README.md +0 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +9 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +25 -22
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +6 -6
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +40 -45
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +23 -23
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +143 -122
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +45 -45
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +135 -131
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +28 -28
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/controls/base-control.d.ts +4 -0
- package/dist/src/controls/leaflet-control.d.ts +1 -0
- package/dist/src/controls/leaflet-events.d.ts +55 -26
- package/dist/src/controls/maplibregl-control.d.ts +1 -0
- package/dist/src/controls/maplibregl-events.d.ts +54 -25
- package/dist/src/controls/maptilersdk-control.d.ts +17 -0
- package/dist/src/controls/maptilersdk-events.d.ts +72 -2
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/controls/openlayers-control.d.ts +5 -4
- package/dist/src/controls/openlayers-events.d.ts +55 -25
- package/dist/src/geocoder/geocoder-events.d.ts +40 -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/package.json +3 -2
package/dist/maplibregl.js
CHANGED
|
@@ -5,12 +5,12 @@ import { classMap as D } from "lit/directives/class-map.js";
|
|
|
5
5
|
import { repeat as Ve } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
7
|
import { styleMap as qe } from "lit/directives/style-map.js";
|
|
8
|
-
import { featureCollection as q, polygon as
|
|
8
|
+
import { featureCollection as q, polygon as Ne, feature as Ze } from "@turf/helpers";
|
|
9
9
|
import Le from "@turf/union";
|
|
10
10
|
import he from "maplibre-gl";
|
|
11
11
|
import be from "@turf/bbox";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import Qe from "@turf/difference";
|
|
13
|
+
import Ke from "@turf/flatten";
|
|
14
14
|
var Ye = Object.getOwnPropertyDescriptor, He = (t, e, i, o) => {
|
|
15
15
|
for (var r = o > 1 ? void 0 : o ? Ye(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
16
16
|
(a = t[s]) && (r = a(r) || r);
|
|
@@ -176,7 +176,7 @@ function at(t, e, i) {
|
|
|
176
176
|
const o = e[1], r = e[0], s = o - r;
|
|
177
177
|
return t === o && i ? t : ((t - r) % s + s) % s + r;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
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
|
}
|
|
@@ -229,14 +229,14 @@ var ct = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, $e = (t) =
|
|
|
229
229
|
for (var r = o > 1 ? void 0 : o ? ht(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
230
230
|
(a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
|
|
231
231
|
return o && r && ct(e, i, r), r;
|
|
232
|
-
}, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), u = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), pt = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Ie(t, e, "access private method"), i), d,
|
|
233
|
-
const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Te ? "@2x" : "",
|
|
234
|
-
let T,
|
|
232
|
+
}, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), u = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), pt = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Ie(t, e, "access private method"), i), d, Z, B, g, Me, Oe, pe, oe;
|
|
233
|
+
const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Te ? "@2x" : "", F = Te ? 2 : 1;
|
|
234
|
+
let T, Fe, k = class extends M {
|
|
235
235
|
constructor() {
|
|
236
236
|
super(...arguments), pt(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") && u(this, d,
|
|
239
|
+
t.has("feature") && u(this, d, Z) && (this.index = u(this, d, Z).length, E(this, d, pe).call(this));
|
|
240
240
|
}
|
|
241
241
|
render() {
|
|
242
242
|
return m`
|
|
@@ -252,11 +252,11 @@ let T, Ce, k = class extends M {
|
|
|
252
252
|
<div
|
|
253
253
|
class="sprite-icon"
|
|
254
254
|
style=${qe({
|
|
255
|
-
width: `${this.spriteIcon.width /
|
|
256
|
-
height: `${this.spriteIcon.height /
|
|
255
|
+
width: `${this.spriteIcon.width / F}px`,
|
|
256
|
+
height: `${this.spriteIcon.height / F}px`,
|
|
257
257
|
backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
|
|
258
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
259
|
-
backgroundSize: `${T.width /
|
|
258
|
+
backgroundPosition: `-${this.spriteIcon.x / F}px -${this.spriteIcon.y / F}px`,
|
|
259
|
+
backgroundSize: `${T.width / F}px ${T.height / F}px`
|
|
260
260
|
})}
|
|
261
261
|
title=${u(this, d, g)}
|
|
262
262
|
/>
|
|
@@ -276,7 +276,7 @@ let T, Ce, k = class extends M {
|
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
d = /* @__PURE__ */ new WeakSet();
|
|
279
|
-
|
|
279
|
+
Z = function() {
|
|
280
280
|
return this.feature?.properties?.categories;
|
|
281
281
|
};
|
|
282
282
|
B = function() {
|
|
@@ -286,7 +286,7 @@ g = function() {
|
|
|
286
286
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
287
287
|
};
|
|
288
288
|
Me = function() {
|
|
289
|
-
|
|
289
|
+
Fe ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
|
|
290
290
|
T = t;
|
|
291
291
|
}).catch(() => {
|
|
292
292
|
T = null;
|
|
@@ -296,13 +296,13 @@ Oe = function() {
|
|
|
296
296
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
|
|
297
297
|
};
|
|
298
298
|
pe = function() {
|
|
299
|
-
T !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Me).call(this),
|
|
299
|
+
T !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Me).call(this), Fe?.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 = u(this, d,
|
|
305
|
+
if (this.index--, this.category = u(this, d, Z)?.[this.index], this.spriteIcon = this.category ? T?.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)));
|
|
@@ -341,19 +341,19 @@ k = _([
|
|
|
341
341
|
O("maptiler-geocoder-feature-item")
|
|
342
342
|
], k);
|
|
343
343
|
const dt = "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 ut = Object.defineProperty, ft = Object.getOwnPropertyDescriptor,
|
|
344
|
+
var ut = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, Ce = (t) => {
|
|
345
345
|
throw TypeError(t);
|
|
346
346
|
}, c = (t, e, i, o) => {
|
|
347
347
|
for (var r = o > 1 ? void 0 : o ? ft(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
348
348
|
(a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
|
|
349
349
|
return o && r && ut(e, i, r), r;
|
|
350
|
-
}, de = (t, e, i) => e.has(t) ||
|
|
350
|
+
}, de = (t, e, i) => e.has(t) || Ce("Cannot " + i), x = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), C = (t, e, i) => e.has(t) ? Ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, o) => (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, Ee, Pe, ue, v, fe, Y, me, ge, $, ye, H, Ue, le, Be, Ge, Re, ze, je;
|
|
351
351
|
let n = class extends M {
|
|
352
352
|
constructor() {
|
|
353
|
-
super(...arguments),
|
|
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);
|
|
354
354
|
}
|
|
355
355
|
firstUpdated() {
|
|
356
|
-
W(this,
|
|
356
|
+
W(this, Q, !0);
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* Set the options of this instance.
|
|
@@ -419,7 +419,7 @@ let n = class extends M {
|
|
|
419
419
|
willUpdate(t) {
|
|
420
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)) && x(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, v).call(this, "select", { feature: x(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, v).call(this, "select", { feature: x(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
424
|
h(this, l, v).call(this, "pick", { feature: this.picked });
|
|
425
425
|
},
|
|
@@ -511,7 +511,7 @@ let n = class extends M {
|
|
|
511
511
|
h(this, l, Ge).call(this, t);
|
|
512
512
|
}}
|
|
513
513
|
.missingIconsCache=${x(this, ae)}
|
|
514
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
514
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/"}
|
|
515
515
|
>
|
|
516
516
|
${t.place_name}
|
|
517
517
|
</maptiler-geocoder-feature-item>
|
|
@@ -523,13 +523,13 @@ let n = class extends M {
|
|
|
523
523
|
`;
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
|
-
|
|
526
|
+
Q = /* @__PURE__ */ new WeakMap();
|
|
527
527
|
V = /* @__PURE__ */ new WeakMap();
|
|
528
528
|
G = /* @__PURE__ */ new WeakMap();
|
|
529
529
|
ae = /* @__PURE__ */ new WeakMap();
|
|
530
530
|
R = /* @__PURE__ */ new WeakMap();
|
|
531
531
|
l = /* @__PURE__ */ new WeakSet();
|
|
532
|
-
|
|
532
|
+
K = function() {
|
|
533
533
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
534
534
|
};
|
|
535
535
|
Ee = function() {
|
|
@@ -542,7 +542,7 @@ ue = function() {
|
|
|
542
542
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
543
543
|
};
|
|
544
544
|
v = function(t, ...[e]) {
|
|
545
|
-
x(this,
|
|
545
|
+
x(this, Q) && this.dispatchEvent(
|
|
546
546
|
new CustomEvent(t, {
|
|
547
547
|
bubbles: !0,
|
|
548
548
|
composed: !0,
|
|
@@ -605,7 +605,7 @@ H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
|
605
605
|
J > 1 && w?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), s ? (J === 1 || this.exhaustiveReverseGeocoding || w?.length === 1) && f.set("limit", String(J)) : f.set("limit", String(ve)), this.apiKey && f.set("key", this.apiKey), this.adjustUrl?.(a);
|
|
606
606
|
const De = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", j = a.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, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, l,
|
|
608
|
+
e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, K)?.id && (this.selectedItemIndex = -1));
|
|
609
609
|
return;
|
|
610
610
|
}
|
|
611
611
|
h(this, l, v).call(this, "request", { urlObj: a }), this.lastSearchUrl = j;
|
|
@@ -637,7 +637,7 @@ H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
|
637
637
|
type: "Point",
|
|
638
638
|
coordinates: [s.decimalLongitude, s.decimalLatitude]
|
|
639
639
|
}
|
|
640
|
-
}), h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, l,
|
|
640
|
+
}), h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, K)?.id && (this.selectedItemIndex = -1), s && this.input.focus());
|
|
641
641
|
} catch (r) {
|
|
642
642
|
if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
|
|
643
643
|
return;
|
|
@@ -887,9 +887,9 @@ ne = vt([
|
|
|
887
887
|
O("maptiler-geocode-marker")
|
|
888
888
|
], ne);
|
|
889
889
|
function ke(t) {
|
|
890
|
-
const e =
|
|
890
|
+
const e = Qe(
|
|
891
891
|
q([
|
|
892
|
-
|
|
892
|
+
Ne([
|
|
893
893
|
[
|
|
894
894
|
[180, 90],
|
|
895
895
|
[-180, 90],
|
|
@@ -904,10 +904,10 @@ function ke(t) {
|
|
|
904
904
|
if (!e)
|
|
905
905
|
return;
|
|
906
906
|
e.properties = { isMask: !0 };
|
|
907
|
-
const i =
|
|
907
|
+
const i = N(be(t)), o = (i[2] - i[0]) / 360 / 1e3, r = i[0] < -180, s = i[2] > 180, a = Ke(t);
|
|
908
908
|
if (a.features.length > 1 && (r || s))
|
|
909
909
|
for (const f of a.features) {
|
|
910
|
-
const L =
|
|
910
|
+
const L = N(be(f));
|
|
911
911
|
if (s && L[0] < -180 + o)
|
|
912
912
|
for (const w of f.geometry.coordinates)
|
|
913
913
|
for (const S of w)
|
|
@@ -964,23 +964,15 @@ const xt = {
|
|
|
964
964
|
}
|
|
965
965
|
}, A = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", kt = he.Evented, wt = he.Marker, _t = he.Popup;
|
|
966
966
|
class Gt extends kt {
|
|
967
|
-
#e;
|
|
967
|
+
#e = {};
|
|
968
968
|
#t;
|
|
969
969
|
#i;
|
|
970
970
|
constructor(e = {}) {
|
|
971
|
-
super(), this
|
|
971
|
+
super(), this.setOptions(e);
|
|
972
972
|
}
|
|
973
973
|
/** @internal Not to be called directly */
|
|
974
974
|
onAdd(e) {
|
|
975
|
-
|
|
976
|
-
const { primaryLanguage: o, apiKey: r } = e.getSdkConfig();
|
|
977
|
-
if (this.#e.apiKey === void 0 && (this.#e.apiKey = r), this.#e.language === void 0) {
|
|
978
|
-
const s = o.code?.match(/^([a-z]{2,3})($|_|-)/);
|
|
979
|
-
s && (this.#e.language = s[1]);
|
|
980
|
-
}
|
|
981
|
-
this.#i.classList.add("maptiler-geocoder");
|
|
982
|
-
}
|
|
983
|
-
this.#v(), this.#w();
|
|
975
|
+
this.#t = e, this.#i = e._container.ownerDocument.createElement("maptiler-geocoder"), this.#i.classList.add("maplibregl-geocoder"), this.#v(), this.#w();
|
|
984
976
|
const i = e._container.ownerDocument.createElement("div");
|
|
985
977
|
return i.classList.add("maplibregl-ctrl-geocoder", "maplibregl-ctrl", "maplibregl-ctrl-group"), i.style.position = "relative", i.style.zIndex = "3", i.appendChild(this.#i), setTimeout(() => this.#i?.setOptions({ openListOnTop: i.matches(".maplibregl-ctrl-bottom-left *, .maplibregl-ctrl-bottom-right *") })), i;
|
|
986
978
|
}
|
|
@@ -988,6 +980,9 @@ class Gt extends kt {
|
|
|
988
980
|
onRemove() {
|
|
989
981
|
this.#_(), this.#t = void 0, this.#i = void 0;
|
|
990
982
|
}
|
|
983
|
+
getOptions() {
|
|
984
|
+
return { ...this.#e };
|
|
985
|
+
}
|
|
991
986
|
setOptions(e) {
|
|
992
987
|
Object.assign(this.#e, e), this.#v();
|
|
993
988
|
}
|
|
@@ -1107,7 +1102,7 @@ class Gt extends kt {
|
|
|
1107
1102
|
return super.fire({ type: e, ...i ?? {} });
|
|
1108
1103
|
}
|
|
1109
1104
|
#L(e) {
|
|
1110
|
-
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(
|
|
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));
|
|
1111
1106
|
}
|
|
1112
1107
|
#$(e) {
|
|
1113
1108
|
if (!e || e.length === 0 || !this.#d) return;
|
|
@@ -1115,7 +1110,7 @@ class Gt extends kt {
|
|
|
1115
1110
|
(s, a) => i || !a.matching_text ? [Math.min(s[0], a.bbox[0]), Math.min(s[1], a.bbox[1]), Math.max(s[2], a.bbox[2]), Math.max(s[3], a.bbox[3])] : s,
|
|
1116
1111
|
[180, 90, -180, -90]
|
|
1117
1112
|
), r = e.map((s) => this.#h(s)).filter((s) => s !== void 0).reduce((s, a) => s === void 0 ? a : Math.max(s, a), void 0);
|
|
1118
|
-
this.#b(
|
|
1113
|
+
this.#b(N(o), 50, r);
|
|
1119
1114
|
}
|
|
1120
1115
|
#h(e) {
|
|
1121
1116
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
@@ -1172,7 +1167,7 @@ class Gt extends kt {
|
|
|
1172
1167
|
(s) => s.type === "Polygon" || s.type === "MultiPolygon"
|
|
1173
1168
|
);
|
|
1174
1169
|
if (r.length > 0) {
|
|
1175
|
-
const s = Le(q(r.map((a) =>
|
|
1170
|
+
const s = Le(q(r.map((a) => Ze(a))));
|
|
1176
1171
|
if (s) {
|
|
1177
1172
|
const a = ke({ ...i, geometry: s.geometry });
|
|
1178
1173
|
a && this.#n(a);
|