@shellui/core 0.6.2 → 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 +147 -70
- package/src/app.tsx +2 -0
- package/src/components/ContentView.tsx +21 -30
- package/src/components/iframeUrlSafety.spec.ts +67 -0
- package/src/components/iframeUrlSafety.ts +50 -0
- package/src/components/ui/sidebar.tsx +11 -5
- package/src/features/admin/AdminView.tsx +9 -6
- package/src/features/auth/AuthProvider.tsx +49 -5
- package/src/features/auth/appBackend/AppBackendSessionHost.tsx +58 -0
- package/src/features/auth/appBackend/appBackendSessions.spec.ts +329 -0
- package/src/features/auth/appBackend/appBackendSessions.ts +443 -0
- package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
- package/src/features/auth/appBackend/childFrames.ts +180 -0
- package/src/features/auth/appBackend/configSchema.spec.ts +41 -0
- package/src/features/auth/appBackend/frameAuth.ts +204 -0
- package/src/features/auth/appBackend/identity.spec.ts +201 -0
- package/src/features/auth/appBackend/identity.ts +173 -0
- package/src/features/auth/appBackend/silentSignIn.spec.ts +225 -0
- package/src/features/auth/appBackend/silentSignIn.ts +254 -0
- package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
- package/src/features/auth/appBackend/tokenExchange.ts +76 -0
- package/src/features/auth/backends/shellui.spec.ts +51 -19
- package/src/features/auth/backends/shellui.ts +20 -5
- package/src/features/auth/backends/types.ts +7 -2
- package/src/features/auth/components/LoginView.tsx +40 -18
- package/src/features/auth/components/OAuthCallbackView.tsx +33 -4
- package/src/features/auth/utils/authRequestError.ts +3 -0
- 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 +16 -1
- package/src/features/auth/utils/loginCancelTarget.spec.ts +73 -0
- package/src/features/auth/utils/loginCancelTarget.ts +45 -0
- package/src/features/auth/utils/loginPanelFrame.spec.ts +24 -0
- package/src/features/auth/utils/loginPanelFrame.ts +14 -0
- 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 +119 -0
- package/src/features/auth/utils/webPkce.ts +169 -0
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- package/src/features/config/types.ts +70 -3
- 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 +198 -29
- package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +379 -4
- package/src/features/settings/utils/buildSettingsForPropagation.ts +65 -39
- 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 +27 -0
- package/src/i18n/translations/fr/common.json +27 -0
- package/src/index.css +935 -46
- package/src/index.ts +2 -0
- package/src/routes/hooks/useNavigationItems.ts +14 -3
- package/src/routes/hooks/withShellSearch.spec.ts +13 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { act } from 'react';
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
4
|
+
import { MemoryRouter } from 'react-router';
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { SidebarProvider } from '../../../components/ui/sidebar';
|
|
7
|
+
import { CollapsedDesktopTitlebar } from './CollapsedDesktopTitlebar';
|
|
8
|
+
import { DesktopHistoryButtons } from './DesktopHistoryButtons';
|
|
9
|
+
import { MAC_DRAG_REGION_PROPS, MacLightsSafeArea, MacStripSpacer } from './MacStrip';
|
|
10
|
+
import { findSafeAreaControls, findStripDragLeaks } from './stripDragMap';
|
|
11
|
+
|
|
12
|
+
vi.mock('./runtime', async (importOriginal) => {
|
|
13
|
+
const actual = await importOriginal<typeof import('./runtime')>();
|
|
14
|
+
return {
|
|
15
|
+
...actual,
|
|
16
|
+
useMacOverlayChrome: () => true,
|
|
17
|
+
useMacTrafficLights: () => true,
|
|
18
|
+
useIsTauriClient: () => true,
|
|
19
|
+
useIsTauriRuntime: () => true,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
vi.mock('../../modal/ModalContext', () => ({ useModal: () => ({ isOpen: false }) }));
|
|
23
|
+
vi.mock('../../drawer/DrawerContext', () => ({ useDrawer: () => ({ isOpen: false }) }));
|
|
24
|
+
vi.mock('../../storage/StoragePickerContext', () => ({
|
|
25
|
+
useStoragePicker: () => ({ isOpen: false }),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
|
|
29
|
+
|
|
30
|
+
let container: HTMLDivElement;
|
|
31
|
+
let root: Root;
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
container = document.createElement('div');
|
|
35
|
+
document.body.appendChild(container);
|
|
36
|
+
root = createRoot(container);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
act(() => root.unmount());
|
|
41
|
+
container.remove();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function getStrip(): Element {
|
|
45
|
+
const strip = container.querySelector('[data-shellui-mac-strip]');
|
|
46
|
+
if (!strip) throw new Error('strip not rendered');
|
|
47
|
+
return strip;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function render(node: React.ReactNode) {
|
|
51
|
+
act(() => {
|
|
52
|
+
root.render(<MemoryRouter>{node}</MemoryRouter>);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
describe('macOS strip drag map', () => {
|
|
57
|
+
it('collapsed sidebar strip: every control is no-drag, the safe area holds none', () => {
|
|
58
|
+
render(
|
|
59
|
+
<SidebarProvider defaultOpen={false}>
|
|
60
|
+
<CollapsedDesktopTitlebar />
|
|
61
|
+
</SidebarProvider>,
|
|
62
|
+
);
|
|
63
|
+
const strip = getStrip();
|
|
64
|
+
expect(strip.hasAttribute('data-tauri-drag-region')).toBe(true);
|
|
65
|
+
// Expand trigger, Back, Forward.
|
|
66
|
+
expect(strip.querySelectorAll('button').length).toBe(3);
|
|
67
|
+
expect(findStripDragLeaks(strip)).toEqual([]);
|
|
68
|
+
expect(findSafeAreaControls(strip)).toEqual([]);
|
|
69
|
+
const safe = strip.firstElementChild;
|
|
70
|
+
if (!safe) throw new Error('safe area missing');
|
|
71
|
+
expect(safe.hasAttribute('data-shellui-mac-safe')).toBe(true);
|
|
72
|
+
expect(safe.hasAttribute('data-tauri-drag-region')).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('history buttons in a strip carry no-drag', () => {
|
|
76
|
+
render(
|
|
77
|
+
<div
|
|
78
|
+
data-shellui-mac-strip=""
|
|
79
|
+
{...MAC_DRAG_REGION_PROPS}
|
|
80
|
+
>
|
|
81
|
+
<MacLightsSafeArea />
|
|
82
|
+
<DesktopHistoryButtons strip />
|
|
83
|
+
<MacStripSpacer />
|
|
84
|
+
</div>,
|
|
85
|
+
);
|
|
86
|
+
const strip = getStrip();
|
|
87
|
+
expect(strip.querySelectorAll('button').length).toBe(2);
|
|
88
|
+
expect(findStripDragLeaks(strip)).toEqual([]);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('flags a control without no-drag, one marked as drag, and one in the safe area', () => {
|
|
92
|
+
container.innerHTML = `
|
|
93
|
+
<div data-shellui-mac-strip data-tauri-drag-region>
|
|
94
|
+
<div data-shellui-mac-safe data-tauri-drag-region><button id="in-safe" data-shellui-no-drag></button></div>
|
|
95
|
+
<button id="bare"></button>
|
|
96
|
+
<a id="drag-link" href="/x" data-shellui-no-drag data-tauri-drag-region></a>
|
|
97
|
+
<div data-shellui-no-drag><button id="ok"></button></div>
|
|
98
|
+
</div>`;
|
|
99
|
+
const strip = getStrip();
|
|
100
|
+
expect(findStripDragLeaks(strip).map((el) => el.id)).toEqual(['bare', 'drag-link']);
|
|
101
|
+
expect(findSafeAreaControls(strip).map((el) => el.id)).toEqual(['in-safe']);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { resolveViewport } from '../../../hooks/use-viewport';
|
|
12
12
|
import { publishLayoutChrome } from '../floating/layoutChromeStore';
|
|
13
13
|
import { readShellSafeAreaPx } from '../floating/computeFloatingInsets';
|
|
14
|
-
import {
|
|
14
|
+
import { SHELL_HEADER_HEIGHT_PX } from './constants';
|
|
15
15
|
|
|
16
16
|
export type ScrollHideLayoutId = 'sidebar' | 'sidebar-inset' | 'app-bar' | 'app-bar-inset';
|
|
17
17
|
|
|
@@ -32,7 +32,7 @@ export function mobileShellHeaderHeightPx(options?: {
|
|
|
32
32
|
includeSafeArea?: boolean;
|
|
33
33
|
barHeightPx?: number;
|
|
34
34
|
}): number {
|
|
35
|
-
const bar = options?.barHeightPx ??
|
|
35
|
+
const bar = options?.barHeightPx ?? SHELL_HEADER_HEIGHT_PX;
|
|
36
36
|
if (options?.includeSafeArea === false) return bar;
|
|
37
37
|
const safe = typeof document !== 'undefined' ? readShellSafeAreaPx().top : 0;
|
|
38
38
|
return bar + safe;
|
|
@@ -78,12 +78,7 @@ export function useScrollHideChrome(options: {
|
|
|
78
78
|
/** When true (root shell), include safe-area-top in the header band height. */
|
|
79
79
|
includeSafeArea?: boolean;
|
|
80
80
|
}) {
|
|
81
|
-
const {
|
|
82
|
-
enabled,
|
|
83
|
-
layout,
|
|
84
|
-
barHeightPx = DESKTOP_TITLEBAR_HEIGHT_PX,
|
|
85
|
-
includeSafeArea = true,
|
|
86
|
-
} = options;
|
|
81
|
+
const { enabled, layout, barHeightPx = SHELL_HEADER_HEIGHT_PX, includeSafeArea = true } = options;
|
|
87
82
|
const location = useLocation();
|
|
88
83
|
const [chromeVisible, setChromeVisible] = useState(true);
|
|
89
84
|
const scrollStateRef = useRef<ScrollChromeState>({ visible: true, lastY: 0 });
|
|
@@ -32,10 +32,12 @@ describe('filterNavigationForAuthState', () => {
|
|
|
32
32
|
]);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it('hides login
|
|
35
|
+
it('hides login entries but keeps logged-in entries while the session restore is loading', () => {
|
|
36
36
|
expect(
|
|
37
37
|
paths(filterNavigationForAuthState([home, login, dashboard], false, false, true)),
|
|
38
|
-
).toEqual(['']);
|
|
39
|
-
expect(filterNavigationForAuthState([accountGroup], false, false, true)).toEqual([
|
|
38
|
+
).toEqual(['', 'dashboard']);
|
|
39
|
+
expect(paths(filterNavigationForAuthState([accountGroup], false, false, true))).toEqual([
|
|
40
|
+
'dashboard',
|
|
41
|
+
]);
|
|
40
42
|
});
|
|
41
43
|
});
|
|
@@ -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': '' }
|