mobility-toolbox-js 2.0.0-beta.3 → 2.0.0-beta.9

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 (248) hide show
  1. package/.babelrc +6 -0
  2. package/.esdoc.json +17 -0
  3. package/.eslintignore +1 -0
  4. package/.github/workflows/conventional-pr-title.yml +21 -0
  5. package/.github/workflows/cypress.yml +29 -0
  6. package/.github/workflows/nodejs.yml +28 -0
  7. package/.husky/commit-msg +4 -0
  8. package/.husky/post-checkout +4 -0
  9. package/.husky/post-merge +4 -0
  10. package/.husky/post-rebase +4 -0
  11. package/.husky/pre-commit +4 -0
  12. package/.neutrinorc.js +176 -0
  13. package/.nvmrc +1 -0
  14. package/CHANGELOG.md +10 -0
  15. package/LICENSE +21 -0
  16. package/README.md +4 -1
  17. package/__mocks__/mapbox-gl.js +81 -0
  18. package/__mocks__/maplibre-gl.js +81 -0
  19. package/commitlint.config.js +1 -0
  20. package/cypress/fixtures/example.json +5 -0
  21. package/cypress/integration/examples/api.spec.js +7 -0
  22. package/cypress/integration/examples/examples.spec.js +7 -0
  23. package/cypress/integration/examples/navigation.spec.js +29 -0
  24. package/cypress/plugins/index.js +21 -0
  25. package/cypress/support/commands.js +25 -0
  26. package/cypress/support/index.js +20 -0
  27. package/cypress.json +4 -0
  28. package/data/fetchRoute.json +292 -0
  29. package/data/fetchTrajectories.json +18 -0
  30. package/data/fetchTrajectoryById.json +3 -0
  31. package/data/fetchTrajectoryStations.json +18 -0
  32. package/data/stopsSearch.json +15 -0
  33. package/documentation.yml +4 -0
  34. package/esdoc/README.md +27 -0
  35. package/esdoc/plugins/MyPlugin.js +69 -0
  36. package/esdoc/plugins/dynamic-property-plugin/Plugin.js +50 -0
  37. package/esdoc/plugins/externals-plugin/Plugin.js +45 -0
  38. package/esdoc/plugins/externals-plugin/externals.js +96 -0
  39. package/global-setup.js +3 -0
  40. package/{ol/README.md → index.html} +0 -0
  41. package/indexweb.html +49 -0
  42. package/jest.config.js +5 -0
  43. package/package.json +29 -9
  44. package/pull_request_template.md +17 -0
  45. package/renovate.json +4 -0
  46. package/scripts/read-pkg-json.js +22 -0
  47. package/{api → src/api}/index.js +0 -0
  48. package/{api → src/api}/routing/RoutingAPI.js +0 -0
  49. package/{api → src/api}/routing/RoutingAPI.test.js +0 -0
  50. package/{api → src/api}/stops/StopsAPI.js +0 -0
  51. package/{api → src/api}/stops/StopsAPI.test.js +0 -0
  52. package/{api → src/api}/tralis/TralisAPI.js +0 -0
  53. package/{api → src/api}/tralis/TralisAPI.test.js +0 -0
  54. package/{api → src/api}/tralis/TralisAPIUtils.js +0 -0
  55. package/{api → src/api}/tralis/WebSocketConnector.js +0 -0
  56. package/{api → src/api}/tralis/WebSocketConnector.test.js +0 -0
  57. package/{api → src/api}/tralis/typedefs.js +0 -0
  58. package/src/assets/Lato-Black.ttf +0 -0
  59. package/src/assets/Lato-BlackItalic.ttf +0 -0
  60. package/src/assets/Lato-Bold.ttf +0 -0
  61. package/src/assets/Lato-BoldItalic.ttf +0 -0
  62. package/src/assets/Lato-Italic.ttf +0 -0
  63. package/src/assets/Lato-Light.ttf +0 -0
  64. package/src/assets/Lato-LightItalic.ttf +0 -0
  65. package/src/assets/Lato-Regular.ttf +0 -0
  66. package/src/assets/Lato-Thin.ttf +0 -0
  67. package/src/assets/Lato-ThinItalic.ttf +0 -0
  68. package/src/assets/OFL.txt +93 -0
  69. package/{common → src/common}/Tracker.js +0 -0
  70. package/{common → src/common}/api/api.js +0 -0
  71. package/{common → src/common}/api/api.test.js +0 -0
  72. package/{common → src/common}/controls/Control.js +0 -0
  73. package/{common → src/common}/controls/Control.test.js +0 -0
  74. package/src/common/index.js +5 -0
  75. package/{common → src/common}/layers/Layer.js +0 -0
  76. package/{common → src/common}/layers/Layer.test.js +0 -0
  77. package/{common → src/common}/mixins/CopyrightMixin.js +0 -0
  78. package/{common → src/common}/mixins/SearchMixin.js +0 -0
  79. package/{common → src/common}/mixins/TralisLayerMixin.js +0 -0
  80. package/{common → src/common}/styles/index.js +1 -1
  81. package/{common → src/common}/styles/trackerDefaultStyle.js +8 -8
  82. package/{common → src/common}/styles/trackerDelayStyle.js +0 -0
  83. package/{common → src/common}/styles/trackerSimpleStyle.js +0 -0
  84. package/{common → src/common}/trackerConfig.js +0 -0
  85. package/{common → src/common}/trackerConfig.test.js +0 -0
  86. package/{common → src/common}/typedefs.js +0 -0
  87. package/{common → src/common}/utils/createTrackerFilters.js +0 -0
  88. package/{common → src/common}/utils/createTrackerFilters.test.js +0 -0
  89. package/{common → src/common}/utils/getMapboxMapCopyrights.js +0 -0
  90. package/{common → src/common}/utils/getMapboxMapCopyrights.test.js +0 -0
  91. package/{common → src/common}/utils/getMapboxStyleUrl.js +0 -0
  92. package/{common → src/common}/utils/getVehiclePosition.js +0 -0
  93. package/{common → src/common}/utils/index.js +0 -1
  94. package/{common → src/common}/utils/removeDuplicate.js +0 -0
  95. package/{common → src/common}/utils/removeDuplicate.test.js +0 -0
  96. package/{common → src/common}/utils/sortByDelay.js +0 -0
  97. package/{common → src/common}/utils/timeUtils.js +0 -0
  98. package/{common → src/common}/utils/timeUtils.test.js +0 -0
  99. package/src/doc/App.js +116 -0
  100. package/src/doc/App.scss +51 -0
  101. package/src/doc/_redirects +2 -0
  102. package/src/doc/components/CodeSandboxButton.js +103 -0
  103. package/src/doc/components/Documentation.js +40 -0
  104. package/src/doc/components/Esdoc/Anchor.js +57 -0
  105. package/src/doc/components/Esdoc/ClassDoc.js +272 -0
  106. package/src/doc/components/Esdoc/DeprecatedHTML.js +16 -0
  107. package/src/doc/components/Esdoc/DetailDocs.js +281 -0
  108. package/src/doc/components/Esdoc/DetailHTML.js +33 -0
  109. package/src/doc/components/Esdoc/DirectSubclassHTML.js +30 -0
  110. package/src/doc/components/Esdoc/DocBuilderUtils.js +694 -0
  111. package/src/doc/components/Esdoc/DocLinkHTML.js +62 -0
  112. package/src/doc/components/Esdoc/DocsLinkHTML.js +38 -0
  113. package/src/doc/components/Esdoc/Esdoc.js +63 -0
  114. package/src/doc/components/Esdoc/EsdocContent.js +51 -0
  115. package/src/doc/components/Esdoc/EsdocNavigation.js +13 -0
  116. package/src/doc/components/Esdoc/EsdocSearch.js +81 -0
  117. package/src/doc/components/Esdoc/ExperimentalHTML.js +17 -0
  118. package/src/doc/components/Esdoc/ExtendsChainHTML.js +32 -0
  119. package/src/doc/components/Esdoc/FileDocLinkHTML.js +60 -0
  120. package/src/doc/components/Esdoc/IdentifiersDoc.js +113 -0
  121. package/src/doc/components/Esdoc/IndirectSubclassHTML.js +30 -0
  122. package/src/doc/components/Esdoc/InheritedSummaryDoc.js +70 -0
  123. package/src/doc/components/Esdoc/InheritedSummaryHTML.js +38 -0
  124. package/src/doc/components/Esdoc/MixinClassesHTML.js +29 -0
  125. package/src/doc/components/Esdoc/NavDoc.js +112 -0
  126. package/src/doc/components/Esdoc/OverrideMethod.js +44 -0
  127. package/src/doc/components/Esdoc/OverrideMethodDescription.js +35 -0
  128. package/src/doc/components/Esdoc/Properties.js +89 -0
  129. package/src/doc/components/Esdoc/README.md +45 -0
  130. package/src/doc/components/Esdoc/SignatureHTML.js +123 -0
  131. package/src/doc/components/Esdoc/SingleDoc.js +31 -0
  132. package/src/doc/components/Esdoc/SummaryDoc.js +160 -0
  133. package/src/doc/components/Esdoc/SummaryHTML.js +96 -0
  134. package/src/doc/components/Esdoc/TypeDocLinkHTML.js +249 -0
  135. package/src/doc/components/Esdoc/css/identifiers.css +38 -0
  136. package/src/doc/components/Esdoc/css/search.css +76 -0
  137. package/src/doc/components/Esdoc/css/style.css +603 -0
  138. package/src/doc/components/Esdoc/index.js +7 -0
  139. package/src/doc/components/Example.js +153 -0
  140. package/src/doc/components/Examples.js +183 -0
  141. package/src/doc/components/Home.js +106 -0
  142. package/src/doc/components/TrackerExample.js +38 -0
  143. package/src/doc/examples/assets/tralis-live-map/index.js +11 -0
  144. package/src/doc/examples/assets/tralis-live-map/s1kreis.svg +105 -0
  145. package/src/doc/examples/assets/tralis-live-map/s20kreis.svg +101 -0
  146. package/src/doc/examples/assets/tralis-live-map/s2kreis.svg +95 -0
  147. package/src/doc/examples/assets/tralis-live-map/s3kreis.svg +95 -0
  148. package/src/doc/examples/assets/tralis-live-map/s4kreis.svg +95 -0
  149. package/src/doc/examples/assets/tralis-live-map/s6kreis.svg +95 -0
  150. package/src/doc/examples/assets/tralis-live-map/s7kreis.svg +95 -0
  151. package/src/doc/examples/assets/tralis-live-map/s8kreis.svg +93 -0
  152. package/src/doc/examples/assets/tralis-live-map/unknown.svg +107 -0
  153. package/src/doc/examples/mb-copyright.html +26 -0
  154. package/src/doc/examples/mb-copyright.js +37 -0
  155. package/src/doc/examples/mb-tracker.html +1 -0
  156. package/src/doc/examples/mb-tracker.js +39 -0
  157. package/src/doc/examples/mb-tracker.md +1 -0
  158. package/src/doc/examples/mb-tralis.html +1 -0
  159. package/src/doc/examples/mb-tralis.js +34 -0
  160. package/src/doc/examples/ol-copyright.html +26 -0
  161. package/src/doc/examples/ol-copyright.js +43 -0
  162. package/src/doc/examples/ol-mapbox-layer.html +1 -0
  163. package/src/doc/examples/ol-mapbox-layer.js +28 -0
  164. package/src/doc/examples/ol-mapbox-layer.md +0 -0
  165. package/src/doc/examples/ol-mapbox-style-layer.html +12 -0
  166. package/src/doc/examples/ol-mapbox-style-layer.js +44 -0
  167. package/src/doc/examples/ol-query.html +32 -0
  168. package/src/doc/examples/ol-query.js +83 -0
  169. package/src/doc/examples/ol-routing.html +26 -0
  170. package/src/doc/examples/ol-routing.js +59 -0
  171. package/src/doc/examples/ol-routing.md +1 -0
  172. package/src/doc/examples/ol-stop-finder.html +15 -0
  173. package/src/doc/examples/ol-stop-finder.js +31 -0
  174. package/src/doc/examples/ol-stop-finder.md +1 -0
  175. package/src/doc/examples/ol-tracker.html +1 -0
  176. package/src/doc/examples/ol-tracker.js +44 -0
  177. package/src/doc/examples/ol-tracker.md +1 -0
  178. package/src/doc/examples/ol-tralis.html +5 -0
  179. package/src/doc/examples/ol-tralis.js +57 -0
  180. package/src/doc/examples/tralis-live-map.html +1 -0
  181. package/src/doc/examples/tralis-live-map.js +51 -0
  182. package/src/doc/examples/tralis-live-map.md +3 -0
  183. package/src/doc/examples.js +107 -0
  184. package/src/doc/img/examples/live_tracker_mb.jpg +0 -0
  185. package/src/doc/img/examples/live_tracker_munich.jpg +0 -0
  186. package/src/doc/img/examples/live_tracker_ol.jpg +0 -0
  187. package/src/doc/img/examples/mapbox.jpg +0 -0
  188. package/src/doc/img/examples/mapbox_style.jpg +0 -0
  189. package/src/doc/img/examples/ol-copyright.png +0 -0
  190. package/src/doc/img/examples/query_objects.jpg +0 -0
  191. package/src/doc/img/examples/routing.jpg +0 -0
  192. package/src/doc/img/examples/simple_map.jpg +0 -0
  193. package/src/doc/img/examples/stops.jpg +0 -0
  194. package/src/doc/img/favico.ico +0 -0
  195. package/src/doc/index.js +21 -0
  196. package/src/iife.js +7 -0
  197. package/src/index.js +10 -0
  198. package/{mapbox → src/mapbox}/controls/CopyrightControl.js +0 -0
  199. package/src/mapbox/controls/index.js +2 -0
  200. package/src/mapbox/index.js +4 -0
  201. package/{mapbox → src/mapbox}/layers/Layer.js +0 -0
  202. package/{mapbox → src/mapbox}/layers/Layer.test.js +0 -0
  203. package/{mapbox → src/mapbox}/layers/TralisLayer.js +0 -0
  204. package/{mapbox → src/mapbox}/layers/TralisLayer.test.js +0 -0
  205. package/src/mapbox/layers/index.js +2 -0
  206. package/{mapbox → src/mapbox}/utils.js +0 -0
  207. package/src/ol/README.md +0 -0
  208. package/{ol → src/ol}/controls/CopyrightControl.js +0 -0
  209. package/{ol → src/ol}/controls/CopyrightControl.test.js +0 -0
  210. package/{ol → src/ol}/controls/RoutingControl.js +0 -0
  211. package/{ol → src/ol}/controls/RoutingControl.test.js +0 -0
  212. package/{ol → src/ol}/controls/StopFinderControl.js +0 -0
  213. package/{ol → src/ol}/controls/StopFinderControl.test.js +0 -0
  214. package/src/ol/controls/index.js +3 -0
  215. package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen10.json +0 -0
  216. package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen100.json +0 -0
  217. package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen30.json +0 -0
  218. package/{ol → src/ol}/controls/snapshots/RoutingControlRouteGen5.json +0 -0
  219. package/{ol → src/ol}/controls/snapshots/RoutingControlRouteOSM.json +0 -0
  220. package/{ol → src/ol}/controls/snapshots/RoutingControlStation1.json +0 -0
  221. package/{ol → src/ol}/controls/snapshots/RoutingControlStation2.json +0 -0
  222. package/src/ol/index.js +5 -0
  223. package/{ol → src/ol}/layers/Layer.js +0 -0
  224. package/{ol → src/ol}/layers/Layer.test.js +0 -0
  225. package/{ol → src/ol}/layers/MapboxLayer.js +0 -0
  226. package/{ol → src/ol}/layers/MapboxLayer.test.js +0 -0
  227. package/{ol → src/ol}/layers/MapboxStyleLayer.js +0 -0
  228. package/{ol → src/ol}/layers/MapboxStyleLayer.test.js +0 -0
  229. package/{ol → src/ol}/layers/MaplibreLayer.js +0 -0
  230. package/{ol → src/ol}/layers/RoutingLayer.js +0 -0
  231. package/{ol → src/ol}/layers/RoutingLayer.test.js +0 -0
  232. package/{ol → src/ol}/layers/TralisLayer.js +0 -0
  233. package/{ol → src/ol}/layers/TralisLayer.test.js +0 -0
  234. package/{ol → src/ol}/layers/VectorLayer.js +0 -0
  235. package/{ol → src/ol}/layers/VectorLayer.test.js +0 -0
  236. package/{ol → src/ol}/layers/WMSLayer.js +0 -0
  237. package/{ol → src/ol}/layers/WMSLayer.test.js +0 -0
  238. package/src/ol/layers/index.js +8 -0
  239. package/{ol → src/ol}/styles/fullTrajectoryDelayStyle.js +0 -0
  240. package/{ol → src/ol}/styles/fullTrajectoryStyle.js +0 -0
  241. package/{ol → src/ol}/styles/index.js +0 -0
  242. package/src/setupTests.js +15 -0
  243. package/webpack.config.js +6 -0
  244. package/index.js +0 -2
  245. package/index.js.map +0 -1
  246. package/mapbox/index.js +0 -3
  247. package/module.js +0 -23
  248. package/ol/index.js +0 -13
