mobility-toolbox-js 3.0.1-beta.0 → 3.0.1-beta.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.
Files changed (78) hide show
  1. package/README.md +11 -3
  2. package/api/HttpAPI.js +1 -3
  3. package/api/RealtimeAPI.d.ts +47 -47
  4. package/api/RealtimeAPI.js +74 -74
  5. package/api/WebSocketAPI.js +0 -1
  6. package/common/controls/StopFinderControlCommon.d.ts +1 -1
  7. package/common/controls/StopFinderControlCommon.js +1 -1
  8. package/common/styles/realtimeDefaultStyle.js +0 -5
  9. package/common/styles/realtimeHeadingStyle.js +0 -5
  10. package/common/styles/realtimeSimpleStyle.d.ts +0 -1
  11. package/common/styles/realtimeSimpleStyle.js +0 -1
  12. package/common/typedefs.d.ts +0 -117
  13. package/common/typedefs.js +0 -31
  14. package/common/utils/RealtimeEngine.d.ts +214 -0
  15. package/common/utils/RealtimeEngine.js +554 -0
  16. package/common/utils/getLayersAsFlatArray.d.ts +0 -1
  17. package/common/utils/getLayersAsFlatArray.js +0 -1
  18. package/common/utils/getVehiclePosition.js +1 -4
  19. package/common/utils/realtimeConfig.d.ts +1 -1
  20. package/common/utils/realtimeConfig.js +0 -1
  21. package/common/utils/renderTrajectories.d.ts +1 -0
  22. package/common/utils/renderTrajectories.js +1 -0
  23. package/common/utils/sortAndFilterDepartures.d.ts +1 -0
  24. package/common/utils/sortAndFilterDepartures.js +1 -0
  25. package/maplibre/controls/CopyrightControl.d.ts +9 -6
  26. package/maplibre/controls/CopyrightControl.js +11 -8
  27. package/maplibre/layers/Layer.d.ts +7 -6
  28. package/maplibre/layers/Layer.js +1 -2
  29. package/maplibre/layers/RealtimeLayer.d.ts +54 -111
  30. package/maplibre/layers/RealtimeLayer.js +126 -114
  31. package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
  32. package/maplibre/utils/getSourceCoordinates.js +5 -4
  33. package/mbt.js +6961 -14605
  34. package/mbt.js.map +4 -4
  35. package/mbt.min.js +68 -71
  36. package/mbt.min.js.map +4 -4
  37. package/ol/controls/CopyrightControl.d.ts +13 -5
  38. package/ol/controls/CopyrightControl.js +13 -5
  39. package/ol/controls/RoutingControl.d.ts +29 -18
  40. package/ol/controls/RoutingControl.js +44 -56
  41. package/ol/controls/StopFinderControl.d.ts +21 -2
  42. package/ol/controls/StopFinderControl.js +22 -3
  43. package/ol/index.d.ts +0 -1
  44. package/ol/index.js +0 -1
  45. package/ol/layers/Layer.d.ts +17 -92
  46. package/ol/layers/Layer.js +17 -3
  47. package/ol/layers/MaplibreLayer.d.ts +47 -114
  48. package/ol/layers/MaplibreLayer.js +102 -46
  49. package/ol/layers/MaplibreStyleLayer.d.ts +67 -147
  50. package/ol/layers/MaplibreStyleLayer.js +170 -123
  51. package/ol/layers/RealtimeLayer.d.ts +85 -218
  52. package/ol/layers/RealtimeLayer.js +170 -181
  53. package/ol/layers/VectorLayer.d.ts +1 -2
  54. package/ol/layers/VectorLayer.js +7 -6
  55. package/ol/renderers/MaplibreLayerRenderer.d.ts +9 -0
  56. package/ol/renderers/MaplibreLayerRenderer.js +37 -137
  57. package/ol/renderers/MaplibreStyleLayerRenderer.js +2 -2
  58. package/ol/renderers/RealtimeLayerRenderer.d.ts +1 -1
  59. package/ol/renderers/RealtimeLayerRenderer.js +6 -31
  60. package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
  61. package/ol/styles/fullTrajectoryStyle.d.ts +1 -2
  62. package/ol/styles/fullTrajectoryStyle.js +5 -7
  63. package/ol/styles/routingStyle.d.ts +0 -1
  64. package/ol/styles/routingStyle.js +13 -10
  65. package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
  66. package/ol/utils/defineDeprecatedProperties.js +180 -0
  67. package/package.json +40 -39
  68. package/setupTests.js +14 -0
  69. package/types/common.d.ts +4 -27
  70. package/types/realtime.d.ts +7 -2
  71. package/common/mixins/RealtimeLayerMixin.d.ts +0 -267
  72. package/common/mixins/RealtimeLayerMixin.js +0 -751
  73. package/ol/mixins/MobilityLayerMixin.d.ts +0 -96
  74. package/ol/mixins/MobilityLayerMixin.js +0 -6
  75. package/ol/mixins/PropertiesLayerMixin.d.ts +0 -136
  76. package/ol/mixins/PropertiesLayerMixin.js +0 -178
  77. package/ol/mixins/index.d.ts +0 -1
  78. package/ol/mixins/index.js +0 -2
