@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
@@ -14,12 +14,12 @@ import { getBaseLayerShapesRequestConfig } from "../utils/get-base-layer-shapes-
14
14
  import { getTenantCountryCode } from "../utils/get-tenant-country-code.js";
15
15
  import { mergeFeatureCollections } from "../utils/merge-feature-collections.js";
16
16
  const useLoadMapBaseLayer = (baseLayerConfig) => {
17
- const [isLoading, setIsLoading] = useState(true);
17
+ const [isFetchingFeatures, setIsFetchingFeatures] = useState(true);
18
18
  const [isMapEnabled, setIsMapEnabled] = useState(false);
19
19
  const [baseFeatureCollection, setBaseFeatureCollection] = useState(void 0);
20
20
  const [error, setError] = useState(false);
21
21
  const getData = useCallback(async () => {
22
- setIsLoading(true);
22
+ setIsFetchingFeatures(true);
23
23
  const isMapEnabledResponse = await fetchClientConfigMapEnabled();
24
24
  setIsMapEnabled(isMapEnabledResponse);
25
25
  try {
@@ -54,12 +54,12 @@ const useLoadMapBaseLayer = (baseLayerConfig) => {
54
54
  } catch {
55
55
  setError(true);
56
56
  }
57
- setIsLoading(false);
57
+ setIsFetchingFeatures(false);
58
58
  }, [baseLayerConfig.include, baseLayerConfig.exclude]);
59
59
  useEffect(() => {
60
60
  getData();
61
61
  }, [getData]);
62
- return { isLoading, baseFeatureCollection, isMapEnabled, error };
62
+ return { isFetchingFeatures, baseFeatureCollection, isMapEnabled, error };
63
63
  };
64
64
  export {
65
65
  useLoadMapBaseLayer
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/hooks/use-load-map-base-layer.ts"],
4
- "sourcesContent": ["import { FeatureCollection } from 'geojson';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { BaseLayerRules } from '../types/base-layer.js';\nimport { applyFeatureFilterRules } from '../utils/apply-feature-filter-rules.js';\nimport {\n getCountryRegionsRules,\n getRegionsRules,\n getWorldViewRules,\n} from '../utils/base-layer-rules.js';\nimport {\n fetchCountryFeatures,\n fetchWorldViewFeatures,\n} from '../utils/fetch-base-layer-features.js';\nimport { fetchClientConfigMapEnabled } from '../utils/fetch-client-config-map-enabled.js';\nimport { getBaseLayerShapesRequestConfig } from '../utils/get-base-layer-shapes-request-config.js';\nimport { getTenantCountryCode } from '../utils/get-tenant-country-code.js';\nimport { mergeFeatureCollections } from '../utils/merge-feature-collections.js';\n\nexport const useLoadMapBaseLayer = (baseLayerConfig: BaseLayerRules) => {\n const [isLoading, setIsLoading] = useState(true);\n const [isMapEnabled, setIsMapEnabled] = useState(false);\n const [baseFeatureCollection, setBaseFeatureCollection] = useState<\n FeatureCollection | undefined\n >(undefined);\n const [error, setError] = useState<boolean>(false);\n\n const getData = useCallback(async () => {\n setIsLoading(true);\n\n const isMapEnabledResponse = await fetchClientConfigMapEnabled();\n\n setIsMapEnabled(isMapEnabledResponse);\n\n try {\n if (isMapEnabledResponse) {\n const tenantCountryCode = await getTenantCountryCode();\n\n const { includeWorldView, countryRegions } =\n getBaseLayerShapesRequestConfig(baseLayerConfig.include);\n\n const featuresRequests: Promise<FeatureCollection>[] = [];\n\n if (includeWorldView) {\n const worldViewRules = getWorldViewRules(baseLayerConfig);\n const worldViewRequest = fetchWorldViewFeatures(\n tenantCountryCode,\n ).then(applyFeatureFilterRules(worldViewRules));\n featuresRequests.push(worldViewRequest);\n }\n\n if (countryRegions.length > 0) {\n const regionsRules = getRegionsRules(baseLayerConfig);\n countryRegions.forEach((countryCode: string) => {\n const countryRules = getCountryRegionsRules(\n regionsRules,\n countryCode,\n );\n const countryRequest = fetchCountryFeatures(\n tenantCountryCode,\n countryCode,\n ).then(applyFeatureFilterRules(countryRules, countryCode));\n featuresRequests.push(countryRequest);\n });\n }\n\n const featureCollections = await Promise.all(featuresRequests);\n\n setBaseFeatureCollection(mergeFeatureCollections(featureCollections));\n }\n } catch {\n setError(true);\n }\n\n setIsLoading(false);\n }, [baseLayerConfig.include, baseLayerConfig.exclude]);\n\n useEffect(() => {\n getData();\n }, [getData]);\n return { isLoading, baseFeatureCollection, isMapEnabled, error };\n};\n"],
5
- "mappings": "AACA,SAAS,aAAa,WAAW,gBAAgB;AAGjD,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAChD,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAEjC,MAAM,sBAAsB,CAAC,oBAAoC;AACtE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAExD,MAAS;AACX,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkB,KAAK;AAEjD,QAAM,UAAU,YAAY,YAAY;AACtC,iBAAa,IAAI;AAEjB,UAAM,uBAAuB,MAAM,4BAA4B;AAE/D,oBAAgB,oBAAoB;AAEpC,QAAI;AACF,UAAI,sBAAsB;AACxB,cAAM,oBAAoB,MAAM,qBAAqB;AAErD,cAAM,EAAE,kBAAkB,eAAe,IACvC,gCAAgC,gBAAgB,OAAO;AAEzD,cAAM,mBAAiD,CAAC;AAExD,YAAI,kBAAkB;AACpB,gBAAM,iBAAiB,kBAAkB,eAAe;AACxD,gBAAM,mBAAmB;AAAA,YACvB;AAAA,UACF,EAAE,KAAK,wBAAwB,cAAc,CAAC;AAC9C,2BAAiB,KAAK,gBAAgB;AAAA,QACxC;AAEA,YAAI,eAAe,SAAS,GAAG;AAC7B,gBAAM,eAAe,gBAAgB,eAAe;AACpD,yBAAe,QAAQ,CAAC,gBAAwB;AAC9C,kBAAM,eAAe;AAAA,cACnB;AAAA,cACA;AAAA,YACF;AACA,kBAAM,iBAAiB;AAAA,cACrB;AAAA,cACA;AAAA,YACF,EAAE,KAAK,wBAAwB,cAAc,WAAW,CAAC;AACzD,6BAAiB,KAAK,cAAc;AAAA,UACtC,CAAC;AAAA,QACH;AAEA,cAAM,qBAAqB,MAAM,QAAQ,IAAI,gBAAgB;AAE7D,iCAAyB,wBAAwB,kBAAkB,CAAC;AAAA,MACtE;AAAA,IACF,QAAQ;AACN,eAAS,IAAI;AAAA,IACf;AAEA,iBAAa,KAAK;AAAA,EACpB,GAAG,CAAC,gBAAgB,SAAS,gBAAgB,OAAO,CAAC;AAErD,YAAU,MAAM;AACd,YAAQ;AAAA,EACV,GAAG,CAAC,OAAO,CAAC;AACZ,SAAO,EAAE,WAAW,uBAAuB,cAAc,MAAM;AACjE;",
4
+ "sourcesContent": ["import { FeatureCollection } from 'geojson';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { BaseLayerRules } from '../types/base-layer.js';\nimport { applyFeatureFilterRules } from '../utils/apply-feature-filter-rules.js';\nimport {\n getCountryRegionsRules,\n getRegionsRules,\n getWorldViewRules,\n} from '../utils/base-layer-rules.js';\nimport {\n fetchCountryFeatures,\n fetchWorldViewFeatures,\n} from '../utils/fetch-base-layer-features.js';\nimport { fetchClientConfigMapEnabled } from '../utils/fetch-client-config-map-enabled.js';\nimport { getBaseLayerShapesRequestConfig } from '../utils/get-base-layer-shapes-request-config.js';\nimport { getTenantCountryCode } from '../utils/get-tenant-country-code.js';\nimport { mergeFeatureCollections } from '../utils/merge-feature-collections.js';\n\nexport const useLoadMapBaseLayer = (baseLayerConfig: BaseLayerRules) => {\n const [isFetchingFeatures, setIsFetchingFeatures] = useState(true);\n const [isMapEnabled, setIsMapEnabled] = useState(false);\n const [baseFeatureCollection, setBaseFeatureCollection] = useState<\n FeatureCollection | undefined\n >(undefined);\n const [error, setError] = useState<boolean>(false);\n\n const getData = useCallback(async () => {\n setIsFetchingFeatures(true);\n\n const isMapEnabledResponse = await fetchClientConfigMapEnabled();\n\n setIsMapEnabled(isMapEnabledResponse);\n\n try {\n if (isMapEnabledResponse) {\n const tenantCountryCode = await getTenantCountryCode();\n\n const { includeWorldView, countryRegions } =\n getBaseLayerShapesRequestConfig(baseLayerConfig.include);\n\n const featuresRequests: Promise<FeatureCollection>[] = [];\n\n if (includeWorldView) {\n const worldViewRules = getWorldViewRules(baseLayerConfig);\n const worldViewRequest = fetchWorldViewFeatures(\n tenantCountryCode,\n ).then(applyFeatureFilterRules(worldViewRules));\n featuresRequests.push(worldViewRequest);\n }\n\n if (countryRegions.length > 0) {\n const regionsRules = getRegionsRules(baseLayerConfig);\n countryRegions.forEach((countryCode: string) => {\n const countryRules = getCountryRegionsRules(\n regionsRules,\n countryCode,\n );\n const countryRequest = fetchCountryFeatures(\n tenantCountryCode,\n countryCode,\n ).then(applyFeatureFilterRules(countryRules, countryCode));\n featuresRequests.push(countryRequest);\n });\n }\n\n const featureCollections = await Promise.all(featuresRequests);\n\n setBaseFeatureCollection(mergeFeatureCollections(featureCollections));\n }\n } catch {\n setError(true);\n }\n\n setIsFetchingFeatures(false);\n }, [baseLayerConfig.include, baseLayerConfig.exclude]);\n\n useEffect(() => {\n getData();\n }, [getData]);\n return { isFetchingFeatures, baseFeatureCollection, isMapEnabled, error };\n};\n"],
5
+ "mappings": "AACA,SAAS,aAAa,WAAW,gBAAgB;AAGjD,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAChD,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAEjC,MAAM,sBAAsB,CAAC,oBAAoC;AACtE,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAAS,IAAI;AACjE,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAExD,MAAS;AACX,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkB,KAAK;AAEjD,QAAM,UAAU,YAAY,YAAY;AACtC,0BAAsB,IAAI;AAE1B,UAAM,uBAAuB,MAAM,4BAA4B;AAE/D,oBAAgB,oBAAoB;AAEpC,QAAI;AACF,UAAI,sBAAsB;AACxB,cAAM,oBAAoB,MAAM,qBAAqB;AAErD,cAAM,EAAE,kBAAkB,eAAe,IACvC,gCAAgC,gBAAgB,OAAO;AAEzD,cAAM,mBAAiD,CAAC;AAExD,YAAI,kBAAkB;AACpB,gBAAM,iBAAiB,kBAAkB,eAAe;AACxD,gBAAM,mBAAmB;AAAA,YACvB;AAAA,UACF,EAAE,KAAK,wBAAwB,cAAc,CAAC;AAC9C,2BAAiB,KAAK,gBAAgB;AAAA,QACxC;AAEA,YAAI,eAAe,SAAS,GAAG;AAC7B,gBAAM,eAAe,gBAAgB,eAAe;AACpD,yBAAe,QAAQ,CAAC,gBAAwB;AAC9C,kBAAM,eAAe;AAAA,cACnB;AAAA,cACA;AAAA,YACF;AACA,kBAAM,iBAAiB;AAAA,cACrB;AAAA,cACA;AAAA,YACF,EAAE,KAAK,wBAAwB,cAAc,WAAW,CAAC;AACzD,6BAAiB,KAAK,cAAc;AAAA,UACtC,CAAC;AAAA,QACH;AAEA,cAAM,qBAAqB,MAAM,QAAQ,IAAI,gBAAgB;AAE7D,iCAAyB,wBAAwB,kBAAkB,CAAC;AAAA,MACtE;AAAA,IACF,QAAQ;AACN,eAAS,IAAI;AAAA,IACf;AAEA,0BAAsB,KAAK;AAAA,EAC7B,GAAG,CAAC,gBAAgB,SAAS,gBAAgB,OAAO,CAAC;AAErD,YAAU,MAAM;AACd,YAAQ;AAAA,EACV,GAAG,CAAC,OAAO,CAAC;AACZ,SAAO,EAAE,oBAAoB,uBAAuB,cAAc,MAAM;AAC1E;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
+ import { useMap } from "@vis.gl/react-maplibre";
1
2
  import { useEffect } from "react";
2
- import { useMap } from "react-map-gl/maplibre";
3
3
  const useMapMouseMove = (layerIds, callback) => {
4
4
  const { current: map } = useMap();
5
5
  useEffect(() => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/hooks/use-map-mouse-move.ts"],
4
- "sourcesContent": ["import type { MapLayerMouseEvent } from 'maplibre-gl';\nimport { useEffect } from 'react';\nimport { useMap } from 'react-map-gl/maplibre';\n\nexport const useMapMouseMove = (\n layerIds: string[],\n callback: (event: MapLayerMouseEvent) => void,\n) => {\n const { current: map } = useMap();\n\n useEffect(() => {\n layerIds.forEach((layerId) => {\n map?.on('mousemove', layerId, callback);\n });\n\n return () => {\n layerIds.forEach((layerId) => {\n map?.off('mousemove', layerId, callback);\n });\n };\n });\n};\n"],
5
- "mappings": "AACA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEhB,MAAM,kBAAkB,CAC7B,UACA,aACG;AACH,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAEhC,YAAU,MAAM;AACd,aAAS,QAAQ,CAAC,YAAY;AAC5B,WAAK,GAAG,aAAa,SAAS,QAAQ;AAAA,IACxC,CAAC;AAED,WAAO,MAAM;AACX,eAAS,QAAQ,CAAC,YAAY;AAC5B,aAAK,IAAI,aAAa,SAAS,QAAQ;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
4
+ "sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport { useEffect } from 'react';\n\nexport const useMapMouseMove = (\n layerIds: string[],\n callback: (event: MapLayerMouseEvent) => void,\n) => {\n const { current: map } = useMap();\n\n useEffect(() => {\n layerIds.forEach((layerId) => {\n map?.on('mousemove', layerId, callback);\n });\n\n return () => {\n layerIds.forEach((layerId) => {\n map?.off('mousemove', layerId, callback);\n });\n };\n });\n};\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAEnB,MAAM,kBAAkB,CAC7B,UACA,aACG;AACH,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAEhC,YAAU,MAAM;AACd,aAAS,QAAQ,CAAC,YAAY;AAC5B,WAAK,GAAG,aAAa,SAAS,QAAQ;AAAA,IACxC,CAAC;AAED,WAAO,MAAM;AACX,eAAS,QAAQ,CAAC,YAAY;AAC5B,aAAK,IAAI,aAAa,SAAS,QAAQ;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -29,12 +29,16 @@ const useResolveColor = (defaultColor, props, colorParser) => {
29
29
  const useResolveLocationColor = (defaultColor, props, colorParser) => {
30
30
  return useResolveColor(defaultColor, props, colorParser);
31
31
  };
32
+ const useResolveConnectionColor = (defaultColor, props, colorParser) => {
33
+ return useResolveColor(defaultColor, props, colorParser);
34
+ };
32
35
  const useResolveChoroplethColor = (defaultColor, props, colorParser) => {
33
36
  return useResolveColor(defaultColor, props, colorParser);
34
37
  };
35
38
  export {
36
39
  useResolveChoroplethColor,
37
40
  useResolveColor,
41
+ useResolveConnectionColor,
38
42
  useResolveLocationColor
39
43
  };
40
44
  //# sourceMappingURL=use-resolve-color.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/hooks/use-resolve-color.ts"],
4
- "sourcesContent": ["import { isUndefined } from 'lodash-es';\n\nimport { _accessValue as accessValue } from '@dynatrace/strato-components-preview/core';\n\nimport { useColorScale } from './use-color-scale.js';\nimport { DEFAULT_RANGE_COLOR } from '../constants.js';\nimport { useMapConfig } from './use-map-config.js';\nimport {\n ChoroplethCustomColorProps,\n ColorParser,\n isLegendColoring,\n LegendColorLayerProps,\n LocationColorProps,\n} from '../types/coloring.js';\nimport { Location } from '../types/location.js';\nimport { isSequentialLegend } from '../utils/build-scale-from-legend-config.js';\n\nexport const useResolveColor = (\n defaultColor: string,\n props:\n | LocationColorProps<never>\n | ChoroplethCustomColorProps<never>\n | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n const legendColoring = useColorScale();\n\n const { legend } = useMapConfig();\n\n if (!isLegendColoring(props)) {\n return props.color ?? defaultColor;\n }\n\n const fallbackColor =\n !isUndefined(legend) && isSequentialLegend(legend)\n ? DEFAULT_RANGE_COLOR\n : defaultColor;\n\n let colorLegend: ((item: Record<string, unknown>) => string) | string =\n fallbackColor;\n\n if (!isUndefined(legendColoring) && !isUndefined(colorParser)) {\n colorLegend = (item: Record<string, unknown>): string => {\n const value = accessValue<number | string>(item, props.valueAccessor);\n if (isUndefined(value)) {\n return fallbackColor;\n }\n\n return colorParser(value) ?? fallbackColor;\n };\n }\n\n return colorLegend;\n};\n\nexport const useResolveLocationColor = <T extends Location>(\n defaultColor: string,\n props: LocationColorProps<T> | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n return useResolveColor(defaultColor, props, colorParser) as\n | string\n | ((item: T) => string);\n};\n\nexport const useResolveChoroplethColor = <T extends Record<string, unknown>>(\n defaultColor: string,\n props: ChoroplethCustomColorProps<T> | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n return useResolveColor(defaultColor, props, colorParser) as\n | string\n | ((item: T) => string);\n};\n"],
5
- "mappings": "AAAA,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,mBAAmB;AAE5C,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B;AAAA,EAGE;AAAA,OAGK;AAEP,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,CAC7B,cACA,OAIA,gBACG;AACH,QAAM,iBAAiB,cAAc;AAErC,QAAM,EAAE,OAAO,IAAI,aAAa;AAEhC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,WAAO,MAAM,SAAS;AAAA,EACxB;AAEA,QAAM,gBACJ,CAAC,YAAY,MAAM,KAAK,mBAAmB,MAAM,IAC7C,sBACA;AAEN,MAAI,cACF;AAEF,MAAI,CAAC,YAAY,cAAc,KAAK,CAAC,YAAY,WAAW,GAAG;AAC7D,kBAAc,CAAC,SAA0C;AACvD,YAAM,QAAQ,YAA6B,MAAM,MAAM,aAAa;AACpE,UAAI,YAAY,KAAK,GAAG;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,YAAY,KAAK,KAAK;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,0BAA0B,CACrC,cACA,OACA,gBACG;AACH,SAAO,gBAAgB,cAAc,OAAO,WAAW;AAGzD;AAEO,MAAM,4BAA4B,CACvC,cACA,OACA,gBACG;AACH,SAAO,gBAAgB,cAAc,OAAO,WAAW;AAGzD;",
4
+ "sourcesContent": ["import { isUndefined } from 'lodash-es';\n\nimport { _accessValue as accessValue } from '@dynatrace/strato-components-preview/core';\n\nimport { useColorScale } from './use-color-scale.js';\nimport { DEFAULT_RANGE_COLOR } from '../constants.js';\nimport { useMapConfig } from './use-map-config.js';\nimport {\n ChoroplethCustomColorProps,\n ColorParser,\n ConnectionColorProps,\n isLegendColoring,\n LegendColorLayerProps,\n LocationColorProps,\n} from '../types/coloring.js';\nimport { Connection } from '../types/connection-layer.js';\nimport { Location } from '../types/location.js';\nimport { isSequentialLegend } from '../utils/build-scale-from-legend-config.js';\n\nexport const useResolveColor = (\n defaultColor: string,\n props:\n | LocationColorProps<never>\n | ConnectionColorProps<never>\n | ChoroplethCustomColorProps<never>\n | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n const legendColoring = useColorScale();\n\n const { legend } = useMapConfig();\n\n if (!isLegendColoring(props)) {\n return props.color ?? defaultColor;\n }\n\n const fallbackColor =\n !isUndefined(legend) && isSequentialLegend(legend)\n ? DEFAULT_RANGE_COLOR\n : defaultColor;\n\n let colorLegend: ((item: Record<string, unknown>) => string) | string =\n fallbackColor;\n\n if (!isUndefined(legendColoring) && !isUndefined(colorParser)) {\n colorLegend = (item: Record<string, unknown>): string => {\n const value = accessValue<number | string>(item, props.valueAccessor);\n if (isUndefined(value)) {\n return fallbackColor;\n }\n\n return colorParser(value) ?? fallbackColor;\n };\n }\n\n return colorLegend;\n};\n\nexport const useResolveLocationColor = <T extends Location>(\n defaultColor: string,\n props: LocationColorProps<T> | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n return useResolveColor(defaultColor, props, colorParser) as\n | string\n | ((item: T) => string);\n};\n\nexport const useResolveConnectionColor = <T extends Connection>(\n defaultColor: string,\n props: ConnectionColorProps<T> | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n return useResolveColor(defaultColor, props, colorParser) as\n | string\n | ((item: T) => string);\n};\n\nexport const useResolveChoroplethColor = <T extends Record<string, unknown>>(\n defaultColor: string,\n props: ChoroplethCustomColorProps<T> | LegendColorLayerProps,\n colorParser?: ColorParser,\n) => {\n return useResolveColor(defaultColor, props, colorParser) as\n | string\n | ((item: T) => string);\n};\n"],
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,mBAAmB;AAE5C,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B;AAAA,EAIE;AAAA,OAGK;AAGP,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,CAC7B,cACA,OAKA,gBACG;AACH,QAAM,iBAAiB,cAAc;AAErC,QAAM,EAAE,OAAO,IAAI,aAAa;AAEhC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,WAAO,MAAM,SAAS;AAAA,EACxB;AAEA,QAAM,gBACJ,CAAC,YAAY,MAAM,KAAK,mBAAmB,MAAM,IAC7C,sBACA;AAEN,MAAI,cACF;AAEF,MAAI,CAAC,YAAY,cAAc,KAAK,CAAC,YAAY,WAAW,GAAG;AAC7D,kBAAc,CAAC,SAA0C;AACvD,YAAM,QAAQ,YAA6B,MAAM,MAAM,aAAa;AACpE,UAAI,YAAY,KAAK,GAAG;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,YAAY,KAAK,KAAK;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,0BAA0B,CACrC,cACA,OACA,gBACG;AACH,SAAO,gBAAgB,cAAc,OAAO,WAAW;AAGzD;AAEO,MAAM,4BAA4B,CACvC,cACA,OACA,gBACG;AACH,SAAO,gBAAgB,cAAc,OAAO,WAAW;AAGzD;AAEO,MAAM,4BAA4B,CACvC,cACA,OACA,gBACG;AACH,SAAO,gBAAgB,cAAc,OAAO,WAAW;AAGzD;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
+ import { useMap } from "@vis.gl/react-maplibre";
1
2
  import { useImperativeHandle } from "react";
2
- import { useMap } from "react-map-gl/maplibre";
3
3
  import { FIT_BOUNDS_OPTIONS } from "../constants.js";
4
4
  import { useDataBoundingBox } from "../hooks/use-data-bounding-box.js";
5
5
  import { useInitialViewContext } from "../hooks/use-initial-view-context.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/providers/imperative-handler.provider.ts"],
4
- "sourcesContent": ["import { PropsWithChildren, useImperativeHandle } from 'react';\nimport { useMap } from 'react-map-gl/maplibre';\n\nimport { FIT_BOUNDS_OPTIONS } from '../constants.js';\nimport { useDataBoundingBox } from '../hooks/use-data-bounding-box.js';\nimport { useInitialViewContext } from '../hooks/use-initial-view-context.js';\nimport { useMapRawData } from '../hooks/use-map-raw-data.js';\nimport type { MapViewRef } from '../types/map-view.js';\nimport { buildAndDownloadCsv } from '../utils/build-and-download-csv.js';\n\nexport interface MapViewImperativeHandlerProps {\n forwardedRef: React.Ref<MapViewRef>;\n containerRef: React.RefObject<HTMLDivElement>;\n}\n\nexport const MapViewImperativeHandler = ({\n forwardedRef,\n containerRef,\n children,\n}: PropsWithChildren<MapViewImperativeHandlerProps>) => {\n const layersData = useMapRawData();\n const { current: map } = useMap();\n const { longitude = 0, latitude = 0, zoom = 0 } = useInitialViewContext();\n const boundingBox = useDataBoundingBox();\n const zoomOutEnabled = map && map?.getMinZoom() !== map?.getZoom();\n const zoomInEnabled = map && map?.getMaxZoom() !== map?.getZoom();\n\n useImperativeHandle(forwardedRef, () => ({\n element: containerRef.current,\n downloadData: () => {\n buildAndDownloadCsv(layersData);\n },\n zoomIn: () => zoomInEnabled && map?.zoomIn(),\n zoomOut: () => zoomOutEnabled && map?.zoomOut(),\n zoomToFit: () => map?.fitBounds(boundingBox, FIT_BOUNDS_OPTIONS),\n reset: () => map?.flyTo({ center: [longitude, latitude], zoom: zoom }),\n }));\n\n return children;\n};\n"],
5
- "mappings": "AAAA,SAA4B,2BAA2B;AACvD,SAAS,cAAc;AAEvB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,2BAA2B;AAO7B,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAAwD;AACtD,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,EAAE,YAAY,GAAG,WAAW,GAAG,OAAO,EAAE,IAAI,sBAAsB;AACxE,QAAM,cAAc,mBAAmB;AACvC,QAAM,iBAAiB,OAAO,KAAK,WAAW,MAAM,KAAK,QAAQ;AACjE,QAAM,gBAAgB,OAAO,KAAK,WAAW,MAAM,KAAK,QAAQ;AAEhE,sBAAoB,cAAc,OAAO;AAAA,IACvC,SAAS,aAAa;AAAA,IACtB,cAAc,MAAM;AAClB,0BAAoB,UAAU;AAAA,IAChC;AAAA,IACA,QAAQ,MAAM,iBAAiB,KAAK,OAAO;AAAA,IAC3C,SAAS,MAAM,kBAAkB,KAAK,QAAQ;AAAA,IAC9C,WAAW,MAAM,KAAK,UAAU,aAAa,kBAAkB;AAAA,IAC/D,OAAO,MAAM,KAAK,MAAM,EAAE,QAAQ,CAAC,WAAW,QAAQ,GAAG,KAAW,CAAC;AAAA,EACvE,EAAE;AAEF,SAAO;AACT;",
4
+ "sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport { PropsWithChildren, useImperativeHandle } from 'react';\n\nimport { FIT_BOUNDS_OPTIONS } from '../constants.js';\nimport { useDataBoundingBox } from '../hooks/use-data-bounding-box.js';\nimport { useInitialViewContext } from '../hooks/use-initial-view-context.js';\nimport { useMapRawData } from '../hooks/use-map-raw-data.js';\nimport type { MapViewRef } from '../types/map-view.js';\nimport { buildAndDownloadCsv } from '../utils/build-and-download-csv.js';\n\nexport interface MapViewImperativeHandlerProps {\n forwardedRef: React.Ref<MapViewRef>;\n containerRef: React.RefObject<HTMLDivElement>;\n}\n\nexport const MapViewImperativeHandler = ({\n forwardedRef,\n containerRef,\n children,\n}: PropsWithChildren<MapViewImperativeHandlerProps>) => {\n const layersData = useMapRawData();\n const { current: map } = useMap();\n const { longitude = 0, latitude = 0, zoom = 0 } = useInitialViewContext();\n const boundingBox = useDataBoundingBox();\n const zoomOutEnabled = map && map?.getMinZoom() !== map?.getZoom();\n const zoomInEnabled = map && map?.getMaxZoom() !== map?.getZoom();\n\n useImperativeHandle(forwardedRef, () => ({\n element: containerRef.current,\n downloadData: () => {\n buildAndDownloadCsv(layersData);\n },\n zoomIn: () => zoomInEnabled && map?.zoomIn(),\n zoomOut: () => zoomOutEnabled && map?.zoomOut(),\n zoomToFit: () => map?.fitBounds(boundingBox, FIT_BOUNDS_OPTIONS),\n reset: () => map?.flyTo({ center: [longitude, latitude], zoom: zoom }),\n }));\n\n return children;\n};\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AACvB,SAA4B,2BAA2B;AAEvD,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,2BAA2B;AAO7B,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAAwD;AACtD,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,EAAE,YAAY,GAAG,WAAW,GAAG,OAAO,EAAE,IAAI,sBAAsB;AACxE,QAAM,cAAc,mBAAmB;AACvC,QAAM,iBAAiB,OAAO,KAAK,WAAW,MAAM,KAAK,QAAQ;AACjE,QAAM,gBAAgB,OAAO,KAAK,WAAW,MAAM,KAAK,QAAQ;AAEhE,sBAAoB,cAAc,OAAO;AAAA,IACvC,SAAS,aAAa;AAAA,IACtB,cAAc,MAAM;AAClB,0BAAoB,UAAU;AAAA,IAChC;AAAA,IACA,QAAQ,MAAM,iBAAiB,KAAK,OAAO;AAAA,IAC3C,SAAS,MAAM,kBAAkB,KAAK,QAAQ;AAAA,IAC9C,WAAW,MAAM,KAAK,UAAU,aAAa,kBAAkB;AAAA,IAC/D,OAAO,MAAM,KAAK,MAAM,EAAE,QAAQ,CAAC,WAAW,QAAQ,GAAG,KAAW,CAAC;AAAA,EACvE,EAAE;AAEF,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
+ import { useMap } from "@vis.gl/react-maplibre";
1
2
  import React, { useMemo, useRef } from "react";
2
- import { useMap } from "react-map-gl";
3
3
  import { MapInitialViewContext } from "../contexts/map-initial-view.context.js";
4
4
  const DEFAULT_CENTER = { lat: 0, lng: 0 };
5
5
  const MapInitialViewProvider = ({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/providers/map-initial-view.provider.tsx"],
4
- "sourcesContent": ["import React, { useMemo, useRef, type PropsWithChildren } from 'react';\nimport { useMap } from 'react-map-gl';\n\nimport { MapInitialViewContext } from '../contexts/map-initial-view.context.js';\nimport type { ViewState } from '../types/map-view.js';\n\n/**\n * This default center is unreachable in runtime, but useful for testing and type-safety\n */\nconst DEFAULT_CENTER = { lat: 0, lng: 0 };\n\n/**\n *\n * Since the initial view state can be determined in 2 different ways\n * this provider takes care of taking a snapshot of the initial state that was\n * set when the map was initialized and normalize it storing the latitude\n * longitude and zoom to later retrieve it in the Reset Toolbar button.\n *\n * Notice how this Provider is design to not trigger any re-renders and just\n * hold the initial state view.\n */\nexport const MapInitialViewProvider = ({\n children,\n}: PropsWithChildren<ViewState>) => {\n const { current: map } = useMap();\n const boundaries = useRef(map?.getCenter() ?? DEFAULT_CENTER);\n const zoom = useRef(map?.getZoom()).current;\n\n const { lng: longitude, lat: latitude } = boundaries.current;\n\n return (\n <MapInitialViewContext.Provider\n value={useMemo(\n () => ({ latitude, longitude, zoom }),\n [latitude, longitude, zoom],\n )}\n >\n {children}\n </MapInitialViewContext.Provider>\n );\n};\n"],
5
- "mappings": "AAAA,OAAO,SAAS,SAAS,cAAsC;AAC/D,SAAS,cAAc;AAEvB,SAAS,6BAA6B;AAMtC,MAAM,iBAAiB,EAAE,KAAK,GAAG,KAAK,EAAE;AAYjC,MAAM,yBAAyB,CAAC;AAAA,EACrC;AACF,MAAoC;AAClC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,aAAa,OAAO,KAAK,UAAU,KAAK,cAAc;AAC5D,QAAM,OAAO,OAAO,KAAK,QAAQ,CAAC,EAAE;AAEpC,QAAM,EAAE,KAAK,WAAW,KAAK,SAAS,IAAI,WAAW;AAErD,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,OAAO,EAAE,UAAU,WAAW,KAAK;AAAA,QACnC,CAAC,UAAU,WAAW,IAAI;AAAA,MAC5B;AAAA;AAAA,IAEC;AAAA,EACH;AAEJ;",
4
+ "sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useMemo, useRef, type PropsWithChildren } from 'react';\n\nimport { MapInitialViewContext } from '../contexts/map-initial-view.context.js';\nimport type { ViewState } from '../types/map-view.js';\n\n/**\n * This default center is unreachable in runtime, but useful for testing and type-safety\n */\nconst DEFAULT_CENTER = { lat: 0, lng: 0 };\n\n/**\n *\n * Since the initial view state can be determined in 2 different ways\n * this provider takes care of taking a snapshot of the initial state that was\n * set when the map was initialized and normalize it storing the latitude\n * longitude and zoom to later retrieve it in the Reset Toolbar button.\n *\n * Notice how this Provider is design to not trigger any re-renders and just\n * hold the initial state view.\n */\nexport const MapInitialViewProvider = ({\n children,\n}: PropsWithChildren<ViewState>) => {\n const { current: map } = useMap();\n const boundaries = useRef(map?.getCenter() ?? DEFAULT_CENTER);\n const zoom = useRef(map?.getZoom()).current;\n\n const { lng: longitude, lat: latitude } = boundaries.current;\n\n return (\n <MapInitialViewContext.Provider\n value={useMemo(\n () => ({ latitude, longitude, zoom }),\n [latitude, longitude, zoom],\n )}\n >\n {children}\n </MapInitialViewContext.Provider>\n );\n};\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,SAAS,cAAsC;AAE/D,SAAS,6BAA6B;AAMtC,MAAM,iBAAiB,EAAE,KAAK,GAAG,KAAK,EAAE;AAYjC,MAAM,yBAAyB,CAAC;AAAA,EACrC;AACF,MAAoC;AAClC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,aAAa,OAAO,KAAK,UAAU,KAAK,cAAc;AAC5D,QAAM,OAAO,OAAO,KAAK,QAAQ,CAAC,EAAE;AAEpC,QAAM,EAAE,KAAK,WAAW,KAAK,SAAS,IAAI,WAAW;AAErD,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,OAAO,EAAE,UAAU,WAAW,KAAK;AAAA,QACnC,CAAC,UAAU,WAAW,IAAI;AAAA,MAC5B;AAAA;AAAA,IAEC;AAAA,EACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/BaseLayer.ts"],
4
- "sourcesContent": ["import type { BaseLayerProps } from '../types/base-layer.js';\n\n/** The base layer component, used to configure the inclusion and exclusion of countries and regions*/\nexport const BaseLayer = (_props: BaseLayerProps) => null;\nBaseLayer['displayName'] = 'BaseLayerSlot';\n"],
5
- "mappings": "AAGO,MAAM,YAAY,CAAC,WAA2B;AACrD,UAAU,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { BaseLayerProps } from '../types/base-layer.js';\n\n/**\n * The base layer component, used to configure the inclusion and exclusion of countries and regions\n * @public\n */\nexport const BaseLayer = (_props: BaseLayerProps) => null;\nBaseLayer['displayName'] = 'BaseLayerSlot';\n"],
5
+ "mappings": "AAMO,MAAM,YAAY,CAAC,WAA2B;AACrD,UAAU,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/BubbleLayer.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { BubbleLayerTooltip } from './BubbleLayerTooltip.js';\nimport type { BubbleLayerProps } from '../types/bubble-layer.js';\nimport type { Location } from '../types/location.js';\n\n/**\n * The `BubbleLayer` component renders data points as bubbles on a map, accepting an array of data points\n * with required properties like latitude and longitude. It supports customization of bubble size\n * using the radius prop and optional tooltips for displaying additional information.\n */\nexport const BubbleLayer = <T extends Location>(\n _: PropsWithChildren<BubbleLayerProps<T>>,\n) => null;\n\nBubbleLayer.Tooltip = BubbleLayerTooltip;\nBubbleLayer['displayName'] = 'BubbleLayerSlot';\n"],
5
- "mappings": "AAEA,SAAS,0BAA0B;AAS5B,MAAM,cAAc,CACzB,MACG;AAEL,YAAY,UAAU;AACtB,YAAY,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { BubbleLayerTooltip } from './BubbleLayerTooltip.js';\nimport type { BubbleLayerProps } from '../types/bubble-layer.js';\nimport type { Location } from '../types/location.js';\n\n/**\n * The `BubbleLayer` component renders data points as bubbles on a map, accepting an array of data points\n * with required properties like latitude and longitude. It supports customization of bubble size\n * using the radius prop and optional tooltips for displaying additional information.\n * @public\n */\nexport const BubbleLayer = <T extends Location>(\n _: PropsWithChildren<BubbleLayerProps<T>>,\n) => null;\n\nBubbleLayer.Tooltip = BubbleLayerTooltip;\nBubbleLayer['displayName'] = 'BubbleLayerSlot';\n"],
5
+ "mappings": "AAEA,SAAS,0BAA0B;AAU5B,MAAM,cAAc,CACzB,MACG;AAEL,YAAY,UAAU;AACtB,YAAY,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/CategoricalLegend.tsx"],
4
- "sourcesContent": ["import type { CategoricalLegendProps } from '../types/legend.js';\n\n/** The categorical legend slot component */\nexport const CategoricalLegend = (props: CategoricalLegendProps) => null;\n\nCategoricalLegend['displayName'] = 'CategoricalLegend';\n"],
5
- "mappings": "AAGO,MAAM,oBAAoB,CAAC,UAAkC;AAEpE,kBAAkB,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { CategoricalLegendProps } from '../types/legend.js';\n\n/**\n * The categorical legend slot component\n * @public\n */\nexport const CategoricalLegend = (props: CategoricalLegendProps) => null;\n\nCategoricalLegend['displayName'] = 'CategoricalLegend';\n"],
5
+ "mappings": "AAMO,MAAM,oBAAoB,CAAC,UAAkC;AAEpE,kBAAkB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { Zoom } from "./Zoom.js";
2
2
  import { ZoomToFit } from "./ZoomToFit.js";
