@shellui/core 0.6.1 → 0.6.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.
Files changed (27) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/src/features/admin/AdminView.tsx +18 -4
  4. package/src/features/auth/AuthProvider.tsx +18 -1
  5. package/src/features/auth/utils/desktopSignIn.spec.ts +41 -0
  6. package/src/features/auth/utils/desktopSignIn.ts +38 -0
  7. package/src/features/chromeActions/ChromeActionsHost.tsx +7 -1
  8. package/src/features/chromeActions/computeActionInsets.ts +6 -0
  9. package/src/features/layouts/appbar/AppBarLayout.tsx +39 -9
  10. package/src/features/layouts/chrome/ContentDragOverlay.tsx +14 -7
  11. package/src/features/layouts/chrome/DesktopChrome.tsx +3 -1
  12. package/src/features/layouts/floating/FloatingLayout.tsx +4 -1
  13. package/src/features/layouts/floating/FloatingSidebar.tsx +84 -28
  14. package/src/features/layouts/floating/computeFloatingInsets.spec.ts +19 -0
  15. package/src/features/layouts/floating/computeFloatingInsets.ts +40 -8
  16. package/src/features/layouts/floating/layoutChromeStore.ts +13 -0
  17. package/src/features/layouts/floating/useFloatingChrome.ts +11 -5
  18. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +3 -0
  19. package/src/features/layouts/sidebar/SidebarInner.tsx +5 -0
  20. package/src/features/layouts/sidebar/SidebarLayout.tsx +1 -0
  21. package/src/features/layouts/windows/WindowsLayout.tsx +106 -46
  22. package/src/features/security/trustedFrames.spec.ts +17 -1
  23. package/src/features/security/trustedFrames.ts +31 -9
  24. package/src/features/settings/SettingsProvider.tsx +3 -0
  25. package/src/features/settings/utils/buildSettingsForPropagation.ts +9 -2
  26. package/src/index.css +16 -1
  27. package/src/lib/z-index.ts +5 -0
package/README.md CHANGED
@@ -6,7 +6,7 @@ React runtime for the Shellui host. `@shellui/cli` depends on this package. Inst
6
6
  npm install @shellui/core
7
7
  ```
8
8
 
9
- Shellui **0.6.1** is the current stable release: `npm install @shellui/core@0.6.1`.
9
+ Shellui **0.6.2** is the current stable release: `npm install @shellui/core@0.6.2`.
10
10
 
11
11
  ```typescript
12
12
  import type { ShellUIConfig } from '@shellui/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Shellui Core - Core React application runtime",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "workbox-routing": "^7.4.0",
74
74
  "workbox-strategies": "^7.4.0",
75
75
  "workbox-window": "^7.4.0",
76
- "@shellui/sdk": "0.6.1"
76
+ "@shellui/sdk": "0.6.2"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "react": "^18.0.0 || ^19.0.0",
@@ -10,10 +10,13 @@ import { useConfig } from '../config/useConfig';
10
10
  import type { NavigationItem } from '../config/types';
11
11
  import { AppLayout } from '../layouts/AppLayout';
12
12
  import {
13
+ MAC_TRAFFIC_LIGHTS_GAP_PX,
14
+ MAC_TRAFFIC_LIGHTS_WIDTH_PX,
13
15
  isShellUiRootWindow,
14
16
  SafeAreaTopbarOffset,
15
17
  SafeAreaTopbarStrip,
16
- } from '../layouts/chrome/SafeAreaTopbar';
18
+ useMacTrafficLights,
19
+ } from '../layouts/chrome';
17
20
  import { AdminForbiddenAccess } from './components/AdminForbiddenAccess';
18
21
  import { getAdminContentUrl, getAdminPath } from './config';
19
22
  import { buildAdminIframeSrc } from './utils';
@@ -70,8 +73,12 @@ export const AdminView = () => {
70
73
  }, [config?.title]);
71
74
 
72
75
  const showSafeAreaTopbar = isShellUiRootWindow();
