/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/mui-system/src/createTheme/createTheme.js
55 строк
1 KB
Rom Grk
[internal] perf: sx (#44254)
25 мар 2026, 09:10
Не верифицирован
25 мар 2026, 09:10
a884702
Код
Авторство
О чём код?
import deepmerge from '@mui/utils/deepmerge'; import createBreakpoints from '../createBreakpoints/createBreakpoints'; import cssContainerQueries from '../cssContainerQueries'; import shape from './shape'; import createSpacing from './createSpacing'; import styleFunctionSx from '../styleFunctionSx/styleFunctionSx'; import defaultSxConfig from '../styleFunctionSx/defaultSxConfig'; import applyStyles from './applyStyles'; function createTheme(options = {}, ...args) { const { breakpoints: breakpointsInput = {}, palette: paletteInput = {}, spacing: spacingInput, shape: shapeInput = {}, ...other } = options; const breakpoints = createBreakpoints(breakpointsInput); const spacing = createSpacing(spacingInput); let muiTheme = deepmerge( { breakpoints, direction: 'ltr', components: {}, // Inject component definitions. palette: { mode: 'light', ...paletteInput }, spacing, shape: { ...shape, ...shapeInput }, }, other, ); muiTheme = cssContainerQueries(muiTheme); muiTheme.applyStyles = applyStyles; muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme); muiTheme.unstable_sxConfig = { ...defaultSxConfig, ...other?.unstable_sxConfig, }; muiTheme.unstable_sx = function sx(props) { return styleFunctionSx({ sx: props, theme: this, }); }; muiTheme.internal_cache = {}; return muiTheme; } export default createTheme;