@backstage/dev-utils 1.1.9-next.1 → 1.1.9-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @backstage/dev-utils
2
2
 
3
+ ## 1.1.9-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
8
+
9
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
10
+
11
+ - Updated dependencies
12
+ - @backstage/integration-react@1.2.6-next.1
13
+ - @backstage/core-components@0.17.1-next.1
14
+ - @backstage/core-plugin-api@1.10.6-next.0
15
+ - @backstage/app-defaults@1.6.1-next.1
16
+ - @backstage/core-app-api@1.16.1-next.0
17
+ - @backstage/plugin-catalog-react@1.17.0-next.2
18
+ - @backstage/theme@0.6.5-next.0
19
+ - @backstage/catalog-model@1.7.3
20
+
3
21
  ## 1.1.9-next.1
4
22
 
5
23
  ### Patch Changes
@@ -1,7 +1,7 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { EntityProvider } from '@backstage/plugin-catalog-react';
2
3
  import Grid from '@material-ui/core/Grid';
3
4
  import { makeStyles } from '@material-ui/core/styles';
4
- import React from 'react';
5
5
 
6
6
  const useStyles = makeStyles((theme) => ({
7
7
  root: ({ entity }) => ({
@@ -18,7 +18,7 @@ const useStyles = makeStyles((theme) => ({
18
18
  const EntityGridItem = (props) => {
19
19
  const { entity, classes, ...rest } = props;
20
20
  const itemClasses = useStyles({ entity });
21
- return /* @__PURE__ */ React.createElement(EntityProvider, { entity }, /* @__PURE__ */ React.createElement(Grid, { classes: { root: itemClasses.root, ...classes }, ...rest, item: true }));
21
+ return /* @__PURE__ */ jsx(EntityProvider, { entity, children: /* @__PURE__ */ jsx(Grid, { classes: { root: itemClasses.root, ...classes }, ...rest, item: true }) });
22
22
  };
23
23
 
24
24
  export { EntityGridItem };
@@ -1 +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;AAAA;AACvB,GACF;AACF,CAAE,CAAA,CAAA;AAGW,MAAA,cAAA,GAAiB,CAC5B,KACgB,KAAA;AAChB,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAS,EAAA,GAAG,MAAS,GAAA,KAAA;AACrC,EAAA,MAAM,WAAc,GAAA,SAAA,CAAU,EAAE,MAAA,EAAQ,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;AAEJ;;;;"}
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';\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":";;;;;AAqBA,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;AAAA;AACvB,GACF;AACF,CAAE,CAAA,CAAA;AAGW,MAAA,cAAA,GAAiB,CAC5B,KACgB,KAAA;AAChB,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAS,EAAA,GAAG,MAAS,GAAA,KAAA;AACrC,EAAA,MAAM,WAAc,GAAA,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAA;AAExC,EAAA,2BACG,cAAe,EAAA,EAAA,MAAA,EACd,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAE,IAAA,EAAM,WAAY,CAAA,IAAA,EAAM,GAAG,OAAQ,EAAA,EAAI,GAAG,IAAM,EAAA,IAAA,EAAI,MAAC,CACxE,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
2
3
  import { appLanguageApiRef } from '@backstage/core-plugin-api/alpha';
3
4
  import TranslateIcon from '@material-ui/icons/Translate';
4
5
  import ListItemText from '@material-ui/core/ListItemText';
@@ -41,45 +42,50 @@ const SidebarLanguageSwitcher = () => {
41
42
  return language;
42
43
  }
43
44
  };
44
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
45
- SidebarItem,
46
- {
47
- icon: TranslateIcon,
48
- text: "Language",
49
- id: "language-button",
50
- "aria-haspopup": "listbox",
51
- "aria-controls": "language-menu",
52
- "aria-label": "switch language",
53
- "aria-expanded": open ? "true" : void 0,
54
- onClick: handleOpen
55
- }
56
- ), /* @__PURE__ */ React.createElement(
57
- Menu,
58
- {
59
- id: "language-menu",
60
- anchorEl,
61
- open,
62
- onClose: handleClose,
63
- MenuListProps: {
64
- "aria-labelledby": "language-button",
65
- role: "listbox"
45
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
46
+ /* @__PURE__ */ jsx(
47
+ SidebarItem,
48
+ {
49
+ icon: TranslateIcon,
50
+ text: "Language",
51
+ id: "language-button",
52
+ "aria-haspopup": "listbox",
53
+ "aria-controls": "language-menu",
54
+ "aria-label": "switch language",
55
+ "aria-expanded": open ? "true" : void 0,
56
+ onClick: handleOpen
66
57
  }
67
- },
68
- /* @__PURE__ */ React.createElement(MenuItem, { disabled: true }, "Choose language"),
69
- languages.map((lang) => {
70
- const active = currentLanguage === lang;
71
- return /* @__PURE__ */ React.createElement(
72
- MenuItem,
73
- {
74
- key: lang,
75
- selected: active,
76
- "aria-selected": active,
77
- onClick: () => handleSetLanguage(lang)
58
+ ),
59
+ /* @__PURE__ */ jsxs(
60
+ Menu,
61
+ {
62
+ id: "language-menu",
63
+ anchorEl,
64
+ open,
65
+ onClose: handleClose,
66
+ MenuListProps: {
67
+ "aria-labelledby": "language-button",
68
+ role: "listbox"
78
69
  },
79
- /* @__PURE__ */ React.createElement(ListItemText, null, getLanguageDisplayName(lang))
80
- );
81
- })
82
- ));
70
+ children: [
71
+ /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: "Choose language" }),
72
+ languages.map((lang) => {
73
+ const active = currentLanguage === lang;
74
+ return /* @__PURE__ */ jsx(
75
+ MenuItem,
76
+ {
77
+ selected: active,
78
+ "aria-selected": active,
79
+ onClick: () => handleSetLanguage(lang),
80
+ children: /* @__PURE__ */ jsx(ListItemText, { children: getLanguageDisplayName(lang) })
81
+ },
82
+ lang
83
+ );
84
+ })
85
+ ]
86
+ }
87
+ )
88
+ ] });
83
89
  };
84
90
 
85
91
  export { SidebarLanguageSwitcher };
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarLanguageSwitcher.esm.js","sources":["../../../src/components/SidebarLanguageSwitcher/SidebarLanguageSwitcher.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 React, { useState } from 'react';\nimport { appLanguageApiRef } from '@backstage/core-plugin-api/alpha';\nimport TranslateIcon from '@material-ui/icons/Translate';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useObservable from 'react-use/esm/useObservable';\nimport { SidebarItem } from '@backstage/core-components';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\n\n/** @public */\nexport const SidebarLanguageSwitcher = () => {\n const languageApi = useApi(appLanguageApiRef);\n\n const [languageObservable] = useState(() => languageApi.language$());\n const { language: currentLanguage } = useObservable(\n languageObservable,\n languageApi.getLanguage(),\n );\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n\n const { languages } = languageApi.getAvailableLanguages();\n\n if (languages.length <= 1) {\n return null;\n }\n\n const open = Boolean(anchorEl);\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const handleOpen = (event: React.MouseEvent) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleSetLanguage = (newLanguage: string | undefined) => {\n languageApi.setLanguage(newLanguage);\n setAnchorEl(undefined);\n };\n\n const getLanguageDisplayName = (language: string) => {\n try {\n const names = new Intl.DisplayNames([language], {\n type: 'language',\n });\n return names.of(language) || language;\n } catch (err) {\n return language;\n }\n };\n\n return (\n <>\n <SidebarItem\n icon={TranslateIcon}\n text=\"Language\"\n id=\"language-button\"\n aria-haspopup=\"listbox\"\n aria-controls=\"language-menu\"\n aria-label=\"switch language\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleOpen}\n />\n <Menu\n id=\"language-menu\"\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'language-button',\n role: 'listbox',\n }}\n >\n <MenuItem disabled>Choose language</MenuItem>\n {languages.map(lang => {\n const active = currentLanguage === lang;\n return (\n <MenuItem\n key={lang}\n selected={active}\n aria-selected={active}\n onClick={() => handleSetLanguage(lang)}\n >\n <ListItemText>{getLanguageDisplayName(lang)}</ListItemText>\n </MenuItem>\n );\n })}\n </Menu>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,0BAA0B,MAAM;AAC3C,EAAM,MAAA,WAAA,GAAc,OAAO,iBAAiB,CAAA;AAE5C,EAAA,MAAM,CAAC,kBAAkB,CAAA,GAAI,SAAS,MAAM,WAAA,CAAY,WAAW,CAAA;AACnE,EAAM,MAAA,EAAE,QAAU,EAAA,eAAA,EAAoB,GAAA,aAAA;AAAA,IACpC,kBAAA;AAAA,IACA,YAAY,WAAY;AAAA,GAC1B;AACA,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAA8B,EAAA;AAE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EAAA;AAAA;AAAA,GAEX,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,eAAA;AAAA,MACH,QAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA,WAAA;AAAA,MACT,aAAe,EAAA;AAAA,QACb,iBAAmB,EAAA,iBAAA;AAAA,QACnB,IAAM,EAAA;AAAA;AACR,KAAA;AAAA,oBAEC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,QAAQ,EAAA,IAAA,EAAA,EAAC,iBAAe,CAAA;AAAA,IACjC,SAAA,CAAU,IAAI,CAAQ,IAAA,KAAA;AACrB,MAAA,MAAM,SAAS,eAAoB,KAAA,IAAA;AACnC,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,GAAK,EAAA,IAAA;AAAA,UACL,QAAU,EAAA,MAAA;AAAA,UACV,eAAe,EAAA,MAAA;AAAA,UACf,OAAA,EAAS,MAAM,iBAAA,CAAkB,IAAI;AAAA,SAAA;AAAA,wBAEpC,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,IAAA,EAAc,sBAAuB,CAAA,IAAI,CAAE;AAAA,OAC9C;AAAA,KAEH;AAAA,GAEL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SidebarLanguageSwitcher.esm.js","sources":["../../../src/components/SidebarLanguageSwitcher/SidebarLanguageSwitcher.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 { MouseEvent, useState } from 'react';\nimport { appLanguageApiRef } from '@backstage/core-plugin-api/alpha';\nimport TranslateIcon from '@material-ui/icons/Translate';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useObservable from 'react-use/esm/useObservable';\nimport { SidebarItem } from '@backstage/core-components';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\n\n/** @public */\nexport const SidebarLanguageSwitcher = () => {\n const languageApi = useApi(appLanguageApiRef);\n\n const [languageObservable] = useState(() => languageApi.language$());\n const { language: currentLanguage } = useObservable(\n languageObservable,\n languageApi.getLanguage(),\n );\n const [anchorEl, setAnchorEl] = useState<Element | undefined>();\n\n const { languages } = languageApi.getAvailableLanguages();\n\n if (languages.length <= 1) {\n return null;\n }\n\n const open = Boolean(anchorEl);\n\n const handleClose = () => {\n setAnchorEl(undefined);\n };\n\n const handleOpen = (event: MouseEvent) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleSetLanguage = (newLanguage: string | undefined) => {\n languageApi.setLanguage(newLanguage);\n setAnchorEl(undefined);\n };\n\n const getLanguageDisplayName = (language: string) => {\n try {\n const names = new Intl.DisplayNames([language], {\n type: 'language',\n });\n return names.of(language) || language;\n } catch (err) {\n return language;\n }\n };\n\n return (\n <>\n <SidebarItem\n icon={TranslateIcon}\n text=\"Language\"\n id=\"language-button\"\n aria-haspopup=\"listbox\"\n aria-controls=\"language-menu\"\n aria-label=\"switch language\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleOpen}\n />\n <Menu\n id=\"language-menu\"\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'language-button',\n role: 'listbox',\n }}\n >\n <MenuItem disabled>Choose language</MenuItem>\n {languages.map(lang => {\n const active = currentLanguage === lang;\n return (\n <MenuItem\n key={lang}\n selected={active}\n aria-selected={active}\n onClick={() => handleSetLanguage(lang)}\n >\n <ListItemText>{getLanguageDisplayName(lang)}</ListItemText>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J;;;;"}
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { SidebarItem } from '@backstage/core-components';
3
3
  import LockIcon from '@material-ui/icons/Lock';
4
4
  import { useApi, identityApiRef } from '@backstage/core-plugin-api';
5
5
 
6
6
  const SidebarSignOutButton = (props) => {
7
7
  const identityApi = useApi(identityApiRef);
8
- return /* @__PURE__ */ React.createElement(
8
+ return /* @__PURE__ */ jsx(
9
9
  SidebarItem,
10
10
  {
11
11
  onClick: () => identityApi.signOut(),
@@ -1 +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;AACJ,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,MAAM,WAAA,CAAY,OAAQ,EAAA;AAAA,MACnC,IAAA,EAAM,MAAM,IAAQ,IAAA,QAAA;AAAA,MACpB,IAAA,EAAM,MAAM,IAAQ,IAAA;AAAA;AAAA,GACtB;AAEJ;;;;"}
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 { 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":";;;;;AA6Ba,MAAA,oBAAA,GAAuB,CAAC,KAG/B,KAAA;AACJ,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,MAAM,WAAA,CAAY,OAAQ,EAAA;AAAA,MACnC,IAAA,EAAM,MAAM,IAAQ,IAAA,QAAA;AAAA,MACpB,IAAA,EAAM,MAAM,IAAQ,IAAA;AAAA;AAAA,GACtB;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { SidebarItem } from '@backstage/core-components';
2
3
  import { useApi, appThemeApiRef } from '@backstage/core-plugin-api';
3
4
  import ListItemIcon from '@material-ui/core/ListItemIcon';
@@ -5,12 +6,12 @@ import ListItemText from '@material-ui/core/ListItemText';
5
6
  import Menu from '@material-ui/core/Menu';
6
7
  import MenuItem from '@material-ui/core/MenuItem';
7
8
  import AutoIcon from '@material-ui/icons/BrightnessAuto';
8
- import React, { useState, useCallback, cloneElement } from 'react';
9
+ import { useState, useCallback, cloneElement } from 'react';
9
10
  import useObservable from 'react-use/esm/useObservable';
10
11
 
11
12
  const ThemeIcon = ({ active, icon }) => icon ? cloneElement(icon, {
12
13
  color: active ? "primary" : void 0
13
- }) : /* @__PURE__ */ React.createElement(AutoIcon, { color: active ? "primary" : void 0 });
14
+ }) : /* @__PURE__ */ jsx(AutoIcon, { color: active ? "primary" : void 0 });
14
15
  const SidebarThemeSwitcher = () => {
15
16
  const appThemeApi = useApi(appThemeApiRef);
16
17
  const themeId = useObservable(
@@ -36,58 +37,67 @@ const SidebarThemeSwitcher = () => {
36
37
  setAnchorEl(void 0);
37
38
  };
38
39
  const ActiveIcon = useCallback(
39
- () => /* @__PURE__ */ React.createElement(ThemeIcon, { icon: activeTheme?.icon }),
40
+ () => /* @__PURE__ */ jsx(ThemeIcon, { icon: activeTheme?.icon }),
40
41
  [activeTheme]
41
42
  );
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,
43
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx(
45
+ SidebarItem,
69
46
  {
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")
47
+ icon: ActiveIcon,
48
+ text: "Switch Theme",
49
+ id: "theme-button",
50
+ "aria-haspopup": "listbox",
51
+ "aria-controls": "theme-menu",
52
+ "aria-label": "switch theme",
53
+ "aria-expanded": open ? "true" : void 0,
54
+ onClick: handleOpen
55
+ }
75
56
  ),
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)
57
+ /* @__PURE__ */ jsxs(
58
+ Menu,
59
+ {
60
+ id: "theme-menu",
61
+ anchorEl,
62
+ open,
63
+ onClose: handleClose,
64
+ MenuListProps: {
65
+ "aria-labelledby": "theme-button",
66
+ role: "listbox"
85
67
  },
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
- ));
68
+ children: [
69
+ /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: "Choose a theme" }),
70
+ /* @__PURE__ */ jsxs(
71
+ MenuItem,
72
+ {
73
+ selected: themeId === void 0,
74
+ onClick: () => handleSelectTheme(void 0),
75
+ children: [
76
+ /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ThemeIcon, { icon: void 0, active: themeId === void 0 }) }),
77
+ /* @__PURE__ */ jsx(ListItemText, { children: "Auto" })
78
+ ]
79
+ }
80
+ ),
81
+ themeIds.map((theme) => {
82
+ const active = theme.id === themeId;
83
+ return /* @__PURE__ */ jsxs(
84
+ MenuItem,
85
+ {
86
+ selected: active,
87
+ "aria-selected": active,
88
+ onClick: () => handleSelectTheme(theme.id),
89
+ children: [
90
+ /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ThemeIcon, { icon: theme.icon, active }) }),
91
+ /* @__PURE__ */ jsx(ListItemText, { children: theme.title })
92
+ ]
93
+ },
94
+ theme.id
95
+ );
96
+ })
97
+ ]
98
+ }
99
+ )
100
+ ] });
91
101
  };
