@shellui/core 0.7.0-alpha.1 → 0.7.0-alpha.11
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/drawer.tsx +47 -30
- package/src/components/ui/sheet.tsx +18 -12
- package/src/components/ui/sidebar.tsx +25 -11
- package/src/components/ui/tooltip.tsx +4 -2
- 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/LoginButton.spec.tsx +155 -0
- package/src/features/auth/components/LoginButton.tsx +52 -27
- package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
- 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/ChromeActionsHost.tsx +5 -1
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- package/src/features/config/types.ts +30 -4
- package/src/features/layouts/OverlayShell.tsx +58 -40
- package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
- package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
- package/src/features/layouts/appbar/AppBarLayout.tsx +115 -110
- package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
- package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +13 -24
- 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 +36 -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/chrome/viewport.ts +11 -4
- package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
- package/src/features/layouts/floating/FloatingBottomDock.tsx +263 -43
- package/src/features/layouts/floating/FloatingLayout.tsx +14 -8
- package/src/features/layouts/floating/FloatingSidebar.tsx +165 -73
- package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
- package/src/features/layouts/floating/moreSections.spec.ts +28 -0
- package/src/features/layouts/floating/moreSections.ts +31 -0
- 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.spec.tsx +68 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +47 -10
- package/src/features/layouts/sidebar/NavigationContent.tsx +17 -9
- package/src/features/layouts/sidebar/SidebarIcons.tsx +70 -9
- package/src/features/layouts/sidebar/SidebarInner.spec.tsx +109 -0
- package/src/features/layouts/sidebar/SidebarInner.tsx +94 -43
- package/src/features/layouts/sidebar/SidebarLayout.tsx +24 -17
- package/src/features/layouts/utils.ts +4 -3
- package/src/features/layouts/windows/DesktopDots.tsx +76 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +251 -161
- package/src/features/layouts/windows/deskDots.spec.ts +54 -0
- package/src/features/layouts/windows/deskDots.ts +314 -0
- package/src/features/overlays/ResponsiveModal.tsx +5 -3
- package/src/features/overlays/overlaySize.spec.ts +56 -16
- package/src/features/overlays/overlaySize.ts +114 -31
- package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
- package/src/features/overlays/useOverlayReportedSize.ts +8 -3
- 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 +26 -0
- package/src/i18n/translations/fr/common.json +26 -0
- package/src/index.css +1145 -77
- package/src/index.ts +1 -0
- package/src/routes/hooks/useNavigationItems.ts +14 -3
- package/src/routes/hooks/withShellSearch.spec.ts +13 -0
- package/src/service-worker/devCaches.spec.ts +32 -0
- package/src/service-worker/devCaches.ts +27 -0
- package/src/service-worker/sw-dev.ts +23 -23
|
@@ -36,12 +36,7 @@ import {
|
|
|
36
36
|
import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
|
|
37
37
|
import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
|
|
38
38
|
import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
|
|
39
|
-
import {
|
|
40
|
-
MAC_TRAFFIC_LIGHTS_GAP_PX,
|
|
41
|
-
MAC_TRAFFIC_LIGHTS_WIDTH_PX,
|
|
42
|
-
DESKTOP_TITLEBAR_HEIGHT_PX,
|
|
43
|
-
DESKTOP_TITLEBAR_PAD_TOP_PX,
|
|
44
|
-
} from '../chrome/constants';
|
|
39
|
+
import { MAC_LIGHTS_SAFE_PX, MOBILE_SIDEBAR_HEADER_HEIGHT_PX } from '../chrome/constants';
|
|
45
40
|
import { WindowTitleBarActions } from '../../chromeActions';
|
|
46
41
|
import { cn } from '../../../lib/utils';
|
|
47
42
|
|
|
@@ -100,15 +95,14 @@ const SidebarLayoutContent = ({
|
|
|
100
95
|
const isMobile = useIsMobile();
|
|
101
96
|
const isTauriEnv = useIsTauriClient();
|
|
102
97
|
const trafficLights = useMacTrafficLights();
|
|
103
|
-
const mobileTrafficInset = trafficLights
|
|
104
|
-
? MAC_TRAFFIC_LIGHTS_WIDTH_PX + MAC_TRAFFIC_LIGHTS_GAP_PX
|
|
105
|
-
: undefined;
|
|
98
|
+
const mobileTrafficInset = trafficLights ? MAC_LIGHTS_SAFE_PX : undefined;
|
|
106
99
|
// Nested shell-in-iframe must not repeat the root safe-area top band.
|
|
107
100
|
const showSafeAreaTopbar = isShellUiRootWindow();
|
|
108
101
|
const scrollHideLayout = variant === 'inset' ? 'sidebar-inset' : 'sidebar';
|
|
109
102
|
const { chromeVisible } = useScrollHideChrome({
|
|
110
103
|
enabled: isMobile,
|
|
111
104
|
layout: scrollHideLayout,
|
|
105
|
+
barHeightPx: MOBILE_SIDEBAR_HEADER_HEIGHT_PX,
|
|
112
106
|
includeSafeArea: showSafeAreaTopbar,
|
|
113
107
|
});
|
|
114
108
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
@@ -161,6 +155,10 @@ const SidebarLayoutContent = ({
|
|
|
161
155
|
};
|
|
162
156
|
}, [authAwareNavigation, isMobile]);
|
|
163
157
|
|
|
158
|
+
const pageTitle = navigationItem
|
|
159
|
+
? resolveLocalizedLabel(navigationItem.label, currentLanguage)
|
|
160
|
+
: title;
|
|
161
|
+
|
|
164
162
|
useEffect(() => {
|
|
165
163
|
if (!title) return;
|
|
166
164
|
if (navigationItem) {
|
|
@@ -236,18 +234,16 @@ const SidebarLayoutContent = ({
|
|
|
236
234
|
<header
|
|
237
235
|
data-shellui-scroll-hide-header=""
|
|
238
236
|
className={cn(
|
|
239
|
-
'pointer-events-auto relative z-[1] flex items-center gap-0.5 px-
|
|
237
|
+
'pointer-events-auto relative z-[1] flex items-center gap-0.5 px-1.5 select-none',
|
|
240
238
|
variant === 'inset'
|
|
241
239
|
? 'border-transparent bg-transparent text-sidebar-foreground'
|
|
242
240
|
: 'border-b border-border bg-background',
|
|
243
241
|
)}
|
|
244
242
|
style={{
|
|
245
|
-
paddingTop: showSafeAreaTopbar
|
|
246
|
-
? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
|
|
247
|
-
: DESKTOP_TITLEBAR_PAD_TOP_PX,
|
|
243
|
+
paddingTop: showSafeAreaTopbar ? 'var(--shellui-safe-area-top)' : 0,
|
|
248
244
|
height: showSafeAreaTopbar
|
|
249
|
-
? `calc(${
|
|
250
|
-
:
|
|
245
|
+
? `calc(${MOBILE_SIDEBAR_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`
|
|
246
|
+
: MOBILE_SIDEBAR_HEADER_HEIGHT_PX,
|
|
251
247
|
...(mobileTrafficInset !== undefined ? { paddingLeft: mobileTrafficInset } : {}),
|
|
252
248
|
}}
|
|
253
249
|
{...(trafficLights
|
|
@@ -256,7 +252,7 @@ const SidebarLayoutContent = ({
|
|
|
256
252
|
>
|
|
257
253
|
<SidebarTrigger
|
|
258
254
|
data-shellui-no-drag=""
|
|
259
|
-
className="relative size-
|
|
255
|
+
className="relative size-10 shrink-0 touch-manipulation text-foreground [&_svg]:size-5"
|
|
260
256
|
/>
|
|
261
257
|
{isTauriEnv ? <DesktopHistoryButtons /> : null}
|
|
262
258
|
{isMobile ? (
|
|
@@ -264,9 +260,20 @@ const SidebarLayoutContent = ({
|
|
|
264
260
|
data-shellui-no-drag=""
|
|
265
261
|
className="flex min-w-0 flex-1 items-center"
|
|
266
262
|
>
|
|
267
|
-
<WindowTitleBarActions
|
|
263
|
+
<WindowTitleBarActions
|
|
264
|
+
frameUuid={frameUuid}
|
|
265
|
+
fallbackTitle={pageTitle}
|
|
266
|
+
centerTitle
|
|
267
|
+
/>
|
|
268
268
|
</div>
|
|
269
269
|
) : null}
|
|
270
|
+
{/* Balances the trigger so the title sits in the middle. */}
|
|
271
|
+
{isMobile && !isTauriEnv ? (
|
|
272
|
+
<span
|
|
273
|
+
aria-hidden
|
|
274
|
+
className="size-10 shrink-0"
|
|
275
|
+
/>
|
|
276
|
+
) : null}
|
|
270
277
|
</header>
|
|
271
278
|
{variant === 'inset' ? <InsetMobileRadiusOverlay /> : null}
|
|
272
279
|
</div>
|
|
@@ -227,7 +227,8 @@ export function hasLoginNavigationItem(navigation: (NavigationItem | NavigationG
|
|
|
227
227
|
* Hide login navigation entries only when authenticated, so custom login entries
|
|
228
228
|
* can still be used while signed out (e.g. open login in modal/drawer).
|
|
229
229
|
* While the initial session restore runs (`isAuthLoading`), login entries are hidden too:
|
|
230
|
-
* the account skeleton takes their place until the auth state is known.
|
|
230
|
+
* the account skeleton takes their place until the auth state is known. Logged-in only entries
|
|
231
|
+
* stay visible during the restore so the navigation does not pop in after a reload.
|
|
231
232
|
*/
|
|
232
233
|
export function filterNavigationForAuthState(
|
|
233
234
|
navigation: (NavigationItem | NavigationGroup)[],
|
|
@@ -242,7 +243,7 @@ export function filterNavigationForAuthState(
|
|
|
242
243
|
if ('title' in item && 'items' in item) {
|
|
243
244
|
const group = item as NavigationGroup;
|
|
244
245
|
const visibleItems = group.items.filter((navItem) => {
|
|
245
|
-
if (navItem.hideWhenLoggedOut && !isAuthenticated) return false;
|
|
246
|
+
if (navItem.hideWhenLoggedOut && !isAuthenticated && !isAuthLoading) return false;
|
|
246
247
|
if (navItem.requiresDevMode && !isDevModeEnabled) return false;
|
|
247
248
|
if (hideLoginEntries && isLoginNavigationUrl(navItem.url)) return false;
|
|
248
249
|
return true;
|
|
@@ -251,7 +252,7 @@ export function filterNavigationForAuthState(
|
|
|
251
252
|
return { ...group, items: visibleItems };
|
|
252
253
|
}
|
|
253
254
|
const navItem = item as NavigationItem;
|
|
254
|
-
if (navItem.hideWhenLoggedOut && !isAuthenticated) return null;
|
|
255
|
+
if (navItem.hideWhenLoggedOut && !isAuthenticated && !isAuthLoading) return null;
|
|
255
256
|
if (navItem.requiresDevMode && !isDevModeEnabled) return null;
|
|
256
257
|
if (hideLoginEntries && isLoginNavigationUrl(navItem.url)) return null;
|
|
257
258
|
return item;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { mountDeskDots, type DeskDotsHandle } from './deskDots';
|
|
3
|
+
|
|
4
|
+
/** Window attributes the field watches to pause itself. */
|
|
5
|
+
const WATCHED_ATTRS = ['data-maximized', 'data-focused', 'data-interacting'];
|
|
6
|
+
|
|
7
|
+
/** True when a focused window fills the desktop or any window is dragged or resized. */
|
|
8
|
+
export function isDesktopCovered(root: ParentNode): boolean {
|
|
9
|
+
return Boolean(
|
|
10
|
+
root.querySelector(
|
|
11
|
+
'[data-shellui-window][data-focused="true"][data-maximized="true"], [data-shellui-window][data-interacting="true"]',
|
|
12
|
+
),
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Calm dot field behind the windows. Canvas while motion is allowed; a static CSS
|
|
18
|
+
* grid (`[data-shellui-desk-dots]::before`) under `prefers-reduced-motion`.
|
|
19
|
+
* Pauses when the tab is hidden, while the desktop is covered, and during drags.
|
|
20
|
+
*/
|
|
21
|
+
export function DesktopDots({ watchRoot }: { watchRoot: React.RefObject<HTMLElement | null> }) {
|
|
22
|
+
const hostRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const host = hostRef.current;
|
|
26
|
+
if (!host || typeof window === 'undefined') return;
|
|
27
|
+
const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)');
|
|
28
|
+
let dots: DeskDotsHandle | null = null;
|
|
29
|
+
let observer: MutationObserver | null = null;
|
|
30
|
+
|
|
31
|
+
const syncPause = () => {
|
|
32
|
+
const root = watchRoot.current;
|
|
33
|
+
dots?.pause(root ? isDesktopCovered(root) : false);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const start = () => {
|
|
37
|
+
if (dots || reduce?.matches) return;
|
|
38
|
+
dots = mountDeskDots(host);
|
|
39
|
+
const root = watchRoot.current;
|
|
40
|
+
if (root) {
|
|
41
|
+
observer = new MutationObserver(syncPause);
|
|
42
|
+
observer.observe(root, {
|
|
43
|
+
subtree: true,
|
|
44
|
+
childList: true,
|
|
45
|
+
attributes: true,
|
|
46
|
+
attributeFilter: WATCHED_ATTRS,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
syncPause();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const stop = () => {
|
|
53
|
+
observer?.disconnect();
|
|
54
|
+
observer = null;
|
|
55
|
+
dots?.destroy();
|
|
56
|
+
dots = null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onReduceChange = () => (reduce?.matches ? stop() : start());
|
|
60
|
+
reduce?.addEventListener?.('change', onReduceChange);
|
|
61
|
+
start();
|
|
62
|
+
return () => {
|
|
63
|
+
reduce?.removeEventListener?.('change', onReduceChange);
|
|
64
|
+
stop();
|
|
65
|
+
};
|
|
66
|
+
}, [watchRoot]);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
ref={hostRef}
|
|
71
|
+
aria-hidden
|
|
72
|
+
data-shellui-desk-dots=""
|
|
73
|
+
className="pointer-events-none absolute inset-0"
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|