@cosmicdrift/kumiko-renderer 0.413.1 → 0.415.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 (369) hide show
  1. package/dist/app/action-form-support.js +4 -0
  2. package/dist/app/content-previews.d.ts +39 -0
  3. package/dist/app/content-previews.js +28 -0
  4. package/dist/app/entity-edit-screen.js +2 -5
  5. package/dist/app/entity-list-screen.js +42 -59
  6. package/dist/app/form-schema.d.ts +1 -0
  7. package/dist/app/form-schema.js +24 -0
  8. package/dist/app/list-facets.d.ts +1 -0
  9. package/dist/app/list-facets.js +10 -1
  10. package/dist/app/list-sort-options.d.ts +4 -0
  11. package/dist/app/list-sort-options.js +11 -0
  12. package/dist/app/named-filter-facet.d.ts +16 -3
  13. package/dist/app/named-filter-facet.js +97 -5
  14. package/dist/app/projection-detail-body.d.ts +2 -4
  15. package/dist/app/projection-detail-body.js +7 -1
  16. package/dist/app/projection-detail-guidance-data.d.ts +7 -0
  17. package/dist/app/projection-detail-guidance-data.js +103 -0
  18. package/dist/app/projection-detail-guidance.d.ts +13 -0
  19. package/dist/app/projection-detail-guidance.js +197 -0
  20. package/dist/app/projection-detail-header-model.d.ts +1 -3
  21. package/dist/app/projection-detail-header-model.js +4 -8
  22. package/dist/app/projection-detail-header-region.d.ts +2 -1
  23. package/dist/app/projection-detail-header-region.js +63 -23
  24. package/dist/app/projection-detail-header.d.ts +6 -1
  25. package/dist/app/projection-detail-header.js +76 -18
  26. package/dist/app/projection-detail-navigation.d.ts +2 -0
  27. package/dist/app/projection-detail-navigation.js +13 -3
  28. package/dist/app/projection-detail-states.d.ts +3 -3
  29. package/dist/app/projection-list-body.js +4 -2
  30. package/dist/app/projection-list-render.js +3 -1
  31. package/dist/app/projection-list-shim.d.ts +4 -1
  32. package/dist/app/projection-list-shim.js +35 -8
  33. package/dist/app/reference-link.d.ts +3 -2
  34. package/dist/app/reference-link.js +19 -4
  35. package/dist/app/row-actions.js +3 -3
  36. package/dist/app/screen-access.d.ts +4 -0
  37. package/dist/app/screen-access.js +18 -0
  38. package/dist/app/screen-shared.js +3 -1
  39. package/dist/app/unique-label-keys.d.ts +1 -0
  40. package/dist/app/unique-label-keys.js +9 -0
  41. package/dist/app/use-entity-list-payload.d.ts +26 -0
  42. package/dist/app/use-entity-list-payload.js +59 -0
  43. package/dist/app/use-entity-range-facets.js +2 -3
  44. package/dist/app/use-facet-counts.d.ts +5 -0
  45. package/dist/app/use-facet-counts.js +7 -0
  46. package/dist/app/use-list-summary-row.d.ts +10 -0
  47. package/dist/app/use-list-summary-row.js +33 -0
  48. package/dist/app/use-named-filter-queue.d.ts +20 -0
  49. package/dist/app/use-named-filter-queue.js +9 -0
  50. package/dist/app/use-projection-detail-actions.d.ts +5 -4
  51. package/dist/app/use-projection-detail-actions.js +42 -1
  52. package/dist/app/use-projection-list-data.d.ts +5 -0
  53. package/dist/app/use-projection-list-data.js +35 -6
  54. package/dist/app/use-projection-list-query.d.ts +2 -0
  55. package/dist/app/use-projection-list-query.js +29 -16
  56. package/dist/app/use-related-list-tab-counts.js +5 -1
  57. package/dist/app/use-row-decoration.d.ts +13 -0
  58. package/dist/app/use-row-decoration.js +103 -0
  59. package/dist/app/use-screen-list-rows.d.ts +4 -1
  60. package/dist/app/use-screen-list-rows.js +14 -5
  61. package/dist/app/use-screen-list-table.d.ts +3 -1
  62. package/dist/app/use-screen-list-table.js +10 -1
  63. package/dist/app/write-failed-error.d.ts +1 -0
  64. package/dist/app/write-failed-error.js +10 -0
  65. package/dist/card-options.d.ts +25 -0
  66. package/dist/card-options.js +1 -0
  67. package/dist/compact-tap-classes.d.ts +1 -0
  68. package/dist/compact-tap-classes.js +3 -0
  69. package/dist/components/embedded-list-field.js +13 -12
  70. package/dist/components/list-empty-state.d.ts +13 -1
  71. package/dist/components/list-empty-state.js +20 -1
  72. package/dist/components/list-group-page-bridges.d.ts +1 -1
  73. package/dist/components/list-group-page-bridges.js +2 -2
  74. package/dist/components/related-list-section.js +4 -22
  75. package/dist/components/render-edit-action-button.d.ts +3 -1
  76. package/dist/components/render-edit-action-button.js +5 -3
  77. package/dist/components/render-edit-render-model.d.ts +2 -2
  78. package/dist/components/render-edit-types.d.ts +4 -2
  79. package/dist/components/render-edit.js +3 -1
  80. package/dist/components/render-list-hint-columns.d.ts +9 -0
  81. package/dist/components/render-list-hint-columns.js +87 -0
  82. package/dist/components/render-list-reference-columns.js +4 -2
  83. package/dist/components/render-list-row-tone.d.ts +3 -0
  84. package/dist/components/render-list-row-tone.js +10 -0
  85. package/dist/components/render-list-table-props.d.ts +9 -1
  86. package/dist/components/render-list-table-props.js +4 -1
  87. package/dist/components/render-list-toolbar-action.d.ts +1 -2
  88. package/dist/components/render-list-toolbar-model.d.ts +4 -1
  89. package/dist/components/render-list-toolbar-model.js +21 -6
  90. package/dist/components/render-list-toolbar.d.ts +3 -2
  91. package/dist/components/render-list-toolbar.js +8 -6
  92. package/dist/components/render-list-types.d.ts +6 -1
  93. package/dist/components/render-list.js +26 -7
  94. package/dist/components/use-render-edit-controlled-sync.js +3 -5
  95. package/dist/components/use-render-edit-draft-save.js +7 -9
  96. package/dist/components/use-render-edit-schema.d.ts +3 -0
  97. package/dist/components/use-render-edit-schema.js +15 -0
  98. package/dist/components/use-render-edit-state.d.ts +1 -0
  99. package/dist/components/use-render-edit-state.js +4 -1
  100. package/dist/components/use-render-edit-steps.js +2 -3
  101. package/dist/components/use-render-list-columns.d.ts +3 -1
  102. package/dist/components/use-render-list-columns.js +22 -10
  103. package/dist/context/screen-focus-context.d.ts +14 -0
  104. package/dist/context/screen-focus-context.js +28 -0
  105. package/dist/data-table-facet-types.d.ts +6 -0
  106. package/dist/data-table-view-types.d.ts +20 -1
  107. package/dist/headless/form/form-controller.js +3 -1
  108. package/dist/headless/form/zod-bridge.d.ts +7 -1
  109. package/dist/headless/form/zod-bridge.js +10 -0
  110. package/dist/headless/index.d.ts +2 -1
  111. package/dist/headless/index.js +1 -0
  112. package/dist/headless/pwa-service-worker-meta.d.ts +4 -0
  113. package/dist/headless/pwa-service-worker-meta.js +13 -0
  114. package/dist/headless/view-model/index.d.ts +1 -1
  115. package/dist/headless/view-model/list-file-display.js +3 -2
  116. package/dist/headless/view-model/list.js +16 -0
  117. package/dist/headless/view-model/types.d.ts +37 -0
  118. package/dist/hooks/list-column-layout.js +2 -1
  119. package/dist/hooks/list-server-groups.js +14 -1
  120. package/dist/hooks/list-state-schema.d.ts +1 -0
  121. package/dist/hooks/list-state-schema.js +9 -1
  122. package/dist/hooks/use-debounced-value.d.ts +1 -0
  123. package/dist/hooks/use-debounced-value.js +11 -0
  124. package/dist/hooks/use-list-aggregates.d.ts +5 -1
  125. package/dist/hooks/use-list-aggregates.js +9 -5
  126. package/dist/hooks/use-list-table.d.ts +2 -1
  127. package/dist/hooks/use-list-table.js +3 -9
  128. package/dist/hooks/use-list-url-state.d.ts +2 -0
  129. package/dist/hooks/use-list-url-state.js +12 -4
  130. package/dist/hooks/use-list-view-state.js +23 -3
  131. package/dist/hooks/use-reference-lookup.js +7 -2
  132. package/dist/hooks/use-remembered-list-params.d.ts +6 -2
  133. package/dist/hooks/use-remembered-list-params.js +18 -3
  134. package/dist/hooks/use-store.js +0 -1
  135. package/dist/i18n-defaults.js +39 -3
  136. package/dist/index.d.ts +7 -2
  137. package/dist/index.js +4 -1
  138. package/dist/live/dispatcher-live.js +2 -0
  139. package/dist/metric-types.d.ts +4 -0
  140. package/dist/primitives-record-guidance.d.ts +55 -0
  141. package/dist/primitives-record-guidance.js +1 -0
  142. package/dist/primitives.d.ts +47 -54
  143. package/dist/server-clock.d.ts +6 -0
  144. package/dist/server-clock.js +20 -0
  145. package/dist/session/session-ended.d.ts +1 -0
  146. package/dist/session/session-ended.js +2 -2
  147. package/dist/status-tone.d.ts +1 -0
  148. package/dist/status-tone.js +5 -0
  149. package/dist/web/app/browser-locale.js +1 -1
  150. package/dist/web/app/client-plugin.d.ts +6 -1
  151. package/dist/web/app/create-app.d.ts +2 -1
  152. package/dist/web/app/create-app.js +15 -5
  153. package/dist/web/app/dashboard-body.js +25 -11
  154. package/dist/web/app/dashboard-header.d.ts +2 -1
  155. package/dist/web/app/dashboard-header.js +19 -7
  156. package/dist/web/app/dashboard-list-panel.d.ts +12 -0
  157. package/dist/web/app/dashboard-list-panel.js +144 -0
  158. package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
  159. package/dist/web/app/dashboard-narrow-gate.js +6 -0
  160. package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
  161. package/dist/web/app/dashboard-narrow-order.js +6 -0
  162. package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
  163. package/dist/web/app/dashboard-navigation-link.js +21 -0
  164. package/dist/web/app/dashboard-panels.d.ts +7 -23
  165. package/dist/web/app/dashboard-panels.js +55 -123
  166. package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
  167. package/dist/web/app/dashboard-reference-list-table.js +13 -4
  168. package/dist/web/app/dashboard-shared.d.ts +23 -7
  169. package/dist/web/app/dashboard-shared.js +45 -17
  170. package/dist/web/app/dashboard-stat-group-panel.d.ts +14 -0
  171. package/dist/web/app/dashboard-stat-group-panel.js +74 -0
  172. package/dist/web/app/dashboard-text-panel.d.ts +12 -0
  173. package/dist/web/app/dashboard-text-panel.js +167 -0
  174. package/dist/web/app/dashboard-text.d.ts +2 -0
  175. package/dist/web/app/dashboard-text.js +1 -1
  176. package/dist/web/app/dashboard-visibility.js +1 -1
  177. package/dist/web/app/relative-time.js +2 -1
  178. package/dist/web/drawn-icons.d.ts +6 -0
  179. package/dist/web/drawn-icons.js +30 -0
  180. package/dist/web/editor/editor-footer.d.ts +28 -0
  181. package/dist/web/editor/editor-footer.js +23 -0
  182. package/dist/web/editor/editor-frame.d.ts +23 -0
  183. package/dist/web/editor/editor-frame.js +24 -0
  184. package/dist/web/editor/editor-header.d.ts +36 -0
  185. package/dist/web/editor/editor-header.js +30 -0
  186. package/dist/web/editor/editor-rail.d.ts +32 -0
  187. package/dist/web/editor/editor-rail.js +37 -0
  188. package/dist/web/editor/editor-workbench.d.ts +34 -0
  189. package/dist/web/editor/editor-workbench.js +19 -0
  190. package/dist/web/editor/index.d.ts +6 -0
  191. package/dist/web/editor/index.js +6 -0
  192. package/dist/web/editor/relative-when.d.ts +1 -0
  193. package/dist/web/editor/relative-when.js +18 -0
  194. package/dist/web/icons.js +6 -5
  195. package/dist/web/index.d.ts +9 -1
  196. package/dist/web/index.js +7 -1
  197. package/dist/web/layout/default-app-shell.js +6 -4
  198. package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
  199. package/dist/web/layout/focus-aware-sidebar.js +5 -7
  200. package/dist/web/layout/header-action-pinned.d.ts +8 -0
  201. package/dist/web/layout/header-action-pinned.js +25 -0
  202. package/dist/web/layout/nav-collapse-state.d.ts +7 -0
  203. package/dist/web/layout/nav-collapse-state.js +76 -0
  204. package/dist/web/layout/nav-tree.js +71 -28
  205. package/dist/web/layout/notification-bell.d.ts +7 -2
  206. package/dist/web/layout/notification-bell.js +16 -5
  207. package/dist/web/layout/page-header-slot.d.ts +2 -0
  208. package/dist/web/layout/page-header-slot.js +4 -0
  209. package/dist/web/layout/screen-focus.d.ts +8 -0
  210. package/dist/web/layout/screen-focus.js +42 -0
  211. package/dist/web/layout/shell-focus.d.ts +5 -4
  212. package/dist/web/layout/shell-focus.js +14 -7
  213. package/dist/web/layout/shell-header.d.ts +2 -1
  214. package/dist/web/layout/shell-header.js +84 -27
  215. package/dist/web/layout/shell-style.d.ts +3 -0
  216. package/dist/web/layout/shell-style.js +6 -0
  217. package/dist/web/layout/sidebar-open-state.d.ts +6 -0
  218. package/dist/web/layout/sidebar-open-state.js +28 -0
  219. package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
  220. package/dist/web/layout/uniform-bar-controls.js +4 -3
  221. package/dist/web/layout/use-in-app-inbox.js +8 -1
  222. package/dist/web/layout/workspace-shell.d.ts +11 -1
  223. package/dist/web/layout/workspace-shell.js +9 -5
  224. package/dist/web/lib/upload-file-ref.d.ts +2 -2
  225. package/dist/web/lib/upload-file-ref.js +4 -9
  226. package/dist/web/presence/use-presence.js +7 -2
  227. package/dist/web/primitives/banner.d.ts +1 -1
  228. package/dist/web/primitives/banner.js +22 -9
  229. package/dist/web/primitives/calendar-day-picker.js +24 -5
  230. package/dist/web/primitives/card.js +18 -8
  231. package/dist/web/primitives/code-input.js +6 -1
  232. package/dist/web/primitives/data-table/actions-column.d.ts +2 -1
  233. package/dist/web/primitives/data-table/actions-column.js +7 -3
  234. package/dist/web/primitives/data-table/card-body.d.ts +6 -1
  235. package/dist/web/primitives/data-table/card-body.js +53 -6
  236. package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
  237. package/dist/web/primitives/data-table/card-frame.js +9 -0
  238. package/dist/web/primitives/data-table/card-row.js +44 -7
  239. package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
  240. package/dist/web/primitives/data-table/card-sort-select.js +10 -7
  241. package/dist/web/primitives/data-table/card-view.js +12 -2
  242. package/dist/web/primitives/data-table/column-picker-section.js +9 -2
  243. package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
  244. package/dist/web/primitives/data-table/column-role.d.ts +1 -0
  245. package/dist/web/primitives/data-table/column-role.js +1 -0
  246. package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
  247. package/dist/web/primitives/data-table/data-cell-props.js +5 -0
  248. package/dist/web/primitives/data-table/density.js +1 -0
  249. package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
  250. package/dist/web/primitives/data-table/facet-cluster.js +2 -2
  251. package/dist/web/primitives/data-table/group-band.js +4 -0
  252. package/dist/web/primitives/data-table/hint-cell.d.ts +14 -0
  253. package/dist/web/primitives/data-table/hint-cell.js +68 -0
  254. package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
  255. package/dist/web/primitives/data-table/hint-column-width.js +11 -0
  256. package/dist/web/primitives/data-table/measure-value.js +2 -3
  257. package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
  258. package/dist/web/primitives/data-table/row-action-column.js +4 -0
  259. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  260. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  261. package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
  262. package/dist/web/primitives/data-table/sort-options-select.js +46 -0
  263. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  264. package/dist/web/primitives/data-table/sortable-header.js +5 -3
  265. package/dist/web/primitives/data-table/table-body.d.ts +1 -1
  266. package/dist/web/primitives/data-table/table-body.js +5 -3
  267. package/dist/web/primitives/data-table/table-chrome.js +3 -1
  268. package/dist/web/primitives/data-table/table-content.js +12 -7
  269. package/dist/web/primitives/data-table/table-data-cell.js +9 -3
  270. package/dist/web/primitives/data-table/table-header-row.js +5 -2
  271. package/dist/web/primitives/data-table/table-view.js +22 -3
  272. package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
  273. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  274. package/dist/web/primitives/data-table/toolbar.js +70 -7
  275. package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
  276. package/dist/web/primitives/data-table/totals-footer.js +41 -9
  277. package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
  278. package/dist/web/primitives/data-table/use-column-pins.js +4 -0
  279. package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
  280. package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
  281. package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
  282. package/dist/web/primitives/data-table/use-row-selection.js +22 -11
  283. package/dist/web/primitives/data-table/view-menu.js +7 -1
  284. package/dist/web/primitives/data-table-cell.d.ts +21 -2
  285. package/dist/web/primitives/data-table-cell.js +129 -26
  286. package/dist/web/primitives/embedded-file-cell.js +3 -2
  287. package/dist/web/primitives/embedded-list-cards.js +3 -4
  288. package/dist/web/primitives/facet-filter.d.ts +5 -3
  289. package/dist/web/primitives/facet-filter.js +36 -5
  290. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  291. package/dist/web/primitives/facet-search-filter.js +3 -2
  292. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  293. package/dist/web/primitives/facet-trigger-label.js +9 -0
  294. package/dist/web/primitives/file-thumbnail.d.ts +6 -2
  295. package/dist/web/primitives/file-thumbnail.js +13 -6
  296. package/dist/web/primitives/file-upload.js +3 -2
  297. package/dist/web/primitives/file-view-action.d.ts +6 -0
  298. package/dist/web/primitives/file-view-action.js +22 -0
  299. package/dist/web/primitives/files-dropzone.js +20 -9
  300. package/dist/web/primitives/form-footer-parts.d.ts +0 -1
  301. package/dist/web/primitives/form.js +0 -1
  302. package/dist/web/primitives/hint-reason-row.d.ts +32 -0
  303. package/dist/web/primitives/hint-reason-row.js +45 -0
  304. package/dist/web/primitives/index.js +6 -0
  305. package/dist/web/primitives/layout-elements.d.ts +1 -1
  306. package/dist/web/primitives/layout-elements.js +3 -3
  307. package/dist/web/primitives/metric.js +20 -6
  308. package/dist/web/primitives/page-header.d.ts +1 -1
  309. package/dist/web/primitives/page-header.js +10 -2
  310. package/dist/web/primitives/pager.d.ts +3 -2
  311. package/dist/web/primitives/pager.js +31 -24
  312. package/dist/web/primitives/reason-box.d.ts +20 -0
  313. package/dist/web/primitives/reason-box.js +13 -0
  314. package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
  315. package/dist/web/primitives/record-breadcrumb.js +11 -0
  316. package/dist/web/primitives/record-steps.d.ts +3 -0
  317. package/dist/web/primitives/record-steps.js +50 -0
  318. package/dist/web/primitives/record-summary.d.ts +3 -0
  319. package/dist/web/primitives/record-summary.js +18 -0
  320. package/dist/web/primitives/row-actions.d.ts +3 -1
  321. package/dist/web/primitives/row-actions.js +14 -5
  322. package/dist/web/primitives/segmented-select.js +10 -9
  323. package/dist/web/primitives/tabs.js +6 -1
  324. package/dist/web/pwa/pwa-support.d.ts +4 -0
  325. package/dist/web/pwa/pwa-support.js +131 -0
  326. package/dist/web/sse/live-events.js +2 -2
  327. package/dist/web/tokens.js +0 -3
  328. package/dist/web/ui/sidebar.d.ts +2 -1
  329. package/dist/web/ui/sidebar.js +4 -3
  330. package/dist/web/widgets/ai-text-field.js +3 -2
  331. package/dist/web/widgets/chart-parts.d.ts +7 -1
  332. package/dist/web/widgets/chart-parts.js +10 -4
  333. package/dist/web/widgets/collapsible-section.js +1 -1
  334. package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
  335. package/dist/web/widgets/dashboard-list-cards.js +46 -0
  336. package/dist/web/widgets/dashboard-list.d.ts +45 -5
  337. package/dist/web/widgets/dashboard-list.js +126 -25
  338. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  339. package/dist/web/widgets/drawer-panel-class.js +9 -1
  340. package/dist/web/widgets/drawer-sizing.js +1 -1
  341. package/dist/web/widgets/drawer.js +2 -2
  342. package/dist/web/widgets/floating-panel.js +4 -2
  343. package/dist/web/widgets/index.d.ts +2 -0
  344. package/dist/web/widgets/index.js +2 -0
  345. package/dist/web/widgets/infinity-list.js +18 -11
  346. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  347. package/dist/web/widgets/preview-width-frame.d.ts +7 -0
  348. package/dist/web/widgets/preview-width-frame.js +10 -0
  349. package/dist/web/widgets/section-card.d.ts +1 -1
  350. package/dist/web/widgets/sheet-parts.js +3 -1
  351. package/dist/web/widgets/stacked-area-chrome.js +3 -3
  352. package/dist/web/widgets/stacked-area-tooltip.js +2 -10
  353. package/dist/web/widgets/stat-box-cell.d.ts +19 -0
  354. package/dist/web/widgets/stat-box-cell.js +10 -0
  355. package/dist/web/widgets/stat.d.ts +16 -1
  356. package/dist/web/widgets/stat.js +24 -7
  357. package/dist/web/widgets/status-badge.d.ts +7 -5
  358. package/dist/web/widgets/status-badge.js +2 -2
  359. package/dist/web/widgets/step-bar.d.ts +1 -1
  360. package/dist/web/widgets/step-bar.js +37 -7
  361. package/dist/web/widgets/step-list-row.d.ts +4 -0
  362. package/dist/web/widgets/step-list-row.js +22 -14
  363. package/dist/web/widgets/step-list.d.ts +12 -4
  364. package/dist/web/widgets/step-list.js +38 -20
  365. package/dist/web/widgets/upload-zone.d.ts +8 -1
  366. package/dist/web/widgets/upload-zone.js +13 -3
  367. package/package.json +5 -5
  368. package/src/changes.json +289 -0
  369. package/src/web/styles.css +15 -0
