mobility-toolbox-js 3.0.0-beta.33 → 3.0.0-beta.34

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.
Files changed (35) hide show
  1. package/api/RealtimeAPI.d.ts +2 -2
  2. package/api/RealtimeAPI.js +3 -3
  3. package/common/controls/StopFinderControlCommon.d.ts +1 -1
  4. package/common/controls/StopFinderControlCommon.js +1 -1
  5. package/common/utils/RealtimeEngine.d.ts +0 -10
  6. package/common/utils/RealtimeEngine.js +0 -10
  7. package/common/utils/renderTrajectories.d.ts +1 -0
  8. package/common/utils/renderTrajectories.js +1 -0
  9. package/common/utils/sortAndFilterDepartures.d.ts +1 -0
  10. package/common/utils/sortAndFilterDepartures.js +1 -0
  11. package/maplibre/controls/CopyrightControl.d.ts +9 -6
  12. package/maplibre/controls/CopyrightControl.js +11 -8
  13. package/maplibre/layers/Layer.d.ts +7 -6
  14. package/maplibre/layers/Layer.js +1 -2
  15. package/maplibre/layers/RealtimeLayer.d.ts +4 -2
  16. package/maplibre/layers/RealtimeLayer.js +26 -11
  17. package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
  18. package/maplibre/utils/getSourceCoordinates.js +5 -4
  19. package/mbt.js +239 -200
  20. package/mbt.js.map +3 -3
  21. package/mbt.min.js +13 -13
  22. package/mbt.min.js.map +4 -4
  23. package/ol/controls/CopyrightControl.d.ts +13 -5
  24. package/ol/controls/CopyrightControl.js +13 -5
  25. package/ol/controls/RoutingControl.d.ts +25 -15
  26. package/ol/controls/RoutingControl.js +31 -19
  27. package/ol/controls/StopFinderControl.d.ts +22 -0
  28. package/ol/controls/StopFinderControl.js +22 -0
  29. package/ol/layers/MaplibreLayer.d.ts +6 -1
  30. package/ol/layers/MaplibreLayer.js +6 -1
  31. package/ol/layers/MaplibreStyleLayer.d.ts +5 -9
  32. package/ol/layers/MaplibreStyleLayer.js +5 -3
  33. package/ol/layers/RealtimeLayer.d.ts +4 -1
  34. package/ol/layers/RealtimeLayer.js +4 -1
  35. package/package.json +21 -20
@@ -1,11 +1,11 @@
1
1
  import { MapEvent } from 'ol';
2
2
  import Control, { Options } from 'ol/control/Control';
3
- export type CopyrightControlOptions = Options & {
3
+ export type CopyrightControlOptions = {
4
4
  className?: 'string';
5
5
  format?: (copyrights: string[]) => string;
6
- };
6
+ } & Options;
7
7
  /**
8
- * Display layer's copyrights.
8
+ * Display layer's copyrights. Adding the possibility to format them as you wish.
9
9
  *
10
10
  * @example
11
11
  * import { Map } from 'ol';
@@ -19,12 +19,20 @@ export type CopyrightControlOptions = Options & {
19
19
  * map.addControl(control);
20
20
  *
21
21
  *
22
- * @see <a href="/example/ol-copyright">Openlayers copyright example</a>
22
+ * @see <a href="/example/ol-realtime>OpenLayers Realtime layer example</a>
23
+ *
24
+ * @extends {ol/control/Control~Control}
23
25
  *
24
- * @extends {ol/control/Control}
25
26
  */
26
27
  declare class CopyrightControl extends Control {
27
28
  format: (copyrights: string[]) => string;
29
+ /**
30
+ * Constructor.
31
+ *
32
+ * @param {Object} options
33
+ * @param {Function} format Function used to format the list of copyrights available to a single string. By default join all the copyrights with a |.
34
+ * @public
35
+ */
28
36
  constructor(options?: CopyrightControlOptions);
29
37
  render({ frameState }: MapEvent): void;
30
38
  }
@@ -1,9 +1,9 @@
1
- import { inView } from 'ol/layer/Layer';
2
1
  import Control from 'ol/control/Control';
3
- import removeDuplicate from '../../common/utils/removeDuplicate';
2
+ import { inView } from 'ol/layer/Layer';
4
3
  import createDefaultCopyrightElement from '../../common/utils/createDefaultCopyrightElt';
