@marcoschwartz/lite-ui 0.24.9 → 0.24.11

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/dist/index.d.mts CHANGED
@@ -1300,12 +1300,55 @@ interface ThemeProviderProps {
1300
1300
  }
1301
1301
  declare function ThemeProvider({ children, defaultTheme, defaultColorMode }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
1302
1302
 
1303
+ /**
1304
+ * ColorSchemeScript - Prevents flash of wrong color scheme
1305
+ *
1306
+ * This component renders a blocking script that sets the color scheme
1307
+ * BEFORE React hydration occurs. Must be placed in the document <head>.
1308
+ *
1309
+ * Usage in Next.js App Router (app/layout.tsx):
1310
+ * ```tsx
1311
+ * import { ColorSchemeScript } from '@marcoschwartz/lite-ui';
1312
+ *
1313
+ * export default function RootLayout({ children }) {
1314
+ * return (
1315
+ * <html lang="en" suppressHydrationWarning>
1316
+ * <head>
1317
+ * <ColorSchemeScript defaultColorMode="system" />
1318
+ * </head>
1319
+ * <body>
1320
+ * <ThemeProvider>{children}</ThemeProvider>
1321
+ * </body>
1322
+ * </html>
1323
+ * );
1324
+ * }
1325
+ * ```
1326
+ */
1327
+ interface ColorSchemeScriptProps {
1328
+ /**
1329
+ * Default color mode if no preference is stored
1330
+ * @default 'system'
1331
+ */
1332
+ defaultColorMode?: 'light' | 'dark' | 'system';
1333
+ /**
1334
+ * localStorage key for color mode
1335
+ * @default 'lite-ui-color-mode'
1336
+ */
1337
+ localStorageKey?: string;
1338
+ /**
1339
+ * Nonce for Content Security Policy
1340
+ */
1341
+ nonce?: string;
1342
+ }
1343
+ declare function ColorSchemeScript({ defaultColorMode, localStorageKey, nonce, }?: ColorSchemeScriptProps): react_jsx_runtime.JSX.Element;
1344
+ declare function getColorSchemeScriptString(defaultColorMode?: 'light' | 'dark' | 'system', localStorageKey?: string): string;
1345
+
1303
1346
  /**
1304
1347
  * Theme initialization script that runs before React hydration
1305
1348
  * This prevents flickering by setting the theme before the page renders
1306
1349
  * Must be inlined in the HTML <head> as a blocking script
1307
1350
  */
1308
- declare const themeScript = "\n(function() {\n try {\n // Get stored preferences\n var storedTheme = localStorage.getItem('lite-ui-theme') || 'default';\n var storedColorMode = localStorage.getItem('lite-ui-color-mode');\n\n // Determine color mode (system, light, or dark)\n var colorMode = storedColorMode;\n if (!colorMode || colorMode === 'system') {\n colorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Set attributes before render\n var html = document.documentElement;\n html.setAttribute('data-theme', storedTheme);\n html.setAttribute('data-color-mode', colorMode);\n\n // Set color-scheme for browser UI elements (scrollbars, form controls)\n html.style.colorScheme = colorMode;\n\n // Add dark class for Tailwind\n if (colorMode === 'dark') {\n html.classList.add('dark');\n // Set critical inline styles as fallback before CSS loads\n html.style.backgroundColor = 'hsl(0 0% 3.9%)';\n html.style.color = 'hsl(0 0% 98%)';\n } else {\n html.classList.remove('dark');\n html.style.backgroundColor = 'hsl(0 0% 100%)';\n html.style.color = 'hsl(0 0% 3.9%)';\n }\n } catch (e) {\n // Silent fail - will use CSS defaults\n }\n})();\n";
1351
+ declare const themeScript = "\n(function() {\n try {\n // Get stored preferences\n var storedTheme = localStorage.getItem('lite-ui-theme') || 'default';\n var storedColorMode = localStorage.getItem('lite-ui-color-mode');\n\n // Determine color mode (system, light, or dark)\n var colorMode = storedColorMode;\n if (!colorMode || colorMode === 'system') {\n colorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Set attributes before render\n var html = document.documentElement;\n html.setAttribute('data-theme', storedTheme);\n html.setAttribute('data-color-mode', colorMode);\n\n // Set color-scheme for browser UI elements (scrollbars, form controls)\n html.style.colorScheme = colorMode;\n\n // Add dark class for Tailwind\n if (colorMode === 'dark') {\n html.classList.add('dark');\n // Set critical inline styles as fallback before CSS loads\n html.style.backgroundColor = 'hsl(0 0% 3.9%)';\n html.style.color = 'hsl(0 0% 98%)';\n } else {\n html.classList.remove('dark');\n html.style.backgroundColor = 'hsl(0 0% 100%)';\n html.style.color = 'hsl(0 0% 3.9%)';\n }\n\n // Mark as initialized to prevent FOUC\n html.setAttribute('data-theme-initialized', 'true');\n } catch (e) {\n // Ensure page shows even on error\n document.documentElement.setAttribute('data-theme-initialized', 'true');\n }\n})();\n";
1309
1352
  declare function getThemeScript(): string;
1310
1353
 
1311
1354
  interface IconProps {
@@ -1455,4 +1498,4 @@ declare const YouTubeIcon: IconComponent;
1455
1498
 
1456
1499
  declare const SlackIcon: IconComponent;
1457
1500
 
1458
- export { ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, AlertCircleIcon, type AlertProps, AppShell, type AppShellAsideConfig, type AppShellFooterConfig, type AppShellHeaderConfig, type AppShellNavbarConfig, type AppShellProps, AppShellSection, type AppShellSectionProps, AppleIcon, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BeakerIcon, BellIcon, BookIcon, BrainIcon, Button, type ButtonProps, type ButtonTheme, CHART_DEFAULTS, Calendar, CalendarHeatmap, type CalendarHeatmapProps, CalendarIcon, type CalendarProps, CameraIcon, Card, type CardProps, CartesianGrid, type CartesianGridProps, type Chapter, ChartTooltip, ChatIcon, CheckCircleIcon, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, CloudIcon, Code, CodeIcon, type CodeProps, type ColorMode, type Column, CopyIcon, DatabaseIcon, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Divider, type DividerProps, DownloadIcon, Drawer, type DrawerProps, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FileIcon, FileUpload, type FileUploadProps, FolderIcon, FullscreenExitIcon, FullscreenIcon, GitHubIcon, GlobeIcon, GoogleIcon, HeartIcon, Heatmap, type HeatmapDataPoint, type HeatmapProps, HomeIcon, type IconComponent, type IconProps, ImageIcon, InfoCircleIcon, KeyIcon, Legend, type LegendItem, type LegendProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, LinkedInIcon, LockIcon, MailIcon, MenuIcon, Modal, type ModalProps, Navbar, type NavbarProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PauseIcon, PieChart, type PieChartDataPoint, type PieChartProps, PlayIcon, PlugIcon, PlusIcon, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ReferenceArea, type ReferenceAreaProps, ReferenceLine, type ReferenceLineProps, RefreshIcon, ResponsiveContainer, type ResponsiveContainerProps, RichTextEditor, type RichTextEditorProps, SaveIcon, ScatterChart, type ScatterChartDataPoint, type ScatterChartProps, type ScatterChartSeries, SearchIcon, Select, type SelectOption, type SelectProps, type SelectTheme, SettingsIcon, ShieldIcon, Sidebar, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SkipBackIcon, SkipForwardIcon, SlackIcon, Slider, type SliderProps, SparklesIcon, Spinner, type SpinnerProps, StarIcon, type Step, Stepper, type StepperProps, StopIcon, type Tab, Table, type TableProps, Tabs, type TabsProps, TerminalIcon, TextInput, type TextInputProps, Textarea, type TextareaProps, type Theme, type ThemeName, ThemeProvider, TimePicker, type TimePickerProps, type Toast, ToastProvider, type ToastProviderProps, Toggle, type ToggleProps, type TooltipPayloadItem, type TooltipProps, TrashIcon, TwitterIcon, UploadIcon, UserIcon, VideoPlayer, type VideoPlayerProps, VolumeOffIcon, VolumeUpIcon, YouTubeIcon, getThemeScript, themeScript, themes, toast, useAppShell, useSidebar, useTheme, useToast, useTooltip };
1501
+ export { ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, AlertCircleIcon, type AlertProps, AppShell, type AppShellAsideConfig, type AppShellFooterConfig, type AppShellHeaderConfig, type AppShellNavbarConfig, type AppShellProps, AppShellSection, type AppShellSectionProps, AppleIcon, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BeakerIcon, BellIcon, BookIcon, BrainIcon, Button, type ButtonProps, type ButtonTheme, CHART_DEFAULTS, Calendar, CalendarHeatmap, type CalendarHeatmapProps, CalendarIcon, type CalendarProps, CameraIcon, Card, type CardProps, CartesianGrid, type CartesianGridProps, type Chapter, ChartTooltip, ChatIcon, CheckCircleIcon, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, CloudIcon, Code, CodeIcon, type CodeProps, type ColorMode, ColorSchemeScript, type ColorSchemeScriptProps, type Column, CopyIcon, DatabaseIcon, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Divider, type DividerProps, DownloadIcon, Drawer, type DrawerProps, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FileIcon, FileUpload, type FileUploadProps, FolderIcon, FullscreenExitIcon, FullscreenIcon, GitHubIcon, GlobeIcon, GoogleIcon, HeartIcon, Heatmap, type HeatmapDataPoint, type HeatmapProps, HomeIcon, type IconComponent, type IconProps, ImageIcon, InfoCircleIcon, KeyIcon, Legend, type LegendItem, type LegendProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, LinkedInIcon, LockIcon, MailIcon, MenuIcon, Modal, type ModalProps, Navbar, type NavbarProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PauseIcon, PieChart, type PieChartDataPoint, type PieChartProps, PlayIcon, PlugIcon, PlusIcon, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ReferenceArea, type ReferenceAreaProps, ReferenceLine, type ReferenceLineProps, RefreshIcon, ResponsiveContainer, type ResponsiveContainerProps, RichTextEditor, type RichTextEditorProps, SaveIcon, ScatterChart, type ScatterChartDataPoint, type ScatterChartProps, type ScatterChartSeries, SearchIcon, Select, type SelectOption, type SelectProps, type SelectTheme, SettingsIcon, ShieldIcon, Sidebar, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SkipBackIcon, SkipForwardIcon, SlackIcon, Slider, type SliderProps, SparklesIcon, Spinner, type SpinnerProps, StarIcon, type Step, Stepper, type StepperProps, StopIcon, type Tab, Table, type TableProps, Tabs, type TabsProps, TerminalIcon, TextInput, type TextInputProps, Textarea, type TextareaProps, type Theme, type ThemeName, ThemeProvider, TimePicker, type TimePickerProps, type Toast, ToastProvider, type ToastProviderProps, Toggle, type ToggleProps, type TooltipPayloadItem, type TooltipProps, TrashIcon, TwitterIcon, UploadIcon, UserIcon, VideoPlayer, type VideoPlayerProps, VolumeOffIcon, VolumeUpIcon, YouTubeIcon, getColorSchemeScriptString, getThemeScript, themeScript, themes, toast, useAppShell, useSidebar, useTheme, useToast, useTooltip };
package/dist/index.d.ts CHANGED
@@ -1300,12 +1300,55 @@ interface ThemeProviderProps {
1300
1300
  }
1301
1301
  declare function ThemeProvider({ children, defaultTheme, defaultColorMode }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
1302
1302
 
1303
+ /**
1304
+ * ColorSchemeScript - Prevents flash of wrong color scheme
1305
+ *
1306
+ * This component renders a blocking script that sets the color scheme
1307
+ * BEFORE React hydration occurs. Must be placed in the document <head>.
1308
+ *
1309
+ * Usage in Next.js App Router (app/layout.tsx):
1310
+ * ```tsx
1311
+ * import { ColorSchemeScript } from '@marcoschwartz/lite-ui';
1312
+ *
1313
+ * export default function RootLayout({ children }) {
1314
+ * return (
1315
+ * <html lang="en" suppressHydrationWarning>
1316
+ * <head>
1317
+ * <ColorSchemeScript defaultColorMode="system" />
1318
+ * </head>
1319
+ * <body>
1320
+ * <ThemeProvider>{children}</ThemeProvider>
1321
+ * </body>
1322
+ * </html>
1323
+ * );
1324
+ * }
1325
+ * ```
1326
+ */
1327
+ interface ColorSchemeScriptProps {
1328
+ /**
1329
+ * Default color mode if no preference is stored
1330
+ * @default 'system'
1331
+ */
1332
+ defaultColorMode?: 'light' | 'dark' | 'system';
1333
+ /**
1334
+ * localStorage key for color mode
1335
+ * @default 'lite-ui-color-mode'
1336
+ */
1337
+ localStorageKey?: string;
1338
+ /**
1339
+ * Nonce for Content Security Policy
1340
+ */
1341
+ nonce?: string;
1342
+ }
1343
+ declare function ColorSchemeScript({ defaultColorMode, localStorageKey, nonce, }?: ColorSchemeScriptProps): react_jsx_runtime.JSX.Element;
1344
+ declare function getColorSchemeScriptString(defaultColorMode?: 'light' | 'dark' | 'system', localStorageKey?: string): string;
1345
+
1303
1346
  /**
1304
1347
  * Theme initialization script that runs before React hydration
1305
1348
  * This prevents flickering by setting the theme before the page renders
1306
1349
  * Must be inlined in the HTML <head> as a blocking script
1307
1350
  */
1308
- declare const themeScript = "\n(function() {\n try {\n // Get stored preferences\n var storedTheme = localStorage.getItem('lite-ui-theme') || 'default';\n var storedColorMode = localStorage.getItem('lite-ui-color-mode');\n\n // Determine color mode (system, light, or dark)\n var colorMode = storedColorMode;\n if (!colorMode || colorMode === 'system') {\n colorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Set attributes before render\n var html = document.documentElement;\n html.setAttribute('data-theme', storedTheme);\n html.setAttribute('data-color-mode', colorMode);\n\n // Set color-scheme for browser UI elements (scrollbars, form controls)\n html.style.colorScheme = colorMode;\n\n // Add dark class for Tailwind\n if (colorMode === 'dark') {\n html.classList.add('dark');\n // Set critical inline styles as fallback before CSS loads\n html.style.backgroundColor = 'hsl(0 0% 3.9%)';\n html.style.color = 'hsl(0 0% 98%)';\n } else {\n html.classList.remove('dark');\n html.style.backgroundColor = 'hsl(0 0% 100%)';\n html.style.color = 'hsl(0 0% 3.9%)';\n }\n } catch (e) {\n // Silent fail - will use CSS defaults\n }\n})();\n";
1351
+ declare const themeScript = "\n(function() {\n try {\n // Get stored preferences\n var storedTheme = localStorage.getItem('lite-ui-theme') || 'default';\n var storedColorMode = localStorage.getItem('lite-ui-color-mode');\n\n // Determine color mode (system, light, or dark)\n var colorMode = storedColorMode;\n if (!colorMode || colorMode === 'system') {\n colorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Set attributes before render\n var html = document.documentElement;\n html.setAttribute('data-theme', storedTheme);\n html.setAttribute('data-color-mode', colorMode);\n\n // Set color-scheme for browser UI elements (scrollbars, form controls)\n html.style.colorScheme = colorMode;\n\n // Add dark class for Tailwind\n if (colorMode === 'dark') {\n html.classList.add('dark');\n // Set critical inline styles as fallback before CSS loads\n html.style.backgroundColor = 'hsl(0 0% 3.9%)';\n html.style.color = 'hsl(0 0% 98%)';\n } else {\n html.classList.remove('dark');\n html.style.backgroundColor = 'hsl(0 0% 100%)';\n html.style.color = 'hsl(0 0% 3.9%)';\n }\n\n // Mark as initialized to prevent FOUC\n html.setAttribute('data-theme-initialized', 'true');\n } catch (e) {\n // Ensure page shows even on error\n document.documentElement.setAttribute('data-theme-initialized', 'true');\n }\n})();\n";
1309
1352
  declare function getThemeScript(): string;
1310
1353
 
1311
1354
  interface IconProps {
@@ -1455,4 +1498,4 @@ declare const YouTubeIcon: IconComponent;
1455
1498
 
1456
1499
  declare const SlackIcon: IconComponent;
1457
1500
 
1458
- export { ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, AlertCircleIcon, type AlertProps, AppShell, type AppShellAsideConfig, type AppShellFooterConfig, type AppShellHeaderConfig, type AppShellNavbarConfig, type AppShellProps, AppShellSection, type AppShellSectionProps, AppleIcon, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BeakerIcon, BellIcon, BookIcon, BrainIcon, Button, type ButtonProps, type ButtonTheme, CHART_DEFAULTS, Calendar, CalendarHeatmap, type CalendarHeatmapProps, CalendarIcon, type CalendarProps, CameraIcon, Card, type CardProps, CartesianGrid, type CartesianGridProps, type Chapter, ChartTooltip, ChatIcon, CheckCircleIcon, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, CloudIcon, Code, CodeIcon, type CodeProps, type ColorMode, type Column, CopyIcon, DatabaseIcon, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Divider, type DividerProps, DownloadIcon, Drawer, type DrawerProps, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FileIcon, FileUpload, type FileUploadProps, FolderIcon, FullscreenExitIcon, FullscreenIcon, GitHubIcon, GlobeIcon, GoogleIcon, HeartIcon, Heatmap, type HeatmapDataPoint, type HeatmapProps, HomeIcon, type IconComponent, type IconProps, ImageIcon, InfoCircleIcon, KeyIcon, Legend, type LegendItem, type LegendProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, LinkedInIcon, LockIcon, MailIcon, MenuIcon, Modal, type ModalProps, Navbar, type NavbarProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PauseIcon, PieChart, type PieChartDataPoint, type PieChartProps, PlayIcon, PlugIcon, PlusIcon, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ReferenceArea, type ReferenceAreaProps, ReferenceLine, type ReferenceLineProps, RefreshIcon, ResponsiveContainer, type ResponsiveContainerProps, RichTextEditor, type RichTextEditorProps, SaveIcon, ScatterChart, type ScatterChartDataPoint, type ScatterChartProps, type ScatterChartSeries, SearchIcon, Select, type SelectOption, type SelectProps, type SelectTheme, SettingsIcon, ShieldIcon, Sidebar, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SkipBackIcon, SkipForwardIcon, SlackIcon, Slider, type SliderProps, SparklesIcon, Spinner, type SpinnerProps, StarIcon, type Step, Stepper, type StepperProps, StopIcon, type Tab, Table, type TableProps, Tabs, type TabsProps, TerminalIcon, TextInput, type TextInputProps, Textarea, type TextareaProps, type Theme, type ThemeName, ThemeProvider, TimePicker, type TimePickerProps, type Toast, ToastProvider, type ToastProviderProps, Toggle, type ToggleProps, type TooltipPayloadItem, type TooltipProps, TrashIcon, TwitterIcon, UploadIcon, UserIcon, VideoPlayer, type VideoPlayerProps, VolumeOffIcon, VolumeUpIcon, YouTubeIcon, getThemeScript, themeScript, themes, toast, useAppShell, useSidebar, useTheme, useToast, useTooltip };
1501
+ export { ActionMenu, type ActionMenuItem, type ActionMenuProps, Alert, AlertCircleIcon, type AlertProps, AppShell, type AppShellAsideConfig, type AppShellFooterConfig, type AppShellHeaderConfig, type AppShellNavbarConfig, type AppShellProps, AppShellSection, type AppShellSectionProps, AppleIcon, AreaChart, type AreaChartDataPoint, type AreaChartProps, type AreaChartSeries, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDataPoint, type BarChartProps, type BarChartSeries, BeakerIcon, BellIcon, BookIcon, BrainIcon, Button, type ButtonProps, type ButtonTheme, CHART_DEFAULTS, Calendar, CalendarHeatmap, type CalendarHeatmapProps, CalendarIcon, type CalendarProps, CameraIcon, Card, type CardProps, CartesianGrid, type CartesianGridProps, type Chapter, ChartTooltip, ChatIcon, CheckCircleIcon, CheckIcon, Checkbox, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, CloudIcon, Code, CodeIcon, type CodeProps, type ColorMode, ColorSchemeScript, type ColorSchemeScriptProps, type Column, CopyIcon, DatabaseIcon, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Divider, type DividerProps, DownloadIcon, Drawer, type DrawerProps, EditIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FileIcon, FileUpload, type FileUploadProps, FolderIcon, FullscreenExitIcon, FullscreenIcon, GitHubIcon, GlobeIcon, GoogleIcon, HeartIcon, Heatmap, type HeatmapDataPoint, type HeatmapProps, HomeIcon, type IconComponent, type IconProps, ImageIcon, InfoCircleIcon, KeyIcon, Legend, type LegendItem, type LegendProps, LineChart, type LineChartDataPoint, type LineChartProps, type LineChartSeries, LinkedInIcon, LockIcon, MailIcon, MenuIcon, Modal, type ModalProps, Navbar, type NavbarProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PauseIcon, PieChart, type PieChartDataPoint, type PieChartProps, PlayIcon, PlugIcon, PlusIcon, ProgressBar, type ProgressBarProps, Radio, type RadioOption, type RadioProps, ReferenceArea, type ReferenceAreaProps, ReferenceLine, type ReferenceLineProps, RefreshIcon, ResponsiveContainer, type ResponsiveContainerProps, RichTextEditor, type RichTextEditorProps, SaveIcon, ScatterChart, type ScatterChartDataPoint, type ScatterChartProps, type ScatterChartSeries, SearchIcon, Select, type SelectOption, type SelectProps, type SelectTheme, SettingsIcon, ShieldIcon, Sidebar, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SkipBackIcon, SkipForwardIcon, SlackIcon, Slider, type SliderProps, SparklesIcon, Spinner, type SpinnerProps, StarIcon, type Step, Stepper, type StepperProps, StopIcon, type Tab, Table, type TableProps, Tabs, type TabsProps, TerminalIcon, TextInput, type TextInputProps, Textarea, type TextareaProps, type Theme, type ThemeName, ThemeProvider, TimePicker, type TimePickerProps, type Toast, ToastProvider, type ToastProviderProps, Toggle, type ToggleProps, type TooltipPayloadItem, type TooltipProps, TrashIcon, TwitterIcon, UploadIcon, UserIcon, VideoPlayer, type VideoPlayerProps, VolumeOffIcon, VolumeUpIcon, YouTubeIcon, getColorSchemeScriptString, getThemeScript, themeScript, themes, toast, useAppShell, useSidebar, useTheme, useToast, useTooltip };
package/dist/index.js CHANGED
@@ -71,6 +71,7 @@ __export(index_exports, {
71
71
  CloudIcon: () => CloudIcon,
72
72
  Code: () => Code,
73
73
  CodeIcon: () => CodeIcon,
74
+ ColorSchemeScript: () => ColorSchemeScript,
74
75
  CopyIcon: () => CopyIcon,
75
76
  DatabaseIcon: () => DatabaseIcon,
76
77
  DatePicker: () => DatePicker,
@@ -153,6 +154,7 @@ __export(index_exports, {
153
154
  VolumeOffIcon: () => VolumeOffIcon,
154
155
  VolumeUpIcon: () => VolumeUpIcon,
155
156
  YouTubeIcon: () => YouTubeIcon,
157
+ getColorSchemeScriptString: () => getColorSchemeScriptString,
156
158
  getThemeScript: () => getThemeScript,
157
159
  themeScript: () => themeScript,
158
160
  themes: () => themes,
@@ -9104,6 +9106,59 @@ var CalendarHeatmap = ({
9104
9106
  ] });
9105
9107
  };
9106
9108
 
9109
+ // src/theme/ColorSchemeScript.tsx
9110
+ var import_jsx_runtime121 = require("react/jsx-runtime");
9111
+ function getColorSchemeScript(defaultColorMode, localStorageKey) {
9112
+ return `
9113
+ (function(){
9114
+ try {
9115
+ var d = document.documentElement;
9116
+ var stored = localStorage.getItem('${localStorageKey}');
9117
+ var mode = stored || '${defaultColorMode}';
9118
+ var resolved = mode;
9119
+
9120
+ if (mode === 'system' || !mode) {
9121
+ resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
9122
+ }
9123
+
9124
+ d.setAttribute('data-color-mode', resolved);
9125
+ d.style.colorScheme = resolved;
9126
+
9127
+ if (resolved === 'dark') {
9128
+ d.classList.add('dark');
9129
+ d.style.backgroundColor = 'hsl(0,0%,3.9%)';
9130
+ d.style.color = 'hsl(0,0%,98%)';
9131
+ } else {
9132
+ d.classList.remove('dark');
9133
+ d.style.backgroundColor = 'hsl(0,0%,100%)';
9134
+ d.style.color = 'hsl(0,0%,3.9%)';
9135
+ }
9136
+
9137
+ // Mark as initialized to prevent FOUC
9138
+ d.setAttribute('data-theme-initialized', 'true');
9139
+ } catch(e) {}
9140
+ })();
9141
+ `.trim();
9142
+ }
9143
+ function ColorSchemeScript({
9144
+ defaultColorMode = "system",
9145
+ localStorageKey = "lite-ui-color-mode",
9146
+ nonce
9147
+ } = {}) {
9148
+ const scriptContent = getColorSchemeScript(defaultColorMode, localStorageKey);
9149
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
9150
+ "script",
9151
+ {
9152
+ nonce,
9153
+ dangerouslySetInnerHTML: { __html: scriptContent },
9154
+ suppressHydrationWarning: true
9155
+ }
9156
+ );
9157
+ }
9158
+ function getColorSchemeScriptString(defaultColorMode = "system", localStorageKey = "lite-ui-color-mode") {
9159
+ return getColorSchemeScript(defaultColorMode, localStorageKey);
9160
+ }
9161
+
9107
9162
  // src/utils/theme-script.ts
9108
9163
  var themeScript = `
9109
9164
  (function() {
@@ -9137,8 +9192,12 @@ var themeScript = `
9137
9192
  html.style.backgroundColor = 'hsl(0 0% 100%)';
9138
9193
  html.style.color = 'hsl(0 0% 3.9%)';
9139
9194
  }
9195
+
9196
+ // Mark as initialized to prevent FOUC
9197
+ html.setAttribute('data-theme-initialized', 'true');
9140
9198
  } catch (e) {
9141
- // Silent fail - will use CSS defaults
9199
+ // Ensure page shows even on error
9200
+ document.documentElement.setAttribute('data-theme-initialized', 'true');
9142
9201
  }
9143
9202
  })();
9144
9203
  `;
@@ -9187,6 +9246,7 @@ function getThemeScript() {
9187
9246
  CloudIcon,
9188
9247
  Code,
9189
9248
  CodeIcon,
9249
+ ColorSchemeScript,
9190
9250
  CopyIcon,
9191
9251
  DatabaseIcon,
9192
9252
  DatePicker,
@@ -9269,6 +9329,7 @@ function getThemeScript() {
9269
9329
  VolumeOffIcon,
9270
9330
  VolumeUpIcon,
9271
9331
  YouTubeIcon,
9332
+ getColorSchemeScriptString,
9272
9333
  getThemeScript,
9273
9334
  themeScript,
9274
9335
  themes,