@h-ai/ui 0.1.0-alpha.73 → 0.1.0-alpha.75

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.
Files changed (76) hide show
  1. package/README.en.md +70 -7
  2. package/README.ja.md +71 -8
  3. package/README.md +72 -9
  4. package/auto-import.d.ts +4 -0
  5. package/auto-import.js +4 -0
  6. package/dist/components/compounds/Confirm.svelte +12 -2
  7. package/dist/components/compounds/Drawer.svelte +32 -14
  8. package/dist/components/compounds/FilterBar.svelte +77 -0
  9. package/dist/components/compounds/FilterBar.svelte.d.ts +39 -0
  10. package/dist/components/compounds/Modal.svelte +4 -37
  11. package/dist/components/compounds/PageHeader.svelte +18 -11
  12. package/dist/components/compounds/TableToolbar.svelte +1 -1
  13. package/dist/components/compounds/index.d.ts +1 -0
  14. package/dist/components/compounds/index.js +1 -0
  15. package/dist/components/primitives/Button.svelte +7 -0
  16. package/dist/components/primitives/Input.svelte +1 -1
  17. package/dist/components/primitives/Textarea.svelte +1 -1
  18. package/dist/components/scenes/app/FeedbackDetail.svelte +13 -3
  19. package/dist/components/scenes/app/FeedbackDetail.svelte.d.ts +6 -0
  20. package/dist/components/scenes/app/FeedbackForm.svelte +1 -1
  21. package/dist/components/scenes/app/FeedbackList.svelte +4 -4
  22. package/dist/components/scenes/app/SettingsLayout.svelte +4 -15
  23. package/dist/components/scenes/app/ThemeSelector.svelte +56 -16
  24. package/dist/components/scenes/app/WorkspaceLayout.svelte +64 -0
  25. package/dist/components/scenes/app/WorkspaceLayout.svelte.d.ts +36 -0
  26. package/dist/components/scenes/app/feedback-functions.d.ts +16 -0
  27. package/dist/components/scenes/app/feedback-functions.js +31 -0
  28. package/dist/components/scenes/app/index.d.ts +1 -0
  29. package/dist/components/scenes/app/index.js +1 -0
  30. package/dist/components/scenes/crud/CrudEditPanel.svelte +18 -9
  31. package/dist/components/scenes/crud/CrudFilterBar.svelte +39 -30
  32. package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +4 -1
  33. package/dist/components/scenes/crud/CrudPage.svelte +27 -7
  34. package/dist/components/scenes/crud/CrudPage.svelte.d.ts +1 -1
  35. package/dist/components/scenes/crud/crud-types.d.ts +1 -1
  36. package/dist/components/scenes/guide/GuideHost.svelte +22 -102
  37. package/dist/components/scenes/guide/GuideHost.svelte.d.ts +5 -13
  38. package/dist/components/scenes/guide/GuideHostContent.svelte +143 -0
  39. package/dist/components/scenes/guide/GuideHostContent.svelte.d.ts +43 -0
  40. package/dist/components/scenes/guide/HelpCenter.svelte +22 -9
  41. package/dist/components/scenes/iam/AuthPanel.svelte +7 -7
  42. package/dist/components/scenes/iam/AuthShell.svelte +6 -1
  43. package/dist/components/scenes/iam/AuthShell.svelte.d.ts +2 -0
  44. package/dist/components/scenes/iam/ChangePasswordForm.svelte +1 -1
  45. package/dist/components/scenes/iam/ForgotPasswordForm.svelte +1 -1
  46. package/dist/components/scenes/iam/LoginForm.svelte +29 -3
  47. package/dist/components/scenes/iam/PasswordInput.svelte +1 -1
  48. package/dist/components/scenes/iam/RegisterForm.svelte +1 -1
  49. package/dist/components/scenes/iam/SensitiveOperationsForm.svelte +70 -0
  50. package/dist/components/scenes/iam/SensitiveOperationsForm.svelte.d.ts +21 -0
  51. package/dist/components/scenes/iam/SessionRecoveryDialog.svelte +64 -0
  52. package/dist/components/scenes/iam/SessionRecoveryDialog.svelte.d.ts +22 -0
  53. package/dist/components/scenes/iam/index.d.ts +6 -0
  54. package/dist/components/scenes/iam/index.js +4 -0
  55. package/dist/components/scenes/iam/sensitive-actions.svelte.d.ts +68 -0
  56. package/dist/components/scenes/iam/sensitive-actions.svelte.js +100 -0
  57. package/dist/components/scenes/iam/session-recovery.svelte.d.ts +44 -0
  58. package/dist/components/scenes/iam/session-recovery.svelte.js +57 -0
  59. package/dist/components/scenes/types.d.ts +9 -0
  60. package/dist/guide.svelte.js +61 -26
  61. package/dist/internal/dialog-focus.d.ts +21 -0
  62. package/dist/internal/dialog-focus.js +77 -0
  63. package/dist/internal/form-validation.svelte.d.ts +2 -1
  64. package/dist/internal/form-validation.svelte.js +9 -1
  65. package/dist/messages/en-US.json +21 -4
  66. package/dist/messages/ja-JP.json +21 -4
  67. package/dist/messages/zh-CN.json +21 -4
  68. package/dist/styles/formal.css +55 -0
  69. package/dist/styles/high-contrast.css +64 -0
  70. package/dist/styles/theme.css +2 -0
  71. package/dist/theme-config.d.ts +2 -2
  72. package/dist/theme-config.js +5 -2
  73. package/dist/types.d.ts +4 -0
  74. package/dist/workspace-context.d.ts +20 -0
  75. package/dist/workspace-context.js +9 -0
  76. package/package.json +2 -2
