@cosmicdrift/kumiko-renderer 0.413.1 → 0.414.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 (334) 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 +30 -50
  6. package/dist/app/form-schema.d.ts +1 -0
  7. package/dist/app/form-schema.js +24 -0
  8. package/dist/app/list-sort-options.d.ts +4 -0
  9. package/dist/app/list-sort-options.js +11 -0
  10. package/dist/app/named-filter-facet.d.ts +17 -3
  11. package/dist/app/named-filter-facet.js +88 -5
  12. package/dist/app/projection-detail-body.d.ts +2 -4
  13. package/dist/app/projection-detail-body.js +7 -1
  14. package/dist/app/projection-detail-guidance-data.d.ts +7 -0
  15. package/dist/app/projection-detail-guidance-data.js +101 -0
  16. package/dist/app/projection-detail-guidance.d.ts +13 -0
  17. package/dist/app/projection-detail-guidance.js +197 -0
  18. package/dist/app/projection-detail-header-model.d.ts +1 -3
  19. package/dist/app/projection-detail-header-model.js +4 -8
  20. package/dist/app/projection-detail-header-region.d.ts +2 -1
  21. package/dist/app/projection-detail-header-region.js +63 -23
  22. package/dist/app/projection-detail-header.d.ts +6 -1
  23. package/dist/app/projection-detail-header.js +75 -18
  24. package/dist/app/projection-detail-states.d.ts +3 -3
  25. package/dist/app/projection-list-body.js +4 -2
  26. package/dist/app/projection-list-render.js +3 -1
  27. package/dist/app/projection-list-shim.d.ts +4 -1
  28. package/dist/app/projection-list-shim.js +35 -8
  29. package/dist/app/reference-link.d.ts +3 -2
  30. package/dist/app/reference-link.js +19 -4
  31. package/dist/app/row-actions.js +3 -3
  32. package/dist/app/screen-access.d.ts +4 -0
  33. package/dist/app/screen-access.js +19 -0
  34. package/dist/app/screen-shared.js +3 -1
  35. package/dist/app/unique-label-keys.d.ts +1 -0
  36. package/dist/app/unique-label-keys.js +9 -0
  37. package/dist/app/use-entity-list-payload.d.ts +25 -0
  38. package/dist/app/use-entity-list-payload.js +57 -0
  39. package/dist/app/use-entity-range-facets.js +2 -3
  40. package/dist/app/use-facet-counts.d.ts +5 -0
  41. package/dist/app/use-facet-counts.js +7 -0
  42. package/dist/app/use-list-summary-row.d.ts +10 -0
  43. package/dist/app/use-list-summary-row.js +33 -0
  44. package/dist/app/use-named-filter-queue.d.ts +20 -0
  45. package/dist/app/use-named-filter-queue.js +9 -0
  46. package/dist/app/use-projection-detail-actions.d.ts +4 -4
  47. package/dist/app/use-projection-detail-actions.js +30 -1
  48. package/dist/app/use-projection-list-data.d.ts +5 -0
  49. package/dist/app/use-projection-list-data.js +35 -6
  50. package/dist/app/use-projection-list-query.d.ts +2 -0
  51. package/dist/app/use-projection-list-query.js +29 -16
  52. package/dist/app/use-related-list-tab-counts.js +5 -1
  53. package/dist/app/use-row-decoration.d.ts +11 -0
  54. package/dist/app/use-row-decoration.js +55 -0
  55. package/dist/app/use-screen-list-rows.d.ts +4 -1
  56. package/dist/app/use-screen-list-rows.js +14 -5
  57. package/dist/app/use-screen-list-table.d.ts +3 -1
  58. package/dist/app/use-screen-list-table.js +10 -1
  59. package/dist/app/write-failed-error.d.ts +1 -0
  60. package/dist/app/write-failed-error.js +10 -0
  61. package/dist/compact-tap-classes.d.ts +1 -0
  62. package/dist/compact-tap-classes.js +3 -0
  63. package/dist/components/embedded-list-field.js +13 -12
  64. package/dist/components/list-empty-state.d.ts +8 -1
  65. package/dist/components/list-empty-state.js +4 -1
  66. package/dist/components/list-group-page-bridges.d.ts +1 -1
  67. package/dist/components/list-group-page-bridges.js +2 -2
  68. package/dist/components/related-list-section.js +4 -22
  69. package/dist/components/render-edit-action-button.d.ts +3 -1
  70. package/dist/components/render-edit-action-button.js +5 -3
  71. package/dist/components/render-edit-render-model.d.ts +2 -2
  72. package/dist/components/render-edit-types.d.ts +4 -2
  73. package/dist/components/render-edit.js +3 -1
  74. package/dist/components/render-list-hint-columns.d.ts +8 -0
  75. package/dist/components/render-list-hint-columns.js +77 -0
  76. package/dist/components/render-list-reference-columns.js +4 -2
  77. package/dist/components/render-list-row-tone.d.ts +3 -0
  78. package/dist/components/render-list-row-tone.js +10 -0
  79. package/dist/components/render-list-table-props.d.ts +9 -1
  80. package/dist/components/render-list-table-props.js +4 -1
  81. package/dist/components/render-list-toolbar-action.d.ts +1 -2
  82. package/dist/components/render-list-toolbar-model.d.ts +3 -0
  83. package/dist/components/render-list-toolbar-model.js +21 -6
  84. package/dist/components/render-list-toolbar.d.ts +3 -2
  85. package/dist/components/render-list-toolbar.js +8 -6
  86. package/dist/components/render-list-types.d.ts +6 -1
  87. package/dist/components/render-list.js +26 -7
  88. package/dist/components/use-render-edit-controlled-sync.js +3 -5
  89. package/dist/components/use-render-edit-draft-save.js +7 -9
  90. package/dist/components/use-render-edit-schema.d.ts +3 -0
  91. package/dist/components/use-render-edit-schema.js +15 -0
  92. package/dist/components/use-render-edit-state.d.ts +1 -0
  93. package/dist/components/use-render-edit-state.js +4 -1
  94. package/dist/components/use-render-edit-steps.js +2 -3
  95. package/dist/components/use-render-list-columns.d.ts +3 -1
  96. package/dist/components/use-render-list-columns.js +22 -10
  97. package/dist/context/screen-focus-context.d.ts +14 -0
  98. package/dist/context/screen-focus-context.js +28 -0
  99. package/dist/data-table-facet-types.d.ts +2 -0
  100. package/dist/data-table-view-types.d.ts +20 -1
  101. package/dist/headless/form/form-controller.js +3 -1
  102. package/dist/headless/form/zod-bridge.d.ts +7 -1
  103. package/dist/headless/form/zod-bridge.js +10 -0
  104. package/dist/headless/index.d.ts +2 -1
  105. package/dist/headless/index.js +1 -0
  106. package/dist/headless/pwa-service-worker-meta.d.ts +1 -0
  107. package/dist/headless/pwa-service-worker-meta.js +3 -0
  108. package/dist/headless/view-model/index.d.ts +1 -1
  109. package/dist/headless/view-model/list-file-display.js +3 -2
  110. package/dist/headless/view-model/list.js +16 -0
  111. package/dist/headless/view-model/types.d.ts +33 -0
  112. package/dist/hooks/list-column-layout.js +2 -1
  113. package/dist/hooks/list-server-groups.js +14 -1
  114. package/dist/hooks/list-state-schema.d.ts +1 -0
  115. package/dist/hooks/list-state-schema.js +9 -1
  116. package/dist/hooks/use-debounced-value.d.ts +1 -0
  117. package/dist/hooks/use-debounced-value.js +11 -0
  118. package/dist/hooks/use-list-aggregates.d.ts +5 -1
  119. package/dist/hooks/use-list-aggregates.js +9 -5
  120. package/dist/hooks/use-list-table.d.ts +2 -1
  121. package/dist/hooks/use-list-table.js +3 -9
  122. package/dist/hooks/use-list-url-state.d.ts +2 -0
  123. package/dist/hooks/use-list-url-state.js +12 -4
  124. package/dist/hooks/use-list-view-state.js +23 -3
  125. package/dist/hooks/use-reference-lookup.js +7 -2
  126. package/dist/hooks/use-remembered-list-params.d.ts +6 -2
  127. package/dist/hooks/use-remembered-list-params.js +18 -3
  128. package/dist/hooks/use-store.js +0 -1
  129. package/dist/i18n-defaults.js +37 -2
  130. package/dist/index.d.ts +7 -2
  131. package/dist/index.js +4 -1
  132. package/dist/live/dispatcher-live.js +2 -0
  133. package/dist/metric-types.d.ts +2 -0
  134. package/dist/primitives-record-guidance.d.ts +53 -0
  135. package/dist/primitives-record-guidance.js +1 -0
  136. package/dist/primitives.d.ts +41 -31
  137. package/dist/server-clock.d.ts +6 -0
  138. package/dist/server-clock.js +20 -0
  139. package/dist/session/session-ended.d.ts +1 -0
  140. package/dist/session/session-ended.js +2 -2
  141. package/dist/status-tone.d.ts +1 -0
  142. package/dist/status-tone.js +5 -0
  143. package/dist/web/app/browser-locale.js +1 -1
  144. package/dist/web/app/client-plugin.d.ts +6 -1
  145. package/dist/web/app/create-app.d.ts +2 -1
  146. package/dist/web/app/create-app.js +15 -5
  147. package/dist/web/app/dashboard-body.js +25 -11
  148. package/dist/web/app/dashboard-header.d.ts +2 -1
  149. package/dist/web/app/dashboard-header.js +19 -7
  150. package/dist/web/app/dashboard-list-panel.d.ts +12 -0
  151. package/dist/web/app/dashboard-list-panel.js +149 -0
  152. package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
  153. package/dist/web/app/dashboard-narrow-gate.js +6 -0
  154. package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
  155. package/dist/web/app/dashboard-narrow-order.js +6 -0
  156. package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
  157. package/dist/web/app/dashboard-navigation-link.js +21 -0
  158. package/dist/web/app/dashboard-panels.d.ts +6 -23
  159. package/dist/web/app/dashboard-panels.js +53 -123
  160. package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
  161. package/dist/web/app/dashboard-reference-list-table.js +12 -4
  162. package/dist/web/app/dashboard-shared.d.ts +23 -7
  163. package/dist/web/app/dashboard-shared.js +44 -17
  164. package/dist/web/app/dashboard-stat-group-panel.d.ts +13 -0
  165. package/dist/web/app/dashboard-stat-group-panel.js +67 -0
  166. package/dist/web/app/dashboard-text-panel.d.ts +12 -0
  167. package/dist/web/app/dashboard-text-panel.js +163 -0
  168. package/dist/web/app/dashboard-text.d.ts +2 -0
  169. package/dist/web/app/dashboard-text.js +1 -1
  170. package/dist/web/app/dashboard-visibility.js +1 -1
  171. package/dist/web/app/relative-time.js +2 -1
  172. package/dist/web/editor/editor-footer.d.ts +28 -0
  173. package/dist/web/editor/editor-footer.js +23 -0
  174. package/dist/web/editor/editor-frame.d.ts +23 -0
  175. package/dist/web/editor/editor-frame.js +24 -0
  176. package/dist/web/editor/editor-header.d.ts +36 -0
  177. package/dist/web/editor/editor-header.js +30 -0
  178. package/dist/web/editor/editor-rail.d.ts +32 -0
  179. package/dist/web/editor/editor-rail.js +37 -0
  180. package/dist/web/editor/editor-workbench.d.ts +34 -0
  181. package/dist/web/editor/editor-workbench.js +19 -0
  182. package/dist/web/editor/index.d.ts +6 -0
  183. package/dist/web/editor/index.js +6 -0
  184. package/dist/web/editor/relative-when.d.ts +1 -0
  185. package/dist/web/editor/relative-when.js +18 -0
  186. package/dist/web/index.d.ts +7 -1
  187. package/dist/web/index.js +5 -1
  188. package/dist/web/layout/default-app-shell.js +6 -4
  189. package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
  190. package/dist/web/layout/focus-aware-sidebar.js +5 -7
  191. package/dist/web/layout/header-action-pinned.d.ts +8 -0
  192. package/dist/web/layout/header-action-pinned.js +25 -0
  193. package/dist/web/layout/nav-collapse-state.d.ts +5 -0
  194. package/dist/web/layout/nav-collapse-state.js +66 -0
  195. package/dist/web/layout/nav-tree.js +25 -5
  196. package/dist/web/layout/page-header-slot.d.ts +2 -0
  197. package/dist/web/layout/page-header-slot.js +4 -0
  198. package/dist/web/layout/screen-focus.d.ts +8 -0
  199. package/dist/web/layout/screen-focus.js +42 -0
  200. package/dist/web/layout/shell-focus.d.ts +6 -5
  201. package/dist/web/layout/shell-focus.js +12 -9
  202. package/dist/web/layout/shell-header.js +38 -10
  203. package/dist/web/layout/sidebar-open-state.d.ts +6 -0
  204. package/dist/web/layout/sidebar-open-state.js +28 -0
  205. package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
  206. package/dist/web/layout/uniform-bar-controls.js +4 -3
  207. package/dist/web/layout/use-in-app-inbox.js +8 -1
  208. package/dist/web/layout/workspace-shell.js +6 -4
  209. package/dist/web/lib/upload-file-ref.d.ts +2 -2
  210. package/dist/web/lib/upload-file-ref.js +4 -9
  211. package/dist/web/presence/use-presence.js +7 -2
  212. package/dist/web/primitives/banner.d.ts +1 -1
  213. package/dist/web/primitives/banner.js +14 -6
  214. package/dist/web/primitives/calendar-day-picker.js +24 -5
  215. package/dist/web/primitives/card.js +1 -1
  216. package/dist/web/primitives/code-input.js +6 -1
  217. package/dist/web/primitives/data-table/actions-column.d.ts +1 -0
  218. package/dist/web/primitives/data-table/actions-column.js +4 -2
  219. package/dist/web/primitives/data-table/card-body.d.ts +5 -0
  220. package/dist/web/primitives/data-table/card-body.js +47 -5
  221. package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
  222. package/dist/web/primitives/data-table/card-frame.js +9 -0
  223. package/dist/web/primitives/data-table/card-row.js +40 -7
  224. package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
  225. package/dist/web/primitives/data-table/card-sort-select.js +10 -7
  226. package/dist/web/primitives/data-table/card-view.js +12 -2
  227. package/dist/web/primitives/data-table/column-picker-section.js +9 -2
  228. package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
  229. package/dist/web/primitives/data-table/column-role.d.ts +1 -0
  230. package/dist/web/primitives/data-table/column-role.js +1 -0
  231. package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
  232. package/dist/web/primitives/data-table/data-cell-props.js +5 -0
  233. package/dist/web/primitives/data-table/density.js +1 -0
  234. package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
  235. package/dist/web/primitives/data-table/facet-cluster.js +2 -2
  236. package/dist/web/primitives/data-table/group-band.js +4 -0
  237. package/dist/web/primitives/data-table/hint-cell.d.ts +16 -0
  238. package/dist/web/primitives/data-table/hint-cell.js +74 -0
  239. package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
  240. package/dist/web/primitives/data-table/hint-column-width.js +11 -0
  241. package/dist/web/primitives/data-table/measure-value.js +2 -3
  242. package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
  243. package/dist/web/primitives/data-table/row-action-column.js +4 -0
  244. package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
  245. package/dist/web/primitives/data-table/sort-options-select.js +46 -0
  246. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  247. package/dist/web/primitives/data-table/sortable-header.js +5 -3
  248. package/dist/web/primitives/data-table/table-body.d.ts +1 -1
  249. package/dist/web/primitives/data-table/table-body.js +5 -3
  250. package/dist/web/primitives/data-table/table-chrome.js +3 -1
  251. package/dist/web/primitives/data-table/table-content.js +10 -5
  252. package/dist/web/primitives/data-table/table-data-cell.js +9 -3
  253. package/dist/web/primitives/data-table/table-header-row.js +5 -2
  254. package/dist/web/primitives/data-table/table-view.js +17 -3
  255. package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
  256. package/dist/web/primitives/data-table/toolbar.js +31 -3
  257. package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
  258. package/dist/web/primitives/data-table/totals-footer.js +40 -9
  259. package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
  260. package/dist/web/primitives/data-table/use-column-pins.js +4 -0
  261. package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
  262. package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
  263. package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
  264. package/dist/web/primitives/data-table/use-row-selection.js +22 -11
  265. package/dist/web/primitives/data-table/view-menu.js +7 -1
  266. package/dist/web/primitives/data-table-cell.d.ts +21 -2
  267. package/dist/web/primitives/data-table-cell.js +96 -19
  268. package/dist/web/primitives/embedded-file-cell.js +3 -2
  269. package/dist/web/primitives/embedded-list-cards.js +3 -4
  270. package/dist/web/primitives/facet-filter.d.ts +4 -2
  271. package/dist/web/primitives/facet-filter.js +26 -3
  272. package/dist/web/primitives/facet-search-filter.js +1 -1
  273. package/dist/web/primitives/file-thumbnail.d.ts +6 -2
  274. package/dist/web/primitives/file-thumbnail.js +13 -6
  275. package/dist/web/primitives/file-upload.js +3 -2
  276. package/dist/web/primitives/file-view-action.d.ts +6 -0
  277. package/dist/web/primitives/file-view-action.js +19 -0
  278. package/dist/web/primitives/files-dropzone.js +20 -9
  279. package/dist/web/primitives/form-footer-parts.d.ts +0 -1
  280. package/dist/web/primitives/form.js +0 -1
  281. package/dist/web/primitives/hint-reason-row.d.ts +32 -0
  282. package/dist/web/primitives/hint-reason-row.js +45 -0
  283. package/dist/web/primitives/index.js +6 -0
  284. package/dist/web/primitives/layout-elements.d.ts +1 -1
  285. package/dist/web/primitives/layout-elements.js +2 -2
  286. package/dist/web/primitives/metric.js +8 -6
  287. package/dist/web/primitives/page-header.d.ts +1 -1
  288. package/dist/web/primitives/page-header.js +8 -1
  289. package/dist/web/primitives/pager.js +29 -18
  290. package/dist/web/primitives/reason-box.d.ts +20 -0
  291. package/dist/web/primitives/reason-box.js +13 -0
  292. package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
  293. package/dist/web/primitives/record-breadcrumb.js +11 -0
  294. package/dist/web/primitives/record-steps.d.ts +3 -0
  295. package/dist/web/primitives/record-steps.js +45 -0
  296. package/dist/web/primitives/record-summary.d.ts +3 -0
  297. package/dist/web/primitives/record-summary.js +18 -0
  298. package/dist/web/primitives/row-actions.d.ts +3 -1
  299. package/dist/web/primitives/row-actions.js +14 -5
  300. package/dist/web/primitives/segmented-select.js +5 -7
  301. package/dist/web/pwa/pwa-support.d.ts +4 -0
  302. package/dist/web/pwa/pwa-support.js +113 -0
  303. package/dist/web/sse/live-events.js +2 -2
  304. package/dist/web/tokens.js +0 -3
  305. package/dist/web/widgets/chart-parts.d.ts +7 -1
  306. package/dist/web/widgets/chart-parts.js +10 -4
  307. package/dist/web/widgets/collapsible-section.js +1 -1
  308. package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
  309. package/dist/web/widgets/dashboard-list-cards.js +54 -0
  310. package/dist/web/widgets/dashboard-list.d.ts +37 -5
  311. package/dist/web/widgets/dashboard-list.js +95 -20
  312. package/dist/web/widgets/drawer-sizing.js +1 -1
  313. package/dist/web/widgets/floating-panel.js +4 -2
  314. package/dist/web/widgets/index.d.ts +2 -0
  315. package/dist/web/widgets/index.js +2 -0
  316. package/dist/web/widgets/infinity-list.js +18 -11
  317. package/dist/web/widgets/preview-width-frame.d.ts +7 -0
  318. package/dist/web/widgets/preview-width-frame.js +10 -0
  319. package/dist/web/widgets/section-card.d.ts +1 -1
  320. package/dist/web/widgets/stacked-area-chrome.js +3 -3
  321. package/dist/web/widgets/stacked-area-tooltip.js +2 -10
  322. package/dist/web/widgets/stat-box-cell.d.ts +19 -0
  323. package/dist/web/widgets/stat-box-cell.js +10 -0
  324. package/dist/web/widgets/stat.d.ts +10 -1
  325. package/dist/web/widgets/stat.js +14 -5
  326. package/dist/web/widgets/status-badge.d.ts +7 -5
  327. package/dist/web/widgets/status-badge.js +2 -2
  328. package/dist/web/widgets/step-bar.d.ts +1 -1
  329. package/dist/web/widgets/step-bar.js +37 -7
  330. package/dist/web/widgets/upload-zone.d.ts +8 -1
  331. package/dist/web/widgets/upload-zone.js +13 -3
  332. package/package.json +5 -5
  333. package/src/changes.json +217 -0
  334. package/src/web/styles.css +9 -0
