@mui/material-nextjs 5.15.5 → 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/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # @mui/material-nextjs
2
2
 
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
+ The official Material UI integration with Next.js. For the full documentation, visit [Next.js integration](https://mui.com/material-ui/guides/nextjs/) page.
@@ -7,6 +7,11 @@ import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
7
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];
@@ -70,13 +70,12 @@ export function createGetInitialProps(plugins) {
70
70
  return getInitialProps;
71
71
  }();
72
72
  }
73
- export function DocumentHeadTags(_ref2) {
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
 
@@ -7,6 +7,11 @@ import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
7
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}}`;
@@ -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
 
@@ -14,6 +14,11 @@ 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}}`;
@@ -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.5",
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.",
@@ -20,4 +20,9 @@ export type AppRouterCacheProviderProps = {
20
20
  }) => React.JSX.Element | null;
21
21
  children: React.ReactNode;
22
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
+ */
23
28
  export default function AppRouterCacheProvider(props: AppRouterCacheProviderProps): React.JSX.Element;
@@ -7,6 +7,11 @@ import { CacheProvider as DefaultCacheProvider } from '@emotion/react';
7
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}}`;
@@ -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({ emotionStyleTags }: DocumentHeadTagsProps): React.JSX.Element;
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