76
+ const trafficLights = useMacTrafficLights();
77
+ const chromeInset = trafficLights
78
+ ? MAC_TRAFFIC_LIGHTS_WIDTH_PX + MAC_TRAFFIC_LIGHTS_GAP_PX
79
+ : undefined;
73
80
  const headerStyle = {
74
- paddingLeft: 'max(0.5rem, var(--shellui-safe-area-left))',
81
+ paddingLeft: chromeInset ?? 'max(0.5rem, var(--shellui-safe-area-left))',
75
82
  paddingRight: 'max(0.75rem, var(--shellui-safe-area-right))',
76
83
  ...(isMobile && showSafeAreaTopbar
77
84
  ? {
@@ -90,13 +97,17 @@ export const AdminView = () => {
90
97
  <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
91
98
  <SafeAreaTopbarStrip enabled={showSafeAreaTopbar} />
92
99
  <header
93
- className="flex shrink-0 items-center justify-between border-b bg-card"
100
+ className="relative z-[46] flex shrink-0 items-center justify-between border-b bg-card select-none"
94
101
  style={headerStyle}
102
+ {...(trafficLights
103
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
104
+ : {})}
95
105
  >
96
106
  <Button
97
107
  type="button"
98
108
  variant="ghost"
99
109
  size="sm"
110
+ data-shellui-no-drag=""
100
111
  onClick={() => navigate('/')}
101
112
  >
102
113
  <svg
@@ -114,7 +125,10 @@ export const AdminView = () => {
114
125
  </svg>
115
126
  Back to home
116
127
  </Button>
117
- <div className="flex items-center gap-2">
128
+ <div
129
+ data-shellui-no-drag=""
130
+ className="flex items-center gap-2"
131
+ >
118
132
  <LoginButton
119
133
  variant="appbar"
120
134
  logoutOnly
@@ -632,23 +632,40 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
632
632
  }, [backend, bffAuthEnabled, session]);
633
633
 
634
634
  useEffect(() => {
635
+ if (typeof window === 'undefined' || window.parent !== window) return;
635
636
  const liveTauri = tauriRuntime || isLiveTauriRuntime();
636
637
  if (!shouldUseDesktopSignIn(config, liveTauri)) return;
637
638
  const scheme = normalizeDesktopScheme(config.auth?.desktopScheme);
638
639
  if (!scheme) return;
639
640
  setActiveDesktopScheme(scheme);
640
641
  let cancelled = false;
642
+
643
+ // The login page may sit in a modal or drawer iframe that cannot see this result.
644
+ const finishOverlayLogin = (failure: string | null) => {
645
+ postShellMessage({ type: 'SHELLUI_CLOSE_MODAL', payload: {} });
646
+ postShellMessage({ type: 'SHELLUI_CLOSE_DRAWER', payload: {} });
647
+ if (failure === null || window.location.pathname === urls.login) return;
648
+ shellui.toast({
649
+ type: 'error',
650
+ title: i18n.getFixedT(null, 'common')('loginPage.signInCouldNotContinue'),
651
+ description: failure || undefined,
652
+ });
653
+ };
654
+
641
655
  const unsubscribe = subscribeDesktopAuth((event) => {
642
656
  if (cancelled) return;
643
657
  if (event.type === 'error') {
644
658
  setError(event.message);
645
659
  setErrorCode(event.errorCode);
660
+ finishOverlayLogin(event.message);
646
661
  return;
647
662
  }
648
663
  void completeOAuthSessionCallback({
649
664
  authCode: event.authCode,
650
665
  redirectTo: event.redirectTo,
651
666
  codeVerifier: event.codeVerifier,
667
+ }).then((result) => {
668
+ if (!cancelled) finishOverlayLogin(result.ok ? null : (result.error ?? ''));
652
669
  });
653
670
  });
654
671
  void ensureDesktopDeepLinkListener({ replayLaunchUrl: true });
@@ -656,7 +673,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
656
673
  cancelled = true;
657
674
  unsubscribe();
658
675
  };
659
- }, [completeOAuthSessionCallback, config, tauriRuntime]);
676
+ }, [completeOAuthSessionCallback, config, i18n, tauriRuntime]);
660
677
 
