@gooddata/sdk-ui-geo 11.6.0-alpha.5 → 11.6.0-alpha.7

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 (231) hide show
  1. package/esm/next/GeoPushpinChartNext.d.ts +12 -0
  2. package/esm/next/GeoPushpinChartNext.d.ts.map +1 -0
  3. package/esm/next/GeoPushpinChartNext.js +42 -0
  4. package/esm/next/GeoPushpinChartNext.js.map +1 -0
  5. package/esm/next/RenderGeoPushpinChart.d.ts +15 -0
  6. package/esm/next/RenderGeoPushpinChart.d.ts.map +1 -0
  7. package/esm/next/RenderGeoPushpinChart.js +97 -0
  8. package/esm/next/RenderGeoPushpinChart.js.map +1 -0
  9. package/esm/next/components/ErrorComponent.d.ts +13 -0
  10. package/esm/next/components/ErrorComponent.d.ts.map +1 -0
  11. package/esm/next/components/ErrorComponent.js +19 -0
  12. package/esm/next/components/ErrorComponent.js.map +1 -0
  13. package/esm/next/components/LoadingComponent.d.ts +5 -0
  14. package/esm/next/components/LoadingComponent.d.ts.map +1 -0
  15. package/esm/next/components/LoadingComponent.js +13 -0
  16. package/esm/next/components/LoadingComponent.js.map +1 -0
  17. package/esm/next/components/legends/Legend.d.ts +28 -0
  18. package/esm/next/components/legends/Legend.d.ts.map +1 -0
  19. package/esm/next/components/legends/Legend.js +54 -0
  20. package/esm/next/components/legends/Legend.js.map +1 -0
  21. package/esm/next/components/legends/LegendBody.d.ts +12 -0
  22. package/esm/next/components/legends/LegendBody.d.ts.map +1 -0
  23. package/esm/next/components/legends/LegendBody.js +30 -0
  24. package/esm/next/components/legends/LegendBody.js.map +1 -0
  25. package/esm/next/components/legends/legendPropsAdapter.d.ts +14 -0
  26. package/esm/next/components/legends/legendPropsAdapter.d.ts.map +1 -0
  27. package/esm/next/components/legends/legendPropsAdapter.js +34 -0
  28. package/esm/next/components/legends/legendPropsAdapter.js.map +1 -0
  29. package/esm/next/components/legends/types.d.ts +16 -0
  30. package/esm/next/components/legends/types.d.ts.map +1 -0
  31. package/esm/next/components/legends/types.js +3 -0
  32. package/esm/next/components/legends/types.js.map +1 -0
  33. package/esm/next/constants/geoChart.d.ts +108 -0
  34. package/esm/next/constants/geoChart.d.ts.map +1 -0
  35. package/esm/next/constants/geoChart.js +130 -0
  36. package/esm/next/constants/geoChart.js.map +1 -0
  37. package/esm/next/constants/internal.d.ts +19 -0
  38. package/esm/next/constants/internal.d.ts.map +1 -0
  39. package/esm/next/constants/internal.js +20 -0
  40. package/esm/next/constants/internal.js.map +1 -0
  41. package/esm/next/context/GeoDataContext.d.ts +69 -0
  42. package/esm/next/context/GeoDataContext.d.ts.map +1 -0
  43. package/esm/next/context/GeoDataContext.js +80 -0
  44. package/esm/next/context/GeoDataContext.js.map +1 -0
  45. package/esm/next/context/GeoLegendContext.d.ts +78 -0
  46. package/esm/next/context/GeoLegendContext.d.ts.map +1 -0
  47. package/esm/next/context/GeoLegendContext.js +74 -0
  48. package/esm/next/context/GeoLegendContext.js.map +1 -0
  49. package/esm/next/context/GeoPushpinPropsContext.d.ts +47 -0
  50. package/esm/next/context/GeoPushpinPropsContext.d.ts.map +1 -0
  51. package/esm/next/context/GeoPushpinPropsContext.js +81 -0
  52. package/esm/next/context/GeoPushpinPropsContext.js.map +1 -0
  53. package/esm/next/context/InitialExecutionContext.d.ts +43 -0
  54. package/esm/next/context/InitialExecutionContext.d.ts.map +1 -0
  55. package/esm/next/context/InitialExecutionContext.js +45 -0
  56. package/esm/next/context/InitialExecutionContext.js.map +1 -0
  57. package/esm/next/context/MapInstanceContext.d.ts +42 -0
  58. package/esm/next/context/MapInstanceContext.d.ts.map +1 -0
  59. package/esm/next/context/MapInstanceContext.js +62 -0
  60. package/esm/next/context/MapInstanceContext.js.map +1 -0
  61. package/esm/next/features/clustering/clustering.d.ts +23 -0
  62. package/esm/next/features/clustering/clustering.d.ts.map +1 -0
  63. package/esm/next/features/clustering/clustering.js +26 -0
  64. package/esm/next/features/clustering/clustering.js.map +1 -0
  65. package/esm/next/features/coloring/colorStrategy.d.ts +22 -0
  66. package/esm/next/features/coloring/colorStrategy.d.ts.map +1 -0
  67. package/esm/next/features/coloring/colorStrategy.js +83 -0
  68. package/esm/next/features/coloring/colorStrategy.js.map +1 -0
  69. package/esm/next/features/coloring/palette.d.ts +81 -0
  70. package/esm/next/features/coloring/palette.d.ts.map +1 -0
  71. package/esm/next/features/coloring/palette.js +233 -0
  72. package/esm/next/features/coloring/palette.js.map +1 -0
  73. package/esm/next/features/data/dataSourceManagement.d.ts +20 -0
  74. package/esm/next/features/data/dataSourceManagement.d.ts.map +1 -0
  75. package/esm/next/features/data/dataSourceManagement.js +30 -0
  76. package/esm/next/features/data/dataSourceManagement.js.map +1 -0
  77. package/esm/next/features/data/transformation.d.ts +99 -0
  78. package/esm/next/features/data/transformation.d.ts.map +1 -0
  79. package/esm/next/features/data/transformation.js +369 -0
  80. package/esm/next/features/data/transformation.js.map +1 -0
  81. package/esm/next/features/map/initializeMap.d.ts +30 -0
  82. package/esm/next/features/map/initializeMap.d.ts.map +1 -0
  83. package/esm/next/features/map/initializeMap.js +58 -0
  84. package/esm/next/features/map/initializeMap.js.map +1 -0
  85. package/esm/next/features/map/layerManagement.d.ts +51 -0
  86. package/esm/next/features/map/layerManagement.d.ts.map +1 -0
  87. package/esm/next/features/map/layerManagement.js +95 -0
  88. package/esm/next/features/map/layerManagement.js.map +1 -0
  89. package/esm/next/features/map/viewportManagement.d.ts +76 -0
  90. package/esm/next/features/map/viewportManagement.d.ts.map +1 -0
  91. package/esm/next/features/map/viewportManagement.js +193 -0
  92. package/esm/next/features/map/viewportManagement.js.map +1 -0
  93. package/esm/next/features/size/calculations.d.ts +32 -0
  94. package/esm/next/features/size/calculations.d.ts.map +1 -0
  95. package/esm/next/features/size/calculations.js +37 -0
  96. package/esm/next/features/size/calculations.js.map +1 -0
  97. package/esm/next/features/tooltip/formatting.d.ts +28 -0
  98. package/esm/next/features/tooltip/formatting.d.ts.map +1 -0
  99. package/esm/next/features/tooltip/formatting.js +51 -0
  100. package/esm/next/features/tooltip/formatting.js.map +1 -0
  101. package/esm/next/features/tooltip/tooltipManagement.d.ts +47 -0
  102. package/esm/next/features/tooltip/tooltipManagement.d.ts.map +1 -0
  103. package/esm/next/features/tooltip/tooltipManagement.js +73 -0
  104. package/esm/next/features/tooltip/tooltipManagement.js.map +1 -0
  105. package/esm/next/hooks/init/useInitExecution.d.ts +29 -0
  106. package/esm/next/hooks/init/useInitExecution.d.ts.map +1 -0
  107. package/esm/next/hooks/init/useInitExecution.js +91 -0
  108. package/esm/next/hooks/init/useInitExecution.js.map +1 -0
  109. package/esm/next/hooks/init/useInitExecutionResult.d.ts +17 -0
  110. package/esm/next/hooks/init/useInitExecutionResult.d.ts.map +1 -0
  111. package/esm/next/hooks/init/useInitExecutionResult.js +44 -0
  112. package/esm/next/hooks/init/useInitExecutionResult.js.map +1 -0
  113. package/esm/next/hooks/legend/useLegendConfig.d.ts +35 -0
  114. package/esm/next/hooks/legend/useLegendConfig.d.ts.map +1 -0
  115. package/esm/next/hooks/legend/useLegendConfig.js +25 -0
  116. package/esm/next/hooks/legend/useLegendConfig.js.map +1 -0
  117. package/esm/next/hooks/legend/useLegendDetails.d.ts +27 -0
  118. package/esm/next/hooks/legend/useLegendDetails.d.ts.map +1 -0
  119. package/esm/next/hooks/legend/useLegendDetails.js +39 -0
  120. package/esm/next/hooks/legend/useLegendDetails.js.map +1 -0
  121. package/esm/next/hooks/legend/useLegendItemClick.d.ts +16 -0
  122. package/esm/next/hooks/legend/useLegendItemClick.d.ts.map +1 -0
  123. package/esm/next/hooks/legend/useLegendItemClick.js +23 -0
  124. package/esm/next/hooks/legend/useLegendItemClick.js.map +1 -0
  125. package/esm/next/hooks/legend/useLegendItems.d.ts +27 -0
  126. package/esm/next/hooks/legend/useLegendItems.d.ts.map +1 -0
  127. package/esm/next/hooks/legend/useLegendItems.js +54 -0
  128. package/esm/next/hooks/legend/useLegendItems.js.map +1 -0
  129. package/esm/next/hooks/legend/useLegendItemsWithState.d.ts +21 -0
  130. package/esm/next/hooks/legend/useLegendItemsWithState.d.ts.map +1 -0
  131. package/esm/next/hooks/legend/useLegendItemsWithState.js +42 -0
  132. package/esm/next/hooks/legend/useLegendItemsWithState.js.map +1 -0
  133. package/esm/next/hooks/legend/useLegendProps.d.ts +53 -0
  134. package/esm/next/hooks/legend/useLegendProps.d.ts.map +1 -0
  135. package/esm/next/hooks/legend/useLegendProps.js +38 -0
  136. package/esm/next/hooks/legend/useLegendProps.js.map +1 -0
  137. package/esm/next/hooks/legend/useSelectedSegments.d.ts +17 -0
  138. package/esm/next/hooks/legend/useSelectedSegments.d.ts.map +1 -0
  139. package/esm/next/hooks/legend/useSelectedSegments.js +32 -0
  140. package/esm/next/hooks/legend/useSelectedSegments.js.map +1 -0
  141. package/esm/next/hooks/map/useAfterRender.d.ts +19 -0
  142. package/esm/next/hooks/map/useAfterRender.d.ts.map +1 -0
  143. package/esm/next/hooks/map/useAfterRender.js +99 -0
  144. package/esm/next/hooks/map/useAfterRender.js.map +1 -0
  145. package/esm/next/hooks/map/useMapCallbacks.d.ts +20 -0
  146. package/esm/next/hooks/map/useMapCallbacks.d.ts.map +1 -0
  147. package/esm/next/hooks/map/useMapCallbacks.js +44 -0
  148. package/esm/next/hooks/map/useMapCallbacks.js.map +1 -0
  149. package/esm/next/hooks/map/useMapDataSync.d.ts +44 -0
  150. package/esm/next/hooks/map/useMapDataSync.d.ts.map +1 -0
  151. package/esm/next/hooks/map/useMapDataSync.js +87 -0
  152. package/esm/next/hooks/map/useMapDataSync.js.map +1 -0
  153. package/esm/next/hooks/map/useMapInitialization.d.ts +56 -0
  154. package/esm/next/hooks/map/useMapInitialization.d.ts.map +1 -0
  155. package/esm/next/hooks/map/useMapInitialization.js +121 -0
  156. package/esm/next/hooks/map/useMapInitialization.js.map +1 -0
  157. package/esm/next/hooks/map/useTooltipHandlers.d.ts +22 -0
  158. package/esm/next/hooks/map/useTooltipHandlers.d.ts.map +1 -0
  159. package/esm/next/hooks/map/useTooltipHandlers.js +28 -0
  160. package/esm/next/hooks/map/useTooltipHandlers.js.map +1 -0
  161. package/esm/next/hooks/shared/useGeoDataTransformation.d.ts +23 -0
  162. package/esm/next/hooks/shared/useGeoDataTransformation.d.ts.map +1 -0
  163. package/esm/next/hooks/shared/useGeoDataTransformation.js +37 -0
  164. package/esm/next/hooks/shared/useGeoDataTransformation.js.map +1 -0
  165. package/esm/next/hooks/shared/usePushData.d.ts +8 -0
  166. package/esm/next/hooks/shared/usePushData.d.ts.map +1 -0
  167. package/esm/next/hooks/shared/usePushData.js +36 -0
  168. package/esm/next/hooks/shared/usePushData.js.map +1 -0
  169. package/esm/next/hooks/shared/useResolvedProps.d.ts +16 -0
  170. package/esm/next/hooks/shared/useResolvedProps.d.ts.map +1 -0
  171. package/esm/next/hooks/shared/useResolvedProps.js +40 -0
  172. package/esm/next/hooks/shared/useResolvedProps.js.map +1 -0
  173. package/esm/next/index.d.ts +5 -0
  174. package/esm/next/index.d.ts.map +1 -0
  175. package/esm/next/index.js +3 -0
  176. package/esm/next/index.js.map +1 -0
  177. package/esm/next/providers/maplibre/maplibreConfig.d.ts +68 -0
  178. package/esm/next/providers/maplibre/maplibreConfig.d.ts.map +1 -0
  179. package/esm/next/providers/maplibre/maplibreConfig.js +104 -0
  180. package/esm/next/providers/maplibre/maplibreConfig.js.map +1 -0
  181. package/esm/next/providers/maplibre/maplibreDataLayers.d.ts +51 -0
  182. package/esm/next/providers/maplibre/maplibreDataLayers.d.ts.map +1 -0
  183. package/esm/next/providers/maplibre/maplibreDataLayers.js +195 -0
  184. package/esm/next/providers/maplibre/maplibreDataLayers.js.map +1 -0
  185. package/esm/next/providers/maplibre/maplibreDataSource.d.ts +28 -0
  186. package/esm/next/providers/maplibre/maplibreDataSource.d.ts.map +1 -0
  187. package/esm/next/providers/maplibre/maplibreDataSource.js +117 -0
  188. package/esm/next/providers/maplibre/maplibreDataSource.js.map +1 -0
  189. package/esm/next/providers/maplibre/maplibreTooltip.d.ts +54 -0
  190. package/esm/next/providers/maplibre/maplibreTooltip.d.ts.map +1 -0
  191. package/esm/next/providers/maplibre/maplibreTooltip.js +158 -0
  192. package/esm/next/providers/maplibre/maplibreTooltip.js.map +1 -0
  193. package/esm/next/providers/maplibre/maplibreViewport.d.ts +45 -0
  194. package/esm/next/providers/maplibre/maplibreViewport.d.ts.map +1 -0
  195. package/esm/next/providers/maplibre/maplibreViewport.js +92 -0
  196. package/esm/next/providers/maplibre/maplibreViewport.js.map +1 -0
  197. package/esm/next/providers/maplibre/style.d.ts +3 -0
  198. package/esm/next/providers/maplibre/style.d.ts.map +1 -0
  199. package/esm/next/providers/maplibre/style.js +8361 -0
  200. package/esm/next/providers/maplibre/style.js.map +1 -0
  201. package/esm/next/types/config.d.ts +89 -0
  202. package/esm/next/types/config.d.ts.map +1 -0
  203. package/esm/next/types/config.js +3 -0
  204. package/esm/next/types/config.js.map +1 -0
  205. package/esm/next/types/internal.d.ts +17 -0
  206. package/esm/next/types/internal.d.ts.map +1 -0
  207. package/esm/next/types/internal.js +3 -0
  208. package/esm/next/types/internal.js.map +1 -0
  209. package/esm/next/types/mapProvider.d.ts +122 -0
  210. package/esm/next/types/mapProvider.d.ts.map +1 -0
  211. package/esm/next/types/mapProvider.js +3 -0
  212. package/esm/next/types/mapProvider.js.map +1 -0
  213. package/esm/next/types/public.d.ts +84 -0
  214. package/esm/next/types/public.d.ts.map +1 -0
  215. package/esm/next/types/public.js +15 -0
  216. package/esm/next/types/public.js.map +1 -0
  217. package/esm/next/types/shared.d.ts +209 -0
  218. package/esm/next/types/shared.d.ts.map +1 -0
  219. package/esm/next/types/shared.js +3 -0
  220. package/esm/next/types/shared.js.map +1 -0
  221. package/esm/next/utils/mapLocale.d.ts +26 -0
  222. package/esm/next/utils/mapLocale.d.ts.map +1 -0
  223. package/esm/next/utils/mapLocale.js +22 -0
  224. package/esm/next/utils/mapLocale.js.map +1 -0
  225. package/package.json +13 -10
  226. package/styles/css/main.css +925 -0
  227. package/styles/css/main.css.map +1 -1
  228. package/styles/scss/_geo-pushpin-next-legend.scss +166 -0
  229. package/styles/scss/_maplibre-overrides.scss +64 -0
  230. package/styles/scss/geo-pushpin-next.scss +58 -0
  231. package/styles/scss/main.scss +1 -0
