@stadiamaps/ferrostar 0.19.0 → 0.20.1

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/ferrostar.d.ts CHANGED
@@ -3,25 +3,28 @@
3
3
  /**
4
4
  * JavaScript wrapper for `location_simulation_from_coordinates`.
5
5
  * @param {any} coordinates
6
- * @param {number | undefined} [resample_distance]
6
+ * @param {number | undefined} resample_distance
7
+ * @param {LocationBias} bias
7
8
  * @returns {any}
8
9
  */
9
- export function locationSimulationFromCoordinates(coordinates: any, resample_distance?: number): any;
10
+ export function locationSimulationFromCoordinates(coordinates: any, resample_distance: number | undefined, bias: LocationBias): any;
10
11
  /**
11
12
  * JavaScript wrapper for `location_simulation_from_route`.
12
13
  * @param {any} route
13
- * @param {number | undefined} [resample_distance]
14
+ * @param {number | undefined} resample_distance
15
+ * @param {LocationBias} bias
14
16
  * @returns {any}
15
17
  */
16
- export function locationSimulationFromRoute(route: any, resample_distance?: number): any;
18
+ export function locationSimulationFromRoute(route: any, resample_distance: number | undefined, bias: LocationBias): any;
17
19
  /**
18
20
  * JavaScript wrapper for `location_simulation_from_polyline`.
19
21
  * @param {string} polyline
20
22
  * @param {number} precision
21
- * @param {number | undefined} [resample_distance]
23
+ * @param {number | undefined} resample_distance
24
+ * @param {LocationBias} bias
22
25
  * @returns {any}
23
26
  */
24
- export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance?: number): any;
27
+ export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | undefined, bias: LocationBias): any;
25
28
  /**
26
29
  * JavaScript wrapper for `advance_location_simulation`.
27
30
  * @param {any} state
@@ -116,9 +119,12 @@ export interface GeographicCoordinate {
116
119
 
117
120
  export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
118
121
 
122
+ export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
123
+
119
124
  export interface LocationSimulationState {
120
125
  current_location: UserLocation;
121
126
  remaining_locations: GeographicCoordinate[];
127
+ bias: LocationBias;
122
128
  }
123
129
 
124
130
  export interface NavigationControllerConfig {
package/ferrostar_bg.js CHANGED
@@ -188,16 +188,24 @@ function debugString(val) {
188
188
  // TODO we could test for more things here, like `Set`s and `Map`s.
189
189
  return className;
190
190
  }
191
+
192
+ function passArray8ToWasm0(arg, malloc) {
193
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
194
+ getUint8ArrayMemory0().set(arg, ptr / 1);
195
+ WASM_VECTOR_LEN = arg.length;
196
+ return ptr;
197
+ }
191
198
  /**
192
199
  * JavaScript wrapper for `location_simulation_from_coordinates`.
193
200
  * @param {any} coordinates
194
- * @param {number | undefined} [resample_distance]
201
+ * @param {number | undefined} resample_distance
202
+ * @param {LocationBias} bias
195
203
  * @returns {any}
196
204
  */
