@shellui/core 0.5.0-beta.2 → 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.
- package/package.json +2 -2
- package/schemas/shellui.config.schema.json +10 -2
- package/src/components/ContentView.tsx +12 -5
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/sidebar.tsx +59 -20
- package/src/features/config/types.ts +16 -2
- package/src/features/layouts/AppLayout.tsx +30 -3
- package/src/features/layouts/OverlayShell.tsx +3 -1
- package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +22 -0
- package/src/features/layouts/appbar/AppBarLayout.tsx +51 -12
- package/src/features/layouts/floating/FloatingFadeMask.tsx +22 -0
- package/src/features/layouts/floating/FloatingLayout.tsx +142 -0
- package/src/features/layouts/floating/FloatingSidebar.tsx +327 -0
- package/src/features/layouts/floating/FloatingTabBar.tsx +437 -0
- package/src/features/layouts/floating/FloatingTabIndicator.tsx +216 -0
- package/src/features/layouts/floating/computeFloatingInsets.spec.ts +83 -0
- package/src/features/layouts/floating/computeFloatingInsets.ts +103 -0
- package/src/features/layouts/floating/isShellOwnedPath.spec.ts +23 -0
- package/src/features/layouts/floating/isShellOwnedPath.ts +16 -0
- package/src/features/layouts/floating/layoutChromeStore.ts +46 -0
- package/src/features/layouts/floating/scrollChrome.spec.ts +49 -0
- package/src/features/layouts/floating/useFloatingChrome.ts +216 -0
- package/src/features/layouts/sidebar/SidebarLayout.tsx +32 -6
- package/src/features/layouts/sidebar/types.ts +4 -0
- package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +15 -0
- package/src/features/settings/SettingsProvider.tsx +7 -0
- package/src/features/settings/SettingsView.tsx +6 -6
- package/src/features/settings/components/Develop.tsx +31 -13
- package/src/features/settings/utils/buildSettingsForPropagation.ts +16 -0
- package/src/features/storage/StoragePickerContext.tsx +1 -0
- package/src/hooks/use-viewport.ts +40 -0
- package/src/i18n/translations/en/settings.json +8 -2
- package/src/i18n/translations/fr/settings.json +8 -2
- package/src/index.css +321 -0
- 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.
|
|
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.
|
|
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": [
|
|
176
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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,
|
|
@@ -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-
|
|
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'
|
|
335
|
+
variant === 'floating'
|
|
336
336
|
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
337
|
-
: '
|
|
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'
|
|
351
|
+
variant === 'floating'
|
|
349
352
|
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
350
|
-
:
|
|
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=
|
|
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({
|
|
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
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
-
|
|
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}
|
|
@@ -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
|
|
14
|
-
export type LayoutType =
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -62,11 +62,15 @@ import {
|
|
|
62
62
|
/** App-bar chrome height — matches the Tauri / sidebar titlebar strip. */
|
|
63
63
|
const APP_BAR_HEIGHT_PX = DESKTOP_TITLEBAR_HEIGHT_PX;
|
|
64
64
|
|
|
65
|
+
export type AppBarChromeVariant = 'app-bar' | 'inset';
|
|
66
|
+
|
|
65
67
|
interface AppBarLayoutProps {
|
|
66
68
|
title?: string;
|
|
67
69
|
appIcon?: ThemeAsset;
|
|
68
70
|
logo?: ThemeAsset;
|
|
69
71
|
navigation: (NavigationItem | NavigationGroup)[];
|
|
72
|
+
/** Visual chrome: default flush app-bar, or inset padded/rounded main frame. */
|
|
73
|
+
variant?: AppBarChromeVariant;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
type NavSection =
|
|
@@ -240,7 +244,7 @@ const navTriggerClass = (active: boolean) =>
|
|
|
240
244
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
241
245
|
active
|
|
242
246
|
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
243
|
-
: 'text-sidebar-foreground/85 hover:bg-sidebar-accent
|
|
247
|
+
: 'text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-foreground',
|
|
244
248
|
);
|
|
245
249
|
|
|
246
250
|
/** Text link / action used in the bar (not inside a dropdown). */
|
|
@@ -366,7 +370,7 @@ function AppBarNavCategory({
|
|
|
366
370
|
type="button"
|
|
367
371
|
variant="ghost"
|
|
368
372
|
size="sm"
|
|
369
|
-
className={cn(navTriggerClass(active)
|
|
373
|
+
className={cn(navTriggerClass(active))}
|
|
370
374
|
aria-expanded={open}
|
|
371
375
|
>
|
|
372
376
|
<span className="truncate">{label}</span>
|
|
@@ -418,7 +422,7 @@ function AppBarNavMore({
|
|
|
418
422
|
type="button"
|
|
419
423
|
variant="ghost"
|
|
420
424
|
size="sm"
|
|
421
|
-
className={cn(navTriggerClass(moreActive)
|
|
425
|
+
className={cn(navTriggerClass(moreActive))}
|
|
422
426
|
aria-label={t('desktopChrome.more')}
|
|
423
427
|
aria-expanded={open}
|
|
424
428
|
>
|
|
@@ -688,7 +692,7 @@ function TopBarEndItem({
|
|
|
688
692
|
'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',
|
|
689
693
|
isActive
|
|
690
694
|
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
691
|
-
: 'text-muted-foreground hover:bg-sidebar-accent
|
|
695
|
+
: 'text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground',
|
|
692
696
|
);
|
|
693
697
|
|
|
694
698
|
const wrap = (node: ReactNode) => <AppBarTooltip label={label}>{node}</AppBarTooltip>;
|
|
@@ -741,7 +745,12 @@ function TopBarEndItem({
|
|
|
741
745
|
);
|
|
742
746
|
}
|
|
743
747
|
|
|
744
|
-
export function AppBarLayout({
|
|
748
|
+
export function AppBarLayout({
|
|
749
|
+
title,
|
|
750
|
+
appIcon,
|
|
751
|
+
navigation,
|
|
752
|
+
variant = 'app-bar',
|
|
753
|
+
}: AppBarLayoutProps) {
|
|
745
754
|
const { i18n } = useTranslation();
|
|
746
755
|
const { isAuthenticated } = useAuth();
|
|
747
756
|
const { settings } = useSettings();
|
|
@@ -751,6 +760,7 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
751
760
|
const overlay = useMacOverlayChrome();
|
|
752
761
|
const trafficLights = useMacTrafficLights();
|
|
753
762
|
const currentLanguage = i18n.language || 'en';
|
|
763
|
+
const isInset = variant === 'inset';
|
|
754
764
|
const hasCustomLoginNav = useMemo(() => hasLoginNavigationItem(navigation), [navigation]);
|
|
755
765
|
const authAwareNavigation = useMemo(
|
|
756
766
|
() =>
|
|
@@ -800,10 +810,17 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
800
810
|
const hasStartNav = startSections.some((s) => s.items.length > 0);
|
|
801
811
|
// Nested shell-in-iframe must not repeat the root safe-area top band.
|
|
802
812
|
const showSafeAreaTopbar = isShellUiRootWindow();
|
|
813
|
+
// Keep in sync with <main> `md:mx-3` — bar content aligns to the inset card border.
|
|
814
|
+
// Extra inset from the frame edge: 20px left (brand/nav), 10px right (end links already have control padding).
|
|
815
|
+
const insetFramePadPx = 12;
|
|
816
|
+
const insetBarContentOffsetLeftPx = 20;
|
|
817
|
+
const insetBarContentOffsetRightPx = 10;
|
|
803
818
|
// md+: strip owns the inset; mobile pads the header into the status band.
|
|
804
819
|
const headerStyle = {
|
|
805
|
-
paddingLeft:
|
|
806
|
-
|
|
820
|
+
paddingLeft: isInset
|
|
821
|
+
? (chromeInset ?? insetFramePadPx) + insetBarContentOffsetLeftPx
|
|
822
|
+
: (chromeInset ?? 12),
|
|
823
|
+
paddingRight: isInset ? insetFramePadPx + insetBarContentOffsetRightPx : 8,
|
|
807
824
|
...(isMobile && showSafeAreaTopbar
|
|
808
825
|
? {
|
|
809
826
|
paddingTop: `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`,
|
|
@@ -818,14 +835,28 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
818
835
|
return (
|
|
819
836
|
<div
|
|
820
837
|
data-shellui-app-bar-layout=""
|
|
821
|
-
|
|
838
|
+
data-shellui-layout-variant={variant}
|
|
839
|
+
className={cn(
|
|
840
|
+
'flex h-full max-h-full flex-col overflow-hidden',
|
|
841
|
+
isInset ? 'bg-shellui-inset-chrome' : 'bg-background',
|
|
842
|
+
)}
|
|
822
843
|
>
|
|
823
844
|
<SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
|
|
824
|
-
<SafeAreaTopbarStrip
|
|
845
|
+
<SafeAreaTopbarStrip
|
|
846
|
+
enabled={showSafeAreaTopbar}
|
|
847
|
+
className={
|
|
848
|
+
isInset ? '[&>div]:border-transparent [&>div]:bg-shellui-inset-chrome' : undefined
|
|
849
|
+
}
|
|
850
|
+
/>
|
|
825
851
|
<header
|
|
826
|
-
className=
|
|
852
|
+
className={cn(
|
|
853
|
+
'relative z-[46] flex w-full shrink-0 items-center gap-1.5 text-sidebar-foreground select-none',
|
|
854
|
+
isInset
|
|
855
|
+
? 'border-b border-transparent bg-transparent'
|
|
856
|
+
: 'border-b border-sidebar-border bg-sidebar',
|
|
857
|
+
)}
|
|
827
858
|
style={headerStyle}
|
|
828
|
-
data-layout=
|
|
859
|
+
data-layout={isInset ? 'app-bar-inset' : 'app-bar'}
|
|
829
860
|
{...(trafficLights ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' } : {})}
|
|
830
861
|
>
|
|
831
862
|
{appIcon ? (
|
|
@@ -893,7 +924,15 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
893
924
|
</div>
|
|
894
925
|
</header>
|
|
895
926
|
|
|
896
|
-
<main
|
|
927
|
+
<main
|
|
928
|
+
className={cn(
|
|
929
|
+
'flex min-h-0 flex-1 flex-col overflow-hidden',
|
|
930
|
+
// Desktop inset: float the content frame on the chrome tray (same as sidebar-inset).
|
|
931
|
+
// `md:mx-3` (12px) must match `insetFramePadPx` on the header above.
|
|
932
|
+
isInset &&
|
|
933
|
+
'bg-background md:mx-3 md:mb-3 md:rounded-2xl md:border md:border-border md:shadow-sm',
|
|
934
|
+
)}
|
|
935
|
+
>
|
|
897
936
|
<Outlet />
|
|
898
937
|
</main>
|
|
899
938
|
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Soft edge fades — mask-tapered blur so scrolling content softens toward chrome. */
|
|
2
|
+
export function FloatingFadeMask({
|
|
3
|
+
placement,
|
|
4
|
+
visible,
|
|
5
|
+
}: {
|
|
6
|
+
placement: 'top' | 'bottom';
|
|
7
|
+
/** False at the matching scroll edge (top/bottom) or when content does not overflow. */
|
|
8
|
+
visible: boolean;
|
|
9
|
+
}) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
aria-hidden
|
|
13
|
+
data-shellui-floating-fade={placement}
|
|
14
|
+
data-visible={visible ? 'true' : 'false'}
|
|
15
|
+
className={
|
|
16
|
+
placement === 'top'
|
|
17
|
+
? 'shellui-floating-fade shellui-floating-fade-top'
|
|
18
|
+
: 'shellui-floating-fade shellui-floating-fade-bottom'
|
|
19
|
+
}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|