@backstage/plugin-techdocs-module-addons-contrib 0.0.0-nightly-20220426024700

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 ADDED
@@ -0,0 +1,17 @@
1
+ # @backstage/plugin-techdocs-module-addons-contrib
2
+
3
+ ## 0.0.0-nightly-20220426024700
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f4dbd2b52: A package for contributed TechDocs addons.
8
+
9
+ In this release it will introduce the ReportIssue addon, which lets you select text and open a GitHub/Gitlab issue.
10
+
11
+ ### Patch Changes
12
+
13
+ - 075a9a067b: Updated the return type of `createTechDocsAddonExtension` to better reflect the fact that passing children to Addon components is not a valid use-case.
14
+ - Updated dependencies
15
+ - @backstage/integration@0.0.0-nightly-20220426024700
16
+ - @backstage/integration-react@0.0.0-nightly-20220426024700
17
+ - @backstage/plugin-techdocs-react@0.0.0-nightly-20220426024700
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
+
4
+ /**
5
+ * @public
6
+ */
7
+ declare type ReportIssueTemplate = {
8
+ title: string;
9
+ body: string;
10
+ };
11
+ /**
12
+ * @public
13
+ */
14
+ declare type ReportIssueTemplateBuilder = ({ selection, }: {
15
+ selection: Selection;
16
+ }) => ReportIssueTemplate;
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ declare type ReportIssueProps = {
22
+ debounceTime?: number;
23
+ templateBuilder?: ReportIssueTemplateBuilder;
24
+ };
25
+
26
+ /**
27
+ * The TechDocs addons contrib plugin
28
+ *
29
+ * @public
30
+ */
31
+ declare const techdocsModuleAddonsContribPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}>;
32
+ /**
33
+ * TechDocs addon that lets you select text and open GitHub/Gitlab issues
34
+ *
35
+ * @public
36
+ */
37
+ declare const ReportIssue: (props: ReportIssueProps) => JSX.Element | null;
38
+
39
+ export { ReportIssue, ReportIssueProps, ReportIssueTemplate, ReportIssueTemplateBuilder, techdocsModuleAddonsContribPlugin };
@@ -0,0 +1,198 @@
1
+ import { useApi, createPlugin } from '@backstage/core-plugin-api';
2
+ import { useShadowRootSelection, useShadowRootElements, createTechDocsAddonExtension, TechDocsAddonLocations } from '@backstage/plugin-techdocs-react';
3
+ import React, { useState, useEffect } from 'react';
4
+ import { makeStyles, Portal, Paper } from '@material-ui/core';
5
+ import parseGitUrl from 'git-url-parse';
6
+ import { replaceGitHubUrlType, replaceGitLabUrlType } from '@backstage/integration';
7
+ import { scmIntegrationsApiRef } from '@backstage/integration-react';
8
+ import BugReportIcon from '@material-ui/icons/BugReport';
9
+ import { Link, GitHubIcon } from '@backstage/core-components';
10
+
11
+ const ADDON_FEEDBACK_CONTAINER_ID = "techdocs-report-issue";
12
+ const ADDON_FEEDBACK_CONTAINER_SELECTOR = `#${ADDON_FEEDBACK_CONTAINER_ID}`;
13
+ const PAGE_EDIT_LINK_SELECTOR = '[title^="Edit this page"]';
14
+ const PAGE_FEEDBACK_LINK_SELECTOR = '[title^="Leave feedback for"]';
15
+ const PAGE_MAIN_CONTENT_SELECTOR = '[data-md-component="main"] .md-content';
16
+
17
+ const resolveBlobUrl = (url, type) => {
18
+ if (type === "github") {
19
+ return replaceGitHubUrlType(url, "blob");
20
+ } else if (type === "gitlab") {
21
+ return replaceGitLabUrlType(url, "blob");
22
+ }
23
+ console.error(`Invalid SCM type ${type} found in ReportIssue addon for URL ${url}!`);
24
+ return url;
25
+ };
26
+ const getTitle = (selection) => {
27
+ const text = selection.toString().substring(0, 70);
28
+ const ellipsis = text.length === 70 ? "..." : "";
29
+ return `Documentation feedback: ${text}${ellipsis}`;
30
+ };
31
+ const getBody = (selection, markdownUrl) => {
32
+ const title = "## Documentation Feedback \u{1F4DD}";
33
+ const subheading = "#### The highlighted text:";
34
+ const commentHeading = "#### The comment on the text:";
35
+ const commentPlaceholder = "_>replace this line with your comment<_";
36
+ const highlightedTextAsQuote = selection.toString().trim().split("\n").map((line) => `> ${line.trim()}`).join("\n");
37
+ const facts = [
38
+ `Backstage URL: <${window.location.href}>
39
+ Markdown URL: <${markdownUrl}>`
40
+ ];
41
+ return `${title}
42
+
43
+ ${subheading}
44
+
45
+ ${highlightedTextAsQuote}
46
+
47
+ ${commentHeading}
48
+ ${commentPlaceholder}
49
+
50
+ ___
51
+ ${facts}`;
52
+ };
53
+ const useGitTemplate = (debounceTime) => {
54
+ var _a, _b;
55
+ const initialTemplate = { title: "", body: "" };
56
+ const selection = useShadowRootSelection(debounceTime);
57
+ const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);
58
+ const url = (_a = editLink == null ? void 0 : editLink.href) != null ? _a : "";
59
+ const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
60
+ if (!selection || !url)
61
+ return initialTemplate;
62
+ const type = (_b = scmIntegrationsApi.byUrl(url)) == null ? void 0 : _b.type;
63
+ if (!type)
64
+ return initialTemplate;
65
+ return {
66
+ title: getTitle(selection),
67
+ body: getBody(selection, resolveBlobUrl(url, type))
68
+ };
69
+ };
70
+ const useGitRepository = () => {
71
+ var _a, _b;
72
+ const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
73
+ const [editLink] = useShadowRootElements([PAGE_EDIT_LINK_SELECTOR]);
74
+ const url = (_a = editLink == null ? void 0 : editLink.href) != null ? _a : "";
75
+ if (!url)
76
+ return null;
77
+ const type = (_b = scmIntegrationsApi.byUrl(url)) == null ? void 0 : _b.type;
78
+ if (!type)
79
+ return null;
80
+ return { ...parseGitUrl(resolveBlobUrl(url, type)), type };
81
+ };
82
+
83
+ const useStyles$1 = makeStyles((theme) => ({
84
+ root: {
85
+ display: "grid",
86
+ gridGap: theme.spacing(1),
87
+ gridAutoFlow: "column",
88
+ justifyContent: "center",
89
+ alignItems: "center",
90
+ color: theme.palette.common.black,
91
+ fontSize: theme.typography.button.fontSize
92
+ }
93
+ }));
94
+ const getIcon = ({ type }) => {
95
+ if (type === "github") {
96
+ return GitHubIcon;
97
+ }
98
+ return BugReportIcon;
99
+ };
100
+ const getName = ({ type }) => {
101
+ if (type === "github") {
102
+ return "Github";
103
+ }
104
+ return "Gitlab";
105
+ };
106
+ const getUrl = (repository, template) => {
107
+ const { title, body } = template;
108
+ const encodedTitle = encodeURIComponent(title);
109
+ const encodedBody = encodeURIComponent(body);
110
+ const { protocol, resource, owner, name, type } = repository;
111
+ const encodedOwner = encodeURIComponent(owner);
112
+ const encodedName = encodeURIComponent(name);
113
+ const url = `${protocol}://${resource}/${encodedOwner}/${encodedName}`;
114
+ if (type === "github") {
115
+ return `${url}/issues/new?title=${encodedTitle}&body=${encodedBody}`;
116
+ }
117
+ return `${url}/issues/new?[title]=${encodedTitle}&[body]=${encodedBody}`;
118
+ };
119
+ const IssueLink = ({ template, repository }) => {
120
+ const classes = useStyles$1();
121
+ const Icon = getIcon(repository);
122
+ const url = getUrl(repository, template);
123
+ return /* @__PURE__ */ React.createElement(Link, {
124
+ className: classes.root,
125
+ to: url,
126
+ target: "_blank"
127
+ }, /* @__PURE__ */ React.createElement(Icon, null), " Open new ", getName(repository), " issue");
128
+ };
129
+
130
+ const useStyles = makeStyles((theme) => ({
131
+ root: {
132
+ transform: "translate(-100%, -100%)",
133
+ position: "absolute",
134
+ padding: theme.spacing(1),
135
+ zIndex: theme.zIndex.tooltip,
136
+ background: theme.palette.common.white
137
+ }
138
+ }));
139
+ const ReportIssueAddon = ({
140
+ debounceTime = 500,
141
+ templateBuilder: buildTemplate
142
+ }) => {
143
+ const classes = useStyles();
144
+ const [style, setStyle] = useState();
145
+ const repository = useGitRepository();
146
+ const defaultTemplate = useGitTemplate(debounceTime);
147
+ const selection = useShadowRootSelection(debounceTime);
148
+ const [mainContent, feedbackLink] = useShadowRootElements([
149
+ PAGE_MAIN_CONTENT_SELECTOR,
150
+ PAGE_FEEDBACK_LINK_SELECTOR
151
+ ]);
152
+ let [feedbackContainer] = useShadowRootElements([
153
+ ADDON_FEEDBACK_CONTAINER_SELECTOR
154
+ ]);
155
+ if (feedbackLink) {
156
+ feedbackLink.style.display = "none";
157
+ }
158
+ useEffect(() => {
159
+ if (!repository || !selection || !selection.containsNode(mainContent, true) || (selection == null ? void 0 : selection.containsNode(feedbackContainer, true))) {
160
+ return;
161
+ }
162
+ const mainContentPosition = mainContent.getBoundingClientRect();
163
+ const selectionPosition = selection.getRangeAt(0).getBoundingClientRect();
164
+ setStyle({
165
+ top: `${selectionPosition.top - mainContentPosition.top - 16}px`,
166
+ left: `${selectionPosition.left + selectionPosition.width / 2}px`
167
+ });
168
+ }, [selection, mainContent, feedbackContainer]);
169
+ if (!selection || !repository)
170
+ return null;
171
+ if (!feedbackContainer) {
172
+ feedbackContainer = document.createElement("div");
173
+ feedbackContainer.setAttribute("id", ADDON_FEEDBACK_CONTAINER_ID);
174
+ mainContent.prepend(feedbackContainer);
175
+ }
176
+ return /* @__PURE__ */ React.createElement(Portal, {
177
+ container: feedbackContainer
178
+ }, /* @__PURE__ */ React.createElement(Paper, {
179
+ "data-testid": "report-issue-addon",
180
+ className: classes.root,
181
+ style
182
+ }, /* @__PURE__ */ React.createElement(IssueLink, {
183
+ repository,
184
+ template: buildTemplate ? buildTemplate({ selection }) : defaultTemplate
185
+ })));
186
+ };
187
+
188
+ const techdocsModuleAddonsContribPlugin = createPlugin({
189
+ id: "techdocsModuleAddonsContrib"
190
+ });
191
+ const ReportIssue = techdocsModuleAddonsContribPlugin.provide(createTechDocsAddonExtension({
192
+ name: "ReportIssue",
193
+ location: TechDocsAddonLocations.Content,
194
+ component: ReportIssueAddon
195
+ }));
196
+
197
+ export { ReportIssue, techdocsModuleAddonsContribPlugin };
198
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/ReportIssue/constants.ts","../src/ReportIssue/hooks.ts","../src/ReportIssue/IssueLink.tsx","../src/ReportIssue/ReportIssue.tsx","../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\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","/*\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 { 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 = (selection: Selection, markdownUrl: string) => {\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 `Backstage 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\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)),\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","/*\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 const encodedOwner = encodeURIComponent(owner);\n const encodedName = encodeURIComponent(name);\n\n const url = `${protocol}://${resource}/${encodedOwner}/${encodedName}`;\n if (type === 'github') {\n return `${url}/issues/new?title=${encodedTitle}&body=${encodedBody}`;\n }\n return `${url}/issues/new?[title]=${encodedTitle}&[body]=${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","/*\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 * @public\n */\nexport type ReportIssueProps = {\n debounceTime?: number;\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 setStyle({\n top: `${selectionPosition.top - mainContentPosition.top - 16}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 (!selection || !repository) 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","/*\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 { ReportIssueAddon, ReportIssueProps } from './ReportIssue';\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 select text and open GitHub/Gitlab issues\n *\n * @public\n */\n\nexport const ReportIssue = techdocsModuleAddonsContribPlugin.provide(\n createTechDocsAddonExtension<ReportIssueProps>({\n name: 'ReportIssue',\n location: TechDocsAddonLocations.Content,\n component: ReportIssueAddon,\n }),\n);\n"],"names":["useStyles"],"mappings":";;;;;;;;;;AAAO,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AAC5D,MAAM,iCAAiC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC;AAC5E,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAC5D,MAAM,2BAA2B,GAAG,+BAA+B,CAAC;AACpE,MAAM,0BAA0B,GAAG,wCAAwC;;ACQlF,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK;AACtC,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE;AACzB,IAAI,OAAO,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7C,GAAG,MAAM,IAAI,IAAI,KAAK,QAAQ,EAAE;AAChC,IAAI,OAAO,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7C,GAAG;AACH,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,EAAE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AACK,MAAM,QAAQ,GAAG,CAAC,SAAS,KAAK;AACvC,EAAE,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACrD,EAAE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;AACnD,EAAE,OAAO,CAAC,wBAAwB,EAAE,I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D,IAAI,aAAa,EAAE,oBAAoB;AACvC,IAAI,SAAS,EAAE,OAAO,CAAC,IAAI;AAC3B,IAAI,KAAK;AACT,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE;AACpD,IAAI,UAAU;AACd,IAAI,QAAQ,EAAE,aAAa,GAAG,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,eAAe;AAC5E,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;;AChEW,MAAC,iCAAiC,GAAG,YAAY,CAAC;AAC9D,EAAE,EAAE,EAAE,6BAA6B;AACnC,CAAC,EAAE;AACS,MAAC,WAAW,GAAG,iCAAiC,CAAC,OAAO,CAAC,4BAA4B,CAAC;AAClG,EAAE,IAAI,EAAE,aAAa;AACrB,EAAE,QAAQ,EAAE,sBAAsB,CAAC,OAAO;AAC1C,EAAE,SAAS,EAAE,gBAAgB;AAC7B,CAAC,CAAC;;;;"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@backstage/plugin-techdocs-module-addons-contrib",
3
+ "description": "Plugin module for contributed TechDocs Addons",
4
+ "version": "0.0.0-nightly-20220426024700",
5
+ "main": "dist/index.esm.js",
6
+ "types": "dist/index.d.ts",
7
+ "license": "Apache-2.0",
8
+ "private": false,
9
+ "publishConfig": {
10
+ "access": "public",
11
+ "main": "dist/index.esm.js",
12
+ "types": "dist/index.d.ts"
13
+ },
14
+ "backstage": {
15
+ "role": "frontend-plugin-module"
16
+ },
17
+ "homepage": "https://backstage.io",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/backstage/backstage",
21
+ "directory": "plugins/techdocs-module-addons-contrib"
22
+ },
23
+ "keywords": [
24
+ "backstage",
25
+ "techdocs"
26
+ ],
27
+ "scripts": {
28
+ "start": "backstage-cli package start",
29
+ "build": "backstage-cli package build",
30
+ "lint": "backstage-cli package lint",
31
+ "test": "backstage-cli package test",
32
+ "clean": "backstage-cli package clean",
33
+ "prepack": "backstage-cli package prepack",
34
+ "postpack": "backstage-cli package postpack"
35
+ },
36
+ "dependencies": {
37
+ "@backstage/core-components": "^0.9.3",
38
+ "@backstage/core-plugin-api": "^1.0.1",
39
+ "@backstage/integration": "^0.0.0-nightly-20220426024700",
40
+ "@backstage/integration-react": "^0.0.0-nightly-20220426024700",
41
+ "@backstage/plugin-techdocs-react": "^0.0.0-nightly-20220426024700",
42
+ "@backstage/theme": "^0.2.15",
43
+ "@material-ui/core": "^4.9.13",
44
+ "@material-ui/icons": "^4.9.1",
45
+ "@material-ui/lab": "4.0.0-alpha.57",
46
+ "git-url-parse": "^11.6.0",
47
+ "react-use": "^17.2.4"
48
+ },
49
+ "peerDependencies": {
50
+ "react": "^16.13.1 || ^17.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "@backstage/cli": "^0.0.0-nightly-20220426024700",
54
+ "@backstage/core-app-api": "^1.0.1",
55
+ "@backstage/dev-utils": "^1.0.1",
56
+ "@backstage/test-utils": "^0.0.0-nightly-20220426024700",
57
+ "@testing-library/jest-dom": "^5.10.1",
58
+ "@testing-library/react": "^12.1.3",
59
+ "@testing-library/user-event": "^14.0.0",
60
+ "@types/jest": "^26.0.7",
61
+ "@types/node": "^16.11.26",
62
+ "@types/react": "^16.13.1 || ^17.0.0",
63
+ "msw": "^0.35.0",
64
+ "cross-fetch": "^3.1.5"
65
+ },
66
+ "files": [
67
+ "dist"
68
+ ]
69
+ }