@backstage/plugin-techdocs-react 0.1.0-next.0 → 0.1.1-next.1

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,39 @@
1
1
  # @backstage/plugin-techdocs-react
2
2
 
3
+ ## 0.1.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+ - Updated dependencies
9
+ - @backstage/core-components@0.9.4-next.0
10
+ - @backstage/core-plugin-api@1.0.2-next.0
11
+
12
+ ## 0.1.1-next.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 075a9a067b: Updated the return type of `createTechDocsAddonExtension` to better reflect the fact that passing children to Addon components is not a valid use-case.
17
+
18
+ ## 0.1.0
19
+
20
+ ### Minor Changes
21
+
22
+ - ff1cc8bced: This package will house frontend utilities related to TechDocs to be shared across other frontend Backstage packages.
23
+
24
+ In this release, it introduces a framework that can be used create TechDocs addons.
25
+
26
+ Note: this package is not necessarily stable yet. After iteration on this package, its stability will be signaled by a major-version bump.
27
+
28
+ ### Patch Changes
29
+
30
+ - 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
31
+ - Updated dependencies
32
+ - @backstage/catalog-model@1.0.1
33
+ - @backstage/core-components@0.9.3
34
+ - @backstage/core-plugin-api@1.0.1
35
+ - @backstage/version-bridge@1.0.1
36
+
3
37
  ## 0.1.0-next.0
4
38
 
5
39
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-react",
3
- "version": "0.1.0-next.0",
3
+ "version": "0.1.1-next.1",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -19,13 +19,20 @@ import { SetStateAction } from 'react';
19
19
  * Create a TechDocs addon.
20
20
  * @alpha
21
21
  */
22
- export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<ComponentType<TComponentProps>>;
22
+ export declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
23
23
 
24
24
  /**
25
25
  * @alpha
26
26
  */
27
27
  export declare const defaultTechDocsReaderPageValue: TechDocsReaderPageValue;
28
28
 
29
+ /**
30
+ * The outcome of a docs sync operation.
31
+ *
32
+ * @public
33
+ */
34
+ export declare type SyncResult = 'cached' | 'updated';
35
+
29
36
  /**
30
37
  * Marks the <TechDocsAddons> registry component.
31
38
  * @alpha
@@ -160,6 +167,27 @@ export declare type TechDocsReaderPageValue = {
160
167
  onReady?: () => void;
161
168
  };
162
169
 
170
+ /**
171
+ * API which talks to TechDocs storage to fetch files to render.
172
+ *
173
+ * @public
174
+ */
175
+ export declare interface TechDocsStorageApi {
176
+ getApiOrigin(): Promise<string>;
177
+ getStorageUrl(): Promise<string>;
178
+ getBuilder(): Promise<string>;
179
+ getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
180
+ syncEntityDocs(entityId: CompoundEntityRef, logHandler?: (line: string) => void): Promise<SyncResult>;
181
+ getBaseUrl(oldBaseUrl: string, entityId: CompoundEntityRef, path: string): Promise<string>;
182
+ }
183
+
184
+ /**
185
+ * Utility API reference for the {@link TechDocsStorageApi}.
186
+ *
187
+ * @public
188
+ */
189
+ export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
190
+
163
191
  /**
164
192
  * Hook for use within TechDocs addons that provides access to the underlying
165
193
  * shadow root of the current page, allowing the DOM within to be mutated.
@@ -19,6 +19,13 @@ import { SetStateAction } from 'react';
19
19
 
20
20
  /* Excluded from this release type: defaultTechDocsReaderPageValue */
21
21
 
22
+ /**
23
+ * The outcome of a docs sync operation.
24
+ *
25
+ * @public
26
+ */
27
+ export declare type SyncResult = 'cached' | 'updated';
28
+
22
29
  /* Excluded from this release type: TECHDOCS_ADDONS_WRAPPER_KEY */
23
30
 
24
31
  /* Excluded from this release type: TechDocsAddonLocations */
@@ -109,6 +116,27 @@ export declare type TechDocsReaderPageValue = {
109
116
  onReady?: () => void;
110
117
  };
111
118
 
119
+ /**
120
+ * API which talks to TechDocs storage to fetch files to render.
121
+ *
122
+ * @public
123
+ */
124
+ export declare interface TechDocsStorageApi {
125
+ getApiOrigin(): Promise<string>;
126
+ getStorageUrl(): Promise<string>;
127
+ getBuilder(): Promise<string>;
128
+ getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
129
+ syncEntityDocs(entityId: CompoundEntityRef, logHandler?: (line: string) => void): Promise<SyncResult>;
130
+ getBaseUrl(oldBaseUrl: string, entityId: CompoundEntityRef, path: string): Promise<string>;
131
+ }
132
+
133
+ /**
134
+ * Utility API reference for the {@link TechDocsStorageApi}.
135
+ *
136
+ * @public
137
+ */
138
+ export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
139
+
112
140
  /* Excluded from this release type: useShadowRoot */
113
141
 
114
142
  /* Excluded from this release type: useShadowRootElements */
