@shellui/core 0.5.0-beta.2 → 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.
- package/README.md +5 -5
- package/package.json +3 -2
- package/schemas/shellui.config.schema.json +10 -2
- package/src/app.tsx +8 -4
- package/src/components/ContentView.tsx +12 -5
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/dialog.tsx +5 -1
- package/src/components/ui/dropdown-menu.tsx +39 -4
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +60 -20
- package/src/components/ui/tabs.tsx +52 -0
- package/src/constants/urls.ts +1 -0
- package/src/features/auth/AuthProvider.tsx +17 -6
- package/src/features/chromeActions/ChromeActionIcons.tsx +261 -0
- package/src/features/chromeActions/ChromeActionsDemoView.tsx +149 -0
- package/src/features/chromeActions/ChromeActionsHost.tsx +1511 -0
- package/src/features/chromeActions/ChromeActionsProvider.tsx +141 -0
- package/src/features/chromeActions/chromeActionsStore.spec.ts +61 -0
- package/src/features/chromeActions/chromeActionsStore.ts +77 -0
- package/src/features/chromeActions/computeActionInsets.spec.ts +360 -0
- package/src/features/chromeActions/computeActionInsets.ts +326 -0
- package/src/features/chromeActions/index.ts +26 -0
- package/src/features/chromeActions/resolveUuidForRemoveIframe.spec.ts +49 -0
- package/src/features/config/types.ts +16 -2
- package/src/features/layouts/AppLayout.tsx +30 -3
- package/src/features/layouts/OverlayShell.tsx +63 -13
- package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +22 -0
- package/src/features/layouts/appbar/AppBarLayout.tsx +230 -86
- package/src/features/layouts/chrome/DesktopChrome.tsx +17 -3
- package/src/features/layouts/chrome/InsetMobileRadiusOverlay.tsx +18 -0
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/runtime.ts +73 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +210 -0
- package/src/features/layouts/floating/FloatingBottomDock.tsx +410 -0
- package/src/features/layouts/floating/FloatingLayout.tsx +152 -0
- package/src/features/layouts/floating/FloatingSidebar.tsx +327 -0
- package/src/features/layouts/floating/FloatingStatusScrim.tsx +36 -0
- package/src/features/layouts/floating/computeFloatingInsets.spec.ts +83 -0
- package/src/features/layouts/floating/computeFloatingInsets.ts +155 -0
- package/src/features/layouts/floating/isShellOwnedPath.spec.ts +25 -0
- package/src/features/layouts/floating/isShellOwnedPath.ts +17 -0
- package/src/features/layouts/floating/layoutChromeStore.spec.ts +138 -0
- package/src/features/layouts/floating/layoutChromeStore.ts +209 -0
- package/src/features/layouts/floating/scrollChrome.spec.ts +49 -0
- package/src/features/layouts/floating/useFloatingChrome.ts +206 -0
- package/src/features/layouts/sidebar/SidebarLayout.tsx +119 -37
- package/src/features/layouts/sidebar/types.ts +4 -0
- package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +15 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +240 -110
- package/src/features/overlays/ResponsiveModal.tsx +201 -21
- package/src/features/overlays/overlaySize.spec.ts +18 -0
- package/src/features/overlays/overlaySize.ts +89 -0
- package/src/features/settings/SettingsProvider.tsx +36 -9
- package/src/features/settings/SettingsView.tsx +6 -6
- package/src/features/settings/components/Develop.tsx +33 -13
- package/src/features/settings/components/develop/ChromeActionsTestButtons.tsx +63 -0
- package/src/features/settings/utils/buildSettingsForPropagation.ts +16 -0
- package/src/features/storage/StoragePickerContext.tsx +1 -0
- package/src/features/storage/uploads/uploadQueue.spec.ts +56 -1
- package/src/features/storage/uploads/uploadQueue.ts +42 -1
- package/src/features/theme/applyTheme.ts +23 -5
- package/src/hooks/use-mobile.tsx +21 -7
- package/src/hooks/use-viewport.ts +40 -0
- package/src/i18n/translations/en/settings.json +17 -2
- package/src/i18n/translations/fr/settings.json +17 -2
- package/src/index.css +473 -12
- package/src/index.html +6 -4
- package/src/index.ts +8 -0
- package/src/routes/components/RouteFallback.tsx +21 -2
- package/src/routes/routes.tsx +14 -0
|
@@ -51,22 +51,25 @@ 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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
import { MAC_TRAFFIC_LIGHTS_GAP_PX, MAC_TRAFFIC_LIGHTS_WIDTH_PX } from '../chrome/constants';
|
|
58
|
+
|
|
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;
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
const APP_BAR_HEIGHT_PX = DESKTOP_TITLEBAR_HEIGHT_PX;
|
|
64
|
+
export type AppBarChromeVariant = 'app-bar' | 'inset';
|
|
64
65
|
|
|
65
66
|
interface AppBarLayoutProps {
|
|
66
67
|
title?: string;
|
|
67
68
|
appIcon?: ThemeAsset;
|
|
68
69
|
logo?: ThemeAsset;
|
|
69
70
|
navigation: (NavigationItem | NavigationGroup)[];
|
|
71
|
+
/** Visual chrome: default flush app-bar, or inset padded/rounded main frame. */
|
|
72
|
+
variant?: AppBarChromeVariant;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
type NavSection =
|
|
@@ -235,12 +238,12 @@ function AppBarItemIcon({ item, label }: { item: NavigationItem; label: string }
|
|
|
235
238
|
|
|
236
239
|
const navTriggerClass = (active: boolean) =>
|
|
237
240
|
cn(
|
|
238
|
-
// h-
|
|
239
|
-
'inline-flex h-
|
|
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',
|
|
240
243
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
241
244
|
active
|
|
242
245
|
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
243
|
-
: 'text-sidebar-foreground/85 hover:bg-sidebar-accent
|
|
246
|
+
: 'text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-foreground',
|
|
244
247
|
);
|
|
245
248
|
|
|
246
249
|
/** Text link / action used in the bar (not inside a dropdown). */
|
|
@@ -366,7 +369,7 @@ function AppBarNavCategory({
|
|
|
366
369
|
type="button"
|
|
367
370
|
variant="ghost"
|
|
368
371
|
size="sm"
|
|
369
|
-
className={cn(navTriggerClass(active)
|
|
372
|
+
className={cn(navTriggerClass(active))}
|
|
370
373
|
aria-expanded={open}
|
|
371
374
|
>
|
|
372
375
|
<span className="truncate">{label}</span>
|
|
@@ -418,7 +421,7 @@ function AppBarNavMore({
|
|
|
418
421
|
type="button"
|
|
419
422
|
variant="ghost"
|
|
420
423
|
size="sm"
|
|
421
|
-
className={cn(navTriggerClass(moreActive)
|
|
424
|
+
className={cn(navTriggerClass(moreActive))}
|
|
422
425
|
aria-label={t('desktopChrome.more')}
|
|
423
426
|
aria-expanded={open}
|
|
424
427
|
>
|
|
@@ -685,10 +688,10 @@ function TopBarEndItem({
|
|
|
685
688
|
);
|
|
686
689
|
|
|
687
690
|
const buttonClass = cn(
|
|
688
|
-
'flex size-
|
|
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',
|
|
689
692
|
isActive
|
|
690
693
|
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
691
|
-
: 'text-muted-foreground hover:bg-sidebar-accent
|
|
694
|
+
: 'text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground',
|
|
692
695
|
);
|
|
693
696
|
|
|
694
697
|
const wrap = (node: ReactNode) => <AppBarTooltip label={label}>{node}</AppBarTooltip>;
|
|
@@ -741,7 +744,12 @@ function TopBarEndItem({
|
|
|
741
744
|
);
|
|
742
745
|
}
|
|
743
746
|
|
|
744
|
-
export function AppBarLayout({
|
|
747
|
+
export function AppBarLayout({
|
|
748
|
+
title,
|
|
749
|
+
appIcon,
|
|
750
|
+
navigation,
|
|
751
|
+
variant = 'app-bar',
|
|
752
|
+
}: AppBarLayoutProps) {
|
|
745
753
|
const { i18n } = useTranslation();
|
|
746
754
|
const { isAuthenticated } = useAuth();
|
|
747
755
|
const { settings } = useSettings();
|
|
@@ -751,7 +759,17 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
751
759
|
const overlay = useMacOverlayChrome();
|
|
752
760
|
const trafficLights = useMacTrafficLights();
|
|
753
761
|
const currentLanguage = i18n.language || 'en';
|
|
762
|
+
const isInset = variant === 'inset';
|
|
754
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
|
+
});
|
|
755
773
|
const authAwareNavigation = useMemo(
|
|
756
774
|
() =>
|
|
757
775
|
filterNavigationForAuthState(navigation, isAuthenticated, settings.developerFeatures.enabled),
|
|
@@ -798,102 +816,228 @@ export function AppBarLayout({ title, appIcon, navigation }: AppBarLayoutProps)
|
|
|
798
816
|
: undefined;
|
|
799
817
|
|
|
800
818
|
const hasStartNav = startSections.some((s) => s.items.length > 0);
|
|
801
|
-
//
|
|
802
|
-
|
|
819
|
+
// Keep in sync with <main> inset frame pad — bar content aligns to the card border.
|
|
820
|
+
// Extra inset from the frame edge: 20px left (brand/nav), 10px right (end links already have control padding).
|
|
821
|
+
// Mobile inset is full-bleed (top radius only); desktop uses 12px (md:mx-3).
|
|
822
|
+
const insetFramePadPx = isMobile ? 0 : 12;
|
|
823
|
+
const insetBarContentOffsetLeftPx = 20;
|
|
824
|
+
const insetBarContentOffsetRightPx = 10;
|
|
803
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.
|
|
804
827
|
const headerStyle = {
|
|
805
|
-
paddingLeft:
|
|
806
|
-
|
|
828
|
+
paddingLeft: isInset
|
|
829
|
+
? isMobile
|
|
830
|
+
? (chromeInset ?? 12)
|
|
831
|
+
: (chromeInset ?? insetFramePadPx) + insetBarContentOffsetLeftPx
|
|
832
|
+
: (chromeInset ?? 12),
|
|
833
|
+
paddingRight: isInset ? (isMobile ? 8 : insetFramePadPx + insetBarContentOffsetRightPx) : 8,
|
|
807
834
|
...(isMobile && showSafeAreaTopbar
|
|
808
835
|
? {
|
|
809
|
-
paddingTop: `calc(var(--shellui-safe-area-top) + ${
|
|
836
|
+
paddingTop: `calc(var(--shellui-safe-area-top) + ${APP_BAR_PAD_TOP_PX}px)`,
|
|
810
837
|
height: `calc(${APP_BAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`,
|
|
811
838
|
}
|
|
812
839
|
: {
|
|
813
840
|
height: APP_BAR_HEIGHT_PX,
|
|
814
|
-
paddingTop:
|
|
841
|
+
paddingTop: APP_BAR_PAD_TOP_PX,
|
|
815
842
|
}),
|
|
816
843
|
} as const;
|
|
817
844
|
|
|
818
845
|
return (
|
|
819
846
|
<div
|
|
820
847
|
data-shellui-app-bar-layout=""
|
|
821
|
-
|
|
848
|
+
data-shellui-layout-variant={variant}
|
|
849
|
+
className={cn(
|
|
850
|
+
'relative flex h-full max-h-full flex-col overflow-hidden',
|
|
851
|
+
isInset ? 'bg-shellui-inset-chrome' : 'bg-background',
|
|
852
|
+
)}
|
|
822
853
|
>
|
|
823
854
|
<SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
|
|
824
|
-
<SafeAreaTopbarStrip
|
|
825
|
-
|
|
826
|
-
className=
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
855
|
+
<SafeAreaTopbarStrip
|
|
856
|
+
enabled={showSafeAreaTopbar}
|
|
857
|
+
className={
|
|
858
|
+
isInset ? '[&>div]:border-transparent [&>div]:bg-shellui-inset-chrome' : undefined
|
|
859
|
+
}
|
|
860
|
+
/>
|
|
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}
|
|
840
894
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
895
|
+
{hasStartNav ? (
|
|
896
|
+
<AppBarNav
|
|
897
|
+
sections={startSections}
|
|
898
|
+
activePathPrefix={activePathPrefix}
|
|
899
|
+
currentLanguage={currentLanguage}
|
|
900
|
+
/>
|
|
901
|
+
) : (
|
|
902
|
+
<div className="min-w-0 flex-1" />
|
|
903
|
+
)}
|
|
850
904
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
905
|
+
{isTauriRuntime ? (
|
|
906
|
+
<div
|
|
907
|
+
data-shellui-no-drag=""
|
|
908
|
+
className="shrink-0"
|
|
909
|
+
>
|
|
910
|
+
<DesktopHistoryButtons />
|
|
911
|
+
</div>
|
|
912
|
+
) : null}
|
|
859
913
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
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
|
|
864
962
|
? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
|
|
865
963
|
: {})}
|
|
866
|
-
/>
|
|
867
|
-
|
|
868
|
-
<div
|
|
869
|
-
data-shellui-no-drag=""
|
|
870
|
-
className="flex shrink-0 items-center gap-0.5"
|
|
871
964
|
>
|
|
872
|
-
{
|
|
873
|
-
<
|
|
874
|
-
|
|
875
|
-
|
|
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"
|
|
876
989
|
>
|
|
877
|
-
<
|
|
878
|
-
|
|
879
|
-
<TopBarEndItem
|
|
880
|
-
key={item.path}
|
|
881
|
-
item={item}
|
|
882
|
-
label={resolveNavLabel(item.label, currentLanguage) || item.path || ''}
|
|
883
|
-
activePathPrefix={activePathPrefix}
|
|
884
|
-
/>
|
|
885
|
-
))}
|
|
886
|
-
</div>
|
|
887
|
-
</TooltipProvider>
|
|
990
|
+
<DesktopHistoryButtons />
|
|
991
|
+
</div>
|
|
888
992
|
) : null}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
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
|
+
: {})}
|
|
892
1000
|
/>
|
|
893
|
-
</div>
|
|
894
|
-
</header>
|
|
895
1001
|
|
|
896
|
-
|
|
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
|
+
)}
|
|
1030
|
+
|
|
1031
|
+
<main
|
|
1032
|
+
className={cn(
|
|
1033
|
+
'flex min-h-0 flex-1 flex-col overflow-hidden',
|
|
1034
|
+
// Mobile inset: full-bleed iframe; radius is a non-interactive overlay.
|
|
1035
|
+
// Desktop inset: padded rounded card below the in-flow header.
|
|
1036
|
+
isInset &&
|
|
1037
|
+
!isMobile &&
|
|
1038
|
+
'relative bg-background md:mx-3 md:mb-3 md:rounded-2xl md:border md:border-border md:shadow-sm',
|
|
1039
|
+
)}
|
|
1040
|
+
>
|
|
897
1041
|
<Outlet />
|
|
898
1042
|
</main>
|
|
899
1043
|
</div>
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { ContentDragOverlay } from './ContentDragOverlay';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
syncShelluiHostAttribute,
|
|
5
|
+
useIsHomeScreenPwa,
|
|
6
|
+
useIsTauriClient,
|
|
7
|
+
useIsTauriRuntime,
|
|
8
|
+
useMacTrafficLights,
|
|
9
|
+
} from './runtime';
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
|
-
* Global
|
|
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.
|