@mui/system 5.10.15 → 5.10.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +47 -1
  3. package/Container/Container.d.ts +13 -13
  4. package/Container/ContainerProps.d.ts +40 -40
  5. package/Container/containerClasses.d.ts +22 -22
  6. package/Container/createContainer.d.ts +18 -18
  7. package/Stack/Stack.d.ts +13 -13
  8. package/Stack/StackProps.d.ts +42 -42
  9. package/Stack/createStack.d.ts +21 -21
  10. package/Stack/index.d.ts +5 -5
  11. package/Stack/stackClasses.d.ts +8 -8
  12. package/Unstable_Grid/Grid.d.ts +12 -12
  13. package/Unstable_Grid/GridProps.d.ts +162 -162
  14. package/Unstable_Grid/createGrid.d.ts +11 -11
  15. package/Unstable_Grid/gridClasses.d.ts +20 -20
  16. package/Unstable_Grid/gridGenerator.d.ts +29 -29
  17. package/Unstable_Grid/index.d.ts +5 -5
  18. package/createBox.spec.d.ts +1 -1
  19. package/createTheme/createSpacing.d.ts +10 -10
  20. package/cssVars/createCssVarsProvider.d.ts +12 -7
  21. package/cssVars/createCssVarsProvider.js +7 -9
  22. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  23. package/cssVars/createGetCssVar.d.ts +5 -5
  24. package/cssVars/cssVarsParser.d.ts +63 -65
  25. package/cssVars/cssVarsParser.js +3 -7
  26. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  27. package/cssVars/index.d.ts +3 -3
  28. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  29. package/esm/cssVars/createCssVarsProvider.js +7 -9
  30. package/esm/cssVars/cssVarsParser.js +3 -7
  31. package/index.js +1 -1
  32. package/index.spec.d.ts +1 -1
  33. package/legacy/cssVars/createCssVarsProvider.js +7 -9
  34. package/legacy/cssVars/cssVarsParser.js +3 -7
  35. package/legacy/index.js +1 -1
  36. package/modern/cssVars/createCssVarsProvider.js +7 -9
  37. package/modern/cssVars/cssVarsParser.js +3 -7
  38. package/modern/index.js +1 -1
  39. package/package.json +5 -5
  40. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -1,65 +1,63 @@
1
- declare type NestedRecord<V = any> = {
2
- [k: string | number]: NestedRecord<V> | V;
3
- };
4
- /**
5
- * This function create an object from keys, value and then assign to target
6
- *
7
- * @param {Object} obj : the target object to be assigned
8
- * @param {string[]} keys
9
- * @param {string | number} value
10
- *
11
- * @example
12
- * const source = {}
13
- * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
- * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
- *
16
- * @example
17
- * const source = { palette: { primary: 'var(--palette-primary)' } }
18
- * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
- * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
- */
21
- export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
- /**
23
- *
24
- * @param {Object} obj : source object
25
- * @param {Function} callback : a function that will be called when
26
- * - the deepest key in source object is reached
27
- * - the value of the deepest key is NOT `undefined` | `null`
28
- *
29
- * @example
30
- * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
- * // ['palette', 'primary', 'main'] '#000000'
32
- */
33
- export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
- /**
35
- * a function that parse theme and return { css, vars }
36
- *
37
- * @param {Object} theme
38
- * @param {{
39
- * prefix?: string,
40
- * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
- * }} options.
42
- * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
- *
44
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
45
- *
46
- * @example
47
- * const { css, vars, parsedTheme } = parser({
48
- * fontSize: 12,
49
- * lineHeight: 1.2,
50
- * palette: { primary: { 500: 'var(--color)' } }
51
- * }, { prefix: 'foo' })
52
- *
53
- * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
- * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
56
- */
57
- export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
58
- prefix?: string;
59
- shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
60
- }): {
61
- css: Record<string, string | number>;
62
- vars: NestedRecord<string>;
63
- parsedTheme: T;
64
- };
65
- export {};
1
+ type NestedRecord<V = any> = {
2
+ [k: string | number]: NestedRecord<V> | V;
3
+ };
4
+ /**
5
+ * This function create an object from keys, value and then assign to target
6
+ *
7
+ * @param {Object} obj : the target object to be assigned
8
+ * @param {string[]} keys
9
+ * @param {string | number} value
10
+ *
11
+ * @example
12
+ * const source = {}
13
+ * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
14
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
15
+ *
16
+ * @example
17
+ * const source = { palette: { primary: 'var(--palette-primary)' } }
18
+ * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
19
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
20
+ */
21
+ export declare const assignNestedKeys: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
22
+ /**
23
+ *
24
+ * @param {Object} obj : source object
25
+ * @param {Function} callback : a function that will be called when
26
+ * - the deepest key in source object is reached
27
+ * - the value of the deepest key is NOT `undefined` | `null`
28
+ *
29
+ * @example
30
+ * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
31
+ * // ['palette', 'primary', 'main'] '#000000'
32
+ */
33
+ export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
34
+ /**
35
+ * a function that parse theme and return { css, vars }
36
+ *
37
+ * @param {Object} theme
38
+ * @param {{
39
+ * prefix?: string,
40
+ * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
41
+ * }} options.
42
+ * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
43
+ *
44
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
45
+ *
46
+ * @example
47
+ * const { css, vars } = parser({
48
+ * fontSize: 12,
49
+ * lineHeight: 1.2,
50
+ * palette: { primary: { 500: 'var(--color)' } }
51
+ * }, { prefix: 'foo' })
52
+ *
53
+ * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
54
+ * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
55
+ */
56
+ export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
57
+ prefix?: string;
58
+ shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
59
+ }): {
60
+ css: Record<string, string | number>;
61
+ vars: NestedRecord<string>;
62
+ };
63
+ export {};
@@ -96,10 +96,10 @@ const getCssValue = (keys, value) => {
96
96
  * }} options.
