@mapcomponents/react-maplibre 0.1.30 → 0.1.31

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 (74) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/coverage/clover.xml +50 -50
  3. package/coverage/coverage-final.json +15 -15
  4. package/coverage/lcov-report/index.html +17 -17
  5. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.js.html +1 -1
  6. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  7. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.js.html +11 -11
  8. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +11 -11
  9. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.js.html +1 -1
  10. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  11. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +4 -4
  12. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  13. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.js.html +4 -4
  14. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  15. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.js.html +4 -4
  16. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +8 -8
  17. package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
  18. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js.html +1 -1
  19. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  20. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html +2 -2
  21. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  22. package/coverage/lcov-report/src/components/MlLayer/MlLayer.js.html +2 -2
  23. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  24. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.js.html +4 -4
  25. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  26. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.js.html +3 -3
  27. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  28. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  29. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  30. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  31. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlMarker/MlMarker.js.html +1 -1
  33. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  34. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.js.html +6 -6
  35. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  36. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.js.html +7 -7
  37. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +11 -11
  38. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +3 -3
  39. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  40. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  41. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  42. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  44. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +4 -4
  45. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  47. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.js.html +2 -2
  49. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  51. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.js.html +3 -3
  53. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  56. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.js.html +5 -5
  57. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  58. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.js.html +1 -1
  59. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
  60. package/coverage/lcov-report/src/hooks/index.html +1 -1
  61. package/coverage/lcov-report/src/hooks/useMap.js.html +1 -1
  62. package/coverage/lcov-report/src/hooks/useMapState.js.html +1 -1
  63. package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
  64. package/coverage/lcov-report/src/i18n.js.html +1 -1
  65. package/coverage/lcov-report/src/index.html +1 -1
  66. package/coverage/lcov-report/src/translations/english.js.html +1 -1
  67. package/coverage/lcov-report/src/translations/german.js.html +1 -1
  68. package/coverage/lcov-report/src/translations/index.html +1 -1
  69. package/coverage/lcov.info +47 -47
  70. package/dist/index.esm.js +309 -8
  71. package/dist/index.esm.js.map +1 -1
  72. package/package.json +1 -1
  73. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.js +1 -1
  74. package/src/index.js +1 -0
package/dist/index.esm.js CHANGED
@@ -6,7 +6,7 @@ import 'maplibre-gl/dist/maplibre-gl.css';
6
6
  import { v4 } from 'uuid';
7
7
  import Button from '@mui/material/Button';
8
8
  import GpsFixedIcon from '@mui/icons-material/GpsFixed';
9
- import { point, circle, lineArc, bbox, lineOffset, distance } from '@turf/turf';
9
+ import { point, circle, lineArc, bbox, lineOffset, distance, lineString as lineString$1, length, lineChunk, featureCollection } from '@turf/turf';
10
10
  import maplibregl$1, { Popup } from 'maplibre-gl';
11
11
  import jsPDF from 'jspdf';
12
12
  import PrinterIcon from '@mui/icons-material/Print';
@@ -119,6 +119,24 @@ function _defineProperty(obj, key, value) {
119
119
  return obj;
120
120
  }
121
121
 
122
+ function _extends() {
123
+ _extends = Object.assign || function (target) {
124
+ for (var i = 1; i < arguments.length; i++) {
125
+ var source = arguments[i];
126
+
127
+ for (var key in source) {
128
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
129
+ target[key] = source[key];
130
+ }
131
+ }
132
+ }
133
+
134
+ return target;
135
+ };
136
+
137
+ return _extends.apply(this, arguments);
138
+ }
139
+
122
140
  function _objectWithoutPropertiesLoose(source, excluded) {
123
141
  if (source == null) return {};
124
142
  var target = {};
@@ -1915,10 +1933,10 @@ var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
1915
1933
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
1916
1934
  };
1917
1935
 
1918
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1936
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
1919
1937
 