3
- const _ChartInteractions = (props) => null;
4
- _ChartInteractions["displayName"] = "ChartInteractions";
5
- const ChartInteractions = Object.assign(_ChartInteractions, {
3
+ const ChartInteractionsRoot = (props) => null;
4
+ ChartInteractionsRoot["displayName"] = "ChartInteractions";
5
+ const ChartInteractions = Object.assign(ChartInteractionsRoot, {
6
6
  Zoom,
7
7
  ZoomToFit
8
8
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/ChartInteractions.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { Zoom } from './Zoom.js';\nimport { ZoomToFit } from './ZoomToFit.js';\nimport type { ChartInteractionsProps } from '../types/toolbar.js';\n\n/**\n * ChartInteractions slot component.\n */\nconst _ChartInteractions = (props: PropsWithChildren<ChartInteractionsProps>) =>\n null;\n\n_ChartInteractions['displayName'] = 'ChartInteractions';\n\n/** ChartInteractions interactions slot component */\nexport const ChartInteractions = Object.assign(_ChartInteractions, {\n Zoom,\n ZoomToFit,\n});\n"],
5
- "mappings": "AAEA,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAM1B,MAAM,qBAAqB,CAAC,UAC1B;AAEF,mBAAmB,aAAa,IAAI;AAG7B,MAAM,oBAAoB,OAAO,OAAO,oBAAoB;AAAA,EACjE;AAAA,EACA;AACF,CAAC;",
4
+ "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { Zoom } from './Zoom.js';\nimport { ZoomToFit } from './ZoomToFit.js';\nimport type { ChartInteractionsProps } from '../types/toolbar.js';\n\n/**\n * ChartInteractions slot component.\n */\nconst ChartInteractionsRoot = (\n props: PropsWithChildren<ChartInteractionsProps>,\n) => null;\n\nChartInteractionsRoot['displayName'] = 'ChartInteractions';\n\n/**\n * ChartInteractions interactions slot component\n * @public\n */\nexport const ChartInteractions = Object.assign(ChartInteractionsRoot, {\n Zoom,\n ZoomToFit,\n});\n"],
5
+ "mappings": "AAEA,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAM1B,MAAM,wBAAwB,CAC5B,UACG;AAEL,sBAAsB,aAAa,IAAI;AAMhC,MAAM,oBAAoB,OAAO,OAAO,uBAAuB;AAAA,EACpE;AAAA,EACA;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/ChoroplethLayer.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { ChoroplethLayerTooltip } from './ChoroplethLayerTooltip.js';\nimport type { ChoroplethLayerProps } from '../types/choropleth-layer.js';\n\n/**\n * The `ChoroplethLayer` component allows users to display divided geographical\n * areas or regions that are coloured in relation to a given data. It provides an\n * easy way to visualize how a variable varies across a geographic area or show\n * the level of variability within a region.\n */\nexport const ChoroplethLayer = <T extends Record<string, unknown>>(\n _: PropsWithChildren<ChoroplethLayerProps<T>>,\n) => null;\n\nChoroplethLayer.Tooltip = ChoroplethLayerTooltip;\nChoroplethLayer['displayName'] = 'ChoroplethLayerSlot';\n"],
5
- "mappings": "AAEA,SAAS,8BAA8B;AAShC,MAAM,kBAAkB,CAC7B,MACG;AAEL,gBAAgB,UAAU;AAC1B,gBAAgB,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { ChoroplethLayerTooltip } from './ChoroplethLayerTooltip.js';\nimport type { ChoroplethLayerProps } from '../types/choropleth-layer.js';\n\n/**\n * The `ChoroplethLayer` component allows users to display divided geographical\n * areas or regions that are coloured in relation to a given data. It provides an\n * easy way to visualize how a variable varies across a geographic area or show\n * the level of variability within a region.\n * @public\n */\nexport const ChoroplethLayer = <T extends Record<string, unknown>>(\n _: PropsWithChildren<ChoroplethLayerProps<T>>,\n) => null;\n\nChoroplethLayer.Tooltip = ChoroplethLayerTooltip;\nChoroplethLayer['displayName'] = 'ChoroplethLayerSlot';\n"],
5
+ "mappings": "AAEA,SAAS,8BAA8B;AAUhC,MAAM,kBAAkB,CAC7B,MACG;AAEL,gBAAgB,UAAU;AAC1B,gBAAgB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/ConnectionLayer.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { ConnectionLayerTooltip } from './ConnectionLayerTooltip.js';\nimport type {\n ConnectionLayerProps,\n Connection,\n} from '../types/connection-layer.js';\n\n/**\n * The `ConnectionLayer` component renders connections between points on a map,\n * accepting an array of `Connection` data points with required properties like\n * latitude and longitude. It supports customization of color, thickness,\n * direction the connection indicators.\n */\nexport const ConnectionLayer = <T extends Connection>(\n _: PropsWithChildren<ConnectionLayerProps<T>>,\n) => null;\n\nConnectionLayer.Tooltip = ConnectionLayerTooltip;\n\nConnectionLayer['displayName'] = 'ConnectionLayerSlot';\n"],
5
- "mappings": "AAEA,SAAS,8BAA8B;AAYhC,MAAM,kBAAkB,CAC7B,MACG;AAEL,gBAAgB,UAAU;AAE1B,gBAAgB,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { ConnectionLayerTooltip } from './ConnectionLayerTooltip.js';\nimport type {\n Connection,\n ConnectionLayerProps,\n} from '../types/connection-layer.js';\n\n/**\n * The `ConnectionLayer` component renders connections between points on a map,\n * accepting an array of `Connection` data points with required properties like\n * latitude and longitude. It supports customization of color, thickness,\n * direction the connection indicators.\n * @public\n */\nexport const ConnectionLayer = <T extends Connection>(\n _: PropsWithChildren<ConnectionLayerProps<T>>,\n) => null;\n\nConnectionLayer.Tooltip = ConnectionLayerTooltip;\n\nConnectionLayer['displayName'] = 'ConnectionLayerSlot';\n"],
5
+ "mappings": "AAEA,SAAS,8BAA8B;AAahC,MAAM,kBAAkB,CAC7B,MACG;AAEL,gBAAgB,UAAU;AAE1B,gBAAgB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/DotLayer.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport type { DotLayerProps } from '../types/dot-layer.js';\nimport type { Location } from '../types/location.js';\n\n/**\n * The `DotLayer` component renders data points on a map, accepting an array of data points\n * with required properties like latitude and longitude. It provides support\n * for various shapes, optional features like custom background for icons, rotation,\n * and tooltips, along with granular color customization and integration with\n * legends for color configuration.\n */\nexport const DotLayer = <T extends Location>(\n _: PropsWithChildren<DotLayerProps<T>>,\n) => null;\n\nDotLayer.Tooltip = DotLayerTooltip;\nDotLayer['displayName'] = 'DotLayerSlot';\n"],
5
- "mappings": "AAEA,SAAS,uBAAuB;AAWzB,MAAM,WAAW,CACtB,MACG;AAEL,SAAS,UAAU;AACnB,SAAS,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { PropsWithChildren } from 'react';\n\nimport { DotLayerTooltip } from './DotLayerTooltip.js';\nimport type { DotLayerProps } from '../types/dot-layer.js';\nimport type { Location } from '../types/location.js';\n\n/**\n * The `DotLayer` component renders data points on a map, accepting an array of data points\n * with required properties like latitude and longitude. It provides support\n * for various shapes, optional features like custom background for icons, rotation,\n * and tooltips, along with granular color customization and integration with\n * legends for color configuration.\n * @public\n */\nexport const DotLayer = <T extends Location>(\n _: PropsWithChildren<DotLayerProps<T>>,\n) => null;\n\nDotLayer.Tooltip = DotLayerTooltip;\nDotLayer['displayName'] = 'DotLayerSlot';\n"],
5
+ "mappings": "AAEA,SAAS,uBAAuB;AAYzB,MAAM,WAAW,CACtB,MACG;AAEL,SAAS,UAAU;AACnB,SAAS,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/SequentialLegend.tsx"],
4
- "sourcesContent": ["import type { SequentialLegendProps } from '../types/legend.js';\n\n/** The sequential legend slot component */\nexport const SequentialLegend = (props: SequentialLegendProps) => null;\n\nSequentialLegend['displayName'] = 'SequentialLegend';\n"],
5
- "mappings": "AAGO,MAAM,mBAAmB,CAAC,UAAiC;AAElE,iBAAiB,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { SequentialLegendProps } from '../types/legend.js';\n\n/**\n * The sequential legend slot component\n * @public\n */\nexport const SequentialLegend = (props: SequentialLegendProps) => null;\n\nSequentialLegend['displayName'] = 'SequentialLegend';\n"],
5
+ "mappings": "AAMO,MAAM,mBAAmB,CAAC,UAAiC;AAElE,iBAAiB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/ThresholdLegend.ts"],
4
- "sourcesContent": ["import type { ThresholdLegendProps } from '../types/legend.js';\n\n/** The sequential legend slot component */\nexport const ThresholdLegend = (props: ThresholdLegendProps) => null;\n\nThresholdLegend['displayName'] = 'ThresholdLegend';\n"],
5
- "mappings": "AAGO,MAAM,kBAAkB,CAAC,UAAgC;AAEhE,gBAAgB,aAAa,IAAI;",
4
+ "sourcesContent": ["import type { ThresholdLegendProps } from '../types/legend.js';\n\n/**\n * The sequential legend slot component\n * @public\n */\nexport const ThresholdLegend = (props: ThresholdLegendProps) => null;\n\nThresholdLegend['displayName'] = 'ThresholdLegend';\n"],
5
+ "mappings": "AAMO,MAAM,kBAAkB,CAAC,UAAgC;AAEhE,gBAAgB,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/slots/states/ErrorStateSlot.tsx"],
4
- "sourcesContent": ["import type { ReactNode, JSX } from 'react';\n\nexport interface ErrorStateSlotProps {\n children: ReactNode | ((errorMessage: string) => JSX.Element);\n}\n\nexport const ErrorStateSlot = (props: ErrorStateSlotProps) => null;\n"],
5
- "mappings": "AAMO,MAAM,iBAAiB,CAAC,UAA+B;",
4
+ "sourcesContent": ["import type { ReactNode, JSX } from 'react';\n\n/**\n * @public\n */\nexport interface ErrorStateSlotProps {\n children: ReactNode | ((errorMessage: string) => JSX.Element);\n}\n\n/**\n * @public\n */\nexport const ErrorStateSlot = (props: ErrorStateSlotProps) => null;\n"],
5
+ "mappings": "AAYO,MAAM,iBAAiB,CAAC,UAA+B;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/types/bubble-layer.ts"],
4
- "sourcesContent": ["import type { LegendColorLayerProps, LocationColorProps } from './coloring.js';\nimport type { Location } from './location.js';\n\n/**\n * Base props to configure a BubbleLayer\n * @typeParam T - Object extending Location\n */\nexport interface BubbleLayerBaseProps<T extends Location> {\n /**\n * An array of location data items to be displayed as bubbles in the BubbleLayer\n */\n data: T[];\n /**\n * Determines the interpolation mode for bubble size.\n * 'zoom': Bubble size changes with zoom.\n * 'fixed': Constant bubble size regardless of zoom level.\n * @defaultValue 'fixed'\n */\n sizeInterpolation?: 'zoom' | 'fixed';\n}\n\n/**\n * The BubbleLayer props\n * @typeParam T - Object extending Location\n */\nexport type BubbleLayerProps<T extends Location> = BubbleLayerBaseProps<T> &\n (LocationColorProps<T> | LegendColorLayerProps) &\n (ScaleRadiusProps<T> | ScaleNoneProps<T>);\n\n/**\n * When there's no scale provided, the radius prop is used as radius size in pixels\n * @typeParam T - Object extending Location\n */\nexport interface ScaleNoneProps<T> {\n /**\n * The way to indicate that scale should not be used\n */\n scale: 'none';\n /**\n * The radius property, which determines the size of the bubbles.\n * It can be a constant number or a function that calculates the radius based on the data item\n * @defaultValue 12\n */\n radius?: number | ((item: T) => number);\n}\n\n/**\n * When a scale is provided, all the values in the dataset will be scaled to fit between the `radiusRange`.\n * @typeParam T - Object extending Location\n */\nexport interface ScaleRadiusProps<T extends Location> {\n /**\n * The way the radius is scaled.\n * @defaultValue 'linear'\n */\n scale?: 'linear' | 'log';\n /**\n * The radius property, which determines the size of the bubbles.\n * It requires a callback that is used as data accessor.\n */\n radius: (item: T) => number;\n /**\n * It determines the min and max size for the bubble radius\n * @defaultValue [10, 100]\n */\n radiusRange?: [number, number];\n}\n\n/**\n * Type guard to know whether radius should apply the scale\n * @param props - BubbleLayerProps\n */\nexport function isScaleRadius<T extends Location>(\n props: BubbleLayerProps<T>,\n): props is BubbleLayerProps<T> & ScaleRadiusProps<T> {\n return props.scale !== 'none';\n}\n\n/** @internal */\nexport type InternalBubbleLayerProps<T extends Location> = {\n layerId: string;\n} & BubbleLayerProps<T>;\n"],
5
- "mappings": "AAwEO,SAAS,cACd,OACoD;AACpD,SAAO,MAAM,UAAU;AACzB;",
4
+ "sourcesContent": ["import type { LegendColorLayerProps, LocationColorProps } from './coloring.js';\nimport type { Location } from './location.js';\n\n/**\n * Base props to configure a BubbleLayer\n * @typeParam T - Object extending Location\n * @public\n */\nexport interface BubbleLayerBaseProps<T extends Location> {\n /**\n * An array of location data items to be displayed as bubbles in the BubbleLayer\n */\n data: T[];\n /**\n * Determines the interpolation mode for bubble size.\n * 'zoom': Bubble size changes with zoom.\n * 'fixed': Constant bubble size regardless of zoom level.\n * @defaultValue 'fixed'\n */\n sizeInterpolation?: 'zoom' | 'fixed';\n}\n\n/**\n * The BubbleLayer props\n * @typeParam T - Object extending Location\n * @public\n */\nexport type BubbleLayerProps<T extends Location> = BubbleLayerBaseProps<T> &\n (LocationColorProps<T> | LegendColorLayerProps) &\n (ScaleRadiusProps<T> | ScaleNoneProps<T>);\n\n/**\n * When there's no scale provided, the radius prop is used as radius size in pixels\n * @typeParam T - Object extending Location\n * @public\n */\nexport interface ScaleNoneProps<T> {\n /**\n * The way to indicate that scale should not be used\n */\n scale: 'none';\n /**\n * The radius property, which determines the size of the bubbles.\n * It can be a constant number or a function that calculates the radius based on the data item\n * @defaultValue 12\n */\n radius?: number | ((item: T) => number);\n}\n\n/**\n * When a scale is provided, all the values in the dataset will be scaled to fit between the `radiusRange`.\n * @typeParam T - Object extending Location\n * @public\n */\nexport interface ScaleRadiusProps<T extends Location> {\n /**\n * The way the radius is scaled.\n * @defaultValue 'linear'\n */\n scale?: 'linear' | 'log';\n /**\n * The radius property, which determines the size of the bubbles.\n * It requires a callback that is used as data accessor.\n */\n radius: (item: T) => number;\n /**\n * It determines the min and max size for the bubble radius\n * @defaultValue [10, 100]\n */\n radiusRange?: [number, number];\n}\n\n/**\n * Type guard to know whether radius should apply the scale\n * @param props - BubbleLayerProps\n */\nexport function isScaleRadius<T extends Location>(\n props: BubbleLayerProps<T>,\n): props is BubbleLayerProps<T> & ScaleRadiusProps<T> {\n return props.scale !== 'none';\n}\n\n/** @internal */\nexport type InternalBubbleLayerProps<T extends Location> = {\n layerId: string;\n} & BubbleLayerProps<T>;\n"],
5
+ "mappings": "AA4EO,SAAS,cACd,OACoD;AACpD,SAAO,MAAM,UAAU;AACzB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/types/coloring.ts"],
4
- "sourcesContent": ["import type { Location } from './location.js';\n\n/**\n * Props to configure any Layer with custom coloring\n * @typeParam T - Object extending Location\n */\nexport interface LocationColorProps<T extends Location> {\n /** Custom color to apply to the layer */\n color?: string | ((item: T) => string);\n}\n\n/**\n * Props to configure any Layer with legend coloring\n */\nexport interface LegendColorLayerProps {\n /** When the color prop is set to 'legend', a value accessor is needed */\n color: 'legend';\n /** The value accessor to map data point values to legend color */\n valueAccessor: string;\n}\n\n/**\n * Props to configure any Layer with custom coloring\n * @typeParam T - Object extending a record of string keys and any type of values\n */\nexport interface ChoroplethCustomColorProps<T extends Record<string, unknown>> {\n /** Color to apply to the layer */\n color?: string | ((item: T) => string);\n}\n\n/**\n * Detects whether color is linked to legend or not\n * @param props - layer color props\n */\nexport function isLegendColoring(\n props:\n | LocationColorProps<never>\n | ChoroplethCustomColorProps<never>\n | LegendColorLayerProps,\n): props is LegendColorLayerProps {\n return props.color === 'legend';\n}\n\n/** @internal */\nexport type ColorParser = (value: string | number) => string | undefined;\n"],
5
- "mappings": "AAkCO,SAAS,iBACd,OAIgC;AAChC,SAAO,MAAM,UAAU;AACzB;",
4
+ "sourcesContent": ["import type { Connection } from './connection-layer.js';\nimport type { Location } from './location.js';\n\n/**\n * Props to configure any Layer with custom coloring\n * @typeParam T - Object extending Location\n * @public\n */\nexport interface LocationColorProps<T extends Location> {\n /** Custom color to apply to the layer */\n color?: string | ((item: T) => string);\n}\n\n/**\n * Props to configure a connection Layer with custom coloring\n * @typeParam T - Object extending Connection\n * @public\n */\nexport interface ConnectionColorProps<T extends Connection> {\n /**\n * Specifies the color of the connection layer.\n * @defaultValue Colors.Charts.Categorical.Color03.Default\n */\n color?: string | ((connection: T) => string);\n}\n\n/**\n * Props to configure any Layer with legend coloring\n * @public\n */\nexport interface LegendColorLayerProps {\n /** When the color prop is set to 'legend', a value accessor is needed */\n color: 'legend';\n /** The value accessor to map data point values to legend color */\n valueAccessor: string;\n}\n\n/**\n * Props to configure any Layer with custom coloring\n * @typeParam T - Object extending a record of string keys and any type of values\n * @public\n */\nexport interface ChoroplethCustomColorProps<T extends Record<string, unknown>> {\n /** Color to apply to the layer */\n color?: string | ((item: T) => string);\n}\n\n/**\n * Detects whether color is linked to legend or not\n * @param props - layer color props\n */\nexport function isLegendColoring(\n props:\n | LocationColorProps<never>\n | ChoroplethCustomColorProps<never>\n | LegendColorLayerProps,\n): props is LegendColorLayerProps {\n return props.color === 'legend';\n}\n\n/** @internal */\nexport type ColorParser = (value: string | number) => string | undefined;\n"],
5
+ "mappings": "AAmDO,SAAS,iBACd,OAIgC;AAChC,SAAO,MAAM,UAAU;AACzB;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,9 @@ const attachImageFromShape = (map, shape, name, outputSize) => {
16
16
  DEFAULT_INPUT_ICON_SIZE,