@@ -0,0 +1,369 @@
1
+ // (C) 2025 GoodData Corporation
2
+ import { attributeDisplayFormRef, attributeLocalId, isAttribute, isIdentifierRef, isResultAttributeHeader, measureItem, measureLocalId, resultHeaderName, } from "@gooddata/sdk-model";
3
+ import { BucketNames } from "@gooddata/sdk-ui";
4
+ import { getMinMax } from "../size/calculations.js";
5
+ /**
6
+ * Converts a data value to a float
7
+ *
8
+ * @param value - Data value from execution result
9
+ * @returns Parsed float value, or NaN if parsing fails
10
+ *
11
+ * @internal
12
+ */
13
+ export function dataValueAsFloat(value) {
14
+ if (value === null) {
15
+ return NaN;
16
+ }
17
+ const parsedNumber = typeof value === "string" ? parseFloat(value) : value;
18
+ if (isNaN(parsedNumber)) {
19
+ console.warn(`SDK: dataValueAsFloat: ${value} is not a number`);
20
+ }
21
+ return parsedNumber;
22
+ }
23
+ /**
24
+ * Parses a location string in "lat;lng" format into coordinates
25
+ *
26
+ * @param latlng - Location string in "latitude;longitude" format
27
+ * @returns Coordinate object or null if invalid
28
+ *
29
+ * @internal
30
+ */
31
+ export function getLocation(latlng) {
32
+ if (!latlng) {
33
+ return null;
34
+ }
35
+ const [latitude, longitude] = latlng.split(";").map(dataValueAsFloat);
36
+ if (isNaN(latitude) || isNaN(longitude)) {
37
+ console.warn("GeoPushpinChartNext: Invalid location format", latlng);
38
+ return null;
39
+ }
40
+ return {
41
+ lat: latitude,
42
+ lng: longitude,
43
+ };
44
+ }
45
+ /**
46
+ * Parses a coordinate string into a number
47
+ *
48
+ * @param coordinate - Coordinate string
49
+ * @returns Parsed number or null if invalid
50
+ *
51
+ * @internal
52
+ */
53
+ export function parseCoordinate(coordinate) {
54
+ if (!coordinate) {
55
+ return null;
56
+ }
57
+ const numericalCoordinate = dataValueAsFloat(coordinate);
58
+ if (isNaN(numericalCoordinate)) {
59
+ console.warn("GeoPushpinChartNext: Invalid coordinate", coordinate);
60
+ return null;
61
+ }
62
+ return numericalCoordinate;
63
+ }
64
+ /**
65
+ * Gets attribute header items from data view for geo data
66
+ *
67
+ * @internal
68
+ */
69
+ function getGeoAttributeHeaderItems(dv, geoData) {
70
+ const { color, size } = geoData;
71
+ const hasColorMeasure = color !== undefined;
72
+ const hasSizeMeasure = size !== undefined;
73
+ const attrHeaderItemIndex = hasColorMeasure || hasSizeMeasure ? 1 : 0;
74
+ return dv.meta().allHeaders()[attrHeaderItemIndex];
75
+ }
76
+ /**
77
+ * Gets format string from execution response for a measure
78
+ *
79
+ * @internal
80
+ */
81
+ function getFormatFromExecutionResponse(dv, indexMeasure) {
82
+ const measureDescriptors = dv.meta().measureDescriptors();
83
+ return measureDescriptors[indexMeasure].measureHeaderItem.format;
84
+ }
85
+ /**
86
+ * Extracts segment data and URIs from attribute header items
87
+ */
88
+ function getSegmentDataAndUris(attributeHeaderItems, dataIndex, nullHeaderString) {
89
+ const headerItems = attributeHeaderItems[dataIndex];
90
+ return headerItems.reduce((result, headerItem) => {
91
+ if (headerItem && isResultAttributeHeader(headerItem)) {
92
+ const { uri, name } = headerItem.attributeHeaderItem;
93
+ return { uris: [...result.uris, uri], data: [...result.data, name ?? nullHeaderString] };
94
+ }
95
+ return result;
96
+ }, { uris: [], data: [] });
97
+ }
98
+ /**
99
+ * Extracts measure data from data view
100
+ */
101
+ function getMeasureData(dv, dataIndex) {
102
+ const twoDimData = dv.rawData().twoDimData();
103
+ const measureValues = twoDimData[dataIndex];
104
+ return measureValues.map(dataValueAsFloat);
105
+ }
106
+ /**
107
+ * Extracts attribute data from attribute header items
108
+ */
109
+ function getAttributeData(attributeHeaderItems, dataIndex, emptyHeaderString, nullHeaderString) {
110
+ const headerItems = attributeHeaderItems[dataIndex];
111
+ return headerItems.map((i) => {
112
+ const name = resultHeaderName(i);
113
+ if (name) {
114
+ return name;
115
+ }
116
+ return name === "" ? emptyHeaderString : nullHeaderString;
117
+ });
118
+ }
119
+ /**
120
+ * Gets URI and identifier from object reference
121
+ */
122
+ function getUriAndIdentifier(ref) {
123
+ if (isIdentifierRef(ref)) {
124
+ return { identifier: ref.identifier };
125
+ }
126
+ else {
127
+ return { uri: ref.uri };
128
+ }
129
+ }
130
+ /**
131
+ * Extracts bucket item information
132
+ */
133
+ function getBucketItemInfo(bucketItem) {
134
+ if (!bucketItem) {
135
+ return null;
136
+ }
137
+ // Attribute item
138
+ if (isAttribute(bucketItem)) {
139
+ const localIdentifier = attributeLocalId(bucketItem);
140
+ const displayFormRef = attributeDisplayFormRef(bucketItem);
141
+ return {
142
+ localIdentifier,
143
+ ...getUriAndIdentifier(displayFormRef),
144
+ };
145
+ }
146
+ // Measure item
147
+ const localIdentifier = measureLocalId(bucketItem);
148
+ const measureItemRef = measureItem(bucketItem);
149
+ if (measureItemRef) {
150
+ return {
151
+ localIdentifier,
152
+ ...getUriAndIdentifier(measureItemRef),
153
+ };
154
+ }
155
+ // Non-simple-measures land here
156
+ return { localIdentifier };
157
+ }
158
+ /**
159
+ * Gets bucket item names and data indices from data view
160
+ */
161
+ function getBucketItemNameAndDataIndex(dv) {
162
+ const buckets = dv.def().buckets();
163
+ const measureDescriptors = dv.meta().measureDescriptors();
164
+ const attributeDescriptors = dv.meta().attributeDescriptors();
165
+ const bucketItemInfos = buckets.reduce((result, bucket) => {
166
+ result[bucket.localIdentifier] = getBucketItemInfo(bucket.items[0]);
167
+ return result;
168
+ }, {});
169
+ const result = {};
170
+ // Process attribute buckets
171
+ [
172
+ BucketNames.LOCATION,
173
+ BucketNames.LATITUDE,
174
+ BucketNames.LONGITUDE,
175
+ BucketNames.SEGMENT,
176
+ BucketNames.TOOLTIP_TEXT,
177
+ ].forEach((bucketName) => {
178
+ const bucketItemInfo = bucketItemInfos[bucketName];
179
+ if (!bucketItemInfo) {
180
+ return;
181
+ }
182
+ const index = attributeDescriptors.findIndex((desc) => desc.attributeHeader.localIdentifier === bucketItemInfo.localIdentifier &&
183
+ (desc.attributeHeader.uri === bucketItemInfo.uri ||
184
+ desc.attributeHeader.identifier === bucketItemInfo.identifier));
185
+ if (index !== -1) {
186
+ const { formOf: { name }, } = attributeDescriptors[index].attributeHeader;
187
+ result[bucketName] = { index, name };
188
+ }
189
+ });
190
+ // Process measure buckets
191
+ [BucketNames.SIZE, BucketNames.COLOR].forEach((bucketName) => {
192
+ const bucketItemInfo = bucketItemInfos[bucketName];
193
+ if (!bucketItemInfo) {
194
+ return;
195
+ }
196
+ const index = measureDescriptors.findIndex((desc) => desc.measureHeaderItem.localIdentifier === bucketItemInfo.localIdentifier &&
197
+ (desc.measureHeaderItem.uri === bucketItemInfo.uri ||
198
+ desc.measureHeaderItem.identifier === bucketItemInfo.identifier));
199
+ if (index !== -1) {
200
+ result[bucketName] = {
201
+ index,
202
+ name: measureDescriptors[index].measureHeaderItem.name,
203
+ };
204
+ }
205
+ });
206
+ return result;
207
+ }
208
+ /**
209
+ * Transforms data view into geo data structure
210
+ *
211
+ * @remarks
212
+ * This is the main data transformation function that extracts and structures
213
+ * all geo-related data from the execution result
214
+ *
215
+ * @param dv - Data view facade
216
+ * @param emptyHeaderString - String to use for empty headers
217
+ * @param nullHeaderString - String to use for null headers
218
+ * @returns Structured geo data
219
+ *
220
+ * @internal
221
+ */
222
+ export function getGeoData(dv, emptyHeaderString, nullHeaderString) {
223
+ const geoData = getBucketItemNameAndDataIndex(dv);
224
+ const attributeHeaderItems = getGeoAttributeHeaderItems(dv, geoData);
225
+ const locationIndex = geoData.location?.index;
226
+ const latitudeIndex = geoData.latitude?.index;
227
+ const longitudeIndex = geoData.longitude?.index;
228
+ const segmentIndex = geoData?.segment?.index;
229
+ const tooltipTextIndex = geoData?.tooltipText?.index;
230
+ const sizeIndex = geoData?.size?.index;
231
+ const colorIndex = geoData?.color?.index;
232
+ // Process location data (single attribute mode)
233
+ if (locationIndex !== undefined) {
234
+ const locationData = getAttributeData(attributeHeaderItems, locationIndex, emptyHeaderString, nullHeaderString);
235
+ geoData[BucketNames.LOCATION].data = locationData.map(getLocation);
236
+ }
237
+ // Process latitude/longitude data (two attribute mode)
238
+ if (latitudeIndex !== undefined && longitudeIndex !== undefined) {
239
+ const latitudeData = getAttributeData(attributeHeaderItems, latitudeIndex, emptyHeaderString, nullHeaderString);
240
+ const longitudeData = getAttributeData(attributeHeaderItems, longitudeIndex, emptyHeaderString, nullHeaderString);
241
+ geoData[BucketNames.LOCATION] = {
242
+ ...geoData[BucketNames.LATITUDE],
243
+ data: latitudeData.map((value, index) => ({
244
+ lat: parseCoordinate(value),
245
+ lng: parseCoordinate(longitudeData[index]),
246
+ })),
247
+ };
248
+ }
249
+ // Process segment data
250
+ if (segmentIndex !== undefined) {
251
+ const { data, uris } = getSegmentDataAndUris(attributeHeaderItems, segmentIndex, nullHeaderString);
252
+ geoData[BucketNames.SEGMENT].data = data;
253
+ geoData[BucketNames.SEGMENT].uris = uris;
254
+ }
255
+ // Process tooltip text data
256
+ if (tooltipTextIndex !== undefined) {
257
+ geoData[BucketNames.TOOLTIP_TEXT].data = getAttributeData(attributeHeaderItems, tooltipTextIndex, emptyHeaderString, nullHeaderString);
258
+ }
259
+ // Process size measure data
260
+ if (sizeIndex !== undefined) {
261
+ geoData[BucketNames.SIZE].data = getMeasureData(dv, sizeIndex);
262
+ geoData[BucketNames.SIZE].format = getFormatFromExecutionResponse(dv, sizeIndex);
263
+ }
264
+ // Process color measure data
265
+ if (colorIndex !== undefined) {
266
+ geoData[BucketNames.COLOR].data = getMeasureData(dv, colorIndex);
267
+ geoData[BucketNames.COLOR].format = getFormatFromExecutionResponse(dv, colorIndex);
268
+ }
269
+ return geoData;
270
+ }
271
+ /**
272
+ * Determines which legends should be available based on data
273
+ *
274
+ * @remarks
275
+ * Analyzes geo data to determine which legend types are applicable:
276
+ * - Category legend: When segments exist
277
+ * - Color legend: When color measure exists with varying values
278
+ * - Size legend: When size measure exists with varying values
279
+ *
280
+ * @param categoryItems - Category legend items
281
+ * @param geoData - Geo data structure
282
+ * @returns Object indicating which legends are available
283
+ *
284
+ * @internal
285
+ */
286
+ export function getAvailableLegends(categoryItems, geoData) {
287
+ const { color: { data: colorData = [] } = {}, size: { data: sizeData = [] } = {} } = geoData;
288
+ const { min: minColor, max: maxColor } = getMinMax(colorData);
289
+ const { min: minSize, max: maxSize } = getMinMax(sizeData);
290
+ const hasCategoryLegend = Boolean(categoryItems?.length);
291
+ const hasColorLegend = Boolean(colorData.length) && minColor !== maxColor && !hasCategoryLegend;
292
+ const hasSizeLegend = Boolean(sizeData.length) && minSize !== maxSize;
293
+ return {
294
+ hasCategoryLegend,
295
+ hasColorLegend,
296
+ hasSizeLegend,
297
+ };
298
+ }
299
+ /**
300
+ * Parses a GeoJSON property item from JSON string
301
+ */
302
+ function parseGeoPropertyItem(item) {
303
+ try {
304
+ return JSON.parse(item);
305
+ }
306
+ catch {
307
+ return {};
308
+ }
309
+ }
310
+ /**
311
+ * Parses GeoJSON properties from feature
312
+ *
313
+ * @remarks
314
+ * Extracts and parses location, color, size, and segment properties from GeoJSON feature
315
+ *
316
+ * @param properties - GeoJSON properties object
317
+ * @returns Parsed properties object
318
+ *
319
+ * @internal
320
+ */
321
+ export function parseGeoProperties(properties) {
322
+ const { locationName = "{}", color = "{}", size = "{}", segment = "{}" } = properties || {};
323
+ return {
324
+ locationName: parseGeoPropertyItem(locationName),
325
+ size: parseGeoPropertyItem(size),
326
+ color: parseGeoPropertyItem(color),
327
+ segment: parseGeoPropertyItem(segment),
328
+ };
329
+ }
330
+ /**
331
+ * Finds geo attributes in the data view dimension
332
+ *
333
+ * @param dv - Data view facade
334
+ * @param geoData - Geo data structure
335
+ * @returns Geo attributes information
336
+ *
337
+ * @internal
338
+ */
339
+ export function findGeoAttributesInDimension(dv, geoData) {
340
+ const { color, location, segment, size, tooltipText } = geoData;
341
+ const locationIndex = location?.index ?? 0;
342
+ const headers = dv.meta().allHeaders();
343
+ const hasMeasure = size || color;
344
+ const attrDimensionIndex = hasMeasure ? 1 : 0;
345
+ const attributeDescriptors = dv.meta().attributeDescriptors();
346
+ const attributeResultHeaderItems = headers[attrDimensionIndex];
347
+ const locationAttribute = {
348
+ ...attributeDescriptors[locationIndex].attributeHeader,
349
+ items: attributeResultHeaderItems[locationIndex],
350
+ };
351
+ const segmentByAttribute = segment?.data.length
352
+ ? {
353
+ ...attributeDescriptors[segment.index].attributeHeader,
354
+ items: attributeResultHeaderItems[segment.index],
355
+ }
356
+ : undefined;
357
+ const tooltipTextAttribute = tooltipText?.data.length
358
+ ? {
359
+ ...attributeDescriptors[tooltipText.index].attributeHeader,
360
+ items: attributeResultHeaderItems[tooltipText.index],
361
+ }
362
+ : undefined;
363
+ return {
364
+ locationAttribute,
365
+ segmentByAttribute,
366
+ tooltipTextAttribute,
367
+ };
368
+ }
369
+ //# sourceMappingURL=transformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformation.js","sourceRoot":"","sources":["../../../../src/next/features/data/transformation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAQH,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,gBAAgB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAY/D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAyCpD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAgB;IAC7C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,CAAC;IACf,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3E,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,CA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K,CAAC;SACnD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,oBAAoB,GAA8B,WAAW,EAAE,IAAI,CAAC,MAAM;QAC5E,CAAC,CAAC;YACI,GAAG,oBAAoB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,eAAe;YAC1D,KAAK,EAAE,0BAA0B,CAAC,WAAW,CAAC,KAAK,CAAC;SACvD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACH,iBAAiB;QACjB,kBAAkB;QAClB,oBAAoB;KACvB,CAAC;AACN,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { Map as MapLibreMap, Popup } from "maplibre-gl";
2
+ import { IMapOptions } from "../../types/mapProvider.js";
3
+ import { IMapLibreLocale } from "../../utils/mapLocale.js";
4
+ /**
5
+ * Result of map initialization
6
+ *
7
+ * @internal
8
+ */
9
+ export interface IMapInitResult {
10
+ map: MapLibreMap;
11
+ tooltip: Popup;
12
+ maplibregl: typeof import("maplibre-gl");
13
+ }
14
+ /**
15
+ * Initialize MapLibre GL map instance with options
16
+ *
17
+ * @remarks
18
+ * This function handles the creation of a MapLibre GL map instance with all necessary
19
+ * configuration. It dynamically imports maplibre-gl to avoid bundling issues, sets up
20
+ * the map with safe default options, and ensures glyphs are properly configured for
21
+ * text rendering.
22
+ *
23
+ * @param options - Map initialization options including container, center, zoom, bounds, etc.
24
+ * @param locale - Optional MapLibre locale configuration for cooperative gestures
25
+ * @returns Promise resolving to map instance, tooltip, and maplibre-gl module
26
+ *
27
+ * @internal
28
+ */
29
+ export declare function initializeMapLibreMap({ container, center, zoom, bounds, interactive, cooperativeGestures, style }: IMapOptions, locale?: IMapLibreLocale): Promise<IMapInitResult>;
30
+ //# sourceMappingURL=initializeMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeMap.d.ts","sourceRoot":"","sources":["../../../../src/next/features/map/initializeMap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgC,GAAG,IAAI,WAAW,EAAc,KAAK,EAAE,MAAM,aAAa,CAAC;AAMvG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,WAAW,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;IACf,UAAU,EAAE,cAAc,aAAa,CAAC,CAAC;CAC5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CACvC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAkB,EAAE,mBAA0B,EAAE,KAAK,EAAE,EAAE,WAAW,EACvG,MAAM,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,cAAc,CAAC,CA8CzB"}
@@ -0,0 +1,58 @@
1
+ // (C) 2025 GoodData Corporation
2
+ import { DEFAULT_MAPLIBRE_OPTIONS, DEFAULT_TOOLTIP_OPTIONS, } from "../../providers/maplibre/maplibreConfig.js";
3
+ /**
4
+ * Initialize MapLibre GL map instance with options
5
+ *
6
+ * @remarks
7
+ * This function handles the creation of a MapLibre GL map instance with all necessary
8
+ * configuration. It dynamically imports maplibre-gl to avoid bundling issues, sets up
9
+ * the map with safe default options, and ensures glyphs are properly configured for
10
+ * text rendering.
11
+ *
12
+ * @param options - Map initialization options including container, center, zoom, bounds, etc.
13
+ * @param locale - Optional MapLibre locale configuration for cooperative gestures
14
+ * @returns Promise resolving to map instance, tooltip, and maplibre-gl module
15
+ *
16
+ * @internal
17
+ */
18
+ export async function initializeMapLibreMap({ container, center, zoom, bounds, interactive = true, cooperativeGestures = true, style }, locale) {
19
+ // Dynamically import maplibre-gl to avoid bundling issues
20
+ const maplibregl = await import("maplibre-gl");
21
+ let styleSpecification = style;
22
+ if (!styleSpecification) {
23
+ const { createStyleSpecification } = await import("../../providers/maplibre/style.js");
24
+ styleSpecification = createStyleSpecification(window.location.origin);
25
+ }
26
+ const mapOptions = {
27
+ ...DEFAULT_MAPLIBRE_OPTIONS,
28
+ style: styleSpecification,
29
+ container,
30
+ interactive,
31
+ cooperativeGestures,
32
+ ...(cooperativeGestures && locale ? { locale } : {}),
33
+ };
34
+ if (bounds) {
35
+ mapOptions.bounds = [
36
+ [bounds.southWest.lng, bounds.southWest.lat],
37
+ [bounds.northEast.lng, bounds.northEast.lat],
38
+ ];
39
+ }
40
+ else if (center) {
41
+ mapOptions.center = [center.lng, center.lat];
42
+ }
43
+ else if (zoom) {
44
+ mapOptions.zoom = zoom;
45
+ }
46
+ const map = new maplibregl.Map(mapOptions);
47
+ const tooltip = new maplibregl.Popup(DEFAULT_TOOLTIP_OPTIONS);
48
+ return new Promise((resolve, reject) => {
49
+ map.on("load", () => {
50
+ resolve({ map, tooltip, maplibregl });
51
+ });
52
+ map.on("error", (e) => {
53
+ console.error("[initializeMapLibreMap] Map error", e);
54
+ reject(new Error(`MapLibre initialization error: ${e?.error?.message ?? "Unknown error"}`));
55
+ });
56
+ });
57
+ }
58
+ //# sourceMappingURL=initializeMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeMap.js","sourceRoot":"","sources":["../../../../src/next/features/map/initializeMap.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAIhC,OAAO,EACH,wBAAwB,EACxB,uBAAuB,GAC1B,MAAM,4CAA4C,CAAC;AAepD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAAE,KAAK,EAAe,EACvG,MAAwB;IAExB,0DAA0D;IAC1D,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACtB,MAAM,E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CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAU,EAAE,EAAE;YAC3B,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAAC;YACtD,MAAM,CACF,IAAI,KAAK,CACL,kCAAmC,CAAsC,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,CACjH,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { Map as MapLibreMap } from "maplibre-gl";
2
+ import { IColorStrategy } from "@gooddata/sdk-ui-vis-commons";
3
+ import { IMapConfig } from "../../types/mapProvider.js";
4
+ import { IGeoData } from "../../types/shared.js";
5
+ /**
6
+ * Add pushpin layers to the map
7
+ *
8
+ * @remarks
9
+ * This function adds the appropriate layers for displaying pushpin data on the map.
10
+ * If clustering is enabled, it adds cluster layers (cluster points, cluster labels, and
11
+ * unclustered points). Otherwise, it adds a single pushpin layer, attempting to insert
12
+ * it before state labels if they exist for better visual hierarchy.
13
+ *
14
+ * @param map - MapLibre map instance
15
+ * @param dataSourceId - ID of the data source to use
16
+ * @param geoData - Geographic data to display
17
+ * @param config - Map configuration
18
+ * @param hasClustering - Whether clustering is enabled
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function addPushpinLayers(map: MapLibreMap, dataSourceId: string, geoData: IGeoData, config: IMapConfig, hasClustering: boolean): void;
23
+ /**
24
+ * Remove all geo-related layers from the map
25
+ *
26
+ * @remarks
27
+ * This function removes all pushpin and cluster layers along with their data source.
28
+ * It's typically called before updating the map with new data.
29
+ *
30
+ * @param map - MapLibre map instance
31
+ *
32
+ * @internal
33
+ */
34
+ export declare function removeGeoLayers(map: MapLibreMap): void;
35
+ /**
36
+ * Add data source and layers to the map
37
+ *
38
+ * @remarks
39
+ * This function combines data source creation and layer addition into a single
40
+ * operation. It removes any existing layers/source first, then creates a new
41
+ * data source and adds the appropriate layers based on clustering configuration.
42
+ *
43
+ * @param map - MapLibre map instance
44
+ * @param geoData - Geographic data to display
45
+ * @param config - Map configuration
46
+ * @param colorStrategy - Color strategy for styling
47
+ *
48
+ * @internal
49
+ */
50
+ export declare function updateMapLayers(map: MapLibreMap, geoData: IGeoData, config: IMapConfig, colorStrategy: IColorStrategy): void;
51
+ //# sourceMappingURL=layerManagement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerManagement.d.ts","sourceRoot":"","sources":["../../../../src/next/features/map/layerManagement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAa9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC5B,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,OAAO,GACvB,IAAI,CAgBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAYtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,cAAc,GAC9B,IAAI,CAoBN"}
@@ -0,0 +1,95 @@
1
+ // (C) 2025 GoodData Corporation
2
+ import { DEFAULT_CLUSTER_LAYER_NAME, DEFAULT_DATA_SOURCE_NAME, DEFAULT_LAYER_NAME, } from "../../constants/geoChart.js";
3
+ import { createClusterLabels, createClusterPoints, createPushpinDataLayer, createUnclusterPoints, } from "../../providers/maplibre/maplibreDataLayers.js";
4
+ import { isClusteringAllowed } from "../clustering/clustering.js";
5
+ import { createGeoDataSource } from "../data/dataSourceManagement.js";
6
+ /**
7
+ * Add pushpin layers to the map
8
+ *
9
+ * @remarks
10
+ * This function adds the appropriate layers for displaying pushpin data on the map.
11
+ * If clustering is enabled, it adds cluster layers (cluster points, cluster labels, and
12
+ * unclustered points). Otherwise, it adds a single pushpin layer, attempting to insert
13
+ * it before state labels if they exist for better visual hierarchy.
14
+ *
15
+ * @param map - MapLibre map instance
16
+ * @param dataSourceId - ID of the data source to use
17
+ * @param geoData - Geographic data to display
18
+ * @param config - Map configuration
19
+ * @param hasClustering - Whether clustering is enabled
20
+ *
21
+ * @internal
22
+ */
23
+ export function addPushpinLayers(map, dataSourceId, geoData, config, hasClustering) {
24
+ if (hasClustering) {
25
+ map.addLayer(createClusterPoints(dataSourceId));
26
+ map.addLayer(createClusterLabels(dataSourceId));
27
+ map.addLayer(createUnclusterPoints(dataSourceId));
28
+ }
29
+ else {
30
+ // Try to add layer before state labels if they exist, otherwise add on top
31
+ const layerToInsertBefore = "state-label";
32
+ const beforeLayerExists = map.getLayer(layerToInsertBefore);
33
+ if (beforeLayerExists) {
34
+ map.addLayer(createPushpinDataLayer(dataSourceId, geoData, config), layerToInsertBefore);
35
+ }
36
+ else {
37
+ map.addLayer(createPushpinDataLayer(dataSourceId, geoData, config));
38
+ }
39
+ }
40
+ }
41
+ /**
42
+ * Remove all geo-related layers from the map
43
+ *
44
+ * @remarks
45
+ * This function removes all pushpin and cluster layers along with their data source.
46
+ * It's typically called before updating the map with new data.
47
+ *
48
+ * @param map - MapLibre map instance
49
+ *
50
+ * @internal
51
+ */
52
+ export function removeGeoLayers(map) {
53
+ const layersToRemove = [DEFAULT_LAYER_NAME, DEFAULT_CLUSTER_LAYER_NAME, "gdcClusterLabels"];
54
+ layersToRemove.forEach((layerId) => {
55
+ if (map.getLayer(layerId)) {
56
+ map.removeLayer(layerId);
57
+ }
58
+ });
59
+ if (map.getSource(DEFAULT_DATA_SOURCE_NAME)) {
60
+ map.removeSource(DEFAULT_DATA_SOURCE_NAME);
61
+ }
62
+ }
63
+ /**
64
+ * Add data source and layers to the map
65
+ *
66
+ * @remarks
67
+ * This function combines data source creation and layer addition into a single
68
+ * operation. It removes any existing layers/source first, then creates a new
69
+ * data source and adds the appropriate layers based on clustering configuration.
70
+ *
71
+ * @param map - MapLibre map instance
72
+ * @param geoData - Geographic data to display
73
+ * @param config - Map configuration
74
+ * @param colorStrategy - Color strategy for styling
75
+ *
76
+ * @internal
77
+ */
78
+ export function updateMapLayers(map, geoData, config, colorStrategy) {
79
+ if (!map.isStyleLoaded()) {
80
+ void map.once("styledata", () => {
81
+ updateMapLayers(map, geoData, config, colorStrategy);
82
+ });
83
+ return;
84
+ }
85
+ const { points: geoPointsConfig = {} } = config;
86
+ const hasClustering = isClusteringAllowed(geoData, geoPointsConfig.groupNearbyPoints);
87
+ // Remove existing layers and source
88
+ removeGeoLayers(map);
89
+ // Create and add new data source using data management utility
90
+ const source = createGeoDataSource(geoData, colorStrategy, config);
91
+ map.addSource(DEFAULT_DATA_SOURCE_NAME, source);
92
+ // Add layers
93
+ addPushpinLayers(map, DEFAULT_DATA_SOURCE_NAME, geoData, config, hasClustering);
94
+ }
95
+ //# sourceMappingURL=layerManagement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerManagement.js","sourceRoot":"","sources":["../../../../src/next/features/map/layerManagement.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAMhC,OAAO,EACH,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,GACxB,MAAM,gDAAgD,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAA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