@@ -29,13 +29,18 @@ function escapeGuideText(text) {
29
29
  })[character]);
30
30
  }
31
31
  function findTarget(step) {
32
- const element = typeof step.target === 'function'
33
- ? step.target()
34
- : [...document.querySelectorAll('[data-guide]')].find(item => item.getAttribute('data-guide') === step.target);
35
- if (!element?.isConnected || !element.getClientRects().length || element.closest('[hidden], [aria-hidden="true"]'))
32
+ try {
33
+ const element = typeof step.target === 'function'
34
+ ? step.target()
35
+ : [...document.querySelectorAll('[data-guide]')].find(item => item.getAttribute('data-guide') === step.target);
36
+ if (!element?.isConnected || !element.getClientRects().length || element.closest('[hidden], [aria-hidden="true"]'))
37
+ return null;
38
+ const style = getComputedStyle(element);
39
+ return style.visibility === 'hidden' || style.display === 'none' ? null : element;
40
+ }
41
+ catch {
36
42
  return null;
37
- const style = getComputedStyle(element);
38
- return style.visibility === 'hidden' || style.display === 'none' ? null : element;
43
+ }
39
44
  }
40
45
  /** 等待异步渲染、页签展开或布局变化,所有退出路径均清理监听和计时器。 */
41
46
  function waitForTarget(step, signal, timeout, ready) {
@@ -58,17 +63,28 @@ function waitForTarget(step, signal, timeout, ready) {
58
63
  finish(null);
59
64
  return;
60
65
  }
61
- const element = ready() ? findTarget(step) : null;
62
- if (element)
63
- finish(element);
66
+ try {
67
+ const element = ready() ? findTarget(step) : null;
68
+ if (element)
69
+ finish(element);
70
+ }
71
+ catch {
72
+ finish(null);
73
+ }
64
74
  };
65
75
  if (signal.aborted) {
66
76
  finish(null);
67
77
  return;
68
78
  }
