@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.
Files changed (94) hide show
  1. package/package.json +2 -2
  2. package/schemas/shellui.config.schema.json +37 -4
  3. package/src/components/ContentView.tsx +19 -8
  4. package/src/components/ui/drawer.tsx +47 -30
  5. package/src/components/ui/sheet.tsx +18 -12
  6. package/src/components/ui/sidebar.tsx +25 -11
  7. package/src/components/ui/tooltip.tsx +4 -2
  8. package/src/features/admin/AdminView.tsx +9 -6
  9. package/src/features/auth/AuthProvider.tsx +25 -4
  10. package/src/features/auth/appBackend/appBackendSessions.spec.ts +134 -0
  11. package/src/features/auth/appBackend/appBackendSessions.ts +168 -17
  12. package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
  13. package/src/features/auth/appBackend/childFrames.ts +180 -0
  14. package/src/features/auth/appBackend/frameAuth.ts +47 -10
  15. package/src/features/auth/appBackend/silentSignIn.spec.ts +18 -0
  16. package/src/features/auth/appBackend/silentSignIn.ts +15 -1
  17. package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
  18. package/src/features/auth/appBackend/tokenExchange.ts +76 -0
  19. package/src/features/auth/components/LoginButton.spec.tsx +155 -0
  20. package/src/features/auth/components/LoginButton.tsx +52 -27
  21. package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
  22. package/src/features/auth/components/OAuthCallbackView.tsx +7 -5
  23. package/src/features/auth/utils/buildOAuthSessionRedirectTo.spec.ts +42 -1
  24. package/src/features/auth/utils/buildOAuthSessionRedirectTo.ts +23 -0
  25. package/src/features/auth/utils/canRestoreStoredSession.spec.ts +29 -0
  26. package/src/features/auth/utils/canRestoreStoredSession.ts +12 -0
  27. package/src/features/auth/utils/index.ts +7 -1
  28. package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
  29. package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
  30. package/src/features/auth/utils/webPkce.spec.ts +23 -0
  31. package/src/features/auth/utils/webPkce.ts +23 -6
  32. package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
  33. package/src/features/chromeActions/computeActionInsets.ts +7 -4
  34. package/src/features/config/types.ts +30 -4
  35. package/src/features/layouts/OverlayShell.tsx +58 -40
  36. package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
  37. package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
  38. package/src/features/layouts/appbar/AppBarLayout.tsx +115 -110
  39. package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
  40. package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
  41. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +13 -24
  42. package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
  43. package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
  44. package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
  45. package/src/features/layouts/chrome/MacStrip.tsx +33 -0
  46. package/src/features/layouts/chrome/constants.ts +36 -8
  47. package/src/features/layouts/chrome/index.ts +8 -0
  48. package/src/features/layouts/chrome/stripDragMap.ts +35 -0
  49. package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
  50. package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
  51. package/src/features/layouts/chrome/viewport.ts +11 -4
  52. package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
  53. package/src/features/layouts/floating/FloatingBottomDock.tsx +263 -43
  54. package/src/features/layouts/floating/FloatingLayout.tsx +14 -8
  55. package/src/features/layouts/floating/FloatingSidebar.tsx +165 -73
  56. package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
  57. package/src/features/layouts/floating/moreSections.spec.ts +28 -0
  58. package/src/features/layouts/floating/moreSections.ts +31 -0
  59. package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
  60. package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
  61. package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
  62. package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
  63. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +47 -10
  64. package/src/features/layouts/sidebar/NavigationContent.tsx +17 -9
  65. package/src/features/layouts/sidebar/SidebarIcons.tsx +70 -9
  66. package/src/features/layouts/sidebar/SidebarInner.spec.tsx +109 -0
  67. package/src/features/layouts/sidebar/SidebarInner.tsx +94 -43
  68. package/src/features/layouts/sidebar/SidebarLayout.tsx +24 -17
  69. package/src/features/layouts/utils.ts +4 -3
  70. package/src/features/layouts/windows/DesktopDots.tsx +76 -0
  71. package/src/features/layouts/windows/WindowsLayout.tsx +251 -161
  72. package/src/features/layouts/windows/deskDots.spec.ts +54 -0
  73. package/src/features/layouts/windows/deskDots.ts +314 -0
  74. package/src/features/overlays/ResponsiveModal.tsx +5 -3
  75. package/src/features/overlays/overlaySize.spec.ts +56 -16
  76. package/src/features/overlays/overlaySize.ts +114 -31
  77. package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
  78. package/src/features/overlays/useOverlayReportedSize.ts +8 -3
  79. package/src/features/settings/SettingsProvider.tsx +158 -2
  80. package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +8 -7
  81. package/src/features/settings/utils/buildSettingsForPropagation.ts +4 -6
  82. package/src/features/theme/applyTheme.ts +8 -0
  83. package/src/features/theme/navContrast.spec.ts +49 -0
  84. package/src/features/theme/navContrast.ts +108 -0
  85. package/src/features/transfers/transferQueue.spec.ts +6 -2
  86. package/src/i18n/translations/en/common.json +26 -0
  87. package/src/i18n/translations/fr/common.json +26 -0
  88. package/src/index.css +1145 -77
  89. package/src/index.ts +1 -0
  90. package/src/routes/hooks/useNavigationItems.ts +14 -3
  91. package/src/routes/hooks/withShellSearch.spec.ts +13 -0
  92. package/src/service-worker/devCaches.spec.ts +32 -0
  93. package/src/service-worker/devCaches.ts +27 -0
  94. package/src/service-worker/sw-dev.ts +23 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/core",
