@lobehub/charts 6.0.0 → 6.1.0
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/README.md +83 -74
- package/es/AccuracyBarChart/index.d.mts +7 -5
- package/es/AccuracyBarChart/index.mjs +36 -37
- package/es/AccuracyBarChart/index.mjs.map +1 -1
- package/es/AccuracyBarChart/styles.d.mts +1 -4
- package/es/AccuracyBarChart/styles.mjs +6 -7
- package/es/AccuracyBarChart/styles.mjs.map +1 -1
- package/es/AreaChart/index.d.mts +11 -7
- package/es/AreaChart/index.mjs +100 -60
- package/es/AreaChart/index.mjs.map +1 -1
- package/es/AreaChart/styles.d.mts +1 -4
- package/es/AreaChart/styles.mjs +1 -2
- package/es/BarChart/A2uiBarChart.d.mts +56 -0
- package/es/BarChart/A2uiBarChart.mjs +368 -0
- package/es/BarChart/A2uiBarChart.mjs.map +1 -0
- package/es/BarChart/index.d.mts +10 -6
- package/es/BarChart/index.mjs +70 -33
- package/es/BarChart/index.mjs.map +1 -1
- package/es/BarChart/renderShape.d.mts +1 -4
- package/es/BarChart/renderShape.mjs +5 -6
- package/es/BarChart/renderShape.mjs.map +1 -1
- package/es/BarChart/styles.d.mts +1 -4
- package/es/BarChart/styles.mjs +1 -2
- package/es/BarList/index.d.mts +8 -6
- package/es/BarList/index.mjs +13 -14
- package/es/BarList/index.mjs.map +1 -1
- package/es/BarList/styles.d.mts +1 -4
- package/es/BarList/styles.mjs +3 -5
- package/es/BarList/styles.mjs.map +1 -1
- package/es/BenchmarkColumnChart/index.d.mts +8 -6
- package/es/BenchmarkColumnChart/index.mjs +38 -39
- package/es/BenchmarkColumnChart/index.mjs.map +1 -1
- package/es/BenchmarkColumnChart/styles.d.mts +1 -4
- package/es/BenchmarkColumnChart/styles.mjs +6 -8
- package/es/BenchmarkColumnChart/styles.mjs.map +1 -1
- package/es/BenchmarkRankingChart/index.d.mts +8 -6
- package/es/BenchmarkRankingChart/index.mjs +16 -17
- package/es/BenchmarkRankingChart/index.mjs.map +1 -1
- package/es/BenchmarkRankingChart/styles.d.mts +1 -4
- package/es/BenchmarkRankingChart/styles.mjs +25 -27
- package/es/BenchmarkRankingChart/styles.mjs.map +1 -1
- package/es/BenchmarkScatterChart/index.d.mts +7 -5
- package/es/BenchmarkScatterChart/index.mjs +22 -23
- package/es/BenchmarkScatterChart/index.mjs.map +1 -1
- package/es/BenchmarkScatterChart/styles.d.mts +1 -4
- package/es/BenchmarkScatterChart/styles.mjs +3 -2
- package/es/BenchmarkScatterChart/styles.mjs.map +1 -1
- package/es/BenchmarkScatterChart/utils.d.mts +1 -4
- package/es/BenchmarkScatterChart/utils.mjs +4 -5
- package/es/BenchmarkScatterChart/utils.mjs.map +1 -1
- package/es/CandlestickChart/index.d.mts +52 -0
- package/es/CandlestickChart/index.mjs +205 -0
- package/es/CandlestickChart/index.mjs.map +1 -0
- package/es/CandlestickChart/styles.d.mts +5 -0
- package/es/CandlestickChart/styles.mjs +24 -0
- package/es/CandlestickChart/styles.mjs.map +1 -0
- package/es/CandlestickChart/utils.d.mts +17 -0
- package/es/CandlestickChart/utils.mjs +56 -0
- package/es/CandlestickChart/utils.mjs.map +1 -0
- package/es/ChartFrame/index.d.mts +40 -0
- package/es/ChartFrame/index.mjs +18 -0
- package/es/ChartFrame/index.mjs.map +1 -0
- package/es/ComposedChart/index.d.mts +7 -5
- package/es/ComposedChart/index.mjs +37 -38
- package/es/ComposedChart/index.mjs.map +1 -1
- package/es/ComposedChart/styles.d.mts +1 -4
- package/es/ComposedChart/styles.mjs +1 -2
- package/es/ComposedChart/types.d.mts +3 -6
- package/es/DataBars/CategoryBar.d.mts +8 -6
- package/es/DataBars/CategoryBar.mjs +13 -14
- package/es/DataBars/CategoryBar.mjs.map +1 -1
- package/es/DataBars/DeltaBar.d.mts +7 -5
- package/es/DataBars/DeltaBar.mjs +10 -12
- package/es/DataBars/DeltaBar.mjs.map +1 -1
- package/es/DataBars/MarkerBar.d.mts +7 -5
- package/es/DataBars/MarkerBar.mjs +10 -12
- package/es/DataBars/MarkerBar.mjs.map +1 -1
- package/es/DataBars/ProgressBar.d.mts +7 -5
- package/es/DataBars/ProgressBar.mjs +10 -12
- package/es/DataBars/ProgressBar.mjs.map +1 -1
- package/es/DataBars/styles.d.mts +1 -4
- package/es/DataBars/styles.mjs +2 -3
- package/es/DataBars/styles.mjs.map +1 -1
- package/es/DonutChart/A2uiDonutChart.d.mts +35 -0
- package/es/DonutChart/A2uiDonutChart.mjs +189 -0
- package/es/DonutChart/A2uiDonutChart.mjs.map +1 -0
- package/es/DonutChart/DonutChartTooltip.d.mts +2 -5
- package/es/DonutChart/DonutChartTooltip.mjs +3 -4
- package/es/DonutChart/DonutChartTooltip.mjs.map +1 -1
- package/es/DonutChart/a2uiStyles.d.mts +13 -0
- package/es/DonutChart/a2uiStyles.mjs +90 -0
- package/es/DonutChart/a2uiStyles.mjs.map +1 -0
- package/es/DonutChart/index.d.mts +42 -9
- package/es/DonutChart/index.mjs +48 -16
- package/es/DonutChart/index.mjs.map +1 -1
- package/es/DonutChart/inputParser.d.mts +1 -4
- package/es/DonutChart/inputParser.mjs +1 -2
- package/es/DonutChart/inputParser.mjs.map +1 -1
- package/es/DonutChart/renderInactiveShape.d.mts +1 -4
- package/es/DonutChart/renderInactiveShape.mjs +1 -2
- package/es/DonutChart/styles.d.mts +1 -4
- package/es/DonutChart/styles.mjs +1 -2
- package/es/FunnelChart/ArrowRightIcon.d.mts +1 -4
- package/es/FunnelChart/ArrowRightIcon.mjs +1 -2
- package/es/FunnelChart/index.d.mts +7 -5
- package/es/FunnelChart/index.mjs +43 -44
- package/es/FunnelChart/index.mjs.map +1 -1
- package/es/FunnelChart/styles.d.mts +1 -4
- package/es/FunnelChart/styles.mjs +1 -2
- package/es/FunnelChart/types.d.mts +1 -4
- package/es/GaugeChart/index.d.mts +49 -0
- package/es/GaugeChart/index.mjs +77 -0
- package/es/GaugeChart/index.mjs.map +1 -0
- package/es/GaugeChart/styles.d.mts +9 -0
- package/es/GaugeChart/styles.mjs +73 -0
- package/es/GaugeChart/styles.mjs.map +1 -0
- package/es/GaugeChart/utils.d.mts +5 -0
- package/es/GaugeChart/utils.mjs +32 -0
- package/es/GaugeChart/utils.mjs.map +1 -0
- package/es/HeatmapChart/index.d.mts +68 -0
- package/es/HeatmapChart/index.mjs +162 -0
- package/es/HeatmapChart/index.mjs.map +1 -0
- package/es/HeatmapChart/styles.d.mts +4 -0
- package/es/HeatmapChart/styles.mjs +24 -0
- package/es/HeatmapChart/styles.mjs.map +1 -0
- package/es/HeatmapChart/utils.d.mts +18 -0
- package/es/HeatmapChart/utils.mjs +40 -0
- package/es/HeatmapChart/utils.mjs.map +1 -0
- package/es/Heatmaps/Calendar.d.mts +2 -5
- package/es/Heatmaps/Calendar.mjs +8 -9
- package/es/Heatmaps/Calendar.mjs.map +1 -1
- package/es/Heatmaps/ChartLabels.d.mts +2 -5
- package/es/Heatmaps/ChartLabels.mjs +3 -4
- package/es/Heatmaps/ChartLabels.mjs.map +1 -1
- package/es/Heatmaps/Footer.d.mts +1 -4
- package/es/Heatmaps/Footer.mjs +3 -4
- package/es/Heatmaps/index.d.mts +10 -8
- package/es/Heatmaps/index.mjs +10 -11
- package/es/Heatmaps/index.mjs.map +1 -1
- package/es/Heatmaps/styles.d.mts +1 -4
- package/es/Heatmaps/styles.mjs +2 -3
- package/es/Heatmaps/styles.mjs.map +1 -1
- package/es/Legend/LegendItem.d.mts +1 -4
- package/es/Legend/LegendItem.mjs +7 -8
- package/es/Legend/LegendItem.mjs.map +1 -1
- package/es/Legend/ScrollButton.d.mts +1 -4
- package/es/Legend/ScrollButton.mjs +6 -7
- package/es/Legend/ScrollButton.mjs.map +1 -1
- package/es/Legend/index.d.mts +7 -5
- package/es/Legend/index.mjs +13 -18
- package/es/Legend/index.mjs.map +1 -1
- package/es/LineChart/index.d.mts +11 -7
- package/es/LineChart/index.mjs +91 -53
- package/es/LineChart/index.mjs.map +1 -1
- package/es/LineChart/styles.d.mts +1 -4
- package/es/LineChart/styles.mjs +1 -2
- package/es/RadarChart/A2uiRadarChart.d.mts +37 -0
- package/es/RadarChart/A2uiRadarChart.mjs +203 -0
- package/es/RadarChart/A2uiRadarChart.mjs.map +1 -0
- package/es/RadarChart/index.d.mts +11 -7
- package/es/RadarChart/index.mjs +51 -18
- package/es/RadarChart/index.mjs.map +1 -1
- package/es/RadarChart/styles.d.mts +1 -4
- package/es/RadarChart/styles.mjs +1 -2
- package/es/SankeyChart/index.d.mts +73 -0
- package/es/SankeyChart/index.mjs +156 -0
- package/es/SankeyChart/index.mjs.map +1 -0
- package/es/SankeyChart/utils.d.mts +54 -0
- package/es/SankeyChart/utils.mjs +270 -0
- package/es/SankeyChart/utils.mjs.map +1 -0
- package/es/ScatterChart/A2uiScatterChart.d.mts +41 -0
- package/es/ScatterChart/A2uiScatterChart.mjs +259 -0
- package/es/ScatterChart/A2uiScatterChart.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltip.d.mts +2 -5
- package/es/ScatterChart/ScatterChartTooltip.mjs +7 -8
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -1
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +1 -4
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +3 -4
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -1
- package/es/ScatterChart/index.d.mts +15 -9
- package/es/ScatterChart/index.mjs +70 -33
- package/es/ScatterChart/index.mjs.map +1 -1
- package/es/ScatterChart/renderShape.d.mts +1 -4
- package/es/ScatterChart/renderShape.mjs +4 -5
- package/es/ScatterChart/renderShape.mjs.map +1 -1
- package/es/ScatterChart/styles.d.mts +1 -4
- package/es/ScatterChart/styles.mjs +1 -2
- package/es/SparkChart/A2uiSparkChart.d.mts +41 -0
- package/es/SparkChart/A2uiSparkChart.mjs +179 -0
- package/es/SparkChart/A2uiSparkChart.mjs.map +1 -0
- package/es/SparkChart/SparkAreaChart.d.mts +12 -7
- package/es/SparkChart/SparkAreaChart.mjs +47 -22
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -1
- package/es/SparkChart/SparkBarChart.d.mts +11 -6
- package/es/SparkChart/SparkBarChart.mjs +39 -16
- package/es/SparkChart/SparkBarChart.mjs.map +1 -1
- package/es/SparkChart/SparkLineChart.d.mts +12 -7
- package/es/SparkChart/SparkLineChart.mjs +41 -16
- package/es/SparkChart/SparkLineChart.mjs.map +1 -1
- package/es/SparkChart/index.d.mts +2 -1
- package/es/Tracker/TrackerBlock.d.mts +5 -5
- package/es/Tracker/TrackerBlock.mjs +8 -9
- package/es/Tracker/TrackerBlock.mjs.map +1 -1
- package/es/Tracker/index.d.mts +8 -6
- package/es/Tracker/index.mjs +11 -13
- package/es/Tracker/index.mjs.map +1 -1
- package/es/Tracker/styles.d.mts +1 -4
- package/es/Tracker/styles.mjs +1 -2
- package/es/TreemapChart/index.d.mts +64 -0
- package/es/TreemapChart/index.mjs +140 -0
- package/es/TreemapChart/index.mjs.map +1 -0
- package/es/TreemapChart/utils.d.mts +23 -0
- package/es/TreemapChart/utils.mjs +175 -0
- package/es/TreemapChart/utils.mjs.map +1 -0
- package/es/common/BaseAnimationTimingProps.d.mts +1 -4
- package/es/common/BaseChartProps.d.mts +3 -6
- package/es/common/BaseSparkChartProps.d.mts +2 -5
- package/es/common/ChartLegend.d.mts +1 -4
- package/es/common/ChartLegend.mjs +4 -5
- package/es/common/ChartLegend.mjs.map +1 -1
- package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +1 -4
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs +1 -2
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -1
- package/es/common/ChartTooltip/ChartTooltipRow.d.mts +1 -4
- package/es/common/ChartTooltip/ChartTooltipRow.mjs +5 -6
- package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -1
- package/es/common/ChartTooltip/index.d.mts +2 -5
- package/es/common/ChartTooltip/index.mjs +3 -4
- package/es/common/ChartTooltip/index.mjs.map +1 -1
- package/es/common/CustomTooltipProps.d.mts +3 -6
- package/es/common/CustomYAxisTick.d.mts +2 -5
- package/es/common/CustomYAxisTick.mjs +1 -2
- package/es/common/CustomYAxisTick.mjs.map +1 -1
- package/es/common/NoData.d.mts +1 -4
- package/es/common/NoData.mjs +2 -3
- package/es/common/NoData.mjs.map +1 -1
- package/es/common/a2ui/A2uiTrendChart.d.mts +43 -0
- package/es/common/a2ui/A2uiTrendChart.mjs +353 -0
- package/es/common/a2ui/A2uiTrendChart.mjs.map +1 -0
- package/es/common/a2ui/Frame.d.mts +20 -0
- package/es/common/a2ui/Frame.mjs +43 -0
- package/es/common/a2ui/Frame.mjs.map +1 -0
- package/es/common/a2ui/HoverTooltip.d.mts +28 -0
- package/es/common/a2ui/HoverTooltip.mjs +36 -0
- package/es/common/a2ui/HoverTooltip.mjs.map +1 -0
- package/es/common/a2ui/Legend.d.mts +11 -0
- package/es/common/a2ui/Legend.mjs +33 -0
- package/es/common/a2ui/Legend.mjs.map +1 -0
- package/es/common/a2ui/PlacedTooltip.d.mts +22 -0
- package/es/common/a2ui/PlacedTooltip.mjs +58 -0
- package/es/common/a2ui/PlacedTooltip.mjs.map +1 -0
- package/es/common/a2ui/Tooltip.d.mts +13 -0
- package/es/common/a2ui/Tooltip.mjs +33 -0
- package/es/common/a2ui/Tooltip.mjs.map +1 -0
- package/es/common/a2ui/axis.d.mts +38 -0
- package/es/common/a2ui/axis.mjs +48 -0
- package/es/common/a2ui/axis.mjs.map +1 -0
- package/es/common/a2ui/curve.d.mts +20 -0
- package/es/common/a2ui/curve.mjs +58 -0
- package/es/common/a2ui/curve.mjs.map +1 -0
- package/es/common/a2ui/format.d.mts +17 -0
- package/es/common/a2ui/format.mjs +56 -0
- package/es/common/a2ui/format.mjs.map +1 -0
- package/es/common/a2ui/index.d.mts +16 -0
- package/es/common/a2ui/index.mjs +15 -0
- package/es/common/a2ui/scale.d.mts +20 -0
- package/es/common/a2ui/scale.mjs +112 -0
- package/es/common/a2ui/scale.mjs.map +1 -0
- package/es/common/a2ui/styles.d.mts +35 -0
- package/es/common/a2ui/styles.mjs +254 -0
- package/es/common/a2ui/styles.mjs.map +1 -0
- package/es/common/a2ui/tokens.d.mts +20 -0
- package/es/common/a2ui/tokens.mjs +103 -0
- package/es/common/a2ui/tokens.mjs.map +1 -0
- package/es/common/a2ui/types.d.mts +25 -0
- package/es/common/a2ui/types.mjs +0 -0
- package/es/common/a2ui/useA2uiTheme.d.mts +2 -0
- package/es/common/a2ui/useA2uiTheme.mjs +11 -0
- package/es/common/a2ui/useA2uiTheme.mjs.map +1 -0
- package/es/common/a2ui/useElementWidth.d.mts +2 -0
- package/es/common/a2ui/useElementWidth.mjs +31 -0
- package/es/common/a2ui/useElementWidth.mjs.map +1 -0
- package/es/common/benchmark/types.d.mts +2 -5
- package/es/common/benchmark/utils.d.mts +1 -4
- package/es/common/benchmark/utils.mjs +1 -2
- package/es/common/utils.d.mts +1 -4
- package/es/common/utils.mjs +1 -2
- package/es/hooks/useOnWindowResize.d.mts +1 -4
- package/es/hooks/useOnWindowResize.mjs +2 -3
- package/es/hooks/usePrefersReducedMotion.d.mts +1 -4
- package/es/hooks/usePrefersReducedMotion.mjs +2 -3
- package/es/hooks/useThemeColorRange.d.mts +1 -4
- package/es/hooks/useThemeColorRange.mjs +1 -2
- package/es/index.d.mts +20 -9
- package/es/index.mjs +15 -9
- package/es/types/charts.d.mts +1 -4
- package/es/types/charts.mjs +1 -2
- package/es/utils/calendar.d.mts +2 -5
- package/es/utils/calendar.mjs +2 -3
- package/es/utils/getMaxLabelLength.d.mts +1 -4
- package/es/utils/getMaxLabelLength.mjs +1 -2
- package/es/utils/getMaxLabelLength.mjs.map +1 -1
- package/es/utils/index.d.mts +1 -4
- package/es/utils/index.mjs +1 -2
- package/es/utils/index.mjs.map +1 -1
- package/es/utils/theme.d.mts +1 -4
- package/es/utils/theme.mjs +1 -2
- package/package.json +33 -9
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { createStaticStyles } from "@lobehub/ui";
|
|
2
|
+
import { A2UI_DARK_VARS, A2UI_LIGHT_VARS } from "./tokens.mjs";
|
|
3
|
+
// src/common/a2ui/styles.ts
|
|
4
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
5
|
+
card: css`
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
width: 100%;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
border: 1px solid var(--a2-line);
|
|
15
|
+
border-radius: 14px;
|
|
16
|
+
|
|
17
|
+
font-variant-numeric: normal;
|
|
18
|
+
color: var(--a2-chart-ink);
|
|
19
|
+
|
|
20
|
+
background: linear-gradient(180deg, var(--a2-card-sheen), transparent 40%), var(--a2-surface);
|
|
21
|
+
box-shadow: var(--a2-card-shadow);
|
|
22
|
+
|
|
23
|
+
& svg text {
|
|
24
|
+
font-family: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
& .recharts-surface,
|
|
28
|
+
& .recharts-wrapper {
|
|
29
|
+
overflow: visible;
|
|
30
|
+
outline: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& .recharts-sector,
|
|
34
|
+
& .recharts-rectangle,
|
|
35
|
+
& .recharts-layer {
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
dark: css`
|
|
40
|
+
${A2UI_DARK_VARS}
|
|
41
|
+
`,
|
|
42
|
+
empty: css`
|
|
43
|
+
display: grid;
|
|
44
|
+
place-items: center;
|
|
45
|
+
|
|
46
|
+
height: 144px;
|
|
47
|
+
border: 1px solid var(--a2-line);
|
|
48
|
+
border-radius: 10px;
|
|
49
|
+
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
color: var(--a2-muted-fg);
|
|
52
|
+
|
|
53
|
+
background: oklch(var(--a2-ink) / 3%);
|
|
54
|
+
`,
|
|
55
|
+
frame: css`
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
|
|
60
|
+
padding-block: 14px 12px;
|
|
61
|
+
padding-inline: 16px;
|
|
62
|
+
`,
|
|
63
|
+
header: css`
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
gap: 6px 16px;
|
|
67
|
+
align-items: flex-start;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
|
|
70
|
+
min-width: 0;
|
|
71
|
+
`,
|
|
72
|
+
headerText: css`
|
|
73
|
+
min-width: 0;
|
|
74
|
+
`,
|
|
75
|
+
legend: css`
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
gap: 4px 12px;
|
|
79
|
+
align-items: center;
|
|
80
|
+
|
|
81
|
+
padding-block-start: 2px;
|
|
82
|
+
`,
|
|
83
|
+
legendItem: css`
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
gap: 6px;
|
|
86
|
+
align-items: center;
|
|
87
|
+
|
|
88
|
+
min-width: 0;
|
|
89
|
+
|
|
90
|
+
font-size: 11.5px;
|
|
91
|
+
line-height: 1.5;
|
|
92
|
+
color: var(--a2-muted-fg);
|
|
93
|
+
`,
|
|
94
|
+
legendLabel: css`
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
`,
|
|
99
|
+
legendValue: css`
|
|
100
|
+
font-variant-numeric: tabular-nums;
|
|
101
|
+
color: color-mix(in oklch, var(--a2-fg) 85%, transparent);
|
|
102
|
+
`,
|
|
103
|
+
light: css`
|
|
104
|
+
${A2UI_LIGHT_VARS}
|
|
105
|
+
`,
|
|
106
|
+
plot: css`
|
|
107
|
+
position: relative;
|
|
108
|
+
width: 100%;
|
|
109
|
+
min-width: 0;
|
|
110
|
+
`,
|
|
111
|
+
subtitle: css`
|
|
112
|
+
margin-block-start: 2px;
|
|
113
|
+
font-size: 11.5px;
|
|
114
|
+
line-height: 1.375;
|
|
115
|
+
color: var(--a2-muted-fg);
|
|
116
|
+
`,
|
|
117
|
+
swatch: css`
|
|
118
|
+
flex-shrink: 0;
|
|
119
|
+
width: 8px;
|
|
120
|
+
height: 8px;
|
|
121
|
+
border-radius: 3px;
|
|
122
|
+
`,
|
|
123
|
+
title: css`
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
|
|
126
|
+
font-size: 13.5px;
|
|
127
|
+
font-weight: 600;
|
|
128
|
+
line-height: 1.5;
|
|
129
|
+
color: var(--a2-fg);
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
letter-spacing: -0.025em;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
`,
|
|
134
|
+
tooltip: css`
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
|
|
137
|
+
max-width: 240px;
|
|
138
|
+
padding-block: 8px;
|
|
139
|
+
padding-inline: 10px;
|
|
140
|
+
border: 1px solid var(--a2-tooltip-border);
|
|
141
|
+
border-radius: 10px;
|
|
142
|
+
|
|
143
|
+
font-size: 11.5px;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
line-height: 1.45;
|
|
146
|
+
color: var(--a2-tooltip-fg);
|
|
147
|
+
overflow-wrap: anywhere;
|
|
148
|
+
|
|
149
|
+
background: var(--a2-tooltip-bg);
|
|
150
|
+
box-shadow: var(--a2-tooltip-shadow);
|
|
151
|
+
`,
|
|
152
|
+
tooltipRow: css`
|
|
153
|
+
display: grid;
|
|
154
|
+
grid-template-columns: 0.55rem minmax(0, 1fr) auto;
|
|
155
|
+
column-gap: 0.4rem;
|
|
156
|
+
align-items: center;
|
|
157
|
+
`,
|
|
158
|
+
tooltipRowActive: css`
|
|
159
|
+
border-radius: 0.2rem;
|
|
160
|
+
font-weight: 700;
|
|
161
|
+
background: color-mix(in srgb, currentcolor 12%, transparent);
|
|
162
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, currentcolor 12%, transparent);
|
|
163
|
+
`,
|
|
164
|
+
tooltipSwatch: css`
|
|
165
|
+
display: block;
|
|
166
|
+
|
|
167
|
+
width: 0.55rem;
|
|
168
|
+
height: 0.55rem;
|
|
169
|
+
border-radius: 0.15rem;
|
|
170
|
+
|
|
171
|
+
box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%);
|
|
172
|
+
`,
|
|
173
|
+
tooltipTitle: css`
|
|
174
|
+
display: flex;
|
|
175
|
+
gap: 0.4rem;
|
|
176
|
+
align-items: center;
|
|
177
|
+
|
|
178
|
+
margin-block-end: 0.3rem;
|
|
179
|
+
|
|
180
|
+
font-weight: 650;
|
|
181
|
+
`,
|
|
182
|
+
tooltipValue: css`
|
|
183
|
+
font-variant-numeric: tabular-nums;
|
|
184
|
+
text-align: end;
|
|
185
|
+
white-space: nowrap;
|
|
186
|
+
`
|
|
187
|
+
}));
|
|
188
|
+
const sparkStyles = createStaticStyles(({ css }) => ({
|
|
189
|
+
chart: css`
|
|
190
|
+
flex: 1;
|
|
191
|
+
min-width: 0;
|
|
192
|
+
height: 44px;
|
|
193
|
+
`,
|
|
194
|
+
chip: css`
|
|
195
|
+
padding-block: 2px;
|
|
196
|
+
padding-inline: 6px;
|
|
197
|
+
border-radius: 6px;
|
|
198
|
+
|
|
199
|
+
font-size: 11px;
|
|
200
|
+
font-weight: 500;
|
|
201
|
+
font-variant-numeric: tabular-nums;
|
|
202
|
+
line-height: 1.5;
|
|
203
|
+
`,
|
|
204
|
+
chipNegative: css`
|
|
205
|
+
color: var(--a2-negative);
|
|
206
|
+
background: color-mix(in oklch, var(--a2-negative) 14%, transparent);
|
|
207
|
+
`,
|
|
208
|
+
chipNeutral: css`
|
|
209
|
+
color: var(--a2-muted-fg);
|
|
210
|
+
background: var(--a2-chip-neutral);
|
|
211
|
+
`,
|
|
212
|
+
chipPositive: css`
|
|
213
|
+
color: var(--a2-positive);
|
|
214
|
+
background: color-mix(in oklch, var(--a2-positive) 14%, transparent);
|
|
215
|
+
`,
|
|
216
|
+
label: css`
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
|
|
219
|
+
font-size: 11.5px;
|
|
220
|
+
line-height: 1.5;
|
|
221
|
+
color: var(--a2-muted-fg);
|
|
222
|
+
text-overflow: ellipsis;
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
`,
|
|
225
|
+
meta: css`
|
|
226
|
+
flex-shrink: 0;
|
|
227
|
+
min-width: 0;
|
|
228
|
+
`,
|
|
229
|
+
root: css`
|
|
230
|
+
display: flex;
|
|
231
|
+
gap: 16px;
|
|
232
|
+
align-items: center;
|
|
233
|
+
|
|
234
|
+
padding-block: 12px;
|
|
235
|
+
padding-inline: 16px;
|
|
236
|
+
`,
|
|
237
|
+
value: css`
|
|
238
|
+
font-size: 18px;
|
|
239
|
+
font-weight: 600;
|
|
240
|
+
font-variant-numeric: tabular-nums;
|
|
241
|
+
line-height: 1.5;
|
|
242
|
+
color: var(--a2-fg);
|
|
243
|
+
letter-spacing: -0.025em;
|
|
244
|
+
`,
|
|
245
|
+
valueRow: css`
|
|
246
|
+
display: flex;
|
|
247
|
+
gap: 8px;
|
|
248
|
+
align-items: baseline;
|
|
249
|
+
margin-block-start: 2px;
|
|
250
|
+
`
|
|
251
|
+
}));
|
|
252
|
+
export { sparkStyles, styles };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../../src/common/a2ui/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nimport { A2UI_DARK_VARS, A2UI_LIGHT_VARS } from './tokens';\n\n// Adapted from CopilotKit a2ui-playground (MIT): `.a2-card`, `.a2-well` (globals.css) and ChartFrame /\n// Legend / tooltip chrome (chart-kit.tsx).\nexport const styles = createStaticStyles(({ css }) => ({\n card: css`\n position: relative;\n\n overflow: hidden;\n\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n max-width: 100%;\n border: 1px solid var(--a2-line);\n border-radius: 14px;\n\n font-variant-numeric: normal;\n color: var(--a2-chart-ink);\n\n background: linear-gradient(180deg, var(--a2-card-sheen), transparent 40%), var(--a2-surface);\n box-shadow: var(--a2-card-shadow);\n\n & svg text {\n font-family: inherit;\n }\n\n & .recharts-surface,\n & .recharts-wrapper {\n overflow: visible;\n outline: none;\n }\n\n & .recharts-sector,\n & .recharts-rectangle,\n & .recharts-layer {\n outline: none;\n }\n `,\n dark: css`\n ${A2UI_DARK_VARS}\n `,\n empty: css`\n display: grid;\n place-items: center;\n\n height: 144px;\n border: 1px solid var(--a2-line);\n border-radius: 10px;\n\n font-size: 12px;\n color: var(--a2-muted-fg);\n\n background: oklch(var(--a2-ink) / 3%);\n `,\n frame: css`\n display: flex;\n flex-direction: column;\n gap: 12px;\n\n padding-block: 14px 12px;\n padding-inline: 16px;\n `,\n header: css`\n display: flex;\n flex-wrap: wrap;\n gap: 6px 16px;\n align-items: flex-start;\n justify-content: space-between;\n\n min-width: 0;\n `,\n headerText: css`\n min-width: 0;\n `,\n legend: css`\n display: flex;\n flex-wrap: wrap;\n gap: 4px 12px;\n align-items: center;\n\n padding-block-start: 2px;\n `,\n legendItem: css`\n display: inline-flex;\n gap: 6px;\n align-items: center;\n\n min-width: 0;\n\n font-size: 11.5px;\n line-height: 1.5;\n color: var(--a2-muted-fg);\n `,\n legendLabel: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n legendValue: css`\n font-variant-numeric: tabular-nums;\n color: color-mix(in oklch, var(--a2-fg) 85%, transparent);\n `,\n light: css`\n ${A2UI_LIGHT_VARS}\n `,\n plot: css`\n position: relative;\n width: 100%;\n min-width: 0;\n `,\n subtitle: css`\n margin-block-start: 2px;\n font-size: 11.5px;\n line-height: 1.375;\n color: var(--a2-muted-fg);\n `,\n swatch: css`\n flex-shrink: 0;\n width: 8px;\n height: 8px;\n border-radius: 3px;\n `,\n title: css`\n overflow: hidden;\n\n font-size: 13.5px;\n font-weight: 600;\n line-height: 1.5;\n color: var(--a2-fg);\n text-overflow: ellipsis;\n letter-spacing: -0.025em;\n white-space: nowrap;\n `,\n tooltip: css`\n pointer-events: none;\n\n max-width: 240px;\n padding-block: 8px;\n padding-inline: 10px;\n border: 1px solid var(--a2-tooltip-border);\n border-radius: 10px;\n\n font-size: 11.5px;\n font-weight: 500;\n line-height: 1.45;\n color: var(--a2-tooltip-fg);\n overflow-wrap: anywhere;\n\n background: var(--a2-tooltip-bg);\n box-shadow: var(--a2-tooltip-shadow);\n `,\n tooltipRow: css`\n display: grid;\n grid-template-columns: 0.55rem minmax(0, 1fr) auto;\n column-gap: 0.4rem;\n align-items: center;\n `,\n tooltipRowActive: css`\n border-radius: 0.2rem;\n font-weight: 700;\n background: color-mix(in srgb, currentcolor 12%, transparent);\n box-shadow: 0 0 0 2px color-mix(in srgb, currentcolor 12%, transparent);\n `,\n tooltipSwatch: css`\n display: block;\n\n width: 0.55rem;\n height: 0.55rem;\n border-radius: 0.15rem;\n\n box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%);\n `,\n tooltipTitle: css`\n display: flex;\n gap: 0.4rem;\n align-items: center;\n\n margin-block-end: 0.3rem;\n\n font-weight: 650;\n `,\n tooltipValue: css`\n font-variant-numeric: tabular-nums;\n text-align: end;\n white-space: nowrap;\n `,\n}));\n\n// Adapted from CopilotKit a2ui-playground (MIT): charts.tsx `Sparkline`.\nexport const sparkStyles = createStaticStyles(({ css }) => ({\n chart: css`\n flex: 1;\n min-width: 0;\n height: 44px;\n `,\n chip: css`\n padding-block: 2px;\n padding-inline: 6px;\n border-radius: 6px;\n\n font-size: 11px;\n font-weight: 500;\n font-variant-numeric: tabular-nums;\n line-height: 1.5;\n `,\n chipNegative: css`\n color: var(--a2-negative);\n background: color-mix(in oklch, var(--a2-negative) 14%, transparent);\n `,\n chipNeutral: css`\n color: var(--a2-muted-fg);\n background: var(--a2-chip-neutral);\n `,\n chipPositive: css`\n color: var(--a2-positive);\n background: color-mix(in oklch, var(--a2-positive) 14%, transparent);\n `,\n label: css`\n overflow: hidden;\n\n font-size: 11.5px;\n line-height: 1.5;\n color: var(--a2-muted-fg);\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n meta: css`\n flex-shrink: 0;\n min-width: 0;\n `,\n root: css`\n display: flex;\n gap: 16px;\n align-items: center;\n\n padding-block: 12px;\n padding-inline: 16px;\n `,\n value: css`\n font-size: 18px;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n line-height: 1.5;\n color: var(--a2-fg);\n letter-spacing: -0.025em;\n `,\n valueRow: css`\n display: flex;\n gap: 8px;\n align-items: baseline;\n margin-block-start: 2px;\n `,\n}));\n"],"mappings":";;;AAMA,MAAa,SAAS,oBAAoB,EAAE,WAAW;CACrD,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCT,MAAM,GAAG;MACL,eAAe;;CAEnB,OAAO,GAAG;;;;;;;;;;;;;CAaV,OAAO,GAAG;;;;;;;;CAQV,QAAQ,GAAG;;;;;;;;;CASX,YAAY,GAAG;;;CAGf,QAAQ,GAAG;;;;;;;;CAQX,YAAY,GAAG;;;;;;;;;;;CAWf,aAAa,GAAG;;;;;CAKhB,aAAa,GAAG;;;;CAIhB,OAAO,GAAG;MACN,gBAAgB;;CAEpB,MAAM,GAAG;;;;;CAKT,UAAU,GAAG;;;;;;CAMb,QAAQ,GAAG;;;;;;CAMX,OAAO,GAAG;;;;;;;;;;;CAWV,SAAS,GAAG;;;;;;;;;;;;;;;;;;CAkBZ,YAAY,GAAG;;;;;;CAMf,kBAAkB,GAAG;;;;;;CAMrB,eAAe,GAAG;;;;;;;;;CASlB,cAAc,GAAG;;;;;;;;;CASjB,cAAc,GAAG;;;;;AAKnB,EAAE;AAGF,MAAa,cAAc,oBAAoB,EAAE,WAAW;CAC1D,OAAO,GAAG;;;;;CAKV,MAAM,GAAG;;;;;;;;;;CAUT,cAAc,GAAG;;;;CAIjB,aAAa,GAAG;;;;CAIhB,cAAc,GAAG;;;;CAIjB,OAAO,GAAG;;;;;;;;;CASV,MAAM,GAAG;;;;CAIT,MAAM,GAAG;;;;;;;;CAQT,OAAO,GAAG;;;;;;;;CAQV,UAAU,GAAG;;;;;;AAMf,EAAE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const A2UI_LIGHT_VARS = "\n --a2-ink: 0.21 0.012 285;\n --a2-fg: oklch(0.2 0.008 285);\n --a2-muted-fg: oklch(0.47 0.014 285);\n --a2-chart-1: oklch(0.55 0.2 292);\n --a2-chart-2: oklch(0.58 0.13 230);\n --a2-chart-3: oklch(0.6 0.14 162);\n --a2-chart-4: oklch(0.7 0.15 72);\n --a2-chart-5: oklch(0.6 0.2 18);\n --a2-chart-6: oklch(0.6 0.03 285);\n --a2-surface: oklch(1 0 0);\n --a2-line: oklch(0.21 0.012 285 / 9%);\n --a2-positive: oklch(0.52 0.13 160);\n --a2-negative: oklch(0.56 0.2 22);\n --a2-card-sheen: transparent;\n --a2-card-shadow: 0 1px 2px oklch(0.21 0.012 285 / 6%), 0 1px 3px oklch(0.21 0.012 285 / 4%);\n --a2-chart-ink: oklch(0.45 0.012 285);\n --a2-chart-fg: oklch(0.28 0.01 285);\n --a2-chart-muted: oklch(0.52 0.012 285);\n --a2-chart-grid: oklch(0.21 0.012 285 / 10%);\n --a2-chart-label: oklch(0.34 0.01 285);\n --a2-chart-focus: oklch(0.21 0.012 285);\n --a2-chart-mute-1: oklch(0.8 0.008 285);\n --a2-chart-mute-2: oklch(0.74 0.008 285);\n --a2-chart-mute-3: oklch(0.86 0.008 285);\n --a2-chart-mute-4: oklch(0.7 0.008 285);\n --a2-heat-low: oklch(0.965 0.006 285);\n --a2-heat-legend-low: oklch(0.965 0.006 285);\n --a2-heat-ink-hi: oklch(0.2 0.02 292);\n --a2-heat-ink-lo: oklch(0.32 0.01 285);\n --a2-treemap-ink: oklch(0.17 0.02 285);\n --a2-tooltip-bg: oklch(1 0 0 / 97%);\n --a2-tooltip-fg: oklch(0.22 0.008 285);\n --a2-tooltip-border: oklch(0.21 0.012 285 / 10%);\n --a2-tooltip-shadow: 0 12px 32px oklch(0.21 0.012 285 / 14%);\n --a2-chip-neutral: oklch(0 0 0 / 5%);\n";
|
|
2
|
+
export declare const A2UI_DARK_VARS = "\n --a2-ink: 1 0 0;\n --a2-fg: oklch(0.97 0.003 285);\n --a2-muted-fg: oklch(0.68 0.012 285);\n --a2-chart-1: oklch(0.72 0.17 292);\n --a2-chart-2: oklch(0.76 0.12 225);\n --a2-chart-3: oklch(0.79 0.15 162);\n --a2-chart-4: oklch(0.83 0.14 78);\n --a2-chart-5: oklch(0.71 0.18 12);\n --a2-chart-6: oklch(0.7 0.03 285);\n --a2-surface: oklch(0.172 0.005 285);\n --a2-line: oklch(1 0 0 / 7.5%);\n --a2-positive: oklch(0.78 0.15 160);\n --a2-negative: oklch(0.7 0.18 18);\n --a2-card-sheen: oklch(1 0 0 / 2.2%);\n --a2-card-shadow: inset 0 1px 0 oklch(1 0 0 / 4%), 0 1px 2px oklch(0 0 0 / 30%);\n --a2-chart-ink: oklch(0.78 0.01 285);\n --a2-chart-fg: oklch(0.93 0.004 285);\n --a2-chart-muted: oklch(0.6 0.012 285);\n --a2-chart-grid: oklch(1 0 0 / 6.5%);\n --a2-chart-label: oklch(0.86 0.008 285);\n --a2-chart-focus: oklch(0.97 0 0);\n --a2-chart-mute-1: oklch(0.47 0.012 285);\n --a2-chart-mute-2: oklch(0.4 0.012 285);\n --a2-chart-mute-3: oklch(0.54 0.012 285);\n --a2-chart-mute-4: oklch(0.36 0.012 285);\n --a2-heat-low: oklch(0.27 0.01 285);\n --a2-heat-legend-low: oklch(0.24 0.008 285);\n --a2-heat-ink-hi: oklch(0.18 0.02 292);\n --a2-heat-ink-lo: oklch(0.86 0.01 285);\n --a2-treemap-ink: oklch(0.17 0.02 285);\n --a2-tooltip-bg: oklch(0.2 0.006 285 / 94%);\n --a2-tooltip-fg: oklch(0.95 0.004 285);\n --a2-tooltip-border: oklch(1 0 0 / 10%);\n --a2-tooltip-shadow: 0 12px 32px oklch(0 0 0 / 45%);\n --a2-chip-neutral: oklch(1 0 0 / 5%);\n";
|
|
3
|
+
/** Series palette, violet first. */
|
|
4
|
+
export declare const A2UI_PALETTE: string[];
|
|
5
|
+
export declare const a2uiPaletteAt: (i: number, palette?: string[]) => string;
|
|
6
|
+
export declare const A2UI_POSITIVE = "var(--a2-positive)";
|
|
7
|
+
export declare const A2UI_NEGATIVE = "var(--a2-negative)";
|
|
8
|
+
export declare const A2UI_SURFACE = "var(--a2-surface)";
|
|
9
|
+
/** Dotted hairline grid. The official grid group also sets `stroke-opacity: 0.11`. */
|
|
10
|
+
export declare const A2UI_GRID: {
|
|
11
|
+
readonly stroke: "var(--a2-chart-grid)";
|
|
12
|
+
readonly strokeDasharray: "2 4";
|
|
13
|
+
readonly strokeOpacity: 0.11;
|
|
14
|
+
};
|
|
15
|
+
/** Tick label paint, as official: muted ink at 68%. */
|
|
16
|
+
export declare const A2UI_TICK: {
|
|
17
|
+
readonly fill: "var(--a2-chart-muted)";
|
|
18
|
+
readonly fillOpacity: 0.68;
|
|
19
|
+
readonly fontSize: 11;
|
|
20
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/common/a2ui/tokens.ts
|
|
2
|
+
const A2UI_LIGHT_VARS = `
|
|
3
|
+
--a2-ink: 0.21 0.012 285;
|
|
4
|
+
--a2-fg: oklch(0.2 0.008 285);
|
|
5
|
+
--a2-muted-fg: oklch(0.47 0.014 285);
|
|
6
|
+
--a2-chart-1: oklch(0.55 0.2 292);
|
|
7
|
+
--a2-chart-2: oklch(0.58 0.13 230);
|
|
8
|
+
--a2-chart-3: oklch(0.6 0.14 162);
|
|
9
|
+
--a2-chart-4: oklch(0.7 0.15 72);
|
|
10
|
+
--a2-chart-5: oklch(0.6 0.2 18);
|
|
11
|
+
--a2-chart-6: oklch(0.6 0.03 285);
|
|
12
|
+
--a2-surface: oklch(1 0 0);
|
|
13
|
+
--a2-line: oklch(0.21 0.012 285 / 9%);
|
|
14
|
+
--a2-positive: oklch(0.52 0.13 160);
|
|
15
|
+
--a2-negative: oklch(0.56 0.2 22);
|
|
16
|
+
--a2-card-sheen: transparent;
|
|
17
|
+
--a2-card-shadow: 0 1px 2px oklch(0.21 0.012 285 / 6%), 0 1px 3px oklch(0.21 0.012 285 / 4%);
|
|
18
|
+
--a2-chart-ink: oklch(0.45 0.012 285);
|
|
19
|
+
--a2-chart-fg: oklch(0.28 0.01 285);
|
|
20
|
+
--a2-chart-muted: oklch(0.52 0.012 285);
|
|
21
|
+
--a2-chart-grid: oklch(0.21 0.012 285 / 10%);
|
|
22
|
+
--a2-chart-label: oklch(0.34 0.01 285);
|
|
23
|
+
--a2-chart-focus: oklch(0.21 0.012 285);
|
|
24
|
+
--a2-chart-mute-1: oklch(0.8 0.008 285);
|
|
25
|
+
--a2-chart-mute-2: oklch(0.74 0.008 285);
|
|
26
|
+
--a2-chart-mute-3: oklch(0.86 0.008 285);
|
|
27
|
+
--a2-chart-mute-4: oklch(0.7 0.008 285);
|
|
28
|
+
--a2-heat-low: oklch(0.965 0.006 285);
|
|
29
|
+
--a2-heat-legend-low: oklch(0.965 0.006 285);
|
|
30
|
+
--a2-heat-ink-hi: oklch(0.2 0.02 292);
|
|
31
|
+
--a2-heat-ink-lo: oklch(0.32 0.01 285);
|
|
32
|
+
--a2-treemap-ink: oklch(0.17 0.02 285);
|
|
33
|
+
--a2-tooltip-bg: oklch(1 0 0 / 97%);
|
|
34
|
+
--a2-tooltip-fg: oklch(0.22 0.008 285);
|
|
35
|
+
--a2-tooltip-border: oklch(0.21 0.012 285 / 10%);
|
|
36
|
+
--a2-tooltip-shadow: 0 12px 32px oklch(0.21 0.012 285 / 14%);
|
|
37
|
+
--a2-chip-neutral: oklch(0 0 0 / 5%);
|
|
38
|
+
`;
|
|
39
|
+
const A2UI_DARK_VARS = `
|
|
40
|
+
--a2-ink: 1 0 0;
|
|
41
|
+
--a2-fg: oklch(0.97 0.003 285);
|
|
42
|
+
--a2-muted-fg: oklch(0.68 0.012 285);
|
|
43
|
+
--a2-chart-1: oklch(0.72 0.17 292);
|
|
44
|
+
--a2-chart-2: oklch(0.76 0.12 225);
|
|
45
|
+
--a2-chart-3: oklch(0.79 0.15 162);
|
|
46
|
+
--a2-chart-4: oklch(0.83 0.14 78);
|
|
47
|
+
--a2-chart-5: oklch(0.71 0.18 12);
|
|
48
|
+
--a2-chart-6: oklch(0.7 0.03 285);
|
|
49
|
+
--a2-surface: oklch(0.172 0.005 285);
|
|
50
|
+
--a2-line: oklch(1 0 0 / 7.5%);
|
|
51
|
+
--a2-positive: oklch(0.78 0.15 160);
|
|
52
|
+
--a2-negative: oklch(0.7 0.18 18);
|
|
53
|
+
--a2-card-sheen: oklch(1 0 0 / 2.2%);
|
|
54
|
+
--a2-card-shadow: inset 0 1px 0 oklch(1 0 0 / 4%), 0 1px 2px oklch(0 0 0 / 30%);
|
|
55
|
+
--a2-chart-ink: oklch(0.78 0.01 285);
|
|
56
|
+
--a2-chart-fg: oklch(0.93 0.004 285);
|
|
57
|
+
--a2-chart-muted: oklch(0.6 0.012 285);
|
|
58
|
+
--a2-chart-grid: oklch(1 0 0 / 6.5%);
|
|
59
|
+
--a2-chart-label: oklch(0.86 0.008 285);
|
|
60
|
+
--a2-chart-focus: oklch(0.97 0 0);
|
|
61
|
+
--a2-chart-mute-1: oklch(0.47 0.012 285);
|
|
62
|
+
--a2-chart-mute-2: oklch(0.4 0.012 285);
|
|
63
|
+
--a2-chart-mute-3: oklch(0.54 0.012 285);
|
|
64
|
+
--a2-chart-mute-4: oklch(0.36 0.012 285);
|
|
65
|
+
--a2-heat-low: oklch(0.27 0.01 285);
|
|
66
|
+
--a2-heat-legend-low: oklch(0.24 0.008 285);
|
|
67
|
+
--a2-heat-ink-hi: oklch(0.18 0.02 292);
|
|
68
|
+
--a2-heat-ink-lo: oklch(0.86 0.01 285);
|
|
69
|
+
--a2-treemap-ink: oklch(0.17 0.02 285);
|
|
70
|
+
--a2-tooltip-bg: oklch(0.2 0.006 285 / 94%);
|
|
71
|
+
--a2-tooltip-fg: oklch(0.95 0.004 285);
|
|
72
|
+
--a2-tooltip-border: oklch(1 0 0 / 10%);
|
|
73
|
+
--a2-tooltip-shadow: 0 12px 32px oklch(0 0 0 / 45%);
|
|
74
|
+
--a2-chip-neutral: oklch(1 0 0 / 5%);
|
|
75
|
+
`;
|
|
76
|
+
/** Series palette, violet first. */
|
|
77
|
+
const A2UI_PALETTE = [
|
|
78
|
+
"var(--a2-chart-1)",
|
|
79
|
+
"var(--a2-chart-2)",
|
|
80
|
+
"var(--a2-chart-3)",
|
|
81
|
+
"var(--a2-chart-4)",
|
|
82
|
+
"var(--a2-chart-5)",
|
|
83
|
+
"var(--a2-chart-6)"
|
|
84
|
+
];
|
|
85
|
+
const a2uiPaletteAt = (i, palette = A2UI_PALETTE) => palette[(i % palette.length + palette.length) % palette.length];
|
|
86
|
+
const A2UI_POSITIVE = "var(--a2-positive)";
|
|
87
|
+
const A2UI_NEGATIVE = "var(--a2-negative)";
|
|
88
|
+
const A2UI_SURFACE = "var(--a2-surface)";
|
|
89
|
+
/** Dotted hairline grid. The official grid group also sets `stroke-opacity: 0.11`. */
|
|
90
|
+
const A2UI_GRID = {
|
|
91
|
+
stroke: "var(--a2-chart-grid)",
|
|
92
|
+
strokeDasharray: "2 4",
|
|
93
|
+
strokeOpacity: .11
|
|
94
|
+
};
|
|
95
|
+
/** Tick label paint, as official: muted ink at 68%. */
|
|
96
|
+
const A2UI_TICK = {
|
|
97
|
+
fill: "var(--a2-chart-muted)",
|
|
98
|
+
fillOpacity: .68,
|
|
99
|
+
fontSize: 11
|
|
100
|
+
};
|
|
101
|
+
export { A2UI_DARK_VARS, A2UI_GRID, A2UI_LIGHT_VARS, A2UI_NEGATIVE, A2UI_PALETTE, A2UI_POSITIVE, A2UI_SURFACE, A2UI_TICK, a2uiPaletteAt };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=tokens.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.mjs","names":[],"sources":["../../../src/common/a2ui/tokens.ts"],"sourcesContent":["// Colour tokens of the a2ui look, per theme. Every value is a CSS variable set on the chart frame, so a\n// chart follows the page from light to dark without being rebuilt.\n// Adapted from CopilotKit a2ui-playground (MIT): src/app/globals.css (--a2-*, --ts-chart-*) and\n// src/a2ui/catalog/renderers/renderers.css.\n\nexport const A2UI_LIGHT_VARS = `\n --a2-ink: 0.21 0.012 285;\n --a2-fg: oklch(0.2 0.008 285);\n --a2-muted-fg: oklch(0.47 0.014 285);\n --a2-chart-1: oklch(0.55 0.2 292);\n --a2-chart-2: oklch(0.58 0.13 230);\n --a2-chart-3: oklch(0.6 0.14 162);\n --a2-chart-4: oklch(0.7 0.15 72);\n --a2-chart-5: oklch(0.6 0.2 18);\n --a2-chart-6: oklch(0.6 0.03 285);\n --a2-surface: oklch(1 0 0);\n --a2-line: oklch(0.21 0.012 285 / 9%);\n --a2-positive: oklch(0.52 0.13 160);\n --a2-negative: oklch(0.56 0.2 22);\n --a2-card-sheen: transparent;\n --a2-card-shadow: 0 1px 2px oklch(0.21 0.012 285 / 6%), 0 1px 3px oklch(0.21 0.012 285 / 4%);\n --a2-chart-ink: oklch(0.45 0.012 285);\n --a2-chart-fg: oklch(0.28 0.01 285);\n --a2-chart-muted: oklch(0.52 0.012 285);\n --a2-chart-grid: oklch(0.21 0.012 285 / 10%);\n --a2-chart-label: oklch(0.34 0.01 285);\n --a2-chart-focus: oklch(0.21 0.012 285);\n --a2-chart-mute-1: oklch(0.8 0.008 285);\n --a2-chart-mute-2: oklch(0.74 0.008 285);\n --a2-chart-mute-3: oklch(0.86 0.008 285);\n --a2-chart-mute-4: oklch(0.7 0.008 285);\n --a2-heat-low: oklch(0.965 0.006 285);\n --a2-heat-legend-low: oklch(0.965 0.006 285);\n --a2-heat-ink-hi: oklch(0.2 0.02 292);\n --a2-heat-ink-lo: oklch(0.32 0.01 285);\n --a2-treemap-ink: oklch(0.17 0.02 285);\n --a2-tooltip-bg: oklch(1 0 0 / 97%);\n --a2-tooltip-fg: oklch(0.22 0.008 285);\n --a2-tooltip-border: oklch(0.21 0.012 285 / 10%);\n --a2-tooltip-shadow: 0 12px 32px oklch(0.21 0.012 285 / 14%);\n --a2-chip-neutral: oklch(0 0 0 / 5%);\n`;\n\nexport const A2UI_DARK_VARS = `\n --a2-ink: 1 0 0;\n --a2-fg: oklch(0.97 0.003 285);\n --a2-muted-fg: oklch(0.68 0.012 285);\n --a2-chart-1: oklch(0.72 0.17 292);\n --a2-chart-2: oklch(0.76 0.12 225);\n --a2-chart-3: oklch(0.79 0.15 162);\n --a2-chart-4: oklch(0.83 0.14 78);\n --a2-chart-5: oklch(0.71 0.18 12);\n --a2-chart-6: oklch(0.7 0.03 285);\n --a2-surface: oklch(0.172 0.005 285);\n --a2-line: oklch(1 0 0 / 7.5%);\n --a2-positive: oklch(0.78 0.15 160);\n --a2-negative: oklch(0.7 0.18 18);\n --a2-card-sheen: oklch(1 0 0 / 2.2%);\n --a2-card-shadow: inset 0 1px 0 oklch(1 0 0 / 4%), 0 1px 2px oklch(0 0 0 / 30%);\n --a2-chart-ink: oklch(0.78 0.01 285);\n --a2-chart-fg: oklch(0.93 0.004 285);\n --a2-chart-muted: oklch(0.6 0.012 285);\n --a2-chart-grid: oklch(1 0 0 / 6.5%);\n --a2-chart-label: oklch(0.86 0.008 285);\n --a2-chart-focus: oklch(0.97 0 0);\n --a2-chart-mute-1: oklch(0.47 0.012 285);\n --a2-chart-mute-2: oklch(0.4 0.012 285);\n --a2-chart-mute-3: oklch(0.54 0.012 285);\n --a2-chart-mute-4: oklch(0.36 0.012 285);\n --a2-heat-low: oklch(0.27 0.01 285);\n --a2-heat-legend-low: oklch(0.24 0.008 285);\n --a2-heat-ink-hi: oklch(0.18 0.02 292);\n --a2-heat-ink-lo: oklch(0.86 0.01 285);\n --a2-treemap-ink: oklch(0.17 0.02 285);\n --a2-tooltip-bg: oklch(0.2 0.006 285 / 94%);\n --a2-tooltip-fg: oklch(0.95 0.004 285);\n --a2-tooltip-border: oklch(1 0 0 / 10%);\n --a2-tooltip-shadow: 0 12px 32px oklch(0 0 0 / 45%);\n --a2-chip-neutral: oklch(1 0 0 / 5%);\n`;\n\n/** Series palette, violet first. */\nexport const A2UI_PALETTE = [\n 'var(--a2-chart-1)',\n 'var(--a2-chart-2)',\n 'var(--a2-chart-3)',\n 'var(--a2-chart-4)',\n 'var(--a2-chart-5)',\n 'var(--a2-chart-6)',\n];\n\nexport const a2uiPaletteAt = (i: number, palette: string[] = A2UI_PALETTE) =>\n palette[((i % palette.length) + palette.length) % palette.length];\n\nexport const A2UI_POSITIVE = 'var(--a2-positive)';\nexport const A2UI_NEGATIVE = 'var(--a2-negative)';\nexport const A2UI_SURFACE = 'var(--a2-surface)';\n\n/** Dotted hairline grid. The official grid group also sets `stroke-opacity: 0.11`. */\nexport const A2UI_GRID = {\n stroke: 'var(--a2-chart-grid)',\n strokeDasharray: '2 4',\n strokeOpacity: 0.11,\n} as const;\n\n/** Tick label paint, as official: muted ink at 68%. */\nexport const A2UI_TICK = {\n fill: 'var(--a2-chart-muted)',\n fillOpacity: 0.68,\n fontSize: 11,\n} as const;\n"],"mappings":";AAKA,MAAa,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsC/B,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuC9B,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,iBAAiB,GAAW,UAAoB,iBAC3D,SAAU,IAAI,QAAQ,SAAU,QAAQ,UAAU,QAAQ;AAE5D,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;;AAG5B,MAAa,YAAY;CACvB,QAAQ;CACR,iBAAiB;CACjB,eAAe;AACjB;;AAGA,MAAa,YAAY;CACvB,MAAM;CACN,aAAa;CACb,UAAU;AACZ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChartNumberFormat } from "./format.mjs";
|
|
2
|
+
export type ChartVariant = 'default' | 'a2ui';
|
|
3
|
+
/** Props shared by every chart that has an a2ui look. */
|
|
4
|
+
export interface A2uiChartProps {
|
|
5
|
+
/**
|
|
6
|
+
* ISO 4217 code used when `format` is `currency` (a2ui only).
|
|
7
|
+
* @default 'USD'
|
|
8
|
+
*/
|
|
9
|
+
currency?: string;
|
|
10
|
+
/**
|
|
11
|
+
* How ticks and tooltip values are formatted in the a2ui look. `percent` expects values in 0-100.
|
|
12
|
+
* `valueFormatter` still wins for tooltip values when given.
|
|
13
|
+
*/
|
|
14
|
+
format?: ChartNumberFormat;
|
|
15
|
+
/** Secondary line under the title (a2ui only). */
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
/** Unit appended to formatted values, e.g. `ms` (a2ui only). */
|
|
18
|
+
unit?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Visual style. `a2ui` draws the chart in its own card with the A2UI palette, header legend,
|
|
21
|
+
* dotted grid and tooltip.
|
|
22
|
+
* @default 'default'
|
|
23
|
+
*/
|
|
24
|
+
variant?: ChartVariant;
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useThemeMode } from "@lobehub/ui";
|
|
2
|
+
import { styles } from "./styles.mjs";
|
|
3
|
+
// src/common/a2ui/useA2uiTheme.ts
|
|
4
|
+
/** Class that defines the a2ui colour variables for the current light / dark mode. */
|
|
5
|
+
const useA2uiThemeClass = () => {
|
|
6
|
+
const { isDarkMode } = useThemeMode();
|
|
7
|
+
return isDarkMode ? styles.dark : styles.light;
|
|
8
|
+
};
|
|
9
|
+
export { useA2uiThemeClass };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=useA2uiTheme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useA2uiTheme.mjs","names":[],"sources":["../../../src/common/a2ui/useA2uiTheme.ts"],"sourcesContent":["import { useThemeMode } from '@lobehub/ui';\n\nimport { styles } from './styles';\n\n/** Class that defines the a2ui colour variables for the current light / dark mode. */\nexport const useA2uiThemeClass = () => {\n const { isDarkMode } = useThemeMode();\n return isDarkMode ? styles.dark : styles.light;\n};\n"],"mappings":";;;;AAKA,MAAa,0BAA0B;CACrC,MAAM,EAAE,eAAe,aAAa;CACpC,OAAO,aAAa,OAAO,OAAO,OAAO;AAC3C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
// src/common/a2ui/useElementWidth.ts
|
|
3
|
+
/** Fallback used where layout is unavailable (SSR, jsdom), so the chart still renders its marks. */
|
|
4
|
+
const FALLBACK_WIDTH = 600;
|
|
5
|
+
const canObserve = () => typeof window !== "undefined" && typeof ResizeObserver !== "undefined";
|
|
6
|
+
/** Tracks the content width of an element and the font family it renders with (for text measurement). */
|
|
7
|
+
const useElementWidth = () => {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const [width, setWidth] = useState(() => canObserve() ? 0 : FALLBACK_WIDTH);
|
|
10
|
+
const [fontFamily, setFontFamily] = useState();
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
const el = ref.current;
|
|
13
|
+
if (!el || !canObserve()) return;
|
|
14
|
+
const update = () => {
|
|
15
|
+
setWidth(Math.max(0, Math.floor(el.getBoundingClientRect().width)));
|
|
16
|
+
setFontFamily(getComputedStyle(el).fontFamily);
|
|
17
|
+
};
|
|
18
|
+
update();
|
|
19
|
+
const observer = new ResizeObserver(update);
|
|
20
|
+
observer.observe(el);
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
}, []);
|
|
23
|
+
return [
|
|
24
|
+
ref,
|
|
25
|
+
width,
|
|
26
|
+
fontFamily
|
|
27
|
+
];
|
|
28
|
+
};
|
|
29
|
+
export { useElementWidth };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=useElementWidth.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElementWidth.mjs","names":[],"sources":["../../../src/common/a2ui/useElementWidth.ts"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\n\n/** Fallback used where layout is unavailable (SSR, jsdom), so the chart still renders its marks. */\nconst FALLBACK_WIDTH = 600;\n\nconst canObserve = () => typeof window !== 'undefined' && typeof ResizeObserver !== 'undefined';\n\n/** Tracks the content width of an element and the font family it renders with (for text measurement). */\nexport const useElementWidth = <T extends HTMLElement = HTMLDivElement>() => {\n const ref = useRef<T>(null);\n const [width, setWidth] = useState(() => (canObserve() ? 0 : FALLBACK_WIDTH));\n const [fontFamily, setFontFamily] = useState<string | undefined>();\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el || !canObserve()) return;\n const update = () => {\n setWidth(Math.max(0, Math.floor(el.getBoundingClientRect().width)));\n setFontFamily(getComputedStyle(el).fontFamily);\n };\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n return [ref, width, fontFamily] as const;\n};\n"],"mappings":";;;AAGA,MAAM,iBAAiB;AAEvB,MAAM,mBAAmB,OAAO,WAAW,eAAe,OAAO,mBAAmB;;AAGpF,MAAa,wBAAgE;CAC3E,MAAM,MAAM,OAAU,IAAI;CAC1B,MAAM,CAAC,OAAO,YAAY,eAAgB,WAAW,IAAI,IAAI,cAAe;CAC5E,MAAM,CAAC,YAAY,iBAAiB,SAA6B;CAEjE,sBAAsB;EACpB,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG;EAC1B,MAAM,eAAe;GACnB,SAAS,KAAK,IAAI,GAAG,KAAK,MAAM,GAAG,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC;GAClE,cAAc,iBAAiB,EAAE,CAAC,CAAC,UAAU;EAC/C;EACA,OAAO;EACP,MAAM,WAAW,IAAI,eAAe,MAAM;EAC1C,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CAEL,OAAO;EAAC;EAAK;EAAO;CAAU;AAChC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
1
2
|
import { NoDataProps } from "../NoData.mjs";
|
|
2
3
|
import { ValueFormatter } from "../../types/charts.mjs";
|
|
3
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
4
|
-
//#region src/common/benchmark/types.d.ts
|
|
5
4
|
export interface BenchmarkRecord {
|
|
6
5
|
[key: string]: any;
|
|
7
6
|
color?: string;
|
|
@@ -120,6 +119,4 @@ export interface NormalizedBenchmarkItem {
|
|
|
120
119
|
target?: string;
|
|
121
120
|
unranked?: boolean;
|
|
122
121
|
value: number;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
//# sourceMappingURL=types.d.mts.map
|
|
122
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BenchmarkFieldKeys, BenchmarkRecord, BenchmarkRenderIcon, NormalizedBenchmarkItem } from "./types.mjs";
|
|
2
|
-
//#region src/common/benchmark/utils.d.ts
|
|
3
2
|
export declare const DEFAULT_BENCHMARK_KEYS: {
|
|
4
3
|
readonly colorKey: "color";
|
|
5
4
|
readonly errorKey: "error";
|
|
@@ -53,6 +52,4 @@ export declare const getBenchmarkLabelMetrics: (label: unknown) => {
|
|
|
53
52
|
lineCount: number;
|
|
54
53
|
lines: string[];
|
|
55
54
|
longestWidth: number;
|
|
56
|
-
};
|
|
57
|
-
//#endregion
|
|
58
|
-
//# sourceMappingURL=utils.d.mts.map
|
|
55
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTextWidth } from "../../utils/getMaxLabelLength.mjs";
|
|
2
|
-
|
|
2
|
+
// src/common/benchmark/utils.ts
|
|
3
3
|
const DEFAULT_BENCHMARK_KEYS = {
|
|
4
4
|
colorKey: "color",
|
|
5
5
|
errorKey: "error",
|
|
@@ -109,7 +109,6 @@ const getBenchmarkLabelMetrics = (label) => {
|
|
|
109
109
|
longestWidth
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
|
-
//#endregion
|
|
113
112
|
export { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel };
|
|
114
113
|
|
|
115
114
|
//# sourceMappingURL=utils.mjs.map
|
package/es/common/utils.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
//#region src/common/utils.d.ts
|
|
2
1
|
export declare const constructCategoryColors: (categories: string[], colors: string[]) => Map<string, string>;
|
|
3
2
|
export declare const getYAxisDomain: (autoMinValue: boolean, minValue: number | undefined, maxValue: number | undefined) => (string | number)[];
|
|
4
3
|
export declare const constructCategories: (data: any[], color?: string) => string[];
|
|
5
4
|
export declare const deepEqual: (obj1: any, obj2: any) => boolean;
|
|
6
|
-
export declare const hasOnlyOneValueForThisKey: (array: any[], keyToCheck: string) => boolean;
|
|
7
|
-
//#endregion
|
|
8
|
-
//# sourceMappingURL=utils.d.mts.map
|
|
5
|
+
export declare const hasOnlyOneValueForThisKey: (array: any[], keyToCheck: string) => boolean;
|
package/es/common/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/common/utils.ts
|
|
2
2
|
const constructCategoryColors = (categories, colors) => {
|
|
3
3
|
const categoryColors = /* @__PURE__ */ new Map();
|
|
4
4
|
for (const [idx, category] of categories.entries()) categoryColors.set(category, colors[idx % colors.length]);
|
|
@@ -30,7 +30,6 @@ const hasOnlyOneValueForThisKey = (array, keyToCheck) => {
|
|
|
30
30
|
}
|
|
31
31
|
return true;
|
|
32
32
|
};
|
|
33
|
-
//#endregion
|
|
34
33
|
export { constructCategories, constructCategoryColors, deepEqual, getYAxisDomain, hasOnlyOneValueForThisKey };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isOnSeverSide } from "../utils/index.mjs";
|
|
2
1
|
import { useEffect } from "react";
|
|
3
|
-
|
|
2
|
+
import { isOnSeverSide } from "../utils/index.mjs";
|
|
3
|
+
// src/hooks/useOnWindowResize.ts
|
|
4
4
|
const useOnWindowResize = (handler) => {
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
if (isOnSeverSide) return;
|
|
@@ -12,7 +12,6 @@ const useOnWindowResize = (handler) => {
|
|
|
12
12
|
return () => window.removeEventListener("resize", handleResize);
|
|
13
13
|
}, [handler]);
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { useOnWindowResize };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=useOnWindowResize.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isOnSeverSide } from "../utils/index.mjs";
|
|
2
1
|
import { useEffect, useState } from "react";
|
|
3
|
-
|
|
2
|
+
import { isOnSeverSide } from "../utils/index.mjs";
|
|
3
|
+
// src/hooks/usePrefersReducedMotion.ts
|
|
4
4
|
const query = "(prefers-reduced-motion: reduce)";
|
|
5
5
|
const usePrefersReducedMotion = () => {
|
|
6
6
|
const [prefersReducedMotion, setPrefersReducedMotion] = useState(true);
|
|
@@ -18,7 +18,6 @@ const usePrefersReducedMotion = () => {
|
|
|
18
18
|
}, []);
|
|
19
19
|
return prefersReducedMotion;
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { usePrefersReducedMotion };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=usePrefersReducedMotion.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme } from "@lobehub/ui";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
|
|
3
|
+
// src/hooks/useThemeColorRange.ts
|
|
4
4
|
const useThemeColorRange = () => {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
return useMemo(() => [
|
|
@@ -22,7 +22,6 @@ const useThemeColorRange = () => {
|
|
|
22
22
|
theme.gray7
|
|
23
23
|
], [theme]);
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { useThemeColorRange };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=useThemeColorRange.mjs.map
|