@backstage/theme 0.6.0 → 0.6.1-next.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
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { PaletteOptions, Palette } from '@material-ui/core/styles/createPalette'
|
|
|
6
6
|
import * as _backstage_theme from '@backstage/theme';
|
|
7
7
|
import { ReactNode } from 'react';
|
|
8
8
|
import * as _material_ui_core from '@material-ui/core';
|
|
9
|
-
import { ThemeOptions as ThemeOptions$2, Theme as Theme$2 } from '@material-ui/core';
|
|
9
|
+
import { ThemeOptions as ThemeOptions$2, Theme as Theme$2 } from '@material-ui/core/styles/createTheme';
|
|
10
10
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import CssBaseline from '@material-ui/core/CssBaseline';
|
|
3
3
|
import { createGenerateClassName, StylesProvider, ThemeProvider } from '@material-ui/core/styles';
|
|
4
4
|
import { StyledEngineProvider, ThemeProvider as ThemeProvider$1 } from '@mui/material/styles';
|
|
5
5
|
import { unstable_ClassNameGenerator } from '@mui/material/className';
|
|
@@ -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
|
|
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/CssBaseline';\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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseTheme.esm.js","sources":["../../src/v4/baseTheme.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { Theme as Mui5Theme } from '@mui/material/styles';\nimport { createTheme as createMuiTheme } from '@material-ui/core/styles';\nimport type {
|
|
1
|
+
{"version":3,"file":"baseTheme.esm.js","sources":["../../src/v4/baseTheme.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { Theme as Mui5Theme } from '@mui/material/styles';\nimport { createTheme as createMuiTheme } from '@material-ui/core/styles';\nimport type { Theme, ThemeOptions } from '@material-ui/core/styles/createTheme';\nimport type { GridProps } from '@material-ui/core/Grid';\nimport type { SwitchProps } from '@material-ui/core/Switch';\n\nimport { Overrides } from '@material-ui/core/styles/overrides';\nimport { SimpleThemeOptions } from './types';\nimport { createBaseThemeOptions } from '../base';\nimport { defaultComponentThemes } from '../v5';\nimport { transformV5ComponentThemesToV4 } from '../unified/overrides';\n\n/**\n * An old helper for creating Material UI v4 theme options.\n *\n * @public\n * @deprecated Use {@link createBaseThemeOptions} instead.\n */\nexport function createThemeOptions(options: SimpleThemeOptions): ThemeOptions {\n return {\n props: {\n MuiGrid: defaultComponentThemes?.MuiGrid\n ?.defaultProps as Partial<GridProps>,\n MuiSwitch: defaultComponentThemes?.MuiSwitch\n ?.defaultProps as Partial<SwitchProps>,\n },\n ...createBaseThemeOptions(options),\n };\n}\n\n/**\n * * An old helper for creating Material UI v4 theme overrides.\n *\n * @public\n * @deprecated Use {@link defaultComponentThemes} with {@link transformV5ComponentThemesToV4} instead.\n */\nexport function createThemeOverrides(theme: Theme): Overrides {\n return transformV5ComponentThemesToV4(\n // Safe but we have to make sure we don't use mui5 specific stuff in the default component themes\n theme as unknown as Mui5Theme,\n defaultComponentThemes,\n ).overrides;\n}\n\n/**\n * The old method to create a Backstage Material UI v4 theme using a palette.\n * The theme is created with the common Backstage options and component styles.\n *\n * @public\n * @deprecated Use {@link createUnifiedTheme} instead.\n */\nexport function createTheme(options: SimpleThemeOptions): Theme {\n const themeOptions = createThemeOptions(options);\n const baseTheme = createMuiTheme(themeOptions);\n const overrides = createThemeOverrides(baseTheme);\n const theme = { ...baseTheme, overrides };\n return theme;\n}\n"],"names":["createMuiTheme"],"mappings":";;;;;;AAkCO,SAAS,mBAAmB,OAA2C,EAAA;AAC5E,EAAO,OAAA;AAAA,IACL,KAAO,EAAA;AAAA,MACL,OAAA,EAAS,wBAAwB,OAC7B,EAAA,YAAA;AAAA,MACJ,SAAA,EAAW,wBAAwB,SAC/B,EAAA,YAAA;AAAA,KACN;AAAA,IACA,GAAG,uBAAuB,OAAO,CAAA;AAAA,GACnC,CAAA;AACF,CAAA;AAQO,SAAS,qBAAqB,KAAyB,EAAA;AAC5D,EAAO,OAAA,8BAAA;AAAA;AAAA,IAEL,KAAA;AAAA,IACA,sBAAA;AAAA,GACA,CAAA,SAAA,CAAA;AACJ,CAAA;AASO,SAAS,YAAY,OAAoC,EAAA;AAC9D,EAAM,MAAA,YAAA,GAAe,mBAAmB,OAAO,CAAA,CAAA;AAC/C,EAAM,MAAA,SAAA,GAAYA,cAAe,YAAY,CAAA,CAAA;AAC7C,EAAM,MAAA,SAAA,GAAY,qBAAqB,SAAS,CAAA,CAAA;AAChD,EAAA,MAAM,KAAQ,GAAA,EAAE,GAAG,SAAA,EAAW,SAAU,EAAA,CAAA;AACxC,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/theme",
|
|
3
|
-
"version": "0.6.0",
|
|
3
|
+
"version": "0.6.1-next.0",
|
|
4
4
|
"description": "material-ui theme for use with Backstage.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@mui/material": "^5.12.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@backstage/cli": "
|
|
44
|
+
"@backstage/cli": "0.29.0-next.1",
|
|
45
45
|
"@mui/styles": "^5.14.18",
|
|
46
46
|
"@testing-library/jest-dom": "^6.0.0",
|
|
47
47
|
"@testing-library/react": "^16.0.0",
|