@maptiler/geocoding-control 0.0.44 → 0.0.48
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/README.md +18 -4
- package/dist/leaflet.js +3909 -3883
- package/dist/leaflet.umd.js +4 -24
- package/dist/lib/types.d.ts +44 -3
- package/dist/main.d.ts +1 -1
- package/dist/maplibregl.js +4014 -3993
- package/dist/maplibregl.umd.js +4 -24
- package/dist/style.css +1 -1
- package/package.json +11 -11
- package/src/lib/GeocodingControl.svelte +106 -40
- package/src/lib/MarkerIcon.svelte +21 -14
- package/src/lib/leafletMapController.ts +102 -51
- package/src/lib/maplibreglMapController.ts +93 -43
- package/src/lib/types.ts +41 -29
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ For examples without using bundler see `demo-maplibregl.html` or `demo-leaflet.h
|
|
|
74
74
|
|
|
75
75
|
## API Documentation
|
|
76
76
|
|
|
77
|
-
Options
|
|
77
|
+
### Options
|
|
78
78
|
|
|
79
79
|
- `apiKey`<sup>\*</sup>: `string` - Maptiler API key
|
|
80
80
|
- `maplibregl`: `MapLibreGL` - A Maplibre GL instance to use when creating [Markers](https://maplibre.org/maplibre-gl-js-docs/api/markers/#marker). Required if `options.marker` is `true`. Used only with Maplibre GL library.
|
|
@@ -86,7 +86,7 @@ Options:
|
|
|
86
86
|
- `trackProximity`: `boolean` - If true, the geocoder proximity will automatically update based on the map view. Default `true`.
|
|
87
87
|
- `minLength`: `number` - Minimum number of characters to enter before results are shown. Default `2`.
|
|
88
88
|
- `bbox`: `[number, number, number, number]` - 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.
|
|
89
|
-
- `language`: `string` - 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. Set to empty string for forcing no language preference.
|
|
89
|
+
- `language`: `string | string[]` - Specify the language(s) 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. Set to empty string for forcing no language preference.
|
|
90
90
|
- `showResultsWhileTyping`: `boolean` - If `false`, indicates that search will only occur on enter key press. If `true`, indicates that the Geocoder will search on the input box being updated above the minLength option. Default `false`.
|
|
91
91
|
- `marker`: `boolean | MarkerOptions` - If `true`, a [MapLibre GL Marker](https://maplibre.org/maplibre-gl-js-docs/api/markers/#marker) / [Leaflet Marker](https://leafletjs.com/reference.html#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.maplibregl` also be set. Default `true`.
|
|
92
92
|
- `showResultMarkers`: `boolean | MarkerOptions` - If `true`, [MapLibre GL Marker](https://maplibre.org/maplibre-gl-js-docs/api/markers/#marker) / [Leaflet Marker](https://leafletjs.com/reference.html#marker) will be added to the map at the location the top results for the query. 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.maplibregl` also be set. Default `true`.
|
|
@@ -101,15 +101,21 @@ Options:
|
|
|
101
101
|
- `clearButtonTitle`: `string` - Clear button title. Default `"clear"`.
|
|
102
102
|
- `showFullGeometry`: `boolean` - Set to `true` to show full feature geometry of the chosen result. Otherwise only marker will be shown. Default `true`.
|
|
103
103
|
- `fullGeometryStyle`: `{ fill: Pick<FillLayerSpecification, "layout" | "paint" | "filter">; line: Pick<LineLayerSpecification, "layout" | "paint" | "filter">; } | (L.PathOptions | L.StyleFunction)` - style of the full feature geometry. See Mapplibre GL JS or Leaflet documentation.
|
|
104
|
+
- `fuzzyMatch`: `boolean` - Set to `false` to disable fuzzy search. Default `true`.
|
|
105
|
+
- `limit`: `number` - Maximum number of results to show. Default `5`.
|
|
106
|
+
- `country`: `string | string[]` - Limit search to specified country(ies). Default `undefined` (use all countries).
|
|
107
|
+
- `types`: `string[]` - Filter of feature types to return. Default `undefined` (all available feature types are returned).
|
|
104
108
|
|
|
105
|
-
Methods
|
|
109
|
+
### Methods
|
|
106
110
|
|
|
107
111
|
- `setQuery(value: string, submit = true): void` - set the query and optionally submit it
|
|
108
112
|
- `focus(): void` - focus the query input box
|
|
109
113
|
- `blur(): void` - blur the query input box
|
|
110
114
|
- `setReverseMode(value: boolean | "always"): void` - set reverse mode
|
|
111
115
|
|
|
112
|
-
Events
|
|
116
|
+
### Events
|
|
117
|
+
|
|
118
|
+
Events are implemented using [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) and [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent).
|
|
113
119
|
|
|
114
120
|
- `select` - Fired on highlighting search result in the dropdown by hovering it or by keyboard selection. Event value will be set to the highlighted `Feature` or to `undefined` if nothing is highlighted.
|
|
115
121
|
- `pick` - Fired on picking the result from the dropdown. Event value will be set to the picked `Feature` or to `undefined` if nothing is picked (eg. search input is cleared).
|
|
@@ -120,6 +126,14 @@ Events:
|
|
|
120
126
|
- `reversetoggle` - Fired if reverse geocoding button is toggled. Event value is `true` if reverse geocoding mode is active, otherwise `false`.
|
|
121
127
|
- `querychange` - Fired if query was changed. Event value is the query string.
|
|
122
128
|
|
|
129
|
+
Example:
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
geocodingControl.addEventListener("optionsVisibilityChange", (e) => {
|
|
133
|
+
console.log("Options visible:", e.detail);
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
123
137
|
## Svelte component
|
|
124
138
|
|
|
125
139
|
In addition to using the component as MapLibre GL Control it is alto possible to use it stand-alone in Svelte projects.
|