@lobehub/charts 6.0.0-beta.1 → 6.0.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/README.md +83 -72
  2. package/es/AccuracyBarChart/index.d.mts +62 -0
  3. package/es/AccuracyBarChart/index.mjs +324 -0
  4. package/es/AccuracyBarChart/index.mjs.map +1 -0
  5. package/es/AccuracyBarChart/styles.d.mts +14 -0
  6. package/es/AccuracyBarChart/styles.mjs +71 -0
  7. package/es/AccuracyBarChart/styles.mjs.map +1 -0
  8. package/es/AreaChart/index.d.mts +13 -0
  9. package/es/AreaChart/index.mjs +306 -0
  10. package/es/AreaChart/index.mjs.map +1 -0
  11. package/es/AreaChart/styles.d.mts +9 -0
  12. package/es/AreaChart/styles.mjs +28 -0
  13. package/es/AreaChart/styles.mjs.map +1 -0
  14. package/es/BarChart/index.d.mts +11 -0
  15. package/es/BarChart/index.mjs +288 -0
  16. package/es/BarChart/index.mjs.map +1 -0
  17. package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
  18. package/es/BarChart/renderShape.mjs +28 -0
  19. package/es/BarChart/renderShape.mjs.map +1 -0
  20. package/es/BarChart/styles.d.mts +9 -0
  21. package/es/BarChart/styles.mjs +28 -0
  22. package/es/BarChart/styles.mjs.map +1 -0
  23. package/es/BarList/index.d.mts +32 -0
  24. package/es/BarList/index.mjs +126 -0
  25. package/es/BarList/index.mjs.map +1 -0
  26. package/es/BarList/styles.d.mts +13 -0
  27. package/es/BarList/styles.mjs +63 -0
  28. package/es/BarList/styles.mjs.map +1 -0
  29. package/es/BenchmarkColumnChart/index.d.mts +144 -0
  30. package/es/BenchmarkColumnChart/index.mjs +512 -0
  31. package/es/BenchmarkColumnChart/index.mjs.map +1 -0
  32. package/es/BenchmarkColumnChart/styles.d.mts +19 -0
  33. package/es/BenchmarkColumnChart/styles.mjs +129 -0
  34. package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
  35. package/es/BenchmarkRankingChart/index.d.mts +91 -0
  36. package/es/BenchmarkRankingChart/index.mjs +345 -0
  37. package/es/BenchmarkRankingChart/index.mjs.map +1 -0
  38. package/es/BenchmarkRankingChart/styles.d.mts +36 -0
  39. package/es/BenchmarkRankingChart/styles.mjs +265 -0
  40. package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
  41. package/es/BenchmarkScatterChart/index.d.mts +148 -0
  42. package/es/BenchmarkScatterChart/index.mjs +666 -0
  43. package/es/BenchmarkScatterChart/index.mjs.map +1 -0
  44. package/es/BenchmarkScatterChart/styles.d.mts +28 -0
  45. package/es/BenchmarkScatterChart/styles.mjs +193 -0
  46. package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
  47. package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
  48. package/es/BenchmarkScatterChart/utils.mjs +214 -0
  49. package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
  50. package/es/ComposedChart/index.d.mts +6 -0
  51. package/es/ComposedChart/index.mjs +252 -0
  52. package/es/ComposedChart/index.mjs.map +1 -0
  53. package/es/ComposedChart/styles.d.mts +9 -0
  54. package/es/ComposedChart/styles.mjs +28 -0
  55. package/es/ComposedChart/styles.mjs.map +1 -0
  56. package/es/ComposedChart/types.d.mts +71 -0
  57. package/es/ComposedChart/types.mjs +0 -0
  58. package/es/DataBars/CategoryBar.d.mts +17 -0
  59. package/es/DataBars/CategoryBar.mjs +144 -0
  60. package/es/DataBars/CategoryBar.mjs.map +1 -0
  61. package/es/DataBars/DeltaBar.d.mts +16 -0
  62. package/es/DataBars/DeltaBar.mjs +100 -0
  63. package/es/DataBars/DeltaBar.mjs.map +1 -0
  64. package/es/DataBars/MarkerBar.d.mts +19 -0
  65. package/es/DataBars/MarkerBar.mjs +72 -0
  66. package/es/DataBars/MarkerBar.mjs.map +1 -0
  67. package/es/DataBars/ProgressBar.d.mts +15 -0
  68. package/es/DataBars/ProgressBar.mjs +51 -0
  69. package/es/DataBars/ProgressBar.mjs.map +1 -0
  70. package/es/DataBars/index.d.mts +5 -0
  71. package/es/DataBars/index.mjs +5 -0
  72. package/es/DataBars/styles.d.mts +10 -0
  73. package/es/DataBars/styles.mjs +31 -0
  74. package/es/DataBars/styles.mjs.map +1 -0
  75. package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
  76. package/es/DonutChart/DonutChartTooltip.mjs +25 -0
  77. package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
  78. package/es/DonutChart/index.d.mts +33 -0
  79. package/es/DonutChart/index.mjs +158 -0
  80. package/es/DonutChart/index.mjs.map +1 -0
  81. package/es/DonutChart/inputParser.d.mts +5 -0
  82. package/es/DonutChart/inputParser.mjs +8 -0
  83. package/es/DonutChart/inputParser.mjs.map +1 -0
  84. package/es/DonutChart/renderInactiveShape.d.mts +4 -0
  85. package/es/DonutChart/renderInactiveShape.mjs +22 -0
  86. package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
  87. package/es/DonutChart/styles.d.mts +9 -0
  88. package/es/DonutChart/styles.mjs +28 -0
  89. package/es/DonutChart/styles.mjs.map +1 -0
  90. package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
  91. package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
  92. package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
  93. package/es/FunnelChart/index.d.mts +21 -0
  94. package/es/FunnelChart/index.mjs +419 -0
  95. package/es/FunnelChart/index.mjs.map +1 -0
  96. package/es/FunnelChart/styles.d.mts +9 -0
  97. package/es/FunnelChart/styles.mjs +28 -0
  98. package/es/FunnelChart/styles.mjs.map +1 -0
  99. package/es/FunnelChart/types.d.mts +31 -0
  100. package/es/FunnelChart/types.mjs +0 -0
  101. package/es/Heatmaps/Calendar.d.mts +21 -0
  102. package/es/Heatmaps/Calendar.mjs +107 -0
  103. package/es/Heatmaps/Calendar.mjs.map +1 -0
  104. package/es/Heatmaps/ChartLabels.d.mts +17 -0
  105. package/es/Heatmaps/ChartLabels.mjs +84 -0
  106. package/es/Heatmaps/ChartLabels.mjs.map +1 -0
  107. package/es/Heatmaps/Footer.d.mts +24 -0
  108. package/es/Heatmaps/Footer.mjs +81 -0
  109. package/es/Heatmaps/Footer.mjs.map +1 -0
  110. package/es/Heatmaps/index.d.mts +31 -0
  111. package/es/Heatmaps/index.mjs +186 -0
  112. package/es/Heatmaps/index.mjs.map +1 -0
  113. package/es/Heatmaps/styles.d.mts +10 -0
  114. package/es/Heatmaps/styles.mjs +47 -0
  115. package/es/Heatmaps/styles.mjs.map +1 -0
  116. package/es/Legend/LegendItem.d.mts +12 -0
  117. package/es/Legend/LegendItem.mjs +63 -0
  118. package/es/Legend/LegendItem.mjs.map +1 -0
  119. package/es/Legend/ScrollButton.d.mts +11 -0
  120. package/es/Legend/ScrollButton.mjs +49 -0
  121. package/es/Legend/ScrollButton.mjs.map +1 -0
  122. package/es/Legend/index.d.mts +16 -0
  123. package/es/Legend/index.mjs +151 -0
  124. package/es/Legend/index.mjs.map +1 -0
  125. package/es/LineChart/index.d.mts +11 -0
  126. package/es/LineChart/index.mjs +269 -0
  127. package/es/LineChart/index.mjs.map +1 -0
  128. package/es/LineChart/styles.d.mts +9 -0
  129. package/es/LineChart/styles.mjs +28 -0
  130. package/es/LineChart/styles.mjs.map +1 -0
  131. package/es/RadarChart/index.d.mts +27 -0
  132. package/es/RadarChart/index.mjs +155 -0
  133. package/es/RadarChart/index.mjs.map +1 -0
  134. package/es/RadarChart/styles.d.mts +8 -0
  135. package/es/RadarChart/styles.mjs +23 -0
  136. package/es/RadarChart/styles.mjs.map +1 -0
  137. package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
  138. package/es/ScatterChart/ScatterChartTooltip.mjs +50 -0
  139. package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
  140. package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
  141. package/es/ScatterChart/ScatterChartTooltipRow.mjs +34 -0
  142. package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
  143. package/es/ScatterChart/index.d.mts +58 -0
  144. package/es/ScatterChart/index.mjs +239 -0
  145. package/es/ScatterChart/index.mjs.map +1 -0
  146. package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
  147. package/es/ScatterChart/renderShape.mjs +18 -0
  148. package/es/ScatterChart/renderShape.mjs.map +1 -0
  149. package/es/ScatterChart/styles.d.mts +9 -0
  150. package/es/ScatterChart/styles.mjs +28 -0
  151. package/es/ScatterChart/styles.mjs.map +1 -0
  152. package/es/SparkChart/SparkAreaChart.d.mts +14 -0
  153. package/es/SparkChart/SparkAreaChart.mjs +107 -0
  154. package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
  155. package/es/SparkChart/SparkBarChart.d.mts +11 -0
  156. package/es/SparkChart/SparkBarChart.mjs +67 -0
  157. package/es/SparkChart/SparkBarChart.mjs.map +1 -0
  158. package/es/SparkChart/SparkLineChart.d.mts +12 -0
  159. package/es/SparkChart/SparkLineChart.mjs +71 -0
  160. package/es/SparkChart/SparkLineChart.mjs.map +1 -0
  161. package/es/SparkChart/index.d.mts +4 -0
  162. package/es/SparkChart/index.mjs +4 -0
  163. package/es/Tracker/TrackerBlock.d.mts +11 -0
  164. package/es/Tracker/TrackerBlock.mjs +50 -0
  165. package/es/Tracker/TrackerBlock.mjs.map +1 -0
  166. package/es/Tracker/index.d.mts +21 -0
  167. package/es/Tracker/index.mjs +67 -0
  168. package/es/Tracker/index.mjs.map +1 -0
  169. package/es/Tracker/styles.d.mts +8 -0
  170. package/es/Tracker/styles.mjs +24 -0
  171. package/es/Tracker/styles.mjs.map +1 -0
  172. package/es/common/BaseAnimationTimingProps.d.mts +10 -0
  173. package/es/common/BaseAnimationTimingProps.mjs +0 -0
  174. package/es/common/BaseChartProps.d.mts +61 -0
  175. package/es/common/BaseChartProps.mjs +0 -0
  176. package/es/common/BaseSparkChartProps.d.mts +17 -0
  177. package/es/common/BaseSparkChartProps.mjs +0 -0
  178. package/es/common/ChartLegend.d.mts +8 -0
  179. package/es/common/ChartLegend.mjs +32 -0
  180. package/es/common/ChartLegend.mjs.map +1 -0
  181. package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
  182. package/es/common/ChartTooltip/ChartTooltipFrame.mjs +26 -0
  183. package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
  184. package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
  185. package/es/common/ChartTooltip/ChartTooltipRow.mjs +49 -0
  186. package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
  187. package/es/common/ChartTooltip/index.d.mts +18 -0
  188. package/es/common/ChartTooltip/index.mjs +48 -0
  189. package/es/common/ChartTooltip/index.mjs.map +1 -0
  190. package/es/common/CustomTooltipProps.d.mts +15 -0
  191. package/es/common/CustomTooltipProps.mjs +0 -0
  192. package/es/common/CustomYAxisTick.d.mts +18 -0
  193. package/es/common/CustomYAxisTick.mjs +24 -0
  194. package/es/common/CustomYAxisTick.mjs.map +1 -0
  195. package/es/common/NoData.d.mts +13 -0
  196. package/es/common/NoData.mjs +25 -0
  197. package/es/common/NoData.mjs.map +1 -0
  198. package/es/common/benchmark/index.d.mts +3 -0
  199. package/es/common/benchmark/{index.js → index.mjs} +1 -1
  200. package/es/common/benchmark/types.d.mts +125 -0
  201. package/es/common/benchmark/types.mjs +0 -0
  202. package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
  203. package/es/common/benchmark/utils.mjs +115 -0
  204. package/es/common/benchmark/utils.mjs.map +1 -0
  205. package/es/common/{utils.d.ts → utils.d.mts} +3 -0
  206. package/es/common/utils.mjs +36 -0
  207. package/es/common/utils.mjs.map +1 -0
  208. package/es/hooks/useOnWindowResize.d.mts +6 -0
  209. package/es/hooks/useOnWindowResize.mjs +18 -0
  210. package/es/hooks/useOnWindowResize.mjs.map +1 -0
  211. package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
  212. package/es/hooks/usePrefersReducedMotion.mjs +24 -0
  213. package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
  214. package/es/hooks/useThemeColorRange.d.mts +4 -0
  215. package/es/hooks/useThemeColorRange.mjs +28 -0
  216. package/es/hooks/useThemeColorRange.mjs.map +1 -0
  217. package/es/index.d.mts +34 -0
  218. package/es/index.mjs +28 -0
  219. package/es/types/{charts.d.ts → charts.d.mts} +26 -26
  220. package/es/types/charts.mjs +12 -0
  221. package/es/types/charts.mjs.map +1 -0
  222. package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
  223. package/es/utils/calendar.mjs +154 -0
  224. package/es/utils/calendar.mjs.map +1 -0
  225. package/es/utils/getMaxLabelLength.d.mts +13 -0
  226. package/es/utils/getMaxLabelLength.mjs +48 -0
  227. package/es/utils/getMaxLabelLength.mjs.map +1 -0
  228. package/es/utils/{index.d.ts → index.d.mts} +4 -1
  229. package/es/utils/index.mjs +19 -0
  230. package/es/utils/index.mjs.map +1 -0
  231. package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
  232. package/es/utils/theme.mjs +33 -0
  233. package/es/utils/theme.mjs.map +1 -0
  234. package/package.json +144 -5
  235. package/es/AccuracyBarChart/index.d.ts +0 -60
  236. package/es/AccuracyBarChart/index.js +0 -452
  237. package/es/AccuracyBarChart/index.mdx +0 -52
  238. package/es/AccuracyBarChart/styles.d.ts +0 -11
  239. package/es/AccuracyBarChart/styles.js +0 -18
  240. package/es/AreaChart/index.d.ts +0 -11
  241. package/es/AreaChart/index.js +0 -428
  242. package/es/AreaChart/index.mdx +0 -49
  243. package/es/AreaChart/styles.d.ts +0 -6
  244. package/es/AreaChart/styles.js +0 -13
  245. package/es/BarChart/index.d.ts +0 -9
  246. package/es/BarChart/index.js +0 -390
  247. package/es/BarChart/index.mdx +0 -73
  248. package/es/BarChart/renderShape.js +0 -34
  249. package/es/BarChart/styles.d.ts +0 -6
  250. package/es/BarChart/styles.js +0 -13
  251. package/es/BarList/index.d.ts +0 -29
  252. package/es/BarList/index.js +0 -172
  253. package/es/BarList/index.mdx +0 -34
  254. package/es/BarList/styles.d.ts +0 -10
  255. package/es/BarList/styles.js +0 -18
  256. package/es/BenchmarkColumnChart/index.d.ts +0 -140
  257. package/es/BenchmarkColumnChart/index.js +0 -684
  258. package/es/BenchmarkColumnChart/index.mdx +0 -66
  259. package/es/BenchmarkColumnChart/styles.d.ts +0 -16
  260. package/es/BenchmarkColumnChart/styles.js +0 -23
  261. package/es/BenchmarkRankingChart/index.d.ts +0 -87
  262. package/es/BenchmarkRankingChart/index.js +0 -453
  263. package/es/BenchmarkRankingChart/index.mdx +0 -59
  264. package/es/BenchmarkRankingChart/styles.d.ts +0 -33
  265. package/es/BenchmarkRankingChart/styles.js +0 -41
  266. package/es/BenchmarkScatterChart/index.d.ts +0 -145
  267. package/es/BenchmarkScatterChart/index.js +0 -855
  268. package/es/BenchmarkScatterChart/index.mdx +0 -61
  269. package/es/BenchmarkScatterChart/styles.d.ts +0 -25
  270. package/es/BenchmarkScatterChart/styles.js +0 -33
  271. package/es/BenchmarkScatterChart/utils.js +0 -353
  272. package/es/ComposedChart/index.d.ts +0 -5
  273. package/es/ComposedChart/index.js +0 -333
  274. package/es/ComposedChart/index.mdx +0 -43
  275. package/es/ComposedChart/styles.d.ts +0 -6
  276. package/es/ComposedChart/styles.js +0 -13
  277. package/es/ComposedChart/types.d.ts +0 -68
  278. package/es/ComposedChart/types.js +0 -1
  279. package/es/DataBars/CategoryBar.d.ts +0 -15
  280. package/es/DataBars/CategoryBar.js +0 -199
  281. package/es/DataBars/DeltaBar.d.ts +0 -13
  282. package/es/DataBars/DeltaBar.js +0 -115
  283. package/es/DataBars/MarkerBar.d.ts +0 -16
  284. package/es/DataBars/MarkerBar.js +0 -92
  285. package/es/DataBars/ProgressBar.d.ts +0 -12
  286. package/es/DataBars/ProgressBar.js +0 -69
  287. package/es/DataBars/index.d.ts +0 -4
  288. package/es/DataBars/index.js +0 -4
  289. package/es/DataBars/index.mdx +0 -36
  290. package/es/DataBars/styles.d.ts +0 -7
  291. package/es/DataBars/styles.js +0 -14
  292. package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
  293. package/es/DonutChart/DonutChartTooltip.js +0 -26
  294. package/es/DonutChart/index.d.ts +0 -31
  295. package/es/DonutChart/index.js +0 -230
  296. package/es/DonutChart/index.mdx +0 -48
  297. package/es/DonutChart/inputParser.d.ts +0 -2
  298. package/es/DonutChart/inputParser.js +0 -9
  299. package/es/DonutChart/renderInactiveShape.d.ts +0 -2
  300. package/es/DonutChart/renderInactiveShape.js +0 -27
  301. package/es/DonutChart/styles.d.ts +0 -6
  302. package/es/DonutChart/styles.js +0 -13
  303. package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
  304. package/es/FunnelChart/ArrowRightIcon.js +0 -22
  305. package/es/FunnelChart/index.d.ts +0 -19
  306. package/es/FunnelChart/index.js +0 -497
  307. package/es/FunnelChart/index.mdx +0 -21
  308. package/es/FunnelChart/styles.d.ts +0 -6
  309. package/es/FunnelChart/styles.js +0 -13
  310. package/es/FunnelChart/types.d.ts +0 -28
  311. package/es/FunnelChart/types.js +0 -1
  312. package/es/Heatmaps/Calendar.d.ts +0 -18
  313. package/es/Heatmaps/Calendar.js +0 -154
  314. package/es/Heatmaps/ChartLabels.d.ts +0 -15
  315. package/es/Heatmaps/ChartLabels.js +0 -106
  316. package/es/Heatmaps/Footer.d.ts +0 -22
  317. package/es/Heatmaps/Footer.js +0 -105
  318. package/es/Heatmaps/index.d.ts +0 -28
  319. package/es/Heatmaps/index.js +0 -225
  320. package/es/Heatmaps/index.mdx +0 -70
  321. package/es/Heatmaps/styles.d.ts +0 -7
  322. package/es/Heatmaps/styles.js +0 -14
  323. package/es/Legend/LegendItem.d.ts +0 -10
  324. package/es/Legend/LegendItem.js +0 -56
  325. package/es/Legend/ScrollButton.d.ts +0 -9
  326. package/es/Legend/ScrollButton.js +0 -62
  327. package/es/Legend/index.d.ts +0 -14
  328. package/es/Legend/index.js +0 -183
  329. package/es/Legend/index.mdx +0 -13
  330. package/es/LineChart/index.d.ts +0 -9
  331. package/es/LineChart/index.js +0 -386
  332. package/es/LineChart/index.mdx +0 -49
  333. package/es/LineChart/styles.d.ts +0 -6
  334. package/es/LineChart/styles.js +0 -13
  335. package/es/RadarChart/index.d.ts +0 -24
  336. package/es/RadarChart/index.js +0 -252
  337. package/es/RadarChart/index.mdx +0 -52
  338. package/es/RadarChart/styles.d.ts +0 -5
  339. package/es/RadarChart/styles.js +0 -12
  340. package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
  341. package/es/ScatterChart/ScatterChartTooltip.js +0 -74
  342. package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
  343. package/es/ScatterChart/ScatterChartTooltipRow.js +0 -38
  344. package/es/ScatterChart/index.d.ts +0 -56
  345. package/es/ScatterChart/index.js +0 -340
  346. package/es/ScatterChart/index.mdx +0 -49
  347. package/es/ScatterChart/renderShape.js +0 -18
  348. package/es/ScatterChart/styles.d.ts +0 -6
  349. package/es/ScatterChart/styles.js +0 -13
  350. package/es/SparkChart/SparkAreaChart.d.ts +0 -12
  351. package/es/SparkChart/SparkAreaChart.js +0 -146
  352. package/es/SparkChart/SparkBarChart.d.ts +0 -9
  353. package/es/SparkChart/SparkBarChart.js +0 -104
  354. package/es/SparkChart/SparkLineChart.d.ts +0 -10
  355. package/es/SparkChart/SparkLineChart.js +0 -108
  356. package/es/SparkChart/index.d.ts +0 -3
  357. package/es/SparkChart/index.js +0 -3
  358. package/es/SparkChart/index.mdx +0 -29
  359. package/es/Tracker/TrackerBlock.d.ts +0 -8
  360. package/es/Tracker/TrackerBlock.js +0 -62
  361. package/es/Tracker/index.d.ts +0 -18
  362. package/es/Tracker/index.js +0 -103
  363. package/es/Tracker/index.mdx +0 -41
  364. package/es/Tracker/styles.d.ts +0 -5
  365. package/es/Tracker/styles.js +0 -12
  366. package/es/common/BaseAnimationTimingProps.d.ts +0 -7
  367. package/es/common/BaseAnimationTimingProps.js +0 -1
  368. package/es/common/BaseChartProps.d.ts +0 -58
  369. package/es/common/BaseChartProps.js +0 -1
  370. package/es/common/BaseSparkChartProps.d.ts +0 -14
  371. package/es/common/BaseSparkChartProps.js +0 -1
  372. package/es/common/ChartLegend.d.ts +0 -5
  373. package/es/common/ChartLegend.js +0 -40
  374. package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
  375. package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -31
  376. package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
  377. package/es/common/ChartTooltip/ChartTooltipRow.js +0 -53
  378. package/es/common/ChartTooltip/index.d.ts +0 -15
  379. package/es/common/ChartTooltip/index.js +0 -64
  380. package/es/common/CustomTooltipProps.d.ts +0 -12
  381. package/es/common/CustomTooltipProps.js +0 -1
  382. package/es/common/CustomYAxisTick.d.ts +0 -15
  383. package/es/common/CustomYAxisTick.js +0 -27
  384. package/es/common/NoData.d.ts +0 -10
  385. package/es/common/NoData.js +0 -24
  386. package/es/common/benchmark/index.d.ts +0 -2
  387. package/es/common/benchmark/types.d.ts +0 -122
  388. package/es/common/benchmark/types.js +0 -1
  389. package/es/common/benchmark/utils.js +0 -159
  390. package/es/common/utils.js +0 -85
  391. package/es/hooks/useOnWindowResize.d.ts +0 -3
  392. package/es/hooks/useOnWindowResize.js +0 -15
  393. package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
  394. package/es/hooks/usePrefersReducedMotion.js +0 -28
  395. package/es/hooks/useThemeColorRange.d.ts +0 -1
  396. package/es/hooks/useThemeColorRange.js +0 -8
  397. package/es/index.d.ts +0 -24
  398. package/es/index.js +0 -22
  399. package/es/types/charts.js +0 -8
  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
