@cosmicdrift/kumiko-renderer 0.414.0 → 0.415.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/app/entity-list-screen.js +12 -9
  2. package/dist/app/list-facets.d.ts +1 -0
  3. package/dist/app/list-facets.js +10 -1
  4. package/dist/app/named-filter-facet.d.ts +0 -1
  5. package/dist/app/named-filter-facet.js +19 -10
  6. package/dist/app/projection-detail-guidance-data.js +3 -1
  7. package/dist/app/projection-detail-guidance.js +9 -9
  8. package/dist/app/projection-detail-header.js +4 -3
  9. package/dist/app/projection-detail-navigation.d.ts +2 -0
  10. package/dist/app/projection-detail-navigation.js +13 -3
  11. package/dist/app/screen-access.js +1 -2
  12. package/dist/app/use-entity-list-payload.d.ts +2 -1
  13. package/dist/app/use-entity-list-payload.js +4 -2
  14. package/dist/app/use-projection-detail-actions.d.ts +1 -0
  15. package/dist/app/use-projection-detail-actions.js +26 -14
  16. package/dist/app/use-row-decoration.d.ts +6 -4
  17. package/dist/app/use-row-decoration.js +67 -19
  18. package/dist/app/use-screen-list-rows.js +1 -1
  19. package/dist/card-options.d.ts +25 -0
  20. package/dist/card-options.js +1 -0
  21. package/dist/components/list-empty-state.d.ts +5 -0
  22. package/dist/components/list-empty-state.js +17 -1
  23. package/dist/components/render-list-hint-columns.d.ts +1 -0
  24. package/dist/components/render-list-hint-columns.js +10 -0
  25. package/dist/components/render-list-toolbar-model.d.ts +2 -2
  26. package/dist/components/use-render-list-columns.js +3 -3
  27. package/dist/context/screen-focus-context.d.ts +1 -1
  28. package/dist/context/screen-focus-context.js +3 -3
  29. package/dist/data-table-facet-types.d.ts +4 -0
  30. package/dist/headless/index.d.ts +1 -1
  31. package/dist/headless/index.js +1 -1
  32. package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
  33. package/dist/headless/pwa-service-worker-meta.js +10 -0
  34. package/dist/headless/view-model/types.d.ts +4 -0
  35. package/dist/i18n-defaults.js +2 -1
  36. package/dist/metric-types.d.ts +2 -0
  37. package/dist/primitives-record-guidance.d.ts +2 -0
  38. package/dist/primitives.d.ts +7 -24
  39. package/dist/web/app/dashboard-header.js +1 -1
  40. package/dist/web/app/dashboard-list-panel.js +8 -13
  41. package/dist/web/app/dashboard-panels.d.ts +1 -0
  42. package/dist/web/app/dashboard-panels.js +9 -7
  43. package/dist/web/app/dashboard-reference-list-table.js +1 -0
  44. package/dist/web/app/dashboard-shared.js +2 -1
  45. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
  46. package/dist/web/app/dashboard-stat-group-panel.js +14 -7
  47. package/dist/web/app/dashboard-text-panel.js +8 -4
  48. package/dist/web/drawn-icons.d.ts +6 -0
  49. package/dist/web/drawn-icons.js +30 -0
  50. package/dist/web/icons.js +6 -5
  51. package/dist/web/index.d.ts +2 -0
  52. package/dist/web/index.js +2 -0
  53. package/dist/web/layout/default-app-shell.js +3 -3
  54. package/dist/web/layout/nav-collapse-state.d.ts +2 -0
  55. package/dist/web/layout/nav-collapse-state.js +10 -0
  56. package/dist/web/layout/nav-tree.js +46 -23
  57. package/dist/web/layout/notification-bell.d.ts +7 -2
  58. package/dist/web/layout/notification-bell.js +16 -5
  59. package/dist/web/layout/shell-focus.d.ts +2 -2
  60. package/dist/web/layout/shell-focus.js +7 -3
  61. package/dist/web/layout/shell-header.d.ts +2 -1
  62. package/dist/web/layout/shell-header.js +56 -27
  63. package/dist/web/layout/shell-style.d.ts +3 -0
  64. package/dist/web/layout/shell-style.js +6 -0
  65. package/dist/web/layout/workspace-shell.d.ts +11 -1
  66. package/dist/web/layout/workspace-shell.js +6 -4
  67. package/dist/web/primitives/banner.d.ts +1 -1
  68. package/dist/web/primitives/banner.js +12 -7
  69. package/dist/web/primitives/card.js +18 -8
  70. package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
  71. package/dist/web/primitives/data-table/actions-column.js +3 -1
  72. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  73. package/dist/web/primitives/data-table/card-body.js +11 -6
  74. package/dist/web/primitives/data-table/card-row.js +21 -17
  75. package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
  76. package/dist/web/primitives/data-table/hint-cell.js +4 -10
  77. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  78. package/dist/web/primitives/data-table/row-render-parts.js +3 -2
  79. package/dist/web/primitives/data-table/sort-options-select.js +3 -3
  80. package/dist/web/primitives/data-table/table-content.js +4 -4
  81. package/dist/web/primitives/data-table/table-view.js +8 -3
  82. package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
  83. package/dist/web/primitives/data-table/toolbar.js +44 -9
  84. package/dist/web/primitives/data-table/totals-footer.js +4 -3
  85. package/dist/web/primitives/data-table-cell.js +44 -18
  86. package/dist/web/primitives/facet-filter.d.ts +1 -1
  87. package/dist/web/primitives/facet-filter.js +16 -8
  88. package/dist/web/primitives/facet-search-filter.d.ts +2 -1
  89. package/dist/web/primitives/facet-search-filter.js +3 -2
  90. package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
  91. package/dist/web/primitives/facet-trigger-label.js +9 -0
  92. package/dist/web/primitives/file-view-action.js +4 -1
  93. package/dist/web/primitives/layout-elements.js +1 -1
  94. package/dist/web/primitives/metric.js +17 -5
  95. package/dist/web/primitives/page-header.js +3 -2
  96. package/dist/web/primitives/pager.d.ts +3 -2
  97. package/dist/web/primitives/pager.js +16 -20
  98. package/dist/web/primitives/record-breadcrumb.js +1 -1
  99. package/dist/web/primitives/record-steps.js +9 -4
  100. package/dist/web/primitives/record-summary.js +1 -1
  101. package/dist/web/primitives/segmented-select.js +6 -3
  102. package/dist/web/primitives/tabs.js +6 -1
  103. package/dist/web/pwa/pwa-support.js +19 -1
  104. package/dist/web/ui/sidebar.d.ts +2 -1
  105. package/dist/web/ui/sidebar.js +4 -3
  106. package/dist/web/widgets/ai-text-field.js +3 -2
  107. package/dist/web/widgets/dashboard-list-cards.js +6 -14
  108. package/dist/web/widgets/dashboard-list.d.ts +8 -0
  109. package/dist/web/widgets/dashboard-list.js +34 -8
  110. package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
  111. package/dist/web/widgets/drawer-panel-class.js +9 -1
  112. package/dist/web/widgets/drawer.js +2 -2
  113. package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
  114. package/dist/web/widgets/sheet-parts.js +3 -1
  115. package/dist/web/widgets/stat-box-cell.js +1 -1
  116. package/dist/web/widgets/stat.d.ts +7 -1
  117. package/dist/web/widgets/stat.js +12 -4
  118. package/dist/web/widgets/step-list-row.d.ts +4 -0
  119. package/dist/web/widgets/step-list-row.js +22 -14
  120. package/dist/web/widgets/step-list.d.ts +12 -4
  121. package/dist/web/widgets/step-list.js +38 -20
  122. package/package.json +5 -5
  123. package/src/changes.json +72 -0
  124. package/src/web/styles.css +6 -0