@@ -0,0 +1,42 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { lastSegment, useNav, useTranslation } from "../../index.js";
3
+ import { ActionOverflowMenu } from "../primitives/row-actions.js";
4
+ import { useIsNarrowViewport } from "../primitives/use-narrow-viewport.js";
5
+ import { MobileTopBar } from "../widgets/mobile-top-bar.js";
6
+ import { usePageHeaderSlot } from "./page-header-slot.js";
7
+ import { resolveParentScreenId, screenTitleKey } from "./shell-breadcrumb.js";
8
+ import { useShellFocused, useShellFocusMode, useShellTopbarActions } from "./shell-focus.js";
9
+ function wantsShellFocus(screen) {
10
+ return ((screen.type === "projectionDetail" || screen.type === "entityEdit") && screen.focus === true);
11
+ }
12
+ function FocusedScreenFrame({ screen, screens, children, }) {
13
+ useShellFocusMode();
14
+ const focused = useShellFocused();
15
+ const nav = useNav();
16
+ const t = useTranslation();
17
+ const slot = usePageHeaderSlot();
18
+ const shortId = lastSegment(screen.id);
19
+ const parentScreenId = resolveParentScreenId(screens, shortId);
20
+ const shellTopbarActions = useShellTopbarActions();
21
+ // The bar is CSS-hidden on wide viewports, where the focused shell deliberately drops the
22
+ // app actions; mounting them there would leave hidden duplicates (same test ids) in the DOM.
23
+ const topbarActions = useIsNarrowViewport() ? shellTopbarActions : undefined;
24
+ const overflowItems = slot?.overflowItems ?? [];
25
+ const hasActions = topbarActions !== undefined || overflowItems.length > 0;
26
+ return (_jsxs(_Fragment, { children: [focused && (_jsx(MobileTopBar, { label: parentScreenId !== undefined
27
+ ? t(screenTitleKey(parentScreenId))
28
+ : (slot?.recordTitle ?? slot?.title ?? t(screenTitleKey(shortId))), back: {
29
+ label: t("kumiko.actions.back"),
30
+ onClick: () => parentScreenId !== undefined
31
+ ? nav.navigate({ screenId: parentScreenId })
32
+ : window.history.back(),
33
+ }, ...(hasActions && {
34
+ actions: (_jsxs(_Fragment, { children: [topbarActions, overflowItems.length > 0 && (_jsx(ActionOverflowMenu, { items: overflowItems, label: t("kumiko.page-header.actions"), testId: "mobile-top-bar-actions" }))] })),
35
+ }) })), children] }));
36
+ }
37
+ /** Applies a screen's declarative `focus`: focused shell chrome on desktop, a MobileTopBar on phones. */
38
+ export function ScreenFocus({ screen, screens, children, }) {
39
+ if (!wantsShellFocus(screen))
40
+ return children;
41
+ return (_jsx(FocusedScreenFrame, { screen: screen, screens: screens, children: children }));
42
+ }
@@ -1,19 +1,20 @@
1
+ import { type ReactNode } from "react";
1
2
  type ShellFocusContextValue = {
2
3
  readonly focused: boolean;
3
4
  readonly register: () => () => void;
5
+ readonly topbarActions?: ReactNode;
4
6
  };
