@shellui/core 0.5.0-alpha.5 → 0.5.0-beta.2

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 (40) hide show
  1. package/package.json +2 -2
  2. package/src/components/ContentView.tsx +1 -1
  3. package/src/components/ui/alert-dialog.tsx +51 -34
  4. package/src/components/ui/drawer.tsx +57 -40
  5. package/src/components/ui/sidebar.tsx +12 -5
  6. package/src/components/ui/sonner.tsx +20 -2
  7. package/src/features/admin/AdminView.tsx +31 -2
  8. package/src/features/alertDialog/DialogContext.tsx +11 -5
  9. package/src/features/auth/components/AccessPendingView.tsx +1 -1
  10. package/src/features/auth/components/LoginButton.tsx +2 -2
  11. package/src/features/auth/components/LoginView.tsx +77 -30
  12. package/src/features/layouts/LayoutFallback.tsx +1 -1
  13. package/src/features/layouts/OverlayShell.tsx +76 -44
  14. package/src/features/layouts/appbar/AppBarLayout.tsx +501 -293
  15. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +18 -10
  16. package/src/features/layouts/chrome/ContentDragOverlay.tsx +1 -1
  17. package/src/features/layouts/chrome/DesktopChrome.tsx +1 -1
  18. package/src/features/layouts/chrome/SafeAreaTopbar.tsx +48 -0
  19. package/src/features/layouts/chrome/constants.ts +7 -1
  20. package/src/features/layouts/chrome/index.ts +5 -0
  21. package/src/features/layouts/chrome/runtime.ts +157 -7
  22. package/src/features/layouts/chrome/viewport.ts +66 -0
  23. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +10 -5
  24. package/src/features/layouts/sidebar/SidebarInner.tsx +26 -30
  25. package/src/features/layouts/sidebar/SidebarLayout.tsx +90 -39
  26. package/src/features/layouts/windows/WindowsLayout.tsx +138 -42
  27. package/src/features/overlays/ResponsiveModal.tsx +36 -17
  28. package/src/features/overlays/overlaySize.spec.ts +27 -1
  29. package/src/features/overlays/overlaySize.ts +73 -18
  30. package/src/features/overlays/useOverlayReportedSize.ts +5 -4
  31. package/src/features/settings/SettingsView.tsx +9 -2
  32. package/src/features/storage/uploads/UploadToastCard.tsx +1 -1
  33. package/src/features/storage/uploads/UploadToaster.tsx +6 -3
  34. package/src/features/theme/applyTheme.ts +20 -1
  35. package/src/i18n/translations/en/common.json +2 -1
  36. package/src/i18n/translations/fr/common.json +2 -1
  37. package/src/index.css +177 -18
  38. package/src/index.html +32 -3
  39. package/src/routes/components/RouteErrorBoundary.tsx +1 -1
  40. package/src/routes/components/RouteFallback.tsx +1 -1
@@ -6,6 +6,14 @@ import type {
6
6
  DrawerPosition,
7
7
  } from '@shellui/sdk';
8
8
 
9
+ /** CSS max-height for overlays — matches --shellui-overlay-max-height in index.css. */
10
+ const OVERLAY_MAX_HEIGHT_CSS = 'var(--shellui-overlay-max-height)';
11
+
12
+ /** Fraction of overlay max height — avoids raw dvh which disagrees with iOS standalone measure. */
13
+ function overlayHeightFrac(fraction: number): string {
14
+ return `calc(${OVERLAY_MAX_HEIGHT_CSS} * ${fraction})`;
15
+ }
16
+
9
17
  const PRESETS = new Set<string>(['sm', 'md', 'lg', 'xl', 'full', 'content']);
10
18
 
11
19
  /**
@@ -38,48 +46,49 @@ export function toCssLength(value: string | number | undefined): string | undefi
38
46
 
39
47
  /** Dialog (desktop/tablet modal) preset → class + inline style hints.
40
48
  * Width uses `calc(100vw - …)` gutters so tablets never edge-to-edge;
41
- * `max-w-*` still caps size on large desktops. */
49
+ * `max-w-*` still caps size on large desktops.
50
+ * Heights derive from `--shellui-overlay-max-height` (not raw dvh). */
42
51
  const DIALOG_PRESET: Record<
43
52
  OverlaySizePreset,
44
53
  { className: string; style?: CSSProperties; contentSized?: boolean }