@@ -0,0 +1,6 @@
1
+ export declare const DrawnSearch: import("lucide-react").LucideIcon;
2
+ export declare const DrawnSparkles: import("lucide-react").LucideIcon;
3
+ export declare const DrawnPencil: import("lucide-react").LucideIcon;
4
+ export declare const DrawnFilter: import("lucide-react").LucideIcon;
5
+ export declare const DrawnWand: import("lucide-react").LucideIcon;
6
+ export declare const DrawnPanel: import("lucide-react").LucideIcon;
@@ -0,0 +1,30 @@
1
+ // Icons drawn to match the KI-first boards; lucide's stock glyphs differ in stroke detail.
2
+ import { createLucideIcon } from "lucide-react";
3
+ export const DrawnSearch = createLucideIcon("drawn-search", [
4
+ ["circle", { cx: "11", cy: "11", r: "7", key: "drawn-search-lens" }],
5
+ ["path", { d: "m20 20-3.5-3.5", key: "drawn-search-handle" }],
6
+ ]);
7
+ export const DrawnSparkles = createLucideIcon("drawn-sparkles", [
8
+ ["path", { d: "M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z", key: "large" }],
9
+ ["path", { d: "M19 15.5l.9 2.6 2.6.9-2.6.9-.9 2.6-.9-2.6-2.6-.9 2.6-.9z", key: "small" }],
10
+ ]);
11
+ export const DrawnPencil = createLucideIcon("drawn-pencil", [
12
+ ["path", { d: "M4 20h4L19 9l-4-4L4 16z", key: "body" }],
13
+ ["path", { d: "m13 7 4 4", key: "tip" }],
14
+ ]);
15
+ export const DrawnFilter = createLucideIcon("drawn-filter", [
16
+ ["path", { d: "M4 6h16l-6 7v5l-4 2v-7z", key: "funnel" }],
17
+ ]);
18
+ export const DrawnWand = createLucideIcon("drawn-wand", [
19
+ [
20
+ "path",
21
+ {
22
+ d: "m4 20 10-10M14 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 11l.7 1.3 1.3.7-1.3.7-.7 1.3-.7-1.3-1.3-.7 1.3-.7z",
23
+ key: "wand",
24
+ },
25
+ ],
26
+ ]);
27
+ export const DrawnPanel = createLucideIcon("drawn-panel", [
28
+ ["rect", { x: "3", y: "4", width: "18", height: "16", rx: "2", key: "frame" }],
29
+ ["path", { d: "M9 4v16", key: "divider" }],
30
+ ]);
package/dist/web/icons.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AlertTriangle, Archive, ArrowLeft, ArrowRight, BarChart3, Bell, BookOpen, Building, Calculator, CalendarDays, Camera, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleStop, ClipboardList, Clock, Coins, Copy, CreditCard, Download, Euro, ExternalLink, Eye, EyeOff, FileText, Filter, Flag, Folder, FolderOpen, Gauge, Hash, Headphones, Home, ImageIcon, Info, KeyRound, Languages, Layers, LayoutDashboard, LayoutGrid, LineChart, Link, List, Loader2, Lock, Mail, MapPin, Mic, MoreHorizontal, MoreVertical, Package, Palette, Pencil, Phone, PiggyBank, Plus, Printer, Receipt, RefreshCw, Rocket, Save, Search, Send, Server, Settings, Share2, Shield, ShieldCheck, Sparkles, Star, Table, Tag, Trash2, TrendingUp, Undo2, Upload, User, Users, Wallet, Wand2, Warehouse, X, XCircle, } from "lucide-react";
2
+ import { AlertTriangle, Archive, ArrowLeft, ArrowRight, BarChart3, Bell, BookOpen, Building, Calculator, CalendarDays, Camera, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleStop, ClipboardList, Clock, Coins, Copy, CreditCard, Download, Euro, ExternalLink, Eye, EyeOff, FileText, Filter, Flag, Folder, FolderOpen, Gauge, Hash, Headphones, Home, ImageIcon, Info, KeyRound, Languages, Layers, LayoutDashboard, LayoutGrid, LineChart, Link, List, Loader2, Lock, Mail, MapPin, Mic, MoreHorizontal, MoreVertical, Package, Palette, Phone, PiggyBank, Plus, Printer, Receipt, RefreshCw, Rocket, Save, Send, Server, Settings, Share2, Shield, ShieldCheck, Star, Table, Tag, Trash2, TrendingUp, Undo2, Upload, User, Users, Wallet, Warehouse, X, XCircle, } from "lucide-react";
3
+ import { DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand } from "./drawn-icons.js";
3
4
  import { cn } from "./lib/cn.js";