5
7
  export declare const ShellFocusProvider: import("react").Provider<ShellFocusContextValue | null>;
6
8
  export type ShellFocusHost = {
7
9
  readonly focused: boolean;
8
- /** Rail expansion while focused; kept apart from the user's own sidebar state so leaving restores it. */
9
- readonly railOpen: boolean;
10
- readonly setRailOpen: (open: boolean) => void;
11
10
  readonly value: ShellFocusContextValue;
12
11
  };
13
- /** Shell side: holds the focus counter and the temporary rail state. */
14
- export declare function useShellFocusHost(): ShellFocusHost;
12
+ /** Shell side: holds the focus counter. */
13
+ export declare function useShellFocusHost(topbarActions?: ReactNode): ShellFocusHost;
15
14
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
16
15
  export declare function useShellFocused(): boolean;
16
+ /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
17
+ export declare function useShellTopbarActions(): ReactNode | undefined;
17
18
  /** Screen side: call while the screen is mounted to get the focused shell. No-op without a DefaultAppShell. */
18
19
  export declare function useShellFocusMode(): void;
19
20
  export {};
@@ -1,28 +1,31 @@
1
- // Per-screen focused shell: while a screen holds focus mode, DefaultAppShell shows the
2
- // collapsed icon rail and ShellHeader reduces itself to the screen's own PageHeader content.
1
+ // Per-screen focused shell: while a screen holds focus mode, ShellHeader reduces itself to the
2
+ // screen's own PageHeader content and a collapsed sidebar shows the focus rail. The sidebar's
3
+ // expanded state is never changed by focus mode; only the user's own clicks change it.
3
4
  //
