@alepha/ui 0.30.0 → 0.31.0

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 (583) hide show
  1. package/dist/account/$pageAccount.d.ts +15 -7
  2. package/dist/account/$pageAccount.d.ts.map +1 -1
  3. package/dist/account/$pageAccount.js +15 -7
  4. package/dist/account/$pageAccount.js.map +1 -1
  5. package/dist/account/AccountBackToSiteMenuItem.d.ts +21 -0
  6. package/dist/account/AccountBackToSiteMenuItem.d.ts.map +1 -0
  7. package/dist/account/AccountBackToSiteMenuItem.js +32 -0
  8. package/dist/account/AccountBackToSiteMenuItem.js.map +1 -0
  9. package/dist/account/AccountBrand.d.ts +23 -0
  10. package/dist/account/AccountBrand.d.ts.map +1 -0
  11. package/dist/account/AccountBrand.js +47 -0
  12. package/dist/account/AccountBrand.js.map +1 -0
  13. package/dist/account/AccountConnections.d.ts +11 -6
  14. package/dist/account/AccountConnections.d.ts.map +1 -1
  15. package/dist/account/AccountConnections.js +103 -63
  16. package/dist/account/AccountConnections.js.map +1 -1
  17. package/dist/account/AccountDeleteDialog.js +4 -4
  18. package/dist/account/AccountDeleteDialog.js.map +1 -1
  19. package/dist/account/AccountKeys.d.ts +12 -8
  20. package/dist/account/AccountKeys.d.ts.map +1 -1
  21. package/dist/account/AccountKeys.js +236 -123
  22. package/dist/account/AccountKeys.js.map +1 -1
  23. package/dist/account/AccountLayout.d.ts +23 -24
  24. package/dist/account/AccountLayout.d.ts.map +1 -1
  25. package/dist/account/AccountLayout.js +79 -46
  26. package/dist/account/AccountLayout.js.map +1 -1
  27. package/dist/account/AccountMfaDialog.d.ts.map +1 -1
  28. package/dist/account/AccountMfaDialog.js +64 -75
  29. package/dist/account/AccountMfaDialog.js.map +1 -1
  30. package/dist/account/AccountPage.d.ts +28 -0
  31. package/dist/account/AccountPage.d.ts.map +1 -0
  32. package/dist/account/AccountPage.js +33 -0
  33. package/dist/account/AccountPage.js.map +1 -0
  34. package/dist/account/AccountPasswordDialog.js +3 -3
  35. package/dist/account/AccountPasswordDialog.js.map +1 -1
  36. package/dist/account/AccountProfile.d.ts.map +1 -1
  37. package/dist/account/AccountProfile.js +119 -115
  38. package/dist/account/AccountProfile.js.map +1 -1
  39. package/dist/account/AccountRecoveryCodes.d.ts +16 -0
  40. package/dist/account/AccountRecoveryCodes.d.ts.map +1 -0
  41. package/dist/account/AccountRecoveryCodes.js +46 -0
  42. package/dist/account/AccountRecoveryCodes.js.map +1 -0
  43. package/dist/account/AccountRecoveryCodesDialog.d.ts +16 -0
  44. package/dist/account/AccountRecoveryCodesDialog.d.ts.map +1 -0
  45. package/dist/account/AccountRecoveryCodesDialog.js +30 -0
  46. package/dist/account/AccountRecoveryCodesDialog.js.map +1 -0
  47. package/dist/account/AccountRouter.d.ts +61 -40
  48. package/dist/account/AccountRouter.d.ts.map +1 -1
  49. package/dist/account/AccountRouter.js +74 -48
  50. package/dist/account/AccountRouter.js.map +1 -1
  51. package/dist/account/AccountRouterOptions.d.ts +55 -26
  52. package/dist/account/AccountRouterOptions.d.ts.map +1 -1
  53. package/dist/account/AccountRouterOptions.js +1 -1
  54. package/dist/account/AccountRouterOptions.js.map +1 -1
  55. package/dist/account/AccountSecurity.d.ts.map +1 -1
  56. package/dist/account/AccountSecurity.js +129 -89
  57. package/dist/account/AccountSecurity.js.map +1 -1
  58. package/dist/account/AccountSessions.d.ts +16 -7
  59. package/dist/account/AccountSessions.d.ts.map +1 -1
  60. package/dist/account/AccountSessions.js +144 -98
  61. package/dist/account/AccountSessions.js.map +1 -1
  62. package/dist/account/ApiKeyCreateDialog.js +3 -3
  63. package/dist/account/ApiKeyCreateDialog.js.map +1 -1
  64. package/dist/account/ApiKeyScopeMatrix.js +1 -1
  65. package/dist/account/index.d.ts +4 -1
  66. package/dist/account/index.d.ts.map +1 -1
  67. package/dist/account/index.js +4 -1
  68. package/dist/admin/AdminAnalytics.js +2 -2
  69. package/dist/admin/AdminAudits.js +3 -3
  70. package/dist/admin/AdminDashboardCountCard.js +1 -1
  71. package/dist/admin/AdminFiles.d.ts.map +1 -1
  72. package/dist/admin/AdminFiles.js +7 -4
  73. package/dist/admin/AdminFiles.js.map +1 -1
  74. package/dist/admin/AdminFilesUsage.d.ts +4 -0
  75. package/dist/admin/AdminFilesUsage.d.ts.map +1 -1
  76. package/dist/admin/AdminFilesUsage.js +5 -2
  77. package/dist/admin/AdminFilesUsage.js.map +1 -1
  78. package/dist/admin/AdminFilesUsageCard.d.ts +12 -0
  79. package/dist/admin/AdminFilesUsageCard.d.ts.map +1 -1
  80. package/dist/admin/AdminFilesUsageCard.js +31 -3
  81. package/dist/admin/AdminFilesUsageCard.js.map +1 -1
  82. package/dist/admin/AdminJobDetail.js +3 -3
  83. package/dist/admin/AdminJobDetail.js.map +1 -1
  84. package/dist/admin/AdminJobDetailAside.js +1 -1
  85. package/dist/admin/AdminJobDetailExecutions.js +4 -4
  86. package/dist/admin/AdminJobDetailExecutions.js.map +1 -1
  87. package/dist/admin/AdminJobExecutionLogs.js +1 -1
  88. package/dist/admin/AdminJobExecutionLogs.js.map +1 -1
  89. package/dist/admin/AdminJobExecutionSheet.js +4 -4
  90. package/dist/admin/AdminJobExecutionSheet.js.map +1 -1
  91. package/dist/admin/AdminJobs.js +4 -4
  92. package/dist/admin/AdminJobs.js.map +1 -1
  93. package/dist/admin/AdminJobsPayloadDialog.js +1 -1
  94. package/dist/admin/AdminJobsTypeIcon.js +1 -1
  95. package/dist/admin/AdminKeys.js +6 -6
  96. package/dist/admin/AdminKeysTokenDialog.js +2 -2
  97. package/dist/admin/AdminKeysTokenDialog.js.map +1 -1
  98. package/dist/admin/AdminLayout.js +3 -3
  99. package/dist/admin/AdminNotifications.js +3 -3
  100. package/dist/admin/AdminNotificationsDetail.js +1 -1
  101. package/dist/admin/AdminNotificationsDetailTabs.js +1 -1
  102. package/dist/admin/AdminNotificationsPreviewTab.js +1 -1
  103. package/dist/admin/AdminParameters.d.ts.map +1 -1
  104. package/dist/admin/AdminParameters.js +2 -2
  105. package/dist/admin/AdminParameters.js.map +1 -1
  106. package/dist/admin/AdminParametersEditorForm.js +3 -3
  107. package/dist/admin/AdminParametersEditorForm.js.map +1 -1
  108. package/dist/admin/AdminParametersEditorPane.js +2 -2
  109. package/dist/admin/AdminParametersHistoryPane.js +2 -2
  110. package/dist/admin/AdminParametersTreeFooterActions.js +3 -3
  111. package/dist/admin/AdminParametersTreeFooterActions.js.map +1 -1
  112. package/dist/admin/AdminParametersTreeNodeView.js +4 -4
  113. package/dist/admin/AdminParametersTreeNodeView.js.map +1 -1
  114. package/dist/admin/AdminParametersTreePane.js +2 -2
  115. package/dist/admin/AdminParametersTreePane.js.map +1 -1
  116. package/dist/admin/AdminPayments.js +2 -2
  117. package/dist/admin/AdminRouter.js +1 -1
  118. package/dist/admin/AdminSessions.js +3 -3
  119. package/dist/admin/AdminUserAvatarControl.js +4 -4
  120. package/dist/admin/AdminUserAvatarControl.js.map +1 -1
  121. package/dist/admin/AdminUserDetail.d.ts.map +1 -1
  122. package/dist/admin/AdminUserDetail.js +5 -4
  123. package/dist/admin/AdminUserDetail.js.map +1 -1
  124. package/dist/admin/AdminUserDetailAuditsTab.js +1 -1
  125. package/dist/admin/AdminUserDetailIdentityAside.js +1 -1
  126. package/dist/admin/AdminUserDetailOverviewTab.js +1 -1
  127. package/dist/admin/AdminUserDetailPasswordDialog.js +2 -2
  128. package/dist/admin/AdminUserDetailPasswordDialog.js.map +1 -1
  129. package/dist/admin/AdminUserDetailSecurityTab.d.ts.map +1 -1
  130. package/dist/admin/AdminUserDetailSecurityTab.js +6 -4
  131. package/dist/admin/AdminUserDetailSecurityTab.js.map +1 -1
  132. package/dist/admin/AdminUserDetailSessionsTab.js +1 -1
  133. package/dist/admin/AdminUsers.js +4 -4
  134. package/dist/admin/AdminUsersRolesPicker.js +1 -1
  135. package/dist/admin/AdminUsersStatusBadge.js +1 -1
  136. package/dist/admin/ParameterDiffDialog.js +3 -3
  137. package/dist/admin/ParameterDiffDialog.js.map +1 -1
  138. package/dist/admin/ParameterHistoryItem.js +3 -3
  139. package/dist/admin/ParameterHistoryItem.js.map +1 -1
  140. package/dist/admin/ParameterJsonDialog.js +2 -2
  141. package/dist/admin/ParameterJsonDialog.js.map +1 -1
  142. package/dist/admin/ParameterSaveDialog.js +3 -3
  143. package/dist/admin/ParameterSaveDialog.js.map +1 -1
  144. package/dist/admin/analytics/AdvancedSection.js +1 -1
  145. package/dist/admin/analytics/AnalyticsEmpty.js +1 -1
  146. package/dist/admin/analytics/DatasetSelect.js +1 -1
  147. package/dist/admin/analytics/FilterEditor.js +4 -4
  148. package/dist/admin/analytics/FilterEditor.js.map +1 -1
  149. package/dist/admin/analytics/FilterValuePicker.js +3 -3
  150. package/dist/admin/analytics/FilterValuePicker.js.map +1 -1
  151. package/dist/admin/analytics/RequestDialog.js +2 -2
  152. package/dist/admin/analytics/RequestDialog.js.map +1 -1
  153. package/dist/admin/analytics/ResultsPane.js +2 -2
  154. package/dist/admin/analytics/ResultsPane.js.map +1 -1
  155. package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
  156. package/dist/admin/analytics/ResultsTable.js +2 -2
  157. package/dist/admin/analytics/ResultsTable.js.map +1 -1
  158. package/dist/admin/analytics/RunFooter.js +1 -1
  159. package/dist/admin/analytics/SamplingBadge.js +1 -1
  160. package/dist/admin/analytics/ToggleChip.js +1 -1
  161. package/dist/admin/analytics/ToggleChip.js.map +1 -1
  162. package/dist/admin/analytics/TruncationBanner.js +2 -2
  163. package/dist/admin/analytics/TruncationBanner.js.map +1 -1
  164. package/dist/admin/analytics/useAnalyticsQuery.js +1 -1
  165. package/dist/admin/analytics/useShapeLabels.js +1 -1
  166. package/dist/auth/AuthLogin.js +5 -5
  167. package/dist/auth/AuthLogin.js.map +1 -1
  168. package/dist/auth/AuthMfaStep.js +3 -3
  169. package/dist/auth/AuthMfaStep.js.map +1 -1
  170. package/dist/auth/AuthRegister.js +5 -5
  171. package/dist/auth/AuthRegister.js.map +1 -1
  172. package/dist/auth/AuthRegisterFormPhase.js +3 -3
  173. package/dist/auth/AuthRegisterFormPhase.js.map +1 -1
  174. package/dist/auth/AuthRegisterPasswordRules.js +1 -1
  175. package/dist/auth/AuthResetPassword.js +5 -5
  176. package/dist/auth/AuthResetPassword.js.map +1 -1
  177. package/dist/auth/AuthRouter.d.ts +2 -2
  178. package/dist/auth/AuthRouter.js +2 -2
  179. package/dist/auth/AuthRouter.js.map +1 -1
  180. package/dist/auth/AuthVerifyEmailStateful.js +2 -2
  181. package/dist/auth/AuthVerifyEmailView.js +3 -3
  182. package/dist/auth/AuthVerifyEmailView.js.map +1 -1
  183. package/dist/auth/safeRedirect.d.ts +3 -0
  184. package/dist/auth/safeRedirect.d.ts.map +1 -1
  185. package/dist/auth/safeRedirect.js +11 -0
  186. package/dist/auth/safeRedirect.js.map +1 -1
  187. package/dist/calendar/Calendar.js +3 -3
  188. package/dist/calendar/Calendar.js.map +1 -1
  189. package/dist/core/Alert.js +2 -2
  190. package/dist/core/Alert.js.map +1 -1
  191. package/dist/core/AlertDialog.js +1 -1
  192. package/dist/core/AlertDialog.js.map +1 -1
  193. package/dist/core/Badge.js +3 -3
  194. package/dist/core/Badge.js.map +1 -1
  195. package/dist/core/Button.d.ts +45 -3
  196. package/dist/core/Button.d.ts.map +1 -1
  197. package/dist/core/Button.js +155 -11
  198. package/dist/core/Button.js.map +1 -1
  199. package/dist/core/ButtonGroup.js +1 -1
  200. package/dist/core/Checkbox.js +1 -1
  201. package/dist/core/Checkbox.js.map +1 -1
  202. package/dist/core/Combobox.js +4 -4
  203. package/dist/core/Combobox.js.map +1 -1
  204. package/dist/core/ContextMenu.js +1 -1
  205. package/dist/core/ContextMenu.js.map +1 -1
  206. package/dist/core/Dialog.js +2 -2
  207. package/dist/core/Dialog.js.map +1 -1
  208. package/dist/core/DropdownMenu.js +2 -2
  209. package/dist/core/DropdownMenu.js.map +1 -1
  210. package/dist/core/Empty.js +1 -1
  211. package/dist/core/Input.js +1 -1
  212. package/dist/core/Input.js.map +1 -1
  213. package/dist/core/InputGroup.js +3 -3
  214. package/dist/core/InputGroup.js.map +1 -1
  215. package/dist/core/Menubar.js +2 -2
  216. package/dist/core/Menubar.js.map +1 -1
  217. package/dist/core/Pagination.js +1 -1
  218. package/dist/core/Pagination.js.map +1 -1
  219. package/dist/core/Segmented.d.ts.map +1 -1
  220. package/dist/core/Segmented.js +1 -1
  221. package/dist/core/Segmented.js.map +1 -1
  222. package/dist/core/Sheet.js +1 -1
  223. package/dist/core/Sheet.js.map +1 -1
  224. package/dist/core/Sidebar.js +4 -4
  225. package/dist/core/Sidebar.js.map +1 -1
  226. package/dist/core/Switch.js +1 -1
  227. package/dist/core/Switch.js.map +1 -1
  228. package/dist/core/Tabs.js +1 -1
  229. package/dist/core/Textarea.js +1 -1
  230. package/dist/core/Textarea.js.map +1 -1
  231. package/dist/core/TimeAgo.js +1 -1
  232. package/dist/core/index.d.ts +1 -1
  233. package/dist/core/index.d.ts.map +1 -1
  234. package/dist/core/index.js +19 -19
  235. package/dist/core/useDialog.d.ts.map +1 -1
  236. package/dist/core/useDialog.js +3 -3
  237. package/dist/core/useDialog.js.map +1 -1
  238. package/dist/form/AutoForm.d.ts +3 -1
  239. package/dist/form/AutoForm.d.ts.map +1 -1
  240. package/dist/form/AutoForm.js +3 -3
  241. package/dist/form/AutoForm.js.map +1 -1
  242. package/dist/form/AutoFormBottomBar.d.ts.map +1 -1
  243. package/dist/form/AutoFormBottomBar.js +5 -4
  244. package/dist/form/AutoFormBottomBar.js.map +1 -1
  245. package/dist/form/AutoFormErrorPopover.js +4 -4
  246. package/dist/form/AutoFormErrorPopover.js.map +1 -1
  247. package/dist/form/AutoFormGroupBlock.js +2 -2
  248. package/dist/form/AutoFormGroupGridField.js +1 -1
  249. package/dist/form/Control.d.ts +16 -0
  250. package/dist/form/Control.d.ts.map +1 -1
  251. package/dist/form/Control.js +20 -10
  252. package/dist/form/Control.js.map +1 -1
  253. package/dist/form/ControlArray.d.ts.map +1 -1
  254. package/dist/form/ControlArray.js +15 -14
  255. package/dist/form/ControlArray.js.map +1 -1
  256. package/dist/form/ControlDate.d.ts.map +1 -1
  257. package/dist/form/ControlDate.js +5 -2
  258. package/dist/form/ControlDate.js.map +1 -1
  259. package/dist/form/ControlDatePopover.js +1 -1
  260. package/dist/form/ControlDateRange.js +2 -2
  261. package/dist/form/ControlObject.js +7 -7
  262. package/dist/form/ControlObject.js.map +1 -1
  263. package/dist/form/ControlPassword.js +1 -1
  264. package/dist/form/ControlPassword.js.map +1 -1
  265. package/dist/form/ControlSelect.d.ts +3 -2
  266. package/dist/form/ControlSelect.d.ts.map +1 -1
  267. package/dist/form/ControlSelect.js +2 -2
  268. package/dist/form/ControlSelect.js.map +1 -1
  269. package/dist/form/ControlSelectCombobox.js +1 -1
  270. package/dist/form/ControlUpload.js +3 -3
  271. package/dist/form/ControlUpload.js.map +1 -1
  272. package/dist/form/FormField.js +5 -5
  273. package/dist/form/FormField.js.map +1 -1
  274. package/dist/form/fieldTrigger.js +1 -1
  275. package/dist/form/grid.d.ts +11 -0
  276. package/dist/form/grid.d.ts.map +1 -1
  277. package/dist/form/grid.js +17 -6
  278. package/dist/form/grid.js.map +1 -1
  279. package/dist/form/index.js +2 -2
  280. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  281. package/dist/i18n/fr/uiFr.js +41 -30
  282. package/dist/i18n/fr/uiFr.js.map +1 -1
  283. package/dist/markdown/MarkdownView.d.ts.map +1 -1
  284. package/dist/markdown/MarkdownView.js +5 -4
  285. package/dist/markdown/MarkdownView.js.map +1 -1
  286. package/dist/markdown/rehypeHighlight.d.ts +1 -1
  287. package/dist/markdown/rehypeHighlight.js +1 -1
  288. package/dist/markdown/rehypeHighlight.js.map +1 -1
  289. package/dist/organizations/MyOrganizationInvitations.d.ts +36 -0
  290. package/dist/organizations/MyOrganizationInvitations.d.ts.map +1 -1
  291. package/dist/organizations/MyOrganizationInvitations.js +116 -58
  292. package/dist/organizations/MyOrganizationInvitations.js.map +1 -1
  293. package/dist/organizations/MyOrganizations.js +4 -4
  294. package/dist/organizations/MyOrganizations.js.map +1 -1
  295. package/dist/organizations/OrganizationInviteDialog.js +2 -2
  296. package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
  297. package/dist/organizations/OrganizationMemberIdentity.d.ts.map +1 -1
  298. package/dist/organizations/OrganizationMemberIdentity.js +1 -1
  299. package/dist/organizations/OrganizationMemberIdentity.js.map +1 -1
  300. package/dist/organizations/OrganizationMemberRankPicker.js +3 -3
  301. package/dist/organizations/OrganizationMembers.js +7 -7
  302. package/dist/organizations/OrganizationMembers.js.map +1 -1
  303. package/dist/organizations/OrganizationPendingInvitations.js +5 -5
  304. package/dist/organizations/OrganizationPendingInvitations.js.map +1 -1
  305. package/dist/organizations/OrganizationRankColumnHeader.d.ts +0 -1
  306. package/dist/organizations/OrganizationRankColumnHeader.d.ts.map +1 -1
  307. package/dist/organizations/OrganizationRankColumnHeader.js +26 -35
  308. package/dist/organizations/OrganizationRankColumnHeader.js.map +1 -1
  309. package/dist/organizations/OrganizationRanks.d.ts.map +1 -1
  310. package/dist/organizations/OrganizationRanks.js +7 -8
  311. package/dist/organizations/OrganizationRanks.js.map +1 -1
  312. package/dist/organizations/OrganizationTransferOwnershipDialog.js +3 -3
  313. package/dist/organizations/OrganizationTransferOwnershipDialog.js.map +1 -1
  314. package/dist/organizations/useInviteOrganizationMember.js +1 -1
  315. package/dist/organizations/useRevokeOrganizationInvitation.js +1 -1
  316. package/dist/otp/InputOTP.js +2 -2
  317. package/dist/otp/InputOTP.js.map +1 -1
  318. package/dist/settings/SettingsDangerSection.js +2 -2
  319. package/dist/settings/SettingsDangerSection.js.map +1 -1
  320. package/dist/settings/SettingsHeading.d.ts +1 -1
  321. package/dist/settings/SettingsHeading.js +1 -1
  322. package/dist/settings/SettingsHeading.js.map +1 -1
  323. package/dist/settings/SettingsSection.d.ts +1 -1
  324. package/dist/settings/SettingsSection.js +2 -2
  325. package/dist/settings/SettingsSection.js.map +1 -1
  326. package/dist/settings/index.js +2 -2
  327. package/dist/shell/AppActions.d.ts +2 -2
  328. package/dist/shell/AppActions.js +6 -6
  329. package/dist/shell/AppActions.js.map +1 -1
  330. package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
  331. package/dist/shell/AppShellSidebarNavItem.js +8 -2
  332. package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
  333. package/dist/shell/AppShellStatefulSidebarTrigger.js +1 -1
  334. package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
  335. package/dist/shell/ButtonDark.d.ts +2 -2
  336. package/dist/shell/ButtonDark.d.ts.map +1 -1
  337. package/dist/shell/ButtonDark.js +1 -1
  338. package/dist/shell/ButtonDark.js.map +1 -1
  339. package/dist/shell/ButtonInbox.d.ts +1 -1
  340. package/dist/shell/ButtonInbox.d.ts.map +1 -1
  341. package/dist/shell/ButtonInbox.js +7 -7
  342. package/dist/shell/ButtonInbox.js.map +1 -1
  343. package/dist/shell/ButtonLanguage.d.ts +2 -2
  344. package/dist/shell/ButtonLanguage.d.ts.map +1 -1
  345. package/dist/shell/ButtonLanguage.js +3 -3
  346. package/dist/shell/ButtonLanguage.js.map +1 -1
  347. package/dist/shell/ButtonSettings.d.ts +2 -2
  348. package/dist/shell/ButtonSettings.d.ts.map +1 -1
  349. package/dist/shell/ButtonSettings.js +2 -2
  350. package/dist/shell/ButtonSettings.js.map +1 -1
  351. package/dist/shell/ButtonSettingsLanguageMenu.js +1 -1
  352. package/dist/shell/ButtonSettingsThemeMenu.js +1 -1
  353. package/dist/shell/ButtonTheme.d.ts +2 -2
  354. package/dist/shell/ButtonTheme.d.ts.map +1 -1
  355. package/dist/shell/ButtonTheme.js +3 -3
  356. package/dist/shell/ButtonTheme.js.map +1 -1
  357. package/dist/shell/ButtonUser.d.ts +2 -2
  358. package/dist/shell/ButtonUser.d.ts.map +1 -1
  359. package/dist/shell/ButtonUser.js +4 -4
  360. package/dist/shell/ButtonUser.js.map +1 -1
  361. package/dist/shell/DetailAside.js +3 -3
  362. package/dist/shell/DetailAside.js.map +1 -1
  363. package/dist/shell/DetailLayout.js +2 -2
  364. package/dist/shell/DetailLayout.js.map +1 -1
  365. package/dist/shell/NavShell.js +1 -1
  366. package/dist/shell/NavigationProgress.js +1 -1
  367. package/dist/shell/PlateTabBar.d.ts.map +1 -1
  368. package/dist/shell/PlateTabBar.js +2 -2
  369. package/dist/shell/PlateTabBar.js.map +1 -1
  370. package/dist/shell/Spotlight.js +1 -1
  371. package/dist/shell/index.js +3 -3
  372. package/dist/shell/useNavBreadcrumbs.js +1 -1
  373. package/dist/shell/useNavEntries.js +1 -1
  374. package/dist/styles.css +89 -12
  375. package/dist/table/DataTable.js +3 -3
  376. package/dist/table/DataTableBody.js +1 -1
  377. package/dist/table/DataTableBulkBar.d.ts.map +1 -1
  378. package/dist/table/DataTableBulkBar.js +6 -3
  379. package/dist/table/DataTableBulkBar.js.map +1 -1
  380. package/dist/table/DataTableBulkMenu.d.ts.map +1 -1
  381. package/dist/table/DataTableBulkMenu.js +4 -3
  382. package/dist/table/DataTableBulkMenu.js.map +1 -1
  383. package/dist/table/DataTableColumnPicker.js +3 -3
  384. package/dist/table/DataTableColumnPicker.js.map +1 -1
  385. package/dist/table/DataTableFilterAdd.d.ts +7 -0
  386. package/dist/table/DataTableFilterAdd.d.ts.map +1 -1
  387. package/dist/table/DataTableFilterAdd.js +15 -6
  388. package/dist/table/DataTableFilterAdd.js.map +1 -1
  389. package/dist/table/DataTableFilterBar.d.ts.map +1 -1
  390. package/dist/table/DataTableFilterBar.js +12 -3
  391. package/dist/table/DataTableFilterBar.js.map +1 -1
  392. package/dist/table/DataTableFilterControl.d.ts +1 -1
  393. package/dist/table/DataTableFilterControl.js +2 -2
  394. package/dist/table/DataTableFilterControl.js.map +1 -1
  395. package/dist/table/DataTableFilterDialog.js +5 -5
  396. package/dist/table/DataTableFilterDialog.js.map +1 -1
  397. package/dist/table/DataTableFilterMenu.js +3 -3
  398. package/dist/table/DataTableFilterMenu.js.map +1 -1
  399. package/dist/table/DataTableFooter.d.ts.map +1 -1
  400. package/dist/table/DataTableFooter.js +1 -1
  401. package/dist/table/DataTableFooter.js.map +1 -1
  402. package/dist/table/DataTableHeaderRow.js +1 -1
  403. package/dist/table/DataTableHelpButton.js +2 -2
  404. package/dist/table/DataTableHelpButton.js.map +1 -1
  405. package/dist/table/DataTableRowActionsMenu.js +3 -3
  406. package/dist/table/DataTableRowActionsMenu.js.map +1 -1
  407. package/dist/table/DataTableToolbar.d.ts.map +1 -1
  408. package/dist/table/DataTableToolbar.js +4 -4
  409. package/dist/table/DataTableToolbar.js.map +1 -1
  410. package/dist/table/PermissionMatrixRowLabel.d.ts +1 -1
  411. package/dist/table/PermissionMatrixRowLabel.js +1 -1
  412. package/dist/table/PermissionMatrixRowLabel.js.map +1 -1
  413. package/dist/table/dataTableTypes.d.ts +12 -1
  414. package/dist/table/dataTableTypes.d.ts.map +1 -1
  415. package/dist/table/index.js +1 -1
  416. package/dist/table/useDataTableData.d.ts.map +1 -1
  417. package/dist/table/useDataTableData.js +13 -2
  418. package/dist/table/useDataTableData.js.map +1 -1
  419. package/dist/tree/TreeViewRenameInput.js +1 -1
  420. package/dist/tree/TreeViewResizer.js +1 -1
  421. package/package.json +17 -14
  422. package/src/account/$pageAccount.tsx +15 -7
  423. package/src/account/AccountBackToSiteMenuItem.tsx +46 -0
  424. package/src/account/AccountBrand.tsx +51 -0
  425. package/src/account/AccountConnections.tsx +154 -126
  426. package/src/account/AccountDeleteDialog.tsx +2 -2
  427. package/src/account/AccountKeys.tsx +277 -162
  428. package/src/account/AccountLayout.tsx +75 -84
  429. package/src/account/AccountMfaDialog.tsx +19 -38
  430. package/src/account/AccountPage.tsx +63 -0
  431. package/src/account/AccountPasswordDialog.tsx +1 -1
  432. package/src/account/AccountProfile.tsx +6 -4
  433. package/src/account/AccountRecoveryCodes.tsx +69 -0
  434. package/src/account/AccountRecoveryCodesDialog.tsx +47 -0
  435. package/src/account/AccountRouter.tsx +82 -50
  436. package/src/account/AccountRouterOptions.tsx +59 -27
  437. package/src/account/AccountSecurity.tsx +84 -12
  438. package/src/account/AccountSessions.tsx +214 -159
  439. package/src/account/ApiKeyCreateDialog.tsx +1 -1
  440. package/src/account/__tests__/AccountConnections.browser.spec.tsx +130 -0
  441. package/src/account/__tests__/AccountKeys.browser.spec.tsx +156 -0
  442. package/src/account/__tests__/AccountLayout.browser.spec.tsx +120 -30
  443. package/src/account/__tests__/AccountRecoveryCodes.browser.spec.tsx +118 -0
  444. package/src/account/__tests__/AccountRouter.spec.ts +34 -0
  445. package/src/account/__tests__/AccountSessions.browser.spec.tsx +199 -0
  446. package/src/account/index.ts +7 -1
  447. package/src/admin/AdminFiles.tsx +4 -1
  448. package/src/admin/AdminFilesUsage.tsx +10 -1
  449. package/src/admin/AdminFilesUsageCard.tsx +69 -2
  450. package/src/admin/AdminJobDetail.tsx +1 -1
  451. package/src/admin/AdminJobDetailExecutions.tsx +1 -1
  452. package/src/admin/AdminJobExecutionLogs.tsx +1 -1
  453. package/src/admin/AdminJobExecutionSheet.tsx +1 -1
  454. package/src/admin/AdminJobs.tsx +1 -1
  455. package/src/admin/AdminKeysTokenDialog.tsx +1 -1
  456. package/src/admin/AdminParameters.tsx +13 -14
  457. package/src/admin/AdminParametersEditorForm.tsx +2 -2
  458. package/src/admin/AdminParametersTreeFooterActions.tsx +2 -2
  459. package/src/admin/AdminParametersTreeNodeView.tsx +2 -2
  460. package/src/admin/AdminParametersTreePane.tsx +1 -1
  461. package/src/admin/AdminUserAvatarControl.tsx +2 -2
  462. package/src/admin/AdminUserDetail.tsx +3 -2
  463. package/src/admin/AdminUserDetailPasswordDialog.tsx +1 -1
  464. package/src/admin/AdminUserDetailSecurityTab.tsx +5 -3
  465. package/src/admin/ParameterDiffDialog.tsx +2 -2
  466. package/src/admin/ParameterHistoryItem.tsx +1 -1
  467. package/src/admin/ParameterJsonDialog.tsx +1 -1
  468. package/src/admin/ParameterSaveDialog.tsx +1 -1
  469. package/src/admin/__tests__/AdminFilesUsageCard.browser.spec.tsx +52 -2
  470. package/src/admin/analytics/FilterEditor.tsx +3 -3
  471. package/src/admin/analytics/FilterValuePicker.tsx +2 -2
  472. package/src/admin/analytics/RequestDialog.tsx +1 -1
  473. package/src/admin/analytics/ResultsPane.tsx +1 -1
  474. package/src/admin/analytics/ResultsTable.tsx +6 -1
  475. package/src/admin/analytics/ToggleChip.tsx +1 -1
  476. package/src/admin/analytics/TruncationBanner.tsx +1 -1
  477. package/src/auth/AuthLogin.tsx +2 -2
  478. package/src/auth/AuthMfaStep.tsx +2 -2
  479. package/src/auth/AuthRegister.tsx +2 -2
  480. package/src/auth/AuthRegisterFormPhase.tsx +1 -1
  481. package/src/auth/AuthResetPassword.tsx +2 -2
  482. package/src/auth/AuthRouter.tsx +2 -2
  483. package/src/auth/AuthVerifyEmailView.tsx +1 -1
  484. package/src/auth/__tests__/AuthRouter.spec.ts +2 -1
  485. package/src/auth/__tests__/safeRedirect.spec.ts +38 -0
  486. package/src/auth/safeRedirect.ts +13 -0
  487. package/src/calendar/Calendar.tsx +2 -2
  488. package/src/core/Alert.tsx +1 -1
  489. package/src/core/AlertDialog.tsx +1 -1
  490. package/src/core/Badge.tsx +2 -2
  491. package/src/core/Button.tsx +232 -18
  492. package/src/core/Checkbox.tsx +1 -1
  493. package/src/core/Combobox.tsx +4 -4
  494. package/src/core/ContextMenu.tsx +1 -1
  495. package/src/core/Dialog.tsx +2 -2
  496. package/src/core/DropdownMenu.tsx +1 -1
  497. package/src/core/Input.tsx +1 -1
  498. package/src/core/InputGroup.tsx +2 -2
  499. package/src/core/Menubar.tsx +1 -1
  500. package/src/core/Pagination.tsx +1 -1
  501. package/src/core/Segmented.tsx +6 -4
  502. package/src/core/Sheet.tsx +1 -1
  503. package/src/core/Sidebar.tsx +1 -1
  504. package/src/core/Switch.tsx +1 -1
  505. package/src/core/Textarea.tsx +1 -1
  506. package/src/core/index.ts +7 -1
  507. package/src/core/useDialog.tsx +3 -5
  508. package/src/form/AutoForm.tsx +3 -1
  509. package/src/form/AutoFormBottomBar.tsx +4 -3
  510. package/src/form/AutoFormErrorPopover.tsx +3 -3
  511. package/src/form/Control.tsx +53 -9
  512. package/src/form/ControlArray.tsx +13 -12
  513. package/src/form/ControlDate.tsx +4 -1
  514. package/src/form/ControlObject.tsx +6 -6
  515. package/src/form/ControlPassword.tsx +1 -1
  516. package/src/form/ControlSelect.tsx +3 -2
  517. package/src/form/ControlUpload.tsx +1 -1
  518. package/src/form/FormField.tsx +5 -5
  519. package/src/form/grid.tsx +17 -6
  520. package/src/i18n/fr/uiFr.ts +46 -33
  521. package/src/markdown/MarkdownView.tsx +5 -4
  522. package/src/markdown/rehypeHighlight.ts +1 -1
  523. package/src/organizations/MyOrganizationInvitations.tsx +177 -71
  524. package/src/organizations/MyOrganizations.tsx +1 -1
  525. package/src/organizations/OrganizationInviteDialog.tsx +1 -1
  526. package/src/organizations/OrganizationMemberIdentity.tsx +4 -1
  527. package/src/organizations/OrganizationMembers.tsx +3 -3
  528. package/src/organizations/OrganizationPendingInvitations.tsx +1 -1
  529. package/src/organizations/OrganizationRankColumnHeader.tsx +1 -8
  530. package/src/organizations/OrganizationRanks.tsx +2 -3
  531. package/src/organizations/OrganizationTransferOwnershipDialog.tsx +2 -2
  532. package/src/organizations/__tests__/MyOrganizationInvitations.browser.spec.tsx +61 -7
  533. package/src/organizations/__tests__/OrganizationRanks.browser.spec.tsx +34 -0
  534. package/src/otp/InputOTP.tsx +2 -2
  535. package/src/settings/SettingsDangerSection.tsx +2 -2
  536. package/src/settings/SettingsHeading.tsx +1 -1
  537. package/src/settings/SettingsSection.tsx +1 -1
  538. package/src/settings/__tests__/SettingsSection.browser.spec.tsx +3 -3
  539. package/src/shell/AppActions.tsx +6 -6
  540. package/src/shell/AppShellSidebarNavItem.tsx +17 -2
  541. package/src/shell/AppShellStatefulSidebarTrigger.tsx +1 -1
  542. package/src/shell/ButtonDark.tsx +3 -3
  543. package/src/shell/ButtonInbox.tsx +15 -5
  544. package/src/shell/ButtonLanguage.tsx +3 -3
  545. package/src/shell/ButtonSettings.tsx +3 -3
  546. package/src/shell/ButtonTheme.tsx +3 -3
  547. package/src/shell/ButtonUser.tsx +4 -4
  548. package/src/shell/DetailAside.tsx +1 -1
  549. package/src/shell/DetailLayout.tsx +1 -1
  550. package/src/shell/PlateTabBar.tsx +4 -2
  551. package/src/shell/__tests__/ActionErrorToaster.browser.spec.tsx +2 -2
  552. package/src/shell/__tests__/AppActions.browser.spec.tsx +1 -1
  553. package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +12 -0
  554. package/src/shell/__tests__/NavigationProgress.browser.spec.tsx +2 -2
  555. package/src/styles.css +89 -12
  556. package/src/table/DataTableBulkBar.tsx +10 -3
  557. package/src/table/DataTableBulkMenu.tsx +2 -1
  558. package/src/table/DataTableColumnPicker.tsx +1 -1
  559. package/src/table/DataTableFilterAdd.tsx +55 -25
  560. package/src/table/DataTableFilterBar.tsx +16 -3
  561. package/src/table/DataTableFilterControl.tsx +1 -1
  562. package/src/table/DataTableFilterDialog.tsx +3 -3
  563. package/src/table/DataTableFilterMenu.tsx +1 -1
  564. package/src/table/DataTableFooter.tsx +31 -32
  565. package/src/table/DataTableHelpButton.tsx +1 -1
  566. package/src/table/DataTableRowActionsMenu.tsx +1 -1
  567. package/src/table/DataTableToolbar.tsx +11 -3
  568. package/src/table/PermissionMatrixRowLabel.tsx +1 -1
  569. package/src/table/__tests__/DataTableBulkBarChrome.browser.spec.tsx +87 -0
  570. package/src/table/__tests__/DataTableFilterDefaultBar.browser.spec.tsx +24 -0
  571. package/src/table/__tests__/DataTableNewestRequest.browser.spec.tsx +91 -0
  572. package/src/table/dataTableTypes.ts +14 -1
  573. package/src/table/useDataTableData.ts +24 -1
  574. package/dist/account/AccountHeader.d.ts +0 -33
  575. package/dist/account/AccountHeader.d.ts.map +0 -1
  576. package/dist/account/AccountHeader.js +0 -45
  577. package/dist/account/AccountHeader.js.map +0 -1
  578. package/dist/account/AccountKeysRow.d.ts +0 -22
  579. package/dist/account/AccountKeysRow.d.ts.map +0 -1
  580. package/dist/account/AccountKeysRow.js +0 -68
  581. package/dist/account/AccountKeysRow.js.map +0 -1
  582. package/src/account/AccountHeader.tsx +0 -66
  583. package/src/account/AccountKeysRow.tsx +0 -100