4
5
  export const NAV_ICONS = {
5
6
  dashboard: LayoutDashboard,
@@ -23,8 +24,8 @@ export const NAV_ICONS = {
23
24
  chart: LineChart,
24
25
  "bar-chart": BarChart3,
25
26
  trending: TrendingUp,
26
- sparkles: Sparkles,
27
- wand: Wand2,
27
+ sparkles: DrawnSparkles,
28
+ wand: DrawnWand,
28
29
  calendar: CalendarDays,
29
30
  file: FileText,
30
31
  folder: Folder,
@@ -37,7 +38,7 @@ export const NAV_ICONS = {
37
38
  settings: Settings,
38
39
  users: Users,
39
40
  user: User,
40
- search: Search,
41
+ search: DrawnSearch,
41
42
  tag: Tag,
42
43
  key: KeyRound,
43
44
  link: Link,
@@ -58,7 +59,7 @@ export const NAV_ICONS = {
58
59
  "arrow-left": ArrowLeft,
59
60
  "arrow-right": ArrowRight,
60
61
  copy: Copy,
61
- pencil: Pencil,
62
+ pencil: DrawnPencil,
62
63
  eye: Eye,
63
64
  "eye-off": EyeOff,
64
65
  filter: Filter,
@@ -13,6 +13,7 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.tsx";
13
13
  export { PlainContentEditor } from "./app/plain-content-editor.tsx";
14
14
  export { useResolvers } from "./app/resolvers-context.tsx";
15
15
  export { clearRememberedListState } from "./app/session-list-state-store.ts";
16
+ export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.ts";
16
17
  export type { EditorActionTestIds, EditorHeaderTestIds, EditorMode, EditorSaveActions, EditorWorkbenchProps, FooterTone, InfoBarTone, WorkbenchSave, } from "./editor/index.ts";
17
18
  export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.ts";
18
19
  export type { NavIconKey } from "./icons.tsx";
@@ -34,6 +35,7 @@ export type { LanguageMenuItemsProps } from "./layout/language-menu-items.tsx";
34
35
  export { LanguageMenuItems } from "./layout/language-menu-items.tsx";
35
36
  export type { LanguageSwitcherProps, LocaleOption } from "./layout/language-switcher.tsx";
36
37
  export { LanguageSwitcher } from "./layout/language-switcher.tsx";
38
+ export { clearNavCollapseState } from "./layout/nav-collapse-state.ts";
37
39
  export type { NavTreeProps } from "./layout/nav-tree.tsx";
38
40
  export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.tsx";
39
41
  export type { ProfileMenuItem, ProfileMenuProps } from "./layout/profile-menu.tsx";
package/dist/web/index.js CHANGED
@@ -12,6 +12,7 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.js";
12
12
  export { PlainContentEditor } from "./app/plain-content-editor.js";
13
13
  export { useResolvers } from "./app/resolvers-context.js";
14
14
  export { clearRememberedListState } from "./app/session-list-state-store.js";
15
+ export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.js";
15
16
  export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.js";
16
17
  export { Icon } from "./icons.js";
17
18
  export { AppLayout } from "./layout/app-layout.js";
@@ -23,6 +24,7 @@ export { HeaderActionGroup } from "./layout/header-action-group.js";
23
24
  export { HeaderActionPinned } from "./layout/header-action-pinned.js";
24
25
  export { LanguageMenuItems } from "./layout/language-menu-items.js";
25
26
  export { LanguageSwitcher } from "./layout/language-switcher.js";
27
+ export { clearNavCollapseState } from "./layout/nav-collapse-state.js";
26
28
  export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.js";
27
29
  export { ProfileMenu } from "./layout/profile-menu.js";
28
30
  export { useShellFocusMode } from "./layout/shell-focus.js";
@@ -5,7 +5,7 @@ import { fillClasses } from "./fill-classes.js";
5
5
  import { FocusAwareSidebarBody, sidebarProviderProps } from "./focus-aware-sidebar.js";
6
6
  import { NavTree } from "./nav-tree.js";
7
7
  import { PageHeaderSlotProvider } from "./page-header-slot.js";
8
- import { ShellFocusProvider, useShellFocusHost } from "./shell-focus.js";
8
+ import { ShellFocusProvider, ShellTopbarActionsProvider, useShellFocusHost, } from "./shell-focus.js";
9
9
  import { ShellHeader } from "./shell-header.js";
10
10
  import { usePersistedSidebarOpen } from "./sidebar-open-state.js";
11
11
  import { SidebarPanelProvider, useSidebarPanelHost } from "./sidebar-panel.js";
@@ -15,7 +15,7 @@ export function DefaultAppShell({ brand, schema, user, sidebarActions, headerAct
15
15
  // Second column only when a screen fills it (sidebar-09 pattern) — otherwise
16
16
  // every other screen would carry an empty strip next to the navigation.
17
17
  const panel = useSidebarPanelHost();
18
- const focus = useShellFocusHost(headerActions);
18
+ const focus = useShellFocusHost();
19
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 }) })] }) })] }) }) }) }));
20
+ return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsx(ShellTopbarActionsProvider, { value: headerActions, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: schema, user: user, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsx(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: brand }), sidebarActions !== undefined && (_jsx(SidebarGroup, { "data-kumiko-layout": "sidebar-actions", className: "flex-row flex-wrap items-center gap-1 py-0", children: sidebarActions })), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: _jsx(NavTree, { schema: schema, ...(user !== undefined && { user }), ...(navBadges !== undefined && { navBadges }) }) }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: schema, ...(user !== undefined && { user }), ...(headerActions !== undefined && { headerActions }) }), _jsx("main", { className: fillCls.main, children: _jsx(UserRolesProvider, { roles: user?.roles, children: children }) })] }) })] }) }) }) }) }));
21
21
  }
