@mapcomponents/react-maplibre 0.1.62 → 0.1.63

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 (185) hide show
  1. package/.babelrc +21 -2
  2. package/.eslintrc.js +8 -1
  3. package/.storybook/main.js +0 -1
  4. package/.storybook/preview.js +0 -2
  5. package/CHANGELOG.md +18 -0
  6. package/coverage/clover.xml +232 -44
  7. package/coverage/coverage-final.json +11 -3
  8. package/coverage/lcov-report/favicon.png +0 -0
  9. package/coverage/lcov-report/index.html +70 -25
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +1 -1
  12. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  13. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +1 -1
  14. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +148 -0
  18. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  19. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +22 -7
  20. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +73 -40
  21. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +15 -15
  22. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  23. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  24. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  25. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +9 -3
  27. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
  28. package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +59 -29
  30. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  31. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +652 -0
  32. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +649 -0
  33. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +131 -0
  34. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  35. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  36. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  39. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  40. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
  41. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  42. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  44. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  46. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  47. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  49. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  51. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  53. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
  55. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
  56. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  57. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  58. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  59. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  60. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  61. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  62. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +214 -0
  64. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +121 -0
  65. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +412 -0
  66. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +463 -0
  67. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +161 -0
  68. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +898 -0
  69. package/coverage/lcov-report/src/components/MlSketchTool/index.html +116 -0
  70. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
  71. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  72. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  73. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  74. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
  75. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  76. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  77. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  78. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
  79. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
  80. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  81. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  82. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  83. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  84. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
  85. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
  86. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +1 -1
  87. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  88. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  89. package/coverage/lcov-report/src/contexts/index.html +1 -1
  90. package/coverage/lcov-report/src/hooks/index.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  92. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  95. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
  96. package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
  97. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
  99. package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
  100. package/coverage/lcov-report/src/hooks/useSource.ts.html +1 -1
  101. package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
  102. package/coverage/lcov-report/src/index.html +1 -1
  103. package/coverage/lcov-report/src/index.ts.html +1 -1
  104. package/coverage/lcov.info +514 -89
  105. package/cypress/support/commands.ts +37 -0
  106. package/cypress/support/component-index.html +12 -0
  107. package/cypress/support/component.ts +46 -0
  108. package/cypress.config.ts +101 -0
  109. package/dist/components/MapLibreMap/MapLibreMap.d.ts +1 -1
  110. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +3 -3
  111. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.cy.d.ts +1 -0
  112. package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
  113. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +10 -4
  114. package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -2
  115. package/dist/components/MlFeatureEditor/lib/theme.d.ts +1 -1
  116. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +1 -1
  117. package/dist/components/MlGPXViewer/util/MlGPXViewerInstructions.d.ts +1 -0
  118. package/dist/components/MlGPXViewer/util/SampleLayer.d.ts +0 -0
  119. package/dist/components/MlGPXViewer/util/demoViewer.d.ts +5 -0
  120. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +4 -4
  121. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +103 -11
  122. package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +2 -0
  123. package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -0
  124. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +9 -0
  125. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +5 -0
  126. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +11 -0
  127. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +9 -0
  128. package/dist/components/MlSketchTool/MlSketchTool.d.ts +29 -0
  129. package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +10 -0
  130. package/dist/contexts/SimpleDataProvider.d.ts +1 -1
  131. package/dist/custom.d.d.ts +1 -1
  132. package/dist/hooks/useLayer.d.ts +1 -1
  133. package/dist/hooks/useMap.d.ts +1 -1
  134. package/dist/hooks/useMapState.d.ts +3 -3
  135. package/dist/hooks/useSource.d.ts +1 -1
  136. package/dist/index.esm.css +1 -1
  137. package/dist/index.esm.js +2736 -3557
  138. package/dist/index.esm.js.map +1 -1
  139. package/dist/ui_components/LoadingOverlayContext.d.ts +1 -1
  140. package/dist/ui_components/Sidebar.d.ts +9 -1
  141. package/dist/ui_components/TopToolbar.d.ts +6 -1
  142. package/package.json +21 -15
  143. package/public/assets/sample1.gpx +3003 -0
  144. package/public/assets/sample2.gpx +1264 -0
  145. package/public/assets/sample3.gpx +912 -0
  146. package/public/index.html +0 -4
  147. package/public/thumbnails/MlSketchTool.png +0 -0
  148. package/public/thumbnails/useCameraFollowPath.png +0 -0
  149. package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +21 -0
  150. package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +1 -3
  151. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +1 -1
  152. package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +1 -1
  153. package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +39 -28
  154. package/src/components/MlGPXViewer/MlGPXViewer.stories.js +75 -15
  155. package/src/components/MlGPXViewer/MlGPXViewer.tsx +3 -1
  156. package/src/components/MlGPXViewer/util/MlGPXViewerInstructions.js +145 -0
  157. package/src/components/MlGPXViewer/util/SampleLayer.js +2 -0
  158. package/src/components/MlGPXViewer/util/demoViewer.js +254 -0
  159. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +102 -0
  160. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +33 -23
  161. package/src/components/MlGeoJsonLayer/assets/sample_1.json +138 -24
  162. package/src/components/MlGeoJsonLayer/assets/sample_2.json +140 -20
  163. package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +189 -0
  164. package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +188 -0
  165. package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +43 -0
  166. package/src/components/MlSketchTool/LayerList/LayerList.tsx +12 -0
  167. package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +109 -0
  168. package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +126 -0
  169. package/src/components/MlSketchTool/MlSketchTool.doc.de.md +3 -0
  170. package/src/components/MlSketchTool/MlSketchTool.meta.json +15 -0
  171. package/src/components/MlSketchTool/MlSketchTool.stories.js +26 -0
  172. package/src/components/MlSketchTool/MlSketchTool.tsx +271 -0
  173. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +2 -2
  174. package/src/ui_components/Sidebar.tsx +80 -0
  175. package/src/ui_components/TopToolbar.tsx +24 -0
  176. package/tsconfig.json +39 -58
  177. package/config/getHttpsConfig.js +0 -66
  178. package/config/modules.js +0 -134
  179. package/config/pnpTs.js +0 -35
  180. package/config/webpack.config.js +0 -757
  181. package/config/webpackDevServer.config.js +0 -130
  182. package/scripts/start.js +0 -166
  183. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +0 -66
  184. package/src/ui_components/Sidebar.js +0 -100
  185. package/src/ui_components/TopToolbar.js +0 -29
