@alepha/ui 0.28.0 → 0.29.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 (378) hide show
  1. package/README.md +31 -2
  2. package/dist/components/account/account-connections.d.ts.map +1 -1
  3. package/dist/components/account/account-connections.js +4 -1
  4. package/dist/components/account/account-connections.js.map +1 -1
  5. package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
  6. package/dist/components/account/account-delete-dialog.js +12 -15
  7. package/dist/components/account/account-delete-dialog.js.map +1 -1
  8. package/dist/components/account/account-keys.d.ts.map +1 -1
  9. package/dist/components/account/account-keys.js +22 -28
  10. package/dist/components/account/account-keys.js.map +1 -1
  11. package/dist/components/account/account-mfa-dialog.js +1 -4
  12. package/dist/components/account/account-mfa-dialog.js.map +1 -1
  13. package/dist/components/account/account-password-dialog.d.ts.map +1 -1
  14. package/dist/components/account/account-password-dialog.js +11 -14
  15. package/dist/components/account/account-password-dialog.js.map +1 -1
  16. package/dist/components/account/account-profile.js +3 -2
  17. package/dist/components/account/account-profile.js.map +1 -1
  18. package/dist/components/account/account-router-options.d.ts +38 -0
  19. package/dist/components/account/account-router-options.d.ts.map +1 -1
  20. package/dist/components/account/account-router-options.js.map +1 -1
  21. package/dist/components/account/account-router-page.d.ts +11 -1
  22. package/dist/components/account/account-router-page.d.ts.map +1 -1
  23. package/dist/components/account/account-router-page.js +11 -1
  24. package/dist/components/account/account-router-page.js.map +1 -1
  25. package/dist/components/account/account-router.d.ts +11 -0
  26. package/dist/components/account/account-router.d.ts.map +1 -1
  27. package/dist/components/account/account-router.js +16 -5
  28. package/dist/components/account/account-router.js.map +1 -1
  29. package/dist/components/admin/admin-audits.d.ts.map +1 -1
  30. package/dist/components/admin/admin-audits.js +91 -34
  31. package/dist/components/admin/admin-audits.js.map +1 -1
  32. package/dist/components/admin/admin-files.d.ts.map +1 -1
  33. package/dist/components/admin/admin-files.js +6 -17
  34. package/dist/components/admin/admin-files.js.map +1 -1
  35. package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
  36. package/dist/components/admin/admin-jobs-executions-panel.js +39 -8
  37. package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
  38. package/dist/components/admin/admin-jobs-payload-dialog.d.ts +19 -0
  39. package/dist/components/admin/admin-jobs-payload-dialog.d.ts.map +1 -0
  40. package/dist/components/admin/admin-jobs-payload-dialog.js +33 -0
  41. package/dist/components/admin/admin-jobs-payload-dialog.js.map +1 -0
  42. package/dist/components/admin/admin-keys.d.ts.map +1 -1
  43. package/dist/components/admin/admin-keys.js +5 -4
  44. package/dist/components/admin/admin-keys.js.map +1 -1
  45. package/dist/components/admin/admin-notifications-channel-label.d.ts +14 -0
  46. package/dist/components/admin/admin-notifications-channel-label.d.ts.map +1 -0
  47. package/dist/components/admin/admin-notifications-channel-label.js +26 -0
  48. package/dist/components/admin/admin-notifications-channel-label.js.map +1 -0
  49. package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -1
  50. package/dist/components/admin/admin-notifications-preview-body.js +23 -13
  51. package/dist/components/admin/admin-notifications-preview-body.js.map +1 -1
  52. package/dist/components/admin/admin-notifications.d.ts.map +1 -1
  53. package/dist/components/admin/admin-notifications.js +11 -12
  54. package/dist/components/admin/admin-notifications.js.map +1 -1
  55. package/dist/components/admin/admin-payments.d.ts.map +1 -1
  56. package/dist/components/admin/admin-payments.js +9 -7
  57. package/dist/components/admin/admin-payments.js.map +1 -1
  58. package/dist/components/admin/admin-router-options.d.ts +12 -0
  59. package/dist/components/admin/admin-router-options.d.ts.map +1 -1
  60. package/dist/components/admin/admin-router-options.js.map +1 -1
  61. package/dist/components/admin/admin-router.d.ts +5 -8
  62. package/dist/components/admin/admin-router.d.ts.map +1 -1
  63. package/dist/components/admin/admin-router.js +6 -29
  64. package/dist/components/admin/admin-router.js.map +1 -1
  65. package/dist/components/admin/admin-sessions.d.ts.map +1 -1
  66. package/dist/components/admin/admin-sessions.js +9 -7
  67. package/dist/components/admin/admin-sessions.js.map +1 -1
  68. package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
  69. package/dist/components/admin/admin-user-detail-audits-tab.js +5 -4
  70. package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
  71. package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
  72. package/dist/components/admin/admin-user-detail-sessions-tab.js +7 -5
  73. package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
  74. package/dist/components/admin/admin-user-detail.js +3 -2
  75. package/dist/components/admin/admin-user-detail.js.map +1 -1
  76. package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
  77. package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
  78. package/dist/components/admin/admin-users.d.ts.map +1 -1
  79. package/dist/components/admin/admin-users.js +6 -4
  80. package/dist/components/admin/admin-users.js.map +1 -1
  81. package/dist/components/admin/analytics/AnalyticsChartBars.js +2 -1
  82. package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -1
  83. package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
  84. package/dist/components/admin/parameter-history-item.js +3 -2
  85. package/dist/components/admin/parameter-history-item.js.map +1 -1
  86. package/dist/components/alepha-table/alepha-table-bulk-menu.js +2 -1
  87. package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -1
  88. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts +60 -0
  89. package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts.map +1 -0
  90. package/dist/components/alepha-table/alepha-table-filter-dialog.js +88 -0
  91. package/dist/components/alepha-table/alepha-table-filter-dialog.js.map +1 -0
  92. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts +35 -0
  93. package/dist/components/alepha-table/alepha-table-filter-menu.d.ts.map +1 -0
  94. package/dist/components/alepha-table/alepha-table-filter-menu.js +54 -0
  95. package/dist/components/alepha-table/alepha-table-filter-menu.js.map +1 -0
  96. package/dist/components/alepha-table/alepha-table.d.ts +188 -3
  97. package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
  98. package/dist/components/alepha-table/alepha-table.js +551 -162
  99. package/dist/components/alepha-table/alepha-table.js.map +1 -1
  100. package/dist/components/alepha-table/query-filters.d.ts +73 -0
  101. package/dist/components/alepha-table/query-filters.d.ts.map +1 -0
  102. package/dist/components/alepha-table/query-filters.js +118 -0
  103. package/dist/components/alepha-table/query-filters.js.map +1 -0
  104. package/dist/components/app-actions/app-actions.d.ts +21 -0
  105. package/dist/components/app-actions/app-actions.d.ts.map +1 -1
  106. package/dist/components/app-actions/app-actions.js +11 -5
  107. package/dist/components/app-actions/app-actions.js.map +1 -1
  108. package/dist/components/app-shell/app-shell.d.ts +45 -0
  109. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  110. package/dist/components/app-shell/app-shell.js +119 -16
  111. package/dist/components/app-shell/app-shell.js.map +1 -1
  112. package/dist/components/auth/auth-register.js +31 -30
  113. package/dist/components/auth/auth-register.js.map +1 -1
  114. package/dist/components/auto-form/auto-form.d.ts.map +1 -1
  115. package/dist/components/auto-form/auto-form.js +68 -30
  116. package/dist/components/auto-form/auto-form.js.map +1 -1
  117. package/dist/components/button-dark/button-dark.d.ts.map +1 -1
  118. package/dist/components/button-dark/button-dark.js +39 -8
  119. package/dist/components/button-dark/button-dark.js.map +1 -1
  120. package/dist/components/button-inbox/button-inbox.d.ts +66 -0
  121. package/dist/components/button-inbox/button-inbox.d.ts.map +1 -0
  122. package/dist/components/button-inbox/button-inbox.js +167 -0
  123. package/dist/components/button-inbox/button-inbox.js.map +1 -0
  124. package/dist/components/button-inbox/inbox-unread-atom.d.ts +22 -0
  125. package/dist/components/button-inbox/inbox-unread-atom.d.ts.map +1 -0
  126. package/dist/components/button-inbox/inbox-unread-atom.js +29 -0
  127. package/dist/components/button-inbox/inbox-unread-atom.js.map +1 -0
  128. package/dist/components/button-theme/button-theme.d.ts +4 -3
  129. package/dist/components/button-theme/button-theme.d.ts.map +1 -1
  130. package/dist/components/button-theme/button-theme.js +8 -25
  131. package/dist/components/button-theme/button-theme.js.map +1 -1
  132. package/dist/components/button-user/button-user.d.ts +19 -0
  133. package/dist/components/button-user/button-user.d.ts.map +1 -1
  134. package/dist/components/button-user/button-user.js +1 -1
  135. package/dist/components/button-user/button-user.js.map +1 -1
  136. package/dist/components/control/control.d.ts +51 -0
  137. package/dist/components/control/control.d.ts.map +1 -1
  138. package/dist/components/control/control.js +49 -5
  139. package/dist/components/control/control.js.map +1 -1
  140. package/dist/components/control-array/control-array.js +2 -1
  141. package/dist/components/control-array/control-array.js.map +1 -1
  142. package/dist/components/control-date/control-date.d.ts +27 -0
  143. package/dist/components/control-date/control-date.d.ts.map +1 -1
  144. package/dist/components/control-date/control-date.js +15 -19
  145. package/dist/components/control-date/control-date.js.map +1 -1
  146. package/dist/components/control-date/date-only.d.ts +18 -0
  147. package/dist/components/control-date/date-only.d.ts.map +1 -0
  148. package/dist/components/control-date/date-only.js +29 -0
  149. package/dist/components/control-date/date-only.js.map +1 -0
  150. package/dist/components/control-date-range/control-date-range.d.ts +56 -0
  151. package/dist/components/control-date-range/control-date-range.d.ts.map +1 -0
  152. package/dist/components/control-date-range/control-date-range.js +148 -0
  153. package/dist/components/control-date-range/control-date-range.js.map +1 -0
  154. package/dist/components/control-object/control-object.js +2 -1
  155. package/dist/components/control-object/control-object.js.map +1 -1
  156. package/dist/components/control-select/control-select.d.ts.map +1 -1
  157. package/dist/components/control-select/control-select.js +177 -37
  158. package/dist/components/control-select/control-select.js.map +1 -1
  159. package/dist/components/control-upload/control-upload.d.ts.map +1 -1
  160. package/dist/components/control-upload/control-upload.js +1 -11
  161. package/dist/components/control-upload/control-upload.js.map +1 -1
  162. package/dist/components/detail/detail-aside.d.ts.map +1 -1
  163. package/dist/components/detail/detail-aside.js +4 -3
  164. package/dist/components/detail/detail-aside.js.map +1 -1
  165. package/dist/components/file-image/file-image.js +2 -1
  166. package/dist/components/file-image/file-image.js.map +1 -1
  167. package/dist/components/markdown-view/SpoilerSpan.d.ts +28 -0
  168. package/dist/components/markdown-view/SpoilerSpan.d.ts.map +1 -0
  169. package/dist/components/markdown-view/SpoilerSpan.js +53 -0
  170. package/dist/components/markdown-view/SpoilerSpan.js.map +1 -0
  171. package/dist/components/markdown-view/diagram/layoutSequence.js +13 -23
  172. package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -1
  173. package/dist/components/markdown-view/diagram/textMetrics.js +2 -2
  174. package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -1
  175. package/dist/components/markdown-view/markdown-view.css +44 -0
  176. package/dist/components/markdown-view/markdown-view.d.ts +12 -0
  177. package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
  178. package/dist/components/markdown-view/markdown-view.js +22 -1
  179. package/dist/components/markdown-view/markdown-view.js.map +1 -1
  180. package/dist/components/markdown-view/remarkSpoiler.d.ts +17 -0
  181. package/dist/components/markdown-view/remarkSpoiler.d.ts.map +1 -0
  182. package/dist/components/markdown-view/remarkSpoiler.js +117 -0
  183. package/dist/components/markdown-view/remarkSpoiler.js.map +1 -0
  184. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts +34 -0
  185. package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts.map +1 -0
  186. package/dist/components/permission-matrix/permission-matrix-group-rows.js +109 -0
  187. package/dist/components/permission-matrix/permission-matrix-group-rows.js.map +1 -0
  188. package/dist/components/permission-matrix/permission-matrix.d.ts +145 -0
  189. package/dist/components/permission-matrix/permission-matrix.d.ts.map +1 -0
  190. package/dist/components/permission-matrix/permission-matrix.js +113 -0
  191. package/dist/components/permission-matrix/permission-matrix.js.map +1 -0
  192. package/dist/components/plate-layout/plate-layout.d.ts +5 -0
  193. package/dist/components/plate-layout/plate-layout.d.ts.map +1 -1
  194. package/dist/components/plate-layout/plate-layout.js +2 -1
  195. package/dist/components/plate-layout/plate-layout.js.map +1 -1
  196. package/dist/components/plate-layout/plate-tab-bar.d.ts +10 -0
  197. package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -1
  198. package/dist/components/plate-layout/plate-tab-bar.js +1 -1
  199. package/dist/components/plate-layout/plate-tab-bar.js.map +1 -1
  200. package/dist/components/settings/settings-nav.js +2 -1
  201. package/dist/components/settings/settings-nav.js.map +1 -1
  202. package/dist/components/time-ago/time-ago.d.ts +57 -0
  203. package/dist/components/time-ago/time-ago.d.ts.map +1 -0
  204. package/dist/components/time-ago/time-ago.js +60 -0
  205. package/dist/components/time-ago/time-ago.js.map +1 -0
  206. package/dist/components/tree-view/tree-model.d.ts +128 -0
  207. package/dist/components/tree-view/tree-model.d.ts.map +1 -0
  208. package/dist/components/tree-view/tree-model.js +226 -0
  209. package/dist/components/tree-view/tree-model.js.map +1 -0
  210. package/dist/components/tree-view/tree-view-rename-input.d.ts +31 -0
  211. package/dist/components/tree-view/tree-view-rename-input.d.ts.map +1 -0
  212. package/dist/components/tree-view/tree-view-rename-input.js +68 -0
  213. package/dist/components/tree-view/tree-view-rename-input.js.map +1 -0
  214. package/dist/components/tree-view/tree-view-resizer.d.ts +38 -0
  215. package/dist/components/tree-view/tree-view-resizer.d.ts.map +1 -0
  216. package/dist/components/tree-view/tree-view-resizer.js +73 -0
  217. package/dist/components/tree-view/tree-view-resizer.js.map +1 -0
  218. package/dist/components/tree-view/tree-view-row.d.ts +177 -0
  219. package/dist/components/tree-view/tree-view-row.d.ts.map +1 -0
  220. package/dist/components/tree-view/tree-view-row.js +241 -0
  221. package/dist/components/tree-view/tree-view-row.js.map +1 -0
  222. package/dist/components/tree-view/tree-view.d.ts +186 -0
  223. package/dist/components/tree-view/tree-view.d.ts.map +1 -0
  224. package/dist/components/tree-view/tree-view.js +112 -0
  225. package/dist/components/tree-view/tree-view.js.map +1 -0
  226. package/dist/components/tree-view/use-tree-state.d.ts +79 -0
  227. package/dist/components/tree-view/use-tree-state.d.ts.map +1 -0
  228. package/dist/components/tree-view/use-tree-state.js +93 -0
  229. package/dist/components/tree-view/use-tree-state.js.map +1 -0
  230. package/dist/components/ui/button.d.ts.map +1 -1
  231. package/dist/components/ui/button.js +1 -1
  232. package/dist/components/ui/button.js.map +1 -1
  233. package/dist/components/ui/dropdown-menu.js.map +1 -1
  234. package/dist/components/ui/select.d.ts +7 -0
  235. package/dist/components/ui/select.d.ts.map +1 -1
  236. package/dist/components/ui/select.js +7 -0
  237. package/dist/components/ui/select.js.map +1 -1
  238. package/dist/components/ui/sidebar.js +1 -1
  239. package/dist/components/ui/sidebar.js.map +1 -1
  240. package/dist/components/ui/table.js.map +1 -1
  241. package/dist/components/ui/tooltip.js.map +1 -1
  242. package/dist/lib/i18n-fr.d.ts.map +1 -1
  243. package/dist/lib/i18n-fr.js +31 -47
  244. package/dist/lib/i18n-fr.js.map +1 -1
  245. package/dist/lib/utils.d.ts +22 -2
  246. package/dist/lib/utils.d.ts.map +1 -1
  247. package/dist/lib/utils.js +29 -5
  248. package/dist/lib/utils.js.map +1 -1
  249. package/dist/styles.css +255 -0
  250. package/package.json +13 -14
  251. package/src/components/account/__tests__/account-router.spec.ts +95 -0
  252. package/src/components/account/account-connections.tsx +14 -1
  253. package/src/components/account/account-delete-dialog.tsx +3 -2
  254. package/src/components/account/account-keys.tsx +11 -4
  255. package/src/components/account/account-mfa-dialog.tsx +1 -1
  256. package/src/components/account/account-password-dialog.tsx +3 -2
  257. package/src/components/account/account-profile.tsx +1 -1
  258. package/src/components/account/account-router-options.tsx +45 -0
  259. package/src/components/account/account-router-page.tsx +11 -1
  260. package/src/components/account/account-router.tsx +23 -6
  261. package/src/components/admin/__tests__/admin-jobs-payload-dialog.browser.spec.tsx +68 -0
  262. package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +20 -4
  263. package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +0 -31
  264. package/src/components/admin/admin-audits.tsx +99 -5
  265. package/src/components/admin/admin-files.tsx +7 -16
  266. package/src/components/admin/admin-jobs-executions-panel.tsx +152 -114
  267. package/src/components/admin/admin-jobs-payload-dialog.tsx +57 -0
  268. package/src/components/admin/admin-keys.tsx +7 -4
  269. package/src/components/admin/admin-notifications-channel-label.ts +18 -0
  270. package/src/components/admin/admin-notifications-preview-body.tsx +7 -2
  271. package/src/components/admin/admin-notifications.tsx +19 -8
  272. package/src/components/admin/admin-payments.tsx +7 -4
  273. package/src/components/admin/admin-router-options.tsx +12 -0
  274. package/src/components/admin/admin-router.tsx +5 -27
  275. package/src/components/admin/admin-sessions.tsx +10 -6
  276. package/src/components/admin/admin-user-detail-audits-tab.tsx +7 -4
  277. package/src/components/admin/admin-user-detail-sessions-tab.tsx +7 -4
  278. package/src/components/admin/admin-users-roles-picker.tsx +4 -0
  279. package/src/components/admin/admin-users.tsx +6 -3
  280. package/src/components/admin/parameter-history-item.tsx +4 -2
  281. package/src/components/alepha-table/__tests__/alepha-table-default-hidden.browser.spec.tsx +108 -0
  282. package/src/components/alepha-table/__tests__/alepha-table-empty-state.browser.spec.tsx +233 -0
  283. package/src/components/alepha-table/__tests__/alepha-table-persist-facets.browser.spec.tsx +177 -0
  284. package/src/components/alepha-table/__tests__/alepha-table-persisted-filters.browser.spec.tsx +182 -0
  285. package/src/components/alepha-table/__tests__/alepha-table-query-seed.browser.spec.tsx +170 -0
  286. package/src/components/alepha-table/__tests__/alepha-table-row-action-checked.browser.spec.tsx +210 -0
  287. package/src/components/alepha-table/__tests__/alepha-table-row-action-group.browser.spec.tsx +202 -0
  288. package/src/components/alepha-table/__tests__/alepha-table-scope.browser.spec.tsx +161 -0
  289. package/src/components/alepha-table/__tests__/alepha-table-share-filters.browser.spec.tsx +309 -0
  290. package/src/components/alepha-table/__tests__/query-filters.spec.ts +212 -0
  291. package/src/components/alepha-table/alepha-table-filter-dialog.tsx +162 -0
  292. package/src/components/alepha-table/alepha-table-filter-menu.tsx +77 -0
  293. package/src/components/alepha-table/alepha-table.tsx +1113 -207
  294. package/src/components/alepha-table/query-filters.ts +159 -0
  295. package/src/components/app-actions/app-actions.tsx +32 -3
  296. package/src/components/app-shell/__tests__/sidebar-nav-accordion.browser.spec.tsx +163 -0
  297. package/src/components/app-shell/app-shell.tsx +255 -12
  298. package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -1
  299. package/src/components/auto-form/auto-form.tsx +98 -30
  300. package/src/components/button-dark/button-dark.tsx +47 -8
  301. package/src/components/button-inbox/__tests__/button-inbox.browser.spec.tsx +247 -0
  302. package/src/components/button-inbox/button-inbox.tsx +303 -0
  303. package/src/components/button-inbox/inbox-unread-atom.ts +27 -0
  304. package/src/components/button-theme/button-theme.tsx +16 -29
  305. package/src/components/button-user/__tests__/button-user-avatar.browser.spec.tsx +88 -0
  306. package/src/components/button-user/button-user.tsx +24 -1
  307. package/src/components/control/__tests__/control-date-range.browser.spec.tsx +177 -0
  308. package/src/components/control/control.tsx +119 -12
  309. package/src/components/control-date/control-date.tsx +117 -22
  310. package/src/components/control-date/date-only.ts +26 -0
  311. package/src/components/control-date-range/control-date-range.tsx +250 -0
  312. package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +129 -15
  313. package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +27 -6
  314. package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +204 -1
  315. package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +77 -1
  316. package/src/components/control-select/control-select.tsx +317 -83
  317. package/src/components/control-upload/control-upload.tsx +1 -10
  318. package/src/components/detail/detail-aside.tsx +30 -6
  319. package/src/components/markdown-view/SpoilerSpan.tsx +66 -0
  320. package/src/components/markdown-view/__tests__/markdown-view-spoiler.browser.spec.tsx +165 -0
  321. package/src/components/markdown-view/diagram/textMetrics.spec.ts +1 -1
  322. package/src/components/markdown-view/diagram/textMetrics.ts +2 -2
  323. package/src/components/markdown-view/markdown-view.css +44 -0
  324. package/src/components/markdown-view/markdown-view.tsx +37 -1
  325. package/src/components/markdown-view/remarkSpoiler.ts +150 -0
  326. package/src/components/permission-matrix/__tests__/permission-matrix.browser.spec.tsx +237 -0
  327. package/src/components/permission-matrix/permission-matrix-group-rows.tsx +240 -0
  328. package/src/components/permission-matrix/permission-matrix.tsx +286 -0
  329. package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +22 -0
  330. package/src/components/plate-layout/plate-layout.tsx +6 -0
  331. package/src/components/plate-layout/plate-tab-bar.tsx +27 -1
  332. package/src/components/time-ago/time-ago.browser.spec.tsx +110 -0
  333. package/src/components/time-ago/time-ago.tsx +80 -0
  334. package/src/components/tree-view/__tests__/tree-model.spec.ts +441 -0
  335. package/src/components/tree-view/__tests__/tree-view-drag.browser.spec.tsx +295 -0
  336. package/src/components/tree-view/__tests__/tree-view-rename.browser.spec.tsx +278 -0
  337. package/src/components/tree-view/__tests__/tree-view-resizer.browser.spec.tsx +112 -0
  338. package/src/components/tree-view/__tests__/tree-view.browser.spec.tsx +260 -0
  339. package/src/components/tree-view/__tests__/use-tree-state.browser.spec.tsx +238 -0
  340. package/src/components/tree-view/tree-model.ts +369 -0
  341. package/src/components/tree-view/tree-view-rename-input.tsx +95 -0
  342. package/src/components/tree-view/tree-view-resizer.tsx +83 -0
  343. package/src/components/tree-view/tree-view-row.tsx +414 -0
  344. package/src/components/tree-view/tree-view.tsx +300 -0
  345. package/src/components/tree-view/use-tree-state.ts +184 -0
  346. package/src/components/ui/button.tsx +79 -1
  347. package/src/components/ui/dropdown-menu.tsx +1 -1
  348. package/src/components/ui/select.tsx +7 -0
  349. package/src/components/ui/table.tsx +1 -1
  350. package/src/components/ui/tooltip.tsx +1 -1
  351. package/src/lib/i18n-fr.ts +34 -51
  352. package/src/lib/utils.ts +32 -4
  353. package/src/styles.css +255 -0
  354. package/dist/components/admin/admin-workflows-execution-sheet.d.ts +0 -11
  355. package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +0 -1
  356. package/dist/components/admin/admin-workflows-execution-sheet.js +0 -190
  357. package/dist/components/admin/admin-workflows-execution-sheet.js.map +0 -1
  358. package/dist/components/admin/admin-workflows-executions-panel.d.ts +0 -9
  359. package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +0 -1
  360. package/dist/components/admin/admin-workflows-executions-panel.js +0 -121
  361. package/dist/components/admin/admin-workflows-executions-panel.js.map +0 -1
  362. package/dist/components/admin/admin-workflows-status-badge.d.ts +0 -12
  363. package/dist/components/admin/admin-workflows-status-badge.d.ts.map +0 -1
  364. package/dist/components/admin/admin-workflows-status-badge.js +0 -30
  365. package/dist/components/admin/admin-workflows-status-badge.js.map +0 -1
  366. package/dist/components/admin/admin-workflows-status-labels.d.ts +0 -19
  367. package/dist/components/admin/admin-workflows-status-labels.d.ts.map +0 -1
  368. package/dist/components/admin/admin-workflows-status-labels.js +0 -48
  369. package/dist/components/admin/admin-workflows-status-labels.js.map +0 -1
  370. package/dist/components/admin/admin-workflows.d.ts +0 -4
  371. package/dist/components/admin/admin-workflows.d.ts.map +0 -1
  372. package/dist/components/admin/admin-workflows.js +0 -145
  373. package/dist/components/admin/admin-workflows.js.map +0 -1
  374. package/src/components/admin/admin-workflows-execution-sheet.tsx +0 -285
  375. package/src/components/admin/admin-workflows-executions-panel.tsx +0 -169
  376. package/src/components/admin/admin-workflows-status-badge.tsx +0 -41
  377. package/src/components/admin/admin-workflows-status-labels.ts +0 -51
  378. package/src/components/admin/admin-workflows.tsx +0 -209
