@backstage/plugin-techdocs 1.0.1-next.1 → 1.1.0-next.3

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