@mui/styled-engine 6.4.6 → 6.4.9

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,99 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 6.4.9
4
+
5
+ <!-- generated comparing v6.4.8..v6.x -->
6
+
7
+ _Mar 25, 2025_
8
+
9
+ A big thanks to the 7 contributors who made this release possible.
10
+
11
+ ### `@mui/material@6.4.9`
12
+
13
+ - [Autocomplete] Fix when `onHighlightChange` is called (@ZeeshanTamboli) (#45635) @ZeeshanTamboli
14
+ - [StepLabel] Add missing root slot (#45607) @sai6855
15
+ - [Switch] Add slots and slotProps (#45628) @siriwatknp
16
+ - [TextField] Add `root` slot (#45616) @sai6855
17
+ - [Tabs] Fix modifier keys + Left/Right Arrow key from being consumed by tab navigation (#45620) @mushfiqbh
18
+
19
+ ### `@mui/codemon@6.4.9`
20
+
21
+ - Add missing deprecations in deprecations-all file (#45508) @sai6855
22
+
23
+ ### Docs
24
+
25
+ - [docs] Fix grammatical errors in support.md (#45636) @letianpailove
26
+ - [docs] Restore utility component docs from MUI Base to Material UI (#45240) @mapache-salvaje
27
+
28
+ ### Core
29
+
30
+ - [core] Prepare v6 branch for v7 stable release (#45668) @DiegoAndai
31
+
32
+ All contributors of this release in alphabetical order: @DiegoAndai, @letianpailove, @mapache-salvaje, @mushfiqbh, @sai6855, @siriwatknp, @ZeeshanTamboli
33
+
34
+ ## 6.4.8
35
+
36
+ <!-- generated comparing v6.4.7..v6.x -->
37
+
38
+ _Mar 14, 2025_
39
+
40
+ A big thanks to the 9 contributors who made this release possible.
41
+
42
+ ### `@mui/material@6.4.8`
43
+
44
+ - [ListItemText] Add missing `root` slot (#45552) @sai6855
45
+ - [SpeedDial] Add missing `root` slot (#45551) @sai6855
46
+ - [Tooltip] Allow auto placement on tooltip (#45536) @Jtaks
47
+ - [useScrollTrigger] Do nothing if target is null (#45553) @vipierozan99
48
+ - [Accordion] Add missing `root` slot (#45534) @sai6855
49
+ - [AccordionSummary] Add slots and slotProps (#45560) @sai6855
50
+ - [TextareaAutosize] Fix ResizeObserver causing infinite `selectionchange` loop (#45351) (#45498) @mj12albert
51
+
52
+ ### `@mui/styled-engine@6.4.8`
53
+
54
+ - Add `enableCssLayer` prop to StyledEngineProvider (#45563) @siriwatknp
55
+
56
+ ### `@mui/system@6.4.8`
57
+
58
+ - [system] Prevent nested non-vars theme inheritance (#45564) @siriwatknp
59
+
60
+ ### `@mui/utils@6.4.8`
61
+
62
+ - Use correct iri-reference homepage format (#45511) @dahiro
63
+
64
+ ### Core
65
+
66
+ - [test] Fix React 18 tests (#45161) (#45496) @DiegoAndai
67
+
68
+ ### Docs
69
+
70
+ - [Backdrop] Fix component name in migration guide (#45507) @sai6855
71
+ - Fix broken links to MUI X docs (cherry-pick of #45145) (#45481) @mapache-salvaje
72
+ - [examples] Fix the invalid argument to extract examples (#45493) @ovtn
73
+ - Add `overriding-component-structure` doc to Material UI (#45570) @siriwatknp
74
+
75
+ All contributors of this release in alphabetical order: @dahiro, @DiegoAndai, @Jtaks, @mapache-salvaje, @mj12albert, @ovtn, @sai6855, @siriwatknp, @vipierozan99
76
+
77
+ ## 6.4.7
78
+
79
+ <!-- generated comparing v6.4.6..v6.x -->
80
+
81
+ _Mar 5, 2025_
82
+
83
+ A big thanks to the 3 contributors who made this release possible.
84
+
85
+ ### `@mui/material@6.4.7`
86
+
87
+ - [ThemeProvider] Add `storageManager` prop to `ThemeProvider` (@siriwatknp) (#45437) @siriwatknp
88
+ - [Rating] Deprecate \*Props and complete slots, slotProps (#45295) (#45398) @DiegoAndai
89
+ - [Radio] Fix `inputProps` not forwarded (@siriwatknp) (#45475) @siriwatknp
90
+
91
+ ### Core
92
+
93
+ - [blog] React 19 migration for MUI X (#45440) @arminmeh
94
+
95
+ All contributors of this release in alphabetical order: @arminmeh, @DiegoAndai, @siriwatknp
96
+
3
97
  ## 6.4.6
4
98
 
5
99
  <!-- generated comparing v6.4.5..v6.x -->
@@ -11,21 +105,21 @@ A big thanks to the 4 contributors who made this release possible.
11
105
  ### `@mui/material@6.4.6`
12
106
 
13
107
  - [Checkbox] Add slots and slotProps (#45361) @siriwatknp
14
- - [Drawer] Deprecate *Props and complete `slots`, `slotProps` (#45377) @siriwatknp
108
+ - [Drawer] Deprecate \*Props and complete `slots`, `slotProps` (#45377) @siriwatknp
15
109
  - [Grid] Improve Grid2 upgrade experience (#45372) @DiegoAndai
16
110
  - [InputBase] Deprecate composed classes (#45366) @siriwatknp
17
111
  - Fix `slotProps.transition` types (#45367) @siriwatknp
18
112
  - Allow nested theme creation with `vars` (#45368) @siriwatknp
19
113
  - Fix wrong slotProps of DetailsHTMLAttributes types (#45356) @siriwatknp
20
- - [Popover] Deprecate *Props and complete `slots`, `slotProps` (#45337) @siriwatknp
114
+ - [Popover] Deprecate \*Props and complete `slots`, `slotProps` (#45337) @siriwatknp
21
115
  - [Radio] Add slots and slotProps (#45364) @siriwatknp
22
116
  - [Slider] Fix css class selector in migration guide (#45409) @sai6855
23
117
  - [Slider] Fix spacings in .md files (#45393) @sai6855
24
118
  - [Snackbar] Add Slots and SlotProps (#45103) (#45352) @siriwatknp
25
119
  - [SpeedDialAction] Add slots and slotProps (#45365) @siriwatknp
26
120
  - [SwitchBase] Deprecate `inputProps` and complete slots, slotProps (#45338) @siriwatknp
27
- - [Tabs] Deprecate *Props and complete slots, slotProps (#45012) (#45355) @siriwatknp
28
- - [Menu] Deprecate *Props and complete `slots`, `slotProps` (#45369) @siriwatknp
121
+ - [Tabs] Deprecate \*Props and complete slots, slotProps (#45012) (#45355) @siriwatknp
122
+ - [Menu] Deprecate \*Props and complete `slots`, `slotProps` (#45369) @siriwatknp
29
123
 
30
124
  ### Docs
31
125
 
package/README.md CHANGED
@@ -6,6 +6,6 @@ It is used internally in the `@mui/system` package.
6
6
 
7
7
  ## Documentation
8
8
 
9
- <!-- #default-branch-switch -->
9
+ <!-- #host-reference -->
10
10
 
11
- Visit [https://mui.com/material-ui/integrations/styled-components/](https://mui.com/material-ui/integrations/styled-components/) to view the full documentation.
11
+ Visit [https://v6.mui.com/material-ui/integrations/styled-components/](https://v6.mui.com/material-ui/integrations/styled-components/) to view the full documentation.
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
 
3
3
  export interface StyledEngineProviderProps {
4
4
  children?: React.ReactNode;
5
+ enableCssLayer?: boolean;
5
6
  injectFirst?: boolean;
6
7
  }
7
8
 
@@ -6,9 +6,26 @@ import { CacheProvider } from '@emotion/react';
6
6
  import createCache from '@emotion/cache';
7
7
  import { StyleSheet } from '@emotion/sheet';
8
8
 
9
+ // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
10
+ // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
11
+ // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export const TEST_INTERNALS_DO_NOT_USE = {
14
+ /**
15
+ * to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
16
+ *
17
+ * let rule;
18
+ * TEST_INTERNALS_DO_NOT_USE.insert = (...args) => {
19
+ * rule = args[0];
20
+ * };
21
+ *
22
+ * expect(rule).to.equal(...);
23
+ */
24
+ insert: undefined
25
+ };
26
+
9
27
  // We might be able to remove this when this issue is fixed:
10
28
  // https://github.com/emotion-js/emotion/issues/2790
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
29
  const createEmotionCache = (options, CustomSheet) => {
13
30
  const cache = createCache(options);
14
31
 
@@ -23,11 +40,11 @@ const createEmotionCache = (options, CustomSheet) => {
23
40
  });
24
41
  return cache;
25
42
  };
26
- let cache;
43
+ let insertionPoint;
27
44
  if (typeof document === 'object') {
28
45
  // Use `insertionPoint` over `prepend`(deprecated) because it can be controlled for GlobalStyles injection order
29
46
  // For more information, see https://github.com/mui/material-ui/issues/44597
30
- let insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
47
+ insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
31
48
  if (!insertionPoint) {
32
49
  insertionPoint = document.createElement('meta');
33
50
  insertionPoint.setAttribute('name', 'emotion-insertion-point');
@@ -37,30 +54,51 @@ if (typeof document === 'object') {
37
54
  head.prepend(insertionPoint);
38
55
  }
39
56
  }
40
- /**
41
- * This is for client-side apps only.
42
- * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
43
- * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
44
- */
45
- class MyStyleSheet extends StyleSheet {
46
- insert(rule, options) {
47
- if (this.key && this.key.endsWith('global')) {
48
- this.before = insertionPoint;
57
+ }
58
+ function getCache(injectFirst, enableCssLayer) {
59
+ if (injectFirst || enableCssLayer) {
60
+ /**
61
+ * This is for client-side apps only.
62
+ * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
63
+ * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
64
+ */
65
+ class MyStyleSheet extends StyleSheet {
66
+ insert(rule, options) {
67
+ if (TEST_INTERNALS_DO_NOT_USE.insert) {
68
+ return TEST_INTERNALS_DO_NOT_USE.insert(rule, options);
69
+ }
70
+ if (this.key && this.key.endsWith('global')) {
71
+ this.before = insertionPoint;
72
+ }
73
+ return super.insert(rule, options);
49
74
  }
50
- return super.insert(rule, options);
51
75
  }
76
+ const emotionCache = createEmotionCache({
77
+ key: 'css',
78
+ insertionPoint: injectFirst ? insertionPoint : undefined
79
+ }, MyStyleSheet);
80
+ if (enableCssLayer) {
81
+ const prevInsert = emotionCache.insert;
82
+ emotionCache.insert = (...args) => {
83
+ if (!args[1].styles.startsWith('@layer')) {
84
+ // avoid nested @layer
85
+ args[1].styles = `@layer mui {${args[1].styles}}`;
86
+ }
87
+ return prevInsert(...args);
88
+ };
89
+ }
90
+ return emotionCache;
52
91
  }
53
- cache = createEmotionCache({
54
- key: 'css',
55
- insertionPoint
56
- }, MyStyleSheet);
92
+ return undefined;
57
93
  }
58
94
  export default function StyledEngineProvider(props) {
59
95
  const {
60
96
  injectFirst,
97
+ enableCssLayer,
61
98
  children
62
99
  } = props;
63
- return injectFirst && cache ? /*#__PURE__*/_jsx(CacheProvider, {
100
+ const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
101
+ return cache ? /*#__PURE__*/_jsx(CacheProvider, {
64
102
  value: cache,
65
103
  children: children
66
104
  }) : children;
@@ -70,6 +108,11 @@ process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes = {
70
108
  * Your component tree.
71
109
  */
72
110
  children: PropTypes.node,
111
+ /**
112
+ * If `true`, the styles are wrapped in `@layer mui`.
113
+ * Learn more about [Cascade layers](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/Cascade_layers).
114
+ */
115
+ enableCssLayer: PropTypes.bool,
73
116
  /**
74
117
  * By default, the styles are injected last in the <head> element of the page.
75
118
  * As a result, they gain more specificity than any other style sheet.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.4.6
2
+ * @mui/styled-engine v6.4.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -6,9 +6,26 @@ import { CacheProvider } from '@emotion/react';
6
6
  import createCache from '@emotion/cache';
7
7
  import { StyleSheet } from '@emotion/sheet';
8
8
 
9
+ // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
10
+ // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
11
+ // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export const TEST_INTERNALS_DO_NOT_USE = {
14
+ /**
15
+ * to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
16
+ *
17
+ * let rule;
18
+ * TEST_INTERNALS_DO_NOT_USE.insert = (...args) => {
19
+ * rule = args[0];
20
+ * };
21
+ *
22
+ * expect(rule).to.equal(...);
23
+ */
24
+ insert: undefined
25
+ };
26
+
9
27
  // We might be able to remove this when this issue is fixed:
10
28
  // https://github.com/emotion-js/emotion/issues/2790
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
29
  const createEmotionCache = (options, CustomSheet) => {
13
30
  const cache = createCache(options);
14
31
 
@@ -23,11 +40,11 @@ const createEmotionCache = (options, CustomSheet) => {
23
40
  });
24
41
  return cache;
25
42
  };
26
- let cache;
43
+ let insertionPoint;
27
44
  if (typeof document === 'object') {
28
45
  // Use `insertionPoint` over `prepend`(deprecated) because it can be controlled for GlobalStyles injection order
29
46
  // For more information, see https://github.com/mui/material-ui/issues/44597
30
- let insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
47
+ insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
31
48
  if (!insertionPoint) {
32
49
  insertionPoint = document.createElement('meta');
33
50
  insertionPoint.setAttribute('name', 'emotion-insertion-point');
@@ -37,30 +54,51 @@ if (typeof document === 'object') {
37
54
  head.prepend(insertionPoint);
38
55
  }
39
56
  }
40
- /**
41
- * This is for client-side apps only.
42
- * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
43
- * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
44
- */
45
- class MyStyleSheet extends StyleSheet {
46
- insert(rule, options) {
47
- if (this.key && this.key.endsWith('global')) {
48
- this.before = insertionPoint;
57
+ }
58
+ function getCache(injectFirst, enableCssLayer) {
59
+ if (injectFirst || enableCssLayer) {
60
+ /**
61
+ * This is for client-side apps only.
62
+ * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
63
+ * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
64
+ */
65
+ class MyStyleSheet extends StyleSheet {
66
+ insert(rule, options) {
67
+ if (TEST_INTERNALS_DO_NOT_USE.insert) {
68
+ return TEST_INTERNALS_DO_NOT_USE.insert(rule, options);
69
+ }
70
+ if (this.key && this.key.endsWith('global')) {
71
+ this.before = insertionPoint;
72
+ }
73
+ return super.insert(rule, options);
49
74
  }
50
- return super.insert(rule, options);
51
75
  }
76
+ const emotionCache = createEmotionCache({
77
+ key: 'css',
78
+ insertionPoint: injectFirst ? insertionPoint : undefined
79
+ }, MyStyleSheet);
80
+ if (enableCssLayer) {
81
+ const prevInsert = emotionCache.insert;
82
+ emotionCache.insert = (...args) => {
83
+ if (!args[1].styles.startsWith('@layer')) {
84
+ // avoid nested @layer
85
+ args[1].styles = `@layer mui {${args[1].styles}}`;
86
+ }
87
+ return prevInsert(...args);
88
+ };
89
+ }
90
+ return emotionCache;
52
91
  }
53
- cache = createEmotionCache({
54
- key: 'css',
55
- insertionPoint
56
- }, MyStyleSheet);
92
+ return undefined;
57
93
  }
58
94
  export default function StyledEngineProvider(props) {
59
95
  const {
60
96
  injectFirst,
97
+ enableCssLayer,
61
98
  children
62
99
  } = props;
63
- return injectFirst && cache ? /*#__PURE__*/_jsx(CacheProvider, {
100
+ const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
101
+ return cache ? /*#__PURE__*/_jsx(CacheProvider, {
64
102
  value: cache,
65
103
  children: children
66
104
  }) : children;
@@ -70,6 +108,11 @@ process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes = {
70
108
  * Your component tree.
71
109
  */
72
110
  children: PropTypes.node,
111
+ /**
112
+ * If `true`, the styles are wrapped in `@layer mui`.
113
+ * Learn more about [Cascade layers](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/Cascade_layers).
114
+ */
115
+ enableCssLayer: PropTypes.bool,
73
116
  /**
74
117
  * By default, the styles are injected last in the <head> element of the page.
75
118
  * As a result, they gain more specificity than any other style sheet.
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.4.6
2
+ * @mui/styled-engine v6.4.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -6,6 +6,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
+ exports.TEST_INTERNALS_DO_NOT_USE = void 0;
9
10
  exports.default = StyledEngineProvider;
10
11
  var React = _interopRequireWildcard(require("react"));
11
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -13,6 +14,23 @@ var _react2 = require("@emotion/react");
13
14
  var _cache = _interopRequireDefault(require("@emotion/cache"));
14
15
  var _sheet = require("@emotion/sheet");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
17
+ // Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
18
+ // We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
19
+ // Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
20
+ const TEST_INTERNALS_DO_NOT_USE = exports.TEST_INTERNALS_DO_NOT_USE = {
21
+ /**
22
+ * to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
23
+ *
24
+ * let rule;
25
+ * TEST_INTERNALS_DO_NOT_USE.insert = (...args) => {
26
+ * rule = args[0];
27
+ * };
28
+ *
29
+ * expect(rule).to.equal(...);
30
+ */
31
+ insert: undefined
32
+ };
33
+
16
34
  // We might be able to remove this when this issue is fixed:
17
35
  // https://github.com/emotion-js/emotion/issues/2790
18
36
  const createEmotionCache = (options, CustomSheet) => {
@@ -29,11 +47,11 @@ const createEmotionCache = (options, CustomSheet) => {
29
47
  });
30
48
  return cache;
31
49
  };
32
- let cache;
50
+ let insertionPoint;
33
51
  if (typeof document === 'object') {
34
52
  // Use `insertionPoint` over `prepend`(deprecated) because it can be controlled for GlobalStyles injection order
35
53
  // For more information, see https://github.com/mui/material-ui/issues/44597
36
- let insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
54
+ insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
37
55
  if (!insertionPoint) {
38
56
  insertionPoint = document.createElement('meta');
39
57
  insertionPoint.setAttribute('name', 'emotion-insertion-point');
@@ -43,30 +61,51 @@ if (typeof document === 'object') {
43
61
  head.prepend(insertionPoint);
44
62
  }
45
63
  }
46
- /**
47
- * This is for client-side apps only.
48
- * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
49
- * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
50
- */
51
- class MyStyleSheet extends _sheet.StyleSheet {
52
- insert(rule, options) {
53
- if (this.key && this.key.endsWith('global')) {
54
- this.before = insertionPoint;
64
+ }
65
+ function getCache(injectFirst, enableCssLayer) {
66
+ if (injectFirst || enableCssLayer) {
67
+ /**
68
+ * This is for client-side apps only.
69
+ * A custom sheet is required to make the GlobalStyles API injected above the insertion point.
70
+ * This is because the [sheet](https://github.com/emotion-js/emotion/blob/main/packages/react/src/global.js#L94-L99) does not consume the options.
71
+ */
72
+ class MyStyleSheet extends _sheet.StyleSheet {
73
+ insert(rule, options) {
74
+ if (TEST_INTERNALS_DO_NOT_USE.insert) {
75
+ return TEST_INTERNALS_DO_NOT_USE.insert(rule, options);
76
+ }
77
+ if (this.key && this.key.endsWith('global')) {
78
+ this.before = insertionPoint;
79
+ }
80
+ return super.insert(rule, options);
55
81
  }
56
- return super.insert(rule, options);
57
82
  }
83
+ const emotionCache = createEmotionCache({
84
+ key: 'css',
85
+ insertionPoint: injectFirst ? insertionPoint : undefined
86
+ }, MyStyleSheet);
87
+ if (enableCssLayer) {
88
+ const prevInsert = emotionCache.insert;
89
+ emotionCache.insert = (...args) => {
90
+ if (!args[1].styles.startsWith('@layer')) {
91
+ // avoid nested @layer
92
+ args[1].styles = `@layer mui {${args[1].styles}}`;
93
+ }
94
+ return prevInsert(...args);
95
+ };
96
+ }
97
+ return emotionCache;
58
98
  }
59
- cache = createEmotionCache({
60
- key: 'css',
61
- insertionPoint
62
- }, MyStyleSheet);
99
+ return undefined;
63
100
  }
64
101
  function StyledEngineProvider(props) {
65
102
  const {
66
103
  injectFirst,
104
+ enableCssLayer,
67
105
  children
68
106
  } = props;
69
- return injectFirst && cache ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.CacheProvider, {
107
+ const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
108
+ return cache ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.CacheProvider, {
70
109
  value: cache,
71
110
  children: children
72
111
  }) : children;
@@ -76,6 +115,11 @@ process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes = {
76
115
  * Your component tree.
77
116
  */
78
117
  children: _propTypes.default.node,
118
+ /**
119
+ * If `true`, the styles are wrapped in `@layer mui`.
120
+ * Learn more about [Cascade layers](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/Cascade_layers).
121
+ */
122
+ enableCssLayer: _propTypes.default.bool,
79
123
  /**
80
124
  * By default, the styles are injected last in the <head> element of the page.
81
125
  * As a result, they gain more specificity than any other style sheet.
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.4.6
2
+ * @mui/styled-engine v6.4.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine",
3
- "version": "6.4.6",
3
+ "version": "6.4.9",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "styled() API wrapper package for emotion.",