@mapcomponents/react-maplibre 0.1.66 → 0.1.68

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 (287) hide show
  1. package/.github/workflows/node_version_test.yml +1 -1
  2. package/.storybook/main.js +37 -31
  3. package/.storybook/preview.js +21 -0
  4. package/CHANGELOG.md +13 -0
  5. package/coverage/clover.xml +545 -472
  6. package/coverage/coverage-final.json +18 -17
  7. package/coverage/lcov-report/index.html +80 -80
  8. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +50 -26
  9. package/coverage/lcov-report/src/components/MapLibreMap/index.html +5 -5
  10. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +30 -51
  11. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +3 -3
  12. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
  18. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  21. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +48 -105
  22. package/coverage/lcov-report/src/components/MlFollowGps/index.html +15 -15
  23. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +2 -2
  24. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  25. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
  27. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +1 -1
  28. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +1 -1
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +1 -1
  30. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  31. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +1 -1
  33. package/coverage/lcov-report/src/components/MlGpxViewer/index.html +1 -1
  34. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  35. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  36. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +52 -40
  39. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +10 -10
  40. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +4 -4
  41. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  42. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  44. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  47. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  49. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  51. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +41 -113
  53. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
  54. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  56. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlScaleReference/{MlScaleReference.js.html → MlScaleReference.tsx.html} +57 -36
  58. package/coverage/lcov-report/src/components/MlScaleReference/index.html +2 -2
  59. package/coverage/lcov-report/src/components/MlShareMapState/{MlShareMapState.js.html → MlShareMapState.tsx.html} +192 -84
  60. package/coverage/lcov-report/src/components/MlShareMapState/index.html +20 -20
  61. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
  62. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
  64. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +2 -2
  65. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +2 -2
  67. package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
  68. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +1 -1
  69. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  70. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  71. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreejsLayer.tsx.html +769 -0
  72. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +25 -10
  73. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
  74. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  75. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  76. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  77. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +22 -10
  78. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +13 -13
  79. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +11 -11
  80. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +11 -11
  81. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  82. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  83. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +27 -18
  84. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +11 -11
  85. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +72 -27
  86. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  87. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  88. package/coverage/lcov-report/src/contexts/index.html +1 -1
  89. package/coverage/lcov-report/src/hooks/index.html +21 -21
  90. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  92. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +2 -2
  95. package/coverage/lcov-report/src/hooks/useGpx/index.html +1 -1
  96. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +1 -1
  97. package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +9 -9
  99. package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +1 -1
  100. package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +1 -1
  101. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +1 -1
  102. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +9 -6
  103. package/coverage/lcov-report/src/hooks/useMap.ts.html +2 -2
  104. package/coverage/lcov-report/src/hooks/useMapState.ts.html +8 -29
  105. package/coverage/lcov-report/src/hooks/useSource.ts.html +10 -10
  106. package/coverage/lcov-report/src/hooks/useWms.ts.html +1 -1
  107. package/coverage/lcov-report/src/index.html +1 -1
  108. package/coverage/lcov-report/src/index.ts.html +105 -12
  109. package/coverage/lcov.info +1038 -917
  110. package/dist/components/MapLibreMap/MapLibreMap.d.ts +3 -3
  111. package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +5 -0
  112. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +17 -15
  113. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +2 -15
  114. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +2 -15
  115. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -0
  116. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +2 -1
  117. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -0
  118. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +2 -1
  119. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +1 -0
  120. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +2 -1
  121. package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +1 -0
  122. package/dist/components/MlCreatePdfForm/lib/_PdfPreview.d.ts +1 -0
  123. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +1 -0
  124. package/dist/components/MlFeatureEditor/lib/create_supplementary_points.d.ts +1 -1
  125. package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +1 -1
  126. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -0
  127. package/dist/components/MlFollowGps/MlFollowGps.d.ts +5 -23
  128. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -2
  129. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -0
  130. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +2 -1
  131. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +1 -0
  132. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +1 -0
  133. package/dist/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +4 -1
  134. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +1 -0
  135. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +2 -1
  136. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +1 -0
  137. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +2 -1
  138. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +1 -0
  139. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +1 -0
  140. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +1 -0
  141. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +1 -0
  142. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +1 -0
  143. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +2 -1
  144. package/dist/components/MlLayer/MlLayer.d.ts +1 -0
  145. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +2 -1
  146. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +2 -1
  147. package/dist/components/MlMarker/MlMarker.d.ts +1 -0
  148. package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +1 -0
  149. package/dist/components/MlNavigationCompass/MlNavigationCompass.d.ts +1 -0
  150. package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +5 -0
  151. package/dist/components/MlScaleReference/MlScaleReference.d.ts +8 -1
  152. package/dist/components/MlShareMapState/MlShareMapState.d.ts +33 -13
  153. package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +16 -9
  154. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +1 -0
  155. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +1 -0
  156. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +1 -0
  157. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +1 -0
  158. package/dist/components/MlSketchTool/MlSketchTool.d.ts +1 -0
  159. package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +2 -1
  160. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +1 -0
  161. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +2 -1
  162. package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +1 -1
  163. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +2 -1
  164. package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +30 -0
  165. package/dist/components/MlThreeJsLayer/lib/GLTFLoader.d.ts +2 -1
  166. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +1 -0
  167. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.d.ts +3 -2
  168. package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +2 -1
  169. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +1 -0
  170. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +1 -0
  171. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +2 -1
  172. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +1 -0
  173. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +1 -0
  174. package/dist/contexts/MapContext.d.ts +13 -2
  175. package/dist/decorators/EmptyMapDecorator.d.ts +2 -0
  176. package/dist/decorators/MapContextDecorator.d.ts +1 -1
  177. package/dist/decorators/MapContextDecoratorHooks.d.ts +1 -1
  178. package/dist/decorators/MultiMapContextDecorator.d.ts +1 -1
  179. package/dist/decorators/NoNavToolsDecorator.d.ts +1 -1
  180. package/dist/decorators/ThemeDecorator.d.ts +2 -0
  181. package/dist/hooks/useCameraFollowPath/useCameraFollowPath.stories.d.ts +2 -1
  182. package/dist/hooks/useExportMap/lib.d.ts +1 -1
  183. package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +2 -1
  184. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +1 -0
  185. package/dist/index.d.ts +25 -8
  186. package/dist/index.esm.css +0 -97
  187. package/dist/index.esm.js +2187 -9306
  188. package/dist/index.esm.js.map +1 -1
  189. package/dist/setupTests.d.ts +6 -6
  190. package/dist/ui_components/Dropzone.d.ts +1 -0
  191. package/dist/ui_components/ImageLoader.d.ts +1 -0
  192. package/dist/ui_components/LayerList/LayerList.d.ts +6 -0
  193. package/dist/ui_components/LayerList/LayerList.stories.d.ts +12 -0
  194. package/dist/ui_components/LayerList/LayerListFolder.d.ts +9 -0
  195. package/dist/ui_components/LayerList/LayerListItem.d.ts +18 -0
  196. package/dist/ui_components/LayerList/util/LayerListItemVectorLayer.d.ts +15 -0
  197. package/dist/ui_components/LayerList/util/LayerPropertyForm.d.ts +10 -0
  198. package/dist/ui_components/LayerList/util/input/ColorPicker.d.ts +10 -0
  199. package/dist/ui_components/LoadingOverlayContext.d.ts +0 -1
  200. package/dist/ui_components/MapcomponentsTheme.d.ts +7 -0
  201. package/dist/ui_components/Tooltip.d.ts +1 -0
  202. package/dist/ui_components/TopToolbar.d.ts +1 -0
  203. package/dist/ui_components/UploadButton.d.ts +1 -0
  204. package/dist/util/Instructions.d.ts +1 -0
  205. package/package.json +67 -67
  206. package/public/thumbnails/{MlGPXViewer.png → MlGpxViewer.png} +0 -0
  207. package/rollup.config.js +68 -50
  208. package/src/@types/assets/index.d.ts +20 -0
  209. package/src/App.css +0 -55
  210. package/src/components/MapLibreMap/MapLibreMap.stories.js +38 -32
  211. package/src/components/MapLibreMap/MapLibreMap.tsx +29 -21
  212. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +50 -40
  213. package/src/components/MlCenterPosition/MlCenterPosition.tsx +22 -29
  214. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +6 -6
  215. package/src/components/MlFollowGps/MlFollowGps.stories.js +28 -10
  216. package/src/components/MlFollowGps/MlFollowGps.tsx +38 -57
  217. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +1 -1
  218. package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +16 -10
  219. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +4 -13
  220. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +3 -1
  221. package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +21 -17
  222. package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +3 -3
  223. package/src/components/MlNavigationTools/MlNavigationTools.stories.js +4 -5
  224. package/src/components/MlNavigationTools/MlNavigationTools.tsx +30 -54
  225. package/src/components/MlScaleReference/{MlScaleReference.js → MlScaleReference.tsx} +38 -31
  226. package/src/components/MlShareMapState/MlShareMapState.stories.tsx +100 -0
  227. package/src/components/MlShareMapState/{MlShareMapState.js → MlShareMapState.tsx} +94 -58
  228. package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +1 -1
  229. package/src/components/MlSketchTool/MlSketchTool.tsx +1 -1
  230. package/src/components/MlThreeJsLayer/MlThreejsLayer.tsx +228 -0
  231. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +7 -3
  232. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +3 -11
  233. package/src/components/MlWmsLoader/MlWmsLoader.tsx +7 -4
  234. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +2 -2
  235. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +1 -1
  236. package/src/contexts/MapContext.tsx +34 -20
  237. package/src/custom.d.ts +4 -0
  238. package/src/decorators/EmptyMapDecorator.js +38 -0
  239. package/src/decorators/MapContextDecorator.js +31 -26
  240. package/src/decorators/MapContextDecoratorHooks.js +29 -24
  241. package/src/decorators/MultiMapContextDecorator.js +71 -71
  242. package/src/decorators/NoNavToolsDecorator.js +25 -23
  243. package/src/decorators/ThemeDecorator.js +24 -0
  244. package/src/decorators/style.css +0 -2
  245. package/src/hooks/useCameraFollowPath/useCameraFollowPath.stories.tsx +13 -19
  246. package/src/hooks/useExportMap/lib.ts +1 -1
  247. package/src/hooks/useGpx/useGpx.stories.js +1 -1
  248. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +1 -1
  249. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +5 -4
  250. package/src/hooks/useMap.ts +1 -1
  251. package/src/hooks/useMapState.stories.js +1 -1
  252. package/src/hooks/useMapState.ts +6 -13
  253. package/src/hooks/useSource.ts +1 -1
  254. package/src/hooks/useSources.stories.js +1 -1
  255. package/src/index.ts +40 -8
  256. package/src/ui_components/LayerList/LayerList.stories.tsx +136 -0
  257. package/src/ui_components/LayerList/LayerList.tsx +12 -0
  258. package/src/ui_components/LayerList/LayerListFolder.tsx +82 -0
  259. package/src/ui_components/LayerList/LayerListItem.tsx +180 -0
  260. package/src/ui_components/LayerList/assets/sample_1.json +26 -0
  261. package/src/ui_components/LayerList/assets/sample_2.json +22 -0
  262. package/src/ui_components/LayerList/assets/sample_polygon_1.json +33 -0
  263. package/src/ui_components/LayerList/assets/style.json +2599 -0
  264. package/src/ui_components/LayerList/util/LayerListItemVectorLayer.tsx +92 -0
  265. package/src/ui_components/LayerList/util/LayerPropertyForm.tsx +125 -0
  266. package/src/ui_components/LayerList/util/input/ColorPicker.tsx +44 -0
  267. package/src/ui_components/MapcomponentsTheme.tsx +133 -0
  268. package/src/ui_components/Sidebar.tsx +16 -11
  269. package/src/ui_components/TopToolbar.tsx +1 -3
  270. package/src/util/BubbleForInstructions.js +14 -12
  271. package/tsconfig.json +3 -9
  272. package/dist/components/MlGPXViewer/MlGPXViewer.d.ts +0 -29
  273. package/dist/components/MlGPXViewer/MlGPXViewer.stories.d.ts +0 -16
  274. package/dist/components/MlGPXViewer/MlGPXViewer.test.d.ts +0 -1
  275. package/dist/components/MlGPXViewer/gpxConverter.d.ts +0 -11
  276. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +0 -10
  277. package/dist/components/MlGPXViewer/util/GeoJsonProvider.d.ts +0 -4
  278. package/dist/components/MlLayer/MlLayer.stories.d.ts +0 -10
  279. package/dist/custom.d.d.ts +0 -22
  280. package/dist/decorators/ThemeWrapper.d.ts +0 -3
  281. package/dist/hooks/exportMap/index.d.ts +0 -11
  282. package/dist/hooks/exportMap/lib.d.ts +0 -36
  283. package/dist/ui_components/Legend.d.ts +0 -1
  284. package/dist/ui_components/LoadingOverlay.d.ts +0 -2
  285. package/src/components/MlShareMapState/MlShareMapState.stories.js +0 -100
  286. package/src/custom.d.tsx +0 -26
  287. package/src/decorators/ThemeWrapper.tsx +0 -9
