@shellui/core 0.4.1 → 0.5.0-alpha.2

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 (142) hide show
  1. package/README.md +2 -2
  2. package/package.json +15 -3
  3. package/schemas/curated-themes.json +4035 -0
  4. package/schemas/shellui.config.schema.json +961 -0
  5. package/schemas/shellui.theme.schema.json +187 -0
  6. package/src/app.tsx +4 -1
  7. package/src/components/ContentView.tsx +144 -9
  8. package/src/components/LoadingOverlay.tsx +1 -1
  9. package/src/components/ui/alert-dialog.tsx +1 -1
  10. package/src/components/ui/dialog.tsx +23 -5
  11. package/src/components/ui/drawer.tsx +282 -42
  12. package/src/components/ui/dropdown-menu.tsx +7 -2
  13. package/src/components/ui/input.tsx +21 -0
  14. package/src/components/ui/separator.tsx +23 -0
  15. package/src/components/ui/sheet.tsx +220 -0
  16. package/src/components/ui/sidebar.tsx +785 -221
  17. package/src/components/ui/skeleton.tsx +13 -0
  18. package/src/constants/urls.ts +1 -0
  19. package/src/features/admin/utils.ts +2 -45
  20. package/src/features/alertDialog/DialogContext.tsx +1 -1
  21. package/src/features/auth/components/LoginButton.tsx +25 -18
  22. package/src/features/auth/components/LoginPreferencesControls.tsx +124 -0
  23. package/src/features/auth/components/LoginView.tsx +131 -49
  24. package/src/features/config/types.ts +64 -82
  25. package/src/features/drawer/DrawerContext.tsx +55 -19
  26. package/src/features/layouts/AppLayout.tsx +3 -3
  27. package/src/features/layouts/OverlayShell.tsx +376 -77
  28. package/src/features/layouts/appbar/AppBarLayout.tsx +501 -88
  29. package/src/features/layouts/branding/AppBrandIcon.tsx +95 -0
  30. package/src/features/layouts/branding/resolveThemeAsset.spec.ts +33 -0
  31. package/src/features/layouts/branding/resolveThemeAsset.ts +33 -0
  32. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +49 -0
  33. package/src/features/layouts/chrome/ContentDragOverlay.tsx +19 -0
  34. package/src/features/layouts/chrome/DesktopBackButton.tsx +71 -0
  35. package/src/features/layouts/chrome/DesktopChrome.tsx +28 -0
  36. package/src/features/layouts/chrome/DesktopForwardButton.tsx +59 -0
  37. package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +16 -0
  38. package/src/features/layouts/chrome/constants.ts +11 -0
  39. package/src/features/layouts/chrome/goDesktopBack.spec.ts +218 -0
  40. package/src/features/layouts/chrome/goDesktopBack.ts +106 -0
  41. package/src/features/layouts/chrome/index.ts +26 -0
  42. package/src/features/layouts/chrome/runtime.ts +45 -0
  43. package/src/features/layouts/findMatchingNavigationItem.spec.ts +55 -0
  44. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +17 -1
  45. package/src/features/layouts/isFrameForAppUrl.spec.ts +33 -0
  46. package/src/features/layouts/sidebar/NavigationContent.tsx +70 -34
  47. package/src/features/layouts/sidebar/SidebarIcons.tsx +41 -42
  48. package/src/features/layouts/sidebar/SidebarInner.tsx +142 -24
  49. package/src/features/layouts/sidebar/SidebarLayout.tsx +100 -37
  50. package/src/features/layouts/sidebar/sidebarUtils.ts +0 -7
  51. package/src/features/layouts/sidebar/types.ts +3 -3
  52. package/src/features/layouts/utils.ts +73 -5
  53. package/src/features/layouts/windows/WindowsLayout.tsx +173 -61
  54. package/src/features/modal/ModalContext.tsx +21 -8
  55. package/src/features/overlays/OverlayDrawerPendingBar.tsx +26 -0
  56. package/src/features/overlays/OverlayDynamicDemoView.tsx +108 -0
  57. package/src/features/overlays/OverlayPendingSpinner.tsx +18 -0
  58. package/src/features/overlays/ResponsiveModal.tsx +483 -0
  59. package/src/features/overlays/overlaySize.spec.ts +71 -0
  60. package/src/features/overlays/overlaySize.ts +228 -0
  61. package/src/features/overlays/useOverlayReportedSize.ts +130 -0
  62. package/src/features/settings/SettingsProvider.tsx +66 -46
  63. package/src/features/settings/SettingsView.tsx +42 -47
  64. package/src/features/settings/components/Appearance.tsx +305 -55
  65. package/src/features/settings/components/develop/DrawerTestButtons.tsx +18 -0
  66. package/src/features/settings/components/develop/ModalTestButtons.tsx +23 -0
  67. package/src/features/settings/utils/getResolvedAppearanceForSettings.ts +11 -5
  68. package/src/features/theme/applyTheme.ts +143 -0
  69. package/src/features/theme/color.ts +83 -0
  70. package/src/features/theme/curated/amber-minimal.json +86 -0
  71. package/src/features/theme/curated/amethyst-haze.json +86 -0
  72. package/src/features/theme/curated/astro-vista.json +86 -0
  73. package/src/features/theme/curated/bold-tech.json +86 -0
  74. package/src/features/theme/curated/bubblegum.json +86 -0
  75. package/src/features/theme/curated/caffeine.json +83 -0
  76. package/src/features/theme/curated/candyland.json +86 -0
  77. package/src/features/theme/curated/catppuccin.json +86 -0
  78. package/src/features/theme/curated/claude.json +86 -0
  79. package/src/features/theme/curated/claymorphism.json +86 -0
  80. package/src/features/theme/curated/clean-slate.json +86 -0
  81. package/src/features/theme/curated/cosmic-night.json +86 -0
  82. package/src/features/theme/curated/cyberpunk.json +86 -0
  83. package/src/features/theme/curated/darkmatter.json +86 -0
  84. package/src/features/theme/curated/doom-64.json +86 -0
  85. package/src/features/theme/curated/elegant-luxury.json +86 -0
  86. package/src/features/theme/curated/graphite.json +86 -0
  87. package/src/features/theme/curated/index.ts +260 -0
  88. package/src/features/theme/curated/kodama-grove.json +86 -0
  89. package/src/features/theme/curated/light-green.json +87 -0
  90. package/src/features/theme/curated/midnight-bloom.json +86 -0
  91. package/src/features/theme/curated/mocha-mousse.json +86 -0
  92. package/src/features/theme/curated/modern-minimal.json +86 -0
  93. package/src/features/theme/curated/mono.json +84 -0
  94. package/src/features/theme/curated/nature.json +86 -0
  95. package/src/features/theme/curated/neo-brutalism.json +86 -0
  96. package/src/features/theme/curated/northern-lights.json +86 -0
  97. package/src/features/theme/curated/notebook.json +87 -0
  98. package/src/features/theme/curated/ocean-breeze.json +86 -0
  99. package/src/features/theme/curated/pastel-dreams.json +86 -0
  100. package/src/features/theme/curated/perpetuity.json +86 -0
  101. package/src/features/theme/curated/quantum-rose.json +86 -0
  102. package/src/features/theme/curated/retro-arcade.json +86 -0
  103. package/src/features/theme/curated/sage-garden.json +86 -0
  104. package/src/features/theme/curated/shadcn.json +83 -0
  105. package/src/features/theme/curated/shellui.json +82 -0
  106. package/src/features/theme/curated/soft-pop.json +86 -0
  107. package/src/features/theme/curated/solar-dusk.json +86 -0
  108. package/src/features/theme/curated/starry-night.json +86 -0
  109. package/src/features/theme/curated/sunset-horizon.json +86 -0
  110. package/src/features/theme/curated/supabase.json +85 -0
  111. package/src/features/theme/curated/t3-chat.json +83 -0
  112. package/src/features/theme/curated/tangerine.json +86 -0
  113. package/src/features/theme/curated/twitter.json +86 -0
  114. package/src/features/theme/curated/vercel.json +86 -0
  115. package/src/features/theme/curated/vintage-paper.json +86 -0
  116. package/src/features/theme/curated/violet-bloom.json +87 -0
  117. package/src/features/theme/curated/zen-inspired.json +87 -0
  118. package/src/features/theme/index.ts +76 -0
  119. package/src/features/theme/normalize.ts +159 -0
  120. package/src/features/theme/registry.ts +50 -0
  121. package/src/features/theme/resolveConfig.ts +182 -0
  122. package/src/features/theme/safeApplyTheme.ts +147 -0
  123. package/src/features/theme/themes.spec.ts +276 -0
  124. package/src/features/theme/themes.ts +82 -558
  125. package/src/features/theme/tokenKeys.ts +60 -0
  126. package/src/features/theme/types.ts +170 -0
  127. package/src/features/theme/useTheme.tsx +48 -50
  128. package/src/hooks/use-mobile.tsx +19 -0
  129. package/src/i18n/translations/en/common.json +41 -0
  130. package/src/i18n/translations/en/settings.json +10 -2
  131. package/src/i18n/translations/fr/common.json +41 -0
  132. package/src/i18n/translations/fr/settings.json +10 -2
  133. package/src/index.css +372 -128
  134. package/src/index.ts +71 -0
  135. package/src/lib/z-index.ts +4 -1
  136. package/src/routes/components/IndexRoute.tsx +12 -2
  137. package/src/routes/components/NavigationItemRoute.tsx +1 -10
  138. package/src/routes/hooks/useNavigationItems.ts +29 -44
  139. package/src/routes/routes.tsx +63 -27
  140. package/tailwind.config.js +27 -27
  141. package/src/features/layouts/sidebar/BottomNavItem.tsx +0 -88
  142. package/src/features/layouts/sidebar/MobileBottomNav.tsx +0 -168
