@backstage/plugin-home-react 0.1.34 → 0.1.35-next.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.
- package/CHANGELOG.md +21 -0
- package/dist/alpha/blueprints/HomePageLayoutBlueprint.esm.js +19 -0
- package/dist/alpha/blueprints/HomePageLayoutBlueprint.esm.js.map +1 -0
- package/dist/alpha/blueprints/HomePageWidgetBlueprint.esm.js +56 -0
- package/dist/alpha/blueprints/HomePageWidgetBlueprint.esm.js.map +1 -0
- package/dist/alpha/dataRefs.esm.js +11 -0
- package/dist/alpha/dataRefs.esm.js.map +1 -0
- package/dist/alpha.d.ts +168 -1
- package/dist/alpha.esm.js +3 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/extensions.esm.js +2 -2
- package/dist/extensions.esm.js.map +1 -1
- package/dist/index.d.ts +5 -74
- package/dist/translation.esm.js.map +1 -1
- package/dist/types/extensions.d-BO9FVXbP.d.ts +76 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/plugin-home-react
|
|
2
2
|
|
|
3
|
+
## 0.1.35-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 90956a6: Support new frontend system in the homepage plugin
|
|
8
|
+
- a7e0d50: Prepare for React Router v7 migration by updating to v6.30.2 across all NFS packages and enabling v7 future flags. Convert routes from splat paths to parent/child structure with Outlet components.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/frontend-plugin-api@0.14.0-next.2
|
|
11
|
+
- @backstage/core-compat-api@0.5.8-next.2
|
|
12
|
+
- @backstage/core-components@0.18.7-next.2
|
|
13
|
+
- @backstage/core-plugin-api@1.12.3-next.1
|
|
14
|
+
|
|
15
|
+
## 0.1.35-next.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/core-components@0.18.6-next.0
|
|
21
|
+
- @backstage/frontend-plugin-api@0.14.0-next.0
|
|
22
|
+
- @backstage/core-plugin-api@1.12.2-next.0
|
|
23
|
+
|
|
3
24
|
## 0.1.34
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createExtensionBlueprint, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { homePageLayoutComponentDataRef } from '../dataRefs.esm.js';
|
|
3
|
+
|
|
4
|
+
const HomePageLayoutBlueprint = createExtensionBlueprint({
|
|
5
|
+
kind: "home-page-layout",
|
|
6
|
+
attachTo: { id: "page:home", input: "layout" },
|
|
7
|
+
output: [homePageLayoutComponentDataRef],
|
|
8
|
+
dataRefs: {
|
|
9
|
+
component: homePageLayoutComponentDataRef
|
|
10
|
+
},
|
|
11
|
+
*factory({ loader }, { node }) {
|
|
12
|
+
yield homePageLayoutComponentDataRef(
|
|
13
|
+
ExtensionBoundary.lazyComponent(node, loader)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { HomePageLayoutBlueprint };
|
|
19
|
+
//# sourceMappingURL=HomePageLayoutBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePageLayoutBlueprint.esm.js","sources":["../../../src/alpha/blueprints/HomePageLayoutBlueprint.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 { JSX } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n homePageLayoutComponentDataRef,\n HomePageLayoutProps,\n} from '../dataRefs';\n\n/**\n * Parameters for creating a home page layout extension.\n *\n * @alpha\n */\nexport interface HomePageLayoutBlueprintParams {\n /**\n * Async loader that returns the layout component.\n * The component receives the collected widgets and renders them.\n */\n loader: () => Promise<(props: HomePageLayoutProps) => JSX.Element>;\n}\n\n/**\n * Blueprint for creating custom home page layouts.\n *\n * A layout receives the list of installed widgets and is responsible for\n * arranging them on the home page. This follows the same pattern as\n * `EntityContentLayoutBlueprint` in the catalog plugin.\n *\n * If no layout extension is installed, the home page uses a built-in default.\n * Users can install their own layout to customize how widgets are arranged.\n *\n * @alpha\n */\nexport const HomePageLayoutBlueprint = createExtensionBlueprint({\n kind: 'home-page-layout',\n attachTo: { id: 'page:home', input: 'layout' },\n output: [homePageLayoutComponentDataRef],\n dataRefs: {\n component: homePageLayoutComponentDataRef,\n },\n *factory({ loader }: HomePageLayoutBlueprintParams, { node }) {\n yield homePageLayoutComponentDataRef(\n ExtensionBoundary.lazyComponent(node, loader),\n );\n },\n});\n"],"names":[],"mappings":";;;AAmDO,MAAM,0BAA0B,wBAAA,CAAyB;AAAA,EAC9D,IAAA,EAAM,kBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,WAAA,EAAa,OAAO,QAAA,EAAS;AAAA,EAC7C,MAAA,EAAQ,CAAC,8BAA8B,CAAA;AAAA,EACvC,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,GACb;AAAA,EACA,CAAC,OAAA,CAAQ,EAAE,QAAO,EAAkC,EAAE,MAAK,EAAG;AAC5D,IAAA,MAAM,8BAAA;AAAA,MACJ,iBAAA,CAAkB,aAAA,CAAc,IAAA,EAAM,MAAM;AAAA,KAC9C;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy } from 'react';
|
|
3
|
+
import { createExtensionBlueprint, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
4
|
+
import { attachComponentData } from '@backstage/core-plugin-api';
|
|
5
|
+
import { CardExtension } from '../../extensions.esm.js';
|
|
6
|
+
import { homePageWidgetDataRef } from '../dataRefs.esm.js';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_WIDGET_ATTACH_POINT = {
|
|
9
|
+
id: "page:home",
|
|
10
|
+
input: "widgets"
|
|
11
|
+
};
|
|
12
|
+
const HomePageWidgetBlueprint = createExtensionBlueprint({
|
|
13
|
+
kind: "home-page-widget",
|
|
14
|
+
attachTo: DEFAULT_WIDGET_ATTACH_POINT,
|
|
15
|
+
dataRefs: {
|
|
16
|
+
widget: homePageWidgetDataRef
|
|
17
|
+
},
|
|
18
|
+
output: [homePageWidgetDataRef],
|
|
19
|
+
*factory(params, { node }) {
|
|
20
|
+
const isCustomizable = params.settings?.schema !== void 0;
|
|
21
|
+
const widgetName = params.name ?? node.spec.id;
|
|
22
|
+
const LazyCard = lazy(
|
|
23
|
+
() => params.components().then((parts) => ({
|
|
24
|
+
default: (props) => /* @__PURE__ */ jsx(
|
|
25
|
+
CardExtension,
|
|
26
|
+
{
|
|
27
|
+
...props,
|
|
28
|
+
...parts,
|
|
29
|
+
title: props.title || params.title,
|
|
30
|
+
isCustomizable
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}))
|
|
34
|
+
);
|
|
35
|
+
const Widget = (props) => /* @__PURE__ */ jsx(ExtensionBoundary, { node, children: /* @__PURE__ */ jsx(LazyCard, { ...props }) });
|
|
36
|
+
attachComponentData(Widget, "core.extensionName", widgetName);
|
|
37
|
+
attachComponentData(Widget, "title", params.title);
|
|
38
|
+
attachComponentData(Widget, "description", params.description);
|
|
39
|
+
attachComponentData(Widget, "home.widget.config", {
|
|
40
|
+
layout: params.layout,
|
|
41
|
+
settings: params.settings
|
|
42
|
+
});
|
|
43
|
+
yield homePageWidgetDataRef({
|
|
44
|
+
node,
|
|
45
|
+
component: /* @__PURE__ */ jsx(Widget, { ...params.componentProps ?? {} }),
|
|
46
|
+
name: widgetName,
|
|
47
|
+
title: params.title,
|
|
48
|
+
description: params.description,
|
|
49
|
+
layout: params.layout,
|
|
50
|
+
settings: params.settings
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export { HomePageWidgetBlueprint };
|
|
56
|
+
//# sourceMappingURL=HomePageWidgetBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePageWidgetBlueprint.esm.js","sources":["../../../src/alpha/blueprints/HomePageWidgetBlueprint.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, ReactElement } from 'react';\nimport {\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport { attachComponentData } from '@backstage/core-plugin-api';\nimport {\n CardExtension,\n CardExtensionProps,\n CardLayout,\n CardSettings,\n ComponentParts,\n} from '../../extensions';\nimport { homePageWidgetDataRef } from '../dataRefs';\n\n/**\n * Parameters for creating a home page widget extension.\n *\n * @alpha\n */\nexport interface HomePageWidgetBlueprintParams {\n /**\n * Optional name for the widget. If not provided, the extension will use only its kind\n * in the extension ID.\n */\n name?: string;\n /**\n * Optional title displayed for the widget, used as the default card heading.\n */\n title?: string;\n /**\n * Optional description shown in the widget catalog when adding new cards.\n */\n description?: string;\n /**\n * Component parts rendered within the card.\n */\n components: () => Promise<ComponentParts>;\n /**\n * Layout hints used by the customizable grid.\n */\n layout?: CardLayout;\n /**\n * Schema used to configure widget settings.\n */\n settings?: CardSettings;\n /**\n * Default props forwarded to the rendered widget component.\n */\n componentProps?: Record<string, unknown>;\n}\n\nconst DEFAULT_WIDGET_ATTACH_POINT = {\n id: 'page:home',\n input: 'widgets',\n} as const;\n\n/**\n * Creates widgets that can be installed into the home page grid.\n *\n * @alpha\n */\nexport const HomePageWidgetBlueprint = createExtensionBlueprint({\n kind: 'home-page-widget',\n attachTo: DEFAULT_WIDGET_ATTACH_POINT,\n dataRefs: {\n widget: homePageWidgetDataRef,\n },\n output: [homePageWidgetDataRef],\n *factory(params: HomePageWidgetBlueprintParams, { node }) {\n const isCustomizable = params.settings?.schema !== undefined;\n const widgetName = params.name ?? node.spec.id;\n const LazyCard = lazy(() =>\n params.components().then(parts => ({\n default: (props: CardExtensionProps<Record<string, unknown>>) => (\n <CardExtension\n {...props}\n {...parts}\n title={props.title || params.title}\n isCustomizable={isCustomizable}\n />\n ),\n })),\n );\n\n const Widget = (\n props: CardExtensionProps<Record<string, unknown>>,\n ): ReactElement => (\n <ExtensionBoundary node={node}>\n <LazyCard {...props} />\n </ExtensionBoundary>\n );\n\n attachComponentData(Widget, 'core.extensionName', widgetName);\n attachComponentData(Widget, 'title', params.title);\n attachComponentData(Widget, 'description', params.description);\n attachComponentData(Widget, 'home.widget.config', {\n layout: params.layout,\n settings: params.settings,\n });\n\n yield homePageWidgetDataRef({\n node,\n component: <Widget {...(params.componentProps ?? {})} />,\n name: widgetName,\n title: params.title,\n description: params.description,\n layout: params.layout,\n settings: params.settings,\n });\n },\n});\n"],"names":[],"mappings":";;;;;;;AAoEA,MAAM,2BAAA,GAA8B;AAAA,EAClC,EAAA,EAAI,WAAA;AAAA,EACJ,KAAA,EAAO;AACT,CAAA;AAOO,MAAM,0BAA0B,wBAAA,CAAyB;AAAA,EAC9D,IAAA,EAAM,kBAAA;AAAA,EACN,QAAA,EAAU,2BAAA;AAAA,EACV,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,MAAA,EAAQ,CAAC,qBAAqB,CAAA;AAAA,EAC9B,CAAC,OAAA,CAAQ,MAAA,EAAuC,EAAE,MAAK,EAAG;AACxD,IAAA,MAAM,cAAA,GAAiB,MAAA,CAAO,QAAA,EAAU,MAAA,KAAW,MAAA;AACnD,IAAA,MAAM,UAAA,GAAa,MAAA,CAAO,IAAA,IAAQ,IAAA,CAAK,IAAA,CAAK,EAAA;AAC5C,IAAA,MAAM,QAAA,GAAW,IAAA;AAAA,MAAK,MACpB,MAAA,CAAO,UAAA,EAAW,CAAE,KAAK,CAAA,KAAA,MAAU;AAAA,QACjC,OAAA,EAAS,CAAC,KAAA,qBACR,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACE,GAAG,KAAA;AAAA,YACH,GAAG,KAAA;AAAA,YACJ,KAAA,EAAO,KAAA,CAAM,KAAA,IAAS,MAAA,CAAO,KAAA;AAAA,YAC7B;AAAA;AAAA;AACF,OAEJ,CAAE;AAAA,KACJ;AAEA,IAAA,MAAM,MAAA,GAAS,CACb,KAAA,qBAEA,GAAA,CAAC,iBAAA,EAAA,EAAkB,MACjB,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,KAAA,EAAO,CAAA,EACvB,CAAA;AAGF,IAAA,mBAAA,CAAoB,MAAA,EAAQ,sBAAsB,UAAU,CAAA;AAC5D,IAAA,mBAAA,CAAoB,MAAA,EAAQ,OAAA,EAAS,MAAA,CAAO,KAAK,CAAA;AACjD,IAAA,mBAAA,CAAoB,MAAA,EAAQ,aAAA,EAAe,MAAA,CAAO,WAAW,CAAA;AAC7D,IAAA,mBAAA,CAAoB,QAAQ,oBAAA,EAAsB;AAAA,MAChD,QAAQ,MAAA,CAAO,MAAA;AAAA,MACf,UAAU,MAAA,CAAO;AAAA,KAClB,CAAA;AAED,IAAA,MAAM,qBAAA,CAAsB;AAAA,MAC1B,IAAA;AAAA,MACA,2BAAW,GAAA,CAAC,MAAA,EAAA,EAAQ,GAAI,MAAA,CAAO,cAAA,IAAkB,EAAC,EAAI,CAAA;AAAA,MACtD,IAAA,EAAM,UAAA;AAAA,MACN,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,aAAa,MAAA,CAAO,WAAA;AAAA,MACpB,QAAQ,MAAA,CAAO,MAAA;AAAA,MACf,UAAU,MAAA,CAAO;AAAA,KAClB,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createExtensionDataRef } from '@backstage/frontend-plugin-api';
|
|
2
|
+
|
|
3
|
+
const homePageWidgetDataRef = createExtensionDataRef().with({
|
|
4
|
+
id: "home.widget.data"
|
|
5
|
+
});
|
|
6
|
+
const homePageLayoutComponentDataRef = createExtensionDataRef().with({
|
|
7
|
+
id: "home.layout.component"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { homePageLayoutComponentDataRef, homePageWidgetDataRef };
|
|
11
|
+
//# sourceMappingURL=dataRefs.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataRefs.esm.js","sources":["../../src/alpha/dataRefs.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 {\n createExtensionDataRef,\n type AppNode,\n} from '@backstage/frontend-plugin-api';\nimport { JSX, ReactElement } from 'react';\nimport type { CardLayout, CardSettings } from '../extensions';\n\n/**\n * Extension data for homepage widgets, bundling the rendered component\n * with its metadata.\n *\n * @alpha\n */\nexport interface HomePageWidgetData {\n /**\n * The originating app node for this widget.\n */\n node: AppNode;\n /**\n * The rendered widget component (typically a card with header, content, etc.)\n */\n component: ReactElement;\n /**\n * Optional name identifier for the widget\n */\n name?: string;\n /**\n * Optional title displayed in the widget header\n */\n title?: string;\n /**\n * Optional description shown in widget catalogs or configuration UIs\n */\n description?: string;\n /**\n * Optional layout hints for positioning and sizing\n */\n layout?: CardLayout;\n /**\n * Optional settings schema for widget configuration\n */\n settings?: CardSettings;\n}\n\n/**\n * Extension data ref for homepage widgets.\n *\n * This follows the pattern from FormFieldBlueprint, bundling the component\n * and metadata into a single comprehensive data ref rather than outputting\n * them separately.\n *\n * @alpha\n */\nexport const homePageWidgetDataRef =\n createExtensionDataRef<HomePageWidgetData>().with({\n id: 'home.widget.data',\n });\n\n/**\n * Props provided to a home page layout component.\n *\n * @alpha\n */\nexport interface HomePageLayoutProps {\n /**\n * The list of widget elements and metadata to render on the home page.\n */\n widgets: Array<HomePageWidgetData>;\n}\n\n/**\n * Extension data ref for home page layout components.\n *\n * A layout receives the collected widgets and is responsible for arranging\n * them on the home page. This follows the same pattern as\n * EntityContentLayoutBlueprint in the catalog plugin.\n *\n * @alpha\n */\nexport const homePageLayoutComponentDataRef = createExtensionDataRef<\n (props: HomePageLayoutProps) => JSX.Element\n>().with({\n id: 'home.layout.component',\n});\n"],"names":[],"mappings":";;AAqEO,MAAM,qBAAA,GACX,sBAAA,EAA2C,CAAE,IAAA,CAAK;AAAA,EAChD,EAAA,EAAI;AACN,CAAC;AAuBI,MAAM,8BAAA,GAAiC,sBAAA,EAE5C,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { AppNode } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { ReactElement, JSX } from 'react';
|
|
4
|
+
import { d as CardLayout, e as CardSettings, a as ComponentParts } from './types/extensions.d-BO9FVXbP.js';
|
|
5
|
+
import '@backstage/core-plugin-api';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '@rjsf/utils';
|
|
2
8
|
|
|
3
9
|
/**
|
|
10
|
+
* Translation reference for the home-react plugin.
|
|
11
|
+
* Contains localized text strings for home page components and settings modals.
|
|
12
|
+
*
|
|
4
13
|
* @alpha
|
|
5
14
|
*/
|
|
6
15
|
declare const homeReactTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"home-react", {
|
|
@@ -9,4 +18,162 @@ declare const homeReactTranslationRef: _backstage_frontend_plugin_api.Translatio
|
|
|
9
18
|
readonly "cardExtension.settingsButtonTitle": "Settings";
|
|
10
19
|
}>;
|
|
11
20
|
|
|
12
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Extension data for homepage widgets, bundling the rendered component
|
|
23
|
+
* with its metadata.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
interface HomePageWidgetData {
|
|
28
|
+
/**
|
|
29
|
+
* The originating app node for this widget.
|
|
30
|
+
*/
|
|
31
|
+
node: AppNode;
|
|
32
|
+
/**
|
|
33
|
+
* The rendered widget component (typically a card with header, content, etc.)
|
|
34
|
+
*/
|
|
35
|
+
component: ReactElement;
|
|
36
|
+
/**
|
|
37
|
+
* Optional name identifier for the widget
|
|
38
|
+
*/
|
|
39
|
+
name?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional title displayed in the widget header
|
|
42
|
+
*/
|
|
43
|
+
title?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional description shown in widget catalogs or configuration UIs
|
|
46
|
+
*/
|
|
47
|
+
description?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Optional layout hints for positioning and sizing
|
|
50
|
+
*/
|
|
51
|
+
layout?: CardLayout;
|
|
52
|
+
/**
|
|
53
|
+
* Optional settings schema for widget configuration
|
|
54
|
+
*/
|
|
55
|
+
settings?: CardSettings;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Extension data ref for homepage widgets.
|
|
59
|
+
*
|
|
60
|
+
* This follows the pattern from FormFieldBlueprint, bundling the component
|
|
61
|
+
* and metadata into a single comprehensive data ref rather than outputting
|
|
62
|
+
* them separately.
|
|
63
|
+
*
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
declare const homePageWidgetDataRef: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<HomePageWidgetData, "home.widget.data", {}>;
|
|
67
|
+
/**
|
|
68
|
+
* Props provided to a home page layout component.
|
|
69
|
+
*
|
|
70
|
+
* @alpha
|
|
71
|
+
*/
|
|
72
|
+
interface HomePageLayoutProps {
|
|
73
|
+
/**
|
|
74
|
+
* The list of widget elements and metadata to render on the home page.
|
|
75
|
+
*/
|
|
76
|
+
widgets: Array<HomePageWidgetData>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Extension data ref for home page layout components.
|
|
80
|
+
*
|
|
81
|
+
* A layout receives the collected widgets and is responsible for arranging
|
|
82
|
+
* them on the home page. This follows the same pattern as
|
|
83
|
+
* EntityContentLayoutBlueprint in the catalog plugin.
|
|
84
|
+
*
|
|
85
|
+
* @alpha
|
|
86
|
+
*/
|
|
87
|
+
declare const homePageLayoutComponentDataRef: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: HomePageLayoutProps) => JSX.Element, "home.layout.component", {}>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Parameters for creating a home page widget extension.
|
|
91
|
+
*
|
|
92
|
+
* @alpha
|
|
93
|
+
*/
|
|
94
|
+
interface HomePageWidgetBlueprintParams {
|
|
95
|
+
/**
|
|
96
|
+
* Optional name for the widget. If not provided, the extension will use only its kind
|
|
97
|
+
* in the extension ID.
|
|
98
|
+
*/
|
|
99
|
+
name?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Optional title displayed for the widget, used as the default card heading.
|
|
102
|
+
*/
|
|
103
|
+
title?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Optional description shown in the widget catalog when adding new cards.
|
|
106
|
+
*/
|
|
107
|
+
description?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Component parts rendered within the card.
|
|
110
|
+
*/
|
|
111
|
+
components: () => Promise<ComponentParts>;
|
|
112
|
+
/**
|
|
113
|
+
* Layout hints used by the customizable grid.
|
|
114
|
+
*/
|
|
115
|
+
layout?: CardLayout;
|
|
116
|
+
/**
|
|
117
|
+
* Schema used to configure widget settings.
|
|
118
|
+
*/
|
|
119
|
+
settings?: CardSettings;
|
|
120
|
+
/**
|
|
121
|
+
* Default props forwarded to the rendered widget component.
|
|
122
|
+
*/
|
|
123
|
+
componentProps?: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates widgets that can be installed into the home page grid.
|
|
127
|
+
*
|
|
128
|
+
* @alpha
|
|
129
|
+
*/
|
|
130
|
+
declare const HomePageWidgetBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
131
|
+
kind: "home-page-widget";
|
|
132
|
+
params: HomePageWidgetBlueprintParams;
|
|
133
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<HomePageWidgetData, "home.widget.data", {}>;
|
|
134
|
+
inputs: {};
|
|
135
|
+
config: {};
|
|
136
|
+
configInput: {};
|
|
137
|
+
dataRefs: {
|
|
138
|
+
widget: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<HomePageWidgetData, "home.widget.data", {}>;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Parameters for creating a home page layout extension.
|
|
144
|
+
*
|
|
145
|
+
* @alpha
|
|
146
|
+
*/
|
|
147
|
+
interface HomePageLayoutBlueprintParams {
|
|
148
|
+
/**
|
|
149
|
+
* Async loader that returns the layout component.
|
|
150
|
+
* The component receives the collected widgets and renders them.
|
|
151
|
+
*/
|
|
152
|
+
loader: () => Promise<(props: HomePageLayoutProps) => JSX.Element>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Blueprint for creating custom home page layouts.
|
|
156
|
+
*
|
|
157
|
+
* A layout receives the list of installed widgets and is responsible for
|
|
158
|
+
* arranging them on the home page. This follows the same pattern as
|
|
159
|
+
* `EntityContentLayoutBlueprint` in the catalog plugin.
|
|
160
|
+
*
|
|
161
|
+
* If no layout extension is installed, the home page uses a built-in default.
|
|
162
|
+
* Users can install their own layout to customize how widgets are arranged.
|
|
163
|
+
*
|
|
164
|
+
* @alpha
|
|
165
|
+
*/
|
|
166
|
+
declare const HomePageLayoutBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
167
|
+
kind: "home-page-layout";
|
|
168
|
+
params: HomePageLayoutBlueprintParams;
|
|
169
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<(props: HomePageLayoutProps) => JSX.Element, "home.layout.component", {}>;
|
|
170
|
+
inputs: {};
|
|
171
|
+
config: {};
|
|
172
|
+
configInput: {};
|
|
173
|
+
dataRefs: {
|
|
174
|
+
component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: HomePageLayoutProps) => JSX.Element, "home.layout.component", {}>;
|
|
175
|
+
};
|
|
176
|
+
}>;
|
|
177
|
+
|
|
178
|
+
export { CardLayout, CardSettings, ComponentParts, HomePageLayoutBlueprint, HomePageWidgetBlueprint, homePageLayoutComponentDataRef, homePageWidgetDataRef, homeReactTranslationRef };
|
|
179
|
+
export type { HomePageLayoutBlueprintParams, HomePageLayoutProps, HomePageWidgetBlueprintParams, HomePageWidgetData };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { homeReactTranslationRef } from './translation.esm.js';
|
|
2
|
+
export { HomePageWidgetBlueprint } from './alpha/blueprints/HomePageWidgetBlueprint.esm.js';
|
|
3
|
+
export { HomePageLayoutBlueprint } from './alpha/blueprints/HomePageLayoutBlueprint.esm.js';
|
|
4
|
+
export { homePageLayoutComponentDataRef, homePageWidgetDataRef } from './alpha/dataRefs.esm.js';
|
|
2
5
|
//# sourceMappingURL=alpha.esm.js.map
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/extensions.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import SettingsIcon from '@material-ui/icons/Settings';
|
|
|
5
5
|
import { InfoCard } from '@backstage/core-components';
|
|
6
6
|
import { SettingsModal } from './components/SettingsModal.esm.js';
|
|
7
7
|
import './components/ContentModal.esm.js';
|
|
8
|
-
import {
|
|
8
|
+
import { useApp, createReactExtension } from '@backstage/core-plugin-api';
|
|
9
9
|
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
10
10
|
import { homeReactTranslationRef } from './translation.esm.js';
|
|
11
11
|
|
|
@@ -87,5 +87,5 @@ function CardExtension(props) {
|
|
|
87
87
|
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: ContextProvider ? /* @__PURE__ */ jsx(ContextProvider, { ...childProps, children: innerContent }) : innerContent });
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
export { createCardExtension };
|
|
90
|
+
export { CardExtension, createCardExtension };
|
|
91
91
|
//# sourceMappingURL=extensions.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.esm.js","sources":["../src/extensions.tsx"],"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 { useState, Suspense } from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { InfoCard } from '@backstage/core-components';\nimport { SettingsModal } from './components';\nimport { createReactExtension, useApp } from '@backstage/core-plugin-api';\nimport { RJSFSchema, UiSchema } from '@rjsf/utils';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { homeReactTranslationRef } from './translation';\n\n/**\n * @public\n */\nexport type ComponentRenderer = {\n Renderer?: (props: RendererProps) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type ComponentParts = {\n Content: (props?: any) => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type RendererProps = { title?: string } & ComponentParts;\n\n/**\n * @public\n */\nexport type CardExtensionProps<T> = ComponentRenderer & {\n title?: string;\n} & T;\n\n/**\n * @public\n */\nexport type CardLayout = {\n width?: { minColumns?: number; maxColumns?: number; defaultColumns?: number };\n height?: { minRows?: number; maxRows?: number; defaultRows?: number };\n};\n\n/**\n * @public\n */\nexport type CardSettings = {\n schema?: RJSFSchema;\n uiSchema?: UiSchema;\n};\n\n/**\n * @public\n */\nexport type CardConfig = {\n layout?: CardLayout;\n settings?: CardSettings;\n};\n\n/**\n * An extension creator to create card based components for the homepage\n *\n * @public\n */\nexport function createCardExtension<T>(options: {\n title?: string;\n components: () => Promise<ComponentParts>;\n name?: string;\n description?: string;\n layout?: CardLayout;\n settings?: CardSettings;\n}) {\n const { title, components, name, description, layout, settings } = options;\n // If widget settings schema is defined, we don't want to show the Settings icon or dialog\n const isCustomizable = settings?.schema !== undefined;\n\n return createReactExtension({\n name,\n data: { title, description, 'home.widget.config': { layout, settings } },\n component: {\n lazy: () =>\n components().then(componentParts => {\n return (props: CardExtensionProps<T>) => {\n return (\n <CardExtension\n {...props}\n {...componentParts}\n title={props.title || title}\n isCustomizable={isCustomizable}\n />\n );\n };\n }),\n },\n });\n}\n\ntype CardExtensionComponentProps<T> = CardExtensionProps<T> &\n ComponentParts & {\n isCustomizable?: boolean;\n overrideTitle?: string;\n };\n\
|
|
1
|
+
{"version":3,"file":"extensions.esm.js","sources":["../src/extensions.tsx"],"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 { useState, Suspense } from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { InfoCard } from '@backstage/core-components';\nimport { SettingsModal } from './components';\nimport { createReactExtension, useApp } from '@backstage/core-plugin-api';\nimport { RJSFSchema, UiSchema } from '@rjsf/utils';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { homeReactTranslationRef } from './translation';\n\n/**\n * @public\n */\nexport type ComponentRenderer = {\n Renderer?: (props: RendererProps) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type ComponentParts = {\n Content: (props?: any) => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type RendererProps = { title?: string } & ComponentParts;\n\n/**\n * @public\n */\nexport type CardExtensionProps<T> = ComponentRenderer & {\n title?: string;\n} & T;\n\n/**\n * @public\n */\nexport type CardLayout = {\n width?: { minColumns?: number; maxColumns?: number; defaultColumns?: number };\n height?: { minRows?: number; maxRows?: number; defaultRows?: number };\n};\n\n/**\n * @public\n */\nexport type CardSettings = {\n schema?: RJSFSchema;\n uiSchema?: UiSchema;\n};\n\n/**\n * @public\n */\nexport type CardConfig = {\n layout?: CardLayout;\n settings?: CardSettings;\n};\n\n/**\n * An extension creator to create card based components for the homepage\n *\n * @public\n */\nexport function createCardExtension<T>(options: {\n title?: string;\n components: () => Promise<ComponentParts>;\n name?: string;\n description?: string;\n layout?: CardLayout;\n settings?: CardSettings;\n}) {\n const { title, components, name, description, layout, settings } = options;\n // If widget settings schema is defined, we don't want to show the Settings icon or dialog\n const isCustomizable = settings?.schema !== undefined;\n\n return createReactExtension({\n name,\n data: { title, description, 'home.widget.config': { layout, settings } },\n component: {\n lazy: () =>\n components().then(componentParts => {\n return (props: CardExtensionProps<T>) => {\n return (\n <CardExtension\n {...props}\n {...componentParts}\n title={props.title || title}\n isCustomizable={isCustomizable}\n />\n );\n };\n }),\n },\n });\n}\n\ntype CardExtensionComponentProps<T> = CardExtensionProps<T> &\n ComponentParts & {\n isCustomizable?: boolean;\n overrideTitle?: string;\n };\n\nexport function CardExtension<T>(props: CardExtensionComponentProps<T>) {\n const {\n Renderer,\n Content,\n Settings,\n Actions,\n ContextProvider,\n isCustomizable,\n title,\n ...childProps\n } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n const [settingsOpen, setSettingsOpen] = useState(false);\n const { t } = useTranslationRef(homeReactTranslationRef);\n\n if (Renderer) {\n return (\n <Suspense fallback={<Progress />}>\n <Renderer\n {...(title && { title })}\n {...{\n Content,\n ...(Actions ? { Actions } : {}),\n ...(Settings && !isCustomizable ? { Settings } : {}),\n ...(ContextProvider ? { ContextProvider } : {}),\n ...childProps,\n }}\n />\n </Suspense>\n );\n }\n\n const cardProps = {\n divider: !!title,\n ...(title && { title }),\n ...(Settings && !isCustomizable\n ? {\n action: (\n <IconButton onClick={() => setSettingsOpen(true)}>\n <SettingsIcon>\n {t('cardExtension.settingsButtonTitle')}\n </SettingsIcon>\n </IconButton>\n ),\n }\n : {}),\n ...(Actions\n ? {\n actions: <Actions />,\n }\n : {}),\n };\n\n const innerContent = (\n <InfoCard {...cardProps}>\n {Settings && !isCustomizable && (\n <SettingsModal\n open={settingsOpen}\n componentName={title}\n close={() => setSettingsOpen(false)}\n >\n <Settings />\n </SettingsModal>\n )}\n <Content {...childProps} />\n </InfoCard>\n );\n\n return (\n <Suspense fallback={<Progress />}>\n {ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n )}\n </Suspense>\n );\n}\n"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { JSX as JSX$1 } from 'react';
|
|
3
|
-
|
|
4
|
-
import { RJSFSchema, UiSchema } from '@rjsf/utils';
|
|
3
|
+
export { f as CardConfig, C as CardExtensionProps, d as CardLayout, e as CardSettings, a as ComponentParts, b as ComponentRenderer, R as RendererProps, c as createCardExtension } from './types/extensions.d-BO9FVXbP.js';
|
|
5
4
|
import { Overrides } from '@material-ui/core/styles/overrides';
|
|
6
5
|
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
|
6
|
+
import '@backstage/core-plugin-api';
|
|
7
|
+
import '@rjsf/utils';
|
|
7
8
|
|
|
8
9
|
/** @public */
|
|
9
10
|
declare const SettingsModal: (props: {
|
|
@@ -31,76 +32,6 @@ type ContentModalProps = {
|
|
|
31
32
|
*/
|
|
32
33
|
declare const ContentModal: (props: ContentModalProps) => react_jsx_runtime.JSX.Element;
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
type ComponentRenderer = {
|
|
38
|
-
Renderer?: (props: RendererProps) => JSX.Element;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
type ComponentParts = {
|
|
44
|
-
Content: (props?: any) => JSX.Element;
|
|
45
|
-
Actions?: () => JSX.Element;
|
|
46
|
-
Settings?: () => JSX.Element;
|
|
47
|
-
ContextProvider?: (props: any) => JSX.Element;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
type RendererProps = {
|
|
53
|
-
title?: string;
|
|
54
|
-
} & ComponentParts;
|
|
55
|
-
/**
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
type CardExtensionProps<T> = ComponentRenderer & {
|
|
59
|
-
title?: string;
|
|
60
|
-
} & T;
|
|
61
|
-
/**
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
type CardLayout = {
|
|
65
|
-
width?: {
|
|
66
|
-
minColumns?: number;
|
|
67
|
-
maxColumns?: number;
|
|
68
|
-
defaultColumns?: number;
|
|
69
|
-
};
|
|
70
|
-
height?: {
|
|
71
|
-
minRows?: number;
|
|
72
|
-
maxRows?: number;
|
|
73
|
-
defaultRows?: number;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
type CardSettings = {
|
|
80
|
-
schema?: RJSFSchema;
|
|
81
|
-
uiSchema?: UiSchema;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
|
-
type CardConfig = {
|
|
87
|
-
layout?: CardLayout;
|
|
88
|
-
settings?: CardSettings;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* An extension creator to create card based components for the homepage
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
declare function createCardExtension<T>(options: {
|
|
96
|
-
title?: string;
|
|
97
|
-
components: () => Promise<ComponentParts>;
|
|
98
|
-
name?: string;
|
|
99
|
-
description?: string;
|
|
100
|
-
layout?: CardLayout;
|
|
101
|
-
settings?: CardSettings;
|
|
102
|
-
}): _backstage_core_plugin_api.Extension<(props: CardExtensionProps<T>) => react_jsx_runtime.JSX.Element>;
|
|
103
|
-
|
|
104
35
|
/** @public */
|
|
105
36
|
type PluginHomeComponentsNameToClassKey = {
|
|
106
37
|
PluginHomeContentModal: PluginHomeContentModalClassKey;
|
|
@@ -114,5 +45,5 @@ declare module '@backstage/theme' {
|
|
|
114
45
|
}
|
|
115
46
|
}
|
|
116
47
|
|
|
117
|
-
export { ContentModal, SettingsModal
|
|
118
|
-
export type { BackstageOverrides,
|
|
48
|
+
export { ContentModal, SettingsModal };
|
|
49
|
+
export type { BackstageOverrides, ContentModalProps, PluginHomeComponentsNameToClassKey, PluginHomeContentModalClassKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/**\n * @alpha\n */\nexport const homeReactTranslationRef = createTranslationRef({\n id: 'home-react',\n messages: {\n settingsModal: {\n title: 'Settings',\n closeButtonTitle: 'Close',\n },\n cardExtension: {\n settingsButtonTitle: 'Settings',\n },\n },\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/**\n * Translation reference for the home-react plugin.\n * Contains localized text strings for home page components and settings modals.\n *\n * @alpha\n */\nexport const homeReactTranslationRef = createTranslationRef({\n id: 'home-react',\n messages: {\n settingsModal: {\n title: 'Settings',\n closeButtonTitle: 'Close',\n },\n cardExtension: {\n settingsButtonTitle: 'Settings',\n },\n },\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,0BAA0B,oBAAA,CAAqB;AAAA,EAC1D,EAAA,EAAI,YAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,aAAA,EAAe;AAAA,MACb,KAAA,EAAO,UAAA;AAAA,MACP,gBAAA,EAAkB;AAAA,KACpB;AAAA,IACA,aAAA,EAAe;AAAA,MACb,mBAAA,EAAqB;AAAA;AACvB;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { RJSFSchema, UiSchema } from '@rjsf/utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
type ComponentRenderer = {
|
|
9
|
+
Renderer?: (props: RendererProps) => JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
type ComponentParts = {
|
|
15
|
+
Content: (props?: any) => JSX.Element;
|
|
16
|
+
Actions?: () => JSX.Element;
|
|
17
|
+
Settings?: () => JSX.Element;
|
|
18
|
+
ContextProvider?: (props: any) => JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
type RendererProps = {
|
|
24
|
+
title?: string;
|
|
25
|
+
} & ComponentParts;
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
type CardExtensionProps<T> = ComponentRenderer & {
|
|
30
|
+
title?: string;
|
|
31
|
+
} & T;
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
type CardLayout = {
|
|
36
|
+
width?: {
|
|
37
|
+
minColumns?: number;
|
|
38
|
+
maxColumns?: number;
|
|
39
|
+
defaultColumns?: number;
|
|
40
|
+
};
|
|
41
|
+
height?: {
|
|
42
|
+
minRows?: number;
|
|
43
|
+
maxRows?: number;
|
|
44
|
+
defaultRows?: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
type CardSettings = {
|
|
51
|
+
schema?: RJSFSchema;
|
|
52
|
+
uiSchema?: UiSchema;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
type CardConfig = {
|
|
58
|
+
layout?: CardLayout;
|
|
59
|
+
settings?: CardSettings;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* An extension creator to create card based components for the homepage
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
declare function createCardExtension<T>(options: {
|
|
67
|
+
title?: string;
|
|
68
|
+
components: () => Promise<ComponentParts>;
|
|
69
|
+
name?: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
layout?: CardLayout;
|
|
72
|
+
settings?: CardSettings;
|
|
73
|
+
}): _backstage_core_plugin_api.Extension<(props: CardExtensionProps<T>) => react_jsx_runtime.JSX.Element>;
|
|
74
|
+
|
|
75
|
+
export { createCardExtension as c };
|
|
76
|
+
export type { CardExtensionProps as C, RendererProps as R, ComponentParts as a, ComponentRenderer as b, CardLayout as d, CardSettings as e, CardConfig as f };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-home-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35-next.1",
|
|
4
4
|
"description": "A Backstage plugin that contains react components helps you build a home page",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -63,26 +63,27 @@
|
|
|
63
63
|
"test": "backstage-cli package test"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@backstage/core-
|
|
67
|
-
"@backstage/core-
|
|
68
|
-
"@backstage/
|
|
66
|
+
"@backstage/core-compat-api": "0.5.8-next.2",
|
|
67
|
+
"@backstage/core-components": "0.18.7-next.2",
|
|
68
|
+
"@backstage/core-plugin-api": "1.12.3-next.1",
|
|
69
|
+
"@backstage/frontend-plugin-api": "0.14.0-next.2",
|
|
69
70
|
"@material-ui/core": "^4.12.2",
|
|
70
71
|
"@material-ui/icons": "^4.9.1",
|
|
71
72
|
"@rjsf/utils": "5.24.13"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
|
-
"@backstage/cli": "
|
|
75
|
+
"@backstage/cli": "0.35.4-next.2",
|
|
75
76
|
"@types/react": "^18.0.0",
|
|
76
77
|
"@types/react-grid-layout": "^1.3.2",
|
|
77
78
|
"react": "^18.0.2",
|
|
78
79
|
"react-dom": "^18.0.2",
|
|
79
|
-
"react-router-dom": "^6.
|
|
80
|
+
"react-router-dom": "^6.30.2"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
83
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
83
84
|
"react": "^17.0.0 || ^18.0.0",
|
|
84
85
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
85
|
-
"react-router-dom": "^6.
|
|
86
|
+
"react-router-dom": "^6.30.2"
|
|
86
87
|
},
|
|
87
88
|
"peerDependenciesMeta": {
|
|
88
89
|
"@types/react": {
|