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

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 (47) hide show
  1. package/package.json +2 -2
  2. package/schemas/shellui.config.schema.json +10 -2
  3. package/src/components/ContentView.tsx +12 -5
  4. package/src/components/ui/alert-dialog.tsx +1 -1
  5. package/src/components/ui/sidebar.tsx +60 -21
  6. package/src/features/admin/AdminView.tsx +31 -2
  7. package/src/features/auth/components/LoginButton.tsx +3 -3
  8. package/src/features/auth/components/LoginView.tsx +74 -28
  9. package/src/features/config/types.ts +16 -2
  10. package/src/features/layouts/AppLayout.tsx +30 -3
  11. package/src/features/layouts/OverlayShell.tsx +3 -1
  12. package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +22 -0
  13. package/src/features/layouts/appbar/AppBarLayout.tsx +98 -33
  14. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +18 -10
  15. package/src/features/layouts/chrome/ContentDragOverlay.tsx +1 -1
  16. package/src/features/layouts/chrome/DesktopChrome.tsx +1 -1
  17. package/src/features/layouts/chrome/SafeAreaTopbar.tsx +48 -0
  18. package/src/features/layouts/chrome/constants.ts +7 -1
  19. package/src/features/layouts/chrome/index.ts +5 -0
  20. package/src/features/layouts/chrome/runtime.ts +157 -7
  21. package/src/features/layouts/floating/FloatingFadeMask.tsx +22 -0
  22. package/src/features/layouts/floating/FloatingLayout.tsx +142 -0
  23. package/src/features/layouts/floating/FloatingSidebar.tsx +327 -0
  24. package/src/features/layouts/floating/FloatingTabBar.tsx +437 -0
  25. package/src/features/layouts/floating/FloatingTabIndicator.tsx +216 -0
  26. package/src/features/layouts/floating/computeFloatingInsets.spec.ts +83 -0
  27. package/src/features/layouts/floating/computeFloatingInsets.ts +103 -0
  28. package/src/features/layouts/floating/isShellOwnedPath.spec.ts +23 -0
  29. package/src/features/layouts/floating/isShellOwnedPath.ts +16 -0
  30. package/src/features/layouts/floating/layoutChromeStore.ts +46 -0
  31. package/src/features/layouts/floating/scrollChrome.spec.ts +49 -0
  32. package/src/features/layouts/floating/useFloatingChrome.ts +216 -0
  33. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +9 -4
  34. package/src/features/layouts/sidebar/SidebarInner.tsx +25 -29
  35. package/src/features/layouts/sidebar/SidebarLayout.tsx +41 -36
  36. package/src/features/layouts/sidebar/types.ts +4 -0
  37. package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +15 -0
  38. package/src/features/settings/SettingsProvider.tsx +7 -0
  39. package/src/features/settings/SettingsView.tsx +6 -6
  40. package/src/features/settings/components/Develop.tsx +31 -13
  41. package/src/features/settings/utils/buildSettingsForPropagation.ts +16 -0
  42. package/src/features/storage/StoragePickerContext.tsx +1 -0
  43. package/src/hooks/use-viewport.ts +40 -0
  44. package/src/i18n/translations/en/settings.json +8 -2
  45. package/src/i18n/translations/fr/settings.json +8 -2
  46. package/src/index.css +339 -15
  47. package/src/routes/components/RouteFallback.tsx +6 -2
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.3",
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.3"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "react": "^18.0.0 || ^19.0.0",
@@ -172,8 +172,16 @@
172
172
  },
