import { PropType, SourceLocation } from '@structured-types/api'; export declare type STFS = { fileExists: (filePath: string) => Promise; readDirectory: (path: string) => Promise; isDirectory: (path: string) => Promise; readFile: (filePath: string) => Promise; cwd: () => string; }; /** * Documentation node kinds */ export declare enum NodeKind { Table = 1, TableRow = 2, TableCell = 3, Heading = 4, Paragraph = 5, Text = 6, Bold = 7, Emphasis = 8, Link = 9, Code = 10, InlineCode = 11, Block = 12, Collapsible = 13 } /** * Base documentation node */ export interface DocumentationNode { kind: NodeKind; } /** * Documentation node with children */ export interface DocumentationNodeWithChildren extends DocumentationNode { children: DocumentationNode[]; } /** * Node with children type guard predicate */ export declare const isNodeWithChildren: (node: DocumentationNode) => node is DocumentationNodeWithChildren; /** * Documentation node with a value */ export interface DocumentationNodeWithValue extends DocumentationNode { value: string; } /** * Node with value type guard predicate */ export declare const isNodeWithValue: (node: DocumentationNode) => node is DocumentationNodeWithValue; /** * Table node, where the first row is a table header row */ export interface TableNode extends DocumentationNode { kind: NodeKind.Table; children: TableRowNode[]; } /** * TableNode type guard predicate */ export declare const isTableNode: (node: DocumentationNode) => node is TableNode; /** * Table row node - can be a header or data row */ export interface TableRowNode extends DocumentationNode { kind: NodeKind.TableRow; children: TableCellNode[]; } /** * TableRowNode type guard predicate */ export declare const isTableRowNode: (node: DocumentationNode) => node is TableRowNode; /** * Table cell node, the content is a list of child nodes */ export interface TableCellNode extends DocumentationNodeWithChildren { kind: NodeKind.TableCell; } /** * TableCellNode type guard predicate */ export declare const isTableCellNode: (node: DocumentationNode) => node is TableCellNode; /** * Heading node with a depth parameter, the content is a list of child nodes */ export interface HeadingNode extends DocumentationNodeWithChildren { kind: NodeKind.Heading; depth: number; } /** * HeadingNode type guard predicate */ export declare const isHeadingNode: (node: DocumentationNode) => node is HeadingNode; /** * Paragraph node, the content is a list of child nodes */ export interface ParagraphNode extends DocumentationNodeWithChildren { kind: NodeKind.Paragraph; } /** * ParagraphNode type guard predicate */ export declare const isParagraphNode: (node: DocumentationNode) => node is ParagraphNode; /** * Text node, the content string is in the value field */ export interface TextNode extends DocumentationNodeWithValue { kind: NodeKind.Text; } /** * TextNode type guard predicate */ export declare const isTextNode: (node: DocumentationNode) => node is TextNode; /** * Bold/Strong node, the content is a list of child nodes */ export interface BoldNode extends DocumentationNodeWithChildren { kind: NodeKind.Bold; } /** * BoldNode type guard predicate */ export declare const isBoldNode: (node: DocumentationNode) => node is BoldNode; /** * Emphasis/Italic node, the content is a list of child nodes */ export interface EmphasisNode extends DocumentationNodeWithChildren { kind: NodeKind.Emphasis; } /** * EmphasisNode type guard predicate */ export declare const isEmphasisNode: (node: DocumentationNode) => node is EmphasisNode; /** * Link node with url property, the content is a list of child nodes */ export interface LinkNode extends DocumentationNodeWithChildren { kind: NodeKind.Link; url?: string; loc?: SourceLocation; } /** * LinkNode type guard predicate */ export declare const isLinkNode: (node: DocumentationNode) => node is LinkNode; /** * Code node, the content string is in the value field */ export interface CodeNode extends DocumentationNodeWithValue { kind: NodeKind.Code; } /** * CodeNode type guard predicate */ export declare const isCodeNode: (node: DocumentationNode) => node is CodeNode; /** * Inline code node, the content string is in the value field */ export interface InlineCodeNode extends DocumentationNodeWithValue { kind: NodeKind.InlineCode; } /** * InlineCodeNode type guard predicate */ export declare const isInlineCodeNode: (node: DocumentationNode) => node is InlineCodeNode; /** * Block - needs a new line */ export interface BlockNode extends DocumentationNodeWithChildren { kind: NodeKind.Block; } /** * BlockNode type guard predicate */ export declare const isBlockNode: (node: DocumentationNode) => node is BlockNode; /** * Collapsible node, the content are in the child elements */ export interface CollapsibleNode extends DocumentationNodeWithChildren { kind: NodeKind.Collapsible; summary: DocumentationNode[]; } /** * CollapsibleNode type guard predicate */ export declare const isCollapsibleNode: (node: DocumentationNode) => node is CollapsibleNode; export declare type TitleCallback = (prop: PropType) => string | undefined; export declare type SectionRenderCallback = (prop: PropType) => DocumentationNode[] | undefined; /** * Section configuration item */ export interface SectionConfig { hidden?: boolean; title?: string | TitleCallback; render?: SectionRenderCallback; } /** * Section names to be displayed */ export declare type SectionName = 'title' | 'type' | 'extends' | 'description' | 'location' | 'props' | 'examples'; /** * Section object kind configuration */ export declare type SectionObject = Partial>; /** * Sections can be configured as an array of the visible sections, or an object * with keys the section name, and values a configuration object * */ export declare type Sections = SectionName[] | SectionObject; /** * Properties table column names to be displayed */ export declare type ColumnName = 'name' | 'type' | 'parents' | 'default' | 'description'; export declare type PropRenderCallback = (name: ColumnName, prop: PropType) => DocumentationNode[] | undefined; /** * Column configuration item */ export interface ColumnConfig { hidden?: boolean; title?: string | TitleCallback; render?: PropRenderCallback; } /** * Column object kind configuration */ export declare type ColumnObject = Partial>; /** * Sections can be configured as an array of the visible sections, or an object * with keys the section name, and values a configuration object * */ export declare type Columns = ColumnName[] | ColumnObject; /** * Document page generation options */ export declare type DocumentationOptions = { /** * List of type names, that should not be expanded. For example, some internal React objects can be kept just as a string and will not be detailed in the documentation, instead of listing their internal properties. */ collapsed?: string[]; /** * List of plugins (or extensions). For example, for a react library, you can specify to include only react components, but not any additional types or utilities. */ extensions?: string[]; /** * List of type names, that should be "visible". * This will limit which of the parsed props to be documented. */ visible?: string[]; /** * List of the columns in the property tables `name` | `type` | `parents` | `value` | `description` | `all`. * By default, all columns will be visible. */ columns?: Columns; /** * List of the `sections` to generate `props` | `description` | `examples` | `title` | `location` | `all`. * By default, all sections are generated. */ sections?: Sections; /** * Whether to skip properties that are "inherited", or "composed". * For example, `type OwnProps = { x: number } & React.LineProps` will only output the `x` property and skip the inherited * React library properties. */ skipInherited?: boolean; /** * virtual file system for use in browser */ fs?: STFS; };