@shellui/core 0.5.0-beta.3 → 0.5.0

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 (62) hide show
  1. package/README.md +5 -5
  2. package/package.json +3 -2
  3. package/src/app.tsx +8 -4
  4. package/src/components/ui/dialog.tsx +5 -1
  5. package/src/components/ui/dropdown-menu.tsx +39 -4
  6. package/src/components/ui/sheet.tsx +1 -1
  7. package/src/components/ui/sidebar.tsx +3 -2
  8. package/src/components/ui/tabs.tsx +52 -0
  9. package/src/constants/urls.ts +1 -0
  10. package/src/features/auth/AuthProvider.tsx +17 -6
  11. package/src/features/chromeActions/ChromeActionIcons.tsx +261 -0
  12. package/src/features/chromeActions/ChromeActionsDemoView.tsx +149 -0
  13. package/src/features/chromeActions/ChromeActionsHost.tsx +1511 -0
  14. package/src/features/chromeActions/ChromeActionsProvider.tsx +141 -0
  15. package/src/features/chromeActions/chromeActionsStore.spec.ts +61 -0
  16. package/src/features/chromeActions/chromeActionsStore.ts +77 -0
  17. package/src/features/chromeActions/computeActionInsets.spec.ts +360 -0
  18. package/src/features/chromeActions/computeActionInsets.ts +326 -0
  19. package/src/features/chromeActions/index.ts +26 -0
  20. package/src/features/chromeActions/resolveUuidForRemoveIframe.spec.ts +49 -0
  21. package/src/features/layouts/AppLayout.tsx +4 -4
  22. package/src/features/layouts/OverlayShell.tsx +60 -12
  23. package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +1 -1
  24. package/src/features/layouts/appbar/AppBarLayout.tsx +194 -89
  25. package/src/features/layouts/chrome/DesktopChrome.tsx +17 -3
  26. package/src/features/layouts/chrome/InsetMobileRadiusOverlay.tsx +18 -0
  27. package/src/features/layouts/chrome/index.ts +8 -0
  28. package/src/features/layouts/chrome/runtime.ts +73 -0
  29. package/src/features/layouts/chrome/useScrollHideChrome.ts +210 -0
  30. package/src/features/layouts/floating/FloatingBottomDock.tsx +410 -0
  31. package/src/features/layouts/floating/FloatingLayout.tsx +31 -21
  32. package/src/features/layouts/floating/FloatingStatusScrim.tsx +36 -0
  33. package/src/features/layouts/floating/computeFloatingInsets.spec.ts +5 -5
  34. package/src/features/layouts/floating/computeFloatingInsets.ts +64 -12
  35. package/src/features/layouts/floating/isShellOwnedPath.spec.ts +2 -0
  36. package/src/features/layouts/floating/isShellOwnedPath.ts +1 -0
  37. package/src/features/layouts/floating/layoutChromeStore.spec.ts +138 -0
  38. package/src/features/layouts/floating/layoutChromeStore.ts +169 -6
  39. package/src/features/layouts/floating/useFloatingChrome.ts +20 -30
  40. package/src/features/layouts/sidebar/SidebarLayout.tsx +87 -31
  41. package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +1 -1
  42. package/src/features/layouts/windows/WindowsLayout.tsx +240 -110
  43. package/src/features/overlays/ResponsiveModal.tsx +201 -21
  44. package/src/features/overlays/overlaySize.spec.ts +18 -0
  45. package/src/features/overlays/overlaySize.ts +89 -0
  46. package/src/features/settings/SettingsProvider.tsx +29 -9
  47. package/src/features/settings/components/Develop.tsx +2 -0
  48. package/src/features/settings/components/develop/ChromeActionsTestButtons.tsx +63 -0
  49. package/src/features/storage/uploads/uploadQueue.spec.ts +56 -1
  50. package/src/features/storage/uploads/uploadQueue.ts +42 -1
  51. package/src/features/theme/applyTheme.ts +23 -5
  52. package/src/hooks/use-mobile.tsx +21 -7
  53. package/src/i18n/translations/en/settings.json +9 -0
  54. package/src/i18n/translations/fr/settings.json +9 -0
  55. package/src/index.css +264 -124
  56. package/src/index.html +6 -4
  57. package/src/index.ts +8 -0
  58. package/src/routes/components/RouteFallback.tsx +15 -0
  59. package/src/routes/routes.tsx +14 -0
  60. package/src/features/layouts/floating/FloatingFadeMask.tsx +0 -22
  61. package/src/features/layouts/floating/FloatingTabBar.tsx +0 -437
  62. package/src/features/layouts/floating/FloatingTabIndicator.tsx +0 -216