4
+ import removeDuplicate from '../../common/utils/removeDuplicate';
5
5
  /**
6
- * Display layer's copyrights.
6
+ * Display layer's copyrights. Adding the possibility to format them as you wish.
7
7
  *
8
8
  * @example
9
9
  * import { Map } from 'ol';
@@ -17,11 +17,19 @@ import createDefaultCopyrightElement from '../../common/utils/createDefaultCopyr
17
17
  * map.addControl(control);
18
18
  *
19
19
  *
20
- * @see <a href="/example/ol-copyright">Openlayers copyright example</a>
20
+ * @see <a href="/example/ol-realtime>OpenLayers Realtime layer example</a>
21
+ *
22
+ * @extends {ol/control/Control~Control}
21
23
  *
22
- * @extends {ol/control/Control}
23
24
  */
24
25
  class CopyrightControl extends Control {
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @param {Object} options
30
+ * @param {Function} format Function used to format the list of copyrights available to a single string. By default join all the copyrights with a |.
31
+ * @public
32
+ */
25
33
  constructor(options = {}) {
26
34
  const element = createDefaultCopyrightElement();
27
35
  element.className = options.className || 'mbt-copyright';
@@ -15,11 +15,11 @@ import type { RoutingGraph, RoutingMot, RoutingParameters, RoutingViaPoint } fro
15
15
  export type RoutingControlOptions = {
16
16
  active?: boolean;
17
17
  apiKey?: string;
18
+ apiParams?: RoutingParameters;
18
19
  graphs?: RoutingGraph[];
19
20
  modify?: boolean;
20
21
  mot?: string;
21
22
  onRouteError?: () => void;
22
- routingApiParams?: RoutingParameters;
23
23
  routingLayer?: VectorLayer<VectorSource>;
24
24
  snapToClosestStation?: boolean;
25
25
  stopsApiKey?: string;
@@ -29,7 +29,8 @@ export type RoutingControlOptions = {
29
29
  } & Options;
30
30
  export type AbotControllersByGraph = Record<string, AbortController>;
31
31
  /**
32
- * This OpenLayers control allows the user to add and modifiy via points to a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
32
+ * This OpenLayers control allows the user to add and modifiy via points to
33
+ * a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
33
34
  *
34
35
  * @example
35
36
  * import { Map } from 'ol';
@@ -41,29 +42,23 @@ export type AbotControllersByGraph = Record<string, AbortController>;
41
42
  *
42
43
  * const control = new RoutingControl();
43
44
  *
44
- * control.attachToMap(map)
45
+ * map.addControl(control);
45
46
  *
46
- * @classproperty {string} apiKey - Key used for RoutingApi requests.
47
- * @classproperty {string} stopsApiKey - Key used for Stop lookup requests (defaults to apiKey).
48
- * @classproperty {string} stopsApiUrl - Url used for Stop lookup requests (defaults to https://api.geops.io/stops/v1/lookup/).
49
- * @classproperty {Array.<Array<graph="osm", minZoom=0, maxZoom=99>>} graphs - Array of routing graphs and min/max zoom levels. If you use the control in combination with the [geOps Maps API](https://developer.geops.io/apis/maps/), you may want to use the optimal level of generalizations: "[['gen4', 0, 8], ['gen3', 8, 9], ['gen2', 9, 11], ['gen1', 11, 13], ['osm', 13, 99]]"
50
47
  * @classproperty {string} mot - Mean of transport to be used for routing.
51
- * @classproperty {object} routingApiParams - object of additional parameters to pass to the routing api request.
52
- * @classproperty {object} snapToClosestStation - If true, the routing will snap the coordinate to the closest station. Default to false.
53
- * @classproperty {boolean} useRawViaPoints - Experimental property. Wen true, it allows the user to add via points using different kind of string. See "via" parameter defined by the [geOps Routing API](https://developer.geops.io/apis/routing/). Default to false, only array of coordinates and station's id are supported as via points.
54
48
  * @classproperty {VectorLayer} routingLayer - Layer for adding route features.
55
- * @classproperty {function} onRouteError - Callback on error.
56
49
  * @classproperty {boolean} loading - True if the control is requesting the backend.
50
+ *
57
51
  * @see <a href="/example/ol-routing">Openlayers routing example</a>
58
52
  *
59
- * @extends {Control}
60
- * @implements {RoutingInterface}
53
+ * @extends {ol/control/Control~Control}
54
+ *
61
55
  * @public
62
56
  */
63
57
  declare class RoutingControl extends Control {
64
58
  abortControllers: Record<string, AbortController>;
65
59
  api?: RoutingAPI;
66
60
  apiKey?: string;
61
+ apiParams?: RoutingParameters;
67
62
  cacheStationData: Record<string, Coordinate>;
68
63
  format: GeoJSON;
69
64
  graphs: RoutingGraph[];
@@ -77,7 +72,6 @@ declare class RoutingControl extends Control {
77
72
  modifyInteraction?: Modify;
78
73
  onMapClickKey?: EventsKey;
79
74
  onRouteError: (error?: Error, control?: RoutingControl) => void;
80
- routingApiParams?: RoutingParameters;
81
75
  routingLayer?: VectorLayer<VectorSource>;
82
76
  segments: Feature<LineString>[];
83
77
  snapToClosestStation: boolean;
@@ -85,6 +79,22 @@ declare class RoutingControl extends Control {
85
79
  stopsApiUrl?: string;
86
80
  useRawViaPoints: boolean;
87
81
  viaPoints: RoutingViaPoint[];
82
+ /**
83
+ * Constructor.
84
+ *
85
+ * @param {Object} options
86
+ * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
87
+ * @param {Object} options.apiParams Request parameters. See [geOps Routing API documentation](https://developer.geops.io/apis/routing/).
88
+ * @param {Array.<Array<graph="osm", minZoom=0, maxZoom=99>>} [options.graphs=[['osm', 0, 99]]] - Array of routing graphs and min/max zoom levels. If you use the control in combination with the [geOps Maps API](https://developer.geops.io/apis/maps/), you may want to use the optimal level of generalizations: "[['gen4', 0, 8], ['gen3', 8, 9], ['gen2', 9, 11], ['gen1', 11, 13], ['osm', 13, 99]]".
89
+ * @param {string} [options.mot="bus"] Mean of transport to be used for routing.
90
+ * @param {function} options.onRouteError Callback on request errors.
91
+ * @param {VectorLayer} [options.routingLayer=new VectorLayer()] Vector layer for adding route features.
92
+ * @param {boolean} [options.snapToClosestStation=false] If true, the routing will snap the coordinate to the closest station. Default to false.
93
+ * @param {StyleLike} options.style Style of the default vector layer.
94
+ * @param {boolean} [options.useRawViaPoints=fale] Experimental property. If true, it allows the user to add via points using different kind of string. See "via" parameter defined by the [geOps Routing API](https://developer.geops.io/apis/routing/). Default to false, only array of coordinates and station's id are supported as via points.
95
+ * @param {string} [options.url='https://api.geops.io/routing/v1/'] [geOps Realtime API](https://developer.geops.io/apis/realtime/) url.
96
+ * @public
97
+ */
88
98
  constructor(options?: RoutingControlOptions);
89
99
  /**
90
100
  * Calculate at which resolutions corresponds each generalizations.
@@ -109,7 +119,7 @@ declare class RoutingControl extends Control {
109
119
  * If an index is passed a viaPoint is added at the specified index.
110
120
  * If an index is passed and overwrite x is > 0, x viaPoints at the specified
111
121
  * index are replaced with a single new viaPoint.
112
- * @param {number[]|string} coordinates Array of coordinates
122
+ * @param {string | Coordinate} coordinatesOrString Array of coordinates or a string representing a station
113
123
  * @param {number} [index=-1] Integer representing the index of the added viaPoint. If not specified, the viaPoint is added at the end of the array.
114
124
  * @param {number} [overwrite=0] Marks the number of viaPoints that are removed at the specified index on add.
115
125
  * @public
@@ -33,7 +33,7 @@ const getFlatCoordinatesFromSegments = (segmentArray) => {
33
33
  const coords = [];
34
34
  segmentArray.forEach((seg) => {
35
35
  var _a;
36
- // @ts-expect-error
36
+ // @ts-expect-error missing type
37
37
  const coordArr = (_a = seg.getGeometry()) === null || _a === void 0 ? void 0 : _a.getCoordinates();
38
38
  if (coordArr === null || coordArr === void 0 ? void 0 : coordArr.length) {
39
39
  coords.push(...coordArr);
@@ -42,7 +42,8 @@ const getFlatCoordinatesFromSegments = (segmentArray) => {
42
42
  return coords;
43
43
  };
44
44
  /**
45
- * This OpenLayers control allows the user to add and modifiy via points to a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
45
+ * This OpenLayers control allows the user to add and modifiy via points to
46
+ * a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
46
47
  *
47
48
  * @example
48
49
  * import { Map } from 'ol';
@@ -54,26 +55,35 @@ const getFlatCoordinatesFromSegments = (segmentArray) => {
54
55
  *
55
56
  * const control = new RoutingControl();
56
57
  *
57
- * control.attachToMap(map)
58
+ * map.addControl(control);
58
59
  *
59
- * @classproperty {string} apiKey - Key used for RoutingApi requests.
60
- * @classproperty {string} stopsApiKey - Key used for Stop lookup requests (defaults to apiKey).
61
- * @classproperty {string} stopsApiUrl - Url used for Stop lookup requests (defaults to https://api.geops.io/stops/v1/lookup/).
62
- * @classproperty {Array.<Array<graph="osm", minZoom=0, maxZoom=99>>} graphs - Array of routing graphs and min/max zoom levels. If you use the control in combination with the [geOps Maps API](https://developer.geops.io/apis/maps/), you may want to use the optimal level of generalizations: "[['gen4', 0, 8], ['gen3', 8, 9], ['gen2', 9, 11], ['gen1', 11, 13], ['osm', 13, 99]]"
63
60
  * @classproperty {string} mot - Mean of transport to be used for routing.
64
- * @classproperty {object} routingApiParams - object of additional parameters to pass to the routing api request.
65
- * @classproperty {object} snapToClosestStation - If true, the routing will snap the coordinate to the closest station. Default to false.
66
- * @classproperty {boolean} useRawViaPoints - Experimental property. Wen true, it allows the user to add via points using different kind of string. See "via" parameter defined by the [geOps Routing API](https://developer.geops.io/apis/routing/). Default to false, only array of coordinates and station's id are supported as via points.
67
61
  * @classproperty {VectorLayer} routingLayer - Layer for adding route features.
68
- * @classproperty {function} onRouteError - Callback on error.
69
62
  * @classproperty {boolean} loading - True if the control is requesting the backend.
63
+ *
70
64
  * @see <a href="/example/ol-routing">Openlayers routing example</a>
71
65
  *
72
- * @extends {Control}
73
- * @implements {RoutingInterface}
66
+ * @extends {ol/control/Control~Control}
67
+ *
74
68
  * @public
75
69
  */
76
70
  class RoutingControl extends Control {
71
+ /**
72
+ * Constructor.
73
+ *
74
+ * @param {Object} options
75
+ * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
76
+ * @param {Object} options.apiParams Request parameters. See [geOps Routing API documentation](https://developer.geops.io/apis/routing/).
77
+ * @param {Array.<Array<graph="osm", minZoom=0, maxZoom=99>>} [options.graphs=[['osm', 0, 99]]] - Array of routing graphs and min/max zoom levels. If you use the control in combination with the [geOps Maps API](https://developer.geops.io/apis/maps/), you may want to use the optimal level of generalizations: "[['gen4', 0, 8], ['gen3', 8, 9], ['gen2', 9, 11], ['gen1', 11, 13], ['osm', 13, 99]]".
78
+ * @param {string} [options.mot="bus"] Mean of transport to be used for routing.
79
+ * @param {function} options.onRouteError Callback on request errors.
80
+ * @param {VectorLayer} [options.routingLayer=new VectorLayer()] Vector layer for adding route features.
81
+ * @param {boolean} [options.snapToClosestStation=false] If true, the routing will snap the coordinate to the closest station. Default to false.
82
+ * @param {StyleLike} options.style Style of the default vector layer.
83
+ * @param {boolean} [options.useRawViaPoints=fale] Experimental property. If true, it allows the user to add via points using different kind of string. See "via" parameter defined by the [geOps Routing API](https://developer.geops.io/apis/routing/). Default to false, only array of coordinates and station's id are supported as via points.
84
+ * @param {string} [options.url='https://api.geops.io/routing/v1/'] [geOps Realtime API](https://developer.geops.io/apis/realtime/) url.
85
+ * @public
86
+ */
77
87
  constructor(options = {}) {
78
88
  super(options);
79
89
  this.abortControllers = {};
@@ -94,7 +104,7 @@ class RoutingControl extends Control {
94
104
  this.graphs = options.graphs || [['osm', 0, 99]];
95
105
  this.mot = options.mot || 'bus';
96
106
  this.modify = options.modify !== false;
97
- this.routingApiParams = options.routingApiParams;
107
+ this.apiParams = options.apiParams;
98
108
  this.useRawViaPoints = options.useRawViaPoints || false;
99
109
  this.snapToClosestStation = options.snapToClosestStation || false;
100
110
  this.apiKey = options.apiKey;
@@ -201,7 +211,7 @@ class RoutingControl extends Control {
201
211
  * If an index is passed a viaPoint is added at the specified index.
202
212
  * If an index is passed and overwrite x is > 0, x viaPoints at the specified
203
213
  * index are replaced with a single new viaPoint.
204
- * @param {number[]|string} coordinates Array of coordinates
214
+ * @param {string | Coordinate} coordinatesOrString Array of coordinates or a string representing a station
205
215
  * @param {number} [index=-1] Integer representing the index of the added viaPoint. If not specified, the viaPoint is added at the end of the array.
206
216
  * @param {number} [overwrite=0] Marks the number of viaPoints that are removed at the specified index on add.
207
217
  * @public
@@ -306,7 +316,9 @@ class RoutingControl extends Control {
306
316
  });
307
317
  this.loading = true;
308
318
  // Create point features for the viaPoints
309
- this.viaPoints.forEach((viaPoint, idx) => this.drawViaPoint(viaPoint, idx, this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]));
319
+ this.viaPoints.forEach((viaPoint, idx) => {
320
+ this.drawViaPoint(viaPoint, idx, this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]);
321
+ });
310
322
  return Promise.all(this.graphs.map(([graph], index) => {
311
323
  const { signal } = this.abortControllers[graph];
312
324
  if (!this.api) {
@@ -315,7 +327,7 @@ class RoutingControl extends Control {
315
327
  return this.api
316
328
  .route(Object.assign({ 'coord-punish': 1000.0, 'coord-radius': 100.0,
317
329
  // @ts-expect-error missing property in swagger
318
- elevation: false, graph, mot: this.mot, 'resolve-hops': false, via: `${formattedViaPoints.join('|')}` }, (this.routingApiParams || {})), { signal })
330
+ elevation: false, graph, mot: this.mot, 'resolve-hops': false, via: `${formattedViaPoints.join('|')}` }, (this.apiParams || {})), { signal })
319
331
  .then((featureCollection) => {
320
332
  var _a, _b, _c;
321
333
  this.segments = this.format.readFeatures(featureCollection);
@@ -549,7 +561,7 @@ class RoutingControl extends Control {
549
561
  if ((route === null || route === void 0 ? void 0 : route.getGeometry()) && evt.mapBrowserEvent.coordinate) {
550
562
  // We use a buff extent to fix floating issues , see https://github.com/openlayers/openlayers/issues/7130#issuecomment-535856422
551
563
  const closestExtent = buffer(new Point(
552
- // @ts-expect-error
564
+ // @ts-expect-error bad def
553
565
  (_a = route.getGeometry()) === null || _a === void 0 ? void 0 : _a.getClosestPoint(evt.mapBrowserEvent.coordinate)).getExtent(), 0.001);
554
566
  segmentIndex = this.segments.findIndex((segment) => { var _a; return (_a = segment.getGeometry()) === null || _a === void 0 ? void 0 : _a.intersectsExtent(closestExtent); });
555
567
  }
@@ -560,7 +572,7 @@ class RoutingControl extends Control {
560
572
  [])[0];
561
573
  // Write object with modify info
562
574
  this.initialRouteDrag = {
563
- oldRoute: route && route.clone(),
575
+ oldRoute: route === null || route === void 0 ? void 0 : route.clone(),
564
576
  segmentIndex,
565
577
  viaPoint,
566
578
  };
@@ -23,12 +23,34 @@ export type StopFinderControlOptions = {
23
23
  *
24
24
  *
25
25
  * @see <a href="/example/ol-search">Openlayers search example</a>
26
+ *
27
+ * @extends {ol/control/Control~Control}
28
+ *
26
29
  * @public
27
30
  */
28
31
  declare class StopFinderControl extends Control {
29
32
  controller: StopFinderControlCommon;
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @param {Object} options
37
+ * @param {HTMLElement} options.element HTML element where to attach input and suggestions.
38
+ * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
39
+ * @param {StopsSearchParams} [options.apiParams={ limit: 20 }] Request parameters. See [geOps Stops API documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
40
+ * @param {string} [options.placeholder='Search for a stop...'] Input field placeholder.
41
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] [geOps Stops API](https://developer.geops.io/apis/stops/) url.
42
+ * @public
43
+ */
30
44
  constructor(options: StopFinderControlOptions);
31
45
  onSuggestionClick(suggestion: Feature): void;
46
+ /**
47
+ * Search for stations using a query.
48
+ *
49
+ * @param {string} q Query used to search stops.
50
+ * @param {AbortController} abortController Abort controller used to abort requests.
51
+ * @returns {Promise<Array<GeoJSONFeature>>}
52
+ * @public
53
+ */
32
54
  search(q: string, abortController: AbortController): Promise<void>;
33
55
  }
34
56
  export default StopFinderControl;
@@ -21,9 +21,23 @@ import createDefaultStopFinderElement from '../../common/utils/createDefaultStop
21
21
  *
22
22
  *
23
23
  * @see <a href="/example/ol-search">Openlayers search example</a>
24
+ *
25
+ * @extends {ol/control/Control~Control}
26
+ *
24
27
  * @public
25
28
  */
26
29
  class StopFinderControl extends Control {
30
+ /**
31
+ * Constructor.
32
+ *
33
+ * @param {Object} options
34
+ * @param {HTMLElement} options.element HTML element where to attach input and suggestions.
35
+ * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
36
+ * @param {StopsSearchParams} [options.apiParams={ limit: 20 }] Request parameters. See [geOps Stops API documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
37
+ * @param {string} [options.placeholder='Search for a stop...'] Input field placeholder.
38
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] [geOps Stops API](https://developer.geops.io/apis/stops/) url.
39
+ * @public
40
+ */
27
41
  constructor(options) {
28
42
  const element = createDefaultStopFinderElement();
29
43
  element.className = (options === null || options === void 0 ? void 0 : options.className) || 'mbt-stop-finder';
@@ -36,6 +50,14 @@ class StopFinderControl extends Control {
36
50
  const coord = fromLonLat(suggestion.geometry.coordinates);
37
51
  (_a = this.getMap()) === null || _a === void 0 ? void 0 : _a.getView().setCenter(coord);
38
52
  }
53
+ /**
54
+ * Search for stations using a query.
55
+ *
56
+ * @param {string} q Query used to search stops.
57
+ * @param {AbortController} abortController Abort controller used to abort requests.
58
+ * @returns {Promise<Array<GeoJSONFeature>>}
59
+ * @public
60
+ */
39
61
  search(q, abortController) {
40
62
  return this.controller.search(q, abortController);
41
63
  }
@@ -125,7 +125,12 @@ declare const MaplibreLayer_base: {
125
125
  *
126
126
  * @classproperty {maplibregl.Map} mapLibreMap - The Maplibre map object. Readonly.
127
127
  * @classproperty {string} style - The [geOps Maps API](https://developer.geops.io/apis/maps) style.
128
- * @extends {MapLibreLayer}
128
+ *
129
+ *
130
+ * @see <a href="/example/ol-maplibre-layer">OpenLayers Maplibre layer example</a>
131
+ *
132
+ * @extends {ol/layer/Layer~Layer}
133
+ * @extends {geoblocks/ol-maplibre-layer/MapLibreLayer}
129
134
  * @public
130
135
  */
131
136
  declare class MaplibreLayer extends MaplibreLayer_base {
@@ -38,7 +38,12 @@ if (typeof window !== 'undefined' &&
38
38
  *
39
39
  * @classproperty {maplibregl.Map} mapLibreMap - The Maplibre map object. Readonly.
40
40
  * @classproperty {string} style - The [geOps Maps API](https://developer.geops.io/apis/maps) style.
41
- * @extends {MapLibreLayer}
41
+ *
42
+ *
43
+ * @see <a href="/example/ol-maplibre-layer">OpenLayers Maplibre layer example</a>
44
+ *
45
+ * @extends {ol/layer/Layer~Layer}
46
+ * @extends {geoblocks/ol-maplibre-layer/MapLibreLayer}
42
47
  * @public
43
48
  */
44
49
  class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
@@ -36,12 +36,7 @@ declare const MaplibreStyleLayer_base: {
36
36
  olLayer: Layer;
37
37
  parent: Layer<Source, import("ol/renderer/Layer").default<any>>;
38
38
  visible: boolean;
39
- on: import("ol/layer/Layer").LayerOnSignature<import("ol/events" /**
40
- * Request feature information for a given coordinate.
41
- * @param {ol/coordinate~Coordinate} coordinate Coordinate to request the information at.
42
- * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
43
- * @deprecated Use getFeatureInfoAtCoordinate([layer], coordinate) from mobility-toolbox-ol package instead.
44
- */).EventsKey>;
39
+ on: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
45
40
  once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
46
41
  un: import("ol/layer/Layer").LayerOnSignature<void>;
47
42
  render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
@@ -128,6 +123,7 @@ declare const MaplibreStyleLayer_base: {
128
123
  * },
129
124
  * });
130
125
  *
126
+ * @see <a href="/example/ol-maplibre-style-layer">OpenLayers MaplibreStyle layer example</a>
131
127
  * @extends {ol/layer/Layer~Layer}
132
128
  * @public
133
129
  */
@@ -143,7 +139,7 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
143
139
  * @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
144
140
  * @param {MaplibreLayer} [options.maplibreLayer] The MaplibreLayer to use.
145
141
  * @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
146
- * @param {maplibregl.SourceSpecification[]} [options.sources] The sources to add to the style on load.
142
+ * @param {{[id: string]:maplibregl.SourceSpecification}} [options.sources] The sources to add to the style on load.
147
143
  * @public
148
144
  */
149
145
  constructor(options?: MaplibreStyleLayerOptions);
@@ -196,10 +192,10 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
196
192
  */
197
193
  select(features?: Feature[]): void;
198
194
  /**
199
- * Set the feature state of the features.
195
+ * Set the [feature state](https://maplibre.org/maplibre-style-spec/expressions/#feature-state) of the features.
200
196
  *
201
197
  * @param {ol/Feature~Feature[]} features
202
- * @param {maplibregl.FeatureState} state The feature state
198
+ * @param {{[key: string]: any}} state The feature state
203
199
  * @public
204
200
  */
205
201
  setFeatureState(features: Feature[], state: FeatureState): void;
@@ -30,6 +30,7 @@ if (typeof window !== 'undefined' &&
30
30
  * },
31
31
  * });
32
32
  *
33
+ * @see <a href="/example/ol-maplibre-style-layer">OpenLayers MaplibreStyle layer example</a>
33
34
  * @extends {ol/layer/Layer~Layer}
34
35
  * @public
35
36
  */
@@ -43,7 +44,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
43
44
  * @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
44
45
  * @param {MaplibreLayer} [options.maplibreLayer] The MaplibreLayer to use.
45
46
  * @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
46
- * @param {maplibregl.SourceSpecification[]} [options.sources] The sources to add to the style on load.
47
+ * @param {{[id: string]:maplibregl.SourceSpecification}} [options.sources] The sources to add to the style on load.
47
48
  * @public
48
49
  */
49
50
  constructor(options = {
@@ -245,6 +246,7 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
245
246
  let layers = this.layers || [];
246
247
  if (this.layersFilter) {
247
248
  layers = mapLibreMap.getStyle().layers.filter(this.layersFilter);
249
+ console.log(layers);
248
250
  }
249
251
  if (this.queryRenderedLayersFilter) {
250
252
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -353,10 +355,10 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
353
355
  this.setHoverState(this.selectedFeatures || [], true);
354
356
  }
355
357
  /**
356
- * Set the feature state of the features.
358
+ * Set the [feature state](https://maplibre.org/maplibre-style-spec/expressions/#feature-state) of the features.
357
359
  *
358
360
  * @param {ol/Feature~Feature[]} features
359
- * @param {maplibregl.FeatureState} state The feature state
361
+ * @param {{[key: string]: any}} state The feature state
360
362
  * @public
361
363
  */
362
364
  setFeatureState(features, state) {
@@ -121,9 +121,12 @@ declare const RealtimeLayer_base: {
121
121
  *
122
122
  *
123
123
  * @see <a href="/api/class/src/api/RealtimeAPI%20js~RealtimeAPI%20html">RealtimeAPI</a>
124
+ * @see <a href="/example/ol-realtime">OpenLayers Realtime layer example</a>
125
+ *
124
126
  *
125
127
  * @extends {ol/layer/Layer~Layer}
126
128
  *
129
+ *
127
130
  * @classproperty {boolean} allowRenderWhenAnimating - Allow rendering of the layer when the map is animating.
128
131
  * @public
129
132
  */
@@ -143,7 +146,7 @@ declare class RealtimeLayer extends RealtimeLayer_base {
143
146
  * @param {boolean} [options.allowRenderWhenAnimating=false] Allow rendering of the layer when the map is animating.
144
147
  * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
145
148
  * @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The [geOps Realtime API](https://developer.geops.io/apis/realtime/) url.
146
- *
149
+ * @public
147
150
  */
148
151
  constructor(options: RealtimeLayerOptions);
149
152
  attachToMap(map: Map): void;
@@ -23,9 +23,12 @@ const format = new GeoJSON();
23
23
  *
24
24
  *
25
25
  * @see <a href="/api/class/src/api/RealtimeAPI%20js~RealtimeAPI%20html">RealtimeAPI</a>
26
+ * @see <a href="/example/ol-realtime">OpenLayers Realtime layer example</a>
27
+ *
26
28
  *
27
29
  * @extends {ol/layer/Layer~Layer}
28
30
  *
31
+ *
29
32
  * @classproperty {boolean} allowRenderWhenAnimating - Allow rendering of the layer when the map is animating.
30
33
  * @public
31
34
  */
@@ -37,7 +40,7 @@ class RealtimeLayer extends MobilityLayerMixin(Layer) {
37
40
  * @param {boolean} [options.allowRenderWhenAnimating=false] Allow rendering of the layer when the map is animating.
38
41
  * @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/).
39
42
  * @param {string} [options.url="wss://api.geops.io/tracker-ws/v1/"] The [geOps Realtime API](https://developer.geops.io/apis/realtime/) url.
40
- *
43
+ * @public
41
44
  */
42
45
  constructor(options) {
43
46
  // We use a group to be able to add custom vector layer in extended class.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mobility-toolbox-js",
3
3
  "license": "MIT",
4
4
  "description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
5
- "version": "3.0.0-beta.33",
5
+ "version": "3.0.0-beta.34",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",
@@ -17,30 +17,30 @@
17
17
  "@turf/transform-rotate": "7.1.0",
18
18
  "lodash.debounce": "4.0.8",
19
19
  "lodash.throttle": "4.1.1",
20
- "uuid": "10.0.0"
20
+ "uuid": "11.0.3"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "maplibre-gl": ">=1",
24
24
  "ol": ">=7"
25
25
  },
26
26
  "devDependencies": {
27
- "@babel/preset-env": "^7.25.4",
28
- "@babel/preset-typescript": "^7.24.7",
27
+ "@babel/preset-env": "^7.26.0",
28
+ "@babel/preset-typescript": "^7.26.0",
29
29
  "@commitlint/cli": "19.5.0",
30
30
  "@commitlint/config-conventional": "19.5.0",
31
- "@geops/eslint-config-react": "^1.1.1",
31
+ "@geops/eslint-config-react": "^1.2.0",
32
32
  "@types/geojson": "7946.0.14",
33
- "@types/lodash": "^4.17.7",
33
+ "@types/lodash": "^4.17.13",
34
34
  "@types/lodash.debounce": "4.0.9",
35
35
  "@types/lodash.throttle": "4.1.9",
36
- "@types/mapbox-gl": "3.4.0",
36
+ "@types/mapbox-gl": "3.4.1",
37
37
  "@types/offscreencanvas": "2019.7.3",
38
38
  "@types/topojson": "3.2.6",
39
39
  "@types/uuid": "10.0.0",
40
- "@typescript-eslint/eslint-plugin": "8.5.0",
41
- "@typescript-eslint/parser": "8.5.0",
42
- "cypress": "13.14.2",
43
- "esbuild": "0.23.1",
40
+ "@typescript-eslint/eslint-plugin": "8.14.0",
41
+ "@typescript-eslint/parser": "8.14.0",
42
+ "cypress": "13.15.2",
43
+ "esbuild": "0.24.0",
44
44
  "esdoc": "1.1.0",
45
45
  "esdoc-ecmascript-proposal-plugin": "1.0.0",
46
46
  "esdoc-publish-html-plugin": "1.1.2",
@@ -51,10 +51,10 @@
51
51
  "eslint-config-airbnb-typescript": "18.0.0",
52
52
  "eslint-config-prettier": "9.1.0",
53
53
  "eslint-plugin-cypress": "3.5.0",
54
- "eslint-plugin-import": "2.30.0",
55
- "eslint-plugin-jsx-a11y": "6.10.0",
54
+ "eslint-plugin-import": "2.31.0",
55
+ "eslint-plugin-jsx-a11y": "6.10.2",
56
56
  "eslint-plugin-prettier": "5.2.1",
57
- "eslint-plugin-react": "7.36.1",
57
+ "eslint-plugin-react": "7.37.2",
58
58
  "fixpack": "4.0.0",
59
59
  "husky": "9.1.6",
60
60
  "is-ci": "3.0.1",
@@ -66,22 +66,23 @@
66
66
  "jest-transformer-svg": "2.0.2",
67
67
  "jest-websocket-mock": "2.5.0",
68
68
  "lint-staged": "15.2.10",
69
- "maplibre-gl": "4.7.0",
69
+ "maplibre-gl": "4.7.1",
70
70
  "mock-socket": "9.3.1",
71
- "next": "14.2.11",
71
+ "next": "15.0.3",
72
72
  "next-transpile-modules": "10.0.1",
73
- "ol": "10.1.0",
73
+ "ol": "10.2.1",
74
74
  "openapi-typescript": "6.7.5",
75
75
  "prettier": "3.3.3",
76
76
  "raw-loader": "4.0.2",
77
77
  "sort-json": "2.0.1",
78
78
  "standard-version": "9.5.0",
79
79
  "start-server-and-test": "2.0.8",
80
- "stylelint": "16.9.0",
80
+ "stylelint": "16.10.0",
81
81
  "stylelint-config-recommended-scss": "14.1.0",
82
82
  "stylelint-config-standard": "36.0.1",
83
- "stylelint-scss": "6.6.0",
84
- "typescript": "5.6.2"
83
+ "stylelint-scss": "6.9.0",
84
+ "ts-jest": "^29.2.5",
85
+ "typescript": "5.6.3"
85
86
  },
86
87
  "scripts": {
87
88
  "apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",