@backstage/plugin-techdocs-react 0.1.1-next.2 → 1.0.0

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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @backstage/plugin-techdocs-react
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 0ad901569f: The TechDocs Addon framework is now generally available.
8
+
9
+ ### Patch Changes
10
+
11
+ - 52419be116: Create a new addon location called "Settings", it is designed for addons that allow users to customize the reading experience in documentation pages.
12
+
13
+ Usage example:
14
+
15
+ ```tsx
16
+ const TextSize = techdocsModuleAddonsContribPlugin.provide(
17
+ createTechDocsAddonExtension({
18
+ name: 'TextSize',
19
+ location: TechDocsAddonLocations.Settings,
20
+ component: TextSizeAddon,
21
+ }),
22
+ );
23
+ ```
24
+
25
+ - c25e880e36: Added overload signatures for `createTechDocsAddonExtension` to handle TechDocs addons without props.
26
+ - 52fddad92d: The `TechDocsStorageApi` and its associated ref are now exported by `@backstage/plugin-techdocs-react`. The API interface, ref, and types are now deprecated in `@backstage/plugin-techdocs` and will be removed in a future release.
27
+ - 075a9a067b: Updated the return type of `createTechDocsAddonExtension` to better reflect the fact that passing children to Addon components is not a valid use-case.
28
+ - Updated dependencies
29
+ - @backstage/core-components@0.9.4
30
+ - @backstage/core-plugin-api@1.0.2
31
+ - @backstage/catalog-model@1.0.2
32
+
3
33
  ## 0.1.1-next.2
4
34
 
5
35
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-react",
3
- "version": "0.1.1-next.2",
3
+ "version": "1.0.0",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -16,15 +16,16 @@ import { ReactNode } from 'react';
16
16
  import { SetStateAction } from 'react';
17
17
 
18
18
  /**
19
- * Create a TechDocs addon.
20
- * @alpha
19
+ * Create a TechDocs addon overload signature without props.
20
+ * @public
21
21
  */
22
- export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
22
+ export declare function createTechDocsAddonExtension(options: TechDocsAddonOptions): Extension<() => JSX.Element | null>;
23
23
 
24
24
  /**
25
- * @alpha
25
+ * Create a TechDocs addon overload signature with props.
26
+ * @public
26
27
  */
27
- export declare const defaultTechDocsReaderPageValue: TechDocsReaderPageValue;
28
+ export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
28
29
 
29
30
  /**
30
31
  * The outcome of a docs sync operation.
@@ -35,13 +36,13 @@ export declare type SyncResult = 'cached' | 'updated';
35
36
 
36
37
  /**
37
38
  * Marks the <TechDocsAddons> registry component.
38
- * @alpha
39
+ * @public
39
40
  */
40
41
  export declare const TECHDOCS_ADDONS_WRAPPER_KEY = "techdocs.addons.wrapper.v1";
41
42
 
42
43
  /**
43
44
  * Locations for which TechDocs addons may be declared and rendered.
44
- * @alpha
45
+ * @public
45
46
  */
