@shellui/core 0.7.0-alpha.10 → 0.7.0-alpha.12

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 (46) hide show
  1. package/package.json +2 -2
  2. package/src/components/ui/drawer.tsx +47 -30
  3. package/src/components/ui/sheet.tsx +18 -12
  4. package/src/components/ui/shell-divider.spec.tsx +63 -0
  5. package/src/components/ui/shell-divider.tsx +20 -0
  6. package/src/components/ui/sidebar.tsx +15 -7
  7. package/src/components/ui/tooltip.tsx +4 -2
  8. package/src/features/auth/components/LoginButton.spec.tsx +203 -0
  9. package/src/features/auth/components/LoginButton.tsx +77 -28
  10. package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
  11. package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
  12. package/src/features/layouts/OverlayShell.tsx +58 -40
  13. package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
  14. package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
  15. package/src/features/layouts/appbar/AppBarLayout.tsx +53 -81
  16. package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
  17. package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
  18. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +1 -1
  19. package/src/features/layouts/chrome/constants.ts +3 -0
  20. package/src/features/layouts/chrome/viewport.ts +11 -4
  21. package/src/features/layouts/floating/FloatingBottomDock.tsx +67 -26
  22. package/src/features/layouts/floating/FloatingLayout.tsx +1 -0
  23. package/src/features/layouts/floating/FloatingSidebar.tsx +43 -20
  24. package/src/features/layouts/floating/moreSections.spec.ts +28 -0
  25. package/src/features/layouts/floating/moreSections.ts +31 -0
  26. package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
  27. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +10 -1
  28. package/src/features/layouts/sidebar/NavigationContent.tsx +4 -4
  29. package/src/features/layouts/sidebar/SidebarIcons.tsx +67 -0
  30. package/src/features/layouts/sidebar/SidebarInner.spec.tsx +149 -0
  31. package/src/features/layouts/sidebar/SidebarInner.tsx +60 -11
  32. package/src/features/layouts/sidebar/SidebarLayout.tsx +23 -13
  33. package/src/features/layouts/windows/WindowsLayout.tsx +93 -47
  34. package/src/features/layouts/windows/deskDots.spec.ts +6 -4
  35. package/src/features/layouts/windows/deskDots.ts +8 -8
  36. package/src/features/overlays/ResponsiveModal.tsx +5 -3
  37. package/src/features/overlays/overlaySize.spec.ts +56 -16
  38. package/src/features/overlays/overlaySize.ts +114 -31
  39. package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
  40. package/src/features/overlays/useOverlayReportedSize.ts +8 -3
  41. package/src/i18n/translations/en/common.json +1 -0
  42. package/src/i18n/translations/fr/common.json +1 -0
  43. package/src/index.css +232 -42
  44. package/src/service-worker/devCaches.spec.ts +32 -0
  45. package/src/service-worker/devCaches.ts +27 -0
  46. package/src/service-worker/sw-dev.ts +23 -23
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import type { NavigationGroup, NavigationItem } from '../../config/types';
3
+ import { groupMoreItems } from './moreSections';
4
+
5
+ const item = (path: string): NavigationItem => ({ path, url: `/${path}`, label: path });
6
+
7
+ describe('groupMoreItems', () => {
8
+ const files = item('files');
9
+ const members = item('members');
10
+ const roles = item('roles');
11
+ const help = item('help');
12
+ const team: NavigationGroup = { title: 'Team', items: [members, roles] };
13
+ const tree = [item('home'), files, team, help];
14
+
15
+ it('labels the runs that belong to a group and keeps the order', () => {
16
+ const sections = groupMoreItems([files, members, roles, help], tree);
17
+ expect(sections.map((s) => s.group?.title ?? null)).toEqual([null, 'Team', null]);
18
+ expect(sections[1].items).toEqual([members, roles]);
19
+ });
20
+
21
+ it('returns one unlabelled section when nothing is grouped', () => {
22
+ expect(groupMoreItems([files, help], tree)).toEqual([{ group: null, items: [files, help] }]);
23
+ });
24
+
25
+ it('returns nothing for an empty overflow', () => {
26
+ expect(groupMoreItems([], tree)).toEqual([]);
27
+ });
28
+ });
@@ -0,0 +1,31 @@
1
+ import type { NavigationGroup, NavigationItem } from '../../config/types';
2
+
3
+ export interface MoreSection {
4
+ /** Group the items came from, or null for top-level links. */
5
+ group: NavigationGroup | null;
6
+ items: NavigationItem[];
7
+ }
8
+
9
+ /**
10
+ * Split the More overflow into runs that share a navigation group, so the
11
+ * sheet and the tablet menu can show each group's label (order is kept).
12
+ */
13
+ export function groupMoreItems(
14
+ overflow: NavigationItem[],
15
+ tree: (NavigationItem | NavigationGroup)[],
16
+ ): MoreSection[] {
17
+ const owner = new Map<NavigationItem, NavigationGroup>();
18
+ for (const entry of tree) {
19
+ if ('title' in entry && 'items' in entry) {
20
+ for (const item of entry.items) owner.set(item, entry);
21
+ }
22
+ }
23
+ const sections: MoreSection[] = [];
24
+ for (const item of overflow) {
25
+ const group = owner.get(item) ?? null;
26
+ const last = sections[sections.length - 1];
27
+ if (last && last.group === group) last.items.push(item);
28
+ else sections.push({ group, items: [item] });
29
+ }
30
+ return sections;
31
+ }
@@ -0,0 +1,68 @@
1
+ // @vitest-environment happy-dom
2
+ import { act } from 'react';
3
+ import { createRoot, type Root } from 'react-dom/client';
4
+ import { MemoryRouter } from 'react-router';
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
6
+ import { FullscreenLayout } from './FullscreenLayout';
7
+
8
+ const env = { mac: false, root: true };
9
+
10
+ vi.mock('react-i18next', () => ({ useTranslation: () => ({ i18n: { language: 'en' } }) }));
11
+ vi.mock('../chrome/runtime', () => ({
12
+ useIsTauriClient: () => env.mac,
13
+ useMacOverlayChrome: () => env.mac,
14
+ useMacTrafficLights: () => env.mac,
15
+ }));
16
+ vi.mock('../chrome/DesktopHistoryButtons', () => ({ DesktopHistoryButtons: () => null }));
17
+ vi.mock('../chrome/SafeAreaTopbar', () => ({ isShellUiRootWindow: () => env.root }));
18
+
19
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
20
+
21
+ let container: HTMLDivElement;
22
+ let root: Root;
23
+
24
+ beforeEach(() => {
25
+ env.mac = false;
26
+ env.root = true;
27
+ container = document.createElement('div');
28
+ document.body.appendChild(container);
29
+ root = createRoot(container);
30
+ });
31
+
32
+ afterEach(() => {
33
+ act(() => root.unmount());
34
+ container.remove();
35
+ });
36
+
37
+ function main(): HTMLElement {
38
+ act(() =>
39
+ root.render(
40
+ <MemoryRouter>
41
+ <FullscreenLayout navigation={[]}>
42
+ <p>content</p>
43
+ </FullscreenLayout>
44
+ </MemoryRouter>,
45
+ ),
46
+ );
47
+ const el = container.querySelector<HTMLElement>('[data-shellui-fullscreen]');
48
+ if (!el) throw new Error('missing main');
49
+ return el;
50
+ }
51
+
52
+ describe('FullscreenLayout safe areas', () => {
53
+ it('pads the root window for the notch and home indicator', () => {
54
+ expect(main().className).toContain('shellui-fullscreen-safe');
55
+ });
56
+
57
+ it('does not pad again inside a nested shell iframe', () => {
58
+ env.root = false;
59
+ expect(main().className).not.toContain('shellui-fullscreen-safe');
60
+ });
61
+
62
+ it('keeps the macOS strip padding instead', () => {
63
+ env.mac = true;
64
+ const el = main();
65
+ expect(el.className).not.toContain('shellui-fullscreen-safe');
66
+ expect(el.style.paddingTop).toBe('48px');
67
+ });
68
+ });
@@ -13,6 +13,8 @@ import {
13
13
  SHELL_HEADER_PAD_TOP_PX,
14
14
  } from '../chrome/constants';
