@shellui/core 0.7.0-alpha.1 → 0.7.0-alpha.10
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 +37 -4
- package/src/components/ContentView.tsx +19 -8
- package/src/components/ui/sidebar.tsx +11 -5
- package/src/features/admin/AdminView.tsx +9 -6
- package/src/features/auth/AuthProvider.tsx +25 -4
- package/src/features/auth/appBackend/appBackendSessions.spec.ts +134 -0
- package/src/features/auth/appBackend/appBackendSessions.ts +168 -17
- package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
- package/src/features/auth/appBackend/childFrames.ts +180 -0
- package/src/features/auth/appBackend/frameAuth.ts +47 -10
- package/src/features/auth/appBackend/silentSignIn.spec.ts +18 -0
- package/src/features/auth/appBackend/silentSignIn.ts +15 -1
- package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
- package/src/features/auth/appBackend/tokenExchange.ts +76 -0
- package/src/features/auth/components/OAuthCallbackView.tsx +7 -5
- package/src/features/auth/utils/buildOAuthSessionRedirectTo.spec.ts +42 -1
- package/src/features/auth/utils/buildOAuthSessionRedirectTo.ts +23 -0
- package/src/features/auth/utils/canRestoreStoredSession.spec.ts +29 -0
- package/src/features/auth/utils/canRestoreStoredSession.ts +12 -0
- package/src/features/auth/utils/index.ts +7 -1
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
- package/src/features/auth/utils/webPkce.spec.ts +23 -0
- package/src/features/auth/utils/webPkce.ts +23 -6
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- package/src/features/config/types.ts +30 -4
- package/src/features/layouts/appbar/AppBarLayout.tsx +63 -30
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +12 -23
- package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
- package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
- package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
- package/src/features/layouts/chrome/MacStrip.tsx +33 -0
- package/src/features/layouts/chrome/constants.ts +33 -8
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/stripDragMap.ts +35 -0
- package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
- package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
- package/src/features/layouts/floating/FloatingBottomDock.tsx +199 -20
- package/src/features/layouts/floating/FloatingLayout.tsx +13 -8
- package/src/features/layouts/floating/FloatingSidebar.tsx +144 -70
- package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
- package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
- package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
- package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +38 -10
- package/src/features/layouts/sidebar/NavigationContent.tsx +14 -6
- package/src/features/layouts/sidebar/SidebarIcons.tsx +3 -9
- package/src/features/layouts/sidebar/SidebarInner.tsx +50 -39
- package/src/features/layouts/sidebar/SidebarLayout.tsx +8 -11
- package/src/features/layouts/utils.ts +4 -3
- package/src/features/layouts/windows/DesktopDots.tsx +76 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +184 -125
- package/src/features/layouts/windows/deskDots.spec.ts +52 -0
- package/src/features/layouts/windows/deskDots.ts +314 -0
- package/src/features/settings/SettingsProvider.tsx +158 -2
- package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +8 -7
- package/src/features/settings/utils/buildSettingsForPropagation.ts +4 -6
- package/src/features/theme/applyTheme.ts +8 -0
- package/src/features/theme/navContrast.spec.ts +49 -0
- package/src/features/theme/navContrast.ts +108 -0
- package/src/features/transfers/transferQueue.spec.ts +6 -2
- package/src/i18n/translations/en/common.json +25 -0
- package/src/i18n/translations/fr/common.json +25 -0
- package/src/index.css +935 -46
- package/src/index.ts +1 -0
- package/src/routes/hooks/useNavigationItems.ts +14 -3
- package/src/routes/hooks/withShellSearch.spec.ts +13 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
|
2
|
+
import { Drawer as VaulDrawer } from 'vaul';
|
|
2
3
|
import { useLocation, useNavigate } from 'react-router';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { shellui } from '@shellui/sdk';
|
|
@@ -37,6 +38,7 @@ import { useChromeActionsSnapshot } from '../../chromeActions/ChromeActionsProvi
|
|
|
37
38
|
import { SHELL_DEVELOP_CHROME_ACTIONS_FRAME } from '../../chromeActions/chromeActionsStore';
|
|
38
39
|
import { CHROME_ACTIONS_FAB_SIZE_FLOATING } from '../../chromeActions/computeActionInsets';
|
|
39
40
|
import { MoreHorizontalIcon } from '../../chromeActions/ChromeActionIcons';
|
|
41
|
+
import { Z_INDEX } from '../../../lib/z-index';
|
|
40
42
|
|
|
41
43
|
const MORE_TAB_KEY = '__more__';
|
|
42
44
|
|
|
@@ -52,12 +54,12 @@ function TabGlyph({ item, label }: { item: NavigationItem; label: string }) {
|
|
|
52
54
|
return (
|
|
53
55
|
<NavIcon
|
|
54
56
|
src={iconSrc}
|
|
55
|
-
className="size-5"
|
|
57
|
+
className="shellui-dock-glyph size-5"
|
|
56
58
|
/>
|
|
57
59
|
);
|
|
58
60
|
}
|
|
59
61
|
return (
|
|
60
|
-
<span className="flex size-5 items-center justify-center text-xs font-semibold leading-none">
|
|
62
|
+
<span className="shellui-dock-glyph flex size-5 items-center justify-center text-xs font-semibold leading-none">
|
|
61
63
|
{label.charAt(0).toUpperCase() || '?'}
|
|
62
64
|
</span>
|
|
63
65
|
);
|
|
@@ -85,10 +87,36 @@ function useMainHasPrimaryFab(): boolean {
|
|
|
85
87
|
}, [all]);
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
// Colours, the active capsule and press feedback live in index.css (`.shellui-dock-tab`).
|
|
88
91
|
const tabTriggerClass =
|
|
89
|
-
'h-auto min-w-0 flex-1 basis-0 flex-col gap-0.5 px-
|
|
92
|
+
'shellui-dock-tab h-auto min-w-0 flex-1 basis-0 flex-col gap-0.5 px-1 py-1 text-[11px] font-medium leading-tight data-[state=active]:bg-transparent data-[state=active]:shadow-none';
|
|
90
93
|
const tabTriggerClassTablet =
|
|
91
|
-
'h-auto min-w-0 flex-1 basis-0 flex-col gap-1 px-3.5 py-
|
|
94
|
+
'shellui-dock-tab h-auto min-w-0 flex-1 basis-0 flex-col gap-1 px-3.5 py-1.5 text-xs font-medium leading-tight data-[state=active]:bg-transparent data-[state=active]:shadow-none';
|
|
95
|
+
|
|
96
|
+
/** Icon inside the capsule that marks the active tab and scales on press. */
|
|
97
|
+
function DockCapsule({ children }: { children: ReactNode }) {
|
|
98
|
+
return (
|
|
99
|
+
<span
|
|
100
|
+
aria-hidden
|
|
101
|
+
data-shellui-dock-capsule=""
|
|
102
|
+
className="shellui-dock-capsule flex items-center justify-center"
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</span>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Short tap feedback on Android web; iOS web has no vibration API (the scale is the cue). */
|
|
110
|
+
function tabChangeHaptic() {
|
|
111
|
+
if (typeof navigator === 'undefined' || typeof navigator.vibrate !== 'function') return;
|
|
112
|
+
if (typeof window === 'undefined' || !window.matchMedia?.('(pointer: coarse)').matches) return;
|
|
113
|
+
if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;
|
|
114
|
+
try {
|
|
115
|
+
navigator.vibrate(8);
|
|
116
|
+
} catch {
|
|
117
|
+
// Blocked before the first user gesture in some browsers.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
92
120
|
|
|
93
121
|
/**
|
|
94
122
|
* Floating phone/tablet bottom nav: shadcn Tabs with equal slots.
|
|
@@ -110,7 +138,8 @@ export function FloatingBottomDock({
|
|
|
110
138
|
}) {
|
|
111
139
|
const location = useLocation();
|
|
112
140
|
const navigate = useNavigate();
|
|
113
|
-
const { i18n
|
|
141
|
+
const { i18n } = useTranslation('settings');
|
|
142
|
+
const { t: tc } = useTranslation('common');
|
|
114
143
|
const lang = i18n.language || 'en';
|
|
115
144
|
const [moreOpen, setMoreOpen] = useState(false);
|
|
116
145
|
const listRef = useRef<HTMLDivElement>(null);
|
|
@@ -223,7 +252,10 @@ export function FloatingBottomDock({
|
|
|
223
252
|
const onTabChange = (value: string) => {
|
|
224
253
|
setMoreOpen(false);
|
|
225
254
|
const navItem = primary.find((item) => itemKey(item) === value);
|
|
226
|
-
if (navItem)
|
|
255
|
+
if (navItem) {
|
|
256
|
+
if (value !== activeTabKey) tabChangeHaptic();
|
|
257
|
+
activateItem(navItem);
|
|
258
|
+
}
|
|
227
259
|
};
|
|
228
260
|
|
|
229
261
|
const bottomPad = floatingTabBarBottomPadCss(viewport);
|
|
@@ -275,11 +307,11 @@ export function FloatingBottomDock({
|
|
|
275
307
|
<TabsList
|
|
276
308
|
ref={listRef}
|
|
277
309
|
data-shellui-floating-dock-list=""
|
|
278
|
-
aria-label={
|
|
310
|
+
aria-label={tc('shellChrome.mainNav')}
|
|
279
311
|
className={cn(
|
|
280
|
-
'flex h-full min-w-0 gap-
|
|
312
|
+
'shellui-glass flex h-full min-w-0 gap-0.5 p-1 text-sidebar-foreground',
|
|
281
313
|
// Override TabsList default `h-10` so height matches the FAB.
|
|
282
|
-
isTablet ? 'h-16 gap-1
|
|
314
|
+
isTablet ? 'h-16 gap-1 p-1.5' : 'h-14',
|
|
283
315
|
isPhone ? 'w-full' : 'w-auto',
|
|
284
316
|
)}
|
|
285
317
|
style={{
|
|
@@ -303,11 +335,13 @@ export function FloatingBottomDock({
|
|
|
303
335
|
className={triggerClass}
|
|
304
336
|
aria-current={isActive ? 'page' : undefined}
|
|
305
337
|
>
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
338
|
+
<DockCapsule>
|
|
339
|
+
<TabGlyph
|
|
340
|
+
item={navItem}
|
|
341
|
+
label={label}
|
|
342
|
+
/>
|
|
343
|
+
</DockCapsule>
|
|
344
|
+
<span className="shellui-dock-label w-full truncate text-center">{label}</span>
|
|
311
345
|
</TabsTrigger>
|
|
312
346
|
);
|
|
313
347
|
})}
|
|
@@ -319,7 +353,7 @@ export function FloatingBottomDock({
|
|
|
319
353
|
aria-hidden
|
|
320
354
|
/>
|
|
321
355
|
) : null}
|
|
322
|
-
{showMoreFinal ? (
|
|
356
|
+
{showMoreFinal && !isPhone ? (
|
|
323
357
|
<DropdownMenu
|
|
324
358
|
open={moreOpen}
|
|
325
359
|
onOpenChange={setMoreOpen}
|
|
@@ -330,16 +364,20 @@ export function FloatingBottomDock({
|
|
|
330
364
|
role="tab"
|
|
331
365
|
aria-selected={activeTabKey === MORE_TAB_KEY}
|
|
332
366
|
aria-current={activeTabKey === MORE_TAB_KEY ? 'page' : undefined}
|
|
367
|
+
aria-haspopup={isPhone ? 'dialog' : 'menu'}
|
|
368
|
+
aria-expanded={moreOpen}
|
|
333
369
|
data-state={activeTabKey === MORE_TAB_KEY ? 'active' : 'inactive'}
|
|
334
370
|
data-shellui-floating-dock-tab=""
|
|
335
371
|
className={cn(
|
|
336
|
-
'inline-flex items-center justify-center whitespace-nowrap
|
|
372
|
+
'inline-flex items-center justify-center whitespace-nowrap focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
337
373
|
triggerClass,
|
|
338
374
|
)}
|
|
339
375
|
>
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
376
|
+
<DockCapsule>
|
|
377
|
+
<MoreHorizontalIcon className="shellui-dock-glyph size-5" />
|
|
378
|
+
</DockCapsule>
|
|
379
|
+
<span className="shellui-dock-label w-full truncate text-center">
|
|
380
|
+
{tc('desktopChrome.more')}
|
|
343
381
|
</span>
|
|
344
382
|
</button>
|
|
345
383
|
</DropdownMenuTrigger>
|
|
@@ -361,6 +399,7 @@ export function FloatingBottomDock({
|
|
|
361
399
|
<DropdownMenuItem
|
|
362
400
|
key={itemKey(item)}
|
|
363
401
|
className={cn(isActive && 'bg-accent font-medium')}
|
|
402
|
+
aria-current={isActive ? 'page' : undefined}
|
|
364
403
|
onSelect={() => activateItem(item)}
|
|
365
404
|
>
|
|
366
405
|
<TabGlyph
|
|
@@ -402,9 +441,149 @@ export function FloatingBottomDock({
|
|
|
402
441
|
</DropdownMenuContent>
|
|
403
442
|
</DropdownMenu>
|
|
404
443
|
) : null}
|
|
444
|
+
{showMoreFinal && isPhone ? (
|
|
445
|
+
<>
|
|
446
|
+
<button
|
|
447
|
+
type="button"
|
|
448
|
+
onClick={() => setMoreOpen((open) => !open)}
|
|
449
|
+
role="tab"
|
|
450
|
+
aria-selected={activeTabKey === MORE_TAB_KEY}
|
|
451
|
+
aria-current={activeTabKey === MORE_TAB_KEY ? 'page' : undefined}
|
|
452
|
+
aria-haspopup={isPhone ? 'dialog' : 'menu'}
|
|
453
|
+
aria-expanded={moreOpen}
|
|
454
|
+
data-state={activeTabKey === MORE_TAB_KEY ? 'active' : 'inactive'}
|
|
455
|
+
data-shellui-floating-dock-tab=""
|
|
456
|
+
className={cn(
|
|
457
|
+
'inline-flex items-center justify-center whitespace-nowrap focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
458
|
+
triggerClass,
|
|
459
|
+
)}
|
|
460
|
+
>
|
|
461
|
+
<DockCapsule>
|
|
462
|
+
<MoreHorizontalIcon className="shellui-dock-glyph size-5" />
|
|
463
|
+
</DockCapsule>
|
|
464
|
+
<span className="shellui-dock-label w-full truncate text-center">
|
|
465
|
+
{tc('desktopChrome.more')}
|
|
466
|
+
</span>
|
|
467
|
+
</button>
|
|
468
|
+
<FloatingMoreSheet
|
|
469
|
+
open={moreOpen}
|
|
470
|
+
onOpenChange={setMoreOpen}
|
|
471
|
+
title={tc('desktopChrome.more')}
|
|
472
|
+
closeLabel={tc('shellChrome.closeMenu')}
|
|
473
|
+
externalLabel={tc('shellChrome.externalLink')}
|
|
474
|
+
lang={lang}
|
|
475
|
+
overflowItems={moreOverflowItems}
|
|
476
|
+
endItems={moreEndItems}
|
|
477
|
+
showAuthButton={showAuthButton}
|
|
478
|
+
activePathPrefix={activePathPrefix}
|
|
479
|
+
onActivate={activateItem}
|
|
480
|
+
/>
|
|
481
|
+
</>
|
|
482
|
+
) : null}
|
|
405
483
|
</TabsList>
|
|
406
484
|
</Tabs>
|
|
407
485
|
</div>
|
|
408
486
|
</div>
|
|
409
487
|
);
|
|
410
488
|
}
|
|
489
|
+
|
|
490
|
+
/** Phone More: bottom sheet (vaul) for one-hand reach. Tablet keeps the dropdown. */
|
|
491
|
+
function FloatingMoreSheet({
|
|
492
|
+
open,
|
|
493
|
+
onOpenChange,
|
|
494
|
+
title,
|
|
495
|
+
closeLabel,
|
|
496
|
+
externalLabel,
|
|
497
|
+
lang,
|
|
498
|
+
overflowItems,
|
|
499
|
+
endItems,
|
|
500
|
+
showAuthButton,
|
|
501
|
+
activePathPrefix,
|
|
502
|
+
onActivate,
|
|
503
|
+
}: {
|
|
504
|
+
open: boolean;
|
|
505
|
+
onOpenChange: (open: boolean) => void;
|
|
506
|
+
title: string;
|
|
507
|
+
closeLabel: string;
|
|
508
|
+
externalLabel: string;
|
|
509
|
+
lang: string;
|
|
510
|
+
overflowItems: NavigationItem[];
|
|
511
|
+
endItems: NavigationItem[];
|
|
512
|
+
showAuthButton: boolean;
|
|
513
|
+
activePathPrefix: string | null;
|
|
514
|
+
onActivate: (item: NavigationItem) => void;
|
|
515
|
+
}) {
|
|
516
|
+
const renderRow = (item: NavigationItem) => {
|
|
517
|
+
const label = resolveLocalizedString(item.label, lang);
|
|
518
|
+
const isActive =
|
|
519
|
+
item.openIn !== 'modal' &&
|
|
520
|
+
item.openIn !== 'drawer' &&
|
|
521
|
+
item.openIn !== 'external' &&
|
|
522
|
+
getNavPathPrefix(item) === activePathPrefix;
|
|
523
|
+
return (
|
|
524
|
+
<button
|
|
525
|
+
key={itemKey(item)}
|
|
526
|
+
type="button"
|
|
527
|
+
data-shellui-more-sheet-row=""
|
|
528
|
+
data-active={isActive ? 'true' : undefined}
|
|
529
|
+
aria-current={isActive ? 'page' : undefined}
|
|
530
|
+
className="shellui-more-sheet-row flex w-full items-center gap-3 text-left"
|
|
531
|
+
onClick={() => onActivate(item)}
|
|
532
|
+
>
|
|
533
|
+
<TabGlyph
|
|
534
|
+
item={item}
|
|
535
|
+
label={label}
|
|
536
|
+
/>
|
|
537
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
538
|
+
{item.openIn === 'external' ? <span className="sr-only">{externalLabel}</span> : null}
|
|
539
|
+
</button>
|
|
540
|
+
);
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
return (
|
|
544
|
+
<VaulDrawer.Root
|
|
545
|
+
open={open}
|
|
546
|
+
onOpenChange={onOpenChange}
|
|
547
|
+
direction="bottom"
|
|
548
|
+
>
|
|
549
|
+
<VaulDrawer.Portal>
|
|
550
|
+
<VaulDrawer.Overlay
|
|
551
|
+
data-shellui-more-sheet-overlay=""
|
|
552
|
+
className="fixed inset-0"
|
|
553
|
+
style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_OVERLAY, background: 'var(--shellui-scrim)' }}
|
|
554
|
+
/>
|
|
555
|
+
<VaulDrawer.Content
|
|
556
|
+
data-shellui-more-sheet=""
|
|
557
|
+
aria-describedby={undefined}
|
|
558
|
+
className="shellui-more-sheet fixed flex max-h-[80dvh] flex-col text-sidebar-foreground outline-none"
|
|
559
|
+
style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_CONTENT }}
|
|
560
|
+
>
|
|
561
|
+
<div
|
|
562
|
+
aria-hidden
|
|
563
|
+
className="shellui-more-sheet-handle mx-auto shrink-0"
|
|
564
|
+
/>
|
|
565
|
+
<VaulDrawer.Title className="sr-only">{title}</VaulDrawer.Title>
|
|
566
|
+
<nav
|
|
567
|
+
aria-label={title}
|
|
568
|
+
className="min-h-0 flex-1 overflow-y-auto px-2 pb-2"
|
|
569
|
+
>
|
|
570
|
+
{overflowItems.map(renderRow)}
|
|
571
|
+
{overflowItems.length > 0 && (endItems.length > 0 || showAuthButton) ? (
|
|
572
|
+
<div
|
|
573
|
+
aria-hidden
|
|
574
|
+
className="mx-3 my-1 h-px bg-[var(--shellui-hairline)]"
|
|
575
|
+
/>
|
|
576
|
+
) : null}
|
|
577
|
+
{endItems.map(renderRow)}
|
|
578
|
+
{showAuthButton ? (
|
|
579
|
+
<div className="shellui-more-sheet-account px-1 py-1">
|
|
580
|
+
<LoginButton variant="sidebar" />
|
|
581
|
+
</div>
|
|
582
|
+
) : null}
|
|
583
|
+
</nav>
|
|
584
|
+
<VaulDrawer.Close className="sr-only">{closeLabel}</VaulDrawer.Close>
|
|
585
|
+
</VaulDrawer.Content>
|
|
586
|
+
</VaulDrawer.Portal>
|
|
587
|
+
</VaulDrawer.Root>
|
|
588
|
+
);
|
|
589
|
+
}
|
|
@@ -16,16 +16,17 @@ import { useAuth } from '../../auth/hooks/useAuth';
|
|
|
16
16
|
import { useSettings } from '../../settings/hooks/useSettings';
|
|
17
17
|
import { useViewport } from '../../../hooks/use-viewport';
|
|
18
18
|
import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
|
|
19
|
-
import { useIsTauriClient, useMacTrafficLights } from '../chrome/runtime';
|
|
19
|
+
import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
MAC_LIGHTS_SAFE_PX,
|
|
22
|
+
SHELL_HEADER_HEIGHT_PX,
|
|
23
|
+
SHELL_HEADER_PAD_TOP_PX,
|
|
24
24
|
} from '../chrome/constants';
|
|
25
25
|
import { FloatingBottomDock } from './FloatingBottomDock';
|
|
26
26
|
import { FloatingSidebar } from './FloatingSidebar';
|
|
27
27
|
import { FloatingStatusScrim } from './FloatingStatusScrim';
|
|
28
28
|
import { useFloatingChrome } from './useFloatingChrome';
|
|
29
|
+
import { useSoftKeyboard } from './useSoftKeyboard';
|
|
29
30
|
import { SafeAreaTopbarOffset, isShellUiRootWindow } from '../chrome/SafeAreaTopbar';
|
|
30
31
|
import { useChromeActionsSnapshot } from '../../chromeActions/ChromeActionsProvider';
|
|
31
32
|
import { actionChromeFlags } from '../../chromeActions/computeActionInsets';
|
|
@@ -46,8 +47,11 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
|
|
|
46
47
|
const { navigationItem } = useNavigationItems();
|
|
47
48
|
const viewport = useViewport();
|
|
48
49
|
const { chromeVisible, sidebarCollapsed, toggleSidebarCollapsed } = useFloatingChrome(viewport);
|
|
50
|
+
// Phones and tablets: hide the dock and FAB while the soft keyboard is up.
|
|
51
|
+
useSoftKeyboard(viewport !== 'desktop');
|
|
49
52
|
const isTauriEnv = useIsTauriClient();
|
|
50
53
|
const trafficLights = useMacTrafficLights();
|
|
54
|
+
const macStrip = useMacOverlayChrome();
|
|
51
55
|
const currentLanguage = i18n.language || 'en';
|
|
52
56
|
|
|
53
57
|
const hasCustomLoginNav = useMemo(() => hasLoginNavigationItem(navigation), [navigation]);
|
|
@@ -114,13 +118,14 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
|
|
|
114
118
|
<SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
|
|
115
119
|
<FloatingStatusScrim enabled={showStatusScrim} />
|
|
116
120
|
|
|
117
|
-
{
|
|
121
|
+
{/* macOS desktop: FloatingSidebar owns the strip, expanded or collapsed. */}
|
|
122
|
+
{isTauriEnv && !(showSidebar && !sidebarCollapsed) && !(showSidebar && macStrip) ? (
|
|
118
123
|
<div
|
|
119
124
|
className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
|
|
120
125
|
style={{
|
|
121
|
-
height:
|
|
122
|
-
paddingTop:
|
|
123
|
-
paddingLeft: trafficLights ?
|
|
126
|
+
height: SHELL_HEADER_HEIGHT_PX,
|
|
127
|
+
paddingTop: SHELL_HEADER_PAD_TOP_PX,
|
|
128
|
+
paddingLeft: trafficLights ? MAC_LIGHTS_SAFE_PX : 8,
|
|
124
129
|
}}
|
|
125
130
|
{...(trafficLights
|
|
126
131
|
? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
|
|
@@ -16,13 +16,14 @@ import { AppBrandIcon } from '../branding/AppBrandIcon';
|
|
|
16
16
|
import { LoginButton } from '../../auth/components/LoginButton';
|
|
17
17
|
import { cn } from '../../../lib/utils';
|
|
18
18
|
import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
|
|
19
|
-
import { useIsTauriClient, useIsTauriRuntime,
|
|
19
|
+
import { useIsTauriClient, useIsTauriRuntime, useMacOverlayChrome } from '../chrome/runtime';
|
|
20
20
|
import {
|
|
21
21
|
DESKTOP_TITLEBAR_HEIGHT_PX,
|
|
22
22
|
DESKTOP_TITLEBAR_PAD_TOP_PX,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
SHELL_HEADER_HEIGHT_PX,
|
|
24
|
+
SHELL_HEADER_PAD_TOP_PX,
|
|
25
25
|
} from '../chrome/constants';
|
|
26
|
+
import { MAC_DRAG_REGION_PROPS, MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
|
|
26
27
|
import {
|
|
27
28
|
FLOATING_CHROME_MARGIN,
|
|
28
29
|
FLOATING_HISTORY_CLUSTER_PX,
|
|
@@ -104,16 +105,16 @@ export function FloatingSidebar({
|
|
|
104
105
|
}) {
|
|
105
106
|
const location = useLocation();
|
|
106
107
|
const { i18n, t } = useTranslation('settings');
|
|
108
|
+
const { t: tc } = useTranslation('common');
|
|
107
109
|
const lang = i18n.language || 'en';
|
|
108
|
-
const trafficLights = useMacTrafficLights();
|
|
109
110
|
const isTauriEnv = useIsTauriClient();
|
|
110
111
|
const tauriRuntime = useIsTauriRuntime();
|
|
111
|
-
/**
|
|
112
|
+
/** macOS: the panel top is the 32px strip; collapsed, a 32px strip runs over the content. */
|
|
113
|
+
const macStrip = useMacOverlayChrome();
|
|
114
|
+
/** Tauri drops the floating edge gap so this row shares the title bar band. */
|
|
112
115
|
const edgeMargin = tauriRuntime ? 0 : FLOATING_CHROME_MARGIN;
|
|
113
|
-
/** Collapsed chip clears the
|
|
114
|
-
const chipLeadingPx =
|
|
115
|
-
(trafficLights ? MAC_TRAFFIC_LIGHTS_WIDTH_PX : 0) +
|
|
116
|
-
(isTauriEnv ? FLOATING_HISTORY_CLUSTER_PX : 0);
|
|
116
|
+
/** Collapsed chip clears the history cluster (Windows / Linux Tauri). */
|
|
117
|
+
const chipLeadingPx = isTauriEnv ? FLOATING_HISTORY_CLUSTER_PX : 0;
|
|
117
118
|
|
|
118
119
|
const sidebarNav = useMemo(() => filterNavigationForSidebar(navigation), [navigation]);
|
|
119
120
|
const sections = useMemo(() => buildSections(sidebarNav), [sidebarNav]);
|
|
@@ -131,8 +132,8 @@ export function FloatingSidebar({
|
|
|
131
132
|
|
|
132
133
|
const chipEdgePad = tauriRuntime
|
|
133
134
|
? {
|
|
134
|
-
height:
|
|
135
|
-
paddingTop:
|
|
135
|
+
height: SHELL_HEADER_HEIGHT_PX,
|
|
136
|
+
paddingTop: SHELL_HEADER_PAD_TOP_PX,
|
|
136
137
|
paddingLeft: `calc(var(--shellui-safe-area-left, 0px) + ${chipLeadingPx}px)`,
|
|
137
138
|
boxSizing: 'border-box' as const,
|
|
138
139
|
alignItems: 'center',
|
|
@@ -156,20 +157,24 @@ export function FloatingSidebar({
|
|
|
156
157
|
const iconSrc = navItem.icon ?? faviconUrl ?? null;
|
|
157
158
|
|
|
158
159
|
const className = cn(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
: 'text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
160
|
+
// Colours, hover and active pill live in index.css (`.shellui-floating-nav-item`).
|
|
161
|
+
'shellui-floating-nav-item flex h-8 w-full items-center gap-2.5 px-2.5 text-sm',
|
|
162
|
+
isActive && 'is-active',
|
|
163
163
|
);
|
|
164
164
|
|
|
165
165
|
const content = (
|
|
166
166
|
<>
|
|
167
167
|
<NavIcon
|
|
168
168
|
src={iconSrc}
|
|
169
|
-
className="size-4 shrink-0"
|
|
169
|
+
className="shellui-nav-icon size-4 shrink-0"
|
|
170
170
|
/>
|
|
171
171
|
<span className="truncate">{label}</span>
|
|
172
|
-
{isExternal ?
|
|
172
|
+
{isExternal ? (
|
|
173
|
+
<>
|
|
174
|
+
<ExternalLinkIcon className="ml-auto size-3.5 opacity-70" />
|
|
175
|
+
<span className="sr-only">{tc('shellChrome.externalLink')}</span>
|
|
176
|
+
</>
|
|
177
|
+
) : null}
|
|
173
178
|
</>
|
|
174
179
|
);
|
|
175
180
|
|
|
@@ -225,8 +230,47 @@ export function FloatingSidebar({
|
|
|
225
230
|
|
|
226
231
|
return (
|
|
227
232
|
<>
|
|
233
|
+
{macStrip ? (
|
|
234
|
+
/*
|
|
235
|
+
* macOS collapsed: 32px strip over the content. Safe area 80, one glass group
|
|
236
|
+
* (expand, back, forward), then a drag spacer.
|
|
237
|
+
*/
|
|
238
|
+
<div
|
|
239
|
+
data-shellui-floating-sidebar="collapsed"
|
|
240
|
+
data-shellui-mac-strip=""
|
|
241
|
+
{...MAC_DRAG_REGION_PROPS}
|
|
242
|
+
className={cn(
|
|
243
|
+
'absolute inset-x-0 top-0 z-[46] flex items-center select-none',
|
|
244
|
+
collapsed ? 'opacity-100' : 'pointer-events-none opacity-0',
|
|
245
|
+
)}
|
|
246
|
+
style={{ height: DESKTOP_TITLEBAR_HEIGHT_PX, paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX }}
|
|
247
|
+
aria-hidden={!collapsed}
|
|
248
|
+
inert={!collapsed ? true : undefined}
|
|
249
|
+
>
|
|
250
|
+
<MacLightsSafeArea />
|
|
251
|
+
<div
|
|
252
|
+
data-shellui-no-drag=""
|
|
253
|
+
className="shellui-history-glass flex shrink-0 items-center text-sidebar-foreground"
|
|
254
|
+
>
|
|
255
|
+
<button
|
|
256
|
+
type="button"
|
|
257
|
+
tabIndex={collapsed ? 0 : -1}
|
|
258
|
+
className="shellui-floating-nav-control flex size-6 shrink-0 items-center justify-center transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
259
|
+
aria-label={toggleLabel}
|
|
260
|
+
aria-expanded={false}
|
|
261
|
+
onClick={onToggleCollapsed}
|
|
262
|
+
>
|
|
263
|
+
<SidebarPanelIcon className="size-4" />
|
|
264
|
+
</button>
|
|
265
|
+
{isTauriEnv ? <DesktopHistoryButtons strip /> : null}
|
|
266
|
+
</div>
|
|
267
|
+
<MacStripSpacer />
|
|
268
|
+
</div>
|
|
269
|
+
) : null}
|
|
270
|
+
|
|
228
271
|
{/* Collapsed expand chip — fades/scales in after the panel slides away. */}
|
|
229
272
|
<div
|
|
273
|
+
hidden={macStrip}
|
|
230
274
|
data-shellui-floating-sidebar="collapsed"
|
|
231
275
|
className={cn(
|
|
232
276
|
'shellui-floating-sidebar-chip pointer-events-none absolute top-0 left-0 z-[46] flex',
|
|
@@ -276,64 +320,94 @@ export function FloatingSidebar({
|
|
|
276
320
|
: 'translate-x-0 scale-100 opacity-100',
|
|
277
321
|
)}
|
|
278
322
|
style={{ width: FLOATING_SIDEBAR_WIDTH }}
|
|
279
|
-
aria-label={
|
|
323
|
+
aria-label={tc('shellChrome.mainNav')}
|
|
280
324
|
>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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 ? (
|
|
325
|
+
{macStrip ? (
|
|
326
|
+
<>
|
|
327
|
+
{/* macOS strip: safe 80, drag spacer, back, forward, collapse. */}
|
|
299
328
|
<div
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
329
|
+
data-shellui-mac-strip=""
|
|
330
|
+
{...MAC_DRAG_REGION_PROPS}
|
|
331
|
+
className="flex shrink-0 items-center pr-2"
|
|
332
|
+
style={{
|
|
333
|
+
height: DESKTOP_TITLEBAR_HEIGHT_PX,
|
|
334
|
+
paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
<MacLightsSafeArea />
|
|
338
|
+
<MacStripSpacer />
|
|
339
|
+
{isTauriEnv && !collapsed ? <DesktopHistoryButtons strip /> : null}
|
|
340
|
+
<button
|
|
341
|
+
type="button"
|
|
342
|
+
tabIndex={collapsed ? -1 : 0}
|
|
343
|
+
data-shellui-no-drag=""
|
|
344
|
+
className="shellui-floating-nav-control flex size-6 shrink-0 items-center justify-center text-sidebar-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
345
|
+
aria-label={toggleLabel}
|
|
346
|
+
aria-expanded={!collapsed}
|
|
347
|
+
onClick={onToggleCollapsed}
|
|
348
|
+
>
|
|
349
|
+
<SidebarPanelIcon className="size-4" />
|
|
350
|
+
</button>
|
|
351
|
+
</div>
|
|
352
|
+
{/* Brand row under the strip: not a drag region. */}
|
|
353
|
+
<div className="flex h-10 shrink-0 items-center gap-2 border-b border-sidebar-border/80 px-3 text-sidebar-foreground">
|
|
354
|
+
{appIcon ? (
|
|
355
|
+
<AppBrandIcon
|
|
356
|
+
appIcon={appIcon}
|
|
357
|
+
title={title}
|
|
358
|
+
className="size-5 shrink-0"
|
|
359
|
+
/>
|
|
360
|
+
) : null}
|
|
361
|
+
{title ? (
|
|
362
|
+
<span className="min-w-0 truncate text-[13px] font-semibold">{title}</span>
|
|
363
|
+
) : null}
|
|
364
|
+
</div>
|
|
365
|
+
</>
|
|
366
|
+
) : (
|
|
305
367
|
<div
|
|
306
|
-
className=
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
368
|
+
className={cn(
|
|
369
|
+
'flex shrink-0 items-center border-b border-sidebar-border/80',
|
|
370
|
+
tauriRuntime ? 'pr-2.5' : 'gap-2 px-2.5 py-2.5',
|
|
371
|
+
)}
|
|
372
|
+
style={
|
|
373
|
+
tauriRuntime
|
|
374
|
+
? {
|
|
375
|
+
height: SHELL_HEADER_HEIGHT_PX,
|
|
376
|
+
paddingTop: SHELL_HEADER_PAD_TOP_PX,
|
|
377
|
+
}
|
|
378
|
+
: undefined
|
|
379
|
+
}
|
|
380
|
+
{...(tauriRuntime ? MAC_DRAG_REGION_PROPS : {})}
|
|
310
381
|
>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
382
|
+
<div className="flex h-full min-w-0 flex-1 items-center gap-1">
|
|
383
|
+
{isTauriEnv && !collapsed ? (
|
|
384
|
+
<DesktopHistoryButtons className="self-center" />
|
|
385
|
+
) : null}
|
|
386
|
+
{appIcon ? (
|
|
387
|
+
<AppBrandIcon
|
|
388
|
+
appIcon={appIcon}
|
|
389
|
+
title={title}
|
|
390
|
+
className="size-7 shrink-0"
|
|
391
|
+
/>
|
|
392
|
+
) : null}
|
|
393
|
+
<span
|
|
394
|
+
className="min-h-full min-w-0 flex-1 self-stretch"
|
|
395
|
+
{...(tauriRuntime ? MAC_DRAG_REGION_PROPS : {})}
|
|
317
396
|
/>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
aria-expanded={!collapsed}
|
|
331
|
-
onClick={onToggleCollapsed}
|
|
332
|
-
>
|
|
333
|
-
<SidebarPanelIcon className="size-4" />
|
|
334
|
-
</button>
|
|
397
|
+
<button
|
|
398
|
+
type="button"
|
|
399
|
+
tabIndex={collapsed ? -1 : 0}
|
|
400
|
+
data-shellui-no-drag=""
|
|
401
|
+
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"
|
|
402
|
+
aria-label={toggleLabel}
|
|
403
|
+
aria-expanded={!collapsed}
|
|
404
|
+
onClick={onToggleCollapsed}
|
|
405
|
+
>
|
|
406
|
+
<SidebarPanelIcon className="size-4" />
|
|
407
|
+
</button>
|
|
408
|
+
</div>
|
|
335
409
|
</div>
|
|
336
|
-
|
|
410
|
+
)}
|
|
337
411
|
|
|
338
412
|
<div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-2">
|
|
339
413
|
{sections.map((section, sectionIndex) => {
|
|
@@ -345,7 +419,7 @@ export function FloatingSidebar({
|
|
|
345
419
|
className="flex flex-col gap-0.5"
|
|
346
420
|
>
|
|
347
421
|
<div
|
|
348
|
-
className="px-2.5 pb-1 text-
|
|
422
|
+
className="shellui-floating-nav-label px-2.5 pb-1 text-xs font-semibold"
|
|
349
423
|
style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
|
|
350
424
|
>
|
|
351
425
|
{groupTitle}
|