@@ -1,49 +1,52 @@
1
1
  import React, { useState } from "react";
2
2
 
3
- import MapLibreMap from "./MapLibreMap";
4
- import { MapComponentsProvider } from "../../contexts/MapContext";
5
- import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
6
- import { Button } from "@mui/material";
7
- import TopToolbar from "../../ui_components/TopToolbar";
8
- import sample_geojson_1 from "../MlGeoJsonLayer/assets/sample_1.json";
3
+ import MapLibreMap from './MapLibreMap';
4
+ import MlGeoJsonLayer from '../MlGeoJsonLayer/MlGeoJsonLayer';
5
+ import { Button } from '@mui/material';
6
+ import TopToolbar from '../../ui_components/TopToolbar';
7
+ import sample_geojson_1 from '../MlGeoJsonLayer/assets/sample_1.json';
8
+
9
+ import themeDecorator from '../../decorators/ThemeDecorator';
9
10
 
10
11
  const storyoptions = {
11
- title: "Core/MapLibreMap",
12
+ title: 'Core/MapLibreMap',
12
13
  component: MapLibreMap,
13
14
  argTypes: {
14
15
  options: {
15
16
  control: {
16
- type: "object",
17
+ type: 'object',
17
18
  },
18
19
  },
19
20
  },
21
+ decorators: themeDecorator,
22
+ parameters: {
23
+ sourceLink: 'components/MapLibreMap/MapLibreMap.tsx',
24
+ },
20
25
  };
