@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
package/dist/messages/zh-CN.json
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"login_username_placeholder": "请输入用户名或邮箱",
|
|
12
12
|
"login_password": "密码",
|
|
13
13
|
"login_password_placeholder": "请输入密码",
|
|
14
|
-
"login_remember_me": "记住我",
|
|
15
14
|
"login_forgot_password": "忘记密码?",
|
|
16
15
|
"login_submit": "登录",
|
|
17
16
|
"login_title": "登录",
|
|
@@ -25,6 +24,7 @@
|
|
|
25
24
|
"combobox_remove": "移除",
|
|
26
25
|
"data_table_actions": "操作",
|
|
27
26
|
"data_table_empty": "暂无数据",
|
|
27
|
+
"common_loading": "正在加载…",
|
|
28
28
|
"chart_loading": "图表加载中",
|
|
29
29
|
"chart_empty": "暂无数据",
|
|
30
30
|
"confirm_title": "确认",
|
|
@@ -166,6 +166,11 @@
|
|
|
166
166
|
"pagination_page_size": "{size} 条/页",
|
|
167
167
|
"pagination_rows_per_page": "每页",
|
|
168
168
|
"pagination_page_info": "第 {page} / {total} 页",
|
|
169
|
+
"pagination_first": "首页",
|
|
170
|
+
"pagination_previous": "上一页",
|
|
171
|
+
"pagination_next": "下一页",
|
|
172
|
+
"pagination_last": "末页",
|
|
173
|
+
"pagination_jump_label": "跳转到页",
|
|
169
174
|
"severity_critical": "严重",
|
|
170
175
|
"severity_high": "高",
|
|
171
176
|
"severity_medium": "中",
|
package/dist/messages.d.ts
CHANGED
|
@@ -5,26 +5,47 @@
|
|
|
5
5
|
* @module messages
|
|
6
6
|
*/
|
|
7
7
|
import messagesZhCN from './messages/zh-CN.json';
|
|
8
|
+
/**
|
|
9
|
+
* 内置翻译键集合;应用业务文案使用应用自己的翻译字典。
|
|
10
|
+
*
|
|
11
|
+
* @example 模块内部上下文
|
|
12
|
+
* ```ts
|
|
13
|
+
* const example: UIMessageKey = 'password_show'
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
8
16
|
export type UIMessageKey = keyof typeof messagesZhCN;
|
|
9
17
|
/**
|
|
10
18
|
* 获取 UI 组件翻译消息
|
|
11
19
|
*
|
|
12
20
|
* @param key - 消息 key
|
|
13
21
|
* @param params - 可选的插值参数
|
|
14
|
-
* @param locale -
|
|
22
|
+
* @param locale - 可选的宿主语言;省略时使用 Node 请求语言或浏览器应用语言
|
|
15
23
|
* @returns 当前 locale 对应的翻译文本
|
|
16
24
|
*
|
|
17
|
-
* @example
|
|
25
|
+
* @example 模块内部上下文
|
|
18
26
|
* ```ts
|
|
19
|
-
* uiM('password_show'
|
|
27
|
+
* const label = uiM('password_show', undefined, 'zh-CN')
|
|
20
28
|
* ```
|
|
21
29
|
*/
|
|
22
30
|
export declare function uiM(key: UIMessageKey, params?: Record<string, string | number | boolean>, locale?: string): string;
|
|
23
31
|
/**
|
|
24
32
|
* 获取当前 UI 模块使用的 locale
|
|
33
|
+
* @returns 当前 UI 语言。
|
|
34
|
+
*
|
|
35
|
+
* @example 模块内部上下文
|
|
36
|
+
* ```ts
|
|
37
|
+
* const locale = getUILocale()
|
|
38
|
+
* ```
|
|
25
39
|
*/
|
|
26
40
|
export declare function getUILocale(): string;
|
|
27
41
|
/**
|
|
28
42
|
* 手动设置 UI 模块的 locale(通常不需要,会自动同步)
|
|
43
|
+
* @param locale - 显式语言代码;省略时使用当前上下文。
|
|
44
|
+
* @returns {void} 无返回值;同步浏览器 UI 语言。
|
|
45
|
+
*
|
|
46
|
+
* @example 模块内部上下文
|
|
47
|
+
* ```ts
|
|
48
|
+
* setUILocale('en-US')
|
|
49
|
+
* ```
|
|
29
50
|
*/
|
|
30
51
|
export declare function setUILocale(locale: string): void;
|
package/dist/messages.js
CHANGED
|
@@ -8,23 +8,25 @@ import { core } from '@h-ai/core';
|
|
|
8
8
|
import { changeUILocale, readUILocale } from './internal/locale.js';
|
|
9
9
|
// 导入消息文件
|
|
10
10
|
import messagesEnUS from './messages/en-US.json';
|
|
11
|
+
import messagesJaJP from './messages/ja-JP.json';
|
|
11
12
|
import messagesZhCN from './messages/zh-CN.json';
|
|
12
13
|
// 创建消息获取器
|
|
13
14
|
const getMessage = core.i18n.createMessageGetter({
|
|
14
15
|
'zh-CN': messagesZhCN,
|
|
15
16
|
'en-US': messagesEnUS,
|
|
17
|
+
'ja-JP': messagesJaJP,
|
|
16
18
|
});
|
|
17
19
|
/**
|
|
18
20
|
* 获取 UI 组件翻译消息
|
|
19
21
|
*
|
|
20
22
|
* @param key - 消息 key
|
|
21
23
|
* @param params - 可选的插值参数
|
|
22
|
-
* @param locale -
|
|
24
|
+
* @param locale - 可选的宿主语言;省略时使用 Node 请求语言或浏览器应用语言
|
|
23
25
|
* @returns 当前 locale 对应的翻译文本
|
|
24
26
|
*
|
|
25
|
-
* @example
|
|
27
|
+
* @example 模块内部上下文
|
|
26
28
|
* ```ts
|
|
27
|
-
* uiM('password_show'
|
|
29
|
+
* const label = uiM('password_show', undefined, 'zh-CN')
|
|
28
30
|
* ```
|
|
29
31
|
*/
|
|
30
32
|
export function uiM(key, params, locale) {
|
|
@@ -32,12 +34,25 @@ export function uiM(key, params, locale) {
|
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* 获取当前 UI 模块使用的 locale
|
|
37
|
+
* @returns 当前 UI 语言。
|
|
38
|
+
*
|
|
39
|
+
* @example 模块内部上下文
|
|
40
|
+
* ```ts
|
|
41
|
+
* const locale = getUILocale()
|
|
42
|
+
* ```
|
|
35
43
|
*/
|
|
36
44
|
export function getUILocale() {
|
|
37
45
|
return readUILocale();
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* 手动设置 UI 模块的 locale(通常不需要,会自动同步)
|
|
49
|
+
* @param locale - 显式语言代码;省略时使用当前上下文。
|
|
50
|
+
* @returns {void} 无返回值;同步浏览器 UI 语言。
|
|
51
|
+
*
|
|
52
|
+
* @example 模块内部上下文
|
|
53
|
+
* ```ts
|
|
54
|
+
* setUILocale('en-US')
|
|
55
|
+
* ```
|
|
41
56
|
*/
|
|
42
57
|
export function setUILocale(locale) {
|
|
43
58
|
changeUILocale(locale);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* =============================================================================
|
|
3
|
-
* @
|
|
3
|
+
* @h-ai/ui - Design Token 系统
|
|
4
4
|
* =============================================================================
|
|
5
5
|
* 所有视觉变量通过 CSS Variables 定义,多端复用。
|
|
6
6
|
*
|
|
7
7
|
* 在 app.css 中导入:
|
|
8
|
-
* @import '@
|
|
8
|
+
* @import '@h-ai/ui/styles/design-tokens.css';
|
|
9
9
|
* =============================================================================
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
:root {
|
|
13
|
+
/* 焦点继承当前 DaisyUI 主题,业务可在主题层覆盖。 */
|
|
14
|
+
--hai-focus-color: var(--color-primary);
|
|
13
15
|
/* ─── 间距 ─── */
|
|
14
16
|
--hai-spacing-xs: 4px;
|
|
15
17
|
--hai-spacing-sm: 8px;
|
package/dist/styles/global.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* =============================================================================
|
|
3
|
-
* @
|
|
3
|
+
* @h-ai/ui - 全局样式
|
|
4
4
|
* =============================================================================
|
|
5
5
|
* 可选的全局样式增强,消费应用可通过以下方式导入:
|
|
6
6
|
*
|
|
@@ -45,8 +45,8 @@ body {
|
|
|
45
45
|
.input:focus,
|
|
46
46
|
.select:focus,
|
|
47
47
|
.textarea:focus {
|
|
48
|
-
outline:
|
|
49
|
-
|
|
48
|
+
outline: 2px solid var(--hai-focus-color, var(--color-primary));
|
|
49
|
+
outline-offset: 2px;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/* ─── 隐藏浏览器原生密码显示按钮(使用自定义切换) ─── */
|
|
@@ -61,7 +61,7 @@ input::-webkit-credentials-auto-fill-button {
|
|
|
61
61
|
表单组件 (.select, .radio, .checkbox, .toggle, .textarea, input, textarea)
|
|
62
62
|
由 DaisyUI 或组件自身处理焦点样式 */
|
|
63
63
|
:focus-visible:not(input, select, textarea, .select, .radio, .checkbox, .toggle, .textarea) {
|
|
64
|
-
outline: 2px solid
|
|
64
|
+
outline: 2px solid var(--hai-focus-color, var(--color-primary));
|
|
65
65
|
outline-offset: 2px;
|
|
66
66
|
border-radius: 4px;
|
|
67
67
|
}
|
|
@@ -69,12 +69,16 @@ input::-webkit-credentials-auto-fill-button {
|
|
|
69
69
|
/* ─── DaisyUI 组件微调 ─── */
|
|
70
70
|
.card {
|
|
71
71
|
transition:
|
|
72
|
-
box-shadow
|
|
73
|
-
transform
|
|
72
|
+
box-shadow var(--hai-transition-normal, 250ms) cubic-bezier(0.4, 0, 0.2, 1),
|
|
73
|
+
transform var(--hai-transition-normal, 250ms) cubic-bezier(0.4, 0, 0.2, 1);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.btn {
|
|
77
|
-
transition:
|
|
77
|
+
transition:
|
|
78
|
+
color var(--hai-transition-fast, 150ms),
|
|
79
|
+
background-color var(--hai-transition-fast, 150ms),
|
|
80
|
+
border-color var(--hai-transition-fast, 150ms),
|
|
81
|
+
box-shadow var(--hai-transition-fast, 150ms);
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
.badge {
|
|
@@ -86,7 +90,7 @@ input::-webkit-credentials-auto-fill-button {
|
|
|
86
90
|
font-size: 0.75rem;
|
|
87
91
|
text-transform: uppercase;
|
|
88
92
|
letter-spacing: 0.05em;
|
|
89
|
-
color:
|
|
93
|
+
color: color-mix(in oklab, var(--color-base-content) 70%, transparent);
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
/* ─── DaisyUI 组件微调:fieldset-legend 间距修正 ─── */
|
|
@@ -264,3 +268,19 @@ input::-webkit-credentials-auto-fill-button {
|
|
|
264
268
|
.fade-in {
|
|
265
269
|
animation-name: hai-fade-in;
|
|
266
270
|
}
|
|
271
|
+
|
|
272
|
+
/* 保留最终状态及动画结束事件,减少动态效果时不再播放装饰运动。 */
|
|
273
|
+
@media (prefers-reduced-motion: reduce) {
|
|
274
|
+
html {
|
|
275
|
+
scroll-behavior: auto;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
*,
|
|
279
|
+
*::before,
|
|
280
|
+
*::after {
|
|
281
|
+
animation-duration: 0.01ms !important;
|
|
282
|
+
animation-iteration-count: 1 !important;
|
|
283
|
+
transition-duration: 0.01ms !important;
|
|
284
|
+
scroll-behavior: auto !important;
|
|
285
|
+
}
|
|
286
|
+
}
|
package/dist/styles/theme.css
CHANGED
package/dist/theme-config.d.ts
CHANGED
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
import type { UIMessageKey } from './messages.js';
|
|
8
8
|
/**
|
|
9
9
|
* 主题信息
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import type { ThemeInfo } from '@h-ai/ui'
|
|
14
|
+
* const example: ThemeInfo = { id: 'light', name: 'Light', dark: false, primaryColor: '#2563eb', bgColor: '#ffffff' }
|
|
15
|
+
* ```
|
|
10
16
|
*/
|
|
11
17
|
export interface ThemeInfo {
|
|
12
18
|
/** 主题标识符 */
|
|
@@ -22,6 +28,12 @@ export interface ThemeInfo {
|
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* 主题色预设定义
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import type { ThemeColorPreset } from '@h-ai/ui'
|
|
35
|
+
* const example: ThemeColorPreset = { value: '#2563eb', labelKey: 'theme_color_ocean' }
|
|
36
|
+
* ```
|
|
25
37
|
*/
|
|
26
38
|
export interface ThemeColorPreset {
|
|
27
39
|
/** 颜色值(Hex) */
|
|
@@ -31,6 +43,12 @@ export interface ThemeColorPreset {
|
|
|
31
43
|
}
|
|
32
44
|
/**
|
|
33
45
|
* 主题分组
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import type { ThemeGroup } from '@h-ai/ui'
|
|
50
|
+
* const example: ThemeGroup = { id: 'light', nameKey: 'theme_group_light', themes: [{ id: 'light', name: 'Light', dark: false, primaryColor: '#2563eb', bgColor: '#ffffff' }] }
|
|
51
|
+
* ```
|
|
34
52
|
*/
|
|
35
53
|
export interface ThemeGroup {
|
|
36
54
|
/** 分组标识 */
|
|
@@ -42,58 +60,156 @@ export interface ThemeGroup {
|
|
|
42
60
|
}
|
|
43
61
|
/**
|
|
44
62
|
* DaisyUI 内置主题配置(精选)
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { THEMES } from '@h-ai/ui'
|
|
67
|
+
* const choices = THEMES.map(theme => ({ value: theme.id, label: theme.name }))
|
|
68
|
+
* ```
|
|
45
69
|
*/
|
|
46
70
|
export declare const THEMES: ThemeInfo[];
|
|
47
71
|
/**
|
|
48
72
|
* 主题分组配置
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { THEME_GROUPS } from '@h-ai/ui'
|
|
77
|
+
* const light = THEME_GROUPS.find(group => group.id === 'light')
|
|
78
|
+
* const choices = light?.themes
|
|
79
|
+
* ```
|
|
49
80
|
*/
|
|
50
81
|
export declare const THEME_GROUPS: ThemeGroup[];
|
|
51
82
|
/**
|
|
52
83
|
* 暗色主题列表
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { DARK_THEMES } from '@h-ai/ui'
|
|
88
|
+
* const dark = DARK_THEMES.includes('dark')
|
|
89
|
+
* ```
|
|
53
90
|
*/
|
|
54
91
|
export declare const DARK_THEMES: string[];
|
|
55
92
|
/**
|
|
56
93
|
* 支持的主题 ID 列表
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { SUPPORTED_THEME_IDS } from '@h-ai/ui'
|
|
98
|
+
* const supported = SUPPORTED_THEME_IDS.includes('light')
|
|
99
|
+
* ```
|
|
57
100
|
*/
|
|
58
101
|
export declare const SUPPORTED_THEME_IDS: string[];
|
|
59
102
|
/**
|
|
60
103
|
* 默认主题色
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { DEFAULT_THEME_COLOR } from '@h-ai/ui'
|
|
108
|
+
* const style = { '--brand-color': DEFAULT_THEME_COLOR }
|
|
109
|
+
* ```
|
|
61
110
|
*/
|
|
62
111
|
export declare const DEFAULT_THEME_COLOR = "#5765f0";
|
|
63
112
|
/**
|
|
64
113
|
* 主题色 CSS 变量名
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { DEFAULT_THEME_COLOR_CSS_VAR } from '@h-ai/ui'
|
|
118
|
+
* document.documentElement.style.setProperty(DEFAULT_THEME_COLOR_CSS_VAR, '#2563eb')
|
|
119
|
+
* ```
|
|
65
120
|
*/
|
|
66
121
|
export declare const DEFAULT_THEME_COLOR_CSS_VAR = "--hai-theme-color-default";
|
|
67
122
|
/**
|
|
68
123
|
* 内置主题色预设
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* import { THEME_COLOR_PRESETS } from '@h-ai/ui'
|
|
128
|
+
* const options = THEME_COLOR_PRESETS.map(preset => ({ value: preset.value, labelKey: preset.labelKey }))
|
|
129
|
+
* ```
|
|
69
130
|
*/
|
|
70
131
|
export declare const THEME_COLOR_PRESETS: ThemeColorPreset[];
|
|
71
132
|
/**
|
|
72
133
|
* 默认主题
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* import { DEFAULT_THEME, applyTheme } from '@h-ai/ui'
|
|
138
|
+
* applyTheme(DEFAULT_THEME, false)
|
|
139
|
+
* ```
|
|
73
140
|
*/
|
|
74
141
|
export declare const DEFAULT_THEME = "light";
|
|
75
142
|
/**
|
|
76
143
|
* 主题存储键名
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { THEME_STORAGE_KEY, getSavedTheme } from '@h-ai/ui'
|
|
148
|
+
* const preference = { key: THEME_STORAGE_KEY, value: getSavedTheme('light') }
|
|
149
|
+
* // 通过公开安全读取函数消费偏好,不直接访问受限存储。
|
|
150
|
+
* ```
|
|
77
151
|
*/
|
|
78
152
|
export declare const THEME_STORAGE_KEY = "theme";
|
|
79
153
|
/**
|
|
80
154
|
* 获取主题信息
|
|
155
|
+
* @param themeId - 主题候选 ID。
|
|
156
|
+
* @returns 匹配的主题元数据,不存在时返回 undefined。
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import { getThemeInfo } from '@h-ai/ui'
|
|
161
|
+
* const theme = getThemeInfo('light')
|
|
162
|
+
* const background = theme?.bgColor
|
|
163
|
+
* ```
|
|
81
164
|
*/
|
|
82
165
|
export declare function getThemeInfo(themeId: string): ThemeInfo | undefined;
|
|
83
166
|
/**
|
|
84
167
|
* 检查是否为暗色主题
|
|
168
|
+
* @param themeId - 主题候选 ID。
|
|
169
|
+
* @returns 是否属于内置暗色主题。
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* import { isDarkTheme } from '@h-ai/ui'
|
|
174
|
+
* const dark = isDarkTheme('dark')
|
|
175
|
+
* ```
|
|
85
176
|
*/
|
|
86
177
|
export declare function isDarkTheme(themeId: string): boolean;
|
|
87
178
|
/**
|
|
88
179
|
* 归一化主题 ID,不支持的值回退到默认主题。
|
|
180
|
+
* @param themeId - 主题候选 ID。
|
|
181
|
+
* @param fallbackThemeId - 候选不支持时尝试的主题。
|
|
182
|
+
* @returns 支持的主题 ID;无效输入按候选和默认主题回退。
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { normalizeThemeId } from '@h-ai/ui'
|
|
187
|
+
* const theme = normalizeThemeId('unknown-theme', 'light')
|
|
188
|
+
* ```
|
|
89
189
|
*/
|
|
90
190
|
export declare function normalizeThemeId(themeId: string | null | undefined, fallbackThemeId?: string): string;
|
|
91
191
|
/**
|
|
92
192
|
* 归一化 Hex 颜色;无效值返回 null。
|
|
193
|
+
* @param value - 待处理或校验的值。
|
|
194
|
+
* @returns 小写六位 Hex 颜色;无效输入返回 null。
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { normalizeHexColor } from '@h-ai/ui'
|
|
199
|
+
* const color = normalizeHexColor('#abc')
|
|
200
|
+
* ```
|
|
93
201
|
*/
|
|
94
202
|
export declare function normalizeHexColor(value: string | null | undefined): string | null;
|
|
95
203
|
/**
|
|
96
204
|
* 解析主题对应的浏览器色调。
|
|
205
|
+
* @param themeId - 主题候选 ID。
|
|
206
|
+
* @returns 供浏览器控件配色使用的 light/dark 值。
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* import { resolveThemeTone } from '@h-ai/ui'
|
|
211
|
+
* const tone = resolveThemeTone('dark')
|
|
212
|
+
* ```
|
|
97
213
|
*/
|
|
98
214
|
export declare function resolveThemeTone(themeId: string): 'light' | 'dark';
|
|
99
215
|
/**
|
|
@@ -101,6 +217,12 @@ export declare function resolveThemeTone(themeId: string): 'light' | 'dark';
|
|
|
101
217
|
*
|
|
102
218
|
* 业务侧如果把语言和主题一起落到同一个偏好对象里,可用这组配置在首屏阶段同步恢复语言值,
|
|
103
219
|
* 避免 HTML shell 和 hydrate 后的语言状态短暂不一致。
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* import type { ThemeBootstrapLocaleConfig } from '@h-ai/ui'
|
|
224
|
+
* const example: ThemeBootstrapLocaleConfig = { key: 'demo-locale', defaultValue: 'zh-CN', supportedValues: ['zh-CN', 'en-US'] }
|
|
225
|
+
* ```
|
|
104
226
|
*/
|
|
105
227
|
export interface ThemeBootstrapLocaleConfig {
|
|
106
228
|
/** 偏好对象中的语言字段名。 */
|
|
@@ -115,6 +237,12 @@ export interface ThemeBootstrapLocaleConfig {
|
|
|
115
237
|
*
|
|
116
238
|
* 这组配置刻意只保留“HTML shell 首屏恢复”所需的信息,避免把运行时 helper 或 UI 组件状态
|
|
117
239
|
* 泄漏到脚本字符串里,方便不同应用在 `app.html` / 服务端模板中复用同一套恢复逻辑。
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import type { ThemeBootstrapScriptOptions } from '@h-ai/ui'
|
|
244
|
+
* const example: ThemeBootstrapScriptOptions = { storageKey: 'demo-theme', defaultThemeId: 'light', defaultThemeColor: '#2563eb' }
|
|
245
|
+
* ```
|
|
118
246
|
*/
|
|
119
247
|
export interface ThemeBootstrapScriptOptions {
|
|
120
248
|
/** 偏好存储 key。 */
|
|
@@ -134,6 +262,15 @@ export interface ThemeBootstrapScriptOptions {
|
|
|
134
262
|
}
|
|
135
263
|
/**
|
|
136
264
|
* 生成首屏主题恢复脚本,适合注入到 SvelteKit `app.html` 的 `<script>` 中。
|
|
265
|
+
* @param options - 本次操作的行为与显示选项。
|
|
266
|
+
* @returns 可放入受控 HTML shell 的初始化脚本文本。
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* import { createThemeBootstrapScript } from '@h-ai/ui'
|
|
271
|
+
* const script = createThemeBootstrapScript({ storageKey: 'demo-theme', defaultThemeId: 'light' })
|
|
272
|
+
* // 在应用 HTML shell 中作为受控脚本使用,避免首屏主题闪烁。
|
|
273
|
+
* ```
|
|
137
274
|
*/
|
|
138
275
|
export declare function createThemeBootstrapScript(options: ThemeBootstrapScriptOptions): string;
|
|
139
276
|
/**
|
|
@@ -141,22 +278,51 @@ export declare function createThemeBootstrapScript(options: ThemeBootstrapScript
|
|
|
141
278
|
*
|
|
142
279
|
* 返回值是“脚本标签内的文本内容”,适合宿主在构建阶段或服务端模板中注入。
|
|
143
280
|
* 对于 SvelteKit `app.html`,请直接粘贴这段脚本字符串的内容,不能写 `{@html getThemeInitScript()}`。
|
|
281
|
+
* @returns 使用默认存储约定的主题初始化脚本。
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* import { getThemeInitScript } from '@h-ai/ui'
|
|
286
|
+
* const script = getThemeInitScript()
|
|
287
|
+
* ```
|
|
144
288
|
*/
|
|
145
289
|
export declare function getThemeInitScript(): string;
|
|
146
290
|
/**
|
|
147
291
|
* 应用主题
|
|
148
292
|
* @param theme - 主题 ID
|
|
149
293
|
* @param persist - 是否持久化到 localStorage
|
|
294
|
+
* @returns {void} 无返回值;更新当前文档,并按 persist 决定是否保存偏好。
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* import { applyTheme } from '@h-ai/ui'
|
|
299
|
+
* applyTheme('dark', false)
|
|
300
|
+
* // false 仅更新当前 DOM,不写入持久化偏好。
|
|
301
|
+
* ```
|
|
150
302
|
*/
|
|
151
303
|
export declare function applyTheme(theme: string, persist?: boolean): void;
|
|
152
304
|
/**
|
|
153
305
|
* 获取当前主题
|
|
306
|
+
* @returns 当前文档主题;无 DOM 时使用默认值。
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* import { getCurrentTheme } from '@h-ai/ui'
|
|
311
|
+
* const theme = getCurrentTheme()
|
|
312
|
+
* ```
|
|
154
313
|
*/
|
|
155
314
|
export declare function getCurrentTheme(): string;
|
|
156
315
|
/**
|
|
157
316
|
* 获取保存的主题;存储为空或不可用时使用宿主默认主题。
|
|
158
317
|
*
|
|
159
318
|
* @param fallbackTheme - 未保存主题时的默认值,默认 light
|
|
319
|
+
* @returns 安全读取并归一化的主题偏好。
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* import { getSavedTheme } from '@h-ai/ui'
|
|
324
|
+
* const theme = getSavedTheme('light')
|
|
325
|
+
* ```
|
|
160
326
|
*/
|
|
161
327
|
export declare function getSavedTheme(fallbackTheme?: string): string;
|
|
162
328
|
/**
|
|
@@ -168,5 +334,12 @@ export declare function getSavedTheme(fallbackTheme?: string): string;
|
|
|
168
334
|
* @plugin "daisyui" {
|
|
169
335
|
* themes: light --default, dark --prefersdark, cupcake, bumblebee, ...
|
|
170
336
|
* }
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* import { DAISYUI_THEMES_CONFIG } from '@h-ai/ui'
|
|
341
|
+
* const css = '@plugin "daisyui" { themes: ' + DAISYUI_THEMES_CONFIG + '; }'
|
|
342
|
+
* // 将生成的配置用于构建时 CSS,不在浏览器动态安装主题。
|
|
343
|
+
* ```
|
|
171
344
|
*/
|
|
172
345
|
export declare const DAISYUI_THEMES_CONFIG: string;
|