17
17
  createBitmapConfigOptions(outputSize)
18
18
  ).then((bitmap) => {
19
+ if (!map) {
20
+ return;
21
+ }
19
22
  attachImageToMap(map, bitmap, name);
20
23
  });
21
24
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/attach-image-from-shape.ts"],
4
- "sourcesContent": ["import type { MapRef } from 'react-map-gl/maplibre';\n\nimport { attachImageToMap } from './attach-image-to-map.js';\nimport { createBitmapConfigOptions } from './create-bitmap-config-options.js';\nimport { getDataUri } from './get-data-uri.js';\nimport { DEFAULT_INPUT_ICON_SIZE } from '../constants.js';\nimport { getShape } from '../shapes/shape-picker.js';\nimport type { MapShape } from '../types/shapes.js';\n\nexport const attachImageFromShape = (\n map: MapRef,\n shape: MapShape,\n name: string,\n outputSize?: number,\n) => {\n const pickedShape = getShape(shape);\n const stringUrl = getDataUri(encodeURIComponent(pickedShape));\n const img = new Image(DEFAULT_INPUT_ICON_SIZE, DEFAULT_INPUT_ICON_SIZE);\n img.addEventListener('load', () => {\n createImageBitmap(\n img,\n 0,\n 0,\n DEFAULT_INPUT_ICON_SIZE,\n DEFAULT_INPUT_ICON_SIZE,\n createBitmapConfigOptions(outputSize),\n ).then((bitmap) => {\n attachImageToMap(map, bitmap, name);\n });\n });\n img.src = stringUrl;\n};\n"],
5
- "mappings": "AAEA,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B;AACxC,SAAS,gBAAgB;AAGlB,MAAM,uBAAuB,CAClC,KACA,OACA,MACA,eACG;AACH,QAAM,cAAc,SAAS,KAAK;AAClC,QAAM,YAAY,WAAW,mBAAmB,WAAW,CAAC;AAC5D,QAAM,MAAM,IAAI,MAAM,yBAAyB,uBAAuB;AACtE,MAAI,iBAAiB,QAAQ,MAAM;AACjC;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BAA0B,UAAU;AAAA,IACtC,EAAE,KAAK,CAAC,WAAW;AACjB,uBAAiB,KAAK,QAAQ,IAAI;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AACD,MAAI,MAAM;AACZ;",
4
+ "sourcesContent": ["import type { MapRef } from '@vis.gl/react-maplibre';\n\nimport { attachImageToMap } from './attach-image-to-map.js';\nimport { createBitmapConfigOptions } from './create-bitmap-config-options.js';\nimport { getDataUri } from './get-data-uri.js';\nimport { DEFAULT_INPUT_ICON_SIZE } from '../constants.js';\nimport { getShape } from '../shapes/shape-picker.js';\nimport type { MapShape } from '../types/shapes.js';\n\nexport const attachImageFromShape = (\n map: MapRef,\n shape: MapShape,\n name: string,\n outputSize?: number,\n) => {\n const pickedShape = getShape(shape);\n const stringUrl = getDataUri(encodeURIComponent(pickedShape));\n const img = new Image(DEFAULT_INPUT_ICON_SIZE, DEFAULT_INPUT_ICON_SIZE);\n img.addEventListener('load', () => {\n createImageBitmap(\n img,\n 0,\n 0,\n DEFAULT_INPUT_ICON_SIZE,\n DEFAULT_INPUT_ICON_SIZE,\n createBitmapConfigOptions(outputSize),\n ).then((bitmap) => {\n if (!map) {\n return;\n }\n attachImageToMap(map, bitmap, name);\n });\n });\n img.src = stringUrl;\n};\n"],
5
+ "mappings": "AAEA,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B;AACxC,SAAS,gBAAgB;AAGlB,MAAM,uBAAuB,CAClC,KACA,OACA,MACA,eACG;AACH,QAAM,cAAc,SAAS,KAAK;AAClC,QAAM,YAAY,WAAW,mBAAmB,WAAW,CAAC;AAC5D,QAAM,MAAM,IAAI,MAAM,yBAAyB,uBAAuB;AACtE,MAAI,iBAAiB,QAAQ,MAAM;AACjC;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BAA0B,UAAU;AAAA,IACtC,EAAE,KAAK,CAAC,WAAW;AACjB,UAAI,CAAC,KAAK;AACR;AAAA,MACF;AACA,uBAAiB,KAAK,QAAQ,IAAI;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AACD,MAAI,MAAM;AACZ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/attach-image-from-string.ts"],
4
- "sourcesContent": ["import type { MapRef } from 'react-map-gl/maplibre';\n\nimport { _sanitizeSymbol } from '@dynatrace/strato-components-preview/core';\n\nimport { attachImageFromShape } from './attach-image-from-shape.js';\nimport { attachImageFromText } from './attach-image-from-text.js';\nimport { isValidShape } from './is-valid-shape.js';\nimport type { MapShape } from '../types/shapes.js';\n\nexport const attachImageFromString = (\n map: MapRef,\n shape: MapShape | string,\n suffix = '',\n outputSize?: number,\n) => {\n const isShape = isValidShape(shape);\n const name = isShape ? `${shape}-${suffix}` : `emoji-${suffix}`;\n\n if (isShape) {\n attachImageFromShape(map, shape, name, outputSize);\n } else {\n const sanitizedShape = _sanitizeSymbol(shape);\n attachImageFromText(map, sanitizedShape, name, outputSize);\n }\n};\n"],
4
+ "sourcesContent": ["import type { MapRef } from '@vis.gl/react-maplibre';\n\nimport { _sanitizeSymbol } from '@dynatrace/strato-components-preview/core';\n\nimport { attachImageFromShape } from './attach-image-from-shape.js';\nimport { attachImageFromText } from './attach-image-from-text.js';\nimport { isValidShape } from './is-valid-shape.js';\nimport type { MapShape } from '../types/shapes.js';\n\nexport const attachImageFromString = (\n map: MapRef,\n shape: MapShape | string,\n suffix = '',\n outputSize?: number,\n) => {\n const isShape = isValidShape(shape);\n const name = isShape ? `${shape}-${suffix}` : `emoji-${suffix}`;\n\n if (isShape) {\n attachImageFromShape(map, shape, name, outputSize);\n } else {\n const sanitizedShape = _sanitizeSymbol(shape);\n attachImageFromText(map, sanitizedShape, name, outputSize);\n }\n};\n"],
5
5
  "mappings": "AAEA,SAAS,uBAAuB;AAEhC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAGtB,MAAM,wBAAwB,CACnC,KACA,OACA,SAAS,IACT,eACG;AACH,QAAM,UAAU,aAAa,KAAK;AAClC,QAAM,OAAO,UAAU,GAAG,KAAK,IAAI,MAAM,KAAK,SAAS,MAAM;AAE7D,MAAI,SAAS;AACX,yBAAqB,KAAK,OAAO,MAAM,UAAU;AAAA,EACnD,OAAO;AACL,UAAM,iBAAiB,gBAAgB,KAAK;AAC5C,wBAAoB,KAAK,gBAAgB,MAAM,UAAU;AAAA,EAC3D;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/attach-image-from-text.ts"],
