@h-ai/ui 0.1.0-alpha8 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1036 -0
- package/README.ja.md +1036 -0
- package/README.md +670 -119
- package/auto-import.d.ts +45 -0
- package/auto-import.js +46 -69
- package/dist/components/compounds/Accordion.svelte +30 -3
- package/dist/components/compounds/Accordion.svelte.d.ts +37 -1
- package/dist/components/compounds/ActionSheet.svelte +35 -8
- package/dist/components/compounds/ActionSheet.svelte.d.ts +41 -1
- package/dist/components/compounds/Alert.svelte +24 -15
- package/dist/components/compounds/Alert.svelte.d.ts +14 -3
- package/dist/components/compounds/AppBar.svelte +37 -9
- package/dist/components/compounds/AppBar.svelte.d.ts +36 -1
- package/dist/components/compounds/BottomNav.svelte +68 -8
- package/dist/components/compounds/BottomNav.svelte.d.ts +51 -1
- package/dist/components/compounds/Breadcrumb.svelte +18 -5
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +23 -2
- package/dist/components/compounds/Calendar.svelte +31 -12
- package/dist/components/compounds/Calendar.svelte.d.ts +23 -7
- package/dist/components/compounds/Card.svelte +17 -5
- package/dist/components/compounds/Card.svelte.d.ts +13 -2
- package/dist/components/compounds/Combobox.svelte +124 -42
- package/dist/components/compounds/Combobox.svelte.d.ts +42 -20
- package/dist/components/compounds/Confirm.svelte +32 -9
- package/dist/components/compounds/Confirm.svelte.d.ts +24 -2
- package/dist/components/compounds/DataTable.svelte +317 -33
- package/dist/components/compounds/DataTable.svelte.d.ts +28 -14
- package/dist/components/compounds/DatePicker.svelte +62 -18
- package/dist/components/compounds/DatePicker.svelte.d.ts +27 -8
- package/dist/components/compounds/Drawer.svelte +179 -22
- package/dist/components/compounds/Drawer.svelte.d.ts +24 -2
- package/dist/components/compounds/Dropdown.svelte +19 -5
- package/dist/components/compounds/Dropdown.svelte.d.ts +13 -2
- package/dist/components/compounds/Empty.svelte +22 -9
- package/dist/components/compounds/Empty.svelte.d.ts +23 -2
- package/dist/components/compounds/FilterBar.svelte +82 -0
- package/dist/components/compounds/FilterBar.svelte.d.ts +39 -0
- package/dist/components/compounds/Form.svelte +59 -16
- package/dist/components/compounds/Form.svelte.d.ts +23 -2
- package/dist/components/compounds/FormField.svelte +99 -16
- package/dist/components/compounds/FormField.svelte.d.ts +23 -2
- package/dist/components/compounds/FormLayout.svelte +71 -0
- package/dist/components/compounds/FormLayout.svelte.d.ts +17 -0
- package/dist/components/compounds/InfiniteScroll.svelte +34 -7
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +37 -1
- package/dist/components/compounds/JsonViewer.svelte +214 -0
- package/dist/components/compounds/JsonViewer.svelte.d.ts +26 -0
- package/dist/components/compounds/MessageBoxContainer.svelte +34 -0
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +25 -0
- package/dist/components/compounds/MessageBoxDialog.svelte +209 -0
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +29 -0
- package/dist/components/compounds/MessageContainer.svelte +24 -0
- package/dist/components/compounds/MessageContainer.svelte.d.ts +18 -0
- package/dist/components/compounds/Modal.svelte +348 -73
- package/dist/components/compounds/Modal.svelte.d.ts +13 -2
- package/dist/components/compounds/PageHeader.svelte +44 -20
- package/dist/components/compounds/PageHeader.svelte.d.ts +24 -9
- package/dist/components/compounds/Pagination.svelte +139 -105
- package/dist/components/compounds/Pagination.svelte.d.ts +23 -2
- package/dist/components/compounds/Popover.svelte +124 -25
- package/dist/components/compounds/Popover.svelte.d.ts +23 -2
- package/dist/components/compounds/PullRefresh.svelte +35 -8
- package/dist/components/compounds/PullRefresh.svelte.d.ts +35 -1
- package/dist/components/compounds/Result.svelte +17 -4
- package/dist/components/compounds/Result.svelte.d.ts +23 -2
- package/dist/components/compounds/SafeArea.svelte +30 -3
- package/dist/components/compounds/SafeArea.svelte.d.ts +35 -1
- package/dist/components/compounds/Skeleton.svelte +19 -7
- package/dist/components/compounds/Skeleton.svelte.d.ts +13 -2
- package/dist/components/compounds/Steps.svelte +17 -4
- package/dist/components/compounds/Steps.svelte.d.ts +23 -2
- package/dist/components/compounds/SwipeCell.svelte +30 -3
- package/dist/components/compounds/SwipeCell.svelte.d.ts +40 -1
- package/dist/components/compounds/TableToolbar.svelte +289 -0
- package/dist/components/compounds/TableToolbar.svelte.d.ts +69 -0
- package/dist/components/compounds/Tabs.svelte +84 -14
- package/dist/components/compounds/Tabs.svelte.d.ts +13 -2
- package/dist/components/compounds/TagInput.svelte +51 -33
- package/dist/components/compounds/TagInput.svelte.d.ts +23 -2
- package/dist/components/compounds/Timeline.svelte +30 -3
- package/dist/components/compounds/Timeline.svelte.d.ts +37 -1
- package/dist/components/compounds/ToastContainer.svelte +386 -28
- package/dist/components/compounds/ToastContainer.svelte.d.ts +27 -1
- package/dist/components/compounds/Tooltip.svelte +143 -9
- package/dist/components/compounds/Tooltip.svelte.d.ts +25 -2
- 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/index.d.ts +7 -0
- package/dist/components/compounds/index.js +11 -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 +35 -0
- package/dist/components/control-size.js +26 -0
- package/dist/components/primitives/Avatar.svelte +19 -5
- package/dist/components/primitives/Avatar.svelte.d.ts +13 -2
- package/dist/components/primitives/Badge.svelte +16 -4
- package/dist/components/primitives/Badge.svelte.d.ts +13 -2
- package/dist/components/primitives/BareButton.svelte +26 -12
- package/dist/components/primitives/BareButton.svelte.d.ts +23 -2
- package/dist/components/primitives/BareInput.svelte +57 -35
- package/dist/components/primitives/BareInput.svelte.d.ts +23 -2
- package/dist/components/primitives/Button.svelte +30 -9
- package/dist/components/primitives/Button.svelte.d.ts +13 -2
- package/dist/components/primitives/Checkbox.svelte +24 -5
- package/dist/components/primitives/Checkbox.svelte.d.ts +23 -2
- package/dist/components/primitives/IconButton.svelte +35 -10
- package/dist/components/primitives/IconButton.svelte.d.ts +23 -2
- package/dist/components/primitives/Input.svelte +56 -26
- package/dist/components/primitives/Input.svelte.d.ts +13 -2
- package/dist/components/primitives/Progress.svelte +17 -4
- package/dist/components/primitives/Progress.svelte.d.ts +23 -2
- package/dist/components/primitives/Radio.svelte +17 -4
- package/dist/components/primitives/Radio.svelte.d.ts +22 -2
- package/dist/components/primitives/Range.svelte +31 -4
- package/dist/components/primitives/Range.svelte.d.ts +37 -1
- package/dist/components/primitives/Rating.svelte +32 -5
- package/dist/components/primitives/Rating.svelte.d.ts +37 -1
- package/dist/components/primitives/Select.svelte +404 -47
- package/dist/components/primitives/Select.svelte.d.ts +23 -2
- package/dist/components/primitives/Spinner.svelte +17 -4
- package/dist/components/primitives/Spinner.svelte.d.ts +23 -2
- package/dist/components/primitives/Switch.svelte +22 -4
- package/dist/components/primitives/Switch.svelte.d.ts +23 -2
- package/dist/components/primitives/Tag.svelte +17 -4
- package/dist/components/primitives/Tag.svelte.d.ts +23 -2
- package/dist/components/primitives/Textarea.svelte +75 -30
- package/dist/components/primitives/Textarea.svelte.d.ts +24 -2
- package/dist/components/primitives/ToggleCheckbox.svelte +24 -10
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +23 -2
- package/dist/components/primitives/ToggleInput.svelte +24 -10
- package/dist/components/primitives/ToggleInput.svelte.d.ts +23 -2
- package/dist/components/primitives/ToggleRadio.svelte +24 -10
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +23 -2
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +54 -23
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +30 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +3428 -693
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +26 -1
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +119 -116
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +31 -1
- package/dist/components/scenes/ai/code-preview.d.ts +46 -0
- package/dist/components/scenes/ai/code-preview.js +141 -0
- package/dist/components/scenes/ai/document-download.d.ts +52 -0
- package/dist/components/scenes/ai/document-download.js +296 -77
- package/dist/components/scenes/ai/document-parse.d.ts +101 -11
- package/dist/components/scenes/ai/document-parse.js +212 -48
- package/dist/components/scenes/ai/document-types.d.ts +292 -75
- package/dist/components/scenes/ai/editor-markdown-extensions.d.ts +27 -0
- package/dist/components/scenes/ai/editor-markdown-extensions.js +215 -0
- package/dist/components/scenes/ai/highlight.d.ts +37 -0
- package/dist/components/scenes/ai/highlight.js +162 -0
- package/dist/components/scenes/ai/index.d.ts +5 -2
- package/dist/components/scenes/ai/index.js +3 -0
- package/dist/components/scenes/ai/markdown-parse.d.ts +11 -3
- package/dist/components/scenes/ai/markdown-parse.js +42 -31
- package/dist/components/scenes/ai/mermaid-host-sync.d.ts +72 -0
- package/dist/components/scenes/ai/mermaid-host-sync.js +65 -0
- package/dist/components/scenes/ai/mermaid-render.d.ts +30 -0
- package/dist/components/scenes/ai/mermaid-render.js +61 -0
- package/dist/components/scenes/ai/safe-html.d.ts +64 -0
- package/dist/components/scenes/ai/safe-html.js +345 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +1692 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +32 -0
- package/dist/components/scenes/ai/table/table-types.d.ts +181 -0
- package/dist/components/scenes/ai/table/table-types.js +1 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte +236 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte.d.ts +40 -0
- package/dist/components/scenes/app/FeedbackForm.svelte +337 -0
- package/dist/components/scenes/app/FeedbackForm.svelte.d.ts +72 -0
- package/dist/components/scenes/app/FeedbackList.svelte +150 -0
- package/dist/components/scenes/app/FeedbackList.svelte.d.ts +28 -0
- package/dist/components/scenes/app/FeedbackModal.svelte +65 -139
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +14 -39
- package/dist/components/scenes/app/FeedbackRecorder.svelte +154 -0
- package/dist/components/scenes/app/FeedbackRecorder.svelte.d.ts +9 -0
- package/dist/components/scenes/app/FeedbackReplay.svelte +142 -0
- package/dist/components/scenes/app/FeedbackReplay.svelte.d.ts +7 -0
- package/dist/components/scenes/app/FeedbackScreenshot.svelte +120 -0
- package/dist/components/scenes/app/FeedbackScreenshot.svelte.d.ts +8 -0
- package/dist/components/scenes/app/LanguageSwitch.svelte +38 -21
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +33 -20
- package/dist/components/scenes/app/SettingsLayout.svelte +115 -0
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +54 -0
- package/dist/components/scenes/app/SettingsModal.svelte +33 -7
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +27 -1
- package/dist/components/scenes/app/ThemeColorPicker.svelte +240 -0
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +57 -0
- package/dist/components/scenes/app/ThemeSelector.svelte +87 -26
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +26 -7
- package/dist/components/scenes/app/ThemeToggle.svelte +27 -6
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +24 -5
- package/dist/components/scenes/app/WorkspaceLayout.svelte +64 -0
- package/dist/components/scenes/app/WorkspaceLayout.svelte.d.ts +36 -0
- package/dist/components/scenes/app/feedback-functions.d.ts +57 -0
- package/dist/components/scenes/app/feedback-functions.js +107 -0
- package/dist/components/scenes/app/feedback-types.d.ts +224 -0
- package/dist/components/scenes/app/feedback-types.js +1 -0
- package/dist/components/scenes/app/index.d.ts +8 -1
- package/dist/components/scenes/app/index.js +7 -1
- package/dist/components/scenes/charts/Chart.svelte +163 -0
- package/dist/components/scenes/charts/Chart.svelte.d.ts +25 -0
- package/dist/components/scenes/charts/chart-theme.d.ts +47 -0
- package/dist/components/scenes/charts/chart-theme.js +68 -0
- package/dist/components/scenes/charts/chart-types.d.ts +153 -0
- package/dist/components/scenes/charts/chart-types.js +7 -0
- package/dist/components/scenes/charts/index.d.ts +8 -0
- package/dist/components/scenes/charts/index.js +7 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte +624 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +32 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte.d.ts +5 -0
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +29 -11
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +13 -1
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +77 -22
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +19 -4
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +242 -0
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +66 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte +365 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +48 -0
- package/dist/components/scenes/crud/CrudFilterBar.svelte +17 -85
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +13 -25
- package/dist/components/scenes/crud/CrudPage.svelte +564 -185
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +137 -51
- package/dist/components/scenes/crud/crud-controller.svelte.d.ts +335 -0
- package/dist/components/scenes/crud/crud-controller.svelte.js +276 -0
- package/dist/components/scenes/crud/crud-form-validation.d.ts +16 -0
- package/dist/components/scenes/crud/crud-form-validation.js +51 -0
- package/dist/components/scenes/crud/crud-types.d.ts +136 -43
- package/dist/components/scenes/crud/index.d.ts +9 -3
- package/dist/components/scenes/crud/index.js +8 -3
- package/dist/components/scenes/crud/nav-adapter.d.ts +50 -0
- package/dist/components/scenes/crud/nav-adapter.js +39 -0
- package/dist/components/scenes/crypto/EncryptedInput.svelte +63 -28
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +38 -3
- package/dist/components/scenes/crypto/HashDisplay.svelte +30 -22
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +24 -1
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +41 -40
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +24 -1
- package/dist/components/scenes/error/ErrorPage.svelte +135 -0
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +50 -0
- package/dist/components/scenes/error/error-presets.d.ts +60 -0
- package/dist/components/scenes/error/error-presets.js +51 -0
- package/dist/components/scenes/error/index.d.ts +8 -0
- package/dist/components/scenes/error/index.js +8 -0
- package/dist/components/scenes/guide/GuideHost.svelte +56 -0
- package/dist/components/scenes/guide/GuideHost.svelte.d.ts +35 -0
- package/dist/components/scenes/guide/GuideHostContent.svelte +136 -0
- package/dist/components/scenes/guide/GuideHostContent.svelte.d.ts +43 -0
- package/dist/components/scenes/guide/HelpCenter.svelte +135 -0
- package/dist/components/scenes/guide/HelpCenter.svelte.d.ts +40 -0
- package/dist/components/scenes/guide/index.d.ts +2 -0
- package/dist/components/scenes/guide/index.js +2 -0
- package/dist/components/scenes/iam/AgreementNotice.svelte +48 -0
- package/dist/components/scenes/iam/AgreementNotice.svelte.d.ts +7 -0
- package/dist/components/scenes/iam/AuthPanel.svelte +226 -0
- package/dist/components/scenes/iam/AuthPanel.svelte.d.ts +29 -0
- package/dist/components/scenes/iam/AuthShell.svelte +160 -0
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +56 -0
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +84 -63
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +113 -89
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +24 -1
- package/dist/components/scenes/iam/LoginForm.svelte +215 -117
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/PasswordInput.svelte +79 -32
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +30 -4
- 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/ReauthenticationDialog.svelte +68 -0
- package/dist/components/scenes/iam/ReauthenticationDialog.svelte.d.ts +17 -0
- package/dist/components/scenes/iam/RegisterForm.svelte +129 -116
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +101 -88
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/SensitiveOperationsForm.svelte +76 -0
- package/dist/components/scenes/iam/SensitiveOperationsForm.svelte.d.ts +21 -0
- package/dist/components/scenes/iam/SessionRecoveryDialog.svelte +64 -0
- package/dist/components/scenes/iam/SessionRecoveryDialog.svelte.d.ts +22 -0
- package/dist/components/scenes/iam/UserProfile.svelte +47 -21
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +24 -1
- package/dist/components/scenes/iam/auth-captcha.d.ts +21 -0
- package/dist/components/scenes/iam/auth-captcha.js +23 -0
- package/dist/components/scenes/iam/auth-error-message.d.ts +13 -0
- package/dist/components/scenes/iam/auth-error-message.js +65 -0
- package/dist/components/scenes/iam/index.d.ts +10 -0
- package/dist/components/scenes/iam/index.js +9 -1
- package/dist/components/scenes/iam/password-utils.d.ts +33 -6
- package/dist/components/scenes/iam/password-utils.js +61 -8
- 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/iam/sensitive-actions.svelte.d.ts +68 -0
- package/dist/components/scenes/iam/sensitive-actions.svelte.js +101 -0
- package/dist/components/scenes/iam/session-recovery.svelte.d.ts +44 -0
- package/dist/components/scenes/iam/session-recovery.svelte.js +57 -0
- package/dist/components/scenes/index.d.ts +3 -0
- package/dist/components/scenes/index.js +5 -0
- package/dist/components/scenes/storage/AvatarUpload.svelte +82 -68
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +23 -1
- package/dist/components/scenes/storage/FileList.svelte +19 -5
- package/dist/components/scenes/storage/FileList.svelte.d.ts +23 -1
- package/dist/components/scenes/storage/FileUpload.svelte +151 -96
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +24 -1
- package/dist/components/scenes/storage/ImageUpload.svelte +93 -94
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +24 -1
- package/dist/components/scenes/types.d.ts +574 -42
- package/dist/guide-storage.d.ts +18 -0
- package/dist/guide-storage.js +79 -0
- package/dist/guide-types.d.ts +143 -0
- package/dist/guide-types.js +1 -0
- package/dist/guide.d.ts +3 -0
- package/dist/guide.js +3 -0
- package/dist/guide.svelte.d.ts +29 -0
- package/dist/guide.svelte.js +506 -0
- package/dist/i18n.svelte.d.ts +67 -4
- package/dist/i18n.svelte.js +106 -21
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/internal/browser-safety.d.ts +88 -0
- package/dist/internal/browser-safety.js +140 -0
- package/dist/internal/dialog-focus.d.ts +21 -0
- package/dist/internal/dialog-focus.js +77 -0
- package/dist/internal/form-context.d.ts +92 -0
- package/dist/internal/form-context.js +70 -0
- package/dist/internal/form-validation.svelte.d.ts +70 -0
- package/dist/internal/form-validation.svelte.js +142 -0
- package/dist/internal/icon-safety.d.ts +14 -0
- package/dist/internal/icon-safety.js +40 -0
- package/dist/internal/locale.d.ts +21 -0
- package/dist/internal/locale.js +43 -0
- package/dist/message.svelte.d.ts +138 -0
- package/dist/message.svelte.js +149 -0
- package/dist/messagebox.svelte.d.ts +130 -0
- package/dist/messagebox.svelte.js +171 -0
- package/dist/messages/en-US.json +297 -16
- package/dist/messages/ja-JP.json +523 -0
- package/dist/messages/zh-CN.json +297 -16
- package/dist/messages.d.ts +25 -3
- package/dist/messages.js +23 -6
- package/dist/styles/design-tokens.css +4 -2
- package/dist/styles/formal.css +55 -0
- package/dist/styles/global.css +86 -18
- package/dist/styles/guide.css +88 -0
- package/dist/styles/high-contrast.css +64 -0
- package/dist/styles/mobile.css +28 -0
- package/dist/styles/theme.css +42 -0
- package/dist/theme-config.d.ts +263 -10
- package/dist/theme-config.js +252 -17
- package/dist/toast.svelte.d.ts +210 -2
- package/dist/toast.svelte.js +296 -19
- package/dist/types.d.ts +787 -63
- package/dist/utils/platform.svelte.d.ts +28 -15
- package/dist/utils/platform.svelte.js +23 -16
- package/dist/utils.d.ts +121 -1
- package/dist/utils.js +208 -13
- package/dist/workspace-context.d.ts +20 -0
- package/dist/workspace-context.js +9 -0
- package/package.json +120 -24
- package/vite.d.ts +13 -0
- package/vite.js +96 -0
- package/dist/components/scenes/crud/CrudEditDrawer.svelte +0 -225
- package/dist/components/scenes/crud/CrudEditDrawer.svelte.d.ts +0 -48
|
@@ -4,16 +4,30 @@
|
|
|
4
4
|
* 场景化组件的 Props 类型
|
|
5
5
|
* @module types
|
|
6
6
|
*/
|
|
7
|
+
import type { HaiResult } from '@h-ai/core';
|
|
8
|
+
import type { Challenge } from 'altcha/lib';
|
|
7
9
|
import type { Snippet } from 'svelte';
|
|
8
|
-
import type { Size } from '../../types.js';
|
|
10
|
+
import type { DataAttributes, FormLayoutOptions, FormText, InputProps, Size } from '../../types.js';
|
|
9
11
|
/**
|
|
10
12
|
* 密码输入框属性
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <script lang="ts">
|
|
17
|
+
* import { PasswordInput } from '@h-ai/ui'
|
|
18
|
+
* import type { PasswordInputProps } from '@h-ai/ui'
|
|
19
|
+
* const props: PasswordInputProps = { value: '', autocomplete: 'new-password', showStrength: true, minLength: 12 }
|
|
20
|
+
* </script>
|
|
21
|
+
* <PasswordInput {...props} />
|
|
22
|
+
* ```
|
|
11
23
|
*/
|
|
12
|
-
export interface PasswordInputProps {
|
|
24
|
+
export interface PasswordInputProps extends DataAttributes {
|
|
13
25
|
/** 元素 ID */
|
|
14
26
|
id?: string;
|
|
15
27
|
/** 值 */
|
|
16
28
|
value?: string;
|
|
29
|
+
/** autocomplete */
|
|
30
|
+
autocomplete?: string;
|
|
17
31
|
/** 占位符 */
|
|
18
32
|
placeholder?: string;
|
|
19
33
|
/** 尺寸 */
|
|
@@ -25,12 +39,12 @@ export interface PasswordInputProps {
|
|
|
25
39
|
/** 是否必填 */
|
|
26
40
|
required?: boolean;
|
|
27
41
|
/** 错误消息 */
|
|
28
|
-
error?:
|
|
42
|
+
error?: FormText;
|
|
29
43
|
/** 是否显示切换按钮 */
|
|
30
44
|
showToggle?: boolean;
|
|
31
45
|
/** 是否显示密码强度 */
|
|
32
46
|
showStrength?: boolean;
|
|
33
|
-
/**
|
|
47
|
+
/** 最小长度;提供时校验,省略时仅以 8 位为基准计算强度。 */
|
|
34
48
|
minLength?: number;
|
|
35
49
|
/** 自定义类名 */
|
|
36
50
|
class?: string;
|
|
@@ -45,8 +59,18 @@ export interface PasswordInputProps {
|
|
|
45
59
|
}
|
|
46
60
|
/**
|
|
47
61
|
* 协议展示配置
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import type { AgreementDisplay } from '@h-ai/ui'
|
|
66
|
+
* const example: AgreementDisplay = { userAgreementUrl: '/terms', privacyPolicyUrl: '/privacy' }
|
|
67
|
+
* ```
|
|
48
68
|
*/
|
|
49
69
|
export interface AgreementDisplay {
|
|
70
|
+
/** 用户协议 Markdown 正文;配置时优先于 URL。 */
|
|
71
|
+
userAgreementMarkdown?: string;
|
|
72
|
+
/** 隐私协议 Markdown 正文;由内置安全渲染器显示。 */
|
|
73
|
+
privacyPolicyMarkdown?: string;
|
|
50
74
|
/** 用户协议 URL */
|
|
51
75
|
userAgreementUrl?: string;
|
|
52
76
|
/** 隐私协议 URL */
|
|
@@ -54,24 +78,53 @@ export interface AgreementDisplay {
|
|
|
54
78
|
}
|
|
55
79
|
/**
|
|
56
80
|
* 登录表单数据
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* import type { LoginFormData } from '@h-ai/ui'
|
|
85
|
+
* const example: LoginFormData = { username: 'ada', password: 'Example-pass-42!', method: 'password' }
|
|
86
|
+
* ```
|
|
57
87
|
*/
|
|
58
88
|
export interface LoginFormData {
|
|
89
|
+
/** 当前登录方式;省略时使用密码。 */
|
|
90
|
+
method?: AuthLoginMethod;
|
|
91
|
+
/** 邮件/短信验证码 */
|
|
92
|
+
code?: string;
|
|
59
93
|
username: string;
|
|
60
94
|
password: string;
|
|
61
|
-
rememberMe: boolean;
|
|
62
95
|
}
|
|
63
96
|
/**
|
|
64
97
|
* 登录表单属性
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```svelte
|
|
101
|
+
* <script lang="ts">
|
|
102
|
+
* import { LoginForm } from '@h-ai/ui'
|
|
103
|
+
* import type { LoginFormProps } from '@h-ai/ui'
|
|
104
|
+
* const props: LoginFormProps = { methods: ['password'] }
|
|
105
|
+
* </script>
|
|
106
|
+
* <LoginForm {...props} />
|
|
107
|
+
* ```
|
|
65
108
|
*/
|
|
66
|
-
export interface LoginFormProps {
|
|
109
|
+
export interface LoginFormProps extends FormLayoutOptions, DataAttributes {
|
|
110
|
+
/** 默认在桌面首次就绪且页面尚无焦点时聚焦登录标识;触屏不主动弹出键盘。 */
|
|
111
|
+
autoFocus?: boolean;
|
|
112
|
+
/** 初始登录标识;原地恢复时预填原用户名,仍走正常鉴别。 */
|
|
113
|
+
initialIdentifier?: string;
|
|
114
|
+
/** 实际可用的方式;空数组表示无可用登录方式。 */
|
|
115
|
+
methods?: AuthLoginMethod[];
|
|
116
|
+
/** 验证码长度 */
|
|
117
|
+
otpLength?: number;
|
|
118
|
+
/** 重发间隔(秒) */
|
|
119
|
+
resendInterval?: number;
|
|
120
|
+
/** 发送验证码;失败信息在表单内显示。 */
|
|
121
|
+
onsendotp?: (identifier: string) => Promise<HaiResult<unknown>>;
|
|
67
122
|
/** 加载状态 */
|
|
68
123
|
loading?: boolean;
|
|
69
124
|
/** 禁用状态 */
|
|
70
125
|
disabled?: boolean;
|
|
71
126
|
/** 是否显示标题 */
|
|
72
127
|
showTitle?: boolean;
|
|
73
|
-
/** 是否显示记住我 */
|
|
74
|
-
showRememberMe?: boolean;
|
|
75
128
|
/** 是否显示忘记密码 */
|
|
76
129
|
showForgotPassword?: boolean;
|
|
77
130
|
/** 忘记密码链接 */
|
|
@@ -94,15 +147,29 @@ export interface LoginFormProps {
|
|
|
94
147
|
onforgotpassword?: () => void;
|
|
95
148
|
/** 头部插槽 */
|
|
96
149
|
header?: Snippet;
|
|
150
|
+
/** 内置字段后、提交按钮前的扩展内容;额外字段值由应用自行绑定与提交。 */
|
|
151
|
+
extraFields?: Snippet;
|
|
97
152
|
/** 底部插槽 */
|
|
98
153
|
footer?: Snippet;
|
|
99
154
|
}
|
|
100
155
|
/**
|
|
101
156
|
* 注册表单字段
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import type { RegisterField } from '@h-ai/ui'
|
|
161
|
+
* const example: RegisterField = 'email'
|
|
162
|
+
* ```
|
|
102
163
|
*/
|
|
103
164
|
export type RegisterField = 'username' | 'email' | 'phone' | 'password' | 'confirmPassword' | 'nickname';
|
|
104
165
|
/**
|
|
105
166
|
* 注册表单数据
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import type { RegisterFormData } from '@h-ai/ui'
|
|
171
|
+
* const example: RegisterFormData = { username: 'ada', email: 'ada@example.com', password: 'Example-pass-42!', confirmPassword: 'Example-pass-42!' }
|
|
172
|
+
* ```
|
|
106
173
|
*/
|
|
107
174
|
export interface RegisterFormData {
|
|
108
175
|
username?: string;
|
|
@@ -114,8 +181,19 @@ export interface RegisterFormData {
|
|
|
114
181
|
}
|
|
115
182
|
/**
|
|
116
183
|
* 注册表单属性
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```svelte
|
|
187
|
+
* <script lang="ts">
|
|
188
|
+
* import { RegisterForm } from '@h-ai/ui'
|
|
189
|
+
* import type { RegisterFormProps } from '@h-ai/ui'
|
|
190
|
+
* const props: RegisterFormProps = { fields: ['username', 'password'], requireConfirmPassword: true }
|
|
191
|
+
* </script>
|
|
192
|
+
* <RegisterForm {...props} />
|
|
193
|
+
* ```
|
|
117
194
|
*/
|
|
118
|
-
export interface RegisterFormProps {
|
|
195
|
+
export interface RegisterFormProps extends FormLayoutOptions, DataAttributes {
|
|
196
|
+
passwordPolicy?: PasswordPolicy;
|
|
119
197
|
/** 加载状态 */
|
|
120
198
|
loading?: boolean;
|
|
121
199
|
/** 禁用状态 */
|
|
@@ -146,21 +224,55 @@ export interface RegisterFormProps {
|
|
|
146
224
|
onsubmit?: (data: RegisterFormData) => void | Promise<void>;
|
|
147
225
|
/** 头部插槽 */
|
|
148
226
|
header?: Snippet;
|
|
227
|
+
/** 内置字段后、提交按钮前的扩展内容;额外字段值由应用自行绑定与提交。 */
|
|
228
|
+
extraFields?: Snippet;
|
|
149
229
|
/** 底部插槽 */
|
|
150
230
|
footer?: Snippet;
|
|
151
231
|
}
|
|
152
232
|
/**
|
|
153
233
|
* 修改密码表单数据
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* import type { ChangePasswordFormData } from '@h-ai/ui'
|
|
238
|
+
* const example: ChangePasswordFormData = { oldPassword: 'Old-example-42!', newPassword: 'New-example-42!', confirmPassword: 'New-example-42!' }
|
|
239
|
+
* ```
|
|
154
240
|
*/
|
|
155
241
|
export interface ChangePasswordFormData {
|
|
156
242
|
oldPassword?: string;
|
|
157
243
|
newPassword: string;
|
|
158
244
|
confirmPassword: string;
|
|
159
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* 敏感操作再鉴别对话框属性;宿主只在服务端选定操作前请求密码。
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* import type { ReauthenticationDialogProps } from '@h-ai/ui'
|
|
251
|
+
* const props: ReauthenticationDialogProps = { open: false, onsubmit: async (password) => { void password }, onclose: () => {} }
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
export interface ReauthenticationDialogProps {
|
|
255
|
+
open: boolean;
|
|
256
|
+
loading?: boolean;
|
|
257
|
+
error?: string;
|
|
258
|
+
onsubmit: (password: string) => void | Promise<void>;
|
|
259
|
+
onclose: () => void;
|
|
260
|
+
}
|
|
160
261
|
/**
|
|
161
262
|
* 修改密码表单属性
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```svelte
|
|
266
|
+
* <script lang="ts">
|
|
267
|
+
* import { ChangePasswordForm } from '@h-ai/ui'
|
|
268
|
+
* import type { ChangePasswordFormProps } from '@h-ai/ui'
|
|
269
|
+
* const props: ChangePasswordFormProps = { requireOldPassword: true, minPasswordLength: 12 }
|
|
270
|
+
* </script>
|
|
271
|
+
* <ChangePasswordForm {...props} />
|
|
272
|
+
* ```
|
|
162
273
|
*/
|
|
163
|
-
export interface ChangePasswordFormProps {
|
|
274
|
+
export interface ChangePasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
275
|
+
passwordPolicy?: PasswordPolicy;
|
|
164
276
|
/** 加载状态 */
|
|
165
277
|
loading?: boolean;
|
|
166
278
|
/** 禁用状态 */
|
|
@@ -182,6 +294,12 @@ export interface ChangePasswordFormProps {
|
|
|
182
294
|
}
|
|
183
295
|
/**
|
|
184
296
|
* 找回密码表单数据
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* import type { ForgotPasswordFormData } from '@h-ai/ui'
|
|
301
|
+
* const example: ForgotPasswordFormData = { email: 'ada@example.com' }
|
|
302
|
+
* ```
|
|
185
303
|
*/
|
|
186
304
|
export interface ForgotPasswordFormData {
|
|
187
305
|
email?: string;
|
|
@@ -189,8 +307,18 @@ export interface ForgotPasswordFormData {
|
|
|
189
307
|
}
|
|
190
308
|
/**
|
|
191
309
|
* 找回密码表单属性
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```svelte
|
|
313
|
+
* <script lang="ts">
|
|
314
|
+
* import { ForgotPasswordForm } from '@h-ai/ui'
|
|
315
|
+
* import type { ForgotPasswordFormProps } from '@h-ai/ui'
|
|
316
|
+
* const props: ForgotPasswordFormProps = { mode: 'email' }
|
|
317
|
+
* </script>
|
|
318
|
+
* <ForgotPasswordForm {...props} />
|
|
319
|
+
* ```
|
|
192
320
|
*/
|
|
193
|
-
export interface ForgotPasswordFormProps {
|
|
321
|
+
export interface ForgotPasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
194
322
|
/** 加载状态 */
|
|
195
323
|
loading?: boolean;
|
|
196
324
|
/** 禁用状态 */
|
|
@@ -220,6 +348,12 @@ export interface ForgotPasswordFormProps {
|
|
|
220
348
|
}
|
|
221
349
|
/**
|
|
222
350
|
* 重置密码表单数据
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* import type { ResetPasswordFormData } from '@h-ai/ui'
|
|
355
|
+
* const example: ResetPasswordFormData = { code: '123456', newPassword: 'New-example-42!', confirmPassword: 'New-example-42!' }
|
|
356
|
+
* ```
|
|
223
357
|
*/
|
|
224
358
|
export interface ResetPasswordFormData {
|
|
225
359
|
code?: string;
|
|
@@ -228,8 +362,19 @@ export interface ResetPasswordFormData {
|
|
|
228
362
|
}
|
|
229
363
|
/**
|
|
230
364
|
* 重置密码表单属性
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```svelte
|
|
368
|
+
* <script lang="ts">
|
|
369
|
+
* import { ResetPasswordForm } from '@h-ai/ui'
|
|
370
|
+
* import type { ResetPasswordFormProps } from '@h-ai/ui'
|
|
371
|
+
* const props: ResetPasswordFormProps = { showCode: true, minPasswordLength: 12 }
|
|
372
|
+
* </script>
|
|
373
|
+
* <ResetPasswordForm {...props} />
|
|
374
|
+
* ```
|
|
231
375
|
*/
|
|
232
|
-
export interface ResetPasswordFormProps {
|
|
376
|
+
export interface ResetPasswordFormProps extends FormLayoutOptions, DataAttributes {
|
|
377
|
+
passwordPolicy?: PasswordPolicy;
|
|
233
378
|
/** 加载状态 */
|
|
234
379
|
loading?: boolean;
|
|
235
380
|
/** 禁用状态 */
|
|
@@ -257,12 +402,235 @@ export interface ResetPasswordFormProps {
|
|
|
257
402
|
/** 提交事件 */
|
|
258
403
|
onsubmit?: (data: ResetPasswordFormData) => void | Promise<void>;
|
|
259
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* 认证页面直接消费 IAM 白名单配置,无需依赖服务端 IAM 包。
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```ts
|
|
410
|
+
* import type { AuthLoginMethod } from '@h-ai/ui'
|
|
411
|
+
* const example: AuthLoginMethod = 'password'
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
export type AuthLoginMethod = 'password' | 'ldap' | 'email' | 'sms';
|
|
415
|
+
/**
|
|
416
|
+
* 与 IAM 公开密码策略一致;前端提示不能代替服务端校验。
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```ts
|
|
420
|
+
* import type { PasswordPolicy } from '@h-ai/ui'
|
|
421
|
+
* const example: PasswordPolicy = { minLength: 12, maxLength: 128, requireUppercase: true, requireLowercase: true, requireNumber: true, requireSpecialChar: true }
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
export interface PasswordPolicy {
|
|
425
|
+
minLength: number;
|
|
426
|
+
maxLength: number;
|
|
427
|
+
requireUppercase: boolean;
|
|
428
|
+
requireLowercase: boolean;
|
|
429
|
+
requireNumber: boolean;
|
|
430
|
+
requireSpecialChar: boolean;
|
|
431
|
+
/** 至少满足的字符类别数;0 或未提供时仅应用各项独立要求。 */
|
|
432
|
+
minCharacterClasses?: number;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* 仅消费安全公开配置,不能将 iam.config 或连接密钥传入浏览器。
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
440
|
+
* import type { AuthPanelConfig } from '@h-ai/ui'
|
|
441
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
442
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
443
|
+
* try {
|
|
444
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
445
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
446
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
447
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
448
|
+
* const example: AuthPanelConfig = result.data
|
|
449
|
+
* }
|
|
450
|
+
* finally {
|
|
451
|
+
* await apiClient.close()
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
export interface AuthPanelConfig {
|
|
456
|
+
captcha?: {
|
|
457
|
+
enabled: boolean;
|
|
458
|
+
};
|
|
459
|
+
/** 只有已启用且具备运行时依赖的方式才应为 true。 */
|
|
460
|
+
login: {
|
|
461
|
+
password: boolean;
|
|
462
|
+
ldap: boolean;
|
|
463
|
+
email: boolean;
|
|
464
|
+
sms: boolean;
|
|
465
|
+
};
|
|
466
|
+
register: {
|
|
467
|
+
enabled: boolean;
|
|
468
|
+
};
|
|
469
|
+
passwordReset: {
|
|
470
|
+
enabled: boolean;
|
|
471
|
+
mode?: 'email' | 'phone';
|
|
472
|
+
};
|
|
473
|
+
password: PasswordPolicy;
|
|
474
|
+
/** 验证码位数和重发间隔(秒),用于输入校验和倒计时。 */
|
|
475
|
+
otp: {
|
|
476
|
+
length: number;
|
|
477
|
+
resendInterval: number;
|
|
478
|
+
};
|
|
479
|
+
/** 协议 URL 由服务端校验;弹窗展示开关按当前页面分别生效。 */
|
|
480
|
+
agreements: AgreementDisplay & {
|
|
481
|
+
showOnLogin: boolean;
|
|
482
|
+
showOnRegister: boolean;
|
|
483
|
+
};
|
|
484
|
+
ui: {
|
|
485
|
+
variant: 'card' | 'split';
|
|
486
|
+
title?: string;
|
|
487
|
+
subtitle?: string;
|
|
488
|
+
brandTitle?: string;
|
|
489
|
+
brandText?: string;
|
|
490
|
+
logoUrl?: string;
|
|
491
|
+
illustrationUrl?: string;
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* 认证动作可由框架工厂直接创建,也可包装以处理应用自己的扩展数据。
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
500
|
+
* import type { AuthPanelActions } from '@h-ai/ui'
|
|
501
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
502
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
503
|
+
* try {
|
|
504
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
505
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
506
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
507
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
508
|
+
* const example: AuthPanelActions = actions
|
|
509
|
+
* }
|
|
510
|
+
* finally {
|
|
511
|
+
* await apiClient.close()
|
|
512
|
+
* }
|
|
513
|
+
* ```
|
|
514
|
+
*/
|
|
515
|
+
export interface AuthPanelActions {
|
|
516
|
+
/** 仅启用交互挑战时需要;动作返回可公开挑战,签名秘密保留在服务端。 */
|
|
517
|
+
createCaptcha?: (input: {
|
|
518
|
+
operation: 'login' | 'register' | 'sendOtp' | 'passwordReset' | 'renewPassword';
|
|
519
|
+
}) => Promise<HaiResult<{
|
|
520
|
+
id: string;
|
|
521
|
+
challenge: Challenge;
|
|
522
|
+
}>>;
|
|
523
|
+
/** password/ldap 使用 password,email/sms 使用 code;成功后由工厂保存凭证。 */
|
|
524
|
+
login: (input: {
|
|
525
|
+
identifier: string;
|
|
526
|
+
password: string;
|
|
527
|
+
method?: AuthLoginMethod;
|
|
528
|
+
code?: string;
|
|
529
|
+
captcha?: string;
|
|
530
|
+
expectedUserId?: string;
|
|
531
|
+
}) => Promise<HaiResult<unknown>>;
|
|
532
|
+
/** 注册并登录;禁用新账户的待启用状态由面板单独提示。 */
|
|
533
|
+
register: (input: {
|
|
534
|
+
username: string;
|
|
535
|
+
password: string;
|
|
536
|
+
email?: string;
|
|
537
|
+
phone?: string;
|
|
538
|
+
displayName?: string;
|
|
539
|
+
captcha?: string;
|
|
540
|
+
}) => Promise<HaiResult<unknown>>;
|
|
541
|
+
sendOtp: (identifier: string, options?: {
|
|
542
|
+
captcha?: string;
|
|
543
|
+
}) => Promise<HaiResult<unknown>>;
|
|
544
|
+
requestPasswordReset: (identifier: string, options?: {
|
|
545
|
+
captcha?: string;
|
|
546
|
+
}) => Promise<HaiResult<unknown>>;
|
|
547
|
+
confirmPasswordReset: (token: string, newPassword: string) => Promise<HaiResult<unknown>>;
|
|
548
|
+
/** 首次或密码过期时,验证原密码并换新;完成后重新登录。 */
|
|
549
|
+
renewPassword?: (input: {
|
|
550
|
+
identifier: string;
|
|
551
|
+
password: string;
|
|
552
|
+
newPassword: string;
|
|
553
|
+
captcha?: string;
|
|
554
|
+
}) => Promise<HaiResult<unknown>>;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* AuthPanel 的初始页面;未传独立路由时由组件内部导航。
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* import type { AuthPanelMode } from '@h-ai/ui'
|
|
562
|
+
* const example: AuthPanelMode = 'login'
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
export type AuthPanelMode = 'login' | 'register' | 'forgot' | 'reset' | 'renew';
|
|
566
|
+
/**
|
|
567
|
+
* 配置驱动认证场景;网络、通知和令牌存储由应用注入 actions。
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* import { apiClient } from '@h-ai/api-client'
|
|
572
|
+
* import type { AuthPanelProps } from '@h-ai/ui'
|
|
573
|
+
* const initialized = await apiClient.init({ baseUrl: 'https://api.example.com/api/v1' })
|
|
574
|
+
* if (!initialized.success) throw new Error(initialized.error.message)
|
|
575
|
+
* try {
|
|
576
|
+
* const result = await apiClient.iam.auth.publicConfig()
|
|
577
|
+
* if (!result.success) throw new Error(result.error.message)
|
|
578
|
+
* if (!result.data) throw new Error('Public auth configuration unavailable')
|
|
579
|
+
* const actions = apiClient.createAuthActions(apiClient)
|
|
580
|
+
* const example: AuthPanelProps = { config: result.data, actions, initialMode: 'login' }
|
|
581
|
+
* }
|
|
582
|
+
* finally {
|
|
583
|
+
* await apiClient.close()
|
|
584
|
+
* }
|
|
585
|
+
* ```
|
|
586
|
+
*/
|
|
587
|
+
export interface AuthPanelProps extends FormLayoutOptions, DataAttributes {
|
|
588
|
+
/** 嵌入弹窗等已有布局,省略整页背景和重复标题。 */
|
|
589
|
+
embedded?: boolean;
|
|
590
|
+
/** 登录标识初始值;不能替代服务端主体约束。 */
|
|
591
|
+
initialIdentifier?: string;
|
|
592
|
+
/** 未取得配置时显示加载状态,只消费 IAM 的公开配置。 */
|
|
593
|
+
config: AuthPanelConfig | null;
|
|
594
|
+
/** 由 Kit 或 API client 提供标准动作,组件不处理底层传输。 */
|
|
595
|
+
actions: AuthPanelActions;
|
|
596
|
+
initialMode?: AuthPanelMode;
|
|
597
|
+
/** 来自重置链接的令牌;未传时显示手动输入框。 */
|
|
598
|
+
resetToken?: string;
|
|
599
|
+
loginUrl?: string;
|
|
600
|
+
registerUrl?: string;
|
|
601
|
+
forgotPasswordUrl?: string;
|
|
602
|
+
/** 登录或注册成功后由应用导航或刷新用户资料。 */
|
|
603
|
+
onauthenticated?: () => void | Promise<void>;
|
|
604
|
+
/** 公开配置获取失败的提示与重试动作。 */
|
|
605
|
+
error?: string;
|
|
606
|
+
onretry?: () => void;
|
|
607
|
+
/** 登录表单的头部、扩展字段、底部;底部仍保留内置导航。 */
|
|
608
|
+
loginHeader?: Snippet;
|
|
609
|
+
loginFields?: Snippet;
|
|
610
|
+
loginFooter?: Snippet;
|
|
611
|
+
/** 注册表单的头部、扩展字段、底部;额外字段通过应用状态处理。 */
|
|
612
|
+
registerHeader?: Snippet;
|
|
613
|
+
registerFields?: Snippet;
|
|
614
|
+
registerFooter?: Snippet;
|
|
615
|
+
}
|
|
260
616
|
/**
|
|
261
617
|
* 用户个人信息字段
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```ts
|
|
621
|
+
* import type { UserProfileField } from '@h-ai/ui'
|
|
622
|
+
* const example: UserProfileField = 'email'
|
|
623
|
+
* ```
|
|
262
624
|
*/
|
|
263
625
|
export type UserProfileField = 'avatar' | 'username' | 'email' | 'displayName' | 'nickname' | 'phone' | 'bio';
|
|
264
626
|
/**
|
|
265
627
|
* 用户信息
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* ```ts
|
|
631
|
+
* import type { UserProfileData } from '@h-ai/ui'
|
|
632
|
+
* const example: UserProfileData = { id: 'u1', username: 'ada', email: 'ada@example.com' }
|
|
633
|
+
* ```
|
|
266
634
|
*/
|
|
267
635
|
export interface UserProfileData {
|
|
268
636
|
id?: string;
|
|
@@ -275,6 +643,15 @@ export interface UserProfileData {
|
|
|
275
643
|
avatarUrl?: string;
|
|
276
644
|
bio?: string;
|
|
277
645
|
}
|
|
646
|
+
/**
|
|
647
|
+
* 个人资料表单的标准提交值;验证和保存由宿主负责。
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* import type { UserProfileSubmitData } from '@h-ai/ui'
|
|
652
|
+
* const example: UserProfileSubmitData = { username: 'ada', email: 'ada@example.com', displayName: 'Ada', phone: '', bio: 'Developer' }
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
278
655
|
export interface UserProfileSubmitData {
|
|
279
656
|
username: string;
|
|
280
657
|
email: string;
|
|
@@ -284,8 +661,18 @@ export interface UserProfileSubmitData {
|
|
|
284
661
|
}
|
|
285
662
|
/**
|
|
286
663
|
* 用户个人信息属性
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```svelte
|
|
667
|
+
* <script lang="ts">
|
|
668
|
+
* import { UserProfile } from '@h-ai/ui'
|
|
669
|
+
* import type { UserProfileProps } from '@h-ai/ui'
|
|
670
|
+
* const props: UserProfileProps = { user: { id: 'u1', username: 'ada', email: 'ada@example.com' }, fields: ['username', 'email'], editable: true }
|
|
671
|
+
* </script>
|
|
672
|
+
* <UserProfile {...props} />
|
|
673
|
+
* ```
|
|
287
674
|
*/
|
|
288
|
-
export interface UserProfileProps {
|
|
675
|
+
export interface UserProfileProps extends FormLayoutOptions, DataAttributes {
|
|
289
676
|
/** 用户信息 */
|
|
290
677
|
user?: UserProfileData;
|
|
291
678
|
/** 是否可编辑 */
|
|
@@ -295,8 +682,14 @@ export interface UserProfileProps {
|
|
|
295
682
|
loading?: boolean;
|
|
296
683
|
/** 显示的字段 */
|
|
297
684
|
fields?: UserProfileField[];
|
|
685
|
+
/** 按业务规则声明字段的原生约束,复用控件失焦校验。 */
|
|
686
|
+
fieldConstraints?: Partial<Record<Exclude<UserProfileField, 'avatar'>, Pick<InputProps, 'required' | 'minlength' | 'maxlength' | 'pattern' | 'validationMessage'>>>;
|
|
298
687
|
/** 头像上传地址 */
|
|
299
688
|
avatarUploadUrl?: string;
|
|
689
|
+
/** 文件选择器允许的头像类型;最终校验由业务上传服务负责。 */
|
|
690
|
+
avatarAccept?: string;
|
|
691
|
+
/** 与业务上传限制一致的提示文案。 */
|
|
692
|
+
avatarHint?: string;
|
|
300
693
|
/** 自定义类名 */
|
|
301
694
|
class?: string;
|
|
302
695
|
/** 错误信息 */
|
|
@@ -308,10 +701,22 @@ export interface UserProfileProps {
|
|
|
308
701
|
}
|
|
309
702
|
/**
|
|
310
703
|
* 上传状态
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```ts
|
|
707
|
+
* import type { UploadState } from '@h-ai/ui'
|
|
708
|
+
* const example: UploadState = 'uploading'
|
|
709
|
+
* ```
|
|
311
710
|
*/
|
|
312
711
|
export type UploadState = 'pending' | 'uploading' | 'success' | 'error';
|
|
313
712
|
/**
|
|
314
713
|
* 上传文件信息
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```ts
|
|
717
|
+
* import type { UploadFile } from '@h-ai/ui'
|
|
718
|
+
* 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 }
|
|
719
|
+
* ```
|
|
315
720
|
*/
|
|
316
721
|
export interface UploadFile {
|
|
317
722
|
/** 唯一 ID */
|
|
@@ -333,10 +738,69 @@ export interface UploadFile {
|
|
|
333
738
|
/** 上传响应 */
|
|
334
739
|
response?: unknown;
|
|
335
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* 上传处理器上下文
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```ts
|
|
746
|
+
* import type { UploadHandlerContext } from '@h-ai/ui'
|
|
747
|
+
* const example: UploadHandlerContext = { signal: new AbortController().signal, onProgress: progress => document.body.setAttribute('data-upload-progress', String(progress)) }
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
750
|
+
export interface UploadHandlerContext {
|
|
751
|
+
/** 组件销毁、文件移除或重试时触发的取消信号 */
|
|
752
|
+
signal: AbortSignal;
|
|
753
|
+
/** 汇报 0-100 的上传进度 */
|
|
754
|
+
onProgress: (progress: number) => void;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* 上传处理结果
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* import type { UploadHandlerResult } from '@h-ai/ui'
|
|
762
|
+
* const example: UploadHandlerResult = { url: '/files/report.pdf', response: { key: 'reports/report.pdf' } }
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
export interface UploadHandlerResult {
|
|
766
|
+
/** 可展示的最终文件 URL(图片/头像上传必须返回) */
|
|
767
|
+
url?: string;
|
|
768
|
+
/** 业务层原始响应(回传到 UploadFile.response) */
|
|
769
|
+
response?: unknown;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* 应用层上传处理器。
|
|
773
|
+
*
|
|
774
|
+
* UI 组件只管理选择、校验、进度和预览;签名 URL、认证头与上传协议由应用服务层实现。
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```ts
|
|
778
|
+
* import type { UploadHandler } from '@h-ai/ui'
|
|
779
|
+
* const upload: UploadHandler = async (file, { signal, onProgress }) => {
|
|
780
|
+
* const response = await fetch('/api/uploads', { method: 'POST', body: file, signal })
|
|
781
|
+
* if (!response.ok) throw new Error('Upload failed')
|
|
782
|
+
* const result: unknown = await response.json()
|
|
783
|
+
* if (!result || typeof result !== 'object' || !('url' in result) || typeof result.url !== 'string') throw new Error('Upload response invalid')
|
|
784
|
+
* onProgress(100)
|
|
785
|
+
* return { url: result.url }
|
|
786
|
+
* }
|
|
787
|
+
* ```
|
|
788
|
+
*/
|
|
789
|
+
export type UploadHandler = (file: File, context: UploadHandlerContext) => Promise<UploadHandlerResult>;
|
|
336
790
|
/**
|
|
337
791
|
* 文件上传属性
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```svelte
|
|
795
|
+
* <script lang="ts">
|
|
796
|
+
* import { FileUpload } from '@h-ai/ui'
|
|
797
|
+
* import type { FileUploadProps } from '@h-ai/ui'
|
|
798
|
+
* const props: FileUploadProps = { accept: '.pdf', maxFiles: 3, autoUpload: false }
|
|
799
|
+
* </script>
|
|
800
|
+
* <FileUpload {...props} />
|
|
801
|
+
* ```
|
|
338
802
|
*/
|
|
339
|
-
export interface FileUploadProps {
|
|
803
|
+
export interface FileUploadProps extends DataAttributes {
|
|
340
804
|
/** 接受的文件类型 */
|
|
341
805
|
accept?: string;
|
|
342
806
|
/** 最大文件大小 (bytes) */
|
|
@@ -347,12 +811,8 @@ export interface FileUploadProps {
|
|
|
347
811
|
multiple?: boolean;
|
|
348
812
|
/** 是否禁用 */
|
|
349
813
|
disabled?: boolean;
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
/** 签名 URL 地址 */
|
|
353
|
-
presignUrl?: string;
|
|
354
|
-
/** 请求头 */
|
|
355
|
-
headers?: Record<string, string>;
|
|
814
|
+
/** 应用层上传处理器;未提供时组件仅选择文件并保持 pending */
|
|
815
|
+
uploadHandler?: UploadHandler;
|
|
356
816
|
/** 是否自动上传 */
|
|
357
817
|
autoUpload?: boolean;
|
|
358
818
|
/** 是否显示文件列表 */
|
|
@@ -372,6 +832,12 @@ export interface FileUploadProps {
|
|
|
372
832
|
}
|
|
373
833
|
/**
|
|
374
834
|
* 文件项
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* ```ts
|
|
838
|
+
* import type { FileItem } from '@h-ai/ui'
|
|
839
|
+
* const example: FileItem = { id: 'file-1', name: 'report.pdf', size: 1024, type: 'application/pdf', url: '/files/report.pdf' }
|
|
840
|
+
* ```
|
|
375
841
|
*/
|
|
376
842
|
export interface FileItem {
|
|
377
843
|
/** 唯一 ID */
|
|
@@ -391,8 +857,18 @@ export interface FileItem {
|
|
|
391
857
|
}
|
|
392
858
|
/**
|
|
393
859
|
* 文件列表属性
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```svelte
|
|
863
|
+
* <script lang="ts">
|
|
864
|
+
* import { FileList } from '@h-ai/ui'
|
|
865
|
+
* import type { FileListProps } from '@h-ai/ui'
|
|
866
|
+
* const props: FileListProps = { files: [{ id: 'f1', name: 'report.pdf', size: 1024, type: 'application/pdf' }], showSize: true }
|
|
867
|
+
* </script>
|
|
868
|
+
* <FileList {...props} />
|
|
869
|
+
* ```
|
|
394
870
|
*/
|
|
395
|
-
export interface FileListProps {
|
|
871
|
+
export interface FileListProps extends DataAttributes {
|
|
396
872
|
/** 文件列表 */
|
|
397
873
|
files?: FileItem[];
|
|
398
874
|
/** 加载状态 */
|
|
@@ -420,8 +896,18 @@ export interface FileListProps {
|
|
|
420
896
|
}
|
|
421
897
|
/**
|
|
422
898
|
* 图片上传属性
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```svelte
|
|
902
|
+
* <script lang="ts">
|
|
903
|
+
* import { ImageUpload } from '@h-ai/ui'
|
|
904
|
+
* import type { ImageUploadProps } from '@h-ai/ui'
|
|
905
|
+
* const props: ImageUploadProps = { accept: 'image/png,image/jpeg', maxSize: 5 * 1024 * 1024 }
|
|
906
|
+
* </script>
|
|
907
|
+
* <ImageUpload {...props} />
|
|
908
|
+
* ```
|
|
423
909
|
*/
|
|
424
|
-
export interface ImageUploadProps {
|
|
910
|
+
export interface ImageUploadProps extends DataAttributes {
|
|
425
911
|
/** 图片 URL */
|
|
426
912
|
value?: string;
|
|
427
913
|
/** 接受的文件类型 */
|
|
@@ -430,12 +916,8 @@ export interface ImageUploadProps {
|
|
|
430
916
|
maxSize?: number;
|
|
431
917
|
/** 是否禁用 */
|
|
432
918
|
disabled?: boolean;
|
|
433
|
-
/**
|
|
434
|
-
|
|
435
|
-
/** 签名 URL 地址 */
|
|
436
|
-
presignUrl?: string;
|
|
437
|
-
/** 请求头 */
|
|
438
|
-
headers?: Record<string, string>;
|
|
919
|
+
/** 应用层上传处理器;未提供时仅生成本地预览 */
|
|
920
|
+
uploadHandler?: UploadHandler;
|
|
439
921
|
/** 占位文本 */
|
|
440
922
|
placeholder?: string;
|
|
441
923
|
/** 宽高比 */
|
|
@@ -453,8 +935,18 @@ export interface ImageUploadProps {
|
|
|
453
935
|
}
|
|
454
936
|
/**
|
|
455
937
|
* 头像上传属性
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```svelte
|
|
941
|
+
* <script lang="ts">
|
|
942
|
+
* import { AvatarUpload } from '@h-ai/ui'
|
|
943
|
+
* import type { AvatarUploadProps } from '@h-ai/ui'
|
|
944
|
+
* const props: AvatarUploadProps = { fallback: 'A', size: 'lg' }
|
|
945
|
+
* </script>
|
|
946
|
+
* <AvatarUpload {...props} />
|
|
947
|
+
* ```
|
|
456
948
|
*/
|
|
457
|
-
export interface AvatarUploadProps {
|
|
949
|
+
export interface AvatarUploadProps extends DataAttributes {
|
|
458
950
|
/** 头像 URL */
|
|
459
951
|
value?: string;
|
|
460
952
|
/** 尺寸 */
|
|
@@ -465,12 +957,8 @@ export interface AvatarUploadProps {
|
|
|
465
957
|
maxSize?: number;
|
|
466
958
|
/** 是否禁用 */
|
|
467
959
|
disabled?: boolean;
|
|
468
|
-
/**
|
|
469
|
-
|
|
470
|
-
/** 签名 URL 地址 */
|
|
471
|
-
presignUrl?: string;
|
|
472
|
-
/** 请求头 */
|
|
473
|
-
headers?: Record<string, string>;
|
|
960
|
+
/** 应用层上传处理器;未提供时仅生成本地预览 */
|
|
961
|
+
uploadHandler?: UploadHandler;
|
|
474
962
|
/** 默认文字(没有图片时显示) */
|
|
475
963
|
fallback?: string;
|
|
476
964
|
/** 自定义类名 */
|
|
@@ -482,8 +970,18 @@ export interface AvatarUploadProps {
|
|
|
482
970
|
}
|
|
483
971
|
/**
|
|
484
972
|
* 加密输入框属性
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```svelte
|
|
976
|
+
* <script lang="ts">
|
|
977
|
+
* import { EncryptedInput } from '@h-ai/ui'
|
|
978
|
+
* import type { EncryptedInputProps } from '@h-ai/ui'
|
|
979
|
+
* const props: EncryptedInputProps = { value: '', algorithm: 'SM2', showEncrypted: false }
|
|
980
|
+
* </script>
|
|
981
|
+
* <EncryptedInput {...props} />
|
|
982
|
+
* ```
|
|
485
983
|
*/
|
|
486
|
-
export interface EncryptedInputProps {
|
|
984
|
+
export interface EncryptedInputProps extends DataAttributes {
|
|
487
985
|
/** 原始值 */
|
|
488
986
|
value?: string;
|
|
489
987
|
/** 加密后的值 */
|
|
@@ -499,7 +997,7 @@ export interface EncryptedInputProps {
|
|
|
499
997
|
/** 是否显示加密结果 */
|
|
500
998
|
showEncrypted?: boolean;
|
|
501
999
|
/** 加密算法 */
|
|
502
|
-
algorithm?: 'SM2' | 'SM4'
|
|
1000
|
+
algorithm?: 'SM2' | 'SM4';
|
|
503
1001
|
/** 加密函数 */
|
|
504
1002
|
onencrypt?: (value: string) => Promise<string>;
|
|
505
1003
|
/** 自定义类名 */
|
|
@@ -515,12 +1013,22 @@ export interface EncryptedInputProps {
|
|
|
515
1013
|
}
|
|
516
1014
|
/**
|
|
517
1015
|
* 哈希展示属性
|
|
1016
|
+
*
|
|
1017
|
+
* @example
|
|
1018
|
+
* ```svelte
|
|
1019
|
+
* <script lang="ts">
|
|
1020
|
+
* import { HashDisplay } from '@h-ai/ui'
|
|
1021
|
+
* import type { HashDisplayProps } from '@h-ai/ui'
|
|
1022
|
+
* const props: HashDisplayProps = { value: 'example-digest', algorithm: 'SM3', copyable: true }
|
|
1023
|
+
* </script>
|
|
1024
|
+
* <HashDisplay {...props} />
|
|
1025
|
+
* ```
|
|
518
1026
|
*/
|
|
519
|
-
export interface HashDisplayProps {
|
|
1027
|
+
export interface HashDisplayProps extends DataAttributes {
|
|
520
1028
|
/** 哈希值 */
|
|
521
1029
|
value?: string;
|
|
522
1030
|
/** 算法 */
|
|
523
|
-
algorithm?: 'SM3'
|
|
1031
|
+
algorithm?: 'SM3';
|
|
524
1032
|
/** 标签 */
|
|
525
1033
|
label?: string;
|
|
526
1034
|
/** 是否可复制 */
|
|
@@ -538,10 +1046,22 @@ export interface HashDisplayProps {
|
|
|
538
1046
|
}
|
|
539
1047
|
/**
|
|
540
1048
|
* Markdown 渲染器属性
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```svelte
|
|
1052
|
+
* <script lang="ts">
|
|
1053
|
+
* import { MarkdownRenderer } from '@h-ai/ui'
|
|
1054
|
+
* import type { MarkdownRendererProps } from '@h-ai/ui'
|
|
1055
|
+
* const props: MarkdownRendererProps = { content: '# 标题\n正文', allowHtmlTags: false }
|
|
1056
|
+
* </script>
|
|
1057
|
+
* <MarkdownRenderer {...props} />
|
|
1058
|
+
* ```
|
|
541
1059
|
*/
|
|
542
|
-
export interface MarkdownRendererProps {
|
|
1060
|
+
export interface MarkdownRendererProps extends DataAttributes {
|
|
543
1061
|
/** Markdown 源文本 */
|
|
544
1062
|
content?: string;
|
|
1063
|
+
/** 文本字号,支持 number(按 px)或任意 CSS 长度字符串 */
|
|
1064
|
+
fontSize?: string | number;
|
|
545
1065
|
/** 自定义类名 */
|
|
546
1066
|
class?: string;
|
|
547
1067
|
/** 是否显示代码块复制按钮(默认 true) */
|
|
@@ -550,17 +1070,29 @@ export interface MarkdownRendererProps {
|
|
|
550
1070
|
enableHighlight?: boolean;
|
|
551
1071
|
/** 是否将换行符转换为 <br>(默认 true,适合 AI 输出) */
|
|
552
1072
|
breaks?: boolean;
|
|
1073
|
+
/** 是否按安全白名单解析原始 HTML 标签(默认 false) */
|
|
1074
|
+
allowHtmlTags?: boolean;
|
|
553
1075
|
}
|
|
554
1076
|
/**
|
|
555
1077
|
* 签名展示属性
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```svelte
|
|
1081
|
+
* <script lang="ts">
|
|
1082
|
+
* import { SignatureDisplay } from '@h-ai/ui'
|
|
1083
|
+
* import type { SignatureDisplayProps } from '@h-ai/ui'
|
|
1084
|
+
* const props: SignatureDisplayProps = { signature: 'example-signature', verified: false, showPublicKey: false }
|
|
1085
|
+
* </script>
|
|
1086
|
+
* <SignatureDisplay {...props} />
|
|
1087
|
+
* ```
|
|
556
1088
|
*/
|
|
557
|
-
export interface SignatureDisplayProps {
|
|
1089
|
+
export interface SignatureDisplayProps extends DataAttributes {
|
|
558
1090
|
/** 签名值 */
|
|
559
1091
|
signature?: string;
|
|
560
1092
|
/** 公钥 */
|
|
561
1093
|
publicKey?: string;
|
|
562
1094
|
/** 算法 */
|
|
563
|
-
algorithm?: 'SM2'
|
|
1095
|
+
algorithm?: 'SM2';
|
|
564
1096
|
/** 验证状态 */
|
|
565
1097
|
verified?: boolean;
|
|
566
1098
|
/** 是否显示公钥 */
|