197
- export function locationSimulationFromCoordinates(coordinates, resample_distance) {
205
+ export function locationSimulationFromCoordinates(coordinates, resample_distance, bias) {
198
206
  try {
199
207
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
200
- wasm.locationSimulationFromCoordinates(retptr, addHeapObject(coordinates), !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance);
208
+ wasm.locationSimulationFromCoordinates(retptr, addHeapObject(coordinates), !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance, addHeapObject(bias));
201
209
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
202
210
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
203
211
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -213,13 +221,14 @@ export function locationSimulationFromCoordinates(coordinates, resample_distance
213
221
  /**
214
222
  * JavaScript wrapper for `location_simulation_from_route`.
215
223
  * @param {any} route
216
- * @param {number | undefined} [resample_distance]
224
+ * @param {number | undefined} resample_distance
225
+ * @param {LocationBias} bias
217
226
  * @returns {any}
218
227
  */
219
- export function locationSimulationFromRoute(route, resample_distance) {
228
+ export function locationSimulationFromRoute(route, resample_distance, bias) {
220
229
  try {
221
230
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
222
- wasm.locationSimulationFromRoute(retptr, addHeapObject(route), !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance);
231
+ wasm.locationSimulationFromRoute(retptr, addHeapObject(route), !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance, addHeapObject(bias));
223
232
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
224
233
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
225
234
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -236,15 +245,16 @@ export function locationSimulationFromRoute(route, resample_distance) {
236
245
  * JavaScript wrapper for `location_simulation_from_polyline`.
237
246
  * @param {string} polyline
238
247
  * @param {number} precision
239
- * @param {number | undefined} [resample_distance]
248
+ * @param {number | undefined} resample_distance
249
+ * @param {LocationBias} bias
240
250
  * @returns {any}
241
251
  */
242
- export function locationSimulationFromPolyline(polyline, precision, resample_distance) {
252
+ export function locationSimulationFromPolyline(polyline, precision, resample_distance, bias) {
243
253
  try {
244
254
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
245
255
  const ptr0 = passStringToWasm0(polyline, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
256
  const len0 = WASM_VECTOR_LEN;
247
- wasm.locationSimulationFromPolyline(retptr, ptr0, len0, precision, !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance);
257
+ wasm.locationSimulationFromPolyline(retptr, ptr0, len0, precision, !isLikeNone(resample_distance), isLikeNone(resample_distance) ? 0 : resample_distance, addHeapObject(bias));
248
258
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
249
259
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
250
260
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -267,13 +277,6 @@ export function advanceLocationSimulation(state) {
267
277
  return takeObject(ret);
268
278
  }
269
279
 
270
- function passArray8ToWasm0(arg, malloc) {
271
- const ptr = malloc(arg.length * 1, 1) >>> 0;
272
- getUint8ArrayMemory0().set(arg, ptr / 1);
273
- WASM_VECTOR_LEN = arg.length;
274
- return ptr;
275
- }
276
-
277
280
  function handleError(f, args) {
278
281
  try {
279
282
  return f.apply(this, args);
@@ -541,9 +544,9 @@ export function __wbindgen_string_new(arg0, arg1) {
541
544
  return addHeapObject(ret);
542
545
  };
543
546
 
544
- export function __wbindgen_error_new(arg0, arg1) {
545
- const ret = new Error(getStringFromWasm0(arg0, arg1));
546
- return addHeapObject(ret);
547
+ export function __wbindgen_as_number(arg0) {
548
+ const ret = +getObject(arg0);
549
+ return ret;
547
550
  };
548
551
 
549
552
  export function __wbindgen_object_clone_ref(arg0) {
@@ -551,13 +554,13 @@ export function __wbindgen_object_clone_ref(arg0) {
551
554
  return addHeapObject(ret);
552
555
  };
553
556
 
554
- export function __wbindgen_jsval_loose_eq(arg0, arg1) {
555
- const ret = getObject(arg0) == getObject(arg1);
556
- return ret;
557
+ export function __wbindgen_error_new(arg0, arg1) {
558
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
559
+ return addHeapObject(ret);
557
560
  };
558
561
 
559
- export function __wbindgen_as_number(arg0) {
560
- const ret = +getObject(arg0);
562
+ export function __wbindgen_jsval_loose_eq(arg0, arg1) {
563
+ const ret = getObject(arg0) == getObject(arg1);
561
564
  return ret;
562
565
  };
563
566
 
@@ -626,6 +629,14 @@ export function __wbg_randomFillSync_5c9c955aa56b6049() { return handleError(fun
626
629
  getObject(arg0).randomFillSync(takeObject(arg1));
627
630
  }, arguments) };
628
631
 
632
+ export function __wbg_String_88810dfeb4021902(arg0, arg1) {
633
+ const ret = String(getObject(arg1));
634
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
635
+ const len1 = WASM_VECTOR_LEN;
636
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
637
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
638
+ };
639
+
629
640
  export function __wbg_get_3baa728f9d58d3f6(arg0, arg1) {
630
641
  const ret = getObject(arg0)[arg1 >>> 0];
631
642
  return addHeapObject(ret);
package/ferrostar_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "Luke Seelenbinder <luke@stadiamaps.com>"
8
8
  ],
9
9
  "description": "The core of modern turn-by-turn navigation.",
10
- "version": "0.19.0",
10
+ "version": "0.20.1",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",