21
26
  export default storyoptions;
22
27
 
23
28
  const Template = (args) => {
24
29
  return (
25
- <MapComponentsProvider>
26
- <MapLibreMap
27
- options={args.options}
28
- style={{
29
- position: "absolute",
30
- height: "100vh",
31
- width: "100vw",
32
- top: 0,
33
- right: 0,
34
- left: 0,
35
- bottom: 0,
36
- zIndex: 100,
37
- }}
38
- />
39
- </MapComponentsProvider>
30
+ <MapLibreMap
31
+ options={{ ...args.options }}
32
+ style={{
33
+ position: 'absolute',
34
+ height: '100vh',
35
+ width: '100vw',
36
+ top: 0,
37
+ right: 0,
38
+ left: 0,
39
+ bottom: 0,
40
+ zIndex: 100,
41
+ }}
42
+ />
40
43
  );
41
44
  };
42
45
 
43
46
  export const ExampleConfig = Template.bind({});
44
47
  ExampleConfig.args = {
45
48
  options: {
46
- style: "https://wms.wheregroup.com/tileserver/style/osm-bright.json",
49
+ style: 'https://wms.wheregroup.com/tileserver/style/osm-bright.json',
47
50
  center: [8.607, 53.1409349],
48
51
  zoom: 14,
49
52
  },
@@ -51,23 +54,26 @@ ExampleConfig.args = {
51
54
 
52
55
  const StyleChangeTemplate = (args) => {
53
56
  const [activeStyle, setActiveStyle] = useState(
54
- "https://wms.wheregroup.com/tileserver/style/osm-fiord-color.json"
57
+ 'https://wms.wheregroup.com/tileserver/style/osm-fiord-color.json'
55
58
  );
56
59
 
57
60
  return (
58
- <MapComponentsProvider>
61
+ <>
59
62
  <TopToolbar>
60
63
  <Button
61
64
  onClick={() =>
62
- setActiveStyle("https://wms.wheregroup.com/tileserver/style/osm-bright.json")
65
+ setActiveStyle('https://wms.wheregroup.com/tileserver/style/osm-bright.json')
63
66
  }
67
+ variant="contained"
68
+ sx={{ marginRight: '5px' }}
64
69
  >
65
70
  OSM-Bright
66
71
  </Button>
67
72
  <Button
68
73
  onClick={() =>
69
- setActiveStyle("https://wms.wheregroup.com/tileserver/style/osm-fiord-color.json")
74
+ setActiveStyle('https://wms.wheregroup.com/tileserver/style/osm-fiord-color.json')
70
75
  }
76
+ variant="contained"
71
77
  >
72
78
  OSM-Fiord-Color
73
79
  </Button>
@@ -75,9 +81,9 @@ const StyleChangeTemplate = (args) => {
75
81
  <MapLibreMap
76
82
  options={{ ...args.options, style: activeStyle }}
77
83
  style={{
78
- position: "absolute",
79
- height: "100vh",
80
- width: "100vw",
84
+ position: 'absolute',
85
+ height: '100vh',
86
+ width: '100vw',
81
87
  top: 0,
82
88
  right: 0,
83
89
  left: 0,
@@ -86,7 +92,7 @@ const StyleChangeTemplate = (args) => {
86
92
  }}
87
93
  />
88
94
  <MlGeoJsonLayer type="line" geojson={sample_geojson_1} />
89
- </MapComponentsProvider>
95
+ </>
90
96
  );
91
97
  };
92
98
 
@@ -1,10 +1,10 @@
1
- import React, { useRef, useEffect, useContext, FC, RefObject } from "react";
1
+ import React, { useRef, useEffect, useContext, FC, RefObject } from 'react';
2
2
 
3
- import MapContext from "../../contexts/MapContext";
4
- import MapLibreGlWrapper from "./lib/MapLibreGlWrapper";
3
+ import MapContext, { MapContextType } from '../../contexts/MapContext';
4
+ import MapLibreGlWrapper from './lib/MapLibreGlWrapper';
5
5
 
6
- import { MapOptions as MapOptionsType } from "maplibre-gl";
7
- import "maplibre-gl/dist/maplibre-gl.css";
6
+ import { MapOptions as MapOptionsType, Map } from 'maplibre-gl';
7
+ import 'maplibre-gl/dist/maplibre-gl.css';
8
8
 
9
9
  type MapLibreMapProps = {
10
10
  /**
@@ -31,16 +31,18 @@ const defaultProps: MapLibreMapProps = {
31
31
  container: '',
32
32
  style: {
33
33
  version: 8,
34
- name: "blank",
34
+ name: 'blank',
35
35
  center: [0, 0],
36
36
  zoom: 0,
37
37
  sources: {},
38
+ sprite: 'https://wms.wheregroup.com/tileserver/sprites/osm-bright',
39
+ glyphs: 'https://wms.wheregroup.com/tileserver/fonts/{fontstack}/{range}.pbf',
38
40
  layers: [
39
41
  {
40
- id: "background",
41
- type: "background",
42
+ id: '_background',
43
+ type: 'background',
42
44
  paint: {
43
- "background-color": "rgba(0,0,0,0)",
45
+ 'background-color': 'rgba(0,0,0,0)',
44
46
  },
45
47
  },
46
48
  ],
@@ -59,22 +61,22 @@ const defaultProps: MapLibreMapProps = {
59
61
  * @category Map components
60
62
  */
61
63
  const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
62
- const map: any = useRef<MapLibreGlWrapper>(null);
64
+ const map = useRef<MapLibreGlWrapper>();
63
65
  const mapContainer = useRef<HTMLDivElement>();
64
66
 
65
- const mapContext: any = useContext<MapContextType>(MapContext);
67
+ const mapContext = useContext<MapContextType>(MapContext);
66
68
 
67
69
  const mapIdRef = useRef(props.mapId);
68
70
  const initializedRef = useRef(false);
69
71
  const currentStyle = useRef(props.options?.style);
70
72
 
71
73
  useEffect(() => {
72
- let mapId = mapIdRef.current;
74
+ const mapId = mapIdRef.current;
73
75
 
74
76
  return () => {
75
77
  mapContext.removeMap(mapId);
76
- map.current?.remove?.();
77
- map.current = null;
78
+ map.current?.map?.remove?.();
79
+ map.current = undefined;
78
80
  };
79
81
  }, []);
80
82
 
@@ -86,11 +88,12 @@ const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
86
88
  map.current = new MapLibreGlWrapper({
87
89
  mapOptions: {
88
90
  style: '',
89
- container: mapContainer.current,
90
91
  ...props.options,
92
+ ...(props?.options?.style ? {} : { style: defaultProps?.options?.style }),
93
+ container: mapContainer.current,
91
94
  },
92
- onReady: (map: any, wrapper: any) => {
93
- map.once("load", () => {
95
+ onReady: (map: Map, wrapper: MapLibreGlWrapper) => {
96
+ map.once('load', () => {
94
97
  if (props.mapId) {
95
98
  mapContext.registerMap(props.mapId, wrapper);
96
99
  } else {
@@ -104,14 +107,19 @@ const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
104
107
 
105
108
  useEffect(() => {
106
109
  if (map.current?.map && props?.options?.style && currentStyle.current !== props.options.style) {
107
- console.log("set style");
110
+ console.log('set style');
108
111
  currentStyle.current = props.options.style;
109
112
  map.current.map.setStyle(props.options.style);
110
113
  }
111
- // @ts-ignore: props.options is either passed or populated with default values
112
- }, [props.options.style])
114
+ }, [props?.options?.style]);
113
115
 
114
- return <div ref={mapContainer as RefObject<HTMLDivElement>} className="mapContainer" style={props.style} />;
116
+ return (
117
+ <div
118
+ ref={mapContainer as RefObject<HTMLDivElement>}
119
+ className="mapContainer"
120
+ style={props.style}
121
+ />
122
+ );
115
123
  };
116
124
 
117
125
  MapLibreMap.defaultProps = defaultProps;
@@ -9,7 +9,8 @@ import {
9
9
  CustomLayerInterface,
10
10
  SourceSpecification,
11
11
  ControlPosition,
12
- } from '!maplibre-gl';
12
+ StyleImageMetadata,
13
+ } from 'maplibre-gl';
13
14
  import { Map as MapType, Style } from 'maplibre-gl';
14
15
 
15
16
  type WrapperEventArgArray = [string, (arg0: unknown) => void];
@@ -39,6 +40,34 @@ type ViewportState = {
39
40
  * @class
40
41
  */
41
42
 
43
+ interface MapLibreGlWrapper extends MapType {
44
+ addImage: (
45
+ id: string,
46
+ image:
47
+ | HTMLImageElement
48
+ | ImageBitmap
49
+ | ImageData
50
+ | {
51
+ width: number;
52
+ height: number;
53
+ data: Uint8Array | Uint8ClampedArray;
54
+ }
55
+ | StyleImageInterface,
56
+ key?: Partial<StyleImageMetadata> | string | undefined,
57
+ componentId?: string | undefined
58
+ ) => this;
59
+ addLayer: (
60
+ layer:
61
+ | (LayerSpecification & {
62
+ source?: string | SourceSpecification | undefined;
63
+ })
64
+ | (CustomLayerInterface & {
65
+ source?: string | SourceSpecification | undefined;
66
+ }),
67
+ beforeId?: string | undefined,
68
+ componentId?: string | undefined
69
+ ) => this;
70
+ }
42
71
  class MapLibreGlWrapper {
43
72
  registeredElements: {
44
73
  [key: string]: {
@@ -90,42 +119,21 @@ class MapLibreGlWrapper {
90
119
  initRegisteredElements: (componentId: string, force?: boolean | undefined) => void;
91
120
  addNativeMaplibreFunctionsAndProps: () => void;
92
121
  map: MapType;
93
- style: object;
122
+ style: Style;
94
123
 
95
124
  styleJson: object;
96
- addLayer: (
97
- layer:
98
- | (LayerSpecification & {
99
- source?: string | SourceSpecification | undefined;
100
- })
101
- | (CustomLayerInterface & {
102
- source?: string | SourceSpecification | undefined;
103
- }),
104
- beforeId?: string | undefined,
105
- componentId?: string | undefined
106
- ) => Map | undefined;
107
- addSource: (id: string, source: SourceSpecification,componentId?: string | undefined) => Map | undefined;
108
- addControl: (control: IControl | unknown, position?: ControlPosition | undefined,componentId?: string | undefined) => Map | undefined;
109
- addImage: (
110
- id: string,
111
- image:
112
- | HTMLImageElement
113
- | ImageBitmap
114
- | ImageData
115
- | {
116
- width: number;
117
- height: number;
118
- data: Uint8Array | Uint8ClampedArray;
119
- }
120
- | StyleImageInterface,
125
+ addSource: (id: string, source: SourceSpecification, componentId?: string | undefined) => this;
126
+ addControl: (
127
+ control: IControl | unknown,
128
+ position?: ControlPosition | undefined,
121
129
  componentId?: string | undefined
122
- ) => void;
130
+ ) => this;
123
131
  on: (
124
132
  type: keyof MapLayerEventType | keyof MapEventType | string,
125
133
  layerId: string | ((ev: unknown) => void),
126
134
  handler?: ((ev: MapEventType & unknown) => Map | void) | string,
127
135
  componentId?: string | undefined
128
- ) => Map | undefined;
136
+ ) => this;
129
137
  cleanup: (componentId: string) => void;
130
138
 
131
139
  constructor(props: {
@@ -367,7 +375,7 @@ class MapLibreGlWrapper {
367
375
  */
368
376
  this.addLayer = (layer, beforeId, componentId) => {
369
377
  if (!self.map.style) {
370
- return;
378
+ return this;
371
379
  }
372
380
  if (componentId && typeof componentId === 'string' && typeof layer.id !== 'undefined') {
373
381
  self.initRegisteredElements(componentId);
@@ -379,7 +387,7 @@ class MapLibreGlWrapper {
379
387
  }
380
388
 
381
389
  self.map.addLayer(layer, beforeId);
382
- return self.map;
390
+ return this;
383
391
  };
384
392
 
385
393
  /**
@@ -393,7 +401,7 @@ class MapLibreGlWrapper {
393
401
  */
394
402
  this.addSource = (sourceId, source, componentId) => {
395
403
  if (!self.map.style) {
396
- return;
404
+ return this;
397
405
  }
398
406
  if (componentId && typeof componentId === 'string' && typeof sourceId !== 'undefined') {
399
407
  self.initRegisteredElements(componentId);
@@ -401,7 +409,7 @@ class MapLibreGlWrapper {
401
409
  }
402
410
 
403
411
  self.map.addSource(sourceId, source);
404
- return self.map;
412
+ return this;
405
413
  };
406
414
 
407
415
  /**
@@ -411,18 +419,21 @@ class MapLibreGlWrapper {
411
419
  * @param {*} image
412
420
  * @param {*} ref
413
421
  * @param {string} componentId
414
- * @returns {undefined}
415
422
  */
416
- this.addImage = (id, image, componentId) => {
423
+ this.addImage = (id, image, meta, componentId) => {
417
424
  if (!self.map.style) {
418
- return;
425
+ return this;
426
+ }
427
+ if (typeof meta === 'string' && typeof componentId === 'undefined') {
428
+ return self.addImage(id, image, undefined, meta);
419
429
  }
420
430
  if (componentId && typeof componentId === 'string' && typeof id !== 'undefined') {
421
431
  self.initRegisteredElements(componentId);
422
432
  self.registeredElements[componentId].images.push(id);
423
433
  }
424
434
 
425
- self.map.addImage(id, image);
435
+ self.map.addImage(id, image, meta as Partial<StyleImageMetadata> | undefined);
436
+ return this;
426
437
  };
427
438
 
428
439
  /**
@@ -456,7 +467,7 @@ class MapLibreGlWrapper {
456
467
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
457
468
  // @ts-ignore
458
469
  self.map.on(..._arguments);
459
- return self.map;
470
+ return this;
460
471
  };
461
472
 
462
473
  /**
@@ -473,7 +484,7 @@ class MapLibreGlWrapper {
473
484
  }
474
485
 
475
486
  self.map.addControl(control as IControl, position);
476
- return self.map;
487
+ return this;
477
488
  };
478
489
 
479
490
  /**
@@ -675,7 +686,6 @@ class MapLibreGlWrapper {
675
686
  initializeMapLibre();
676
687
  }
677
688
  }
678
-
679
689
  export default MapLibreGlWrapper;
680
690
 
681
691
  export type { LayerState, ViewportState };
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useCallback } from "react";
2
2
  import useMap from "../../hooks/useMap";
3
- import { Button, SxProps, Theme } from "@mui/material";
4
- import GpsFixedIcon from "@mui/icons-material/GpsFixed";
3
+ import { Button, SxProps, Theme } from '@mui/material';
4
+ import GpsFixedIcon from '@mui/icons-material/GpsFixed';
5
5
 
6
6
  export interface MlCenterPositionProps {
7
7
  /**
@@ -36,51 +36,44 @@ const MlCenterPosition = (props: MlCenterPositionProps) => {
36
36
  mapId: props.mapId,
37
37
  waitForLayer: props.insertBeforeLayer,
38
38
  });
39
+
39
40
  const [locationAccessDenied, setLocationAccessDenied] = useState(false);
40
41
 
41
42
  const centerCurrentLocation = () => {
42
43
  navigator.geolocation.getCurrentPosition(getLocationSuccess, getLocationError);
43
44
  };
44
45
 
45
- const getLocationSuccess = useCallback((location) => {
46
- mapHook.map?.map.setCenter?.([location.coords.longitude, location.coords.latitude]);
47
- }, [mapHook.map]);
46
+ const getLocationSuccess = useCallback(
47
+ (location: GeolocationPosition) => {
48
+ mapHook.map?.map.setCenter?.([location.coords.longitude, location.coords.latitude]);
49
+ },
50
+ [mapHook.map]
51
+ );
48
52
 
49
53
  const getLocationError = () => {
50
- console.log("Access of user location denied");
54
+ console.log('Access of user location denied');
51
55
  setLocationAccessDenied(true);
52
56
  };
53
- return <>
54
- <Button
57
+ return (
58
+ <>
59
+ <Button
60
+ variant="navtools"
55
61
  sx={{
56
62
  zIndex: 1002,
57
63
  color: !locationAccessDenied ? props.onColor : props.offColor,
58
- ...props.style,
59
64
  }}
60
- onClick={centerCurrentLocation} disabled={locationAccessDenied}>
61
- <GpsFixedIcon sx={{ ...(props.style?.['fontSize']?{fontSize: props.style?.['fontSize']}:{}) }} />{" "}
65
+ onClick={centerCurrentLocation}
66
+ disabled={locationAccessDenied}
67
+ >
68
+ <GpsFixedIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
62
69
  </Button>
63
- </>;
64
-
70
+ </>
71
+ );
65
72
  };
66
73
 
67
74
  MlCenterPosition.defaultProps = {
68
75
  mapId: undefined,
69
- style: {
70
- minWidth: "30px",
71
- minHeight: "30px",
72
- width: "30px",
73
- height: "30px",
74
- backgroundColor: "#414141",
75
- borderRadius: "23%",
76
- margin: 0.15,
77
- fontSize: "1.3em",
78
- ":hover": {
79
- backgroundColor: "#515151",
80
- color: "#ececec",
81
- },
82
- },
83
- onColor: "#ececec",
84
- offColor: "#666",
76
+ onColor: '#ececec',
77
+ offColor: '#666',
85
78
  };
86
79
  export default MlCenterPosition;
@@ -188,7 +188,7 @@ export default function PdfForm(props: PdfFormProps) {
188
188
  <Select
189
189
  labelId="quality-select-label"
190
190
  id="quality-select"
191
- label="Qualität"
191
+ label="Quality"
192
192
  value={pdfContext.quality}
193
193
  onChange={(event) => {
194
194
  pdfContext.setQuality?.(event.target.value);
@@ -202,11 +202,11 @@ export default function PdfForm(props: PdfFormProps) {
202
202
  </Select>
203
203
  </FormControl>
204
204
  <FormControl fullWidth sx={formControlStyles}>
205
- <InputLabel id="quality-select-label">Scale</InputLabel>
205
+ <InputLabel id="scale-select-label">Scale</InputLabel>
206
206
  <Select
207
- labelId="quality-select-label"
208
- id="quality-select"
209
- label="Qualität"
207
+ labelId="scale-select-label"
208
+ id="scale-select"
209
+ label="Scale"
210
210
  value={pdfContext?.options?.fixedScale}
211
211
  onChange={(event) => {
212
212
  pdfContext.setOptions?.((val) => ({
@@ -229,7 +229,7 @@ export default function PdfForm(props: PdfFormProps) {
229
229
  onClick={createPdfHandler}
230
230
  disabled={loading}
231
231
  >
232
- PDF erstellen
232
+ create PDF
233
233
  </Button>
234
234
  {loading && (
235
235
  <CircularProgress
@@ -1,22 +1,40 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
 
3
- import MlFollowGps from "./MlFollowGps";
3
+ import MlFollowGps from './MlFollowGps';
4
4
 
5
- import mapContextDecorator from "../../decorators/MapContextDecorator";
5
+ import noNavToolsDecorator from '../../decorators/NoNavToolsDecorator';
6
+ import useMediaQuery from '@mui/material/useMediaQuery';
6
7
 
7
8
  const storyoptions = {
8
- title: "MapComponents/MlFollowGps",
9
+ title: 'MapComponents/MlFollowGps',
9
10
  component: MlFollowGps,
10
- argTypes: {
11
- },
12
- decorators: mapContextDecorator,
11
+ argTypes: {},
12
+ decorators: noNavToolsDecorator,
13
13
  };
14
14
  export default storyoptions;
15
15
 
16
- const Template = (props) => <MlFollowGps {...props}/>;
17
-
16
+ const Template = (props) => {
17
+ const mediaIsMobile = useMediaQuery('(max-width:900px)');
18
+ return (
19
+ <>
20
+ <div
21
+ style={{
22
+ position: 'fixed',
23
+ right: '11px',
24
+ bottom: mediaIsMobile ? '130px' : '45px',
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ gap: '5px',
28
+ zIndex: 1000,
29
+ }}
30
+ >
31
+ <MlFollowGps {...props} />
32
+ </div>
33
+ </>
34
+ );
35
+ };
18
36
  export const ExampleConfig = Template.bind({});
19
37
  ExampleConfig.parameters = {};
20
38
  ExampleConfig.args = {
21
- followUserPosition: false
39
+ followUserPosition: false,
22
40
  };