Review feedback.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -5,5 +5,5 @@ This package provides frontend utilities for TechDocs and Addons.
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
yarn add @backstage/plugin-techdocs-react
|
||||
yarn add --cwd packages/app @backstage/plugin-techdocs-react
|
||||
```
|
||||
|
||||
@@ -80,17 +80,17 @@ export type TechDocsReaderPageValue = {
|
||||
onReady?: () => void;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const useShadowRoot: () => ShadowRoot | undefined;
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const useShadowRootElements: <
|
||||
TReturnedElement extends HTMLElement = HTMLElement,
|
||||
>(
|
||||
selectors: string[],
|
||||
) => TReturnedElement[];
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const useShadowRootSelection: (wait?: number) => Selection | null;
|
||||
|
||||
// @alpha
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"alphaTypes": "dist/index.alpha.d.ts",
|
||||
"main": "dist/index.esm.js",
|
||||
"types": "dist/index.d.ts"
|
||||
},
|
||||
@@ -25,7 +26,7 @@
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"build": "backstage-cli package build --experimental-type-build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
@@ -59,6 +60,7 @@
|
||||
"@backstage/theme": "^0.2.15"
|
||||
},
|
||||
"files": [
|
||||
"alpha",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { useTechDocsReaderPage } from './context';
|
||||
/**
|
||||
* Hook for use within TechDocs addons that provides access to the underlying
|
||||
* shadow root of the current page, allowing the DOM within to be mutated.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const useShadowRoot = () => {
|
||||
const { shadowRoot } = useTechDocsReaderPage();
|
||||
@@ -31,7 +31,7 @@ export const useShadowRoot = () => {
|
||||
* Convenience hook for use within TechDocs addons that provides access to
|
||||
* elements that match a given selector within the shadow root.
|
||||
*
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const useShadowRootElements = <
|
||||
TReturnedElement extends HTMLElement = HTMLElement,
|
||||
@@ -58,7 +58,7 @@ const isValidSelection = (newSelection: Selection) => {
|
||||
|
||||
/**
|
||||
* Hook for retreiving a selection within the ShadowRoot.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const useShadowRootSelection = (wait: number = 0) => {
|
||||
const shadowRoot = useShadowRoot();
|
||||
|
||||
Reference in New Issue
Block a user