From 8184ac8393db9ed3867ab7888206a2451822b168 Mon Sep 17 00:00:00 2001 From: Harel M Date: Wed, 21 Aug 2024 08:56:59 +0300 Subject: [PATCH] Update geocoder to 1.6.0 (#920) This is to update geocoder to latest version which now have types and is fully modernized. --- package-lock.json | 13 +++++++------ package.json | 2 +- src/components/MapMaplibreGl.tsx | 9 ++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2231de0c..8110f387 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@mapbox/mapbox-gl-rtl-text": "^0.2.3", - "@maplibre/maplibre-gl-geocoder": "^1.5.0", + "@maplibre/maplibre-gl-geocoder": "^1.6.0", "@maplibre/maplibre-gl-inspect": "^1.6.3", "@maplibre/maplibre-gl-style-spec": "^20.1.1", "@mdi/js": "^7.4.47", @@ -1626,20 +1626,21 @@ } }, "node_modules/@maplibre/maplibre-gl-geocoder": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-geocoder/-/maplibre-gl-geocoder-1.5.0.tgz", - "integrity": "sha512-PsAbV7WFIOu5QYZne95FiXoV7AV1/6ULMjQxgInhZ5DdB0hDLjciQPegnyDgkzI8JfeqoUMZVS/MglZnSZYhyQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-geocoder/-/maplibre-gl-geocoder-1.6.0.tgz", + "integrity": "sha512-SU4cv1P+8ALZlGYLPNvlENadH4zzn8Lw5ajmhbmJgWdC/NzxGFS+u4TITSL8tjzhMFU4jepo42HvNmGtDJjFuQ==", "dependencies": { + "events": "^3.3.0", "lodash.debounce": "^4.0.6", "subtag": "^0.5.0", "suggestions-list": "^0.0.2", "xtend": "^4.0.1" }, "engines": { - "node": ">=6" + "node": ">=18" }, "peerDependencies": { - "maplibre-gl": ">=1.14.0" + "maplibre-gl": ">=4.0.0" } }, "node_modules/@maplibre/maplibre-gl-inspect": { diff --git a/package.json b/package.json index dc8858ff..9556b3d3 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "homepage": "https://github.com/maplibre/maputnik#readme", "dependencies": { "@mapbox/mapbox-gl-rtl-text": "^0.2.3", - "@maplibre/maplibre-gl-geocoder": "^1.5.0", + "@maplibre/maplibre-gl-geocoder": "^1.6.0", "@maplibre/maplibre-gl-inspect": "^1.6.3", "@maplibre/maplibre-gl-style-spec": "^20.1.1", "@mdi/js": "^7.4.47", diff --git a/src/components/MapMaplibreGl.tsx b/src/components/MapMaplibreGl.tsx index 6a987ca5..c98d742a 100644 --- a/src/components/MapMaplibreGl.tsx +++ b/src/components/MapMaplibreGl.tsx @@ -11,8 +11,7 @@ import { HighlightedLayer, colorHighlightedLayer } from '../libs/highlight' import 'maplibre-gl/dist/maplibre-gl.css' import '../maplibregl.css' import '../libs/maplibre-rtl' -//@ts-ignore -import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder'; +import MaplibreGeocoder, { MaplibreGeocoderApi, MaplibreGeocoderApiConfig } from '@maplibre/maplibre-gl-geocoder'; import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css'; import { withTranslation, WithTranslation } from 'react-i18next' @@ -222,7 +221,7 @@ class MapMaplibreGlInternal extends React.Component { + forwardGeocode: async (config: MaplibreGeocoderApiConfig) => { const features = []; try { const request = `https://nominatim.openstreetmap.org/search?q=${config.query}&format=geojson&polygon_geojson=1&addressdetails=1`; @@ -255,8 +254,8 @@ class MapMaplibreGlInternal extends React.Component