@backstage/plugin-techdocs 1.12.5-next.1 → 1.12.5
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 +54 -0
- package/dist/EntityPageDocs.esm.js +11 -8
- package/dist/EntityPageDocs.esm.js.map +1 -1
- package/dist/Router.esm.js +15 -12
- package/dist/Router.esm.js.map +1 -1
- package/dist/alpha.d.ts +6 -6
- package/dist/alpha.esm.js +14 -10
- package/dist/alpha.esm.js.map +1 -1
- package/dist/home/components/DefaultTechDocsHome.esm.js +21 -10
- package/dist/home/components/DefaultTechDocsHome.esm.js.map +1 -1
- package/dist/home/components/Grids/DocsCardGrid.esm.js +26 -22
- package/dist/home/components/Grids/DocsCardGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js +22 -14
- package/dist/home/components/Grids/EntityListDocsGrid.esm.js.map +1 -1
- package/dist/home/components/Grids/InfoCardGrid.esm.js +19 -17
- package/dist/home/components/Grids/InfoCardGrid.esm.js.map +1 -1
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js +2 -2
- package/dist/home/components/Tables/CursorPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/DocsTable.esm.js +8 -8
- package/dist/home/components/Tables/DocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/EntityListDocsTable.esm.js +8 -8
- package/dist/home/components/Tables/EntityListDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js +4 -3
- package/dist/home/components/Tables/OffsetPaginatedDocsTable.esm.js.map +1 -1
- package/dist/home/components/Tables/actions.esm.js +3 -3
- package/dist/home/components/Tables/actions.esm.js.map +1 -1
- package/dist/home/components/Tables/columns.esm.js +4 -4
- package/dist/home/components/Tables/columns.esm.js.map +1 -1
- package/dist/home/components/TechDocsCustomHome.esm.js +41 -34
- package/dist/home/components/TechDocsCustomHome.esm.js.map +1 -1
- package/dist/home/components/TechDocsIndexPage.esm.js +2 -2
- package/dist/home/components/TechDocsIndexPage.esm.js.map +1 -1
- package/dist/home/components/TechDocsPageWrapper.esm.js +6 -6
- package/dist/home/components/TechDocsPageWrapper.esm.js.map +1 -1
- package/dist/index.d.ts +39 -38
- package/dist/reader/components/TechDocsBuildLogs.esm.js +48 -40
- package/dist/reader/components/TechDocsBuildLogs.esm.js.map +1 -1
- package/dist/reader/components/TechDocsNotFound.esm.js +3 -2
- package/dist/reader/components/TechDocsNotFound.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js +18 -13
- package/dist/reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js +19 -11
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js +6 -2
- package/dist/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContentAddons.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js +55 -44
- package/dist/reader/components/TechDocsReaderPageHeader/TechDocsReaderPageHeader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js +33 -27
- package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map +1 -1
- package/dist/reader/components/TechDocsReaderProvider.esm.js +4 -3
- package/dist/reader/components/TechDocsReaderProvider.esm.js.map +1 -1
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js +7 -6
- package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js.map +1 -1
- package/dist/reader/components/TechDocsStateIndicator.esm.js +43 -36
- package/dist/reader/components/TechDocsStateIndicator.esm.js.map +1 -1
- package/dist/reader/transformers/addGitFeedbackLink.esm.js +2 -2
- package/dist/reader/transformers/addGitFeedbackLink.esm.js.map +1 -1
- package/dist/reader/transformers/addSidebarToggle.esm.js +2 -2
- package/dist/reader/transformers/addSidebarToggle.esm.js.map +1 -1
- package/dist/reader/transformers/copyToClipboard.esm.js +16 -15
- package/dist/reader/transformers/copyToClipboard.esm.js.map +1 -1
- package/dist/reader/transformers/handleMetaRedirects.esm.js +2 -2
- package/dist/reader/transformers/handleMetaRedirects.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearch.esm.js +5 -4
- package/dist/search/components/TechDocsSearch.esm.js.map +1 -1
- package/dist/search/components/TechDocsSearchResultListItem.esm.js +28 -20
- package/dist/search/components/TechDocsSearchResultListItem.esm.js.map +1 -1
- package/package.json +27 -27
package/dist/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsReaderPageSubheader.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"TechDocsReaderPageSubheader.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2022 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, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["locations"],"mappings":";;;;;;;;;;;AAiCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,eAAA;AAAA,IACV,aAAe,EAAA,QAAA;AAAA,IACf,SAAW,EAAA,MAAA;AAAA,IACX,OAAS,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,IAC9B,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA;AAAA;AACX;AAEJ,CAAE,CAAA,CAAA;AAOW,MAAA,2BAAA,GAA8B,CAAC,KAEtC,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAA6B,IAAI,CAAA;AAEjE,EAAM,MAAA,WAAA,GAAc,WAAY,CAAA,CAAC,KAAyC,KAAA;AACxE,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA;AAAA,GACjC,EAAG,EAAE,CAAA;AAEL,EAAM,MAAA,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,GAClB,EAAG,EAAE,CAAA;AAEL,EAAM,MAAA;AAAA,IACJ,cAAgB,EAAA,EAAE,KAAO,E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AAA;AAAA,cACxD,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,cACtB,OAAS,EAAA,WAAA;AAAA,cACT,WAAW,EAAA,IAAA;AAAA,cAEX,QAAA,kBAAA,GAAA,CAAC,SAAK,QAAe,EAAA,cAAA,EAAA;AAAA;AAAA;AACvB,SAAA,EACF,CACE,GAAA;AAAA;AAAA;AAAA,GAER,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
2
3
|
import { useParams } from 'react-router-dom';
|
|
3
4
|
import { useTechDocsReaderPage } from '@backstage/plugin-techdocs-react';
|
|
4
5
|
import { useReaderState } from './useReaderState.esm.js';
|
|
@@ -11,9 +12,9 @@ const TechDocsReaderProvider = (props) => {
|
|
|
11
12
|
const { entityRef } = useTechDocsReaderPage();
|
|
12
13
|
const { kind, namespace, name } = entityRef;
|
|
13
14
|
const value = useReaderState(kind, namespace, name, path);
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx(TechDocsReaderContext.Provider, { value, children: children instanceof Function ? children(value) : children });
|
|
15
16
|
};
|
|
16
|
-
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */
|
|
17
|
+
const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ jsx(TechDocsReaderProvider, { children: /* @__PURE__ */ jsx(Component, { ...props }) });
|
|
17
18
|
|
|
18
19
|
export { TechDocsReaderProvider, useTechDocsReader, withTechDocsReaderProvider };
|
|
19
20
|
//# sourceMappingURL=TechDocsReaderProvider.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsReaderProvider.esm.js","sources":["../../../src/reader/components/TechDocsReaderProvider.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
|
|
1
|
+
{"version":3,"file":"TechDocsReaderProvider.esm.js","sources":["../../../src/reader/components/TechDocsReaderProvider.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 { ComponentType, createContext, useContext, ReactNode } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useTechDocsReaderPage } from '@backstage/plugin-techdocs-react';\n\nimport { useReaderState, ReaderState } from './useReaderState';\n\nconst TechDocsReaderContext = createContext<ReaderState>({} as ReaderState);\n\nexport const useTechDocsReader = () => useContext(TechDocsReaderContext);\n\n/**\n * @public Render function for {@link TechDocsReaderProvider}\n */\nexport type TechDocsReaderProviderRenderFunction = (\n value: ReaderState,\n) => JSX.Element;\n\n/**\n * @public Props for {@link TechDocsReaderProvider}\n */\nexport type TechDocsReaderProviderProps = {\n children: TechDocsReaderProviderRenderFunction | ReactNode;\n};\n\n/**\n * Provides shared building process state to the reader page components.\n *\n * @public\n */\nexport const TechDocsReaderProvider = (props: TechDocsReaderProviderProps) => {\n const { children } = props;\n\n const { '*': path = '' } = useParams();\n const { entityRef } = useTechDocsReaderPage();\n const { kind, namespace, name } = entityRef;\n const value = useReaderState(kind, namespace, name, path);\n\n return (\n <TechDocsReaderContext.Provider value={value}>\n {children instanceof Function ? children(value) : children}\n </TechDocsReaderContext.Provider>\n );\n};\n\nexport const withTechDocsReaderProvider =\n <T extends {}>(Component: ComponentType<T>) =>\n (props: T) =>\n (\n <TechDocsReaderProvider>\n <Component {...props} />\n </TechDocsReaderProvider>\n );\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,qBAAA,GAAwB,aAA2B,CAAA,EAAiB,CAAA;AAE7D,MAAA,iBAAA,GAAoB,MAAM,UAAA,CAAW,qBAAqB;AAqB1D,MAAA,sBAAA,GAAyB,CAAC,KAAuC,KAAA;AAC5E,EAAM,MAAA,EAAE,UAAa,GAAA,KAAA;AAErB,EAAA,MAAM,EAAE,GAAA,EAAK,IAAO,GAAA,EAAA,KAAO,SAAU,EAAA;AACrC,EAAM,MAAA,EAAE,SAAU,EAAA,GAAI,qBAAsB,EAAA;AAC5C,EAAA,MAAM,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAS,GAAA,SAAA;AAClC,EAAA,MAAM,KAAQ,GAAA,cAAA,CAAe,IAAM,EAAA,SAAA,EAAW,MAAM,IAAI,CAAA;AAExD,EACE,uBAAA,GAAA,CAAC,qBAAsB,CAAA,QAAA,EAAtB,EAA+B,KAAA,EAC7B,8BAAoB,QAAW,GAAA,QAAA,CAAS,KAAK,CAAA,GAAI,QACpD,EAAA,CAAA;AAEJ;AAEa,MAAA,0BAAA,GACX,CAAe,SAAA,KACf,CAAC,KAAA,qBAEI,GAAA,CAAA,sBAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CACxB,EAAA;;;;"}
|
package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
-
import
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import Snackbar from '@material-ui/core/Snackbar';
|
|
4
5
|
import Button from '@material-ui/core/Button';
|
|
5
6
|
|
|
@@ -17,7 +18,7 @@ const TechDocsRedirectNotification = ({
|
|
|
17
18
|
const classes = useStyles();
|
|
18
19
|
const [open, setOpen] = useState(true);
|
|
19
20
|
const handleClose = () => setOpen(false);
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
21
22
|
Snackbar,
|
|
22
23
|
{
|
|
23
24
|
open,
|
|
@@ -26,7 +27,7 @@ const TechDocsRedirectNotification = ({
|
|
|
26
27
|
color: "primary",
|
|
27
28
|
onClose: handleClose,
|
|
28
29
|
message,
|
|
29
|
-
action: /* @__PURE__ */
|
|
30
|
+
action: /* @__PURE__ */ jsx(
|
|
30
31
|
Button,
|
|
31
32
|
{
|
|
32
33
|
classes: { root: classes.button },
|
|
@@ -34,9 +35,9 @@ const TechDocsRedirectNotification = ({
|
|
|
34
35
|
onClick: () => {
|
|
35
36
|
handleClose();
|
|
36
37
|
handleButtonClick();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
},
|
|
39
|
+
children: "Redirect now"
|
|
40
|
+
}
|
|
40
41
|
)
|
|
41
42
|
}
|
|
42
43
|
);
|
package/dist/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsRedirectNotification.esm.js","sources":["../../../../src/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.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 { makeStyles } from '@material-ui/core/styles';\nimport
|
|
1
|
+
{"version":3,"file":"TechDocsRedirectNotification.esm.js","sources":["../../../../src/reader/components/TechDocsRedirectNotification/TechDocsRedirectNotification.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 { makeStyles } from '@material-ui/core/styles';\nimport { useState } from 'react';\nimport Snackbar from '@material-ui/core/Snackbar';\nimport Button from '@material-ui/core/Button';\n\ntype TechDocsRedirectNotificationProps = {\n handleButtonClick: () => void;\n message: string;\n autoHideDuration: number;\n};\n\nconst useStyles = makeStyles(theme => ({\n button: {\n color: theme.palette.primary.light,\n textDecoration: 'underline',\n },\n}));\n\nexport const TechDocsRedirectNotification = ({\n message,\n handleButtonClick,\n autoHideDuration,\n}: TechDocsRedirectNotificationProps) => {\n const classes = useStyles();\n const [open, setOpen] = useState(true);\n\n const handleClose = () => setOpen(false);\n\n return (\n <Snackbar\n open={open}\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n autoHideDuration={autoHideDuration}\n color=\"primary\"\n onClose={handleClose}\n message={message}\n action={\n <Button\n classes={{ root: classes.button }}\n size=\"small\"\n onClick={() => {\n handleClose();\n handleButtonClick();\n }}\n >\n Redirect now\n </Button>\n }\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA;AAAA,IAC7B,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CAAA;AAEK,MAAM,+BAA+B,CAAC;AAAA,EAC3C,OAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAyC,KAAA;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,IAAI,CAAA;AAErC,EAAM,MAAA,WAAA,GAAc,MAAM,OAAA,CAAQ,KAAK,CAAA;AAEvC,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,YAAc,EAAA,EAAE,QAAU,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,MACrD,gBAAA;AAAA,MACA,KAAM,EAAA,SAAA;AAAA,MACN,OAAS,EAAA,WAAA;AAAA,MACT,OAAA;AAAA,MACA,MACE,kBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,MAAO,EAAA;AAAA,UAChC,IAAK,EAAA,OAAA;AAAA,UACL,SAAS,MAAM;AACb,YAAY,WAAA,EAAA;AACZ,YAAkB,iBAAA,EAAA;AAAA,WACpB;AAAA,UACD,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,GAEJ;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
3
3
|
import Button from '@material-ui/core/Button';
|
|
4
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -29,70 +29,77 @@ const TechDocsStateIndicator = () => {
|
|
|
29
29
|
buildLog
|
|
30
30
|
} = useTechDocsReader();
|
|
31
31
|
if (state === "INITIAL_BUILD") {
|
|
32
|
-
StateAlert = /* @__PURE__ */
|
|
32
|
+
StateAlert = /* @__PURE__ */ jsx(
|
|
33
33
|
Alert,
|
|
34
34
|
{
|
|
35
35
|
classes: { root: classes.root },
|
|
36
36
|
variant: "outlined",
|
|
37
37
|
severity: "info",
|
|
38
|
-
icon: /* @__PURE__ */
|
|
39
|
-
action: /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
icon: /* @__PURE__ */ jsx(CircularProgress, { size: "24px" }),
|
|
39
|
+
action: /* @__PURE__ */ jsx(TechDocsBuildLogs, { buildLog }),
|
|
40
|
+
children: "Documentation is accessed for the first time and is being prepared. The subsequent loads are much faster."
|
|
41
|
+
}
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
if (state === "CONTENT_STALE_REFRESHING") {
|
|
45
|
-
StateAlert = /* @__PURE__ */
|
|
45
|
+
StateAlert = /* @__PURE__ */ jsx(
|
|
46
46
|
Alert,
|
|
47
47
|
{
|
|
48
48
|
variant: "outlined",
|
|
49
49
|
severity: "info",
|
|
50
|
-
icon: /* @__PURE__ */
|
|
51
|
-
action: /* @__PURE__ */
|
|
52
|
-
classes: { root: classes.root }
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
icon: /* @__PURE__ */ jsx(CircularProgress, { size: "24px" }),
|
|
51
|
+
action: /* @__PURE__ */ jsx(TechDocsBuildLogs, { buildLog }),
|
|
52
|
+
classes: { root: classes.root },
|
|
53
|
+
children: "A newer version of this documentation is being prepared and will be available shortly."
|
|
54
|
+
}
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
if (state === "CONTENT_STALE_READY") {
|
|
58
|
-
StateAlert = /* @__PURE__ */
|
|
58
|
+
StateAlert = /* @__PURE__ */ jsx(
|
|
59
59
|
Alert,
|
|
60
60
|
{
|
|
61
61
|
variant: "outlined",
|
|
62
62
|
severity: "success",
|
|
63
|
-
action: /* @__PURE__ */
|
|
64
|
-
classes: { root: classes.root }
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
action: /* @__PURE__ */ jsx(Button, { color: "inherit", onClick: () => contentReload(), children: "Refresh" }),
|
|
64
|
+
classes: { root: classes.root },
|
|
65
|
+
children: "A newer version of this documentation is now available, please refresh to view."
|
|
66
|
+
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
if (state === "CONTENT_STALE_ERROR") {
|
|
70
|
-
StateAlert = /* @__PURE__ */
|
|
70
|
+
StateAlert = /* @__PURE__ */ jsxs(
|
|
71
71
|
Alert,
|
|
72
72
|
{
|
|
73
73
|
variant: "outlined",
|
|
74
74
|
severity: "error",
|
|
75
|
-
action: /* @__PURE__ */
|
|
76
|
-
classes: { root: classes.root, message: classes.message }
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
action: /* @__PURE__ */ jsx(TechDocsBuildLogs, { buildLog }),
|
|
76
|
+
classes: { root: classes.root, message: classes.message },
|
|
77
|
+
children: [
|
|
78
|
+
"Building a newer version of this documentation failed.",
|
|
79
|
+
" ",
|
|
80
|
+
syncErrorMessage
|
|
81
|
+
]
|
|
82
|
+
}
|
|
81
83
|
);
|
|
82
84
|
}
|
|
83
85
|
if (state === "CONTENT_NOT_FOUND") {
|
|
84
|
-
StateAlert = /* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
StateAlert = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
syncErrorMessage && /* @__PURE__ */ jsxs(
|
|
88
|
+
Alert,
|
|
89
|
+
{
|
|
90
|
+
variant: "outlined",
|
|
91
|
+
severity: "error",
|
|
92
|
+
action: /* @__PURE__ */ jsx(TechDocsBuildLogs, { buildLog }),
|
|
93
|
+
classes: { root: classes.root, message: classes.message },
|
|
94
|
+
children: [
|
|
95
|
+
"Building a newer version of this documentation failed.",
|
|
96
|
+
" ",
|
|
97
|
+
syncErrorMessage
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(TechDocsNotFound, { errorMessage: contentErrorMessage })
|
|
102
|
+
] });
|
|
96
103
|
}
|
|
97
104
|
return StateAlert;
|
|
98
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsStateIndicator.esm.js","sources":["../../../src/reader/components/TechDocsStateIndicator.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"TechDocsStateIndicator.esm.js","sources":["../../../src/reader/components/TechDocsStateIndicator.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { TechDocsBuildLogs } from './TechDocsBuildLogs';\nimport { TechDocsNotFound } from './TechDocsNotFound';\nimport { useTechDocsReader } from './TechDocsReaderProvider';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(2),\n },\n message: {\n // `word-break: break-word` is deprecated, but gives legacy support to browsers not supporting `overflow-wrap` yet\n // https://developer.mozilla.org/en-US/docs/Web/CSS/word-break\n wordBreak: 'break-word',\n overflowWrap: 'anywhere',\n },\n}));\n\nexport const TechDocsStateIndicator = () => {\n let StateAlert: JSX.Element | null = null;\n const classes = useStyles();\n\n const {\n state,\n contentReload,\n contentErrorMessage,\n syncErrorMessage,\n buildLog,\n } = useTechDocsReader();\n\n if (state === 'INITIAL_BUILD') {\n StateAlert = (\n <Alert\n classes={{ root: classes.root }}\n variant=\"outlined\"\n severity=\"info\"\n icon={<CircularProgress size=\"24px\" />}\n action={<TechDocsBuildLogs buildLog={buildLog} />}\n >\n Documentation is accessed for the first time and is being prepared. The\n subsequent loads are much faster.\n </Alert>\n );\n }\n\n if (state === 'CONTENT_STALE_REFRESHING') {\n StateAlert = (\n <Alert\n variant=\"outlined\"\n severity=\"info\"\n icon={<CircularProgress size=\"24px\" />}\n action={<TechDocsBuildLogs buildLog={buildLog} />}\n classes={{ root: classes.root }}\n >\n A newer version of this documentation is being prepared and will be\n available shortly.\n </Alert>\n );\n }\n\n if (state === 'CONTENT_STALE_READY') {\n StateAlert = (\n <Alert\n variant=\"outlined\"\n severity=\"success\"\n action={\n <Button color=\"inherit\" onClick={() => contentReload()}>\n Refresh\n </Button>\n }\n classes={{ root: classes.root }}\n >\n A newer version of this documentation is now available, please refresh\n to view.\n </Alert>\n );\n }\n\n if (state === 'CONTENT_STALE_ERROR') {\n StateAlert = (\n <Alert\n variant=\"outlined\"\n severity=\"error\"\n action={<TechDocsBuildLogs buildLog={buildLog} />}\n classes={{ root: classes.root, message: classes.message }}\n >\n Building a newer version of this documentation failed.{' '}\n {syncErrorMessage}\n </Alert>\n );\n }\n\n if (state === 'CONTENT_NOT_FOUND') {\n StateAlert = (\n <>\n {syncErrorMessage && (\n <Alert\n variant=\"outlined\"\n severity=\"error\"\n action={<TechDocsBuildLogs buildLog={buildLog} />}\n classes={{ root: classes.root, message: classes.message }}\n >\n Building a newer version of this documentation failed.{' '}\n {syncErrorMessage}\n </Alert>\n )}\n <TechDocsNotFound errorMessage={contentErrorMessage} />\n </>\n );\n }\n\n return StateAlert;\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,OAAS,EAAA;AAAA;AAAA;AAAA,IAGP,SAAW,EAAA,YAAA;AAAA,IACX,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEK,MAAM,yBAAyB,MAAM;AAC1C,EAAA,IAAI,UAAiC,GAAA,IAAA;AACrC,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,aAAA;AAAA,IACA,mBAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,MACE,iBAAkB,EAAA;AAEtB,EAAA,IAAI,UAAU,eAAiB,EAAA;AAC7B,IACE,UAAA,mBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,IAAK,EAAA;AAAA,QAC9B,OAAQ,EAAA,UAAA;AAAA,QACR,QAAS,EAAA,MAAA;AAAA,QACT,IAAM,kBAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,IAAA,EAAK,MAAO,EAAA,CAAA;AAAA,QACpC,MAAA,kBAAS,GAAA,CAAA,iBAAA,EAAA,EAAkB,QAAoB,EAAA,CAAA;AAAA,QAChD,QAAA,EAAA;AAAA;AAAA,KAGD;AAAA;AAIJ,EAAA,IAAI,UAAU,0BAA4B,EAAA;AACxC,IACE,UAAA,mBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,UAAA;AAAA,QACR,QAA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AA,MACC,gBAAA,oBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,OAAQ,EAAA,UAAA;AAAA,UACR,QAAS,EAAA,OAAA;AAAA,UACT,MAAA,kBAAS,GAAA,CAAA,iBAAA,EAAA,EAAkB,QAAoB,EAAA,CAAA;AAAA,UAC/C,SAAS,EAAE,IAAA,EAAM,QAAQ,IAAM,EAAA,OAAA,EAAS,QAAQ,OAAQ,EAAA;AAAA,UACzD,QAAA,EAAA;AAAA,YAAA,wDAAA;AAAA,YACwD,GAAA;AAAA,YACtD;AAAA;AAAA;AAAA,OACH;AAAA,sBAEF,GAAA,CAAC,gBAAiB,EAAA,EAAA,YAAA,EAAc,mBAAqB,EAAA;AAAA,KACvD,EAAA,CAAA;AAAA;AAIJ,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { replaceGithubUrlType } from '@backstage/integration';
|
|
2
2
|
import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
|
|
3
|
-
import
|
|
3
|
+
import { createElement } from 'react';
|
|
4
4
|
import parseGitUrl from 'git-url-parse';
|
|
5
5
|
import { renderReactElement } from './renderReactElement.esm.js';
|
|
6
6
|
|
|
@@ -39,7 +39,7 @@ Feedback:`
|
|
|
39
39
|
default:
|
|
40
40
|
return dom;
|
|
41
41
|
}
|
|
42
|
-
renderReactElement(
|
|
42
|
+
renderReactElement(createElement(FeedbackOutlinedIcon), feedbackLink);
|
|
43
43
|
feedbackLink.style.paddingLeft = "5px";
|
|
44
44
|
feedbackLink.title = "Leave feedback for this page";
|
|
45
45
|
feedbackLink.id = "git-feedback-link";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addGitFeedbackLink.esm.js","sources":["../../../src/reader/transformers/addGitFeedbackLink.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Transformer } from './transformer';\nimport {\n replaceGithubUrlType,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';\nimport
|
|
1
|
+
{"version":3,"file":"addGitFeedbackLink.esm.js","sources":["../../../src/reader/transformers/addGitFeedbackLink.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Transformer } from './transformer';\nimport {\n replaceGithubUrlType,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';\nimport { createElement } from 'react';\nimport parseGitUrl from 'git-url-parse';\nimport { renderReactElement } from './renderReactElement';\n\n// requires repo\nexport const addGitFeedbackLink = (\n scmIntegrationsApi: ScmIntegrationRegistry,\n): Transformer => {\n return dom => {\n // attempting to use selectors that are more likely to be static as MkDocs updates over time\n const sourceAnchor = dom.querySelector(\n '[title=\"Edit this page\"]',\n ) as HTMLAnchorElement;\n\n // don't show if edit link not available in raw page\n if (!sourceAnchor || !sourceAnchor.href) {\n return dom;\n }\n\n const sourceURL = new URL(sourceAnchor.href);\n const integration = scmIntegrationsApi.byUrl(sourceURL);\n\n // don't show if can't identify edit link hostname as a gitlab/github hosting\n if (integration?.type !== 'github' && integration?.type !== 'gitlab') {\n return dom;\n }\n\n // topmost h1 only contains title for whole page\n const title =\n (dom.querySelector('article>h1') as HTMLElement)?.childNodes[0]\n .textContent || '';\n const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);\n const issueDesc = encodeURIComponent(\n `Page source:\\n${sourceAnchor.href}\\n\\nFeedback:`,\n );\n\n // Convert GitHub edit url to blob type so it can be parsed by git-url-parse correctly\n const gitUrl =\n integration?.type === 'github'\n ? replaceGithubUrlType(sourceURL.href, 'blob')\n : sourceURL.href;\n const gitInfo = parseGitUrl(gitUrl);\n const repoPath = `/${gitInfo.organization}/${gitInfo.name}`;\n\n const feedbackLink = sourceAnchor.cloneNode() as HTMLAnchorElement;\n switch (integration?.type) {\n case 'gitlab':\n feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?issue[title]=${issueTitle}&issue[description]=${issueDesc}`;\n break;\n case 'github':\n feedbackLink.href = `${sourceURL.origin}${repoPath}/issues/new?title=${issueTitle}&body=${issueDesc}`;\n break;\n default:\n return dom;\n }\n renderReactElement(createElement(FeedbackOutlinedIcon), feedbackLink);\n feedbackLink.style.paddingLeft = '5px';\n feedbackLink.title = 'Leave feedback for this page';\n feedbackLink.id = 'git-feedback-link';\n sourceAnchor?.insertAdjacentElement('beforebegin', feedbackLink);\n return dom;\n };\n};\n"],"names":[],"mappings":";;;;;;AA2Ba,MAAA,kBAAA,GAAqB,CAChC,kBACgB,KAAA;AAChB,EAAA,OAAO,CAAO,GAAA,KAAA;AAEZ,IAAA,MAAM,eAAe,GAAI,CAAA,aAAA;AAAA,MACvB;AAAA,KACF;AAGA,IAAA,IAAI,CAAC,YAAA,IAAgB,CAAC,YAAA,CAAa,IAAM,EAAA;AACvC,MAAO,OAAA,GAAA;AAAA;AAGT,IAAA,MAAM,SAAY,GAAA,IAAI,GAAI,CAAA,YAAA,CAAa,IAAI,CAAA;AAC3C,IAAM,MAAA,WAAA,GAAc,kBAAmB,C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AoB,CAAA,EAAG,YAAY,CAAA;AACpE,IAAA,YAAA,CAAa,MAAM,WAAc,GAAA,KAAA;AACjC,IAAA,YAAA,CAAa,KAAQ,GAAA,8BAAA;AACrB,IAAA,YAAA,CAAa,EAAK,GAAA,mBAAA;AAClB,IAAc,YAAA,EAAA,qBAAA,CAAsB,eAAe,YAAY,CAAA;AAC/D,IAAO,OAAA,GAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MenuIcon from '@material-ui/icons/Menu';
|
|
2
|
-
import
|
|
2
|
+
import { createElement } from 'react';
|
|
3
3
|
import { renderReactElement } from './renderReactElement.esm.js';
|
|
4
4
|
|
|
5
5
|
const addSidebarToggle = () => {
|
|
@@ -12,7 +12,7 @@ const addSidebarToggle = () => {
|
|
|
12
12
|
return dom;
|
|
13
13
|
}
|
|
14
14
|
const toggleSidebar = mkdocsToggleSidebar.cloneNode();
|
|
15
|
-
renderReactElement(
|
|
15
|
+
renderReactElement(createElement(MenuIcon), toggleSidebar);
|
|
16
16
|
toggleSidebar.id = "toggle-sidebar";
|
|
17
17
|
toggleSidebar.title = "Toggle Sidebar";
|
|
18
18
|
toggleSidebar.classList.add("md-content__button");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addSidebarToggle.esm.js","sources":["../../../src/reader/transformers/addSidebarToggle.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Transformer } from './transformer';\nimport MenuIcon from '@material-ui/icons/Menu';\nimport
|
|
1
|
+
{"version":3,"file":"addSidebarToggle.esm.js","sources":["../../../src/reader/transformers/addSidebarToggle.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Transformer } from './transformer';\nimport MenuIcon from '@material-ui/icons/Menu';\nimport { createElement } from 'react';\nimport { renderReactElement } from './renderReactElement';\n\nexport const addSidebarToggle = (): Transformer => {\n return dom => {\n // attempting to use selectors that are more likely to be static as MkDocs updates over time\n const mkdocsToggleSidebar = dom.querySelector(\n '.md-header label[for=\"__drawer\"]',\n ) as HTMLLabelElement;\n const article = dom.querySelector('article') as HTMLElement;\n\n // Fail gracefully\n if (!mkdocsToggleSidebar || !article) {\n return dom;\n }\n\n const toggleSidebar = mkdocsToggleSidebar.cloneNode() as HTMLLabelElement;\n renderReactElement(createElement(MenuIcon), toggleSidebar);\n toggleSidebar.id = 'toggle-sidebar';\n toggleSidebar.title = 'Toggle Sidebar';\n toggleSidebar.classList.add('md-content__button');\n toggleSidebar.style.setProperty('padding', '0 0 0 5px');\n toggleSidebar.style.setProperty('margin', '0.4rem 0 0.4rem 0.4rem');\n article?.prepend(toggleSidebar);\n return dom;\n };\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,mBAAmB,MAAmB;AACjD,EAAA,OAAO,CAAO,GAAA,KAAA;AAEZ,IAAA,MAAM,sBAAsB,GAAI,CAAA,aAAA;AAAA,MAC9B;AAAA,KACF;AACA,IAAM,MAAA,OAAA,GAAU,GAAI,CAAA,aAAA,CAAc,SAAS,CAAA;AAG3C,IAAI,IAAA,CAAC,mBAAuB,IAAA,CAAC,OAAS,EAAA;AACpC,MAAO,OAAA,GAAA;AAAA;AAGT,IAAM,MAAA,aAAA,GAAgB,oBAAoB,SAAU,EAAA;AACpD,IAAmB,kBAAA,CAAA,aAAA,CAAc,QAAQ,CAAA,EAAG,aAAa,CAAA;AACzD,IAAA,aAAA,CAAc,EAAK,GAAA,gBAAA;AACnB,IAAA,aAAA,CAAc,KAAQ,GAAA,gBAAA;AACtB,IAAc,aAAA,CAAA,SAAA,CAAU,IAAI,oBAAoB,CAAA;AAChD,IAAc,aAAA,CAAA,KAAA,CAAM,WAAY,CAAA,SAAA,EAAW,WAAW,CAAA;AACtD,IAAc,aAAA,CAAA,KAAA,CAAM,WAAY,CAAA,QAAA,EAAU,wBAAwB,CAAA;AAClE,IAAA,OAAA,EAAS,QAAQ,aAAa,CAAA;AAC9B,IAAO,OAAA,GAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
2
3
|
import { renderReactElement } from './renderReactElement.esm.js';
|
|
3
4
|
import { withStyles, ThemeProvider } from '@material-ui/core/styles';
|
|
4
5
|
import SvgIcon from '@material-ui/core/SvgIcon';
|
|
@@ -16,7 +17,7 @@ const CopyToClipboardTooltip = withStyles((theme) => ({
|
|
|
16
17
|
boxShadow: "none"
|
|
17
18
|
}
|
|
18
19
|
}))(Tooltip);
|
|
19
|
-
const CopyToClipboardIcon = () => /* @__PURE__ */
|
|
20
|
+
const CopyToClipboardIcon = () => /* @__PURE__ */ jsx(SvgIcon, { children: /* @__PURE__ */ jsx("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) });
|
|
20
21
|
const CopyToClipboardButton = ({ text }) => {
|
|
21
22
|
const [open, setOpen] = useState(false);
|
|
22
23
|
const [, copyToClipboard2] = useCopyToClipboard();
|
|
@@ -27,24 +28,24 @@ const CopyToClipboardButton = ({ text }) => {
|
|
|
27
28
|
const handleClose = useCallback(() => {
|
|
28
29
|
setOpen(false);
|
|
29
30
|
}, [setOpen]);
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
31
32
|
CopyToClipboardTooltip,
|
|
32
33
|
{
|
|
33
34
|
title: "Copied to clipboard",
|
|
34
35
|
placement: "left",
|
|
35
36
|
open,
|
|
36
37
|
onClose: handleClose,
|
|
37
|
-
leaveDelay: 1e3
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
leaveDelay: 1e3,
|
|
39
|
+
children: /* @__PURE__ */ jsx(
|
|
40
|
+
IconButton,
|
|
41
|
+
{
|
|
42
|
+
style: { color: "inherit", position: "absolute" },
|
|
43
|
+
className: "md-clipboard md-icon",
|
|
44
|
+
onClick: handleClick,
|
|
45
|
+
children: /* @__PURE__ */ jsx(CopyToClipboardIcon, {})
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
48
49
|
);
|
|
49
50
|
};
|
|
50
51
|
const copyToClipboard = (theme) => {
|
|
@@ -55,7 +56,7 @@ const copyToClipboard = (theme) => {
|
|
|
55
56
|
const container = document.createElement("div");
|
|
56
57
|
code?.parentElement?.prepend(container);
|
|
57
58
|
renderReactElement(
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(CopyToClipboardButton, { text }) }),
|
|
59
60
|
container
|
|
60
61
|
);
|
|
61
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyToClipboard.esm.js","sources":["../../../src/reader/transformers/copyToClipboard.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"copyToClipboard.esm.js","sources":["../../../src/reader/transformers/copyToClipboard.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useCallback } from 'react';\nimport { renderReactElement } from './renderReactElement';\nimport { ThemeProvider } from '@material-ui/core/styles';\nimport SvgIcon from '@material-ui/core/SvgIcon';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { withStyles, Theme } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport type { Transformer } from './transformer';\nimport useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\n\nconst CopyToClipboardTooltip = withStyles(theme => ({\n tooltip: {\n fontSize: 'inherit',\n color: theme.palette.text.primary,\n margin: 0,\n padding: theme.spacing(0.5),\n backgroundColor: 'transparent',\n boxShadow: 'none',\n },\n}))(Tooltip);\n\nconst CopyToClipboardIcon = () => (\n <SvgIcon>\n <path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\" />\n </SvgIcon>\n);\n\ntype CopyToClipboardButtonProps = {\n text: string;\n};\n\nconst CopyToClipboardButton = ({ text }: CopyToClipboardButtonProps) => {\n const [open, setOpen] = useState(false);\n const [, copyToClipboard] = useCopyToClipboard();\n\n const handleClick = useCallback(() => {\n copyToClipboard(text);\n setOpen(true);\n }, [text, copyToClipboard]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n return (\n <CopyToClipboardTooltip\n title=\"Copied to clipboard\"\n placement=\"left\"\n open={open}\n onClose={handleClose}\n leaveDelay={1000}\n >\n <IconButton\n style={{ color: 'inherit', position: 'absolute' }}\n className=\"md-clipboard md-icon\"\n onClick={handleClick}\n >\n <CopyToClipboardIcon />\n </IconButton>\n </CopyToClipboardTooltip>\n );\n};\n\n/**\n * Recreates copy-to-clipboard functionality attached to <code> snippets that\n * is native to mkdocs-material theme.\n */\nexport const copyToClipboard = (theme: Theme): Transformer => {\n return dom => {\n const codes = dom.querySelectorAll('pre > code');\n for (const code of codes) {\n const text = code.textContent || '';\n const container = document.createElement('div');\n code?.parentElement?.prepend(container);\n renderReactElement(\n <ThemeProvider theme={theme}>\n <CopyToClipboardButton text={text} />\n </ThemeProvider>,\n container,\n );\n }\n return dom;\n };\n};\n"],"names":["copyToClipboard"],"mappings":";;;;;;;;;AA0BA,MAAM,sBAAA,GAAyB,WAAW,CAAU,KAAA,MAAA;AAAA,EAClD,OAAS,EAAA;AAAA,IACP,QAAU,EAAA,SAAA;AAAA,IACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA;AAAA,IAC1B,MAAQ,EAAA,CAAA;AAAA,IACR,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC1B,eAAiB,EAAA,aAAA;AAAA,IACjB,SAAW,EAAA;AAAA;AAEf,CAAA,CAAE,EAAE,OAAO,CAAA;AAEX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,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,MAAM,MAAA,IAAA,GAAO,KAAK,WAAe,IAAA,EAAA;AACjC,MAAM,MAAA,SAAA,GAAY,QAAS,CAAA,aAAA,CAAc,KAAK,CAAA;AAC9C,MAAM,IAAA,EAAA,aAAA,EAAe,QAAQ,SAAS,CAAA;AACtC,MAAA,kBAAA;AAAA,4BACG,aAAc,EAAA,EAAA,KAAA,EACb,QAAC,kBAAA,GAAA,CAAA,qBAAA,EAAA,EAAsB,MAAY,CACrC,EAAA,CAAA;AAAA,QACA;AAAA,OACF;AAAA;AAEF,IAAO,OAAA,GAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { normalizeUrl } from './rewriteDocLinks.esm.js';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
import { renderReactElement } from './renderReactElement.esm.js';
|
|
4
4
|
import { TechDocsRedirectNotification } from '../components/TechDocsRedirectNotification/TechDocsRedirectNotification.esm.js';
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ const handleMetaRedirects = (navigate, entityName) => {
|
|
|
34
34
|
}
|
|
35
35
|
const container = document.createElement("div");
|
|
36
36
|
renderReactElement(
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
38
|
TechDocsRedirectNotification,
|
|
39
39
|
{
|
|
40
40
|
message: "This TechDocs page is no longer maintained. Will automatically redirect to the designated replacement.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleMetaRedirects.esm.js","sources":["../../../src/reader/transformers/handleMetaRedirects.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 { Transformer } from './transformer';\nimport { normalizeUrl } from './rewriteDocLinks';\nimport
|
|
1
|
+
{"version":3,"file":"handleMetaRedirects.esm.js","sources":["../../../src/reader/transformers/handleMetaRedirects.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 { Transformer } from './transformer';\nimport { normalizeUrl } from './rewriteDocLinks';\nimport { renderReactElement } from './renderReactElement';\nimport { TechDocsRedirectNotification } from '../components/TechDocsRedirectNotification';\n\nexport const handleMetaRedirects = (\n navigate: (to: string) => void,\n entityName: string,\n): Transformer => {\n const redirectAfterMs = 3000;\n\n const determineRedirectURL = (metaUrl: string) => {\n const normalizedCurrentUrl = normalizeUrl(window.location.href);\n // When creating URL object, if the metaUrl is relative, it will be resolved with base href. If it is absolute, it will replace the base href.\n const absoluteRedirectObj = new URL(metaUrl, normalizedCurrentUrl);\n const isExternalRedirect =\n absoluteRedirectObj.hostname !== window.location.hostname;\n\n if (isExternalRedirect) {\n const currentTechDocPath = window.location.pathname;\n const indexOfSiteHome = currentTechDocPath.indexOf(entityName);\n const siteHomePath = currentTechDocPath.slice(\n 0,\n indexOfSiteHome + entityName.length,\n );\n return new URL(siteHomePath, normalizedCurrentUrl).href;\n }\n return absoluteRedirectObj.href;\n };\n\n return dom => {\n for (const elem of Array.from(dom.querySelectorAll('meta'))) {\n if (elem.getAttribute('http-equiv') === 'refresh') {\n const metaContentParameters = elem\n .getAttribute('content')\n ?.split('url=');\n\n if (!metaContentParameters || metaContentParameters.length < 2) {\n return dom;\n }\n\n const metaUrl = metaContentParameters[1];\n const redirectURL = determineRedirectURL(metaUrl);\n\n // If the current URL is the same as the redirect URL, do not proceed with the redirect.\n if (window.location.href === redirectURL) {\n return dom;\n }\n\n const container = document.createElement('div');\n\n renderReactElement(\n <TechDocsRedirectNotification\n message=\"This TechDocs page is no longer maintained. Will automatically redirect to the designated replacement.\"\n handleButtonClick={() => navigate(redirectURL)}\n autoHideDuration={redirectAfterMs}\n />,\n container,\n );\n document.body.appendChild(container);\n\n setTimeout(() => {\n navigate(redirectURL);\n }, redirectAfterMs);\n\n return dom;\n }\n }\n return dom;\n };\n};\n"],"names":[],"mappings":";;;;;AAqBa,MAAA,mBAAA,GAAsB,CACjC,QAAA,EACA,UACgB,KAAA;AAChB,EAAA,MAAM,eAAkB,GAAA,GAAA;AAExB,EAAM,MAAA,oBAAA,GAAuB,CAAC,OAAoB,KAAA;AAChD,IAAA,MAAM,oBAAuB,GAAA,YAAA,CAAa,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA;AAE9D,IAAA,MAAM,mBAAsB,GAAA,IAAI,GAAI,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACjE,IAAA,MAAM,kBACJ,GAAA,mBAAA,CAAoB,QAAa,KAAA,MAAA,CAAO,QAAS,CAAA,QAAA;AAEnD,IAAA,IAAI,kBAAoB,EAAA;AACtB,MAAM,MAAA,kBAAA,GAAqB,OAAO,QAAS,CAAA,QAAA;AAC3C,MAAM,MAAA,eAAA,GAAkB,kBAAmB,CAAA,OAAA,CAAQ,UAAU,CAAA;AAC7D,MAAA,MAAM,eAAe,kBAAmB,CAAA,KAAA;AAAA,QACtC,CAAA;AAAA,QACA,kBAAkB,UAAW,CAAA;AAAA,OAC/B;AACA,MAAA,OAAO,IAAI,GAAA,CAAI,YAAc,EAAA,oBAAoB,CAAE,CAAA,IAAA;AAAA;AAErD,IAAA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
|
import { SearchContextProvider, useSearch, SearchAutocomplete } from '@backstage/plugin-search-react';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import { useNavigate } from 'react-router-dom';
|
|
4
5
|
import { TechDocsSearchResultListItem } from './TechDocsSearchResultListItem.esm.js';
|
|
5
6
|
|
|
@@ -50,7 +51,7 @@ const TechDocsSearchBar = (props) => {
|
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
54
55
|
SearchAutocomplete,
|
|
55
56
|
{
|
|
56
57
|
"data-testid": "techdocs-search-bar",
|
|
@@ -71,7 +72,7 @@ const TechDocsSearchBar = (props) => {
|
|
|
71
72
|
noOptionsText: "No results found",
|
|
72
73
|
value: null,
|
|
73
74
|
options,
|
|
74
|
-
renderOption: ({ document, highlight }) => /* @__PURE__ */
|
|
75
|
+
renderOption: ({ document, highlight }) => /* @__PURE__ */ jsx(
|
|
75
76
|
TechDocsSearchResultListItem,
|
|
76
77
|
{
|
|
77
78
|
result: document,
|
|
@@ -96,7 +97,7 @@ const TechDocsSearch = (props) => {
|
|
|
96
97
|
pageCursor: "",
|
|
97
98
|
filters: props.entityId
|
|
98
99
|
};
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ jsx(SearchContextProvider, { initialState, children: /* @__PURE__ */ jsx(TechDocsSearchBar, { ...props }) });
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
export { TechDocsSearch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechDocsSearch.esm.js","sources":["../../../src/search/components/TechDocsSearch.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { ResultHighlight } from '@backstage/plugin-search-common';\nimport {\n SearchAutocomplete,\n SearchContextProvider,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport
|
|
1
|
+
{"version":3,"file":"TechDocsSearch.esm.js","sources":["../../../src/search/components/TechDocsSearch.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { ResultHighlight } from '@backstage/plugin-search-common';\nimport {\n SearchAutocomplete,\n SearchContextProvider,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport { useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { TechDocsSearchResultListItem } from './TechDocsSearchResultListItem';\n\n/**\n * Props for {@link TechDocsSearch}\n *\n * @public\n */\nexport type TechDocsSearchProps = {\n entityId: CompoundEntityRef;\n entityTitle?: string;\n debounceTime?: number;\n searchResultUrlMapper?: (url: string) => string;\n};\n\ntype TechDocsDoc = {\n namespace: string;\n kind: string;\n name: string;\n path: string;\n location: string;\n title: string;\n};\n\ntype TechDocsSearchResult = {\n type: string;\n document: TechDocsDoc;\n highlight?: ResultHighlight;\n};\n\nconst isTechDocsSearchResult = (\n option: any,\n): option is TechDocsSearchResult => {\n return option?.document;\n};\n\nconst TechDocsSearchBar = (props: TechDocsSearchProps) => {\n const {\n entityId,\n entityTitle,\n debounceTime = 150,\n searchResultUrlMapper,\n } = props;\n const [open, setOpen] = useState(false);\n const navigate = useNavigate();\n const {\n setFilters,\n term,\n result: { loading, value: searchVal },\n } = useSearch();\n const [options, setOptions] = useState<any[]>([]);\n useEffect(() => {\n let mounted = true;\n\n if (mounted && searchVal) {\n // TODO: Change this into getting only subset of search results from the BE in the first place\n // once pagination is implemented for search engines\n // See: https://github.com/backstage/backstage/issues/6062\n const searchResults = searchVal.results.slice(0, 10);\n setOptions(searchResults);\n }\n return () => {\n mounted = false;\n };\n }, [loading, searchVal]);\n\n // Update the filter context when the entityId changes, e.g. when the search\n // bar continues to be rendered, navigating between different TechDocs sites.\n const { kind, name, namespace } = entityId;\n useEffect(() => {\n setFilters(prevFilters => {\n return {\n ...prevFilters,\n kind,\n namespace,\n name,\n };\n });\n }, [kind, namespace, name, setFilters]);\n\n const handleSelection = (\n _: any,\n selection: TechDocsSearchResult | string | null,\n ) => {\n if (isTechDocsSearchResult(selection)) {\n const { location } = selection.document;\n navigate(\n searchResultUrlMapper ? searchResultUrlMapper(location) : location,\n );\n }\n };\n\n return (\n <SearchAutocomplete\n data-testid=\"techdocs-search-bar\"\n size=\"small\"\n open={open && Boolean(term)}\n getOptionLabel={() => ''}\n filterOptions={x => {\n return x; // This is needed to get renderOption to be called after options change. Bug in material-ui?\n }}\n onClose={() => {\n setOpen(false);\n }}\n onOpen={() => {\n setOpen(true);\n }}\n onChange={handleSelection}\n blurOnSelect\n noOptionsText=\"No results found\"\n value={null}\n options={options}\n renderOption={({ document, highlight }) => (\n <TechDocsSearchResultListItem\n result={document}\n lineClamp={3}\n asListItem={false}\n asLink={false}\n title={document.title}\n highlight={highlight}\n />\n )}\n loading={loading}\n inputDebounceTime={debounceTime}\n inputPlaceholder={`Search ${entityTitle || entityId.name} docs`}\n freeSolo={false}\n />\n );\n};\n\n/**\n * Component used to render search bar on TechDocs page, scoped to\n *\n * @public\n */\nexport const TechDocsSearch = (props: TechDocsSearchProps) => {\n const initialState = {\n term: '',\n types: ['techdocs'],\n pageCursor: '',\n filters: props.entityId,\n };\n return (\n <SearchContextProvider initialState={initialState}>\n <TechDocsSearchBar {...props} />\n </SearchContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsDA,MAAM,sBAAA,GAAyB,CAC7B,MACmC,KAAA;AACnC,EAAA,OAAO,MAAQ,EAAA,QAAA;AACjB,CAAA;AAEA,MAAM,iBAAA,GAAoB,CAAC,KAA+B,KAAA;AACxD,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAe,GAAA,GAAA;AAAA,IACf;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAQ,EAAA,EAAE,OAAS,EAAA,KAAA,EAAO,SAAU;AAAA,MAClC,SAAU,EAAA;AACd,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAAgB,EAAE,CAAA;AAChD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAU,GAAA,IAAA;AAEd,IAAA,IAAI,WAAW,SAAW,EAAA;AAIxB,MAAA,MAAM,aAAgB,GAAA,SAAA,CAAU,OAAQ,CAAA,KAAA,CAAM,GAAG,EAAE,CAAA;AACnD,MAAA,UAAA,CAAW,aAAa,CAAA;AAAA;AAE1B,IAAA,OAAO,MAAM;AACX,MAAU,OAAA,GAAA,KAAA;AAAA,KACZ;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,SAAS,CAAC,CAAA;AAIvB,EAAA,MAAM,EAAE,IAAA,EAAM,IAAM,EAAA,SAAA,EAAc,GAAA,QAAA;AAClC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,UAAA,CAA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