export interface TableTitle { type: "title"; text: string; } export interface TableSectionHeader { type: "section-header"; text: string; subtitle?: string; } export interface TableHeader { type: "header"; cells: string[]; } export interface TableRow { type: "row"; cells: string[]; } export type TableItem = TableTitle | TableSectionHeader | TableHeader | TableRow; /** * Formats an array of titles, section headers, headers, and rows into a table * string with box-drawing characters. * * Features: * - Titles are centered in a standalone box with double borders (╔═╗) * - Section headers group related content with automatic closing * - Headers and rows can have different numbers of cells * - Rows with fewer cells than max columns are handled with special rendering * * @param items An array of table items (titles, section headers, headers, and rows). * Sections are automatically closed when a new section-header or title appears, or * at the end of the table. * @returns The formatted table as a string, ready to be rendered. * * @example * ```ts * formatTable([ * { type: "title", text: "My Table" }, * { type: "section-header", text: "User Data" }, * { type: "header", cells: ["Name", "Age", "City"] }, * { type: "row", cells: ["Alice", "30", "NYC"] }, * { type: "row", cells: ["Bob", "25", "LA"] }, * { type: "section-header", text: "Summary" }, * { type: "header", cells: ["Total", "Count"] }, * { type: "row", cells: ["55", "2"] } * ]); * * // => * // ╔═══════════════════╗ * // ║ My Table ║ * // ╚═══════════════════╝ * // ╔═══════════════════╗ * // ║ User Data ║ * // ╟───────┬─────┬─────╢ * // ║ Name │ Age │ City║ * // ╟───────┼─────┼─────╢ * // ║ Alice │ 30 │ NYC ║ * // ╟───────┼─────┼─────╢ * // ║ Bob │ 25 │ LA ║ * // ╚═══════╧═════╧═════╝ * // ╔═══════════════════╗ * // ║ Summary ║ * // ╟───────┬───────────╢ * // ║ Total │ Count ║ * // ╟───────┼───────────╢ * // ║ 55 │ 2 ║ * // ╚═══════╧═══════════╝ * ``` */ export declare function formatTable(items: TableItem[]): string; //# sourceMappingURL=format.d.ts.map