@shellui/core 0.5.0-beta.1 → 0.5.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/core",
3
- "version": "0.5.0-beta.1",
3
+ "version": "0.5.0-beta.2",
4
4
  "description": "Shellui Core - Core React application runtime",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -71,7 +71,7 @@
71
71
  "workbox-routing": "^7.4.0",
72
72
  "workbox-strategies": "^7.4.0",
73
73
  "workbox-window": "^7.4.0",
74
- "@shellui/sdk": "0.5.0-beta.1"
74
+ "@shellui/sdk": "0.5.0-beta.2"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "react": "^18.0.0 || ^19.0.0",
@@ -43,7 +43,7 @@ const SIDEBAR_STORAGE_KEY = 'shellui:sidebar:open';
43
43
  const SIDEBAR_WIDTH_STORAGE_KEY = 'shellui:sidebar:width';
44
44
  /** Default expanded width (matches previous 16rem). */
45
45
  const SIDEBAR_WIDTH_DEFAULT_PX = 256;
46
- const SIDEBAR_WIDTH_MIN_PX = 200;
46
+ const SIDEBAR_WIDTH_MIN_PX = 230;
47
47
  const SIDEBAR_WIDTH_MAX_PX = 480;
48
48
  /** Cap at the viewport so a phone narrower than 18rem still gets a full-width sheet. */
49
49
  const SIDEBAR_WIDTH_MOBILE = 'min(18rem, 100%)';
@@ -2,15 +2,23 @@ import { useEffect, useMemo, useRef } from 'react';
2
2
  import { Outlet, Route, Routes, useLocation, useNavigate } from 'react-router';
3
3
  import { Button } from '../../components/ui/button';
4
4
  import { ContentView } from '../../components/ContentView';
5
+ import { useIsMobile } from '../../hooks/use-mobile';
5
6
  import { LoginButton } from '../auth/components/LoginButton';
6
7
  import { useAuth } from '../auth/hooks/useAuth';
7
8
  import { useConfig } from '../config/useConfig';
8
9
  import type { NavigationItem } from '../config/types';
9
10
  import { AppLayout } from '../layouts/AppLayout';
11
+ import {
12
+ isShellUiRootWindow,
13
+ SafeAreaTopbarOffset,
14
+ SafeAreaTopbarStrip,
15
+ } from '../layouts/chrome/SafeAreaTopbar';
10
16
  import { AdminForbiddenAccess } from './components/AdminForbiddenAccess';
11
17
  import { getAdminContentUrl, getAdminPath } from './config';
12
18
  import { buildAdminIframeSrc } from './utils';
13
19
 
