import { ThemeOptions as SystemThemeOptions } from '@mui/system'; import type { Theme, NovaPigmentTheme, SxProps } from '../types/theme'; import { ApplyStyles } from '@mui/system'; import { OverridableStringUnion } from '@mui/types'; export type { Theme, NovaPigmentTheme, SxProps }; export interface CssVarsOptions { } export interface CssThemeVariables { } export interface ThemeOptions extends Omit, CssVarsOptions { sys?: Theme['sys']; } /** * default MD color-schemes */ export type DefaultColorScheme = 'light' | 'dark'; export interface ColorSchemeOverrides { } export type ExtendedColorScheme = OverridableStringUnion; /** * default MD color-schemes */ export type SupportedColorScheme = DefaultColorScheme | ExtendedColorScheme; export interface CssVarsThemeOptions extends Omit { /** * @default 'light' */ defaultColorScheme?: SupportedColorScheme; /** * Prefix of the generated CSS variables * @default 'nova' */ cssVarPrefix?: string; /** * Color schemes configuration */ colorSchemes?: Partial>; /** * The strategy to generate CSS variables * * @example 'media' * Generate CSS variables using [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) * * @example '.mode-%s' * Generate CSS variables within a class .mode-light, .mode-dark * * @example '[data-mode-%s]' * Generate CSS variables within a data attribute [data-mode-light], [data-mode-dark] */ colorSchemeSelector?: 'media' | 'class' | 'data' | string; /** * The selector to generate the global CSS variables (non-color-scheme related) * @default ':root' * @example ':host' // (for shadow DOM) * @see https://mui.com/material-ui/customization/shadow-dom/#3-css-theme-variables-optional */ rootSelector?: string; /** * If `true`, the CSS color-scheme will not be set. * https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme * @default false */ disableCssColorScheme?: boolean; /** * 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; } export interface ThemeVars extends NovaPigmentTheme { } export interface ColorSystem { palette: Theme['palette']; } 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}-${ConcatDeep>}` : never : never : never; type NormalizeVars = ConcatDeep>; export type ThemeCssVar = OverridableStringUnion>>; export interface CssVarsTheme extends ColorSystem { colorSchemes: Partial>; rootSelector: string; colorSchemeSelector: 'media' | 'class' | 'data' | string; cssVarPrefix: string; defaultColorScheme: SupportedColorScheme; vars: ThemeVars; getCssVar: (field: ThemeCssVar, ...vars: ThemeCssVar[]) => string; getColorSchemeSelector: (colorScheme: SupportedColorScheme) => string; generateThemeVars: () => ThemeVars; generateStyleSheets: () => Array>; generateSpacing: () => Theme['spacing']; spacing: Theme['spacing']; breakpoints: Theme['breakpoints']; typography: Theme['typography']; shadows: Theme['shadows']; sys: Theme['sys']; /** * 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; applyStyles: ApplyStyles; }