4
- "sourcesContent": ["import type { MapRef } from 'react-map-gl/maplibre';\n\nimport { attachImageToMap } from './attach-image-to-map.js';\nimport { getScaledSymbolSize } from './get-scaled-symbol-size.js';\n\nexport const attachImageFromText = (\n map: MapRef,\n text: string,\n name: string,\n outputSize?: number,\n) => {\n const scaledTextSymbolSize = getScaledSymbolSize(outputSize);\n const canvas = document.createElement('canvas');\n // Create a canvas with the default icon size (dpr for retina displays)\n canvas.width = scaledTextSymbolSize;\n canvas.height = scaledTextSymbolSize;\n const ctx = canvas.getContext('2d') ?? new CanvasRenderingContext2D();\n ctx.imageSmoothingEnabled = false;\n ctx.font = `${scaledTextSymbolSize}px DynatraceFlow`;\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(text, scaledTextSymbolSize / 2, scaledTextSymbolSize / 2);\n\n const img = new Image(scaledTextSymbolSize, scaledTextSymbolSize);\n img.addEventListener('load', () => {\n attachImageToMap(map, img, name, false);\n });\n img.src = canvas.toDataURL('image/png');\n};\n"],
4
+ "sourcesContent": ["import type { MapRef } from '@vis.gl/react-maplibre';\n\nimport { attachImageToMap } from './attach-image-to-map.js';\nimport { getScaledSymbolSize } from './get-scaled-symbol-size.js';\n\nexport const attachImageFromText = (\n map: MapRef,\n text: string,\n name: string,\n outputSize?: number,\n) => {\n const scaledTextSymbolSize = getScaledSymbolSize(outputSize);\n const canvas = document.createElement('canvas');\n // Create a canvas with the default icon size (dpr for retina displays)\n canvas.width = scaledTextSymbolSize;\n canvas.height = scaledTextSymbolSize;\n const ctx = canvas.getContext('2d') ?? new CanvasRenderingContext2D();\n ctx.imageSmoothingEnabled = false;\n ctx.font = `${scaledTextSymbolSize}px DynatraceFlow`;\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(text, scaledTextSymbolSize / 2, scaledTextSymbolSize / 2);\n\n const img = new Image(scaledTextSymbolSize, scaledTextSymbolSize);\n img.addEventListener('load', () => {\n attachImageToMap(map, img, name, false);\n });\n img.src = canvas.toDataURL('image/png');\n};\n"],
5
5
  "mappings": "AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAE7B,MAAM,sBAAsB,CACjC,KACA,MACA,MACA,eACG;AACH,QAAM,uBAAuB,oBAAoB,UAAU;AAC3D,QAAM,SAAS,SAAS,cAAc,QAAQ;AAE9C,SAAO,QAAQ;AACf,SAAO,SAAS;AAChB,QAAM,MAAM,OAAO,WAAW,IAAI,KAAK,IAAI,yBAAyB;AACpE,MAAI,wBAAwB;AAC5B,MAAI,OAAO,GAAG,oBAAoB;AAClC,MAAI,YAAY;AAChB,MAAI,eAAe;AACnB,MAAI,SAAS,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAErE,QAAM,MAAM,IAAI,MAAM,sBAAsB,oBAAoB;AAChE,MAAI,iBAAiB,QAAQ,MAAM;AACjC,qBAAiB,KAAK,KAAK,MAAM,KAAK;AAAA,EACxC,CAAC;AACD,MAAI,MAAM,OAAO,UAAU,WAAW;AACxC;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,17 @@
