@shellui/core 0.4.1 → 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.tsx +21 -8
- 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/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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "twitter",
|
|
4
|
+
"label": "Twitter",
|
|
5
|
+
"description": "Sky-blue social palette (Open Sans).",
|
|
6
|
+
"recommended": true,
|
|
7
|
+
"radius": "1.3rem",
|
|
8
|
+
"fonts": {
|
|
9
|
+
"sans": "Open Sans, sans-serif",
|
|
10
|
+
"serif": "Georgia, serif",
|
|
11
|
+
"mono": "Menlo, monospace",
|
|
12
|
+
"files": [
|
|
13
|
+
"https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"light": {
|
|
17
|
+
"background": "oklch(1.0000 0 0)",
|
|
18
|
+
"foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
19
|
+
"card": "oklch(0.9784 0.0011 197.1387)",
|
|
20
|
+
"cardForeground": "oklch(0.1884 0.0128 248.5103)",
|
|
21
|
+
"popover": "oklch(1.0000 0 0)",
|
|
22
|
+
"popoverForeground": "oklch(0.1884 0.0128 248.5103)",
|
|
23
|
+
"primary": "oklch(0.6723 0.1606 244.9955)",
|
|
24
|
+
"primaryForeground": "oklch(1.0000 0 0)",
|
|
25
|
+
"secondary": "oklch(0.1884 0.0128 248.5103)",
|
|
26
|
+
"secondaryForeground": "oklch(1.0000 0 0)",
|
|
27
|
+
"muted": "oklch(0.9222 0.0013 286.3737)",
|
|
28
|
+
"mutedForeground": "oklch(0.1884 0.0128 248.5103)",
|
|
29
|
+
"accent": "oklch(0.9392 0.0166 250.8453)",
|
|
30
|
+
"accentForeground": "oklch(0.6723 0.1606 244.9955)",
|
|
31
|
+
"destructive": "oklch(0.6188 0.2376 25.7658)",
|
|
32
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
33
|
+
"border": "oklch(0.9317 0.0118 231.6594)",
|
|
34
|
+
"input": "oklch(0.9809 0.0025 228.7836)",
|
|
35
|
+
"ring": "oklch(0.6818 0.1584 243.3540)",
|
|
36
|
+
"chart1": "oklch(0.6723 0.1606 244.9955)",
|
|
37
|
+
"chart2": "oklch(0.6907 0.1554 160.3454)",
|
|
38
|
+
"chart3": "oklch(0.8214 0.1600 82.5337)",
|
|
39
|
+
"chart4": "oklch(0.7064 0.1822 151.7125)",
|
|
40
|
+
"chart5": "oklch(0.5919 0.2186 10.5826)",
|
|
41
|
+
"radius": "1.3rem",
|
|
42
|
+
"sidebarBackground": "oklch(0.9784 0.0011 197.1387)",
|
|
43
|
+
"sidebarForeground": "oklch(0.1884 0.0128 248.5103)",
|
|
44
|
+
"sidebarPrimary": "oklch(0.6723 0.1606 244.9955)",
|
|
45
|
+
"sidebarPrimaryForeground": "oklch(1.0000 0 0)",
|
|
46
|
+
"sidebarAccent": "oklch(0.9392 0.0166 250.8453)",
|
|
47
|
+
"sidebarAccentForeground": "oklch(0.6723 0.1606 244.9955)",
|
|
48
|
+
"sidebarBorder": "oklch(0.9271 0.0101 238.5177)",
|
|
49
|
+
"sidebarRing": "oklch(0.6818 0.1584 243.3540)"
|
|
50
|
+
},
|
|
51
|
+
"dark": {
|
|
52
|
+
"background": "oklch(0 0 0)",
|
|
53
|
+
"foreground": "oklch(0.9328 0.0025 228.7857)",
|
|
54
|
+
"card": "oklch(0.2097 0.0080 274.5332)",
|
|
55
|
+
"cardForeground": "oklch(0.8853 0 0)",
|
|
56
|
+
"popover": "oklch(0 0 0)",
|
|
57
|
+
"popoverForeground": "oklch(0.9328 0.0025 228.7857)",
|
|
58
|
+
"primary": "oklch(0.6692 0.1607 245.0110)",
|
|
59
|
+
"primaryForeground": "oklch(1.0000 0 0)",
|
|
60
|
+
"secondary": "oklch(0.9622 0.0035 219.5331)",
|
|
61
|
+
"secondaryForeground": "oklch(0.1884 0.0128 248.5103)",
|
|
62
|
+
"muted": "oklch(0.2090 0 0)",
|
|
63
|
+
"mutedForeground": "oklch(0.5637 0.0078 247.9662)",
|
|
64
|
+
"accent": "oklch(0.1928 0.0331 242.5459)",
|
|
65
|
+
"accentForeground": "oklch(0.6692 0.1607 245.0110)",
|
|
66
|
+
"destructive": "oklch(0.6188 0.2376 25.7658)",
|
|
67
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
68
|
+
"border": "oklch(0.2674 0.0047 248.0045)",
|
|
69
|
+
"input": "oklch(0.3020 0.0288 244.8244)",
|
|
70
|
+
"ring": "oklch(0.6818 0.1584 243.3540)",
|
|
71
|
+
"chart1": "oklch(0.6723 0.1606 244.9955)",
|
|
72
|
+
"chart2": "oklch(0.6907 0.1554 160.3454)",
|
|
73
|
+
"chart3": "oklch(0.8214 0.1600 82.5337)",
|
|
74
|
+
"chart4": "oklch(0.7064 0.1822 151.7125)",
|
|
75
|
+
"chart5": "oklch(0.5919 0.2186 10.5826)",
|
|
76
|
+
"radius": "1.3rem",
|
|
77
|
+
"sidebarBackground": "oklch(0.2097 0.0080 274.5332)",
|
|
78
|
+
"sidebarForeground": "oklch(0.8853 0 0)",
|
|
79
|
+
"sidebarPrimary": "oklch(0.6818 0.1584 243.3540)",
|
|
80
|
+
"sidebarPrimaryForeground": "oklch(1.0000 0 0)",
|
|
81
|
+
"sidebarAccent": "oklch(0.1928 0.0331 242.5459)",
|
|
82
|
+
"sidebarAccentForeground": "oklch(0.6692 0.1607 245.0110)",
|
|
83
|
+
"sidebarBorder": "oklch(0.3795 0.0220 240.5943)",
|
|
84
|
+
"sidebarRing": "oklch(0.6818 0.1584 243.3540)"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "vercel",
|
|
4
|
+
"label": "Vercel",
|
|
5
|
+
"description": "Stark black-and-white Vercel aesthetic (Geist + Geist Mono).",
|
|
6
|
+
"recommended": true,
|
|
7
|
+
"radius": "0.5rem",
|
|
8
|
+
"fonts": {
|
|
9
|
+
"sans": "Geist, sans-serif",
|
|
10
|
+
"serif": "Georgia, serif",
|
|
11
|
+
"mono": "Geist Mono, monospace",
|
|
12
|
+
"files": [
|
|
13
|
+
"https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"light": {
|
|
17
|
+
"background": "oklch(0.9900 0 0)",
|
|
18
|
+
"foreground": "oklch(0 0 0)",
|
|
19
|
+
"card": "oklch(1 0 0)",
|
|
20
|
+
"cardForeground": "oklch(0 0 0)",
|
|
21
|
+
"popover": "oklch(0.9900 0 0)",
|
|
22
|
+
"popoverForeground": "oklch(0 0 0)",
|
|
23
|
+
"primary": "oklch(0 0 0)",
|
|
24
|
+
"primaryForeground": "oklch(1 0 0)",
|
|
25
|
+
"secondary": "oklch(0.9400 0 0)",
|
|
26
|
+
"secondaryForeground": "oklch(0 0 0)",
|
|
27
|
+
"muted": "oklch(0.9700 0 0)",
|
|
28
|
+
"mutedForeground": "oklch(0.4400 0 0)",
|
|
29
|
+
"accent": "oklch(0.9400 0 0)",
|
|
30
|
+
"accentForeground": "oklch(0 0 0)",
|
|
31
|
+
"destructive": "oklch(0.6300 0.1900 23.0300)",
|
|
32
|
+
"destructiveForeground": "oklch(1 0 0)",
|
|
33
|
+
"border": "oklch(0.9200 0 0)",
|
|
34
|
+
"input": "oklch(0.9400 0 0)",
|
|
35
|
+
"ring": "oklch(0 0 0)",
|
|
36
|
+
"chart1": "oklch(0.8100 0.1700 75.3500)",
|
|
37
|
+
"chart2": "oklch(0.5500 0.2200 264.5300)",
|
|
38
|
+
"chart3": "oklch(0.7200 0 0)",
|
|
39
|
+
"chart4": "oklch(0.9200 0 0)",
|
|
40
|
+
"chart5": "oklch(0.5600 0 0)",
|
|
41
|
+
"radius": "0.5rem",
|
|
42
|
+
"sidebarBackground": "oklch(0.9900 0 0)",
|
|
43
|
+
"sidebarForeground": "oklch(0 0 0)",
|
|
44
|
+
"sidebarPrimary": "oklch(0 0 0)",
|
|
45
|
+
"sidebarPrimaryForeground": "oklch(1 0 0)",
|
|
46
|
+
"sidebarAccent": "oklch(0.9400 0 0)",
|
|
47
|
+
"sidebarAccentForeground": "oklch(0 0 0)",
|
|
48
|
+
"sidebarBorder": "oklch(0.9400 0 0)",
|
|
49
|
+
"sidebarRing": "oklch(0 0 0)"
|
|
50
|
+
},
|
|
51
|
+
"dark": {
|
|
52
|
+
"background": "oklch(0 0 0)",
|
|
53
|
+
"foreground": "oklch(1 0 0)",
|
|
54
|
+
"card": "oklch(0.1400 0 0)",
|
|
55
|
+
"cardForeground": "oklch(1 0 0)",
|
|
56
|
+
"popover": "oklch(0.1800 0 0)",
|
|
57
|
+
"popoverForeground": "oklch(1 0 0)",
|
|
58
|
+
"primary": "oklch(1 0 0)",
|
|
59
|
+
"primaryForeground": "oklch(0 0 0)",
|
|
60
|
+
"secondary": "oklch(0.2500 0 0)",
|
|
61
|
+
"secondaryForeground": "oklch(1 0 0)",
|
|
62
|
+
"muted": "oklch(0.2300 0 0)",
|
|
63
|
+
"mutedForeground": "oklch(0.7200 0 0)",
|
|
64
|
+
"accent": "oklch(0.3200 0 0)",
|
|
65
|
+
"accentForeground": "oklch(1 0 0)",
|
|
66
|
+
"destructive": "oklch(0.6900 0.2000 23.9100)",
|
|
67
|
+
"destructiveForeground": "oklch(0 0 0)",
|
|
68
|
+
"border": "oklch(0.2600 0 0)",
|
|
69
|
+
"input": "oklch(0.3200 0 0)",
|
|
70
|
+
"ring": "oklch(0.7200 0 0)",
|
|
71
|
+
"chart1": "oklch(0.8100 0.1700 75.3500)",
|
|
72
|
+
"chart2": "oklch(0.5800 0.2100 260.8400)",
|
|
73
|
+
"chart3": "oklch(0.5600 0 0)",
|
|
74
|
+
"chart4": "oklch(0.4400 0 0)",
|
|
75
|
+
"chart5": "oklch(0.9200 0 0)",
|
|
76
|
+
"radius": "0.5rem",
|
|
77
|
+
"sidebarBackground": "oklch(0.1800 0 0)",
|
|
78
|
+
"sidebarForeground": "oklch(1 0 0)",
|
|
79
|
+
"sidebarPrimary": "oklch(1 0 0)",
|
|
80
|
+
"sidebarPrimaryForeground": "oklch(0 0 0)",
|
|
81
|
+
"sidebarAccent": "oklch(0.3200 0 0)",
|
|
82
|
+
"sidebarAccentForeground": "oklch(1 0 0)",
|
|
83
|
+
"sidebarBorder": "oklch(0.3200 0 0)",
|
|
84
|
+
"sidebarRing": "oklch(0.7200 0 0)"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "vintage-paper",
|
|
4
|
+
"label": "Vintage Paper",
|
|
5
|
+
"description": "Aged paper browns (Libre Baskerville + Lora + IBM Plex Mono).",
|
|
6
|
+
"recommended": true,
|
|
7
|
+
"radius": "0.25rem",
|
|
8
|
+
"fonts": {
|
|
9
|
+
"sans": "Libre Baskerville, serif",
|
|
10
|
+
"serif": "Lora, serif",
|
|
11
|
+
"mono": "IBM Plex Mono, monospace",
|
|
12
|
+
"files": [
|
|
13
|
+
"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100..700;1,100..700&family=Libre+Baskerville:ital,wght@0,400..700;1,400..700&family=Lora:ital,wght@0,400..700;1,400..700&display=swap"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"light": {
|
|
17
|
+
"background": "oklch(0.9582 0.0152 90.2357)",
|
|
18
|
+
"foreground": "oklch(0.3760 0.0225 64.3434)",
|
|
19
|
+
"card": "oklch(0.9914 0.0098 87.4695)",
|
|
20
|
+
"cardForeground": "oklch(0.3760 0.0225 64.3434)",
|
|
21
|
+
"popover": "oklch(0.9914 0.0098 87.4695)",
|
|
22
|
+
"popoverForeground": "oklch(0.3760 0.0225 64.3434)",
|
|
23
|
+
"primary": "oklch(0.6180 0.0778 65.5444)",
|
|
24
|
+
"primaryForeground": "oklch(1.0000 0 0)",
|
|
25
|
+
"secondary": "oklch(0.8846 0.0302 85.5655)",
|
|
26
|
+
"secondaryForeground": "oklch(0.4313 0.0300 64.9288)",
|
|
27
|
+
"muted": "oklch(0.9239 0.0190 83.0636)",
|
|
28
|
+
"mutedForeground": "oklch(0.5391 0.0387 71.1655)",
|
|
29
|
+
"accent": "oklch(0.8348 0.0426 88.8064)",
|
|
30
|
+
"accentForeground": "oklch(0.3760 0.0225 64.3434)",
|
|
31
|
+
"destructive": "oklch(0.5471 0.1438 32.9149)",
|
|
32
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
33
|
+
"border": "oklch(0.8606 0.0321 84.5881)",
|
|
34
|
+
"input": "oklch(0.8606 0.0321 84.5881)",
|
|
35
|
+
"ring": "oklch(0.6180 0.0778 65.5444)",
|
|
36
|
+
"chart1": "oklch(0.6180 0.0778 65.5444)",
|
|
37
|
+
"chart2": "oklch(0.5604 0.0624 68.5805)",
|
|
38
|
+
"chart3": "oklch(0.4851 0.0570 72.6827)",
|
|
39
|
+
"chart4": "oklch(0.6777 0.0624 64.7755)",
|
|
40
|
+
"chart5": "oklch(0.7264 0.0581 66.6967)",
|
|
41
|
+
"radius": "0.25rem",
|
|
42
|
+
"sidebarBackground": "oklch(0.9239 0.0190 83.0636)",
|
|
43
|
+
"sidebarForeground": "oklch(0.3760 0.0225 64.3434)",
|
|
44
|
+
"sidebarPrimary": "oklch(0.6180 0.0778 65.5444)",
|
|
45
|
+
"sidebarPrimaryForeground": "oklch(1.0000 0 0)",
|
|
46
|
+
"sidebarAccent": "oklch(0.8348 0.0426 88.8064)",
|
|
47
|
+
"sidebarAccentForeground": "oklch(0.3760 0.0225 64.3434)",
|
|
48
|
+
"sidebarBorder": "oklch(0.8606 0.0321 84.5881)",
|
|
49
|
+
"sidebarRing": "oklch(0.6180 0.0778 65.5444)"
|
|
50
|
+
},
|
|
51
|
+
"dark": {
|
|
52
|
+
"background": "oklch(0.2747 0.0139 57.6523)",
|
|
53
|
+
"foreground": "oklch(0.9239 0.0190 83.0636)",
|
|
54
|
+
"card": "oklch(0.3237 0.0155 59.0603)",
|
|
55
|
+
"cardForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
56
|
+
"popover": "oklch(0.3237 0.0155 59.0603)",
|
|
57
|
+
"popoverForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
58
|
+
"primary": "oklch(0.7264 0.0581 66.6967)",
|
|
59
|
+
"primaryForeground": "oklch(0.2747 0.0139 57.6523)",
|
|
60
|
+
"secondary": "oklch(0.3795 0.0181 57.1280)",
|
|
61
|
+
"secondaryForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
62
|
+
"muted": "oklch(0.2939 0.0125 62.1298)",
|
|
63
|
+
"mutedForeground": "oklch(0.7982 0.0243 82.1078)",
|
|
64
|
+
"accent": "oklch(0.4186 0.0281 56.3404)",
|
|
65
|
+
"accentForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
66
|
+
"destructive": "oklch(0.5471 0.1438 32.9149)",
|
|
67
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
68
|
+
"border": "oklch(0.3795 0.0181 57.1280)",
|
|
69
|
+
"input": "oklch(0.3795 0.0181 57.1280)",
|
|
70
|
+
"ring": "oklch(0.7264 0.0581 66.6967)",
|
|
71
|
+
"chart1": "oklch(0.7264 0.0581 66.6967)",
|
|
72
|
+
"chart2": "oklch(0.6777 0.0624 64.7755)",
|
|
73
|
+
"chart3": "oklch(0.6180 0.0778 65.5444)",
|
|
74
|
+
"chart4": "oklch(0.5604 0.0624 68.5805)",
|
|
75
|
+
"chart5": "oklch(0.4851 0.0570 72.6827)",
|
|
76
|
+
"radius": "0.25rem",
|
|
77
|
+
"sidebarBackground": "oklch(0.2747 0.0139 57.6523)",
|
|
78
|
+
"sidebarForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
79
|
+
"sidebarPrimary": "oklch(0.7264 0.0581 66.6967)",
|
|
80
|
+
"sidebarPrimaryForeground": "oklch(0.2747 0.0139 57.6523)",
|
|
81
|
+
"sidebarAccent": "oklch(0.4186 0.0281 56.3404)",
|
|
82
|
+
"sidebarAccentForeground": "oklch(0.9239 0.0190 83.0636)",
|
|
83
|
+
"sidebarBorder": "oklch(0.3795 0.0181 57.1280)",
|
|
84
|
+
"sidebarRing": "oklch(0.7264 0.0581 66.6967)"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "violet-bloom",
|
|
4
|
+
"label": "Violet Bloom",
|
|
5
|
+
"description": "Bold violet bloom with tight tracking (Plus Jakarta Sans + Lora).",
|
|
6
|
+
"recommended": true,
|
|
7
|
+
"radius": "1.4rem",
|
|
8
|
+
"letterSpacing": "-0.025em",
|
|
9
|
+
"fonts": {
|
|
10
|
+
"sans": "Plus Jakarta Sans, sans-serif",
|
|
11
|
+
"serif": "Lora, serif",
|
|
12
|
+
"mono": "IBM Plex Mono, monospace",
|
|
13
|
+
"files": [
|
|
14
|
+
"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100..700;1,100..700&family=Lora:ital,wght@0,400..700;1,400..700&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"light": {
|
|
18
|
+
"background": "oklch(0.9940 0 0)",
|
|
19
|
+
"foreground": "oklch(0 0 0)",
|
|
20
|
+
"card": "oklch(0.9940 0 0)",
|
|
21
|
+
"cardForeground": "oklch(0 0 0)",
|
|
22
|
+
"popover": "oklch(0.9911 0 0)",
|
|
23
|
+
"popoverForeground": "oklch(0 0 0)",
|
|
24
|
+
"primary": "oklch(0.5393 0.2713 286.7462)",
|
|
25
|
+
"primaryForeground": "oklch(1.0000 0 0)",
|
|
26
|
+
"secondary": "oklch(0.9540 0.0063 255.4755)",
|
|
27
|
+
"secondaryForeground": "oklch(0.1344 0 0)",
|
|
28
|
+
"muted": "oklch(0.9702 0 0)",
|
|
29
|
+
"mutedForeground": "oklch(0.4386 0 0)",
|
|
30
|
+
"accent": "oklch(0.9393 0.0288 266.3680)",
|
|
31
|
+
"accentForeground": "oklch(0.5445 0.1903 259.4848)",
|
|
32
|
+
"destructive": "oklch(0.6290 0.1902 23.0704)",
|
|
33
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
34
|
+
"border": "oklch(0.9300 0.0094 286.2156)",
|
|
35
|
+
"input": "oklch(0.9401 0 0)",
|
|
36
|
+
"ring": "oklch(0 0 0)",
|
|
37
|
+
"chart1": "oklch(0.7459 0.1483 156.4499)",
|
|
38
|
+
"chart2": "oklch(0.5393 0.2713 286.7462)",
|
|
39
|
+
"chart3": "oklch(0.7336 0.1758 50.5517)",
|
|
40
|
+
"chart4": "oklch(0.5828 0.1809 259.7276)",
|
|
41
|
+
"chart5": "oklch(0.5590 0 0)",
|
|
42
|
+
"radius": "1.4rem",
|
|
43
|
+
"sidebarBackground": "oklch(0.9777 0.0051 247.8763)",
|
|
44
|
+
"sidebarForeground": "oklch(0 0 0)",
|
|
45
|
+
"sidebarPrimary": "oklch(0 0 0)",
|
|
46
|
+
"sidebarPrimaryForeground": "oklch(1.0000 0 0)",
|
|
47
|
+
"sidebarAccent": "oklch(0.9401 0 0)",
|
|
48
|
+
"sidebarAccentForeground": "oklch(0 0 0)",
|
|
49
|
+
"sidebarBorder": "oklch(0.9401 0 0)",
|
|
50
|
+
"sidebarRing": "oklch(0 0 0)"
|
|
51
|
+
},
|
|
52
|
+
"dark": {
|
|
53
|
+
"background": "oklch(0.2223 0.0060 271.1393)",
|
|
54
|
+
"foreground": "oklch(0.9551 0 0)",
|
|
55
|
+
"card": "oklch(0.2568 0.0076 274.6528)",
|
|
56
|
+
"cardForeground": "oklch(0.9551 0 0)",
|
|
57
|
+
"popover": "oklch(0.2568 0.0076 274.6528)",
|
|
58
|
+
"popoverForeground": "oklch(0.9551 0 0)",
|
|
59
|
+
"primary": "oklch(0.6132 0.2294 291.7437)",
|
|
60
|
+
"primaryForeground": "oklch(1.0000 0 0)",
|
|
61
|
+
"secondary": "oklch(0.2940 0.0130 272.9312)",
|
|
62
|
+
"secondaryForeground": "oklch(0.9551 0 0)",
|
|
63
|
+
"muted": "oklch(0.2940 0.0130 272.9312)",
|
|
64
|
+
"mutedForeground": "oklch(0.7058 0 0)",
|
|
65
|
+
"accent": "oklch(0.2795 0.0368 260.0310)",
|
|
66
|
+
"accentForeground": "oklch(0.7857 0.1153 246.6596)",
|
|
67
|
+
"destructive": "oklch(0.7106 0.1661 22.2162)",
|
|
68
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
69
|
+
"border": "oklch(0.3289 0.0092 268.3843)",
|
|
70
|
+
"input": "oklch(0.3289 0.0092 268.3843)",
|
|
71
|
+
"ring": "oklch(0.6132 0.2294 291.7437)",
|
|
72
|
+
"chart1": "oklch(0.8003 0.1821 151.7110)",
|
|
73
|
+
"chart2": "oklch(0.6132 0.2294 291.7437)",
|
|
74
|
+
"chart3": "oklch(0.8077 0.1035 19.5706)",
|
|
75
|
+
"chart4": "oklch(0.6691 0.1569 260.1063)",
|
|
76
|
+
"chart5": "oklch(0.7058 0 0)",
|
|
77
|
+
"radius": "1.4rem",
|
|
78
|
+
"sidebarBackground": "oklch(0.2011 0.0039 286.0396)",
|
|
79
|
+
"sidebarForeground": "oklch(0.9551 0 0)",
|
|
80
|
+
"sidebarPrimary": "oklch(0.6132 0.2294 291.7437)",
|
|
81
|
+
"sidebarPrimaryForeground": "oklch(1.0000 0 0)",
|
|
82
|
+
"sidebarAccent": "oklch(0.2940 0.0130 272.9312)",
|
|
83
|
+
"sidebarAccentForeground": "oklch(0.6132 0.2294 291.7437)",
|
|
84
|
+
"sidebarBorder": "oklch(0.3289 0.0092 268.3843)",
|
|
85
|
+
"sidebarRing": "oklch(0.6132 0.2294 291.7437)"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "zen-inspired",
|
|
4
|
+
"label": "Zen Inspired",
|
|
5
|
+
"description": "Warm parchment neutrals with charcoal primary (Inter + Playfair Display + JetBrains Mono).",
|
|
6
|
+
"recommended": true,
|
|
7
|
+
"radius": "0.5rem",
|
|
8
|
+
"letterSpacing": "0.01em",
|
|
9
|
+
"fonts": {
|
|
10
|
+
"sans": "Inter, sans-serif",
|
|
11
|
+
"serif": "Playfair Display, serif",
|
|
12
|
+
"mono": "JetBrains Mono, monospace",
|
|
13
|
+
"files": [
|
|
14
|
+
"https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=JetBrains+Mono:wght@100..800&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"light": {
|
|
18
|
+
"background": "oklch(0.9195 0.0169 88.0030)",
|
|
19
|
+
"foreground": "oklch(0.2350 0 0)",
|
|
20
|
+
"card": "oklch(0.9530 0.0156 86.4257)",
|
|
21
|
+
"cardForeground": "oklch(0.2350 0 0)",
|
|
22
|
+
"popover": "oklch(0.9530 0.0156 86.4257)",
|
|
23
|
+
"popoverForeground": "oklch(0.2350 0 0)",
|
|
24
|
+
"primary": "oklch(0.3012 0 0)",
|
|
25
|
+
"primaryForeground": "oklch(0.9169 0.0175 99.6160)",
|
|
26
|
+
"secondary": "oklch(0.8647 0.0201 87.5232)",
|
|
27
|
+
"secondaryForeground": "oklch(0.3012 0 0)",
|
|
28
|
+
"muted": "oklch(0.8340 0.0232 87.1630)",
|
|
29
|
+
"mutedForeground": "oklch(0.4688 0.0136 84.5932)",
|
|
30
|
+
"accent": "oklch(0.9169 0.0175 99.6160)",
|
|
31
|
+
"accentForeground": "oklch(0.3012 0 0)",
|
|
32
|
+
"destructive": "oklch(0.5771 0.2152 27.3250)",
|
|
33
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
34
|
+
"border": "oklch(0.8434 0.0231 87.1621)",
|
|
35
|
+
"input": "oklch(0.8434 0.0231 87.1621)",
|
|
36
|
+
"ring": "oklch(0.3012 0 0)",
|
|
37
|
+
"radius": "0.5rem",
|
|
38
|
+
"sidebarBackground": "oklch(0.8985 0.0199 87.5195)",
|
|
39
|
+
"sidebarForeground": "oklch(0.2350 0 0)",
|
|
40
|
+
"sidebarPrimary": "oklch(0.3012 0 0)",
|
|
41
|
+
"sidebarPrimaryForeground": "oklch(0.9169 0.0175 99.6160)",
|
|
42
|
+
"sidebarAccent": "oklch(0.9169 0.0175 99.6160)",
|
|
43
|
+
"sidebarAccentForeground": "oklch(0.3012 0 0)",
|
|
44
|
+
"sidebarBorder": "oklch(0.8434 0.0231 87.1621)",
|
|
45
|
+
"sidebarRing": "oklch(0.3012 0 0)",
|
|
46
|
+
"chart1": "oklch(0.6863 0.1743 34.2614)",
|
|
47
|
+
"chart2": "oklch(0.2350 0 0)",
|
|
48
|
+
"chart3": "oklch(0.4688 0.0136 84.5932)",
|
|
49
|
+
"chart4": "oklch(0.7057 0.0250 82.0932)",
|
|
50
|
+
"chart5": "oklch(0.8340 0.0232 87.1630)"
|
|
51
|
+
},
|
|
52
|
+
"dark": {
|
|
53
|
+
"background": "oklch(0.1913 0 0)",
|
|
54
|
+
"foreground": "oklch(0.9173 0.0133 82.4015)",
|
|
55
|
+
"card": "oklch(0.2264 0 0)",
|
|
56
|
+
"cardForeground": "oklch(0.9173 0.0133 82.4015)",
|
|
57
|
+
"popover": "oklch(0.2264 0 0)",
|
|
58
|
+
"popoverForeground": "oklch(0.9173 0.0133 82.4015)",
|
|
59
|
+
"primary": "oklch(0.8520 0.0205 100.6306)",
|
|
60
|
+
"primaryForeground": "oklch(0.3329 0 0)",
|
|
61
|
+
"secondary": "oklch(0.2520 0 0)",
|
|
62
|
+
"secondaryForeground": "oklch(0.8520 0.0205 100.6306)",
|
|
63
|
+
"muted": "oklch(0.2850 0 0)",
|
|
64
|
+
"mutedForeground": "oklch(0.6348 0.0113 81.7875)",
|
|
65
|
+
"accent": "oklch(0.3329 0 0)",
|
|
66
|
+
"accentForeground": "oklch(0.8520 0.0205 100.6306)",
|
|
67
|
+
"destructive": "oklch(0.6368 0.2078 25.3313)",
|
|
68
|
+
"destructiveForeground": "oklch(1.0000 0 0)",
|
|
69
|
+
"border": "oklch(0.2931 0 0)",
|
|
70
|
+
"input": "oklch(0.2931 0 0)",
|
|
71
|
+
"ring": "oklch(0.8520 0.0205 100.6306)",
|
|
72
|
+
"radius": "0.5rem",
|
|
73
|
+
"sidebarBackground": "oklch(0.1730 0 0)",
|
|
74
|
+
"sidebarForeground": "oklch(0.9173 0.0133 82.4015)",
|
|
75
|
+
"sidebarPrimary": "oklch(0.8520 0.0205 100.6306)",
|
|
76
|
+
"sidebarPrimaryForeground": "oklch(0.3329 0 0)",
|
|
77
|
+
"sidebarAccent": "oklch(0.3329 0 0)",
|
|
78
|
+
"sidebarAccentForeground": "oklch(0.8520 0.0205 100.6306)",
|
|
79
|
+
"sidebarBorder": "oklch(0.2931 0 0)",
|
|
80
|
+
"sidebarRing": "oklch(0.8520 0.0205 100.6306)",
|
|
81
|
+
"chart1": "oklch(0.6863 0.1743 34.2614)",
|
|
82
|
+
"chart2": "oklch(0.8590 0.0209 74.6369)",
|
|
83
|
+
"chart3": "oklch(0.6348 0.0113 81.7875)",
|
|
84
|
+
"chart4": "oklch(0.4681 0.0069 84.5829)",
|
|
85
|
+
"chart5": "oklch(0.3523 0 0)"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node- and browser-safe theme API (no React, no CSS side effects).
|
|
3
|
+
* Import from `@shellui/core/theme` in the CLI or tooling.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
ThemeColors,
|
|
8
|
+
ThemeColorsMode,
|
|
9
|
+
ThemeColorsModePartial,
|
|
10
|
+
ThemeDefinition,
|
|
11
|
+
ThemeFonts,
|
|
12
|
+
ThemeInput,
|
|
13
|
+
ThemeRef,
|
|
14
|
+
ThemesConfig,
|
|
15
|
+
ThemeColorKey,
|
|
16
|
+
} from './types';
|
|
17
|
+
export { THEME_SCHEMA_VERSION, THEME_COLOR_KEYS } from './types';
|
|
18
|
+
|
|
19
|
+
export { hexToHsl, toCssVarValue, isHexColor } from './color';
|
|
20
|
+
export { normalizeTheme, toThemeJson } from './normalize';
|
|
21
|
+
export { resolveThemeConfig } from './resolveConfig';
|
|
22
|
+
export type { ResolveThemeConfigInput, ResolvedThemeConfig } from './resolveConfig';
|
|
23
|
+
export {
|
|
24
|
+
defaultTheme,
|
|
25
|
+
themes,
|
|
26
|
+
themeNames,
|
|
27
|
+
recommendedThemeNames,
|
|
28
|
+
curatedThemes,
|
|
29
|
+
shelluiTheme,
|
|
30
|
+
claudeTheme,
|
|
31
|
+
lightGreenTheme,
|
|
32
|
+
zenInspiredTheme,
|
|
33
|
+
astroVistaTheme,
|
|
34
|
+
shadcnTheme,
|
|
35
|
+
amberMinimalTheme,
|
|
36
|
+
amethystHazeTheme,
|
|
37
|
+
boldTechTheme,
|
|
38
|
+
bubblegumTheme,
|
|
39
|
+
caffeineTheme,
|
|
40
|
+
candylandTheme,
|
|
41
|
+
catppuccinTheme,
|
|
42
|
+
claymorphismTheme,
|
|
43
|
+
cleanSlateTheme,
|
|
44
|
+
cosmicNightTheme,
|
|
45
|
+
cyberpunkTheme,
|
|
46
|
+
darkmatterTheme,
|
|
47
|
+
doom64Theme,
|
|
48
|
+
elegantLuxuryTheme,
|
|
49
|
+
graphiteTheme,
|
|
50
|
+
kodamaGroveTheme,
|
|
51
|
+
midnightBloomTheme,
|
|
52
|
+
mochaMousseTheme,
|
|
53
|
+
modernMinimalTheme,
|
|
54
|
+
monoTheme,
|
|
55
|
+
natureTheme,
|
|
56
|
+
neoBrutalismTheme,
|
|
57
|
+
northernLightsTheme,
|
|
58
|
+
notebookTheme,
|
|
59
|
+
oceanBreezeTheme,
|
|
60
|
+
pastelDreamsTheme,
|
|
61
|
+
perpetuityTheme,
|
|
62
|
+
quantumRoseTheme,
|
|
63
|
+
retroArcadeTheme,
|
|
64
|
+
sageGardenTheme,
|
|
65
|
+
softPopTheme,
|
|
66
|
+
solarDuskTheme,
|
|
67
|
+
starryNightTheme,
|
|
68
|
+
sunsetHorizonTheme,
|
|
69
|
+
supabaseTheme,
|
|
70
|
+
t3ChatTheme,
|
|
71
|
+
tangerineTheme,
|
|
72
|
+
twitterTheme,
|
|
73
|
+
vercelTheme,
|
|
74
|
+
vintagePaperTheme,
|
|
75
|
+
violetBloomTheme,
|
|
76
|
+
} from './curated';
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { defaultTheme } from './curated';
|
|
2
|
+
import { normalizeTokenKeys } from './tokenKeys';
|
|
3
|
+
import {
|
|
4
|
+
THEME_COLOR_KEYS,
|
|
5
|
+
THEME_SCHEMA_VERSION,
|
|
6
|
+
type ThemeColorsMode,
|
|
7
|
+
type ThemeColorsModePartial,
|
|
8
|
+
type ThemeDefinition,
|
|
9
|
+
type ThemeInput,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
function isCompleteMode(mode: ThemeColorsModePartial | undefined): mode is ThemeColorsMode {
|
|
13
|
+
if (!mode) return false;
|
|
14
|
+
return THEME_COLOR_KEYS.every((key) => {
|
|
15
|
+
const value = mode[key];
|
|
16
|
+
return typeof value === 'string' && value.length > 0;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function mergeMode(
|
|
21
|
+
base: ThemeColorsMode,
|
|
22
|
+
override: ThemeColorsModePartial | undefined,
|
|
23
|
+
radiusFallback?: string,
|
|
24
|
+
): ThemeColorsMode {
|
|
25
|
+
const merged: ThemeColorsMode = {
|
|
26
|
+
...base,
|
|
27
|
+
...(override ?? {}),
|
|
28
|
+
};
|
|
29
|
+
if (radiusFallback && (!override?.radius || override.radius === '')) {
|
|
30
|
+
merged.radius = radiusFallback;
|
|
31
|
+
}
|
|
32
|
+
return merged;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function resolveLabel(input: ThemeInput, fallbackName: string): string {
|
|
36
|
+
return input.label || input.displayName || fallbackName;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function resolveName(input: ThemeInput, fallbackName?: string): string {
|
|
40
|
+
if (input.name && input.name.trim()) return input.name.trim();
|
|
41
|
+
if (fallbackName && fallbackName.trim()) return fallbackName.trim();
|
|
42
|
+
throw new Error('Theme object requires a `name` (or map key / filename).');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function asPartial(raw: unknown): ThemeColorsModePartial | undefined {
|
|
46
|
+
if (!raw || typeof raw !== 'object') return undefined;
|
|
47
|
+
return normalizeTokenKeys(raw as Record<string, unknown>) as ThemeColorsModePartial;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Normalize a flexible theme input into a complete ThemeDefinition.
|
|
52
|
+
* Partial light/dark tokens merge onto `base` (defaults to the official default theme).
|
|
53
|
+
* Accepts camelCase or CSS-variable kebab-case token keys.
|
|
54
|
+
*/
|
|
55
|
+
export function normalizeTheme(
|
|
56
|
+
input: ThemeInput | ThemeDefinition,
|
|
57
|
+
options: { name?: string; base?: ThemeDefinition } = {},
|
|
58
|
+
): ThemeDefinition {
|
|
59
|
+
const base = options.base ?? defaultTheme;
|
|
60
|
+
|
|
61
|
+
// Already a complete ThemeDefinition
|
|
62
|
+
if (
|
|
63
|
+
'colors' in input &&
|
|
64
|
+
input.colors &&
|
|
65
|
+
isCompleteMode(input.colors.light) &&
|
|
66
|
+
isCompleteMode(input.colors.dark) &&
|
|
67
|
+
typeof (input as ThemeDefinition).name === 'string' &&
|
|
68
|
+
typeof (input as ThemeDefinition).displayName === 'string'
|
|
69
|
+
) {
|
|
70
|
+
const def = input as ThemeDefinition;
|
|
71
|
+
return {
|
|
72
|
+
...def,
|
|
73
|
+
name: options.name ?? def.name,
|
|
74
|
+
displayName: def.displayName || resolveLabel(input as ThemeInput, def.name),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const themeInput = input as ThemeInput;
|
|
79
|
+
|
|
80
|
+
if (typeof themeInput.version === 'number' && themeInput.version !== THEME_SCHEMA_VERSION) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Unsupported theme version ${themeInput.version}. Expected ${THEME_SCHEMA_VERSION}.`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const name = resolveName(themeInput, options.name);
|
|
87
|
+
const displayName = resolveLabel(themeInput, name);
|
|
88
|
+
|
|
89
|
+
const lightPartial = asPartial(themeInput.light ?? themeInput.colors?.light);
|
|
90
|
+
const darkPartial = asPartial(themeInput.dark ?? themeInput.colors?.dark);
|
|
91
|
+
|
|
92
|
+
let light: ThemeColorsMode;
|
|
93
|
+
let dark: ThemeColorsMode;
|
|
94
|
+
if (isCompleteMode(lightPartial) && isCompleteMode(darkPartial)) {
|
|
95
|
+
light = { ...lightPartial };
|
|
96
|
+
dark = { ...darkPartial };
|
|
97
|
+
if (themeInput.radius) {
|
|
98
|
+
light.radius = light.radius || themeInput.radius;
|
|
99
|
+
dark.radius = dark.radius || themeInput.radius;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
light = mergeMode(base.colors.light, lightPartial, themeInput.radius);
|
|
103
|
+
dark = mergeMode(base.colors.dark, darkPartial, themeInput.radius);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const fonts = themeInput.fonts;
|
|
107
|
+
const bodyFontFamily =
|
|
108
|
+
themeInput.bodyFontFamily || fonts?.body || fonts?.sans || themeInput.fontFamily;
|
|
109
|
+
const headingFontFamily =
|
|
110
|
+
themeInput.headingFontFamily || fonts?.heading || fonts?.sans || themeInput.fontFamily;
|
|
111
|
+
const fontFamily = themeInput.fontFamily || fonts?.sans || bodyFontFamily;
|
|
112
|
+
const fontFiles = themeInput.fontFiles ?? fonts?.files;
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
name,
|
|
116
|
+
displayName,
|
|
117
|
+
...(themeInput.description ? { description: themeInput.description } : {}),
|
|
118
|
+
...(themeInput.recommended ? { recommended: true } : {}),
|
|
119
|
+
colors: { light, dark },
|
|
120
|
+
...(fontFamily ? { fontFamily } : {}),
|
|
121
|
+
...(bodyFontFamily ? { bodyFontFamily } : {}),
|
|
122
|
+
...(headingFontFamily ? { headingFontFamily } : {}),
|
|
123
|
+
...(fontFiles?.length ? { fontFiles: [...fontFiles] } : {}),
|
|
124
|
+
...(themeInput.letterSpacing ? { letterSpacing: themeInput.letterSpacing } : {}),
|
|
125
|
+
...(themeInput.textShadow ? { textShadow: themeInput.textShadow } : {}),
|
|
126
|
+
...(themeInput.lineHeight ? { lineHeight: themeInput.lineHeight } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Convert a ThemeDefinition to the versioned theme JSON shape (for files / docs).
|
|
132
|
+
*/
|
|
133
|
+
export function toThemeJson(theme: ThemeDefinition): ThemeInput {
|
|
134
|
+
return {
|
|
135
|
+
version: THEME_SCHEMA_VERSION,
|
|
136
|
+
name: theme.name,
|
|
137
|
+
label: theme.displayName,
|
|
138
|
+
...(theme.description ? { description: theme.description } : {}),
|
|
139
|
+
...(theme.recommended ? { recommended: true } : {}),
|
|
140
|
+
...(theme.fontFamily || theme.bodyFontFamily || theme.headingFontFamily || theme.fontFiles
|
|
141
|
+
? {
|
|
142
|
+
fonts: {
|
|
143
|
+
...(theme.fontFamily || theme.bodyFontFamily
|
|
144
|
+
? { sans: theme.bodyFontFamily || theme.fontFamily }
|
|
145
|
+
: {}),
|
|
146
|
+
...(theme.headingFontFamily ? { heading: theme.headingFontFamily } : {}),
|
|
147
|
+
...(theme.bodyFontFamily ? { body: theme.bodyFontFamily } : {}),
|
|
148
|
+
...(theme.fontFiles?.length ? { files: theme.fontFiles } : {}),
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
: {}),
|
|
152
|
+
...(theme.letterSpacing ? { letterSpacing: theme.letterSpacing } : {}),
|
|
153
|
+
...(theme.textShadow ? { textShadow: theme.textShadow } : {}),
|
|
154
|
+
...(theme.lineHeight ? { lineHeight: theme.lineHeight } : {}),
|
|
155
|
+
radius: theme.colors.light.radius,
|
|
156
|
+
light: { ...theme.colors.light },
|
|
157
|
+
dark: { ...theme.colors.dark },
|
|
158
|
+
};
|
|
159
|
+
}
|