3
- "version": "0.7.0-alpha.1",
3
+ "version": "0.7.0-alpha.11",
4
4
  "description": "Shellui Core - Core React application runtime",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "workbox-routing": "^7.4.0",
74
74
  "workbox-strategies": "^7.4.0",
75
75
  "workbox-window": "^7.4.0",
76
- "@shellui/sdk": "0.7.0-alpha.1"
76
+ "@shellui/sdk": "0.7.0-alpha.11"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "react": "^18.0.0 || ^19.0.0",
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "email": {
81
81
  "$ref": "#/definitions/EmailConfig",
82
- "description": "Email-service connection. Propagated to iframes via SDK settings. When `email` is set and `url` is omitted, the shell sends `https://email.shellui.com`. `showInAdmin: false` hides Admin → Email."
82
+ "description": "Email-service connection. Propagated to iframes via SDK settings. Without `url`, the shell sends no email service (`null`). `showInAdmin: false` hides Admin → Email."
83
83
  },
84
84
  "theme": {
85
85
  "$ref": "#/definitions/ThemeRef",
@@ -260,6 +260,10 @@
260
260
  "$ref": "#/definitions/AppBackendConfig",
261
261
  "description": "Identity server for this embedded app when it is not the shell `backend`. The shell keeps a separate session and sends this URL plus that session's access token. Omit to use the shell backend and token. The shell token is never sent when this server differs."
262
262
  },
263
+ "childFrames": {
264
+ "$ref": "#/definitions/ChildFramesConfig",
265
+ "description": "Lets this app host other Shellui apps in its own iframes (`createAppFrame`). Off when omitted. Only exact origins listed here are accepted."
266
+ },
263
267
  "email": {
264
268
  "$ref": "#/definitions/EmailConfig",
265
269
  "description": "Email service for this app. Omit to use the shell `email` when the app uses the shell identity server. When `backend` names a different server and this is omitted, the app receives no email URL."
@@ -324,7 +328,7 @@
324
328
  },
325
329
  "provider": {
326
330
  "type": "string",
327
- "description": "OAuth provider for silent sign-in, such as `google`. When omitted, the shell uses the first `backend.login.oauthProviders` entry."
331
+ "description": "`upstream`: the shell gets the app session by OAuth token exchange (RFC 8693), trading its own access token at this server. Recommended for Shellui regions. Any other value, such as `google`, is the OAuth provider for silent sign-in. When omitted, the shell uses the first `backend.login.oauthProviders` entry."
328
332
  }
329
333
  },
330
334
  "required": ["url"],
@@ -336,12 +340,41 @@
336
340
  "enum": ["shellui", "supabase"],
337
341
  "description": "Supported backend providers for auth/API communication."
338
342
  },
343
+ "ChildFramesConfig": {
344
+ "type": "object",
345
+ "properties": {
346
+ "origins": {
347
+ "type": "array",
348
+ "items": {
349
+ "type": "string"
350
+ },
351
+ "description": "Exact origins of child apps, such as `https://admin.shellui.com`. No wildcards."
352
+ },
353
+ "backendOrigins": {
354
+ "type": "array",
355
+ "items": {
356
+ "type": "string"
357
+ },
358
+ "description": "Exact origins of identity servers a child may sign in to, such as `https://id.eu.shellui.com`. The shell keeps a separate session per server and never sends its own token to a child. Omit to give children no token."
359
+ },
360
+ "serviceOrigins": {
361
+ "type": "array",
362
+ "items": {
363
+ "type": "string"
364
+ },
365
+ "description": "Exact origins of service URLs (email, storage, files, hosting) a host may pass to a child with `ShelluiFrame` or `createAppFrame`, such as `https://storage.eu.shellui.com`. No wildcards. A URL outside this list, or a missing one, reaches the child as `null`. Omit to send children no service URLs."
366
+ }
367
+ },
368
+ "required": ["origins"],
369
+ "additionalProperties": false,
370
+ "description": "Child apps an embedded app may host, and the identity servers they may use."
371
+ },
339
372
  "EmailConfig": {
340
373
  "type": "object",
341
374
  "properties": {
342
375
  "url": {
343
376
  "type": "string",
344
- "description": "Base URL of email-service. Default: `https://email.shellui.com` when `email` is set and this is omitted. Local: `http://localhost:8003`."
377
+ "description": "Base URL of email-service. Required for apps to get email. There is no built-in default. Local: `http://localhost:8003`."
345
378
  },
346
379
  "showInAdmin": {
347
380
  "type": "boolean",
@@ -349,7 +382,7 @@
349
382
  }
350
383
  },
351
384
  "additionalProperties": false,
352
- "description": "Optional email-service wiring for Admin → Email and iframe apps. When `email` is set and `url` is omitted, the shell uses `https://email.shellui.com`."
385
+ "description": "Optional email-service wiring for Admin → Email and iframe apps. The shell never invents a URL: without `url`, apps get no email service."
353
386
  },
