mobility-toolbox-js 2.0.0 → 2.1.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 +279 -0
- package/api/RealtimeAPI.d.ts.map +1 -0
- package/api/RealtimeAPI.js +466 -0
- package/api/RoutingAPI.d.ts +37 -0
- package/api/RoutingAPI.d.ts.map +1 -0
- package/api/RoutingAPI.js +35 -0
- package/api/StopsAPI.d.ts +38 -0
- package/api/StopsAPI.d.ts.map +1 -0
- package/api/StopsAPI.js +36 -0
- 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/{tralis/typedefs.js → typedefs.js} +4 -10
- package/common/api/HttpAPI.d.ts +31 -0
- package/common/api/HttpAPI.d.ts.map +1 -0
- package/common/api/HttpAPI.js +57 -0
- package/common/api/WebSocketAPI.d.ts +153 -0
- package/common/api/WebSocketAPI.d.ts.map +1 -0
- package/common/api/WebSocketAPI.js +341 -0
- 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 -0
- 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 +776 -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/{trackerDelayStyle.js → realtimeDelayStyle.d.ts} +4 -9
- 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 +35 -6
- 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 +21 -23
- 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 +60 -60
- package/common/utils/index.d.ts +17 -0
- package/common/utils/index.d.ts.map +1 -0
- package/common/utils/index.js +13 -2
- 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 +5 -12
- 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 -20
- package/common/utils/timeUtils.d.ts +24 -0
- package/common/utils/timeUtils.d.ts.map +1 -0
- package/common/utils/timeUtils.js +13 -18
- 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 +10 -2
- package/mapbox/controls/CopyrightControl.d.ts +29 -0
- package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
- package/mapbox/controls/CopyrightControl.js +25 -35
- package/mapbox/controls/index.d.ts +2 -0
- package/mapbox/controls/index.d.ts.map +1 -0
- package/mapbox/controls/index.js +2 -0
- package/mapbox/index.d.ts +6 -0
- package/mapbox/index.d.ts.map +1 -0
- package/mapbox/index.js +5 -3
- package/mapbox/layers/Layer.d.ts +59 -0
- package/mapbox/layers/Layer.d.ts.map +1 -0
- package/mapbox/layers/Layer.js +78 -95
- 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 -0
- 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 +60005 -0
- package/mbt.js.map +7 -0
- package/mbt.min.js +1084 -0
- package/mbt.min.js.map +7 -0
- package/ol/controls/CopyrightControl.d.ts +31 -0
- package/ol/controls/CopyrightControl.d.ts.map +1 -0
- package/ol/controls/CopyrightControl.js +44 -56
- package/ol/controls/RoutingControl.d.ts +193 -0
- package/ol/controls/RoutingControl.d.ts.map +1 -0
- package/ol/controls/RoutingControl.js +546 -667
- package/ol/controls/StopFinderControl.d.ts +30 -0
- package/ol/controls/StopFinderControl.d.ts.map +1 -0
- package/ol/controls/StopFinderControl.js +10 -16
- package/ol/controls/index.d.ts +4 -0
- package/ol/controls/index.d.ts.map +1 -0
- package/ol/controls/index.js +3 -0
- package/ol/index.d.ts +6 -0
- package/ol/index.d.ts.map +1 -0
- package/ol/index.js +4 -12
- package/ol/layers/Layer.d.ts +86 -0
- package/ol/layers/Layer.d.ts.map +1 -0
- package/ol/layers/Layer.js +147 -166
- 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 +79 -348
- package/ol/layers/MapboxStyleLayer.d.ts +129 -0
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
- package/ol/layers/MapboxStyleLayer.js +329 -368
- package/ol/layers/MaplibreLayer.d.ts +28 -0
- package/ol/layers/MaplibreLayer.d.ts.map +1 -0
- package/ol/layers/MaplibreLayer.js +13 -259
- 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 +62 -68
- package/ol/layers/VectorLayer.d.ts +25 -0
- package/ol/layers/VectorLayer.d.ts.map +1 -0
- package/ol/layers/VectorLayer.js +27 -32
- package/ol/layers/WMSLayer.d.ts +42 -0
- package/ol/layers/WMSLayer.d.ts.map +1 -0
- package/ol/layers/WMSLayer.js +74 -66
- package/ol/layers/index.d.ts +9 -0
- package/ol/layers/index.d.ts.map +1 -0
- package/ol/layers/index.js +8 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryDelayStyle.js +23 -25
- package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
- package/ol/styles/fullTrajectoryStyle.js +37 -44
- package/ol/styles/index.d.ts +3 -0
- package/ol/styles/index.d.ts.map +1 -0
- package/package.json +98 -177
- 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 +11 -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/routing/RoutingAPI.js +0 -44
- package/api/routing/RoutingAPI.test.js +0 -41
- package/api/stops/StopsAPI.js +0 -41
- package/api/stops/StopsAPI.test.js +0 -34
- package/api/tralis/TralisAPI.js +0 -731
- package/api/tralis/TralisAPI.test.js +0 -75
- package/api/tralis/TralisAPIUtils.js +0 -73
- package/api/tralis/WebSocketConnector.js +0 -338
- package/api/tralis/WebSocketConnector.test.js +0 -356
- package/common/Tracker.js +0 -197
- package/common/api/api.js +0 -64
- package/common/api/api.test.js +0 -68
- package/common/controls/Control.js +0 -146
- package/common/controls/Control.test.js +0 -98
- package/common/layers/Layer.js +0 -404
- package/common/layers/Layer.test.js +0 -585
- package/common/mixins/CopyrightMixin.js +0 -48
- package/common/mixins/SearchMixin.js +0 -176
- package/common/mixins/TralisLayerMixin.js +0 -930
- package/common/styles/trackerDefaultStyle.js +0 -333
- package/common/styles/trackerSimpleStyle.js +0 -22
- package/common/trackerConfig.js +0 -190
- package/common/trackerConfig.test.js +0 -25
- package/common/utils/createTrackerFilters.js +0 -87
- package/common/utils/createTrackerFilters.test.js +0 -95
- package/common/utils/getMapboxMapCopyrights.test.js +0 -47
- package/common/utils/getMapboxStyleUrl.js +0 -32
- package/common/utils/removeDuplicate.test.js +0 -22
- package/common/utils/timeUtils.test.js +0 -16
- package/index.js.map +0 -1
- package/mapbox/layers/Layer.test.js +0 -202
- package/mapbox/layers/TralisLayer.js +0 -329
- package/mapbox/layers/TralisLayer.test.js +0 -40
- package/mapbox/utils.js +0 -46
- package/module.js +0 -23
- package/ol/README.md +0 -0
- package/ol/controls/CopyrightControl.test.js +0 -211
- package/ol/controls/RoutingControl.test.js +0 -216
- package/ol/controls/StopFinderControl.test.js +0 -59
- package/ol/controls/snapshots/RoutingControlRouteGen10.json +0 -58
- package/ol/controls/snapshots/RoutingControlRouteGen100.json +0 -292
- package/ol/controls/snapshots/RoutingControlRouteGen30.json +0 -69
- package/ol/controls/snapshots/RoutingControlRouteGen5.json +0 -58
- package/ol/controls/snapshots/RoutingControlRouteOSM.json +0 -759
- package/ol/controls/snapshots/RoutingControlStation1.json +0 -60
- package/ol/controls/snapshots/RoutingControlStation2.json +0 -49
- package/ol/layers/Layer.test.js +0 -197
- package/ol/layers/MapboxLayer.test.js +0 -186
- package/ol/layers/MapboxStyleLayer.test.js +0 -262
- package/ol/layers/RoutingLayer.test.js +0 -49
- package/ol/layers/TralisLayer.js +0 -359
- package/ol/layers/TralisLayer.test.js +0 -97
- package/ol/layers/VectorLayer.test.js +0 -98
- package/ol/layers/WMSLayer.test.js +0 -84
package/package.json
CHANGED
|
@@ -2,216 +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.
|
|
6
|
-
"
|
|
7
|
-
"module": "
|
|
5
|
+
"version": "2.1.0",
|
|
6
|
+
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
|
+
"module": "index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./api": "./api/index.js",
|
|
11
|
+
"./mapbox": "./mapbox/index.js",
|
|
12
|
+
"./ol": "./ol/index.js",
|
|
13
|
+
"./types": "./types/index.d.ts"
|
|
14
|
+
},
|
|
8
15
|
"dependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
11
|
-
"@material-ui/icons": "4.11.2",
|
|
12
|
-
"@material-ui/styles": "4.11.4",
|
|
13
|
-
"@turf/helpers": "^6.5.0",
|
|
14
|
-
"@turf/transform-rotate": "^6.5.0",
|
|
15
|
-
"codesandbox": "2.2.3",
|
|
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
|
-
"prop-types": "15.8.1",
|
|
20
|
-
"query-string": "7.1.0",
|
|
21
|
-
"react": "18",
|
|
22
|
-
"react-app-polyfill": "^1.0.6",
|
|
23
|
-
"react-dom": "18",
|
|
24
|
-
"react-icons": "4.3.1",
|
|
25
|
-
"react-markdown": "8.0.0",
|
|
26
|
-
"react-router-dom": "6",
|
|
27
|
-
"react-scrollchor": "7.0.1",
|
|
28
|
-
"react-syntax-highlighter": "15.4.5",
|
|
29
|
-
"taffydb": "^2.7.3",
|
|
30
|
-
"turf": "^3.0.14",
|
|
31
|
-
"typeface-lato": "^0.0.75",
|
|
32
|
-
"uuid": "8.3.2"
|
|
20
|
+
"uuid": "9.0.0"
|
|
33
21
|
},
|
|
34
22
|
"peerDependencies": {
|
|
35
|
-
"mapbox-gl": "
|
|
36
|
-
"maplibre-gl": "
|
|
37
|
-
"ol": "
|
|
23
|
+
"mapbox-gl": "1.13.2",
|
|
24
|
+
"maplibre-gl": "2.4.0",
|
|
25
|
+
"ol": "7.3.0"
|
|
38
26
|
},
|
|
39
27
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
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",
|
|
54
42
|
"esdoc": "1.1.0",
|
|
55
43
|
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
56
44
|
"esdoc-publish-html-plugin": "1.1.2",
|
|
57
45
|
"esdoc-standard-plugin": "1.0.0",
|
|
58
|
-
"
|
|
46
|
+
"esdoc-typescript-plugin": "1.0.1",
|
|
47
|
+
"eslint": "8.38.0",
|
|
59
48
|
"eslint-config-airbnb": "19.0.4",
|
|
60
|
-
"eslint-config-
|
|
61
|
-
"eslint-
|
|
62
|
-
"eslint-plugin-cypress": "2.
|
|
63
|
-
"eslint-plugin-import": "2.
|
|
64
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
65
|
-
"eslint-plugin-prettier": "4.
|
|
66
|
-
"eslint-plugin-react": "7.
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"jest": "
|
|
71
|
-
"jest-canvas-mock": "2.
|
|
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",
|
|
72
62
|
"jest-fetch-mock": "3.0.3",
|
|
73
63
|
"jest-serializer-html": "7.1.0",
|
|
74
|
-
"jest-
|
|
75
|
-
"
|
|
64
|
+
"jest-transformer-svg": "2.0.1",
|
|
65
|
+
"jest-websocket-mock": "2.4.0",
|
|
66
|
+
"lint-staged": "13.2.1",
|
|
76
67
|
"mapbox-gl": "1.13.2",
|
|
77
|
-
"maplibre-gl": "2.
|
|
78
|
-
"mock-socket": "9.1
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"prettier": "2.
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"sort-json": "2.0.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",
|
|
87
77
|
"standard-version": "9.5.0",
|
|
88
|
-
"start-server-and-test": "
|
|
89
|
-
"stylelint": "
|
|
90
|
-
"stylelint-config-recommended-scss": "
|
|
91
|
-
"stylelint-config-standard": "
|
|
92
|
-
"stylelint-scss": "4.
|
|
93
|
-
"
|
|
94
|
-
"webpack-cli": "3.3.11",
|
|
95
|
-
"webpack-dev-server": "3.11.0",
|
|
96
|
-
"worker-loader": "3.0.8"
|
|
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"
|
|
97
84
|
},
|
|
98
85
|
"scripts": {
|
|
99
|
-
"apidoc": "esdoc",
|
|
100
|
-
"build": "yarn
|
|
86
|
+
"apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
|
|
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",
|
|
101
89
|
"coverage": "yarn test --watchAll=false --coverage --coverageDirectory=coverage",
|
|
102
90
|
"cy:open": "cypress open",
|
|
103
|
-
"cy:
|
|
104
|
-
"cy:test": "start-server-and-test start http://localhost:
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
91
|
+
"cy:test": "start-server-and-test dev http://localhost:3000 'cypress run --browser chrome'",
|
|
92
|
+
"cy:test:chrome": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser chrome'",
|
|
93
|
+
"cy:test:edge": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser edge'",
|
|
94
|
+
"cy:test:firefox": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser firefox'",
|
|
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",
|
|
100
|
+
"esbuild:iife": "yarn esbuild:iife:unminify && yarn esbuild:iife:minify",
|
|
101
|
+
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
102
|
+
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
103
|
+
"esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
|
|
104
|
+
"format": "prettier --write 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
|
|
108
105
|
"lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
|
|
109
106
|
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
110
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",
|
|
111
|
-
"lint": "eslint
|
|
112
|
-
"
|
|
108
|
+
"lint": "eslint src/**/*.js src/**/*.ts && stylelint src/**/*.css src/**/*.scss --allow-empty-input",
|
|
109
|
+
"prepare": "is-ci || husky install",
|
|
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 ",
|
|
113
111
|
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
|
|
114
|
-
"publish:public": "yarn release && git push origin HEAD && yarn run build && cd build && git push --tags
|
|
112
|
+
"publish:public": "yarn release --skip.changelog && git push origin HEAD && yarn run build && cd build && HUSKY=0 yarn publish && git push --tags ",
|
|
115
113
|
"publish:public:dryrun": "yarn release --dry-run",
|
|
116
114
|
"release": "standard-version",
|
|
117
|
-
"start": "yarn doc &&
|
|
118
|
-
"start:examples": "
|
|
119
|
-
"test": "
|
|
120
|
-
"test:watch": "yarn test --watchAll"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"production": [
|
|
124
|
-
">0.2%",
|
|
125
|
-
"not dead",
|
|
126
|
-
"not op_mini all"
|
|
127
|
-
],
|
|
128
|
-
"development": [
|
|
129
|
-
"last 1 chrome version",
|
|
130
|
-
"last 1 firefox version",
|
|
131
|
-
"last 1 safari version",
|
|
132
|
-
"last 1 ie version"
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
|
-
"eslintConfig": {
|
|
136
|
-
"env": {
|
|
137
|
-
"cypress/globals": true,
|
|
138
|
-
"node": true,
|
|
139
|
-
"browser": true,
|
|
140
|
-
"es6": true,
|
|
141
|
-
"jest": true
|
|
142
|
-
},
|
|
143
|
-
"parser": "@babel/eslint-parser",
|
|
144
|
-
"extends": [
|
|
145
|
-
"airbnb",
|
|
146
|
-
"airbnb/hooks",
|
|
147
|
-
"prettier"
|
|
148
|
-
],
|
|
149
|
-
"plugins": [
|
|
150
|
-
"cypress",
|
|
151
|
-
"prettier"
|
|
152
|
-
],
|
|
153
|
-
"rules": {
|
|
154
|
-
"arrow-body-style": 0,
|
|
155
|
-
"react/jsx-filename-extension": [
|
|
156
|
-
1,
|
|
157
|
-
{
|
|
158
|
-
"extensions": [
|
|
159
|
-
".js",
|
|
160
|
-
".jsx"
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"prettier/prettier": "error"
|
|
165
|
-
},
|
|
166
|
-
"settings": {
|
|
167
|
-
"import/resolver": "webpack",
|
|
168
|
-
"react": {
|
|
169
|
-
"version": "detect"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
"exports": {
|
|
174
|
-
".": "./index.js",
|
|
175
|
-
"./module": "./module.js",
|
|
176
|
-
"./api": "./api/index.js",
|
|
177
|
-
"./common/trackerConfig": "./common/trackerConfig.js",
|
|
178
|
-
"./utils": "./common/utils/index.js",
|
|
179
|
-
"./mapbox": "./mapbox/index.js",
|
|
180
|
-
"./ol": "./ol/index.js"
|
|
115
|
+
"start": "yarn doc && cd doc && yarn start",
|
|
116
|
+
"start:examples": "cd doc && yarn build && yarn start",
|
|
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"
|
|
181
121
|
},
|
|
122
|
+
"browserslist": [
|
|
123
|
+
">0.2%",
|
|
124
|
+
"not dead",
|
|
125
|
+
"not op_mini all",
|
|
126
|
+
"not ie <= 11",
|
|
127
|
+
"not android < 5"
|
|
128
|
+
],
|
|
182
129
|
"keywords": [
|
|
183
130
|
"mobility",
|
|
184
131
|
"toolbox"
|
|
185
132
|
],
|
|
186
|
-
"lint-staged": {
|
|
187
|
-
"(src|__mocks__)/**/*.js": [
|
|
188
|
-
"eslint --fix",
|
|
189
|
-
"prettier --write",
|
|
190
|
-
"git add",
|
|
191
|
-
"yarn test --bail --findRelatedTests"
|
|
192
|
-
],
|
|
193
|
-
"package.json": [
|
|
194
|
-
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
|
|
195
|
-
],
|
|
196
|
-
"src/**/*.{css,scss}": [
|
|
197
|
-
"stylelint --fix"
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
"prettier": {
|
|
201
|
-
"trailingComma": "all",
|
|
202
|
-
"singleQuote": true
|
|
203
|
-
},
|
|
204
133
|
"repository": {
|
|
205
134
|
"type": "git",
|
|
206
135
|
"url": "https://github.com/geops/mobility-toolbox-js"
|
|
207
136
|
},
|
|
208
|
-
"
|
|
209
|
-
"plugins": [
|
|
210
|
-
"stylelint-scss"
|
|
211
|
-
],
|
|
212
|
-
"extends": [
|
|
213
|
-
"stylelint-config-standard",
|
|
214
|
-
"stylelint-config-recommended-scss"
|
|
215
|
-
]
|
|
216
|
-
}
|
|
137
|
+
"sideEffects": false
|
|
217
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;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Feature } from 'ol';
|
|
2
|
+
import { Coordinate } from 'ol/coordinate';
|
|
3
|
+
import { ObjectEvent } from 'ol/Object';
|
|
4
|
+
import { Pixel } from 'ol/pixel';
|
|
5
|
+
import type { RealtimeMot, RealtimeTrainId } from './realtime';
|
|
6
|
+
import type {
|
|
7
|
+
CopyrightControl as MbCopyrightControl,
|
|
8
|
+
RealtimeLayer as MbRealtimeLayer,
|
|
9
|
+
layer as MbLayer,
|
|
10
|
+
} from '../mapbox';
|
|
11
|
+
import type {
|
|
12
|
+
CopyrightControl as OlCopyrightControl,
|
|
13
|
+
MapboxLayer,
|
|
14
|
+
MaplibreLayer,
|
|
15
|
+
RealtimeLayer as OlRealtimeLayer,
|
|
16
|
+
layer as OlLayer,
|
|
17
|
+
} from '../ol';
|
|
18
|
+
import { RealtimeTrajectory } from '../api/typedefs';
|
|
19
|
+
import CommonLayer, { LayerCommonOptions } from '../common/layers/LayerCommon';
|
|
20
|
+
import type { RoutingParameters } from '.';
|
|
21
|
+
|
|
22
|
+
export type StyleCache = { [key: string]: AnyCanvas };
|
|
23
|
+
|
|
24
|
+
export type ViewState = {
|
|
25
|
+
time?: number;
|
|
26
|
+
center?: number[];
|
|
27
|
+
extent?: number[];
|
|
28
|
+
size?: number[];
|
|
29
|
+
rotation?: number;
|
|
30
|
+
resolution?: number;
|
|
31
|
+
zoom?: number;
|
|
32
|
+
pixelRatio?: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type RealtimeStyleOptions = {
|
|
36
|
+
hoverVehicleId?: RealtimeTrainId;
|
|
37
|
+
selectedVehicleId?: RealtimeTrainId;
|
|
38
|
+
useDelayStyle?: boolean;
|
|
39
|
+
delayOutlineColor?: string;
|
|
40
|
+
delayDisplay?: number;
|
|
41
|
+
noInterpolate?: boolean;
|
|
42
|
+
filter?: FilterFunction;
|
|
43
|
+
getRadius?: (type: RealtimeMot, z: number) => number;
|
|
44
|
+
getBgColor?: (type: RealtimeMot) => string;
|
|
45
|
+
getDelayColor?: (
|
|
46
|
+
delay: number | null,
|
|
47
|
+
cancelled?: boolean,
|
|
48
|
+
isDelayText?: boolean,
|
|
49
|
+
) => string;
|
|
50
|
+
getDelayText?: (delay: number | null, cancelled?: boolean) => string;
|
|
51
|
+
getTextColor?: (type: RealtimeMot) => string;
|
|
52
|
+
getTextSize?: (
|
|
53
|
+
ctx: AnyCanvasContext,
|
|
54
|
+
markerSize: number,
|
|
55
|
+
name: string,
|
|
56
|
+
fontSize: number,
|
|
57
|
+
) => number;
|
|
58
|
+
getMaxRadiusForText?: () => number;
|
|
59
|
+
getMaxRadiusForStrokeAndDelay?: () => number;
|
|
60
|
+
getScreenPixel?: (pixel: Pixel, viewState: ViewState) => Pixel;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type RealtimeTrajectories = {
|
|
64
|
+
[key: RealtimeTrainId]: RealtimeTrajectory;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type RealtimeStyleFunction = (
|
|
68
|
+
trajectory: RealtimeTrajectory,
|
|
69
|
+
viewState: ViewState,
|
|
70
|
+
options: RealtimeStyleOptions,
|
|
71
|
+
) => AnyCanvas | null;
|
|
72
|
+
|
|
73
|
+
export type RealtimeRenderState = {
|
|
74
|
+
center?: Coordinate;
|
|
75
|
+
zoom?: number;
|
|
76
|
+
rotation?: number;
|
|
77
|
+
renderedTrajectories?: RealtimeTrajectory[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type AnyMap = OlMap | MaplibreMap | MapboxMap;
|
|
81
|
+
export type AnyLayer = OlLayer | MbLayer;
|
|
82
|
+
export type AnyOlLayer = OlLayer;
|
|
83
|
+
export type AnyMapboxLayer = MapboxLayer | MaplibreLayer;
|
|
84
|
+
export type AnyRealtimeLayer = MbRealtimeLayer | OlRealtimeLayer;
|
|
85
|
+
export type AnyCopyrightControl = MbCopyrightControl | OlCopyrightControl;
|
|
86
|
+
export type AnyMapboxMap = mapboxgl.Map | maplibregl.Map;
|
|
87
|
+
export type AnyCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
88
|
+
export type AnyCanvasContext =
|
|
89
|
+
| CanvasRenderingContext2D
|
|
90
|
+
| OffscreenCanvasRenderingContext2D;
|
|
91
|
+
export type GConstructor<T extends CommonLayer> = new (options?: any) => T;
|
|
92
|
+
export type CommonLayerClass = GConstructor<CommonLayer>;
|
|
93
|
+
export type GConstructor2<T extends OlLayer> = new (options?: any) => T;
|
|
94
|
+
export type OlLayerClass = GConstructor<AnyOlLayer>;
|
|
95
|
+
export type AnyLayerClass = GConstructor<AnyLayer>;
|
|
96
|
+
|
|
97
|
+
export type AnyMapboxLayerClass = GConstructor<AnyMapboxLayer>;
|
|
98
|
+
export type AnyRealtimeLayerClass = GConstructor<AnyRealtimeLayer>;
|
|
99
|
+
export type AnyMapboxMapClass = GConstructor<AnyMapboxMap>;
|
|
100
|
+
export type AnyCopyrightControlClass = GConstructor<AnyCopyrightControl>;
|
|
101
|
+
|
|
102
|
+
export type LayerGetFeatureInfoResponse = {
|
|
103
|
+
layer: Layer;
|
|
104
|
+
features: Feature[];
|
|
105
|
+
coordinate: Coordinate;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type LayerGetFeatureInfoOptions = {
|
|
109
|
+
resolution: number;
|
|
110
|
+
nb?: number;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type UserInteractionCallback = (
|
|
114
|
+
features: Feature[],
|
|
115
|
+
layer: LayerCommonOptions,
|
|
116
|
+
coordinate: Coordinate,
|
|
117
|
+
event: ObjectEvent,
|
|
118
|
+
) => void;
|
|
119
|
+
|
|
120
|
+
export type RoutingGraph = [RoutingParameters.graph, number, number];
|
|
121
|
+
export type RoutingMot = RoutingParameters.mot;
|
|
122
|
+
export type RoutingViaPoint = string | Coordinate;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Paths as Routing } from './routing';
|
|
2
|
+
import { Paths as Stops } from './stops';
|
|
3
|
+
|
|
4
|
+
export * from './realtime';
|
|
5
|
+
export * from './common';
|
|
6
|
+
|
|
7
|
+
export type RoutingParameters = Routing['/']['get']['parameters']['query'];
|
|
8
|
+
export type RoutingResponse = Routing['/']['get']['responses']['200']['schema'];
|
|
9
|
+
|
|
10
|
+
export type StopsParameters = Stops['/']['get']['parameters']['query'];
|
|
11
|
+
export type StopsResponse = Stops['/']['get']['responses']['200']['schema'];
|