@mui/material-nextjs 5.15.4 → 5.15.6
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/{build/CHANGELOG.md → CHANGELOG.md} +398 -242
- package/README.md +1 -1
- package/{build/legacy → legacy}/v13-appRouter/appRouterV13.js +9 -1
- package/{build/legacy → legacy}/v13-appRouter/index.js +0 -2
- package/{build/legacy → legacy}/v13-pagesRouter/pagesRouterV13Document.js +2 -3
- package/legacy/v14-appRouter/index.js +1 -0
- package/{build/modern → modern}/v13-appRouter/appRouterV13.js +9 -1
- package/{build/modern → modern}/v13-appRouter/index.js +0 -2
- package/{build/modern → modern}/v13-pagesRouter/pagesRouterV13Document.js +2 -4
- package/modern/v14-appRouter/index.js +1 -0
- package/{build/node → node}/v13-appRouter/appRouterV13.js +9 -1
- package/{build/node → node}/v13-appRouter/index.js +0 -1
- package/{build/node → node}/v13-pagesRouter/pagesRouterV13Document.js +2 -4
- package/{build/node → node}/v14-appRouter/index.js +0 -1
- package/package.json +3 -23
- package/{build/v13-appRouter → v13-appRouter}/appRouterV13.d.ts +13 -4
- package/{build/v13-appRouter → v13-appRouter}/appRouterV13.js +9 -1
- package/{build/v13-appRouter → v13-appRouter}/index.js +0 -2
- package/{build/v13-pagesRouter → v13-pagesRouter}/pagesRouterV13Document.d.ts +1 -1
- package/{build/v13-pagesRouter → v13-pagesRouter}/pagesRouterV13Document.js +2 -4
- package/v14-appRouter/index.js +1 -0
- package/build/README.md +0 -3
- package/build/legacy/v14-appRouter/index.js +0 -3
- package/build/modern/v14-appRouter/index.js +0 -3
- package/build/package.json +0 -52
- package/build/v14-appRouter/index.js +0 -3
- package/src/v13-appRouter/appRouterV13.tsx +0 -102
- package/src/v13-appRouter/index.ts +0 -3
- package/src/v13-pagesRouter/createCache.ts +0 -19
- package/src/v13-pagesRouter/index.ts +0 -2
- package/src/v13-pagesRouter/pagesRouterV13App.tsx +0 -16
- package/src/v13-pagesRouter/pagesRouterV13Document.tsx +0 -115
- package/src/v14-appRouter/index.ts +0 -2
- package/src/v14-pagesRouter/index.ts +0 -1
- package/tsconfig.build.json +0 -15
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -7
- /package/{build/LICENSE → LICENSE} +0 -0
- /package/{build/legacy → legacy}/v13-pagesRouter/createCache.js +0 -0
- /package/{build/legacy → legacy}/v13-pagesRouter/index.js +0 -0
- /package/{build/legacy → legacy}/v13-pagesRouter/pagesRouterV13App.js +0 -0
- /package/{build/legacy → legacy}/v14-pagesRouter/index.js +0 -0
- /package/{build/modern → modern}/v13-pagesRouter/createCache.js +0 -0
- /package/{build/modern → modern}/v13-pagesRouter/index.js +0 -0
- /package/{build/modern → modern}/v13-pagesRouter/pagesRouterV13App.js +0 -0
- /package/{build/modern → modern}/v14-pagesRouter/index.js +0 -0
- /package/{build/node → node}/v13-pagesRouter/createCache.js +0 -0
- /package/{build/node → node}/v13-pagesRouter/index.js +0 -0
- /package/{build/node → node}/v13-pagesRouter/pagesRouterV13App.js +0 -0
- /package/{build/node → node}/v14-pagesRouter/index.js +0 -0
- /package/{build/v13-appRouter → v13-appRouter}/index.d.ts +0 -0
- /package/{build/v13-appRouter → v13-appRouter}/package.json +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/createCache.d.ts +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/createCache.js +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/index.d.ts +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/index.js +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/package.json +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/pagesRouterV13App.d.ts +0 -0
- /package/{build/v13-pagesRouter → v13-pagesRouter}/pagesRouterV13App.js +0 -0
- /package/{build/v14-appRouter → v14-appRouter}/index.d.ts +0 -0
- /package/{build/v14-appRouter → v14-appRouter}/package.json +0 -0
- /package/{build/v14-pagesRouter → v14-pagesRouter}/index.d.ts +0 -0
- /package/{build/v14-pagesRouter → v14-pagesRouter}/index.js +0 -0
- /package/{build/v14-pagesRouter → v14-pagesRouter}/package.json +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# @mui/material-nextjs
|
|
2
2
|
|
|
3
|
-
The official Material
|
|
3
|
+
The official Material UI integration with Next.js. For the full documentation, visit [Next.js integration](https://mui.com/material-ui/guides/nextjs/) page.
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
|
-
import { useServerInsertedHTML } from 'next/navigation';
|
|
7
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
|
+
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
|
+
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
13
|
+
* See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 for why it's a problem.
|
|
14
|
+
*/
|
|
10
15
|
export default function AppRouterCacheProvider(props) {
|
|
11
16
|
var options = props.options,
|
|
12
17
|
_props$CacheProvider = props.CacheProvider,
|
|
@@ -20,6 +25,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
20
25
|
cache.compat = true;
|
|
21
26
|
var prevInsert = cache.insert;
|
|
22
27
|
var inserted = [];
|
|
28
|
+
// Override the insert method to support streaming SSR with flush().
|
|
23
29
|
cache.insert = function () {
|
|
24
30
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
31
|
args[_key] = arguments[_key];
|
|
@@ -77,6 +83,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
77
83
|
var name = _ref2.name,
|
|
78
84
|
style = _ref2.style;
|
|
79
85
|
return /*#__PURE__*/_jsx("style", {
|
|
86
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
80
87
|
"data-emotion": "".concat(registry.cache.key, "-global ").concat(name)
|
|
81
88
|
// eslint-disable-next-line react/no-danger
|
|
82
89
|
,
|
|
@@ -85,6 +92,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
85
92
|
}
|
|
86
93
|
}, name);
|
|
87
94
|
}), styles && /*#__PURE__*/_jsx("style", {
|
|
95
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
88
96
|
"data-emotion": dataEmotionAttribute
|
|
89
97
|
// eslint-disable-next-line react/no-danger
|
|
90
98
|
,
|
|
@@ -70,13 +70,12 @@ export function createGetInitialProps(plugins) {
|
|
|
70
70
|
return getInitialProps;
|
|
71
71
|
}();
|
|
72
72
|
}
|
|
73
|
-
export function DocumentHeadTags(
|
|
74
|
-
var emotionStyleTags = _ref2.emotionStyleTags;
|
|
73
|
+
export function DocumentHeadTags(props) {
|
|
75
74
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
76
75
|
children: [_meta || (_meta = /*#__PURE__*/_jsx("meta", {
|
|
77
76
|
name: "emotion-insertion-point",
|
|
78
77
|
content: ""
|
|
79
|
-
})), emotionStyleTags]
|
|
78
|
+
})), props.emotionStyleTags]
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
81
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../v13-appRouter';
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
|
-
import { useServerInsertedHTML } from 'next/navigation';
|
|
7
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
|
+
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
|
+
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
13
|
+
* See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 for why it's a problem.
|
|
14
|
+
*/
|
|
10
15
|
export default function AppRouterCacheProvider(props) {
|
|
11
16
|
const {
|
|
12
17
|
options,
|
|
@@ -20,6 +25,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
20
25
|
cache.compat = true;
|
|
21
26
|
const prevInsert = cache.insert;
|
|
22
27
|
let inserted = [];
|
|
28
|
+
// Override the insert method to support streaming SSR with flush().
|
|
23
29
|
cache.insert = (...args) => {
|
|
24
30
|
if (options?.enableCssLayer) {
|
|
25
31
|
args[1].styles = `@layer mui {${args[1].styles}}`;
|
|
@@ -73,6 +79,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
73
79
|
name,
|
|
74
80
|
style
|
|
75
81
|
}) => /*#__PURE__*/_jsx("style", {
|
|
82
|
+
nonce: options?.nonce,
|
|
76
83
|
"data-emotion": `${registry.cache.key}-global ${name}`
|
|
77
84
|
// eslint-disable-next-line react/no-danger
|
|
78
85
|
,
|
|
@@ -80,6 +87,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
80
87
|
__html: style
|
|
81
88
|
}
|
|
82
89
|
}, name)), styles && /*#__PURE__*/_jsx("style", {
|
|
90
|
+
nonce: options?.nonce,
|
|
83
91
|
"data-emotion": dataEmotionAttribute
|
|
84
92
|
// eslint-disable-next-line react/no-danger
|
|
85
93
|
,
|
|
@@ -20,14 +20,12 @@ export function createGetInitialProps(plugins) {
|
|
|
20
20
|
return finalProps;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
export function DocumentHeadTags({
|
|
24
|
-
emotionStyleTags
|
|
25
|
-
}) {
|
|
23
|
+
export function DocumentHeadTags(props) {
|
|
26
24
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
27
25
|
children: [_meta || (_meta = /*#__PURE__*/_jsx("meta", {
|
|
28
26
|
name: "emotion-insertion-point",
|
|
29
27
|
content: ""
|
|
30
|
-
})), emotionStyleTags]
|
|
28
|
+
})), props.emotionStyleTags]
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../v13-appRouter';
|
|
@@ -9,11 +9,16 @@ exports.default = AppRouterCacheProvider;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _cache = _interopRequireDefault(require("@emotion/cache"));
|
|
12
|
-
var _navigation = require("next/navigation");
|
|
13
12
|
var _react2 = require("@emotion/react");
|
|
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
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 && Object.prototype.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
|
+
/**
|
|
18
|
+
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
19
|
+
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
20
|
+
* See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 for why it's a problem.
|
|
21
|
+
*/
|
|
17
22
|
function AppRouterCacheProvider(props) {
|
|
18
23
|
const {
|
|
19
24
|
options,
|
|
@@ -28,6 +33,7 @@ function AppRouterCacheProvider(props) {
|
|
|
28
33
|
cache.compat = true;
|
|
29
34
|
const prevInsert = cache.insert;
|
|
30
35
|
let inserted = [];
|
|
36
|
+
// Override the insert method to support streaming SSR with flush().
|
|
31
37
|
cache.insert = (...args) => {
|
|
32
38
|
if (options != null && options.enableCssLayer) {
|
|
33
39
|
args[1].styles = `@layer mui {${args[1].styles}}`;
|
|
@@ -81,6 +87,7 @@ function AppRouterCacheProvider(props) {
|
|
|
81
87
|
name,
|
|
82
88
|
style
|
|
83
89
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
|
|
90
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
84
91
|
"data-emotion": `${registry.cache.key}-global ${name}`
|
|
85
92
|
// eslint-disable-next-line react/no-danger
|
|
86
93
|
,
|
|
@@ -88,6 +95,7 @@ function AppRouterCacheProvider(props) {
|
|
|
88
95
|
__html: style
|
|
89
96
|
}
|
|
90
97
|
}, name)), styles && /*#__PURE__*/(0, _jsxRuntime.jsx)("style", {
|
|
98
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
91
99
|
"data-emotion": dataEmotionAttribute
|
|
92
100
|
// eslint-disable-next-line react/no-danger
|
|
93
101
|
,
|
|
@@ -30,14 +30,12 @@ function createGetInitialProps(plugins) {
|
|
|
30
30
|
return finalProps;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function DocumentHeadTags({
|
|
34
|
-
emotionStyleTags
|
|
35
|
-
}) {
|
|
33
|
+
function DocumentHeadTags(props) {
|
|
36
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
37
35
|
children: [_meta || (_meta = /*#__PURE__*/(0, _jsxRuntime.jsx)("meta", {
|
|
38
36
|
name: "emotion-insertion-point",
|
|
39
37
|
content: ""
|
|
40
|
-
})), emotionStyleTags]
|
|
38
|
+
})), props.emotionStyleTags]
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material-nextjs",
|
|
3
|
-
"version": "5.15.
|
|
3
|
+
"version": "5.15.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Collection of utilities for integration between Material UI and Next.js.",
|
|
@@ -23,14 +23,6 @@
|
|
|
23
23
|
"type": "opencollective",
|
|
24
24
|
"url": "https://opencollective.com/mui-org"
|
|
25
25
|
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@emotion/cache": "^11.11.0",
|
|
28
|
-
"@emotion/react": "^11.11.3",
|
|
29
|
-
"@emotion/server": "^11.11.0",
|
|
30
|
-
"@types/react": "^18.2.46",
|
|
31
|
-
"next": "13.4.19",
|
|
32
|
-
"react": "^18.2.0"
|
|
33
|
-
},
|
|
34
26
|
"peerDependencies": {
|
|
35
27
|
"@emotion/cache": "^11.11.0",
|
|
36
28
|
"@emotion/server": "^11.11.0",
|
|
@@ -52,22 +44,10 @@
|
|
|
52
44
|
},
|
|
53
45
|
"sideEffects": false,
|
|
54
46
|
"publishConfig": {
|
|
55
|
-
"access": "public"
|
|
47
|
+
"access": "public",
|
|
48
|
+
"directory": "build"
|
|
56
49
|
},
|
|
57
50
|
"engines": {
|
|
58
51
|
"node": ">=12.0.0"
|
|
59
|
-
},
|
|
60
|
-
"scripts": {
|
|
61
|
-
"build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
|
|
62
|
-
"build:legacy": "node ../../scripts/build.mjs legacy",
|
|
63
|
-
"build:modern": "node ../../scripts/build.mjs modern",
|
|
64
|
-
"build:node": "node ../../scripts/build.mjs node",
|
|
65
|
-
"build:stable": "node ../../scripts/build.mjs stable",
|
|
66
|
-
"build:copy-files": "node ../../scripts/copyFiles.mjs",
|
|
67
|
-
"build:types": "node ../../scripts/buildTypes.mjs",
|
|
68
|
-
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
|
|
69
|
-
"release": "pnpm build && npm publish build",
|
|
70
|
-
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-utils/**/*.test.{js,ts,tsx}'",
|
|
71
|
-
"typescript": "tsc -p tsconfig.json"
|
|
72
52
|
}
|
|
73
53
|
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { EmotionCache, Options as OptionsOfCreateCache } from '@emotion/cache';
|
|
3
3
|
export type AppRouterCacheProviderProps = {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* These are the options passed to createCache() from 'import createCache from "@emotion/cache"'.
|
|
6
|
+
*/
|
|
5
7
|
options?: Partial<OptionsOfCreateCache> & {
|
|
6
8
|
/**
|
|
7
9
|
* If `true`, the generated styles are wrapped within `@layer mui`.
|
|
8
|
-
* This is useful if you want to override the Material UI's generated styles with different styling solution, like Tailwind, plain CSS etc.
|
|
10
|
+
* This is useful if you want to override the Material UI's generated styles with different styling solution, like Tailwind CSS, plain CSS etc.
|
|
9
11
|
*/
|
|
10
12
|
enableCssLayer?: boolean;
|
|
11
13
|
};
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* By default <CacheProvider /> from 'import { CacheProvider } from "@emotion/react"'.
|
|
16
|
+
*/
|
|
13
17
|
CacheProvider?: (props: {
|
|
14
18
|
value: EmotionCache;
|
|
15
19
|
children: React.ReactNode;
|
|
16
20
|
}) => React.JSX.Element | null;
|
|
17
21
|
children: React.ReactNode;
|
|
18
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
25
|
+
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
26
|
+
* See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 for why it's a problem.
|
|
27
|
+
*/
|
|
19
28
|
export default function AppRouterCacheProvider(props: AppRouterCacheProviderProps): React.JSX.Element;
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import createCache from '@emotion/cache';
|
|
6
|
-
import { useServerInsertedHTML } from 'next/navigation';
|
|
7
6
|
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
7
|
+
import { useServerInsertedHTML } from 'next/navigation';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Emotion works OK without this provider but it's recommended to use this provider to improve performance.
|
|
12
|
+
* Without it, Emotion will generate a new <style> tag during SSR for every component.
|
|
13
|
+
* See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 for why it's a problem.
|
|
14
|
+
*/
|
|
10
15
|
export default function AppRouterCacheProvider(props) {
|
|
11
16
|
const {
|
|
12
17
|
options,
|
|
@@ -21,6 +26,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
21
26
|
cache.compat = true;
|
|
22
27
|
const prevInsert = cache.insert;
|
|
23
28
|
let inserted = [];
|
|
29
|
+
// Override the insert method to support streaming SSR with flush().
|
|
24
30
|
cache.insert = (...args) => {
|
|
25
31
|
if (options != null && options.enableCssLayer) {
|
|
26
32
|
args[1].styles = `@layer mui {${args[1].styles}}`;
|
|
@@ -74,6 +80,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
74
80
|
name,
|
|
75
81
|
style
|
|
76
82
|
}) => /*#__PURE__*/_jsx("style", {
|
|
83
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
77
84
|
"data-emotion": `${registry.cache.key}-global ${name}`
|
|
78
85
|
// eslint-disable-next-line react/no-danger
|
|
79
86
|
,
|
|
@@ -81,6 +88,7 @@ export default function AppRouterCacheProvider(props) {
|
|
|
81
88
|
__html: style
|
|
82
89
|
}
|
|
83
90
|
}, name)), styles && /*#__PURE__*/_jsx("style", {
|
|
91
|
+
nonce: options == null ? void 0 : options.nonce,
|
|
84
92
|
"data-emotion": dataEmotionAttribute
|
|
85
93
|
// eslint-disable-next-line react/no-danger
|
|
86
94
|
,
|
|
@@ -13,7 +13,7 @@ export declare function createGetInitialProps(plugins: Plugin[]): (ctx: Document
|
|
|
13
13
|
export interface DocumentHeadTagsProps {
|
|
14
14
|
emotionStyleTags: React.JSX.Element[];
|
|
15
15
|
}
|
|
16
|
-
export declare function DocumentHeadTags(
|
|
16
|
+
export declare function DocumentHeadTags(props: DocumentHeadTagsProps): React.JSX.Element;
|
|
17
17
|
export declare function documentGetInitialProps(ctx: DocumentContext, options?: {
|
|
18
18
|
emotionCache?: EmotionCache;
|
|
19
19
|
plugins?: Plugin[];
|
|
@@ -20,14 +20,12 @@ export function createGetInitialProps(plugins) {
|
|
|
20
20
|
return finalProps;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
export function DocumentHeadTags({
|
|
24
|
-
emotionStyleTags
|
|
25
|
-
}) {
|
|
23
|
+
export function DocumentHeadTags(props) {
|
|
26
24
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
27
25
|
children: [_meta || (_meta = /*#__PURE__*/_jsx("meta", {
|
|
28
26
|
name: "emotion-insertion-point",
|
|
29
27
|
content: ""
|
|
30
|
-
})), emotionStyleTags]
|
|
28
|
+
})), props.emotionStyleTags]
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../v13-appRouter';
|
package/build/README.md
DELETED
package/build/package.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mui/material-nextjs",
|
|
3
|
-
"version": "5.15.4",
|
|
4
|
-
"private": false,
|
|
5
|
-
"author": "MUI Team",
|
|
6
|
-
"description": "Collection of utilities for integration between Material UI and Next.js.",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"react",
|
|
9
|
-
"next",
|
|
10
|
-
"material-ui"
|
|
11
|
-
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/mui/material-ui.git",
|
|
15
|
-
"directory": "packages/mui-material-nextjs"
|
|
16
|
-
},
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/mui/material-ui/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://mui.com/material-ui/guides/nextjs/",
|
|
22
|
-
"funding": {
|
|
23
|
-
"type": "opencollective",
|
|
24
|
-
"url": "https://opencollective.com/mui-org"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@emotion/cache": "^11.11.0",
|
|
28
|
-
"@emotion/server": "^11.11.0",
|
|
29
|
-
"@mui/material": "^5.0.0",
|
|
30
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
31
|
-
"next": "^13.0.0 || ^14.0.0",
|
|
32
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
33
|
-
},
|
|
34
|
-
"peerDependenciesMeta": {
|
|
35
|
-
"@types/react": {
|
|
36
|
-
"optional": true
|
|
37
|
-
},
|
|
38
|
-
"@emotion/cache": {
|
|
39
|
-
"optional": true
|
|
40
|
-
},
|
|
41
|
-
"@emotion/server": {
|
|
42
|
-
"optional": true
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"sideEffects": false,
|
|
46
|
-
"publishConfig": {
|
|
47
|
-
"access": "public"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=12.0.0"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import createCache from '@emotion/cache';
|
|
4
|
-
import { useServerInsertedHTML } from 'next/navigation';
|
|
5
|
-
import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
|
|
6
|
-
import type { EmotionCache, Options as OptionsOfCreateCache } from '@emotion/cache';
|
|
7
|
-
|
|
8
|
-
export type AppRouterCacheProviderProps = {
|
|
9
|
-
/** These are the options passed to createCache() from 'import createCache from "@emotion/cache"' */
|
|
10
|
-
options?: Partial<OptionsOfCreateCache> & {
|
|
11
|
-
/**
|
|
12
|
-
* If `true`, the generated styles are wrapped within `@layer mui`.
|
|
13
|
-
* This is useful if you want to override the Material UI's generated styles with different styling solution, like Tailwind, plain CSS etc.
|
|
14
|
-
*/
|
|
15
|
-
enableCssLayer?: boolean;
|
|
16
|
-
};
|
|
17
|
-
/** By default <CacheProvider /> from 'import { CacheProvider } from "@emotion/react"' */
|
|
18
|
-
CacheProvider?: (props: {
|
|
19
|
-
value: EmotionCache;
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
}) => React.JSX.Element | null;
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default function AppRouterCacheProvider(props: AppRouterCacheProviderProps) {
|
|
26
|
-
const { options, CacheProvider = DefaultCacheProvider, children } = props;
|
|
27
|
-
|
|
28
|
-
const [registry] = React.useState(() => {
|
|
29
|
-
const cache = createCache({ ...options, key: options?.key ?? 'mui' });
|
|
30
|
-
cache.compat = true;
|
|
31
|
-
const prevInsert = cache.insert;
|
|
32
|
-
let inserted: { name: string; isGlobal: boolean }[] = [];
|
|
33
|
-
cache.insert = (...args) => {
|
|
34
|
-
if (options?.enableCssLayer) {
|
|
35
|
-
args[1].styles = `@layer mui {${args[1].styles}}`;
|
|
36
|
-
}
|
|
37
|
-
const [selector, serialized] = args;
|
|
38
|
-
if (cache.inserted[serialized.name] === undefined) {
|
|
39
|
-
inserted.push({
|
|
40
|
-
name: serialized.name,
|
|
41
|
-
isGlobal: !selector,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return prevInsert(...args);
|
|
45
|
-
};
|
|
46
|
-
const flush = () => {
|
|
47
|
-
const prevInserted = inserted;
|
|
48
|
-
inserted = [];
|
|
49
|
-
return prevInserted;
|
|
50
|
-
};
|
|
51
|
-
return { cache, flush };
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
useServerInsertedHTML(() => {
|
|
55
|
-
const inserted = registry.flush();
|
|
56
|
-
if (inserted.length === 0) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
let styles = '';
|
|
60
|
-
let dataEmotionAttribute = registry.cache.key;
|
|
61
|
-
|
|
62
|
-
const globals: {
|
|
63
|
-
name: string;
|
|
64
|
-
style: string;
|
|
65
|
-
}[] = [];
|
|
66
|
-
|
|
67
|
-
inserted.forEach(({ name, isGlobal }) => {
|
|
68
|
-
const style = registry.cache.inserted[name];
|
|
69
|
-
|
|
70
|
-
if (typeof style !== 'boolean') {
|
|
71
|
-
if (isGlobal) {
|
|
72
|
-
globals.push({ name, style });
|
|
73
|
-
} else {
|
|
74
|
-
styles += style;
|
|
75
|
-
dataEmotionAttribute += ` ${name}`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<React.Fragment>
|
|
82
|
-
{globals.map(({ name, style }) => (
|
|
83
|
-
<style
|
|
84
|
-
key={name}
|
|
85
|
-
data-emotion={`${registry.cache.key}-global ${name}`}
|
|
86
|
-
// eslint-disable-next-line react/no-danger
|
|
87
|
-
dangerouslySetInnerHTML={{ __html: style }}
|
|
88
|
-
/>
|
|
89
|
-
))}
|
|
90
|
-
{styles && (
|
|
91
|
-
<style
|
|
92
|
-
data-emotion={dataEmotionAttribute}
|
|
93
|
-
// eslint-disable-next-line react/no-danger
|
|
94
|
-
dangerouslySetInnerHTML={{ __html: styles }}
|
|
95
|
-
/>
|
|
96
|
-
)}
|
|
97
|
-
</React.Fragment>
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
return <CacheProvider value={registry.cache}>{children}</CacheProvider>;
|
|
102
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import createCache from '@emotion/cache';
|
|
2
|
-
|
|
3
|
-
const isBrowser = typeof document !== 'undefined';
|
|
4
|
-
|
|
5
|
-
// On the client side, Create a meta tag at the top of the <head> and set it as insertionPoint.
|
|
6
|
-
// This assures that MUI styles are loaded first.
|
|
7
|
-
// It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
|
|
8
|
-
export default function createEmotionCache() {
|
|
9
|
-
let insertionPoint;
|
|
10
|
-
|
|
11
|
-
if (isBrowser) {
|
|
12
|
-
const emotionInsertionPoint = document.querySelector<HTMLMetaElement>(
|
|
13
|
-
'meta[name="emotion-insertion-point"]',
|
|
14
|
-
);
|
|
15
|
-
insertionPoint = emotionInsertionPoint ?? undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return createCache({ key: 'mui', insertionPoint });
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CacheProvider, EmotionCache } from '@emotion/react';
|
|
3
|
-
import createEmotionCache from './createCache';
|
|
4
|
-
|
|
5
|
-
export interface EmotionCacheProviderProps {
|
|
6
|
-
emotionCache?: EmotionCache;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const defaultEmotionCache = createEmotionCache();
|
|
10
|
-
|
|
11
|
-
export function AppCacheProvider({
|
|
12
|
-
emotionCache = defaultEmotionCache,
|
|
13
|
-
children,
|
|
14
|
-
}: React.PropsWithChildren<EmotionCacheProviderProps>) {
|
|
15
|
-
return <CacheProvider value={emotionCache}>{children}</CacheProvider>;
|
|
16
|
-
}
|