@@ -51,16 +51,15 @@ import {
51
51
  SafeAreaTopbarOffset,
52
52
  SafeAreaTopbarStrip,
53
53
  } from '../chrome/SafeAreaTopbar';
54
+ import { useScrollHideChrome } from '../chrome/useScrollHideChrome';
55
+ import { InsetMobileRadiusOverlay } from '../chrome/InsetMobileRadiusOverlay';
54
56
  import { useIsTauriRuntime, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
55
- import {
56
- DESKTOP_TITLEBAR_HEIGHT_PX,
57
- DESKTOP_TITLEBAR_PAD_TOP_PX,
58
- MAC_TRAFFIC_LIGHTS_GAP_PX,
59
- MAC_TRAFFIC_LIGHTS_WIDTH_PX,
60
- } from '../chrome/constants';
57
+ import { MAC_TRAFFIC_LIGHTS_GAP_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
61
58
 
62
- /** App-bar chrome height — matches the Tauri / sidebar titlebar strip. */
63
- const APP_BAR_HEIGHT_PX = DESKTOP_TITLEBAR_HEIGHT_PX;
59
+ /** App-bar chrome height — taller than the 42px Tauri/sidebar title strip. */
60
+ const APP_BAR_HEIGHT_PX = 56;
61
+ /** Extra top inset so controls aren’t flush against the window edge / notch band. */
62
+ const APP_BAR_PAD_TOP_PX = 6;
64
63
 
65
64
  export type AppBarChromeVariant = 'app-bar' | 'inset';
66
65
 
@@ -239,8 +238,8 @@ function AppBarItemIcon({ item, label }: { item: NavigationItem; label: string }
239
238
 
240
239
  const navTriggerClass = (active: boolean) =>
241
240
  cn(
242
- // h-7 leaves air in the 42px chrome after the 2px top pad.
243
- 'inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors',
241
+ // h-8 fills the taller app-bar after the top pad.
242
+ 'inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-sm font-medium transition-colors',
244
243
  'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
245
244
  active
246
245
  ? 'bg-sidebar-accent text-sidebar-accent-foreground'
@@ -689,7 +688,7 @@ function TopBarEndItem({
689
688
  );
690
689
 
691
690
  const buttonClass = cn(
692
- 'flex size-7 items-center justify-center rounded-md transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
691
+ 'flex size-8 items-center justify-center rounded-md transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
693
692
  isActive
694
693
  ? 'bg-sidebar-accent text-sidebar-accent-foreground'
695
694
  : 'text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground',
@@ -762,6 +761,15 @@ export function AppBarLayout({
762
761
  const currentLanguage = i18n.language || 'en';
763
762
  const isInset = variant === 'inset';
764
763
  const hasCustomLoginNav = useMemo(() => hasLoginNavigationItem(navigation), [navigation]);
764
+ // Nested shell-in-iframe must not repeat the root safe-area top band.
765
+ const showSafeAreaTopbar = isShellUiRootWindow();
766
+ const scrollHideLayout = isInset ? 'app-bar-inset' : 'app-bar';
767
+ const { chromeVisible } = useScrollHideChrome({
768
+ enabled: isMobile,
769
+ layout: scrollHideLayout,
770
+ barHeightPx: APP_BAR_HEIGHT_PX,
771
+ includeSafeArea: showSafeAreaTopbar,
772
+ });
765
773
  const authAwareNavigation = useMemo(
766
774
  () =>
767
775
  filterNavigationForAuthState(navigation, isAuthenticated, settings.developerFeatures.enabled),
@@ -808,27 +816,29 @@ export function AppBarLayout({
808
816
  : undefined;
809
817
 
810
818
  const hasStartNav = startSections.some((s) => s.items.length > 0);
811
- // Nested shell-in-iframe must not repeat the root safe-area top band.
812
- const showSafeAreaTopbar = isShellUiRootWindow();
813
- // Keep in sync with <main> `md:mx-3` — bar content aligns to the inset card border.
819
+ // Keep in sync with <main> inset frame pad — bar content aligns to the card border.
814
820
  // Extra inset from the frame edge: 20px left (brand/nav), 10px right (end links already have control padding).
815
- const insetFramePadPx = 12;
821
+ // Mobile inset is full-bleed (top radius only); desktop uses 12px (md:mx-3).
822
+ const insetFramePadPx = isMobile ? 0 : 12;
816
823
  const insetBarContentOffsetLeftPx = 20;
817
824
  const insetBarContentOffsetRightPx = 10;
818
825
  // md+: strip owns the inset; mobile pads the header into the status band.
826
+ // Mobile inset is full-bleed — use the same control insets as the flush app-bar.
819
827
  const headerStyle = {
820
828
  paddingLeft: isInset
821
- ? (chromeInset ?? insetFramePadPx) + insetBarContentOffsetLeftPx
829
+ ? isMobile
830
+ ? (chromeInset ?? 12)
831
+ : (chromeInset ?? insetFramePadPx) + insetBarContentOffsetLeftPx
822
832
  : (chromeInset ?? 12),
823
- paddingRight: isInset ? insetFramePadPx + insetBarContentOffsetRightPx : 8,
833
+ paddingRight: isInset ? (isMobile ? 8 : insetFramePadPx + insetBarContentOffsetRightPx) : 8,
824
834
  ...(isMobile && showSafeAreaTopbar
825
835
  ? {
826
- paddingTop: `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`,
836
+ paddingTop: `calc(var(--shellui-safe-area-top) + ${APP_BAR_PAD_TOP_PX}px)`,
827
837
  height: `calc(${APP_BAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
828
838
  }
829
839
  : {
830
840
  height: APP_BAR_HEIGHT_PX,
831
- paddingTop: DESKTOP_TITLEBAR_PAD_TOP_PX,
841
+ paddingTop: APP_BAR_PAD_TOP_PX,
832
842
  }),
833
843
  } as const;
834
844
 
@@ -837,7 +847,7 @@ export function AppBarLayout({
837
847
  data-shellui-app-bar-layout=""
838
848
  data-shellui-layout-variant={variant}
839
849
  className={cn(
840
- 'flex h-full max-h-full flex-col overflow-hidden',
850
+ 'relative flex h-full max-h-full flex-col overflow-hidden',
841
851
  isInset ? 'bg-shellui-inset-chrome' : 'bg-background',
842
852
  )}
843
853
  >
@@ -848,89 +858,184 @@ export function AppBarLayout({
848
858
  isInset ? '[&>div]:border-transparent [&>div]:bg-shellui-inset-chrome' : undefined
849
859
  }
850
860
  />
851
- <header
852
- className={cn(
853
- 'relative z-[46] flex w-full shrink-0 items-center gap-1.5 text-sidebar-foreground select-none',
854
- isInset
855
- ? 'border-b border-transparent bg-transparent'
856
- : 'border-b border-sidebar-border bg-sidebar',
857
- )}
858
- style={headerStyle}
859
- data-layout={isInset ? 'app-bar-inset' : 'app-bar'}
860
- {...(trafficLights ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' } : {})}
861
- >
862
- {appIcon ? (
863
- <AppBrandIcon
864
- appIcon={appIcon}
865
- title={title}
866
- data-shellui-no-drag=""
867
- className="mr-1 shrink-0"
868
- imgClassName="app-bar-app-icon"
869
- />
870
- ) : null}
861
+ {/*
862
+ Mobile: header + inset tray/radius slide as one stack; action row follows
863
+ the same CSS var. Desktop: header stays in normal document flow.
864
+ */}
865
+ {isMobile ? (
866
+ <div
867
+ data-shellui-mobile-chrome-stack=""
868
+ data-chrome-visible={chromeVisible ? 'true' : 'false'}
869
+ className="pointer-events-none absolute inset-0 z-[45]"
870
+ >
871
+ <header
872
+ data-shellui-scroll-hide-header=""
873
+ className={cn(
874
+ 'pointer-events-auto relative z-[1] flex w-full items-center gap-1.5 text-sidebar-foreground select-none',
875
+ isInset
876
+ ? 'border-b border-transparent bg-transparent'
877
+ : 'border-b border-sidebar-border bg-sidebar',
878
+ )}
879
+ style={headerStyle}
880
+ data-layout={isInset ? 'app-bar-inset' : 'app-bar'}
881
+ {...(trafficLights
882
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
883
+ : {})}
884
+ >
885
+ {appIcon ? (
886
+ <AppBrandIcon
887
+ appIcon={appIcon}
888
+ title={title}
889
+ data-shellui-no-drag=""
890
+ className="mr-1 shrink-0"
891
+ imgClassName="app-bar-app-icon size-6"
892
+ />
893
+ ) : null}
871
894
 
872
- {hasStartNav ? (
873
- <AppBarNav
874
- sections={startSections}
875
- activePathPrefix={activePathPrefix}
876
- currentLanguage={currentLanguage}
877
- />
878
- ) : (
879
- <div className="min-w-0 flex-1" />
880
- )}
895
+ {hasStartNav ? (
896
+ <AppBarNav
897
+ sections={startSections}
898
+ activePathPrefix={activePathPrefix}
899
+ currentLanguage={currentLanguage}
900
+ />
901
+ ) : (
902
+ <div className="min-w-0 flex-1" />
903
+ )}
881
904
 
882
- {isTauriRuntime ? (
883
- <div
884
- data-shellui-no-drag=""
885
- className="shrink-0"
886
- >
887
- <DesktopHistoryButtons />
888
- </div>
889
- ) : null}
905
+ {isTauriRuntime ? (
906
+ <div
907
+ data-shellui-no-drag=""
908
+ className="shrink-0"
909
+ >
910
+ <DesktopHistoryButtons />
911
+ </div>
912
+ ) : null}
890
913
 
891
- <div
892
- aria-hidden
893
- className="min-h-full min-w-[8px] shrink-0 grow-0 basis-2"
894
- {...(trafficLights || overlay
914
+ <div
915
+ aria-hidden
916
+ className="min-h-full min-w-[8px] shrink-0 grow-0 basis-2"
917
+ {...(trafficLights || overlay
918
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
919
+ : {})}
920
+ />
921
+
922
+ <div
923
+ data-shellui-no-drag=""
924
+ className="flex shrink-0 items-center gap-0.5"
925
+ >
926
+ {endNavItems.length > 0 ? (
927
+ <TooltipProvider
928
+ delayDuration={200}
929
+ skipDelayDuration={0}
930
+ >
931
+ <div className="flex items-center gap-0.5">
932
+ {endNavItems.map((item) => (
933
+ <TopBarEndItem
934
+ key={item.path}
935
+ item={item}
936
+ label={resolveNavLabel(item.label, currentLanguage) || item.path || ''}
937
+ activePathPrefix={activePathPrefix}
938
+ />
939
+ ))}
940
+ </div>
941
+ </TooltipProvider>
942
+ ) : null}
943
+ <LoginButton
944
+ variant="appbar"
945
+ hideWhenLoggedOut={hasCustomLoginNav}
946
+ />
947
+ </div>
948
+ </header>
949
+ {isInset ? <InsetMobileRadiusOverlay /> : null}
950
+ </div>
951
+ ) : (
952
+ <header
953
+ className={cn(
954
+ 'relative z-[46] flex w-full shrink-0 items-center gap-1.5 text-sidebar-foreground select-none',
955
+ isInset
956
+ ? 'border-b border-transparent bg-transparent'
957
+ : 'border-b border-sidebar-border bg-sidebar',
958
+ )}
959
+ style={headerStyle}
960
+ data-layout={isInset ? 'app-bar-inset' : 'app-bar'}
961
+ {...(trafficLights
895
962
  ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
896
963
  : {})}
897
- />
898
-
899
- <div
900
- data-shellui-no-drag=""
901
- className="flex shrink-0 items-center gap-0.5"
902
964
  >
903
- {endNavItems.length > 0 ? (
904
- <TooltipProvider
905
- delayDuration={200}
906
- skipDelayDuration={0}
965
+ {appIcon ? (
966
+ <AppBrandIcon
967
+ appIcon={appIcon}
968
+ title={title}
969
+ data-shellui-no-drag=""
970
+ className="mr-1 shrink-0"
971
+ imgClassName="app-bar-app-icon size-6"
972
+ />
973
+ ) : null}
974
+
975
+ {hasStartNav ? (
976
+ <AppBarNav
977
+ sections={startSections}
978
+ activePathPrefix={activePathPrefix}
979
+ currentLanguage={currentLanguage}
980
+ />
981
+ ) : (
982
+ <div className="min-w-0 flex-1" />
983
+ )}
984
+
985
+ {isTauriRuntime ? (
986
+ <div
987
+ data-shellui-no-drag=""
988
+ className="shrink-0"
907
989
  >
908
- <div className="flex items-center gap-0.5">
909
- {endNavItems.map((item) => (
910
- <TopBarEndItem
911
- key={item.path}
912
- item={item}
913
- label={resolveNavLabel(item.label, currentLanguage) || item.path || ''}
914
- activePathPrefix={activePathPrefix}
915
- />
916
- ))}
917
- </div>
918
- </TooltipProvider>
990
+ <DesktopHistoryButtons />
991
+ </div>
919
992
  ) : null}
920
- <LoginButton
921
- variant="appbar"
922
- hideWhenLoggedOut={hasCustomLoginNav}
993
+
994
+ <div
995
+ aria-hidden
996
+ className="min-h-full min-w-[8px] shrink-0 grow-0 basis-2"
997
+ {...(trafficLights || overlay
998
+ ? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
999
+ : {})}
923
1000
  />
924
- </div>
925
- </header>
1001
+
1002
+ <div
1003
+ data-shellui-no-drag=""
1004
+ className="flex shrink-0 items-center gap-0.5"
1005
+ >
1006
+ {endNavItems.length > 0 ? (
1007
+ <TooltipProvider
1008
+ delayDuration={200}
1009
+ skipDelayDuration={0}
1010
+ >
1011
+ <div className="flex items-center gap-0.5">
1012
+ {endNavItems.map((item) => (
1013
+ <TopBarEndItem
1014
+ key={item.path}
1015
+ item={item}
1016
+ label={resolveNavLabel(item.label, currentLanguage) || item.path || ''}
1017
+ activePathPrefix={activePathPrefix}
1018
+ />
1019
+ ))}
1020
+ </div>
1021
+ </TooltipProvider>
1022
+ ) : null}
1023
+ <LoginButton
1024
+ variant="appbar"
1025
+ hideWhenLoggedOut={hasCustomLoginNav}
1026
+ />
1027
+ </div>
1028
+ </header>
1029
+ )}
926
1030
 
927
1031
  <main
928
1032
  className={cn(
929
1033
  'flex min-h-0 flex-1 flex-col overflow-hidden',
930
- // Desktop inset: float the content frame on the chrome tray (same as sidebar-inset).
931
- // `md:mx-3` (12px) must match `insetFramePadPx` on the header above.
1034
+ // Mobile inset: full-bleed iframe; radius is a non-interactive overlay.
1035
+ // Desktop inset: padded rounded card below the in-flow header.
932
1036
  isInset &&
933
- 'bg-background md:mx-3 md:mb-3 md:rounded-2xl md:border md:border-border md:shadow-sm',
1037
+ !isMobile &&
1038
+ 'relative bg-background md:mx-3 md:mb-3 md:rounded-2xl md:border md:border-border md:shadow-sm',
934
1039
  )}
935
1040
  >
936
1041
  <Outlet />
@@ -1,18 +1,31 @@
1
1
  import { useEffect } from 'react';
2
2
  import { ContentDragOverlay } from './ContentDragOverlay';
3
- import { useIsTauriClient, useMacTrafficLights } from './runtime';
3
+ import {
4
+ syncShelluiHostAttribute,
5
+ useIsHomeScreenPwa,
6
+ useIsTauriClient,
7
+ useIsTauriRuntime,
8
+ useMacTrafficLights,
9
+ } from './runtime';
4
10
 
5
11
  /**
6
- * Global Tauri desktop chrome: document flags + the 42px top drag strip.
12
+ * Global shell host chrome: document flags + the 42px Tauri drag strip.
7
13
  * Mounted at the app root so it stays available on every page (layouts, login,
8
14
  * settings, route error boundary, empty config) — including narrow/mobile widths.
15
+ *
16
+ * Sets `data-shellui-host` to `browser` | `pwa` | `tauri` so CSS / layout can
17
+ * distinguish Safari Home Screen PWAs (iOS 27 system status gradient) from
18
+ * Tauri WKWebView (native-controlled chrome + CSS safe-area).
9
19
  */
10
20
  export function DesktopChrome() {
11
21
  const isTauriEnv = useIsTauriClient();
22
+ const tauriRuntime = useIsTauriRuntime();
23
+ const homeScreenPwa = useIsHomeScreenPwa();
12
24
  const trafficLights = useMacTrafficLights();
13
25
 
14
26
  useEffect(() => {
15
27
  const root = document.documentElement;
28
+ syncShelluiHostAttribute();
16
29
  if (trafficLights) root.setAttribute('data-shellui-overlay-chrome', '');
17
30
  else root.removeAttribute('data-shellui-overlay-chrome');
18
31
  if (isTauriEnv) root.setAttribute('data-shellui-tauri', '');
@@ -20,8 +33,9 @@ export function DesktopChrome() {
20
33
  return () => {
21
34
  root.removeAttribute('data-shellui-overlay-chrome');
22
35
  root.removeAttribute('data-shellui-tauri');
36
+ root.removeAttribute('data-shellui-host');
23
37
  };
24
- }, [trafficLights, isTauriEnv]);
38
+ }, [trafficLights, isTauriEnv, tauriRuntime, homeScreenPwa]);
25
39
 
26
40
  if (!trafficLights) return null;
27
41
  return <ContentDragOverlay />;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Mobile inset “card” personality without resizing the iframe.
3
+ *
4
+ * Paints chrome-colored corner wedges + a top radius/border over full-bleed
5
+ * content via a box-shadow cutout. Clicks pass through. Hides with the top bar
6
+ * on scroll so flush-style stable `--shellui-inset-top` stays smooth.
7
+ */
8
+ export function InsetMobileRadiusOverlay() {
9
+ return (
10
+ <div
11
+ aria-hidden
12
+ data-shellui-inset-radius-overlay=""
13
+ className="pointer-events-none absolute inset-0 md:hidden"
14
+ >
15
+ <div data-shellui-inset-radius-cutout="" />
16
+ </div>
17
+ );
18
+ }
@@ -17,10 +17,16 @@ export {
17
17
  useIsTauriClient,
18
18
  useIsTauriRuntime,
19
19
  useIsTauriFullscreen,
20
+ useIsHomeScreenPwa,
20
21
  useMacOverlayChrome,
21
22
  useMacTrafficLights,
22
23
  isMacOSDesktop,
23
24
  isTauriRuntime,
25
+ isStandaloneDisplayMode,
26
+ isHomeScreenPwa,
27
+ getShelluiHostKind,
28
+ syncShelluiHostAttribute,
29
+ type ShelluiHostKind,
24
30
  } from './runtime';
25
31
  export { DesktopBackButton } from './DesktopBackButton';
26
32
  export { DesktopForwardButton } from './DesktopForwardButton';
@@ -29,3 +35,5 @@ export { ContentDragOverlay } from './ContentDragOverlay';
29
35
  export { DesktopChrome } from './DesktopChrome';
30
36
  export { CollapsedDesktopTitlebar } from './CollapsedDesktopTitlebar';
31
37
  export { isShellUiRootWindow, SafeAreaTopbarOffset, SafeAreaTopbarStrip } from './SafeAreaTopbar';
38
+ export { useScrollHideChrome, type ScrollHideLayoutId } from './useScrollHideChrome';
39
+ export { InsetMobileRadiusOverlay } from './InsetMobileRadiusOverlay';
@@ -27,6 +27,10 @@ function getTauriInternals(): TauriInternals | null {
27
27
  * Unlike `isTauri()`, this ignores the CLI `--target tauri` build flag
28
28
  * (`__SHELLUI_TAURI__`) so a browser tab opened against the same URL does not
29
29
  * get traffic-light padding.
30
+ *
31
+ * Use this for native-specific UI (macOS traffic lights, iOS App Store WKWebView
32
+ * adjustments). Prefer over `isTauri()` whenever behavior must differ between a
33
+ * live native shell and a browser tab of a tauri-targeted build.
30
34
  */
31
35
  export function isTauriRuntime(): boolean {
32
36
  if (typeof window === 'undefined') return false;
@@ -37,6 +41,50 @@ export function isTauriRuntime(): boolean {
37
41
  return !!(w.__TAURI__ ?? w.__TAURI_INTERNALS__);
38
42
  }
39
43
 
44
+ /**
45
+ * Installed web app display mode (Safari "Add to Home Screen", Android TWA, etc.).
46
+ * Includes `navigator.standalone` for older iOS. Does not imply Tauri.
47
+ */
48
+ export function isStandaloneDisplayMode(): boolean {
49
+ if (typeof window === 'undefined') return false;
50
+ const nav = window.navigator as Navigator & { standalone?: boolean };
51
+ if (nav.standalone === true) return true;
52
+ try {
53
+ return window.matchMedia('(display-mode: standalone)').matches;
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Safari / Android Home Screen PWA — not a Tauri native WKWebView.
61
+ *
62
+ * iOS 26/27 applies Liquid Glass status-bar sampling / gradients only to these
63
+ * standalone web apps. Tauri iOS hosts the same React UI in a native webview and
64
+ * does not get that Home Screen PWA system treatment — gate PWA-only chrome
65
+ * workarounds with this helper, not with `isTauri()` alone.
66
+ */
67
+ export function isHomeScreenPwa(): boolean {
68
+ return isStandaloneDisplayMode() && !isTauriRuntime();
69
+ }
70
+
71
+ /** How the shell is hosted: browser tab, installed PWA, or Tauri native. */
72
+ export type ShelluiHostKind = 'browser' | 'pwa' | 'tauri';
73
+
74
+ export function getShelluiHostKind(): ShelluiHostKind {
75
+ if (isTauriRuntime()) return 'tauri';
76
+ if (isStandaloneDisplayMode()) return 'pwa';
77
+ return 'browser';
78
+ }
79
+
80
+ /** Sync `html[data-shellui-host]` for CSS / debugging. */
81
+ export function syncShelluiHostAttribute(): ShelluiHostKind {
82
+ if (typeof document === 'undefined') return 'browser';
83
+ const kind = getShelluiHostKind();
84
+ document.documentElement.setAttribute('data-shellui-host', kind);
85
+ return kind;
86
+ }
87
+
40
88
  function currentWindowLabel(internals: TauriInternals): string {
41
89
  return internals.metadata?.currentWindow?.label || 'main';
42
90
  }
@@ -114,6 +162,31 @@ export function useIsTauriRuntime(): boolean {
114
162
  return value;
115
163
  }
116
164
 
165
+ /** Home Screen / installed PWA (excludes Tauri native). */
166
+ export function useIsHomeScreenPwa(): boolean {
167
+ const [value, setValue] = useState(() => isHomeScreenPwa());
168
+
169
+ useEffect(() => {
170
+ const sync = () => setValue(isHomeScreenPwa());
171
+ sync();
172
+ // Late __TAURI__ injection can flip PWA → tauri in the same document.
173
+ const timer = window.setTimeout(sync, 200);
174
+ let mql: MediaQueryList | undefined;
175
+ try {
176
+ mql = window.matchMedia('(display-mode: standalone)');
177
+ mql.addEventListener('change', sync);
178
+ } catch {
179
+ /* ignore */
180
+ }
181
+ return () => {
182
+ window.clearTimeout(timer);
183
+ mql?.removeEventListener('change', sync);
184
+ };
185
+ }, []);
186
+
187
+ return value;
188
+ }
189
+
117
190
  /**
118
191
  * Native window fullscreen (Tauri `is_fullscreen` + resize listener).
119
192
  * Resize can fire before macOS updates fullscreen state, so we re-check after a short delay.