@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
|
@@ -9,6 +9,16 @@ import type { Snippet } from 'svelte';
|
|
|
9
9
|
import type { DataAttributes, FormLayoutOptions, FormText, InputProps, Size } from '../../types.js';
|
|
10
10
|
/**
|
|
11
11
|
* 密码输入框属性
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```svelte
|
|
15
|
+
* <script lang="ts">
|
|
16
|
+
* import { PasswordInput } from '@h-ai/ui'
|
|
17
|
+
* import type { PasswordInputProps } from '@h-ai/ui'
|
|
18
|
+
* const props: PasswordInputProps = { value: '', autocomplete: 'new-password', showStrength: true, minLength: 12 }
|
|
19
|
+
* </script>
|
|
20
|
+
* <PasswordInput {...props} />
|
|
21
|
+
* ```
|
|
12
22
|
*/
|
|
13
23
|
export interface PasswordInputProps extends DataAttributes {
|
|
14
24
|
/** 元素 ID */
|
|
@@ -48,6 +58,12 @@ export interface PasswordInputProps extends DataAttributes {
|
|
|
48
58
|
}
|
|
49
59
|
/**
|
|
50
60
|
* 协议展示配置
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import type { AgreementDisplay } from '@h-ai/ui'
|
|
65
|
+
* const example: AgreementDisplay = { userAgreementUrl: '/terms', privacyPolicyUrl: '/privacy' }
|
|
66
|
+
* ```
|
|
51
67
|
*/
|
|
52
68
|
export interface AgreementDisplay {
|
|
53
69
|
/** 用户协议 Markdown 正文;配置时优先于 URL。 */
|
|
@@ -61,6 +77,12 @@ export interface AgreementDisplay {
|
|
|
61
77
|
}
|
|
62
78
|
/**
|
|
63
79
|
* 登录表单数据
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import type { LoginFormData } from '@h-ai/ui'
|
|
84
|
+
* const example: LoginFormData = { username: 'ada', password: 'Example-pass-42!', method: 'password' }
|
|
85
|
+
* ```
|
|
64
86
|
*/
|
|
65
87
|
export interface LoginFormData {
|
|
66
88
|
/** 当前登录方式;省略时使用密码。 */
|
|
@@ -69,10 +91,19 @@ export interface LoginFormData {
|
|
|
69
91
|
code?: string;
|
|
70
92
|
username: string;
|
|
71
93
|
password: string;
|
|
72
|
-
rememberMe: boolean;
|
|
73
94
|
}
|
|
74
95
|
/**
|
|
75
96
|
* 登录表单属性
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```svelte
|
|
100
|
+
* <script lang="ts">
|
|
101
|
+
* import { LoginForm } from '@h-ai/ui'
|
|
102
|
+
* import type { LoginFormProps } from '@h-ai/ui'
|
|
103
|
+
* const props: LoginFormProps = { methods: ['password'] }
|
|
104
|
+
* </script>
|
|
105
|
+
* <LoginForm {...props} />
|
|
106
|
+
* ```
|
|
76
107
|
*/
|
|
77
108
|
export interface LoginFormProps extends FormLayoutOptions, DataAttributes {
|
|
78
109
|
/** 实际可用的方式;空数组表示无可用登录方式。 */
|
|
@@ -89,8 +120,6 @@ export interface LoginFormProps extends FormLayoutOptions, DataAttributes {
|
|
|
89
120
|
disabled?: boolean;
|
|
90
121
|
/** 是否显示标题 */
|
|
91
122
|
showTitle?: boolean;
|
|
92
|
-
/** 是否显示记住我 */
|
|
93
|
-
showRememberMe?: boolean;
|
|
94
123
|
/** 是否显示忘记密码 */
|
|
95
124
|
showForgotPassword?: boolean;
|
|
96
125
|
/** 忘记密码链接 */
|
|
@@ -120,10 +149,22 @@ export interface LoginFormProps extends FormLayoutOptions, DataAttributes {
|
|
|
120
149
|
}
|
|
121
150
|
/**
|
|
122
151
|
* 注册表单字段
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* import type { RegisterField } from '@h-ai/ui'
|
|
156
|
+
* const example: RegisterField = 'email'
|
|
157
|
+
* ```
|
|
123
158
|
*/
|
|
124
159
|
export type RegisterField = 'username' | 'email' | 'phone' | 'password' | 'confirmPassword' | 'nickname';
|
|
125
160
|
/**
|
|
126
161
|
* 注册表单数据
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* import type { RegisterFormData } from '@h-ai/ui'
|
|
166
|
+
* const example: RegisterFormData = { username: 'ada', email: 'ada@example.com', password: 'Example-pass-42!', confirmPassword: 'Example-pass-42!' }
|
|
167
|
+
* ```
|
|
127
168
|
*/
|
|
128
169
|
export interface RegisterFormData {
|
|
129
170
|
username?: string;
|
|
@@ -135,6 +176,16 @@ export interface RegisterFormData {
|
|
|
135
176
|
}
|
|
136
177
|
/**
|
|
137
178
|
* 注册表单属性
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```svelte
|
|
182
|
+
* <script lang="ts">
|
|
183
|
+
* import { RegisterForm } from '@h-ai/ui'
|
|
184
|
+
* import type { RegisterFormProps } from '@h-ai/ui'
|
|
185
|
+
* const props: RegisterFormProps = { fields: ['username', 'password'], requireConfirmPassword: true }
|
|
186
|
+
* </script>
|
|
187
|
+
* <RegisterForm {...props} />
|
|
188
|
+
* ```
|
|
138
189
|
*/
|
|
139
190
|
export interface RegisterFormProps extends FormLayoutOptions, DataAttributes {
|
|
140
191
|
passwordPolicy?: PasswordPolicy;
|
|
@@ -175,6 +226,12 @@ export interface RegisterFormProps extends FormLayoutOptions, DataAttributes {
|
|
|
175
226
|
}
|
|
176
227
|
/**
|
|
177
228
|
* 修改密码表单数据
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```ts
|
|
232
|
+
* import type { ChangePasswordFormData } from '@h-ai/ui'
|
|
233
|
+
* const example: ChangePasswordFormData = { oldPassword: 'Old-example-42!', newPassword: 'New-example-42!', confirmPassword: 'New-example-42!' }
|
|
234
|
+
* ```
|
|
178
235
|
*/
|
|
179
236
|
export interface ChangePasswordFormData {
|
|
180
237
|
oldPassword?: string;
|
|
@@ -183,6 +240,16 @@ export interface ChangePasswordFormData {
|
|
|
183
240
|
}
|
|
184
241
|
/**
|
|
185
242
|
* 修改密码表单属性
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```svelte
|
|
246
|
+
* <script lang="ts">
|
|
247
|
+
* import { ChangePasswordForm } from '@h-ai/ui'
|
|
248
|
+
* import type { ChangePasswordFormProps } from '@h-ai/ui'
|
|
249
|
+
* const props: ChangePasswordFormProps = { requireOldPassword: true, minPasswordLength: 12 }
|
|
250
|
+
* </script>
|
|
251
|
+
* <ChangePasswordForm {...props} />
|
|
252
|
+
* ```
|
|
186
253
|
*/
|
|
187
254
|
export interface ChangePasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
188
255
|
passwordPolicy?: PasswordPolicy;
|
|
@@ -207,6 +274,12 @@ export interface ChangePasswordFormProps extends FormLayoutOptions, DataAttribut
|
|
|
207
274
|
}
|
|
208
275
|
/**
|
|
209
276
|
* 找回密码表单数据
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import type { ForgotPasswordFormData } from '@h-ai/ui'
|
|
281
|
+
* const example: ForgotPasswordFormData = { email: 'ada@example.com' }
|
|
282
|
+
* ```
|
|
210
283
|
*/
|
|
211
284
|
export interface ForgotPasswordFormData {
|
|
212
285
|
email?: string;
|
|
@@ -214,6 +287,16 @@ export interface ForgotPasswordFormData {
|
|
|
214
287
|
}
|
|
215
288
|
/**
|
|
216
289
|
* 找回密码表单属性
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```svelte
|
|
293
|
+
* <script lang="ts">
|
|
294
|
+
* import { ForgotPasswordForm } from '@h-ai/ui'
|
|
295
|
+
* import type { ForgotPasswordFormProps } from '@h-ai/ui'
|
|
296
|
+
* const props: ForgotPasswordFormProps = { mode: 'email' }
|
|
297
|
+
* </script>
|
|
298
|
+
* <ForgotPasswordForm {...props} />
|
|
299
|
+
* ```
|
|
217
300
|
*/
|
|
218
301
|
export interface ForgotPasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
219
302
|
/** 加载状态 */
|
|
@@ -245,6 +328,12 @@ export interface ForgotPasswordFormProps extends FormLayoutOptions, DataAttribut
|
|
|
245
328
|
}
|
|
246
329
|
/**
|
|
247
330
|
* 重置密码表单数据
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* import type { ResetPasswordFormData } from '@h-ai/ui'
|
|
335
|
+
* const example: ResetPasswordFormData = { code: '123456', newPassword: 'New-example-42!', confirmPassword: 'New-example-42!' }
|
|
336
|
+
* ```
|
|
248
337
|
*/
|
|
249
338
|
export interface ResetPasswordFormData {
|
|
250
339
|
code?: string;
|
|
@@ -253,6 +342,16 @@ export interface ResetPasswordFormData {
|
|
|
253
342
|
}
|
|
254
343
|
/**
|
|
255
344
|
* 重置密码表单属性
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```svelte
|
|
348
|
+
* <script lang="ts">
|
|
349
|
+
* import { ResetPasswordForm } from '@h-ai/ui'
|
|
350
|
+
* import type { ResetPasswordFormProps } from '@h-ai/ui'
|
|
351
|
+
* const props: ResetPasswordFormProps = { showCode: true, minPasswordLength: 12 }
|
|
352
|
+
* </script>
|
|
353
|
+
* <ResetPasswordForm {...props} />
|
|
354
|
+
* ```
|
|
256
355
|
*/
|
|
257
356
|
export interface ResetPasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
258
357
|
passwordPolicy?: PasswordPolicy;
|
|
@@ -283,9 +382,25 @@ export interface ResetPasswordFormProps extends FormLayoutOptions, DataAttribute
|
|
|
283
382
|
/** 提交事件 */
|
|
284
383
|
onsubmit?: (data: ResetPasswordFormData) => void | Promise<void>;
|
|
285
384
|
}
|
|
286
|
-
/**
|
|
385
|
+
/**
|
|
386
|
+
* 认证页面直接消费 IAM 白名单配置,无需依赖服务端 IAM 包。
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* import type { AuthLoginMethod } from '@h-ai/ui'
|
|
391
|
+
* const example: AuthLoginMethod = 'password'
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
287
394
|
export type AuthLoginMethod = 'password' | 'ldap' | 'email' | 'sms';
|
|
288
|
-
/**
|
|
395
|
+
/**
|
|
396
|
+
* 与 IAM 公开密码策略一致;前端提示不能代替服务端校验。
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* import type { PasswordPolicy } from '@h-ai/ui'
|
|
401
|
+
* const example: PasswordPolicy = { minLength: 12, maxLength: 128, requireUppercase: true, requireLowercase: true, requireNumber: true, requireSpecialChar: true }
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
289
404
|
export interface PasswordPolicy {
|
|
290
405
|
minLength: number;
|
|
291
406
|
maxLength: number;
|
|
@@ -294,7 +409,27 @@ export interface PasswordPolicy {
|
|
|
294
409
|
requireNumber: boolean;
|
|
295
410
|
requireSpecialChar: boolean;
|
|
296
411
|
}
|
|
297
|
-
/**
|
|
412
|
+
/**
|
|
413
|
+
* 仅消费安全公开配置,不能将 iam.config 或连接密钥传入浏览器。
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
418
|
+
* import type { AuthPanelConfig } from '@h-ai/ui'
|
|
419
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
420
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
421
|
+
* try {
|
|
422
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
423
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
424
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
425
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
426
|
+
* const example: AuthPanelConfig = result.data
|
|
427
|
+
* }
|
|
428
|
+
* finally {
|
|
429
|
+
* await apiClient.close()
|
|
430
|
+
* }
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
298
433
|
export interface AuthPanelConfig {
|
|
299
434
|
/** 只有已启用且具备运行时依赖的方式才应为 true。 */
|
|
300
435
|
login: {
|
|
@@ -331,7 +466,27 @@ export interface AuthPanelConfig {
|
|
|
331
466
|
illustrationUrl?: string;
|
|
332
467
|
};
|
|
333
468
|
}
|
|
334
|
-
/**
|
|
469
|
+
/**
|
|
470
|
+
* 认证动作可由框架工厂直接创建,也可包装以处理应用自己的扩展数据。
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
475
|
+
* import type { AuthPanelActions } from '@h-ai/ui'
|
|
476
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
477
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
478
|
+
* try {
|
|
479
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
480
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
481
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
482
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
483
|
+
* const example: AuthPanelActions = actions
|
|
484
|
+
* }
|
|
485
|
+
* finally {
|
|
486
|
+
* await apiClient.close()
|
|
487
|
+
* }
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
335
490
|
export interface AuthPanelActions {
|
|
336
491
|
/** password/ldap 使用 password,email/sms 使用 code;成功后由工厂保存凭证。 */
|
|
337
492
|
login: (input: {
|
|
@@ -352,9 +507,37 @@ export interface AuthPanelActions {
|
|
|
352
507
|
requestPasswordReset: (identifier: string) => Promise<HaiResult<unknown>>;
|
|
353
508
|
confirmPasswordReset: (token: string, newPassword: string) => Promise<HaiResult<unknown>>;
|
|
354
509
|
}
|
|
355
|
-
/**
|
|
510
|
+
/**
|
|
511
|
+
* AuthPanel 的初始页面;未传独立路由时由组件内部导航。
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* import type { AuthPanelMode } from '@h-ai/ui'
|
|
516
|
+
* const example: AuthPanelMode = 'login'
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
356
519
|
export type AuthPanelMode = 'login' | 'register' | 'forgot' | 'reset';
|
|
357
|
-
/**
|
|
520
|
+
/**
|
|
521
|
+
* 配置驱动认证场景;网络、通知和令牌存储由应用注入 actions。
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* ```ts
|
|
525
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
526
|
+
* import type { AuthPanelProps } from '@h-ai/ui'
|
|
527
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
528
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
529
|
+
* try {
|
|
530
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
531
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
532
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
533
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
534
|
+
* const example: AuthPanelProps = { config: result.data, actions, initialMode: 'login' }
|
|
535
|
+
* }
|
|
536
|
+
* finally {
|
|
537
|
+
* await apiClient.close()
|
|
538
|
+
* }
|
|
539
|
+
* ```
|
|
540
|
+
*/
|
|
358
541
|
export interface AuthPanelProps extends FormLayoutOptions, DataAttributes {
|
|
359
542
|
/** 未取得配置时显示加载状态,只消费 IAM 的公开配置。 */
|
|
360
543
|
config: AuthPanelConfig | null;
|
|
@@ -382,10 +565,22 @@ export interface AuthPanelProps extends FormLayoutOptions, DataAttributes {
|
|
|
382
565
|
}
|
|
383
566
|
/**
|
|
384
567
|
* 用户个人信息字段
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* import type { UserProfileField } from '@h-ai/ui'
|
|
572
|
+
* const example: UserProfileField = 'email'
|
|
573
|
+
* ```
|
|
385
574
|
*/
|
|
386
575
|
export type UserProfileField = 'avatar' | 'username' | 'email' | 'displayName' | 'nickname' | 'phone' | 'bio';
|
|
387
576
|
/**
|
|
388
577
|
* 用户信息
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```ts
|
|
581
|
+
* import type { UserProfileData } from '@h-ai/ui'
|
|
582
|
+
* const example: UserProfileData = { id: 'u1', username: 'ada', email: 'ada@example.com' }
|
|
583
|
+
* ```
|
|
389
584
|
*/
|
|
390
585
|
export interface UserProfileData {
|
|
391
586
|
id?: string;
|
|
@@ -398,6 +593,15 @@ export interface UserProfileData {
|
|
|
398
593
|
avatarUrl?: string;
|
|
399
594
|
bio?: string;
|
|
400
595
|
}
|
|
596
|
+
/**
|
|
597
|
+
* 个人资料表单的标准提交值;验证和保存由宿主负责。
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```ts
|
|
601
|
+
* import type { UserProfileSubmitData } from '@h-ai/ui'
|
|
602
|
+
* const example: UserProfileSubmitData = { username: 'ada', email: 'ada@example.com', displayName: 'Ada', phone: '', bio: 'Developer' }
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
401
605
|
export interface UserProfileSubmitData {
|
|
402
606
|
username: string;
|
|
403
607
|
email: string;
|
|
@@ -407,6 +611,16 @@ export interface UserProfileSubmitData {
|
|
|
407
611
|
}
|
|
408
612
|
/**
|
|
409
613
|
* 用户个人信息属性
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```svelte
|
|
617
|
+
* <script lang="ts">
|
|
618
|
+
* import { UserProfile } from '@h-ai/ui'
|
|
619
|
+
* import type { UserProfileProps } from '@h-ai/ui'
|
|
620
|
+
* const props: UserProfileProps = { user: { id: 'u1', username: 'ada', email: 'ada@example.com' }, fields: ['username', 'email'], editable: true }
|
|
621
|
+
* </script>
|
|
622
|
+
* <UserProfile {...props} />
|
|
623
|
+
* ```
|
|
410
624
|
*/
|
|
411
625
|
export interface UserProfileProps extends FormLayoutOptions, DataAttributes {
|
|
412
626
|
/** 用户信息 */
|
|
@@ -437,10 +651,22 @@ export interface UserProfileProps extends FormLayoutOptions, DataAttributes {
|
|
|
437
651
|
}
|
|
438
652
|
/**
|
|
439
653
|
* 上传状态
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```ts
|
|
657
|
+
* import type { UploadState } from '@h-ai/ui'
|
|
658
|
+
* const example: UploadState = 'uploading'
|
|
659
|
+
* ```
|
|
440
660
|
*/
|
|
441
661
|
export type UploadState = 'pending' | 'uploading' | 'success' | 'error';
|
|
442
662
|
/**
|
|
443
663
|
* 上传文件信息
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```ts
|
|
667
|
+
* import type { UploadFile } from '@h-ai/ui'
|
|
668
|
+
* const example: UploadFile = { id: 'upload-1', file: new File(['report'], 'report.txt', { type: 'text/plain' }), name: 'report.txt', size: 6, type: 'text/plain', state: 'pending', progress: 0 }
|
|
669
|
+
* ```
|
|
444
670
|
*/
|
|
445
671
|
export interface UploadFile {
|
|
446
672
|
/** 唯一 ID */
|
|
@@ -462,14 +688,30 @@ export interface UploadFile {
|
|
|
462
688
|
/** 上传响应 */
|
|
463
689
|
response?: unknown;
|
|
464
690
|
}
|
|
465
|
-
/**
|
|
691
|
+
/**
|
|
692
|
+
* 上传处理器上下文
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```ts
|
|
696
|
+
* import type { UploadHandlerContext } from '@h-ai/ui'
|
|
697
|
+
* const example: UploadHandlerContext = { signal: new AbortController().signal, onProgress: progress => document.body.setAttribute('data-upload-progress', String(progress)) }
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
466
700
|
export interface UploadHandlerContext {
|
|
467
701
|
/** 组件销毁、文件移除或重试时触发的取消信号 */
|
|
468
702
|
signal: AbortSignal;
|
|
469
703
|
/** 汇报 0-100 的上传进度 */
|
|
470
704
|
onProgress: (progress: number) => void;
|
|
471
705
|
}
|
|
472
|
-
/**
|
|
706
|
+
/**
|
|
707
|
+
* 上传处理结果
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```ts
|
|
711
|
+
* import type { UploadHandlerResult } from '@h-ai/ui'
|
|
712
|
+
* const example: UploadHandlerResult = { url: '/files/report.pdf', response: { key: 'reports/report.pdf' } }
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
473
715
|
export interface UploadHandlerResult {
|
|
474
716
|
/** 可展示的最终文件 URL(图片/头像上传必须返回) */
|
|
475
717
|
url?: string;
|
|
@@ -480,10 +722,33 @@ export interface UploadHandlerResult {
|
|
|
480
722
|
* 应用层上传处理器。
|
|
481
723
|
*
|
|
482
724
|
* UI 组件只管理选择、校验、进度和预览;签名 URL、认证头与上传协议由应用服务层实现。
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```ts
|
|
728
|
+
* import type { UploadHandler } from '@h-ai/ui'
|
|
729
|
+
* const upload: UploadHandler = async (file, { signal, onProgress }) => {
|
|
730
|
+
* const response = await fetch('/api/uploads', { method: 'POST', body: file, signal })
|
|
731
|
+
* if (!response.ok) throw new Error('Upload failed')
|
|
732
|
+
* const result: unknown = await response.json()
|
|
733
|
+
* if (!result || typeof result !== 'object' || !('url' in result) || typeof result.url !== 'string') throw new Error('Upload response invalid')
|
|
734
|
+
* onProgress(100)
|
|
735
|
+
* return { url: result.url }
|
|
736
|
+
* }
|
|
737
|
+
* ```
|
|
483
738
|
*/
|
|
484
739
|
export type UploadHandler = (file: File, context: UploadHandlerContext) => Promise<UploadHandlerResult>;
|
|
485
740
|
/**
|
|
486
741
|
* 文件上传属性
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* ```svelte
|
|
745
|
+
* <script lang="ts">
|
|
746
|
+
* import { FileUpload } from '@h-ai/ui'
|
|
747
|
+
* import type { FileUploadProps } from '@h-ai/ui'
|
|
748
|
+
* const props: FileUploadProps = { accept: '.pdf', maxFiles: 3, autoUpload: false }
|
|
749
|
+
* </script>
|
|
750
|
+
* <FileUpload {...props} />
|
|
751
|
+
* ```
|
|
487
752
|
*/
|
|
488
753
|
export interface FileUploadProps extends DataAttributes {
|
|
489
754
|
/** 接受的文件类型 */
|
|
@@ -517,6 +782,12 @@ export interface FileUploadProps extends DataAttributes {
|
|
|
517
782
|
}
|
|
518
783
|
/**
|
|
519
784
|
* 文件项
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```ts
|
|
788
|
+
* import type { FileItem } from '@h-ai/ui'
|
|
789
|
+
* const example: FileItem = { id: 'file-1', name: 'report.pdf', size: 1024, type: 'application/pdf', url: '/files/report.pdf' }
|
|
790
|
+
* ```
|
|
520
791
|
*/
|
|
521
792
|
export interface FileItem {
|
|
522
793
|
/** 唯一 ID */
|
|
@@ -536,6 +807,16 @@ export interface FileItem {
|
|
|
536
807
|
}
|
|
537
808
|
/**
|
|
538
809
|
* 文件列表属性
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
* ```svelte
|
|
813
|
+
* <script lang="ts">
|
|
814
|
+
* import { FileList } from '@h-ai/ui'
|
|
815
|
+
* import type { FileListProps } from '@h-ai/ui'
|
|
816
|
+
* const props: FileListProps = { files: [{ id: 'f1', name: 'report.pdf', size: 1024, type: 'application/pdf' }], showSize: true }
|
|
817
|
+
* </script>
|
|
818
|
+
* <FileList {...props} />
|
|
819
|
+
* ```
|
|
539
820
|
*/
|
|
540
821
|
export interface FileListProps extends DataAttributes {
|
|
541
822
|
/** 文件列表 */
|
|
@@ -565,6 +846,16 @@ export interface FileListProps extends DataAttributes {
|
|
|
565
846
|
}
|
|
566
847
|
/**
|
|
567
848
|
* 图片上传属性
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* ```svelte
|
|
852
|
+
* <script lang="ts">
|
|
853
|
+
* import { ImageUpload } from '@h-ai/ui'
|
|
854
|
+
* import type { ImageUploadProps } from '@h-ai/ui'
|
|
855
|
+
* const props: ImageUploadProps = { accept: 'image/png,image/jpeg', maxSize: 5 * 1024 * 1024 }
|
|
856
|
+
* </script>
|
|
857
|
+
* <ImageUpload {...props} />
|
|
858
|
+
* ```
|
|
568
859
|
*/
|
|
569
860
|
export interface ImageUploadProps extends DataAttributes {
|
|
570
861
|
/** 图片 URL */
|
|
@@ -594,6 +885,16 @@ export interface ImageUploadProps extends DataAttributes {
|
|
|
594
885
|
}
|
|
595
886
|
/**
|
|
596
887
|
* 头像上传属性
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```svelte
|
|
891
|
+
* <script lang="ts">
|
|
892
|
+
* import { AvatarUpload } from '@h-ai/ui'
|
|
893
|
+
* import type { AvatarUploadProps } from '@h-ai/ui'
|
|
894
|
+
* const props: AvatarUploadProps = { fallback: 'A', size: 'lg' }
|
|
895
|
+
* </script>
|
|
896
|
+
* <AvatarUpload {...props} />
|
|
897
|
+
* ```
|
|
597
898
|
*/
|
|
598
899
|
export interface AvatarUploadProps extends DataAttributes {
|
|
599
900
|
/** 头像 URL */
|
|
@@ -619,6 +920,16 @@ export interface AvatarUploadProps extends DataAttributes {
|
|
|
619
920
|
}
|
|
620
921
|
/**
|
|
621
922
|
* 加密输入框属性
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```svelte
|
|
926
|
+
* <script lang="ts">
|
|
927
|
+
* import { EncryptedInput } from '@h-ai/ui'
|
|
928
|
+
* import type { EncryptedInputProps } from '@h-ai/ui'
|
|
929
|
+
* const props: EncryptedInputProps = { value: '', algorithm: 'SM2', showEncrypted: false }
|
|
930
|
+
* </script>
|
|
931
|
+
* <EncryptedInput {...props} />
|
|
932
|
+
* ```
|
|
622
933
|
*/
|
|
623
934
|
export interface EncryptedInputProps extends DataAttributes {
|
|
624
935
|
/** 原始值 */
|
|
@@ -652,6 +963,16 @@ export interface EncryptedInputProps extends DataAttributes {
|
|
|
652
963
|
}
|
|
653
964
|
/**
|
|
654
965
|
* 哈希展示属性
|
|
966
|
+
*
|
|
967
|
+
* @example
|
|
968
|
+
* ```svelte
|
|
969
|
+
* <script lang="ts">
|
|
970
|
+
* import { HashDisplay } from '@h-ai/ui'
|
|
971
|
+
* import type { HashDisplayProps } from '@h-ai/ui'
|
|
972
|
+
* const props: HashDisplayProps = { value: 'example-digest', algorithm: 'SM3', copyable: true }
|
|
973
|
+
* </script>
|
|
974
|
+
* <HashDisplay {...props} />
|
|
975
|
+
* ```
|
|
655
976
|
*/
|
|
656
977
|
export interface HashDisplayProps extends DataAttributes {
|
|
657
978
|
/** 哈希值 */
|
|
@@ -675,6 +996,16 @@ export interface HashDisplayProps extends DataAttributes {
|
|
|
675
996
|
}
|
|
676
997
|
/**
|
|
677
998
|
* Markdown 渲染器属性
|
|
999
|
+
*
|
|
1000
|
+
* @example
|
|
1001
|
+
* ```svelte
|
|
1002
|
+
* <script lang="ts">
|
|
1003
|
+
* import { MarkdownRenderer } from '@h-ai/ui'
|
|
1004
|
+
* import type { MarkdownRendererProps } from '@h-ai/ui'
|
|
1005
|
+
* const props: MarkdownRendererProps = { content: '# 标题\n正文', allowHtmlTags: false }
|
|
1006
|
+
* </script>
|
|
1007
|
+
* <MarkdownRenderer {...props} />
|
|
1008
|
+
* ```
|
|
678
1009
|
*/
|
|
679
1010
|
export interface MarkdownRendererProps extends DataAttributes {
|
|
680
1011
|
/** Markdown 源文本 */
|
|
@@ -694,6 +1025,16 @@ export interface MarkdownRendererProps extends DataAttributes {
|
|
|
694
1025
|
}
|
|
695
1026
|
/**
|
|
696
1027
|
* 签名展示属性
|
|
1028
|
+
*
|
|
1029
|
+
* @example
|
|
1030
|
+
* ```svelte
|
|
1031
|
+
* <script lang="ts">
|
|
1032
|
+
* import { SignatureDisplay } from '@h-ai/ui'
|
|
1033
|
+
* import type { SignatureDisplayProps } from '@h-ai/ui'
|
|
1034
|
+
* const props: SignatureDisplayProps = { signature: 'example-signature', verified: false, showPublicKey: false }
|
|
1035
|
+
* </script>
|
|
1036
|
+
* <SignatureDisplay {...props} />
|
|
1037
|
+
* ```
|
|
697
1038
|
*/
|
|
698
1039
|
export interface SignatureDisplayProps extends DataAttributes {
|
|
699
1040
|
/** 签名值 */
|
package/dist/guide-storage.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { GuideOptions, GuideProgress } from './guide-types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 存储受限时使用会话内存;只保存非敏感的引导偏好。
|
|
4
|
+
* @param options - 本次操作的行为与显示选项。
|
|
5
|
+
* @returns 可读取、写入、清除非敏感导览进度的适配器。
|
|
6
|
+
*
|
|
7
|
+
* @example 模块内部上下文
|
|
8
|
+
* ```ts
|
|
9
|
+
* const storage = createGuideStorage({ tours: [], persistence: 'memory' })
|
|
10
|
+
* storage.set('intro', { version: 1, status: 'completed', updatedAt: Date.now() })
|
|
11
|
+
* const progress = storage.get('intro')
|
|
12
|
+
* storage.set('intro', null)
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
3
15
|
export declare function createGuideStorage(options: GuideOptions): {
|
|
4
16
|
get(key: string): GuideProgress | null;
|
|
5
17
|
set(key: string, progress: GuideProgress | null): void;
|
package/dist/guide-storage.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { readStoredValue, writeStoredValue } from './internal/browser-safety.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 存储受限时使用会话内存;只保存非敏感的引导偏好。
|
|
4
|
+
* @param options - 本次操作的行为与显示选项。
|
|
5
|
+
* @returns 可读取、写入、清除非敏感导览进度的适配器。
|
|
6
|
+
*
|
|
7
|
+
* @example 模块内部上下文
|
|
8
|
+
* ```ts
|
|
9
|
+
* const storage = createGuideStorage({ tours: [], persistence: 'memory' })
|
|
10
|
+
* storage.set('intro', { version: 1, status: 'completed', updatedAt: Date.now() })
|
|
11
|
+
* const progress = storage.get('intro')
|
|
12
|
+
* storage.set('intro', null)
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
3
15
|
export function createGuideStorage(options) {
|
|
4
16
|
const memory = new Map();
|
|
5
17
|
const persistence = options.persistence ?? 'cookie';
|