@@ -13,6 +13,9 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.tsx";
13
13
  export { PlainContentEditor } from "./app/plain-content-editor.tsx";
14
14
  export { useResolvers } from "./app/resolvers-context.tsx";
15
15
  export { clearRememberedListState } from "./app/session-list-state-store.ts";
16
+ export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.ts";
17
+ export type { EditorActionTestIds, EditorHeaderTestIds, EditorMode, EditorSaveActions, EditorWorkbenchProps, FooterTone, InfoBarTone, WorkbenchSave, } from "./editor/index.ts";
18
+ export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.ts";
16
19
  export type { NavIconKey } from "./icons.tsx";
17
20
  export { Icon } from "./icons.tsx";
18
21
  export type { AppLayoutProps } from "./layout/app-layout.tsx";
@@ -27,10 +30,12 @@ export type { NavReparentOverride } from "./layout/filter-app-schema-navs.ts";
27
30
  export { filterAppSchemaNavsByAllowlist, reparentAppSchemaNavs, } from "./layout/filter-app-schema-navs.ts";
28
31
  export type { HeaderActionGroupProps } from "./layout/header-action-group.tsx";
29
32
  export { HeaderActionGroup } from "./layout/header-action-group.tsx";
33
+ export { HeaderActionPinned } from "./layout/header-action-pinned.tsx";
30
34
  export type { LanguageMenuItemsProps } from "./layout/language-menu-items.tsx";
