@maptiler/geocoding-control 2.1.7 → 3.0.0-rc.1

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.
Files changed (333) hide show
  1. package/CODE_OF_CONDUCT.md +46 -0
  2. package/CONTRIBUTING.md +72 -0
  3. package/README.md +34 -26
  4. package/SECURITY.md +16 -0
  5. package/dist/index.js +856 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.umd.js +263 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/leaflet.public.js +1273 -0
  10. package/dist/leaflet.public.js.map +1 -0
  11. package/dist/leaflet.public.umd.js +276 -0
  12. package/dist/leaflet.public.umd.js.map +1 -0
  13. package/dist/maplibregl.js +1297 -0
  14. package/dist/maplibregl.js.map +1 -0
  15. package/dist/maplibregl.umd.js +276 -0
  16. package/dist/maplibregl.umd.js.map +1 -0
  17. package/dist/maptilersdk.js +1305 -0
  18. package/dist/maptilersdk.js.map +1 -0
  19. package/dist/maptilersdk.umd.js +276 -0
  20. package/dist/maptilersdk.umd.js.map +1 -0
  21. package/dist/src/components/clear-icon.d.ts +10 -0
  22. package/dist/src/components/fail-icon.d.ts +10 -0
  23. package/dist/src/components/loading-icon.d.ts +10 -0
  24. package/dist/src/components/marker.d.ts +10 -0
  25. package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
  26. package/dist/src/components/search-icon.d.ts +10 -0
  27. package/dist/src/controls/leaflet-control.d.ts +58 -0
  28. package/dist/src/controls/leaflet-events.d.ts +42 -0
  29. package/dist/src/controls/leaflet-options.d.ts +84 -0
  30. package/dist/src/controls/maplibregl-control.d.ts +55 -0
  31. package/dist/src/controls/maplibregl-events.d.ts +44 -0
  32. package/dist/src/controls/maplibregl-options.d.ts +104 -0
  33. package/dist/src/controls/maptilersdk-control.d.ts +6 -0
  34. package/dist/src/controls/maptilersdk-events.d.ts +2 -0
  35. package/dist/src/controls/maptilersdk-options.d.ts +10 -0
  36. package/dist/src/geocoder/geocoder-events.d.ts +46 -0
  37. package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
  38. package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +11 -147
  39. package/dist/src/geocoder/geocoder.d.ts +112 -0
  40. package/dist/src/index.d.ts +9 -0
  41. package/dist/src/leaflet.public.d.ts +7 -0
  42. package/dist/src/maplibregl.d.ts +7 -0
  43. package/dist/src/maptilersdk.d.ts +7 -0
  44. package/dist/src/types.d.ts +45 -0
  45. package/dist/src/utils/geo-utils.d.ts +6 -0
  46. package/dist/src/utils/mask.d.ts +2 -0
  47. package/dist/src/utils/proximity.d.ts +2 -0
  48. package/package.json +80 -113
  49. package/MapLibreBasedGeocodingControl.d.ts +0 -3072
  50. package/geo-coordinates-parser.t.d.ts +0 -8
  51. package/geoUtils.d.ts +0 -3
  52. package/leaflet-controller.d.ts +0 -12
  53. package/leaflet-controller.js +0 -2475
  54. package/leaflet-controller.js.map +0 -1
  55. package/leaflet-controller.umd.js +0 -2
  56. package/leaflet-controller.umd.js.map +0 -1
  57. package/leaflet.d.ts +0 -131
  58. package/leaflet.js +0 -5082
  59. package/leaflet.js.map +0 -1
  60. package/leaflet.umd.js +0 -14
  61. package/leaflet.umd.js.map +0 -1
  62. package/maplibregl-controller.d.ts +0 -19
  63. package/maplibregl-controller.js +0 -2418
  64. package/maplibregl-controller.js.map +0 -1
  65. package/maplibregl-controller.umd.js +0 -2
  66. package/maplibregl-controller.umd.js.map +0 -1
  67. package/maplibregl.d.ts +0 -2509
  68. package/maplibregl.js +0 -5142
  69. package/maplibregl.js.map +0 -1
  70. package/maplibregl.umd.js +0 -14
  71. package/maplibregl.umd.js.map +0 -1
  72. package/maptilersdk.d.ts +0 -2504
  73. package/maptilersdk.js +0 -5152
  74. package/maptilersdk.js.map +0 -1
  75. package/maptilersdk.umd.js +0 -14
  76. package/maptilersdk.umd.js.map +0 -1
  77. package/mask.d.ts +0 -2
  78. package/openlayers-controller.d.ts +0 -15
  79. package/openlayers-controller.js +0 -2174
  80. package/openlayers-controller.js.map +0 -1
  81. package/openlayers-controller.umd.js +0 -2
  82. package/openlayers-controller.umd.js.map +0 -1
  83. package/openlayers.d.ts +0 -109
  84. package/openlayers.js +0 -5045
  85. package/openlayers.js.map +0 -1
  86. package/openlayers.umd.js +0 -14
  87. package/openlayers.umd.js.map +0 -1
  88. package/proximity.d.ts +0 -2
  89. package/react.d.ts +0 -45
  90. package/react.js +0 -2795
  91. package/react.js.map +0 -1
  92. package/react.umd.js +0 -14
  93. package/react.umd.js.map +0 -1
  94. package/style.css +0 -1
  95. package/svelte/ClearIcon.svelte +0 -12
  96. package/svelte/ClearIcon.svelte.d.ts +0 -25
  97. package/svelte/FailIcon.svelte +0 -12
  98. package/svelte/FailIcon.svelte.d.ts +0 -25
  99. package/svelte/FeatureItem.svelte +0 -246
  100. package/svelte/FeatureItem.svelte.d.ts +0 -26
  101. package/svelte/GeocodingControl.svelte +0 -921
  102. package/svelte/GeocodingControl.svelte.d.ts +0 -105
  103. package/svelte/LoadingIcon.svelte +0 -40
  104. package/svelte/LoadingIcon.svelte.d.ts +0 -25
  105. package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
  106. package/svelte/MapLibreBasedGeocodingControl.js +0 -210
  107. package/svelte/MarkerIcon.svelte +0 -71
  108. package/svelte/MarkerIcon.svelte.d.ts +0 -18
  109. package/svelte/ReverseGeocodingIcon.svelte +0 -12
  110. package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
  111. package/svelte/SearchIcon.svelte +0 -26
  112. package/svelte/SearchIcon.svelte.d.ts +0 -25
  113. package/svelte/geo-coordinates-parser.t.d.ts +0 -8
  114. package/svelte/geo-coordinates-parser.t.js +0 -1
  115. package/svelte/geoUtils.d.ts +0 -3
  116. package/svelte/geoUtils.js +0 -18
  117. package/svelte/info.json +0 -1
  118. package/svelte/leaflet-controller.d.ts +0 -12
  119. package/svelte/leaflet-controller.js +0 -274
  120. package/svelte/leaflet.d.ts +0 -131
  121. package/svelte/leaflet.js +0 -116
  122. package/svelte/maplibregl-controller.d.ts +0 -19
  123. package/svelte/maplibregl-controller.js +0 -279
  124. package/svelte/maplibregl.d.ts +0 -2509
  125. package/svelte/maplibregl.js +0 -17
  126. package/svelte/maptilersdk.d.ts +0 -2504
  127. package/svelte/maptilersdk.js +0 -32
  128. package/svelte/mask.d.ts +0 -2
  129. package/svelte/mask.js +0 -54
  130. package/svelte/openlayers-controller.d.ts +0 -15
  131. package/svelte/openlayers-controller.js +0 -283
  132. package/svelte/openlayers.d.ts +0 -109
  133. package/svelte/openlayers.js +0 -178
  134. package/svelte/proximity.d.ts +0 -2
  135. package/svelte/proximity.js +0 -60
  136. package/svelte/react.d.ts +0 -45
  137. package/svelte/react.js +0 -106
  138. package/svelte/types.js +0 -1
  139. package/svelte/vanilla.d.ts +0 -61
  140. package/svelte/vanilla.js +0 -101
  141. package/svelte/vite-env.d.ts +0 -2
  142. package/types.d.ts +0 -391
  143. package/vanilla.d.ts +0 -61
  144. package/vanilla.js +0 -2799
  145. package/vanilla.js.map +0 -1
  146. package/vanilla.umd.js +0 -14
  147. package/vanilla.umd.js.map +0 -1
  148. /package/{icons → dist/icons}/10pin.svg +0 -0
  149. /package/{icons → dist/icons}/9pin.svg +0 -0
  150. /package/{icons → dist/icons}/advertising_column.svg +0 -0
  151. /package/{icons → dist/icons}/aerodrome.svg +0 -0
  152. /package/{icons → dist/icons}/alcohol.svg +0 -0
  153. /package/{icons → dist/icons}/alpine_hut.svg +0 -0
  154. /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
  155. /package/{icons → dist/icons}/amusement_park.svg +0 -0
  156. /package/{icons → dist/icons}/apartment.svg +0 -0
  157. /package/{icons → dist/icons}/archaeological_site.svg +0 -0
  158. /package/{icons → dist/icons}/area.svg +0 -0
  159. /package/{icons → dist/icons}/art.svg +0 -0
  160. /package/{icons → dist/icons}/arts_centre.svg +0 -0
  161. /package/{icons → dist/icons}/artwork.svg +0 -0
  162. /package/{icons → dist/icons}/audioguide.svg +0 -0
  163. /package/{icons → dist/icons}/bag.svg +0 -0
  164. /package/{icons → dist/icons}/beauty.svg +0 -0
  165. /package/{icons → dist/icons}/bed.svg +0 -0
  166. /package/{icons → dist/icons}/bell_tower.svg +0 -0
  167. /package/{icons → dist/icons}/beverages.svg +0 -0
  168. /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
  169. /package/{icons → dist/icons}/biergarten.svg +0 -0
  170. /package/{icons → dist/icons}/bird_hide.svg +0 -0
  171. /package/{icons → dist/icons}/boat_rental.svg +0 -0
  172. /package/{icons → dist/icons}/bookmaker.svg +0 -0
  173. /package/{icons → dist/icons}/books.svg +0 -0
  174. /package/{icons → dist/icons}/bowl.svg +0 -0
  175. /package/{icons → dist/icons}/bowling_alley.svg +0 -0
  176. /package/{icons → dist/icons}/bunker.svg +0 -0
  177. /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
  178. /package/{icons → dist/icons}/bus_station.svg +0 -0
  179. /package/{icons → dist/icons}/bust.svg +0 -0
  180. /package/{icons → dist/icons}/camping.svg +0 -0
  181. /package/{icons → dist/icons}/car_parts.svg +0 -0
  182. /package/{icons → dist/icons}/car_wash.svg +0 -0
  183. /package/{icons → dist/icons}/caravan_park.svg +0 -0
  184. /package/{icons → dist/icons}/carpet.svg +0 -0
  185. /package/{icons → dist/icons}/cattle_grid.svg +0 -0
  186. /package/{icons → dist/icons}/cave_entrance.svg +0 -0
  187. /package/{icons → dist/icons}/chalet.svg +0 -0
  188. /package/{icons → dist/icons}/charity.svg +0 -0
  189. /package/{icons → dist/icons}/chemist.svg +0 -0
  190. /package/{icons → dist/icons}/chimney.svg +0 -0
  191. /package/{icons → dist/icons}/church.svg +0 -0
  192. /package/{icons → dist/icons}/city_gate.svg +0 -0
  193. /package/{icons → dist/icons}/clinic.svg +0 -0
  194. /package/{icons → dist/icons}/clothes.svg +0 -0
  195. /package/{icons → dist/icons}/coffee.svg +0 -0
  196. /package/{icons → dist/icons}/community_centre.svg +0 -0
  197. /package/{icons → dist/icons}/computer.svg +0 -0
  198. /package/{icons → dist/icons}/consulate.svg +0 -0
  199. /package/{icons → dist/icons}/copyshop.svg +0 -0
  200. /package/{icons → dist/icons}/cosmetics.svg +0 -0
  201. /package/{icons → dist/icons}/courthouse.svg +0 -0
  202. /package/{icons → dist/icons}/crane.svg +0 -0
  203. /package/{icons → dist/icons}/dairy.svg +0 -0
  204. /package/{icons → dist/icons}/deli.svg +0 -0
  205. /package/{icons → dist/icons}/department_store.svg +0 -0
  206. /package/{icons → dist/icons}/diy.svg +0 -0
  207. /package/{icons → dist/icons}/electronics.svg +0 -0
  208. /package/{icons → dist/icons}/embankment.svg +0 -0
  209. /package/{icons → dist/icons}/embassy.svg +0 -0
  210. /package/{icons → dist/icons}/excrement_bags.svg +0 -0
  211. /package/{icons → dist/icons}/fabric.svg +0 -0
  212. /package/{icons → dist/icons}/farmyard.svg +0 -0
  213. /package/{icons → dist/icons}/ferry.svg +0 -0
  214. /package/{icons → dist/icons}/firepit.svg +0 -0
  215. /package/{icons → dist/icons}/firestation.svg +0 -0
  216. /package/{icons → dist/icons}/fishing.svg +0 -0
  217. /package/{icons → dist/icons}/fitness.svg +0 -0
  218. /package/{icons → dist/icons}/ford.svg +0 -0
  219. /package/{icons → dist/icons}/fort.svg +0 -0
  220. /package/{icons → dist/icons}/fortress.svg +0 -0
  221. /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
  222. /package/{icons → dist/icons}/generator_wind.svg +0 -0
  223. /package/{icons → dist/icons}/golf_pin.svg +0 -0
  224. /package/{icons → dist/icons}/greengrocer.svg +0 -0
  225. /package/{icons → dist/icons}/guest_house.svg +0 -0
  226. /package/{icons → dist/icons}/helipad.svg +0 -0
  227. /package/{icons → dist/icons}/hifi.svg +0 -0
  228. /package/{icons → dist/icons}/hostel.svg +0 -0
  229. /package/{icons → dist/icons}/hotel.svg +0 -0
  230. /package/{icons → dist/icons}/housenumber.svg +0 -0
  231. /package/{icons → dist/icons}/houseware.svg +0 -0
  232. /package/{icons → dist/icons}/hunting_stand.svg +0 -0
  233. /package/{icons → dist/icons}/interior_decoration.svg +0 -0
  234. /package/{icons → dist/icons}/internet_cafe.svg +0 -0
  235. /package/{icons → dist/icons}/kindergarten.svg +0 -0
  236. /package/{icons → dist/icons}/kissing_gate.svg +0 -0
  237. /package/{icons → dist/icons}/manor.svg +0 -0
  238. /package/{icons → dist/icons}/map.svg +0 -0
  239. /package/{icons → dist/icons}/marker_reverse.svg +0 -0
  240. /package/{icons → dist/icons}/marker_selected.svg +0 -0
  241. /package/{icons → dist/icons}/marker_unselected.svg +0 -0
  242. /package/{icons → dist/icons}/marketplace.svg +0 -0
  243. /package/{icons → dist/icons}/massage.svg +0 -0
  244. /package/{icons → dist/icons}/mast.svg +0 -0
  245. /package/{icons → dist/icons}/mast_communications.svg +0 -0
  246. /package/{icons → dist/icons}/mast_lighting.svg +0 -0
  247. /package/{icons → dist/icons}/medical_supply.svg +0 -0
  248. /package/{icons → dist/icons}/memorial.svg +0 -0
  249. /package/{icons → dist/icons}/miniature_golf.svg +0 -0
  250. /package/{icons → dist/icons}/motel.svg +0 -0
  251. /package/{icons → dist/icons}/mountain_range.svg +0 -0
  252. /package/{icons → dist/icons}/multifaith.svg +0 -0
  253. /package/{icons → dist/icons}/musical_instrument.svg +0 -0
  254. /package/{icons → dist/icons}/newsagent.svg +0 -0
  255. /package/{icons → dist/icons}/nightclub.svg +0 -0
  256. /package/{icons → dist/icons}/ocean.svg +0 -0
  257. /package/{icons → dist/icons}/office.svg +0 -0
  258. /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
  259. /package/{icons → dist/icons}/palace.svg +0 -0
  260. /package/{icons → dist/icons}/parcel_locker.svg +0 -0
  261. /package/{icons → dist/icons}/parking_space.svg +0 -0
  262. /package/{icons → dist/icons}/parking_tickets.svg +0 -0
  263. /package/{icons → dist/icons}/pet.svg +0 -0
  264. /package/{icons → dist/icons}/photo.svg +0 -0
  265. /package/{icons → dist/icons}/picnic.svg +0 -0
  266. /package/{icons → dist/icons}/plaque.svg +0 -0
  267. /package/{icons → dist/icons}/poi.svg +0 -0
  268. /package/{icons → dist/icons}/post_box.svg +0 -0
  269. /package/{icons → dist/icons}/post_office.svg +0 -0
  270. /package/{icons → dist/icons}/postal_code.svg +0 -0
  271. /package/{icons → dist/icons}/pub.svg +0 -0
  272. /package/{icons → dist/icons}/public_bath.svg +0 -0
  273. /package/{icons → dist/icons}/public_bookcase.svg +0 -0
  274. /package/{icons → dist/icons}/public_building.svg +0 -0
  275. /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
  276. /package/{icons → dist/icons}/reverse.svg +0 -0
  277. /package/{icons → dist/icons}/river.svg +0 -0
  278. /package/{icons → dist/icons}/road.svg +0 -0
  279. /package/{icons → dist/icons}/saddle.svg +0 -0
  280. /package/{icons → dist/icons}/sauna.svg +0 -0
  281. /package/{icons → dist/icons}/sea.svg +0 -0
  282. /package/{icons → dist/icons}/second_hand.svg +0 -0
  283. /package/{icons → dist/icons}/shintoist.svg +0 -0
  284. /package/{icons → dist/icons}/shoe.svg +0 -0
  285. /package/{icons → dist/icons}/shower.svg +0 -0
  286. /package/{icons → dist/icons}/shrine.svg +0 -0
  287. /package/{icons → dist/icons}/sikhist.svg +0 -0
  288. /package/{icons → dist/icons}/slipway.svg +0 -0
  289. /package/{icons → dist/icons}/snowmobile.svg +0 -0
  290. /package/{icons → dist/icons}/social_facility.svg +0 -0
  291. /package/{icons → dist/icons}/sports.svg +0 -0
  292. /package/{icons → dist/icons}/sprite.json +0 -0
  293. /package/{icons → dist/icons}/sprite.png +0 -0
  294. /package/{icons → dist/icons}/sprite@2x.json +0 -0
  295. /package/{icons → dist/icons}/sprite@2x.png +0 -0
  296. /package/{icons → dist/icons}/stationery.svg +0 -0
  297. /package/{icons → dist/icons}/stile.svg +0 -0
  298. /package/{icons → dist/icons}/stone.svg +0 -0
  299. /package/{icons → dist/icons}/storage_tank.svg +0 -0
  300. /package/{icons → dist/icons}/stream.svg +0 -0
  301. /package/{icons → dist/icons}/street.svg +0 -0
  302. /package/{icons → dist/icons}/supermarket.svg +0 -0
  303. /package/{icons → dist/icons}/tea.svg +0 -0
  304. /package/{icons → dist/icons}/telescope_dish.svg +0 -0
  305. /package/{icons → dist/icons}/telescope_dome.svg +0 -0
  306. /package/{icons → dist/icons}/ticket.svg +0 -0
  307. /package/{icons → dist/icons}/tobacco.svg +0 -0
  308. /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
  309. /package/{icons → dist/icons}/tower_cooling.svg +0 -0
  310. /package/{icons → dist/icons}/tower_dish.svg +0 -0
  311. /package/{icons → dist/icons}/tower_dome.svg +0 -0
  312. /package/{icons → dist/icons}/tower_generic.svg +0 -0
  313. /package/{icons → dist/icons}/tower_lattice.svg +0 -0
  314. /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
  315. /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
  316. /package/{icons → dist/icons}/tower_lighting.svg +0 -0
  317. /package/{icons → dist/icons}/townhall.svg +0 -0
  318. /package/{icons → dist/icons}/toys.svg +0 -0
  319. /package/{icons → dist/icons}/trade.svg +0 -0
  320. /package/{icons → dist/icons}/traffic_light.svg +0 -0
  321. /package/{icons → dist/icons}/train_station.svg +0 -0
  322. /package/{icons → dist/icons}/travel_agency.svg +0 -0
  323. /package/{icons → dist/icons}/tyres.svg +0 -0
  324. /package/{icons → dist/icons}/university.svg +0 -0
  325. /package/{icons → dist/icons}/variety_store.svg +0 -0
  326. /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
  327. /package/{icons → dist/icons}/vending_machine.svg +0 -0
  328. /package/{icons → dist/icons}/video.svg +0 -0
  329. /package/{icons → dist/icons}/video_games.svg +0 -0
  330. /package/{icons → dist/icons}/waste_disposal.svg +0 -0
  331. /package/{icons → dist/icons}/water_well.svg +0 -0
  332. /package/{icons → dist/icons}/waterfall.svg +0 -0
  333. /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