173
173
  "LayoutType": {
174
174
  "type": "string",
175
- "enum": ["sidebar", "fullscreen", "windows", "app-bar"],
176
- "description": "Layout mode: 'sidebar' (default) shows navigation sidebar; 'fullscreen' shows only content area; 'windows' shows a taskbar with start menu and multi-window desktop; 'app-bar' shows a compact top bar with a 9-square launcher for start links and icon-only end links."
175
+ "enum": [
176
+ "sidebar",
177
+ "sidebar-inset",
178
+ "fullscreen",
179
+ "windows",
180
+ "app-bar",
181
+ "app-bar-inset",
182
+ "floating"
183
+ ],
184
+ "description": "Layout mode: 'sidebar' (default) shows navigation sidebar; 'sidebar-inset' is sidebar with a padded, rounded main frame that reveals the chrome background; 'fullscreen' shows only content area; 'windows' shows a taskbar with start menu and multi-window desktop; 'app-bar' shows a compact top bar with a 9-square launcher for start links and icon-only end links; 'app-bar-inset' is app-bar with the same padded, rounded main frame as sidebar-inset; 'floating' is glass navigation over full-bleed content (bottom-centered tabs on phone and tablet, floating sidebar on desktop) with layout-chrome safe insets for iframe apps."
177
185
  },