45
54
  > = {
46
55
  sm: {
47
56
  className:
48
- 'max-w-sm w-[min(24rem,calc(100vw-3rem))] h-[min(50dvh,24rem)] max-h-[min(70dvh,28rem)] rounded-lg',
57
+ 'max-w-sm w-[min(24rem,calc(100vw-3rem))] h-[min(calc(var(--shellui-overlay-max-height)*0.5),24rem)] max-h-[min(calc(var(--shellui-overlay-max-height)*0.7),28rem)] rounded-lg',
49
58
  },
50
59
  md: {
51
60
  className:
52
- 'max-w-lg w-[min(32rem,calc(100vw-4rem))] h-[min(60dvh,32rem)] max-h-[min(75dvh,36rem)] rounded-lg',
61
+ 'max-w-lg w-[min(32rem,calc(100vw-4rem))] h-[min(calc(var(--shellui-overlay-max-height)*0.6),32rem)] max-h-[min(calc(var(--shellui-overlay-max-height)*0.75),36rem)] rounded-lg',
53
62
  },
54
63
  lg: {
55
64
  // Wider than the 768px mobile breakpoint so iframe apps keep desktop UI
56
65
  className:
57
- 'max-w-4xl w-[min(56rem,calc(100vw-5rem))] h-[min(80dvh,42.5rem)] max-h-[min(80dvh,42.5rem)] rounded-lg',
66
+ 'max-w-4xl w-[min(56rem,calc(100vw-5rem))] h-[min(calc(var(--shellui-overlay-max-height)*0.8),42.5rem)] max-h-[min(calc(var(--shellui-overlay-max-height)*0.8),42.5rem)] rounded-lg',
58
67
  },
59
68
  xl: {
60
69
  className:
61
- 'max-w-6xl w-[min(72rem,calc(100vw-5rem))] h-[min(85dvh,50rem)] max-h-[min(85dvh,50rem)] rounded-lg',
70
+ 'max-w-6xl w-[min(72rem,calc(100vw-5rem))] h-[min(calc(var(--shellui-overlay-max-height)*0.85),50rem)] max-h-[min(calc(var(--shellui-overlay-max-height)*0.85),50rem)] rounded-lg',
62
71
  },
63
72
  full: {
64
73
  className:
65
- 'max-w-[calc(100vw-2.5rem)] w-[calc(100vw-2.5rem)] h-[calc(100dvh-2.5rem)] max-h-[calc(100dvh-2.5rem)] rounded-lg',
74
+ 'max-w-[calc(100vw-2.5rem)] w-[calc(100vw-2.5rem)] h-[var(--shellui-overlay-max-height)] max-h-[var(--shellui-overlay-max-height)] rounded-lg',
66
75
  },
67
76
  content: {
68
77
  // Width comes from SHELLUI_OVERLAY_SIZE; max-w only caps. Avoid forcing 56rem
69
78
  // (that caused reflow: narrow measure → tall report → wide chrome → shorter report).
70
79
  className: 'max-w-4xl w-max rounded-lg',
71
- style: { height: 'auto', width: 'auto', maxHeight: 'min(90dvh, 100dvh - 2.5rem)' },
80
+ style: { height: 'auto', width: 'auto', maxHeight: OVERLAY_MAX_HEIGHT_CSS },
72
81
  contentSized: true,
73
82
  },
74
83
  };
75
84
 
76
85
  /** Drawer primary dimension presets (height for top/bottom, width for left/right). */
77
86
  const DRAWER_PRESET_VERTICAL: Record<OverlaySizePreset, string> = {
78
- sm: '40dvh',
79
- md: '55dvh',
80
- lg: '75dvh',
81
- xl: '90dvh',
82
- full: '100dvh',
87
+ sm: overlayHeightFrac(0.4),
88
+ md: overlayHeightFrac(0.55),
89
+ lg: overlayHeightFrac(0.75),
90
+ xl: overlayHeightFrac(0.9),
91
+ full: OVERLAY_MAX_HEIGHT_CSS,
83
92
  content: 'auto',
84
93
  };
85
94
 
@@ -92,6 +101,8 @@ const DRAWER_PRESET_HORIZONTAL: Record<OverlaySizePreset, string> = {
92
101
  content: 'auto',
93
102
  };
94
103
 
104
+ const DEFAULT_VERTICAL_DRAWER = overlayHeightFrac(0.8);
105
+
95
106
  export interface ResolvedOverlaySize {
96
107
  className: string;
97
108
  style: CSSProperties;
@@ -113,7 +124,7 @@ function applyExplicitDimensions(
113
124
  if (width) next.width = width;
114
125
  if (height) next.height = height;
115
126
  if (maxWidth) next.maxWidth = `min(${maxWidth}, 100vw)`;
116
- if (maxHeight) next.maxHeight = `min(${maxHeight}, 100dvh)`;
127
+ if (maxHeight) next.maxHeight = `min(${maxHeight}, ${OVERLAY_MAX_HEIGHT_CSS})`;
117
128
  return next;
118
129
  }
119
130
 
@@ -139,7 +150,7 @@ export function resolveDialogSize(options?: OverlayOpenOptions | null): Resolved
139
150
  };
