@maptiler/geocoding-control 2.0.0-rc.2 → 2.0.0-rc.4

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.
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { Feature } from "./types";
2
+ import type { Feature, ShowPlaceType } from "./types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  feature: Feature;
6
6
  selected?: boolean;
7
- showPlaceType: "never" | "always" | "if-needed";
7
+ showPlaceType: ShowPlaceType;
8
8
  missingIconsCache: Set<string>;
9
9
  iconsBaseUrl: string;
10
10
  };
@@ -43,7 +43,7 @@ export let clearOnBlur = false;
43
43
  export let collapsed = false;
44
44
  export let country = undefined;
45
45
  export let debounceSearch = 200;
46
- export let enableReverse = false;
46
+ export let enableReverse = "never";
47
47
  export let errorMessage = "Something went wrong…";
48
48
  export let filter = () => true;
49
49
  export let flyTo = true;
@@ -74,7 +74,7 @@ export let zoom = ZOOM_DEFAULTS;
74
74
  export let apiUrl = "https://api.maptiler.com/geocoding";
75
75
  export let fetchParameters = {};
76
76
  export let iconsBaseUrl = "https://cdn.maptiler.com/maptiler-geocoding-control/v" +
77
- "2.0.0-rc.2" +
77
+ "2.0.0-rc.4" +
78
78
  "/icons/";
79
79
  export let adjustUrlQuery = () => { };