4
5
  // Why register/unregister instead of a prop: the shell sits above every screen and cannot
5
6
  // know which one wants the focused chrome; the screen opts in by mounting the hook.
6
- import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useState } from "react";
7
+ import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useState, } from "react";
7
8
  const ShellFocusContext = createContext(null);
8
9
  export const ShellFocusProvider = ShellFocusContext.Provider;
9
- /** Shell side: holds the focus counter and the temporary rail state. */
10
- export function useShellFocusHost() {
10
+ /** Shell side: holds the focus counter. */
11
+ export function useShellFocusHost(topbarActions) {
11
12
  const [holders, setHolders] = useState(0);
12
- const [railOpen, setRailOpen] = useState(false);
13
13
  const register = useCallback(() => {
14
- setRailOpen(false);
15
14
  setHolders((count) => count + 1);
16
15
  return () => setHolders((count) => count - 1);
17
16
  }, []);
18
17
  const focused = holders > 0;
19
- const value = useMemo(() => ({ focused, register }), [focused, register]);
20
- return { focused, railOpen, setRailOpen, value };
18
+ const value = useMemo(() => ({ focused, register, topbarActions }), [focused, register, topbarActions]);
19
+ return { focused, value };
21
20
  }
22
21
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
23
22
  export function useShellFocused() {
24
23
  return useContext(ShellFocusContext)?.focused ?? false;
25
24
  }
25
+ /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
26
+ export function useShellTopbarActions() {
27
+ return useContext(ShellFocusContext)?.topbarActions;
28
+ }
26
29
  /** Screen side: call while the screen is mounted to get the focused shell. No-op without a DefaultAppShell. */
27
30
  export function useShellFocusMode() {
28
31
  const register = useContext(ShellFocusContext)?.register;
@@ -8,7 +8,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
8
8
  // in styles.css (:has() selector) — the single source for the header height
9
9
  // that Drawer's `belowHeader` prop also reads.
10
10
  import { IN_APP_NOTIFICATION_FEATURE } from "@cosmicdrift/kumiko-types/in-app-notification-types";
11
- import { MoreHorizontal } from "lucide-react";
11
+ import { ChevronLeft, MoreHorizontal } from "lucide-react";
12
12
  import { Fragment, useEffect, useId, useMemo, useRef, useState, } from "react";
13
13
  import { resolveNavigation } from "../../headless/index.js";
14
14
  import { toAppSchema, useNav, usePageHeaderCompact, useTranslation, } from "../../index.js";
@@ -16,6 +16,7 @@ import { Icon, NAV_ICONS } from "../icons.js";
16
16
  import { cn } from "../lib/cn.js";
17
17
  import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "../ui/breadcrumb.js";
18
18
  import { SidebarTrigger } from "../ui/sidebar.js";
19
+ import { collectPinnedHeaderActions, isOnlyPinnedHeaderActions } from "./header-action-pinned.js";
19
20
  import { HeaderOverflowMenuContext, headerOverflowMenuItemClass } from "./header-overflow-menu.js";
20
21
  import { buildNavRegistrySliceForApp } from "./nav-tree.js";
21
22
  import { NotificationBell } from "./notification-bell.js";
@@ -27,7 +28,10 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
27
28
  const nav = useNav();
28
29
  const t = useTranslation();
29
30
  const focused = useShellFocused();
30
- const headerActions = focused ? undefined : appHeaderActions;
31
+ // The app's headerActions (the assistant button) stay in focus mode: they are not navigation,
32
+ // and a focused screen must not cut the user off from them. The sidebar trigger and the
33
+ // notification bell are rendered by this header itself, not passed in, and stay hidden.
34
+ const headerActions = appHeaderActions;
31
35
  const appSchema = toAppSchema(schema);
32
36
  const tree = useMemo(() => {
33
37
  const source = buildNavRegistrySliceForApp(appSchema);
@@ -69,22 +73,46 @@ export function ShellHeader({ schema, user, headerActions: appHeaderActions, all
69
73
  const recordTitle = slot?.recordTitle;
70
74
  const compact = usePageHeaderCompact();
71
75
  const overflowItems = slot?.overflowItems ?? [];
72
- const hasOverflow = compact && (overflowItems.length > 0 || headerActions !== undefined);
76
+ // On a phone the app's headerActions fold into the menu, except the ones wrapped in HeaderActionPinned.
77
+ const pinnedActions = compact ? collectPinnedHeaderActions(headerActions) : [];
78
+ const hasOverflow = compact &&
79
+ (overflowItems.length > 0 ||
80
+ (headerActions !== undefined && !isOnlyPinnedHeaderActions(headerActions)));
73
81
  // A stand-in without a translated title must not surface the raw i18n key.
74
82
  const standInUntitled = standInScreenId !== undefined && crumbs?.at(-1)?.label === screenTitleKey(standInScreenId);
75
- const shownCrumbs = (slot?.breadcrumbHidden === true && standInScreenId === undefined) || standInUntitled
83
+ const bodyTitle = slot?.bodyTitle === true;
84
+ const baseCrumbs = (slot?.breadcrumbHidden === true && standInScreenId === undefined) || standInUntitled
76
85
  ? undefined
77
- : crumbs !== undefined && recordTitle !== undefined && crumbs.length > 0
78
- ? [...crumbs.slice(0, -1), { label: recordTitle }, ...crumbs.slice(-1)]
79
- : crumbs;
86
+ : crumbs;
87
+ const visibleCrumbs = baseCrumbs !== undefined && recordTitle !== undefined && baseCrumbs.length > 0
88
+ ? [...baseCrumbs.slice(0, -1), { label: recordTitle }, ...baseCrumbs.slice(-1)]
89
+ : baseCrumbs;
90
+ // The screen's own title block is the h1, so the bar names the list the record belongs to. It is
91
+ // picked from the nav crumbs, not from visibleCrumbs: a record title inserted there must not
92
+ // take the parent's place.
93
+ // Phone: only "‹ parent", never the screen's own title (the body shows it). Desktop: "parent › record title".
94
+ // A screen that draws its own breadcrumb hides the bar's crumbs, but its parent link stays.
95
+ const titleCrumbs = standInUntitled ? undefined : crumbs;
96
+ const parentCrumb = titleCrumbs !== undefined && titleCrumbs.length > 1 ? titleCrumbs.at(-2) : undefined;
97
+ const parentOnly = bodyTitle && compact && parentCrumb !== undefined;
98
+ const bodyTitleCrumbs = () => {
99
+ if (compact)
100
+ return parentCrumb === undefined ? [] : [parentCrumb];
101
+ const ownTitle = recordTitle ?? titleCrumbs?.at(-1)?.label;
102
+ return [
103
+ ...(parentCrumb === undefined ? [] : [parentCrumb]),
104
+ ...(ownTitle === undefined ? [] : [{ label: ownTitle }]),
105
+ ];
106
+ };
107
+ const shownCrumbs = bodyTitle ? bodyTitleCrumbs() : visibleCrumbs;
80
108
  return (_jsxs("header", { "data-kumiko-layout": "shell-header", className: cn("flex h-14 shrink-0 items-center gap-3 border-b border-border pl-1.5 pr-3 md:pl-4 md:pr-6", compact && "relative", focused && "max-md:hidden"), children: [_jsxs("div", { className: "@container flex min-w-0 flex-1 items-center gap-3", children: [!focused && _jsx(SidebarTrigger, { label: t("kumiko.sidebar.toggle") }), _jsxs("div", { className: cn("flex min-w-0", compact ? "flex-col justify-center" : "items-center gap-3"), children: [shownCrumbs !== undefined && shownCrumbs.length > 0 && (_jsx(Breadcrumb, { className: "min-w-0", "aria-label": t("kumiko.breadcrumb.label"), children: _jsx(BreadcrumbList, { className: "flex-nowrap gap-1.5 sm:gap-1.5", children: shownCrumbs.map((crumb, index) => {
81
109
  const screenId = crumb.screenId;
82
110
  const isLast = index === shownCrumbs.length - 1;
83
- return (_jsxs(Fragment, { children: [index > 0 && (_jsx(BreadcrumbSeparator, { className: "hidden text-muted-foreground @xs:inline-flex [&>svg]:size-3.5" })), _jsx(BreadcrumbItem, { className: cn(isLast ? "min-w-0" : "hidden shrink-0 @xs:inline-flex"), children: screenId !== undefined && !isLast ? (_jsx(BreadcrumbLink, { href: "#", className: "whitespace-nowrap text-foreground-secondary", onClick: (e) => {
111
+ return (_jsxs(Fragment, { children: [index > 0 && (_jsx(BreadcrumbSeparator, { className: "hidden text-muted-foreground @xs:inline-flex [&>svg]:size-3.5" })), _jsx(BreadcrumbItem, { className: cn(isLast ? "min-w-0" : "hidden shrink-0 @xs:inline-flex"), children: screenId !== undefined && (!isLast || parentOnly) ? (_jsxs(BreadcrumbLink, { href: "#", className: "whitespace-nowrap text-foreground-secondary", onClick: (e) => {
84
112
  e.preventDefault();
85
113
  nav.navigate({ screenId });
86
- }, children: crumb.label })) : isLast ? (_jsx("h1", { "aria-current": "page", title: titleOverride ?? crumb.label, className: "truncate text-lg font-semibold text-foreground", children: titleOverride ?? crumb.label })) : (_jsx(BreadcrumbPage, { className: "whitespace-nowrap text-foreground-secondary", children: crumb.label })) })] }, screenId ?? crumb.label));
87
- }) }) })), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [_jsx("div", { ref: setActionsElement, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), !focused && user !== undefined && hasInAppChannel && (_jsx(NotificationBell, { screens: allScreens })), !compact && headerActions !== undefined && (_jsx("div", { "data-kumiko-layout": "header-actions", className: "flex items-center gap-2", children: headerActions })), hasOverflow && _jsx(HeaderOverflow, { items: overflowItems, headerActions: headerActions })] })] }));
114
+ }, children: [parentOnly && (_jsx(ChevronLeft, { className: "me-0.5 inline size-4 align-text-bottom", "aria-hidden": "true" })), crumb.label] })) : isLast && bodyTitle ? (_jsx("span", { className: "truncate text-lg font-semibold text-foreground", children: crumb.label })) : isLast ? (_jsx("h1", { "aria-current": "page", title: titleOverride ?? crumb.label, className: "truncate text-lg font-semibold text-foreground", children: titleOverride ?? crumb.label })) : (_jsx(BreadcrumbPage, { className: "whitespace-nowrap text-foreground-secondary", children: crumb.label })) })] }, screenId ?? crumb.label));
115
+ }) }) })), _jsx("div", { ref: setStatusElement, "data-kumiko-layout": "page-header-status", className: cn("flex items-center gap-2 empty:hidden", compact ? "min-w-0 max-w-full overflow-hidden whitespace-nowrap text-xs" : "shrink-0") })] })] }), _jsxs("div", { className: cn("ml-auto flex items-center gap-2", compact ? "min-w-0 max-w-[60%]" : "min-w-0 max-w-[50%] shrink-0 sm:max-w-none"), children: [_jsx("div", { ref: setActionsElement, "data-kumiko-layout": "page-header-actions", className: cn(SHELL_HEADER_CONTROLS_CLASSES, "flex min-w-0 items-center gap-2 empty:hidden [&_*]:min-w-0 [&_*]:max-w-full [&_button]:overflow-hidden [&_button]:whitespace-nowrap", compact && "overflow-hidden") }), !focused && user !== undefined && hasInAppChannel && (_jsx(NotificationBell, { screens: allScreens })), !compact && headerActions !== undefined && (_jsx("div", { "data-kumiko-layout": "header-actions", className: "flex items-center gap-2", children: headerActions })), pinnedActions.length > 0 && (_jsx("div", { "data-kumiko-layout": "header-actions-pinned", className: "flex items-center gap-2", children: pinnedActions })), hasOverflow && _jsx(HeaderOverflow, { items: overflowItems, headerActions: headerActions })] })] }));
88
116
  }