15
15
  import { MAC_DRAG_REGION_PROPS, MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
16
+ import { isShellUiRootWindow } from '../chrome/SafeAreaTopbar';
17
+ import { cn } from '../../../lib/utils';
16
18
 
17
19
  /** macOS: content starts under the 32px strip plus 16px. */
18
20
  const MAC_CONTENT_PAD_TOP_PX = 48;
@@ -39,6 +41,8 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
39
41
  const trafficLights = useMacTrafficLights();
40
42
  const macStrip = useMacOverlayChrome();
41
43
  const currentLanguage = i18n.language || 'en';
44
+ // Nested shell-in-iframe: the root window already cleared the safe areas.
45
+ const safeAreaPad = isShellUiRootWindow();
42
46
  const navigationItems = useMemo(() => flattenNavigationItems(navigation), [navigation]);
43
47
 
44
48
  useEffect(() => {
@@ -60,7 +64,12 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
60
64
 
61
65
  return (
62
66
  <main
63
- className="relative flex h-full max-h-full w-full flex-col overflow-hidden bg-background"
67
+ data-shellui-fullscreen=""
68
+ className={cn(
69
+ 'relative flex h-full max-h-full w-full flex-col overflow-hidden bg-background',
70
+ // Phones: clear the notch and home indicator (nothing higher up pads them).
71
+ !macStrip && safeAreaPad && 'shellui-fullscreen-safe',
72
+ )}
64
73
  style={macStrip ? { paddingTop: MAC_CONTENT_PAD_TOP_PX } : undefined}
65
74
  >
66
75
  {macStrip ? (
@@ -148,7 +148,7 @@ export function NavigationContent({
148
148
 
149
149
  if (sections.length === 0 && trailingItem) {
150
150
  return (
151
- <SidebarGroup className="mt-0">
151
+ <SidebarGroup className="mt-0 px-2 py-0">
152
152
  <SidebarGroupContent>
153
153
  <SidebarMenu className="gap-0.5">{trailingItem}</SidebarMenu>
154
154
  </SidebarGroupContent>
@@ -167,9 +167,9 @@ export function NavigationContent({
167
167
  return (
168
168
  <SidebarGroup
169
169
  key={`group-${groupTitle}-${sectionIndex}`}
170
- className="mt-0"
170
+ className="mt-0 px-2 py-0"
171
171
  >
172
- <SidebarGroupLabel className="shellui-nav-label mb-1">{groupTitle}</SidebarGroupLabel>
172
+ <SidebarGroupLabel className="shellui-nav-label">{groupTitle}</SidebarGroupLabel>
173
173
  <SidebarGroupContent>
174
174
  <SidebarMenu className="gap-0.5">
175
175
  {section.group.items.map((navItem) => (
@@ -185,7 +185,7 @@ export function NavigationContent({
185
185
  return (
186
186
  <SidebarGroup
187
187
  key={`items-${section.items.map((i) => i.path).join('-')}-${sectionIndex}`}
188
- className="mt-0"
188
+ className="mt-0 px-2 py-0"
189
189
  >
190
190
  <SidebarGroupContent>
191
191
  <SidebarMenu className="gap-0.5">
@@ -23,6 +23,73 @@ export function ExternalLinkIcon({ className }: { className?: string }) {
23
23
  );
24
24
  }
25
25
 
26
+ function LucideSvg({ className, children }: { className?: string; children: React.ReactNode }) {
27
+ return (
28
+ <svg
29
+ xmlns="http://www.w3.org/2000/svg"
30
+ width="24"
31
+ height="24"
32
+ viewBox="0 0 24 24"
33
+ fill="none"
34
+ stroke="currentColor"
35
+ strokeWidth="2"
36
+ strokeLinecap="round"
37
+ strokeLinejoin="round"
38
+ className={cn('shrink-0', className)}
39
+ aria-hidden
40
+ >
41
+ {children}
42
+ </svg>
43
+ );
44
+ }
45
+
46
+ /** lucide x */
47
+ export function CloseIcon({ className }: { className?: string }) {
48
+ return (
49
+ <LucideSvg className={className}>
50
+ <path d="M18 6 6 18" />
51
+ <path d="m6 6 12 12" />
52
+ </LucideSvg>
53
+ );
54
+ }
55
+
56
+ /** lucide ellipsis */
57
+ export function EllipsisIcon({ className }: { className?: string }) {
58
+ return (
59
+ <LucideSvg className={className}>
60
+ <circle
61
+ cx="12"
62
+ cy="12"
63
+ r="1"
64
+ />
65
+ <circle
66
+ cx="19"
67
+ cy="12"
68
+ r="1"
69
+ />
70
+ <circle
71
+ cx="5"
72
+ cy="12"
73
+ r="1"
74
+ />
75
+ </LucideSvg>
76
+ );
77
+ }
78
+
79
+ /** Settings gear (same glyph as the account menu). */
80
+ export function SettingsIcon({ className }: { className?: string }) {
81
+ return (
82
+ <LucideSvg className={className}>
83
+ <circle
84
+ cx="12"
85
+ cy="12"
86
+ r="3"
87
+ />
88
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
89
+ </LucideSvg>
90
+ );
91
+ }
92
+
26
93
  /** Default nav icon when a navigation item has no custom icon. */
27
94
  export function DefaultNavIcon({ className }: { className?: string }) {
28
95
  return (
@@ -0,0 +1,149 @@
1
+ // @vitest-environment happy-dom
2
+ import { act, type ReactNode } from 'react';
3
+ import { createRoot, type Root } from 'react-dom/client';
4
+ import { MemoryRouter } from 'react-router';
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
6
+ import en from '../../../i18n/translations/en/common.json';
7
+ import fr from '../../../i18n/translations/fr/common.json';
8
+ import { SIDEBAR_PANEL_ID, SidebarProvider, SidebarTrigger } from '../../../components/ui/sidebar';
9
+ import { SidebarInner } from './SidebarInner';
10
+
11
+ const mobile = { value: false };
12
+
13
+ vi.mock('../../../hooks/use-mobile', () => ({ useIsMobile: () => mobile.value }));
14
+ vi.mock('../chrome/runtime', () => ({
15
+ useIsTauriClient: () => false,
16
+ useMacOverlayChrome: () => false,
17
+ useMacTrafficLights: () => false,
18
+ }));
19
+ vi.mock('./NavigationContent', () => ({
20
+ NavigationContent: ({ trailing }: { trailing?: ReactNode }) => trailing ?? null,
21
+ }));
22
+ vi.mock('../../config/useConfig', () => ({ useConfig: () => ({ config: {} }) }));
23
+ vi.mock('../../auth/components/LoginButton', () => ({
24
+ LoginButton: ({ dividerAbove }: { dividerAbove?: boolean }) => (
25
+ <span
26
+ data-login=""
27
+ data-divider={String(Boolean(dividerAbove))}
28
+ />
29
+ ),
30
+ }));
31
+ vi.mock('react-i18next', () => ({
32
+ useTranslation: () => ({
33
+ t: (key: string) => {
34
+ const [group, leaf] = key.split('.') as [keyof typeof en, string];
35
+ return (en[group] as Record<string, string>)[leaf] ?? key;
36
+ },
37
+ }),
38
+ }));
39
+
40
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
41
+
42
+ let container: HTMLDivElement;
43
+ let root: Root;
44
+
45
+ beforeEach(() => {
46
+ mobile.value = false;
47
+ container = document.createElement('div');
48
+ document.body.appendChild(container);
49
+ root = createRoot(container);
50
+ });
51
+
52
+ afterEach(() => {
53
+ act(() => root.unmount());
54
+ container.remove();
55
+ });
56
+
57
+ function render(node: React.ReactNode, open = true) {
58
+ act(() => {
59
+ root.render(
60
+ <MemoryRouter>
61
+ <SidebarProvider defaultOpen={open}>{node}</SidebarProvider>
62
+ </MemoryRouter>,
63
+ );
64
+ });
65
+ }
66
+
67
+ function q<T extends Element = HTMLElement>(scope: ParentNode, sel: string): T {
68
+ const el = scope.querySelector<T>(sel);
69
+ if (!el) throw new Error(`missing ${sel}`);
70
+ return el;
71
+ }
72
+
73
+ const inner = (
74
+ <SidebarInner
75
+ startNav={[]}
76
+ endItems={[]}
77
+ showAuthButton={false}
78
+ title="Acme"
79
+ appIcon="/icon.svg"
80
+ />
81
+ );
82
+
83
+ describe('SidebarTrigger', () => {
84
+ it('reports aria-expanded and aria-controls', () => {
85
+ render(<SidebarTrigger />);
86
+ const btn = q<HTMLButtonElement>(container, 'button');
87
+ expect(btn.getAttribute('aria-controls')).toBe(SIDEBAR_PANEL_ID);
88
+ expect(btn.getAttribute('aria-expanded')).toBe('true');
89
+ act(() => btn.click());
90
+ expect(btn.getAttribute('aria-expanded')).toBe('false');
91
+ });
92
+ });
93
+
94
+ describe('SidebarInner header', () => {
95
+ it('shows the app name next to the logo, with no border under the header', () => {
96
+ render(inner);
97
+ const header = q(container, '[data-sidebar="header"]');
98
+ expect(header.textContent).toContain('Acme');
99
+ expect(header.className).not.toContain('border-b');
100
+ expect(q(header, 'span.truncate').className).toContain(
101
+ 'group-data-[collapsible=icon]:opacity-0',
102
+ );
103
+ });
104
+
105
+ it('mobile sheet header is 52px with a labelled close button', () => {
106
+ mobile.value = true;
107
+ render(inner);
108
+ const header = q(container, '[data-sidebar="header"]');
109
+ expect(header.style.height).toBe('52px');
110
+ const close = q(header, 'button');
111
+ expect(close.getAttribute('aria-label')).toBe('Close menu');
112
+ expect(header.textContent).toContain('Acme');
113
+ });
114
+
115
+ it('has the close label in French', () => {
116
+ expect(fr.shellChrome.closeMenu).toBe('Fermer le menu');
117
+ });
118
+ });
119
+
120
+ describe('SidebarInner footer account divider', () => {
121
+ const footer = (endItems: { label: string; path: string; url: string }[]) => (
122
+ <SidebarInner
123
+ startNav={[]}
124
+ endItems={endItems}
125
+ showAuthButton
126
+ title="Acme"
127
+ />
128
+ );
129
+
130
+ it('asks for a divider when footer items sit above the account block', () => {
131
+ render(footer([{ label: 'Settings', path: 'settings', url: '/settings' }]));
132
+ expect(q(container, '[data-login]').getAttribute('data-divider')).toBe('true');
133
+ });
134
+
135
+ it('opens the footer with the shared full-width divider instead of a border', () => {
136
+ render(footer([]));
137
+ const foot = q(container, '[data-shellui-nav-footer]');
138
+ expect(foot.className).not.toContain('border-t');
139
+ const first = foot.firstElementChild;
140
+ expect(first?.getAttribute('data-shellui-divider')).toBe('');
141
+ expect(first?.className).toContain('shellui-divider');
142
+ expect(first?.hasAttribute('data-shellui-footer-divider')).toBe(true);
143
+ });
144
+
145
+ it('skips the account divider when the account block is the only footer item', () => {
146
+ render(footer([]));
147
+ expect(q(container, '[data-login]').getAttribute('data-divider')).toBe('false');
148
+ });
149
+ });
@@ -7,7 +7,9 @@ import {
7
7
  SidebarTrigger,
8
8
  useSidebar,
9
9
  } from '../../../components/ui/sidebar';
10
+ import { CloseIcon } from './SidebarIcons';
10
11
  import { NavigationContent } from './NavigationContent';
12
+ import { ShellDivider } from '../../../components/ui/shell-divider';
11
13
  import { LoginButton } from '../../auth/components/LoginButton';
12
14
  import { cn } from '../../../lib/utils';
13
15
  import { MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
@@ -22,6 +24,9 @@ import {
22
24
  } from '../chrome/constants';
23
25
  import { AppBrandIcon } from '../branding/AppBrandIcon';
24
26
 
27
+ /** Mobile sheet brand row height (spec: 52px). */
28
+ const MOBILE_SHEET_HEADER_HEIGHT_PX = 52;
29
+
25
30
  /** Reusable sidebar inner: header, main nav, footer. Used in desktop Sidebar and mobile Sheet. */
26
31
  export function SidebarInner({
27
32
  startNav,
@@ -43,7 +48,7 @@ export function SidebarInner({
43
48
  const isTauriEnv = useIsTauriClient();
44
49
  const overlay = useMacOverlayChrome();
45
50
  const trafficLights = useMacTrafficLights();
46
- const { state, isMobile } = useSidebar();
51
+ const { state, isMobile, setOpenMobile } = useSidebar();
47
52
  const collapsed = state === 'collapsed' && !isMobile;
48
53
  // Collapsed Tauri: Back + trigger live in CollapsedDesktopTitlebar instead.
49
54
  const showCollapsedTopBar = overlay && collapsed;
@@ -85,16 +90,28 @@ export function SidebarInner({
85
90
  <SidebarHeader
86
91
  className={cn(
87
92
  // Always pin to titlebar height — default SidebarHeader p-2 is taller on web.
88
- 'gap-0 border-b border-sidebar-border select-none',
93
+ 'gap-0 select-none',
89
94
  showOverlayHeader || mobileSheetHeader ? 'p-0' : 'px-2 py-0',
95
+ // Mobile sheet: brand row with a close button, 14px left like the mock.
96
+ isMobile && !mobileSheetHeader && 'pr-2 pl-3.5',
90
97
  showCollapsedTopBar && 'hidden',
91
98
  // Inset `p-3` sits this row 12px under the lights. Pull it to the window edge.
92
99
  inset && showOverlayHeader && '-mt-3 -ml-3 w-[calc(100%+1.5rem)]',
100
+ // Web: same pull, so the brand row lines up with the plain sidebar header.
101
+ inset && !showOverlayHeader && !isMobile && '-mt-3 -ml-3 w-[calc(100%+0.75rem)] pl-5',
93
102
  )}
94
103
  style={{
95
104
  // macOS: the header is the 32px strip. Web, phones and caption bar hosts: 42px.
96
- height: showOverlayHeader ? DESKTOP_TITLEBAR_HEIGHT_PX : SHELL_HEADER_HEIGHT_PX,
97
- paddingTop: showOverlayHeader ? DESKTOP_TITLEBAR_PAD_TOP_PX : SHELL_HEADER_PAD_TOP_PX,
105
+ height: showOverlayHeader
106
+ ? DESKTOP_TITLEBAR_HEIGHT_PX
107
+ : isMobile
108
+ ? MOBILE_SHEET_HEADER_HEIGHT_PX
109
+ : SHELL_HEADER_HEIGHT_PX,
110
+ paddingTop: showOverlayHeader
111
+ ? DESKTOP_TITLEBAR_PAD_TOP_PX
112
+ : isMobile
113
+ ? 0
114
+ : SHELL_HEADER_PAD_TOP_PX,
98
115
  ...(mobileSheetHeader ? { paddingLeft: mobileTrafficInset } : {}),
99
116
  }}
100
117
  {...(showOverlayHeader
@@ -137,40 +154,72 @@ export function SidebarInner({
137
154
  {hasAppIcon ? trailingInset : null}
138
155
  </div>
139
156
  </div>
157
+ ) : isMobile ? (
158
+ <div className="flex h-full w-full items-center gap-1.5">
159
+ {brandIcon}
160
+ <span
161
+ aria-hidden
162
+ className="min-w-0 flex-1 truncate text-sm font-semibold text-sidebar-foreground"
163
+ >
164
+ {title}
165
+ </span>
166
+ <button
167
+ type="button"
168
+ aria-label={t('shellChrome.closeMenu')}
169
+ onClick={() => setOpenMobile(false)}
170
+ className="inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-[var(--shellui-r-row)] text-[var(--shellui-nav-icon)] hover:bg-[var(--shellui-nav-hover)] hover:text-sidebar-foreground focus-visible:outline-2 focus-visible:outline-[var(--sidebar-ring)]"
171
+ >
172
+ <CloseIcon className="size-5" />
173
+ </button>
174
+ </div>
140
175
  ) : (
141
176
  <div className={cn('flex h-full w-full items-center', hasAppIcon ? 'gap-0' : 'gap-0.5')}>
142
177
  {brandIcon}
143
178
  {hasAppIcon ? (
144
179
  <div
145
180
  aria-hidden
146
- className="min-w-0 flex-1"
147
- />
181
+ className="min-w-0 flex-1 overflow-hidden"
182
+ >
183
+ {title ? (
184
+ <span className="block truncate pl-2 text-sm font-semibold text-sidebar-foreground transition-opacity duration-200 ease-linear group-data-[collapsible=icon]:opacity-0 motion-reduce:transition-none">
185
+ {title}
186
+ </span>
187
+ ) : null}
188
+ </div>
148
189
  ) : null}
149
190
  <SidebarTrigger className="size-7 shrink-0 touch-manipulation" />
150
191
  {trailingInset}
151
192
  </div>
152
193
  )}
153
194
  </SidebarHeader>
154
- <SidebarContent className="shellui-nav gap-1">
195
+ <SidebarContent className="shellui-nav gap-0">
155
196
  <nav
156
197
  aria-label={t('shellChrome.mainNav')}
157
- className="flex min-w-0 flex-col gap-1"
198
+ className="flex min-w-0 flex-col gap-0.5 py-2"
158
199
  >
159
200
  <NavigationContent navigation={startNav} />
160
201
  </nav>
161
202
  </SidebarContent>
162
203
  <SidebarFooter
163
204
  data-shellui-nav-footer=""
164
- className="shellui-nav gap-0 border-t border-sidebar-border px-0 pt-0 pb-[max(0.5rem,var(--shellui-safe-area-bottom))]"
205
+ className="shellui-nav gap-0 px-0 pt-0 pb-[max(0.5rem,var(--shellui-safe-area-bottom))]"
165
206
  >
207
+ <ShellDivider data-shellui-footer-divider="" />
166
208
  {(endItems.length > 0 || showAuthButton) && (
167
209
  <nav
168
210
  aria-label={t('shellChrome.accountNav')}
169
- className="flex min-w-0 flex-col"
211
+ className="flex min-w-0 flex-col gap-0.5 pt-1.5 pb-1"
170
212
  >
171
213
  <NavigationContent
172
214
  navigation={endItems}
173
- trailing={showAuthButton ? <LoginButton variant="sidebar" /> : undefined}
215
+ trailing={
216
+ showAuthButton ? (
217
+ <LoginButton
218
+ variant="sidebar"
219
+ dividerAbove={endItems.length > 0}
220
+ />
221
+ ) : undefined
222
+ }
174
223
  />
175
224
  </nav>
176
225
  )}
@@ -36,11 +36,7 @@ import {
36
36
  import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
37
37
  import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
38
38
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
39
- import {
40
- MAC_LIGHTS_SAFE_PX,
41
- SHELL_HEADER_HEIGHT_PX,
42
- SHELL_HEADER_PAD_TOP_PX,
43
- } from '../chrome/constants';
39
+ import { MAC_LIGHTS_SAFE_PX, MOBILE_SIDEBAR_HEADER_HEIGHT_PX } from '../chrome/constants';
44
40
  import { WindowTitleBarActions } from '../../chromeActions';
45
41
  import { cn } from '../../../lib/utils';
46
42
 
@@ -106,6 +102,7 @@ const SidebarLayoutContent = ({
106
102
  const { chromeVisible } = useScrollHideChrome({
107
103
  enabled: isMobile,
108
104
  layout: scrollHideLayout,
105
+ barHeightPx: MOBILE_SIDEBAR_HEADER_HEIGHT_PX,
109
106
  includeSafeArea: showSafeAreaTopbar,
110
107
  });
111
108
  const contentRef = useRef<HTMLDivElement>(null);
@@ -158,6 +155,10 @@ const SidebarLayoutContent = ({
158
155
  };
159
156
  }, [authAwareNavigation, isMobile]);
160
157
 
158
+ const pageTitle = navigationItem
159
+ ? resolveLocalizedLabel(navigationItem.label, currentLanguage)
160
+ : title;
161
+
161
162
  useEffect(() => {
162
163
  if (!title) return;
163
164
  if (navigationItem) {
@@ -233,18 +234,16 @@ const SidebarLayoutContent = ({
233
234
  <header
234
235
  data-shellui-scroll-hide-header=""
235
236
  className={cn(
236
- 'pointer-events-auto relative z-[1] flex items-center gap-0.5 px-3 select-none',
237
+ 'pointer-events-auto relative z-[1] flex items-center gap-0.5 px-1.5 select-none',
237
238
  variant === 'inset'
238
239
  ? 'border-transparent bg-transparent text-sidebar-foreground'
239
240
  : 'border-b border-border bg-background',
240
241
  )}
241
242
  style={{
242
- paddingTop: showSafeAreaTopbar
243
- ? `calc(var(--shellui-safe-area-top) + ${SHELL_HEADER_PAD_TOP_PX}px)`
244
- : SHELL_HEADER_PAD_TOP_PX,
243
+ paddingTop: showSafeAreaTopbar ? 'var(--shellui-safe-area-top)' : 0,
245
244
  height: showSafeAreaTopbar
246
- ? `calc(${SHELL_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`
247
- : SHELL_HEADER_HEIGHT_PX,
245
+ ? `calc(${MOBILE_SIDEBAR_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`
246
+ : MOBILE_SIDEBAR_HEADER_HEIGHT_PX,
248
247
  ...(mobileTrafficInset !== undefined ? { paddingLeft: mobileTrafficInset } : {}),
249
248
  }}
250
249
  {...(trafficLights
@@ -253,7 +252,7 @@ const SidebarLayoutContent = ({
253
252
  >
254
253
  <SidebarTrigger
255
254
  data-shellui-no-drag=""
256
- className="relative size-8 shrink-0 touch-manipulation text-foreground"
255
+ className="relative size-10 shrink-0 touch-manipulation text-foreground [&_svg]:size-5"
257
256
  />
258
257
  {isTauriEnv ? <DesktopHistoryButtons /> : null}
259
258
  {isMobile ? (
@@ -261,9 +260,20 @@ const SidebarLayoutContent = ({
261
260
  data-shellui-no-drag=""
262
261
  className="flex min-w-0 flex-1 items-center"
263
262
  >
264
- <WindowTitleBarActions frameUuid={frameUuid} />
263
+ <WindowTitleBarActions
264
+ frameUuid={frameUuid}
265
+ fallbackTitle={pageTitle}
266
+ centerTitle
267
+ />
265
268
  </div>
266
269
  ) : null}
270
+ {/* Balances the trigger so the title sits in the middle. */}
271
+ {isMobile && !isTauriEnv ? (
272
+ <span
273
+ aria-hidden
274
+ className="size-10 shrink-0"
275
+ />
276
+ ) : null}
267
277
  </header>
268
278
  {variant === 'inset' ? <InsetMobileRadiusOverlay /> : null}
269
279
  </div>