@shellui/core 0.5.0-beta.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +5 -5
  2. package/package.json +3 -2
  3. package/schemas/shellui.config.schema.json +10 -2
  4. package/src/app.tsx +8 -4
  5. package/src/components/ContentView.tsx +12 -5
  6. package/src/components/ui/alert-dialog.tsx +1 -1
  7. package/src/components/ui/dialog.tsx +5 -1
  8. package/src/components/ui/dropdown-menu.tsx +39 -4
  9. package/src/components/ui/sheet.tsx +1 -1
  10. package/src/components/ui/sidebar.tsx +60 -20
  11. package/src/components/ui/tabs.tsx +52 -0
  12. package/src/constants/urls.ts +1 -0
  13. package/src/features/auth/AuthProvider.tsx +17 -6
  14. package/src/features/chromeActions/ChromeActionIcons.tsx +261 -0
  15. package/src/features/chromeActions/ChromeActionsDemoView.tsx +149 -0
  16. package/src/features/chromeActions/ChromeActionsHost.tsx +1511 -0
  17. package/src/features/chromeActions/ChromeActionsProvider.tsx +141 -0
  18. package/src/features/chromeActions/chromeActionsStore.spec.ts +61 -0
  19. package/src/features/chromeActions/chromeActionsStore.ts +77 -0
  20. package/src/features/chromeActions/computeActionInsets.spec.ts +360 -0
  21. package/src/features/chromeActions/computeActionInsets.ts +326 -0
  22. package/src/features/chromeActions/index.ts +26 -0
  23. package/src/features/chromeActions/resolveUuidForRemoveIframe.spec.ts +49 -0
  24. package/src/features/config/types.ts +16 -2
  25. package/src/features/layouts/AppLayout.tsx +30 -3
  26. package/src/features/layouts/OverlayShell.tsx +63 -13
  27. package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +22 -0
  28. package/src/features/layouts/appbar/AppBarLayout.tsx +230 -86
  29. package/src/features/layouts/chrome/DesktopChrome.tsx +17 -3
  30. package/src/features/layouts/chrome/InsetMobileRadiusOverlay.tsx +18 -0
  31. package/src/features/layouts/chrome/index.ts +8 -0
  32. package/src/features/layouts/chrome/runtime.ts +73 -0
  33. package/src/features/layouts/chrome/useScrollHideChrome.ts +210 -0
  34. package/src/features/layouts/floating/FloatingBottomDock.tsx +410 -0
  35. package/src/features/layouts/floating/FloatingLayout.tsx +152 -0
  36. package/src/features/layouts/floating/FloatingSidebar.tsx +327 -0
  37. package/src/features/layouts/floating/FloatingStatusScrim.tsx +36 -0
  38. package/src/features/layouts/floating/computeFloatingInsets.spec.ts +83 -0
  39. package/src/features/layouts/floating/computeFloatingInsets.ts +155 -0
  40. package/src/features/layouts/floating/isShellOwnedPath.spec.ts +25 -0
  41. package/src/features/layouts/floating/isShellOwnedPath.ts +17 -0
  42. package/src/features/layouts/floating/layoutChromeStore.spec.ts +138 -0
  43. package/src/features/layouts/floating/layoutChromeStore.ts +209 -0
  44. package/src/features/layouts/floating/scrollChrome.spec.ts +49 -0
  45. package/src/features/layouts/floating/useFloatingChrome.ts +206 -0
  46. package/src/features/layouts/sidebar/SidebarLayout.tsx +119 -37
  47. package/src/features/layouts/sidebar/types.ts +4 -0
  48. package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +15 -0
  49. package/src/features/layouts/windows/WindowsLayout.tsx +240 -110
  50. package/src/features/overlays/ResponsiveModal.tsx +201 -21
  51. package/src/features/overlays/overlaySize.spec.ts +18 -0
  52. package/src/features/overlays/overlaySize.ts +89 -0
  53. package/src/features/settings/SettingsProvider.tsx +36 -9
  54. package/src/features/settings/SettingsView.tsx +6 -6
  55. package/src/features/settings/components/Develop.tsx +33 -13
  56. package/src/features/settings/components/develop/ChromeActionsTestButtons.tsx +63 -0
  57. package/src/features/settings/utils/buildSettingsForPropagation.ts +16 -0
  58. package/src/features/storage/StoragePickerContext.tsx +1 -0
  59. package/src/features/storage/uploads/uploadQueue.spec.ts +56 -1
  60. package/src/features/storage/uploads/uploadQueue.ts +42 -1
  61. package/src/features/theme/applyTheme.ts +23 -5
  62. package/src/hooks/use-mobile.tsx +21 -7
  63. package/src/hooks/use-viewport.ts +40 -0
  64. package/src/i18n/translations/en/settings.json +17 -2
  65. package/src/i18n/translations/fr/settings.json +17 -2
  66. package/src/index.css +473 -12
  67. package/src/index.html +6 -4
  68. package/src/index.ts +8 -0
  69. package/src/routes/components/RouteFallback.tsx +21 -2
  70. package/src/routes/routes.tsx +14 -0
