@lobehub/charts 5.6.0 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/es/AccuracyBarChart/index.d.mts +62 -0
  2. package/es/AccuracyBarChart/index.mjs +326 -0
  3. package/es/AccuracyBarChart/index.mjs.map +1 -0
  4. package/es/AccuracyBarChart/styles.d.mts +14 -0
  5. package/es/AccuracyBarChart/styles.mjs +71 -0
  6. package/es/AccuracyBarChart/styles.mjs.map +1 -0
  7. package/es/AreaChart/index.d.mts +13 -0
  8. package/es/AreaChart/index.mjs +308 -0
  9. package/es/AreaChart/index.mjs.map +1 -0
  10. package/es/AreaChart/styles.d.mts +9 -0
  11. package/es/AreaChart/styles.mjs +28 -0
  12. package/es/AreaChart/styles.mjs.map +1 -0
  13. package/es/BarChart/index.d.mts +11 -0
  14. package/es/BarChart/index.mjs +290 -0
  15. package/es/BarChart/index.mjs.map +1 -0
  16. package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
  17. package/es/BarChart/renderShape.mjs +28 -0
  18. package/es/BarChart/renderShape.mjs.map +1 -0
  19. package/es/BarChart/styles.d.mts +9 -0
  20. package/es/BarChart/styles.mjs +28 -0
  21. package/es/BarChart/styles.mjs.map +1 -0
  22. package/es/BarList/index.d.mts +32 -0
  23. package/es/BarList/index.mjs +128 -0
  24. package/es/BarList/index.mjs.map +1 -0
  25. package/es/BarList/styles.d.mts +13 -0
  26. package/es/BarList/styles.mjs +63 -0
  27. package/es/BarList/styles.mjs.map +1 -0
  28. package/es/BenchmarkColumnChart/index.d.mts +144 -0
  29. package/es/BenchmarkColumnChart/index.mjs +514 -0
  30. package/es/BenchmarkColumnChart/index.mjs.map +1 -0
  31. package/es/BenchmarkColumnChart/styles.d.mts +19 -0
  32. package/es/BenchmarkColumnChart/styles.mjs +129 -0
  33. package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
  34. package/es/BenchmarkRankingChart/index.d.mts +91 -0
  35. package/es/BenchmarkRankingChart/index.mjs +347 -0
  36. package/es/BenchmarkRankingChart/index.mjs.map +1 -0
  37. package/es/BenchmarkRankingChart/styles.d.mts +36 -0
  38. package/es/BenchmarkRankingChart/styles.mjs +265 -0
  39. package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
  40. package/es/BenchmarkScatterChart/index.d.mts +148 -0
  41. package/es/BenchmarkScatterChart/index.mjs +668 -0
  42. package/es/BenchmarkScatterChart/index.mjs.map +1 -0
  43. package/es/BenchmarkScatterChart/styles.d.mts +28 -0
  44. package/es/BenchmarkScatterChart/styles.mjs +193 -0
  45. package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
  46. package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
  47. package/es/BenchmarkScatterChart/utils.mjs +214 -0
  48. package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
  49. package/es/ComposedChart/index.d.mts +6 -0
  50. package/es/ComposedChart/index.mjs +254 -0
  51. package/es/ComposedChart/index.mjs.map +1 -0
  52. package/es/ComposedChart/styles.d.mts +9 -0
  53. package/es/ComposedChart/styles.mjs +28 -0
  54. package/es/ComposedChart/styles.mjs.map +1 -0
  55. package/es/ComposedChart/types.d.mts +71 -0
  56. package/es/ComposedChart/types.mjs +0 -0
  57. package/es/DataBars/CategoryBar.d.mts +17 -0
  58. package/es/DataBars/CategoryBar.mjs +146 -0
  59. package/es/DataBars/CategoryBar.mjs.map +1 -0
  60. package/es/DataBars/DeltaBar.d.mts +16 -0
  61. package/es/DataBars/DeltaBar.mjs +102 -0
  62. package/es/DataBars/DeltaBar.mjs.map +1 -0
  63. package/es/DataBars/MarkerBar.d.mts +19 -0
  64. package/es/DataBars/MarkerBar.mjs +74 -0
  65. package/es/DataBars/MarkerBar.mjs.map +1 -0
  66. package/es/DataBars/ProgressBar.d.mts +15 -0
  67. package/es/DataBars/ProgressBar.mjs +53 -0
  68. package/es/DataBars/ProgressBar.mjs.map +1 -0
  69. package/es/DataBars/index.d.mts +5 -0
  70. package/es/DataBars/index.mjs +5 -0
  71. package/es/DataBars/styles.d.mts +10 -0
  72. package/es/DataBars/styles.mjs +31 -0
  73. package/es/DataBars/styles.mjs.map +1 -0
  74. package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
  75. package/es/DonutChart/DonutChartTooltip.mjs +25 -0
  76. package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
  77. package/es/DonutChart/index.d.mts +33 -0
  78. package/es/DonutChart/index.mjs +160 -0
  79. package/es/DonutChart/index.mjs.map +1 -0
  80. package/es/DonutChart/inputParser.d.mts +5 -0
  81. package/es/DonutChart/inputParser.mjs +8 -0
  82. package/es/DonutChart/inputParser.mjs.map +1 -0
  83. package/es/DonutChart/renderInactiveShape.d.mts +4 -0
  84. package/es/DonutChart/renderInactiveShape.mjs +22 -0
  85. package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
  86. package/es/DonutChart/styles.d.mts +9 -0
  87. package/es/DonutChart/styles.mjs +28 -0
  88. package/es/DonutChart/styles.mjs.map +1 -0
  89. package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
  90. package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
  91. package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
  92. package/es/FunnelChart/index.d.mts +21 -0
  93. package/es/FunnelChart/index.mjs +421 -0
  94. package/es/FunnelChart/index.mjs.map +1 -0
  95. package/es/FunnelChart/styles.d.mts +9 -0
  96. package/es/FunnelChart/styles.mjs +28 -0
  97. package/es/FunnelChart/styles.mjs.map +1 -0
  98. package/es/FunnelChart/types.d.mts +31 -0
  99. package/es/FunnelChart/types.mjs +0 -0
  100. package/es/Heatmaps/Calendar.d.mts +21 -0
  101. package/es/Heatmaps/Calendar.mjs +108 -0
  102. package/es/Heatmaps/Calendar.mjs.map +1 -0
  103. package/es/Heatmaps/ChartLabels.d.mts +17 -0
  104. package/es/Heatmaps/ChartLabels.mjs +84 -0
  105. package/es/Heatmaps/ChartLabels.mjs.map +1 -0
  106. package/es/Heatmaps/Footer.d.mts +24 -0
  107. package/es/Heatmaps/Footer.mjs +81 -0
  108. package/es/Heatmaps/Footer.mjs.map +1 -0
  109. package/es/Heatmaps/index.d.mts +31 -0
  110. package/es/Heatmaps/index.mjs +188 -0
  111. package/es/Heatmaps/index.mjs.map +1 -0
  112. package/es/Heatmaps/styles.d.mts +10 -0
  113. package/es/Heatmaps/styles.mjs +47 -0
  114. package/es/Heatmaps/styles.mjs.map +1 -0
  115. package/es/Legend/LegendItem.d.mts +12 -0
  116. package/es/Legend/LegendItem.mjs +65 -0
  117. package/es/Legend/LegendItem.mjs.map +1 -0
  118. package/es/Legend/ScrollButton.d.mts +11 -0
  119. package/es/Legend/ScrollButton.mjs +50 -0
  120. package/es/Legend/ScrollButton.mjs.map +1 -0
  121. package/es/Legend/index.d.mts +16 -0
  122. package/es/Legend/index.mjs +152 -0
  123. package/es/Legend/index.mjs.map +1 -0
  124. package/es/LineChart/index.d.mts +11 -0
  125. package/es/LineChart/index.mjs +271 -0
  126. package/es/LineChart/index.mjs.map +1 -0
  127. package/es/LineChart/styles.d.mts +9 -0
  128. package/es/LineChart/styles.mjs +28 -0
  129. package/es/LineChart/styles.mjs.map +1 -0
  130. package/es/RadarChart/index.d.mts +27 -0
  131. package/es/RadarChart/index.mjs +157 -0
  132. package/es/RadarChart/index.mjs.map +1 -0
  133. package/es/RadarChart/styles.d.mts +8 -0
  134. package/es/RadarChart/styles.mjs +23 -0
  135. package/es/RadarChart/styles.mjs.map +1 -0
  136. package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
  137. package/es/ScatterChart/ScatterChartTooltip.mjs +52 -0
  138. package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
  139. package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
  140. package/es/ScatterChart/ScatterChartTooltipRow.mjs +36 -0
  141. package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
  142. package/es/ScatterChart/index.d.mts +58 -0
  143. package/es/ScatterChart/index.mjs +241 -0
  144. package/es/ScatterChart/index.mjs.map +1 -0
  145. package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
  146. package/es/ScatterChart/renderShape.mjs +18 -0
  147. package/es/ScatterChart/renderShape.mjs.map +1 -0
  148. package/es/ScatterChart/styles.d.mts +9 -0
  149. package/es/ScatterChart/styles.mjs +28 -0
  150. package/es/ScatterChart/styles.mjs.map +1 -0
  151. package/es/SparkChart/SparkAreaChart.d.mts +14 -0
  152. package/es/SparkChart/SparkAreaChart.mjs +109 -0
  153. package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
  154. package/es/SparkChart/SparkBarChart.d.mts +11 -0
  155. package/es/SparkChart/SparkBarChart.mjs +69 -0
  156. package/es/SparkChart/SparkBarChart.mjs.map +1 -0
  157. package/es/SparkChart/SparkLineChart.d.mts +12 -0
  158. package/es/SparkChart/SparkLineChart.mjs +73 -0
  159. package/es/SparkChart/SparkLineChart.mjs.map +1 -0
  160. package/es/SparkChart/index.d.mts +4 -0
  161. package/es/SparkChart/index.mjs +4 -0
  162. package/es/Tracker/TrackerBlock.d.mts +11 -0
  163. package/es/Tracker/TrackerBlock.mjs +52 -0
  164. package/es/Tracker/TrackerBlock.mjs.map +1 -0
  165. package/es/Tracker/index.d.mts +21 -0
  166. package/es/Tracker/index.mjs +69 -0
  167. package/es/Tracker/index.mjs.map +1 -0
  168. package/es/Tracker/styles.d.mts +8 -0
  169. package/es/Tracker/styles.mjs +24 -0
  170. package/es/Tracker/styles.mjs.map +1 -0
  171. package/es/common/BaseAnimationTimingProps.d.mts +10 -0
  172. package/es/common/BaseAnimationTimingProps.mjs +0 -0
  173. package/es/common/BaseChartProps.d.mts +61 -0
  174. package/es/common/BaseChartProps.mjs +0 -0
  175. package/es/common/BaseSparkChartProps.d.mts +17 -0
  176. package/es/common/BaseSparkChartProps.mjs +0 -0
  177. package/es/common/ChartLegend.d.mts +8 -0
  178. package/es/common/ChartLegend.mjs +32 -0
  179. package/es/common/ChartLegend.mjs.map +1 -0
  180. package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
  181. package/es/common/ChartTooltip/ChartTooltipFrame.mjs +27 -0
  182. package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
  183. package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
  184. package/es/common/ChartTooltip/ChartTooltipRow.mjs +51 -0
  185. package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
  186. package/es/common/ChartTooltip/index.d.mts +18 -0
  187. package/es/common/ChartTooltip/index.mjs +50 -0
  188. package/es/common/ChartTooltip/index.mjs.map +1 -0
  189. package/es/common/CustomTooltipProps.d.mts +15 -0
  190. package/es/common/CustomTooltipProps.mjs +0 -0
  191. package/es/common/CustomYAxisTick.d.mts +18 -0
  192. package/es/common/CustomYAxisTick.mjs +24 -0
  193. package/es/common/CustomYAxisTick.mjs.map +1 -0
  194. package/es/common/NoData.d.mts +13 -0
  195. package/es/common/NoData.mjs +25 -0
  196. package/es/common/NoData.mjs.map +1 -0
  197. package/es/common/benchmark/index.d.mts +3 -0
  198. package/es/common/benchmark/{index.js → index.mjs} +1 -1
  199. package/es/common/benchmark/types.d.mts +125 -0
  200. package/es/common/benchmark/types.mjs +0 -0
  201. package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
  202. package/es/common/benchmark/utils.mjs +115 -0
  203. package/es/common/benchmark/utils.mjs.map +1 -0
  204. package/es/common/{utils.d.ts → utils.d.mts} +3 -0
  205. package/es/common/utils.mjs +36 -0
  206. package/es/common/utils.mjs.map +1 -0
  207. package/es/hooks/useOnWindowResize.d.mts +6 -0
  208. package/es/hooks/useOnWindowResize.mjs +18 -0
  209. package/es/hooks/useOnWindowResize.mjs.map +1 -0
  210. package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
  211. package/es/hooks/usePrefersReducedMotion.mjs +24 -0
  212. package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
  213. package/es/hooks/useThemeColorRange.d.mts +4 -0
  214. package/es/hooks/useThemeColorRange.mjs +28 -0
  215. package/es/hooks/useThemeColorRange.mjs.map +1 -0
  216. package/es/index.d.mts +34 -0
  217. package/es/index.mjs +28 -0
  218. package/es/types/{charts.d.ts → charts.d.mts} +26 -26
  219. package/es/types/charts.mjs +12 -0
  220. package/es/types/charts.mjs.map +1 -0
  221. package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
  222. package/es/utils/calendar.mjs +154 -0
  223. package/es/utils/calendar.mjs.map +1 -0
  224. package/es/utils/getMaxLabelLength.d.mts +13 -0
  225. package/es/utils/getMaxLabelLength.mjs +48 -0
  226. package/es/utils/getMaxLabelLength.mjs.map +1 -0
  227. package/es/utils/{index.d.ts → index.d.mts} +4 -1
  228. package/es/utils/index.mjs +19 -0
  229. package/es/utils/index.mjs.map +1 -0
  230. package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
  231. package/es/utils/theme.mjs +33 -0
  232. package/es/utils/theme.mjs.map +1 -0
  233. package/package.json +23 -5
  234. package/es/AccuracyBarChart/index.d.ts +0 -60
  235. package/es/AccuracyBarChart/index.js +0 -454
  236. package/es/AccuracyBarChart/index.mdx +0 -52
  237. package/es/AccuracyBarChart/styles.d.ts +0 -11
  238. package/es/AccuracyBarChart/styles.js +0 -18
  239. package/es/AreaChart/index.d.ts +0 -11
  240. package/es/AreaChart/index.js +0 -430
  241. package/es/AreaChart/index.mdx +0 -49
  242. package/es/AreaChart/styles.d.ts +0 -6
  243. package/es/AreaChart/styles.js +0 -13
  244. package/es/BarChart/index.d.ts +0 -9
  245. package/es/BarChart/index.js +0 -392
  246. package/es/BarChart/index.mdx +0 -73
  247. package/es/BarChart/renderShape.js +0 -34
  248. package/es/BarChart/styles.d.ts +0 -6
  249. package/es/BarChart/styles.js +0 -13
  250. package/es/BarList/index.d.ts +0 -29
  251. package/es/BarList/index.js +0 -174
  252. package/es/BarList/index.mdx +0 -34
  253. package/es/BarList/styles.d.ts +0 -10
  254. package/es/BarList/styles.js +0 -18
  255. package/es/BenchmarkColumnChart/index.d.ts +0 -140
  256. package/es/BenchmarkColumnChart/index.js +0 -686
  257. package/es/BenchmarkColumnChart/index.mdx +0 -66
  258. package/es/BenchmarkColumnChart/styles.d.ts +0 -16
  259. package/es/BenchmarkColumnChart/styles.js +0 -23
  260. package/es/BenchmarkRankingChart/index.d.ts +0 -87
  261. package/es/BenchmarkRankingChart/index.js +0 -448
  262. package/es/BenchmarkRankingChart/index.mdx +0 -59
  263. package/es/BenchmarkRankingChart/styles.d.ts +0 -33
  264. package/es/BenchmarkRankingChart/styles.js +0 -41
  265. package/es/BenchmarkScatterChart/index.d.ts +0 -145
  266. package/es/BenchmarkScatterChart/index.js +0 -850
  267. package/es/BenchmarkScatterChart/index.mdx +0 -61
  268. package/es/BenchmarkScatterChart/styles.d.ts +0 -25
  269. package/es/BenchmarkScatterChart/styles.js +0 -33
  270. package/es/BenchmarkScatterChart/utils.js +0 -353
  271. package/es/ComposedChart/index.d.ts +0 -5
  272. package/es/ComposedChart/index.js +0 -335
  273. package/es/ComposedChart/index.mdx +0 -43
  274. package/es/ComposedChart/styles.d.ts +0 -6
  275. package/es/ComposedChart/styles.js +0 -13
  276. package/es/ComposedChart/types.d.ts +0 -68
  277. package/es/ComposedChart/types.js +0 -1
  278. package/es/DataBars/CategoryBar.d.ts +0 -15
  279. package/es/DataBars/CategoryBar.js +0 -200
  280. package/es/DataBars/DeltaBar.d.ts +0 -13
  281. package/es/DataBars/DeltaBar.js +0 -116
  282. package/es/DataBars/MarkerBar.d.ts +0 -16
  283. package/es/DataBars/MarkerBar.js +0 -93
  284. package/es/DataBars/ProgressBar.d.ts +0 -12
  285. package/es/DataBars/ProgressBar.js +0 -70
  286. package/es/DataBars/index.d.ts +0 -4
  287. package/es/DataBars/index.js +0 -4
  288. package/es/DataBars/index.mdx +0 -36
  289. package/es/DataBars/styles.d.ts +0 -7
  290. package/es/DataBars/styles.js +0 -14
  291. package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
  292. package/es/DonutChart/DonutChartTooltip.js +0 -26
  293. package/es/DonutChart/index.d.ts +0 -31
  294. package/es/DonutChart/index.js +0 -232
  295. package/es/DonutChart/index.mdx +0 -48
  296. package/es/DonutChart/inputParser.d.ts +0 -2
  297. package/es/DonutChart/inputParser.js +0 -9
  298. package/es/DonutChart/renderInactiveShape.d.ts +0 -2
  299. package/es/DonutChart/renderInactiveShape.js +0 -27
  300. package/es/DonutChart/styles.d.ts +0 -6
  301. package/es/DonutChart/styles.js +0 -13
  302. package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
  303. package/es/FunnelChart/ArrowRightIcon.js +0 -22
  304. package/es/FunnelChart/index.d.ts +0 -19
  305. package/es/FunnelChart/index.js +0 -499
  306. package/es/FunnelChart/index.mdx +0 -21
  307. package/es/FunnelChart/styles.d.ts +0 -6
  308. package/es/FunnelChart/styles.js +0 -13
  309. package/es/FunnelChart/types.d.ts +0 -28
  310. package/es/FunnelChart/types.js +0 -1
  311. package/es/Heatmaps/Calendar.d.ts +0 -18
  312. package/es/Heatmaps/Calendar.js +0 -155
  313. package/es/Heatmaps/ChartLabels.d.ts +0 -15
  314. package/es/Heatmaps/ChartLabels.js +0 -106
  315. package/es/Heatmaps/Footer.d.ts +0 -22
  316. package/es/Heatmaps/Footer.js +0 -105
  317. package/es/Heatmaps/index.d.ts +0 -28
  318. package/es/Heatmaps/index.js +0 -226
  319. package/es/Heatmaps/index.mdx +0 -70
  320. package/es/Heatmaps/styles.d.ts +0 -7
  321. package/es/Heatmaps/styles.js +0 -14
  322. package/es/Legend/LegendItem.d.ts +0 -10
  323. package/es/Legend/LegendItem.js +0 -58
  324. package/es/Legend/ScrollButton.d.ts +0 -9
  325. package/es/Legend/ScrollButton.js +0 -63
  326. package/es/Legend/index.d.ts +0 -14
  327. package/es/Legend/index.js +0 -184
  328. package/es/Legend/index.mdx +0 -13
  329. package/es/LineChart/index.d.ts +0 -9
  330. package/es/LineChart/index.js +0 -388
  331. package/es/LineChart/index.mdx +0 -49
  332. package/es/LineChart/styles.d.ts +0 -6
  333. package/es/LineChart/styles.js +0 -13
  334. package/es/RadarChart/index.d.ts +0 -24
  335. package/es/RadarChart/index.js +0 -254
  336. package/es/RadarChart/index.mdx +0 -52
  337. package/es/RadarChart/styles.d.ts +0 -5
  338. package/es/RadarChart/styles.js +0 -12
  339. package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
  340. package/es/ScatterChart/ScatterChartTooltip.js +0 -76
  341. package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
  342. package/es/ScatterChart/ScatterChartTooltipRow.js +0 -40
  343. package/es/ScatterChart/index.d.ts +0 -56
  344. package/es/ScatterChart/index.js +0 -342
  345. package/es/ScatterChart/index.mdx +0 -49
  346. package/es/ScatterChart/renderShape.js +0 -18
  347. package/es/ScatterChart/styles.d.ts +0 -6
  348. package/es/ScatterChart/styles.js +0 -13
  349. package/es/SparkChart/SparkAreaChart.d.ts +0 -12
  350. package/es/SparkChart/SparkAreaChart.js +0 -148
  351. package/es/SparkChart/SparkBarChart.d.ts +0 -9
  352. package/es/SparkChart/SparkBarChart.js +0 -106
  353. package/es/SparkChart/SparkLineChart.d.ts +0 -10
  354. package/es/SparkChart/SparkLineChart.js +0 -110
  355. package/es/SparkChart/index.d.ts +0 -3
  356. package/es/SparkChart/index.js +0 -3
  357. package/es/SparkChart/index.mdx +0 -29
  358. package/es/Tracker/TrackerBlock.d.ts +0 -8
  359. package/es/Tracker/TrackerBlock.js +0 -63
  360. package/es/Tracker/index.d.ts +0 -18
  361. package/es/Tracker/index.js +0 -104
  362. package/es/Tracker/index.mdx +0 -41
  363. package/es/Tracker/styles.d.ts +0 -5
  364. package/es/Tracker/styles.js +0 -12
  365. package/es/common/BaseAnimationTimingProps.d.ts +0 -7
  366. package/es/common/BaseAnimationTimingProps.js +0 -1
  367. package/es/common/BaseChartProps.d.ts +0 -58
  368. package/es/common/BaseChartProps.js +0 -1
  369. package/es/common/BaseSparkChartProps.d.ts +0 -14
  370. package/es/common/BaseSparkChartProps.js +0 -1
  371. package/es/common/ChartLegend.d.ts +0 -5
  372. package/es/common/ChartLegend.js +0 -40
  373. package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
  374. package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -32
  375. package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
  376. package/es/common/ChartTooltip/ChartTooltipRow.js +0 -55
  377. package/es/common/ChartTooltip/index.d.ts +0 -15
  378. package/es/common/ChartTooltip/index.js +0 -66
  379. package/es/common/CustomTooltipProps.d.ts +0 -12
  380. package/es/common/CustomTooltipProps.js +0 -1
  381. package/es/common/CustomYAxisTick.d.ts +0 -15
  382. package/es/common/CustomYAxisTick.js +0 -27
  383. package/es/common/NoData.d.ts +0 -10
  384. package/es/common/NoData.js +0 -41
  385. package/es/common/benchmark/index.d.ts +0 -2
  386. package/es/common/benchmark/types.d.ts +0 -122
  387. package/es/common/benchmark/types.js +0 -1
  388. package/es/common/benchmark/utils.js +0 -159
  389. package/es/common/utils.js +0 -85
  390. package/es/hooks/useOnWindowResize.d.ts +0 -3
  391. package/es/hooks/useOnWindowResize.js +0 -15
  392. package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
  393. package/es/hooks/usePrefersReducedMotion.js +0 -28
  394. package/es/hooks/useThemeColorRange.d.ts +0 -1
  395. package/es/hooks/useThemeColorRange.js +0 -8
  396. package/es/index.d.ts +0 -24
  397. package/es/index.js +0 -22
  398. package/es/types/charts.js +0 -8
  399. package/es/types/global.d.ts +0 -9
  400. package/es/utils/calendar.js +0 -199
  401. package/es/utils/getMaxLabelLength.d.ts +0 -10
  402. package/es/utils/getMaxLabelLength.js +0 -110
  403. package/es/utils/index.js +0 -32
  404. package/es/utils/theme.js +0 -40
