@mui/material-nextjs 5.15.11 → 6.0.0-alpha.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.
- package/CHANGELOG.md +474 -165
- package/legacy/v13-appRouter/appRouterV13.js +1 -2
- package/legacy/v13-pagesRouter/pagesRouterV13Document.js +1 -2
- package/modern/v13-appRouter/appRouterV13.js +1 -2
- package/modern/v13-pagesRouter/pagesRouterV13Document.js +1 -2
- package/node/v13-appRouter/appRouterV13.js +1 -1
- package/node/v13-appRouter/index.js +1 -1
- package/node/v13-pagesRouter/pagesRouterV13App.js +1 -1
- package/node/v13-pagesRouter/pagesRouterV13Document.js +1 -1
- package/package.json +3 -3
- package/v13-appRouter/appRouterV13.js +5 -7
- package/v13-pagesRouter/createCache.js +1 -1
- package/v13-pagesRouter/pagesRouterV13Document.js +3 -5
|
@@ -5,8 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
7
|
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
/**
|
|
11
10
|
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
11
|
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
@@ -7,8 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import createEmotionServer from '@emotion/server/create-instance';
|
|
8
8
|
import Document from 'next/document';
|
|
9
9
|
import createEmotionCache from './createCache';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
13
12
|
* A utility to compose multiple `getInitialProps` functions.
|
|
14
13
|
*/
|
|
@@ -5,8 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
7
|
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
/**
|
|
11
10
|
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
11
|
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
@@ -4,8 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import createEmotionServer from '@emotion/server/create-instance';
|
|
5
5
|
import Document from 'next/document';
|
|
6
6
|
import createEmotionCache from './createCache';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
/**
|
|
10
9
|
* A utility to compose multiple `getInitialProps` functions.
|
|
11
10
|
*/
|
|
@@ -13,7 +13,7 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _navigation = require("next/navigation");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
/**
|
|
18
18
|
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
19
19
|
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
@@ -25,4 +25,4 @@ Object.keys(_appRouterV).forEach(function (key) {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
28
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
28
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -10,7 +10,7 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _createCache = _interopRequireDefault(require("./createCache"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
const defaultEmotionCache = (0, _createCache.default)();
|
|
15
15
|
function AppCacheProvider({
|
|
16
16
|
emotionCache = defaultEmotionCache,
|
|
@@ -15,7 +15,7 @@ var _createCache = _interopRequireDefault(require("./createCache"));
|
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
var _meta;
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
/**
|
|
20
20
|
* A utility to compose multiple `getInitialProps` functions.
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material-nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Collection of utilities for integration between Material UI and Next.js.",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@emotion/cache": "^11.11.0",
|
|
31
31
|
"@emotion/server": "^11.11.0",
|
|
32
|
-
"@mui/material": "^5.0.0",
|
|
33
32
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
34
33
|
"next": "^13.0.0 || ^14.0.0",
|
|
35
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
34
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
35
|
+
"@mui/material": "^6.0.0-alpha.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@types/react": {
|
|
@@ -5,8 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
7
|
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
/**
|
|
11
10
|
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
11
|
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
@@ -19,16 +18,15 @@ export default function AppRouterCacheProvider(props) {
|
|
|
19
18
|
children
|
|
20
19
|
} = props;
|
|
21
20
|
const [registry] = React.useState(() => {
|
|
22
|
-
var _options$key;
|
|
23
21
|
const cache = createCache(_extends({}, options, {
|
|
24
|
-
key:
|
|
22
|
+
key: options?.key ?? 'mui'
|
|
25
23
|
}));
|
|
26
24
|
cache.compat = true;
|
|
27
25
|
const prevInsert = cache.insert;
|
|
28
26
|
let inserted = [];
|
|
29
27
|
// Override the insert method to support streaming SSR with flush().
|
|
30
28
|
cache.insert = (...args) => {
|
|
31
|
-
if (options
|
|
29
|
+
if (options?.enableCssLayer) {
|
|
32
30
|
args[1].styles = `@layer mui {${args[1].styles}}`;
|
|
33
31
|
}
|
|
34
32
|
const [selector, serialized] = args;
|
|
@@ -80,7 +78,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
80
78
|
name,
|
|
81
79
|
style
|
|
82
80
|
}) => /*#__PURE__*/_jsx("style", {
|
|
83
|
-
nonce: options
|
|
81
|
+
nonce: options?.nonce,
|
|
84
82
|
"data-emotion": `${registry.cache.key}-global ${name}`
|
|
85
83
|
// eslint-disable-next-line react/no-danger
|
|
86
84
|
,
|
|
@@ -88,7 +86,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
88
86
|
__html: style
|
|
89
87
|
}
|
|
90
88
|
}, name)), styles && /*#__PURE__*/_jsx("style", {
|
|
91
|
-
nonce: options
|
|
89
|
+
nonce: options?.nonce,
|
|
92
90
|
"data-emotion": dataEmotionAttribute
|
|
93
91
|
// eslint-disable-next-line react/no-danger
|
|
94
92
|
,
|
|
@@ -8,7 +8,7 @@ export default function createEmotionCache() {
|
|
|
8
8
|
let insertionPoint;
|
|
9
9
|
if (isBrowser) {
|
|
10
10
|
const emotionInsertionPoint = document.querySelector('meta[name="emotion-insertion-point"]');
|
|
11
|
-
insertionPoint = emotionInsertionPoint
|
|
11
|
+
insertionPoint = emotionInsertionPoint ?? undefined;
|
|
12
12
|
}
|
|
13
13
|
return createCache({
|
|
14
14
|
key: 'mui',
|
|
@@ -4,8 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import createEmotionServer from '@emotion/server/create-instance';
|
|
5
5
|
import Document from 'next/document';
|
|
6
6
|
import createEmotionCache from './createCache';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
/**
|
|
10
9
|
* A utility to compose multiple `getInitialProps` functions.
|
|
11
10
|
*/
|
|
@@ -32,7 +31,6 @@ export function DocumentHeadTags(props) {
|
|
|
32
31
|
// `getInitialProps` belongs to `_document` (instead of `_app`),
|
|
33
32
|
// it's compatible with static-site generation (SSG).
|
|
34
33
|
export async function documentGetInitialProps(ctx, options) {
|
|
35
|
-
var _options$emotionCache, _options$plugins;
|
|
36
34
|
// Resolution order
|
|
37
35
|
//
|
|
38
36
|
// On the server:
|
|
@@ -57,7 +55,7 @@ export async function documentGetInitialProps(ctx, options) {
|
|
|
57
55
|
|
|
58
56
|
// You can consider sharing the same Emotion cache between all the SSR requests to speed up performance.
|
|
59
57
|
// However, be aware that it can have global side effects.
|
|
60
|
-
const cache =
|
|
58
|
+
const cache = options?.emotionCache ?? createEmotionCache();
|
|
61
59
|
// The createEmotionServer has to be called directly after the cache creation due to the side effect of cache.compat = true,
|
|
62
60
|
// otherwise the <style> tag will not come with the HTML string from the server.
|
|
63
61
|
const {
|
|
@@ -83,5 +81,5 @@ export async function documentGetInitialProps(ctx, options) {
|
|
|
83
81
|
}, style.key))
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
|
-
}, ...(
|
|
84
|
+
}, ...(options?.plugins ?? [])])(ctx);
|
|
87
85
|
}
|