import React from 'react'; import { JavaScriptFile, type ModuleExport } from '../../file-system/entries.ts'; import { type RepositoryInput } from '../../file-system/Repository.ts'; import type { FileSystem } from '../../file-system/FileSystem.ts'; import { type Kind, type TypeFilter, type TypeOfKind } from '../../utils/resolve-type.ts'; import { type PathLike } from '../../utils/path.ts'; type GapSize = 'small' | 'medium' | 'large'; type ClassAccessor = NonNullable['accessors']>[number]; type AccessorKind = ClassAccessor['kind'] | Kind.GetAccessorSignature['kind'] | Kind.SetAccessorSignature['kind']; export interface ReferenceComponents { Section: React.ComponentType<{ /** The section's ID. */ id?: string; /** The kind of the section. */ kind: Kind['kind']; /** The content of the section. */ children?: React.ReactNode; }>; SectionHeading: React.ComponentType<{ /** The kind formatted as a label, e.g. "Type Alias", "Function". */ label?: string; /** The section's title, e.g. the export identifier name. */ title?: string; /** Label based on the kind and title. */ 'aria-label'?: string; }>; SectionBody: React.ComponentType<{ /** Whether the section has a description. */ hasDescription: boolean; /** The content of the section body. */ children: React.ReactNode; }>; Column: React.ComponentType<{ /** The gap size between the column's children. */ gap?: GapSize; /** The content of the column. */ children?: React.ReactNode; }>; Row: React.ComponentType<{ /** The gap size between the row's children. */ gap?: GapSize; /** The content of the row. */ children?: React.ReactNode; }>; Code: React.ComponentType<{ /** The content of the code. */ children?: React.ReactNode; }>; Description: React.ComponentType<{ /** The content of the description. */ children: string; }>; Detail: React.ComponentType<{ /** The kind of the detail. */ kind: Kind['kind']; /** The content of the detail. */ children: React.ReactNode; }>; Signatures: React.ComponentType<{ /** The content of the signatures. */ children: React.ReactNode; }>; DetailHeading: React.ComponentType<{ /** The content of the detail heading. */ children?: React.ReactNode; }>; Table: React.ComponentType<{ /** The content of the table. */ children?: React.ReactNode; }>; TableHead: React.ComponentType<{ /** The content of the table head. */ children?: React.ReactNode; }>; TableBody: React.ComponentType<{ /** The content of the table body. */ children?: React.ReactNode; }>; TableRowGroup: React.ComponentType<{ /** Whether the row has a sub-row. */ hasSubRow?: boolean; /** The content of the row group. */ children?: React.ReactNode; }>; TableRow: React.ComponentType<{ /** Whether the row has a sub-row. */ hasSubRow?: boolean; /** The content of the row. */ children?: React.ReactNode; }>; TableSubRow: React.ComponentType<{ /** The number of columns the cell should span. */ colSpan?: number; /** The content of the sub-row. */ children: React.ReactNode; }>; TableHeader: React.ComponentType<{ /** The number of columns the cell should span. */ colSpan?: number; /** The content of the header cell. */ children?: React.ReactNode; }>; TableData: React.ComponentType<{ /** Index of the data cell. */ index: number; /** Whether the row has a sub-row. */ hasSubRow?: boolean; /** The number of columns the cell should span. */ colSpan?: number; /** The content of the cell. */ children?: React.ReactNode; }>; AccessorName: React.ComponentType<{ /** The accessor's identifier. */ name?: string; /** Whether the accessor is a getter or setter. */ kind: AccessorKind; }>; } export interface ReferenceProps { /** The file path, `JavaScriptFile`, or `ModuleExport` type reference to resolve. */ source: string | PathLike | JavaScriptFile | ModuleExport; /** * Repository context for string-based `source` values. * Pass a `Repository` created from trusted application configuration. * Do not construct it from request params, search params, CMS content, or * MDX frontmatter unless you fully trust them. * If an attacker controls the underlying repository locator, they can choose * which repository the server resolves against: * - local paths and `file://` URLs can expose another local repository * - remote URLs can trigger fetches/clones to attacker-chosen remotes * The concern is repository selection and data access, not command injection. */ repository?: RepositoryInput; /** File-system context for string-based `source` values. */ fileSystem?: FileSystem; /** Optional filter for including additional properties from referenced types. */ filter?: TypeFilter; /** Base directory for relative `source` values. Passing `import.meta.url` will resolve the directory of the current file. */ baseDirectory?: PathLike; /** Override default component renderers. */ components?: Partial; } /** Resolves TypeScript and JSDoc types from all module exports in a source file. */ export declare const Reference: typeof ReferenceWithFallback | typeof ReferenceAsync; declare function ReferenceWithFallback(props: ReferenceProps): React.JSX.Element; declare function ReferenceAsync({ source, repository, fileSystem, filter, baseDirectory, components, }: ReferenceProps): Promise; export {};