@backstage/frontend-plugin-api 0.15.0-next.1 → 0.15.1

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/dist/alpha.d.ts +6 -71
  3. package/dist/alpha.esm.js +4 -0
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/analytics/useAnalytics.esm.js +2 -0
  6. package/dist/analytics/useAnalytics.esm.js.map +1 -1
  7. package/dist/apis/definitions/AlertApi.esm.js +3 -2
  8. package/dist/apis/definitions/AlertApi.esm.js.map +1 -1
  9. package/dist/apis/definitions/AnalyticsApi.esm.js +3 -2
  10. package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
  11. package/dist/apis/definitions/AppLanguageApi.esm.js +3 -2
  12. package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -1
  13. package/dist/apis/definitions/AppThemeApi.esm.js +3 -2
  14. package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -1
  15. package/dist/apis/definitions/AppTreeApi.esm.js +4 -1
  16. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
  17. package/dist/apis/definitions/ConfigApi.esm.js +3 -2
  18. package/dist/apis/definitions/ConfigApi.esm.js.map +1 -1
  19. package/dist/apis/definitions/DialogApi.esm.js +3 -2
  20. package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
  21. package/dist/apis/definitions/DiscoveryApi.esm.js +3 -2
  22. package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -1
  23. package/dist/apis/definitions/ErrorApi.esm.js +3 -2
  24. package/dist/apis/definitions/ErrorApi.esm.js.map +1 -1
  25. package/dist/apis/definitions/FeatureFlagsApi.esm.js +3 -2
  26. package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -1
  27. package/dist/apis/definitions/FetchApi.esm.js +3 -2
  28. package/dist/apis/definitions/FetchApi.esm.js.map +1 -1
  29. package/dist/apis/definitions/IconsApi.esm.js +3 -2
  30. package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
  31. package/dist/apis/definitions/IdentityApi.esm.js +3 -2
  32. package/dist/apis/definitions/IdentityApi.esm.js.map +1 -1
  33. package/dist/apis/definitions/OAuthRequestApi.esm.js +3 -2
  34. package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -1
  35. package/dist/apis/definitions/PluginHeaderActionsApi.esm.js +3 -2
  36. package/dist/apis/definitions/PluginHeaderActionsApi.esm.js.map +1 -1
  37. package/dist/apis/definitions/PluginWrapperApi.esm.js +7 -3
  38. package/dist/apis/definitions/PluginWrapperApi.esm.js.map +1 -1
  39. package/dist/apis/definitions/RouteResolutionApi.esm.js +3 -2
  40. package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
  41. package/dist/apis/definitions/StorageApi.esm.js +3 -2
  42. package/dist/apis/definitions/StorageApi.esm.js.map +1 -1
  43. package/dist/apis/definitions/SwappableComponentsApi.esm.js +3 -2
  44. package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
  45. package/dist/apis/definitions/ToastApi.esm.js +11 -0
  46. package/dist/apis/definitions/ToastApi.esm.js.map +1 -0
  47. package/dist/apis/definitions/TranslationApi.esm.js +3 -2
  48. package/dist/apis/definitions/TranslationApi.esm.js.map +1 -1
  49. package/dist/apis/definitions/auth.esm.js +33 -22
  50. package/dist/apis/definitions/auth.esm.js.map +1 -1
  51. package/dist/apis/system/ApiRef.esm.js +28 -20
  52. package/dist/apis/system/ApiRef.esm.js.map +1 -1
  53. package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js +1 -1
  54. package/dist/blueprints/ApiBlueprint.esm.js +1 -1
  55. package/dist/blueprints/AppRootElementBlueprint.esm.js +1 -1
  56. package/dist/blueprints/NavItemBlueprint.esm.js +1 -1
  57. package/dist/blueprints/PageBlueprint.esm.js +38 -7
  58. package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
  59. package/dist/blueprints/PluginHeaderActionBlueprint.esm.js +3 -1
  60. package/dist/blueprints/PluginHeaderActionBlueprint.esm.js.map +1 -1
  61. package/dist/blueprints/PluginWrapperBlueprint.esm.js +4 -2
  62. package/dist/blueprints/PluginWrapperBlueprint.esm.js.map +1 -1
  63. package/dist/blueprints/SubPageBlueprint.esm.js +3 -1
  64. package/dist/blueprints/SubPageBlueprint.esm.js.map +1 -1
  65. package/dist/components/ExtensionBoundary.esm.js +3 -2
  66. package/dist/components/ExtensionBoundary.esm.js.map +1 -1
  67. package/dist/components/PageLayout.esm.js.map +1 -1
  68. package/dist/components/createSwappableComponent.esm.js +2 -0
  69. package/dist/components/createSwappableComponent.esm.js.map +1 -1
  70. package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js +9 -0
  71. package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js.map +1 -0
  72. package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
  73. package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
  74. package/dist/index.d.ts +364 -1442
  75. package/dist/index.esm.js +3 -0
  76. package/dist/index.esm.js.map +1 -1
  77. package/dist/routing/useRouteRef.esm.js +2 -0
  78. package/dist/routing/useRouteRef.esm.js.map +1 -1
  79. package/dist/schema/createSchemaFromZod.esm.js +1 -1
  80. package/dist/schema/createSchemaFromZod.esm.js.map +1 -1
  81. package/dist/translation/useTranslationRef.esm.js +2 -0
  82. package/dist/translation/useTranslationRef.esm.js.map +1 -1
  83. package/dist/types/alpha.d-DzeiOzxk.d.ts +1425 -0
  84. package/dist/wiring/createExtension.esm.js +6 -0
  85. package/dist/wiring/createExtension.esm.js.map +1 -1
  86. package/dist/wiring/createExtensionBlueprint.esm.js +2 -0
  87. package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
  88. package/dist/wiring/createExtensionDataRef.esm.js.map +1 -1
  89. package/dist/wiring/createFrontendModule.esm.js +1 -0
  90. package/dist/wiring/createFrontendModule.esm.js.map +1 -1
  91. package/dist/wiring/createFrontendPlugin.esm.js +6 -0
  92. package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
  93. package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
  94. package/dist/wiring/resolveInputOverrides.esm.js.map +1 -1
  95. package/package.json +11 -10
@@ -1,5 +1,5 @@
1
1
  import '../wiring/coreExtensionData.esm.js';
2
- import 'zod';
2
+ import 'zod/v3';
3
3
  import 'zod-to-json-schema';