92
102
 
93
103
  export { SidebarThemeSwitcher };
@@ -1 +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;AAC9B,CAAC,oBAEA,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,MAAA,GAAS,YAAY,KAAW,CAAA,EAAA,CAAA;AAG9C,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,OAAU,GAAA,aAAA;AAAA,IACd,YAAY,cAAe,EAAA;AAAA,IAC3B,YAAY,gBAAiB;AAAA,GAC/B;AACA,EAAM,MAAA,QAAA,GAAW,YAAY,kBAAmB,EAAA;AAChD,EAAA,MAAM,cAAc,QAAS,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,OAAO,CAAA;AAEvD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAA8B,EAAA;AAC9D,EAAM,MAAA,IAAA,GAAO,QAAQ,QAAQ,CAAA;AAE7B,EAAM,MAAA,UAAA,GAAa,CAAC,KAA4B,KAAA;AAC9C,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,GACjC;AAEA,EAAM,MAAA,iBAAA,GAAoB,CAAC,UAAmC,KAAA;AAC5D,IAAA,IAAI,SAAS,IAAK,CAAA,CAAA,CAAA,KAAK,CAAE,CAAA,EAAA,KAAO,UAAU,CAAG,EAAA;AAC3C,MAAA,WAAA,CA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AAA,KAAA,CAAA;AAAA,QACtB,OAAA,EAAS,MAAM,iBAAA,CAAkB,KAAS,CAAA;AAAA,OAAA;AAAA,sBAE1C,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,MAAM,KAAW,CAAA,EAAA,MAAA,EAAQ,OAAY,KAAA,KAAA,CAAA,EAAW,CAC7D,CAAA;AAAA,sBACA,KAAA,CAAA,aAAA,CAAC,oBAAa,MAAI;AAAA,KACpB;AAAA,IAEC,QAAA,CAAS,IAAI,CAAS,KAAA,KAAA;AACrB,MAAM,MAAA,MAAA,GAAS,MAAM,EAAO,KAAA,OAAA;AAC5B,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAM,CAAA,EAAA;AAAA,UACX,QAAU,EAAA,MAAA;AAAA,UACV,eAAe,EAAA,MAAA;AAAA,UACf,OAAS,EAAA,MAAM,iBAAkB,CAAA,KAAA,CAAM,EAAE;AAAA,SAAA;AAAA,wBAEzC,KAAA,CAAA,aAAA,CAAC,oCACE,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,MAAM,KAAM,CAAA,IAAA,EAAM,QAAgB,CAC/C,CAAA;AAAA,wBACA,KAAA,CAAA,aAAA,CAAC,YAAc,EAAA,IAAA,EAAA,KAAA,CAAM,KAAM;AAAA,OAC7B;AAAA,KAEH;AAAA,GAEL,CAAA;AAEJ;;;;"}
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 { MouseEvent, 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: 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;AAC9B,CAAC,oBAEA,GAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,MAAA,GAAS,YAAY,KAAW,CAAA,EAAA,CAAA;AAG9C,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,OAAU,GAAA,aAAA;AAAA,IACd,YAAY,cAAe,EAAA;AAAA,IAC3B,YAAY,gBAAiB;AAAA,GAC/B;AACA,EAAM,MAAA,QAAA,GAAW,YAAY,kBAAmB,EAAA;AAChD,EAAA,MAAM,cAAc,QAAS,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,OAAO,CAAA;AAEvD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAA8B,EAAA;AAC9D,EAAM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AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { createApp } from '@backstage/app-defaults';
2
3
  import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
3
4
  import { SidebarItem, SignInPage, AlertDisplay, OAuthRequestDialog, SidebarPage, Sidebar, SidebarSpacer, SidebarSpace, SidebarDivider } from '@backstage/core-components';
@@ -5,7 +6,6 @@ import { attachComponentData, createRouteRef, createApiFactory, configApiRef } f
5
6
  import { scmIntegrationsApiRef, ScmIntegrationsApi } from '@backstage/integration-react';
6
7
  import Box from '@material-ui/core/Box';
7
8
  import BookmarkIcon from '@material-ui/icons/Bookmark';
8
- import React from 'react';
9
9
  import { createRoutesFromChildren, Route } from 'react-router-dom';
10
10
  import { SidebarThemeSwitcher } from './SidebarThemeSwitcher.esm.js';
11
11
  import 'react-dom';
@@ -20,7 +20,7 @@ if (process.env.HAS_REACT_DOM_CLIENT) {
20
20
  ReactDOMPromise = import('react-dom');
21
21
  }
22
22
  function isReactRouterBeta() {
23
- const [obj] = createRoutesFromChildren(/* @__PURE__ */ React.createElement(Route, { index: true, element: /* @__PURE__ */ React.createElement("div", null) }));
23
+ const [obj] = createRoutesFromChildren(/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx("div", {}) }));
24
24
  return !obj.index;
