@shellui/core 0.4.0 → 0.5.0-alpha.1
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 +2 -2
- package/package.json +15 -3
- package/schemas/curated-themes.json +4035 -0
- package/schemas/shellui.config.schema.json +961 -0
- package/schemas/shellui.theme.schema.json +187 -0
- package/src/app.tsx +4 -1
- package/src/components/ContentView.tsx +144 -9
- package/src/components/LoadingOverlay.tsx +1 -1
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/dialog.tsx +23 -5
- package/src/components/ui/drawer.tsx +282 -42
- package/src/components/ui/dropdown-menu.tsx +7 -2
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +220 -0
- package/src/components/ui/sidebar.tsx +785 -221
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/constants/urls.ts +1 -0
- package/src/features/admin/utils.ts +2 -45
- package/src/features/alertDialog/DialogContext.tsx +1 -1
- package/src/features/auth/components/LoginButton.tsx +25 -18
- package/src/features/auth/components/LoginPreferencesControls.tsx +124 -0
- package/src/features/auth/components/LoginView.tsx +131 -49
- package/src/features/config/types.ts +64 -82
- package/src/features/drawer/DrawerContext.tsx +55 -19
- package/src/features/layouts/AppLayout.tsx +3 -3
- package/src/features/layouts/OverlayShell.tsx +376 -77
- package/src/features/layouts/appbar/AppBarLayout.tsx +501 -88
- package/src/features/layouts/branding/AppBrandIcon.tsx +95 -0
- package/src/features/layouts/branding/resolveThemeAsset.spec.ts +33 -0
- package/src/features/layouts/branding/resolveThemeAsset.ts +33 -0
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +49 -0
- package/src/features/layouts/chrome/ContentDragOverlay.tsx +19 -0
- package/src/features/layouts/chrome/DesktopBackButton.tsx +71 -0
- package/src/features/layouts/chrome/DesktopChrome.tsx +28 -0
- package/src/features/layouts/chrome/DesktopForwardButton.tsx +59 -0
- package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +16 -0
- package/src/features/layouts/chrome/constants.ts +11 -0
- package/src/features/layouts/chrome/goDesktopBack.spec.ts +218 -0
- package/src/features/layouts/chrome/goDesktopBack.ts +106 -0
- package/src/features/layouts/chrome/index.ts +26 -0
- package/src/features/layouts/chrome/runtime.ts +45 -0
- package/src/features/layouts/findMatchingNavigationItem.spec.ts +55 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +17 -1
- package/src/features/layouts/isFrameForAppUrl.spec.ts +33 -0
- package/src/features/layouts/sidebar/NavigationContent.tsx +70 -34
- package/src/features/layouts/sidebar/SidebarIcons.tsx +41 -42
- package/src/features/layouts/sidebar/SidebarInner.tsx +142 -24
- package/src/features/layouts/sidebar/SidebarLayout.tsx +100 -37
- package/src/features/layouts/sidebar/sidebarUtils.ts +0 -7
- package/src/features/layouts/sidebar/types.ts +3 -3
- package/src/features/layouts/utils.ts +73 -5
- package/src/features/layouts/windows/WindowsLayout.tsx +173 -61
- package/src/features/modal/ModalContext.spec.ts +77 -0
- package/src/features/modal/ModalContext.tsx +32 -57
- package/src/features/modal/validateAndNormalizeUrl.ts +96 -0
- package/src/features/overlays/OverlayDrawerPendingBar.tsx +26 -0
- package/src/features/overlays/OverlayDynamicDemoView.tsx +108 -0
- package/src/features/overlays/OverlayPendingSpinner.tsx +18 -0
- package/src/features/overlays/ResponsiveModal.tsx +483 -0
- package/src/features/overlays/overlaySize.spec.ts +71 -0
- package/src/features/overlays/overlaySize.ts +228 -0
- package/src/features/overlays/useOverlayReportedSize.ts +130 -0
- package/src/features/settings/SettingsProvider.tsx +66 -46
- package/src/features/settings/SettingsView.tsx +42 -47
- package/src/features/settings/components/Appearance.tsx +305 -55
- package/src/features/settings/components/develop/DrawerTestButtons.tsx +18 -0
- package/src/features/settings/components/develop/ModalTestButtons.tsx +23 -0
- package/src/features/settings/utils/getResolvedAppearanceForSettings.ts +11 -5
- package/src/features/storage/StoragePickerContext.tsx +3 -3
- package/src/features/theme/applyTheme.ts +143 -0
- package/src/features/theme/color.ts +83 -0
- package/src/features/theme/curated/amber-minimal.json +86 -0
- package/src/features/theme/curated/amethyst-haze.json +86 -0
- package/src/features/theme/curated/astro-vista.json +86 -0
- package/src/features/theme/curated/bold-tech.json +86 -0
- package/src/features/theme/curated/bubblegum.json +86 -0
- package/src/features/theme/curated/caffeine.json +83 -0
- package/src/features/theme/curated/candyland.json +86 -0
- package/src/features/theme/curated/catppuccin.json +86 -0
- package/src/features/theme/curated/claude.json +86 -0
- package/src/features/theme/curated/claymorphism.json +86 -0
- package/src/features/theme/curated/clean-slate.json +86 -0
- package/src/features/theme/curated/cosmic-night.json +86 -0
- package/src/features/theme/curated/cyberpunk.json +86 -0
- package/src/features/theme/curated/darkmatter.json +86 -0
- package/src/features/theme/curated/doom-64.json +86 -0
- package/src/features/theme/curated/elegant-luxury.json +86 -0
- package/src/features/theme/curated/graphite.json +86 -0
- package/src/features/theme/curated/index.ts +260 -0
- package/src/features/theme/curated/kodama-grove.json +86 -0
- package/src/features/theme/curated/light-green.json +87 -0
- package/src/features/theme/curated/midnight-bloom.json +86 -0
- package/src/features/theme/curated/mocha-mousse.json +86 -0
- package/src/features/theme/curated/modern-minimal.json +86 -0
- package/src/features/theme/curated/mono.json +84 -0
- package/src/features/theme/curated/nature.json +86 -0
- package/src/features/theme/curated/neo-brutalism.json +86 -0
- package/src/features/theme/curated/northern-lights.json +86 -0
- package/src/features/theme/curated/notebook.json +87 -0
- package/src/features/theme/curated/ocean-breeze.json +86 -0
- package/src/features/theme/curated/pastel-dreams.json +86 -0
- package/src/features/theme/curated/perpetuity.json +86 -0
- package/src/features/theme/curated/quantum-rose.json +86 -0
- package/src/features/theme/curated/retro-arcade.json +86 -0
- package/src/features/theme/curated/sage-garden.json +86 -0
- package/src/features/theme/curated/shadcn.json +83 -0
- package/src/features/theme/curated/shellui.json +82 -0
- package/src/features/theme/curated/soft-pop.json +86 -0
- package/src/features/theme/curated/solar-dusk.json +86 -0
- package/src/features/theme/curated/starry-night.json +86 -0
- package/src/features/theme/curated/sunset-horizon.json +86 -0
- package/src/features/theme/curated/supabase.json +85 -0
- package/src/features/theme/curated/t3-chat.json +83 -0
- package/src/features/theme/curated/tangerine.json +86 -0
- package/src/features/theme/curated/twitter.json +86 -0
- package/src/features/theme/curated/vercel.json +86 -0
- package/src/features/theme/curated/vintage-paper.json +86 -0
- package/src/features/theme/curated/violet-bloom.json +87 -0
- package/src/features/theme/curated/zen-inspired.json +87 -0
- package/src/features/theme/index.ts +76 -0
- package/src/features/theme/normalize.ts +159 -0
- package/src/features/theme/registry.ts +50 -0
- package/src/features/theme/resolveConfig.ts +182 -0
- package/src/features/theme/safeApplyTheme.ts +147 -0
- package/src/features/theme/themes.spec.ts +276 -0
- package/src/features/theme/themes.ts +82 -558
- package/src/features/theme/tokenKeys.ts +60 -0
- package/src/features/theme/types.ts +170 -0
- package/src/features/theme/useTheme.tsx +48 -50
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/i18n/translations/en/common.json +41 -0
- package/src/i18n/translations/en/settings.json +10 -2
- package/src/i18n/translations/fr/common.json +41 -0
- package/src/i18n/translations/fr/settings.json +10 -2
- package/src/index.css +372 -128
- package/src/index.ts +71 -0
- package/src/lib/z-index.ts +4 -1
- package/src/routes/components/IndexRoute.tsx +12 -2
- package/src/routes/components/NavigationItemRoute.tsx +1 -10
- package/src/routes/hooks/useNavigationItems.ts +29 -44
- package/src/routes/routes.tsx +58 -27
- package/tailwind.config.js +27 -27
- package/src/features/layouts/sidebar/BottomNavItem.tsx +0 -88
- package/src/features/layouts/sidebar/MobileBottomNav.tsx +0 -168
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { Link, useLocation } from 'react-router';
|
|
2
|
-
import { useMemo, useEffect, useState, useRef, useLayoutEffect } from 'react';
|
|
3
|
-
import type { NavigationItem } from '../../config/types';
|
|
4
|
-
import { cn } from '../../../lib/utils';
|
|
5
|
-
import { Z_INDEX } from '../../../lib/z-index';
|
|
6
|
-
import {
|
|
7
|
-
getActivePathPrefix,
|
|
8
|
-
getNavPathPrefix,
|
|
9
|
-
resolveLocalizedString as resolveNavLabel,
|
|
10
|
-
HOMEPAGE_NAV_ITEM,
|
|
11
|
-
} from '../utils';
|
|
12
|
-
import {
|
|
13
|
-
getExternalFaviconUrl,
|
|
14
|
-
isAppIcon,
|
|
15
|
-
BOTTOM_NAV_SLOT_WIDTH,
|
|
16
|
-
BOTTOM_NAV_GAP,
|
|
17
|
-
BOTTOM_NAV_PX,
|
|
18
|
-
BOTTOM_NAV_MAX_SLOTS,
|
|
19
|
-
} from './sidebarUtils';
|
|
20
|
-
import { BottomNavItem } from './BottomNavItem';
|
|
21
|
-
import { CaretUpIcon, CaretDownIcon, HomeIcon } from './SidebarIcons';
|
|
22
|
-
|
|
23
|
-
/** Mobile bottom nav: optional Home + nav items; More only when not all fit. Dynamic from width. */
|
|
24
|
-
export function MobileBottomNav({
|
|
25
|
-
items,
|
|
26
|
-
currentLanguage,
|
|
27
|
-
showHomeButton,
|
|
28
|
-
}: {
|
|
29
|
-
items: NavigationItem[];
|
|
30
|
-
currentLanguage: string;
|
|
31
|
-
showHomeButton: boolean;
|
|
32
|
-
}) {
|
|
33
|
-
const location = useLocation();
|
|
34
|
-
const [expanded, setExpanded] = useState(false);
|
|
35
|
-
const navRef = useRef<HTMLElement>(null);
|
|
36
|
-
const [rowWidth, setRowWidth] = useState(0);
|
|
37
|
-
|
|
38
|
-
const activePathPrefix = useMemo(
|
|
39
|
-
() => getActivePathPrefix(location.pathname, items),
|
|
40
|
-
[location.pathname, items],
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
useLayoutEffect(() => {
|
|
44
|
-
const el = navRef.current;
|
|
45
|
-
if (!el) return;
|
|
46
|
-
const ro = new ResizeObserver((entries) => {
|
|
47
|
-
const w = entries[0]?.contentRect.width ?? 0;
|
|
48
|
-
setRowWidth(w);
|
|
49
|
-
});
|
|
50
|
-
ro.observe(el);
|
|
51
|
-
setRowWidth(el.getBoundingClientRect().width);
|
|
52
|
-
return () => ro.disconnect();
|
|
53
|
-
}, []);
|
|
54
|
-
|
|
55
|
-
const { rowItems, overflowItems, hasMore } = useMemo(() => {
|
|
56
|
-
const list = items.slice();
|
|
57
|
-
const contentWidth = Math.max(0, rowWidth - BOTTOM_NAV_PX * 2);
|
|
58
|
-
const slotTotal = BOTTOM_NAV_SLOT_WIDTH + BOTTOM_NAV_GAP;
|
|
59
|
-
const computedSlots =
|
|
60
|
-
rowWidth > 0 ? Math.floor((contentWidth + BOTTOM_NAV_GAP) / slotTotal) : 5;
|
|
61
|
-
const totalSlots = Math.min(Math.max(0, computedSlots), BOTTOM_NAV_MAX_SLOTS);
|
|
62
|
-
const slotsForNav = showHomeButton ? totalSlots - 1 : totalSlots;
|
|
63
|
-
const allFit = list.length <= slotsForNav;
|
|
64
|
-
const maxInRow = allFit
|
|
65
|
-
? list.length
|
|
66
|
-
: Math.max(0, showHomeButton ? totalSlots - 2 : totalSlots - 1);
|
|
67
|
-
const row = list.slice(0, maxInRow);
|
|
68
|
-
const rowPaths = new Set(row.map((i) => i.path));
|
|
69
|
-
const overflow = list.filter((item) => !rowPaths.has(item.path));
|
|
70
|
-
return {
|
|
71
|
-
rowItems: row,
|
|
72
|
-
overflowItems: overflow,
|
|
73
|
-
hasMore: overflow.length > 0,
|
|
74
|
-
};
|
|
75
|
-
}, [items, rowWidth, showHomeButton]);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
setExpanded(false);
|
|
79
|
-
}, [location.pathname]);
|
|
80
|
-
|
|
81
|
-
const renderItem = (item: NavigationItem, index: number) => {
|
|
82
|
-
const pathPrefix = getNavPathPrefix(item);
|
|
83
|
-
const isOverlayOrExternal =
|
|
84
|
-
item.openIn === 'modal' || item.openIn === 'drawer' || item.openIn === 'external';
|
|
85
|
-
const isActive = !isOverlayOrExternal && pathPrefix === activePathPrefix;
|
|
86
|
-
const label = resolveNavLabel(item.label, currentLanguage);
|
|
87
|
-
const faviconUrl =
|
|
88
|
-
item.openIn === 'external' && !item.icon ? getExternalFaviconUrl(item.url) : null;
|
|
89
|
-
const iconSrc = item.icon ?? faviconUrl ?? null;
|
|
90
|
-
const applyIconTheme = iconSrc ? isAppIcon(iconSrc) : false;
|
|
91
|
-
return (
|
|
92
|
-
<BottomNavItem
|
|
93
|
-
key={`${item.path}-${item.url}-${index}`}
|
|
94
|
-
item={item}
|
|
95
|
-
label={label}
|
|
96
|
-
isActive={isActive}
|
|
97
|
-
iconSrc={iconSrc}
|
|
98
|
-
applyIconTheme={applyIconTheme}
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<nav
|
|
105
|
-
ref={navRef}
|
|
106
|
-
className="fixed bottom-0 left-0 right-0 z-[9999] md:hidden border-t border-sidebar-border bg-sidebar-background overflow-hidden pt-2"
|
|
107
|
-
style={{
|
|
108
|
-
zIndex: Z_INDEX.SIDEBAR_TRIGGER,
|
|
109
|
-
paddingBottom: 'calc(0.5rem + env(safe-area-inset-bottom, 0px))',
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
<div className="flex flex-row flex-nowrap items-center justify-center gap-1 px-3 overflow-x-hidden">
|
|
113
|
-
{showHomeButton && (
|
|
114
|
-
<Link
|
|
115
|
-
to="/"
|
|
116
|
-
className={cn(
|
|
117
|
-
'flex flex-col items-center justify-center gap-1 rounded-md py-1.5 px-2 min-w-0 transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
118
|
-
location.pathname === '/' || location.pathname === ''
|
|
119
|
-
? 'bg-sidebar-accent text-sidebar-accent-foreground [&_span]:text-sidebar-accent-foreground'
|
|
120
|
-
: 'text-sidebar-foreground/80 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground [&_span]:inherit',
|
|
121
|
-
)}
|
|
122
|
-
aria-label={resolveNavLabel(HOMEPAGE_NAV_ITEM.label, currentLanguage) || 'Home'}
|
|
123
|
-
>
|
|
124
|
-
<span className="size-4 shrink-0 flex items-center justify-center [&_svg]:text-current">
|
|
125
|
-
<HomeIcon className="size-4" />
|
|
126
|
-
</span>
|
|
127
|
-
<span className="text-[11px] leading-tight">
|
|
128
|
-
{resolveNavLabel(HOMEPAGE_NAV_ITEM.label, currentLanguage) || 'Home'}
|
|
129
|
-
</span>
|
|
130
|
-
</Link>
|
|
131
|
-
)}
|
|
132
|
-
{rowItems.map((item, i) => renderItem(item, i))}
|
|
133
|
-
{hasMore && (
|
|
134
|
-
<button
|
|
135
|
-
type="button"
|
|
136
|
-
onClick={() => setExpanded((e) => !e)}
|
|
137
|
-
className={cn(
|
|
138
|
-
'flex flex-col items-center justify-center gap-1 rounded-md py-1.5 px-2 min-w-0 transition-colors cursor-pointer',
|
|
139
|
-
'text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
140
|
-
)}
|
|
141
|
-
aria-expanded={expanded}
|
|
142
|
-
aria-label={expanded ? 'Show less' : 'Show more'}
|
|
143
|
-
>
|
|
144
|
-
<span className="size-4 shrink-0 flex items-center justify-center">
|
|
145
|
-
{expanded ? <CaretDownIcon className="size-4" /> : <CaretUpIcon className="size-4" />}
|
|
146
|
-
</span>
|
|
147
|
-
<span className="text-[11px] leading-tight">{expanded ? 'Less' : 'More'}</span>
|
|
148
|
-
</button>
|
|
149
|
-
)}
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<div
|
|
153
|
-
className={cn(
|
|
154
|
-
'grid transition-[grid-template-rows] duration-300 ease-out',
|
|
155
|
-
expanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',
|
|
156
|
-
)}
|
|
157
|
-
>
|
|
158
|
-
<div className="min-h-0 overflow-hidden">
|
|
159
|
-
<div className="px-4 pt-3 pb-2 border-t border-sidebar-border/50 mt-1">
|
|
160
|
-
<div className="grid grid-cols-5 gap-2 justify-items-center max-w-xs mx-auto">
|
|
161
|
-
{expanded ? overflowItems.map((item, i) => renderItem(item, i)) : null}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
</nav>
|
|
167
|
-
);
|
|
168
|
-
}
|