package/types.d.ts DELETED
@@ -1,391 +0,0 @@
1
- import type { Feature as FeatureType, Geometry } from "geojson";
2
- export type BBox = [minx: number, miny: number, maxx: number, maxy: number];
3
- export type Position = [x: number, y: number];
4
- export type Feature<T extends Geometry = Geometry> = FeatureType<T> & {
5
- id: string;
6
- text: string;
7
- place_name: string;
8
- place_type: string[];
9
- center: Position;
10
- bbox: BBox;
11
- address?: string;
12
- matching_text?: string;
13
- };
14
- export type FeatureCollection<T extends Geometry = Geometry> = {
15
- type: "FeatureCollection";
16
- features: Feature<T>[];
17
- };
18
- export type MapEvent = {
19
- type: "mapClick";
20
- coordinates: Position;
21
- } | {
22
- type: "markerClick";
23
- id: string;
24
- } | {
25
- type: "markerMouseEnter";
26
- id: string;
27
- } | {
28
- type: "markerMouseLeave";
29
- id: string;
30
- };
31
- export type MapController = {
32
- setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
33
- flyTo(center: Position, zoom?: number): void;
34
- fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
35
- indicateReverse(reverse: boolean): void;
36
- setFeatures(features: Feature[] | undefined, picked: Feature | undefined, showPolygonMarker: boolean): void;
37
- setReverseMarker(coordinates?: Position): void;
38
- setSelectedMarker(index: number): void;
39
- getCenterAndZoom(): [zoom: number, lon: number, lat: number] | undefined;
40
- };
41
- export type ProximityRule = {
42
- /** minimal map zoom for the rule to be used */
43
- minZoom?: number;
44
- /** maximal map zoom for the rule to be used */
45
- maxZoom?: number;
46
- } & ({
47
- /** fixed proximity */
48
- type: "fixed";
49
- /** coordinates of the fixed proximity */
50
- coordinates: Position;
51
- } | {
52
- /** use map center coordinates for the proximity */
53
- type: "map-center";
54
- } | {
55
- /** resolve proximity by geolocating IP of the geocoding API call */
56
- type: "server-geolocation";
57
- } | ({
58
- /** use browser's geolocation API for proximity. If it fails, following proximity rules are iterated. */
59
- type: "client-geolocation";
60
- /** how long should the geolocation result be cached, in milliseconds */
61
- cachedLocationExpiry?: number;
62
- } & PositionOptions));
63
- export type ControlOptions = {
64
- /**
65
- * Callback function to adjust URL search parameters.
66
- *
67
- * Default: Empty function.
68
- *
69
- * @deprecated Use `adjustUrl` instead.
70
- */
71
- adjustUrlQuery?: (sp: URLSearchParams) => void;
72
- /**
73
- * Callback function to adjust the geocoding URL before fetching.
74
- *
75
- * @param url [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) parameter that can be modified.
76
- *
77
- * Default: Empty function.
78
- */
79
- adjustUrl?: (url: URL) => void;
80
- /**
81
- * MapTiler API key.
82
- */
83
- apiKey?: string;
84
- /**
85
- * Geocoding API URL.
86
- *
87
- * Default: MapTiler Geocoding API URL.
88
- */
89
- apiUrl?: string;
90
- /**
91
- * Bounding box in the format `[minX, minY, maxX, maxY]` to limit search results.
92
- *
93
- * Default: `undefined`.
94
- */
95
- bbox?: BBox;
96
- /**
97
- * CSS class for the root element.
98
- *
99
- * Default: `undefined`.
100
- */
101
- class?: string;
102
- /**
103
- * Title of the clear button.
104
- *
105
- * Default: `"clear"`.
106
- */
107
- clearButtonTitle?: string;
108
- /**
109
- * Clears the result list after picking an item.
110
- * Prevents redisplaying the list when the input box is focused.
111
- *
112
- * Default: `false`.
113
- */
114
- clearListOnPick?: boolean;
115
- /**
116
- * Clears the input value when it loses focus.
117
- *
118
- * Default: `false`.
119
- */
120
- clearOnBlur?: boolean;
121
- /**
122
- * Collapses the geocoder control until hovered or focused.
123
- *
124
- * Default: `false`.
125
- */
126
- collapsed?: boolean;
127
- /**
128
- * Limits search to the specified country or countries.
129
- *
130
- * Default: `undefined` (all countries).
131
- */
132
- country?: string | string[];
133
- /**
134
- * Time delay (in milliseconds) before querying the server after typing in the input box.
135
- * Useful for reducing the number of API calls.
136
- *
137
- * Default: `200`.
138
- */
139
- debounceSearch?: number;
140
- /**
141
- * Enables reverse geocoding:
142
- * - `"button"`: Enables reverse geocoding button.
143
- * - `"always"`: Reverse geocoding is always active.
144
- *
145
- * Default: `"never"`.
146
- */
147
- enableReverse?: EnableReverse;
148
- /**
149
- * Custom error message.
150
- *
151
- * Default: `"Something went wrong…"`.
152
- */
153
- errorMessage?: string;
154
- /**
155
- * Includes all available types except those listed in the `types` option.
156
- *
157
- * See `reverseGeocodingExcludeTypes` for reverse geocoding exclusion.
158
- *
159
- * Default: `false`.
160
- */
161
- excludeTypes?: boolean;
162
- /**
163
- * Uses the `limit` option value for reverse geocoding even if the `types` option has multiple elements.
164
- * Works only if enabled on the server.
165
- *
166
- * Default: `false`.
167
- */
168
- exhaustiveReverseGeocoding?: boolean;
169
- /**
170
- * Additional parameters for fetch requests.
171
- *
172
- * Default: `undefined`.
173
- */
174
- fetchParameters?: RequestInit;
175
- /**
176
- * Callback function to filter results from the Geocoding API response.
177
- * The function should return `true` to keep an item, or `false` to exclude it.
178
- *
179
- * Default: A function that always returns `true`.
180
- */
181
- filter?: (feature: Feature) => boolean;
182
- /**
183
- * Animates the map to the selected feature from the result list.
184
- *
185
- * Default: `false`.
186
- */
187
- flyToSelected?: boolean;
188
- /**
189
- * Enables fuzzy search.
190
- *
191
- * Default: `true`.
192
- */
193
- fuzzyMatch?: boolean;
194
- /**
195
- * Base URL for POI icons.
196
- *
197
- * Default:
198
- * - `"icons/"` for Svelte apps.
199
- * - `"https://cdn.maptiler.com/maptiler-geocoding-control/v${version}/icons/"` for others.
200
- */
201
- iconsBaseUrl?: string;
202
- /**
203
- * Keeps the result list open even if the control is unfocused.
204
- *
205
- * Default: `false`.
206
- */
207
- keepListOpen?: boolean;
208
- /**
209
- * Language for response text and query weighting.
210
- * Accepts IETF language tags.
211
- * Set to `null` or an empty string to disable language-specific searching.
212
- *
213
- * Default: `undefined` (uses the browser's language settings).
214
- */
215
- language?: string | string[] | null;
216
- /**
217
- * Maximum number of results to display.
218
- *
219
- * See `reverseGeocodingLimit` for reverse geocoding limits.
220
- *
221
- * Default: `5`.
222
- */
223
- limit?: number;
224
- /**
225
- * Displays a marker on the selected feature from the result list.
226
- *
227
- * Default: `true`.
228
- */
229
- markerOnSelected?: boolean;
230
- /**
231
- * Minimum number of characters required to start a search.
232
- *
233
- * Default: `2`.
234
- */
235
- minLength?: number;
236
- /**
237
- * Custom message for when no results are found.
238
- *
239
- * Default:
240
- * ```
241
- * "Oops! Looks like you're trying to predict something that's not quite right.
242
- * We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term.
243
- * Keep on typing - we'll do our best to get you where you need to go!"
244
- * ```
245
- */
246
- noResultsMessage?: string;
247
- /**
248
- * Style of the picked result on the map:
249
- * - `"marker-only"`: Show only a marker at the center of the feature.
250
- * - `"full-geometry"`: Display the full feature geometry.
251
- * - `"full-geometry-including-polygon-center-marker"`: Display full geometry with a marker at the polygon center.
252
- *
253
- * Default: `"full-geometry"`.
254
- */
255
- pickedResultStyle?: PickedResultStyle;
256
- /**
257
- * Custom placeholder for the input box.
258
- *
259
- * Default: `"Search"`.
260
- */
261
- placeholder?: string;
262
- /**
263
- * Prioritizes search results closer to a proximity point.
264
- * The first matching rule in the array is used.
265
- * Set to `null` to disable proximity.
266
- *
267
- * Default: `[ { type: "server-geolocation" } ]`.
268
- */
269
- proximity?: ProximityRule[] | null;
270
- /**
271
- * Activates reverse geocoding.
272
- *
273
- * Default: `false`.
274
- */
275
- reverseActive?: boolean;
276
- /**
277
- * Title of the reverse geocoding toggle button.
278
- *
279
- * Default: `"toggle reverse geocoding"`.
280
- */
281
- reverseButtonTitle?: string;
282
- /**
283
- * Excludes types for reverse geocoding.
284
- *
285
- * Default: Same as `excludeTypes`.
286
- */
287
- reverseGeocodingExcludeTypes?: boolean;
288
- /**
289
- * Limits results for reverse geocoding.
290
- * Applied only if value is 1 or effective types contain a single value.
291
- *
292
- * See also `reverseGeocodingTypes` option.
293
- *
294
- * Default: The value of the `limit` option if set. If effective types contain a single value, the default is `1`. In all other cases, this option is not used.
295
- */
296
- reverseGeocodingLimit?: number;
297
- /**
298
- * Specifies types for reverse geocoding.
299
- *
300
- * If effective types are multiple values, the `limit`/`reverseGeocodingLimit` option is ignored.
301
- *
302
- * See also `reverseGeocodingLimit` option.
303
- *
304
- * Default: Same as `types`.
305
- */
306
- reverseGeocodingTypes?: TypeRule[];
307
- /**
308
- * Automatically selects the first feature in the result list.
309
- *
310
- * Default: `true`.
311
- */
312
- selectFirst?: boolean;
313
- /**
314
- * Indicates when to show place/POI types in the dropdown:
315
- * - `"never"`: Hide the type.
316
- * - `"always"`: Always show the type.
317
- * - `"if-needed"`: Show the type only if it cannot be determined from the icon.
318
- *
319
- * Default: `"if-needed"`.
320
- */
321
- showPlaceType?: ShowPlaceType;
322
- /**
323
- * Displays results while typing:
324
- * - `false`: Search occurs only on pressing the Enter key.
325
- * - `true`: Search begins when the input meets the `minLength` requirement.
326
- *
327
- * Default: `true`.
328
- */
329
- showResultsWhileTyping?: boolean;
330
- /**
331
- * Types to query, either as an array or `[minZoom, maxZoom, type]` format.
332
- * `minZoom` is inclusive, `maxZoom` is exclusive, and either can be `null` or `undefined` for unbounded values.
333
- *
334
- * See `reverseGeocodingTypes` option for reverse geocoding types.
335
- *
336
- * Default: `undefined` (uses server default feature types).
337
- */
338
- types?: TypeRule[];
339
- /**
340
- * Specifies the zoom level to animate the map to for a geocoded result when no bounding box is present or when the result is a point.
341
- * If a bounding box is present and not a point, the map will fit to the bounding box.
342
- *
343
- * Values are key-value pairs where the key is a `<type>` or `<type>.<category>` and the value is the zoom level.
344
- *
345
- * Default: `GeocodingControl.ZOOM_DEFAULTS`.
346
- */
347
- zoom?: Record<string, number>;
348
- };
349
- export type PickedResultStyle = "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
350
- export type EnableReverse = "never" | "always" | "button";
351
- export type ShowPlaceType = "never" | "always" | "if-needed";
352
- export type DispatcherTypeCC = {
353
- featuresListed: {
354
- features: Feature[] | undefined;
355
- };
356
- featuresMarked: {
357
- features: Feature[] | undefined;
358
- };
359
- optionsVisibilityChange: {
360
- optionsVisible: boolean;
361
- };
362
- pick: {
363
- feature: Feature | undefined;
364
- };
365
- queryChange: {
366
- query: string;
367
- };
368
- response: {
369
- url: string;
370
- featureCollection: FeatureCollection;
371
- };
372
- reverseToggle: {
373
- reverse: boolean;
374
- };
375
- select: {
376
- feature: Feature | undefined;
377
- };
378
- };
379
- export type DispatcherType = {
380
- [T in keyof DispatcherTypeCC as Lowercase<T>]: DispatcherTypeCC[T];
381
- };
382
- export type RedefineType<OriginalType, UpdatedType extends {
383
- [K in keyof OriginalType]: OriginalType[K];
384
- } & {
385
- [K in Exclude<keyof UpdatedType, keyof OriginalType>]: never;
386
- }> = UpdatedType;
387
- export type TypeRule = string | [
388
- minZoom: number | null | undefined,
389
- maxZoom: number | null | undefined,
390
- type: string
391
- ];
package/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 {};