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

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 (32) 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 +11 -4
  6. package/src/components/ui/sonner.tsx +20 -2
  7. package/src/features/alertDialog/DialogContext.tsx +11 -5
  8. package/src/features/auth/components/AccessPendingView.tsx +1 -1
  9. package/src/features/auth/components/LoginButton.tsx +3 -3
  10. package/src/features/auth/components/LoginView.tsx +5 -4
  11. package/src/features/layouts/LayoutFallback.tsx +1 -1
  12. package/src/features/layouts/OverlayShell.tsx +76 -44
  13. package/src/features/layouts/appbar/AppBarLayout.tsx +473 -291
  14. package/src/features/layouts/chrome/viewport.ts +66 -0
  15. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +1 -1
  16. package/src/features/layouts/sidebar/SidebarInner.tsx +1 -1
  17. package/src/features/layouts/sidebar/SidebarLayout.tsx +110 -38
  18. package/src/features/layouts/windows/WindowsLayout.tsx +138 -42
  19. package/src/features/overlays/ResponsiveModal.tsx +36 -17
  20. package/src/features/overlays/overlaySize.spec.ts +27 -1
  21. package/src/features/overlays/overlaySize.ts +73 -18
  22. package/src/features/overlays/useOverlayReportedSize.ts +5 -4
  23. package/src/features/settings/SettingsView.tsx +9 -2
  24. package/src/features/storage/uploads/UploadToastCard.tsx +1 -1
  25. package/src/features/storage/uploads/UploadToaster.tsx +6 -3
  26. package/src/features/theme/applyTheme.ts +20 -1
  27. package/src/i18n/translations/en/common.json +2 -1
  28. package/src/i18n/translations/fr/common.json +2 -1
  29. package/src/index.css +168 -12
  30. package/src/index.html +32 -3
  31. package/src/routes/components/RouteErrorBoundary.tsx +1 -1
  32. package/src/routes/components/RouteFallback.tsx +1 -1
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 while keeping a minimum
101
+ * inset. Override mins with --shellui-safe-pad-x / --shellui-safe-pad-y.
102
+ */
103
+ .shellui-safe-pad {
104
+ padding-top: max(var(--shellui-safe-pad-y, 1.5rem), var(--shellui-safe-area-top));
105
+ padding-right: max(var(--shellui-safe-pad-x, 1.5rem), var(--shellui-safe-area-right));
106
+ padding-bottom: max(var(--shellui-safe-pad-y, 1.5rem), var(--shellui-safe-area-bottom));
107
+ padding-left: max(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 {
@@ -697,16 +798,71 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
697
798
  z-index: 46;
698
799
  }
699
800
 
801
+ /*
802
+ * Tablet / desktop: fixed shell sidebar sits below the layout safe-area strip.
803
+ * Only when the root (non-iframe) sidebar layout advertised the topbar.
804
+ * Drawer overlay stays full-bleed (topbar dims behind it); panels clear the inset.
805
+ */
806
+ @media (min-width: 768px) {
807
+ html[data-shellui-safe-area-topbar]
808
+ [data-shellui-sidebar-layout]
809
+ > [data-slot='sidebar-wrapper']
810
+ > [data-slot='sidebar']
811
+ > [data-slot='sidebar-container'] {
812
+ top: var(--shellui-safe-area-top);
813
+ bottom: auto;
814
+ height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top));
815
+ }
816
+
817
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='left'],
818
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='right'] {
819
+ top: var(--shellui-safe-area-top);
820
+ height: auto;
821
+ }
822
+
823
+ /* Top drawer: sit below the safe-area band (no extra pt — offset replaces it). */
824
+ html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='top'] {
825
+ top: var(--shellui-safe-area-top);
826
+ padding-top: 0;
827
+ border-top-left-radius: 0.75rem;
828
+ border-top-right-radius: 0.75rem;
829
+ }
830
+ }
831
+
700
832
  /* Collapsed Tauri: full-width 38px titlebar; push sidebar + content below it. */
701
- html[data-shellui-collapsed-titlebar] [data-slot='sidebar-container'] {
833
+ html[data-shellui-collapsed-titlebar]
834
+ [data-shellui-sidebar-layout]
835
+ > [data-slot='sidebar-wrapper']
836
+ > [data-slot='sidebar']
837
+ > [data-slot='sidebar-container'] {
702
838
  top: var(--shellui-titlebar-height, 38px);
703
- height: calc(100svh - var(--shellui-titlebar-height, 38px));
839
+ height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-titlebar-height, 38px));
840
+ }
841
+
842
+ html[data-shellui-collapsed-titlebar][data-shellui-safe-area-topbar]
843
+ [data-shellui-sidebar-layout]
844
+ > [data-slot='sidebar-wrapper']
845
+ > [data-slot='sidebar']
846
+ > [data-slot='sidebar-container'] {
847
+ top: calc(var(--shellui-safe-area-top) + var(--shellui-titlebar-height, 38px));
848
+ height: calc(
849
+ var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top) -
850
+ var(--shellui-titlebar-height, 38px)
851
+ );
704
852
  }
705
853
 
706
- html[data-shellui-collapsed-titlebar] [data-slot='sidebar-inset'] {
854
+ html[data-shellui-collapsed-titlebar]
855
+ [data-shellui-sidebar-layout]
856
+ > [data-slot='sidebar-wrapper']
857
+ > [data-slot='sidebar-inset'] {
707
858
  padding-top: var(--shellui-titlebar-height, 38px);
708
859
  }
709
860
 
861
+ /* Root safe-area topbar: collapsed chrome sits below the status band. */
862
+ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
863
+ top: var(--shellui-safe-area-top);
864
+ }
865
+
710
866
  /* Avoid iframe stealing pointer events while dragging the sidebar border. */
711
867
  [data-slot='sidebar-wrapper'][data-resizing] iframe {
712
868
  pointer-events: none;
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
  );