97
97
  * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
98
98
  *
99
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
99
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
100
100
  *
101
101
  * @example
102
- * const { css, vars, parsedTheme } = parser({
102
+ * const { css, vars } = parser({
103
103
  * fontSize: 12,
104
104
  * lineHeight: 1.2,
105
105
  * palette: { primary: { 500: 'var(--color)' } }
@@ -107,7 +107,6 @@ const getCssValue = (keys, value) => {
107
107
  *
108
108
  * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
109
109
  * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
110
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
111
110
  */
112
111
  function cssVarsParser(theme, options) {
113
112
  const {
@@ -116,7 +115,6 @@ function cssVarsParser(theme, options) {
116
115
  } = options || {};
117
116
  const css = {};
118
117
  const vars = {};
119
- const parsedTheme = {};
120
118
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
121
119
  if (typeof value === 'string' || typeof value === 'number') {
122
120
  if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
@@ -128,13 +126,11 @@ function cssVarsParser(theme, options) {
128
126
  assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
129
127
  }
130
128
  }
131
- assignNestedKeys(parsedTheme, keys, value, arrayKeys);
132
129
  }, keys => keys[0] === 'vars' // skip 'vars/*' paths
133
130
  );
134
131
 
135
132
  return {
136
133
  css,
137
- vars,
138
- parsedTheme
134
+ vars
139
135
  };
140
136
  }
@@ -1,42 +1,42 @@
1
- /// <reference types="react" />
2
- export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
- export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
- export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
- export interface GetInitColorSchemeScriptOptions {
6
- /**
7
- * The mode to be used for the first visit
8
- * @default 'light'
9
- */
10
- defaultMode?: 'light' | 'dark' | 'system';
11
- /**
12
- * The default color scheme to be used on the light mode
13
- * @default 'light'
14
- */
15
- defaultLightColorScheme?: string;
16
- /**
17
- * The default color scheme to be used on the dark mode
18
- * * @default 'dark'
19
- */
20
- defaultDarkColorScheme?: string;
21
- /**
22
- * The node (provided as string) used to attach the color-scheme attribute
23
- * @default 'document.documentElement'
24
- */
25
- colorSchemeNode?: string;
26
- /**
27
- * localStorage key used to store `mode`
28
- * @default 'mode'
29
- */
30
- modeStorageKey?: string;
31
- /**
32
- * localStorage key used to store `colorScheme`
33
- * @default 'color-scheme'
34
- */
35
- colorSchemeStorageKey?: string;
36
- /**
37
- * DOM attribute for applying color scheme
38
- * @default 'data-color-scheme'
39
- */
40
- attribute?: string;
41
- }
42
- export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
+ export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
+ export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
+ export interface GetInitColorSchemeScriptOptions {
6
+ /**
7
+ * The mode to be used for the first visit
8
+ * @default 'light'
9
+ */
10
+ defaultMode?: 'light' | 'dark' | 'system';
11
+ /**
12
+ * The default color scheme to be used on the light mode
13
+ * @default 'light'
14
+ */
15
+ defaultLightColorScheme?: string;
16
+ /**
17
+ * The default color scheme to be used on the dark mode
18
+ * * @default 'dark'
19
+ */
20
+ defaultDarkColorScheme?: string;
21
+ /**
22
+ * The node (provided as string) used to attach the color-scheme attribute
23
+ * @default 'document.documentElement'
24
+ */
25
+ colorSchemeNode?: string;
26
+ /**
27
+ * localStorage key used to store `mode`
28
+ * @default 'mode'
29
+ */
30
+ modeStorageKey?: string;
31
+ /**
32
+ * localStorage key used to store `colorScheme`
33
+ * @default 'color-scheme'
34
+ */
35
+ colorSchemeStorageKey?: string;
36
+ /**
37
+ * DOM attribute for applying color scheme
38
+ * @default 'data-color-scheme'
39
+ */
40
+ attribute?: string;
41
+ }
42
+ export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
@@ -1,3 +1,3 @@
1
- export { default } from './createCssVarsProvider';
2
- export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
1
+ export { default } from './createCssVarsProvider';
2
+ export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
3
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
@@ -1,53 +1,53 @@
1
- export declare type Mode = 'light' | 'dark' | 'system';
2
- export declare type SystemMode = Exclude<Mode, 'system'>;
3
- export interface State<SupportedColorScheme extends string> {
4
- /**
5
- * User selected mode.
6
- * Note: on the server, mode is always undefined
7
- */
8
- mode: Mode | undefined;
9
- /**
10
- * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
- */
12
- systemMode: SystemMode | undefined;
13
- /**
14
- * The color scheme for the light mode.
15
- */
16
- lightColorScheme: SupportedColorScheme;
17
- /**
18
- * The color scheme for the dark mode.
19
- */
20
- darkColorScheme: SupportedColorScheme;
21
- }
22
- export declare type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
- /**
24
- * The current application color scheme. It is always `undefined` on the server.
25
- */
26
- colorScheme: SupportedColorScheme | undefined;
27
- /**
28
- * `mode` is saved to internal state and localStorage
29
- * If `mode` is null, it will be reset to the defaultMode
30
- */
31
- setMode: (mode: Mode | null) => void;
32
- /**
33
- * `colorScheme` is saved to internal state and localStorage
34
- * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
- */
36
- setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
- light: SupportedColorScheme | null;
38
- dark: SupportedColorScheme | null;
39
- }> | null) => void;
40
- };
41
- export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
- export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
- interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
- defaultLightColorScheme: SupportedColorScheme;
45
- defaultDarkColorScheme: SupportedColorScheme;
46
- supportedColorSchemes: Array<SupportedColorScheme>;
47
- defaultMode?: Mode;
48
- modeStorageKey?: string;
49
- colorSchemeStorageKey?: string;
50
- storageWindow?: Window | null;
51
- }
52
- export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
- export {};
1
+ export type Mode = 'light' | 'dark' | 'system';
2
+ export type SystemMode = Exclude<Mode, 'system'>;
3
+ export interface State<SupportedColorScheme extends string> {
4
+ /**
5
+ * User selected mode.
6
+ * Note: on the server, mode is always undefined
7
+ */
8
+ mode: Mode | undefined;
9
+ /**
10
+ * Only valid if `mode: 'system'`, either 'light' | 'dark'.
11
+ */
12
+ systemMode: SystemMode | undefined;
13
+ /**
14
+ * The color scheme for the light mode.
15
+ */
16
+ lightColorScheme: SupportedColorScheme;
17
+ /**
18
+ * The color scheme for the dark mode.
19
+ */
20
+ darkColorScheme: SupportedColorScheme;
21
+ }
22
+ export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
23
+ /**
24
+ * The current application color scheme. It is always `undefined` on the server.
25
+ */
26
+ colorScheme: SupportedColorScheme | undefined;
27
+ /**
28
+ * `mode` is saved to internal state and localStorage
29
+ * If `mode` is null, it will be reset to the defaultMode
30
+ */
31
+ setMode: (mode: Mode | null) => void;
32
+ /**
33
+ * `colorScheme` is saved to internal state and localStorage
34
+ * If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
35
+ */
36
+ setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
37
+ light: SupportedColorScheme | null;
38
+ dark: SupportedColorScheme | null;
39
+ }> | null) => void;
40
+ };
41
+ export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
42
+ export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
43
+ interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
44
+ defaultLightColorScheme: SupportedColorScheme;
45
+ defaultDarkColorScheme: SupportedColorScheme;
46
+ supportedColorSchemes: Array<SupportedColorScheme>;
47
+ defaultMode?: Mode;
48
+ modeStorageKey?: string;
49
+ colorSchemeStorageKey?: string;
50
+ storageWindow?: Window | null;
51
+ }
52
+ export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
53
+ export {};
@@ -106,15 +106,14 @@ export default function createCssVarsProvider(options) {
106
106
  // 2. Create CSS variables and store them in objects (to be generated in stylesheets in the final step)
107
107
  const {
108
108
  css: rootCss,
109
- vars: rootVars,
110
- parsedTheme
109
+ vars: rootVars
111
110
  } = cssVarsParser(restThemeProp, {
112
111
  prefix: cssVarPrefix,
113
112
  shouldSkipGeneratingVar
114
113
  });
115
114
 
116
115
  // 3. Start composing the theme object
117
- const theme = _extends({}, parsedTheme, {
116
+ const theme = _extends({}, restThemeProp, {
118
117
  components,
119
118
  colorSchemes,
120
119
  cssVarPrefix,
@@ -130,8 +129,7 @@ export default function createCssVarsProvider(options) {
130
129
  Object.entries(colorSchemes).forEach(([key, scheme]) => {
131
130
  const {
132
131
  css,
133
- vars,
134
- parsedTheme: parsedScheme
132
+ vars
135
133
  } = cssVarsParser(scheme, {
136
134
  prefix: cssVarPrefix,
137
135
  shouldSkipGeneratingVar
@@ -139,12 +137,12 @@ export default function createCssVarsProvider(options) {
139
137
  theme.vars = deepmerge(theme.vars, vars);
140
138
  if (key === calculatedColorScheme) {
141
139
  // 4.1 Merge the selected color scheme to the theme
142
- Object.keys(parsedScheme).forEach(schemeKey => {
143
- if (parsedScheme[schemeKey] && typeof parsedScheme[schemeKey] === 'object') {
140
+ Object.keys(scheme).forEach(schemeKey => {
141
+ if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
144
142
  // shallow merge the 1st level structure of the theme.
145
- theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
143
+ theme[schemeKey] = _extends({}, theme[schemeKey], scheme[schemeKey]);
146
144
  } else {
147
- theme[schemeKey] = parsedScheme[schemeKey];
145
+ theme[schemeKey] = scheme[schemeKey];
148
146
  }
149
147
  });
150
148
  if (theme.palette) {
@@ -86,10 +86,10 @@ const getCssValue = (keys, value) => {
86
86
  * }} options.
87
87
  * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
88
88
  *
89
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
89
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
90
90
  *
91
91
  * @example
92
- * const { css, vars, parsedTheme } = parser({
92
+ * const { css, vars } = parser({
93
93
  * fontSize: 12,
94
94
  * lineHeight: 1.2,
95
95
  * palette: { primary: { 500: 'var(--color)' } }
@@ -97,7 +97,6 @@ const getCssValue = (keys, value) => {
97
97
  *
98
98
  * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
99
99
  * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
100
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
101
100
  */
102
101
  export default function cssVarsParser(theme, options) {
103
102
  const {
@@ -106,7 +105,6 @@ export default function cssVarsParser(theme, options) {
106
105
  } = options || {};
107
106
  const css = {};
108
107
  const vars = {};
109
- const parsedTheme = {};
110
108
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
111
109
  if (typeof value === 'string' || typeof value === 'number') {
112
110
  if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
@@ -118,13 +116,11 @@ export default function cssVarsParser(theme, options) {
118
116
  assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
119
117
  }
120
118
  }
121
- assignNestedKeys(parsedTheme, keys, value, arrayKeys);
122
119
  }, keys => keys[0] === 'vars' // skip 'vars/*' paths
123
120
  );
124
121
 
125
122
  return {
126
123
  css,
127
- vars,
128
- parsedTheme
124
+ vars
129
125
  };
130
126
  }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.15
1
+ /** @license MUI v5.10.16
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -125,9 +125,8 @@ export default function createCssVarsProvider(options) {
125
125
  shouldSkipGeneratingVar: shouldSkipGeneratingVar
126
126
  }),
127
127
  rootCss = _cssVarsParser.css,
128
- rootVars = _cssVarsParser.vars,
129
- parsedTheme = _cssVarsParser.parsedTheme; // 3. Start composing the theme object
130
- var theme = _extends({}, parsedTheme, {
128
+ rootVars = _cssVarsParser.vars; // 3. Start composing the theme object
129
+ var theme = _extends({}, restThemeProp, {
131
130
  components: components,
132
131
  colorSchemes: colorSchemes,
133
132
  cssVarPrefix: cssVarPrefix,
@@ -151,17 +150,16 @@ export default function createCssVarsProvider(options) {
151
150
  shouldSkipGeneratingVar: shouldSkipGeneratingVar
152
151
  }),
153
152
  css = _cssVarsParser2.css,
154
- vars = _cssVarsParser2.vars,
155
- parsedScheme = _cssVarsParser2.parsedTheme;
153
+ vars = _cssVarsParser2.vars;
156
154
  theme.vars = deepmerge(theme.vars, vars);
157
155
  if (key === calculatedColorScheme) {
158
156
  // 4.1 Merge the selected color scheme to the theme
159
- Object.keys(parsedScheme).forEach(function (schemeKey) {
160
- if (parsedScheme[schemeKey] && _typeof(parsedScheme[schemeKey]) === 'object') {
157
+ Object.keys(scheme).forEach(function (schemeKey) {
158
+ if (scheme[schemeKey] && _typeof(scheme[schemeKey]) === 'object') {
161
159
  // shallow merge the 1st level structure of the theme.
162
- theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
160
+ theme[schemeKey] = _extends({}, theme[schemeKey], scheme[schemeKey]);
163
161
  } else {
164
- theme[schemeKey] = parsedScheme[schemeKey];
162
+ theme[schemeKey] = scheme[schemeKey];
165
163
  }
166
164
  });
167
165
  if (theme.palette) {
@@ -99,10 +99,10 @@ var getCssValue = function getCssValue(keys, value) {
99
99
  * }} options.
100
100
  * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
101
101
  *
102
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
102
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
103
103
  *
104
104
  * @example
105
- * const { css, vars, parsedTheme } = parser({
105
+ * const { css, vars } = parser({
106
106
  * fontSize: 12,
107
107
  * lineHeight: 1.2,
108
108
  * palette: { primary: { 500: 'var(--color)' } }
@@ -110,7 +110,6 @@ var getCssValue = function getCssValue(keys, value) {
110
110
  *
111
111
  * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
112
112
  * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
113
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
114
113
  */
115
114
  export default function cssVarsParser(theme, options) {
116
115
  var _ref3 = options || {},
@@ -118,7 +117,6 @@ export default function cssVarsParser(theme, options) {
118
117
  shouldSkipGeneratingVar = _ref3.shouldSkipGeneratingVar;
119
118
  var css = {};
120
119
  var vars = {};
121
- var parsedTheme = {};
122
120
  walkObjectDeep(theme, function (keys, value, arrayKeys) {
123
121
  if (typeof value === 'string' || typeof value === 'number') {
124
122
  if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
@@ -128,7 +126,6 @@ export default function cssVarsParser(theme, options) {
128
126
  assignNestedKeys(vars, keys, "var(".concat(cssVar, ")"), arrayKeys);
129
127
  }
130
128
  }
131
- assignNestedKeys(parsedTheme, keys, value, arrayKeys);
132
129
  }, function (keys) {
133
130
  return keys[0] === 'vars';
134
131
  } // skip 'vars/*' paths
@@ -136,7 +133,6 @@ export default function cssVarsParser(theme, options) {
136
133
 
137
134
  return {
138
135
  css: css,
139
- vars: vars,
140
- parsedTheme: parsedTheme
136
+ vars: vars
141
137
  };
142
138
  }
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.10.15
1
+ /** @license MUI v5.10.16
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -106,15 +106,14 @@ export default function createCssVarsProvider(options) {
106
106
  // 2. Create CSS variables and store them in objects (to be generated in stylesheets in the final step)
107
107
  const {
108
108
  css: rootCss,
109
- vars: rootVars,
110
- parsedTheme
109
+ vars: rootVars
111
110
  } = cssVarsParser(restThemeProp, {
112
111
  prefix: cssVarPrefix,
113
112
  shouldSkipGeneratingVar
114
113
  });
115
114
 
116
115
  // 3. Start composing the theme object
117
- const theme = _extends({}, parsedTheme, {
116
+ const theme = _extends({}, restThemeProp, {
118
117
  components,
119
118
  colorSchemes,
120
119
  cssVarPrefix,
@@ -130,8 +129,7 @@ export default function createCssVarsProvider(options) {
130
129
  Object.entries(colorSchemes).forEach(([key, scheme]) => {
131
130
  const {
132
131
  css,
133
- vars,
134
- parsedTheme: parsedScheme
132
+ vars
135
133
  } = cssVarsParser(scheme, {
136
134
  prefix: cssVarPrefix,
137
135
  shouldSkipGeneratingVar
@@ -139,12 +137,12 @@ export default function createCssVarsProvider(options) {
139
137
  theme.vars = deepmerge(theme.vars, vars);
140
138
  if (key === calculatedColorScheme) {
141
139
  // 4.1 Merge the selected color scheme to the theme
142
- Object.keys(parsedScheme).forEach(schemeKey => {
143
- if (parsedScheme[schemeKey] && typeof parsedScheme[schemeKey] === 'object') {
140
+ Object.keys(scheme).forEach(schemeKey => {
141
+ if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
144
142
  // shallow merge the 1st level structure of the theme.
145
- theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
143
+ theme[schemeKey] = _extends({}, theme[schemeKey], scheme[schemeKey]);
146
144
  } else {
147
- theme[schemeKey] = parsedScheme[schemeKey];
145
+ theme[schemeKey] = scheme[schemeKey];
148
146
  }
149
147
  });
150
148
  if (theme.palette) {
@@ -86,10 +86,10 @@ const getCssValue = (keys, value) => {
86
86
  * }} options.
87
87
  * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
88
88
  *
89
- * @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
89
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
90
90
  *
91
91
  * @example
92
- * const { css, vars, parsedTheme } = parser({
92
+ * const { css, vars } = parser({
93
93
  * fontSize: 12,
94
94
  * lineHeight: 1.2,
95
95
  * palette: { primary: { 500: 'var(--color)' } }
@@ -97,7 +97,6 @@ const getCssValue = (keys, value) => {
97
97
  *
98
98
  * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
99
99
  * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
100
- * console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
101
100
  */
102
101
  export default function cssVarsParser(theme, options) {
103
102
  const {
@@ -106,7 +105,6 @@ export default function cssVarsParser(theme, options) {
106
105
  } = options || {};
107
106
  const css = {};
108
107
  const vars = {};
109
- const parsedTheme = {};
110
108
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
111
109
  if (typeof value === 'string' || typeof value === 'number') {
112
110
  if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
@@ -118,13 +116,11 @@ export default function cssVarsParser(theme, options) {
118
116
  assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
119
117
  }
120
118
  }
121
- assignNestedKeys(parsedTheme, keys, value, arrayKeys);
122
119
  }, keys => keys[0] === 'vars' // skip 'vars/*' paths
123
120
  );
124
121
 
125
122
  return {
126
123
  css,
127
- vars,
128
- parsedTheme
124
+ vars
129
125
  };
130
126
  }