diff --git a/workspaces/app-defaults/.changeset/graduate-nfs-exports.md b/workspaces/app-defaults/.changeset/graduate-nfs-exports.md new file mode 100644 index 00000000000..4d3c5dcc359 --- /dev/null +++ b/workspaces/app-defaults/.changeset/graduate-nfs-exports.md @@ -0,0 +1,40 @@ +--- +'@red-hat-developer-hub/backstage-plugin-app-defaults': major +'@red-hat-developer-hub/backstage-plugin-app-auth': major +'@red-hat-developer-hub/backstage-plugin-app-integrations': major +'@red-hat-developer-hub/backstage-plugin-app-react': major +--- + +**BREAKING**: Graduate NFS exports from `/alpha` to the main entry point. + +- All public APIs previously available from `./alpha` are now exported from the + package root (`.`). Update imports: + + ```diff + -import { appAuthModule } from '@red-hat-developer-hub/backstage-plugin-app-auth/alpha'; + +import { appAuthModule } from '@red-hat-developer-hub/backstage-plugin-app-auth'; + + -import { appIntegrationsModule } from '@red-hat-developer-hub/backstage-plugin-app-integrations/alpha'; + +import { appIntegrationsModule } from '@red-hat-developer-hub/backstage-plugin-app-integrations'; + + -import { appDrawerModule, AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react/alpha'; + +import { appDrawerModule, AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react'; + + -import { appDefaultsModule } from '@red-hat-developer-hub/backstage-plugin-app-defaults/alpha'; + +import { appDefaultsModule } from '@red-hat-developer-hub/backstage-plugin-app-defaults'; + ``` + +- The `./alpha` subpath has been removed from packages without translations + (`app-defaults`, `app-integrations`, `app-react`). Only `app-auth` retains + `./alpha` for translation exports (`signInTranslationRef`). + +- `@red-hat-developer-hub/backstage-plugin-app-react` adds a new `./legacy` + subpath exporting the direct-use OFS components (`useAppDrawer`, + `ApplicationDrawer`, `DrawerPanel`) for backward compatibility. + +- `@red-hat-developer-hub/backstage-plugin-app-react` adds a new + `./app-drawer-module` subpath that default-exports `appDrawerModule` + (`pluginId: 'app'`) for Scalprum / module-federation dynamic loading. + +- All `pluginId: 'app'` modules are now re-exported as the default export from + their respective packages. diff --git a/workspaces/app-defaults/packages/app/src/App.tsx b/workspaces/app-defaults/packages/app/src/App.tsx index b33c1373703..f9690330eb9 100644 --- a/workspaces/app-defaults/packages/app/src/App.tsx +++ b/workspaces/app-defaults/packages/app/src/App.tsx @@ -16,9 +16,9 @@ import { createApp } from '@backstage/frontend-defaults'; import catalogPlugin from '@backstage/plugin-catalog/alpha'; -import { appAuthModule } from '@red-hat-developer-hub/backstage-plugin-app-auth/alpha'; -import { appIntegrationsModule } from '@red-hat-developer-hub/backstage-plugin-app-integrations/alpha'; -import { appDrawerModule } from '@red-hat-developer-hub/backstage-plugin-app-react/alpha'; +import { appAuthModule } from '@red-hat-developer-hub/backstage-plugin-app-auth'; +import { appIntegrationsModule } from '@red-hat-developer-hub/backstage-plugin-app-integrations'; +import { appDrawerModule } from '@red-hat-developer-hub/backstage-plugin-app-react'; import { globalHeaderModule, globalHeaderTranslationsModule, diff --git a/workspaces/app-defaults/packages/app/src/modules/drawer-demo/index.tsx b/workspaces/app-defaults/packages/app/src/modules/drawer-demo/index.tsx index 57729eae16e..2c69b792ae3 100644 --- a/workspaces/app-defaults/packages/app/src/modules/drawer-demo/index.tsx +++ b/workspaces/app-defaults/packages/app/src/modules/drawer-demo/index.tsx @@ -15,7 +15,7 @@ */ import { createFrontendModule } from '@backstage/frontend-plugin-api'; -import { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react/alpha'; +import { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react'; import { GlobalHeaderMenuItemBlueprint } from '@red-hat-developer-hub/backstage-plugin-global-header/alpha'; import { ChatDrawerContent, diff --git a/workspaces/app-defaults/plugins/app-auth/package.json b/workspaces/app-defaults/plugins/app-auth/package.json index 2872369d38b..35df6ad36fd 100644 --- a/workspaces/app-defaults/plugins/app-auth/package.json +++ b/workspaces/app-defaults/plugins/app-auth/package.json @@ -3,8 +3,8 @@ "version": "0.2.0", "license": "Apache-2.0", "description": "RHDH sign-in page and OIDC/Auth0/SAML frontend auth APIs for the new frontend system", - "main": "src/alpha.ts", - "types": "src/alpha.ts", + "main": "src/index.ts", + "types": "src/index.ts", "exports": { ".": "./src/index.ts", "./alpha": "./src/alpha.ts", diff --git a/workspaces/app-defaults/plugins/app-auth/report-alpha.api.md b/workspaces/app-defaults/plugins/app-auth/report-alpha.api.md index 9ce963d7e71..ee2ecd14e61 100644 --- a/workspaces/app-defaults/plugins/app-auth/report-alpha.api.md +++ b/workspaces/app-defaults/plugins/app-auth/report-alpha.api.md @@ -3,42 +3,8 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { ApiRef } from '@backstage/core-plugin-api'; -import { BackstageIdentityApi } from '@backstage/core-plugin-api'; -import { FrontendModule } from '@backstage/frontend-plugin-api'; -import { OAuthApi } from '@backstage/core-plugin-api'; -import { OpenIdConnectApi } from '@backstage/core-plugin-api'; -import { ProfileInfoApi } from '@backstage/core-plugin-api'; -import { SessionApi } from '@backstage/core-plugin-api'; import { TranslationRef } from '@backstage/frontend-plugin-api'; -// @alpha -const appAuthModule: FrontendModule; -export { appAuthModule }; -export default appAuthModule; - -// @alpha -export const auth0AuthApiRef: ApiRef; - -// @alpha -export type CustomAuthApiRefType = OAuthApi & - OpenIdConnectApi & - ProfileInfoApi & - BackstageIdentityApi & - SessionApi; - -// @alpha -export const keycloakAuthApiRef: ApiRef; - -// @alpha -export const oidcAuthApiRef: ApiRef; - -// @alpha -export const pingfederateAuthApiRef: ApiRef; - -// @alpha -export const samlAuthApiRef: ApiRef; - // @alpha export const signInTranslationRef: TranslationRef< 'plugin.app-auth.sign-in', diff --git a/workspaces/app-defaults/plugins/app-auth/report.api.md b/workspaces/app-defaults/plugins/app-auth/report.api.md index 931c08c4ca2..311bec429c2 100644 --- a/workspaces/app-defaults/plugins/app-auth/report.api.md +++ b/workspaces/app-defaults/plugins/app-auth/report.api.md @@ -3,7 +3,38 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts +import { ApiRef } from '@backstage/core-plugin-api'; +import { BackstageIdentityApi } from '@backstage/core-plugin-api'; +import { FrontendModule } from '@backstage/frontend-plugin-api'; +import { OAuthApi } from '@backstage/core-plugin-api'; +import { OpenIdConnectApi } from '@backstage/core-plugin-api'; +import { ProfileInfoApi } from '@backstage/core-plugin-api'; +import { SessionApi } from '@backstage/core-plugin-api'; + +// @public +const appAuthModule: FrontendModule; +export { appAuthModule }; +export default appAuthModule; + +// @public +export const auth0AuthApiRef: ApiRef; + +// @public +export type CustomAuthApiRefType = OAuthApi & + OpenIdConnectApi & + ProfileInfoApi & + BackstageIdentityApi & + SessionApi; + +// @public +export const keycloakAuthApiRef: ApiRef; + +// @public +export const oidcAuthApiRef: ApiRef; + +// @public +export const pingfederateAuthApiRef: ApiRef; + // @public -const _default: {}; -export default _default; +export const samlAuthApiRef: ApiRef; ``` diff --git a/workspaces/app-defaults/plugins/app-auth/src/AuthApiRefs.ts b/workspaces/app-defaults/plugins/app-auth/src/AuthApiRefs.ts index 2e30bab554b..3fde0dae3a1 100644 --- a/workspaces/app-defaults/plugins/app-auth/src/AuthApiRefs.ts +++ b/workspaces/app-defaults/plugins/app-auth/src/AuthApiRefs.ts @@ -27,7 +27,7 @@ import { /** * Combined surface for custom RHDH auth APIs backed by `OAuth2` in the app module. * - * @alpha + * @public */ export type CustomAuthApiRefType = OAuthApi & OpenIdConnectApi & @@ -38,7 +38,7 @@ export type CustomAuthApiRefType = OAuthApi & /** * OIDC auth API for the RHDH multi-provider sign-in page. * - * @alpha + * @public */ export const oidcAuthApiRef: ApiRef = createApiRef({ id: 'internal.auth.oidc', @@ -47,7 +47,7 @@ export const oidcAuthApiRef: ApiRef = createApiRef({ /** * Keycloak auth API for the RHDH multi-provider sign-in page (OIDC-backed). * - * @alpha + * @public */ export const keycloakAuthApiRef: ApiRef = createApiRef({ id: 'internal.auth.keycloak', @@ -56,7 +56,7 @@ export const keycloakAuthApiRef: ApiRef = createApiRef({ /** * PingFederate auth API for the RHDH multi-provider sign-in page (OIDC-backed). * - * @alpha + * @public */ export const pingfederateAuthApiRef: ApiRef = createApiRef({ @@ -66,7 +66,7 @@ export const pingfederateAuthApiRef: ApiRef = /** * Auth0 auth API for the RHDH multi-provider sign-in page. * - * @alpha + * @public */ export const auth0AuthApiRef: ApiRef = createApiRef({ id: 'internal.auth.auth0', @@ -75,7 +75,7 @@ export const auth0AuthApiRef: ApiRef = createApiRef({ /** * SAML auth API for the RHDH multi-provider sign-in page. * - * @alpha + * @public */ export const samlAuthApiRef: ApiRef = createApiRef({ id: 'internal.auth.saml', diff --git a/workspaces/app-defaults/plugins/app-auth/src/alpha.ts b/workspaces/app-defaults/plugins/app-auth/src/alpha.ts index 5b9240fe634..22f127e7c43 100644 --- a/workspaces/app-defaults/plugins/app-auth/src/alpha.ts +++ b/workspaces/app-defaults/plugins/app-auth/src/alpha.ts @@ -15,17 +15,9 @@ */ /** - * New Frontend System: RHDH sign-in and auth API extensions for the app plugin. - * - * The sign-in page UI is not re-exported here — it loads via - * {@link appAuthModule}'s SignInPageBlueprint loader so MUI / core-components - * stay off the Module Federation alpha sync chunk. + * Alpha exports: sign-in page translations. * * @packageDocumentation */ -export { appAuthModule } from './appAuthModule'; -export * from './AuthApiRefs'; export * from './translations/signIn'; - -export { appAuthModule as default } from './appAuthModule'; diff --git a/workspaces/app-defaults/plugins/app-auth/src/appAuthModule.tsx b/workspaces/app-defaults/plugins/app-auth/src/appAuthModule.tsx index 952513789e2..a8d74ee8d7d 100644 --- a/workspaces/app-defaults/plugins/app-auth/src/appAuthModule.tsx +++ b/workspaces/app-defaults/plugins/app-auth/src/appAuthModule.tsx @@ -172,7 +172,7 @@ const signInPage = SignInPageBlueprint.make({ * RHDH app sign-in page plus OIDC, Keycloak, PingFederate, Auth0, and SAML OAuth2 frontend APIs (`pluginId: app`). * Default-export this module for dynamic frontend loading. * - * @alpha + * @public */ export const appAuthModule = createFrontendModule({ pluginId: 'app', diff --git a/workspaces/app-defaults/plugins/app-auth/src/index.ts b/workspaces/app-defaults/plugins/app-auth/src/index.ts index 096e162e2c3..81eb0b035d0 100644 --- a/workspaces/app-defaults/plugins/app-auth/src/index.ts +++ b/workspaces/app-defaults/plugins/app-auth/src/index.ts @@ -15,9 +15,12 @@ */ /** - * Stub package root export for API reporting and bundlers. This plugin targets - * the new frontend system only; use `./alpha` for public APIs. + * RHDH sign-in and auth API extensions for the app plugin. * * @packageDocumentation */ -export default {}; + +export { appAuthModule } from './appAuthModule'; +export * from './AuthApiRefs'; + +export { appAuthModule as default } from './appAuthModule'; diff --git a/workspaces/app-defaults/plugins/app-defaults/package.json b/workspaces/app-defaults/plugins/app-defaults/package.json index f9813264c80..d6f0cd6c5d8 100644 --- a/workspaces/app-defaults/plugins/app-defaults/package.json +++ b/workspaces/app-defaults/plugins/app-defaults/package.json @@ -2,19 +2,15 @@ "name": "@red-hat-developer-hub/backstage-plugin-app-defaults", "version": "0.0.3", "license": "Apache-2.0", - "description": "Empty RHDH app module for the new frontend system", - "main": "src/alpha.ts", - "types": "src/alpha.ts", + "description": "RHDH app module for the new frontend system", + "main": "src/index.ts", + "types": "src/index.ts", "exports": { ".": "./src/index.ts", - "./alpha": "./src/alpha.ts", "./package.json": "./package.json" }, "typesVersions": { "*": { - "alpha": [ - "src/alpha.ts" - ], "package.json": [ "package.json" ] diff --git a/workspaces/app-defaults/plugins/app-defaults/report.api.md b/workspaces/app-defaults/plugins/app-defaults/report.api.md index ef1d82ee4ac..5463d2b2442 100644 --- a/workspaces/app-defaults/plugins/app-defaults/report.api.md +++ b/workspaces/app-defaults/plugins/app-defaults/report.api.md @@ -3,7 +3,10 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts +import { FrontendModule } from '@backstage/frontend-plugin-api'; + // @public -const _default: {}; -export default _default; +const appDefaultsModule: FrontendModule; +export { appDefaultsModule }; +export default appDefaultsModule; ``` diff --git a/workspaces/app-defaults/plugins/app-defaults/src/appDefaultsModule.ts b/workspaces/app-defaults/plugins/app-defaults/src/appDefaultsModule.ts index c8c7571beca..66565ca2926 100644 --- a/workspaces/app-defaults/plugins/app-defaults/src/appDefaultsModule.ts +++ b/workspaces/app-defaults/plugins/app-defaults/src/appDefaultsModule.ts @@ -15,14 +15,14 @@ */ import { createFrontendModule } from '@backstage/frontend-plugin-api'; -import { appDrawerExtension } from '@red-hat-developer-hub/backstage-plugin-app-react/alpha'; +import { appDrawerExtension } from '@red-hat-developer-hub/backstage-plugin-app-react'; /** * RHDH app module for `pluginId: 'app'`. * Provides the application drawer system for dockable panel extensions. * Default-export this module for dynamic frontend loading. * - * @alpha + * @public */ export const appDefaultsModule = createFrontendModule({ pluginId: 'app', diff --git a/workspaces/app-defaults/plugins/app-defaults/src/index.ts b/workspaces/app-defaults/plugins/app-defaults/src/index.ts index 096e162e2c3..1ec5454f7e6 100644 --- a/workspaces/app-defaults/plugins/app-defaults/src/index.ts +++ b/workspaces/app-defaults/plugins/app-defaults/src/index.ts @@ -15,9 +15,11 @@ */ /** - * Stub package root export for API reporting and bundlers. This plugin targets - * the new frontend system only; use `./alpha` for public APIs. + * RHDH app module for the new frontend system. * * @packageDocumentation */ -export default {}; + +export { appDefaultsModule } from './appDefaultsModule'; + +export { appDefaultsModule as default } from './appDefaultsModule'; diff --git a/workspaces/app-defaults/plugins/app-integrations/package.json b/workspaces/app-defaults/plugins/app-integrations/package.json index 74cf0b112a2..f76f30f2879 100644 --- a/workspaces/app-defaults/plugins/app-integrations/package.json +++ b/workspaces/app-defaults/plugins/app-integrations/package.json @@ -3,8 +3,8 @@ "version": "0.1.1", "license": "Apache-2.0", "description": "RHDH default SCM integrations and scmAuth wiring for the new frontend system", - "main": "src/alpha.ts", - "types": "src/alpha.ts", + "main": "src/index.ts", + "types": "src/index.ts", "exports": { ".": "./src/index.ts", "./alpha": "./src/alpha.ts", diff --git a/workspaces/app-defaults/plugins/app-integrations/report-alpha.api.md b/workspaces/app-defaults/plugins/app-integrations/report-alpha.api.md index bcc9fba14ce..bf00c8c92bd 100644 --- a/workspaces/app-defaults/plugins/app-integrations/report-alpha.api.md +++ b/workspaces/app-defaults/plugins/app-integrations/report-alpha.api.md @@ -4,15 +4,9 @@ ```ts import type { ConfigApi } from '@backstage/core-plugin-api'; -import { FrontendModule } from '@backstage/frontend-plugin-api'; import type { OAuthApi } from '@backstage/core-plugin-api'; import { ScmAuthApi } from '@backstage/integration-react'; -// @alpha -const appIntegrationsModule: FrontendModule; -export { appIntegrationsModule }; -export default appIntegrationsModule; - // @alpha export function mergeScmAuthFromDeps(deps: ScmAuthFactoryDeps): ScmAuthApi; diff --git a/workspaces/app-defaults/plugins/app-integrations/report.api.md b/workspaces/app-defaults/plugins/app-integrations/report.api.md index 74eff2b725a..bd3ef5e1eeb 100644 --- a/workspaces/app-defaults/plugins/app-integrations/report.api.md +++ b/workspaces/app-defaults/plugins/app-integrations/report.api.md @@ -3,7 +3,10 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts +import { FrontendModule } from '@backstage/frontend-plugin-api'; + // @public -const _default: {}; -export default _default; +const appIntegrationsModule: FrontendModule; +export { appIntegrationsModule }; +export default appIntegrationsModule; ``` diff --git a/workspaces/app-defaults/plugins/app-integrations/src/alpha.ts b/workspaces/app-defaults/plugins/app-integrations/src/alpha.ts index ff4b8836ede..0ad20e4d8bf 100644 --- a/workspaces/app-defaults/plugins/app-integrations/src/alpha.ts +++ b/workspaces/app-defaults/plugins/app-integrations/src/alpha.ts @@ -15,13 +15,10 @@ */ /** - * New Frontend System: default SCM integrations APIs for the app plugin. + * Alpha exports: SCM auth merge utility. * * @packageDocumentation */ -export { appIntegrationsModule } from './appIntegrationsModule'; export { mergeScmAuthFromDeps } from './mergeScmAuthFromDeps'; export type { ScmAuthFactoryDeps } from './mergeScmAuthFromDeps'; - -export { appIntegrationsModule as default } from './appIntegrationsModule'; diff --git a/workspaces/app-defaults/plugins/app-integrations/src/appIntegrationsModule.tsx b/workspaces/app-defaults/plugins/app-integrations/src/appIntegrationsModule.tsx index df9bb778b35..377f6589bfd 100644 --- a/workspaces/app-defaults/plugins/app-integrations/src/appIntegrationsModule.tsx +++ b/workspaces/app-defaults/plugins/app-integrations/src/appIntegrationsModule.tsx @@ -70,7 +70,7 @@ const scmAuthApi = ApiBlueprint.make({ * RHDH-style `scmIntegrationsApiRef` + `scmAuthApiRef` for `pluginId: 'app'`. * Default-export this module for dynamic frontend loading. * - * @alpha + * @public */ export const appIntegrationsModule = createFrontendModule({ pluginId: 'app', diff --git a/workspaces/app-defaults/plugins/app-integrations/src/index.ts b/workspaces/app-defaults/plugins/app-integrations/src/index.ts index 096e162e2c3..dd9ce7d0243 100644 --- a/workspaces/app-defaults/plugins/app-integrations/src/index.ts +++ b/workspaces/app-defaults/plugins/app-integrations/src/index.ts @@ -15,9 +15,11 @@ */ /** - * Stub package root export for API reporting and bundlers. This plugin targets - * the new frontend system only; use `./alpha` for public APIs. + * RHDH default SCM integrations APIs for the app plugin. * * @packageDocumentation */ -export default {}; + +export { appIntegrationsModule } from './appIntegrationsModule'; + +export { appIntegrationsModule as default } from './appIntegrationsModule'; diff --git a/workspaces/app-defaults/plugins/app-react/package.json b/workspaces/app-defaults/plugins/app-react/package.json index cfff5c5649c..f935659132c 100644 --- a/workspaces/app-defaults/plugins/app-react/package.json +++ b/workspaces/app-defaults/plugins/app-react/package.json @@ -7,13 +7,17 @@ "types": "src/index.ts", "exports": { ".": "./src/index.ts", - "./alpha": "./src/alpha.ts", + "./legacy": "./src/legacy/index.ts", + "./app-drawer-module": "./src/appDrawerModuleExport.ts", "./package.json": "./package.json" }, "typesVersions": { "*": { - "alpha": [ - "src/alpha.ts" + "legacy": [ + "src/legacy/index.ts" + ], + "app-drawer-module": [ + "src/appDrawerModuleExport.ts" ], "package.json": [ "package.json" diff --git a/workspaces/app-defaults/plugins/app-react/report-alpha.api.md b/workspaces/app-defaults/plugins/app-react/report-alpha.api.md deleted file mode 100644 index 37c2c230579..00000000000 --- a/workspaces/app-defaults/plugins/app-react/report-alpha.api.md +++ /dev/null @@ -1,130 +0,0 @@ -## API Report File for "@red-hat-developer-hub/backstage-plugin-app-react" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api'; -import { ExtensionBlueprint } from '@backstage/frontend-plugin-api'; -import { ExtensionDataRef } from '@backstage/frontend-plugin-api'; -import { ExtensionInput } from '@backstage/frontend-plugin-api'; -import { FrontendModule } from '@backstage/frontend-plugin-api'; -import { JSX as JSX_2 } from 'react/jsx-runtime'; -import { OverridableExtensionDefinition } from '@backstage/frontend-plugin-api'; -import { ReactNode } from 'react'; - -// @public -export interface AppDrawerApi { - activeDrawerId: string | null; - closeDrawer(id: string): void; - getWidth(id: string): number; - isOpen(id: string): boolean; - openDrawer(id: string): void; - setWidth(id: string, width: number): void; - toggleDrawer(id: string): void; -} - -// @public -export interface AppDrawerContent { - defaultWidth?: number; - element: React.ReactElement; - id: string; - priority?: number; - resizable?: boolean; -} - -// @alpha -export const AppDrawerContentBlueprint: ExtensionBlueprint<{ - kind: 'app-drawer-content'; - params: { - id: string; - element: React.ReactElement; - resizable?: boolean; - defaultWidth?: number; - priority?: number; - }; - output: ExtensionDataRef; - inputs: {}; - config: { - defaultWidth: number | undefined; - resizable: boolean | undefined; - priority: number | undefined; - }; - configInput: { - defaultWidth?: number | undefined; - resizable?: boolean | undefined; - priority?: number | undefined; - }; - dataRefs: { - content: ConfigurableExtensionDataRef< - AppDrawerContent, - 'app.drawer.content', - {} - >; - }; -}>; - -// @alpha -export const appDrawerContentDataRef: ConfigurableExtensionDataRef< - AppDrawerContent, - 'app.drawer.content', - {} ->; - -// @alpha -export const appDrawerExtension: OverridableExtensionDefinition<{ - config: {}; - configInput: {}; - output: ExtensionDataRef< - (props: { children: ReactNode }) => JSX.Element | null, - 'app.root.wrapper', - {} - >; - inputs: { - drawers: ExtensionInput< - ConfigurableExtensionDataRef, - { - singleton: false; - optional: false; - internal: false; - } - >; - }; - kind: 'app-root-wrapper'; - name: 'drawer'; - params: { - Component?: [error: 'Use the `component` parameter instead']; - component: (props: { children: ReactNode }) => JSX.Element | null; - }; -}>; - -// @alpha -export const appDrawerModule: FrontendModule; - -// @public -export const ApplicationDrawer: ( - input: ApplicationDrawerProps, -) => JSX_2.Element; - -// @public -export interface ApplicationDrawerProps { - children: React.ReactNode; - contents: AppDrawerContent[]; -} - -// @public -export const DrawerPanel: (props: DrawerPanelProps) => JSX_2.Element; - -// @public -export interface DrawerPanelProps { - children: React.ReactNode; - drawerWidth?: number; - isDrawerOpen: boolean; - isResizable?: boolean; - maxWidth?: number; - minWidth?: number; - onWidthChange?: (width: number) => void; -} - -// @public -export const useAppDrawer: () => AppDrawerApi; -``` diff --git a/workspaces/app-defaults/plugins/app-defaults/report-alpha.api.md b/workspaces/app-defaults/plugins/app-react/report-app-drawer-module.api.md similarity index 61% rename from workspaces/app-defaults/plugins/app-defaults/report-alpha.api.md rename to workspaces/app-defaults/plugins/app-react/report-app-drawer-module.api.md index 6c9ccfd85f3..f25a8faed46 100644 --- a/workspaces/app-defaults/plugins/app-defaults/report-alpha.api.md +++ b/workspaces/app-defaults/plugins/app-react/report-app-drawer-module.api.md @@ -1,12 +1,13 @@ -## API Report File for "@red-hat-developer-hub/backstage-plugin-app-defaults" +## API Report File for "@red-hat-developer-hub/backstage-plugin-app-react" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { FrontendModule } from '@backstage/frontend-plugin-api'; -// @alpha -const appDefaultsModule: FrontendModule; -export { appDefaultsModule }; -export default appDefaultsModule; +// @public +const appDrawerModule: FrontendModule; +export default appDrawerModule; + +// (No @packageDocumentation comment for this package) ``` diff --git a/workspaces/app-defaults/plugins/app-react/report-legacy.api.md b/workspaces/app-defaults/plugins/app-react/report-legacy.api.md new file mode 100644 index 00000000000..8a8e0cc5f73 --- /dev/null +++ b/workspaces/app-defaults/plugins/app-react/report-legacy.api.md @@ -0,0 +1,55 @@ +## API Report File for "@red-hat-developer-hub/backstage-plugin-app-react" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { JSX as JSX_2 } from 'react/jsx-runtime'; + +// @public +export interface AppDrawerApi { + activeDrawerId: string | null; + closeDrawer(id: string): void; + getWidth(id: string): number; + isOpen(id: string): boolean; + openDrawer(id: string): void; + setWidth(id: string, width: number): void; + toggleDrawer(id: string): void; +} + +// @public +export interface AppDrawerContent { + defaultWidth?: number; + element: React.ReactElement; + id: string; + priority?: number; + resizable?: boolean; +} + +// @public +export const ApplicationDrawer: ( + input: ApplicationDrawerProps, +) => JSX_2.Element; + +// @public +export interface ApplicationDrawerProps { + children: React.ReactNode; + contents: AppDrawerContent[]; +} + +// @public +export const DrawerPanel: (props: DrawerPanelProps) => JSX_2.Element; + +// @public +export interface DrawerPanelProps { + children: React.ReactNode; + drawerWidth?: number; + isDrawerOpen: boolean; + isResizable?: boolean; + maxWidth?: number; + minWidth?: number; + onWidthChange?: (width: number) => void; +} + +// @public +export const useAppDrawer: () => AppDrawerApi; +``` diff --git a/workspaces/app-defaults/plugins/app-react/report.api.md b/workspaces/app-defaults/plugins/app-react/report.api.md index 8a8e0cc5f73..3097992b418 100644 --- a/workspaces/app-defaults/plugins/app-react/report.api.md +++ b/workspaces/app-defaults/plugins/app-react/report.api.md @@ -3,7 +3,13 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { JSX as JSX_2 } from 'react/jsx-runtime'; +import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api'; +import { ExtensionBlueprint } from '@backstage/frontend-plugin-api'; +import { ExtensionDataRef } from '@backstage/frontend-plugin-api'; +import { ExtensionInput } from '@backstage/frontend-plugin-api'; +import { FrontendModule } from '@backstage/frontend-plugin-api'; +import { OverridableExtensionDefinition } from '@backstage/frontend-plugin-api'; +import { ReactNode } from 'react'; // @public export interface AppDrawerApi { @@ -26,9 +32,72 @@ export interface AppDrawerContent { } // @public -export const ApplicationDrawer: ( - input: ApplicationDrawerProps, -) => JSX_2.Element; +export const AppDrawerContentBlueprint: ExtensionBlueprint<{ + kind: 'app-drawer-content'; + params: { + id: string; + element: React.ReactElement; + resizable?: boolean; + defaultWidth?: number; + priority?: number; + }; + output: ExtensionDataRef; + inputs: {}; + config: { + defaultWidth: number | undefined; + resizable: boolean | undefined; + priority: number | undefined; + }; + configInput: { + defaultWidth?: number | undefined; + resizable?: boolean | undefined; + priority?: number | undefined; + }; + dataRefs: { + content: ConfigurableExtensionDataRef< + AppDrawerContent, + 'app.drawer.content', + {} + >; + }; +}>; + +// @public +export const appDrawerContentDataRef: ConfigurableExtensionDataRef< + AppDrawerContent, + 'app.drawer.content', + {} +>; + +// @public +export const appDrawerExtension: OverridableExtensionDefinition<{ + config: {}; + configInput: {}; + output: ExtensionDataRef< + (props: { children: ReactNode }) => JSX.Element | null, + 'app.root.wrapper', + {} + >; + inputs: { + drawers: ExtensionInput< + ConfigurableExtensionDataRef, + { + singleton: false; + optional: false; + internal: false; + } + >; + }; + kind: 'app-root-wrapper'; + name: 'drawer'; + params: { + Component?: [error: 'Use the `component` parameter instead']; + component: (props: { children: ReactNode }) => JSX.Element | null; + }; +}>; + +// @public +export const appDrawerModule: FrontendModule; // @public export interface ApplicationDrawerProps { @@ -36,9 +105,6 @@ export interface ApplicationDrawerProps { contents: AppDrawerContent[]; } -// @public -export const DrawerPanel: (props: DrawerPanelProps) => JSX_2.Element; - // @public export interface DrawerPanelProps { children: React.ReactNode; diff --git a/workspaces/app-defaults/plugins/app-react/src/alpha.ts b/workspaces/app-defaults/plugins/app-react/src/appDrawerModuleExport.ts similarity index 82% rename from workspaces/app-defaults/plugins/app-react/src/alpha.ts rename to workspaces/app-defaults/plugins/app-react/src/appDrawerModuleExport.ts index 929f9910529..cbce1675ca4 100644 --- a/workspaces/app-defaults/plugins/app-react/src/alpha.ts +++ b/workspaces/app-defaults/plugins/app-react/src/appDrawerModuleExport.ts @@ -14,10 +14,4 @@ * limitations under the License. */ -/** - * New Frontend System extension APIs for the RHDH app shell. - * - * @packageDocumentation - */ - -export * from './drawer'; +export { appDrawerModule as default } from './drawer'; diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/AppDrawerContentBlueprint.ts b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/AppDrawerContentBlueprint.ts index f89edfe8be4..a9e23c1a2e1 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/AppDrawerContentBlueprint.ts +++ b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/AppDrawerContentBlueprint.ts @@ -46,7 +46,7 @@ import { appDrawerContentDataRef } from './appDrawerContentDataRef'; * }); * ``` * - * @alpha + * @public */ export const AppDrawerContentBlueprint = createExtensionBlueprint({ kind: 'app-drawer-content', diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerContentDataRef.ts b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerContentDataRef.ts index 0e60978528e..57e087378ba 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerContentDataRef.ts +++ b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerContentDataRef.ts @@ -21,7 +21,7 @@ import type { AppDrawerContent } from '../types'; /** * Extension data ref carrying drawer content from a plugin to the host. * - * @alpha + * @public */ export const appDrawerContentDataRef = createExtensionDataRef().with({ diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerModule.tsx b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerModule.tsx index 06a6b05c69e..8981b56e4fe 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerModule.tsx +++ b/workspaces/app-defaults/plugins/app-react/src/drawer/extensions/appDrawerModule.tsx @@ -20,7 +20,7 @@ import { } from '@backstage/frontend-plugin-api'; import { AppRootWrapperBlueprint } from '@backstage/plugin-app-react'; -import { ApplicationDrawer } from '../components/ApplicationDrawer'; +import { ApplicationDrawer } from '../../legacy/ApplicationDrawer'; import { appDrawerContentDataRef } from './appDrawerContentDataRef'; /** @@ -31,7 +31,7 @@ import { appDrawerContentDataRef } from './appDrawerContentDataRef'; * Drawer state is managed by a global singleton store (see drawerStore.ts) * rather than a React context provider. * - * @alpha + * @public */ export const appDrawerExtension = AppRootWrapperBlueprint.makeWithOverrides({ name: 'drawer', @@ -53,7 +53,7 @@ export const appDrawerExtension = AppRootWrapperBlueprint.makeWithOverrides({ * Registers a wrapper extension that renders the drawer and accepts * drawer content contributions via inputs. * - * @alpha + * @public */ export const appDrawerModule = createFrontendModule({ pluginId: 'app', diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/index.ts b/workspaces/app-defaults/plugins/app-react/src/drawer/index.ts index 6b78d06a728..d316ca04a8f 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/index.ts +++ b/workspaces/app-defaults/plugins/app-react/src/drawer/index.ts @@ -15,8 +15,8 @@ */ export { useAppDrawer } from './hooks/useAppDrawer'; -export { ApplicationDrawer } from './components/ApplicationDrawer'; -export { DrawerPanel } from './components/DrawerPanel'; +export { ApplicationDrawer } from '../legacy/ApplicationDrawer'; +export { DrawerPanel } from '../legacy/DrawerPanel'; export { appDrawerContentDataRef } from './extensions/appDrawerContentDataRef'; export { AppDrawerContentBlueprint } from './extensions/AppDrawerContentBlueprint'; @@ -25,6 +25,6 @@ export { appDrawerModule, } from './extensions/appDrawerModule'; -export type { ApplicationDrawerProps } from './components/ApplicationDrawer'; -export type { DrawerPanelProps } from './components/DrawerPanel'; +export type { ApplicationDrawerProps } from '../legacy/ApplicationDrawer'; +export type { DrawerPanelProps } from '../legacy/DrawerPanel'; export type { AppDrawerContent, AppDrawerApi } from './types'; diff --git a/workspaces/app-defaults/plugins/app-react/src/index.ts b/workspaces/app-defaults/plugins/app-react/src/index.ts index aeab03915dd..1bb1ca675a4 100644 --- a/workspaces/app-defaults/plugins/app-react/src/index.ts +++ b/workspaces/app-defaults/plugins/app-react/src/index.ts @@ -15,14 +15,16 @@ */ /** - * Shared UI components and hooks for the RHDH app shell. + * Shared UI components and extension APIs for the RHDH app shell. * * @packageDocumentation */ +export { AppDrawerContentBlueprint } from './drawer'; +export { appDrawerContentDataRef } from './drawer'; +export { appDrawerExtension, appDrawerModule } from './drawer'; + export { useAppDrawer } from './drawer'; -export { ApplicationDrawer } from './drawer'; -export { DrawerPanel } from './drawer'; +export type { AppDrawerContent, AppDrawerApi } from './drawer'; export type { ApplicationDrawerProps } from './drawer'; export type { DrawerPanelProps } from './drawer'; -export type { AppDrawerContent, AppDrawerApi } from './drawer'; diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.test.tsx b/workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.test.tsx similarity index 94% rename from workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.test.tsx rename to workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.test.tsx index 315e96cfa56..d61a5c01fb2 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.test.tsx +++ b/workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.test.tsx @@ -16,10 +16,10 @@ import { render, screen, act } from '@testing-library/react'; -import { useAppDrawer } from '../hooks/useAppDrawer'; -import { drawerStore } from '../utils/drawerStore'; +import { useAppDrawer } from '../drawer/hooks/useAppDrawer'; +import { drawerStore } from '../drawer/utils/drawerStore'; import { ApplicationDrawer } from './ApplicationDrawer'; -import type { AppDrawerContent } from '../types'; +import type { AppDrawerContent } from '../drawer/types'; function OpenButton({ id }: { id: string }) { const { openDrawer } = useAppDrawer(); diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.tsx b/workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.tsx similarity index 95% rename from workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.tsx rename to workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.tsx index eba500ed8f7..83883ec9bbf 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/components/ApplicationDrawer.tsx +++ b/workspaces/app-defaults/plugins/app-react/src/legacy/ApplicationDrawer.tsx @@ -16,14 +16,14 @@ import { useEffect, useRef } from 'react'; -import { useAppDrawer } from '../hooks/useAppDrawer'; +import { useAppDrawer } from '../drawer/hooks/useAppDrawer'; import { DrawerPanel } from './DrawerPanel'; -import type { AppDrawerContent } from '../types'; +import type { AppDrawerContent } from '../drawer/types'; const DEFAULT_WIDTH = 500; /** - * Props for {@link ApplicationDrawer}. + * Props for ApplicationDrawer. * * @public */ diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/components/DrawerPanel.test.tsx b/workspaces/app-defaults/plugins/app-react/src/legacy/DrawerPanel.test.tsx similarity index 100% rename from workspaces/app-defaults/plugins/app-react/src/drawer/components/DrawerPanel.test.tsx rename to workspaces/app-defaults/plugins/app-react/src/legacy/DrawerPanel.test.tsx diff --git a/workspaces/app-defaults/plugins/app-react/src/drawer/components/DrawerPanel.tsx b/workspaces/app-defaults/plugins/app-react/src/legacy/DrawerPanel.tsx similarity index 99% rename from workspaces/app-defaults/plugins/app-react/src/drawer/components/DrawerPanel.tsx rename to workspaces/app-defaults/plugins/app-react/src/legacy/DrawerPanel.tsx index 02c4fdaa7c1..ca6dc8e6365 100644 --- a/workspaces/app-defaults/plugins/app-react/src/drawer/components/DrawerPanel.tsx +++ b/workspaces/app-defaults/plugins/app-react/src/legacy/DrawerPanel.tsx @@ -20,7 +20,7 @@ import Box from '@mui/material/Box'; import Drawer from '@mui/material/Drawer'; /** - * Props for {@link DrawerPanel}. + * Props for DrawerPanel. * * @public */ diff --git a/workspaces/app-defaults/plugins/app-defaults/src/alpha.ts b/workspaces/app-defaults/plugins/app-react/src/legacy/index.ts similarity index 52% rename from workspaces/app-defaults/plugins/app-defaults/src/alpha.ts rename to workspaces/app-defaults/plugins/app-react/src/legacy/index.ts index 92b528fad2c..688ac14e009 100644 --- a/workspaces/app-defaults/plugins/app-defaults/src/alpha.ts +++ b/workspaces/app-defaults/plugins/app-react/src/legacy/index.ts @@ -15,11 +15,17 @@ */ /** - * New Frontend System: empty app module for the app plugin. + * Legacy (OFS) direct-component API surface for the RHDH app drawer. + * + * @deprecated Migrate to the NFS extension API: + * `import { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react'` * * @packageDocumentation */ -export { appDefaultsModule } from './appDefaultsModule'; - -export { appDefaultsModule as default } from './appDefaultsModule'; +export { useAppDrawer } from '../drawer/hooks/useAppDrawer'; +export { ApplicationDrawer } from './ApplicationDrawer'; +export { DrawerPanel } from './DrawerPanel'; +export type { ApplicationDrawerProps } from './ApplicationDrawer'; +export type { DrawerPanelProps } from './DrawerPanel'; +export type { AppDrawerContent, AppDrawerApi } from '../drawer/types';