@backstage/frontend-plugin-api 0.11.0-next.0 → 0.11.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +211 -0
- package/dist/analytics/useAnalytics.esm.js +1 -1
- package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
- package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
- package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
- package/dist/apis/definitions/SwappableComponentsApi.esm.js +8 -0
- package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -0
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js +24 -0
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js.map +1 -0
- package/dist/blueprints/AppRootElementBlueprint.esm.js +1 -3
- package/dist/blueprints/AppRootElementBlueprint.esm.js.map +1 -1
- package/dist/blueprints/AppRootWrapperBlueprint.esm.js +1 -5
- package/dist/blueprints/AppRootWrapperBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PageBlueprint.esm.js +17 -9
- package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/RouterBlueprint.esm.js +2 -2
- package/dist/blueprints/RouterBlueprint.esm.js.map +1 -1
- package/dist/blueprints/SignInPageBlueprint.esm.js +9 -1
- package/dist/blueprints/SignInPageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/SwappableComponentBlueprint.esm.js +27 -0
- package/dist/blueprints/SwappableComponentBlueprint.esm.js.map +1 -0
- package/dist/components/DefaultSwappableComponents.esm.js +16 -0
- package/dist/components/DefaultSwappableComponents.esm.js.map +1 -0
- package/dist/components/ErrorBoundary.esm.js +3 -2
- package/dist/components/ErrorBoundary.esm.js.map +1 -1
- package/dist/components/ExtensionBoundary.esm.js +9 -16
- package/dist/components/ExtensionBoundary.esm.js.map +1 -1
- package/dist/components/createSwappableComponent.esm.js +52 -0
- package/dist/components/createSwappableComponent.esm.js.map +1 -0
- package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
- package/dist/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js +9 -0
- package/dist/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js.map +1 -0
- package/dist/frontend-internal/src/wiring/createExtensionDataContainer.esm.js +4 -1
- package/dist/frontend-internal/src/wiring/createExtensionDataContainer.esm.js.map +1 -1
- package/dist/index.d.ts +493 -294
- package/dist/index.esm.js +5 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/routing/RouteRef.esm.js +8 -2
- package/dist/routing/RouteRef.esm.js.map +1 -1
- package/dist/routing/useRouteRef.esm.js +1 -1
- package/dist/wiring/createExtension.esm.js +7 -0
- package/dist/wiring/createExtension.esm.js.map +1 -1
- package/dist/wiring/createExtensionBlueprint.esm.js +3 -2
- package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
- package/dist/wiring/createExtensionDataRef.esm.js.map +1 -1
- package/dist/wiring/createFrontendModule.esm.js.map +1 -1
- package/dist/wiring/createFrontendPlugin.esm.js +2 -6
- package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
- package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/dist/wiring/resolveInputOverrides.esm.js +3 -0
- package/dist/wiring/resolveInputOverrides.esm.js.map +1 -1
- package/package.json +5 -5
- package/dist/apis/definitions/ComponentsApi.esm.js +0 -12
- package/dist/apis/definitions/ComponentsApi.esm.js.map +0 -1
- package/dist/components/coreComponentRefs.esm.js +0 -19
- package/dist/components/coreComponentRefs.esm.js.map +0 -1
- package/dist/components/createComponentRef.esm.js +0 -12
- package/dist/components/createComponentRef.esm.js.map +0 -1
- package/dist/extensions/createComponentExtension.esm.js +0 -43
- package/dist/extensions/createComponentExtension.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,216 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.11.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fda1bbc: **BREAKING**: The component system has been overhauled to use `SwappableComponent` instead of `ComponentRef`. Several APIs have been removed and replaced:
|
|
8
|
+
|
|
9
|
+
- Removed: `createComponentRef`, `createComponentExtension`, `ComponentRef`, `ComponentsApi`, `componentsApiRef`, `useComponentRef`, `coreComponentRefs`
|
|
10
|
+
- Added: `createSwappableComponent`, `SwappableComponentBlueprint`, `SwappableComponentRef`, `SwappableComponentsApi`, `swappableComponentsApiRef`
|
|
11
|
+
|
|
12
|
+
**BREAKING**: The default `componentRefs` and exported `Core*Props` have been removed and have replacement `SwappableComponents` and revised type names instead.
|
|
13
|
+
|
|
14
|
+
- The `errorBoundaryFallback` component and `CoreErrorBoundaryFallbackProps` type have been replaced with `ErrorDisplay` swappable component and `CoreErrorDisplayProps` respectively.
|
|
15
|
+
- The `progress` component and `CoreProgressProps` type have been replaced with `Progress` swappable component and `ProgressProps` respectively.
|
|
16
|
+
- The `notFoundErrorPage` component and `CoreNotFoundErrorPageProps` type have been replaced with `NotFoundErrorPage` swappable component and `NotFoundErrorPageProps` respectively.
|
|
17
|
+
|
|
18
|
+
**Migration for creating swappable components:**
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
// OLD: Using createComponentRef and createComponentExtension
|
|
22
|
+
import {
|
|
23
|
+
createComponentRef,
|
|
24
|
+
createComponentExtension,
|
|
25
|
+
} from '@backstage/frontend-plugin-api';
|
|
26
|
+
|
|
27
|
+
const myComponentRef = createComponentRef<{ title: string }>({
|
|
28
|
+
id: 'my-plugin.my-component',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const myComponentExtension = createComponentExtension({
|
|
32
|
+
ref: myComponentRef,
|
|
33
|
+
loader: {
|
|
34
|
+
lazy: () => import('./MyComponent').then(m => m.MyComponent),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// NEW: Using createSwappableComponent and SwappableComponentBlueprint
|
|
39
|
+
import {
|
|
40
|
+
createSwappableComponent,
|
|
41
|
+
SwappableComponentBlueprint,
|
|
42
|
+
} from '@backstage/frontend-plugin-api';
|
|
43
|
+
|
|
44
|
+
const MySwappableComponent = createSwappableComponent({
|
|
45
|
+
id: 'my-plugin.my-component',
|
|
46
|
+
loader: () => import('./MyComponent').then(m => m.MyComponent),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const myComponentExtension = SwappableComponentBlueprint.make({
|
|
50
|
+
name: 'my-component',
|
|
51
|
+
params: {
|
|
52
|
+
component: MySwappableComponent,
|
|
53
|
+
loader: () => import('./MyComponent').then(m => m.MyComponent),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Migration for using components:**
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// OLD: Using ComponentsApi and useComponentRef
|
|
62
|
+
import {
|
|
63
|
+
useComponentRef,
|
|
64
|
+
componentsApiRef,
|
|
65
|
+
useApi,
|
|
66
|
+
coreComponentRefs,
|
|
67
|
+
} from '@backstage/frontend-plugin-api';
|
|
68
|
+
|
|
69
|
+
const MyComponent = useComponentRef(myComponentRef);
|
|
70
|
+
const ProgressComponent = useComponentRef(coreComponentRefs.progress);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
// NEW: Direct component usage
|
|
74
|
+
import { Progress } from '@backstage/frontend-plugin-api';
|
|
75
|
+
|
|
76
|
+
// Use directly as React Component
|
|
77
|
+
<Progress />
|
|
78
|
+
<MySwappableComponent title="Hello World" />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Migration for core component references:**
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
// OLD: Core component refs
|
|
85
|
+
import { coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
86
|
+
|
|
87
|
+
coreComponentRefs.progress
|
|
88
|
+
coreComponentRefs.notFoundErrorPage
|
|
89
|
+
coreComponentRefs.errorBoundaryFallback
|
|
90
|
+
|
|
91
|
+
// NEW: Direct swappable component imports
|
|
92
|
+
import { Progress, NotFoundErrorPage, ErrorDisplay } from '@backstage/frontend-plugin-api';
|
|
93
|
+
|
|
94
|
+
// Use directly as React components
|
|
95
|
+
<Progress />
|
|
96
|
+
<NotFoundErrorPage />
|
|
97
|
+
<ErrorDisplay plugin={plugin} error={error} resetError={resetError} />
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- 6a75e00: **BREAKING**: Removed the deprecated `createFrontendPlugin` variant where the plugin ID is passed via an `id` option. To update existing code, switch to using the `pluginId` option instead.
|
|
101
|
+
- 1e6410b: **BREAKING**: The `ResolveInputValueOverrides` type is no longer exported.
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- 9831f4e: Adjusted the dialog API types to have more sensible defaults
|
|
106
|
+
- 1c2cc37: Improved runtime error message clarity when extension factories don't return an iterable object.
|
|
107
|
+
- 24558f0: Added inline documentation for `createExtension`, `createExtensionBlueprint`, `createFrontendPlugin`, and `createFrontendModule`.
|
|
108
|
+
- Updated dependencies
|
|
109
|
+
- @backstage/core-components@0.17.5-next.2
|
|
110
|
+
|
|
111
|
+
## 0.11.0-next.1
|
|
112
|
+
|
|
113
|
+
### Minor Changes
|
|
114
|
+
|
|
115
|
+
- c5f88b5: **BREAKING**: Remove deprecated `source` property from the `AppNodeSpec` type, use `AppNodeSpec.plugin` instead.
|
|
116
|
+
- e4ddf22: **BREAKING**: The `defaultPath` param of `PageBlueprint` has been renamed to `path`. This change does not affect the compatibility of extensions created with older versions of this blueprint.
|
|
117
|
+
- 37f2989: **BREAKING**: Removed the `routable` property from `ExtensionBoundary`. This property was never needed in practice and is instead inferred from whether or not the extension outputs a route reference. It can be safely removed.
|
|
118
|
+
- 3243fa6: **BREAKING**: Removed the ability to define a default extension `name` in blueprints. This option had no practical purpose as blueprints already use the `kind` to identity the source of the extension.
|
|
119
|
+
- a082429: **BREAKING**: The separate `RouteResolutionApiResolveOptions` type has been removed.
|
|
120
|
+
- 5d31d66: **BREAKING**: In an attempt to align some of the API's around providing components to `Blueprints`, we've renamed the parameters for both the `RouterBlueprint` and `AppRootWrapperBlueprint` from `Component` to `component`.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
// old
|
|
124
|
+
RouterBlueprint.make({
|
|
125
|
+
params: {
|
|
126
|
+
Component: ({ children }) => <div>{children}</div>,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// new
|
|
131
|
+
RouterBlueprint.make({
|
|
132
|
+
params: {
|
|
133
|
+
component: ({ children }) => <div>{children}</div>,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// old
|
|
140
|
+
AppRootWrapperBlueprint.make({
|
|
141
|
+
params: {
|
|
142
|
+
Component: ({ children }) => <div>{children}</div>,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// new
|
|
147
|
+
AppRootWrapperBlueprint.make({
|
|
148
|
+
params: {
|
|
149
|
+
component: ({ children }) => <div>{children}</div>,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
As part of this change, the type for `component` has also changed from `ComponentType<PropsWithChildren<{}>>` to `(props: { children: ReactNode }) => JSX.Element | null` which is not breaking, just a little more reflective of the actual expected component.
|
|
155
|
+
|
|
156
|
+
- 45ead4a: **BREAKING**: The `AnyRoutes` and `AnyExternalRoutes` types have been removed and their usage has been inlined instead.
|
|
157
|
+
|
|
158
|
+
Existing usage can be replaced according to their previous definitions:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
type AnyRoutes = { [name in string]: RouteRef | SubRouteRef };
|
|
162
|
+
type AnyExternalRoutes = { [name in string]: ExternalRouteRef };
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- 121899a: **BREAKING**: The `element` param for `AppRootElementBlueprint` no longer accepts a component. If you are currently passing a component such as `element: () => <MyComponent />` or `element: MyComponent`, simply switch to `element: <MyComponent />`.
|
|
166
|
+
- a321f3b: **BREAKING**: The `CommonAnalyticsContext` has been removed, and inlined into `AnalyticsContextValue` instead.
|
|
167
|
+
|
|
168
|
+
### Patch Changes
|
|
169
|
+
|
|
170
|
+
- d9e00e3: Add support for a new `aliasFor` option for `createRouteRef`. This allows for the creation of a new route ref that acts as an alias for an existing route ref that is installed in the app. This is particularly useful when creating modules that override existing plugin pages, without referring to the existing plugin. For example:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
export default createFrontendModule({
|
|
174
|
+
pluginId: 'catalog',
|
|
175
|
+
extensions: [
|
|
176
|
+
PageBlueprint.make({
|
|
177
|
+
params: {
|
|
178
|
+
defaultPath: '/catalog',
|
|
179
|
+
routeRef: createRouteRef({ aliasFor: 'catalog.catalogIndex' }),
|
|
180
|
+
loader: () =>
|
|
181
|
+
import('./CustomCatalogIndexPage').then(m => (
|
|
182
|
+
<m.CustomCatalogIndexPage />
|
|
183
|
+
)),
|
|
184
|
+
},
|
|
185
|
+
}),
|
|
186
|
+
],
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- 93b5e38: Plugins should now use the new `AnalyticsImplementationBlueprint` to define and provide concrete analytics implementations. For example:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { AnalyticsImplementationBlueprint } from '@backstage/frontend-plugin-api';
|
|
194
|
+
|
|
195
|
+
const AcmeAnalytics = AnalyticsImplementationBlueprint.make({
|
|
196
|
+
name: 'acme-analytics',
|
|
197
|
+
params: define =>
|
|
198
|
+
define({
|
|
199
|
+
deps: { config: configApiRef },
|
|
200
|
+
factory: ({ config }) => AcmeAnalyticsImpl.fromConfig(config),
|
|
201
|
+
}),
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
- 948de17: Tweaked the return types from `createExtension` and `createExtensionBlueprint` to avoid the forwarding of `ConfigurableExtensionDataRef` into exported types.
|
|
206
|
+
- 147482b: Updated the recommended naming of the blueprint param callback from `define` to `defineParams`, making the syntax `defineParams => defineParams(...)`.
|
|
207
|
+
- 3c3c882: Added added defaults for all type parameters of `ExtensionDataRef` and deprecated `AnyExtensionDataRef`, as it is now redundant.
|
|
208
|
+
- Updated dependencies
|
|
209
|
+
- @backstage/core-components@0.17.5-next.1
|
|
210
|
+
- @backstage/core-plugin-api@1.10.9
|
|
211
|
+
- @backstage/types@1.2.1
|
|
212
|
+
- @backstage/version-bridge@1.0.11
|
|
213
|
+
|
|
3
214
|
## 0.11.0-next.0
|
|
4
215
|
|
|
5
216
|
### Minor Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useApi } from '@backstage/core-plugin-api';
|
|
2
2
|
import { useAnalyticsContext } from './AnalyticsContext.esm.js';
|
|
3
3
|
import '../apis/definitions/AppTreeApi.esm.js';
|
|
4
|
-
import '../apis/definitions/
|
|
4
|
+
import '../apis/definitions/SwappableComponentsApi.esm.js';
|
|
5
5
|
import '../apis/definitions/IconsApi.esm.js';
|
|
6
6
|
import '../apis/definitions/DialogApi.esm.js';
|
|
7
7
|
import '../apis/definitions/RouteResolutionApi.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsApi.esm.js","sources":["../../../src/apis/definitions/AnalyticsApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { ApiRef, createApiRef } from '@backstage/core-plugin-api';\nimport { AnalyticsContextValue } from '../../analytics/types';\n\n/**\n * Represents an event worth tracking in an analytics system that could inform\n * how users of a Backstage instance are using its features.\n *\n * @public\n */\nexport type AnalyticsEvent = {\n /**\n * A string that identifies the event being tracked by the type of action the\n * event represents. Be careful not to encode extra metadata in this string\n * that should instead be placed in the Analytics Context or attributes.\n * Examples include:\n *\n * - view\n * - click\n * - filter\n * - search\n * - hover\n * - scroll\n */\n action: string;\n\n /**\n * A string that uniquely identifies the object that the action is being\n * taken on. Examples include:\n *\n * - The path of the page viewed\n * - The url of the link clicked\n * - The value that was filtered by\n * - The text that was searched for\n */\n subject: string;\n\n /**\n * An optional numeric value relevant to the event that could be aggregated\n * by analytics tools. Examples include:\n *\n * - The index or position of the clicked element in an ordered list\n * - The percentage of an element that has been scrolled through\n * - The amount of time that has elapsed since a fixed point\n * - A satisfaction score on a fixed scale\n */\n value?: number;\n\n /**\n * Optional, additional attributes (representing dimensions or metrics)\n * specific to the event that could be forwarded on to analytics systems.\n */\n attributes?: AnalyticsEventAttributes;\n\n /**\n * Contextual metadata relating to where the event was captured and by whom.\n * This could include information about the route, plugin, or extension in\n * which an event was captured.\n */\n context: AnalyticsContextValue;\n};\n\n/**\n * A structure allowing other arbitrary metadata to be provided by analytics\n * event emitters.\n *\n * @public\n */\nexport type AnalyticsEventAttributes = {\n [attribute in string]: string | boolean | number;\n};\n\n/**\n * Represents a tracker with methods that can be called to track events in a\n * configured analytics service.\n *\n * @public\n */\nexport type AnalyticsTracker = {\n captureEvent: (\n action: string,\n subject: string,\n options?: {\n value?: number;\n attributes?: AnalyticsEventAttributes;\n },\n ) => void;\n};\n\n/**\n * The Analytics API is used to track user behavior in a Backstage instance.\n *\n * @remarks\n *\n * To instrument your App or Plugin, retrieve an analytics tracker using the\n * useAnalytics() hook. This will return a pre-configured AnalyticsTracker\n * with relevant methods for instrumentation.\n *\n * @public\n */\nexport type AnalyticsApi = {\n /**\n * Primary event handler responsible for compiling and forwarding events to\n * an analytics system.\n */\n captureEvent(event: AnalyticsEvent): void;\n};\n\n/**\n * The API reference of {@link AnalyticsApi}.\n *\n * @public\n */\nexport const analyticsApiRef: ApiRef<AnalyticsApi> = createApiRef({\n id: 'core.analytics',\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"AnalyticsApi.esm.js","sources":["../../../src/apis/definitions/AnalyticsApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { ApiRef, createApiRef } from '@backstage/core-plugin-api';\nimport { AnalyticsContextValue } from '../../analytics/types';\nimport type { AnalyticsImplementationBlueprint } from '../../blueprints/';\n\n/**\n * Represents an event worth tracking in an analytics system that could inform\n * how users of a Backstage instance are using its features.\n *\n * @public\n */\nexport type AnalyticsEvent = {\n /**\n * A string that identifies the event being tracked by the type of action the\n * event represents. Be careful not to encode extra metadata in this string\n * that should instead be placed in the Analytics Context or attributes.\n * Examples include:\n *\n * - view\n * - click\n * - filter\n * - search\n * - hover\n * - scroll\n */\n action: string;\n\n /**\n * A string that uniquely identifies the object that the action is being\n * taken on. Examples include:\n *\n * - The path of the page viewed\n * - The url of the link clicked\n * - The value that was filtered by\n * - The text that was searched for\n */\n subject: string;\n\n /**\n * An optional numeric value relevant to the event that could be aggregated\n * by analytics tools. Examples include:\n *\n * - The index or position of the clicked element in an ordered list\n * - The percentage of an element that has been scrolled through\n * - The amount of time that has elapsed since a fixed point\n * - A satisfaction score on a fixed scale\n */\n value?: number;\n\n /**\n * Optional, additional attributes (representing dimensions or metrics)\n * specific to the event that could be forwarded on to analytics systems.\n */\n attributes?: AnalyticsEventAttributes;\n\n /**\n * Contextual metadata relating to where the event was captured and by whom.\n * This could include information about the route, plugin, or extension in\n * which an event was captured.\n */\n context: AnalyticsContextValue;\n};\n\n/**\n * A structure allowing other arbitrary metadata to be provided by analytics\n * event emitters.\n *\n * @public\n */\nexport type AnalyticsEventAttributes = {\n [attribute in string]: string | boolean | number;\n};\n\n/**\n * Represents a tracker with methods that can be called to track events in a\n * configured analytics service.\n *\n * @public\n */\nexport type AnalyticsTracker = {\n captureEvent: (\n action: string,\n subject: string,\n options?: {\n value?: number;\n attributes?: AnalyticsEventAttributes;\n },\n ) => void;\n};\n\n/**\n * Analytics implementations are used to track user behavior in a Backstage\n * instance.\n *\n * @remarks\n *\n * To instrument your App or Plugin, retrieve an analytics tracker using the\n * `useAnalytics()` hook. This will return a pre-configured `AnalyticsTracker`\n * with relevant methods for instrumentation.\n *\n * @public\n */\nexport type AnalyticsImplementation = {\n /**\n * Primary event handler responsible for compiling and forwarding events to\n * an analytics system.\n */\n captureEvent(event: AnalyticsEvent): void;\n};\n\n/**\n * The Analytics API is used to track user behavior in a Backstage instance.\n *\n * @remarks\n *\n * To instrument your App or Plugin, retrieve an analytics tracker using the\n * useAnalytics() hook. This will return a pre-configured AnalyticsTracker\n * with relevant methods for instrumentation.\n *\n * @public\n */\nexport type AnalyticsApi = {\n /**\n * Primary event handler responsible for compiling and forwarding events to\n * an analytics system.\n */\n captureEvent(event: AnalyticsEvent): void;\n};\n\n/**\n * The API reference of {@link AnalyticsApi}.\n *\n * @remarks\n *\n * To define a concrete Analytics Implementation, use\n * {@link AnalyticsImplementationBlueprint} instead.\n *\n * @public\n */\nexport const analyticsApiRef: ApiRef<AnalyticsApi> = createApiRef({\n id: 'core.analytics',\n});\n"],"names":[],"mappings":";;AA0JO,MAAM,kBAAwC,YAAa,CAAA;AAAA,EAChE,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppTreeApi.esm.js","sources":["../../../src/apis/definitions/AppTreeApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n FrontendPlugin,\n Extension,\n ExtensionDataRef,\n ExtensionAttachToSpec,\n} from '../../wiring';\n\n/**\n * The specification for this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The specifications for a collection of app nodes is all the information needed\n * to build the tree and instantiate the nodes.\n */\nexport interface AppNodeSpec {\n readonly id: string;\n readonly attachTo: ExtensionAttachToSpec;\n readonly extension: Extension<unknown, unknown>;\n readonly disabled: boolean;\n readonly config?: unknown;\n readonly plugin
|
|
1
|
+
{"version":3,"file":"AppTreeApi.esm.js","sources":["../../../src/apis/definitions/AppTreeApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n FrontendPlugin,\n Extension,\n ExtensionDataRef,\n ExtensionAttachToSpec,\n} from '../../wiring';\n\n/**\n * The specification for this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The specifications for a collection of app nodes is all the information needed\n * to build the tree and instantiate the nodes.\n */\nexport interface AppNodeSpec {\n readonly id: string;\n readonly attachTo: ExtensionAttachToSpec;\n readonly extension: Extension<unknown, unknown>;\n readonly disabled: boolean;\n readonly config?: unknown;\n readonly plugin: FrontendPlugin;\n}\n\n/**\n * The connections from this {@link AppNode} to other nodes.\n *\n * @public\n * @remarks\n *\n * The app node edges are resolved based on the app node specs, regardless of whether\n * adjacent nodes are disabled or not. If no parent attachment is present or\n */\nexport interface AppNodeEdges {\n readonly attachedTo?: { node: AppNode; input: string };\n readonly attachments: ReadonlyMap<string, AppNode[]>;\n}\n\n/**\n * The instance of this {@link AppNode} in the {@link AppTree}.\n *\n * @public\n * @remarks\n *\n * The app node instance is created when the `factory` function of an extension is called.\n * Instances will only be present for nodes in the app that are connected to the root\n * node and not disabled\n */\nexport interface AppNodeInstance {\n /** Returns a sequence of all extension data refs that were output by this instance */\n getDataRefs(): Iterable<ExtensionDataRef<unknown>>;\n /** Get the output data for a single extension data ref */\n getData<T>(ref: ExtensionDataRef<T>): T | undefined;\n}\n\n/**\n * A node in the {@link AppTree}.\n *\n * @public\n */\nexport interface AppNode {\n /** The specification for how this node should be instantiated */\n readonly spec: AppNodeSpec;\n /** The edges from this node to other nodes in the app tree */\n readonly edges: AppNodeEdges;\n /** The instance of this node, if it was instantiated */\n readonly instance?: AppNodeInstance;\n}\n\n/**\n * The app tree containing all {@link AppNode}s of the app.\n *\n * @public\n */\nexport interface AppTree {\n /** The root node of the app */\n readonly root: AppNode;\n /** A map of all nodes in the app by ID, including orphaned or disabled nodes */\n readonly nodes: ReadonlyMap<string /* id */, AppNode>;\n /** A sequence of all nodes with a parent that is not reachable from the app root node */\n readonly orphans: Iterable<AppNode>;\n}\n\n/**\n * The API for interacting with the {@link AppTree}.\n *\n * @public\n */\nexport interface AppTreeApi {\n /**\n * Get the {@link AppTree} for the app.\n */\n getTree(): { tree: AppTree };\n\n /**\n * Get all nodes in the app that are mounted at a given route path.\n */\n getNodesByRoutePath(routePath: string): { nodes: AppNode[] };\n}\n\n/**\n * The `ApiRef` of {@link AppTreeApi}.\n *\n * @public\n */\nexport const appTreeApiRef = createApiRef<AppTreeApi>({ id: 'core.app-tree' });\n"],"names":[],"mappings":";;AA2HO,MAAM,aAAgB,GAAA,YAAA,CAAyB,EAAE,EAAA,EAAI,iBAAiB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogApi.esm.js","sources":["../../../src/apis/definitions/DialogApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * A handle for an open dialog that can be used to interact with it.\n *\n * @remarks\n *\n * Dialogs can be opened using either {@link DialogApi.show} or {@link DialogApi.showModal}.\n *\n * @public\n */\nexport interface DialogApiDialog<TResult =
|
|
1
|
+
{"version":3,"file":"DialogApi.esm.js","sources":["../../../src/apis/definitions/DialogApi.ts"],"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 { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * A handle for an open dialog that can be used to interact with it.\n *\n * @remarks\n *\n * Dialogs can be opened using either {@link DialogApi.show} or {@link DialogApi.showModal}.\n *\n * @public\n */\nexport interface DialogApiDialog<TResult = void> {\n /**\n * Closes the dialog with that provided result.\n *\n * @remarks\n *\n * If the dialog is a modal dialog a result must always be provided. If it's a regular dialog then passing a result is optional.\n */\n close(\n ...args: undefined extends TResult ? [result?: TResult] : [result: TResult]\n ): void;\n\n /**\n * Replaces the content of the dialog with the provided element or component, causing it to be rerenedered.\n */\n update(\n elementOrComponent:\n | React.JSX.Element\n | ((props: { dialog: DialogApiDialog<TResult> }) => JSX.Element),\n ): void;\n\n /**\n * Wait until the dialog is closed and return the result.\n *\n * @remarks\n *\n * If the dialog is a modal dialog a result will always be returned. If it's a regular dialog then the result may be `undefined`.\n */\n result(): Promise<TResult>;\n}\n\n/**\n * A Utility API for showing dialogs that render in the React tree and return a result.\n *\n * @public\n */\nexport interface DialogApi {\n /**\n * Opens a modal dialog and returns a handle to it.\n *\n * @remarks\n *\n * This dialog can be closed by calling the `close` method on the returned handle, optionally providing a result.\n * The dialog can also be closed by the user by clicking the backdrop or pressing the escape key.\n *\n * If the dialog is closed without a result, the result will be `undefined`.\n *\n * @example\n *\n * ### Example with inline dialog content\n * ```tsx\n * const dialog = dialogApi.show<boolean>(\n * <DialogContent>\n * <DialogTitle>Are you sure?</DialogTitle>\n * <DialogActions>\n * <Button onClick={() => dialog.close(true)}>Yes</Button>\n * <Button onClick={() => dialog.close(false)}>No</Button>\n * </DialogActions>\n * </DialogContent>\n * );\n * const result = await dialog.result();\n * ```\n *\n * @example\n *\n * ### Example with separate dialog component\n * ```tsx\n * function CustomDialog({ dialog }: { dialog: DialogApiDialog<boolean | undefined> }) {\n * return (\n * <DialogContent>\n * <DialogTitle>Are you sure?</DialogTitle>\n * <DialogActions>\n * <Button onClick={() => dialog.close(true)}>Yes</Button>\n * <Button onClick={() => dialog.close(false)}>No</Button>\n * </DialogActions>\n * </DialogContent>\n * )\n * }\n * const result = await dialogApi.show(CustomDialog).result();\n * ```\n *\n * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle.\n * @public\n */\n show<TResult = void>(\n elementOrComponent:\n | JSX.Element\n | ((props: {\n dialog: DialogApiDialog<TResult | undefined>;\n }) => JSX.Element),\n ): DialogApiDialog<TResult | undefined>;\n\n /**\n * Opens a modal dialog and returns a handle to it.\n *\n * @remarks\n *\n * This dialog can not be closed in any other way than calling the `close` method on the returned handle and providing a result.\n *\n * @example\n *\n * ### Example with inline dialog content\n * ```tsx\n * const dialog = dialogApi.showModal<boolean>(\n * <DialogContent>\n * <DialogTitle>Are you sure?</DialogTitle>\n * <DialogActions>\n * <Button onClick={() => dialog.close(true)}>Yes</Button>\n * <Button onClick={() => dialog.close(false)}>No</Button>\n * </DialogActions>\n * </DialogContent>\n * );\n * const result = await dialog.result();\n * ```\n *\n * @example\n *\n * ### Example with separate dialog component\n * ```tsx\n * function CustomDialog({ dialog }: { dialog: DialogApiDialog<boolean> }) {\n * return (\n * <DialogContent>\n * <DialogTitle>Are you sure?</DialogTitle>\n * <DialogActions>\n * <Button onClick={() => dialog.close(true)}>Yes</Button>\n * <Button onClick={() => dialog.close(false)}>No</Button>\n * </DialogActions>\n * </DialogContent>\n * )\n * }\n * const result = await dialogApi.showModal(CustomDialog).result();\n * ```\n *\n * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle.\n * @public\n */\n showModal<TResult = void>(\n elementOrComponent:\n | JSX.Element\n | ((props: { dialog: DialogApiDialog<TResult> }) => JSX.Element),\n ): DialogApiDialog<TResult>;\n}\n\n/**\n * The `ApiRef` of {@link DialogApi}.\n *\n * @public\n */\nexport const dialogApiRef = createApiRef<DialogApi>({\n id: 'core.dialog',\n});\n"],"names":[],"mappings":";;AA+KO,MAAM,eAAe,YAAwB,CAAA;AAAA,EAClD,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteResolutionApi.esm.js","sources":["../../../src/apis/definitions/RouteResolutionApi.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 AnyRouteRefParams,\n RouteRef,\n SubRouteRef,\n ExternalRouteRef,\n} from '../../routing';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * TS magic for handling route parameters.\n *\n * @remarks\n *\n * The extra TS magic here is to require a single params argument if the RouteRef\n * had at least one param defined, but require 0 arguments if there are no params defined.\n * Without this we'd have to pass in empty object to all parameter-less RouteRefs\n * just to make TypeScript happy, or we would have to make the argument optional in\n * which case you might forget to pass it in when it is actually required.\n *\n * @public\n */\nexport type RouteFunc<TParams extends AnyRouteRefParams> = (\n ...[params]: TParams extends undefined\n ? readonly []\n : readonly [params: TParams]\n) => string;\n\n/**\n * @public\n */\nexport
|
|
1
|
+
{"version":3,"file":"RouteResolutionApi.esm.js","sources":["../../../src/apis/definitions/RouteResolutionApi.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 AnyRouteRefParams,\n RouteRef,\n SubRouteRef,\n ExternalRouteRef,\n} from '../../routing';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * TS magic for handling route parameters.\n *\n * @remarks\n *\n * The extra TS magic here is to require a single params argument if the RouteRef\n * had at least one param defined, but require 0 arguments if there are no params defined.\n * Without this we'd have to pass in empty object to all parameter-less RouteRefs\n * just to make TypeScript happy, or we would have to make the argument optional in\n * which case you might forget to pass it in when it is actually required.\n *\n * @public\n */\nexport type RouteFunc<TParams extends AnyRouteRefParams> = (\n ...[params]: TParams extends undefined\n ? readonly []\n : readonly [params: TParams]\n) => string;\n\n/**\n * @public\n */\nexport interface RouteResolutionApi {\n resolve<TParams extends AnyRouteRefParams>(\n anyRouteRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams>,\n options?: {\n /**\n * An absolute path to use as a starting point when resolving the route.\n * If no path is provided the route will be resolved from the root of the app.\n */\n sourcePath?: string;\n },\n ): RouteFunc<TParams> | undefined;\n}\n\n/**\n * The `ApiRef` of {@link RouteResolutionApi}.\n *\n * @public\n */\nexport const routeResolutionApiRef = createApiRef<RouteResolutionApi>({\n id: 'core.route-resolution',\n});\n"],"names":[],"mappings":";;AAmEO,MAAM,wBAAwB,YAAiC,CAAA;AAAA,EACpE,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../../src/apis/definitions/SwappableComponentsApi.ts"],"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 { SwappableComponentRef } from '../../components';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * API for looking up components based on component refs.\n *\n * @public\n */\nexport interface SwappableComponentsApi {\n getComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n >(\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>,\n ): (props: TInnerComponentProps) => JSX.Element | null;\n}\n\n/**\n * The `ApiRef` of {@link SwappableComponentsApi}.\n *\n * @public\n */\nexport const swappableComponentsApiRef = createApiRef<SwappableComponentsApi>({\n id: 'core.swappable-components',\n});\n"],"names":[],"mappings":";;AAsCO,MAAM,4BAA4B,YAAqC,CAAA;AAAA,EAC5E,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../wiring/coreExtensionData.esm.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import 'zod-to-json-schema';
|
|
4
|
+
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
5
|
+
import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
|
+
|
|
7
|
+
const factoryDataRef = createExtensionDataRef().with({
|
|
8
|
+
id: "core.analytics.factory"
|
|
9
|
+
});
|
|
10
|
+
const AnalyticsImplementationBlueprint = createExtensionBlueprint({
|
|
11
|
+
kind: "analytics",
|
|
12
|
+
attachTo: [{ id: "api:app/analytics", input: "implementations" }],
|
|
13
|
+
output: [factoryDataRef],
|
|
14
|
+
dataRefs: {
|
|
15
|
+
factory: factoryDataRef
|
|
16
|
+
},
|
|
17
|
+
defineParams: (params) => createExtensionBlueprintParams(params),
|
|
18
|
+
*factory(params) {
|
|
19
|
+
yield factoryDataRef(params);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { AnalyticsImplementationBlueprint };
|
|
24
|
+
//# sourceMappingURL=AnalyticsImplementationBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsImplementationBlueprint.esm.js","sources":["../../src/blueprints/AnalyticsImplementationBlueprint.ts"],"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 { AnalyticsImplementation, TypesToApiRefs } from '../apis';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/** @public */\nexport type AnalyticsImplementationFactory<\n Deps extends { [name in string]: unknown } = {},\n> = {\n deps: TypesToApiRefs<Deps>;\n factory(deps: Deps): AnalyticsImplementation;\n};\n\nconst factoryDataRef =\n createExtensionDataRef<AnalyticsImplementationFactory>().with({\n id: 'core.analytics.factory',\n });\n\n/**\n * Creates analytics implementations.\n *\n * @public\n */\nexport const AnalyticsImplementationBlueprint = createExtensionBlueprint({\n kind: 'analytics',\n attachTo: [{ id: 'api:app/analytics', input: 'implementations' }],\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <TDeps extends { [name in string]: unknown }>(\n params: AnalyticsImplementationFactory<TDeps>,\n ) => createExtensionBlueprintParams(params as AnalyticsImplementationFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;;;AA+BA,MAAM,cAAA,GACJ,sBAAuD,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5D,EAAI,EAAA;AACN,CAAC,CAAA;AAOI,MAAM,mCAAmC,wBAAyB,CAAA;AAAA,EACvE,IAAM,EAAA,WAAA;AAAA,EACN,UAAU,CAAC,EAAE,IAAI,mBAAqB,EAAA,KAAA,EAAO,mBAAmB,CAAA;AAAA,EAChE,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,GACX;AAAA,EACA,YAAc,EAAA,CACZ,MACG,KAAA,8BAAA,CAA+B,MAAwC,CAAA;AAAA,EAC5E,CAAC,QAAQ,MAAQ,EAAA;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA;AAE/B,CAAC;;;;"}
|
|
@@ -8,9 +8,7 @@ const AppRootElementBlueprint = createExtensionBlueprint({
|
|
|
8
8
|
attachTo: { id: "app/root", input: "elements" },
|
|
9
9
|
output: [coreExtensionData.reactElement],
|
|
10
10
|
*factory(params) {
|
|
11
|
-
yield coreExtensionData.reactElement(
|
|
12
|
-
typeof params.element === "function" ? params.element() : params.element
|
|
13
|
-
);
|
|
11
|
+
yield coreExtensionData.reactElement(params.element);
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element
|
|
1
|
+
{"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element }) {\n yield coreExtensionData.reactElement(params.element);\n },\n});\n"],"names":[],"mappings":";;;;;AAwBO,MAAM,0BAA0B,wBAAyB,CAAA;AAAA,EAC9D,IAAM,EAAA,kBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,EAC9C,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,QAAQ,MAAkC,EAAA;AACzC,IAAM,MAAA,iBAAA,CAAkB,YAAa,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA;AAEvD,CAAC;;;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
1
|
import '../wiring/coreExtensionData.esm.js';
|
|
3
2
|
import 'zod';
|
|
4
3
|
import 'zod-to-json-schema';
|
|
@@ -14,10 +13,7 @@ const AppRootWrapperBlueprint = createExtensionBlueprint({
|
|
|
14
13
|
component: componentDataRef
|
|
15
14
|
},
|
|
16
15
|
*factory(params) {
|
|
17
|
-
|
|
18
|
-
return /* @__PURE__ */ jsx(params.Component, { children: props.children });
|
|
19
|
-
};
|
|
20
|
-
yield componentDataRef(Component);
|
|
16
|
+
yield componentDataRef(params.component);
|
|
21
17
|
}
|
|
22
18
|
});
|
|
23
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootWrapperBlueprint.esm.js","sources":["../../src/blueprints/AppRootWrapperBlueprint.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 {
|
|
1
|
+
{"version":3,"file":"AppRootWrapperBlueprint.esm.js","sources":["../../src/blueprints/AppRootWrapperBlueprint.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 { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.root.wrapper' });\n\n/**\n * Creates a extensions that render a React wrapper at the app root, enclosing\n * the app layout. This is useful for example for adding global React contexts\n * and similar.\n *\n * @public\n */\nexport const AppRootWrapperBlueprint = createExtensionBlueprint({\n kind: 'app-root-wrapper',\n attachTo: { id: 'app/root', input: 'wrappers' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAEvB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,oBAAoB,CAAA;AAS5B,MAAM,0BAA0B,wBAAyB,CAAA;AAAA,EAC9D,IAAM,EAAA,kBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,EAC9C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAIN,EAAA;AACD,IAAM,MAAA,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA;AAE3C,CAAC;;;;"}
|
|
@@ -3,7 +3,17 @@ import 'zod';
|
|
|
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';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../apis/definitions/AppTreeApi.esm.js';
|
|
8
|
+
import '@backstage/core-plugin-api';
|
|
9
|
+
import '../apis/definitions/SwappableComponentsApi.esm.js';
|
|
10
|
+
import '../apis/definitions/IconsApi.esm.js';
|
|
11
|
+
import '../apis/definitions/DialogApi.esm.js';
|
|
12
|
+
import '../apis/definitions/RouteResolutionApi.esm.js';
|
|
13
|
+
import '../apis/definitions/AnalyticsApi.esm.js';
|
|
14
|
+
import 'react';
|
|
6
15
|
import '../components/AppNodeProvider.esm.js';
|
|
16
|
+
import '../components/DefaultSwappableComponents.esm.js';
|
|
7
17
|
|
|
8
18
|
const PageBlueprint = createExtensionBlueprint({
|
|
9
19
|
kind: "page",
|
|
@@ -18,15 +28,13 @@ const PageBlueprint = createExtensionBlueprint({
|
|
|
18
28
|
path: (z) => z.string().optional()
|
|
19
29
|
}
|
|
20
30
|
},
|
|
21
|
-
*factory({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (routeRef) {
|
|
29
|
-
yield coreExtensionData.routeRef(routeRef);
|
|
31
|
+
*factory(params, { config, node }) {
|
|
32
|
+
yield coreExtensionData.routePath(config.path ?? params.path);
|
|
33
|
+
yield coreExtensionData.reactElement(
|
|
34
|
+
ExtensionBoundary.lazy(node, params.loader)
|
|
35
|
+
);
|
|
36
|
+
if (params.routeRef) {
|
|
37
|
+
yield coreExtensionData.routeRef(params.routeRef);
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
});
|
|
@@ -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 { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\n\n/**\n * Createx 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 output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n },\n },\n *factory(\n {\n
|
|
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 { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\n\n/**\n * Createx 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 output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n ],\n config: {\n schema: {\n path: z => z.string().optional(),\n },\n },\n *factory(\n params: {\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultPath?: [Error: `Use the 'path' param instead`];\n path: string;\n loader: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAyBO,MAAM,gBAAgB,wBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,QAAS,EAAA;AAAA,EAC9C,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,SAAA;AAAA,IAClB,iBAAkB,CAAA,YAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAS;AAAA,GACtC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS;AAAA;AACjC,GACF;AAAA,EACA,CAAC,OACC,CAAA,MAAA,EASA,EAAE,MAAA,EAAQ,MACV,EAAA;AACA,IAAA,MAAM,iBAAkB,CAAA,SAAA,CAAU,MAAO,CAAA,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAkB,CAAA,YAAA;AAAA,MACtB,iBAAkB,CAAA,IAAA,CAAK,IAAM,EAAA,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAU,EAAA;AACnB,MAAM,MAAA,iBAAA,CAAkB,QAAS,CAAA,MAAA,CAAO,QAAQ,CAAA;AAAA;AAClD;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterBlueprint.esm.js","sources":["../../src/blueprints/RouterBlueprint.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 {
|
|
1
|
+
{"version":3,"file":"RouterBlueprint.esm.js","sources":["../../src/blueprints/RouterBlueprint.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 { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\nconst componentDataRef = createExtensionDataRef<\n (props: { children: ReactNode }) => JSX.Element | null\n>().with({ id: 'app.router.wrapper' });\n\n/** @public */\nexport const RouterBlueprint = createExtensionBlueprint({\n kind: 'app-router-component',\n attachTo: { id: 'app/root', input: 'router' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(params: {\n /** @deprecated use the `component` parameter instead */\n Component?: [error: 'Use the `component` parameter instead'];\n component: (props: { children: ReactNode }) => JSX.Element | null;\n }) {\n yield componentDataRef(params.component);\n },\n});\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,sBAEvB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,sBAAsB,CAAA;AAG9B,MAAM,kBAAkB,wBAAyB,CAAA;AAAA,EACtD,IAAM,EAAA,sBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,QAAS,EAAA;AAAA,EAC5C,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,GACb;AAAA,EACA,CAAC,QAAQ,MAIN,EAAA;AACD,IAAM,MAAA,gBAAA,CAAiB,OAAO,SAAS,CAAA;AAAA;AAE3C,CAAC;;;;"}
|
|
@@ -6,7 +6,15 @@ import 'zod-to-json-schema';
|
|
|
6
6
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
7
7
|
import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
|
|
8
8
|
import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
|
|
9
|
+
import '../apis/definitions/AppTreeApi.esm.js';
|
|
10
|
+
import '@backstage/core-plugin-api';
|
|
11
|
+
import '../apis/definitions/SwappableComponentsApi.esm.js';
|
|
12
|
+
import '../apis/definitions/IconsApi.esm.js';
|
|
13
|
+
import '../apis/definitions/DialogApi.esm.js';
|
|
14
|
+
import '../apis/definitions/RouteResolutionApi.esm.js';
|
|
15
|
+
import '../apis/definitions/AnalyticsApi.esm.js';
|
|
9
16
|
import '../components/AppNodeProvider.esm.js';
|
|
17
|
+
import '../components/DefaultSwappableComponents.esm.js';
|
|
10
18
|
|
|
11
19
|
const componentDataRef = createExtensionDataRef().with({ id: "core.sign-in-page.component" });
|
|
12
20
|
const SignInPageBlueprint = createExtensionBlueprint({
|
|
@@ -22,7 +30,7 @@ const SignInPageBlueprint = createExtensionBlueprint({
|
|
|
22
30
|
const ExtensionComponent = lazy(
|
|
23
31
|
() => loader().then((component) => ({ default: component }))
|
|
24
32
|
);
|
|
25
|
-
yield componentDataRef((props) => /* @__PURE__ */ jsx(ExtensionBoundary, { node,
|
|
33
|
+
yield componentDataRef((props) => /* @__PURE__ */ jsx(ExtensionBoundary, { node, children: /* @__PURE__ */ jsx(ExtensionComponent, { ...props }) }));
|
|
26
34
|
}
|
|
27
35
|
});
|
|
28
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInPageBlueprint.esm.js","sources":["../../src/blueprints/SignInPageBlueprint.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, lazy } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { SignInPageProps } from '@backstage/core-plugin-api';\nimport { ExtensionBoundary } from '../components';\n\nconst componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n>().with({ id: 'core.sign-in-page.component' });\n\n/**\n * Creates an extension that replaces the sign in page.\n *\n * @public\n */\nexport const SignInPageBlueprint = createExtensionBlueprint({\n kind: 'sign-in-page',\n attachTo: { id: 'app/root', input: 'signInPage' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(\n {\n loader,\n }: {\n loader: () => Promise<ComponentType<SignInPageProps>>;\n },\n { node },\n ) {\n const ExtensionComponent = lazy(() =>\n loader().then(component => ({ default: component })),\n );\n\n yield componentDataRef(props => (\n <ExtensionBoundary node={node}
|
|
1
|
+
{"version":3,"file":"SignInPageBlueprint.esm.js","sources":["../../src/blueprints/SignInPageBlueprint.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, lazy } from 'react';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { SignInPageProps } from '@backstage/core-plugin-api';\nimport { ExtensionBoundary } from '../components';\n\nconst componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n>().with({ id: 'core.sign-in-page.component' });\n\n/**\n * Creates an extension that replaces the sign in page.\n *\n * @public\n */\nexport const SignInPageBlueprint = createExtensionBlueprint({\n kind: 'sign-in-page',\n attachTo: { id: 'app/root', input: 'signInPage' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n *factory(\n {\n loader,\n }: {\n loader: () => Promise<ComponentType<SignInPageProps>>;\n },\n { node },\n ) {\n const ExtensionComponent = lazy(() =>\n loader().then(component => ({ default: component })),\n );\n\n yield componentDataRef(props => (\n <ExtensionBoundary node={node}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ));\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,MAAM,mBAAmB,sBAEvB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,+BAA+B,CAAA;AAOvC,MAAM,sBAAsB,wBAAyB,CAAA;AAAA,EAC1D,IAAM,EAAA,cAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,YAAa,EAAA;AAAA,EAChD,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,GACb;AAAA,EACA,CAAC,OACC,CAAA;AAAA,IACE;AAAA,GACF,EAGA,EAAE,IAAA,EACF,EAAA;AACA,IAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,MAAK,MAC9B,QAAS,CAAA,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAY,CAAA;AAAA,KACrD;AAEA,IAAM,MAAA,gBAAA,CAAiB,CACrB,KAAA,qBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,IAAA,EACjB,8BAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,EACjC,CACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '../wiring/coreExtensionData.esm.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import 'zod-to-json-schema';
|
|
4
|
+
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
5
|
+
import { createExtensionBlueprint, createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint.esm.js';
|
|
6
|
+
|
|
7
|
+
const componentDataRef = createExtensionDataRef().with({ id: "core.swappableComponent" });
|
|
8
|
+
const SwappableComponentBlueprint = createExtensionBlueprint({
|
|
9
|
+
kind: "component",
|
|
10
|
+
attachTo: { id: "api:app/swappable-components", input: "components" },
|
|
11
|
+
output: [componentDataRef],
|
|
12
|
+
dataRefs: {
|
|
13
|
+
component: componentDataRef
|
|
14
|
+
},
|
|
15
|
+
defineParams(params) {
|
|
16
|
+
return createExtensionBlueprintParams(params);
|
|
17
|
+
},
|
|
18
|
+
factory: (params) => [
|
|
19
|
+
componentDataRef({
|
|
20
|
+
ref: params.component.ref,
|
|
21
|
+
loader: params.loader
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { SwappableComponentBlueprint, componentDataRef };
|
|
27
|
+
//# sourceMappingURL=SwappableComponentBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwappableComponentBlueprint.esm.js","sources":["../../src/blueprints/SwappableComponentBlueprint.ts"],"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 */\nimport { SwappableComponentRef } from '../components';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\nexport const componentDataRef = createExtensionDataRef<{\n ref: SwappableComponentRef;\n loader:\n | (() => (props: {}) => JSX.Element | null)\n | (() => Promise<(props: {}) => JSX.Element | null>);\n}>().with({ id: 'core.swappableComponent' });\n\n/**\n * Blueprint for creating swappable components from a SwappableComponentRef and a loader\n *\n * @public\n */\nexport const SwappableComponentBlueprint = createExtensionBlueprint({\n kind: 'component',\n attachTo: { id: 'api:app/swappable-components', input: 'components' },\n output: [componentDataRef],\n dataRefs: {\n component: componentDataRef,\n },\n defineParams<Ref extends SwappableComponentRef<any>>(params: {\n component: Ref extends SwappableComponentRef<\n any,\n infer IExternalComponentProps\n >\n ? { ref: Ref } & ((props: IExternalComponentProps) => JSX.Element | null)\n : never;\n loader: Ref extends SwappableComponentRef<infer IInnerComponentProps, any>\n ?\n | (() => (props: IInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: IInnerComponentProps) => JSX.Element | null>)\n : never;\n }) {\n return createExtensionBlueprintParams(params);\n },\n factory: params => [\n componentDataRef({\n ref: params.component.ref,\n loader: params.loader,\n }),\n ],\n});\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,mBAAmB,sBAK7B,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,2BAA2B;AAOpC,MAAM,8BAA8B,wBAAyB,CAAA;AAAA,EAClE,IAAM,EAAA,WAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,8BAAA,EAAgC,OAAO,YAAa,EAAA;AAAA,EACpE,MAAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,GACb;AAAA,EACA,aAAqD,MAYlD,EAAA;AACD,IAAA,OAAO,+BAA+B,MAAM,CAAA;AAAA,GAC9C;AAAA,EACA,SAAS,CAAU,MAAA,KAAA;AAAA,IACjB,gBAAiB,CAAA;AAAA,MACf,GAAA,EAAK,OAAO,SAAU,CAAA,GAAA;AAAA,MACtB,QAAQ,MAAO,CAAA;AAAA,KAChB;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createSwappableComponent } from './createSwappableComponent.esm.js';
|
|
3
|
+
|
|
4
|
+
const Progress = createSwappableComponent({
|
|
5
|
+
id: "core-progress"
|
|
6
|
+
});
|
|
7
|
+
const NotFoundErrorPage = createSwappableComponent({
|
|
8
|
+
id: "core-not-found-error-page"
|
|
9
|
+
});
|
|
10
|
+
const ErrorDisplay = createSwappableComponent({
|
|
11
|
+
id: "core-error-display",
|
|
12
|
+
loader: () => (props) => /* @__PURE__ */ jsx("div", { "data-testid": "core-error-display", children: props.error.message })
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { ErrorDisplay, NotFoundErrorPage, Progress };
|
|
16
|
+
//# sourceMappingURL=DefaultSwappableComponents.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultSwappableComponents.esm.js","sources":["../../src/components/DefaultSwappableComponents.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 {\n ErrorDisplayProps,\n NotFoundErrorPageProps,\n ProgressProps,\n} from '../types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * @public\n */\nexport const Progress = createSwappableComponent<ProgressProps>({\n id: 'core-progress',\n});\n\n/**\n * @public\n */\nexport const NotFoundErrorPage =\n createSwappableComponent<NotFoundErrorPageProps>({\n id: 'core-not-found-error-page',\n });\n\n/**\n * @public\n */\nexport const ErrorDisplay = createSwappableComponent<ErrorDisplayProps>({\n id: 'core-error-display',\n loader: () => props =>\n <div data-testid=\"core-error-display\">{props.error.message}</div>,\n});\n"],"names":[],"mappings":";;;AA0BO,MAAM,WAAW,wBAAwC,CAAA;AAAA,EAC9D,EAAI,EAAA;AACN,CAAC;AAKM,MAAM,oBACX,wBAAiD,CAAA;AAAA,EAC/C,EAAI,EAAA;AACN,CAAC;AAKI,MAAM,eAAe,wBAA4C,CAAA;AAAA,EACtE,EAAI,EAAA,oBAAA;AAAA,EACJ,MAAA,EAAQ,MAAM,CACZ,KAAA,qBAAA,GAAA,CAAC,SAAI,aAAY,EAAA,oBAAA,EAAsB,QAAM,EAAA,KAAA,CAAA,KAAA,CAAM,OAAQ,EAAA;AAC/D,CAAC;;;;"}
|