@maptiler/geocoding-control 2.1.2 → 2.1.3-rc1
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/icons/sprite.json +259 -0
- package/icons/sprite.png +0 -0
- package/icons/sprite@2x.json +259 -0
- package/icons/sprite@2x.png +0 -0
- package/leaflet.js +1668 -1581
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +13 -1
- package/leaflet.umd.js.map +1 -1
- package/maplibregl.js +1405 -1318
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +13 -1
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +1406 -1319
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +13 -1
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers.js +1471 -1384
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +13 -1
- package/openlayers.umd.js.map +1 -1
- package/package.json +5 -5
- package/react.js +985 -898
- package/react.js.map +1 -1
- package/react.umd.js +13 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +70 -18
- package/svelte/GeocodingControl.svelte +46 -17
- package/svelte/GeocodingControl.svelte.d.ts +1 -0
- package/svelte/info.json +1 -1
- package/svelte/types.d.ts +1 -0
- package/types.d.ts +1 -0
- package/vanilla.js +1028 -941
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +13 -1
- package/vanilla.umd.js.map +1 -1
- package/icons/aerialway.svg +0 -1
- package/icons/airfield.svg +0 -1
- package/icons/airport.svg +0 -6
- package/icons/alcohol_shop.svg +0 -1
- package/icons/american_football.svg +0 -1
- package/icons/animal_shelter.svg +0 -4
- package/icons/aquarium.svg +0 -1
- package/icons/art_gallery.svg +0 -4
- package/icons/atm.svg +0 -5
- package/icons/attraction.svg +0 -1
- package/icons/bakery.svg +0 -1
- package/icons/bank.svg +0 -1
- package/icons/bar.svg +0 -1
- package/icons/barrier.svg +0 -4
- package/icons/baseball.svg +0 -4
- package/icons/basketball.svg +0 -4
- package/icons/bbq.svg +0 -4
- package/icons/beach.svg +0 -4
- package/icons/beer.svg +0 -4
- package/icons/bench.svg +0 -4
- package/icons/bicycle.svg +0 -4
- package/icons/bicycle_parking.svg +0 -5
- package/icons/bicycle_rental.svg +0 -5
- package/icons/bicycle_share.svg +0 -1
- package/icons/billiards.svg +0 -4
- package/icons/board.svg +0 -4
- package/icons/bollard.svg +0 -4
- package/icons/bowling.svg +0 -4
- package/icons/buddhist.svg +0 -1
- package/icons/building.svg +0 -4
- package/icons/bulldozer.svg +0 -4
- package/icons/bus_guided.svg +0 -4
- package/icons/bus_stop.svg +0 -1
- package/icons/bus_trolley.svg +0 -4
- package/icons/butcher.svg +0 -4
- package/icons/cafe.svg +0 -1
- package/icons/camper_trailer.svg +0 -4
- package/icons/campfire.svg +0 -4
- package/icons/campsite.svg +0 -1
- package/icons/car.svg +0 -1
- package/icons/car_rental.svg +0 -1
- package/icons/car_repair.svg +0 -14
- package/icons/casino.svg +0 -1
- package/icons/castle.svg +0 -1
- package/icons/caution.svg +0 -4
- package/icons/cemetery.svg +0 -4
- package/icons/charging_station.svg +0 -4
- package/icons/christian.svg +0 -5
- package/icons/cinema.svg +0 -1
- package/icons/circle-dot.svg +0 -4
- package/icons/circle-stroke.svg +0 -4
- package/icons/circle.svg +0 -4
- package/icons/city.svg +0 -4
- package/icons/clothing_store.svg +0 -1
- package/icons/college.svg +0 -1
- package/icons/commercial.svg +0 -1
- package/icons/communications_tower.svg +0 -4
- package/icons/confectionery.svg +0 -4
- package/icons/construction.svg +0 -4
- package/icons/convenience.svg +0 -1
- package/icons/cricket.svg +0 -4
- package/icons/cross.svg +0 -4
- package/icons/cycle_barrier.svg +0 -4
- package/icons/dam.svg +0 -4
- package/icons/danger.svg +0 -4
- package/icons/defibrillator.svg +0 -1
- package/icons/dentist.svg +0 -1
- package/icons/diamond.svg +0 -4
- package/icons/diamond_stroked.svg +0 -4
- package/icons/diplomatic.svg +0 -1
- package/icons/doctors.svg +0 -1
- package/icons/dog_park.svg +0 -1
- package/icons/dot.svg +0 -4
- package/icons/drinking_water.svg +0 -4
- package/icons/elevator.svg +0 -1
- package/icons/emergency_phone.svg +0 -4
- package/icons/entrance.svg +0 -4
- package/icons/farm.svg +0 -4
- package/icons/fast_food.svg +0 -1
- package/icons/fence.svg +0 -4
- package/icons/ferry_terminal.svg +0 -1
- package/icons/fire_station.svg +0 -1
- package/icons/fitness_centre.svg +0 -1
- package/icons/florist.svg +0 -4
- package/icons/fountain.svg +0 -1
- package/icons/fuel.svg +0 -1
- package/icons/furniture.svg +0 -4
- package/icons/gaming.svg +0 -4
- package/icons/garden.svg +0 -4
- package/icons/garden_centre.svg +0 -4
- package/icons/gate.svg +0 -4
- package/icons/gift.svg +0 -1
- package/icons/globe.svg +0 -4
- package/icons/golf.svg +0 -1
- package/icons/golf_green.svg +0 -4
- package/icons/gondola.svg +0 -4
- package/icons/grocery.svg +0 -1
- package/icons/guidepost.svg +0 -4
- package/icons/hairdresser.svg +0 -1
- package/icons/harbor.svg +0 -1
- package/icons/hardware.svg +0 -4
- package/icons/heart.svg +0 -4
- package/icons/heliport.svg +0 -4
- package/icons/highway_rest_area.svg +0 -4
- package/icons/hinduist.svg +0 -1
- package/icons/historic.svg +0 -1
- package/icons/home.svg +0 -4
- package/icons/horse_riding.svg +0 -1
- package/icons/hospital.svg +0 -1
- package/icons/hot_spring.svg +0 -4
- package/icons/hut.svg +0 -1
- package/icons/ice_cream.svg +0 -1
- package/icons/industry.svg +0 -4
- package/icons/information.svg +0 -1
- package/icons/jewelry.svg +0 -1
- package/icons/jewish.svg +0 -1
- package/icons/karaoke.svg +0 -4
- package/icons/landmark.svg +0 -1
- package/icons/laundry.svg +0 -1
- package/icons/library.svg +0 -1
- package/icons/lift_gate.svg +0 -4
- package/icons/light_rail.svg +0 -4
- package/icons/lighthouse.svg +0 -4
- package/icons/lodging.svg +0 -1
- package/icons/marker.svg +0 -4
- package/icons/marker_stroked.svg +0 -4
- package/icons/mobile_phone.svg +0 -1
- package/icons/monorail.svg +0 -4
- package/icons/monument.svg +0 -1
- package/icons/motorcycle.svg +0 -4
- package/icons/motorcycle_parking.svg +0 -4
- package/icons/motorcycle_rental.svg +0 -4
- package/icons/motorcycle_repair.svg +0 -4
- package/icons/museum.svg +0 -1
- package/icons/music.svg +0 -1
- package/icons/muslim.svg +0 -1
- package/icons/natural.svg +0 -4
- package/icons/noodle.svg +0 -4
- package/icons/obelisk.svg +0 -4
- package/icons/observation_tower.svg +0 -4
- package/icons/oneway.svg +0 -4
- package/icons/optician.svg +0 -4
- package/icons/outdoor.svg +0 -1
- package/icons/paint.svg +0 -1
- package/icons/park.svg +0 -4
- package/icons/parking.svg +0 -1
- package/icons/parking_garage.svg +0 -1
- package/icons/parking_paid.svg +0 -4
- package/icons/peak.svg +0 -1
- package/icons/perfumery.svg +0 -1
- package/icons/pharmacy.svg +0 -1
- package/icons/picnic_site.svg +0 -1
- package/icons/pin.svg +0 -4
- package/icons/pipe.svg +0 -4
- package/icons/pitch.svg +0 -1
- package/icons/pizza.svg +0 -4
- package/icons/place_of_worship.svg +0 -4
- package/icons/playground.svg +0 -4
- package/icons/police.svg +0 -1
- package/icons/post.svg +0 -1
- package/icons/prison.svg +0 -1
- package/icons/racetrack.svg +0 -4
- package/icons/radiation.svg +0 -4
- package/icons/railway.svg +0 -4
- package/icons/ranger_station.svg +0 -4
- package/icons/recycling.svg +0 -4
- package/icons/restaurant.svg +0 -1
- package/icons/road_accident.svg +0 -4
- package/icons/roadblock.svg +0 -4
- package/icons/rocket.svg +0 -4
- package/icons/school.svg +0 -1
- package/icons/school_bus.svg +0 -4
- package/icons/scooter.svg +0 -1
- package/icons/sculpture.svg +0 -4
- package/icons/seafood.svg +0 -4
- package/icons/shelter.svg +0 -4
- package/icons/shinto.svg +0 -1
- package/icons/shoes.svg +0 -4
- package/icons/shop.svg +0 -1
- package/icons/sikh.svg +0 -4
- package/icons/skateboard.svg +0 -1
- package/icons/snow.svg +0 -4
- package/icons/soccer.svg +0 -4
- package/icons/spring.svg +0 -4
- package/icons/square.svg +0 -4
- package/icons/square_stroked.svg +0 -4
- package/icons/stadium.svg +0 -1
- package/icons/star.svg +0 -4
- package/icons/star_stroked.svg +0 -4
- package/icons/statue.svg +0 -4
- package/icons/subway.svg +0 -4
- package/icons/suitcase.svg +0 -1
- package/icons/sushi.svg +0 -4
- package/icons/swimming.svg +0 -5
- package/icons/swimming_pool.svg +0 -8
- package/icons/tako.svg +0 -4
- package/icons/taoist.svg +0 -1
- package/icons/taxi.svg +0 -4
- package/icons/teahouse.svg +0 -4
- package/icons/telephone.svg +0 -1
- package/icons/tennis.svg +0 -1
- package/icons/terminal.svg +0 -4
- package/icons/theatre.svg +0 -1
- package/icons/theme_park.svg +0 -4
- package/icons/toilets.svg +0 -1
- package/icons/toll.svg +0 -1
- package/icons/town.svg +0 -4
- package/icons/town_hall.svg +0 -4
- package/icons/tram_stop.svg +0 -4
- package/icons/tramway.svg +0 -1
- package/icons/transit.svg +0 -4
- package/icons/triangle.svg +0 -4
- package/icons/triangle_stroked.svg +0 -4
- package/icons/truck.svg +0 -4
- package/icons/tunnel.svg +0 -4
- package/icons/veterinary.svg +0 -4
- package/icons/viewpoint.svg +0 -4
- package/icons/village.svg +0 -4
- package/icons/volcano.svg +0 -1
- package/icons/volleyball.svg +0 -4
- package/icons/warehouse.svg +0 -4
- package/icons/waste_basket.svg +0 -1
- package/icons/watches.svg +0 -1
- package/icons/water.svg +0 -4
- package/icons/water_park.svg +0 -6
- package/icons/water_tower.svg +0 -4
- package/icons/watermill.svg +0 -4
- package/icons/wetland.svg +0 -4
- package/icons/wheelchair.svg +0 -1
- package/icons/windmill.svg +0 -1
- package/icons/wine.svg +0 -4
- package/icons/zoo.svg +0 -1
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-
|
|
1
|
+
svg.svelte-d2loi5{display:block;fill:#e15042}.sprite-icon.svelte-w9y5n9.svelte-w9y5n9{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li.svelte-w9y5n9.svelte-w9y5n9{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.svelte-w9y5n9.svelte-w9y5n9:first-child{padding-top:10px}li.svelte-w9y5n9.svelte-w9y5n9:last-child{padding-bottom:10px}li.picked.svelte-w9y5n9.svelte-w9y5n9{background-color:#e7edff}li.picked.svelte-w9y5n9 .secondary.svelte-w9y5n9{color:#96a4c7;padding-left:4px}li.picked.svelte-w9y5n9 .line2.svelte-w9y5n9{color:#96a4c7}li.selected.svelte-w9y5n9.svelte-w9y5n9{background-color:#f3f6ff}li.selected.svelte-w9y5n9.svelte-w9y5n9{animation:svelte-w9y5n9-backAndForth 5s linear infinite}li.selected.svelte-w9y5n9 .primary.svelte-w9y5n9{color:#2b8bfb}li.selected.svelte-w9y5n9 .secondary.svelte-w9y5n9{color:#a2adc7;padding-left:4px}li.selected.svelte-w9y5n9 .line2.svelte-w9y5n9{color:#a2adc7}li.svelte-w9y5n9>img.svelte-w9y5n9{align-self:center;justify-self:center;opacity:.75}.texts.svelte-w9y5n9.svelte-w9y5n9{padding:0 17px 0 0}.texts.svelte-w9y5n9>.svelte-w9y5n9{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-w9y5n9.svelte-w9y5n9{font-weight:600}.secondary.svelte-w9y5n9.svelte-w9y5n9{color:#aeb6c7;padding-left:4px}.line2.svelte-w9y5n9.svelte-w9y5n9{color:#aeb6c7}@keyframes svelte-w9y5n9-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}
|
|
@@ -1,36 +1,69 @@
|
|
|
1
|
+
<script context="module">"use strict";
|
|
2
|
+
const hidpi = devicePixelRatio > 1.25;
|
|
3
|
+
const scaleUrl = hidpi ? "@2x" : "";
|
|
4
|
+
const scaleFactor = hidpi ? 2 : 1;
|
|
5
|
+
let sprites;
|
|
6
|
+
let spritePromise;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
1
9
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
10
|
export let feature;
|
|
3
11
|
export let style = "default";
|
|
4
12
|
export let showPlaceType;
|
|
5
13
|
export let missingIconsCache;
|
|
6
14
|
export let iconsBaseUrl;
|
|
15
|
+
$: categories = feature.properties?.categories;
|
|
16
|
+
$: isReverse = feature.place_type[0] === "reverse";
|
|
7
17
|
const dispatch = createEventDispatcher();
|
|
8
|
-
const categories = feature.properties?.categories;
|
|
9
18
|
let category;
|
|
10
19
|
let imageUrl;
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
$: index = categories?.length ?? 0;
|
|
14
|
-
$: {
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
16
|
-
loadIconAttempt;
|
|
17
|
-
do {
|
|
18
|
-
index--;
|
|
19
|
-
category = categories?.[index];
|
|
20
|
-
imageUrl = category
|
|
21
|
-
? iconsBaseUrl + category.replace(/ /g, "_") + ".svg"
|
|
22
|
-
: undefined;
|
|
23
|
-
} while (index > -1 && (!imageUrl || missingIconsCache.has(imageUrl)));
|
|
24
|
-
}
|
|
20
|
+
let spriteIcon;
|
|
21
|
+
let index;
|
|
25
22
|
$: placeType =
|
|
26
23
|
feature.properties?.categories?.join(", ") ??
|
|
27
24
|
feature.properties?.place_type_name?.[0] ??
|
|
28
25
|
feature.place_type[0];
|
|
26
|
+
$: {
|
|
27
|
+
index = categories?.length ?? 0;
|
|
28
|
+
loadIcon();
|
|
29
|
+
}
|
|
30
|
+
function loadSprites() {
|
|
31
|
+
spritePromise ??= fetch(`${iconsBaseUrl}/sprite${scaleUrl}.json`)
|
|
32
|
+
.then((response) => response.json())
|
|
33
|
+
.then((data) => {
|
|
34
|
+
sprites = data;
|
|
35
|
+
})
|
|
36
|
+
.catch(() => {
|
|
37
|
+
sprites = null;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
29
40
|
function handleImgError() {
|
|
30
41
|
if (imageUrl) {
|
|
31
42
|
missingIconsCache.add(imageUrl);
|
|
32
43
|
}
|
|
33
|
-
|
|
44
|
+
loadIcon();
|
|
45
|
+
}
|
|
46
|
+
function loadIcon() {
|
|
47
|
+
if (sprites !== undefined) {
|
|
48
|
+
loadIcon2();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
loadSprites();
|
|
52
|
+
spritePromise?.then(loadIcon2);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function loadIcon2() {
|
|
56
|
+
do {
|
|
57
|
+
index--;
|
|
58
|
+
category = categories?.[index];
|
|
59
|
+
spriteIcon = category ? sprites?.icons[category] : undefined;
|
|
60
|
+
if (spriteIcon) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
imageUrl = category
|
|
64
|
+
? iconsBaseUrl + category.replace(/ /g, "_") + ".svg"
|
|
65
|
+
: undefined;
|
|
66
|
+
} while (index > -1 && (!imageUrl || missingIconsCache.has(imageUrl)));
|
|
34
67
|
}
|
|
35
68
|
</script>
|
|
36
69
|
|
|
@@ -50,7 +83,19 @@ function handleImgError() {
|
|
|
50
83
|
}
|
|
51
84
|
}}
|
|
52
85
|
>
|
|
53
|
-
{#if
|
|
86
|
+
{#if sprites && spriteIcon}
|
|
87
|
+
<div
|
|
88
|
+
class="sprite-icon"
|
|
89
|
+
style={`
|
|
90
|
+
width: ${spriteIcon.width / scaleFactor}px;
|
|
91
|
+
height: ${spriteIcon.height / scaleFactor}px;
|
|
92
|
+
background-image: url(${iconsBaseUrl}sprite${scaleUrl}.png);
|
|
93
|
+
background-position: -${spriteIcon.x / scaleFactor}px -${spriteIcon.y / scaleFactor}px;
|
|
94
|
+
background-size: ${sprites.width / scaleFactor}px ${sprites.height / scaleFactor}px;
|
|
95
|
+
`}
|
|
96
|
+
title={placeType}
|
|
97
|
+
/>
|
|
98
|
+
{:else if imageUrl}
|
|
54
99
|
<img
|
|
55
100
|
src={imageUrl}
|
|
56
101
|
alt={category}
|
|
@@ -100,7 +145,14 @@ function handleImgError() {
|
|
|
100
145
|
</span>
|
|
101
146
|
</li>
|
|
102
147
|
|
|
103
|
-
<style
|
|
148
|
+
<style>.sprite-icon {
|
|
149
|
+
align-self: center;
|
|
150
|
+
justify-self: center;
|
|
151
|
+
opacity: 0.75;
|
|
152
|
+
background-repeat: no-repeat;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
li {
|
|
104
156
|
text-align: left;
|
|
105
157
|
cursor: default;
|
|
106
158
|
display: grid;
|
|
@@ -67,6 +67,7 @@ export let searchValue = "";
|
|
|
67
67
|
export let pickedResultStyle = "full-geometry";
|
|
68
68
|
export let showPlaceType = "if-needed";
|
|
69
69
|
export let showResultsWhileTyping = true;
|
|
70
|
+
export let autocompleteTimeout = undefined;
|
|
70
71
|
export let selectFirst = true;
|
|
71
72
|
export let flyToSelected = false;
|
|
72
73
|
export let markerOnSelected = true;
|
|
@@ -81,7 +82,7 @@ export let zoom = ZOOM_DEFAULTS;
|
|
|
81
82
|
export let apiUrl = "https://api.maptiler.com/geocoding";
|
|
82
83
|
export let fetchParameters = {};
|
|
83
84
|
export let iconsBaseUrl = "https://cdn.maptiler.com/maptiler-geocoding-control/v" +
|
|
84
|
-
"2.1.
|
|
85
|
+
"2.1.3-rc1" +
|
|
85
86
|
"/icons/";
|
|
86
87
|
/**
|
|
87
88
|
* @deprecated use `adjustUrl`
|
|
@@ -150,6 +151,7 @@ let error;
|
|
|
150
151
|
let cachedFeatures = [];
|
|
151
152
|
let abortController;
|
|
152
153
|
let searchTimeoutRef;
|
|
154
|
+
let autocompleteTimeoutRef;
|
|
153
155
|
let focusedDelayed;
|
|
154
156
|
let prevIdToFly;
|
|
155
157
|
let focused = false;
|
|
@@ -209,6 +211,14 @@ $: setTimeout(() => {
|
|
|
209
211
|
searchValue = "";
|
|
210
212
|
}
|
|
211
213
|
});
|
|
214
|
+
function isInAutocompleteTimeout() {
|
|
215
|
+
return !!autocompleteTimeoutRef;
|
|
216
|
+
}
|
|
217
|
+
$: if (selectFirst && listFeatures?.length) {
|
|
218
|
+
if (!isInAutocompleteTimeout()) {
|
|
219
|
+
selectedItemIndex = 0;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
212
222
|
$: if (selectFirst &&
|
|
213
223
|
listFeatures?.length &&
|
|
214
224
|
selectedItemIndex == -1 &&
|
|
@@ -216,6 +226,10 @@ $: if (selectFirst &&
|
|
|
216
226
|
selectedItemIndex = 0;
|
|
217
227
|
}
|
|
218
228
|
$: selected = listFeatures?.[selectedItemIndex];
|
|
229
|
+
$: if (selected) {
|
|
230
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
231
|
+
autocompleteTimeoutRef = undefined;
|
|
232
|
+
}
|
|
219
233
|
$: if (mapController) {
|
|
220
234
|
const coords = isQueryReverse(searchValue);
|
|
221
235
|
mapController.setReverseMarker(coords ? [coords.decimalLongitude, coords.decimalLatitude] : undefined);
|
|
@@ -275,9 +289,15 @@ onDestroy(() => {
|
|
|
275
289
|
function handleSubmit(event) {
|
|
276
290
|
focused = false;
|
|
277
291
|
if (searchTimeoutRef) {
|
|
278
|
-
clearTimeout(searchTimeoutRef);
|
|
292
|
+
window.clearTimeout(searchTimeoutRef);
|
|
279
293
|
searchTimeoutRef = undefined;
|
|
280
294
|
}
|
|
295
|
+
if (autocompleteTimeoutRef) {
|
|
296
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
297
|
+
autocompleteTimeoutRef = undefined;
|
|
298
|
+
search(searchValue, { appendSpace: true });
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
281
301
|
if (selectedItemIndex > -1 && listFeatures) {
|
|
282
302
|
picked = listFeatures[selectedItemIndex];
|
|
283
303
|
searchValue =
|
|
@@ -309,7 +329,7 @@ function isQueryReverse(searchValue) {
|
|
|
309
329
|
return false;
|
|
310
330
|
}
|
|
311
331
|
}
|
|
312
|
-
async function search(searchValue, { byId = false, exact = false, } = {}) {
|
|
332
|
+
async function search(searchValue, { byId = false, exact = false, appendSpace = false, } = {}) {
|
|
313
333
|
error = undefined;
|
|
314
334
|
abortController?.abort();
|
|
315
335
|
const ac = new AbortController();
|
|
@@ -320,7 +340,7 @@ async function search(searchValue, { byId = false, exact = false, } = {}) {
|
|
|
320
340
|
"/" +
|
|
321
341
|
encodeURIComponent(isReverse
|
|
322
342
|
? isReverse.decimalLongitude + "," + isReverse.decimalLatitude
|
|
323
|
-
: searchValue) +
|
|
343
|
+
: searchValue + (appendSpace ? " " : "")) +
|
|
324
344
|
".json");
|
|
325
345
|
const sp = urlObj.searchParams;
|
|
326
346
|
if (language !== undefined) {
|
|
@@ -570,21 +590,29 @@ function handleInput(_, debounce = true, reverse = false) {
|
|
|
570
590
|
error = undefined;
|
|
571
591
|
picked = undefined;
|
|
572
592
|
focused = true;
|
|
573
|
-
if (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
if (searchValue.length < minLength) {
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
const sv = searchValue;
|
|
581
|
-
searchTimeoutRef = window.setTimeout(() => {
|
|
582
|
-
search(sv).catch((err) => (error = err));
|
|
583
|
-
}, debounce ? debounceSearch : 0);
|
|
593
|
+
if (searchTimeoutRef) {
|
|
594
|
+
window.clearTimeout(searchTimeoutRef);
|
|
595
|
+
searchTimeoutRef = undefined;
|
|
584
596
|
}
|
|
585
|
-
|
|
597
|
+
if (autocompleteTimeoutRef) {
|
|
598
|
+
window.clearTimeout(autocompleteTimeoutRef);
|
|
599
|
+
autocompleteTimeoutRef = undefined;
|
|
600
|
+
}
|
|
601
|
+
if ((!showResultsWhileTyping && !reverse) ||
|
|
602
|
+
searchValue.length < minLength) {
|
|
586
603
|
listFeatures = undefined;
|
|
587
|
-
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
const sv = searchValue;
|
|
607
|
+
searchTimeoutRef = window.setTimeout(() => {
|
|
608
|
+
searchTimeoutRef = undefined;
|
|
609
|
+
search(sv).catch((err) => (error = err));
|
|
610
|
+
}, debounce ? debounceSearch : 0);
|
|
611
|
+
if (!searchValue.endsWith(" ")) {
|
|
612
|
+
autocompleteTimeoutRef = window.setTimeout(() => {
|
|
613
|
+
autocompleteTimeoutRef = undefined;
|
|
614
|
+
search(sv, { appendSpace: true }).catch((err) => (error = err));
|
|
615
|
+
}, autocompleteTimeout);
|
|
588
616
|
}
|
|
589
617
|
}
|
|
590
618
|
function pick(feature) {
|
|
@@ -643,6 +671,7 @@ function handleMouseLeave() {
|
|
|
643
671
|
type="button"
|
|
644
672
|
on:click={() => {
|
|
645
673
|
searchValue = "";
|
|
674
|
+
picked = undefined;
|
|
646
675
|
input.focus();
|
|
647
676
|
}}
|
|
648
677
|
title={clearButtonTitle}
|
|
@@ -32,6 +32,7 @@ declare const __propDef: {
|
|
|
32
32
|
pickedResultStyle?: PickedResultStyle;
|
|
33
33
|
showPlaceType?: ShowPlaceType;
|
|
34
34
|
showResultsWhileTyping?: boolean;
|
|
35
|
+
autocompleteTimeout?: number | undefined;
|
|
35
36
|
selectFirst?: boolean;
|
|
36
37
|
flyToSelected?: boolean;
|
|
37
38
|
markerOnSelected?: boolean;
|
package/svelte/info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@maptiler/geocoding-control","version":"2.1.
|
|
1
|
+
{"name":"@maptiler/geocoding-control","version":"2.1.3-rc1"}
|
package/svelte/types.d.ts
CHANGED