1920
1938
  function SvgRotateRight(props) {
1921
- return /*#__PURE__*/createElement("svg", _extends({
1939
+ return /*#__PURE__*/createElement("svg", _extends$1({
1922
1940
  width: "39.675098mm",
1923
1941
  height: "104.27064mm",
1924
1942
  viewBox: "0 0 39.675098 104.27064"
@@ -1935,10 +1953,10 @@ function SvgRotateRight(props) {
1935
1953
 
1936
1954
  var _g;
1937
1955
 
1938
- function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
1956
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
1939
1957
 
1940
1958
  function SvgRotateLeft(props) {
1941
- return /*#__PURE__*/createElement("svg", _extends$1({
1959
+ return /*#__PURE__*/createElement("svg", _extends$2({
1942
1960
  width: "39.675098mm",
1943
1961
  height: "104.27064mm",
1944
1962
  viewBox: "0 0 39.675098 104.27064"
@@ -1951,10 +1969,10 @@ function SvgRotateLeft(props) {
1951
1969
 
1952
1970
  var _g$1;
1953
1971
 
1954
- function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
1972
+ function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
1955
1973
 
1956
1974
  function SvgNeedle(props) {
1957
- return /*#__PURE__*/createElement("svg", _extends$2({
1975
+ return /*#__PURE__*/createElement("svg", _extends$3({
1958
1976
  width: "75.967445mm",
1959
1977
  height: "234.71339mm",
1960
1978
  viewBox: "0 0 75.967445 234.71339"
@@ -5555,5 +5573,288 @@ MlSpatialElevationProfile.propTypes = {
5555
5573
  insertBeforeLayer: PropTypes.string
5556
5574
  };
5557
5575
 
5558
- export { GeoJsonContext, GeoJsonProvider, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlSpatialElevationProfile, MlVectorTileLayer, MlWmsLayer, useMap, useMapState };
5576
+ var _showNextTransitionSegment = function _showNextTransitionSegment(props, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef, setDisplayGeojson) {
5577
+ var _arguments = arguments;
5578
+
5579
+ if (typeof transitionGeojsonDataRef.current[currentTransitionStepRef.current] !== "undefined") {
5580
+ // if at last transition step set to target geojson
5581
+ // else to an assembled LineString from common geometry and the current transition step geometry
5582
+ var newData = currentTransitionStepRef.current + 1 === transitionGeojsonDataRef.current.length ? props.geojson : lineString$1([].concat(_toConsumableArray(transitionGeojsonCommonDataRef.current), _toConsumableArray(transitionGeojsonDataRef.current[currentTransitionStepRef.current].geometry.coordinates)));
5583
+ setDisplayGeojson(newData);
5584
+
5585
+ if (typeof props.onTransitionFrame === "function") {
5586
+ props.onTransitionFrame(newData);
5587
+ }
5588
+
5589
+ currentTransitionStepRef.current++;
5590
+
5591
+ if (transitionInProgressRef.current && currentTransitionStepRef.current < transitionGeojsonDataRef.current.length) {
5592
+ transitionTimeoutRef.current = setTimeout(function () {
5593
+ return _showNextTransitionSegment.apply(void 0, _toConsumableArray(_arguments));
5594
+ }, msPerStep);
5595
+ } else {
5596
+ if (typeof props.onTransitionEnd === "function") {
5597
+ props.onTransitionEnd(props.geojson);
5598
+ }
5599
+
5600
+ transitionInProgressRef.current = false;
5601
+ }
5602
+ }
5603
+ };
5604
+
5605
+ var _transitionToGeojson = function _transitionToGeojson(props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, map, transitionTimeoutRef, setDisplayGeojson) {
5606
+ // create the transition geojson between oldGeojsonRef.current and props.geojson
5607
+ // create a geojson that contains no common point between the two line features
5608
+ var transitionCoordinatesShort = [];
5609
+ var transitionCoordinatesLong = [];
5610
+ var targetCoordinates = [];
5611
+ var srcCoordinates = [];
5612
+ transitionGeojsonCommonDataRef.current = [];
5613
+ var sourceGeojson = oldGeojsonRef.current || {
5614
+ geometry: {
5615
+ type: "LineString",
5616
+ coordinates: []
5617
+ },
5618
+ properties: {},
5619
+ type: "Feature"
5620
+ };
5621
+ var targetGeojson = props.geojson;
5622
+ var longerGeojson = targetGeojson;
5623
+ var shorterGeojson = sourceGeojson;
5624
+ var reverseOrder = false; // In case one geojson is missing completely use the first two coordinates of the other geojson
5625
+
5626
+ if (typeof longerGeojson.geometry === "undefined" && typeof shorterGeojson.geometry !== "undefined" && shorterGeojson.geometry.coordinates.length > 1) {
5627
+ longerGeojson = lineString$1(shorterGeojson.geometry.coordinates.slice(0, 2));
5628
+ } else if (typeof shorterGeojson.geometry === "undefined" && typeof longerGeojson.geometry !== "undefined" && longerGeojson.geometry.coordinates.length > 1) {
5629
+ shorterGeojson = lineString$1(longerGeojson.geometry.coordinates.slice(0, 2));
5630
+ } else if (typeof shorterGeojson.geometry === "undefined" && typeof longerGeojson.geometry === "undefined") {
5631
+ return;
5632
+ }
5633
+
5634
+ if (longerGeojson.geometry.coordinates.length < shorterGeojson.geometry.coordinates.length) {
5635
+ longerGeojson = sourceGeojson;
5636
+ shorterGeojson = targetGeojson;
5637
+ reverseOrder = true;
5638
+ }
5639
+
5640
+ if (longerGeojson && shorterGeojson) {
5641
+ for (var i = 0, len = longerGeojson.geometry.coordinates.length; i < len; i++) {
5642
+ if (typeof shorterGeojson.geometry.coordinates[i] !== "undefined" && longerGeojson.geometry.coordinates[i][0] === shorterGeojson.geometry.coordinates[i][0] && longerGeojson.geometry.coordinates[i][1] === shorterGeojson.geometry.coordinates[i][1]) {
5643
+ // if coordinates are equal
5644
+ transitionGeojsonCommonDataRef.current.push(longerGeojson.geometry.coordinates[i]);
5645
+ } else {
5646
+ if (typeof longerGeojson.geometry.coordinates[i] !== "undefined") {
5647
+ transitionCoordinatesLong.push(longerGeojson.geometry.coordinates[i]);
5648
+ }
5649
+
5650
+ if (typeof shorterGeojson.geometry.coordinates[i] !== "undefined") {
5651
+ transitionCoordinatesShort.push(shorterGeojson.geometry.coordinates[i]);
5652
+ }
5653
+ }
5654
+ }
5655
+ }
5656
+
5657
+ if (reverseOrder) {
5658
+ targetCoordinates = transitionCoordinatesShort;
5659
+ srcCoordinates = transitionCoordinatesLong;
5660
+ } else {
5661
+ targetCoordinates = transitionCoordinatesLong;
5662
+ srcCoordinates = transitionCoordinatesShort;
5663
+ }
5664
+
5665
+ if (targetCoordinates.length < 2 && srcCoordinates < 2) return; // create props.transitionTime / msPerStep (=: transitionSteps) Versions of transitionGeojsonCommonDataRef.current + transitionCoordinates making the transitionCoordinates transitionCoordinatesDistance / transitionSteps longer on each step
5666
+
5667
+ var transitionSteps = props.transitionTime / msPerStep;
5668
+ var srcCoordinatesDistance = srcCoordinates.length > 1 ? Math.round(length(lineString$1(srcCoordinates))) : 0;
5669
+ var targetCoordinatesDistance = targetCoordinates.length > 1 ? Math.round(length(lineString$1(targetCoordinates))) : 0;
5670
+ var transitionDistance = targetCoordinatesDistance + srcCoordinatesDistance;
5671
+ var srcCoordinatesShare = srcCoordinatesDistance / transitionDistance;
5672
+ var srcTransitionSteps = Math.round(transitionSteps * srcCoordinatesShare);
5673
+ var srcPerStepDistance = Math.round(srcCoordinatesDistance / srcTransitionSteps * 100) / 100;
5674
+ var targetCoordinatesShare = targetCoordinatesDistance / transitionDistance;
5675
+ var targetTransitionSteps = Math.round(transitionSteps * targetCoordinatesShare);
5676
+ var targetPerStepDistance = Math.round(targetCoordinatesDistance / targetTransitionSteps * 100) / 100; // use srcPerStepDistance as src coordinates are always animated backwards
5677
+
5678
+
5679
+ var transitionStepData;
5680
+ transitionStepData = _toConsumableArray(createTransitionSteps(srcCoordinates, srcPerStepDistance, srcTransitionSteps));
5681
+ transitionStepData.reverse();
5682
+ transitionStepData = [].concat(_toConsumableArray(transitionStepData), _toConsumableArray(createTransitionSteps(targetCoordinates, targetPerStepDistance, targetTransitionSteps)));
5683
+ transitionStepData.push(targetGeojson);
5684
+ transitionGeojsonDataRef.current = transitionStepData;
5685
+ currentTransitionStepRef.current = 1;
5686
+ transitionInProgressRef.current = true;
5687
+ transitionTimeoutRef.current = setTimeout(function () {
5688
+ return _showNextTransitionSegment(props, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef, setDisplayGeojson);
5689
+ }, msPerStep);
5690
+ };
5691
+
5692
+ var createTransitionSteps = function createTransitionSteps(linestringCoordinates, perStepDistance, stepCnt) {
5693
+ var transitionSteps = [];
5694
+
5695
+ if (linestringCoordinates.length > 1) {
5696
+ var tmpChunks = lineChunk(lineString$1(linestringCoordinates), perStepDistance); // tmpLineString contains all coordinates of all previous plus current loop iteration
5697
+
5698
+ var tmpLinestring = tmpChunks.features[0];
5699
+
5700
+ for (var i = 0; i < stepCnt; i++) {
5701
+ transitionSteps.push(tmpLinestring);
5702
+
5703
+ if (typeof tmpChunks.features[i] !== "undefined") {
5704
+ tmpLinestring = lineString$1([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
5705
+ } else {
5706
+ break;
5707
+ }
5708
+ }
5709
+ }
5710
+
5711
+ return transitionSteps;
5712
+ };
5713
+
5714
+ var _excluded$2 = ["geojson"];
5715
+ var msPerStep = 50;
5716
+ /**
5717
+ * Adds source and layer of types "line", "fill" or "circle" to display GeoJSON data on the map.
5718
+ *
5719
+ * @component
5720
+ */
5721
+
5722
+ var MlTransitionGeoJsonLayer = function MlTransitionGeoJsonLayer(props) {
5723
+ var geojson = props.geojson,
5724
+ restProps = _objectWithoutProperties(props, _excluded$2); // Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
5725
+
5726
+
5727
+ var mapHook = useMap({
5728
+ mapId: props.mapId,
5729
+ waitForLayer: props.insertBeforeLayer
5730
+ });
5731
+ var initializedRef = useRef(false); // transition effect variables
5732
+
5733
+ var oldGeojsonRef = useRef(null);
5734
+ var transitionInProgressRef = useRef(false);
5735
+ var transitionTimeoutRef = useRef(undefined);
5736
+ var currentTransitionStepRef = useRef(false);
5737
+ var transitionGeojsonDataRef = useRef([]);
5738
+ var transitionGeojsonCommonDataRef = useRef([]);
5739
+
5740
+ var _useState = useState(featureCollection([])),
5741
+ _useState2 = _slicedToArray(_useState, 2),
5742
+ displayGeojson = _useState2[0],
5743
+ setDisplayGeojson = _useState2[1];
5744
+
5745
+ useEffect(function () {
5746
+ return function () {
5747
+ // This is the cleanup function, it is called when this react component is removed from react-dom
5748
+ if (transitionTimeoutRef.current) {
5749
+ clearTimeout(transitionTimeoutRef.current);
5750
+ }
5751
+ };
5752
+ }, []);
5753
+ var transitionToGeojson = useCallback(function () {
5754
+ _transitionToGeojson(props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapHook.map, transitionTimeoutRef, setDisplayGeojson);
5755
+ }, [props, mapHook.map]);
5756
+ useEffect(function () {
5757
+ if (!mapHook.map || !initializedRef.current) return;
5758
+
5759
+ if (typeof props.transitionTime !== "undefined" && props.type === "line" && oldGeojsonRef.current) {
5760
+ transitionInProgressRef.current = false;
5761
+ currentTransitionStepRef.current = false;
5762
+ transitionGeojsonDataRef.current = [];
5763
+ transitionGeojsonCommonDataRef.current = [];
5764
+ transitionToGeojson();
5765
+ }
5766
+
5767
+ oldGeojsonRef.current = props.geojson;
5768
+ }, [mapHook.map, transitionToGeojson, props]);
5769
+ var startTransition = useCallback(function () {
5770
+ if (props.type === "line" && typeof props.transitionTime !== "undefined" && props.transitionTime && typeof props.geojson.geometry !== "undefined" && JSON.stringify(oldGeojsonRef.current) !== JSON.stringify(props.geojson)) {
5771
+ transitionToGeojson(props.geojson);
5772
+ oldGeojsonRef.current = props.geojson;
5773
+ }
5774
+ }, [props, transitionToGeojson]);
5775
+ useEffect(function () {
5776
+ if (!mapHook.mapIsReady || !props.geojson) return;
5777
+ initializedRef.current = true;
5778
+ startTransition();
5779
+ }, [mapHook.mapIsReady, startTransition, props]);
5780
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MlGeoJsonLayer, _extends({}, restProps, {
5781
+ geojson: displayGeojson
5782
+ })));
5783
+ };
5784
+
5785
+ MlTransitionGeoJsonLayer.propTypes = {
5786
+ /**
5787
+ * Id of the target MapLibre instance in mapContext
5788
+ */
5789
+ mapId: PropTypes.string,
5790
+
5791
+ /**
5792
+ * Type of the layer that will be added to the MapLibre instance.
5793
+ * Possible values: "line", "circle", "fill"
5794
+ */
5795
+ type: PropTypes.string,
5796
+
5797
+ /**
5798
+ * Layout property object, that is passed to the addLayer call.
5799
+ * Possible props depend on the layer type.
5800
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
5801
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
5802
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
5803
+ */
5804
+ layout: PropTypes.object,
5805
+
5806
+ /**
5807
+ * Paint property object, that is passed to the addLayer call.
5808
+ * Possible props depend on the layer type.
5809
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
5810
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
5811
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
5812
+ */
5813
+ paint: PropTypes.object,
5814
+
5815
+ /**
5816
+ * Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
5817
+ */
5818
+ defaultPaintOverrides: PropTypes.object,
5819
+
5820
+ /**
5821
+ * Javascript object that is spread into the addLayer commands first parameter.
5822
+ */
5823
+ options: PropTypes.object,
5824
+
5825
+ /**
5826
+ * GeoJSON data that is supposed to be rendered by this component.
5827
+ */
5828
+ geojson: PropTypes.object,
5829
+
5830
+ /**
5831
+ * Id of an existing layer in the mapLibre instance to help specify the layer order
5832
+ * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
5833
+ */
5834
+ insertBeforeLayer: PropTypes.string,
5835
+
5836
+ /**
5837
+ * Click event handler that is executed whenever a geometry rendered by this component is clicked.
5838
+ */
5839
+ onClick: PropTypes.func,
5840
+
5841
+ /**
5842
+ * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
5843
+ */
5844
+ onHover: PropTypes.func,
5845
+
5846
+ /**
5847
+ * Leave event handler that is executed whenever a geometry rendered by this component is
5848
+ * left/unhovered.
5849
+ */
5850
+ onLeave: PropTypes.func,
5851
+
5852
+ /**
5853
+ * Creates transition animation whenever the geojson prop changes.
5854
+ * Only works with layer type "line" and LineString GeoJSON data.
5855
+ */
5856
+ transitionTime: PropTypes.number
5857
+ };
5858
+
5859
+ export { GeoJsonContext, GeoJsonProvider, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, useMap, useMapState };
5559
5860
  //# sourceMappingURL=index.esm.js.map