@mui/system 9.0.0-alpha.3 → 9.0.0-beta.0

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 (48) hide show
  1. package/Box/Box.d.mts +1 -1
  2. package/Box/Box.d.ts +1 -1
  3. package/CHANGELOG.md +224 -3
  4. package/Stack/StackProps.d.mts +1 -2
  5. package/Stack/StackProps.d.ts +1 -2
  6. package/Stack/createStack.js +1 -3
  7. package/Stack/createStack.mjs +1 -3
  8. package/breakpoints/breakpoints.d.mts +4 -1
  9. package/breakpoints/breakpoints.d.ts +4 -1
  10. package/breakpoints/breakpoints.js +90 -49
  11. package/breakpoints/breakpoints.mjs +86 -49
  12. package/compose/compose.js +6 -6
  13. package/compose/compose.mjs +6 -6
  14. package/createBox/createBox.js +2 -2
  15. package/createBox/createBox.mjs +2 -2
  16. package/createBreakpoints/createBreakpoints.d.mts +5 -0
  17. package/createBreakpoints/createBreakpoints.d.ts +5 -0
  18. package/createBreakpoints/createBreakpoints.js +5 -0
  19. package/createBreakpoints/createBreakpoints.mjs +5 -0
  20. package/createStyled/createStyled.js +2 -8
  21. package/createStyled/createStyled.mjs +1 -7
  22. package/createTheme/createTheme.js +1 -0
  23. package/createTheme/createTheme.mjs +1 -0
  24. package/cssContainerQueries/cssContainerQueries.d.mts +1 -0
  25. package/cssContainerQueries/cssContainerQueries.d.ts +1 -0
  26. package/cssContainerQueries/cssContainerQueries.js +27 -14
  27. package/cssContainerQueries/cssContainerQueries.mjs +27 -14
  28. package/cssVars/createCssVarsTheme.js +1 -0
  29. package/cssVars/createCssVarsTheme.mjs +1 -0
  30. package/index.js +1 -1
  31. package/index.mjs +1 -1
  32. package/merge/merge.js +4 -3
  33. package/merge/merge.mjs +4 -3
  34. package/package.json +6 -6
  35. package/spacing/spacing.js +45 -45
  36. package/spacing/spacing.mjs +47 -45
  37. package/style/index.d.mts +1 -0
  38. package/style/index.d.ts +1 -0
  39. package/style/index.js +9 -1
  40. package/style/index.mjs +1 -0
  41. package/style/style.d.mts +36 -7
  42. package/style/style.d.ts +36 -7
  43. package/style/style.js +85 -34
  44. package/style/style.mjs +84 -34
  45. package/styleFunctionSx/styleFunctionSx.js +95 -100
  46. package/styleFunctionSx/styleFunctionSx.mjs +98 -102
  47. package/version/index.js +2 -2
  48. package/version/index.mjs +2 -2
package/style/style.mjs CHANGED
@@ -1,40 +1,99 @@
1
1
  import capitalize from '@mui/utils/capitalize';
2
2
  import responsivePropType from "../responsivePropType/index.mjs";
3
3
  import { handleBreakpoints } from "../breakpoints/index.mjs";