4
4
  import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
5
5
  import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { Routes, Route, Navigate } from 'react-router-dom';
3
3
  import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
4
- import 'zod';
4
+ import 'zod/v3';
5
5
  import 'zod-to-json-schema';
6
6
  import { createExtensionInput } from '../wiring/createExtensionInput.esm.js';
7
7
  import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
@@ -21,17 +21,29 @@ import '../apis/definitions/IconsApi.esm.js';
21
21
  import '../apis/definitions/IdentityApi.esm.js';
22
22
  import '../apis/definitions/DialogApi.esm.js';
23
23
  import '../apis/definitions/OAuthRequestApi.esm.js';
24
- import '../apis/definitions/RouteResolutionApi.esm.js';
24
+ import { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi.esm.js';
25
25
  import '../apis/definitions/StorageApi.esm.js';
26
26
  import '../apis/definitions/AnalyticsApi.esm.js';
27
+ import '../apis/definitions/ToastApi.esm.js';
27
28
  import '../apis/definitions/TranslationApi.esm.js';
28
29
  import { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi.esm.js';
30
+ import '../apis/definitions/PluginWrapperApi.esm.js';
29
31
  import { useApi } from '../apis/system/useApi.esm.js';
30
32
  import 'react';
31
33
  import '../components/AppNodeProvider.esm.js';
32
34
  import '../components/DefaultSwappableComponents.esm.js';
33
35
  import { PageLayout } from '../components/PageLayout.esm.js';
34
36
 
37
+ function resolveTitleLink(routeResolutionApi, routeRef) {
38
+ if (!routeRef) {
39
+ return void 0;
40
+ }
41
+ try {
42
+ return routeResolutionApi.resolve(routeRef)?.();
43
+ } catch {
44
+ return void 0;
45
+ }
46
+ }
35
47
  const PageBlueprint = createExtensionBlueprint({
36
48
  kind: "page",
37
49
  attachTo: { id: "app/routes", input: "routes" },
@@ -62,18 +74,24 @@ const PageBlueprint = createExtensionBlueprint({
62
74
  const icon = params.icon;
63
75
  const pluginId = node.spec.plugin.pluginId;
64
76
  const noHeader = params.noHeader ?? false;
77
+ const resolvedTitle = title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;
78
+ const resolvedIcon = icon ?? node.spec.plugin.icon;
79
+ const titleRouteRef = node.spec.plugin.routes.root ?? params.routeRef;
65
80
  yield coreExtensionData.routePath(config.path ?? params.path);
66
81
  if (params.loader) {
67
82
  const loader = params.loader;
68
83
  const PageContent = () => {
84
+ const routeResolutionApi = useApi(routeResolutionApiRef);
85
+ const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);
69
86
  const headerActionsApi = useApi(pluginHeaderActionsApiRef);
70
87
  const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);
71
88
  return /* @__PURE__ */ jsx(
72
89
  PageLayout,
73
90
  {
74
- title: title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId,
75
- icon: icon ?? node.spec.plugin.icon,
91
+ title: resolvedTitle,
92
+ icon: resolvedIcon,
76
93
  noHeader,
94
+ titleLink,
77
95
  headerActions,
78
96
  children: ExtensionBoundary.lazy(node, loader)
79
97
  }
@@ -94,14 +112,17 @@ const PageBlueprint = createExtensionBlueprint({
94
112
  });
95
113
  const PageContent = () => {
96
114
  const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);
115
+ const routeResolutionApi = useApi(routeResolutionApiRef);
116
+ const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);
97
117
  const headerActionsApi = useApi(pluginHeaderActionsApiRef);
98
118
  const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);
99
119
  return /* @__PURE__ */ jsx(
100
120
  PageLayout,
101
121
  {
102
- title,
103
- icon,
122
+ title: resolvedTitle,
123
+ icon: resolvedIcon,
104
124
  tabs,
125
+ titleLink,
105
126
  headerActions,
106
127
  children: /* @__PURE__ */ jsxs(Routes, { children: [
107
128
  firstPagePath && /* @__PURE__ */ jsx(
@@ -123,9 +144,19 @@ const PageBlueprint = createExtensionBlueprint({
123
144
  yield coreExtensionData.reactElement(/* @__PURE__ */ jsx(PageContent, {}));
124
145
  } else {
125
146
  const PageContent = () => {
147
+ const routeResolutionApi = useApi(routeResolutionApiRef);
148
+ const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);
126
149
  const headerActionsApi = useApi(pluginHeaderActionsApiRef);
127
150
  const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);
128
- return /* @__PURE__ */ jsx(PageLayout, { title, icon, headerActions });
151
+ return /* @__PURE__ */ jsx(
152
+ PageLayout,
153
+ {
154
+ title: resolvedTitle,
155
+ icon: resolvedIcon,
156
+ titleLink,
157
+ headerActions
158
+ }
159
+ );
129
160
  };
130
161
  yield coreExtensionData.reactElement(/* @__PURE__ */ jsx(PageContent, {}));
131
162
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PageBlueprint.esm.js","sources":["../../src/blueprints/PageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { JSX } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n },\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId}\n icon={icon ?? node.spec.plugin.icon}\n noHeader={noHeader}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={title}\n icon={icon}\n tabs={tabs}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route key={index} path={`${path}/*`} element={element} />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout title={title} icon={icon} headerActions={headerActions} />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAM,gBAAgB,wBAAA,CAAyB;AAAA,EACpD,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,YAAA,EAAc,OAAO,QAAA,EAAS;AAAA,EAC9C,MAAA,EAAQ;AAAA,IACN,OAAO,oBAAA,CAAqB;AAAA,MAC1B,iBAAA,CAAkB,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,Q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AA,MAExE,CAAA;AACA,MAAA,MAAM,iBAAA,CAAkB,YAAA,iBAAa,GAAA,CAAC,WAAA,EAAA,EAAY,CAAE,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,iBAAA,CAAkB,KAAK,IAAI,CAAA;AAAA,IACnC;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PageBlueprint.esm.js","sources":["../../src/blueprints/PageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { JSX } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\nimport { RouteResolutionApi } from '../apis/definitions/RouteResolutionApi';\n\nfunction resolveTitleLink(\n routeResolutionApi: RouteResolutionApi,\n routeRef: RouteRef | undefined,\n): string | undefined {\n if (!routeRef) {\n return undefined;\n }\n try {\n return routeResolutionApi.resolve(routeRef)?.();\n } catch {\n // Route ref may require params not available in the current context\n return undefined;\n }\n}\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n },\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n const resolvedTitle =\n title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;\n const resolvedIcon = icon ?? node.spec.plugin.icon;\n const titleRouteRef =\n (node.spec.plugin.routes as { root?: RouteRef }).root ?? params.routeRef;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n noHeader={noHeader}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n tabs={tabs}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route key={index} path={`${path}/*`} element={element} />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n titleLink={titleLink}\n headerActions={headerActions}\n />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;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AACA,MAAA,MAAM,iBAAA,CAAkB,YAAA,iBAAa,GAAA,CAAC,WAAA,EAAA,EAAY,CAAE,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,iBAAA,CAAkB,KAAK,IAAI,CAAA;AAAA,IACnC;AAAA,EACF;AACF,CAAC;;;;"}
@@ -19,15 +19,17 @@ import '../apis/definitions/OAuthRequestApi.esm.js';
19
19
  import '../apis/definitions/RouteResolutionApi.esm.js';
20
20
  import '../apis/definitions/StorageApi.esm.js';
21
21
  import '../apis/definitions/AnalyticsApi.esm.js';
22
+ import '../apis/definitions/ToastApi.esm.js';
22
23
  import '../apis/definitions/TranslationApi.esm.js';
23
24
  import '../apis/definitions/PluginHeaderActionsApi.esm.js';
25
+ import '../apis/definitions/PluginWrapperApi.esm.js';
24
26
  import '@backstage/version-bridge';
25
27
  import '@backstage/errors';
26
28
  import '../components/AppNodeProvider.esm.js';
27
29
  import '../components/DefaultSwappableComponents.esm.js';
28
30
  import '../components/PageLayout.esm.js';
29
31
  import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
30
- import 'zod';
32
+ import 'zod/v3';
31
33
  import 'zod-to-json-schema';
32
34
  import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
33
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n} from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n defineParams(params: { loader: () => Promise<JSX.Element> }) {\n return createExtensionBlueprintParams(params);\n },\n *factory(params, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,+BAAA,EAAiC,OAAO,SAAA,EAAU;AAAA,EAClE,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,aAAa,MAAA,EAAgD;AAC3D,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,CAAC,OAAA,CAAQ,MAAA,EAAQ,EAAE,MAAK,EAAG;AACzB,IAAA,MAAM,UAAA,GAAaA,IAAA;AAAA,MAAU,MAC3B,MAAA,CAAO,MAAA,EAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KAC9D;AACA,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,mBAAkB,WAAA,EAC/C,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n} from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n defineParams(params: { loader: () => Promise<JSX.Element> }) {\n return createExtensionBlueprintParams(params);\n },\n *factory(params, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,+BAAA,EAAiC,OAAO,SAAA,EAAU;AAAA,EAClE,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,aAAa,MAAA,EAAgD;AAC3D,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,CAAC,OAAA,CAAQ,MAAA,EAAQ,EAAE,MAAK,EAAG;AACzB,IAAA,MAAM,UAAA,GAAaA,IAAA;AAAA,MAAU,MAC3B,MAAA,CAAO,MAAA,EAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KAC9D;AACA,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,mBAAkB,WAAA,EAC/C,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import '../wiring/coreExtensionData.esm.js';
2
- import 'zod';
2
+ import 'zod/v3';
3
3
  import 'zod-to-json-schema';
4
4
  import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
5
5
  import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
@@ -13,7 +13,9 @@ const PluginWrapperBlueprint = createExtensionBlueprint({
13
13
  wrapper: wrapperDataRef
14
14
  },
15
15
  defineParams(params) {
16
- return createExtensionBlueprintParams(params);
16
+ return createExtensionBlueprintParams(
17
+ params
18
+ );
17
19
  },
18
20
  *factory(params) {
19
21
  yield wrapperDataRef(params.loader);
@@ -1 +1 @@
1
- {"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<{ component: ComponentType<{ children: ReactNode }> }>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @alpha\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams(params: {\n loader: () => Promise<{\n component: ComponentType<{ children: ReactNode }>;\n }>;\n }) {\n return createExtensionBlueprintParams(params);\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,iBAAiB,sBAAA,EAErB,CAAE,KAAK,EAAE,EAAA,EAAI,8BAA8B,CAAA;AAOtC,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,wBAAA,EAA0B,OAAO,UAAA,EAAW;AAAA,EAC5D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,aAAa,MAAA,EAIV;AACD,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,EAC9C,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * Defines the structure of a plugin wrapper, optionally including a shared\n * hook value.\n *\n * @remarks\n *\n * When `useWrapperValue` is provided, the hook is called in a single location\n * in the app and the resulting value is forwarded as the `value` prop to the\n * component. The hook obeys the rules of React hooks and is not called until a\n * component from the plugin is rendered.\n *\n * @public\n */\nexport type PluginWrapperDefinition<TValue = unknown | never> = {\n /**\n * Creates a shared value that is forwarded as the `value` prop to the\n * component.\n *\n * @remarks\n *\n * This function obeys the rules of React hooks and is only invoked in a\n * single location in the app. Note that the hook will not be called until a\n * component from the plugin is rendered.\n */\n useWrapperValue?: () => TValue;\n component: ComponentType<{ children: ReactNode; value: TValue }>;\n};\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<PluginWrapperDefinition>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @public\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams<TValue = never>(params: {\n loader: () => Promise<PluginWrapperDefinition<TValue>>;\n }) {\n return createExtensionBlueprintParams(\n params as { loader: () => Promise<PluginWrapperDefinition> },\n );\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmDA,MAAM,iBAAiB,sBAAA,EAErB,CAAE,KAAK,EAAE,EAAA,EAAI,8BAA8B,CAAA;AAOtC,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,wBAAA,EAA0B,OAAO,UAAA,EAAW;AAAA,EAC5D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,aAA6B,MAAA,EAE1B;AACD,IAAA,OAAO,8BAAA;AAAA,MACL;AAAA,KACF;AAAA,EACF,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
2
- import 'zod';
2
+ import 'zod/v3';
3
3
  import 'zod-to-json-schema';
4
4
  import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
5
5
  import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
@@ -22,8 +22,10 @@ import '../apis/definitions/OAuthRequestApi.esm.js';
22
22
  import '../apis/definitions/RouteResolutionApi.esm.js';
23
23
  import '../apis/definitions/StorageApi.esm.js';
24
24
  import '../apis/definitions/AnalyticsApi.esm.js';
25
+ import '../apis/definitions/ToastApi.esm.js';
25
26
  import '../apis/definitions/TranslationApi.esm.js';
26
27
  import '../apis/definitions/PluginHeaderActionsApi.esm.js';
28
+ import '../apis/definitions/PluginWrapperApi.esm.js';
27
29
  import '@backstage/version-bridge';
28
30
  import '@backstage/errors';
29
31
  import 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\n\n/**\n * Creates extensions that are sub-page React components attached to a parent page.\n * Sub-pages are rendered as tabs within the parent page's header.\n *\n * @public\n * @example\n * ```tsx\n * const overviewRouteRef = createRouteRef();\n *\n * const mySubPage = SubPageBlueprint.make({\n * attachTo: { id: 'page:my-plugin', input: 'pages' },\n * name: 'overview',\n * params: {\n * path: 'overview',\n * title: 'Overview',\n * routeRef: overviewRouteRef,\n * loader: () => import('./components/Overview').then(m => <m.Overview />),\n * },\n * });\n * ```\n */\nexport const SubPageBlueprint = createExtensionBlueprint({\n kind: 'sub-page',\n attachTo: { relative: { kind: 'page' }, input: 'pages' },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.title,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.icon.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n },\n },\n *factory(\n params: {\n /**\n * The path for this sub-page, relative to the parent page. Must **not** start with '/'.\n *\n * @example 'overview', 'settings', 'details'\n */\n path: string;\n /**\n * The title displayed in the tab for this sub-page.\n */\n title: string;\n /**\n * Optional icon for this sub-page, displayed in the tab.\n */\n icon?: IconElement;\n /**\n * A function that returns a promise resolving to the React element to render.\n * This enables lazy loading of the sub-page content.\n */\n loader: () => Promise<JSX.Element>;\n /**\n * Optional route reference for this sub-page.\n */\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.title(config.title ?? params.title);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (params.icon) {\n yield coreExtensionData.icon(params.icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,QAAA,EAAU,EAAE,MAAM,MAAA,EAAO,EAAG,OAAO,OAAA,EAAQ;AAAA,EACvD,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,IAClB,iBAAA,CAAkB,YAAA;AAAA,IAClB,iBAAA,CAAkB,KAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,IACpC,iBAAA,CAAkB,KAAK,QAAA;AAAS,GAClC;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS;AAAA,MAC/B,KAAA,EAAO,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,GAAS,QAAA;AAAS;AAClC,GACF;AAAA,EACA,CAAC,OAAA,CACC,MAAA,EAyBA,EAAE,MAAA,EAAQ,MAAK,EACf;AACA,IAAA,MAAM,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAA,CAAkB,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,OAAO,KAAK,CAAA;AAC1D,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,MACtB,iBAAA,CAAkB,IAAA,CAAK,IAAA,EAAM,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,MAAM,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAAA,IAC1C;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\n\n/**\n * Creates extensions that are sub-page React components attached to a parent page.\n * Sub-pages are rendered as tabs within the parent page's header.\n *\n * @public\n * @example\n * ```tsx\n * const overviewRouteRef = createRouteRef();\n *\n * const mySubPage = SubPageBlueprint.make({\n * attachTo: { id: 'page:my-plugin', input: 'pages' },\n * name: 'overview',\n * params: {\n * path: 'overview',\n * title: 'Overview',\n * routeRef: overviewRouteRef,\n * loader: () => import('./components/Overview').then(m => <m.Overview />),\n * },\n * });\n * ```\n */\nexport const SubPageBlueprint = createExtensionBlueprint({\n kind: 'sub-page',\n attachTo: { relative: { kind: 'page' }, input: 'pages' },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.title,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.icon.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n },\n },\n *factory(\n params: {\n /**\n * The path for this sub-page, relative to the parent page. Must **not** start with '/'.\n *\n * @example 'overview', 'settings', 'details'\n */\n path: string;\n /**\n * The title displayed in the tab for this sub-page.\n */\n title: string;\n /**\n * Optional icon for this sub-page, displayed in the tab.\n */\n icon?: IconElement;\n /**\n * A function that returns a promise resolving to the React element to render.\n * This enables lazy loading of the sub-page content.\n */\n loader: () => Promise<JSX.Element>;\n /**\n * Optional route reference for this sub-page.\n */\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.title(config.title ?? params.title);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (params.icon) {\n yield coreExtensionData.icon(params.icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,QAAA,EAAU,EAAE,MAAM,MAAA,EAAO,EAAG,OAAO,OAAA,EAAQ;AAAA,EACvD,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,IAClB,iBAAA,CAAkB,YAAA;AAAA,IAClB,iBAAA,CAAkB,KAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,IACpC,iBAAA,CAAkB,KAAK,QAAA;AAAS,GAClC;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS;AAAA,MAC/B,KAAA,EAAO,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,GAAS,QAAA;AAAS;AAClC,GACF;AAAA,EACA,CAAC,OAAA,CACC,MAAA,EAyBA,EAAE,MAAA,EAAQ,MAAK,EACf;AACA,IAAA,MAAM,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAA,CAAkB,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,OAAO,KAAK,CAAA;AAC1D,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,MACtB,iBAAA,CAAkB,IAAA,CAAK,IAAA,EAAM,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,MAAM,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAAA,IAC1C;AAAA,EACF;AACF,CAAC;;;;"}
@@ -23,12 +23,13 @@ import '../apis/definitions/OAuthRequestApi.esm.js';
23
23
  import '../apis/definitions/RouteResolutionApi.esm.js';
24
24
  import '../apis/definitions/StorageApi.esm.js';
25
25
  import '../apis/definitions/AnalyticsApi.esm.js';
26
+ import '../apis/definitions/ToastApi.esm.js';
26
27
  import '../apis/definitions/TranslationApi.esm.js';
27
28
  import '../apis/definitions/PluginHeaderActionsApi.esm.js';
28
- import { useApi } from '../apis/system/useApi.esm.js';
29
29
  import { pluginWrapperApiRef } from '../apis/definitions/PluginWrapperApi.esm.js';
30
+ import { useApi } from '../apis/system/useApi.esm.js';
30
31
  import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
31
- import 'zod';
32
+ import 'zod/v3';
32
33
  import 'zod-to-json-schema';
33
34
  import '../wiring/createExtensionBlueprint.esm.js';
34
35
  import { AppNodeProvider } from './AppNodeProvider.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, ErrorApi, errorApiRef, useApi } from '../apis';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,mBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,WAAW,CAAA;AAAA,EAC3B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,2BAAA,GAA4D;AACnE,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,mBAAmB,CAAA;AAAA,EACnC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAKA,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACjD,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAC9B,EAAA,MAAM,YAAY,YAAA,EAAa;AAM/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,SAAA,CAAU,YAAA,CAAa,gCAAgC,EAAE,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA,EAAG,CAAC,SAAA,EAAW,OAAO,CAAC,CAAA;AAEvB,EAAA,uCAAU,QAAA,EAAS,CAAA;AACrB,CAAA;AAUO,SAAS,kBAAkB,KAAA,EAA+B;AAC/D,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,KAAA;AAE3B,EAAA,MAAM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AAA,CAAC,QAAA,EAAA,EAAS,CAAA,EAAK,QAAA,EAAA,OAAA,EAAQ,CAAA,EAC7C,CAAA;AAEJ;AAAA,CAGO,CAAUA,kBAAAA,KAAV;AACE,EAAA,SAASC,MAAA,CACd,SACA,MAAA,EACa;AACb,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KACvD;AACA,IAAA,2BACGF,kBAAAA,EAAA,EAAkB,MAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,sBAAmB,CAAA,EACtB,CAAA;AAAA,EAEJ;AAZO,EAAAA,kBAAAA,CAAS,IAAA,GAAAC,MAAA;AAcT,EAAA,SAAS,aAAA,CACd,SACA,MAAA,EACgC;AAChC,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,OAAO,CAAC,KAAA,qBACN,GAAA,CAACF,kBAAAA,EAAA,EAAkB,IAAA,EAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CAAA;AAAA,EAEJ;AAbO,EAAAA,kBAAAA,CAAS,aAAA,GAAA,aAAA;AAAA,CAAA,EAfD,iBAAA,KAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, ErrorApi, errorApiRef, useApi } from '../apis';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,mB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AA,CAAS,IAAA,GAAAC,MAAA;AAcT,EAAA,SAAS,aAAA,CACd,SACA,MAAA,EACgC;AAChC,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,OAAO,CAAC,KAAA,qBACN,GAAA,CAACF,kBAAAA,EAAA,EAAkB,IAAA,EAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CAAA;AAAA,EAEJ;AAbO,EAAAA,kBAAAA,CAAS,aAAA,GAAA,aAAA;AAAA,CAAA,EAfD,iBAAA,KAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.esm.js","sources":["../../src/components/PageLayout.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ReactNode } from 'react';\nimport { IconElement } from '../icons/types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * Tab configuration for page navigation\n * @public\n */\nexport interface PageLayoutTab {\n id: string;\n label: string;\n icon?: IconElement;\n href: string;\n}\n\n/**\n * @deprecated Use {@link PageLayoutTab} instead\n * @public\n */\nexport type PageTab = PageLayoutTab;\n\n/**\n * Props for the PageLayout component\n * @public\n */\nexport interface PageLayoutProps {\n title?: string;\n icon?: IconElement;\n noHeader?: boolean;\n headerActions?: Array<JSX.Element | null>;\n tabs?: PageLayoutTab[];\n children?: ReactNode;\n}\n\n/**\n * Default implementation of PageLayout using plain HTML elements\n */\nfunction DefaultPageLayout(props: PageLayoutProps): JSX.Element {\n const { title, icon, headerActions, tabs, children } = props;\n\n return (\n <div\n data-component=\"page-layout\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {(title || tabs) && (\n <header\n style={{\n borderBottom: '1px solid #ddd',\n backgroundColor: '#fff',\n flexShrink: 0,\n }}\n >\n {title && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n padding: '12px 24px 8px',\n fontSize: '18px',\n fontWeight: 500,\n }}\n >\n {icon}\n {title}\n {headerActions && (\n <div style={{ marginLeft: 'auto' }}>{headerActions}</div>\n )}\n </div>\n )}\n {tabs && tabs.length > 0 && (\n <nav\n style={{\n display: 'flex',\n gap: '4px',\n padding: '0 24px',\n }}\n >\n {tabs.map(tab => (\n <a\n key={tab.id}\n href={tab.href}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n padding: '8px 12px',\n textDecoration: 'none',\n color: '#333',\n borderBottom: '2px solid transparent',\n }}\n >\n {tab.icon}\n {tab.label}\n </a>\n ))}\n </nav>\n )}\n </header>\n )}\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * Swappable component for laying out page content with header and navigation.\n * The default implementation uses plain HTML elements.\n * Apps can override this with a custom implementation (e.g., using \\@backstage/ui).\n *\n * @public\n */\nexport const PageLayout = createSwappableComponent<PageLayoutProps>({\n id: 'core.page-layout',\n loader: () => DefaultPageLayout,\n});\n"],"names":[],"mappings":";;;AAqDA,SAAS,kBAAkB,KAAA,EAAqC;AAC9D,EAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,UAAS,GAAI,KAAA;AAEvD,EAAA,uBACE,IAAA;AAAA,IAAC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,sBAEC,MAAM,GAAA,CAAI,IAAA;AAAA,sBACV,KAAA,EAAO;AAAA,wBACL,OAAA,EAAS,MAAA;AAAA,wBACT,UAAA,EAAY,QAAA;AAAA,wBACZ,GAAA,EAAK,KAAA;AAAA,wBACL,OAAA,EAAS,UAAA;AAAA,wBACT,cAAA,EAAgB,MAAA;AAAA,wBAChB,KAAA,EAAO,MAAA;AAAA,wBACP,YAAA,EAAc;AAAA,uBAChB;AAAA,sBAEC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAI,IAAA;AAAA,wBACJ,GAAA,CAAI;AAAA;AAAA,qBAAA;AAAA,oBAbA,GAAA,CAAI;AAAA,mBAeZ;AAAA;AAAA;AACH;AAAA;AAAA,SAEJ;AAAA,wBAEF,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,OAAA,EAAS,MAAA;AAAA,cACT,aAAA,EAAe,QAAA;AAAA,cACf,QAAA,EAAU,CAAA;AAAA,cACV,SAAA,EAAW;AAAA,aACb;AAAA,YAEC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;AASO,MAAM,aAAa,wBAAA,CAA0C;AAAA,EAClE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAQ,MAAM;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"PageLayout.esm.js","sources":["../../src/components/PageLayout.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { ReactNode } from 'react';\nimport { IconElement } from '../icons/types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * Tab configuration for page navigation\n * @public\n */\nexport interface PageLayoutTab {\n id: string;\n label: string;\n icon?: IconElement;\n href: string;\n}\n\n/**\n * @deprecated Use {@link PageLayoutTab} instead\n * @public\n */\nexport type PageTab = PageLayoutTab;\n\n/**\n * Props for the PageLayout component\n * @public\n */\nexport interface PageLayoutProps {\n title?: string;\n icon?: IconElement;\n noHeader?: boolean;\n titleLink?: string;\n headerActions?: Array<JSX.Element | null>;\n tabs?: PageLayoutTab[];\n children?: ReactNode;\n}\n\n/**\n * Default implementation of PageLayout using plain HTML elements\n */\nfunction DefaultPageLayout(props: PageLayoutProps): JSX.Element {\n const { title, icon, headerActions, tabs, children } = props;\n\n return (\n <div\n data-component=\"page-layout\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {(title || tabs) && (\n <header\n style={{\n borderBottom: '1px solid #ddd',\n backgroundColor: '#fff',\n flexShrink: 0,\n }}\n >\n {title && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n padding: '12px 24px 8px',\n fontSize: '18px',\n fontWeight: 500,\n }}\n >\n {icon}\n {title}\n {headerActions && (\n <div style={{ marginLeft: 'auto' }}>{headerActions}</div>\n )}\n </div>\n )}\n {tabs && tabs.length > 0 && (\n <nav\n style={{\n display: 'flex',\n gap: '4px',\n padding: '0 24px',\n }}\n >\n {tabs.map(tab => (\n <a\n key={tab.id}\n href={tab.href}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n padding: '8px 12px',\n textDecoration: 'none',\n color: '#333',\n borderBottom: '2px solid transparent',\n }}\n >\n {tab.icon}\n {tab.label}\n </a>\n ))}\n </nav>\n )}\n </header>\n )}\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * Swappable component for laying out page content with header and navigation.\n * The default implementation uses plain HTML elements.\n * Apps can override this with a custom implementation (e.g., using \\@backstage/ui).\n *\n * @public\n */\nexport const PageLayout = createSwappableComponent<PageLayoutProps>({\n id: 'core.page-layout',\n loader: () => DefaultPageLayout,\n});\n"],"names":[],"mappings":";;;AAsDA,SAAS,kBAAkB,KAAA,EAAqC;AAC9D,EAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,UAAS,GAAI,KAAA;AAEvD,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,gBAAA,EAAe,aAAA;AAAA,MACf,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,MAAA;AAAA,QACT,aAAA,EAAe,QAAA;AAAA,QACf,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,OACb;AAAA,MAEE,QAAA,EAAA;AAAA,QAAA,CAAA,KAAA,IAAS,IAAA,qBACT,IAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,YAAA,EAAc,gBAAA;AAAA,cACd,eAAA,EAAiB,MAAA;AAAA,cACjB,UAAA,EAAY;AAAA,aACd;AAAA,YAEC,QAAA,EAAA;AAAA,cAAA,KAAA,oBACC,IAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAO;AAAA,oBACL,OAAA,EAAS,MAAA;AAAA,oBACT,UAAA,EAAY,QAAA;AAAA,oBACZ,GAAA,EAAK,KAAA;AAAA,oBACL,OAAA,EAAS,eAAA;AAAA,oBACT,QAAA,EAAU,MAAA;AAAA,oBACV,UAAA,EAAY;AAAA,mBACd;AAAA,kBAEC,QAAA,EAAA;AAAA,oBAAA,IAAA;AAAA,oBACA,KAAA;AAAA,oBACA,aAAA,wBACE,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,UAAA,EAAY,MAAA,IAAW,QAAA,EAAA,aAAA,EAAc;AAAA;AAAA;AAAA,eAEvD;AAAA,cAED,IAAA,IAAQ,IAAA,CAAK,MAAA,GAAS,CAAA,oBACrB,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAO;AAAA,oBACL,OAAA,EAAS,MAAA;AAAA,oBACT,GAAA,EAAK,KAAA;AAAA,oBACL,OAAA,EAAS;AAAA,mBACX;AAAA,kBAEC,QAAA,EAAA,IAAA,CAAK,IAAI,CAAA,GAAA,qBACR,IAAA;AAAA,oBAAC,GAAA;AAAA,oBAAA;AAAA,sBAEC,MAAM,GAAA,CAAI,IAAA;AAAA,sBACV,KAAA,EAAO;AAAA,wBACL,OAAA,EAAS,MAAA;AAAA,wBACT,UAAA,EAAY,QAAA;AAAA,wBACZ,GAAA,EAAK,KAAA;AAAA,wBACL,OAAA,EAAS,UAAA;AAAA,wBACT,cAAA,EAAgB,MAAA;AAAA,wBAChB,KAAA,EAAO,MAAA;AAAA,wBACP,YAAA,EAAc;AAAA,uBAChB;AAAA,sBAEC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAI,IAAA;AAAA,wBACJ,GAAA,CAAI;AAAA;AAAA,qBAAA;AAAA,oBAbA,GAAA,CAAI;AAAA,mBAeZ;AAAA;AAAA;AACH;AAAA;AAAA,SAEJ;AAAA,wBAEF,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,OAAA,EAAS,MAAA;AAAA,cACT,aAAA,EAAe,QAAA;AAAA,cACf,QAAA,EAAU,CAAA;AAAA,cACV,SAAA,EAAW;AAAA,aACb;AAAA,YAEC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;AASO,MAAM,aAAa,wBAAA,CAA0C;AAAA,EAClE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAQ,MAAM;AAChB,CAAC;;;;"}
@@ -17,8 +17,10 @@ import '../apis/definitions/OAuthRequestApi.esm.js';
17
17
  import '../apis/definitions/RouteResolutionApi.esm.js';
18
18
  import '../apis/definitions/StorageApi.esm.js';
19
19
  import '../apis/definitions/AnalyticsApi.esm.js';
20
+ import '../apis/definitions/ToastApi.esm.js';
20
21
  import '../apis/definitions/TranslationApi.esm.js';
21
22
  import '../apis/definitions/PluginHeaderActionsApi.esm.js';
23
+ import '../apis/definitions/PluginWrapperApi.esm.js';
22
24
  import { useApi } from '../apis/system/useApi.esm.js';
23
25
  import { lazy } from 'react';
24
26
  import { OpaqueSwappableComponentRef } from '../frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"createSwappableComponent.esm.js","sources":["../../src/components/createSwappableComponent.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { OpaqueSwappableComponentRef } from '@internal/frontend';\nimport { swappableComponentsApiRef, useApi } from '../apis';\nimport { lazy } from 'react';\n\n/** @public */\nexport type SwappableComponentRef<\n TInnerComponentProps extends {} = {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n TProps: TInnerComponentProps;\n TExternalProps: TExternalComponentProps;\n $$type: '@backstage/SwappableComponentRef';\n};\n\n/**\n * Options for creating an SwappableComponent.\n *\n * @public\n */\nexport type CreateSwappableComponentOptions<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n loader?:\n | (() => (props: TInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);\n transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;\n};\n\nconst useComponentRefApi = () => {\n try {\n return useApi(swappableComponentsApiRef);\n } catch (e) {\n return undefined;\n }\n};\n\n/**\n * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.\n *\n * @public\n */\nexport function createSwappableComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n>(\n options: CreateSwappableComponentOptions<\n TInnerComponentProps,\n TExternalComponentProps\n >,\n): {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n} {\n const FallbackComponent = (p: JSX.IntrinsicAttributes) => (\n <div data-testid={options.id} {...p} />\n );\n\n const ref = OpaqueSwappableComponentRef.createInstance('v1', {\n id: options.id,\n TProps: null as unknown as TInnerComponentProps,\n TExternalProps: null as unknown as TExternalComponentProps,\n toString() {\n return `SwappableComponentRef{id=${options.id}}`;\n },\n defaultComponent: lazy(async () => {\n const Component = (await options.loader?.()) ?? FallbackComponent;\n return { default: Component };\n }) as (typeof OpaqueSwappableComponentRef.TInternal)['defaultComponent'],\n transformProps:\n options.transformProps as (typeof OpaqueSwappableComponentRef.TInternal)['transformProps'],\n });\n\n const ComponentRefImpl = (props: TExternalComponentProps) => {\n const api = useComponentRefApi();\n\n if (!api) {\n const internalRef = OpaqueSwappableComponentRef.toInternal(ref);\n const Component = internalRef.defaultComponent;\n const innerProps = internalRef.transformProps?.(props) ?? props;\n return <Component {...innerProps} />;\n }\n\n const Component = api.getComponent<any>(ref);\n return <Component {...props} />;\n };\n\n Object.assign(ComponentRefImpl, { ref });\n\n return ComponentRefImpl as {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n };\n}\n"],"names":["Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,qBAAqB,MAAM;AAC/B,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,yBAAyB,CAAA;AAAA,EACzC,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAA;AAOO,SAAS,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EAAA,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB,EAAE,GAAA,EAAK,CAAA;AAEvC,EAAA,OAAO,gBAAA;AAIT;;;;"}
1
+ {"version":3,"file":"createSwappableComponent.esm.js","sources":["../../src/components/createSwappableComponent.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { OpaqueSwappableComponentRef } from '@internal/frontend';\nimport { swappableComponentsApiRef, useApi } from '../apis';\nimport { lazy } from 'react';\n\n/** @public */\nexport type SwappableComponentRef<\n TInnerComponentProps extends {} = {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n TProps: TInnerComponentProps;\n TExternalProps: TExternalComponentProps;\n $$type: '@backstage/SwappableComponentRef';\n};\n\n/**\n * Options for creating an SwappableComponent.\n *\n * @public\n */\nexport type CreateSwappableComponentOptions<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n loader?:\n | (() => (props: TInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);\n transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;\n};\n\nconst useComponentRefApi = () => {\n try {\n return useApi(swappableComponentsApiRef);\n } catch (e) {\n return undefined;\n }\n};\n\n/**\n * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.\n *\n * @public\n */\nexport function createSwappableComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n>(\n options: CreateSwappableComponentOptions<\n TInnerComponentProps,\n TExternalComponentProps\n >,\n): {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n} {\n const FallbackComponent = (p: JSX.IntrinsicAttributes) => (\n <div data-testid={options.id} {...p} />\n );\n\n const ref = OpaqueSwappableComponentRef.createInstance('v1', {\n id: options.id,\n TProps: null as unknown as TInnerComponentProps,\n TExternalProps: null as unknown as TExternalComponentProps,\n toString() {\n return `SwappableComponentRef{id=${options.id}}`;\n },\n defaultComponent: lazy(async () => {\n const Component = (await options.loader?.()) ?? FallbackComponent;\n return { default: Component };\n }) as (typeof OpaqueSwappableComponentRef.TInternal)['defaultComponent'],\n transformProps:\n options.transformProps as (typeof OpaqueSwappableComponentRef.TInternal)['transformProps'],\n });\n\n const ComponentRefImpl = (props: TExternalComponentProps) => {\n const api = useComponentRefApi();\n\n if (!api) {\n const internalRef = OpaqueSwappableComponentRef.toInternal(ref);\n const Component = internalRef.defaultComponent;\n const innerProps = internalRef.transformProps?.(props) ?? props;\n return <Component {...innerProps} />;\n }\n\n const Component = api.getComponent<any>(ref);\n return <Component {...props} />;\n };\n\n Object.assign(ComponentRefImpl, { ref });\n\n return ComponentRefImpl as {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n };\n}\n"],"names":["Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,qBAAqB,MAAM;AAC/B,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,yBAAyB,CAAA;AAAA,EACzC,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAA;AAOO,SAAS,yBAId,OAAA,EAOA;AACA,EAAA,MAAM,iBAAA,GAAoB,CAAC,CAAA,qBACzB,GAAA,CAAC,SAAI,aAAA,EAAa,OAAA,CAAQ,EAAA,EAAK,GAAG,CAAA,EAAG,CAAA;AAGvC,EAAA,MAAM,GAAA,GAAM,2BAAA,CAA4B,cA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ef = OpaqueType.create({
4
+ type: "@backstage/ApiRef",
5
+ versions: ["v1"]
6
+ });
7
+
8
+ export { OpaqueApiRef };
9
+ //# sourceMappingURL=OpaqueApiRef.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpaqueApiRef.esm.js","sources":["../../../../../frontend-internal/src/apis/OpaqueApiRef.ts"],"sourcesContent":["/*\n * Copyright 2024 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 type { ApiRef } from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueApiRef = OpaqueType.create<{\n public: ApiRef<unknown> & {\n readonly $$type: '@backstage/ApiRef';\n };\n versions: {\n readonly version: 'v1';\n readonly pluginId?: string;\n };\n}>({\n type: '@backstage/ApiRef',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,YAAA,GAAe,WAAW,MAAA,CAQpC;AAAA,EACD,IAAA,EAAM,mBAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalExtensionDefinition.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalExtensionDefinition.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ApiHolder,\n AppNode,\n ExtensionDefinitionAttachTo,\n ExtensionDataValue,\n ExtensionDataRef,\n OverridableExtensionDefinition,\n ExtensionDefinitionParameters,\n ExtensionInput,\n PortableSchema,\n ResolvedExtensionInputs,\n} from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueExtensionDefinition = OpaqueType.create<{\n public: OverridableExtensionDefinition<ExtensionDefinitionParameters>;\n versions:\n | {\n readonly version: 'v1';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: ExtensionDefinitionAttachTo;\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: {\n [inputName in string]: {\n $$type: '@backstage/ExtensionInput';\n extensionData: {\n [name in string]: ExtensionDataRef;\n };\n config: { optional: boolean; singleton: boolean };\n };\n };\n readonly output: {\n [name in string]: ExtensionDataRef;\n };\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: {\n [inputName in string]: unknown;\n };\n }): {\n [inputName in string]: unknown;\n };\n }\n | {\n readonly version: 'v2';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: ExtensionDefinitionAttachTo;\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: { [inputName in string]: ExtensionInput };\n readonly output: Array<ExtensionDataRef>;\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: ResolvedExtensionInputs<{\n [inputName in string]: ExtensionInput;\n }>;\n }): Iterable<ExtensionDataValue<any, any>>;\n };\n}>({\n type: '@backstage/ExtensionDefinition',\n versions: ['v1', 'v2'],\n});\n"],"names":[],"mappings":";;AA8BO,MAAM,yBAAA,GAA4B,WAAW,MAAA,CAqDjD;AAAA,EACD,IAAA,EAAM,gCAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAA,EAAM,IAAI;AACvB,CAAC;;;;"}
1
+ {"version":3,"file":"InternalExtensionDefinition.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalExtensionDefinition.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ApiHolder,\n AppNode,\n ExtensionDefinitionAttachTo,\n ExtensionDataValue,\n ExtensionDataRef,\n OverridableExtensionDefinition,\n ExtensionDefinitionParameters,\n ExtensionInput,\n PortableSchema,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { ResolvedExtensionInputs } from '../../../frontend-plugin-api/src/wiring/createExtension';\nimport { OpaqueType } from '@internal/opaque';\nimport { FilterPredicate } from '@backstage/filter-predicates';\n\nexport const OpaqueExtensionDefinition = OpaqueType.create<{\n public: OverridableExtensionDefinition<ExtensionDefinitionParameters>;\n versions:\n | {\n readonly version: 'v1';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: ExtensionDefinitionAttachTo;\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: {\n [inputName in string]: {\n $$type: '@backstage/ExtensionInput';\n extensionData: {\n [name in string]: ExtensionDataRef;\n };\n config: { optional: boolean; singleton: boolean };\n };\n };\n readonly output: {\n [name in string]: ExtensionDataRef;\n };\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: {\n [inputName in string]: unknown;\n };\n }): {\n [inputName in string]: unknown;\n };\n }\n | {\n readonly version: 'v2';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: ExtensionDefinitionAttachTo;\n readonly disabled: boolean;\n readonly if?: FilterPredicate;\n readonly configSchema?: PortableSchema<any, any>;\n readonly inputs: { [inputName in string]: ExtensionInput };\n readonly output: Array<ExtensionDataRef>;\n factory(context: {\n node: AppNode;\n apis: ApiHolder;\n config: object;\n inputs: ResolvedExtensionInputs<{\n [inputName in string]: ExtensionInput;\n }>;\n }): Iterable<ExtensionDataValue<any, any>>;\n };\n}>({\n type: '@backstage/ExtensionDefinition',\n versions: ['v1', 'v2'],\n});\n"],"names":[],"mappings":";;AAgCO,MAAM,yBAAA,GAA4B,WAAW,MAAA,CAsDjD;AAAA,EACD,IAAA,EAAM,gCAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAA,EAAM,IAAI;AACvB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalFrontendPlugin.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalFrontendPlugin.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n Extension,\n FeatureFlagConfig,\n IconElement,\n OverridableFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\nimport { JsonObject } from '@backstage/types';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueFrontendPlugin = OpaqueType.create<{\n public: OverridableFrontendPlugin;\n versions: {\n readonly version: 'v1';\n readonly title?: string;\n readonly icon?: IconElement;\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n readonly infoOptions?: {\n packageJson?: () => Promise<JsonObject>;\n manifest?: () => Promise<JsonObject>;\n };\n };\n}>({\n type: '@backstage/FrontendPlugin',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAyBO,MAAM,oBAAA,GAAuB,WAAW,MAAA,CAa5C;AAAA,EACD,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;;;"}
1
+ {"version":3,"file":"InternalFrontendPlugin.esm.js","sources":["../../../../../frontend-internal/src/wiring/InternalFrontendPlugin.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n Extension,\n FeatureFlagConfig,\n IconElement,\n OverridableFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport { JsonObject } from '@backstage/types';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueFrontendPlugin = OpaqueType.create<{\n public: OverridableFrontendPlugin;\n versions: {\n readonly version: 'v1';\n readonly title?: string;\n readonly icon?: IconElement;\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n readonly if?: FilterPredicate;\n readonly infoOptions?: {\n packageJson?: () => Promise<JsonObject>;\n manifest?: () => Promise<JsonObject>;\n };\n };\n}>({\n type: '@backstage/FrontendPlugin',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AA0BO,MAAM,oBAAA,GAAuB,WAAW,MAAA,CAc5C;AAAA,EACD,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;;;"}