@classic-homes/charts-svelte 0.1.37 → 0.2.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/dist/lib/components/base/ChartContainer.svelte +51 -11
- package/dist/lib/components/base/ChartContainer.svelte.d.ts +8 -0
- package/dist/lib/components/base/ChartError.svelte +3 -1
- package/dist/lib/components/base/ChartLegend.svelte +59 -0
- package/dist/lib/components/base/ChartLegend.svelte.d.ts +10 -0
- package/dist/lib/components/base/index.d.ts +12 -0
- package/dist/lib/components/base/index.js +1 -0
- package/dist/lib/components/core/AreaChart.svelte +126 -61
- package/dist/lib/components/core/AreaChart.svelte.d.ts +2 -1
- package/dist/lib/components/core/BarChart.svelte +91 -35
- package/dist/lib/components/core/BarChart.svelte.d.ts +2 -1
- package/dist/lib/components/core/DonutChart.svelte +155 -82
- package/dist/lib/components/core/DonutChart.svelte.d.ts +2 -1
- package/dist/lib/components/core/LineChart.svelte +118 -48
- package/dist/lib/components/core/LineChart.svelte.d.ts +2 -1
- package/dist/lib/components/core/PieChart.svelte +100 -38
- package/dist/lib/components/core/PieChart.svelte.d.ts +2 -1
- package/dist/lib/components/core/ScatterChart.svelte +115 -38
- package/dist/lib/components/core/ScatterChart.svelte.d.ts +2 -1
- package/dist/lib/components/extended/CandlestickChart.svelte +53 -26
- package/dist/lib/components/extended/FunnelChart.svelte +102 -32
- package/dist/lib/components/extended/FunnelChart.svelte.d.ts +2 -1
- package/dist/lib/components/extended/GaugeChart.svelte +62 -29
- package/dist/lib/components/extended/HeatmapChart.svelte +59 -29
- package/dist/lib/components/extended/RadarChart.svelte +76 -22
- package/dist/lib/components/extended/RadarChart.svelte.d.ts +2 -1
- package/dist/lib/components/extended/SankeyChart.svelte +50 -21
- package/dist/lib/components/extended/TreemapChart.svelte +71 -26
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/composables/index.d.ts +1 -0
- package/dist/lib/composables/index.js +1 -0
- package/dist/lib/composables/useChart.svelte.js +20 -3
- package/dist/lib/composables/useChartLegend.svelte.d.ts +37 -0
- package/dist/lib/composables/useChartLegend.svelte.js +54 -0
- package/dist/lib/composables/useChartTheme.svelte.d.ts +2 -1
- package/dist/lib/composables/useChartTheme.svelte.js +2 -6
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +2 -2
- package/package.json +1 -1
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
import type { EChartsOption } from 'echarts';
|
|
7
7
|
|
|
8
8
|
import type { SankeyChartProps, SankeyEventParams } from '@classic-homes/charts-core';
|
|
9
|
+
import {
|
|
10
|
+
buildDataLabel,
|
|
11
|
+
buildTooltip,
|
|
12
|
+
mergeChartOption,
|
|
13
|
+
nameLabelLookup,
|
|
14
|
+
pointLabel,
|
|
15
|
+
} from '@classic-homes/charts-core';
|
|
9
16
|
|
|
10
17
|
import { cn } from '../../utils.js';
|
|
11
18
|
import { useChart } from '../../composables/useChart.svelte.js';
|
|
@@ -29,6 +36,10 @@
|
|
|
29
36
|
animation = true,
|
|
30
37
|
showTooltip = true,
|
|
31
38
|
orient = 'horizontal',
|
|
39
|
+
labelFormatter,
|
|
40
|
+
tooltipFormatter,
|
|
41
|
+
tooltipValueFormatter,
|
|
42
|
+
option: optionOverride,
|
|
32
43
|
onClick,
|
|
33
44
|
class: className,
|
|
34
45
|
}: Props = $props();
|
|
@@ -38,27 +49,45 @@
|
|
|
38
49
|
const option: EChartsOption = $derived.by(() => {
|
|
39
50
|
if (isEmpty) return {};
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
const getLabel = nameLabelLookup(data.nodes);
|
|
53
|
+
|
|
54
|
+
return mergeChartOption(
|
|
55
|
+
{
|
|
56
|
+
tooltip: buildTooltip(
|
|
57
|
+
{ trigger: 'item', triggerOn: 'mousemove' },
|
|
58
|
+
{
|
|
59
|
+
show: showTooltip,
|
|
60
|
+
formatter: tooltipFormatter,
|
|
61
|
+
valueFormatter: tooltipValueFormatter,
|
|
62
|
+
getLabel,
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
series: [
|
|
66
|
+
{
|
|
67
|
+
type: 'sankey',
|
|
68
|
+
orient,
|
|
69
|
+
emphasis: { focus: 'adjacency' },
|
|
70
|
+
data: data.nodes.map((node) => ({
|
|
71
|
+
name: node.name,
|
|
72
|
+
itemStyle: node.color ? { color: node.color } : undefined,
|
|
73
|
+
label: pointLabel(node.label, labelFormatter),
|
|
74
|
+
})),
|
|
75
|
+
links: data.links.map((link) => ({
|
|
76
|
+
source: link.source,
|
|
77
|
+
target: link.target,
|
|
78
|
+
value: link.value,
|
|
79
|
+
})),
|
|
80
|
+
lineStyle: { color: 'gradient', curveness: 0.5 },
|
|
81
|
+
label: buildDataLabel(
|
|
82
|
+
{ position: orient === 'horizontal' ? 'right' : 'bottom' },
|
|
83
|
+
undefined,
|
|
84
|
+
{ show: true, formatter: labelFormatter, getLabel }
|
|
85
|
+
),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
} as EChartsOption,
|
|
89
|
+
optionOverride
|
|
90
|
+
);
|
|
62
91
|
});
|
|
63
92
|
|
|
64
93
|
const accessibilityDescription = $derived(
|
|
@@ -5,7 +5,21 @@
|
|
|
5
5
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
6
6
|
import type { EChartsOption } from 'echarts';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
TreemapChartProps,
|
|
10
|
+
TreemapEventParams,
|
|
11
|
+
TreemapNode,
|
|
12
|
+
} from '@classic-homes/charts-core';
|
|
13
|
+
import {
|
|
14
|
+
buildDataLabel,
|
|
15
|
+
buildTooltip,
|
|
16
|
+
escapeHtml,
|
|
17
|
+
formatTooltipValue,
|
|
18
|
+
getChartColors,
|
|
19
|
+
mergeChartOption,
|
|
20
|
+
nameLabelLookup,
|
|
21
|
+
pointLabel,
|
|
22
|
+
} from '@classic-homes/charts-core';
|
|
9
23
|
|
|
10
24
|
import { cn } from '../../utils.js';
|
|
11
25
|
import { useChart } from '../../composables/useChart.svelte.js';
|
|
@@ -29,44 +43,75 @@
|
|
|
29
43
|
theme = 'auto',
|
|
30
44
|
animation = true,
|
|
31
45
|
showTooltip = true,
|
|
46
|
+
labelFormatter,
|
|
47
|
+
tooltipFormatter,
|
|
48
|
+
tooltipValueFormatter,
|
|
49
|
+
option: optionOverride,
|
|
32
50
|
onClick,
|
|
33
51
|
class: className,
|
|
34
52
|
}: Props = $props();
|
|
35
53
|
|
|
36
54
|
const isEmpty = $derived(!data?.length);
|
|
37
55
|
|
|
56
|
+
// Per-element colours that follow the resolved chart theme
|
|
57
|
+
const chartColors = $derived.by(() => getChartColors(chart.theme));
|
|
58
|
+
|
|
38
59
|
const option: EChartsOption = $derived.by(() => {
|
|
39
60
|
if (isEmpty) return {};
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
const getLabel = nameLabelLookup(data);
|
|
63
|
+
// ECharts expects a label object, so swap each node's label text for one
|
|
64
|
+
const toNode = (n: TreemapNode): Record<string, unknown> => ({
|
|
65
|
+
...n,
|
|
66
|
+
children: n.children?.map(toNode),
|
|
67
|
+
label: pointLabel(n.label, labelFormatter),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return mergeChartOption(
|
|
71
|
+
{
|
|
72
|
+
tooltip: buildTooltip(
|
|
73
|
+
{
|
|
44
74
|
formatter: (params: unknown) => {
|
|
45
75
|
const p = params as { name?: string; value?: number };
|
|
46
|
-
return `${p.name}: ${p.value}`;
|
|
76
|
+
return `${escapeHtml(p.name)}: ${escapeHtml(formatTooltipValue(p.value, tooltipValueFormatter))}`;
|
|
47
77
|
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
show: showTooltip,
|
|
81
|
+
formatter: tooltipFormatter,
|
|
82
|
+
valueFormatter: tooltipValueFormatter,
|
|
83
|
+
getLabel,
|
|
48
84
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
),
|
|
86
|
+
series: [
|
|
87
|
+
{
|
|
88
|
+
type: 'treemap',
|
|
89
|
+
data: data.map(toNode),
|
|
90
|
+
roam: false,
|
|
91
|
+
levels: (levels || [
|
|
92
|
+
{ itemStyle: { borderColor: chartColors.divider, borderWidth: 4, gapWidth: 4 } },
|
|
93
|
+
{
|
|
94
|
+
colorSaturation: [0.3, 0.6],
|
|
95
|
+
itemStyle: { borderColorSaturation: 0.7, gapWidth: 2, borderWidth: 2 },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
colorSaturation: [0.3, 0.5],
|
|
99
|
+
itemStyle: { borderColorSaturation: 0.6, gapWidth: 1 },
|
|
100
|
+
},
|
|
101
|
+
{ colorSaturation: [0.3, 0.5] },
|
|
102
|
+
]) as unknown[],
|
|
103
|
+
label: buildDataLabel({ show: true, formatter: '{b}' }, undefined, {
|
|
104
|
+
show: true,
|
|
105
|
+
formatter: labelFormatter,
|
|
106
|
+
getLabel,
|
|
107
|
+
}),
|
|
108
|
+
upperLabel: { show: true, height: 30 },
|
|
109
|
+
breadcrumb: { show: true },
|
|
110
|
+
},
|
|
111
|
+
] as EChartsOption['series'],
|
|
112
|
+
} as EChartsOption,
|
|
113
|
+
optionOverride
|
|
114
|
+
);
|
|
70
115
|
});
|
|
71
116
|
|
|
72
117
|
const accessibilityDescription = $derived(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty } from './base/index.js';
|
|
1
|
+
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty, ChartLegend, type ChartContainerProps, type ChartLegendProps, type ChartSkeletonProps, type ChartErrorProps, type ChartEmptyProps, } from './base/index.js';
|
|
2
2
|
export { LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart, } from './core/index.js';
|
|
3
3
|
export { RadarChart, FunnelChart, GaugeChart, HeatmapChart, TreemapChart, CandlestickChart, SankeyChart, } from './extended/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Base components
|
|
2
|
-
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty } from './base/index.js';
|
|
2
|
+
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty, ChartLegend, } from './base/index.js';
|
|
3
3
|
// Core charts
|
|
4
4
|
export { LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart, } from './core/index.js';
|
|
5
5
|
// Extended charts
|
|
@@ -2,3 +2,4 @@ export { useChart, type UseChartOptions, type UseChartReturn } from './useChart.
|
|
|
2
2
|
export { useChartTheme, registerClassicThemes } from './useChartTheme.svelte.js';
|
|
3
3
|
export { useReducedMotion } from './useReducedMotion.svelte.js';
|
|
4
4
|
export { useChartResize } from './useChartResize.svelte.js';
|
|
5
|
+
export { useChartLegend, type CustomLegendProps, type UseChartLegendOptions, type UseChartLegendReturn, } from './useChartLegend.svelte.js';
|
|
@@ -2,3 +2,4 @@ export { useChart } from './useChart.svelte.js';
|
|
|
2
2
|
export { useChartTheme, registerClassicThemes } from './useChartTheme.svelte.js';
|
|
3
3
|
export { useReducedMotion } from './useReducedMotion.svelte.js';
|
|
4
4
|
export { useChartResize } from './useChartResize.svelte.js';
|
|
5
|
+
export { useChartLegend, } from './useChartLegend.svelte.js';
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { untrack } from 'svelte';
|
|
2
2
|
import * as echarts from 'echarts/core';
|
|
3
|
+
import { getReplaceMerge } from '@classic-homes/charts-core';
|
|
3
4
|
import { useChartTheme } from './useChartTheme.svelte.js';
|
|
4
5
|
import { useChartResize } from './useChartResize.svelte.js';
|
|
5
6
|
import { useReducedMotion } from './useReducedMotion.svelte.js';
|
|
6
|
-
const
|
|
7
|
+
const isComponentType = (mainType) => echarts.ComponentModel.hasClass(mainType);
|
|
8
|
+
// The option last applied to each instance; a fresh instance has none
|
|
9
|
+
const appliedOptions = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Apply a complete option on top of the one last applied to this instance.
|
|
12
|
+
* Series, graphics and components that dropped out of the option are replaced
|
|
13
|
+
* so they disappear; everything else is merged so legend selection and
|
|
14
|
+
* dataZoom ranges survive data updates.
|
|
15
|
+
*/
|
|
16
|
+
function applyOption(chart, next) {
|
|
17
|
+
const prev = appliedOptions.get(chart) ?? null;
|
|
18
|
+
chart.setOption(next, {
|
|
19
|
+
replaceMerge: getReplaceMerge(prev, next, isComponentType),
|
|
20
|
+
lazyUpdate: true,
|
|
21
|
+
});
|
|
22
|
+
appliedOptions.set(chart, next);
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* Composable to manage ECharts instance lifecycle
|
|
9
26
|
* Matches behavior of React useChart hook
|
|
@@ -34,7 +51,7 @@ export function useChart(opts) {
|
|
|
34
51
|
// or callback changes update the chart instead of re-initializing it
|
|
35
52
|
untrack(() => {
|
|
36
53
|
if (!(opts.isEmpty?.() ?? false)) {
|
|
37
|
-
chart
|
|
54
|
+
applyOption(chart, resolveOption());
|
|
38
55
|
}
|
|
39
56
|
opts.onReady?.(chart);
|
|
40
57
|
});
|
|
@@ -55,7 +72,7 @@ export function useChart(opts) {
|
|
|
55
72
|
const empty = opts.isEmpty?.() ?? false;
|
|
56
73
|
if (!chart || chart.isDisposed() || empty)
|
|
57
74
|
return;
|
|
58
|
-
chart
|
|
75
|
+
applyOption(chart, option);
|
|
59
76
|
});
|
|
60
77
|
return {
|
|
61
78
|
get container() {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type * as echarts from 'echarts/core';
|
|
3
|
+
import { type ChartLegendConfig, type LegendRenderProps } from '@classic-homes/charts-core';
|
|
4
|
+
/** Props shared by charts that can render a custom legend */
|
|
5
|
+
export interface CustomLegendProps {
|
|
6
|
+
/**
|
|
7
|
+
* Render your own legend in place of the built-in one, e.g.
|
|
8
|
+
* `{#snippet legend(props)}<ChartLegend {...props} />{/snippet}` passed as
|
|
9
|
+
* `renderLegend={legend}`
|
|
10
|
+
*/
|
|
11
|
+
renderLegend?: Snippet<[LegendRenderProps]>;
|
|
12
|
+
}
|
|
13
|
+
export interface UseChartLegendOptions {
|
|
14
|
+
/** Getter returning legend item names in chart order */
|
|
15
|
+
names: () => string[];
|
|
16
|
+
/** Getter returning per-item colour overrides, by index */
|
|
17
|
+
colors: () => (string | undefined)[];
|
|
18
|
+
/** Getter returning the theme series palette */
|
|
19
|
+
palette: () => string[];
|
|
20
|
+
/** Getter returning the built-in legend config (its position also places a custom legend) */
|
|
21
|
+
config?: () => ChartLegendConfig | undefined;
|
|
22
|
+
/** Getter returning the chart title */
|
|
23
|
+
title: () => string;
|
|
24
|
+
/** Getter returning the change callback, read at event time */
|
|
25
|
+
onLegendChange?: () => ((visible: Record<string, boolean>) => void) | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface UseChartLegendReturn {
|
|
28
|
+
/** Register legend listeners; call from the chart's `onReady` */
|
|
29
|
+
attach: (chart: echarts.ECharts) => void;
|
|
30
|
+
/** State and actions for a custom legend renderer */
|
|
31
|
+
readonly renderProps: LegendRenderProps;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Track legend selection for a chart and expose it to custom legends
|
|
35
|
+
* Matches behavior of React useChartLegend hook
|
|
36
|
+
*/
|
|
37
|
+
export declare function useChartLegend(opts: UseChartLegendOptions): UseChartLegendReturn;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getLegendItems, } from '@classic-homes/charts-core';
|
|
2
|
+
// Every legend selection event carries the full `selected` map
|
|
3
|
+
const LEGEND_EVENTS = [
|
|
4
|
+
'legendselectchanged',
|
|
5
|
+
'legendselected',
|
|
6
|
+
'legendunselected',
|
|
7
|
+
'legendselectall',
|
|
8
|
+
'legendinverseselect',
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Track legend selection for a chart and expose it to custom legends
|
|
12
|
+
* Matches behavior of React useChartLegend hook
|
|
13
|
+
*/
|
|
14
|
+
export function useChartLegend(opts) {
|
|
15
|
+
let chartInstance = null;
|
|
16
|
+
let visible = $state({});
|
|
17
|
+
const dispatch = (action) => {
|
|
18
|
+
if (chartInstance && !chartInstance.isDisposed())
|
|
19
|
+
chartInstance.dispatchAction(action);
|
|
20
|
+
};
|
|
21
|
+
const items = $derived(getLegendItems(opts.names(), opts.palette(), opts.colors(), visible));
|
|
22
|
+
const actions = {
|
|
23
|
+
toggle: (name) => dispatch({ type: 'legendToggleSelect', name }),
|
|
24
|
+
setVisible: (name, show) => dispatch({ type: show ? 'legendSelect' : 'legendUnSelect', name }),
|
|
25
|
+
showOnly: (name) => {
|
|
26
|
+
for (const other of opts.names()) {
|
|
27
|
+
dispatch({ type: other === name ? 'legendSelect' : 'legendUnSelect', name: other });
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
showAll: () => dispatch({ type: 'legendAllSelect' }),
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
attach(chart) {
|
|
34
|
+
chartInstance = chart;
|
|
35
|
+
// A new instance starts with every item shown
|
|
36
|
+
visible = {};
|
|
37
|
+
const handler = (params) => {
|
|
38
|
+
const selected = { ...params.selected };
|
|
39
|
+
visible = selected;
|
|
40
|
+
opts.onLegendChange?.()?.(selected);
|
|
41
|
+
};
|
|
42
|
+
for (const event of LEGEND_EVENTS)
|
|
43
|
+
chart.on(event, handler);
|
|
44
|
+
},
|
|
45
|
+
get renderProps() {
|
|
46
|
+
return {
|
|
47
|
+
items,
|
|
48
|
+
position: opts.config?.()?.position ?? 'bottom',
|
|
49
|
+
chartTitle: opts.title(),
|
|
50
|
+
...actions,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare function registerClassicThemes(): void;
|
|
5
5
|
/**
|
|
6
|
-
* Create a reactive chart theme based on
|
|
6
|
+
* Create a reactive chart theme based on the document dark mode class. 'auto'
|
|
7
|
+
* follows the `.dark` class on <html>, the same switch the token CSS keys on.
|
|
7
8
|
* @param getPreference - A getter function that returns the current theme preference
|
|
8
9
|
*/
|
|
9
10
|
export declare function useChartTheme(getPreference: () => 'light' | 'dark' | 'auto'): {
|
|
@@ -12,7 +12,8 @@ export function registerClassicThemes() {
|
|
|
12
12
|
themesRegistered = true;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Create a reactive chart theme based on
|
|
15
|
+
* Create a reactive chart theme based on the document dark mode class. 'auto'
|
|
16
|
+
* follows the `.dark` class on <html>, the same switch the token CSS keys on.
|
|
16
17
|
* @param getPreference - A getter function that returns the current theme preference
|
|
17
18
|
*/
|
|
18
19
|
export function useChartTheme(getPreference) {
|
|
@@ -49,13 +50,8 @@ export function useChartTheme(getPreference) {
|
|
|
49
50
|
attributes: true,
|
|
50
51
|
attributeFilter: ['class'],
|
|
51
52
|
});
|
|
52
|
-
// Also listen for media query changes
|
|
53
|
-
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
54
|
-
const handleMediaChange = () => updateTheme();
|
|
55
|
-
mediaQuery.addEventListener('change', handleMediaChange);
|
|
56
53
|
return () => {
|
|
57
54
|
observer.disconnect();
|
|
58
|
-
mediaQuery.removeEventListener('change', handleMediaChange);
|
|
59
55
|
};
|
|
60
56
|
});
|
|
61
57
|
return {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Svelte ECharts components for the Classic Theme design system
|
|
5
5
|
*/
|
|
6
|
-
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty, LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart, RadarChart, FunnelChart, GaugeChart, HeatmapChart, TreemapChart, CandlestickChart, SankeyChart, } from './components/index.js';
|
|
7
|
-
export { useChart, useChartTheme, registerClassicThemes, useReducedMotion, type UseChartOptions, type UseChartReturn, } from './composables/index.js';
|
|
6
|
+
export { ChartContainer, ChartSkeleton, ChartError, ChartEmpty, ChartLegend, type ChartContainerProps, type ChartLegendProps, type ChartSkeletonProps, type ChartErrorProps, type ChartEmptyProps, LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart, RadarChart, FunnelChart, GaugeChart, HeatmapChart, TreemapChart, CandlestickChart, SankeyChart, } from './components/index.js';
|
|
7
|
+
export { useChart, useChartTheme, useChartResize, registerClassicThemes, useReducedMotion, useChartLegend, type CustomLegendProps, type UseChartLegendOptions, type UseChartLegendReturn, type UseChartOptions, type UseChartReturn, } from './composables/index.js';
|
|
8
8
|
export { cn } from './utils.js';
|
|
9
|
-
export type { BaseChartProps, LineChartProps, BarChartProps, PieChartProps, DonutChartProps, AreaChartProps, ScatterChartProps, RadarChartProps, FunnelChartProps, GaugeChartProps, HeatmapChartProps, TreemapChartProps, CandlestickChartProps, SankeyChartProps, LineChartData, LineSeriesData, BarChartData, BarSeriesData, PieSliceData, AreaChartData, AreaSeriesData, ScatterChartData, ScatterSeriesData, RadarChartData, RadarSeriesData, RadarIndicator, FunnelSliceData, HeatmapData, TreemapNode, TreemapLevel, CandlestickData, CandlestickItem, SankeyData, SankeyNode, SankeyLink, BaseEventParams, DataPointEventParams, SliceEventParams, HeatmapEventParams, TreemapEventParams, CandlestickEventParams, SankeyEventParams, } from '@classic-homes/charts-core';
|
|
9
|
+
export type { BaseChartProps, LegendChartProps, LabelChartProps, AxisChartProps, AxisConfig, ChartFormatter, ChartLegendConfig, ChartLegendPosition, LabelFormatterParams, TooltipFormatterParams, LegendItem, LegendRenderProps, LineChartProps, BarChartProps, PieChartProps, DonutChartProps, AreaChartProps, ScatterChartProps, RadarChartProps, FunnelChartProps, GaugeChartProps, HeatmapChartProps, TreemapChartProps, CandlestickChartProps, SankeyChartProps, LineChartData, LineSeriesData, BarChartData, BarSeriesData, PieSliceData, AreaChartData, AreaSeriesData, ScatterChartData, ScatterSeriesData, RadarChartData, RadarSeriesData, RadarIndicator, FunnelSliceData, HeatmapData, TreemapNode, TreemapLevel, CandlestickData, CandlestickItem, SankeyData, SankeyNode, SankeyLink, BaseEventParams, DataPointEventParams, SliceEventParams, HeatmapEventParams, TreemapEventParams, CandlestickEventParams, SankeyEventParams, } from '@classic-homes/charts-core';
|
package/dist/lib/index.js
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
// Components
|
|
7
7
|
export {
|
|
8
8
|
// Base
|
|
9
|
-
ChartContainer, ChartSkeleton, ChartError, ChartEmpty,
|
|
9
|
+
ChartContainer, ChartSkeleton, ChartError, ChartEmpty, ChartLegend,
|
|
10
10
|
// Core charts
|
|
11
11
|
LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart,
|
|
12
12
|
// Extended charts
|
|
13
13
|
RadarChart, FunnelChart, GaugeChart, HeatmapChart, TreemapChart, CandlestickChart, SankeyChart, } from './components/index.js';
|
|
14
14
|
// Composables
|
|
15
|
-
export { useChart, useChartTheme, registerClassicThemes, useReducedMotion, } from './composables/index.js';
|
|
15
|
+
export { useChart, useChartTheme, useChartResize, registerClassicThemes, useReducedMotion, useChartLegend, } from './composables/index.js';
|
|
16
16
|
// Utils
|
|
17
17
|
export { cn } from './utils.js';
|