@dynatrace/strato-geo 1.0.3 → 1.2.1

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 (194) hide show
  1. package/esm/index.js.map +2 -2
  2. package/esm/map/MapView.js +14 -10
  3. package/esm/map/MapView.js.map +2 -2
  4. package/esm/map/components/BubbleLayer/BubbleCircleLayer.js +6 -6
  5. package/esm/map/components/BubbleLayer/BubbleCircleLayer.js.map +2 -2
  6. package/esm/map/components/BubbleLayer/BubbleLayer.js +1 -1
  7. package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
  8. package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js +1 -1
  9. package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js.map +2 -2
  10. package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js.map +2 -2
  11. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +47 -24
  12. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
  13. package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
  14. package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js.map +2 -2
  15. package/esm/map/components/ConnectionLayer/ConnectionLayer.js +30 -48
  16. package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
  17. package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js +10 -3
  18. package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js.map +2 -2
  19. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +44 -0
  20. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +7 -0
  21. package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +4 -8
  22. package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js.map → get-arc-line-feature.js.map} +3 -3
  23. package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js +11 -0
  24. package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js.map +7 -0
  25. package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
  26. package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
  27. package/esm/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.js.map +1 -1
  28. package/esm/map/components/DotLayer/BackgroundLayer.js +1 -1
  29. package/esm/map/components/DotLayer/BackgroundLayer.js.map +2 -2
  30. package/esm/map/components/DotLayer/DotLayer.js +5 -5
  31. package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
  32. package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js.map +2 -2
  33. package/esm/map/components/MapContent.js +33 -7
  34. package/esm/map/components/MapContent.js.map +2 -2
  35. package/esm/map/components/MapUnavailable.js +2 -2
  36. package/esm/map/components/MapUnavailable.js.map +2 -2
  37. package/esm/map/components/toolbar/buttons/MapResetButton.js +1 -1
  38. package/esm/map/components/toolbar/buttons/MapResetButton.js.map +2 -2
  39. package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js +1 -1
  40. package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js.map +2 -2
  41. package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js +1 -1
  42. package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js.map +2 -2
  43. package/esm/map/constants.js +23 -17
  44. package/esm/map/constants.js.map +2 -2
  45. package/esm/map/contexts/map-data-bounding-box.context.js +2 -2
  46. package/esm/map/contexts/map-data-bounding-box.context.js.map +2 -2
  47. package/esm/map/hooks/use-active-interaction.js +14 -1
  48. package/esm/map/hooks/use-active-interaction.js.map +2 -2
  49. package/esm/map/hooks/use-attach-image-from-icon.js +4 -1
  50. package/esm/map/hooks/use-attach-image-from-icon.js.map +2 -2
  51. package/esm/map/hooks/use-attach-symbol-to-map.js +2 -2
  52. package/esm/map/hooks/use-attach-symbol-to-map.js.map +2 -2
  53. package/esm/map/hooks/use-hover-interaction.js +1 -1
  54. package/esm/map/hooks/use-hover-interaction.js.map +2 -2
  55. package/esm/map/hooks/use-legend-interaction-highlighting.js +30 -1
  56. package/esm/map/hooks/use-legend-interaction-highlighting.js.map +2 -2
  57. package/esm/map/hooks/use-legend-interaction-visibility.js +10 -1
  58. package/esm/map/hooks/use-legend-interaction-visibility.js.map +2 -2
  59. package/esm/map/hooks/use-load-map-base-layer.js +4 -4
  60. package/esm/map/hooks/use-load-map-base-layer.js.map +2 -2
  61. package/esm/map/hooks/use-map-mouse-move.js +1 -1
  62. package/esm/map/hooks/use-map-mouse-move.js.map +2 -2
  63. package/esm/map/hooks/use-resolve-color.js +4 -0
  64. package/esm/map/hooks/use-resolve-color.js.map +2 -2
  65. package/esm/map/providers/imperative-handler.provider.js +1 -1
  66. package/esm/map/providers/imperative-handler.provider.js.map +2 -2
  67. package/esm/map/providers/map-initial-view.provider.js +1 -1
  68. package/esm/map/providers/map-initial-view.provider.js.map +2 -2
  69. package/esm/map/slots/BaseLayer.js.map +2 -2
  70. package/esm/map/slots/BubbleLayer.js.map +2 -2
  71. package/esm/map/slots/CategoricalLegend.js.map +2 -2
  72. package/esm/map/slots/ChartInteractions.js +3 -3
  73. package/esm/map/slots/ChartInteractions.js.map +2 -2
  74. package/esm/map/slots/ChoroplethLayer.js.map +2 -2
  75. package/esm/map/slots/ConnectionLayer.js.map +2 -2
  76. package/esm/map/slots/DotLayer.js.map +2 -2
  77. package/esm/map/slots/SequentialLegend.js.map +2 -2
  78. package/esm/map/slots/ThresholdLegend.js.map +2 -2
  79. package/esm/map/slots/states/ErrorStateSlot.js.map +2 -2
  80. package/esm/map/types/bubble-layer.js.map +2 -2
  81. package/esm/map/types/coloring.js.map +2 -2
  82. package/esm/map/utils/attach-image-from-shape.js +3 -0
  83. package/esm/map/utils/attach-image-from-shape.js.map +2 -2
  84. package/esm/map/utils/attach-image-from-string.js.map +1 -1
  85. package/esm/map/utils/attach-image-from-text.js.map +1 -1
  86. package/esm/map/utils/attach-image-to-map.js +12 -5
  87. package/esm/map/utils/attach-image-to-map.js.map +2 -2
  88. package/esm/map/utils/build-scale-from-legend-config.js +5 -1
  89. package/esm/map/utils/build-scale-from-legend-config.js.map +2 -2
  90. package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js +17 -0
  91. package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js.map +7 -0
  92. package/esm/map/utils/extract-layers-data.js +50 -13
  93. package/esm/map/utils/extract-layers-data.js.map +2 -2
  94. package/esm/map/utils/iterate-config-slots.js +4 -2
  95. package/esm/map/utils/iterate-config-slots.js.map +2 -2
  96. package/esm/map/utils/set-layers-id.js +12 -4
  97. package/esm/map/utils/set-layers-id.js.map +2 -2
  98. package/esm/map/utils/tooltip-type-guards.js +1 -1
  99. package/esm/map/utils/tooltip-type-guards.js.map +2 -2
  100. package/esm/map/utils/use-set-map-initial-configuration.js.map +2 -2
  101. package/index.d.ts +2 -2
  102. package/map/MapView.d.ts +1 -1
  103. package/map/MapView.js +13 -9
  104. package/map/components/BubbleLayer/BubbleCircleLayer.js +5 -5
  105. package/map/components/BubbleLayer/BubbleLayer.js +2 -2
  106. package/map/components/BubbleLayer/BubbleOutlineLayer.js +2 -2
  107. package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.d.ts +2 -18
  108. package/map/components/ChoroplethLayer/ChoroplethLayer.d.ts +1 -1
  109. package/map/components/ChoroplethLayer/ChoroplethLayer.js +42 -22
  110. package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
  111. package/map/components/ConnectionLayer/ConnectionLayer.d.ts +2 -2
  112. package/map/components/ConnectionLayer/ConnectionLayer.js +29 -41
  113. package/map/components/ConnectionLayer/ConnectionLayerDirection.d.ts +1 -1
  114. package/map/components/ConnectionLayer/ConnectionLayerDirection.js +9 -4
  115. package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +12 -0
  116. package/map/components/ConnectionLayer/ConnectionLayerLine.js +66 -0
  117. package/map/components/ConnectionLayer/utils/{get-arc-line-features.d.ts → get-arc-line-feature.d.ts} +1 -1
  118. package/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +6 -10
  119. package/map/components/ConnectionLayer/utils/{get-straight-line-features.d.ts → get-straight-line-feature.d.ts} +1 -1
  120. package/map/components/ConnectionLayer/utils/{get-straight-line-features.js → get-straight-line-feature.js} +6 -7
  121. package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.d.ts +1 -1
  122. package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
  123. package/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.d.ts +1 -1
  124. package/map/components/DotLayer/BackgroundLayer.js +2 -2
  125. package/map/components/DotLayer/DotLayer.js +5 -5
  126. package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.d.ts +2 -19
  127. package/map/components/MapContent.d.ts +5 -1
  128. package/map/components/MapContent.js +28 -8
  129. package/map/components/MapUnavailable.d.ts +2 -2
  130. package/map/components/MapUnavailable.js +2 -2
  131. package/map/components/toolbar/buttons/MapResetButton.js +2 -2
  132. package/map/components/toolbar/buttons/MapZoomInOutButtons.js +2 -2
  133. package/map/components/toolbar/buttons/MapZoomToFitButton.js +2 -2
  134. package/map/constants.d.ts +13 -10
  135. package/map/constants.js +23 -17
  136. package/map/contexts/map-data-bounding-box.context.js +1 -1
  137. package/map/hooks/use-active-interaction.js +15 -2
  138. package/map/hooks/use-attach-image-from-icon.js +5 -2
  139. package/map/hooks/use-attach-symbol-to-map.js +2 -2
  140. package/map/hooks/use-hover-interaction.js +2 -2
  141. package/map/hooks/use-legend-interaction-highlighting.d.ts +2 -1
  142. package/map/hooks/use-legend-interaction-highlighting.js +31 -2
  143. package/map/hooks/use-legend-interaction-visibility.d.ts +2 -1
  144. package/map/hooks/use-legend-interaction-visibility.js +11 -2
  145. package/map/hooks/use-load-map-base-layer.d.ts +1 -1
  146. package/map/hooks/use-load-map-base-layer.js +4 -4
  147. package/map/hooks/use-map-mouse-move.js +2 -2
  148. package/map/hooks/use-resolve-color.d.ts +4 -2
  149. package/map/hooks/use-resolve-color.js +4 -0
  150. package/map/providers/imperative-handler.provider.js +2 -2
  151. package/map/providers/map-initial-view.provider.js +2 -2
  152. package/map/slots/BaseLayer.d.ts +4 -1
  153. package/map/slots/BubbleLayer.d.ts +1 -0
  154. package/map/slots/CategoricalLegend.d.ts +4 -1
  155. package/map/slots/ChartInteractions.d.ts +4 -1
  156. package/map/slots/ChartInteractions.js +3 -3
  157. package/map/slots/ChoroplethLayer.d.ts +1 -0
  158. package/map/slots/ConnectionLayer.d.ts +2 -1
  159. package/map/slots/DotLayer.d.ts +1 -0
  160. package/map/slots/SequentialLegend.d.ts +4 -1
  161. package/map/slots/ThresholdLegend.d.ts +4 -1
  162. package/map/slots/states/ErrorStateSlot.d.ts +6 -0
  163. package/map/types/base-layer.d.ts +4 -0
  164. package/map/types/bubble-layer.d.ts +4 -0
  165. package/map/types/choropleth-layer.d.ts +2 -0
  166. package/map/types/coloring.d.ts +16 -0
  167. package/map/types/connection-layer.d.ts +11 -7
  168. package/map/types/dot-layer.d.ts +2 -0
  169. package/map/types/legend.d.ts +18 -6
  170. package/map/types/location.d.ts +4 -1
  171. package/map/types/map-view.d.ts +10 -1
  172. package/map/types/shapes.d.ts +5 -1
  173. package/map/types/toolbar.d.ts +4 -1
  174. package/map/types/tooltip.d.ts +16 -1
  175. package/map/utils/attach-image-from-shape.d.ts +1 -1
  176. package/map/utils/attach-image-from-shape.js +3 -0
  177. package/map/utils/attach-image-from-string.d.ts +1 -1
  178. package/map/utils/attach-image-from-text.d.ts +1 -1
  179. package/map/utils/attach-image-to-map.d.ts +1 -1
  180. package/map/utils/attach-image-to-map.js +12 -5
  181. package/map/utils/build-scale-from-legend-config.js +5 -1
  182. package/map/utils/create-categorical-color-scheme-from-custom-color-object.d.ts +5 -0
  183. package/map/utils/create-categorical-color-scheme-from-custom-color-object.js +35 -0
  184. package/map/utils/extract-layers-data.d.ts +3 -2
  185. package/map/utils/extract-layers-data.js +50 -13
  186. package/map/utils/iterate-config-slots.d.ts +2 -1
  187. package/map/utils/iterate-config-slots.js +4 -2
  188. package/map/utils/set-layers-id.d.ts +1 -1
  189. package/map/utils/set-layers-id.js +12 -4
  190. package/map/utils/tooltip-type-guards.js +1 -1
  191. package/map/utils/use-set-map-initial-configuration.d.ts +1 -1
  192. package/package.json +8 -9
  193. package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js +0 -12
  194. package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayer.tsx"],