@@ -0,0 +1,220 @@
1
+ import {
2
+ forwardRef,
3
+ useCallback,
4
+ type ComponentProps,
5
+ type ComponentPropsWithoutRef,
6
+ type ElementRef,
7
+ type HTMLAttributes,
8
+ } from 'react';
9
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
10
+ import { cva, type VariantProps } from 'class-variance-authority';
11
+ import { cn } from '../../lib/utils';
12
+ import { Z_INDEX } from '../../lib/z-index';
13
+
14
+ const PORTALED_OVERLAY_SELECTOR =
15
+ '[data-dropdown-menu-content], [data-auth-menu-content], [data-sonner-toaster], [data-upload-toast]';
16
+
17
+ function isPortaledOverlayTarget(target: EventTarget | null): boolean {
18
+ const element = target instanceof Element ? target : (target as Node | null)?.parentElement;
19
+ if (!element) return false;
20
+ return Boolean(element.closest(PORTALED_OVERLAY_SELECTOR));
21
+ }
22
+
23
+ const Sheet = SheetPrimitive.Root;
24
+
25
+ const SheetTrigger = SheetPrimitive.Trigger;
26
+
27
+ const SheetClose = SheetPrimitive.Close;
28
+
29
+ const SheetPortal = SheetPrimitive.Portal;
30
+
31
+ const SheetOverlay = forwardRef<
32
+ ElementRef<typeof SheetPrimitive.Overlay>,
33
+ ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
34
+ >(({ className, style, ...props }, ref) => (
35
+ <SheetPrimitive.Overlay
36
+ ref={ref}
37
+ data-sheet-overlay=""
38
+ className={cn('fixed inset-0 bg-black/50 backdrop-blur-[1px]', className)}
39
+ style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_OVERLAY, ...style }}
40
+ {...props}
41
+ />
42
+ ));
43
+ SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
44
+
45
+ const sheetVariants = cva('fixed flex flex-col gap-4 bg-background shadow-lg', {
46
+ variants: {
47
+ side: {
48
+ top: 'inset-x-0 top-0 border-b',
49
+ bottom: 'inset-x-0 bottom-0 border-t',
50
+ left: 'inset-y-0 left-0 h-full w-3/4 max-w-full border-r sm:max-w-sm',
51
+ right: 'inset-y-0 right-0 h-full w-3/4 max-w-full border-l sm:max-w-sm',
52
+ },
53
+ },
54
+ defaultVariants: {
55
+ side: 'right',
56
+ },
57
+ });
58
+
59
+ interface SheetContentProps
60
+ extends
61
+ ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
62
+ VariantProps<typeof sheetVariants> {
63
+ overlayZIndex?: number;
64
+ contentZIndex?: number;
65
+ }
66
+
67
+ const SheetContent = forwardRef<ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(
68
+ (
69
+ {
70
+ side = 'right',
71
+ className,
72
+ children,
73
+ style,
74
+ overlayZIndex,
75
+ contentZIndex,
76
+ onPointerDownOutside,
77
+ onFocusOutside,
78
+ onInteractOutside,
79
+ ...props
80
+ },
81
+ ref,
82
+ ) => {
83
+ const handlePointerDownOutside = useCallback(
84
+ (
85
+ event: Parameters<
86
+ NonNullable<ComponentProps<typeof SheetPrimitive.Content>['onPointerDownOutside']>
87
+ >[0],
88
+ ) => {
89
+ if (isPortaledOverlayTarget(event.target)) {
90
+ event.preventDefault();
91
+ }
92
+ onPointerDownOutside?.(event);
93
+ },
94
+ [onPointerDownOutside],
95
+ );
96
+
97
+ const handleFocusOutside = useCallback(
98
+ (
99
+ event: Parameters<
100
+ NonNullable<ComponentProps<typeof SheetPrimitive.Content>['onFocusOutside']>
101
+ >[0],
102
+ ) => {
103
+ if (isPortaledOverlayTarget(event.target)) {
104
+ event.preventDefault();
105
+ }
106
+ onFocusOutside?.(event);
107
+ },
108
+ [onFocusOutside],
109
+ );
110
+
111
+ const handleInteractOutside = useCallback(
112
+ (
113
+ event: Parameters<
114
+ NonNullable<ComponentProps<typeof SheetPrimitive.Content>['onInteractOutside']>
115
+ >[0],
116
+ ) => {
117
+ if (isPortaledOverlayTarget(event.target)) {
118
+ event.preventDefault();
119
+ }
120
+ onInteractOutside?.(event);
121
+ },
122
+ [onInteractOutside],
123
+ );
124
+
125
+ return (
126
+ <SheetPortal>
127
+ <SheetOverlay style={overlayZIndex !== undefined ? { zIndex: overlayZIndex } : undefined} />
128
+ <SheetPrimitive.Content
129
+ ref={ref}
130
+ data-sheet-content=""
131
+ data-side={side}
132
+ className={cn(sheetVariants({ side }), className)}
133
+ style={{
134
+ zIndex: contentZIndex ?? Z_INDEX.SIDEBAR_SHEET_CONTENT,
135
+ ...style,
136
+ }}
137
+ onPointerDownOutside={handlePointerDownOutside}
138
+ onFocusOutside={handleFocusOutside}
139
+ onInteractOutside={handleInteractOutside}
140
+ {...props}
141
+ >
142
+ {children}
143
+ <SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary cursor-pointer">
144
+ <svg
145
+ xmlns="http://www.w3.org/2000/svg"
146
+ width="24"
147
+ height="24"
148
+ viewBox="0 0 24 24"
149
+ fill="none"
150
+ stroke="currentColor"
151
+ strokeWidth="2"
152
+ strokeLinecap="round"
153
+ strokeLinejoin="round"
154
+ className="size-4"
155
+ aria-hidden
156
+ >
157
+ <path d="M18 6 6 18" />
158
+ <path d="m6 6 12 12" />
159
+ </svg>
160
+ <span className="sr-only">Close</span>
161
+ </SheetPrimitive.Close>
162
+ </SheetPrimitive.Content>
163
+ </SheetPortal>
164
+ );
165
+ },
166
+ );
167
+ SheetContent.displayName = SheetPrimitive.Content.displayName;
168
+
169
+ const SheetHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
170
+ <div
171
+ className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
172
+ {...props}
173
+ />
174
+ );
175
+ SheetHeader.displayName = 'SheetHeader';
176
+
177
+ const SheetFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
178
+ <div
179
+ className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
180
+ {...props}
181
+ />
182
+ );
183
+ SheetFooter.displayName = 'SheetFooter';
184
+
185
+ const SheetTitle = forwardRef<
186
+ ElementRef<typeof SheetPrimitive.Title>,
187
+ ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
188
+ >(({ className, ...props }, ref) => (
189
+ <SheetPrimitive.Title
190
+ ref={ref}
191
+ className={cn('text-lg font-semibold text-foreground', className)}
192
+ {...props}
193
+ />
194
+ ));
195
+ SheetTitle.displayName = SheetPrimitive.Title.displayName;
196
+
197
+ const SheetDescription = forwardRef<
198
+ ElementRef<typeof SheetPrimitive.Description>,
199
+ ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
200
+ >(({ className, ...props }, ref) => (
201
+ <SheetPrimitive.Description
202
+ ref={ref}
203
+ className={cn('text-sm text-muted-foreground', className)}
204
+ {...props}
205
+ />
206
+ ));
207
+ SheetDescription.displayName = SheetPrimitive.Description.displayName;
208
+
209
+ export {
210
+ Sheet,
211
+ SheetPortal,
212
+ SheetOverlay,
213
+ SheetTrigger,
214
+ SheetClose,
215
+ SheetContent,
216
+ SheetHeader,
217
+ SheetFooter,
218
+ SheetTitle,
219
+ SheetDescription,
220
+ };