661
678
  useEffect(() => {
662
679
  if (typeof window === 'undefined' || window.parent !== window) {
@@ -159,4 +159,45 @@ describe('desktop sign-in', () => {
159
159
  expect(invoke).toHaveBeenCalledWith('plugin:deep-link|get_current');
160
160
  expect(events[0]).toMatchObject({ type: 'code', authCode: 'from-launch' });
161
161
  });
162
+
163
+ test('brings the window forward for each sign-in link, even a spent one', async () => {
164
+ const invoke = vi.fn(async (_cmd: string, _args?: Record<string, unknown>) => null);
165
+ vi.stubGlobal('window', {
166
+ __TAURI_INTERNALS__: { invoke, metadata: { currentWindow: { label: 'main' } } },
167
+ });
168
+ setActiveDesktopScheme(SCHEME);
169
+ await createAndStoreDesktopPkce(SCHEME);
170
+
171
+ const callback = 'shellui-playground://callback?shellui_auth_code=focus-code';
172
+ handleDesktopAuthCallback(callback);
173
+ handleDesktopAuthCallback(callback);
174
+ handleDesktopAuthCallback('other-app://callback?shellui_auth_code=focus-code');
175
+ await vi.waitFor(() => expect(invoke).toHaveBeenCalledTimes(6));
176
+
177
+ for (const cmd of [
178
+ 'plugin:window|unminimize',
179
+ 'plugin:window|show',
180
+ 'plugin:window|set_focus',
181
+ ]) {
182
+ expect(invoke.mock.calls.filter((call) => call[0] === cmd)).toEqual([
183
+ [cmd, { label: 'main' }],
184
+ [cmd, { label: 'main' }],
185
+ ]);
186
+ }
187
+ });
188
+
189
+ test('a login page in an iframe leaves deep links to the top-level shell', async () => {
190
+ const invoke = vi.fn(async () => ['shellui-playground://callback?shellui_auth_code=x']);
191
+ const parent = {};
192
+ vi.stubGlobal('window', {
193
+ parent,
194
+ __TAURI_INTERNALS__: { invoke, transformCallback: () => 9 },
195
+ });
196
+ setActiveDesktopScheme(SCHEME);
197
+ await createAndStoreDesktopPkce(SCHEME);
198
+
199
+ await ensureDesktopDeepLinkListener();
200
+
201
+ expect(invoke).not.toHaveBeenCalled();
202
+ });
162
203
  });
@@ -28,6 +28,8 @@ export type DesktopAuthOpenUrl = (url: string) => void | Promise<void>;
28
28
 
29
29
  export type DesktopAuthUrlListener = (urls: string[]) => void;
30
30
 
31
+ export type DesktopAuthFocusWindow = () => void | Promise<void>;
32
+
31
33
  /**
32
34
  * Subscribe to OS deep links. Wire `@tauri-apps/plugin-deep-link` `onOpenUrl`.
33
35
  * Return an unsubscribe function when the plugin provides one.
@@ -41,6 +43,8 @@ export interface DesktopAuthAdapters {
41
43
  openUrl: DesktopAuthOpenUrl;
42
44
  /** Optional. When omitted, the shell listens with Tauri's deep-link plugin IPC. */
43
45
  onOpenUrl?: DesktopAuthOnOpenUrl;
46
+ /** Optional. When omitted, the shell focuses its window with Tauri's window plugin IPC. */
47
+ focusWindow?: DesktopAuthFocusWindow;
44
48
  }
45
49
 
46
50
  export type DesktopAuthEvent =
@@ -51,6 +55,7 @@ type TauriInternals = {
51
55
  invoke: (cmd: string, args?: Record<string, unknown>) => Promise<unknown>;
52
56
  transformCallback?: (callback: (data: unknown) => void, once?: boolean) => number;
53
57
  unregisterCallback?: (id: number) => void;
58
+ metadata?: { currentWindow?: { label?: string } };
54
59
  };
55
60
 
56
61
  let adapters: DesktopAuthAdapters | null = null;
@@ -314,6 +319,27 @@ export async function beginDesktopOAuth(input: {
314
319
  }
315
320
  }
316
321
 