@@ -1,6 +1,7 @@
1
1
  import type { ApiKeyController } from "alepha/api/keys";
2
2
  import type { MyConnectionController, MyIdentityController, MyProfileController, MySessionController, RealmController } from "alepha/api/users";
3
- import { type AccountPage } from "./AccountRouterOptions.tsx";
3
+ import { I18nProvider } from "alepha/react/i18n";
4
+ import { type AccountPageName } from "./AccountRouterOptions.tsx";
4
5
  /**
5
6
  * The whole `/account` surface — five pages and their shell — mounted and
6
7
  * wired. The user-facing counterpart of `AdminRouter`.
@@ -23,46 +24,31 @@ import { type AccountPage } from "./AccountRouterOptions.tsx";
23
24
  * });
24
25
  * ```
25
26
  *
26
- * ### It needs `<DialogProvider>` and `<Toaster />` above it
27
+ * ### A root shell, like `/admin`
27
28
  *
28
- * `account-sessions` and `account-connections` call `useDialog()`, which
29
- * throws `useDialog requires <DialogProvider>` on the first confirm, and both
30
- * raise toasts. Neither this shell nor `AdminLayout` mounts either provider,
31
- * on purpose: a second `<Toaster />` under an application that already has
32
- * one shows every toast twice, and that is a worse failure than a clear
33
- * throw because nothing points at the cause.
29
+ * {@link AccountRouter.layout} is a root `$page`: registering the service
30
+ * puts `/account` at the root of the application, drawn by `AccountLayout`,
31
+ * a full-viewport `NavShell` with a floating sidebar, its own topbar and a
32
+ * way back to the site. It is **not** adopted into the application's own
33
+ * layout any more. Its `AppShell` mounts `DialogProvider`, `Toaster` and
34
+ * `ActionErrorToaster` itself, so an application that still put
35
+ * `this.account.layout` among its layout's `children`, under a layout with
36
+ * its own `Toaster`, would show every toast twice.
34
37
  *
35
- * `AppShell` already mounts both, so an application built on it has nothing
36
- * to do. Mounting these pages **standalone**, or under `AppShell` with
37
- * `embedded` (which skips both wrappers), means supplying them:
38
- *
39
- * ```tsx
40
- * <DialogProvider>
41
- * <Toaster />
42
- * {children}
43
- * </DialogProvider>
44
- * ```
45
- *
46
- * The same applies to `AdminRouter`, for the same components.
47
- *
48
- * ### Mount it standalone, or inside your own layout
49
- *
50
- * {@link AccountRouter.layout} is a root `$page`, so registering the service
51
- * puts `/account` at the root with only the `header` slot for chrome. An
52
- * application that wants it *inside* its own header and footer adds
53
- * `accountRouter.layout` to that layout's `children`:
38
+ * The chrome is configured on `accountRouterOptionsAtom` (`brand`,
39
+ * `topbarActions`, `homeRouteName`, `loginRouteName`, `colorScheme`,
40
+ * `extraNav`), mirroring `adminRouterOptionsAtom`:
54
41
  *
55
42
  * ```ts
56
- * layout = $page({
57
- * children: () => [this.home, this.account.layout, this.notFound],
58
- * lazy: () => import("./Layout.tsx"),
43
+ * alepha.set(accountRouterOptionsAtom, {
44
+ * brand: <MyBrand />,
45
+ * homeRouteName: "home",
59
46
  * });
60
47
  * ```
61
48
  *
62
- * `ReactPageProvider` excludes an adopted page from the root set, so it
63
- * renders nested. This is why the options atom has no `parent` field: a
64
- * boot-time atom carrying a `PagePrimitive` would be order-fragile, and the
65
- * mechanism already exists.
49
+ * A page frames itself with `AccountPage`: `variant="table"` for a
50
+ * `DataTable` filling the area, `variant="form"` for a centred column of
51
+ * cards.
66
52
  *
67
53
  * ### Every page is mounted; none is conditionally registered
68
54
  *
@@ -94,14 +80,49 @@ import { type AccountPage } from "./AccountRouterOptions.tsx";
94
80
  *
95
81
  * ### Extending the shell
96
82
  *
97
- * `$pageAccount` is the one-call way to add a page. Take `order: 100` or
98
- * above, or declare your own `nav.group` — the built-ins occupy `Account`
99
- * (order 1) and `Security` (orders 2-5), and `useNavEntries` sorts groups by
100
- * their smallest member, so a page at a lower order silently reshuffles the
101
- * shared rail.
83
+ * `$pageAccount` is the one-call way to add a page.
84
+ *
85
+ * ### Group order is a contract
86
+ *
87
+ * Three bands, personal first, then the application, then security:
88
+ *
89
+ * - `Account` (Profile) at order 1;
90
+ * - the application's own groups at 100-999;
91
+ * - `Security` (Security, Sessions, API keys, Connected apps) parked at
92
+ * 1000-1003.
93
+ *
94
+ * `useNavEntries` sorts groups by their smallest member, so a page at
95
+ * `order: 100` with its own `nav.group` sorts between the two built-in
96
+ * groups without asking, and only an order of 1000 or more sinks it in among
97
+ * the security pages.
98
+ *
99
+ * ### Tab titles
100
+ *
101
+ * Every built-in page's head is {@link AccountRouter.accountHead}:
102
+ * `Account - <Page>` in the reader's language, the way `adminHead` titles
103
+ * the admin console.
102
104
  */
