@maptiler/geocoding-control 3.0.0-rc.1 → 3.0.0-rc.2
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 +115 -51
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +17 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +47 -69
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +14 -14
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +52 -74
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +14 -14
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +49 -71
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +14 -14
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +4 -35
- package/dist/src/controls/maplibregl-control.d.ts +14 -35
- package/dist/src/controls/maptilersdk-control.d.ts +2 -1
- package/dist/src/controls/openlayers-control.d.ts +35 -0
- package/dist/src/controls/openlayers-events.d.ts +43 -0
- package/dist/src/controls/openlayers-options.d.ts +83 -0
- package/dist/src/geocoder/geocoder-options.d.ts +17 -1
- package/dist/src/geocoder/geocoder.d.ts +2 -1
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +6 -1
package/dist/maplibregl.js
CHANGED
|
@@ -229,9 +229,9 @@ 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, N,
|
|
233
|
-
const
|
|
234
|
-
let
|
|
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, N, B, g, Me, Oe, pe, oe;
|
|
233
|
+
const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Te ? "@2x" : "", C = Te ? 2 : 1;
|
|
234
|
+
let T, Ce, 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
|
}
|
|
@@ -248,28 +248,28 @@ let S, Ce, k = class extends M {
|
|
|
248
248
|
class=${this.itemStyle}
|
|
249
249
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
250
250
|
>
|
|
251
|
-
${
|
|
251
|
+
${T && this.spriteIcon ? m`
|
|
252
252
|
<div
|
|
253
253
|
class="sprite-icon"
|
|
254
254
|
style=${qe({
|
|
255
255
|
width: `${this.spriteIcon.width / C}px`,
|
|
256
256
|
height: `${this.spriteIcon.height / C}px`,
|
|
257
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
257
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
|
|
258
258
|
backgroundPosition: `-${this.spriteIcon.x / C}px -${this.spriteIcon.y / C}px`,
|
|
259
|
-
backgroundSize: `${
|
|
259
|
+
backgroundSize: `${T.width / C}px ${T.height / C}px`
|
|
260
260
|
})}
|
|
261
261
|
title=${u(this, d, g)}
|
|
262
262
|
/>
|
|
263
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${E(this, d, Oe)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d,
|
|
263
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${E(this, d, Oe)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d, B) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> `}
|
|
264
264
|
|
|
265
265
|
<span class="texts">
|
|
266
266
|
<span>
|
|
267
|
-
<span class="primary"> ${u(this, d,
|
|
267
|
+
<span class="primary"> ${u(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) && !u(this, d,
|
|
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) && !u(this, d, B) ? m` <span class="secondary"> ${u(this, d, g)} </span> ` : X}
|
|
270
270
|
</span>
|
|
271
271
|
|
|
272
|
-
<span class="line2"> ${u(this, d,
|
|
272
|
+
<span class="line2"> ${u(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
273
273
|
</span>
|
|
274
274
|
</li>
|
|
275
275
|
`;
|
|
@@ -279,30 +279,30 @@ d = /* @__PURE__ */ new WeakSet();
|
|
|
279
279
|
N = function() {
|
|
280
280
|
return this.feature?.properties?.categories;
|
|
281
281
|
};
|
|
282
|
-
|
|
282
|
+
B = function() {
|
|
283
283
|
return this.feature?.place_type[0] === "reverse";
|
|
284
284
|
};
|
|
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
288
|
Me = function() {
|
|
289
|
-
Ce ??= fetch(`${this.iconsBaseUrl}sprite${
|
|
290
|
-
|
|
289
|
+
Ce ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
|
|
290
|
+
T = t;
|
|
291
291
|
}).catch(() => {
|
|
292
|
-
|
|
292
|
+
T = null;
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
295
|
Oe = function() {
|
|
296
296
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
|
|
297
297
|
};
|
|
298
298
|
pe = function() {
|
|
299
|
-
|
|
299
|
+
T !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Me).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 = u(this, d, N)?.[this.index], this.spriteIcon = this.category ?
|
|
305
|
+
if (this.index--, this.category = u(this, d, N)?.[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)));
|
|
@@ -347,10 +347,10 @@ var ut = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, Fe = (t) =
|
|
|
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) || Fe("Cannot " + i), x = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), F = (t, e, i) => e.has(t) ? Fe("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), Z, V,
|
|
350
|
+
}, de = (t, e, i) => e.has(t) || Fe("Cannot " + i), x = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), F = (t, e, i) => e.has(t) ? Fe("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), Z, V, G, ae, R, l, Q, 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), F(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, F(this, Z, !1), F(this, V, !1), F(this,
|
|
353
|
+
super(...arguments), F(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, F(this, Z, !1), F(this, V, !1), F(this, G), F(this, ae, /* @__PURE__ */ new Set()), F(this, R);
|
|
354
354
|
}
|
|
355
355
|
firstUpdated() {
|
|
356
356
|
W(this, Z, !0);
|
|
@@ -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, Q) }), ["picked"].some((e) => t.has(e)) && this.picked && (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(
|
|
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, Q) }), ["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
|
},
|
|
@@ -448,7 +448,7 @@ 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, Be)}
|
|
452
452
|
@change=${() => this.picked = void 0}
|
|
453
453
|
placeholder=${this.placeholder ?? "Search"}
|
|
454
454
|
aria-label=${this.placeholder ?? "Search"}
|
|
@@ -508,10 +508,10 @@ let n = class extends M {
|
|
|
508
508
|
h(this, l, Re).call(this, e);
|
|
509
509
|
}}
|
|
510
510
|
@select=${() => {
|
|
511
|
-
h(this, l,
|
|
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.2/icons/"}
|
|
515
515
|
>
|
|
516
516
|
${t.place_name}
|
|
517
517
|
</maptiler-geocoder-feature-item>
|
|
@@ -525,7 +525,7 @@ let n = class extends M {
|
|
|
525
525
|
};
|
|
526
526
|
Z = /* @__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();
|
|
@@ -551,7 +551,7 @@ v = function(t, ...[e]) {
|
|
|
551
551
|
);
|
|
552
552
|
};
|
|
553
553
|
fe = function(t) {
|
|
554
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(x(this,
|
|
554
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(x(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 }).then(() => {
|
|
555
555
|
this.picked = void 0;
|
|
556
556
|
}).catch((e) => this.error = e);
|
|
557
557
|
};
|
|
@@ -569,10 +569,10 @@ me = function() {
|
|
|
569
569
|
};
|
|
570
570
|
ge = function(t) {
|
|
571
571
|
if (this.searchValue = t, h(this, l, v).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(x(this,
|
|
572
|
+
if (clearTimeout(x(this, G)), x(this, l, ue))
|
|
573
573
|
return;
|
|
574
574
|
const e = this.searchValue;
|
|
575
|
-
W(this,
|
|
575
|
+
W(this, G, window.setTimeout(() => {
|
|
576
576
|
h(this, l, H).call(this, e).catch((i) => this.error = i);
|
|
577
577
|
}, this.debounceSearch ?? 200));
|
|
578
578
|
} else
|
|
@@ -596,8 +596,8 @@ H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
|
596
596
|
(y) => typeof y == "string" ? y : L === void 0 || (y[0] ?? 0) <= L && L < (y[1] ?? 1 / 0) ? y[2] : void 0
|
|
597
597
|
).filter((y) => y !== void 0);
|
|
598
598
|
w && (w = [...new Set(w)], f.set("types", w.join(",")));
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
599
|
+
const S = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
600
|
+
if (S && f.set("excludeTypes", String(S)), this.bbox && f.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && f.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && f.set("worldview", this.worldview), !e && !s) {
|
|
601
601
|
const y = this.proximity ?? [{ type: "server-geolocation" }], xe = await lt(x(this, R), y, o);
|
|
602
602
|
xe && f.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && f.set("autocomplete", "false"), f.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
603
603
|
}
|
|
@@ -655,10 +655,10 @@ 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
|
+
Be = function(t) {
|
|
659
659
|
h(this, l, ge).call(this, t.target.value);
|
|
660
660
|
};
|
|
661
|
-
|
|
661
|
+
Ge = function(t) {
|
|
662
662
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
663
663
|
};
|
|
664
664
|
Re = function(t) {
|
|
@@ -781,6 +781,9 @@ c([
|
|
|
781
781
|
c([
|
|
782
782
|
p({ type: Array })
|
|
783
783
|
], n.prototype, "types", 2);
|
|
784
|
+
c([
|
|
785
|
+
p({ type: String })
|
|
786
|
+
], n.prototype, "worldview", 2);
|
|
784
787
|
c([
|
|
785
788
|
Ae("input")
|
|
786
789
|
], n.prototype, "input", 2);
|
|
@@ -853,8 +856,9 @@ const mt = [
|
|
|
853
856
|
"showPlaceType",
|
|
854
857
|
"showResultsWhileTyping",
|
|
855
858
|
"types",
|
|
856
|
-
"reverseGeocodingTypes"
|
|
857
|
-
|
|
859
|
+
"reverseGeocodingTypes",
|
|
860
|
+
"worldview"
|
|
861
|
+
], gt = "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)}";
|
|
858
862
|
var yt = Object.getOwnPropertyDescriptor, vt = (t, e, i, o) => {
|
|
859
863
|
for (var r = o > 1 ? void 0 : o ? yt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
|
|
860
864
|
(a = t[s]) && (r = a(r) || r);
|
|
@@ -906,12 +910,12 @@ function ke(t) {
|
|
|
906
910
|
const L = K(be(f));
|
|
907
911
|
if (s && L[0] < -180 + o)
|
|
908
912
|
for (const w of f.geometry.coordinates)
|
|
909
|
-
for (const
|
|
910
|
-
|
|
913
|
+
for (const S of w)
|
|
914
|
+
S[0] += 360 - o;
|
|
911
915
|
if (r && L[2] > 180 - o)
|
|
912
916
|
for (const w of f.geometry.coordinates)
|
|
913
|
-
for (const
|
|
914
|
-
|
|
917
|
+
for (const S of w)
|
|
918
|
+
S[0] -= 360 - o;
|
|
915
919
|
}
|
|
916
920
|
return q([a.features.length < 2 ? t : Le(a) ?? t, e]);
|
|
917
921
|
}
|
|
@@ -959,13 +963,14 @@ const xt = {
|
|
|
959
963
|
filter: ["!", ["has", "isMask"]]
|
|
960
964
|
}
|
|
961
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;
|
|
962
|
-
class
|
|
966
|
+
class Gt extends kt {
|
|
963
967
|
#e;
|
|
964
968
|
#t;
|
|
965
969
|
#i;
|
|
966
970
|
constructor(e = {}) {
|
|
967
971
|
super(), this.#e = e;
|
|
968
972
|
}
|
|
973
|
+
/** @internal Not to be called directly */
|
|
969
974
|
onAdd(e) {
|
|
970
975
|
if (this.#t = e, this.#i = e._container.ownerDocument.createElement("maptiler-geocoder"), this.#i.classList.add("maplibregl-geocoder"), "getSdkConfig" in e && typeof e.getSdkConfig == "function") {
|
|
971
976
|
const { primaryLanguage: o, apiKey: r } = e.getSdkConfig();
|
|
@@ -979,64 +984,31 @@ class Bt extends kt {
|
|
|
979
984
|
const i = e._container.ownerDocument.createElement("div");
|
|
980
985
|
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;
|
|
981
986
|
}
|
|
987
|
+
/** @internal Not to be called directly */
|
|
982
988
|
onRemove() {
|
|
983
989
|
this.#_(), this.#t = void 0, this.#i = void 0;
|
|
984
990
|
}
|
|
985
|
-
/**
|
|
986
|
-
* Update the control options.
|
|
987
|
-
*
|
|
988
|
-
* @param options options to update
|
|
989
|
-
*/
|
|
990
991
|
setOptions(e) {
|
|
991
992
|
Object.assign(this.#e, e), this.#v();
|
|
992
993
|
}
|
|
993
|
-
/**
|
|
994
|
-
* Set the content of search input box.
|
|
995
|
-
*
|
|
996
|
-
* @param value text to set
|
|
997
|
-
*/
|
|
998
994
|
setQuery(e) {
|
|
999
995
|
this.#i?.setQuery(e);
|
|
1000
996
|
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Set the content of search input box and immediately submit it.
|
|
1003
|
-
*
|
|
1004
|
-
* @param value text to set and submit
|
|
1005
|
-
*/
|
|
1006
997
|
submitQuery(e) {
|
|
1007
998
|
this.#i?.submitQuery(e);
|
|
1008
999
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Clear geocoding search results from the map.
|
|
1011
|
-
*/
|
|
1012
1000
|
clearMap() {
|
|
1013
1001
|
this.#o = [], this.#p(void 0, void 0);
|
|
1014
1002
|
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Clear search result list.
|
|
1017
|
-
*/
|
|
1018
1003
|
clearList() {
|
|
1019
1004
|
this.#i?.clearList();
|
|
1020
1005
|
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Set reverse geocoding mode.
|
|
1023
|
-
*
|
|
1024
|
-
* @param reverseActive reverse geocoding active
|
|
1025
|
-
*/
|
|
1026
1006
|
setReverseMode(e) {
|
|
1027
1007
|
this.setOptions({ reverseActive: e });
|
|
1028
1008
|
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Focus the search input box.
|
|
1031
|
-
*
|
|
1032
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
1033
|
-
*/
|
|
1034
1009
|
focus(e) {
|
|
1035
1010
|
this.#i?.focus(e);
|
|
1036
1011
|
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Blur the search input box.
|
|
1039
|
-
*/
|
|
1040
1012
|
blur() {
|
|
1041
1013
|
this.#i?.blur();
|
|
1042
1014
|
}
|
|
@@ -1255,7 +1227,7 @@ class Bt extends kt {
|
|
|
1255
1227
|
});
|
|
1256
1228
|
return;
|
|
1257
1229
|
}
|
|
1258
|
-
const e = this.#
|
|
1230
|
+
const e = this.#T(), i = this.#t.getSource(A);
|
|
1259
1231
|
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(A, {
|
|
1260
1232
|
type: "geojson",
|
|
1261
1233
|
data: this.#a
|
|
@@ -1277,11 +1249,17 @@ class Bt extends kt {
|
|
|
1277
1249
|
#f(e) {
|
|
1278
1250
|
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new wt(e);
|
|
1279
1251
|
}
|
|
1252
|
+
#T() {
|
|
1253
|
+
const { fullGeometryStyle: e } = this.#e;
|
|
1254
|
+
if (e === !0 || e === void 0) return bt;
|
|
1255
|
+
if (!(e === !1 || e === null))
|
|
1256
|
+
return e;
|
|
1257
|
+
}
|
|
1280
1258
|
}
|
|
1281
1259
|
export {
|
|
1282
1260
|
bt as DEFAULT_GEOMETRY_STYLE,
|
|
1283
|
-
|
|
1284
|
-
|
|
1261
|
+
Gt as GeocodingControl,
|
|
1262
|
+
Gt as MaplibreglGeocodingControl,
|
|
1285
1263
|
ee as MaptilerGeocodeClearIconElement,
|
|
1286
1264
|
te as MaptilerGeocodeFailIconElement,
|
|
1287
1265
|
ie as MaptilerGeocodeLoadingIconElement,
|