@aura-react-comp/charts 0.2.0 → 0.3.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/esm/charts/area-chart/index.d.ts +2 -2
- package/esm/charts/area-chart/index.js +1 -0
- package/esm/charts/bar-chart/index.d.ts +1 -1
- package/esm/charts/bar-chart/index.js +1 -0
- package/esm/charts/candlestick-chart/index.d.ts +2 -2
- package/esm/charts/candlestick-chart/index.js +1 -0
- package/esm/charts/combo-chart/index.d.ts +1 -1
- package/esm/charts/combo-chart/index.js +1 -0
- package/esm/charts/funnel-chart/index.d.ts +2 -2
- package/esm/charts/funnel-chart/index.js +1 -0
- package/esm/charts/gauge-chart/index.d.ts +1 -1
- package/esm/charts/gauge-chart/index.js +1 -0
- package/esm/charts/graph-chart/index.d.ts +3 -3
- package/esm/charts/graph-chart/index.js +1 -0
- package/esm/charts/heatmap-chart/index.d.ts +2 -2
- package/esm/charts/heatmap-chart/index.js +1 -0
- package/esm/charts/line-chart/index.d.ts +2 -2
- package/esm/charts/line-chart/index.js +1 -0
- package/esm/charts/pie-chart/index.d.ts +2 -2
- package/esm/charts/pie-chart/index.js +1 -0
- package/esm/charts/radar-chart/index.d.ts +2 -2
- package/esm/charts/radar-chart/index.js +1 -0
- package/esm/charts/ring-progress/index.d.ts +1 -1
- package/esm/charts/ring-progress/index.js +1 -0
- package/esm/charts/sankey-chart/index.d.ts +3 -3
- package/esm/charts/sankey-chart/index.js +1 -0
- package/esm/charts/scatter-chart/index.d.ts +3 -3
- package/esm/charts/scatter-chart/index.js +1 -0
- package/esm/charts/sparkline/index.d.ts +1 -1
- package/esm/charts/sparkline/index.js +1 -0
- package/esm/charts/tree-chart/index.d.ts +3 -3
- package/esm/charts/tree-chart/index.js +1 -0
- package/esm/charts/treemap-chart/index.d.ts +3 -3
- package/esm/charts/treemap-chart/index.js +1 -0
- package/esm/charts/waterfall-chart/index.d.ts +2 -2
- package/esm/charts/waterfall-chart/index.js +1 -0
- package/esm/components/Legend.d.ts +2 -2
- package/esm/components/Legend.js +1 -0
- package/esm/components/Tooltip.d.ts +2 -2
- package/esm/components/Tooltip.js +1 -0
- package/esm/components/chart/index.d.ts +1 -1
- package/esm/components/chart/index.js +1 -0
- package/esm/core/animation.js +1 -0
- package/esm/core/force.js +1 -0
- package/esm/core/format.js +1 -0
- package/esm/core/hierarchy.d.ts +1 -1
- package/esm/core/hierarchy.js +1 -0
- package/esm/core/layout.d.ts +1 -1
- package/esm/core/layout.js +1 -0
- package/esm/core/sampling.js +1 -0
- package/esm/core/sankey.js +1 -0
- package/esm/core/scale.js +1 -0
- package/esm/core/shape.js +1 -0
- package/esm/hooks/useChartTheme.d.ts +6 -5
- package/esm/hooks/useChartTheme.d.ts.map +1 -1
- package/esm/hooks/useChartTheme.js +7 -5
- package/esm/hooks/useChartTransition.d.ts +1 -1
- package/esm/hooks/useChartTransition.js +1 -0
- package/esm/hooks/useElementSize.js +1 -0
- package/esm/index.d.ts +50 -50
- package/esm/index.js +1 -0
- package/esm/internal/CartesianChart.d.ts +1 -1
- package/esm/internal/CartesianChart.js +1 -0
- package/esm/internal/model.d.ts +2 -2
- package/esm/internal/model.js +1 -0
- package/esm/scene/canvas.d.ts +1 -1
- package/esm/scene/canvas.js +1 -0
- package/esm/scene/svg.d.ts +1 -1
- package/esm/scene/svg.js +1 -0
- package/esm/scene/types.js +1 -0
- package/esm/theme/index.d.ts +2 -2
- package/esm/theme/index.d.ts.map +1 -1
- package/esm/theme/index.js +9 -6
- package/esm/types.d.ts +3 -3
- package/esm/types.js +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BaseChartProps } from '../../types';
|
|
3
|
-
import type { CurveType } from '../../core/shape';
|
|
2
|
+
import type { BaseChartProps } from '../../types.js';
|
|
3
|
+
import type { CurveType } from '../../core/shape.js';
|
|
4
4
|
export interface AreaChartProps extends BaseChartProps {
|
|
5
5
|
curve?: CurveType;
|
|
6
6
|
smooth?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface CandlestickItem {
|
|
5
5
|
/** 时间标签(交易日、周、月) */
|
|
6
6
|
date: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface FunnelDataItem {
|
|
5
5
|
name: string;
|
|
6
6
|
value: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import { type ForceLink, type ForceNode } from '../../core/force';
|
|
4
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import { type ForceLink, type ForceNode } from '../../core/force.js';
|
|
4
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
5
5
|
export interface GraphChartProps {
|
|
6
6
|
nodes?: ForceNode[];
|
|
7
7
|
links?: ForceLink[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface HeatmapCell {
|
|
5
5
|
/** 横轴分类 */
|
|
6
6
|
x: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BaseChartProps } from '../../types';
|
|
3
|
-
import type { CurveType } from '../../core/shape';
|
|
2
|
+
import type { BaseChartProps } from '../../types.js';
|
|
3
|
+
import type { CurveType } from '../../core/shape.js';
|
|
4
4
|
export interface LineChartProps extends BaseChartProps {
|
|
5
5
|
/** 曲线插值方式,默认 monotone(平滑但不越界) */
|
|
6
6
|
curve?: CurveType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { LegendConfig, TooltipConfig } from '../../types';
|
|
2
|
+
import type { ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { LegendConfig, TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface PieDataItem {
|
|
5
5
|
name: string;
|
|
6
6
|
value: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { LegendConfig, TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { LegendConfig, TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface RadarIndicator {
|
|
5
5
|
/** 指标名,显示在顶点外侧 */
|
|
6
6
|
name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import { type SankeyLinkInput, type SankeyNode } from '../../core/sankey';
|
|
4
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import { type SankeyLinkInput, type SankeyNode } from '../../core/sankey.js';
|
|
4
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
5
5
|
export interface SankeyChartProps {
|
|
6
6
|
/** 节点列表;只传 links 时会自动从 links 推导 */
|
|
7
7
|
nodes?: SankeyNode[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChartDataRow, SeriesConfig } from '../../types';
|
|
3
|
-
import { type ChartThemeInput } from '../../theme';
|
|
4
|
-
import type { LegendConfig, TooltipConfig } from '../../types';
|
|
2
|
+
import type { ChartDataRow, SeriesConfig } from '../../types.js';
|
|
3
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
4
|
+
import type { LegendConfig, TooltipConfig } from '../../types.js';
|
|
5
5
|
export interface ScatterChartProps {
|
|
6
6
|
data?: ChartDataRow[];
|
|
7
7
|
/** 数值型 x 字段 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type HierarchyNode } from '../../core/hierarchy';
|
|
3
|
-
import { type ChartThemeInput } from '../../theme';
|
|
4
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type HierarchyNode } from '../../core/hierarchy.js';
|
|
3
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
4
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
5
5
|
export interface TreeChartProps {
|
|
6
6
|
data?: HierarchyNode;
|
|
7
7
|
/** 节点圆点半径 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type HierarchyNode } from '../../core/hierarchy';
|
|
3
|
-
import { type ChartThemeInput } from '../../theme';
|
|
4
|
-
import type { ChartAnimationInput, TooltipConfig } from '../../types';
|
|
2
|
+
import { type HierarchyNode } from '../../core/hierarchy.js';
|
|
3
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
4
|
+
import type { ChartAnimationInput, TooltipConfig } from '../../types.js';
|
|
5
5
|
export interface TreemapChartProps {
|
|
6
6
|
/** 根节点;只渲染它的子孙 */
|
|
7
7
|
data?: HierarchyNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ChartThemeInput } from '../../theme';
|
|
3
|
-
import type { TooltipConfig } from '../../types';
|
|
2
|
+
import { type ChartThemeInput } from '../../theme/index.js';
|
|
3
|
+
import type { TooltipConfig } from '../../types.js';
|
|
4
4
|
export interface WaterfallItem {
|
|
5
5
|
name: string;
|
|
6
6
|
/** 增量值:正为增加,负为减少 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChartTheme } from '../theme';
|
|
3
|
-
import type { LegendConfig } from '../types';
|
|
2
|
+
import type { ChartTheme } from '../theme/index.js';
|
|
3
|
+
import type { LegendConfig } from '../types.js';
|
|
4
4
|
export interface LegendItem {
|
|
5
5
|
key: string;
|
|
6
6
|
name: string;
|
package/esm/components/Legend.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChartTheme } from '../theme';
|
|
3
|
-
import type { TooltipConfig, TooltipPayload } from '../types';
|
|
2
|
+
import type { ChartTheme } from '../theme/index.js';
|
|
3
|
+
import type { TooltipConfig, TooltipPayload } from '../types.js';
|
|
4
4
|
export interface TooltipProps {
|
|
5
5
|
payload: TooltipPayload | null;
|
|
6
6
|
/** 相对容器的像素位置 */
|
package/esm/core/animation.js
CHANGED
package/esm/core/force.js
CHANGED
package/esm/core/format.js
CHANGED
package/esm/core/hierarchy.d.ts
CHANGED
package/esm/core/hierarchy.js
CHANGED
package/esm/core/layout.d.ts
CHANGED
package/esm/core/layout.js
CHANGED
package/esm/core/sampling.js
CHANGED
package/esm/core/sankey.js
CHANGED
package/esm/core/scale.js
CHANGED
package/esm/core/shape.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type ChartTheme, type ChartThemeInput } from '../theme';
|
|
1
|
+
import { type ChartTheme, type ChartThemeInput } from '../theme/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 解析图表主题,并在主题属性变化时重新读取。
|
|
4
4
|
*
|
|
5
|
-
* 为什么需要订阅:Aura
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* 为什么需要订阅:Aura 的主题是 `document.documentElement` 上的双轴属性
|
|
6
|
+
* (`data-mode`=明暗 × `data-palette`=色板,见 ui/theme/tokens.css)。
|
|
7
|
+
* 图表颜色若是挂载时读一次,用户点切换后图表会停在旧配色 ——
|
|
8
|
+
* 视觉上和整站脱节。旧的 `data-theme` 键继续监听以兼容历史用法。
|
|
8
9
|
*/
|
|
9
10
|
export declare function useChartTheme(input?: ChartThemeInput, palette?: string[]): ChartTheme;
|
|
10
11
|
//# sourceMappingURL=useChartTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChartTheme.d.ts","sourceRoot":"","sources":["useChartTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAE/E
|
|
1
|
+
{"version":3,"file":"useChartTheme.d.ts","sourceRoot":"","sources":["useChartTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,UAAU,CAiCZ"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
3
|
import { resolveTheme } from "../theme";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* 解析图表主题,并在主题属性变化时重新读取。
|
|
6
7
|
*
|
|
7
|
-
* 为什么需要订阅:Aura
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 为什么需要订阅:Aura 的主题是 `document.documentElement` 上的双轴属性
|
|
9
|
+
* (`data-mode`=明暗 × `data-palette`=色板,见 ui/theme/tokens.css)。
|
|
10
|
+
* 图表颜色若是挂载时读一次,用户点切换后图表会停在旧配色 ——
|
|
11
|
+
* 视觉上和整站脱节。旧的 `data-theme` 键继续监听以兼容历史用法。
|
|
10
12
|
*/
|
|
11
13
|
export function useChartTheme(input, palette) {
|
|
12
14
|
const [theme, setTheme] = useState(() => resolveTheme(input));
|
|
@@ -25,7 +27,7 @@ export function useChartTheme(input, palette) {
|
|
|
25
27
|
const observer = new MutationObserver(update);
|
|
26
28
|
observer.observe(document.documentElement, {
|
|
27
29
|
attributes: true,
|
|
28
|
-
attributeFilter: ['data-theme', 'class', 'style']
|
|
30
|
+
attributeFilter: ['data-mode', 'data-palette', 'data-theme', 'class', 'style']
|
|
29
31
|
});
|
|
30
32
|
return () => observer.disconnect();
|
|
31
33
|
}, [input, palette]);
|
package/esm/index.d.ts
CHANGED
|
@@ -9,54 +9,54 @@
|
|
|
9
9
|
* · 主题工具(createChartTheme / readAuraTheme)—— 深度定制
|
|
10
10
|
* · 内核(scale / shape)—— 自建图表时的乐高积木
|
|
11
11
|
*/
|
|
12
|
-
export { LineChart } from './charts/line-chart';
|
|
13
|
-
export type { LineChartProps } from './charts/line-chart';
|
|
14
|
-
export { BarChart } from './charts/bar-chart';
|
|
15
|
-
export type { BarChartProps } from './charts/bar-chart';
|
|
16
|
-
export { AreaChart } from './charts/area-chart';
|
|
17
|
-
export type { AreaChartProps } from './charts/area-chart';
|
|
18
|
-
export { ComboChart } from './charts/combo-chart';
|
|
19
|
-
export type { ComboChartProps } from './charts/combo-chart';
|
|
20
|
-
export { ScatterChart } from './charts/scatter-chart';
|
|
21
|
-
export type { ScatterChartProps } from './charts/scatter-chart';
|
|
22
|
-
export { PieChart } from './charts/pie-chart';
|
|
23
|
-
export type { PieChartProps, PieDataItem } from './charts/pie-chart';
|
|
24
|
-
export { RadarChart } from './charts/radar-chart';
|
|
25
|
-
export type { RadarChartProps, RadarIndicator, RadarSeries, } from './charts/radar-chart';
|
|
26
|
-
export { GaugeChart } from './charts/gauge-chart';
|
|
27
|
-
export type { GaugeChartProps, GaugeRange } from './charts/gauge-chart';
|
|
28
|
-
export { FunnelChart } from './charts/funnel-chart';
|
|
29
|
-
export type { FunnelChartProps, FunnelDataItem } from './charts/funnel-chart';
|
|
30
|
-
export { RingProgress } from './charts/ring-progress';
|
|
31
|
-
export type { RingProgressProps } from './charts/ring-progress';
|
|
32
|
-
export { WaterfallChart } from './charts/waterfall-chart';
|
|
33
|
-
export type { WaterfallChartProps, WaterfallItem, } from './charts/waterfall-chart';
|
|
34
|
-
export { Sparkline } from './charts/sparkline';
|
|
35
|
-
export type { SparklineProps } from './charts/sparkline';
|
|
36
|
-
export { HeatmapChart } from './charts/heatmap-chart';
|
|
37
|
-
export type { HeatmapChartProps, HeatmapCell } from './charts/heatmap-chart';
|
|
38
|
-
export { CandlestickChart } from './charts/candlestick-chart';
|
|
39
|
-
export type { CandlestickChartProps, CandlestickItem, } from './charts/candlestick-chart';
|
|
40
|
-
export { TreemapChart } from './charts/treemap-chart';
|
|
41
|
-
export type { TreemapChartProps } from './charts/treemap-chart';
|
|
42
|
-
export { TreeChart } from './charts/tree-chart';
|
|
43
|
-
export type { TreeChartProps } from './charts/tree-chart';
|
|
44
|
-
export { SankeyChart } from './charts/sankey-chart';
|
|
45
|
-
export type { SankeyChartProps } from './charts/sankey-chart';
|
|
46
|
-
export { GraphChart } from './charts/graph-chart';
|
|
47
|
-
export type { GraphChartProps } from './charts/graph-chart';
|
|
48
|
-
export { Tooltip } from './components/Tooltip';
|
|
49
|
-
export { useElementSize } from './hooks/useElementSize';
|
|
50
|
-
export { Chart } from './components/chart';
|
|
51
|
-
export type { ChartProps, ChartOption, ChartOptionSeries, } from './components/chart';
|
|
52
|
-
export type { BaseChartProps, ChartDataRow, SeriesConfig, SeriesType, AxisConfig, LegendConfig, TooltipConfig, TooltipPayload, TooltipSeriesItem, ChartRenderer, ChartAnimationInput, } from './types';
|
|
53
|
-
export { createChartTheme, readAuraTheme, resolveTheme, detectDarkMode, colorAt, withAlpha, mixColor, parseColor, lightTheme, darkTheme, DEFAULT_PALETTE, } from './theme';
|
|
54
|
-
export type { ChartTheme, ChartThemeInput, ChartThemeOptions, DeepPartial, } from './theme';
|
|
55
|
-
export { createBandScale, createPointScale, createLinearScale, linearTicks, niceStep, niceExtent, extentOf, extentWithZero, } from './core/scale';
|
|
56
|
-
export type { BandScale, PointScale, LinearScale, Extent } from './core/scale';
|
|
57
|
-
export { linePath, areaPath, arcLinePath, arcPath, roundedRectPath, symbolPath, splitSegments, } from './core/shape';
|
|
58
|
-
export type { CurveType, CurvePoint, Point, SymbolType } from './core/shape';
|
|
59
|
-
export { formatNumber, formatCompact, formatPercent, estimateTextWidth, } from './core/format';
|
|
60
|
-
export { squarify, buildTreemap, layoutTree, sumValues, } from './core/hierarchy';
|
|
61
|
-
export type { HierarchyNode, TreemapCell, TreeLayoutNode, } from './core/hierarchy';
|
|
12
|
+
export { LineChart } from './charts/line-chart/index.js';
|
|
13
|
+
export type { LineChartProps } from './charts/line-chart/index.js';
|
|
14
|
+
export { BarChart } from './charts/bar-chart/index.js';
|
|
15
|
+
export type { BarChartProps } from './charts/bar-chart/index.js';
|
|
16
|
+
export { AreaChart } from './charts/area-chart/index.js';
|
|
17
|
+
export type { AreaChartProps } from './charts/area-chart/index.js';
|
|
18
|
+
export { ComboChart } from './charts/combo-chart/index.js';
|
|
19
|
+
export type { ComboChartProps } from './charts/combo-chart/index.js';
|
|
20
|
+
export { ScatterChart } from './charts/scatter-chart/index.js';
|
|
21
|
+
export type { ScatterChartProps } from './charts/scatter-chart/index.js';
|
|
22
|
+
export { PieChart } from './charts/pie-chart/index.js';
|
|
23
|
+
export type { PieChartProps, PieDataItem } from './charts/pie-chart/index.js';
|
|
24
|
+
export { RadarChart } from './charts/radar-chart/index.js';
|
|
25
|
+
export type { RadarChartProps, RadarIndicator, RadarSeries, } from './charts/radar-chart/index.js';
|
|
26
|
+
export { GaugeChart } from './charts/gauge-chart/index.js';
|
|
27
|
+
export type { GaugeChartProps, GaugeRange } from './charts/gauge-chart/index.js';
|
|
28
|
+
export { FunnelChart } from './charts/funnel-chart/index.js';
|
|
29
|
+
export type { FunnelChartProps, FunnelDataItem } from './charts/funnel-chart/index.js';
|
|
30
|
+
export { RingProgress } from './charts/ring-progress/index.js';
|
|
31
|
+
export type { RingProgressProps } from './charts/ring-progress/index.js';
|
|
32
|
+
export { WaterfallChart } from './charts/waterfall-chart/index.js';
|
|
33
|
+
export type { WaterfallChartProps, WaterfallItem, } from './charts/waterfall-chart/index.js';
|
|
34
|
+
export { Sparkline } from './charts/sparkline/index.js';
|
|
35
|
+
export type { SparklineProps } from './charts/sparkline/index.js';
|
|
36
|
+
export { HeatmapChart } from './charts/heatmap-chart/index.js';
|
|
37
|
+
export type { HeatmapChartProps, HeatmapCell } from './charts/heatmap-chart/index.js';
|
|
38
|
+
export { CandlestickChart } from './charts/candlestick-chart/index.js';
|
|
39
|
+
export type { CandlestickChartProps, CandlestickItem, } from './charts/candlestick-chart/index.js';
|
|
40
|
+
export { TreemapChart } from './charts/treemap-chart/index.js';
|
|
41
|
+
export type { TreemapChartProps } from './charts/treemap-chart/index.js';
|
|
42
|
+
export { TreeChart } from './charts/tree-chart/index.js';
|
|
43
|
+
export type { TreeChartProps } from './charts/tree-chart/index.js';
|
|
44
|
+
export { SankeyChart } from './charts/sankey-chart/index.js';
|
|
45
|
+
export type { SankeyChartProps } from './charts/sankey-chart/index.js';
|
|
46
|
+
export { GraphChart } from './charts/graph-chart/index.js';
|
|
47
|
+
export type { GraphChartProps } from './charts/graph-chart/index.js';
|
|
48
|
+
export { Tooltip } from './components/Tooltip.js';
|
|
49
|
+
export { useElementSize } from './hooks/useElementSize.js';
|
|
50
|
+
export { Chart } from './components/chart/index.js';
|
|
51
|
+
export type { ChartProps, ChartOption, ChartOptionSeries, } from './components/chart/index.js';
|
|
52
|
+
export type { BaseChartProps, ChartDataRow, SeriesConfig, SeriesType, AxisConfig, LegendConfig, TooltipConfig, TooltipPayload, TooltipSeriesItem, ChartRenderer, ChartAnimationInput, } from './types.js';
|
|
53
|
+
export { createChartTheme, readAuraTheme, resolveTheme, detectDarkMode, colorAt, withAlpha, mixColor, parseColor, lightTheme, darkTheme, DEFAULT_PALETTE, } from './theme/index.js';
|
|
54
|
+
export type { ChartTheme, ChartThemeInput, ChartThemeOptions, DeepPartial, } from './theme/index.js';
|
|
55
|
+
export { createBandScale, createPointScale, createLinearScale, linearTicks, niceStep, niceExtent, extentOf, extentWithZero, } from './core/scale.js';
|
|
56
|
+
export type { BandScale, PointScale, LinearScale, Extent } from './core/scale.js';
|
|
57
|
+
export { linePath, areaPath, arcLinePath, arcPath, roundedRectPath, symbolPath, splitSegments, } from './core/shape.js';
|
|
58
|
+
export type { CurveType, CurvePoint, Point, SymbolType } from './core/shape.js';
|
|
59
|
+
export { formatNumber, formatCompact, formatPercent, estimateTextWidth, } from './core/format.js';
|
|
60
|
+
export { squarify, buildTreemap, layoutTree, sumValues, } from './core/hierarchy.js';
|
|
61
|
+
export type { HierarchyNode, TreemapCell, TreeLayoutNode, } from './core/hierarchy.js';
|
|
62
62
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.js
CHANGED
package/esm/internal/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChartDataRow, SeriesConfig, SeriesType } from '../types';
|
|
2
|
-
import { type ChartTheme } from '../theme';
|
|
1
|
+
import type { ChartDataRow, SeriesConfig, SeriesType } from '../types.js';
|
|
2
|
+
import { type ChartTheme } from '../theme/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* 数据模型归一化。
|
|
5
5
|
*
|
package/esm/internal/model.js
CHANGED
package/esm/scene/canvas.d.ts
CHANGED
package/esm/scene/canvas.js
CHANGED
package/esm/scene/svg.d.ts
CHANGED
package/esm/scene/svg.js
CHANGED
package/esm/scene/types.js
CHANGED
package/esm/theme/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* 实现策略:
|
|
7
7
|
* 1. 不写死色值 —— 主题从 Aura 的 CSS 变量(`--aura-primary-600` 等)实时读取,
|
|
8
|
-
* 因此只要宿主项目引了 `@aura-react-comp/
|
|
8
|
+
* 因此只要宿主项目引了 `@aura-react-comp/design/style.css`,图表天然同色;
|
|
9
9
|
* 2. 读取发生在运行时(getComputedStyle),所以 `data-theme="dark"` 切换后
|
|
10
10
|
* 图表会跟着变,无需额外配置;
|
|
11
11
|
* 3. 提供 createChartTheme 做逐字段深合并,允许只覆盖一两个字段
|
|
@@ -98,7 +98,7 @@ export interface ChartThemeOptions {
|
|
|
98
98
|
}
|
|
99
99
|
/** 创建一个主题(以浅色/暗色基础为底,叠加覆盖项) */
|
|
100
100
|
export declare function createChartTheme(options?: ChartThemeOptions): ChartTheme;
|
|
101
|
-
/**
|
|
101
|
+
/** 当前是否为暗色(双轴:优先 data-mode,兼容历史 data-theme,与 tokens.css 的选择器一致) */
|
|
102
102
|
export declare function detectDarkMode(element?: HTMLElement | null): boolean;
|
|
103
103
|
/**
|
|
104
104
|
* 从 Aura 的 CSS 变量读取一份主题。
|
package/esm/theme/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,kCAAkC;AAClC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC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AED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAwB9D"}
|
package/esm/theme/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
/**
|
|
2
3
|
* 图表主题体系。
|
|
3
4
|
*
|
|
@@ -5,7 +6,7 @@
|
|
|
5
6
|
*
|
|
6
7
|
* 实现策略:
|
|
7
8
|
* 1. 不写死色值 —— 主题从 Aura 的 CSS 变量(`--aura-primary-600` 等)实时读取,
|
|
8
|
-
* 因此只要宿主项目引了 `@aura-react-comp/
|
|
9
|
+
* 因此只要宿主项目引了 `@aura-react-comp/design/style.css`,图表天然同色;
|
|
9
10
|
* 2. 读取发生在运行时(getComputedStyle),所以 `data-theme="dark"` 切换后
|
|
10
11
|
* 图表会跟着变,无需额外配置;
|
|
11
12
|
* 3. 提供 createChartTheme 做逐字段深合并,允许只覆盖一两个字段
|
|
@@ -155,12 +156,12 @@ function cssVar(name, fallback, element) {
|
|
|
155
156
|
return value || fallback;
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
/**
|
|
159
|
+
/** 当前是否为暗色(双轴:优先 data-mode,兼容历史 data-theme,与 tokens.css 的选择器一致) */
|
|
159
160
|
export function detectDarkMode(element) {
|
|
160
161
|
if (typeof document === 'undefined') return false;
|
|
161
162
|
const host = element ?? document.documentElement;
|
|
162
|
-
const explicit = host?.closest?.('[data-theme]')?.getAttribute('data-theme');
|
|
163
|
-
const root = document.documentElement.getAttribute('data-theme');
|
|
163
|
+
const explicit = host?.closest?.('[data-theme]')?.getAttribute('data-theme') ?? host?.closest?.('[data-mode]')?.getAttribute('data-mode');
|
|
164
|
+
const root = document.documentElement.getAttribute('data-theme') ?? document.documentElement.getAttribute('data-mode');
|
|
164
165
|
return (explicit ?? root) === 'dark';
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -234,8 +235,10 @@ export function resolveTheme(input, element) {
|
|
|
234
235
|
if (Array.isArray(candidate.palette) && candidate.font && candidate.axis) {
|
|
235
236
|
return candidate;
|
|
236
237
|
}
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
// 不再区分亮暗分支:readAuraTheme 内部会按 data-mode/data-theme 判定暗色,
|
|
239
|
+
// 并读取当前色板生效的 CSS 变量 —— 静态 darkTheme 的 accent 等主锚色写死
|
|
240
|
+
// 在默认紫罗兰上,暗色叠加局部覆盖时会跟色板脱节。
|
|
241
|
+
const base = readAuraTheme(element);
|
|
239
242
|
return deepMerge(base, input);
|
|
240
243
|
}
|
|
241
244
|
|
package/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CurveType } from './core/shape';
|
|
3
|
-
import type { ChartAnimationOptions } from './core/animation';
|
|
4
|
-
import type { ChartThemeInput } from './theme';
|
|
2
|
+
import type { CurveType } from './core/shape.js';
|
|
3
|
+
import type { ChartAnimationOptions } from './core/animation.js';
|
|
4
|
+
import type { ChartThemeInput } from './theme/index.js';
|
|
5
5
|
/** 一行数据。数值列允许 null,表示缺失(折线断开、柱子不画) */
|
|
6
6
|
export type ChartDataRow = Record<string, string | number | null | undefined>;
|
|
7
7
|
export type SeriesType = 'line' | 'bar' | 'area' | 'scatter';
|
package/esm/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aura-react-comp/charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Aura 图表库 — 自研 SVG/Canvas 双渲染内核,令牌驱动的主题体系,覆盖市面主流图表类型",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aura",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-dom": ">=18.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@aura-react-comp/shared": "0.1.
|
|
54
|
+
"@aura-react-comp/shared": "0.1.1"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|