@backstage/plugin-techdocs 1.0.1 → 1.1.1-next.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/dist/index.d.ts CHANGED
@@ -1,33 +1,30 @@
1
1
  /// <reference types="react" />
2
- import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
2
+ import { TechDocsMetadata, TechDocsEntityMetadata } from '@backstage/plugin-techdocs-react';
3
+ import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
3
4
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
5
  import { DiscoveryApi, FetchApi, IdentityApi } from '@backstage/core-plugin-api';
5
6
  import { Config } from '@backstage/config';
6
- import React, { PropsWithChildren } from 'react';
7
+ import * as React from 'react';
8
+ import React__default, { ReactNode, PropsWithChildren } from 'react';
9
+ import { ToolbarProps } from '@material-ui/core';
7
10
  import { TableColumn, TableProps } from '@backstage/core-components';
8
11
  import { UserListFilterKind } from '@backstage/plugin-catalog-react';
9
12
  import { CSSProperties } from '@material-ui/styles';
10
13
 
11
14
  /**
12
- * Metadata for TechDocs page
13
- *
14
- * @public
15
- */
16
- declare type TechDocsMetadata = {
17
- site_name: string;
18
- site_description: string;
19
- };
20
- /**
21
- * Metadata for TechDocs Entity
15
+ * Helper function that gives the children of {@link TechDocsReaderPage} access to techdocs and entity metadata
22
16
  *
23
17
  * @public
24
18
  */
25
- declare type TechDocsEntityMetadata = Entity & {
26
- locationMetadata?: {
27
- type: string;
28
- target: string;
29
- };
30
- };
19
+ declare type TechDocsReaderPageRenderFunction = ({ techdocsMetadataValue, entityMetadataValue, entityRef, }: {
20
+ techdocsMetadataValue?: TechDocsMetadata | undefined;
21
+ entityMetadataValue?: TechDocsEntityMetadata | undefined;
22
+ entityRef: CompoundEntityRef;
23
+ /**
24
+ * @deprecated You can continue pass this property, but directly to the `TechDocsReaderPageContent` component.
25
+ */
26
+ onReady?: () => void;
27
+ }) => JSX.Element;
31
28
 
32
29
  /**
33
30
  * Utility API reference for the {@link TechDocsStorageApi}.
@@ -39,6 +36,7 @@ declare const techdocsStorageApiRef: _backstage_core_plugin_api.ApiRef<TechDocsS
39
36
  * Utility API reference for the {@link TechDocsApi}.
40
37
  *
41
38
  * @public
39
+ * @deprecated Import from `@backstage/plugin-techdocs-react` instead
42
40
  */
43
41
  declare const techdocsApiRef: _backstage_core_plugin_api.ApiRef<TechDocsApi>;
44
42
  /**
@@ -64,6 +62,7 @@ interface TechDocsStorageApi {
64
62
  * API to talk to techdocs-backend.
65
63
  *
66
64
  * @public
65
+ * @deprecated Import from `@backstage/plugin-techdocs-react` instead
67
66
  */