@@ -0,0 +1,666 @@
1
+ "use client";
2
+ import { useThemeColorRange } from "../hooks/useThemeColorRange.mjs";
3
+ import ChartTooltip from "../common/ChartTooltip/index.mjs";
4
+ import NoData from "../common/NoData.mjs";
5
+ import { constructCategoryColors } from "../common/utils.mjs";
6
+ import { getTextWidth } from "../utils/getMaxLabelLength.mjs";
7
+ import { defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, normalizeBenchmarkData } from "../common/benchmark/utils.mjs";
8
+ import { styles } from "./styles.mjs";
9
+ import { createScale, getParetoFrontier, placeLabels } from "./utils.mjs";
10
+ import { A, Segmented, Skeleton, Tooltip, cssVar, cx, useTheme } from "@lobehub/ui";
11
+ import { forwardRef, useMemo, useRef, useState } from "react";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
+ import { useSize } from "ahooks";
14
+ //#region src/BenchmarkScatterChart/index.tsx
15
+ const labelPriority = (point, frontierKeys) => (frontierKeys.has(point.key) ? 0 : 2) + (point.item.highlighted ? 0 : 1);
16
+ const MARGIN_TOP = 12;
17
+ const MARGIN_RIGHT = 16;
18
+ const TICK_GAP = 8;
19
+ const AXIS_TITLE_SIZE = 22;
20
+ const MONO_CHAR_RATIO = .62;
21
+ const renderShape = (shape, color, size, ring = false) => {
22
+ const half = size / 2;
23
+ let node;
24
+ switch (shape) {
25
+ case "square":
26
+ node = /* @__PURE__ */ jsx("rect", {
27
+ fill: color,
28
+ height: size * .84,
29
+ width: size * .84,
30
+ x: size * .08,
31
+ y: size * .08
32
+ });
33
+ break;
34
+ case "diamond":
35
+ node = /* @__PURE__ */ jsx("path", {
36
+ d: `M${half},0 L${size},${half} L${half},${size} L0,${half} Z`,
37
+ fill: color
38
+ });
39
+ break;
40
+ case "triangle":
41
+ node = /* @__PURE__ */ jsx("path", {
42
+ d: `M${half},0 L${size},${size * .9} L0,${size * .9} Z`,
43
+ fill: color
44
+ });
45
+ break;
46
+ default: node = /* @__PURE__ */ jsx("circle", {
47
+ cx: half,
48
+ cy: half,
49
+ fill: color,
50
+ r: half
51
+ });
52
+ }
53
+ return /* @__PURE__ */ jsx("svg", {
54
+ height: size,
55
+ style: {
56
+ display: "block",
57
+ overflow: "visible"
58
+ },
59
+ width: size,
60
+ children: ring ? /* @__PURE__ */ jsx("g", {
61
+ paintOrder: "stroke",
62
+ stroke: cssVar.colorBgContainer,
63
+ strokeWidth: 4,
64
+ children: node
65
+ }) : node
66
+ });
67
+ };
68
+ const toLabelText = (name) => String(name ?? "").replaceAll("\n", " ");
69
+ const BenchmarkScatterChart = forwardRef((props, ref) => {
70
+ const theme = useTheme();
71
+ const themeColorRange = useThemeColorRange();
72
+ const { data = [], index, valueKey, providerKey, iconKey, colorKey, errorKey, renderIcon, valueFormatter = defaultBenchmarkValueFormatter, accuracyFormatter, errorFormatter = defaultBenchmarkErrorFormatter, showError = true, showErrorBars = true, showAnimation = false, onValueChange, className, style, loading, width = "100%", height = 420, noDataText, highlightColor, frontierColor, frontierWidth = 2, iconSize = 20, markerSize = 12, labelFontSize = 12, valueLabelFontSize = 11, metrics, metric, defaultMetric, onMetricChange, minX, maxX, minY, maxY, showDominatedArea = true, showFrontier = true, showGridLines = true, showLabels = true, showLegend = true, showTooltip = true, showValueLabel = true, showXAxis = true, showYAxis = true, xAxisLabel, xDirection = "lower", xFormatter = defaultBenchmarkValueFormatter, xKey = "x", xScale = "linear", yAxisLabel, ...rest } = props;
73
+ const plotRef = useRef(null);
74
+ const size = useSize(plotRef);
75
+ const [innerMetric, setInnerMetric] = useState(defaultMetric);
76
+ const [hoverKey, setHoverKey] = useState();
77
+ const [selectedKey, setSelectedKey] = useState();
78
+ const resolvedHighlightColor = highlightColor ?? theme.gold;
79
+ const resolvedFrontierColor = frontierColor ?? theme.orange;
80
+ const yFormatter = accuracyFormatter ?? valueFormatter;
81
+ const yName = yAxisLabel || (accuracyFormatter ? "Accuracy" : "Score");
82
+ const activeMetric = useMemo(() => {
83
+ if (metrics?.length) {
84
+ const key = metric ?? innerMetric;
85
+ const found = metrics.find((m) => m.key === key) ?? metrics[0];
86
+ return {
87
+ axisLabel: found.axisLabel ?? found.label,
88
+ direction: found.direction ?? "lower",
89
+ formatter: found.formatter ?? defaultBenchmarkValueFormatter,
90
+ key: found.key,
91
+ label: found.label,
92
+ max: found.max ?? maxX,
93
+ min: found.min ?? minX,
94
+ scale: found.scale ?? "linear"
95
+ };
96
+ }
97
+ return {
98
+ axisLabel: xAxisLabel,
99
+ direction: xDirection,
100
+ formatter: xFormatter,
101
+ key: xKey,
102
+ label: xAxisLabel || "X",
103
+ max: maxX,
104
+ min: minX,
105
+ scale: xScale
106
+ };
107
+ }, [
108
+ innerMetric,
109
+ maxX,
110
+ metric,
111
+ metrics,
112
+ minX,
113
+ xAxisLabel,
114
+ xDirection,
115
+ xFormatter,
116
+ xKey,
117
+ xScale
118
+ ]);
119
+ const items = useMemo(() => normalizeBenchmarkData({
120
+ colorKey,
121
+ data,
122
+ errorKey,
123
+ iconKey,
124
+ index,
125
+ providerKey,
126
+ renderIcon,
127
+ sortOrder: "descending",
128
+ valueKey
129
+ }), [
130
+ colorKey,
131
+ data,
132
+ errorKey,
133
+ iconKey,
134
+ index,
135
+ providerKey,
136
+ renderIcon,
137
+ valueKey
138
+ ]);
139
+ const categoryColors = useMemo(() => constructCategoryColors(items.map((item) => String(item.key)), themeColorRange), [items, themeColorRange]);
140
+ const points = useMemo(() => items.map((item) => ({
141
+ color: item.color ?? categoryColors.get(String(item.key)) ?? cssVar.colorPrimary,
142
+ item,
143
+ key: item.key,
144
+ x: Number(item.original[activeMetric.key]),
145
+ y: item.value
146
+ })).filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y) && (activeMetric.scale !== "log" || p.x > 0)), [
147
+ activeMetric.key,
148
+ activeMetric.scale,
149
+ categoryColors,
150
+ items
151
+ ]);
152
+ const frontier = useMemo(() => showFrontier ? getParetoFrontier(points, activeMetric.direction) : [], [
153
+ activeMetric.direction,
154
+ points,
155
+ showFrontier
156
+ ]);
157
+ const frontierKeys = useMemo(() => new Set(frontier.map((p) => p.key)), [frontier]);
158
+ const enableErrorBars = showError && showErrorBars;
159
+ const yValues = useMemo(() => points.flatMap((p) => enableErrorBars && p.item.error ? [p.y - p.item.error, p.y + p.item.error] : [p.y]), [enableErrorBars, points]);
160
+ const labelSizes = useMemo(() => {
161
+ const map = /* @__PURE__ */ new Map();
162
+ if (!showLabels) return map;
163
+ const nameScale = labelFontSize / 12 * 1.1;
164
+ for (const p of points) {
165
+ const nameWidth = getTextWidth(toLabelText(p.item.name)) * nameScale;
166
+ const valueWidth = showValueLabel ? `${yFormatter(p.y)} · ${activeMetric.formatter(p.x)}`.length * valueLabelFontSize * MONO_CHAR_RATIO : 0;
167
+ map.set(p.key, {
168
+ height: Math.ceil(labelFontSize * 1.3 + (showValueLabel ? valueLabelFontSize * 1.3 : 0)),
169
+ width: Math.ceil(Math.max(nameWidth, valueWidth)) + 2
170
+ });
171
+ }
172
+ return map;
173
+ }, [
174
+ activeMetric,
175
+ labelFontSize,
176
+ points,
177
+ showLabels,
178
+ showValueLabel,
179
+ valueLabelFontSize,
180
+ yFormatter
181
+ ]);
182
+ const plotWidth = size?.width || (typeof width === "number" ? width : 0);
183
+ const plotHeight = typeof height === "number" ? height : 420;
184
+ const layout = useMemo(() => {
185
+ if (!plotWidth || !points.length) return null;
186
+ const probeY = createScale({
187
+ max: maxY,
188
+ min: minY,
189
+ range: [0, 1],
190
+ values: yValues
191
+ });
192
+ const yTickWidth = showYAxis ? Math.max(...probeY.ticks.map((t) => yFormatter(t).length * 12 * MONO_CHAR_RATIO), 0) : 0;
193
+ const left = (showYAxis ? yTickWidth + TICK_GAP + 4 : 4) + (yAxisLabel ? AXIS_TITLE_SIZE : 0);
194
+ const bottom = (showXAxis ? 26 : 4) + (activeMetric.axisLabel ? AXIS_TITLE_SIZE : 0);
195
+ const innerRight = plotWidth - MARGIN_RIGHT;
196
+ const innerBottom = plotHeight - bottom;
197
+ const xScaleObj = createScale({
198
+ max: activeMetric.max,
199
+ min: activeMetric.min,
200
+ range: [left, innerRight],
201
+ type: activeMetric.scale,
202
+ values: points.map((p) => p.x)
203
+ });
204
+ const yScaleObj = createScale({
205
+ max: maxY,
206
+ min: minY,
207
+ range: [innerBottom, MARGIN_TOP],
208
+ values: yValues
209
+ });
210
+ const positions = /* @__PURE__ */ new Map();
211
+ for (const p of points) positions.set(p.key, {
212
+ px: xScaleObj.map(p.x),
213
+ py: yScaleObj.map(p.y),
214
+ radius: (p.item.icon ? iconSize : markerSize) / 2
215
+ });
216
+ const frontierPath = frontier.map((p, i) => {
217
+ const pos = positions.get(p.key);
218
+ return `${i === 0 ? "M" : "L"}${pos.px.toFixed(2)},${pos.py.toFixed(2)}`;
219
+ }).join(" ");
220
+ let labels = /* @__PURE__ */ new Map();
221
+ if (showLabels) {
222
+ const lineBoxes = [];
223
+ for (let i = 1; i < frontier.length; i++) {
224
+ const a = positions.get(frontier[i - 1].key);
225
+ const b = positions.get(frontier[i].key);
226
+ const steps = Math.max(1, Math.ceil(Math.hypot(b.px - a.px, b.py - a.py) / 10));
227
+ for (let s = 0; s <= steps; s++) {
228
+ const t = s / steps;
229
+ lineBoxes.push({
230
+ height: 6,
231
+ width: 6,
232
+ x: a.px + (b.px - a.px) * t - 3,
233
+ y: a.py + (b.py - a.py) * t - 3
234
+ });
235
+ }
236
+ }
237
+ const candidates = [...points].sort((a, b) => labelPriority(a, frontierKeys) - labelPriority(b, frontierKeys) || b.y - a.y).map((p) => {
238
+ const pos = positions.get(p.key);
239
+ return {
240
+ ...labelSizes.get(p.key) ?? {
241
+ height: 16,
242
+ width: 40
243
+ },
244
+ key: p.key,
245
+ ...pos
246
+ };
247
+ });
248
+ labels = placeLabels(candidates, {
249
+ height: innerBottom,
250
+ width: plotWidth - left + MARGIN_RIGHT,
251
+ x: left,
252
+ y: 0
253
+ }, { lines: lineBoxes });
254
+ }
255
+ return {
256
+ bottom,
257
+ frontierPath,
258
+ innerBottom,
259
+ innerRight,
260
+ labels,
261
+ left,
262
+ positions,
263
+ xScale: xScaleObj,
264
+ yScale: yScaleObj
265
+ };
266
+ }, [
267
+ activeMetric,
268
+ frontier,
269
+ frontierKeys,
270
+ iconSize,
271
+ labelSizes,
272
+ markerSize,
273
+ maxY,
274
+ minY,
275
+ plotHeight,
276
+ plotWidth,
277
+ points,
278
+ showLabels,
279
+ showXAxis,
280
+ showYAxis,
281
+ yAxisLabel,
282
+ yFormatter,
283
+ yValues
284
+ ]);
285
+ if (loading || !data) return /* @__PURE__ */ jsx(Skeleton, {
286
+ height: plotHeight,
287
+ width
288
+ });
289
+ const focusKey = hoverKey ?? selectedKey;
290
+ const focusPoint = focusKey === void 0 ? void 0 : points.find((point) => point.key === focusKey);
291
+ const dominatedKeys = /* @__PURE__ */ new Set();
292
+ if (showDominatedArea && focusPoint) for (const point of points) {
293
+ if (point.key === focusPoint.key || point.y > focusPoint.y) continue;
294
+ if (activeMetric.direction === "lower" ? point.x >= focusPoint.x : point.x <= focusPoint.x) dominatedKeys.add(point.key);
295
+ }
296
+ const getEmphasis = (key) => {
297
+ if (focusKey === void 0 || key === focusKey) return "normal";
298
+ if (!showDominatedArea) return "dimmed";
299
+ return dominatedKeys.has(key) ? "dominated" : "normal";
300
+ };
301
+ const isDimmed = (key) => getEmphasis(key) !== "normal";
302
+ const animatedCls = showAnimation ? void 0 : styles.noTransition;
303
+ const handleClick = (item) => {
304
+ if (!onValueChange) return;
305
+ if (selectedKey === item.key) {
306
+ setSelectedKey(void 0);
307
+ onValueChange(null);
308
+ return;
309
+ }
310
+ setSelectedKey(item.key);
311
+ const payload = {
312
+ ...item.original,
313
+ eventType: "point",
314
+ rank: item.rank,
315
+ value: item.value
316
+ };
317
+ onValueChange(payload);
318
+ };
319
+ const handleMetricChange = (key) => {
320
+ if (metric === void 0) setInnerMetric(key);
321
+ onMetricChange?.(key);
322
+ };
323
+ const renderTooltip = (point, child) => {
324
+ if (!showTooltip) return child;
325
+ const { item } = point;
326
+ const rows = [];
327
+ if (metrics?.length) for (const m of metrics) {
328
+ const value = Number(item.original[m.key]);
329
+ if (!Number.isFinite(value)) continue;
330
+ rows.push({
331
+ format: m.formatter ?? defaultBenchmarkValueFormatter,
332
+ name: m.label,
333
+ value
334
+ });
335
+ }
336
+ else rows.push({
337
+ format: activeMetric.formatter,
338
+ name: activeMetric.label,
339
+ value: point.x
340
+ });
341
+ rows.reverse();
342
+ rows.push({
343
+ format: (v) => showError && item.error !== void 0 ? `${yFormatter(v)} ± ${errorFormatter(item.error)}` : yFormatter(v),
344
+ name: yName,
345
+ value: point.y
346
+ });
347
+ const formatters = new Map(rows.map((row) => [row.name, row.format]));
348
+ const modelName = toLabelText(item.name);
349
+ return /* @__PURE__ */ jsx(Tooltip, {
350
+ arrow: false,
351
+ mouseEnterDelay: .05,
352
+ mouseLeaveDelay: 0,
353
+ styles: {
354
+ container: {
355
+ background: "transparent",
356
+ boxShadow: "none",
357
+ maxWidth: "none",
358
+ padding: 0,
359
+ pointerEvents: "none",
360
+ width: "max-content"
361
+ },
362
+ content: {
363
+ color: cssVar.colorText,
364
+ fontSize: cssVar.fontSize,
365
+ lineHeight: cssVar.lineHeight,
366
+ maxWidth: "none",
367
+ overflow: "visible",
368
+ padding: 0
369
+ },
370
+ root: {
371
+ maxWidth: "none",
372
+ pointerEvents: "none"
373
+ }
374
+ },
375
+ title: /* @__PURE__ */ jsx(ChartTooltip, {
376
+ active: true,
377
+ categoryColors: new Map(rows.map((row) => [row.name, point.color])),
378
+ label: item.provider ? `${modelName} · ${String(item.provider)}` : modelName,
379
+ payload: rows.map((row) => ({
380
+ dataKey: row.name,
381
+ name: row.name,
382
+ value: row.value
383
+ })),
384
+ valueFormatter: (value, name) => (formatters.get(name ?? "") ?? String)(Number(value))
385
+ }),
386
+ children: child
387
+ });
388
+ };
389
+ const renderMarker = (point, markerSizePx, ring = false) => point.item.icon ? /* @__PURE__ */ jsx("span", {
390
+ className: ring ? styles.markerIconRing : void 0,
391
+ style: {
392
+ alignItems: "center",
393
+ display: "flex",
394
+ flexShrink: 0,
395
+ height: iconSize,
396
+ justifyContent: "center",
397
+ transform: markerSizePx === iconSize ? void 0 : `scale(${markerSizePx / iconSize})`,
398
+ width: iconSize
399
+ },
400
+ children: point.item.icon
401
+ }) : renderShape(point.item.original.shape, point.color, markerSizePx, ring);
402
+ const hasMetricSwitch = (metrics?.length ?? 0) > 1;
403
+ return /* @__PURE__ */ jsxs("div", {
404
+ className: cx(styles.container, className),
405
+ ref,
406
+ style: {
407
+ "--benchmark-label-font-size": `${labelFontSize}px`,
408
+ "--benchmark-value-label-font-size": `${valueLabelFontSize}px`,
409
+ "width": width,
410
+ ...style
411
+ },
412
+ ...rest,
413
+ children: [showLegend && points.length > 0 || hasMetricSwitch ? /* @__PURE__ */ jsxs("div", {
414
+ className: styles.header,
415
+ children: [/* @__PURE__ */ jsx("div", {
416
+ className: styles.legend,
417
+ children: showLegend ? points.map((point) => /* @__PURE__ */ jsxs("span", {
418
+ className: styles.legendItem,
419
+ onClick: () => handleClick(point.item),
420
+ onMouseEnter: () => setHoverKey(point.key),
421
+ onMouseLeave: () => setHoverKey(void 0),
422
+ style: {
423
+ color: point.item.highlighted ? resolvedHighlightColor : void 0,
424
+ cursor: onValueChange ? "pointer" : void 0,
425
+ opacity: isDimmed(point.key) ? .4 : 1
426
+ },
427
+ children: [/* @__PURE__ */ jsx("span", {
428
+ className: styles.legendMarker,
429
+ children: renderMarker(point, 12)
430
+ }), toLabelText(point.item.name)]
431
+ }, `legend-${point.key}`)) : null
432
+ }), hasMetricSwitch ? /* @__PURE__ */ jsx(Segmented, {
433
+ onChange: (value) => handleMetricChange(String(value)),
434
+ options: metrics.map((m) => ({
435
+ label: m.label,
436
+ value: m.key
437
+ })),
438
+ size: "small",
439
+ value: activeMetric.key
440
+ }) : null]
441
+ }) : null, /* @__PURE__ */ jsxs("div", {
442
+ className: styles.plot,
443
+ ref: plotRef,
444
+ style: { height: plotHeight },
445
+ children: [!points.length ? /* @__PURE__ */ jsx(NoData, { noDataText }) : null, layout ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("svg", {
446
+ height: plotHeight,
447
+ role: "img",
448
+ style: {
449
+ display: "block",
450
+ overflow: "visible"
451
+ },
452
+ width: plotWidth,
453
+ children: [
454
+ showGridLines ? /* @__PURE__ */ jsxs("g", { children: [layout.yScale.ticks.map((tick) => {
455
+ const y = layout.yScale.map(tick);
456
+ return /* @__PURE__ */ jsx("line", {
457
+ className: styles.gridLine,
458
+ x1: layout.left,
459
+ x2: layout.innerRight,
460
+ y1: y,
461
+ y2: y
462
+ }, `gy-${tick}`);
463
+ }), layout.xScale.ticks.map((tick) => {
464
+ const x = layout.xScale.map(tick);
465
+ return /* @__PURE__ */ jsx("line", {
466
+ className: styles.gridLine,
467
+ x1: x,
468
+ x2: x,
469
+ y1: MARGIN_TOP,
470
+ y2: layout.innerBottom
471
+ }, `gx-${tick}`);
472
+ })] }) : null,
473
+ showYAxis ? /* @__PURE__ */ jsx("g", { children: layout.yScale.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
474
+ className: styles.tickLabel,
475
+ dominantBaseline: "middle",
476
+ textAnchor: "end",
477
+ x: layout.left - TICK_GAP,
478
+ y: layout.yScale.map(tick),
479
+ children: yFormatter(tick)
480
+ }, `ty-${tick}`)) }) : null,
481
+ showXAxis ? /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
482
+ className: styles.axisLine,
483
+ x1: layout.left,
484
+ x2: layout.innerRight,
485
+ y1: layout.innerBottom,
486
+ y2: layout.innerBottom
487
+ }), layout.xScale.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
488
+ className: styles.tickLabel,
489
+ dominantBaseline: "hanging",
490
+ textAnchor: "middle",
491
+ x: layout.xScale.map(tick),
492
+ y: layout.innerBottom + TICK_GAP,
493
+ children: activeMetric.formatter(tick)
494
+ }, `tx-${tick}`))] }) : null,
495
+ yAxisLabel ? /* @__PURE__ */ jsx("text", {
496
+ className: styles.axisLabel,
497
+ dominantBaseline: "hanging",
498
+ textAnchor: "middle",
499
+ transform: `rotate(-90, 0, ${(MARGIN_TOP + layout.innerBottom) / 2})`,
500
+ x: 0,
501
+ y: (MARGIN_TOP + layout.innerBottom) / 2,
502
+ children: yAxisLabel
503
+ }) : null,
504
+ activeMetric.axisLabel ? /* @__PURE__ */ jsx("text", {
505
+ className: styles.axisLabel,
506
+ dominantBaseline: "auto",
507
+ textAnchor: "middle",
508
+ x: (layout.left + layout.innerRight) / 2,
509
+ y: plotHeight - 4,
510
+ children: activeMetric.axisLabel
511
+ }) : null,
512
+ showDominatedArea && focusPoint ? (() => {
513
+ const pos = layout.positions.get(focusPoint.key);
514
+ const toRight = activeMetric.direction === "lower";
515
+ const x0 = toRight ? pos.px : layout.left;
516
+ const x1 = toRight ? layout.innerRight : pos.px;
517
+ return /* @__PURE__ */ jsxs("g", {
518
+ className: styles.dominatedArea,
519
+ "data-testid": "benchmark-scatter-dominated-area",
520
+ children: [
521
+ /* @__PURE__ */ jsx("rect", {
522
+ fill: resolvedFrontierColor,
523
+ fillOpacity: .08,
524
+ height: Math.max(0, layout.innerBottom - pos.py),
525
+ width: Math.max(0, x1 - x0),
526
+ x: x0,
527
+ y: pos.py
528
+ }),
529
+ /* @__PURE__ */ jsx("line", {
530
+ className: styles.dominatedGuide,
531
+ x1: x0,
532
+ x2: x1,
533
+ y1: pos.py,
534
+ y2: pos.py
535
+ }),
536
+ /* @__PURE__ */ jsx("line", {
537
+ className: styles.dominatedGuide,
538
+ x1: pos.px,
539
+ x2: pos.px,
540
+ y1: pos.py,
541
+ y2: layout.innerBottom
542
+ })
543
+ ]
544
+ });
545
+ })() : null,
546
+ enableErrorBars ? points.map((point) => {
547
+ const { error } = point.item;
548
+ if (!error) return null;
549
+ const pos = layout.positions.get(point.key);
550
+ const top = layout.yScale.map(point.y + error);
551
+ const bottom = layout.yScale.map(point.y - error);
552
+ return /* @__PURE__ */ jsxs("g", {
553
+ className: styles.errorBar,
554
+ "data-testid": "benchmark-scatter-error-bar",
555
+ opacity: isDimmed(point.key) ? .25 : .7,
556
+ stroke: point.color,
557
+ children: [
558
+ /* @__PURE__ */ jsx("line", {
559
+ x1: pos.px,
560
+ x2: pos.px,
561
+ y1: top,
562
+ y2: bottom
563
+ }),
564
+ /* @__PURE__ */ jsx("line", {
565
+ x1: pos.px - 4,
566
+ x2: pos.px + 4,
567
+ y1: top,
568
+ y2: top
569
+ }),
570
+ /* @__PURE__ */ jsx("line", {
571
+ x1: pos.px - 4,
572
+ x2: pos.px + 4,
573
+ y1: bottom,
574
+ y2: bottom
575
+ })
576
+ ]
577
+ }, `err-${point.key}`);
578
+ }) : null,
579
+ layout.frontierPath ? /* @__PURE__ */ jsx("path", {
580
+ className: styles.frontier,
581
+ d: layout.frontierPath,
582
+ "data-testid": "benchmark-scatter-frontier",
583
+ opacity: !showDominatedArea && focusKey !== void 0 && !frontierKeys.has(focusKey) ? .35 : 1,
584
+ stroke: resolvedFrontierColor,
585
+ strokeWidth: frontierWidth,
586
+ style: showAnimation ? { transition: `d 0.4s, opacity 0.2s` } : void 0
587
+ }) : null
588
+ ]
589
+ }), /* @__PURE__ */ jsxs("div", {
590
+ className: styles.overlay,
591
+ children: [points.map((point) => {
592
+ const pos = layout.positions.get(point.key);
593
+ const markerPx = point.item.icon ? iconSize : markerSize;
594
+ return /* @__PURE__ */ jsx("div", { children: renderTooltip(point, /* @__PURE__ */ jsx("div", {
595
+ "aria-label": `${toLabelText(point.item.name)}: ${yFormatter(point.y)}, ${activeMetric.formatter(point.x)}`,
596
+ className: cx(styles.marker, animatedCls),
597
+ onClick: () => handleClick(point.item),
598
+ onMouseEnter: () => setHoverKey(point.key),
599
+ onMouseLeave: () => setHoverKey(void 0),
600
+ role: "button",
601
+ style: {
602
+ cursor: onValueChange ? "pointer" : "default",
603
+ filter: getEmphasis(point.key) === "dominated" ? "grayscale(1)" : void 0,
604
+ height: markerPx,
605
+ left: pos.px,
606
+ opacity: {
607
+ dimmed: .25,
608
+ dominated: .5,
609
+ normal: 1
610
+ }[getEmphasis(point.key)],
611
+ top: pos.py,
612
+ width: markerPx
613
+ },
614
+ children: renderMarker(point, markerPx, true)
615
+ })) }, `marker-${point.key}`);
616
+ }), showLabels ? points.map((point) => {
617
+ const label = layout.labels.get(point.key);
618
+ if (!label) return null;
619
+ const emphasis = getEmphasis(point.key);
620
+ const textColor = emphasis === "dominated" ? cssVar.colorTextQuaternary : point.item.highlighted ? resolvedHighlightColor : void 0;
621
+ const isKeyLabel = emphasis !== "dominated" && (frontierKeys.has(point.key) || point.item.highlighted || point.key === focusKey);
622
+ const align = label.placement.endsWith("left") ? "right" : label.placement === "top" || label.placement === "bottom" ? "center" : "left";
623
+ const name = toLabelText(point.item.name);
624
+ return /* @__PURE__ */ jsxs("div", {
625
+ className: cx(styles.label, animatedCls),
626
+ onClick: () => handleClick(point.item),
627
+ onMouseEnter: () => setHoverKey(point.key),
628
+ onMouseLeave: () => setHoverKey(void 0),
629
+ style: {
630
+ cursor: onValueChange ? "pointer" : "default",
631
+ height: label.height,
632
+ left: label.x,
633
+ opacity: emphasis === "dimmed" ? .25 : 1,
634
+ textAlign: align,
635
+ top: label.y,
636
+ width: label.width
637
+ },
638
+ children: [/* @__PURE__ */ jsx("div", {
639
+ className: cx(styles.labelName, isKeyLabel && styles.labelNameEmphasis),
640
+ style: textColor ? { color: textColor } : void 0,
641
+ children: point.item.href ? /* @__PURE__ */ jsx(A, {
642
+ className: styles.labelNameLink,
643
+ href: point.item.href,
644
+ onClick: (event) => event.stopPropagation(),
645
+ target: point.item.target,
646
+ children: name
647
+ }) : name
648
+ }), showValueLabel ? /* @__PURE__ */ jsxs("div", {
649
+ className: styles.labelValue,
650
+ children: [
651
+ yFormatter(point.y),
652
+ " · ",
653
+ activeMetric.formatter(point.x)
654
+ ]
655
+ }) : null]
656
+ }, `label-${point.key}`);
657
+ }) : null]
658
+ })] }) : null]
659
+ })]
660
+ });
661
+ });
662
+ BenchmarkScatterChart.displayName = "BenchmarkScatterChart";
663
+ //#endregion
664
+ export { BenchmarkScatterChart as default };
665
+
666
+ //# sourceMappingURL=index.mjs.map