140
151
  if (freeform) {
141
152
  style.height = freeform;
142
- style.maxHeight = `min(${freeform}, 100dvh)`;
153
+ style.maxHeight = `min(${freeform}, ${OVERLAY_MAX_HEIGHT_CSS})`;
143
154
  }
144
155
  style = applyExplicitDimensions(style, options ?? {});
145
156
 
@@ -151,9 +162,20 @@ export function resolveDialogSize(options?: OverlayOpenOptions | null): Resolved
151
162
  };
152
163
  }
153
164
 
165
+ /**
166
+ * On viewports below the mobile breakpoint, every drawer edge presents as a
167
+ * bottom sheet (same chrome as mobile `openModal`).
168
+ */
169
+ export function resolveEffectiveDrawerPosition(
170
+ position: DrawerPosition = 'right',
171
+ isMobile = false,
172
+ ): DrawerPosition {
173
+ return isMobile ? 'bottom' : position;
174
+ }
175
+
154
176
  /**
155
177
  * Resolve drawer sizing from open options + direction.
156
- * Default: 80dvh / 80vw (previous behavior).
178
+ * Default: 80% of overlay max / 80vw (previous 80dvh / 80vw behavior).
157
179
  */
158
180
  export function resolveDrawerSize(
159
181
  options?: OverlayOpenOptions | null,
@@ -166,11 +188,11 @@ export function resolveDrawerSize(
166
188
 
167
189
  let drawerSize: string;
168
190
  if (!size) {
169
- drawerSize = isVertical ? '80dvh' : '80vw';
191
+ drawerSize = isVertical ? DEFAULT_VERTICAL_DRAWER : '80vw';
170
192
  } else if (isOverlaySizePreset(size)) {
171
193
  drawerSize = isVertical ? DRAWER_PRESET_VERTICAL[size] : DRAWER_PRESET_HORIZONTAL[size];
172
194
  } else {
173
- drawerSize = toCssLength(size) ?? (isVertical ? '80dvh' : '80vw');
195
+ drawerSize = toCssLength(size) ?? (isVertical ? DEFAULT_VERTICAL_DRAWER : '80vw');
174
196
  }
175
197
 
176
198
  let style: CSSProperties = {
@@ -190,7 +212,7 @@ export function resolveDrawerSize(
190
212
  if (contentSized) {
191
213
  drawerSize = 'auto';
192
214
  if (isVertical) {
193
- style.maxHeight = style.maxHeight ?? 'min(90dvh, 100dvh)';
215
+ style.maxHeight = style.maxHeight ?? OVERLAY_MAX_HEIGHT_CSS;
194
216
  style.height = style.height ?? 'auto';
195
217
  } else {
196
218
  style.maxWidth = style.maxWidth ?? 'min(90vw, 100%)';
@@ -206,6 +228,39 @@ export function resolveDrawerSize(
206
228
  };
207
229
  }
208
230
 
231
+ /**
232
+ * Resolve drawer size for the active viewport.
233
+ * Mobile always uses bottom-sheet chrome; horizontal freeform widths (`60vw`,
234
+ * `400px`, explicit `width`) are dropped so they are not applied as height.
235
+ */
236
+ export function resolveDrawerSizeForViewport(
237
+ options?: OverlayOpenOptions | null,
238
+ position: DrawerPosition = 'right',
239
+ isMobile = false,
240
+ ): ResolvedOverlaySize {
241
+ const effective = resolveEffectiveDrawerPosition(position, isMobile);
242
+ if (!isMobile) {
243
+ return resolveDrawerSize(options, effective);
244
+ }
245
+
246
+ // left/right → bottom: width-oriented sizes must not become sheet height
247
+ if (position === 'left' || position === 'right') {
248
+ const dynamic = isDynamicSizing(options);
249
+ const size = options?.size;
250
+ const dropFreeformWidth =
251
+ !dynamic && size !== undefined && size !== null && !isOverlaySizePreset(size);
252
+ const nextOptions: OverlayOpenOptions | null | undefined = dropFreeformWidth
253
+ ? { ...options, size: undefined, width: undefined }
254
+ : options?.width !== undefined
255
+ ? { ...options, width: undefined }
256
+ : options;
257
+ return resolveDrawerSize(nextOptions, 'bottom');
258
+ }
259
+
260
+ // top → bottom (or already bottom): keep height-oriented size
261
+ return resolveDrawerSize(options, 'bottom');
262
+ }
263
+
209
264
  export type OverlayDismissOptions = {
210
265
  showCloseButton: boolean;
211
266
  dismissible: boolean;
@@ -1,5 +1,6 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { shellui, type OverlaySizePayload, type ShellUIMessage } from '@shellui/sdk';
3
+ import { overlayMaxHeightPx, readAppHeightPx } from '../layouts/chrome/viewport';
3
4
 
4
5
  const MIN_CONTENT_HEIGHT = 40;
5
6
  const MAX_VIEWPORT_RATIO = 0.92;
@@ -66,7 +67,9 @@ export function useOverlayReportedSize(enabled: boolean, active: boolean) {
66
67
  const height = Number(payload?.height);
67
68
  if (!Number.isFinite(height) || height <= 0) return;
68
69
 
69
- const maxH = Math.floor(window.innerHeight * MAX_VIEWPORT_RATIO);
70
+ // Clamp against the shell height (not raw innerHeight / dvh), so standalone
71
+ // iOS overlays cannot outgrow the visible screen.
72
+ const maxH = overlayMaxHeightPx(MAX_VIEWPORT_RATIO);
70
73
  const rawH = Math.ceil(height);
71
74
  const clampedH = Math.min(Math.max(rawH, MIN_CONTENT_HEIGHT), maxH);
72
75
  const wasClamped = rawH > maxH;
@@ -114,9 +117,7 @@ export function useOverlayReportedSize(enabled: boolean, active: boolean) {
114
117
  reported ??
115
118
  (fallback && enabled
116
119
  ? {
117
- height: Math.floor(
118
- (typeof window !== 'undefined' ? window.innerHeight : 600) * FALLBACK_HEIGHT_RATIO,
119
- ),
120
+ height: Math.floor(readAppHeightPx() * FALLBACK_HEIGHT_RATIO),
120
121
  wasClamped: true,
121
122
  }
122
123
  : null);
@@ -279,7 +279,7 @@ export const SettingsView = () => {
279
279
  <header className="flex h-16 shrink-0 items-center justify-center px-4 border-b">
280
280
  <h1 className="text-lg font-semibold">{t('title')}</h1>
281
281
  </header>
282
- <div className="flex flex-1 flex-col p-4 gap-6">
282
+ <div className="flex flex-1 flex-col gap-6 p-4 pb-[max(1.5rem,calc(1rem+env(safe-area-inset-bottom,0px)))] pl-[max(1rem,env(safe-area-inset-left,0px))] pr-[max(1rem,env(safe-area-inset-right,0px))]">
283
283
  {groupedRoutes.map((group) => (
284
284
  <div
285
285
  key={group.title}
@@ -344,7 +344,14 @@ export const SettingsView = () => {
344
344
  </Button>
345
345
  <h1 className="text-lg font-semibold">{selectedItem?.name}</h1>
346
346
  </header>
347
- <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-4">
347
+ <div
348
+ className={cn(
349
+ 'flex flex-1 flex-col overflow-hidden',
350
+ selectedItem?.path?.startsWith('app-')
351
+ ? 'min-h-0'
352
+ : 'gap-4 overflow-y-auto p-4 pt-4 pb-[max(1.5rem,calc(1rem+env(safe-area-inset-bottom,0px)))] pl-[max(1rem,env(safe-area-inset-left,0px))] pr-[max(1rem,env(safe-area-inset-right,0px))]',
353
+ )}
354
+ >
348
355
  <Routes>
349
356
  <Route
350
357
  index
@@ -410,7 +410,7 @@ export function UploadToastCard() {
410
410
  >
411
411
  <div className="overflow-hidden">
412
412
  <div className="border-t border-border px-3">
413
- <div className="max-h-[min(14rem,calc(100dvh-14rem))] overflow-y-auto overscroll-contain divide-y divide-border">
413
+ <div className="max-h-[min(14rem,calc(var(--shellui-app-height,100dvh)-14rem))] overflow-y-auto overscroll-contain divide-y divide-border">
414
414
  {items.map((item) => (
415
415
  <FileRow
416
416
  key={item.id}
@@ -1,4 +1,5 @@
1
1
  import { useEffect } from 'react';
2
+ import { createPortal } from 'react-dom';
2
3
  import { shellui } from '@shellui/sdk';
3
4
  import { UploadToastCard } from './UploadToastCard';
4
5
  import { startUploadToastDemo, UPLOAD_TOAST_DEMO_MESSAGE, UPLOAD_TOAST_ID } from './uploadQueue';
@@ -27,15 +28,17 @@ export function UploadToaster() {
27
28
 
28
29
  if (!isRoot || items.length === 0) return null;
29
30
 
30
- return (
31
+ // Portal to body so z-index sits above portaled modals/drawers (same as Sonner).
32
+ return createPortal(
31
33
  <div
32
34
  id={UPLOAD_TOAST_ID}
33
- className="pointer-events-none fixed right-3 bottom-20 md:right-4 md:bottom-4"
35
+ className="pointer-events-none fixed right-[max(0.75rem,env(safe-area-inset-right,0px))] bottom-[max(5rem,calc(5rem+env(safe-area-inset-bottom,0px)))] md:right-[max(1rem,env(safe-area-inset-right,0px))] md:bottom-[max(1rem,env(safe-area-inset-bottom,0px))]"
34
36
  style={{ zIndex: Z_INDEX.TOAST }}
35
37
  >
36
38
  <div className="pointer-events-auto origin-bottom animate-in fade-in-0 slide-in-from-bottom-2 duration-200">
37
39
  <UploadToastCard />
38
40
  </div>
39
- </div>
41
+ </div>,
42
+ document.body,
40
43
  );
41
44
  }
@@ -1,6 +1,5 @@
1
1
  import { toCssVarValue } from './color';
2
2
  import type { ThemeColorsMode, ThemeDefinition } from './types';
3
-
4
3
  const COLOR_VAR_MAP: Array<[keyof ThemeColorsMode, string]> = [
5
4
  ['background', '--background'],
6
5
  ['foreground', '--foreground'],
@@ -36,6 +35,22 @@ const COLOR_VAR_MAP: Array<[keyof ThemeColorsMode, string]> = [
36
35
  ['chart5', '--chart-5'],
37
36
  ];
38
37
 
38
+ /** Update <meta name="theme-color"> so PWA / browser chrome matches the active surface. */
39
+ function syncThemeColorMeta(cssColor: string): void {
40
+ if (typeof document === 'undefined' || !cssColor) return;
41
+ const head = document.head || document.getElementsByTagName('head')[0];
42
+ if (!head) return;
43
+
44
+ // Prefer a single unconditional theme-color (iOS reads this; media variants are flaky standalone)
45
+ let meta = head.querySelector<HTMLMetaElement>('meta[name="theme-color"]:not([media])');
46
+ if (!meta) {
47
+ meta = document.createElement('meta');
48
+ meta.setAttribute('name', 'theme-color');
49
+ head.appendChild(meta);
50
+ }
51
+ meta.setAttribute('content', cssColor);
52
+ }
53
+
39
54
  /**
40
55
  * Apply theme colors to the document.
41
56
  * Sets full CSS colors (OKLCH / hex / hsl()) on :root for Tailwind `var(--*)` consumption.
@@ -61,6 +76,10 @@ export function applyTheme(theme: ThemeDefinition, isDark: boolean): void {
61
76
 
62
77
  root.style.setProperty('--radius', colors.radius);
63
78
 
79
+ // Keep browser chrome in sync. theme-color coexists with black-translucent — it
80
+ // does not paint the iOS status-bar slab, sizing the shell with dvh does.
81
+ syncThemeColorMeta(toCssVarValue(colors.background) || (isDark ? '#000000' : '#ffffff'));
82
+
64
83
  const head = document.head || document.getElementsByTagName('head')[0];
65
84
  const existingFontLinks = head.querySelectorAll('link[data-theme-font], style[data-theme-font]');
66
85
  existingFontLinks.forEach((link) => link.remove());
@@ -104,6 +104,7 @@
104
104
  "back": "Back",
105
105
  "forward": "Forward",
106
106
  "navigation": "Navigation",
107
- "openNavigation": "Open navigation"
107
+ "openNavigation": "Open navigation",
108
+ "more": "More"
108
109
  }
109
110
  }
@@ -104,6 +104,7 @@
104
104
  "back": "Retour",
105
105
  "forward": "Suivant",
106
106
  "navigation": "Navigation",
107
- "openNavigation": "Ouvrir la navigation"
107
+ "openNavigation": "Ouvrir la navigation",
108
+ "more": "Plus"
108
109
  }
109
110
  }
package/src/index.css CHANGED
@@ -77,6 +77,49 @@
77
77
  --sidebar: var(--sidebar-background);
78
78
  }
79
79
 
80
+ /*
81
+ * Padding only — never fold these into shell height. Use for chrome clearance
82
+ * (titlebar, sheet edges, home indicator). The shell itself is sized by
83
+ * --shellui-app-height (100dvh in CSS).
84
+ */
85
+ :root {
86
+ --shellui-app-height: 100dvh;
87
+ --shellui-safe-area-top: env(safe-area-inset-top, 0px);
88
+ --shellui-safe-area-right: env(safe-area-inset-right, 0px);
89
+ --shellui-safe-area-bottom: env(safe-area-inset-bottom, 0px);
90
+ --shellui-safe-area-left: env(safe-area-inset-left, 0px);
91
+ /*
92
+ * Max height for sheets / modals / drawers. Leaves the top safe area clear.
93
+ */
94
+ --shellui-overlay-max-height: calc(
95
+ var(--shellui-app-height) - var(--shellui-safe-area-top) - 0.5rem
96
+ );
97
+ }
98
+
99
+ /*
100
+ * Content padding that clears the notch / home indicator, then keeps the
101
+ * configured inset beyond that edge. Override with --shellui-safe-pad-x / -y.
102
+ */
103
+ .shellui-safe-pad {
104
+ padding-top: calc(var(--shellui-safe-pad-y, 1.5rem) + var(--shellui-safe-area-top));
105
+ padding-right: calc(var(--shellui-safe-pad-x, 1.5rem) + var(--shellui-safe-area-right));
106
+ padding-bottom: calc(var(--shellui-safe-pad-y, 1.5rem) + var(--shellui-safe-area-bottom));
107
+ padding-left: calc(var(--shellui-safe-pad-x, 1.5rem) + var(--shellui-safe-area-left));
108
+ }
109
+
110
+ /*
111
+ * Installed web app: make <body> the containing block for fixed descendants
112
+ * (overlays, sheets, toasts). Pure CSS via display-mode — no JS attributes.
113
+ */
114
+ @media (display-mode: standalone) {
115
+ body {
116
+ position: fixed;
117
+ inset: 0;
118
+ height: var(--shellui-app-height, 100dvh);
119
+ contain: layout paint;
120
+ }
121
+ }
122
+
80
123
  @layer base {
81
124
  * {
82
125
  border-color: var(--border);
@@ -277,6 +320,27 @@ html.shellui-theme-switching
277
320
  background-color: color-mix(in oklch, var(--muted) 80%, transparent) !important;
278
321
  }
279
322
 
323
+ /* Group cancel + action on the right. Sonner's unlayered CSS sets margin-auto on
324
+ * every button; !important beats it from @layer base. Target [data-cancel] — the
325
+ * close control is also a <button>, so :first-of-type is wrong. */
326
+ [data-sonner-toast][data-styled='true'] [data-button] {
327
+ margin-left: 0 !important;
328
+ margin-right: 0 !important;
329
+ }
330
+
331
+ [data-sonner-toast][data-styled='true'] [data-cancel],
332
+ [data-sonner-toast][data-styled='true']:not(:has([data-cancel])) [data-action] {
333
+ margin-left: auto !important;
334
+ }
335
+
336
+ [data-sonner-toaster][dir='rtl'] [data-sonner-toast][data-styled='true'] [data-cancel],
337
+ [data-sonner-toaster][dir='rtl']
338
+ [data-sonner-toast][data-styled='true']:not(:has([data-cancel]))
339
+ [data-action] {
340
+ margin-left: 0 !important;
341
+ margin-right: auto !important;
342
+ }
343
+
280
344
  /* Success toast icon uses text color (no separate icon color) */
281
345
  [data-sonner-toast][data-type='success'] [data-icon],
282
346
  [data-sonner-toast][data-type='success'] [data-icon] svg {
@@ -350,11 +414,7 @@ html.shellui-theme-switching
350
414
  }
351
415
  }
352
416
 
353
- /* Dialog / modal overlay and content animations */
354
- [data-dialog-content] {
355
- left: 50%;
356
- top: 50%;
357
- }
417
+ /* Dialog / modal — sheet & custom geometry overrides (base left/top come from component classes) */
358
418
 
359
419
  /* Responsive openModal: sheet presentation (mobile) — override centered dialog geometry */
360
420
  [data-dialog-content][data-presentation='sheet'] {
@@ -374,7 +434,7 @@ html.shellui-theme-switching
374
434
  transform: none;
375
435
  /* Never paint larger than the viewport even if state lags a resize */
376
436
  max-width: calc(100vw - 16px) !important;
377
- max-height: calc(100dvh - 16px) !important;
437
+ max-height: calc(var(--shellui-app-height, 100dvh) - 16px) !important;
378
438
  }
379
439
 
380
440
  [data-dialog-content][data-window-interacting='true'] {
@@ -453,11 +513,48 @@ html.shellui-theme-switching
453
513
  animation: dialog-overlay-fade-out 0.1s ease-in;
454
514
  }
455
515
 
456
- /* Default dialog (non-responsive / other Dialog usages) */
457
- [data-dialog-content][data-state='open']:not([data-presentation]) {
516
+ /* Alert dialogs — position/size come from inline styles on the component.
517
+ Animations must re-assert translate(-50%,-50%) every keyframe or fill-mode
518
+ clears transform and the dialog jumps to top-left@50%/50% (looks top-right / full-height). */
519
+ @keyframes alert-dialog-fade-in {
520
+ from {
521
+ opacity: 0;
522
+ transform: translate(-50%, -50%);
523
+ }
524
+ to {
525
+ opacity: 1;
526
+ transform: translate(-50%, -50%);
527
+ }
528
+ }
529
+ @keyframes alert-dialog-fade-out {
530
+ from {
531
+ opacity: 1;
532
+ transform: translate(-50%, -50%);
533
+ }
534
+ to {
535
+ opacity: 0;
536
+ transform: translate(-50%, -50%);
537
+ }
538
+ }
539
+ [data-dialog-content][data-alert-dialog] {
540
+ height: auto !important;
541
+ max-height: calc(
542
+ var(--shellui-app-height, 100dvh) - max(0.75rem, var(--shellui-safe-area-top)) -
543
+ max(0.75rem, var(--shellui-safe-area-bottom))
544
+ ) !important;
545
+ }
546
+ [data-dialog-content][data-alert-dialog][data-state='open'] {
547
+ animation: alert-dialog-fade-in 0.15s ease-out both;
548
+ }
549
+ [data-dialog-content][data-alert-dialog][data-state='closed'] {
550
+ animation: alert-dialog-fade-out 0.12s ease-in both;
551
+ }
552
+
553
+ /* Default dialog enter/exit — exclude alert dialogs (scale() would clobber translate centering) */
554
+ [data-dialog-content][data-state='open']:not([data-presentation]):not([data-alert-dialog]) {
458
555
  animation: dialog-content-in 0.1s ease-out 0.05s both;
459
556
  }
460
- [data-dialog-content][data-state='closed']:not([data-presentation]) {
557
+ [data-dialog-content][data-state='closed']:not([data-presentation]):not([data-alert-dialog]) {
461
558
  animation: dialog-content-out 0.1s ease-in both;
462
559
  }
463
560
 
@@ -468,6 +565,10 @@ html.shellui-theme-switching
468
565
  [data-dialog-content][data-presentation][data-state='closed'] {
469
566
  animation: responsive-modal-fade-out 0.12s ease-in both;
470
567
  }
568
+ /* Sheet swipe-dismiss continues from the dragged translate; keep mounted for the slide */
569
+ [data-dialog-content][data-presentation='sheet'][data-state='closed'] {
570
+ animation: responsive-modal-fade-out 0.28s cubic-bezier(0.32, 0.72, 0, 1) both;
571
+ }
471
572
 
472
573
  /* Sheet overlay and panel animations (mobile sidebar) */
473
574
  @keyframes sheet-overlay-fade-in {
@@ -688,7 +789,7 @@ html.shellui-theme-switching
688
789
  }
689
790
 
690
791
  html[data-shellui-overlay-chrome] {
691
- --shellui-titlebar-height: 38px;
792
+ --shellui-titlebar-height: 42px;
692
793
  --shellui-traffic-lights-width: 78px;
693
794
  }
694
795
 
@@ -697,14 +798,72 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
697
798
  z-index: 46;
698
799
  }
699
800
 
700
- /* Collapsed Tauri: full-width 38px titlebar; push sidebar + content below it. */
701
- html[data-shellui-collapsed-titlebar] [data-slot='sidebar-container'] {
702
- top: var(--shellui-titlebar-height, 38px);
703
- height: calc(100svh - var(--shellui-titlebar-height, 38px));
704
- }
705
-
706
- html[data-shellui-collapsed-titlebar] [data-slot='sidebar-inset'] {
707
- padding-top: var(--shellui-titlebar-height, 38px);
801
+ /*
802
+ * Tablet / desktop: fixed shell sidebar sits below the layout safe-area strip.
803
+ * Only when the root (non-iframe) layout advertised the topbar via
804
+ * data-shellui-safe-area-topbar. Drawer overlay stays full-bleed (topbar dims
805
+ * behind it); left/right/top drawer panels clear the inset so they never cover
806
+ * the strip. Height is 0 when env(safe-area-inset-top) is 0.
807
+ */
808
+ @media (min-width: 768px) {
809
+ html[data-shellui-safe-area-topbar]
810
+ [data-shellui-sidebar-layout]
811
+ > [data-slot='sidebar-wrapper']
812
+ > [data-slot='sidebar']
813
+ > [data-slot='sidebar-container'] {
814
+ top: var(--shellui-safe-area-top);
815
+ bottom: auto;
816
+ height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top));
817
+ }
818
+
819
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='left'],
820
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='right'] {
821
+ top: var(--shellui-safe-area-top);
822
+ bottom: 0;
823
+ height: auto;
824
+ }
825
+
826
+ /* Top drawer: sit below the safe-area band (no extra pt — offset replaces it). */
827
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='top'] {
828
+ top: var(--shellui-safe-area-top);
829
+ padding-top: 0;
830
+ border-top-left-radius: 0.75rem;
831
+ border-top-right-radius: 0.75rem;
832
+ }
833
+ }
834
+
835
+ /* Collapsed Tauri: full-width 42px titlebar; push sidebar + content below it. */
836
+ html[data-shellui-collapsed-titlebar]
837
+ [data-shellui-sidebar-layout]
838
+ > [data-slot='sidebar-wrapper']
839
+ > [data-slot='sidebar']
840
+ > [data-slot='sidebar-container'] {
841
+ top: var(--shellui-titlebar-height, 42px);
842
+ height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-titlebar-height, 42px));
843
+ }
844
+
845
+ html[data-shellui-collapsed-titlebar][data-shellui-safe-area-topbar]
846
+ [data-shellui-sidebar-layout]
847
+ > [data-slot='sidebar-wrapper']
848
+ > [data-slot='sidebar']
849
+ > [data-slot='sidebar-container'] {
850
+ top: calc(var(--shellui-safe-area-top) + var(--shellui-titlebar-height, 42px));
851
+ height: calc(
852
+ var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top) -
853
+ var(--shellui-titlebar-height, 42px)
854
+ );
855
+ }
856
+
857
+ html[data-shellui-collapsed-titlebar]
858
+ [data-shellui-sidebar-layout]
859
+ > [data-slot='sidebar-wrapper']
860
+ > [data-slot='sidebar-inset'] {
861
+ padding-top: var(--shellui-titlebar-height, 42px);
862
+ }
863
+
864
+ /* Root safe-area topbar: collapsed chrome sits below the status band. */
865
+ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
866
+ top: var(--shellui-safe-area-top);
708
867
  }
709
868
 
710
869
  /* Avoid iframe stealing pointer events while dragging the sidebar border. */
package/src/index.html CHANGED
@@ -4,8 +4,24 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta
6
6
  name="viewport"
7
- content="width=device-width, initial-scale=1.0"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
8
  />
9
+ <!-- iOS home-screen / standalone: draw under a translucent status bar -->
10
+ <meta
11
+ name="apple-mobile-web-app-capable"
12
+ content="yes"
13
+ />
14
+ <meta
15
+ name="mobile-web-app-capable"
16
+ content="yes"
17
+ />
18
+ <meta
19
+ name="apple-mobile-web-app-status-bar-style"
20
+ content="black-translucent"
21
+ />
22
+ <!-- No theme-color here on purpose: in an installed iOS web app it overrides
23
+ black-translucent and paints a slab overlays cannot cover. applyTheme adds
24
+ one at runtime for the platforms that still honour it. -->
9
25
  <title></title>
10
26
  <link
11
27
  rel="icon"
@@ -78,15 +94,28 @@
78
94
  * {
79
95
  box-sizing: border-box;
80
96
  }
97
+ :root {
98
+ /* Dynamic viewport — CSS only; no JS height measurement. */
99
+ --shellui-app-height: 100dvh;
100
+ }
81
101
  html,
82
102
  body {
83
103
  margin: 0;
84
104
  padding: 0;
85
- height: 100%;
105
+ height: calc(100% + env(safe-area-inset-top, 0px));
86
106
  overflow: hidden;
107
+ background-color: var(--background, #ffffff);
87
108
  }
109
+ /*
110
+ Fixed full-screen shell so the app (and portaled overlays) can paint under
111
+ a translucent iOS status bar. Height is pure CSS (--shellui-app-height).
112
+ */
88
113
  #root {
89
- height: 100%;
114
+ position: fixed;
115
+ inset: 0;
116
+ height: var(--shellui-app-height);
117
+ overflow: hidden;
118
+ background-color: var(--background, #ffffff);
90
119
  }
91
120
  </style>
92
121
  </head>
@@ -49,7 +49,7 @@ export function RouteErrorBoundary() {
49
49
 
50
50
  return (
51
51
  <div
52
- className="flex min-h-screen flex-col items-center justify-center bg-background px-4 py-12"
52
+ className="shellui-safe-pad flex h-full min-h-full flex-col items-center justify-center bg-background [--shellui-safe-pad-x:1rem] [--shellui-safe-pad-y:3rem]"
53
53
  style={{ fontFamily: 'var(--heading-font-family, system-ui, sans-serif)' }}
54
54
  >
55
55
  <div className="w-full max-w-md space-y-6 text-center">
@@ -1,7 +1,7 @@
1
1
  export function RouteFallback() {
2
2
  return (
3
3
  <div
4
- className="min-h-screen bg-background"
4
+ className="h-full min-h-full bg-background"
5
5
  aria-hidden
6
6
  />
7
7
  );