From ddc33eba3d94a9bc206f77ef5168b2ac2aa27ee7 Mon Sep 17 00:00:00 2001 From: Maks Date: Wed, 3 Feb 2021 12:57:56 +0200 Subject: [PATCH] deps: add @types/mapbox__mapbox-gl-geocoder --- package.json | 1 + tsconfig.json | 1 - types/mapbox__mapbox-gl-geocoder/index.d.ts | 253 -------------------- yarn.lock | 15 ++ 4 files changed, 16 insertions(+), 254 deletions(-) delete mode 100644 types/mapbox__mapbox-gl-geocoder/index.d.ts diff --git a/package.json b/package.json index b5a8e6d08..1cd811bad 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@types/jasminewd2": "^2.0.6", "@types/lodash-es": "^4.17.3", "@types/mapbox-gl": "2.0.3", + "@types/mapbox__mapbox-gl-geocoder": "4.7.0", "angular-cli-ghpages": "^0.6.0", "codelyzer": "^6.0.0", "commitizen": "^4.0.3", diff --git a/tsconfig.json b/tsconfig.json index cf34c6ffc..dc0b82c65 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,6 @@ "typeRoots": ["node_modules/@types"], "lib": ["es2017", "dom"], "paths": { - "@mapbox/*": ["types/mapbox__*"], "ngx-mapbox-gl": ["projects/ngx-mapbox-gl/src/public_api"] }, "strict": true, diff --git a/types/mapbox__mapbox-gl-geocoder/index.d.ts b/types/mapbox__mapbox-gl-geocoder/index.d.ts deleted file mode 100644 index f77495a42..000000000 --- a/types/mapbox__mapbox-gl-geocoder/index.d.ts +++ /dev/null @@ -1,253 +0,0 @@ -/// -/// - -export as namespace MapboxGeocoder; -export = MapboxGeocoder; - -declare namespace MapboxGeocoder { - interface LngLatLiteral { - latitude: number; - longitude: number; - } - - interface Results extends GeoJSON.FeatureCollection { - attribution: string; - query: string[]; - } - - interface Result extends GeoJSON.Feature { - bbox: [number, number, number, number]; - center: number[]; - place_name: string; - place_type: string[]; - relevance: number; - text: string; - address: string; - context: any[]; - } - - type Bbox = [number, number, number, number]; - - interface GeocoderOptions { - accessToken: string; - - /** Use to set a custom API origin. (optional, default "https://api.mapbox.com" */ - origin?: string; - - /** A [mapbox-gl](https://github.com/mapbox/mapbox-gl-js) instance to use when creating [Markers](https://docs.mapbox.com/mapbox-gl-js/api/#marker). Required if `options.marker` is `true`.*/ - mapboxgl?: mapboxgl.Map; - - /** On geocoded result what zoom level should the map animate to when a bbox isn't found in the response. If a bbox is found the map will fit to the bbox. (optional, default 16) */ - zoom?: number; - - /** Override the default placeholder attribute value. (optional, default "Search") */ - placeholder?: string; - - /** If `false`, animating the map to a selected result is disabled. If `true`, animating the map will use the default animation parameters. - * If an object, it will be passed as `options` to the map [`flyTo`](https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto) - * or [`fitBounds`](https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds) method providing control over the animation of the transition. (optional, default true) */ - flyTo?: boolean | Object; - - /** a proximity argument: this is a geographical point given as an object with latitude and longitude properties. Search results closer to this point will be given higher priority. */ - proximity?: LngLatLiteral; - - /** If `true`, the geocoder proximity will automatically update based on the map view. (optional, default true)*/ - trackProximity?: boolean; - - /** If `true`, the geocoder control will collapse until hovered or in focus. (optional, default false) */ - collapsed?: boolean; - - /** If `true`, the geocoder control will clear it's contents and blur when user presses the escape key. (optional, default false)*/ - clearAndBlurOnEsc?: boolean; - - /** If `true`, the geocoder control will clear its value when the input blurs. (optional, default false)*/ - clearOnBlur?: boolean; - - /** a bounding box argument: this is a bounding box given as an array in the format [minX, minY, maxX, maxY]. - * Search results will be limited to the bounding box. */ - bbox?: Bbox; - - /** a comma seperated list of types that filter results to match those specified. See https://www.mapbox.com/developers/api/geocoding/#filter-type for available types. */ - types?: string; - - /** a comma separated list of country codes to limit results to specified country or countries. */ - countries?: string; - - /** Minimum number of characters to enter before results are shown. (optional, default 2) */ - minLength?: number; - - /** Maximum number of results to show. (optional, default 5) */ - limit?: number; - - /** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. Defaults to the browser's language settings.*/ - language?: string; - - /** A function which accepts a Feature in the [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise.*/ - filter?: (feature: Result) => boolean; - - /** A function accepting the query string and current features list which performs geocoding to supplement results from the Mapbox Geocoding API. Expected to return a Promise which resolves to an Array of GeoJSON Features in the [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) format.*/ - externalGeocoder?: Function; - - /** If `true`, enable reverse geocoding mode. In reverse geocoding, search input is expected to be coordinates in the form `lat, lon`, with suggestions being the reverse geocodes. (optional, default false)*/ - reverseGeocode?: boolean; - - /** Allow Mapbox to collect anonymous usage statistics from the plugin. (optional, default true) */ - enableEventLogging?: boolean; - - /** If `true`, a [Marker](https://docs.mapbox.com/mapbox-gl-js/api/#marker) will be added to the map at the location of the user-selected result using a default set of Marker options. - * If the value is an object, the marker will be constructed using these options. If `false`, no marker will be added to the map. Requires that `options.mapboxgl` also be set. (optional, default true) */ - marker?: boolean | mapboxgl.Marker; - - /** A function that specifies how the results should be rendered in the dropdown menu. This function should accepts a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and return a string. Any HTML in the returned string will be rendered. */ - render?: (feature: Result) => string; - - /** A function that specifies how the selected result should be rendered in the search bar. This function should accept a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and return a string. HTML tags in the output string will not be rendered. Defaults to `(item) => item.place_name`. */ - getItemValue?: (feature: Result) => string; - - /** A string specifying the geocoding [endpoint](https://docs.mapbox.com/api/search/#endpoints) to query. Options are `mapbox.places` and `mapbox.places`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes. (optional, default "mapbox.places") */ - mode?: 'mapbox.places' | 'mapbox.places-permanent'; - /** A function accepting the query string which performs local geocoding to supplement results from the Mapbox Geocoding API. Expected to return an Array of GeoJSON Features in the [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) format. */ - localGeocoder?: (query: string) => Result[]; - - /** If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user. If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher. (optional, default false) */ - localGeocoderOnly?: boolean; - } -} - -declare class MapboxGeocoder implements mapboxgl.IControl { - constructor(options?: MapboxGeocoder.GeocoderOptions); - - addTo(container: String | HTMLElement | mapboxgl.Map): this; - - onAdd(map: mapboxgl.Map): HTMLElement; - - createIcon(name: string, path: any): SVGSVGElement; - - onRemove(): this; - - /** - * Clear and then focus the input. - * [ev] the event that triggered the clear, if available - * - */ - clear(ev: Event): void; - - /** - * Set & query the input - */ - query(searchInput: string): this; - - /** - * Set input - * searchInput location name or other search input - */ - setInput(searchInput: string): this; - - /** - * Set proximity The new `options.proximity` value. This is a geographical point given as an object with `latitude` and `longitude` properties. - */ - setProximity(proximity: MapboxGeocoder.LngLatLiteral): this; - - /** - * Get the geocoder proximity - */ - getProximity(): MapboxGeocoder.LngLatLiteral; - - /** - * Set the render function used in the results dropdown - * The function to use as a render function. This function accepts a single [Carmen GeoJSON](https://github.com/mapbox/carmen/blob/master/carmen-geojson.md) object as input and returns a string. - */ - setRenderFunction(fn: Function): this; - - /** - * Get the function used to render the results dropdown - */ - getRenderFunction(): Function; - - /** - * Get the language to use in UI elements and when making search requests - * - * Look first at the explicitly set options otherwise use the browser's language settings - * language Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. - */ - setLanguage(language: string): this; - - /** - * Get the language to use in UI elements and when making search requests - */ - getLanguage(): string; - - /** - * Get the zoom level the map will move to when there is no bounding box on the selected result - */ - getZoom(): number; - - /** - * Set the zoom level that the map should animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. - */ - setZoom(zoom: number): this; - - /** - * Set the flyTo options - * If false, animating the map to a selected result is disabled. If true, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`](https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto) or [`fitBounds`](https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds) method providing control over the animation of the transition. - */ - setFlyTo(flyTo: boolean | Object): this; - - /** - * Get the parameters used to fly to the selected response, if any - */ - getFlyTo(): boolean | Object; - - /** - * Get the value of the placeholder string - */ - getPlaceholder(): string; - - /** - * Set the value of the input element's placeholder - * placeholder the text to use as the input element's placeholder - */ - setPlaceholder(placeholder: string): this; - - getBbox(): MapboxGeocoder.Bbox; - - setBbox(bbox: MapboxGeocoder.Bbox): this; - - getCountries(): string; - - setCountries(countries: string): this; - - getTypes(): string; - - setTypes(types: string): this; - - getMinLength(): number; - - setMinLength(minLength: number): this; - - getLimit(): number; - - setLimit(limit: number): this; - - getFilter(): (feature: MapboxGeocoder.Result) => boolean; - - setFilter(filter: (feature: MapboxGeocoder.Result) => boolean): this; - - setOrigin(origin: Function): this; - - getOrigin(): Function; - - /** - * Subscribe to events that happen within the plugin. - * type name of event. Available events and the data passed into their respective event objects are: - * - * - __clear__ `Emitted when the input is cleared` - * - __loading__ `{ query } Emitted when the geocoder is looking up a query` - * - __results__ `{ results } Fired when the geocoder returns a response` - * - __result__ `{ result } Fired when input is set` - * - __error__ `{ error } Error as string` - */ - on(type: string, fn: Function): this; - - off(type: string, fn: Function): this; -} diff --git a/yarn.lock b/yarn.lock index 430274173..2240ade9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1490,6 +1490,13 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008" integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q== +"@types/mapbox-gl@*": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/mapbox-gl/-/mapbox-gl-2.0.4.tgz#cc407ee56d4ac89e71340b3bedbb6cc58d9d27e9" + integrity sha512-0qxx/jK+/t5dcJ9LjTCvtcUamryk8yZUCQcpcOs/mQU6JipW15taAfUKvyNLC/PmhJYLSN5U4GrLFl6cBSGemg== + dependencies: + "@types/geojson" "*" + "@types/mapbox-gl@2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/mapbox-gl/-/mapbox-gl-2.0.3.tgz#06faab3b509902a97d65a27c200d6af151824e42" @@ -1497,6 +1504,14 @@ dependencies: "@types/geojson" "*" +"@types/mapbox__mapbox-gl-geocoder@4.7.0": + version "4.7.0" + resolved "https://registry.yarnpkg.com/@types/mapbox__mapbox-gl-geocoder/-/mapbox__mapbox-gl-geocoder-4.7.0.tgz#804b4f5b0e5e281be15b79a9cef1253495974b60" + integrity sha512-I2mPBvibX5F9bTfWpHLFpDhJjUXdCziBcV+1ZW5vADjPqXrP9ee8gvUgTlrbDx5nZ4JyWB6nbQ4U6um9NJZN3g== + dependencies: + "@types/geojson" "*" + "@types/mapbox-gl" "*" + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"