@cosmicdrift/kumiko-renderer 0.413.0 → 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.
- package/dist/app/action-form-support.js +4 -0
- package/dist/app/content-previews.d.ts +39 -0
- package/dist/app/content-previews.js +28 -0
- package/dist/app/entity-edit-screen.js +2 -5
- package/dist/app/entity-list-screen.js +30 -50
- package/dist/app/form-schema.d.ts +1 -0
- package/dist/app/form-schema.js +24 -0
- package/dist/app/list-sort-options.d.ts +4 -0
- package/dist/app/list-sort-options.js +11 -0
- package/dist/app/named-filter-facet.d.ts +17 -3
- package/dist/app/named-filter-facet.js +88 -5
- package/dist/app/projection-detail-body.d.ts +2 -4
- package/dist/app/projection-detail-body.js +7 -1
- package/dist/app/projection-detail-guidance-data.d.ts +7 -0
- package/dist/app/projection-detail-guidance-data.js +101 -0
- package/dist/app/projection-detail-guidance.d.ts +13 -0
- package/dist/app/projection-detail-guidance.js +197 -0
- package/dist/app/projection-detail-header-model.d.ts +1 -3
- package/dist/app/projection-detail-header-model.js +4 -8
- package/dist/app/projection-detail-header-region.d.ts +2 -1
- package/dist/app/projection-detail-header-region.js +63 -23
- package/dist/app/projection-detail-header.d.ts +6 -1
- package/dist/app/projection-detail-header.js +75 -18
- package/dist/app/projection-detail-states.d.ts +3 -3
- package/dist/app/projection-list-body.js +4 -2
- package/dist/app/projection-list-render.js +3 -1
- package/dist/app/projection-list-shim.d.ts +4 -1
- package/dist/app/projection-list-shim.js +35 -8
- package/dist/app/reference-link.d.ts +3 -2
- package/dist/app/reference-link.js +19 -4
- package/dist/app/row-actions.js +3 -3
- package/dist/app/screen-access.d.ts +4 -0
- package/dist/app/screen-access.js +19 -0
- package/dist/app/screen-shared.js +3 -1
- package/dist/app/unique-label-keys.d.ts +1 -0
- package/dist/app/unique-label-keys.js +9 -0
- package/dist/app/use-entity-list-payload.d.ts +25 -0
- package/dist/app/use-entity-list-payload.js +57 -0
- package/dist/app/use-entity-range-facets.js +2 -3
- package/dist/app/use-facet-counts.d.ts +5 -0
- package/dist/app/use-facet-counts.js +7 -0
- package/dist/app/use-list-summary-row.d.ts +10 -0
- package/dist/app/use-list-summary-row.js +33 -0
- package/dist/app/use-named-filter-queue.d.ts +20 -0
- package/dist/app/use-named-filter-queue.js +9 -0
- package/dist/app/use-projection-detail-actions.d.ts +4 -4
- package/dist/app/use-projection-detail-actions.js +30 -1
- package/dist/app/use-projection-list-data.d.ts +5 -0
- package/dist/app/use-projection-list-data.js +35 -6
- package/dist/app/use-projection-list-query.d.ts +2 -0
- package/dist/app/use-projection-list-query.js +29 -16
- package/dist/app/use-related-list-tab-counts.js +5 -1
- package/dist/app/use-row-decoration.d.ts +11 -0
- package/dist/app/use-row-decoration.js +55 -0
- package/dist/app/use-screen-list-rows.d.ts +4 -1
- package/dist/app/use-screen-list-rows.js +14 -5
- package/dist/app/use-screen-list-table.d.ts +3 -1
- package/dist/app/use-screen-list-table.js +10 -1
- package/dist/app/write-failed-error.d.ts +1 -0
- package/dist/app/write-failed-error.js +10 -0
- package/dist/compact-tap-classes.d.ts +1 -0
- package/dist/compact-tap-classes.js +3 -0
- package/dist/components/embedded-list-field.js +13 -12
- package/dist/components/form-pending-uploads.d.ts +8 -0
- package/dist/components/form-pending-uploads.js +27 -0
- package/dist/components/list-empty-state.d.ts +8 -1
- package/dist/components/list-empty-state.js +4 -1
- package/dist/components/list-group-page-bridges.d.ts +1 -1
- package/dist/components/list-group-page-bridges.js +2 -2
- package/dist/components/related-list-section.js +4 -22
- package/dist/components/render-edit-action-button.d.ts +3 -1
- package/dist/components/render-edit-action-button.js +5 -3
- package/dist/components/render-edit-form-actions.js +6 -3
- package/dist/components/render-edit-layout.js +2 -1
- package/dist/components/render-edit-render-model.d.ts +2 -2
- package/dist/components/render-edit-submit.js +2 -1
- package/dist/components/render-edit-types.d.ts +4 -2
- package/dist/components/render-edit.js +3 -1
- package/dist/components/render-list-hint-columns.d.ts +8 -0
- package/dist/components/render-list-hint-columns.js +77 -0
- package/dist/components/render-list-reference-columns.js +4 -2
- package/dist/components/render-list-row-tone.d.ts +3 -0
- package/dist/components/render-list-row-tone.js +10 -0
- package/dist/components/render-list-table-props.d.ts +9 -1
- package/dist/components/render-list-table-props.js +4 -1
- package/dist/components/render-list-toolbar-action.d.ts +1 -2
- package/dist/components/render-list-toolbar-model.d.ts +3 -0
- package/dist/components/render-list-toolbar-model.js +21 -6
- package/dist/components/render-list-toolbar.d.ts +3 -2
- package/dist/components/render-list-toolbar.js +8 -6
- package/dist/components/render-list-types.d.ts +6 -1
- package/dist/components/render-list.js +26 -7
- package/dist/components/use-render-edit-controlled-sync.js +5 -4
- package/dist/components/use-render-edit-draft-save.js +7 -9
- package/dist/components/use-render-edit-schema.d.ts +3 -0
- package/dist/components/use-render-edit-schema.js +15 -0
- package/dist/components/use-render-edit-state.d.ts +4 -0
- package/dist/components/use-render-edit-state.js +9 -1
- package/dist/components/use-render-edit-steps.js +2 -3
- package/dist/components/use-render-list-columns.d.ts +3 -1
- package/dist/components/use-render-list-columns.js +22 -10
- package/dist/context/screen-focus-context.d.ts +14 -0
- package/dist/context/screen-focus-context.js +28 -0
- package/dist/data-table-facet-types.d.ts +2 -0
- package/dist/data-table-view-types.d.ts +20 -1
- package/dist/headless/form/form-controller.js +3 -1
- package/dist/headless/form/zod-bridge.d.ts +7 -1
- package/dist/headless/form/zod-bridge.js +10 -0
- package/dist/headless/index.d.ts +2 -1
- package/dist/headless/index.js +1 -0
- package/dist/headless/pwa-service-worker-meta.d.ts +1 -0
- package/dist/headless/pwa-service-worker-meta.js +3 -0
- package/dist/headless/view-model/index.d.ts +1 -1
- package/dist/headless/view-model/list-file-display.js +3 -2
- package/dist/headless/view-model/list.js +16 -0
- package/dist/headless/view-model/types.d.ts +33 -0
- package/dist/hooks/list-column-layout.js +2 -1
- package/dist/hooks/list-server-groups.js +14 -1
- package/dist/hooks/list-state-schema.d.ts +1 -0
- package/dist/hooks/list-state-schema.js +9 -1
- package/dist/hooks/use-debounced-value.d.ts +1 -0
- package/dist/hooks/use-debounced-value.js +11 -0
- package/dist/hooks/use-list-aggregates.d.ts +5 -1
- package/dist/hooks/use-list-aggregates.js +9 -5
- package/dist/hooks/use-list-table.d.ts +2 -1
- package/dist/hooks/use-list-table.js +3 -9
- package/dist/hooks/use-list-url-state.d.ts +2 -0
- package/dist/hooks/use-list-url-state.js +12 -4
- package/dist/hooks/use-list-view-state.js +23 -3
- package/dist/hooks/use-reference-lookup.js +7 -2
- package/dist/hooks/use-remembered-list-params.d.ts +6 -2
- package/dist/hooks/use-remembered-list-params.js +18 -3
- package/dist/hooks/use-store.js +0 -1
- package/dist/i18n-defaults.js +37 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +5 -1
- package/dist/live/dispatcher-live.js +2 -0
- package/dist/metric-types.d.ts +2 -0
- package/dist/primitives-record-guidance.d.ts +53 -0
- package/dist/primitives-record-guidance.js +1 -0
- package/dist/primitives.d.ts +41 -31
- package/dist/server-clock.d.ts +6 -0
- package/dist/server-clock.js +20 -0
- package/dist/session/session-ended.d.ts +1 -0
- package/dist/session/session-ended.js +2 -2
- package/dist/status-tone.d.ts +1 -0
- package/dist/status-tone.js +5 -0
- package/dist/web/app/browser-locale.js +1 -1
- package/dist/web/app/client-plugin.d.ts +6 -1
- package/dist/web/app/create-app.d.ts +2 -1
- package/dist/web/app/create-app.js +15 -5
- package/dist/web/app/dashboard-body.js +25 -11
- package/dist/web/app/dashboard-header.d.ts +2 -1
- package/dist/web/app/dashboard-header.js +19 -7
- package/dist/web/app/dashboard-list-panel.d.ts +12 -0
- package/dist/web/app/dashboard-list-panel.js +149 -0
- package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
- package/dist/web/app/dashboard-narrow-gate.js +6 -0
- package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
- package/dist/web/app/dashboard-narrow-order.js +6 -0
- package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
- package/dist/web/app/dashboard-navigation-link.js +21 -0
- package/dist/web/app/dashboard-panels.d.ts +6 -23
- package/dist/web/app/dashboard-panels.js +53 -123
- package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
- package/dist/web/app/dashboard-reference-list-table.js +12 -4
- package/dist/web/app/dashboard-shared.d.ts +23 -7
- package/dist/web/app/dashboard-shared.js +44 -17
- package/dist/web/app/dashboard-stat-group-panel.d.ts +13 -0
- package/dist/web/app/dashboard-stat-group-panel.js +67 -0
- package/dist/web/app/dashboard-text-panel.d.ts +12 -0
- package/dist/web/app/dashboard-text-panel.js +163 -0
- package/dist/web/app/dashboard-text.d.ts +2 -0
- package/dist/web/app/dashboard-text.js +1 -1
- package/dist/web/app/dashboard-visibility.js +1 -1
- package/dist/web/app/relative-time.js +2 -1
- package/dist/web/editor/editor-footer.d.ts +28 -0
- package/dist/web/editor/editor-footer.js +23 -0
- package/dist/web/editor/editor-frame.d.ts +23 -0
- package/dist/web/editor/editor-frame.js +24 -0
- package/dist/web/editor/editor-header.d.ts +36 -0
- package/dist/web/editor/editor-header.js +30 -0
- package/dist/web/editor/editor-rail.d.ts +32 -0
- package/dist/web/editor/editor-rail.js +37 -0
- package/dist/web/editor/editor-workbench.d.ts +34 -0
- package/dist/web/editor/editor-workbench.js +19 -0
- package/dist/web/editor/index.d.ts +6 -0
- package/dist/web/editor/index.js +6 -0
- package/dist/web/editor/relative-when.d.ts +1 -0
- package/dist/web/editor/relative-when.js +18 -0
- package/dist/web/index.d.ts +7 -1
- package/dist/web/index.js +5 -1
- package/dist/web/layout/default-app-shell.js +6 -4
- package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
- package/dist/web/layout/focus-aware-sidebar.js +5 -7
- package/dist/web/layout/header-action-pinned.d.ts +8 -0
- package/dist/web/layout/header-action-pinned.js +25 -0
- package/dist/web/layout/nav-collapse-state.d.ts +5 -0
- package/dist/web/layout/nav-collapse-state.js +66 -0
- package/dist/web/layout/nav-tree.js +25 -5
- package/dist/web/layout/page-header-slot.d.ts +2 -0
- package/dist/web/layout/page-header-slot.js +4 -0
- package/dist/web/layout/screen-focus.d.ts +8 -0
- package/dist/web/layout/screen-focus.js +42 -0
- package/dist/web/layout/shell-focus.d.ts +6 -5
- package/dist/web/layout/shell-focus.js +12 -9
- package/dist/web/layout/shell-header.js +38 -10
- package/dist/web/layout/sidebar-open-state.d.ts +6 -0
- package/dist/web/layout/sidebar-open-state.js +28 -0
- package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
- package/dist/web/layout/uniform-bar-controls.js +4 -3
- package/dist/web/layout/use-in-app-inbox.js +8 -1
- package/dist/web/layout/workspace-shell.js +6 -4
- package/dist/web/lib/upload-file-ref.d.ts +2 -2
- package/dist/web/lib/upload-file-ref.js +4 -9
- package/dist/web/presence/use-presence.js +7 -2
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +14 -6
- package/dist/web/primitives/calendar-day-picker.js +24 -5
- package/dist/web/primitives/card.js +1 -1
- package/dist/web/primitives/code-input.js +6 -1
- package/dist/web/primitives/data-table/actions-column.d.ts +1 -0
- package/dist/web/primitives/data-table/actions-column.js +4 -2
- package/dist/web/primitives/data-table/card-body.d.ts +5 -0
- package/dist/web/primitives/data-table/card-body.js +47 -5
- package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
- package/dist/web/primitives/data-table/card-frame.js +9 -0
- package/dist/web/primitives/data-table/card-row.js +40 -7
- package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
- package/dist/web/primitives/data-table/card-sort-select.js +10 -7
- package/dist/web/primitives/data-table/card-view.js +12 -2
- package/dist/web/primitives/data-table/column-picker-section.js +9 -2
- package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
- package/dist/web/primitives/data-table/column-role.d.ts +1 -0
- package/dist/web/primitives/data-table/column-role.js +1 -0
- package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
- package/dist/web/primitives/data-table/data-cell-props.js +5 -0
- package/dist/web/primitives/data-table/density.js +1 -0
- package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
- package/dist/web/primitives/data-table/facet-cluster.js +2 -2
- package/dist/web/primitives/data-table/group-band.js +4 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +16 -0
- package/dist/web/primitives/data-table/hint-cell.js +74 -0
- package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
- package/dist/web/primitives/data-table/hint-column-width.js +11 -0
- package/dist/web/primitives/data-table/measure-value.js +2 -3
- package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
- package/dist/web/primitives/data-table/row-action-column.js +4 -0
- package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
- package/dist/web/primitives/data-table/sort-options-select.js +46 -0
- package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
- package/dist/web/primitives/data-table/sortable-header.js +5 -3
- package/dist/web/primitives/data-table/table-body.d.ts +1 -1
- package/dist/web/primitives/data-table/table-body.js +5 -3
- package/dist/web/primitives/data-table/table-chrome.js +3 -1
- package/dist/web/primitives/data-table/table-content.js +10 -5
- package/dist/web/primitives/data-table/table-data-cell.js +9 -3
- package/dist/web/primitives/data-table/table-header-row.js +5 -2
- package/dist/web/primitives/data-table/table-view.js +17 -3
- package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
- package/dist/web/primitives/data-table/toolbar.js +31 -3
- package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
- package/dist/web/primitives/data-table/totals-footer.js +40 -9
- package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
- package/dist/web/primitives/data-table/use-column-pins.js +4 -0
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
- package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
- package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
- package/dist/web/primitives/data-table/use-row-selection.js +22 -11
- package/dist/web/primitives/data-table/view-menu.js +7 -1
- package/dist/web/primitives/data-table-cell.d.ts +21 -2
- package/dist/web/primitives/data-table-cell.js +96 -19
- package/dist/web/primitives/embedded-file-cell.js +10 -6
- package/dist/web/primitives/embedded-list-cards.js +3 -4
- package/dist/web/primitives/facet-filter.d.ts +4 -2
- package/dist/web/primitives/facet-filter.js +26 -3
- package/dist/web/primitives/facet-search-filter.js +1 -1
- package/dist/web/primitives/file-thumbnail.d.ts +6 -2
- package/dist/web/primitives/file-thumbnail.js +13 -6
- package/dist/web/primitives/file-upload.js +15 -11
- package/dist/web/primitives/file-view-action.d.ts +6 -0
- package/dist/web/primitives/file-view-action.js +19 -0
- package/dist/web/primitives/files-dropzone.js +18 -4
- package/dist/web/primitives/form-footer-parts.d.ts +0 -1
- package/dist/web/primitives/form.js +0 -1
- package/dist/web/primitives/hint-reason-row.d.ts +32 -0
- package/dist/web/primitives/hint-reason-row.js +45 -0
- package/dist/web/primitives/index.js +6 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +2 -2
- package/dist/web/primitives/metric.js +8 -6
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +8 -1
- package/dist/web/primitives/pager.js +29 -18
- package/dist/web/primitives/reason-box.d.ts +20 -0
- package/dist/web/primitives/reason-box.js +13 -0
- package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
- package/dist/web/primitives/record-breadcrumb.js +11 -0
- package/dist/web/primitives/record-steps.d.ts +3 -0
- package/dist/web/primitives/record-steps.js +45 -0
- package/dist/web/primitives/record-summary.d.ts +3 -0
- package/dist/web/primitives/record-summary.js +18 -0
- package/dist/web/primitives/row-actions.d.ts +3 -1
- package/dist/web/primitives/row-actions.js +14 -5
- package/dist/web/primitives/segmented-select.js +5 -7
- package/dist/web/pwa/pwa-support.d.ts +4 -0
- package/dist/web/pwa/pwa-support.js +113 -0
- package/dist/web/sse/live-events.js +2 -2
- package/dist/web/tokens.js +0 -3
- package/dist/web/widgets/chart-parts.d.ts +7 -1
- package/dist/web/widgets/chart-parts.js +10 -4
- package/dist/web/widgets/collapsible-section.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
- package/dist/web/widgets/dashboard-list-cards.js +54 -0
- package/dist/web/widgets/dashboard-list.d.ts +37 -5
- package/dist/web/widgets/dashboard-list.js +95 -20
- package/dist/web/widgets/drawer-sizing.js +1 -1
- package/dist/web/widgets/floating-panel.js +4 -2
- package/dist/web/widgets/index.d.ts +2 -0
- package/dist/web/widgets/index.js +2 -0
- package/dist/web/widgets/infinity-list.js +18 -11
- package/dist/web/widgets/preview-width-frame.d.ts +7 -0
- package/dist/web/widgets/preview-width-frame.js +10 -0
- package/dist/web/widgets/section-card.d.ts +1 -1
- package/dist/web/widgets/stacked-area-chrome.js +3 -3
- package/dist/web/widgets/stacked-area-tooltip.js +2 -10
- package/dist/web/widgets/stat-box-cell.d.ts +19 -0
- package/dist/web/widgets/stat-box-cell.js +10 -0
- package/dist/web/widgets/stat.d.ts +10 -1
- package/dist/web/widgets/stat.js +14 -5
- package/dist/web/widgets/status-badge.d.ts +7 -5
- package/dist/web/widgets/status-badge.js +2 -2
- package/dist/web/widgets/step-bar.d.ts +1 -1
- package/dist/web/widgets/step-bar.js +37 -7
- package/dist/web/widgets/upload-zone.d.ts +8 -1
- package/dist/web/widgets/upload-zone.js +13 -3
- package/package.json +5 -5
- package/src/changes.json +223 -0
- package/src/web/styles.css +9 -0
|
@@ -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,
|
|
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
8
|
import { ShellFocusProvider, 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);
|
|
@@ -14,6 +15,7 @@ export function DefaultAppShell({ brand, schema, user, sidebarActions, headerAct
|
|
|
14
15
|
// Second column only when a screen fills it (sidebar-09 pattern) — otherwise
|
|
15
16
|
// every other screen would carry an empty strip next to the navigation.
|
|
16
17
|
const panel = useSidebarPanelHost();
|
|
17
|
-
const focus = useShellFocusHost();
|
|
18
|
-
|
|
18
|
+
const focus = useShellFocusHost(headerActions);
|
|
19
|
+
const sidebarOpen = usePersistedSidebarOpen();
|
|
20
|
+
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: 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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
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
|
|
7
|
-
export function
|
|
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:
|
|
12
|
-
onOpenChange:
|
|
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,66 @@
|
|
|
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
|
+
// The sidebar body remounts when the shell swaps it (focus mode, mobile sheet),
|
|
46
|
+
// so the explicitly collapsed qualified names live in sessionStorage, not in
|
|
47
|
+
// component state alone.
|
|
48
|
+
export function usePersistedNavCollapse() {
|
|
49
|
+
const [collapsed, setCollapsed] = useState(readStoredCollapsed);
|
|
50
|
+
useEffect(() => writeStoredCollapsed(collapsed), [collapsed]);
|
|
51
|
+
const toggle = useCallback((qualifiedName) => {
|
|
52
|
+
setCollapsed((prev) => toggleSetMember(prev, qualifiedName));
|
|
53
|
+
}, []);
|
|
54
|
+
const revealOnScreenChange = useCallback((screenId, qualifiedNames) => {
|
|
55
|
+
// skip: this screen's path was already revealed once; later collapses stay
|
|
56
|
+
if (readRevealedScreen() === screenId)
|
|
57
|
+
return;
|
|
58
|
+
writeRevealedScreen(screenId);
|
|
59
|
+
setCollapsed((prev) => {
|
|
60
|
+
if (!qualifiedNames.some((qn) => prev.has(qn)))
|
|
61
|
+
return prev;
|
|
62
|
+
return new Set([...prev].filter((qn) => !qualifiedNames.includes(qn)));
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
return { collapsed, toggle, revealOnScreenChange };
|
|
66
|
+
}
|
|
@@ -5,12 +5,12 @@ 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";
|
|
11
10
|
import { NAV_ICONS } from "../icons.js";
|
|
12
11
|
import { cn } from "../lib/cn.js";
|
|
13
12
|
import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInput, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar, } from "../ui/sidebar.js";
|
|
13
|
+
import { usePersistedNavCollapse } from "./nav-collapse-state.js";
|
|
14
14
|
import { resolveParentScreenId } from "./shell-breadcrumb.js";
|
|
15
15
|
import { useDispatchTarget } from "./target-resolver-stub.js";
|
|
16
16
|
import { parseTargetFromSearchParams } from "./target-url.js";
|
|
@@ -28,6 +28,17 @@ export function treeContainsScreen(nodes, screenId) {
|
|
|
28
28
|
return nodes.some((n) => (n.screen !== undefined && lastSegment(n.screen) === screenId) ||
|
|
29
29
|
treeContainsScreen(n.children, screenId));
|
|
30
30
|
}
|
|
31
|
+
// Qualified names of the containers on the way to the node showing `screenId`.
|
|
32
|
+
function containerPathToScreen(nodes, screenId) {
|
|
33
|
+
for (const node of nodes) {
|
|
34
|
+
if (node.screen !== undefined && lastSegment(node.screen) === screenId)
|
|
35
|
+
return [];
|
|
36
|
+
const inner = containerPathToScreen(node.children, screenId);
|
|
37
|
+
if (inner !== undefined)
|
|
38
|
+
return [node.qualifiedName, ...inner];
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
31
42
|
// A node survives filtering when it or a descendant matches.
|
|
32
43
|
// Provider children are already materialized during filtering (provider nodes
|
|
33
44
|
// are default-expanded → eagerly loaded), so static children recursion is
|
|
@@ -68,10 +79,19 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
|
|
|
68
79
|
// The collapsed set contains only explicitly collapsed qualified names.
|
|
69
80
|
// Everything is therefore expanded by default, so new features appear open
|
|
70
81
|
// without requiring the user to click first.
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
const { collapsed, toggle: onToggle, revealOnScreenChange } = usePersistedNavCollapse();
|
|
83
|
+
// Keyed on the active screen only, so a container the user collapses while
|
|
84
|
+
// staying on the screen is not reopened; other collapsed containers are left alone.
|
|
85
|
+
const revealScreenId = activeMarker?.screenId;
|
|
86
|
+
const treeRef = useRef(tree);
|
|
87
|
+
treeRef.current = tree;
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (revealScreenId === undefined)
|
|
90
|
+
return;
|
|
91
|
+
const path = containerPathToScreen(treeRef.current, revealScreenId);
|
|
92
|
+
if (path !== undefined)
|
|
93
|
+
revealOnScreenChange(revealScreenId, path);
|
|
94
|
+
}, [revealScreenId, revealOnScreenChange]);
|
|
75
95
|
const t = useTranslation();
|
|
76
96
|
const { state: sidebarState } = useSidebar();
|
|
77
97
|
const [filter, setFilter] = useState("");
|
|
@@ -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;
|
|
@@ -18,6 +18,7 @@ export function PageHeaderSlotProvider({ children }) {
|
|
|
18
18
|
const [actionsElement, setActionsElement] = useState(null);
|
|
19
19
|
const [title, setTitle] = useState(undefined);
|
|
20
20
|
const [recordTitle, setRecordTitle] = useState(undefined);
|
|
21
|
+
const [bodyTitle, setBodyTitle] = useState(false);
|
|
21
22
|
const [breadcrumbHidden, setBreadcrumbHidden] = useState(false);
|
|
22
23
|
const [breadcrumbScreenId, setBreadcrumbScreenId] = useState(undefined);
|
|
23
24
|
const [overflowItems, setOverflowItems] = useState(undefined);
|
|
@@ -31,6 +32,8 @@ export function PageHeaderSlotProvider({ children }) {
|
|
|
31
32
|
setTitle,
|
|
32
33
|
recordTitle,
|
|
33
34
|
setRecordTitle,
|
|
35
|
+
bodyTitle,
|
|
36
|
+
setBodyTitle,
|
|
34
37
|
breadcrumbHidden,
|
|
35
38
|
setBreadcrumbHidden,
|
|
36
39
|
breadcrumbScreenId,
|
|
@@ -42,6 +45,7 @@ export function PageHeaderSlotProvider({ children }) {
|
|
|
42
45
|
actionsElement,
|
|
43
46
|
title,
|
|
44
47
|
recordTitle,
|
|
48
|
+
bodyTitle,
|
|
45
49
|
breadcrumbHidden,
|
|
46
50
|
breadcrumbScreenId,
|
|
47
51
|
overflowItems,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
/** Applies a screen's declarative `focus`: focused shell chrome on desktop, a MobileTopBar on phones. */
|
|
4
|
+
export declare function ScreenFocus({ screen, screens, children, }: {
|
|
5
|
+
readonly screen: ScreenDefinition;
|
|
6
|
+
readonly screens: readonly ScreenDefinition[];
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
}): ReactNode;
|
|
@@ -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
|
|
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,
|
|
2
|
-
//
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
83
|
+
const bodyTitle = slot?.bodyTitle === true;
|
|
84
|
+
const baseCrumbs = (slot?.breadcrumbHidden === true && standInScreenId === undefined) || standInUntitled
|
|
76
85
|
? undefined
|
|
77
|
-
: crumbs
|
|
78
|
-
|
|
79
|
-
|
|
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 ? (
|
|
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
|
-
|
|
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]);
|