@mui/system 5.11.9 → 5.11.12

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 (64) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +279 -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/Stack.js +5 -0
  9. package/Stack/StackProps.d.ts +42 -42
  10. package/Stack/createStack.d.ts +21 -21
  11. package/Stack/index.d.ts +5 -5
  12. package/Stack/stackClasses.d.ts +8 -8
  13. package/Unstable_Grid/Grid.d.ts +12 -12
  14. package/Unstable_Grid/GridProps.d.ts +173 -173
  15. package/Unstable_Grid/createGrid.d.ts +11 -11
  16. package/Unstable_Grid/gridClasses.d.ts +20 -20
  17. package/Unstable_Grid/gridGenerator.d.ts +33 -33
  18. package/Unstable_Grid/index.d.ts +5 -5
  19. package/createBox.spec.d.ts +1 -1
  20. package/createTheme/createSpacing.d.ts +10 -10
  21. package/cssVars/createCssVarsProvider.d.ts +0 -8
  22. package/cssVars/createCssVarsProvider.js +8 -16
  23. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  24. package/cssVars/createCssVarsTheme.d.ts +10 -0
  25. package/cssVars/createCssVarsTheme.js +24 -0
  26. package/cssVars/createGetCssVar.d.ts +5 -5
  27. package/cssVars/createGetCssVar.js +1 -1
  28. package/cssVars/cssVarsParser.d.ts +64 -63
  29. package/cssVars/cssVarsParser.js +4 -1
  30. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  31. package/cssVars/index.d.ts +5 -3
  32. package/cssVars/index.js +15 -1
  33. package/cssVars/prepareCssVars.d.ts +11 -0
  34. package/cssVars/prepareCssVars.js +70 -0
  35. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  36. package/esm/Stack/Stack.js +5 -0
  37. package/esm/cssVars/createCssVarsProvider.js +8 -16
  38. package/esm/cssVars/createCssVarsTheme.js +16 -0
  39. package/esm/cssVars/createGetCssVar.js +1 -1
  40. package/esm/cssVars/cssVarsParser.js +4 -1
  41. package/esm/cssVars/index.js +3 -1
  42. package/esm/cssVars/prepareCssVars.js +62 -0
  43. package/esm/index.js +3 -0
  44. package/index.d.ts +3 -0
  45. package/index.js +25 -1
  46. package/index.spec.d.ts +1 -1
  47. package/legacy/Stack/Stack.js +5 -0
  48. package/legacy/cssVars/createCssVarsProvider.js +15 -21
  49. package/legacy/cssVars/createCssVarsTheme.js +13 -0
  50. package/legacy/cssVars/createGetCssVar.js +1 -1
  51. package/legacy/cssVars/cssVarsParser.js +4 -1
  52. package/legacy/cssVars/index.js +3 -1
  53. package/legacy/cssVars/prepareCssVars.js +59 -0
  54. package/legacy/index.js +4 -1
  55. package/modern/Stack/Stack.js +5 -0
  56. package/modern/cssVars/createCssVarsProvider.js +8 -16
  57. package/modern/cssVars/createCssVarsTheme.js +16 -0
  58. package/modern/cssVars/createGetCssVar.js +1 -1
  59. package/modern/cssVars/cssVarsParser.js +4 -1
  60. package/modern/cssVars/index.js +3 -1
  61. package/modern/cssVars/prepareCssVars.js +62 -0
  62. package/modern/index.js +4 -1
  63. package/package.json +5 -5
  64. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
@@ -105,6 +105,7 @@ export default function cssVarsParser(theme, options) {
105
105
  } = options || {};
106
106
  const css = {};
107
107
  const vars = {};
108
+ const varsWithDefaults = {};
108
109
  walkObjectDeep(theme, (keys, value, arrayKeys) => {
109
110
  if (typeof value === 'string' || typeof value === 'number') {
110
111
  if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
@@ -114,6 +115,7 @@ export default function cssVarsParser(theme, options) {
114
115
  [cssVar]: getCssValue(keys, value)
115
116
  });
116
117
  assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
118
+ assignNestedKeys(varsWithDefaults, keys, `var(${cssVar}, ${value})`, arrayKeys);
117
119
  }
118
120
  }
