feat(site): generated multipart component api reference (#468)

This commit is contained in:
Darius Cepulis
2026-02-09 12:20:45 +11:00
committed by GitHub
parent 3c4152fb58
commit 4b1e863883
31 changed files with 1413 additions and 327 deletions
@@ -2,14 +2,20 @@ import * as ts from 'typescript';
import type { HtmlExtraction } from './types.js';
/** Extract tagName from a Lit element file. */
export function extractHtml(filePath: string, program: ts.Program, componentName: string): HtmlExtraction | null {
export function extractHtml(
filePath: string,
program: ts.Program,
componentName: string,
elementName?: string
): HtmlExtraction | null {
const sourceFile = program.getSourceFile(filePath);
if (!sourceFile) return null;
const className = elementName ?? `${componentName}Element`;
let tagName = '';
function visit(node: ts.Node) {
if (ts.isClassDeclaration(node) && node.name?.text === `${componentName}Element`) {
if (ts.isClassDeclaration(node) && node.name?.text === className) {
for (const member of node.members) {
if (
ts.isPropertyDeclaration(member) &&