@backstage/plugin-techdocs-module-addons-contrib 1.1.40-next.0 → 1.1.40
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 +26 -0
- package/dist/LightBox/LightBox.esm.js +62 -42
- package/dist/LightBox/LightBox.esm.js.map +1 -1
- package/dist/LightBox/lightbox.css.esm.js +5 -0
- package/dist/LightBox/lightbox.css.esm.js.map +1 -0
- package/dist/ReportIssue/IssueLink.esm.js +1 -1
- package/dist/ReportIssue/IssueLink.esm.js.map +1 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @backstage/plugin-techdocs-module-addons-contrib
|
|
2
2
|
|
|
3
|
+
## 1.1.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
|
|
8
|
+
- 10d2720: Keep the TechDocs LightBox addon's image viewer out of an app's initial bundle by loading it with the first documentation page.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/core-components@0.18.14
|
|
11
|
+
- @backstage/integration@2.1.2
|
|
12
|
+
- @backstage/plugin-techdocs-react@1.3.15
|
|
13
|
+
- @backstage/frontend-plugin-api@0.18.1
|
|
14
|
+
- @backstage/core-plugin-api@1.12.10
|
|
15
|
+
- @backstage/integration-react@1.2.22
|
|
16
|
+
|
|
17
|
+
## 1.1.40-next.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/core-components@0.18.14-next.1
|
|
23
|
+
- @backstage/integration@2.1.2-next.0
|
|
24
|
+
- @backstage/frontend-plugin-api@0.18.1-next.0
|
|
25
|
+
- @backstage/integration-react@1.2.22-next.0
|
|
26
|
+
- @backstage/core-plugin-api@1.12.10-next.0
|
|
27
|
+
- @backstage/plugin-techdocs-react@1.3.15-next.1
|
|
28
|
+
|
|
3
29
|
## 1.1.40-next.0
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,55 +1,75 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useShadowRootElements } from '@backstage/plugin-techdocs-react';
|
|
3
|
-
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
|
4
|
-
import PhotoSwipe from 'photoswipe';
|
|
5
|
-
import 'photoswipe/style.css';
|
|
6
3
|
|
|
7
4
|
const LightBoxAddon = () => {
|
|
8
5
|
const images = useShadowRootElements(["img"]);
|
|
9
6
|
useEffect(() => {
|
|
10
|
-
let
|
|
7
|
+
let cancelled = false;
|
|
8
|
+
let lightbox = null;
|
|
11
9
|
const lightboxImages = images.filter((image) => !image.closest("a"));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
const setup = async () => {
|
|
11
|
+
const [{ default: Lightbox }, { default: PhotoSwipe }] = await Promise.all([
|
|
12
|
+
import('photoswipe/lightbox'),
|
|
13
|
+
import('photoswipe')
|
|
14
|
+
]);
|
|
15
|
+
await import('photoswipe/style.css');
|
|
16
|
+
await import('./lightbox.css.esm.js');
|
|
17
|
+
if (cancelled) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let dataSourceImages = null;
|
|
21
|
+
lightbox = new Lightbox({
|
|
22
|
+
pswpModule: PhotoSwipe,
|
|
23
|
+
initialZoomLevel: 1,
|
|
24
|
+
secondaryZoomLevel: (zoomLevelObject) => {
|
|
25
|
+
if (!zoomLevelObject.elementSize || !zoomLevelObject.panAreaSize) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
const imageWidth = zoomLevelObject.elementSize.x;
|
|
29
|
+
const imageHeight = zoomLevelObject.elementSize.y;
|
|
30
|
+
const viewportWidth = zoomLevelObject.panAreaSize.x;
|
|
31
|
+
const viewportHeight = zoomLevelObject.panAreaSize.y;
|
|
32
|
+
const widthScale = viewportWidth / imageWidth;
|
|
33
|
+
const heightScale = viewportHeight / imageHeight;
|
|
34
|
+
const scaleFactor = Math.min(widthScale, heightScale);
|
|
35
|
+
return scaleFactor;
|
|
36
|
+
},
|
|
37
|
+
wheelToZoom: true,
|
|
38
|
+
arrowPrevSVG: '<svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeLarge" focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"></path></svg>',
|
|
39
|
+
arrowNextSVG: '<svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeLarge" focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"></path></svg>',
|
|
40
|
+
closeSVG: '<svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeLarge pswp__icn" focusable="false" aria-hidden="true" viewBox="0 0 24 24"><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>',
|
|
41
|
+
zoomSVG: `<svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeLarge pswp__icn" focusable="false" aria-hidden="true" viewBox="0 0 24 24">
|
|
30
42
|
<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">
|
|
31
43
|
</svg>`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
});
|
|
45
|
+
lightboxImages.forEach((image, index) => {
|
|
46
|
+
image.onclick = () => {
|
|
47
|
+
if (dataSourceImages === null) {
|
|
48
|
+
dataSourceImages = lightboxImages.map((dataSourceImage) => {
|
|
49
|
+
return {
|
|
50
|
+
element: dataSourceImage,
|
|
51
|
+
src: dataSourceImage.src,
|
|
52
|
+
msrc: dataSourceImage.src,
|
|
53
|
+
alt: dataSourceImage.alt,
|
|
54
|
+
width: dataSourceImage.clientWidth,
|
|
55
|
+
height: dataSourceImage.clientHeight
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
lightbox?.loadAndOpen(index, dataSourceImages);
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
lightbox.init();
|
|
64
|
+
};
|
|
65
|
+
if (lightboxImages.length > 0) {
|
|
66
|
+
setup();
|
|
67
|
+
}
|
|
52
68
|
return () => {
|
|
69
|
+
cancelled = true;
|
|
70
|
+
lightboxImages.forEach((image) => {
|
|
71
|
+
image.onclick = null;
|
|
72
|
+
});
|
|
53
73
|
lightbox?.destroy();
|
|
54
74
|
lightbox = null;
|
|
55
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightBox.esm.js","sources":["../../src/LightBox/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';\
|
|
1
|
+
{"version":3,"file":"LightBox.esm.js","sources":["../../src/LightBox/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';\nimport type PhotoSwipeLightbox from 'photoswipe/lightbox';\nimport type { DataSource } from 'photoswipe/lightbox';\n\nexport const LightBoxAddon = () => {\n const images = useShadowRootElements<HTMLImageElement>(['img']);\n\n useEffect(() => {\n let cancelled = false;\n let lightbox: PhotoSwipeLightbox | null = null;\n // Resolved up front so pages with no zoomable image never load photoswipe.\n const lightboxImages = images.filter(image => !image.closest('a'));\n\n // Imported here rather than statically, so photoswipe and its stylesheets\n // stay out of the app's initial bundle and load with the first docs page.\n const setup = async () => {\n const [{ default: Lightbox }, { default: PhotoSwipe }] =\n await Promise.all([\n import('photoswipe/lightbox'),\n import('photoswipe'),\n ]);\n // lightbox.css overrides photoswipe's own styles, so apply after them.\n await import('photoswipe/style.css');\n await import('./lightbox.css');\n\n if (cancelled) {\n return;\n }\n\n let dataSourceImages: DataSource | null = null;\n\n lightbox = new Lightbox({\n pswpModule: PhotoSwipe,\n initialZoomLevel: 1,\n secondaryZoomLevel: zoomLevelObject => {\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 // photoswipe sets both sizes before calling this, the guard is only for the types.\n if (!zoomLevelObject.elementSize || !zoomLevelObject.panAreaSize) {\n return 1;\n }\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\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><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\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><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 pswp__icn\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><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 pswp__icn\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\">\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 lightboxImages.forEach((image, index) => {\n image.onclick = () => {\n if (dataSourceImages === null) {\n dataSourceImages = lightboxImages.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\n if (lightboxImages.length > 0) {\n // Unhandled on purpose: the app's ErrorApi reports rejections.\n setup();\n }\n\n return () => {\n cancelled = true;\n lightboxImages.forEach(image => {\n image.onclick = null;\n });\n lightbox?.destroy();\n lightbox = null;\n };\n }, [images]);\n\n return null;\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,MAAA,GAAS,qBAAA,CAAwC,CAAC,KAAK,CAAC,CAAA;AAE9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,KAAA;AAChB,IAAA,IAAI,QAAA,GAAsC,IAAA;AAE1C,IAAA,MAAM,cAAA,GAAiB,OAAO,MAAA,CAAO,CAAA,KAAA,KAAS,CAAC,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAC,CAAA;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3
|
+
var css_248z = "/* Beats MuiSvgIcon's own styles; the backdrop is always dark, in either theme */\n.pswp__button svg {\n fill: var(--bui-white, #ffffff);\n color: var(--bui-white, #ffffff);\n}\n\n/* Reset: default is dynamic and unclear (zoom vs drag) */\n.pswp__img {\n cursor: pointer !important;\n}\n\n/* hide \"-\" icon path */\n.pswp--zoomed-allowed #photoswipe-zoom-icon-zoomout-path {\n display: none;\n}\n\n/* hide \"+\" path and show \"-\" */\n.pswp--zoomed-in #photoswipe-zoom-icon-zoomin-path {\n display: none;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
//# sourceMappingURL=lightbox.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightbox.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -21,7 +21,7 @@ const getIcon = ({ type }) => {
|
|
|
21
21
|
return BugReportIcon;
|
|
22
22
|
};
|
|
23
23
|
const getName = ({ type }) => {
|
|
24
|
-
return type.charAt(0).
|
|
24
|
+
return type.charAt(0).toUpperCase() + type.slice(1);
|
|
25
25
|
};
|
|
26
26
|
const getUrl = (repository, template) => {
|
|
27
27
|
const { title, body } = template;
|
|
@@ -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 { 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 return type.charAt(0).
|
|
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 { 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 return type.charAt(0).toUpperCase() + type.slice(1);\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":";;;;;AAuBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,MAAA;AAAA,IACT,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,YAAA,EAAc,QAAA;AAAA,IACd,cAAA,EAAgB,QAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IAC5B,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,MAAA,CAAO;AAAA;AAEtC,CAAA,CAAE,CAAA;AAOF,MAAM,OAAA,GAAU,CAAC,EAAE,IAAA,EAAK,KAAkB;AACxC,EAAA,IAAI,SAAS,QAAA,EAAU;AACrB,IAAA,OAAO,UAAA;AAAA,EACT;AACA,EAAA,OAAO,aAAA;AACT,CAAA;AAEA,MAAM,OAAA,GAAU,CAAC,EAAE,IAAA,EAAK,KAAkB;AACxC,EAAA,OAAO,IAAA,CAAK,OAAO,CAAC,CAAA,CAAE,aAAY,GAAI,IAAA,CAAK,MAAM,CAAC,CAAA;AACpD,CAAA;AAEA,MAAM,MAAA,GAAS,CAAC,UA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+
if ( ref === void 0 ) ref = {};
|
|
3
|
+
var insertAt = ref.insertAt;
|
|
4
|
+
|
|
5
|
+
if (typeof document === 'undefined') { return; }
|
|
6
|
+
|
|
7
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8
|
+
var style = document.createElement('style');
|
|
9
|
+
style.type = 'text/css';
|
|
10
|
+
|
|
11
|
+
if (insertAt === 'top') {
|
|
12
|
+
if (head.firstChild) {
|
|
13
|
+
head.insertBefore(style, head.firstChild);
|
|
14
|
+
} else {
|
|
15
|
+
head.appendChild(style);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
head.appendChild(style);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (style.styleSheet) {
|
|
22
|
+
style.styleSheet.cssText = css;
|
|
23
|
+
} else {
|
|
24
|
+
style.appendChild(document.createTextNode(css));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { styleInject as default };
|
|
29
|
+
//# sourceMappingURL=style-inject.es.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.es.esm.js","sources":["../../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAY,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-techdocs-module-addons-contrib",
|
|
3
|
-
"version": "1.1.40
|
|
3
|
+
"version": "1.1.40",
|
|
4
4
|
"description": "Plugin module for contributed TechDocs Addons",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin-module",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"test": "backstage-cli package test"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@backstage/core-components": "0.18.14
|
|
64
|
-
"@backstage/core-plugin-api": "1.12.
|
|
65
|
-
"@backstage/frontend-plugin-api": "0.18.
|
|
66
|
-
"@backstage/integration": "2.1.
|
|
67
|
-
"@backstage/integration-react": "1.2.
|
|
68
|
-
"@backstage/plugin-techdocs-react": "1.3.15
|
|
63
|
+
"@backstage/core-components": "^0.18.14",
|
|
64
|
+
"@backstage/core-plugin-api": "^1.12.10",
|
|
65
|
+
"@backstage/frontend-plugin-api": "^0.18.1",
|
|
66
|
+
"@backstage/integration": "^2.1.2",
|
|
67
|
+
"@backstage/integration-react": "^1.2.22",
|
|
68
|
+
"@backstage/plugin-techdocs-react": "^1.3.15",
|
|
69
69
|
"@material-ui/core": "^4.12.2",
|
|
70
70
|
"@material-ui/icons": "^4.9.1",
|
|
71
71
|
"@react-hookz/web": "^24.0.0",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"photoswipe": "^5.3.7"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "0.36.6
|
|
77
|
-
"@backstage/plugin-catalog-react": "3.2.
|
|
78
|
-
"@backstage/plugin-techdocs-addons-test-utils": "2.0.9
|
|
79
|
-
"@backstage/test-utils": "1.7.22
|
|
76
|
+
"@backstage/cli": "^0.36.6",
|
|
77
|
+
"@backstage/plugin-catalog-react": "^3.2.3",
|
|
78
|
+
"@backstage/plugin-techdocs-addons-test-utils": "^2.0.9",
|
|
79
|
+
"@backstage/test-utils": "^1.7.22",
|
|
80
80
|
"@testing-library/dom": "^10.0.0",
|
|
81
81
|
"@testing-library/jest-dom": "^6.0.0",
|
|
82
82
|
"@testing-library/react": "^16.0.0",
|