@backstage/dev-utils 1.0.31 → 1.0.32-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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/dev-utils
2
2
 
3
+ ## 1.0.32-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.14.6-next.1
9
+ - @backstage/plugin-catalog-react@1.11.4-next.1
10
+ - @backstage/app-defaults@1.5.5-next.1
11
+ - @backstage/integration-react@1.1.26
12
+
13
+ ## 1.0.32-next.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+ - @backstage/catalog-model@1.5.0-next.0
19
+ - @backstage/theme@0.5.4-next.0
20
+ - @backstage/core-components@0.14.5-next.0
21
+ - @backstage/plugin-catalog-react@1.11.4-next.0
22
+ - @backstage/app-defaults@1.5.5-next.0
23
+ - @backstage/core-app-api@1.12.4
24
+ - @backstage/core-plugin-api@1.9.2
25
+ - @backstage/integration-react@1.1.26
26
+
3
27
  ## 1.0.31
4
28
 
5
29
  ### Patch Changes
@@ -0,0 +1,25 @@
1
+ import { EntityProvider } from '@backstage/plugin-catalog-react';
2
+ import Grid from '@material-ui/core/Grid';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import React from 'react';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ root: ({ entity }) => ({
8
+ position: "relative",
9
+ "&::before": {
10
+ content: `"${entity.metadata.name}"`,
11
+ top: -theme.typography.fontSize + 4,
12
+ display: "block",
13
+ position: "absolute",
14
+ color: theme.palette.textSubtle
15
+ }
16
+ })
17
+ }));
18
+ const EntityGridItem = (props) => {
19
+ const { entity, classes, ...rest } = props;
20
+ const itemClasses = useStyles({ entity });
21
+ return /* @__PURE__ */ React.createElement(EntityProvider, { entity }, /* @__PURE__ */ React.createElement(Grid, { classes: { root: itemClasses.root, ...classes }, ...rest, item: true }));
22
+ };
23
+
24
+ export { EntityGridItem };
25
+ //# sourceMappingURL=EntityGridItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityGridItem.esm.js","sources":["../../../src/components/EntityGridItem/EntityGridItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { Entity } from '@backstage/catalog-model';\nimport { EntityProvider } from '@backstage/plugin-catalog-react';\nimport Grid, { GridProps } from '@material-ui/core/Grid';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\n\nconst useStyles = makeStyles<Theme, { entity: Entity }>(theme => ({\n root: ({ entity }) => ({\n position: 'relative',\n\n '&::before': {\n content: `\"${entity.metadata.name}\"`,\n top: -theme.typography.fontSize + 4,\n display: 'block',\n position: 'absolute',\n color: theme.palette.textSubtle,\n },\n }),\n}));\n\n/** @public */\nexport const EntityGridItem = (\n props: Omit<GridProps, 'item' | 'container'> & { entity: Entity },\n): JSX.Element => {\n const { entity, classes, ...rest } = props;\n const itemClasses = useStyles({ entity });\n\n return (\n <EntityProvider entity={entity}>\n <Grid classes={{ root: itemClasses.root, ...classes }} {...rest} item />\n </EntityProvider>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAsC,CAAU,KAAA,MAAA;AAAA,EAChE,IAAM,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACrB,QAAU,EAAA,UAAA;AAAA,IAEV,WAAa,EAAA;AAAA,MACX,OAAS,EAAA,CAAA,CAAA,EAAI,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA;AAAA,MACjC,GAAK,EAAA,CAAC,KAAM,CAAA,UAAA,CAAW,QAAW,GAAA,CAAA;AAAA,MAClC,OAAS,EAAA,OAAA;AAAA,MACT,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,MAAM,OAAQ,CAAA,UAAA;AAAA,KACvB;AAAA,GACF,CAAA;AACF,CAAE,CAAA,CAAA,CAAA;AAGW,MAAA,cAAA,GAAiB,CAC5B,KACgB,KAAA;AAChB,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAS,EAAA,GAAG,MAAS,GAAA,KAAA,CAAA;AACrC,EAAA,MAAM,WAAc,GAAA,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAA,CAAA;AAExC,EAAA,2CACG,cAAe,EAAA,EAAA,MAAA,EAAA,kBACb,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAE,IAAA,EAAM,WAAY,CAAA,IAAA,EAAM,GAAG,OAAQ,EAAA,EAAI,GAAG,IAAM,EAAA,IAAA,EAAI,MAAC,CACxE,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { SidebarItem } from '@backstage/core-components';
3
+ import LockIcon from '@material-ui/icons/Lock';
4
+ import { useApi, identityApiRef } from '@backstage/core-plugin-api';
5
+
6
+ const SidebarSignOutButton = (props) => {
7
+ var _a, _b;
8
+ const identityApi = useApi(identityApiRef);
9
+ return /* @__PURE__ */ React.createElement(
10
+ SidebarItem,
11
+ {
12
+ onClick: () => identityApi.signOut(),
13
+ icon: (_a = props.icon) != null ? _a : LockIcon,
14
+ text: (_b = props.text) != null ? _b : "Sign Out"
15
+ }
16
+ );
17
+ };
18
+
19
+ export { SidebarSignOutButton };
20
+ //# sourceMappingURL=SidebarSignOutButton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarSignOutButton.esm.js","sources":["../../../src/components/SidebarSignOutButton/SidebarSignOutButton.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 React from 'react';\nimport { SidebarItem } from '@backstage/core-components';\nimport LockIcon from '@material-ui/icons/Lock';\nimport {\n IconComponent,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\n/**\n * Button for sidebar that signs out user\n *\n * @public\n */\nexport const SidebarSignOutButton = (props: {\n icon?: IconComponent;\n text?: string;\n}) => {\n const identityApi = useApi(identityApiRef);\n\n return (\n <SidebarItem\n onClick={() => identityApi.signOut()}\n icon={props.icon ?? LockIcon}\n text={props.text ?? 'Sign Out'}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AA8Ba,MAAA,oBAAA,GAAuB,CAAC,KAG/B,KAAA;AAjCN,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAkCE,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,MAAM,WAAA,CAAY,OAAQ,EAAA;AAAA,MACnC,IAAA,EAAA,CAAM,EAAM,GAAA,KAAA,CAAA,IAAA,KAAN,IAAc,GAAA,EAAA,GAAA,QAAA;AAAA,MACpB,IAAA,EAAA,CAAM,EAAM,GAAA,KAAA,CAAA,IAAA,KAAN,IAAc,GAAA,EAAA,GAAA,UAAA;AAAA,KAAA;AAAA,GACtB,CAAA;AAEJ;;;;"}
@@ -0,0 +1,94 @@
1
+ import { SidebarItem } from '@backstage/core-components';
2
+ import { useApi, appThemeApiRef } from '@backstage/core-plugin-api';
3
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
4
+ import ListItemText from '@material-ui/core/ListItemText';
5
+ import Menu from '@material-ui/core/Menu';
6
+ import MenuItem from '@material-ui/core/MenuItem';
7
+ import AutoIcon from '@material-ui/icons/BrightnessAuto';
8
+ import React, { useState, useCallback, cloneElement } from 'react';
9
+ import useObservable from 'react-use/esm/useObservable';
10
+
11
+ const ThemeIcon = ({ active, icon }) => icon ? cloneElement(icon, {
12
+ color: active ? "primary" : void 0
13
+ }) : /* @__PURE__ */ React.createElement(AutoIcon, { color: active ? "primary" : void 0 });
14
+ const SidebarThemeSwitcher = () => {
15
+ const appThemeApi = useApi(appThemeApiRef);
16
+ const themeId = useObservable(
17
+ appThemeApi.activeThemeId$(),
18
+ appThemeApi.getActiveThemeId()
19
+ );
20
+ const themeIds = appThemeApi.getInstalledThemes();
21
+ const activeTheme = themeIds.find((t) => t.id === themeId);
22
+ const [anchorEl, setAnchorEl] = useState();
23
+ const open = Boolean(anchorEl);
24
+ const handleOpen = (event) => {
25
+ setAnchorEl(event.currentTarget);
26
+ };
27
+ const handleSelectTheme = (newThemeId) => {
28
+ if (themeIds.some((t) => t.id === newThemeId)) {
29
+ appThemeApi.setActiveThemeId(newThemeId);
30
+ } else {
31
+ appThemeApi.setActiveThemeId(void 0);
32
+ }
33
+ setAnchorEl(void 0);
34
+ };
35
+ const handleClose = () => {
36
+ setAnchorEl(void 0);
37
+ };
38
+ const ActiveIcon = useCallback(
39
+ () => /* @__PURE__ */ React.createElement(ThemeIcon, { icon: activeTheme == null ? void 0 : activeTheme.icon }),
40
+ [activeTheme]
41
+ );
42
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
43
+ SidebarItem,
44
+ {
45
+ icon: ActiveIcon,
46
+ text: "Switch Theme",
47
+ id: "theme-button",
48
+ "aria-haspopup": "listbox",
49
+ "aria-controls": "theme-menu",
50
+ "aria-label": "switch theme",
51
+ "aria-expanded": open ? "true" : void 0,
52
+ onClick: handleOpen
53
+ }
54
+ ), /* @__PURE__ */ React.createElement(
55
+ Menu,
56
+ {
57
+ id: "theme-menu",
58
+ anchorEl,
59
+ open,
60
+ onClose: handleClose,
61
+ MenuListProps: {
62
+ "aria-labelledby": "theme-button",
63
+ role: "listbox"
64
+ }
65
+ },
66
+ /* @__PURE__ */ React.createElement(MenuItem, { disabled: true }, "Choose a theme"),
67
+ /* @__PURE__ */ React.createElement(
68
+ MenuItem,
69
+ {
70
+ selected: themeId === void 0,
71
+ onClick: () => handleSelectTheme(void 0)
72
+ },
73
+ /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(ThemeIcon, { icon: void 0, active: themeId === void 0 })),
74
+ /* @__PURE__ */ React.createElement(ListItemText, null, "Auto")
75
+ ),
76
+ themeIds.map((theme) => {
77
+ const active = theme.id === themeId;
78
+ return /* @__PURE__ */ React.createElement(
79
+ MenuItem,
80
+ {
81
+ key: theme.id,
82
+ selected: active,
83
+ "aria-selected": active,
84
+ onClick: () => handleSelectTheme(theme.id)
85
+ },
86
+ /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(ThemeIcon, { icon: theme.icon, active })),
87
+ /* @__PURE__ */ React.createElement(ListItemText, null, theme.title)
88
+ );
89
+ })
90
+ ));
91
+ };
92
+
93
+ export { SidebarThemeSwitcher };
94
+ //# sourceMappingURL=SidebarThemeSwitcher.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarThemeSwitcher.esm.js","sources":["../../src/devApp/SidebarThemeSwitcher.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 */\nimport { SidebarItem } from '@backstage/core-components';\nimport { appThemeApiRef, useApi } from '@backstage/core-plugin-api';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport AutoIcon from '@material-ui/icons/BrightnessAuto';\nimport React, { cloneElement, useCallback, useState } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\n\ntype ThemeIconProps = {\n active?: boolean;\n icon: JSX.Element | undefined;\n};\n\nconst ThemeIcon = ({ active, icon }: ThemeIconProps) =>\n icon ? (\n cloneElement(icon, {\n color: active ? 'primary' : undefined,\n })\n ) : (\n <AutoIcon color={active ? 'primary' : undefined} />\n );\n\nexport const SidebarThemeSwitcher = () => {\n const appThemeApi = useApi(appThemeApiRef);\n const themeId = useObservable(\n appThemeApi.activeThemeId$(),\n appThemeApi.getActiveThemeId(),\n );\n const themeIds = appThemeApi.getInstalledThemes();\n const activeTheme = themeIds.find(t => t.id === themeId);\n\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n const open = Boolean(anchorEl);\n\n const handleOpen = (event: React.MouseEvent) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleSelectTheme = (newThemeId: string | undefined) => {\n if (themeIds.some(t => t.id === newThemeId)) {\n appThemeApi.setActiveThemeId(newThemeId);\n } else {\n appThemeApi.setActiveThemeId(undefined);\n }\n\n setAnchorEl(undefined);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const ActiveIcon = useCallback(\n () => <ThemeIcon icon={activeTheme?.icon} />,\n [activeTheme],\n );\n\n return (\n <>\n <SidebarItem\n icon={ActiveIcon}\n text=\"Switch Theme\"\n id=\"theme-button\"\n aria-haspopup=\"listbox\"\n aria-controls=\"theme-menu\"\n aria-label=\"switch theme\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleOpen}\n />\n\n <Menu\n id=\"theme-menu\"\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'theme-button',\n role: 'listbox',\n }}\n >\n <MenuItem disabled>Choose a theme</MenuItem>\n <MenuItem\n selected={themeId === undefined}\n onClick={() => handleSelectTheme(undefined)}\n >\n <ListItemIcon>\n <ThemeIcon icon={undefined} active={themeId === undefined} />\n </ListItemIcon>\n <ListItemText>Auto</ListItemText>\n </MenuItem>\n\n {themeIds.map(theme => {\n const active = theme.id === themeId;\n return (\n <MenuItem\n key={theme.id}\n selected={active}\n aria-selected={active}\n onClick={() => handleSelectTheme(theme.id)}\n >\n <ListItemIcon>\n <ThemeIcon icon={theme.icon} active={active} />\n </ListItemIcon>\n <ListItemText>{theme.title}</ListItemText>\n </MenuItem>\n );\n })}\n </Menu>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,CAAC,EAAE,MAAA,EAAQ,MAC3B,KAAA,IAAA,GACE,aAAa,IAAM,EAAA;AAAA,EACjB,KAAA,EAAO,SAAS,SAAY,GAAA,KAAA,CAAA;AAC9B,CAAC,oBAEA,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,MAAA,GAAS,YAAY,KAAW,CAAA,EAAA,CAAA,CAAA;AAG9C,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAA,MAAM,OAAU,GAAA,aAAA;AAAA,IACd,YAAY,cAAe,EAAA;AAAA,IAC3B,YAAY,gBAAiB,EAAA;AAAA,GAC/B,CAAA;AACA,EAAM,MAAA,QAAA,GAAW,YAAY,kBAAmB,EAAA,CAAA;AAChD,EAAA,MAAM,cAAc,QAAS,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,OAAO,CAAA,CAAA;AAEvD,EAAA,MAAM,CAAC,QA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MAAM,KAAM,CAAA,IAAA,EAAM,QAAgB,CAC/C,CAAA;AAAA,wBACA,KAAA,CAAA,aAAA,CAAC,YAAc,EAAA,IAAA,EAAA,KAAA,CAAM,KAAM,CAAA;AAAA,OAC7B,CAAA;AAAA,KAEH,CAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,202 @@
1
+ import { createApp } from '@backstage/app-defaults';
2
+ import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
3
+ import { SidebarItem, SignInPage, AlertDisplay, OAuthRequestDialog, SidebarPage, Sidebar, SidebarSpacer, SidebarSpace, SidebarDivider } from '@backstage/core-components';
4
+ import { attachComponentData, createRouteRef, createApiFactory, configApiRef } from '@backstage/core-plugin-api';
5
+ import { scmIntegrationsApiRef, ScmIntegrationsApi } from '@backstage/integration-react';
6
+ import Box from '@material-ui/core/Box';
7
+ import BookmarkIcon from '@material-ui/icons/Bookmark';
8
+ import React from 'react';
9
+ import { createRoutesFromChildren, Route } from 'react-router-dom';
10
+ import { SidebarThemeSwitcher } from './SidebarThemeSwitcher.esm.js';
11
+ import 'react-dom';
12
+ import '../components/EntityGridItem/EntityGridItem.esm.js';
13
+ import { SidebarSignOutButton } from '../components/SidebarSignOutButton/SidebarSignOutButton.esm.js';
14
+
15
+ var __defProp = Object.defineProperty;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __publicField = (obj, key, value) => {
18
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
+ return value;
20
+ };
21
+ let ReactDOMPromise;
22
+ if (process.env.HAS_REACT_DOM_CLIENT) {
23
+ ReactDOMPromise = import('react-dom/client');
24
+ } else {
25
+ ReactDOMPromise = import('react-dom');
26
+ }
27
+ function isReactRouterBeta() {
28
+ const [obj] = createRoutesFromChildren(/* @__PURE__ */ React.createElement(Route, { index: true, element: /* @__PURE__ */ React.createElement("div", null) }));
29
+ return !obj.index;
30
+ }
31
+ const MaybeGatheringRoute = ({ element }) => element;
32
+ if (isReactRouterBeta()) {
33
+ attachComponentData(MaybeGatheringRoute, "core.gatherMountPoints", true);
34
+ }
35
+ class DevAppBuilder {
36
+ constructor() {
37
+ __publicField(this, "plugins", new Array());
38
+ __publicField(this, "apis", new Array());
39
+ __publicField(this, "rootChildren", new Array());
40
+ __publicField(this, "routes", new Array());
41
+ __publicField(this, "sidebarItems", new Array());
42
+ __publicField(this, "signInProviders", new Array());
43
+ __publicField(this, "defaultPage");
44
+ __publicField(this, "themes");
45
+ }
46
+ /**
47
+ * Register one or more plugins to render in the dev app
48
+ */
49
+ registerPlugin(...plugins) {
50
+ this.plugins.push(...plugins);
51
+ return this;
52
+ }
53
+ /**
54
+ * Register an API factory to add to the app
55
+ */
56
+ registerApi(factory) {
57
+ this.apis.push(factory);
58
+ return this;
59
+ }
60
+ /**
61
+ * Adds a React node to place just inside the App Provider.
62
+ *
63
+ * Useful for adding more global components like the AlertDisplay.
64
+ */
65
+ addRootChild(node) {
66
+ this.rootChildren.push(node);
67
+ return this;
68
+ }
69
+ /**
70
+ * Adds a new sidebar item to the dev app.
71
+ *
72
+ * Useful for adding only sidebar items without a corresponding page.
73
+ */
74
+ addSidebarItem(sidebarItem) {
75
+ this.sidebarItems.push(sidebarItem);
76
+ return this;
77
+ }
78
+ /**
79
+ * Adds a page component along with accompanying sidebar item.
80
+ *
81
+ * If no path is provided one will be generated.
82
+ * If no title is provided, no sidebar item will be created.
83
+ */
84
+ addPage(opts) {
85
+ var _a, _b;
86
+ const path = (_a = opts.path) != null ? _a : `/page-${this.routes.length + 1}`;
87
+ if (!this.defaultPage || path === "/") {
88
+ this.defaultPage = path;
89
+ }
90
+ if (opts.title) {
91
+ this.sidebarItems.push(
92
+ /* @__PURE__ */ React.createElement(
93
+ SidebarItem,
94
+ {
95
+ key: path,
96
+ to: path,
97
+ text: opts.title,
98
+ icon: (_b = opts.icon) != null ? _b : BookmarkIcon
99
+ }
100
+ )
101
+ );
102
+ }
103
+ this.routes.push(
104
+ /* @__PURE__ */ React.createElement(
105
+ MaybeGatheringRoute,
106
+ {
107
+ key: path,
108
+ path,
109
+ element: opts.element,
110
+ children: opts.children
111
+ }
112
+ )
113
+ );
114
+ return this;
115
+ }
116
+ /**
117
+ * Adds an array of themes to override the default theme.
118
+ */
119
+ addThemes(themes) {
120
+ this.themes = themes;
121
+ return this;
122
+ }
123
+ /**
124
+ * Adds new sign in provider for the dev app
125
+ */
126
+ addSignInProvider(provider) {
127
+ this.signInProviders.push(provider);
128
+ return this;
129
+ }
130
+ /**
131
+ * Build a DevApp component using the resources registered so far
132
+ */
133
+ build() {
134
+ const fakeRouteRef = createRouteRef({ id: "fake" });
135
+ const FakePage = () => /* @__PURE__ */ React.createElement(Box, { p: 3 }, "Page belonging to another plugin.");
136
+ attachComponentData(FakePage, "core.mountPoint", fakeRouteRef);
137
+ const apis = [...this.apis];
138
+ if (!apis.some((api) => api.api.id === scmIntegrationsApiRef.id)) {
139
+ apis.push(
140
+ createApiFactory({
141
+ api: scmIntegrationsApiRef,
142
+ deps: { configApi: configApiRef },
143
+ factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi)
144
+ })
145
+ );
146
+ }
147
+ const app = createApp({
148
+ apis,
149
+ plugins: this.plugins,
150
+ themes: this.themes,
151
+ components: {
152
+ SignInPage: (props) => {
153
+ return /* @__PURE__ */ React.createElement(
154
+ SignInPage,
155
+ {
156
+ ...props,
157
+ providers: ["guest", ...this.signInProviders],
158
+ title: "Select a sign-in method",
159
+ align: "center"
160
+ }
161
+ );
162
+ }
163
+ },
164
+ bindRoutes: ({ bind }) => {
165
+ var _a;
166
+ for (const plugin of (_a = this.plugins) != null ? _a : []) {
167
+ const targets = {};
168
+ for (const routeKey of Object.keys(plugin.externalRoutes)) {
169
+ targets[routeKey] = fakeRouteRef;
170
+ }
171
+ bind(plugin.externalRoutes, targets);
172
+ }
173
+ }
174
+ });
175
+ const DevApp = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AlertDisplay, null), /* @__PURE__ */ React.createElement(OAuthRequestDialog, null), this.rootChildren, /* @__PURE__ */ React.createElement(AppRouter, null, /* @__PURE__ */ React.createElement(SidebarPage, null, /* @__PURE__ */ React.createElement(Sidebar, null, /* @__PURE__ */ React.createElement(SidebarSpacer, null), this.sidebarItems, /* @__PURE__ */ React.createElement(SidebarSpace, null), /* @__PURE__ */ React.createElement(SidebarDivider, null), /* @__PURE__ */ React.createElement(SidebarThemeSwitcher, null), /* @__PURE__ */ React.createElement(SidebarSignOutButton, null)), /* @__PURE__ */ React.createElement(FlatRoutes, null, this.routes, /* @__PURE__ */ React.createElement(Route, { path: "/_external_route", element: /* @__PURE__ */ React.createElement(FakePage, null) })))));
176
+ return app.createRoot(DevApp);
177
+ }
178
+ /**
179
+ * Build and render directory to #root element, with react hot loading.
180
+ */
181
+ render() {
182
+ const DevApp = this.build();
183
+ if (window.location.pathname === "/" && this.defaultPage && this.defaultPage !== "/") {
184
+ window.location.pathname = this.defaultPage;
185
+ }
186
+ ReactDOMPromise.then((ReactDOM) => {
187
+ if ("createRoot" in ReactDOM) {
188
+ ReactDOM.createRoot(document.getElementById("root")).render(
189
+ /* @__PURE__ */ React.createElement(DevApp, null)
190
+ );
191
+ } else {
192
+ ReactDOM.render(/* @__PURE__ */ React.createElement(DevApp, null), document.getElementById("root"));
193
+ }
194
+ });
195
+ }
196
+ }
197
+ function createDevApp() {
198
+ return new DevAppBuilder();
199
+ }
200
+
201
+ export { DevAppBuilder, createDevApp, isReactRouterBeta };
202
+ //# sourceMappingURL=render.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.esm.js","sources":["../../src/devApp/render.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { createApp } from '@backstage/app-defaults';\nimport { AppRouter, FlatRoutes } from '@backstage/core-app-api';\nimport {\n AlertDisplay,\n OAuthRequestDialog,\n Sidebar,\n SidebarDivider,\n SidebarItem,\n SidebarPage,\n SidebarSpace,\n SidebarSpacer,\n SignInPage,\n SignInProviderConfig,\n} from '@backstage/core-components';\nimport {\n AnyApiFactory,\n ApiFactory,\n AppTheme,\n attachComponentData,\n BackstagePlugin,\n configApiRef,\n createApiFactory,\n createRouteRef,\n IconComponent,\n RouteRef,\n} from '@backstage/core-plugin-api';\nimport {\n ScmIntegrationsApi,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport Box from '@material-ui/core/Box';\nimport BookmarkIcon from '@material-ui/icons/Bookmark';\nimport React, { ComponentType, PropsWithChildren, ReactNode } from 'react';\nimport { createRoutesFromChildren, Route } from 'react-router-dom';\nimport { SidebarThemeSwitcher } from './SidebarThemeSwitcher';\nimport 'react-dom';\nimport { SidebarSignOutButton } from '../components';\n\nlet ReactDOMPromise: Promise<\n typeof import('react-dom') | typeof import('react-dom/client')\n>;\nif (process.env.HAS_REACT_DOM_CLIENT) {\n ReactDOMPromise = import('react-dom/client');\n} else {\n ReactDOMPromise = import('react-dom');\n}\n\nexport function isReactRouterBeta(): boolean {\n const [obj] = createRoutesFromChildren(<Route index element={<div />} />);\n return !obj.index;\n}\n\nconst MaybeGatheringRoute: (props: {\n path: string;\n element: JSX.Element;\n children?: ReactNode;\n}) => JSX.Element = ({ element }) => element;\n\nif (isReactRouterBeta()) {\n attachComponentData(MaybeGatheringRoute, 'core.gatherMountPoints', true);\n}\n\n/** @public */\nexport type DevAppPageOptions = {\n path?: string;\n element: JSX.Element;\n children?: JSX.Element;\n title?: string;\n icon?: IconComponent;\n};\n\n/**\n * DevApp builder that is similar to the App builder API, but creates an App\n * with the purpose of developing one or more plugins inside it.\n *\n * @public\n */\nexport class DevAppBuilder {\n private readonly plugins = new Array<BackstagePlugin>();\n private readonly apis = new Array<AnyApiFactory>();\n private readonly rootChildren = new Array<ReactNode>();\n private readonly routes = new Array<JSX.Element>();\n private readonly sidebarItems = new Array<JSX.Element>();\n private readonly signInProviders = new Array<SignInProviderConfig>();\n\n private defaultPage?: string;\n private themes?: Array<AppTheme>;\n\n /**\n * Register one or more plugins to render in the dev app\n */\n registerPlugin(...plugins: BackstagePlugin[]): DevAppBuilder {\n this.plugins.push(...plugins);\n return this;\n }\n\n /**\n * Register an API factory to add to the app\n */\n registerApi<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n >(factory: ApiFactory<Api, Impl, Deps>): DevAppBuilder {\n this.apis.push(factory);\n return this;\n }\n\n /**\n * Adds a React node to place just inside the App Provider.\n *\n * Useful for adding more global components like the AlertDisplay.\n */\n addRootChild(node: ReactNode): DevAppBuilder {\n this.rootChildren.push(node);\n return this;\n }\n\n /**\n * Adds a new sidebar item to the dev app.\n *\n * Useful for adding only sidebar items without a corresponding page.\n */\n addSidebarItem(sidebarItem: JSX.Element): DevAppBuilder {\n this.sidebarItems.push(sidebarItem);\n return this;\n }\n\n /**\n * Adds a page component along with accompanying sidebar item.\n *\n * If no path is provided one will be generated.\n * If no title is provided, no sidebar item will be created.\n */\n addPage(opts: DevAppPageOptions): DevAppBuilder {\n const path = opts.path ?? `/page-${this.routes.length + 1}`;\n\n if (!this.defaultPage || path === '/') {\n this.defaultPage = path;\n }\n\n if (opts.title) {\n this.sidebarItems.push(\n <SidebarItem\n key={path}\n to={path}\n text={opts.title}\n icon={opts.icon ?? BookmarkIcon}\n />,\n );\n }\n\n this.routes.push(\n <MaybeGatheringRoute\n key={path}\n path={path}\n element={opts.element}\n children={opts.children}\n />,\n );\n return this;\n }\n\n /**\n * Adds an array of themes to override the default theme.\n */\n addThemes(themes: AppTheme[]) {\n this.themes = themes;\n return this;\n }\n\n /**\n * Adds new sign in provider for the dev app\n */\n addSignInProvider(provider: SignInProviderConfig) {\n this.signInProviders.push(provider);\n return this;\n }\n\n /**\n * Build a DevApp component using the resources registered so far\n */\n build(): ComponentType<PropsWithChildren<{}>> {\n const fakeRouteRef = createRouteRef({ id: 'fake' });\n const FakePage = () => <Box p={3}>Page belonging to another plugin.</Box>;\n attachComponentData(FakePage, 'core.mountPoint', fakeRouteRef);\n\n const apis = [...this.apis];\n if (!apis.some(api => api.api.id === scmIntegrationsApiRef.id)) {\n apis.push(\n createApiFactory({\n api: scmIntegrationsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),\n }),\n );\n }\n\n const app = createApp({\n apis,\n plugins: this.plugins,\n themes: this.themes,\n components: {\n SignInPage: props => {\n return (\n <SignInPage\n {...props}\n providers={['guest', ...this.signInProviders]}\n title=\"Select a sign-in method\"\n align=\"center\"\n />\n );\n },\n },\n bindRoutes: ({ bind }) => {\n for (const plugin of this.plugins ?? []) {\n const targets: Record<string, RouteRef<any>> = {};\n for (const routeKey of Object.keys(plugin.externalRoutes)) {\n targets[routeKey] = fakeRouteRef;\n }\n bind(plugin.externalRoutes, targets);\n }\n },\n });\n\n const DevApp = (\n <>\n <AlertDisplay />\n <OAuthRequestDialog />\n {this.rootChildren}\n <AppRouter>\n <SidebarPage>\n <Sidebar>\n <SidebarSpacer />\n {this.sidebarItems}\n <SidebarSpace />\n <SidebarDivider />\n <SidebarThemeSwitcher />\n <SidebarSignOutButton />\n </Sidebar>\n <FlatRoutes>\n {this.routes}\n <Route path=\"/_external_route\" element={<FakePage />} />\n </FlatRoutes>\n </SidebarPage>\n </AppRouter>\n </>\n );\n\n return app.createRoot(DevApp);\n }\n\n /**\n * Build and render directory to #root element, with react hot loading.\n */\n render(): void {\n const DevApp = this.build();\n\n if (\n window.location.pathname === '/' &&\n this.defaultPage &&\n this.defaultPage !== '/'\n ) {\n window.location.pathname = this.defaultPage;\n }\n\n ReactDOMPromise.then(ReactDOM => {\n if ('createRoot' in ReactDOM) {\n ReactDOM.createRoot(document.getElementById('root')!).render(\n <DevApp />,\n );\n } else {\n ReactDOM.render(<DevApp />, document.getElementById('root'));\n }\n });\n }\n}\n\n// TODO(rugvip): Figure out patterns for how to allow in-house apps to build upon\n// this to provide their own plugin dev wrappers.\n\n/**\n * Creates a dev app for rendering one or more plugins and exposing the touch points of the plugin.\n *\n * @public\n */\nexport function createDevApp() {\n return new DevAppBuilder();\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,IAAI,eAAA,CAAA;AAGJ,IAAI,OAAA,CAAQ,IAAI,oBAAsB,EAAA;AACpC,EAAA,eAAA,GAAkB,OAAO,kBAAkB,CAAA,CAAA;AAC7C,CAAO,MAAA;AACL,EAAA,eAAA,GAAkB,OAAO,WAAW,CAAA,CAAA;AACtC,CAAA;AAEO,SAAS,iBAA6B,GAAA;AAC3C,EAAA,MAAM,CAAC,GAAG,CAAI,GAAA,wBAAA,iBAA0B,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,KAAK,EAAA,IAAA,EAAC,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,IAAA,CAAA,EAAI,CAAE,CAAA,CAAA;AACxE,EAAA,OAAO,CAAC,GAAI,CAAA,KAAA,CAAA;AACd,CAAA;AAEA,MAAM,mBAIc,GAAA,CAAC,EAAE,OAAA,EAAc,KAAA,OAAA,CAAA;AAErC,IAAI,mBAAqB,EAAA;AACvB,EAAoB,mBAAA,CAAA,mBAAA,EAAqB,0BAA0B,IAAI,CAAA,CAAA;AACzE,CAAA;AAiBO,MAAM,aAAc,CAAA;AAAA,EAApB,WAAA,GAAA;AACL,IAAiB,aAAA,CAAA,IAAA,EAAA,SAAA,EAAU,IAAI,KAAuB,EAAA,CAAA,CAAA;AACtD,IAAiB,aAAA,CAAA,IAAA,EAAA,MAA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AA,GAAA,CAAI,WAAW,MAAM,CAAA,CAAA;AAAA,GAC9B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAe,GAAA;AACb,IAAM,MAAA,MAAA,GAAS,KAAK,KAAM,EAAA,CAAA;AAE1B,IACE,IAAA,MAAA,CAAO,SAAS,QAAa,KAAA,GAAA,IAC7B,KAAK,WACL,IAAA,IAAA,CAAK,gBAAgB,GACrB,EAAA;AACA,MAAO,MAAA,CAAA,QAAA,CAAS,WAAW,IAAK,CAAA,WAAA,CAAA;AAAA,KAClC;AAEA,IAAA,eAAA,CAAgB,KAAK,CAAY,QAAA,KAAA;AAC/B,MAAA,IAAI,gBAAgB,QAAU,EAAA;AAC5B,QAAA,QAAA,CAAS,UAAW,CAAA,QAAA,CAAS,cAAe,CAAA,MAAM,CAAE,CAAE,CAAA,MAAA;AAAA,8CACnD,MAAO,EAAA,IAAA,CAAA;AAAA,SACV,CAAA;AAAA,OACK,MAAA;AACL,QAAA,QAAA,CAAS,uBAAQ,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAO,GAAI,QAAS,CAAA,cAAA,CAAe,MAAM,CAAC,CAAA,CAAA;AAAA,OAC7D;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAA;AAUO,SAAS,YAAe,GAAA;AAC7B,EAAA,OAAO,IAAI,aAAc,EAAA,CAAA;AAC3B;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,322 +1,4 @@
1
- import { EntityProvider } from '@backstage/plugin-catalog-react';
2
- import Grid from '@material-ui/core/Grid';
3
- import { makeStyles } from '@material-ui/core/styles';
4
- import React, { useState, useCallback, cloneElement } from 'react';
5
- import { SidebarItem, SignInPage, AlertDisplay, OAuthRequestDialog, SidebarPage, Sidebar, SidebarSpacer, SidebarSpace, SidebarDivider } from '@backstage/core-components';
6
- import LockIcon from '@material-ui/icons/Lock';
7
- import { useApi, identityApiRef, appThemeApiRef, attachComponentData, createRouteRef, createApiFactory, configApiRef } from '@backstage/core-plugin-api';
8
- import { createApp } from '@backstage/app-defaults';
9
- import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
10
- import { scmIntegrationsApiRef, ScmIntegrationsApi } from '@backstage/integration-react';
11
- import Box from '@material-ui/core/Box';
12
- import BookmarkIcon from '@material-ui/icons/Bookmark';
13
- import { createRoutesFromChildren, Route } from 'react-router-dom';
14
- import ListItemIcon from '@material-ui/core/ListItemIcon';
15
- import ListItemText from '@material-ui/core/ListItemText';
16
- import Menu from '@material-ui/core/Menu';
17
- import MenuItem from '@material-ui/core/MenuItem';
18
- import AutoIcon from '@material-ui/icons/BrightnessAuto';
19
- import useObservable from 'react-use/esm/useObservable';
20
- import 'react-dom';
21
-
22
- const useStyles = makeStyles((theme) => ({
23
- root: ({ entity }) => ({
24
- position: "relative",
25
- "&::before": {
26
- content: `"${entity.metadata.name}"`,
27
- top: -theme.typography.fontSize + 4,
28
- display: "block",
29
- position: "absolute",
30
- color: theme.palette.textSubtle
31
- }
32
- })
33
- }));
34
- const EntityGridItem = (props) => {
35
- const { entity, classes, ...rest } = props;
36
- const itemClasses = useStyles({ entity });
37
- return /* @__PURE__ */ React.createElement(EntityProvider, { entity }, /* @__PURE__ */ React.createElement(Grid, { classes: { root: itemClasses.root, ...classes }, ...rest, item: true }));
38
- };
39
-
40
- const SidebarSignOutButton = (props) => {
41
- var _a, _b;
42
- const identityApi = useApi(identityApiRef);
43
- return /* @__PURE__ */ React.createElement(
44
- SidebarItem,
45
- {
46
- onClick: () => identityApi.signOut(),
47
- icon: (_a = props.icon) != null ? _a : LockIcon,
48
- text: (_b = props.text) != null ? _b : "Sign Out"
49
- }
50
- );
51
- };
52
-
53
- const ThemeIcon = ({ active, icon }) => icon ? cloneElement(icon, {
54
- color: active ? "primary" : void 0
55
- }) : /* @__PURE__ */ React.createElement(AutoIcon, { color: active ? "primary" : void 0 });
56
- const SidebarThemeSwitcher = () => {
57
- const appThemeApi = useApi(appThemeApiRef);
58
- const themeId = useObservable(
59
- appThemeApi.activeThemeId$(),
60
- appThemeApi.getActiveThemeId()
61
- );
62
- const themeIds = appThemeApi.getInstalledThemes();
63
- const activeTheme = themeIds.find((t) => t.id === themeId);
64
- const [anchorEl, setAnchorEl] = useState();
65
- const open = Boolean(anchorEl);
66
- const handleOpen = (event) => {
67
- setAnchorEl(event.currentTarget);
68
- };
69
- const handleSelectTheme = (newThemeId) => {
70
- if (themeIds.some((t) => t.id === newThemeId)) {
71
- appThemeApi.setActiveThemeId(newThemeId);
72
- } else {
73
- appThemeApi.setActiveThemeId(void 0);
74
- }
75
- setAnchorEl(void 0);
76
- };
77
- const handleClose = () => {
78
- setAnchorEl(void 0);
79
- };
80
- const ActiveIcon = useCallback(
81
- () => /* @__PURE__ */ React.createElement(ThemeIcon, { icon: activeTheme == null ? void 0 : activeTheme.icon }),
82
- [activeTheme]
83
- );
84
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
85
- SidebarItem,
86
- {
87
- icon: ActiveIcon,
88
- text: "Switch Theme",
89
- id: "theme-button",
90
- "aria-haspopup": "listbox",
91
- "aria-controls": "theme-menu",
92
- "aria-label": "switch theme",
93
- "aria-expanded": open ? "true" : void 0,
94
- onClick: handleOpen
95
- }
96
- ), /* @__PURE__ */ React.createElement(
97
- Menu,
98
- {
99
- id: "theme-menu",
100
- anchorEl,
101
- open,
102
- onClose: handleClose,
103
- MenuListProps: {
104
- "aria-labelledby": "theme-button",
105
- role: "listbox"
106
- }
107
- },
108
- /* @__PURE__ */ React.createElement(MenuItem, { disabled: true }, "Choose a theme"),
109
- /* @__PURE__ */ React.createElement(
110
- MenuItem,
111
- {
112
- selected: themeId === void 0,
113
- onClick: () => handleSelectTheme(void 0)
114
- },
115
- /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(ThemeIcon, { icon: void 0, active: themeId === void 0 })),
116
- /* @__PURE__ */ React.createElement(ListItemText, null, "Auto")
117
- ),
118
- themeIds.map((theme) => {
119
- const active = theme.id === themeId;
120
- return /* @__PURE__ */ React.createElement(
121
- MenuItem,
122
- {
123
- key: theme.id,
124
- selected: active,
125
- "aria-selected": active,
126
- onClick: () => handleSelectTheme(theme.id)
127
- },
128
- /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(ThemeIcon, { icon: theme.icon, active })),
129
- /* @__PURE__ */ React.createElement(ListItemText, null, theme.title)
130
- );
131
- })
132
- ));
133
- };
134
-
135
- var __defProp = Object.defineProperty;
136
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
137
- var __publicField = (obj, key, value) => {
138
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
139
- return value;
140
- };
141
- let ReactDOMPromise;
142
- if (process.env.HAS_REACT_DOM_CLIENT) {
143
- ReactDOMPromise = import('react-dom/client');
144
- } else {
145
- ReactDOMPromise = import('react-dom');
146
- }
147
- function isReactRouterBeta() {
148
- const [obj] = createRoutesFromChildren(/* @__PURE__ */ React.createElement(Route, { index: true, element: /* @__PURE__ */ React.createElement("div", null) }));
149
- return !obj.index;
150
- }
151
- const MaybeGatheringRoute = ({ element }) => element;
152
- if (isReactRouterBeta()) {
153
- attachComponentData(MaybeGatheringRoute, "core.gatherMountPoints", true);
154
- }
155
- class DevAppBuilder {
156
- constructor() {
157
- __publicField(this, "plugins", new Array());
158
- __publicField(this, "apis", new Array());
159
- __publicField(this, "rootChildren", new Array());
160
- __publicField(this, "routes", new Array());
161
- __publicField(this, "sidebarItems", new Array());
162
- __publicField(this, "signInProviders", new Array());
163
- __publicField(this, "defaultPage");
164
- __publicField(this, "themes");
165
- }
166
- /**
167
- * Register one or more plugins to render in the dev app
168
- */
169
- registerPlugin(...plugins) {
170
- this.plugins.push(...plugins);
171
- return this;
172
- }
173
- /**
174
- * Register an API factory to add to the app
175
- */
176
- registerApi(factory) {
177
- this.apis.push(factory);
178
- return this;
179
- }
180
- /**
181
- * Adds a React node to place just inside the App Provider.
182
- *
183
- * Useful for adding more global components like the AlertDisplay.
184
- */
185
- addRootChild(node) {
186
- this.rootChildren.push(node);
187
- return this;
188
- }
189
- /**
190
- * Adds a new sidebar item to the dev app.
191
- *
192
- * Useful for adding only sidebar items without a corresponding page.
193
- */
194
- addSidebarItem(sidebarItem) {
195
- this.sidebarItems.push(sidebarItem);
196
- return this;
197
- }
198
- /**
199
- * Adds a page component along with accompanying sidebar item.
200
- *
201
- * If no path is provided one will be generated.
202
- * If no title is provided, no sidebar item will be created.
203
- */
204
- addPage(opts) {
205
- var _a, _b;
206
- const path = (_a = opts.path) != null ? _a : `/page-${this.routes.length + 1}`;
207
- if (!this.defaultPage || path === "/") {
208
- this.defaultPage = path;
209
- }
210
- if (opts.title) {
211
- this.sidebarItems.push(
212
- /* @__PURE__ */ React.createElement(
213
- SidebarItem,
214
- {
215
- key: path,
216
- to: path,
217
- text: opts.title,
218
- icon: (_b = opts.icon) != null ? _b : BookmarkIcon
219
- }
220
- )
221
- );
222
- }
223
- this.routes.push(
224
- /* @__PURE__ */ React.createElement(
225
- MaybeGatheringRoute,
226
- {
227
- key: path,
228
- path,
229
- element: opts.element,
230
- children: opts.children
231
- }
232
- )
233
- );
234
- return this;
235
- }
236
- /**
237
- * Adds an array of themes to override the default theme.
238
- */
239
- addThemes(themes) {
240
- this.themes = themes;
241
- return this;
242
- }
243
- /**
244
- * Adds new sign in provider for the dev app
245
- */
246
- addSignInProvider(provider) {
247
- this.signInProviders.push(provider);
248
- return this;
249
- }
250
- /**
251
- * Build a DevApp component using the resources registered so far
252
- */
253
- build() {
254
- const fakeRouteRef = createRouteRef({ id: "fake" });
255
- const FakePage = () => /* @__PURE__ */ React.createElement(Box, { p: 3 }, "Page belonging to another plugin.");
256
- attachComponentData(FakePage, "core.mountPoint", fakeRouteRef);
257
- const apis = [...this.apis];
258
- if (!apis.some((api) => api.api.id === scmIntegrationsApiRef.id)) {
259
- apis.push(
260
- createApiFactory({
261
- api: scmIntegrationsApiRef,
262
- deps: { configApi: configApiRef },
263
- factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi)
264
- })
265
- );
266
- }
267
- const app = createApp({
268
- apis,
269
- plugins: this.plugins,
270
- themes: this.themes,
271
- components: {
272
- SignInPage: (props) => {
273
- return /* @__PURE__ */ React.createElement(
274
- SignInPage,
275
- {
276
- ...props,
277
- providers: ["guest", ...this.signInProviders],
278
- title: "Select a sign-in method",
279
- align: "center"
280
- }
281
- );
282
- }
283
- },
284
- bindRoutes: ({ bind }) => {
285
- var _a;
286
- for (const plugin of (_a = this.plugins) != null ? _a : []) {
287
- const targets = {};
288
- for (const routeKey of Object.keys(plugin.externalRoutes)) {
289
- targets[routeKey] = fakeRouteRef;
290
- }
291
- bind(plugin.externalRoutes, targets);
292
- }
293
- }
294
- });
295
- const DevApp = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AlertDisplay, null), /* @__PURE__ */ React.createElement(OAuthRequestDialog, null), this.rootChildren, /* @__PURE__ */ React.createElement(AppRouter, null, /* @__PURE__ */ React.createElement(SidebarPage, null, /* @__PURE__ */ React.createElement(Sidebar, null, /* @__PURE__ */ React.createElement(SidebarSpacer, null), this.sidebarItems, /* @__PURE__ */ React.createElement(SidebarSpace, null), /* @__PURE__ */ React.createElement(SidebarDivider, null), /* @__PURE__ */ React.createElement(SidebarThemeSwitcher, null), /* @__PURE__ */ React.createElement(SidebarSignOutButton, null)), /* @__PURE__ */ React.createElement(FlatRoutes, null, this.routes, /* @__PURE__ */ React.createElement(Route, { path: "/_external_route", element: /* @__PURE__ */ React.createElement(FakePage, null) })))));
296
- return app.createRoot(DevApp);
297
- }
298
- /**
299
- * Build and render directory to #root element, with react hot loading.
300
- */
301
- render() {
302
- const DevApp = this.build();
303
- if (window.location.pathname === "/" && this.defaultPage && this.defaultPage !== "/") {
304
- window.location.pathname = this.defaultPage;
305
- }
306
- ReactDOMPromise.then((ReactDOM) => {
307
- if ("createRoot" in ReactDOM) {
308
- ReactDOM.createRoot(document.getElementById("root")).render(
309
- /* @__PURE__ */ React.createElement(DevApp, null)
310
- );
311
- } else {
312
- ReactDOM.render(/* @__PURE__ */ React.createElement(DevApp, null), document.getElementById("root"));
313
- }
314
- });
315
- }
316
- }
317
- function createDevApp() {
318
- return new DevAppBuilder();
319
- }
320
-
321
- export { EntityGridItem, SidebarSignOutButton, createDevApp };
1
+ export { EntityGridItem } from './components/EntityGridItem/EntityGridItem.esm.js';
2
+ export { SidebarSignOutButton } from './components/SidebarSignOutButton/SidebarSignOutButton.esm.js';
3
+ export { createDevApp } from './devApp/render.esm.js';
322
4
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/components/EntityGridItem/EntityGridItem.tsx","../src/components/SidebarSignOutButton/SidebarSignOutButton.tsx","../src/devApp/SidebarThemeSwitcher.tsx","../src/devApp/render.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { Entity } from '@backstage/catalog-model';\nimport { EntityProvider } from '@backstage/plugin-catalog-react';\nimport Grid, { GridProps } from '@material-ui/core/Grid';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\n\nconst useStyles = makeStyles<Theme, { entity: Entity }>(theme => ({\n root: ({ entity }) => ({\n position: 'relative',\n\n '&::before': {\n content: `\"${entity.metadata.name}\"`,\n top: -theme.typography.fontSize + 4,\n display: 'block',\n position: 'absolute',\n color: theme.palette.textSubtle,\n },\n }),\n}));\n\n/** @public */\nexport const EntityGridItem = (\n props: Omit<GridProps, 'item' | 'container'> & { entity: Entity },\n): JSX.Element => {\n const { entity, classes, ...rest } = props;\n const itemClasses = useStyles({ entity });\n\n return (\n <EntityProvider entity={entity}>\n <Grid classes={{ root: itemClasses.root, ...classes }} {...rest} item />\n </EntityProvider>\n );\n};\n","/*\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 React from 'react';\nimport { SidebarItem } from '@backstage/core-components';\nimport LockIcon from '@material-ui/icons/Lock';\nimport {\n IconComponent,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\n/**\n * Button for sidebar that signs out user\n *\n * @public\n */\nexport const SidebarSignOutButton = (props: {\n icon?: IconComponent;\n text?: string;\n}) => {\n const identityApi = useApi(identityApiRef);\n\n return (\n <SidebarItem\n onClick={() => identityApi.signOut()}\n icon={props.icon ?? LockIcon}\n text={props.text ?? 'Sign Out'}\n />\n );\n};\n","/*\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 */\nimport { SidebarItem } from '@backstage/core-components';\nimport { appThemeApiRef, useApi } from '@backstage/core-plugin-api';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport AutoIcon from '@material-ui/icons/BrightnessAuto';\nimport React, { cloneElement, useCallback, useState } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\n\ntype ThemeIconProps = {\n active?: boolean;\n icon: JSX.Element | undefined;\n};\n\nconst ThemeIcon = ({ active, icon }: ThemeIconProps) =>\n icon ? (\n cloneElement(icon, {\n color: active ? 'primary' : undefined,\n })\n ) : (\n <AutoIcon color={active ? 'primary' : undefined} />\n );\n\nexport const SidebarThemeSwitcher = () => {\n const appThemeApi = useApi(appThemeApiRef);\n const themeId = useObservable(\n appThemeApi.activeThemeId$(),\n appThemeApi.getActiveThemeId(),\n );\n const themeIds = appThemeApi.getInstalledThemes();\n const activeTheme = themeIds.find(t => t.id === themeId);\n\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n const open = Boolean(anchorEl);\n\n const handleOpen = (event: React.MouseEvent) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleSelectTheme = (newThemeId: string | undefined) => {\n if (themeIds.some(t => t.id === newThemeId)) {\n appThemeApi.setActiveThemeId(newThemeId);\n } else {\n appThemeApi.setActiveThemeId(undefined);\n }\n\n setAnchorEl(undefined);\n };\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const ActiveIcon = useCallback(\n () => <ThemeIcon icon={activeTheme?.icon} />,\n [activeTheme],\n );\n\n return (\n <>\n <SidebarItem\n icon={ActiveIcon}\n text=\"Switch Theme\"\n id=\"theme-button\"\n aria-haspopup=\"listbox\"\n aria-controls=\"theme-menu\"\n aria-label=\"switch theme\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleOpen}\n />\n\n <Menu\n id=\"theme-menu\"\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'theme-button',\n role: 'listbox',\n }}\n >\n <MenuItem disabled>Choose a theme</MenuItem>\n <MenuItem\n selected={themeId === undefined}\n onClick={() => handleSelectTheme(undefined)}\n >\n <ListItemIcon>\n <ThemeIcon icon={undefined} active={themeId === undefined} />\n </ListItemIcon>\n <ListItemText>Auto</ListItemText>\n </MenuItem>\n\n {themeIds.map(theme => {\n const active = theme.id === themeId;\n return (\n <MenuItem\n key={theme.id}\n selected={active}\n aria-selected={active}\n onClick={() => handleSelectTheme(theme.id)}\n >\n <ListItemIcon>\n <ThemeIcon icon={theme.icon} active={active} />\n </ListItemIcon>\n <ListItemText>{theme.title}</ListItemText>\n </MenuItem>\n );\n })}\n </Menu>\n </>\n );\n};\n","/*\n * Copyright 2020 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 { createApp } from '@backstage/app-defaults';\nimport { AppRouter, FlatRoutes } from '@backstage/core-app-api';\nimport {\n AlertDisplay,\n OAuthRequestDialog,\n Sidebar,\n SidebarDivider,\n SidebarItem,\n SidebarPage,\n SidebarSpace,\n SidebarSpacer,\n SignInPage,\n SignInProviderConfig,\n} from '@backstage/core-components';\nimport {\n AnyApiFactory,\n ApiFactory,\n AppTheme,\n attachComponentData,\n BackstagePlugin,\n configApiRef,\n createApiFactory,\n createRouteRef,\n IconComponent,\n RouteRef,\n} from '@backstage/core-plugin-api';\nimport {\n ScmIntegrationsApi,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport Box from '@material-ui/core/Box';\nimport BookmarkIcon from '@material-ui/icons/Bookmark';\nimport React, { ComponentType, PropsWithChildren, ReactNode } from 'react';\nimport { createRoutesFromChildren, Route } from 'react-router-dom';\nimport { SidebarThemeSwitcher } from './SidebarThemeSwitcher';\nimport 'react-dom';\nimport { SidebarSignOutButton } from '../components';\n\nlet ReactDOMPromise: Promise<\n typeof import('react-dom') | typeof import('react-dom/client')\n>;\nif (process.env.HAS_REACT_DOM_CLIENT) {\n ReactDOMPromise = import('react-dom/client');\n} else {\n ReactDOMPromise = import('react-dom');\n}\n\nexport function isReactRouterBeta(): boolean {\n const [obj] = createRoutesFromChildren(<Route index element={<div />} />);\n return !obj.index;\n}\n\nconst MaybeGatheringRoute: (props: {\n path: string;\n element: JSX.Element;\n children?: ReactNode;\n}) => JSX.Element = ({ element }) => element;\n\nif (isReactRouterBeta()) {\n attachComponentData(MaybeGatheringRoute, 'core.gatherMountPoints', true);\n}\n\n/** @public */\nexport type DevAppPageOptions = {\n path?: string;\n element: JSX.Element;\n children?: JSX.Element;\n title?: string;\n icon?: IconComponent;\n};\n\n/**\n * DevApp builder that is similar to the App builder API, but creates an App\n * with the purpose of developing one or more plugins inside it.\n *\n * @public\n */\nexport class DevAppBuilder {\n private readonly plugins = new Array<BackstagePlugin>();\n private readonly apis = new Array<AnyApiFactory>();\n private readonly rootChildren = new Array<ReactNode>();\n private readonly routes = new Array<JSX.Element>();\n private readonly sidebarItems = new Array<JSX.Element>();\n private readonly signInProviders = new Array<SignInProviderConfig>();\n\n private defaultPage?: string;\n private themes?: Array<AppTheme>;\n\n /**\n * Register one or more plugins to render in the dev app\n */\n registerPlugin(...plugins: BackstagePlugin[]): DevAppBuilder {\n this.plugins.push(...plugins);\n return this;\n }\n\n /**\n * Register an API factory to add to the app\n */\n registerApi<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n >(factory: ApiFactory<Api, Impl, Deps>): DevAppBuilder {\n this.apis.push(factory);\n return this;\n }\n\n /**\n * Adds a React node to place just inside the App Provider.\n *\n * Useful for adding more global components like the AlertDisplay.\n */\n addRootChild(node: ReactNode): DevAppBuilder {\n this.rootChildren.push(node);\n return this;\n }\n\n /**\n * Adds a new sidebar item to the dev app.\n *\n * Useful for adding only sidebar items without a corresponding page.\n */\n addSidebarItem(sidebarItem: JSX.Element): DevAppBuilder {\n this.sidebarItems.push(sidebarItem);\n return this;\n }\n\n /**\n * Adds a page component along with accompanying sidebar item.\n *\n * If no path is provided one will be generated.\n * If no title is provided, no sidebar item will be created.\n */\n addPage(opts: DevAppPageOptions): DevAppBuilder {\n const path = opts.path ?? `/page-${this.routes.length + 1}`;\n\n if (!this.defaultPage || path === '/') {\n this.defaultPage = path;\n }\n\n if (opts.title) {\n this.sidebarItems.push(\n <SidebarItem\n key={path}\n to={path}\n text={opts.title}\n icon={opts.icon ?? BookmarkIcon}\n />,\n );\n }\n\n this.routes.push(\n <MaybeGatheringRoute\n key={path}\n path={path}\n element={opts.element}\n children={opts.children}\n />,\n );\n return this;\n }\n\n /**\n * Adds an array of themes to override the default theme.\n */\n addThemes(themes: AppTheme[]) {\n this.themes = themes;\n return this;\n }\n\n /**\n * Adds new sign in provider for the dev app\n */\n addSignInProvider(provider: SignInProviderConfig) {\n this.signInProviders.push(provider);\n return this;\n }\n\n /**\n * Build a DevApp component using the resources registered so far\n */\n build(): ComponentType<PropsWithChildren<{}>> {\n const fakeRouteRef = createRouteRef({ id: 'fake' });\n const FakePage = () => <Box p={3}>Page belonging to another plugin.</Box>;\n attachComponentData(FakePage, 'core.mountPoint', fakeRouteRef);\n\n const apis = [...this.apis];\n if (!apis.some(api => api.api.id === scmIntegrationsApiRef.id)) {\n apis.push(\n createApiFactory({\n api: scmIntegrationsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),\n }),\n );\n }\n\n const app = createApp({\n apis,\n plugins: this.plugins,\n themes: this.themes,\n components: {\n SignInPage: props => {\n return (\n <SignInPage\n {...props}\n providers={['guest', ...this.signInProviders]}\n title=\"Select a sign-in method\"\n align=\"center\"\n />\n );\n },\n },\n bindRoutes: ({ bind }) => {\n for (const plugin of this.plugins ?? []) {\n const targets: Record<string, RouteRef<any>> = {};\n for (const routeKey of Object.keys(plugin.externalRoutes)) {\n targets[routeKey] = fakeRouteRef;\n }\n bind(plugin.externalRoutes, targets);\n }\n },\n });\n\n const DevApp = (\n <>\n <AlertDisplay />\n <OAuthRequestDialog />\n {this.rootChildren}\n <AppRouter>\n <SidebarPage>\n <Sidebar>\n <SidebarSpacer />\n {this.sidebarItems}\n <SidebarSpace />\n <SidebarDivider />\n <SidebarThemeSwitcher />\n <SidebarSignOutButton />\n </Sidebar>\n <FlatRoutes>\n {this.routes}\n <Route path=\"/_external_route\" element={<FakePage />} />\n </FlatRoutes>\n </SidebarPage>\n </AppRouter>\n </>\n );\n\n return app.createRoot(DevApp);\n }\n\n /**\n * Build and render directory to #root element, with react hot loading.\n */\n render(): void {\n const DevApp = this.build();\n\n if (\n window.location.pathname === '/' &&\n this.defaultPage &&\n this.defaultPage !== '/'\n ) {\n window.location.pathname = this.defaultPage;\n }\n\n ReactDOMPromise.then(ReactDOM => {\n if ('createRoot' in ReactDOM) {\n ReactDOM.createRoot(document.getElementById('root')!).render(\n <DevApp />,\n );\n } else {\n ReactDOM.render(<DevApp />, document.getElementById('root'));\n }\n });\n }\n}\n\n// TODO(rugvip): Figure out patterns for how to allow in-house apps to build upon\n// this to provide their own plugin dev wrappers.\n\n/**\n * Creates a dev app for rendering one or more plugins and exposing the touch points of the plugin.\n *\n * @public\n */\nexport function createDevApp() {\n return new DevAppBuilder();\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,SAAA,GAAY,WAAsC,CAAU,KAAA,MAAA;AAAA,EAChE,IAAM,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACrB,QAAU,EAAA,UAAA;AAAA,IAEV,WAAa,EAAA;AAAA,MACX,OAAS,EAAA,CAAA,CAAA,EAAI,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA,CAAA,CAAA;AAAA,MACjC,GAAK,EAAA,CAAC,KAAM,CAAA,UAAA,CAAW,QAAW,GAAA,CAAA;AAAA,MAClC,OAAS,EAAA,OAAA;AAAA,MACT,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-1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/dev-utils",
3
- "version": "1.0.31",
3
+ "version": "1.0.32-next.1",
4
4
  "description": "Utilities for developing Backstage plugins.",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -36,22 +36,22 @@
36
36
  "test": "backstage-cli package test"
37
37
  },
38
38
  "dependencies": {
39
- "@backstage/app-defaults": "^1.5.4",
40
- "@backstage/catalog-model": "^1.4.5",
39
+ "@backstage/app-defaults": "^1.5.5-next.1",
40
+ "@backstage/catalog-model": "^1.5.0-next.0",
41
41
  "@backstage/core-app-api": "^1.12.4",
42
- "@backstage/core-components": "^0.14.4",
42
+ "@backstage/core-components": "^0.14.6-next.1",
43
43
  "@backstage/core-plugin-api": "^1.9.2",
44
44
  "@backstage/integration-react": "^1.1.26",
45
- "@backstage/plugin-catalog-react": "^1.11.3",
46
- "@backstage/theme": "^0.5.3",
45
+ "@backstage/plugin-catalog-react": "^1.11.4-next.1",
46
+ "@backstage/theme": "^0.5.4-next.0",
47
47
  "@material-ui/core": "^4.12.2",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
50
50
  "react-use": "^17.2.4"
51
51
  },
52
52
  "devDependencies": {
53
- "@backstage/cli": "^0.26.3",
54
- "@backstage/test-utils": "^1.5.4",
53
+ "@backstage/cli": "^0.26.5-next.0",
54
+ "@backstage/test-utils": "^1.5.5-next.0",
55
55
  "@testing-library/dom": "^10.0.0",
56
56
  "@testing-library/jest-dom": "^6.0.0",
57
57
  "@testing-library/react": "^15.0.0",