31
35
  export { LanguageMenuItems } from "./layout/language-menu-items.tsx";
32
36
  export type { LanguageSwitcherProps, LocaleOption } from "./layout/language-switcher.tsx";
33
37
  export { LanguageSwitcher } from "./layout/language-switcher.tsx";
38
+ export { clearNavCollapseState } from "./layout/nav-collapse-state.ts";
34
39
  export type { NavTreeProps } from "./layout/nav-tree.tsx";
35
40
  export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.tsx";
36
41
  export type { ProfileMenuItem, ProfileMenuProps } from "./layout/profile-menu.tsx";
@@ -65,6 +70,9 @@ export { PresenceAvatars, PresenceNotice, usePresence, usePresenceList, } from "
65
70
  export type { ActionMenuProps, MenuItemDef } from "./primitives/action-menu.tsx";
66
71
  export { ActionMenu } from "./primitives/action-menu.tsx";
67
72
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, } from "./primitives/dropdown-menu.tsx";
73
+ export type { FileMeta } from "./primitives/file-thumbnail.tsx";
74
+ export { useFileMeta } from "./primitives/file-thumbnail.tsx";
75
+ export { FileViewAction } from "./primitives/file-view-action.tsx";
68
76
  export { BareFormProvider, DefaultCard as Card, defaultPrimitives, FormScreenShell, ScreenWidthProvider, } from "./primitives/index.tsx";
