core-components: tweak exports and update api reports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-10-26 21:31:28 +02:00
parent 7e0b26dec0
commit 8921944da1
5 changed files with 35 additions and 16 deletions
-2
View File
@@ -164,8 +164,6 @@ export type AppContext = {
getComponents(): AppComponents;
};
// Warning: (ae-missing-release-tag) "AppIcons" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AppIcons = {
'kind:api': IconComponent;
+1
View File
@@ -35,6 +35,7 @@ import MuiPeopleIcon from '@material-ui/icons/People';
import MuiPersonIcon from '@material-ui/icons/Person';
import MuiWarningIcon from '@material-ui/icons/Warning';
/** @public */
export type AppIcons = {
'kind:api': IconComponent;
'kind:component': IconComponent;
+19 -2
View File
@@ -681,6 +681,22 @@ export type OAuthRequestDialogClassKey =
// @public (undocumented)
export type OpenedDropdownClassKey = 'icon';
// @public
export interface OptionalAppOptions {
// Warning: (ae-forgotten-export) The symbol "AppComponents" needs to be exported by the entry point index.d.ts
//
// (undocumented)
components?: Partial<AppComponents>;
// Warning: (ae-forgotten-export) The symbol "AppIcons" needs to be exported by the entry point index.d.ts
//
// (undocumented)
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
// (undocumented)
themes?: (Partial<AppTheme> & Omit<AppTheme, 'theme'>)[];
}
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "OverflowTooltip" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -2328,11 +2344,12 @@ export type WarningPanelClassKey =
| 'message'
| 'details';
// Warning: (ae-forgotten-export) The symbol "DefaultAppOptions" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "AppOptions" needs to be exported by the entry point index.d.ts
//
// @public
export function withDefaults(options?: DefaultAppOptions): AppOptions;
export function withDefaults(
options?: Omit<AppOptions, keyof OptionalAppOptions> & OptionalAppOptions,
): AppOptions;
// Warnings were encountered during analysis:
//
@@ -15,3 +15,4 @@
*/
export { withDefaults } from './withDefaults';
export type { OptionalAppOptions } from './withDefaults';
@@ -28,22 +28,22 @@ import { defaultAppComponents } from './defaultAppComponents';
import { defaultAppIcons } from './defaultAppIcons';
import { defaultAppThemes } from './defaultAppThemes';
interface OptionalAppOptions {
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
themes?: (Partial<AppTheme> & Omit<AppTheme, 'theme'>)[];
components?: Partial<AppComponents>;
}
// NOTE: we don't re-export any of the types imported from core-app-api, as we
// want them to be imported from there rather than core-components.
/**
* The options required by {@link @backstage/core-app-api#createApp}, but with
* many of the fields being optional
* The set of app options that will be populated by {@link withDefaults} if they
* are not passed in explicitly.
*
* @public
*/
type DefaultAppOptions = Omit<AppOptions, keyof OptionalAppOptions> &
OptionalAppOptions;
export interface OptionalAppOptions {
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
themes?: (Partial<AppTheme> & Omit<AppTheme, 'theme'>)[]; // TODO: simplify once AppTheme is updated
components?: Partial<AppComponents>;
}
/**
* Provides a set of default App options with the ability to override specific options.
@@ -52,7 +52,9 @@ type DefaultAppOptions = Omit<AppOptions, keyof OptionalAppOptions> &
*
* @public
*/
export function withDefaults(options?: DefaultAppOptions): AppOptions {
export function withDefaults(
options?: Omit<AppOptions, keyof OptionalAppOptions> & OptionalAppOptions,
): AppOptions {
const { themes, icons, components } = options ?? {};
return {