69
- const initial = ready() ? findTarget(step) : null;
70
- if (initial) {
71
- finish(initial);
79
+ try {
80
+ const initial = ready() ? findTarget(step) : null;
81
+ if (initial) {
82
+ finish(initial);
83
+ return;
84
+ }
85
+ }
86
+ catch {
87
+ finish(null);
72
88
  return;
73
89
  }
74
90
  observer = new MutationObserver(check);
@@ -116,7 +132,14 @@ export function createGuide(options) {
116
132
  let targetObserver;
117
133
  const msg = (key) => uiM(key, undefined, locale);
118
134
  const progressKey = (id) => `${persistKey}:${scope}:${id}`;
119
- const tourFor = (id) => options.tours.find(tour => tour.id === id && (!tour.enabled || tour.enabled()));
135
+ const tourFor = (id) => {
136
+ try {
137
+ return options.tours.find(tour => tour.id === id && (!tour.enabled || tour.enabled()));
138
+ }
139
+ catch {
140
+ return undefined;
141
+ }
142
+ };
120
143
  function clearPending() {
121
144
  try {
122
145
  sessionStorage.removeItem(pendingKey);
@@ -183,7 +206,7 @@ export function createGuide(options) {
183
206
  helpOpen = false;
184
207
  const tour = tourFor(id);
185
208
  if (!tour?.steps.length) {
186
- error = 'guide_unavailable';
209
+ error ||= 'guide_unavailable';
187
210
  return false;
188
211
  }
189
212
  const run = generation;
@@ -339,16 +362,22 @@ export function createGuide(options) {
339
362
  }
340
363
  },
341
364
  onPopoverRender: (popover) => {
342
- // 第三方默认支持 HTML;业务翻译和插值统一按纯文本写入。
343
- const index = driver?.getActiveIndex() ?? 0;
344
- const step = tour.steps[index];
345
- popover.title.textContent = resolveGuideText(step?.title);
346
- popover.description.textContent = resolveGuideText(step?.description);
347
- popover.nextButton.textContent = msg(index === tour.steps.length - 1 ? 'guide_done' : 'guide_next');
348
- popover.previousButton.textContent = msg('guide_previous');
349
- popover.progress.textContent = uiM('guide_progress', { current: index + 1, total: tour.steps.length }, locale);
350
- popover.nextButton.disabled = busy;
351
- popover.previousButton.disabled = busy || !hasPreviousStep(index);
365
+ try {
366
+ // 第三方默认支持 HTML;业务翻译和插值统一按纯文本写入。
367
+ const index = driver?.getActiveIndex() ?? 0;
368
+ const step = tour.steps[index];
369
+ popover.title.textContent = resolveGuideText(step?.title);
370
+ popover.description.textContent = resolveGuideText(step?.description);
371
+ popover.nextButton.textContent = msg(index === tour.steps.length - 1 ? 'guide_done' : 'guide_next');
372
+ popover.previousButton.textContent = msg('guide_previous');
373
+ popover.progress.textContent = uiM('guide_progress', { current: index + 1, total: tour.steps.length }, locale);
374
+ popover.nextButton.disabled = busy;
375
+ popover.previousButton.disabled = busy || !hasPreviousStep(index);
376
+ }
377
+ catch {
378
+ error = 'guide_startFailed';
379
+ stop();
380
+ }
352
381
  },
353
382
  });
354
383
  const started = await showStep(0);
@@ -425,8 +454,14 @@ export function createGuide(options) {
425
454
  locale = value;
426
455
  const tour = activeTourId ? tourFor(activeTourId) : undefined;
427
456
  if (driver && tour) {
428
- driver.setConfig({ ...driver.getConfig(), ...translatedConfig(tour) });
429
- driver.drive(driver.getActiveIndex() ?? 0);
457
+ try {
458
+ driver.setConfig({ ...driver.getConfig(), ...translatedConfig(tour) });
459
+ driver.drive(driver.getActiveIndex() ?? 0);
460
+ }
461
+ catch {
462
+ error = 'guide_startFailed';
463
+ stop();
464
+ }
430
465
  }
431
466
  },
432
467
  setScope(value) {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 打开后优先聚焦可编辑字段,清理时取消首帧校准并恢复触发控件。
3
+ * @example 模块内部上下文
4
+ * ```ts
5
+ * function example(panel: HTMLElement) {
6
+ * const restore = focusDialog(panel)
7
+ * return restore
8
+ * }
9
+ * ```
10
+ */
11
+ export declare function focusDialog(panel: HTMLElement): () => void;
12
+ /**
13
+ * 原生 Tab 顺序只在边缘循环;嵌套弹层已处理的键盘事件不再拦截。
14
+ * @example 模块内部上下文
15
+ * ```ts
16
+ * function example(event: KeyboardEvent, panel: HTMLElement) {
17
+ * handleDialogKeydown(event, panel, () => {})
18
+ * }
19
+ * ```
20
+ */
21
+ export declare function handleDialogKeydown(event: KeyboardEvent, panel: HTMLElement, close?: () => void): void;
@@ -0,0 +1,77 @@
1
+ /** 弹窗和抽屉共享可见、可操作的焦点边界。 */
2
+ function focusable(panel) {
3
+ return [...panel.querySelectorAll('button, a[href], input:not([type="hidden"]), select, textarea, [tabindex]')]
4
+ .filter(element => element.tabIndex >= 0 && !element.matches(':disabled') && element.getClientRects().length > 0);
5
+ }
6
+ /**
7
+ * 打开后优先聚焦可编辑字段,清理时取消首帧校准并恢复触发控件。
8
+ * @example 模块内部上下文
9
+ * ```ts
10
+ * function example(panel: HTMLElement) {
11
+ * const restore = focusDialog(panel)
12
+ * return restore
13
+ * }
14
+ * ```
15
+ */
16
+ export function focusDialog(panel) {
17
+ const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
18
+ function preferred() {
19
+ const elements = focusable(panel);
20
+ return elements.find(element => element.matches('input:not([readonly]), textarea, select, [role="combobox"]')) ?? elements[0] ?? panel;
21
+ }
22
+ const initial = preferred();
23
+ initial.focus({ preventScroll: true });
24
+ function alignFocus() {
25
+ const active = document.activeElement;
26
+ if (panel.isConnected && (active === previous || active === initial || active === panel || active === document.body))
27
+ preferred().focus({ preventScroll: true });
28
+ }
29
+ function onTransition(event) {
30
+ if (event.target === panel)
31
+ alignFocus();
32
+ }
33
+ panel.addEventListener('transitionend', onTransition);
34
+ const frame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame(alignFocus) : undefined;
35
+ return () => {
36
+ panel.removeEventListener('transitionend', onTransition);
37
+ if (frame !== undefined)
38
+ cancelAnimationFrame(frame);
39
+ if (previous?.isConnected && !previous.matches(':disabled'))
40
+ previous.focus();
41
+ };
42
+ }
43
+ /**
44
+ * 原生 Tab 顺序只在边缘循环;嵌套弹层已处理的键盘事件不再拦截。
45
+ * @example 模块内部上下文
46
+ * ```ts
47
+ * function example(event: KeyboardEvent, panel: HTMLElement) {
48
+ * handleDialogKeydown(event, panel, () => {})
49
+ * }
50
+ * ```
51
+ */
52
+ export function handleDialogKeydown(event, panel, close) {
53
+ if (event.defaultPrevented)
54
+ return;
55
+ if (event.key === 'Escape' && close) {
56
+ event.preventDefault();
57
+ event.stopPropagation();
58
+ close();
59
+ }
60
+ else if (event.key === 'Tab') {
61
+ const elements = focusable(panel);
62
+ const first = elements[0];
63
+ const last = elements.at(-1);
64
+ if (!first) {
65
+ event.preventDefault();
66
+ panel.focus();
67
+ }
68
+ else if (event.shiftKey && (document.activeElement === first || document.activeElement === panel)) {
69
+ event.preventDefault();
70
+ last?.focus();
71
+ }
72
+ else if (!event.shiftKey && document.activeElement === last) {
73
+ event.preventDefault();
74
+ first.focus();
75
+ }
76
+ }
77
+ }
@@ -37,7 +37,7 @@ export declare function resolveFormText(text?: FormText): string;
37
37
  * 在组件初始化阶段创建原生约束校验状态;宿主关闭或表单 reset 时清除过期错误。
38
38
  * @param getOverride - 读取自定义校验提示的函数。
39
39
  * @param getValue - 读取当前控件值以跟踪程序回填的函数。
40
- * @returns 带响应式 message 和 validate/input/reset 方法的校验状态。
40
+ * @returns 带响应式 message 和 validate/blur/input/reset 方法的校验状态。
41
41
  *
42
42
  * @example 模块内部上下文
43
43
  * ```ts
@@ -52,6 +52,7 @@ export declare function resolveFormText(text?: FormText): string;
52
52
  export declare function createControlValidation(getOverride?: () => FormText | undefined, getValue?: () => unknown): {
53
53
  readonly message: string;
54
54
  validate(control: FormControl): void;
55
+ blur(control: FormControl): void;
55
56
  input(control: FormControl): void;
56
57
  reset: () => void;
57
58
  };
@@ -49,7 +49,7 @@ function readIssue(control) {
49
49
  * 在组件初始化阶段创建原生约束校验状态;宿主关闭或表单 reset 时清除过期错误。
50
50
  * @param getOverride - 读取自定义校验提示的函数。
51
51
  * @param getValue - 读取当前控件值以跟踪程序回填的函数。
52
- * @returns 带响应式 message 和 validate/input/reset 方法的校验状态。
52
+ * @returns 带响应式 message 和 validate/blur/input/reset 方法的校验状态。
53
53
  *
54
54
  * @example 模块内部上下文
55
55
  * ```ts
@@ -65,8 +65,10 @@ export function createControlValidation(getOverride = () => undefined, getValue)
65
65
  const visibility = getFormVisibilityContext();
66
66
  let issue = $state();
67
67
  let currentControl = $state();
68
+ let edited = false;
68
69
  function reset() {
69
70
  issue = undefined;
71
+ edited = false;
70
72
  currentControl?.setCustomValidity('');
71
73
  }
72
74
  $effect(() => {
@@ -101,7 +103,13 @@ export function createControlValidation(getOverride = () => undefined, getValue)
101
103
  issue = readIssue(control);
102
104
  control.setCustomValidity(issue ? resolveFormText(getOverride()) || uiM(issue.key, issue.params) : '');
103
105
  },
106
+ blur(control) {
107
+ // 默认焦点离开未输入的空字段时不挤动按钮/链接;提交仍由原生 invalid 校验。
108
+ if (edited || control.value || issue)
109
+ this.validate(control);
110
+ },
104
111
  input(control) {
112
+ edited = true;
105
113
  currentControl = control;
106
114
  control.setCustomValidity('');
107
115
  if (issue)
@@ -20,6 +20,7 @@
20
20
  "settings_close": "Close",
21
21
  "settings_language": "Language",
22
22
  "settings_theme": "Theme",
23
+ "theme_high_contrast": "High contrast",
23
24
  "combobox_no_match": "No match",
24
25
  "combobox_remove": "Remove",
25
26
  "data_table_actions": "Actions",
@@ -325,8 +326,9 @@
325
326
  "error_500_desc": "Something went wrong on our end. We're working on it, please try again later.",
326
327
  "error_503_title": "Under Maintenance",
327
328
  "error_503_desc": "The system is currently undergoing maintenance. Please check back soon.",
328
- "login_method_password": "Password",
329
+ "login_method_password": "Account & password",
329
330
  "login_method_ldap": "Organization",
331
+ "login_method_ldap_hint": "Use the account and password provided by your company or organization",
330
332
  "login_method_email": "Email code",
331
333
  "login_method_sms": "SMS code",
332
334
  "login_methods": "Login method",
@@ -423,6 +425,9 @@
423
425
  "feedback_processing": "Processing status",
424
426
  "feedback_collection": "Collection status",
425
427
  "feedback_notification": "Notification status",
428
+ "feedback_webhook": "Webhook",
429
+ "feedback_business": "Business evidence",
430
+ "feedback_attempts": "Attempts",
426
431
  "feedback_notification_pending": "Notification pending",
427
432
  "feedback_notification_sending": "Sending notification",
428
433
  "feedback_notification_sent": "Accepted by notification channel",
@@ -483,8 +488,20 @@
483
488
  "json_viewer_copied": "Copied",
484
489
  "auth_captcha_error": "Security check is incomplete or unavailable. Try again.",
485
490
  "auth_captcha_verifying": "Verifying security challenge",
486
- "reauthentication_title": "Confirm sensitive action",
487
- "reauthentication_hint": "Enter your current password to continue this action.",
491
+ "reauthentication_title": "Verify your identity again",
492
+ "reauthentication_hint": "You are signed in. Enter this account's password again to continue this sensitive action. Canceling will not submit it.",
488
493
  "reauthentication_password": "Current password",
489
- "reauthentication_confirm": "Verify and continue"
494
+ "reauthentication_confirm": "Verify and continue",
495
+ "session_recovery_title": "Session expired — sign in again",
496
+ "session_recovery_hint": "Your page and input are preserved. Sign in to the same account using the normal controls to continue the rejected operation.",
497
+ "session_recovery_later": "Sign in later",
498
+ "session_recovery_account_error": "Sign in to the original account. The pending action has not continued.",
499
+ "sensitive_operations_label": "Operation IDs requiring reauthentication",
500
+ "sensitive_operations_hint": "One operation ID per line, matching the server guard. Database and file rules are combined. Clearing removes only this permission’s rules. The master switch must be enabled.",
501
+ "sensitive_operations_invalid": "Use at most 1000 operation IDs, each no longer than 128 characters.",
502
+ "filter_bar_expand": "Expand filters",
503
+ "filter_bar_collapse": "Collapse filters",
504
+ "filter_bar_active": "Active filters: {count}",
505
+ "theme_formal": "Formal",
506
+ "keyboard_submit_enter": "Press Enter in a single-line field to submit"
490
507
  }
@@ -20,6 +20,7 @@
20
20
  "settings_close": "閉じる",
21
21
  "settings_language": "言語",
22
22
  "settings_theme": "テーマ",
23
+ "theme_high_contrast": "ハイコントラスト",
23
24
  "combobox_no_match": "一致する項目がありません",
24
25
  "combobox_remove": "削除",
25
26
  "data_table_actions": "操作",
@@ -325,8 +326,9 @@
325
326
  "error_500_desc": "サーバー側で問題が発生しました。しばらくしてから再試行してください。",
326
327
  "error_503_title": "メンテナンス中",
327
328
  "error_503_desc": "現在システムのメンテナンスを行っています。しばらくしてからアクセスしてください。",
328
- "login_method_password": "パスワード",
329
+ "login_method_password": "アカウントとパスワード",
329
330
  "login_method_ldap": "組織アカウント",
331
+ "login_method_ldap_hint": "会社や組織から提供されたアカウントとパスワードを使用します",
330
332
  "login_method_email": "メール認証コード",
331
333
  "login_method_sms": "SMS認証コード",
332
334
  "login_methods": "ログイン方法",
@@ -423,6 +425,9 @@
423
425
  "feedback_processing": "処理状況",
424
426
  "feedback_collection": "収集状況",
425
427
  "feedback_notification": "通知状況",
428
+ "feedback_webhook": "Webhook コールバック",
429
+ "feedback_business": "業務情報",
430
+ "feedback_attempts": "試行回数",
426
431
  "feedback_notification_pending": "通知待ち",
427
432
  "feedback_notification_sending": "送信中",
428
433
  "feedback_notification_sent": "通知チャネルで受理済み",
@@ -483,8 +488,20 @@
483
488
  "json_viewer_copied": "コピーしました",
484
489
  "auth_captcha_error": "セキュリティ確認が未完了または利用できません。再試行してください",
485
490
  "auth_captcha_verifying": "セキュリティ確認中",
486
- "reauthentication_title": "重要な操作の確認",
487
- "reauthentication_hint": "この操作を続けるには現在のパスワードを入力してください。",
491
+ "reauthentication_title": "本人確認を再実行",
492
+ "reauthentication_hint": "現在のアカウントでログイン済みです。この重要な操作を続けるには、同じアカウントのパスワードを再入力してください。キャンセルすると操作は送信されません。",
488
493
  "reauthentication_password": "現在のパスワード",
489
- "reauthentication_confirm": "認証して続行"
494
+ "reauthentication_confirm": "認証して続行",
495
+ "session_recovery_title": "セッションの期限切れ・再ログイン",
496
+ "session_recovery_hint": "ページと入力内容を保持しています。通常の認証で元のアカウントにログインすると、拒否された操作を続けます。",
497
+ "session_recovery_later": "後でログイン",
498
+ "session_recovery_account_error": "元のアカウントでログインしてください。操作はまだ続行していません。",
499
+ "sensitive_operations_label": "再認証が必要な操作 ID",
500
+ "sensitive_operations_hint": "サーバーのガードと一致する操作 ID を1行ずつ入力します。DB とファイルの規則は和集合です。空欄はこの権限の規則だけを削除します。主スイッチが有効な場合に適用されます。",
501
+ "sensitive_operations_invalid": "操作 ID は最大1000件、各128文字以内です。",
502
+ "filter_bar_expand": "絞り込みを展開",
503
+ "filter_bar_collapse": "絞り込みを折りたたむ",
504
+ "filter_bar_active": "適用中の条件:{count}件",
505
+ "theme_formal": "ビジネス(角丸なし)",
506
+ "keyboard_submit_enter": "1行の入力欄で Enter を押して送信"
490
507
  }
@@ -20,6 +20,7 @@
20
20
  "settings_close": "关闭",
21
21
  "settings_language": "语言",
22
22
  "settings_theme": "主题",
23
+ "theme_high_contrast": "高对比",
23
24
  "combobox_no_match": "无匹配结果",
24
25
  "combobox_remove": "移除",
25
26
  "data_table_actions": "操作",
@@ -325,8 +326,9 @@
325
326
  "error_500_desc": "服务器出现了一些问题。我们正在处理,请稍后重试。",
326
327
  "error_503_title": "服务维护中",
327
328
  "error_503_desc": "系统正在维护升级,请稍后再访问。",
328
- "login_method_password": "密码",
329
+ "login_method_password": "账号密码",
329
330
  "login_method_ldap": "企业账号",
331
+ "login_method_ldap_hint": "使用公司或组织提供的账号和密码",
330
332
  "login_method_email": "邮件验证码",
331
333
  "login_method_sms": "短信验证码",
332
334
  "login_methods": "登录方式",
@@ -423,6 +425,9 @@
423
425
  "feedback_processing": "处理状态",
424
426
  "feedback_collection": "采集状态",
425
427
  "feedback_notification": "通知状态",
428
+ "feedback_webhook": "Webhook 回调",
429
+ "feedback_business": "业务信息",
430
+ "feedback_attempts": "尝试次数",
426
431
  "feedback_notification_pending": "等待通知",
427
432
  "feedback_notification_sending": "正在发送",
428
433
  "feedback_notification_sent": "通知通道已受理",
@@ -483,8 +488,20 @@
483
488
  "json_viewer_copied": "已复制",
484
489
  "auth_captcha_error": "安全验证未完成或暂不可用,请重试",
485
490
  "auth_captcha_verifying": "正在进行安全验证",
486
- "reauthentication_title": "确认敏感操作",
487
- "reauthentication_hint": "请输入当前密码以继续本次操作。",
491
+ "reauthentication_title": "二次身份验证",
492
+ "reauthentication_hint": "当前账号已登录。请再次输入当前账号的密码,验证后继续本次敏感操作;取消不会提交操作。",
488
493
  "reauthentication_password": "当前密码",
489
- "reauthentication_confirm": "验证并继续"
494
+ "reauthentication_confirm": "验证并继续",
495
+ "session_recovery_title": "会话已过期,请重新登录",
496
+ "session_recovery_hint": "当前页面和输入已保留。请按正常登录流程验证原账号,成功后继续刚才未提交的操作。",
497
+ "session_recovery_later": "稍后登录",
498
+ "session_recovery_account_error": "请使用原账号完成登录,当前操作尚未继续。",
499
+ "sensitive_operations_label": "需要重新认证的操作 ID",
500
+ "sensitive_operations_hint": "每行一个操作 ID,与服务端守卫一致。数据库与文件配置取并集;清空只移除本权限的规则。主开关关闭时不要求二次认证。",
501
+ "sensitive_operations_invalid": "最多 1000 项,每个操作 ID 不超过 128 字符。",
502
+ "filter_bar_expand": "展开筛选",
503
+ "filter_bar_collapse": "收起筛选",
504
+ "filter_bar_active": "已启用 {count} 项筛选",
505
+ "theme_formal": "简洁商务",
506
+ "keyboard_submit_enter": "在单行输入框中按 Enter 提交"
490
507
  }
@@ -0,0 +1,55 @@
1
+ /* 直角商务主题:语义色和圆角统一由共享主题控制。 */
2
+ [data-theme='formal'] {
3
+ color-scheme: light;
4
+ color: #132238;
5
+ background-color: #ffffff;
6
+ --color-base-100: #ffffff;
7
+ --color-base-200: #f5f7fa;
8
+ --color-base-300: #e1e6ed;
9
+ --color-base-content: #132238;
10
+ --color-primary: #123d70;
11
+ --color-primary-content: #ffffff;
12
+ --color-secondary: #45556c;
13
+ --color-secondary-content: #ffffff;
14
+ --color-accent: #126342;
15
+ --color-accent-content: #ffffff;
16
+ --color-neutral: #25354a;
17
+ --color-neutral-content: #ffffff;
18
+ --color-info: #155d91;
19
+ --color-info-content: #ffffff;
20
+ --color-success: #126342;
21
+ --color-success-content: #ffffff;
22
+ --color-warning: #6b4b00;
23
+ --color-warning-content: #ffffff;
24
+ --color-error: #b42318;
25
+ --color-error-content: #ffffff;
26
+ --radius-selector: 0;
27
+ --radius-field: 0;
28
+ --radius-box: 0;
29
+ --hai-radius-sm: 0;
30
+ --hai-radius-md: 0;
31
+ --hai-radius-lg: 0;
32
+ --hai-radius-full: 0;
33
+ --size-selector: 0.25rem;
34
+ --size-field: 0.25rem;
35
+ --border: 1px;
36
+ --depth: 0;
37
+ --noise: 0;
38
+ --hai-focus-color: #123d70;
39
+ }
40
+
41
+ /* 覆盖组件中的显式 rounded 类;单选指示和加载图形保留其交互含义。 */
42
+ [data-theme='formal'] :is([class*='rounded-'], .btn, .input, .select, .textarea, .card, .modal-box, .alert),
43
+ [data-theme='formal'] :focus-visible {
44
+ border-radius: 0;
45
+ }
46
+
47
+ [data-theme='formal'] :is([class^='text-base-content/'], [class*=' text-base-content/']),
48
+ [data-theme='formal'] .table th {
49
+ color: #4b5563;
50
+ }
51
+
52
+ [data-theme='formal'] :is(input, textarea)::placeholder {
53
+ color: #4b5563;
54
+ opacity: 1;
55
+ }
@@ -0,0 +1,64 @@
1
+ /* 共享高对比主题随 theme.css 发布,不依赖 DaisyUI 的内置主题名单。 */
2
+ [data-theme='high-contrast'] {
3
+ color-scheme: dark;
4
+ color: #ffffff;
5
+ background-color: #000000;
6
+ --color-base-100: #000000;
7
+ --color-base-200: #121212;
8
+ --color-base-300: #242424;
9
+ --color-base-content: #ffffff;
10
+ --color-primary: #ffe04d;
11
+ --color-primary-content: #111111;
12
+ --color-secondary: #80d4ff;
13
+ --color-secondary-content: #111111;
14
+ --color-accent: #9df3c4;
15
+ --color-accent-content: #111111;
16
+ --color-neutral: #dce5f0;
17
+ --color-neutral-content: #111111;
18
+ --color-info: #80d4ff;
19
+ --color-info-content: #111111;
20
+ --color-success: #9df3c4;
21
+ --color-success-content: #111111;
22
+ --color-warning: #ffe04d;
23
+ --color-warning-content: #111111;
24
+ --color-error: #ffb4ab;
25
+ --color-error-content: #111111;
26
+ --radius-selector: 0.375rem;
27
+ --radius-field: 0.375rem;
28
+ --radius-box: 0.5rem;
29
+ --size-selector: 0.25rem;
30
+ --size-field: 0.25rem;
31
+ --border: 2px;
32
+ --depth: 0;
33
+ --noise: 0;
34
+ --hai-focus-color: #ffe04d;
35
+ }
36
+
37
+ /* 低透明度的次要正文在此主题中保持可读,伪类和占位符类不误匹配。 */
38
+ [data-theme='high-contrast'] :is([class^='text-base-content/'], [class*=' text-base-content/']),
39
+ [data-theme='high-contrast'] .table th {
40
+ color: #e5e7eb;
41
+ }
42
+
43
+ [data-theme='high-contrast'] :is([class^='border-base-content/'], [class*=' border-base-content/']) {
44
+ border-color: #b5c1cf;
45
+ }
46
+
47
+ [data-theme='high-contrast'] :is(input, textarea)::placeholder {
48
+ color: #dce5f0;
49
+ opacity: 1;
50
+ }
51
+
52
+ [data-theme='high-contrast'] :focus-visible {
53
+ outline: 3px solid #ffe04d;
54
+ outline-offset: 3px;
55
+ }
56
+
57
+ [data-theme='high-contrast'] a:not(.btn) {
58
+ text-decoration: underline;
59
+ text-underline-offset: 0.15em;
60
+ }
61
+
62
+ [data-theme='high-contrast'] ::-webkit-scrollbar-thumb {
63
+ background: #b5c1cf;
64
+ }
@@ -12,6 +12,8 @@
12
12
  */
13
13
 
14
14
  @import './design-tokens.css';
15
+ @import './high-contrast.css';
16
+ @import './formal.css';
15
17
 
16
18
  :root {
17
19
  --hai-theme-color-default: #5765f0;
@@ -59,7 +59,7 @@ export interface ThemeGroup {
59
59
  themes: ThemeInfo[];
60
60
  }
61
61
  /**
62
- * DaisyUI 内置主题配置(精选)
62
+ * 精选 DaisyUI 主题及 UI 共享样式提供的高对比、直角商务主题。
63
63
  *
64
64
  * @example
65
65
  * ```ts
@@ -288,7 +288,7 @@ export declare function createThemeBootstrapScript(options: ThemeBootstrapScript
288
288
  */
289
289
  export declare function getThemeInitScript(): string;
290
290
  /**
291
- * 应用主题
291
+ * 应用主题,并同步原生表单控件配色;自定义主题由宿主 CSS 决定配色。
292
292
  * @param theme - 主题 ID
293
293
  * @param persist - 是否持久化到 localStorage
294
294
  * @returns {void} 无返回值;更新当前文档,并按 persist 决定是否保存偏好。
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { readStoredValue, writeStoredValue } from './internal/browser-safety.js';
8
8
  /**
9
- * DaisyUI 内置主题配置(精选)
9
+ * 精选 DaisyUI 主题及 UI 共享样式提供的高对比、直角商务主题。
10
10
  *
11
11
  * @example
12
12
  * ```ts
@@ -23,6 +23,7 @@ export const THEMES = [
23
23
  { id: 'lofi', name: 'Lo-Fi', dark: false, primaryColor: '#0d0d0d', bgColor: '#ffffff' },
24
24
  { id: 'winter', name: 'Winter', dark: false, primaryColor: '#047aff', bgColor: '#ffffff' },
25
25
  { id: 'nord', name: 'Nord', dark: false, primaryColor: '#5e81ac', bgColor: '#eceff4' },
26
+ { id: 'formal', name: 'Formal', dark: false, primaryColor: '#123d70', bgColor: '#ffffff' },
26
27
  // 暗色主题
27
28
  { id: 'dark', name: 'Dark', dark: true, primaryColor: '#661ae6', bgColor: '#1d232a' },
28
29
  { id: 'dracula', name: 'Dracula', dark: true, primaryColor: '#ff79c6', bgColor: '#282a36' },
@@ -32,6 +33,7 @@ export const THEMES = [
32
33
  { id: 'sunset', name: 'Sunset', dark: true, primaryColor: '#ff865b', bgColor: '#1a1919' },
33
34
  { id: 'luxury', name: 'Luxury', dark: true, primaryColor: '#c9a53d', bgColor: '#171618' },
34
35
  { id: 'coffee', name: 'Coffee', dark: true, primaryColor: '#db924b', bgColor: '#20161f' },
36
+ { id: 'high-contrast', name: 'High contrast', dark: true, primaryColor: '#ffe04d', bgColor: '#000000' },
35
37
  ];
36
38
  /**
37
39
  * 主题分组配置
@@ -278,7 +280,7 @@ export function getThemeInitScript() {
278
280
  });
279
281
  }
280
282
  /**
281
- * 应用主题
283
+ * 应用主题,并同步原生表单控件配色;自定义主题由宿主 CSS 决定配色。
282
284
  * @param theme - 主题 ID
283
285
  * @param persist - 是否持久化到 localStorage
284
286
  * @returns {void} 无返回值;更新当前文档,并按 persist 决定是否保存偏好。
@@ -294,6 +296,7 @@ export function applyTheme(theme, persist = true) {
294
296
  if (typeof document === 'undefined')
295
297
  return;
296
298
  document.documentElement.setAttribute('data-theme', theme);
299
+ document.documentElement.style.setProperty('color-scheme', getThemeInfo(theme) ? resolveThemeTone(theme) : '');
297
300
  if (persist) {
298
301
  writeStoredValue(THEME_STORAGE_KEY, theme);
299
302
  }
package/dist/types.d.ts CHANGED
@@ -102,6 +102,8 @@ export interface ButtonProps extends DataAttributes {
102
102
  circle?: boolean;
103
103
  /** 按钮类型 */
104
104
  type?: 'button' | 'submit' | 'reset';
105
+ /** type=submit 时显示原生表单 Enter 提示;不注册全局快捷键。 */
106
+ submitHint?: boolean;
105
107
  /** 点击事件 */
106
108
  onclick?: (e: MouseEvent) => void;
107
109
  /** 子内容 */
@@ -713,6 +715,8 @@ export interface DrawerProps extends DataAttributes {
713
715
  widthStorageKey?: string;
714
716
  /** 是否可通过点击遮罩关闭 */
715
717
  closeOnBackdrop?: boolean;
718
+ /** 是否允许 Esc 关闭;提交期间可显式关闭。 */
719
+ closeOnEscape?: boolean;
716
720
  /** 是否显示关闭按钮 */
717
721
  showClose?: boolean;
718
722
  /** 自定义类名 */