178
186
  "NavigationItem": {
179
187
  "type": "object",
@@ -73,6 +73,11 @@ interface ContentViewProps {
73
73
  pathPrefix: string;
74
74
  ignoreMessages?: boolean;
75
75
  navItem: NavigationItem;
76
+ /**
77
+ * When true (default), this iframe is a main layout content frame and receives
78
+ * floating layout-chrome insets. Modal / drawer / picker frames set false.
79
+ */
80
+ layoutChrome?: boolean;
76
81
  }
77
82
 
78
83
  export const ContentView = ({
@@ -80,6 +85,7 @@ export const ContentView = ({
80
85
  pathPrefix,
81
86
  ignoreMessages = false,
82
87
  navItem,
88
+ layoutChrome = true,
83
89
  }: ContentViewProps) => {
84
90
  const navigate = useNavigate();
85
91
  const location = useLocation();
@@ -91,11 +97,9 @@ export const ContentView = ({
91
97
  const skipInitialShellSyncRef = useRef(true);
92
98
  const prevNavPathRef = useRef(navItem?.path ?? '');
93
99
 
94
- const [isLoading, setIsLoading] = useState(() => {
95
- // Skip overlay when same app URL was just loaded (e.g. switching App ↔ Root with same url)
96
- if (!ignoreMessages) return false;
97
- return true;
98
- });
100
+ // Always start covered: remounts (e.g. /layout → /) create a fresh iframe that would
101
+ // otherwise flash blank/white at opacity 1 before SHELLUI_INITIALIZED.
102
+ const [isLoading, setIsLoading] = useState(true);
99
103
 
100
104
  const [iframeUrl, setIframeUrl] = useState(url);
101
105
  /** Bumped only when the iframe element must remount (nav item / app change). */
@@ -156,6 +160,8 @@ export const ContentView = ({
156
160
  if (iframe && isSameOriginAsNavItem(url, navItem) && replaceIframeLocation(iframe, url)) {
157
161
  // Do not update the src prop — React would re-navigate the iframe and can
158
162
  // push a joint session-history entry, wiping intermediate shell routes.
163
+ // Loading stays as-is: same-document (e.g. hash) hops do not re-send
164
+ // SHELLUI_INITIALIZED, and blanking for the fallback timeout would feel stuck.
159
165
  return;
160
166
  }
161
167
 
@@ -354,6 +360,7 @@ export const ContentView = ({
354
360
  src={iframeUrl}
355
361
  key={`${navItem?.path ?? ''}:${frameGeneration}`}
356
362
  loading="eager"
363
+ data-shellui-frame={layoutChrome ? 'main' : 'overlay'}
357
364
  style={{
358
365
  width: '100%',
359
366
  height: '100%',
@@ -114,7 +114,7 @@ const AlertDialogFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElemen
114
114
  className={cn(
115
115
  'flex w-full min-w-full flex-col-reverse max-sm:gap-2 sm:flex-row sm:justify-end sm:space-x-2',
116
116
  '-mb-6 mt-2 border-t border-border bg-muted/50 px-6 py-3 rounded-b-xl sm:rounded-b-lg',
117
- '[&_button]:h-8 [&_button]:text-xs [&_button]:px-3',
117
+ '[&_button]:h-8 [&_button]:min-w-[80px] [&_button]:text-xs [&_button]:px-3',
118
118
  'group-data-[size=sm]:flex-row group-data-[size=sm]:gap-2',
119
119
  'group-data-[size=sm]:[&>*:not(:only-child)]:min-w-0 group-data-[size=sm]:[&>*:not(:only-child)]:flex-1',
120
120
  className,
@@ -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%)';
@@ -236,7 +236,7 @@ function SidebarProvider({
236
236
  className={cn(
237
237
  // #root owns the screen height (see index.html); fill it rather than
238
238
  // re-deriving it from a viewport unit.
239
- 'group/sidebar-wrapper flex h-full min-h-0 w-full has-data-[variant=inset]:bg-sidebar',
239
+ 'group/sidebar-wrapper flex h-full min-h-0 w-full has-data-[variant=inset]:bg-shellui-inset-chrome',
240
240
  className,
241
241
  )}
242
242
  {...props}
@@ -332,9 +332,12 @@ function Sidebar({
332
332
  'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[resizing]/sidebar-wrapper:transition-none',
333
333
  'group-data-[collapsible=offcanvas]:w-0',
334
334
  'group-data-[side=right]:rotate-180',
335
- variant === 'floating' || variant === 'inset'
335
+ variant === 'floating'
336
336
  ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
337
- : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
337
+ : variant === 'inset'
338
+ ? // Collapsed: only left chrome pad — inset ml provides the gap before the card (keeps L/R even).
339
+ 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(3)))]'
340
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
338
341
  )}
339
342
  />
340
343
  <div
@@ -345,9 +348,12 @@ function Sidebar({
345
348
  ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
346
349
  : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
347
350
  // Adjust the padding for floating and inset variants.
348
- variant === 'floating' || variant === 'inset'
351
+ variant === 'floating'
349
352
  ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
350
- : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
353
+ : variant === 'inset'
354
+ ? // Expanded: pad all sides. Collapsed: drop right pad so card ml-3 matches right gutter.
355
+ 'p-3 group-data-[collapsible=icon]:pr-0 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(3)))]'
356
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
351
357
  className,
352
358
  )}
353
359
  {...props}
@@ -355,7 +361,11 @@ function Sidebar({
355
361
  <div
356
362
  data-sidebar="sidebar"
357
363
  data-slot="sidebar-inner"
358
- className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm"
364
+ className={cn(
365
+ 'flex h-full w-full flex-col bg-sidebar',
366
+ 'group-data-[variant=inset]:bg-transparent',
367
+ 'group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm',
368
+ )}
359
369
  >
360
370
  {children}
361
371
  </div>
@@ -391,7 +401,17 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
391
401
  );
392
402
  }
393
403
 
394
- function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
404
+ function SidebarRail({
405
+ className,
406
+ placement = 'sidebar',
407
+ side: sideProp = 'left',
408
+ ...props
409
+ }: React.ComponentProps<'button'> & {
410
+ /** Where the rail attaches. `inset` sits on the main frame edge (sidebar-inset layout). */
411
+ placement?: 'sidebar' | 'inset';
412
+ /** Used when `placement="inset"` (no `[data-side]` ancestor). */
413
+ side?: 'left' | 'right';
414
+ }) {
395
415
  const { toggleSidebar, state, width, setWidth, setIsResizing } = useSidebar();
396
416
  const dragRef = React.useRef<{
397
417
  startX: number;
@@ -403,21 +423,24 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
403
423
  const widthRef = React.useRef(width);
404
424
  widthRef.current = width;
405
425
 
426
+ const resolveSide = (event: React.PointerEvent<HTMLButtonElement>): 'left' | 'right' => {
427
+ if (placement === 'inset') return sideProp;
428
+ return (event.currentTarget.closest('[data-side]') as HTMLElement | null)?.dataset.side ===
429
+ 'right'
430
+ ? 'right'
431
+ : 'left';
432
+ };
433
+
406
434
  const onPointerDown = (event: React.PointerEvent<HTMLButtonElement>) => {
407
435
  if (event.button !== 0) return;
408
436
  // Collapsed rail keeps click-to-expand; only resize when expanded.
409
437
  if (state !== 'expanded') return;
410
438
 
411
- const side =
412
- (event.currentTarget.closest('[data-side]') as HTMLElement | null)?.dataset.side === 'right'
413
- ? 'right'
414
- : 'left';
415
-
416
439
  didDragRef.current = false;
417
440
  dragRef.current = {
418
441
  startX: event.clientX,
419
442
  startWidth: width,
420
- side,
443
+ side: resolveSide(event),
421
444
  pointerId: event.pointerId,
422
445
  };
423
446
  setIsResizing(true);
@@ -462,6 +485,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
462
485
  data-sidebar="rail"
463
486
  data-slot="sidebar-rail"
464
487
  data-shellui-no-drag=""
488
+ data-placement={placement}
465
489
  aria-label={state === 'expanded' ? 'Resize Sidebar' : 'Toggle Sidebar'}
466
490
  tabIndex={-1}
467
491
  title={state === 'expanded' ? 'Drag to resize' : 'Toggle Sidebar'}
@@ -478,12 +502,25 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
478
502
  onPointerUp={endDrag}
479
503
  onPointerCancel={endDrag}
480
504
  className={cn(
481
- 'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex',
482
- 'in-data-[side=left]:cursor-col-resize in-data-[side=right]:cursor-col-resize',
483
- '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
484
- 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',
485
- '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
486
- '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
505
+ placement === 'inset'
506
+ ? cn(
507
+ // Sit on the inset frame edge so the hover line follows the rounded card,
508
+ // instead of cutting through the chrome gap from the sidebar.
509
+ 'absolute inset-y-0 z-20 hidden w-3 md:flex',
510
+ sideProp === 'left' ? 'left-0 cursor-col-resize' : 'right-0 cursor-col-resize',
511
+ 'after:absolute after:inset-y-0 after:w-[2px] hover:after:bg-border',
512
+ sideProp === 'left' ? 'after:left-0' : 'after:right-0',
513
+ state === 'collapsed' &&
514
+ (sideProp === 'left' ? 'cursor-e-resize' : 'cursor-w-resize'),
515
+ )
516
+ : cn(
517
+ 'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex',
518
+ 'in-data-[side=left]:cursor-col-resize in-data-[side=right]:cursor-col-resize',
519
+ '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
520
+ 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',
521
+ '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
522
+ '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
523
+ ),
487
524
  className,
488
525
  )}
489
526
  {...props}
@@ -497,7 +534,9 @@ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
497
534
  data-slot="sidebar-inset"
498
535
  className={cn(
499
536
  'relative flex w-full flex-1 flex-col bg-background',
500
- 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
537
+ // Inset layout: float the main frame on a darkened chrome tray.
538
+ // Expanded: ml-0 — sidebar's own right pad is the gap. Collapsed: ml-3 matches right/top/bottom.
539
+ 'md:peer-data-[variant=inset]:m-3 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-border md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-3',
501
540
  className,
502
541
  )}
503
542
  {...props}
@@ -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);
@@ -10,8 +10,22 @@ export type LocalizedString =
10
10
  /** Drawer position when opening a link in a drawer (optional, used when openIn === 'drawer'). */
11
11
  export type DrawerPosition = 'top' | 'bottom' | 'left' | 'right';
12
12
 
13
- /** Layout mode: 'sidebar' (default) shows navigation sidebar; 'fullscreen' shows only content area; 'windows' shows a taskbar with start menu and multi-window desktop; 'app-bar' shows a compact top bar with a 9-square launcher for start links and icon-only end links. */
14
- export type LayoutType = 'sidebar' | 'fullscreen' | 'windows' | 'app-bar';
13
+ /** Layout mode: 'sidebar' (default) shows navigation sidebar; 'sidebar-inset' is sidebar with a padded, rounded main frame; 'fullscreen' shows only content area; 'windows' shows a taskbar with start menu and multi-window desktop; 'app-bar' shows a compact top bar; 'app-bar-inset' is app-bar with the same padded, rounded main frame as sidebar-inset; 'floating' is glass chrome over full-bleed content (bottom tabs on phone/tablet, floating sidebar on desktop). */
14
+ export type LayoutType =
15
+ | 'sidebar'
16
+ | 'sidebar-inset'
17
+ | 'fullscreen'
18
+ | 'windows'
19
+ | 'app-bar'
20
+ | 'app-bar-inset'
21
+ | 'floating';
22
+
23
+ /** Map legacy layout ids (e.g. early `cupertino`) onto current LayoutType. */
24
+ export function normalizeLayoutType(layout: string | null | undefined): LayoutType | undefined {
25
+ if (!layout) return undefined;
26
+ if (layout === 'cupertino') return 'floating';
27
+ return layout as LayoutType;
28
+ }
15
29
 
16
30
  export interface NavigationItem {
17
31
  label: string | LocalizedString;
@@ -1,24 +1,40 @@
1
1
  import { lazy, Suspense, type LazyExoticComponent, type ComponentType } from 'react';
2
- import type { LayoutType, NavigationItem, NavigationGroup, ThemeAsset } from '../config/types';
2
+ import {
3
+ normalizeLayoutType,
4
+ type LayoutType,
5
+ type NavigationItem,
6
+ type NavigationGroup,
7
+ type ThemeAsset,
8
+ } from '../config/types';
3
9
  import { useSettings } from '../settings/SettingsContext';
4
10
  import { ModalProvider } from '../modal/ModalContext';
5
11
  import { DrawerProvider } from '../drawer/DrawerContext';
6
12
  import { OverlayShell } from './OverlayShell';
7
13
  import { StoragePickerProvider } from '../storage/StoragePickerContext';
8
14
  import { LayoutFallback } from './LayoutFallback';
15
+ import { isShellUiRootWindow } from './chrome/SafeAreaTopbar';
9
16
 
10
17
  const SidebarLayout = lazy(() =>
11
18
  import('./sidebar/SidebarLayout').then((m) => ({ default: m.SidebarLayout })),
12
19
  );
20
+ const SidebarInsetLayout = lazy(() =>
21
+ import('./sidebar-inset/SidebarInsetLayout').then((m) => ({ default: m.SidebarInsetLayout })),
22
+ );
13
23
  const FullscreenLayout = lazy(() =>
14
24
  import('./fullscreen/FullscreenLayout').then((m) => ({ default: m.FullscreenLayout })),
15
25
  );
16
26
  const WindowsLayout = lazy(() =>
17
27
  import('./windows/WindowsLayout').then((m) => ({ default: m.WindowsLayout })),
18
28
  );
29
+ const FloatingLayout = lazy(() =>
30
+ import('./floating/FloatingLayout').then((m) => ({ default: m.FloatingLayout })),
31
+ );
19
32
  const AppBarLayout = lazy(() =>
20
33
  import('./appbar/AppBarLayout').then((m) => ({ default: m.AppBarLayout })),
21
34
  );
35
+ const AppBarInsetLayout = lazy(() =>
36
+ import('./app-bar-inset/AppBarInsetLayout').then((m) => ({ default: m.AppBarInsetLayout })),
37
+ );
22
38
 
23
39
  interface AppLayoutProps {
24
40
  layout?: LayoutType;
@@ -29,7 +45,7 @@ interface AppLayoutProps {
29
45
  children?: React.ReactNode;
30
46
  }
31
47
 
32
- /** Renders the layout based on settings.layout (override) or config.layout: 'sidebar' (default), 'fullscreen', or 'windows'. Lazy-loads only the active layout. */
48
+ /** Renders the layout based on settings.layout (override) or config.layout. Lazy-loads only the active layout. */
33
49
  export function AppLayout({
34
50
  layout = 'sidebar',
35
51
  title,
@@ -39,7 +55,9 @@ export function AppLayout({
39
55
  children,
40
56
  }: AppLayoutProps) {
41
57
  const { settings } = useSettings();
42
- const effectiveLayout: LayoutType = settings.layout ?? layout;
58
+ // Nested shell-in-iframe (e.g. nav → `/__settings`): parent already owns chrome — use fullscreen.
59
+ const configuredLayout = normalizeLayoutType(settings.layout ?? layout) ?? 'sidebar';
60
+ const effectiveLayout: LayoutType = !isShellUiRootWindow() ? 'fullscreen' : configuredLayout;
43
61
 
44
62
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
63
  let LayoutComponent: LazyExoticComponent<ComponentType<any>>;
@@ -51,9 +69,18 @@ export function AppLayout({
51
69
  } else if (effectiveLayout === 'windows') {
52
70
  LayoutComponent = WindowsLayout;
53
71
  layoutProps = { title, appIcon, logo, navigation: navigation || [] };
72
+ } else if (effectiveLayout === 'floating') {
73
+ LayoutComponent = FloatingLayout;
74
+ layoutProps = { title, appIcon, logo, navigation: navigation || [] };
54
75
  } else if (effectiveLayout === 'app-bar') {
55
76
  LayoutComponent = AppBarLayout;
56
77
  layoutProps = { title, appIcon, logo, navigation: navigation || [] };
78
+ } else if (effectiveLayout === 'app-bar-inset') {
79
+ LayoutComponent = AppBarInsetLayout;
80
+ layoutProps = { title, appIcon, logo, navigation: navigation || [] };
81
+ } else if (effectiveLayout === 'sidebar-inset') {
82
+ LayoutComponent = SidebarInsetLayout;
83
+ layoutProps = { title, appIcon, logo, navigation: navigation || [] };
57
84
  } else {
58
85
  LayoutComponent = SidebarLayout;
59
86
  layoutProps = { title, appIcon, logo, navigation: navigation || [] };
@@ -57,7 +57,7 @@ function OverlayIframe({
57
57
  url,
58
58
  navItem,
59
59
  contentSized,
60
- reportedHeight,
60
+ reportedHeight: _reportedHeight,
61
61
  reportedWidth,
62
62
  allowInnerScroll,
63
63
  pending,
@@ -105,6 +105,7 @@ function OverlayIframe({
105
105
  url={url}
106
106
  pathPrefix="settings"
107
107
  ignoreMessages={true}
108
+ layoutChrome={false}
108
109
  navItem={navItem}
109
110
  />
110
111
  </div>
@@ -163,6 +164,7 @@ function OverlayIframe({
163
164
  url={url}
164
165
  pathPrefix="settings"
165
166
  ignoreMessages={true}
167
+ layoutChrome={false}
166
168
  navItem={navItem}
167
169
  />
168
170
  </div>
@@ -0,0 +1,22 @@
1
+ import { AppBarLayout } from '../appbar/AppBarLayout';
2
+ import type { NavigationItem, NavigationGroup, ThemeAsset } from '../../config/types';
3
+
4
+ interface AppBarInsetLayoutProps {
5
+ title?: string;
6
+ appIcon?: ThemeAsset;
7
+ logo?: ThemeAsset;
8
+ navigation: (NavigationItem | NavigationGroup)[];
9
+ }
10
+
11
+ /**
12
+ * App-bar inset layout — same as app-bar, with a padded, rounded main frame that
13
+ * reveals the chrome background around the content area (desktop).
14
+ */
15
+ export function AppBarInsetLayout(props: AppBarInsetLayoutProps) {
16
+ return (
17
+ <AppBarLayout
18
+ {...props}
19
+ variant="inset"
20
+ />
21
+ );
22
+ }