89
117
  // A hand-rolled menu instead of Radix DropdownMenu: app headerActions are opaque
90
118
  // nodes with their own popovers, and the panel stays mounted while closed so their
@@ -0,0 +1,6 @@
1
+ export type PersistedSidebarOpen = {
2
+ readonly open: boolean;
3
+ readonly setOpen: (open: boolean) => void;
4
+ };
5
+ /** The sidebar's expanded state, changed only by user actions and kept across screens and reloads. */
6
+ export declare function usePersistedSidebarOpen(): PersistedSidebarOpen;
@@ -0,0 +1,28 @@
1
+ import { useCallback, useState } from "react";
2
+ const STORAGE_KEY = "kumiko.sidebar.open";
3
+ // Expanded unless the user collapsed it; storage failures (privacy mode, SSR) fall back to expanded.
4
+ function readStoredOpen() {
5
+ try {
6
+ return window.localStorage.getItem(STORAGE_KEY) !== "false";
7
+ }
8
+ catch {
9
+ return true;
10
+ }
11
+ }
12
+ function writeStoredOpen(open) {
13
+ try {
14
+ window.localStorage.setItem(STORAGE_KEY, String(open));
15
+ }
16
+ catch {
17
+ // storage unavailable: the choice just stops surviving a reload
18
+ }
19
+ }
20
+ /** The sidebar's expanded state, changed only by user actions and kept across screens and reloads. */
21
+ export function usePersistedSidebarOpen() {
22
+ const [open, setOpenState] = useState(readStoredOpen);
23
+ const setOpen = useCallback((next) => {
24
+ setOpenState(next);
25
+ writeStoredOpen(next);
26
+ }, []);
27
+ return { open, setOpen };
28
+ }
@@ -1,2 +1,2 @@
1
- export declare const UNIFORM_BAR_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-9 [&_[data-slot=input]]:h-9";
2
- export declare const SHELL_HEADER_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-8 [&_[data-slot=input]]:h-8";
1
+ export declare const UNIFORM_BAR_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-9 [&_[data-slot=input]]:h-9 max-md:[&_[data-slot=button]:not([data-size^=icon])]:h-11 max-md:[&_[data-slot=input]]:h-11";
2
+ export declare const SHELL_HEADER_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-8 [&_[data-slot=input]]:h-8 max-md:[&_[data-slot=button]:not([data-size^=icon])]:h-11 max-md:[&_[data-slot=input]]:h-11";
@@ -1,7 +1,8 @@
1
1
  // Header and toolbar controls share one height whatever size a screen, app or
2
2
  // primitive asked for: the descendant selector outranks the button's own
3
- // size utilities. Icon-only buttons keep their square size.
4
- export const UNIFORM_BAR_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-9 [&_[data-slot=input]]:h-9";
3
+ // size utilities. Icon-only buttons keep their square size. The max-md variants have
4
+ // the same specificity and come later, so phones keep the 44 px touch height.
5
+ export const UNIFORM_BAR_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-9 [&_[data-slot=input]]:h-9 max-md:[&_[data-slot=button]:not([data-size^=icon])]:h-11 max-md:[&_[data-slot=input]]:h-11";
5
6
  // The shell header's own controls (workspace and tenant switcher, language, theme) are h-8,