@@ -1,3 +1,5 @@
1
+ /** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
2
+ export declare function clearNavCollapseState(): void;
1
3
  export declare function usePersistedNavCollapse(): {
2
4
  readonly collapsed: ReadonlySet<string>;
3
5
  readonly toggle: (qualifiedName: string) => void;
@@ -42,6 +42,16 @@ function writeRevealedScreen(screenId) {
42
42
  // storage unavailable: a remount may reveal the active path once more
43
43
  }
44
44
  }
45
+ /** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
46
+ export function clearNavCollapseState() {
47
+ try {
48
+ window.sessionStorage.removeItem(STORAGE_KEY);
49
+ window.sessionStorage.removeItem(REVEALED_SCREEN_KEY);
50
+ }
51
+ catch {
52
+ // storage unavailable: nothing was persisted
53
+ }
54
+ }
45
55
  // The sidebar body remounts when the shell swaps it (focus mode, mobile sheet),
46
56
  // so the explicitly collapsed qualified names live in sessionStorage, not in
47
57
  // component state alone.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronDown, ChevronRight, Plus, Search } from "lucide-react";
2
+ import { ChevronDown, ChevronRight, Plus } from "lucide-react";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
4
4
  import { rendererWarn } from "../../dev-console.js";
5
5
  import { resolveNavigation } from "../../headless/index.js";
@@ -7,11 +7,13 @@ import { createLiveRefetchScheduler } from "../../hooks/live-refetch-scheduler.j
7
7
  import { lastSegment, toAppSchema, useLiveEvents, useNav, useTranslation } from "../../index.js";
8
8
  import { KumikoLink } from "../app/nav.js";
9
9
  import { useNavEntities, useNavProviders } from "../app/nav-providers-context.js";
10
+ import { DrawnSearch } from "../drawn-icons.js";
10
11
  import { NAV_ICONS } from "../icons.js";
11
12
  import { cn } from "../lib/cn.js";
12
13
  import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInput, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar, } from "../ui/sidebar.js";
13
14
  import { usePersistedNavCollapse } from "./nav-collapse-state.js";
14
15
  import { resolveParentScreenId } from "./shell-breadcrumb.js";
16
+ import { useShellNavStyle } from "./shell-style.js";
15
17
  import { useDispatchTarget } from "./target-resolver-stub.js";
16
18
  import { parseTargetFromSearchParams } from "./target-url.js";
17
19
  // Widened alias for the two lookup sites below, which index by the plain
@@ -93,6 +95,7 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
93
95
  revealOnScreenChange(revealScreenId, path);
94
96
  }, [revealScreenId, revealOnScreenChange]);
95
97
  const t = useTranslation();
98
+ const plain = useShellNavStyle() === "plain";
96
99
  const { state: sidebarState } = useSidebar();
97
100
  const [filter, setFilter] = useState("");
98
101
  // The search box is only CSS-hidden (`group-data-[collapsible=icon]:hidden`)
@@ -104,11 +107,10 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
104
107
  }, [sidebarState]);
105
108
  const q = filter.trim().toLowerCase();
106
109
  const matches = useCallback((raw) => {
107
- const label = raw.includes(".") ? t(raw) : raw;
108
- return label.toLowerCase().includes(q);
110
+ return navLabel(t, raw).toLowerCase().includes(q);
109
111
  }, [t, q]);
110
112
  const navFilter = useMemo(() => ({ q, matches }), [q, matches]);
111
- return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: "pl-8", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
113
+ return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(DrawnSearch, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: cn("pl-8", plain && PLAIN_SEARCH_CLASS), value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree, plain).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
112
114
  }
113
115
  // The runtime badge slot is keyed by the bare nav ID. With no entry it
114
116
  // renders nothing, avoiding layout shift. shrink-0 and ml-auto move it to the
@@ -132,21 +134,30 @@ function NavBadge({ node }) {
132
134
  // A pure section is a group header without its own screen that only groups
133
135
  // its children. At the top level it becomes a SidebarGroup with a toggleable
134
136
  // GroupLabel; a node with a screen remains a clickable menu entry even when it
135
- // also has children.
136
- function isPureSection(node) {
137
+ // also has children. In the plain nav a group's createAction stays a section
138
+ // and renders as a "+" on the group label.
139
+ function isPureSection(node, plain) {
137
140
  return (node.screen === undefined &&
138
141
  node.target === undefined &&
139
142
  node.provider !== true &&
140
- node.createAction === undefined &&
143
+ (plain || node.createAction === undefined) &&
141
144
  node.children.length > 0);
142
145
  }
146
+ const PLAIN_ITEM_CLASS = "px-2.5 py-1.5 text-[13.5px] leading-[1.3] font-normal hover:bg-sidebar-foreground/10 data-[active=true]:bg-sidebar-foreground/10 data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground";
147
+ const PLAIN_GROUP_LABEL_CLASS = "justify-between rounded-none px-2.5 pt-[11px] pb-[3px] text-[10.5px] font-normal uppercase tracking-[0.07em] text-sidebar-muted";
148
+ const PLAIN_SEARCH_CLASS = "h-auto rounded-md border-0 py-[7px] text-[12.5px]";
149
+ const PLUS_BUTTON_CLASS = "flex size-5 items-center justify-center rounded-md text-sidebar-muted";
150
+ const PLAIN_PLUS_REVEAL_CLASS = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100 group-focus-within/menu-sub-item:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100";
151
+ function usePlainItemClass() {
152
+ return useShellNavStyle() === "plain" ? PLAIN_ITEM_CLASS : undefined;
153
+ }
143
154
  // Consecutive non-section entries share one <ul>, so the root gap only
144
155
  // separates blocks and not every pair of top-level leaves.
145
- function groupTopLevelRuns(nodes) {
156
+ function groupTopLevelRuns(nodes, plain) {
146
157
  const runs = [];
147
158
  let entries;
148
159
  for (const node of nodes) {
149
- if (isPureSection(node)) {
160
+ if (isPureSection(node, plain)) {
150
161
  entries = undefined;
151
162
  runs.push({ kind: "section", node });
152
163
  }
@@ -163,13 +174,16 @@ function groupTopLevelRuns(nodes) {
163
174
  // If the label contains a dot, pass it through t(): the bundle translates
164
175
  // the key; otherwise the key remains visible as a reminder of a missing
165
176
  // translation. Literal string labels are left unchanged.
177
+ function navLabel(t, raw) {
178
+ return raw.includes(".") ? t(raw) : raw;
179
+ }
166
180
  function useLabel(node) {
167
- const t = useTranslation();
168
- return node.label.includes(".") ? t(node.label) : node.label;
181
+ return navLabel(useTranslation(), node.label);
169
182
  }
170
183
  // Without an icon only the collapsed rail shows the initial letter; expanded,
171
184
  // the label stands alone.
172
185
  function NavLeadingIcon({ node, active, expanded = false, label, }) {
186
+ const plain = useShellNavStyle() === "plain";
173
187
  const iconKey = expanded && node.icon === "folder" ? "folder-open" : node.icon;
174
188
  const isKnownIcon = iconKey !== undefined && Object.hasOwn(NAV_ICONS, iconKey);
175
189
  const NavIcon = iconKey !== undefined && isKnownIcon ? NAV_ICON_LOOKUP[iconKey] : undefined;
@@ -179,8 +193,9 @@ function NavLeadingIcon({ node, active, expanded = false, label, }) {
179
193
  `registered in NAV_ICONS — falling back to the dot indicator. Check the icon key spelling.`);
180
194
  }
181
195
  }, [iconKey, isKnownIcon, node.qualifiedName]);
182
- if (NavIcon !== undefined)
183
- return _jsx(NavIcon, { "aria-hidden": "true", className: "shrink-0" });
196
+ if (NavIcon !== undefined) {
197
+ return (_jsx(NavIcon, { "aria-hidden": "true", className: cn("shrink-0", plain && "hidden group-data-[collapsible=icon]:block") }));
198
+ }
184
199
  const initial = label?.trim().charAt(0).toUpperCase();
185
200
  if (initial === undefined || initial === "")
186
201
  return null;
@@ -386,14 +401,15 @@ function TreeActionControl({ action, ariaLabel, className, dispatch, workspaceId
386
401
  function NodeActions({ node, expandable, workspaceId, }) {
387
402
  const dispatch = useDispatchTarget();
388
403
  const t = useTranslation();
404
+ const plain = useShellNavStyle() === "plain";
389
405
  const create = node.createAction;
390
406
  const actions = node.actions ?? [];
391
407
  if (create === undefined && actions.length === 0)
392
408
  return null;
393
- const label = (s) => (s.includes(".") ? t(s) : s);
394
- const btn = "flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";
409
+ const label = (s) => navLabel(t, s);
410
+ const btn = `${PLUS_BUTTON_CLASS} hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`;
395
411
  const hover = "opacity-0 group-hover/menu-item:opacity-100 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-item:opacity-100";
396
- return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: btn, dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
412
+ return (_jsxs("div", { className: cn("absolute top-1 flex items-center gap-0.5", expandable ? "right-7" : "right-1"), children: [create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: label(create.label), className: cn(btn, plain && PLAIN_PLUS_REVEAL_CLASS), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(Plus, { className: "size-3.5" }) })), actions.map((a) => (_jsx(TreeActionControl, { action: a, ariaLabel: label(a.label), className: cn(btn, hover), dispatch: dispatch, workspaceId: workspaceId, children: _jsx(ActionGlyph, { icon: a.icon }) }, a.label)))] }));
397
413
  }
398
414
  // Status lines within a provider sub-list (lazy loading or error).
399
415
  function ProviderStatus({ loading, error, }) {
@@ -410,6 +426,11 @@ function ProviderStatus({ loading, error, }) {
410
426
  // on items with children, not on the section itself.
411
427
  function NavSection({ node, collapsed, onToggle }) {
412
428
  const displayLabel = useLabel(node);
429
+ const t = useTranslation();
430
+ const nav = useNav();
431
+ const dispatch = useDispatchTarget();
432
+ const plain = useShellNavStyle() === "plain";
433
+ const create = node.createAction;
413
434
  const { q, matches } = useContext(NavFilterContext);
414
435
  // Provider children are statically empty until loaded, so they keep the
415
436
  // section visible; their matches cannot be checked statically, and the node
@@ -419,7 +440,7 @@ function NavSection({ node, collapsed, onToggle }) {
419
440
  !node.children.some((c) => c.provider === true || subtreeMatches(c, matches))) {
420
441
  return null;
421
442
  }
422
- return (_jsxs(SidebarGroup, { children: [_jsx(SidebarGroupLabel, { children: displayLabel }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
443
+ return (_jsxs(SidebarGroup, { children: [_jsxs(SidebarGroupLabel, { className: plain ? PLAIN_GROUP_LABEL_CLASS : undefined, children: [displayLabel, plain && create !== undefined && (_jsx(TreeActionControl, { action: create, ariaLabel: navLabel(t, create.label), className: `${PLUS_BUTTON_CLASS} hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground`, dispatch: dispatch, workspaceId: nav.route?.workspaceId, children: _jsx(Plus, { className: "size-3.5" }) }))] }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: node.children.map((child) => (_jsx(NavMenuNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName))) }) })] }));
423
444
  }
424
445
  // A menu entry (top-level item or section child) supports three click modes:
425
446
  // `screen` is a route link (KumikoLink), `target` dispatches to EditorPanel
@@ -432,19 +453,20 @@ function NavMenuNode({ node, collapsed, onToggle }) {
432
453
  const t = useTranslation();
433
454
  const dispatch = useDispatchTarget();
434
455
  const s = useNavNodeState(node, collapsed);
456
+ const itemClass = usePlainItemClass();
435
457
  if (s.hidden)
436
458
  return null;
437
459
  const sub = s.isExpanded ? (_jsxs(SidebarMenuSub, { children: [_jsx(ProviderStatus, { loading: s.providerLoading, error: s.providerError }), s.childNodes.map((child) => (_jsx(NavSubNode, { node: child, collapsed: collapsed, onToggle: onToggle }, child.qualifiedName)))] })) : null;
438
460
  const chevron = s.expandable ? (_jsx(SidebarMenuAction, { "aria-label": t(s.isExpanded ? "kumiko.nav.collapse" : "kumiko.nav.expand"), "aria-expanded": s.isExpanded, onClick: () => onToggle(node.qualifiedName), children: s.isExpanded ? _jsx(ChevronDown, {}) : _jsx(ChevronRight, {}) })) : null;
439
461
  if (node.screen !== undefined) {
440
462
  const screenId = lastSegment(node.screen);
441
- return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
463
+ return (_jsxs(SidebarMenuItem, { children: [_jsx(SidebarMenuButton, { asChild: true, isActive: s.active, tooltip: s.displayLabel, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
442
464
  }
443
465
  if (node.target !== undefined) {
444
466
  const target = node.target;
445
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
467
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { isActive: s.active, className: itemClass, tooltip: s.displayLabel, onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, sub] }));
446
468
  }
447
- return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { onClick: () => {
469
+ return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { className: itemClass, onClick: () => {
448
470
  if (s.expandable)
449
471
  onToggle(node.qualifiedName);
450
472
  }, ...(s.expandable && { "aria-expanded": s.isExpanded }), children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), s.expandable &&
@@ -460,6 +482,7 @@ function NavSubNode({ node, collapsed, onToggle }) {
460
482
  const t = useTranslation();
461
483
  const dispatch = useDispatchTarget();
462
484
  const s = useNavNodeState(node, collapsed);
485
+ const itemClass = usePlainItemClass();
463
486
  if (s.hidden)
464
487
  return null;
465
488
  // Children go in their own SidebarMenuSub (<ul>): a sub-item is an <li>, so
@@ -473,13 +496,13 @@ function NavSubNode({ node, collapsed, onToggle }) {
473
496
  }, className: "absolute top-1 right-1 flex size-5 items-center justify-center rounded-md text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: s.isExpanded ? _jsx(ChevronDown, { className: "size-3.5" }) : _jsx(ChevronRight, { className: "size-3.5" }) })) : null;
474
497
  if (node.screen !== undefined) {
475
498
  const screenId = lastSegment(node.screen);
476
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
499
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs(KumikoLink, { to: { ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }, ...(s.ariaCurrent && { "aria-current": "page" }), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
477
500
  }
478
501
  if (node.target !== undefined) {
479
502
  const target = node.target;
480
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
503
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: s.active, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => dispatch(target), children: [_jsx(NavLeadingIcon, { node: node, active: s.active, label: s.displayLabel }), _jsx("span", { className: "min-w-0 truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel }), _jsx(NavBadge, { node: node })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
481
504
  }
482
- return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, children: _jsxs("button", { type: "button", onClick: () => {
505
+ return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, className: itemClass, children: _jsxs("button", { type: "button", onClick: () => {
483
506
  if (s.expandable)
484
507
  onToggle(node.qualifiedName);
485
508
  }, children: [_jsx(NavLeadingIcon, { node: node, active: false, expanded: s.isExpanded, label: s.displayLabel }), _jsx("span", { className: "truncate group-data-[collapsible=icon]:hidden", title: s.displayLabel, children: s.displayLabel })] }) }), _jsx(NodeActions, { node: node, expandable: s.expandable, workspaceId: s.workspaceId }), chevron, deeper] }));
@@ -1,5 +1,10 @@
1
1
  import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import { type ReactNode } from "react";
3
- export declare function NotificationBell({ screens, }: {
2
+ import { type ReactNode, type RefObject } from "react";
3
+ export declare function NotificationBell({ screens, menuEntry, }: {
4
4
  readonly screens: readonly ScreenDefinition[];
5
+ /** Inside the header overflow menu: a menu row instead of the bell button; the list opens at `anchorRef` and survives the menu closing via `onSelect`. */
6
+ readonly menuEntry?: {
7
+ readonly anchorRef: RefObject<HTMLElement | null>;
8
+ readonly onSelect: () => void;
9
+ };
5
10
  }): ReactNode;