69
77
  export { PageSection, Stack } from "./primitives/layout.tsx";
70
78
  export { formatMoney } from "./primitives/money-input.tsx";
@@ -79,4 +87,4 @@ export { SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from
79
87
  export type { KumikoBuild } from "./version/update-checker.tsx";
80
88
  export { readLoadedBuild } from "./version/update-checker.tsx";
81
89
  export type { AiTextAreaProps, AiTextEndAction, AiTextFieldProps, BooleanFieldProps, ComparisonMetric, ComposerProps, DateFieldProps, DrawerProps, FeedRow, FileFieldProps, FloatingPanelGeometry, FloatingPanelPlacement, FloatingPanelProps, InfinityListProps, InfinityListSelection, MessageAttachment, MessageBody, MessageReaderProps, MessageReaderTab, MessageThreadProps, MobileTopBarProps, ModeSwitchVariant, NumberFieldProps, PdfMatchInfo, PdfPreviewProps, PdfPreviewSource, PhotoSlotSpec, PhotoSlotsProps, PlanCardActionSlot, PlanCardLinkSlot, PlanCardPrice, PlanCardProps, PlanGridProps, ProgressListRow, PublicShellProps, PublicShellVariant, QueryTableColumn, QueryTableProps, RangeFieldProps, ResultColumn, SectionNavLayoutProps, SelectFieldProps, SideBySideTableCell, SideBySideTableColumn, SideBySideTableRow, StatDelta, StatTone, StatusBadgeTone, StatusBarEntry, StatusTone, StepAction, StepListItem, StepListProps, StepListSelection, StepSelectability, StepSelectionAction, StepSource, StepStatus, StepTag, TextareaFieldProps, TextFieldProps, ThreadMessage, TimeseriesHeight, TimeseriesPoint, TimeseriesReferenceLine, TimeseriesXAxis, TimeseriesYAxis, UploadZoneProps, } from "./widgets/index.ts";
82
- export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.ts";
90
+ export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, HtmlMailFrame, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, type PreviewDevice, PreviewWidthFrame, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.ts";
package/dist/web/index.js CHANGED
@@ -12,6 +12,8 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.js";
12
12
  export { PlainContentEditor } from "./app/plain-content-editor.js";
13
13
  export { useResolvers } from "./app/resolvers-context.js";
14
14
  export { clearRememberedListState } from "./app/session-list-state-store.js";
15
+ export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.js";
16
+ export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.js";
15
17
  export { Icon } from "./icons.js";
16
18
  export { AppLayout } from "./layout/app-layout.js";
17
19
  export { Avatar } from "./layout/avatar.js";
@@ -19,8 +21,10 @@ export { DefaultAppShell } from "./layout/default-app-shell.js";
19
21
  export { EditorPanel } from "./layout/editor-panel.js";
20
22
  export { filterAppSchemaNavsByAllowlist, reparentAppSchemaNavs, } from "./layout/filter-app-schema-navs.js";
21
23
  export { HeaderActionGroup } from "./layout/header-action-group.js";
24
+ export { HeaderActionPinned } from "./layout/header-action-pinned.js";
22
25
  export { LanguageMenuItems } from "./layout/language-menu-items.js";
23
26
  export { LanguageSwitcher } from "./layout/language-switcher.js";
27
+ export { clearNavCollapseState } from "./layout/nav-collapse-state.js";
24
28
  export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.js";
25
29
  export { ProfileMenu } from "./layout/profile-menu.js";
26
30
  export { useShellFocusMode } from "./layout/shell-focus.js";
@@ -43,6 +47,8 @@ export { FileUploadFailedError, uploadFileRef } from "./lib/upload-file-ref.js";
43
47
  export { PresenceAvatars, PresenceNotice, usePresence, usePresenceList, } from "./presence/index.js";
44
48
  export { ActionMenu } from "./primitives/action-menu.js";
45
49
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, } from "./primitives/dropdown-menu.js";
50
+ export { useFileMeta } from "./primitives/file-thumbnail.js";
51
+ export { FileViewAction } from "./primitives/file-view-action.js";
46
52
  export { BareFormProvider, DefaultCard as Card, defaultPrimitives, FormScreenShell, ScreenWidthProvider, } from "./primitives/index.js";