1
1
  const attachImageToMap = (map, bitmap, iconName, sdf = true) => {
2
2
  const pixelRatio = devicePixelRatio;
3
- if (!map.hasImage(iconName)) {
4
- map.addImage(iconName, bitmap, { sdf, pixelRatio });
5
- } else {
6
- map.removeImage(iconName);
7
- map.addImage(iconName, bitmap, { sdf, pixelRatio });
3
+ try {
4
+ if (!map.hasImage(iconName)) {
5
+ map.addImage(iconName, bitmap, { sdf, pixelRatio });
6
+ } else {
7
+ map.removeImage(iconName);
8
+ map.addImage(iconName, bitmap, { sdf, pixelRatio });
9
+ }
10
+ } catch (error) {
11
+ if (error instanceof Error) {
12
+ return;
13
+ }
14
+ throw error;
8
15
  }
9
16
  };
10
17
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/attach-image-to-map.ts"],
4
- "sourcesContent": ["import type { MapRef } from 'react-map-gl/maplibre';\n\nexport const attachImageToMap = (\n map: MapRef,\n bitmap: ImageBitmap | HTMLImageElement,\n iconName: string,\n sdf = true,\n) => {\n const pixelRatio = devicePixelRatio;\n if (!map.hasImage(iconName)) {\n map.addImage(iconName, bitmap, { sdf: sdf, pixelRatio });\n } else {\n // Update doesn't work until you make some move in the map, so we need to\n // remove it and add it to make the render right away\n map.removeImage(iconName);\n map.addImage(iconName, bitmap, { sdf: sdf, pixelRatio });\n }\n};\n"],
5
- "mappings": "AAEO,MAAM,mBAAmB,CAC9B,KACA,QACA,UACA,MAAM,SACH;AACH,QAAM,aAAa;AACnB,MAAI,CAAC,IAAI,SAAS,QAAQ,GAAG;AAC3B,QAAI,SAAS,UAAU,QAAQ,EAAE,KAAU,WAAW,CAAC;AAAA,EACzD,OAAO;AAGL,QAAI,YAAY,QAAQ;AACxB,QAAI,SAAS,UAAU,QAAQ,EAAE,KAAU,WAAW,CAAC;AAAA,EACzD;AACF;",
4
+ "sourcesContent": ["import type { MapRef } from '@vis.gl/react-maplibre';\n\nexport const attachImageToMap = (\n map: MapRef,\n bitmap: ImageBitmap | HTMLImageElement,\n iconName: string,\n sdf = true,\n) => {\n const pixelRatio = devicePixelRatio;\n try {\n if (!map.hasImage(iconName)) {\n map.addImage(iconName, bitmap, { sdf: sdf, pixelRatio });\n } else {\n // Update doesn't work until you make some move in the map, so we need to\n // remove it and add it to make the render right away\n map.removeImage(iconName);\n map.addImage(iconName, bitmap, { sdf: sdf, pixelRatio });\n }\n } catch (error: unknown) {\n // If the whole map is unloaded, but the load events on some images are fired, it will trigger the `addImage`\n // on the map reference. Since the map is already unloaded, it will no longer be able to handle the internal getImage\n // call.\n if (error instanceof Error) {\n return;\n }\n throw error;\n }\n};\n"],
5
+ "mappings": "AAEO,MAAM,mBAAmB,CAC9B,KACA,QACA,UACA,MAAM,SACH;AACH,QAAM,aAAa;AACnB,MAAI;AACF,QAAI,CAAC,IAAI,SAAS,QAAQ,GAAG;AAC3B,UAAI,SAAS,UAAU,QAAQ,EAAE,KAAU,WAAW,CAAC;AAAA,IACzD,OAAO;AAGL,UAAI,YAAY,QAAQ;AACxB,UAAI,SAAS,UAAU,QAAQ,EAAE,KAAU,WAAW,CAAC;AAAA,IACzD;AAAA,EACF,SAAS,OAAgB;AAIvB,QAAI,iBAAiB,OAAO;AAC1B;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACF;",
6
6
  "names": []
7
7
  }
