Move stable alpha exports to public.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-05-11 11:37:33 +02:00
parent 66521125b3
commit 2b74671f52
6 changed files with 22 additions and 32 deletions
+10 -13
View File
@@ -14,21 +14,18 @@ import { default as React_2 } from 'react';
import { ReactNode } from 'react';
import { SetStateAction } from 'react';
// @alpha
// @public
export function createTechDocsAddonExtension<TComponentProps>(
options: TechDocsAddonOptions<TComponentProps>,
): Extension<(props: TComponentProps) => JSX.Element | null>;
// @alpha (undocumented)
export const defaultTechDocsReaderPageValue: TechDocsReaderPageValue;
// @public
export type SyncResult = 'cached' | 'updated';
// @alpha
// @public
export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
// @alpha
// @public
export const TechDocsAddonLocations: Readonly<{
readonly Header: 'Header';
readonly Subheader: 'Subheader';
@@ -38,14 +35,14 @@ export const TechDocsAddonLocations: Readonly<{
readonly Content: 'Content';
}>;
// @alpha
// @public
export type TechDocsAddonOptions<TAddonProps = {}> = {
name: string;
location: keyof typeof TechDocsAddonLocations;
component: ComponentType<TAddonProps>;
};
// @alpha
// @public
export const TechDocsAddons: React_2.ComponentType;
// @public
@@ -133,20 +130,20 @@ export interface TechDocsStorageApi {
// @public
export const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
// @alpha
// @public
export const useShadowRoot: () => ShadowRoot | undefined;
// @alpha
// @public
export const useShadowRootElements: <
TReturnedElement extends HTMLElement = HTMLElement,
>(
selectors: string[],
) => TReturnedElement[];
// @alpha
// @public
export const useShadowRootSelection: (wait?: number) => Selection | null;
// @alpha
// @public
export const useTechDocsAddons: () => {
renderComponentByName: (name: string) => JSX.Element | null;
renderComponentsByLocation: (
@@ -154,6 +151,6 @@ export const useTechDocsAddons: () => {
) => (JSX.Element | null)[] | null;
};
// @alpha
// @public
export const useTechDocsReaderPage: () => TechDocsReaderPageValue;
```
+4 -4
View File
@@ -31,13 +31,13 @@ export const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';
/**
* Marks the <TechDocsAddons> registry component.
* @alpha
* @public
*/
export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
/**
* TechDocs Addon registry.
* @alpha
* @public
*/
export const TechDocsAddons: React.ComponentType = () => null;
@@ -49,7 +49,7 @@ const getDataKeyByName = (name: string) => {
/**
* Create a TechDocs addon.
* @alpha
* @public
*/
export function createTechDocsAddonExtension<TComponentProps>(
options: TechDocsAddonOptions<TComponentProps>,
@@ -96,7 +96,7 @@ const getAllTechDocsAddonsData = (collection: ElementCollection) => {
/**
* hook to use addons in components
* @alpha
* @public
*/
export const useTechDocsAddons = () => {
const node = useOutlet();
+2 -5
View File
@@ -66,10 +66,7 @@ export type TechDocsReaderPageValue = {
onReady?: () => void;
};
/**
* @alpha
*/
export const defaultTechDocsReaderPageValue: TechDocsReaderPageValue = {
const defaultTechDocsReaderPageValue: TechDocsReaderPageValue = {
title: '',
subtitle: '',
setTitle: () => {},
@@ -153,7 +150,7 @@ export const TechDocsReaderPageProvider = memo(
/**
* Hook used to get access to shared state between reader page components.
* @alpha
* @public
*/
export const useTechDocsReaderPage = () => {
const versionedContext = useContext(TechDocsReaderPageContext);
+3 -3
View File
@@ -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.
* @alpha
* @public
*/
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.
*
* @alpha
* @public
*/
export const useShadowRootElements = <
TReturnedElement extends HTMLElement = HTMLElement,
@@ -58,7 +58,7 @@ const isValidSelection = (newSelection: Selection) => {
/**
* Hook for retreiving a selection within the ShadowRoot.
* @alpha
* @public
*/
export const useShadowRootSelection = (wait: number = 0) => {
const shadowRoot = useShadowRoot();
+1 -5
View File
@@ -28,11 +28,7 @@ export {
} from './addons';
export { techdocsApiRef, techdocsStorageApiRef } from './api';
export type { SyncResult, TechDocsApi, TechDocsStorageApi } from './api';
export {
defaultTechDocsReaderPageValue,
TechDocsReaderPageProvider,
useTechDocsReaderPage,
} from './context';
export { TechDocsReaderPageProvider, useTechDocsReaderPage } from './context';
export type {
TechDocsReaderPageProviderProps,
TechDocsReaderPageProviderRenderFunction,
+2 -2
View File
@@ -38,7 +38,7 @@ export type TechDocsEntityMetadata = Entity & {
/**
* Locations for which TechDocs addons may be declared and rendered.
* @alpha
* @public
*/
export const TechDocsAddonLocations = Object.freeze({
/**
@@ -108,7 +108,7 @@ export const TechDocsAddonLocations = Object.freeze({
/**
* Options for creating a TechDocs addon.
* @alpha
* @public
*/
export type TechDocsAddonOptions<TAddonProps = {}> = {
name: string;