From e2fad5e880806947875b98a964ce1d1dc7278977 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Tue, 4 Jul 2023 16:52:16 +0200 Subject: [PATCH] Update api -reports & changeset Signed-off-by: Philipp Hugenroth --- .changeset/cool-starfishes-love.md | 2 +- packages/theme/api-report.md | 21 ++++++++++++++------- packages/theme/src/unified/index.ts | 2 +- packages/theme/src/unified/types.ts | 13 +++++++++++++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.changeset/cool-starfishes-love.md b/.changeset/cool-starfishes-love.md index c29ff03efc..63e387c364 100644 --- a/.changeset/cool-starfishes-love.md +++ b/.changeset/cool-starfishes-love.md @@ -2,4 +2,4 @@ '@backstage/theme': patch --- -Overwritting `PaletteOptions` & `ThemeOptions` type to allow usage of `createTheme` from `'@backstage/theme'` as well as `@material-ui/core/styles` with the same type. Additionally replacing default `CSSBaseline` wiht v4 instead of v5 for better backwards compatibilty for now. +Overwrite `PaletteOptions` & `ThemeOptions` type to allow use of `createTheme` from `@backstage/theme` as well as `@material-ui/core/styles` with the same type. Also replaced the default `CSSBaseline` with v4 instead of v5 for better backwards compatibility for now. diff --git a/packages/theme/api-report.md b/packages/theme/api-report.md index fe05ca6b4e..d29ad937cf 100644 --- a/packages/theme/api-report.md +++ b/packages/theme/api-report.md @@ -10,7 +10,8 @@ import type { PaletteOptions } from '@material-ui/core/styles/createPalette'; import { PaletteOptions as PaletteOptions_2 } from '@mui/material/styles'; import { ReactNode } from 'react'; import { Theme } from '@mui/material/styles'; -import { Theme as Theme_2 } from '@material-ui/core'; +import { Theme as Theme_2 } from '@material-ui/core/styles'; +import { Theme as Theme_3 } from '@material-ui/core'; import { ThemeOptions } from '@mui/material/styles'; import { ThemeOptions as ThemeOptions_2 } from '@material-ui/core/styles'; import type { ThemeOptions as ThemeOptions_3 } from '@material-ui/core'; @@ -86,7 +87,7 @@ export type BackstagePaletteOptions = PaletteOptions & BackstagePaletteAdditions; // @public @deprecated -export interface BackstageTheme extends Theme_2 { +export interface BackstageTheme extends Theme_3 { // (undocumented) getPageTheme: (selector: PageThemeSelector) => PageTheme; // (undocumented) @@ -172,13 +173,13 @@ export function createBaseThemeOptions( }; // @public @deprecated -export function createTheme(options: SimpleThemeOptions): Theme_2; +export function createTheme(options: SimpleThemeOptions): Theme_3; // @public @deprecated export function createThemeOptions(options: SimpleThemeOptions): ThemeOptions_3; // @public @deprecated -export function createThemeOverrides(theme: Theme_2): Overrides; +export function createThemeOverrides(theme: Theme_3): Overrides; // @public export function createUnifiedTheme(options: UnifiedThemeOptions): UnifiedTheme; @@ -187,7 +188,7 @@ export function createUnifiedTheme(options: UnifiedThemeOptions): UnifiedTheme; export function createUnifiedThemeFromV4(options: ThemeOptions_2): UnifiedTheme; // @public @deprecated -export const darkTheme: Theme_2; +export const darkTheme: Theme_3; // @public export const defaultComponentThemes: ThemeOptions['components']; @@ -202,7 +203,7 @@ export function genPageTheme(props: { }): PageTheme; // @public @deprecated -export const lightTheme: Theme_2; +export const lightTheme: Theme_3; // @public export type PageTheme = { @@ -380,6 +381,12 @@ export type SimpleThemeOptions = { htmlFontSize?: number; }; +// @public +export type SupportedThemes = Theme_2 | Theme; + +// @public +export type SupportedVersions = 'v4' | 'v5'; + // @public export const themes: { light: UnifiedTheme; @@ -398,7 +405,7 @@ export function transformV5ComponentThemesToV4( // @public export interface UnifiedTheme { // (undocumented) - getTheme(version: string): unknown | undefined; + getTheme(version: SupportedVersions): SupportedThemes | undefined; } // @public diff --git a/packages/theme/src/unified/index.ts b/packages/theme/src/unified/index.ts index f5c805d3ed..747662e195 100644 --- a/packages/theme/src/unified/index.ts +++ b/packages/theme/src/unified/index.ts @@ -20,4 +20,4 @@ export type { UnifiedThemeOptions } from './UnifiedTheme'; export { themes } from './themes'; export { UnifiedThemeProvider } from './UnifiedThemeProvider'; export type { UnifiedThemeProviderProps } from './UnifiedThemeProvider'; -export type { UnifiedTheme } from './types'; +export type { UnifiedTheme, SupportedThemes, SupportedVersions } from './types'; diff --git a/packages/theme/src/unified/types.ts b/packages/theme/src/unified/types.ts index f17e5e234a..2dfea6d9b7 100644 --- a/packages/theme/src/unified/types.ts +++ b/packages/theme/src/unified/types.ts @@ -17,7 +17,20 @@ import { Theme as Mui4Theme } from '@material-ui/core/styles'; import { Theme as Mui5Theme } from '@mui/material/styles'; +/** + * Supported Material UI Versions + * + * Currently: 'v4' and 'v5'. + * + * @public + */ export type SupportedVersions = 'v4' | 'v5'; + +/** + * Supported Material UI Theme Types for `SupportedVersions` + * + * @public + */ export type SupportedThemes = Mui4Theme | Mui5Theme; /**