6
7
  // so screen actions portalled next to them get h-8 too instead of the toolbar's h-9.
7
- export const SHELL_HEADER_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-8 [&_[data-slot=input]]:h-8";
8
+ export const SHELL_HEADER_CONTROLS_CLASSES = "[&_[data-slot=button]:not([data-size^=icon])]:h-8 [&_[data-slot=input]]:h-8 max-md:[&_[data-slot=button]:not([data-size^=icon])]:h-11 max-md:[&_[data-slot=input]]:h-11";
@@ -1,5 +1,5 @@
1
1
  import { IN_APP_NOTIFICATION_DELIVERED_EVENT, IN_APP_NOTIFICATION_QUERIES, IN_APP_NOTIFICATION_WRITES, } from "@cosmicdrift/kumiko-types/in-app-notification-types";
2
- import { useCallback, useEffect, useState } from "react";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { useDispatcher } from "../../context/dispatcher-context.js";
4
4
  import { useMutation } from "../../hooks/use-mutation.js";
5
5
  import { useQuery } from "../../hooks/use-query.js";
@@ -18,7 +18,10 @@ export function useInAppInbox(open) {
18
18
  const markAllReadWrite = useMutation(IN_APP_NOTIFICATION_WRITES.markAllRead);
19
19
  const refetchCount = count.refetch;
20
20
  const refetchFirstPage = firstPage.refetch;
21
+ // Bumped by every refetch so a loadMore started before it cannot append stale rows afterwards.
22
+ const generation = useRef(0);
21
23
  const refetchAll = useCallback(async () => {
24
+ generation.current += 1;
22
25
  setOlderRows([]);
23
26
  setOlderCursor(undefined);
24
27
  await Promise.all([refetchCount(), open ? refetchFirstPage() : Promise.resolve()]);
@@ -30,6 +33,7 @@ export function useInAppInbox(open) {
30
33
  // skip: no older page left
31
34
  if (nextCursor === null)
32
35
  return;
36
+ const startedAt = generation.current;
33
37
  const result = await dispatcher.query(IN_APP_NOTIFICATION_QUERIES.inbox, {
34
38
  limit: IN_APP_INBOX_PAGE_SIZE,
35
39
  cursor: nextCursor,
@@ -37,6 +41,9 @@ export function useInAppInbox(open) {
37
41
  // skip: keep the loaded rows, the next click retries
38
42
  if (!result.isSuccess)
39
43
  return;
44
+ // skip: a refetch reset the list while this page was in flight
45
+ if (generation.current !== startedAt)
46
+ return;
40
47
  setOlderRows((previous) => [...previous, ...result.data.rows]);
41
48
  setOlderCursor(result.data.nextCursor);
42
49
  }, [dispatcher, nextCursor]);
@@ -31,16 +31,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
31
  // rule that NavDefinition.access follows)
32
32
  import { isUiAccessGranted } from "@cosmicdrift/kumiko-framework/ui-types";
33
33
  import { useCallback, useLayoutEffect, useMemo } from "react";
34
- import { qualifyNavId, toAppSchema, UserRolesProvider, useNav, useTranslation, } from "../../index.js";
34
+ import { qualifyNavId, ScreenFocusProvider, toAppSchema, UserRolesProvider, useNav, useTranslation, } from "../../index.js";
35
35
  import { useResolvers } from "../app/resolvers-context.js";
36
36
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInset, SidebarProvider, SidebarRail, } from "../ui/sidebar.js";
37
37
  import { EditorPanel } from "./editor-panel.js";
38
38
  import { fillClasses } from "./fill-classes.js";
39
- import { FocusAwareSidebarBody, focusSidebarProviderProps } from "./focus-aware-sidebar.js";
39
+ import { FocusAwareSidebarBody, sidebarProviderProps } from "./focus-aware-sidebar.js";
40
40
  import { lastSegment, NavTree } from "./nav-tree.js";
41
41
  import { PageHeaderSlotProvider } from "./page-header-slot.js";
42
42
  import { ShellFocusProvider, useShellFocusHost } from "./shell-focus.js";
43
43
  import { ShellHeader } from "./shell-header.js";
44
+ import { usePersistedSidebarOpen } from "./sidebar-open-state.js";
44
45
  import { SidebarPanelProvider, useSidebarPanelHost } from "./sidebar-panel.js";
45
46
  import { parseTargetFromSearchParams } from "./target-url.js";
46
47
  import { WorkspaceSwitcher } from "./workspace-switcher.js";
@@ -152,8 +153,9 @@ export function WorkspaceShell({ brand, schema, topbarActions, user, initialWork
152
153
  // The second column appears only when a screen fills it (sidebar-09 pattern);
153
154
  // otherwise every other screen would have an empty strip beside the navigation.
154
155
  const panel = useSidebarPanelHost();
155
- const focus = useShellFocusHost();
156
- 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: app, user: user, allowedNavQns: allowedNavQns, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsxs(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: [brand, switcher] }), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: sidebarContent }), 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: app, ...(user !== undefined && { user }), ...(allowedNavQns !== undefined && { allowedNavQns }), ...(topbarActions !== undefined && { headerActions: topbarActions }) }), _jsx("main", { className: fillCls.main, children: activeTarget !== undefined ? (_jsx(EditorPanel, { resolvers: resolvers })) : (_jsx(UserRolesProvider, { roles: user?.roles, children: children })) })] }) })] }) }) }));
156
+ const focus = useShellFocusHost(topbarActions);
157
+ const sidebarOpen = usePersistedSidebarOpen();
158
+ return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), 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: app, user: user, allowedNavQns: allowedNavQns, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsxs(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: [brand, switcher] }), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: sidebarContent }), 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: app, ...(user !== undefined && { user }), ...(allowedNavQns !== undefined && { allowedNavQns }), ...(topbarActions !== undefined && { headerActions: topbarActions }) }), _jsx("main", { className: fillCls.main, children: activeTarget !== undefined ? (_jsx(EditorPanel, { resolvers: resolvers })) : (_jsx(UserRolesProvider, { roles: user?.roles, children: children })) })] }) })] }) }) }) }));
157
159
  }
158
160
  // --- helpers (exported for tests) ---
