mobility-toolbox-js 3.0.0-beta.8 → 3.0.0

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 (130) hide show
  1. package/README.md +11 -3
  2. package/api/HttpAPI.d.ts +20 -0
  3. package/api/HttpAPI.js +1 -14
  4. package/api/RealtimeAPI.d.ts +404 -0
  5. package/api/RealtimeAPI.js +265 -206
  6. package/api/RoutingAPI.d.ts +47 -0
  7. package/api/RoutingAPI.js +17 -7
  8. package/api/StopsAPI.d.ts +44 -0
  9. package/api/StopsAPI.js +17 -11
  10. package/api/WebSocketAPI.d.ts +147 -0
  11. package/api/WebSocketAPI.js +164 -165
  12. package/api/index.d.ts +3 -0
  13. package/api/index.js +1 -1
  14. package/api/typedefs.d.ts +76 -0
  15. package/api/typedefs.js +27 -42
  16. package/common/controls/StopFinderControlCommon.d.ts +53 -0
  17. package/common/controls/StopFinderControlCommon.js +32 -32
  18. package/common/index.d.ts +2 -0
  19. package/common/index.js +1 -1
  20. package/common/styles/index.d.ts +4 -0
  21. package/common/styles/realtimeDefaultStyle.d.ts +36 -0
  22. package/common/styles/realtimeDefaultStyle.js +6 -11
  23. package/common/styles/realtimeDelayStyle.d.ts +12 -0
  24. package/common/styles/realtimeHeadingStyle.d.ts +12 -0
  25. package/common/styles/realtimeHeadingStyle.js +5 -10
  26. package/common/styles/realtimeSimpleStyle.d.ts +3 -0
  27. package/common/styles/realtimeSimpleStyle.js +0 -1
  28. package/common/typedefs.d.ts +102 -0
  29. package/common/typedefs.js +6 -31
  30. package/common/utils/RealtimeEngine.d.ts +214 -0
  31. package/common/utils/RealtimeEngine.js +554 -0
  32. package/common/utils/compareDepartures.d.ts +10 -0
  33. package/common/utils/compareDepartures.js +2 -2
  34. package/common/utils/constants.d.ts +5 -0
  35. package/common/utils/createCanvas.d.ts +10 -0
  36. package/common/utils/createDefaultCopyrightElt.d.ts +5 -0
  37. package/common/utils/createDefaultStopFinderElt.d.ts +5 -0
  38. package/common/utils/createRealtimeFilters.d.ts +12 -0
  39. package/common/utils/debounceDeparturesMessages.d.ts +12 -0
  40. package/common/utils/debounceWebsocketMessages.d.ts +11 -0
  41. package/common/utils/getLayersAsFlatArray.d.ts +2 -0
  42. package/common/utils/getLayersAsFlatArray.js +0 -1
  43. package/common/utils/getMapGlCopyrights.d.ts +17 -0
  44. package/common/utils/getMapGlCopyrights.js +3 -3
  45. package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
  46. package/common/utils/getRealtimeModeSuffix.js +1 -0
  47. package/common/utils/getUrlWithParams.d.ts +8 -0
  48. package/common/utils/getVehiclePosition.d.ts +17 -0
  49. package/common/utils/getVehiclePosition.js +6 -3
  50. package/common/utils/index.d.ts +16 -0
  51. package/common/utils/realtimeConfig.d.ts +64 -0
  52. package/common/utils/realtimeConfig.js +0 -1
  53. package/common/utils/removeDuplicate.d.ts +9 -0
  54. package/common/utils/renderTrajectories.d.ts +17 -0
  55. package/common/utils/renderTrajectories.js +7 -6
  56. package/common/utils/sortAndFilterDepartures.d.ts +16 -0
  57. package/common/utils/sortAndFilterDepartures.js +2 -1
  58. package/common/utils/sortByDelay.d.ts +3 -0
  59. package/common/utils/sortByDelay.js +5 -1
  60. package/common/utils/timeUtils.d.ts +23 -0
  61. package/common/utils/toMercatorExtent.d.ts +5 -0
  62. package/iife.d.ts +2 -0
  63. package/index.d.ts +9 -0
  64. package/maplibre/controls/CopyrightControl.d.ts +38 -0
  65. package/maplibre/controls/CopyrightControl.js +11 -8
  66. package/maplibre/controls/index.d.ts +1 -0
  67. package/maplibre/index.d.ts +5 -0
  68. package/maplibre/layers/Layer.d.ts +29 -0
  69. package/maplibre/layers/Layer.js +2 -3
  70. package/maplibre/layers/RealtimeLayer.d.ts +124 -0
  71. package/maplibre/layers/RealtimeLayer.js +154 -118
  72. package/maplibre/layers/index.d.ts +2 -0
  73. package/maplibre/utils/getMercatorResolution.d.ts +7 -0
  74. package/maplibre/utils/getSourceCoordinates.d.ts +8 -0
  75. package/maplibre/utils/getSourceCoordinates.js +6 -5
  76. package/maplibre/utils/index.d.ts +2 -0
  77. package/mbt.js +14585 -14557
  78. package/mbt.js.map +4 -4
  79. package/mbt.min.js +75 -75
  80. package/mbt.min.js.map +4 -4
  81. package/ol/controls/CopyrightControl.d.ts +39 -0
  82. package/ol/controls/CopyrightControl.js +13 -5
  83. package/ol/controls/RoutingControl.d.ts +213 -0
  84. package/ol/controls/RoutingControl.js +250 -264
  85. package/ol/controls/StopFinderControl.d.ts +56 -0
  86. package/ol/controls/StopFinderControl.js +24 -5
  87. package/ol/controls/index.d.ts +3 -0
  88. package/ol/index.d.ts +6 -0
  89. package/ol/layers/Layer.d.ts +26 -0
  90. package/ol/layers/Layer.js +39 -0
  91. package/ol/layers/MaplibreLayer.d.ts +91 -0
  92. package/ol/layers/MaplibreLayer.js +154 -31
  93. package/ol/layers/MaplibreStyleLayer.d.ts +157 -0
  94. package/ol/layers/MaplibreStyleLayer.js +281 -210
  95. package/ol/layers/RealtimeLayer.d.ts +150 -0
  96. package/ol/layers/RealtimeLayer.js +210 -206
  97. package/ol/layers/VectorLayer.d.ts +17 -0
  98. package/ol/layers/VectorLayer.js +33 -0
  99. package/ol/layers/index.d.ts +5 -0
  100. package/ol/layers/index.js +3 -0
  101. package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -0
  102. package/ol/renderers/MaplibreLayerRenderer.js +142 -114
  103. package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +20 -0
  104. package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
  105. package/ol/renderers/RealtimeLayerRenderer.d.ts +22 -0
  106. package/ol/renderers/RealtimeLayerRenderer.js +50 -70
  107. package/ol/styles/fullTrajectoryDelayStyle.d.ts +6 -0
  108. package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
  109. package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
  110. package/ol/styles/fullTrajectoryStyle.js +5 -7
  111. package/ol/styles/index.d.ts +3 -0
  112. package/ol/styles/routingStyle.d.ts +3 -0
  113. package/ol/styles/routingStyle.js +13 -10
  114. package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
  115. package/ol/utils/defineDeprecatedProperties.js +180 -0
  116. package/ol/utils/getFeatureInfoAtCoordinate.d.ts +8 -0
  117. package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
  118. package/ol/utils/index.d.ts +1 -0
  119. package/package.json +44 -44
  120. package/setupTests.d.ts +1 -0
  121. package/setupTests.js +17 -4
  122. package/types/common.d.ts +53 -69
  123. package/types/index.d.ts +1 -1
  124. package/types/realtime.d.ts +98 -95
  125. package/types/routing.d.ts +60 -60
  126. package/types/stops.d.ts +62 -62
  127. package/common/mixins/RealtimeLayerMixin.js +0 -743
  128. package/ol/layers/MapGlLayer.js +0 -142
  129. package/ol/mixins/MobilityLayerMixin.js +0 -9
  130. package/ol/mixins/PropertiesLayerMixin.js +0 -142