package/README.md CHANGED
@@ -10,7 +10,7 @@ The tools in this library have been inspired by many projects realized for publi
10
10
 
11
11
  ## Documentation and examples
12
12
 
13
- Visit https://mobility-toolbox-js.vercel.app/
13
+ Visit https://mobility-toolbox-js.geops.io/
14
14
 
15
15
  ## Demos
16
16
 
@@ -24,7 +24,7 @@ Visit https://mobility-toolbox-js.vercel.app/
24
24
  Install the library and the peer dependencies:
25
25
 
26
26
  ```bash
27
- yarn add mobility-toolbox-js ol maplibre-gl
27
+ yarn add ol maplibre-gl mobility-toolbox-js
28
28
  ```
29
29
 
30
30
  ## Development
@@ -34,9 +34,17 @@ yarn install
34
34
  yarn dev
35
35
  ```
36
36
 
37
+ `yarn dev` starts a vite server using the `index.html` file at the root of the project.
38
+ This html file loads the `dev.js` file. Use this file to develop the library.
39
+ Each time you modifiy the library code you have to run `yarn build:tsc` to see the changes.
40
+
41
+ ## Development documentation
42
+
43
+ The documentations website is located in the `doc/` folder.
44
+ It's a nextJS website that use the mobility-toolbox-js library built from the `build/` folder.
45
+
37
46
  ## Deploy
38
47
 
39
48
  This library website is deployed automatically using [Vercel](https://vercel.com/geops).
40
49
  For Vercel we have to add the nextjs and raw-loader modules in the dev dependencies of the main package.json.
41
50
  But those 2 librairies are not needed to build the library.
42
-
package/api/HttpAPI.js CHANGED
@@ -14,9 +14,7 @@ import getUrlWithParams from '../common/utils/getUrlWithParams';
14
14
  */
15
15
  class HttpAPI {
16
16
  constructor(options) {
17
- /** @private */
18
17
  this.url = options.url;
19
- /** @private */
20
18
  this.apiKey = options.apiKey;
21
19
  }
22
20
  /**
@@ -29,7 +27,7 @@ class HttpAPI {
29
27
  if (!this.url) {
30
28
  throw new Error(`No url defined for request to ${this.url}/${path}`);
31
29
  }
32
- if (!this.url && !this.apiKey && !/key=/.test(this.url)) {
30
+ if (!this.url && !this.apiKey && !this.url.includes('key=')) {
33
31
  // eslint-disable-next-line no-console
34
32
  throw new Error(`No apiKey defined for request to ${this.url}`);
35
33
  }
@@ -55,7 +55,7 @@ export declare const RealtimeModes: {
55
55
  * });
56
56
  *
57
57
  * // Close the websocket connection
58
- * // api.close();
58
+ * api.close();
59
59
  *
60
60
  * @public
61
61
  */
@@ -63,12 +63,55 @@ declare class RealtimeAPI {
63
63
  _bbox?: RealtimeBbox;
64
64
  _buffer?: number[];
65
65
  _url: string;
66
+ version: RealtimeVersion;
67
+ wsApi: WebSocketAPI;
68
+ /**
69
+ * This callback type is called `requestCallback` and is displayed as a global symbol.
70
+ *
71
+ * @callback onFullTrajectoryMessageCallback
72
+ * @param {number} responseCode
73
+ * @param {string} responseMessage
74
+ */
75
+ /**
76
+ * The bounding box to receive data from.\
77
+ * Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
78
+ *  \
79
+ * Where:
80
+ * - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
81
+ *  
82
+ * - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
83
+ *  
84
+ * - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
85
+ *  
86
+ * - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
87
+ *  
88
+ * - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
89
+ * &nbsp;
90
+ * - **mots**: A comma separated list of modes of transport. **Optional**.\
91
+ * Example: "mots=rail,subway".\
92
+ * &nbsp;
93
+ * - **gen_level**: An integer representing the generalization level. **Optional**.\
94
+ * Example: "gen_level=5"\
95
+ * &nbsp;
96
+ * - **tenant**: A string representing the tenant. **Optional**.\
97
+ * Example: "tenant=sbb"\
98
+ * &nbsp;
99
+ * - ...: Any other values added to the bbox will be send to the server
100
+ *
101
+ * @type {string[]}
102
+ *
103
+ * @public
104
+ */
105
+ get bbox(): RealtimeBbox | undefined;
106
+ set bbox(newBbox: RealtimeBbox | undefined);
107
+ get buffer(): number[] | undefined;
108
+ set buffer(newBuffer: number[] | undefined);
109
+ get url(): string;
110
+ set url(newUrl: string);
66
111
  private pingInterval;
67
112
  private pingIntervalMs;
68
113
  private reconnectTimeout?;
69
114
  private reconnectTimeoutMs?;
70
- version: RealtimeVersion;
71
- wsApi: WebSocketAPI;
72
115
  /**
73
116
  * Constructor
74
117
  *
@@ -350,55 +393,12 @@ declare class RealtimeAPI {
350
393
  * @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
351
394
  * @public
352
395
  */
353
- unsubscribeTimetabe(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
396
+ unsubscribeTimetable(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
354
397
  /**
355
398
  * Unsubscribe to trajectory channels.
356
399
  * @param {function(data: { content: RealtimeTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
357
400
  * @public
358
401
  */
359
402
  unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>): void;
360
- /**
361
- * This callback type is called `requestCallback` and is displayed as a global symbol.
362
- *
363
- * @callback onFullTrajectoryMessageCallback
364
- * @param {number} responseCode
365
- * @param {string} responseMessage
366
- */
367
- /**
368
- * The bounding box to receive data from.\
369
- * Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
370
- * &nbsp;\
371
- * Where:
372
- * - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
373
- * &nbsp;
374
- * - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
375
- * &nbsp;
376
- * - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
377
- * &nbsp;
378
- * - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
379
- * &nbsp;
380
- * - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
381
- * &nbsp;
382
- * - **mots**: A comma separated list of modes of transport. **Optional**.\
383
- * Example: "mots=rail,subway".\
384
- * &nbsp;
385
- * - **gen_level**: An integer representing the generalization level. **Optional**.\
386
- * Example: "gen_level=5"\
387
- * &nbsp;
388
- * - **tenant**: A string representing the tenant. **Optional**.\
389
- * Example: "tenant=sbb"\
390
- * &nbsp;
391
- * - ...: Any other values added to the bbox will be send to the server
392
- *
393
- * @type {string[]}
394
- *
395
- * @public
396
- */
397
- get bbox(): RealtimeBbox | undefined;
398
- set bbox(newBbox: RealtimeBbox | undefined);
399
- get buffer(): number[] | undefined;
400
- set buffer(newBuffer: number[] | undefined);
401
- get url(): string;
402
- set url(newUrl: string);
403
403
  }
404
404
  export default RealtimeAPI;
@@ -39,11 +39,82 @@ export const RealtimeModes = {
39
39
  * });
40
40
  *
41
41
  * // Close the websocket connection
42
- * // api.close();
42
+ * api.close();
43
43
  *
44
44
  * @public
45
45
  */
46
46
  class RealtimeAPI {
47
+ /**
48
+ * This callback type is called `requestCallback` and is displayed as a global symbol.
49
+ *
50
+ * @callback onFullTrajectoryMessageCallback
51
+ * @param {number} responseCode
52
+ * @param {string} responseMessage
53
+ */
54
+ /**
55
+ * The bounding box to receive data from.\
56
+ * Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
57
+ * &nbsp;\
58
+ * Where:
59
+ * - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
60
+ * &nbsp;
61
+ * - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
62
+ * &nbsp;
63
+ * - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
64
+ * &nbsp;
65
+ * - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
66
+ * &nbsp;
67
+ * - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
68
+ * &nbsp;
69
+ * - **mots**: A comma separated list of modes of transport. **Optional**.\
70
+ * Example: "mots=rail,subway".\
71
+ * &nbsp;
72
+ * - **gen_level**: An integer representing the generalization level. **Optional**.\
73
+ * Example: "gen_level=5"\
74
+ * &nbsp;
75
+ * - **tenant**: A string representing the tenant. **Optional**.\
76
+ * Example: "tenant=sbb"\
77
+ * &nbsp;
78
+ * - ...: Any other values added to the bbox will be send to the server
79
+ *
80
+ * @type {string[]}
81
+ *
82
+ * @public
83
+ */
84
+ get bbox() {
85
+ return this._bbox;
86
+ }
87
+ set bbox(newBbox) {
88
+ if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
89
+ this._bbox = newBbox;
90
+ if (this.wsApi && this._bbox) {
91
+ this.wsApi.send(`BBOX ${this._bbox.join(' ')}`);
92
+ }
93
+ }
94
+ }
95
+ get buffer() {
96
+ return this._buffer;
97
+ }
98
+ set buffer(newBuffer) {
99
+ if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
100
+ this._buffer = newBuffer;
101
+ if (this.wsApi && this._buffer) {
102
+ this.wsApi.send(`BUFFER ${this._buffer.join(' ')}`);
103
+ }
104
+ }
105
+ }
106
+ get url() {
107
+ return this._url;
108
+ }
109
+ set url(newUrl) {
110
+ if (this._url !== newUrl) {
111
+ this._url = newUrl;
112
+ // Update the websocket only if the url has changed and the websocket is already open or is opening.
113
+ if (this.wsApi.open || this.wsApi.connecting) {
114
+ this.open();
115
+ }
116
+ }
117
+ }
47
118
  /**
48
119
  * Constructor
49
120
  *
@@ -422,7 +493,7 @@ class RealtimeAPI {
422
493
  * @deprecated Use RealtimeAPI.unsubscribeTimetabe instead.
423
494
  */
424
495
  unsubscribeDepartures(stationId, onMessage) {
425
- this.unsubscribeTimetabe(stationId, onMessage);
496
+ this.unsubscribeTimetable(stationId, onMessage);
426
497
  }
427
498
  /**
428
499
  * Unsubscribe disruptions.
@@ -490,7 +561,7 @@ class RealtimeAPI {
490
561
  * @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
491
562
  * @public
492
563
  */
493
- unsubscribeTimetabe(stationId, onMessage) {
564
+ unsubscribeTimetable(stationId, onMessage) {
494
565
  this.unsubscribe(`timetable_${stationId}`, '', onMessage);
495
566
  }
496
567
  /**
@@ -501,76 +572,5 @@ class RealtimeAPI {
501
572
  unsubscribeTrajectory(onMessage) {
502
573
  this.unsubscribe(`trajectory`, '', onMessage);
503
574
  }
504
- /**
505
- * This callback type is called `requestCallback` and is displayed as a global symbol.
506
- *
507
- * @callback onFullTrajectoryMessageCallback
508
- * @param {number} responseCode
509
- * @param {string} responseMessage
510
- */
511
- /**
512
- * The bounding box to receive data from.\
513
- * Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
514
- * &nbsp;\
515
- * Where:
516
- * - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
517
- * &nbsp;
518
- * - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
519
- * &nbsp;
520
- * - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
521
- * &nbsp;
522
- * - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
523
- * &nbsp;
524
- * - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
525
- * &nbsp;
526
- * - **mots**: A comma separated list of modes of transport. **Optional**.\
527
- * Example: "mots=rail,subway".\
528
- * &nbsp;
529
- * - **gen_level**: An integer representing the generalization level. **Optional**.\
530
- * Example: "gen_level=5"\
531
- * &nbsp;
532
- * - **tenant**: A string representing the tenant. **Optional**.\
533
- * Example: "tenant=sbb"\
534
- * &nbsp;
535
- * - ...: Any other values added to the bbox will be send to the server
536
- *
537
- * @type {string[]}
538
- *
539
- * @public
540
- */
541
- get bbox() {
542
- return this._bbox;
543
- }
544
- set bbox(newBbox) {
545
- if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
546
- this._bbox = newBbox;
547
- if (this.wsApi && this._bbox) {
548
- this.wsApi.send(`BBOX ${this._bbox.join(' ')}`);
549
- }
550
- }
551
- }
552
- get buffer() {
553
- return this._buffer;
554
- }
555
- set buffer(newBuffer) {
556
- if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
557
- this._buffer = newBuffer;
558
- if (this.wsApi && this._buffer) {
559
- this.wsApi.send(`BUFFER ${this._buffer.join(' ')}`);
560
- }
561
- }
562
- }
563
- get url() {
564
- return this._url;
565
- }
566
- set url(newUrl) {
567
- if (this._url !== newUrl) {
568
- this._url = newUrl;
569
- // Update the websocket only if the url has changed and the websocket is already open or is opening.
570
- if (this.wsApi.open || this.wsApi.connecting) {
571
- this.open();
572
- }
573
- }
574
- }
575
575
  }
576
576
  export default RealtimeAPI;
@@ -71,7 +71,6 @@ class WebSocketAPI {
71
71
  this.websocket.close();
72
72
  }
73
73
  }
74
- /** @private */
75
74
  this.websocket = new WebSocket(url);
76
75
  if (!this.open) {
77
76
  this.websocket.addEventListener('open', () => {
@@ -30,7 +30,7 @@ declare class StopFinderControlCommon {
30
30
  * @param {Object} options Options
31
31
  * @param {HTMLElement} options.element HTML element where to attach input and suggestions.
32
32
  * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/). See StopsAPI.
33
- * @param {string} [options.url='https://api.geops.io/tracker/v1'] Stops service url. See StopsAPI.
33
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] Stops service url. See StopsAPI.
34
34
  * @param {string} [options.placeholder='Search for a stop...'] Input field placeholder.
35
35
  * @param {StopsSearchParams} [options.apiParams={ limit: 20 }] Request parameters. See [Stops service documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
36
36
  */
@@ -13,7 +13,7 @@ class StopFinderControlCommon {
13
13
  * @param {Object} options Options
14
14
  * @param {HTMLElement} options.element HTML element where to attach input and suggestions.
15
15
  * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/). See StopsAPI.
16
- * @param {string} [options.url='https://api.geops.io/tracker/v1'] Stops service url. See StopsAPI.
16
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] Stops service url. See StopsAPI.
17
17
  * @param {string} [options.placeholder='Search for a stop...'] Input field placeholder.
18
18
  * @param {StopsSearchParams} [options.apiParams={ limit: 20 }] Request parameters. See [Stops service documentation](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
19
19
  */
@@ -1,5 +1,4 @@
1
1
  import createCanvas from '../utils/createCanvas';
2
- /** @private */
3
2
  const cacheDelayBg = {};
4
3
  /**
5
4
  * Draw circle delay background
@@ -25,7 +24,6 @@ export const getDelayBgCanvas = (origin, radius, color) => {
25
24
  }
26
25
  return cacheDelayBg[key];
27
26
  };
28
- /** @private */
29
27
  const cacheDelayText = {};
30
28
  /**
31
29
  * Draw delay text
@@ -55,7 +53,6 @@ export const getDelayTextCanvas = (text, fontSize, font, delayColor, delayOutlin
55
53
  }
56
54
  return cacheDelayText[key];
57
55
  };
58
- /** @private */
59
56
  const cacheCircle = {};
60
57
  /**
61
58
  * Draw colored circle with black border
@@ -90,7 +87,6 @@ export const getCircleCanvas = (origin, radius, color, hasStroke, hasDash, pixel
90
87
  }
91
88
  return cacheCircle[key];
92
89
  };
93
- /** @private */
94
90
  const cacheText = {};
95
91
  /**
96
92
  * Draw text in the circle
@@ -129,7 +125,6 @@ export const getTextCanvas = (text, origin, textSize, fillColor, strokeColor, ha
129
125
  }
130
126
  return cacheText[key];
131
127
  };
132
- /** @private */
133
128
  const cache = {};
134
129
  /**
135
130
  * A tracker style that take in account the delay.
@@ -1,16 +1,13 @@
1
1
  import createCanvas from '../utils/createCanvas';
2
2
  import { getBgColor } from '../utils/realtimeConfig';
3
3
  import realtimeDefaultStyle from './realtimeDefaultStyle';
4
- /** @private */
5
4
  const rotateCanvas = (canvas, rotation) => {
6
5
  const ctx = canvas.getContext('2d');
7
6
  ctx === null || ctx === void 0 ? void 0 : ctx.translate(canvas.width / 2, canvas.height / 2);
8
7
  ctx === null || ctx === void 0 ? void 0 : ctx.rotate(rotation);
9
8
  ctx === null || ctx === void 0 ? void 0 : ctx.translate(-canvas.width / 2, -canvas.height / 2);
10
9
  };
11
- /** @private */
12
10
  const arrowCache = {};
13
- /** @private */
14
11
  const getArrowCanvas = (fillColor) => {
15
12
  const key = `${fillColor}`;
16
13
  if (!arrowCache[key]) {
@@ -35,9 +32,7 @@ const getArrowCanvas = (fillColor) => {
35
32
  }
36
33
  return arrowCache[key];
37
34
  };
38
- /** @private */
39
35
  const bufferArrowCache = {};
40
- /** @private */
41
36
  const getBufferArrowCanvas = (canvas, fillColor, rotation) => {
42
37
  const margin = 20;
43
38
  const bufferKey = `${fillColor},${canvas.width},${canvas.height},${rotation}`;
@@ -1,4 +1,3 @@
1
1
  import type { RealtimeStyleFunction } from '../../types';
2
- /** @private */
3
2
  declare const realtimeSimpleStyle: RealtimeStyleFunction;
4
3
  export default realtimeSimpleStyle;
@@ -4,7 +4,6 @@ import createCanvas from '../utils/createCanvas';
4
4
  * Display blue point for each train.
5
5
  */
6
6
  let canvas;
7
- /** @private */
8
7
  const realtimeSimpleStyle = () => {
9
8
  if (!canvas) {
10
9
  canvas = createCanvas(15, 15);
@@ -50,88 +50,6 @@ export type FeatureInfo = {
50
50
  */
51
51
  coordinate: number[2];
52
52
  };
53
- export type MaplibreLayerOptions = {
54
- /**
55
- * Access key for [geOps apis](https://developer.geops.io/).
56
- */
57
- apiKey: string;
58
- /**
59
- * geOps Maps api key name.
60
- */
61
- apiKeyName: string;
62
- /**
63
- * Maplibre map options.
64
- */
65
- mapLibreOptions: maplibregl.MapOptions;
66
- /**
67
- * geOps Maps api style.
68
- */
69
- style: string;
70
- /**
71
- * geOps Maps api url.
72
- */
73
- url: string;
74
- };
75
- export type ControlCommonOptions = {
76
- /**
77
- * Whether the control is active or not.
78
- */
79
- active?: boolean | undefined;
80
- /**
81
- * The HTML element used to render the control.
82
- */
83
- element: HTMLElement;
84
- /**
85
- * The HTML element where to render the element property. Default is the map's element.
86
- */
87
- target: HTMLElement;
88
- /**
89
- * Render function called whenever the control needs to be rerendered.
90
- */
91
- render: Function;
92
- };
93
- export type LayerCommonOptions = {
94
- /**
95
- * Identifier of the layer. Must be unique.
96
- */
97
- key: string;
98
- /**
99
- * Name of the layer.
100
- */
101
- name: string;
102
- /**
103
- * Group of the layer.
104
- */
105
- group: string;
106
- /**
107
- * List of copyrights.
108
- */
109
- copyrights: string[];
110
- /**
111
- * List of children layers.
112
- */
113
- children: Layer[];
114
- /**
115
- * Define if the layer is currently display on the map.
116
- */
117
- visible: boolean;
118
- /**
119
- * Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
120
- */
121
- disabled: boolean;
122
- /**
123
- * Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
124
- */
125
- hittolerance: number;
126
- /**
127
- * - Custom properties.
128
- */
129
- properties: Object;
130
- /**
131
- * - The map used to display the layer.
132
- */
133
- map: AnyMap;
134
- };
135
53
  export type VehiclePosition = {
136
54
  /**
137
55
  * Coordinate of the vehicle position in Mercator .
@@ -142,10 +60,6 @@ export type VehiclePosition = {
142
60
  */
143
61
  rotation: number;
144
62
  };
145
- /**
146
- * /Map~Map|maplibregl.Map} AnyMap
147
- */
148
- type dummy = ol;
149
63
  /**
150
64
  * @typedef {function} FilterFunction
151
65
  * @param {Vehicle} vehicle Vehicle to filter.
@@ -180,37 +94,6 @@ type dummy = ol;
180
94
  * @property {Feature[]} features An array of features.
181
95
  * @property {number[2]} coordinate The coordinate where to find the featue.
182
96
  */
183
- /**
184
- * @typedef {ol/Map~Map|maplibregl.Map} AnyMap
185
- */
186
- /**
187
- * @typedef {Object} MaplibreLayerOptions
188
- * @property {string} apiKey Access key for [geOps apis](https://developer.geops.io/).
189
- * @property {string} apiKeyName geOps Maps api key name.
190
- * @property {maplibregl.MapOptions} options.mapLibreOptions Maplibre map options.
191
- * @property {string} style geOps Maps api style.
192
- * @property {string} url geOps Maps api url.
193
- */
194
- /**
195
- * @typedef {Object} ControlCommonOptions
196
- * @property {boolean} [active = true] Whether the control is active or not.
197
- * @property {HTMLElement} element The HTML element used to render the control.
198
- * @property {HTMLElement} target The HTML element where to render the element property. Default is the map's element.
199
- * @property {function} render Render function called whenever the control needs to be rerendered.
200
- */
201
- /**
202
- * @typedef {Object} LayerCommonOptions
203
- * @property {string!} key Identifier of the layer. Must be unique.
204
- * @property {string!} name Name of the layer.
205
- * @property {string!} group Group of the layer.
206
- * @property {string[]!} copyrights List of copyrights.
207
- * @property {Layer[]!} children List of children layers.
208
- * @property {boolean!} visible Define if the layer is currently display on the map.
209
- * @property {boolean!} disabled Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
210
- * @property {number!} hittolerance Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
211
- * @property {Object!} properties - Custom properties.
212
- * @property {AnyMap!} map - The map used to display the layer.
213
- */
214
97
  /**
215
98
  * @typedef {Object} VehiclePosition
216
99
  * @property {number[2]} coord Coordinate of the vehicle position in Mercator .
@@ -32,37 +32,6 @@
32
32
  * @property {Feature[]} features An array of features.
33
33
  * @property {number[2]} coordinate The coordinate where to find the featue.
34
34
  */
35
- /**
36
- * @typedef {ol/Map~Map|maplibregl.Map} AnyMap
37
- */
38
- /**
39
- * @typedef {Object} MaplibreLayerOptions
40
- * @property {string} apiKey Access key for [geOps apis](https://developer.geops.io/).
41
- * @property {string} apiKeyName geOps Maps api key name.
42
- * @property {maplibregl.MapOptions} options.mapLibreOptions Maplibre map options.
43
- * @property {string} style geOps Maps api style.
44
- * @property {string} url geOps Maps api url.
45
- */
46
- /**
47
- * @typedef {Object} ControlCommonOptions
48
- * @property {boolean} [active = true] Whether the control is active or not.
49
- * @property {HTMLElement} element The HTML element used to render the control.
50
- * @property {HTMLElement} target The HTML element where to render the element property. Default is the map's element.
51
- * @property {function} render Render function called whenever the control needs to be rerendered.
52
- */
53
- /**
54
- * @typedef {Object} LayerCommonOptions
55
- * @property {string!} key Identifier of the layer. Must be unique.
56
- * @property {string!} name Name of the layer.
57
- * @property {string!} group Group of the layer.
58
- * @property {string[]!} copyrights List of copyrights.
59
- * @property {Layer[]!} children List of children layers.
60
- * @property {boolean!} visible Define if the layer is currently display on the map.
61
- * @property {boolean!} disabled Define if the layer is currently display on the map but can't be seen (extent, zoom ,data restrictions).
62
- * @property {number!} hittolerance Hit-detection tolerance in css pixels. Pixels inside the radius around the given position will be checked for features.
63
- * @property {Object!} properties - Custom properties.
64
- * @property {AnyMap!} map - The map used to display the layer.
65
- */
66
35
  /**
67
36
  * @typedef {Object} VehiclePosition
68
37
  * @property {number[2]} coord Coordinate of the vehicle position in Mercator .