4
- export function getPath(obj, path, checkVars = true) {
5
- if (!path || typeof path !== 'string') {
6
- return null;
4
+ /**
5
+ * TODO(v7): Keep either this one or `getStyleValue2`
6
+ */
7
+ export function getStyleValue(themeMapping, transform, valueFinal, userValue = valueFinal) {
8
+ let value;
9
+ if (typeof themeMapping === 'function') {
10
+ value = themeMapping(valueFinal);
11
+ } else if (Array.isArray(themeMapping)) {
12
+ value = themeMapping[valueFinal] || userValue;
13
+ } else if (typeof valueFinal === 'string') {
14
+ value = getPath(themeMapping, valueFinal) || userValue;
15
+ } else {
16
+ value = userValue;
7
17
  }
8
-
9
- // Check if CSS variables are used
10
- if (obj && obj.vars && checkVars) {
11
- const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
12
- if (val != null) {
13
- return val;
14
- }
18
+ if (transform) {
19
+ value = transform(value, userValue, themeMapping);
15
20
  }
16
- return path.split('.').reduce((acc, item) => {
17
- if (acc && acc[item] != null) {
18
- return acc[item];
19
- }
20
- return null;
21
- }, obj);
21
+ return value;
22
22
  }
23
- export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
23
+
24
+ /**
25
+ * HACK: The `alternateProp` logic is there because our theme looks like this:
26
+ * {
27
+ * typography: {
28
+ * fontFamily: 'comic sans',
29
+ * fontFamilyCode: 'courrier new',
30
+ * }
31
+ * }
32
+ * And we support targetting:
33
+ * - `typography.fontFamily` with `sx={{ fontFamily: 'default' }}`
34
+ * - `typography.fontFamilyCode` with `sx={{ fontFamily: 'code' }}`
35
+ *
36
+ * TODO(v7): Refactor our theme to look like this and remove the horrendous logic:
37
+ * {
38
+ * typography: {
39
+ * fontFamily: {
40
+ * default: 'comic sans',
41
+ * code: 'courrier new',
42
+ * }
43
+ * }
44
+ * }
45
+ */
46
+ export function getStyleValue2(themeMapping, transform, userValue, alternateProp) {
24
47
  let value;
25
48
  if (typeof themeMapping === 'function') {
26
- value = themeMapping(propValueFinal);
49
+ value = themeMapping(userValue);
27
50
  } else if (Array.isArray(themeMapping)) {
28
- value = themeMapping[propValueFinal] || userValue;
51
+ value = themeMapping[userValue] || userValue;
52
+ } else if (typeof userValue === 'string') {
53
+ value = getPath(themeMapping, userValue, true, alternateProp) || userValue;
29
54
  } else {
30
- value = getPath(themeMapping, propValueFinal) || userValue;
55
+ value = userValue;
31
56
  }
32
57
  if (transform) {
33
58
  value = transform(value, userValue, themeMapping);
34
59
  }
35
60
  return value;
36
61
  }
37
- function style(options) {
62
+ export function getPath(obj, pathInput, checkVars = true, alternateProp = undefined) {
63
+ if (!obj || !pathInput) {
64
+ return null;
65
+ }
66
+ const path = pathInput.split('.');
67
+
68
+ // Check if CSS variables are used
69
+ if (obj.vars && checkVars) {
70
+ const val = getPathImpl(obj.vars, path, alternateProp);
71
+ if (val != null) {
72
+ return val;
73
+ }
74
+ }
75
+ return getPathImpl(obj, path, alternateProp);
76
+ }
77
+ function getPathImpl(object, path, alternateProp = undefined) {
78
+ let lastResult = undefined;
79
+ let result = object;
80
+ let index = 0;
81
+ while (index < path.length) {
82
+ if (result === null || result === undefined) {
83
+ return result;
84
+ }
85
+ lastResult = result;
86
+ result = result[path[index]];
87
+ index += 1;
88
+ }
89
+ if (alternateProp && result === undefined) {
90
+ const lastKey = path[path.length - 1];
91
+ const alternateKey = `${alternateProp}${lastKey === 'default' ? '' : capitalize(lastKey)}`;
92
+ return lastResult?.[alternateKey];
93
+ }
94
+ return result;
95
+ }
96
+ export default function style(options) {
38
97
  const {
39
98
  prop,
40
99
  cssProperty = options.prop,
@@ -42,7 +101,6 @@ function style(options) {
42
101
  transform
43
102
  } = options;
44
103
 
45
- // false positive
46
104
  // eslint-disable-next-line react/function-component-definition
47
105
  const fn = props => {
48
106
  if (props[prop] == null) {
@@ -51,16 +109,9 @@ function style(options) {
51
109
  const propValue = props[prop];
52
110
  const theme = props.theme;
53
111
  const themeMapping = getPath(theme, themeKey) || {};
54
- const styleFromPropValue = propValueFinal => {
55
- let value = getStyleValue(themeMapping, transform, propValueFinal);
56
- if (propValueFinal === value && typeof propValueFinal === 'string') {
57
- // Haven't found value
58
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
59
- }
60
- if (cssProperty === false) {
61
- return value;
62
- }
63
- return {
112
+ const styleFromPropValue = valueFinal => {
113
+ const value = getStyleValue2(themeMapping, transform, valueFinal, prop);
114
+ return cssProperty === false ? value : {
64
115
  [cssProperty]: value
65
116
  };
66
117
  };
@@ -71,5 +122,4 @@ function style(options) {
71
122
  } : {};
72
123
  fn.filterProps = [prop];
73
124
  return fn;
74
- }
75
- export default style;
125
+ }
@@ -6,86 +6,35 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  exports.unstable_createStyleFunctionSx = unstable_createStyleFunctionSx;
9
- var _capitalize = _interopRequireDefault(require("@mui/utils/capitalize"));
10
- var _merge = _interopRequireDefault(require("../merge"));
9
+ var _fastDeepAssign = _interopRequireDefault(require("@mui/utils/fastDeepAssign"));
11
10
  var _style = require("../style");
12
11
  var _breakpoints = require("../breakpoints");
13
12
  var _cssContainerQueries = require("../cssContainerQueries");
14
13
  var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
15
- function objectsHaveSameKeys(...objects) {
16
- const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
17
- const union = new Set(allKeys);
18
- return objects.every(object => union.size === Object.keys(object).length);
19
- }
20
- function callIfFn(maybeFn, arg) {
21
- return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
22
- }
14
+ /* eslint-disable guard-for-in */
15
+
16
+ const EMPTY_THEME = {};
23
17
 
24
18
  // eslint-disable-next-line @typescript-eslint/naming-convention
25
19
  function unstable_createStyleFunctionSx() {
26
- function getThemeValue(prop, val, theme, config) {
27
- const props = {
28
- [prop]: val,
29
- theme
30
- };
31
- const options = config[prop];
32
- if (!options) {
33
- return {
34
- [prop]: val
35
- };
36
- }
37
- const {
38
- cssProperty = prop,
39
- themeKey,
40
- transform,
41
- style
42
- } = options;
43
- if (val == null) {
20
+ function styleFunctionSx(props) {
21
+ if (!props.sx) {
44
22
  return null;
45
23
  }
46
-
47
- // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
48
- if (themeKey === 'typography' && val === 'inherit') {
49
- return {
50
- [prop]: val
51
- };
52
- }
53
- const themeMapping = (0, _style.getPath)(theme, themeKey) || {};
54
- if (style) {
55
- return style(props);
56
- }
57
- const styleFromPropValue = propValueFinal => {
58
- let value = (0, _style.getStyleValue)(themeMapping, transform, propValueFinal);
59
- if (propValueFinal === value && typeof propValueFinal === 'string') {
60
- // Haven't found value
61
- value = (0, _style.getStyleValue)(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : (0, _capitalize.default)(propValueFinal)}`, propValueFinal);
62
- }
63
- if (cssProperty === false) {
64
- return value;
65
- }
66
- return {
67
- [cssProperty]: value
68
- };
69
- };
70
- return (0, _breakpoints.handleBreakpoints)(props, val, styleFromPropValue);
71
- }
72
- function styleFunctionSx(props) {
73
24
  const {
74
25
  sx,
75
- theme = {},
26
+ theme = EMPTY_THEME,
76
27
  nested
77
- } = props || {};
78
- if (!sx) {
79
- return null; // Emotion & styled-components will neglect null
80
- }
28
+ } = props;
81
29
  const config = theme.unstable_sxConfig ?? _defaultSxConfig.default;
82
30
 
83
- /*
84
- * Receive `sxInput` as object or callback
85
- * and then recursively check keys & values to create media query object styles.
86
- * (the result will be used in `styled`)
87
- */
88
- function traverse(sxInput) {
31
+ // Pass argument without loop allocations
32
+ const wrapper = {
33
+ sx: null,
34
+ theme,
35
+ nested: true
36
+ };
37
+ function process(sxInput) {
89
38
  let sxObject = sxInput;
90
39
  if (typeof sxInput === 'function') {
91
40
  sxObject = sxInput(theme);
@@ -96,47 +45,93 @@ function unstable_createStyleFunctionSx() {
96
45
  if (!sxObject) {
97
46
  return null;
98
47
  }
99
- const emptyBreakpoints = (0, _breakpoints.createEmptyBreakpointObject)(theme.breakpoints);
100
- const breakpointsKeys = Object.keys(emptyBreakpoints);
101
- let css = emptyBreakpoints;
102
- Object.keys(sxObject).forEach(styleKey => {
48
+ const breakpoints = theme.breakpoints ?? _breakpoints.DEFAULT_BREAKPOINTS;
49
+ const css = (0, _breakpoints.createEmptyBreakpointObject)(breakpoints);
50
+ for (const styleKey in sxObject) {
103
51
  const value = callIfFn(sxObject[styleKey], theme);
104
- if (value !== null && value !== undefined) {
105
- if (typeof value === 'object') {
106
- if (config[styleKey]) {
107
- css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme, config));
108
- } else {
109
- const breakpointsValues = (0, _breakpoints.handleBreakpoints)({
110
- theme
111
- }, value, x => ({
112
- [styleKey]: x
113
- }));
114
- if (objectsHaveSameKeys(breakpointsValues, value)) {
115
- css[styleKey] = styleFunctionSx({
116
- sx: value,
117
- theme,
118
- nested: true
119
- });
120
- } else {
121
- css = (0, _merge.default)(css, breakpointsValues);
122
- }
123
- }
124
- } else {
125
- css = (0, _merge.default)(css, getThemeValue(styleKey, value, theme, config));
126
- }
52
+ if (value === null || value === undefined) {
53
+ continue;
54
+ }
55
+ if (typeof value !== 'object') {
56
+ setThemeValue(css, styleKey, value, theme, config);
57
+ continue;
58
+ }
59
+ if (config[styleKey]) {
60
+ setThemeValue(css, styleKey, value, theme, config);
61
+ continue;
62
+ }
63
+ if ((0, _breakpoints.hasBreakpoint)(breakpoints, value)) {
64
+ (0, _breakpoints.iterateBreakpoints)(css, props.theme, value, (mediaKey, finalValue) => {
65
+ css[mediaKey][styleKey] = finalValue;
66
+ });
67
+ } else {
68
+ wrapper.sx = value;
69
+ css[styleKey] = styleFunctionSx(wrapper);
127
70
  }
128
- });
71
+ }
129
72
  if (!nested && theme.modularCssLayers) {
130
73
  return {
131
- '@layer sx': (0, _cssContainerQueries.sortContainerQueries)(theme, (0, _breakpoints.removeUnusedBreakpoints)(breakpointsKeys, css))
74
+ '@layer sx': (0, _cssContainerQueries.sortContainerQueries)(theme, (0, _breakpoints.removeUnusedBreakpoints)(breakpoints, css))
132
75
  };
133
76
  }
134
- return (0, _cssContainerQueries.sortContainerQueries)(theme, (0, _breakpoints.removeUnusedBreakpoints)(breakpointsKeys, css));
77
+ return (0, _cssContainerQueries.sortContainerQueries)(theme, (0, _breakpoints.removeUnusedBreakpoints)(breakpoints, css));
135
78
  }
136
- return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
79
+ return Array.isArray(sx) ? sx.map(process) : process(sx);
137
80
  }
81
+ styleFunctionSx.filterProps = ['sx'];
138
82
  return styleFunctionSx;
139
83
  }
140
- const styleFunctionSx = unstable_createStyleFunctionSx();
141
- styleFunctionSx.filterProps = ['sx'];
142
- var _default = exports.default = styleFunctionSx;
84
+ var _default = exports.default = unstable_createStyleFunctionSx();
85
+ function setThemeValue(css, prop, value, theme, config) {
86
+ const options = config[prop];
87
+ if (!options) {
88
+ css[prop] = value;
89
+ return;
90
+ }
91
+ if (value == null) {
92
+ return;
93
+ }
94
+ const {
95
+ themeKey
96
+ } = options;
97
+ // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
98
+ if (themeKey === 'typography' && value === 'inherit') {
99
+ css[prop] = value;
100
+ return;
101
+ }
102
+ const {
103
+ style
104
+ } = options;
105
+ if (style) {
106
+ (0, _fastDeepAssign.default)(css, style({
107
+ [prop]: value,
108
+ theme
109
+ }));
110
+ return;
111
+ }
112
+ const {
113
+ cssProperty = prop,
114
+ transform
115
+ } = options;
116
+ const themeMapping = (0, _style.getPath)(theme, themeKey);
117
+ (0, _breakpoints.iterateBreakpoints)(css, theme, value, (mediaKey, valueFinal) => {
118
+ const finalValue = (0, _style.getStyleValue2)(themeMapping, transform, valueFinal, prop);
119
+ if (cssProperty === false) {
120
+ if (mediaKey) {
121
+ css[mediaKey] = finalValue;
122
+ } else {
123
+ (0, _fastDeepAssign.default)(css, finalValue);
124
+ }
125
+ } else {
126
+ // eslint-disable-next-line no-lonely-if
127
+ if (mediaKey) {
128
+ css[mediaKey][cssProperty] = finalValue;
129
+ } else {
130
+ css[cssProperty] = finalValue;
131
+ }
132
+ }
133
+ });
134
+ }
135
+ function callIfFn(maybeFn, arg) {
136
+ return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
137
+ }
@@ -1,83 +1,33 @@
1
- import capitalize from '@mui/utils/capitalize';
2
- import merge from "../merge/index.mjs";
3
- import { getPath, getStyleValue as getValue } from "../style/index.mjs";
4
- import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from "../breakpoints/index.mjs";
1
+ import merge from '@mui/utils/fastDeepAssign';
2
+ import { getPath, getStyleValue2 } from "../style/index.mjs";
3
+ import { hasBreakpoint, iterateBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints, DEFAULT_BREAKPOINTS } from "../breakpoints/index.mjs";
5
4
  import { sortContainerQueries } from "../cssContainerQueries/index.mjs";
6
5
  import defaultSxConfig from "./defaultSxConfig.mjs";
7
- function objectsHaveSameKeys(...objects) {
8
- const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
9
- const union = new Set(allKeys);
10
- return objects.every(object => union.size === Object.keys(object).length);
11
- }
12
- function callIfFn(maybeFn, arg) {
13
- return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
14
- }
6
+
7
+ /* eslint-disable guard-for-in */
8
+
9
+ const EMPTY_THEME = {};
15
10
 
16
11
  // eslint-disable-next-line @typescript-eslint/naming-convention
17
12
  export function unstable_createStyleFunctionSx() {
18
- function getThemeValue(prop, val, theme, config) {
19
- const props = {
20
- [prop]: val,
21
- theme
22
- };
23
- const options = config[prop];
24
- if (!options) {
25
- return {
26
- [prop]: val
27
- };
28
- }
29
- const {
30
- cssProperty = prop,
31
- themeKey,
32
- transform,
33
- style
34
- } = options;
35
- if (val == null) {
13
+ function styleFunctionSx(props) {
14
+ if (!props.sx) {
36
15
  return null;
37
16
  }
38
-
39
- // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
40
- if (themeKey === 'typography' && val === 'inherit') {
41
- return {
42
- [prop]: val
43
- };
44
- }
45
- const themeMapping = getPath(theme, themeKey) || {};
46
- if (style) {
47
- return style(props);
48
- }
49
- const styleFromPropValue = propValueFinal => {
50
- let value = getValue(themeMapping, transform, propValueFinal);
51
- if (propValueFinal === value && typeof propValueFinal === 'string') {
52
- // Haven't found value
53
- value = getValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
54
- }
55
- if (cssProperty === false) {
56
- return value;
57
- }
58
- return {
59
- [cssProperty]: value
60
- };
61
- };
62
- return handleBreakpoints(props, val, styleFromPropValue);
63
- }
64
- function styleFunctionSx(props) {
65
17
  const {
66
18
  sx,
67
- theme = {},
19
+ theme = EMPTY_THEME,
68
20
  nested
69
- } = props || {};
70
- if (!sx) {
71
- return null; // Emotion & styled-components will neglect null
72
- }
21
+ } = props;
73
22
  const config = theme.unstable_sxConfig ?? defaultSxConfig;
74
23
 
75
- /*
76
- * Receive `sxInput` as object or callback
77
- * and then recursively check keys & values to create media query object styles.
78
- * (the result will be used in `styled`)
79
- */
80
- function traverse(sxInput) {
24
+ // Pass argument without loop allocations
25
+ const wrapper = {
26
+ sx: null,
27
+ theme,
28
+ nested: true
29
+ };
30
+ function process(sxInput) {
81
31
  let sxObject = sxInput;
82
32
  if (typeof sxInput === 'function') {
83
33
  sxObject = sxInput(theme);
@@ -88,47 +38,93 @@ export function unstable_createStyleFunctionSx() {
88
38
  if (!sxObject) {
89
39
  return null;
90
40
  }
91
- const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
92
- const breakpointsKeys = Object.keys(emptyBreakpoints);
93
- let css = emptyBreakpoints;
94
- Object.keys(sxObject).forEach(styleKey => {
41
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
42
+ const css = createEmptyBreakpointObject(breakpoints);
43
+ for (const styleKey in sxObject) {
95
44
  const value = callIfFn(sxObject[styleKey], theme);
96
- if (value !== null && value !== undefined) {
97
- if (typeof value === 'object') {
98
- if (config[styleKey]) {
99
- css = merge(css, getThemeValue(styleKey, value, theme, config));
100
- } else {
101
- const breakpointsValues = handleBreakpoints({
102
- theme
103
- }, value, x => ({
104
- [styleKey]: x
105
- }));
106
- if (objectsHaveSameKeys(breakpointsValues, value)) {
107
- css[styleKey] = styleFunctionSx({
108
- sx: value,
109
- theme,
110
- nested: true
111
- });
112
- } else {
113
- css = merge(css, breakpointsValues);
114
- }
115
- }
116
- } else {
117
- css = merge(css, getThemeValue(styleKey, value, theme, config));
118
- }
45
+ if (value === null || value === undefined) {
46
+ continue;
47
+ }
48
+ if (typeof value !== 'object') {
49
+ setThemeValue(css, styleKey, value, theme, config);
50
+ continue;
51
+ }
52
+ if (config[styleKey]) {
53
+ setThemeValue(css, styleKey, value, theme, config);
54
+ continue;
119
55
  }
120
- });
56
+ if (hasBreakpoint(breakpoints, value)) {
57
+ iterateBreakpoints(css, props.theme, value, (mediaKey, finalValue) => {
58
+ css[mediaKey][styleKey] = finalValue;
59
+ });
60
+ } else {
61
+ wrapper.sx = value;
62
+ css[styleKey] = styleFunctionSx(wrapper);
63
+ }
64
+ }
121
65
  if (!nested && theme.modularCssLayers) {
122
66
  return {
123
- '@layer sx': sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css))
67
+ '@layer sx': sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css))
124
68
  };
125
69
  }
126
- return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css));
70
+ return sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css));
127
71
  }
128
- return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
72
+ return Array.isArray(sx) ? sx.map(process) : process(sx);
129
73
  }
74
+ styleFunctionSx.filterProps = ['sx'];
130
75
  return styleFunctionSx;
131
76
  }
132
- const styleFunctionSx = unstable_createStyleFunctionSx();
133
- styleFunctionSx.filterProps = ['sx'];
134
- export default styleFunctionSx;
77
+ export default unstable_createStyleFunctionSx();
78
+ function setThemeValue(css, prop, value, theme, config) {
79
+ const options = config[prop];
80
+ if (!options) {
81
+ css[prop] = value;
82
+ return;
83
+ }
84
+ if (value == null) {
85
+ return;
86
+ }
87
+ const {
88
+ themeKey
89
+ } = options;
90
+ // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
91
+ if (themeKey === 'typography' && value === 'inherit') {
92
+ css[prop] = value;
93
+ return;
94
+ }
95
+ const {
96
+ style
97
+ } = options;
98
+ if (style) {
99
+ merge(css, style({
100
+ [prop]: value,
101
+ theme
102
+ }));
103
+ return;
104
+ }
105
+ const {
106
+ cssProperty = prop,
107
+ transform
108
+ } = options;
109
+ const themeMapping = getPath(theme, themeKey);
110
+ iterateBreakpoints(css, theme, value, (mediaKey, valueFinal) => {
111
+ const finalValue = getStyleValue2(themeMapping, transform, valueFinal, prop);
112
+ if (cssProperty === false) {
113
+ if (mediaKey) {
114
+ css[mediaKey] = finalValue;
115
+ } else {
116
+ merge(css, finalValue);
117
+ }
118
+ } else {
119
+ // eslint-disable-next-line no-lonely-if
120
+ if (mediaKey) {
121
+ css[mediaKey][cssProperty] = finalValue;
122
+ } else {
123
+ css[cssProperty] = finalValue;
124
+ }
125
+ }
126
+ });
127
+ }
128
+ function callIfFn(maybeFn, arg) {
129
+ return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
130
+ }
package/version/index.js CHANGED
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
7
- const version = exports.version = "9.0.0-alpha.3";
7
+ const version = exports.version = "9.0.0-beta.0";
8
8
  const major = exports.major = Number("9");
9
9
  const minor = exports.minor = Number("0");
10
10
  const patch = exports.patch = Number("0");
11
- const prerelease = exports.prerelease = "alpha.3";
11
+ const prerelease = exports.prerelease = "beta.0";
12
12
  var _default = exports.default = version;
package/version/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "9.0.0-alpha.3";
1
+ export const version = "9.0.0-beta.0";
2
2
  export const major = Number("9");
3
3
  export const minor = Number("0");
4
4
  export const patch = Number("0");
5
- export const prerelease = "alpha.3";
5
+ export const prerelease = "beta.0";
6
6
  export default version;