@@ -9,6 +9,58 @@ export interface Paths {
9
9
  get: {
10
10
  parameters: {
11
11
  query: {
12
+ /**
13
+ * Whether to use beelines (line strings with 2 points) between
14
+ * mutually unreachable hops as a fallback for "Route not found"
15
+ * errors. "true", "on", "yes", "y", "1" will enable the
16
+ * fallback. Default: enabled
17
+ */
18
+ 'beeline-fallback'?: string;
19
+ /**
20
+ * Distance punishment factor for edge snapping of coordinates (see
21
+ * "Note on coordinates" at the top). Large: prefer close edge. Small:
22
+ * prefer short total route. Negative value: like worst edge
23
+ * category. Default: -1.0
24
+ */
25
+ 'coord-punish'?: number;
26
+ /**
27
+ * Search radius for candidate edges during snapping of coordinates
28
+ * (see "Note on coordinates" at the top) Default: -1.0
29
+ */
30
+ 'coord-radius'?: number;
31
+ /** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
32
+ graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
33
+ /**
34
+ * Whether to include intermediate hops (stations/stops) found on the
35
+ * route to the response. "true", "on", "yes", "y", "1" will enable
36
+ * intermediate hops. Default: disabled
37
+ */
38
+ hops?: string;
39
+ /** A line name that should be preferred */
40
+ line?: string;
41
+ /** Name of origin of the preferred line */
42
+ 'line-from'?: string;
43
+ /** Name of destination of the preferred line */
44
+ 'line-to'?: string;
45
+ /**
46
+ * Maximum allowed ratio of hops to skip if not found. Only non-start
47
+ * and non-end hops are counted in ratio numerator and denominator.
48
+ */
49
+ 'max-skip-hop-ratio'?: number;
50
+ /** Mode of transport */
51
+ mot:
52
+ | 'bus'
53
+ | 'car'
54
+ | 'coach'
55
+ | 'ferry'
56
+ | 'foot'
57
+ | 'funicular'
58
+ | 'gondola'
59
+ | 'rail'
60
+ | 'subway'
61
+ | 'tram';
62
+ /** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
63
+ simplify?: number;
12
64
  /**
13
65
  * A pipe separated list of hops. A hop describes a station with either
14
66
  * - a name or abbreviation
@@ -52,58 +104,6 @@ export interface Paths {
52
104
  * - `freiburg|basel%20sbb|bern` - from Freiburg (Breisgau) Hbf via Basel SBB to Bern
53
105
  */
54
106
  via: string;
55
- /** Mode of transport */
56
- mot:
57
- | 'rail'
58
- | 'bus'
59
- | 'coach'
60
- | 'foot'
61
- | 'tram'
62
- | 'subway'
63
- | 'gondola'
64
- | 'funicular'
65
- | 'ferry'
66
- | 'car';
67
- /** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
68
- graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
69
- /** A line name that should be preferred */
70
- line?: string;
71
- /** Name of origin of the preferred line */
72
- 'line-from'?: string;
73
- /** Name of destination of the preferred line */
74
- 'line-to'?: string;
75
- /** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
76
- simplify?: number;
77
- /**
78
- * Maximum allowed ratio of hops to skip if not found. Only non-start
79
- * and non-end hops are counted in ratio numerator and denominator.
80
- */
81
- 'max-skip-hop-ratio'?: number;
82
- /**
83
- * Whether to include intermediate hops (stations/stops) found on the
84
- * route to the response. "true", "on", "yes", "y", "1" will enable
85
- * intermediate hops. Default: disabled
86
- */
87
- hops?: string;
88
- /**
89
- * Whether to use beelines (line strings with 2 points) between
90
- * mutually unreachable hops as a fallback for "Route not found"
91
- * errors. "true", "on", "yes", "y", "1" will enable the
92
- * fallback. Default: enabled
93
- */
94
- 'beeline-fallback'?: string;
95
- /**
96
- * Search radius for candidate edges during snapping of coordinates
97
- * (see "Note on coordinates" at the top) Default: -1.0
98
- */
99
- 'coord-radius'?: number;
100
- /**
101
- * Distance punishment factor for edge snapping of coordinates (see
102
- * "Note on coordinates" at the top). Large: prefer close edge. Small:
103
- * prefer short total route. Negative value: like worst edge
104
- * category. Default: -1.0
105
- */
106
- 'coord-punish'?: number;
107
107
  /**
108
108
  * Whether to output OSM way ids in Feature properties.
109
109
  * "true", "on", "yes", "y", "1" will enable output. Default: disabled
@@ -147,14 +147,14 @@ export interface Paths {
147
147
  * @example
148
148
  */
149
149
  id?: string;
150
- /** @example Freiburg Littenweiler */
151
- name?: string;
152
- /** @example 1 */
153
- platform?: string;
154
150
  /** @description Latitude of the stop, in WGS84 */
155
151
  latitude?: number;
156
152
  /** @description Latitude of the stop, in WGS84 */
157
153
  longitude?: number;
154
+ /** @example Freiburg Littenweiler */
155
+ name?: string;
156
+ /** @example 1 */
157
+ platform?: string;
158
158
  };
159
159
  station_to?: {
160
160
  /**
@@ -162,14 +162,14 @@ export interface Paths {
162
162
  * @example 8004158
163
163
  */
164
164
  id?: string;
165
- /** @example Muenchen Pasing */
166
- name?: string;
167
- /** @example 4 */
168
- platform?: string;
169
165
  /** @description Latitude of the stop, in WGS84 */
170
166
  latitude?: number;
171
167
  /** @description Latitude of the stop, in WGS84 */
172
168
  longitude?: number;
169
+ /** @example Muenchen Pasing */
170
+ name?: string;
171
+ /** @example 4 */
172
+ platform?: string;
173
173
  };
174
174
  /** @enum {string} */
175
175
  type?: 'Feature';
package/types/stops.d.ts CHANGED
@@ -9,35 +9,35 @@ export interface Paths {
9
9
  get: {
10
10
  parameters: {
11
11
  query: {
12
- /** Control how many matches will be returned */
13
- limit?: number;
14
- /** Anything you'd like to search for */
15
- q: string;
16
12
  /**
17
- * comma seperated list, order chooses which agency will be preferred
18
- * as ident_source (for id and code fields)
13
+ * left,bottom,right,up coordinates in WGS84 wherein the
14
+ * station should lie
19
15
  */
20
- prefagencies?: 'sbb' | 'db';
16
+ bbox?: string;
17
+ /** which field to look up, default: all of them */
18
+ field?: 'coords' | 'id' | 'name';
19
+ /** Control how many matches will be returned */
20
+ limit?: number;
21
21
  /**
22
22
  * comma seperated list of mot's which should be available
23
23
  * at the stop
24
24
  */
25
25
  mots?:
26
26
  | 'bus'
27
+ | 'cable_car'
27
28
  | 'ferry'
29
+ | 'funicular'
28
30
  | 'gondola'
29
- | 'tram'
30
31
  | 'rail'
31
- | 'funicular'
32
- | 'cable_car'
33
- | 'subway';
32
+ | 'subway'
33
+ | 'tram';
34
34
  /**
35
- * left,bottom,right,up coordinates in WGS84 wherein the
36
- * station should lie
35
+ * comma seperated list, order chooses which agency will be preferred
36
+ * as ident_source (for id and code fields)
37
37
  */
38
- bbox?: string;
39
- /** which field to look up, default: all of them */
40
- field?: 'id' | 'name' | 'coords';
38
+ prefagencies?: 'db' | 'sbb';
39
+ /** Anything you'd like to search for */
40
+ q: string;
41
41
  /**
42
42
  * Coordinates in WGS84 (in lat,lon order) used to rank stops close to
43
43
  * this position higher
@@ -49,81 +49,81 @@ export interface Paths {
49
49
  /** stop(s) */
50
50
  200: {
51
51
  schema: {
52
- /** @enum {string} */
53
- type?: 'FeatureCollection';
54
52
  features?: {
55
- /** @enum {string} */
56
- type?: 'Feature';
53
+ /** @description the coordinates of the stop */
54
+ geometry?: {
55
+ /**
56
+ * @example [
57
+ * 7.439119,
58
+ * 46.94882
59
+ * ]
60
+ */
61
+ coordinates?: number[];
62
+ /** @enum {string} */
63
+ type?: 'Point';
64
+ };
57
65
  properties?: {
58
- /** @description internal ID */
59
- uid?: string;
60
66
  /**
61
- * @description name of the stop
62
- * @example Bern
67
+ * @description Abbreviation code from the transport agency (e.g. DS100 for Deutsche Bahn)
68
+ *
69
+ * @example BN
63
70
  */
64
- name?: string;
71
+ code?: string;
65
72
  /**
66
73
  * @description 2 letter country code where the station is located
67
74
  * @example CH
68
75
  */
69
76
  country_code?: string;
70
77
  /**
71
- * @description how well the result matches your query, 0
72
- * means best
78
+ * @description uic number
79
+ * @example 8507000
73
80
  */
74
- rank?: number;
81
+ id?: string;
75
82
  /**
76
- * @description array of translations of the stopname
77
- * @default []
83
+ * @description source agency for id and code (see below)
84
+ * @example sbb
78
85
  */
79
- translated_names?: {
80
- value?: string;
81
- /** @enum {string} */
82
- language?: 'de' | 'en' | 'fr' | 'it';
83
- }[];
86
+ ident_source?: string;
87
+ /** @description ifopt identifier, if available */
88
+ ifopt?: string;
84
89
  /** @description Means of transport that are available at this station */
85
90
  mot?: {
86
91
  bus?: boolean;
92
+ cable_car?: boolean;
87
93
  ferry?: boolean;
94
+ funicular?: boolean;
88
95
  gondola?: boolean;
89
- tram?: boolean;
90
96
  rail?: boolean;
91
- funicular?: boolean;
92
- cable_car?: boolean;
93
97
  subway?: boolean;
98
+ tram?: boolean;
94
99
  };
95
100
  /**
96
- * @description source agency for id and code (see below)
97
- * @example sbb
98
- */
99
- ident_source?: string;
100
- /**
101
- * @description uic number
102
- * @example 8507000
101
+ * @description name of the stop
102
+ * @example Bern
103
103
  */
104
- id?: string;
104
+ name?: string;
105
105
  /**
106
- * @description Abbreviation code from the transport agency (e.g. DS100 for Deutsche Bahn)
107
- *
108
- * @example BN
106
+ * @description how well the result matches your query, 0
107
+ * means best
109
108
  */
110
- code?: string;
111
- /** @description ifopt identifier, if available */
112
- ifopt?: string;
113
- };
114
- /** @description the coordinates of the stop */
115
- geometry?: {
116
- /** @enum {string} */
117
- type?: 'Point';
109
+ rank?: number;
118
110
  /**
119
- * @example [
120
- * 7.439119,
121
- * 46.94882
122
- * ]
111
+ * @description array of translations of the stopname
112
+ * @default []
123
113
  */
124
- coordinates?: number[];
114
+ translated_names?: {
115
+ /** @enum {string} */
116
+ language?: 'de' | 'en' | 'fr' | 'it';
117
+ value?: string;
118
+ }[];
119
+ /** @description internal ID */
120
+ uid?: string;
125
121
  };
122
+ /** @enum {string} */
123
+ type?: 'Feature';
126
124
  }[];
125
+ /** @enum {string} */
126
+ type?: 'FeatureCollection';
127
127
  };
128
128
  };
129
129
  /** limit parameter too high */