mobility-toolbox-js 2.0.1-beta.13 → 2.2.0-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/RealtimeAPI.d.ts +281 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +490 -0
- package/api/RoutingAPI.d.ts +37 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/RoutingAPI.js +32 -12
- package/api/StopsAPI.d.ts +38 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +33 -9
- package/api/index.d.ts +4 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +3 -3
- package/api/typedefs.d.ts +179 -0
- package/api/typedefs.d.ts.map +1 -0
- package/api/typedefs.js +75 -0
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +54 -27
- package/common/api/WebSocketAPI.d.ts +153 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +330 -164
- package/common/controls/ControlCommon.d.ts +76 -0
- package/common/controls/ControlCommon.d.ts.map +1 -0
- package/common/controls/ControlCommon.js +150 -0
- package/common/controls/CopyrightControlCommon.d.ts +13 -0
- package/common/controls/CopyrightControlCommon.d.ts.map +1 -0
- package/common/controls/CopyrightControlCommon.js +34 -0
- package/common/controls/StopFinderControlCommon.d.ts +55 -0
- package/common/controls/StopFinderControlCommon.d.ts.map +1 -0
- package/common/controls/StopFinderControlCommon.js +144 -0
- package/common/index.d.ts +3 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +2 -4
- package/common/layers/LayerCommon.d.ts +94 -0
- package/common/layers/LayerCommon.d.ts.map +1 -0
- package/common/layers/LayerCommon.js +244 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +286 -0
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
- package/common/mixins/RealtimeLayerMixin.js +779 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts +60 -0
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
- package/common/mixins/UserInteractionsLayerMixin.js +241 -0
- package/common/styles/index.d.ts +5 -0
- package/common/styles/index.d.ts.map +1 -0
- package/common/styles/index.js +4 -4
- package/common/styles/realtimeDefaultStyle.d.ts +36 -0
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
- package/common/styles/realtimeDefaultStyle.js +275 -0
- package/common/styles/realtimeDelayStyle.d.ts +12 -0
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
- package/common/styles/realtimeDelayStyle.js +13 -0
- package/common/styles/realtimeHeadingStyle.d.ts +12 -0
- package/common/styles/realtimeHeadingStyle.d.ts.map +1 -0
- package/common/styles/realtimeHeadingStyle.js +85 -0
- package/common/styles/realtimeSimpleStyle.d.ts +4 -0
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
- package/common/styles/realtimeSimpleStyle.js +23 -0
- package/common/typedefs.d.ts +111 -0
- package/common/typedefs.d.ts.map +1 -0
- package/common/typedefs.js +52 -0
- package/common/utils/compareDepartures.d.ts +11 -0
- package/common/utils/compareDepartures.d.ts.map +1 -0
- package/common/utils/compareDepartures.js +35 -0
- package/common/utils/createCanvas.d.ts +10 -0
- package/common/utils/createCanvas.d.ts.map +1 -0
- package/common/utils/createCanvas.js +27 -0
- package/common/utils/createRealtimeFilters.d.ts +13 -0
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/createRealtimeFilters.js +74 -0
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +24 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +29 -0
- package/common/utils/getLayersAsFlatArray.d.ts +3 -0
- package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
- package/common/utils/getLayersAsFlatArray.js +15 -0
- package/common/utils/getMapboxMapCopyrights.d.ts +18 -0
- package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
- package/common/utils/getMapboxMapCopyrights.js +26 -15
- package/common/utils/getMapboxRender.d.ts +7 -0
- package/common/utils/getMapboxRender.d.ts.map +1 -0
- package/common/utils/getMapboxRender.js +87 -0
- package/common/utils/getMaplibreRender.d.ts +7 -0
- package/common/utils/getMaplibreRender.d.ts.map +1 -0
- package/common/utils/getMaplibreRender.js +38 -0
- package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
- package/common/utils/getRealtimeModeSuffix.js +7 -0
- package/common/utils/getUrlWithParams.d.ts +9 -0
- package/common/utils/getUrlWithParams.d.ts.map +1 -0
- package/common/utils/getUrlWithParams.js +18 -0
- package/common/utils/getVehiclePosition.d.ts +16 -0
- package/common/utils/getVehiclePosition.d.ts.map +1 -0
- package/common/utils/getVehiclePosition.js +67 -37
- package/common/utils/index.d.ts +17 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +17 -5
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/realtimeConfig.js +173 -0
- package/common/utils/removeDuplicate.d.ts +10 -0
- package/common/utils/removeDuplicate.d.ts.map +1 -0
- package/common/utils/removeDuplicate.js +12 -5
- package/common/utils/renderTrajectories.d.ts +17 -0
- package/common/utils/renderTrajectories.d.ts.map +1 -0
- package/common/utils/renderTrajectories.js +110 -0
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
- package/common/utils/sortAndFilterDepartures.js +58 -0
- package/common/utils/sortByDelay.d.ts +3 -0
- package/common/utils/sortByDelay.d.ts.map +1 -0
- package/common/utils/sortByDelay.js +17 -15
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +34 -15
- package/iife.d.ts +3 -0
- package/iife.d.ts.map +1 -0
- package/iife.js +5 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +8 -6
- package/mapbox/controls/CopyrightControl.d.ts +29 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +44 -25
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/controls/index.js +2 -1
- package/mapbox/index.d.ts +6 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/index.js +5 -4
- package/mapbox/layers/Layer.d.ts +59 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +99 -55
- package/mapbox/layers/RealtimeLayer.d.ts +181 -0
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
- package/mapbox/layers/RealtimeLayer.js +276 -0
- package/mapbox/layers/index.d.ts +3 -0
- package/mapbox/layers/index.d.ts.map +1 -0
- package/mapbox/layers/index.js +2 -2
- package/mapbox/utils/getMercatorResolution.d.ts +9 -0
- package/mapbox/utils/getMercatorResolution.d.ts.map +1 -0
- package/mapbox/utils/getMercatorResolution.js +18 -0
- package/mapbox/utils/getSourceCoordinates.d.ts +9 -0
- package/mapbox/utils/getSourceCoordinates.d.ts.map +1 -0
- package/mapbox/utils/getSourceCoordinates.js +27 -0
- package/mapbox/utils/index.d.ts +3 -0
- package/mapbox/utils/index.d.ts.map +1 -0
- package/mapbox/utils/index.js +2 -0
- package/mbt.js +26074 -16501
- package/mbt.js.map +4 -4
- package/mbt.min.js +205 -126
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +62 -36
- package/ol/controls/RoutingControl.d.ts +193 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +601 -357
- package/ol/controls/StopFinderControl.d.ts +30 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.js +30 -8
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/controls/index.js +3 -3
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/index.js +5 -5
- package/ol/layers/Layer.d.ts +86 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +163 -77
- package/ol/layers/MapGlLayer.d.ts +67 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -0
- package/ol/layers/MapGlLayer.js +218 -0
- package/ol/layers/MapboxLayer.d.ts +50 -0
- package/ol/layers/MapboxLayer.d.ts.map +1 -0
- package/ol/layers/MapboxLayer.js +99 -193
- package/ol/layers/MapboxStyleLayer.d.ts +129 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +362 -171
- package/ol/layers/MaplibreLayer.d.ts +28 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +30 -135
- package/ol/layers/RealtimeLayer.d.ts +202 -0
- package/ol/layers/RealtimeLayer.d.ts.map +1 -0
- package/ol/layers/RealtimeLayer.js +340 -0
- package/ol/layers/RoutingLayer.d.ts +34 -0
- package/ol/layers/RoutingLayer.d.ts.map +1 -0
- package/ol/layers/RoutingLayer.js +72 -48
- package/ol/layers/VectorLayer.d.ts +25 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +34 -18
- package/ol/layers/WMSLayer.d.ts +42 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +84 -34
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/layers/index.js +8 -8
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +26 -24
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +40 -39
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/ol/styles/index.js +2 -2
- package/package.json +81 -133
- package/setupTests.d.ts +2 -0
- package/setupTests.d.ts.map +1 -0
- package/setupTests.js +26 -0
- package/types/common.d.ts +122 -0
- package/types/index.d.ts +13 -0
- package/types/realtime.d.ts +320 -0
- package/types/routing.d.ts +206 -0
- package/types/stops.d.ts +143 -0
- package/README.md +0 -23
- package/api/RoutingAPI.test.js +0 -25
- package/api/StopsAPI.test.js +0 -22
- package/api/TralisAPI.js +0 -359
- package/api/TralisAPI.test.js +0 -67
- package/api/TralisAPIUtils.js +0 -43
- package/common/Tracker.js +0 -93
- package/common/api/HttpAPI.test.js +0 -50
- package/common/api/WebSocketAPI.test.js +0 -311
- package/common/controls/Control.js +0 -81
- package/common/controls/Control.test.js +0 -87
- package/common/layers/Layer.js +0 -213
- package/common/layers/Layer.test.js +0 -526
- package/common/mixins/CopyrightMixin.js +0 -24
- package/common/mixins/SearchMixin.js +0 -110
- package/common/mixins/TralisLayerMixin.js +0 -479
- package/common/styles/trackerDefaultStyle.js +0 -197
- package/common/styles/trackerDelayStyle.js +0 -8
- package/common/styles/trackerSimpleStyle.js +0 -18
- package/common/trackerConfig.js +0 -152
- package/common/trackerConfig.test.js +0 -23
- package/common/utils/createTrackerFilters.js +0 -56
- package/common/utils/createTrackerFilters.test.js +0 -79
- package/common/utils/getMapboxMapCopyrights.test.js +0 -40
- package/common/utils/getMapboxStyleUrl.js +0 -22
- package/common/utils/removeDuplicate.test.js +0 -19
- package/common/utils/timeUtils.test.js +0 -10
- package/mapbox/layers/Layer.test.js +0 -182
- package/mapbox/layers/TralisLayer.js +0 -182
- package/mapbox/layers/TralisLayer.test.js +0 -38
- package/mapbox/utils.js +0 -32
- package/ol/controls/CopyrightControl.test.js +0 -165
- package/ol/controls/RoutingControl.test.js +0 -151
- package/ol/controls/StopFinderControl.test.js +0 -48
- package/ol/layers/Layer.test.js +0 -174
- package/ol/layers/MapboxLayer.test.js +0 -160
- package/ol/layers/MapboxStyleLayer.test.js +0 -231
- package/ol/layers/RoutingLayer.test.js +0 -40
- package/ol/layers/TralisLayer.js +0 -185
- package/ol/layers/TralisLayer.test.js +0 -79
- package/ol/layers/VectorLayer.test.js +0 -87
- package/ol/layers/WMSLayer.test.js +0 -76
package/ol/layers/WMSLayer.js
CHANGED
|
@@ -1,38 +1,88 @@
|
|
|
1
|
-
import GeoJSON from
|
|
2
|
-
import Layer from
|
|
1
|
+
import GeoJSON from 'ol/format/GeoJSON';
|
|
2
|
+
import Layer from './Layer';
|
|
3
|
+
/**
|
|
4
|
+
* Class use to display a WMS layer.
|
|
5
|
+
*
|
|
6
|
+
* @classproperty {ol/Map~Map} map - The map where the layer is displayed.
|
|
7
|
+
* @extends {Layer}
|
|
8
|
+
*/
|
|
3
9
|
class WMSLayer extends Layer {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @override
|
|
12
|
+
*/
|
|
13
|
+
constructor(options) {
|
|
14
|
+
super(options);
|
|
15
|
+
/** @ignore */
|
|
16
|
+
this.abortController = new AbortController();
|
|
17
|
+
/** @ignore */
|
|
18
|
+
this.format = new GeoJSON();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get features infos' Url.
|
|
22
|
+
* @param {ol/coordinate~Coordinate} coord
|
|
23
|
+
* @return {ol/layer/Layer~Layer}
|
|
24
|
+
*/
|
|
25
|
+
getFeatureInfoUrl(coord) {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
if (!this.map) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const projection = this.map.getView().getProjection();
|
|
31
|
+
const resolution = this.map.getView().getResolution();
|
|
32
|
+
if (resolution &&
|
|
33
|
+
projection &&
|
|
34
|
+
((_b = (_a = this.olLayer) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.getFeatureInfoUrl)) {
|
|
35
|
+
// eslint-disable-next-line consistent-return
|
|
36
|
+
return (_d = (_c = this.olLayer) === null || _c === void 0 ? void 0 : _c.getSource()) === null || _d === void 0 ? void 0 : _d.getFeatureInfoUrl(coord, resolution, projection, {
|
|
37
|
+
info_format: 'application/json',
|
|
38
|
+
query_layers: (_f = (_e = this.olLayer) === null || _e === void 0 ? void 0 : _e.getSource()) === null || _f === void 0 ? void 0 : _f.getParams().layers,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Request feature information for a given coordinate.
|
|
44
|
+
* @param {ol/coordinate~Coordinate} coordinate to request the information at.
|
|
45
|
+
* @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
|
|
46
|
+
*/
|
|
47
|
+
getFeatureInfoAtCoordinate(coordinate) {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
50
|
+
this.abortController = new AbortController();
|
|
51
|
+
const { signal } = this.abortController;
|
|
52
|
+
const url = this.getFeatureInfoUrl(coordinate);
|
|
53
|
+
if (!url) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.error('No url for the WMS layer.');
|
|
56
|
+
// resolve an empty feature array something fails
|
|
57
|
+
return Promise.resolve({
|
|
58
|
+
features: [],
|
|
59
|
+
coordinate,
|
|
60
|
+
layer: this,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return fetch(url, { signal })
|
|
64
|
+
.then((resp) => resp.json())
|
|
65
|
+
.then((r) => r.features)
|
|
66
|
+
.then((data) => ({
|
|
67
|
+
layer: this,
|
|
68
|
+
coordinate,
|
|
69
|
+
features: data.map((d) => this.format.readFeature(d)),
|
|
70
|
+
}))
|
|
71
|
+
.catch(() =>
|
|
72
|
+
// resolve an empty feature array something fails
|
|
73
|
+
Promise.resolve({
|
|
74
|
+
features: [],
|
|
75
|
+
coordinate,
|
|
76
|
+
layer: this,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a copy of the WMSLayer.
|
|
81
|
+
* @param {Object} newOptions Options to override
|
|
82
|
+
* @return {WMSLayer} A WMSLayer
|
|
83
|
+
*/
|
|
84
|
+
clone(newOptions) {
|
|
85
|
+
return new WMSLayer(Object.assign(Object.assign({}, this.options), newOptions));
|
|
17
86
|
}
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
getFeatureInfoAtCoordinate(coordinate) {
|
|
21
|
-
this.abortController.abort();
|
|
22
|
-
this.abortController = new AbortController();
|
|
23
|
-
const { signal } = this.abortController;
|
|
24
|
-
return fetch(this.getFeatureInfoUrl(coordinate), { signal }).then((resp) => resp.json()).then((r) => r.features).then((data) => ({
|
|
25
|
-
layer: this,
|
|
26
|
-
coordinate,
|
|
27
|
-
features: data.map((d) => this.format.readFeature(d))
|
|
28
|
-
})).catch(() => Promise.resolve({
|
|
29
|
-
features: [],
|
|
30
|
-
coordinate,
|
|
31
|
-
layer: this
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
clone(newOptions) {
|
|
35
|
-
return new WMSLayer({ ...this.options, ...newOptions });
|
|
36
|
-
}
|
|
37
87
|
}
|
|
38
88
|
export default WMSLayer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as Layer } from "./Layer";
|
|
2
|
+
export { default as MapboxLayer } from "./MapboxLayer";
|
|
3
|
+
export { default as MaplibreLayer } from "./MaplibreLayer";
|
|
4
|
+
export { default as MapboxStyleLayer } from "./MapboxStyleLayer";
|
|
5
|
+
export { default as RoutingLayer } from "./RoutingLayer";
|
|
6
|
+
export { default as RealtimeLayer } from "./RealtimeLayer";
|
|
7
|
+
export { default as VectorLayer } from "./VectorLayer";
|
|
8
|
+
export { default as WMSLayer } from "./WMSLayer";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/index.js"],"names":[],"mappings":""}
|
package/ol/layers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as Layer } from
|
|
2
|
-
export { default as MapboxLayer } from
|
|
3
|
-
export { default as MaplibreLayer } from
|
|
4
|
-
export { default as MapboxStyleLayer } from
|
|
5
|
-
export { default as RoutingLayer } from
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as VectorLayer } from
|
|
8
|
-
export { default as WMSLayer } from
|
|
1
|
+
export { default as Layer } from './Layer';
|
|
2
|
+
export { default as MapboxLayer } from './MapboxLayer';
|
|
3
|
+
export { default as MaplibreLayer } from './MaplibreLayer';
|
|
4
|
+
export { default as MapboxStyleLayer } from './MapboxStyleLayer';
|
|
5
|
+
export { default as RoutingLayer } from './RoutingLayer';
|
|
6
|
+
export { default as RealtimeLayer } from './RealtimeLayer';
|
|
7
|
+
export { default as VectorLayer } from './VectorLayer';
|
|
8
|
+
export { default as WMSLayer } from './WMSLayer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullTrajectoryDelayStyle.d.ts","sourceRoot":"","sources":["../../../src/ol/styles/fullTrajectoryDelayStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AAgCvD,QAAA,MAAM,wBAAwB,QAAO,KAAK,EAEzC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { Style, Fill, Stroke, Circle } from
|
|
1
|
+
import { Style, Fill, Stroke, Circle } from 'ol/style';
|
|
2
|
+
/** @private */
|
|
2
3
|
const stroke = new Style({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
zIndex: 2,
|
|
5
|
+
image: new Circle({
|
|
6
|
+
radius: 5,
|
|
7
|
+
fill: new Fill({
|
|
8
|
+
color: '#000000',
|
|
9
|
+
}),
|
|
10
|
+
}),
|
|
11
|
+
stroke: new Stroke({
|
|
12
|
+
color: '#000000',
|
|
13
|
+
width: 6,
|
|
14
|
+
}),
|
|
14
15
|
});
|
|
16
|
+
/** @private */
|
|
15
17
|
const fill = new Style({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
zIndex: 3,
|
|
19
|
+
image: new Circle({
|
|
20
|
+
radius: 4,
|
|
21
|
+
fill: new Fill({
|
|
22
|
+
color: '#a0a0a0',
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
stroke: new Stroke({
|
|
26
|
+
color: '#a0a0a0',
|
|
27
|
+
width: 4,
|
|
28
|
+
}),
|
|
27
29
|
});
|
|
28
30
|
const fullTrajectoryDelaystyle = () => {
|
|
29
|
-
|
|
31
|
+
return [stroke, fill];
|
|
30
32
|
};
|
|
31
33
|
export default fullTrajectoryDelaystyle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FeatureLike } from 'ol/Feature';
|
|
2
|
+
import { Style } from 'ol/style';
|
|
3
|
+
declare const fullTrajectorystyle: (feature: FeatureLike, resolution: number, options: any) => Style[];
|
|
4
|
+
export default fullTrajectorystyle;
|
|
5
|
+
//# sourceMappingURL=fullTrajectoryStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullTrajectoryStyle.d.ts","sourceRoot":"","sources":["../../../src/ol/styles/fullTrajectoryStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AAiBvD,QAAA,MAAM,mBAAmB,YACd,WAAW,cACR,MAAM,WACT,GAAG,KACX,KAAK,EAgCP,CAAC;AACF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { Style, Fill, Stroke, Circle } from
|
|
2
|
-
|
|
1
|
+
import { Style, Fill, Stroke, Circle } from 'ol/style';
|
|
2
|
+
/** @private */
|
|
3
3
|
const borderStyle = new Style({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fill: new Fill({
|
|
8
|
-
color: "#000000"
|
|
9
|
-
})
|
|
10
|
-
}),
|
|
11
|
-
stroke: new Stroke({
|
|
12
|
-
color: "#000000",
|
|
13
|
-
width: 6
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
const fullTrajectorystyle = (feature) => {
|
|
17
|
-
let lineColor = "#ffffff";
|
|
18
|
-
const type = feature.get("type");
|
|
19
|
-
let stroke = feature.get("stroke");
|
|
20
|
-
if (stroke && stroke[0] !== "#") {
|
|
21
|
-
stroke = `#${stroke}`;
|
|
22
|
-
}
|
|
23
|
-
lineColor = stroke || getBgColor(type);
|
|
24
|
-
lineColor = /#ffffff/i.test(lineColor) ? "#ff0000" : lineColor;
|
|
25
|
-
const style = [
|
|
26
|
-
borderStyle,
|
|
27
|
-
new Style({
|
|
28
|
-
zIndex: 3,
|
|
29
|
-
image: new Circle({
|
|
30
|
-
radius: 4,
|
|
4
|
+
zIndex: 2,
|
|
5
|
+
image: new Circle({
|
|
6
|
+
radius: 5,
|
|
31
7
|
fill: new Fill({
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
color:
|
|
37
|
-
width:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
8
|
+
color: '#000000',
|
|
9
|
+
}),
|
|
10
|
+
}),
|
|
11
|
+
stroke: new Stroke({
|
|
12
|
+
color: '#000000',
|
|
13
|
+
width: 6,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
const fullTrajectorystyle = (feature, resolution, options) => {
|
|
17
|
+
let lineColor = '#ffffff'; // white
|
|
18
|
+
const type = feature.get('type');
|
|
19
|
+
let stroke = feature.get('stroke');
|
|
20
|
+
if (stroke && stroke[0] !== '#') {
|
|
21
|
+
stroke = `#${stroke}`;
|
|
22
|
+
}
|
|
23
|
+
lineColor = stroke || (options === null || options === void 0 ? void 0 : options.getBgColor(type));
|
|
24
|
+
// Don't allow white lines, use red instead.
|
|
25
|
+
lineColor = /#ffffff/i.test(lineColor) ? '#ff0000' : lineColor;
|
|
26
|
+
const style = [
|
|
27
|
+
borderStyle,
|
|
28
|
+
new Style({
|
|
29
|
+
zIndex: 3,
|
|
30
|
+
image: new Circle({
|
|
31
|
+
radius: 4,
|
|
32
|
+
fill: new Fill({
|
|
33
|
+
color: lineColor,
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
stroke: new Stroke({
|
|
37
|
+
color: lineColor,
|
|
38
|
+
width: 4,
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
];
|
|
42
|
+
return style;
|
|
42
43
|
};
|
|
43
44
|
export default fullTrajectorystyle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ol/styles/index.js"],"names":[],"mappings":""}
|
package/ol/styles/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as fullTrajectoryStyle } from
|
|
2
|
-
export { default as fullTrajectoryDelayStyle } from
|
|
1
|
+
export { default as fullTrajectoryStyle } from './fullTrajectoryStyle';
|
|
2
|
+
export { default as fullTrajectoryDelayStyle } from './fullTrajectoryDelayStyle';
|
package/package.json
CHANGED
|
@@ -2,189 +2,137 @@
|
|
|
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": "2.0
|
|
6
|
-
"
|
|
5
|
+
"version": "2.2.0-beta.0",
|
|
6
|
+
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
|
+
"module": "index.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./index.js",
|
|
9
10
|
"./api": "./api/index.js",
|
|
10
11
|
"./mapbox": "./mapbox/index.js",
|
|
11
|
-
"./ol": "./ol/index.js"
|
|
12
|
+
"./ol": "./ol/index.js",
|
|
13
|
+
"./types": "./types/index.d.ts"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
|
-
"@turf/helpers": "
|
|
15
|
-
"@turf/transform-rotate": "
|
|
16
|
+
"@turf/helpers": "6.5.0",
|
|
17
|
+
"@turf/transform-rotate": "6.5.0",
|
|
16
18
|
"lodash.debounce": "4.0.8",
|
|
17
19
|
"lodash.throttle": "4.1.1",
|
|
18
|
-
"
|
|
19
|
-
"query-string": "7.1.0",
|
|
20
|
-
"turf": "^3.0.14",
|
|
21
|
-
"uuid": "8.3.2"
|
|
20
|
+
"uuid": "9.0.0"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
|
-
"mapbox-gl": "
|
|
25
|
-
"maplibre-gl": "
|
|
26
|
-
"ol": "
|
|
23
|
+
"mapbox-gl": "1.13.2",
|
|
24
|
+
"maplibre-gl": "2.4.0",
|
|
25
|
+
"ol": "7.3.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
28
|
+
"@commitlint/cli": "17.6.1",
|
|
29
|
+
"@commitlint/config-conventional": "17.6.1",
|
|
30
|
+
"@types/geojson": "7946.0.10",
|
|
31
|
+
"@types/lodash.debounce": "4.0.7",
|
|
32
|
+
"@types/lodash.throttle": "4.1.7",
|
|
33
|
+
"@types/mapbox-gl": "2.7.10",
|
|
34
|
+
"@types/offscreencanvas": "2019.7.0",
|
|
35
|
+
"@types/topojson": "3.2.3",
|
|
36
|
+
"@types/uuid": "9.0.1",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
38
|
+
"@typescript-eslint/parser": "5.59.0",
|
|
39
|
+
"cypress": "12.10.0",
|
|
40
|
+
"esbuild": "0.17.17",
|
|
41
|
+
"esbuild-jest": "0.5.0",
|
|
41
42
|
"esdoc": "1.1.0",
|
|
42
43
|
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
43
44
|
"esdoc-publish-html-plugin": "1.1.2",
|
|
44
45
|
"esdoc-standard-plugin": "1.0.0",
|
|
45
|
-
"
|
|
46
|
+
"esdoc-typescript-plugin": "1.0.1",
|
|
47
|
+
"eslint": "8.38.0",
|
|
46
48
|
"eslint-config-airbnb": "19.0.4",
|
|
47
|
-
"eslint-config-
|
|
48
|
-
"eslint-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
49
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
50
|
+
"eslint-config-prettier": "8.8.0",
|
|
51
|
+
"eslint-plugin-cypress": "2.13.2",
|
|
52
|
+
"eslint-plugin-import": "2.27.5",
|
|
53
|
+
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
54
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
55
|
+
"eslint-plugin-react": "7.32.2",
|
|
56
|
+
"fixpack": "4.0.0",
|
|
57
|
+
"husky": "8.0.3",
|
|
58
|
+
"is-ci": "3.0.1",
|
|
59
|
+
"jest": "29.5.0",
|
|
60
|
+
"jest-canvas-mock": "2.5.0",
|
|
61
|
+
"jest-environment-jsdom": "29.5.0",
|
|
57
62
|
"jest-fetch-mock": "3.0.3",
|
|
58
63
|
"jest-serializer-html": "7.1.0",
|
|
59
|
-
"jest-transformer-svg": "
|
|
60
|
-
"jest-websocket-mock": "2.
|
|
61
|
-
"lint-staged": "
|
|
64
|
+
"jest-transformer-svg": "2.0.1",
|
|
65
|
+
"jest-websocket-mock": "2.4.0",
|
|
66
|
+
"lint-staged": "13.2.1",
|
|
62
67
|
"mapbox-gl": "1.13.2",
|
|
63
|
-
"maplibre-gl": "2.
|
|
64
|
-
"mock-socket": "9.1
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"sort-json": "2.0.
|
|
68
|
+
"maplibre-gl": "2.4.0",
|
|
69
|
+
"mock-socket": "9.2.1",
|
|
70
|
+
"next": "12.1.6",
|
|
71
|
+
"next-transpile-modules": "10.0.0",
|
|
72
|
+
"ol": "7.3.0",
|
|
73
|
+
"openapi-typescript": "6.2.1",
|
|
74
|
+
"prettier": "2.8.7",
|
|
75
|
+
"raw-loader": "4.0.2",
|
|
76
|
+
"sort-json": "2.0.1",
|
|
72
77
|
"standard-version": "9.5.0",
|
|
73
|
-
"start-server-and-test": "
|
|
74
|
-
"stylelint": "
|
|
75
|
-
"stylelint-config-recommended-scss": "
|
|
76
|
-
"stylelint-config-standard": "
|
|
77
|
-
"stylelint-scss": "4.
|
|
78
|
+
"start-server-and-test": "2.0.0",
|
|
79
|
+
"stylelint": "15.5.0",
|
|
80
|
+
"stylelint-config-recommended-scss": "10.0.0",
|
|
81
|
+
"stylelint-config-standard": "33.0.0",
|
|
82
|
+
"stylelint-scss": "4.6.0",
|
|
83
|
+
"typescript": "5.0.4"
|
|
78
84
|
},
|
|
79
85
|
"scripts": {
|
|
80
86
|
"apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
|
|
81
|
-
"build": "yarn esbuild",
|
|
87
|
+
"build": "yarn build:tsc && yarn esbuild:iife",
|
|
88
|
+
"build:tsc": "rm -rf build && yarn tsc && cp package.json build/ && cp -R src/types build/ && find build -type f -name '*.test.*' -delete",
|
|
82
89
|
"coverage": "yarn test --watchAll=false --coverage --coverageDirectory=coverage",
|
|
83
90
|
"cy:open": "cypress open",
|
|
84
91
|
"cy:test": "start-server-and-test dev http://localhost:3000 'cypress run --browser chrome'",
|
|
85
92
|
"cy:test:chrome": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser chrome'",
|
|
86
93
|
"cy:test:edge": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser edge'",
|
|
87
94
|
"cy:test:firefox": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser firefox'",
|
|
88
|
-
"dev": "yarn doc && yarn dev:examples",
|
|
89
|
-
"dev:examples": "cd doc && yarn dev",
|
|
90
|
-
"doc": "yarn apidoc && cd doc && yarn install --
|
|
91
|
-
"esbuild": "
|
|
92
|
-
"esbuild:all": "esbuild src/index.js src/**/*.js src/**/**/*.js --target=chrome100 --outdir=build/ --loader:.js=jsx",
|
|
95
|
+
"dev": "rm -rf .next && rm -rf doc/.next && yarn doc && yarn dev:examples",
|
|
96
|
+
"dev:examples": "rm -rf .next && rm -rf doc/.next && yarn build && cd build && yarn link && cd ../doc && yarn link mobility-toolbox-js && yarn dev",
|
|
97
|
+
"doc": "yarn build && yarn apidoc && cd doc && rm -rf .next && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn build",
|
|
98
|
+
"esbuild": "yarn esbuild:all && yarn esbuild:iife",
|
|
99
|
+
"esbuild:all": "esbuild src/index.js src/**/*.js src/**/*.ts src/**/**/*.js src/**/**/*.ts --target=chrome100 --outdir=build/ --loader:.js=jsx",
|
|
93
100
|
"esbuild:iife": "yarn esbuild:iife:unminify && yarn esbuild:iife:minify",
|
|
94
101
|
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
95
102
|
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
96
103
|
"esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
|
|
97
|
-
"format": "prettier --write 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix",
|
|
104
|
+
"format": "prettier --write 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
|
|
98
105
|
"lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
|
|
99
106
|
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
100
107
|
"link2": "cmdToAdd=$(node ./scripts/read-pkg-json.js add) && $cmdToAdd && yarn build && cmdToRemove=$(node ./scripts/read-pkg-json.js remove) && $cmdToRemove && cd build && yarn link",
|
|
101
|
-
"lint": "eslint
|
|
108
|
+
"lint": "eslint src/**/*.js src/**/*.ts && stylelint src/**/*.css src/**/*.scss --allow-empty-input",
|
|
109
|
+
"prepare": "is-ci || husky install",
|
|
102
110
|
"publish:beta": "HUSKY=0 yarn release -- --prerelease beta --skip.changelog && git push origin HEAD && yarn run build && cd build && HUSKY=0 yarn publish --tag beta && git push --tags ",
|
|
103
111
|
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
|
|
112
|
+
"publish:public": "yarn release && git push origin HEAD && yarn run build && cd build && HUSKY=0 yarn publish && git push --tags ",
|
|
104
113
|
"publish:public:dryrun": "yarn release --dry-run",
|
|
105
114
|
"release": "standard-version",
|
|
106
115
|
"start": "yarn doc && cd doc && yarn start",
|
|
107
116
|
"start:examples": "cd doc && yarn build && yarn start",
|
|
108
|
-
"test": "TZ='UTC' jest",
|
|
109
|
-
"test:watch": "yarn test --watchAll"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"production": [
|
|
113
|
-
">0.2%",
|
|
114
|
-
"not dead",
|
|
115
|
-
"not op_mini all"
|
|
116
|
-
],
|
|
117
|
-
"development": [
|
|
118
|
-
"last 1 chrome version",
|
|
119
|
-
"last 1 firefox version",
|
|
120
|
-
"last 1 safari version",
|
|
121
|
-
"last 1 ie version"
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
"eslintConfig": {
|
|
125
|
-
"env": {
|
|
126
|
-
"cypress/globals": true,
|
|
127
|
-
"node": true,
|
|
128
|
-
"browser": true,
|
|
129
|
-
"es6": true,
|
|
130
|
-
"jest": true
|
|
131
|
-
},
|
|
132
|
-
"parser": "@babel/eslint-parser",
|
|
133
|
-
"extends": [
|
|
134
|
-
"airbnb",
|
|
135
|
-
"prettier"
|
|
136
|
-
],
|
|
137
|
-
"plugins": [
|
|
138
|
-
"cypress",
|
|
139
|
-
"prettier"
|
|
140
|
-
],
|
|
141
|
-
"rules": {
|
|
142
|
-
"arrow-body-style": 0,
|
|
143
|
-
"react/jsx-filename-extension": [
|
|
144
|
-
1,
|
|
145
|
-
{
|
|
146
|
-
"extensions": [
|
|
147
|
-
".js",
|
|
148
|
-
".jsx"
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"prettier/prettier": "error"
|
|
153
|
-
}
|
|
117
|
+
"test": "TZ='UTC' jest ",
|
|
118
|
+
"test:watch": "yarn test --watchAll",
|
|
119
|
+
"tsc": "tsc",
|
|
120
|
+
"types:backend": "openapi-typescript https://developer.geops.io/swagger/routing.json --output src/types/routing.d.ts && openapi-typescript https://developer.geops.io/swagger/stops.json --output src/types/stops.d.ts"
|
|
154
121
|
},
|
|
122
|
+
"browserslist": [
|
|
123
|
+
">0.2%",
|
|
124
|
+
"not dead",
|
|
125
|
+
"not op_mini all",
|
|
126
|
+
"not ie <= 11",
|
|
127
|
+
"not android < 5"
|
|
128
|
+
],
|
|
155
129
|
"keywords": [
|
|
156
130
|
"mobility",
|
|
157
131
|
"toolbox"
|
|
158
132
|
],
|
|
159
|
-
"lint-staged": {
|
|
160
|
-
"(src|__mocks__)/**/*.js": [
|
|
161
|
-
"eslint --fix",
|
|
162
|
-
"prettier --write",
|
|
163
|
-
"git add",
|
|
164
|
-
"yarn test --bail --findRelatedTests"
|
|
165
|
-
],
|
|
166
|
-
"package.json": [
|
|
167
|
-
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop exports --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
|
|
168
|
-
],
|
|
169
|
-
"src/**/*.{css,scss}": [
|
|
170
|
-
"stylelint --fix --allow-empty-input"
|
|
171
|
-
]
|
|
172
|
-
},
|
|
173
|
-
"prettier": {
|
|
174
|
-
"trailingComma": "all",
|
|
175
|
-
"singleQuote": true
|
|
176
|
-
},
|
|
177
133
|
"repository": {
|
|
178
134
|
"type": "git",
|
|
179
135
|
"url": "https://github.com/geops/mobility-toolbox-js"
|
|
180
136
|
},
|
|
181
|
-
"
|
|
182
|
-
"plugins": [
|
|
183
|
-
"stylelint-scss"
|
|
184
|
-
],
|
|
185
|
-
"extends": [
|
|
186
|
-
"stylelint-config-standard",
|
|
187
|
-
"stylelint-config-recommended-scss"
|
|
188
|
-
]
|
|
189
|
-
}
|
|
137
|
+
"sideEffects": false
|
|
190
138
|
}
|
package/setupTests.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.js"],"names":[],"mappings":""}
|
package/setupTests.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import 'jest-canvas-mock';
|
|
3
|
+
import fetchTrajectoryByIdResponse from '../data/fetchTrajectoryById.json';
|
|
4
|
+
import fetchTrajectoriesResponse from '../data/fetchTrajectories.json';
|
|
5
|
+
import fetchTrajectoryStationsResponse from '../data/fetchTrajectoryStations.json';
|
|
6
|
+
import stopsSearchResponse from '../data/stopsSearch.json';
|
|
7
|
+
import fetchRouteResponse from '../data/fetchRoute.json';
|
|
8
|
+
global.fetchTrajectoryByIdResponse = fetchTrajectoryByIdResponse;
|
|
9
|
+
global.fetchTrajectoriesResponse = fetchTrajectoriesResponse;
|
|
10
|
+
global.fetchTrajectoryStationsResponse = fetchTrajectoryStationsResponse;
|
|
11
|
+
global.stopsSearchResponse = stopsSearchResponse;
|
|
12
|
+
global.fetchRouteResponse = fetchRouteResponse;
|
|
13
|
+
global.URL.createObjectURL = jest.fn(() => 'fooblob');
|
|
14
|
+
window.OffscreenCanvas = () => {
|
|
15
|
+
return document.createElement('canvas');
|
|
16
|
+
};
|
|
17
|
+
/* eslint-disable */
|
|
18
|
+
class ResizeObserver {
|
|
19
|
+
constructor(onResize) {
|
|
20
|
+
ResizeObserver.onResize = onResize;
|
|
21
|
+
}
|
|
22
|
+
observe() { }
|
|
23
|
+
unobserve() { }
|
|
24
|
+
disconnect() { }
|
|
25
|
+
}
|
|
26
|
+
window.ResizeObserver = ResizeObserver;
|