@@ -1,18 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Bell } from "lucide-react";
3
3
  import { Popover as PopoverPrimitive } from "radix-ui";
4
4
  import { useState } from "react";
5
5
  import { lastSegment, useLocale, useNav, useTranslation } from "../../index.js";
6
6
  import { useRelativeTimeFormatter } from "../app/relative-time.js";
7
7
  import { cn } from "../lib/cn.js";
8
+ import { headerOverflowMenuItemClass } from "./header-overflow-menu.js";
8
9
  import { useInAppInbox } from "./use-in-app-inbox.js";
9
10
  const MAX_BADGE_COUNT = 99;
10
- const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-input " +
11
- "bg-background text-foreground shadow-xs transition-colors hover:bg-accent " +
11
+ const triggerClass = "relative inline-flex size-8 shrink-0 items-center justify-center rounded-md " +
12
+ "text-foreground-secondary transition-colors hover:bg-accent " +
12
13
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
13
14
  const panelClass = "z-50 flex max-h-[28rem] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-md border " +
14
15
  "bg-popover text-popover-foreground shadow-md";
15
- export function NotificationBell({ screens, }) {
16
+ export function NotificationBell({ screens, menuEntry, }) {
16
17
  const t = useTranslation();
17
18
  const nav = useNav();
18
19
  const locale = useLocale().locale();
@@ -35,5 +36,15 @@ export function NotificationBell({ screens, }) {
35
36
  setOpen(false);
36
37
  nav.navigate(target.entityId === undefined ? { screenId } : { screenId, entityId: target.entityId });
37
38
  };
38
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute -right-1.5 -top-1.5 flex min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-4 text-destructive-foreground", children: badge }))] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) })] }));
39
+ const panel = (_jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 6, className: panelClass, ...(menuEntry !== undefined && {
40
+ // Without a Trigger Radix has nothing to refocus; the keyboard user returns to the menu button.
41
+ onCloseAutoFocus: (event) => {
42
+ event.preventDefault();
43
+ menuEntry.anchorRef.current?.focus();
44
+ },
45
+ }), children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsx("h2", { className: "text-sm font-semibold", children: t("kumiko.notifications.title") }), inbox.unreadCount > 0 && (_jsx("button", { type: "button", className: "text-xs text-primary hover:underline", onClick: () => void inbox.markAllRead(), children: t("kumiko.notifications.markAllRead") }))] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [inbox.failed && (_jsx("p", { role: "alert", className: "px-3 py-4 text-sm text-destructive", children: t("kumiko.notifications.loadFailed") })), !inbox.failed && !inbox.loading && inbox.rows.length === 0 && (_jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: t("kumiko.notifications.empty") })), _jsx("ul", { children: inbox.rows.map((row) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-unread": row.isRead ? undefined : "true", className: "flex w-full items-start gap-2 border-b border-border px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none", onClick: () => void openRow(row), children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-1.5 size-2 shrink-0 rounded-full", row.isRead ? "bg-transparent" : "bg-primary") }), !row.isRead && (_jsx("span", { className: "sr-only", children: t("kumiko.notifications.unread") })), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm", !row.isRead && "font-semibold"), children: row.title }), row.body !== null && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: row.body })), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRelative(Date.parse(row.createdAt)) })] })] }) }, row.id))) }), inbox.hasMore && (_jsx("button", { type: "button", className: "w-full px-3 py-2 text-sm text-primary hover:bg-accent", onClick: () => void inbox.loadMore(), children: t("kumiko.notifications.loadMore") }))] })] }) }));
46
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [menuEntry === undefined ? (_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": label, "data-kumiko-layout": "notification-bell", className: triggerClass, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "absolute right-[3px] top-[3px] rounded-full bg-destructive px-1 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] }) })) : (_jsxs(_Fragment, { children: [_jsx(PopoverPrimitive.Anchor, { virtualRef: menuEntry.anchorRef }), _jsxs("button", { type: "button", role: "menuitem", "data-testid": "notification-bell-menu-item", className: headerOverflowMenuItemClass, onClick: () => {
47
+ setOpen(true);
48
+ menuEntry.onSelect();
49
+ }, children: [_jsx(Bell, { className: "size-4", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t("kumiko.notifications.label") }), inbox.unreadCount > 0 && (_jsx("span", { "data-kumiko-layout": "notification-bell-badge", className: "rounded-full bg-destructive px-1.5 py-0.5 text-[9.5px] font-semibold leading-none text-destructive-foreground", children: badge }))] })] })), panel] }));
39
50
  }
