@shellui/core 0.5.0-beta.1 → 0.5.0-beta.3

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 (47) hide show
  1. package/package.json +2 -2
  2. package/schemas/shellui.config.schema.json +10 -2
  3. package/src/components/ContentView.tsx +12 -5
  4. package/src/components/ui/alert-dialog.tsx +1 -1
  5. package/src/components/ui/sidebar.tsx +60 -21
  6. package/src/features/admin/AdminView.tsx +31 -2
  7. package/src/features/auth/components/LoginButton.tsx +3 -3
  8. package/src/features/auth/components/LoginView.tsx +74 -28
  9. package/src/features/config/types.ts +16 -2
  10. package/src/features/layouts/AppLayout.tsx +30 -3
  11. package/src/features/layouts/OverlayShell.tsx +3 -1
  12. package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +22 -0
  13. package/src/features/layouts/appbar/AppBarLayout.tsx +98 -33
  14. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +18 -10
  15. package/src/features/layouts/chrome/ContentDragOverlay.tsx +1 -1
  16. package/src/features/layouts/chrome/DesktopChrome.tsx +1 -1
  17. package/src/features/layouts/chrome/SafeAreaTopbar.tsx +48 -0
  18. package/src/features/layouts/chrome/constants.ts +7 -1
  19. package/src/features/layouts/chrome/index.ts +5 -0
  20. package/src/features/layouts/chrome/runtime.ts +157 -7
  21. package/src/features/layouts/floating/FloatingFadeMask.tsx +22 -0
  22. package/src/features/layouts/floating/FloatingLayout.tsx +142 -0
  23. package/src/features/layouts/floating/FloatingSidebar.tsx +327 -0
  24. package/src/features/layouts/floating/FloatingTabBar.tsx +437 -0
  25. package/src/features/layouts/floating/FloatingTabIndicator.tsx +216 -0
  26. package/src/features/layouts/floating/computeFloatingInsets.spec.ts +83 -0
  27. package/src/features/layouts/floating/computeFloatingInsets.ts +103 -0
  28. package/src/features/layouts/floating/isShellOwnedPath.spec.ts +23 -0
  29. package/src/features/layouts/floating/isShellOwnedPath.ts +16 -0
  30. package/src/features/layouts/floating/layoutChromeStore.ts +46 -0
  31. package/src/features/layouts/floating/scrollChrome.spec.ts +49 -0
  32. package/src/features/layouts/floating/useFloatingChrome.ts +216 -0
  33. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +9 -4
  34. package/src/features/layouts/sidebar/SidebarInner.tsx +25 -29
  35. package/src/features/layouts/sidebar/SidebarLayout.tsx +41 -36
  36. package/src/features/layouts/sidebar/types.ts +4 -0
  37. package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +15 -0
  38. package/src/features/settings/SettingsProvider.tsx +7 -0
  39. package/src/features/settings/SettingsView.tsx +6 -6
  40. package/src/features/settings/components/Develop.tsx +31 -13
  41. package/src/features/settings/utils/buildSettingsForPropagation.ts +16 -0
  42. package/src/features/storage/StoragePickerContext.tsx +1 -0
  43. package/src/hooks/use-viewport.ts +40 -0
  44. package/src/i18n/translations/en/settings.json +8 -2
  45. package/src/i18n/translations/fr/settings.json +8 -2
  46. package/src/index.css +339 -15
  47. package/src/routes/components/RouteFallback.tsx +6 -2
@@ -27,12 +27,19 @@ import { useModal } from '../../modal/ModalContext';
27
27
  import { useDrawer } from '../../drawer/DrawerContext';
28
28
  import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
29
29
  import { CollapsedDesktopTitlebar } from '../chrome/CollapsedDesktopTitlebar';
30
+ import {
31
+ isShellUiRootWindow,
32
+ SafeAreaTopbarOffset,
33
+ SafeAreaTopbarStrip,
34
+ } from '../chrome/SafeAreaTopbar';
30
35
  import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
31
36
  import {
32
37
  MAC_TRAFFIC_LIGHTS_GAP_PX,
33
38
  MAC_TRAFFIC_LIGHTS_WIDTH_PX,
34
39
  DESKTOP_TITLEBAR_HEIGHT_PX,
40
+ DESKTOP_TITLEBAR_PAD_TOP_PX,
35
41
  } from '../chrome/constants';
42
+ import { cn } from '../../../lib/utils';
36
43
 
37
44
  /** Close the mobile sheet when the route changes. */
