@h-ai/ui 0.1.0-alpha9 → 1.0.0-beta.10

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 (380) hide show
  1. package/README.en.md +1062 -0
  2. package/README.ja.md +1062 -0
  3. package/README.md +696 -119
  4. package/auto-import.d.ts +49 -0
  5. package/auto-import.js +51 -69
  6. package/dist/components/compounds/Accordion.svelte +30 -3
  7. package/dist/components/compounds/Accordion.svelte.d.ts +37 -1
  8. package/dist/components/compounds/ActionSheet.svelte +35 -8
  9. package/dist/components/compounds/ActionSheet.svelte.d.ts +41 -1
  10. package/dist/components/compounds/Alert.svelte +24 -15
  11. package/dist/components/compounds/Alert.svelte.d.ts +14 -3
  12. package/dist/components/compounds/AppBar.svelte +37 -9
  13. package/dist/components/compounds/AppBar.svelte.d.ts +36 -1
  14. package/dist/components/compounds/BottomNav.svelte +68 -8
  15. package/dist/components/compounds/BottomNav.svelte.d.ts +51 -1
  16. package/dist/components/compounds/Breadcrumb.svelte +18 -5
  17. package/dist/components/compounds/Breadcrumb.svelte.d.ts +23 -2
  18. package/dist/components/compounds/Calendar.svelte +31 -12
  19. package/dist/components/compounds/Calendar.svelte.d.ts +23 -7
  20. package/dist/components/compounds/Card.svelte +17 -5
  21. package/dist/components/compounds/Card.svelte.d.ts +13 -2
  22. package/dist/components/compounds/Combobox.svelte +124 -42
  23. package/dist/components/compounds/Combobox.svelte.d.ts +42 -20
  24. package/dist/components/compounds/Confirm.svelte +32 -9
  25. package/dist/components/compounds/Confirm.svelte.d.ts +24 -2
  26. package/dist/components/compounds/DataTable.svelte +317 -33
  27. package/dist/components/compounds/DataTable.svelte.d.ts +28 -14
  28. package/dist/components/compounds/DatePicker.svelte +62 -18
  29. package/dist/components/compounds/DatePicker.svelte.d.ts +27 -8
  30. package/dist/components/compounds/Drawer.svelte +179 -22
  31. package/dist/components/compounds/Drawer.svelte.d.ts +24 -2
  32. package/dist/components/compounds/Dropdown.svelte +19 -5
  33. package/dist/components/compounds/Dropdown.svelte.d.ts +13 -2
  34. package/dist/components/compounds/Empty.svelte +22 -9
  35. package/dist/components/compounds/Empty.svelte.d.ts +23 -2
  36. package/dist/components/compounds/FilterBar.svelte +82 -0
  37. package/dist/components/compounds/FilterBar.svelte.d.ts +39 -0
  38. package/dist/components/compounds/Form.svelte +59 -16
  39. package/dist/components/compounds/Form.svelte.d.ts +23 -2
  40. package/dist/components/compounds/FormField.svelte +99 -16
  41. package/dist/components/compounds/FormField.svelte.d.ts +23 -2
  42. package/dist/components/compounds/FormLayout.svelte +71 -0
  43. package/dist/components/compounds/FormLayout.svelte.d.ts +17 -0
  44. package/dist/components/compounds/InfiniteScroll.svelte +34 -7
  45. package/dist/components/compounds/InfiniteScroll.svelte.d.ts +37 -1
  46. package/dist/components/compounds/JsonViewer.svelte +214 -0
  47. package/dist/components/compounds/JsonViewer.svelte.d.ts +26 -0
  48. package/dist/components/compounds/MessageBoxContainer.svelte +34 -0
  49. package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +25 -0
  50. package/dist/components/compounds/MessageBoxDialog.svelte +209 -0
  51. package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +29 -0
  52. package/dist/components/compounds/MessageContainer.svelte +24 -0
  53. package/dist/components/compounds/MessageContainer.svelte.d.ts +18 -0
  54. package/dist/components/compounds/Modal.svelte +348 -73
  55. package/dist/components/compounds/Modal.svelte.d.ts +13 -2
  56. package/dist/components/compounds/PageHeader.svelte +44 -20
  57. package/dist/components/compounds/PageHeader.svelte.d.ts +24 -9
  58. package/dist/components/compounds/Pagination.svelte +139 -105
  59. package/dist/components/compounds/Pagination.svelte.d.ts +23 -2
  60. package/dist/components/compounds/Popover.svelte +124 -25
  61. package/dist/components/compounds/Popover.svelte.d.ts +23 -2
  62. package/dist/components/compounds/PullRefresh.svelte +35 -8
  63. package/dist/components/compounds/PullRefresh.svelte.d.ts +35 -1
  64. package/dist/components/compounds/Result.svelte +17 -4
  65. package/dist/components/compounds/Result.svelte.d.ts +23 -2
  66. package/dist/components/compounds/SafeArea.svelte +30 -3
  67. package/dist/components/compounds/SafeArea.svelte.d.ts +35 -1
  68. package/dist/components/compounds/Skeleton.svelte +19 -7
  69. package/dist/components/compounds/Skeleton.svelte.d.ts +13 -2
  70. package/dist/components/compounds/Steps.svelte +17 -4
  71. package/dist/components/compounds/Steps.svelte.d.ts +23 -2
  72. package/dist/components/compounds/SwipeCell.svelte +30 -3
  73. package/dist/components/compounds/SwipeCell.svelte.d.ts +40 -1
  74. package/dist/components/compounds/TableToolbar.svelte +289 -0
  75. package/dist/components/compounds/TableToolbar.svelte.d.ts +69 -0
  76. package/dist/components/compounds/Tabs.svelte +84 -14
  77. package/dist/components/compounds/Tabs.svelte.d.ts +13 -2
  78. package/dist/components/compounds/TagInput.svelte +51 -33
  79. package/dist/components/compounds/TagInput.svelte.d.ts +23 -2
  80. package/dist/components/compounds/Timeline.svelte +30 -3
  81. package/dist/components/compounds/Timeline.svelte.d.ts +37 -1
  82. package/dist/components/compounds/ToastContainer.svelte +397 -28
  83. package/dist/components/compounds/ToastContainer.svelte.d.ts +27 -1
  84. package/dist/components/compounds/Tooltip.svelte +143 -9
  85. package/dist/components/compounds/Tooltip.svelte.d.ts +25 -2
  86. package/dist/components/compounds/accordion-types.d.ts +10 -1
  87. package/dist/components/compounds/action-sheet-types.d.ts +9 -0
  88. package/dist/components/compounds/bottom-nav-types.d.ts +9 -0
  89. package/dist/components/compounds/index.d.ts +7 -0
  90. package/dist/components/compounds/index.js +11 -0
  91. package/dist/components/compounds/swipe-cell-types.d.ts +9 -0
  92. package/dist/components/compounds/timeline-types.d.ts +9 -0
  93. package/dist/components/control-size.d.ts +35 -0
  94. package/dist/components/control-size.js +26 -0
  95. package/dist/components/primitives/Avatar.svelte +19 -5
  96. package/dist/components/primitives/Avatar.svelte.d.ts +13 -2
  97. package/dist/components/primitives/Badge.svelte +16 -4
  98. package/dist/components/primitives/Badge.svelte.d.ts +13 -2
  99. package/dist/components/primitives/BareButton.svelte +26 -12
  100. package/dist/components/primitives/BareButton.svelte.d.ts +23 -2
  101. package/dist/components/primitives/BareInput.svelte +57 -35
  102. package/dist/components/primitives/BareInput.svelte.d.ts +23 -2
  103. package/dist/components/primitives/Button.svelte +30 -9
  104. package/dist/components/primitives/Button.svelte.d.ts +13 -2
  105. package/dist/components/primitives/Checkbox.svelte +24 -5
  106. package/dist/components/primitives/Checkbox.svelte.d.ts +23 -2
  107. package/dist/components/primitives/IconButton.svelte +35 -10
  108. package/dist/components/primitives/IconButton.svelte.d.ts +23 -2
  109. package/dist/components/primitives/Input.svelte +56 -26
  110. package/dist/components/primitives/Input.svelte.d.ts +13 -2
  111. package/dist/components/primitives/Progress.svelte +17 -4
  112. package/dist/components/primitives/Progress.svelte.d.ts +23 -2
  113. package/dist/components/primitives/Radio.svelte +17 -4
  114. package/dist/components/primitives/Radio.svelte.d.ts +22 -2
  115. package/dist/components/primitives/Range.svelte +31 -4
  116. package/dist/components/primitives/Range.svelte.d.ts +37 -1
  117. package/dist/components/primitives/Rating.svelte +32 -5
  118. package/dist/components/primitives/Rating.svelte.d.ts +37 -1
  119. package/dist/components/primitives/Select.svelte +404 -47
  120. package/dist/components/primitives/Select.svelte.d.ts +23 -2
  121. package/dist/components/primitives/Spinner.svelte +17 -4
  122. package/dist/components/primitives/Spinner.svelte.d.ts +23 -2
  123. package/dist/components/primitives/Switch.svelte +22 -4
  124. package/dist/components/primitives/Switch.svelte.d.ts +23 -2
  125. package/dist/components/primitives/Tag.svelte +17 -4
  126. package/dist/components/primitives/Tag.svelte.d.ts +23 -2
  127. package/dist/components/primitives/Textarea.svelte +75 -30
  128. package/dist/components/primitives/Textarea.svelte.d.ts +24 -2
  129. package/dist/components/primitives/ToggleCheckbox.svelte +24 -10
  130. package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +23 -2
  131. package/dist/components/primitives/ToggleInput.svelte +24 -10
  132. package/dist/components/primitives/ToggleInput.svelte.d.ts +23 -2
  133. package/dist/components/primitives/ToggleRadio.svelte +24 -10
  134. package/dist/components/primitives/ToggleRadio.svelte.d.ts +23 -2
  135. package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +54 -23
  136. package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +30 -1
  137. package/dist/components/scenes/ai/AiDocumentEditor.svelte +3428 -693
  138. package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +26 -1
  139. package/dist/components/scenes/ai/MarkdownRenderer.svelte +119 -116
  140. package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +31 -1
  141. package/dist/components/scenes/ai/code-preview.d.ts +46 -0
  142. package/dist/components/scenes/ai/code-preview.js +141 -0
  143. package/dist/components/scenes/ai/document-download.d.ts +52 -0
  144. package/dist/components/scenes/ai/document-download.js +300 -79
  145. package/dist/components/scenes/ai/document-parse.d.ts +101 -11
  146. package/dist/components/scenes/ai/document-parse.js +212 -48
  147. package/dist/components/scenes/ai/document-types.d.ts +292 -75
  148. package/dist/components/scenes/ai/editor-markdown-extensions.d.ts +27 -0
  149. package/dist/components/scenes/ai/editor-markdown-extensions.js +216 -0
  150. package/dist/components/scenes/ai/highlight.d.ts +37 -0
  151. package/dist/components/scenes/ai/highlight.js +177 -0
  152. package/dist/components/scenes/ai/index.d.ts +5 -2
  153. package/dist/components/scenes/ai/index.js +3 -0
  154. package/dist/components/scenes/ai/markdown-parse.d.ts +11 -3
  155. package/dist/components/scenes/ai/markdown-parse.js +85 -47
  156. package/dist/components/scenes/ai/mermaid-host-sync.d.ts +72 -0
  157. package/dist/components/scenes/ai/mermaid-host-sync.js +65 -0
  158. package/dist/components/scenes/ai/mermaid-render.d.ts +30 -0
  159. package/dist/components/scenes/ai/mermaid-render.js +61 -0
  160. package/dist/components/scenes/ai/safe-html.d.ts +64 -0
  161. package/dist/components/scenes/ai/safe-html.js +345 -0
  162. package/dist/components/scenes/ai/table/AiTableEditor.svelte +1692 -0
  163. package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +32 -0
  164. package/dist/components/scenes/ai/table/table-types.d.ts +181 -0
  165. package/dist/components/scenes/ai/table/table-types.js +1 -0
  166. package/dist/components/scenes/app/FeedbackDetail.svelte +236 -0
  167. package/dist/components/scenes/app/FeedbackDetail.svelte.d.ts +40 -0
  168. package/dist/components/scenes/app/FeedbackForm.svelte +337 -0
  169. package/dist/components/scenes/app/FeedbackForm.svelte.d.ts +72 -0
  170. package/dist/components/scenes/app/FeedbackList.svelte +150 -0
  171. package/dist/components/scenes/app/FeedbackList.svelte.d.ts +28 -0
  172. package/dist/components/scenes/app/FeedbackModal.svelte +65 -139
  173. package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +14 -39
  174. package/dist/components/scenes/app/FeedbackRecorder.svelte +154 -0
  175. package/dist/components/scenes/app/FeedbackRecorder.svelte.d.ts +9 -0
  176. package/dist/components/scenes/app/FeedbackReplay.svelte +142 -0
  177. package/dist/components/scenes/app/FeedbackReplay.svelte.d.ts +7 -0
  178. package/dist/components/scenes/app/FeedbackScreenshot.svelte +120 -0
  179. package/dist/components/scenes/app/FeedbackScreenshot.svelte.d.ts +8 -0
  180. package/dist/components/scenes/app/LanguageSwitch.svelte +38 -21
  181. package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +33 -20
  182. package/dist/components/scenes/app/SettingsLayout.svelte +115 -0
  183. package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +54 -0
  184. package/dist/components/scenes/app/SettingsModal.svelte +33 -7
  185. package/dist/components/scenes/app/SettingsModal.svelte.d.ts +27 -1
  186. package/dist/components/scenes/app/ThemeColorPicker.svelte +240 -0
  187. package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +57 -0
  188. package/dist/components/scenes/app/ThemeSelector.svelte +87 -26
  189. package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +26 -7
  190. package/dist/components/scenes/app/ThemeToggle.svelte +27 -6
  191. package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +24 -5
  192. package/dist/components/scenes/app/WorkspaceLayout.svelte +64 -0
  193. package/dist/components/scenes/app/WorkspaceLayout.svelte.d.ts +36 -0
  194. package/dist/components/scenes/app/feedback-functions.d.ts +57 -0
  195. package/dist/components/scenes/app/feedback-functions.js +107 -0
  196. package/dist/components/scenes/app/feedback-types.d.ts +224 -0
  197. package/dist/components/scenes/app/feedback-types.js +1 -0
  198. package/dist/components/scenes/app/index.d.ts +8 -1
  199. package/dist/components/scenes/app/index.js +7 -1
  200. package/dist/components/scenes/charts/Chart.svelte +186 -0
  201. package/dist/components/scenes/charts/Chart.svelte.d.ts +24 -0
  202. package/dist/components/scenes/charts/ChartLoadError.svelte +13 -0
  203. package/dist/components/scenes/charts/ChartLoadError.svelte.d.ts +6 -0
  204. package/dist/components/scenes/charts/DashboardGrid.svelte +34 -0
  205. package/dist/components/scenes/charts/DashboardGrid.svelte.d.ts +15 -0
  206. package/dist/components/scenes/charts/MetricCard.svelte +52 -0
  207. package/dist/components/scenes/charts/MetricCard.svelte.d.ts +15 -0
  208. package/dist/components/scenes/charts/ReportCard.svelte +48 -0
  209. package/dist/components/scenes/charts/ReportCard.svelte.d.ts +15 -0
  210. package/dist/components/scenes/charts/chart-presets.d.ts +15 -0
  211. package/dist/components/scenes/charts/chart-presets.js +19 -0
  212. package/dist/components/scenes/charts/chart-theme.d.ts +47 -0
  213. package/dist/components/scenes/charts/chart-theme.js +68 -0
  214. package/dist/components/scenes/charts/chart-types.d.ts +164 -0
  215. package/dist/components/scenes/charts/chart-types.js +7 -0
  216. package/dist/components/scenes/charts/dashboard-types.d.ts +79 -0
  217. package/dist/components/scenes/charts/dashboard-types.js +1 -0
  218. package/dist/components/scenes/charts/index.d.ts +12 -0
  219. package/dist/components/scenes/charts/index.js +10 -0
  220. package/dist/components/scenes/charts/renderers/AreaChart.svelte +19 -0
  221. package/dist/components/scenes/charts/renderers/AreaChart.svelte.d.ts +6 -0
  222. package/dist/components/scenes/charts/renderers/BarChart.svelte +19 -0
  223. package/dist/components/scenes/charts/renderers/BarChart.svelte.d.ts +6 -0
  224. package/dist/components/scenes/charts/renderers/LineChart.svelte +625 -0
  225. package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +33 -0
  226. package/dist/components/scenes/charts/renderers/PieChart.svelte +19 -0
  227. package/dist/components/scenes/charts/renderers/PieChart.svelte.d.ts +6 -0
  228. package/dist/components/scenes/charts/renderers/ScatterChart.svelte +19 -0
  229. package/dist/components/scenes/charts/renderers/ScatterChart.svelte.d.ts +6 -0
  230. package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +29 -11
  231. package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +13 -1
  232. package/dist/components/scenes/crud/CrudDetailDrawer.svelte +77 -22
  233. package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +19 -4
  234. package/dist/components/scenes/crud/CrudDetailPanel.svelte +242 -0
  235. package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +66 -0
  236. package/dist/components/scenes/crud/CrudEditPanel.svelte +365 -0
  237. package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +48 -0
  238. package/dist/components/scenes/crud/CrudFilterBar.svelte +17 -85
  239. package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +13 -25
  240. package/dist/components/scenes/crud/CrudPage.svelte +564 -185
  241. package/dist/components/scenes/crud/CrudPage.svelte.d.ts +137 -51
  242. package/dist/components/scenes/crud/crud-controller.svelte.d.ts +335 -0
  243. package/dist/components/scenes/crud/crud-controller.svelte.js +276 -0
  244. package/dist/components/scenes/crud/crud-form-validation.d.ts +16 -0
  245. package/dist/components/scenes/crud/crud-form-validation.js +51 -0
  246. package/dist/components/scenes/crud/crud-types.d.ts +136 -43
  247. package/dist/components/scenes/crud/index.d.ts +9 -3
  248. package/dist/components/scenes/crud/index.js +8 -3
  249. package/dist/components/scenes/crud/nav-adapter.d.ts +50 -0
  250. package/dist/components/scenes/crud/nav-adapter.js +39 -0
  251. package/dist/components/scenes/crypto/EncryptedInput.svelte +63 -28
  252. package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +38 -3
  253. package/dist/components/scenes/crypto/HashDisplay.svelte +30 -22
  254. package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +24 -1
  255. package/dist/components/scenes/crypto/SignatureDisplay.svelte +41 -40
  256. package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +24 -1
  257. package/dist/components/scenes/error/ErrorPage.svelte +135 -0
  258. package/dist/components/scenes/error/ErrorPage.svelte.d.ts +50 -0
  259. package/dist/components/scenes/error/error-presets.d.ts +60 -0
  260. package/dist/components/scenes/error/error-presets.js +51 -0
  261. package/dist/components/scenes/error/index.d.ts +8 -0
  262. package/dist/components/scenes/error/index.js +8 -0
  263. package/dist/components/scenes/guide/GuideHost.svelte +56 -0
  264. package/dist/components/scenes/guide/GuideHost.svelte.d.ts +35 -0
  265. package/dist/components/scenes/guide/GuideHostContent.svelte +136 -0
  266. package/dist/components/scenes/guide/GuideHostContent.svelte.d.ts +43 -0
  267. package/dist/components/scenes/guide/HelpCenter.svelte +135 -0
  268. package/dist/components/scenes/guide/HelpCenter.svelte.d.ts +40 -0
  269. package/dist/components/scenes/guide/index.d.ts +2 -0
  270. package/dist/components/scenes/guide/index.js +2 -0
  271. package/dist/components/scenes/iam/AgreementNotice.svelte +48 -0
  272. package/dist/components/scenes/iam/AgreementNotice.svelte.d.ts +7 -0
  273. package/dist/components/scenes/iam/AuthPanel.svelte +226 -0
  274. package/dist/components/scenes/iam/AuthPanel.svelte.d.ts +29 -0
  275. package/dist/components/scenes/iam/AuthShell.svelte +160 -0
  276. package/dist/components/scenes/iam/AuthShell.svelte.d.ts +56 -0
  277. package/dist/components/scenes/iam/ChangePasswordForm.svelte +84 -63
  278. package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +13 -1
  279. package/dist/components/scenes/iam/ForgotPasswordForm.svelte +113 -89
  280. package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +24 -1
  281. package/dist/components/scenes/iam/LoginForm.svelte +215 -117
  282. package/dist/components/scenes/iam/LoginForm.svelte.d.ts +13 -1
  283. package/dist/components/scenes/iam/PasswordInput.svelte +79 -32
  284. package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +30 -4
  285. package/dist/components/scenes/iam/PermGuard.svelte +21 -11
  286. package/dist/components/scenes/iam/PermGuard.svelte.d.ts +30 -0
  287. package/dist/components/scenes/iam/ReauthenticationDialog.svelte +68 -0
  288. package/dist/components/scenes/iam/ReauthenticationDialog.svelte.d.ts +17 -0
  289. package/dist/components/scenes/iam/RegisterForm.svelte +129 -116
  290. package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +13 -1
  291. package/dist/components/scenes/iam/ResetPasswordForm.svelte +101 -88
  292. package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +13 -1
  293. package/dist/components/scenes/iam/SensitiveOperationsForm.svelte +76 -0
  294. package/dist/components/scenes/iam/SensitiveOperationsForm.svelte.d.ts +21 -0
  295. package/dist/components/scenes/iam/SessionRecoveryDialog.svelte +64 -0
  296. package/dist/components/scenes/iam/SessionRecoveryDialog.svelte.d.ts +22 -0
  297. package/dist/components/scenes/iam/UserProfile.svelte +47 -21
  298. package/dist/components/scenes/iam/UserProfile.svelte.d.ts +24 -1
  299. package/dist/components/scenes/iam/auth-captcha.d.ts +21 -0
  300. package/dist/components/scenes/iam/auth-captcha.js +23 -0
  301. package/dist/components/scenes/iam/auth-error-message.d.ts +13 -0
  302. package/dist/components/scenes/iam/auth-error-message.js +65 -0
  303. package/dist/components/scenes/iam/index.d.ts +10 -0
  304. package/dist/components/scenes/iam/index.js +9 -1
  305. package/dist/components/scenes/iam/password-utils.d.ts +33 -6
  306. package/dist/components/scenes/iam/password-utils.js +61 -8
  307. package/dist/components/scenes/iam/permission-context.svelte.d.ts +33 -23
  308. package/dist/components/scenes/iam/permission-context.svelte.js +20 -22
  309. package/dist/components/scenes/iam/sensitive-actions.svelte.d.ts +68 -0
  310. package/dist/components/scenes/iam/sensitive-actions.svelte.js +101 -0
  311. package/dist/components/scenes/iam/session-recovery.svelte.d.ts +44 -0
  312. package/dist/components/scenes/iam/session-recovery.svelte.js +57 -0
  313. package/dist/components/scenes/index.d.ts +3 -0
  314. package/dist/components/scenes/index.js +5 -0
  315. package/dist/components/scenes/storage/AvatarUpload.svelte +82 -68
  316. package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +23 -1
  317. package/dist/components/scenes/storage/FileList.svelte +19 -5
  318. package/dist/components/scenes/storage/FileList.svelte.d.ts +23 -1
  319. package/dist/components/scenes/storage/FileUpload.svelte +151 -96
  320. package/dist/components/scenes/storage/FileUpload.svelte.d.ts +24 -1
  321. package/dist/components/scenes/storage/ImageUpload.svelte +93 -94
  322. package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +24 -1
  323. package/dist/components/scenes/types.d.ts +574 -42
  324. package/dist/guide-storage.d.ts +18 -0
  325. package/dist/guide-storage.js +79 -0
  326. package/dist/guide-types.d.ts +143 -0
  327. package/dist/guide-types.js +1 -0
  328. package/dist/guide.d.ts +3 -0
  329. package/dist/guide.js +3 -0
  330. package/dist/guide.svelte.d.ts +29 -0
  331. package/dist/guide.svelte.js +506 -0
  332. package/dist/i18n.svelte.d.ts +67 -4
  333. package/dist/i18n.svelte.js +106 -21
  334. package/dist/index.d.ts +6 -0
  335. package/dist/index.js +7 -0
  336. package/dist/internal/browser-safety.d.ts +88 -0
  337. package/dist/internal/browser-safety.js +140 -0
  338. package/dist/internal/dialog-focus.d.ts +21 -0
  339. package/dist/internal/dialog-focus.js +77 -0
  340. package/dist/internal/form-context.d.ts +92 -0
  341. package/dist/internal/form-context.js +70 -0
  342. package/dist/internal/form-validation.svelte.d.ts +70 -0
  343. package/dist/internal/form-validation.svelte.js +142 -0
  344. package/dist/internal/icon-safety.d.ts +14 -0
  345. package/dist/internal/icon-safety.js +40 -0
  346. package/dist/internal/locale.d.ts +21 -0
  347. package/dist/internal/locale.js +43 -0
  348. package/dist/message.svelte.d.ts +138 -0
  349. package/dist/message.svelte.js +149 -0
  350. package/dist/messagebox.svelte.d.ts +130 -0
  351. package/dist/messagebox.svelte.js +171 -0
  352. package/dist/messages/en-US.json +303 -16
  353. package/dist/messages/ja-JP.json +529 -0
  354. package/dist/messages/zh-CN.json +303 -16
  355. package/dist/messages.d.ts +25 -3
  356. package/dist/messages.js +23 -6
  357. package/dist/styles/design-tokens.css +4 -2
  358. package/dist/styles/eye-care.css +55 -0
  359. package/dist/styles/formal.css +55 -0
  360. package/dist/styles/global.css +86 -18
  361. package/dist/styles/guide.css +88 -0
  362. package/dist/styles/high-contrast.css +64 -0
  363. package/dist/styles/mobile.css +28 -0
  364. package/dist/styles/theme.css +43 -0
  365. package/dist/theme-config.d.ts +263 -10
  366. package/dist/theme-config.js +253 -17
  367. package/dist/toast.svelte.d.ts +210 -2
  368. package/dist/toast.svelte.js +305 -19
  369. package/dist/types.d.ts +787 -63
  370. package/dist/utils/platform.svelte.d.ts +28 -15
  371. package/dist/utils/platform.svelte.js +23 -16
  372. package/dist/utils.d.ts +121 -1
  373. package/dist/utils.js +208 -13
  374. package/dist/workspace-context.d.ts +20 -0
  375. package/dist/workspace-context.js +9 -0
  376. package/package.json +120 -24
  377. package/vite.d.ts +13 -0
  378. package/vite.js +96 -0
  379. package/dist/components/scenes/crud/CrudEditDrawer.svelte +0 -225
  380. 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?: string;
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
- uploadUrl?: string;
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
- uploadUrl?: string;
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
- uploadUrl?: string;
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' | 'AES';
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' | 'SHA256' | 'MD5';
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' | 'RSA' | 'ECDSA';
1095
+ algorithm?: 'SM2';
564
1096
  /** 验证状态 */
565
1097
  verified?: boolean;
566
1098
  /** 是否显示公钥 */