@@ -1,850 +0,0 @@
1
- 'use client';
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- var _excluded = ["data", "index", "valueKey", "providerKey", "iconKey", "colorKey", "errorKey", "renderIcon", "valueFormatter", "accuracyFormatter", "errorFormatter", "showError", "showErrorBars", "showAnimation", "onValueChange", "className", "style", "loading", "width", "height", "noDataText", "highlightColor", "frontierColor", "frontierWidth", "iconSize", "markerSize", "labelFontSize", "valueLabelFontSize", "metrics", "metric", "defaultMetric", "onMetricChange", "minX", "maxX", "minY", "maxY", "showDominatedArea", "showFrontier", "showGridLines", "showLabels", "showLegend", "showTooltip", "showValueLabel", "showXAxis", "showYAxis", "xAxisLabel", "xDirection", "xFormatter", "xKey", "xScale", "yAxisLabel"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
11
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
15
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
19
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
22
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
- import { A, Skeleton } from '@lobehub/ui';
24
- import { useSize } from 'ahooks';
25
- import { Segmented, Tooltip } from 'antd';
26
- import { cssVar, cx, useTheme } from 'antd-style';
27
- import { forwardRef, useMemo, useRef, useState } from 'react';
28
- import ChartTooltip from "../common/ChartTooltip";
29
- import NoData from "../common/NoData";
30
- import { defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, normalizeBenchmarkData } from "../common/benchmark";
31
- import { constructCategoryColors } from "../common/utils";
32
- import { useThemeColorRange } from "../hooks/useThemeColorRange";
33
- import { getTextWidth } from "../utils/getMaxLabelLength";
34
- import { styles } from "./styles";
35
- import { createScale, getParetoFrontier, placeLabels } from "./utils";
36
- import { jsx as _jsx } from "react/jsx-runtime";
37
- import { jsxs as _jsxs } from "react/jsx-runtime";
38
- import { Fragment as _Fragment } from "react/jsx-runtime";
39
- var labelPriority = function labelPriority(point, frontierKeys) {
40
- return (frontierKeys.has(point.key) ? 0 : 2) + (point.item.highlighted ? 0 : 1);
41
- };
42
- var MARGIN_TOP = 12;
43
- var MARGIN_RIGHT = 16;
44
- var TICK_GAP = 8;
45
- var AXIS_TITLE_SIZE = 22;
46
- // Monospace glyph advance relative to font size (Geist Mono / SF Mono ≈ 0.6em)
47
- var MONO_CHAR_RATIO = 0.62;
48
- var renderShape = function renderShape(shape, color, size) {
49
- var ring = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
50
- var half = size / 2;
51
- var node;
52
- switch (shape) {
53
- case 'square':
54
- {
55
- node = /*#__PURE__*/_jsx("rect", {
56
- fill: color,
57
- height: size * 0.84,
58
- width: size * 0.84,
59
- x: size * 0.08,
60
- y: size * 0.08
61
- });
62
- break;
63
- }
64
- case 'diamond':
65
- {
66
- node = /*#__PURE__*/_jsx("path", {
67
- d: "M".concat(half, ",0 L").concat(size, ",").concat(half, " L").concat(half, ",").concat(size, " L0,").concat(half, " Z"),
68
- fill: color
69
- });
70
- break;
71
- }
72
- case 'triangle':
73
- {
74
- node = /*#__PURE__*/_jsx("path", {
75
- d: "M".concat(half, ",0 L").concat(size, ",").concat(size * 0.9, " L0,").concat(size * 0.9, " Z"),
76
- fill: color
77
- });
78
- break;
79
- }
80
- default:
81
- {
82
- node = /*#__PURE__*/_jsx("circle", {
83
- cx: half,
84
- cy: half,
85
- fill: color,
86
- r: half
87
- });
88
- }
89
- }
90
- return /*#__PURE__*/_jsx("svg", {
91
- height: size,
92
- style: {
93
- display: 'block',
94
- overflow: 'visible'
95
- },
96
- width: size,
97
- children: ring ? /*#__PURE__*/_jsx("g", {
98
- paintOrder: "stroke",
99
- stroke: cssVar.colorBgContainer,
100
- strokeWidth: 4,
101
- children: node
102
- }) : node
103
- });
104
- };
105
- var toLabelText = function toLabelText(name) {
106
- return String(name !== null && name !== void 0 ? name : '').replaceAll('\n', ' ');
107
- };
108
- var BenchmarkScatterChart = /*#__PURE__*/forwardRef(function (props, ref) {
109
- var _metrics$length;
110
- var theme = useTheme();
111
- var themeColorRange = useThemeColorRange();
112
- var _props$data = props.data,
113
- data = _props$data === void 0 ? [] : _props$data,
114
- index = props.index,
115
- valueKey = props.valueKey,
116
- providerKey = props.providerKey,
117
- iconKey = props.iconKey,
118
- colorKey = props.colorKey,
119
- errorKey = props.errorKey,
120
- renderIcon = props.renderIcon,
121
- _props$valueFormatter = props.valueFormatter,
122
- valueFormatter = _props$valueFormatter === void 0 ? defaultBenchmarkValueFormatter : _props$valueFormatter,
123
- accuracyFormatter = props.accuracyFormatter,
124
- _props$errorFormatter = props.errorFormatter,
125
- errorFormatter = _props$errorFormatter === void 0 ? defaultBenchmarkErrorFormatter : _props$errorFormatter,
126
- _props$showError = props.showError,
127
- showError = _props$showError === void 0 ? true : _props$showError,
128
- _props$showErrorBars = props.showErrorBars,
129
- showErrorBars = _props$showErrorBars === void 0 ? true : _props$showErrorBars,
130
- _props$showAnimation = props.showAnimation,
131
- showAnimation = _props$showAnimation === void 0 ? false : _props$showAnimation,
132
- onValueChange = props.onValueChange,
133
- className = props.className,
134
- style = props.style,
135
- loading = props.loading,
136
- _props$width = props.width,
137
- width = _props$width === void 0 ? '100%' : _props$width,
138
- _props$height = props.height,
139
- height = _props$height === void 0 ? 420 : _props$height,
140
- noDataText = props.noDataText,
141
- highlightColor = props.highlightColor,
142
- frontierColor = props.frontierColor,
143
- _props$frontierWidth = props.frontierWidth,
144
- frontierWidth = _props$frontierWidth === void 0 ? 2 : _props$frontierWidth,
145
- _props$iconSize = props.iconSize,
146
- iconSize = _props$iconSize === void 0 ? 20 : _props$iconSize,
147
- _props$markerSize = props.markerSize,
148
- markerSize = _props$markerSize === void 0 ? 12 : _props$markerSize,
149
- _props$labelFontSize = props.labelFontSize,
150
- labelFontSize = _props$labelFontSize === void 0 ? 12 : _props$labelFontSize,
151
- _props$valueLabelFont = props.valueLabelFontSize,
152
- valueLabelFontSize = _props$valueLabelFont === void 0 ? 11 : _props$valueLabelFont,
153
- metrics = props.metrics,
154
- metric = props.metric,
155
- defaultMetric = props.defaultMetric,
156
- onMetricChange = props.onMetricChange,
157
- minX = props.minX,
158
- maxX = props.maxX,
159
- minY = props.minY,
160
- maxY = props.maxY,
161
- _props$showDominatedA = props.showDominatedArea,
162
- showDominatedArea = _props$showDominatedA === void 0 ? true : _props$showDominatedA,
163
- _props$showFrontier = props.showFrontier,
164
- showFrontier = _props$showFrontier === void 0 ? true : _props$showFrontier,
165
- _props$showGridLines = props.showGridLines,
166
- showGridLines = _props$showGridLines === void 0 ? true : _props$showGridLines,
167
- _props$showLabels = props.showLabels,
168
- showLabels = _props$showLabels === void 0 ? true : _props$showLabels,
169
- _props$showLegend = props.showLegend,
170
- showLegend = _props$showLegend === void 0 ? true : _props$showLegend,
171
- _props$showTooltip = props.showTooltip,
172
- showTooltip = _props$showTooltip === void 0 ? true : _props$showTooltip,
173
- _props$showValueLabel = props.showValueLabel,
174
- showValueLabel = _props$showValueLabel === void 0 ? true : _props$showValueLabel,
175
- _props$showXAxis = props.showXAxis,
176
- showXAxis = _props$showXAxis === void 0 ? true : _props$showXAxis,
177
- _props$showYAxis = props.showYAxis,
178
- showYAxis = _props$showYAxis === void 0 ? true : _props$showYAxis,
179
- xAxisLabel = props.xAxisLabel,
180
- _props$xDirection = props.xDirection,
181
- xDirection = _props$xDirection === void 0 ? 'lower' : _props$xDirection,
182
- _props$xFormatter = props.xFormatter,
183
- xFormatter = _props$xFormatter === void 0 ? defaultBenchmarkValueFormatter : _props$xFormatter,
184
- _props$xKey = props.xKey,
185
- xKey = _props$xKey === void 0 ? 'x' : _props$xKey,
186
- _props$xScale = props.xScale,
187
- xScale = _props$xScale === void 0 ? 'linear' : _props$xScale,
188
- yAxisLabel = props.yAxisLabel,
189
- rest = _objectWithoutProperties(props, _excluded);
190
- var plotRef = useRef(null);
191
- var size = useSize(plotRef);
192
- var _useState = useState(defaultMetric),
193
- _useState2 = _slicedToArray(_useState, 2),
194
- innerMetric = _useState2[0],
195
- setInnerMetric = _useState2[1];
196
- var _useState3 = useState(),
197
- _useState4 = _slicedToArray(_useState3, 2),
198
- hoverKey = _useState4[0],
199
- setHoverKey = _useState4[1];
200
- var _useState5 = useState(),
201
- _useState6 = _slicedToArray(_useState5, 2),
202
- selectedKey = _useState6[0],
203
- setSelectedKey = _useState6[1];
204
- var resolvedHighlightColor = highlightColor !== null && highlightColor !== void 0 ? highlightColor : theme.gold;
205
- var resolvedFrontierColor = frontierColor !== null && frontierColor !== void 0 ? frontierColor : theme.orange;
206
- var yFormatter = accuracyFormatter !== null && accuracyFormatter !== void 0 ? accuracyFormatter : valueFormatter;
207
- var yName = yAxisLabel || (accuracyFormatter ? 'Accuracy' : 'Score');
208
- var activeMetric = useMemo(function () {
209
- if (metrics !== null && metrics !== void 0 && metrics.length) {
210
- var _metrics$find, _found$axisLabel, _found$direction, _found$formatter, _found$max, _found$min, _found$scale;
211
- var key = metric !== null && metric !== void 0 ? metric : innerMetric;
212
- var found = (_metrics$find = metrics.find(function (m) {
213
- return m.key === key;
214
- })) !== null && _metrics$find !== void 0 ? _metrics$find : metrics[0];
215
- return {
216
- axisLabel: (_found$axisLabel = found.axisLabel) !== null && _found$axisLabel !== void 0 ? _found$axisLabel : found.label,
217
- direction: (_found$direction = found.direction) !== null && _found$direction !== void 0 ? _found$direction : 'lower',
218
- formatter: (_found$formatter = found.formatter) !== null && _found$formatter !== void 0 ? _found$formatter : defaultBenchmarkValueFormatter,
219
- key: found.key,
220
- label: found.label,
221
- max: (_found$max = found.max) !== null && _found$max !== void 0 ? _found$max : maxX,
222
- min: (_found$min = found.min) !== null && _found$min !== void 0 ? _found$min : minX,
223
- scale: (_found$scale = found.scale) !== null && _found$scale !== void 0 ? _found$scale : 'linear'
224
- };
225
- }
226
- return {
227
- axisLabel: xAxisLabel,
228
- direction: xDirection,
229
- formatter: xFormatter,
230
- key: xKey,
231
- label: xAxisLabel || 'X',
232
- max: maxX,
233
- min: minX,
234
- scale: xScale
235
- };
236
- }, [innerMetric, maxX, metric, metrics, minX, xAxisLabel, xDirection, xFormatter, xKey, xScale]);
237
- var items = useMemo(function () {
238
- return normalizeBenchmarkData({
239
- colorKey: colorKey,
240
- data: data,
241
- errorKey: errorKey,
242
- iconKey: iconKey,
243
- index: index,
244
- providerKey: providerKey,
245
- renderIcon: renderIcon,
246
- sortOrder: 'descending',
247
- valueKey: valueKey
248
- });
249
- }, [colorKey, data, errorKey, iconKey, index, providerKey, renderIcon, valueKey]);
250
- var categoryColors = useMemo(function () {
251
- return constructCategoryColors(items.map(function (item) {
252
- return String(item.key);
253
- }), themeColorRange);
254
- }, [items, themeColorRange]);
255
- var points = useMemo(function () {
256
- return items.map(function (item) {
257
- var _ref, _item$color;
258
- return {
259
- color: (_ref = (_item$color = item.color) !== null && _item$color !== void 0 ? _item$color : categoryColors.get(String(item.key))) !== null && _ref !== void 0 ? _ref : cssVar.colorPrimary,
260
- item: item,
261
- key: item.key,
262
- x: Number(item.original[activeMetric.key]),
263
- y: item.value
264
- };
265
- }).filter(function (p) {
266
- return Number.isFinite(p.x) && Number.isFinite(p.y) && (activeMetric.scale !== 'log' || p.x > 0);
267
- });
268
- }, [activeMetric.key, activeMetric.scale, categoryColors, items]);
269
- var frontier = useMemo(function () {
270
- return showFrontier ? getParetoFrontier(points, activeMetric.direction) : [];
271
- }, [activeMetric.direction, points, showFrontier]);
272
- var frontierKeys = useMemo(function () {
273
- return new Set(frontier.map(function (p) {
274
- return p.key;
275
- }));
276
- }, [frontier]);
277
- var enableErrorBars = showError && showErrorBars;
278
- var yValues = useMemo(function () {
279
- return points.flatMap(function (p) {
280
- return enableErrorBars && p.item.error ? [p.y - p.item.error, p.y + p.item.error] : [p.y];
281
- });
282
- }, [enableErrorBars, points]);
283
- var labelSizes = useMemo(function () {
284
- var map = new Map();
285
- if (!showLabels) return map;
286
- var nameScale = labelFontSize / 12 * 1.1;
287
- var _iterator = _createForOfIteratorHelper(points),
288
- _step;
289
- try {
290
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
291
- var p = _step.value;
292
- var nameWidth = getTextWidth(toLabelText(p.item.name)) * nameScale;
293
- var valueWidth = showValueLabel ? "".concat(yFormatter(p.y), " \xB7 ").concat(activeMetric.formatter(p.x)).length * valueLabelFontSize * MONO_CHAR_RATIO : 0;
294
- map.set(p.key, {
295
- height: Math.ceil(labelFontSize * 1.3 + (showValueLabel ? valueLabelFontSize * 1.3 : 0)),
296
- width: Math.ceil(Math.max(nameWidth, valueWidth)) + 2
297
- });
298
- }
299
- } catch (err) {
300
- _iterator.e(err);
301
- } finally {
302
- _iterator.f();
303
- }
304
- return map;
305
- }, [activeMetric, labelFontSize, points, showLabels, showValueLabel, valueLabelFontSize, yFormatter]);
306
- var plotWidth = (size === null || size === void 0 ? void 0 : size.width) || (typeof width === 'number' ? width : 0);
307
- var plotHeight = typeof height === 'number' ? height : 420;
308
- var layout = useMemo(function () {
309
- if (!plotWidth || !points.length) return null;
310
- var probeY = createScale({
311
- max: maxY,
312
- min: minY,
313
- range: [0, 1],
314
- values: yValues
315
- });
316
- var yTickWidth = showYAxis ? Math.max.apply(Math, _toConsumableArray(probeY.ticks.map(function (t) {
317
- return yFormatter(t).length * 12 * MONO_CHAR_RATIO;
318
- })).concat([0])) : 0;
319
- var left = (showYAxis ? yTickWidth + TICK_GAP + 4 : 4) + (yAxisLabel ? AXIS_TITLE_SIZE : 0);
320
- var bottom = (showXAxis ? 26 : 4) + (activeMetric.axisLabel ? AXIS_TITLE_SIZE : 0);
321
- var innerRight = plotWidth - MARGIN_RIGHT;
322
- var innerBottom = plotHeight - bottom;
323
- var xScaleObj = createScale({
324
- max: activeMetric.max,
325
- min: activeMetric.min,
326
- range: [left, innerRight],
327
- type: activeMetric.scale,
328
- values: points.map(function (p) {
329
- return p.x;
330
- })
331
- });
332
- var yScaleObj = createScale({
333
- max: maxY,
334
- min: minY,
335
- range: [innerBottom, MARGIN_TOP],
336
- values: yValues
337
- });
338
- var positions = new Map();
339
- var _iterator2 = _createForOfIteratorHelper(points),
340
- _step2;
341
- try {
342
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
343
- var p = _step2.value;
344
- positions.set(p.key, {
345
- px: xScaleObj.map(p.x),
346
- py: yScaleObj.map(p.y),
347
- radius: (p.item.icon ? iconSize : markerSize) / 2
348
- });
349
- }
350
- } catch (err) {
351
- _iterator2.e(err);
352
- } finally {
353
- _iterator2.f();
354
- }
355
- var frontierPath = frontier.map(function (p, i) {
356
- var pos = positions.get(p.key);
357
- return "".concat(i === 0 ? 'M' : 'L').concat(pos.px.toFixed(2), ",").concat(pos.py.toFixed(2));
358
- }).join(' ');
359
- var labels = new Map();
360
- if (showLabels) {
361
- var lineBoxes = [];
362
- for (var i = 1; i < frontier.length; i++) {
363
- var a = positions.get(frontier[i - 1].key);
364
- var b = positions.get(frontier[i].key);
365
- var steps = Math.max(1, Math.ceil(Math.hypot(b.px - a.px, b.py - a.py) / 10));
366
- for (var s = 0; s <= steps; s++) {
367
- var t = s / steps;
368
- lineBoxes.push({
369
- height: 6,
370
- width: 6,
371
- x: a.px + (b.px - a.px) * t - 3,
372
- y: a.py + (b.py - a.py) * t - 3
373
- });
374
- }
375
- }
376
- var ordered = _toConsumableArray(points).sort(function (a, b) {
377
- return labelPriority(a, frontierKeys) - labelPriority(b, frontierKeys) || b.y - a.y;
378
- });
379
- var candidates = ordered.map(function (p) {
380
- var _labelSizes$get;
381
- var pos = positions.get(p.key);
382
- var labelSize = (_labelSizes$get = labelSizes.get(p.key)) !== null && _labelSizes$get !== void 0 ? _labelSizes$get : {
383
- height: 16,
384
- width: 40
385
- };
386
- return _objectSpread(_objectSpread({}, labelSize), {}, {
387
- key: p.key
388
- }, pos);
389
- });
390
- labels = placeLabels(candidates, {
391
- height: innerBottom,
392
- width: plotWidth - left + MARGIN_RIGHT,
393
- x: left,
394
- y: 0
395
- }, {
396
- lines: lineBoxes
397
- });
398
- }
399
- return {
400
- bottom: bottom,
401
- frontierPath: frontierPath,
402
- innerBottom: innerBottom,
403
- innerRight: innerRight,
404
- labels: labels,
405
- left: left,
406
- positions: positions,
407
- xScale: xScaleObj,
408
- yScale: yScaleObj
409
- };
410
- }, [activeMetric, frontier, frontierKeys, iconSize, labelSizes, markerSize, maxY, minY, plotHeight, plotWidth, points, showLabels, showXAxis, showYAxis, yAxisLabel, yFormatter, yValues]);
411
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
412
- active: true,
413
- height: plotHeight,
414
- width: width
415
- });
416
- var focusKey = hoverKey !== null && hoverKey !== void 0 ? hoverKey : selectedKey;
417
- var focusPoint = focusKey === undefined ? undefined : points.find(function (point) {
418
- return point.key === focusKey;
419
- });
420
- var dominatedKeys = new Set();
421
- if (showDominatedArea && focusPoint) {
422
- var _iterator3 = _createForOfIteratorHelper(points),
423
- _step3;
424
- try {
425
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
426
- var point = _step3.value;
427
- if (point.key === focusPoint.key || point.y > focusPoint.y) continue;
428
- var worseX = activeMetric.direction === 'lower' ? point.x >= focusPoint.x : point.x <= focusPoint.x;
429
- if (worseX) dominatedKeys.add(point.key);
430
- }
431
- } catch (err) {
432
- _iterator3.e(err);
433
- } finally {
434
- _iterator3.f();
435
- }
436
- }
437
- var getEmphasis = function getEmphasis(key) {
438
- if (focusKey === undefined || key === focusKey) return 'normal';
439
- if (!showDominatedArea) return 'dimmed';
440
- return dominatedKeys.has(key) ? 'dominated' : 'normal';
441
- };
442
- var isDimmed = function isDimmed(key) {
443
- return getEmphasis(key) !== 'normal';
444
- };
445
- var animatedCls = showAnimation ? undefined : styles.noTransition;
446
- var handleClick = function handleClick(item) {
447
- if (!onValueChange) return;
448
- if (selectedKey === item.key) {
449
- setSelectedKey(undefined);
450
- onValueChange(null);
451
- return;
452
- }
453
- setSelectedKey(item.key);
454
- var payload = _objectSpread(_objectSpread({}, item.original), {}, {
455
- eventType: 'point',
456
- rank: item.rank,
457
- value: item.value
458
- });
459
- onValueChange(payload);
460
- };
461
- var handleMetricChange = function handleMetricChange(key) {
462
- if (metric === undefined) setInnerMetric(key);
463
- onMetricChange === null || onMetricChange === void 0 || onMetricChange(key);
464
- };
465
- var renderTooltip = function renderTooltip(point, child) {
466
- if (!showTooltip) return child;
467
- var item = point.item;
468
- var rows = [];
469
- if (metrics !== null && metrics !== void 0 && metrics.length) {
470
- var _iterator4 = _createForOfIteratorHelper(metrics),
471
- _step4;
472
- try {
473
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
474
- var _m$formatter;
475
- var m = _step4.value;
476
- var _value2 = Number(item.original[m.key]);
477
- if (!Number.isFinite(_value2)) continue;
478
- rows.push({
479
- format: (_m$formatter = m.formatter) !== null && _m$formatter !== void 0 ? _m$formatter : defaultBenchmarkValueFormatter,
480
- name: m.label,
481
- value: _value2
482
- });
483
- }
484
- } catch (err) {
485
- _iterator4.e(err);
486
- } finally {
487
- _iterator4.f();
488
- }
489
- } else {
490
- rows.push({
491
- format: activeMetric.formatter,
492
- name: activeMetric.label,
493
- value: point.x
494
- });
495
- }
496
- rows.reverse();
497
- rows.push({
498
- format: function format(v) {
499
- return showError && item.error !== undefined ? "".concat(yFormatter(v), " \xB1 ").concat(errorFormatter(item.error)) : yFormatter(v);
500
- },
501
- name: yName,
502
- value: point.y
503
- });
504
- var formatters = new Map(rows.map(function (row) {
505
- return [row.name, row.format];
506
- }));
507
- var modelName = toLabelText(item.name);
508
- return /*#__PURE__*/_jsx(Tooltip, {
509
- arrow: false,
510
- mouseEnterDelay: 0.05,
511
- mouseLeaveDelay: 0,
512
- styles: {
513
- container: {
514
- background: 'transparent',
515
- boxShadow: 'none',
516
- maxWidth: 'none',
517
- padding: 0,
518
- pointerEvents: 'none',
519
- width: 'max-content'
520
- },
521
- root: {
522
- maxWidth: 'none',
523
- pointerEvents: 'none'
524
- }
525
- },
526
- title: /*#__PURE__*/_jsx(ChartTooltip, {
527
- active: true,
528
- categoryColors: new Map(rows.map(function (row) {
529
- return [row.name, point.color];
530
- })),
531
- label: item.provider ? "".concat(modelName, " \xB7 ").concat(String(item.provider)) : modelName,
532
- payload: rows.map(function (row) {
533
- return {
534
- dataKey: row.name,
535
- name: row.name,
536
- value: row.value
537
- };
538
- }),
539
- valueFormatter: function valueFormatter(value, name) {
540
- var _formatters$get;
541
- return ((_formatters$get = formatters.get(name !== null && name !== void 0 ? name : '')) !== null && _formatters$get !== void 0 ? _formatters$get : String)(Number(value));
542
- }
543
- }),
544
- children: child
545
- });
546
- };
547
- var renderMarker = function renderMarker(point, markerSizePx) {
548
- var ring = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
549
- return point.item.icon ? /*#__PURE__*/_jsx("span", {
550
- className: ring ? styles.markerIconRing : undefined,
551
- style: {
552
- alignItems: 'center',
553
- display: 'flex',
554
- flexShrink: 0,
555
- height: iconSize,
556
- justifyContent: 'center',
557
- transform: markerSizePx === iconSize ? undefined : "scale(".concat(markerSizePx / iconSize, ")"),
558
- width: iconSize
559
- },
560
- children: point.item.icon
561
- }) : renderShape(point.item.original.shape, point.color, markerSizePx, ring);
562
- };
563
- var hasMetricSwitch = ((_metrics$length = metrics === null || metrics === void 0 ? void 0 : metrics.length) !== null && _metrics$length !== void 0 ? _metrics$length : 0) > 1;
564
- return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
565
- className: cx(styles.container, className),
566
- ref: ref,
567
- style: _objectSpread({
568
- '--benchmark-label-font-size': "".concat(labelFontSize, "px"),
569
- '--benchmark-value-label-font-size': "".concat(valueLabelFontSize, "px"),
570
- 'width': width
571
- }, style)
572
- }, rest), {}, {
573
- children: [showLegend && points.length > 0 || hasMetricSwitch ? /*#__PURE__*/_jsxs("div", {
574
- className: styles.header,
575
- children: [/*#__PURE__*/_jsx("div", {
576
- className: styles.legend,
577
- children: showLegend ? points.map(function (point) {
578
- return /*#__PURE__*/_jsxs("span", {
579
- className: styles.legendItem,
580
- onClick: function onClick() {
581
- return handleClick(point.item);
582
- },
583
- onMouseEnter: function onMouseEnter() {
584
- return setHoverKey(point.key);
585
- },
586
- onMouseLeave: function onMouseLeave() {
587
- return setHoverKey(undefined);
588
- },
589
- style: {
590
- color: point.item.highlighted ? resolvedHighlightColor : undefined,
591
- cursor: onValueChange ? 'pointer' : undefined,
592
- opacity: isDimmed(point.key) ? 0.4 : 1
593
- },
594
- children: [/*#__PURE__*/_jsx("span", {
595
- className: styles.legendMarker,
596
- children: renderMarker(point, 12)
597
- }), toLabelText(point.item.name)]
598
- }, "legend-".concat(point.key));
599
- }) : null
600
- }), hasMetricSwitch ? /*#__PURE__*/_jsx(Segmented, {
601
- onChange: function onChange(value) {
602
- return handleMetricChange(String(value));
603
- },
604
- options: metrics.map(function (m) {
605
- return {
606
- label: m.label,
607
- value: m.key
608
- };
609
- }),
610
- size: "small",
611
- value: activeMetric.key
612
- }) : null]
613
- }) : null, /*#__PURE__*/_jsxs("div", {
614
- className: styles.plot,
615
- ref: plotRef,
616
- style: {
617
- height: plotHeight
618
- },
619
- children: [!points.length ? /*#__PURE__*/_jsx(NoData, {
620
- noDataText: noDataText
621
- }) : null, layout ? /*#__PURE__*/_jsxs(_Fragment, {
622
- children: [/*#__PURE__*/_jsxs("svg", {
623
- height: plotHeight,
624
- role: "img",
625
- style: {
626
- display: 'block',
627
- overflow: 'visible'
628
- },
629
- width: plotWidth,
630
- children: [showGridLines ? /*#__PURE__*/_jsxs("g", {
631
- children: [layout.yScale.ticks.map(function (tick) {
632
- var y = layout.yScale.map(tick);
633
- return /*#__PURE__*/_jsx("line", {
634
- className: styles.gridLine,
635
- x1: layout.left,
636
- x2: layout.innerRight,
637
- y1: y,
638
- y2: y
639
- }, "gy-".concat(tick));
640
- }), layout.xScale.ticks.map(function (tick) {
641
- var x = layout.xScale.map(tick);
642
- return /*#__PURE__*/_jsx("line", {
643
- className: styles.gridLine,
644
- x1: x,
645
- x2: x,
646
- y1: MARGIN_TOP,
647
- y2: layout.innerBottom
648
- }, "gx-".concat(tick));
649
- })]
650
- }) : null, showYAxis ? /*#__PURE__*/_jsx("g", {
651
- children: layout.yScale.ticks.map(function (tick) {
652
- return /*#__PURE__*/_jsx("text", {
653
- className: styles.tickLabel,
654
- dominantBaseline: "middle",
655
- textAnchor: "end",
656
- x: layout.left - TICK_GAP,
657
- y: layout.yScale.map(tick),
658
- children: yFormatter(tick)
659
- }, "ty-".concat(tick));
660
- })
661
- }) : null, showXAxis ? /*#__PURE__*/_jsxs("g", {
662
- children: [/*#__PURE__*/_jsx("line", {
663
- className: styles.axisLine,
664
- x1: layout.left,
665
- x2: layout.innerRight,
666
- y1: layout.innerBottom,
667
- y2: layout.innerBottom
668
- }), layout.xScale.ticks.map(function (tick) {
669
- return /*#__PURE__*/_jsx("text", {
670
- className: styles.tickLabel,
671
- dominantBaseline: "hanging",
672
- textAnchor: "middle",
673
- x: layout.xScale.map(tick),
674
- y: layout.innerBottom + TICK_GAP,
675
- children: activeMetric.formatter(tick)
676
- }, "tx-".concat(tick));
677
- })]
678
- }) : null, yAxisLabel ? /*#__PURE__*/_jsx("text", {
679
- className: styles.axisLabel,
680
- dominantBaseline: "hanging",
681
- textAnchor: "middle",
682
- transform: "rotate(-90, 0, ".concat((MARGIN_TOP + layout.innerBottom) / 2, ")"),
683
- x: 0,
684
- y: (MARGIN_TOP + layout.innerBottom) / 2,
685
- children: yAxisLabel
686
- }) : null, activeMetric.axisLabel ? /*#__PURE__*/_jsx("text", {
687
- className: styles.axisLabel,
688
- dominantBaseline: "auto",
689
- textAnchor: "middle",
690
- x: (layout.left + layout.innerRight) / 2,
691
- y: plotHeight - 4,
692
- children: activeMetric.axisLabel
693
- }) : null, showDominatedArea && focusPoint ? function () {
694
- var pos = layout.positions.get(focusPoint.key);
695
- var toRight = activeMetric.direction === 'lower';
696
- var x0 = toRight ? pos.px : layout.left;
697
- var x1 = toRight ? layout.innerRight : pos.px;
698
- return /*#__PURE__*/_jsxs("g", {
699
- className: styles.dominatedArea,
700
- "data-testid": "benchmark-scatter-dominated-area",
701
- children: [/*#__PURE__*/_jsx("rect", {
702
- fill: resolvedFrontierColor,
703
- fillOpacity: 0.08,
704
- height: Math.max(0, layout.innerBottom - pos.py),
705
- width: Math.max(0, x1 - x0),
706
- x: x0,
707
- y: pos.py
708
- }), /*#__PURE__*/_jsx("line", {
709
- className: styles.dominatedGuide,
710
- x1: x0,
711
- x2: x1,
712
- y1: pos.py,
713
- y2: pos.py
714
- }), /*#__PURE__*/_jsx("line", {
715
- className: styles.dominatedGuide,
716
- x1: pos.px,
717
- x2: pos.px,
718
- y1: pos.py,
719
- y2: layout.innerBottom
720
- })]
721
- });
722
- }() : null, enableErrorBars ? points.map(function (point) {
723
- var error = point.item.error;
724
- if (!error) return null;
725
- var pos = layout.positions.get(point.key);
726
- var top = layout.yScale.map(point.y + error);
727
- var bottom = layout.yScale.map(point.y - error);
728
- return /*#__PURE__*/_jsxs("g", {
729
- className: styles.errorBar,
730
- "data-testid": "benchmark-scatter-error-bar",
731
- opacity: isDimmed(point.key) ? 0.25 : 0.7,
732
- stroke: point.color,
733
- children: [/*#__PURE__*/_jsx("line", {
734
- x1: pos.px,
735
- x2: pos.px,
736
- y1: top,
737
- y2: bottom
738
- }), /*#__PURE__*/_jsx("line", {
739
- x1: pos.px - 4,
740
- x2: pos.px + 4,
741
- y1: top,
742
- y2: top
743
- }), /*#__PURE__*/_jsx("line", {
744
- x1: pos.px - 4,
745
- x2: pos.px + 4,
746
- y1: bottom,
747
- y2: bottom
748
- })]
749
- }, "err-".concat(point.key));
750
- }) : null, layout.frontierPath ? /*#__PURE__*/_jsx("path", {
751
- className: styles.frontier,
752
- d: layout.frontierPath,
753
- "data-testid": "benchmark-scatter-frontier",
754
- opacity: !showDominatedArea && focusKey !== undefined && !frontierKeys.has(focusKey) ? 0.35 : 1,
755
- stroke: resolvedFrontierColor,
756
- strokeWidth: frontierWidth,
757
- style: showAnimation ? {
758
- transition: "d 0.4s, opacity 0.2s"
759
- } : undefined
760
- }) : null]
761
- }), /*#__PURE__*/_jsxs("div", {
762
- className: styles.overlay,
763
- children: [points.map(function (point) {
764
- var pos = layout.positions.get(point.key);
765
- var markerPx = point.item.icon ? iconSize : markerSize;
766
- return /*#__PURE__*/_jsx("div", {
767
- children: renderTooltip(point, /*#__PURE__*/_jsx("div", {
768
- "aria-label": "".concat(toLabelText(point.item.name), ": ").concat(yFormatter(point.y), ", ").concat(activeMetric.formatter(point.x)),
769
- className: cx(styles.marker, animatedCls),
770
- onClick: function onClick() {
771
- return handleClick(point.item);
772
- },
773
- onMouseEnter: function onMouseEnter() {
774
- return setHoverKey(point.key);
775
- },
776
- onMouseLeave: function onMouseLeave() {
777
- return setHoverKey(undefined);
778
- },
779
- role: "button",
780
- style: {
781
- cursor: onValueChange ? 'pointer' : 'default',
782
- filter: getEmphasis(point.key) === 'dominated' ? 'grayscale(1)' : undefined,
783
- height: markerPx,
784
- left: pos.px,
785
- opacity: {
786
- dimmed: 0.25,
787
- dominated: 0.5,
788
- normal: 1
789
- }[getEmphasis(point.key)],
790
- top: pos.py,
791
- width: markerPx
792
- },
793
- children: renderMarker(point, markerPx, true)
794
- }))
795
- }, "marker-".concat(point.key));
796
- }), showLabels ? points.map(function (point) {
797
- var label = layout.labels.get(point.key);
798
- if (!label) return null;
799
- var emphasis = getEmphasis(point.key);
800
- var textColor = emphasis === 'dominated' ? cssVar.colorTextQuaternary : point.item.highlighted ? resolvedHighlightColor : undefined;
801
- var isKeyLabel = emphasis !== 'dominated' && (frontierKeys.has(point.key) || point.item.highlighted || point.key === focusKey);
802
- var align = label.placement.endsWith('left') ? 'right' : label.placement === 'top' || label.placement === 'bottom' ? 'center' : 'left';
803
- var name = toLabelText(point.item.name);
804
- return /*#__PURE__*/_jsxs("div", {
805
- className: cx(styles.label, animatedCls),
806
- onClick: function onClick() {
807
- return handleClick(point.item);
808
- },
809
- onMouseEnter: function onMouseEnter() {
810
- return setHoverKey(point.key);
811
- },
812
- onMouseLeave: function onMouseLeave() {
813
- return setHoverKey(undefined);
814
- },
815
- style: {
816
- cursor: onValueChange ? 'pointer' : 'default',
817
- height: label.height,
818
- left: label.x,
819
- opacity: emphasis === 'dimmed' ? 0.25 : 1,
820
- textAlign: align,
821
- top: label.y,
822
- width: label.width
823
- },
824
- children: [/*#__PURE__*/_jsx("div", {
825
- className: cx(styles.labelName, isKeyLabel && styles.labelNameEmphasis),
826
- style: textColor ? {
827
- color: textColor
828
- } : undefined,
829
- children: point.item.href ? /*#__PURE__*/_jsx(A, {
830
- className: styles.labelNameLink,
831
- href: point.item.href,
832
- onClick: function onClick(event) {
833
- return event.stopPropagation();
834
- },
835
- target: point.item.target,
836
- children: name
837
- }) : name
838
- }), showValueLabel ? /*#__PURE__*/_jsxs("div", {
839
- className: styles.labelValue,
840
- children: [yFormatter(point.y), " \xB7 ", activeMetric.formatter(point.x)]
841
- }) : null]
842
- }, "label-".concat(point.key));
843
- }) : null]
844
- })]
845
- }) : null]
846
- })]
847
- }));
848
- });
849
- BenchmarkScatterChart.displayName = 'BenchmarkScatterChart';
850
- export default BenchmarkScatterChart;