38
45
  function CloseMobileSidebarOnNavigate() {
@@ -75,27 +82,12 @@ function CollapsedTitlebarOffset() {
75
82
  return null;
76
83
  }
77
84
 
78
- /** True when this window is the outermost shell (not nested in an iframe). */
79
- function isShellUiRootWindow(): boolean {
80
- return typeof window !== 'undefined' && window.parent === window;
81
- }
82
-
83
- /**
84
- * Root sidebar only: advertise the safe-area topbar on <html> so fixed chrome
85
- * (sidebar container, drawers) can clear it. Nested iframe shells skip this.
86
- */
87
- function SafeAreaTopbarOffset({ enabled }: { enabled: boolean }) {
88
- useEffect(() => {
89
- if (!enabled) return;
90
- const root = document.documentElement;
91
- root.setAttribute('data-shellui-safe-area-topbar', '');
92
- return () => root.removeAttribute('data-shellui-safe-area-topbar');
93
- }, [enabled]);
94
-
95
- return null;
96
- }
97
-
98
- const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps) => {
85
+ const SidebarLayoutContent = ({
86
+ title,
87
+ appIcon,
88
+ navigation,
89
+ variant = 'sidebar',
90
+ }: SidebarLayoutProps) => {
99
91
  const { i18n } = useTranslation();
100
92
  const { isAuthenticated } = useAuth();
101
93
  const { settings } = useSettings();
@@ -145,7 +137,12 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
145
137
  return (
146
138
  <div
147
139
  data-shellui-sidebar-layout=""
148
- className="flex h-full max-h-full flex-col overflow-hidden"
140
+ data-shellui-layout-variant={variant}
141
+ className={cn(
142
+ 'flex h-full max-h-full flex-col overflow-hidden',
143
+ // Inset chrome: darkened tray so the main frame (and in-app sidebars) separate cleanly.
144
+ variant === 'inset' && 'bg-shellui-inset-chrome',
145
+ )}
149
146
  >
150
147
  <SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
151
148
  {/*
@@ -153,16 +150,14 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
153
150
  top safe-area, painted with sidebar background. Height is 0 when the inset
154
151
  is 0; overflow clips the border so no stray hairline.
155
152
  */}
156
- {showSafeAreaTopbar ? (
157
- <div
158
- aria-hidden
159
- data-slot="sidebar-safe-area-top"
160
- className="relative z-0 hidden shrink-0 overflow-hidden md:block"
161
- style={{ height: 'var(--shellui-safe-area-top)' }}
162
- >
163
- <div className="box-border h-full border-b border-sidebar-border bg-sidebar" />
164
- </div>
165
- ) : null}
153
+ <SafeAreaTopbarStrip
154
+ enabled={showSafeAreaTopbar}
155
+ className={
156
+ variant === 'inset'
157
+ ? '[&>div]:border-transparent [&>div]:bg-shellui-inset-chrome'
158
+ : undefined
159
+ }
160
+ />
166
161
  <SidebarProvider className="min-h-0 flex-1 overflow-hidden">
167
162
  <CloseMobileSidebarOnNavigate />
168
163
  <CloseMobileSidebarOnOverlay />
@@ -170,6 +165,7 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
170
165
  <CollapsedDesktopTitlebar />
171
166
  <Sidebar
172
167
  collapsible="icon"
168
+ variant={variant}
173
169
  className="border-sidebar-border"
174
170
  >
175
171
  <SidebarInner
@@ -179,10 +175,11 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
179
175
  title={title}
180
176
  appIcon={appIcon}
181
177
  />
182
- <SidebarRail />
178
+ {variant !== 'inset' ? <SidebarRail /> : null}
183
179
  </Sidebar>
184
180
 
185
181
  <SidebarInset className="relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
182
+ {variant === 'inset' ? <SidebarRail placement="inset" /> : null}{' '}
186
183
  {/*
187
184
  Mobile top chrome: extend the header background into the status-bar band
188
185
  so there is no empty strip. Interactive controls stay below the inset via
@@ -192,7 +189,9 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
192
189
  <header
193
190
  className="relative z-[46] flex shrink-0 items-center gap-0.5 border-b border-border bg-background px-3 select-none md:hidden"
194
191
  style={{
195
- paddingTop: showSafeAreaTopbar ? 'var(--shellui-safe-area-top)' : undefined,
192
+ paddingTop: showSafeAreaTopbar
193
+ ? `calc(var(--shellui-safe-area-top) + ${DESKTOP_TITLEBAR_PAD_TOP_PX}px)`
194
+ : DESKTOP_TITLEBAR_PAD_TOP_PX,
196
195
  height: showSafeAreaTopbar
197
196
  ? `calc(${DESKTOP_TITLEBAR_HEIGHT_PX}px + var(--shellui-safe-area-top))`
198
197
  : DESKTOP_TITLEBAR_HEIGHT_PX,
@@ -208,7 +207,6 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
208
207
  />
209
208
  {isTauriEnv ? <DesktopHistoryButtons /> : null}
210
209
  </header>
211
-
212
210
  {/*
213
211
  Fill to the physical bottom — do not pad safe-area here or the iframe
214
212
  looks cut off. In-app content (settings, etc.) owns bottom safe insets.
@@ -222,13 +220,20 @@ const SidebarLayoutContent = ({ title, appIcon, navigation }: SidebarLayoutProps
222
220
  );
223
221
  };
224
222
 
225
- export function SidebarLayout({ title, appIcon, logo, navigation }: SidebarLayoutProps) {
223
+ export function SidebarLayout({
224
+ title,
225
+ appIcon,
226
+ logo,
227
+ navigation,
228
+ variant = 'sidebar',
229
+ }: SidebarLayoutProps) {
226
230
  return (
227
231
  <SidebarLayoutContent
228
232
  title={title}
229
233
  appIcon={appIcon}
230
234
  logo={logo}
231
235
  navigation={navigation}
236
+ variant={variant}
232
237
  />
233
238
  );
234
239
  }
@@ -1,8 +1,12 @@
1
1
  import type { NavigationItem, NavigationGroup, ThemeAsset } from '../../config/types';
2
2
 
3
+ export type SidebarChromeVariant = 'sidebar' | 'inset';
4
+
3
5
  export interface SidebarLayoutProps {
4
6
  title?: string;
5
7
  appIcon?: ThemeAsset;
6
8
  logo?: ThemeAsset;
7
9
  navigation: (NavigationItem | NavigationGroup)[];
10
+ /** Visual chrome: default flush sidebar, or inset padded/rounded main frame. */
11
+ variant?: SidebarChromeVariant;
8
12
  }
@@ -0,0 +1,15 @@
1
+ import { SidebarLayout } from '../sidebar/SidebarLayout';
2
+ import type { SidebarLayoutProps } from '../sidebar/types';
3
+
4
+ /**
5
+ * Sidebar inset layout — same as sidebar, with a padded, rounded main frame that
6
+ * reveals the chrome background around the content area (desktop).
7
+ */
8
+ export function SidebarInsetLayout(props: SidebarLayoutProps) {
9
+ return (
10
+ <SidebarLayout
11
+ {...props}
12
+ variant="inset"
13
+ />
14
+ );
15
+ }
@@ -12,6 +12,7 @@ import type { NavigationItem } from '../config/types';
12
12
  import { useAuth } from '../auth/hooks/useAuth';
13
13
  import { isAdminFrame } from '../admin/utils';
14
14
  import { isFrameForAppUrl } from '../layouts/utils';
15
+ import { isMainLayoutFrame } from '../layouts/floating/layoutChromeStore';
15
16
  import { defaultTheme } from '../theme/themes';
16
17
  import {
17
18
  buildSettingsForPropagation,
@@ -220,6 +221,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
220
221
  const settingsToPropagate = buildSettingsForPropagation(baseSettings, config, lang, {
221
222
  includeAuthAccessToken,
222
223
  accessToken,
224
+ includeLayoutChrome: isMainLayoutFrame(iframe),
223
225
  });
224
226
  shellui.sendMessage({
225
227
  type: 'SHELLUI_SETTINGS',
@@ -235,9 +237,13 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
235
237
  (iframeUuid: string, frameSrc: string, baseSettings: Settings) => {
236
238
  const lang = baseSettings.language?.code || 'en';
237
239
  const includeAuthAccessToken = isTrustedFrameForAuthToken(frameSrc);
240
+ const iframe = shellui.frameRegistry
241
+ .getAllIframes()
242
+ .find(([uuid]) => uuid === iframeUuid)?.[1];
238
243
  const settingsToPropagate = buildSettingsForPropagation(baseSettings, config, lang, {
239
244
  includeAuthAccessToken,
240
245
  accessToken: accessTokenRef.current,
246
+ includeLayoutChrome: isMainLayoutFrame(iframe),
241
247
  });
242
248
  shellui.sendMessage({
243
249
  type: 'SHELLUI_SETTINGS',
@@ -459,6 +465,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
459
465
  const settingsToPropagate = buildSettingsForPropagation(currentSettings, config, lang, {
460
466
  includeAuthAccessToken,
461
467
  accessToken: accessTokenRef.current,
468
+ includeLayoutChrome: isMainLayoutFrame(frame),
462
469
  });
463
470
 
464
471
  // Route through the full parent -> child -> ... -> requester path so deep descendants
@@ -230,7 +230,7 @@ export const SettingsView = () => {
230
230
  }, [navigate]);
231
231
 
232
232
  return (
233
- <div className="flex h-full w-full overflow-hidden items-start">
233
+ <div className="flex h-full w-full overflow-hidden items-start md:pt-[var(--shellui-inset-top,0px)] md:pr-[var(--shellui-inset-right,0px)] md:pb-[var(--shellui-inset-bottom,0px)] md:pl-[var(--shellui-inset-left,0px)]">
234
234
  {/* Desktop settings nav — local provider so this works outside the shell sidebar layout */}
235
235
  <SidebarProvider className="hidden h-full min-h-0 w-auto shrink-0 md:flex">
236
236
  <Sidebar
@@ -276,10 +276,10 @@ export const SettingsView = () => {
276
276
  {isSettingsRoot ? (
277
277
  // Show list of settings pages
278
278
  <div className="flex flex-1 flex-col overflow-y-auto bg-background">
279
- <header className="flex h-16 shrink-0 items-center justify-center px-4 border-b">
279
+ <header className="flex min-h-16 shrink-0 items-center justify-center border-b px-4 pt-[var(--shellui-inset-top,0px)]">
280
280
  <h1 className="text-lg font-semibold">{t('title')}</h1>
281
281
  </header>
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))]">
282
+ <div className="flex flex-1 flex-col gap-6 p-4 pb-[max(1.5rem,calc(1rem+max(var(--shellui-inset-bottom,0px),env(safe-area-inset-bottom,0px))))] pl-[max(1rem,max(var(--shellui-inset-left,0px),env(safe-area-inset-left,0px)))] pr-[max(1rem,max(var(--shellui-inset-right,0px),env(safe-area-inset-right,0px)))]">
283
283
  {groupedRoutes.map((group) => (
284
284
  <div
285
285
  key={group.title}
@@ -333,7 +333,7 @@ export const SettingsView = () => {
333
333
  ) : (
334
334
  // Show selected settings page with back button
335
335
  <div className="flex h-full flex-1 flex-col overflow-hidden">
336
- <header className="flex h-16 shrink-0 items-center gap-2 px-4 border-b">
336
+ <header className="flex min-h-16 shrink-0 items-center gap-2 border-b px-4 pt-[var(--shellui-inset-top,0px)]">
337
337
  <Button
338
338
  variant="ghost"
339
339
  size="icon"
@@ -349,7 +349,7 @@ export const SettingsView = () => {
349
349
  'flex flex-1 flex-col overflow-hidden',
350
350
  selectedItem?.path?.startsWith('app-')
351
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))]',
352
+ : 'gap-4 overflow-y-auto p-4 pt-4 pb-[max(1.5rem,calc(1rem+max(var(--shellui-inset-bottom,0px),env(safe-area-inset-bottom,0px))))] pl-[max(1rem,max(var(--shellui-inset-left,0px),env(safe-area-inset-left,0px)))] pr-[max(1rem,max(var(--shellui-inset-right,0px),env(safe-area-inset-right,0px)))]',
353
353
  )}
354
354
  >
355
355
  <Routes>
@@ -380,7 +380,7 @@ export const SettingsView = () => {
380
380
  {/* Desktop Main Content */}
381
381
  <main className="hidden md:flex h-full flex-1 flex-col overflow-hidden">
382
382
  {selectedItem && (
383
- <header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear">
383
+ <header className="flex min-h-16 shrink-0 items-center gap-2 pt-[var(--shellui-inset-top,0px)] transition-[width,height] ease-linear">
384
384
  <div className="flex items-center gap-2 px-4">
385
385
  <Breadcrumb>
386
386
  <BreadcrumbList>
@@ -18,14 +18,15 @@ import { DrawerTestButtons } from './develop/DrawerTestButtons';
18
18
  import { StoragePickerTestButtons } from './develop/StoragePickerTestButtons';
19
19
  import { captureException } from '../../sentry/initSentry';
20
20
  import { useCookieConsent } from '../../cookieConsent/useCookieConsent';
21
- import type { LayoutType } from '../../config/types';
21
+ import { normalizeLayoutType, type LayoutType } from '../../config/types';
22
22
 
23
23
  export const Develop = () => {
24
24
  const { t } = useTranslation('settings');
25
25
  const { settings, updateSetting } = useSettings();
26
26
  const { config } = useConfig();
27
27
  const currentLanguage = settings.language?.code || 'en';
28
- const effectiveLayout: LayoutType = settings.layout ?? config?.layout ?? 'sidebar';
28
+ const effectiveLayout: LayoutType =
29
+ normalizeLayoutType(settings.layout ?? config?.layout) ?? 'sidebar';
29
30
  const navItems = config?.navigation?.length
30
31
  ? flattenNavigationItems(config?.navigation ?? []).filter(
31
32
  (item, index, self) => index === self.findIndex((i) => i.path === item.path),
@@ -151,17 +152,34 @@ export const Develop = () => {
151
152
  >
152
153
  {t('develop.layout.title')}
153
154
  </h3>
154
- <div className="flex flex-wrap gap-2">
155
- {(['sidebar', 'app-bar', 'windows'] as const).map((layoutMode) => (
156
- <Button
157
- key={layoutMode}
158
- variant={effectiveLayout === layoutMode ? 'default' : 'outline'}
159
- size="sm"
160
- onClick={() => updateSetting('layout', layoutMode as LayoutType)}
161
- >
162
- {t(`develop.layout.${layoutMode}`)}
163
- </Button>
164
- ))}
155
+ <p className="mb-3 text-sm text-muted-foreground">{t('develop.layout.description')}</p>
156
+ <div
157
+ role="group"
158
+ aria-label={t('develop.layout.title')}
159
+ className="inline-flex max-w-full flex-wrap gap-1 rounded-xl border border-border/70 bg-muted/40 p-1"
160
+ >
161
+ {(
162
+ ['sidebar', 'sidebar-inset', 'app-bar', 'app-bar-inset', 'floating', 'windows'] as const
163
+ ).map((layoutMode) => {
164
+ const active = effectiveLayout === layoutMode;
165
+ return (
166
+ <Button
167
+ key={layoutMode}
168
+ type="button"
169
+ variant="ghost"
170
+ size="sm"
171
+ aria-pressed={active}
172
+ className={
173
+ active
174
+ ? 'bg-background text-foreground shadow-sm hover:bg-background'
175
+ : 'text-muted-foreground hover:bg-transparent hover:text-foreground'
176
+ }
177
+ onClick={() => updateSetting('layout', layoutMode as LayoutType)}
178
+ >
179
+ {t(`develop.layout.${layoutMode}`)}
180
+ </Button>
181
+ );
182
+ })}
165
183
  </div>
166
184
  </div>
167
185
 
@@ -4,6 +4,7 @@ import { flattenNavigationItems } from './flattenNavigationItems';
4
4
  import { getAvailableThemesForSettings } from './getAvailableThemesForSettings';
5
5
  import { getResolvedAppearanceForSettings } from './getResolvedAppearanceForSettings';
6
6
  import { resolveLabel } from './resolveLabel';
7
+ import { getPublishedLayoutChrome } from '../../layouts/floating/layoutChromeStore';
7
8
 
8
9
  /**
9
10
  * Build settings for propagation to iframes: inject navigation, full theme object,
@@ -16,6 +17,8 @@ export const buildSettingsForPropagation = (
16
17
  options?: {
17
18
  includeAuthAccessToken?: boolean;
18
19
  accessToken?: string | null;
20
+ /** When false, omit layoutChrome (modal / drawer frames). Default true. */
21
+ includeLayoutChrome?: boolean;
19
22
  },
20
23
  ): Settings => {
21
24
  const appearance = getResolvedAppearanceForSettings(settings, config);
@@ -24,6 +27,19 @@ export const buildSettingsForPropagation = (
24
27
  appearance: appearance ?? settings.appearance,
25
28
  };
26
29
 
30
+ if (options?.includeLayoutChrome !== false) {
31
+ const layoutChrome = getPublishedLayoutChrome();
32
+ if (layoutChrome) {
33
+ result = { ...result, layoutChrome };
34
+ } else if ('layoutChrome' in result) {
35
+ const { layoutChrome: _removed, ...rest } = result;
36
+ result = rest;
37
+ }
38
+ } else if ('layoutChrome' in result) {
39
+ const { layoutChrome: _removed, ...rest } = result;
40
+ result = rest;
41
+ }
42
+
27
43
  // Inject available themes when we have a resolved appearance (themes are already registered above)
28
44
  if (result.appearance && typeof window !== 'undefined') {
29
45
  result = {
@@ -203,6 +203,7 @@ export const StoragePickerProvider = ({ children }: StoragePickerProviderProps)
203
203
  url={pending.url}
204
204
  pathPrefix="storage-picker"
205
205
  ignoreMessages={true}
206
+ layoutChrome={false}
206
207
  navItem={pickerNavItem}
207
208
  />
208
209
  </div>
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+
3
+ /** Matches Tailwind `md` (tablet and up). */
4
+ export const VIEWPORT_MOBILE_MAX = 767;
5
+ /** Matches Tailwind `lg` (desktop and up). */
6
+ export const VIEWPORT_TABLET_MAX = 1023;
7
+
8
+ export type ShellViewport = 'mobile' | 'tablet' | 'desktop';
9
+
10
+ export function resolveViewport(width: number): ShellViewport {
11
+ if (width <= VIEWPORT_MOBILE_MAX) return 'mobile';
12
+ if (width <= VIEWPORT_TABLET_MAX) return 'tablet';
13
+ return 'desktop';
14
+ }
15
+
16
+ /** Reactive viewport tier: mobile (&lt;768), tablet (768–1023), desktop (≥1024). */
17
+ export function useViewport(): ShellViewport {
18
+ const [viewport, setViewport] = React.useState<ShellViewport>(() =>
19
+ typeof window !== 'undefined' ? resolveViewport(window.innerWidth) : 'desktop',
20
+ );
21
+
22
+ React.useEffect(() => {
23
+ const sync = () => setViewport(resolveViewport(window.innerWidth));
24
+ const mobileMql = window.matchMedia(`(max-width: ${VIEWPORT_MOBILE_MAX}px)`);
25
+ const tabletMql = window.matchMedia(
26
+ `(min-width: ${VIEWPORT_MOBILE_MAX + 1}px) and (max-width: ${VIEWPORT_TABLET_MAX}px)`,
27
+ );
28
+ mobileMql.addEventListener('change', sync);
29
+ tabletMql.addEventListener('change', sync);
30
+ window.addEventListener('resize', sync);
31
+ sync();
32
+ return () => {
33
+ mobileMql.removeEventListener('change', sync);
34
+ tabletMql.removeEventListener('change', sync);
35
+ window.removeEventListener('resize', sync);
36
+ };
37
+ }, []);
38
+
39
+ return viewport;
40
+ }
@@ -271,10 +271,16 @@
271
271
  },
272
272
  "layout": {
273
273
  "title": "Layout",
274
- "description": "Switch between sidebar layout and windows (taskbar) layout. This overrides the app config for this session.",
274
+ "description": "Switch between sidebar, inset, app bar, floating, and windows layouts. This overrides the app config for this session.",
275
275
  "sidebar": "Sidebar",
276
+ "sidebar-inset": "Sidebar inset",
276
277
  "windows": "Windows (experimental)",
277
- "app-bar": "App bar"
278
+ "app-bar": "App bar",
279
+ "app-bar-inset": "App bar inset",
280
+ "floating": "Floating",
281
+ "more": "More",
282
+ "hideSidebar": "Hide sidebar",
283
+ "showSidebar": "Show sidebar"
278
284
  },
279
285
  "logging": {
280
286
  "title": "Logging",
@@ -271,10 +271,16 @@
271
271
  },
272
272
  "layout": {
273
273
  "title": "Disposition",
274
- "description": "Basculer entre la disposition avec barre latérale et la disposition fenêtres (barre des tâches). Remplace la config de l'app pour cette session.",
274
+ "description": "Basculer entre barre latérale, encadrés, barre d'app, flottante et fenêtres. Remplace la config de l'app pour cette session.",
275
275
  "sidebar": "Barre latérale",
276
+ "sidebar-inset": "Barre latérale encadrée",
276
277
  "windows": "Fenêtres (expérimental)",
277
- "app-bar": "Barre d'app"
278
+ "app-bar": "Barre d'app",
279
+ "app-bar-inset": "Barre d'app encadrée",
280
+ "floating": "Flottante",
281
+ "more": "Plus",
282
+ "hideSidebar": "Masquer la barre latérale",
283
+ "showSidebar": "Afficher la barre latérale"
278
284
  },
279
285
  "logging": {
280
286
  "title": "Journalisation",