@maptiler/geocoding-control 2.1.7 → 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/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +115 -43
- package/SECURITY.md +16 -0
- package/dist/index.js +860 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +263 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/leaflet.public.js +1251 -0
- package/dist/leaflet.public.js.map +1 -0
- package/dist/leaflet.public.umd.js +276 -0
- package/dist/leaflet.public.umd.js.map +1 -0
- package/dist/maplibregl.js +1275 -0
- package/dist/maplibregl.js.map +1 -0
- package/dist/maplibregl.umd.js +276 -0
- package/dist/maplibregl.umd.js.map +1 -0
- package/dist/maptilersdk.js +1283 -0
- package/dist/maptilersdk.js.map +1 -0
- package/dist/maptilersdk.umd.js +276 -0
- package/dist/maptilersdk.umd.js.map +1 -0
- package/dist/src/components/clear-icon.d.ts +10 -0
- package/dist/src/components/fail-icon.d.ts +10 -0
- package/dist/src/components/loading-icon.d.ts +10 -0
- package/dist/src/components/marker.d.ts +10 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
- package/dist/src/components/search-icon.d.ts +10 -0
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +27 -0
- package/dist/src/controls/leaflet-events.d.ts +42 -0
- package/dist/src/controls/leaflet-options.d.ts +84 -0
- package/dist/src/controls/maplibregl-control.d.ts +34 -0
- package/dist/src/controls/maplibregl-events.d.ts +44 -0
- package/dist/src/controls/maplibregl-options.d.ts +104 -0
- package/dist/src/controls/maptilersdk-control.d.ts +7 -0
- package/dist/src/controls/maptilersdk-events.d.ts +2 -0
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- 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-events.d.ts +46 -0
- package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
- package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +23 -143
- package/dist/src/geocoder/geocoder.d.ts +113 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/leaflet.public.d.ts +7 -0
- package/dist/src/maplibregl.d.ts +7 -0
- package/dist/src/maptilersdk.d.ts +7 -0
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +46 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/mask.d.ts +2 -0
- package/dist/src/utils/proximity.d.ts +2 -0
- package/package.json +84 -112
- package/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/geo-coordinates-parser.t.d.ts +0 -8
- package/geoUtils.d.ts +0 -3
- package/leaflet-controller.d.ts +0 -12
- package/leaflet-controller.js +0 -2475
- package/leaflet-controller.js.map +0 -1
- package/leaflet-controller.umd.js +0 -2
- package/leaflet-controller.umd.js.map +0 -1
- package/leaflet.d.ts +0 -131
- package/leaflet.js +0 -5082
- package/leaflet.js.map +0 -1
- package/leaflet.umd.js +0 -14
- package/leaflet.umd.js.map +0 -1
- package/maplibregl-controller.d.ts +0 -19
- package/maplibregl-controller.js +0 -2418
- package/maplibregl-controller.js.map +0 -1
- package/maplibregl-controller.umd.js +0 -2
- package/maplibregl-controller.umd.js.map +0 -1
- package/maplibregl.d.ts +0 -2509
- package/maplibregl.js +0 -5142
- package/maplibregl.js.map +0 -1
- package/maplibregl.umd.js +0 -14
- package/maplibregl.umd.js.map +0 -1
- package/maptilersdk.d.ts +0 -2504
- package/maptilersdk.js +0 -5152
- package/maptilersdk.js.map +0 -1
- package/maptilersdk.umd.js +0 -14
- package/maptilersdk.umd.js.map +0 -1
- package/mask.d.ts +0 -2
- package/openlayers-controller.d.ts +0 -15
- package/openlayers-controller.js +0 -2174
- package/openlayers-controller.js.map +0 -1
- package/openlayers-controller.umd.js +0 -2
- package/openlayers-controller.umd.js.map +0 -1
- package/openlayers.d.ts +0 -109
- package/openlayers.js +0 -5045
- package/openlayers.js.map +0 -1
- package/openlayers.umd.js +0 -14
- package/openlayers.umd.js.map +0 -1
- package/proximity.d.ts +0 -2
- package/react.d.ts +0 -45
- package/react.js +0 -2795
- package/react.js.map +0 -1
- package/react.umd.js +0 -14
- package/react.umd.js.map +0 -1
- package/style.css +0 -1
- package/svelte/ClearIcon.svelte +0 -12
- package/svelte/ClearIcon.svelte.d.ts +0 -25
- package/svelte/FailIcon.svelte +0 -12
- package/svelte/FailIcon.svelte.d.ts +0 -25
- package/svelte/FeatureItem.svelte +0 -246
- package/svelte/FeatureItem.svelte.d.ts +0 -26
- package/svelte/GeocodingControl.svelte +0 -921
- package/svelte/GeocodingControl.svelte.d.ts +0 -105
- package/svelte/LoadingIcon.svelte +0 -40
- package/svelte/LoadingIcon.svelte.d.ts +0 -25
- package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/svelte/MapLibreBasedGeocodingControl.js +0 -210
- package/svelte/MarkerIcon.svelte +0 -71
- package/svelte/MarkerIcon.svelte.d.ts +0 -18
- package/svelte/ReverseGeocodingIcon.svelte +0 -12
- package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
- package/svelte/SearchIcon.svelte +0 -26
- package/svelte/SearchIcon.svelte.d.ts +0 -25
- package/svelte/geo-coordinates-parser.t.d.ts +0 -8
- package/svelte/geo-coordinates-parser.t.js +0 -1
- package/svelte/geoUtils.d.ts +0 -3
- package/svelte/geoUtils.js +0 -18
- package/svelte/info.json +0 -1
- package/svelte/leaflet-controller.d.ts +0 -12
- package/svelte/leaflet-controller.js +0 -274
- package/svelte/leaflet.d.ts +0 -131
- package/svelte/leaflet.js +0 -116
- package/svelte/maplibregl-controller.d.ts +0 -19
- package/svelte/maplibregl-controller.js +0 -279
- package/svelte/maplibregl.d.ts +0 -2509
- package/svelte/maplibregl.js +0 -17
- package/svelte/maptilersdk.d.ts +0 -2504
- package/svelte/maptilersdk.js +0 -32
- package/svelte/mask.d.ts +0 -2
- package/svelte/mask.js +0 -54
- package/svelte/openlayers-controller.d.ts +0 -15
- package/svelte/openlayers-controller.js +0 -283
- package/svelte/openlayers.d.ts +0 -109
- package/svelte/openlayers.js +0 -178
- package/svelte/proximity.d.ts +0 -2
- package/svelte/proximity.js +0 -60
- package/svelte/react.d.ts +0 -45
- package/svelte/react.js +0 -106
- package/svelte/types.js +0 -1
- package/svelte/vanilla.d.ts +0 -61
- package/svelte/vanilla.js +0 -101
- package/svelte/vite-env.d.ts +0 -2
- package/types.d.ts +0 -391
- package/vanilla.d.ts +0 -61
- package/vanilla.js +0 -2799
- package/vanilla.js.map +0 -1
- package/vanilla.umd.js +0 -14
- package/vanilla.umd.js.map +0 -1
- /package/{icons → dist/icons}/10pin.svg +0 -0
- /package/{icons → dist/icons}/9pin.svg +0 -0
- /package/{icons → dist/icons}/advertising_column.svg +0 -0
- /package/{icons → dist/icons}/aerodrome.svg +0 -0
- /package/{icons → dist/icons}/alcohol.svg +0 -0
- /package/{icons → dist/icons}/alpine_hut.svg +0 -0
- /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
- /package/{icons → dist/icons}/amusement_park.svg +0 -0
- /package/{icons → dist/icons}/apartment.svg +0 -0
- /package/{icons → dist/icons}/archaeological_site.svg +0 -0
- /package/{icons → dist/icons}/area.svg +0 -0
- /package/{icons → dist/icons}/art.svg +0 -0
- /package/{icons → dist/icons}/arts_centre.svg +0 -0
- /package/{icons → dist/icons}/artwork.svg +0 -0
- /package/{icons → dist/icons}/audioguide.svg +0 -0
- /package/{icons → dist/icons}/bag.svg +0 -0
- /package/{icons → dist/icons}/beauty.svg +0 -0
- /package/{icons → dist/icons}/bed.svg +0 -0
- /package/{icons → dist/icons}/bell_tower.svg +0 -0
- /package/{icons → dist/icons}/beverages.svg +0 -0
- /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
- /package/{icons → dist/icons}/biergarten.svg +0 -0
- /package/{icons → dist/icons}/bird_hide.svg +0 -0
- /package/{icons → dist/icons}/boat_rental.svg +0 -0
- /package/{icons → dist/icons}/bookmaker.svg +0 -0
- /package/{icons → dist/icons}/books.svg +0 -0
- /package/{icons → dist/icons}/bowl.svg +0 -0
- /package/{icons → dist/icons}/bowling_alley.svg +0 -0
- /package/{icons → dist/icons}/bunker.svg +0 -0
- /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
- /package/{icons → dist/icons}/bus_station.svg +0 -0
- /package/{icons → dist/icons}/bust.svg +0 -0
- /package/{icons → dist/icons}/camping.svg +0 -0
- /package/{icons → dist/icons}/car_parts.svg +0 -0
- /package/{icons → dist/icons}/car_wash.svg +0 -0
- /package/{icons → dist/icons}/caravan_park.svg +0 -0
- /package/{icons → dist/icons}/carpet.svg +0 -0
- /package/{icons → dist/icons}/cattle_grid.svg +0 -0
- /package/{icons → dist/icons}/cave_entrance.svg +0 -0
- /package/{icons → dist/icons}/chalet.svg +0 -0
- /package/{icons → dist/icons}/charity.svg +0 -0
- /package/{icons → dist/icons}/chemist.svg +0 -0
- /package/{icons → dist/icons}/chimney.svg +0 -0
- /package/{icons → dist/icons}/church.svg +0 -0
- /package/{icons → dist/icons}/city_gate.svg +0 -0
- /package/{icons → dist/icons}/clinic.svg +0 -0
- /package/{icons → dist/icons}/clothes.svg +0 -0
- /package/{icons → dist/icons}/coffee.svg +0 -0
- /package/{icons → dist/icons}/community_centre.svg +0 -0
- /package/{icons → dist/icons}/computer.svg +0 -0
- /package/{icons → dist/icons}/consulate.svg +0 -0
- /package/{icons → dist/icons}/copyshop.svg +0 -0
- /package/{icons → dist/icons}/cosmetics.svg +0 -0
- /package/{icons → dist/icons}/courthouse.svg +0 -0
- /package/{icons → dist/icons}/crane.svg +0 -0
- /package/{icons → dist/icons}/dairy.svg +0 -0
- /package/{icons → dist/icons}/deli.svg +0 -0
- /package/{icons → dist/icons}/department_store.svg +0 -0
- /package/{icons → dist/icons}/diy.svg +0 -0
- /package/{icons → dist/icons}/electronics.svg +0 -0
- /package/{icons → dist/icons}/embankment.svg +0 -0
- /package/{icons → dist/icons}/embassy.svg +0 -0
- /package/{icons → dist/icons}/excrement_bags.svg +0 -0
- /package/{icons → dist/icons}/fabric.svg +0 -0
- /package/{icons → dist/icons}/farmyard.svg +0 -0
- /package/{icons → dist/icons}/ferry.svg +0 -0
- /package/{icons → dist/icons}/firepit.svg +0 -0
- /package/{icons → dist/icons}/firestation.svg +0 -0
- /package/{icons → dist/icons}/fishing.svg +0 -0
- /package/{icons → dist/icons}/fitness.svg +0 -0
- /package/{icons → dist/icons}/ford.svg +0 -0
- /package/{icons → dist/icons}/fort.svg +0 -0
- /package/{icons → dist/icons}/fortress.svg +0 -0
- /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
- /package/{icons → dist/icons}/generator_wind.svg +0 -0
- /package/{icons → dist/icons}/golf_pin.svg +0 -0
- /package/{icons → dist/icons}/greengrocer.svg +0 -0
- /package/{icons → dist/icons}/guest_house.svg +0 -0
- /package/{icons → dist/icons}/helipad.svg +0 -0
- /package/{icons → dist/icons}/hifi.svg +0 -0
- /package/{icons → dist/icons}/hostel.svg +0 -0
- /package/{icons → dist/icons}/hotel.svg +0 -0
- /package/{icons → dist/icons}/housenumber.svg +0 -0
- /package/{icons → dist/icons}/houseware.svg +0 -0
- /package/{icons → dist/icons}/hunting_stand.svg +0 -0
- /package/{icons → dist/icons}/interior_decoration.svg +0 -0
- /package/{icons → dist/icons}/internet_cafe.svg +0 -0
- /package/{icons → dist/icons}/kindergarten.svg +0 -0
- /package/{icons → dist/icons}/kissing_gate.svg +0 -0
- /package/{icons → dist/icons}/manor.svg +0 -0
- /package/{icons → dist/icons}/map.svg +0 -0
- /package/{icons → dist/icons}/marker_reverse.svg +0 -0
- /package/{icons → dist/icons}/marker_selected.svg +0 -0
- /package/{icons → dist/icons}/marker_unselected.svg +0 -0
- /package/{icons → dist/icons}/marketplace.svg +0 -0
- /package/{icons → dist/icons}/massage.svg +0 -0
- /package/{icons → dist/icons}/mast.svg +0 -0
- /package/{icons → dist/icons}/mast_communications.svg +0 -0
- /package/{icons → dist/icons}/mast_lighting.svg +0 -0
- /package/{icons → dist/icons}/medical_supply.svg +0 -0
- /package/{icons → dist/icons}/memorial.svg +0 -0
- /package/{icons → dist/icons}/miniature_golf.svg +0 -0
- /package/{icons → dist/icons}/motel.svg +0 -0
- /package/{icons → dist/icons}/mountain_range.svg +0 -0
- /package/{icons → dist/icons}/multifaith.svg +0 -0
- /package/{icons → dist/icons}/musical_instrument.svg +0 -0
- /package/{icons → dist/icons}/newsagent.svg +0 -0
- /package/{icons → dist/icons}/nightclub.svg +0 -0
- /package/{icons → dist/icons}/ocean.svg +0 -0
- /package/{icons → dist/icons}/office.svg +0 -0
- /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
- /package/{icons → dist/icons}/palace.svg +0 -0
- /package/{icons → dist/icons}/parcel_locker.svg +0 -0
- /package/{icons → dist/icons}/parking_space.svg +0 -0
- /package/{icons → dist/icons}/parking_tickets.svg +0 -0
- /package/{icons → dist/icons}/pet.svg +0 -0
- /package/{icons → dist/icons}/photo.svg +0 -0
- /package/{icons → dist/icons}/picnic.svg +0 -0
- /package/{icons → dist/icons}/plaque.svg +0 -0
- /package/{icons → dist/icons}/poi.svg +0 -0
- /package/{icons → dist/icons}/post_box.svg +0 -0
- /package/{icons → dist/icons}/post_office.svg +0 -0
- /package/{icons → dist/icons}/postal_code.svg +0 -0
- /package/{icons → dist/icons}/pub.svg +0 -0
- /package/{icons → dist/icons}/public_bath.svg +0 -0
- /package/{icons → dist/icons}/public_bookcase.svg +0 -0
- /package/{icons → dist/icons}/public_building.svg +0 -0
- /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
- /package/{icons → dist/icons}/reverse.svg +0 -0
- /package/{icons → dist/icons}/river.svg +0 -0
- /package/{icons → dist/icons}/road.svg +0 -0
- /package/{icons → dist/icons}/saddle.svg +0 -0
- /package/{icons → dist/icons}/sauna.svg +0 -0
- /package/{icons → dist/icons}/sea.svg +0 -0
- /package/{icons → dist/icons}/second_hand.svg +0 -0
- /package/{icons → dist/icons}/shintoist.svg +0 -0
- /package/{icons → dist/icons}/shoe.svg +0 -0
- /package/{icons → dist/icons}/shower.svg +0 -0
- /package/{icons → dist/icons}/shrine.svg +0 -0
- /package/{icons → dist/icons}/sikhist.svg +0 -0
- /package/{icons → dist/icons}/slipway.svg +0 -0
- /package/{icons → dist/icons}/snowmobile.svg +0 -0
- /package/{icons → dist/icons}/social_facility.svg +0 -0
- /package/{icons → dist/icons}/sports.svg +0 -0
- /package/{icons → dist/icons}/sprite.json +0 -0
- /package/{icons → dist/icons}/sprite.png +0 -0
- /package/{icons → dist/icons}/sprite@2x.json +0 -0
- /package/{icons → dist/icons}/sprite@2x.png +0 -0
- /package/{icons → dist/icons}/stationery.svg +0 -0
- /package/{icons → dist/icons}/stile.svg +0 -0
- /package/{icons → dist/icons}/stone.svg +0 -0
- /package/{icons → dist/icons}/storage_tank.svg +0 -0
- /package/{icons → dist/icons}/stream.svg +0 -0
- /package/{icons → dist/icons}/street.svg +0 -0
- /package/{icons → dist/icons}/supermarket.svg +0 -0
- /package/{icons → dist/icons}/tea.svg +0 -0
- /package/{icons → dist/icons}/telescope_dish.svg +0 -0
- /package/{icons → dist/icons}/telescope_dome.svg +0 -0
- /package/{icons → dist/icons}/ticket.svg +0 -0
- /package/{icons → dist/icons}/tobacco.svg +0 -0
- /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_cooling.svg +0 -0
- /package/{icons → dist/icons}/tower_dish.svg +0 -0
- /package/{icons → dist/icons}/tower_dome.svg +0 -0
- /package/{icons → dist/icons}/tower_generic.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
- /package/{icons → dist/icons}/tower_lighting.svg +0 -0
- /package/{icons → dist/icons}/townhall.svg +0 -0
- /package/{icons → dist/icons}/toys.svg +0 -0
- /package/{icons → dist/icons}/trade.svg +0 -0
- /package/{icons → dist/icons}/traffic_light.svg +0 -0
- /package/{icons → dist/icons}/train_station.svg +0 -0
- /package/{icons → dist/icons}/travel_agency.svg +0 -0
- /package/{icons → dist/icons}/tyres.svg +0 -0
- /package/{icons → dist/icons}/university.svg +0 -0
- /package/{icons → dist/icons}/variety_store.svg +0 -0
- /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
- /package/{icons → dist/icons}/vending_machine.svg +0 -0
- /package/{icons → dist/icons}/video.svg +0 -0
- /package/{icons → dist/icons}/video_games.svg +0 -0
- /package/{icons → dist/icons}/waste_disposal.svg +0 -0
- /package/{icons → dist/icons}/water_well.svg +0 -0
- /package/{icons → dist/icons}/waterfall.svg +0 -0
- /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
package/svelte/proximity.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
let cachedLocation;
|
|
2
|
-
export async function getProximity(mapController, proximity, ac) {
|
|
3
|
-
const centerAndZoom = mapController?.getCenterAndZoom();
|
|
4
|
-
for (const rule of proximity ?? []) {
|
|
5
|
-
if (centerAndZoom &&
|
|
6
|
-
((rule.minZoom != undefined && rule.minZoom > centerAndZoom[0]) ||
|
|
7
|
-
(rule.maxZoom != undefined && rule.maxZoom < centerAndZoom[0]))) {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
if (rule.type === "fixed") {
|
|
11
|
-
return rule.coordinates.join(",");
|
|
12
|
-
}
|
|
13
|
-
cg: if (rule.type === "client-geolocation") {
|
|
14
|
-
if (cachedLocation &&
|
|
15
|
-
rule.cachedLocationExpiry &&
|
|
16
|
-
cachedLocation.time + rule.cachedLocationExpiry > Date.now()) {
|
|
17
|
-
if (!cachedLocation.coords) {
|
|
18
|
-
break cg;
|
|
19
|
-
}
|
|
20
|
-
return cachedLocation.coords;
|
|
21
|
-
}
|
|
22
|
-
let coords;
|
|
23
|
-
try {
|
|
24
|
-
coords = await new Promise((resolve, reject) => {
|
|
25
|
-
ac.signal.addEventListener("abort", () => {
|
|
26
|
-
reject(Error("aborted"));
|
|
27
|
-
});
|
|
28
|
-
navigator.geolocation.getCurrentPosition((pos) => {
|
|
29
|
-
resolve([pos.coords.longitude, pos.coords.latitude]
|
|
30
|
-
.map((c) => c.toFixed(6))
|
|
31
|
-
.join(","));
|
|
32
|
-
}, (err) => {
|
|
33
|
-
reject(err);
|
|
34
|
-
}, rule);
|
|
35
|
-
});
|
|
36
|
-
return coords;
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// ignore
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
if (rule.cachedLocationExpiry) {
|
|
43
|
-
cachedLocation = {
|
|
44
|
-
time: Date.now(),
|
|
45
|
-
coords,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (ac.signal.aborted) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (rule.type === "server-geolocation") {
|
|
54
|
-
return "ip";
|
|
55
|
-
}
|
|
56
|
-
if (centerAndZoom && rule.type === "map-center") {
|
|
57
|
-
return centerAndZoom[1].toFixed(6) + "," + centerAndZoom[2].toFixed(6);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/svelte/react.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ControlOptions, DispatcherTypeCC, MapController } from "./types";
|
|
2
|
-
type EventNames = keyof DispatcherTypeCC;
|
|
3
|
-
type EventHandlerFnName<T extends EventNames> = `on${Capitalize<T>}`;
|
|
4
|
-
type CallbackProperties<T> = {
|
|
5
|
-
[K in keyof T as EventHandlerFnName<Extract<K, EventNames>>]?: (event: T[K]) => void;
|
|
6
|
-
};
|
|
7
|
-
type MapControllerProp = {
|
|
8
|
-
mapController?: MapController;
|
|
9
|
-
};
|
|
10
|
-
export type Props = ControlOptions & CallbackProperties<DispatcherTypeCC> & MapControllerProp;
|
|
11
|
-
export type Methods = {
|
|
12
|
-
/**
|
|
13
|
-
* Blur the search input box.
|
|
14
|
-
*/
|
|
15
|
-
blur(): void;
|
|
16
|
-
/**
|
|
17
|
-
* Focus the search input box.
|
|
18
|
-
*
|
|
19
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
20
|
-
*/
|
|
21
|
-
focus(options?: FocusOptions): void;
|
|
22
|
-
/**
|
|
23
|
-
* Set the content of search input box.
|
|
24
|
-
*
|
|
25
|
-
* @param value text to set
|
|
26
|
-
* @param submit perform the search
|
|
27
|
-
*/
|
|
28
|
-
setQuery(value: string, submit?: boolean): void;
|
|
29
|
-
/**
|
|
30
|
-
* Clear geocoding search results from the map.
|
|
31
|
-
*/
|
|
32
|
-
clearMap(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Clear search result list.
|
|
35
|
-
*/
|
|
36
|
-
clearList(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Set reverse geocoding mode.
|
|
39
|
-
*
|
|
40
|
-
* @param reverseActive reverse geocoding active
|
|
41
|
-
*/
|
|
42
|
-
setReverseMode(reverseActive: boolean): void;
|
|
43
|
-
};
|
|
44
|
-
declare const ReactGeocodingControl: import("react").ForwardRefExoticComponent<ControlOptions & CallbackProperties<DispatcherTypeCC> & MapControllerProp & import("react").RefAttributes<Methods>>;
|
|
45
|
-
export { ReactGeocodingControl as GeocodingControl };
|
package/svelte/react.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { createElement, forwardRef, useEffect, useImperativeHandle, useRef, } from "react";
|
|
2
|
-
import GeocodingControl from "./GeocodingControl.svelte";
|
|
3
|
-
const eventNames = [
|
|
4
|
-
"featuresListed",
|
|
5
|
-
"featuresMarked",
|
|
6
|
-
"optionsVisibilityChange",
|
|
7
|
-
"pick",
|
|
8
|
-
"queryChange",
|
|
9
|
-
"response",
|
|
10
|
-
"reverseToggle",
|
|
11
|
-
"select",
|
|
12
|
-
];
|
|
13
|
-
const propertyNames = [
|
|
14
|
-
"adjustUrlQuery",
|
|
15
|
-
"adjustUrl",
|
|
16
|
-
"apiKey",
|
|
17
|
-
"apiUrl",
|
|
18
|
-
"bbox",
|
|
19
|
-
"class",
|
|
20
|
-
"clearButtonTitle",
|
|
21
|
-
"clearListOnPick",
|
|
22
|
-
"clearOnBlur",
|
|
23
|
-
"collapsed",
|
|
24
|
-
"country",
|
|
25
|
-
"debounceSearch",
|
|
26
|
-
"enableReverse",
|
|
27
|
-
"errorMessage",
|
|
28
|
-
"excludeTypes",
|
|
29
|
-
"reverseGeocodingExcludeTypes",
|
|
30
|
-
"exhaustiveReverseGeocoding",
|
|
31
|
-
"fetchParameters",
|
|
32
|
-
"filter",
|
|
33
|
-
"flyToSelected",
|
|
34
|
-
"fuzzyMatch",
|
|
35
|
-
"iconsBaseUrl",
|
|
36
|
-
"keepListOpen",
|
|
37
|
-
"language",
|
|
38
|
-
"limit",
|
|
39
|
-
"reverseGeocodingLimit",
|
|
40
|
-
"mapController",
|
|
41
|
-
"markerOnSelected",
|
|
42
|
-
"minLength",
|
|
43
|
-
"noResultsMessage",
|
|
44
|
-
"pickedResultStyle",
|
|
45
|
-
"placeholder",
|
|
46
|
-
"proximity",
|
|
47
|
-
"reverseActive",
|
|
48
|
-
"reverseButtonTitle",
|
|
49
|
-
"selectFirst",
|
|
50
|
-
"showPlaceType",
|
|
51
|
-
"showResultsWhileTyping",
|
|
52
|
-
"types",
|
|
53
|
-
"reverseGeocodingTypes",
|
|
54
|
-
"zoom",
|
|
55
|
-
];
|
|
56
|
-
function getEventFnName(name) {
|
|
57
|
-
return ("on" +
|
|
58
|
-
name[0].toUpperCase() +
|
|
59
|
-
name.slice(1));
|
|
60
|
-
}
|
|
61
|
-
const ReactGeocodingControl = forwardRef(function ReactGeocodingControl(props, ref) {
|
|
62
|
-
const divRef = useRef(undefined);
|
|
63
|
-
const controlRef = useRef(undefined);
|
|
64
|
-
const options = { ...props };
|
|
65
|
-
for (const eventName of eventNames) {
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
67
|
-
delete options[getEventFnName(eventName)];
|
|
68
|
-
}
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (!divRef.current) {
|
|
71
|
-
throw new Error();
|
|
72
|
-
}
|
|
73
|
-
const control = new GeocodingControl({
|
|
74
|
-
target: divRef.current,
|
|
75
|
-
props: options,
|
|
76
|
-
});
|
|
77
|
-
controlRef.current = control;
|
|
78
|
-
return () => control.$destroy();
|
|
79
|
-
}, []);
|
|
80
|
-
// watch change on every option
|
|
81
|
-
for (const propName of propertyNames) {
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
if (controlRef.current && props[propName] !== undefined) {
|
|
84
|
-
controlRef.current.$set({ [propName]: props[propName] });
|
|
85
|
-
}
|
|
86
|
-
}, [props[propName]]);
|
|
87
|
-
}
|
|
88
|
-
// attach event handlers
|
|
89
|
-
for (const eventName of eventNames) {
|
|
90
|
-
const eventHandlerFn = props[getEventFnName(eventName)];
|
|
91
|
-
useEffect(() => eventHandlerFn &&
|
|
92
|
-
controlRef.current?.$on(eventName.toLowerCase(), (e) => {
|
|
93
|
-
eventHandlerFn(e.detail);
|
|
94
|
-
}), [eventHandlerFn]);
|
|
95
|
-
}
|
|
96
|
-
useImperativeHandle(ref, () => ({
|
|
97
|
-
setQuery: (value, submit = true) => controlRef.current?.setQuery(value, submit),
|
|
98
|
-
clearMap: () => controlRef.current?.clearMap(),
|
|
99
|
-
clearList: () => controlRef.current?.clearList(),
|
|
100
|
-
focus: (options) => controlRef.current?.focus(options),
|
|
101
|
-
blur: () => controlRef.current?.blur(),
|
|
102
|
-
setReverseMode: (reverseActive) => controlRef.current?.$set({ reverseActive }),
|
|
103
|
-
}));
|
|
104
|
-
return createElement("div", { ref: divRef });
|
|
105
|
-
});
|
|
106
|
-
export { ReactGeocodingControl as GeocodingControl };
|
package/svelte/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/svelte/vanilla.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ControlOptions, DispatcherType, MapController } from "./types";
|
|
2
|
-
type Options = ControlOptions & {
|
|
3
|
-
mapController?: MapController;
|
|
4
|
-
};
|
|
5
|
-
interface GeocodingControlEvent<T> extends CustomEvent<T> {
|
|
6
|
-
readonly target: GeocodingControl;
|
|
7
|
-
readonly currentTarget: GeocodingControl;
|
|
8
|
-
}
|
|
9
|
-
type CustomEventListenerOrEventListenerObject<K extends keyof CustomEventMap> = ((evt: CustomEventMap[K]) => void) | {
|
|
10
|
-
handleEvent(object: CustomEventMap[K]): void;
|
|
11
|
-
};
|
|
12
|
-
type CustomEventMap = {
|
|
13
|
-
[T in keyof DispatcherType]: GeocodingControlEvent<DispatcherType[T]>;
|
|
14
|
-
};
|
|
15
|
-
export declare class GeocodingControl extends EventTarget {
|
|
16
|
-
#private;
|
|
17
|
-
constructor({ target, ...options }: Options & {
|
|
18
|
-
target: HTMLElement;
|
|
19
|
-
});
|
|
20
|
-
/**
|
|
21
|
-
* Update the control options.
|
|
22
|
-
*
|
|
23
|
-
* @param options options to update
|
|
24
|
-
*/
|
|
25
|
-
setOptions(options: Partial<Options>): void;
|
|
26
|
-
/**
|
|
27
|
-
* Set the content of search input box.
|
|
28
|
-
*
|
|
29
|
-
* @param value text to set
|
|
30
|
-
* @param submit perform the search
|
|
31
|
-
*/
|
|
32
|
-
setQuery(value: string, submit?: boolean): void;
|
|
33
|
-
/**
|
|
34
|
-
* Clear geocoding search results from the map.
|
|
35
|
-
*/
|
|
36
|
-
clearMap(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clear search result list.
|
|
39
|
-
*/
|
|
40
|
-
clearList(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Set reverse geocoding mode.
|
|
43
|
-
*
|
|
44
|
-
* @param reverseActive reverse geocoding active
|
|
45
|
-
*/
|
|
46
|
-
setReverseMode(reverseActive: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Focus the search input box.
|
|
49
|
-
*
|
|
50
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
51
|
-
*/
|
|
52
|
-
focus(options?: FocusOptions): void;
|
|
53
|
-
/**
|
|
54
|
-
* Blur the search input box.
|
|
55
|
-
*/
|
|
56
|
-
blur(): void;
|
|
57
|
-
addEventListener<K extends keyof CustomEventMap>(type: K, callback: CustomEventListenerOrEventListenerObject<K> | null, options?: AddEventListenerOptions | boolean): void;
|
|
58
|
-
removeEventListener<K extends keyof CustomEventMap>(type: K, callback: CustomEventListenerOrEventListenerObject<K> | null, options?: EventListenerOptions | boolean): void;
|
|
59
|
-
dispatchEvent<K extends keyof CustomEventMap>(event: CustomEventMap[K]): boolean;
|
|
60
|
-
}
|
|
61
|
-
export {};
|
package/svelte/vanilla.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import GeocodingControlComponent from "./GeocodingControl.svelte";
|
|
2
|
-
const finalizationRegistry = new FinalizationRegistry((gc) => {
|
|
3
|
-
gc.$destroy();
|
|
4
|
-
});
|
|
5
|
-
export class GeocodingControl extends EventTarget {
|
|
6
|
-
#gc;
|
|
7
|
-
constructor({ target, ...options }) {
|
|
8
|
-
super();
|
|
9
|
-
this.#gc = new GeocodingControlComponent({
|
|
10
|
-
target,
|
|
11
|
-
props: options,
|
|
12
|
-
});
|
|
13
|
-
for (const eventName of [
|
|
14
|
-
"select",
|
|
15
|
-
"pick",
|
|
16
|
-
"featureslisted",
|
|
17
|
-
"featuresmarked",
|
|
18
|
-
"response",
|
|
19
|
-
"optionsvisibilitychange",
|
|
20
|
-
"reversetoggle",
|
|
21
|
-
"querychange",
|
|
22
|
-
]) {
|
|
23
|
-
this.#gc.$on(eventName, (event) => {
|
|
24
|
-
// Use the new `emit` method for type-safe dispatching
|
|
25
|
-
this.#emit(eventName, event.detail);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
this.#gc.$on("select", (event) => {
|
|
29
|
-
const geocodingEvent = new CustomEvent(event.type, {
|
|
30
|
-
detail: event.detail,
|
|
31
|
-
});
|
|
32
|
-
this.dispatchEvent(geocodingEvent);
|
|
33
|
-
});
|
|
34
|
-
finalizationRegistry.register(this, this.#gc);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Update the control options.
|
|
38
|
-
*
|
|
39
|
-
* @param options options to update
|
|
40
|
-
*/
|
|
41
|
-
setOptions(options) {
|
|
42
|
-
this.#gc.$set(options);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Set the content of search input box.
|
|
46
|
-
*
|
|
47
|
-
* @param value text to set
|
|
48
|
-
* @param submit perform the search
|
|
49
|
-
*/
|
|
50
|
-
setQuery(value, submit = true) {
|
|
51
|
-
this.#gc?.setQuery(value, submit);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Clear geocoding search results from the map.
|
|
55
|
-
*/
|
|
56
|
-
clearMap() {
|
|
57
|
-
this.#gc?.clearMap();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Clear search result list.
|
|
61
|
-
*/
|
|
62
|
-
clearList() {
|
|
63
|
-
this.#gc?.clearList();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Set reverse geocoding mode.
|
|
67
|
-
*
|
|
68
|
-
* @param reverseActive reverse geocoding active
|
|
69
|
-
*/
|
|
70
|
-
setReverseMode(reverseActive) {
|
|
71
|
-
this.#gc?.$set({ reverseActive });
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Focus the search input box.
|
|
75
|
-
*
|
|
76
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
77
|
-
*/
|
|
78
|
-
focus(options) {
|
|
79
|
-
this.#gc?.focus(options);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Blur the search input box.
|
|
83
|
-
*/
|
|
84
|
-
blur() {
|
|
85
|
-
this.#gc?.blur();
|
|
86
|
-
}
|
|
87
|
-
addEventListener(type, callback, options) {
|
|
88
|
-
super.addEventListener(type, callback, options);
|
|
89
|
-
}
|
|
90
|
-
removeEventListener(type, callback, options) {
|
|
91
|
-
super.removeEventListener(type, callback, options);
|
|
92
|
-
}
|
|
93
|
-
dispatchEvent(event) {
|
|
94
|
-
return super.dispatchEvent(event);
|
|
95
|
-
}
|
|
96
|
-
#emit(type, detail) {
|
|
97
|
-
return super.dispatchEvent(new CustomEvent(type, {
|
|
98
|
-
detail,
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
}
|
package/svelte/vite-env.d.ts
DELETED