68
67
  interface TechDocsApi {
69
68
  getApiOrigin(): Promise<string>;
@@ -147,58 +146,138 @@ declare class TechDocsStorageClient implements TechDocsStorageApi {
147
146
  }
148
147
 
149
148
  /**
150
- * Props for {@link Reader}
151
- *
149
+ * Props for {@link TechDocsReaderLayout}
152
150
  * @public
153
151
  */
154
- declare type ReaderProps = {
155
- entityRef: CompoundEntityRef;
152
+ declare type TechDocsReaderLayoutProps = {
153
+ /**
154
+ * Show or hide the header, defaults to true.
155
+ */
156
+ withHeader?: boolean;
157
+ /**
158
+ * Show or hide the content search bar, defaults to true.
159
+ */
156
160
  withSearch?: boolean;
157
- onReady?: () => void;
158
161
  };
159
162
  /**
160
- * Component responsible for rendering TechDocs documentation
161
- *
163
+ * Default TechDocs reader page structure composed with a header and content
162
164
  * @public
163
165
  */
164
- declare const Reader: (props: ReaderProps) => JSX.Element;
165
-
166
+ declare const TechDocsReaderLayout: ({ withSearch, withHeader, }: TechDocsReaderLayoutProps) => JSX.Element;
166
167
  /**
167
- * Helper function that gives the children of {@link TechDocsReaderPage} access to techdocs and entity metadata
168
- *
169
- * @public
170
- */
171
- declare type TechDocsReaderPageRenderFunction = ({ techdocsMetadataValue, entityMetadataValue, entityRef, }: {
172
- techdocsMetadataValue?: TechDocsMetadata | undefined;
173
- entityMetadataValue?: TechDocsEntityMetadata | undefined;
174
- entityRef: CompoundEntityRef;
175
- onReady: () => void;
176
- }) => JSX.Element;
177
- /**
178
- * Props for {@link TechDocsReaderPage}
179
- *
180
168
  * @public
181
169
  */
182
170
  declare type TechDocsReaderPageProps = {
183
- children?: TechDocsReaderPageRenderFunction | React.ReactNode;
171
+ entityRef?: CompoundEntityRef;
172
+ children?: TechDocsReaderPageRenderFunction | ReactNode;
184
173
  };
185
174
 
186
175
  /**
187
176
  * Props for {@link TechDocsReaderPageHeader}
188
177
  *
189
178
  * @public
179
+ * @deprecated No need to pass down properties anymore. The component consumes data from `TechDocsReaderPageContext` instead. Use the {@link @backstage/plugin-techdocs-react#useTechDocsReaderPage} hook for custom header.
190
180
  */
191
181
  declare type TechDocsReaderPageHeaderProps = PropsWithChildren<{
192
- entityRef: CompoundEntityRef;
182
+ entityRef?: CompoundEntityRef;
193
183
  entityMetadata?: TechDocsEntityMetadata;
194
184
  techDocsMetadata?: TechDocsMetadata;
195
185
  }>;
196
186
  /**
197
- * Component responsible for rendering a Header with metadata on TechDocs reader page.
187
+ * Renders the reader page header.
188
+ * This component does not accept props, please use
189
+ * the Tech Docs add-ons to customize it
190
+ * @public
191
+ */
192
+ declare const TechDocsReaderPageHeader: (props: TechDocsReaderPageHeaderProps) => JSX.Element | null;
193
+
194
+ /**
195
+ * Props for {@link TechDocsReaderPageContent}
196
+ * @public
197
+ */
198
+ declare type TechDocsReaderPageContentProps = {
199
+ /**
200
+ * @deprecated No need to pass down entityRef as property anymore. Consumes the entityName from `TechDocsReaderPageContext`. Use the {@link @backstage/plugin-techdocs-react#useTechDocsReaderPage} hook for custom reader page content.
201
+ */
202
+ entityRef?: CompoundEntityRef;
203
+ /**
204
+ * Show or hide the search bar, defaults to true.
205
+ */
206
+ withSearch?: boolean;
207
+ /**
208
+ * Callback called when the content is rendered.
209
+ */
210
+ onReady?: () => void;
211
+ };
212
+ /**
213
+ * Renders the reader page content
214
+ * @public
215
+ */
216
+ declare const TechDocsReaderPageContent: (props: TechDocsReaderPageContentProps) => JSX.Element;
217
+ /**
218
+ * Component responsible for rendering TechDocs documentation
219
+ * @public
220
+ * @deprecated use `TechDocsReaderPageContent` component instead.
221
+ */
222
+ declare const Reader: (props: TechDocsReaderPageContentProps) => JSX.Element;
223
+
224
+ /**
225
+ * @public
226
+ * A state representation that is used to configure the UI of <Reader />
227
+ */
228
+ declare type ContentStateTypes =
229
+ /** There is nothing to display but a loading indicator */
230
+ 'CHECKING'
231
+ /** There is no content yet -> present a full screen loading page */
232
+ | 'INITIAL_BUILD'
233
+ /** There is content, but the backend is about to update it */
234
+ | 'CONTENT_STALE_REFRESHING'
235
+ /** There is content, but after a reload, the content will be different */
236
+ | 'CONTENT_STALE_READY'
237
+ /** There is content, the backend tried to update it, but failed */
238
+ | 'CONTENT_STALE_ERROR'
239
+ /** There is nothing to see but a "not found" page. Is also shown on page load errors */
240
+ | 'CONTENT_NOT_FOUND'
241
+ /** There is only the latest and greatest content */
242
+ | 'CONTENT_FRESH';
243
+ /**
244
+ * @public shared reader state
245
+ */
246
+ declare type ReaderState = {
247
+ state: ContentStateTypes;
248
+ path: string;
249
+ contentReload: () => void;
250
+ content?: string;
251
+ contentErrorMessage?: string;
252
+ syncErrorMessage?: string;
253
+ buildLog: string[];
254
+ };
255
+
256
+ /**
257
+ * @public Render function for {@link TechDocsReaderProvider}
258
+ */
259
+ declare type TechDocsReaderProviderRenderFunction = (value: ReaderState) => JSX.Element;
260
+ /**
261
+ * @public Props for {@link TechDocsReaderProvider}
262
+ */
263
+ declare type TechDocsReaderProviderProps = {
264
+ children: TechDocsReaderProviderRenderFunction | ReactNode;
265
+ };
266
+ /**
267
+ * Provides shared building process state to the reader page components.
198
268
  *
199
269
  * @public
200
270
  */
201
- declare const TechDocsReaderPageHeader: (props: TechDocsReaderPageHeaderProps) => JSX.Element;
271
+ declare const TechDocsReaderProvider: ({ children, }: TechDocsReaderProviderProps) => JSX.Element;
272
+
273
+ /**
274
+ * Renders the reader page subheader.
275
+ * Please use the Tech Docs add-ons to customize it
276
+ * @public
277
+ */
278
+ declare const TechDocsReaderPageSubheader: ({ toolbarProps, }: {
279
+ toolbarProps?: ToolbarProps<"div", {}> | undefined;
280
+ }) => JSX.Element | null;
202
281
 
203
282
  /**
204
283
  * Props for {@link TechDocsSearchResultListItem}.
@@ -415,7 +494,7 @@ declare type TechDocsCustomHomeProps = {
415
494
  * @public
416
495
  */
417
496
  declare type TechDocsPageWrapperProps = {
418
- children?: React.ReactNode;
497
+ children?: React__default.ReactNode;
419
498
  };
420
499
  /**
421
500
  * Component wrapping a techdocs page with Page and Header components
@@ -456,7 +535,9 @@ declare const TechdocsPage: () => JSX.Element;
456
535
  *
457
536
  * @public
458
537
  */
459
- declare const EntityTechdocsContent: () => JSX.Element;
538
+ declare const EntityTechdocsContent: (props: {
539
+ children?: React.ReactNode;
540
+ }) => JSX.Element;
460
541
  /**
461
542
  * Component which takes a custom tabs config object and renders a documentation landing page.
462
543
  *
@@ -493,6 +574,25 @@ declare const Router: () => JSX.Element;
493
574
  *
494
575
  * @public
495
576
  */
496
- declare const EmbeddedDocsRouter: () => JSX.Element;
577
+ declare const EmbeddedDocsRouter: (props: PropsWithChildren<{}>) => JSX.Element;
578
+
579
+ /**
580
+ * The Backstage plugin that renders technical documentation for your components
581
+ *
582
+ * @packageDocumentation
583
+ */
584
+
585
+ /**
586
+ * @deprecated Import from `@backstage/plugin-techdocs-react` instead
587
+ *
588
+ * @public
589
+ */
590
+ declare type DeprecatedTechDocsMetadata = TechDocsMetadata;
591
+ /**
592
+ * @deprecated Import from `@backstage/plugin-techdocs-react` instead
593
+ *
594
+ * @public
595
+ */
596
+ declare type DeprecatedTechDocsEntityMetadata = TechDocsEntityMetadata;
497
597
 
498
- export { DefaultTechDocsHome, DefaultTechDocsHomeProps, DocsCardGrid, DocsCardGridProps, DocsTable, DocsTableProps, DocsTableRow, EmbeddedDocsRouter, EntityListDocsGrid, EntityListDocsTable, EntityListDocsTableProps, EntityTechdocsContent, PanelConfig, PanelType, Reader, ReaderProps, Router, SyncResult, TabConfig, TabsConfig, TechDocsApi, TechDocsClient, TechDocsCustomHome, TechDocsCustomHomeProps, TechDocsEntityMetadata, TechDocsIndexPage, TechDocsMetadata, TechDocsPageWrapper, TechDocsPageWrapperProps, TechDocsPicker, TechDocsReaderPage, TechDocsReaderPageHeader, TechDocsReaderPageHeaderProps, TechDocsReaderPageProps, TechDocsReaderPageRenderFunction, TechDocsSearch, TechDocsSearchProps, TechDocsSearchResultListItem, TechDocsSearchResultListItemProps, TechDocsStorageApi, TechDocsStorageClient, TechdocsPage, isTechDocsAvailable, techdocsPlugin as plugin, techdocsApiRef, techdocsPlugin, techdocsStorageApiRef };
598
+ export { ContentStateTypes, DefaultTechDocsHome, DefaultTechDocsHomeProps, DocsCardGrid, DocsCardGridProps, DocsTable, DocsTableProps, DocsTableRow, EmbeddedDocsRouter, EntityListDocsGrid, EntityListDocsTable, EntityListDocsTableProps, EntityTechdocsContent, PanelConfig, PanelType, Reader, ReaderState, Router, SyncResult, TabConfig, TabsConfig, TechDocsApi, TechDocsClient, TechDocsCustomHome, TechDocsCustomHomeProps, DeprecatedTechDocsEntityMetadata as TechDocsEntityMetadata, TechDocsIndexPage, DeprecatedTechDocsMetadata as TechDocsMetadata, TechDocsPageWrapper, TechDocsPageWrapperProps, TechDocsPicker, TechDocsReaderLayout, TechDocsReaderLayoutProps, TechDocsReaderPage, TechDocsReaderPageContent, TechDocsReaderPageContentProps, TechDocsReaderPageHeader, TechDocsReaderPageHeaderProps, TechDocsReaderPageProps, TechDocsReaderPageRenderFunction, TechDocsReaderPageSubheader, TechDocsReaderProvider, TechDocsReaderProviderProps, TechDocsReaderProviderRenderFunction, TechDocsSearch, TechDocsSearchProps, TechDocsSearchResultListItem, TechDocsSearchResultListItemProps, TechDocsStorageApi, TechDocsStorageClient, TechdocsPage, isTechDocsAvailable, techdocsPlugin as plugin, techdocsApiRef, techdocsPlugin, techdocsStorageApiRef };