@lobehub/charts 5.7.0 → 5.7.2

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