159
161
  export function filterByAccess(workspaces, userRoles) {
@@ -7,6 +7,6 @@ export declare class FileUploadFailedError extends Error {
7
7
  readonly code?: string | undefined;
8
8
  constructor(message: string, fromServer: boolean, httpStatus?: number | undefined, code?: string | undefined);
9
9
  }
10
- export declare function isSessionEndedUploadError(cause: unknown): boolean;
11
- /** Posts one file to the stack's file endpoint (double-submit CSRF) and returns the new FileRef id. */
10
+ /** Posts one file to the stack's file endpoint (double-submit CSRF) and returns the new FileRef id,
11
+ * or the claim handle when the server issued one (anonymous uploads), which a save must submit. */
12
12
  export declare function uploadFileRef(file: Blob, target?: FileRefTarget): Promise<string>;
@@ -1,6 +1,5 @@
1
1
  import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
2
2
  import { CSRF_HEADER_NAME, readCsrfToken } from "../../live/index.js";
3
- import { isSessionEndedError } from "../../session/session-ended.js";
4
3
  import { buildFileUploadFormData } from "./file-upload-form-data.js";
5
4
  /** Carries the server's own `error` message when the upload endpoint sent one. */
6
5
  export class FileUploadFailedError extends Error {
@@ -14,13 +13,8 @@ export class FileUploadFailedError extends Error {
14
13
  this.code = code;
15
14
  }
16
15
  }
17
- export function isSessionEndedUploadError(cause) {
18
- return (cause instanceof FileUploadFailedError &&
19
- cause.code !== undefined &&
20
- cause.httpStatus !== undefined &&
21
- isSessionEndedError({ code: cause.code, httpStatus: cause.httpStatus }));
22
- }
23
- /** Posts one file to the stack's file endpoint (double-submit CSRF) and returns the new FileRef id. */
16
+ /** Posts one file to the stack's file endpoint (double-submit CSRF) and returns the new FileRef id,
17
+ * or the claim handle when the server issued one (anonymous uploads), which a save must submit. */
24
18
  export async function uploadFileRef(file, target) {
25
19
  const csrf = readCsrfToken();
26
20
  const res = await fetch("/api/files", {
@@ -30,6 +24,7 @@ export async function uploadFileRef(file, target) {
30
24
  });
31
25
  const json = await res.json().catch(() => ({}));
32
26
  const id = propertyOf(json, "id");
27
+ const handle = propertyOf(json, "handle");
33
28
  if (!res.ok || typeof id !== "string") {
34
29
  const message = propertyOf(json, "error");
35
30
  const code = propertyOf(json, "code");
@@ -37,5 +32,5 @@ export async function uploadFileRef(file, target) {
37
32
  ? new FileUploadFailedError(message, true, res.status, typeof code === "string" ? code : undefined)
38
33
  : new FileUploadFailedError(`upload failed (${res.status})`, false, res.status);
39
34
  }
40
- return id;
35
+ return typeof handle === "string" ? handle : id;
41
36
  }
@@ -25,6 +25,7 @@ export function usePresence({ entity, id, activity, focus, enabled = true, }) {
25
25
  return;
26
26
  let stopped = false;
27
27
  let timer;
28
+ let latestRequest = 0;
28
29
  const stop = () => {
29
30
  stopped = true;
30
31
  if (timer !== undefined)
@@ -37,6 +38,7 @@ export function usePresence({ entity, id, activity, focus, enabled = true, }) {
37
38
  return;
38
39
  const current = latest.current;
39
40
  lastSentKey.current = stateKey(current.activity, current.focus);
41
+ const request = ++latestRequest;
40
42
  const result = await dispatcher.write(PRESENCE_WRITES.heartbeat, {
41
43
  entity,
42
44
  id,
@@ -46,8 +48,11 @@ export function usePresence({ entity, id, activity, focus, enabled = true, }) {
46
48
  // skip: the answer belongs to a record that is no longer open
47
49
  if (stopped)
48
50
  return;
49
- if (result.isSuccess)
50
- setOthers(result.data.others);
51
+ // An older answer arriving after a newer one would show a stale roster until the next beat.
52
+ if (result.isSuccess) {
53
+ if (request === latestRequest)
54
+ setOthers(result.data.others);
55
+ }
51
56
  else if (isPermanentPresenceFailure(result.error))
52
57
  stop();
53
58
  };
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { BannerProps } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
- export declare function DefaultBanner({ variant, density, icon, title, titleTestId, children, parts, actions, actionsPlacement, padded, testId, id, }: BannerProps): ReactNode;
4
+ export declare function DefaultBanner({ variant, density, icon, title, titleTestId, children, parts, actions, actionsPlacement, padded, inline, testId, id, }: BannerProps): ReactNode;
@@ -31,11 +31,19 @@ function variantClass(variant, compact) {
31
31
  }
32
32
  }
33
33
  function BannerParts({ parts }) {
34
- return parts?.map((part) => part.strong === true ? (_jsx("strong", { className: "font-semibold", children: part.text }, `strong:${part.text}`)) : (_jsx("span", { children: part.text }, `plain:${part.text}`)));
34
+ // Parts are a static ordered list; the occurrence counter keeps repeated texts (separators) unique.
35
+ const seen = new Map();
36
+ return parts?.map((part) => {
37
+ const base = `${part.strong === true ? "strong" : "plain"}:${part.text}`;
38
+ const occurrence = seen.get(base) ?? 0;
39
+ seen.set(base, occurrence + 1);
40
+ const key = `${base}:${occurrence}`;
41
+ return part.strong === true ? (_jsx("strong", { className: "font-semibold", children: part.text }, key)) : (_jsx("span", { children: part.text }, key));
42
+ });
35
43
  }
36
- function BannerText({ compact, title, titleTestId, children, parts, actionsBelow, }) {
37
- if (compact) {
38
- return (_jsxs("div", { className: "min-w-0 grow", children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), children, _jsx(BannerParts, { parts: parts })] }));
44
+ function BannerText({ compact, title, titleTestId, children, parts, actionsBelow, inline, }) {
45
+ if (compact || inline) {
46
+ return (_jsxs("div", { className: "min-w-0 grow", children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), _jsxs("span", { className: cn(inline && "max-sm:hidden"), children: [children, _jsx(BannerParts, { parts: parts })] })] }));
39
47
  }
40
48
  return (_jsxs("div", { className: "flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children, _jsx(BannerParts, { parts: parts }), actionsBelow] }));
41
49
  }
@@ -47,7 +55,7 @@ function bannerLayoutClass(variant, compact, actionsBelow) {
47
55
  variant === "primary" &&
48
56
  "flex-col items-start sm:flex-row sm:items-center", actionsBelow && "items-start", variantClass(variant, compact));
49
57
  }
50
- export function DefaultBanner({ variant = "info", density = "default", icon, title, titleTestId, children, parts, actions, actionsPlacement = "end", padded, testId, id, }) {
58
+ export function DefaultBanner({ variant = "info", density = "default", icon, title, titleTestId, children, parts, actions, actionsPlacement = "end", padded, inline = false, testId, id, }) {
51
59
  const isError = variant === "error";
52
60
  const compact = density === "compact";
53
61
  // A compact banner is one line, so its actions always stay at the end.
@@ -57,7 +65,7 @@ export function DefaultBanner({ variant = "info", density = "default", icon, tit
57
65
  // at it is inert for screen readers — role="group" + aria-labelledby is
58
66
  // the actual mechanism, pointed at the label id Field emits (fieldLabelId).
59
67
  const bannerRole = id !== undefined ? "group" : isError ? "alert" : undefined;
60
- const banner = (_jsxs("div", { role: bannerRole, ...(id !== undefined && { "aria-labelledby": fieldLabelId(id) }), "data-testid": testId, "data-variant": variant, "data-density": density, className: bannerLayoutClass(variant, compact, actionsBelow), children: [icon !== undefined && (_jsx(Icon, { name: icon, className: cn("size-3.5 shrink-0", ICON_COLOR_CLASS[variant]) })), _jsx(BannerText, { compact: compact, title: title, titleTestId: titleTestId, parts: parts, actionsBelow: actionsBelow ? (_jsx("div", { "data-slot": "actions", className: "mt-3 flex flex-wrap gap-2", children: actions })) : undefined, children: children }), !actionsBelow && actions !== undefined && (_jsx("div", { "data-slot": "actions", className: cn(compact && "shrink-0"), children: actions }))] }));
68
+ const banner = (_jsxs("div", { role: bannerRole, ...(id !== undefined && { "aria-labelledby": fieldLabelId(id) }), "data-testid": testId, "data-variant": variant, "data-density": density, className: bannerLayoutClass(variant, compact, actionsBelow), children: [icon !== undefined && (_jsx(Icon, { name: icon, className: cn("size-3.5 shrink-0", ICON_COLOR_CLASS[variant]) })), _jsx(BannerText, { compact: compact, inline: inline, title: title, titleTestId: titleTestId, parts: parts, actionsBelow: actionsBelow ? (_jsx("div", { "data-slot": "actions", className: "mt-3 flex flex-wrap gap-2", children: actions })) : undefined, children: children }), !actionsBelow && actions !== undefined && (_jsx("div", { "data-slot": "actions", className: cn(compact && "shrink-0"), children: actions }))] }));
61
69
  // Page state: the banner sits alone in main (which no longer has padding).
62
70
  // The wrapper adds 24px outer spacing so the banner does not stick
63
71
  // edge-to-edge to the sidebar/browser.
@@ -1,5 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { DayPicker } from "react-day-picker";
3
+ import { de } from "react-day-picker/locale/de";
4
+ import { enUS } from "react-day-picker/locale/en-US";
5
+ import { es } from "react-day-picker/locale/es";
6
+ import { fr } from "react-day-picker/locale/fr";
7
+ import { it } from "react-day-picker/locale/it";
8
+ import { useLocale } from "../../index.js";
3
9
  import { cn } from "../lib/cn.js";
4
10
  const dropdownSelectClass = "rounded-sm border border-input bg-transparent px-1.5 py-0.5 text-sm font-medium " +
5
11
  "cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
@@ -10,16 +16,28 @@ const dropdownSelectClass = "rounded-sm border border-input bg-transparent px-1.
10
16
  function SelectDropdown({ options, className, ...selectProps }) {
11
17
  return (_jsx("select", { className: cn(dropdownSelectClass, className), ...selectProps, children: options?.map((opt) => (_jsx("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value))) }));
12
18
  }
19
+ const dayPickerLocales = { de, es, fr, it, en: enUS };
20
+ // The rdp locale carries month/weekday names and the week start (de → Monday).
21
+ function dayPickerLocaleFor(appLocale) {
22
+ const language = appLocale.split("-")[0]?.toLowerCase() ?? "";
23
+ return dayPickerLocales[language] ?? enUS;
24
+ }
25
+ const navButtonClass = "inline-flex h-7 w-7 items-center justify-center rounded-sm text-muted-foreground " +
26
+ "hover:bg-accent hover:text-foreground " +
27
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
28
+ // navLayout="around" renders prev/next as siblings of the caption inside
29
+ // `month`; the 3-column grid keeps them beside the dropdowns instead of on top.
13
30
  // Month/year selects come from SelectDropdown (components prop), so only the dropdowns container is styled here.
14
31
  const dayPickerClasses = {
15
32
  root: "rdp-root",
16
33
  months: "flex flex-col gap-2",
17
- month: "flex flex-col gap-2",
34
+ month: "grid grid-cols-[auto_1fr_auto] items-center gap-x-1 gap-y-2",
18
35
  month_caption: "flex justify-center items-center h-7 text-sm font-medium",
36
+ month_grid: "col-span-3",
19
37
  dropdowns: "flex items-center gap-1 text-sm font-medium",
20
- nav: "flex items-center gap-1 absolute right-1 top-2",
21
- button_previous: "inline-flex h-7 w-7 items-center justify-center rounded-sm hover:bg-accent",
22
- button_next: "inline-flex h-7 w-7 items-center justify-center rounded-sm hover:bg-accent",
38
+ chevron: "h-4 w-4 fill-current",
39
+ button_previous: navButtonClass,
40
+ button_next: navButtonClass,
23
41
  weekdays: "flex",
24
42
  weekday: "w-8 text-xs font-normal text-muted-foreground",
25
43
  week: "flex mt-1",
@@ -32,7 +50,8 @@ const dayPickerClasses = {
32
50
  disabled: "text-muted-foreground/30 pointer-events-none",
33
51
  };
34
52
  export default function CalendarDayPicker({ selected, onSelect, startMonth, endMonth, disabledMatchers, }) {
35
- return (_jsx(DayPicker, { mode: "single", captionLayout: "dropdown", startMonth: startMonth, endMonth: endMonth, selected: selected,
53
+ const appLocale = useLocale().locale();
54
+ return (_jsx(DayPicker, { mode: "single", captionLayout: "dropdown", navLayout: "around", locale: dayPickerLocaleFor(appLocale), startMonth: startMonth, endMonth: endMonth, selected: selected,
36
55
  // Without defaultMonth DayPicker opens on today, not on the chosen date.
37
56
  defaultMonth: selected, ...(disabledMatchers.length > 0 && { disabled: [...disabledMatchers] }), onSelect: (d) => onSelect(d), classNames: dayPickerClasses, components: { Dropdown: SelectDropdown } }));
38
57
  }
@@ -19,7 +19,7 @@ export function DefaultCard({ slots, options, className, testId, dataAttributes,
19
19
  const defaultHeader = s.title !== undefined ||
20
20
  s.subtitle !== undefined ||
21
21
  s.headerContent !== undefined ||
22
- s.headerActions !== undefined ? (_jsxs("div", { className: cn("flex flex-col gap-3 px-[var(--card-padding)] pt-6 pb-4", fillHeight && "shrink-0"), children: [(s.title !== undefined || s.subtitle !== undefined || s.headerActions !== undefined) && (_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [s.title !== undefined && (_jsx("h3", { className: "text-base font-semibold leading-none tracking-tight", children: s.title })), s.subtitle !== undefined && (_jsx("p", { className: "text-sm text-muted-foreground", children: s.subtitle }))] }), s.headerActions] })), s.headerContent] })) : null;
22
+ s.headerActions !== undefined ? (_jsxs("div", { className: cn("flex flex-col gap-3 px-[var(--card-padding)] pt-6 pb-4", fillHeight && "shrink-0"), children: [(s.title !== undefined || s.subtitle !== undefined || s.headerActions !== undefined) && (_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [s.title !== undefined && (_jsx("h3", { className: "text-base font-semibold leading-none tracking-tight", children: s.title })), s.subtitle !== undefined && (_jsx("div", { className: "text-sm text-muted-foreground", children: s.subtitle }))] }), s.headerActions] })), s.headerContent] })) : null;
23
23
  const header = s.header ?? defaultHeader;
24
24
  const hasHeader = header !== null && header !== undefined;
25
25
  const card = (_jsxs("div", { ...dataAttributes, "data-slot": "card", "data-testid": testId, className: cn(framed ? cardSurface({ radius }) : "flex flex-col",
@@ -11,7 +11,12 @@ export function CodeInput(props) {
11
11
  const activeIndex = Math.min(value.length, length - 1);
12
12
  const hasSeparator = length >= MIN_LENGTH_FOR_SEPARATOR && length % 2 === 0;
13
13
  const handleChange = (e) => {
14
- const next = e.target.value.replace(/\D/g, "").slice(0, length);
14
+ const digits = e.target.value.replace(/\D/g, "");
15
+ // The caret is hidden and the active cell is always the end, so an insertion into a full code
16
+ // would shift digits the user never typed and auto-submit them.
17
+ if (value.length === length && digits.length > length)
18
+ return;
19
+ const next = digits.slice(0, length);
15
20
  props.onChange(next);
16
21
  if (next.length === length && next !== value)
17
22
  props.onComplete?.(next);
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import "../../react-css-custom-properties.ts";
2
3
  export declare const ACTIONS_CONTENT_ATTRIBUTE = "data-actions-content";
3
4
  export declare function stickyActionsCellClass(fillsHeight: boolean): string;
4
5
  export declare function ActionsHeaderCell({ label, style, absorbsLeftover, }: {
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/cn.js";
3
3
  import { TableCell, TableHead } from "../../ui/table.js";
4
+ import { COLUMN_ROLE_ATTRIBUTE } from "./column-role.js";
4
5
  import { ROW_FOCUS_RING_CELL_CLASS } from "./use-row-keyboard-navigation.js";
6
+ import "../../react-css-custom-properties.js";
5
7
  export const ACTIONS_CONTENT_ATTRIBUTE = "data-actions-content";
6
8
  export function stickyActionsCellClass(fillsHeight) {
7
- return cn("md:sticky md:right-0 md:z-10 md:bg-background", fillsHeight && "md:bg-card");
9
+ return cn("md:sticky md:right-0 md:z-10", fillsHeight ? "md:bg-card" : "md:bg-background");
8
10
  }
9
11
  export function ActionsHeaderCell({ label, style, absorbsLeftover, }) {
10
- return (_jsx(TableHead, { "data-testid": "column-actions",
12
+ return (_jsx(TableHead, { "data-testid": "column-actions", [COLUMN_ROLE_ATTRIBUTE]: "actions",
11
13
  // From md: sticky right-0 + bg-muted (= header tone) so the
12
14
  // action column stays at the right edge during horizontal
13
15
  // scroll on wider screens. Below md, actions scroll in
@@ -3,4 +3,9 @@ import type { ReactNode } from "react";
3
3
  import type { ListColumnViewModel, ListRowViewModel } from "../../../headless/index.ts";
4
4
  import type { DataTableModel } from "./use-data-table-state.ts";
5
5
  export type CardRoles = ReturnType<typeof cardColumnRoles<ListColumnViewModel>>;
6
+ export declare function splitLinkColumns(m: DataTableModel, row: ListRowViewModel, roles: CardRoles): {
7
+ readonly bodyRoles: CardRoles;
8
+ readonly linkColumns: readonly ListColumnViewModel[];
9
+ };
10
+ export declare function renderCardLinks(m: DataTableModel, row: ListRowViewModel, linkColumns: readonly ListColumnViewModel[]): ReactNode;
6
11
  export declare function renderCardBody(m: DataTableModel, row: ListRowViewModel, roles: CardRoles): ReactNode;