@mapcomponents/react-maplibre 0.1.35 → 0.1.38
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.
- package/.storybook/main.js +1 -0
- package/CHANGELOG.md +10 -0
- package/coverage/clover.xml +435 -351
- package/coverage/coverage-final.json +29 -26
- package/coverage/lcov-report/index.html +74 -59
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +75 -27
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +13 -13
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +9 -9
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +11 -11
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +3 -6
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +3 -3
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +3 -3
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +3 -3
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +8 -8
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +15 -27
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +18 -18
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +13 -28
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +19 -19
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +2 -2
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +9 -9
- package/coverage/lcov-report/src/components/MlMarker/index.html +11 -11
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +6 -6
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +7 -7
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +11 -11
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +3 -3
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +2 -2
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +9 -36
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +2 -2
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +3 -3
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +3 -3
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +2 -2
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +5 -5
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +3 -6
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +358 -0
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +103 -0
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +277 -0
- package/coverage/lcov-report/src/contexts/index.html +146 -0
- package/coverage/lcov-report/src/hooks/index.html +11 -11
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +15 -126
- package/coverage/lcov-report/src/hooks/useMap.ts.html +13 -61
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +6 -6
- package/coverage/lcov-report/src/hooks/useWms.js.html +7 -7
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +15 -3
- package/coverage/lcov.info +790 -615
- package/dist/index.esm.js +187 -45
- package/dist/index.esm.js.map +1 -1
- package/docs-build/{0.fd1aa3ea21956d993519.manager.bundle.js → 0.20735a16c2ad9677fe7d.manager.bundle.js} +1 -1
- package/docs-build/{0.d0c23b79.iframe.bundle.js → 0.93d0ce3d.iframe.bundle.js} +2 -2
- package/docs-build/0.93d0ce3d.iframe.bundle.js.map +1 -0
- package/docs-build/{1.34075652.iframe.bundle.js → 1.2b1ae3fa.iframe.bundle.js} +2 -2
- package/docs-build/1.2b1ae3fa.iframe.bundle.js.map +1 -0
- package/docs-build/{16.ca488dae.iframe.bundle.js → 16.2c8135a1.iframe.bundle.js} +2 -2
- package/docs-build/16.2c8135a1.iframe.bundle.js.map +1 -0
- package/docs-build/{17.e40eac7f.iframe.bundle.js → 17.9a16865a.iframe.bundle.js} +2 -2
- package/docs-build/17.9a16865a.iframe.bundle.js.map +1 -0
- package/docs-build/{18.62af0912.iframe.bundle.js → 18.4c47f37e.iframe.bundle.js} +2 -2
- package/docs-build/18.4c47f37e.iframe.bundle.js.map +1 -0
- package/docs-build/{19.0a217189.iframe.bundle.js → 19.cdf25e28.iframe.bundle.js} +2 -2
- package/docs-build/19.cdf25e28.iframe.bundle.js.map +1 -0
- package/docs-build/{2.f15ae19a.iframe.bundle.js → 2.4518b817.iframe.bundle.js} +2 -2
- package/docs-build/2.4518b817.iframe.bundle.js.map +1 -0
- package/docs-build/{4.f741dafe1833630ec8bf.manager.bundle.js → 4.8ac31bba1926f4f011b0.manager.bundle.js} +2 -2
- package/docs-build/{4.f741dafe1833630ec8bf.manager.bundle.js.LICENSE.txt → 4.8ac31bba1926f4f011b0.manager.bundle.js.LICENSE.txt} +0 -0
- package/docs-build/{5.d4de191e7daeefb036ca.manager.bundle.js → 5.daf044a6c0f55d839078.manager.bundle.js} +1 -1
- package/docs-build/{6.2b178c5444648ee5c0fa.manager.bundle.js → 6.99fba2cf6af0473f8209.manager.bundle.js} +2 -2
- package/docs-build/{6.2b178c5444648ee5c0fa.manager.bundle.js.LICENSE.txt → 6.99fba2cf6af0473f8209.manager.bundle.js.LICENSE.txt} +0 -0
- package/docs-build/{7.7c16aea8ec7ea6e91994.manager.bundle.js → 7.b6a48b90f61cb575c2e4.manager.bundle.js} +1 -1
- package/docs-build/{8.52fa838fdf937b29676a.manager.bundle.js → 8.50518a5391398d9d5812.manager.bundle.js} +1 -1
- package/docs-build/assets/3D/godzilla_simple.glb +0 -0
- package/docs-build/catalogue/mc_meta.json +1 -1
- package/docs-build/iframe.html +1 -1
- package/docs-build/index.html +1 -1
- package/docs-build/{main.8a7ec710ea1c16b5e13f.manager.bundle.js → main.ef9704b1252e8efa56a0.manager.bundle.js} +1 -1
- package/docs-build/main~24120820.e0a66582.iframe.bundle.js +2 -0
- package/docs-build/main~24120820.e0a66582.iframe.bundle.js.map +1 -0
- package/docs-build/{runtime~main.67aa1de2d72f40a81164.manager.bundle.js → runtime~main.6e6ed7dc9ea4785ef286.manager.bundle.js} +1 -1
- package/docs-build/stories.json +416 -168
- package/docs-build/vendors~main.4b570b3072ba06ee44b5.manager.bundle.js +2 -0
- package/docs-build/{vendors~main.351900838c49e9200954.manager.bundle.js.LICENSE.txt → vendors~main.4b570b3072ba06ee44b5.manager.bundle.js.LICENSE.txt} +27 -24
- package/docs-build/{vendors~main~0ad7406a.a6abfed7.iframe.bundle.js → vendors~main~0ad7406a.22b96f8e.iframe.bundle.js} +2 -2
- package/docs-build/vendors~main~0ad7406a.22b96f8e.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~0f485567.1d7a15b7.iframe.bundle.js → vendors~main~0f485567.df27e62a.iframe.bundle.js} +2 -2
- package/docs-build/vendors~main~0f485567.df27e62a.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~41a6ab2c.525ecc56.iframe.bundle.js → vendors~main~41a6ab2c.7f3a1ced.iframe.bundle.js} +2 -2
- package/docs-build/vendors~main~41a6ab2c.7f3a1ced.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~73914085.227c6747.iframe.bundle.js → vendors~main~73914085.3d4f5bbf.iframe.bundle.js} +4 -4
- package/docs-build/{vendors~main~73914085.227c6747.iframe.bundle.js.map → vendors~main~73914085.3d4f5bbf.iframe.bundle.js.map} +1 -1
- package/docs-build/{vendors~main~9c5b28f6.f02cc741.iframe.bundle.js → vendors~main~9c5b28f6.f8614bdc.iframe.bundle.js} +3 -3
- package/docs-build/vendors~main~9c5b28f6.f8614bdc.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~b5906859.4083ac60.iframe.bundle.js → vendors~main~b5906859.b606e812.iframe.bundle.js} +3 -3
- package/docs-build/vendors~main~b5906859.b606e812.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~b9cf3951.a6200a51.iframe.bundle.js +63 -0
- package/docs-build/vendors~main~b9cf3951.a6200a51.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~d939e436.92c27fbf.iframe.bundle.js → vendors~main~d939e436.aa5d1533.iframe.bundle.js} +2 -2
- package/docs-build/vendors~main~d939e436.aa5d1533.iframe.bundle.js.map +1 -0
- package/docs-build/{vendors~main~dab50aa4.b0d58038.iframe.bundle.js → vendors~main~dab50aa4.277284e0.iframe.bundle.js} +4 -4
- package/docs-build/{vendors~main~dab50aa4.b0d58038.iframe.bundle.js.map → vendors~main~dab50aa4.277284e0.iframe.bundle.js.map} +1 -1
- package/package.json +18 -15
- package/rollup.config.js +5 -6
- package/src/components/MapLibreMap/MapLibreMap.stories.js +1 -1
- package/src/components/MapLibreMap/MapLibreMap.test.js +1 -1
- package/src/components/MapLibreMap/MapLibreMap.tsx +32 -16
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +1 -1
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +2 -2
- package/src/components/MlBasicComponent.js +4 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +1 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +0 -1
- package/src/components/MlFollowGps/MlFollowGps.test.js +1 -1
- package/src/components/MlLayer/MlLayer.test.js +1 -1
- package/src/components/MlLayerMagnify/MlLayerMagnify.test.js +1 -1
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +3 -7
- package/src/components/MlLayerSwipe/MlLayerSwipe.test.js +1 -1
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +2 -7
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +1 -1
- package/src/components/MlNavigationCompass/MlNavigationCompass.test.js +1 -1
- package/src/components/MlShareMapState/MlShareMapState.js +1 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +4 -13
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +1 -1
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +1 -1
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +1 -2
- package/src/contexts/MapComponentsProvider.test.js +260 -0
- package/src/contexts/MapContext.tsx +92 -0
- package/src/contexts/SimpleDataContext.js +6 -0
- package/src/contexts/SimpleDataProvider.js +64 -0
- package/src/contexts/SimpleDataProvider.test.js +68 -0
- package/src/custom.d.tsx +1 -1
- package/src/decorators/MapContextDecorator.js +1 -1
- package/src/decorators/MultiMapContextDecorator.js +1 -1
- package/src/hooks/useLayer.ts +12 -49
- package/src/hooks/useMap.ts +9 -26
- package/src/hooks/useMapState.ts +3 -3
- package/src/index.ts +5 -1
- package/src/ui_components/LoadingOverlayContext.js +1 -1
- package/src/util/layerRemovalTest.js +1 -1
- package/src/util/sourceRemovalTest.js +1 -1
- package/docs-build/0.d0c23b79.iframe.bundle.js.map +0 -1
- package/docs-build/1.34075652.iframe.bundle.js.map +0 -1
- package/docs-build/16.ca488dae.iframe.bundle.js.map +0 -1
- package/docs-build/17.e40eac7f.iframe.bundle.js.map +0 -1
- package/docs-build/18.62af0912.iframe.bundle.js.map +0 -1
- package/docs-build/19.0a217189.iframe.bundle.js.map +0 -1
- package/docs-build/2.f15ae19a.iframe.bundle.js.map +0 -1
- package/docs-build/main~24120820.ba6665a8.iframe.bundle.js +0 -2
- package/docs-build/main~24120820.ba6665a8.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main.351900838c49e9200954.manager.bundle.js +0 -2
- package/docs-build/vendors~main~0ad7406a.a6abfed7.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~0f485567.1d7a15b7.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~41a6ab2c.525ecc56.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~9c5b28f6.f02cc741.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~b5906859.4083ac60.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~b9cf3951.45da142d.iframe.bundle.js +0 -68
- package/docs-build/vendors~main~b9cf3951.45da142d.iframe.bundle.js.map +0 -1
- package/docs-build/vendors~main~d939e436.92c27fbf.iframe.bundle.js.map +0 -1
- package/public/stories.json +0 -331
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendors~main~dab50aa4.
|
|
1
|
+
{"version":3,"file":"vendors~main~dab50aa4.277284e0.iframe.bundle.js","sources":["webpack:///vendors~main~dab50aa4.277284e0.iframe.bundle.js"],"mappings":"AAAA;;;;;;;;;;AAuvRA;;;;;;;;AASA;;;;;;;;;;;;AAaA;;;;AAuBA;;;AAGA;AACA;AACA;;;AAGA;AACA;;;AAGA;;;;;;;;;AASA;;AAEA;AACA;AACA;;;AAGA;;;;;AAKA;;AAEA;;;;AAIA;;;;;;;;AAwoBA;;;;;;;;;;;;;;;AAgCA;AAqBA;AACA;AAiCA;AACA;;;;;AAwmBA","sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapcomponents/react-maplibre",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -17,18 +17,27 @@
|
|
|
17
17
|
"build-catalogue-markdown-docs": "node scripts/build-catalogue-markdown-docs.js",
|
|
18
18
|
"create-component": "./scripts/create-map-component.sh"
|
|
19
19
|
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@babel/preset-react": "^7.16.7",
|
|
20
|
+
"dependencies": {
|
|
23
21
|
"@emotion/css": "^11.7.1",
|
|
24
22
|
"@emotion/react": "^11.8.2",
|
|
25
23
|
"@emotion/styled": "^11.8.1",
|
|
26
24
|
"@mapbox/mapbox-gl-draw": "^1.3.0",
|
|
27
25
|
"@mapbox/mapbox-gl-sync-move": "^0.3.0",
|
|
28
|
-
"@mapcomponents/react-core": "^0.1.7",
|
|
29
26
|
"@mui/icons-material": "^5.5.1",
|
|
30
27
|
"@mui/material": "5.5.3",
|
|
31
28
|
"@mui/styles": "^5.5.3",
|
|
29
|
+
"@turf/turf": "^6.5.0",
|
|
30
|
+
"jspdf": "^2.5.1",
|
|
31
|
+
"maplibre-gl": "^2.1.7",
|
|
32
|
+
"react-i18next": "^11.14.3",
|
|
33
|
+
"three": "^0.139.1",
|
|
34
|
+
"uuid": "^8.3.2",
|
|
35
|
+
"wms-capabilities": "^0.5.1",
|
|
36
|
+
"xmldom": "^0.6.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/preset-react": "^7.16.7",
|
|
32
41
|
"@rollup/plugin-alias": "^3.1.9",
|
|
33
42
|
"@rollup/plugin-babel": "^5.3.1",
|
|
34
43
|
"@rollup/plugin-commonjs": "^21.0.3",
|
|
@@ -44,7 +53,6 @@
|
|
|
44
53
|
"@storybook/theming": "^6.4.19",
|
|
45
54
|
"@svgr/rollup": "^6.2.1",
|
|
46
55
|
"@testing-library/react": "^12.1.2",
|
|
47
|
-
"@turf/turf": "^6.5.0",
|
|
48
56
|
"@types/enzyme": "^3.10.11",
|
|
49
57
|
"@types/mapbox__mapbox-gl-draw": "^1.2.3",
|
|
50
58
|
"@types/mapbox__point-geometry": "^0.1.2",
|
|
@@ -57,6 +65,7 @@
|
|
|
57
65
|
"babel-plugin-inline-react-svg": "^2.0.1",
|
|
58
66
|
"babel-plugin-styled-components": "^2.0.6",
|
|
59
67
|
"babel-preset-react-app": "^10.0.1",
|
|
68
|
+
"d3": "^7.4.4",
|
|
60
69
|
"docz": "^2.4.0",
|
|
61
70
|
"enzyme": "^3.11.0",
|
|
62
71
|
"glob": "^7.2.0",
|
|
@@ -66,14 +75,11 @@
|
|
|
66
75
|
"jest-enzyme": "^7.1.2",
|
|
67
76
|
"jest-resolve": "26.6.0",
|
|
68
77
|
"jest-watch-typeahead": "0.6.1",
|
|
69
|
-
"jspdf": "^2.5.1",
|
|
70
|
-
"maplibre-gl": "^2.1.7",
|
|
71
78
|
"postcss": "^8.4.12",
|
|
72
79
|
"react": "^17.0.2",
|
|
73
80
|
"react-app-polyfill": "^3.0.0",
|
|
74
81
|
"react-dev-utils": "^12.0.0",
|
|
75
82
|
"react-dom": "^17.0.2",
|
|
76
|
-
"react-i18next": "^11.16.2",
|
|
77
83
|
"rollup": "^2.70.1",
|
|
78
84
|
"rollup-plugin-delete": "^2.0.0",
|
|
79
85
|
"rollup-plugin-import-css": "^3.0.3",
|
|
@@ -81,15 +87,11 @@
|
|
|
81
87
|
"rollup-plugin-postcss": "^4.0.2",
|
|
82
88
|
"rollup-plugin-typescript2": "^0.31.2",
|
|
83
89
|
"showdown": "^2.0.3",
|
|
84
|
-
"three": "^0.139.1",
|
|
85
90
|
"ts-jest": "^27.1.4",
|
|
86
91
|
"typedoc": "^0.22.13",
|
|
87
92
|
"typedoc-plugin-missing-exports": "^0.22.6",
|
|
88
93
|
"typedoc-twilio-theme": "^1.0.1",
|
|
89
|
-
"typescript": "^4.6.3"
|
|
90
|
-
"uuid": "^8.3.2",
|
|
91
|
-
"wms-capabilities": "^0.5.1",
|
|
92
|
-
"xmldom": "^0.6.0"
|
|
94
|
+
"typescript": "^4.6.3"
|
|
93
95
|
},
|
|
94
96
|
"jest": {
|
|
95
97
|
"roots": [
|
|
@@ -124,7 +126,8 @@
|
|
|
124
126
|
"moduleNameMapper": {
|
|
125
127
|
"^react-native$": "react-native-web",
|
|
126
128
|
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
|
|
127
|
-
"^!maplibre-gl$": "<rootDir>/node_modules/maplibre-gl"
|
|
129
|
+
"^!maplibre-gl$": "<rootDir>/node_modules/maplibre-gl",
|
|
130
|
+
"d3": "<rootDir>/node_modules/d3/dist/d3.min.js"
|
|
128
131
|
},
|
|
129
132
|
"moduleFileExtensions": [
|
|
130
133
|
"web.js",
|
package/rollup.config.js
CHANGED
|
@@ -42,15 +42,14 @@ const config = {
|
|
|
42
42
|
"d3",
|
|
43
43
|
"@emotion/react",
|
|
44
44
|
"@emotion/styled",
|
|
45
|
-
|
|
45
|
+
"@babel/helpers",
|
|
46
|
+
"jspdf",
|
|
47
|
+
...Object.keys(pkg.dependencies),
|
|
48
|
+
...Object.keys(pkg.peerDependencies),
|
|
49
|
+
...Object.keys(pkg.devDependencies),
|
|
46
50
|
],
|
|
47
51
|
inlineDynamicImports: true,
|
|
48
52
|
onwarn: function (warning, warn) {
|
|
49
|
-
if (
|
|
50
|
-
warning.code === "CIRCULAR_DEPENDENCY" ||
|
|
51
|
-
warning.code === "THIS_IS_UNDEFINED"
|
|
52
|
-
)
|
|
53
|
-
return;
|
|
54
53
|
warn(warning);
|
|
55
54
|
},
|
|
56
55
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState } from "react";
|
|
2
2
|
import { mount, configure } from "enzyme";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import
|
|
4
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
5
5
|
import MapLibreMap from "./MapLibreMap";
|
|
6
6
|
|
|
7
7
|
const MapLibreMapTestComponent = (props) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useContext, FC } from "react";
|
|
1
|
+
import React, { useRef, useEffect, useContext, FC, RefObject } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { MapContext } from "@mapcomponents/react-core";
|
|
5
|
-
// @ts-ignore
|
|
3
|
+
import MapContext from "../../contexts/MapContext";
|
|
6
4
|
import MapLibreGlWrapper from "./lib/MapLibreGlWrapper";
|
|
7
5
|
|
|
6
|
+
import { MapOptions as MapOptionsType } from "maplibre-gl";
|
|
8
7
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
9
8
|
|
|
10
9
|
type MapLibreMapProps = {
|
|
@@ -17,7 +16,7 @@ type MapLibreMapProps = {
|
|
|
17
16
|
* See https://maplibre.org/maplibre-gl-js-docs/api/map/ for a formal documentation of al
|
|
18
17
|
* available properties.
|
|
19
18
|
*/
|
|
20
|
-
options?:
|
|
19
|
+
options?: MapOptionsType;
|
|
21
20
|
/**
|
|
22
21
|
* css style definition passed to the map container DOM element
|
|
23
22
|
*/
|
|
@@ -29,6 +28,23 @@ const defaultProps: MapLibreMapProps = {
|
|
|
29
28
|
options: {
|
|
30
29
|
center: { lng: 8.607, lat: 53.1409349 },
|
|
31
30
|
zoom: 11,
|
|
31
|
+
container: '',
|
|
32
|
+
style: {
|
|
33
|
+
version: 8,
|
|
34
|
+
name: "blank",
|
|
35
|
+
center: [0, 0],
|
|
36
|
+
zoom: 0,
|
|
37
|
+
sources: {},
|
|
38
|
+
layers: [
|
|
39
|
+
{
|
|
40
|
+
id: "background",
|
|
41
|
+
type: "background",
|
|
42
|
+
paint: {
|
|
43
|
+
"background-color": "rgba(80,0,0,0)",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
32
48
|
},
|
|
33
49
|
};
|
|
34
50
|
|
|
@@ -43,13 +59,13 @@ const defaultProps: MapLibreMapProps = {
|
|
|
43
59
|
* @category Map components
|
|
44
60
|
*/
|
|
45
61
|
const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
|
|
46
|
-
const map: any = useRef(null);
|
|
47
|
-
const mapContainer = useRef(
|
|
62
|
+
const map: any = useRef<MapLibreGlWrapper>(null);
|
|
63
|
+
const mapContainer = useRef<HTMLDivElement>();
|
|
48
64
|
|
|
49
|
-
const mapContext: any = useContext(MapContext);
|
|
65
|
+
const mapContext: any = useContext<MapContextType>(MapContext);
|
|
50
66
|
|
|
51
67
|
const mapIdRef = useRef(props.mapId);
|
|
52
|
-
const
|
|
68
|
+
const initializedRef = useRef(false);
|
|
53
69
|
|
|
54
70
|
useEffect(() => {
|
|
55
71
|
let mapId = mapIdRef.current;
|
|
@@ -62,12 +78,15 @@ const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
|
|
|
62
78
|
}, []);
|
|
63
79
|
|
|
64
80
|
useEffect(() => {
|
|
81
|
+
if (initializedRef.current) return;
|
|
82
|
+
|
|
65
83
|
if (mapContainer.current) {
|
|
84
|
+
initializedRef.current = true;
|
|
66
85
|
map.current = new MapLibreGlWrapper({
|
|
67
|
-
// @ts-ignore
|
|
68
86
|
mapOptions: {
|
|
87
|
+
style: '',
|
|
69
88
|
container: mapContainer.current,
|
|
70
|
-
...
|
|
89
|
+
...props.options,
|
|
71
90
|
},
|
|
72
91
|
onReady: (map: any, wrapper: any) => {
|
|
73
92
|
map.once("load", () => {
|
|
@@ -80,12 +99,9 @@ const MapLibreMap: FC<MapLibreMapProps> = (props: MapLibreMapProps) => {
|
|
|
80
99
|
},
|
|
81
100
|
});
|
|
82
101
|
}
|
|
83
|
-
|
|
84
|
-
}, [mapContainer]);
|
|
102
|
+
}, [props.options, props.mapId]);
|
|
85
103
|
|
|
86
|
-
return
|
|
87
|
-
<div ref={mapContainer} className="mapContainer" style={props.style} />
|
|
88
|
-
);
|
|
104
|
+
return <div ref={mapContainer as RefObject<HTMLDivElement>} className="mapContainer" style={props.style} />;
|
|
89
105
|
};
|
|
90
106
|
|
|
91
107
|
MapLibreMap.defaultProps = defaultProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext, useState } from "react";
|
|
2
2
|
import { mount } from "enzyme";
|
|
3
|
-
import
|
|
3
|
+
import MapContext, { MapComponentsProvider } from "../../../contexts/MapContext";
|
|
4
4
|
import { v4 as uuidv4 } from "uuid";
|
|
5
5
|
import MapLibreMap from "../MapLibreMap";
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Map, IControl, MapOptions } from "maplibre-gl";
|
|
1
|
+
import { Map, IControl, MapOptions as MapOptionsType } from "maplibre-gl";
|
|
2
2
|
|
|
3
3
|
type EventArgArray = [string, string | Function, Function?];
|
|
4
4
|
type LayerState = {
|
|
@@ -64,7 +64,7 @@ class MapLibreGlWrapper {
|
|
|
64
64
|
on: Function;
|
|
65
65
|
cleanup: Function;
|
|
66
66
|
|
|
67
|
-
constructor(props: { mapOptions:
|
|
67
|
+
constructor(props: { mapOptions: MapOptionsType; onReady: Function }) {
|
|
68
68
|
// closure variable to safely point to the object context of the current MapLibreGlWrapper instance
|
|
69
69
|
let self = this;
|
|
70
70
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useContext } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import MapContext from "../contexts/MapContext";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* This component is deprecated and will be removed in the next major release
|
|
7
|
+
*/
|
|
5
8
|
const MlBasicComponent = (props) => {
|
|
6
9
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
7
10
|
// without the requirement of adding it to the dependency list (ignore the false eslint exhaustive deps warning)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useState } from "react";
|
|
2
2
|
import { mount, configure } from "enzyme";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import
|
|
4
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
5
5
|
import MlFeatureEditor from "./MlFeatureEditor";
|
|
6
6
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
7
|
import maplibregl from "maplibre-gl/dist/maplibre-gl";
|
|
@@ -111,7 +111,6 @@ const MlFeatureEditor = (props:MlFeatureEditorProps) => {
|
|
|
111
111
|
draw.current &&
|
|
112
112
|
props.geojson?.geometry
|
|
113
113
|
) {
|
|
114
|
-
// @ts-ignore
|
|
115
114
|
draw.current.set({ type: "FeatureCollection", features: [props.geojson] });
|
|
116
115
|
}
|
|
117
116
|
}, [props.geojson, drawToolsReady]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useState } from "react";
|
|
2
2
|
import { mount, configure } from "enzyme";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import
|
|
4
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
5
5
|
import MlFollowGps from "./MlFollowGps";
|
|
6
6
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useState } from "react";
|
|
2
2
|
import { mount, configure } from "enzyme";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import
|
|
4
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
5
5
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
6
6
|
import MlLayer from "./MlLayer";
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import MlLayerMagnify from "./MlLayerMagnify";
|
|
|
2
2
|
|
|
3
3
|
import React, { useContext, useState } from "react";
|
|
4
4
|
import { mount } from "enzyme";
|
|
5
|
-
import
|
|
5
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
6
6
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
7
|
import syncMove from "@mapbox/mapbox-gl-sync-move";
|
|
8
8
|
// Mapbox sync-move mockup
|
|
@@ -9,8 +9,7 @@ import React, {
|
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
import syncMove from "@mapbox/mapbox-gl-sync-move";
|
|
11
11
|
import "./style.css";
|
|
12
|
-
|
|
13
|
-
import { MapContext } from "@mapcomponents/react-core";
|
|
12
|
+
import MapContext from "../../contexts/MapContext";
|
|
14
13
|
|
|
15
14
|
interface MlLayerMagnifyProps {
|
|
16
15
|
/**
|
|
@@ -35,7 +34,7 @@ interface MlLayerMagnifyProps {
|
|
|
35
34
|
const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
36
35
|
const mapContext:MapContextType = useContext(MapContext);
|
|
37
36
|
const syncMoveInitializedRef = useRef(false);
|
|
38
|
-
const syncCleanupFunctionRef = useRef(
|
|
37
|
+
const syncCleanupFunctionRef = useRef(() => {});
|
|
39
38
|
|
|
40
39
|
const [swipeX, setSwipeX] = useState('50');
|
|
41
40
|
const swipeXRef = useRef('50');
|
|
@@ -72,10 +71,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
72
71
|
|
|
73
72
|
return () => {
|
|
74
73
|
window.removeEventListener("resize", _onResize);
|
|
75
|
-
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
syncCleanupFunctionRef.current();
|
|
78
|
-
}
|
|
74
|
+
syncCleanupFunctionRef.current();
|
|
79
75
|
};
|
|
80
76
|
}, []);
|
|
81
77
|
|
|
@@ -2,7 +2,7 @@ import MlLayerSwipe from "./MlLayerSwipe";
|
|
|
2
2
|
|
|
3
3
|
import React, { useContext, useState } from "react";
|
|
4
4
|
import { mount } from "enzyme";
|
|
5
|
-
import
|
|
5
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
6
6
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
7
|
import syncMove from "@mapbox/mapbox-gl-sync-move";
|
|
8
8
|
// Mapbox sync-move mockup
|
|
@@ -8,8 +8,7 @@ import React, {
|
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
import syncMove from "@mapbox/mapbox-gl-sync-move";
|
|
10
10
|
import "./style.css";
|
|
11
|
-
|
|
12
|
-
import { MapContext } from "@mapcomponents/react-core";
|
|
11
|
+
import MapContext from "../../contexts/MapContext";
|
|
13
12
|
|
|
14
13
|
interface MlLayerSwipeProps {
|
|
15
14
|
/**
|
|
@@ -32,7 +31,7 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
32
31
|
const [swipeX, setSwipeX] = useState(50);
|
|
33
32
|
const swipeXRef = useRef(0);
|
|
34
33
|
|
|
35
|
-
const syncCleanupFunctionRef = useRef(
|
|
34
|
+
const syncCleanupFunctionRef = useRef(() => {});
|
|
36
35
|
|
|
37
36
|
const mapExists = useCallback(() => {
|
|
38
37
|
if (!props.map1Id || !props.map2Id) {
|
|
@@ -46,10 +45,7 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
46
45
|
}, [mapContext, props.map1Id, props.map2Id]);
|
|
47
46
|
|
|
48
47
|
const cleanup = () => {
|
|
49
|
-
if (syncCleanupFunctionRef.current) {
|
|
50
|
-
// @ts-ignore
|
|
51
48
|
syncCleanupFunctionRef.current();
|
|
52
|
-
}
|
|
53
49
|
};
|
|
54
50
|
|
|
55
51
|
const onMove = useCallback(
|
|
@@ -68,7 +64,6 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
68
64
|
clientX -= bounds.x;
|
|
69
65
|
let swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
|
|
70
66
|
|
|
71
|
-
console.log(swipeX_tmp);
|
|
72
67
|
if (swipeXRef.current !== swipeX_tmp) {
|
|
73
68
|
setSwipeX(swipeX_tmp);
|
|
74
69
|
swipeXRef.current = swipeX_tmp;
|
|
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import { Card, CardContent, Typography, Box } from "@mui/material";
|
|
7
7
|
//Internal
|
|
8
|
-
import
|
|
8
|
+
import MapContext from "../../contexts/MapContext";
|
|
9
9
|
import LayerBox from "./components/LayerBox";
|
|
10
10
|
import Divider from "@mui/material/Divider";
|
|
11
11
|
import useMapState from "../../hooks/useMapState";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useState } from "react";
|
|
2
2
|
import { mount, configure } from "enzyme";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
|
-
import
|
|
4
|
+
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
5
5
|
import MlNavigationCompass from "./MlNavigationCompass";
|
|
6
6
|
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
7
|
import maplibregl from "maplibre-gl/dist/maplibre-gl";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext, useState, useCallback } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import MapContext from "../../contexts/MapContext";
|
|
5
5
|
import { v4 as uuidv4 } from "uuid";
|
|
6
6
|
import useMapState from "../../hooks/useMapState";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useContext, useEffect } from "react";
|
|
2
|
-
import
|
|
2
|
+
import MapContext from "../../contexts/MapContext";
|
|
3
3
|
import GeoJsonContext from "../MlGPXViewer/util/GeoJsonContext";
|
|
4
4
|
import { polygon, lineString } from "@turf/helpers";
|
|
5
5
|
import { distance, lineOffset } from "@turf/turf";
|
|
@@ -110,13 +110,7 @@ const MlSpatialElevationProfile = (props) => {
|
|
|
110
110
|
props.insertBeforeLayer,
|
|
111
111
|
componentId.current
|
|
112
112
|
);
|
|
113
|
-
}, [
|
|
114
|
-
mapContext.mapIds,
|
|
115
|
-
props.insertBeforeLayer,
|
|
116
|
-
props.mapId,
|
|
117
|
-
dataSource,
|
|
118
|
-
mapContext,
|
|
119
|
-
]);
|
|
113
|
+
}, [mapContext.mapIds, props.insertBeforeLayer, props.mapId, dataSource, mapContext]);
|
|
120
114
|
|
|
121
115
|
useEffect(() => {
|
|
122
116
|
if (!mapRef.current || !mapRef.current.getLayer(layerName.current)) return;
|
|
@@ -155,10 +149,7 @@ const MlSpatialElevationProfile = (props) => {
|
|
|
155
149
|
if (line.geometry.coordinates[index + 1]) {
|
|
156
150
|
const wayLength = distance(
|
|
157
151
|
[coordinate[0], coordinate[1]],
|
|
158
|
-
[
|
|
159
|
-
line.geometry.coordinates[index + 1][0],
|
|
160
|
-
line.geometry.coordinates[index + 1][1],
|
|
161
|
-
],
|
|
152
|
+
[line.geometry.coordinates[index + 1][0], line.geometry.coordinates[index + 1][1]],
|
|
162
153
|
{ units: "kilometers" }
|
|
163
154
|
);
|
|
164
155
|
let listLength = ~~((wayLength * 1000) / 10);
|
|
@@ -228,6 +219,6 @@ MlSpatialElevationProfile.propTypes = {
|
|
|
228
219
|
* https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
|
|
229
220
|
*/
|
|
230
221
|
insertBeforeLayer: PropTypes.string,
|
|
231
|
-
}
|
|
222
|
+
};
|
|
232
223
|
|
|
233
224
|
export default MlSpatialElevationProfile;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useRef, useEffect, useState } from "react";
|
|
2
|
-
import
|
|
2
|
+
import MapContext from "../../contexts/MapContext";
|
|
3
3
|
|
|
4
4
|
import Button from "@mui/material/Button";
|
|
5
5
|
import maplibregl from "maplibre-gl";
|
|
@@ -3,7 +3,7 @@ import React, { useState, useContext, useRef, useEffect } from "react";
|
|
|
3
3
|
import MlTransitionGeoJsonLayer from "./MlTransitionGeoJsonLayer";
|
|
4
4
|
|
|
5
5
|
import mapContextDecorator from "../../decorators/MapContextDecorator";
|
|
6
|
-
import
|
|
6
|
+
import MapContext from "../../contexts/MapContext";
|
|
7
7
|
|
|
8
8
|
import sample_geojson_1 from "./assets/sample_1.json";
|
|
9
9
|
import sample_geojson_2 from "./assets/sample_2.json";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext, useCallback, useState } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { MapContext } from "@mapcomponents/react-core";
|
|
3
|
+
import MapContext from "../../contexts/MapContext";
|
|
5
4
|
import { v4 as uuidv4 } from "uuid";
|
|
6
5
|
|
|
7
6
|
import MlWmsLayer from "../MlWmsLayer/MlWmsLayer";
|