@backstage/plugin-techdocs-module-addons-contrib 0.0.0-nightly-20220510022953 → 0.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -11
- package/LICENSE +201 -0
- package/dist/index.d.ts +40 -1
- package/dist/index.esm.js +176 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,46 @@
|
|
1
1
|
# @backstage/plugin-techdocs-module-addons-contrib
|
2
2
|
|
3
|
-
## 0.
|
3
|
+
## 0.1.0-next.2
|
4
4
|
|
5
|
-
###
|
5
|
+
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- 52419be116: Create a TechDocs `<TextSize/>` addon that allows users to set a font size in the browser's local storage for the text of documentation pages.
|
8
8
|
|
9
|
-
|
9
|
+
Here's an example on how to use it in a Backstage app:
|
10
10
|
|
11
|
-
|
11
|
+
```diff
|
12
|
+
import {
|
13
|
+
DefaultTechDocsHome,
|
14
|
+
TechDocsIndexPage,
|
15
|
+
TechDocsReaderPage,
|
16
|
+
} from '@backstage/plugin-techdocs';
|
17
|
+
import { TechDocsAddons } from '@backstage/plugin-techdocs-react/alpha';
|
18
|
+
+import { TextSize } from '@backstage/plugin-techdocs-module-addons-contrib';
|
19
|
+
|
20
|
+
const AppRoutes = () => {
|
21
|
+
<FlatRoutes>
|
22
|
+
// other plugin routes
|
23
|
+
<Route path="/docs" element={<TechDocsIndexPage />}>
|
24
|
+
<DefaultTechDocsHome />
|
25
|
+
</Route>
|
26
|
+
<Route
|
27
|
+
path="/docs/:namespace/:kind/:name/*"
|
28
|
+
element={<TechDocsReaderPage />}
|
29
|
+
>
|
30
|
+
<TechDocsAddons>
|
31
|
+
+ <TextSize />
|
32
|
+
</TechDocsAddons>
|
33
|
+
</Route>
|
34
|
+
</FlatRoutes>;
|
35
|
+
};
|
36
|
+
```
|
12
37
|
|
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
38
|
- Updated dependencies
|
15
|
-
- @backstage/core-components@0.
|
16
|
-
- @backstage/
|
17
|
-
- @backstage/
|
18
|
-
- @backstage/integration
|
19
|
-
- @backstage/
|
39
|
+
- @backstage/core-components@0.9.4-next.1
|
40
|
+
- @backstage/plugin-techdocs-react@0.1.1-next.2
|
41
|
+
- @backstage/core-plugin-api@1.0.2-next.1
|
42
|
+
- @backstage/integration@1.2.0-next.1
|
43
|
+
- @backstage/integration-react@1.1.0-next.2
|
20
44
|
|
21
45
|
## 0.1.0-next.1
|
22
46
|
|
package/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2020 The Backstage Authors
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
package/dist/index.d.ts
CHANGED
@@ -35,5 +35,44 @@ declare const techdocsModuleAddonsContribPlugin: _backstage_core_plugin_api.Back
|
|
35
35
|
* @public
|
36
36
|
*/
|
37
37
|
declare const ReportIssue: (props: ReportIssueProps) => JSX.Element | null;
|
38
|
+
/**
|
39
|
+
* 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.
|
40
|
+
*
|
41
|
+
* @remarks
|
42
|
+
* 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.
|
43
|
+
*
|
44
|
+
* @example
|
45
|
+
* Here's a simple example:
|
46
|
+
* ```
|
47
|
+
* import {
|
48
|
+
* DefaultTechDocsHome,
|
49
|
+
* TechDocsIndexPage,
|
50
|
+
* TechDocsReaderPage,
|
51
|
+
* } from '@backstage/plugin-techdocs';
|
52
|
+
* import { TechDocsAddons } from '@backstage/plugin-techdocs-react/alpha';
|
53
|
+
* import { TextSize } from '@backstage/plugin-techdocs-module-addons-contrib';
|
54
|
+
*
|
55
|
+
*
|
56
|
+
* const AppRoutes = () => {
|
57
|
+
* <FlatRoutes>
|
58
|
+
* // other plugin routes
|
59
|
+
* <Route path="/docs" element={<TechDocsIndexPage />}>
|
60
|
+
* <DefaultTechDocsHome />
|
61
|
+
* </Route>
|
62
|
+
* <Route
|
63
|
+
* path="/docs/:namespace/:kind/:name/*"
|
64
|
+
* element={<TechDocsReaderPage />}
|
65
|
+
* >
|
66
|
+
* <TechDocsAddons>
|
67
|
+
* <TextSize />
|
68
|
+
* </TechDocsAddons>
|
69
|
+
* </Route>
|
70
|
+
* </FlatRoutes>;
|
71
|
+
* };
|
72
|
+
* ```
|
73
|
+
*
|
74
|
+
* @public
|
75
|
+
*/
|
76
|
+
declare const TextSize: (props: unknown) => JSX.Element | null;
|
38
77
|
|
39
|
-
export { ReportIssue, ReportIssueProps, ReportIssueTemplate, ReportIssueTemplateBuilder, techdocsModuleAddonsContribPlugin };
|
78
|
+
export { ReportIssue, ReportIssueProps, ReportIssueTemplate, ReportIssueTemplateBuilder, TextSize, techdocsModuleAddonsContribPlugin };
|
package/dist/index.esm.js
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
import { useApi, createPlugin } from '@backstage/core-plugin-api';
|
2
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';
|
3
|
+
import React, { useState, useEffect, useMemo, useCallback } from 'react';
|
4
|
+
import { makeStyles, Portal, Paper, withStyles, Slider, useTheme, MenuItem, ListItemText, Typography, Box, IconButton } from '@material-ui/core';
|
5
5
|
import parseGitUrl from 'git-url-parse';
|
6
6
|
import { replaceGitHubUrlType, replaceGitLabUrlType } from '@backstage/integration';
|
7
7
|
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
8
8
|
import BugReportIcon from '@material-ui/icons/BugReport';
|
9
9
|
import { Link, GitHubIcon } from '@backstage/core-components';
|
10
|
+
import AddIcon from '@material-ui/icons/Add';
|
11
|
+
import RemoveIcon from '@material-ui/icons/Remove';
|
10
12
|
|
11
13
|
const ADDON_FEEDBACK_CONTAINER_ID = "techdocs-report-issue";
|
12
14
|
const ADDON_FEEDBACK_CONTAINER_SELECTOR = `#${ADDON_FEEDBACK_CONTAINER_ID}`;
|
@@ -80,7 +82,7 @@ const useGitRepository = () => {
|
|
80
82
|
return { ...parseGitUrl(resolveBlobUrl(url, type)), type };
|
81
83
|
};
|
82
84
|
|
83
|
-
const useStyles$
|
85
|
+
const useStyles$2 = makeStyles((theme) => ({
|
84
86
|
root: {
|
85
87
|
display: "grid",
|
86
88
|
gridGap: theme.spacing(1),
|
@@ -117,7 +119,7 @@ const getUrl = (repository, template) => {
|
|
117
119
|
return `${url}/issues/new?issue[title]=${encodedTitle}&issue[description]=${encodedBody}`;
|
118
120
|
};
|
119
121
|
const IssueLink = ({ template, repository }) => {
|
120
|
-
const classes = useStyles$
|
122
|
+
const classes = useStyles$2();
|
121
123
|
const Icon = getIcon(repository);
|
122
124
|
const url = getUrl(repository, template);
|
123
125
|
return /* @__PURE__ */ React.createElement(Link, {
|
@@ -127,7 +129,7 @@ const IssueLink = ({ template, repository }) => {
|
|
127
129
|
}, /* @__PURE__ */ React.createElement(Icon, null), " Open new ", getName(repository), " issue");
|
128
130
|
};
|
129
131
|
|
130
|
-
const useStyles = makeStyles((theme) => ({
|
132
|
+
const useStyles$1 = makeStyles((theme) => ({
|
131
133
|
root: {
|
132
134
|
transform: "translate(-100%, -100%)",
|
133
135
|
position: "absolute",
|
@@ -140,7 +142,7 @@ const ReportIssueAddon = ({
|
|
140
142
|
debounceTime = 500,
|
141
143
|
templateBuilder: buildTemplate
|
142
144
|
}) => {
|
143
|
-
const classes = useStyles();
|
145
|
+
const classes = useStyles$1();
|
144
146
|
const [style, setStyle] = useState();
|
145
147
|
const repository = useGitRepository();
|
146
148
|
const defaultTemplate = useGitTemplate(debounceTime);
|
@@ -185,6 +187,168 @@ const ReportIssueAddon = ({
|
|
185
187
|
})));
|
186
188
|
};
|
187
189
|
|
190
|
+
const boxShadow = "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)";
|
191
|
+
const StyledSlider = withStyles((theme) => ({
|
192
|
+
root: {
|
193
|
+
height: 2,
|
194
|
+
padding: "15px 0"
|
195
|
+
},
|
196
|
+
thumb: {
|
197
|
+
height: 18,
|
198
|
+
width: 18,
|
199
|
+
backgroundColor: theme.palette.common.white,
|
200
|
+
boxShadow,
|
201
|
+
marginTop: -9,
|
202
|
+
marginLeft: -9,
|
203
|
+
"&:focus, &:hover, &$active": {
|
204
|
+
boxShadow: "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)",
|
205
|
+
"@media (hover: none)": {
|
206
|
+
boxShadow
|
207
|
+
}
|
208
|
+
}
|
209
|
+
},
|
210
|
+
active: {},
|
211
|
+
valueLabel: {
|
212
|
+
top: "100%",
|
213
|
+
left: "50%",
|
214
|
+
transform: "scale(1) translate(-50%, -5px) !important",
|
215
|
+
"& *": {
|
216
|
+
color: theme.palette.common.black,
|
217
|
+
fontSize: theme.typography.caption.fontSize,
|
218
|
+
background: "transparent"
|
219
|
+
}
|
220
|
+
},
|
221
|
+
track: {
|
222
|
+
height: 2
|
223
|
+
},
|
224
|
+
rail: {
|
225
|
+
height: 2,
|
226
|
+
opacity: 0.5
|
227
|
+
},
|
228
|
+
mark: {
|
229
|
+
height: 10,
|
230
|
+
width: 1,
|
231
|
+
marginTop: -4
|
232
|
+
},
|
233
|
+
markActive: {
|
234
|
+
opacity: 1,
|
235
|
+
backgroundColor: "currentColor"
|
236
|
+
}
|
237
|
+
}))(Slider);
|
238
|
+
const settings = {
|
239
|
+
key: "techdocs.addons.settings.textsize",
|
240
|
+
defaultValue: 100
|
241
|
+
};
|
242
|
+
const marks = [
|
243
|
+
{
|
244
|
+
value: 90
|
245
|
+
},
|
246
|
+
{
|
247
|
+
value: 100
|
248
|
+
},
|
249
|
+
{
|
250
|
+
value: 115
|
251
|
+
},
|
252
|
+
{
|
253
|
+
value: 130
|
254
|
+
},
|
255
|
+
{
|
256
|
+
value: 150
|
257
|
+
}
|
258
|
+
];
|
259
|
+
const useStyles = makeStyles((theme) => ({
|
260
|
+
container: {
|
261
|
+
color: theme.palette.textSubtle,
|
262
|
+
display: "flex",
|
263
|
+
alignItems: "center",
|
264
|
+
margin: 0,
|
265
|
+
minWidth: 200
|
266
|
+
},
|
267
|
+
menuItem: {
|
268
|
+
"&:hover": {
|
269
|
+
background: "transparent"
|
270
|
+
}
|
271
|
+
},
|
272
|
+
decreaseButton: {
|
273
|
+
marginRight: theme.spacing(1)
|
274
|
+
},
|
275
|
+
increaseButton: {
|
276
|
+
marginLeft: theme.spacing(1)
|
277
|
+
}
|
278
|
+
}));
|
279
|
+
const TextSizeAddon = () => {
|
280
|
+
const classes = useStyles();
|
281
|
+
const theme = useTheme();
|
282
|
+
const [body] = useShadowRootElements(["body"]);
|
283
|
+
const [value, setValue] = useState(() => {
|
284
|
+
const initialValue = localStorage == null ? void 0 : localStorage.getItem(settings.key);
|
285
|
+
return initialValue ? parseInt(initialValue, 10) : settings.defaultValue;
|
286
|
+
});
|
287
|
+
const values = useMemo(() => marks.map((mark) => mark.value), []);
|
288
|
+
const index = useMemo(() => values.indexOf(value), [values, value]);
|
289
|
+
const min = useMemo(() => values[0], [values]);
|
290
|
+
const max = useMemo(() => values[values.length - 1], [values]);
|
291
|
+
const getValueText = useCallback(() => `${value}%`, [value]);
|
292
|
+
const handleChangeCommitted = useCallback((_event, newValue) => {
|
293
|
+
if (!Array.isArray(newValue)) {
|
294
|
+
setValue(newValue);
|
295
|
+
localStorage == null ? void 0 : localStorage.setItem(settings.key, String(newValue));
|
296
|
+
}
|
297
|
+
}, [setValue]);
|
298
|
+
const handleDecreaseClick = useCallback((event) => {
|
299
|
+
handleChangeCommitted(event, values[index - 1]);
|
300
|
+
}, [index, values, handleChangeCommitted]);
|
301
|
+
const handleIncreaseClick = useCallback((event) => {
|
302
|
+
handleChangeCommitted(event, values[index + 1]);
|
303
|
+
}, [index, values, handleChangeCommitted]);
|
304
|
+
useEffect(() => {
|
305
|
+
var _a, _b;
|
306
|
+
if (!body)
|
307
|
+
return;
|
308
|
+
const htmlFontSize = (_b = (_a = theme.typography) == null ? void 0 : _a.htmlFontSize) != null ? _b : 16;
|
309
|
+
body.style.setProperty("--md-typeset-font-size", `${htmlFontSize * (value / 100)}px`);
|
310
|
+
}, [body, value, theme]);
|
311
|
+
return /* @__PURE__ */ React.createElement(MenuItem, {
|
312
|
+
className: classes.menuItem,
|
313
|
+
button: true,
|
314
|
+
disableRipple: true
|
315
|
+
}, /* @__PURE__ */ React.createElement(ListItemText, {
|
316
|
+
primary: /* @__PURE__ */ React.createElement(Typography, {
|
317
|
+
variant: "subtitle2",
|
318
|
+
color: "textPrimary"
|
319
|
+
}, "Text size"),
|
320
|
+
secondary: /* @__PURE__ */ React.createElement(Box, {
|
321
|
+
className: classes.container
|
322
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
323
|
+
className: classes.decreaseButton,
|
324
|
+
size: "small",
|
325
|
+
edge: "start",
|
326
|
+
disabled: value === min,
|
327
|
+
onClick: handleDecreaseClick,
|
328
|
+
"aria-label": "Decrease text size"
|
329
|
+
}, /* @__PURE__ */ React.createElement(RemoveIcon, null)), /* @__PURE__ */ React.createElement(StyledSlider, {
|
330
|
+
value,
|
331
|
+
"aria-labelledby": "text-size-slider",
|
332
|
+
getAriaValueText: getValueText,
|
333
|
+
valueLabelDisplay: "on",
|
334
|
+
valueLabelFormat: getValueText,
|
335
|
+
marks,
|
336
|
+
step: null,
|
337
|
+
min,
|
338
|
+
max,
|
339
|
+
onChangeCommitted: handleChangeCommitted
|
340
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
341
|
+
className: classes.increaseButton,
|
342
|
+
size: "small",
|
343
|
+
edge: "end",
|
344
|
+
disabled: value === max,
|
345
|
+
onClick: handleIncreaseClick,
|
346
|
+
"aria-label": "Increase text size"
|
347
|
+
}, /* @__PURE__ */ React.createElement(AddIcon, null))),
|
348
|
+
disableTypography: true
|
349
|
+
}));
|
350
|
+
};
|
351
|
+
|
188
352
|
const techdocsModuleAddonsContribPlugin = createPlugin({
|
189
353
|
id: "techdocsModuleAddonsContrib"
|
190
354
|
});
|
@@ -193,6 +357,11 @@ const ReportIssue = techdocsModuleAddonsContribPlugin.provide(createTechDocsAddo
|
|
193
357
|
location: TechDocsAddonLocations.Content,
|
194
358
|
component: ReportIssueAddon
|
195
359
|
}));
|
360
|
+
const TextSize = techdocsModuleAddonsContribPlugin.provide(createTechDocsAddonExtension({
|
361
|
+
name: "TextSize",
|
362
|
+
location: TechDocsAddonLocations.Settings,
|
363
|
+
component: TextSizeAddon
|
364
|
+
}));
|
196
365
|
|
197
|
-
export { ReportIssue, techdocsModuleAddonsContribPlugin };
|
366
|
+
export { ReportIssue, TextSize, techdocsModuleAddonsContribPlugin };
|
198
367
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
@@ -1 +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?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","/*\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,EA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{"version":3,"file":"index.esm.js","sources":["../src/ReportIssue/constants.ts","../src/ReportIssue/hooks.ts","../src/ReportIssue/IssueLink.tsx","../src/ReportIssue/ReportIssue.tsx","../src/TextSize/TextSize.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?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","/*\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 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} from '@material-ui/core';\nimport AddIcon from '@material-ui/icons/Add';\nimport RemoveIcon from '@material-ui/icons/Remove';\n\nimport { BackstageTheme } from '@backstage/theme';\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.common.black,\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: BackstageTheme) => ({\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<BackstageTheme>();\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 BackstageTheme['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","/*\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';\nimport { TextSizeAddon } from './TextSize';\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\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/alpha';\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"],"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,CA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ACQ,MAAC,QAAQ,GAAG,iCAAiC,CAAC,OAAO,CAAC,4BAA4B,CAAC;AAC/F,EAAE,IAAI,EAAE,UAAU;AAClB,EAAE,QAAQ,EAAE,sBAAsB,CAAC,QAAQ;AAC3C,EAAE,SAAS,EAAE,aAAa;AAC1B,CAAC,CAAC;;;;"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@backstage/plugin-techdocs-module-addons-contrib",
|
3
3
|
"description": "Plugin module for contributed TechDocs Addons",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.1.0-next.2",
|
5
5
|
"main": "dist/index.esm.js",
|
6
6
|
"types": "dist/index.d.ts",
|
7
7
|
"license": "Apache-2.0",
|
@@ -34,11 +34,11 @@
|
|
34
34
|
"postpack": "backstage-cli package postpack"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@backstage/core-components": "^0.
|
38
|
-
"@backstage/core-plugin-api": "^
|
39
|
-
"@backstage/integration": "^
|
40
|
-
"@backstage/integration-react": "^
|
41
|
-
"@backstage/plugin-techdocs-react": "^0.
|
37
|
+
"@backstage/core-components": "^0.9.4-next.1",
|
38
|
+
"@backstage/core-plugin-api": "^1.0.2-next.1",
|
39
|
+
"@backstage/integration": "^1.2.0-next.1",
|
40
|
+
"@backstage/integration-react": "^1.1.0-next.2",
|
41
|
+
"@backstage/plugin-techdocs-react": "^0.1.1-next.2",
|
42
42
|
"@backstage/theme": "^0.2.15",
|
43
43
|
"@material-ui/core": "^4.9.13",
|
44
44
|
"@material-ui/icons": "^4.9.1",
|
@@ -50,21 +50,22 @@
|
|
50
50
|
"react": "^16.13.1 || ^17.0.0"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
|
-
"@backstage/cli": "^0.
|
54
|
-
"@backstage/core-app-api": "^
|
55
|
-
"@backstage/dev-utils": "^
|
56
|
-
"@backstage/plugin-techdocs-addons-test-utils": "^0.
|
57
|
-
"@backstage/test-utils": "^
|
53
|
+
"@backstage/cli": "^0.17.1-next.2",
|
54
|
+
"@backstage/core-app-api": "^1.0.2-next.1",
|
55
|
+
"@backstage/dev-utils": "^1.0.2-next.2",
|
56
|
+
"@backstage/plugin-techdocs-addons-test-utils": "^0.1.0-next.1",
|
57
|
+
"@backstage/test-utils": "^1.1.0-next.2",
|
58
58
|
"@testing-library/jest-dom": "^5.10.1",
|
59
59
|
"@testing-library/react": "^12.1.3",
|
60
60
|
"@testing-library/user-event": "^14.0.0",
|
61
61
|
"@types/jest": "^26.0.7",
|
62
62
|
"@types/node": "^16.11.26",
|
63
63
|
"@types/react": "^16.13.1 || ^17.0.0",
|
64
|
-
"
|
65
|
-
"
|
64
|
+
"cross-fetch": "^3.1.5",
|
65
|
+
"msw": "^0.35.0"
|
66
66
|
},
|
67
67
|
"files": [
|
68
68
|
"dist"
|
69
|
-
]
|
69
|
+
],
|
70
|
+
"gitHead": "cfbf5762d7d91eee18999306b21d63840400ee29"
|
70
71
|
}
|