@shellui/core 0.7.0-alpha.1 → 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.
Files changed (69) hide show
  1. package/package.json +2 -2
  2. package/schemas/shellui.config.schema.json +37 -4
  3. package/src/components/ContentView.tsx +19 -8
  4. package/src/components/ui/sidebar.tsx +11 -5
  5. package/src/features/admin/AdminView.tsx +9 -6
  6. package/src/features/auth/AuthProvider.tsx +25 -4
  7. package/src/features/auth/appBackend/appBackendSessions.spec.ts +134 -0
  8. package/src/features/auth/appBackend/appBackendSessions.ts +168 -17
  9. package/src/features/auth/appBackend/childFrames.spec.ts +328 -0
  10. package/src/features/auth/appBackend/childFrames.ts +180 -0
  11. package/src/features/auth/appBackend/frameAuth.ts +47 -10
  12. package/src/features/auth/appBackend/silentSignIn.spec.ts +18 -0
  13. package/src/features/auth/appBackend/silentSignIn.ts +15 -1
  14. package/src/features/auth/appBackend/tokenExchange.spec.ts +98 -0
  15. package/src/features/auth/appBackend/tokenExchange.ts +76 -0
  16. package/src/features/auth/components/OAuthCallbackView.tsx +7 -5
  17. package/src/features/auth/utils/buildOAuthSessionRedirectTo.spec.ts +42 -1
  18. package/src/features/auth/utils/buildOAuthSessionRedirectTo.ts +23 -0
  19. package/src/features/auth/utils/canRestoreStoredSession.spec.ts +29 -0
  20. package/src/features/auth/utils/canRestoreStoredSession.ts +12 -0
  21. package/src/features/auth/utils/index.ts +7 -1
  22. package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
  23. package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
  24. package/src/features/auth/utils/webPkce.spec.ts +23 -0
  25. package/src/features/auth/utils/webPkce.ts +23 -6
  26. package/src/features/chromeActions/computeActionInsets.ts +7 -4
  27. package/src/features/config/types.ts +30 -4
  28. package/src/features/layouts/appbar/AppBarLayout.tsx +63 -30
  29. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +12 -23
  30. package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
  31. package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
  32. package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
  33. package/src/features/layouts/chrome/MacStrip.tsx +33 -0
  34. package/src/features/layouts/chrome/constants.ts +33 -8
  35. package/src/features/layouts/chrome/index.ts +8 -0
  36. package/src/features/layouts/chrome/stripDragMap.ts +35 -0
  37. package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
  38. package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
  39. package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
  40. package/src/features/layouts/floating/FloatingBottomDock.tsx +199 -20
  41. package/src/features/layouts/floating/FloatingLayout.tsx +13 -8
  42. package/src/features/layouts/floating/FloatingSidebar.tsx +144 -70
  43. package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
  44. package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
  45. package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
  46. package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
  47. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +38 -10
  48. package/src/features/layouts/sidebar/NavigationContent.tsx +14 -6
  49. package/src/features/layouts/sidebar/SidebarIcons.tsx +3 -9
  50. package/src/features/layouts/sidebar/SidebarInner.tsx +50 -39
  51. package/src/features/layouts/sidebar/SidebarLayout.tsx +8 -11
  52. package/src/features/layouts/utils.ts +4 -3
  53. package/src/features/layouts/windows/DesktopDots.tsx +76 -0
  54. package/src/features/layouts/windows/WindowsLayout.tsx +184 -125
  55. package/src/features/layouts/windows/deskDots.spec.ts +52 -0
  56. package/src/features/layouts/windows/deskDots.ts +314 -0
  57. package/src/features/settings/SettingsProvider.tsx +158 -2
  58. package/src/features/settings/utils/buildSettingsForPropagation.spec.ts +8 -7
  59. package/src/features/settings/utils/buildSettingsForPropagation.ts +4 -6
  60. package/src/features/theme/applyTheme.ts +8 -0
  61. package/src/features/theme/navContrast.spec.ts +49 -0
  62. package/src/features/theme/navContrast.ts +108 -0
  63. package/src/features/transfers/transferQueue.spec.ts +6 -2
  64. package/src/i18n/translations/en/common.json +25 -0
  65. package/src/i18n/translations/fr/common.json +25 -0
  66. package/src/index.css +935 -46
  67. package/src/index.ts +1 -0
  68. package/src/routes/hooks/useNavigationItems.ts +14 -3
  69. package/src/routes/hooks/withShellSearch.spec.ts +13 -0
@@ -0,0 +1,76 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { mountDeskDots, type DeskDotsHandle } from './deskDots';
3
+
4
+ /** Window attributes the field watches to pause itself. */
5
+ const WATCHED_ATTRS = ['data-maximized', 'data-focused', 'data-interacting'];
6
+
7
+ /** True when a focused window fills the desktop or any window is dragged or resized. */
8
+ export function isDesktopCovered(root: ParentNode): boolean {
9
+ return Boolean(
10
+ root.querySelector(
11
+ '[data-shellui-window][data-focused="true"][data-maximized="true"], [data-shellui-window][data-interacting="true"]',
12
+ ),
13
+ );
14
+ }
15
+
16
+ /**
17
+ * Calm dot field behind the windows. Canvas while motion is allowed; a static CSS
18
+ * grid (`[data-shellui-desk-dots]::before`) under `prefers-reduced-motion`.
19
+ * Pauses when the tab is hidden, while the desktop is covered, and during drags.
20
+ */
21
+ export function DesktopDots({ watchRoot }: { watchRoot: React.RefObject<HTMLElement | null> }) {
22
+ const hostRef = useRef<HTMLDivElement>(null);
23
+
24
+ useEffect(() => {
25
+ const host = hostRef.current;
26
+ if (!host || typeof window === 'undefined') return;
27
+ const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)');
28
+ let dots: DeskDotsHandle | null = null;
29
+ let observer: MutationObserver | null = null;
30
+
31
+ const syncPause = () => {
32
+ const root = watchRoot.current;
33
+ dots?.pause(root ? isDesktopCovered(root) : false);
34
+ };
35
+
36
+ const start = () => {
37
+ if (dots || reduce?.matches) return;
38
+ dots = mountDeskDots(host);
39
+ const root = watchRoot.current;
40
+ if (root) {
41
+ observer = new MutationObserver(syncPause);
42
+ observer.observe(root, {
43
+ subtree: true,
44
+ childList: true,
45
+ attributes: true,
46
+ attributeFilter: WATCHED_ATTRS,
47
+ });
48
+ }
49
+ syncPause();
50
+ };
51
+
52
+ const stop = () => {
53
+ observer?.disconnect();
54
+ observer = null;
55
+ dots?.destroy();
56
+ dots = null;
57
+ };
58
+
59
+ const onReduceChange = () => (reduce?.matches ? stop() : start());
60
+ reduce?.addEventListener?.('change', onReduceChange);
61
+ start();
62
+ return () => {
63
+ reduce?.removeEventListener?.('change', onReduceChange);
64
+ stop();
65
+ };
66
+ }, [watchRoot]);
67
+
68
+ return (
69
+ <div
70
+ ref={hostRef}
71
+ aria-hidden
72
+ data-shellui-desk-dots=""
73
+ className="pointer-events-none absolute inset-0"
74
+ />
75
+ );
76
+ }