New source found from dndbeyond.com
This commit is contained in:
+13
-1
@@ -14,9 +14,21 @@ export default function ThemeProvider(_ref) {
|
||||
} = _ref,
|
||||
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||||
const scopedTheme = themeInput[THEME_ID];
|
||||
let finalTheme = scopedTheme || themeInput;
|
||||
if (typeof themeInput !== 'function') {
|
||||
if (scopedTheme && !scopedTheme.vars) {
|
||||
finalTheme = _extends({}, scopedTheme, {
|
||||
vars: null
|
||||
});
|
||||
} else if (themeInput && !themeInput.vars) {
|
||||
finalTheme = _extends({}, themeInput, {
|
||||
vars: null
|
||||
});
|
||||
}
|
||||
}
|
||||
return /*#__PURE__*/_jsx(SystemThemeProvider, _extends({}, props, {
|
||||
themeId: scopedTheme ? THEME_ID : undefined,
|
||||
theme: scopedTheme || themeInput
|
||||
theme: finalTheme
|
||||
}));
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
||||
|
||||
+4
-1
@@ -20,7 +20,10 @@ function createTheme(options = {}, ...args) {
|
||||
typography: typographyInput = {}
|
||||
} = options,
|
||||
other = _objectWithoutPropertiesLoose(options, _excluded);
|
||||
if (options.vars) {
|
||||
if (options.vars &&
|
||||
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
||||
// `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
||||
options.generateCssVars === undefined) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
|
||||
Please use another name.` : _formatMuiErrorMessage(18));
|
||||
}
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import systemUseThemeProps from '@mui/system/useThemeProps';
|
||||
import defaultTheme from './defaultTheme';
|
||||
import THEME_ID from './identifier';
|
||||
export default function useThemeProps({
|
||||
props,
|
||||
name
|
||||
}) {
|
||||
return systemUseThemeProps({
|
||||
props,
|
||||
name,
|
||||
defaultTheme,
|
||||
themeId: THEME_ID
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user