@maptiler/geocoding-control 1.4.2-dev.3 → 2.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/MapLibreBasedGeocodingControl.d.ts +2659 -35
- package/leaflet-controller.d.ts +1 -1
- package/leaflet-controller.js +580 -569
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -3
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.d.ts +74 -16
- package/leaflet.js +1396 -1369
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +7 -7
- package/maplibregl-controller.js +683 -661
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +2614 -5
- package/maplibregl.js +1563 -1418
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +2614 -5
- package/maptilersdk.js +1574 -1426
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +1 -1
- package/openlayers-controller.js +308 -306
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.d.ts +21 -0
- package/openlayers.js +1300 -1318
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +17 -17
- package/react.d.ts +4 -4
- package/react.js +811 -798
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +1 -1
- package/svelte/FeatureItem.svelte.d.ts +1 -1
- package/svelte/GeocodingControl.svelte +68 -46
- package/svelte/GeocodingControl.svelte.d.ts +25 -11
- package/svelte/MapLibreBasedGeocodingControl.d.ts +2659 -35
- package/svelte/MapLibreBasedGeocodingControl.js +165 -58
- package/svelte/leaflet-controller.d.ts +1 -1
- package/svelte/leaflet-controller.js +50 -24
- package/svelte/leaflet.d.ts +74 -16
- package/svelte/leaflet.js +26 -15
- package/svelte/maplibregl-controller.d.ts +7 -7
- package/svelte/maplibregl-controller.js +96 -66
- package/svelte/maplibregl.d.ts +2614 -5
- package/svelte/maplibregl.js +10 -7
- package/svelte/maptilersdk.d.ts +2614 -5
- package/svelte/maptilersdk.js +23 -18
- package/svelte/openlayers-controller.d.ts +1 -1
- package/svelte/openlayers-controller.js +4 -1
- package/svelte/openlayers.d.ts +21 -0
- package/svelte/openlayers.js +31 -45
- package/svelte/react.d.ts +4 -4
- package/svelte/react.js +5 -5
- package/svelte/types.d.ts +72 -30
- package/svelte/vanilla.d.ts +14 -1
- package/svelte/vanilla.js +31 -8
- package/types.d.ts +72 -30
- package/vanilla.d.ts +14 -1
- package/vanilla.js +837 -796
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{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}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-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)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}circle.svelte-1aq105l{stroke-width:1.875;fill:none}path.svelte-1aq105l{stroke-width:1.875;stroke-linecap:round}svg.svelte-1aq105l{display:block;stroke:var(--color-icon-button)}form.svelte-
|
|
1
|
+
svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{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}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-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)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}circle.svelte-1aq105l{stroke-width:1.875;fill:none}path.svelte-1aq105l{stroke-width:1.875;stroke-linecap:round}svg.svelte-1aq105l{display:block;stroke:var(--color-icon-button)}form.svelte-bz0zu3.svelte-bz0zu3{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}form.svelte-bz0zu3.svelte-bz0zu3,form.svelte-bz0zu3 .svelte-bz0zu3,form.svelte-bz0zu3 .svelte-bz0zu3:after,form.svelte-bz0zu3 .svelte-bz0zu3:before{box-sizing:border-box}form.can-collapse.svelte-bz0zu3.svelte-bz0zu3{max-width:29px}form.can-collapse.svelte-bz0zu3 input.svelte-bz0zu3::placeholder{transition:opacity .25s;opacity:0}form.svelte-bz0zu3.svelte-bz0zu3,form.svelte-bz0zu3.svelte-bz0zu3:focus-within,form.svelte-bz0zu3.svelte-bz0zu3:hover{width:270px;max-width:270px}form.svelte-bz0zu3 input.svelte-bz0zu3::placeholder,form.svelte-bz0zu3:focus-within input.svelte-bz0zu3::placeholder,form.svelte-bz0zu3:hover input.svelte-bz0zu3::placeholder{opacity:1}input.svelte-bz0zu3.svelte-bz0zu3{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.svelte-bz0zu3.svelte-bz0zu3:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul.svelte-bz0zu3.svelte-bz0zu3,div.error.svelte-bz0zu3.svelte-bz0zu3,div.no-results.svelte-bz0zu3.svelte-bz0zu3{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.svelte-bz0zu3.svelte-bz0zu3{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error.svelte-bz0zu3.svelte-bz0zu3,div.no-results.svelte-bz0zu3.svelte-bz0zu3{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error.svelte-bz0zu3.svelte-bz0zu3{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error.svelte-bz0zu3 div.svelte-bz0zu3{flex-grow:1}div.error.svelte-bz0zu3 svg{flex-shrink:0;width:20px;height:20px}div.error.svelte-bz0zu3 button.svelte-bz0zu3{flex-shrink:0}div.error.svelte-bz0zu3 button.svelte-bz0zu3>svg{width:13px;fill:#e25041}div.error.svelte-bz0zu3 button.svelte-bz0zu3:hover svg,div.error.svelte-bz0zu3 button.svelte-bz0zu3:active svg{fill:#444952}div.no-results.svelte-bz0zu3.svelte-bz0zu3{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results.svelte-bz0zu3 svg{margin-top:4px;flex-shrink:0;width:20px;height:20px;width:30px;height:30px}.leaflet-bottom ul.options.svelte-bz0zu3.svelte-bz0zu3,.maplibregl-ctrl-bottom-left ul.options.svelte-bz0zu3.svelte-bz0zu3,.maplibregl-ctrl-bottom-right ul.options.svelte-bz0zu3.svelte-bz0zu3{top:auto;bottom:calc(100% + 6px)}button.svelte-bz0zu3.svelte-bz0zu3{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button.svelte-bz0zu3.svelte-bz0zu3:hover{background-color:transparent}button.svelte-bz0zu3:hover svg,button.svelte-bz0zu3:active svg{fill:#2b8bfb}.input-group.svelte-bz0zu3.svelte-bz0zu3{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group.svelte-bz0zu3.svelte-bz0zu3:focus-within{outline:#2b8bfb solid 2px}.search-button.svelte-bz0zu3.svelte-bz0zu3{flex-shrink:0}.maplibregl-ctrl-geocoder:not(.maptiler-ctrl) .search-button svg{width:12px!important;transform:translate(.5px)}.clear-button-container.svelte-bz0zu3.svelte-bz0zu3{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable.svelte-bz0zu3.svelte-bz0zu3{display:flex;flex-shrink:0}.maplibregl-ctrl-geocoder{position:relative;z-index:3}.maptiler-ctrl:not(:empty){box-shadow:none}.maptiler-ctrl .input-group.svelte-bz0zu3.svelte-bz0zu3{padding-inline:8px;border:white solid 2px}.maptiler-ctrl .input-group.svelte-bz0zu3.svelte-bz0zu3:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}.maptiler-ctrl form.can-collapse.svelte-bz0zu3.svelte-bz0zu3{max-width:33px}.maptiler-ctrl form.svelte-bz0zu3.svelte-bz0zu3,.maptiler-ctrl form.svelte-bz0zu3.svelte-bz0zu3:focus-within,.maptiler-ctrl form.svelte-bz0zu3.svelte-bz0zu3:hover{width:270px;max-width:270px}
|
|
@@ -58,7 +58,7 @@ function handleImgError() {
|
|
|
58
58
|
{isReverse ? feature.place_name : feature.place_name.replace(/,.*/, "")}
|
|
59
59
|
</span>
|
|
60
60
|
|
|
61
|
-
{#if showPlaceType === "always" || (showPlaceType && !feature.address && !feature.id.startsWith("road.") && !feature.id.startsWith("address.") && !feature.id.startsWith("postal_code.") && (!feature.id.startsWith("poi.") || !imageUrl) && !isReverse)}
|
|
61
|
+
{#if showPlaceType === "always" || (showPlaceType !== "never" && !feature.address && !feature.id.startsWith("road.") && !feature.id.startsWith("address.") && !feature.id.startsWith("postal_code.") && (!feature.id.startsWith("poi.") || !imageUrl) && !isReverse)}
|
|
62
62
|
<span class="secondary">
|
|
63
63
|
{placeType}
|
|
64
64
|
</span>
|
|
@@ -60,9 +60,10 @@ export let proximity = [
|
|
|
60
60
|
export let reverseActive = enableReverse === "always";
|
|
61
61
|
export let reverseButtonTitle = "toggle reverse geocoding";
|
|
62
62
|
export let searchValue = "";
|
|
63
|
-
export let
|
|
64
|
-
export let showPlaceType = "
|
|
63
|
+
export let pickedResultStyle = "full-geometry";
|
|
64
|
+
export let showPlaceType = "if-needed";
|
|
65
65
|
export let showResultsWhileTyping = true;
|
|
66
|
+
export let autocompleteTimeout = undefined;
|
|
66
67
|
export let selectFirst = true;
|
|
67
68
|
export let flyToSelected = false;
|
|
68
69
|
export let markerOnSelected = true;
|
|
@@ -70,11 +71,10 @@ export let types = undefined;
|
|
|
70
71
|
export let exhaustiveReverseGeocoding = false;
|
|
71
72
|
export let excludeTypes = false;
|
|
72
73
|
export let zoom = ZOOM_DEFAULTS;
|
|
73
|
-
export let maxZoom = undefined;
|
|
74
74
|
export let apiUrl = "https://api.maptiler.com/geocoding";
|
|
75
75
|
export let fetchParameters = {};
|
|
76
76
|
export let iconsBaseUrl = "https://cdn.maptiler.com/maptiler-geocoding-control/v" +
|
|
77
|
-
"
|
|
77
|
+
"2.0.0-rc.2" +
|
|
78
78
|
"/icons/";
|
|
79
79
|
export let adjustUrlQuery = () => { };
|
|
80
80
|
export function focus() {
|
|
@@ -87,7 +87,7 @@ export function setQuery(value, submit = true, reverse = false) {
|
|
|
87
87
|
searchValue = value;
|
|
88
88
|
if (submit) {
|
|
89
89
|
selectedItemIndex = -1;
|
|
90
|
-
|
|
90
|
+
handleSubmit();
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
handleInput(!reverse, reverse);
|
|
@@ -117,6 +117,7 @@ let error;
|
|
|
117
117
|
let cachedFeatures = [];
|
|
118
118
|
let abortController;
|
|
119
119
|
let searchTimeoutRef;
|
|
120
|
+
let autocompleteTimeoutRef;
|
|
120
121
|
let focusedDelayed;
|
|
121
122
|
let prevIdToFly;
|
|
122
123
|
const missingIconsCache = new Set();
|
|
@@ -124,7 +125,7 @@ const dispatch = createEventDispatcher();
|
|
|
124
125
|
$: {
|
|
125
126
|
reverseActive = enableReverse === "always";
|
|
126
127
|
}
|
|
127
|
-
$: if (
|
|
128
|
+
$: if (pickedResultStyle !== "marker-only" &&
|
|
128
129
|
picked &&
|
|
129
130
|
!picked.address &&
|
|
130
131
|
picked.geometry.type === "Point" &&
|
|
@@ -180,8 +181,13 @@ $: setTimeout(() => {
|
|
|
180
181
|
searchValue = "";
|
|
181
182
|
}
|
|
182
183
|
});
|
|
184
|
+
function isInAutocompleteTimeout() {
|
|
185
|
+
return !!autocompleteTimeoutRef;
|
|
186
|
+
}
|
|
183
187
|
$: if (selectFirst && listFeatures?.length) {
|
|
184
|
-
|
|
188
|
+
if (!isInAutocompleteTimeout()) {
|
|
189
|
+
selectedItemIndex = 0;
|
|
190
|
+
}
|
|
185
191
|
}
|
|
186
192
|
// clear selection on edit
|
|
187
193
|
$: {
|
|
@@ -190,17 +196,23 @@ $: {
|
|
|
190
196
|
selectedItemIndex = -1;
|
|
191
197
|
}
|
|
192
198
|
$: selected = listFeatures?.[selectedItemIndex];
|
|
199
|
+
$: if (selected) {
|
|
200
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
201
|
+
autocompleteTimeoutRef = undefined;
|
|
202
|
+
}
|
|
193
203
|
$: if (mapController) {
|
|
194
204
|
const coords = isQueryReverse(searchValue);
|
|
195
205
|
mapController.setReverseMarker(coords ? [coords.decimalLongitude, coords.decimalLatitude] : undefined);
|
|
196
206
|
}
|
|
197
|
-
$: dispatch("select", selected);
|
|
198
|
-
$: dispatch("pick", picked);
|
|
199
|
-
$: dispatch("
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
$: dispatch("
|
|
203
|
-
$: dispatch("
|
|
207
|
+
$: dispatch("select", { feature: selected });
|
|
208
|
+
$: dispatch("pick", { feature: picked });
|
|
209
|
+
$: dispatch("optionsvisibilitychange", {
|
|
210
|
+
optionsVisible: focusedDelayed && !!listFeatures,
|
|
211
|
+
});
|
|
212
|
+
$: dispatch("featureslisted", { features: listFeatures });
|
|
213
|
+
$: dispatch("featuresmarked", { features: markedFeatures });
|
|
214
|
+
$: dispatch("reversetoggle", { reverse: reverseActive });
|
|
215
|
+
$: dispatch("querychange", { query: searchValue });
|
|
204
216
|
$: if (mapController) {
|
|
205
217
|
mapController.indicateReverse(reverseActive);
|
|
206
218
|
}
|
|
@@ -244,11 +256,17 @@ onDestroy(() => {
|
|
|
244
256
|
mapController.setMarkers(undefined, undefined);
|
|
245
257
|
}
|
|
246
258
|
});
|
|
247
|
-
function
|
|
259
|
+
function handleSubmit(event) {
|
|
248
260
|
if (searchTimeoutRef) {
|
|
249
|
-
clearTimeout(searchTimeoutRef);
|
|
261
|
+
window.clearTimeout(searchTimeoutRef);
|
|
250
262
|
searchTimeoutRef = undefined;
|
|
251
263
|
}
|
|
264
|
+
if (autocompleteTimeoutRef) {
|
|
265
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
266
|
+
autocompleteTimeoutRef = undefined;
|
|
267
|
+
search(searchValue, { exact: true });
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
252
270
|
if (selectedItemIndex > -1 && listFeatures) {
|
|
253
271
|
picked = listFeatures[selectedItemIndex];
|
|
254
272
|
searchValue =
|
|
@@ -280,7 +298,7 @@ function isQueryReverse(searchValue) {
|
|
|
280
298
|
return false;
|
|
281
299
|
}
|
|
282
300
|
}
|
|
283
|
-
async function search(searchValue, { byId = false, exact = false, } = {}) {
|
|
301
|
+
async function search(searchValue, { byId = false, exact = false, appendSpace = false, } = {}) {
|
|
284
302
|
error = undefined;
|
|
285
303
|
abortController?.abort();
|
|
286
304
|
const ac = new AbortController();
|
|
@@ -323,7 +341,7 @@ async function search(searchValue, { byId = false, exact = false, } = {}) {
|
|
|
323
341
|
"/" +
|
|
324
342
|
encodeURIComponent(isReverse
|
|
325
343
|
? isReverse.decimalLongitude + "," + isReverse.decimalLatitude
|
|
326
|
-
: searchValue) +
|
|
344
|
+
: searchValue + (appendSpace ? " " : "")) +
|
|
327
345
|
".json?" +
|
|
328
346
|
sp.toString();
|
|
329
347
|
if (url === lastSearchUrl) {
|
|
@@ -411,12 +429,11 @@ function zoomToResults() {
|
|
|
411
429
|
for (const feature of markedFeatures) {
|
|
412
430
|
const featZoom = computeZoom(feature);
|
|
413
431
|
allZoom =
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
: Math.max(allZoom, featZoom));
|
|
432
|
+
allZoom === undefined
|
|
433
|
+
? featZoom
|
|
434
|
+
: featZoom === undefined
|
|
435
|
+
? allZoom
|
|
436
|
+
: Math.max(allZoom, featZoom);
|
|
420
437
|
if (fuzzyOnly || !feature.matching_text) {
|
|
421
438
|
for (const i of [0, 1, 2, 3]) {
|
|
422
439
|
bbox[i] = Math[i < 2 ? "min" : "max"](bbox[i], feature.bbox?.[i] ?? feature.center[i % 2]);
|
|
@@ -438,11 +455,6 @@ function computeZoom(feature) {
|
|
|
438
455
|
feature.bbox[1] !== feature.bbox[3])) {
|
|
439
456
|
return undefined;
|
|
440
457
|
}
|
|
441
|
-
if (typeof zoom === "number") {
|
|
442
|
-
return feature.id.startsWith("poi.") || feature.id.startsWith("address.")
|
|
443
|
-
? maxZoom
|
|
444
|
-
: zoom;
|
|
445
|
-
}
|
|
446
458
|
const index = feature.id.replace(/\..*/, "");
|
|
447
459
|
return ((Array.isArray(feature.properties?.categories)
|
|
448
460
|
? feature.properties.categories.reduce((a, category) => {
|
|
@@ -481,21 +493,29 @@ function handleKeyDown(e) {
|
|
|
481
493
|
}
|
|
482
494
|
function handleInput(debounce = true, reverse = false) {
|
|
483
495
|
error = undefined;
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
if (searchValue.length < minLength) {
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
const sv = searchValue;
|
|
492
|
-
searchTimeoutRef = window.setTimeout(() => {
|
|
493
|
-
search(sv).catch((err) => (error = err));
|
|
494
|
-
}, debounce ? debounceSearch : 0);
|
|
496
|
+
if (searchTimeoutRef) {
|
|
497
|
+
window.clearTimeout(searchTimeoutRef);
|
|
498
|
+
searchTimeoutRef = undefined;
|
|
495
499
|
}
|
|
496
|
-
|
|
500
|
+
if (autocompleteTimeoutRef) {
|
|
501
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
502
|
+
autocompleteTimeoutRef = undefined;
|
|
503
|
+
}
|
|
504
|
+
if ((!showResultsWhileTyping && !reverse) ||
|
|
505
|
+
searchValue.length < minLength) {
|
|
497
506
|
listFeatures = undefined;
|
|
498
|
-
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const sv = searchValue;
|
|
510
|
+
searchTimeoutRef = window.setTimeout(() => {
|
|
511
|
+
searchTimeoutRef = undefined;
|
|
512
|
+
search(sv).catch((err) => (error = err));
|
|
513
|
+
}, debounce ? debounceSearch : 0);
|
|
514
|
+
if (!searchValue.endsWith(" ")) {
|
|
515
|
+
autocompleteTimeoutRef = window.setTimeout(() => {
|
|
516
|
+
autocompleteTimeoutRef = undefined;
|
|
517
|
+
search(sv, { appendSpace: true }).catch((err) => (error = err));
|
|
518
|
+
}, autocompleteTimeout);
|
|
499
519
|
}
|
|
500
520
|
}
|
|
501
521
|
function pick(feature) {
|
|
@@ -513,7 +533,7 @@ function pick(feature) {
|
|
|
513
533
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
514
534
|
<form
|
|
515
535
|
tabindex="0"
|
|
516
|
-
on:submit|preventDefault={
|
|
536
|
+
on:submit|preventDefault={handleSubmit}
|
|
517
537
|
class:can-collapse={collapsed && searchValue === ""}
|
|
518
538
|
class={className}
|
|
519
539
|
>
|
|
@@ -584,6 +604,7 @@ function pick(feature) {
|
|
|
584
604
|
</div>
|
|
585
605
|
{:else if focusedDelayed && listFeatures?.length}
|
|
586
606
|
<ul
|
|
607
|
+
class="options"
|
|
587
608
|
on:mouseleave={() => {
|
|
588
609
|
if (!selectFirst) {
|
|
589
610
|
selectedItemIndex = -1;
|
|
@@ -726,10 +747,11 @@ div.no-results :global(svg) {
|
|
|
726
747
|
height: 30px;
|
|
727
748
|
}
|
|
728
749
|
|
|
729
|
-
:global(.
|
|
730
|
-
:global(.maplibregl-ctrl-bottom-
|
|
750
|
+
:global(.leaflet-bottom) ul.options,
|
|
751
|
+
:global(.maplibregl-ctrl-bottom-left) ul.options,
|
|
752
|
+
:global(.maplibregl-ctrl-bottom-right) ul.options {
|
|
731
753
|
top: auto;
|
|
732
|
-
bottom: 100
|
|
754
|
+
bottom: calc(100% + 6px);
|
|
733
755
|
}
|
|
734
756
|
|
|
735
757
|
button {
|
|
@@ -26,17 +26,17 @@ declare const __propDef: {
|
|
|
26
26
|
reverseActive?: boolean;
|
|
27
27
|
reverseButtonTitle?: string;
|
|
28
28
|
searchValue?: string;
|
|
29
|
-
|
|
30
|
-
showPlaceType?:
|
|
29
|
+
pickedResultStyle?: "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
|
|
30
|
+
showPlaceType?: "never" | "always" | "if-needed";
|
|
31
31
|
showResultsWhileTyping?: boolean;
|
|
32
|
+
autocompleteTimeout?: number | undefined;
|
|
32
33
|
selectFirst?: boolean;
|
|
33
34
|
flyToSelected?: boolean;
|
|
34
35
|
markerOnSelected?: boolean;
|
|
35
36
|
types?: string[] | undefined;
|
|
36
37
|
exhaustiveReverseGeocoding?: boolean;
|
|
37
38
|
excludeTypes?: boolean;
|
|
38
|
-
zoom?:
|
|
39
|
-
maxZoom?: number | undefined;
|
|
39
|
+
zoom?: Record<string, number>;
|
|
40
40
|
apiUrl?: string;
|
|
41
41
|
fetchParameters?: RequestInit;
|
|
42
42
|
iconsBaseUrl?: string;
|
|
@@ -48,17 +48,31 @@ declare const __propDef: {
|
|
|
48
48
|
clearMap?: () => void;
|
|
49
49
|
};
|
|
50
50
|
events: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
featureslisted: CustomEvent<{
|
|
52
|
+
features: Feature[] | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
featuresmarked: CustomEvent<{
|
|
55
|
+
features: Feature[] | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
optionsvisibilitychange: CustomEvent<{
|
|
58
|
+
optionsVisible: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
pick: CustomEvent<{
|
|
61
|
+
feature: Feature | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
querychange: CustomEvent<{
|
|
64
|
+
query: string;
|
|
65
|
+
}>;
|
|
56
66
|
response: CustomEvent<{
|
|
57
67
|
url: string;
|
|
58
68
|
featureCollection: FeatureCollection;
|
|
59
69
|
}>;
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
reversetoggle: CustomEvent<{
|
|
71
|
+
reverse: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
select: CustomEvent<{
|
|
74
|
+
feature: Feature | undefined;
|
|
75
|
+
}>;
|
|
62
76
|
} & {
|
|
63
77
|
[evt: string]: CustomEvent<any>;
|
|
64
78
|
};
|