@maptiler/geocoding-control 3.0.0-rc.8 → 3.0.0
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/{leaflet.public.js → leaflet.js} +2 -2
- package/dist/leaflet.js.map +1 -0
- package/dist/{leaflet.public.umd.js → leaflet.umd.js} +7 -7
- package/dist/leaflet.umd.js.map +1 -0
- package/dist/maplibregl.js +2 -2
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +6 -6
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +38 -38
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +2 -2
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/{openlayers.public.js → openlayers.js} +3 -3
- package/dist/openlayers.js.map +1 -0
- package/dist/{openlayers.public.umd.js → openlayers.umd.js} +7 -7
- package/dist/openlayers.umd.js.map +1 -0
- package/package.json +10 -9
- package/check-version.js +0 -69
- package/dist/check-version.d.ts +0 -1
- package/dist/leaflet.public.js.map +0 -1
- package/dist/leaflet.public.umd.js.map +0 -1
- package/dist/openlayers.public.js.map +0 -1
- package/dist/openlayers.public.umd.js.map +0 -1
- /package/dist/src/{maplibregl.d.ts → maplibregl.public.d.ts} +0 -0
- /package/dist/src/{maptilersdk.d.ts → maptilersdk.public.d.ts} +0 -0
package/dist/maptilersdk.js
CHANGED
|
@@ -7,7 +7,7 @@ import "@turf/clone";
|
|
|
7
7
|
import { styleMap as Ne } from "lit/directives/style-map.js";
|
|
8
8
|
import { config as Ze } from "@maptiler/sdk";
|
|
9
9
|
import { featureCollection as D, polygon as Ke, feature as Qe } from "@turf/helpers";
|
|
10
|
-
import
|
|
10
|
+
import Le from "@turf/union";
|
|
11
11
|
import H from "maplibre-gl";
|
|
12
12
|
import be from "@turf/bbox";
|
|
13
13
|
import Ye from "@turf/difference";
|
|
@@ -226,7 +226,7 @@ async function ct(t, e, i) {
|
|
|
226
226
|
const ht = ".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)}}";
|
|
227
227
|
var pt = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, $e = (t) => {
|
|
228
228
|
throw TypeError(t);
|
|
229
|
-
},
|
|
229
|
+
}, L = (t, e, i, a) => {
|
|
230
230
|
for (var s = a > 1 ? void 0 : a ? dt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
231
231
|
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
232
232
|
return a && s && pt(e, i, s), s;
|
|
@@ -311,34 +311,34 @@ re = function() {
|
|
|
311
311
|
k.styles = I`
|
|
312
312
|
${ce(ht)}
|
|
313
313
|
`;
|
|
314
|
-
|
|
314
|
+
L([
|
|
315
315
|
p({ type: Object })
|
|
316
316
|
], k.prototype, "feature", 2);
|
|
317
|
-
|
|
317
|
+
L([
|
|
318
318
|
p({ type: String })
|
|
319
319
|
], k.prototype, "itemStyle", 2);
|
|
320
|
-
|
|
320
|
+
L([
|
|
321
321
|
p({ type: String })
|
|
322
322
|
], k.prototype, "showPlaceType", 2);
|
|
323
|
-
|
|
323
|
+
L([
|
|
324
324
|
p({ attribute: !1 })
|
|
325
325
|
], k.prototype, "missingIconsCache", 2);
|
|
326
|
-
|
|
326
|
+
L([
|
|
327
327
|
p({ type: String })
|
|
328
328
|
], k.prototype, "iconsBaseUrl", 2);
|
|
329
|
-
|
|
329
|
+
L([
|
|
330
330
|
b()
|
|
331
331
|
], k.prototype, "category", 2);
|
|
332
|
-
|
|
332
|
+
L([
|
|
333
333
|
b()
|
|
334
334
|
], k.prototype, "imageUrl", 2);
|
|
335
|
-
|
|
335
|
+
L([
|
|
336
336
|
b()
|
|
337
337
|
], k.prototype, "spriteIcon", 2);
|
|
338
|
-
|
|
338
|
+
L([
|
|
339
339
|
b()
|
|
340
340
|
], k.prototype, "index", 2);
|
|
341
|
-
k =
|
|
341
|
+
k = L([
|
|
342
342
|
O("maptiler-geocoder-feature-item")
|
|
343
343
|
], k);
|
|
344
344
|
const ft = "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}";
|
|
@@ -517,7 +517,7 @@ let n = class extends F {
|
|
|
517
517
|
h(this, l, Ge).call(this, t);
|
|
518
518
|
}}
|
|
519
519
|
.missingIconsCache=${w(this, ae)}
|
|
520
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0
|
|
520
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0/icons/"}
|
|
521
521
|
/>
|
|
522
522
|
`
|
|
523
523
|
)}
|
|
@@ -592,17 +592,17 @@ Q = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
|
592
592
|
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, K).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
593
593
|
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
594
594
|
const [M] = w(this, R) ?? [void 0];
|
|
595
|
-
let
|
|
595
|
+
let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
596
596
|
(v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
597
597
|
).filter((v) => v !== void 0);
|
|
598
|
-
|
|
598
|
+
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
599
599
|
const ye = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
600
600
|
if (ye && y.set("excludeTypes", String(ye)), 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
601
|
const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await ct(w(this, R), v, s);
|
|
602
602
|
xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
603
603
|
}
|
|
604
604
|
const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
|
|
605
|
-
Y > 1 &&
|
|
605
|
+
Y > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (Y === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
606
606
|
const We = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
|
|
607
607
|
if (j === this.lastSearchUrl) {
|
|
608
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 !== w(this, l, Z)?.id && (this.selectedItemIndex = -1));
|
|
@@ -897,7 +897,7 @@ ne.styles = I`
|
|
|
897
897
|
ne = bt([
|
|
898
898
|
O("maptiler-geocode-marker")
|
|
899
899
|
], ne);
|
|
900
|
-
const wt = "@maptiler/geocoding-control", kt = "3.0.0
|
|
900
|
+
const wt = "@maptiler/geocoding-control", kt = "3.0.0";
|
|
901
901
|
function we(t) {
|
|
902
902
|
const e = Ye(
|
|
903
903
|
D([
|
|
@@ -922,16 +922,16 @@ function we(t) {
|
|
|
922
922
|
const y = V(be(u));
|
|
923
923
|
if (o && y[0] < -180 + a)
|
|
924
924
|
for (const M of u.geometry.coordinates)
|
|
925
|
-
for (const
|
|
926
|
-
|
|
925
|
+
for (const _ of M)
|
|
926
|
+
_[0] += 360 - a;
|
|
927
927
|
if (s && y[2] > 180 - a)
|
|
928
928
|
for (const M of u.geometry.coordinates)
|
|
929
|
-
for (const
|
|
930
|
-
|
|
929
|
+
for (const _ of M)
|
|
930
|
+
_[0] -= 360 - a;
|
|
931
931
|
}
|
|
932
|
-
return D([r.features.length < 2 ? t :
|
|
932
|
+
return D([r.features.length < 2 ? t : Le(r) ?? t, e]);
|
|
933
933
|
}
|
|
934
|
-
const
|
|
934
|
+
const _t = {
|
|
935
935
|
continental_marine: 4,
|
|
936
936
|
country: 4,
|
|
937
937
|
major_landform: 8,
|
|
@@ -955,7 +955,7 @@ const Lt = {
|
|
|
955
955
|
"poi.restaurant": 18,
|
|
956
956
|
"poi.aerodrome": 13
|
|
957
957
|
// TODO add many more
|
|
958
|
-
},
|
|
958
|
+
}, Lt = {
|
|
959
959
|
fill: {
|
|
960
960
|
paint: {
|
|
961
961
|
"fill-color": "#000",
|
|
@@ -974,7 +974,7 @@ const Lt = {
|
|
|
974
974
|
},
|
|
975
975
|
filter: ["!", ["has", "isMask"]]
|
|
976
976
|
}
|
|
977
|
-
}, W = "mtlr-gc-full-geom", ke = "mtlr-gc-full-geom-fill",
|
|
977
|
+
}, W = "mtlr-gc-full-geom", ke = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line";
|
|
978
978
|
class $t extends H.Evented {
|
|
979
979
|
#e = {};
|
|
980
980
|
#t;
|
|
@@ -990,7 +990,7 @@ class $t extends H.Evented {
|
|
|
990
990
|
}
|
|
991
991
|
/** @internal Not to be called directly */
|
|
992
992
|
onRemove() {
|
|
993
|
-
this.#
|
|
993
|
+
this.#_(), this.#t = void 0, this.#i = void 0;
|
|
994
994
|
}
|
|
995
995
|
getOptions() {
|
|
996
996
|
return { ...this.#e };
|
|
@@ -1055,7 +1055,7 @@ class $t extends H.Evented {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
pick: (e) => {
|
|
1057
1057
|
const i = e.detail.feature;
|
|
1058
|
-
i && i.id !== this.#m && this.#d && (this.#
|
|
1058
|
+
i && i.id !== this.#m && this.#d && (this.#L(i), this.#p(this.#o, i)), this.#m = i?.id, this.#s("pick", e.detail);
|
|
1059
1059
|
},
|
|
1060
1060
|
featuresshow: () => {
|
|
1061
1061
|
this.#s("featuresshow");
|
|
@@ -1102,7 +1102,7 @@ class $t extends H.Evented {
|
|
|
1102
1102
|
this.#t.on(e, i);
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
#
|
|
1105
|
+
#_() {
|
|
1106
1106
|
if (!(!this.#i || !this.#t)) {
|
|
1107
1107
|
for (const [e, i] of Object.entries(this.#g))
|
|
1108
1108
|
this.#i.removeEventListener(e, i);
|
|
@@ -1113,7 +1113,7 @@ class $t extends H.Evented {
|
|
|
1113
1113
|
#s(e, i) {
|
|
1114
1114
|
return super.fire({ type: e, ...i ?? {} });
|
|
1115
1115
|
}
|
|
1116
|
-
#
|
|
1116
|
+
#L(e) {
|
|
1117
1117
|
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(V(e.bbox), 50, this.#h(e));
|
|
1118
1118
|
}
|
|
1119
1119
|
#$({ detail: { features: e, external: i } }) {
|
|
@@ -1128,7 +1128,7 @@ class $t extends H.Evented {
|
|
|
1128
1128
|
#h(e) {
|
|
1129
1129
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1130
1130
|
return;
|
|
1131
|
-
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ??
|
|
1131
|
+
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? _t;
|
|
1132
1132
|
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
|
|
1133
1133
|
const r = a[i + "." + o];
|
|
1134
1134
|
return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
|
|
@@ -1180,7 +1180,7 @@ class $t extends H.Evented {
|
|
|
1180
1180
|
(o) => o.type === "Polygon" || o.type === "MultiPolygon"
|
|
1181
1181
|
);
|
|
1182
1182
|
if (s.length > 0) {
|
|
1183
|
-
const o =
|
|
1183
|
+
const o = Le(D(s.map((r) => Qe(r))));
|
|
1184
1184
|
if (o) {
|
|
1185
1185
|
const r = we({ ...i, geometry: o.geometry });
|
|
1186
1186
|
r && this.#n(r);
|
|
@@ -1229,7 +1229,7 @@ class $t extends H.Evented {
|
|
|
1229
1229
|
this.#c?.getElement().classList.toggle("marker-selected", !1), this.#c = void 0, this.#e.markerOnSelected !== !1 && (this.#c = this.#l.get(e), this.#c?.getElement().classList.toggle("marker-selected", !0));
|
|
1230
1230
|
}
|
|
1231
1231
|
#u() {
|
|
1232
|
-
if (!this.#t?.
|
|
1232
|
+
if (!this.#t?._loaded) {
|
|
1233
1233
|
this.#t?.once("load", () => {
|
|
1234
1234
|
this.#u();
|
|
1235
1235
|
});
|
|
@@ -1244,9 +1244,9 @@ class $t extends H.Evented {
|
|
|
1244
1244
|
id: ke,
|
|
1245
1245
|
type: "fill",
|
|
1246
1246
|
source: W
|
|
1247
|
-
}), !this.#t.getLayer(
|
|
1247
|
+
}), !this.#t.getLayer(_e) && e.line && this.#t.addLayer({
|
|
1248
1248
|
...e.line,
|
|
1249
|
-
id:
|
|
1249
|
+
id: _e,
|
|
1250
1250
|
type: "line",
|
|
1251
1251
|
source: W
|
|
1252
1252
|
}));
|
|
@@ -1259,7 +1259,7 @@ class $t extends H.Evented {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
#M() {
|
|
1261
1261
|
const { fullGeometryStyle: e } = this.#e;
|
|
1262
|
-
if (e === !0 || e === void 0) return
|
|
1262
|
+
if (e === !0 || e === void 0) return Lt;
|
|
1263
1263
|
if (!(e === !1 || e === null))
|
|
1264
1264
|
return e;
|
|
1265
1265
|
}
|
|
@@ -1297,7 +1297,7 @@ class jt extends $t {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
1299
|
export {
|
|
1300
|
-
|
|
1300
|
+
Lt as DEFAULT_GEOMETRY_STYLE,
|
|
1301
1301
|
jt as GeocodingControl,
|
|
1302
1302
|
X as MaptilerGeocodeClearIconElement,
|
|
1303
1303
|
ee as MaptilerGeocodeFailIconElement,
|
|
@@ -1308,8 +1308,8 @@ export {
|
|
|
1308
1308
|
n as MaptilerGeocoderElement,
|
|
1309
1309
|
jt as MaptilerGeocodingControl,
|
|
1310
1310
|
ke as RESULT_LAYER_FILL,
|
|
1311
|
-
|
|
1311
|
+
_e as RESULT_LAYER_LINE,
|
|
1312
1312
|
W as RESULT_SOURCE,
|
|
1313
|
-
|
|
1313
|
+
_t as ZOOM_DEFAULTS
|
|
1314
1314
|
};
|
|
1315
1315
|
//# sourceMappingURL=maptilersdk.js.map
|