103
105
  export declare class AccountRouter {
104
106
  protected readonly options: Readonly<import("./AccountRouterOptions.tsx").AccountRouterOptions>;
107
+ protected readonly i18n: I18nProvider<object, never>;
108
+ /**
109
+ * The head of an account page: `Account - <Page>` in the browser tab.
110
+ *
111
+ * A function, evaluated when the page renders, so the tab follows the
112
+ * reader's language: `key` names the page's title in the catalogue (the
113
+ * built-ins pass their nav `labelKey`), `title` is the English fallback,
114
+ * and the prefix is `account.title`. The layout cannot add the prefix
115
+ * itself, for the reason `AdminRouter.adminHead` gives: `HeadProvider`
116
+ * would join the two as "Profile - Account".
117
+ */
118
+ accountHead(title: string, key?: string): () => {
119
+ title: string;
120
+ };
121
+ /**
122
+ * `Account - <title>`, the prefix in the reader's language
123
+ * (`account.title`). The title itself is used as given.
124
+ */
125
+ accountTitle(title: string): string;
105
126
  /**
106
127
  * Whether the application has declared it does not offer this page.
107
128
  *
@@ -110,7 +131,7 @@ export declare class AccountRouter {
110
131
  * `AccountRouterOptions.hide` for the page this exists for and why `can`
111
132
  * alone cannot answer it.
112
133
  */
113
- protected hidden(page: AccountPage): boolean;
134
+ protected hidden(page: AccountPageName): boolean;
114
135
  protected readonly profileApi: import("alepha/server/links").HttpVirtualClient<MyProfileController>;
115
136
  protected readonly realmApi: import("alepha/server/links").HttpVirtualClient<RealmController>;
116
137
  protected readonly identityApi: import("alepha/server/links").HttpVirtualClient<MyIdentityController>;
@@ -1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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCJ;IAEH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BL;IAEH,QAAQ;;;;;;;;;;;;;;;YAkBL;IAEH,IAAI;;;;;;;;;;;;;;;;;;;YAkBD;IAEH,WAAW;;;;;;;;;;;;;;;;;YAqBR;CACJ"}
@@ -1,7 +1,8 @@
1
1
  import { $pageNav } from "../shell/$pageNav.js";
2
2
  import { accountRouterOptionsAtom } from "./AccountRouterOptions.js";
3
- import { $store } from "alepha";
3
+ import { $inject, $store } from "alepha";
4
4
  import { $secure } from "alepha/security";
5
+ import { I18nProvider } from "alepha/react/i18n";
5
6
  import { $client } from "alepha/server/links";
6
7
  import { KeyRound, Plug, RadioTower, ShieldCheck, User } from "lucide-react";
7
8
  import { createElement } from "react";
@@ -28,46 +29,31 @@ import { createElement } from "react";
28
29
  * });