47
53
  export { PageSection, Stack } from "./primitives/layout.js";
48
54
  export { formatMoney } from "./primitives/money-input.js";
@@ -53,4 +59,4 @@ export { applyTokensToCssVars, defaultTokens, lightTokens, useBrowserTokensApi,
53
59
  export { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "./ui/resizable.js";
54
60
  export { SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "./ui/sidebar.js";
55
61
  export { readLoadedBuild } from "./version/update-checker.js";
56
- export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.js";
62
+ export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, HtmlMailFrame, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, PreviewWidthFrame, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.js";
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { UserRolesProvider, useTranslation, } from "../../index.js";
2
+ import { ScreenFocusProvider, UserRolesProvider, useTranslation, } from "../../index.js";
3
3
  import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarHeader, SidebarInset, SidebarProvider, SidebarRail, } from "../ui/sidebar.js";
4
4
  import { fillClasses } from "./fill-classes.js";
5
- import { FocusAwareSidebarBody, focusSidebarProviderProps } from "./focus-aware-sidebar.js";
5
+ import { FocusAwareSidebarBody, sidebarProviderProps } from "./focus-aware-sidebar.js";
6
6
  import { NavTree } from "./nav-tree.js";
7
7
  import { PageHeaderSlotProvider } from "./page-header-slot.js";
8
- import { ShellFocusProvider, useShellFocusHost } from "./shell-focus.js";
8
+ import { ShellFocusProvider, ShellTopbarActionsProvider, useShellFocusHost, } from "./shell-focus.js";
9
9
  import { ShellHeader } from "./shell-header.js";
10
+ import { usePersistedSidebarOpen } from "./sidebar-open-state.js";
10
11
  import { SidebarPanelProvider, useSidebarPanelHost } from "./sidebar-panel.js";
11
12
  export function DefaultAppShell({ brand, schema, user, sidebarActions, headerActions, navBadges, sidebarFooter, focusRailNavQns, fill = true, children, }) {
12
13
  const fillCls = fillClasses(fill);
@@ -15,5 +16,6 @@ export function DefaultAppShell({ brand, schema, user, sidebarActions, headerAct
15
16
  // every other screen would carry an empty strip next to the navigation.
16
17
  const panel = useSidebarPanelHost();
17
18
  const focus = useShellFocusHost();
18
- return (_jsx(SidebarProvider, { ...fillCls.provider, ...focusSidebarProviderProps(focus), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: schema, user: user, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsx(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: brand }), sidebarActions !== undefined && (_jsx(SidebarGroup, { "data-kumiko-layout": "sidebar-actions", className: "flex-row flex-wrap items-center gap-1 py-0", children: sidebarActions })), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: _jsx(NavTree, { schema: schema, ...(user !== undefined && { user }), ...(navBadges !== undefined && { navBadges }) }) }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: schema, ...(user !== undefined && { user }), ...(headerActions !== undefined && { headerActions }) }), _jsx("main", { className: fillCls.main, children: _jsx(UserRolesProvider, { roles: user?.roles, children: children }) })] }) })] }) }) }));
19
+ const sidebarOpen = usePersistedSidebarOpen();
20
+ return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsx(ShellTopbarActionsProvider, { value: headerActions, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: schema, user: user, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsx(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: brand }), sidebarActions !== undefined && (_jsx(SidebarGroup, { "data-kumiko-layout": "sidebar-actions", className: "flex-row flex-wrap items-center gap-1 py-0", children: sidebarActions })), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: _jsx(NavTree, { schema: schema, ...(user !== undefined && { user }), ...(navBadges !== undefined && { navBadges }) }) }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: schema, ...(user !== undefined && { user }), ...(headerActions !== undefined && { headerActions }) }), _jsx("main", { className: fillCls.main, children: _jsx(UserRolesProvider, { roles: user?.roles, children: children }) })] }) })] }) }) }) }) }));
19
21
  }
@@ -1,15 +1,12 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
2
  import type { AppSchema, FeatureSchema } from "../../index.ts";
3
3
  import type { ShellFocusHost } from "./shell-focus.tsx";
