/** * Reads a component's docs straight from its source, for the project's own * elements that have no Custom Elements Manifest. The dev server runs this * over each module it transforms; the result is per class, with the * superclass left unresolved, and `source-index.ts` joins classes across * modules into `ComponentDocs`. * * Mixins are read too: a top-level function that returns a class documents * that class's members under the function's name, and a class's `extends * A(B(Base))` names the mixins and the base for the index to follow. * * What it reads, in the analyzer's vocabulary: the tag from * `@customElement('x-y')` or `customElements.define('x-y', Class)`, the * class's JSDoc (`@summary`, `@deprecated`, `@fires`/`@event`, `@slot`, * `@csspart`, `@cssprop`/`@cssproperty`, `@cssstate`, `@example`), and its public * instance fields and accessors with their JSDoc, declared type, initializer * and attribute (from `@property()` or `static properties`). Internal * reactive state (`@state()`, `state: true`) and private, protected, `#` * and static members are not API and are left out. * * Never throws: a module that doesn't parse documents nothing. */ import type { ComponentDocs } from '../../types/component-docs.js'; /** `ComponentDocs` without what the index fills in. */ export type ClassDocsBody = Omit; export interface ClassDocs { name: string; /** Set when the module registers the class as a custom element. */ tagName?: string; /** `true` for `export default class`. */ isDefaultExport?: boolean; /** * The class it extends, when that is an identifier, also as the innermost * argument of mixin calls (`extends Sized(Base)` extends `Base`). */ superclass?: ClassRef; /** * The mixins it is built from, outermost first: `extends A(B(Base))` is * `[A, B]`. Only mixins called by name are listed. */ mixins?: ClassRef[]; docs: ClassDocsBody; } /** * Names a class or mixin as the module that declares it exports it: `name` * is that export's name (`default` for a default import), `specifier` the * import source when it is imported. */ export interface ClassRef { name: string; specifier?: string; } /** * A mixin the module declares at its top level: a function that returns a * class, read like one. `mixins` lists the mixins its class applies to the * function's argument in turn. */ export interface MixinDocs { name: string; isDefaultExport?: true; mixins?: ClassRef[]; docs: ClassDocsBody; } export interface ModuleDocs { classes: ClassDocs[]; /** Absent when the module declares none. */ mixins?: MixinDocs[]; } /** * The classes `code` declares at its top level, with their docs. `id` is the * module's id; its extension picks the parser's language. */ export declare const extractModuleDocs: (code: string, id: string) => ModuleDocs; //# sourceMappingURL=extract.d.ts.map