@@ -1 +1 @@
1
- {"version":3,"file":"account-profile.js","names":[],"sources":["../../../src/components/account/account-profile.tsx"],"sourcesContent":["import { AutoForm } from \"@alepha/ui/components/auto-form/auto-form\";\nimport { FileImage } from \"@alepha/ui/components/file-image/file-image\";\nimport { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type {\n MyAvatarController,\n MyProfile,\n MyProfileController,\n RealmConfig,\n} from \"alepha/api/users\";\nimport { updateMyProfileBodySchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AtSign, Camera, Trash2, User } from \"lucide-react\";\nimport { type ChangeEvent, useRef, useState } from \"react\";\n\nexport interface AccountProfileProps {\n /**\n * Supplied by the route loader. Optional so the page can also be rendered\n * standalone in a story or a test.\n */\n profile?: MyProfile;\n\n /**\n * Supplied by the route loader, and read for one thing: whether this realm\n * collects usernames at all.\n *\n * Optional for the same reason `profile` is. Absent, the username field\n * renders — the historical behaviour, and the right guess for a realm nobody\n * described.\n */\n realmConfig?: RealmConfig;\n}\n\n/**\n * Who you are: avatar, name, and the read-only facts about the account.\n *\n * Email is shown but not editable — changing it is a verification flow, not a\n * profile edit, and `updateMyProfile` deliberately refuses it. Rather than\n * render a disabled input with no explanation, the row says so.\n */\nconst AccountProfile = (props: AccountProfileProps) => {\n const api = useClient<MyProfileController>();\n const avatarApi = useClient<MyAvatarController>();\n const toaster = useToast();\n const { l, tr } = useI18n();\n const fileInput = useRef<HTMLInputElement>(null);\n\n const [profile, setProfile] = useState<MyProfile | undefined>(props.profile);\n const [uploading, setUploading] = useState(false);\n\n /*\n * Does this realm have usernames at all?\n *\n * The avatar section above reads its switch through `can()`, because a realm\n * with `features.avatars` off registers no avatar action and the capability\n * is simply absent from `/api/_links`. That cannot work here:\n * `updateMyProfile` is the same call that saves first and last name, so it\n * exists in every realm and its presence says nothing about usernames.\n *\n * The realm's own `settings.username` is the switch, and `\"none\"` is the\n * only value that hides the row: it is the one that means this realm has no\n * such thing as a username, so there is nothing to show and nothing the user\n * could set.\n *\n * Without this, a `\"none\"` realm did not merely render a pointless field:\n * `?? \"\"` seeded an empty string into a column that is `.optional()` but\n * `minLength: 3`, `FormModel` decodes its initial values on construction,\n * and the whole page died at `useForm` with \"Too small: expected string to\n * have >=3 characters at /username\" — before anything rendered. `apps/examples/shop`\n * is such a realm, and `\"none\"` is also the framework default, so this is\n * what any new app hits first.\n *\n * ⚠️ `auth-register.tsx` excludes `\"email\"` here as well, and this\n * deliberately does not. In that mode `RegistrationService` derives the\n * handle from the address and drops whatever the client sent, so the\n * registration form is right to hide a field the user does not choose — but\n * the account page is where an existing, already-derived username is shown,\n * and `apps/lore` runs exactly this mode. Whether editing it there should be\n * possible at all is a real question (a rename desyncs it from the email\n * that produced it, and `updateMyProfile` does not re-run the slugger), but\n * it is a separate one from \"this realm has no usernames\", and answering it\n * by quietly deleting the field is not the place to start.\n */\n const hasUsername = props.realmConfig?.settings?.username !== \"none\";\n\n /**\n * Validated against the server's own body schema, so \"3 to 30 characters\"\n * is enforced before the request rather than only by the 400 that comes\n * back — and is stated in exactly one place.\n *\n * The schema stays whole and `username` is dropped from the *values*: the\n * column is `.optional()`, so an absent key decodes cleanly, while the empty\n * string does not. Omitting it from `groups` below is what hides the row —\n * `AutoForm` renders the fields its groups name and nothing else — and an\n * absent value is what keeps it out of the request.\n *\n * ⚠️ **`username` is never seeded as `\"\"`, even when the field is shown.**\n * The old `?? \"\"` was not only a `\"none\"`-realm problem: `\"optional\"` is a\n * realm that collects usernames and does not insist, so an account without\n * one is the normal case there — and it crashed the page for exactly those\n * users while working for everyone who had set one. `undefined` is what an\n * empty optional field means, and it is what the two name fields would use\n * too if they were not `.nullable()` with a real \"clear me\" state.\n */\n const form = useForm({\n initialValues: {\n ...(hasUsername ? { username: props.profile?.username } : {}),\n firstName: props.profile?.firstName ?? \"\",\n lastName: props.profile?.lastName ?? \"\",\n },\n schema: updateMyProfileBodySchema,\n handler: async (values) => {\n try {\n setProfile(\n await api.updateMyProfile({\n body: {\n // Empty is \"unset\", which the API spells `null` — NOT\n // `undefined`, which means \"leave this column alone\" and made\n // clearing a name a silent no-op that still toasted success.\n firstName: values.firstName || null,\n lastName: values.lastName || null,\n // Absent, not `null`, in a realm without usernames: `null` is the\n // \"clear this column\" signal the two name fields use, and\n // `username` has no such state — absent is \"leave it alone\".\n username: values.username,\n },\n }),\n );\n toaster.show(\n tr(\"account.profile.updated\", { default: \"Profile updated\" }),\n \"success\",\n );\n } catch (error: any) {\n // The username-taken 409 arrives here with its own message, which is\n // the only one worth showing. Toasted *and* rethrown: the toast is\n // what the user reads, and the throw is what keeps the form dirty and\n // errored so Save stays actionable for the retry.\n toaster.show(\n error?.message ??\n tr(\"account.profile.updateError\", {\n default: \"Could not update your profile\",\n }),\n \"danger\",\n );\n throw error;\n }\n },\n });\n\n if (!profile) {\n return null;\n }\n\n const onPickAvatar = async (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (!file) {\n return;\n }\n setUploading(true);\n try {\n setProfile(await avatarApi.updateMyAvatar({ body: { file } }));\n toaster.show(\n tr(\"account.profile.avatarUpdated\", { default: \"Avatar updated\" }),\n \"success\",\n );\n } catch (error: any) {\n toaster.show(\n error?.message ??\n tr(\"account.profile.avatarUploadError\", {\n default: \"Could not upload that image\",\n }),\n \"danger\",\n );\n } finally {\n setUploading(false);\n // Reset so picking the same file again still fires a change event.\n if (fileInput.current) {\n fileInput.current.value = \"\";\n }\n }\n };\n\n const removeAvatar = async () => {\n setUploading(true);\n try {\n setProfile(await avatarApi.deleteMyAvatar());\n } catch (error: any) {\n toaster.show(\n error?.message ??\n tr(\"account.profile.avatarRemoveError\", {\n default: \"Could not remove your avatar\",\n }),\n \"danger\",\n );\n } finally {\n setUploading(false);\n }\n };\n\n // Realms opt into avatars (`features.avatars`, off by default), and an\n // unregistered action is absent from `/api/_links` — so this is the realm's\n // own switch read through the mechanism that cannot drift from it. Checking\n // a flag mirrored into the client instead would let the picker render\n // against endpoints that answer 404.\n const canEditAvatar = avatarApi.updateMyAvatar.can();\n\n return (\n <>\n {canEditAvatar && (\n <>\n <SettingsSection\n title={tr(\"account.profile.pictureTitle\", {\n default: \"Profile picture\",\n })}\n description={tr(\"account.profile.pictureDescription\", {\n default: \"Shown next to your name wherever you appear.\",\n })}\n >\n <SettingsRow\n label={tr(\"account.profile.avatar\", { default: \"Avatar\" })}\n description={tr(\"account.profile.avatarDescription\", {\n default: \"PNG, JPEG, GIF or WebP, up to 5 MB.\",\n })}\n >\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => fileInput.current?.click()}\n disabled={uploading}\n aria-label={tr(\"account.profile.avatarChange\", {\n default: \"Change avatar\",\n })}\n className=\"relative size-14 shrink-0 cursor-pointer\"\n >\n {/* Only the image is clipped to a circle; the camera badge sits\n outside the wrapper so the round mask cannot crop it. */}\n <div className=\"bg-muted size-full overflow-hidden rounded-full border\">\n <FileImage\n id={profile.picture}\n public\n alt=\"\"\n className=\"size-full object-cover\"\n fallback={\n <div className=\"flex size-full items-center justify-center\">\n <User className=\"size-6\" />\n </div>\n }\n />\n </div>\n <div className=\"bg-card absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border\">\n <Camera className=\"size-3\" />\n </div>\n </button>\n {profile.picture ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={removeAvatar}\n disabled={uploading}\n >\n <Trash2 className=\"size-4\" />\n {tr(\"account.profile.avatarRemove\", { default: \"Remove\" })}\n </Button>\n ) : null}\n </div>\n </SettingsRow>\n </SettingsSection>\n\n <input\n type=\"file\"\n ref={fileInput}\n onChange={onPickAvatar}\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n className=\"hidden\"\n />\n </>\n )}\n\n {/* The one section here whose rows are all form fields, so it is an\n `AutoForm` in row layout rather than hand-wired `SettingsRow`s — same\n card, same rows, same heading, plus schema validation, the error\n popover, Reset, and a Save that knows whether anything changed. The\n sections above and below stay hand-wired because their rows are an\n avatar picker and read-only values, not fields. */}\n <AutoForm\n form={form}\n layout=\"row\"\n disabledIfPristine\n groups={[\n {\n title: tr(\"account.profile.nameTitle\", { default: \"Name\" }),\n description: tr(\"account.profile.nameDescription\", {\n default: \"How you are identified to other people.\",\n }),\n fields: hasUsername\n ? [\"username\", \"firstName\", \"lastName\"]\n : [\"firstName\", \"lastName\"],\n },\n ]}\n fields={{\n // Labels are explicit rather than derived: `prettyName` would title\n // -case them into \"First Name\", and this page's wording is settled.\n //\n // Icons are explicit because `Control`'s own fallback would resolve\n // the schema hint, and for a plain string that is the generic \"T\"\n // glyph — the same mark three times, saying \"this is text\" next to a\n // label that already said so. A field earns an icon by having one\n // that means something: `@` is what a handle looks like everywhere.\n username: {\n label: tr(\"account.profile.username\", { default: \"Username\" }),\n description: tr(\"account.profile.usernameDescription\", {\n default: \"Unique across this site.\",\n }),\n autoComplete: \"username\",\n icon: AtSign,\n // No clear button: `updateMyProfile` has no \"unset\" for a\n // username, so the × would offer a deletion the server cannot\n // perform. First and last name keep theirs — those genuinely\n // clear, via `null`.\n clearable: false,\n },\n firstName: {\n label: tr(\"account.profile.firstName\", { default: \"First name\" }),\n autoComplete: \"given-name\",\n icon: User,\n },\n lastName: {\n label: tr(\"account.profile.lastName\", { default: \"Last name\" }),\n autoComplete: \"family-name\",\n icon: User,\n },\n }}\n />\n\n <SettingsSection\n title={tr(\"account.profile.accountTitle\", { default: \"Account\" })}\n description={tr(\"account.profile.accountDescription\", {\n default: \"Details you cannot change from this page.\",\n })}\n >\n <SettingsRow\n label={tr(\"account.profile.email\", { default: \"Email\" })}\n description={tr(\"account.profile.emailDescription\", {\n default:\n \"Changing your email needs verification, so it is not a profile edit.\",\n })}\n >\n <span className=\"text-muted-foreground text-sm\">\n {profile.email ??\n tr(\"account.profile.emailUnset\", { default: \"Not set\" })}\n </span>\n </SettingsRow>\n <SettingsRow label={tr(\"account.profile.roles\", { default: \"Roles\" })}>\n <div className=\"flex flex-wrap gap-1\">\n {profile.roles.length > 0 ? (\n profile.roles.map((role) => (\n <Badge key={role} variant=\"outline\" className=\"text-xs\">\n {role}\n </Badge>\n ))\n ) : (\n <span className=\"text-muted-foreground text-sm\">—</span>\n )}\n </div>\n </SettingsRow>\n <SettingsRow\n label={tr(\"account.profile.memberSince\", { default: \"Member since\" })}\n >\n <span className=\"text-muted-foreground text-sm\">\n {String(l(profile.createdAt, { date: \"LL\" }))}\n </span>\n </Sett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KAED,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,QAAQ,SACP,GAAG,8BAA8B,EAAE,SAAS,UAAU,CAAC;KACrD,CAAA;IACK,CAAA;IACb,oBAAC,aAAD;KAAa,OAAO,GAAG,yBAAyB,EAAE,SAAS,QAAQ,CAAC;KAClE,UAAA,oBAAC,OAAD;MAAK,WAAU;MACZ,UAAA,QAAQ,MAAM,SAAS,IACtB,QAAQ,MAAM,KAAK,SACjB,oBAAC,OAAD;OAAkB,SAAQ;OAAU,WAAU;OAC3C,UAAA;MACI,GAFK,IAEL,CACR,IAED,oBAAC,QAAD;OAAM,WAAU;OAAgC,UAAA;MAAO,CAAA;KAEtD,CAAA;IACM,CAAA;IACb,oBAAC,aAAD;KACE,OAAO,GAAG,+BAA+B,EAAE,SAAS,eAAe,CAAC;KAEpE,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,OAAO,EAAE,QAAQ,WAAW,EAAE,MAAM,KAAK,CAAC,CAAC;KACxC,CAAA;IACK,CAAA;GACE;;CACjB,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"account-profile.js","names":[],"sources":["../../../src/components/account/account-profile.tsx"],"sourcesContent":["import { AutoForm } from \"@alepha/ui/components/auto-form/auto-form\";\nimport { FileImage } from \"@alepha/ui/components/file-image/file-image\";\nimport { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type {\n MyAvatarController,\n MyProfile,\n MyProfileController,\n RealmConfig,\n} from \"alepha/api/users\";\nimport { updateMyProfileBodySchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AtSign, Camera, Trash2, User } from \"lucide-react\";\nimport { type ChangeEvent, useRef, useState } from \"react\";\n\nexport interface AccountProfileProps {\n /**\n * Supplied by the route loader. Optional so the page can also be rendered\n * standalone in a story or a test.\n */\n profile?: MyProfile;\n\n /**\n * Supplied by the route loader, and read for one thing: whether this realm\n * collects usernames at all.\n *\n * Optional for the same reason `profile` is. Absent, the username field\n * renders — the historical behaviour, and the right guess for a realm nobody\n * described.\n */\n realmConfig?: RealmConfig;\n}\n\n/**\n * Who you are: avatar, name, and the read-only facts about the account.\n *\n * Email is shown but not editable — changing it is a verification flow, not a\n * profile edit, and `updateMyProfile` deliberately refuses it. Rather than\n * render a disabled input with no explanation, the row says so.\n */\nconst AccountProfile = (props: AccountProfileProps) => {\n const api = useClient<MyProfileController>();\n const avatarApi = useClient<MyAvatarController>();\n const toaster = useToast();\n const { l, tr } = useI18n();\n const fileInput = useRef<HTMLInputElement>(null);\n\n const [profile, setProfile] = useState<MyProfile | undefined>(props.profile);\n const [uploading, setUploading] = useState(false);\n\n /*\n * Does this realm have usernames at all?\n *\n * The avatar section above reads its switch through `can()`, because a realm\n * with `features.avatars` off registers no avatar action and the capability\n * is simply absent from `/api/_links`. That cannot work here:\n * `updateMyProfile` is the same call that saves first and last name, so it\n * exists in every realm and its presence says nothing about usernames.\n *\n * The realm's own `settings.username` is the switch, and `\"none\"` is the\n * only value that hides the row: it is the one that means this realm has no\n * such thing as a username, so there is nothing to show and nothing the user\n * could set.\n *\n * Without this, a `\"none\"` realm did not merely render a pointless field:\n * `?? \"\"` seeded an empty string into a column that is `.optional()` but\n * `minLength: 3`, `FormModel` decodes its initial values on construction,\n * and the whole page died at `useForm` with \"Too small: expected string to\n * have >=3 characters at /username\" — before anything rendered. `apps/examples/shop`\n * is such a realm, and `\"none\"` is also the framework default, so this is\n * what any new app hits first.\n *\n * ⚠️ `auth-register.tsx` excludes `\"email\"` here as well, and this\n * deliberately does not. In that mode `RegistrationService` derives the\n * handle from the address and drops whatever the client sent, so the\n * registration form is right to hide a field the user does not choose — but\n * the account page is where an existing, already-derived username is shown,\n * and `apps/lore` runs exactly this mode. Whether editing it there should be\n * possible at all is a real question (a rename desyncs it from the email\n * that produced it, and `updateMyProfile` does not re-run the slugger), but\n * it is a separate one from \"this realm has no usernames\", and answering it\n * by quietly deleting the field is not the place to start.\n */\n const hasUsername = props.realmConfig?.settings?.username !== \"none\";\n\n /**\n * Validated against the server's own body schema, so \"3 to 30 characters\"\n * is enforced before the request rather than only by the 400 that comes\n * back — and is stated in exactly one place.\n *\n * The schema stays whole and `username` is dropped from the *values*: the\n * column is `.optional()`, so an absent key decodes cleanly, while the empty\n * string does not. Omitting it from `groups` below is what hides the row —\n * `AutoForm` renders the fields its groups name and nothing else — and an\n * absent value is what keeps it out of the request.\n *\n * ⚠️ **`username` is never seeded as `\"\"`, even when the field is shown.**\n * The old `?? \"\"` was not only a `\"none\"`-realm problem: `\"optional\"` is a\n * realm that collects usernames and does not insist, so an account without\n * one is the normal case there — and it crashed the page for exactly those\n * users while working for everyone who had set one. `undefined` is what an\n * empty optional field means, and it is what the two name fields would use\n * too if they were not `.nullable()` with a real \"clear me\" state.\n */\n const form = useForm({\n initialValues: {\n ...(hasUsername ? { username: props.profile?.username } : {}),\n firstName: props.profile?.firstName ?? \"\",\n lastName: props.profile?.lastName ?? \"\",\n },\n schema: updateMyProfileBodySchema,\n handler: async (values) => {\n try {\n setProfile(\n await api.updateMyProfile({\n body: {\n // Empty is \"unset\", which the API spells `null` — NOT\n // `undefined`, which means \"leave this column alone\" and made\n // clearing a name a silent no-op that still toasted success.\n firstName: values.firstName || null,\n lastName: values.lastName || null,\n // Absent, not `null`, in a realm without usernames: `null` is the\n // \"clear this column\" signal the two name fields use, and\n // `username` has no such state — absent is \"leave it alone\".\n username: values.username,\n },\n }),\n );\n toaster.show(\n tr(\"account.profile.updated\", { default: \"Profile updated\" }),\n \"success\",\n );\n } catch (error: any) {\n // The username-taken 409 arrives here with its own message, which is\n // the only one worth showing. Toasted *and* rethrown: the toast is\n // what the user reads, and the throw is what keeps the form dirty and\n // errored so Save stays actionable for the retry.\n toaster.show(\n error?.message ??\n tr(\"account.profile.updateError\", {\n default: \"Could not update your profile\",\n }),\n \"danger\",\n );\n throw error;\n }\n },\n });\n\n if (!profile) {\n return null;\n }\n\n const onPickAvatar = async (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (!file) {\n return;\n }\n setUploading(true);\n try {\n setProfile(await avatarApi.updateMyAvatar({ body: { file } }));\n toaster.show(\n tr(\"account.profile.avatarUpdated\", { default: \"Avatar updated\" }),\n \"success\",\n );\n } catch (error: any) {\n toaster.show(\n error?.message ??\n tr(\"account.profile.avatarUploadError\", {\n default: \"Could not upload that image\",\n }),\n \"danger\",\n );\n } finally {\n setUploading(false);\n // Reset so picking the same file again still fires a change event.\n if (fileInput.current) {\n fileInput.current.value = \"\";\n }\n }\n };\n\n const removeAvatar = async () => {\n setUploading(true);\n try {\n setProfile(await avatarApi.deleteMyAvatar());\n } catch (error: any) {\n toaster.show(\n error?.message ??\n tr(\"account.profile.avatarRemoveError\", {\n default: \"Could not remove your avatar\",\n }),\n \"danger\",\n );\n } finally {\n setUploading(false);\n }\n };\n\n // Realms opt into avatars (`features.avatars`, off by default), and an\n // unregistered action is absent from `/api/_links` — so this is the realm's\n // own switch read through the mechanism that cannot drift from it. Checking\n // a flag mirrored into the client instead would let the picker render\n // against endpoints that answer 404.\n const canEditAvatar = avatarApi.updateMyAvatar.can();\n\n return (\n <>\n {canEditAvatar && (\n <>\n <SettingsSection\n title={tr(\"account.profile.pictureTitle\", {\n default: \"Profile picture\",\n })}\n description={tr(\"account.profile.pictureDescription\", {\n default: \"Shown next to your name wherever you appear.\",\n })}\n >\n <SettingsRow\n label={tr(\"account.profile.avatar\", { default: \"Avatar\" })}\n description={tr(\"account.profile.avatarDescription\", {\n default: \"PNG, JPEG, GIF or WebP, up to 5 MB.\",\n })}\n >\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => fileInput.current?.click()}\n disabled={uploading}\n aria-label={tr(\"account.profile.avatarChange\", {\n default: \"Change avatar\",\n })}\n className=\"relative size-14 shrink-0\"\n >\n {/* Only the image is clipped to a circle; the camera badge sits\n outside the wrapper so the round mask cannot crop it. */}\n <div className=\"bg-muted size-full overflow-hidden rounded-full border\">\n <FileImage\n id={profile.picture}\n public\n alt=\"\"\n className=\"size-full object-cover\"\n fallback={\n <div className=\"flex size-full items-center justify-center\">\n <User className=\"size-6\" />\n </div>\n }\n />\n </div>\n <div className=\"bg-card absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border\">\n <Camera className=\"size-3\" />\n </div>\n </button>\n {profile.picture ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={removeAvatar}\n disabled={uploading}\n >\n <Trash2 className=\"size-4\" />\n {tr(\"account.profile.avatarRemove\", { default: \"Remove\" })}\n </Button>\n ) : null}\n </div>\n </SettingsRow>\n </SettingsSection>\n\n <input\n type=\"file\"\n ref={fileInput}\n onChange={onPickAvatar}\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n className=\"hidden\"\n />\n </>\n )}\n\n {/* The one section here whose rows are all form fields, so it is an\n `AutoForm` in row layout rather than hand-wired `SettingsRow`s — same\n card, same rows, same heading, plus schema validation, the error\n popover, Reset, and a Save that knows whether anything changed. The\n sections above and below stay hand-wired because their rows are an\n avatar picker and read-only values, not fields. */}\n <AutoForm\n form={form}\n layout=\"row\"\n disabledIfPristine\n groups={[\n {\n title: tr(\"account.profile.nameTitle\", { default: \"Name\" }),\n description: tr(\"account.profile.nameDescription\", {\n default: \"How you are identified to other people.\",\n }),\n fields: hasUsername\n ? [\"username\", \"firstName\", \"lastName\"]\n : [\"firstName\", \"lastName\"],\n },\n ]}\n fields={{\n // Labels are explicit rather than derived: `prettyName` would title\n // -case them into \"First Name\", and this page's wording is settled.\n //\n // Icons are explicit because `Control`'s own fallback would resolve\n // the schema hint, and for a plain string that is the generic \"T\"\n // glyph — the same mark three times, saying \"this is text\" next to a\n // label that already said so. A field earns an icon by having one\n // that means something: `@` is what a handle looks like everywhere.\n username: {\n label: tr(\"account.profile.username\", { default: \"Username\" }),\n description: tr(\"account.profile.usernameDescription\", {\n default: \"Unique across this site.\",\n }),\n autoComplete: \"username\",\n icon: AtSign,\n // No clear button: `updateMyProfile` has no \"unset\" for a\n // username, so the × would offer a deletion the server cannot\n // perform. First and last name keep theirs — those genuinely\n // clear, via `null`.\n clearable: false,\n },\n firstName: {\n label: tr(\"account.profile.firstName\", { default: \"First name\" }),\n autoComplete: \"given-name\",\n icon: User,\n },\n lastName: {\n label: tr(\"account.profile.lastName\", { default: \"Last name\" }),\n autoComplete: \"family-name\",\n icon: User,\n },\n }}\n />\n\n <SettingsSection\n title={tr(\"account.profile.accountTitle\", { default: \"Account\" })}\n description={tr(\"account.profile.accountDescription\", {\n default: \"Details you cannot change from this page.\",\n })}\n >\n <SettingsRow\n label={tr(\"account.profile.email\", { default: \"Email\" })}\n description={tr(\"account.profile.emailDescription\", {\n default:\n \"Changing your email needs verification, so it is not a profile edit.\",\n })}\n >\n <span className=\"text-muted-foreground text-sm\">\n {profile.email ??\n tr(\"account.profile.emailUnset\", { default: \"Not set\" })}\n </span>\n </SettingsRow>\n <SettingsRow label={tr(\"account.profile.roles\", { default: \"Roles\" })}>\n <div className=\"flex flex-wrap gap-1\">\n {profile.roles.length > 0 ? (\n profile.roles.map((role) => (\n <Badge key={role} variant=\"outline\" className=\"text-xs\">\n {role}\n </Badge>\n ))\n ) : (\n <span className=\"text-muted-foreground text-sm\">—</span>\n )}\n </div>\n </SettingsRow>\n <SettingsRow\n label={tr(\"account.profile.memberSince\", { default: \"Member since\" })}\n >\n <span className=\"text-muted-foreground text-sm\">\n {String(l(profile.createdAt, { date: \"LL\" }))}\n </span>\n </SettingsRow>\n </SettingsSection>\n </>\n );\n};\n\nexport default AccountProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,kBAAkB,UAA+B;CACrD,MAAM,MAAM,U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K,CAAA;IACb,oBAAC,aAAD;KAAa,OAAO,GAAG,yBAAyB,EAAE,SAAS,QAAQ,CAAC;KAClE,UAAA,oBAAC,OAAD;MAAK,WAAU;MACZ,UAAA,QAAQ,MAAM,SAAS,IACtB,QAAQ,MAAM,KAAK,SACjB,oBAAC,OAAD;OAAkB,SAAQ;OAAU,WAAU;OAC3C,UAAA;MACI,GAFK,IAEL,CACR,IAED,oBAAC,QAAD;OAAM,WAAU;OAAgC,UAAA;MAAO,CAAA;KAEtD,CAAA;IACM,CAAA;IACb,oBAAC,aAAD;KACE,OAAO,GAAG,+BAA+B,EAAE,SAAS,eAAe,CAAC;KAEpE,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,OAAO,EAAE,QAAQ,WAAW,EAAE,MAAM,KAAK,CAAC,CAAC;KACxC,CAAA;IACK,CAAA;GACE;;CACjB,EAAA,CAAA;AAEN"}
@@ -62,7 +62,45 @@ export interface AccountRouterOptions {
62
62
  keys?: AccountKeysProps;
63
63
  connections?: AccountConnectionsProps;
64
64
  };
65
+ /**
66
+ * Pages this application does not offer at all.
67
+ *
68
+ * Each page is already gated on whether the action behind it is mounted,
69
+ * and that answers most of the question: the API-keys page really does
70
+ * disappear for an application that never mounts `AlephaApiKeys`.
71
+ *
72
+ * ⚠️ **It cannot answer a page whose action is always mounted.**
73
+ * `MyConnectionController` ships with `$realm` and is `$secure()` with no
74
+ * permission, so `listMyConnections` exists in every application ever
75
+ * built on this router - and "Connected apps" was therefore offered to
76
+ * citizens of a public service that has no OAuth client in the world, over
77
+ * a list that is empty by construction. Whether the API exists is the
78
+ * registry's question; whether the application offers it is the
79
+ * application's, and only the application can answer the second.
80
+ *
81
+ * ANDed with the existing gate, never instead of it. A hidden page is
82
+ * absent from the rail and refused on direct entry, exactly as one whose
83
+ * action is missing already is.
84
+ *
85
+ * ⚠️ A list of exceptions rather than an allowlist, and that is the
86
+ * difference from the `pages: [...]` this router's own doc block rules
87
+ * out: an allowlist has to be kept complete, so a page added here would
88
+ * vanish from every application that had already written one down. Unset
89
+ * changes nothing, and a new page is offered by default.
90
+ *
91
+ * ```ts
92
+ * alepha.set(accountRouterOptionsAtom, { hide: ["connections"] });
93
+ * ```
94
+ */
95
+ hide?: AccountPage[];
65
96
  }