@@ -2,15 +2,15 @@ import { type ReactNode } from "react";
2
2
  type ShellFocusContextValue = {
3
3
  readonly focused: boolean;
4
4
  readonly register: () => () => void;
5
- readonly topbarActions?: ReactNode;
6
5
  };
7
6
  export declare const ShellFocusProvider: import("react").Provider<ShellFocusContextValue | null>;
7
+ export declare const ShellTopbarActionsProvider: import("react").Provider<ReactNode>;
8
8
  export type ShellFocusHost = {
9
9
  readonly focused: boolean;
10
10
  readonly value: ShellFocusContextValue;
11
11
  };
12
12
  /** Shell side: holds the focus counter. */
13
- export declare function useShellFocusHost(topbarActions?: ReactNode): ShellFocusHost;
13
+ export declare function useShellFocusHost(): ShellFocusHost;
14
14
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
15
15
  export declare function useShellFocused(): boolean;
16
16
  /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
@@ -7,15 +7,19 @@
7
7
  import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useState, } from "react";
8
8
  const ShellFocusContext = createContext(null);
9
9
  export const ShellFocusProvider = ShellFocusContext.Provider;
10
+ // Own context: the shell builds this element anew on every render, which would otherwise
11
+ // re-render every ShellFocusContext consumer along with it.
12
+ const ShellTopbarActionsContext = createContext(undefined);
13
+ export const ShellTopbarActionsProvider = ShellTopbarActionsContext.Provider;
10
14
  /** Shell side: holds the focus counter. */