@@ -0,0 +1,206 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useLocation } from 'react-router';
3
+ import {
4
+ shellui,
5
+ getScrollMetrics,
6
+ reduceScrollChromeVisibility,
7
+ type LayoutChrome,
8
+ type LayoutChromeInsets,
9
+ type LayoutChromeViewport,
10
+ type ScrollChromeState,
11
+ } from '@shellui/sdk';
12
+ import {
13
+ computeFloatingInsets,
14
+ FLOATING_COLLAPSED_ACTIONS_LEADING_EXTRA,
15
+ readShellSafeAreaPx,
16
+ } from './computeFloatingInsets';
17
+ import { publishLayoutChrome } from './layoutChromeStore';
18
+
19
+ const SIDEBAR_COLLAPSED_STORAGE_KEY = 'shellui:floating-sidebar:collapsed';
20
+ /** Host CSS var: extra left pad on chrome actions when the expand chip is visible. */
21
+ const ACTIONS_LEADING_EXTRA_VAR = '--shellui-chrome-actions-leading-extra';
22
+
23
+ function readSidebarCollapsed(): boolean {
24
+ if (typeof window === 'undefined') return false;
25
+ try {
26
+ return sessionStorage.getItem(SIDEBAR_COLLAPSED_STORAGE_KEY) === 'true';
27
+ } catch {
28
+ return false;
29
+ }
30
+ }
31
+
32
+ function writeSidebarCollapsed(collapsed: boolean): void {
33
+ if (typeof window === 'undefined') return;
34
+ try {
35
+ sessionStorage.setItem(SIDEBAR_COLLAPSED_STORAGE_KEY, String(collapsed));
36
+ } catch {
37
+ // Ignore quota / privacy mode errors.
38
+ }
39
+ }
40
+
41
+ /** Pad chrome actions past the expand chip; content insets stay full-bleed when collapsed. */
42
+ function syncChromeActionsLeadingExtra(desktopCollapsed: boolean): void {
43
+ if (typeof document === 'undefined') return;
44
+ document.documentElement.style.setProperty(
45
+ ACTIONS_LEADING_EXTRA_VAR,
46
+ `${desktopCollapsed ? FLOATING_COLLAPSED_ACTIONS_LEADING_EXTRA : 0}px`,
47
+ );
48
+ }
49
+
50
+ function buildChrome(
51
+ viewport: LayoutChromeViewport,
52
+ chromeVisible: boolean,
53
+ sidebarCollapsed: boolean,
54
+ autoPadding = true,
55
+ ): LayoutChrome {
56
+ const safeArea =
57
+ typeof document !== 'undefined'
58
+ ? readShellSafeAreaPx()
59
+ : { top: 0, right: 0, bottom: 0, left: 0 };
60
+ const desktopCollapsed = viewport === 'desktop' && sidebarCollapsed;
61
+ return {
62
+ layout: 'floating',
63
+ viewport,
64
+ chromeVisible: viewport === 'desktop' ? !desktopCollapsed : chromeVisible,
65
+ autoPadding,
66
+ // Phone/tablet: keep tab-bar-sized insets even when chrome hides on scroll
67
+ // so padding does not jump. Desktop: insets follow sidebar collapsed state.
68
+ insets: computeFloatingInsets({
69
+ viewport,
70
+ chromeVisible: true,
71
+ sidebarCollapsed: desktopCollapsed,
72
+ safeArea,
73
+ }),
74
+ };
75
+ }
76
+
77
+ /**
78
+ * Owns floating chrome visibility (hide-on-scroll on phone/tablet),
79
+ * desktop sidebar collapse, publishes layoutChrome to iframes.
80
+ */
81
+ export function useFloatingChrome(viewport: LayoutChromeViewport) {
82
+ const location = useLocation();
83
+ const [chromeVisible, setChromeVisible] = useState(true);
84
+ const [sidebarCollapsed, setSidebarCollapsedState] = useState(readSidebarCollapsed);
85
+ const scrollStateRef = useRef<ScrollChromeState>({ visible: true, lastY: 0 });
86
+ const viewportRef = useRef(viewport);
87
+ viewportRef.current = viewport;
88
+ const sidebarCollapsedRef = useRef(sidebarCollapsed);
89
+ sidebarCollapsedRef.current = sidebarCollapsed;
90
+ const hideOnScroll = viewport !== 'desktop';
91
+
92
+ const pushChrome = useCallback(
93
+ (visible: boolean, vp: LayoutChromeViewport, collapsed: boolean) => {
94
+ const desktopCollapsed = vp === 'desktop' && collapsed;
95
+ syncChromeActionsLeadingExtra(desktopCollapsed);
96
+ publishLayoutChrome(buildChrome(vp, visible, collapsed));
97
+ },
98
+ [],
99
+ );
100
+
101
+ const setSidebarCollapsed = useCallback((collapsed: boolean) => {
102
+ setSidebarCollapsedState(collapsed);
103
+ writeSidebarCollapsed(collapsed);
104
+ }, []);
105
+
106
+ const toggleSidebarCollapsed = useCallback(() => {
107
+ setSidebarCollapsed(!sidebarCollapsedRef.current);
108
+ }, [setSidebarCollapsed]);
109
+
110
+ const applyScrollMetrics = useCallback((scrollY: number, distanceFromBottom?: number) => {
111
+ if (viewportRef.current === 'desktop') return;
112
+
113
+ const next = reduceScrollChromeVisibility(scrollStateRef.current, scrollY, {
114
+ distanceFromBottom,
115
+ });
116
+ scrollStateRef.current = next;
117
+ setChromeVisible((prev) => (prev === next.visible ? prev : next.visible));
118
+ }, []);
119
+
120
+ // Reset hide-on-scroll when viewport tier or shell route changes.
121
+ useEffect(() => {
122
+ setChromeVisible(true);
123
+ scrollStateRef.current = { visible: true, lastY: 0 };
124
+ pushChrome(true, viewport, sidebarCollapsedRef.current);
125
+ // Shell-owned pages: sample document scroller (iframes report via message).
126
+ const metrics = getScrollMetrics(document);
127
+ if (metrics) {
128
+ applyScrollMetrics(metrics.scrollY, metrics.distanceFromBottom);
129
+ }
130
+ }, [viewport, location.pathname, pushChrome, applyScrollMetrics]);
131
+
132
+ useEffect(() => {
133
+ const visible = viewport === 'desktop' ? true : chromeVisible;
134
+ pushChrome(visible, viewport, sidebarCollapsed);
135
+ }, [chromeVisible, viewport, sidebarCollapsed, pushChrome]);
136
+
137
+ useEffect(() => {
138
+ const onResize = () => {
139
+ const visible = viewportRef.current === 'desktop' ? true : scrollStateRef.current.visible;
140
+ pushChrome(visible, viewportRef.current, sidebarCollapsedRef.current);
141
+ };
142
+ window.addEventListener('resize', onResize);
143
+ return () => window.removeEventListener('resize', onResize);
144
+ }, [pushChrome]);
145
+
146
+ useEffect(() => {
147
+ if (!hideOnScroll) return;
148
+ const cleanup = shellui.addMessageListener('SHELLUI_CONTENT_SCROLL', (data) => {
149
+ const payload = data.payload as
150
+ | { scrollY?: number; direction?: 'up' | 'down' | 'none'; distanceFromBottom?: number }
151
+ | undefined;
152
+ if (typeof payload?.scrollY !== 'number') return;
153
+ applyScrollMetrics(payload.scrollY, payload.distanceFromBottom);
154
+ });
155
+ return cleanup;
156
+ }, [applyScrollMetrics, hideOnScroll]);
157
+
158
+ useEffect(() => {
159
+ if (!hideOnScroll) return;
160
+ const onScroll = (event: Event) => {
161
+ const el = event.target;
162
+ if (el instanceof Element) {
163
+ if (el.closest('[data-shellui-floating-dock], [data-shellui-floating-sidebar]')) {
164
+ return;
165
+ }
166
+ }
167
+ const metrics = getScrollMetrics(el);
168
+ if (!metrics) return;
169
+ applyScrollMetrics(metrics.scrollY, metrics.distanceFromBottom);
170
+ };
171
+
172
+ document.addEventListener('scroll', onScroll, { capture: true, passive: true });
173
+ return () => document.removeEventListener('scroll', onScroll, true);
174
+ }, [applyScrollMetrics, hideOnScroll]);
175
+
176
+ useEffect(() => {
177
+ return () => {
178
+ syncChromeActionsLeadingExtra(false);
179
+ publishLayoutChrome(null);
180
+ };
181
+ }, []);
182
+
183
+ const effectiveVisible = viewport === 'desktop' ? true : chromeVisible;
184
+
185
+ const insets: LayoutChromeInsets = useMemo(() => {
186
+ const safeArea =
187
+ typeof document !== 'undefined'
188
+ ? readShellSafeAreaPx()
189
+ : { top: 0, right: 0, bottom: 0, left: 0 };
190
+ return computeFloatingInsets({
191
+ viewport,
192
+ chromeVisible: true,
193
+ sidebarCollapsed: viewport === 'desktop' && sidebarCollapsed,
194
+ safeArea,
195
+ });
196
+ }, [viewport, sidebarCollapsed]);
197
+
198
+ return {
199
+ chromeVisible: effectiveVisible,
200
+ setChromeVisible,
201
+ sidebarCollapsed: viewport === 'desktop' ? sidebarCollapsed : false,
202
+ setSidebarCollapsed,
203
+ toggleSidebarCollapsed,
204
+ insets,
205
+ };
206
+ }
@@ -1,6 +1,7 @@
1
1
  import { Outlet, useLocation } from 'react-router';
