@backstage/theme 0.5.4 → 0.5.5

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage/theme
2
2
 
3
+ ## 0.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - e059f63: Internal refactor to fix an issue where the MUI 5 `v5-` class prefixing gets removed by tree shaking.
8
+
3
9
  ## 0.5.4
4
10
 
5
11
  ### Patch Changes
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
- import './MuiClassNameSetup.esm.js';
3
2
  import { CssBaseline } from '@material-ui/core';
4
3
  import { createGenerateClassName, StylesProvider, ThemeProvider } from '@material-ui/core/styles';
5
4
  import { StyledEngineProvider, ThemeProvider as ThemeProvider$1 } from '@mui/material/styles';
5
+ import { unstable_ClassNameGenerator } from '@mui/material/className';
6
6
 
7
+ unstable_ClassNameGenerator.configure((componentName) => {
8
+ return `v5-${componentName}`;
9
+ });
7
10
  const generateV4ClassName = createGenerateClassName({
8
11
  productionPrefix: "jss4-"
9
12
  });
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedThemeProvider.esm.js","sources":["../../src/unified/UnifiedThemeProvider.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport './MuiClassNameSetup';\nimport { CssBaseline } from '@material-ui/core';\nimport {\n ThemeProvider,\n StylesProvider,\n createGenerateClassName,\n Theme as Mui4Theme,\n} from '@material-ui/core/styles';\nimport {\n StyledEngineProvider,\n ThemeProvider as Mui5Provider,\n Theme as Mui5Theme,\n} from '@mui/material/styles';\nimport { UnifiedTheme } from './types';\n\n/**\n * Props for {@link UnifiedThemeProvider}.\n *\n * @public\n */\nexport interface UnifiedThemeProviderProps {\n children: ReactNode;\n theme: UnifiedTheme;\n noCssBaseline?: boolean;\n}\n\n// Background at https://mui.com/x/migration/migration-data-grid-v4/#using-mui-core-v4-with-v5\n// Rather than disabling globals and custom seed, we instead only set a production prefix that\n// won't collide with Material UI 5 styles. We've already got a separate class name generator for v5 set\n// up in MuiClassNameSetup.ts, so only the production JSS needs deduplication.\nconst generateV4ClassName = createGenerateClassName({\n productionPrefix: 'jss4-',\n});\n\n/**\n * Provides themes for all Material UI versions supported by the provided unified theme.\n *\n * @public\n */\nexport function UnifiedThemeProvider(\n props: UnifiedThemeProviderProps,\n): JSX.Element {\n const { children, theme, noCssBaseline = false } = props;\n\n const v4Theme = theme.getTheme('v4') as Mui4Theme;\n const v5Theme = theme.getTheme('v5') as Mui5Theme;\n\n let cssBaseline: JSX.Element | undefined = undefined;\n if (!noCssBaseline) {\n cssBaseline = <CssBaseline />;\n }\n\n let result = (\n <>\n {cssBaseline}\n {children}\n </>\n );\n\n if (v4Theme) {\n result = (\n <StylesProvider generateClassName={generateV4ClassName}>\n <ThemeProvider theme={v4Theme}>{result}</ThemeProvider>\n </StylesProvider>\n );\n }\n\n if (v5Theme) {\n result = (\n <StyledEngineProvider injectFirst>\n <Mui5Provider theme={v5Theme}>{result}</Mui5Provider>\n </StyledEngineProvider>\n );\n }\n\n return result;\n}\n"],"names":["Mui5Provider"],"mappings":";;;;;;AA+CA,MAAM,sBAAsB,uBAAwB,CAAA;AAAA,EAClD,gBAAkB,EAAA,OAAA;AACpB,CAAC,CAAA,CAAA;AAOM,SAAS,qBACd,KACa,EAAA;AACb,EAAA,MAAM,EAAE,QAAA,EAAU,KAAO,EAAA,aAAA,GAAgB,OAAU,GAAA,KAAA,CAAA;AAEnD,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AACnC,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAEnC,EAAA,IAAI,WAAuC,GAAA,KAAA,CAAA,CAAA;AAC3C,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAA,WAAA,uCAAe,WAAY,EAAA,IAAA,CAAA,CAAA;AAAA,GAC7B;AAEA,EAAI,IAAA,MAAA,mBAEC,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,WAAA,EACA,QACH,CAAA,CAAA;AAGF,EAAA,IAAI,OAAS,EAAA;AACX,IACE,MAAA,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,iBAAmB,EAAA,mBAAA,EAAA,sCAChC,aAAc,EAAA,EAAA,KAAA,EAAO,OAAU,EAAA,EAAA,MAAO,CACzC,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IACE,MAAA,mBAAA,KAAA,CAAA,aAAA,CAAC,wBAAqB,WAAW,EAAA,IAAA,EAAA,sCAC9BA,eAAa,EAAA,EAAA,KAAA,EAAO,OAAU,EAAA,EAAA,MAAO,CACxC,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"UnifiedThemeProvider.esm.js","sources":["../../src/unified/UnifiedThemeProvider.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { CssBaseline } from '@material-ui/core';\nimport {\n ThemeProvider,\n StylesProvider,\n createGenerateClassName,\n Theme as Mui4Theme,\n} from '@material-ui/core/styles';\nimport {\n StyledEngineProvider,\n ThemeProvider as Mui5Provider,\n Theme as Mui5Theme,\n} from '@mui/material/styles';\nimport { UnifiedTheme } from './types';\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\n/**\n * Props for {@link UnifiedThemeProvider}.\n *\n * @public\n */\nexport interface UnifiedThemeProviderProps {\n children: ReactNode;\n theme: UnifiedTheme;\n noCssBaseline?: boolean;\n}\n\n/**\n * This API is introduced in @mui/material (v5.0.5) as a replacement of deprecated createGenerateClassName & only affects v5 Material UI components from `@mui/*`.\n *\n * This call needs to be in the same module as the `UnifiedThemeProvider` to ensure that it doesn't get removed by tree shaking\n */\nClassNameGenerator.configure(componentName => {\n return `v5-${componentName}`;\n});\n\n// Background at https://mui.com/x/migration/migration-data-grid-v4/#using-mui-core-v4-with-v5\n// Rather than disabling globals and custom seed, we instead only set a production prefix that\n// won't collide with Material UI 5 styles. We've already got the separate class name generator\n// for v5 set up in just above, so only the production JSS needs deduplication.\nconst generateV4ClassName = createGenerateClassName({\n productionPrefix: 'jss4-',\n});\n\n/**\n * Provides themes for all Material UI versions supported by the provided unified theme.\n *\n * @public\n */\nexport function UnifiedThemeProvider(\n props: UnifiedThemeProviderProps,\n): JSX.Element {\n const { children, theme, noCssBaseline = false } = props;\n\n const v4Theme = theme.getTheme('v4') as Mui4Theme;\n const v5Theme = theme.getTheme('v5') as Mui5Theme;\n\n let cssBaseline: JSX.Element | undefined = undefined;\n if (!noCssBaseline) {\n cssBaseline = <CssBaseline />;\n }\n\n let result = (\n <>\n {cssBaseline}\n {children}\n </>\n );\n\n if (v4Theme) {\n result = (\n <StylesProvider generateClassName={generateV4ClassName}>\n <ThemeProvider theme={v4Theme}>{result}</ThemeProvider>\n </StylesProvider>\n );\n }\n\n if (v5Theme) {\n result = (\n <StyledEngineProvider injectFirst>\n <Mui5Provider theme={v5Theme}>{result}</Mui5Provider>\n </StyledEngineProvider>\n );\n }\n\n return result;\n}\n"],"names":["ClassNameGenerator","Mui5Provider"],"mappings":";;;;;;AAgDAA,2BAAA,CAAmB,UAAU,CAAiB,aAAA,KAAA;AAC5C,EAAA,OAAO,MAAM,aAAa,CAAA,CAAA,CAAA;AAC5B,CAAC,CAAA,CAAA;AAMD,MAAM,sBAAsB,uBAAwB,CAAA;AAAA,EAClD,gBAAkB,EAAA,OAAA;AACpB,CAAC,CAAA,CAAA;AAOM,SAAS,qBACd,KACa,EAAA;AACb,EAAA,MAAM,EAAE,QAAA,EAAU,KAAO,EAAA,aAAA,GAAgB,OAAU,GAAA,KAAA,CAAA;AAEnD,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AACnC,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAEnC,EAAA,IAAI,WAAuC,GAAA,KAAA,CAAA,CAAA;AAC3C,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAA,WAAA,uCAAe,WAAY,EAAA,IAAA,CAAA,CAAA;AAAA,GAC7B;AAEA,EAAI,IAAA,MAAA,mBAEC,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,WAAA,EACA,QACH,CAAA,CAAA;AAGF,EAAA,IAAI,OAAS,EAAA;AACX,IACE,MAAA,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,iBAAmB,EAAA,mBAAA,EAAA,sCAChC,aAAc,EAAA,EAAA,KAAA,EAAO,OAAU,EAAA,EAAA,MAAO,CACzC,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IACE,MAAA,mBAAA,KAAA,CAAA,aAAA,CAAC,wBAAqB,WAAW,EAAA,IAAA,EAAA,sCAC9BC,eAAa,EAAA,EAAA,KAAA,EAAO,OAAU,EAAA,EAAA,MAAO,CACxC,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/theme",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "material-ui theme for use with Backstage.",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -1,6 +0,0 @@
1
- import { unstable_ClassNameGenerator } from '@mui/material/className';
2
-
3
- unstable_ClassNameGenerator.configure((componentName) => {
4
- return `v5-${componentName}`;
5
- });
6
- //# sourceMappingURL=MuiClassNameSetup.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MuiClassNameSetup.esm.js","sources":["../../src/unified/MuiClassNameSetup.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\n/**\n * This API is introduced in @mui/material (v5.0.5) as a replacement of deprecated createGenerateClassName & only affects v5 Material UI components from `@mui/*`\n */\nClassNameGenerator.configure(componentName => {\n return `v5-${componentName}`;\n});\n"],"names":["ClassNameGenerator"],"mappings":";;AAqBAA,2BAAA,CAAmB,UAAU,CAAiB,aAAA,KAAA;AAC5C,EAAA,OAAO,MAAM,aAAa,CAAA,CAAA,CAAA;AAC5B,CAAC,CAAA"}