@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
@@ -0,0 +1,12 @@
1
+ export var uuid_regex: string;
2
+ export namespace mockMapLibreMethods {
3
+ const on: any;
4
+ const off: any;
5
+ const addControl: any;
6
+ const removeControl: any;
7
+ const hasControl: any;
8
+ function getCanvas(): HTMLCanvasElement;
9
+ function getContainer(): {
10
+ style: {};
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ export default Readme;
2
+ declare function Readme(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export default ImageLoader;
2
+ declare function ImageLoader(props: any): JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Legend(props: any): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export default LoadingOverlay;
2
+ declare function LoadingOverlay(): JSX.Element;
@@ -0,0 +1,11 @@
1
+ export const LoadingOverlayContext: React.Context<{}>;
2
+ export function LoadingOverlayProvider({ children }: {
3
+ children: any;
4
+ }): JSX.Element;
5
+ export namespace LoadingOverlayProvider {
6
+ namespace propTypes {
7
+ const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
8
+ }
9
+ }
10
+ import React from "react";
11
+ import PropTypes from "prop-types";
@@ -0,0 +1 @@
1
+ export default function Sidebar(props: any): JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Legend(props: any): JSX.Element;
@@ -0,0 +1 @@
1
+ export default function TopToolbar(props: any): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import layerRemovalTest from "./layerRemovalTest";
2
+ import sourceRemovalTest from "./sourceRemovalTest";
3
+ export { layerRemovalTest, sourceRemovalTest };
@@ -0,0 +1,2 @@
1
+ export default layerRemovalTest;
2
+ declare function layerRemovalTest(ComponentName: any, Component: any, regexLayerNameTest: any, humanReadableLayerName: any, beforeWrapperInit: any, afterWrapperInit: any, createWrapperFunction: any): void;
@@ -0,0 +1,2 @@
1
+ export default sourceRemovalTest;
2
+ declare function sourceRemovalTest(ComponentName: any, Component: any, regexLayerNameTest: any, humanReadableLayerName: any, beforeWrapperInit: any, afterWrapperInit: any): void;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@mapcomponents/react-maplibre",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.esm.js",
7
7
  "source": "src/index.ts",
8
+ "types": "dist/index.d.ts",
8
9
  "scripts": {
9
10
  "build": "rollup -c",
10
11
  "start": "start-storybook -p 6006 -s public",
@@ -16,7 +16,7 @@ type MapLibreMapProps = {
16
16
  * See https://maplibre.org/maplibre-gl-js-docs/api/map/ for a formal documentation of al
17
17
  * available properties.
18
18
  */
19
- options?: MapOptionsType;
19
+ options?: Partial<MapOptionsType>;
20
20
  /**
21
21
  * css style definition passed to the map container DOM element
22
22
  */
@@ -15,11 +15,10 @@ export default storyoptions;
15
15
  const Template = (args) => {
16
16
  return (
17
17
  <MlFeatureEditor
18
- debug={true}
18
+ {...args}
19
19
  onChange={(features) => {
20
20
  console.log(features);
21
21
  }}
22
- {...args}
23
22
  />
24
23
  );
25
24
  };
@@ -82,7 +82,7 @@ describe("<MlFeatureEditor>", () => {
82
82
  );
83
83
 
84
84
  // MapLibreGlWrapper now subscribes to "data", "move" events on its own
85
- await waitFor(() => expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(6));
85
+ await waitFor(() => expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(7));
86
86
  });
87
87
 
88
88
  it("should deregister 2 event listeners to the maplibre instance", async () => {
@@ -93,11 +93,11 @@ describe("<MlFeatureEditor>", () => {
93
93
  );
94
94
 
95
95
  // MapLibreGlWrapper now subscribes to "data", "move" events on its own
96
- expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(6);
96
+ expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(7);
97
97
 
98
98
  wrapper.find(".toggle_layer_visible").simulate("click");
99
99
 
100
- expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2);
100
+ expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(3);
101
101
  });
102
102
 
103
103
  it("should add MapBox-Gl-draw instance using map.addControl to the maplibre instance", async () => {
@@ -9,7 +9,6 @@ import CustomDirectSelectMode from "./custom-direct-select-mode.js";
9
9
 
10
10
  import useMap from "../../hooks/useMap";
11
11
 
12
-
13
12
  interface MlFeatureEditorProps {
14
13
  /**
15
14
  * Id of the target MapLibre instance in mapContext
@@ -28,7 +27,7 @@ interface MlFeatureEditorProps {
28
27
  * Callback function that is called each time the GeoJson data within has changed within MlFeatureEditor.
29
28
  * First parameter is the new GeoJson feature.
30
29
  */
31
- onChange?: Function
30
+ onChange?: Function;
32
31
  /**
33
32
  * Feature editor mode:
34
33
  * - "custom_select" edit features
@@ -36,40 +35,30 @@ interface MlFeatureEditorProps {
36
35
  * - "draw_point" draw Point
37
36
  * - "draw_line_string" draw LineString
38
37
  */
39
- mode?:string
38
+ mode?: string;
40
39
  }
41
40
 
42
41
  /**
43
42
  * GeoJson Feature editor that allows to create or manipulate GeoJson data
44
43
  */
45
- const MlFeatureEditor = (props:MlFeatureEditorProps) => {
44
+ const MlFeatureEditor = (props: MlFeatureEditorProps) => {
46
45
  const draw = useRef<MapboxDraw>();
47
46
  const mapHook = useMap({
48
47
  mapId: props.mapId,
49
48
  waitForLayer: props.insertBeforeLayer,
50
49
  });
51
- const onChangeRef = useRef(props.onChange);
52
50
 
53
51
  const drawToolsInitialized = useRef(false);
54
52
  const [drawToolsReady, setDrawToolsReady] = useState(false);
55
53
 
56
- const [mouseUpTrigger, setMouseUpTrigger] = useState(0);
57
54
 
58
- const modeChangeHandler = (e:any) => {
55
+ const modeChangeHandler = (e: any) => {
59
56
  console.log("MlFeatureEditor mode change to " + e.mode);
60
57
  //setDrawMode(e.mode);
61
58
  };
62
59
 
63
- const mouseUpHandler = () => {
64
- setMouseUpTrigger(Math.random());
65
- };
66
-
67
60
  useEffect(() => {
68
- if (
69
- mapHook.map &&
70
- !drawToolsInitialized.current
71
- ) {
72
-
61
+ if (mapHook.map && !drawToolsInitialized.current) {
73
62
  drawToolsInitialized.current = true;
74
63
 
75
64
  if (
@@ -96,34 +85,47 @@ const MlFeatureEditor = (props:MlFeatureEditorProps) => {
96
85
  ),
97
86
  });
98
87
 
99
- mapHook.map.on("draw.modechange", modeChangeHandler, mapHook.componentId);
100
-
101
88
  mapHook.map.addControl(draw.current, "top-left", mapHook.componentId);
102
89
 
103
- mapHook.map.on("mouseup", mouseUpHandler, mapHook.componentId);
90
+
91
+ mapHook.map.on("draw.modechange", modeChangeHandler, mapHook.componentId);
104
92
 
105
93
  setDrawToolsReady(true);
106
94
  }
107
- }, [mapHook.map, props, drawToolsInitialized]);
95
+ }, [mapHook.map, props, drawToolsInitialized]);
108
96
 
109
97
  useEffect(() => {
110
- if (
111
- draw.current &&
112
- props.geojson?.geometry
113
- ) {
114
- draw.current.set({ type: "FeatureCollection", features: [props.geojson] });
98
+ if (!mapHook.map || !drawToolsReady) return;
99
+
100
+ const changeHandler = () => {
101
+ if (draw.current) {
102
+ // update drawnFeatures state object
103
+ if (typeof props.onChange === "function") {
104
+ let currentFeatureCollection = draw.current.getAll?.();
105
+ props.onChange(currentFeatureCollection?.features);
106
+ }
107
+ }
108
+ };
109
+
110
+ mapHook.map.on("mouseup", changeHandler);
111
+
112
+ mapHook.map.on("touchend", changeHandler);
113
+
114
+ return () => {
115
+ if (!mapHook.map) return;
116
+
117
+ mapHook.map.map.off("mouseup", changeHandler);
118
+
119
+ mapHook.map.map.off("touchend", changeHandler);
115
120
  }
116
- }, [props.geojson, drawToolsReady]);
121
+
122
+ }, [drawToolsReady, mapHook.map])
117
123
 
118
124
  useEffect(() => {
119
- if (draw.current && mouseUpTrigger) {
120
- // update drawnFeatures state object
121
- let currentFeatureCollection = draw.current.getAll();
122
- if (typeof onChangeRef.current === "function") {
123
- onChangeRef.current(currentFeatureCollection.features);
124
- }
125
+ if (draw.current && props.geojson?.geometry) {
126
+ draw.current.set({ type: "FeatureCollection", features: [props.geojson] });
125
127
  }
126
- }, [mouseUpTrigger]);
128
+ }, [props.geojson, drawToolsReady]);
127
129
 
128
130
  useEffect(() => {
129
131
  if (props.mode && draw.current) {
@@ -132,7 +134,7 @@ const MlFeatureEditor = (props:MlFeatureEditorProps) => {
132
134
  }
133
135
  }, [props.mode]);
134
136
 
135
- return (<></>);
136
- }
137
+ return <></>;
138
+ };
137
139
 
138
140
  export default MlFeatureEditor;
@@ -39,8 +39,7 @@ const drawUtils = {
39
39
  getDrawInstance: (map) => {
40
40
  for (var i = map._controls.length - 1; i >= 0; i--) {
41
41
  if (
42
- map._controls[i].options &&
43
- map._controls[i].options.defaultMode === "custom_select"
42
+ map._controls[i]?.modes?.SIMPLE_SELECT === "simple_select"
44
43
  ) {
45
44
  return map._controls[i];
46
45
  }
@@ -43,5 +43,5 @@ ExampleConfig.args = {
43
43
  * https://www.wms.nrw.de/wms/kitas
44
44
  * https://www.wms.nrw.de/geobasis/wms_nw_vdop
45
45
  */
46
- url: "https://www.wms.nrw.de/wms/kitas",
46
+ url: "https://www.wms.nrw.de/geobasis/wms_nw_vdop",
47
47
  };
@@ -0,0 +1,205 @@
1
+ import React, { useContext, useState } from "react";
2
+ import { mount, configure } from "enzyme";
3
+ import MapContext, { MapComponentsProvider } from "../contexts/MapContext";
4
+ import MapLibreMap from "../components/MapLibreMap/MapLibreMap";
5
+ import { waitFor } from "@testing-library/react";
6
+ import { mockMapLibreMethods } from "../setupTests";
7
+
8
+ import useLayer from "./useLayer";
9
+
10
+ const UseLayerTestComponent = (props) => {
11
+ // Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
12
+ useLayer({
13
+ mapId: props.mapId,
14
+ layerId: props.layerId || "TestComponent",
15
+ geojson: props.geojson,
16
+ options: {
17
+ paint: props.paint,
18
+ layout: props.layout || {},
19
+ type: props.type,
20
+ ...props.options,
21
+ },
22
+ insertBeforeLayer: props.insertBeforeLayer,
23
+ onHover: props.onHover,
24
+ onClick: props.onClick,
25
+ onLeave: props.onLeave,
26
+ });
27
+
28
+ return <></>;
29
+ };
30
+
31
+ const TestComponent = (props) => {
32
+ const [includeComponent, setIncludeComponent] = useState(true);
33
+ const [testType, setTestType] = useState('line');
34
+
35
+ return (
36
+ <>
37
+ <button
38
+ className="change_testType"
39
+ onClick={() => {
40
+ setTestType('circle');
41
+ }}
42
+ >
43
+ change type
44
+ </button>
45
+ <button
46
+ className="toggle_includeComponent"
47
+ onClick={() => {
48
+ setIncludeComponent(!includeComponent);
49
+ }}
50
+ >
51
+ toggle
52
+ </button>
53
+ {includeComponent && <UseLayerTestComponent {...props} type={testType} />}
54
+ <MapLibreMap />
55
+ </>
56
+ );
57
+ };
58
+
59
+ describe("useLayer hook", () => {
60
+ it("should register 1 event listener 'hover' to the maplibre instance", async () => {
61
+ var testAttributes = {
62
+ onHover: () => {},
63
+ };
64
+
65
+ const wrapper = mount(
66
+ <MapComponentsProvider>
67
+ <TestComponent {...testAttributes} />
68
+ </MapComponentsProvider>
69
+ );
70
+
71
+ // MapLibreGlWrapper now subscribes to 4 events events on its own
72
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
73
+ await waitFor(() => expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(6));
74
+ });
75
+ it("should deregister 1 event listener 'hover' to the maplibre instance", async () => {
76
+ var testAttributes = {
77
+ onHover: () => {},
78
+ };
79
+
80
+ const wrapper = mount(
81
+ <MapComponentsProvider>
82
+ <TestComponent {...testAttributes} />
83
+ </MapComponentsProvider>
84
+ );
85
+
86
+ wrapper.find(".toggle_includeComponent").simulate("click");
87
+
88
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
89
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
90
+ });
91
+ it("should register 1 event listener 'leave' to the maplibre instance", async () => {
92
+ var testAttributes = {
93
+ onLeave: () => {},
94
+ };
95
+
96
+ const wrapper = mount(
97
+ <MapComponentsProvider>
98
+ <TestComponent {...testAttributes} />
99
+ </MapComponentsProvider>
100
+ );
101
+
102
+ // MapLibreGlWrapper now subscribes to 4 events events on its own
103
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
104
+ await waitFor(() => expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(6));
105
+ });
106
+ it("should deregister 1 event listener 'leave' to the maplibre instance", async () => {
107
+ var testAttributes = {
108
+ onLeave: () => {},
109
+ };
110
+
111
+ const wrapper = mount(
112
+ <MapComponentsProvider>
113
+ <TestComponent {...testAttributes} />
114
+ </MapComponentsProvider>
115
+ );
116
+
117
+ wrapper.find(".toggle_includeComponent").simulate("click");
118
+
119
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
120
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
121
+ });
122
+
123
+
124
+ it("should register 1 event listener 'click' to the maplibre instance", async () => {
125
+ var testAttributes = {
126
+ onClick: () => {},
127
+ };
128
+
129
+ const wrapper = mount(
130
+ <MapComponentsProvider>
131
+ <TestComponent {...testAttributes} />
132
+ </MapComponentsProvider>
133
+ );
134
+
135
+ // MapLibreGlWrapper now subscribes to 4 events events on its own
136
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
137
+ await waitFor(() => expect(mockMapLibreMethods.on).toHaveBeenCalledTimes(6));
138
+ });
139
+ it("should deregister 1 event listener 'click' to the maplibre instance", async () => {
140
+ var testAttributes = {
141
+ onClick: () => {},
142
+ };
143
+
144
+ const wrapper = mount(
145
+ <MapComponentsProvider>
146
+ <TestComponent {...testAttributes} />
147
+ </MapComponentsProvider>
148
+ );
149
+
150
+ wrapper.find(".toggle_includeComponent").simulate("click");
151
+
152
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
153
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
154
+ });
155
+
156
+ // if props.type is changed during runtime the hook needs to remove existing additions to the maplibre instance and reinitialize its representation in the maplibre instance
157
+ it("should deregister 1 event listener 'hover' to the maplibre instance if type is changed during component runtime", async () => {
158
+ var testAttributes = {
159
+ onHover: () => {},
160
+ };
161
+
162
+ const wrapper = mount(
163
+ <MapComponentsProvider>
164
+ <TestComponent {...testAttributes} />
165
+ </MapComponentsProvider>
166
+ );
167
+
168
+ wrapper.find(".change_testType").simulate("click");
169
+
170
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
171
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
172
+ });
173
+ it("should deregister 1 event listener 'hover' to the maplibre instance if type is changed during component runtime", async () => {
174
+ var testAttributes = {
175
+ onHover: () => {},
176
+ };
177
+
178
+ const wrapper = mount(
179
+ <MapComponentsProvider>
180
+ <TestComponent {...testAttributes} />
181
+ </MapComponentsProvider>
182
+ );
183
+
184
+ wrapper.find(".change_testType").simulate("click");
185
+
186
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
187
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
188
+ });
189
+ it("should deregister 1 event listener 'click' to the maplibre instance if type is changed during component runtime", async () => {
190
+ var testAttributes = {
191
+ onClick: () => {},
192
+ };
193
+
194
+ const wrapper = mount(
195
+ <MapComponentsProvider>
196
+ <TestComponent {...testAttributes} />
197
+ </MapComponentsProvider>
198
+ );
199
+
200
+ wrapper.find(".change_testType").simulate("click");
201
+
202
+ // useLayer always subscribes to 'styledata' to watch whether its representation within the maplibre instance has been removed
203
+ await waitFor(() => expect(mockMapLibreMethods.off).toHaveBeenCalledTimes(2));
204
+ });
205
+ });
package/tsconfig.json CHANGED
@@ -1,15 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "checkJs": false,
4
+ "esModuleInterop": true,
5
+ "importHelpers": false,
6
+ "isolatedModules": true,
7
+ "resolveJsonModule": true,
8
+ "skipLibCheck": true,
9
+ "sourceMap": true,
10
+ "strict": false,
11
+ "types": [
12
+ "node",
13
+ "jest",
14
+ "geojson"
15
+ ],
3
16
  "outDir": "build/esm",
4
17
  "module": "esnext",
5
18
  "target": "es5",
6
- "lib": ["es6", "dom", "es2016", "es2017"],
19
+ "lib": [
20
+ "es6",
21
+ "dom",
22
+ "es2016",
23
+ "es2017"
24
+ ],
7
25
  "jsx": "react",
8
26
  "declaration": true,
27
+ "declarationDir": "./dist",
9
28
  "moduleResolution": "node",
10
29
  "noUnusedLocals": true,
11
30
  "noUnusedParameters": true,
12
- "esModuleInterop": true,
13
31
  "noImplicitReturns": true,
14
32
  "noImplicitThis": true,
15
33
  "noImplicitAny": true,
@@ -19,13 +37,23 @@
19
37
  "allowJs": true,
20
38
  "baseUrl": ".",
21
39
  "paths": {
22
- "!maplibre-gl": ["node_modules/maplibre-gl"] // This mapping is relative to "baseUrl"
40
+ "!maplibre-gl": [
41
+ "node_modules/maplibre-gl"
42
+ ] // This mapping is relative to "baseUrl"
23
43
  }
24
44
  },
25
- "include": ["src", "src/custom.d.tsx"],
26
- "exclude": ["node_modules", "lib"],
45
+ "include": [
46
+ "src",
47
+ "src/custom.d.tsx"
48
+ ],
49
+ "exclude": [
50
+ "node_modules",
51
+ "lib"
52
+ ],
27
53
  "typedocOptions": {
28
- "entryPoints": ["src/index.ts"],
54
+ "entryPoints": [
55
+ "src/index.ts"
56
+ ],
29
57
  "out": "docs",
30
58
  }
31
- }
59
+ }