@@ -1,130 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
5
- const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
6
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
7
- const ignoredFiles = require('react-dev-utils/ignoredFiles');
8
- const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
9
- const paths = require('./paths');
10
- const getHttpsConfig = require('./getHttpsConfig');
11
-
12
- const host = process.env.HOST || '0.0.0.0';
13
- const sockHost = process.env.WDS_SOCKET_HOST;
14
- const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
15
- const sockPort = process.env.WDS_SOCKET_PORT;
16
-
17
- module.exports = function (proxy, allowedHost) {
18
- return {
19
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
20
- // websites from potentially accessing local content through DNS rebinding:
21
- // https://github.com/webpack/webpack-dev-server/issues/887
22
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
23
- // However, it made several existing use cases such as development in cloud
24
- // environment or subdomains in development significantly more complicated:
25
- // https://github.com/facebook/create-react-app/issues/2271
26
- // https://github.com/facebook/create-react-app/issues/2233
27
- // While we're investigating better solutions, for now we will take a
28
- // compromise. Since our WDS configuration only serves files in the `public`
29
- // folder we won't consider accessing them a vulnerability. However, if you
30
- // use the `proxy` feature, it gets more dangerous because it can expose
31
- // remote code execution vulnerabilities in backends like Django and Rails.
32
- // So we will disable the host check normally, but enable it if you have
33
- // specified the `proxy` setting. Finally, we let you override it if you
34
- // really know what you're doing with a special environment variable.
35
- disableHostCheck:
36
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
37
- // Enable gzip compression of generated files.
38
- compress: true,
39
- // Silence WebpackDevServer's own logs since they're generally not useful.
40
- // It will still show compile warnings and errors with this setting.
41
- clientLogLevel: 'none',
42
- // By default WebpackDevServer serves physical files from current directory
43
- // in addition to all the virtual build products that it serves from memory.
44
- // This is confusing because those files won’t automatically be available in
45
- // production build folder unless we copy them. However, copying the whole
46
- // project directory is dangerous because we may expose sensitive files.
47
- // Instead, we establish a convention that only files in `public` directory
48
- // get served. Our build script will copy `public` into the `build` folder.
49
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
50
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
51
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
52
- // Note that we only recommend to use `public` folder as an escape hatch
53
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
54
- // for some reason broken when imported through webpack. If you just want to
55
- // use an image, put it in `src` and `import` it from JavaScript instead.
56
- contentBase: paths.appPublic,
57
- contentBasePublicPath: paths.publicUrlOrPath,
58
- // By default files from `contentBase` will not trigger a page reload.
59
- watchContentBase: true,
60
- // Enable hot reloading server. It will provide WDS_SOCKET_PATH endpoint
61
- // for the WebpackDevServer client so it can learn when the files were
62
- // updated. The WebpackDevServer client is included as an entry point
63
- // in the webpack development configuration. Note that only changes
64
- // to CSS are currently hot reloaded. JS changes will refresh the browser.
65
- hot: true,
66
- // Use 'ws' instead of 'sockjs-node' on server since we're using native
67
- // websockets in `webpackHotDevClient`.
68
- transportMode: 'ws',
69
- // Prevent a WS client from getting injected as we're already including
70
- // `webpackHotDevClient`.
71
- injectClient: false,
72
- // Enable custom sockjs pathname for websocket connection to hot reloading server.
73
- // Enable custom sockjs hostname, pathname and port for websocket connection
74
- // to hot reloading server.
75
- sockHost,
76
- sockPath,
77
- sockPort,
78
- // It is important to tell WebpackDevServer to use the same "publicPath" path as
79
- // we specified in the webpack config. When homepage is '.', default to serving
80
- // from the root.
81
- // remove last slash so user can land on `/test` instead of `/test/`
82
- publicPath: paths.publicUrlOrPath.slice(0, -1),
83
- // WebpackDevServer is noisy by default so we emit custom message instead
84
- // by listening to the compiler events with `compiler.hooks[...].tap` calls above.
85
- quiet: true,
86
- // Reportedly, this avoids CPU overload on some systems.
87
- // https://github.com/facebook/create-react-app/issues/293
88
- // src/node_modules is not ignored to support absolute imports
89
- // https://github.com/facebook/create-react-app/issues/1065
90
- watchOptions: {
91
- ignored: ignoredFiles(paths.appSrc),
92
- },
93
- https: getHttpsConfig(),
94
- host,
95
- overlay: false,
96
- historyApiFallback: {
97
- // Paths with dots should still use the history fallback.
98
- // See https://github.com/facebook/create-react-app/issues/387.
99
- disableDotRule: true,
100
- index: paths.publicUrlOrPath,
101
- },
102
- public: allowedHost,
103
- // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
104
- proxy,
105
- before(app, server) {
106
- // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
107
- // middlewares before `redirectServedPath` otherwise will not have any effect
108
- // This lets us fetch source contents from webpack for the error overlay
109
- app.use(evalSourceMapMiddleware(server));
110
- // This lets us open files from the runtime error overlay.
111
- app.use(errorOverlayMiddleware());
112
-
113
- if (fs.existsSync(paths.proxySetup)) {
114
- // This registers user provided middleware for proxy reasons
115
- require(paths.proxySetup)(app);
116
- }
117
- },
118
- after(app) {
119
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
120
- app.use(redirectServedPath(paths.publicUrlOrPath));
121
-
122
- // This service worker file is effectively a 'no-op' that will reset any
123
- // previous service worker registered for the same host:port combination.
124
- // We do this in development to avoid hitting the production cache if
125
- // it used the same host and port.
126
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
127
- app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
128
- },
129
- };
130
- };
package/scripts/start.js DELETED
@@ -1,166 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'development';
5
- process.env.NODE_ENV = 'development';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
-
18
- const fs = require('fs');
19
- const chalk = require('react-dev-utils/chalk');
20
- const webpack = require('webpack');
21
- const WebpackDevServer = require('webpack-dev-server');
22
- const clearConsole = require('react-dev-utils/clearConsole');
23
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
24
- const {
25
- choosePort,
26
- createCompiler,
27
- prepareProxy,
28
- prepareUrls,
29
- } = require('react-dev-utils/WebpackDevServerUtils');
30
- const openBrowser = require('react-dev-utils/openBrowser');
31
- const semver = require('semver');
32
- const paths = require('../config/paths');
33
- const configFactory = require('../config/webpack.config');
34
- const createDevServerConfig = require('../config/webpackDevServer.config');
35
- const getClientEnvironment = require('../config/env');
36
- const react = require(require.resolve('react', { paths: [paths.appPath] }));
37
-
38
- const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
39
- const useYarn = fs.existsSync(paths.yarnLockFile);
40
- const isInteractive = process.stdout.isTTY;
41
-
42
- // Warn and crash if required files are missing
43
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
44
- process.exit(1);
45
- }
46
-
47
- // Tools like Cloud9 rely on this.
48
- const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
49
- const HOST = process.env.HOST || '0.0.0.0';
50
-
51
- if (process.env.HOST) {
52
- console.log(
53
- chalk.cyan(
54
- `Attempting to bind to HOST environment variable: ${chalk.yellow(
55
- chalk.bold(process.env.HOST)
56
- )}`
57
- )
58
- );
59
- console.log(
60
- `If this was unintentional, check that you haven't mistakenly set it in your shell.`
61
- );
62
- console.log(
63
- `Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
64
- );
65
- console.log();
66
- }
67
-
68
- // We require that you explicitly set browsers and do not fall back to
69
- // browserslist defaults.
70
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
71
- checkBrowsers(paths.appPath, isInteractive)
72
- .then(() => {
73
- // We attempt to use the default port but if it is busy, we offer the user to
74
- // run on a different port. `choosePort()` Promise resolves to the next free port.
75
- return choosePort(HOST, DEFAULT_PORT);
76
- })
77
- .then(port => {
78
- if (port == null) {
79
- // We have not found a port.
80
- return;
81
- }
82
-
83
- const config = configFactory('development');
84
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
85
- const appName = require(paths.appPackageJson).name;
86
-
87
- const useTypeScript = fs.existsSync(paths.appTsConfig);
88
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
89
- const urls = prepareUrls(
90
- protocol,
91
- HOST,
92
- port,
93
- paths.publicUrlOrPath.slice(0, -1)
94
- );
95
- const devSocket = {
96
- warnings: warnings =>
97
- devServer.sockWrite(devServer.sockets, 'warnings', warnings),
98
- errors: errors =>
99
- devServer.sockWrite(devServer.sockets, 'errors', errors),
100
- };
101
- // Create a webpack compiler that is configured with custom messages.
102
- const compiler = createCompiler({
103
- appName,
104
- config,
105
- devSocket,
106
- urls,
107
- useYarn,
108
- useTypeScript,
109
- tscCompileOnError,
110
- webpack,
111
- });
112
- // Load proxy config
113
- const proxySetting = require(paths.appPackageJson).proxy;
114
- const proxyConfig = prepareProxy(
115
- proxySetting,
116
- paths.appPublic,
117
- paths.publicUrlOrPath
118
- );
119
- // Serve webpack assets generated by the compiler over a web server.
120
- const serverConfig = createDevServerConfig(
121
- proxyConfig,
122
- urls.lanUrlForConfig
123
- );
124
- const devServer = new WebpackDevServer(compiler, serverConfig);
125
- // Launch WebpackDevServer.
126
- devServer.listen(port, HOST, err => {
127
- if (err) {
128
- return console.log(err);
129
- }
130
- if (isInteractive) {
131
- clearConsole();
132
- }
133
-
134
- if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
135
- console.log(
136
- chalk.yellow(
137
- `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
138
- )
139
- );
140
- }
141
-
142
- console.log(chalk.cyan('Starting the development server...\n'));
143
- openBrowser(urls.localUrlForBrowser);
144
- });
145
-
146
- ['SIGINT', 'SIGTERM'].forEach(function (sig) {
147
- process.on(sig, function () {
148
- devServer.close();
149
- process.exit();
150
- });
151
- });
152
-
153
- if (process.env.CI !== 'true') {
154
- // Gracefully exit when stdin ends
155
- process.stdin.on('end', function () {
156
- devServer.close();
157
- process.exit();
158
- });
159
- }
160
- })
161
- .catch(err => {
162
- if (err && err.message) {
163
- console.log(err.message);
164
- }
165
- process.exit(1);
166
- });
@@ -1,66 +0,0 @@
1
- import React from "react";
2
-
3
- import MlGeoJsonLayer from "./MlGeoJsonLayer";
4
-
5
- import mapContextDecorator from "../../decorators/MapContextDecorator";
6
-
7
- import sample_geojson_1 from "./assets/sample_1.json";
8
- import sample_polygon_geojson_1 from "./assets/sample_polygon_1.json";
9
-
10
- console.log(sample_polygon_geojson_1);
11
- const storyoptions = {
12
- title: "MapComponents/MlGeoJsonLayer",
13
- component: MlGeoJsonLayer,
14
- argTypes: {
15
- },
16
- decorators: mapContextDecorator,
17
- };
18
- export default storyoptions;
19
-
20
- const Template = (props) => {
21
- return (
22
- <>
23
- <MlGeoJsonLayer {...props} />
24
- </>
25
- );
26
- };
27
- const LinestringTemplate = (props) => {
28
- return (
29
- <>
30
- <MlGeoJsonLayer type="line" geojson={sample_geojson_1} />
31
- </>
32
- );
33
- };
34
-
35
- export const Linestring = LinestringTemplate.bind({});
36
- Linestring.parameters = {};
37
- Linestring.args = {
38
- type:''
39
- };
40
-
41
- export const Polygon = Template.bind({});
42
- Polygon.parameters = {};
43
- Polygon.args = {
44
- geojson: sample_polygon_geojson_1,
45
- paint:{
46
- "fill-color": 'rgba(120,20,80,.5)'
47
- },
48
- type:''
49
- };
50
- export const DefaultPaintOverrides = Template.bind({});
51
- DefaultPaintOverrides.parameters = {};
52
- DefaultPaintOverrides.args = {
53
- defaultPaintOverrides: {
54
- fill: {
55
- "fill-color": "blue",
56
- },
57
- circle: {
58
- "circle-color": "red",
59
- },
60
- line: {
61
- "line-color": "black",
62
- },
63
- },
64
- geojson: sample_polygon_geojson_1,
65
- type:''
66
- };
@@ -1,100 +0,0 @@
1
- import React, {useState} from "react";
2
- import { styled } from "@mui/material/styles";
3
- import makeStyles from "@mui/styles/makeStyles";
4
- import Drawer from "@mui/material/Drawer";
5
- import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
6
- import MenuIcon from '@mui/icons-material/Menu';
7
- import { IconButton } from "@mui/material";
8
- import useMediaQuery from "@mui/material/useMediaQuery";
9
-
10
- const useStyles = makeStyles((theme) => ({
11
- drawer: {
12
- flexGrow: 1,
13
- zIndex: 105,
14
- position: "absolute",
15
- top: 0,
16
- left: 0,
17
- bottom: 0,
18
- backgroundColor: "#fafafa",
19
- display: "flex",
20
- flexDirection: "column",
21
- alignItems: "stretch",
22
- alignContent: "stretch",
23
- },
24
- drawerPaper: {
25
- position: "initial !important",
26
- boxSizing: "border-box",
27
- padding: "40px",
28
- visibility: "visible !important",
29
- zIndex: "initial !important",
30
- },
31
- drawerHeader: {
32
- alignContent: "flex-start",
33
- display: "flex",
34
- },
35
- drawerContent: {},
36
- }));
37
-
38
- const DrawerHeader = styled("div")(({ theme }) => ({
39
- display: "flex",
40
- alignItems: "center",
41
- }));
42
-
43
- export default function Sidebar(props) {
44
- const classes = useStyles();
45
- const mediaIsMobile = useMediaQuery("(max-width:900px)");
46
-
47
- const [drawerOpen, setDrawerOpen] = useState(true);
48
-
49
- const handleDrawerOpen = () => {
50
- setDrawerOpen(true);
51
- };
52
- const handleDrawerClose = () => {
53
- setDrawerOpen(false);
54
- };
55
-
56
- return (
57
- <>
58
- <IconButton
59
- onClick={handleDrawerOpen}
60
- style={{
61
- zIndex: 101,
62
- position: "relative",
63
- padding: "20px",
64
- }}
65
- >
66
- <MenuIcon />
67
- </IconButton>
68
- <Drawer
69
- transitionDuration={0}
70
- className={classes.drawer}
71
- variant="persistent"
72
- anchor="left"
73
- open={drawerOpen}
74
- classes={{
75
- paper: classes.drawerPaper,
76
- }}
77
- sx={{
78
- ...props.sx,
79
- ...{
80
- maxWidth: mediaIsMobile ? "90vw" : "20vw",
81
- },
82
- ...(drawerOpen ? {} : { left: mediaIsMobile ? "-90vw" : "-20vw" }),
83
- }}
84
- >
85
- <DrawerHeader className={classes.drawerHeader}>
86
- <IconButton onClick={handleDrawerClose}>
87
- <ChevronLeftIcon
88
- style={
89
- {
90
- //paddingBottom: "40px",
91
- }
92
- }
93
- />
94
- </IconButton>
95
- </DrawerHeader>
96
- <div style={{ maxWidth: "100%" }}>{props.children}</div>
97
- </Drawer>
98
- </>
99
- );
100
- }
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import AppBar from "@mui/material/AppBar";
3
- import Toolbar from "@mui/material/Toolbar";
4
-
5
- export default function TopToolbar(props) {
6
- return (
7
- <div
8
- style={{
9
- flexGrow: 1,
10
- zIndex: 120,
11
- position: "absolute",
12
- top: 0,
13
- left: 0,
14
- right: 0,
15
- }}
16
- >
17
- <AppBar
18
- sx={{
19
- minHeight: "62px",
20
- backgroundColor: "#f1f1f1",
21
- }}
22
- color="primary"
23
- position="static"
24
- >
25
- <Toolbar>{props.children}</Toolbar>
26
- </AppBar>
27
- </div>
28
- );
29
- }