354
387
  "StorageConfig": {
355
388
  "type": "object",
@@ -73,8 +73,10 @@ export const ContentView = ({
73
73
  const iframeRef = useRef<HTMLIFrameElement>(null);
74
74
  const cancelRevealRef = useRef<(() => void) | null>(null);
75
75
  const mountTimeRef = useRef(Date.now());
76
- /** Shell path last reported by the iframe — skip driving iframe when we caused the location change. */
76
+ /** Shell path last synced with the iframe. */
77
77
  const lastShellPathFromIframeRef = useRef<string | null>(null);
78
+ /** Iframe reports not rendered back yet: their echo must not drive the iframe. */
79
+ const pendingFromIframeRef = useRef<string[]>([]);
78
80
  const skipInitialShellSyncRef = useRef(true);
79
81
  const prevNavPathRef = useRef(navItem?.path ?? '');
80
82
 
@@ -119,9 +121,16 @@ export const ContentView = ({
119
121
  return;
120
122
  }
121
123
 
124
+ const echo = pendingFromIframeRef.current.indexOf(currentShellPath);
125
+ if (echo >= 0 && !navItemChanged) {
126
+ pendingFromIframeRef.current = pendingFromIframeRef.current.slice(echo + 1);
127
+ lastShellPathFromIframeRef.current = currentShellPath;
128
+ return;
129
+ }
122
130
  if (lastShellPathFromIframeRef.current === currentShellPath && !navItemChanged) {
123
131
  return;
124
132
  }
133
+ pendingFromIframeRef.current = [];
125
134
 
126
135
  lastShellPathFromIframeRef.current = currentShellPath;
127
136
  mountTimeRef.current = Date.now();
@@ -173,7 +182,7 @@ export const ContentView = ({
173
182
  return;
174
183
  }
175
184
 
176
- const { pathname, search, hash } = data.payload as ShellUIUrlPayload;
185
+ const { pathname, search, hash, replace } = data.payload as ShellUIUrlPayload;
177
186
  // Shell URL is always path + search only (no hash) so it's transparent whether the sub-app uses hash routing or not
178
187
  let pathSegment: string;
179
188
  if (isHashRouterNavItem(navItem) && hash) {
@@ -223,17 +232,19 @@ export const ContentView = ({
223
232
  const normalizedNewPathname = newPathParts?.[1]?.replace(/\/+$/, '') || '/';
224
233
  const normalizedNewPath = normalizedNewPathname + (newPathParts?.[2] || '');
225
234
 
226
- // Mark before navigate so the shell-sync effect does not reload the iframe
227
- lastShellPathFromIframeRef.current = normalizedNewPath;
228
-
229
235
  if (currentPath !== normalizedNewPath) {
230
236
  if (!isSafeShellPath(normalizedNewPath)) {
231
237
  logger.warn('ContentView: refused unsafe shell path from iframe', normalizedNewPath);
232
238
  return;
233
239
  }
234
- // Push — iframe pushState is replace-only when embedded, so the shell
235
- // is the sole owner of back/forward entries.
236
- navigate(newShellPath);
240
+ // Mark before navigate so the shell-sync effect does not drive the iframe back.
241
+ pendingFromIframeRef.current = [
242
+ ...pendingFromIframeRef.current.slice(-19),
243
+ normalizedNewPath,
244
+ ];
245
+ // Iframe pushState is replace-only when embedded, so the shell owns back and
246
+ // forward. A child redirect replaces, so it never adds an entry.
247
+ navigate(newShellPath, { replace: replace === true });
237
248
  }
238
249
  },
239
250
  );
@@ -17,11 +17,13 @@ import {
17
17
  import { Drawer as VaulDrawer } from 'vaul';
18
18
  import { cn } from '../../lib/utils';
19
19
  import { Z_INDEX } from '../../lib/z-index';
20
+ import { readCssLengthPx } from '../../features/layouts/chrome/viewport';
20
21
 
21
22
  export type DrawerDirection = 'top' | 'bottom' | 'left' | 'right';
22
23
 
23
24
  const MIN_DRAWER_SIZE = 240;
24
- const VIEWPORT_MARGIN = 8;
25
+ /** Fallback edge offset (desktop gap) when the CSS token cannot be read. */
26
+ const FALLBACK_DRAWER_OFFSET_PX = 12;
25
27
 
26
28
  const Drawer = ({
27
29
  open,
@@ -65,7 +67,7 @@ const DrawerOverlay = forwardRef<
65
67
  <VaulDrawer.Overlay
66
68
  ref={ref}
67
69
  data-drawer-overlay
68
- className={cn('fixed inset-0 bg-black/50 backdrop-blur-[1px]', className)}
70
+ className={cn('fixed inset-0 bg-[var(--shellui-scrim)]', className)}
69
71
  style={{ zIndex: Z_INDEX.DRAWER_OVERLAY }}
70
72
  onClick={(e) => {
71
73
  if (!closeOnClick) {
@@ -80,42 +82,53 @@ const DrawerOverlay = forwardRef<
80
82
  ));
81
83
  DrawerOverlay.displayName = VaulDrawer.Overlay.displayName;
82
84
 
83
- /** Base layout classes per direction — max dimension is applied via style so size prop can override. */
85
+ /**
86
+ * Floating panel: a gap away from the window edge on its outer sides (the offsets
87
+ * include the safe area), all corners rounded, hairline border and soft shadow.
88
+ */
89
+ const drawerPanel =
90
+ 'fixed flex flex-col overflow-clip border border-[var(--shellui-drawer-border)] bg-background rounded-[var(--shellui-drawer-radius)] shadow-[var(--shellui-drawer-shadow)]';
91
+
92
+ /** Base layout classes per direction. Max dimension is applied via style so size prop can override. */
84
93
  const drawerContentByDirection: Record<DrawerDirection, string> = {
85
- bottom:
86
- 'fixed inset-x-0 bottom-0 mt-24 flex h-auto flex-col rounded-t-xl border border-border bg-background pb-[var(--shellui-safe-area-bottom)]',
87
- top: 'fixed inset-x-0 top-0 mb-24 flex h-auto flex-col rounded-b-xl border border-border bg-background pt-[var(--shellui-safe-area-top)]',
88
- left: 'fixed inset-y-0 left-0 mr-24 flex h-full w-auto flex-col rounded-r-xl border border-border bg-background pl-[var(--shellui-safe-area-left)]',
89
- right:
90
- 'fixed inset-y-0 right-0 ml-24 flex h-full w-auto flex-col rounded-l-xl border border-border bg-background pr-[var(--shellui-safe-area-right)]',
94
+ bottom: `${drawerPanel} bottom-[var(--shellui-drawer-bottom)] left-[var(--shellui-drawer-left)] right-[var(--shellui-drawer-right)] h-auto max-md:rounded-[var(--shellui-sheet-radius)]`,
95
+ top: `${drawerPanel} top-[var(--shellui-drawer-top)] left-[var(--shellui-drawer-left)] right-[var(--shellui-drawer-right)] h-auto`,
96
+ left: `${drawerPanel} top-[var(--shellui-drawer-top)] bottom-[var(--shellui-drawer-bottom)] left-[var(--shellui-drawer-left)] h-auto w-auto`,
97
+ right: `${drawerPanel} top-[var(--shellui-drawer-top)] bottom-[var(--shellui-drawer-bottom)] right-[var(--shellui-drawer-right)] h-auto w-auto`,
91
98
  };
92
99
 
93
- /** Free-edge resize handle (opposite the anchored side). */
100
+ /** Free-edge resize handle (opposite the anchored side), 8px, inside the panel. */
94
101
  const resizeHandleByDirection: Record<DrawerDirection, { className: string; cursor: string }> = {
95
102
  right: {
96
- className: 'absolute left-0 top-3 bottom-3 w-1.5 -translate-x-1/2',
103
+ className: 'absolute left-0 top-3 bottom-3 w-2',
97
104
  cursor: 'ew-resize',
98
105
  },
99
106
  left: {
100
- className: 'absolute right-0 top-3 bottom-3 w-1.5 translate-x-1/2',
107
+ className: 'absolute right-0 top-3 bottom-3 w-2',
101
108
  cursor: 'ew-resize',
102
109
  },
103
110
  bottom: {
104
- className: 'absolute top-0 left-3 right-3 h-1.5 -translate-y-1/2',
111
+ className: 'absolute top-0 left-3 right-3 h-2',
105
112
  cursor: 'ns-resize',
106
113
  },
107
114
  top: {
108
- className: 'absolute bottom-0 left-3 right-3 h-1.5 translate-y-1/2',
115
+ className: 'absolute bottom-0 left-3 right-3 h-2',
109
116
  cursor: 'ns-resize',
110
117
  },
111
118
  };
112
119
 
120
+ function readDrawerOffsetPx(side: 'top' | 'right' | 'bottom' | 'left'): number {
121
+ const px = readCssLengthPx(`var(--shellui-drawer-${side})`);
122
+ return px > 0 ? px : FALLBACK_DRAWER_OFFSET_PX;
123
+ }
124
+
125
+ /** Largest panel size: the viewport minus the offsets on both ends of the size axis. */
113
126
  function maxPrimarySize(direction: DrawerDirection): number {
114
127
  const isVertical = direction === 'top' || direction === 'bottom';
115
- return Math.max(
116
- MIN_DRAWER_SIZE,
117
- (isVertical ? window.innerHeight : window.innerWidth) - VIEWPORT_MARGIN,
118
- );
128
+ const margin = isVertical
129
+ ? readDrawerOffsetPx('top') + readDrawerOffsetPx('bottom')
130
+ : readDrawerOffsetPx('left') + readDrawerOffsetPx('right');
131
+ return Math.max(MIN_DRAWER_SIZE, (isVertical ? window.innerHeight : window.innerWidth) - margin);
119
132
  }
120
133
 
121
134
  function clampDrawerSize(px: number, direction: DrawerDirection): number {
@@ -264,22 +277,25 @@ const DrawerContent = forwardRef<ComponentRef<typeof VaulDrawer.Content>, Drawer
264
277
  ? isVertical
265
278
  ? {
266
279
  height: effectiveSize,
267
- maxHeight: `min(${effectiveSize}, calc(var(--shellui-overlay-max-height) - ${VIEWPORT_MARGIN}px))`,
280
+ maxHeight: `min(${effectiveSize}, var(--shellui-drawer-max-height))`,
268
281
  }
269
282
  : {
270
283
  width: effectiveSize,
271
- maxWidth: `min(${effectiveSize}, calc(100vw - ${VIEWPORT_MARGIN}px))`,
284
+ maxWidth: `min(${effectiveSize}, var(--shellui-drawer-max-width))`,
272
285
  }
273
286
  : size === null
274
287
  ? isVertical
275
- ? { maxHeight: 'var(--shellui-overlay-max-height)' }
276
- : { maxWidth: 'min(90vw, 100%)' }
288
+ ? { maxHeight: 'var(--shellui-drawer-max-height)' }
289
+ : { maxWidth: 'min(90vw, var(--shellui-drawer-max-width))' }
277
290
  : isVertical
278
291
  ? {
279
292
  height: effectiveSize,
280
- maxHeight: `min(${effectiveSize}, var(--shellui-overlay-max-height))`,
293
+ maxHeight: `min(${effectiveSize}, var(--shellui-drawer-max-height))`,
281
294
  }
282
- : { width: effectiveSize, maxWidth: `min(${effectiveSize}, 100%)` };
295
+ : {
296
+ width: effectiveSize,
297
+ maxWidth: `min(${effectiveSize}, var(--shellui-drawer-max-width))`,
298
+ };
283
299
 
284
300
  const resizeHandle = resizeHandleByDirection[pos];
285
301
 
@@ -387,7 +403,7 @@ DrawerHeader.displayName = 'DrawerHeader';
387
403
  const DrawerFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
388
404
  <div
389
405
  className={cn(
390
- 'mt-auto flex flex-col-reverse gap-2 border-t border-border px-6 pt-4 pb-[max(1rem,var(--shellui-safe-area-bottom))] sm:flex-row sm:justify-end',
406
+ 'mt-auto flex flex-col-reverse gap-2 border-t border-border px-6 py-4 sm:flex-row sm:justify-end',
391
407
  className,
392
408
  )}
393
409
  {...props}
@@ -428,14 +444,15 @@ const DrawerHandle = forwardRef<
428
444
  ref={ref}
429
445
  data-drawer-handle
430
446
  className={cn(
431
- // !important overrides Vaul's injected `background: #e2e2e4` + 5px height
432
- 'mx-auto mt-1.5 h-[3px] w-8 shrink-0 rounded-full !bg-muted-foreground/70 !opacity-100',
447
+ // Same pill as the More sheet handle: 36 x 5px, 6px from the top (Vaul adds the 44px hit area).
448
+ 'mx-auto mt-1.5 h-[5px] w-9 shrink-0 rounded-full !opacity-100',
433
449
  className,
434
450
  )}
435
451
  style={{
436
- // Inline wins over Vaul stylesheet `background` / size when utilities lose the race
437
- background: 'color-mix(in oklch, var(--muted-foreground) 70%, transparent)',
438
- height: '3px',
452
+ // Inline wins over Vaul's injected `background: #e2e2e4`
453
+ background: 'color-mix(in oklch, var(--foreground) 22%, transparent)',
454
+ width: '36px',
455
+ height: '5px',
439
456
  borderRadius: '9999px',
440
457
  ...style,
441
458
  }}
@@ -35,26 +35,32 @@ const SheetOverlay = forwardRef<
35
35
  <SheetPrimitive.Overlay
36
36
  ref={ref}
37
37
  data-sheet-overlay=""
38
- className={cn('fixed inset-0 bg-black/50 backdrop-blur-[1px]', className)}
38
+ className={cn('fixed inset-0 bg-[var(--shellui-scrim)]', className)}
39
39
  style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_OVERLAY, ...style }}
40
40
  {...props}
41
41
  />
42
42
  ));
43
43
  SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
44
44
 
45
- const sheetVariants = cva('fixed flex flex-col gap-4 bg-background shadow-lg', {
46
- variants: {
47
- side: {
48
- top: 'inset-x-0 top-0 border-b',
49
- bottom: 'inset-x-0 bottom-0 border-t',
50
- left: 'inset-y-0 left-0 h-full w-3/4 max-w-full border-r sm:max-w-sm',
51
- right: 'inset-y-0 right-0 h-full w-3/4 max-w-full border-l sm:max-w-sm',
45
+ /** Floating sheet: same offsets, radius, border and shadow as the drawer panel. */
46
+ const sheetVariants = cva(
47
+ 'fixed flex flex-col gap-4 overflow-clip border border-[var(--shellui-drawer-border)] bg-background rounded-[var(--shellui-drawer-radius)] shadow-[var(--shellui-drawer-shadow)]',
48
+ {
49
+ variants: {
50
+ side: {
51
+ top: 'top-[var(--shellui-drawer-top)] left-[var(--shellui-drawer-left)] right-[var(--shellui-drawer-right)]',
52
+ bottom:
53
+ 'bottom-[var(--shellui-drawer-bottom)] left-[var(--shellui-drawer-left)] right-[var(--shellui-drawer-right)] max-md:rounded-[var(--shellui-sheet-radius)]',
54
+ left: 'top-[var(--shellui-drawer-top)] bottom-[var(--shellui-drawer-bottom)] left-[var(--shellui-drawer-left)] w-3/4 max-w-[var(--shellui-drawer-max-width)] sm:max-w-sm',
55
+ right:
56
+ 'top-[var(--shellui-drawer-top)] bottom-[var(--shellui-drawer-bottom)] right-[var(--shellui-drawer-right)] w-3/4 max-w-[var(--shellui-drawer-max-width)] sm:max-w-sm',
57
+ },
58
+ },
59
+ defaultVariants: {
60
+ side: 'right',
52
61
  },
53
62
  },
54
- defaultVariants: {
55
- side: 'right',
56
- },
57
- });
63
+ );
58
64
 
59
65
  interface SheetContentProps
60
66
  extends
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { cva, type VariantProps } from 'class-variance-authority';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
+ import { useTranslation } from 'react-i18next';
4
5
 
5
6
  import { useIsMobile } from '../../hooks/use-mobile';
6
7
  import { cn } from '../../lib/utils';
@@ -46,7 +47,8 @@ const SIDEBAR_WIDTH_DEFAULT_PX = 256;
46
47
  const SIDEBAR_WIDTH_MIN_PX = 230;
47
48
  const SIDEBAR_WIDTH_MAX_PX = 480;
48
49
  /** Cap at the viewport so a phone narrower than 18rem still gets a full-width sheet. */
49
- const SIDEBAR_WIDTH_MOBILE = 'min(18rem, 100%)';
50
+ /** Phone nav sheet width, capped so the floating sheet keeps its gap on both sides. */
51
+ const SIDEBAR_WIDTH_MOBILE = 'min(18rem, 100%, calc(100% - 2 * var(--shellui-drawer-gap)))';
50
52
  const SIDEBAR_WIDTH_ICON = '3rem';
51
53
  const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
52
54
  /** Ignore tiny pointer moves so a rail click still toggles. */
@@ -222,7 +224,7 @@ function SidebarProvider({
222
224
 
223
225
  return (
224
226
  <SidebarContext.Provider value={contextValue}>
225
- <TooltipProvider delayDuration={0}>
227
+ <TooltipProvider delayDuration={200}>
226
228
  <div
227
229
  data-slot="sidebar-wrapper"
228
230
  data-resizing={isResizing ? '' : undefined}
@@ -248,6 +250,9 @@ function SidebarProvider({
248
250
  );
249
251
  }
250
252
 
253
+ /** DOM id of the sidebar panel, for the trigger's `aria-controls`. */
254
+ export const SIDEBAR_PANEL_ID = 'shellui-sidebar';
255
+
251
256
  function Sidebar({
252
257
  side = 'left',
253
258
  variant = 'sidebar',
@@ -260,6 +265,7 @@ function Sidebar({
260
265
  variant?: 'sidebar' | 'floating' | 'inset';
261
266
  collapsible?: 'offcanvas' | 'icon' | 'none';
262
267
  }) {
268
+ const { t } = useTranslation();
263
269
  const context = React.useContext(SidebarContext);
264
270
 
265
271
  if (collapsible === 'none') {
@@ -294,6 +300,7 @@ function Sidebar({
294
300
  data-sidebar="sidebar"
295
301
  data-slot="sidebar"
296
302
  data-mobile="true"
303
+ id={SIDEBAR_PANEL_ID}
297
304
  className="w-(--sidebar-width) max-w-full overflow-x-hidden bg-sidebar p-0 text-sidebar-foreground sm:max-w-full [&>button]:hidden"
298
305
  style={
299
306
  {
@@ -305,12 +312,10 @@ function Sidebar({
305
312
  side={side}
306
313
  >
307
314
  <SheetHeader className="sr-only">
308
- <SheetTitle>Sidebar</SheetTitle>
309
- <SheetDescription>Displays the mobile sidebar.</SheetDescription>
315
+ <SheetTitle>{t('desktopChrome.navigation')}</SheetTitle>
316
+ <SheetDescription>{t('shellChrome.sheetDescription')}</SheetDescription>
310
317
  </SheetHeader>
311
- <div className="flex h-full min-h-0 w-full flex-col overflow-hidden pt-[var(--shellui-safe-area-top)] pr-[var(--shellui-safe-area-right)] pl-[var(--shellui-safe-area-left)]">
312
- {children}
313
- </div>
318
+ <div className="flex h-full min-h-0 w-full flex-col overflow-hidden">{children}</div>
314
319
  </SheetContent>
315
320
  </Sheet>
316
321
  );
@@ -361,6 +366,7 @@ function Sidebar({
361
366
  <div
362
367
  data-sidebar="sidebar"
363
368
  data-slot="sidebar-inner"
369
+ id={SIDEBAR_PANEL_ID}
364
370
  className={cn(
365
371
  'flex h-full w-full flex-col bg-sidebar',
366
372
  'group-data-[variant=inset]:bg-transparent',
@@ -375,7 +381,8 @@ function Sidebar({
375
381
  }
376
382
 
377
383
  function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
378
- const { toggleSidebar } = useSidebar();
384
+ const { toggleSidebar, isMobile, open, openMobile } = useSidebar();
385
+ const { t } = useTranslation();
379
386
 
380
387
  return (
381
388
  <Button
@@ -384,7 +391,9 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
384
391
  data-slot="sidebar-trigger"
385
392
  variant="ghost"
386
393
  size="icon"
387
- aria-label="Toggle Sidebar"
394
+ aria-label={t('shellChrome.toggleSidebar')}
395
+ aria-expanded={isMobile ? openMobile : open}
396
+ aria-controls={SIDEBAR_PANEL_ID}
388
397
  className={cn(
389
398
  'size-7 touch-manipulation select-none [-webkit-touch-callout:none]',
390
399
  className,
@@ -413,6 +422,7 @@ function SidebarRail({
413
422
  side?: 'left' | 'right';
414
423
  }) {
415
424
  const { toggleSidebar, state, width, setWidth, setIsResizing } = useSidebar();
425
+ const { t } = useTranslation();
416
426
  const dragRef = React.useRef<{
417
427
  startX: number;
418
428
  startWidth: number;
@@ -486,9 +496,11 @@ function SidebarRail({
486
496
  data-slot="sidebar-rail"
487
497
  data-shellui-no-drag=""
488
498
  data-placement={placement}
489
- aria-label={state === 'expanded' ? 'Resize Sidebar' : 'Toggle Sidebar'}
499
+ aria-label={
500
+ state === 'expanded' ? t('shellChrome.resizeSidebar') : t('shellChrome.toggleSidebar')
501
+ }
490
502
  tabIndex={-1}
491
- title={state === 'expanded' ? 'Drag to resize' : 'Toggle Sidebar'}
503
+ title={state === 'expanded' ? t('shellChrome.dragToResize') : t('shellChrome.toggleSidebar')}
492
504
  onClick={(event) => {
493
505
  if (didDragRef.current) {
494
506
  didDragRef.current = false;
@@ -763,6 +775,8 @@ function SidebarMenuButton({
763
775
  <TooltipContent
764
776
  side="right"
765
777
  align="center"
778
+ sideOffset={8}
779
+ className="rounded-[calc(var(--shellui-r-row)-1px)] border-0 bg-foreground px-2 py-1 text-xs font-medium text-background shadow-none"
766
780
  hidden={state !== 'collapsed' || isMobile}
767
781
  {...tooltip}
768
782
  />
@@ -32,15 +32,17 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
32
32
  export interface AppBarTooltipProps {
33
33
  label: string;
34
34
  children: ReactNode;
35
+ /** Defaults to below; the windows taskbar opens it above. */
36
+ side?: 'top' | 'bottom';
35
37
  }
36
38
 
37
39
  /** Themed tooltip for app-bar end buttons: no arrow, no animation. */
38
- function AppBarTooltip({ label, children }: AppBarTooltipProps) {
40
+ function AppBarTooltip({ label, children, side = 'bottom' }: AppBarTooltipProps) {
39
41
  return (
40
42
  <Tooltip delayDuration={200}>
41
43
  <TooltipTrigger asChild>{children}</TooltipTrigger>
42
44
  <TooltipContent
43
- side="bottom"
45
+ side={side}
44
46
  align="center"
45
47
  >
46
48
  {label}
@@ -10,8 +10,8 @@ import { useConfig } from '../config/useConfig';
10
10
  import type { NavigationItem } from '../config/types';
11
11
  import { AppLayout } from '../layouts/AppLayout';
12
12
  import {
13
- MAC_TRAFFIC_LIGHTS_GAP_PX,
14
- MAC_TRAFFIC_LIGHTS_WIDTH_PX,
13
+ DESKTOP_TITLEBAR_HEIGHT_PX,
14
+ MAC_LIGHTS_SAFE_PX,
15
15
  isShellUiRootWindow,
16
16
  SafeAreaTopbarOffset,
17
17
  SafeAreaTopbarStrip,
@@ -74,9 +74,9 @@ export const AdminView = () => {
74
74
 
75
75
  const showSafeAreaTopbar = isShellUiRootWindow();
76
76
  const trafficLights = useMacTrafficLights();
77
- const chromeInset = trafficLights
78
- ? MAC_TRAFFIC_LIGHTS_WIDTH_PX + MAC_TRAFFIC_LIGHTS_GAP_PX
79
- : undefined;
77
+ const chromeInset = trafficLights ? MAC_LIGHTS_SAFE_PX : undefined;
78
+ // macOS desktop: the header is the 32px strip, controls centre on the lights line.
79
+ const macStrip = trafficLights && !isMobile;
80
80
  const headerStyle = {
81
81
  paddingLeft: chromeInset ?? 'max(0.5rem, var(--shellui-safe-area-left))',
82
82
  paddingRight: 'max(0.75rem, var(--shellui-safe-area-right))',
@@ -85,7 +85,7 @@ export const AdminView = () => {
85
85
  paddingTop: 'var(--shellui-safe-area-top)',
86
86
  height: `calc(${ADMIN_HEADER_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
87
87
  }
88
- : { height: ADMIN_HEADER_HEIGHT_PX }),
88
+ : { height: macStrip ? DESKTOP_TITLEBAR_HEIGHT_PX : ADMIN_HEADER_HEIGHT_PX }),
89
89
  } as const;
90
90
 
91
91
  return (
@@ -102,11 +102,13 @@ export const AdminView = () => {
102
102
  {...(trafficLights
103
103
  ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
104
104
  : {})}
105
+ {...(macStrip ? { 'data-shellui-mac-strip': '' } : {})}
105
106
  >
106
107
  <Button
107
108
  type="button"
108
109
  variant="ghost"
109
110
  size="sm"
111
+ className={macStrip ? 'h-6 px-2 text-[13px]' : undefined}
110
112
  data-shellui-no-drag=""
111
113
  onClick={() => navigate('/')}
112
114
  >
@@ -127,6 +129,7 @@ export const AdminView = () => {
127
129
  </Button>
128
130
  <div
129
131
  data-shellui-no-drag=""
132
+ data-shellui-strip-end=""
130
133
  className="flex items-center gap-2"
131
134
  >
132
135
  <LoginButton
@@ -27,6 +27,7 @@ import {
27
27
  hasStoredAuthSession,
28
28
  inferAccessPendingErrorCode,
29
29
  isBffAuthEnabledFromConfig,
30
+ canRestoreStoredSession,
30
31
  isSessionExpired,
31
32
  isTokenAutoRefreshDisabled,
32
33
  logoutBffAuthSession,
@@ -38,6 +39,7 @@ import {
38
39
  type InFlightSlot,
39
40
  } from './utils';
40
41
  import { buildAuthUrlWithNext } from './utils/buildAuthUrlWithNext';
42
+ import { resolveSdkLoginRedirectPath } from './utils/resolveSdkLoginRedirectPath';
41
43
  import {
42
44
  beginDesktopOAuth,
43
45
  clearDesktopPkce,
@@ -252,6 +254,17 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
252
254
  return;
253
255
  }
254
256
 
257
+ // A new tab has the shared profile but not the tab-scoped refresh token. Treat it as
258
+ // signed out instead of a signed-in session with no token. Keep storage: another tab
259
+ // may still own this session.
260
+ if (!canRestoreStoredSession(stored, bffAuthEnabled)) {
261
+ if (!cancelled) {
262
+ setSession(null);
263
+ setIsLoading(false);
264
+ }
265
+ return;
266
+ }
267
+
255
268
  const applyRestoredSession = async (source: AuthSession) => {
256
269
  try {
257
270
  const restored = await shareInFlight(restoreRefreshSlot, () =>
@@ -849,8 +862,8 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
849
862
  });
850
863
  } catch (err) {
851
864
  reply('error');
852
- const errorCode = getAuthRequestErrorCode(err);
853
- if (errorCode === 'last_company_owner') {
865
+ const deleteErrorCode = getAuthRequestErrorCode(err);
866
+ if (deleteErrorCode === 'last_company_owner') {
854
867
  const companies =
855
868
  err instanceof AuthRequestError && Array.isArray(err.details.companies)
856
869
  ? (err.details.companies as Array<{ name?: unknown }>)
@@ -868,7 +881,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
868
881
  });
869
882
  return;
870
883
  }
871
- if (errorCode === 'recent_login_required') {
884
+ if (deleteErrorCode === 'recent_login_required') {
872
885
  shellui.dialog({
873
886
  title: t('userAccount.deleteAccount.reauthTitle'),
874
887
  description: t('userAccount.deleteAccount.reauthDescription'),
@@ -930,7 +943,15 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
930
943
  return;
931
944
  }
932
945
 
933
- startOAuth(provider, payload.redirectPath || urls.login, payload.oauthClientId);
946
+ const currentPath =
947
+ typeof window !== 'undefined'
948
+ ? `${window.location.pathname}${window.location.search}`
949
+ : '/';
950
+ startOAuth(
951
+ provider,
952
+ resolveSdkLoginRedirectPath(payload.redirectPath, currentPath),
953
+ payload.oauthClientId,
954
+ );
934
955
  });
935
956
 
936
957
  return () => cleanup();