4
- /** SidebarProvider props that hand the rail state to the focus host while a screen holds focus mode. */
5
- export declare function focusSidebarProviderProps(focus: ShellFocusHost): {
6
- open?: undefined;
7
- onOpenChange?: undefined;
8
- style?: undefined;
9
- } | {
4
+ import type { PersistedSidebarOpen } from "./sidebar-open-state.ts";
5
+ /** SidebarProvider props: the user-owned open state, plus the narrow rail width while a screen holds focus mode. */
6
+ export declare function sidebarProviderProps(focus: ShellFocusHost, sidebar: PersistedSidebarOpen): {
10
7
  open: boolean;
11
8
  onOpenChange: (open: boolean) => void;
12
- style: CSSProperties;
9
+ style?: CSSProperties | undefined;
13
10
  };
14
11
  /** Swaps the whole sidebar content for the focus rail while focused and collapsed on desktop. */
15
12
  export declare function FocusAwareSidebarBody({ focused, brand, schema, user, allowedNavQns, railNavQns, footer, children, }: {
@@ -3,14 +3,12 @@ import { useSidebar } from "../ui/sidebar.js";
3
3
  import { FocusRail } from "./focus-rail.js";
4
4
  // 3.5rem = the 56px rail of the focused screen; the default icon width stays 3rem.
5
5
  const FOCUS_RAIL_WIDTH_STYLE = { "--sidebar-width-icon": "3.5rem" };
6
- /** SidebarProvider props that hand the rail state to the focus host while a screen holds focus mode. */
7
- export function focusSidebarProviderProps(focus) {
8
- if (!focus.focused)
9
- return {};
6
+ /** SidebarProvider props: the user-owned open state, plus the narrow rail width while a screen holds focus mode. */
7
+ export function sidebarProviderProps(focus, sidebar) {
10
8
  return {
11
- open: focus.railOpen,
12
- onOpenChange: focus.setRailOpen,
13
- style: FOCUS_RAIL_WIDTH_STYLE,
9
+ open: sidebar.open,
10
+ onOpenChange: sidebar.setOpen,
11
+ ...(focus.focused && { style: FOCUS_RAIL_WIDTH_STYLE }),
14
12
  };
15
13
  }
16
14
  /** Swaps the whole sidebar content for the focus rail while focused and collapsed on desktop. */
@@ -0,0 +1,8 @@
1
+ import { type ReactNode } from "react";
2
+ /** Marks an app header action (e.g. the assistant trigger) that stays in the bar on a phone, next to the
3
+ * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing. */
4
+ export declare function HeaderActionPinned({ children }: {
5
+ readonly children: ReactNode;
6
+ }): ReactNode;
7
+ export declare function collectPinnedHeaderActions(node: ReactNode): readonly ReactNode[];
8
+ export declare function isOnlyPinnedHeaderActions(node: ReactNode): boolean;
@@ -0,0 +1,25 @@
1
+ import { Children, Fragment, isValidElement, useContext } from "react";
2
+ import { HeaderOverflowMenuContext } from "./header-overflow-menu.js";
3
+ /** Marks an app header action (e.g. the assistant trigger) that stays in the bar on a phone, next to the
4
+ * bell; the rest of `headerActions` folds into the "…" menu. Inside the menu it renders nothing. */
5
+ export function HeaderActionPinned({ children }) {
6
+ const inMenu = useContext(HeaderOverflowMenuContext);
7
+ return inMenu ? null : children;
8
+ }
9
+ function isPinnedElement(node) {
10
+ return isValidElement(node) && node.type === HeaderActionPinned;
11
+ }
12
+ // Pinned markers are found in the JSX tree handed to the shell (fragments and arrays included); a marker
13
+ // hidden inside another component's render output is not seen.
14
+ function flattenFragments(node) {
15
+ return Children.toArray(node).flatMap((child) => isValidElement(child) && child.type === Fragment
16
+ ? flattenFragments(child.props.children)
17
+ : [child]);
18
+ }
19
+ export function collectPinnedHeaderActions(node) {
20
+ return flattenFragments(node).filter(isPinnedElement);
21
+ }
22
+ export function isOnlyPinnedHeaderActions(node) {
23
+ const children = flattenFragments(node);
24
+ return children.length > 0 && children.every(isPinnedElement);
25
+ }
@@ -0,0 +1,7 @@
1
+ /** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
2
+ export declare function clearNavCollapseState(): void;
3
+ export declare function usePersistedNavCollapse(): {
4
+ readonly collapsed: ReadonlySet<string>;
5
+ readonly toggle: (qualifiedName: string) => void;
6
+ readonly revealOnScreenChange: (screenId: string, qualifiedNames: readonly string[]) => void;
7
+ };
@@ -0,0 +1,76 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { toggleSetMember } from "../../toggle-set-member.js";
3
+ const STORAGE_KEY = "kumiko.nav.collapsed";
4
+ const REVEALED_SCREEN_KEY = "kumiko.nav.revealedScreen";
5
+ // Storage can be missing (SSR, Metro), blocked (privacy mode) or hold foreign
6
+ // data, so every access degrades to "nothing collapsed" instead of throwing.
7
+ function readStoredCollapsed() {
8
+ try {
9
+ const raw = window.sessionStorage.getItem(STORAGE_KEY);
10
+ if (raw === null)
11
+ return new Set();
12
+ const parsed = JSON.parse(raw);
13
+ if (!Array.isArray(parsed))
14
+ return new Set();
15
+ return new Set(parsed.filter((entry) => typeof entry === "string"));
16
+ }
17
+ catch {
18
+ return new Set();
19
+ }
20
+ }
21
+ function writeStoredCollapsed(collapsed) {
22
+ try {
23
+ window.sessionStorage.setItem(STORAGE_KEY, JSON.stringify([...collapsed]));
24
+ }
25
+ catch {
26
+ // storage unavailable: the state just stops surviving a remount
27
+ }
28
+ }
29
+ function readRevealedScreen() {
30
+ try {
31
+ return window.sessionStorage.getItem(REVEALED_SCREEN_KEY);
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ function writeRevealedScreen(screenId) {
38
+ try {
39
+ window.sessionStorage.setItem(REVEALED_SCREEN_KEY, screenId);
40
+ }
41
+ catch {
42
+ // storage unavailable: a remount may reveal the active path once more
43
+ }
44
+ }
45
+ /** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
46
+ export function clearNavCollapseState() {
47
+ try {
48
+ window.sessionStorage.removeItem(STORAGE_KEY);
49
+ window.sessionStorage.removeItem(REVEALED_SCREEN_KEY);
50
+ }
51
+ catch {
52
+ // storage unavailable: nothing was persisted
53
+ }
54
+ }
55
+ // The sidebar body remounts when the shell swaps it (focus mode, mobile sheet),
56
+ // so the explicitly collapsed qualified names live in sessionStorage, not in
57
+ // component state alone.
58
+ export function usePersistedNavCollapse() {
59
+ const [collapsed, setCollapsed] = useState(readStoredCollapsed);
60
+ useEffect(() => writeStoredCollapsed(collapsed), [collapsed]);
61
+ const toggle = useCallback((qualifiedName) => {
62
+ setCollapsed((prev) => toggleSetMember(prev, qualifiedName));
63
+ }, []);
64
+ const revealOnScreenChange = useCallback((screenId, qualifiedNames) => {
65
+ // skip: this screen's path was already revealed once; later collapses stay
66
+ if (readRevealedScreen() === screenId)
67
+ return;
68
+ writeRevealedScreen(screenId);
69
+ setCollapsed((prev) => {
70
+ if (!qualifiedNames.some((qn) => prev.has(qn)))
71
+ return prev;
72
+ return new Set([...prev].filter((qn) => !qualifiedNames.includes(qn)));
73
+ });
74
+ }, []);
75
+ return { collapsed, toggle, revealOnScreenChange };
76
+ }
@@ -1,17 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown, ChevronRight, Plus, Search } from "lucide-react";
2
+ import { ChevronDown, ChevronRight, Plus } from "lucide-react";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
4
4
  import { rendererWarn } from "../../dev-console.js";
5
5
  import { resolveNavigation } from "../../headless/index.js";
6
6
  import { createLiveRefetchScheduler } from "../../hooks/live-refetch-scheduler.js";
7
7
  import { lastSegment, toAppSchema, useLiveEvents, useNav, useTranslation } from "../../index.js";
8
- import { toggleSetMember } from "../../toggle-set-member.js";
9
8
  import { KumikoLink } from "../app/nav.js";
10
9
  import { useNavEntities, useNavProviders } from "../app/nav-providers-context.js";
10
+ import { DrawnSearch } from "../drawn-icons.js";
11
11
  import { NAV_ICONS } from "../icons.js";
12
12
  import { cn } from "../lib/cn.js";
13
13
  import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInput, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar, } from "../ui/sidebar.js";
14
+ import { usePersistedNavCollapse } from "./nav-collapse-state.js";
14
15
  import { resolveParentScreenId } from "./shell-breadcrumb.js";
16
+ import { useShellNavStyle } from "./shell-style.js";
15
17
  import { useDispatchTarget } from "./target-resolver-stub.js";
16
18
  import { parseTargetFromSearchParams } from "./target-url.js";
17
19
  // Widened alias for the two lookup sites below, which index by the plain
@@ -28,6 +30,17 @@ export function treeContainsScreen(nodes, screenId) {
28
30
  return nodes.some((n) => (n.screen !== undefined && lastSegment(n.screen) === screenId) ||
29
31
  treeContainsScreen(n.children, screenId));
30
32
  }
33
+ // Qualified names of the containers on the way to the node showing `screenId`.
34
+ function containerPathToScreen(nodes, screenId) {
35
+ for (const node of nodes) {
36
+ if (node.screen !== undefined && lastSegment(node.screen) === screenId)
37
+ return [];
38
+ const inner = containerPathToScreen(node.children, screenId);
39
+ if (inner !== undefined)
40
+ return [node.qualifiedName, ...inner];
41
+ }
42
+ return undefined;
43
+ }
31
44
  // A node survives filtering when it or a descendant matches.
32
45
  // Provider children are already materialized during filtering (provider nodes
33
46
  // are default-expanded → eagerly loaded), so static children recursion is
@@ -68,11 +81,21 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
68
81
  // The collapsed set contains only explicitly collapsed qualified names.
69
82
  // Everything is therefore expanded by default, so new features appear open
70
83
  // without requiring the user to click first.
71
- const [collapsed, setCollapsed] = useState(() => new Set());
72
- const onToggle = useCallback((qn) => {
73
- setCollapsed((prev) => toggleSetMember(prev, qn));
74
- }, []);
84
+ const { collapsed, toggle: onToggle, revealOnScreenChange } = usePersistedNavCollapse();
85
+ // Keyed on the active screen only, so a container the user collapses while
86
+ // staying on the screen is not reopened; other collapsed containers are left alone.
87
+ const revealScreenId = activeMarker?.screenId;
88
+ const treeRef = useRef(tree);
89
+ treeRef.current = tree;
90
+ useEffect(() => {
91
+ if (revealScreenId === undefined)
92
+ return;
93
+ const path = containerPathToScreen(treeRef.current, revealScreenId);
94
+ if (path !== undefined)
95
+ revealOnScreenChange(revealScreenId, path);
96
+ }, [revealScreenId, revealOnScreenChange]);
75
97
  const t = useTranslation();
98
+ const plain = useShellNavStyle() === "plain";
76
99
  const { state: sidebarState } = useSidebar();
77
100
  const [filter, setFilter] = useState("");
78
101
  // The search box is only CSS-hidden (`group-data-[collapsible=icon]:hidden`)
@@ -84,11 +107,10 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
84
107
  }, [sidebarState]);
85
108
  const q = filter.trim().toLowerCase();
86
109
  const matches = useCallback((raw) => {
87
- const label = raw.includes(".") ? t(raw) : raw;
88
- return label.toLowerCase().includes(q);
110
+ return navLabel(t, raw).toLowerCase().includes(q);
89
111
  }, [t, q]);
90
112
  const navFilter = useMemo(() => ({ q, matches }), [q, matches]);
91
- return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: "pl-8", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
113
+ return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(DrawnSearch, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: cn("pl-8", plain && PLAIN_SEARCH_CLASS), value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree, plain).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
92
114
  }
93
115
  // The runtime badge slot is keyed by the bare nav ID. With no entry it
94
116
  // renders nothing, avoiding layout shift. shrink-0 and ml-auto move it to the
@@ -112,21 +134,30 @@ function NavBadge({ node }) {
112
134
  // A pure section is a group header without its own screen that only groups
113
135
  // its children. At the top level it becomes a SidebarGroup with a toggleable
114
136
  // GroupLabel; a node with a screen remains a clickable menu entry even when it
115
- // also has children.
116
- function isPureSection(node) {
137
+ // also has children. In the plain nav a group's createAction stays a section
138
+ // and renders as a "+" on the group label.
139
+ function isPureSection(node, plain) {
117
140
  return (node.screen === undefined &&
118
141
  node.target === undefined &&
119
142
  node.provider !== true &&
120
- node.createAction === undefined &&
143
+ (plain || node.createAction === undefined) &&
121
144
  node.children.length > 0);
122
145
  }
146
+ const PLAIN_ITEM_CLASS = "px-2.5 py-1.5 text-[13.5px] leading-[1.3] font-normal hover:bg-sidebar-foreground/10 data-[active=true]:bg-sidebar-foreground/10 data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground";
147
+ const PLAIN_GROUP_LABEL_CLASS = "justify-between rounded-none px-2.5 pt-[11px] pb-[3px] text-[10.5px] font-normal uppercase tracking-[0.07em] text-sidebar-muted";
148
+ const PLAIN_SEARCH_CLASS = "h-auto rounded-md border-0 py-[7px] text-[12.5px]";
149
+ const PLUS_BUTTON_CLASS = "flex size-5 items-center justify-center rounded-md text-sidebar-muted";
150
+ const PLAIN_PLUS_REVEAL_CLASS = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100 group-focus-within/menu-sub-item:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100";
151
+ function usePlainItemClass() {
152
+ return useShellNavStyle() === "plain" ? PLAIN_ITEM_CLASS : undefined;
153
+ }
123
154
  // Consecutive non-section entries share one <ul>, so the root gap only
124
155
  // separates blocks and not every pair of top-level leaves.
125
- function groupTopLevelRuns(nodes) {
156
+ function groupTopLevelRuns(nodes, plain) {
126
157
  const runs = [];
127
158
  let entries;
128
159
  for (const node of nodes) {
129
- if (isPureSection(node)) {
160
+ if (isPureSection(node, plain)) {
130
161
  entries = undefined;
131
162
  runs.push({ kind: "section", node });
132
163
  }
@@ -143,13 +174,16 @@ function groupTopLevelRuns(nodes) {
143
174
  // If the label contains a dot, pass it through t(): the bundle translates
144
175
  // the key; otherwise the key remains visible as a reminder of a missing
145
176
  // translation. Literal string labels are left unchanged.
177
+ function navLabel(t, raw) {
178
+ return raw.includes(".") ? t(raw) : raw;
179
+ }
146
180
  function useLabel(node) {
147
- const t = useTranslation();
148
- return node.label.includes(".") ? t(node.label) : node.label;
181
+ return navLabel(useTranslation(), node.label);
149
182
  }
150
183
  // Without an icon only the collapsed rail shows the initial letter; expanded,
151
184
  // the label stands alone.
152
185
  function NavLeadingIcon({ node, active, expanded = false, label, }) {
186
+ const plain = useShellNavStyle() === "plain";
153
187
  const iconKey = expanded && node.icon === "folder" ? "folder-open" : node.icon;
154
188
  const isKnownIcon = iconKey !== undefined && Object.hasOwn(NAV_ICONS, iconKey);
155
189
  const NavIcon = iconKey !== undefined && isKnownIcon ? NAV_ICON_LOOKUP[iconKey] : undefined;
@@ -159,8 +193,9 @@ function NavLeadingIcon({ node, active, expanded = false, label, }) {
159
193
  `registered in NAV_ICONS — falling back to the dot indicator. Check the icon key spelling.`);
160
194
  }
161
195
  }, [iconKey, isKnownIcon, node.qualifiedName]);
162
- if (NavIcon !== undefined)
163
- return _jsx(NavIcon, { "aria-hidden": "true", className: "shrink-0" });
196
+ if (NavIcon !== undefined) {
197
+ return (_jsx(NavIcon, { "aria-hidden": "true", className: cn("shrink-0", plain && "hidden group-data-[collapsible=icon]:block") }));
198
+ }
164
199
  const initial = label?.trim().charAt(0).toUpperCase();
165
200
  if (initial === undefined || initial === "")
166
201
  return null;
@@ -366,14 +401,15 @@ function TreeActionControl({ action, ariaLabel, className, dispatch, workspaceId
366
401
  function NodeActions({ node, expandable, workspaceId, }) {
367
402
  const dispatch = useDispatchTarget();
368
403
  const t = useTranslation();
404
+ const plain = useShellNavStyle() === "plain";
369
405
  const create = node.createAction;
370
406
  const actions = node.actions ?? [];
371
407
  if (create === undefined && actions.length === 0)
372
408
  return null;
373
- const label = (s) => (s.includes(".") ? t(s) : s);
374
- const btn = "flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";
409
+ const label = (s) => navLabel(t, s);
410
+ const btn = `${PLUS_BUTTON_CLASS} hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`;
375
411
  const hover = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100";
376
- return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: btn, dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
412
+ return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: cn(btn, plain && PLAIN_PLUS_REVEAL_CLASS), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
377
413
  }
378
414
  // Status lines within a provider sub-list (lazy loading or error).
379
415
  function ProviderStatus({ loading, error, }) {
@@ -390,6 +426,11 @@ function ProviderStatus({ loading, error, }) {
390
426
  // on items with children, not on the section itself.
391
427
  function NavSection({ node, collapsed, onToggle }) {
392
428
  const displayLabel = useLabel(node);
429
+ const t = useTranslation();
430
+ const nav = useNav();
431
+ const dispatch = useDispatchTarget();
432
+ const plain = useShellNavStyle() === "plain";
433
+ const create = node.createAction;
393
434
  const { q, matches } = useContext(NavFilterContext);
394
435
  // Provider children are statically empty until loaded, so they keep the
395
436
  // section visible; their matches cannot be checked statically, and the node
@@ -399,7 +440,7 @@ function NavSection({ node, collapsed, onToggle }) {
399
440
  !node.children.some((c) => c.provider === true || subtreeMatches(c, matches))) {
400
441
  return null;
401
442
  }
402
- return (_jsxs(SidebarGroup, { children: [_jsx(SidebarGroupLabel, { children: displayLabel }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
443
+ return (_jsxs(SidebarGroup, { children: [_jsxs(SidebarGroupLabel, { className: plain ? PLAIN_GROUP_LABEL_CLASS : undefined, children: [displayLabel, plain && create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: navLabel(t, create.label), className: `${PLUS_BUTTON_CLASS} hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground`, dispatch: dispatch, workspaceId: nav.route?.workspaceId, children: _jsx(Plus, { className: "size-3.5" }) }))] }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
403
444
  }
404
445
  // A menu entry (top-level item or section child) supports three click modes:
405
446
  // `screen` is a route link (KumikoLink), `target` dispatches to EditorPanel
@@ -412,19 +453,20 @@ function NavMenuNode({ node, collapsed, onToggle }) {
412
453
  const t = useTranslation();
413
454
  const dispatch = useDispatchTarget();
414
455
  const s = useNavNodeState(node, collapsed);
456
+ const itemClass = usePlainItemClass();
415
457
  if (s.hidden)
416
458
  return null;
417
459
  const sub = s.isExpanded ? (_jsxs(SidebarMenuSub, { children: [_jsx(ProviderStatus, { loading: s.providerLoading, error: s.providerError }), s.childNodes.map((child) => (_jsx(NavSubNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName)))] })) : null;
418
460
  const chevron = s.expandable ? (_jsx(SidebarMenuAction, { "aria-label": t(s.isExpanded ? "kumiko.nav.collapse" : "kumiko.nav.expand"), "aria-expanded": s.isExpanded, onClick: () => onToggle(node.qualifiedName), children: s.isExpanded ? _jsx(ChevronDown, {}) : _jsx(ChevronRight, {}) })) : null;
419
461
  if (node.screen !== undefined) {
420
462
  const screenId = lastSegment(node.screen);
421
- return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
463
+ return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
422
464
  }
423
465
  if (node.target !== undefined) {
424
466
  const target = node.target;
425
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
467
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, className: itemClass, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
426
468
  }
427
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { onClick: () => {
469
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { className: itemClass, onClick: () => {
428
470
  if (s.expandable)
429
471
  onToggle(node.qualifiedName);
430
472
  }, ...(s.expandable && { "aria-expanded": s.isExpanded }), children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), s.expandable &&
@@ -440,6 +482,7 @@ function NavSubNode({ node, collapsed, onToggle }) {
440
482
  const t = useTranslation();
441
483
  const dispatch = useDispatchTarget();
442
484
  const s = useNavNodeState(node, collapsed);
485
+ const itemClass = usePlainItemClass();
443
486
  if (s.hidden)
444
487
  return null;
445
488
  // Children go in their own SidebarMenuSub (<ul>): a sub-item is an <li>, so
@@ -453,13 +496,13 @@ function NavSubNode({ node, collapsed, onToggle }) {
453
496
  }, className: "absolute top-1 right-1 flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: s.isExpanded ? _jsx(ChevronDown, { className: "size-3.5" }) : _jsx(ChevronRight, { className: "size-3.5" }) })) : null;
454
497
  if (node.screen !== undefined) {
455
498
  const screenId = lastSegment(node.screen);
456
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
499
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
457
500
  }
458
501
  if (node.target !== undefined) {
459
502
  const target = node.target;
460
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
503
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
461
504
  }
462
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, children: _jsxs("button", { type: "button", onClick: () => {
505
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => {
463
506
  if (s.expandable)
464
507
  onToggle(node.qualifiedName);
465
508
  }, children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
@@ -1,5 +1,10 @@
1
1
  import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import { type ReactNode } from "react";
3
- export declare function NotificationBell({ screens, }: {
2
+ import { type ReactNode, type RefObject } from "react";
3
+ export declare function NotificationBell({ screens, menuEntry, }: {
4
4
  readonly screens: readonly ScreenDefinition[];
5
+ /** Inside the header overflow menu: a menu row instead of the bell button; the list opens at `anchorRef` and survives the menu closing via `onSelect`. */
6
+ readonly menuEntry?: {
7
+ readonly anchorRef: RefObject<HTMLElement | null>;
8
+ readonly onSelect: () => void;
9
+ };
5
10
  }): ReactNode;
@@ -1,18 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Bell } from "lucide-react";
3
3
  import { Popover as PopoverPrimitive } from "radix-ui";
4
4
  import { useState } from "react";
5
5
  import { lastSegment, useLocale, useNav, useTranslation } from "../../index.js";
6
6
  import { useRelativeTimeFormatter } from "../app/relative-time.js";
7
7
  import { cn } from "../lib/cn.js";
8
+ import { headerOverflowMenuItemClass } from "./header-overflow-menu.js";
8
9
  import { useInAppInbox } from "./use-in-app-inbox.js";
9
10
  const MAX_BADGE_COUNT = 99;
10
- const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-input " +
11
- "bg-background text-foreground shadow-xs transition-colors hover:bg-accent " +
11
+ const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md " +
12
+ "text-foreground-secondary transition-colors hover:bg-accent " +
12
13
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
13
14
  const panelClass = "z-50 flex max-h-[28rem] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-md border " +
14
15
  "bg-popover text-popover-foreground shadow-md";
15
- export function NotificationBell({ screens, }) {
16
+ export function NotificationBell({ screens, menuEntry, }) {
16
17
  const t = useTranslation();
17
18
  const nav = useNav();
18
19
  const locale = useLocale().locale();
@@ -35,5 +36,15 @@ export function NotificationBell({ screens, }) {
35
36
  setOpen(false);
36
37
  nav.navigate(target.entityId === undefined ? { screenId } : { screenId, entityId: target.entityId });
37
38
  };
38
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute -right-1.5 -top-1.5 flex min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-4 text-destructive-foreground", children: badge }))] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) })] }));
39
+ const panel = (_jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, ...(menuEntry !== undefined && {
40
+ // Without a Trigger Radix has nothing to refocus; the keyboard user returns to the menu button.
41
+ onCloseAutoFocus: (event) => {
42
+ event.preventDefault();
43
+ menuEntry.anchorRef.current?.focus();
44
+ },
45
+ }), children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) }));
46
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [menuEntry === undefined ? (_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute right-[3px] top-[3px] rounded-full bg-destructive px-1 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] }) })) : (_jsxs(_Fragment, { children: [_jsx(PopoverPrimitive.Anchor, { virtualRef: menuEntry.anchorRef }), _jsxs("button", { type: "button", role: "menuitem", "data-testid": "notification-bell-menu-item", className: headerOverflowMenuItemClass, onClick: () => {
47
+ setOpen(true);
48
+ menuEntry.onSelect();
49
+ }, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t("kumiko.notifications.label") }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "rounded-full bg-destructive px-1.5 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] })] })), panel] }));
39
50
  }
@@ -10,6 +10,8 @@ export type PageHeaderSlot = {
10
10
  readonly setTitle: (title: string | undefined) => void;
11
11
  readonly recordTitle: string | undefined;
12
12
  readonly setRecordTitle: (recordTitle: string | undefined) => void;
13
+ readonly bodyTitle: boolean;
14
+ readonly setBodyTitle: (bodyTitle: boolean) => void;
13
15
  readonly breadcrumbHidden: boolean;
14
16
  readonly setBreadcrumbHidden: (hidden: boolean) => void;
15
17
  readonly breadcrumbScreenId: string | undefined;