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

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 (69) hide show
  1. package/package.json +2 -2
  2. package/schemas/shellui.config.schema.json +37 -4
  3. package/src/components/ContentView.tsx +19 -8
  4. package/src/components/ui/sidebar.tsx +11 -5
  5. package/src/features/admin/AdminView.tsx +9 -6
  6. package/src/features/auth/AuthProvider.tsx +25 -4
  7. package/src/features/auth/appBackend/appBackendSessions.spec.ts +134 -0
  8. package/src/features/auth/appBackend/appBackendSessions.ts +168 -17
  9. package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
  10. package/src/features/auth/appBackend/childFrames.ts +180 -0
  11. package/src/features/auth/appBackend/frameAuth.ts +47 -10
  12. package/src/features/auth/appBackend/silentSignIn.spec.ts +18 -0
  13. package/src/features/auth/appBackend/silentSignIn.ts +15 -1
  14. package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
  15. package/src/features/auth/appBackend/tokenExchange.ts +76 -0
  16. package/src/features/auth/components/OAuthCallbackView.tsx +7 -5
  17. package/src/features/auth/utils/buildOAuthSessionRedirectTo.spec.ts +42 -1
  18. package/src/features/auth/utils/buildOAuthSessionRedirectTo.ts +23 -0
  19. package/src/features/auth/utils/canRestoreStoredSession.spec.ts +29 -0
  20. package/src/features/auth/utils/canRestoreStoredSession.ts +12 -0
  21. package/src/features/auth/utils/index.ts +7 -1
  22. package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
  23. package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
  24. package/src/features/auth/utils/webPkce.spec.ts +23 -0
  25. package/src/features/auth/utils/webPkce.ts +23 -6
  26. package/src/features/chromeActions/computeActionInsets.ts +7 -4
  27. package/src/features/config/types.ts +30 -4
  28. package/src/features/layouts/appbar/AppBarLayout.tsx +63 -30
  29. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +12 -23
  30. package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
  31. package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
  32. package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
  33. package/src/features/layouts/chrome/MacStrip.tsx +33 -0
  34. package/src/features/layouts/chrome/constants.ts +33 -8
  35. package/src/features/layouts/chrome/index.ts +8 -0
  36. package/src/features/layouts/chrome/stripDragMap.ts +35 -0
  37. package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
  38. package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
  39. package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
  40. package/src/features/layouts/floating/FloatingBottomDock.tsx +199 -20
  41. package/src/features/layouts/floating/FloatingLayout.tsx +13 -8
  42. package/src/features/layouts/floating/FloatingSidebar.tsx +144 -70
  43. package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
  44. package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
  45. package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
  46. package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
  47. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +38 -10
  48. package/src/features/layouts/sidebar/NavigationContent.tsx +14 -6
  49. package/src/features/layouts/sidebar/SidebarIcons.tsx +3 -9
  50. package/src/features/layouts/sidebar/SidebarInner.tsx +50 -39
  51. package/src/features/layouts/sidebar/SidebarLayout.tsx +8 -11
  52. package/src/features/layouts/utils.ts +4 -3
  53. package/src/features/layouts/windows/DesktopDots.tsx +76 -0
  54. package/src/features/layouts/windows/WindowsLayout.tsx +184 -125
  55. package/src/features/layouts/windows/deskDots.spec.ts +52 -0
  56. package/src/features/layouts/windows/deskDots.ts +314 -0
  57. package/src/features/settings/SettingsProvider.tsx +158 -2
  58. package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +8 -7
  59. package/src/features/settings/utils/buildSettingsForPropagation.ts +4 -6
  60. package/src/features/theme/applyTheme.ts +8 -0
  61. package/src/features/theme/navContrast.spec.ts +49 -0
  62. package/src/features/theme/navContrast.ts +108 -0
  63. package/src/features/transfers/transferQueue.spec.ts +6 -2
  64. package/src/i18n/translations/en/common.json +25 -0
  65. package/src/i18n/translations/fr/common.json +25 -0
  66. package/src/index.css +935 -46
  67. package/src/index.ts +1 -0
  68. package/src/routes/hooks/useNavigationItems.ts +14 -3
  69. package/src/routes/hooks/withShellSearch.spec.ts +13 -0
@@ -1,5 +1,5 @@
1
1
  import type { LayoutChromeInsets, LayoutChromeViewport } from '@shellui/sdk';
