@mapcomponents/react-maplibre 0.1.48 → 0.1.49

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 (329) hide show
  1. package/.github/workflows/node_version_test.yml +2 -1
  2. package/README.md +61 -150
  3. package/coverage/clover.xml +181 -178
  4. package/coverage/coverage-final.json +6 -6
  5. package/coverage/lcov-report/index.html +26 -26
  6. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +25 -25
  7. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  8. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  9. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  10. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +69 -63
  11. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +18 -18
  12. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  16. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +1 -1
  17. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
  18. package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  21. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  22. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  23. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  24. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  25. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
  26. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  27. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
  28. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  29. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  30. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  31. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  33. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  34. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  35. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  36. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  37. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  38. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  39. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
  40. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
  41. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  42. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  44. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  45. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  47. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
  49. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  51. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
  53. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  56. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
  57. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
  58. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  59. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  60. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  61. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  62. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
  63. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
  64. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
  65. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  66. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  67. package/coverage/lcov-report/src/contexts/index.html +1 -1
  68. package/coverage/lcov-report/src/hooks/index.html +15 -15
  69. package/coverage/lcov-report/src/hooks/useLayer.ts.html +60 -60
  70. package/coverage/lcov-report/src/hooks/useMap.ts.html +25 -25
  71. package/coverage/lcov-report/src/hooks/useMapState.ts.html +28 -28
  72. package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
  73. package/coverage/lcov-report/src/index.html +1 -1
  74. package/coverage/lcov-report/src/index.ts.html +1 -1
  75. package/coverage/lcov.info +320 -311
  76. package/dist/components/MapLibreMap/MapLibreMap.d.ts +31 -0
  77. package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +15 -0
  78. package/dist/components/MapLibreMap/MapLibreMap.test.d.ts +1 -0
  79. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +75 -0
  80. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.test.d.ts +1 -0
  81. package/dist/components/MlBasicComponent.d.ts +5 -0
  82. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +22 -0
  83. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +10 -0
  84. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +21 -0
  85. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +10 -0
  86. package/dist/components/MlCreatePdfButton/lib/createPdf.d.ts +2 -0
  87. package/dist/components/MlCreatePdfButton/lib/nominatimMap.d.ts +2 -0
  88. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +35 -0
  89. package/dist/components/MlFeatureEditor/MlFeatureEditor.stories.d.ts +15 -0
  90. package/dist/components/MlFeatureEditor/MlFeatureEditor.test.d.ts +1 -0
  91. package/dist/components/MlFeatureEditor/custom-direct-select-mode.d.ts +37 -0
  92. package/dist/components/MlFeatureEditor/custom-polygon-mode.d.ts +16 -0
  93. package/dist/components/MlFeatureEditor/custom-select-mode.d.ts +37 -0
  94. package/dist/components/MlFeatureEditor/lib/common_selectors.d.ts +11 -0
  95. package/dist/components/MlFeatureEditor/lib/constants.d.ts +85 -0
  96. package/dist/components/MlFeatureEditor/lib/constrain_feature_movement.d.ts +2 -0
  97. package/dist/components/MlFeatureEditor/lib/create_midpoint.d.ts +15 -0
  98. package/dist/components/MlFeatureEditor/lib/create_supplementary_points.d.ts +2 -0
  99. package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +13 -0
  100. package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +7 -0
  101. package/dist/components/MlFeatureEditor/lib/euclidean_distance.d.ts +5 -0
  102. package/dist/components/MlFeatureEditor/lib/features_at.d.ts +7 -0
  103. package/dist/components/MlFeatureEditor/lib/get_features_and_set_cursor.d.ts +1 -0
  104. package/dist/components/MlFeatureEditor/lib/is_click.d.ts +1 -0
  105. package/dist/components/MlFeatureEditor/lib/is_event_at_coordinates.d.ts +6 -0
  106. package/dist/components/MlFeatureEditor/lib/is_tap.d.ts +3 -0
  107. package/dist/components/MlFeatureEditor/lib/map_event_to_bounding_box.d.ts +12 -0
  108. package/dist/components/MlFeatureEditor/lib/mode_handler.d.ts +24 -0
  109. package/dist/components/MlFeatureEditor/lib/mouse_event_point.d.ts +11 -0
  110. package/dist/components/MlFeatureEditor/lib/move_features.d.ts +2 -0
  111. package/dist/components/MlFeatureEditor/lib/sort_features.d.ts +2 -0
  112. package/dist/components/MlFeatureEditor/lib/string_set.d.ts +21 -0
  113. package/dist/components/MlFeatureEditor/lib/string_sets_are_equal.d.ts +5 -0
  114. package/dist/components/MlFeatureEditor/lib/theme.d.ts +88 -0
  115. package/dist/components/MlFeatureEditor/lib/to_dense_array.d.ts +12 -0
  116. package/dist/components/MlFeatureEditor/lib/utils.d.ts +10 -0
  117. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +61 -0
  118. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.d.ts +10 -0
  119. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.test.d.ts +1 -0
  120. package/dist/components/MlFollowGps/MlFollowGps.d.ts +80 -0
  121. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +10 -0
  122. package/dist/components/MlFollowGps/MlFollowGps.test.d.ts +1 -0
  123. package/dist/components/MlGPXViewer/MlGPXViewer.d.ts +29 -0
  124. package/dist/components/MlGPXViewer/MlGPXViewer.stories.d.ts +16 -0
  125. package/dist/components/MlGPXViewer/MlGPXViewer.test.d.ts +1 -0
  126. package/dist/components/MlGPXViewer/gpxConverter.d.ts +11 -0
  127. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +10 -0
  128. package/dist/components/MlGPXViewer/util/GeoJsonProvider.d.ts +4 -0
  129. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +69 -0
  130. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +12 -0
  131. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.test.d.ts +1 -0
  132. package/dist/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.d.ts +2 -0
  133. package/dist/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +2 -0
  134. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +29 -0
  135. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +10 -0
  136. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.test.d.ts +1 -0
  137. package/dist/components/MlLayer/MlLayer.d.ts +26 -0
  138. package/dist/components/MlLayer/MlLayer.stories.d.ts +10 -0
  139. package/dist/components/MlLayer/MlLayer.test.d.ts +1 -0
  140. package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +27 -0
  141. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +10 -0
  142. package/dist/components/MlLayerMagnify/MlLayerMagnify.test.d.ts +1 -0
  143. package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +16 -0
  144. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +11 -0
  145. package/dist/components/MlLayerSwipe/MlLayerSwipe.test.d.ts +1 -0
  146. package/dist/components/MlLayerSwitcher/MlLayerSwitcher.d.ts +30 -0
  147. package/dist/components/MlLayerSwitcher/MlLayerSwitcher.stories.d.ts +13 -0
  148. package/dist/components/MlLayerSwitcher/components/LayerBox.d.ts +6 -0
  149. package/dist/components/MlMarker/MlMarker.d.ts +33 -0
  150. package/dist/components/MlMarker/MlMarker.stories.d.ts +9 -0
  151. package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +20 -0
  152. package/dist/components/MlMeasureTool/MlMeasureTool.stories.d.ts +11 -0
  153. package/dist/components/MlNavigationCompass/MlNavigationCompass.d.ts +47 -0
  154. package/dist/components/MlNavigationCompass/MlNavigationCompass.stories.d.ts +10 -0
  155. package/dist/components/MlNavigationCompass/MlNavigationCompass.test.d.ts +1 -0
  156. package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +9 -0
  157. package/dist/components/MlNavigationTools/MlNavigationTools.stories.d.ts +13 -0
  158. package/dist/components/MlOsmLayer/MlOsmLayer.d.ts +18 -0
  159. package/dist/components/MlOsmLayer/MlOsmLayer.stories_.d.ts +16 -0
  160. package/dist/components/MlOsmLayer/MlOsmLayer.test.d.ts +1 -0
  161. package/dist/components/MlScaleReference/MlScaleReference.d.ts +2 -0
  162. package/dist/components/MlScaleReference/MlScaleReference.stories.d.ts +14 -0
  163. package/dist/components/MlShareMapState/MlShareMapState.d.ts +22 -0
  164. package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +10 -0
  165. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +20 -0
  166. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +16 -0
  167. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.d.ts +1 -0
  168. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.d.ts +15 -0
  169. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +16 -0
  170. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.test.d.ts +1 -0
  171. package/dist/components/MlThreeJsLayer/lib/GLTFLoader.d.ts +17 -0
  172. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +68 -0
  173. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.d.ts +13 -0
  174. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.test.d.ts +1 -0
  175. package/dist/components/MlTransitionGeoJsonLayer/util/transitionFunctions.d.ts +2 -0
  176. package/dist/components/MlUseMapDebugger/MlUseMapDebugger.d.ts +22 -0
  177. package/dist/components/MlUseMapDebugger/MlUseMapDebugger.stories.d.ts +13 -0
  178. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.d.ts +37 -0
  179. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.stories.d.ts +13 -0
  180. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.test.d.ts +1 -0
  181. package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.d.ts +22 -0
  182. package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +13 -0
  183. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +100 -0
  184. package/dist/components/MlWmsLayer/MlWmsLayer.stories.d.ts +13 -0
  185. package/dist/components/MlWmsLayer/MlWmsLayer.test.d.ts +1 -0
  186. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +48 -0
  187. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +13 -0
  188. package/dist/contexts/MapComponentsProvider.test.d.ts +1 -0
  189. package/dist/contexts/MapContext.d.ts +13 -0
  190. package/dist/contexts/SimpleDataContext.d.ts +4 -0
  191. package/dist/contexts/SimpleDataProvider.d.ts +8 -0
  192. package/dist/contexts/SimpleDataProvider.test.d.ts +1 -0
  193. package/dist/custom.d.d.ts +22 -0
  194. package/dist/decorators/MapContextDecorator.d.ts +2 -0
  195. package/dist/decorators/MultiMapContextDecorator.d.ts +2 -0
  196. package/dist/hooks/useLayer.d.ts +24 -0
  197. package/dist/hooks/useLayer.test.d.ts +1 -0
  198. package/dist/hooks/useMap.d.ts +14 -0
  199. package/dist/hooks/useMapState.d.ts +62 -0
  200. package/dist/hooks/useMapState.stories.d.ts +14 -0
  201. package/dist/hooks/useWms.d.ts +18 -0
  202. package/dist/index.d.ts +32 -0
  203. package/dist/index.esm.js +29 -22
  204. package/dist/index.esm.js.map +1 -1
  205. package/dist/setupTests.d.ts +12 -0
  206. package/dist/stories/components/Readme.d.ts +2 -0
  207. package/dist/ui_components/ImageLoader.d.ts +2 -0
  208. package/dist/ui_components/Legend.d.ts +1 -0
  209. package/dist/ui_components/LoadingOverlay.d.ts +2 -0
  210. package/dist/ui_components/LoadingOverlayContext.d.ts +11 -0
  211. package/dist/ui_components/Sidebar.d.ts +1 -0
  212. package/dist/ui_components/Tooltip.d.ts +1 -0
  213. package/dist/ui_components/TopToolbar.d.ts +1 -0
  214. package/dist/util/index.d.ts +3 -0
  215. package/dist/util/layerRemovalTest.d.ts +2 -0
  216. package/dist/util/sourceRemovalTest.d.ts +2 -0
  217. package/package.json +2 -1
  218. package/src/components/MapLibreMap/MapLibreMap.tsx +1 -1
  219. package/src/components/MlFeatureEditor/MlFeatureEditor.stories.js +1 -2
  220. package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +3 -3
  221. package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +37 -35
  222. package/src/components/MlFeatureEditor/lib/utils.js +1 -2
  223. package/src/components/MlWmsLoader/MlWmsLoader.stories.js +1 -1
  224. package/src/hooks/useLayer.test.js +205 -0
  225. package/tsconfig.json +35 -7
  226. package/docs-build/0.20735a16c2ad9677fe7d.manager.bundle.js +0 -1
  227. package/docs-build/0.968bdc5f.iframe.bundle.js +0 -2
  228. package/docs-build/0.968bdc5f.iframe.bundle.js.map +0 -1
  229. package/docs-build/1.3530bc86.iframe.bundle.js +0 -10
  230. package/docs-build/1.3530bc86.iframe.bundle.js.map +0 -1
  231. package/docs-build/17.c96fb6bc.iframe.bundle.js +0 -2
  232. package/docs-build/17.c96fb6bc.iframe.bundle.js.map +0 -1
  233. package/docs-build/18.0947f810.iframe.bundle.js +0 -17
  234. package/docs-build/18.0947f810.iframe.bundle.js.map +0 -1
  235. package/docs-build/19.44204e5a.iframe.bundle.js +0 -14
  236. package/docs-build/19.44204e5a.iframe.bundle.js.map +0 -1
  237. package/docs-build/2.c62e9630.iframe.bundle.js +0 -2
  238. package/docs-build/2.c62e9630.iframe.bundle.js.map +0 -1
  239. package/docs-build/20.50a2ad76.iframe.bundle.js +0 -2
  240. package/docs-build/20.50a2ad76.iframe.bundle.js.map +0 -1
  241. package/docs-build/21.ce55b70e.iframe.bundle.js +0 -4
  242. package/docs-build/21.ce55b70e.iframe.bundle.js.map +0 -1
  243. package/docs-build/22.639c6bb4.iframe.bundle.js +0 -22
  244. package/docs-build/22.639c6bb4.iframe.bundle.js.map +0 -1
  245. package/docs-build/3.afb0e0a5.iframe.bundle.js +0 -2
  246. package/docs-build/3.afb0e0a5.iframe.bundle.js.map +0 -1
  247. package/docs-build/4.8ac31bba1926f4f011b0.manager.bundle.js +0 -2
  248. package/docs-build/4.8ac31bba1926f4f011b0.manager.bundle.js.LICENSE.txt +0 -8
  249. package/docs-build/5.daf044a6c0f55d839078.manager.bundle.js +0 -1
  250. package/docs-build/6.99fba2cf6af0473f8209.manager.bundle.js +0 -2
  251. package/docs-build/6.99fba2cf6af0473f8209.manager.bundle.js.LICENSE.txt +0 -12
  252. package/docs-build/7.b6a48b90f61cb575c2e4.manager.bundle.js +0 -1
  253. package/docs-build/8.50518a5391398d9d5812.manager.bundle.js +0 -1
  254. package/docs-build/assets/3D/godzilla_simple.glb +0 -0
  255. package/docs-build/assets/dop.png +0 -0
  256. package/docs-build/assets/historic.png +0 -0
  257. package/docs-build/assets/marker.png +0 -0
  258. package/docs-build/assets/osm.png +0 -0
  259. package/docs-build/assets/sample.gpx +0 -716
  260. package/docs-build/catalogue/.gitkeep +0 -0
  261. package/docs-build/catalogue/mc_meta.json +0 -1
  262. package/docs-build/favicon.ico +0 -0
  263. package/docs-build/iframe.html +0 -348
  264. package/docs-build/index.html +0 -59
  265. package/docs-build/logo.png +0 -0
  266. package/docs-build/main.ef9704b1252e8efa56a0.manager.bundle.js +0 -1
  267. package/docs-build/main~24120820.e956ad2c.iframe.bundle.js +0 -2
  268. package/docs-build/main~24120820.e956ad2c.iframe.bundle.js.map +0 -1
  269. package/docs-build/manifest.json +0 -25
  270. package/docs-build/robots.txt +0 -3
  271. package/docs-build/runtime~main.6e6ed7dc9ea4785ef286.manager.bundle.js +0 -1
  272. package/docs-build/static/media/mapcomponents_logo.98b01a05.png +0 -0
  273. package/docs-build/static/media/wg-marker.bf3eeb2d.png +0 -0
  274. package/docs-build/thumbnails/MapLibreMap.png +0 -0
  275. package/docs-build/thumbnails/MlCameraFollowPath.png +0 -0
  276. package/docs-build/thumbnails/MlCreatePdfButton.png +0 -0
  277. package/docs-build/thumbnails/MlDeckGlLayer.png +0 -0
  278. package/docs-build/thumbnails/MlDeckGlTerrainLayer.png +0 -0
  279. package/docs-build/thumbnails/MlDemoDashboard.png +0 -0
  280. package/docs-build/thumbnails/MlFeatureEditor.png +0 -0
  281. package/docs-build/thumbnails/MlFillExtrusionLayer.png +0 -0
  282. package/docs-build/thumbnails/MlFollowGps.png +0 -0
  283. package/docs-build/thumbnails/MlGPXViewer.png +0 -0
  284. package/docs-build/thumbnails/MlGeoJsonLayer.png +0 -0
  285. package/docs-build/thumbnails/MlHillshadeLayer.png +0 -0
  286. package/docs-build/thumbnails/MlIconLayer.png +0 -0
  287. package/docs-build/thumbnails/MlLaermkarte.png +0 -0
  288. package/docs-build/thumbnails/MlLayerMagnify.png +0 -0
  289. package/docs-build/thumbnails/MlLayerSwipe.png +0 -0
  290. package/docs-build/thumbnails/MlMapDrawTools.png +0 -0
  291. package/docs-build/thumbnails/MlMeasureTool.png +0 -0
  292. package/docs-build/thumbnails/MlMobilerImker.png +0 -0
  293. package/docs-build/thumbnails/MlNavigationCompass.png +0 -0
  294. package/docs-build/thumbnails/MlNavigationTools.png +0 -0
  295. package/docs-build/thumbnails/MlOsmLayer.png +0 -0
  296. package/docs-build/thumbnails/MlScaleReference.png +0 -0
  297. package/docs-build/thumbnails/MlSpatialElevationProfile.png +0 -0
  298. package/docs-build/thumbnails/MlThreeJsLayer.png +0 -0
  299. package/docs-build/thumbnails/MlTransitionGeoJsonLayer.png +0 -0
  300. package/docs-build/thumbnails/MlVectorTileLayer.png +0 -0
  301. package/docs-build/thumbnails/MlWanderApp.png +0 -0
  302. package/docs-build/thumbnails/MlWmsLayer.png +0 -0
  303. package/docs-build/thumbnails/MlWmsLoader.png +0 -0
  304. package/docs-build/vendors~main.4b570b3072ba06ee44b5.manager.bundle.js +0 -2
  305. package/docs-build/vendors~main.4b570b3072ba06ee44b5.manager.bundle.js.LICENSE.txt +0 -104
  306. package/docs-build/vendors~main~0ad7406a.834c9ace.iframe.bundle.js +0 -8
  307. package/docs-build/vendors~main~0ad7406a.834c9ace.iframe.bundle.js.map +0 -1
  308. package/docs-build/vendors~main~0f485567.7297d057.iframe.bundle.js +0 -2
  309. package/docs-build/vendors~main~0f485567.7297d057.iframe.bundle.js.map +0 -1
  310. package/docs-build/vendors~main~41a6ab2c.19d97527.iframe.bundle.js +0 -2
  311. package/docs-build/vendors~main~41a6ab2c.19d97527.iframe.bundle.js.map +0 -1
  312. package/docs-build/vendors~main~52589227.cebbe724.iframe.bundle.js +0 -8
  313. package/docs-build/vendors~main~52589227.cebbe724.iframe.bundle.js.map +0 -1
  314. package/docs-build/vendors~main~57c1f6cb.8a8dd47e.iframe.bundle.js +0 -2
  315. package/docs-build/vendors~main~57c1f6cb.8a8dd47e.iframe.bundle.js.map +0 -1
  316. package/docs-build/vendors~main~73914085.2e61c0dc.iframe.bundle.js +0 -293
  317. package/docs-build/vendors~main~73914085.2e61c0dc.iframe.bundle.js.map +0 -1
  318. package/docs-build/vendors~main~9c5b28f6.32356887.iframe.bundle.js +0 -7
  319. package/docs-build/vendors~main~9c5b28f6.32356887.iframe.bundle.js.map +0 -1
  320. package/docs-build/vendors~main~b5906859.94dc520a.iframe.bundle.js +0 -21
  321. package/docs-build/vendors~main~b5906859.94dc520a.iframe.bundle.js.map +0 -1
  322. package/docs-build/vendors~main~b8f44717.8669cfb8.iframe.bundle.js +0 -89
  323. package/docs-build/vendors~main~b8f44717.8669cfb8.iframe.bundle.js.map +0 -1
  324. package/docs-build/vendors~main~b9cf3951.2a2025c3.iframe.bundle.js +0 -63
  325. package/docs-build/vendors~main~b9cf3951.2a2025c3.iframe.bundle.js.map +0 -1
  326. package/docs-build/vendors~main~d939e436.bb2b0303.iframe.bundle.js +0 -2
  327. package/docs-build/vendors~main~d939e436.bb2b0303.iframe.bundle.js.map +0 -1
  328. package/docs-build/vendors~main~f420d588.3481b43e.iframe.bundle.js +0 -107
  329. package/docs-build/vendors~main~f420d588.3481b43e.iframe.bundle.js.map +0 -1