29
30
  * ```
30
31
  *
31
- * ### It needs `<DialogProvider>` and `<Toaster />` above it
32
+ * ### A root shell, like `/admin`
32
33
  *
33
- * `account-sessions` and `account-connections` call `useDialog()`, which
34
- * throws `useDialog requires <DialogProvider>` on the first confirm, and both
35
- * raise toasts. Neither this shell nor `AdminLayout` mounts either provider,
36
- * on purpose: a second `<Toaster />` under an application that already has
37
- * one shows every toast twice, and that is a worse failure than a clear
38
- * throw because nothing points at the cause.
34
+ * {@link AccountRouter.layout} is a root `$page`: registering the service
35
+ * puts `/account` at the root of the application, drawn by `AccountLayout`,
36
+ * a full-viewport `NavShell` with a floating sidebar, its own topbar and a
37
+ * way back to the site. It is **not** adopted into the application's own
38
+ * layout any more. Its `AppShell` mounts `DialogProvider`, `Toaster` and
39
+ * `ActionErrorToaster` itself, so an application that still put
40
+ * `this.account.layout` among its layout's `children`, under a layout with
41
+ * its own `Toaster`, would show every toast twice.
39
42
  *
40
- * `AppShell` already mounts both, so an application built on it has nothing
41
- * to do. Mounting these pages **standalone**, or under `AppShell` with
42
- * `embedded` (which skips both wrappers), means supplying them:
43
- *
44
- * ```tsx
45
- * <DialogProvider>
46
- * <Toaster />
47
- * {children}
48
- * </DialogProvider>
49
- * ```
50
- *
51
- * The same applies to `AdminRouter`, for the same components.
52
- *
53
- * ### Mount it standalone, or inside your own layout
54
- *
55
- * {@link AccountRouter.layout} is a root `$page`, so registering the service
56
- * puts `/account` at the root with only the `header` slot for chrome. An
57
- * application that wants it *inside* its own header and footer adds
58
- * `accountRouter.layout` to that layout's `children`:
43
+ * The chrome is configured on `accountRouterOptionsAtom` (`brand`,
44
+ * `topbarActions`, `homeRouteName`, `loginRouteName`, `colorScheme`,
45
+ * `extraNav`), mirroring `adminRouterOptionsAtom`:
59
46
  *
60
47
  * ```ts
