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

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 reverse = "never";
47
47
  export let errorMessage = "Something went wrong…";
48
48
  export let filter = () => true;
49
49
  export let flyTo = true;
@@ -57,7 +57,7 @@ export let placeholder = "Search";
57
57
  export let proximity = [
58
58
  { type: "server-geolocation" },
59
59
  ];
60
- export let reverseActive = enableReverse === "always";
60
+ export let reverseActive = reverse === "always";
61
61
  export let reverseButtonTitle = "toggle reverse geocoding";
62
62
  export let searchValue = "";
63
63
  export let pickedResultStyle = "full-geometry";
@@ -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.3" +
78
78
  "/icons/";
79
79
  export let adjustUrlQuery = () => { };
80
80
  export function focus() {
@@ -123,7 +123,7 @@ let prevIdToFly;
123
123
  const missingIconsCache = new Set();
124
124
  const dispatch = createEventDispatcher();
125
125
  $: {
126
- reverseActive = enableReverse === "always";
126
+ reverseActive = reverse === "always";
127
127
  }
128
128
  $: if (pickedResultStyle !== "marker-only" &&
129
129
  picked &&
@@ -464,7 +464,7 @@ function computeZoom(feature) {
464
464
  : undefined) ?? zoom[index]);
465
465
  }
466
466
  function handleReverse(coordinates) {
467
- reverseActive = enableReverse === "always";
467
+ reverseActive = reverse === "always";
468
468
  listFeatures = undefined;
469
469
  picked = undefined;
470
470
  selectedItemIndex = -1;
@@ -570,7 +570,7 @@ function pick(feature) {
570
570
  {/if}
571
571
  </div>
572
572
 
573
- {#if enableReverse === true}
573
+ {#if reverse !== "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
+ reverse?: 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;