@fluentui/react-charts 9.3.7 → 9.3.9

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 (259) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/dist/index.d.ts +433 -7
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  7. package/lib/components/AreaChart/AreaChart.js +1 -28
  8. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +27 -8
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  13. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  14. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  15. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  16. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  17. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  18. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  19. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  20. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  21. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +54 -4
  22. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  24. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  25. package/lib/components/CommonComponents/CartesianChart.js +81 -44
  26. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  27. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
  29. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  30. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
  31. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  33. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +643 -366
  35. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +24 -9
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  41. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  42. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  43. package/lib/components/FunnelChart/FunnelChart.js +33 -8
  44. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  45. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  47. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  48. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  49. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  50. package/lib/components/GanttChart/GanttChart.js +1 -1
  51. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  52. package/lib/components/GaugeChart/GaugeChart.js +13 -9
  53. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  54. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  55. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  56. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  57. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  58. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  59. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +18 -18
  60. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  61. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  62. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  63. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  64. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +60 -10
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  69. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  71. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  72. package/lib/components/Legends/Legends.js +3 -4
  73. package/lib/components/Legends/Legends.js.map +1 -1
  74. package/lib/components/Legends/OverflowMenu.js +9 -2
  75. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  76. package/lib/components/LineChart/LineChart.js +65 -64
  77. package/lib/components/LineChart/LineChart.js.map +1 -1
  78. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  79. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  80. package/lib/components/PolarChart/PolarChart.js +577 -0
  81. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  82. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  83. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  85. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  86. package/lib/components/PolarChart/index.js +2 -0
  87. package/lib/components/PolarChart/index.js.map +1 -0
  88. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  89. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  90. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  91. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  92. package/lib/components/SankeyChart/SankeyChart.js +15 -5
  93. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  94. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  95. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +24 -8
  96. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  98. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.js +13 -25
  100. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  102. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  103. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
  105. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  106. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  107. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +48 -68
  109. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  110. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  111. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  112. package/lib/index.js +1 -0
  113. package/lib/index.js.map +1 -1
  114. package/lib/types/ChartAnnotation.js.map +1 -1
  115. package/lib/types/DataPoint.js +1 -1
  116. package/lib/types/DataPoint.js.map +1 -1
  117. package/lib/utilities/ChartTitle.js +45 -0
  118. package/lib/utilities/ChartTitle.js.map +1 -0
  119. package/lib/utilities/Common.styles.js +73 -2
  120. package/lib/utilities/Common.styles.js.map +1 -1
  121. package/lib/utilities/Common.styles.raw.js +70 -1
  122. package/lib/utilities/Common.styles.raw.js.map +1 -1
  123. package/lib/utilities/image-export-utils.js +4 -4
  124. package/lib/utilities/image-export-utils.js.map +1 -1
  125. package/lib/utilities/index.js +1 -0
  126. package/lib/utilities/index.js.map +1 -1
  127. package/lib/utilities/utilities.js +219 -77
  128. package/lib/utilities/utilities.js.map +1 -1
  129. package/lib-commonjs/PolarChart.js +6 -0
  130. package/lib-commonjs/PolarChart.js.map +1 -0
  131. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  132. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
  134. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  135. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  136. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/ChartTable/ChartTable.js +27 -8
  138. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  139. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  140. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  141. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  143. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  145. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  146. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  147. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +65 -5
  148. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  149. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  150. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  151. package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
  152. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  153. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  154. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
  155. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
  157. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  159. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  160. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +649 -368
  161. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  162. package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
  163. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  164. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  165. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  166. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  167. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  168. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  169. package/lib-commonjs/components/FunnelChart/FunnelChart.js +31 -6
  170. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  171. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  172. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  173. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  174. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  175. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  176. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
  177. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  178. package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
  179. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  180. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  181. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  182. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  183. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  184. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  185. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +16 -16
  186. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  187. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  188. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  189. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  190. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  191. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +59 -9
  192. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  193. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  194. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  195. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  196. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  197. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  198. package/lib-commonjs/components/Legends/Legends.js +3 -4
  199. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  200. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  201. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  202. package/lib-commonjs/components/LineChart/LineChart.js +64 -63
  203. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  204. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  205. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  206. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  207. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  208. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  209. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  210. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  211. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  212. package/lib-commonjs/components/PolarChart/index.js +7 -0
  213. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  214. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  215. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  216. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  217. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  218. package/lib-commonjs/components/SankeyChart/SankeyChart.js +15 -5
  219. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  220. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  221. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -6
  222. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  223. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  224. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  225. package/lib-commonjs/components/ScatterChart/ScatterChart.js +12 -24
  226. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  227. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  228. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  229. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  230. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
  231. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  232. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  233. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  234. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +47 -67
  235. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  236. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  237. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  238. package/lib-commonjs/index.js +1 -0
  239. package/lib-commonjs/index.js.map +1 -1
  240. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  241. package/lib-commonjs/types/DataPoint.js +1 -1
  242. package/lib-commonjs/types/DataPoint.js.map +1 -1
  243. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  244. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  245. package/lib-commonjs/utilities/Common.styles.js +69 -1
  246. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  247. package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
  248. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  249. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  250. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  251. package/lib-commonjs/utilities/index.js +1 -0
  252. package/lib-commonjs/utilities/index.js.map +1 -1
  253. package/lib-commonjs/utilities/utilities.js +235 -78
  254. package/lib-commonjs/utilities/utilities.js.map +1 -1
  255. package/package.json +11 -17
  256. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  257. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  258. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  259. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utilities/image-export-utils.ts"],"sourcesContent":["'use client';\n\nimport { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { copyStyle, createMeasurementSpan } from './index';\nimport { ImageExportOptions } from '../types/index';\nimport { Legend, LegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/useLegendsStyles.styles';\n\nexport type GridChart = {\n container: HTMLElement | null | undefined;\n row?: number;\n col?: number;\n};\n\ntype SvgImage = {\n dataUrl: string;\n width: number;\n height: number;\n};\n\nexport async function exportChartsAsImage(\n charts: GridChart[],\n legendsToSvg?: LegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: ImageExportOptions = {},\n): Promise<string> {\n if (charts.length === 0 && !legendsToSvg) {\n throw new Error('No charts or legends to export');\n }\n\n const chartImages = await Promise.all(\n charts.map(chart => {\n return new Promise<SvgImage>(resolve => {\n const svg = cloneStyledSVG(chart.container, isRTL);\n const svgDataUrl = svgToBase64(svg.node);\n resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });\n });\n }),\n );\n\n const grid: SvgImage[][] = []; // Sparse 2D array\n charts.forEach((chart, i) => {\n const row = chart.row || 0;\n const col = chart.col || 0;\n if (!grid[row]) {\n grid[row] = [];\n }\n grid[row][col] = chartImages[i];\n });\n\n if (legendsToSvg) {\n let totalWidth = 0;\n grid.forEach(row => {\n let rowWidth = 0;\n row.forEach(item => {\n rowWidth += item.width;\n });\n totalWidth = Math.max(totalWidth, rowWidth);\n });\n\n const svg = legendsToSvg(totalWidth, isRTL);\n if (svg.node) {\n const svgDataUrl = svgToBase64(svg.node);\n grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);\n }\n }\n\n return svgToPng(grid, opts);\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\n\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'align-items',\n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'box-sizing',\n 'color',\n 'column-gap',\n 'display',\n 'flex',\n 'flex-direction',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'gap',\n 'height',\n 'justify-content',\n 'letter-spacing',\n 'line-height',\n 'margin',\n 'max-height',\n 'max-width',\n 'min-height',\n 'min-width',\n 'opacity',\n 'overflow',\n 'padding',\n 'pointer-events',\n 'position',\n 'row-gap',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'white-space',\n 'width',\n 'z-index',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction cloneStyledSVG(chartContainer: HTMLElement | null | undefined, isRTL: boolean) {\n if (!chartContainer) {\n throw new Error('Chart container is not defined');\n }\n\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const originalForeignObjects = svg.querySelectorAll('foreignObject');\n const clonedForeignObjects = clonedSvg.node()!.querySelectorAll('foreignObject');\n\n originalForeignObjects.forEach((originalFo, index) => {\n const clonedFo = clonedForeignObjects[index];\n if (!clonedFo) {\n return;\n }\n\n const originalRoot = originalFo.firstElementChild as HTMLElement | null;\n const clonedRoot = clonedFo.firstElementChild as HTMLElement | null;\n\n if (originalRoot && clonedRoot) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);\n }\n\n const originalHtmlElements = originalFo.querySelectorAll<HTMLElement>('*');\n const clonedHtmlElements = clonedFo.querySelectorAll<HTMLElement>('*');\n\n originalHtmlElements.forEach((originalEl, elementIndex) => {\n const clonedEl = clonedHtmlElements[elementIndex];\n if (clonedEl) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);\n }\n });\n });\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = isHTMLElement(original);\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n const { width, height } = svg.getBoundingClientRect();\n\n clonedSvg\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n clonedSvg.selectAll('[data-chart-annotation-layer=\"true\"]').remove();\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n const result = {\n node: clonedSvg.node(),\n width,\n height,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: Legend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): {\n node: SVGSVGElement | null;\n width: number;\n height: number;\n} {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = createMeasurementSpan(legends[i].title, textClassName, legendContainer);\n const legendWidth = textOffset + legendText.getBoundingClientRect().width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n const h1 = legendY;\n const svg = d3Create<SVGSVGElement>('svg').attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n svg.append(() => legendGroup.node()!);\n\n return {\n node: svg.node(),\n width: w1,\n height: h1,\n };\n}\n\ntype PositionedImage = SvgImage & {\n x: number;\n y: number;\n};\n\nasync function svgToPng(grid: SvgImage[][], opts: ImageExportOptions = {}): Promise<string> {\n let totalWidth = 0;\n let totalHeight = 0;\n\n const positionedImages: PositionedImage[] = grid\n .map(row => {\n let rowWidth = 0;\n let rowHeight = 0;\n\n const items = row.map(item => {\n const positioned = { ...item, x: rowWidth, y: totalHeight };\n rowWidth += item.width;\n rowHeight = Math.max(rowHeight, item.height);\n return positioned;\n });\n\n totalWidth = Math.max(totalWidth, rowWidth);\n totalHeight += rowHeight;\n\n return items;\n })\n .flat();\n\n const scale = opts.scale || 1;\n const w0 = opts.width || totalWidth;\n const h0 = opts.height || totalHeight;\n const scaleX = (scale * w0) / totalWidth;\n const scaleY = (scale * h0) / totalHeight;\n totalWidth = scaleX * totalWidth;\n totalHeight = scaleY * totalHeight;\n\n const canvas = document.createElement('canvas');\n canvas.width = totalWidth;\n canvas.height = totalHeight;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Canvas context is null');\n }\n\n ctx.fillStyle = opts.background || 'transparent';\n ctx.fillRect(0, 0, totalWidth, totalHeight);\n\n await Promise.all(\n positionedImages.map(\n item =>\n new Promise<void>((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);\n resolve();\n };\n img.onerror = reject;\n img.src = item.dataUrl;\n }),\n ),\n );\n\n return canvas.toDataURL('image/png');\n}\n\nfunction svgToBase64(svgNode: SVGSVGElement | null) {\n if (!svgNode) {\n throw new Error('SVG node is null');\n }\n\n const svgData = new XMLSerializer().serializeToString(svgNode);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n return svgDataUrl;\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"],"names":["create","d3Create","select","d3Select","isHTMLElement","copyStyle","createMeasurementSpan","LEGEND_CONTAINER_MARGIN_TOP","LEGEND_CONTAINER_MARGIN_START","LEGEND_PADDING","LEGEND_HEIGHT","LEGEND_SHAPE_BORDER","LEGEND_SHAPE_SIZE","LEGEND_SHAPE_MARGIN_END","INACTIVE_LEGEND_TEXT_OPACITY","exportChartsAsImage","charts","legendsToSvg","isRTL","opts","length","Error","chartImages","Promise","all","map","chart","resolve","svg","cloneStyledSVG","container","svgDataUrl","svgToBase64","node","dataUrl","width","height","grid","forEach","i","row","col","totalWidth","rowWidth","item","Math","max","push","svgToPng","SVG_STYLE_PROPERTIES","SVG_TEXT_STYLE_PROPERTIES","ANNOTATION_HTML_STYLE_PROPERTIES","ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES","chartContainer","querySelector","clonedSvg","cloneNode","attr","svgElements","getElementsByTagName","clonedSvgElements","TEXT_ELEMENTS","TABLE_ELEMENTS","tag","tagName","toLowerCase","includes","originalForeignObjects","querySelectorAll","clonedForeignObjects","originalFo","index","clonedFo","originalRoot","firstElementChild","clonedRoot","originalHtmlElements","clonedHtmlElements","originalEl","elementIndex","clonedEl","annotationSvg","annotationClone","annotationElements","clonedAnnotationElements","original","cloned","isSvgElement","SVGElement","isTextElement","isHtmlElement","getBoundingClientRect","selectAll","remove","append","result","LEGEND_TEXT_STYLE_PROPERTIES_MAP","color","cloneLegendsToSVG","legends","svgWidth","config","legendContainer","selectedLegends","centerLegends","textClassName","legendGroup","legendX","legendY","legendLine","legendLines","legendLineWidths","noLegendsSelected","Object","keys","textOffset","legendText","title","legendWidth","legendItem","elem","pop","isLegendActive","style","text","call","selection","ln","idx","lineOffsetX","remLineWidth","itemOffsetX","newOffsetX","w1","h1","totalHeight","positionedImages","rowHeight","items","positioned","x","y","flat","scale","w0","h0","scaleX","scaleY","canvas","document","createElement","ctx","getContext","fillStyle","background","fillRect","reject","img","Image","onload","drawImage","onerror","src","toDataURL","svgNode","svgData","XMLSerializer","serializeToString","btoa","unescapePonyfill","encodeURIComponent","hex2","hex4","str","chr","part","charAt","slice","exec","String","fromCharCode","parseInt"],"mappings":"AAAA;AAEA,SAASA,UAAUC,QAAQ,EAAEC,UAAUC,QAAQ,QAAmB,eAAe;AACjF,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,SAAS,EAAEC,qBAAqB,QAAQ,UAAU;AAG3D,SACEC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,cAAc,EACdC,aAAa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,MAAM;IAClB;IAEA,MAAMgJ,UAAU,IAAIC,gBAAgBC,iBAAiB,CAACH;IACtD,MAAMrI,aAAa,+BAA+ByI,KAAKC,iBAAiBC,mBAAmBL;IAC3F,OAAOtI;AACT;AAEA,MAAM4I,OAAO;AACb,MAAMC,OAAO;AAEb;;;;CAIC,GACD,SAASH,iBAAiBI,GAAW;IACnC,IAAI9E,SAAS;IACb,MAAM3E,SAASyJ,IAAIzJ,MAAM;IACzB,IAAImD,QAAQ;IACZ,IAAIuG;IACJ,IAAIC;IACJ,MAAOxG,QAAQnD,OAAQ;QACrB0J,MAAMD,IAAIG,MAAM,CAACzG;QACjB,IAAIuG,QAAQ,KAAK;YACf,IAAID,IAAIG,MAAM,CAACzG,WAAW,KAAK;gBAC7BwG,OAAOF,IAAII,KAAK,CAAC1G,QAAQ,GAAGA,QAAQ;gBACpC,IAAIqG,KAAKM,IAAI,CAACH,OAAO;oBACnBhF,UAAUoF,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CxG,SAAS;oBACT;gBACF;YACF,OAAO;gBACLwG,OAAOF,IAAII,KAAK,CAAC1G,OAAOA,QAAQ;gBAChC,IAAIoG,KAAKO,IAAI,CAACH,OAAO;oBACnBhF,UAAUoF,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CxG,SAAS;oBACT;gBACF;YACF;QACF;QACAwB,UAAU+E;IACZ;IACA,OAAO/E;AACT"}
1
+ {"version":3,"sources":["../src/utilities/image-export-utils.ts"],"sourcesContent":["'use client';\n\nimport { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { copyStyle, measureTextWithDOM } from './index';\nimport { ImageExportOptions } from '../types/index';\nimport { Legend, LegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/useLegendsStyles.styles';\n\nexport type GridChart = {\n container: HTMLElement | null | undefined;\n row?: number;\n col?: number;\n};\n\ntype SvgImage = {\n dataUrl: string;\n width: number;\n height: number;\n};\n\nexport async function exportChartsAsImage(\n charts: GridChart[],\n legendsToSvg?: LegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: ImageExportOptions = {},\n): Promise<string> {\n if (charts.length === 0 && !legendsToSvg) {\n throw new Error('No charts or legends to export');\n }\n\n const chartImages = await Promise.all(\n charts.map(chart => {\n return new Promise<SvgImage>(resolve => {\n const svg = cloneStyledSVG(chart.container, isRTL);\n const svgDataUrl = svgToBase64(svg.node);\n resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });\n });\n }),\n );\n\n const grid: SvgImage[][] = []; // Sparse 2D array\n charts.forEach((chart, i) => {\n const row = chart.row || 0;\n const col = chart.col || 0;\n if (!grid[row]) {\n grid[row] = [];\n }\n grid[row][col] = chartImages[i];\n });\n\n if (legendsToSvg) {\n let totalWidth = 0;\n grid.forEach(row => {\n let rowWidth = 0;\n row.forEach(item => {\n rowWidth += item.width;\n });\n totalWidth = Math.max(totalWidth, rowWidth);\n });\n\n const svg = legendsToSvg(totalWidth, isRTL);\n if (svg.node) {\n const svgDataUrl = svgToBase64(svg.node);\n grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);\n }\n }\n\n return svgToPng(grid, opts);\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\n\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'align-items',\n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'box-sizing',\n 'color',\n 'column-gap',\n 'display',\n 'flex',\n 'flex-direction',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'gap',\n 'height',\n 'justify-content',\n 'letter-spacing',\n 'line-height',\n 'margin',\n 'max-height',\n 'max-width',\n 'min-height',\n 'min-width',\n 'opacity',\n 'overflow',\n 'padding',\n 'pointer-events',\n 'position',\n 'row-gap',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'white-space',\n 'width',\n 'z-index',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction cloneStyledSVG(chartContainer: HTMLElement | null | undefined, isRTL: boolean) {\n if (!chartContainer) {\n throw new Error('Chart container is not defined');\n }\n\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const originalForeignObjects = svg.querySelectorAll('foreignObject');\n const clonedForeignObjects = clonedSvg.node()!.querySelectorAll('foreignObject');\n\n originalForeignObjects.forEach((originalFo, index) => {\n const clonedFo = clonedForeignObjects[index];\n if (!clonedFo) {\n return;\n }\n\n const originalRoot = originalFo.firstElementChild as HTMLElement | null;\n const clonedRoot = clonedFo.firstElementChild as HTMLElement | null;\n\n if (originalRoot && clonedRoot) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);\n }\n\n const originalHtmlElements = originalFo.querySelectorAll<HTMLElement>('*');\n const clonedHtmlElements = clonedFo.querySelectorAll<HTMLElement>('*');\n\n originalHtmlElements.forEach((originalEl, elementIndex) => {\n const clonedEl = clonedHtmlElements[elementIndex];\n if (clonedEl) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);\n }\n });\n });\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = isHTMLElement(original);\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n const { width, height } = svg.getBoundingClientRect();\n\n clonedSvg\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n clonedSvg.selectAll('[data-chart-annotation-layer=\"true\"]').remove();\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n const result = {\n node: clonedSvg.node(),\n width,\n height,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: Legend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): {\n node: SVGSVGElement | null;\n width: number;\n height: number;\n} {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = measureTextWithDOM(legends[i].title, `.${textClassName}`, legendContainer);\n const legendWidth = textOffset + legendText.width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText.node, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n const h1 = legendY;\n const svg = d3Create<SVGSVGElement>('svg').attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n svg.append(() => legendGroup.node()!);\n\n return {\n node: svg.node(),\n width: w1,\n height: h1,\n };\n}\n\ntype PositionedImage = SvgImage & {\n x: number;\n y: number;\n};\n\nasync function svgToPng(grid: SvgImage[][], opts: ImageExportOptions = {}): Promise<string> {\n let totalWidth = 0;\n let totalHeight = 0;\n\n const positionedImages: PositionedImage[] = grid\n .map(row => {\n let rowWidth = 0;\n let rowHeight = 0;\n\n const items = row.map(item => {\n const positioned = { ...item, x: rowWidth, y: totalHeight };\n rowWidth += item.width;\n rowHeight = Math.max(rowHeight, item.height);\n return positioned;\n });\n\n totalWidth = Math.max(totalWidth, rowWidth);\n totalHeight += rowHeight;\n\n return items;\n })\n .flat();\n\n const scale = opts.scale || 1;\n const w0 = opts.width || totalWidth;\n const h0 = opts.height || totalHeight;\n const scaleX = (scale * w0) / totalWidth;\n const scaleY = (scale * h0) / totalHeight;\n totalWidth = scaleX * totalWidth;\n totalHeight = scaleY * totalHeight;\n\n const canvas = document.createElement('canvas');\n canvas.width = totalWidth;\n canvas.height = totalHeight;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Canvas context is null');\n }\n\n ctx.fillStyle = opts.background || 'transparent';\n ctx.fillRect(0, 0, totalWidth, totalHeight);\n\n await Promise.all(\n positionedImages.map(\n item =>\n new Promise<void>((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);\n resolve();\n };\n img.onerror = reject;\n img.src = item.dataUrl;\n }),\n ),\n );\n\n return canvas.toDataURL('image/png');\n}\n\nfunction svgToBase64(svgNode: SVGSVGElement | null) {\n if (!svgNode) {\n throw new Error('SVG node is null');\n }\n\n const svgData = new XMLSerializer().serializeToString(svgNode);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n return svgDataUrl;\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"],"names":["create","d3Create","select","d3Select","isHTMLElement","copyStyle","measureTextWithDOM","LEGEND_CONTAINER_MARGIN_TOP","LEGEND_CONTAINER_MARGIN_START","LEGEND_PADDING","LEGEND_HEIGHT","LEGEND_SHAPE_BORDER","LEGEND_SHAPE_SIZE","LEGEND_SHAPE_MARGIN_END","INACTIVE_LEGEND_TEXT_OPACITY","exportChartsAsImage","charts","legendsToSvg","isRTL","opts","length","Error","chartImages","Promise","all","map","chart","resolve","svg","cloneStyledSVG","container","svgDataUrl","svgToBase64","node","dataUrl","width","height","grid","forEach","i","row","col","totalWidth","rowWidth","item","Math","max","push","svgToPng","SVG_STYLE_PROPERTIES","SVG_TEXT_STYLE_PROPERTIES","ANNOTATION_HTML_STYLE_PROPERTIES","ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES","chartContainer","querySelector","clonedSvg","cloneNode","attr","svgElements","getElementsByTagName","clonedSvgElements","TEXT_ELEMENTS","TABLE_ELEMENTS","tag","tagName","toLowerCase","includes","originalForeignObjects","querySelectorAll","clonedForeignObjects","originalFo","index","clonedFo","originalRoot","firstElementChild","clonedRoot","originalHtmlElements","clonedHtmlElements","originalEl","elementIndex","clonedEl","annotationSvg","annotationClone","annotationElements","clonedAnnotationElements","original","cloned","isSvgElement","SVGElement","isTextElement","isHtmlElement","getBoundingClientRect","selectAll","remove","append","result","LEGEND_TEXT_STYLE_PROPERTIES_MAP","color","cloneLegendsToSVG","legends","svgWidth","config","legendContainer","selectedLegends","centerLegends","textClassName","legendGroup","legendX","legendY","legendLine","legendLines","legendLineWidths","noLegendsSelected","Object","keys","textOffset","legendText","title","legendWidth","legendItem","elem","pop","isLegendActive","style","text","call","selection","ln","idx","lineOffsetX","remLineWidth","itemOffsetX","newOffsetX","w1","h1","totalHeight","positionedImages","rowHeight","items","positioned","x","y","flat","scale","w0","h0","scaleX","scaleY","canvas","document","createElement","ctx","getContext","fillStyle","background","fillRect","reject","img","Image","onload","drawImage","onerror","src","toDataURL","svgNode","svgData","XMLSerializer","serializeToString","btoa","unescapePonyfill","encodeURIComponent","hex2","hex4","str","chr","part","charAt","slice","exec","String","fromCharCode","parseInt"],"mappings":"AAAA;AAEA,SAASA,UAAUC,QAAQ,EAAEC,UAAUC,QAAQ,QAAmB,eAAe;AACjF,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,UAAU;AAGxD,SACEC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,cAAc,EACdC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,uBAAuB,EACvBC,4BA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AAIC,gBAAgBC,iBAAiB,CAACH;IACtD,MAAMrI,aAAa,+BAA+ByI,KAAKC,iBAAiBC,mBAAmBL;IAC3F,OAAOtI;AACT;AAEA,MAAM4I,OAAO;AACb,MAAMC,OAAO;AAEb;;;;CAIC,GACD,SAASH,iBAAiBI,GAAW;IACnC,IAAI9E,SAAS;IACb,MAAM3E,SAASyJ,IAAIzJ,MAAM;IACzB,IAAImD,QAAQ;IACZ,IAAIuG;IACJ,IAAIC;IACJ,MAAOxG,QAAQnD,OAAQ;QACrB0J,MAAMD,IAAIG,MAAM,CAACzG;QACjB,IAAIuG,QAAQ,KAAK;YACf,IAAID,IAAIG,MAAM,CAACzG,WAAW,KAAK;gBAC7BwG,OAAOF,IAAII,KAAK,CAAC1G,QAAQ,GAAGA,QAAQ;gBACpC,IAAIqG,KAAKM,IAAI,CAACH,OAAO;oBACnBhF,UAAUoF,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CxG,SAAS;oBACT;gBACF;YACF,OAAO;gBACLwG,OAAOF,IAAII,KAAK,CAAC1G,OAAOA,QAAQ;gBAChC,IAAIoG,KAAKO,IAAI,CAACH,OAAO;oBACnBhF,UAAUoF,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CxG,SAAS;oBACT;gBACF;YACF;QACF;QACAwB,UAAU+E;IACZ;IACA,OAAO/E;AACT"}
@@ -2,3 +2,4 @@ export * from './utilities';
2
2
  export * from './colors';
3
3
  export * from './vbc-utils';
4
4
  export * from './Common.styles';
5
+ export * from './ChartTitle';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utilities/index.ts"],"sourcesContent":["export * from './utilities';\nexport * from './colors';\nexport * from './vbc-utils';\nexport * from './Common.styles';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,kBAAkB"}
1
+ {"version":3,"sources":["../src/utilities/index.ts"],"sourcesContent":["export * from './utilities';\nexport * from './colors';\nexport * from './vbc-utils';\nexport * from './Common.styles';\nexport * from './ChartTitle';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,eAAe"}