25
25
  }
26
26
  const MaybeGatheringRoute = ({ element }) => element;
@@ -84,26 +84,26 @@ class DevAppBuilder {
84
84
  }
85
85
  if (opts.title) {
86
86
  this.sidebarItems.push(
87
- /* @__PURE__ */ React.createElement(
87
+ /* @__PURE__ */ jsx(
88
88
  SidebarItem,
89
89
  {
90
- key: path,
91
90
  to: path,
92
91
  text: opts.title,
93
92
  icon: opts.icon ?? BookmarkIcon
94
- }
93
+ },
94
+ path
95
95
  )
96
96
  );
97
97
  }
98
98
  this.routes.push(
99
- /* @__PURE__ */ React.createElement(
99
+ /* @__PURE__ */ jsx(
100
100
  MaybeGatheringRoute,
101
101
  {
102
- key: path,
103
102
  path,
104
103
  element: opts.element,
105
104
  children: opts.children
106
- }
105
+ },
106
+ path
107
107
  )
108
108
  );
109
109
  return this;
@@ -148,7 +148,7 @@ class DevAppBuilder {
148
148
  */
149
149
  build() {
150
150
  const fakeRouteRef = createRouteRef({ id: "fake" });
151
- const FakePage = () => /* @__PURE__ */ React.createElement(Box, { p: 3 }, "Page belonging to another plugin.");
151
+ const FakePage = () => /* @__PURE__ */ jsx(Box, { p: 3, children: "Page belonging to another plugin." });
152
152
  attachComponentData(FakePage, "core.mountPoint", fakeRouteRef);
153
153
  const apis = [...this.apis];
154
154
  if (!apis.some((api) => api.api.id === scmIntegrationsApiRef.id)) {
@@ -166,7 +166,7 @@ class DevAppBuilder {
166
166
  themes: this.themes,
167
167
  components: {
168
168
  SignInPage: (props) => {
169
- return /* @__PURE__ */ React.createElement(
169
+ return /* @__PURE__ */ jsx(
170
170
  SignInPage,
171
171
  {
172
172
  ...props,
@@ -192,7 +192,26 @@ class DevAppBuilder {
192
192
  resources: this.translationResources
193
193
  }
194
194
  });
195
- 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(SidebarLanguageSwitcher, 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) })))));
195
+ const DevApp = /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ /* @__PURE__ */ jsx(AlertDisplay, {}),
197
+ /* @__PURE__ */ jsx(OAuthRequestDialog, {}),
198
+ this.rootChildren,
199
+ /* @__PURE__ */ jsx(AppRouter, { children: /* @__PURE__ */ jsxs(SidebarPage, { children: [
200
+ /* @__PURE__ */ jsxs(Sidebar, { children: [
201
+ /* @__PURE__ */ jsx(SidebarSpacer, {}),
202
+ this.sidebarItems,
203
+ /* @__PURE__ */ jsx(SidebarSpace, {}),
204
+ /* @__PURE__ */ jsx(SidebarDivider, {}),
205
+ /* @__PURE__ */ jsx(SidebarThemeSwitcher, {}),
206
+ /* @__PURE__ */ jsx(SidebarLanguageSwitcher, {}),
207
+ /* @__PURE__ */ jsx(SidebarSignOutButton, {})
208
+ ] }),
209
+ /* @__PURE__ */ jsxs(FlatRoutes, { children: [
210
+ this.routes,
211
+ /* @__PURE__ */ jsx(Route, { path: "/_external_route", element: /* @__PURE__ */ jsx(FakePage, {}) })
212
+ ] })
213
+ ] }) })
214
+ ] });
196
215
  return app.createRoot(DevApp);
