@backstage/plugin-techdocs-module-addons-contrib 1.1.17-next.0 → 1.1.17-next.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @backstage/plugin-techdocs-module-addons-contrib
2
2
 
3
+ ## 1.1.17-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.16.0-next.2
9
+ - @backstage/core-plugin-api@1.10.0
10
+ - @backstage/integration@1.15.1
11
+ - @backstage/integration-react@1.2.0
12
+ - @backstage/plugin-techdocs-react@1.2.10-next.2
13
+
14
+ ## 1.1.17-next.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+ - @backstage/core-components@0.16.0-next.1
20
+ - @backstage/core-plugin-api@1.10.0
21
+ - @backstage/integration@1.15.1
22
+ - @backstage/integration-react@1.2.0
23
+ - @backstage/plugin-techdocs-react@1.2.10-next.1
24
+
3
25
  ## 1.1.17-next.0
4
26
 
5
27
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableNavigation.esm.js","sources":["../../src/ExpandableNavigation/ExpandableNavigation.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 React, { useEffect, useCallback, useState } from 'react';\nimport { useLocalStorageValue } from '@react-hookz/web';\nimport { Button, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst NESTED_LIST_TOGGLE = '.md-nav__item--nested .md-toggle';\n\nconst EXPANDABLE_NAVIGATION_LOCAL_STORAGE =\n '@backstage/techdocs-addons/nav-expanded';\n\nconst StyledButton = withStyles({\n root: {\n position: 'absolute',\n left: '13.7rem', // Sidebar inner width (15.1em) minus the different margins/paddings\n top: '19px',\n zIndex: 2,\n padding: 0,\n minWidth: 0,\n },\n})(Button);\n\nconst CollapsedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ChevronRightIcon);\n\nconst ExpandedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ExpandMoreIcon);\n\ntype expandableNavigationLocalStorage = {\n expandAllNestedNavs: boolean;\n};\n\n/**\n * Show expand/collapse navigation button next to site name in main\n * navigation menu if documentation site has nested navigation.\n */\nexport const ExpandableNavigationAddon = () => {\n const defaultValue = { expandAllNestedNavs: false };\n const { value: expanded, set: setExpanded } =\n useLocalStorageValue<expandableNavigationLocalStorage>(\n EXPANDABLE_NAVIGATION_LOCAL_STORAGE,\n { defaultValue },\n );\n const [hasNavSubLevels, setHasNavSubLevels] = useState<boolean>(false);\n\n const [...checkboxToggles] = useShadowRootElements<HTMLInputElement>([\n NESTED_LIST_TOGGLE,\n ]);\n\n const shouldToggle = useCallback(\n (item: HTMLInputElement) => {\n const isExpanded = item.checked;\n const shouldExpand = expanded?.expandAllNestedNavs;\n\n // Is collapsed but should expand\n if (shouldExpand && !isExpanded) {\n return true;\n }\n\n // Is expanded but should collapse\n if (!shouldExpand && isExpanded) {\n return true;\n }\n\n return false;\n },\n [expanded],\n );\n\n useEffect(() => {\n // There is no nested navs\n if (!checkboxToggles?.length) return;\n\n setHasNavSubLevels(true);\n checkboxToggles.forEach(item => {\n if (shouldToggle(item)) item.click();\n });\n }, [expanded, shouldToggle, checkboxToggles]);\n\n const handleState = () => {\n setExpanded(prevState => ({\n expandAllNestedNavs: !prevState?.expandAllNestedNavs,\n }));\n };\n\n return (\n <>\n {hasNavSubLevels ? (\n <StyledButton\n size=\"small\"\n onClick={handleState}\n aria-label={\n expanded?.expandAllNestedNavs ? 'collapse-nav' : 'expand-nav'\n }\n >\n {expanded?.expandAllNestedNavs ? <ExpandedIcon /> : <CollapsedIcon />}\n </StyledButton>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,kBAAqB,GAAA,kCAAA,CAAA;AAE3B,MAAM,mCACJ,GAAA,yCAAA,CAAA;AAEF,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,SAAA;AAAA;AAAA,IACN,GAAK,EAAA,MAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,OAAS,EAAA,CAAA;AAAA,IACT,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAC,EAAE,MAAM,CAAA,CAAA;AAET,MAAM,gBAAgB,UAAW,CAAA;AAAA,EAC/B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,EAAE,gBAAgB,CAAA,CAAA;AAEnB,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,EAAE,cAAc,CAAA,CAAA;AAUV,MAAM,4BAA4B,MAAM;AAC7C,EAAM,MAAA,YAAA,GAAe,EAAE,mBAAA,EAAqB,KAAM,EAAA,CAAA;AAClD,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,GAAA,EAAK,aAC5B,GAAA,oBAAA;AAAA,IACE,mCAAA;AAAA,IACA,EAAE,YAAa,EAAA;AAAA,GACjB,CAAA;AACF,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAErE,EAAA,MAAM,C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AiB,GAAA,YAAA;AAAA,KAAA;AAAA,IAGlD,UAAU,mBAAsB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,uCAAM,aAAc,EAAA,IAAA,CAAA;AAAA,MAEnE,IACN,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ExpandableNavigation.esm.js","sources":["../../src/ExpandableNavigation/ExpandableNavigation.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 React, { useEffect, useCallback, useState } from 'react';\nimport { useLocalStorageValue } from '@react-hookz/web';\nimport { Button, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst NESTED_LIST_TOGGLE = '.md-nav__item--nested .md-toggle';\n\nconst EXPANDABLE_NAVIGATION_LOCAL_STORAGE =\n '@backstage/techdocs-addons/nav-expanded';\n\nconst StyledButton = withStyles({\n root: {\n position: 'absolute',\n left: '13.7rem', // Sidebar inner width (15.1em) minus the different margins/paddings\n top: '19px',\n zIndex: 2,\n padding: 0,\n minWidth: 0,\n },\n})(Button);\n\nconst CollapsedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ChevronRightIcon);\n\nconst ExpandedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ExpandMoreIcon);\n\ntype expandableNavigationLocalStorage = {\n expandAllNestedNavs: boolean;\n};\n\n/**\n * Show expand/collapse navigation button next to site name in main\n * navigation menu if documentation site has nested navigation.\n */\nexport const ExpandableNavigationAddon = () => {\n const defaultValue = { expandAllNestedNavs: false };\n const { value: expanded, set: setExpanded } =\n useLocalStorageValue<expandableNavigationLocalStorage>(\n EXPANDABLE_NAVIGATION_LOCAL_STORAGE,\n { defaultValue },\n );\n const [hasNavSubLevels, setHasNavSubLevels] = useState<boolean>(false);\n\n const [...checkboxToggles] = useShadowRootElements<HTMLInputElement>([\n NESTED_LIST_TOGGLE,\n ]);\n\n const shouldToggle = useCallback(\n (item: HTMLInputElement) => {\n const isExpanded = item.checked;\n const shouldExpand = expanded?.expandAllNestedNavs;\n\n // Is collapsed but should expand\n if (shouldExpand && !isExpanded) {\n return true;\n }\n\n // Is expanded but should collapse\n if (!shouldExpand && isExpanded) {\n return true;\n }\n\n return false;\n },\n [expanded],\n );\n\n useEffect(() => {\n // There is no nested navs\n if (!checkboxToggles?.length) return;\n\n setHasNavSubLevels(true);\n checkboxToggles.forEach(item => {\n if (shouldToggle(item)) item.click();\n });\n }, [expanded, shouldToggle, checkboxToggles]);\n\n const handleState = () => {\n setExpanded(prevState => ({\n expandAllNestedNavs: !prevState?.expandAllNestedNavs,\n }));\n };\n\n return (\n <>\n {hasNavSubLevels ? (\n <StyledButton\n size=\"small\"\n onClick={handleState}\n aria-label={\n expanded?.expandAllNestedNavs ? 'collapse-nav' : 'expand-nav'\n }\n >\n {expanded?.expandAllNestedNavs ? <ExpandedIcon /> : <CollapsedIcon />}\n </StyledButton>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,kBAAqB,GAAA,kCAAA;AAE3B,MAAM,mCACJ,GAAA,yCAAA;AAEF,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,SAAA;AAAA;AAAA,IACN,GAAK,EAAA,MAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IAC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AA,kBAAA,CAAmB,IAAI,CAAA;AACvB,IAAA,eAAA,CAAgB,QAAQ,CAAQ,IAAA,KAAA;AAC9B,MAAA,IAAI,YAAa,CAAA,IAAI,CAAG,EAAA,IAAA,CAAK,KAAM,EAAA;AAAA,KACpC,CAAA;AAAA,GACA,EAAA,CAAC,QAAU,EAAA,YAAA,EAAc,eAAe,CAAC,CAAA;AAE5C,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,WAAA,CAAY,CAAc,SAAA,MAAA;AAAA,MACxB,mBAAA,EAAqB,CAAC,SAAW,EAAA;AAAA,KACjC,CAAA,CAAA;AAAA,GACJ;AAEA,EAAA,iEAEK,eACC,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,WAAA;AAAA,MACT,YAAA,EACE,QAAU,EAAA,mBAAA,GAAsB,cAAiB,GAAA;AAAA,KAAA;AAAA,IAGlD,UAAU,mBAAsB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,uCAAM,aAAc,EAAA,IAAA;AAAA,MAEnE,IACN,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightBox.esm.js","sources":["../../src/LigthBox/LightBox.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 { useEffect } from 'react';\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n// @ts-ignore\nimport PhotoSwipeLightbox, { DataSource, ZoomLevel } from 'photoswipe/lightbox';\nimport PhotoSwipe from 'photoswipe';\nimport 'photoswipe/style.css';\nimport './lightbox.css';\n\nexport const LightBoxAddon = () => {\n const images = useShadowRootElements<HTMLImageElement>(['img']);\n\n useEffect(() => {\n let dataSourceImages: DataSource | null = null;\n\n let lightbox = new PhotoSwipeLightbox({\n pswpModule: PhotoSwipe,\n initialZoomLevel: 1,\n secondaryZoomLevel: (zoomLevelObject: ZoomLevel) => {\n // photoswipe/lightbox won't zoom the image further then the given width and height.\n // therefore we need to calculate the zoom factor needed to fit the complete image in the viewport manually.\n const imageWidth = zoomLevelObject.elementSize.x;\n const imageHeight = zoomLevelObject.elementSize.y;\n const viewportWidth = zoomLevelObject.panAreaSize.x;\n const viewportHeight = zoomLevelObject.panAreaSize.y;\n\n const widthScale = viewportWidth / imageWidth;\n const heightScale = viewportHeight / imageHeight;\n\n const scaleFactor = Math.min(widthScale, heightScale);\n return scaleFactor;\n },\n wheelToZoom: true,\n arrowPrevSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ArrowBackIosIcon\" aria-label=\"fontSize large\"><path d=\"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z\"></path></svg>',\n arrowNextSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ArrowForwardIosIcon\" aria-label=\"fontSize large\"><path d=\"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z\"></path></svg>',\n closeSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"CloseIcon\" aria-label=\"fontSize large\"><path d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path></svg>',\n zoomSVG: `<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ZoomIcon\" aria-label=\"fontSize large\">\n <path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"></path><path d=\"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z\" id=\"photoswipe-zoom-icon-zoomin-path\"></path><path d=\"M12 10H 7 V 9 H 12 Z\" id=\"photoswipe-zoom-icon-zoomout-path\">\n </svg>`,\n });\n\n images.forEach((image, index) => {\n image.onclick = () => {\n if (dataSourceImages === null) {\n dataSourceImages = images.map(dataSourceImage => {\n return {\n element: dataSourceImage,\n src: dataSourceImage.src,\n msrc: dataSourceImage.src,\n alt: dataSourceImage.alt,\n width: dataSourceImage.clientWidth,\n height: dataSourceImage.clientHeight,\n };\n });\n }\n lightbox.loadAndOpen(index, dataSourceImages);\n return false;\n };\n });\n lightbox.init();\n\n return () => {\n lightbox.destroy();\n lightbox = null;\n };\n }, [images]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,MAAS,GAAA,qBAAA,CAAwC,CAAC,KAAK,CAAC,CAAA,CAAA;AAE9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,gBAAsC,GAAA,IAAA,CAAA;AAE1C,IAAI,IAAA,QAAA,GAAW,IAAI,kBAAmB,CAAA;AAAA,MACpC,UAAY,EAAA,UAAA;AAAA,MACZ,gBAAkB,EAAA,CAA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CAAA,WAAA,CAAY,OAAO,gBAAgB,CAAA,CAAA;AAC5C,QAAO,OAAA,KAAA,CAAA;AAAA,OACT,CAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,QAAA,CAAS,IAAK,EAAA,CAAA;AAEd,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,OAAQ,EAAA,CAAA;AACjB,MAAW,QAAA,GAAA,IAAA,CAAA;AAAA,KACb,CAAA;AAAA,GACF,EAAG,CAAC,MAAM,CAAC,CAAA,CAAA;AAEX,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"LightBox.esm.js","sources":["../../src/LigthBox/LightBox.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 { useEffect } from 'react';\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n// @ts-ignore\nimport PhotoSwipeLightbox, { DataSource, ZoomLevel } from 'photoswipe/lightbox';\nimport PhotoSwipe from 'photoswipe';\nimport 'photoswipe/style.css';\nimport './lightbox.css';\n\nexport const LightBoxAddon = () => {\n const images = useShadowRootElements<HTMLImageElement>(['img']);\n\n useEffect(() => {\n let dataSourceImages: DataSource | null = null;\n\n let lightbox = new PhotoSwipeLightbox({\n pswpModule: PhotoSwipe,\n initialZoomLevel: 1,\n secondaryZoomLevel: (zoomLevelObject: ZoomLevel) => {\n // photoswipe/lightbox won't zoom the image further then the given width and height.\n // therefore we need to calculate the zoom factor needed to fit the complete image in the viewport manually.\n const imageWidth = zoomLevelObject.elementSize.x;\n const imageHeight = zoomLevelObject.elementSize.y;\n const viewportWidth = zoomLevelObject.panAreaSize.x;\n const viewportHeight = zoomLevelObject.panAreaSize.y;\n\n const widthScale = viewportWidth / imageWidth;\n const heightScale = viewportHeight / imageHeight;\n\n const scaleFactor = Math.min(widthScale, heightScale);\n return scaleFactor;\n },\n wheelToZoom: true,\n arrowPrevSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ArrowBackIosIcon\" aria-label=\"fontSize large\"><path d=\"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z\"></path></svg>',\n arrowNextSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ArrowForwardIosIcon\" aria-label=\"fontSize large\"><path d=\"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z\"></path></svg>',\n closeSVG:\n '<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"CloseIcon\" aria-label=\"fontSize large\"><path d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path></svg>',\n zoomSVG: `<svg class=\"MuiSvgIcon-root MuiSvgIcon-fontSizeLarge css-c1sh5i\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-testid=\"ZoomIcon\" aria-label=\"fontSize large\">\n <path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"></path><path d=\"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z\" id=\"photoswipe-zoom-icon-zoomin-path\"></path><path d=\"M12 10H 7 V 9 H 12 Z\" id=\"photoswipe-zoom-icon-zoomout-path\">\n </svg>`,\n });\n\n images.forEach((image, index) => {\n image.onclick = () => {\n if (dataSourceImages === null) {\n dataSourceImages = images.map(dataSourceImage => {\n return {\n element: dataSourceImage,\n src: dataSourceImage.src,\n msrc: dataSourceImage.src,\n alt: dataSourceImage.alt,\n width: dataSourceImage.clientWidth,\n height: dataSourceImage.clientHeight,\n };\n });\n }\n lightbox.loadAndOpen(index, dataSourceImages);\n return false;\n };\n });\n lightbox.init();\n\n return () => {\n lightbox.destroy();\n lightbox = null;\n };\n }, [images]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,MAAS,GAAA,qBAAA,CAAwC,CAAC,KAAK,CAAC,CAAA;AAE9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,gBAAsC,GAAA,IAAA;AAE1C,IAAI,IAAA,QAAA,GAAW,IAAI,kBAAmB,CAAA;AAAA,MACpC,UAAY,EAAA,UAAA;AAAA,MACZ,gBAAkB,EAAA,CAAA;AAAA,MAClB,kBAAA,EAAoB,CAAC,eAA+B,KAAA;AAGlD,QAAM,MAAA,UAAA,GAAa,gBAAgB,WAAY,CAAA,CAAA;AAC/C,QAAM,MAAA,WAAA,GAAc,gBAAgB,WAAY,CAAA,CAAA;AAChD,QAAM,MAAA,aAAA,GAAgB,gBAAgB,WAAY,CAAA,CAAA;AAClD,QAAM,MAAA,cAAA,GAAiB,gBAAgB,WAAY,CAAA,CAAA;AAEnD,QAAA,MAAM,aAAa,aAAgB,GAAA,UAAA;AACnC,QAAA,MAAM,cAAc,cAAiB,GAAA,WAAA;AAErC,QAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,UAAA,EAAY,WAAW,CAAA;AACpD,QAAO,OAAA,WAAA;AAAA,OACT;AAAA,MACA,WAAa,EAAA,IAAA;AAAA,MACb,YACE,EAAA,mQAAA;AAAA,MACF,YACE,EAAA,iQAAA;AAAA,MACF,QACE,EAAA,8SAAA;AAAA,MACF,OAAS,EAAA,CAAA;AAAA;AAAA,cAAA;AAAA,KAGV,CAAA;AAED,IAAO,MAAA,CAAA,OAAA,CAAQ,CAAC,KAAA,EAAO,KAAU,KAAA;AAC/B,MAAA,KAAA,CAAM,UAAU,MAAM;AACpB,QAAA,IAAI,qBAAqB,IAAM,EAAA;AAC7B,UAAmB,gBAAA,GAAA,MAAA,CAAO,IAAI,CAAmB,eAAA,KAAA;AAC/C,YAAO,OAAA;AAAA,cACL,OAAS,EAAA,eAAA;AAAA,cACT,KAAK,eAAgB,CAAA,GAAA;AAAA,cACrB,MAAM,eAAgB,CAAA,GAAA;AAAA,cACtB,KAAK,eAAgB,CAAA,GAAA;AAAA,cACrB,OAAO,eAAgB,CAAA,WAAA;AAAA,cACvB,QAAQ,eAAgB,CAAA;AAAA,aAC1B;AAAA,WACD,CAAA;AAAA;AAEH,QAAS,QAAA,CAAA,WAAA,CAAY,OAAO,gBAAgB,CAAA;AAC5C,QAAO,OAAA,KAAA;AAAA,OACT;AAAA,KACD,CAAA;AACD,IAAA,QAAA,CAAS,IAAK,EAAA;AAEd,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,OAAQ,EAAA;AACjB,MAAW,QAAA,GAAA,IAAA;AAAA,KACb;AAAA,GACF,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IssueLink.esm.js","sources":["../../src/ReportIssue/IssueLink.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 React from 'react';\n\nimport { makeStyles } from '@material-ui/core';\nimport BugReportIcon from '@material-ui/icons/BugReport';\n\nimport { Link, GitHubIcon } from '@backstage/core-components';\n\nimport { ReportIssueTemplate, Repository } from './types';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'grid',\n gridGap: theme.spacing(1),\n gridAutoFlow: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n color: theme.palette.common.black,\n fontSize: theme.typography.button.fontSize,\n },\n}));\n\ntype IssueLinkProps = {\n template: ReportIssueTemplate;\n repository: Repository;\n};\n\nconst getIcon = ({ type }: Repository) => {\n if (type === 'github') {\n return GitHubIcon;\n }\n return BugReportIcon;\n};\n\nconst getName = ({ type }: Repository) => {\n if (type === 'github') {\n return 'Github';\n }\n return 'Gitlab';\n};\n\nconst getUrl = (repository: Repository, template: ReportIssueTemplate) => {\n const { title, body } = template;\n const encodedTitle = encodeURIComponent(title);\n const encodedBody = encodeURIComponent(body);\n const { protocol, resource, owner, name, type } = repository;\n\n const url = `${protocol}://${resource}/${owner}/${name}`;\n const encodedUrl = encodeURI(url);\n if (type === 'github') {\n return `${encodedUrl}/issues/new?title=${encodedTitle}&body=${encodedBody}`;\n }\n return `${encodedUrl}/issues/new?issue[title]=${encodedTitle}&issue[description]=${encodedBody}`;\n};\n\nexport const IssueLink = ({ template, repository }: IssueLinkProps) => {\n const classes = useStyles();\n\n const Icon = getIcon(repository);\n const url = getUrl(repository, template);\n\n return (\n <Link className={classes.root} to={url} target=\"_blank\">\n <Icon /> Open new {getName(repository)} issue\n </Link>\n );\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAA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CAAA,CAAA;AAChC,EAAA,IAAI,SAAS,QAAU,EAAA;AACrB,IAAA,OAAO,CAAG,EAAA,UAAU,CAAqB,kBAAA,EAAA,YAAY,SAAS,WAAW,CAAA,CAAA,CAAA;AAAA,GAC3E;AACA,EAAA,OAAO,CAAG,EAAA,UAAU,CAA4B,yBAAA,EAAA,YAAY,uBAAuB,WAAW,CAAA,CAAA,CAAA;AAChG,CAAA,CAAA;AAEO,MAAM,SAAY,GAAA,CAAC,EAAE,QAAA,EAAU,YAAiC,KAAA;AACrE,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAM,MAAA,IAAA,GAAO,QAAQ,UAAU,CAAA,CAAA;AAC/B,EAAM,MAAA,GAAA,GAAM,MAAO,CAAA,UAAA,EAAY,QAAQ,CAAA,CAAA;AAEvC,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAM,IAAI,GAAK,EAAA,MAAA,EAAO,QAC7C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAK,CAAE,EAAA,YAAA,EAAW,OAAQ,CAAA,UAAU,GAAE,QACzC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"IssueLink.esm.js","sources":["../../src/ReportIssue/IssueLink.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 React from 'react';\n\nimport { makeStyles } from '@material-ui/core';\nimport BugReportIcon from '@material-ui/icons/BugReport';\n\nimport { Link, GitHubIcon } from '@backstage/core-components';\n\nimport { ReportIssueTemplate, Repository } from './types';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'grid',\n gridGap: theme.spacing(1),\n gridAutoFlow: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n color: theme.palette.common.black,\n fontSize: theme.typography.button.fontSize,\n },\n}));\n\ntype IssueLinkProps = {\n template: ReportIssueTemplate;\n repository: Repository;\n};\n\nconst getIcon = ({ type }: Repository) => {\n if (type === 'github') {\n return GitHubIcon;\n }\n return BugReportIcon;\n};\n\nconst getName = ({ type }: Repository) => {\n if (type === 'github') {\n return 'Github';\n }\n return 'Gitlab';\n};\n\nconst getUrl = (repository: Repository, template: ReportIssueTemplate) => {\n const { title, body } = template;\n const encodedTitle = encodeURIComponent(title);\n const encodedBody = encodeURIComponent(body);\n const { protocol, resource, owner, name, type } = repository;\n\n const url = `${protocol}://${resource}/${owner}/${name}`;\n const encodedUrl = encodeURI(url);\n if (type === 'github') {\n return `${encodedUrl}/issues/new?title=${encodedTitle}&body=${encodedBody}`;\n }\n return `${encodedUrl}/issues/new?issue[title]=${encodedTitle}&issue[description]=${encodedBody}`;\n};\n\nexport const IssueLink = ({ template, repository }: IssueLinkProps) => {\n const classes = useStyles();\n\n const Icon = getIcon(repository);\n const url = getUrl(repository, template);\n\n return (\n <Link className={classes.root} to={url} target=\"_blank\">\n <Icon /> Open new {getName(repository)} issue\n </Link>\n );\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,IACT,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,YAAc,EAAA,QAAA;AAAA,IACd,cAAgB,EAAA,QAAA;AAAA,IAChB,UAAY,EAAA,QAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,MA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AAM,MAAO,CAAA,UAAA,EAAY,QAAQ,CAAA;AAEvC,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAM,IAAI,GAAK,EAAA,MAAA,EAAO,QAC7C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAK,CAAE,EAAA,YAAA,EAAW,OAAQ,CAAA,UAAU,GAAE,QACzC,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportIssue.esm.js","sources":["../../src/ReportIssue/ReportIssue.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 React, { useState, useEffect } from 'react';\n\nimport { makeStyles, Portal, Paper } from '@material-ui/core';\n\nimport { useGitTemplate, useGitRepository } from './hooks';\nimport { ReportIssueTemplateBuilder } from './types';\nimport {\n PAGE_MAIN_CONTENT_SELECTOR,\n PAGE_FEEDBACK_LINK_SELECTOR,\n ADDON_FEEDBACK_CONTAINER_ID,\n ADDON_FEEDBACK_CONTAINER_SELECTOR,\n} from './constants';\nimport { IssueLink } from './IssueLink';\n\nimport {\n useShadowRootElements,\n useShadowRootSelection,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n transform: 'translate(-100%, -100%)',\n position: 'absolute',\n padding: theme.spacing(1),\n zIndex: theme.zIndex.tooltip,\n background: theme.palette.common.white,\n },\n}));\n\ntype Style = {\n top: string;\n left: string;\n};\n\n/**\n * Props customizing the <ReportIssue /> Addon.\n *\n * @public\n */\nexport type ReportIssueProps = {\n /**\n * Number of milliseconds after a user highlights some text before the report\n * issue link appears above the highlighted text. Defaults to 500ms.\n */\n debounceTime?: number;\n\n /**\n * An optional function defining how a custom issue title and body should be\n * constructed, given some selected text.\n */\n templateBuilder?: ReportIssueTemplateBuilder;\n};\n\n/**\n * Show report issue button when text is highlighted\n */\nexport const ReportIssueAddon = ({\n debounceTime = 500,\n templateBuilder: buildTemplate,\n}: ReportIssueProps) => {\n const classes = useStyles();\n const [style, setStyle] = useState<Style>();\n\n const repository = useGitRepository();\n\n const defaultTemplate = useGitTemplate(debounceTime);\n\n const selection = useShadowRootSelection(debounceTime);\n\n const [mainContent, feedbackLink] = useShadowRootElements([\n PAGE_MAIN_CONTENT_SELECTOR,\n PAGE_FEEDBACK_LINK_SELECTOR,\n ]);\n\n let [feedbackContainer] = useShadowRootElements([\n ADDON_FEEDBACK_CONTAINER_SELECTOR,\n ]);\n\n if (feedbackLink) {\n feedbackLink.style.display = 'none';\n }\n\n // calculates the position of the selected text to be able to set the position of the addon\n useEffect(() => {\n if (\n // todo(backstage/techdocs-core) handle non-repo rendering\n !repository ||\n !selection ||\n !selection.containsNode(mainContent!, true) ||\n selection?.containsNode(feedbackContainer!, true)\n ) {\n return;\n }\n\n const mainContentPosition = mainContent!.getBoundingClientRect();\n const selectionPosition = selection.getRangeAt(0).getBoundingClientRect();\n\n // Calculating the distance between the selection's top and the main content's top\n const distanceFromTop = selectionPosition.top - mainContentPosition.top;\n const minDistanceFromTop = 50;\n\n // Defining a base value for 'top'\n let top = distanceFromTop < minDistanceFromTop ? 101 : distanceFromTop - 16;\n\n // Checking if the main content is off-screen towards the top\n if (mainContentPosition.top < 0) {\n const absMainContentTop = Math.abs(mainContentPosition.top);\n\n // Adjusting 'top' if the selection is close to the top edge and the main content is off-screen\n if (distanceFromTop - absMainContentTop < minDistanceFromTop) {\n top += 89;\n }\n }\n\n setStyle({\n top: `${top}px`,\n left: `${selectionPosition.left + selectionPosition.width / 2}px`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selection, mainContent, feedbackContainer]);\n\n if (\n !selection ||\n !repository ||\n !['github', 'gitlab'].includes(repository.type)\n )\n return null;\n\n if (!feedbackContainer) {\n feedbackContainer = document.createElement('div');\n feedbackContainer.setAttribute('id', ADDON_FEEDBACK_CONTAINER_ID);\n mainContent!.prepend(feedbackContainer);\n }\n\n return (\n <Portal container={feedbackContainer}>\n <Paper\n data-testid=\"report-issue-addon\"\n className={classes.root}\n style={style}\n >\n <IssueLink\n repository={repository}\n template={\n buildTemplate ? buildTemplate({ selection }) : defaultTemplate\n }\n />\n </Paper>\n </Portal>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,yBAAA;AAAA,IACX,QAAU,EAAA,UAAA;AAAA,IACV,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,MAAA,EAAQ,MAAM,MAAO,CAAA,OAAA;AAAA,IACrB,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,GACnC;AACF,CAAE,CAAA,CAAA,CAAA;AA6BK,MAAM,mBAAmB,CAAC;AAAA,EAC/B,YAAe,GAAA,GAAA;AAAA,EACf,eAAiB,EAAA,aAAA;AACnB,CAAwB,KAAA;AACtB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAgB,EAAA,CAAA;AAE1C,EAAA,MAAM,aAAa,gBAAiB,EAAA,CAAA;AAEpC,EAAM,MAAA,eAAA,GAAkB,eAAe,YAAY,CAAA,CAAA;AAEnD,EAAM,MAAA,SAAA,GAAY,uBAAuB,YAAY,CAAA,CAAA;AAErD,EAAA,MAAM,CAAC,WAAA,EAAa,YAAY,CAAA,GAAI,qBAAsB,CAAA;AAAA,IACxD,0BAA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AAO,GAAA,iBAAA,CAAkB,QAAQ,CAAC,CAAA,EAAA,CAAA;AAAA,KAC9D,CAAA,CAAA;AAAA,GAEA,EAAA,CAAC,SAAW,EAAA,WAAA,EAAa,iBAAiB,CAAC,CAAA,CAAA;AAE9C,EACE,IAAA,CAAC,SACD,IAAA,CAAC,UACD,IAAA,CAAC,CAAC,QAAA,EAAU,QAAQ,CAAA,CAAE,QAAS,CAAA,UAAA,CAAW,IAAI,CAAA;AAE9C,IAAO,OAAA,IAAA,CAAA;AAET,EAAA,IAAI,CAAC,iBAAmB,EAAA;AACtB,IAAoB,iBAAA,GAAA,QAAA,CAAS,cAAc,KAAK,CAAA,CAAA;AAChD,IAAkB,iBAAA,CAAA,YAAA,CAAa,MAAM,2BAA2B,CAAA,CAAA;AAChE,IAAA,WAAA,CAAa,QAAQ,iBAAiB,CAAA,CAAA;AAAA,GACxC;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,SAAA,EAAW,iBACjB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,oBAAA;AAAA,MACZ,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB,KAAA;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,UAAA;AAAA,QACA,UACE,aAAgB,GAAA,aAAA,CAAc,EAAE,SAAA,EAAW,CAAI,GAAA,eAAA;AAAA,OAAA;AAAA,KAEnD;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportIssue.esm.js","sources":["../../src/ReportIssue/ReportIssue.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 React, { useState, useEffect } from 'react';\n\nimport { makeStyles, Portal, Paper } from '@material-ui/core';\n\nimport { useGitTemplate, useGitRepository } from './hooks';\nimport { ReportIssueTemplateBuilder } from './types';\nimport {\n PAGE_MAIN_CONTENT_SELECTOR,\n PAGE_FEEDBACK_LINK_SELECTOR,\n ADDON_FEEDBACK_CONTAINER_ID,\n ADDON_FEEDBACK_CONTAINER_SELECTOR,\n} from './constants';\nimport { IssueLink } from './IssueLink';\n\nimport {\n useShadowRootElements,\n useShadowRootSelection,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n transform: 'translate(-100%, -100%)',\n position: 'absolute',\n padding: theme.spacing(1),\n zIndex: theme.zIndex.tooltip,\n background: theme.palette.common.white,\n },\n}));\n\ntype Style = {\n top: string;\n left: string;\n};\n\n/**\n * Props customizing the <ReportIssue /> Addon.\n *\n * @public\n */\nexport type ReportIssueProps = {\n /**\n * Number of milliseconds after a user highlights some text before the report\n * issue link appears above the highlighted text. Defaults to 500ms.\n */\n debounceTime?: number;\n\n /**\n * An optional function defining how a custom issue title and body should be\n * constructed, given some selected text.\n */\n templateBuilder?: ReportIssueTemplateBuilder;\n};\n\n/**\n * Show report issue button when text is highlighted\n */\nexport const ReportIssueAddon = ({\n debounceTime = 500,\n templateBuilder: buildTemplate,\n}: ReportIssueProps) => {\n const classes = useStyles();\n const [style, setStyle] = useState<Style>();\n\n const repository = useGitRepository();\n\n const defaultTemplate = useGitTemplate(debounceTime);\n\n const selection = useShadowRootSelection(debounceTime);\n\n const [mainContent, feedbackLink] = useShadowRootElements([\n PAGE_MAIN_CONTENT_SELECTOR,\n PAGE_FEEDBACK_LINK_SELECTOR,\n ]);\n\n let [feedbackContainer] = useShadowRootElements([\n ADDON_FEEDBACK_CONTAINER_SELECTOR,\n ]);\n\n if (feedbackLink) {\n feedbackLink.style.display = 'none';\n }\n\n // calculates the position of the selected text to be able to set the position of the addon\n useEffect(() => {\n if (\n // todo(backstage/techdocs-core) handle non-repo rendering\n !repository ||\n !selection ||\n !selection.containsNode(mainContent!, true) ||\n selection?.containsNode(feedbackContainer!, true)\n ) {\n return;\n }\n\n const mainContentPosition = mainContent!.getBoundingClientRect();\n const selectionPosition = selection.getRangeAt(0).getBoundingClientRect();\n\n // Calculating the distance between the selection's top and the main content's top\n const distanceFromTop = selectionPosition.top - mainContentPosition.top;\n const minDistanceFromTop = 50;\n\n // Defining a base value for 'top'\n let top = distanceFromTop < minDistanceFromTop ? 101 : distanceFromTop - 16;\n\n // Checking if the main content is off-screen towards the top\n if (mainContentPosition.top < 0) {\n const absMainContentTop = Math.abs(mainContentPosition.top);\n\n // Adjusting 'top' if the selection is close to the top edge and the main content is off-screen\n if (distanceFromTop - absMainContentTop < minDistanceFromTop) {\n top += 89;\n }\n }\n\n setStyle({\n top: `${top}px`,\n left: `${selectionPosition.left + selectionPosition.width / 2}px`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selection, mainContent, feedbackContainer]);\n\n if (\n !selection ||\n !repository ||\n !['github', 'gitlab'].includes(repository.type)\n )\n return null;\n\n if (!feedbackContainer) {\n feedbackContainer = document.createElement('div');\n feedbackContainer.setAttribute('id', ADDON_FEEDBACK_CONTAINER_ID);\n mainContent!.prepend(feedbackContainer);\n }\n\n return (\n <Portal container={feedbackContainer}>\n <Paper\n data-testid=\"report-issue-addon\"\n className={classes.root}\n style={style}\n >\n <IssueLink\n repository={repository}\n template={\n buildTemplate ? buildTemplate({ selection }) : defaultTemplate\n }\n />\n </Paper>\n </Portal>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,yBAAA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AA,MACZ,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB;AAAA,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,UAAA;AAAA,QACA,UACE,aAAgB,GAAA,aAAA,CAAc,EAAE,SAAA,EAAW,CAAI,GAAA;AAAA;AAAA;AAEnD,GAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.esm.js","sources":["../../src/ReportIssue/constants.ts"],"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\nexport const ADDON_FEEDBACK_CONTAINER_ID = 'techdocs-report-issue';\nexport const ADDON_FEEDBACK_CONTAINER_SELECTOR = `#${ADDON_FEEDBACK_CONTAINER_ID}`;\nexport const PAGE_EDIT_LINK_SELECTOR = '[title^=\"Edit this page\"]';\nexport const PAGE_FEEDBACK_LINK_SELECTOR = '[title^=\"Leave feedback for\"]';\nexport const PAGE_MAIN_CONTENT_SELECTOR =\n '[data-md-component=\"main\"] .md-content';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAA8B,GAAA,wBAAA;AAC9B,MAAA,iCAAA,GAAoC,IAAI,2BAA2B,CAAA,EAAA;AACzE,MAAM,uBAA0B,GAAA,4BAAA;AAChC,MAAM,2BAA8B,GAAA,gCAAA;AACpC,MAAM,0BACX,GAAA;;;;"}
1
+ {"version":3,"file":"constants.esm.js","sources":["../../src/ReportIssue/constants.ts"],"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\nexport const ADDON_FEEDBACK_CONTAINER_ID = 'techdocs-report-issue';\nexport const ADDON_FEEDBACK_CONTAINER_SELECTOR = `#${ADDON_FEEDBACK_CONTAINER_ID}`;\nexport const PAGE_EDIT_LINK_SELECTOR = '[title^=\"Edit this page\"]';\nexport const PAGE_FEEDBACK_LINK_SELECTOR = '[title^=\"Leave feedback for\"]';\nexport const PAGE_MAIN_CONTENT_SELECTOR =\n '[data-md-component=\"main\"] .md-content';\n"],"names":[],"mappings":"AAgBO,MAAM,2BAA8B,GAAA;AAC9B,MAAA,iCAAA,GAAoC,IAAI,2BAA2B,CAAA;AACzE,MAAM,uBAA0B,GAAA;AAChC,MAAM,2BAA8B,GAAA;AACpC,MAAM,0BACX,GAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.esm.js","sources":["../../src/ReportIssue/hooks.ts"],"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 parseGitUrl from 'git-url-parse';\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n replaceGithubUrlType,\n replaceGitLabUrlType,\n} from '@backstage/integration';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport {\n useShadowRootElements,\n useShadowRootSelection,\n} from '@backstage/plugin-techdocs-react';\n\nimport { PAGE_EDIT_LINK_SELECTOR } from './constants';\n\nconst resolveBlobUrl = (url: string, type: string) => {\n if (type === 'github') {\n return replaceGithubUrlType(url, 'blob');\n } else if (type === 'gitlab') {\n return replaceGitLabUrlType(url, 'blob');\n }\n // eslint-disable-next-line no-console\n console.error(\n `Invalid SCM type ${type} found in ReportIssue addon for URL ${url}!`,\n );\n return url;\n};\n\nexport const getTitle = (selection: Selection) => {\n const text = selection.toString().substring(0, 70);\n const ellipsis = text.length === 70 ? '...' : '';\n return `Documentation feedback: ${text}${ellipsis}`;\n};\n\nexport const getBody = (\n selection: Selection,\n markdownUrl: string,\n appTitle: string,\n) => {\n const title = '## Documentation Feedback 📝';\n const subheading = '#### The highlighted text:';\n const commentHeading = '#### The comment on the text:';\n const commentPlaceholder = '_>replace this line with your comment<_';\n const highlightedTextAsQuote = selection\n .toString()\n .trim()\n .split('\\n')\n .map(line => `> ${line.trim()}`)\n .join('\\n');\n\n const facts = [\n `${appTitle} URL: <${window.location.href}> \\nMarkdown URL: <${markdownUrl}>`,\n ];\n\n return `${title}\\n\\n ${subheading} \\n\\n ${highlightedTextAsQuote}\\n\\n ${commentHeading} \\n ${commentPlaceholder}\\n\\n ___\\n${facts}`;\n};\n\nexport const useGitTemplate = (debounceTime?: number) => {\n const initialTemplate = { title: '', body: '' };\n const selection = useShadowRootSelection(debounceTime);\n const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);\n const url = (editLink as HTMLAnchorElement)?.href ?? '';\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n if (!selection || !url) return initialTemplate;\n\n const type = scmIntegrationsApi.byUrl(url)?.type;\n\n if (!type) return initialTemplate;\n\n return {\n title: getTitle(selection),\n body: getBody(selection, resolveBlobUrl(url, type), appTitle),\n };\n};\n\nexport const useGitRepository = () => {\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n\n const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);\n const url = (editLink as HTMLAnchorElement)?.href ?? '';\n\n if (!url) return null;\n\n const type = scmIntegrationsApi.byUrl(url)?.type;\n\n if (!type) return null;\n\n return { ...parseGitUrl(resolveBlobUrl(url, type)), type };\n};\n"],"names":[],"mappings":";;;;;;;AA+BA,MAAM,cAAA,GAAiB,CAAC,GAAA,EAAa,IAAiB,KAAA;AACpD,EAAA,IAAI,SAAS,QAAU,EAAA;AACrB,IAAO,OAAA,oBAAA,CAAqB,KAAK,MAAM,CAAA,CAAA;AAAA,GACzC,MAAA,IAAW,SAAS,QAAU,EAAA;AAC5B,IAAO,OAAA,oBAAA,CAAqB,KAAK,MAAM,CAAA,CAAA;AAAA,GACzC;AAEA,EAAQ,OAAA,CAAA,KAAA;AAAA,IACN,CAAA,iBAAA,EAAoB,IAAI,CAAA,oCAAA,EAAuC,GAAG,CAAA,CAAA,CAAA;AAAA,GACpE,CAAA;AACA,EAAO,OAAA,GAAA,CAAA;AACT,CAAA,CAAA;AAEa,MAAA,QAAA,GAAW,CAAC,SAAyB,KAAA;AAChD,EAAA,MAAM,OAAO,SAAU,CAAA,QAAA,EAAW,CAAA,SAAA,CAAU,GAAG,EAAE,CAAA,CAAA;AACjD,EAAA,MAAM,QAAW,GAAA,IAAA,CAAK,MAAW,KAAA,EAAA,GAAK,KAAQ,GAAA,EAAA,CAAA;AAC9C,EAAO,OAAA,CAAA,wBAAA,EAA2B,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAA,CAAA;AACnD,EAAA;AAEO,MAAM,OAAU,GAAA,CACrB,SACA,EAAA,WAAA,EACA,QACG,KAAA;AACH,EAAA,MAAM,KAAQ,GAAA,qCAAA,CAAA;AACd,EAAA,MAAM,UAAa,GAAA,4BAAA,CAAA;AACnB,EAAA,MAAM,cAAiB,GAAA,+BAAA,CAAA;AACvB,EAAA,MAAM,kBAAqB,GA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AAA,eAAA,CAAA;AAE/B,EAAA,MAAM,IAAO,GAAA,kBAAA,CAAmB,KAAM,CAAA,GAAG,CAAG,EAAA,IAAA,CAAA;AAE5C,EAAI,IAAA,CAAC,MAAa,OAAA,eAAA,CAAA;AAElB,EAAO,OAAA;AAAA,IACL,KAAA,EAAO,SAAS,SAAS,CAAA;AAAA,IACzB,MAAM,OAAQ,CAAA,SAAA,EAAW,eAAe,GAAK,EAAA,IAAI,GAAG,QAAQ,CAAA;AAAA,GAC9D,CAAA;AACF,EAAA;AAEO,MAAM,mBAAmB,MAAM;AACpC,EAAM,MAAA,kBAAA,GAAqB,OAAO,qBAAqB,CAAA,CAAA;AAEvD,EAAA,MAAM,CAAC,QAAQ,CAAA,GAAI,qBAAsB,CAAA,CAAC,uBAAuB,CAAC,CAAA,CAAA;AAClE,EAAM,MAAA,GAAA,GAAO,UAAgC,IAAQ,IAAA,EAAA,CAAA;AAErD,EAAI,IAAA,CAAC,KAAY,OAAA,IAAA,CAAA;AAEjB,EAAA,MAAM,IAAO,GAAA,kBAAA,CAAmB,KAAM,CAAA,GAAG,CAAG,EAAA,IAAA,CAAA;AAE5C,EAAI,IAAA,CAAC,MAAa,OAAA,IAAA,CAAA;AAElB,EAAO,OAAA,EAAE,GAAG,WAAY,CAAA,cAAA,CAAe,KAAK,IAAI,CAAC,GAAG,IAAK,EAAA,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"hooks.esm.js","sources":["../../src/ReportIssue/hooks.ts"],"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 parseGitUrl from 'git-url-parse';\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n replaceGithubUrlType,\n replaceGitLabUrlType,\n} from '@backstage/integration';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport {\n useShadowRootElements,\n useShadowRootSelection,\n} from '@backstage/plugin-techdocs-react';\n\nimport { PAGE_EDIT_LINK_SELECTOR } from './constants';\n\nconst resolveBlobUrl = (url: string, type: string) => {\n if (type === 'github') {\n return replaceGithubUrlType(url, 'blob');\n } else if (type === 'gitlab') {\n return replaceGitLabUrlType(url, 'blob');\n }\n // eslint-disable-next-line no-console\n console.error(\n `Invalid SCM type ${type} found in ReportIssue addon for URL ${url}!`,\n );\n return url;\n};\n\nexport const getTitle = (selection: Selection) => {\n const text = selection.toString().substring(0, 70);\n const ellipsis = text.length === 70 ? '...' : '';\n return `Documentation feedback: ${text}${ellipsis}`;\n};\n\nexport const getBody = (\n selection: Selection,\n markdownUrl: string,\n appTitle: string,\n) => {\n const title = '## Documentation Feedback 📝';\n const subheading = '#### The highlighted text:';\n const commentHeading = '#### The comment on the text:';\n const commentPlaceholder = '_>replace this line with your comment<_';\n const highlightedTextAsQuote = selection\n .toString()\n .trim()\n .split('\\n')\n .map(line => `> ${line.trim()}`)\n .join('\\n');\n\n const facts = [\n `${appTitle} URL: <${window.location.href}> \\nMarkdown URL: <${markdownUrl}>`,\n ];\n\n return `${title}\\n\\n ${subheading} \\n\\n ${highlightedTextAsQuote}\\n\\n ${commentHeading} \\n ${commentPlaceholder}\\n\\n ___\\n${facts}`;\n};\n\nexport const useGitTemplate = (debounceTime?: number) => {\n const initialTemplate = { title: '', body: '' };\n const selection = useShadowRootSelection(debounceTime);\n const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);\n const url = (editLink as HTMLAnchorElement)?.href ?? '';\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n if (!selection || !url) return initialTemplate;\n\n const type = scmIntegrationsApi.byUrl(url)?.type;\n\n if (!type) return initialTemplate;\n\n return {\n title: getTitle(selection),\n body: getBody(selection, resolveBlobUrl(url, type), appTitle),\n };\n};\n\nexport const useGitRepository = () => {\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n\n const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);\n const url = (editLink as HTMLAnchorElement)?.href ?? '';\n\n if (!url) return null;\n\n const type = scmIntegrationsApi.byUrl(url)?.type;\n\n if (!type) return null;\n\n return { ...parseGitUrl(resolveBlobUrl(url, type)), type };\n};\n"],"names":[],"mappings":";;;;;;;AA+BA,MAAM,cAAA,GAAiB,CAAC,GAAA,EAAa,IAAiB,KAAA;AACpD,EAAA,IAAI,SAAS,QAAU,EAAA;AACrB,IAAO,OAAA,oBAAA,CAAqB,KAAK,MAAM,CAAA;AAAA,GACzC,MAAA,IAAW,SAAS,QAAU,EAAA;AAC5B,IAAO,OAAA,oBAAA,CAAqB,KAAK,MAAM,CAAA;AAAA;AAGzC,EAAQ,OAAA,CAAA,KAAA;AAAA,IACN,CAAA,iBAAA,EAAoB,IAAI,CAAA,oCAAA,EAAuC,GAAG,CAAA,CAAA;AAAA,GACpE;AACA,EAAO,OAAA,GAAA;AACT,CAAA;AAEa,MAAA,QAAA,GAAW,CAAC,SAAyB,KAAA;AAChD,EAAA,MAAM,OAAO,SAAU,CAAA,QAAA,EAAW,CAAA,SAAA,CAAU,GAAG,EAAE,CAAA;AACjD,EAAA,MAAM,QAAW,GAAA,IAAA,CAAK,MAAW,KAAA,EAAA,GAAK,KAAQ,GAAA,EAAA;AAC9C,EAAO,OAAA,CAAA,wBAAA,EAA2B,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAA;AACnD;AAEO,MAAM,OAAU,GAAA,CACrB,SACA,EAAA,WAAA,EACA,QACG,KAAA;AACH,EAAA,MAAM,KAAQ,GAAA,qCAAA;AACd,EAAA,MAAM,UAAa,GAAA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A,kBAAA,CAAmB,KAAM,CAAA,GAAG,CAAG,EAAA,IAAA;AAE5C,EAAI,IAAA,CAAC,MAAa,OAAA,eAAA;AAElB,EAAO,OAAA;AAAA,IACL,KAAA,EAAO,SAAS,SAAS,CAAA;AAAA,IACzB,MAAM,OAAQ,CAAA,SAAA,EAAW,eAAe,GAAK,EAAA,IAAI,GAAG,QAAQ;AAAA,GAC9D;AACF;AAEO,MAAM,mBAAmB,MAAM;AACpC,EAAM,MAAA,kBAAA,GAAqB,OAAO,qBAAqB,CAAA;AAEvD,EAAA,MAAM,CAAC,QAAQ,CAAA,GAAI,qBAAsB,CAAA,CAAC,uBAAuB,CAAC,CAAA;AAClE,EAAM,MAAA,GAAA,GAAO,UAAgC,IAAQ,IAAA,EAAA;AAErD,EAAI,IAAA,CAAC,KAAY,OAAA,IAAA;AAEjB,EAAA,MAAM,IAAO,GAAA,kBAAA,CAAmB,KAAM,CAAA,GAAG,CAAG,EAAA,IAAA;AAE5C,EAAI,IAAA,CAAC,MAAa,OAAA,IAAA;AAElB,EAAO,OAAA,EAAE,GAAG,WAAY,CAAA,cAAA,CAAe,KAAK,IAAI,CAAC,GAAG,IAAK,EAAA;AAC3D;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextSize.esm.js","sources":["../../src/TextSize/TextSize.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 React, {\n ChangeEvent,\n MouseEvent,\n useMemo,\n useState,\n useEffect,\n useCallback,\n} from 'react';\n\nimport {\n withStyles,\n makeStyles,\n useTheme,\n Box,\n MenuItem,\n ListItemText,\n Slider,\n IconButton,\n Typography,\n Theme,\n} from '@material-ui/core';\nimport AddIcon from '@material-ui/icons/Add';\nimport RemoveIcon from '@material-ui/icons/Remove';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst boxShadow =\n '0 3px 1px rgba(0,0,0,0.1),0 4px 8px rgba(0,0,0,0.13),0 0 0 1px rgba(0,0,0,0.02)';\n\nconst StyledSlider = withStyles(theme => ({\n root: {\n height: 2,\n padding: '15px 0',\n },\n thumb: {\n height: 18,\n width: 18,\n backgroundColor: theme.palette.common.white,\n boxShadow: boxShadow,\n marginTop: -9,\n marginLeft: -9,\n '&:focus, &:hover, &$active': {\n boxShadow:\n '0 3px 1px rgba(0,0,0,0.1),0 4px 8px rgba(0,0,0,0.3),0 0 0 1px rgba(0,0,0,0.02)',\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n boxShadow: boxShadow,\n },\n },\n },\n active: {},\n valueLabel: {\n top: '100%',\n left: '50%',\n transform: 'scale(1) translate(-50%, -5px) !important',\n '& *': {\n color: theme.palette.textSubtle,\n fontSize: theme.typography.caption.fontSize,\n background: 'transparent',\n },\n },\n track: {\n height: 2,\n },\n rail: {\n height: 2,\n opacity: 0.5,\n },\n mark: {\n height: 10,\n width: 1,\n marginTop: -4,\n },\n markActive: {\n opacity: 1,\n backgroundColor: 'currentColor',\n },\n}))(Slider);\n\nconst settings = {\n key: 'techdocs.addons.settings.textsize',\n defaultValue: 100,\n};\n\nconst marks = [\n {\n value: 90,\n },\n {\n value: 100,\n },\n {\n value: 115,\n },\n {\n value: 130,\n },\n {\n value: 150,\n },\n];\n\nconst useStyles = makeStyles(theme => ({\n container: {\n color: theme.palette.textSubtle,\n display: 'flex',\n alignItems: 'center',\n margin: 0,\n minWidth: 200,\n },\n menuItem: {\n '&:hover': {\n background: 'transparent',\n },\n },\n decreaseButton: {\n marginRight: theme.spacing(1),\n },\n increaseButton: {\n marginLeft: theme.spacing(1),\n },\n}));\n\nexport const TextSizeAddon = () => {\n const classes = useStyles();\n const theme = useTheme();\n const [body] = useShadowRootElements(['body']);\n\n const [value, setValue] = useState<number>(() => {\n const initialValue = localStorage?.getItem(settings.key);\n return initialValue ? parseInt(initialValue, 10) : settings.defaultValue;\n });\n\n const values = useMemo(() => marks.map(mark => mark.value), []);\n const index = useMemo(() => values.indexOf(value), [values, value]);\n const min = useMemo(() => values[0], [values]);\n const max = useMemo(() => values[values.length - 1], [values]);\n\n const getValueText = useCallback(() => `${value}%`, [value]);\n\n const handleChangeCommitted = useCallback(\n (_event: ChangeEvent<{}>, newValue: number | number[]) => {\n if (!Array.isArray(newValue)) {\n setValue(newValue);\n localStorage?.setItem(settings.key, String(newValue));\n }\n },\n [setValue],\n );\n\n const handleDecreaseClick = useCallback(\n (event: MouseEvent) => {\n handleChangeCommitted(event, values[index - 1]);\n },\n [index, values, handleChangeCommitted],\n );\n\n const handleIncreaseClick = useCallback(\n (event: MouseEvent) => {\n handleChangeCommitted(event, values[index + 1]);\n },\n [index, values, handleChangeCommitted],\n );\n\n useEffect(() => {\n if (!body) return;\n const htmlFontSize =\n (\n theme.typography as Theme['typography'] & {\n htmlFontSize?: number;\n }\n )?.htmlFontSize ?? 16;\n body.style.setProperty(\n '--md-typeset-font-size',\n `${htmlFontSize * (value / 100)}px`,\n );\n }, [body, value, theme]);\n\n return (\n <MenuItem className={classes.menuItem} button disableRipple>\n <ListItemText\n primary={\n <Typography variant=\"subtitle2\" color=\"textPrimary\">\n Text size\n </Typography>\n }\n secondary={\n <Box className={classes.container}>\n <IconButton\n className={classes.decreaseButton}\n size=\"small\"\n edge=\"start\"\n disabled={value === min}\n onClick={handleDecreaseClick}\n aria-label=\"Decrease text size\"\n >\n <RemoveIcon />\n </IconButton>\n <StyledSlider\n value={value}\n aria-labelledby=\"text-size-slider\"\n getAriaValueText={getValueText}\n valueLabelDisplay=\"on\"\n valueLabelFormat={getValueText}\n marks={marks}\n step={null}\n min={min}\n max={max}\n onChangeCommitted={handleChangeCommitted}\n />\n <IconButton\n className={classes.increaseButton}\n size=\"small\"\n edge=\"end\"\n disabled={value === max}\n onClick={handleIncreaseClick}\n aria-label=\"Increase text size\"\n >\n <AddIcon />\n </IconButton>\n </Box>\n }\n disableTypography\n />\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0CA,MAAM,SACJ,GAAA,iFAAA,CAAA;AAEF,MAAM,YAAA,GAAe,WAAW,CAAU,KAAA,MAAA;AAAA,EACxC,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,CAAA;AAAA,IACR,OAAS,EAAA,QAAA;AAAA,GACX;AAAA,EACA,KAAO,EAAA;AAAA,IACL,MAAQ,EAAA,EAAA;AAAA,IACR,KAAO,EAAA,EAAA;AAAA,IACP,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IACtC,SAAA;AAAA,IACA,SAAW,EAAA,CAAA,CAAA;AAAA,IACX,UAAY,EAAA,CAAA,CAAA;AAAA,IACZ,4BAA8B,EAAA;AAAA,MAC5B,SACE,EAAA,gFAAA;AAAA;AAAA,MAEF,sBAAwB,EAAA;AAAA,QACtB,SAAA;AAAA,OACF;AAAA,KACF;AAAA,GACF;AAAA,EACA,QAAQ,EAAC;AAAA,EACT,UAAY,EAAA;AAAA,IACV,GAAK,EAAA,MAAA;AAAA,IACL,IAAM,EAAA,KAAA;AAAA,IACN,SAAW,EAAA,2CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,KAAA,EAAO,MAAM,OAAQ,CAAA,UAAA;AAAA,MACrB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,MACnC,UAAY,EAAA,aAAA;AAAA,KACd;AAAA,GACF;AAAA,EACA,KAAO,EAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,GACV;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,CAAA;AAAA,IACR,OAAS,EAAA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AAiB,EAAA,IAAA;AAAA,KAAA;AAAA,GAErB,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TextSize.esm.js","sources":["../../src/TextSize/TextSize.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 React, {\n ChangeEvent,\n MouseEvent,\n useMemo,\n useState,\n useEffect,\n useCallback,\n} from 'react';\n\nimport {\n withStyles,\n makeStyles,\n useTheme,\n Box,\n MenuItem,\n ListItemText,\n Slider,\n IconButton,\n Typography,\n Theme,\n} from '@material-ui/core';\nimport AddIcon from '@material-ui/icons/Add';\nimport RemoveIcon from '@material-ui/icons/Remove';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst boxShadow =\n '0 3px 1px rgba(0,0,0,0.1),0 4px 8px rgba(0,0,0,0.13),0 0 0 1px rgba(0,0,0,0.02)';\n\nconst StyledSlider = withStyles(theme => ({\n root: {\n height: 2,\n padding: '15px 0',\n },\n thumb: {\n height: 18,\n width: 18,\n backgroundColor: theme.palette.common.white,\n boxShadow: boxShadow,\n marginTop: -9,\n marginLeft: -9,\n '&:focus, &:hover, &$active': {\n boxShadow:\n '0 3px 1px rgba(0,0,0,0.1),0 4px 8px rgba(0,0,0,0.3),0 0 0 1px rgba(0,0,0,0.02)',\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n boxShadow: boxShadow,\n },\n },\n },\n active: {},\n valueLabel: {\n top: '100%',\n left: '50%',\n transform: 'scale(1) translate(-50%, -5px) !important',\n '& *': {\n color: theme.palette.textSubtle,\n fontSize: theme.typography.caption.fontSize,\n background: 'transparent',\n },\n },\n track: {\n height: 2,\n },\n rail: {\n height: 2,\n opacity: 0.5,\n },\n mark: {\n height: 10,\n width: 1,\n marginTop: -4,\n },\n markActive: {\n opacity: 1,\n backgroundColor: 'currentColor',\n },\n}))(Slider);\n\nconst settings = {\n key: 'techdocs.addons.settings.textsize',\n defaultValue: 100,\n};\n\nconst marks = [\n {\n value: 90,\n },\n {\n value: 100,\n },\n {\n value: 115,\n },\n {\n value: 130,\n },\n {\n value: 150,\n },\n];\n\nconst useStyles = makeStyles(theme => ({\n container: {\n color: theme.palette.textSubtle,\n display: 'flex',\n alignItems: 'center',\n margin: 0,\n minWidth: 200,\n },\n menuItem: {\n '&:hover': {\n background: 'transparent',\n },\n },\n decreaseButton: {\n marginRight: theme.spacing(1),\n },\n increaseButton: {\n marginLeft: theme.spacing(1),\n },\n}));\n\nexport const TextSizeAddon = () => {\n const classes = useStyles();\n const theme = useTheme();\n const [body] = useShadowRootElements(['body']);\n\n const [value, setValue] = useState<number>(() => {\n const initialValue = localStorage?.getItem(settings.key);\n return initialValue ? parseInt(initialValue, 10) : settings.defaultValue;\n });\n\n const values = useMemo(() => marks.map(mark => mark.value), []);\n const index = useMemo(() => values.indexOf(value), [values, value]);\n const min = useMemo(() => values[0], [values]);\n const max = useMemo(() => values[values.length - 1], [values]);\n\n const getValueText = useCallback(() => `${value}%`, [value]);\n\n const handleChangeCommitted = useCallback(\n (_event: ChangeEvent<{}>, newValue: number | number[]) => {\n if (!Array.isArray(newValue)) {\n setValue(newValue);\n localStorage?.setItem(settings.key, String(newValue));\n }\n },\n [setValue],\n );\n\n const handleDecreaseClick = useCallback(\n (event: MouseEvent) => {\n handleChangeCommitted(event, values[index - 1]);\n },\n [index, values, handleChangeCommitted],\n );\n\n const handleIncreaseClick = useCallback(\n (event: MouseEvent) => {\n handleChangeCommitted(event, values[index + 1]);\n },\n [index, values, handleChangeCommitted],\n );\n\n useEffect(() => {\n if (!body) return;\n const htmlFontSize =\n (\n theme.typography as Theme['typography'] & {\n htmlFontSize?: number;\n }\n )?.htmlFontSize ?? 16;\n body.style.setProperty(\n '--md-typeset-font-size',\n `${htmlFontSize * (value / 100)}px`,\n );\n }, [body, value, theme]);\n\n return (\n <MenuItem className={classes.menuItem} button disableRipple>\n <ListItemText\n primary={\n <Typography variant=\"subtitle2\" color=\"textPrimary\">\n Text size\n </Typography>\n }\n secondary={\n <Box className={classes.container}>\n <IconButton\n className={classes.decreaseButton}\n size=\"small\"\n edge=\"start\"\n disabled={value === min}\n onClick={handleDecreaseClick}\n aria-label=\"Decrease text size\"\n >\n <RemoveIcon />\n </IconButton>\n <StyledSlider\n value={value}\n aria-labelledby=\"text-size-slider\"\n getAriaValueText={getValueText}\n valueLabelDisplay=\"on\"\n valueLabelFormat={getValueText}\n marks={marks}\n step={null}\n min={min}\n max={max}\n onChangeCommitted={handleChangeCommitted}\n />\n <IconButton\n className={classes.increaseButton}\n size=\"small\"\n edge=\"end\"\n disabled={value === max}\n onClick={handleIncreaseClick}\n aria-label=\"Increase text size\"\n >\n <AddIcon />\n </IconButton>\n </Box>\n }\n disableTypography\n />\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0CA,MAAM,SACJ,GAAA,iFAAA;AAEF,MAAM,YAAA,GAAe,WAAW,CAAU,KAAA,MAAA;AAAA,EACxC,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,CAAA;AAAA,IACR,OAAS,EAAA;AAAA,GACX;AAAA,EACA,KAAO,EAAA;AAAA,IACL,MAAQ,EAAA,EAAA;AAAA,IACR,KAAO,EAAA,EAAA;AAAA,IACP,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IACtC,SAAA;AAAA,IACA,SAAW,EAAA,CAAA,CAAA;AAAA,IACX,UAAY,EAAA,CAAA,CAAA;AAAA,IACZ,4BAA8B,EAAA;AAAA,MAC5B,SACE,EAAA,gFAAA;AAAA;AAAA,MAEF,s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A;AAAA,UACL,UAAU,KAAU,KAAA,GAAA;AAAA,UACpB,OAAS,EAAA,mBAAA;AAAA,UACT,YAAW,EAAA;AAAA,SAAA;AAAA,4CAEV,OAAQ,EAAA,IAAA;AAAA,OAEb,CAAA;AAAA,MAEF,iBAAiB,EAAA;AAAA;AAAA,GAErB,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { createPlugin } from '@backstage/core-plugin-api';\nimport {\n createTechDocsAddonExtension,\n TechDocsAddonLocations,\n} from '@backstage/plugin-techdocs-react';\nimport { ExpandableNavigationAddon } from './ExpandableNavigation';\nimport { ReportIssueAddon, ReportIssueProps } from './ReportIssue';\nimport { TextSizeAddon } from './TextSize';\nimport { LightBoxAddon } from './LigthBox';\n\n/**\n * The TechDocs addons contrib plugin\n *\n * @public\n */\n\nexport const techdocsModuleAddonsContribPlugin = createPlugin({\n id: 'techdocsModuleAddonsContrib',\n});\n\n/**\n * TechDocs addon that lets you expand/collapse the TechDocs main navigation\n * and keep the preferred state in local storage. The addon will render as\n * a button next to the site name if the documentation has nested navigation.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react/alpha';\n * import { ExpandableNavigation } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ExpandableNavigation />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\n\nexport const ExpandableNavigation = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'ExpandableNavigation',\n location: TechDocsAddonLocations.PrimarySidebar,\n component: ExpandableNavigationAddon,\n }),\n);\n\n/**\n * TechDocs addon that lets you select text and open GitHub/Gitlab issues\n *\n * @remarks\n * Before using it, you should set up an `edit_uri` for your pages as explained {@link https://backstage.io/docs/features/techdocs/faqs#is-it-possible-for-users-to-suggest-changes-or-provide-feedback-on-a-techdocs-page | here} and remember, it only works for Github or Gitlab.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ReportIssue />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @example\n * Here's an example with `debounceTime` and `templateBuilder` props:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n * const templateBuilder = ({ selection }: ReportIssueTemplateBuilder) => (({\n * title: 'Custom issue title',\n * body: `Custom issue body: ${selection.toString()}`\n * }))\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ReportIssue debounceTime={300} templateBuilder={templateBuilder} />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * ```\n * @param props - Object that can optionally contain `debounceTime` and `templateBuilder` properties.\n * @public\n */\nexport const ReportIssue = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension<ReportIssueProps>({\n name: 'ReportIssue',\n location: TechDocsAddonLocations.Content,\n component: ReportIssueAddon,\n }),\n);\n\n/**\n * This TechDocs addon allows users to customize text size on documentation pages, they can select how much they want to increase or decrease the font size via slider or buttons.\n *\n * @remarks\n * The default value for the font size is 100% of the HTML font size, if the theme does not have a `htmlFontSize` in its typography object, the addon will assume 16px as 100%, and remember, this setting is kept in the browser local storage.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { TextSize } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <TextSize />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\nexport const TextSize = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'TextSize',\n location: TechDocsAddonLocations.Settings,\n component: TextSizeAddon,\n }),\n);\n\n/**\n * This TechDocs addon allows users to open images in a lightbox on documentation pages, they can navigate between images if there are several on one page.\n *\n * @remarks\n * The image size of the lightbox image is the same as the image size on the document page.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { LightBox } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <LightBox />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\nexport const LightBox = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'LightBox',\n location: TechDocsAddonLocations.Content,\n component: LightBoxAddon,\n }),\n);\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,oCAAoC,YAAa,CAAA;AAAA,EAC5D,EAAI,EAAA,6BAAA;AACN,CAAC,EAAA;AAwCM,MAAM,uBAAuB,iCAAkC,CAAA,OAAA;AAAA,EACpE,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,sBAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,cAAA;AAAA,IACjC,SAAW,EAAA,yBAAA;AAAA,GACZ,CAAA;AACH,EAAA;AAyEO,MAAM,cAAc,iCAAkC,CAAA,OAAA;AAAA,EAC3D,4BAA+C,CAAA;AAAA,IAC7C,IAAM,EAAA,aAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA,gBAAA;AAAA,GACZ,CAAA;AACH,EAAA;AAwCO,MAAM,WAAW,iCAAkC,CAAA,OAAA;AAAA,EACxD,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,UAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,QAAA;AAAA,IACjC,SAAW,EAAA,aAAA;AAAA,GACZ,CAAA;AACH,EAAA;AAwCO,MAAM,WAAW,iCAAkC,CAAA,OAAA;AAAA,EACxD,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,UAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA,aAAA;AAAA,GACZ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 { createPlugin } from '@backstage/core-plugin-api';\nimport {\n createTechDocsAddonExtension,\n TechDocsAddonLocations,\n} from '@backstage/plugin-techdocs-react';\nimport { ExpandableNavigationAddon } from './ExpandableNavigation';\nimport { ReportIssueAddon, ReportIssueProps } from './ReportIssue';\nimport { TextSizeAddon } from './TextSize';\nimport { LightBoxAddon } from './LigthBox';\n\n/**\n * The TechDocs addons contrib plugin\n *\n * @public\n */\n\nexport const techdocsModuleAddonsContribPlugin = createPlugin({\n id: 'techdocsModuleAddonsContrib',\n});\n\n/**\n * TechDocs addon that lets you expand/collapse the TechDocs main navigation\n * and keep the preferred state in local storage. The addon will render as\n * a button next to the site name if the documentation has nested navigation.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react/alpha';\n * import { ExpandableNavigation } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ExpandableNavigation />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\n\nexport const ExpandableNavigation = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'ExpandableNavigation',\n location: TechDocsAddonLocations.PrimarySidebar,\n component: ExpandableNavigationAddon,\n }),\n);\n\n/**\n * TechDocs addon that lets you select text and open GitHub/Gitlab issues\n *\n * @remarks\n * Before using it, you should set up an `edit_uri` for your pages as explained {@link https://backstage.io/docs/features/techdocs/faqs#is-it-possible-for-users-to-suggest-changes-or-provide-feedback-on-a-techdocs-page | here} and remember, it only works for Github or Gitlab.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ReportIssue />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @example\n * Here's an example with `debounceTime` and `templateBuilder` props:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n * const templateBuilder = ({ selection }: ReportIssueTemplateBuilder) => (({\n * title: 'Custom issue title',\n * body: `Custom issue body: ${selection.toString()}`\n * }))\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <ReportIssue debounceTime={300} templateBuilder={templateBuilder} />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * ```\n * @param props - Object that can optionally contain `debounceTime` and `templateBuilder` properties.\n * @public\n */\nexport const ReportIssue = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension<ReportIssueProps>({\n name: 'ReportIssue',\n location: TechDocsAddonLocations.Content,\n component: ReportIssueAddon,\n }),\n);\n\n/**\n * This TechDocs addon allows users to customize text size on documentation pages, they can select how much they want to increase or decrease the font size via slider or buttons.\n *\n * @remarks\n * The default value for the font size is 100% of the HTML font size, if the theme does not have a `htmlFontSize` in its typography object, the addon will assume 16px as 100%, and remember, this setting is kept in the browser local storage.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { TextSize } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <TextSize />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\nexport const TextSize = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'TextSize',\n location: TechDocsAddonLocations.Settings,\n component: TextSizeAddon,\n }),\n);\n\n/**\n * This TechDocs addon allows users to open images in a lightbox on documentation pages, they can navigate between images if there are several on one page.\n *\n * @remarks\n * The image size of the lightbox image is the same as the image size on the document page.\n *\n * @example\n * Here's a simple example:\n * ```\n * import {\n * DefaultTechDocsHome,\n * TechDocsIndexPage,\n * TechDocsReaderPage,\n * } from '@backstage/plugin-techdocs';\n * import { TechDocsAddons } from '@backstage/plugin-techdocs-react';\n * import { LightBox } from '@backstage/plugin-techdocs-module-addons-contrib';\n *\n *\n * const AppRoutes = () => {\n * <FlatRoutes>\n * // other plugin routes\n * <Route path=\"/docs\" element={<TechDocsIndexPage />}>\n * <DefaultTechDocsHome />\n * </Route>\n * <Route\n * path=\"/docs/:namespace/:kind/:name/*\"\n * element={<TechDocsReaderPage />}\n * >\n * <TechDocsAddons>\n * <LightBox />\n * </TechDocsAddons>\n * </Route>\n * </FlatRoutes>;\n * };\n * ```\n *\n * @public\n */\nexport const LightBox = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension({\n name: 'LightBox',\n location: TechDocsAddonLocations.Content,\n component: LightBoxAddon,\n }),\n);\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,oCAAoC,YAAa,CAAA;AAAA,EAC5D,EAAI,EAAA;AACN,CAAC;AAwCM,MAAM,uBAAuB,iCAAkC,CAAA,OAAA;AAAA,EACpE,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,sBAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,cAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ;AACH;AAyEO,MAAM,cAAc,iCAAkC,CAAA,OAAA;AAAA,EAC3D,4BAA+C,CAAA;AAAA,IAC7C,IAAM,EAAA,aAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ;AACH;AAwCO,MAAM,WAAW,iCAAkC,CAAA,OAAA;AAAA,EACxD,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,UAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,QAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ;AACH;AAwCO,MAAM,WAAW,iCAAkC,CAAA,OAAA;AAAA,EACxD,4BAA6B,CAAA;AAAA,IAC3B,IAAM,EAAA,UAAA;AAAA,IACN,UAAU,sBAAuB,CAAA,OAAA;AAAA,IACjC,SAAW,EAAA;AAAA,GACZ;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-module-addons-contrib",
3
- "version": "1.1.17-next.0",
3
+ "version": "1.1.17-next.2",
4
4
  "description": "Plugin module for contributed TechDocs Addons",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin-module",
@@ -39,11 +39,11 @@
39
39
  "test": "backstage-cli package test"
40
40
  },
41
41
  "dependencies": {
42
- "@backstage/core-components": "0.16.0-next.0",
42
+ "@backstage/core-components": "0.16.0-next.2",
43
43
  "@backstage/core-plugin-api": "1.10.0",
44
44
  "@backstage/integration": "1.15.1",
45
45
  "@backstage/integration-react": "1.2.0",
46
- "@backstage/plugin-techdocs-react": "1.2.10-next.0",
46
+ "@backstage/plugin-techdocs-react": "1.2.10-next.2",
47
47
  "@material-ui/core": "^4.12.2",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "@react-hookz/web": "^24.0.0",
@@ -51,9 +51,9 @@
51
51
  "photoswipe": "^5.3.7"
52
52
  },
53
53
  "devDependencies": {
54
- "@backstage/cli": "0.29.0-next.0",
55
- "@backstage/plugin-techdocs-addons-test-utils": "1.0.41-next.0",
56
- "@backstage/test-utils": "1.7.0",
54
+ "@backstage/cli": "0.29.0-next.3",
55
+ "@backstage/plugin-techdocs-addons-test-utils": "1.0.41-next.3",
56
+ "@backstage/test-utils": "1.7.1-next.0",
57
57
  "@testing-library/dom": "^10.0.0",
58
58
  "@testing-library/jest-dom": "^6.0.0",
59
59
  "@testing-library/react": "^16.0.0",
@@ -73,5 +73,12 @@
73
73
  "optional": true
74
74
  }
75
75
  },
76
+ "typesVersions": {
77
+ "*": {
78
+ "index": [
79
+ "dist/index.d.ts"
80
+ ]
81
+ }
82
+ },
76
83
  "module": "./dist/index.esm.js"
77
84
  }