4
- "sourcesContent": ["import React from 'react';\nimport { Layer, Source } from 'react-map-gl/maplibre';\n\nimport { ConnectionLayerDirection } from './ConnectionLayerDirection.js';\nimport { ConnectionLayerTooltip } from './ConnectionLayerTooltip.js';\nimport { useConnectionLayerMouseMove } from './hooks/use-connection-layer-mouse-move.js';\nimport { parseConnectionDataToGeoJSON } from './utils/parse-connection-data-to-geo-json.js';\nimport {\n DEFAULT_LINE_CAP,\n DEFAULT_LINE_COLOR,\n DEFAULT_LINE_DASH_ARRAY,\n DEFAULT_LINE_JOIN,\n DEFAULT_LINE_THICKNESS,\n} from '../../constants.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { ConnectionLayerTooltip as ConnectionLayerTooltipSlot } from '../../slots/ConnectionLayerTooltip.js';\nimport type {\n InternalConnectionLayerProps,\n Connection,\n} from '../../types/connection-layer.js';\nimport { isConnectionTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\nexport const ConnectionLayer = <T extends Connection>(\n props: React.PropsWithChildren<InternalConnectionLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n children,\n color = DEFAULT_LINE_COLOR,\n curve,\n directionIndicator,\n line,\n thickness = DEFAULT_LINE_THICKNESS,\n } = props;\n\n const sourceId = `source-${layerId}`;\n\n const geoJsonData = parseConnectionDataToGeoJSON(\n data,\n thickness,\n color,\n curve,\n );\n\n const tooltipTemplate = useTooltipTemplate(\n children,\n ConnectionLayerTooltipSlot,\n );\n\n const { layerIds } = useConnectionLayerMouseMove(geoJsonData.length, layerId);\n\n return geoJsonData.map((featureCollection, index) => (\n <React.Fragment key={index}>\n <Source\n id={`${sourceId}-${index}`}\n type=\"geojson\"\n data={featureCollection}\n promoteId={'id'}\n >\n <Layer\n type=\"line\"\n id={layerIds[index]}\n layout={{\n 'line-cap': DEFAULT_LINE_CAP,\n 'line-join': DEFAULT_LINE_JOIN,\n }}\n paint={{\n 'line-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'line-width': ['get', '__lineWidth'],\n ...(line && line === 'dashed'\n ? { 'line-dasharray': DEFAULT_LINE_DASH_ARRAY }\n : null),\n }}\n />\n </Source>\n\n <ConnectionLayerTooltip\n layerId={layerIds[index]}\n tooltipTemplate={\n isConnectionTooltipTemplate(tooltipTemplate)\n ? tooltipTemplate\n : undefined\n }\n />\n\n {directionIndicator && (\n <ConnectionLayerDirection\n geoJsonData={featureCollection}\n layerId={layerIds[index]}\n directionIndicator={directionIndicator}\n />\n )}\n </React.Fragment>\n ));\n};\n\nConnectionLayer['displayName'] = 'ConnectionLayer';\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,OAAO,cAAc;AAE9B,SAAS,gCAAgC;AACzC,SAAS,8BAA8B;AACvC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,0BAA0B,kCAAkC;AAKrE,SAAS,mCAAmC;AAErC,MAAM,kBAAkB,CAC7B,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;A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\n\nimport { ConnectionLayerDirection } from './ConnectionLayerDirection.js';\nimport { ConnectionLayerLine } from './ConnectionLayerLine.js';\nimport { ConnectionLayerTooltip } from './ConnectionLayerTooltip.js';\nimport { parseConnectionDataToGeoJSON } from './utils/parse-connection-data-to-geo-json.js';\nimport { DEFAULT_LINE_COLOR, DEFAULT_LINE_THICKNESS } from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useResolveConnectionColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { ConnectionLayerTooltip as ConnectionLayerTooltipSlot } from '../../slots/ConnectionLayerTooltip.js';\nimport type {\n Connection,\n InternalConnectionLayerProps,\n} from '../../types/connection-layer.js';\nimport { isConnectionTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\nexport const ConnectionLayer = <T extends Connection>(\n props: React.PropsWithChildren<InternalConnectionLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n children,\n curve,\n directionIndicator,\n line,\n thickness = DEFAULT_LINE_THICKNESS,\n } = props;\n\n const colorParser = useLayerColoringStrategy();\n const connectionColor = useResolveConnectionColor(\n DEFAULT_LINE_COLOR,\n props,\n colorParser,\n );\n\n const sourceId = `source-${layerId}`;\n\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const geoJsonData = parseConnectionDataToGeoJSON(\n data,\n thickness,\n connectionColor,\n curve,\n );\n\n const tooltipTemplate = useTooltipTemplate(\n children,\n ConnectionLayerTooltipSlot,\n );\n\n return (\n <>\n <ConnectionLayerLine\n geoJsonData={geoJsonData}\n layerId={layerId}\n sourceId={sourceId}\n line={line}\n />\n\n {directionIndicator && (\n <ConnectionLayerDirection\n geoJsonData={geoJsonData}\n layerId={layerId}\n directionIndicator={directionIndicator}\n />\n )}\n\n <ConnectionLayerTooltip\n layerId={layerId}\n tooltipTemplate={\n isConnectionTooltipTemplate(tooltipTemplate)\n ? tooltipTemplate\n : undefined\n }\n />\n </>\n );\n};\n\nConnectionLayer['displayName'] = 'ConnectionLayer';\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,sCAAsC;AAC/C,SAAS,iCAAiC;AAC1C,SAAS,0BAA0B;AACnC,SAAS,0BAA0B,kCAAkC;AAKrE,SAAS,mCAAmC;AAErC,MAAM,kBAAkB,CAC7B,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,IAAI;AAEJ,QAAM,cAAc,yBAAyB;AAC7C,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW,UAAU,OAAO;AAElC,mCAAiC,OAAO,QAAQ;AAChD,iCAA+B,OAAO,OAAO;AAE7C,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AAEA,SACE,0DACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GAEC,sBACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GAGF;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBACE,4BAA4B,eAAe,IACvC,kBACA;AAAA;AAAA,EAER,CACF;AAEJ;AAEA,gBAAgB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,12 @@
1
+ import { Layer, Source } from "@vis.gl/react-maplibre";
1
2
  import React from "react";
2
- import { Layer, Source } from "react-map-gl";
3
3
  import { SorterIcon } from "@dynatrace/strato-icons";
4
4
  import { parseDirectionDataToGeoJSON } from "./utils/parse-direction-data-to-geo-json.js";
5
5
  import {
6
6
  DIRECTION_ICON_OUTPUT_SIZE,
7
- DIRECTION_ICON_SHRINK_RATIO
7
+ DIRECTION_ICON_SHRINK_RATIO,
8
+ SHAPE_OPACITY_DEFAULT,
9
+ SHAPE_OPACITY_DIMMED
8
10
  } from "../../constants.js";
9
11
  import { useLoadSymbolIntoMap } from "../../hooks/use-load-symbol-into-map.js";
10
12
  const ConnectionLayerDirection = (props) => {
@@ -55,7 +57,12 @@ const ConnectionLayerDirection = (props) => {
55
57
  ["get", "__lineHoveredColor"],
56
58
  ["get", "__lineColor"]
57
59
  ],
58
- "icon-opacity": ["get", "__lineOpacity"]
60
+ "icon-opacity": [
61
+ "case",
62
+ ["boolean", ["feature-state", "legendHover"], true],
63
+ SHAPE_OPACITY_DEFAULT,
64
+ SHAPE_OPACITY_DIMMED
65
+ ]
59
66
  }
60
67
  }