322
+ /**
323
+ * The browser stays in front after it hands over the deep link.
324
+ * Needs `core:window:allow-unminimize`, `allow-show`, and `allow-set-focus`.
325
+ */
326
+ async function focusDesktopWindow(): Promise<void> {
327
+ if (adapters?.focusWindow) {
328
+ await adapters.focusWindow();
329
+ return;
330
+ }
331
+ const internals = getTauriInternals();
332
+ if (!internals?.invoke) return;
333
+ const label = internals.metadata?.currentWindow?.label || 'main';
334
+ for (const cmd of ['plugin:window|unminimize', 'plugin:window|show', 'plugin:window|set_focus']) {
335
+ try {
336
+ await internals.invoke(cmd, { label });
337
+ } catch {
338
+ // A capability without this window permission leaves the window where it is.
339
+ }
340
+ }
341
+ }
342
+
317
343
  /**
318
344
  * Feed one deep-link URL, for example from `@tauri-apps/plugin-deep-link` `onOpenUrl`.
319
345
  * Codes, verifiers, and tokens are not logged.
@@ -323,6 +349,8 @@ export function handleDesktopAuthCallback(rawUrl: string): void {
323
349
  if (!scheme || typeof rawUrl !== 'string' || !rawUrl) return;
324
350
  const parsed = parseDesktopAuthCallback(rawUrl, scheme);
325
351
  if (!parsed) return;
352
+ // A second "Return to app" click repeats a spent code. It should still raise the window.
353
+ void focusDesktopWindow().catch(() => undefined);
326
354
 
327
355
  if (parsed.kind === 'error') {
328
356
  clearDesktopPkce();
@@ -371,9 +399,19 @@ async function readCurrentDeepLinks(): Promise<void> {
371
399
  }
372
400
  }
373
401
 
402
+ /**
403
+ * A login page in a modal or drawer iframe shares the verifier through `sessionStorage`.
404
+ * Only the top-level shell takes deep links, so the iframe cannot spend it.
405
+ */
406
+ function isEmbeddedFrame(): boolean {
407
+ if (typeof window === 'undefined') return false;
408
+ return Boolean(window.parent) && window.parent !== window;
409
+ }
410
+
374
411
  export function ensureDesktopDeepLinkListener(options?: {
375
412
  replayLaunchUrl?: boolean;
376
413
  }): Promise<void> {
414
+ if (isEmbeddedFrame()) return Promise.resolve();
377
415
  const replay = options?.replayLaunchUrl !== false;
378
416
  if (listenerPromise) {
379
417
  if (replay && !replayedLaunchUrl) {
@@ -33,9 +33,11 @@ import {
33
33
  } from '../../components/ui/tooltip';
34
34
  import { cn } from '../../lib/utils';
35
35
  import { useViewport } from '../../hooks/use-viewport';
36
+ import { isTauriRuntime } from '../layouts/chrome/runtime';
36
37
  import { useSettings } from '../settings/hooks/useSettings';
37
38
  import {
38
39
  FLOATING_CHROME_MARGIN,
40
+ TAURI_FLOATING_ACTION_SIDEBAR_GAP_PX,
39
41
  floatingTabBarBottomPadCss,
40
42
  floatingTabBarHeight,
41
43
  } from '../layouts/floating/computeFloatingInsets';
@@ -1039,7 +1041,11 @@ function TopActionBar({
1039
1041
  ? {
1040
1042
  // One animated edge (inset + collapsed-chip clearance) so actions
1041
1043
  // track the floating sidebar / layout resize instead of fighting it.
1042
- left: `calc(var(--shellui-inset-left, 0px) + var(--shellui-chrome-actions-leading-extra, 0px))`,
1044
+ left: `calc(var(--shellui-inset-left, 0px) + var(--shellui-chrome-actions-leading-extra, 0px) + ${
1045
+ isTauriRuntime() && layout === 'floating' && sidebarExpanded
1046
+ ? TAURI_FLOATING_ACTION_SIDEBAR_GAP_PX
1047
+ : 0
1048
+ }px)`,
1043
1049
  right: 'var(--shellui-inset-right, 0px)',
1044
1050
  // Match InsetMobileRadiusOverlay cutout so the bright scrim doesn’t
1045
1051
  // square off the top card corners.
@@ -1,4 +1,6 @@
1
1
  import type { LayoutChromeInsets, LayoutChromeViewport } from '@shellui/sdk';
2
+ import { DESKTOP_TITLEBAR_HEIGHT_PX } from '../layouts/chrome/constants';
3
+ import { isTauriRuntime } from '../layouts/chrome/runtime';
2
4
  import {
3
5
  FLOATING_CHROME_MARGIN,
4
6
  FLOATING_CONTENT_CLEARANCE,
@@ -93,6 +95,10 @@ export function chromeActionsTopMargin(
93
95
 
94
96
  const { layout, viewport } = context;
95
97
  if (layout === 'floating') {
98
+ if (isTauriRuntime() && viewport === 'desktop') {
99
+ // Center the row in the overlay titlebar, then nudge it off the window edge.
100
+ return Math.round((DESKTOP_TITLEBAR_HEIGHT_PX - chromeActionsTopBarHeight(viewport)) / 2) + 4;
101
+ }
96
102
  return viewport === 'desktop' ? CHROME_ACTIONS_TOP_MARGIN_DESKTOP : CHROME_ACTIONS_TOP_MARGIN;
97
103
  }
98
104
  return CHROME_ACTIONS_TOP_MARGIN_MINIMAL;
@@ -53,8 +53,13 @@ import {
53
53
  } from '../chrome/SafeAreaTopbar';
54
54
  import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
55
55
  import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
56
+ import {
57
+ DESKTOP_TITLEBAR_HEIGHT_PX,
58
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
59
+ MAC_TRAFFIC_LIGHTS_GAP_PX,
60
+ MAC_TRAFFIC_LIGHTS_WIDTH_PX,
61
+ } from '../chrome/constants';
56
62
  import { useIsTauriRuntime, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
57
- import { MAC_TRAFFIC_LIGHTS_GAP_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
58
63
 
59
64
  /** App-bar chrome height — taller than the 42px Tauri/sidebar title strip. */
60
65
  const APP_BAR_HEIGHT_PX = 56;
@@ -509,10 +514,13 @@ function AppBarNav({
509
514
  sections,
510
515
  activePathPrefix,
511
516
  currentLanguage,
517
+ windowDrag = false,
512
518
  }: {
513
519
  sections: NavSection[];
514
520
  activePathPrefix: string | null;
515
521
  currentLanguage: string;
522
+ /** Leftover space after the links drags the Tauri window. */
523
+ windowDrag?: boolean;
516
524
  }) {
517
525
  const { t } = useTranslation();
518
526
  const entries = useMemo(() => sectionsToEntries(sections), [sections]);
@@ -580,7 +588,6 @@ function AppBarNav({
580
588
 
581
589
  return (
582
590
  <div
583
- data-shellui-no-drag=""
584
591
  ref={containerRef}
585
592
  className="relative flex min-w-0 flex-1 items-center gap-0.5 overflow-hidden"
586
593
  >
@@ -650,6 +657,14 @@ function AppBarNav({
650
657
  currentLanguage={currentLanguage}
651
658
  />
652
659
  ) : null}
660
+ {windowDrag ? (
661
+ <div
662
+ aria-hidden
663
+ data-shellui-drag-region=""
664
+ data-tauri-drag-region=""
665
+ className="h-full min-h-8 min-w-2 flex-1 self-stretch"
666
+ />
667
+ ) : null}
653
668
  </div>
654
669
  );
655
670
  }
@@ -764,10 +779,13 @@ export function AppBarLayout({
764
779
  // Nested shell-in-iframe must not repeat the root safe-area top band.
765
780
  const showSafeAreaTopbar = isShellUiRootWindow();
766
781
  const scrollHideLayout = isInset ? 'app-bar-inset' : 'app-bar';
782
+ const titlebarAligned = isTauriRuntime && !isMobile;
783
+ const barHeightPx = titlebarAligned ? DESKTOP_TITLEBAR_HEIGHT_PX : APP_BAR_HEIGHT_PX;
784
+ const barPadTopPx = titlebarAligned ? DESKTOP_TITLEBAR_PAD_TOP_PX : APP_BAR_PAD_TOP_PX;
767
785
  const { chromeVisible } = useScrollHideChrome({
768
786
  enabled: isMobile,
769
787
  layout: scrollHideLayout,
770
- barHeightPx: APP_BAR_HEIGHT_PX,
788
+ barHeightPx,
771
789
  includeSafeArea: showSafeAreaTopbar,
772
790
  });
773
791
  const authAwareNavigation = useMemo(
@@ -838,12 +856,12 @@ export function AppBarLayout({
838
856
  paddingRight: isInset ? (isMobile ? 8 : insetFramePadPx + insetBarContentOffsetRightPx) : 8,
839
857
  ...(isMobile && showSafeAreaTopbar
840
858
  ? {
841
- paddingTop: `calc(var(--shellui-safe-area-top) + ${APP_BAR_PAD_TOP_PX}px)`,
842
- height: `calc(${APP_BAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
859
+ paddingTop: `calc(var(--shellui-safe-area-top) + ${barPadTopPx}px)`,
860
+ height: `calc(${barHeightPx}px + var(--shellui-safe-area-top))`,
843
861
  }
844
862
  : {
845
- height: APP_BAR_HEIGHT_PX,
846
- paddingTop: APP_BAR_PAD_TOP_PX,
863
+ height: barHeightPx,
864
+ paddingTop: barPadTopPx,
847
865
  }),
848
866
  } as const;
849
867
 
@@ -902,9 +920,15 @@ export function AppBarLayout({
902
920
  sections={startSections}
903
921
  activePathPrefix={activePathPrefix}
904
922
  currentLanguage={currentLanguage}
923
+ windowDrag={isTauriRuntime}
905
924
  />
906
925
  ) : (
907
- <div className="min-w-0 flex-1" />
926
+ <div
927
+ className="min-w-0 flex-1 self-stretch"
928
+ {...(isTauriRuntime
929
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
930
+ : {})}
931
+ />
908
932
  )}
909
933
 
910
934
  {isTauriRuntime ? (
@@ -982,9 +1006,15 @@ export function AppBarLayout({
982
1006
  sections={startSections}
983
1007
  activePathPrefix={activePathPrefix}
984
1008
  currentLanguage={currentLanguage}
1009
+ windowDrag={isTauriRuntime}
985
1010
  />
986
1011
  ) : (
987
- <div className="min-w-0 flex-1" />
1012
+ <div
1013
+ className="min-w-0 flex-1 self-stretch"
1014
+ {...(isTauriRuntime
1015
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
1016
+ : {})}
1017
+ />
988
1018
  )}
989
1019
 
990
1020
  {isTauriRuntime ? (
@@ -1,19 +1,26 @@
1
- import { DESKTOP_TITLEBAR_HEIGHT_PX } from './constants';
1
+ import { DESKTOP_TITLEBAR_HEIGHT_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from './constants';
2
2
 
3
3
  /**
4
- * Full-width invisible 42px strip at the top of the Tauri window.
4
+ * Narrow left strip over the traffic-light band only.
5
5
  *
6
- * Uses Tauri's official `data-tauri-drag-region` (requires
7
- * `core:window:allow-start-dragging` in capabilities). Shell controls must sit
8
- * above this strip (higher z-index) so they stay clickable.
6
+ * A full-width overlay used to sit on top of iframes and steal clicks from
7
+ * embedded content. Dragging the window still works from layout chrome
8
+ * (app bar, sidebar header, admin header, windows titlebar) and from this
9
+ * empty traffic-light spacer. Interactive iframe content to the right stays
10
+ * clickable.
11
+ *
12
+ * Requires `core:window:allow-start-dragging` in Tauri capabilities.
9
13
  */
10
14
  export function ContentDragOverlay() {
11
15
  return (
12
16
  <div
13
17
  aria-hidden
14
18
  data-tauri-drag-region
15
- className="fixed inset-x-0 top-0 z-[45] w-full"
16
- style={{ height: DESKTOP_TITLEBAR_HEIGHT_PX }}
19
+ className="fixed top-0 left-0 z-[45]"
20
+ style={{
21
+ height: DESKTOP_TITLEBAR_HEIGHT_PX,
22
+ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX,
23
+ }}
17
24
  />
18
25
  );
19
26
  }
@@ -9,9 +9,11 @@ import {
9
9
  } from './runtime';
10
10
 
11
11
  /**
12
- * Global shell host chrome: document flags + the 42px Tauri drag strip.
12
+ * Global shell host chrome: document flags + a narrow traffic-light drag strip.
13
13
  * Mounted at the app root so it stays available on every page (layouts, login,
14
14
  * settings, route error boundary, empty config) — including narrow/mobile widths.
15
+ * Full-width drag lives on layout chrome so iframe content under the titlebar
16
+ * band stays clickable.
15
17
  *
16
18
  * Sets `data-shellui-host` to `browser` | `pwa` | `tauri` so CSS / layout can
17
19
  * distinguish Safari Home Screen PWAs (iOS 27 system status gradient) from
@@ -114,7 +114,7 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
114
114
  <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
115
115
  <FloatingStatusScrim enabled={showStatusScrim} />
116
116
 
117
- {isTauriEnv ? (
117
+ {isTauriEnv && !(showSidebar && !sidebarCollapsed) ? (
118
118
  <div
119
119
  className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
120
120
  style={{
@@ -122,6 +122,9 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
122
122
  paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
123
123
  paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 8,
124
124
  }}
125
+ {...(trafficLights
126
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
127
+ : {})}
125
128
  >
126
129
  <DesktopHistoryButtons />
127
130
  </div>
@@ -15,10 +15,17 @@ import { NavIcon, ExternalLinkIcon } from '../sidebar/SidebarIcons';
15
15
  import { AppBrandIcon } from '../branding/AppBrandIcon';
16
16
  import { LoginButton } from '../../auth/components/LoginButton';
17
17
  import { cn } from '../../../lib/utils';
18
- import { useIsTauriClient, useMacTrafficLights } from '../chrome/runtime';
19
- import { MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
18
+ import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
19
+ import { useIsTauriClient, useIsTauriRuntime, useMacTrafficLights } from '../chrome/runtime';
20
+ import {
21
+ DESKTOP_TITLEBAR_HEIGHT_PX,
22
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
23
+ MAC_TRAFFIC_LIGHTS_GAP_PX,
24
+ MAC_TRAFFIC_LIGHTS_WIDTH_PX,
25
+ } from '../chrome/constants';
20
26
  import {
21
27
  FLOATING_CHROME_MARGIN,
28
+ FLOATING_HISTORY_CLUSTER_PX,
22
29
  FLOATING_SIDEBAR_TOGGLE_SIZE,
23
30
  FLOATING_SIDEBAR_WIDTH,
24
31
  } from './computeFloatingInsets';
@@ -100,9 +107,13 @@ export function FloatingSidebar({
100
107
  const lang = i18n.language || 'en';
101
108
  const trafficLights = useMacTrafficLights();
102
109
  const isTauriEnv = useIsTauriClient();
103
- const trafficPadPx = trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 0;
104
- /** History cluster only for the collapsed chip (shares the top-left corner on Tauri). */
105
- const chipLeadingPx = trafficPadPx + (isTauriEnv ? 72 : 0);
110
+ const tauriRuntime = useIsTauriRuntime();
111
+ /** Tauri drops the floating edge gap so this row shares the traffic-light band. */
112
+ const edgeMargin = tauriRuntime ? 0 : FLOATING_CHROME_MARGIN;
113
+ /** Collapsed chip clears the corner lights and the history cluster. */
114
+ const chipLeadingPx =
115
+ (trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 0) +
116
+ (isTauriEnv ? FLOATING_HISTORY_CLUSTER_PX : 0);
106
117
 
107
118
  const sidebarNav = useMemo(() => filterNavigationForSidebar(navigation), [navigation]);
108
119
  const sections = useMemo(() => buildSections(sidebarNav), [sidebarNav]);
@@ -113,15 +124,23 @@ export function FloatingSidebar({
113
124
  );
114
125
 
115
126
  const sidebarEdgePad = {
116
- paddingTop: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-top, 0px))`,
117
- paddingLeft: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-left, 0px) + ${trafficPadPx}px)`,
118
- paddingBottom: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-bottom, 0px))`,
127
+ paddingTop: `calc(${edgeMargin}px + var(--shellui-safe-area-top, 0px))`,
128
+ paddingLeft: `calc(${edgeMargin}px + var(--shellui-safe-area-left, 0px))`,
129
+ paddingBottom: `calc(${edgeMargin}px + var(--shellui-safe-area-bottom, 0px))`,
119
130
  };
120
131
 
121
- const chipEdgePad = {
122
- paddingTop: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-top, 0px))`,
123
- paddingLeft: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-left, 0px) + ${chipLeadingPx}px)`,
124
- };
132
+ const chipEdgePad = tauriRuntime
133
+ ? {
134
+ height: DESKTOP_TITLEBAR_HEIGHT_PX,
135
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
136
+ paddingLeft: `calc(var(--shellui-safe-area-left, 0px) + ${chipLeadingPx}px)`,
137
+ boxSizing: 'border-box' as const,
138
+ alignItems: 'center',
139
+ }
140
+ : {
141
+ paddingTop: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-top, 0px))`,
142
+ paddingLeft: `calc(${FLOATING_CHROME_MARGIN}px + var(--shellui-safe-area-left, 0px) + ${chipLeadingPx}px)`,
143
+ };
125
144
 
126
145
  const toggleLabel = collapsed
127
146
  ? t('develop.layout.showSidebar', { defaultValue: 'Show sidebar' })
@@ -247,6 +266,7 @@ export function FloatingSidebar({
247
266
  aria-hidden={collapsed}
248
267
  >
249
268
  <nav
269
+ data-shellui-tauri-flush={tauriRuntime ? '' : undefined}
250
270
  className={cn(
251
271
  'shellui-floating-glass pointer-events-auto flex h-full flex-col overflow-hidden',
252
272
  'origin-left will-change-transform',
@@ -258,25 +278,61 @@ export function FloatingSidebar({
258
278
  style={{ width: FLOATING_SIDEBAR_WIDTH }}
259
279
  aria-label={title || 'Navigation'}
260
280
  >
261
- <div className="flex shrink-0 items-center gap-2 border-b border-sidebar-border/80 px-2.5 py-2.5">
262
- {appIcon ? (
263
- <AppBrandIcon
264
- appIcon={appIcon}
265
- title={title}
266
- className="size-7 shrink-0"
281
+ <div
282
+ className={cn(
283
+ 'flex shrink-0 items-center border-b border-sidebar-border/80',
284
+ tauriRuntime ? 'pr-2.5' : 'gap-2 px-2.5 py-2.5',
285
+ )}
286
+ style={
287
+ tauriRuntime
288
+ ? {
289
+ height: DESKTOP_TITLEBAR_HEIGHT_PX,
290
+ paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
291
+ }
292
+ : undefined
293
+ }
294
+ {...(tauriRuntime
295
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
296
+ : {})}
297
+ >
298
+ {trafficLights ? (
299
+ <div
300
+ className="h-full shrink-0"
301
+ style={{ width: MAC_TRAFFIC_LIGHTS_WIDTH_PX }}
302
+ aria-hidden
267
303
  />
268
304
  ) : null}
269
- <span className="min-w-0 flex-1" />
270
- <button
271
- type="button"
272
- tabIndex={collapsed ? -1 : 0}
273
- className="shellui-floating-nav-control flex size-8 shrink-0 items-center justify-center text-sidebar-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
274
- aria-label={toggleLabel}
275
- aria-expanded={!collapsed}
276
- onClick={onToggleCollapsed}
305
+ <div
306
+ className="flex h-full min-w-0 flex-1 items-center gap-1"
307
+ style={{
308
+ paddingLeft: trafficLights ? MAC_TRAFFIC_LIGHTS_GAP_PX : undefined,
309
+ }}
277
310
  >
278
- <SidebarPanelIcon className="size-4" />
279
- </button>
311
+ {isTauriEnv && !collapsed ? <DesktopHistoryButtons className="self-center" /> : null}
312
+ {appIcon ? (
313
+ <AppBrandIcon
314
+ appIcon={appIcon}
315
+ title={title}
316
+ className="size-7 shrink-0"
317
+ />
318
+ ) : null}
319
+ <span
320
+ className="min-h-full min-w-0 flex-1 self-stretch"
321
+ {...(tauriRuntime
322
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
323
+ : {})}
324
+ />
325
+ <button
326
+ type="button"
327
+ tabIndex={collapsed ? -1 : 0}
328
+ className="shellui-floating-nav-control flex size-8 shrink-0 items-center justify-center text-sidebar-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
329
+ aria-label={toggleLabel}
330
+ aria-expanded={!collapsed}
331
+ onClick={onToggleCollapsed}
332
+ >
333
+ <SidebarPanelIcon className="size-4" />
334
+ </button>
335
+ </div>
280
336
  </div>
281
337
 
282
338
  <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-2">