@h-ai/ui 1.0.0-beta.3 → 1.0.0-beta.31
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.en.md +14 -1007
- package/README.ja.md +13 -1006
- package/README.md +15 -1007
- package/auto-import.d.ts +9 -0
- package/auto-import.js +246 -65
- package/dist/components/compounds/Accordion.svelte +6 -2
- package/dist/components/compounds/BottomNav.svelte +14 -2
- package/dist/components/compounds/Card.svelte +3 -1
- package/dist/components/compounds/Combobox.svelte +41 -5
- package/dist/components/compounds/DataTable.svelte +28 -8
- package/dist/components/compounds/DatePicker.svelte +6 -1
- package/dist/components/compounds/Drawer.svelte +12 -4
- package/dist/components/compounds/Dropdown.svelte +135 -59
- package/dist/components/compounds/Empty.svelte +10 -2
- package/dist/components/compounds/FormField.svelte +10 -2
- package/dist/components/compounds/JsonViewer.svelte +18 -6
- package/dist/components/compounds/Modal.svelte +8 -2
- package/dist/components/compounds/Pagination.svelte +22 -7
- package/dist/components/compounds/Popover.svelte +94 -12
- package/dist/components/compounds/Steps.svelte +24 -8
- package/dist/components/compounds/SwipeCell.svelte +3 -1
- package/dist/components/compounds/TableToolbar.svelte +32 -9
- package/dist/components/compounds/Tabs.svelte +25 -5
- package/dist/components/compounds/TagInput.svelte +2 -0
- package/dist/components/compounds/Timeline.svelte +6 -2
- package/dist/components/compounds/ToastContainer.svelte +41 -10
- package/dist/components/compounds/Tooltip.svelte +1 -1
- package/dist/components/compounds/Tooltip.svelte.d.ts +1 -1
- package/dist/components/control-size.js +48 -8
- package/dist/components/primitives/Avatar.svelte +9 -3
- package/dist/components/primitives/BareInput.svelte +3 -1
- package/dist/components/primitives/Button.svelte +6 -2
- package/dist/components/primitives/Checkbox.svelte +5 -0
- package/dist/components/primitives/IconButton.svelte +3 -1
- package/dist/components/primitives/Input.svelte +19 -3
- package/dist/components/primitives/Radio.svelte +4 -1
- package/dist/components/primitives/Range.svelte +3 -1
- package/dist/components/primitives/Rating.svelte +9 -3
- package/dist/components/primitives/Select.svelte +21 -5
- package/dist/components/primitives/Tag.svelte +6 -10
- package/dist/components/primitives/Textarea.svelte +14 -2
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +118 -76
- package/dist/components/scenes/ai/document-download.js +55 -88
- package/dist/components/scenes/ai/document-parse.js +27 -33
- package/dist/components/scenes/ai/document-pdf-pages.d.ts +26 -0
- package/dist/components/scenes/ai/document-pdf-pages.js +111 -0
- package/dist/components/scenes/ai/document-pdf-worker.d.ts +11 -0
- package/dist/components/scenes/ai/document-pdf-worker.js +29 -0
- package/dist/components/scenes/ai/document-render-pool.d.ts +19 -0
- package/dist/components/scenes/ai/document-render-pool.js +20 -0
- package/dist/components/scenes/ai/document-render-worker.d.ts +13 -0
- package/dist/components/scenes/ai/document-render-worker.js +7 -0
- package/dist/components/scenes/ai/document-types.d.ts +2 -12
- package/dist/components/scenes/ai/editor-markdown-extensions.js +9 -3
- package/dist/components/scenes/ai/highlight.js +3 -1
- package/dist/components/scenes/ai/index.d.ts +4 -1
- package/dist/components/scenes/ai/index.js +2 -0
- package/dist/components/scenes/ai/markdown-parse.js +36 -10
- package/dist/components/scenes/ai/mermaid-render.js +13 -1
- package/dist/components/scenes/ai/mind/AiMindMapEditor.svelte +519 -0
- package/dist/components/scenes/ai/mind/AiMindMapEditor.svelte.d.ts +8 -0
- package/dist/components/scenes/ai/mind/mind-adapter.d.ts +38 -0
- package/dist/components/scenes/ai/mind/mind-adapter.js +59 -0
- package/dist/components/scenes/ai/mind/mind-types.d.ts +116 -0
- package/dist/components/scenes/ai/mind/mind-types.js +1 -0
- package/dist/components/scenes/ai/safe-html.js +9 -3
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +28 -16
- package/dist/components/scenes/app/FeedbackDetail.svelte +102 -24
- package/dist/components/scenes/app/FeedbackForm.svelte +70 -16
- package/dist/components/scenes/app/FeedbackList.svelte +138 -21
- package/dist/components/scenes/app/FeedbackRecorder.svelte +18 -5
- package/dist/components/scenes/app/FeedbackReplay.svelte +15 -3
- package/dist/components/scenes/app/FeedbackScreenshot.svelte +64 -13
- package/dist/components/scenes/app/LanguageSwitch.svelte +6 -2
- package/dist/components/scenes/app/SettingsLayout.svelte +3 -1
- package/dist/components/scenes/app/ThemeSelector.svelte +29 -5
- package/dist/components/scenes/app/ThemeToggle.svelte +6 -2
- package/dist/components/scenes/app/WorkspaceLayout.svelte +1 -1
- package/dist/components/scenes/app/feedback-functions.js +6 -2
- package/dist/components/scenes/charts/Chart.svelte +55 -21
- package/dist/components/scenes/charts/Chart.svelte.d.ts +0 -1
- package/dist/components/scenes/charts/ChartLoadError.svelte +13 -0
- package/dist/components/scenes/charts/ChartLoadError.svelte.d.ts +6 -0
- package/dist/components/scenes/charts/DashboardGrid.svelte +34 -0
- package/dist/components/scenes/charts/DashboardGrid.svelte.d.ts +15 -0
- package/dist/components/scenes/charts/MetricCard.svelte +69 -0
- package/dist/components/scenes/charts/MetricCard.svelte.d.ts +15 -0
- package/dist/components/scenes/charts/ReportCard.svelte +48 -0
- package/dist/components/scenes/charts/ReportCard.svelte.d.ts +15 -0
- package/dist/components/scenes/charts/chart-presets.d.ts +15 -0
- package/dist/components/scenes/charts/chart-presets.js +56 -0
- package/dist/components/scenes/charts/chart-types.d.ts +13 -2
- package/dist/components/scenes/charts/dashboard-types.d.ts +79 -0
- package/dist/components/scenes/charts/dashboard-types.js +1 -0
- package/dist/components/scenes/charts/index.d.ts +6 -2
- package/dist/components/scenes/charts/index.js +4 -1
- package/dist/components/scenes/charts/renderers/AreaChart.svelte +1 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte.d.ts +1 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte +1 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte.d.ts +1 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte +39 -12
- package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +1 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte +1 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte.d.ts +1 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte +1 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte.d.ts +1 -0
- package/dist/components/scenes/code/CodeWorkspace.svelte +946 -0
- package/dist/components/scenes/code/CodeWorkspace.svelte.d.ts +21 -0
- package/dist/components/scenes/code/CodeWorkspaceEditor.svelte +737 -0
- package/dist/components/scenes/code/CodeWorkspaceEditor.svelte.d.ts +37 -0
- package/dist/components/scenes/code/CodeWorkspaceGutter.svelte +246 -0
- package/dist/components/scenes/code/CodeWorkspaceGutter.svelte.d.ts +23 -0
- package/dist/components/scenes/code/CodeWorkspaceSearch.svelte +234 -0
- package/dist/components/scenes/code/CodeWorkspaceSearch.svelte.d.ts +23 -0
- package/dist/components/scenes/code/CodeWorkspaceTree.svelte +519 -0
- package/dist/components/scenes/code/CodeWorkspaceTree.svelte.d.ts +26 -0
- package/dist/components/scenes/code/code-editor.d.ts +12 -0
- package/dist/components/scenes/code/code-editor.js +93 -0
- package/dist/components/scenes/code/code-types.d.ts +346 -0
- package/dist/components/scenes/code/code-types.js +1 -0
- package/dist/components/scenes/code/index.d.ts +2 -0
- package/dist/components/scenes/code/index.js +1 -0
- package/dist/components/scenes/code/workers/css.worker.d.ts +1 -0
- package/dist/components/scenes/code/workers/css.worker.js +1 -0
- package/dist/components/scenes/code/workers/editor.worker.d.ts +1 -0
- package/dist/components/scenes/code/workers/editor.worker.js +1 -0
- package/dist/components/scenes/code/workers/html.worker.d.ts +1 -0
- package/dist/components/scenes/code/workers/html.worker.js +1 -0
- package/dist/components/scenes/code/workers/json.worker.d.ts +1 -0
- package/dist/components/scenes/code/workers/json.worker.js +1 -0
- package/dist/components/scenes/code/workers/ts.worker.d.ts +1 -0
- package/dist/components/scenes/code/workers/ts.worker.js +1 -0
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +6 -2
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +6 -2
- package/dist/components/scenes/crud/CrudEditPanel.svelte +41 -12
- package/dist/components/scenes/crud/CrudPage.svelte +34 -9
- package/dist/components/scenes/crud/crud-controller.svelte.js +23 -8
- package/dist/components/scenes/crud/crud-form-validation.js +27 -9
- package/dist/components/scenes/crypto/EncryptedInput.svelte +9 -3
- package/dist/components/scenes/error/error-presets.js +30 -5
- package/dist/components/scenes/guide/GuideHostContent.svelte +7 -1
- package/dist/components/scenes/guide/HelpCenter.svelte +23 -4
- package/dist/components/scenes/iam/AgreementNotice.svelte +9 -3
- package/dist/components/scenes/iam/AuthPanel.svelte +74 -16
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +6 -2
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +9 -3
- package/dist/components/scenes/iam/LoginForm.svelte +32 -8
- package/dist/components/scenes/iam/PasswordInput.svelte +50 -12
- package/dist/components/scenes/iam/RegisterForm.svelte +11 -3
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +6 -2
- package/dist/components/scenes/iam/SensitiveOperationsForm.svelte +3 -1
- package/dist/components/scenes/iam/SessionRecoveryDialog.svelte +4 -1
- package/dist/components/scenes/iam/UserProfile.svelte +41 -14
- package/dist/components/scenes/iam/auth-captcha.js +9 -2
- package/dist/components/scenes/iam/auth-error-message.d.ts +2 -2
- package/dist/components/scenes/iam/auth-error-message.js +16 -3
- package/dist/components/scenes/iam/password-utils.js +9 -2
- package/dist/components/scenes/iam/sensitive-actions.svelte.js +4 -1
- package/dist/components/scenes/index.d.ts +2 -0
- package/dist/components/scenes/index.js +4 -0
- package/dist/components/scenes/storage/FileList.svelte +3 -1
- package/dist/components/scenes/storage/FileUpload.svelte +7 -2
- package/dist/components/scenes/tools/ArtifactWorkspace.svelte +561 -0
- package/dist/components/scenes/tools/ArtifactWorkspace.svelte.d.ts +17 -0
- package/dist/components/scenes/tools/ToolWorkspace.svelte +435 -0
- package/dist/components/scenes/tools/ToolWorkspace.svelte.d.ts +17 -0
- package/dist/components/scenes/tools/artifact-data.d.ts +35 -0
- package/dist/components/scenes/tools/artifact-data.js +127 -0
- package/dist/components/scenes/tools/artifact-markdown.d.ts +58 -0
- package/dist/components/scenes/tools/artifact-markdown.js +308 -0
- package/dist/components/scenes/tools/artifact-preview.d.ts +9 -0
- package/dist/components/scenes/tools/artifact-preview.js +31 -0
- package/dist/components/scenes/tools/index.d.ts +4 -0
- package/dist/components/scenes/tools/index.js +3 -0
- package/dist/components/scenes/tools/tool-form.d.ts +74 -0
- package/dist/components/scenes/tools/tool-form.js +179 -0
- package/dist/components/scenes/tools/workspace-types.d.ts +221 -0
- package/dist/components/scenes/tools/workspace-types.js +1 -0
- package/dist/components/scenes/types.d.ts +2 -2
- package/dist/guide-storage.js +12 -4
- package/dist/guide.svelte.js +59 -16
- package/dist/i18n.svelte.js +9 -3
- package/dist/internal/dialog-focus.d.ts +19 -0
- package/dist/internal/dialog-focus.js +104 -4
- package/dist/internal/form-validation.svelte.js +46 -15
- package/dist/internal/icon-safety.js +6 -2
- package/dist/message.svelte.js +6 -2
- package/dist/messagebox.svelte.js +6 -2
- package/dist/messages/en-US.json +158 -2
- package/dist/messages/ja-JP.json +158 -2
- package/dist/messages/zh-CN.json +158 -2
- package/dist/styles/eye-care.css +55 -0
- package/dist/styles/global.css +16 -0
- package/dist/styles/theme.css +1 -0
- package/dist/theme-config.d.ts +1 -3
- package/dist/theme-config.js +137 -22
- package/dist/toast.svelte.js +27 -7
- package/dist/types.d.ts +3 -3
- package/dist/utils.js +6 -2
- package/package.json +31 -19
|
@@ -20,18 +20,16 @@
|
|
|
20
20
|
-->
|
|
21
21
|
<script lang='ts'>
|
|
22
22
|
import type { ChartProps, ChartSeries, ChartType } from './chart-types.js'
|
|
23
|
+
import { onMount } from 'svelte'
|
|
23
24
|
import { uiM } from '../../../messages.js'
|
|
24
25
|
import { cn, getDataAttributes } from '../../../utils.js'
|
|
26
|
+
import { resolveChartPreset } from './chart-presets.js'
|
|
25
27
|
import { DAISYUI_CHART_COLORS, resolveChartColors } from './chart-theme.js'
|
|
26
|
-
import
|
|
27
|
-
import BarChart from './renderers/BarChart.svelte'
|
|
28
|
-
import LineChart from './renderers/LineChart.svelte'
|
|
29
|
-
import PieChart from './renderers/PieChart.svelte'
|
|
30
|
-
import ScatterChart from './renderers/ScatterChart.svelte'
|
|
31
|
-
import 'layerchart/daisyui-5.css'
|
|
28
|
+
import ChartLoadError from './ChartLoadError.svelte'
|
|
32
29
|
|
|
33
30
|
const {
|
|
34
|
-
type,
|
|
31
|
+
type: requestedType,
|
|
32
|
+
preset,
|
|
35
33
|
data = [],
|
|
36
34
|
x,
|
|
37
35
|
y,
|
|
@@ -46,8 +44,27 @@
|
|
|
46
44
|
...restProps
|
|
47
45
|
}: ChartProps = $props()
|
|
48
46
|
|
|
47
|
+
const presetConfig = $derived(resolveChartPreset(preset))
|
|
48
|
+
const type = $derived(requestedType ?? presetConfig.type ?? 'line')
|
|
49
|
+
const nativeProps = $derived({
|
|
50
|
+
...presetConfig.props,
|
|
51
|
+
...restProps,
|
|
52
|
+
})
|
|
49
53
|
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
50
54
|
|
|
55
|
+
// 仅浏览器挂载且确有数据时加载对应图形;Svelte await 自动丢弃过期 Promise 的结果。
|
|
56
|
+
const renderers = {
|
|
57
|
+
bar: () => import('./renderers/BarChart.svelte'),
|
|
58
|
+
line: () => import('./renderers/LineChart.svelte'),
|
|
59
|
+
area: () => import('./renderers/AreaChart.svelte'),
|
|
60
|
+
pie: () => import('./renderers/PieChart.svelte'),
|
|
61
|
+
scatter: () => import('./renderers/ScatterChart.svelte'),
|
|
62
|
+
}
|
|
63
|
+
let mounted = $state(false)
|
|
64
|
+
onMount(() => {
|
|
65
|
+
mounted = true
|
|
66
|
+
})
|
|
67
|
+
|
|
51
68
|
const chartSizeHeights: Record<NonNullable<ChartProps['size']>, number> = {
|
|
52
69
|
sm: 200,
|
|
53
70
|
md: 300,
|
|
@@ -58,10 +75,15 @@
|
|
|
58
75
|
|
|
59
76
|
/** 图表可视高度优先尊重 LayerChart 原生 height,未传时使用 @h-ai/ui 的 size 预设。 */
|
|
60
77
|
const chartHeight = $derived(
|
|
61
|
-
typeof
|
|
78
|
+
typeof nativeProps.height === 'number'
|
|
79
|
+
? nativeProps.height
|
|
80
|
+
: chartSizeHeights[size],
|
|
62
81
|
)
|
|
63
82
|
|
|
64
83
|
const isEmpty = $derived(empty || data.length === 0)
|
|
84
|
+
const rendererPromise = $derived(mounted && !loading && !isEmpty
|
|
85
|
+
? renderers[type]()
|
|
86
|
+
: undefined)
|
|
65
87
|
const hasHeader = $derived(Boolean(title || description))
|
|
66
88
|
|
|
67
89
|
const rootClass = $derived(
|
|
@@ -106,13 +128,15 @@
|
|
|
106
128
|
const resolvedSeries = $derived(resolveChartColors(normalizedSeries))
|
|
107
129
|
|
|
108
130
|
/** 饼图使用统一 x/y API 时,将 x 映射为 key/label,y 的第一项映射为 value。 */
|
|
109
|
-
const pieValue = $derived(Array.isArray(y)
|
|
131
|
+
const pieValue = $derived(Array.isArray(y)
|
|
132
|
+
? y[0]
|
|
133
|
+
: y)
|
|
110
134
|
|
|
111
135
|
const cartesianLayerProps = $derived({
|
|
112
136
|
data,
|
|
113
137
|
height: chartHeight,
|
|
114
138
|
cRange: DAISYUI_CHART_COLORS,
|
|
115
|
-
...
|
|
139
|
+
...nativeProps,
|
|
116
140
|
orientation,
|
|
117
141
|
series: resolvedSeries,
|
|
118
142
|
x,
|
|
@@ -126,7 +150,7 @@
|
|
|
126
150
|
label: x,
|
|
127
151
|
value: pieValue,
|
|
128
152
|
cRange: DAISYUI_CHART_COLORS,
|
|
129
|
-
...
|
|
153
|
+
...nativeProps,
|
|
130
154
|
series: resolvedSeries,
|
|
131
155
|
})
|
|
132
156
|
</script>
|
|
@@ -148,16 +172,26 @@
|
|
|
148
172
|
<span class='loading loading-spinner loading-md text-primary' aria-label={uiM('chart_loading')}></span>
|
|
149
173
|
{:else if isEmpty}
|
|
150
174
|
<p class='text-sm text-base-content/50'>{uiM('chart_empty')}</p>
|
|
151
|
-
{:else if
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
{:else
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
{:else if !mounted}
|
|
176
|
+
<div class='flex h-full items-center justify-center' role='status' aria-label={uiM('chart_loading')}>
|
|
177
|
+
<span class='loading loading-spinner loading-md text-primary'></span>
|
|
178
|
+
</div>
|
|
179
|
+
{:else}
|
|
180
|
+
{#await rendererPromise}
|
|
181
|
+
<div class='flex h-full items-center justify-center' role='status' aria-label={uiM('chart_loading')}>
|
|
182
|
+
<span class='loading loading-spinner loading-md text-primary'></span>
|
|
183
|
+
</div>
|
|
184
|
+
{:then renderer}
|
|
185
|
+
{#if renderer}
|
|
186
|
+
{@const Renderer = renderer.default}
|
|
187
|
+
<Renderer {...(type === 'pie'
|
|
188
|
+
? pieLayerProps
|
|
189
|
+
: cartesianLayerProps)} />
|
|
190
|
+
{/if}
|
|
191
|
+
{:catch}
|
|
192
|
+
<!-- 浏览器可能缓存失败的模块请求;刷新文档后才能可靠重试同一资源。 -->
|
|
193
|
+
<ChartLoadError onretry={() => window.location.reload()} />
|
|
194
|
+
{/await}
|
|
161
195
|
{/if}
|
|
162
196
|
</div>
|
|
163
197
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- 图形模块加载失败时使用统一 Toast,原位保留重试操作。 -->
|
|
2
|
+
<script lang='ts'>
|
|
3
|
+
import { uiM } from '../../../messages.js'
|
|
4
|
+
import { useToastFeedback } from '../../../toast.svelte.js'
|
|
5
|
+
import Button from '../../primitives/Button.svelte'
|
|
6
|
+
/** 重试由 Chart 重新创建本次动态导入。 */
|
|
7
|
+
const { onretry }: { onretry: () => void } = $props()
|
|
8
|
+
useToastFeedback(() => uiM('chart_load_failed'))
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class='flex h-full items-center justify-center'>
|
|
12
|
+
<Button onclick={onretry} size='sm'>{uiM('chart_retry')}</Button>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component DashboardGrid
|
|
3
|
+
使用容器查询适配看板,不依赖视口宽度或图形引擎。
|
|
4
|
+
@example
|
|
5
|
+
```ts
|
|
6
|
+
import { mount, unmount } from 'svelte'
|
|
7
|
+
import { DashboardGrid } from '@h-ai/ui'
|
|
8
|
+
const component = mount(DashboardGrid, { target: document.body, props: { label: 'Reports', columns: 2 } })
|
|
9
|
+
await unmount(component)
|
|
10
|
+
```
|
|
11
|
+
-->
|
|
12
|
+
<script lang='ts'>
|
|
13
|
+
import type { DashboardGridProps } from './dashboard-types.js'
|
|
14
|
+
import { cn, getDataAttributes } from '../../../utils.js'
|
|
15
|
+
|
|
16
|
+
const { label, columns = 2, children, class: className = '', ...restProps }: DashboardGridProps = $props()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div {...getDataAttributes(restProps)} role='group' aria-label={label} class={cn('hai-dashboard-grid min-w-0', className)} style={`--hai-dashboard-columns: ${columns}; --hai-dashboard-medium-columns: ${Math.min(columns, 2)};`}>
|
|
20
|
+
<div class='hai-dashboard-grid__items'>
|
|
21
|
+
{#if children}{@render children()}{/if}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
.hai-dashboard-grid { container: hai-dashboard / inline-size; }
|
|
27
|
+
.hai-dashboard-grid__items { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
|
|
28
|
+
@container hai-dashboard (min-width: 40rem) {
|
|
29
|
+
.hai-dashboard-grid__items { grid-template-columns: repeat(var(--hai-dashboard-medium-columns), minmax(0, 1fr)); }
|
|
30
|
+
}
|
|
31
|
+
@container hai-dashboard (min-width: 64rem) {
|
|
32
|
+
.hai-dashboard-grid__items { grid-template-columns: repeat(var(--hai-dashboard-columns), minmax(0, 1fr)); }
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DashboardGridProps } from './dashboard-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* DashboardGrid
|
|
4
|
+
* 使用容器查询适配看板,不依赖视口宽度或图形引擎。
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { mount, unmount } from 'svelte'
|
|
8
|
+
* import { DashboardGrid } from '@h-ai/ui'
|
|
9
|
+
* const component = mount(DashboardGrid, { target: document.body, props: { label: 'Reports', columns: 2 } })
|
|
10
|
+
* await unmount(component)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const DashboardGrid: import("svelte").Component<DashboardGridProps, {}, "">;
|
|
14
|
+
type DashboardGrid = ReturnType<typeof DashboardGrid>;
|
|
15
|
+
export default DashboardGrid;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component MetricCard
|
|
3
|
+
指标卡不依赖图形引擎;可通过 children 按需补充迷你趋势图。
|
|
4
|
+
@example
|
|
5
|
+
```ts
|
|
6
|
+
import { mount, unmount } from 'svelte'
|
|
7
|
+
import { MetricCard } from '@h-ai/ui'
|
|
8
|
+
const component = mount(MetricCard, { target: document.body, props: { title: 'Revenue', value: '128,430', trend: 12.8, trendLabel: 'vs previous month', trendTone: 'success' } })
|
|
9
|
+
await unmount(component)
|
|
10
|
+
```
|
|
11
|
+
-->
|
|
12
|
+
<script lang='ts'>
|
|
13
|
+
import type { MetricCardProps } from './dashboard-types.js'
|
|
14
|
+
import { getUILocale, uiM } from '../../../messages.js'
|
|
15
|
+
import { cn, getDataAttributes } from '../../../utils.js'
|
|
16
|
+
import Card from '../../compounds/Card.svelte'
|
|
17
|
+
|
|
18
|
+
const { title, value, unit = '', trend, trendLabel = '', trendTone = 'neutral', description = '', loading = false, children, class: className = '', ...restProps }: MetricCardProps = $props()
|
|
19
|
+
const hasValue = $derived(value != null && (typeof value !== 'number' || Number.isFinite(value)))
|
|
20
|
+
const hasTrend = $derived(typeof trend === 'number' && Number.isFinite(trend))
|
|
21
|
+
const direction = $derived((trend ?? 0) > 0
|
|
22
|
+
? 'up'
|
|
23
|
+
: (trend ?? 0) < 0
|
|
24
|
+
? 'down'
|
|
25
|
+
: 'flat')
|
|
26
|
+
const trendText = $derived(new Intl.NumberFormat(getUILocale(), { style: 'percent', maximumFractionDigits: 1, signDisplay: 'exceptZero' }).format((trend ?? 0) / 100))
|
|
27
|
+
const toneClass = {
|
|
28
|
+
success: 'text-success',
|
|
29
|
+
warning: 'text-warning',
|
|
30
|
+
error: 'text-error',
|
|
31
|
+
neutral: 'text-base-content',
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<Card {...getDataAttributes(restProps)} class={cn('hai-metric-card min-w-0', className)} shadow={false}>
|
|
36
|
+
<div aria-busy={loading} class='flex min-w-0 flex-col gap-2'>
|
|
37
|
+
<h2 class='text-sm font-medium text-base-content/80'>{title}</h2>
|
|
38
|
+
{#if loading}
|
|
39
|
+
<div role='status' aria-label={uiM('chart_loading')} class='skeleton h-9 w-32'></div>
|
|
40
|
+
{:else}
|
|
41
|
+
<div class='flex min-w-0 flex-wrap items-baseline gap-x-2'>
|
|
42
|
+
<span class='break-words text-3xl font-semibold tracking-tight tabular-nums'>{hasValue ? value : '—'}</span>
|
|
43
|
+
{#if unit && hasValue}<span class='text-sm text-base-content/80'>{unit}</span>{/if}
|
|
44
|
+
</div>
|
|
45
|
+
{#if hasTrend}
|
|
46
|
+
<div class='flex flex-wrap items-center gap-x-2 gap-y-1 text-sm'>
|
|
47
|
+
<span data-trend-direction={direction} class={cn('inline-flex items-center gap-1 font-medium tabular-nums', toneClass[trendTone])}>
|
|
48
|
+
<svg aria-hidden='true' viewBox='0 0 20 20' class='size-4 shrink-0' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'>
|
|
49
|
+
<path d={direction === 'up'
|
|
50
|
+
? 'M3 14 8 9 12 12 17 5 M12 5h5v5'
|
|
51
|
+
: direction === 'down'
|
|
52
|
+
? 'M3 6 8 11 12 8 17 15 M12 15h5v-5'
|
|
53
|
+
: 'M3 10h14 m-4 -4 4 4 -4 4'}></path>
|
|
54
|
+
</svg>
|
|
55
|
+
<span class='sr-only'>{uiM(direction === 'up'
|
|
56
|
+
? 'metric_increase'
|
|
57
|
+
: direction === 'down'
|
|
58
|
+
? 'metric_decrease'
|
|
59
|
+
: 'metric_unchanged')}</span>
|
|
60
|
+
{trendText}
|
|
61
|
+
</span>
|
|
62
|
+
{#if trendLabel}<span class='text-base-content/80'>{trendLabel}</span>{/if}
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
65
|
+
{#if children}{@render children()}{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
{#if description}<p class='break-words text-xs text-base-content/80'>{description}</p>{/if}
|
|
68
|
+
</div>
|
|
69
|
+
</Card>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MetricCardProps } from './dashboard-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* MetricCard
|
|
4
|
+
* 指标卡不依赖图形引擎;可通过 children 按需补充迷你趋势图。
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { mount, unmount } from 'svelte'
|
|
8
|
+
* import { MetricCard } from '@h-ai/ui'
|
|
9
|
+
* const component = mount(MetricCard, { target: document.body, props: { title: 'Revenue', value: '128,430', trend: 12.8, trendLabel: 'vs previous month', trendTone: 'success' } })
|
|
10
|
+
* await unmount(component)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const MetricCard: import("svelte").Component<MetricCardProps, {}, "">;
|
|
14
|
+
type MetricCard = ReturnType<typeof MetricCard>;
|
|
15
|
+
export default MetricCard;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component ReportCard
|
|
3
|
+
复用 Card 的报表容器,内容插槽不限制 LayerChart 图形能力。
|
|
4
|
+
@example
|
|
5
|
+
```ts
|
|
6
|
+
import { mount, unmount } from 'svelte'
|
|
7
|
+
import { ReportCard } from '@h-ai/ui'
|
|
8
|
+
const component = mount(ReportCard, { target: document.body, props: { title: 'Revenue', empty: true } })
|
|
9
|
+
await unmount(component)
|
|
10
|
+
```
|
|
11
|
+
-->
|
|
12
|
+
<script lang='ts'>
|
|
13
|
+
import type { ReportCardProps } from './dashboard-types.js'
|
|
14
|
+
import { uiM } from '../../../messages.js'
|
|
15
|
+
import { cn, getDataAttributes } from '../../../utils.js'
|
|
16
|
+
import Card from '../../compounds/Card.svelte'
|
|
17
|
+
|
|
18
|
+
const { title, description = '', actions, children, footer, loading = false, empty = false, minHeight = 240, class: className = '', ...restProps }: ReportCardProps = $props()
|
|
19
|
+
const titleId = $props.id()
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Card {...getDataAttributes(restProps)} class={cn('hai-report-card min-w-0', className)} shadow={false}>
|
|
23
|
+
{#snippet header()}
|
|
24
|
+
<div class='flex w-full min-w-0 flex-wrap items-start justify-between gap-3'>
|
|
25
|
+
<div class='min-w-0'>
|
|
26
|
+
<h2 id={titleId} class='break-words text-sm font-semibold'>{title}</h2>
|
|
27
|
+
{#if description}<p class='mt-1 break-words text-xs font-normal text-base-content/80'>{description}</p>{/if}
|
|
28
|
+
</div>
|
|
29
|
+
{#if actions}<div class='flex shrink-0 flex-wrap gap-2 font-normal'>{@render actions()}</div>{/if}
|
|
30
|
+
</div>
|
|
31
|
+
{/snippet}
|
|
32
|
+
<section aria-labelledby={titleId} aria-busy={loading} class='min-w-0' style={`min-height: ${Math.max(0, minHeight)}px;`}>
|
|
33
|
+
{#if loading || empty}
|
|
34
|
+
<div class='flex items-center justify-center' style={`min-height: ${Math.max(0, minHeight)}px;`}>
|
|
35
|
+
{#if loading}
|
|
36
|
+
<span role='status' class='loading loading-spinner loading-md text-primary' aria-label={uiM('chart_loading')}></span>
|
|
37
|
+
{:else}
|
|
38
|
+
<p class='text-sm text-base-content/80'>{uiM('chart_empty')}</p>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
41
|
+
{:else if children}
|
|
42
|
+
{@render children()}
|
|
43
|
+
{/if}
|
|
44
|
+
</section>
|
|
45
|
+
{#if footer}
|
|
46
|
+
<div class='min-w-0 border-t border-base-300 pt-3 text-xs text-base-content/80'>{@render footer()}</div>
|
|
47
|
+
{/if}
|
|
48
|
+
</Card>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReportCardProps } from './dashboard-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* ReportCard
|
|
4
|
+
* 复用 Card 的报表容器,内容插槽不限制 LayerChart 图形能力。
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { mount, unmount } from 'svelte'
|
|
8
|
+
* import { ReportCard } from '@h-ai/ui'
|
|
9
|
+
* const component = mount(ReportCard, { target: document.body, props: { title: 'Revenue', empty: true } })
|
|
10
|
+
* await unmount(component)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const ReportCard: import("svelte").Component<ReportCardProps, {}, "">;
|
|
14
|
+
type ReportCard = ReturnType<typeof ReportCard>;
|
|
15
|
+
export default ReportCard;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @h-ai/ui — 常用图表预设,仅定义默认值,调用方原生配置优先。 @module chart-presets */
|
|
2
|
+
import type { ChartPreset, ChartType } from './chart-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 解析预设,不读取或转换业务数据。
|
|
5
|
+
* @param preset - 可选预设名称。
|
|
6
|
+
* @returns 图形类型及可被调用方覆盖的默认属性。
|
|
7
|
+
* @example 模块内部上下文
|
|
8
|
+
* ```ts
|
|
9
|
+
* const preset = resolveChartPreset('donut')
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveChartPreset(preset?: ChartPreset): {
|
|
13
|
+
type?: ChartType;
|
|
14
|
+
props: Record<string, unknown>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析预设,不读取或转换业务数据。
|
|
3
|
+
* @param preset - 可选预设名称。
|
|
4
|
+
* @returns 图形类型及可被调用方覆盖的默认属性。
|
|
5
|
+
* @example 模块内部上下文
|
|
6
|
+
* ```ts
|
|
7
|
+
* const preset = resolveChartPreset('donut')
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export function resolveChartPreset(preset) {
|
|
11
|
+
switch (preset) {
|
|
12
|
+
case 'grouped-bar': return {
|
|
13
|
+
type: 'bar',
|
|
14
|
+
props: {
|
|
15
|
+
seriesLayout: 'group',
|
|
16
|
+
axis: true,
|
|
17
|
+
grid: true,
|
|
18
|
+
legend: true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
case 'stacked-bar': return {
|
|
22
|
+
type: 'bar',
|
|
23
|
+
props: {
|
|
24
|
+
seriesLayout: 'stack',
|
|
25
|
+
axis: true,
|
|
26
|
+
grid: true,
|
|
27
|
+
legend: true,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
case 'stacked-area': return {
|
|
31
|
+
type: 'area',
|
|
32
|
+
props: {
|
|
33
|
+
seriesLayout: 'stack',
|
|
34
|
+
axis: true,
|
|
35
|
+
grid: true,
|
|
36
|
+
legend: true,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
case 'donut': return {
|
|
40
|
+
type: 'pie',
|
|
41
|
+
props: { innerRadius: 0.65, legend: true },
|
|
42
|
+
};
|
|
43
|
+
case 'sparkline': return {
|
|
44
|
+
type: 'line',
|
|
45
|
+
props: {
|
|
46
|
+
axis: false,
|
|
47
|
+
grid: false,
|
|
48
|
+
legend: false,
|
|
49
|
+
points: false,
|
|
50
|
+
padding: { top: 4, right: 0, bottom: 4, left: 0 },
|
|
51
|
+
height: 64,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
default: return { props: {} };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -43,6 +43,15 @@ export type ChartAccessor = string | number | ((item: ChartDataItem) => unknown)
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'scatter';
|
|
46
|
+
/**
|
|
47
|
+
* 常用图形的可覆盖默认配置;无需同时传 type。
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import type { ChartPreset } from '@h-ai/ui'
|
|
51
|
+
* const preset: ChartPreset = 'donut'
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export type ChartPreset = 'grouped-bar' | 'stacked-bar' | 'stacked-area' | 'donut' | 'sparkline';
|
|
46
55
|
/**
|
|
47
56
|
* Chart 预设高度档位;具体像素值在 Chart.svelte 中固定映射。
|
|
48
57
|
*
|
|
@@ -116,8 +125,10 @@ export interface ChartSeries {
|
|
|
116
125
|
* ```
|
|
117
126
|
*/
|
|
118
127
|
export interface ChartProps extends DataAttributes {
|
|
119
|
-
/** 选择内部 LayerChart
|
|
120
|
-
type
|
|
128
|
+
/** 选择内部 LayerChart 高阶组件;优先于 preset 的图形类型,未指定时默认 line。 */
|
|
129
|
+
type?: ChartType;
|
|
130
|
+
/** 常用图表预设;原生属性覆盖预设默认值。 */
|
|
131
|
+
preset?: ChartPreset;
|
|
121
132
|
/** 图表数据源;空数组会触发内置空态。 */
|
|
122
133
|
data: ChartDataItem[];
|
|
123
134
|
/** x 轴字段名;饼图中默认映射为 key 和 label。 */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/** @h-ai/ui — 轻量看板组件契约。 @module dashboard-types */
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { DataAttributes } from '../../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* 指标卡展示数据;百分比变化由业务计算,正负方向与业务好坏分别表达。
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { MetricCardProps } from '@h-ai/ui'
|
|
9
|
+
* const metric: MetricCardProps = { title: 'Revenue', value: '128,430', unit: 'CNY', trend: 12.8, trendLabel: 'vs previous month', trendTone: 'success' }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface MetricCardProps extends DataAttributes {
|
|
13
|
+
/** 指标名称,由应用提供翻译。 */
|
|
14
|
+
title: string;
|
|
15
|
+
/** 已格式化文本或数值;缺失和非有限数显示占位符,零值正常显示。 */
|
|
16
|
+
value?: string | number | null;
|
|
17
|
+
/** 单位文本。 */
|
|
18
|
+
unit?: string;
|
|
19
|
+
/** 变化百分数,例如 12.8 表示 +12.8%,不是 0.128。 */
|
|
20
|
+
trend?: number;
|
|
21
|
+
/** 比较基准,例如“较上月”。 */
|
|
22
|
+
trendLabel?: string;
|
|
23
|
+
/** 业务语义色;默认 neutral,下降也可以是 success。 */
|
|
24
|
+
trendTone?: 'success' | 'warning' | 'error' | 'neutral';
|
|
25
|
+
/** 辅助说明。 */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** 加载时隐藏旧数值及趋势内容。 */
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
/** 可选趋势图或其他补充内容;未提供时不加载图形引擎。 */
|
|
30
|
+
children?: Snippet;
|
|
31
|
+
/** 外层样式。 */
|
|
32
|
+
class?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 报表卡片负责布局和状态,children 可放统一 Chart 或任意 LayerChart 原生组件。
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import type { ReportCardProps } from '@h-ai/ui'
|
|
39
|
+
* const report: ReportCardProps = { title: 'Revenue trend', description: 'Monthly totals', loading: false }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface ReportCardProps extends DataAttributes {
|
|
43
|
+
/** 卡片标题。 */
|
|
44
|
+
title: string;
|
|
45
|
+
/** 标题下的说明。 */
|
|
46
|
+
description?: string;
|
|
47
|
+
/** 标题旁的操作区域。 */
|
|
48
|
+
actions?: Snippet;
|
|
49
|
+
/** 报表或原生图形内容。 */
|
|
50
|
+
children?: Snippet;
|
|
51
|
+
/** 可选页脚。 */
|
|
52
|
+
footer?: Snippet;
|
|
53
|
+
/** 加载状态;保留卡片高度,不挂载图形。 */
|
|
54
|
+
loading?: boolean;
|
|
55
|
+
/** 空态;不挂载图形。 */
|
|
56
|
+
empty?: boolean;
|
|
57
|
+
/** 状态区域的最小高度,默认 240 像素。 */
|
|
58
|
+
minHeight?: number;
|
|
59
|
+
/** 外层样式。 */
|
|
60
|
+
class?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 看板的响应式网格,按容器宽度收拢,children 保持 DOM 阅读顺序。
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import type { DashboardGridProps } from '@h-ai/ui'
|
|
67
|
+
* const grid: DashboardGridProps = { label: 'Key metrics', columns: 4 }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export interface DashboardGridProps extends DataAttributes {
|
|
71
|
+
/** 网格的无障碍名称。 */
|
|
72
|
+
label: string;
|
|
73
|
+
/** 宽容器列数;窄容器一列,中等容器最多两列。 */
|
|
74
|
+
columns?: 1 | 2 | 3 | 4;
|
|
75
|
+
/** 指标卡或报表卡。 */
|
|
76
|
+
children?: Snippet;
|
|
77
|
+
/** 外层样式。 */
|
|
78
|
+
class?: string;
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @h-ai/ui — 图表场景组件
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 导出统一 Chart、轻量看板组件和公共类型;内部 renderer 不对外暴露。
|
|
5
5
|
* @module index
|
|
6
6
|
*/
|
|
7
|
-
export type { ChartDataItem, ChartLineVariant, ChartProps, ChartSeries, ChartSize, ChartTooltipMode, ChartType } from './chart-types.js';
|
|
7
|
+
export type { ChartDataItem, ChartLineVariant, ChartPreset, ChartProps, ChartSeries, ChartSize, ChartTooltipMode, ChartType } from './chart-types.js';
|
|
8
8
|
export { default as Chart } from './Chart.svelte';
|
|
9
|
+
export type { DashboardGridProps, MetricCardProps, ReportCardProps } from './dashboard-types.js';
|
|
10
|
+
export { default as DashboardGrid } from './DashboardGrid.svelte';
|
|
11
|
+
export { default as MetricCard } from './MetricCard.svelte';
|
|
12
|
+
export { default as ReportCard } from './ReportCard.svelte';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @h-ai/ui — 图表场景组件
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 导出统一 Chart、轻量看板组件和公共类型;内部 renderer 不对外暴露。
|
|
5
5
|
* @module index
|
|
6
6
|
*/
|
|
7
7
|
export { default as Chart } from './Chart.svelte';
|
|
8
|
+
export { default as DashboardGrid } from './DashboardGrid.svelte';
|
|
9
|
+
export { default as MetricCard } from './MetricCard.svelte';
|
|
10
|
+
export { default as ReportCard } from './ReportCard.svelte';
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import type { AreaChartProps } from 'layerchart'
|
|
11
11
|
import type { ChartDataItem } from '../chart-types.js'
|
|
12
12
|
import { AreaChart as LayerAreaChart } from 'layerchart'
|
|
13
|
+
import 'layerchart/daisyui-5.css'
|
|
13
14
|
|
|
14
15
|
/** 透传给 LayerChart AreaChart 的全部原生属性。 */
|
|
15
16
|
const { ...props }: AreaChartProps<ChartDataItem> = $props()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AreaChartProps } from 'layerchart';
|
|
2
2
|
import type { ChartDataItem } from '../chart-types.js';
|
|
3
|
+
import 'layerchart/daisyui-5.css';
|
|
3
4
|
declare const AreaChart: import("svelte").Component<AreaChartProps<ChartDataItem>, {}, "">;
|
|
4
5
|
type AreaChart = ReturnType<typeof AreaChart>;
|
|
5
6
|
export default AreaChart;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import type { BarChartProps } from 'layerchart'
|
|
11
11
|
import type { ChartDataItem } from '../chart-types.js'
|
|
12
12
|
import { BarChart as LayerBarChart } from 'layerchart'
|
|
13
|
+
import 'layerchart/daisyui-5.css'
|
|
13
14
|
|
|
14
15
|
/** 透传给 LayerChart BarChart 的全部原生属性。 */
|
|
15
16
|
const { ...props }: BarChartProps<ChartDataItem> = $props()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BarChartProps } from 'layerchart';
|
|
2
2
|
import type { ChartDataItem } from '../chart-types.js';
|
|
3
|
+
import 'layerchart/daisyui-5.css';
|
|
3
4
|
declare const BarChart: import("svelte").Component<BarChartProps<ChartDataItem>, {}, "">;
|
|
4
5
|
type BarChart = ReturnType<typeof BarChart>;
|
|
5
6
|
export default BarChart;
|