package/.babelrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ "@babel/preset-react"
5
+ ]
6
+ }
package/.esdoc.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "source": "./src",
3
+ "destination": "./apidoc",
4
+ "includes": ["\\.js$"],
5
+ "excludes": ["\\.test\\.js$", "doc/", "(u|U)tils"],
6
+ "plugins": [
7
+ {
8
+ "name": "esdoc-standard-plugin"
9
+ },
10
+ { "name": "esdoc-ecmascript-proposal-plugin", "option": { "all": true } },
11
+ {
12
+ "name": "esdoc-publish-html-plugin"
13
+ },
14
+ { "name": "./esdoc/plugins/dynamic-property-plugin/Plugin.js" },
15
+ { "name": "./esdoc/plugins/externals-plugin/Plugin.js" }
16
+ ]
17
+ }
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ build/*
@@ -0,0 +1,21 @@
1
+ name: Check PR title
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - opened
6
+ - reopened
7
+ - edited
8
+ - synchronize
9
+
10
+ jobs:
11
+ lint:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: aslafy-z/conventional-pr-title-action@v2.2.0
15
+ with:
16
+ success-state: Title follows the specification.
17
+ failure-state: Title does not follow the specification.
18
+ context-name: conventional-pr-title
19
+ preset: conventional-changelog-angular@latest
20
+ env:
21
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,29 @@
1
+ name: Cypress
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v1
10
+
11
+ - uses: actions/setup-node@v1
12
+ with:
13
+ node-version: '14.x'
14
+
15
+ - name: Get yarn cache
16
+ id: yarn-cache
17
+ run: echo "::set-output name=dir::$(yarn cache dir)"
18
+
19
+ - uses: actions/cache@v1
20
+ with:
21
+ path: ${{ steps.yarn-cache.outputs.dir }}
22
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
23
+ restore-keys: |
24
+ ${{ runner.os }}-yarn-
25
+ - name: Install dependencies
26
+ run: yarn install --frozen-lockfile
27
+
28
+ - name: Run and record Cypress tests
29
+ run: yarn run cy:test
@@ -0,0 +1,28 @@
1
+ name: Build
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ node-version: [14.x]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v1
15
+ - name: Use Node.js ${{ matrix.node-version }}
16
+ uses: actions/setup-node@v1
17
+ with:
18
+ node-version: ${{ matrix.node-version }}
19
+ - name: yarn install, build, and test
20
+ run: |
21
+ echo '[]' > src/doc/components/Esdoc/index.json
22
+ npm install -g yarn
23
+ yarn install
24
+ yarn lint
25
+ yarn test
26
+ yarn build
27
+ env:
28
+ CI: true
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ yarn commitlint --edit $1
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn install --frozen-lockfile
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn install --frozen-lockfile
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn install --frozen-lockfile
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ CI=true npx lint-staged
package/.neutrinorc.js ADDED
@@ -0,0 +1,176 @@
1
+ const react = require('@neutrinojs/react');
2
+ const library = require('@neutrinojs/library');
3
+ const copy = require('@neutrinojs/copy');
4
+ const jest = require('@neutrinojs/jest');
5
+ const styles = require('@neutrinojs/style-loader');
6
+ const merge = require('deepmerge');
7
+ const path = require('path');
8
+
9
+ const webpackDevServer = (neutrino) => {
10
+ neutrino.config.watchOptions({
11
+ ignored: /node_modules/,
12
+ });
13
+ };
14
+
15
+ if (process.env.REACT_APP_LIB_MODE) {
16
+ module.exports = {
17
+ options: {
18
+ root: __dirname,
19
+ mains: {
20
+ index: './index.js',
21
+ },
22
+ },
23
+ use: [
24
+ (neutrino) => {
25
+ neutrino.config.output
26
+ .globalObject('this') // will prevent `window`
27
+ .end()
28
+ .module.rule('worker')
29
+ .test(neutrino.regexFromExtensions(['worker.js']))
30
+ .use('worker')
31
+ .loader(require.resolve('worker-loader'))
32
+ .options({
33
+ // See: https://github.com/webpack-contrib/worker-loader#options
34
+ });
35
+ },
36
+ library({
37
+ name: 'mobility-toolbox-js',
38
+ targets: {
39
+ browsers: [
40
+ 'last 2 Chrome versions',
41
+ 'last 2 Firefox versions',
42
+ 'last 2 Edge versions',
43
+ 'last 2 Opera versions',
44
+ 'last 2 Safari versions',
45
+ 'last 2 iOS versions',
46
+ 'ie 11',
47
+ ],
48
+ },
49
+ }),
50
+ jest({
51
+ testRegex: 'src/.*.test.js$',
52
+ coveragePathIgnorePatterns: ['src/doc/'],
53
+ coverageReporters: ['text', 'html'],
54
+ snapshotSerializers: ['jest-serializer-html'],
55
+ setupFilesAfterEnv: ['<rootDir>/src/setupTests.js'],
56
+ globalSetup: './global-setup.js',
57
+ transformIgnorePatterns: [
58
+ '/node_modules/(?!(ol|ol-mapbox-style|geotiff)/).*/',
59
+ ],
60
+ }),
61
+ (neutrino) => {
62
+ if (process.env.NODE_ENV === 'test') {
63
+ neutrino.config.module
64
+ .rule('compile')
65
+ .use('babel')
66
+ .tap((options) =>
67
+ merge(options, {
68
+ env: {
69
+ test: {
70
+ plugins: ['@babel/plugin-transform-runtime'], // async/await
71
+ },
72
+ },
73
+ }),
74
+ );
75
+ }
76
+ },
77
+ copy({
78
+ patterns: [
79
+ {
80
+ from: path.join(__dirname, 'README.md'),
81
+ to: path.join(__dirname, 'build/README.md'),
82
+ },
83
+ {
84
+ from: path.join(__dirname, 'src/api'),
85
+ to: path.join(__dirname, 'build/api'),
86
+ },
87
+ {
88
+ from: path.join(__dirname, 'src/common'),
89
+ to: path.join(__dirname, 'build/common'),
90
+ },
91
+ {
92
+ from: path.join(__dirname, 'src/ol'),
93
+ to: path.join(__dirname, 'build/ol'),
94
+ },
95
+ {
96
+ from: path.join(__dirname, 'src/mapbox'),
97
+ to: path.join(__dirname, 'build/mapbox'),
98
+ },
99
+ {
100
+ from: path.join(__dirname, 'package.json'),
101
+ to: path.join(__dirname, 'build/package.json'),
102
+ },
103
+ {
104
+ from: path.join(__dirname, 'src/index.js'),
105
+ to: path.join(__dirname, 'build/module.js'),
106
+ },
107
+ ],
108
+ }),
109
+ ],
110
+ };
111
+ } else {
112
+ module.exports = {
113
+ options: {
114
+ root: __dirname,
115
+ mains: {
116
+ index: 'doc/index.js',
117
+ },
118
+ },
119
+ use: [
120
+ react({
121
+ html: {
122
+ title: 'mobility-toolbox-js',
123
+ favicon: 'src/doc/img/favico.ico',
124
+ },
125
+ targets: {
126
+ browsers: [
127
+ 'last 2 Chrome versions',
128
+ 'last 2 Firefox versions',
129
+ 'last 2 Edge versions',
130
+ 'last 2 Opera versions',
131
+ 'last 2 Safari versions',
132
+ 'last 2 iOS versions',
133
+ 'ie 11',
134
+ ],
135
+ },
136
+ style: {
137
+ // Override the default file extension of `.css` if needed
138
+ test: /\.(css|sass|scss)$/,
139
+ modulesTest: /\.module\.(css|sass|scss)$/,
140
+ loaders: [
141
+ // Define loaders as objects. Note: loaders must be specified in reverse order.
142
+ // ie: for the loaders below the actual execution order would be:
143
+ // input file -> sass-loader -> postcss-loader -> css-loader -> style-loader/mini-css-extract-plugin
144
+ {
145
+ loader: 'postcss-loader',
146
+ options: {
147
+ plugins: [require('autoprefixer')],
148
+ },
149
+ },
150
+ {
151
+ loader: 'sass-loader',
152
+ useId: 'sass',
153
+ },
154
+ ],
155
+ },
156
+ }),
157
+ webpackDevServer,
158
+ copy({
159
+ patterns: [
160
+ {
161
+ from: path.join(__dirname, 'README.md'),
162
+ to: path.join(__dirname, 'build/README.md'),
163
+ },
164
+ {
165
+ from: path.join(__dirname, 'src/doc/examples'),
166
+ to: path.join(__dirname, 'build/examples'),
167
+ },
168
+ {
169
+ from: path.join(__dirname, 'src/doc/_redirects'),
170
+ to: path.join(__dirname, 'build/'),
171
+ },
172
+ ],
173
+ }),
174
+ ],
175
+ };
176
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 14
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## [2.0.0](https://github.com/geops/mobility-toolbox-js/compare/v1.7.5...v2.0.0) (2022-06-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * use standard-version for automatic versioning and changelog ([#167](https://github.com/geops/mobility-toolbox-js/issues/167)) ([045ad0b](https://github.com/geops/mobility-toolbox-js/commit/045ad0b533aaa56d84b90178de8e6aa18c2cbd89))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 geOps
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -8,13 +8,16 @@ The tools in this library have been inspired by many projects realized for publi
8
8
  [![Netlify Status](https://api.netlify.com/api/v1/badges/b368ab18-9dbf-416c-91f6-a82076b02c10/deploy-status)](https://app.netlify.com/sites/mobility-toolbox-js/deploys)
9
9
 
10
10
  ## Main Features
11
+
11
12
  * Display [real-time vehicle positions and prognosis data](http://tracker.geops.ch/) on a map.
12
13
  * Search for [stops and stations](https://maps2.trafimage.ch) all over the world.
13
14
  * Get [precise geographic courses](https://geops.github.io/geops-routing-demo/) for all modes of transport.
14
15
  * Generate beautiful maps for public transport, mobility and logistics
15
16
 
16
17
  ## Documentation and examples
17
- Visit https://mobility-toolbox-js.geops.io
18
+
19
+ Visit https://master--mobility-toolbox-js.netlify.app/
18
20
 
19
21
  ## Version 1.x.x
22
+
20
23
  The master branch is now open for the version 2 development. The version 1 is still available in [1.x.x](https://github.com/geops/mobility-toolbox-js/tree/1.x.x) branch.
@@ -0,0 +1,81 @@
1
+ const callbacks = {};
2
+
3
+ /* eslint-disable class-methods-use-this */
4
+ class Map {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+
9
+ addLayer() {}
10
+
11
+ addSource() {}
12
+
13
+ isStyleLoaded() {}
14
+
15
+ getLayer() {}
16
+
17
+ getBounds() {
18
+ return {
19
+ toArray: () => [
20
+ [1, 2],
21
+ [1, 2],
22
+ ],
23
+ };
24
+ }
25
+
26
+ getCanvas() {
27
+ return {
28
+ height: '100px',
29
+ width: '100px',
30
+ setAttribute: () => {},
31
+ removeAttribute: () => {},
32
+ };
33
+ }
34
+
35
+ getCenter() {
36
+ return { lng: 0, lat: 0 };
37
+ }
38
+
39
+ getZoom() {}
40
+
41
+ getBearing() {
42
+ return 0;
43
+ }
44
+
45
+ once() {}
46
+
47
+ on(type, func) {
48
+ if (!callbacks[type]) {
49
+ callbacks[type] = [];
50
+ }
51
+ callbacks[type].push(func);
52
+ }
53
+
54
+ off(type, func) {
55
+ if (!callbacks[type]) {
56
+ callbacks[type] = [];
57
+ }
58
+ const index = callbacks[type].indexOf(func);
59
+ if (index > -1) {
60
+ callbacks[type].splice(index, 1);
61
+ }
62
+ }
63
+
64
+ fire(type, evt) {
65
+ if (!callbacks[type]) {
66
+ callbacks[type] = [];
67
+ }
68
+ callbacks[type].forEach((callback) => callback(evt));
69
+ }
70
+
71
+ loaded() {}
72
+
73
+ remove() {}
74
+
75
+ unproject() {
76
+ return { lng: 0, lat: 0 };
77
+ }
78
+ }
79
+ module.exports = {
80
+ Map,
81
+ };
@@ -0,0 +1,81 @@
1
+ const callbacks = {};
2
+
3
+ /* eslint-disable class-methods-use-this */
4
+ class Map {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+
9
+ addLayer() {}
10
+
11
+ addSource() {}
12
+
13
+ isStyleLoaded() {}
14
+
15
+ getLayer() {}
16
+
17
+ getBounds() {
18
+ return {
19
+ toArray: () => [
20
+ [1, 2],
21
+ [1, 2],
22
+ ],
23
+ };
24
+ }
25
+
26
+ getCanvas() {
27
+ return {
28
+ height: '100px',
29
+ width: '100px',
30
+ setAttribute: () => {},
31
+ removeAttribute: () => {},
32
+ };
33
+ }
34
+
35
+ getCenter() {
36
+ return { lng: 0, lat: 0 };
37
+ }
38
+
39
+ getZoom() {}
40
+
41
+ getBearing() {
42
+ return 0;
43
+ }
44
+
45
+ once() {}
46
+
47
+ on(type, func) {
48
+ if (!callbacks[type]) {
49
+ callbacks[type] = [];
50
+ }
51
+ callbacks[type].push(func);
52
+ }
53
+
54
+ off(type, func) {
55
+ if (!callbacks[type]) {
56
+ callbacks[type] = [];
57
+ }
58
+ const index = callbacks[type].indexOf(func);
59
+ if (index > -1) {
60
+ callbacks[type].splice(index, 1);
61
+ }
62
+ }
63
+
64
+ fire(type, evt) {
65
+ if (!callbacks[type]) {
66
+ callbacks[type] = [];
67
+ }
68
+ callbacks[type].forEach((callback) => callback(evt));
69
+ }
70
+
71
+ loaded() {}
72
+
73
+ remove() {}
74
+
75
+ unproject() {
76
+ return { lng: 0, lat: 0 };
77
+ }
78
+ }
79
+ module.exports = {
80
+ Map,
81
+ };
@@ -0,0 +1 @@
1
+ module.exports = { extends: ['@commitlint/config-conventional'] };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,7 @@
1
+ describe('Api', () => {
2
+ it('loads api page', () => {
3
+ cy.visit('/api');
4
+ cy.get('img[alt=Logo').should('be.ok');
5
+ cy.get('iframe').should('be.ok');
6
+ });
7
+ });
@@ -0,0 +1,7 @@
1
+ describe('Examples', () => {
2
+ it('loads a map in the simple map example', () => {
3
+ cy.visit('/examples');
4
+ cy.get('img[alt=Logo').should('be.ok');
5
+ cy.get('canvas').should('be.ok');
6
+ });
7
+ });
@@ -0,0 +1,29 @@
1
+ // / <reference types="cypress" />
2
+
3
+ context('Navigation', () => {
4
+ beforeEach(() => {
5
+ cy.visit('');
6
+ cy.get('header').contains('API').click();
7
+ cy.get('header').contains('Examples').click();
8
+ });
9
+
10
+ it("cy.go() - go back or forward in the browser's history", () => {
11
+ // https://on.cypress.io/go
12
+
13
+ cy.location('pathname').should('include', 'examples');
14
+
15
+ cy.go('back');
16
+ cy.location('pathname').should('include', 'api');
17
+
18
+ cy.go('forward');
19
+ cy.location('pathname').should('include', 'examples');
20
+
21
+ // clicking back
22
+ cy.go(-1);
23
+ cy.location('pathname').should('include', 'api');
24
+
25
+ // clicking forward
26
+ cy.go(1);
27
+ cy.location('pathname').should('include', 'examples');
28
+ });
29
+ });
@@ -0,0 +1,21 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************************
3
+ // This example plugins/index.js can be used to load plugins
4
+ //
5
+ // You can change the location of this file or turn off loading
6
+ // the plugins file with the 'pluginsFile' configuration option.
7
+ //
8
+ // You can read more here:
9
+ // https://on.cypress.io/plugins-guide
10
+ // ***********************************************************
11
+
12
+ // This function is called when a project is opened or re-opened (e.g. due to
13
+ // the project's config changing)
14
+
15
+ /**
16
+ * @type {Cypress.PluginConfig}
17
+ */
18
+ module.exports = (on, config) => {
19
+ // `on` is used to hook into various events Cypress emits
20
+ // `config` is the resolved Cypress config
21
+ }
@@ -0,0 +1,25 @@
1
+ // ***********************************************
2
+ // This example commands.js shows you how to
3
+ // create various custom commands and overwrite
4
+ // existing commands.
5
+ //
6
+ // For more comprehensive examples of custom
7
+ // commands please read more here:
8
+ // https://on.cypress.io/custom-commands
9
+ // ***********************************************
10
+ //
11
+ //
12
+ // -- This is a parent command --
13
+ // Cypress.Commands.add("login", (email, password) => { ... })
14
+ //
15
+ //
16
+ // -- This is a child command --
17
+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18
+ //
19
+ //
20
+ // -- This is a dual command --
21
+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22
+ //
23
+ //
24
+ // -- This will overwrite an existing command --
25
+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
@@ -0,0 +1,20 @@
1
+ // ***********************************************************
2
+ // This example support/index.js is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands'
18
+
19
+ // Alternatively you can use CommonJS syntax:
20
+ // require('./commands')
package/cypress.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "baseUrl": "http://localhost:5000",
3
+ "video": false
4
+ }