61
- * layout = $page({
62
- * children: () => [this.home, this.account.layout, this.notFound],
63
- * lazy: () => import("./Layout.tsx"),
48
+ * alepha.set(accountRouterOptionsAtom, {
49
+ * brand: <MyBrand />,
50
+ * homeRouteName: "home",
64
51
  * });
65
52
  * ```
66
53
  *
67
- * `ReactPageProvider` excludes an adopted page from the root set, so it
68
- * renders nested. This is why the options atom has no `parent` field: a
69
- * boot-time atom carrying a `PagePrimitive` would be order-fragile, and the
70
- * mechanism already exists.
54
+ * A page frames itself with `AccountPage`: `variant="table"` for a
55
+ * `DataTable` filling the area, `variant="form"` for a centred column of
56
+ * cards.
71
57
  *
72
58
  * ### Every page is mounted; none is conditionally registered
73
59
  *
@@ -99,14 +85,54 @@ import { createElement } from "react";
99
85
  *
100
86
  * ### Extending the shell
101
87
  *
102
- * `$pageAccount` is the one-call way to add a page. Take `order: 100` or
103
- * above, or declare your own `nav.group` — the built-ins occupy `Account`
104
- * (order 1) and `Security` (orders 2-5), and `useNavEntries` sorts groups by
105
- * their smallest member, so a page at a lower order silently reshuffles the
106
- * shared rail.
88
+ * `$pageAccount` is the one-call way to add a page.
89
+ *
90
+ * ### Group order is a contract
91
+ *
92
+ * Three bands, personal first, then the application, then security:
93
+ *
94
+ * - `Account` (Profile) at order 1;
95
+ * - the application's own groups at 100-999;
96
+ * - `Security` (Security, Sessions, API keys, Connected apps) parked at
97
+ * 1000-1003.
98
+ *
99
+ * `useNavEntries` sorts groups by their smallest member, so a page at
100
+ * `order: 100` with its own `nav.group` sorts between the two built-in
101
+ * groups without asking, and only an order of 1000 or more sinks it in among
102
+ * the security pages.
103
+ *
104
+ * ### Tab titles
105
+ *
106
+ * Every built-in page's head is {@link AccountRouter.accountHead}:
107
+ * `Account - <Page>` in the reader's language, the way `adminHead` titles
108
+ * the admin console.
107
109
  */
108
110
  var AccountRouter = class {
109
111
  options = $store(accountRouterOptionsAtom);
112
+ i18n = $inject(I18nProvider);
113
+ /**
114
+ * The head of an account page: `Account - <Page>` in the browser tab.
115
+ *
116
+ * A function, evaluated when the page renders, so the tab follows the
117
+ * reader's language: `key` names the page's title in the catalogue (the
118
+ * built-ins pass their nav `labelKey`), `title` is the English fallback,
119
+ * and the prefix is `account.title`. The layout cannot add the prefix
120
+ * itself, for the reason `AdminRouter.adminHead` gives: `HeadProvider`
121
+ * would join the two as "Profile - Account".
122
+ */
123
+ accountHead(title, key) {
124
+ return () => ({ title: this.accountTitle(key ? this.i18n.tr(key, { default: title }) : title) });
125
+ }
126
+ /**
127
+ * `Account - <title>`, the prefix in the reader's language
128
+ * (`account.title`). The title itself is used as given.
129
+ */
130
+ accountTitle(title) {
131
+ return this.i18n.tr("account.title", {
132
+ default: "Account - $1",
133
+ args: [title]
134
+ });
135
+ }
110
136
  /**
111
137
  * Whether the application has declared it does not offer this page.
112
138
  *
@@ -150,7 +176,7 @@ var AccountRouter = class {
150
176
  parent: this.layout,
151
177
  path: "/",
152
178
  name: "accountProfile",
153
- head: { title: "Profile" },
179
+ head: this.accountHead("Profile", "account.nav.profile"),
154
180
  can: () => !this.hidden("profile") && this.profileApi.getMyProfile.can(),
155
181
  nav: {
156
182
  label: "Profile",
@@ -174,7 +200,7 @@ var AccountRouter = class {
174
200
  parent: this.layout,
175
201
  path: "/security",
176
202
  name: "accountSecurity",
177
- head: { title: "Security" },
203
+ head: this.accountHead("Security", "account.nav.security"),
178
204
  can: () => !this.hidden("security") && this.identityApi.listMyIdentities.can(),
179
205
  nav: {
180
206
  label: "Security",
@@ -182,7 +208,7 @@ var AccountRouter = class {
182
208
  icon: createElement(ShieldCheck),
183
209
  group: "Security",
184
210
  groupKey: "account.nav.group.security",
185
- order: 2,
211
+ order: 1e3,
186
212
  keywords: [
187
213
  "password",
188
214
  "identities",
@@ -204,7 +230,7 @@ var AccountRouter = class {
204
230
  parent: this.layout,
205
231
  path: "/sessions",
206
232
  name: "accountSessions",
207
- head: { title: "Sessions" },
233
+ head: this.accountHead("Sessions", "account.nav.sessions"),
208
234
  can: () => !this.hidden("sessions") && this.sessionApi.listMySessions.can(),
209
235
  nav: {
210
236
  label: "Sessions",
@@ -212,7 +238,7 @@ var AccountRouter = class {
212
238
  icon: createElement(RadioTower),
213
239
  group: "Security",
214
240
  groupKey: "account.nav.group.security",
215
- order: 3,
241
+ order: 1001,
216
242
  keywords: ["devices", "sign out"]
217
243
  },
218
244
  loader: async () => ({ sessions: await this.sessionApi.listMySessions() }),
@@ -223,7 +249,7 @@ var AccountRouter = class {
223
249
  parent: this.layout,
224
250
  path: "/keys",
225
251
  name: "accountKeys",
226
- head: { title: "API keys" },
252
+ head: this.accountHead("API keys", "account.nav.keys"),
227
253
  can: () => !this.hidden("keys") && this.apiKeyApi.listApiKeys.can(),
228
254
  nav: {
229
255
  label: "API keys",
@@ -231,7 +257,7 @@ var AccountRouter = class {
231
257
  icon: createElement(KeyRound),
232
258
  group: "Security",
233
259
  groupKey: "account.nav.group.security",
234
- order: 4,
260
+ order: 1002,
235
261
  keywords: ["tokens", "credentials"]
236
262
  },
237
263
  loader: async () => ({ apiKeys: await this.apiKeyApi.listApiKeys() }),
@@ -242,7 +268,7 @@ var AccountRouter = class {
242
268
  parent: this.layout,
243
269
  path: "/connections",
244
270
  name: "accountConnections",
245
- head: { title: "Connected apps" },
271
+ head: this.accountHead("Connected apps", "account.nav.connections"),
246
272
  can: () => !this.hidden("connections") && this.connectionApi.listMyConnections.can(),
247
273
  nav: {
248
274
  label: "Connected apps",
@@ -250,7 +276,7 @@ var AccountRouter = class {
250
276
  icon: createElement(Plug),
251
277
  group: "Security",
252
278
  groupKey: "account.nav.group.security",
253
- order: 5,
279
+ order: 1003,
254
280
  keywords: [
255
281
  "oauth",
256
282
  "mcp",
@@ -1 +1 @@
1
- {"version":3,"file":"AccountRouter.js","names":[],"sources":["../../src/account/AccountRouter.tsx"],"sourcesContent":["import { $store } from \"alepha\";\nimport type { ApiKeyController } from \"alepha/api/keys\";\nimport type {\n MyConnectionController,\n MyIdentityController,\n MyProfileController,\n MySessionController,\n RealmController,\n} from \"alepha/api/users\";\nimport { $secure } from \"alepha/security\";\nimport { $client } from \"alepha/server/links\";\nimport { KeyRound, Plug, RadioTower, ShieldCheck, User } from \"lucide-react\";\nimport { createElement } from \"react\";\n\nimport { $pageNav } from \"../shell/$pageNav.tsx\";\nimport {\n type AccountPage,\n accountRouterOptionsAtom,\n} from \"./AccountRouterOptions.tsx\";\n\n/**\n * The whole `/account` surface — five pages and their shell — mounted and\n * wired. The user-facing counterpart of `AdminRouter`.\n *\n * ⚠️ **Nav icons are `createElement(Icon)`, never `<Icon />`.** Same reason as\n * `AdminRouter`: this module is evaluated *eagerly* in the server graph, and\n * `alepha db migrations create` imports that graph under `tsx`, which applies\n * a tsconfig resolved from the app root. A file outside that tsconfig's\n * `include` — which this one is, living in a sibling workspace — gets\n * esbuild's defaults, whose JSX transform is the *classic* one. The emitted\n * `React.createElement` then fails with `ReferenceError: React is not\n * defined`, breaking migration generation for the whole app.\n *\n * ```ts\n * import { AccountRouter } from \"@alepha/ui/account\";\n *\n * export const MyWeb = $module({\n * name: \"my.web\",\n * services: [MyRouter, AuthRouter, AccountRouter],\n * });\n * ```\n *\n * ### It needs `<DialogProvider>` and `<Toaster />` above it\n *\n * `account-sessions` and `account-connections` call `useDialog()`, which\n * throws `useDialog requires <DialogProvider>` on the first confirm, and both\n * raise toasts. Neither this shell nor `AdminLayout` mounts either provider,\n * on purpose: a second `<Toaster />` under an application that already has\n * one shows every toast twice, and that is a worse failure than a clear\n * throw because nothing points at the cause.\n *\n * `AppShell` already mounts both, so an application built on it has nothing\n * to do. Mounting these pages **standalone**, or under `AppShell` with\n * `embedded` (which skips both wrappers), means supplying them:\n *\n * ```tsx\n * <DialogProvider>\n * <Toaster />\n * {children}\n * </DialogProvider>\n * ```\n *\n * The same applies to `AdminRouter`, for the same components.\n *\n * ### Mount it standalone, or inside your own layout\n *\n * {@link AccountRouter.layout} is a root `$page`, so registering the service\n * puts `/account` at the root with only the `header` slot for chrome. An\n * application that wants it *inside* its own header and footer adds\n * `accountRouter.layout` to that layout's `children`:\n *\n * ```ts\n * layout = $page({\n * children: () => [this.home, this.account.layout, this.notFound],\n * lazy: () => import(\"./Layout.tsx\"),\n * });\n * ```\n *\n * `ReactPageProvider` excludes an adopted page from the root set, so it\n * renders nested. This is why the options atom has no `parent` field: a\n * boot-time atom carrying a `PagePrimitive` would be order-fragile, and the\n * mechanism already exists.\n *\n * ### Every page is mounted; none is conditionally registered\n *\n * A page whose backing module is not registered hides itself through `can`,\n * which resolves an action name against `/api/_links` — a registry built from\n * the actions the server actually registered. `permission` could not do this:\n * `$secure` registers a permission at definition time whether or not any\n * controller backs it, so an admin holding `*` would be granted it over a\n * dead API. The API-keys page is the clearest case — it disappears entirely\n * for an application that never mounts `AlephaApiKeys`.\n *\n * (Connections is *not* an example of that any more. `MyConnectionController`\n * had to move from `api/oauth` into `api/users` to break a circular module\n * dependency, so its action exists wherever `api/users` does — see that\n * controller's own JSDoc.)\n *\n * There is deliberately no `pages: [...]` allowlist: a second gate on top of\n * one that already works goes stale.\n *\n * ### These five route names are prefixed on purpose\n *\n * `AdminRouter` already claims `sessions` and `keys` globally, and\n * `ReactPageProvider.page()` returns the *first* match on a duplicate — so\n * bare names here would shadow the admin ones, or be shadowed by them,\n * silently, depending on mount order. `accountProfile`, `accountSecurity`,\n * `accountSessions`, `accountKeys` and `accountConnections` each carry an\n * explicit `name:` so renaming a field later never changes the public route\n * name.\n *\n * ### Extending the shell\n *\n * `$pageAccount` is the one-call way to add a page. Take `order: 100` or\n * above, or declare your own `nav.group` — the built-ins occupy `Account`\n * (order 1) and `Security` (orders 2-5), and `useNavEntries` sorts groups by\n * their smallest member, so a page at a lower order silently reshuffles the\n * shared rail.\n */\nexport class AccountRouter {\n protected readonly options = $store(accountRouterOptionsAtom);\n\n /**\n * Whether the application has declared it does not offer this page.\n *\n * ANDed into each page's `can`, never replacing it: whether the action\n * exists stays the registry's question. See\n * `AccountRouterOptions.hide` for the page this exists for and why `can`\n * alone cannot answer it.\n */\n protected hidden(page: AccountPage): boolean {\n return this.options.hide?.includes(page) ?? false;\n }\n\n protected readonly profileApi = $client<MyProfileController>();\n protected readonly realmApi = $client<RealmController>();\n protected readonly identityApi = $client<MyIdentityController>();\n protected readonly sessionApi = $client<MySessionController>();\n protected readonly apiKeyApi = $client<ApiKeyController>();\n protected readonly connectionApi = $client<MyConnectionController>();\n\n /**\n * Anchors the shell. Not itself a nav entry — a shell root is excluded from\n * its own rail.\n *\n * `$secure()` with no permission means signed-in only, which is both the\n * right gate (nothing here means anything to an anonymous visitor) and what\n * puts the subtree in CSR.\n *\n * No index redirect: {@link profile} sits at `path: \"/\"`, so a bare\n * `/account` resolves to it directly. `AdminRouter` now anchors its\n * dashboard the same way.\n */\n layout = $pageNav({\n name: \"account\",\n path: \"/account\",\n use: [$secure()],\n nav: { label: \"Account\", labelKey: \"account.nav.account\" },\n lazy: () => import(\"./AccountLayout.tsx\"),\n });\n\n profile = $pageNav({\n parent: this.layout,\n path: \"/\",\n name: \"accountProfile\",\n head: { title: \"Profile\" },\n can: () => !this.hidden(\"profile\") && this.profileApi.getMyProfile.can(),\n nav: {\n label: \"Profile\",\n labelKey: \"account.nav.profile\",\n icon: createElement(User),\n group: \"Account\",\n groupKey: \"account.nav.group.account\",\n order: 1,\n },\n /*\n * `realmConfig` rides along because the page has one realm-dependent\n * field: a realm with `username: \"none\"` or `\"email\"` has no handle to\n * edit. It is the same call `AuthRouter.loadRealm` makes for the same\n * reason, and the same public endpoint — cheap, and already warm from\n * sign-in.\n *\n * Both are fetched together rather than in sequence: they do not depend\n * on each other, and the account area is behind `$secure`, so this runs\n * client-side where a waterfall is two round trips instead of one.\n */\n loader: async () => {\n const [profile, realmConfig] = await Promise.all([\n this.profileApi.getMyProfile(),\n this.realmApi.getRealmConfig(),\n ]);\n return { profile, realmConfig };\n },\n lazy: () => import(\"./AccountProfile.tsx\"),\n props: () => this.options.pages?.profile ?? {},\n });\n\n security = $pageNav({\n parent: this.layout,\n path: \"/security\",\n name: \"accountSecurity\",\n head: { title: \"Security\" },\n can: () =>\n !this.hidden(\"security\") && this.identityApi.listMyIdentities.can(),\n nav: {\n label: \"Security\",\n labelKey: \"account.nav.security\",\n icon: createElement(ShieldCheck),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 2,\n keywords: [\"password\", \"identities\", \"sign-in\", \"delete account\"],\n },\n /*\n * `realmConfig` rides along for the same reason it does on {@link profile}:\n * one row here is realm-dependent. A realm with `mfa.totp: \"disabled\"` must\n * not be offered the two-factor row, or the user enrolls into a factor the\n * login gate will never ask for.\n */\n loader: async () => {\n const [identities, realmConfig] = await Promise.all([\n this.identityApi.listMyIdentities(),\n this.realmApi.getRealmConfig(),\n ]);\n return { identities, realmConfig };\n },\n lazy: () => import(\"./AccountSecurity.tsx\"),\n props: () => this.options.pages?.security ?? {},\n });\n\n sessions = $pageNav({\n parent: this.layout,\n path: \"/sessions\",\n name: \"accountSessions\",\n head: { title: \"Sessions\" },\n can: () => !this.hidden(\"sessions\") && this.sessionApi.listMySessions.can(),\n nav: {\n label: \"Sessions\",\n labelKey: \"account.nav.sessions\",\n icon: createElement(RadioTower),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 3,\n keywords: [\"devices\", \"sign out\"],\n },\n loader: async () => ({ sessions: await this.sessionApi.listMySessions() }),\n lazy: () => import(\"./AccountSessions.tsx\"),\n props: () => this.options.pages?.sessions ?? {},\n });\n\n keys = $pageNav({\n parent: this.layout,\n path: \"/keys\",\n name: \"accountKeys\",\n head: { title: \"API keys\" },\n can: () => !this.hidden(\"keys\") && this.apiKeyApi.listApiKeys.can(),\n nav: {\n label: \"API keys\",\n labelKey: \"account.nav.keys\",\n icon: createElement(KeyRound),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 4,\n keywords: [\"tokens\", \"credentials\"],\n },\n loader: async () => ({ apiKeys: await this.apiKeyApi.listApiKeys() }),\n lazy: () => import(\"./AccountKeys.tsx\"),\n props: () => this.options.pages?.keys ?? {},\n });\n\n connections = $pageNav({\n parent: this.layout,\n path: \"/connections\",\n name: \"accountConnections\",\n head: { title: \"Connected apps\" },\n can: () =>\n !this.hidden(\"connections\") && this.connectionApi.listMyConnections.can(),\n nav: {\n label: \"Connected apps\",\n labelKey: \"account.nav.connections\",\n icon: createElement(Plug),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 5,\n keywords: [\"oauth\", \"mcp\", \"integrations\"],\n },\n loader: async () => ({\n connections: await this.connectionApi.listMyConnections(),\n }),\n lazy: () => import(\"./AccountConnections.tsx\"),\n props: () => this.options.pages?.connections ?? {},\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,IAAa,gBAAb,MAA2B;CACzB,UAA6B,OAAO,wBAAwB;;;;;;;;;CAU5D,OAAiB,MAA4B;EAC3C,OAAO,KAAK,QAAQ,MAAM,SAAS,IAAI,KAAK;CAC9C;CAEA,aAAgC,QAA6B;CAC7D,WAA8B,QAAyB;CACvD,cAAiC,QAA8B;CAC/D,aAAgC,Q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eAAe,CAAC;CACnD,CAAC;AACH"}
1
+ {"version":3,"file":"AccountRouter.js","names":[],"sources":["../../src/account/AccountRouter.tsx"],"sourcesContent":["import { $inject, $store } from \"alepha\";\nimport type { ApiKeyController } from \"alepha/api/keys\";\nimport type {\n MyConnectionController,\n MyIdentityController,\n MyProfileController,\n MySessionController,\n RealmController,\n} from \"alepha/api/users\";\nimport { I18nProvider } from \"alepha/react/i18n\";\nimport { $secure } from \"alepha/security\";\nimport { $client } from \"alepha/server/links\";\nimport { KeyRound, Plug, RadioTower, ShieldCheck, User } from \"lucide-react\";\nimport { createElement } from \"react\";\n\nimport { $pageNav } from \"../shell/$pageNav.tsx\";\nimport {\n type AccountPageName,\n accountRouterOptionsAtom,\n} from \"./AccountRouterOptions.tsx\";\n\n/**\n * The whole `/account` surface — five pages and their shell — mounted and\n * wired. The user-facing counterpart of `AdminRouter`.\n *\n * ⚠️ **Nav icons are `createElement(Icon)`, never `<Icon />`.** Same reason as\n * `AdminRouter`: this module is evaluated *eagerly* in the server graph, and\n * `alepha db migrations create` imports that graph under `tsx`, which applies\n * a tsconfig resolved from the app root. A file outside that tsconfig's\n * `include` — which this one is, living in a sibling workspace — gets\n * esbuild's defaults, whose JSX transform is the *classic* one. The emitted\n * `React.createElement` then fails with `ReferenceError: React is not\n * defined`, breaking migration generation for the whole app.\n *\n * ```ts\n * import { AccountRouter } from \"@alepha/ui/account\";\n *\n * export const MyWeb = $module({\n * name: \"my.web\",\n * services: [MyRouter, AuthRouter, AccountRouter],\n * });\n * ```\n *\n * ### A root shell, like `/admin`\n *\n * {@link AccountRouter.layout} is a root `$page`: registering the service\n * puts `/account` at the root of the application, drawn by `AccountLayout`,\n * a full-viewport `NavShell` with a floating sidebar, its own topbar and a\n * way back to the site. It is **not** adopted into the application's own\n * layout any more. Its `AppShell` mounts `DialogProvider`, `Toaster` and\n * `ActionErrorToaster` itself, so an application that still put\n * `this.account.layout` among its layout's `children`, under a layout with\n * its own `Toaster`, would show every toast twice.\n *\n * The chrome is configured on `accountRouterOptionsAtom` (`brand`,\n * `topbarActions`, `homeRouteName`, `loginRouteName`, `colorScheme`,\n * `extraNav`), mirroring `adminRouterOptionsAtom`:\n *\n * ```ts\n * alepha.set(accountRouterOptionsAtom, {\n * brand: <MyBrand />,\n * homeRouteName: \"home\",\n * });\n * ```\n *\n * A page frames itself with `AccountPage`: `variant=\"table\"` for a\n * `DataTable` filling the area, `variant=\"form\"` for a centred column of\n * cards.\n *\n * ### Every page is mounted; none is conditionally registered\n *\n * A page whose backing module is not registered hides itself through `can`,\n * which resolves an action name against `/api/_links` — a registry built from\n * the actions the server actually registered. `permission` could not do this:\n * `$secure` registers a permission at definition time whether or not any\n * controller backs it, so an admin holding `*` would be granted it over a\n * dead API. The API-keys page is the clearest case — it disappears entirely\n * for an application that never mounts `AlephaApiKeys`.\n *\n * (Connections is *not* an example of that any more. `MyConnectionController`\n * had to move from `api/oauth` into `api/users` to break a circular module\n * dependency, so its action exists wherever `api/users` does — see that\n * controller's own JSDoc.)\n *\n * There is deliberately no `pages: [...]` allowlist: a second gate on top of\n * one that already works goes stale.\n *\n * ### These five route names are prefixed on purpose\n *\n * `AdminRouter` already claims `sessions` and `keys` globally, and\n * `ReactPageProvider.page()` returns the *first* match on a duplicate — so\n * bare names here would shadow the admin ones, or be shadowed by them,\n * silently, depending on mount order. `accountProfile`, `accountSecurity`,\n * `accountSessions`, `accountKeys` and `accountConnections` each carry an\n * explicit `name:` so renaming a field later never changes the public route\n * name.\n *\n * ### Extending the shell\n *\n * `$pageAccount` is the one-call way to add a page.\n *\n * ### Group order is a contract\n *\n * Three bands, personal first, then the application, then security:\n *\n * - `Account` (Profile) at order 1;\n * - the application's own groups at 100-999;\n * - `Security` (Security, Sessions, API keys, Connected apps) parked at\n * 1000-1003.\n *\n * `useNavEntries` sorts groups by their smallest member, so a page at\n * `order: 100` with its own `nav.group` sorts between the two built-in\n * groups without asking, and only an order of 1000 or more sinks it in among\n * the security pages.\n *\n * ### Tab titles\n *\n * Every built-in page's head is {@link AccountRouter.accountHead}:\n * `Account - <Page>` in the reader's language, the way `adminHead` titles\n * the admin console.\n */\nexport class AccountRouter {\n protected readonly options = $store(accountRouterOptionsAtom);\n protected readonly i18n = $inject(I18nProvider);\n\n /**\n * The head of an account page: `Account - <Page>` in the browser tab.\n *\n * A function, evaluated when the page renders, so the tab follows the\n * reader's language: `key` names the page's title in the catalogue (the\n * built-ins pass their nav `labelKey`), `title` is the English fallback,\n * and the prefix is `account.title`. The layout cannot add the prefix\n * itself, for the reason `AdminRouter.adminHead` gives: `HeadProvider`\n * would join the two as \"Profile - Account\".\n */\n public accountHead(title: string, key?: string): () => { title: string } {\n return () => ({\n title: this.accountTitle(\n key ? this.i18n.tr(key, { default: title }) : title,\n ),\n });\n }\n\n /**\n * `Account - <title>`, the prefix in the reader's language\n * (`account.title`). The title itself is used as given.\n */\n public accountTitle(title: string): string {\n return this.i18n.tr(\"account.title\", {\n default: \"Account - $1\",\n args: [title],\n });\n }\n\n /**\n * Whether the application has declared it does not offer this page.\n *\n * ANDed into each page's `can`, never replacing it: whether the action\n * exists stays the registry's question. See\n * `AccountRouterOptions.hide` for the page this exists for and why `can`\n * alone cannot answer it.\n */\n protected hidden(page: AccountPageName): boolean {\n return this.options.hide?.includes(page) ?? false;\n }\n\n protected readonly profileApi = $client<MyProfileController>();\n protected readonly realmApi = $client<RealmController>();\n protected readonly identityApi = $client<MyIdentityController>();\n protected readonly sessionApi = $client<MySessionController>();\n protected readonly apiKeyApi = $client<ApiKeyController>();\n protected readonly connectionApi = $client<MyConnectionController>();\n\n /**\n * Anchors the shell. Not itself a nav entry — a shell root is excluded from\n * its own rail.\n *\n * `$secure()` with no permission means signed-in only, which is both the\n * right gate (nothing here means anything to an anonymous visitor) and what\n * puts the subtree in CSR.\n *\n * No index redirect: {@link profile} sits at `path: \"/\"`, so a bare\n * `/account` resolves to it directly. `AdminRouter` now anchors its\n * dashboard the same way.\n */\n layout = $pageNav({\n name: \"account\",\n path: \"/account\",\n use: [$secure()],\n nav: { label: \"Account\", labelKey: \"account.nav.account\" },\n lazy: () => import(\"./AccountLayout.tsx\"),\n });\n\n profile = $pageNav({\n parent: this.layout,\n path: \"/\",\n name: \"accountProfile\",\n head: this.accountHead(\"Profile\", \"account.nav.profile\"),\n can: () => !this.hidden(\"profile\") && this.profileApi.getMyProfile.can(),\n nav: {\n label: \"Profile\",\n labelKey: \"account.nav.profile\",\n icon: createElement(User),\n group: \"Account\",\n groupKey: \"account.nav.group.account\",\n order: 1,\n },\n /*\n * `realmConfig` rides along because the page has one realm-dependent\n * field: a realm with `username: \"none\"` or `\"email\"` has no handle to\n * edit. It is the same call `AuthRouter.loadRealm` makes for the same\n * reason, and the same public endpoint — cheap, and already warm from\n * sign-in.\n *\n * Both are fetched together rather than in sequence: they do not depend\n * on each other, and the account area is behind `$secure`, so this runs\n * client-side where a waterfall is two round trips instead of one.\n */\n loader: async () => {\n const [profile, realmConfig] = await Promise.all([\n this.profileApi.getMyProfile(),\n this.realmApi.getRealmConfig(),\n ]);\n return { profile, realmConfig };\n },\n lazy: () => import(\"./AccountProfile.tsx\"),\n props: () => this.options.pages?.profile ?? {},\n });\n\n security = $pageNav({\n parent: this.layout,\n path: \"/security\",\n name: \"accountSecurity\",\n head: this.accountHead(\"Security\", \"account.nav.security\"),\n can: () =>\n !this.hidden(\"security\") && this.identityApi.listMyIdentities.can(),\n nav: {\n label: \"Security\",\n labelKey: \"account.nav.security\",\n icon: createElement(ShieldCheck),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 1000,\n keywords: [\"password\", \"identities\", \"sign-in\", \"delete account\"],\n },\n /*\n * `realmConfig` rides along for the same reason it does on {@link profile}:\n * one row here is realm-dependent. A realm with `mfa.totp: \"disabled\"` must\n * not be offered the two-factor row, or the user enrolls into a factor the\n * login gate will never ask for.\n */\n loader: async () => {\n const [identities, realmConfig] = await Promise.all([\n this.identityApi.listMyIdentities(),\n this.realmApi.getRealmConfig(),\n ]);\n return { identities, realmConfig };\n },\n lazy: () => import(\"./AccountSecurity.tsx\"),\n props: () => this.options.pages?.security ?? {},\n });\n\n sessions = $pageNav({\n parent: this.layout,\n path: \"/sessions\",\n name: \"accountSessions\",\n head: this.accountHead(\"Sessions\", \"account.nav.sessions\"),\n can: () => !this.hidden(\"sessions\") && this.sessionApi.listMySessions.can(),\n nav: {\n label: \"Sessions\",\n labelKey: \"account.nav.sessions\",\n icon: createElement(RadioTower),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 1001,\n keywords: [\"devices\", \"sign out\"],\n },\n loader: async () => ({ sessions: await this.sessionApi.listMySessions() }),\n lazy: () => import(\"./AccountSessions.tsx\"),\n props: () => this.options.pages?.sessions ?? {},\n });\n\n keys = $pageNav({\n parent: this.layout,\n path: \"/keys\",\n name: \"accountKeys\",\n head: this.accountHead(\"API keys\", \"account.nav.keys\"),\n can: () => !this.hidden(\"keys\") && this.apiKeyApi.listApiKeys.can(),\n nav: {\n label: \"API keys\",\n labelKey: \"account.nav.keys\",\n icon: createElement(KeyRound),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 1002,\n keywords: [\"tokens\", \"credentials\"],\n },\n loader: async () => ({ apiKeys: await this.apiKeyApi.listApiKeys() }),\n lazy: () => import(\"./AccountKeys.tsx\"),\n props: () => this.options.pages?.keys ?? {},\n });\n\n connections = $pageNav({\n parent: this.layout,\n path: \"/connections\",\n name: \"accountConnections\",\n head: this.accountHead(\"Connected apps\", \"account.nav.connections\"),\n can: () =>\n !this.hidden(\"connections\") && this.connectionApi.listMyConnections.can(),\n nav: {\n label: \"Connected apps\",\n labelKey: \"account.nav.connections\",\n icon: createElement(Plug),\n group: \"Security\",\n groupKey: \"account.nav.group.security\",\n order: 1003,\n keywords: [\"oauth\", \"mcp\", \"integrations\"],\n },\n loader: async () => ({\n connections: await this.connectionApi.listMyConnections(),\n }),\n lazy: () => import(\"./AccountConnections.tsx\"),\n props: () => this.options.pages?.connections ?? {},\n });\n}\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,UAAU,YAAY,IAAI;EAClE,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,QAAQ;GAC5B,OAAO;GACP,UAAU;GACV,OAAO;GACP,UAAU,CAAC,UAAU,aAAa;EACpC;EACA,QAAQ,aAAa,EAAE,SAAS,MAAM,KAAK,UAAU,YAAY,EAAE;EACnE,YAAY,OAAO;EACnB,aAAa,KAAK,QAAQ,OAAO,QAAQ,CAAC;CAC5C,CAAC;CAED,cAAc,SAAS;EACrB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,KAAK,YAAY,kBAAkB,yBAAyB;EAClE,WACE,CAAC,KAAK,OAAO,aAAa,KAAK,KAAK,cAAc,kBAAkB,IAAI;EAC1E,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,IAAI;GACxB,OAAO;GACP,UAAU;GACV,OAAO;GACP,UAAU;IAAC;IAAS;IAAO;GAAc;EAC3C;EACA,QAAQ,aAAa,EACnB,aAAa,MAAM,KAAK,cAAc,kBAAkB,EAC1D;EACA,YAAY,OAAO;EACnB,aAAa,KAAK,QAAQ,OAAO,eAAe,CAAC;CACnD,CAAC;AACH"}
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { NavGroup } from "../shell/appShellNav.tsx";
2
3
  import type { AccountConnectionsProps } from "./AccountConnections.tsx";
3
4
  import type { AccountKeysProps } from "./AccountKeys.tsx";
4
5
  import type { AccountProfileProps } from "./AccountProfile.tsx";
@@ -8,46 +9,74 @@ import type { AccountSessionsProps } from "./AccountSessions.tsx";
8
9
  * Everything an application can change about `AccountRouter` without writing
9
10
  * its own.
10
11
  *
11
- * The seam is narrower than the admin one, and deliberately so — an account
12
- * area is a handful of forms, not a console. An application wanting different
13
- * URLs or a different page set writes its own router; the same trade
14
- * `AuthRouter` documents.
12
+ * The chrome slots mirror `AdminRouterOptions`, because the account area is
13
+ * the same kind of shell: a root `NavShell` with its own sidebar and topbar,
14
+ * never adopted into the application's layout. The page seam is narrower: an
15
+ * application wanting different URLs or a different page set writes its own
16
+ * router, the same trade `AuthRouter` documents.
17
+ *
18
+ * There is no `header` and no `fill` any more. Both existed for an account
19
+ * area nested inside the application's chrome (#F111), which is no longer a
20
+ * way to mount it: the shell owns the viewport, so it has nothing to bound
21
+ * and no second header to suppress.
15
22
  */
16
23
  export interface AccountRouterOptions {
17
24
  /**
18
- * Replaces the default {@link AccountHeader} — the back link plus the
19
- * ambient controls — entirely. Supply the whole bar, not an addition to it.
25
+ * Sidebar header. Defaults to `AccountBrand`: the signed-in user's avatar
26
+ * and name, the account area being theirs.
27
+ *
28
+ * ⚠️ **It must handle the sidebar collapsing to an icon rail itself**, the
29
+ * same contract as `AdminRouterOptions.brand`: keep whatever reads as an
30
+ * icon, hide the words with `group-data-[collapsible=icon]:hidden`.
31
+ */
32
+ brand?: ReactNode;
33
+ /**
34
+ * Replaces the default account cluster (`ButtonSettings`: language, theme,
35
+ * display mode and the way back to the site) entirely when set. Supply the
36
+ * whole cluster, not an addition to it.
20
37
  *
21
- * Set it to `null` for an account area nested inside an application's own
22
- * chrome, where a second header would just be a second row of the same
23
- * controls.
38
+ * The ⌘K search affordance is not part of the cluster and always renders:
39
+ * the Spotlight state it opens lives inside the layout.
24
40
  */
25
- header?: ReactNode;
41
+ topbarActions?: ReactNode;
26
42
  /**
27
- * Route name the default header's back link points at. Ignored when
28
- * `header` is supplied, since that replaces the link too.
43
+ * Route name the account menu's "Back to site" item pushes: the way out of
44
+ * a shell that, like `/admin`, is not drawn inside the application's own
45
+ * chrome.
29
46
  *
30
47
  * @default "home"
31
48
  */
32
49
  homeRouteName?: string;
33
50
  /**
34
- * Extra class(es) merged onto the shell's root element, for an account area
35
- * living inside a document the application does not fully own.
51
+ * Route name the account menu's sign-in affordance pushes, for an
52
+ * application mounting its auth pages under another name than
53
+ * `AuthRouter`'s `login`. See `AdminRouterOptions.loginRouteName` for why
54
+ * it answers this one button and not the router.
55
+ *
56
+ * @default "login"
36
57
  */
37
- className?: string;
58
+ loginRouteName?: string;
38
59
  /**
39
- * Bound the account area to its parent's height and let its content column
40
- * scroll, rather than relying on the document to scroll.
60
+ * Set `false` to keep the shell from mounting `<ColorScheme />`.
41
61
  *
42
- * Set it whenever the application adopts `AccountRouter.layout` into a shell
43
- * that has taken the viewport height and hidden its overflow — the common
44
- * `h-svh … overflow-hidden` app frame. Without it those pages have no
45
- * scrollbar at all in such a shell, and everything past the fold is
46
- * unreachable rather than merely below.
62
+ * The shell mounts it because `/account` is a root shell, not a child of
63
+ * the application's layout, so nothing else would apply the dark-mode
64
+ * class to `<html>`. An application whose host document owns that class
65
+ * itself turns this off.
47
66
  *
48
- * @default false — the account area scrolls with the document.
67
+ * @default true
49
68
  */
50
- fill?: boolean;
69
+ colorScheme?: boolean;
70
+ /**
71
+ * Nav groups appended after the route-derived ones, for entries that map to
72
+ * no route. Forwarded to `NavShell`'s own `extraNav`.
73
+ */
74
+ extraNav?: NavGroup[];
75
+ /**
76
+ * Extra class(es) merged onto the shell's root element, for an account area
77
+ * living inside a document the application does not fully own.
78
+ */
79
+ className?: string;
51
80
  /**
52
81
  * Props forwarded to the pages, keyed by page.
53
82
  *
@@ -92,7 +121,7 @@ export interface AccountRouterOptions {
92
121
  * alepha.set(accountRouterOptionsAtom, { hide: ["connections"] });
93
122
  * ```
94
123
  */
95
- hide?: AccountPage[];
124
+ hide?: AccountPageName[];
96
125
  }
97
126
  /**
98
127
  * The pages `AccountRouter` mounts, by the field that declares each one.
@@ -100,7 +129,7 @@ export interface AccountRouterOptions {
100
129
  * Named rather than inlined so {@link AccountRouterOptions.hide} and the
101
130
  * router's own helper cannot drift apart on a rename.
102
131
  */
103
- export type AccountPage = "profile" | "security" | "sessions" | "keys" | "connections";
132
+ export type AccountPageName = "profile" | "security" | "sessions" | "keys" | "connections";
104
133
  /**
105
134
  * Boot-time configuration for `AccountRouter`, following the
106
135
  * `adminRouterOptionsAtom` pattern: the application calls
@@ -1 +1 @@
1
- {"version":3,"file":"AccountRouterOptions.d.ts","sourceRoot":"","sources":["../../src/account/AccountRouterOptions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;;;OAMG;IACH,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,mBAAmB,CAAC;QAC9B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAChC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAChC,IAAI,CAAC,EAAE,gBAAgB,CAAC;QACxB,WAAW,CAAC,EAAE,uBAAuB,CAAC;KACvC,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,CAAC;AAElB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,gIAKnC,CAAC"}
1
+ {"version":3,"file":"AccountRouterOptions.d.ts","sourceRoot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B;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,CAAC;AAElB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,gIAKnC,CAAC"}
@@ -12,7 +12,7 @@ import { $atom, z } from "alepha";
12
12
  */
13
13
  const accountRouterOptionsAtom = $atom({
14
14
  name: "alepha.ui.account.router.options",
15
- description: "Chrome slot and per-page props for the account router.",
15
+ description: "Chrome slots and per-page props for the account router.",
16
16
  schema: z.custom(),
17
17
  default: {}
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AccountRouterOptions.js","names":[],"sources":["../../src/account/AccountRouterOptions.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AccountConnectionsProps } from \"./AccountConnections.tsx\";\nimport type { AccountKeysProps } from \"./AccountKeys.tsx\";\nimport type { AccountProfileProps } from \"./AccountProfile.tsx\";\nimport type { AccountSecurityProps } from \"./AccountSecurity.tsx\";\nimport type { AccountSessionsProps } from \"./AccountSessions.tsx\";\n\n/**\n * Everything an application can change about `AccountRouter` without writing\n * its own.\n *\n * The seam is narrower than the admin one, and deliberately so — an account\n * area is a handful of forms, not a console. An application wanting different\n * URLs or a different page set writes its own router; the same trade\n * `AuthRouter` documents.\n */\nexport interface AccountRouterOptions {\n /**\n * Replaces the default {@link AccountHeader} — the back link plus the\n * ambient controls — entirely. Supply the whole bar, not an addition to it.\n *\n * Set it to `null` for an account area nested inside an application's own\n * chrome, where a second header would just be a second row of the same\n * controls.\n */\n header?: ReactNode;\n\n /**\n * Route name the default header's back link points at. Ignored when\n * `header` is supplied, since that replaces the link too.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Extra class(es) merged onto the shell's root element, for an account area\n * living inside a document the application does not fully own.\n */\n className?: string;\n\n /**\n * Bound the account area to its parent's height and let its content column\n * scroll, rather than relying on the document to scroll.\n *\n * Set it whenever the application adopts `AccountRouter.layout` into a shell\n * that has taken the viewport height and hidden its overflow — the common\n * `h-svh … overflow-hidden` app frame. Without it those pages have no\n * scrollbar at all in such a shell, and everything past the fold is\n * unreachable rather than merely below.\n *\n * @default false — the account area scrolls with the document.\n */\n fill?: boolean;\n\n /**\n * Props forwarded to the pages, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to a page is passable the day\n * it exists.\n */\n pages?: {\n profile?: AccountProfileProps;\n security?: AccountSecurityProps;\n sessions?: AccountSessionsProps;\n keys?: AccountKeysProps;\n connections?: AccountConnectionsProps;\n };\n\n /**\n * Pages this application does not offer at all.\n *\n * Each page is already gated on whether the action behind it is mounted,\n * and that answers most of the question: the API-keys page really does\n * disappear for an application that never mounts `AlephaApiKeys`.\n *\n * ⚠️ **It cannot answer a page whose action is always mounted.**\n * `MyConnectionController` ships with `$realm` and is `$secure()` with no\n * permission, so `listMyConnections` exists in every application ever\n * built on this router - and \"Connected apps\" was therefore offered to\n * citizens of a public service that has no OAuth client in the world, over\n * a list that is empty by construction. Whether the API exists is the\n * registry's question; whether the application offers it is the\n * application's, and only the application can answer the second.\n *\n * ANDed with the existing gate, never instead of it. A hidden page is\n * absent from the rail and refused on direct entry, exactly as one whose\n * action is missing already is.\n *\n * ⚠️ A list of exceptions rather than an allowlist, and that is the\n * difference from the `pages: [...]` this router's own doc block rules\n * out: an allowlist has to be kept complete, so a page added here would\n * vanish from every application that had already written one down. Unset\n * changes nothing, and a new page is offered by default.\n *\n * ```ts\n * alepha.set(accountRouterOptionsAtom, { hide: [\"connections\"] });\n * ```\n */\n hide?: AccountPage[];\n}\n\n/**\n * The pages `AccountRouter` mounts, by the field that declares each one.\n *\n * Named rather than inlined so {@link AccountRouterOptions.hide} and the\n * router's own helper cannot drift apart on a rename.\n */\nexport type AccountPage =\n | \"profile\"\n | \"security\"\n | \"sessions\"\n | \"keys\"\n | \"connections\";\n\n/**\n * Boot-time configuration for `AccountRouter`, following the\n * `adminRouterOptionsAtom` pattern: the application calls\n * `alepha.set(accountRouterOptionsAtom, { … })` once, before start.\n *\n * `z.custom` passthrough because the value carries React nodes, whose shape\n * TypeScript already owns. Being boot-configured also keeps it out of the SSR\n * payload — `StateManager.exportAtoms()` reads request scope only, and a\n * `ReactNode` would not survive JSON serialization.\n */\nexport const accountRouterOptionsAtom = $atom({\n name: \"alepha.ui.account.router.options\",\n description: \"Chrome slot and per-page props for the account router.\",\n schema: z.custom<AccountRouterOptions>(),\n default: {} satisfies AccountRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;AAgIA,MAAa,2BAA2B,MAAM;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,OAA6B;CACvC,SAAS,CAAC;AACZ,CAAC"}
1
+ {"version":3,"file":"AccountRouterOptions.js","names":[],"sources":["../../src/account/AccountRouterOptions.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { NavGroup } from \"../shell/appShellNav.tsx\";\nimport type { AccountConnectionsProps } from \"./AccountConnections.tsx\";\nimport type { AccountKeysProps } from \"./AccountKeys.tsx\";\nimport type { AccountProfileProps } from \"./AccountProfile.tsx\";\nimport type { AccountSecurityProps } from \"./AccountSecurity.tsx\";\nimport type { AccountSessionsProps } from \"./AccountSessions.tsx\";\n\n/**\n * Everything an application can change about `AccountRouter` without writing\n * its own.\n *\n * The chrome slots mirror `AdminRouterOptions`, because the account area is\n * the same kind of shell: a root `NavShell` with its own sidebar and topbar,\n * never adopted into the application's layout. The page seam is narrower: an\n * application wanting different URLs or a different page set writes its own\n * router, the same trade `AuthRouter` documents.\n *\n * There is no `header` and no `fill` any more. Both existed for an account\n * area nested inside the application's chrome (#F111), which is no longer a\n * way to mount it: the shell owns the viewport, so it has nothing to bound\n * and no second header to suppress.\n */\nexport interface AccountRouterOptions {\n /**\n * Sidebar header. Defaults to `AccountBrand`: the signed-in user's avatar\n * and name, the account area being theirs.\n *\n * ⚠️ **It must handle the sidebar collapsing to an icon rail itself**, the\n * same contract as `AdminRouterOptions.brand`: keep whatever reads as an\n * icon, hide the words with `group-data-[collapsible=icon]:hidden`.\n */\n brand?: ReactNode;\n\n /**\n * Replaces the default account cluster (`ButtonSettings`: language, theme,\n * display mode and the way back to the site) entirely when set. Supply the\n * whole cluster, not an addition to it.\n *\n * The ⌘K search affordance is not part of the cluster and always renders:\n * the Spotlight state it opens lives inside the layout.\n */\n topbarActions?: ReactNode;\n\n /**\n * Route name the account menu's \"Back to site\" item pushes: the way out of\n * a shell that, like `/admin`, is not drawn inside the application's own\n * chrome.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Route name the account menu's sign-in affordance pushes, for an\n * application mounting its auth pages under another name than\n * `AuthRouter`'s `login`. See `AdminRouterOptions.loginRouteName` for why\n * it answers this one button and not the router.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Set `false` to keep the shell from mounting `<ColorScheme />`.\n *\n * The shell mounts it because `/account` is a root shell, not a child of\n * the application's layout, so nothing else would apply the dark-mode\n * class to `<html>`. An application whose host document owns that class\n * itself turns this off.\n *\n * @default true\n */\n colorScheme?: boolean;\n\n /**\n * Nav groups appended after the route-derived ones, for entries that map to\n * no route. Forwarded to `NavShell`'s own `extraNav`.\n */\n extraNav?: NavGroup[];\n\n /**\n * Extra class(es) merged onto the shell's root element, for an account area\n * living inside a document the application does not fully own.\n */\n className?: string;\n\n /**\n * Props forwarded to the pages, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to a page is passable the day\n * it exists.\n */\n pages?: {\n profile?: AccountProfileProps;\n security?: AccountSecurityProps;\n sessions?: AccountSessionsProps;\n keys?: AccountKeysProps;\n connections?: AccountConnectionsProps;\n };\n\n /**\n * Pages this application does not offer at all.\n *\n * Each page is already gated on whether the action behind it is mounted,\n * and that answers most of the question: the API-keys page really does\n * disappear for an application that never mounts `AlephaApiKeys`.\n *\n * ⚠️ **It cannot answer a page whose action is always mounted.**\n * `MyConnectionController` ships with `$realm` and is `$secure()` with no\n * permission, so `listMyConnections` exists in every application ever\n * built on this router - and \"Connected apps\" was therefore offered to\n * citizens of a public service that has no OAuth client in the world, over\n * a list that is empty by construction. Whether the API exists is the\n * registry's question; whether the application offers it is the\n * application's, and only the application can answer the second.\n *\n * ANDed with the existing gate, never instead of it. A hidden page is\n * absent from the rail and refused on direct entry, exactly as one whose\n * action is missing already is.\n *\n * ⚠️ A list of exceptions rather than an allowlist, and that is the\n * difference from the `pages: [...]` this router's own doc block rules\n * out: an allowlist has to be kept complete, so a page added here would\n * vanish from every application that had already written one down. Unset\n * changes nothing, and a new page is offered by default.\n *\n * ```ts\n * alepha.set(accountRouterOptionsAtom, { hide: [\"connections\"] });\n * ```\n */\n hide?: AccountPageName[];\n}\n\n/**\n * The pages `AccountRouter` mounts, by the field that declares each one.\n *\n * Named rather than inlined so {@link AccountRouterOptions.hide} and the\n * router's own helper cannot drift apart on a rename.\n */\nexport type AccountPageName =\n | \"profile\"\n | \"security\"\n | \"sessions\"\n | \"keys\"\n | \"connections\";\n\n/**\n * Boot-time configuration for `AccountRouter`, following the\n * `adminRouterOptionsAtom` pattern: the application calls\n * `alepha.set(accountRouterOptionsAtom, { … })` once, before start.\n *\n * `z.custom` passthrough because the value carries React nodes, whose shape\n * TypeScript already owns. Being boot-configured also keeps it out of the SSR\n * payload — `StateManager.exportAtoms()` reads request scope only, and a\n * `ReactNode` would not survive JSON serialization.\n */\nexport const accountRouterOptionsAtom = $atom({\n name: \"alepha.ui.account.router.options\",\n description: \"Chrome slots and per-page props for the account router.\",\n schema: z.custom<AccountRouterOptions>(),\n default: {} satisfies AccountRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;AAgKA,MAAa,2BAA2B,MAAM;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,OAA6B;CACvC,SAAS,CAAC;AACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSecurity.d.ts","sourceRoot":"","sources":["../../src/account/AccountSecurity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAajD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAE1B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,UAAW,oBAAoB,gCAyRnD,CAAC;eAEa,eAAe"}
1
+ {"version":3,"file":"AccountSecurity.d.ts","sourceRoot":"","sources":["../../src/account/AccountSecurity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIV,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAejD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAE1B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,UAAW,oBAAoB,gCAyVnD,CAAC;eAEa,eAAe"}