@@ -5,6 +5,7 @@ import {
5
5
  } from "@dynatrace/strato-components-preview/charts";
6
6
  import { buildCategoricalScale } from "./build-categorical-scale.js";
7
7
  import { DEFAULT_RANGE_COLOR } from "../constants.js";
8
+ import { createCategoricalColorSchemeFromCustomColorObject } from "./create-categorical-color-scheme-from-custom-color-object.js";
8
9
  import { createCategoricalColorSchemeFromLegendProps } from "./create-categorical-color-scheme-from-legend-props.js";
9
10
  const isThresholdLegend = (legendConfig) => legendConfig.type === "threshold";
10
11
  const isSequentialLegend = (legendConfig) => legendConfig.type === "sequential";
@@ -22,7 +23,10 @@ const buildScaleFromLegendConfig = (mapLegendConfig, categories) => {
22
23
  mapLegendConfig.colorPalette
23
24
  );
24
25
  const isCustomColorObject = !(isDefaultColorPalette || isArrayOfColors);
25
- const colorPaletteObject = isCustomColorObject ? mapLegendConfig.colorPalette : createCategoricalColorSchemeFromLegendProps(
26
+ const colorPaletteObject = isCustomColorObject ? createCategoricalColorSchemeFromCustomColorObject(
27
+ mapLegendConfig.colorPalette,
28
+ categories ?? []
29
+ ) : createCategoricalColorSchemeFromLegendProps(
26
30
  mapLegendConfig.colorPalette,
27
31
  categories ?? []
28
32
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/build-scale-from-legend-config.ts"],
4
- "sourcesContent": ["import {\n _buildQuantizeScaleFromColorPalette as buildQuantizeScaleFromColorPalette,\n _buildThresholdScaleFromRanges as buildThresholdScaleFromRanges,\n type ColorPalette,\n colorPaletteOptions,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { buildCategoricalScale } from './build-categorical-scale.js';\nimport { DEFAULT_RANGE_COLOR } from '../constants.js';\nimport { createCategoricalColorSchemeFromLegendProps } from './create-categorical-color-scheme-from-legend-props.js';\nimport type {\n CategoricalLegendConfig,\n MapLegendConfig,\n SequentialLegendConfig,\n ThresholdLegendConfig,\n} from '../types/legend.js';\n\nexport const isThresholdLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is ThresholdLegendConfig => legendConfig.type === 'threshold';\n\nexport const isSequentialLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is SequentialLegendConfig => legendConfig.type === 'sequential';\n\nexport const isCategoricalLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is CategoricalLegendConfig =>\n legendConfig.type === 'categorical';\n\n/**\n * Builds a scale for the corresponding map legend configuration\n */\nexport const buildScaleFromLegendConfig = (\n mapLegendConfig: MapLegendConfig,\n categories?: string[],\n) => {\n if (isSequentialLegend(mapLegendConfig)) {\n const { min, max, colorPalette } = mapLegendConfig;\n return buildQuantizeScaleFromColorPalette(min, max, colorPalette);\n } else if (isThresholdLegend(mapLegendConfig)) {\n const { ranges } = mapLegendConfig;\n return buildThresholdScaleFromRanges(ranges, DEFAULT_RANGE_COLOR);\n } else if (isCategoricalLegend(mapLegendConfig)) {\n const isArrayOfColors = Array.isArray(mapLegendConfig.colorPalette);\n const isDefaultColorPalette = colorPaletteOptions.includes(\n mapLegendConfig.colorPalette as (typeof colorPaletteOptions)[number],\n );\n const isCustomColorObject = !(isDefaultColorPalette || isArrayOfColors);\n const colorPaletteObject = isCustomColorObject\n ? (mapLegendConfig.colorPalette as { [key: string]: string })\n : createCategoricalColorSchemeFromLegendProps(\n mapLegendConfig.colorPalette as string[] | ColorPalette,\n categories ?? [],\n );\n\n return buildCategoricalScale(colorPaletteObject);\n }\n};\n"],
5
- "mappings": "AAAA;AAAA,EACE,uCAAuC;AAAA,EACvC,kCAAkC;AAAA,EAElC;AAAA,OACK;AAEP,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,mDAAmD;AAQrD,MAAM,oBAAoB,CAC/B,iBAC0C,aAAa,SAAS;AAE3D,MAAM,qBAAqB,CAChC,iBAC2C,aAAa,SAAS;AAE5D,MAAM,sBAAsB,CACjC,iBAEA,aAAa,SAAS;AAKjB,MAAM,6BAA6B,CACxC,iBACA,eACG;AACH,MAAI,mBAAmB,eAAe,GAAG;AACvC,UAAM,EAAE,KAAK,KAAK,aAAa,IAAI;AACnC,WAAO,mCAAmC,KAAK,KAAK,YAAY;AAAA,EAClE,WAAW,kBAAkB,eAAe,GAAG;AAC7C,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,8BAA8B,QAAQ,mBAAmB;AAAA,EAClE,WAAW,oBAAoB,eAAe,GAAG;AAC/C,UAAM,kBAAkB,MAAM,QAAQ,gBAAgB,YAAY;AAClE,UAAM,wBAAwB,oBAAoB;AAAA,MAChD,gBAAgB;AAAA,IAClB;AACA,UAAM,sBAAsB,EAAE,yBAAyB;AACvD,UAAM,qBAAqB,sBACtB,gBAAgB,eACjB;AAAA,MACE,gBAAgB;AAAA,MAChB,cAAc,CAAC;AAAA,IACjB;AAEJ,WAAO,sBAAsB,kBAAkB;AAAA,EACjD;AACF;",
4
+ "sourcesContent": ["import {\n _buildQuantizeScaleFromColorPalette as buildQuantizeScaleFromColorPalette,\n _buildThresholdScaleFromRanges as buildThresholdScaleFromRanges,\n type ColorPalette,\n colorPaletteOptions,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { buildCategoricalScale } from './build-categorical-scale.js';\nimport { DEFAULT_RANGE_COLOR } from '../constants.js';\nimport { createCategoricalColorSchemeFromCustomColorObject } from './create-categorical-color-scheme-from-custom-color-object.js';\nimport { createCategoricalColorSchemeFromLegendProps } from './create-categorical-color-scheme-from-legend-props.js';\nimport type {\n CategoricalLegendConfig,\n MapLegendConfig,\n SequentialLegendConfig,\n ThresholdLegendConfig,\n} from '../types/legend.js';\n\nexport const isThresholdLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is ThresholdLegendConfig => legendConfig.type === 'threshold';\n\nexport const isSequentialLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is SequentialLegendConfig => legendConfig.type === 'sequential';\n\nexport const isCategoricalLegend = (\n legendConfig: MapLegendConfig,\n): legendConfig is CategoricalLegendConfig =>\n legendConfig.type === 'categorical';\n\n/**\n * Builds a scale for the corresponding map legend configuration\n */\nexport const buildScaleFromLegendConfig = (\n mapLegendConfig: MapLegendConfig,\n categories?: string[],\n) => {\n if (isSequentialLegend(mapLegendConfig)) {\n const { min, max, colorPalette } = mapLegendConfig;\n return buildQuantizeScaleFromColorPalette(min, max, colorPalette);\n } else if (isThresholdLegend(mapLegendConfig)) {\n const { ranges } = mapLegendConfig;\n return buildThresholdScaleFromRanges(ranges, DEFAULT_RANGE_COLOR);\n } else if (isCategoricalLegend(mapLegendConfig)) {\n const isArrayOfColors = Array.isArray(mapLegendConfig.colorPalette);\n const isDefaultColorPalette = colorPaletteOptions.includes(\n mapLegendConfig.colorPalette as (typeof colorPaletteOptions)[number],\n );\n const isCustomColorObject = !(isDefaultColorPalette || isArrayOfColors);\n const colorPaletteObject = isCustomColorObject\n ? createCategoricalColorSchemeFromCustomColorObject(\n mapLegendConfig.colorPalette as {\n [key: string]: string;\n },\n categories ?? [],\n )\n : createCategoricalColorSchemeFromLegendProps(\n mapLegendConfig.colorPalette as string[] | ColorPalette,\n categories ?? [],\n );\n\n return buildCategoricalScale(colorPaletteObject);\n }\n};\n"],
5
+ "mappings": "AAAA;AAAA,EACE,uCAAuC;AAAA,EACvC,kCAAkC;AAAA,EAElC;AAAA,OACK;AAEP,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,yDAAyD;AAClE,SAAS,mDAAmD;AAQrD,MAAM,oBAAoB,CAC/B,iBAC0C,aAAa,SAAS;AAE3D,MAAM,qBAAqB,CAChC,iBAC2C,aAAa,SAAS;AAE5D,MAAM,sBAAsB,CACjC,iBAEA,aAAa,SAAS;AAKjB,MAAM,6BAA6B,CACxC,iBACA,eACG;AACH,MAAI,mBAAmB,eAAe,GAAG;AACvC,UAAM,EAAE,KAAK,KAAK,aAAa,IAAI;AACnC,WAAO,mCAAmC,KAAK,KAAK,YAAY;AAAA,EAClE,WAAW,kBAAkB,eAAe,GAAG;AAC7C,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,8BAA8B,QAAQ,mBAAmB;AAAA,EAClE,WAAW,oBAAoB,eAAe,GAAG;AAC/C,UAAM,kBAAkB,MAAM,QAAQ,gBAAgB,YAAY;AAClE,UAAM,wBAAwB,oBAAoB;AAAA,MAChD,gBAAgB;AAAA,IAClB;AACA,UAAM,sBAAsB,EAAE,yBAAyB;AACvD,UAAM,qBAAqB,sBACvB;AAAA,MACE,gBAAgB;AAAA,MAGhB,cAAc,CAAC;AAAA,IACjB,IACA;AAAA,MACE,gBAAgB;AAAA,MAChB,cAAc,CAAC;AAAA,IACjB;AAEJ,WAAO,sBAAsB,kBAAkB;AAAA,EACjD;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ import { DEFAULT_BASIC_SHAPE_COLOR_TOKEN } from "../constants.js";
2
+ const createCategoricalColorSchemeFromCustomColorObject = (colorPalette, categories) => {
3
+ let obj = { ...colorPalette };
4
+ categories.forEach((categoryName, index) => {
5
+ if (!obj[categoryName]) {
6
+ obj = {
7
+ ...obj,
8
+ [categoryName]: DEFAULT_BASIC_SHAPE_COLOR_TOKEN.Default
9
+ };
10
+ }
11
+ });
12
+ return obj;
13
+ };
14
+ export {
15
+ createCategoricalColorSchemeFromCustomColorObject
16
+ };
17
+ //# sourceMappingURL=create-categorical-color-scheme-from-custom-color-object.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/map/utils/create-categorical-color-scheme-from-custom-color-object.ts"],
4
+ "sourcesContent": ["import { DEFAULT_BASIC_SHAPE_COLOR_TOKEN } from '../constants.js';\n\ntype CustomCategoricalColorObject = { [key: string]: string };\n\nexport const createCategoricalColorSchemeFromCustomColorObject = (\n colorPalette: CustomCategoricalColorObject,\n categories: string[],\n): CustomCategoricalColorObject => {\n let obj = { ...colorPalette };\n\n categories.forEach((categoryName, index) => {\n if (!obj[categoryName]) {\n obj = {\n ...obj,\n [categoryName]: DEFAULT_BASIC_SHAPE_COLOR_TOKEN.Default,\n };\n }\n });\n\n return obj;\n};\n"],
5
+ "mappings": "AAAA,SAAS,uCAAuC;AAIzC,MAAM,oDAAoD,CAC/D,cACA,eACiC;AACjC,MAAI,MAAM,EAAE,GAAG,aAAa;AAE5B,aAAW,QAAQ,CAAC,cAAc,UAAU;AAC1C,QAAI,CAAC,IAAI,YAAY,GAAG;AACtB,YAAM;AAAA,QACJ,GAAG;AAAA,QACH,CAAC,YAAY,GAAG,gCAAgC;AAAA,MAClD;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
6
+ "names": []
7
+ }