80
80
  export function focus() {
@@ -570,7 +570,7 @@ function pick(feature) {
570
570
  {/if}
571
571
  </div>
572
572
 
573
- {#if enableReverse === true}
573
+ {#if enableReverse !== "never"}
574
574
  <button
575
575
  type="button"
576
576
  class:active={reverseActive}
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { BBox, Feature, FeatureCollection, MapController, ProximityRule } from "./types";
2
+ import type { BBox, EnableReverse, Feature, FeatureCollection, MapController, PickedResultStyle, ProximityRule, ShowPlaceType } from "./types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  ZOOM_DEFAULTS?: Record<string, number>;
@@ -11,7 +11,7 @@ declare const __propDef: {
11
11
  collapsed?: boolean;
12
12
  country?: string | string[] | undefined;
13
13
  debounceSearch?: number;
14
- enableReverse?: boolean | "always";
14
+ enableReverse?: EnableReverse;
15
15
  errorMessage?: string;
16
16
  filter?: (feature: Feature) => boolean;
17
17
  flyTo?: boolean;
@@ -26,8 +26,8 @@ declare const __propDef: {
26
26
  reverseActive?: boolean;
27
27
  reverseButtonTitle?: string;
28
28
  searchValue?: string;
29
- pickedResultStyle?: "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
30
- showPlaceType?: "never" | "always" | "if-needed";
29
+ pickedResultStyle?: PickedResultStyle;
30
+ showPlaceType?: ShowPlaceType;
31
31
  showResultsWhileTyping?: boolean;
32
32
  autocompleteTimeout?: number | undefined;
33
33
  selectFirst?: boolean;
package/svelte/types.d.ts CHANGED
@@ -99,6 +99,7 @@ export type ControlOptions = {
99
99
  noResultsMessage?: string;
100
100
  /**
101
101
  * Minimum number of characters to enter before results are shown.
102
+ *
102
103
  * Default value is `2`.
103
104
  */
104
105
  minLength?: number;
@@ -135,7 +136,7 @@ export type ControlOptions = {
135
136
  /**
136
137
  * Set to `false` to disable fuzzy search.
137
138
  *
138
- * Default value is `true`
139
+ * Default value is `true`.
139
140
  */
140
141
  fuzzyMatch?: boolean;
141
142
  /**
@@ -149,17 +150,21 @@ export type ControlOptions = {
149
150
  zoom?: Record<string, number>;
150
151
  /**
151
152
  * If `true`, the geocoder control will collapse until hovered or in focus.
153
+ *
152
154
  * Default value is `false`.
153
155
  */
154
156
  collapsed?: boolean;
155
157
  /**
156
158
  * If true, the geocoder control will clear its value when the input blurs.
159
+ *
157
160
  * Default value is `false`.
158
161
  */
159
162
  clearOnBlur?: boolean;
160
163
  /**
161
164
  * A function which accepts a Feature in the Carmen GeoJSON format to filter out results from the Geocoding API response before they are included in the suggestions list.
162
165
  * Return true to keep the item, false otherwise.
166
+ *
167
+ * Default value is a function returning always `true`.
163
168
  */
164
169
  filter?: (feature: Feature) => boolean;
165
170
  /**
@@ -169,13 +174,13 @@ export type ControlOptions = {
169
174
  */
170
175
  class?: string;
171
176
  /**
172
- * Set to `true` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active.
177
+ * Set to `button` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active.
173
178
  *
174
- * Default value is `false`
179
+ * Default value is `"never"`.
175
180
  */
176
- enableReverse?: boolean | "always";
181
+ enableReverse?: EnableReverse;
177
182
  /**
178
- * Reverse mode.
183
+ * Reverse mode active.
179
184
  *
180
185
  * Default value is `false`.
181
186
  */
@@ -198,7 +203,7 @@ export type ControlOptions = {
198
203
  *
199
204
  * Default value is `"if-needed"`.
200
205
  */
201
- showPlaceType?: "never" | "always" | "if-needed";
206
+ showPlaceType?: ShowPlaceType;
202
207
  /**
203
208
  * Style of the picked result on the map:
204
209
  *
@@ -208,7 +213,7 @@ export type ControlOptions = {
208
213
  *
209
214
  * Default value is `true`.
210
215
  */
211
- pickedResultStyle?: "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
216
+ pickedResultStyle?: PickedResultStyle;
212
217
  /**
213
218
  * Limit search to specified country(ies).
214
219
  *
@@ -277,6 +282,9 @@ export type ControlOptions = {
277
282
  */
278
283
  markerOnSelected?: boolean;
279
284
  };
285
+ export type PickedResultStyle = "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
286
+ export type EnableReverse = "never" | "always" | "button";
287
+ export type ShowPlaceType = "never" | "always" | "if-needed";
280
288
  export type DispatcherTypeCC = {
281
289
  featuresListed: {
282
290
  features: Feature[] | undefined;
package/types.d.ts CHANGED
@@ -99,6 +99,7 @@ export type ControlOptions = {
99
99
  noResultsMessage?: string;
100
100
  /**
101
101
  * Minimum number of characters to enter before results are shown.
102
+ *
102
103
  * Default value is `2`.
103
104
  */
104
105
  minLength?: number;
@@ -135,7 +136,7 @@ export type ControlOptions = {
135
136
  /**
136
137
  * Set to `false` to disable fuzzy search.
137
138
  *
138
- * Default value is `true`
139
+ * Default value is `true`.
139
140
  */
140
141
  fuzzyMatch?: boolean;
141
142
  /**
@@ -149,17 +150,21 @@ export type ControlOptions = {
149
150
  zoom?: Record<string, number>;
150
151
  /**
151
152
  * If `true`, the geocoder control will collapse until hovered or in focus.
153
+ *
152
154
  * Default value is `false`.
153
155
  */
154
156
  collapsed?: boolean;
155
157
  /**
156
158
  * If true, the geocoder control will clear its value when the input blurs.
159
+ *
157
160
  * Default value is `false`.
158
161
  */
159
162
  clearOnBlur?: boolean;
160
163
  /**
161
164
  * A function which accepts a Feature in the Carmen GeoJSON format to filter out results from the Geocoding API response before they are included in the suggestions list.
162
165
  * Return true to keep the item, false otherwise.
166
+ *
167
+ * Default value is a function returning always `true`.
163
168
  */
164
169
  filter?: (feature: Feature) => boolean;
165
170
  /**
@@ -169,13 +174,13 @@ export type ControlOptions = {
169
174
  */
170
175
  class?: string;
171
176
  /**
172
- * Set to `true` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active.
177
+ * Set to `button` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active.
173
178
  *
174
- * Default value is `false`
179
+ * Default value is `"never"`.
175
180
  */
176
- enableReverse?: boolean | "always";
181
+ enableReverse?: EnableReverse;
177
182
  /**
178
- * Reverse mode.
183
+ * Reverse mode active.
179
184
  *
180
185
  * Default value is `false`.
181
186
  */
@@ -198,7 +203,7 @@ export type ControlOptions = {
198
203
  *
199
204
  * Default value is `"if-needed"`.
200
205
  */
201
- showPlaceType?: "never" | "always" | "if-needed";
206
+ showPlaceType?: ShowPlaceType;
202
207
  /**
203
208
  * Style of the picked result on the map:
204
209
  *
@@ -208,7 +213,7 @@ export type ControlOptions = {
208
213
  *
209
214
  * Default value is `true`.
210
215
  */
211
- pickedResultStyle?: "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
216
+ pickedResultStyle?: PickedResultStyle;
212
217
  /**
213
218
  * Limit search to specified country(ies).
214
219
  *
@@ -277,6 +282,9 @@ export type ControlOptions = {
277
282
  */
278
283
  markerOnSelected?: boolean;
279
284
  };
285
+ export type PickedResultStyle = "marker-only" | "full-geometry" | "full-geometry-including-polygon-center-marker";
286
+ export type EnableReverse = "never" | "always" | "button";
287
+ export type ShowPlaceType = "never" | "always" | "if-needed";
280
288
  export type DispatcherTypeCC = {
281
289
  featuresListed: {
282
290
  features: Feature[] | undefined;
package/vanilla.js CHANGED
@@ -1834,7 +1834,7 @@ function Sn(i) {
1834
1834
  i[19] && Ut()
1835
1835
  ), m = (
1836
1836
  /*enableReverse*/
1837
- i[5] === !0 && At(i)
1837
+ i[5] !== "never" && At(i)
1838
1838
  );
1839
1839
  const M = (
1840
1840
  /*#slots*/
@@ -1986,7 +1986,7 @@ function Sn(i) {
1986
1986
  /*searchValue*/
1987
1987
  L[1] !== ""
1988
1988
  ), /*enableReverse*/
1989
- L[5] === !0 ? m ? (m.p(L, F), F[0] & /*enableReverse*/
1989
+ L[5] !== "never" ? m ? (m.p(L, F), F[0] & /*enableReverse*/
1990
1990
  32 && H(m, 1)) : (m = At(L), m.c(), H(m, 1), m.m(n, w)) : m && (Ze(), Q(m, 1, 1, () => {
1991
1991
  m = null;
1992
1992
  }), qe()), j && j.p && (!z || F[1] & /*$$scope*/
@@ -2061,7 +2061,7 @@ function pn(i, e, t) {
2061
2061
  "poi.restaurant": 18,
2062
2062
  "poi.aerodrome": 13
2063
2063
  };
2064
- let { class: o = void 0 } = e, { apiKey: d } = e, { bbox: u = void 0 } = e, { clearButtonTitle: f = "clear" } = e, { clearOnBlur: h = !1 } = e, { collapsed: v = !1 } = e, { country: _ = void 0 } = e, { debounceSearch: w = 200 } = e, { enableReverse: W = !1 } = e, { errorMessage: y = "Something went wrong…" } = e, { filter: E = () => !0 } = e, { flyTo: C = !0 } = e, { fuzzyMatch: z = !0 } = e, { language: p = void 0 } = e, { limit: q = void 0 } = e, { mapController: b = void 0 } = e, { minLength: g = 2 } = e, { noResultsMessage: m = "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!" } = e, { placeholder: M = "Search" } = e, { proximity: j = [{ type: "server-geolocation" }] } = e, { reverseActive: Y = W === "always" } = e, { reverseButtonTitle: te = "toggle reverse geocoding" } = e, { searchValue: B = "" } = e, { pickedResultStyle: L = "full-geometry" } = e, { showPlaceType: F = "if-needed" } = e, { showResultsWhileTyping: ie = !0 } = e, { autocompleteTimeout: we = void 0 } = e, { selectFirst: Ee = !0 } = e, { flyToSelected: Qe = !1 } = e, { markerOnSelected: Oe = !0 } = e, { types: he = void 0 } = e, { exhaustiveReverseGeocoding: Ke = !1 } = e, { excludeTypes: Ie = !1 } = e, { zoom: Ue = c } = e, { apiUrl: Ve = "https://api.maptiler.com/geocoding" } = e, { fetchParameters: xe = {} } = e, { iconsBaseUrl: ft = "https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.0-rc.2/icons/" } = e, { adjustUrlQuery: Je = () => {
2064
+ let { class: o = void 0 } = e, { apiKey: d } = e, { bbox: u = void 0 } = e, { clearButtonTitle: f = "clear" } = e, { clearOnBlur: h = !1 } = e, { collapsed: v = !1 } = e, { country: _ = void 0 } = e, { debounceSearch: w = 200 } = e, { enableReverse: W = "never" } = e, { errorMessage: y = "Something went wrong…" } = e, { filter: E = () => !0 } = e, { flyTo: C = !0 } = e, { fuzzyMatch: z = !0 } = e, { language: p = void 0 } = e, { limit: q = void 0 } = e, { mapController: b = void 0 } = e, { minLength: g = 2 } = e, { noResultsMessage: m = "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!" } = e, { placeholder: M = "Search" } = e, { proximity: j = [{ type: "server-geolocation" }] } = e, { reverseActive: Y = W === "always" } = e, { reverseButtonTitle: te = "toggle reverse geocoding" } = e, { searchValue: B = "" } = e, { pickedResultStyle: L = "full-geometry" } = e, { showPlaceType: F = "if-needed" } = e, { showResultsWhileTyping: ie = !0 } = e, { autocompleteTimeout: we = void 0 } = e, { selectFirst: Ee = !0 } = e, { flyToSelected: Qe = !1 } = e, { markerOnSelected: Oe = !0 } = e, { types: he = void 0 } = e, { exhaustiveReverseGeocoding: Ke = !1 } = e, { excludeTypes: Ie = !1 } = e, { zoom: Ue = c } = e, { apiUrl: Ve = "https://api.maptiler.com/geocoding" } = e, { fetchParameters: xe = {} } = e, { iconsBaseUrl: ft = "https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.0-rc.4/icons/" } = e, { adjustUrlQuery: Je = () => {
2065
2065
  } } = e;
2066
2066
  function Vt() {
2067
2067
  ne.focus();