61
68
  )
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerDirection.tsx"],
4
- "sourcesContent": ["import React from 'react';\nimport { Layer, Source } from 'react-map-gl';\n\nimport { SorterIcon } from '@dynatrace/strato-icons';\n\nimport { parseDirectionDataToGeoJSON } from './utils/parse-direction-data-to-geo-json.js';\nimport {\n DIRECTION_ICON_OUTPUT_SIZE,\n DIRECTION_ICON_SHRINK_RATIO,\n} from '../../constants.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport type {\n InternalConnectionLayerProps,\n Connection,\n} from '../../types/connection-layer.js';\n\ninterface ConnectionLayerDirectionProps<T extends Connection>\n extends Required<\n Pick<InternalConnectionLayerProps<T>, 'layerId' | 'directionIndicator'>\n > {\n geoJsonData: GeoJSON.FeatureCollection;\n}\n\nexport const ConnectionLayerDirection = <T extends Connection>(\n props: ConnectionLayerDirectionProps<T>,\n) => {\n const { geoJsonData, layerId: connectionLayerId, directionIndicator } = props;\n\n const layerId = `${connectionLayerId}-direction`;\n const sourceId = `source-${layerId}`;\n\n // To get an image with enough quality instead of creating a tiny pic\n // and enlarge it, we create a huge image to shrink it\n const { symbolName } = useLoadSymbolIntoMap(\n <SorterIcon />,\n layerId,\n DIRECTION_ICON_OUTPUT_SIZE,\n );\n\n const parsedGeoJsonData = parseDirectionDataToGeoJSON({\n geoJsonData,\n directionIndicator,\n });\n\n /**\n * This value is necessary due to the icon\n * that comes from the '\\@dynatrace/strato-icons'\n * SorterIcon points downwards, but it should point upwards\n * for the sake of the angle calculation.\n */\n const iconRotationDegrees = 180;\n\n return (\n <Source\n id={sourceId}\n type=\"geojson\"\n data={parsedGeoJsonData}\n promoteId={'id'}\n >\n <Layer\n id={layerId}\n beforeId={connectionLayerId}\n type=\"symbol\"\n layout={{\n 'symbol-placement': 'point',\n 'icon-image': symbolName,\n 'icon-rotate': ['+', ['get', '__angle'], iconRotationDegrees],\n 'icon-rotation-alignment': 'map',\n 'icon-allow-overlap': true,\n 'icon-ignore-placement': true,\n 'icon-size': [\n '*',\n ['get', '__lineWidth'],\n DIRECTION_ICON_SHRINK_RATIO,\n ],\n }}\n paint={{\n 'icon-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'icon-opacity': ['get', '__lineOpacity'],\n }}\n />\n </Source>\n );\n};\n\nConnectionLayerDirection['displayName'] = 'ConnectionLayerDirection';\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,OAAO,cAAc;AAE9B,SAAS,kBAAkB;AAE3B,SAAS,mCAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAa9B,MAAM,2BAA2B,CACtC,UACG;AACH,QAAM,EAAE,aAAa,SAAS,mBAAmB,mBAAmB,IAAI;AAExE,QAAM,UAAU,GAAG,iBAAiB;AACpC,QAAM,WAAW,UAAU,OAAO;AAIlC,QAAM,EAAE,WAAW,IAAI;AAAA,IACrB,oCAAC,gBAAW;AAAA,IACZ;AAAA,IACA;AAAA,EACF;AAEA,QAAM,oBAAoB,4BAA4B;AAAA,IACpD;AAAA,IACA;AAAA,EACF,CAAC;AAQD,QAAM,sBAAsB;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACJ,MAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA;AAAA,IAEX;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,MAAK;AAAA,QACL,QAAQ;AAAA,UACN,oBAAoB;AAAA,UACpB,cAAc;AAAA,UACd,eAAe,CAAC,KAAK,CAAC,OAAO,SAAS,GAAG,mBAAmB;AAAA,UAC5D,2BAA2B;AAAA,UAC3B,sBAAsB;AAAA,UACtB,yBAAyB;AAAA,UACzB,aAAa;AAAA,YACX;AAAA,YACA,CAAC,OAAO,aAAa;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,YAC7C,CAAC,OAAO,oBAAoB;AAAA,YAC5B,CAAC,OAAO,aAAa;AAAA,UACvB;AAAA,UACA,gBAAgB,CAAC,OAAO,eAAe;AAAA,QACzC;AAAA;AAAA,IACF;AAAA,EACF;AAEJ;AAEA,yBAAyB,aAAa,IAAI;",
4
+ "sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport React from 'react';\n\nimport { SorterIcon } from '@dynatrace/strato-icons';\n\nimport { parseDirectionDataToGeoJSON } from './utils/parse-direction-data-to-geo-json.js';\nimport {\n DIRECTION_ICON_OUTPUT_SIZE,\n DIRECTION_ICON_SHRINK_RATIO,\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n} from '../../constants.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport type {\n Connection,\n InternalConnectionLayerProps,\n} from '../../types/connection-layer.js';\n\ninterface ConnectionLayerDirectionProps<T extends Connection>\n extends Required<\n Pick<InternalConnectionLayerProps<T>, 'layerId' | 'directionIndicator'>\n > {\n geoJsonData: GeoJSON.FeatureCollection;\n}\n\nexport const ConnectionLayerDirection = <T extends Connection>(\n props: ConnectionLayerDirectionProps<T>,\n) => {\n const { geoJsonData, layerId: connectionLayerId, directionIndicator } = props;\n\n const layerId = `${connectionLayerId}-direction`;\n const sourceId = `source-${layerId}`;\n\n // To get an image with enough quality instead of creating a tiny pic\n // and enlarge it, we create a huge image to shrink it\n const { symbolName } = useLoadSymbolIntoMap(\n <SorterIcon />,\n layerId,\n DIRECTION_ICON_OUTPUT_SIZE,\n );\n\n const parsedGeoJsonData = parseDirectionDataToGeoJSON({\n geoJsonData,\n directionIndicator,\n });\n\n /**\n * This value is necessary due to the icon\n * that comes from the '\\@dynatrace/strato-icons'\n * SorterIcon points downwards, but it should point upwards\n * for the sake of the angle calculation.\n */\n const iconRotationDegrees = 180;\n\n return (\n <Source\n id={sourceId}\n type=\"geojson\"\n data={parsedGeoJsonData}\n promoteId={'id'}\n >\n <Layer\n id={layerId}\n beforeId={connectionLayerId}\n type=\"symbol\"\n layout={{\n 'symbol-placement': 'point',\n 'icon-image': symbolName,\n 'icon-rotate': ['+', ['get', '__angle'], iconRotationDegrees],\n 'icon-rotation-alignment': 'map',\n 'icon-allow-overlap': true,\n 'icon-ignore-placement': true,\n 'icon-size': [\n '*',\n ['get', '__lineWidth'],\n DIRECTION_ICON_SHRINK_RATIO,\n ],\n }}\n paint={{\n 'icon-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'icon-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n }}\n />\n </Source>\n );\n};\n\nConnectionLayerDirection['displayName'] = 'ConnectionLayerDirection';\n"],
5
+ "mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,OAAO,WAAW;AAElB,SAAS,kBAAkB;AAE3B,SAAS,mCAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAa9B,MAAM,2BAA2B,CACtC,UACG;AACH,QAAM,EAAE,aAAa,SAAS,mBAAmB,mBAAmB,IAAI;AAExE,QAAM,UAAU,GAAG,iBAAiB;AACpC,QAAM,WAAW,UAAU,OAAO;AAIlC,QAAM,EAAE,WAAW,IAAI;AAAA,IACrB,oCAAC,gBAAW;AAAA,IACZ;AAAA,IACA;AAAA,EACF;AAEA,QAAM,oBAAoB,4BAA4B;AAAA,IACpD;AAAA,IACA;AAAA,EACF,CAAC;AAQD,QAAM,sBAAsB;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACJ,MAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA;AAAA,IAEX;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,MAAK;AAAA,QACL,QAAQ;AAAA,UACN,oBAAoB;AAAA,UACpB,cAAc;AAAA,UACd,eAAe,CAAC,KAAK,CAAC,OAAO,SAAS,GAAG,mBAAmB;AAAA,UAC5D,2BAA2B;AAAA,UAC3B,sBAAsB;AAAA,UACtB,yBAAyB;AAAA,UACzB,aAAa;AAAA,YACX;AAAA,YACA,CAAC,OAAO,aAAa;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,YAC7C,CAAC,OAAO,oBAAoB;AAAA,YAC5B,CAAC,OAAO,aAAa;AAAA,UACvB;AAAA,UACA,gBAAgB;AAAA,YACd;AAAA,YACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,YAClD;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EACF;AAEJ;AAEA,yBAAyB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,44 @@
1
+ import { Layer, Source } from "@vis.gl/react-maplibre";
2
+ import React from "react";
3
+ import {
4
+ DEFAULT_LINE_CAP,
5
+ DEFAULT_LINE_DASH_ARRAY,
6
+ DEFAULT_LINE_JOIN,
7
+ SHAPE_OPACITY_DEFAULT,
8
+ SHAPE_OPACITY_DIMMED
9
+ } from "../../constants.js";
10
+ const ConnectionLayerLine = (props) => {
11
+ const { geoJsonData, layerId, sourceId, line } = props;
12
+ return /* @__PURE__ */ React.createElement(Source, { id: sourceId, type: "geojson", data: geoJsonData, promoteId: "id" }, /* @__PURE__ */ React.createElement(
13
+ Layer,
14
+ {
15
+ type: "line",
16
+ id: layerId,
17
+ layout: {
18
+ "line-cap": DEFAULT_LINE_CAP,
19
+ "line-join": DEFAULT_LINE_JOIN
20
+ },
21
+ paint: {
22
+ "line-color": [
23
+ "case",
24
+ ["boolean", ["feature-state", "hover"], false],
25
+ ["get", "__lineHoveredColor"],
26
+ ["get", "__lineColor"]
27
+ ],
28
+ "line-opacity": [
29
+ "case",
30
+ ["boolean", ["feature-state", "legendHover"], true],
31
+ SHAPE_OPACITY_DEFAULT,
32
+ SHAPE_OPACITY_DIMMED
33
+ ],
34
+ "line-width": ["get", "__lineWidth"],
35
+ ...line && line === "dashed" ? { "line-dasharray": DEFAULT_LINE_DASH_ARRAY } : null
36
+ }
37
+ }
38
+ ));
39
+ };
40
+ ConnectionLayerLine["displayName"] = "ConnectionLayerLine";
41
+ export {
42
+ ConnectionLayerLine
43
+ };
44
+ //# sourceMappingURL=ConnectionLayerLine.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerLine.tsx"],
4
+ "sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport React from 'react';\n\nimport {\n DEFAULT_LINE_CAP,\n DEFAULT_LINE_DASH_ARRAY,\n DEFAULT_LINE_JOIN,\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n} from '../../constants.js';\nimport type {\n Connection,\n InternalConnectionLayerProps,\n} from '../../types/connection-layer.js';\n\ninterface ConnectionLayerLineProps<T extends Connection>\n extends Required<Pick<InternalConnectionLayerProps<T>, 'layerId'>> {\n geoJsonData: GeoJSON.FeatureCollection;\n sourceId: string;\n line: 'dashed' | 'solid' | undefined;\n}\n\nexport const ConnectionLayerLine = <T extends Connection>(\n props: ConnectionLayerLineProps<T>,\n) => {\n const { geoJsonData, layerId, sourceId, line } = props;\n\n return (\n <Source id={sourceId} type=\"geojson\" data={geoJsonData} promoteId={'id'}>\n <Layer\n type=\"line\"\n id={layerId}\n layout={{\n 'line-cap': DEFAULT_LINE_CAP,\n 'line-join': DEFAULT_LINE_JOIN,\n }}\n paint={{\n 'line-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__lineHoveredColor'],\n ['get', '__lineColor'],\n ],\n 'line-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n 'line-width': ['get', '__lineWidth'],\n ...(line && line === 'dashed'\n ? { 'line-dasharray': DEFAULT_LINE_DASH_ARRAY }\n : null),\n }}\n />\n </Source>\n );\n};\n\nConnectionLayerLine['displayName'] = 'ConnectionLayerLine';\n"],
5
+ "mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,OAAO,WAAW;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaA,MAAM,sBAAsB,CACjC,UACG;AACH,QAAM,EAAE,aAAa,SAAS,UAAU,KAAK,IAAI;AAEjD,SACE,oCAAC,UAAO,IAAI,UAAU,MAAK,WAAU,MAAM,aAAa,WAAW,QACjE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,IAAI;AAAA,MACJ,QAAQ;AAAA,QACN,YAAY;AAAA,QACZ,aAAa;AAAA,MACf;AAAA,MACA,OAAO;AAAA,QACL,cAAc;AAAA,UACZ;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C,CAAC,OAAO,oBAAoB;AAAA,UAC5B,CAAC,OAAO,aAAa;AAAA,QACvB;AAAA,QACA,gBAAgB;AAAA,UACd;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,UAClD;AAAA,UACA;AAAA,QACF;AAAA,QACA,cAAc,CAAC,OAAO,aAAa;AAAA,QACnC,GAAI,QAAQ,SAAS,WACjB,EAAE,kBAAkB,wBAAwB,IAC5C;AAAA,MACN;AAAA;AAAA,EACF,CACF;AAEJ;AAEA,oBAAoB,aAAa,IAAI;",
6
+ "names": []
7
+ }
@@ -30,10 +30,7 @@ const getArcFeatureItem = (coordinates) => {
30
30
  );