97
+ /**
98
+ * The pages `AccountRouter` mounts, by the field that declares each one.
99
+ *
100
+ * Named rather than inlined so {@link AccountRouterOptions.hide} and the
101
+ * router's own helper cannot drift apart on a rename.
102
+ */
103
+ export type AccountPage = "profile" | "security" | "sessions" | "keys" | "connections";
66
104
  /**
67
105
  * Boot-time configuration for `AccountRouter`, following the
68
106
  * `adminRouterOptionsAtom` pattern: the application calls
@@ -1 +1 @@
1
- {"version":3,"file":"account-router-options.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;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;CACH;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,gIAKnC,CAAC"}
1
+ {"version":3,"file":"account-router-options.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;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 +1 @@
1
- {"version":3,"file":"account-router-options.js","names":[],"sources":["../../../src/components/account/account-router-options.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AccountConnectionsProps } from \"./account-connections.tsx\";\nimport type { AccountKeysProps } from \"./account-keys.tsx\";\nimport type { AccountProfileProps } from \"./account-profile.tsx\";\nimport type { AccountSecurityProps } from \"./account-security.tsx\";\nimport type { AccountSessionsProps } from \"./account-sessions.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/**\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":";;;;;;;;;;;;AAmFA,MAAa,2BAA2B,MAAM;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,OAA6B;CACvC,SAAS,CAAC;AACZ,CAAC"}
1
+ {"version":3,"file":"account-router-options.js","names":[],"sources":["../../../src/components/account/account-router-options.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AccountConnectionsProps } from \"./account-connections.tsx\";\nimport type { AccountKeysProps } from \"./account-keys.tsx\";\nimport type { AccountProfileProps } from \"./account-profile.tsx\";\nimport type { AccountSecurityProps } from \"./account-security.tsx\";\nimport type { AccountSessionsProps } from \"./account-sessions.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"}
@@ -38,7 +38,17 @@ import { type PageNavOptions } from "../nav-shell/nav-page.tsx";
38
38
  * invitations = $pageAccount({
39
39
  * path: "/invitations",
40
40
  * name: "accountInvitations",
41
- * nav: { label: "Invitations", icon: <Mail />, group: "Lore", order: 100 },
41
+ * nav: {
42
+ * label: "Invitations",
43
+ * // ⚠️ `createElement(Mail)`, never `<Mail />`. This module graph is
44
+ * // imported by `alepha db migrations create` under `tsx` with the
45
+ * // classic JSX transform, where the element form emits a bare
46
+ * // `React.createElement` and breaks migration generation for the
47
+ * // whole app - far from the icon that caused it.
48
+ * icon: createElement(Mail),
49
+ * group: "Lore",
50
+ * order: 100,
51
+ * },
42
52
  * can: () => this.invitationApi.listMyInvitations.can(),
43
53
  * lazy: () => import("./MyInvitations.tsx"),
44
54
  * });
@@ -1 +1 @@
1
- {"version":3,"file":"account-router-page.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-page.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,MAAM,SAAS,MAAM,GAAG,aAAa,EACrC,YAAY,SAAS,MAAM,GAAG,mBAAmB,WAExC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,KACrE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAO7C,CAAC"}
1
+ {"version":3,"file":"account-router-page.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-page.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,MAAM,SAAS,MAAM,GAAG,aAAa,EACrC,YAAY,SAAS,MAAM,GAAG,mBAAmB,WAExC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,KACrE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAO7C,CAAC"}
@@ -40,7 +40,17 @@ import { $context } from "alepha";
40
40
  * invitations = $pageAccount({
41
41
  * path: "/invitations",
42
42
  * name: "accountInvitations",
43
- * nav: { label: "Invitations", icon: <Mail />, group: "Lore", order: 100 },
43
+ * nav: {
44
+ * label: "Invitations",
45
+ * // ⚠️ `createElement(Mail)`, never `<Mail />`. This module graph is
46
+ * // imported by `alepha db migrations create` under `tsx` with the
47
+ * // classic JSX transform, where the element form emits a bare
48
+ * // `React.createElement` and breaks migration generation for the
49
+ * // whole app - far from the icon that caused it.
50
+ * icon: createElement(Mail),
51
+ * group: "Lore",
52
+ * order: 100,
53
+ * },
44
54
  * can: () => this.invitationApi.listMyInvitations.can(),
45
55
  * lazy: () => import("./MyInvitations.tsx"),
46
56
  * });
@@ -1 +1 @@
1
- {"version":3,"file":"account-router-page.js","names":[],"sources":["../../../src/components/account/account-router-page.tsx"],"sourcesContent":["import { $context } from \"alepha\";\nimport type {\n PageConfigSchema,\n PagePrimitive,\n TPropsDefault,\n TPropsParentDefault,\n} from \"alepha/react/router\";\n\nimport { $pageNav, type PageNavOptions } from \"../nav-shell/nav-page.tsx\";\nimport { AccountRouter } from \"./account-router.tsx\";\n\n/**\n * `$pageNav` already parented to {@link AccountRouter}'s `/account` shell —\n * the one-call form of \"a page inside the shared account area\".\n *\n * It carries the `$` prefix to sit with the framework's other declarations at\n * a call site, but it is a plain function wrapping `$pageNav`, which wraps\n * `$page`. Nothing about its lifecycle differs from declaring `$page`\n * yourself.\n *\n * The page appears in the rail with no separate registration: the layout\n * reads `useNavEntries({ root: \"account\" })`, which walks the parent chain\n * and reads each page's own `nav`.\n *\n * **Calling this registers `AccountRouter`.** Declaring even one page this\n * way mounts the whole `/account` shell including its five built-in pages —\n * an account page without the account area around it is not a thing. That is\n * the intended reading, but it is a real side effect: an application wanting\n * `/account` to carry only its own pages must build its own layout instead.\n *\n * **Take `order: 100` or above, or declare your own `nav.group`.** The\n * built-ins occupy `Account` (order 1) and `Security` (orders 2-5), and\n * `useNavEntries` sorts groups by their smallest member — a page at a lower\n * order silently reshuffles the shared rail.\n *\n * **Gate with `can: () => this.someApi.someAction.can()`, not `permission`\n * alone.** A permission named by this page's own `$secure` is self-declaring:\n * `$secure` registers it into `SecurityProvider` at definition time, so it\n * exists whether or not any controller backing the page does. An action name\n * resolves against `/api/_links`, which is built only from actions the server\n * actually registered.\n *\n * ```tsx\n * class LoreAccountRouter {\n * protected readonly invitationApi = $client<InvitationController>();\n *\n * invitations = $pageAccount({\n * path: \"/invitations\",\n * name: \"accountInvitations\",\n * nav: { label: \"Invitations\", icon: <Mail />, group: \"Lore\", order: 100 },\n * can: () => this.invitationApi.listMyInvitations.can(),\n * lazy: () => import(\"./MyInvitations.tsx\"),\n * });\n * }\n * ```\n */\nexport const $pageAccount = <\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n>(\n options: Omit<PageNavOptions<TConfig, TProps, TPropsParent>, \"parent\">,\n): PagePrimitive<TConfig, TProps, TPropsParent> => {\n const { alepha } = $context();\n const account = alepha.inject(AccountRouter);\n return $pageNav<TConfig, TProps, TPropsParent>({\n ...options,\n parent: account.layout,\n } as PageNavOptions<TConfig, TProps, TPropsParent>);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,gBAKX,YACiD;CACjD,MAAM,EAAE,WAAW,SAAS;CAC5B,MAAM,UAAU,OAAO,OAAO,aAAa;CAC3C,OAAO,SAAwC;EAC7C,GAAG;EACH,QAAQ,QAAQ;CAClB,CAAkD;AACpD"}
1
+ {"version":3,"file":"account-router-page.js","names":[],"sources":["../../../src/components/account/account-router-page.tsx"],"sourcesContent":["import { $context } from \"alepha\";\nimport type {\n PageConfigSchema,\n PagePrimitive,\n TPropsDefault,\n TPropsParentDefault,\n} from \"alepha/react/router\";\n\nimport { $pageNav, type PageNavOptions } from \"../nav-shell/nav-page.tsx\";\nimport { AccountRouter } from \"./account-router.tsx\";\n\n/**\n * `$pageNav` already parented to {@link AccountRouter}'s `/account` shell —\n * the one-call form of \"a page inside the shared account area\".\n *\n * It carries the `$` prefix to sit with the framework's other declarations at\n * a call site, but it is a plain function wrapping `$pageNav`, which wraps\n * `$page`. Nothing about its lifecycle differs from declaring `$page`\n * yourself.\n *\n * The page appears in the rail with no separate registration: the layout\n * reads `useNavEntries({ root: \"account\" })`, which walks the parent chain\n * and reads each page's own `nav`.\n *\n * **Calling this registers `AccountRouter`.** Declaring even one page this\n * way mounts the whole `/account` shell including its five built-in pages —\n * an account page without the account area around it is not a thing. That is\n * the intended reading, but it is a real side effect: an application wanting\n * `/account` to carry only its own pages must build its own layout instead.\n *\n * **Take `order: 100` or above, or declare your own `nav.group`.** The\n * built-ins occupy `Account` (order 1) and `Security` (orders 2-5), and\n * `useNavEntries` sorts groups by their smallest member — a page at a lower\n * order silently reshuffles the shared rail.\n *\n * **Gate with `can: () => this.someApi.someAction.can()`, not `permission`\n * alone.** A permission named by this page's own `$secure` is self-declaring:\n * `$secure` registers it into `SecurityProvider` at definition time, so it\n * exists whether or not any controller backing the page does. An action name\n * resolves against `/api/_links`, which is built only from actions the server\n * actually registered.\n *\n * ```tsx\n * class LoreAccountRouter {\n * protected readonly invitationApi = $client<InvitationController>();\n *\n * invitations = $pageAccount({\n * path: \"/invitations\",\n * name: \"accountInvitations\",\n * nav: {\n * label: \"Invitations\",\n * // ⚠️ `createElement(Mail)`, never `<Mail />`. This module graph is\n * // imported by `alepha db migrations create` under `tsx` with the\n * // classic JSX transform, where the element form emits a bare\n * // `React.createElement` and breaks migration generation for the\n * // whole app - far from the icon that caused it.\n * icon: createElement(Mail),\n * group: \"Lore\",\n * order: 100,\n * },\n * can: () => this.invitationApi.listMyInvitations.can(),\n * lazy: () => import(\"./MyInvitations.tsx\"),\n * });\n * }\n * ```\n */\nexport const $pageAccount = <\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n>(\n options: Omit<PageNavOptions<TConfig, TProps, TPropsParent>, \"parent\">,\n): PagePrimitive<TConfig, TProps, TPropsParent> => {\n const { alepha } = $context();\n const account = alepha.inject(AccountRouter);\n return $pageNav<TConfig, TProps, TPropsParent>({\n ...options,\n parent: account.layout,\n } as PageNavOptions<TConfig, TProps, TPropsParent>);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,gBAKX,YACiD;CACjD,MAAM,EAAE,WAAW,SAAS;CAC5B,MAAM,UAAU,OAAO,OAAO,aAAa;CAC3C,OAAO,SAAwC;EAC7C,GAAG;EACH,QAAQ,QAAQ;CAClB,CAAkD;AACpD"}
@@ -1,5 +1,6 @@
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 "./account-router-options.tsx";
3
4
  /**
4
5
  * The whole `/account` surface — five pages and their shell — mounted and
5
6
  * wired. The user-facing counterpart of `AdminRouter`.
@@ -101,6 +102,15 @@ import type { MyConnectionController, MyIdentityController, MyProfileController,
101
102
  */
102
103
  export declare class AccountRouter {
103
104
  protected readonly options: Readonly<import("./account-router-options.tsx").AccountRouterOptions>;
105
+ /**
106
+ * Whether the application has declared it does not offer this page.
107
+ *
108
+ * ANDed into each page's `can`, never replacing it: whether the action
109
+ * exists stays the registry's question. See
110
+ * `AccountRouterOptions.hide` for the page this exists for and why `can`
111
+ * alone cannot answer it.
112
+ */
113
+ protected hidden(page: AccountPage): boolean;
104
114
  protected readonly profileApi: import("alepha/server/links").HttpVirtualClient<MyProfileController>;
105
115
  protected readonly realmApi: import("alepha/server/links").HttpVirtualClient<RealmController>;
106
116
  protected readonly identityApi: import("alepha/server/links").HttpVirtualClient<MyIdentityController>;
@@ -276,6 +286,7 @@ export declare class AccountRouter {
276
286
  createdAt: string;
277
287
  lastUsedAt?: string | undefined;
278
288
  expiresAt: string;
289
+ sessionCount: number;
279
290
  ip?: string | undefined;
280
291
  userAgent?: {
281
292
  os: string;
@@ -1 +1 @@
1
- {"version":3,"file":"account-router.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAQ1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AACH,qBAAa,aAAa;IACxB,SAAS,CAAC,QAAQ,CAAC,OAAO,wEAAoC;IAE9D,SAAS,CAAC,QAAQ,CAAC,UAAU,uEAAkC;IAC/D,SAAS,CAAC,QAAQ,CAAC,QAAQ,mEAA8B;IACzD,SAAS,CAAC,QAAQ,CAAC,WAAW,wEAAmC;IACjE,SAAS,CAAC,QAAQ,CAAC,UAAU,uEAAkC;IAC/D,SAAS,CAAC,QAAQ,CAAC,SAAS,oEAA+B;IAC3D,SAAS,CAAC,QAAQ,CAAC,aAAa,0EAAqC;IAErE;;;;;;;;;;;OAWG;IACH,MAAM,sJAMH;IAEH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCJ;IAEH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA8BL;IAEH,QAAQ;;;;;;;;;;;;;;;YAkBL;IAEH,IAAI;;;;;;;;;;;;;YAkBD;IAEH,WAAW;;;;;;;;;;;;;;;;YAoBR;CACJ"}
1
+ {"version":3,"file":"account-router.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AACH,qBAAa,aAAa;IACxB,SAAS,CAAC,QAAQ,CAAC,OAAO,wEAAoC;IAE9D;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAE3C;IAED,SAAS,CAAC,QAAQ,CAAC,UAAU,uEAAkC;IAC/D,SAAS,CAAC,QAAQ,CAAC,QAAQ,mEAA8B;IACzD,SAAS,CAAC,QAAQ,CAAC,WAAW,wEAAmC;IACjE,SAAS,CAAC,QAAQ,CAAC,UAAU,uEAAkC;IAC/D,SAAS,CAAC,QAAQ,CAAC,SAAS,oEAA+B;IAC3D,SAAS,CAAC,QAAQ,CAAC,aAAa,0EAAqC;IAErE;;;;;;;;;;;OAWG;IACH,MAAM,sJAMH;IAEH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCJ;IAEH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BL;IAEH,QAAQ;;;;;;;;;;;;;;;YAkBL;IAEH,IAAI;;;;;;;;;;;;;YAkBD;IAEH,WAAW;;;;;;;;;;;;;;;;;YAqBR;CACJ"}
@@ -107,6 +107,17 @@ import { $client } from "alepha/server/links";
107
107
  */
108
108
  var AccountRouter = class {
109
109
  options = $store(accountRouterOptionsAtom);
110
+ /**
111
+ * Whether the application has declared it does not offer this page.
112
+ *
113
+ * ANDed into each page's `can`, never replacing it: whether the action
114
+ * exists stays the registry's question. See
115
+ * `AccountRouterOptions.hide` for the page this exists for and why `can`
116
+ * alone cannot answer it.
117
+ */
118
+ hidden(page) {
119
+ return this.options.hide?.includes(page) ?? false;
120
+ }
110
121
  profileApi = $client();
111
122
  realmApi = $client();
112
123
  identityApi = $client();
@@ -140,7 +151,7 @@ var AccountRouter = class {
140
151
  path: "/",
141
152
  name: "accountProfile",
142
153
  head: { title: "Profile" },
143
- can: () => this.profileApi.getMyProfile.can(),
154
+ can: () => !this.hidden("profile") && this.profileApi.getMyProfile.can(),
144
155
  nav: {
145
156
  label: "Profile",
146
157
  labelKey: "account.nav.profile",
@@ -164,7 +175,7 @@ var AccountRouter = class {
164
175
  path: "/security",
165
176
  name: "accountSecurity",
166
177
  head: { title: "Security" },
167
- can: () => this.identityApi.listMyIdentities.can(),
178
+ can: () => !this.hidden("security") && this.identityApi.listMyIdentities.can(),
168
179
  nav: {
169
180
  label: "Security",
170
181
  labelKey: "account.nav.security",
@@ -194,7 +205,7 @@ var AccountRouter = class {
194
205
  path: "/sessions",
195
206
  name: "accountSessions",
196
207
  head: { title: "Sessions" },
197
- can: () => this.sessionApi.listMySessions.can(),
208
+ can: () => !this.hidden("sessions") && this.sessionApi.listMySessions.can(),
198
209
  nav: {
199
210
  label: "Sessions",
200
211
  labelKey: "account.nav.sessions",
@@ -213,7 +224,7 @@ var AccountRouter = class {
213
224
  path: "/keys",
214
225
  name: "accountKeys",
215
226
  head: { title: "API keys" },
216
- can: () => this.apiKeyApi.listApiKeys.can(),
227
+ can: () => !this.hidden("keys") && this.apiKeyApi.listApiKeys.can(),
217
228
  nav: {
218
229
  label: "API keys",
219
230
  labelKey: "account.nav.keys",
@@ -232,7 +243,7 @@ var AccountRouter = class {
232
243
  path: "/connections",
233
244
  name: "accountConnections",
234
245
  head: { title: "Connected apps" },
235
- can: () => this.connectionApi.listMyConnections.can(),
246
+ can: () => !this.hidden("connections") && this.connectionApi.listMyConnections.can(),
236
247
  nav: {
237
248
  label: "Connected apps",
238
249
  labelKey: "account.nav.connections",
@@ -1 +1 @@
1
- {"version":3,"file":"account-router.js","names":[],"sources":["../../../src/components/account/account-router.tsx"],"sourcesContent":["import { $pageNav } from \"@alepha/ui/components/nav-shell/nav-page\";\nimport { $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 { accountRouterOptionsAtom } from \"./account-router-options.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/components/account/account-router\";\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 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(\"./account-layout.tsx\"),\n });\n\n profile = $pageNav({\n parent: this.layout,\n path: \"/\",\n name: \"accountProfile\",\n head: { title: \"Profile\" },\n can: () => 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(\"./account-profile.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: () => 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(\"./account-security.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.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(\"./account-sessions.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.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(\"./account-keys.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: () => 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(\"./account-connections.tsx\"),\n props: () => this.options.pages?.connections ?? {},\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,IAAa,gBAAb,MAA2B;CACzB,UAA6B,OAAO,wBAAwB;CAE5D,aAAgC,QAA6B;CAC7D,WAA8B,QAAyB;CACvD,cAAiC,QAA8B;CAC/D,aAAgC,QAA6B;CAC7D,YAA+B,QAA0B;CACzD,gBAAmC,QAAgC;;;;;;;;;;;;;CAcnE,SAAS,SAAS;EAChB,MAAM;EACN,MAAM;EACN,KAAK,CAAC,QAAQ,CAAC;EACf,KAAK;GAAE,OAAO;GAAW,UAAU;EAAsB;EACzD,YAAY,OAAO;CACrB,CAAC;CAED,UAAU,SAAS;EACjB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,UAAU;EACzB,WAAW,KAAK,WAAW,aAAa,IAAI;EAC5C,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,IAAI;GACxB,OAAO;GACP,UAAU;GACV,OAAO;EACT;EAYA,QAAQ,YAAY;GAClB,MAAM,CAAC,SAAS,eAAe,MAAM,QAAQ,IAAI,CAC/C,KAAK,WAAW,aAAa,GAC7B,KAAK,SAAS,eAAe,CAC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AU,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,EAAE,OAAO,iBAAiB;EAChC,WAAW,KAAK,cAAc,kBAAkB,IAAI;EACpD,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
+ {"version":3,"file":"account-router.js","names":[],"sources":["../../../src/components/account/account-router.tsx"],"sourcesContent":["import { $pageNav } from \"@alepha/ui/components/nav-shell/nav-page\";\nimport { $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 {\n type AccountPage,\n accountRouterOptionsAtom,\n} from \"./account-router-options.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/components/account/account-router\";\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(\"./account-layout.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(\"./account-profile.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(\"./account-security.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(\"./account-sessions.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(\"./account-keys.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(\"./account-connections.tsx\"),\n props: () => this.options.pages?.connections ?? {},\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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kB,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 +1 @@
1
- {"version":3,"file":"admin-audits.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-audits.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAa3B,eAAO,MAAM,WAAW,yBAoOvB,CAAC;eAEa,WAAW;AAE1B;;GAEG;AACH,eAAO,MAAM,cAAc,SAAU,eAAe,KAAG,MACxB,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QACxB,MAAM,SACJ,eAAe,EAAE,KACvB,eAOF,CAAC"}
1
+ {"version":3,"file":"admin-audits.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-audits.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAgC3B,eAAO,MAAM,WAAW,yBA6SvB,CAAC;eAEa,WAAW;AAE1B;;GAEG;AACH,eAAO,MAAM,cAAc,SAAU,eAAe,KAAG,MACxB,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QACxB,MAAM,SACJ,eAAe,EAAE,KACvB,eAOF,CAAC"}
@@ -2,12 +2,13 @@ import { useToast } from "../use-toast/use-toast.js";
2
2
  import { Control } from "../control/control.js";
3
3
  import { Badge } from "../ui/badge.js";
4
4
  import { AlephaTable } from "../alepha-table/alepha-table.js";
5
+ import TimeAgo from "../time-ago/time-ago.js";
5
6
  import { AdminPage } from "./admin-page.js";
6
7
  import { AdminUserCell } from "./admin-user-cell.js";
7
8
  import { useConfirmedAction } from "./use-confirmed-action.js";
8
9
  import { useCallback, useEffect, useState } from "react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
- import { CircleDot, SlidersHorizontal, Trash2, User, Zap } from "lucide-react";
11
+ import { CircleDot, Layers, SlidersHorizontal, Trash2, User, Zap } from "lucide-react";
11
12
  import { z } from "alepha";
12
13
  import { useI18n } from "alepha/react/i18n";
13
14
  import { useClient } from "alepha/react";
@@ -15,13 +16,25 @@ import { useRouter } from "alepha/react/router";
15
16
  //#region src/components/admin/admin-audits.tsx
16
17
  const auditFiltersSchema = z.object({
17
18
  status: z.string().optional(),
18
- action: z.string().optional()
19
+ action: z.string().optional(),
20
+ layer: z.string().optional(),
21
+ /**
22
+ * When, as a closed range of calendar days.
23
+ *
24
+ * ⚠️ Deliberately NOT a `dateRange` field on `auditQuerySchema`. That schema
25
+ * declares `from`, `to` and `after` with documented semantics (`after` is an
26
+ * exclusive cursor), and two ways to say one thing in a public query schema
27
+ * is a smell. The mapping happens at the call site below, which is also what
28
+ * proves a range control can drive an existing from/to endpoint with no API
29
+ * churn at all.
30
+ */
31
+ createdAt: z.dateRange().optional()
19
32
  });
20
33
  const AdminAudits = () => {
21
34
  const client = useClient();
22
35
  const toast = useToast();
23
36
  const router = useRouter();
24
- const { l, tr } = useI18n();
37
+ const { tr } = useI18n();
25
38
  const [actions, setActions] = useState([]);
26
39
  useEffect(() => {
27
40
  let alive = true;
@@ -42,7 +55,12 @@ const AdminAudits = () => {
42
55
  sort: params.sort,
43
56
  type: pair?.type,
44
57
  action: pair?.action,
45
- success: f?.status ? f.status === "ok" : void 0
58
+ layer: f?.layer === "app" || f?.layer === "scoped" ? f.layer : void 0,
59
+ success: f?.status ? f.status === "ok" : void 0,
60
+ ...f?.createdAt?.length === 2 ? {
61
+ from: `${f.createdAt[0]}T00:00:00.000Z`,
62
+ to: `${f.createdAt[1]}T23:59:59.999Z`
63
+ } : {}
46
64
  } });
47
65
  }, [client, actions]);
48
66
  const bulkDelete = useConfirmedAction({
@@ -93,42 +111,67 @@ const AdminAudits = () => {
93
111
  schema: auditFiltersSchema,
94
112
  render: (form) => /* @__PURE__ */ jsxs("div", {
95
113
  className: "flex items-center gap-2",
96
- children: [/* @__PURE__ */ jsx(Control, {
97
- input: form.input.status,
98
- label: "",
99
- clearable: true,
100
- icon: CircleDot,
101
- clearLabel: String(tr("admin.audits.statusAll", { default: "All status" })),
102
- triggerClassName: "w-40",
103
- items: [{
104
- value: "ok",
105
- label: tr("admin.audits.ok", { default: "OK" })
106
- }, {
107
- value: "failed",
108
- label: String(tr("admin.audits.failed", { default: "Failed" }))
109
- }]
110
- }), /* @__PURE__ */ jsx(Control, {
111
- input: form.input.action,
112
- label: "",
113
- clearable: true,
114
- icon: Zap,
115
- clearLabel: String(tr("admin.audits.actionAll", { default: "All actions" })),
116
- triggerClassName: "w-56",
117
- items: actions.map((pair) => ({
118
- value: auditActionKey(pair),
119
- label: auditActionKey(pair),
120
- tag: pair.type
121
- }))
122
- })]
114
+ children: [
115
+ /* @__PURE__ */ jsx(Control, {
116
+ input: form.input.layer,
117
+ label: "",
118
+ clearable: true,
119
+ icon: Layers,
120
+ clearLabel: String(tr("admin.audits.layerAll", { default: "All layers" })),
121
+ triggerClassName: "w-40",
122
+ items: [{
123
+ value: "app",
124
+ label: String(tr("admin.audits.layerApp", { default: "App" }))
125
+ }, {
126
+ value: "scoped",
127
+ label: String(tr("admin.audits.layerScoped", { default: "Scoped" }))
128
+ }]
129
+ }),
130
+ /* @__PURE__ */ jsx(Control, {
131
+ input: form.input.createdAt,
132
+ label: "",
133
+ clearable: true,
134
+ triggerClassName: "w-64",
135
+ placeholder: String(tr("admin.audits.dateAll", { default: "Any date" }))
136
+ }),
137
+ /* @__PURE__ */ jsx(Control, {
138
+ input: form.input.status,
139
+ label: "",
140
+ clearable: true,
141
+ icon: CircleDot,
142
+ clearLabel: String(tr("admin.audits.statusAll", { default: "All status" })),
143
+ triggerClassName: "w-40",
144
+ items: [{
145
+ value: "ok",
146
+ label: tr("admin.audits.ok", { default: "OK" })
147
+ }, {
148
+ value: "failed",
149
+ label: String(tr("admin.audits.failed", { default: "Failed" }))
150
+ }]
151
+ }),
152
+ /* @__PURE__ */ jsx(Control, {
153
+ input: form.input.action,
154
+ label: "",
155
+ clearable: true,
156
+ icon: Zap,
157
+ clearLabel: String(tr("admin.audits.actionAll", { default: "All actions" })),
158
+ triggerClassName: "w-56",
159
+ items: actions.map((pair) => ({
160
+ value: auditActionKey(pair),
161
+ label: auditActionKey(pair),
162
+ tag: pair.type
163
+ }))
164
+ })
165
+ ]
123
166
  })
124
167
  },
125
168
  columns: {
126
169
  createdAt: {
127
170
  label: tr("admin.audits.colWhen", { default: "When" }),
128
171
  sortable: true,
129
- cell: (a) => /* @__PURE__ */ jsx("span", {
130
- className: "text-muted-foreground text-xs",
131
- children: String(l(a.createdAt, { date: "fromNow" }))
172
+ cell: (a) => /* @__PURE__ */ jsx(TimeAgo, {
173
+ value: a.createdAt,
174
+ className: "text-muted-foreground text-xs"
132
175
  })
133
176
  },
134
177
  action: {
@@ -142,6 +185,20 @@ const AdminAudits = () => {
142
185
  ]
143
186
  })
144
187
  },
188
+ scope: {
189
+ label: tr("admin.audits.colScope", { default: "Scope" }),
190
+ cell: (a) => a.scopeType ? /* @__PURE__ */ jsxs("span", {
191
+ className: "font-mono text-xs",
192
+ children: [
193
+ a.scopeType,
194
+ ":",
195
+ a.scopeId ?? "?"
196
+ ]
197
+ }) : /* @__PURE__ */ jsx("span", {
198
+ className: "text-muted-foreground text-xs",
199
+ children: tr("admin.audits.layerApp", { default: "App" })
200
+ })
201
+ },
145
202
  resource: {
146
203
  label: tr("admin.audits.colResource", { default: "Resource" }),
147
204
  cell: (a) => {