package/dist/index.d.ts CHANGED
@@ -19,6 +19,13 @@ import { SetStateAction } from 'react';
19
19
 
20
20
  /* Excluded from this release type: defaultTechDocsReaderPageValue */
21
21
 
22
+ /**
23
+ * The outcome of a docs sync operation.
24
+ *
25
+ * @public
26
+ */
27
+ export declare type SyncResult = 'cached' | 'updated';
28
+
22
29
  /* Excluded from this release type: TECHDOCS_ADDONS_WRAPPER_KEY */
23
30
 
24
31
  /* Excluded from this release type: TechDocsAddonLocations */
@@ -109,6 +116,27 @@ export declare type TechDocsReaderPageValue = {
109
116
  onReady?: () => void;
110
117
  };
111
118
 
119
+ /**
120
+ * API which talks to TechDocs storage to fetch files to render.
121
+ *
122
+ * @public
123
+ */
124
+ export declare interface TechDocsStorageApi {
125
+ getApiOrigin(): Promise<string>;
126
+ getStorageUrl(): Promise<string>;
127
+ getBuilder(): Promise<string>;
128
+ getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
129
+ syncEntityDocs(entityId: CompoundEntityRef, logHandler?: (line: string) => void): Promise<SyncResult>;
130
+ getBaseUrl(oldBaseUrl: string, entityId: CompoundEntityRef, path: string): Promise<string>;
131
+ }
132
+
133
+ /**
134
+ * Utility API reference for the {@link TechDocsStorageApi}.
135
+ *
136
+ * @public
137
+ */
138
+ export declare const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
139
+
112
140
  /* Excluded from this release type: useShadowRoot */
113
141
 
114
142
  /* Excluded from this release type: useShadowRootElements */
package/dist/index.esm.js CHANGED
@@ -70,6 +70,9 @@ const useTechDocsAddons = () => {
70
70
  const techdocsApiRef = createApiRef({
71
71
  id: "plugin.techdocs.service"
72
72
  });
73
+ const techdocsStorageApiRef = createApiRef({
74
+ id: "plugin.techdocs.storageservice"
75
+ });
73
76
 
74
77
  const areEntityRefsEqual = (prevEntityRef, nextEntityRef) => {
75
78
  return stringifyEntityRef(prevEntityRef) === stringifyEntityRef(nextEntityRef);
@@ -169,5 +172,5 @@ const TechDocsAddonLocations = Object.freeze({
169
172
  Content: "Content"
170
173
  });
171
174
 
172
- export { TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsAddonLocations, TechDocsAddons, TechDocsReaderPageProvider, createTechDocsAddonExtension, defaultTechDocsReaderPageValue, techdocsApiRef, useShadowRoot, useShadowRootElements, useShadowRootSelection, useTechDocsAddons, useTechDocsReaderPage };
175
+ export { TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsAddonLocations, TechDocsAddons, TechDocsReaderPageProvider, createTechDocsAddonExtension, defaultTechDocsReaderPageValue, techdocsApiRef, techdocsStorageApiRef, useShadowRoot, useShadowRootElements, useShadowRootSelection, useTechDocsAddons, useTechDocsReaderPage };
173
176
  //# 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, { ComponentType, 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<ComponentType<TComponentProps>> {\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 * 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 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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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 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;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,GAAG,OAAO;AACpC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;AACpC,KAAK;AACL,GAAG,CAAC,CAAC;AACL,CAAC;AACD,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,GAAG,KAAK;AACpD,EAAE,OAAO,UAAU,CAAC,qBAAqB,CAAC,E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AC,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,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.0-next.0",
4
+ "version": "0.1.1-next.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -35,10 +35,10 @@
35
35
  "start": "backstage-cli package start"
36
36
  },
37
37
  "dependencies": {
38
- "@backstage/catalog-model": "^1.0.1-next.1",
39
- "@backstage/core-components": "^0.9.3-next.2",
40
- "@backstage/core-plugin-api": "^1.0.1-next.0",
41
- "@backstage/version-bridge": "^1.0.0",
38
+ "@backstage/catalog-model": "^1.0.1",
39
+ "@backstage/core-components": "^0.9.4-next.0",
40
+ "@backstage/core-plugin-api": "^1.0.2-next.0",
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",
44
44
  "@material-ui/styles": "^4.11.0",
@@ -53,14 +53,14 @@
53
53
  "react": "^16.13.1 || ^17.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@backstage/test-utils": "^1.0.1-next.2",
56
+ "@backstage/test-utils": "^1.1.0-next.1",
57
57
  "@backstage/theme": "^0.2.15",
58
58
  "@testing-library/react": "^12.1.3",
59
- "@testing-library/react-hooks": "^7.0.2"
59
+ "@testing-library/react-hooks": "^8.0.0"
60
60
  },
61
61
  "files": [
62
62
  "alpha",
63
63
  "dist"
64
64
  ],
65
- "gitHead": "2eca57d93ef1081f4a76a19fc994a8e9e1a19e00"
65
+ "gitHead": "0b3df66a238c66a5498dab85b1ed85a8607289f1"
66
66
  }