31
31
  return turfToMercator(lineArc);
32
32
  };
33
- const getArcLineFeatures = (path, featureProperties) => {
34
- if (path.length < 2) {
35
- return [];
36
- }
33
+ const getArcLineFeature = (path, featureProperties) => {
37
34
  const finalCoordinates = [];
38
35
  for (let i = 0; i < path.length - 1; i++) {
39
36
  const start = path[i];
@@ -45,12 +42,11 @@ const getArcLineFeatures = (path, featureProperties) => {
45
42
  const feature = getArcFeatureItem(coordinates);
46
43
  finalCoordinates.push(...feature.geometry.coordinates.reverse());
47
44
  }
48
- const finalFeature = turfLineString(finalCoordinates, {
45
+ return turfLineString(finalCoordinates, {
49
46
  ...featureProperties
50
47
  });
51
- return [finalFeature];
52
48
  };
53
49
  export {
54
- getArcLineFeatures
50
+ getArcLineFeature
55
51
  };
56
- //# sourceMappingURL=get-arc-line-features.js.map
52
+ //# sourceMappingURL=get-arc-line-feature.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../../src/map/components/ConnectionLayer/utils/get-arc-line-features.ts"],
4
- "sourcesContent": ["import turfBearing from '@turf/bearing';\nimport turfDestination from '@turf/destination';\nimport turfDistance from '@turf/distance';\nimport { lineString as turfLineString } from '@turf/helpers';\nimport turfLineDistance from '@turf/length';\nimport turfLineArc from '@turf/line-arc';\nimport turfMidpoint from '@turf/midpoint';\nimport {\n toMercator as turfToMercator,\n toWgs84 as turfToWgs84,\n} from '@turf/projection';\nimport type GeoJSON from 'geojson';\n\nimport type { FeatureProperties } from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\n\nconst getArcFeatureItem = (\n coordinates: GeoJSON.Position[],\n): GeoJSON.Feature<GeoJSON.LineString> => {\n const feature = turfLineString(coordinates);\n\n const parsedLineString = turfToWgs84(feature);\n\n const {\n geometry: {\n coordinates: [start, end],\n },\n } = parsedLineString;\n\n const lineDistance = turfLineDistance(parsedLineString);\n const midPoint = turfMidpoint(start, end);\n const bearing = turfBearing(start, end) - 90;\n const center = turfDestination(midPoint, lineDistance, bearing);\n\n const lineArc = turfLineArc(\n center,\n turfDistance(center, start),\n turfBearing(center, end),\n turfBearing(center, start),\n { steps: 256 },\n );\n\n return turfToMercator(lineArc);\n};\n\nexport const getArcLineFeatures = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature<GeoJSON.LineString>[] => {\n if (path.length < 2) {\n return [];\n }\n\n const finalCoordinates: GeoJSON.Position[] = [];\n\n for (let i = 0; i < path.length - 1; i++) {\n const start = path[i];\n const end = path[i + 1];\n\n const coordinates: GeoJSON.Position[] = [\n [start.longitude, start.latitude],\n [end.longitude, end.latitude],\n ];\n\n const feature = getArcFeatureItem(coordinates);\n\n finalCoordinates.push(...feature.geometry.coordinates.reverse());\n }\n\n const finalFeature = turfLineString(finalCoordinates, {\n ...featureProperties,\n });\n\n return [finalFeature];\n};\n"],
5
- "mappings": "AAAA,OAAO,iBAAiB;AACxB,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,cAAc,sBAAsB;AAC7C,OAAO,sBAAsB;AAC7B,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB;AAAA,EACE,cAAc;AAAA,EACd,WAAW;AAAA,OACN;AAMP,MAAM,oBAAoB,CACxB,gBACwC;AACxC,QAAM,UAAU,eAAe,WAAW;AAE1C,QAAM,mBAAmB,YAAY,OAAO;AAE5C,QAAM;AAAA,IACJ,UAAU;AAAA,MACR,aAAa,CAAC,OAAO,GAAG;AAAA,IAC1B;AAAA,EACF,IAAI;AAEJ,QAAM,eAAe,iBAAiB,gBAAgB;AACtD,QAAM,WAAW,aAAa,OAAO,GAAG;AACxC,QAAM,UAAU,YAAY,OAAO,GAAG,IAAI;AAC1C,QAAM,SAAS,gBAAgB,UAAU,cAAc,OAAO;AAE9D,QAAM,UAAU;AAAA,IACd;AAAA,IACA,aAAa,QAAQ,KAAK;AAAA,IAC1B,YAAY,QAAQ,GAAG;AAAA,IACvB,YAAY,QAAQ,KAAK;AAAA,IACzB,EAAE,OAAO,IAAI;AAAA,EACf;AAEA,SAAO,eAAe,OAAO;AAC/B;AAEO,MAAM,qBAAqB,CAChC,MACA,sBAC0C;AAC1C,MAAI,KAAK,SAAS,GAAG;AACnB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,mBAAuC,CAAC;AAE9C,WAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,UAAM,QAAQ,KAAK,CAAC;AACpB,UAAM,MAAM,KAAK,IAAI,CAAC;AAEtB,UAAM,cAAkC;AAAA,MACtC,CAAC,MAAM,WAAW,MAAM,QAAQ;AAAA,MAChC,CAAC,IAAI,WAAW,IAAI,QAAQ;AAAA,IAC9B;AAEA,UAAM,UAAU,kBAAkB,WAAW;AAE7C,qBAAiB,KAAK,GAAG,QAAQ,SAAS,YAAY,QAAQ,CAAC;AAAA,EACjE;AAEA,QAAM,eAAe,eAAe,kBAAkB;AAAA,IACpD,GAAG;AAAA,EACL,CAAC;AAED,SAAO,CAAC,YAAY;AACtB;",
3
+ "sources": ["../../../../../../src/map/components/ConnectionLayer/utils/get-arc-line-feature.ts"],
4
+ "sourcesContent": ["import turfBearing from '@turf/bearing';\nimport turfDestination from '@turf/destination';\nimport turfDistance from '@turf/distance';\nimport { lineString as turfLineString } from '@turf/helpers';\nimport turfLineDistance from '@turf/length';\nimport turfLineArc from '@turf/line-arc';\nimport turfMidpoint from '@turf/midpoint';\nimport {\n toMercator as turfToMercator,\n toWgs84 as turfToWgs84,\n} from '@turf/projection';\nimport type GeoJSON from 'geojson';\n\nimport type { FeatureProperties } from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\n\nconst getArcFeatureItem = (\n coordinates: GeoJSON.Position[],\n): GeoJSON.Feature<GeoJSON.LineString> => {\n const feature = turfLineString(coordinates);\n\n const parsedLineString = turfToWgs84(feature);\n\n const {\n geometry: {\n coordinates: [start, end],\n },\n } = parsedLineString;\n\n const lineDistance = turfLineDistance(parsedLineString);\n const midPoint = turfMidpoint(start, end);\n const bearing = turfBearing(start, end) - 90;\n const center = turfDestination(midPoint, lineDistance, bearing);\n\n const lineArc = turfLineArc(\n center,\n turfDistance(center, start),\n turfBearing(center, end),\n turfBearing(center, start),\n { steps: 256 },\n );\n\n return turfToMercator(lineArc);\n};\n\nexport const getArcLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature<GeoJSON.LineString> => {\n const finalCoordinates: GeoJSON.Position[] = [];\n\n for (let i = 0; i < path.length - 1; i++) {\n const start = path[i];\n const end = path[i + 1];\n\n const coordinates: GeoJSON.Position[] = [\n [start.longitude, start.latitude],\n [end.longitude, end.latitude],\n ];\n\n const feature = getArcFeatureItem(coordinates);\n\n finalCoordinates.push(...feature.geometry.coordinates.reverse());\n }\n\n return turfLineString(finalCoordinates, {\n ...featureProperties,\n });\n};\n"],
5
+ "mappings": "AAAA,OAAO,iBAAiB;AACxB,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,cAAc,sBAAsB;AAC7C,OAAO,sBAAsB;AAC7B,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB;AAAA,EACE,cAAc;AAAA,EACd,WAAW;AAAA,OACN;AAMP,MAAM,oBAAoB,CACxB,gBACwC;AACxC,QAAM,UAAU,eAAe,WAAW;AAE1C,QAAM,mBAAmB,YAAY,OAAO;AAE5C,QAAM;AAAA,IACJ,UAAU;AAAA,MACR,aAAa,CAAC,OAAO,GAAG;AAAA,IAC1B;AAAA,EACF,IAAI;AAEJ,QAAM,eAAe,iBAAiB,gBAAgB;AACtD,QAAM,WAAW,aAAa,OAAO,GAAG;AACxC,QAAM,UAAU,YAAY,OAAO,GAAG,IAAI;AAC1C,QAAM,SAAS,gBAAgB,UAAU,cAAc,OAAO;AAE9D,QAAM,UAAU;AAAA,IACd;AAAA,IACA,aAAa,QAAQ,KAAK;AAAA,IAC1B,YAAY,QAAQ,GAAG;AAAA,IACvB,YAAY,QAAQ,KAAK;AAAA,IACzB,EAAE,OAAO,IAAI;AAAA,EACf;AAEA,SAAO,eAAe,OAAO;AAC/B;AAEO,MAAM,oBAAoB,CAC/B,MACA,sBACwC;AACxC,QAAM,mBAAuC,CAAC;AAE9C,WAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,UAAM,QAAQ,KAAK,CAAC;AACpB,UAAM,MAAM,KAAK,IAAI,CAAC;AAEtB,UAAM,cAAkC;AAAA,MACtC,CAAC,MAAM,WAAW,MAAM,QAAQ;AAAA,MAChC,CAAC,IAAI,WAAW,IAAI,QAAQ;AAAA,IAC9B;AAEA,UAAM,UAAU,kBAAkB,WAAW;AAE7C,qBAAiB,KAAK,GAAG,QAAQ,SAAS,YAAY,QAAQ,CAAC;AAAA,EACjE;AAEA,SAAO,eAAe,kBAAkB;AAAA,IACtC,GAAG;AAAA,EACL,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,11 @@
1
+ import { lineString as turfLineString } from "@turf/helpers";
2
+ const getStraightLineFeature = (path, featureProperties) => {
3
+ const coordinates = path.map((coord) => [coord.longitude, coord.latitude]);
4
+ return turfLineString(coordinates, {
5
+ ...featureProperties
6
+ });
7
+ };
8
+ export {
9
+ getStraightLineFeature
10
+ };
11
+ //# sourceMappingURL=get-straight-line-feature.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/map/components/ConnectionLayer/utils/get-straight-line-feature.ts"],
4
+ "sourcesContent": ["import { lineString as turfLineString } from '@turf/helpers';\nimport type GeoJSON from 'geojson';\n\nimport type { FeatureProperties } from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\n\nexport const getStraightLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature => {\n const coordinates = path.map((coord) => [coord.longitude, coord.latitude]);\n return turfLineString(coordinates, {\n ...featureProperties,\n });\n};\n"],
5
+ "mappings": "AAAA,SAAS,cAAc,sBAAsB;AAMtC,MAAM,yBAAyB,CACpC,MACA,sBACoB;AACpB,QAAM,cAAc,KAAK,IAAI,CAAC,UAAU,CAAC,MAAM,WAAW,MAAM,QAAQ,CAAC;AACzE,SAAO,eAAe,aAAa;AAAA,IACjC,GAAG;AAAA,EACL,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -1,7 +1,6 @@
1
- import { featureCollection as turfFeatureCollection } from "@turf/helpers";
2
1
  import { _getCanvasColor as getCanvasColor } from "@dynatrace/strato-components-preview/charts";
3
- import { getArcLineFeatures } from "./get-arc-line-features.js";
4
- import { getStraightLineFeatures } from "./get-straight-line-features.js";
2
+ import { getArcLineFeature } from "./get-arc-line-feature.js";
3
+ import { getStraightLineFeature } from "./get-straight-line-feature.js";
5
4
  import { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from "../../../constants.js";
6
5
  import { calculateHoveredColor } from "../../../utils/calculate-hovered-color.js";
7
6
  import { defineColor } from "../../../utils/define-color.js";
@@ -23,12 +22,27 @@ const getFeatureProperties = (thickness, curve) => (properties, id) => {
23
22
  curve
24
23
  };
25
24
  };
26
- const getFeatures = (path, featureProperties) => {
25
+ const getLineFeature = (path, featureProperties) => {
27
26
  const isCurve = featureProperties.curve === "smooth";
28
27
  if (isCurve) {
29
- return getArcLineFeatures(path, featureProperties);
28
+ return getArcLineFeature(path, featureProperties);
30
29
  }
31
- return getStraightLineFeatures(path, featureProperties);
30
+ return getStraightLineFeature(path, featureProperties);
31
+ };
32
+ const getFeatures = (data, thickness, color, curve) => {
33
+ const getProperties = getFeatureProperties(thickness, curve);
34
+ const features = [];
35
+ data.forEach((feature, index) => {
36
+ if (feature.path.length >= 2) {
37
+ const { path, ...properties } = feature;
38
+ const featureProperties = {
39
+ ...getProperties({ path, ...properties }, `connection-${index}`),
40
+ ...getConnectionColor(feature, color)
41
+ };
42
+ features.push(getLineFeature(path, featureProperties));
43
+ }
44
+ });
45
+ return features;
32
46
  };
33
47
  const getConnectionColor = (connection, color) => {
34
48
  const parsedColor = defineColor(color, connection);
@@ -40,19 +54,10 @@ const getConnectionColor = (connection, color) => {
40
54
  };
41
55
  };
42
56
  const parseConnectionDataToGeoJSON = (data, thickness, color, curve) => {
43
- const featuresCollections = [];
44
- const getProperties = getFeatureProperties(thickness, curve);
45
- data.forEach((connection, index) => {
46
- const { path, ...properties } = connection;
47
- const featureProperties = {
48
- ...getProperties({ path, ...properties }, `connection-${index}`),
49
- ...getConnectionColor(connection, color)
50
- };
51
- const features = getFeatures(path, featureProperties);
52
- const featuresCollection = turfFeatureCollection(features);
53
- featuresCollections.push(featuresCollection);
54
- });
55
- return featuresCollections;
57
+ return {
58
+ type: "FeatureCollection",
59
+ features: getFeatures(data, thickness, color, curve)
60
+ };
56
61
  };
57
62
  export {
58
63
  parseConnectionDataToGeoJSON
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.ts"],
4
- "sourcesContent": ["import { featureCollection as turfFeatureCollection } from '@turf/helpers';\nimport type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { getArcLineFeatures } from './get-arc-line-features.js';\nimport { getStraightLineFeatures } from './get-straight-line-features.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst getFeatureProperties =\n (thickness: number, curve?: CurvedLine) =>\n <T extends Connection>(\n properties: T,\n id: string,\n ): Omit<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const lineThickness = getLineThickness(thickness);\n\n return {\n ...properties,\n id,\n __lineWidth: lineThickness,\n curve,\n };\n };\n\nconst getFeatures = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature[] => {\n const isCurve = featureProperties.curve === 'smooth';\n\n if (isCurve) {\n return getArcLineFeatures(path, featureProperties);\n }\n\n return getStraightLineFeatures(path, featureProperties);\n};\n\nconst getConnectionColor = <T extends Connection>(\n connection: T,\n color: string | ((connection: T) => string),\n): Pick<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const parsedColor = defineColor(color, connection);\n\n const canvasColor = getCanvasColor(parsedColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n return {\n __lineColor: canvasColor,\n __lineHoveredColor: hoveredColor,\n };\n};\n\nexport const parseConnectionDataToGeoJSON = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.FeatureCollection[] => {\n const featuresCollections: GeoJSON.FeatureCollection[] = [];\n\n const getProperties = getFeatureProperties(thickness, curve);\n\n data.forEach((connection, index) => {\n const { path, ...properties } = connection;\n\n const featureProperties = {\n ...getProperties({ path, ...properties }, `connection-${index}`),\n ...getConnectionColor(connection, color),\n };\n\n const features = getFeatures(path, featureProperties);\n\n const featuresCollection: GeoJSON.FeatureCollection =\n turfFeatureCollection(features);\n\n featuresCollections.push(featuresCollection);\n });\n\n return featuresCollections;\n};\n"],
5
- "mappings": "AAAA,SAAS,qBAAqB,6BAA6B;AAG3D,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB,0BAA0B;AAOvD,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,mBAAmB,CAAC,cAA8B;AACtD,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,uBACJ,CAAC,WAAmB,UACpB,CACE,YACA,OACkE;AAClE,QAAM,gBAAgB,iBAAiB,SAAS;AAEhD,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEF,MAAM,cAAc,CAClB,MACA,sBACsB;AACtB,QAAM,UAAU,kBAAkB,UAAU;AAE5C,MAAI,SAAS;AACX,WAAO,mBAAmB,MAAM,iBAAiB;AAAA,EACnD;AAEA,SAAO,wBAAwB,MAAM,iBAAiB;AACxD;AAEA,MAAM,qBAAqB,CACzB,YACA,UACkE;AAClE,QAAM,cAAc,YAAY,OAAO,UAAU;AAEjD,QAAM,cAAc,eAAe,WAAW;AAC9C,QAAM,eAAe,sBAAsB,WAAW;AAEtD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,oBAAoB;AAAA,EACtB;AACF;AAEO,MAAM,+BAA+B,CAC1C,MACA,WACA,OACA,UACgC;AAChC,QAAM,sBAAmD,CAAC;AAE1D,QAAM,gBAAgB,qBAAqB,WAAW,KAAK;AAE3D,OAAK,QAAQ,CAAC,YAAY,UAAU;AAClC,UAAM,EAAE,MAAM,GAAG,WAAW,IAAI;AAEhC,UAAM,oBAAoB;AAAA,MACxB,GAAG,cAAc,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,KAAK,EAAE;AAAA,MAC/D,GAAG,mBAAmB,YAAY,KAAK;AAAA,IACzC;AAEA,UAAM,WAAW,YAAY,MAAM,iBAAiB;AAEpD,UAAM,qBACJ,sBAAsB,QAAQ;AAEhC,wBAAoB,KAAK,kBAAkB;AAAA,EAC7C,CAAC;AAED,SAAO;AACT;",
4
+ "sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { getArcLineFeature } from './get-arc-line-feature.js';\nimport { getStraightLineFeature } from './get-straight-line-feature.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst getFeatureProperties =\n (thickness: number, curve?: CurvedLine) =>\n <T extends Connection>(\n properties: T,\n id: string,\n ): Omit<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const lineThickness = getLineThickness(thickness);\n\n return {\n ...properties,\n id,\n __lineWidth: lineThickness,\n curve,\n };\n };\n\nconst getLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature => {\n const isCurve = featureProperties.curve === 'smooth';\n\n if (isCurve) {\n return getArcLineFeature(path, featureProperties);\n }\n\n return getStraightLineFeature(path, featureProperties);\n};\n\nconst getFeatures = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.Feature[] => {\n const getProperties = getFeatureProperties(thickness, curve);\n const features: GeoJSON.Feature[] = [];\n data.forEach((feature, index) => {\n if (feature.path.length >= 2) {\n const { path, ...properties } = feature;\n\n const featureProperties = {\n ...getProperties({ path, ...properties }, `connection-${index}`),\n ...getConnectionColor(feature, color),\n };\n\n features.push(getLineFeature(path, featureProperties));\n }\n });\n return features;\n};\n\nconst getConnectionColor = <T extends Connection>(\n connection: T,\n color: string | ((connection: T) => string),\n): Pick<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const parsedColor = defineColor(color, connection);\n\n const canvasColor = getCanvasColor(parsedColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n return {\n __lineColor: canvasColor,\n __lineHoveredColor: hoveredColor,\n };\n};\n\nexport const parseConnectionDataToGeoJSON = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.FeatureCollection => {\n return {\n type: 'FeatureCollection',\n\n features: getFeatures(data, thickness, color, curve),\n };\n};\n"],
5
+ "mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,oBAAoB,0BAA0B;AAO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C1C,MACA,WACA,OACA,UAC8B;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,UAAU,YAAY,MAAM,WAAW,OAAO,KAAK;AAAA,EACrD;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.ts"],
4
- "sourcesContent": ["import { point as turfPoint } from '@turf/helpers';\n\nimport { getArrowsAngles } from './get-arrows-angles.js';\nimport type {\n GeoJSONFeature,\n InternalConnectionLayerProps,\n Connection,\n} from '../../../types/connection-layer.js';\n\ninterface ParseGeoJsonDataProps<T extends Connection>\n extends Required<\n Pick<InternalConnectionLayerProps<T>, 'directionIndicator'>\n > {\n geoJsonData: GeoJSON.FeatureCollection;\n}\n\nconst getConnectionGeoJSONFeature = (\n feature: GeoJSONFeature<GeoJSON.LineString>,\n angle: number,\n coordinates: number[],\n): GeoJSONFeature<GeoJSON.Point> =>\n turfPoint(coordinates, { ...feature.properties, __angle: angle });\n\nexport const parseDirectionDataToGeoJSON = <T extends Connection>(\n props: ParseGeoJsonDataProps<T>,\n): GeoJSON.FeatureCollection => {\n const { geoJsonData, directionIndicator } = props;\n\n const features: GeoJSONFeature<GeoJSON.Point>[] = [];\n\n for (let i = 0; i < geoJsonData.features.length; i++) {\n const feature = geoJsonData.features[\n i\n ] as GeoJSONFeature<GeoJSON.LineString>;\n\n const { coordinates } = feature.geometry;\n\n const { endMarkerAngle, startMarkerAngle } = getArrowsAngles(coordinates);\n\n const showStartArrow = directionIndicator !== 'end';\n const showEndArrow = directionIndicator !== 'start';\n\n const startCoordinate = coordinates[0];\n const endCoordinate = coordinates[coordinates.length - 1];\n\n if (showStartArrow) {\n const startPoint = getConnectionGeoJSONFeature(\n feature,\n startMarkerAngle,\n startCoordinate,\n );\n\n features.push({\n ...startPoint,\n properties: {\n ...startPoint.properties,\n id: `${feature.properties.id}-direction-start`,\n },\n });\n }\n\n if (showEndArrow) {\n const endPoint = getConnectionGeoJSONFeature(\n feature,\n endMarkerAngle,\n endCoordinate,\n );\n\n features.push({\n ...endPoint,\n properties: {\n ...endPoint.properties,\n id: `${feature.properties.id}-direction-end`,\n },\n });\n }\n }\n\n return {\n ...geoJsonData,\n features,\n };\n};\n"],
4
+ "sourcesContent": ["import { point as turfPoint } from '@turf/helpers';\n\nimport { getArrowsAngles } from './get-arrows-angles.js';\nimport type {\n Connection,\n GeoJSONFeature,\n InternalConnectionLayerProps,\n} from '../../../types/connection-layer.js';\n\ninterface ParseGeoJsonDataProps<T extends Connection>\n extends Required<\n Pick<InternalConnectionLayerProps<T>, 'directionIndicator'>\n > {\n geoJsonData: GeoJSON.FeatureCollection;\n}\n\nconst getConnectionGeoJSONFeature = (\n feature: GeoJSONFeature<GeoJSON.LineString>,\n angle: number,\n coordinates: number[],\n): GeoJSONFeature<GeoJSON.Point> =>\n turfPoint(coordinates, { ...feature.properties, __angle: angle });\n\nexport const parseDirectionDataToGeoJSON = <T extends Connection>(\n props: ParseGeoJsonDataProps<T>,\n): GeoJSON.FeatureCollection => {\n const { geoJsonData, directionIndicator } = props;\n\n const features: GeoJSONFeature<GeoJSON.Point>[] = [];\n\n for (let i = 0; i < geoJsonData.features.length; i++) {\n const feature = geoJsonData.features[\n i\n ] as GeoJSONFeature<GeoJSON.LineString>;\n\n const { coordinates } = feature.geometry;\n\n const { endMarkerAngle, startMarkerAngle } = getArrowsAngles(coordinates);\n\n const showStartArrow = directionIndicator !== 'end';\n const showEndArrow = directionIndicator !== 'start';\n\n const startCoordinate = coordinates[0];\n const endCoordinate = coordinates[coordinates.length - 1];\n\n if (showStartArrow) {\n const startPoint = getConnectionGeoJSONFeature(\n feature,\n startMarkerAngle,\n startCoordinate,\n );\n\n features.push({\n ...startPoint,\n properties: {\n ...startPoint.properties,\n id: `${feature.properties.id}-direction-start`,\n },\n });\n }\n\n if (showEndArrow) {\n const endPoint = getConnectionGeoJSONFeature(\n feature,\n endMarkerAngle,\n endCoordinate,\n );\n\n features.push({\n ...endPoint,\n properties: {\n ...endPoint.properties,\n id: `${feature.properties.id}-direction-end`,\n },\n });\n }\n }\n\n return {\n ...geoJsonData,\n features,\n };\n};\n"],
5
5
  "mappings": "AAAA,SAAS,SAAS,iBAAiB;AAEnC,SAAS,uBAAuB;AAchC,MAAM,8BAA8B,CAClC,SACA,OACA,gBAEA,UAAU,aAAa,EAAE,GAAG,QAAQ,YAAY,SAAS,MAAM,CAAC;AAE3D,MAAM,8BAA8B,CACzC,UAC8B;AAC9B,QAAM,EAAE,aAAa,mBAAmB,IAAI;AAE5C,QAAM,WAA4C,CAAC;AAEnD,WAAS,IAAI,GAAG,IAAI,YAAY,SAAS,QAAQ,KAAK;AACpD,UAAM,UAAU,YAAY,SAC1B,CACF;AAEA,UAAM,EAAE,YAAY,IAAI,QAAQ;AAEhC,UAAM,EAAE,gBAAgB,iBAAiB,IAAI,gBAAgB,WAAW;AAExE,UAAM,iBAAiB,uBAAuB;AAC9C,UAAM,eAAe,uBAAuB;AAE5C,UAAM,kBAAkB,YAAY,CAAC;AACrC,UAAM,gBAAgB,YAAY,YAAY,SAAS,CAAC;AAExD,QAAI,gBAAgB;AAClB,YAAM,aAAa;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,eAAS,KAAK;AAAA,QACZ,GAAG;AAAA,QACH,YAAY;AAAA,UACV,GAAG,WAAW;AAAA,UACd,IAAI,GAAG,QAAQ,WAAW,EAAE;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,cAAc;AAChB,YAAM,WAAW;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,eAAS,KAAK;AAAA,QACZ,GAAG;AAAA,QACH,YAAY;AAAA,UACV,GAAG,SAAS;AAAA,UACZ,IAAI,GAAG,QAAQ,WAAW,EAAE;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
+ import { Layer } from "@vis.gl/react-maplibre";
1
2
  import React from "react";
2
- import { Layer } from "react-map-gl";
3
3
  import { calculateCircleTranslate } from "./utils/calculate-circle-translate.js";
4
4
  import {
5
5
  BUBBLE_OUTLINE_STROKE,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/components/DotLayer/BackgroundLayer.tsx"],
4
- "sourcesContent": ["import React from 'react';\nimport { Layer } from 'react-map-gl';\n\nimport { calculateCircleTranslate } from './utils/calculate-circle-translate.js';\nimport {\n BUBBLE_OUTLINE_STROKE,\n ICON_BACKGROUND_OPACITY,\n} from '../../constants.js';\n\ninterface BackgroundLayerProps {\n background: boolean;\n beforeId: string;\n source: string;\n radius: number;\n iconAnchor: 'bottom' | 'center';\n}\n\nexport const BackgroundLayer = (props: BackgroundLayerProps) => {\n const { background, beforeId, source, radius, iconAnchor } = props;\n const circleTranslate = calculateCircleTranslate(iconAnchor, radius);\n\n return (\n <Layer\n type=\"circle\"\n beforeId={beforeId}\n source={source}\n paint={{\n 'circle-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__hoveredBackgroundColor'],\n ['get', '__backgroundColor'],\n ],\n 'circle-radius': radius,\n 'circle-opacity': [\n 'case',\n ['boolean', background, false],\n ICON_BACKGROUND_OPACITY,\n ['boolean', ['feature-state', 'hover'], false],\n ICON_BACKGROUND_OPACITY,\n 0,\n ],\n 'circle-stroke-width': [\n 'case',\n ['boolean', ['feature-state', 'active'], false],\n BUBBLE_OUTLINE_STROKE,\n 0,\n ],\n 'circle-translate': circleTranslate,\n }}\n />\n );\n};\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAUA,MAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM,EAAE,YAAY,UAAU,QAAQ,QAAQ,WAAW,IAAI;AAC7D,QAAM,kBAAkB,yBAAyB,YAAY,MAAM;AAEnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO;AAAA,QACL,gBAAgB;AAAA,UACd;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C,CAAC,OAAO,0BAA0B;AAAA,UAClC,CAAC,OAAO,mBAAmB;AAAA,QAC7B;AAAA,QACA,iBAAiB;AAAA,QACjB,kBAAkB;AAAA,UAChB;AAAA,UACA,CAAC,WAAW,YAAY,KAAK;AAAA,UAC7B;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C;AAAA,UACA;AAAA,QACF;AAAA,QACA,uBAAuB;AAAA,UACrB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,QAAQ,GAAG,KAAK;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,MACtB;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["import { Layer } from '@vis.gl/react-maplibre';\nimport React from 'react';\n\nimport { calculateCircleTranslate } from './utils/calculate-circle-translate.js';\nimport {\n BUBBLE_OUTLINE_STROKE,\n ICON_BACKGROUND_OPACITY,\n} from '../../constants.js';\n\ninterface BackgroundLayerProps {\n background: boolean;\n beforeId: string;\n source: string;\n radius: number;\n iconAnchor: 'bottom' | 'center';\n}\n\nexport const BackgroundLayer = (props: BackgroundLayerProps) => {\n const { background, beforeId, source, radius, iconAnchor } = props;\n const circleTranslate = calculateCircleTranslate(iconAnchor, radius);\n\n return (\n <Layer\n type=\"circle\"\n beforeId={beforeId}\n source={source}\n paint={{\n 'circle-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__hoveredBackgroundColor'],\n ['get', '__backgroundColor'],\n ],\n 'circle-radius': radius,\n 'circle-opacity': [\n 'case',\n ['boolean', background, false],\n ICON_BACKGROUND_OPACITY,\n ['boolean', ['feature-state', 'hover'], false],\n ICON_BACKGROUND_OPACITY,\n 0,\n ],\n 'circle-stroke-width': [\n 'case',\n ['boolean', ['feature-state', 'active'], false],\n BUBBLE_OUTLINE_STROKE,\n 0,\n ],\n 'circle-translate': circleTranslate,\n }}\n />\n );\n};\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,WAAW;AAElB,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAUA,MAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM,EAAE,YAAY,UAAU,QAAQ,QAAQ,WAAW,IAAI;AAC7D,QAAM,kBAAkB,yBAAyB,YAAY,MAAM;AAEnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO;AAAA,QACL,gBAAgB;AAAA,UACd;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C,CAAC,OAAO,0BAA0B;AAAA,UAClC,CAAC,OAAO,mBAAmB;AAAA,QAC7B;AAAA,QACA,iBAAiB;AAAA,QACjB,kBAAkB;AAAA,UAChB;AAAA,UACA,CAAC,WAAW,YAAY,KAAK;AAAA,UAC7B;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C;AAAA,UACA;AAAA,QACF;AAAA,QACA,uBAAuB;AAAA,UACrB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,QAAQ,GAAG,KAAK;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,MACtB;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
+ import { Layer, Source } from "@vis.gl/react-maplibre";
1
2
  import React from "react";
2
- import { Layer, Source } from "react-map-gl/maplibre";
3
3
  import { BackgroundLayer } from "./BackgroundLayer.js";
4
4
  import { DotLayerTooltip } from "./DotLayerTooltip.js";
5
5
  import { parseDotDataToGeoJSON } from "./utils/parse-dot-data-to-geo-json.js";
@@ -9,8 +9,8 @@ import {
9
9
  DEFAULT_SHAPE_COLOR,
10
10
  DEFAULT_SYMBOL_SIZE,
11
11
  FALLBACK_SYMBOL_SIZE,
12
- LEGEND_DIM_OPACITY,
13
- SHAPE_OPACITY
12
+ SHAPE_OPACITY_DIMMED,
13
+ SHAPE_OPACITY_DEFAULT
14
14
  } from "../../constants.js";
15
15
  import { useLayerColoringStrategy } from "../../hooks/use-layer-coloring-strategy.js";
16
16
  import { useLegendInteractionHighlighting } from "../../hooks/use-legend-interaction-highlighting.js";
@@ -72,8 +72,8 @@ const DotLayer = (props) => {
72
72
  "icon-opacity": [
73
73
  "case",
74
74
  ["boolean", ["feature-state", "legendHover"], true],
75
- SHAPE_OPACITY,
76
- LEGEND_DIM_OPACITY
75
+ SHAPE_OPACITY_DEFAULT,
76
+ SHAPE_OPACITY_DIMMED
77
77
  ]
78
78
  }
79
79
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/components/DotLayer/DotLayer.tsx"],
4
- "sourcesContent": ["import React, { type PropsWithChildren } from 'react';\nimport { Layer, Source } from 'react-map-gl/maplibre';\n\nimport { BackgroundLayer } from './BackgroundLayer.js';\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport { parseDotDataToGeoJSON } from './utils/parse-dot-data-to-geo-json.js';\nimport {\n DEFAULT_ICON_COLOR,\n DEFAULT_ICON_SIZE_RATIO,\n DEFAULT_SHAPE_COLOR,\n DEFAULT_SYMBOL_SIZE,\n FALLBACK_SYMBOL_SIZE,\n LEGEND_DIM_OPACITY,\n SHAPE_OPACITY,\n} from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { DotLayerTooltip as DotLayerTooltipSlot } from '../../slots/DotLayerTooltip.js';\nimport type { InternalDotLayerProps } from '../../types/dot-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isDotTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\n/**\n * DotLayer Component\n */\nexport const DotLayer = <T extends Location>(\n props: PropsWithChildren<InternalDotLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n bearing = 0,\n children,\n shape = 'pin',\n background = false,\n shapeSize = DEFAULT_SYMBOL_SIZE,\n } = props;\n\n const calculatedShapeSize = shapeSize > 0 ? shapeSize : FALLBACK_SYMBOL_SIZE;\n\n const { symbolName, symbolType } = useLoadSymbolIntoMap(\n shape,\n layerId,\n calculatedShapeSize,\n );\n\n const defaultSymbolColor =\n symbolType === 'shape' ? DEFAULT_SHAPE_COLOR : DEFAULT_ICON_COLOR;\n\n const colorParser = useLayerColoringStrategy();\n const shapeColor = useResolveLocationColor(\n defaultSymbolColor,\n props,\n colorParser,\n );\n\n const tooltipTemplate = useTooltipTemplate(children, DotLayerTooltipSlot);\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const dataGeoJson = parseDotDataToGeoJSON(\n data,\n shapeColor,\n bearing,\n background,\n );\n\n const iconAnchor = shape === 'pin' ? 'bottom' : 'center';\n\n return (\n <>\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <Layer\n type=\"symbol\"\n id={layerId}\n layout={{\n 'icon-image': symbolName,\n 'icon-size': DEFAULT_ICON_SIZE_RATIO,\n 'icon-rotate': ['get', '__bearing'],\n // https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-ignore-placement\n 'icon-ignore-placement': true,\n 'icon-anchor': iconAnchor,\n }}\n paint={{\n 'icon-color': ['get', '__color'],\n 'icon-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY,\n LEGEND_DIM_OPACITY,\n ],\n }}\n />\n <BackgroundLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n />\n </Source>\n\n <DotLayerTooltip\n layerId={layerId}\n tooltipTemplate={\n isDotTooltipTemplate(tooltipTemplate) ? tooltipTemplate : undefined\n }\n />\n </>\n );\n};\n\nDotLayer['displayName'] = 'DotLayer';\n"],
5
- "mappings": "AAAA,OAAO,WAAuC;AAC9C,SAAS,OAAO,cAAc;AAE9B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,sCAAsC;AAC/C,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB,2BAA2B;AAGvD,SAAS,4BAA4B;AAK9B,MAAM,WAAW,CACtB,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY;AAAA,EACd,IAAI;AAEJ,QAAM,sBAAsB,YAAY,IAAI,YAAY;AAExD,QAAM,EAAE,YAAY,WAAW,IAAI;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBACJ,eAAe,UAAU,sBAAsB;AAEjD,QAAM,cAAc,yBAAyB;AAC7C,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAAkB,mBAAmB,UAAU,mBAAmB;AAExE,QAAM,WAAW,UAAU,OAAO;AAClC,mCAAiC,OAAO,QAAQ;AAChD,iCAA+B,OAAO,OAAO;AAE7C,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,aAAa,UAAU,QAAQ,WAAW;AAEhD,SACE,0DACE,oCAAC,UAAO,IAAI,UAAU,MAAK,WAAU,MAAM,aAAa,YAAU,QAChE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,IAAI;AAAA,MACJ,QAAQ;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA,QACb,eAAe,CAAC,OAAO,WAAW;AAAA;AAAA,QAElC,yBAAyB;AAAA,QACzB,eAAe;AAAA,MACjB;AAAA,MACA,OAAO;AAAA,QACL,cAAc,CAAC,OAAO,SAAS;AAAA,QAC/B,gBAAgB;AAAA,UACd;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,UAClD;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA;AAAA,EACF,GACA;AAAA,IAAC;AAAA;AAAA,MACC,YAAY,QAAQ,UAAU;AAAA,MAC9B,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,QAAQ,sBAAsB;AAAA,MAC9B;AAAA;AAAA,EACF,CACF,GAEA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBACE,qBAAqB,eAAe,IAAI,kBAAkB;AAAA;AAAA,EAE9D,CACF;AAEJ;AAEA,SAAS,aAAa,IAAI;",
4
+ "sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { BackgroundLayer } from './BackgroundLayer.js';\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport { parseDotDataToGeoJSON } from './utils/parse-dot-data-to-geo-json.js';\nimport {\n DEFAULT_ICON_COLOR,\n DEFAULT_ICON_SIZE_RATIO,\n DEFAULT_SHAPE_COLOR,\n DEFAULT_SYMBOL_SIZE,\n FALLBACK_SYMBOL_SIZE,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n} from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useLoadSymbolIntoMap } from '../../hooks/use-load-symbol-into-map.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { DotLayerTooltip as DotLayerTooltipSlot } from '../../slots/DotLayerTooltip.js';\nimport type { InternalDotLayerProps } from '../../types/dot-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isDotTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\n/**\n * DotLayer Component\n */\nexport const DotLayer = <T extends Location>(\n props: PropsWithChildren<InternalDotLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n bearing = 0,\n children,\n shape = 'pin',\n background = false,\n shapeSize = DEFAULT_SYMBOL_SIZE,\n } = props;\n\n const calculatedShapeSize = shapeSize > 0 ? shapeSize : FALLBACK_SYMBOL_SIZE;\n\n const { symbolName, symbolType } = useLoadSymbolIntoMap(\n shape,\n layerId,\n calculatedShapeSize,\n );\n\n const defaultSymbolColor =\n symbolType === 'shape' ? DEFAULT_SHAPE_COLOR : DEFAULT_ICON_COLOR;\n\n const colorParser = useLayerColoringStrategy();\n const shapeColor = useResolveLocationColor(\n defaultSymbolColor,\n props,\n colorParser,\n );\n\n const tooltipTemplate = useTooltipTemplate(children, DotLayerTooltipSlot);\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const dataGeoJson = parseDotDataToGeoJSON(\n data,\n shapeColor,\n bearing,\n background,\n );\n\n const iconAnchor = shape === 'pin' ? 'bottom' : 'center';\n\n return (\n <>\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <Layer\n type=\"symbol\"\n id={layerId}\n layout={{\n 'icon-image': symbolName,\n 'icon-size': DEFAULT_ICON_SIZE_RATIO,\n 'icon-rotate': ['get', '__bearing'],\n // https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-ignore-placement\n 'icon-ignore-placement': true,\n 'icon-anchor': iconAnchor,\n }}\n paint={{\n 'icon-color': ['get', '__color'],\n 'icon-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n }}\n />\n <BackgroundLayer\n background={Boolean(background)}\n beforeId={layerId}\n source={sourceId}\n radius={calculatedShapeSize / 2}\n iconAnchor={iconAnchor}\n />\n </Source>\n\n <DotLayerTooltip\n layerId={layerId}\n tooltipTemplate={\n isDotTooltipTemplate(tooltipTemplate) ? tooltipTemplate : undefined\n }\n />\n </>\n );\n};\n\nDotLayer['displayName'] = 'DotLayer';\n"],
5
+ "mappings": "AAAA,SAAS,OAAO,cAAc;AAC9B,OAAO,WAAuC;AAE9C,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,sCAAsC;AAC/C,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB,2BAA2B;AAGvD,SAAS,4BAA4B;AAK9B,MAAM,WAAW,CACtB,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU;A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AAAA,MACA,iBACE,qBAAqB,eAAe,IAAI,kBAAkB;AAAA;AAAA,EAE9D,CACF;AAEJ;AAEA,SAAS,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/map/components/DotLayer/utils/parse-dot-data-to-geo-json.ts"],
4
- "sourcesContent": ["import { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { defineBearing } from './define-bearing.js';\nimport { resolveIconBackground } from './resolve-icon-background.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseDotDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n bearing: number | ((item: T) => number),\n backgroundColor: boolean | string | ((item: T) => string),\n) => {\n return {\n type: 'FeatureCollection',\n features: data.map((feature) => {\n const { longitude, latitude, ...properties } = feature;\n const canvasColor = getCanvasColor(defineColor(color, feature));\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n const { parsedBackgroundColor, parsedHoveredBackgroundColor } =\n resolveIconBackground(feature, backgroundColor);\n\n return {\n type: 'Feature',\n properties: {\n data: feature,\n ...properties,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n __backgroundColor: parsedBackgroundColor,\n __hoveredBackgroundColor: parsedHoveredBackgroundColor,\n __bearing: defineBearing(bearing, feature),\n },\n geometry: { type: 'Point', coordinates: [longitude, latitude] },\n };\n }),\n };\n};\n"],
5
- "mappings": "AAAA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,wBAAwB,CACnC,MACA,OACA,SACA,oBACG;AACH,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,KAAK,IAAI,CAAC,YAAY;AAC9B,YAAM,EAAE,WAAW,UAAU,GAAG,WAAW,IAAI;AAC/C,YAAM,cAAc,eAAe,YAAY,OAAO,OAAO,CAAC;AAC9D,YAAM,eAAe,sBAAsB,WAAW;AAEtD,YAAM,EAAE,uBAAuB,6BAA6B,IAC1D,sBAAsB,SAAS,eAAe;AAEhD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,YAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAG;AAAA,UACH,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,mBAAmB;AAAA,UACnB,0BAA0B;AAAA,UAC1B,WAAW,cAAc,SAAS,OAAO;AAAA,QAC3C;AAAA,QACA,UAAU,EAAE,MAAM,SAAS,aAAa,CAAC,WAAW,QAAQ,EAAE;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
4
+ "sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { defineBearing } from './define-bearing.js';\nimport { resolveIconBackground } from './resolve-icon-background.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseDotDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n bearing: number | ((item: T) => number),\n backgroundColor: boolean | string | ((item: T) => string),\n): GeoJSON.FeatureCollection => {\n return {\n type: 'FeatureCollection',\n features: data.map((feature) => {\n const { longitude, latitude, ...properties } = feature;\n const canvasColor = getCanvasColor(defineColor(color, feature));\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n const { parsedBackgroundColor, parsedHoveredBackgroundColor } =\n resolveIconBackground(feature, backgroundColor);\n\n return {\n type: 'Feature',\n properties: {\n data: feature,\n ...properties,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n __backgroundColor: parsedBackgroundColor,\n __hoveredBackgroundColor: parsedHoveredBackgroundColor,\n __bearing: defineBearing(bearing, feature),\n },\n geometry: { type: 'Point', coordinates: [longitude, latitude] },\n };\n }),\n };\n};\n"],
5
+ "mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,wBAAwB,CACnC,MACA,OACA,SACA,oBAC8B;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,KAAK,IAAI,CAAC,YAAY;AAC9B,YAAM,EAAE,WAAW,UAAU,GAAG,WAAW,IAAI;AAC/C,YAAM,cAAc,eAAe,YAAY,OAAO,OAAO,CAAC;AAC9D,YAAM,eAAe,sBAAsB,WAAW;AAEtD,YAAM,EAAE,uBAAuB,6BAA6B,IAC1D,sBAAsB,SAAS,eAAe;AAEhD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,YAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAG;AAAA,UACH,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,mBAAmB;AAAA,UACnB,0BAA0B;AAAA,UAC1B,WAAW,cAAc,SAAS,OAAO;AAAA,QAC3C;AAAA,QACA,UAAU,EAAE,MAAM,SAAS,aAAa,CAAC,WAAW,QAAQ,EAAE;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,17 +1,23 @@
1
+ import { Layer, Map, Source } from "@vis.gl/react-maplibre";
1
2
  import { isUndefined } from "lodash-es";
2
3
  import React, {
3
4
  forwardRef,
4
5
  useContext,
5
6
  useRef
6
7
  } from "react";
7
- import { Layer, Map, Source } from "react-map-gl/maplibre";
8
8
  import { _useGraphSize as useGraphSize } from "@dynatrace/strato-components-preview/charts";
9
9
  import { useMergeRefs } from "@dynatrace/strato-components-preview/core";
10
10
  import {
11
11
  BASE_LAYER_FILL_ID,
12
12
  BASE_LAYER_LINE_ID,
13
- DEFAULT_COUNTRIES_BORDER_COLOR,
14
- DEFAULT_COUNTRIES_FILL_COLOR
13
+ DEFAULT_BOUNDARIES_BORDER_COLOR,
14
+ DEFAULT_COUNTRIES_FILL_COLOR,
15
+ REGION_BORDER_WIDTH,
16
+ COUNTRY_BORDER_WIDTH,
17
+ MIN_LONGITUDE,
18
+ MIN_LATITUDE,
19
+ MAX_LONGITUDE,
20
+ MAX_LATITUDE
15
21
  } from "../constants.js";
16
22
  import { MapToolbar } from "./toolbar/MapToolbar.js";
17
23
  import { LayerIdsContext } from "../contexts/layer-ids.context.js";
@@ -40,7 +46,7 @@ const fillLayer = {
40
46
  };
41
47
  const MapSource = () => {
42
48
  const baseLayerFeatures = useMapBaseLayerFeatures();
43
- return /* @__PURE__ */ React.createElement(Source, { id: "data", type: "geojson", data: baseLayerFeatures }, /* @__PURE__ */ React.createElement(
49
+ return baseLayerFeatures && /* @__PURE__ */ React.createElement(Source, { id: "data", type: "geojson", data: baseLayerFeatures }, /* @__PURE__ */ React.createElement(
44
50
  Layer,
45
51
  {
46
52
  ...fillLayer,
@@ -52,8 +58,20 @@ const MapSource = () => {
52
58
  Layer,
53
59
  {
54
60
  ...lineLayer,
61
+ type: "line",
62
+ filter: [
63
+ "any",
64
+ ["==", "region_type", "COUNTRY"],
65
+ ["==", "region_type", "REGION"]
66
+ ],
55
67
  paint: {
56
- "line-color": getColorFromToken(DEFAULT_COUNTRIES_BORDER_COLOR)
68
+ "line-color": getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),
69
+ "line-width": [
70
+ "case",
71
+ ["==", ["get", "region_type"], "REGION"],
72
+ REGION_BORDER_WIDTH,
73
+ COUNTRY_BORDER_WIDTH
74
+ ]
57
75
  }
58
76
  }
59
77
  ));
@@ -70,6 +88,7 @@ const MapContent = forwardRef((props, forwardedRef) => {
70
88
  style,
71
89
  mapStyle = defaultStyle,
72
90
  onViewStateChange,
91
+ onMapLoad,
73
92
  ...remaining
74
93
  } = props;
75
94
  const loading = useMapLoading();
@@ -121,15 +140,22 @@ const MapContent = forwardRef((props, forwardedRef) => {
121
140
  mapStyle,
122
141
  dragRotate: false,
123
142
  fadeDuration: 0,
124
- RTLTextPlugin: false,
125
143
  renderWorldCopies: false,
126
144
  interactiveLayerIds: layerIds,
145
+ maxBounds: [
146
+ [MIN_LONGITUDE, MIN_LATITUDE],
147
+ [MAX_LONGITUDE, MAX_LATITUDE]
148
+ ],
127
149
  onMouseMove: (e) => handleMouseMove(e),
128
150
  onClick: (e) => handleMouseClick(e),
129
151
  onZoom: handleZoom,
130
152
  onDrag: handleDrag,
153
+ attributionControl: false,
131
154
  onRender: () => onRenderHandler && onRenderHandler(),
132
- onLoad: () => onLoadHandler && onLoadHandler(),
155
+ onLoad: () => {
156
+ onMapLoad();
157
+ onLoadHandler && onLoadHandler();
158
+ },
133
159
  ref: useSetMapInitialConfiguration(),
134
160
  interactive: true,
135
161
  ...remaining
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/components/MapContent.tsx"],
4
- "sourcesContent": ["import { isUndefined } from 'lodash-es';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport React, {\n forwardRef,\n type PropsWithChildren,\n useContext,\n useRef,\n} from 'react';\nimport { Layer, type LayerProps, Map, Source } from 'react-map-gl/maplibre';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n DEFAULT_COUNTRIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n} from '../constants.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type { MapViewProps, MapViewRef } from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n ></Layer>\n <Layer\n {...lineLayer}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_COUNTRIES_BORDER_COLOR),\n }}\n ></Layer>\n </Source>\n );\n};\n\nconst MapInteractions = ({ children }: PropsWithChildren) => {\n useHoverInteraction();\n useActiveInteraction();\n\n return children;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapViewProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n const shouldRenderToolbar =\n !isUndefined(toolbarConfig) || !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={toMapBoxInitialViewState(initialViewState)}\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n RTLTextPlugin={false}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onDrag={handleDrag}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={() => onLoadHandler && onLoadHandler()}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions>{children}</MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
5
- "mappings": "AAAA,SAAS,mBAAmB;AAE5B,OAAO;AAAA,EACL;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAwB,KAAK,cAAc;AAEpD,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAEzC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,qCAAqC;AAE9C,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAY,MAAM;AACtB,QAAM,oBAAoB,wBAAwB;AAClD,SACE,oCAAC,UAAO,IAAG,QAAO,MAAK,WAAU,MAAM,qBACrC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,QACL,cAAc,kBAAkB,4BAA4B;AAAA,MAC9D;AAAA;AAAA,EACD,GACD;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,QACL,cAAc,kBAAkB,8BAA8B;AAAA,MAChE;AAAA;AAAA,EACD,CACH;AAEJ;AAEA,MAAM,kBAAkB,CAAC,EAAE,SAAS,MAAyB;AAC3D,sBAAoB;AACpB,uBAAqB;AA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nB,qBAAqB;AAAA,QACrB,aAAa,CAAC,MAAM,gBAAgB,CAAuB;AAAA,QAC3D,SAAS,CAAC,MAAM,iBAAiB,CAAuB;AAAA,QACxD,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,UAAU,MAAM,mBAAmB,gBAAgB;AAAA,QACnD,QAAQ,MAAM,iBAAiB,cAAc;AAAA,QAC7C,KAAK,8BAA8B;AAAA,QACnC,aAAW;AAAA,QACV,GAAG;AAAA;AAAA,MAEJ,oCAAC,0BAA0B,UAA1B,EAAmC,OAAO,kBACzC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,cAAc;AAAA;AAAA,QAEd,oCAAC,eAAU;AAAA,QACV,UAAU,OACT,0DACE,oCAAC,uBAAiB,QAAS,GAC1B,sBAAsB,oCAAC,gBAAW,IAAK,IAC1C;AAAA,MAEJ,CACF;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;AAEA,WAA2D,cAC1D;",
4
+ "sourcesContent": ["import { Layer, type LayerProps, Map, Source } from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport React, {\n forwardRef,\n type PropsWithChildren,\n useContext,\n useRef,\n} from 'react';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n MIN_LONGITUDE,\n MIN_LATITUDE,\n MAX_LONGITUDE,\n MAX_LATITUDE,\n} from '../constants.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type { MapViewProps, MapViewRef } from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n baseLayerFeatures && (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n />\n <Layer\n {...lineLayer}\n type={'line'}\n filter={[\n 'any',\n ['==', 'region_type', 'COUNTRY'],\n ['==', 'region_type', 'REGION'],\n ]}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),\n 'line-width': [\n 'case',\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n </Source>\n )\n );\n};\n\nconst MapInteractions = ({ children }: PropsWithChildren) => {\n useHoverInteraction();\n useActiveInteraction();\n\n return children;\n};\ntype MapContentProps = MapViewProps & {\n onMapLoad: () => void;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapContentProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n onMapLoad,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n const shouldRenderToolbar =\n !isUndefined(toolbarConfig) || !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={toMapBoxInitialViewState(initialViewState)}\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n maxBounds={[\n [MIN_LONGITUDE, MIN_LATITUDE],\n [MAX_LONGITUDE, MAX_LATITUDE],\n ]}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onDrag={handleDrag}\n attributionControl={false}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={() => {\n onMapLoad();\n onLoadHandler && onLoadHandler();\n }}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions>{children}</MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
5
+ "mappings": "AAAA,SAAS,OAAwB,KAAK,cAAc;AACpD,SAAS,mBAAmB;AAE5B,OAAO;AAAA,EACL;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAEzC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,qCAAqC;AAE9C,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,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