@mui/styled-engine 6.0.1 → 6.1.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.
@@ -4,13 +4,43 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { CacheProvider } from '@emotion/react';
6
6
  import createCache from '@emotion/cache';
7
+ import { StyleSheet } from '@emotion/sheet';
8
+
9
+ // We might be able to remove this when this issue is fixed:
10
+ // https://github.com/emotion-js/emotion/issues/2790
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const createEmotionCache = options => {
13
+ const cache = createCache(options);
14
+
15
+ /**
16
+ * This is for client-side apps only.
17
+ * A custom sheet is required to make the GlobalStyles API work with `prepend: true`.
18
+ * 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.
19
+ */
20
+ class MyStyleSheet extends StyleSheet {
21
+ constructor(args) {
22
+ super(args);
23
+ this.prepend = cache.sheet.prepend;
24
+ }
25
+ }
26
+
27
+ // Do the same as https://github.com/emotion-js/emotion/blob/main/packages/cache/src/index.js#L238-L245
28
+ cache.sheet = new MyStyleSheet({
29
+ key: cache.key,
30
+ nonce: cache.sheet.nonce,
31
+ container: cache.sheet.container,
32
+ speedy: cache.sheet.isSpeedy,
33
+ prepend: cache.sheet.prepend,
34
+ insertionPoint: cache.sheet.insertionPoint
35
+ });
36
+ return cache;
37
+ };
7
38
 
8
39
  // prepend: true moves MUI styles to the top of the <head> so they're loaded first.
9
40
  // It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
41
  let cache;
12
42
  if (typeof document === 'object') {
13
- cache = createCache({
43
+ cache = createEmotionCache({
14
44
  key: 'css',
15
45
  prepend: true
16
46
  });
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.0.1
2
+ * @mui/styled-engine v6.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -4,13 +4,43 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { CacheProvider } from '@emotion/react';
6
6
  import createCache from '@emotion/cache';
7
+ import { StyleSheet } from '@emotion/sheet';
8
+
9
+ // We might be able to remove this when this issue is fixed:
10
+ // https://github.com/emotion-js/emotion/issues/2790
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const createEmotionCache = options => {
13
+ const cache = createCache(options);
14
+
15
+ /**
16
+ * This is for client-side apps only.
17
+ * A custom sheet is required to make the GlobalStyles API work with `prepend: true`.
18
+ * 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.
19
+ */
20
+ class MyStyleSheet extends StyleSheet {
21
+ constructor(args) {
22
+ super(args);
23
+ this.prepend = cache.sheet.prepend;
24
+ }
25
+ }
26
+
27
+ // Do the same as https://github.com/emotion-js/emotion/blob/main/packages/cache/src/index.js#L238-L245
28
+ cache.sheet = new MyStyleSheet({
29
+ key: cache.key,
30
+ nonce: cache.sheet.nonce,
31
+ container: cache.sheet.container,
32
+ speedy: cache.sheet.isSpeedy,
33
+ prepend: cache.sheet.prepend,
34
+ insertionPoint: cache.sheet.insertionPoint
35
+ });
36
+ return cache;
37
+ };
7
38
 
8
39
  // prepend: true moves MUI styles to the top of the <head> so they're loaded first.
9
40
  // It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
41
  let cache;
12
42
  if (typeof document === 'object') {
13
- cache = createCache({
43
+ cache = createEmotionCache({
14
44
  key: 'css',
15
45
  prepend: true
16
46
  });
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.0.1
2
+ * @mui/styled-engine v6.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,12 +11,42 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _cache = _interopRequireDefault(require("@emotion/cache"));
14
+ var _sheet = require("@emotion/sheet");
14
15
  var _jsxRuntime = require("react/jsx-runtime");
16
+ // We might be able to remove this when this issue is fixed:
17
+ // https://github.com/emotion-js/emotion/issues/2790
18
+ const createEmotionCache = options => {
19
+ const cache = (0, _cache.default)(options);
20
+
21
+ /**
22
+ * This is for client-side apps only.
23
+ * A custom sheet is required to make the GlobalStyles API work with `prepend: true`.
24
+ * 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.
25
+ */
26
+ class MyStyleSheet extends _sheet.StyleSheet {
27
+ constructor(args) {
28
+ super(args);
29
+ this.prepend = cache.sheet.prepend;
30
+ }
31
+ }
32
+
33
+ // Do the same as https://github.com/emotion-js/emotion/blob/main/packages/cache/src/index.js#L238-L245
34
+ cache.sheet = new MyStyleSheet({
35
+ key: cache.key,
36
+ nonce: cache.sheet.nonce,
37
+ container: cache.sheet.container,
38
+ speedy: cache.sheet.isSpeedy,
39
+ prepend: cache.sheet.prepend,
40
+ insertionPoint: cache.sheet.insertionPoint
41
+ });
42
+ return cache;
43
+ };
44
+
15
45
  // prepend: true moves MUI styles to the top of the <head> so they're loaded first.
16
46
  // It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
17
47
  let cache;
18
48
  if (typeof document === 'object') {
19
- cache = (0, _cache.default)({
49
+ cache = createEmotionCache({
20
50
  key: 'css',
21
51
  prepend: true
22
52
  });
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine v6.0.1
2
+ * @mui/styled-engine v6.1.0
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.0.1",
3
+ "version": "6.1.0",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "styled() API wrapper package for emotion.",
@@ -26,8 +26,9 @@
26
26
  "url": "https://opencollective.com/mui-org"
27
27
  },
28
28
  "dependencies": {
29
- "@babel/runtime": "^7.25.0",
29
+ "@babel/runtime": "^7.25.6",
30
30
  "@emotion/cache": "^11.13.1",
31
+ "@emotion/sheet": "^1.4.0",
31
32
  "csstype": "^3.1.3",
32
33
  "prop-types": "^15.8.1"
33
34
  },