46
47
  export declare const TechDocsAddonLocations: Readonly<{
47
48
  /**
@@ -76,7 +77,7 @@ export declare const TechDocsAddonLocations: Readonly<{
76
77
 
77
78
  /**
78
79
  * Options for creating a TechDocs addon.
79
- * @alpha
80
+ * @public
80
81
  */
81
82
  export declare type TechDocsAddonOptions<TAddonProps = {}> = {
82
83
  name: string;
@@ -86,7 +87,7 @@ export declare type TechDocsAddonOptions<TAddonProps = {}> = {
86
87
 
87
88
  /**
88
89
  * TechDocs Addon registry.
89
- * @alpha
90
+ * @public
90
91
  */
91
92
  export declare const TechDocsAddons: React_2.ComponentType;
92
93
 
@@ -196,7 +197,7 @@ export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
196
197
  /**
197
198
  * Hook for use within TechDocs addons that provides access to the underlying
198
199
  * shadow root of the current page, allowing the DOM within to be mutated.
199
- * @alpha
200
+ * @public
200
201
  */
201
202
  export declare const useShadowRoot: () => ShadowRoot | undefined;
202
203
 
@@ -204,19 +205,19 @@ export declare const useShadowRoot: () => ShadowRoot | undefined;
204
205
  * Convenience hook for use within TechDocs addons that provides access to
205
206
  * elements that match a given selector within the shadow root.
206
207
  *
207
- * @alpha
208
+ * @public
208
209
  */
209
210
  export declare const useShadowRootElements: <TReturnedElement extends HTMLElement = HTMLElement>(selectors: string[]) => TReturnedElement[];
210
211
 
211
212
  /**
212
213
  * Hook for retreiving a selection within the ShadowRoot.
213
- * @alpha
214
+ * @public
214
215
  */
215
216
  export declare const useShadowRootSelection: (wait?: number) => Selection | null;
216
217
 
217
218
  /**
218
219
  * hook to use addons in components
219
- * @alpha
220
+ * @public
220
221
  */
221
222
  export declare const useTechDocsAddons: () => {
222
223
  renderComponentByName: (name: string) => JSX.Element | null;
@@ -225,7 +226,7 @@ export declare const useTechDocsAddons: () => {
225
226
 
226
227
  /**
227
228
  * Hook used to get access to shared state between reader page components.
228
- * @alpha
229
+ * @public
229
230
  */
230
231
  export declare const useTechDocsReaderPage: () => TechDocsReaderPageValue;
231
232
 
@@ -15,9 +15,17 @@ import { default as React_2 } from 'react';
15
15
  import { ReactNode } from 'react';
16
16
  import { SetStateAction } from 'react';
17
17
 
18
- /* Excluded from this release type: createTechDocsAddonExtension */
18
+ /**
19
+ * Create a TechDocs addon overload signature without props.
20
+ * @public
21
+ */
22
+ export declare function createTechDocsAddonExtension(options: TechDocsAddonOptions): Extension<() => JSX.Element | null>;
19
23
 
20
- /* Excluded from this release type: defaultTechDocsReaderPageValue */
24
+ /**
25
+ * Create a TechDocs addon overload signature with props.
26
+ * @public
27
+ */
28
+ export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
21
29
 
22
30
  /**
23
31
  * The outcome of a docs sync operation.
@@ -26,13 +34,62 @@ import { SetStateAction } from 'react';
26
34
  */
27
35
  export declare type SyncResult = 'cached' | 'updated';
28
36
 
29
- /* Excluded from this release type: TECHDOCS_ADDONS_WRAPPER_KEY */
37
+ /**
38
+ * Marks the <TechDocsAddons> registry component.
39
+ * @public
40
+ */
41
+ export declare const TECHDOCS_ADDONS_WRAPPER_KEY = "techdocs.addons.wrapper.v1";
30
42
 
31
- /* Excluded from this release type: TechDocsAddonLocations */
43
+ /**
44
+ * Locations for which TechDocs addons may be declared and rendered.
45
+ * @public
46
+ */
47
+ export declare const TechDocsAddonLocations: Readonly<{
48
+ /**
49
+ * These addons fill up the header from the right, on the same line as the
50
+ * title.
51
+ */
52
+ readonly Header: "Header";
53
+ /**
54
+ * These addons appear below the header and above all content; tooling addons
55
+ * can be inserted for convenience.
56
+ */
57
+ readonly Subheader: "Subheader";
58
+ /**
59
+ * These addons are items added to the settings menu list and are designed to make
60
+ * the reader experience customizable, for example accessibility options
61
+ */
62
+ readonly Settings: "Settings";
63
+ /**
64
+ * These addons appear left of the content and above the navigation.
65
+ */
66
+ readonly PrimarySidebar: "PrimarySidebar";
67
+ /**
68
+ * These addons appear right of the content and above the table of contents.
69
+ */
70
+ readonly SecondarySidebar: "SecondarySidebar";
71
+ /**
72
+ * A virtual location which allows mutation of all content within the shadow
73
+ * root by transforming DOM nodes. These addons should return null on render.
74
+ */
75
+ readonly Content: "Content";
76
+ }>;
32
77
 
33
- /* Excluded from this release type: TechDocsAddonOptions */
78
+ /**
79
+ * Options for creating a TechDocs addon.
80
+ * @public
81
+ */
82
+ export declare type TechDocsAddonOptions<TAddonProps = {}> = {
83
+ name: string;
84
+ location: keyof typeof TechDocsAddonLocations;
85
+ component: ComponentType<TAddonProps>;
86
+ };
34
87
 
35
- /* Excluded from this release type: TechDocsAddons */
88
+ /**
89
+ * TechDocs Addon registry.
90
+ * @public
91
+ */
92
+ export declare const TechDocsAddons: React_2.ComponentType;
36
93
 
37
94
  /**
38
95
  * API to talk to techdocs-backend.
@@ -137,14 +194,40 @@ export declare interface TechDocsStorageApi {
137
194
  */
138
195
  export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
139
196
 
140
- /* Excluded from this release type: useShadowRoot */
197
+ /**
198
+ * Hook for use within TechDocs addons that provides access to the underlying
199
+ * shadow root of the current page, allowing the DOM within to be mutated.
200
+ * @public
201
+ */
202
+ export declare const useShadowRoot: () => ShadowRoot | undefined;
141
203
 
142
- /* Excluded from this release type: useShadowRootElements */
204
+ /**
205
+ * Convenience hook for use within TechDocs addons that provides access to
206
+ * elements that match a given selector within the shadow root.
207
+ *
208
+ * @public
209
+ */
210
+ export declare const useShadowRootElements: <TReturnedElement extends HTMLElement = HTMLElement>(selectors: string[]) => TReturnedElement[];
143
211
 
144
- /* Excluded from this release type: useShadowRootSelection */
212
+ /**
213
+ * Hook for retreiving a selection within the ShadowRoot.
214
+ * @public
215
+ */
216
+ export declare const useShadowRootSelection: (wait?: number) => Selection | null;
145
217
 
146
- /* Excluded from this release type: useTechDocsAddons */
218
+ /**
219
+ * hook to use addons in components
220
+ * @public
221
+ */
222
+ export declare const useTechDocsAddons: () => {
223
+ renderComponentByName: (name: string) => JSX.Element | null;
224
+ renderComponentsByLocation: (location: keyof typeof TechDocsAddonLocations) => (JSX.Element | null)[] | null;
225
+ };
147
226
 
148
- /* Excluded from this release type: useTechDocsReaderPage */
227
+ /**
228
+ * Hook used to get access to shared state between reader page components.
229
+ * @public
230
+ */
231
+ export declare const useTechDocsReaderPage: () => TechDocsReaderPageValue;
149
232
 
150
233
  export { }
package/dist/index.d.ts CHANGED
@@ -15,9 +15,17 @@ import { default as React_2 } from 'react';
15
15
  import { ReactNode } from 'react';
16
16
  import { SetStateAction } from 'react';
17
17
 
18
- /* Excluded from this release type: createTechDocsAddonExtension */
18
+ /**
19
+ * Create a TechDocs addon overload signature without props.
20
+ * @public
21
+ */
22
+ export declare function createTechDocsAddonExtension(options: TechDocsAddonOptions): Extension<() => JSX.Element | null>;
19
23
 
20
- /* Excluded from this release type: defaultTechDocsReaderPageValue */
24
+ /**
25
+ * Create a TechDocs addon overload signature with props.
26
+ * @public
27
+ */
28
+ export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
21
29
 
22
30
  /**
23
31
  * The outcome of a docs sync operation.
@@ -26,13 +34,62 @@ import { SetStateAction } from 'react';
26
34
  */
27
35
  export declare type SyncResult = 'cached' | 'updated';
28
36
 
29
- /* Excluded from this release type: TECHDOCS_ADDONS_WRAPPER_KEY */
37
+ /**
38
+ * Marks the <TechDocsAddons> registry component.
39
+ * @public
40
+ */
41
+ export declare const TECHDOCS_ADDONS_WRAPPER_KEY = "techdocs.addons.wrapper.v1";
30
42
 
31
- /* Excluded from this release type: TechDocsAddonLocations */
43
+ /**
44
+ * Locations for which TechDocs addons may be declared and rendered.
45
+ * @public
46
+ */
47
+ export declare const TechDocsAddonLocations: Readonly<{
48
+ /**
49
+ * These addons fill up the header from the right, on the same line as the
50
+ * title.
51
+ */
52
+ readonly Header: "Header";
53
+ /**
54
+ * These addons appear below the header and above all content; tooling addons
55
+ * can be inserted for convenience.
56
+ */
57
+ readonly Subheader: "Subheader";
58
+ /**
59
+ * These addons are items added to the settings menu list and are designed to make
60
+ * the reader experience customizable, for example accessibility options
61
+ */
62
+ readonly Settings: "Settings";
63
+ /**
64
+ * These addons appear left of the content and above the navigation.
65
+ */
66
+ readonly PrimarySidebar: "PrimarySidebar";
67
+ /**
68
+ * These addons appear right of the content and above the table of contents.
69
+ */
70
+ readonly SecondarySidebar: "SecondarySidebar";
71
+ /**
72
+ * A virtual location which allows mutation of all content within the shadow
73
+ * root by transforming DOM nodes. These addons should return null on render.
74
+ */
75
+ readonly Content: "Content";
76
+ }>;
32
77
 
33
- /* Excluded from this release type: TechDocsAddonOptions */
78
+ /**
79
+ * Options for creating a TechDocs addon.
80
+ * @public
81
+ */
82
+ export declare type TechDocsAddonOptions<TAddonProps = {}> = {
83
+ name: string;
84
+ location: keyof typeof TechDocsAddonLocations;
85
+ component: ComponentType<TAddonProps>;
86
+ };
34
87
 
35
- /* Excluded from this release type: TechDocsAddons */
88
+ /**
89
+ * TechDocs Addon registry.
90
+ * @public
91
+ */
92
+ export declare const TechDocsAddons: React_2.ComponentType;
36
93
 
37
94
  /**
38
95
  * API to talk to techdocs-backend.
@@ -137,14 +194,40 @@ export declare interface TechDocsStorageApi {
137
194
  */
138
195
  export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
139
196
 
140
- /* Excluded from this release type: useShadowRoot */
197
+ /**
198
+ * Hook for use within TechDocs addons that provides access to the underlying
199
+ * shadow root of the current page, allowing the DOM within to be mutated.
200
+ * @public
201
+ */
202
+ export declare const useShadowRoot: () => ShadowRoot | undefined;
141
203
 
142
- /* Excluded from this release type: useShadowRootElements */
204
+ /**
205
+ * Convenience hook for use within TechDocs addons that provides access to
206
+ * elements that match a given selector within the shadow root.
207
+ *
208
+ * @public
209
+ */
210
+ export declare const useShadowRootElements: <TReturnedElement extends HTMLElement = HTMLElement>(selectors: string[]) => TReturnedElement[];
143
211
 
144
- /* Excluded from this release type: useShadowRootSelection */
212
+ /**
213
+ * Hook for retreiving a selection within the ShadowRoot.
214
+ * @public
215
+ */
216
+ export declare const useShadowRootSelection: (wait?: number) => Selection | null;
145
217
 
146
- /* Excluded from this release type: useTechDocsAddons */
218
+ /**
219
+ * hook to use addons in components
220
+ * @public
221
+ */
222
+ export declare const useTechDocsAddons: () => {
223
+ renderComponentByName: (name: string) => JSX.Element | null;
224
+ renderComponentsByLocation: (location: keyof typeof TechDocsAddonLocations) => (JSX.Element | null)[] | null;
225
+ };
147
226
 
148
- /* Excluded from this release type: useTechDocsReaderPage */
227
+ /**
228
+ * Hook used to get access to shared state between reader page components.
229
+ * @public
230
+ */
231
+ export declare const useTechDocsReaderPage: () => TechDocsReaderPageValue;
149
232
 
150
233
  export { }
package/dist/index.esm.js CHANGED
@@ -173,5 +173,5 @@ const TechDocsAddonLocations = Object.freeze({
173
173
  Content: "Content"
174
174
  });
175
175
 
176
- export { TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsAddonLocations, TechDocsAddons, TechDocsReaderPageProvider, createTechDocsAddonExtension, defaultTechDocsReaderPageValue, techdocsApiRef, techdocsStorageApiRef, useShadowRoot, useShadowRootElements, useShadowRootSelection, useTechDocsAddons, useTechDocsReaderPage };
176
+ export { TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsAddonLocations, TechDocsAddons, TechDocsReaderPageProvider, createTechDocsAddonExtension, techdocsApiRef, techdocsStorageApiRef, useShadowRoot, useShadowRootElements, useShadowRootSelection, useTechDocsAddons, useTechDocsReaderPage };
177
177
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/addons.tsx","../src/api.ts","../src/context.tsx","../src/hooks.ts","../src/types.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport {\n attachComponentData,\n createReactExtension,\n ElementCollection,\n Extension,\n useElementFilter,\n} from '@backstage/core-plugin-api';\n\nimport { TechDocsAddonLocations, TechDocsAddonOptions } from './types';\n\nexport const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';\n\n/**\n * Marks the <TechDocsAddons> registry component.\n * @alpha\n */\nexport const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';\n\n/**\n * TechDocs Addon registry.\n * @alpha\n */\nexport const TechDocsAddons: React.ComponentType = () => null;\n\nattachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true);\n\nconst getDataKeyByName = (name: string) => {\n return `${TECHDOCS_ADDONS_KEY}.${name.toLocaleLowerCase('en-US')}`;\n};\n\n/**\n * Create a TechDocs addon.\n * @alpha\n */\nexport function createTechDocsAddonExtension<TComponentProps>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null> {\n const { name, component: TechDocsAddon } = options;\n return createReactExtension({\n name,\n component: {\n sync: (props: TComponentProps) => <TechDocsAddon {...props} />,\n },\n data: {\n [TECHDOCS_ADDONS_KEY]: options,\n [getDataKeyByName(name)]: true,\n },\n });\n}\n\nconst getTechDocsAddonByName = (\n collection: ElementCollection,\n key: string,\n): JSX.Element | undefined => {\n return collection.selectByComponentData({ key }).getElements()[0];\n};\n\nconst getAllTechDocsAddons = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .selectByComponentData({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\nconst getAllTechDocsAddonsData = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .findComponentData<TechDocsAddonOptions>({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\n/**\n * hook to use addons in components\n * @alpha\n */\nexport const useTechDocsAddons = () => {\n const node = useOutlet();\n const collection = useElementFilter(node, getAllTechDocsAddons);\n const options = useElementFilter(node, getAllTechDocsAddonsData);\n\n const findAddonByData = useCallback(\n (data: TechDocsAddonOptions | undefined) => {\n if (!collection || !data) return null;\n const nameKey = getDataKeyByName(data.name);\n return getTechDocsAddonByName(collection, nameKey) ?? null;\n },\n [collection],\n );\n\n const renderComponentByName = useCallback(\n (name: string) => {\n const data = options.find(option => option.name === name);\n return data ? findAddonByData(data) : null;\n },\n [options, findAddonByData],\n );\n\n const renderComponentsByLocation = useCallback(\n (location: keyof typeof TechDocsAddonLocations) => {\n const data = options.filter(option => option.location === location);\n return data.length ? data.map(findAddonByData) : null;\n },\n [options, findAddonByData],\n );\n\n return { renderComponentByName, renderComponentsByLocation };\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 { CompoundEntityRef } from '@backstage/catalog-model';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { TechDocsEntityMetadata, TechDocsMetadata } from './types';\n\n/**\n * API to talk to techdocs-backend.\n *\n * @public\n */\nexport interface TechDocsApi {\n getApiOrigin(): Promise<string>;\n getTechDocsMetadata(entityId: CompoundEntityRef): Promise<TechDocsMetadata>;\n getEntityMetadata(\n entityId: CompoundEntityRef,\n ): Promise<TechDocsEntityMetadata>;\n}\n\n/**\n * Utility API reference for the {@link TechDocsApi}.\n *\n * @public\n */\nexport const techdocsApiRef = createApiRef<TechDocsApi>({\n id: 'plugin.techdocs.service',\n});\n\n/**\n * The outcome of a docs sync operation.\n *\n * @public\n */\nexport type SyncResult = 'cached' | 'updated';\n\n/**\n * API which talks to TechDocs storage to fetch files to render.\n *\n * @public\n */\nexport interface TechDocsStorageApi {\n getApiOrigin(): Promise<string>;\n getStorageUrl(): Promise<string>;\n getBuilder(): Promise<string>;\n getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;\n syncEntityDocs(\n entityId: CompoundEntityRef,\n logHandler?: (line: string) => void,\n ): Promise<SyncResult>;\n getBaseUrl(\n oldBaseUrl: string,\n entityId: CompoundEntityRef,\n path: string,\n ): Promise<string>;\n}\n\n/**\n * Utility API reference for the {@link TechDocsStorageApi}.\n *\n * @public\n */\nexport const techdocsStorageApiRef = createApiRef<TechDocsStorageApi>({\n id: 'plugin.techdocs.storageservice',\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 Dispatch,\n SetStateAction,\n useContext,\n useState,\n memo,\n ReactNode,\n} from 'react';\nimport useAsync, { AsyncState } from 'react-use/lib/useAsync';\n\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { techdocsApiRef } from './api';\nimport { TechDocsEntityMetadata, TechDocsMetadata } from './types';\n\nconst areEntityRefsEqual = (\n prevEntityRef: CompoundEntityRef,\n nextEntityRef: CompoundEntityRef,\n) => {\n return (\n stringifyEntityRef(prevEntityRef) === stringifyEntityRef(nextEntityRef)\n );\n};\n\n/**\n * @public type for the value of the TechDocsReaderPageContext\n */\nexport type TechDocsReaderPageValue = {\n metadata: AsyncState<TechDocsMetadata>;\n entityRef: CompoundEntityRef;\n entityMetadata: AsyncState<TechDocsEntityMetadata>;\n shadowRoot?: ShadowRoot;\n setShadowRoot: Dispatch<SetStateAction<ShadowRoot | undefined>>;\n title: string;\n setTitle: Dispatch<SetStateAction<string>>;\n subtitle: string;\n setSubtitle: Dispatch<SetStateAction<string>>;\n /**\n * @deprecated property can be passed down directly to the `TechDocsReaderPageContent` instead.\n */\n onReady?: () => void;\n};\n\n/**\n * @alpha\n */\nexport const defaultTechDocsReaderPageValue: TechDocsReaderPageValue = {\n title: '',\n subtitle: '',\n setTitle: () => {},\n setSubtitle: () => {},\n setShadowRoot: () => {},\n metadata: { loading: true },\n entityMetadata: { loading: true },\n entityRef: { kind: '', name: '', namespace: '' },\n};\n\nconst TechDocsReaderPageContext = createVersionedContext<{\n 1: TechDocsReaderPageValue;\n}>('techdocs-reader-page-context');\n\n/**\n * render function for {@link TechDocsReaderPageProvider}\n *\n * @public\n */\nexport type TechDocsReaderPageProviderRenderFunction = (\n value: TechDocsReaderPageValue,\n) => JSX.Element;\n\n/**\n * Props for {@link TechDocsReaderPageProvider}\n *\n * @public\n */\nexport type TechDocsReaderPageProviderProps = {\n entityRef: CompoundEntityRef;\n children: TechDocsReaderPageProviderRenderFunction | ReactNode;\n};\n\n/**\n * A context to store the reader page state\n * @public\n */\nexport const TechDocsReaderPageProvider = memo(\n ({ entityRef, children }: TechDocsReaderPageProviderProps) => {\n const techdocsApi = useApi(techdocsApiRef);\n\n const metadata = useAsync(async () => {\n return techdocsApi.getTechDocsMetadata(entityRef);\n }, [entityRef]);\n\n const entityMetadata = useAsync(async () => {\n return techdocsApi.getEntityMetadata(entityRef);\n }, [entityRef]);\n\n const [title, setTitle] = useState(defaultTechDocsReaderPageValue.title);\n const [subtitle, setSubtitle] = useState(\n defaultTechDocsReaderPageValue.subtitle,\n );\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | undefined>(\n defaultTechDocsReaderPageValue.shadowRoot,\n );\n\n const value = {\n metadata,\n entityRef,\n entityMetadata,\n shadowRoot,\n setShadowRoot,\n title,\n setTitle,\n subtitle,\n setSubtitle,\n };\n const versionedValue = createVersionedValueMap({ 1: value });\n\n return (\n <TechDocsReaderPageContext.Provider value={versionedValue}>\n {children instanceof Function ? children(value) : children}\n </TechDocsReaderPageContext.Provider>\n );\n },\n (prevProps, nextProps) => {\n return areEntityRefsEqual(prevProps.entityRef, nextProps.entityRef);\n },\n);\n\n/**\n * Hook used to get access to shared state between reader page components.\n * @alpha\n */\nexport const useTechDocsReaderPage = () => {\n const versionedContext = useContext(TechDocsReaderPageContext);\n\n if (versionedContext === undefined) {\n return defaultTechDocsReaderPageValue;\n }\n\n const context = versionedContext.atVersion(1);\n if (context === undefined) {\n throw new Error('No context found for version 1.');\n }\n\n return context;\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 */\nimport { useState, useEffect, useMemo } from 'react';\nimport debounce from 'lodash/debounce';\nimport { useTechDocsReaderPage } from './context';\n\n/**\n * Hook for use within TechDocs addons that provides access to the underlying\n * shadow root of the current page, allowing the DOM within to be mutated.\n * @alpha\n */\nexport const useShadowRoot = () => {\n const { shadowRoot } = useTechDocsReaderPage();\n return shadowRoot;\n};\n\n/**\n * Convenience hook for use within TechDocs addons that provides access to\n * elements that match a given selector within the shadow root.\n *\n * @alpha\n */\nexport const useShadowRootElements = <\n TReturnedElement extends HTMLElement = HTMLElement,\n>(\n selectors: string[],\n): TReturnedElement[] => {\n const shadowRoot = useShadowRoot();\n if (!shadowRoot) return [];\n return selectors\n .map(selector => shadowRoot?.querySelectorAll<TReturnedElement>(selector))\n .filter(nodeList => nodeList.length)\n .map(nodeList => Array.from(nodeList))\n .flat();\n};\n\nconst isValidSelection = (newSelection: Selection) => {\n // Safari sets the selection rect to top zero\n return (\n newSelection.toString() &&\n newSelection.rangeCount &&\n newSelection.getRangeAt(0).getBoundingClientRect().top\n );\n};\n\n/**\n * Hook for retreiving a selection within the ShadowRoot.\n * @alpha\n */\nexport const useShadowRootSelection = (wait: number = 0) => {\n const shadowRoot = useShadowRoot();\n const [selection, setSelection] = useState<Selection | null>(null);\n const handleSelectionChange = useMemo(\n () =>\n debounce(() => {\n const shadowDocument = shadowRoot as ShadowRoot &\n Pick<Document, 'getSelection'>;\n // Firefox and Safari don't implement getSelection for Shadow DOM\n const newSelection = shadowDocument.getSelection\n ? shadowDocument.getSelection()\n : document.getSelection();\n\n if (newSelection && isValidSelection(newSelection)) {\n setSelection(newSelection);\n } else {\n setSelection(null);\n }\n }, wait),\n [shadowRoot, setSelection, wait],\n );\n\n useEffect(() => {\n window.document.addEventListener('selectionchange', handleSelectionChange);\n return () =>\n window.document.removeEventListener(\n 'selectionchange',\n handleSelectionChange,\n );\n }, [handleSelectionChange]);\n\n return selection;\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 { ComponentType } from 'react';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * Metadata for TechDocs page\n *\n * @public\n */\nexport type TechDocsMetadata = {\n site_name: string;\n site_description: string;\n};\n\n/**\n * Metadata for TechDocs Entity\n *\n * @public\n */\nexport type TechDocsEntityMetadata = Entity & {\n locationMetadata?: { type: string; target: string };\n};\n\n/**\n * Locations for which TechDocs addons may be declared and rendered.\n * @alpha\n */\nexport const TechDocsAddonLocations = Object.freeze({\n /**\n * These addons fill up the header from the right, on the same line as the\n * title.\n */\n Header: 'Header',\n\n /**\n * These addons appear below the header and above all content; tooling addons\n * can be inserted for convenience.\n */\n Subheader: 'Subheader',\n\n /**\n * These addons are items added to the settings menu list and are designed to make\n * the reader experience customizable, for example accessibility options\n */\n Settings: 'Settings',\n\n /**\n * These addons appear left of the content and above the navigation.\n */\n PrimarySidebar: 'PrimarySidebar',\n\n /**\n * These addons appear right of the content and above the table of contents.\n */\n SecondarySidebar: 'SecondarySidebar',\n\n /**\n * A virtual location which allows mutation of all content within the shadow\n * root by transforming DOM nodes. These addons should return null on render.\n */\n Content: 'Content',\n\n /**\n * todo(backstage/community): This is a proposed virtual location which would\n * help implement a common addon pattern in which many instances of a given\n * element in markdown would be dynamically replaced at render-time based on\n * attributes provided on that element, for example:\n *\n * ```md\n * ## For Fun\n * <TechDocsAddon>CatGif</TechDocsAddon>\n *\n * ## Component Metadata\n * <TechDocsAddon entityRef=\"default:component/some-component-name\">CatalogEntityCard</TechDocsAddon>\n *\n * ## System Metadata\n * <TechDocsAddon entityRef=\"default:system/some-system-name\">CatalogEntityCard</TechDocsAddon>\n * ```\n *\n * Could correspond to a TechDocs addon named `CatalogEntityCard` with\n * location `TechDocsAddonLocations.COMPONENT`, whose `component` would be\n * the react component that would be rendered in place of all instances of\n * the markdown illustrated above.\n *\n * The `@backstage/plugin-techdocs-react` package would need to be updated to, in\n * cases where such addons had been registered, find all instances of the\n * the `<TechDocsAddon>` tag whose `textContent` corresponded with the name of the\n * addon, then replace them with component instances of the addon component,\n * passing any attributes from the tag as props to the component.\n */\n // Component: 'Component',\n} as const);\n\n/**\n * Options for creating a TechDocs addon.\n * @alpha\n */\nexport type TechDocsAddonOptions<TAddonProps = {}> = {\n name: string;\n location: keyof typeof TechDocsAddonLocations;\n component: ComponentType<TAddonProps>;\n};\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAClD,MAAC,2BAA2B,GAAG,6BAA6B;AAC5D,MAAC,cAAc,GAAG,MAAM,KAAK;AACzC,mBAAmB,CAAC,cAAc,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAC;AACvE,MAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK;AACnC,EAAE,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAC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,CAAC,IAAI,CAAC,CAAC;AACnD,EAAE,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAM,QAAQ,CAAC,MAAM;AAC7D,IAAI,MAAM,cAAc,GAAG,UAAU,CAAC;AACtC,IAAI,MAAM,YAAY,GAAG,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,YAAY,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;AAC/G,IAAI,IAAI,YAAY,IAAI,gBAAgB,CAAC,YAAY,CAAC,EAAE;AACxD,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;AACjC,KAAK,MAAM;AACX,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK;AACL,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9C,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AAC/E,IAAI,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AAC/F,GAAG,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAC9B,EAAE,OAAO,SAAS,CAAC;AACnB;;ACjCY,MAAC,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;AACpD,EAAE,MAAM,EAAE,QAAQ;AAClB,EAAE,SAAS,EAAE,WAAW;AACxB,EAAE,QAAQ,EAAE,UAAU;AACtB,EAAE,cAAc,EAAE,gBAAgB;AAClC,EAAE,gBAAgB,EAAE,kBAAkB;AACtC,EAAE,OAAO,EAAE,SAAS;AACpB,CAAC;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/addons.tsx","../src/api.ts","../src/context.tsx","../src/hooks.ts","../src/types.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport {\n attachComponentData,\n createReactExtension,\n ElementCollection,\n Extension,\n useElementFilter,\n} from '@backstage/core-plugin-api';\n\nimport { TechDocsAddonLocations, TechDocsAddonOptions } from './types';\n\nexport const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';\n\n/**\n * Marks the <TechDocsAddons> registry component.\n * @public\n */\nexport const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';\n\n/**\n * TechDocs Addon registry.\n * @public\n */\nexport const TechDocsAddons: React.ComponentType = () => null;\n\nattachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true);\n\nconst getDataKeyByName = (name: string) => {\n return `${TECHDOCS_ADDONS_KEY}.${name.toLocaleLowerCase('en-US')}`;\n};\n\n/**\n * Create a TechDocs addon overload signature without props.\n * @public\n */\nexport function createTechDocsAddonExtension(\n options: TechDocsAddonOptions,\n): Extension<() => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon overload signature with props.\n * @public\n */\nexport function createTechDocsAddonExtension<TComponentProps>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon implementation.\n * @public\n */\nexport function createTechDocsAddonExtension<TComponentProps>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null> {\n const { name, component: TechDocsAddon } = options;\n return createReactExtension({\n name,\n component: {\n sync: (props: TComponentProps) => <TechDocsAddon {...props} />,\n },\n data: {\n [TECHDOCS_ADDONS_KEY]: options,\n [getDataKeyByName(name)]: true,\n },\n });\n}\n\nconst getTechDocsAddonByName = (\n collection: ElementCollection,\n key: string,\n): JSX.Element | undefined => {\n return collection.selectByComponentData({ key }).getElements()[0];\n};\n\nconst getAllTechDocsAddons = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .selectByComponentData({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\nconst getAllTechDocsAddonsData = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .findComponentData<TechDocsAddonOptions>({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\n/**\n * hook to use addons in components\n * @public\n */\nexport const useTechDocsAddons = () => {\n const node = useOutlet();\n const collection = useElementFilter(node, getAllTechDocsAddons);\n const options = useElementFilter(node, getAllTechDocsAddonsData);\n\n const findAddonByData = useCallback(\n (data: TechDocsAddonOptions | undefined) => {\n if (!collection || !data) return null;\n const nameKey = getDataKeyByName(data.name);\n return getTechDocsAddonByName(collection, nameKey) ?? null;\n },\n [collection],\n );\n\n const renderComponentByName = useCallback(\n (name: string) => {\n const data = options.find(option => option.name === name);\n return data ? findAddonByData(data) : null;\n },\n [options, findAddonByData],\n );\n\n const renderComponentsByLocation = useCallback(\n (location: keyof typeof TechDocsAddonLocations) => {\n const data = options.filter(option => option.location === location);\n return data.length ? data.map(findAddonByData) : null;\n },\n [options, findAddonByData],\n );\n\n return { renderComponentByName, renderComponentsByLocation };\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 { CompoundEntityRef } from '@backstage/catalog-model';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { TechDocsEntityMetadata, TechDocsMetadata } from './types';\n\n/**\n * API to talk to techdocs-backend.\n *\n * @public\n */\nexport interface TechDocsApi {\n getApiOrigin(): Promise<string>;\n getTechDocsMetadata(entityId: CompoundEntityRef): Promise<TechDocsMetadata>;\n getEntityMetadata(\n entityId: CompoundEntityRef,\n ): Promise<TechDocsEntityMetadata>;\n}\n\n/**\n * Utility API reference for the {@link TechDocsApi}.\n *\n * @public\n */\nexport const techdocsApiRef = createApiRef<TechDocsApi>({\n id: 'plugin.techdocs.service',\n});\n\n/**\n * The outcome of a docs sync operation.\n *\n * @public\n */\nexport type SyncResult = 'cached' | 'updated';\n\n/**\n * API which talks to TechDocs storage to fetch files to render.\n *\n * @public\n */\nexport interface TechDocsStorageApi {\n getApiOrigin(): Promise<string>;\n getStorageUrl(): Promise<string>;\n getBuilder(): Promise<string>;\n getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;\n syncEntityDocs(\n entityId: CompoundEntityRef,\n logHandler?: (line: string) => void,\n ): Promise<SyncResult>;\n getBaseUrl(\n oldBaseUrl: string,\n entityId: CompoundEntityRef,\n path: string,\n ): Promise<string>;\n}\n\n/**\n * Utility API reference for the {@link TechDocsStorageApi}.\n *\n * @public\n */\nexport const techdocsStorageApiRef = createApiRef<TechDocsStorageApi>({\n id: 'plugin.techdocs.storageservice',\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 Dispatch,\n SetStateAction,\n useContext,\n useState,\n memo,\n ReactNode,\n} from 'react';\nimport useAsync, { AsyncState } from 'react-use/lib/useAsync';\n\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { techdocsApiRef } from './api';\nimport { TechDocsEntityMetadata, TechDocsMetadata } from './types';\n\nconst areEntityRefsEqual = (\n prevEntityRef: CompoundEntityRef,\n nextEntityRef: CompoundEntityRef,\n) => {\n return (\n stringifyEntityRef(prevEntityRef) === stringifyEntityRef(nextEntityRef)\n );\n};\n\n/**\n * @public type for the value of the TechDocsReaderPageContext\n */\nexport type TechDocsReaderPageValue = {\n metadata: AsyncState<TechDocsMetadata>;\n entityRef: CompoundEntityRef;\n entityMetadata: AsyncState<TechDocsEntityMetadata>;\n shadowRoot?: ShadowRoot;\n setShadowRoot: Dispatch<SetStateAction<ShadowRoot | undefined>>;\n title: string;\n setTitle: Dispatch<SetStateAction<string>>;\n subtitle: string;\n setSubtitle: Dispatch<SetStateAction<string>>;\n /**\n * @deprecated property can be passed down directly to the `TechDocsReaderPageContent` instead.\n */\n onReady?: () => void;\n};\n\nconst defaultTechDocsReaderPageValue: TechDocsReaderPageValue = {\n title: '',\n subtitle: '',\n setTitle: () => {},\n setSubtitle: () => {},\n setShadowRoot: () => {},\n metadata: { loading: true },\n entityMetadata: { loading: true },\n entityRef: { kind: '', name: '', namespace: '' },\n};\n\nconst TechDocsReaderPageContext = createVersionedContext<{\n 1: TechDocsReaderPageValue;\n}>('techdocs-reader-page-context');\n\n/**\n * render function for {@link TechDocsReaderPageProvider}\n *\n * @public\n */\nexport type TechDocsReaderPageProviderRenderFunction = (\n value: TechDocsReaderPageValue,\n) => JSX.Element;\n\n/**\n * Props for {@link TechDocsReaderPageProvider}\n *\n * @public\n */\nexport type TechDocsReaderPageProviderProps = {\n entityRef: CompoundEntityRef;\n children: TechDocsReaderPageProviderRenderFunction | ReactNode;\n};\n\n/**\n * A context to store the reader page state\n * @public\n */\nexport const TechDocsReaderPageProvider = memo(\n ({ entityRef, children }: TechDocsReaderPageProviderProps) => {\n const techdocsApi = useApi(techdocsApiRef);\n\n const metadata = useAsync(async () => {\n return techdocsApi.getTechDocsMetadata(entityRef);\n }, [entityRef]);\n\n const entityMetadata = useAsync(async () => {\n return techdocsApi.getEntityMetadata(entityRef);\n }, [entityRef]);\n\n const [title, setTitle] = useState(defaultTechDocsReaderPageValue.title);\n const [subtitle, setSubtitle] = useState(\n defaultTechDocsReaderPageValue.subtitle,\n );\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | undefined>(\n defaultTechDocsReaderPageValue.shadowRoot,\n );\n\n const value = {\n metadata,\n entityRef,\n entityMetadata,\n shadowRoot,\n setShadowRoot,\n title,\n setTitle,\n subtitle,\n setSubtitle,\n };\n const versionedValue = createVersionedValueMap({ 1: value });\n\n return (\n <TechDocsReaderPageContext.Provider value={versionedValue}>\n {children instanceof Function ? children(value) : children}\n </TechDocsReaderPageContext.Provider>\n );\n },\n (prevProps, nextProps) => {\n return areEntityRefsEqual(prevProps.entityRef, nextProps.entityRef);\n },\n);\n\n/**\n * Hook used to get access to shared state between reader page components.\n * @public\n */\nexport const useTechDocsReaderPage = () => {\n const versionedContext = useContext(TechDocsReaderPageContext);\n\n if (versionedContext === undefined) {\n return defaultTechDocsReaderPageValue;\n }\n\n const context = versionedContext.atVersion(1);\n if (context === undefined) {\n throw new Error('No context found for version 1.');\n }\n\n return context;\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 */\nimport { useState, useEffect, useMemo } from 'react';\nimport debounce from 'lodash/debounce';\nimport { useTechDocsReaderPage } from './context';\n\n/**\n * Hook for use within TechDocs addons that provides access to the underlying\n * shadow root of the current page, allowing the DOM within to be mutated.\n * @public\n */\nexport const useShadowRoot = () => {\n const { shadowRoot } = useTechDocsReaderPage();\n return shadowRoot;\n};\n\n/**\n * Convenience hook for use within TechDocs addons that provides access to\n * elements that match a given selector within the shadow root.\n *\n * @public\n */\nexport const useShadowRootElements = <\n TReturnedElement extends HTMLElement = HTMLElement,\n>(\n selectors: string[],\n): TReturnedElement[] => {\n const shadowRoot = useShadowRoot();\n if (!shadowRoot) return [];\n return selectors\n .map(selector => shadowRoot?.querySelectorAll<TReturnedElement>(selector))\n .filter(nodeList => nodeList.length)\n .map(nodeList => Array.from(nodeList))\n .flat();\n};\n\nconst isValidSelection = (newSelection: Selection) => {\n // Safari sets the selection rect to top zero\n return (\n newSelection.toString() &&\n newSelection.rangeCount &&\n newSelection.getRangeAt(0).getBoundingClientRect().top\n );\n};\n\n/**\n * Hook for retreiving a selection within the ShadowRoot.\n * @public\n */\nexport const useShadowRootSelection = (wait: number = 0) => {\n const shadowRoot = useShadowRoot();\n const [selection, setSelection] = useState<Selection | null>(null);\n const handleSelectionChange = useMemo(\n () =>\n debounce(() => {\n const shadowDocument = shadowRoot as ShadowRoot &\n Pick<Document, 'getSelection'>;\n // Firefox and Safari don't implement getSelection for Shadow DOM\n const newSelection = shadowDocument.getSelection\n ? shadowDocument.getSelection()\n : document.getSelection();\n\n if (newSelection && isValidSelection(newSelection)) {\n setSelection(newSelection);\n } else {\n setSelection(null);\n }\n }, wait),\n [shadowRoot, setSelection, wait],\n );\n\n useEffect(() => {\n window.document.addEventListener('selectionchange', handleSelectionChange);\n return () =>\n window.document.removeEventListener(\n 'selectionchange',\n handleSelectionChange,\n );\n }, [handleSelectionChange]);\n\n return selection;\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 { ComponentType } from 'react';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * Metadata for TechDocs page\n *\n * @public\n */\nexport type TechDocsMetadata = {\n site_name: string;\n site_description: string;\n};\n\n/**\n * Metadata for TechDocs Entity\n *\n * @public\n */\nexport type TechDocsEntityMetadata = Entity & {\n locationMetadata?: { type: string; target: string };\n};\n\n/**\n * Locations for which TechDocs addons may be declared and rendered.\n * @public\n */\nexport const TechDocsAddonLocations = Object.freeze({\n /**\n * These addons fill up the header from the right, on the same line as the\n * title.\n */\n Header: 'Header',\n\n /**\n * These addons appear below the header and above all content; tooling addons\n * can be inserted for convenience.\n */\n Subheader: 'Subheader',\n\n /**\n * These addons are items added to the settings menu list and are designed to make\n * the reader experience customizable, for example accessibility options\n */\n Settings: 'Settings',\n\n /**\n * These addons appear left of the content and above the navigation.\n */\n PrimarySidebar: 'PrimarySidebar',\n\n /**\n * These addons appear right of the content and above the table of contents.\n */\n SecondarySidebar: 'SecondarySidebar',\n\n /**\n * A virtual location which allows mutation of all content within the shadow\n * root by transforming DOM nodes. These addons should return null on render.\n */\n Content: 'Content',\n\n /**\n * todo(backstage/community): This is a proposed virtual location which would\n * help implement a common addon pattern in which many instances of a given\n * element in markdown would be dynamically replaced at render-time based on\n * attributes provided on that element, for example:\n *\n * ```md\n * ## For Fun\n * <TechDocsAddon>CatGif</TechDocsAddon>\n *\n * ## Component Metadata\n * <TechDocsAddon entityRef=\"default:component/some-component-name\">CatalogEntityCard</TechDocsAddon>\n *\n * ## System Metadata\n * <TechDocsAddon entityRef=\"default:system/some-system-name\">CatalogEntityCard</TechDocsAddon>\n * ```\n *\n * Could correspond to a TechDocs addon named `CatalogEntityCard` with\n * location `TechDocsAddonLocations.COMPONENT`, whose `component` would be\n * the react component that would be rendered in place of all instances of\n * the markdown illustrated above.\n *\n * The `@backstage/plugin-techdocs-react` package would need to be updated to, in\n * cases where such addons had been registered, find all instances of the\n * the `<TechDocsAddon>` tag whose `textContent` corresponded with the name of the\n * addon, then replace them with component instances of the addon component,\n * passing any attributes from the tag as props to the component.\n */\n // Component: 'Component',\n} as const);\n\n/**\n * Options for creating a TechDocs addon.\n * @public\n */\nexport type TechDocsAddonOptions<TAddonProps = {}> = {\n name: string;\n location: keyof typeof TechDocsAddonLocations;\n component: ComponentType<TAddonProps>;\n};\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAClD,MAAC,2BAA2B,GAAG,6BAA6B;AAC5D,MAAC,cAAc,GAAG,MAAM,KAAK;AACzC,mBAAmB,CAAC,cAAc,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAC;AACvE,MAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK;AACnC,EAAE,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AACK,SAAS,4BAA4B,CAAC,OAAO,EAAE;AACtD,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;AACrD,EAAE,OAAO,oBAAoB,CAAC;AAC9B,IAAI,IAAI;AACR,IAAI,SAAS,EAAE;AACf,MAAM,IAAI,EAAE,CAAC,KAAK,qBAAqB,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE;AAC1E,QAAQ,GAAG,KAAK;AAChB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,IAAI,EAAE;AACV,MAAM,CAAC,mBAAmB,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,KAAK,MAAM;AACX,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK;AACL,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9C,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AAC/E,IAAI,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AAC/F,GAAG,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAC9B,EAAE,OAAO,SAAS,CAAC;AACnB;;ACjCY,MAAC,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;AACpD,EAAE,MAAM,EAAE,QAAQ;AAClB,EAAE,SAAS,EAAE,WAAW;AACxB,EAAE,QAAQ,EAAE,UAAU;AACtB,EAAE,cAAc,EAAE,gBAAgB;AAClC,EAAE,gBAAgB,EAAE,kBAAkB;AACtC,EAAE,OAAO,EAAE,SAAS;AACpB,CAAC;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-react",
3
3
  "description": "Shared frontend utilities for TechDocs and Addons",
4
- "version": "0.1.1-next.2",
4
+ "version": "1.0.0",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -35,9 +35,9 @@
35
35
  "start": "backstage-cli package start"
36
36
  },
37
37
  "dependencies": {
38
- "@backstage/catalog-model": "^1.0.2-next.0",
39
- "@backstage/core-components": "^0.9.4-next.1",
40
- "@backstage/core-plugin-api": "^1.0.2-next.1",
38
+ "@backstage/catalog-model": "^1.0.2",
39
+ "@backstage/core-components": "^0.9.4",
40
+ "@backstage/core-plugin-api": "^1.0.2",
41
41
  "@backstage/version-bridge": "^1.0.1",
42
42
  "@material-ui/core": "^4.12.2",
43
43
  "@material-ui/lab": "4.0.0-alpha.57",
@@ -53,7 +53,7 @@
53
53
  "react": "^16.13.1 || ^17.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@backstage/test-utils": "^1.1.0-next.2",
56
+ "@backstage/test-utils": "^1.1.0",
57
57
  "@backstage/theme": "^0.2.15",
58
58
  "@testing-library/react": "^12.1.3",
59
59
  "@testing-library/react-hooks": "^8.0.0"
@@ -62,5 +62,5 @@
62
62
  "alpha",
63
63
  "dist"
64
64
  ],
65
- "gitHead": "cfbf5762d7d91eee18999306b21d63840400ee29"
65
+ "gitHead": "96323f280ba32ee526c5b151cda42260aee927c9"
66
66
  }