import { OverridableStringUnion } from '@mui/types'; import { Breakpoints, Spacing, SxProps as SystemSxProps, SystemProps as SystemSystemProps, CSSObject, SxConfig, ApplyStyles } from '@mui/system'; import { DefaultColorScheme, ExtendedColorScheme } from './colorScheme'; import { ColorSystem } from './colorSystem'; import { Focus } from './focus'; import { DefaultShadow, Shadow } from './shadow'; import { DefaultRadius, Radius } from './radius'; import { FontFamily, FontSize, FontWeight, LineHeight, TypographySystem, DefaultFontFamily, DefaultFontSize, DefaultFontWeight, DefaultLineHeight } from './typography'; import { Variants } from './variants'; import { DefaultZIndex, ZIndex } from './zIndex'; import { MergeDefault } from './utils'; type Split = K extends string | number ? { [k in K]: Exclude; } : never; type ConcatDeep = T extends Record ? keyof T extends string | number ? V extends string | number ? keyof T : keyof V extends string | number ? `${keyof T}${D}${ConcatDeep, D>}` : never : never : never; /** * Does not work for these cases: * - { borderRadius: string | number } // the value can't be a union * - { shadows: [string, string, ..., string] } // the value can't be an array */ type NormalizeVars = ConcatDeep, D>; export interface RuntimeColorSystem extends Omit { palette: ColorSystem['palette'] & { colorScheme: DefaultColorScheme | ExtendedColorScheme; }; } export interface ThemeScales { radius: Radius; shadow: Shadow; focus: { thickness: string; }; fontFamily: FontFamily; fontSize: FontSize; fontWeight: FontWeight; lineHeight: LineHeight; zIndex: ZIndex; } export type ThemeScalesOptions = MergeDefault; interface ColorSystemVars extends Omit { palette: Omit; } export interface ThemeVars extends ThemeScales, ColorSystemVars { } export interface ThemeCssVarOverrides { } /** * For providing `sx` autocomplete, for example `color`, `bgcolor`, `borderColor`. */ export type TextColor = NormalizeVars, '.'> | (string & Record); export type ThemeCssVar = OverridableStringUnion, ThemeCssVarOverrides>; export interface Theme extends ThemeScales, RuntimeColorSystem { colorSchemes: Record; focus: Focus; typography: TypographySystem; variants: Variants; spacing: Spacing; breakpoints: Breakpoints; cssVarPrefix: string; vars: ThemeVars; getCssVar: (field: ThemeCssVar, ...vars: ThemeCssVar[]) => string; getColorSchemeSelector: (colorScheme: DefaultColorScheme | ExtendedColorScheme) => string; generateCssVars: (colorScheme?: DefaultColorScheme | ExtendedColorScheme) => { css: Record; vars: ThemeVars; }; /** * A function to determine if the key, value should be attached as CSS Variable * `keys` is an array that represents the object path keys. * Ex, if the theme is { foo: { bar: 'var(--test)' } } * then, keys = ['foo', 'bar'] * value = 'var(--test)' */ shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean; unstable_sxConfig: SxConfig; unstable_sx: (props: SxProps) => CSSObject; applyStyles: ApplyStyles; } export type SxProps = SystemSxProps; export type SystemProps = SystemSystemProps; export {};