mui-toolpad-extended-tuni
Version:
185 lines (184 loc) • 4.75 kB
TypeScript
import { Components, Theme, PaletteMode, PaletteOptions } from '@mui/material/styles';
import { ColorSchemePreference } from '@mui-toolpad-extended-tuni/core';
export interface TypographyVariantStyle extends Partial<React.CSSProperties> {
}
export interface ThemeTypography {
fontFamily: string;
h1: TypographyVariantStyle;
h2: TypographyVariantStyle;
h3: TypographyVariantStyle;
h4: TypographyVariantStyle;
h5: TypographyVariantStyle;
h6: TypographyVariantStyle;
subtitle1: TypographyVariantStyle;
subtitle2: TypographyVariantStyle;
body1: TypographyVariantStyle;
body2: TypographyVariantStyle;
button: TypographyVariantStyle;
caption: TypographyVariantStyle;
overline: TypographyVariantStyle;
}
export interface shape {
borderRadius: number;
}
export interface colorScheme {
palette: PaletteOptions & {
mode: PaletteMode;
background: {
default: string;
paper: string;
};
primary: {
main: string;
light: string;
dark: string;
contrastText: string;
};
secondary: {
main: string;
light: string;
dark: string;
contrastText: string;
};
error: {
main: string;
light: string;
dark: string;
contrastText: string;
};
warning: {
main: string;
light: string;
dark: string;
contrastText: string;
};
info: {
main: string;
light: string;
dark: string;
contrastText: string;
};
success: {
main: string;
light: string;
dark: string;
contrastText: string;
};
text: {
primary: string;
secondary: string;
disabled: string;
};
divider: string;
};
}
export interface ThemeBreakpoints {
values: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
}
export interface ThemeComponents {
MuiButton: {
styleOverrides: {
root: {
textTransform: string;
borderRadius: number;
};
};
};
MuiPaper: {
styleOverrides: {
root: {
backgroundImage: string;
};
};
};
MuiDialog: {
styleOverrides: {
paper: {
borderRadius: number;
};
};
};
MuiCard: {
styleOverrides: {
root: {
borderRadius: number;
};
};
};
}
export interface ThemeTransitions {
easing: {
easeInOut: string;
easeOut: string;
easeIn: string;
sharp: string;
};
duration: {
shortest: number;
shorter: number;
short: number;
standard: number;
complex: number;
enteringScreen: number;
leavingScreen: number;
};
}
export interface ThemezIndex {
mobileStepper: number;
fab: number;
speedDial: number;
appBar: number;
drawer: number;
modal: number;
snackbar: number;
tooltip: number;
}
interface ThemeTemplate {
cssVariables: {
colorSchemeSelector: string;
};
defaultColorScheme: 'light' | 'dark';
typography: ThemeTypography;
shape: shape;
spacing: number;
colorSchemes: {
light: colorScheme;
dark: colorScheme;
};
breakpoints: ThemeBreakpoints;
components: Partial<Components<Theme>>;
transitions: ThemeTransitions;
zIndex: ThemezIndex;
}
export declare const ThemeTemplate: ThemeTemplate;
export type AppTheme = ThemeTemplate;
interface ThemeStore {
colorSchemePreference: ColorSchemePreference;
setColorSchemePreference: (preference: ColorSchemePreference) => void;
getTheme: () => AppTheme;
updateTheme: (updates: AppTheme) => void;
resetTheme: () => void;
}
/**
* Theme management store with support for custom themes and dark mode.
*
* @version 2.0.0
* @updates
* - Color scheme preference stored in cookie (light/dark/system)
* - Theme colors always come from ThemeTemplate (not persisted)
* - System preference detection for 'system' mode
*
* @features
* - Theme customization (colors, typography, etc.)
* - Color scheme preference management (cookie-based)
* - System preference detection
* - Always uses ThemeTemplate for base colors
*/
export declare const useThemeStore: import('zustand/traditional').UseBoundStoreWithEqualityFn<import('zustand').StoreApi<ThemeStore>>;
export {};