197
216
  }
198
217
  /**
@@ -206,10 +225,10 @@ class DevAppBuilder {
206
225
  ReactDOMPromise.then((ReactDOM) => {
207
226
  if ("createRoot" in ReactDOM) {
208
227
  ReactDOM.createRoot(document.getElementById("root")).render(
209
- /* @__PURE__ */ React.createElement(DevApp, null)
228
+ /* @__PURE__ */ jsx(DevApp, {})
210
229
  );
211
230
  } else {
212
- ReactDOM.render(/* @__PURE__ */ React.createElement(DevApp, null), document.getElementById("root"));
231
+ ReactDOM.render(/* @__PURE__ */ jsx(DevApp, {}), document.getElementById("root"));
213
232
  }
214
233
  });
215
234
  }
@@ -1 +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 { TranslationResource } from '@backstage/core-plugin-api/alpha';\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 { SidebarLanguageSwitcher, 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 private readonly translationResources = new Array<TranslationResource>();\n\n private defaultPage?: string;\n private themes?: Array<AppTheme>;\n private languages?: string[];\n private defaultLanguage?: string;\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 * Set available languages to be shown in the dev app\n */\n setAvailableLanguages(languages: string[]) {\n this.languages = languages;\n return this;\n }\n\n /**\n * Add translation resource to the dev app\n */\n addTranslationResource(resource: TranslationResource) {\n this.translationResources.push(resource);\n return this;\n }\n\n /**\n * Set default language for the dev app\n */\n setDefaultLanguage(language: string) {\n this.defaultLanguage = language;\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 __experimentalTranslations: {\n defaultLanguage: this.defaultLanguage,\n availableLanguages: this.languages,\n resources: this.translationResources,\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 <SidebarLanguageSwitcher />\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":";;;;;;;;;;;;;;;AAuDA,IAAI,eAAA;AAGJ,IAAI,OAAA,CAAQ,IAAI,oBAAsB,EAAA;AACpC,EAAA,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AAC7C,CAAO,MAAA;AACL,EAAA,eAAA,GAAkB,OAAO,WAAW,CAAA;AACtC;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,EA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AA,CAAA,aAAA,CAAC,uBAAwB,EAAA,IAAA,CAAA,sCACxB,oBAAqB,EAAA,IAAA,CACxB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UACE,EAAA,IAAA,EAAA,IAAA,CAAK,wBACL,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,IAAK,EAAA,kBAAA,EAAmB,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CAAI,EAAA,CACxD,CACF,CACF,CACF,CAAA;AAGF,IAAO,OAAA,GAAA,CAAI,WAAW,MAAM,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA,EAKA,MAAe,GAAA;AACb,IAAM,MAAA,MAAA,GAAS,KAAK,KAAM,EAAA;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;AAAA;AAGlC,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;AAAA,SACV;AAAA,OACK,MAAA;AACL,QAAA,QAAA,CAAS,uBAAQ,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAO,GAAI,QAAS,CAAA,cAAA,CAAe,MAAM,CAAC,CAAA;AAAA;AAC7D,KACD,CAAA;AAAA;AAEL;AAUO,SAAS,YAAe,GAAA;AAC7B,EAAA,OAAO,IAAI,aAAc,EAAA;AAC3B;;;;"}
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 { TranslationResource } from '@backstage/core-plugin-api/alpha';\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 { ComponentType, PropsWithChildren, ReactNode } from 'react';\nimport { createRoutesFromChildren, Route } from 'react-router-dom';\nimport { SidebarThemeSwitcher } from './SidebarThemeSwitcher';\nimport 'react-dom';\nimport { SidebarLanguageSwitcher, 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 private readonly translationResources = new Array<TranslationResource>();\n\n private defaultPage?: string;\n private themes?: Array<AppTheme>;\n private languages?: string[];\n private defaultLanguage?: string;\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 * Set available languages to be shown in the dev app\n */\n setAvailableLanguages(languages: string[]) {\n this.languages = languages;\n return this;\n }\n\n /**\n * Add translation resource to the dev app\n */\n addTranslationResource(resource: TranslationResource) {\n this.translationResources.push(resource);\n return this;\n }\n\n /**\n * Set default language for the dev app\n */\n setDefaultLanguage(language: string) {\n this.defaultLanguage = language;\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 __experimentalTranslations: {\n defaultLanguage: this.defaultLanguage,\n availableLanguages: this.languages,\n resources: this.translationResources,\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 <SidebarLanguageSwitcher />\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":";;;;;;;;;;;;;;;AAuDA,IAAI,eAAA;AAGJ,IAAI,OAAA,CAAQ,IAAI,oBAAsB,EAAA;AACpC,EAAA,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AAC7C,CAAO,MAAA;AACL,EAAA,eAAA,GAAkB,OAAO,WAAW,CAAA;AACtC;AAEO,SAAS,iBAA6B,GAAA;AAC3C,EAAA,MAAM,CAAC,GAAG,CAAI,GAAA,wBAAA,iBAA0B,GAAA,CAAA,KAAA,EAAA,EAAM,KAAK,EAAA,IAAA,EAAC,OAAS,kBAAA,GAAA,CAAC,KAAI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EAAA,EAAA;AAAA,SACxB,EAAA,CAAA;AAAA,6BACC,UACE,EAAA,EAAA,QAAA,EAAA;AAAA,UAAK,IAAA,CAAA,MAAA;AAAA,8BACL,KAAM,EAAA,EAAA,IAAA,EAAK,oBAAmB,OAAS,kBAAA,GAAA,CAAC,YAAS,CAAI,EAAA;AAAA,SACxD,EAAA;AAAA,OAAA,EACF,CACF,EAAA;AAAA,KACF,EAAA,CAAA;AAGF,IAAO,OAAA,GAAA,CAAI,WAAW,MAAM,CAAA;AAAA;AAC9B;AAAA;AAAA;AAAA,EAKA,MAAe,GAAA;AACb,IAAM,MAAA,MAAA,GAAS,KAAK,KAAM,EAAA;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;AAAA;AAGlC,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,8BACnD,MAAO,EAAA,EAAA;AAAA,SACV;AAAA,OACK,MAAA;AACL,QAAA,QAAA,CAAS,uBAAQ,GAAA,CAAA,MAAA,EAAA,EAAO,GAAI,QAAS,CAAA,cAAA,CAAe,MAAM,CAAC,CAAA;AAAA;AAC7D,KACD,CAAA;AAAA;AAEL;AAUO,SAAS,YAAe,GAAA;AAC7B,EAAA,OAAO,IAAI,aAAc,EAAA;AAC3B;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { Entity } from '@backstage/catalog-model';
2
2
  import { GridProps } from '@material-ui/core/Grid';
3
- import React, { ReactNode, ComponentType, PropsWithChildren } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { IconComponent, BackstagePlugin, ApiFactory, AppTheme } from '@backstage/core-plugin-api';
5
5
  import { SignInProviderConfig } from '@backstage/core-components';
6
6
  import { TranslationResource } from '@backstage/core-plugin-api/alpha';
7
+ import { ReactNode, ComponentType, PropsWithChildren } from 'react';
7
8
 
8
9
  /** @public */
9
10
  declare const EntityGridItem: (props: Omit<GridProps, "item" | "container"> & {
@@ -18,10 +19,10 @@ declare const EntityGridItem: (props: Omit<GridProps, "item" | "container"> & {
18
19
  declare const SidebarSignOutButton: (props: {
19
20
  icon?: IconComponent;
20
21
  text?: string;
21
- }) => React.JSX.Element;
22
+ }) => react_jsx_runtime.JSX.Element;
22
23
 
23
24
  /** @public */
24
- declare const SidebarLanguageSwitcher: () => React.JSX.Element | null;
25
+ declare const SidebarLanguageSwitcher: () => react_jsx_runtime.JSX.Element | null;
25
26
 
26
27
  /** @public */
27
28
  type DevAppPageOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/dev-utils",
3
- "version": "1.1.9-next.1",
3
+ "version": "1.1.9-next.2",
4
4
  "description": "Utilities for developing Backstage plugins.",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -36,21 +36,21 @@
36
36
  "test": "backstage-cli package test"
37
37
  },
38
38
  "dependencies": {
39
- "@backstage/app-defaults": "1.6.1-next.0",
39
+ "@backstage/app-defaults": "1.6.1-next.1",
40
40
  "@backstage/catalog-model": "1.7.3",
41
- "@backstage/core-app-api": "1.16.0",
42
- "@backstage/core-components": "0.17.1-next.0",
43
- "@backstage/core-plugin-api": "1.10.5",
44
- "@backstage/integration-react": "1.2.6-next.0",
45
- "@backstage/plugin-catalog-react": "1.16.1-next.1",
46
- "@backstage/theme": "0.6.4",
41
+ "@backstage/core-app-api": "1.16.1-next.0",
42
+ "@backstage/core-components": "0.17.1-next.1",
43
+ "@backstage/core-plugin-api": "1.10.6-next.0",
44
+ "@backstage/integration-react": "1.2.6-next.1",
45
+ "@backstage/plugin-catalog-react": "1.17.0-next.2",
46
+ "@backstage/theme": "0.6.5-next.0",
47
47
  "@material-ui/core": "^4.12.2",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "react-use": "^17.2.4"
50
50
  },
51
51
  "devDependencies": {
52
- "@backstage/cli": "0.32.0-next.1",
53
- "@backstage/test-utils": "1.7.6",
52
+ "@backstage/cli": "0.32.0-next.2",
53
+ "@backstage/test-utils": "1.7.7-next.0",
54
54
  "@testing-library/dom": "^10.0.0",
55
55
  "@testing-library/jest-dom": "^6.0.0",
56
56
  "@testing-library/react": "^16.0.0",
@@ -72,5 +72,12 @@
72
72
  "optional": true
73
73
  }
74
74
  },
75
+ "typesVersions": {
76
+ "*": {
77
+ "package.json": [
78
+ "package.json"
79
+ ]
80
+ }
81
+ },
75
82
  "module": "./dist/index.esm.js"
76
83
  }