@@ -12,7 +12,7 @@ jobs:
12
12
 
13
13
  strategy:
14
14
  matrix:
15
- node-versions: [10.x, 12.x, 14.x, 15.x, 16.x]
15
+ node-versions: [14.x, 15.x, 16.x]
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v2
@@ -23,3 +23,4 @@ jobs:
23
23
  node-version: ${{ matrix.node-version }}
24
24
  - run: yarn
25
25
  - run: yarn test:noninteractive
26
+ - run: yarn build
package/README.md CHANGED
@@ -6,196 +6,107 @@
6
6
 
7
7
  ![Tests](https://github.com/mapcomponents/react-map-components-maplibre/actions/workflows/node_version_test.yml/badge.svg)
8
8
 
9
+ @mapcomponents/react-maplibre is a react component library for declarative GIS application development.
10
+ ## Links
9
11
 
10
- ## Getting started (Using the storybook dev server)
12
+ - Documentation: https://mapcomponents.github.io/react-map-components-maplibre/
13
+ - Catalogue: https://www.mapcomponents.org/
11
14
 
12
- 1. Clone the repository and ```cd``` into the folder
13
- 2. Run ```yarn``` to install all dependencies.
14
- 3. Run ```yarn start``` to start the storybook server. It will watch files for changes and reload affected components. If cleanup functions are incomplete it might be required to reload the browser tab.
15
+ ## Getting started
15
16
 
16
- ### Create a new component
17
+ Use our Codesandbox template to quickly try out this library without any setup required. https://codesandbox.io/s/base-template-n0vp9
17
18
 
18
- 1. Run ```yarn create-component {component-name}``` to create a new map component based on ./src/components/MlComponentTemplate/. It has to start with a capital letter and preferably with the prefix "Ml" if it is a MapLibre component, to follow the naming conventions of this repository.
19
- 2. The new component should become available within your storybook webinterface. Start the component development inside the component file (former MlComponentTemplate.js) and see the changes reflected in your browser.
20
- 3. Once the component is ready to be published to the MapComponents catalogue, remove the ```_``` from the meta.json file ({component_name}.meta_.json) and to have it included in the next release.
19
+ ### **How to use @mapcomponents/react-maplibre in ...**
21
20
 
22
- ### Create a new example application
21
+ ### **... a new project**
23
22
 
24
- 1. Follow all steps of "Create a new component"
25
- 2. Change the value of the property "type" in {component_name}.meta.json to "application"
23
+ The easiest way to start a new project using this framework is to bootstrap a react application using our [create-react-app-template](https://github.com/mapcomponents/react-map-components-maplibre-cra-template).
26
24
 
27
- ## Project setup
25
+ **Requirements:**
28
26
 
29
- ### Starting a new project
27
+ 1. node.js >=16
28
+ 2. yarn
30
29
 
31
- Fork our codesandbox project setup template to get started instantly. https://codesandbox.io/s/base-template-n0vp9
30
+ Run the following commands in the terminal:
32
31
 
33
- ### Integrate MapComponents into an existing react project
32
+ 1. `npx create-react-app {your-app-name} --template @mapcomponents/cra-template`
33
+ 2. `cd {your-app-name}`
34
+ 3. `yarn start`
34
35
 
35
- 1. Add the dependency ```yarn add @mapcomponents/react-maplibre```
36
- 2. Add a MapcomponentsProvider to your react-dom (e.g. https://codesandbox.io/s/base-template-n0vp9?file=/src/index.js)
37
- 3. Add a MapLibreMap and any MapComponent you like to use in your app below MapcomponentsProvider.
38
- ## Anatomy of a MapComponent
36
+ This will start a development server that serves the mapcomponents app on port 3000 of your local machine as well as a browser tab with live reload enabled. This reloads the affected parts of the application if changes are detected to the corresponding files in the filesystem. Open the project folder in the IDE of your choice and start building your map client.
39
37
 
40
- A MapComponent is a react component that accepts at least 1 attribute "mapId" (there are some exceptions) and is expected to retrieve a maplibre-gl instance from mapContext and directly manipulate it or watch its state.
41
- An example implementation of basic required functions for the maplibre instance retrieval process using the functions getMap, mapExists provided by mapContext, both accepting "mapId" (string) as parameter, can be seen in ./components/MlComponentTemplate/MlComponentTemplate.js.
42
- If no attribute mapId is provided the map component is expected to work with the map instance provided by mapContext at ```mapContext.map``` (it is recommended to retrieve it using ```mapContext.getMap(props.mapId)```).
38
+ ### **... an existing react project**
43
39
 
40
+ In this case, navigate to your project folder in a terminal and execute the following steps:
44
41
 
45
- ### File structure
42
+ 1. Add @mapcomponents/react-maplibre as a dependency to your project using `yarn add @mapcomponents/react-maplibre` or `npm i @mapcomponents/react-maplibre` depending on which package manager you prefer.
43
+ 2. Add the MapComponentsProvider (named export of this module) to your applications react-DOM where it makes sense. Only children of this component will be able to render a map canvas or interact with a maplibre-gl instance. Place it in the index.js entrypoint if your application is a dedicated map app and all components have a high probability to interact with the maplibre-gl instance. Place it somewhere higher in the JSX tree if the map constitutes only a small portion of your app and components outside of the MapComponentsProvider have no need to interact with the map instance.
44
+ 3. Add a MapLibreMap component to the react-DOM wherever the map canvas is supposed to be placed.
46
45
 
47
- ```
48
- ./src/components/{component_name}/
49
- ├── {component_name}.js // the only mandatory file is the component code
50
- ├── {component_name}.test.js // jest tests
51
- └── {component_name}.stories.js // Storybook & catalogue
52
- ├── {component_name}.doc.en.md // Catalogue only
53
- ├── {component_name}.doc.de.md // catalogue only
54
- ├── {component_name}.meta.json // catalogue only
55
- ```
46
+ ## How it works
47
+ ### Anatomy of a MapComponent
56
48
 
57
- ### {component_name}.js
49
+ A MapComponent is a react component that accepts at least 1 attribute "mapId" (there are some exceptions) and is expected to retrieve a maplibre-gl instance from mapContext and directly manipulate it or watch its state.
50
+ An example implementation of basic required functions for the maplibre instance retrieval process using the useMap hook, can be seen in [./components/MlComponentTemplate/MlComponentTemplate.tsx](https://github.com/mapcomponents/react-map-components-maplibre/blob/main/src/components/MlComponentTemplate/MlComponentTemplate.tsx)
51
+ If no attribute mapId is provided the map component is expected to work with the map instance provided by mapContext at ```mapContext.map``` (the first maplibre instance that is registered in MapContext).
58
52
 
59
- React component implementation
60
53
 
61
- #### Common conventions
54
+ ### Cleanup functions
62
55
 
63
- ##### Cleanup functions
56
+ Once a component is removed from reactDOM we need to make sure everything it has added to the maplibre-gl instance is removed with it. The mapHook offers a convenient way to do this.
64
57
 
65
- To make sure a component cleans up anything it has added to the MapLibre instance when it is removed from reactDOM declare a reference to the map instance using the useRef hook.
58
+ **- Retrieve the maplibre instance using the useMap hook**
66
59
 
67
- **- Reference declaration**
60
+ Add `mapHook.map` to the dependency array of e.g. a useEffect hook to trigger it once the map instance becomes available.
68
61
 
69
62
  ```js
70
- const mapRef = useRef(undefined);
71
- ```
72
-
73
- **- Component cleanup function**
74
63
 
75
- After everything has been undone set the map reference (mapRef.current) to undefined.
64
+ const mapHook = useMap({
65
+ mapId: props.mapId,
66
+ waitForLayer: props.insertBeforeLayer,
67
+ });
76
68
 
77
- ```js
78
69
  useEffect(() => {
79
- let _componentId = componentId.current;
80
-
81
- return () => {
82
- // This is the cleanup function, it is called when this react component is removed from react-dom
83
- if (mapRef.current) {
84
- mapRef.current.cleanup(_componentId);
85
-
86
- mapRef.current = undefined;
87
- }
88
- };
89
- }, []);
90
- ```
91
-
92
- **- Reference population**
93
-
94
- This happens within the effect that discovers the map instance for the first time (watch the mapContext.mapIds state variable for added or removed map engine instances).
95
-
96
- ```js
97
- useEffect(() => {
98
- if (!mapContext.mapExists(props.mapId) || initializedRef.current) return;
99
- // the MapLibre-gl instance (mapContext.map) is accessible here
100
- // initialize the layer and add it to the MapLibre-gl instance or do something else with it
101
-
102
- // set initializedRef.current to true to make sure this function gets only called once
103
- initializedRef.current = true;
104
-
105
- // populate the map reference
106
- mapRef.current = mapContext.getMap(props.mapId);
70
+ if (!mapHook.map) return;
71
+ // the MapLibre-gl instance (mapHook.map) is accessible here
72
+ // initialize the layer and add it to the MapLibre-gl instance
107
73
 
108
74
  // optionally add layers, sources, event listeners, controls, images to the MapLibre instance that are required by this component
109
- // see the next section about adding content to the MapLibre instance
110
-
111
- }, [mapContext.mapIds, mapContext, props, transitionToGeojson]);
112
- ```
75
+ mapHook.map.addLayer(
76
+ {/*layer-config*/},
77
+ props.insertBeforeLayer,
78
+ mapHook.componentId)
113
79
 
114
- **- addLayer, addSource, addImage, addControls, on**
115
-
116
- The function mentioned above have been overriden in the MapLibreGlWrapper instance that is returned by the mapContext.getMap(props.mapId) function.
117
- All five functions expect an additional optional parameter "component_id" (string) as last or optional parameter (except for the beforeLayerId parameter of the addLayer function, which should be defined as props.beforeLayerId to make sure the parent component is able to control the layer order).
118
- MapLibreGlWrapper uses the component_id to keep track of everything that has been added by a specific component (including implicitly added sources), enabling a safe and simple cleanup by calling ```mapRef.current.cleanup(component_id)``` as shown in the cleanup function example above.
119
-
120
- ### {component_name}.meta.json *//catalogue only*
121
-
122
- Additional meta data regarding the component, this file is required for the component to become listed in the catalogue
123
-
124
- ```json
125
- {
126
- "name": "{component_name}", // must be identical to the react component name (string)
127
- "title": "", // english component title (string)
128
- "description": "", // english short description (string)
129
- "i18n":{
130
- "de":{
131
- "title": "", // german component title (string)
132
- "description": "", // german short description (string)
80
+ return () => {
81
+ mapHook.cleanup();
133
82
  }
134
- },
135
- "tags": [ "Map add-on" ], // list of tags (Array<string>)
136
- "category": "add-ons", // category (string)
137
- "type": "component", // type "component" or "application" (string)
138
- }
139
- ```
140
83
 
141
- ### {component_name}.doc.en.md *//catalogue only*
142
- ### {component_name}.doc.de.md *//catalogue only*
84
+ }, [mapHook.map]);
143
85
 
144
- Description text, that is shown on the catalogue component detail page below the main image
145
-
146
- ### {component_name}.stories.js *//storybook only*
147
-
148
- Example implementation of a component in context with all required dependent components to showcase the basic functionality of a single component. Decorators to choose from are located in ./src/decorators/. During development the command ```yarn start``` will start a server (localhost:6006) with live reload functionality. In case of example applications the stories are used as a wrapper to make the application available in the storybook build that is later used to access working demos from within the catalogue.
149
-
150
- More information on writing storybook stories for react components: https://storybook.js.org/docs/react/get-started/browse-stories
151
-
152
- # Tests
153
-
154
- ```
155
- yarn test
156
86
  ```
87
+ **- Component cleanup function**
157
88
 
158
- will watch the filesystem for changes and run all jest tests for affected components.
159
-
160
-
161
- # Building the documentation
162
-
163
- Install the dependencies globally:
89
+ `mapHook.cleanup()` will remove all ressources from the maplibre-gl instance that have been added using `mapHook.componentId` as additional parameter in `map.addLayer`, `map.addSource`, `map.on`, `map.addImage` or `map.addControl` calls.
164
90
 
165
- ```
166
- yarn global add jsdoc parcel-bundler
167
- ```
168
-
169
- Build the documentation:
91
+ ```js
170
92
 
171
- ```
172
- yarn docs-create
173
- ```
93
+ useEffect(() => {
174
94
 
175
- Serve the documentation:
95
+ return () => {
96
+ // This is the cleanup function, it is called when this react component is removed from react-dom
97
+ mapHook.cleanup();
98
+ };
99
+ }, []);
176
100
 
177
101
  ```
178
- yarn docs-serve
179
- ```
180
-
181
- # Release NPM package
182
102
 
183
- The version property in package.json must not be adjusted manually.
184
- Once the main branch ist ready for a new release you can use one of:
185
-
186
- ```yarn version --patch```
187
-
188
-
189
- ```yarn version --minor```
190
-
191
-
192
- ```yarn version --major```
193
-
194
- to have yarn up the version number in package.json, create a new commit with the new version number as commit message and tag the commit with the same string (e.g. ```v0.1.15```).
103
+ **- addLayer, addSource, addImage, addControls, on**
195
104
 
196
- After pushing the commits to the repository remember to also push the tags using ```git push --tags```. A new tag starting with "v" pushed to the repository will trigger a github workflow that builds the npm release from the referenced branch.
197
- # Catalogue
105
+ The functions mentioned above have been overridden in the MapLibreGlWrapper instance that is referenced by mapHook.map.
106
+ All five functions expect an additional optional parameter "component_id" (string) as their last or optional parameter (except for the beforeLayerId parameter of the addLayer function, which should be defined as props.beforeLayerId to make sure the parent component is able to control the layer order).
107
+ A uuid `componentId` property is generated and available on the object returned by mapHook.
108
+ MapLibreGlWrapper uses the component_id to keep track of everything that has been added by a specific component (including implicitly added sources), enabling a safe and simple cleanup by calling ```mapHook.cleanup()``` as shown in the cleanup function example above.
198
109
 
199
- ## Screenshots
110
+ ## more links
200
111
 
201
- To make a component screenshot appear in the catalogue manually create a png like ./public/thumbnails/{component_name}.png and push it to the repository, it will be included in the catalogue in the next catalogue deployment.
112
+ - @mapcomponents/react-maplibre-lab storybook: https://mapcomponents.github.io/react-map-components-maplibre-lab