2
- import { useMemo, useEffect } from 'react';
2
+ import { useMemo, useEffect, useRef, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
+ import { shellui } from '@shellui/sdk';
4
5
  import {
5
6
  Sidebar,
6
7
  SidebarInset,
@@ -32,6 +33,8 @@ import {
32
33
  SafeAreaTopbarOffset,
33
34
  SafeAreaTopbarStrip,
34
35
  } from '../chrome/SafeAreaTopbar';
36
+ import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
37
+ import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
35
38
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
36
39
  import {
37
40
  MAC_TRAFFIC_LIGHTS_GAP_PX,
@@ -39,6 +42,8 @@ import {
39
42
  DESKTOP_TITLEBAR_HEIGHT_PX,
40
43
  DESKTOP_TITLEBAR_PAD_TOP_PX,
41
44
  } from '../chrome/constants';
45
+ import { WindowTitleBarActions } from '../../chromeActions';
46
+ import { cn } from '../../../lib/utils';
42
47
 
43
48
  /** Close the mobile sheet when the route changes. */
44
49
  function CloseMobileSidebarOnNavigate() {
@@ -81,8 +86,14 @@ function CollapsedTitlebarOffset() {
81
86
  return null;
82
87
  }
83
88
 
84
- const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps) => {
89
+ const SidebarLayoutContent = ({
90
+ title,
91
+ appIcon,
92
+ navigation,
93
+ variant = 'sidebar',
94
+ }: SidebarLayoutProps) => {
85
95
  const { i18n } = useTranslation();
96
+ const location = useLocation();
86
97
  const { isAuthenticated } = useAuth();
87
98
  const { settings } = useSettings();
88
99
  const { navigationItem } = useNavigationItems();
@@ -94,6 +105,33 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
94
105
  : undefined;
95
106
  // Nested shell-in-iframe must not repeat the root safe-area top band.
96
107
  const showSafeAreaTopbar = isShellUiRootWindow();
108
+ const scrollHideLayout = variant === 'inset' ? 'sidebar-inset' : 'sidebar';
109
+ const { chromeVisible } = useScrollHideChrome({
110
+ enabled: isMobile,
111
+ layout: scrollHideLayout,
112
+ includeSafeArea: showSafeAreaTopbar,
113
+ });
114
+ const contentRef = useRef<HTMLDivElement>(null);
115
+ const [frameUuid, setFrameUuid] = useState<string | null>(null);
116
+
117
+ // Bind title-bar actions to the main content iframe (mobile only).
118
+ useEffect(() => {
119
+ if (!isMobile) {
120
+ setFrameUuid(null);
121
+ return;
122
+ }
123
+ const sync = () => {
124
+ const iframe = contentRef.current?.querySelector('iframe');
125
+ if (!iframe) {
126
+ setFrameUuid(null);
127
+ return;
128
+ }
129
+ setFrameUuid(shellui.getUuidByIframe(iframe.contentWindow) ?? null);
130
+ };
131
+ sync();
132
+ const id = window.setInterval(sync, 400);
133
+ return () => window.clearInterval(id);
134
+ }, [isMobile, location.pathname]);
97
135
 
98
136
  const currentLanguage = useMemo(() => {
99
137
  return i18n.language || 'en';
@@ -131,7 +169,12 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
131
169
  return (
132
170
  <div
133
171
  data-shellui-sidebar-layout=""
134
- className="flex h-full max-h-full flex-col overflow-hidden"
172
+ data-shellui-layout-variant={variant}
173
+ className={cn(
174
+ 'flex h-full max-h-full flex-col overflow-hidden',
175
+ // Inset chrome: darkened tray so the main frame (and in-app sidebars) separate cleanly.
176
+ variant === 'inset' && 'bg-shellui-inset-chrome',
177
+ )}
135
178
  >
136
179
  <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
137
180
  {/*
@@ -139,7 +182,14 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
139
182
  top safe-area, painted with sidebar background. Height is 0 when the inset
140
183
  is 0; overflow clips the border so no stray hairline.
141
184
  */}
142
- <SafeAreaTopbarStrip enabled={showSafeAreaTopbar} />
185
+ <SafeAreaTopbarStrip
186
+ enabled={showSafeAreaTopbar}
187
+ className={
188
+ variant === 'inset'
189
+ ? '[&>div]:border-transparent [&>div]:bg-shellui-inset-chrome'
190
+ : undefined
191
+ }
192
+ />
143
193
  <SidebarProvider className="min-h-0 flex-1 overflow-hidden">
144
194
  <CloseMobileSidebarOnNavigate />
145
195
  <CloseMobileSidebarOnOverlay />
@@ -147,6 +197,7 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
147
197
  <CollapsedDesktopTitlebar />
148
198
  <Sidebar
149
199
  collapsible="icon"
200
+ variant={variant}
150
201
  className="border-sidebar-border"
151
202
  >
152
203
  <SidebarInner
@@ -156,43 +207,67 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
156
207
  title={title}
157
208
  appIcon={appIcon}
158
209
  />
159
- <SidebarRail />
210
+ {variant !== 'inset' ? <SidebarRail /> : null}
160
211
  </Sidebar>
161
212
 
162
- <SidebarInset className="relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
213
+ <SidebarInset
214
+ className={cn(
215
+ 'relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden',
216
+ // Mobile inset: keep the darkened chrome tray behind the header + card radius.
217
+ variant === 'inset' && 'max-md:bg-transparent',
218
+ )}
219
+ >
220
+ {variant === 'inset' ? <SidebarRail placement="inset" /> : null}{' '}
163
221
  {/*
164
- Mobile top chrome: extend the header background into the status-bar band
165
- so there is no empty strip. Interactive controls stay below the inset via
166
- padding. Overlays are fixed full-screen and still cover this band.
167
- Nested iframe shells skip top safe-area — the host already cleared it.
222
+ Mobile: header + inset tray/radius slide as one stack; action row follows
223
+ the same CSS var. Stable inset-top — no jump when chrome hides.
168
224
  */}
169
- <header
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"
171
- style={{
172
- paddingTop: showSafeAreaTopbar
173
- ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
174
- : DESKTOP_TITLEBAR_PAD_TOP_PX,
175
- height: showSafeAreaTopbar
176
- ? `calc(${DESKTOP_TITLEBAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`
177
- : DESKTOP_TITLEBAR_HEIGHT_PX,
178
- ...(mobileTrafficInset !== undefined ? { paddingLeft: mobileTrafficInset } : {}),
179
- }}
180
- {...(trafficLights
181
- ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
182
- : {})}
225
+ <div
226
+ data-shellui-mobile-chrome-stack=""
227
+ data-chrome-visible={chromeVisible ? 'true' : 'false'}
228
+ className="pointer-events-none absolute inset-0 z-[45] md:hidden"
229
+ >
230
+ <header
231
+ data-shellui-scroll-hide-header=""
232
+ className={cn(
233
+ 'pointer-events-auto relative z-[1] flex items-center gap-0.5 px-3 select-none',
234
+ variant === 'inset'
235
+ ? 'border-transparent bg-transparent text-sidebar-foreground'
236
+ : 'border-b border-border bg-background',
237
+ )}
238
+ style={{
239
+ paddingTop: showSafeAreaTopbar
240
+ ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
241
+ : DESKTOP_TITLEBAR_PAD_TOP_PX,
242
+ height: showSafeAreaTopbar
243
+ ? `calc(${DESKTOP_TITLEBAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`
244
+ : DESKTOP_TITLEBAR_HEIGHT_PX,
245
+ ...(mobileTrafficInset !== undefined ? { paddingLeft: mobileTrafficInset } : {}),
246
+ }}
247
+ {...(trafficLights
248
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
249
+ : {})}
250
+ >
251
+ <SidebarTrigger
252
+ data-shellui-no-drag=""
253
+ className="relative size-8 shrink-0 touch-manipulation text-foreground"
254
+ />
255
+ {isTauriEnv ? <DesktopHistoryButtons /> : null}
256
+ {isMobile ? (
257
+ <div
258
+ data-shellui-no-drag=""
259
+ className="flex min-w-0 flex-1 items-center"
260
+ >
261
+ <WindowTitleBarActions frameUuid={frameUuid} />
262
+ </div>
263
+ ) : null}
264
+ </header>
265
+ {variant === 'inset' ? <InsetMobileRadiusOverlay /> : null}
266
+ </div>
267
+ <div
268
+ ref={contentRef}
269
+ className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden"
183
270
  >
184
- <SidebarTrigger
185
- data-shellui-no-drag=""
186
- className="relative size-8 touch-manipulation text-foreground"
187
- />
188
- {isTauriEnv ? <DesktopHistoryButtons /> : null}
189
- </header>
190
-
191
- {/*
192
- Fill to the physical bottom — do not pad safe-area here or the iframe
193
- looks cut off. In-app content (settings, etc.) owns bottom safe insets.
194
- */}
195
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
196
271
  <Outlet />
197
272
  </div>
198
273
  </SidebarInset>
@@ -201,13 +276,20 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
201
276
  );
202
277
  };
203
278
 
204
- export function SidebarLayout({ title, appIcon, logo, navigation }: SidebarLayoutProps) {
279
+ export function SidebarLayout({
280
+ title,
281
+ appIcon,
282
+ logo,
283
+ navigation,
284
+ variant = 'sidebar',
285
+ }: SidebarLayoutProps) {
205
286
  return (
206
287
  <SidebarLayoutContent
207
288
  title={title}
208
289
  appIcon={appIcon}
209
290
  logo={logo}
210
291
  navigation={navigation}
292
+ variant={variant}
211
293
  />
212
294
  );
213
295
  }
@@ -1,8 +1,12 @@
1
1
  import type { NavigationItem, NavigationGroup, ThemeAsset } from '../../config/types';
2
2
 
3
+ export type SidebarChromeVariant = 'sidebar' | 'inset';
4
+
3
5
  export interface SidebarLayoutProps {
4
6
  title?: string;
5
7
  appIcon?: ThemeAsset;
6
8
  logo?: ThemeAsset;
7
9
  navigation: (NavigationItem | NavigationGroup)[];
10
+ /** Visual chrome: default flush sidebar, or inset padded/rounded main frame. */
11
+ variant?: SidebarChromeVariant;
8
12
  }
@@ -0,0 +1,15 @@
1
+ import { SidebarLayout } from '../sidebar/SidebarLayout';
2
+ import type { SidebarLayoutProps } from '../sidebar/types';
3
+
4
+ /**
5
+ * Sidebar inset layout — same as sidebar, with a padded, rounded main frame that
6
+ * reveals the chrome background around the content area (mobile + desktop).
7
+ */
8
+ export function SidebarInsetLayout(props: SidebarLayoutProps) {
9
+ return (
10
+ <SidebarLayout
11
+ {...props}
12
+ variant="inset"
13
+ />
14
+ );
15
+ }