20
+ const ADMIN_HEADER_HEIGHT_PX = 48;
21
+
14
22
  const AdminAccessGuard = ({ allow }: { allow: boolean }) => {
15
23
  if (!allow) {
16
24
  return <AdminForbiddenAccess />;
@@ -23,6 +31,7 @@ export const AdminView = () => {
23
31
  const location = useLocation();
24
32
  const { config } = useConfig();
25
33
  const { user } = useAuth();
34
+ const isMobile = useIsMobile();
26
35
  const canOpenAdminPanel = Boolean(user?.isStaff || user?.isCompanyOwner);
27
36
  const adminPath = getAdminPath(config);
28
37
  const baseAdminContentUrl = getAdminContentUrl(config);
@@ -56,10 +65,30 @@ export const AdminView = () => {
56
65
  }
57
66
  }, [config?.title]);
58
67
 
68
+ const showSafeAreaTopbar = isShellUiRootWindow();
69
+ const headerStyle = {
70
+ paddingLeft: 'max(0.5rem, var(--shellui-safe-area-left))',
71
+ paddingRight: 'max(0.75rem, var(--shellui-safe-area-right))',
72
+ ...(isMobile && showSafeAreaTopbar
73
+ ? {
74
+ paddingTop: 'var(--shellui-safe-area-top)',
75
+ height: `calc(${ADMIN_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
76
+ }
77
+ : { height: ADMIN_HEADER_HEIGHT_PX }),
78
+ } as const;
79
+
59
80
  return (
60
81
  <AppLayout>
61
- <div className="flex h-full w-full flex-col overflow-hidden bg-background">
62
- <header className="flex h-12 shrink-0 items-center justify-between border-b bg-card px-2 md:px-3">
82
+ <div
83
+ data-shellui-admin-layout=""
84
+ className="flex h-full w-full flex-col overflow-hidden bg-background"
85
+ >
86
+ <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
87
+ <SafeAreaTopbarStrip enabled={showSafeAreaTopbar} />
88
+ <header
89
+ className="flex shrink-0 items-center justify-between border-b bg-card"
90
+ style={headerStyle}
91
+ >
63
92
  <Button
64
93
  type="button"
65
94
  variant="ghost"
@@ -90,11 +90,11 @@ const variantConfig: Record<
90
90
  appbar: {
91
91
  button: {
92
92
  authenticated:
93
- 'size-9 rounded-md p-0 justify-center text-sm text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
93
+ 'size-7 rounded-md p-0 justify-center text-xs text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
94
94
  loggedOut:
95
- 'h-9 max-w-[220px] rounded-md px-3 text-sm text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
95
+ 'h-7 max-w-[220px] rounded-md px-2.5 text-xs text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
96
96
  },
97
- avatar: 'size-5',
97
+ avatar: 'size-4',
98
98
  menu: { width: 'w-[min(16rem,calc(100vw-1.5rem))]', side: 'bottom', align: 'end' },
99
99
  showDisplayName: false,
100
100
  showCaret: false,
@@ -23,9 +23,16 @@ import {
23
23
  redirectToCliCallback,
24
24
  } from '../utils';
25
25
  import { AppBrandIcon } from '../../layouts/branding/AppBrandIcon';
26
+ import { DESKTOP_TITLEBAR_HEIGHT_PX } from '../../layouts/chrome/constants';
27
+ import { useMacTrafficLights } from '../../layouts/chrome/runtime';
26
28
  import { AccessPendingView } from './AccessPendingView';
27
29
  import { LoginPreferencesControls } from './LoginPreferencesControls';
28
30
 
31
+ /** Shared top inset for login chrome when traffic lights are absent. */
32
+ const LOGIN_CHROME_PAD_Y = '2rem';
33
+ /** Gap below the macOS titlebar before the brand icon. */
34
+ const LOGIN_BRAND_BELOW_TITLEBAR_GAP = '0.75rem';
35
+
29
36
  const LAST_USED_LOGIN_STORAGE_KEY = 'shellui.auth.last_used_login';
30
37
 
31
38
  const SHELLUI_OAUTH_ERROR_PARAM = 'shellui_oauth_error';
@@ -84,6 +91,7 @@ export const LoginView = () => {
84
91
  const navigate = useNavigate();
85
92
  const location = useLocation();
86
93
  const { config } = useConfig();
94
+ const trafficLights = useMacTrafficLights();
87
95
  const {
88
96
  isAuthenticated,
89
97
  isLoading: authLoading,
@@ -143,6 +151,11 @@ export const LoginView = () => {
143
151
  captureCliCallbackFromSearch(location.search);
144
152
  }, [location.search]);
145
153
 
154
+ useEffect(() => {
155
+ const loginLabel = t('authMenu.login');
156
+ document.title = config?.title ? `${loginLabel} | ${config.title}` : loginLabel;
157
+ }, [config?.title, t]);
158
+
146
159
  useEffect(() => {
147
160
  const params = new URLSearchParams(location.search);
148
161
  const rawErr = params.get(SHELLUI_OAUTH_ERROR_PARAM);
@@ -405,6 +418,7 @@ export const LoginView = () => {
405
418
 
406
419
  const panelUrl = config.backend?.login?.panelUrl?.trim() || null;
407
420
  const panelImage = config.backend?.login?.panelImage?.trim() || null;
421
+ const hasCustomPanel = Boolean(panelUrl || panelImage);
408
422
  const legalDocuments = useMemo(() => getLegalDocuments(config), [config]);
409
423
 
410
424
  if (isAuthenticated) {
@@ -424,8 +438,52 @@ export const LoginView = () => {
424
438
  );
425
439
  }
426
440
 
441
+ const chromePadTop = `calc(${LOGIN_CHROME_PAD_Y} + var(--shellui-safe-area-top))`;
442
+ // Clear traffic-light titlebar, then keep a small gap — only when native lights are shown.
443
+ const brandPadTop = trafficLights
444
+ ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_HEIGHT_PX}px + ${LOGIN_BRAND_BELOW_TITLEBAR_GAP})`
445
+ : chromePadTop;
446
+ const contentPadTop = trafficLights
447
+ ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_HEIGHT_PX}px + ${LOGIN_BRAND_BELOW_TITLEBAR_GAP} + 2rem)`
448
+ : `calc(4rem + var(--shellui-safe-area-top))`;
449
+
427
450
  return (
428
- <main className="flex min-h-full w-full bg-background">
451
+ <main className="relative flex min-h-full w-full bg-background">
452
+ {!isIframeView ? (
453
+ <>
454
+ <div
455
+ className={cn(
456
+ 'pointer-events-none absolute top-0 left-0 z-10 pl-[calc(1.5rem+var(--shellui-safe-area-left))]',
457
+ hasCustomPanel && 'md:invisible',
458
+ )}
459
+ style={{ paddingTop: brandPadTop }}
460
+ >
461
+ <div className="pointer-events-auto">
462
+ {config.appIcon ? (
463
+ <AppBrandIcon
464
+ appIcon={config.appIcon}
465
+ title={config.title}
466
+ imgClassName="size-8"
467
+ />
468
+ ) : (
469
+ <span
470
+ className="block size-8"
471
+ aria-hidden
472
+ />
473
+ )}
474
+ </div>
475
+ </div>
476
+ <div
477
+ className="pointer-events-none absolute top-0 right-0 z-10 pr-[calc(1.5rem+var(--shellui-safe-area-right))]"
478
+ style={{ paddingTop: chromePadTop }}
479
+ >
480
+ <div className="pointer-events-auto">
481
+ <LoginPreferencesControls />
482
+ </div>
483
+ </div>
484
+ </>
485
+ ) : null}
486
+
429
487
  {!isIframeView && (
430
488
  <section
431
489
  className="relative hidden min-h-full w-1/2 overflow-hidden bg-muted/40 md:block"
@@ -445,41 +503,24 @@ export const LoginView = () => {
445
503
  className="max-h-full max-w-full object-contain"
446
504
  />
447
505
  </div>
448
- ) : (
449
- <div className="flex h-full w-full items-start justify-start p-6">
450
- <AppBrandIcon
451
- appIcon={config.appIcon}
452
- title={config.title}
453
- imgClassName="size-8"
454
- />
455
- </div>
456
- )}
506
+ ) : null}
457
507
  </section>
458
508
  )}
459
509
 
460
510
  <section
461
511
  className={cn(
462
512
  'relative flex min-h-full w-full flex-col',
463
- isIframeView ? 'px-6 py-6' : 'shellui-safe-pad md:[--shellui-safe-pad-y:2.5rem]',
513
+ isIframeView
514
+ ? 'px-6 py-6'
515
+ : [
516
+ 'pr-[calc(1.5rem+var(--shellui-safe-area-right))]',
517
+ 'pb-[calc(1.5rem+var(--shellui-safe-area-bottom))] md:pb-[calc(2.5rem+var(--shellui-safe-area-bottom))]',
518
+ 'pl-[calc(1.5rem+var(--shellui-safe-area-left))]',
519
+ ],
464
520
  !isIframeView && 'md:w-1/2',
465
521
  )}
522
+ style={!isIframeView ? { paddingTop: contentPadTop } : undefined}
466
523
  >
467
- {!isIframeView ? (
468
- <div className="flex shrink-0 items-center gap-4 pb-6 md:pb-2">
469
- {config.appIcon ? (
470
- <div className="md:hidden">
471
- <AppBrandIcon
472
- appIcon={config.appIcon}
473
- title={config.title}
474
- imgClassName="size-8"
475
- />
476
- </div>
477
- ) : null}
478
- <div className="ml-auto">
479
- <LoginPreferencesControls />
480
- </div>
481
- </div>
482
- ) : null}
483
524
  <div className="flex w-full min-h-0 flex-1 items-center justify-center">
484
525
  <div
485
526
  className={cn(
@@ -712,7 +753,12 @@ export const LoginView = () => {
712
753
  ? t('loginPage.otherSocialLogins')
713
754
  : t('loginPage.socialLogin')}
714
755
  </p>
715
- <div className="grid gap-2 sm:grid-cols-2">
756
+ <div
757
+ className={cn(
758
+ 'grid gap-2',
759
+ otherOAuthProviders.length > 1 && 'sm:grid-cols-2',
760
+ )}
761
+ >
716
762
  {otherOAuthProviders.map((provider) => {
717
763
  const visual = getProviderVisual(provider);
718
764
  const label = formatProviderLabel(provider);
@@ -46,11 +46,21 @@ import { useSettings } from '../../settings/hooks/useSettings';
46
46
  import { NavIcon } from '../sidebar/SidebarIcons';
47
47
  import { getExternalFaviconUrl } from '../sidebar/sidebarUtils';
48
48
  import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
49
- import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
50
- import { MAC_TRAFFIC_LIGHTS_GAP_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
49
+ import {
50
+ isShellUiRootWindow,
51
+ SafeAreaTopbarOffset,
52
+ SafeAreaTopbarStrip,
53
+ } from '../chrome/SafeAreaTopbar';
54
+ import { useIsTauriRuntime, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
55
+ import {
56
+ DESKTOP_TITLEBAR_HEIGHT_PX,
57
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
58
+ MAC_TRAFFIC_LIGHTS_GAP_PX,
59
+ MAC_TRAFFIC_LIGHTS_WIDTH_PX,
60
+ } from '../chrome/constants';
51
61
 
52
- /** App-bar chrome height — taller than the 38px Tauri titlebar strip for easier hit targets. */
53
- const APP_BAR_HEIGHT_PX = 52;
62
+ /** App-bar chrome height — matches the Tauri / sidebar titlebar strip. */
63
+ const APP_BAR_HEIGHT_PX = DESKTOP_TITLEBAR_HEIGHT_PX;
54
64
 
55
65
  interface AppBarLayoutProps {
56
66
  title?: string;
@@ -203,19 +213,19 @@ function AppBarItemIcon({ item, label }: { item: NavigationItem; label: string }
203
213
  if (iconSrc) {
204
214
  return (
205
215
  <span
206
- className="flex size-7 shrink-0 items-center justify-center rounded-md bg-muted/60"
216
+ className="flex size-5 shrink-0 items-center justify-center rounded-md bg-muted/60 p-0.5"
207
217
  aria-hidden
208
218
  >
209
219
  <NavIcon
210
220
  src={iconSrc}
211
- className="size-5"
221
+ className="size-3"
212
222
  />
213
223
  </span>
214
224
  );
215
225
  }
216
226
  return (
217
227
  <span
218
- className="flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-[11px] font-semibold leading-none text-muted-foreground"
228
+ className="flex size-5 shrink-0 items-center justify-center rounded-md bg-muted p-0.5 text-[9px] font-semibold leading-none text-muted-foreground"
219
229
  aria-hidden
220
230
  >
221
231
  {firstLetter}
@@ -225,7 +235,8 @@ function AppBarItemIcon({ item, label }: { item: NavigationItem; label: string }
225
235
 
226
236
  const navTriggerClass = (active: boolean) =>
227
237
  cn(
228
- 'inline-flex h-9 shrink-0 items-center gap-2 rounded-md px-2.5 pr-3 text-sm font-medium transition-colors',
238
+ // h-7 leaves air in the 42px chrome after the 2px top pad.
239
+ 'inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors',
229
240
  'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
230
241
  active
231
242
  ? 'bg-sidebar-accent text-sidebar-accent-foreground'
@@ -359,7 +370,7 @@ function AppBarNavCategory({
359
370
  aria-expanded={open}
360
371
  >
361
372
  <span className="truncate">{label}</span>
362
- <CaretDownIcon className="size-3.5 shrink-0 opacity-70" />
373
+ <CaretDownIcon className="size-3 shrink-0 opacity-70" />
363
374
  </Button>
364
375
  </DropdownMenuTrigger>
365
376
  <DropdownMenuContent
@@ -412,7 +423,7 @@ function AppBarNavMore({
412
423
  aria-expanded={open}
413
424
  >
414
425
  <span>{t('desktopChrome.more')}</span>
415
- <CaretDownIcon className="size-3.5 shrink-0 opacity-70" />
426
+ <CaretDownIcon className="size-3 shrink-0 opacity-70" />
416
427
  </Button>
417
428
  </DropdownMenuTrigger>
418
429
  <DropdownMenuContent
@@ -478,12 +489,12 @@ function AppBarNavMeasureChip({
478
489
  >
479
490
  {withIcon ? (
480
491
  <span
481
- className="size-7 shrink-0"
492
+ className="size-5 shrink-0"
482
493
  aria-hidden
483
494
  />
484
495
  ) : null}
485
496
  {label}
486
- {withCaret ? <CaretDownIcon className="size-3.5 shrink-0 opacity-70" /> : null}
497
+ {withCaret ? <CaretDownIcon className="size-3 shrink-0 opacity-70" /> : null}
487
498
  </span>
488
499
  );
489
500
  }
@@ -662,11 +673,11 @@ function TopBarEndItem({
662
673
  const iconEl = iconSrc ? (
663
674
  <NavIcon
664
675
  src={iconSrc}
665
- className="size-4"
676
+ className="size-3.5"
666
677
  />
667
678
  ) : (
668
679
  <span
669
- className="flex size-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-semibold text-muted-foreground"
680
+ className="flex size-4 shrink-0 items-center justify-center rounded-md bg-muted text-[9px] font-semibold text-muted-foreground"
670
681
  aria-hidden
671
682
  >
672
683
  {firstLetter}
@@ -674,7 +685,7 @@ function TopBarEndItem({
674
685
  );
675
686
 
676
687
  const buttonClass = cn(
677
- 'flex size-9 items-center justify-center rounded-md transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
688
+ 'flex size-7 items-center justify-center rounded-md transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
678
689
  isActive
679
690
  ? 'bg-sidebar-accent text-sidebar-accent-foreground'
680
691
  : 'text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
@@ -736,7 +747,7 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
736
747
  const { settings } = useSettings();
737
748
  const location = useLocation();
738
749
  const isMobile = useIsMobile();
739
- const isTauriEnv = useIsTauriClient();
750
+ const isTauriRuntime = useIsTauriRuntime();
740
751
  const overlay = useMacOverlayChrome();
741
752
  const trafficLights = useMacTrafficLights();
742
753
  const currentLanguage = i18n.language || 'en';
@@ -787,18 +798,33 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
787
798
  : undefined;
788
799
 
789
800
  const hasStartNav = startSections.some((s) => s.items.length > 0);
801
+ // Nested shell-in-iframe must not repeat the root safe-area top band.
802
+ const showSafeAreaTopbar = isShellUiRootWindow();
803
+ // md+: strip owns the inset; mobile pads the header into the status band.
804
+ const headerStyle = {
805
+ paddingLeft: chromeInset ?? 12,
806
+ paddingRight: 8,
807
+ ...(isMobile && showSafeAreaTopbar
808
+ ? {
809
+ paddingTop: `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`,
810
+ height: `calc(${APP_BAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
811
+ }
812
+ : {
813
+ height: APP_BAR_HEIGHT_PX,
814
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
815
+ }),
816
+ } as const;
790
817
 
791
818
  return (
792
- <div className="flex h-full max-h-full flex-col overflow-hidden bg-background">
793
- {/* Header background extends into the status-bar band; controls sit below it. */}
819
+ <div
820
+ data-shellui-app-bar-layout=""
821
+ className="flex h-full max-h-full flex-col overflow-hidden bg-background"
822
+ >
823
+ <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
824
+ <SafeAreaTopbarStrip enabled={showSafeAreaTopbar} />
794
825
  <header
795
826
  className="relative z-[46] flex w-full shrink-0 items-center gap-1.5 border-b border-sidebar-border bg-sidebar text-sidebar-foreground select-none"
796
- style={{
797
- paddingTop: 'var(--shellui-safe-area-top)',
798
- height: `calc(${APP_BAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
799
- paddingLeft: chromeInset ?? 12,
800
- paddingRight: 8,
801
- }}
827
+ style={headerStyle}
802
828
  data-layout="app-bar"
803
829
  {...(trafficLights ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' } : {})}
804
830
  >
@@ -822,7 +848,7 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
822
848
  <div className="min-w-0 flex-1" />
823
849
  )}
824
850
 
825
- {isTauriEnv ? (
851
+ {isTauriRuntime ? (
826
852
  <div
827
853
  data-shellui-no-drag=""
828
854
  className="shrink-0"
@@ -3,17 +3,20 @@ import { cn } from '../../../lib/utils';
3
3
  import { DesktopHistoryButtons } from './DesktopHistoryButtons';
4
4
  import {
5
5
  DESKTOP_TITLEBAR_HEIGHT_PX,
6
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
6
7
  MAC_TRAFFIC_LIGHTS_GAP_PX,
7
8
  MAC_TRAFFIC_LIGHTS_WIDTH_PX,
8
9
  } from './constants';
9
- import { useIsTauriClient, useMacOverlayChrome } from './runtime';
10
+ import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from './runtime';
10
11
 
11
12
  /**
12
- * Full-width 38px chrome when the sidebar is collapsed in a Tauri overlay window.
13
+ * Full-width 42px chrome when the sidebar is collapsed in a Tauri overlay window.
13
14
  * Open-sidebar first, then Back; room for more controls later.
15
+ * Stays visible in native fullscreen (no traffic-light spacer there).
14
16
  */
15
17
  export function CollapsedDesktopTitlebar({ className }: { className?: string }) {
16
18
  const overlay = useMacOverlayChrome();
19
+ const trafficLights = useMacTrafficLights();
17
20
  const isTauriEnv = useIsTauriClient();
18
21
  const { state, isMobile } = useSidebar();
19
22
  const collapsed = state === 'collapsed' && !isMobile;
@@ -29,19 +32,24 @@ export function CollapsedDesktopTitlebar({ className }: { className?: string })
29
32
  'fixed inset-x-0 top-0 z-[47] flex w-full items-center border-b border-sidebar-border bg-sidebar text-sidebar-foreground select-none',
30
33
  className,
31
34
  )}
32
- style={{ height: DESKTOP_TITLEBAR_HEIGHT_PX }}
35
+ style={{
36
+ height: DESKTOP_TITLEBAR_HEIGHT_PX,
37
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
38
+ }}
33
39
  >
34
- <div
35
- className="h-full shrink-0"
36
- style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
37
- aria-hidden
38
- />
40
+ {trafficLights ? (
41
+ <div
42
+ className="h-full shrink-0"
43
+ style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
44
+ aria-hidden
45
+ />
46
+ ) : null}
39
47
  <div
40
48
  data-shellui-no-drag=""
41
49
  className="flex h-full items-center gap-0.5"
42
- style={{ paddingLeft: MAC_TRAFFIC_LIGHTS_GAP_PX }}
50
+ style={{ paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_GAP_PX : 8 }}
43
51
  >
44
- <SidebarTrigger className="size-8 touch-manipulation" />
52
+ <SidebarTrigger className="size-7 touch-manipulation" />
45
53
  {isTauriEnv ? <DesktopHistoryButtons /> : null}
46
54
  </div>
47
55
  </div>
@@ -1,7 +1,7 @@
1
1
  import { DESKTOP_TITLEBAR_HEIGHT_PX } from './constants';
2
2
 
3
3
  /**
4
- * Full-width invisible 38px strip at the top of the Tauri window.
4
+ * Full-width invisible 42px strip at the top of the Tauri window.
5
5
  *
6
6
  * Uses Tauri's official `data-tauri-drag-region` (requires
7
7
  * `core:window:allow-start-dragging` in capabilities). Shell controls must sit
@@ -3,7 +3,7 @@ import { ContentDragOverlay } from './ContentDragOverlay';
3
3
  import { useIsTauriClient, useMacTrafficLights } from './runtime';
4
4
 
5
5
  /**
6
- * Global Tauri desktop chrome: document flags + the 38px top drag strip.
6
+ * Global Tauri desktop chrome: document flags + the 42px top drag strip.
7
7
  * Mounted at the app root so it stays available on every page (layouts, login,
8
8
  * settings, route error boundary, empty config) — including narrow/mobile widths.
9
9
  */
@@ -0,0 +1,48 @@
1
+ import { useEffect } from 'react';
2
+ import { cn } from '../../../lib/utils';
3
+
4
+ /** True when this window is the outermost shell (not nested in an iframe). */
5
+ export function isShellUiRootWindow(): boolean {
6
+ return typeof window !== 'undefined' && window.parent === window;
7
+ }
8
+
9
+ /**
10
+ * Root shell only: advertise the safe-area topbar on <html> so fixed chrome
11
+ * (sidebar, drawers) can clear it. Nested iframe shells skip this.
12
+ */
13
+ export function SafeAreaTopbarOffset({ enabled }: { enabled: boolean }) {
14
+ useEffect(() => {
15
+ if (!enabled) return;
16
+ const root = document.documentElement;
17
+ root.setAttribute('data-shellui-safe-area-topbar', '');
18
+ return () => root.removeAttribute('data-shellui-safe-area-topbar');
19
+ }, [enabled]);
20
+
21
+ return null;
22
+ }
23
+
24
+ /**
25
+ * Tablet / desktop band for top safe-area. Height is 0 when the inset is 0;
26
+ * overflow clips the border so no stray hairline. Hidden below md — mobile
27
+ * headers pad into the status band instead.
28
+ */
29
+ export function SafeAreaTopbarStrip({
30
+ enabled,
31
+ className,
32
+ }: {
33
+ enabled: boolean;
34
+ /** Outer strip classes (defaults match sidebar chrome). */
35
+ className?: string;
36
+ }) {
37
+ if (!enabled) return null;
38
+ return (
39
+ <div
40
+ aria-hidden
41
+ data-slot="shellui-safe-area-top"
42
+ className={cn('relative z-0 hidden shrink-0 overflow-hidden md:block', className)}
43
+ style={{ height: 'var(--shellui-safe-area-top)' }}
44
+ >
45
+ <div className="box-border h-full border-b border-sidebar-border bg-sidebar" />
46
+ </div>
47
+ );
48
+ }
@@ -1,5 +1,11 @@
1
1
  /** Height of the macOS overlay titlebar / traffic-light row. */
2
- export const DESKTOP_TITLEBAR_HEIGHT_PX = 38;
2
+ export const DESKTOP_TITLEBAR_HEIGHT_PX = 42;
3
+
4
+ /**
5
+ * Top inset inside the titlebar so web controls optically match macOS traffic lights
6
+ * (lights stay vertically centered in the full height).
7
+ */
8
+ export const DESKTOP_TITLEBAR_PAD_TOP_PX = 2;
3
9
 
4
10
  /** Width reserved for macOS traffic lights (close / minimize / zoom). */
5
11
  export const MAC_TRAFFIC_LIGHTS_WIDTH_PX = 78;
@@ -1,5 +1,6 @@
1
1
  export {
2
2
  DESKTOP_TITLEBAR_HEIGHT_PX,
3
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
3
4
  IFRAME_FOREIGN_ATTR,
4
5
  MAC_TRAFFIC_LIGHTS_GAP_PX,
5
6
  MAC_TRAFFIC_LIGHTS_WIDTH_PX,
@@ -14,9 +15,12 @@ export {
14
15
  } from './goDesktopBack';
15
16
  export {
16
17
  useIsTauriClient,
18
+ useIsTauriRuntime,
19
+ useIsTauriFullscreen,
17
20
  useMacOverlayChrome,
18
21
  useMacTrafficLights,
19
22
  isMacOSDesktop,
23
+ isTauriRuntime,
20
24
  } from './runtime';
21
25
  export { DesktopBackButton } from './DesktopBackButton';
22
26
  export { DesktopForwardButton } from './DesktopForwardButton';
@@ -24,3 +28,4 @@ export { DesktopHistoryButtons } from './DesktopHistoryButtons';
24
28
  export { ContentDragOverlay } from './ContentDragOverlay';
25
29
  export { DesktopChrome } from './DesktopChrome';
26
30
  export { CollapsedDesktopTitlebar } from './CollapsedDesktopTitlebar';
31
+ export { isShellUiRootWindow, SafeAreaTopbarOffset, SafeAreaTopbarStrip } from './SafeAreaTopbar';
@@ -10,6 +10,84 @@ export function isMacOSDesktop(): boolean {
10
10
  return platform.startsWith('Mac') && !touchIpad;
11
11
  }
12
12
 
13
+ type TauriInternals = {
14
+ invoke: (cmd: string, args?: Record<string, unknown>) => Promise<unknown>;
15
+ transformCallback: (callback: (data: unknown) => void, once: boolean) => number;
16
+ unregisterCallback?: (id: number) => void;
17
+ metadata?: { currentWindow?: { label?: string } };
18
+ };
19
+
20
+ function getTauriInternals(): TauriInternals | null {
21
+ if (typeof window === 'undefined') return null;
22
+ return (window as Window & { __TAURI_INTERNALS__?: TauriInternals }).__TAURI_INTERNALS__ ?? null;
23
+ }
24
+
25
+ /**
26
+ * True only inside a real Tauri webview (`__TAURI__` / `__TAURI_INTERNALS__`).
27
+ * Unlike `isTauri()`, this ignores the CLI `--target tauri` build flag
28
+ * (`__SHELLUI_TAURI__`) so a browser tab opened against the same URL does not
29
+ * get traffic-light padding.
30
+ */
31
+ export function isTauriRuntime(): boolean {
32
+ if (typeof window === 'undefined') return false;
33
+ const w = window as Window & {
34
+ __TAURI__?: unknown;
35
+ __TAURI_INTERNALS__?: unknown;
36
+ };
37
+ return !!(w.__TAURI__ ?? w.__TAURI_INTERNALS__);
38
+ }
39
+
40
+ function currentWindowLabel(internals: TauriInternals): string {
41
+ return internals.metadata?.currentWindow?.label || 'main';
42
+ }
43
+
44
+ /** Native macOS / OS fullscreen via Tauri window plugin (no npm import required). */
45
+ async function readTauriFullscreen(): Promise<boolean> {
46
+ const internals = getTauriInternals();
47
+ if (!internals?.invoke) return false;
48
+ try {
49
+ return Boolean(
50
+ await internals.invoke('plugin:window|is_fullscreen', {
51
+ label: currentWindowLabel(internals),
52
+ }),
53
+ );
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Listen for window resize (includes fullscreen transitions on macOS).
61
+ * Uses Tauri event IPC when available; falls back to DOM `resize`.
62
+ */
63
+ async function listenTauriWindowResized(handler: () => void): Promise<() => void> {
64
+ const internals = getTauriInternals();
65
+ if (internals?.invoke && internals.transformCallback) {
66
+ const label = currentWindowLabel(internals);
67
+ const callbackId = internals.transformCallback(() => {
68
+ handler();
69
+ }, false);
70
+ try {
71
+ const eventId = (await internals.invoke('plugin:event|listen', {
72
+ event: 'tauri://resize',
73
+ target: { kind: 'Window', label },
74
+ handler: callbackId,
75
+ })) as number;
76
+ return () => {
77
+ internals.unregisterCallback?.(callbackId);
78
+ void internals
79
+ .invoke('plugin:event|unlisten', { event: 'tauri://resize', eventId })
80
+ .catch(() => undefined);
81
+ };
82
+ } catch {
83
+ internals.unregisterCallback?.(callbackId);
84
+ }
85
+ }
86
+
87
+ window.addEventListener('resize', handler);
88
+ return () => window.removeEventListener('resize', handler);
89
+ }
90
+
13
91
  export function useIsTauriClient(): boolean {
14
92
  const [value, setValue] = useState(() => isTauri());
15
93
 
@@ -22,24 +100,96 @@ export function useIsTauriClient(): boolean {
22
100
  return value;
23
101
  }
24
102
 
25
- /** Overlay titlebar chrome: Tauri on macOS, desktop (non-mobile) viewport. */
103
+ /** Live Tauri webview (not merely a tauri-targeted web build). */
104
+ export function useIsTauriRuntime(): boolean {
105
+ const [value, setValue] = useState(() => isTauriRuntime());
106
+
107
+ useEffect(() => {
108
+ setValue(isTauriRuntime());
109
+ // __TAURI_INTERNALS__ can appear slightly after first paint in dev.
110
+ const timer = window.setTimeout(() => setValue(isTauriRuntime()), 200);
111
+ return () => window.clearTimeout(timer);
112
+ }, []);
113
+
114
+ return value;
115
+ }
116
+
117
+ /**
118
+ * Native window fullscreen (Tauri `is_fullscreen` + resize listener).
119
+ * Resize can fire before macOS updates fullscreen state, so we re-check after a short delay.
120
+ * @see https://v2.tauri.app/reference/javascript/api/namespacewindow/#isfullscreen
121
+ */
122
+ export function useIsTauriFullscreen(): boolean {
123
+ const tauriRuntime = useIsTauriRuntime();
124
+ const [fullscreen, setFullscreen] = useState(false);
125
+
126
+ useEffect(() => {
127
+ if (!tauriRuntime) {
128
+ setFullscreen(false);
129
+ return;
130
+ }
131
+
132
+ let cancelled = false;
133
+ let unlisten: (() => void) | undefined;
134
+ let debounceTimer: number | undefined;
135
+
136
+ const sync = async () => {
137
+ const next = await readTauriFullscreen();
138
+ if (!cancelled) setFullscreen(next);
139
+ };
140
+
141
+ void (async () => {
142
+ await sync();
143
+ unlisten = await listenTauriWindowResized(() => {
144
+ void sync();
145
+ window.clearTimeout(debounceTimer);
146
+ // macOS often flips isFullscreen after the resize notification.
147
+ debounceTimer = window.setTimeout(() => {
148
+ void sync();
149
+ }, 400);
150
+ });
151
+ })();
152
+
153
+ return () => {
154
+ cancelled = true;
155
+ window.clearTimeout(debounceTimer);
156
+ unlisten?.();
157
+ };
158
+ }, [tauriRuntime]);
159
+
160
+ return fullscreen;
161
+ }
162
+
163
+ /**
164
+ * macOS Tauri desktop chrome (history buttons, collapsed titlebar, drag regions).
165
+ * Desktop viewport only — narrow/mobile layouts use the sheet / top header instead.
166
+ * Stays on in native fullscreen; only the traffic-light *inset* goes away there.
167
+ */
26
168
  export function useMacOverlayChrome(): boolean {
27
- const trafficLights = useMacTrafficLights();
169
+ const tauriRuntime = useIsTauriRuntime();
28
170
  const isMobile = useIsMobile();
29
- return trafficLights && !isMobile;
171
+ const [isMac, setIsMac] = useState(false);
172
+
173
+ useEffect(() => {
174
+ setIsMac(isMacOSDesktop());
175
+ }, []);
176
+
177
+ return tauriRuntime && isMac && !isMobile;
30
178
  }
31
179
 
32
180
  /**
33
- * Native macOS traffic lights are on the window (Tauri macOS), including
34
- * narrow / mobile layouts where overlay chrome is otherwise disabled.
181
+ * Native macOS traffic lights that need chrome inset: live Tauri webview on
182
+ * macOS, windowed (not native fullscreen — lights are hidden there).
183
+ * Applies at any viewport width (narrow window / mobile layout included).
35
184
  */
36
185
  export function useMacTrafficLights(): boolean {
37
- const tauri = useIsTauriClient();
186
+ const tauriRuntime = useIsTauriRuntime();
187
+ const fullscreen = useIsTauriFullscreen();
38
188
  const [isMac, setIsMac] = useState(false);
39
189
 
40
190
  useEffect(() => {
41
191
  setIsMac(isMacOSDesktop());
42
192
  }, []);
43
193
 
44
- return tauri && isMac;
194
+ return tauriRuntime && isMac && !fullscreen;
45
195
  }
@@ -4,8 +4,12 @@ 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, useMacOverlayChrome } from '../chrome/runtime';
8
- import { DESKTOP_TITLEBAR_HEIGHT_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
7
+ import { useIsTauriClient, useMacTrafficLights } from '../chrome/runtime';
8
+ import {
9
+ DESKTOP_TITLEBAR_HEIGHT_PX,
10
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
11
+ MAC_TRAFFIC_LIGHTS_WIDTH_PX,
12
+ } from '../chrome/constants';
9
13
 
10
14
  interface FullscreenLayoutProps {
11
15
  title?: string;
@@ -26,7 +30,7 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
26
30
  const location = useLocation();
27
31
  const { i18n } = useTranslation();
28
32
  const isTauriEnv = useIsTauriClient();
29
- const overlay = useMacOverlayChrome();
33
+ const trafficLights = useMacTrafficLights();
30
34
  const currentLanguage = i18n.language || 'en';
31
35
  const navigationItems = useMemo(() => flattenNavigationItems(navigation), [navigation]);
32
36
 
@@ -54,7 +58,8 @@ export function FullscreenLayout({ title, navigation, children }: FullscreenLayo
54
58
  className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
55
59
  style={{
56
60
  height: DESKTOP_TITLEBAR_HEIGHT_PX,
57
- paddingLeft: overlay ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 8,
61
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
62
+ paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 8,
58
63
  }}
59
64
  >
60
65
  <DesktopHistoryButtons />
@@ -13,6 +13,7 @@ import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
13
13
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
14
14
  import {
15
15
  DESKTOP_TITLEBAR_HEIGHT_PX,
16
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
16
17
  MAC_TRAFFIC_LIGHTS_GAP_PX,
17
18
  MAC_TRAFFIC_LIGHTS_WIDTH_PX,
18
19
  } from '../chrome/constants';
@@ -76,44 +77,45 @@ export function SidebarInner({
76
77
  <>
77
78
  <SidebarHeader
78
79
  className={cn(
79
- 'border-b border-sidebar-border select-none',
80
- showOverlayHeader && 'gap-0 p-0',
80
+ // Always pin to titlebar height — default SidebarHeader p-2 is taller on web.
81
+ 'gap-0 border-b border-sidebar-border select-none',
82
+ showOverlayHeader || mobileSheetHeader ? 'p-0' : 'px-2 py-0',
81
83
  showCollapsedTopBar && 'hidden',
82
- mobileSheetHeader && 'gap-0 p-0',
83
84
  )}
84
- style={
85
- mobileSheetHeader
86
- ? {
87
- height: DESKTOP_TITLEBAR_HEIGHT_PX,
88
- paddingLeft: mobileTrafficInset,
89
- }
90
- : undefined
91
- }
85
+ style={{
86
+ height: DESKTOP_TITLEBAR_HEIGHT_PX,
87
+ // Nudge controls down so they optically match centered traffic lights.
88
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
89
+ ...(mobileSheetHeader ? { paddingLeft: mobileTrafficInset } : {}),
90
+ }}
92
91
  {...(showOverlayHeader
93
92
  ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
94
93
  : {})}
95
94
  >
96
95
  {showOverlayHeader ? (
97
96
  <div
98
- className="flex w-full shrink-0 items-stretch"
99
- style={{ height: DESKTOP_TITLEBAR_HEIGHT_PX }}
97
+ className="flex h-full w-full shrink-0 items-stretch"
100
98
  data-shellui-drag-region=""
101
99
  data-tauri-drag-region=""
102
100
  >
103
- <div
104
- className="h-full shrink-0"
105
- style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
106
- aria-hidden
107
- />
101
+ {trafficLights ? (
102
+ <div
103
+ className="h-full shrink-0"
104
+ style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
105
+ aria-hidden
106
+ />
107
+ ) : null}
108
108
  <div
109
109
  className="flex h-full min-w-0 flex-1 items-center gap-1"
110
- style={{ paddingLeft: MAC_TRAFFIC_LIGHTS_GAP_PX }}
110
+ style={{
111
+ paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_GAP_PX : 8,
112
+ }}
111
113
  >
112
114
  {hasAppIcon ? brandIcon : null}
113
115
  {!hasAppIcon ? (
114
116
  <SidebarTrigger
115
117
  data-shellui-no-drag=""
116
- className="size-8 shrink-0 touch-manipulation"
118
+ className="size-7 shrink-0 touch-manipulation"
117
119
  />
118
120
  ) : null}
119
121
  <div
@@ -126,20 +128,14 @@ export function SidebarInner({
126
128
  {hasAppIcon ? (
127
129
  <SidebarTrigger
128
130
  data-shellui-no-drag=""
129
- className="size-8 shrink-0 touch-manipulation"
131
+ className="size-7 shrink-0 touch-manipulation"
130
132
  />
131
133
  ) : null}
132
134
  {hasAppIcon ? trailingInset : null}
133
135
  </div>
134
136
  </div>
135
137
  ) : (
136
- <div
137
- className={cn(
138
- 'flex w-full items-center',
139
- hasAppIcon ? 'gap-0' : 'gap-0.5',
140
- mobileSheetHeader && 'h-full',
141
- )}
142
- >
138
+ <div className={cn('flex h-full w-full items-center', hasAppIcon ? 'gap-0' : 'gap-0.5')}>
143
139
  {brandIcon}
144
140
  {hasAppIcon ? (
145
141
  <div
@@ -147,7 +143,7 @@ export function SidebarInner({
147
143
  className="min-w-0 flex-1"
148
144
  />
149
145
  ) : null}
150
- <SidebarTrigger className="size-8 shrink-0 touch-manipulation" />
146
+ <SidebarTrigger className="size-7 shrink-0 touch-manipulation" />
151
147
  {trailingInset}
152
148
  </div>
153
149
  )}
@@ -27,11 +27,17 @@ import { useModal } from '../../modal/ModalContext';
27
27
  import { useDrawer } from '../../drawer/DrawerContext';
28
28
  import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
29
29
  import { CollapsedDesktopTitlebar } from '../chrome/CollapsedDesktopTitlebar';
30
+ import {
31
+ isShellUiRootWindow,
32
+ SafeAreaTopbarOffset,
33
+ SafeAreaTopbarStrip,
34
+ } from '../chrome/SafeAreaTopbar';
30
35
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
31
36
  import {
32
37
  MAC_TRAFFIC_LIGHTS_GAP_PX,
33
38
  MAC_TRAFFIC_LIGHTS_WIDTH_PX,
34
39
  DESKTOP_TITLEBAR_HEIGHT_PX,
40
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
35
41
  } from '../chrome/constants';
36
42
 
37
43
  /** Close the mobile sheet when the route changes. */
@@ -75,26 +81,6 @@ function CollapsedTitlebarOffset() {
75
81
  return null;
76
82
  }
77
83
 
78
- /** True when this window is the outermost shell (not nested in an iframe). */
79
- function isShellUiRootWindow(): boolean {
80
- return typeof window !== 'undefined' && window.parent === window;
81
- }
82
-
83
- /**
84
- * Root sidebar only: advertise the safe-area topbar on <html> so fixed chrome
85
- * (sidebar container, drawers) can clear it. Nested iframe shells skip this.
86
- */
87
- function SafeAreaTopbarOffset({ enabled }: { enabled: boolean }) {
88
- useEffect(() => {
89
- if (!enabled) return;
90
- const root = document.documentElement;
91
- root.setAttribute('data-shellui-safe-area-topbar', '');
92
- return () => root.removeAttribute('data-shellui-safe-area-topbar');
93
- }, [enabled]);
94
-
95
- return null;
96
- }
97
-
98
84
  const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps) => {
99
85
  const { i18n } = useTranslation();
100
86
  const { isAuthenticated } = useAuth();
@@ -153,16 +139,7 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
153
139
  top safe-area, painted with sidebar background. Height is 0 when the inset
154
140
  is 0; overflow clips the border so no stray hairline.
155
141
  */}
156
- {showSafeAreaTopbar ? (
157
- <div
158
- aria-hidden
159
- data-slot="sidebar-safe-area-top"
160
- className="relative z-0 hidden shrink-0 overflow-hidden md:block"
161
- style={{ height: 'var(--shellui-safe-area-top)' }}
162
- >
163
- <div className="box-border h-full border-b border-sidebar-border bg-sidebar" />
164
- </div>
165
- ) : null}
142
+ <SafeAreaTopbarStrip enabled={showSafeAreaTopbar} />
166
143
  <SidebarProvider className="min-h-0 flex-1 overflow-hidden">
167
144
  <CloseMobileSidebarOnNavigate />
168
145
  <CloseMobileSidebarOnOverlay />
@@ -192,7 +169,9 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
192
169
  <header
193
170
  className="relative z-[46] flex shrink-0 items-center gap-0.5 border-b border-border bg-background px-3 select-none md:hidden"
194
171
  style={{
195
- paddingTop: showSafeAreaTopbar ? 'var(--shellui-safe-area-top)' : undefined,
172
+ paddingTop: showSafeAreaTopbar
173
+ ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
174
+ : DESKTOP_TITLEBAR_PAD_TOP_PX,
196
175
  height: showSafeAreaTopbar
197
176
  ? `calc(${DESKTOP_TITLEBAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`
198
177
  : DESKTOP_TITLEBAR_HEIGHT_PX,
package/src/index.css CHANGED
@@ -97,14 +97,14 @@
97
97
  }
98
98
 
99
99
  /*
100
- * Content padding that clears the notch / home indicator while keeping a minimum
101
- * inset. Override mins with --shellui-safe-pad-x / --shellui-safe-pad-y.
100
+ * Content padding that clears the notch / home indicator, then keeps the
101
+ * configured inset beyond that edge. Override with --shellui-safe-pad-x / -y.
102
102
  */
103
103
  .shellui-safe-pad {
104
- padding-top: max(var(--shellui-safe-pad-y, 1.5rem), var(--shellui-safe-area-top));
105
- padding-right: max(var(--shellui-safe-pad-x, 1.5rem), var(--shellui-safe-area-right));
106
- padding-bottom: max(var(--shellui-safe-pad-y, 1.5rem), var(--shellui-safe-area-bottom));
107
- padding-left: max(var(--shellui-safe-pad-x, 1.5rem), var(--shellui-safe-area-left));
104
+ padding-top: calc(var(--shellui-safe-pad-y, 1.5rem) + var(--shellui-safe-area-top));
105
+ padding-right: calc(var(--shellui-safe-pad-x, 1.5rem) + var(--shellui-safe-area-right));
106
+ padding-bottom: calc(var(--shellui-safe-pad-y, 1.5rem) + var(--shellui-safe-area-bottom));
107
+ padding-left: calc(var(--shellui-safe-pad-x, 1.5rem) + var(--shellui-safe-area-left));
108
108
  }
109
109
 
110
110
  /*
@@ -789,7 +789,7 @@ html.shellui-theme-switching
789
789
  }
790
790
 
791
791
  html[data-shellui-overlay-chrome] {
792
- --shellui-titlebar-height: 38px;
792
+ --shellui-titlebar-height: 42px;
793
793
  --shellui-traffic-lights-width: 78px;
794
794
  }
795
795
 
@@ -800,8 +800,10 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
800
800
 
801
801
  /*
802
802
  * Tablet / desktop: fixed shell sidebar sits below the layout safe-area strip.
803
- * Only when the root (non-iframe) sidebar layout advertised the topbar.
804
- * Drawer overlay stays full-bleed (topbar dims behind it); panels clear the inset.
803
+ * Only when the root (non-iframe) layout advertised the topbar via
804
+ * data-shellui-safe-area-topbar. Drawer overlay stays full-bleed (topbar dims
805
+ * behind it); left/right/top drawer panels clear the inset so they never cover
806
+ * the strip. Height is 0 when env(safe-area-inset-top) is 0.
805
807
  */
806
808
  @media (min-width: 768px) {
807
809
  html[data-shellui-safe-area-topbar]
@@ -817,6 +819,7 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
817
819
  html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='left'],
818
820
  html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='right'] {
819
821
  top: var(--shellui-safe-area-top);
822
+ bottom: 0;
820
823
  height: auto;
821
824
  }
822
825
 
@@ -829,14 +832,14 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
829
832
  }
830
833
  }
831
834
 
832
- /* Collapsed Tauri: full-width 38px titlebar; push sidebar + content below it. */
835
+ /* Collapsed Tauri: full-width 42px titlebar; push sidebar + content below it. */
833
836
  html[data-shellui-collapsed-titlebar]
834
837
  [data-shellui-sidebar-layout]
835
838
  > [data-slot='sidebar-wrapper']
836
839
  > [data-slot='sidebar']
837
840
  > [data-slot='sidebar-container'] {
838
- top: var(--shellui-titlebar-height, 38px);
839
- height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-titlebar-height, 38px));
841
+ top: var(--shellui-titlebar-height, 42px);
842
+ height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-titlebar-height, 42px));
840
843
  }
841
844
 
842
845
  html[data-shellui-collapsed-titlebar][data-shellui-safe-area-topbar]
@@ -844,10 +847,10 @@ html[data-shellui-collapsed-titlebar][data-shellui-safe-area-topbar]
844
847
  > [data-slot='sidebar-wrapper']
845
848
  > [data-slot='sidebar']
846
849
  > [data-slot='sidebar-container'] {
847
- top: calc(var(--shellui-safe-area-top) + var(--shellui-titlebar-height, 38px));
850
+ top: calc(var(--shellui-safe-area-top) + var(--shellui-titlebar-height, 42px));
848
851
  height: calc(
849
852
  var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top) -
850
- var(--shellui-titlebar-height, 38px)
853
+ var(--shellui-titlebar-height, 42px)
851
854
  );
852
855
  }
853
856
 
@@ -855,7 +858,7 @@ html[data-shellui-collapsed-titlebar]
855
858
  [data-shellui-sidebar-layout]
856
859
  > [data-slot='sidebar-wrapper']
857
860
  > [data-slot='sidebar-inset'] {
858
- padding-top: var(--shellui-titlebar-height, 38px);
861
+ padding-top: var(--shellui-titlebar-height, 42px);
859
862
  }
860
863
 
861
864
  /* Root safe-area topbar: collapsed chrome sits below the status band. */