119
121
  }, keys => keys[0] === 'vars' // skip 'vars/*' paths
@@ -121,6 +123,7 @@ export default function cssVarsParser(theme, options) {
121
123
 
122
124
  return {
123
125
  css,
124
- vars
126
+ vars,
127
+ varsWithDefaults
125
128
  };
126
129
  }
@@ -1,2 +1,4 @@
1
1
  export { default } from './createCssVarsProvider';
2
- export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
2
+ export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
3
+ export { default as prepareCssVars } from './prepareCssVars';
4
+ export { default as createCssVarsTheme } from './createCssVarsTheme';
@@ -0,0 +1,62 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ const _excluded = ["colorSchemes", "components"],
3
+ _excluded2 = ["light"];
4
+ import { deepmerge } from '@mui/utils';
5
+ import cssVarsParser from './cssVarsParser';
6
+ function prepareCssVars(theme, parserConfig) {
7
+ // @ts-ignore - ignore components do not exist
8
+ const {
9
+ colorSchemes = {}
10
+ } = theme,
11
+ otherTheme = _objectWithoutPropertiesLoose(theme, _excluded);
12
+ const {
13
+ vars: rootVars,
14
+ css: rootCss,
15
+ varsWithDefaults: rootVarsWithDefaults
16
+ } = cssVarsParser(otherTheme, parserConfig);
17
+ let themeVars = rootVarsWithDefaults;
18
+ const colorSchemesMap = {};
19
+ const {
20
+ light
21
+ } = colorSchemes,
22
+ otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, _excluded2);
23
+ Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
24
+ const {
25
+ vars,
26
+ css,
27
+ varsWithDefaults
28
+ } = cssVarsParser(scheme, parserConfig);
29
+ themeVars = deepmerge(themeVars, varsWithDefaults);
30
+ colorSchemesMap[key] = {
31
+ css,
32
+ vars
33
+ };
34
+ });
35
+ if (light) {
36
+ // light color scheme vars should be merged last to set as default
37
+ const {
38
+ css,
39
+ vars,
40
+ varsWithDefaults
41
+ } = cssVarsParser(light, parserConfig);
42
+ themeVars = deepmerge(themeVars, varsWithDefaults);
43
+ colorSchemesMap.light = {
44
+ css,
45
+ vars
46
+ };
47
+ }
48
+ const generateCssVars = colorScheme => {
49
+ if (!colorScheme) {
50
+ return {
51
+ css: rootCss,
52
+ vars: rootVars
53
+ };
54
+ }
55
+ return colorSchemesMap[colorScheme];
56
+ };
57
+ return {
58
+ vars: themeVars,
59
+ generateCssVars
60
+ };
61
+ }
62
+ export default prepareCssVars;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.11.9
2
+ * @mui/system v5.11.12
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -52,6 +52,9 @@ export * from './colorManipulator';
52
52
  export { default as ThemeProvider } from './ThemeProvider';
53
53
  export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
54
54
  export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
55
+ export { default as unstable_cssVarsParser } from './cssVars/cssVarsParser';
56
+ export { default as unstable_prepareCssVars } from './cssVars/prepareCssVars';
57
+ export { default as unstable_createCssVarsTheme } from './cssVars/createCssVarsTheme';
55
58
  export { default as responsivePropType } from './responsivePropType';
56
59
 
57
60
  /** ----------------- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.11.9",
3
+ "version": "5.11.12",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -43,11 +43,11 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@babel/runtime": "^7.20.13",
47
- "@mui/private-theming": "^5.11.9",
48
- "@mui/styled-engine": "^5.11.9",
46
+ "@babel/runtime": "^7.21.0",
47
+ "@mui/private-theming": "^5.11.12",
48
+ "@mui/styled-engine": "^5.11.11",
49
49
  "@mui/types": "^7.2.3",
50
- "@mui/utils": "^5.11.9",
50
+ "@mui/utils": "^5.11.12",
51
51
  "clsx": "^1.2.1",
52
52
  "csstype": "^3.1.1",
53
53
  "prop-types": "^15.8.1"
@@ -1 +1 @@
1
- export {};
1
+ export {};