@h-ai/ui 0.1.0-alpha.67 → 0.1.0-alpha.68
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 +31 -5
- package/README.ja.md +31 -5
- package/README.md +64 -38
- package/dist/components/compounds/Accordion.svelte +24 -0
- package/dist/components/compounds/Accordion.svelte.d.ts +34 -0
- package/dist/components/compounds/ActionSheet.svelte +24 -0
- package/dist/components/compounds/ActionSheet.svelte.d.ts +38 -0
- package/dist/components/compounds/Alert.svelte +15 -4
- package/dist/components/compounds/Alert.svelte.d.ts +10 -0
- package/dist/components/compounds/AppBar.svelte +24 -0
- package/dist/components/compounds/AppBar.svelte.d.ts +33 -0
- package/dist/components/compounds/BottomNav.svelte +37 -0
- package/dist/components/compounds/BottomNav.svelte.d.ts +43 -0
- package/dist/components/compounds/Breadcrumb.svelte +11 -0
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +20 -0
- package/dist/components/compounds/Calendar.svelte +20 -6
- package/dist/components/compounds/Calendar.svelte.d.ts +20 -6
- package/dist/components/compounds/Card.svelte +10 -0
- package/dist/components/compounds/Card.svelte.d.ts +10 -0
- package/dist/components/compounds/Combobox.svelte +35 -18
- package/dist/components/compounds/Combobox.svelte.d.ts +35 -18
- package/dist/components/compounds/Confirm.svelte +11 -0
- package/dist/components/compounds/Confirm.svelte.d.ts +21 -0
- package/dist/components/compounds/DataTable.svelte +40 -17
- package/dist/components/compounds/DataTable.svelte.d.ts +9 -13
- package/dist/components/compounds/DatePicker.svelte +20 -6
- package/dist/components/compounds/DatePicker.svelte.d.ts +20 -6
- package/dist/components/compounds/Drawer.svelte +11 -0
- package/dist/components/compounds/Drawer.svelte.d.ts +21 -0
- package/dist/components/compounds/Dropdown.svelte +10 -0
- package/dist/components/compounds/Dropdown.svelte.d.ts +10 -0
- package/dist/components/compounds/Empty.svelte +16 -5
- package/dist/components/compounds/Empty.svelte.d.ts +20 -0
- package/dist/components/compounds/Form.svelte +37 -2
- package/dist/components/compounds/Form.svelte.d.ts +20 -0
- package/dist/components/compounds/FormField.svelte +11 -0
- package/dist/components/compounds/FormField.svelte.d.ts +20 -0
- package/dist/components/compounds/FormLayout.svelte +13 -1
- package/dist/components/compounds/FormLayout.svelte.d.ts +13 -0
- package/dist/components/compounds/InfiniteScroll.svelte +24 -0
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +34 -0
- package/dist/components/compounds/MessageBoxContainer.svelte +11 -0
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +21 -0
- package/dist/components/compounds/MessageBoxDialog.svelte +14 -0
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +21 -0
- package/dist/components/compounds/MessageContainer.svelte +11 -0
- package/dist/components/compounds/MessageContainer.svelte.d.ts +21 -0
- package/dist/components/compounds/Modal.svelte +10 -0
- package/dist/components/compounds/Modal.svelte.d.ts +10 -0
- package/dist/components/compounds/PageHeader.svelte +21 -8
- package/dist/components/compounds/PageHeader.svelte.d.ts +21 -8
- package/dist/components/compounds/Pagination.svelte +34 -8
- package/dist/components/compounds/Pagination.svelte.d.ts +20 -0
- package/dist/components/compounds/Popover.svelte +11 -0
- package/dist/components/compounds/Popover.svelte.d.ts +20 -0
- package/dist/components/compounds/PullRefresh.svelte +24 -0
- package/dist/components/compounds/PullRefresh.svelte.d.ts +32 -0
- package/dist/components/compounds/Result.svelte +11 -0
- package/dist/components/compounds/Result.svelte.d.ts +20 -0
- package/dist/components/compounds/SafeArea.svelte +24 -0
- package/dist/components/compounds/SafeArea.svelte.d.ts +32 -0
- package/dist/components/compounds/Skeleton.svelte +10 -0
- package/dist/components/compounds/Skeleton.svelte.d.ts +10 -0
- package/dist/components/compounds/Steps.svelte +11 -0
- package/dist/components/compounds/Steps.svelte.d.ts +20 -0
- package/dist/components/compounds/SwipeCell.svelte +24 -0
- package/dist/components/compounds/SwipeCell.svelte.d.ts +37 -0
- package/dist/components/compounds/TableToolbar.svelte +66 -28
- package/dist/components/compounds/TableToolbar.svelte.d.ts +29 -19
- package/dist/components/compounds/Tabs.svelte +58 -10
- package/dist/components/compounds/Tabs.svelte.d.ts +10 -0
- package/dist/components/compounds/TagInput.svelte +11 -0
- package/dist/components/compounds/TagInput.svelte.d.ts +20 -0
- package/dist/components/compounds/Timeline.svelte +24 -0
- package/dist/components/compounds/Timeline.svelte.d.ts +34 -0
- package/dist/components/compounds/ToastContainer.svelte +11 -0
- package/dist/components/compounds/ToastContainer.svelte.d.ts +26 -0
- package/dist/components/compounds/Tooltip.svelte +11 -0
- package/dist/components/compounds/Tooltip.svelte.d.ts +22 -0
- package/dist/components/compounds/accordion-types.d.ts +10 -1
- package/dist/components/compounds/action-sheet-types.d.ts +9 -0
- package/dist/components/compounds/bottom-nav-types.d.ts +9 -0
- package/dist/components/compounds/swipe-cell-types.d.ts +9 -0
- package/dist/components/compounds/timeline-types.d.ts +9 -0
- package/dist/components/control-size.d.ts +17 -0
- package/dist/components/control-size.js +8 -0
- package/dist/components/primitives/Avatar.svelte +10 -0
- package/dist/components/primitives/Avatar.svelte.d.ts +10 -0
- package/dist/components/primitives/Badge.svelte +10 -0
- package/dist/components/primitives/Badge.svelte.d.ts +10 -0
- package/dist/components/primitives/BareButton.svelte +11 -0
- package/dist/components/primitives/BareButton.svelte.d.ts +20 -0
- package/dist/components/primitives/BareInput.svelte +11 -0
- package/dist/components/primitives/BareInput.svelte.d.ts +20 -0
- package/dist/components/primitives/Button.svelte +10 -0
- package/dist/components/primitives/Button.svelte.d.ts +10 -0
- package/dist/components/primitives/Checkbox.svelte +11 -0
- package/dist/components/primitives/Checkbox.svelte.d.ts +20 -0
- package/dist/components/primitives/IconButton.svelte +11 -0
- package/dist/components/primitives/IconButton.svelte.d.ts +20 -0
- package/dist/components/primitives/Input.svelte +10 -0
- package/dist/components/primitives/Input.svelte.d.ts +10 -0
- package/dist/components/primitives/Progress.svelte +11 -0
- package/dist/components/primitives/Progress.svelte.d.ts +20 -0
- package/dist/components/primitives/Radio.svelte +11 -0
- package/dist/components/primitives/Radio.svelte.d.ts +20 -0
- package/dist/components/primitives/Range.svelte +24 -0
- package/dist/components/primitives/Range.svelte.d.ts +34 -0
- package/dist/components/primitives/Rating.svelte +24 -0
- package/dist/components/primitives/Rating.svelte.d.ts +34 -0
- package/dist/components/primitives/Select.svelte +11 -0
- package/dist/components/primitives/Select.svelte.d.ts +21 -0
- package/dist/components/primitives/Spinner.svelte +11 -0
- package/dist/components/primitives/Spinner.svelte.d.ts +20 -0
- package/dist/components/primitives/Switch.svelte +11 -0
- package/dist/components/primitives/Switch.svelte.d.ts +20 -0
- package/dist/components/primitives/Tag.svelte +11 -0
- package/dist/components/primitives/Tag.svelte.d.ts +20 -0
- package/dist/components/primitives/Textarea.svelte +11 -0
- package/dist/components/primitives/Textarea.svelte.d.ts +21 -0
- package/dist/components/primitives/ToggleCheckbox.svelte +11 -0
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +20 -0
- package/dist/components/primitives/ToggleInput.svelte +11 -0
- package/dist/components/primitives/ToggleInput.svelte.d.ts +20 -0
- package/dist/components/primitives/ToggleRadio.svelte +11 -0
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +20 -0
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +27 -0
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +27 -0
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +79 -0
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +23 -0
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +11 -0
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +28 -0
- package/dist/components/scenes/ai/code-preview.d.ts +28 -0
- package/dist/components/scenes/ai/code-preview.js +20 -0
- package/dist/components/scenes/ai/document-download.d.ts +52 -0
- package/dist/components/scenes/ai/document-download.js +30 -2
- package/dist/components/scenes/ai/document-parse.d.ts +71 -14
- package/dist/components/scenes/ai/document-parse.js +19 -9
- package/dist/components/scenes/ai/document-types.d.ts +222 -88
- package/dist/components/scenes/ai/editor-markdown-extensions.d.ts +16 -0
- package/dist/components/scenes/ai/editor-markdown-extensions.js +16 -0
- package/dist/components/scenes/ai/highlight.d.ts +11 -0
- package/dist/components/scenes/ai/highlight.js +11 -0
- package/dist/components/scenes/ai/markdown-parse.d.ts +8 -2
- package/dist/components/scenes/ai/markdown-parse.js +2 -2
- package/dist/components/scenes/ai/mermaid-host-sync.d.ts +38 -0
- package/dist/components/scenes/ai/mermaid-host-sync.js +30 -0
- package/dist/components/scenes/ai/mermaid-render.d.ts +23 -0
- package/dist/components/scenes/ai/mermaid-render.js +23 -0
- package/dist/components/scenes/ai/safe-html.d.ts +54 -6
- package/dist/components/scenes/ai/safe-html.js +54 -6
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +48 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +24 -0
- package/dist/components/scenes/ai/table/table-types.d.ts +79 -0
- package/dist/components/scenes/app/FeedbackModal.svelte +45 -5
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +45 -5
- package/dist/components/scenes/app/LanguageSwitch.svelte +29 -19
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +28 -19
- package/dist/components/scenes/app/SettingsLayout.svelte +21 -9
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +21 -9
- package/dist/components/scenes/app/SettingsModal.svelte +23 -0
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +23 -0
- package/dist/components/scenes/app/ThemeColorPicker.svelte +31 -0
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +31 -0
- package/dist/components/scenes/app/ThemeSelector.svelte +21 -6
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +21 -6
- package/dist/components/scenes/app/ThemeToggle.svelte +21 -4
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +21 -4
- package/dist/components/scenes/app/index.d.ts +1 -1
- package/dist/components/scenes/app/index.js +1 -1
- package/dist/components/scenes/charts/Chart.svelte +11 -0
- package/dist/components/scenes/charts/Chart.svelte.d.ts +20 -0
- package/dist/components/scenes/charts/chart-theme.d.ts +25 -1
- package/dist/components/scenes/charts/chart-theme.js +25 -1
- package/dist/components/scenes/charts/chart-types.d.ts +83 -7
- package/dist/components/scenes/charts/renderers/LineChart.svelte +53 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +13 -0
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +10 -0
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +10 -0
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +8 -0
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +8 -0
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +18 -0
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +18 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte +10 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +10 -0
- package/dist/components/scenes/crud/CrudFilterBar.svelte +18 -0
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +18 -0
- package/dist/components/scenes/crud/CrudPage.svelte +37 -5
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +35 -3
- package/dist/components/scenes/crud/crud-controller.svelte.d.ts +142 -23
- package/dist/components/scenes/crud/crud-controller.svelte.js +22 -11
- package/dist/components/scenes/crud/crud-form-validation.d.ts +12 -0
- package/dist/components/scenes/crud/crud-form-validation.js +12 -0
- package/dist/components/scenes/crud/crud-types.d.ts +79 -8
- package/dist/components/scenes/crud/nav-adapter.d.ts +14 -0
- package/dist/components/scenes/crud/nav-adapter.js +8 -0
- package/dist/components/scenes/crypto/EncryptedInput.svelte +24 -0
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +34 -0
- package/dist/components/scenes/crypto/HashDisplay.svelte +11 -0
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +21 -0
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +11 -0
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +21 -0
- package/dist/components/scenes/error/ErrorPage.svelte +8 -1
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +8 -1
- package/dist/components/scenes/error/error-presets.d.ts +40 -4
- package/dist/components/scenes/error/error-presets.js +22 -2
- package/dist/components/scenes/guide/GuideHost.svelte +27 -0
- package/dist/components/scenes/guide/GuideHost.svelte.d.ts +27 -0
- package/dist/components/scenes/guide/HelpCenter.svelte +27 -0
- package/dist/components/scenes/guide/HelpCenter.svelte.d.ts +27 -0
- package/dist/components/scenes/iam/AuthPanel.svelte +26 -2
- package/dist/components/scenes/iam/AuthPanel.svelte.d.ts +25 -0
- package/dist/components/scenes/iam/AuthShell.svelte +8 -3
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +8 -3
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +10 -0
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +10 -0
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +11 -0
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +21 -0
- package/dist/components/scenes/iam/LoginForm.svelte +24 -31
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +10 -0
- package/dist/components/scenes/iam/PasswordInput.svelte +23 -0
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +23 -0
- package/dist/components/scenes/iam/PermGuard.svelte +21 -11
- package/dist/components/scenes/iam/PermGuard.svelte.d.ts +30 -0
- package/dist/components/scenes/iam/RegisterForm.svelte +10 -0
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +10 -0
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +10 -0
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +10 -0
- package/dist/components/scenes/iam/UserProfile.svelte +11 -0
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +21 -0
- package/dist/components/scenes/iam/auth-error-message.d.ts +10 -0
- package/dist/components/scenes/iam/auth-error-message.js +10 -0
- package/dist/components/scenes/iam/password-utils.d.ts +39 -1
- package/dist/components/scenes/iam/password-utils.js +39 -1
- package/dist/components/scenes/iam/permission-context.svelte.d.ts +33 -23
- package/dist/components/scenes/iam/permission-context.svelte.js +20 -22
- package/dist/components/scenes/storage/AvatarUpload.svelte +11 -0
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +20 -0
- package/dist/components/scenes/storage/FileList.svelte +13 -2
- package/dist/components/scenes/storage/FileList.svelte.d.ts +20 -0
- package/dist/components/scenes/storage/FileUpload.svelte +37 -2
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +21 -0
- package/dist/components/scenes/storage/ImageUpload.svelte +11 -0
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +21 -0
- package/dist/components/scenes/types.d.ts +352 -11
- package/dist/guide-storage.d.ts +13 -1
- package/dist/guide-storage.js +13 -1
- package/dist/guide-types.d.ts +67 -2
- package/dist/guide.svelte.d.ts +22 -1
- package/dist/guide.svelte.js +22 -1
- package/dist/i18n.svelte.d.ts +64 -3
- package/dist/i18n.svelte.js +99 -18
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -2
- package/dist/internal/browser-safety.d.ts +51 -2
- package/dist/internal/browser-safety.js +45 -7
- package/dist/internal/form-context.d.ts +73 -0
- package/dist/internal/form-context.js +57 -0
- package/dist/internal/form-validation.svelte.d.ts +42 -0
- package/dist/internal/form-validation.svelte.js +26 -0
- package/dist/internal/icon-safety.d.ts +7 -0
- package/dist/internal/icon-safety.js +7 -0
- package/dist/internal/locale.d.ts +19 -0
- package/dist/internal/locale.js +21 -0
- package/dist/message.svelte.d.ts +90 -0
- package/dist/message.svelte.js +84 -0
- package/dist/messagebox.svelte.d.ts +61 -13
- package/dist/messagebox.svelte.js +55 -13
- package/dist/messages/en-US.json +6 -1
- package/dist/messages/ja-JP.json +389 -0
- package/dist/messages/zh-CN.json +6 -1
- package/dist/messages.d.ts +24 -3
- package/dist/messages.js +18 -3
- package/dist/styles/design-tokens.css +4 -2
- package/dist/styles/global.css +28 -8
- package/dist/styles/theme.css +2 -0
- package/dist/theme-config.d.ts +173 -0
- package/dist/theme-config.js +143 -0
- package/dist/toast.svelte.d.ts +114 -4
- package/dist/toast.svelte.js +108 -4
- package/dist/types.d.ts +526 -9
- package/dist/utils/platform.svelte.d.ts +28 -15
- package/dist/utils/platform.svelte.js +19 -14
- package/dist/utils.d.ts +102 -0
- package/dist/utils.js +93 -0
- package/package.json +66 -6
|
@@ -4,8 +4,23 @@ import type { DataAttributes } from '../../../../types.js';
|
|
|
4
4
|
* - `text`: 普通文本输入
|
|
5
5
|
* - `number`: 数值输入(前端仍按字符串回传,避免输入中间态被强转)
|
|
6
6
|
* - `tag`: 标签样式输入,用于优先级、状态等枚举文本
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { AiTableColumnType } from '@h-ai/ui'
|
|
11
|
+
* const example: AiTableColumnType = 'number'
|
|
12
|
+
* ```
|
|
7
13
|
*/
|
|
8
14
|
export type AiTableColumnType = 'text' | 'number' | 'tag';
|
|
15
|
+
/**
|
|
16
|
+
* AI 表格列的稳定字段名、标题和编辑类型。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import type { AiTableColumn } from '@h-ai/ui'
|
|
21
|
+
* const example: AiTableColumn = { key: 'sales', label: '销量', type: 'number' }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
9
24
|
export interface AiTableColumn {
|
|
10
25
|
/** 列唯一键,必须和每行对象中的字段名一一对应。 */
|
|
11
26
|
key: string;
|
|
@@ -14,6 +29,15 @@ export interface AiTableColumn {
|
|
|
14
29
|
/** 当前列的输入与渲染类型。 */
|
|
15
30
|
type: AiTableColumnType;
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* 带稳定 row_id 的表格行;其余字段按列 key 访问。
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import type { AiTableRow } from '@h-ai/ui'
|
|
38
|
+
* const example: AiTableRow = { row_id: 'r1', sales: 42 }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
17
41
|
export interface AiTableRow {
|
|
18
42
|
/** 行唯一标识;编辑、删除和流式合并都依赖它做稳定匹配。 */
|
|
19
43
|
row_id: string;
|
|
@@ -26,6 +50,15 @@ export interface AiTableRow {
|
|
|
26
50
|
*/
|
|
27
51
|
[key: string]: unknown;
|
|
28
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* AI 表格的完整列定义和行快照,交给编辑器进行受控展示与编辑。
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import type { AiTableData } from '@h-ai/ui'
|
|
59
|
+
* const example: AiTableData = { table_columns: [{ key: 'sales', label: '销量', type: 'number' }], table_rows: [{ row_id: 'r1', sales: 42 }] }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
29
62
|
export interface AiTableData {
|
|
30
63
|
/** 列定义,按数组顺序渲染表头和单元格。 */
|
|
31
64
|
table_columns: AiTableColumn[];
|
|
@@ -34,8 +67,23 @@ export interface AiTableData {
|
|
|
34
67
|
}
|
|
35
68
|
/**
|
|
36
69
|
* 表格变更来源,用于上层做埋点或按动作类型分流保存策略。
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import type { AiTableEditorChangeAction } from '@h-ai/ui'
|
|
74
|
+
* const example: AiTableEditorChangeAction = 'cell-update'
|
|
75
|
+
* ```
|
|
37
76
|
*/
|
|
38
77
|
export type AiTableEditorChangeAction = 'replace' | 'cell-update' | 'row-add' | 'row-delete' | 'row-reorder';
|
|
78
|
+
/**
|
|
79
|
+
* 表格修改后的完整快照及动作定位信息;宿主据此保存,而不是依赖内部草稿。
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import type { AiTableEditorChangePayload } from '@h-ai/ui'
|
|
84
|
+
* const example: AiTableEditorChangePayload = { action: 'cell-update', rowId: 'r1', columnKey: 'sales', value: '43', nextData: { table_columns: [{ key: 'sales', label: '销量', type: 'number' }], table_rows: [{ row_id: 'r1', sales: 43 }] } }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
39
87
|
export interface AiTableEditorChangePayload {
|
|
40
88
|
/** 本次变更动作类型。 */
|
|
41
89
|
action: AiTableEditorChangeAction;
|
|
@@ -54,12 +102,30 @@ export interface AiTableEditorChangePayload {
|
|
|
54
102
|
/** 行重排后的索引;仅 `row-reorder` 时存在。 */
|
|
55
103
|
toIndex?: number;
|
|
56
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* 表格复制回调,包含当前数据和可交给剪贴板的纯文本。
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import type { AiTableCopyPayload } from '@h-ai/ui'
|
|
111
|
+
* const example: AiTableCopyPayload = { data: { table_columns: [{ key: 'sales', label: '销量', type: 'number' }], table_rows: [{ row_id: 'r1', sales: 42 }] }, text: '销量\n42' }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
57
114
|
export interface AiTableCopyPayload {
|
|
58
115
|
/** 当前复制时的结构化表格数据。 */
|
|
59
116
|
data: AiTableData;
|
|
60
117
|
/** 复制到剪贴板的文本内容(TSV)。 */
|
|
61
118
|
text: string;
|
|
62
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* 表格下载回调,包含当前数据、CSV 正文和建议文件名。
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import type { AiTableDownloadPayload } from '@h-ai/ui'
|
|
126
|
+
* const example: AiTableDownloadPayload = { data: { table_columns: [{ key: 'sales', label: '销量', type: 'number' }], table_rows: [{ row_id: 'r1', sales: 42 }] }, csv: '销量\n42', filename: 'sales.csv' }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
63
129
|
export interface AiTableDownloadPayload {
|
|
64
130
|
/** 当前下载时的结构化表格数据。 */
|
|
65
131
|
data: AiTableData;
|
|
@@ -68,6 +134,19 @@ export interface AiTableDownloadPayload {
|
|
|
68
134
|
/** 推荐文件名(已带 `.csv` 后缀)。 */
|
|
69
135
|
filename: string;
|
|
70
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* AI 表格编辑器的输入快照、展示状态和宿主保存/复制/下载回调。
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```svelte
|
|
142
|
+
* <script lang="ts">
|
|
143
|
+
* import { AiTableEditor } from '@h-ai/ui'
|
|
144
|
+
* import type { AiTableEditorProps } from '@h-ai/ui'
|
|
145
|
+
* const props: AiTableEditorProps = { title: '销量', tableData: { table_columns: [{ key: 'sales', label: '销量', type: 'number' }], table_rows: [{ row_id: 'r1', sales: 42 }] } }
|
|
146
|
+
* </script>
|
|
147
|
+
* <AiTableEditor {...props} />
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
71
150
|
export interface AiTableEditorProps extends DataAttributes {
|
|
72
151
|
/** 原始表格内容字符串,通常是 JSON 文本,支持流式残缺片段。 */
|
|
73
152
|
content?: string;
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
@prop {function} onsubmit - 提交反馈的回调
|
|
7
7
|
|
|
8
8
|
@example
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
```ts
|
|
10
|
+
import { mount, unmount } from 'svelte'
|
|
11
|
+
import type { ComponentProps } from 'svelte'
|
|
12
|
+
import { FeedbackModal } from '@h-ai/ui'
|
|
13
|
+
const props: ComponentProps<typeof FeedbackModal> = { open: true, labels: { title: '提交反馈' } }
|
|
14
|
+
const component = mount(FeedbackModal, { target: document.body, props })
|
|
15
|
+
await unmount(component)
|
|
16
|
+
```
|
|
13
17
|
-->
|
|
14
18
|
<script lang='ts'>
|
|
15
19
|
import FormField from '../../compounds/FormField.svelte'
|
|
@@ -20,15 +24,38 @@
|
|
|
20
24
|
import Select from '../../primitives/Select.svelte'
|
|
21
25
|
import Textarea from '../../primitives/Textarea.svelte'
|
|
22
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 反馈表单可选的问题类别。
|
|
29
|
+
*
|
|
30
|
+
* @example 模块内部上下文
|
|
31
|
+
* ```ts
|
|
32
|
+
* const example: FeedbackType = 'bug'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
23
35
|
type FeedbackType = 'bug' | 'feature' | 'question' | 'other'
|
|
24
36
|
|
|
37
|
+
/**
|
|
38
|
+
* 反馈表单提交值;描述和联系方式由宿主验证并保存。
|
|
39
|
+
*
|
|
40
|
+
* @example 模块内部上下文
|
|
41
|
+
* ```ts
|
|
42
|
+
* const example: FeedbackData = { type: 'bug', description: '保存后列表没有刷新', contact: 'ada@example.com' }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
25
45
|
interface FeedbackData {
|
|
26
46
|
type: FeedbackType
|
|
27
47
|
description: string
|
|
28
48
|
contact?: string
|
|
29
49
|
}
|
|
30
50
|
|
|
31
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* i18n 文案配置
|
|
53
|
+
*
|
|
54
|
+
* @example 模块内部上下文
|
|
55
|
+
* ```ts
|
|
56
|
+
* const example: FeedbackLabels = { title: '提交反馈', contentLabel: '问题描述' }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
32
59
|
interface FeedbackLabels {
|
|
33
60
|
title?: string
|
|
34
61
|
description?: string
|
|
@@ -53,6 +80,19 @@
|
|
|
53
80
|
import { uiM } from '../../../messages.js'
|
|
54
81
|
import { getDataAttributes } from '../../../utils.js'
|
|
55
82
|
|
|
83
|
+
/**
|
|
84
|
+
* FeedbackModal 组件的属性契约;通过公开组件配置使用。
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { mount, unmount } from 'svelte'
|
|
89
|
+
* import type { ComponentProps } from 'svelte'
|
|
90
|
+
* import { FeedbackModal } from '@h-ai/ui'
|
|
91
|
+
* const props: ComponentProps<typeof FeedbackModal> = { open: true, labels: { title: '提交反馈' } }
|
|
92
|
+
* const component = mount(FeedbackModal, { target: document.body, props })
|
|
93
|
+
* await unmount(component)
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
56
96
|
interface Props extends FormLayoutOptions {
|
|
57
97
|
open?: boolean
|
|
58
98
|
labels?: FeedbackLabels
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import type { DataAttributes, FormLayoutOptions } from '../../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 反馈表单可选的问题类别。
|
|
4
|
+
*
|
|
5
|
+
* @example 模块内部上下文
|
|
6
|
+
* ```ts
|
|
7
|
+
* const example: FeedbackType = 'bug'
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
type FeedbackType = 'bug' | 'feature' | 'question' | 'other';
|
|
11
|
+
/**
|
|
12
|
+
* 反馈表单提交值;描述和联系方式由宿主验证并保存。
|
|
13
|
+
*
|
|
14
|
+
* @example 模块内部上下文
|
|
15
|
+
* ```ts
|
|
16
|
+
* const example: FeedbackData = { type: 'bug', description: '保存后列表没有刷新', contact: 'ada@example.com' }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
3
19
|
interface FeedbackData {
|
|
4
20
|
type: FeedbackType;
|
|
5
21
|
description: string;
|
|
6
22
|
contact?: string;
|
|
7
23
|
}
|
|
8
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* i18n 文案配置
|
|
26
|
+
*
|
|
27
|
+
* @example 模块内部上下文
|
|
28
|
+
* ```ts
|
|
29
|
+
* const example: FeedbackLabels = { title: '提交反馈', contentLabel: '问题描述' }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
9
32
|
interface FeedbackLabels {
|
|
10
33
|
title?: string;
|
|
11
34
|
description?: string;
|
|
@@ -25,6 +48,19 @@ interface FeedbackLabels {
|
|
|
25
48
|
other?: string;
|
|
26
49
|
};
|
|
27
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* FeedbackModal 组件的属性契约;通过公开组件配置使用。
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { mount, unmount } from 'svelte'
|
|
57
|
+
* import type { ComponentProps } from 'svelte'
|
|
58
|
+
* import { FeedbackModal } from '@h-ai/ui'
|
|
59
|
+
* const props: ComponentProps<typeof FeedbackModal> = { open: true, labels: { title: '提交反馈' } }
|
|
60
|
+
* const component = mount(FeedbackModal, { target: document.body, props })
|
|
61
|
+
* await unmount(component)
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
28
64
|
interface Props extends FormLayoutOptions {
|
|
29
65
|
open?: boolean;
|
|
30
66
|
labels?: FeedbackLabels;
|
|
@@ -40,10 +76,14 @@ type $$ComponentProps = Props & DataAttributes;
|
|
|
40
76
|
* @prop {function} onsubmit - 提交反馈的回调
|
|
41
77
|
*
|
|
42
78
|
* @example
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { mount, unmount } from 'svelte'
|
|
81
|
+
* import type { ComponentProps } from 'svelte'
|
|
82
|
+
* import { FeedbackModal } from '@h-ai/ui'
|
|
83
|
+
* const props: ComponentProps<typeof FeedbackModal> = { open: true, labels: { title: '提交反馈' } }
|
|
84
|
+
* const component = mount(FeedbackModal, { target: document.body, props })
|
|
85
|
+
* await unmount(component)
|
|
86
|
+
* ```
|
|
47
87
|
*/
|
|
48
88
|
declare const FeedbackModal: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
49
89
|
type FeedbackModal = ReturnType<typeof FeedbackModal>;
|
|
@@ -7,25 +7,13 @@
|
|
|
7
7
|
@prop {function} onchange - 语言变更回调,传入选中的语言代码
|
|
8
8
|
|
|
9
9
|
@example
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<LanguageSwitch
|
|
19
|
-
currentLanguage={localeStore.current}
|
|
20
|
-
languages={[
|
|
21
|
-
{ value: 'zh-CN', label: '简体中文' },
|
|
22
|
-
{ value: 'en-US', label: 'English' }
|
|
23
|
-
]}
|
|
24
|
-
onchange={(lang) => {
|
|
25
|
-
localeStore.set(lang) // 同步到 @h-ai/core 全局 locale
|
|
26
|
-
setLocale(lang) // 同步到 Paraglide
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
10
|
+
```ts
|
|
11
|
+
import { mount, unmount } from 'svelte'
|
|
12
|
+
import type { ComponentProps } from 'svelte'
|
|
13
|
+
import { LanguageSwitch } from '@h-ai/ui'
|
|
14
|
+
const props: ComponentProps<typeof LanguageSwitch> = { currentLanguage: 'zh-CN', languages: [{ value: 'zh-CN', label: '中文' }, { value: 'en-US', label: 'English' }] }
|
|
15
|
+
const component = mount(LanguageSwitch, { target: document.body, props })
|
|
16
|
+
await unmount(component)
|
|
29
17
|
```
|
|
30
18
|
-->
|
|
31
19
|
<script lang='ts'>
|
|
@@ -34,12 +22,33 @@
|
|
|
34
22
|
import { getDataAttributes } from '../../../utils.js'
|
|
35
23
|
import BareButton from '../../primitives/BareButton.svelte'
|
|
36
24
|
|
|
25
|
+
/**
|
|
26
|
+
* 语言选择器候选项;value 使用应用实际支持的 locale 代码。
|
|
27
|
+
*
|
|
28
|
+
* @example 模块内部上下文
|
|
29
|
+
* ```ts
|
|
30
|
+
* const example: Language = { value: 'zh-CN', label: '中文' }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
37
33
|
interface Language {
|
|
38
34
|
value: string
|
|
39
35
|
label: string
|
|
40
36
|
flag?: string
|
|
41
37
|
}
|
|
42
38
|
|
|
39
|
+
/**
|
|
40
|
+
* LanguageSwitch 组件的属性契约;通过公开组件配置使用。
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { mount, unmount } from 'svelte'
|
|
45
|
+
* import type { ComponentProps } from 'svelte'
|
|
46
|
+
* import { LanguageSwitch } from '@h-ai/ui'
|
|
47
|
+
* const props: ComponentProps<typeof LanguageSwitch> = { currentLanguage: 'zh-CN', languages: [{ value: 'zh-CN', label: '中文' }, { value: 'en-US', label: 'English' }] }
|
|
48
|
+
* const component = mount(LanguageSwitch, { target: document.body, props })
|
|
49
|
+
* await unmount(component)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
43
52
|
interface Props {
|
|
44
53
|
/** 当前语言代码(BCP 47 格式) */
|
|
45
54
|
currentLanguage?: string
|
|
@@ -60,6 +69,7 @@
|
|
|
60
69
|
languages = [
|
|
61
70
|
{ value: 'zh-CN', label: '简体中文', flag: 'CN' },
|
|
62
71
|
{ value: 'en-US', label: 'English', flag: 'US' },
|
|
72
|
+
{ value: 'ja-JP', label: '日本語', flag: 'JP' },
|
|
63
73
|
],
|
|
64
74
|
onchange,
|
|
65
75
|
align = 'end',
|
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import type { DataAttributes } from '../../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 语言选择器候选项;value 使用应用实际支持的 locale 代码。
|
|
4
|
+
*
|
|
5
|
+
* @example 模块内部上下文
|
|
6
|
+
* ```ts
|
|
7
|
+
* const example: Language = { value: 'zh-CN', label: '中文' }
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
interface Language {
|
|
3
11
|
value: string;
|
|
4
12
|
label: string;
|
|
5
13
|
flag?: string;
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* LanguageSwitch 组件的属性契约;通过公开组件配置使用。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { mount, unmount } from 'svelte'
|
|
21
|
+
* import type { ComponentProps } from 'svelte'
|
|
22
|
+
* import { LanguageSwitch } from '@h-ai/ui'
|
|
23
|
+
* const props: ComponentProps<typeof LanguageSwitch> = { currentLanguage: 'zh-CN', languages: [{ value: 'zh-CN', label: '中文' }, { value: 'en-US', label: 'English' }] }
|
|
24
|
+
* const component = mount(LanguageSwitch, { target: document.body, props })
|
|
25
|
+
* await unmount(component)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
7
28
|
interface Props {
|
|
8
29
|
/** 当前语言代码(BCP 47 格式) */
|
|
9
30
|
currentLanguage?: string;
|
|
@@ -28,25 +49,13 @@ type $$ComponentProps = Props & DataAttributes;
|
|
|
28
49
|
* @prop {function} onchange - 语言变更回调,传入选中的语言代码
|
|
29
50
|
*
|
|
30
51
|
* @example
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* <LanguageSwitch
|
|
40
|
-
* currentLanguage={localeStore.current}
|
|
41
|
-
* languages={[
|
|
42
|
-
* { value: 'zh-CN', label: '简体中文' },
|
|
43
|
-
* { value: 'en-US', label: 'English' }
|
|
44
|
-
* ]}
|
|
45
|
-
* onchange={(lang) => {
|
|
46
|
-
* localeStore.set(lang) // 同步到 @h-ai/core 全局 locale
|
|
47
|
-
* setLocale(lang) // 同步到 Paraglide
|
|
48
|
-
* }}
|
|
49
|
-
* />
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { mount, unmount } from 'svelte'
|
|
54
|
+
* import type { ComponentProps } from 'svelte'
|
|
55
|
+
* import { LanguageSwitch } from '@h-ai/ui'
|
|
56
|
+
* const props: ComponentProps<typeof LanguageSwitch> = { currentLanguage: 'zh-CN', languages: [{ value: 'zh-CN', label: '中文' }, { value: 'en-US', label: 'English' }] }
|
|
57
|
+
* const component = mount(LanguageSwitch, { target: document.body, props })
|
|
58
|
+
* await unmount(component)
|
|
50
59
|
* ```
|
|
51
60
|
*/
|
|
52
61
|
declare const LanguageSwitch: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
使用 Svelte 5 Runes ($props, $derived)
|
|
9
9
|
|
|
10
10
|
@example
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</SettingsLayout>
|
|
11
|
+
```ts
|
|
12
|
+
import { mount, unmount, createRawSnippet } from 'svelte'
|
|
13
|
+
import type { ComponentProps } from 'svelte'
|
|
14
|
+
import { SettingsLayout } from '@h-ai/ui'
|
|
15
|
+
const props: ComponentProps<typeof SettingsLayout> = { title: '设置', sections: [{ id: 'profile', label: '资料', href: '/settings/profile' }], active: 'profile', children: createRawSnippet(() => ({ render: () => "<p>个人资料设置</p>" })) }
|
|
16
|
+
const component = mount(SettingsLayout, { target: document.body, props })
|
|
17
|
+
await unmount(component)
|
|
18
|
+
```
|
|
20
19
|
-->
|
|
21
20
|
<script lang='ts'>
|
|
22
21
|
import type { Snippet } from 'svelte'
|
|
@@ -24,6 +23,19 @@
|
|
|
24
23
|
import { cn, getDataAttributes } from '../../../utils.js'
|
|
25
24
|
import BareButton from '../../primitives/BareButton.svelte'
|
|
26
25
|
|
|
26
|
+
/**
|
|
27
|
+
* 设置页分区导航项;href 直接渲染链接,否则由宿主处理选中事件。
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { mount, unmount, createRawSnippet } from 'svelte'
|
|
32
|
+
* import type { ComponentProps } from 'svelte'
|
|
33
|
+
* import { SettingsLayout } from '@h-ai/ui'
|
|
34
|
+
* const props: ComponentProps<typeof SettingsLayout> = { title: '设置', sections: [{ id: 'profile', label: '资料', href: '/settings/profile' }], active: 'profile', children: createRawSnippet(() => ({ render: () => "<p>个人资料设置</p>" })) }
|
|
35
|
+
* const component = mount(SettingsLayout, { target: document.body, props })
|
|
36
|
+
* await unmount(component)
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
27
39
|
type SettingsSection = {
|
|
28
40
|
id: string
|
|
29
41
|
label: string
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { DataAttributes } from '../../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 设置页分区导航项;href 直接渲染链接,否则由宿主处理选中事件。
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { mount, unmount, createRawSnippet } from 'svelte'
|
|
9
|
+
* import type { ComponentProps } from 'svelte'
|
|
10
|
+
* import { SettingsLayout } from '@h-ai/ui'
|
|
11
|
+
* const props: ComponentProps<typeof SettingsLayout> = { title: '设置', sections: [{ id: 'profile', label: '资料', href: '/settings/profile' }], active: 'profile', children: createRawSnippet(() => ({ render: () => "<p>个人资料设置</p>" })) }
|
|
12
|
+
* const component = mount(SettingsLayout, { target: document.body, props })
|
|
13
|
+
* await unmount(component)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
3
16
|
type SettingsSection = {
|
|
4
17
|
id: string;
|
|
5
18
|
label: string;
|
|
@@ -27,15 +40,14 @@ type $$ComponentProps = {
|
|
|
27
40
|
* 使用 Svelte 5 Runes ($props, $derived)
|
|
28
41
|
*
|
|
29
42
|
* @example
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* </SettingsLayout>
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { mount, unmount, createRawSnippet } from 'svelte'
|
|
45
|
+
* import type { ComponentProps } from 'svelte'
|
|
46
|
+
* import { SettingsLayout } from '@h-ai/ui'
|
|
47
|
+
* const props: ComponentProps<typeof SettingsLayout> = { title: '设置', sections: [{ id: 'profile', label: '资料', href: '/settings/profile' }], active: 'profile', children: createRawSnippet(() => ({ render: () => "<p>个人资料设置</p>" })) }
|
|
48
|
+
* const component = mount(SettingsLayout, { target: document.body, props })
|
|
49
|
+
* await unmount(component)
|
|
50
|
+
* ```
|
|
39
51
|
*/
|
|
40
52
|
declare const SettingsLayout: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
41
53
|
type SettingsLayout = ReturnType<typeof SettingsLayout>;
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
@prop {string} currentTheme - 当前主题
|
|
9
9
|
@prop {function} onlanguagechange - 语言变更回调
|
|
10
10
|
@prop {function} onthemechange - 主题变更回调
|
|
11
|
+
|
|
12
|
+
@example
|
|
13
|
+
```ts
|
|
14
|
+
import { mount, unmount } from 'svelte'
|
|
15
|
+
import type { ComponentProps } from 'svelte'
|
|
16
|
+
import { SettingsModal } from '@h-ai/ui'
|
|
17
|
+
const props: ComponentProps<typeof SettingsModal> = { open: true, currentLanguage: 'zh-CN', currentTheme: 'light' }
|
|
18
|
+
const component = mount(SettingsModal, { target: document.body, props })
|
|
19
|
+
await unmount(component)
|
|
20
|
+
```
|
|
11
21
|
-->
|
|
12
22
|
<script lang='ts'>
|
|
13
23
|
import type { DataAttributes } from '../../../types.js'
|
|
@@ -16,6 +26,19 @@
|
|
|
16
26
|
import BareButton from '../../primitives/BareButton.svelte'
|
|
17
27
|
import IconButton from '../../primitives/IconButton.svelte'
|
|
18
28
|
|
|
29
|
+
/**
|
|
30
|
+
* SettingsModal 组件的属性契约;通过公开组件配置使用。
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { mount, unmount } from 'svelte'
|
|
35
|
+
* import type { ComponentProps } from 'svelte'
|
|
36
|
+
* import { SettingsModal } from '@h-ai/ui'
|
|
37
|
+
* const props: ComponentProps<typeof SettingsModal> = { open: true, currentLanguage: 'zh-CN', currentTheme: 'light' }
|
|
38
|
+
* const component = mount(SettingsModal, { target: document.body, props })
|
|
39
|
+
* await unmount(component)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
19
42
|
interface Props {
|
|
20
43
|
open?: boolean
|
|
21
44
|
currentLanguage?: string
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { DataAttributes } from '../../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* SettingsModal 组件的属性契约;通过公开组件配置使用。
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { mount, unmount } from 'svelte'
|
|
8
|
+
* import type { ComponentProps } from 'svelte'
|
|
9
|
+
* import { SettingsModal } from '@h-ai/ui'
|
|
10
|
+
* const props: ComponentProps<typeof SettingsModal> = { open: true, currentLanguage: 'zh-CN', currentTheme: 'light' }
|
|
11
|
+
* const component = mount(SettingsModal, { target: document.body, props })
|
|
12
|
+
* await unmount(component)
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
2
15
|
interface Props {
|
|
3
16
|
open?: boolean;
|
|
4
17
|
currentLanguage?: string;
|
|
@@ -28,6 +41,16 @@ type $$ComponentProps = Props & DataAttributes;
|
|
|
28
41
|
* @prop {string} currentTheme - 当前主题
|
|
29
42
|
* @prop {function} onlanguagechange - 语言变更回调
|
|
30
43
|
* @prop {function} onthemechange - 主题变更回调
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { mount, unmount } from 'svelte'
|
|
48
|
+
* import type { ComponentProps } from 'svelte'
|
|
49
|
+
* import { SettingsModal } from '@h-ai/ui'
|
|
50
|
+
* const props: ComponentProps<typeof SettingsModal> = { open: true, currentLanguage: 'zh-CN', currentTheme: 'light' }
|
|
51
|
+
* const component = mount(SettingsModal, { target: document.body, props })
|
|
52
|
+
* await unmount(component)
|
|
53
|
+
* ```
|
|
31
54
|
*/
|
|
32
55
|
declare const SettingsModal: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
33
56
|
type SettingsModal = ReturnType<typeof SettingsModal>;
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
@prop {string} value - 当前选中的颜色值(Hex)
|
|
6
6
|
@prop {Array<{ value: string, label: string }>} presets - 预置主题色列表
|
|
7
7
|
@prop {function} onchange - 颜色变更回调
|
|
8
|
+
|
|
9
|
+
@example
|
|
10
|
+
```ts
|
|
11
|
+
import { mount, unmount } from 'svelte'
|
|
12
|
+
import type { ComponentProps } from 'svelte'
|
|
13
|
+
import { ThemeColorPicker } from '@h-ai/ui'
|
|
14
|
+
const props: ComponentProps<typeof ThemeColorPicker> = { value: '#2563eb', presets: [{ value: '#2563eb', label: '蓝色' }] }
|
|
15
|
+
const component = mount(ThemeColorPicker, { target: document.body, props })
|
|
16
|
+
await unmount(component)
|
|
17
|
+
```
|
|
8
18
|
-->
|
|
9
19
|
<script lang='ts'>
|
|
10
20
|
import type { DataAttributes } from '../../../types.js'
|
|
@@ -15,11 +25,32 @@
|
|
|
15
25
|
const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/
|
|
16
26
|
const SHORT_HEX_COLOR_REGEX = /^#[0-9a-f]{3}$/
|
|
17
27
|
|
|
28
|
+
/**
|
|
29
|
+
* 主题色选择器的显示名称与 Hex 值。
|
|
30
|
+
*
|
|
31
|
+
* @example 模块内部上下文
|
|
32
|
+
* ```ts
|
|
33
|
+
* const example: ThemeColorPreset = { value: '#2563eb', label: '蓝色' }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
18
36
|
interface ThemeColorPreset {
|
|
19
37
|
value: string
|
|
20
38
|
label: string
|
|
21
39
|
}
|
|
22
40
|
|
|
41
|
+
/**
|
|
42
|
+
* ThemeColorPicker 组件的属性契约;通过公开组件配置使用。
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { mount, unmount } from 'svelte'
|
|
47
|
+
* import type { ComponentProps } from 'svelte'
|
|
48
|
+
* import { ThemeColorPicker } from '@h-ai/ui'
|
|
49
|
+
* const props: ComponentProps<typeof ThemeColorPicker> = { value: '#2563eb', presets: [{ value: '#2563eb', label: '蓝色' }] }
|
|
50
|
+
* const component = mount(ThemeColorPicker, { target: document.body, props })
|
|
51
|
+
* await unmount(component)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
23
54
|
interface Props {
|
|
24
55
|
value?: string
|
|
25
56
|
presets?: ThemeColorPreset[]
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import type { DataAttributes } from '../../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 主题色选择器的显示名称与 Hex 值。
|
|
4
|
+
*
|
|
5
|
+
* @example 模块内部上下文
|
|
6
|
+
* ```ts
|
|
7
|
+
* const example: ThemeColorPreset = { value: '#2563eb', label: '蓝色' }
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
interface ThemeColorPreset {
|
|
3
11
|
value: string;
|
|
4
12
|
label: string;
|
|
5
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* ThemeColorPicker 组件的属性契约;通过公开组件配置使用。
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { mount, unmount } from 'svelte'
|
|
20
|
+
* import type { ComponentProps } from 'svelte'
|
|
21
|
+
* import { ThemeColorPicker } from '@h-ai/ui'
|
|
22
|
+
* const props: ComponentProps<typeof ThemeColorPicker> = { value: '#2563eb', presets: [{ value: '#2563eb', label: '蓝色' }] }
|
|
23
|
+
* const component = mount(ThemeColorPicker, { target: document.body, props })
|
|
24
|
+
* await unmount(component)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
6
27
|
interface Props {
|
|
7
28
|
value?: string;
|
|
8
29
|
presets?: ThemeColorPreset[];
|
|
@@ -20,6 +41,16 @@ type $$ComponentProps = Props & DataAttributes;
|
|
|
20
41
|
* @prop {string} value - 当前选中的颜色值(Hex)
|
|
21
42
|
* @prop {Array<{ value: string, label: string }>} presets - 预置主题色列表
|
|
22
43
|
* @prop {function} onchange - 颜色变更回调
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { mount, unmount } from 'svelte'
|
|
48
|
+
* import type { ComponentProps } from 'svelte'
|
|
49
|
+
* import { ThemeColorPicker } from '@h-ai/ui'
|
|
50
|
+
* const props: ComponentProps<typeof ThemeColorPicker> = { value: '#2563eb', presets: [{ value: '#2563eb', label: '蓝色' }] }
|
|
51
|
+
* const component = mount(ThemeColorPicker, { target: document.body, props })
|
|
52
|
+
* await unmount(component)
|
|
53
|
+
* ```
|
|
23
54
|
*/
|
|
24
55
|
declare const ThemeColorPicker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
25
56
|
type ThemeColorPicker = ReturnType<typeof ThemeColorPicker>;
|