Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Move StyledEngineProvider to @material-ui/core/styles #26265

Merged
merged 10 commits into from
May 13, 2021
2 changes: 1 addition & 1 deletion docs/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { create } from 'jss';
import jssRtl from 'jss-rtl';
import { useRouter } from 'next/router';
import { StylesProvider, jssPreset } from '@material-ui/styles';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import pages from 'docs/src/pages';
import initRedux from 'docs/src/modules/redux/initRedux';
import PageContext from 'docs/src/modules/components/PageContext';
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/utils/getDemoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function jsDemo(demoData) {
'index.js': `
import * as React from 'react';
import ReactDOM from 'react-dom';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Demo from './demo';

ReactDOM.render(
Expand All @@ -36,7 +36,7 @@ function tsDemo(demoData) {
'index.tsx': `
import * as React from 'react';
import ReactDOM from 'react-dom';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Demo from './demo';

ReactDOM.render(
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/guides/interoperability/interoperability.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function PlainCssSlider() {

```jsx
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';

export default function GlobalCssPriority() {
return (
Expand Down Expand Up @@ -208,7 +208,7 @@ export default function GlobalCssSlider() {

```jsx
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';

export default function GlobalCssPriority() {
return (
Expand Down Expand Up @@ -457,7 +457,7 @@ export default function CssModulesSlider() {

```jsx
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';

export default function GlobalCssPriority() {
return (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The styled engine used in v5 by default is [`emotion`](https://github.com/emotio

```jsx
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';

export default function GlobalCssPriority() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import App from './App';

ReactDOM.render(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import App from './App';
import * as serviceWorker from './serviceWorker';

Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app-with-typescript/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/core/styles';
import App from './App';
import theme from './theme';
Expand Down
3 changes: 1 addition & 2 deletions examples/create-react-app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';
import { ThemeProvider, StyledEngineProvider } from '@material-ui/core/styles';
import App from './App';
import theme from './theme';

Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby-theme/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby-theme/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
Expand Down
2 changes: 1 addition & 1 deletion examples/preact/src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';
import Container from '@material-ui/core/Container';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
Expand Down
18 changes: 18 additions & 0 deletions packages/material-ui/scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ const nestedFolder = {
return resolved;
}

if (importee.indexOf('@material-ui/styled-engine/') === 0) {
const folder = importee.split('/')[2];
const resolved = path.resolve(
__dirname,
`../../../packages/material-ui-styled-engine/src/${folder}/index.js`,
);
return resolved;
}

if (importee.indexOf('@material-ui/styled-engine-sc/') === 0) {
const folder = importee.split('/')[2];
const resolved = path.resolve(
__dirname,
`../../../packages/material-ui-styled-engine-sc/src/${folder}/index.js`,
);
return resolved;
}

return undefined;
},
};
Expand Down
3 changes: 3 additions & 0 deletions packages/material-ui/src/StyledEngineProvider/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/**
* @deprecated will be removed in v5.beta, please use StyledEngineProvider from @material-ui/core/styles instead
*/
export { StyledEngineProvider as default } from '@material-ui/styled-engine';
5 changes: 2 additions & 3 deletions packages/material-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ export { default as GlobalStyles } from './GlobalStyles';
export * from './GlobalStyles';

/**
* @deprecated will be removed in v5.beta, please use StyledEngineProvider instead
* @deprecated will be removed in v5.beta, please use StyledEngineProvider from @material-ui/core/styles instead
*/
export { default as StylesProvider } from './StyledEngineProvider';
export { default as StyledEngineProvider } from './StyledEngineProvider';
export { StyledEngineProvider } from './styles';
6 changes: 1 addition & 5 deletions packages/material-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,4 @@ export { default as useAutocomplete } from './useAutocomplete';
export { default as GlobalStyles } from './GlobalStyles';
export * from './GlobalStyles';

/**
* @deprecated will be removed in v5 beta, please use StyledEngineProvider instead
*/
export { default as StylesProvider } from './StyledEngineProvider';
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
export { default as StyledEngineProvider } from './StyledEngineProvider';
export { StyledEngineProvider } from './styles';
Copy link
Member Author

@mnajdova mnajdova May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we are changing it a second time already 😞

1 change: 1 addition & 0 deletions packages/material-ui/src/styles/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ export {
export { ComponentsProps } from './props';
export { ComponentsVariants } from './variants';
export { ComponentsOverrides } from './overrides';
export { default as StyledEngineProvider } from '@material-ui/styled-engine/StyledEngineProvider';
1 change: 1 addition & 0 deletions packages/material-ui/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { default as unstable_useThemeProps } from './useThemeProps';
export { default as withStyles } from './withStyles';
export { default as experimentalStyled } from './experimentalStyled';
export { default as ThemeProvider } from './ThemeProvider';
export { default as StyledEngineProvider } from '@material-ui/styled-engine/StyledEngineProvider';
2 changes: 1 addition & 1 deletion test/e2e/TestViewer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { StyledEngineProvider } from '@material-ui/core/styles';

function TestViewer(props) {
const { children } = props;
Expand Down
3 changes: 1 addition & 2 deletions test/regressions/TestViewer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useFakeTimers } from 'sinon';
import StyledEngineProvider from '@material-ui/core/StyledEngineProvider';
import { withStyles } from '@material-ui/core/styles';
import { withStyles, StyledEngineProvider } from '@material-ui/core/styles';

const styles = (theme) => ({
'@global': {
Expand Down