mobility-toolbox-js 3.0.0-beta.9 → 3.0.1-beta.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.
- package/api/HttpAPI.d.ts +5 -16
- package/api/HttpAPI.js +0 -11
- package/api/RealtimeAPI.d.ts +221 -176
- package/api/RealtimeAPI.js +317 -258
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -164
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +12 -12
- package/common/controls/StopFinderControlCommon.js +31 -31
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +157 -163
- package/common/mixins/RealtimeLayerMixin.js +401 -393
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/typedefs.d.ts +13 -6
- package/common/typedefs.js +7 -1
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +9 -3
- package/common/utils/renderTrajectories.d.ts +1 -1
- package/common/utils/renderTrajectories.js +6 -6
- package/common/utils/sortAndFilterDepartures.d.ts +1 -1
- package/common/utils/sortAndFilterDepartures.js +1 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/layers/Layer.d.ts +1 -1
- package/maplibre/layers/Layer.js +1 -1
- package/maplibre/layers/RealtimeLayer.d.ts +87 -66
- package/maplibre/layers/RealtimeLayer.js +30 -6
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/mbt.js +20988 -13287
- package/mbt.js.map +4 -4
- package/mbt.min.js +61 -58
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +82 -89
- package/ol/controls/RoutingControl.js +217 -219
- package/ol/controls/StopFinderControl.d.ts +3 -3
- package/ol/controls/StopFinderControl.js +2 -2
- package/ol/index.d.ts +1 -0
- package/ol/index.js +1 -0
- package/ol/layers/Layer.d.ts +101 -0
- package/ol/layers/Layer.js +25 -0
- package/ol/layers/MaplibreLayer.d.ts +121 -24
- package/ol/layers/MaplibreLayer.js +98 -27
- package/ol/layers/MaplibreStyleLayer.d.ts +93 -91
- package/ol/layers/MaplibreStyleLayer.js +281 -257
- package/ol/layers/RealtimeLayer.d.ts +119 -121
- package/ol/layers/RealtimeLayer.js +143 -134
- package/ol/layers/VectorLayer.d.ts +18 -0
- package/ol/layers/VectorLayer.js +32 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/mixins/MobilityLayerMixin.d.ts +32 -34
- package/ol/mixins/PropertiesLayerMixin.d.ts +60 -51
- package/ol/mixins/PropertiesLayerMixin.js +114 -79
- package/ol/mixins/index.d.ts +1 -0
- package/ol/mixins/index.js +2 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +6 -6
- package/ol/renderers/RealtimeLayerRenderer.js +56 -51
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +31 -31
- package/setupTests.js +3 -4
- package/types/common.d.ts +55 -48
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +91 -93
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
|
@@ -1,66 +1,65 @@
|
|
|
1
|
+
import { FeatureState } from 'maplibre-gl';
|
|
1
2
|
import { Feature, Map } from 'ol';
|
|
2
3
|
import { Coordinate } from 'ol/coordinate';
|
|
3
|
-
import { ObjectEvent } from 'ol/Object';
|
|
4
4
|
import { Layer } from 'ol/layer';
|
|
5
|
+
import { ObjectEvent } from 'ol/Object';
|
|
5
6
|
import { Source } from 'ol/source';
|
|
6
|
-
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
7
7
|
import { FilterFunction } from '../../common/typedefs';
|
|
8
|
-
import
|
|
8
|
+
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
9
9
|
import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
|
|
10
|
-
|
|
10
|
+
import MaplibreLayer, { MaplibreLayerOptions } from './MaplibreLayer';
|
|
11
|
+
export type MaplibreStyleLayerOptions = {
|
|
11
12
|
beforeId?: string;
|
|
12
|
-
maplibreLayer?: MaplibreLayer;
|
|
13
13
|
layers?: maplibregl.AddLayerObject[];
|
|
14
14
|
layersFilter?: FilterFunction;
|
|
15
|
+
maplibreLayer?: MaplibreLayer;
|
|
15
16
|
queryRenderedLayersFilter?: FilterFunction;
|
|
16
|
-
};
|
|
17
|
+
} & MaplibreLayerOptions;
|
|
17
18
|
declare const MaplibreStyleLayer_base: {
|
|
18
19
|
new (...args: any[]): {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
olEventsKeys: import("ol/events").EventsKey[];
|
|
21
|
+
options?: import("../mixins/PropertiesLayerMixin").PropertiesLayerMixinOptions;
|
|
22
|
+
attachToMap(map: Map): void;
|
|
23
|
+
detachFromMap(): void;
|
|
24
|
+
flat(): any[];
|
|
25
|
+
onChildrenChange(oldValue: Layer[]): void;
|
|
26
|
+
setMapInternal: ((map: Map) => void) & ((map: import("ol/Map").default | null) => void);
|
|
21
27
|
children: Layer<Source, import("ol/renderer/Layer").default<any>>[];
|
|
22
28
|
get copyrights(): string;
|
|
23
29
|
set copyrights(newCopyrights: string | string[]);
|
|
24
30
|
disabled: boolean;
|
|
25
31
|
readonly group: string;
|
|
26
|
-
readonly hitTolerance:
|
|
32
|
+
readonly hitTolerance: number;
|
|
27
33
|
readonly key: string;
|
|
28
34
|
readonly map: Map;
|
|
29
35
|
readonly name: string;
|
|
30
|
-
olLayer: Layer
|
|
36
|
+
olLayer: Layer;
|
|
31
37
|
parent: Layer<Source, import("ol/renderer/Layer").default<any>>;
|
|
32
38
|
visible: boolean;
|
|
33
|
-
setMapInternal: ((map: Map) => void) & ((map: Map | null) => void);
|
|
34
|
-
onChildrenChange(oldValue: Layer<Source, import("ol/renderer/Layer").default<any>>[]): void;
|
|
35
|
-
attachToMap(map: Map): void;
|
|
36
|
-
detachFromMap(): void;
|
|
37
|
-
flat(): any[];
|
|
38
|
-
addEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
39
|
-
removeEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
40
39
|
on: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
|
|
41
|
-
render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
|
|
42
40
|
once: import("ol/layer/Layer").LayerOnSignature<import("ol/events").EventsKey>;
|
|
43
41
|
un: import("ol/layer/Layer").LayerOnSignature<void>;
|
|
42
|
+
render: (frameState: import("ol/Map").FrameState | null, target: HTMLElement) => HTMLElement | null;
|
|
44
43
|
getSource: () => Source | null;
|
|
45
44
|
getRenderSource: () => Source | null;
|
|
46
|
-
getFeatures: (pixel: import("ol/pixel").Pixel) => Promise<import("ol/Feature").FeatureLike
|
|
47
|
-
getData: (pixel: import("ol/pixel").Pixel) =>
|
|
48
|
-
isVisible: (view?: import("ol
|
|
49
|
-
getAttributions: (view?: import("ol
|
|
45
|
+
getFeatures: (pixel: import("ol/pixel").Pixel) => Promise<Array<import("ol/Feature").FeatureLike>>;
|
|
46
|
+
getData: (pixel: import("ol/pixel").Pixel) => Uint8ClampedArray | Uint8Array | Float32Array | DataView | null;
|
|
47
|
+
isVisible: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => boolean;
|
|
48
|
+
getAttributions: (view?: import("ol").View | import("ol/View").ViewStateLayerStateExtent | undefined) => Array<string>;
|
|
50
49
|
unrender: () => void;
|
|
51
50
|
getDeclutter: () => string;
|
|
52
51
|
renderDeclutter: (frameState: import("ol/Map").FrameState, layerState: import("ol/layer/Layer").State) => void;
|
|
53
52
|
renderDeferred: (frameState: import("ol/Map").FrameState) => void;
|
|
54
|
-
getMapInternal: () => Map | null;
|
|
55
|
-
setMap: (map: Map | null) => void;
|
|
53
|
+
getMapInternal: () => import("ol/Map").default | null;
|
|
54
|
+
setMap: (map: import("ol/Map").default | null) => void;
|
|
56
55
|
setSource: (source: Source | null) => void;
|
|
57
56
|
getRenderer: () => import("ol/renderer/Layer").default<any> | null;
|
|
58
57
|
hasRenderer: () => boolean;
|
|
59
|
-
getBackground: () =>
|
|
58
|
+
getBackground: () => import("ol/layer/Base").BackgroundColor | false;
|
|
60
59
|
getClassName: () => string;
|
|
61
60
|
getLayerState: (managed?: boolean | undefined) => import("ol/layer/Layer").State;
|
|
62
|
-
getLayersArray: (array?: Layer<Source, import("ol/renderer/Layer").default<any>>[] | undefined) =>
|
|
63
|
-
getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => import("ol/layer/Layer").State
|
|
61
|
+
getLayersArray: (array?: import("ol/layer/Layer").default<import("ol/source/Source").default, import("ol/renderer/Layer").default<any>>[] | undefined) => Array<import("ol/layer/Layer").default>;
|
|
62
|
+
getLayerStatesArray: (states?: import("ol/layer/Layer").State[] | undefined) => Array<import("ol/layer/Layer").State>;
|
|
64
63
|
getExtent: () => import("ol/extent").Extent | undefined;
|
|
65
64
|
getMaxResolution: () => number;
|
|
66
65
|
getMinResolution: () => number;
|
|
@@ -80,7 +79,7 @@ declare const MaplibreStyleLayer_base: {
|
|
|
80
79
|
setVisible: (visible: boolean) => void;
|
|
81
80
|
setZIndex: (zindex: number) => void;
|
|
82
81
|
get: (key: string) => any;
|
|
83
|
-
getKeys: () => string
|
|
82
|
+
getKeys: () => Array<string>;
|
|
84
83
|
getProperties: () => {
|
|
85
84
|
[x: string]: any;
|
|
86
85
|
};
|
|
@@ -98,9 +97,11 @@ declare const MaplibreStyleLayer_base: {
|
|
|
98
97
|
unset: (key: string, silent?: boolean | undefined) => void;
|
|
99
98
|
changed: () => void;
|
|
100
99
|
getRevision: () => number;
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
addEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
101
|
+
dispatchEvent: (event: import("ol/events/Event").default | string) => boolean | undefined;
|
|
102
|
+
getListeners: (type: string) => Array<import("ol/events").Listener> | undefined;
|
|
103
103
|
hasListener: (type?: string | undefined) => boolean;
|
|
104
|
+
removeEventListener: (type: string, listener: import("ol/events").Listener) => void;
|
|
104
105
|
dispose: () => void;
|
|
105
106
|
};
|
|
106
107
|
} & typeof Layer;
|
|
@@ -125,39 +126,6 @@ declare const MaplibreStyleLayer_base: {
|
|
|
125
126
|
declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
126
127
|
highlightedFeatures: Feature[];
|
|
127
128
|
selectedFeatures: Feature[];
|
|
128
|
-
get beforeId(): string;
|
|
129
|
-
set beforeId(newValue: string[]);
|
|
130
|
-
get layers(): maplibregl.AddLayerObject[];
|
|
131
|
-
set layers(newValue: maplibregl.AddLayerObject[]);
|
|
132
|
-
get layersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
133
|
-
set layersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
134
|
-
get mapboxLayer(): MaplibreLayer | undefined;
|
|
135
|
-
get maplibreLayer(): MaplibreLayer;
|
|
136
|
-
set maplibreLayer(newValue: MaplibreLayer);
|
|
137
|
-
get queryRenderedLayersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
138
|
-
set queryRenderedLayersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
139
|
-
get sources(): {
|
|
140
|
-
[key: string]: maplibregl.SourceSpecification;
|
|
141
|
-
};
|
|
142
|
-
set sources(newValue: {
|
|
143
|
-
[key: string]: maplibregl.SourceSpecification;
|
|
144
|
-
});
|
|
145
|
-
/**
|
|
146
|
-
* @deprecated
|
|
147
|
-
*/
|
|
148
|
-
get styleLayer(): maplibregl.AddLayerObject;
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated
|
|
151
|
-
*/
|
|
152
|
-
set styleLayer(newValue: maplibregl.AddLayerObject);
|
|
153
|
-
/**
|
|
154
|
-
* @deprecated
|
|
155
|
-
*/
|
|
156
|
-
get styleLayers(): maplibregl.AddLayerObject[];
|
|
157
|
-
/**
|
|
158
|
-
* @deprecated
|
|
159
|
-
*/
|
|
160
|
-
set styleLayers(newValue: maplibregl.AddLayerObject[]);
|
|
161
129
|
/**
|
|
162
130
|
* Constructor.
|
|
163
131
|
*
|
|
@@ -168,38 +136,64 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
|
168
136
|
* @param {FilterFunction} [options.layersFilter] Filter function to decide which style layer to apply visiblity on. If not provided, the 'layers' property is used.
|
|
169
137
|
* @param {FilterFunction} [options.queryRenderedLayersFilter] Filter function to decide which style layer are available for query.
|
|
170
138
|
*/
|
|
171
|
-
constructor(options
|
|
172
|
-
|
|
139
|
+
constructor(options?: MaplibreStyleLayerOptions);
|
|
140
|
+
/** @private */
|
|
141
|
+
addLayers(): void;
|
|
142
|
+
/** @private */
|
|
143
|
+
addSources(): void;
|
|
144
|
+
applyLayoutVisibility(evt?: ObjectEvent): void;
|
|
173
145
|
/**
|
|
174
146
|
* Initialize the layer.
|
|
175
147
|
* @param {ol/Map~Map} map the Maplibre map.
|
|
176
148
|
* @override
|
|
177
149
|
*/
|
|
178
150
|
attachToMap(map: Map): void;
|
|
151
|
+
/**
|
|
152
|
+
* Create a copy of the MapboxStyleLayer.
|
|
153
|
+
* @param {Object} newOptions Options to override.
|
|
154
|
+
* @return {MapboxStyleLayer} A MapboxStyleLayer.
|
|
155
|
+
*/
|
|
156
|
+
clone(newOptions: MaplibreStyleLayerOptions): MaplibreStyleLayer;
|
|
157
|
+
createRenderer(): MaplibreStyleLayerRenderer;
|
|
179
158
|
/**
|
|
180
159
|
* Terminate the layer.
|
|
181
160
|
* @override
|
|
182
161
|
*/
|
|
183
162
|
detachFromMap(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Request feature information for a given coordinate.
|
|
165
|
+
* @param {ol/coordinate~Coordinate} coordinate Coordinate to request the information at.
|
|
166
|
+
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
167
|
+
*/
|
|
168
|
+
getFeatureInfoAtCoordinate(coordinate: Coordinate): Promise<LayerGetFeatureInfoResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Highlight a list of features.
|
|
171
|
+
* @param {Array<ol/Feature~Feature>} [features=[]] Features to highlight.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
highlight(features?: Feature[]): void;
|
|
175
|
+
/**
|
|
176
|
+
* On Maplibre map load callback function. Add style layers and dynaimc filters.
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
onLoad(): void;
|
|
184
180
|
/** @private */
|
|
185
|
-
|
|
181
|
+
removeLayers(): void;
|
|
186
182
|
/** @private */
|
|
187
183
|
removeSources(): void;
|
|
188
|
-
/** @private */
|
|
189
|
-
addLayers(): void;
|
|
190
|
-
/** @private */
|
|
191
|
-
removeLayers(): void;
|
|
192
184
|
/**
|
|
193
|
-
*
|
|
185
|
+
* Select a list of features.
|
|
186
|
+
* @param {Array<ol/Feature~Feature>} [features=[]] Features to select.
|
|
194
187
|
* @private
|
|
195
188
|
*/
|
|
196
|
-
|
|
189
|
+
select(features?: Feature[]): void;
|
|
197
190
|
/**
|
|
198
|
-
*
|
|
199
|
-
* @param {ol/
|
|
200
|
-
* @
|
|
191
|
+
* Set the feature state of the features.
|
|
192
|
+
* @param {Array<ol/Feature~Feature>} features
|
|
193
|
+
* @param {{[key:string]:boolean}} state The feature state
|
|
194
|
+
* @public
|
|
201
195
|
*/
|
|
202
|
-
|
|
196
|
+
setFeatureState(features: Feature[], state: FeatureState): void;
|
|
203
197
|
/**
|
|
204
198
|
* Set if features are hovered or not.
|
|
205
199
|
* @param {Array<ol/Feature~Feature>} features
|
|
@@ -207,29 +201,37 @@ declare class MaplibreStyleLayer extends MaplibreStyleLayer_base {
|
|
|
207
201
|
* @private
|
|
208
202
|
*/
|
|
209
203
|
setHoverState(features: Feature[], state: boolean): void;
|
|
204
|
+
get beforeId(): string;
|
|
205
|
+
set beforeId(newValue: string[]);
|
|
206
|
+
get layers(): maplibregl.AddLayerObject[];
|
|
207
|
+
set layers(newValue: maplibregl.AddLayerObject[]);
|
|
208
|
+
get layersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
209
|
+
set layersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
210
|
+
get mapboxLayer(): MaplibreLayer | undefined;
|
|
211
|
+
get maplibreLayer(): MaplibreLayer;
|
|
212
|
+
set maplibreLayer(newValue: MaplibreLayer);
|
|
213
|
+
get queryRenderedLayersFilter(): (layer: maplibregl.LayerSpecification) => boolean;
|
|
214
|
+
set queryRenderedLayersFilter(newValue: (layer: maplibregl.LayerSpecification) => boolean);
|
|
215
|
+
get sources(): Record<string, maplibregl.SourceSpecification>;
|
|
216
|
+
set sources(newValue: Record<string, maplibregl.SourceSpecification>);
|
|
210
217
|
/**
|
|
211
|
-
*
|
|
212
|
-
* @param {Array<ol/Feature~Feature>} [features=[]] Features to select.
|
|
213
|
-
* @private
|
|
218
|
+
* @deprecated
|
|
214
219
|
*/
|
|
215
|
-
|
|
220
|
+
get styleLayer(): maplibregl.AddLayerObject;
|
|
216
221
|
/**
|
|
217
|
-
*
|
|
218
|
-
* @param {Array<ol/Feature~Feature>} [features=[]] Features to highlight.
|
|
219
|
-
* @private
|
|
222
|
+
* @deprecated
|
|
220
223
|
*/
|
|
221
|
-
|
|
224
|
+
set styleLayer(newValue: maplibregl.AddLayerObject);
|
|
222
225
|
/**
|
|
223
226
|
* Apply visibility to style layers that fits the styleLayersFilter function.
|
|
224
|
-
*
|
|
225
|
-
* @private
|
|
226
227
|
*/
|
|
227
|
-
applyLayoutVisibility(evt?: ObjectEvent): void;
|
|
228
228
|
/**
|
|
229
|
-
*
|
|
230
|
-
* @param {Object} newOptions Options to override.
|
|
231
|
-
* @return {MapboxStyleLayer} A MapboxStyleLayer.
|
|
229
|
+
* @deprecated
|
|
232
230
|
*/
|
|
233
|
-
|
|
231
|
+
get styleLayers(): maplibregl.AddLayerObject[];
|
|
232
|
+
/**
|
|
233
|
+
* @deprecated
|
|
234
|
+
*/
|
|
235
|
+
set styleLayers(newValue: maplibregl.AddLayerObject[]);
|
|
234
236
|
}
|
|
235
237
|
export default MaplibreStyleLayer;
|