@shellui/core 0.6.2 → 0.7.0-alpha.10
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/package.json +2 -2
- package/schemas/shellui.config.schema.json +147 -70
- package/src/app.tsx +2 -0
- package/src/components/ContentView.tsx +21 -30
- package/src/components/iframeUrlSafety.spec.ts +67 -0
- package/src/components/iframeUrlSafety.ts +50 -0
- package/src/components/ui/sidebar.tsx +11 -5
- package/src/features/admin/AdminView.tsx +9 -6
- package/src/features/auth/AuthProvider.tsx +49 -5
- package/src/features/auth/appBackend/AppBackendSessionHost.tsx +58 -0
- package/src/features/auth/appBackend/appBackendSessions.spec.ts +329 -0
- package/src/features/auth/appBackend/appBackendSessions.ts +443 -0
- package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
- package/src/features/auth/appBackend/childFrames.ts +180 -0
- package/src/features/auth/appBackend/configSchema.spec.ts +41 -0
- package/src/features/auth/appBackend/frameAuth.ts +204 -0
- package/src/features/auth/appBackend/identity.spec.ts +201 -0
- package/src/features/auth/appBackend/identity.ts +173 -0
- package/src/features/auth/appBackend/silentSignIn.spec.ts +225 -0
- package/src/features/auth/appBackend/silentSignIn.ts +254 -0
- package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
- package/src/features/auth/appBackend/tokenExchange.ts +76 -0
- package/src/features/auth/backends/shellui.spec.ts +51 -19
- package/src/features/auth/backends/shellui.ts +20 -5
- package/src/features/auth/backends/types.ts +7 -2
- package/src/features/auth/components/LoginView.tsx +40 -18
- package/src/features/auth/components/OAuthCallbackView.tsx +33 -4
- package/src/features/auth/utils/authRequestError.ts +3 -0
- package/src/features/auth/utils/buildOAuthSessionRedirectTo.spec.ts +42 -1
- package/src/features/auth/utils/buildOAuthSessionRedirectTo.ts +23 -0
- package/src/features/auth/utils/canRestoreStoredSession.spec.ts +29 -0
- package/src/features/auth/utils/canRestoreStoredSession.ts +12 -0
- package/src/features/auth/utils/index.ts +16 -1
- package/src/features/auth/utils/loginCancelTarget.spec.ts +73 -0
- package/src/features/auth/utils/loginCancelTarget.ts +45 -0
- package/src/features/auth/utils/loginPanelFrame.spec.ts +24 -0
- package/src/features/auth/utils/loginPanelFrame.ts +14 -0
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
- package/src/features/auth/utils/webPkce.spec.ts +119 -0
- package/src/features/auth/utils/webPkce.ts +169 -0
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- package/src/features/config/types.ts +70 -3
- package/src/features/layouts/appbar/AppBarLayout.tsx +63 -30
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +12 -23
- package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
- package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
- package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
- package/src/features/layouts/chrome/MacStrip.tsx +33 -0
- package/src/features/layouts/chrome/constants.ts +33 -8
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/stripDragMap.ts +35 -0
- package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
- package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
- package/src/features/layouts/floating/FloatingBottomDock.tsx +199 -20
- package/src/features/layouts/floating/FloatingLayout.tsx +13 -8
- package/src/features/layouts/floating/FloatingSidebar.tsx +144 -70
- package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
- package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
- package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
- package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +38 -10
- package/src/features/layouts/sidebar/NavigationContent.tsx +14 -6
- package/src/features/layouts/sidebar/SidebarIcons.tsx +3 -9
- package/src/features/layouts/sidebar/SidebarInner.tsx +50 -39
- package/src/features/layouts/sidebar/SidebarLayout.tsx +8 -11
- package/src/features/layouts/utils.ts +4 -3
- package/src/features/layouts/windows/DesktopDots.tsx +76 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +184 -125
- package/src/features/layouts/windows/deskDots.spec.ts +52 -0
- package/src/features/layouts/windows/deskDots.ts +314 -0
- package/src/features/settings/SettingsProvider.tsx +198 -29
- package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +379 -4
- package/src/features/settings/utils/buildSettingsForPropagation.ts +65 -39
- package/src/features/theme/applyTheme.ts +8 -0
- package/src/features/theme/navContrast.spec.ts +49 -0
- package/src/features/theme/navContrast.ts +108 -0
- package/src/features/transfers/transferQueue.spec.ts +6 -2
- package/src/i18n/translations/en/common.json +27 -0
- package/src/i18n/translations/fr/common.json +27 -0
- package/src/index.css +935 -46
- package/src/index.ts +2 -0
- package/src/routes/hooks/useNavigationItems.ts +14 -3
- package/src/routes/hooks/withShellSearch.spec.ts +13 -0
|
@@ -37,12 +37,19 @@ import { useIsMobile } from '../../../hooks/use-mobile';
|
|
|
37
37
|
import { readSafeAreaInsetBottom, readSafeAreaInsetTop } from '../chrome/viewport';
|
|
38
38
|
import {
|
|
39
39
|
DESKTOP_TITLEBAR_HEIGHT_PX,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
SHELL_HEADER_HEIGHT_PX,
|
|
41
|
+
SHELL_HEADER_PAD_TOP_PX,
|
|
42
42
|
} from '../chrome/constants';
|
|
43
43
|
import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
|
|
44
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
useIsTauriClient,
|
|
46
|
+
useIsTauriRuntime,
|
|
47
|
+
useMacOverlayChrome,
|
|
48
|
+
useMacTrafficLights,
|
|
49
|
+
} from '../chrome/runtime';
|
|
50
|
+
import { MAC_DRAG_REGION_PROPS, MacLightsSafeArea, MacStripSpacer } from '../chrome/MacStrip';
|
|
45
51
|
import { WindowTitleBarActions } from '../../chromeActions';
|
|
52
|
+
import { DesktopDots } from './DesktopDots';
|
|
46
53
|
|
|
47
54
|
interface WindowsLayoutProps {
|
|
48
55
|
title?: string;
|
|
@@ -219,11 +226,15 @@ function AppWindow({
|
|
|
219
226
|
/** Used to cascade normal size when leaving mobile. */
|
|
220
227
|
cascadeIndex: number;
|
|
221
228
|
}) {
|
|
229
|
+
const { t } = useTranslation();
|
|
222
230
|
const windowLabel = resolveNavLabel(navItem.label, currentLanguage);
|
|
223
231
|
const tauriRuntime = useIsTauriRuntime();
|
|
224
232
|
const isTauriEnv = useIsTauriClient();
|
|
225
233
|
const trafficLights = useMacTrafficLights();
|
|
226
|
-
const
|
|
234
|
+
const macOverlay = useMacOverlayChrome();
|
|
235
|
+
// macOS: 32px strip on top (also in native fullscreen); windows clamp below it.
|
|
236
|
+
const macStrip = trafficLights || macOverlay;
|
|
237
|
+
const topInset = macStrip ? DESKTOP_TITLEBAR_HEIGHT_PX : 0;
|
|
227
238
|
const topInsetRef = useRef(topInset);
|
|
228
239
|
topInsetRef.current = topInset;
|
|
229
240
|
const [frameUuid, setFrameUuid] = useState<string | null>(null);
|
|
@@ -263,7 +274,7 @@ function AppWindow({
|
|
|
263
274
|
)
|
|
264
275
|
: clampBounds(win.bounds, topInset),
|
|
265
276
|
);
|
|
266
|
-
const containerRef = useRef<
|
|
277
|
+
const containerRef = useRef<HTMLElement>(null);
|
|
267
278
|
const dragRef = useRef<{
|
|
268
279
|
startX: number;
|
|
269
280
|
startY: number;
|
|
@@ -391,6 +402,7 @@ function AppWindow({
|
|
|
391
402
|
if (el) {
|
|
392
403
|
el.style.transform = '';
|
|
393
404
|
el.style.willChange = '';
|
|
405
|
+
el.removeAttribute('data-interacting');
|
|
394
406
|
}
|
|
395
407
|
const finalBounds = clampBounds(
|
|
396
408
|
{
|
|
@@ -423,6 +435,7 @@ function AppWindow({
|
|
|
423
435
|
};
|
|
424
436
|
const el = containerRef.current;
|
|
425
437
|
if (el) {
|
|
438
|
+
el.setAttribute('data-interacting', 'true');
|
|
426
439
|
el.setPointerCapture(e.pointerId);
|
|
427
440
|
el.addEventListener('pointermove', onPointerMove, { passive: true });
|
|
428
441
|
el.addEventListener('pointerup', onPointerUp as (e: Event) => void);
|
|
@@ -490,6 +503,7 @@ function AppWindow({
|
|
|
490
503
|
el.removeEventListener('pointermove', onResizePointerMove as (e: Event) => void);
|
|
491
504
|
el.removeEventListener('pointerup', onResizePointerUp as (e: Event) => void);
|
|
492
505
|
el.releasePointerCapture(e.pointerId);
|
|
506
|
+
el.removeAttribute('data-interacting');
|
|
493
507
|
}
|
|
494
508
|
resizeRef.current = null;
|
|
495
509
|
},
|
|
@@ -510,6 +524,7 @@ function AppWindow({
|
|
|
510
524
|
};
|
|
511
525
|
const el = containerRef.current;
|
|
512
526
|
if (el) {
|
|
527
|
+
el.setAttribute('data-interacting', 'true');
|
|
513
528
|
el.setPointerCapture(e.pointerId);
|
|
514
529
|
el.addEventListener('pointermove', onResizePointerMove as (e: Event) => void, {
|
|
515
530
|
passive: true,
|
|
@@ -528,13 +543,16 @@ function AppWindow({
|
|
|
528
543
|
const z = isFocused ? maxZIndex : zIndex;
|
|
529
544
|
|
|
530
545
|
return (
|
|
531
|
-
<
|
|
546
|
+
<section
|
|
532
547
|
ref={containerRef}
|
|
548
|
+
aria-label={windowLabel}
|
|
549
|
+
data-shellui-window=""
|
|
550
|
+
data-focused={isFocused ? 'true' : 'false'}
|
|
551
|
+
data-maximized={lockedChrome ? 'true' : 'false'}
|
|
533
552
|
className={cn(
|
|
534
|
-
'absolute flex flex-col overflow-hidden
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
: 'rounded-lg border border-border shadow-lg',
|
|
553
|
+
'shellui-win absolute flex flex-col overflow-hidden',
|
|
554
|
+
isFocused && 'is-focused',
|
|
555
|
+
mobileFullscreen && 'is-flat',
|
|
538
556
|
)}
|
|
539
557
|
style={{
|
|
540
558
|
left: bounds.x,
|
|
@@ -549,20 +567,23 @@ function AppWindow({
|
|
|
549
567
|
{/* Title bar: pointer capture so drag continues when cursor is over iframe or outside window */}
|
|
550
568
|
<div
|
|
551
569
|
className={cn(
|
|
552
|
-
'flex items-center gap-2 pr-1
|
|
553
|
-
flushTitlebar ? 'box-border' : '
|
|
570
|
+
'shellui-win-titlebar flex items-center gap-2 pr-1 select-none shrink-0',
|
|
571
|
+
flushTitlebar ? 'box-border' : 'pl-2.5',
|
|
554
572
|
lockedChrome ? 'cursor-default' : 'cursor-move',
|
|
555
573
|
)}
|
|
556
574
|
style={
|
|
557
575
|
flushTitlebar
|
|
558
576
|
? {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
577
|
+
// Maximized under a native caption bar (Windows / Linux). macOS keeps its strip.
|
|
578
|
+
height: SHELL_HEADER_HEIGHT_PX,
|
|
579
|
+
paddingTop: SHELL_HEADER_PAD_TOP_PX,
|
|
580
|
+
paddingLeft: 8,
|
|
562
581
|
}
|
|
563
582
|
: undefined
|
|
564
583
|
}
|
|
565
|
-
{...(flushTitlebar
|
|
584
|
+
{...(flushTitlebar
|
|
585
|
+
? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
|
|
586
|
+
: { 'data-shellui-no-drag': '' })}
|
|
566
587
|
onPointerDown={handleTitlePointerDown}
|
|
567
588
|
>
|
|
568
589
|
{win.icon && (
|
|
@@ -570,7 +591,7 @@ function AppWindow({
|
|
|
570
591
|
src={win.icon}
|
|
571
592
|
alt=""
|
|
572
593
|
className={cn(
|
|
573
|
-
'
|
|
594
|
+
'shellui-win-tile shrink-0 rounded-sm object-cover',
|
|
574
595
|
isAppIcon(win.icon) && 'opacity-90 dark:opacity-100 dark:invert',
|
|
575
596
|
)}
|
|
576
597
|
/>
|
|
@@ -587,13 +608,13 @@ function AppWindow({
|
|
|
587
608
|
e.stopPropagation();
|
|
588
609
|
handleMaximizeToggle();
|
|
589
610
|
}}
|
|
590
|
-
className="
|
|
591
|
-
aria-label={isMaximized ? '
|
|
611
|
+
className="shellui-win-control shellui-chrome-focus"
|
|
612
|
+
aria-label={isMaximized ? t('windows.restore') : t('windows.maximize')}
|
|
592
613
|
>
|
|
593
614
|
{isMaximized ? (
|
|
594
|
-
<RestoreIcon className="
|
|
615
|
+
<RestoreIcon className="size-3.5" />
|
|
595
616
|
) : (
|
|
596
|
-
<MaximizeIcon className="
|
|
617
|
+
<MaximizeIcon className="size-3.5" />
|
|
597
618
|
)}
|
|
598
619
|
</button>
|
|
599
620
|
)}
|
|
@@ -603,14 +624,14 @@ function AppWindow({
|
|
|
603
624
|
e.stopPropagation();
|
|
604
625
|
onClose();
|
|
605
626
|
}}
|
|
606
|
-
className="
|
|
607
|
-
aria-label=
|
|
627
|
+
className="shellui-win-control shellui-win-close shellui-chrome-focus"
|
|
628
|
+
aria-label={t('windows.close')}
|
|
608
629
|
>
|
|
609
|
-
<CloseIcon className="
|
|
630
|
+
<CloseIcon className="size-3.5" />
|
|
610
631
|
</button>
|
|
611
632
|
</div>
|
|
612
633
|
{/* Content */}
|
|
613
|
-
<div className="flex-1 min-h-0 relative bg-background">
|
|
634
|
+
<div className="shellui-win-body flex-1 min-h-0 relative bg-background">
|
|
614
635
|
{/* When not focused, overlay captures clicks to bring window to front */}
|
|
615
636
|
{!isFocused && (
|
|
616
637
|
<div
|
|
@@ -664,7 +685,7 @@ function AppWindow({
|
|
|
664
685
|
onPointerDown={(e) => handleResizePointerDown(e, edge)}
|
|
665
686
|
/>
|
|
666
687
|
))}
|
|
667
|
-
</
|
|
688
|
+
</section>
|
|
668
689
|
);
|
|
669
690
|
}
|
|
670
691
|
|
|
@@ -771,13 +792,17 @@ function getBrowserTimezone(): string {
|
|
|
771
792
|
|
|
772
793
|
export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: WindowsLayoutProps) {
|
|
773
794
|
const location = useLocation();
|
|
774
|
-
const { i18n } = useTranslation();
|
|
795
|
+
const { t, i18n } = useTranslation();
|
|
775
796
|
const { isAuthenticated, isLoading: isAuthLoading } = useAuth();
|
|
776
797
|
const { settings } = useSettings();
|
|
777
798
|
/** Fullscreen phone chrome — includes iPhone landscape (wide but short). */
|
|
778
799
|
const phoneMode = useWindowsPhoneMode();
|
|
779
800
|
const trafficLights = useMacTrafficLights();
|
|
780
|
-
const
|
|
801
|
+
const isTauriEnv = useIsTauriClient();
|
|
802
|
+
const macOverlay = useMacOverlayChrome();
|
|
803
|
+
// macOS: 32px strip on top (also in native fullscreen); windows clamp below it.
|
|
804
|
+
const macStrip = trafficLights || macOverlay;
|
|
805
|
+
const topInset = macStrip ? DESKTOP_TITLEBAR_HEIGHT_PX : 0;
|
|
781
806
|
const currentLanguage = i18n.language || 'en';
|
|
782
807
|
const hasCustomLoginNav = useMemo(() => hasLoginNavigationItem(navigation), [navigation]);
|
|
783
808
|
const authAwareNavigation = useMemo(
|
|
@@ -811,13 +836,24 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
811
836
|
const [startMenuOpen, setStartMenuOpen] = useState(false);
|
|
812
837
|
const [now, setNow] = useState(() => new Date());
|
|
813
838
|
const startPanelRef = useRef<HTMLDivElement>(null);
|
|
839
|
+
const startButtonRef = useRef<HTMLButtonElement>(null);
|
|
840
|
+
const startMenuRef = useRef<HTMLDivElement>(null);
|
|
841
|
+
const desktopRef = useRef<HTMLDivElement>(null);
|
|
814
842
|
const initialOpenFromUrlDoneRef = useRef(false);
|
|
815
843
|
const openPaths = useMemo(() => new Set(windows.map((w) => w.path)), [windows]);
|
|
816
844
|
|
|
817
|
-
//
|
|
845
|
+
// Taskbar clock shows hours and minutes: tick on each minute boundary, not every second.
|
|
818
846
|
useEffect(() => {
|
|
819
|
-
|
|
820
|
-
|
|
847
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
848
|
+
const schedule = () => {
|
|
849
|
+
const current = new Date();
|
|
850
|
+
setNow(current);
|
|
851
|
+
const msToNextMinute =
|
|
852
|
+
60_000 - (current.getSeconds() * 1000 + current.getMilliseconds()) + 50;
|
|
853
|
+
timer = setTimeout(schedule, msToNextMinute);
|
|
854
|
+
};
|
|
855
|
+
schedule();
|
|
856
|
+
return () => clearTimeout(timer);
|
|
821
857
|
}, []);
|
|
822
858
|
|
|
823
859
|
/** Highest z-index: front window always gets this so it stays on top. */
|
|
@@ -902,8 +938,21 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
902
938
|
setStartMenuOpen(false);
|
|
903
939
|
}
|
|
904
940
|
};
|
|
941
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
942
|
+
if (e.key !== 'Escape') return;
|
|
943
|
+
e.preventDefault();
|
|
944
|
+
setStartMenuOpen(false);
|
|
945
|
+
startButtonRef.current?.focus();
|
|
946
|
+
};
|
|
905
947
|
document.addEventListener('mousedown', onDocClick);
|
|
906
|
-
|
|
948
|
+
document.addEventListener('keydown', onKeyDown);
|
|
949
|
+
// Move focus to the first row so keyboard users land inside the menu.
|
|
950
|
+
const first = startMenuRef.current?.querySelector<HTMLElement>('.shellui-start-row');
|
|
951
|
+
first?.focus({ preventScroll: true });
|
|
952
|
+
return () => {
|
|
953
|
+
document.removeEventListener('mousedown', onDocClick);
|
|
954
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
955
|
+
};
|
|
907
956
|
}, [startMenuOpen]);
|
|
908
957
|
|
|
909
958
|
const handleNavClick = useCallback(
|
|
@@ -938,37 +987,49 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
938
987
|
[openWindow, windows, focusWindow, phoneMode],
|
|
939
988
|
);
|
|
940
989
|
|
|
990
|
+
const frontWindowLabel = useMemo(() => {
|
|
991
|
+
const front = windows.find((w) => w.id === frontWindowId);
|
|
992
|
+
if (!front) return null;
|
|
993
|
+
const navItem = navigationItems.find((n) => n.path === front.path);
|
|
994
|
+
return navItem ? resolveNavLabel(navItem.label, currentLanguage) : front.label;
|
|
995
|
+
}, [windows, frontWindowId, navigationItems, currentLanguage]);
|
|
996
|
+
|
|
941
997
|
return (
|
|
942
998
|
<>
|
|
943
999
|
<div
|
|
1000
|
+
ref={desktopRef}
|
|
944
1001
|
data-shellui-windows-layout=""
|
|
945
1002
|
className="fixed inset-0 overflow-hidden bg-background"
|
|
946
1003
|
style={{ paddingBottom: TASKBAR_SLOT_CSS }}
|
|
947
1004
|
>
|
|
948
|
-
{/*
|
|
1005
|
+
{/* Desktop: two low primary washes at the bottom, under the calm dot field. */}
|
|
949
1006
|
<div
|
|
950
1007
|
aria-hidden
|
|
951
|
-
className="pointer-events-none absolute inset-0"
|
|
952
|
-
style={{
|
|
953
|
-
backgroundImage: [
|
|
954
|
-
'radial-gradient(ellipse 95% 70% at 18% 108%, color-mix(in oklch, var(--primary) 32%, transparent), transparent 58%)',
|
|
955
|
-
'radial-gradient(ellipse 70% 55% at 78% 118%, color-mix(in oklch, var(--primary) 22%, transparent), transparent 62%)',
|
|
956
|
-
'radial-gradient(ellipse 55% 40% at 52% 92%, color-mix(in oklch, var(--primary) 14%, transparent), transparent 70%)',
|
|
957
|
-
'radial-gradient(ellipse 40% 30% at 92% 78%, color-mix(in oklch, var(--primary) 10%, transparent), transparent 68%)',
|
|
958
|
-
'radial-gradient(ellipse 35% 28% at 8% 72%, color-mix(in oklch, var(--primary) 8%, transparent), transparent 65%)',
|
|
959
|
-
].join(', '),
|
|
960
|
-
}}
|
|
1008
|
+
className="shellui-desk-wash pointer-events-none absolute inset-0"
|
|
961
1009
|
/>
|
|
1010
|
+
<DesktopDots watchRoot={desktopRef} />
|
|
962
1011
|
|
|
963
|
-
{
|
|
1012
|
+
{macStrip ? (
|
|
1013
|
+
/* macOS strip: safe area 80, back, forward, drag spacer, focused title centred. */
|
|
964
1014
|
<div
|
|
965
1015
|
data-shellui-windows-titlebar=""
|
|
966
|
-
data-shellui-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
className="absolute inset-x-0 top-0 border-b border-border bg-sidebar-background"
|
|
1016
|
+
data-shellui-mac-strip=""
|
|
1017
|
+
{...MAC_DRAG_REGION_PROPS}
|
|
1018
|
+
className="shellui-windows-strip absolute inset-x-0 top-0 flex items-center select-none"
|
|
970
1019
|
style={{ height: DESKTOP_TITLEBAR_HEIGHT_PX, zIndex: Z_INDEX.WINDOWS_TITLEBAR }}
|
|
971
|
-
|
|
1020
|
+
>
|
|
1021
|
+
<MacLightsSafeArea />
|
|
1022
|
+
{isTauriEnv ? <DesktopHistoryButtons strip /> : null}
|
|
1023
|
+
<MacStripSpacer />
|
|
1024
|
+
{frontWindowLabel ? (
|
|
1025
|
+
<span
|
|
1026
|
+
aria-hidden
|
|
1027
|
+
className="shellui-windows-strip-title truncate"
|
|
1028
|
+
>
|
|
1029
|
+
{frontWindowLabel}
|
|
1030
|
+
</span>
|
|
1031
|
+
) : null}
|
|
1032
|
+
</div>
|
|
972
1033
|
) : null}
|
|
973
1034
|
|
|
974
1035
|
{/* Desktop area: windows */}
|
|
@@ -998,7 +1059,11 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
998
1059
|
|
|
999
1060
|
{/* Taskbar */}
|
|
1000
1061
|
<div
|
|
1001
|
-
|
|
1062
|
+
role="region"
|
|
1063
|
+
aria-label={t('windows.taskbar')}
|
|
1064
|
+
data-shellui-taskbar=""
|
|
1065
|
+
data-phone={phoneMode ? 'true' : undefined}
|
|
1066
|
+
className="shellui-taskbar fixed left-0 right-0 bottom-0 flex items-center gap-1 px-2"
|
|
1002
1067
|
style={{
|
|
1003
1068
|
height: TASKBAR_SLOT_CSS,
|
|
1004
1069
|
paddingBottom: 'var(--shellui-safe-area-bottom, 0px)',
|
|
@@ -1019,17 +1084,13 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1019
1084
|
ref={startPanelRef}
|
|
1020
1085
|
>
|
|
1021
1086
|
<button
|
|
1087
|
+
ref={startButtonRef}
|
|
1022
1088
|
type="button"
|
|
1023
1089
|
onClick={() => setStartMenuOpen((o) => !o)}
|
|
1024
|
-
className={cn(
|
|
1025
|
-
'flex items-center gap-2 h-9 px-3 rounded cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
1026
|
-
startMenuOpen
|
|
1027
|
-
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
1028
|
-
: 'text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
|
|
1029
|
-
)}
|
|
1090
|
+
className={cn('shellui-start shellui-chrome-focus', startMenuOpen && 'is-open')}
|
|
1030
1091
|
aria-expanded={startMenuOpen}
|
|
1031
|
-
aria-haspopup="
|
|
1032
|
-
aria-label=
|
|
1092
|
+
aria-haspopup="dialog"
|
|
1093
|
+
aria-label={title || t('windows.start')}
|
|
1033
1094
|
>
|
|
1034
1095
|
{appIcon ? (
|
|
1035
1096
|
<AppBrandIcon
|
|
@@ -1041,32 +1102,33 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1041
1102
|
) : (
|
|
1042
1103
|
<StartIcon className="h-5 w-5" />
|
|
1043
1104
|
)}
|
|
1044
|
-
<span className="
|
|
1105
|
+
<span className="shellui-start-name hidden sm:inline">
|
|
1106
|
+
{title || t('windows.start')}
|
|
1107
|
+
</span>
|
|
1045
1108
|
</button>
|
|
1046
1109
|
{/* Start menu panel */}
|
|
1047
1110
|
{startMenuOpen && (
|
|
1048
1111
|
<div
|
|
1049
|
-
|
|
1112
|
+
ref={startMenuRef}
|
|
1113
|
+
className="shellui-start-menu absolute bottom-full left-0 mb-2 flex w-[22rem] max-h-[min(72vh,34rem)] flex-col overflow-hidden text-popover-foreground"
|
|
1050
1114
|
style={{ zIndex: Z_INDEX.MODAL_CONTENT }}
|
|
1051
|
-
role="
|
|
1052
|
-
aria-label={
|
|
1115
|
+
role="dialog"
|
|
1116
|
+
aria-label={t('windows.applications')}
|
|
1053
1117
|
>
|
|
1054
|
-
<div className="
|
|
1118
|
+
<div className="shellui-start-head shrink-0 px-4 py-3">
|
|
1055
1119
|
<p
|
|
1056
|
-
className="
|
|
1120
|
+
className="shellui-start-title"
|
|
1057
1121
|
style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
|
|
1058
1122
|
>
|
|
1059
|
-
{title || '
|
|
1060
|
-
</p>
|
|
1061
|
-
<p className="mt-0.5 text-xs text-muted-foreground">
|
|
1062
|
-
Choose an app to open in a window
|
|
1123
|
+
{title || t('windows.applications')}
|
|
1063
1124
|
</p>
|
|
1125
|
+
<p className="shellui-start-hint text-muted-foreground">{t('windows.chooseApp')}</p>
|
|
1064
1126
|
</div>
|
|
1065
1127
|
|
|
1066
1128
|
<div className="min-h-0 flex-1 space-y-4 overflow-y-auto px-2 py-3">
|
|
1067
1129
|
{menuSections.length === 0 ? (
|
|
1068
1130
|
<p className="px-2 py-6 text-center text-sm text-muted-foreground">
|
|
1069
|
-
|
|
1131
|
+
{t('windows.noApps')}
|
|
1070
1132
|
</p>
|
|
1071
1133
|
) : (
|
|
1072
1134
|
menuSections.map((section, sectionIndex) => {
|
|
@@ -1089,10 +1151,7 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1089
1151
|
? 'end-items'
|
|
1090
1152
|
: `items-${sectionIndex}`
|
|
1091
1153
|
}
|
|
1092
|
-
className={cn(
|
|
1093
|
-
'space-y-1.5',
|
|
1094
|
-
isEndSection && 'border-t border-border/60 pt-3',
|
|
1095
|
-
)}
|
|
1154
|
+
className={cn('space-y-1.5', isEndSection && 'shellui-start-foot pt-3')}
|
|
1096
1155
|
>
|
|
1097
1156
|
{categoryLabel ? (
|
|
1098
1157
|
<h2
|
|
@@ -1114,23 +1173,13 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1114
1173
|
<button
|
|
1115
1174
|
key={item.path}
|
|
1116
1175
|
type="button"
|
|
1117
|
-
role="menuitem"
|
|
1118
1176
|
onClick={() => handleNavClick(item)}
|
|
1119
1177
|
className={cn(
|
|
1120
|
-
'
|
|
1121
|
-
'
|
|
1122
|
-
'hover:bg-accent hover:text-accent-foreground',
|
|
1123
|
-
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover',
|
|
1124
|
-
isOpen && 'bg-accent/50',
|
|
1178
|
+
'shellui-start-row shellui-chrome-focus group',
|
|
1179
|
+
isOpen && 'is-open',
|
|
1125
1180
|
)}
|
|
1126
1181
|
>
|
|
1127
|
-
<span
|
|
1128
|
-
className={cn(
|
|
1129
|
-
'flex size-9 shrink-0 items-center justify-center rounded-md',
|
|
1130
|
-
'bg-muted/70 text-foreground ring-1 ring-border/50',
|
|
1131
|
-
'group-hover:bg-background/80 group-hover:ring-border',
|
|
1132
|
-
)}
|
|
1133
|
-
>
|
|
1182
|
+
<span className="shellui-start-tile">
|
|
1134
1183
|
<NavIcon
|
|
1135
1184
|
src={icon}
|
|
1136
1185
|
className="size-4"
|
|
@@ -1142,12 +1191,15 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1142
1191
|
</span>
|
|
1143
1192
|
{isOpen && !isOverlay && !isExternal ? (
|
|
1144
1193
|
<span className="mt-0.5 block text-[11px] text-muted-foreground">
|
|
1145
|
-
|
|
1194
|
+
{t('windows.open')}
|
|
1146
1195
|
</span>
|
|
1147
1196
|
) : null}
|
|
1148
1197
|
</span>
|
|
1149
1198
|
{isExternal ? (
|
|
1150
|
-
|
|
1199
|
+
<>
|
|
1200
|
+
<ExternalLinkIcon className="size-3.5 shrink-0 opacity-50 group-hover:opacity-80" />
|
|
1201
|
+
<span className="sr-only">{t('shellChrome.externalLink')}</span>
|
|
1202
|
+
</>
|
|
1151
1203
|
) : isOpen && !isOverlay ? (
|
|
1152
1204
|
<span
|
|
1153
1205
|
className="size-1.5 shrink-0 rounded-full bg-primary"
|
|
@@ -1169,7 +1221,10 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1169
1221
|
|
|
1170
1222
|
{/* Window list — desktop only; phone switches via the start menu */}
|
|
1171
1223
|
{!phoneMode && (
|
|
1172
|
-
<
|
|
1224
|
+
<ul
|
|
1225
|
+
aria-label={t('windows.openApps')}
|
|
1226
|
+
className="shellui-task-list flex-1 flex items-center gap-1 min-w-0 overflow-x-auto"
|
|
1227
|
+
>
|
|
1173
1228
|
{windows.map((win) => {
|
|
1174
1229
|
const navItem = navigationItems.find((n) => n.path === win.path);
|
|
1175
1230
|
const windowLabel = navItem
|
|
@@ -1177,39 +1232,39 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1177
1232
|
: win.label;
|
|
1178
1233
|
const isFocused = win.id === frontWindowId;
|
|
1179
1234
|
return (
|
|
1180
|
-
<
|
|
1235
|
+
<li
|
|
1181
1236
|
key={win.id}
|
|
1182
|
-
|
|
1183
|
-
onClick={() => focusWindow(win.id)}
|
|
1184
|
-
onContextMenu={(e) => {
|
|
1185
|
-
e.preventDefault();
|
|
1186
|
-
closeWindow(win.id);
|
|
1187
|
-
}}
|
|
1188
|
-
className={cn(
|
|
1189
|
-
'flex items-center gap-2 h-8 px-2 rounded min-w-0 max-w-[140px] shrink-0 cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
1190
|
-
isFocused
|
|
1191
|
-
? 'bg-sidebar-accent text-sidebar-accent-foreground'
|
|
1192
|
-
: 'text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
|
|
1193
|
-
)}
|
|
1194
|
-
title={windowLabel}
|
|
1237
|
+
className="shrink-0"
|
|
1195
1238
|
>
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1239
|
+
<button
|
|
1240
|
+
type="button"
|
|
1241
|
+
aria-current={isFocused ? 'true' : undefined}
|
|
1242
|
+
onClick={() => focusWindow(win.id)}
|
|
1243
|
+
onContextMenu={(e) => {
|
|
1244
|
+
e.preventDefault();
|
|
1245
|
+
closeWindow(win.id);
|
|
1246
|
+
}}
|
|
1247
|
+
className={cn('shellui-task shellui-chrome-focus', isFocused && 'is-focused')}
|
|
1248
|
+
title={windowLabel}
|
|
1249
|
+
>
|
|
1250
|
+
{win.icon ? (
|
|
1251
|
+
<img
|
|
1252
|
+
src={win.icon}
|
|
1253
|
+
alt=""
|
|
1254
|
+
className={cn(
|
|
1255
|
+
'h-4 w-4 shrink-0 rounded-sm object-cover',
|
|
1256
|
+
isAppIcon(win.icon) && 'opacity-90 dark:opacity-100 dark:invert',
|
|
1257
|
+
)}
|
|
1258
|
+
/>
|
|
1259
|
+
) : (
|
|
1260
|
+
<span className="h-4 w-4 shrink-0 rounded-sm bg-muted" />
|
|
1261
|
+
)}
|
|
1262
|
+
<span className="truncate">{windowLabel}</span>
|
|
1263
|
+
</button>
|
|
1264
|
+
</li>
|
|
1210
1265
|
);
|
|
1211
1266
|
})}
|
|
1212
|
-
</
|
|
1267
|
+
</ul>
|
|
1213
1268
|
)}
|
|
1214
1269
|
{phoneMode && <div className="flex-1 min-w-0" />}
|
|
1215
1270
|
|
|
@@ -1228,8 +1283,13 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1228
1283
|
key={item.path}
|
|
1229
1284
|
type="button"
|
|
1230
1285
|
onClick={() => handleNavClick(item)}
|
|
1231
|
-
className="
|
|
1286
|
+
className="shellui-task shellui-chrome-focus"
|
|
1232
1287
|
title={label}
|
|
1288
|
+
aria-label={
|
|
1289
|
+
item.openIn === 'external'
|
|
1290
|
+
? `${label} (${t('shellChrome.externalLink')})`
|
|
1291
|
+
: label
|
|
1292
|
+
}
|
|
1233
1293
|
>
|
|
1234
1294
|
{icon ? (
|
|
1235
1295
|
<img
|
|
@@ -1243,7 +1303,7 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1243
1303
|
) : (
|
|
1244
1304
|
<span className="h-4 w-4 shrink-0 rounded-sm bg-muted" />
|
|
1245
1305
|
)}
|
|
1246
|
-
<span className="
|
|
1306
|
+
<span className="truncate max-w-[100px]">{label}</span>
|
|
1247
1307
|
</button>
|
|
1248
1308
|
);
|
|
1249
1309
|
})}
|
|
@@ -1259,30 +1319,29 @@ export function WindowsLayout({ title, appIcon, logo: _logo, navigation }: Windo
|
|
|
1259
1319
|
|
|
1260
1320
|
{/* Date and time (extreme bottom right, OS-style); uses region timezone from settings */}
|
|
1261
1321
|
<div
|
|
1262
|
-
className="flex flex-col items-end justify-center shrink-0 px-3 py-1
|
|
1322
|
+
className="shellui-clock flex flex-col items-end justify-center shrink-0 px-3 py-1 ml-1 min-w-0"
|
|
1263
1323
|
style={{ paddingRight: 'max(0.75rem, env(safe-area-inset-right))' }}
|
|
1264
1324
|
role="timer"
|
|
1265
1325
|
aria-live="off"
|
|
1266
1326
|
aria-label={new Intl.DateTimeFormat(currentLanguage, {
|
|
1267
1327
|
timeZone,
|
|
1268
1328
|
dateStyle: 'full',
|
|
1269
|
-
timeStyle: '
|
|
1329
|
+
timeStyle: 'short',
|
|
1270
1330
|
}).format(now)}
|
|
1271
1331
|
>
|
|
1272
1332
|
<time
|
|
1273
1333
|
dateTime={now.toISOString()}
|
|
1274
|
-
className="
|
|
1334
|
+
className="shellui-clock-time tabular-nums whitespace-nowrap"
|
|
1275
1335
|
>
|
|
1276
1336
|
{new Intl.DateTimeFormat(currentLanguage, {
|
|
1277
1337
|
timeZone,
|
|
1278
1338
|
hour: '2-digit',
|
|
1279
1339
|
minute: '2-digit',
|
|
1280
|
-
second: '2-digit',
|
|
1281
1340
|
}).format(now)}
|
|
1282
1341
|
</time>
|
|
1283
1342
|
<time
|
|
1284
1343
|
dateTime={now.toISOString()}
|
|
1285
|
-
className="
|
|
1344
|
+
className="shellui-clock-date whitespace-nowrap"
|
|
1286
1345
|
>
|
|
1287
1346
|
{new Intl.DateTimeFormat(currentLanguage, {
|
|
1288
1347
|
timeZone,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { DESK_DOTS, bucketAlpha, gridSize, isAccentDot } from './deskDots';
|
|
4
|
+
import { isDesktopCovered } from './DesktopDots';
|
|
5
|
+
|
|
6
|
+
describe('DESK_DOTS', () => {
|
|
7
|
+
it('keeps the calm parameters from the spec', () => {
|
|
8
|
+
expect(DESK_DOTS.fps).toBe(30);
|
|
9
|
+
expect(DESK_DOTS.dprMax).toBe(2);
|
|
10
|
+
expect(DESK_DOTS.gustPx).toBe(3.5);
|
|
11
|
+
expect(DESK_DOTS.crossMs).toEqual([30000, 40000]);
|
|
12
|
+
expect(DESK_DOTS.everyMs).toEqual([9000, 15000]);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('bucketAlpha', () => {
|
|
17
|
+
it('starts near the base alpha and rises with the gust', () => {
|
|
18
|
+
expect(bucketAlpha(false, 0, false)).toBeCloseTo(0.15 + 0.16 / 12, 5);
|
|
19
|
+
expect(bucketAlpha(false, 0, true)).toBeCloseTo(0.11 + 0.16 / 12, 5);
|
|
20
|
+
expect(bucketAlpha(false, 5, false)).toBeGreaterThan(bucketAlpha(false, 0, false));
|
|
21
|
+
expect(bucketAlpha(true, 0, false)).toBeGreaterThan(bucketAlpha(false, 0, false));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('gridSize', () => {
|
|
26
|
+
it('covers the host with a 24 px grid', () => {
|
|
27
|
+
expect(gridSize(1440, 900)).toEqual({ cols: 60, rows: 38, count: 2280 });
|
|
28
|
+
expect(gridSize(0, 900).count).toBe(0);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('isAccentDot', () => {
|
|
33
|
+
it('tints about one dot in eleven', () => {
|
|
34
|
+
let accents = 0;
|
|
35
|
+
for (let r = 0; r < 22; r++) for (let c = 0; c < 22; c++) if (isAccentDot(c, r)) accents++;
|
|
36
|
+
expect(accents / (22 * 22)).toBeCloseTo(1 / 11, 1);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('isDesktopCovered', () => {
|
|
41
|
+
it('pauses for a focused maximized window or a drag, not for a background maximized one', () => {
|
|
42
|
+
const root = document.createElement('div');
|
|
43
|
+
root.innerHTML =
|
|
44
|
+
'<div data-shellui-window data-focused="false" data-maximized="true"></div><div data-shellui-window data-focused="true" data-maximized="false"></div>';
|
|
45
|
+
expect(isDesktopCovered(root)).toBe(false);
|
|
46
|
+
root.lastElementChild?.setAttribute('data-interacting', 'true');
|
|
47
|
+
expect(isDesktopCovered(root)).toBe(true);
|
|
48
|
+
root.lastElementChild?.removeAttribute('data-interacting');
|
|
49
|
+
root.firstElementChild?.setAttribute('data-focused', 'true');
|
|
50
|
+
expect(isDesktopCovered(root)).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
});
|