@h-ai/ui 0.1.0-alpha.33 → 0.1.0-alpha.35
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 +24 -5
- package/auto-import.js +2 -2
- package/dist/components/compounds/Combobox.svelte +12 -4
- package/dist/components/compounds/Combobox.svelte.d.ts +4 -1
- package/dist/components/compounds/DatePicker.svelte +19 -4
- package/dist/components/compounds/DatePicker.svelte.d.ts +4 -1
- package/dist/components/compounds/TagInput.svelte +36 -31
- package/dist/components/control-size.d.ts +18 -0
- package/dist/components/control-size.js +18 -0
- package/dist/components/primitives/Input.svelte +4 -25
- package/dist/components/primitives/Select.svelte +4 -10
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +203 -22
- package/dist/components/scenes/ai/document-download.js +19 -2
- package/dist/components/scenes/ai/document-parse.d.ts +25 -2
- package/dist/components/scenes/ai/document-parse.js +137 -11
- package/dist/components/scenes/ai/index.d.ts +1 -1
- package/dist/components/scenes/ai/mermaid-host-sync.d.ts +34 -0
- package/dist/components/scenes/ai/mermaid-host-sync.js +35 -0
- package/dist/components/scenes/ai/mermaid-render.d.ts +5 -0
- package/dist/components/scenes/ai/mermaid-render.js +7 -0
- package/dist/components/scenes/charts/Chart.svelte +152 -0
- package/dist/components/scenes/charts/Chart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/chart-theme.d.ts +23 -0
- package/dist/components/scenes/charts/chart-theme.js +44 -0
- package/dist/components/scenes/charts/chart-types.d.ts +77 -0
- package/dist/components/scenes/charts/chart-types.js +7 -0
- package/dist/components/scenes/charts/index.d.ts +8 -0
- package/dist/components/scenes/charts/index.js +7 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte +571 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +19 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte.d.ts +5 -0
- package/dist/components/scenes/iam/PasswordInput.svelte +4 -15
- package/dist/components/scenes/index.d.ts +1 -0
- package/dist/components/scenes/index.js +2 -0
- package/dist/messages/en-US.json +2 -0
- package/dist/messages/zh-CN.json +2 -0
- package/dist/types.d.ts +1 -0
- package/package.json +3 -2
|
@@ -40,3 +40,10 @@ export async function renderMermaidDiagram(code) {
|
|
|
40
40
|
const { svg } = await mermaid.render(renderId, code);
|
|
41
41
|
return svg;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Mermaid 11.x 会在 SVG 内写入很长的 style 标签内容;在 contenteditable 预览区里,
|
|
45
|
+
* 部分浏览器会把这些 CSS 当成正文显示。这里保留 SVG 图形,剥离内联样式文本。
|
|
46
|
+
*/
|
|
47
|
+
export function stripMermaidSvgStyleElements(svg) {
|
|
48
|
+
return svg.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, '');
|
|
49
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
=============================================================================
|
|
3
|
+
@h-ai/ui - Chart 组件
|
|
4
|
+
=============================================================================
|
|
5
|
+
基于 LayerChart 的统一图表入口,仅处理 type 路由、主题色默认值和基础状态。
|
|
6
|
+
|
|
7
|
+
使用 Svelte 5 Runes ($props, $derived)
|
|
8
|
+
=============================================================================
|
|
9
|
+
-->
|
|
10
|
+
<script lang='ts'>
|
|
11
|
+
import type { ChartProps, ChartSeries, ChartType } from './chart-types.js'
|
|
12
|
+
import { uiM } from '../../../messages.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../../utils.js'
|
|
14
|
+
import { DAISYUI_CHART_COLORS, resolveChartColors } from './chart-theme.js'
|
|
15
|
+
import AreaChart from './renderers/AreaChart.svelte'
|
|
16
|
+
import BarChart from './renderers/BarChart.svelte'
|
|
17
|
+
import LineChart from './renderers/LineChart.svelte'
|
|
18
|
+
import PieChart from './renderers/PieChart.svelte'
|
|
19
|
+
import ScatterChart from './renderers/ScatterChart.svelte'
|
|
20
|
+
import 'layerchart/daisyui-5.css'
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
type,
|
|
24
|
+
data = [],
|
|
25
|
+
x,
|
|
26
|
+
y,
|
|
27
|
+
series,
|
|
28
|
+
orientation,
|
|
29
|
+
size = 'md',
|
|
30
|
+
title = '',
|
|
31
|
+
description = '',
|
|
32
|
+
loading = false,
|
|
33
|
+
empty = false,
|
|
34
|
+
class: className = '',
|
|
35
|
+
...restProps
|
|
36
|
+
}: ChartProps = $props()
|
|
37
|
+
|
|
38
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
39
|
+
|
|
40
|
+
const chartSizeHeights: Record<NonNullable<ChartProps['size']>, number> = {
|
|
41
|
+
sm: 200,
|
|
42
|
+
md: 300,
|
|
43
|
+
lg: 400,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const cartesianChartTypes = new Set<ChartType>(['bar', 'line', 'area'])
|
|
47
|
+
|
|
48
|
+
/** 图表可视高度优先尊重 LayerChart 原生 height,未传时使用 @h-ai/ui 的 size 预设。 */
|
|
49
|
+
const chartHeight = $derived(
|
|
50
|
+
typeof restProps.height === 'number' ? restProps.height : chartSizeHeights[size],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const isEmpty = $derived(empty || data.length === 0)
|
|
54
|
+
const hasHeader = $derived(Boolean(title || description))
|
|
55
|
+
|
|
56
|
+
const rootClass = $derived(
|
|
57
|
+
cn(
|
|
58
|
+
'hai-chart flex flex-col gap-3',
|
|
59
|
+
className,
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const viewportClass = $derived(
|
|
64
|
+
cn(
|
|
65
|
+
'hai-chart-viewport min-w-0',
|
|
66
|
+
(loading || isEmpty) && 'flex items-center justify-center rounded-lg border border-dashed border-base-300 bg-base-200/30',
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 当调用方只传 y 数组时,为常见笛卡尔图自动补 series。
|
|
72
|
+
* 这让 `<Chart y={['a','b']}>` 仍然得到多系列和主题色,同时不影响显式传入的 LayerChart series。
|
|
73
|
+
*/
|
|
74
|
+
const normalizedSeries = $derived.by<ChartSeries[] | undefined>(() => {
|
|
75
|
+
if (series) {
|
|
76
|
+
if (!cartesianChartTypes.has(type))
|
|
77
|
+
return series
|
|
78
|
+
|
|
79
|
+
return series.map(item => ({
|
|
80
|
+
...item,
|
|
81
|
+
value: item.value ?? item.key,
|
|
82
|
+
}))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!cartesianChartTypes.has(type) || !Array.isArray(y))
|
|
86
|
+
return undefined
|
|
87
|
+
|
|
88
|
+
return y.map(key => ({
|
|
89
|
+
key,
|
|
90
|
+
label: key,
|
|
91
|
+
value: key,
|
|
92
|
+
}))
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const resolvedSeries = $derived(resolveChartColors(normalizedSeries))
|
|
96
|
+
|
|
97
|
+
/** 饼图使用统一 x/y API 时,将 x 映射为 key/label,y 的第一项映射为 value。 */
|
|
98
|
+
const pieValue = $derived(Array.isArray(y) ? y[0] : y)
|
|
99
|
+
|
|
100
|
+
const cartesianLayerProps = $derived({
|
|
101
|
+
data,
|
|
102
|
+
height: chartHeight,
|
|
103
|
+
cRange: DAISYUI_CHART_COLORS,
|
|
104
|
+
...restProps,
|
|
105
|
+
orientation,
|
|
106
|
+
series: resolvedSeries,
|
|
107
|
+
x,
|
|
108
|
+
y,
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const pieLayerProps = $derived({
|
|
112
|
+
data,
|
|
113
|
+
height: chartHeight,
|
|
114
|
+
key: x,
|
|
115
|
+
label: x,
|
|
116
|
+
value: pieValue,
|
|
117
|
+
cRange: DAISYUI_CHART_COLORS,
|
|
118
|
+
...restProps,
|
|
119
|
+
series: resolvedSeries,
|
|
120
|
+
})
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<div {...dataAttributes} class={rootClass}>
|
|
124
|
+
{#if hasHeader}
|
|
125
|
+
<div class='space-y-1'>
|
|
126
|
+
{#if title}
|
|
127
|
+
<h3 class='text-sm font-semibold text-base-content'>{title}</h3>
|
|
128
|
+
{/if}
|
|
129
|
+
{#if description}
|
|
130
|
+
<p class='text-xs leading-relaxed text-base-content/60'>{description}</p>
|
|
131
|
+
{/if}
|
|
132
|
+
</div>
|
|
133
|
+
{/if}
|
|
134
|
+
|
|
135
|
+
<div class={viewportClass} style={`height: ${chartHeight}px;`}>
|
|
136
|
+
{#if loading}
|
|
137
|
+
<span class='loading loading-spinner loading-md text-primary' aria-label={uiM('chart_loading')}></span>
|
|
138
|
+
{:else if isEmpty}
|
|
139
|
+
<p class='text-sm text-base-content/50'>{uiM('chart_empty')}</p>
|
|
140
|
+
{:else if type === 'bar'}
|
|
141
|
+
<BarChart {...cartesianLayerProps} />
|
|
142
|
+
{:else if type === 'line'}
|
|
143
|
+
<LineChart {...cartesianLayerProps} />
|
|
144
|
+
{:else if type === 'area'}
|
|
145
|
+
<AreaChart {...cartesianLayerProps} />
|
|
146
|
+
{:else if type === 'pie'}
|
|
147
|
+
<PieChart {...pieLayerProps} />
|
|
148
|
+
{:else if type === 'scatter'}
|
|
149
|
+
<ScatterChart {...cartesianLayerProps} />
|
|
150
|
+
{/if}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @h-ai/ui — 图表主题色
|
|
3
|
+
*
|
|
4
|
+
* 颜色保持 CSS 变量引用,避免在 JS 中读取主题并让 DaisyUI 主题切换自然生效。
|
|
5
|
+
* @module chart-theme
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartSeries } from './chart-types.js';
|
|
8
|
+
export declare const DAISYUI_CHART_THEME_COLORS: {
|
|
9
|
+
readonly primary: "var(--color-primary)";
|
|
10
|
+
readonly secondary: "var(--color-secondary)";
|
|
11
|
+
readonly accent: "var(--color-accent)";
|
|
12
|
+
readonly success: "var(--color-success)";
|
|
13
|
+
readonly warning: "var(--color-warning)";
|
|
14
|
+
readonly error: "var(--color-error)";
|
|
15
|
+
readonly info: "var(--color-info)";
|
|
16
|
+
};
|
|
17
|
+
/** DaisyUI 图表主题色按系列分配的稳定顺序。 */
|
|
18
|
+
export declare const DAISYUI_CHART_COLORS: readonly ["var(--color-primary)", "var(--color-secondary)", "var(--color-accent)", "var(--color-success)", "var(--color-warning)", "var(--color-error)", "var(--color-info)"];
|
|
19
|
+
/**
|
|
20
|
+
* 为缺少 color 的系列补齐 DaisyUI 主题色。
|
|
21
|
+
* 返回新数组,避免修改调用方传入的 series 对象。
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveChartColors<TSeries extends ChartSeries>(series?: readonly TSeries[]): TSeries[] | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @h-ai/ui — 图表主题色
|
|
3
|
+
*
|
|
4
|
+
* 颜色保持 CSS 变量引用,避免在 JS 中读取主题并让 DaisyUI 主题切换自然生效。
|
|
5
|
+
* @module chart-theme
|
|
6
|
+
*/
|
|
7
|
+
export const DAISYUI_CHART_THEME_COLORS = {
|
|
8
|
+
// primary 用作第一条主数据系列,跟随当前 DaisyUI 5 主题主色。
|
|
9
|
+
primary: 'var(--color-primary)',
|
|
10
|
+
// secondary 用作第二条系列,和 primary 拉开视觉层级。
|
|
11
|
+
secondary: 'var(--color-secondary)',
|
|
12
|
+
// accent 用作第三条系列,补充主题中的强调色。
|
|
13
|
+
accent: 'var(--color-accent)',
|
|
14
|
+
// success 用作正向或增长类系列,也作为常规调色板的一员。
|
|
15
|
+
success: 'var(--color-success)',
|
|
16
|
+
// warning 用作需要注意的系列,维持 DaisyUI 语义一致性。
|
|
17
|
+
warning: 'var(--color-warning)',
|
|
18
|
+
// error 用作异常或下降类系列,也可作为高对比补充色。
|
|
19
|
+
error: 'var(--color-error)',
|
|
20
|
+
// info 用作信息类系列,补足多系列图表的第七种主题色。
|
|
21
|
+
info: 'var(--color-info)',
|
|
22
|
+
};
|
|
23
|
+
/** DaisyUI 图表主题色按系列分配的稳定顺序。 */
|
|
24
|
+
export const DAISYUI_CHART_COLORS = [
|
|
25
|
+
DAISYUI_CHART_THEME_COLORS.primary,
|
|
26
|
+
DAISYUI_CHART_THEME_COLORS.secondary,
|
|
27
|
+
DAISYUI_CHART_THEME_COLORS.accent,
|
|
28
|
+
DAISYUI_CHART_THEME_COLORS.success,
|
|
29
|
+
DAISYUI_CHART_THEME_COLORS.warning,
|
|
30
|
+
DAISYUI_CHART_THEME_COLORS.error,
|
|
31
|
+
DAISYUI_CHART_THEME_COLORS.info,
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* 为缺少 color 的系列补齐 DaisyUI 主题色。
|
|
35
|
+
* 返回新数组,避免修改调用方传入的 series 对象。
|
|
36
|
+
*/
|
|
37
|
+
export function resolveChartColors(series) {
|
|
38
|
+
if (!series)
|
|
39
|
+
return undefined;
|
|
40
|
+
return series.map((item, index) => ({
|
|
41
|
+
...item,
|
|
42
|
+
color: item.color ?? DAISYUI_CHART_COLORS[index % DAISYUI_CHART_COLORS.length],
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @h-ai/ui — 图表组件类型定义
|
|
3
|
+
*
|
|
4
|
+
* 统一 Chart 只定义 @h-ai/ui 自身需要的轻量语义,其他字段通过索引签名透传给 LayerChart。
|
|
5
|
+
* @module chart-types
|
|
6
|
+
*/
|
|
7
|
+
import type { DataAttributes } from '../../../types.js';
|
|
8
|
+
/** 图表数据单元允许的原子值,和 LayerChart 常见 accessor 输入保持一致。 */
|
|
9
|
+
export type ChartDataValue = string | number | Date;
|
|
10
|
+
/** 图表数据项;每个字段都可被 x/y/key/value 等 accessor 引用。 */
|
|
11
|
+
export type ChartDataItem = Record<string, ChartDataValue>;
|
|
12
|
+
/** LayerChart accessor 的常用子集,用于 series.value 等透传配置。 */
|
|
13
|
+
export type ChartAccessor = string | number | ((item: ChartDataItem) => unknown) | ChartAccessor[] | null | undefined;
|
|
14
|
+
/** 统一 Chart 支持的高阶图表类型。 */
|
|
15
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'scatter';
|
|
16
|
+
/** Chart 预设高度档位;具体像素值在 Chart.svelte 中固定映射。 */
|
|
17
|
+
export type ChartSize = 'sm' | 'md' | 'lg';
|
|
18
|
+
/** 折线图渲染变体;default 保持 LayerChart 原生渲染,segmented-point 提供分段线 + 圆点样式。 */
|
|
19
|
+
export type ChartLineVariant = 'default' | 'segmented-point';
|
|
20
|
+
/** 折线图 tooltip 触发方式;nearest 会在绘图区内吸附最近数据点。 */
|
|
21
|
+
export type ChartTooltipMode = 'default' | 'nearest';
|
|
22
|
+
export interface ChartSeries {
|
|
23
|
+
/** 系列稳定标识;宽表数据通常对应数据项中的数值字段名。 */
|
|
24
|
+
key: string;
|
|
25
|
+
/** 系列展示名称;不传时 LayerChart 会按 key 或 value accessor 回退。 */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** 系列颜色;不传时由 @h-ai/ui 按 DaisyUI 主题色顺序补齐。 */
|
|
28
|
+
color?: string;
|
|
29
|
+
/** LayerChart 原生 value accessor,用于覆盖默认按 key 取值的行为。 */
|
|
30
|
+
value?: ChartAccessor;
|
|
31
|
+
/** LayerChart 原生独立数据源,用于 long format 或每个系列不同数据的场景。 */
|
|
32
|
+
data?: ChartDataItem[];
|
|
33
|
+
/** 系列初始可见状态;透传给 LayerChart legend/series 状态管理。 */
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
/** 传给 LayerChart 内部 mark 组件的原生 props,例如 Bars/Spline/Arc/Points props。 */
|
|
36
|
+
props?: Record<string, unknown>;
|
|
37
|
+
/** 单系列最大值;主要用于饼图等需要上限语义的 LayerChart 配置。 */
|
|
38
|
+
maxValue?: number;
|
|
39
|
+
/** 保留 LayerChart 新增 series 字段的透传能力,避免薄包装层限制底层 API。 */
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
export interface ChartProps extends DataAttributes {
|
|
43
|
+
/** 选择内部 LayerChart 高阶组件;必填。 */
|
|
44
|
+
type: ChartType;
|
|
45
|
+
/** 图表数据源;空数组会触发内置空态。 */
|
|
46
|
+
data: ChartDataItem[];
|
|
47
|
+
/** x 轴字段名;饼图中默认映射为 key 和 label。 */
|
|
48
|
+
x: string;
|
|
49
|
+
/** y 轴字段名;传数组时会自动生成多系列配置。 */
|
|
50
|
+
y: string | string[];
|
|
51
|
+
/** 系列配置;未指定 color 的项会按 DaisyUI 主题色补齐。 */
|
|
52
|
+
series?: ChartSeries[];
|
|
53
|
+
/** LayerChart 原生 orientation;主要用于柱状图和折线图方向控制。 */
|
|
54
|
+
orientation?: 'horizontal' | 'vertical';
|
|
55
|
+
/** 折线图渲染变体;仅 type='line' 时生效,默认透传 LayerChart。 */
|
|
56
|
+
lineVariant?: ChartLineVariant;
|
|
57
|
+
/** 折线图 tooltip 触发方式;nearest 会在整块绘图区内吸附最近点。 */
|
|
58
|
+
tooltipMode?: ChartTooltipMode;
|
|
59
|
+
/** 折线图是否显示随 hover 变化的竖向参考线;仅 segmented-point 变体生效。 */
|
|
60
|
+
showCrosshair?: boolean;
|
|
61
|
+
/** 折线图是否显示数据点圆点;仅 segmented-point 变体生效,默认显示。 */
|
|
62
|
+
showPoints?: boolean;
|
|
63
|
+
/** @h-ai/ui 预设尺寸;未显式传 LayerChart height 时映射为固定高度。 */
|
|
64
|
+
size?: ChartSize;
|
|
65
|
+
/** 图表标题;不传时不渲染标题区域。 */
|
|
66
|
+
title?: string;
|
|
67
|
+
/** 图表说明;不传时不渲染说明文本。 */
|
|
68
|
+
description?: string;
|
|
69
|
+
/** 加载状态;为 true 时仅显示 DaisyUI loading spinner。 */
|
|
70
|
+
loading?: boolean;
|
|
71
|
+
/** 强制空态;为 true 或 data 为空时显示空数据提示。 */
|
|
72
|
+
empty?: boolean;
|
|
73
|
+
/** 外层容器类名;用于布局,不会覆盖 LayerChart 内部配置。 */
|
|
74
|
+
class?: string;
|
|
75
|
+
/** 其他所有字段会原样透传给当前 type 对应的 LayerChart 组件。 */
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @h-ai/ui — 图表场景组件
|
|
3
|
+
*
|
|
4
|
+
* 仅导出统一 Chart 入口和公共类型;内部 renderer 不对外暴露。
|
|
5
|
+
* @module index
|
|
6
|
+
*/
|
|
7
|
+
export type { ChartDataItem, ChartLineVariant, ChartProps, ChartSeries, ChartSize, ChartTooltipMode, ChartType } from './chart-types.js';
|
|
8
|
+
export { default as Chart } from './Chart.svelte';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
=============================================================================
|
|
3
|
+
@h-ai/ui - AreaChart 内部渲染器
|
|
4
|
+
=============================================================================
|
|
5
|
+
对 LayerChart AreaChart 的薄包装,仅做类型收窄和统一导入路径。
|
|
6
|
+
不对外暴露;由 Chart.svelte 按 type='area' 内部路由调用。
|
|
7
|
+
=============================================================================
|
|
8
|
+
-->
|
|
9
|
+
<script lang='ts'>
|
|
10
|
+
import type { AreaChartProps } from 'layerchart'
|
|
11
|
+
import type { ChartDataItem } from '../chart-types.js'
|
|
12
|
+
import { AreaChart as LayerAreaChart } from 'layerchart'
|
|
13
|
+
|
|
14
|
+
/** 透传给 LayerChart AreaChart 的全部原生属性。 */
|
|
15
|
+
const { ...props }: AreaChartProps<ChartDataItem> = $props()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<LayerAreaChart {...props} />
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AreaChartProps } from 'layerchart';
|
|
2
|
+
import type { ChartDataItem } from '../chart-types.js';
|
|
3
|
+
declare const AreaChart: import("svelte").Component<AreaChartProps<ChartDataItem>, {}, "">;
|
|
4
|
+
type AreaChart = ReturnType<typeof AreaChart>;
|
|
5
|
+
export default AreaChart;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
=============================================================================
|
|
3
|
+
@h-ai/ui - BarChart 内部渲染器
|
|
4
|
+
=============================================================================
|
|
5
|
+
对 LayerChart BarChart 的薄包装,仅做类型收窄和统一导入路径。
|
|
6
|
+
不对外暴露;由 Chart.svelte 按 type='bar' 内部路由调用。
|
|
7
|
+
=============================================================================
|
|
8
|
+
-->
|
|
9
|
+
<script lang='ts'>
|
|
10
|
+
import type { BarChartProps } from 'layerchart'
|
|
11
|
+
import type { ChartDataItem } from '../chart-types.js'
|
|
12
|
+
import { BarChart as LayerBarChart } from 'layerchart'
|
|
13
|
+
|
|
14
|
+
/** 透传给 LayerChart BarChart 的全部原生属性。 */
|
|
15
|
+
const { ...props }: BarChartProps<ChartDataItem> = $props()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<LayerBarChart {...props} />
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BarChartProps } from 'layerchart';
|
|
2
|
+
import type { ChartDataItem } from '../chart-types.js';
|
|
3
|
+
declare const BarChart: import("svelte").Component<BarChartProps<ChartDataItem>, {}, "">;
|
|
4
|
+
type BarChart = ReturnType<typeof BarChart>;
|
|
5
|
+
export default BarChart;
|