@mui/styled-engine 7.0.1 → 7.0.2
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 +60 -0
- package/StyledEngineProvider/StyledEngineProvider.js +12 -1
- package/esm/StyledEngineProvider/StyledEngineProvider.js +13 -2
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -10
- package/modern/GlobalStyles/GlobalStyles.js +0 -23
- package/modern/GlobalStyles/index.js +0 -1
- package/modern/StyledEngineProvider/StyledEngineProvider.js +0 -122
- package/modern/StyledEngineProvider/index.js +0 -1
- package/modern/index.js +0 -47
- package/modern/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
_Apr 9, 2025_
|
|
6
|
+
|
|
7
|
+
A big thanks to the 12 contributors who made this release possible.
|
|
8
|
+
|
|
9
|
+
### `@mui/material@7.0.2`
|
|
10
|
+
|
|
11
|
+
- [Autocomplete] Add ability to render custom single value (#45387) @ZeeshanTamboli
|
|
12
|
+
- [Autocomplete] Prevent shrink animation in controlled Autocomplete when initial `value` is provided (#45734) @imadx
|
|
13
|
+
- [AvatarGroup] Fix `spacing` prop ignoring value `0` (#45799) @Kartik-Murthy
|
|
14
|
+
- [Dialog] Deprecate composed classes (#45418) @sai6855
|
|
15
|
+
|
|
16
|
+
### `@mui/material-nextjs@7.0.2`
|
|
17
|
+
|
|
18
|
+
- Fix nonce issues (#45794) @Janpot
|
|
19
|
+
- Add warnings to nextjs router integration (#45778) @Janpot
|
|
20
|
+
|
|
21
|
+
### `@mui/styled-engine@7.0.2`
|
|
22
|
+
|
|
23
|
+
- Added caching to `StyledEngineProvider` to improve performance for running tests with Jest (#45846) @siriwatknp
|
|
24
|
+
|
|
25
|
+
### Core
|
|
26
|
+
|
|
27
|
+
- [blog] Improve upvote video (0646444) @oliviertassinari
|
|
28
|
+
- [code-infra] Remove webpack aliases (#45841) @Janpot
|
|
29
|
+
- [code-infra] Remove .tsbuildinfo from build folder (#45727) @Janpot
|
|
30
|
+
- [code-infra] Stabilize theme viewer screenshot tests (#45768) @Janpot
|
|
31
|
+
- [code-infra] Remove modern bundles (#45808) @Janpot
|
|
32
|
+
- Update buildTypes script to optionally remove css imports (#45835) @brijeshb42
|
|
33
|
+
- Allow repo to be accepted as an argument for releaseTag (#45801) @brijeshb42
|
|
34
|
+
- Update scripts to support base-ui (#45784) @brijeshb42
|
|
35
|
+
- Sync scorecards.yml across codebase (4de5076) @oliviertassinari
|
|
36
|
+
- Remove baseUrl and skipLibCheck (#45806) @Janpot
|
|
37
|
+
- [docs-infra] Fix redirect styles pages (#45848) @siriwatknp
|
|
38
|
+
- [docs-infra] Remove false-positive Vale rules (#45843) @oliviertassinari
|
|
39
|
+
- [docs-infra] Make sure Next.js can find package.json through its aliases (#45840) @Janpot
|
|
40
|
+
- [docs-infra] Fix Next.js brand name coverage (6915f8d) @oliviertassinari
|
|
41
|
+
- [docs-infra] Fix layout shift between MIT and commercial pages (#45760) @oliviertassinari
|
|
42
|
+
- [docs-infra] Non breaking space for ESM (#45758) @oliviertassinari
|
|
43
|
+
- [support-infra] Remove dead 'workflow_call:' (#45736) @oliviertassinari
|
|
44
|
+
- [utils] Support cleanup callbacks in useForkRef (#45621) @DiegoAndai
|
|
45
|
+
|
|
46
|
+
### Docs
|
|
47
|
+
|
|
48
|
+
- Fix pigment vite integration example (#44746) @brijeshb42
|
|
49
|
+
- Update migration instructions and codemod references for deprecated APIs (#45793) @sai6855
|
|
50
|
+
- Add TanStack Router routing example (#44930) @vetledv
|
|
51
|
+
- Fix layout shifting in icons page (#45779) @sai6855
|
|
52
|
+
- Fix migration instructions (#45762) @oliviertassinari
|
|
53
|
+
- Fix wrong TypeScript support version (#45761) @oliviertassinari
|
|
54
|
+
- Fix link to mui-joy/src/styles/components.d.ts (#45763) @oliviertassinari
|
|
55
|
+
- Fix 301 link (ae94c40) @oliviertassinari
|
|
56
|
+
- Fix 301 links (abd8f63) @oliviertassinari
|
|
57
|
+
- Fix 301 redirection (c7658de) @oliviertassinari
|
|
58
|
+
- [nextjs] Migrate from deprecated "legacyBehavior" prop (#44871) @oliviertassinari
|
|
59
|
+
- [nextjs] Document CSP for Next.js Pages Router (#45798) @Grohden
|
|
60
|
+
|
|
61
|
+
All contributors of this release in alphabetical order: @brijeshb42, @DiegoAndai, @Grohden, @imadx, @Janpot, @Kartik-Murthy, @oliviertassinari, @renovate[bot], @sai6855, @siriwatknp, @vetledv, @ZeeshanTamboli
|
|
62
|
+
|
|
3
63
|
## 7.0.1
|
|
4
64
|
|
|
5
65
|
<!-- generated comparing v7.0.0..master -->
|
|
@@ -14,6 +14,9 @@ var _react2 = require("@emotion/react");
|
|
|
14
14
|
var _cache = _interopRequireDefault(require("@emotion/cache"));
|
|
15
15
|
var _sheet = require("@emotion/sheet");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
// To fix [Jest performance](https://github.com/mui/material-ui/issues/45638).
|
|
18
|
+
const cacheMap = new Map();
|
|
19
|
+
|
|
17
20
|
// Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
|
|
18
21
|
// We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
|
|
19
22
|
// Even if we disable it, JSDOM needs extra configuration to be able to parse `@layer` CSS.
|
|
@@ -104,7 +107,15 @@ function StyledEngineProvider(props) {
|
|
|
104
107
|
enableCssLayer,
|
|
105
108
|
children
|
|
106
109
|
} = props;
|
|
107
|
-
const cache = React.useMemo(() =>
|
|
110
|
+
const cache = React.useMemo(() => {
|
|
111
|
+
const cacheKey = `${injectFirst}-${enableCssLayer}`;
|
|
112
|
+
if (cacheMap.has(cacheKey)) {
|
|
113
|
+
return cacheMap.get(cacheKey);
|
|
114
|
+
}
|
|
115
|
+
const fresh = getCache(injectFirst, enableCssLayer);
|
|
116
|
+
cacheMap.set(cacheKey, fresh);
|
|
117
|
+
return fresh;
|
|
118
|
+
}, [injectFirst, enableCssLayer]);
|
|
108
119
|
return cache ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.CacheProvider, {
|
|
109
120
|
value: cache,
|
|
110
121
|
children: children
|
|
@@ -6,10 +6,13 @@ import { CacheProvider } from '@emotion/react';
|
|
|
6
6
|
import createCache from '@emotion/cache';
|
|
7
7
|
import { StyleSheet } from '@emotion/sheet';
|
|
8
8
|
|
|
9
|
+
// To fix [Jest performance](https://github.com/mui/material-ui/issues/45638).
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const cacheMap = new Map();
|
|
12
|
+
|
|
9
13
|
// Need to add a private variable to test the generated CSS from Emotion, this is the simplest way to do it.
|
|
10
14
|
// We can't test the CSS from `style` tag easily because the `speedy: true` (produce empty text content) is enabled by Emotion.
|
|
11
15
|
// 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
16
|
export const TEST_INTERNALS_DO_NOT_USE = {
|
|
14
17
|
/**
|
|
15
18
|
* to intercept the generated CSS before inserting to the style tag, so that we can check the generated CSS.
|
|
@@ -97,7 +100,15 @@ export default function StyledEngineProvider(props) {
|
|
|
97
100
|
enableCssLayer,
|
|
98
101
|
children
|
|
99
102
|
} = props;
|
|
100
|
-
const cache = React.useMemo(() =>
|
|
103
|
+
const cache = React.useMemo(() => {
|
|
104
|
+
const cacheKey = `${injectFirst}-${enableCssLayer}`;
|
|
105
|
+
if (cacheMap.has(cacheKey)) {
|
|
106
|
+
return cacheMap.get(cacheKey);
|
|
107
|
+
}
|
|
108
|
+
const fresh = getCache(injectFirst, enableCssLayer);
|
|
109
|
+
cacheMap.set(cacheKey, fresh);
|
|
110
|
+
return fresh;
|
|
111
|
+
}, [injectFirst, enableCssLayer]);
|
|
101
112
|
return cache ? /*#__PURE__*/_jsx(CacheProvider, {
|
|
102
113
|
value: cache,
|
|
103
114
|
children: children
|
package/esm/index.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/styled-engine",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "styled() API wrapper package for emotion.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.
|
|
29
|
+
"@babel/runtime": "^7.27.0",
|
|
30
30
|
"@emotion/cache": "^11.13.5",
|
|
31
31
|
"@emotion/serialize": "^1.3.3",
|
|
32
32
|
"@emotion/sheet": "^1.4.0",
|
|
@@ -65,10 +65,6 @@
|
|
|
65
65
|
"import": {
|
|
66
66
|
"types": "./esm/index.d.ts",
|
|
67
67
|
"default": "./esm/index.js"
|
|
68
|
-
},
|
|
69
|
-
"mui-modern": {
|
|
70
|
-
"types": "./modern/index.d.ts",
|
|
71
|
-
"default": "./modern/index.js"
|
|
72
68
|
}
|
|
73
69
|
},
|
|
74
70
|
"./*": {
|
|
@@ -79,10 +75,6 @@
|
|
|
79
75
|
"import": {
|
|
80
76
|
"types": "./esm/*/index.d.ts",
|
|
81
77
|
"default": "./esm/*/index.js"
|
|
82
|
-
},
|
|
83
|
-
"mui-modern": {
|
|
84
|
-
"types": "./modern/*/index.d.ts",
|
|
85
|
-
"default": "./modern/*/index.js"
|
|
86
78
|
}
|
|
87
79
|
},
|
|
88
80
|
"./esm": null,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { Global } from '@emotion/react';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
function isEmpty(obj) {
|
|
8
|
-
return obj === undefined || obj === null || Object.keys(obj).length === 0;
|
|
9
|
-
}
|
|
10
|
-
export default function GlobalStyles(props) {
|
|
11
|
-
const {
|
|
12
|
-
styles,
|
|
13
|
-
defaultTheme = {}
|
|
14
|
-
} = props;
|
|
15
|
-
const globalStyles = typeof styles === 'function' ? themeInput => styles(isEmpty(themeInput) ? defaultTheme : themeInput) : styles;
|
|
16
|
-
return /*#__PURE__*/_jsx(Global, {
|
|
17
|
-
styles: globalStyles
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes = {
|
|
21
|
-
defaultTheme: PropTypes.object,
|
|
22
|
-
styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
|
|
23
|
-
} : void 0;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./GlobalStyles.js";
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { CacheProvider } from '@emotion/react';
|
|
6
|
-
import createCache from '@emotion/cache';
|
|
7
|
-
import { StyleSheet } from '@emotion/sheet';
|
|
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
|
-
|
|
27
|
-
// We might be able to remove this when this issue is fixed:
|
|
28
|
-
// https://github.com/emotion-js/emotion/issues/2790
|
|
29
|
-
const createEmotionCache = (options, CustomSheet) => {
|
|
30
|
-
const cache = createCache(options);
|
|
31
|
-
|
|
32
|
-
// Do the same as https://github.com/emotion-js/emotion/blob/main/packages/cache/src/index.js#L238-L245
|
|
33
|
-
cache.sheet = new CustomSheet({
|
|
34
|
-
key: cache.key,
|
|
35
|
-
nonce: cache.sheet.nonce,
|
|
36
|
-
container: cache.sheet.container,
|
|
37
|
-
speedy: cache.sheet.isSpeedy,
|
|
38
|
-
prepend: cache.sheet.prepend,
|
|
39
|
-
insertionPoint: cache.sheet.insertionPoint
|
|
40
|
-
});
|
|
41
|
-
return cache;
|
|
42
|
-
};
|
|
43
|
-
let insertionPoint;
|
|
44
|
-
if (typeof document === 'object') {
|
|
45
|
-
// Use `insertionPoint` over `prepend`(deprecated) because it can be controlled for GlobalStyles injection order
|
|
46
|
-
// For more information, see https://github.com/mui/material-ui/issues/44597
|
|
47
|
-
insertionPoint = document.querySelector('[name="emotion-insertion-point"]');
|
|
48
|
-
if (!insertionPoint) {
|
|
49
|
-
insertionPoint = document.createElement('meta');
|
|
50
|
-
insertionPoint.setAttribute('name', 'emotion-insertion-point');
|
|
51
|
-
insertionPoint.setAttribute('content', '');
|
|
52
|
-
const head = document.querySelector('head');
|
|
53
|
-
if (head) {
|
|
54
|
-
head.prepend(insertionPoint);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
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);
|
|
74
|
-
}
|
|
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;
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
export default function StyledEngineProvider(props) {
|
|
95
|
-
const {
|
|
96
|
-
injectFirst,
|
|
97
|
-
enableCssLayer,
|
|
98
|
-
children
|
|
99
|
-
} = props;
|
|
100
|
-
const cache = React.useMemo(() => getCache(injectFirst, enableCssLayer), [injectFirst, enableCssLayer]);
|
|
101
|
-
return cache ? /*#__PURE__*/_jsx(CacheProvider, {
|
|
102
|
-
value: cache,
|
|
103
|
-
children: children
|
|
104
|
-
}) : children;
|
|
105
|
-
}
|
|
106
|
-
process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes = {
|
|
107
|
-
/**
|
|
108
|
-
* Your component tree.
|
|
109
|
-
*/
|
|
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,
|
|
116
|
-
/**
|
|
117
|
-
* By default, the styles are injected last in the <head> element of the page.
|
|
118
|
-
* As a result, they gain more specificity than any other style sheet.
|
|
119
|
-
* If you want to override MUI's styles, set this prop.
|
|
120
|
-
*/
|
|
121
|
-
injectFirst: PropTypes.bool
|
|
122
|
-
} : void 0;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./StyledEngineProvider.js";
|
package/modern/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/styled-engine v7.0.1
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
'use client';
|
|
9
|
-
|
|
10
|
-
/* eslint-disable no-underscore-dangle */
|
|
11
|
-
import emStyled from '@emotion/styled';
|
|
12
|
-
import { serializeStyles as emSerializeStyles } from '@emotion/serialize';
|
|
13
|
-
export default function styled(tag, options) {
|
|
14
|
-
const stylesFactory = emStyled(tag, options);
|
|
15
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
16
|
-
return (...styles) => {
|
|
17
|
-
const component = typeof tag === 'string' ? `"${tag}"` : 'component';
|
|
18
|
-
if (styles.length === 0) {
|
|
19
|
-
console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
|
|
20
|
-
} else if (styles.some(style => style === undefined)) {
|
|
21
|
-
console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
|
|
22
|
-
}
|
|
23
|
-
return stylesFactory(...styles);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return stylesFactory;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
|
-
export function internal_mutateStyles(tag, processor) {
|
|
31
|
-
// Emotion attaches all the styles as `__emotion_styles`.
|
|
32
|
-
// Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
|
|
33
|
-
if (Array.isArray(tag.__emotion_styles)) {
|
|
34
|
-
tag.__emotion_styles = processor(tag.__emotion_styles);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Emotion only accepts an array, but we want to avoid allocations
|
|
39
|
-
const wrapper = [];
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
41
|
-
export function internal_serializeStyles(styles) {
|
|
42
|
-
wrapper[0] = styles;
|
|
43
|
-
return emSerializeStyles(wrapper);
|
|
44
|
-
}
|
|
45
|
-
export { ThemeContext, keyframes, css } from '@emotion/react';
|
|
46
|
-
export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
|
|
47
|
-
export { default as GlobalStyles } from "./GlobalStyles/index.js";
|
package/modern/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module","sideEffects":false}
|