1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import styleFunctionSx from '@mui/system/styleFunctionSx';
|
5 | import { unstable_createCssVarsProvider as createCssVarsProvider } from '@mui/system';
|
6 | import createTheme from "./createTheme.js";
|
7 | import createTypography from "./createTypography.js";
|
8 | import THEME_ID from "./identifier.js";
|
9 | import { defaultConfig } from "../InitColorSchemeScript/InitColorSchemeScript.js";
|
10 | import { jsx as _jsx } from "react/jsx-runtime";
|
11 | const {
|
12 | CssVarsProvider: InternalCssVarsProvider,
|
13 | useColorScheme,
|
14 | getInitColorSchemeScript: deprecatedGetInitColorSchemeScript
|
15 | } = createCssVarsProvider({
|
16 | themeId: THEME_ID,
|
17 |
|
18 | theme: () => createTheme({
|
19 | cssVariables: true
|
20 | }),
|
21 | colorSchemeStorageKey: defaultConfig.colorSchemeStorageKey,
|
22 | modeStorageKey: defaultConfig.modeStorageKey,
|
23 | defaultColorScheme: {
|
24 | light: defaultConfig.defaultLightColorScheme,
|
25 | dark: defaultConfig.defaultDarkColorScheme
|
26 | },
|
27 | resolveTheme: theme => {
|
28 | const newTheme = {
|
29 | ...theme,
|
30 | typography: createTypography(theme.palette, theme.typography)
|
31 | };
|
32 | newTheme.unstable_sx = function sx(props) {
|
33 | return styleFunctionSx({
|
34 | sx: props,
|
35 | theme: this
|
36 | });
|
37 | };
|
38 | return newTheme;
|
39 | }
|
40 | });
|
41 | let warnedOnce = false;
|
42 |
|
43 |
|
44 |
|
45 | function Experimental_CssVarsProvider(props) {
|
46 | if (process.env.NODE_ENV !== 'production') {
|
47 | if (!warnedOnce) {
|
48 | console.warn(['MUI: The Experimental_CssVarsProvider component has been ported into ThemeProvider.', '', "You should use `import { ThemeProvider } from '@mui/material/styles'` instead.", 'For more details, check out https://mui.com/material-ui/customization/css-theme-variables/usage/'].join('\n'));
|
49 | warnedOnce = true;
|
50 | }
|
51 | }
|
52 | return _jsx(InternalCssVarsProvider, {
|
53 | ...props
|
54 | });
|
55 | }
|
56 | let warnedInitScriptOnce = false;
|
57 |
|
58 |
|
59 | const getInitColorSchemeScript = params => {
|
60 | if (!warnedInitScriptOnce) {
|
61 | console.warn(['MUI: The getInitColorSchemeScript function has been deprecated.', '', "You should use `import InitColorSchemeScript from '@mui/material/InitColorSchemeScript'`", 'and replace the function call with `<InitColorSchemeScript />` instead.'].join('\n'));
|
62 | warnedInitScriptOnce = true;
|
63 | }
|
64 | return deprecatedGetInitColorSchemeScript(params);
|
65 | };
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | export const CssVarsProvider = InternalCssVarsProvider;
|
91 | export { useColorScheme, getInitColorSchemeScript, Experimental_CssVarsProvider }; |
\ | No newline at end of file |