@lobehub/charts 5.7.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.
- package/es/AccuracyBarChart/index.d.mts +62 -0
- package/es/AccuracyBarChart/index.mjs +326 -0
- package/es/AccuracyBarChart/index.mjs.map +1 -0
- package/es/AccuracyBarChart/styles.d.mts +14 -0
- package/es/AccuracyBarChart/styles.mjs +71 -0
- package/es/AccuracyBarChart/styles.mjs.map +1 -0
- package/es/AreaChart/index.d.mts +13 -0
- package/es/AreaChart/index.mjs +308 -0
- package/es/AreaChart/index.mjs.map +1 -0
- package/es/AreaChart/styles.d.mts +9 -0
- package/es/AreaChart/styles.mjs +28 -0
- package/es/AreaChart/styles.mjs.map +1 -0
- package/es/BarChart/index.d.mts +11 -0
- package/es/BarChart/index.mjs +290 -0
- package/es/BarChart/index.mjs.map +1 -0
- package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
- package/es/BarChart/renderShape.mjs +28 -0
- package/es/BarChart/renderShape.mjs.map +1 -0
- package/es/BarChart/styles.d.mts +9 -0
- package/es/BarChart/styles.mjs +28 -0
- package/es/BarChart/styles.mjs.map +1 -0
- package/es/BarList/index.d.mts +32 -0
- package/es/BarList/index.mjs +128 -0
- package/es/BarList/index.mjs.map +1 -0
- package/es/BarList/styles.d.mts +13 -0
- package/es/BarList/styles.mjs +63 -0
- package/es/BarList/styles.mjs.map +1 -0
- package/es/BenchmarkColumnChart/index.d.mts +144 -0
- package/es/BenchmarkColumnChart/index.mjs +514 -0
- package/es/BenchmarkColumnChart/index.mjs.map +1 -0
- package/es/BenchmarkColumnChart/styles.d.mts +19 -0
- package/es/BenchmarkColumnChart/styles.mjs +129 -0
- package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
- package/es/BenchmarkRankingChart/index.d.mts +91 -0
- package/es/BenchmarkRankingChart/index.mjs +347 -0
- package/es/BenchmarkRankingChart/index.mjs.map +1 -0
- package/es/BenchmarkRankingChart/styles.d.mts +36 -0
- package/es/BenchmarkRankingChart/styles.mjs +265 -0
- package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/index.d.mts +148 -0
- package/es/BenchmarkScatterChart/index.mjs +668 -0
- package/es/BenchmarkScatterChart/index.mjs.map +1 -0
- package/es/BenchmarkScatterChart/styles.d.mts +28 -0
- package/es/BenchmarkScatterChart/styles.mjs +193 -0
- package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
- package/es/BenchmarkScatterChart/utils.mjs +214 -0
- package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
- package/es/ComposedChart/index.d.mts +6 -0
- package/es/ComposedChart/index.mjs +254 -0
- package/es/ComposedChart/index.mjs.map +1 -0
- package/es/ComposedChart/styles.d.mts +9 -0
- package/es/ComposedChart/styles.mjs +28 -0
- package/es/ComposedChart/styles.mjs.map +1 -0
- package/es/ComposedChart/types.d.mts +71 -0
- package/es/ComposedChart/types.mjs +0 -0
- package/es/DataBars/CategoryBar.d.mts +17 -0
- package/es/DataBars/CategoryBar.mjs +146 -0
- package/es/DataBars/CategoryBar.mjs.map +1 -0
- package/es/DataBars/DeltaBar.d.mts +16 -0
- package/es/DataBars/DeltaBar.mjs +102 -0
- package/es/DataBars/DeltaBar.mjs.map +1 -0
- package/es/DataBars/MarkerBar.d.mts +19 -0
- package/es/DataBars/MarkerBar.mjs +74 -0
- package/es/DataBars/MarkerBar.mjs.map +1 -0
- package/es/DataBars/ProgressBar.d.mts +15 -0
- package/es/DataBars/ProgressBar.mjs +53 -0
- package/es/DataBars/ProgressBar.mjs.map +1 -0
- package/es/DataBars/index.d.mts +5 -0
- package/es/DataBars/index.mjs +5 -0
- package/es/DataBars/styles.d.mts +10 -0
- package/es/DataBars/styles.mjs +31 -0
- package/es/DataBars/styles.mjs.map +1 -0
- package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
- package/es/DonutChart/DonutChartTooltip.mjs +25 -0
- package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
- package/es/DonutChart/index.d.mts +33 -0
- package/es/DonutChart/index.mjs +160 -0
- package/es/DonutChart/index.mjs.map +1 -0
- package/es/DonutChart/inputParser.d.mts +5 -0
- package/es/DonutChart/inputParser.mjs +8 -0
- package/es/DonutChart/inputParser.mjs.map +1 -0
- package/es/DonutChart/renderInactiveShape.d.mts +4 -0
- package/es/DonutChart/renderInactiveShape.mjs +22 -0
- package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
- package/es/DonutChart/styles.d.mts +9 -0
- package/es/DonutChart/styles.mjs +28 -0
- package/es/DonutChart/styles.mjs.map +1 -0
- package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
- package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
- package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
- package/es/FunnelChart/index.d.mts +21 -0
- package/es/FunnelChart/index.mjs +421 -0
- package/es/FunnelChart/index.mjs.map +1 -0
- package/es/FunnelChart/styles.d.mts +9 -0
- package/es/FunnelChart/styles.mjs +28 -0
- package/es/FunnelChart/styles.mjs.map +1 -0
- package/es/FunnelChart/types.d.mts +31 -0
- package/es/FunnelChart/types.mjs +0 -0
- package/es/Heatmaps/Calendar.d.mts +21 -0
- package/es/Heatmaps/Calendar.mjs +108 -0
- package/es/Heatmaps/Calendar.mjs.map +1 -0
- package/es/Heatmaps/ChartLabels.d.mts +17 -0
- package/es/Heatmaps/ChartLabels.mjs +84 -0
- package/es/Heatmaps/ChartLabels.mjs.map +1 -0
- package/es/Heatmaps/Footer.d.mts +24 -0
- package/es/Heatmaps/Footer.mjs +81 -0
- package/es/Heatmaps/Footer.mjs.map +1 -0
- package/es/Heatmaps/index.d.mts +31 -0
- package/es/Heatmaps/index.mjs +188 -0
- package/es/Heatmaps/index.mjs.map +1 -0
- package/es/Heatmaps/styles.d.mts +10 -0
- package/es/Heatmaps/styles.mjs +47 -0
- package/es/Heatmaps/styles.mjs.map +1 -0
- package/es/Legend/LegendItem.d.mts +12 -0
- package/es/Legend/LegendItem.mjs +65 -0
- package/es/Legend/LegendItem.mjs.map +1 -0
- package/es/Legend/ScrollButton.d.mts +11 -0
- package/es/Legend/ScrollButton.mjs +50 -0
- package/es/Legend/ScrollButton.mjs.map +1 -0
- package/es/Legend/index.d.mts +16 -0
- package/es/Legend/index.mjs +152 -0
- package/es/Legend/index.mjs.map +1 -0
- package/es/LineChart/index.d.mts +11 -0
- package/es/LineChart/index.mjs +271 -0
- package/es/LineChart/index.mjs.map +1 -0
- package/es/LineChart/styles.d.mts +9 -0
- package/es/LineChart/styles.mjs +28 -0
- package/es/LineChart/styles.mjs.map +1 -0
- package/es/RadarChart/index.d.mts +27 -0
- package/es/RadarChart/index.mjs +157 -0
- package/es/RadarChart/index.mjs.map +1 -0
- package/es/RadarChart/styles.d.mts +8 -0
- package/es/RadarChart/styles.mjs +23 -0
- package/es/RadarChart/styles.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs +52 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +36 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
- package/es/ScatterChart/index.d.mts +58 -0
- package/es/ScatterChart/index.mjs +241 -0
- package/es/ScatterChart/index.mjs.map +1 -0
- package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
- package/es/ScatterChart/renderShape.mjs +18 -0
- package/es/ScatterChart/renderShape.mjs.map +1 -0
- package/es/ScatterChart/styles.d.mts +9 -0
- package/es/ScatterChart/styles.mjs +28 -0
- package/es/ScatterChart/styles.mjs.map +1 -0
- package/es/SparkChart/SparkAreaChart.d.mts +14 -0
- package/es/SparkChart/SparkAreaChart.mjs +109 -0
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
- package/es/SparkChart/SparkBarChart.d.mts +11 -0
- package/es/SparkChart/SparkBarChart.mjs +69 -0
- package/es/SparkChart/SparkBarChart.mjs.map +1 -0
- package/es/SparkChart/SparkLineChart.d.mts +12 -0
- package/es/SparkChart/SparkLineChart.mjs +73 -0
- package/es/SparkChart/SparkLineChart.mjs.map +1 -0
- package/es/SparkChart/index.d.mts +4 -0
- package/es/SparkChart/index.mjs +4 -0
- package/es/Tracker/TrackerBlock.d.mts +11 -0
- package/es/Tracker/TrackerBlock.mjs +52 -0
- package/es/Tracker/TrackerBlock.mjs.map +1 -0
- package/es/Tracker/index.d.mts +21 -0
- package/es/Tracker/index.mjs +69 -0
- package/es/Tracker/index.mjs.map +1 -0
- package/es/Tracker/styles.d.mts +8 -0
- package/es/Tracker/styles.mjs +24 -0
- package/es/Tracker/styles.mjs.map +1 -0
- package/es/common/BaseAnimationTimingProps.d.mts +10 -0
- package/es/common/BaseAnimationTimingProps.mjs +0 -0
- package/es/common/BaseChartProps.d.mts +61 -0
- package/es/common/BaseChartProps.mjs +0 -0
- package/es/common/BaseSparkChartProps.d.mts +17 -0
- package/es/common/BaseSparkChartProps.mjs +0 -0
- package/es/common/ChartLegend.d.mts +8 -0
- package/es/common/ChartLegend.mjs +32 -0
- package/es/common/ChartLegend.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs +27 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs +51 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
- package/es/common/ChartTooltip/index.d.mts +18 -0
- package/es/common/ChartTooltip/index.mjs +50 -0
- package/es/common/ChartTooltip/index.mjs.map +1 -0
- package/es/common/CustomTooltipProps.d.mts +15 -0
- package/es/common/CustomTooltipProps.mjs +0 -0
- package/es/common/CustomYAxisTick.d.mts +18 -0
- package/es/common/CustomYAxisTick.mjs +24 -0
- package/es/common/CustomYAxisTick.mjs.map +1 -0
- package/es/common/NoData.d.mts +13 -0
- package/es/common/NoData.mjs +25 -0
- package/es/common/NoData.mjs.map +1 -0
- package/es/common/benchmark/index.d.mts +3 -0
- package/es/common/benchmark/{index.js → index.mjs} +1 -1
- package/es/common/benchmark/types.d.mts +125 -0
- package/es/common/benchmark/types.mjs +0 -0
- package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
- package/es/common/benchmark/utils.mjs +115 -0
- package/es/common/benchmark/utils.mjs.map +1 -0
- package/es/common/{utils.d.ts → utils.d.mts} +3 -0
- package/es/common/utils.mjs +36 -0
- package/es/common/utils.mjs.map +1 -0
- package/es/hooks/useOnWindowResize.d.mts +6 -0
- package/es/hooks/useOnWindowResize.mjs +18 -0
- package/es/hooks/useOnWindowResize.mjs.map +1 -0
- package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
- package/es/hooks/usePrefersReducedMotion.mjs +24 -0
- package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
- package/es/hooks/useThemeColorRange.d.mts +4 -0
- package/es/hooks/useThemeColorRange.mjs +28 -0
- package/es/hooks/useThemeColorRange.mjs.map +1 -0
- package/es/index.d.mts +34 -0
- package/es/index.mjs +28 -0
- package/es/types/{charts.d.ts → charts.d.mts} +26 -26
- package/es/types/charts.mjs +12 -0
- package/es/types/charts.mjs.map +1 -0
- package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
- package/es/utils/calendar.mjs +154 -0
- package/es/utils/calendar.mjs.map +1 -0
- package/es/utils/getMaxLabelLength.d.mts +13 -0
- package/es/utils/getMaxLabelLength.mjs +48 -0
- package/es/utils/getMaxLabelLength.mjs.map +1 -0
- package/es/utils/{index.d.ts → index.d.mts} +4 -1
- package/es/utils/index.mjs +19 -0
- package/es/utils/index.mjs.map +1 -0
- package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
- package/es/utils/theme.mjs +33 -0
- package/es/utils/theme.mjs.map +1 -0
- package/package.json +22 -4
- package/es/AccuracyBarChart/index.d.ts +0 -60
- package/es/AccuracyBarChart/index.js +0 -454
- package/es/AccuracyBarChart/index.mdx +0 -52
- package/es/AccuracyBarChart/styles.d.ts +0 -11
- package/es/AccuracyBarChart/styles.js +0 -18
- package/es/AreaChart/index.d.ts +0 -11
- package/es/AreaChart/index.js +0 -430
- package/es/AreaChart/index.mdx +0 -49
- package/es/AreaChart/styles.d.ts +0 -6
- package/es/AreaChart/styles.js +0 -13
- package/es/BarChart/index.d.ts +0 -9
- package/es/BarChart/index.js +0 -392
- package/es/BarChart/index.mdx +0 -73
- package/es/BarChart/renderShape.js +0 -34
- package/es/BarChart/styles.d.ts +0 -6
- package/es/BarChart/styles.js +0 -13
- package/es/BarList/index.d.ts +0 -29
- package/es/BarList/index.js +0 -174
- package/es/BarList/index.mdx +0 -34
- package/es/BarList/styles.d.ts +0 -10
- package/es/BarList/styles.js +0 -18
- package/es/BenchmarkColumnChart/index.d.ts +0 -140
- package/es/BenchmarkColumnChart/index.js +0 -686
- package/es/BenchmarkColumnChart/index.mdx +0 -66
- package/es/BenchmarkColumnChart/styles.d.ts +0 -16
- package/es/BenchmarkColumnChart/styles.js +0 -23
- package/es/BenchmarkRankingChart/index.d.ts +0 -87
- package/es/BenchmarkRankingChart/index.js +0 -455
- package/es/BenchmarkRankingChart/index.mdx +0 -59
- package/es/BenchmarkRankingChart/styles.d.ts +0 -33
- package/es/BenchmarkRankingChart/styles.js +0 -41
- package/es/BenchmarkScatterChart/index.d.ts +0 -145
- package/es/BenchmarkScatterChart/index.js +0 -857
- package/es/BenchmarkScatterChart/index.mdx +0 -61
- package/es/BenchmarkScatterChart/styles.d.ts +0 -25
- package/es/BenchmarkScatterChart/styles.js +0 -33
- package/es/BenchmarkScatterChart/utils.js +0 -353
- package/es/ComposedChart/index.d.ts +0 -5
- package/es/ComposedChart/index.js +0 -335
- package/es/ComposedChart/index.mdx +0 -43
- package/es/ComposedChart/styles.d.ts +0 -6
- package/es/ComposedChart/styles.js +0 -13
- package/es/ComposedChart/types.d.ts +0 -68
- package/es/ComposedChart/types.js +0 -1
- package/es/DataBars/CategoryBar.d.ts +0 -15
- package/es/DataBars/CategoryBar.js +0 -201
- package/es/DataBars/DeltaBar.d.ts +0 -13
- package/es/DataBars/DeltaBar.js +0 -117
- package/es/DataBars/MarkerBar.d.ts +0 -16
- package/es/DataBars/MarkerBar.js +0 -94
- package/es/DataBars/ProgressBar.d.ts +0 -12
- package/es/DataBars/ProgressBar.js +0 -71
- package/es/DataBars/index.d.ts +0 -4
- package/es/DataBars/index.js +0 -4
- package/es/DataBars/index.mdx +0 -36
- package/es/DataBars/styles.d.ts +0 -7
- package/es/DataBars/styles.js +0 -14
- package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
- package/es/DonutChart/DonutChartTooltip.js +0 -26
- package/es/DonutChart/index.d.ts +0 -31
- package/es/DonutChart/index.js +0 -232
- package/es/DonutChart/index.mdx +0 -48
- package/es/DonutChart/inputParser.d.ts +0 -2
- package/es/DonutChart/inputParser.js +0 -9
- package/es/DonutChart/renderInactiveShape.d.ts +0 -2
- package/es/DonutChart/renderInactiveShape.js +0 -27
- package/es/DonutChart/styles.d.ts +0 -6
- package/es/DonutChart/styles.js +0 -13
- package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
- package/es/FunnelChart/ArrowRightIcon.js +0 -22
- package/es/FunnelChart/index.d.ts +0 -19
- package/es/FunnelChart/index.js +0 -499
- package/es/FunnelChart/index.mdx +0 -21
- package/es/FunnelChart/styles.d.ts +0 -6
- package/es/FunnelChart/styles.js +0 -13
- package/es/FunnelChart/types.d.ts +0 -28
- package/es/FunnelChart/types.js +0 -1
- package/es/Heatmaps/Calendar.d.ts +0 -18
- package/es/Heatmaps/Calendar.js +0 -155
- package/es/Heatmaps/ChartLabels.d.ts +0 -15
- package/es/Heatmaps/ChartLabels.js +0 -106
- package/es/Heatmaps/Footer.d.ts +0 -22
- package/es/Heatmaps/Footer.js +0 -105
- package/es/Heatmaps/index.d.ts +0 -28
- package/es/Heatmaps/index.js +0 -227
- package/es/Heatmaps/index.mdx +0 -70
- package/es/Heatmaps/styles.d.ts +0 -7
- package/es/Heatmaps/styles.js +0 -14
- package/es/Legend/LegendItem.d.ts +0 -10
- package/es/Legend/LegendItem.js +0 -58
- package/es/Legend/ScrollButton.d.ts +0 -9
- package/es/Legend/ScrollButton.js +0 -63
- package/es/Legend/index.d.ts +0 -14
- package/es/Legend/index.js +0 -184
- package/es/Legend/index.mdx +0 -13
- package/es/LineChart/index.d.ts +0 -9
- package/es/LineChart/index.js +0 -388
- package/es/LineChart/index.mdx +0 -49
- package/es/LineChart/styles.d.ts +0 -6
- package/es/LineChart/styles.js +0 -13
- package/es/RadarChart/index.d.ts +0 -24
- package/es/RadarChart/index.js +0 -254
- package/es/RadarChart/index.mdx +0 -52
- package/es/RadarChart/styles.d.ts +0 -5
- package/es/RadarChart/styles.js +0 -12
- package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
- package/es/ScatterChart/ScatterChartTooltip.js +0 -76
- package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
- package/es/ScatterChart/ScatterChartTooltipRow.js +0 -40
- package/es/ScatterChart/index.d.ts +0 -56
- package/es/ScatterChart/index.js +0 -342
- package/es/ScatterChart/index.mdx +0 -49
- package/es/ScatterChart/renderShape.js +0 -18
- package/es/ScatterChart/styles.d.ts +0 -6
- package/es/ScatterChart/styles.js +0 -13
- package/es/SparkChart/SparkAreaChart.d.ts +0 -12
- package/es/SparkChart/SparkAreaChart.js +0 -148
- package/es/SparkChart/SparkBarChart.d.ts +0 -9
- package/es/SparkChart/SparkBarChart.js +0 -106
- package/es/SparkChart/SparkLineChart.d.ts +0 -10
- package/es/SparkChart/SparkLineChart.js +0 -110
- package/es/SparkChart/index.d.ts +0 -3
- package/es/SparkChart/index.js +0 -3
- package/es/SparkChart/index.mdx +0 -29
- package/es/Tracker/TrackerBlock.d.ts +0 -8
- package/es/Tracker/TrackerBlock.js +0 -64
- package/es/Tracker/index.d.ts +0 -18
- package/es/Tracker/index.js +0 -105
- package/es/Tracker/index.mdx +0 -41
- package/es/Tracker/styles.d.ts +0 -5
- package/es/Tracker/styles.js +0 -12
- package/es/common/BaseAnimationTimingProps.d.ts +0 -7
- package/es/common/BaseAnimationTimingProps.js +0 -1
- package/es/common/BaseChartProps.d.ts +0 -58
- package/es/common/BaseChartProps.js +0 -1
- package/es/common/BaseSparkChartProps.d.ts +0 -14
- package/es/common/BaseSparkChartProps.js +0 -1
- package/es/common/ChartLegend.d.ts +0 -5
- package/es/common/ChartLegend.js +0 -40
- package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
- package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -32
- package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
- package/es/common/ChartTooltip/ChartTooltipRow.js +0 -55
- package/es/common/ChartTooltip/index.d.ts +0 -15
- package/es/common/ChartTooltip/index.js +0 -66
- package/es/common/CustomTooltipProps.d.ts +0 -12
- package/es/common/CustomTooltipProps.js +0 -1
- package/es/common/CustomYAxisTick.d.ts +0 -15
- package/es/common/CustomYAxisTick.js +0 -27
- package/es/common/NoData.d.ts +0 -10
- package/es/common/NoData.js +0 -24
- package/es/common/benchmark/index.d.ts +0 -2
- package/es/common/benchmark/types.d.ts +0 -122
- package/es/common/benchmark/types.js +0 -1
- package/es/common/benchmark/utils.js +0 -159
- package/es/common/utils.js +0 -85
- package/es/hooks/useOnWindowResize.d.ts +0 -3
- package/es/hooks/useOnWindowResize.js +0 -15
- package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
- package/es/hooks/usePrefersReducedMotion.js +0 -28
- package/es/hooks/useThemeColorRange.d.ts +0 -1
- package/es/hooks/useThemeColorRange.js +0 -8
- package/es/index.d.ts +0 -24
- package/es/index.js +0 -22
- package/es/types/charts.js +0 -8
- package/es/types/global.d.ts +0 -9
- package/es/utils/calendar.js +0 -199
- package/es/utils/getMaxLabelLength.d.ts +0 -10
- package/es/utils/getMaxLabelLength.js +0 -110
- package/es/utils/index.js +0 -32
- package/es/utils/theme.js +0 -40
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Flexbox, Icon } from "@lobehub/ui";
|
|
2
|
+
import { Text } from "@lobehub/ui/base-ui";
|
|
3
|
+
import { createStaticStyles } from "antd-style";
|
|
4
|
+
import { memo } from "react";
|
|
5
|
+
import { Circle } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/common/ChartTooltip/ChartTooltipRow.tsx
|
|
8
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
9
|
+
number: css`
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
`,
|
|
14
|
+
title: css`
|
|
15
|
+
color: ${cssVar.colorTextSecondary};
|
|
16
|
+
`
|
|
17
|
+
}));
|
|
18
|
+
const ChartTooltipRow = memo(({ value, name, color }) => {
|
|
19
|
+
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
20
|
+
align: "center",
|
|
21
|
+
gap: 32,
|
|
22
|
+
horizontal: true,
|
|
23
|
+
justify: "space-between",
|
|
24
|
+
width: "max-content",
|
|
25
|
+
children: [/* @__PURE__ */ jsxs(Flexbox, {
|
|
26
|
+
align: "center",
|
|
27
|
+
gap: 8,
|
|
28
|
+
horizontal: true,
|
|
29
|
+
width: "auto",
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
31
|
+
color,
|
|
32
|
+
fill: color,
|
|
33
|
+
icon: Circle,
|
|
34
|
+
size: 10
|
|
35
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
36
|
+
className: styles.title,
|
|
37
|
+
ellipsis: true,
|
|
38
|
+
style: { margin: 0 },
|
|
39
|
+
children: name
|
|
40
|
+
})]
|
|
41
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
42
|
+
className: styles.number,
|
|
43
|
+
style: { margin: 0 },
|
|
44
|
+
children: value
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { ChartTooltipRow as default };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=ChartTooltipRow.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartTooltipRow.mjs","names":[],"sources":["../../../src/common/ChartTooltip/ChartTooltipRow.tsx"],"sourcesContent":["import { Flexbox, Icon } from '@lobehub/ui';\nimport { Text } from '@lobehub/ui/base-ui';\nimport { createStaticStyles } from 'antd-style';\nimport { Circle } from 'lucide-react';\nimport { memo } from 'react';\n\nconst styles = createStaticStyles(({ css, cssVar }) => ({\n number: css`\n flex-shrink: 0;\n font-weight: 500;\n white-space: nowrap;\n `,\n title: css`\n color: ${cssVar.colorTextSecondary};\n `,\n}));\nexport interface ChartTooltipRowProps {\n color: string;\n name: string;\n value: string;\n}\n\nconst ChartTooltipRow = memo<ChartTooltipRowProps>(({ value, name, color }) => {\n return (\n <Flexbox align={'center'} gap={32} horizontal justify={'space-between'} width={'max-content'}>\n <Flexbox align={'center'} gap={8} horizontal width={'auto'}>\n <Icon color={color} fill={color} icon={Circle} size={10} />\n <Text className={styles.title} ellipsis style={{ margin: 0 }}>\n {name}\n </Text>\n </Flexbox>\n <Text className={styles.number} style={{ margin: 0 }}>\n {value}\n </Text>\n </Flexbox>\n );\n});\n\nexport default ChartTooltipRow;\n"],"mappings":";;;;;;;AAMA,MAAM,SAAS,oBAAoB,EAAE,KAAK,cAAc;CACtD,QAAQ,GAAG;;;;;CAKX,OAAO,GAAG;aACC,OAAO,mBAAmB;;AAEvC,EAAE;AAOF,MAAM,kBAAkB,MAA4B,EAAE,OAAO,MAAM,YAAY;CAC7E,OACE,qBAAC,SAAD;EAAS,OAAO;EAAU,KAAK;EAAI,YAAA;EAAW,SAAS;EAAiB,OAAO;EAA/E,UAAA,CACE,qBAAC,SAAD;GAAS,OAAO;GAAU,KAAK;GAAG,YAAA;GAAW,OAAO;GAApD,UAAA,CACE,oBAAC,MAAD;IAAa;IAAO,MAAM;IAAO,MAAM;IAAQ,MAAM;GAAK,CAAA,GAC1D,oBAAC,MAAD;IAAM,WAAW,OAAO;IAAO,UAAA;IAAS,OAAO,EAAE,QAAQ,EAAE;IACxD,UAAA;GACG,CAAA,CACC;EACT,CAAA,GAAA,oBAAC,MAAD;GAAM,WAAW,OAAO;GAAQ,OAAO,EAAE,QAAQ,EAAE;GAChD,UAAA;EACG,CAAA,CACC;;AAEb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValueFormatter } from "../../types/charts.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/common/ChartTooltip/index.d.ts
|
|
4
|
+
export interface ChartTooltipProps {
|
|
5
|
+
active: boolean | undefined;
|
|
6
|
+
categoryColors: Map<string, string>;
|
|
7
|
+
customCategories?: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
label: string;
|
|
12
|
+
payload: any;
|
|
13
|
+
valueFormatter: ValueFormatter | ((value: number, name?: string) => string);
|
|
14
|
+
}
|
|
15
|
+
declare const ChartTooltip: ({ active, payload, label, categoryColors, valueFormatter, customCategories, footer }: ChartTooltipProps) => import("react").JSX.Element | null;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ChartTooltip as default };
|
|
18
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ChartTooltipFrame } from "./ChartTooltipFrame.mjs";
|
|
2
|
+
import ChartTooltipRow from "./ChartTooltipRow.mjs";
|
|
3
|
+
import { Flexbox } from "@lobehub/ui";
|
|
4
|
+
import { Text } from "@lobehub/ui/base-ui";
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from "antd-style";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/common/ChartTooltip/index.tsx
|
|
8
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({ header: css`
|
|
9
|
+
border-bottom: 1px solid ${cssVar.colorBorderSecondary};
|
|
10
|
+
font-weight: 500;
|
|
11
|
+
` }));
|
|
12
|
+
const ChartTooltip = ({ active, payload, label, categoryColors, valueFormatter, customCategories, footer }) => {
|
|
13
|
+
if (active && payload) {
|
|
14
|
+
const filteredPayload = payload.filter((item) => item.type !== "none");
|
|
15
|
+
return /* @__PURE__ */ jsxs(ChartTooltipFrame, { children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Flexbox, {
|
|
17
|
+
className: cx(styles.header),
|
|
18
|
+
paddingBlock: 8,
|
|
19
|
+
paddingInline: 16,
|
|
20
|
+
width: "auto",
|
|
21
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
22
|
+
ellipsis: true,
|
|
23
|
+
style: { margin: 0 },
|
|
24
|
+
children: label
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsx(Flexbox, {
|
|
28
|
+
gap: 4,
|
|
29
|
+
paddingBlock: 8,
|
|
30
|
+
paddingInline: 16,
|
|
31
|
+
style: {
|
|
32
|
+
flexDirection: "column-reverse",
|
|
33
|
+
marginTop: 4
|
|
34
|
+
},
|
|
35
|
+
width: "auto",
|
|
36
|
+
children: filteredPayload.map(({ value, name }, idx) => /* @__PURE__ */ jsx(ChartTooltipRow, {
|
|
37
|
+
color: categoryColors.get(name) ?? cssVar.colorPrimary,
|
|
38
|
+
name: customCategories?.[name] || name,
|
|
39
|
+
value: valueFormatter(value, name)
|
|
40
|
+
}, `id-${idx}`))
|
|
41
|
+
}),
|
|
42
|
+
footer
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { ChartTooltip as default };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/common/ChartTooltip/index.tsx"],"sourcesContent":["import { Flexbox } from '@lobehub/ui';\nimport { Text } from '@lobehub/ui/base-ui';\nimport { createStaticStyles, cssVar, cx } from 'antd-style';\nimport { ReactNode } from 'react';\n\nimport { ValueFormatter } from '@/types/charts';\n\nimport ChartTooltipFrame from './ChartTooltipFrame';\nimport ChartTooltipRow from './ChartTooltipRow';\n\nconst styles = createStaticStyles(({ css, cssVar }) => ({\n header: css`\n border-bottom: 1px solid ${cssVar.colorBorderSecondary};\n font-weight: 500;\n `,\n}));\n\nexport interface ChartTooltipProps {\n active: boolean | undefined;\n categoryColors: Map<string, string>;\n customCategories?: {\n [key: string]: string;\n };\n footer?: ReactNode;\n label: string;\n payload: any;\n valueFormatter: ValueFormatter | ((value: number, name?: string) => string);\n}\n\nconst ChartTooltip = ({\n active,\n payload,\n label,\n categoryColors,\n valueFormatter,\n customCategories,\n footer,\n}: ChartTooltipProps) => {\n if (active && payload) {\n const filteredPayload = payload.filter((item: any) => item.type !== 'none');\n\n return (\n <ChartTooltipFrame>\n <Flexbox className={cx(styles.header)} paddingBlock={8} paddingInline={16} width={'auto'}>\n <Text ellipsis style={{ margin: 0 }}>\n {label}\n </Text>\n </Flexbox>\n <Flexbox\n gap={4}\n paddingBlock={8}\n paddingInline={16}\n style={{ flexDirection: 'column-reverse', marginTop: 4 }}\n width={'auto'}\n >\n {filteredPayload.map(({ value, name }: { name: string; value: number }, idx: number) => (\n <ChartTooltipRow\n color={categoryColors.get(name) ?? cssVar.colorPrimary}\n key={`id-${idx}`}\n name={customCategories?.[name] || name}\n value={valueFormatter(value, name)}\n />\n ))}\n </Flexbox>\n {footer}\n </ChartTooltipFrame>\n );\n }\n return null;\n};\n\nexport default ChartTooltip;\n"],"mappings":";;;;;;;AAUA,MAAM,SAAS,oBAAoB,EAAE,KAAK,cAAc,EACtD,QAAQ,GAAG;+BACkB,OAAO,qBAAqB;;IAG3D,EAAE;AAcF,MAAM,gBAAgB,EACpB,QACA,SACA,OACA,gBACA,gBACA,kBACA,aACuB;CACvB,IAAI,UAAU,SAAS;EACrB,MAAM,kBAAkB,QAAQ,QAAQ,SAAc,KAAK,SAAS,MAAM;EAE1E,OACE,qBAAC,mBAAD,EAAA,UAAA;GACE,oBAAC,SAAD;IAAS,WAAW,GAAG,OAAO,MAAM;IAAG,cAAc;IAAG,eAAe;IAAI,OAAO;IAChF,UAAA,oBAAC,MAAD;KAAM,UAAA;KAAS,OAAO,EAAE,QAAQ,EAAE;KAC/B,UAAA;IACG,CAAA;GACC,CAAA;GACT,oBAAC,SAAD;IACE,KAAK;IACL,cAAc;IACd,eAAe;IACf,OAAO;KAAE,eAAe;KAAkB,WAAW;IAAE;IACvD,OAAO;IAEN,UAAA,gBAAgB,KAAK,EAAE,OAAO,QAAyC,QACtE,oBAAC,iBAAD;KACE,OAAO,eAAe,IAAI,IAAI,KAAK,OAAO;KAE1C,MAAM,mBAAmB,SAAS;KAClC,OAAO,eAAe,OAAO,IAAI;IAClC,GAHM,MAAM,KAGZ,CACF;GACM,CAAA;GACR;EACgB,EAAA,CAAA;CAEvB;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ValueFormatter } from "../types/charts.mjs";
|
|
2
|
+
import { ScatterChartValueFormatter } from "../ScatterChart/index.mjs";
|
|
3
|
+
import { NameType, Payload } from "recharts/types/component/DefaultTooltipContent";
|
|
4
|
+
//#region src/common/CustomTooltipProps.d.ts
|
|
5
|
+
export type CustomTooltipProps = {
|
|
6
|
+
active: boolean | undefined;
|
|
7
|
+
customCategories?: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
label: NameType | undefined;
|
|
11
|
+
payload: Payload<string | number | (string | number)[], string | number>[] | undefined;
|
|
12
|
+
valueFormatter: ValueFormatter | ScatterChartValueFormatter;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=CustomTooltipProps.d.mts.map
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValueFormatter } from "../types/charts.mjs";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/common/CustomYAxisTick.d.ts
|
|
4
|
+
interface CustomYAxisTickProps {
|
|
5
|
+
align: 'left' | 'right';
|
|
6
|
+
anchor?: 'end' | 'middle' | 'start';
|
|
7
|
+
formatter: ValueFormatter;
|
|
8
|
+
payload: {
|
|
9
|
+
value: number;
|
|
10
|
+
};
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
yAxisLabel?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const CustomYAxisTick: React.NamedExoticComponent<CustomYAxisTickProps>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CustomYAxisTick as default };
|
|
18
|
+
//# sourceMappingURL=CustomYAxisTick.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cssVar } from "antd-style";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/common/CustomYAxisTick.tsx
|
|
5
|
+
const CustomYAxisTick = memo(({ yAxisLabel, x, y, payload, align, formatter, anchor }) => {
|
|
6
|
+
const yAxisLabelWidth = yAxisLabel ? 24 : 0;
|
|
7
|
+
const resolvedTextAnchor = anchor ?? (align === "left" ? "start" : "end");
|
|
8
|
+
return /* @__PURE__ */ jsx("g", {
|
|
9
|
+
transform: `translate(${align === "left" ? yAxisLabelWidth : x + yAxisLabelWidth},${y})`,
|
|
10
|
+
children: /* @__PURE__ */ jsx("text", {
|
|
11
|
+
dy: 4,
|
|
12
|
+
fill: cssVar.colorTextDescription,
|
|
13
|
+
fontSize: 12,
|
|
14
|
+
textAnchor: resolvedTextAnchor,
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0,
|
|
17
|
+
children: formatter(payload.value)
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CustomYAxisTick as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=CustomYAxisTick.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomYAxisTick.mjs","names":[],"sources":["../../src/common/CustomYAxisTick.tsx"],"sourcesContent":["import { cssVar } from 'antd-style';\nimport React, { memo } from 'react';\n\nimport { ValueFormatter } from '@/types/charts';\n\ninterface CustomYAxisTickProps {\n align: 'left' | 'right';\n anchor?: 'end' | 'middle' | 'start';\n formatter: ValueFormatter;\n\n payload: {\n value: number;\n };\n\n x: number;\n y: number;\n yAxisLabel?: boolean;\n}\n\nconst CustomYAxisTick = memo<CustomYAxisTickProps>(\n ({ yAxisLabel, x, y, payload, align, formatter, anchor }) => {\n const yAxisLabelWidth = yAxisLabel ? 24 : 0;\n const resolvedTextAnchor = anchor ?? (align === 'left' ? 'start' : 'end');\n\n return (\n <g transform={`translate(${align === 'left' ? yAxisLabelWidth : x + yAxisLabelWidth},${y})`}>\n <text\n dy={4}\n fill={cssVar.colorTextDescription}\n fontSize={12}\n textAnchor={resolvedTextAnchor}\n x={0}\n y={0}\n >\n {formatter(payload.value)}\n </text>\n </g>\n );\n },\n);\n\nexport default CustomYAxisTick;\n"],"mappings":";;;;AAmBA,MAAM,kBAAkB,MACrB,EAAE,YAAY,GAAG,GAAG,SAAS,OAAO,WAAW,aAAa;CAC3D,MAAM,kBAAkB,aAAa,KAAK;CAC1C,MAAM,qBAAqB,WAAW,UAAU,SAAS,UAAU;CAEnE,OACE,oBAAC,KAAD;EAAG,WAAW,aAAa,UAAU,SAAS,kBAAkB,IAAI,gBAAgB,GAAG,EAAE;EACvF,UAAA,oBAAC,QAAD;GACE,IAAI;GACJ,MAAM,OAAO;GACb,UAAU;GACV,YAAY;GACZ,GAAG;GACH,GAAG;GAEF,UAAA,UAAU,QAAQ,KAAK;EACpB,CAAA;CACL,CAAA;AAEP,CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/common/NoData.d.ts
|
|
3
|
+
export interface NoDataProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
noDataText?: ReactNode | {
|
|
6
|
+
desc: ReactNode;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare const NoData: import("react").NamedExoticComponent<NoDataProps>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { NoData as default };
|
|
13
|
+
//# sourceMappingURL=NoData.d.mts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Center, Empty } from "@lobehub/ui";
|
|
2
|
+
import { isValidElement, memo } from "react";
|
|
3
|
+
import { Inbox } from "lucide-react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/common/NoData.tsx
|
|
6
|
+
const NoData = memo(({ noDataText = {
|
|
7
|
+
desc: "There's no data available for your selection.",
|
|
8
|
+
title: "No Data"
|
|
9
|
+
}, className }) => {
|
|
10
|
+
const isReactNodeText = isValidElement(noDataText);
|
|
11
|
+
return /* @__PURE__ */ jsx(Center, {
|
|
12
|
+
height: "100%",
|
|
13
|
+
width: "100%",
|
|
14
|
+
children: /* @__PURE__ */ jsx(Empty, {
|
|
15
|
+
className,
|
|
16
|
+
description: isReactNodeText ? noDataText : noDataText?.desc,
|
|
17
|
+
icon: Inbox,
|
|
18
|
+
title: isReactNodeText ? void 0 : noDataText?.title
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { NoData as default };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=NoData.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoData.mjs","names":[],"sources":["../../src/common/NoData.tsx"],"sourcesContent":["import { Center, Empty } from '@lobehub/ui';\nimport { Inbox } from 'lucide-react';\nimport { ReactNode, isValidElement, memo } from 'react';\n\nexport interface NoDataProps {\n className?: string;\n noDataText?:\n | ReactNode\n | {\n desc: ReactNode;\n title: ReactNode;\n };\n}\n\nconst NoData = memo<NoDataProps>(\n ({\n noDataText = {\n desc: \"There's no data available for your selection.\",\n title: 'No Data',\n },\n className,\n }) => {\n const isReactNodeText = isValidElement(noDataText);\n return (\n <Center height={'100%'} width={'100%'}>\n <Empty\n className={className}\n description={isReactNodeText ? noDataText : (noDataText as any)?.desc}\n icon={Inbox}\n title={isReactNodeText ? undefined : (noDataText as any)?.title}\n />\n </Center>\n );\n },\n);\n\nexport default NoData;\n"],"mappings":";;;;;AAcA,MAAM,SAAS,MACZ,EACC,aAAa;CACX,MAAM;CACN,OAAO;AACT,GACA,gBACI;CACJ,MAAM,kBAAkB,eAAe,UAAU;CACjD,OACE,oBAAC,QAAD;EAAQ,QAAQ;EAAQ,OAAO;EAC7B,UAAA,oBAAC,OAAD;GACa;GACX,aAAa,kBAAkB,aAAc,YAAoB;GACjE,MAAM;GACN,OAAO,kBAAkB,KAAA,IAAa,YAAoB;EAC3D,CAAA;CACK,CAAA;AAEZ,CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BenchmarkBaseProps, BenchmarkEventProps, BenchmarkFieldKeys, BenchmarkPointShape, BenchmarkRecord, BenchmarkRenderIcon, NormalizedBenchmarkItem } from "./types.mjs";
|
|
2
|
+
import { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel } from "./utils.mjs";
|
|
3
|
+
export { type BenchmarkBaseProps, type BenchmarkEventProps, type BenchmarkFieldKeys, type BenchmarkPointShape, type BenchmarkRecord, type BenchmarkRenderIcon, DEFAULT_BENCHMARK_KEYS, type NormalizedBenchmarkItem, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel } from "./utils";
|
|
1
|
+
export { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel } from "./utils.mjs";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { NoDataProps } from "../NoData.mjs";
|
|
2
|
+
import { ValueFormatter } from "../../types/charts.mjs";
|
|
3
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
4
|
+
//#region src/common/benchmark/types.d.ts
|
|
5
|
+
export interface BenchmarkRecord {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
color?: string;
|
|
8
|
+
error?: number;
|
|
9
|
+
highlighted?: boolean;
|
|
10
|
+
href?: string;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
key?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Secondary line-series value (e.g. Pass¹ overall rate)
|
|
15
|
+
*/
|
|
16
|
+
line?: number;
|
|
17
|
+
name?: ReactNode;
|
|
18
|
+
provider?: ReactNode;
|
|
19
|
+
rank?: number;
|
|
20
|
+
score?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Marker shape used by scatter-style charts when no icon is provided
|
|
23
|
+
*/
|
|
24
|
+
shape?: BenchmarkPointShape;
|
|
25
|
+
target?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Place item after a visual separator; line series does not connect into it
|
|
28
|
+
*/
|
|
29
|
+
unranked?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type BenchmarkPointShape = 'circle' | 'square' | 'diamond' | 'triangle';
|
|
32
|
+
export type BenchmarkRenderIcon = (record: BenchmarkRecord, index: number) => ReactNode;
|
|
33
|
+
export type BenchmarkEventProps = (BenchmarkRecord & {
|
|
34
|
+
eventType: 'bar' | 'row' | 'point';
|
|
35
|
+
value: number;
|
|
36
|
+
}) | null | undefined;
|
|
37
|
+
export interface BenchmarkFieldKeys {
|
|
38
|
+
/**
|
|
39
|
+
* Per-item bar color field
|
|
40
|
+
* @default 'color'
|
|
41
|
+
*/
|
|
42
|
+
colorKey?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Error / uncertainty field (AccuracyBar-style ± display)
|
|
45
|
+
* @default 'error'
|
|
46
|
+
*/
|
|
47
|
+
errorKey?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Icon field; value should be a ReactNode provided by the consumer
|
|
50
|
+
* @default 'icon'
|
|
51
|
+
*/
|
|
52
|
+
iconKey?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Model / entry name field
|
|
55
|
+
* @default 'name'
|
|
56
|
+
*/
|
|
57
|
+
index?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Secondary line-series field
|
|
60
|
+
* @default 'line'
|
|
61
|
+
*/
|
|
62
|
+
lineKey?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Provider / organization field
|
|
65
|
+
* @default 'provider'
|
|
66
|
+
*/
|
|
67
|
+
providerKey?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Numeric score field
|
|
70
|
+
* @default 'score'
|
|
71
|
+
*/
|
|
72
|
+
valueKey?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface BenchmarkBaseProps extends BenchmarkFieldKeys, Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
75
|
+
/**
|
|
76
|
+
* Accuracy-style value formatter (e.g. `52.0%`). Falls back to `valueFormatter`.
|
|
77
|
+
*/
|
|
78
|
+
accuracyFormatter?: (value: number) => string;
|
|
79
|
+
data?: BenchmarkRecord[];
|
|
80
|
+
/**
|
|
81
|
+
* Formats the ± error segment
|
|
82
|
+
* @default (n) => n.toFixed(1)
|
|
83
|
+
*/
|
|
84
|
+
errorFormatter?: (value: number) => string;
|
|
85
|
+
height?: string | number;
|
|
86
|
+
/**
|
|
87
|
+
* Text accent color when an item has `highlighted: true` (does not change bar fill)
|
|
88
|
+
* @default theme.gold
|
|
89
|
+
*/
|
|
90
|
+
highlightColor?: string;
|
|
91
|
+
loading?: boolean;
|
|
92
|
+
noDataText?: NoDataProps['noDataText'];
|
|
93
|
+
onValueChange?: (value: BenchmarkEventProps) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Optional icon renderer that overrides `iconKey`
|
|
96
|
+
*/
|
|
97
|
+
renderIcon?: BenchmarkRenderIcon;
|
|
98
|
+
showAnimation?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Show AccuracyBar-style ± error next to values / error bars
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
showError?: boolean;
|
|
104
|
+
sortOrder?: 'ascending' | 'descending' | 'none';
|
|
105
|
+
valueFormatter?: ValueFormatter;
|
|
106
|
+
width?: string | number;
|
|
107
|
+
}
|
|
108
|
+
export interface NormalizedBenchmarkItem {
|
|
109
|
+
color?: string;
|
|
110
|
+
error?: number;
|
|
111
|
+
highlighted?: boolean;
|
|
112
|
+
href?: string;
|
|
113
|
+
icon?: ReactNode;
|
|
114
|
+
key: string | number;
|
|
115
|
+
lineValue?: number;
|
|
116
|
+
name: ReactNode;
|
|
117
|
+
original: BenchmarkRecord;
|
|
118
|
+
provider?: ReactNode;
|
|
119
|
+
rank: number;
|
|
120
|
+
target?: string;
|
|
121
|
+
unranked?: boolean;
|
|
122
|
+
value: number;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//# sourceMappingURL=types.d.mts.map
|
|
File without changes
|
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BenchmarkFieldKeys, BenchmarkRecord, BenchmarkRenderIcon, NormalizedBenchmarkItem } from "./types.mjs";
|
|
2
|
+
//#region src/common/benchmark/utils.d.ts
|
|
3
3
|
export declare const DEFAULT_BENCHMARK_KEYS: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
readonly colorKey: "color";
|
|
5
|
+
readonly errorKey: "error";
|
|
6
|
+
readonly iconKey: "icon";
|
|
7
|
+
readonly index: "name";
|
|
8
|
+
readonly lineKey: "line";
|
|
9
|
+
readonly providerKey: "provider";
|
|
10
|
+
readonly valueKey: "score";
|
|
11
11
|
};
|
|
12
12
|
export declare const resolveBenchmarkKeys: (keys?: BenchmarkFieldKeys) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
colorKey: string;
|
|
14
|
+
errorKey: string;
|
|
15
|
+
iconKey: string;
|
|
16
|
+
index: string;
|
|
17
|
+
lineKey: string;
|
|
18
|
+
providerKey: string;
|
|
19
|
+
valueKey: string;
|
|
20
20
|
};
|
|
21
21
|
export declare const getBenchmarkIcon: (record: BenchmarkRecord, iconKey: string, renderIcon?: BenchmarkRenderIcon, index?: number) => import("react").ReactNode;
|
|
22
|
-
export declare const normalizeBenchmarkData: ({ colorKey, data, errorKey, iconKey, index, lineKey, providerKey, renderIcon, sortOrder, valueKey
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export declare const normalizeBenchmarkData: ({ colorKey, data, errorKey, iconKey, index, lineKey, providerKey, renderIcon, sortOrder, valueKey }: BenchmarkFieldKeys & {
|
|
23
|
+
data: BenchmarkRecord[];
|
|
24
|
+
renderIcon?: BenchmarkRenderIcon;
|
|
25
|
+
sortOrder?: "ascending" | "descending" | "none";
|
|
26
26
|
}) => NormalizedBenchmarkItem[];
|
|
27
27
|
export declare const getBenchmarkMaxValue: (items: NormalizedBenchmarkItem[], maxValue?: number) => number;
|
|
28
28
|
export declare const getBenchmarkBarPercent: (value: number, maxValue: number, minPercent?: number) => number;
|
|
29
29
|
export declare const defaultBenchmarkValueFormatter: (value: number) => string;
|
|
30
30
|
export declare const defaultBenchmarkAccuracyFormatter: (value: number) => string;
|
|
31
31
|
export declare const defaultBenchmarkErrorFormatter: (value: number) => string;
|
|
32
|
-
export declare const formatBenchmarkAccuracyDisplay: ({ accuracyFormatter, error, errorFormatter, showError, value, valueFormatter
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
export declare const formatBenchmarkAccuracyDisplay: ({ accuracyFormatter, error, errorFormatter, showError, value, valueFormatter }: {
|
|
33
|
+
accuracyFormatter?: (value: number) => string;
|
|
34
|
+
error?: number;
|
|
35
|
+
errorFormatter?: (value: number) => string;
|
|
36
|
+
showError?: boolean;
|
|
37
|
+
value: number;
|
|
38
|
+
valueFormatter?: (value: number) => string;
|
|
39
39
|
}) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
errorText: undefined;
|
|
41
|
+
main: string;
|
|
42
|
+
text: string;
|
|
43
43
|
} | {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
errorText: string;
|
|
45
|
+
main: string;
|
|
46
|
+
text: string;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
49
|
* Split a label into lines. Supports `\n` / `\r\n`.
|
|
50
50
|
*/
|
|
51
51
|
export declare const splitBenchmarkLabel: (label: unknown) => string[];
|
|
52
52
|
export declare const getBenchmarkLabelMetrics: (label: unknown) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
lineCount: number;
|
|
54
|
+
lines: string[];
|
|
55
|
+
longestWidth: number;
|
|
56
56
|
};
|
|
57
|
+
//#endregion
|
|
58
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { getTextWidth } from "../../utils/getMaxLabelLength.mjs";
|
|
2
|
+
//#region src/common/benchmark/utils.ts
|
|
3
|
+
const DEFAULT_BENCHMARK_KEYS = {
|
|
4
|
+
colorKey: "color",
|
|
5
|
+
errorKey: "error",
|
|
6
|
+
iconKey: "icon",
|
|
7
|
+
index: "name",
|
|
8
|
+
lineKey: "line",
|
|
9
|
+
providerKey: "provider",
|
|
10
|
+
valueKey: "score"
|
|
11
|
+
};
|
|
12
|
+
const resolveBenchmarkKeys = (keys = {}) => ({
|
|
13
|
+
colorKey: keys.colorKey ?? DEFAULT_BENCHMARK_KEYS.colorKey,
|
|
14
|
+
errorKey: keys.errorKey ?? DEFAULT_BENCHMARK_KEYS.errorKey,
|
|
15
|
+
iconKey: keys.iconKey ?? DEFAULT_BENCHMARK_KEYS.iconKey,
|
|
16
|
+
index: keys.index ?? DEFAULT_BENCHMARK_KEYS.index,
|
|
17
|
+
lineKey: keys.lineKey ?? DEFAULT_BENCHMARK_KEYS.lineKey,
|
|
18
|
+
providerKey: keys.providerKey ?? DEFAULT_BENCHMARK_KEYS.providerKey,
|
|
19
|
+
valueKey: keys.valueKey ?? DEFAULT_BENCHMARK_KEYS.valueKey
|
|
20
|
+
});
|
|
21
|
+
const getBenchmarkIcon = (record, iconKey, renderIcon, index = 0) => {
|
|
22
|
+
if (renderIcon) return renderIcon(record, index);
|
|
23
|
+
return record[iconKey];
|
|
24
|
+
};
|
|
25
|
+
const normalizeBenchmarkData = ({ colorKey, data, errorKey, iconKey, index, lineKey, providerKey, renderIcon, sortOrder = "descending", valueKey }) => {
|
|
26
|
+
const keys = resolveBenchmarkKeys({
|
|
27
|
+
colorKey,
|
|
28
|
+
errorKey,
|
|
29
|
+
iconKey,
|
|
30
|
+
index,
|
|
31
|
+
lineKey,
|
|
32
|
+
providerKey,
|
|
33
|
+
valueKey
|
|
34
|
+
});
|
|
35
|
+
return (sortOrder === "none" ? [...data] : [...data].sort((a, b) => {
|
|
36
|
+
const aUnranked = Boolean(a.unranked);
|
|
37
|
+
if (aUnranked !== Boolean(b.unranked)) return aUnranked ? 1 : -1;
|
|
38
|
+
const aValue = Number(a[keys.valueKey] ?? 0);
|
|
39
|
+
const bValue = Number(b[keys.valueKey] ?? 0);
|
|
40
|
+
return sortOrder === "ascending" ? aValue - bValue : bValue - aValue;
|
|
41
|
+
})).map((record, idx) => {
|
|
42
|
+
const name = record[keys.index] ?? record.name ?? "";
|
|
43
|
+
const value = Number(record[keys.valueKey] ?? 0);
|
|
44
|
+
const rank = typeof record.rank === "number" ? record.rank : idx + 1;
|
|
45
|
+
const rawError = record[keys.errorKey];
|
|
46
|
+
const error = rawError === void 0 || rawError === null || rawError === "" ? void 0 : Number(rawError);
|
|
47
|
+
const rawLine = record[keys.lineKey] ?? record.line;
|
|
48
|
+
const lineValue = rawLine === void 0 || rawLine === null || rawLine === "" ? void 0 : Number(rawLine);
|
|
49
|
+
return {
|
|
50
|
+
color: record[keys.colorKey] ?? record.color,
|
|
51
|
+
error: Number.isFinite(error) ? error : void 0,
|
|
52
|
+
highlighted: Boolean(record.highlighted),
|
|
53
|
+
href: record.href,
|
|
54
|
+
icon: getBenchmarkIcon(record, keys.iconKey, renderIcon, idx),
|
|
55
|
+
key: record.key ?? (name === "" || name === void 0 || name === null ? idx : String(name)),
|
|
56
|
+
lineValue: Number.isFinite(lineValue) ? lineValue : void 0,
|
|
57
|
+
name,
|
|
58
|
+
original: record,
|
|
59
|
+
provider: record[keys.providerKey] ?? record.provider,
|
|
60
|
+
rank,
|
|
61
|
+
target: record.target,
|
|
62
|
+
unranked: Boolean(record.unranked),
|
|
63
|
+
value
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const getBenchmarkMaxValue = (items, maxValue) => {
|
|
68
|
+
if (typeof maxValue === "number") return maxValue;
|
|
69
|
+
return Math.max(...items.flatMap((item) => [item.value, item.lineValue ?? 0]), 0);
|
|
70
|
+
};
|
|
71
|
+
const getBenchmarkBarPercent = (value, maxValue, minPercent = 2) => {
|
|
72
|
+
if (maxValue <= 0 || value <= 0) return 0;
|
|
73
|
+
return Math.max(value / maxValue * 100, minPercent);
|
|
74
|
+
};
|
|
75
|
+
const defaultBenchmarkValueFormatter = (value) => {
|
|
76
|
+
if (Number.isInteger(value)) return String(value);
|
|
77
|
+
return value.toFixed(1);
|
|
78
|
+
};
|
|
79
|
+
const defaultBenchmarkAccuracyFormatter = (value) => `${value.toFixed(1)}%`;
|
|
80
|
+
const defaultBenchmarkErrorFormatter = (value) => value.toFixed(1);
|
|
81
|
+
const formatBenchmarkAccuracyDisplay = ({ accuracyFormatter, error, errorFormatter = defaultBenchmarkErrorFormatter, showError = true, value, valueFormatter = defaultBenchmarkValueFormatter }) => {
|
|
82
|
+
const main = (accuracyFormatter ?? valueFormatter)(value);
|
|
83
|
+
if (!showError || error === void 0 || error === null || Number.isNaN(error)) return {
|
|
84
|
+
errorText: void 0,
|
|
85
|
+
main,
|
|
86
|
+
text: main
|
|
87
|
+
};
|
|
88
|
+
const errorText = errorFormatter(error);
|
|
89
|
+
return {
|
|
90
|
+
errorText,
|
|
91
|
+
main,
|
|
92
|
+
text: `${main} ± ${errorText}`
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Split a label into lines. Supports `\n` / `\r\n`.
|
|
97
|
+
*/
|
|
98
|
+
const splitBenchmarkLabel = (label) => {
|
|
99
|
+
const text = String(label ?? "");
|
|
100
|
+
if (!text) return [""];
|
|
101
|
+
return text.split(/\r?\n/);
|
|
102
|
+
};
|
|
103
|
+
const getBenchmarkLabelMetrics = (label) => {
|
|
104
|
+
const lines = splitBenchmarkLabel(label);
|
|
105
|
+
const longestWidth = lines.reduce((max, line) => Math.max(max, getTextWidth(line)), 0);
|
|
106
|
+
return {
|
|
107
|
+
lineCount: Math.max(lines.length, 1),
|
|
108
|
+
lines,
|
|
109
|
+
longestWidth
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
export { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/common/benchmark/utils.ts"],"sourcesContent":["import { getTextWidth } from '@/utils/getMaxLabelLength';\n\nimport type {\n BenchmarkFieldKeys,\n BenchmarkRecord,\n BenchmarkRenderIcon,\n NormalizedBenchmarkItem,\n} from './types';\n\nexport const DEFAULT_BENCHMARK_KEYS = {\n colorKey: 'color',\n errorKey: 'error',\n iconKey: 'icon',\n index: 'name',\n lineKey: 'line',\n providerKey: 'provider',\n valueKey: 'score',\n} as const;\n\nexport const resolveBenchmarkKeys = (keys: BenchmarkFieldKeys = {}) => ({\n colorKey: keys.colorKey ?? DEFAULT_BENCHMARK_KEYS.colorKey,\n errorKey: keys.errorKey ?? DEFAULT_BENCHMARK_KEYS.errorKey,\n iconKey: keys.iconKey ?? DEFAULT_BENCHMARK_KEYS.iconKey,\n index: keys.index ?? DEFAULT_BENCHMARK_KEYS.index,\n lineKey: keys.lineKey ?? DEFAULT_BENCHMARK_KEYS.lineKey,\n providerKey: keys.providerKey ?? DEFAULT_BENCHMARK_KEYS.providerKey,\n valueKey: keys.valueKey ?? DEFAULT_BENCHMARK_KEYS.valueKey,\n});\n\nexport const getBenchmarkIcon = (\n record: BenchmarkRecord,\n iconKey: string,\n renderIcon?: BenchmarkRenderIcon,\n index = 0,\n) => {\n if (renderIcon) return renderIcon(record, index);\n return record[iconKey] as BenchmarkRecord['icon'];\n};\n\nexport const normalizeBenchmarkData = ({\n colorKey,\n data,\n errorKey,\n iconKey,\n index,\n lineKey,\n providerKey,\n renderIcon,\n sortOrder = 'descending',\n valueKey,\n}: BenchmarkFieldKeys & {\n data: BenchmarkRecord[];\n renderIcon?: BenchmarkRenderIcon;\n sortOrder?: 'ascending' | 'descending' | 'none';\n}): NormalizedBenchmarkItem[] => {\n const keys = resolveBenchmarkKeys({\n colorKey,\n errorKey,\n iconKey,\n index,\n lineKey,\n providerKey,\n valueKey,\n });\n\n const sorted =\n sortOrder === 'none'\n ? [...data]\n : [...data].sort((a, b) => {\n const aUnranked = Boolean(a.unranked);\n const bUnranked = Boolean(b.unranked);\n if (aUnranked !== bUnranked) return aUnranked ? 1 : -1;\n\n const aValue = Number(a[keys.valueKey] ?? 0);\n const bValue = Number(b[keys.valueKey] ?? 0);\n return sortOrder === 'ascending' ? aValue - bValue : bValue - aValue;\n });\n\n return sorted.map((record, idx) => {\n const name = record[keys.index] ?? record.name ?? '';\n const value = Number(record[keys.valueKey] ?? 0);\n const rank = typeof record.rank === 'number' ? record.rank : idx + 1;\n const rawError = record[keys.errorKey];\n const error =\n rawError === undefined || rawError === null || rawError === '' ? undefined : Number(rawError);\n const rawLine = record[keys.lineKey] ?? record.line;\n const lineValue =\n rawLine === undefined || rawLine === null || rawLine === '' ? undefined : Number(rawLine);\n\n return {\n color: record[keys.colorKey] ?? record.color,\n error: Number.isFinite(error) ? error : undefined,\n highlighted: Boolean(record.highlighted),\n href: record.href,\n icon: getBenchmarkIcon(record, keys.iconKey, renderIcon, idx),\n key: record.key ?? (name === '' || name === undefined || name === null ? idx : String(name)),\n lineValue: Number.isFinite(lineValue) ? lineValue : undefined,\n name,\n original: record,\n provider: record[keys.providerKey] ?? record.provider,\n rank,\n target: record.target,\n unranked: Boolean(record.unranked),\n value,\n };\n });\n};\n\nexport const getBenchmarkMaxValue = (\n items: NormalizedBenchmarkItem[],\n maxValue?: number,\n): number => {\n if (typeof maxValue === 'number') return maxValue;\n return Math.max(...items.flatMap((item) => [item.value, item.lineValue ?? 0]), 0);\n};\n\nexport const getBenchmarkBarPercent = (value: number, maxValue: number, minPercent = 2) => {\n if (maxValue <= 0 || value <= 0) return 0;\n return Math.max((value / maxValue) * 100, minPercent);\n};\n\nexport const defaultBenchmarkValueFormatter = (value: number) => {\n if (Number.isInteger(value)) return String(value);\n return value.toFixed(1);\n};\n\nexport const defaultBenchmarkAccuracyFormatter = (value: number) => `${value.toFixed(1)}%`;\n\nexport const defaultBenchmarkErrorFormatter = (value: number) => value.toFixed(1);\n\nexport const formatBenchmarkAccuracyDisplay = ({\n accuracyFormatter,\n error,\n errorFormatter = defaultBenchmarkErrorFormatter,\n showError = true,\n value,\n valueFormatter = defaultBenchmarkValueFormatter,\n}: {\n accuracyFormatter?: (value: number) => string;\n error?: number;\n errorFormatter?: (value: number) => string;\n showError?: boolean;\n value: number;\n valueFormatter?: (value: number) => string;\n}) => {\n const formatValue = accuracyFormatter ?? valueFormatter;\n const main = formatValue(value);\n if (!showError || error === undefined || error === null || Number.isNaN(error)) {\n return { errorText: undefined, main, text: main };\n }\n const errorText = errorFormatter(error);\n return { errorText, main, text: `${main} ± ${errorText}` };\n};\n\n/**\n * Split a label into lines. Supports `\\n` / `\\r\\n`.\n */\nexport const splitBenchmarkLabel = (label: unknown): string[] => {\n const text = String(label ?? '');\n if (!text) return [''];\n return text.split(/\\r?\\n/);\n};\n\nexport const getBenchmarkLabelMetrics = (label: unknown) => {\n const lines = splitBenchmarkLabel(label);\n const longestWidth = lines.reduce((max, line) => Math.max(max, getTextWidth(line)), 0);\n return { lineCount: Math.max(lines.length, 1), lines, longestWidth };\n};\n"],"mappings":"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"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
//#region src/common/utils.d.ts
|
|
1
2
|
export declare const constructCategoryColors: (categories: string[], colors: string[]) => Map<string, string>;
|
|
2
3
|
export declare const getYAxisDomain: (autoMinValue: boolean, minValue: number | undefined, maxValue: number | undefined) => (string | number)[];
|
|
3
4
|
export declare const constructCategories: (data: any[], color?: string) => string[];
|
|
4
5
|
export declare const deepEqual: (obj1: any, obj2: any) => boolean;
|
|
5
6
|
export declare const hasOnlyOneValueForThisKey: (array: any[], keyToCheck: string) => boolean;
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=utils.d.mts.map
|