11
- export function useShellFocusHost(topbarActions) {
15
+ export function useShellFocusHost() {
12
16
  const [holders, setHolders] = useState(0);
13
17
  const register = useCallback(() => {
14
18
  setHolders((count) => count + 1);
15
19
  return () => setHolders((count) => count - 1);
16
20
  }, []);
17
21
  const focused = holders > 0;
18
- const value = useMemo(() => ({ focused, register, topbarActions }), [focused, register, topbarActions]);
22
+ const value = useMemo(() => ({ focused, register }), [focused, register]);
19
23
  return { focused, value };
20
24
  }
21
25
  /** True while any mounted screen holds focus mode (always false outside DefaultAppShell). */
@@ -24,7 +28,7 @@ export function useShellFocused() {
24
28
  }
25
29
  /** The shell's topbarActions, for focused screens whose MobileTopBar replaces the shell header. */
26
30
  export function useShellTopbarActions() {
27
- return useContext(ShellFocusContext)?.topbarActions;
31
+ return useContext(ShellTopbarActionsContext);
28
32
  }
29
33
  /** Screen side: call while the screen is mounted to get the focused shell. No-op without a DefaultAppShell. */
30
34
  export function useShellFocusMode() {
@@ -4,10 +4,11 @@ type ShellHeaderUser = {
4
4
  readonly id: string;
5
5
  readonly roles: readonly string[];
6
6
  };
7
- export declare function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, }: {
7
+ export declare function ShellHeader({ schema, user, headerActions: appHeaderActions, allowedNavQns, notificationBellPlacement, }: {
8
8
  readonly schema: AppSchema | FeatureSchema;
9
9
  readonly user?: ShellHeaderUser;
10
10
  readonly headerActions?: ReactNode;
11
11
  readonly allowedNavQns?: ReadonlySet<string>;
12
+ readonly notificationBellPlacement?: "header" | "overflow";
12
13
  }): ReactNode;
13
14
  export {};