2
- import { MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
2
+ import { MAC_LIGHTS_SAFE_PX } from '../chrome/constants';
3
3
  import { isMacOSDesktop, isTauriRuntime } from '../chrome/runtime';
4
4
  import { isTauri } from '../../../service-worker/register';
5
5
 
@@ -88,15 +88,31 @@ export const FLOATING_COLLAPSED_ACTIONS_LEADING_EXTRA =
88
88
  /** Back + forward pair ahead of the collapsed expand chip in Tauri. */
89
89
  export const FLOATING_HISTORY_CLUSTER_PX = 72;
90
90
 
91
+ /**
92
+ * macOS collapsed strip glass group: expand, back, forward (3 x 24px) with 2px gaps
93
+ * and 2px padding.
94
+ */
95
+ export const FLOATING_MAC_STRIP_GROUP_PX = 80;
96
+ /** macOS collapsed: content starts under the 32px strip plus 20px. */
97
+ export const FLOATING_MAC_COLLAPSED_CONTENT_TOP = 52;
98
+
99
+ /** Live macOS Tauri webview (lights in the window corner). */
100
+ function isMacTauriWindow(): boolean {
101
+ return typeof window !== 'undefined' && isTauriRuntime() && isMacOSDesktop();
102
+ }
103
+
91
104
  /**
92
105
  * Left offset for the top action row when the desktop sidebar is collapsed.
93
- * Tauri also clears the traffic lights and the history buttons before the chip.
106
+ * macOS clears the 80px safe area and the strip glass group. Other Tauri hosts
107
+ * clear the history buttons before the chip.
94
108
  */
95
109
  export function floatingCollapsedActionsLeadingPx(): number {
110
+ if (isMacTauriWindow()) {
111
+ return MAC_LIGHTS_SAFE_PX + FLOATING_MAC_STRIP_GROUP_PX + FLOATING_CONTENT_CLEARANCE;
112
+ }
96
113
  let leading = FLOATING_COLLAPSED_ACTIONS_LEADING_EXTRA;
97
114
  if (typeof window === 'undefined' || !isTauri()) return leading;
98
115
  leading += FLOATING_HISTORY_CLUSTER_PX;
99
- if (isTauriRuntime() && isMacOSDesktop()) leading += MAC_TRAFFIC_LIGHTS_WIDTH_PX;
100
116
  return leading;
101
117
  }
102
118
  /**
@@ -126,6 +142,8 @@ export function computeFloatingInsets(options: {
126
142
  * Tauri passes `0` so the title row meets the traffic lights.
127
143
  */
128
144
  edgeMargin?: number;
145
+ /** macOS Tauri desktop: collapsed content clears the 32px strip (top 52). */
146
+ macStrip?: boolean;
129
147
  }): LayoutChromeInsets {
130
148
  const safe: FloatingSafeArea = {
131
149
  top: options.safeArea?.top ?? 0,
@@ -155,7 +173,7 @@ export function computeFloatingInsets(options: {
155
173
 
156
174
  if (options.sidebarCollapsed) {
157
175
  return {
158
- top: safe.top,
176
+ top: options.macStrip ? safe.top + FLOATING_MAC_COLLAPSED_CONTENT_TOP : safe.top,
159
177
  right: safe.right,
160
178
  bottom: safe.bottom,
161
179
  left: safe.left,
@@ -9,7 +9,7 @@ import {
9
9
  type LayoutChromeViewport,
10
10
  type ScrollChromeState,
11
11
  } from '@shellui/sdk';
12
- import { useIsTauriRuntime } from '../chrome/runtime';
12
+ import { isMacOSDesktop, isTauriRuntime, useIsTauriRuntime } from '../chrome/runtime';
13
13
  import {
14
14
  computeFloatingInsets,
15
15
  floatingCollapsedActionsLeadingPx,
@@ -73,6 +73,7 @@ function buildChrome(
73
73
  sidebarCollapsed: desktopCollapsed,
74
74
  safeArea,
75
75
  edgeMargin,
76
+ macStrip: viewport === 'desktop' && isTauriRuntime() && isMacOSDesktop(),
76
77
  }),
77
78
  };
78
79
  }
@@ -198,6 +199,7 @@ export function useFloatingChrome(viewport: LayoutChromeViewport) {
198
199
  sidebarCollapsed: viewport === 'desktop' && sidebarCollapsed,
199
200
  safeArea,
200
201
  edgeMargin,
202
+ macStrip: viewport === 'desktop' && isTauriRuntime() && isMacOSDesktop(),
201
203
  });
202
204
  }, [viewport, sidebarCollapsed, edgeMargin]);
203
205
 
@@ -0,0 +1,39 @@
1
+ // @vitest-environment happy-dom
2
+ import { describe, expect, it } from 'vitest';
3
+ import { isEditableFocus, isSoftKeyboardOpen, SOFT_KEYBOARD_MIN_PX } from './useSoftKeyboard';
4
+
5
+ const el = (html: string) => {
6
+ const wrap = document.createElement('div');
7
+ wrap.innerHTML = html;
8
+ return wrap.firstElementChild;
9
+ };
10
+
11
+ describe('isEditableFocus', () => {
12
+ it('accepts text fields, textareas, contenteditable and content frames', () => {
13
+ expect(isEditableFocus(el('<input type="text">'))).toBe(true);
14
+ expect(isEditableFocus(el('<input type="search">'))).toBe(true);
15
+ expect(isEditableFocus(el('<textarea></textarea>'))).toBe(true);
16
+ expect(isEditableFocus(el('<iframe></iframe>'))).toBe(true);
17
+ });
18
+
19
+ it('rejects buttons, checkboxes and plain elements', () => {
20
+ expect(isEditableFocus(el('<input type="checkbox">'))).toBe(false);
21
+ expect(isEditableFocus(el('<button></button>'))).toBe(false);
22
+ expect(isEditableFocus(el('<div></div>'))).toBe(false);
23
+ expect(isEditableFocus(null)).toBe(false);
24
+ });
25
+ });
26
+
27
+ describe('isSoftKeyboardOpen', () => {
28
+ const input = el('<input type="text">');
29
+
30
+ it('opens when the visual viewport shrinks past the threshold with a field focused', () => {
31
+ expect(isSoftKeyboardOpen(500, 844, input)).toBe(true);
32
+ });
33
+
34
+ it('stays closed for small changes (URL bar) or without an editable focus', () => {
35
+ expect(isSoftKeyboardOpen(844 - SOFT_KEYBOARD_MIN_PX, 844, input)).toBe(false);
36
+ expect(isSoftKeyboardOpen(500, 844, el('<button></button>'))).toBe(false);
37
+ expect(isSoftKeyboardOpen(0, 844, input)).toBe(false);
38
+ });
39
+ });
@@ -0,0 +1,82 @@
1
+ import { useEffect } from 'react';
2
+
3
+ /** Root attribute set while the phone soft keyboard covers the bottom of the shell. */
4
+ export const SOFT_KEYBOARD_ATTR = 'data-shellui-keyboard';
5
+
6
+ /** The visual viewport must shrink by more than this before we call it a keyboard. */
7
+ export const SOFT_KEYBOARD_MIN_PX = 120;
8
+
9
+ /** Focus that can raise a soft keyboard: text fields, contenteditable, or a content iframe. */
10
+ export function isEditableFocus(el: Element | null): boolean {
11
+ if (!el) return false;
12
+ const tag = el.tagName;
13
+ // Keyboard inside a content frame: the shell only sees the iframe as active.
14
+ if (tag === 'IFRAME') return true;
15
+ if (tag === 'TEXTAREA' || tag === 'SELECT') return true;
16
+ if (tag === 'INPUT') {
17
+ const type = ((el as HTMLInputElement).type || 'text').toLowerCase();
18
+ return ![
19
+ 'button',
20
+ 'checkbox',
21
+ 'color',
22
+ 'file',
23
+ 'hidden',
24
+ 'image',
25
+ 'radio',
26
+ 'range',
27
+ 'reset',
28
+ 'submit',
29
+ ].includes(type);
30
+ }
31
+ return (el as HTMLElement).isContentEditable === true;
32
+ }
33
+
34
+ /** Pure check, kept separate for tests. */
35
+ export function isSoftKeyboardOpen(
36
+ visualHeight: number,
37
+ innerHeight: number,
38
+ active: Element | null,
39
+ ): boolean {
40
+ if (!(visualHeight > 0) || !(innerHeight > 0)) return false;
41
+ return innerHeight - visualHeight > SOFT_KEYBOARD_MIN_PX && isEditableFocus(active);
42
+ }
43
+
44
+ /**
45
+ * Phones: hide the floating dock and FAB while the soft keyboard is open so the
46
+ * focused field keeps the space. Sets `html[data-shellui-keyboard="open"]`.
47
+ */
48
+ export function useSoftKeyboard(enabled: boolean): void {
49
+ useEffect(() => {
50
+ if (typeof window === 'undefined') return;
51
+ const root = document.documentElement;
52
+ const vv = window.visualViewport;
53
+ if (!enabled || !vv) {
54
+ root.removeAttribute(SOFT_KEYBOARD_ATTR);
55
+ return;
56
+ }
57
+
58
+ let frame = 0;
59
+ const update = () => {
60
+ cancelAnimationFrame(frame);
61
+ frame = requestAnimationFrame(() => {
62
+ const open = isSoftKeyboardOpen(vv.height, window.innerHeight, document.activeElement);
63
+ if (open) root.setAttribute(SOFT_KEYBOARD_ATTR, 'open');
64
+ else root.removeAttribute(SOFT_KEYBOARD_ATTR);
65
+ });
66
+ };
67
+
68
+ vv.addEventListener('resize', update);
69
+ window.addEventListener('focusin', update);
70
+ window.addEventListener('focusout', update);
71
+ window.addEventListener('blur', update);
72
+ update();
73
+ return () => {
74
+ cancelAnimationFrame(frame);
75
+ vv.removeEventListener('resize', update);
76
+ window.removeEventListener('focusin', update);
77
+ window.removeEventListener('focusout', update);
78
+ window.removeEventListener('blur', update);
79
+ root.removeAttribute(SOFT_KEYBOARD_ATTR);
80
+ };
81
+ }, [enabled]);
82
+ }
@@ -4,12 +4,18 @@ import { useTranslation } from 'react-i18next';
4
4
  import type { NavigationItem, NavigationGroup } from '../../config/types';
5
5
  import { flattenNavigationItems } from '../utils';
6
6
  import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
7
- import { useIsTauriClient, useMacTrafficLights } from '../chrome/runtime';
7
+ import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
8
8
  import {
9
9
  DESKTOP_TITLEBAR_HEIGHT_PX,
10
10
  DESKTOP_TITLEBAR_PAD_TOP_PX,
11
- MAC_TRAFFIC_LIGHTS_WIDTH_PX,
11
+ MAC_LIGHTS_SAFE_PX,
12
+ SHELL_HEADER_HEIGHT_PX,
13
+ SHELL_HEADER_PAD_TOP_PX,
12
14
  } from '../chrome/constants';
15
+ import { MAC_DRAG_REGION_PROPS, MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
16
+
17
+ /** macOS: content starts under the 32px strip plus 16px. */
18
+ const MAC_CONTENT_PAD_TOP_PX = 48;
13
19
 
14
20
  interface FullscreenLayoutProps {
15
21
  title?: string;
@@ -31,6 +37,7 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
31
37
  const { i18n } = useTranslation();
32
38
  const isTauriEnv = useIsTauriClient();
33
39
  const trafficLights = useMacTrafficLights();
40
+ const macStrip = useMacOverlayChrome();
34
41
  const currentLanguage = i18n.language || 'en';
35
42
  const navigationItems = useMemo(() => flattenNavigationItems(navigation), [navigation]);
36
43
 
@@ -52,20 +59,41 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
52
59
  }, [location.pathname, title, navigationItems, currentLanguage]);
53
60
 
54
61
  return (
55
- <main className="relative flex h-full max-h-full w-full flex-col overflow-hidden bg-background">
56
- {isTauriEnv ? (
62
+ <main
63
+ className="relative flex h-full max-h-full w-full flex-col overflow-hidden bg-background"
64
+ style={macStrip ? { paddingTop: MAC_CONTENT_PAD_TOP_PX } : undefined}
65
+ >
66
+ {macStrip ? (
67
+ /* Transparent 32px drag strip: safe area 80, history glass group, drag spacer. */
57
68
  <div
58
- className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
69
+ data-shellui-mac-strip=""
70
+ {...MAC_DRAG_REGION_PROPS}
71
+ className="absolute inset-x-0 top-0 z-[46] flex items-center select-none"
59
72
  style={{
60
73
  height: DESKTOP_TITLEBAR_HEIGHT_PX,
61
74
  paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
62
- paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 8,
63
75
  }}
64
- {...(trafficLights
65
- ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
66
- : {})}
67
76
  >
68
- <DesktopHistoryButtons />
77
+ <MacLightsSafeArea />
78
+ {isTauriEnv ? (
79
+ <DesktopHistoryButtons
80
+ strip
81
+ className="shellui-history-glass"
82
+ />
83
+ ) : null}
84
+ <MacStripSpacer />
85
+ </div>
86
+ ) : isTauriEnv ? (
87
+ <div
88
+ className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
89
+ style={{
90
+ height: SHELL_HEADER_HEIGHT_PX,
91
+ paddingTop: SHELL_HEADER_PAD_TOP_PX,
92
+ paddingLeft: trafficLights ? MAC_LIGHTS_SAFE_PX : 8,
93
+ }}
94
+ {...(trafficLights ? MAC_DRAG_REGION_PROPS : {})}
95
+ >
96
+ <DesktopHistoryButtons className="shellui-history-glass" />
69
97
  </div>
70
98
  ) : null}
71
99
  {children || <Outlet />}
@@ -11,7 +11,6 @@ import {
11
11
  SidebarMenuItem,
12
12
  SidebarMenuButton,
13
13
  } from '../../../components/ui/sidebar';
14
- import { cn } from '../../../lib/utils';
15
14
  import { getActivePathPrefix, getNavPathPrefix, flattenNavigationItems } from '../utils';
16
15
  import { getExternalFaviconUrl } from './sidebarUtils';
17
16
  import { ExternalLinkIcon, NavIcon } from './SidebarIcons';
@@ -29,7 +28,7 @@ export function NavigationContent({
29
28
  trailing?: ReactNode;
30
29
  }) {
31
30
  const location = useLocation();
32
- const { i18n } = useTranslation();
31
+ const { t, i18n } = useTranslation();
33
32
  const currentLanguage = i18n.language || 'en';
34
33
 
35
34
  const resolveLocalizedString = (
@@ -77,9 +76,17 @@ export function NavigationContent({
77
76
  const itemLabel = resolveLocalizedString(navItem.label, currentLanguage);
78
77
  const faviconUrl = isExternal && !navItem.icon ? getExternalFaviconUrl(navItem.url) : null;
79
78
  const iconSrc = navItem.icon ?? faviconUrl ?? null;
80
- const iconEl = <NavIcon src={iconSrc} />;
79
+ const iconEl = (
80
+ <NavIcon
81
+ src={iconSrc}
82
+ className="shellui-nav-icon"
83
+ />
84
+ );
81
85
  const externalIcon = isExternal ? (
82
- <ExternalLinkIcon className="ml-auto size-4 shrink-0 opacity-70" />
86
+ <>
87
+ <ExternalLinkIcon className="shellui-nav-external ml-auto size-3.5 shrink-0 opacity-70" />
88
+ <span className="sr-only">{t('shellChrome.externalLink')}</span>
89
+ </>
83
90
  ) : null;
84
91
  const content = (
85
92
  <>
@@ -126,8 +133,9 @@ export function NavigationContent({
126
133
  <SidebarMenuButton
127
134
  asChild
128
135
  isActive={isActive}
136
+ aria-current={isActive ? 'page' : undefined}
129
137
  tooltip={itemLabel}
130
- className={cn('w-full', isActive && 'bg-sidebar-accent text-sidebar-accent-foreground')}
138
+ className="shellui-nav-row w-full"
131
139
  >
132
140
  {linkOrTrigger}
133
141
  </SidebarMenuButton>
@@ -161,7 +169,7 @@ export function NavigationContent({
161
169
  key={`group-${groupTitle}-${sectionIndex}`}
162
170
  className="mt-0"
163
171
  >
164
- <SidebarGroupLabel className="mb-1">{groupTitle}</SidebarGroupLabel>
172
+ <SidebarGroupLabel className="shellui-nav-label mb-1">{groupTitle}</SidebarGroupLabel>
165
173
  <SidebarGroupContent>
166
174
  <SidebarMenu className="gap-0.5">
167
175
  {section.group.items.map((navItem) => (
@@ -1,7 +1,7 @@
1
1
  import { cn } from '../../../lib/utils';
2
2
  import { isAppIcon } from './sidebarUtils';
3
3
 
4
- /** Inline SVG: external-link icon. Bundled so consumers don't need to serve static SVGs. */
4
+ /** Inline SVG: external link (arrow up right). Bundled so consumers don't need to serve static SVGs. */
5
5
  export function ExternalLinkIcon({ className }: { className?: string }) {
6
6
  return (
7
7
  <svg
@@ -17,14 +17,8 @@ export function ExternalLinkIcon({ className }: { className?: string }) {
17
17
  className={cn('shrink-0', className)}
18
18
  aria-hidden
19
19
  >
20
- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
21
- <polyline points="15 3 21 3 21 9" />
22
- <line
23
- x1="10"
24
- y1="14"
25
- x2="21"
26
- y2="3"
27
- />
20
+ <path d="M7 7h10v10" />
21
+ <path d="M7 17 17 7" />
28
22
  </svg>
29
23
  );
30
24
  }
@@ -1,3 +1,4 @@
1
+ import { useTranslation } from 'react-i18next';
1
2
  import type { NavigationItem, NavigationGroup, ThemeAsset } from '../../config/types';
2
3
  import {
3
4
  SidebarHeader,
@@ -9,13 +10,15 @@ import {
9
10
  import { NavigationContent } from './NavigationContent';
10
11
  import { LoginButton } from '../../auth/components/LoginButton';
11
12
  import { cn } from '../../../lib/utils';
13
+ import { MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
12
14
  import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
13
15
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
14
16
  import {
15
17
  DESKTOP_TITLEBAR_HEIGHT_PX,
16
18
  DESKTOP_TITLEBAR_PAD_TOP_PX,
17
- MAC_TRAFFIC_LIGHTS_GAP_PX,
18
- MAC_TRAFFIC_LIGHTS_WIDTH_PX,
19
+ MAC_LIGHTS_SAFE_PX,
20
+ SHELL_HEADER_HEIGHT_PX,
21
+ SHELL_HEADER_PAD_TOP_PX,
19
22
  } from '../chrome/constants';
20
23
  import { AppBrandIcon } from '../branding/AppBrandIcon';
21
24
 
@@ -36,6 +39,7 @@ export function SidebarInner({
36
39
  /** Sidebar-inset: the column is padded, so the title row must break out to meet the lights. */
37
40
  inset?: boolean;
38
41
  }) {
42
+ const { t } = useTranslation();
39
43
  const isTauriEnv = useIsTauriClient();
40
44
  const overlay = useMacOverlayChrome();
41
45
  const trafficLights = useMacTrafficLights();
@@ -46,9 +50,7 @@ export function SidebarInner({
46
50
  const showOverlayHeader = overlay && !collapsed;
47
51
  // Narrow Tauri window: sheet header must clear native traffic lights.
48
52
  const mobileSheetHeader = isMobile && trafficLights;
49
- const mobileTrafficInset = mobileSheetHeader
50
- ? MAC_TRAFFIC_LIGHTS_WIDTH_PX + MAC_TRAFFIC_LIGHTS_GAP_PX
51
- : undefined;
53
+ const mobileTrafficInset = mobileSheetHeader ? MAC_LIGHTS_SAFE_PX : undefined;
52
54
  // Keep trigger on the right whenever an icon is configured (even while collapsed),
53
55
  // so it rides the sidebar width animation instead of jumping left.
54
56
  const hasAppIcon = Boolean(appIcon);
@@ -59,7 +61,9 @@ export function SidebarInner({
59
61
  title={title}
60
62
  data-shellui-no-drag=""
61
63
  className={cn(
62
- 'ml-1 w-5 min-w-0 shrink-0 overflow-hidden transition-[width,opacity,margin] duration-200 ease-linear',
64
+ 'w-5 min-w-0 shrink-0 overflow-hidden transition-[width,opacity,margin] duration-200 ease-linear',
65
+ // macOS strip: the icon starts right at the 80px safe area edge.
66
+ showOverlayHeader ? 'ml-0' : 'ml-1',
63
67
  // Sync with sidebar collapse; icon fades/shrinks while trigger stays put.
64
68
  'group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:ml-0 group-data-[collapsible=icon]:w-0 group-data-[collapsible=icon]:opacity-0',
65
69
  )}
@@ -88,13 +92,17 @@ export function SidebarInner({
88
92
  inset && showOverlayHeader && '-mt-3 -ml-3 w-[calc(100%+1.5rem)]',
89
93
  )}
90
94
  style={{
91
- height: DESKTOP_TITLEBAR_HEIGHT_PX,
92
- // Nudge controls down so they optically match centered traffic lights.
93
- paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
95
+ // 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,
94
98
  ...(mobileSheetHeader ? { paddingLeft: mobileTrafficInset } : {}),
95
99
  }}
96
100
  {...(showOverlayHeader
97
- ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
101
+ ? {
102
+ 'data-shellui-drag-region': '',
103
+ 'data-tauri-drag-region': '',
104
+ 'data-shellui-mac-strip': '',
105
+ }
98
106
  : {})}
99
107
  >
100
108
  {showOverlayHeader ? (
@@ -103,37 +111,27 @@ export function SidebarInner({
103
111
  data-shellui-drag-region=""
104
112
  data-tauri-drag-region=""
105
113
  >
106
- {trafficLights ? (
107
- <div
108
- className="h-full shrink-0"
109
- style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
110
- aria-hidden
111
- />
112
- ) : null}
113
- <div
114
- className="flex h-full min-w-0 flex-1 items-center gap-1"
115
- style={{
116
- paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_GAP_PX : 8,
117
- }}
118
- >
114
+ {/* 80px drag-only safe area next to the lights (12px in native fullscreen). */}
115
+ <MacLightsSafeArea />
116
+ <div className="flex h-full min-w-0 flex-1 items-center gap-1">
119
117
  {hasAppIcon ? brandIcon : null}
120
118
  {!hasAppIcon ? (
121
119
  <SidebarTrigger
122
120
  data-shellui-no-drag=""
123
- className="size-7 shrink-0 touch-manipulation"
121
+ className="size-6 shrink-0 touch-manipulation"
122
+ />
123
+ ) : null}
124
+ <MacStripSpacer className="min-w-[8px]" />
125
+ {isTauriEnv ? (
126
+ <DesktopHistoryButtons
127
+ strip
128
+ className="self-center"
124
129
  />
125
130
  ) : null}
126
- <div
127
- aria-hidden
128
- data-shellui-drag-region=""
129
- data-tauri-drag-region=""
130
- className="min-h-full min-w-[8px] flex-1 self-stretch"
131
- />
132
- {isTauriEnv ? <DesktopHistoryButtons className="self-center" /> : null}
133
131
  {hasAppIcon ? (
134
132
  <SidebarTrigger
135
133
  data-shellui-no-drag=""
136
- className="size-7 shrink-0 touch-manipulation"
134
+ className="size-6 shrink-0 touch-manipulation"
137
135
  />
138
136
  ) : null}
139
137
  {hasAppIcon ? trailingInset : null}
@@ -153,15 +151,28 @@ export function SidebarInner({
153
151
  </div>
154
152
  )}
155
153
  </SidebarHeader>
156
- <SidebarContent className="gap-1">
157
- <NavigationContent navigation={startNav} />
154
+ <SidebarContent className="shellui-nav gap-1">
155
+ <nav
156
+ aria-label={t('shellChrome.mainNav')}
157
+ className="flex min-w-0 flex-col gap-1"
158
+ >
159
+ <NavigationContent navigation={startNav} />
160
+ </nav>
158
161
  </SidebarContent>
159
- <SidebarFooter className="gap-0 border-t border-sidebar-border px-0 pt-0 pb-[max(0.5rem,var(--shellui-safe-area-bottom))]">
162
+ <SidebarFooter
163
+ 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))]"
165
+ >
160
166
  {(endItems.length > 0 || showAuthButton) && (
161
- <NavigationContent
162
- navigation={endItems}
163
- trailing={showAuthButton ? <LoginButton variant="sidebar" /> : undefined}
164
- />
167
+ <nav
168
+ aria-label={t('shellChrome.accountNav')}
169
+ className="flex min-w-0 flex-col"
170
+ >
171
+ <NavigationContent
172
+ navigation={endItems}
173
+ trailing={showAuthButton ? <LoginButton variant="sidebar" /> : undefined}
174
+ />
175
+ </nav>
165
176
  )}
166
177
  </SidebarFooter>
167
178
  </>
@@ -37,10 +37,9 @@ import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
37
37
  import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
38
38
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
39
39
  import {
40
- MAC_TRAFFIC_LIGHTS_GAP_PX,
41
- MAC_TRAFFIC_LIGHTS_WIDTH_PX,
42
- DESKTOP_TITLEBAR_HEIGHT_PX,
43
- DESKTOP_TITLEBAR_PAD_TOP_PX,
40
+ MAC_LIGHTS_SAFE_PX,
41
+ SHELL_HEADER_HEIGHT_PX,
42
+ SHELL_HEADER_PAD_TOP_PX,
44
43
  } from '../chrome/constants';
45
44
  import { WindowTitleBarActions } from '../../chromeActions';
46
45
  import { cn } from '../../../lib/utils';
@@ -100,9 +99,7 @@ const SidebarLayoutContent = ({
100
99
  const isMobile = useIsMobile();
101
100
  const isTauriEnv = useIsTauriClient();
102
101
  const trafficLights = useMacTrafficLights();
103
- const mobileTrafficInset = trafficLights
104
- ? MAC_TRAFFIC_LIGHTS_WIDTH_PX + MAC_TRAFFIC_LIGHTS_GAP_PX
105
- : undefined;
102
+ const mobileTrafficInset = trafficLights ? MAC_LIGHTS_SAFE_PX : undefined;
106
103
  // Nested shell-in-iframe must not repeat the root safe-area top band.
107
104
  const showSafeAreaTopbar = isShellUiRootWindow();
108
105
  const scrollHideLayout = variant === 'inset' ? 'sidebar-inset' : 'sidebar';
@@ -243,11 +240,11 @@ const SidebarLayoutContent = ({
243
240
  )}
244
241
  style={{
245
242
  paddingTop: showSafeAreaTopbar
246
- ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
247
- : DESKTOP_TITLEBAR_PAD_TOP_PX,
243
+ ? `calc(var(--shellui-safe-area-top) + ${SHELL_HEADER_PAD_TOP_PX}px)`
244
+ : SHELL_HEADER_PAD_TOP_PX,
248
245
  height: showSafeAreaTopbar
249
- ? `calc(${DESKTOP_TITLEBAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`
250
- : DESKTOP_TITLEBAR_HEIGHT_PX,
246
+ ? `calc(${SHELL_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`
247
+ : SHELL_HEADER_HEIGHT_PX,
251
248
  ...(mobileTrafficInset !== undefined ? { paddingLeft: mobileTrafficInset } : {}),
252
249
  }}
253
250
  {...(trafficLights
@@ -227,7 +227,8 @@ export function hasLoginNavigationItem(navigation: (NavigationItem | NavigationG
227
227
  * Hide login navigation entries only when authenticated, so custom login entries
228
228
  * can still be used while signed out (e.g. open login in modal/drawer).
229
229
  * While the initial session restore runs (`isAuthLoading`), login entries are hidden too:
230
- * the account skeleton takes their place until the auth state is known.
230
+ * the account skeleton takes their place until the auth state is known. Logged-in only entries
231
+ * stay visible during the restore so the navigation does not pop in after a reload.
231
232
  */
232
233
  export function filterNavigationForAuthState(
233
234
  navigation: (NavigationItem | NavigationGroup)[],
@@ -242,7 +243,7 @@ export function filterNavigationForAuthState(
242
243
  if ('title' in item && 'items' in item) {
243
244
  const group = item as NavigationGroup;
244
245
  const visibleItems = group.items.filter((navItem) => {
245
- if (navItem.hideWhenLoggedOut && !isAuthenticated) return false;
246
+ if (navItem.hideWhenLoggedOut && !isAuthenticated && !isAuthLoading) return false;
246
247
  if (navItem.requiresDevMode && !isDevModeEnabled) return false;
247
248
  if (hideLoginEntries && isLoginNavigationUrl(navItem.url)) return false;
248
249
  return true;
@@ -251,7 +252,7 @@ export function filterNavigationForAuthState(
251
252
  return { ...group, items: visibleItems };
252
253
  }
253
254
  const navItem = item as NavigationItem;
254
- if (navItem.hideWhenLoggedOut && !isAuthenticated) return null;
255
+ if (navItem.hideWhenLoggedOut && !isAuthenticated && !isAuthLoading) return null;
255
256
  if (navItem.requiresDevMode && !isDevModeEnabled) return null;
256
257
  if (hideLoginEntries && isLoginNavigationUrl(navItem.url)) return null;
257
258
  return item;