UNPKG

@thi.ng/text-canvas

Version:

Text based canvas, drawing, plotting, tables with arbitrary formatting (incl. ANSI/HTML)

46 lines 1.39 kB
import { Border, type TableOpts } from "./api.js"; import { type Canvas } from "./canvas.js"; export type RawCell = { body: string; format?: number; height?: number; hard?: boolean; wrap?: boolean; }; export type Cell = { body: string[]; format?: number; height?: number; }; export declare const initTable: (opts: TableOpts, cells: (string | RawCell)[][]) => { style: import("./api.js").StrokeStyle | undefined; format: number | undefined; formatHead: number | undefined; width: number; height: number; cells: Cell[][]; rowHeights: number[]; cols: { width: number; }[]; numCols: number; numRows: number; padH: number; padV: number; b: Border; bH: number; bV: number; bFH: number; bFV: number; }; export declare const drawTable: (canvas: Canvas, x: number, y: number, opts: ReturnType<typeof initTable>) => void; export declare const table: (canvas: Canvas, x: number, y: number, opts: TableOpts, cells: (string | RawCell)[][]) => number[]; /** * Initializes table with given options and contents. Then creates * auto-sized canvas for it, renders table and returns canvas. * * @param opts - table config * @param cells - table cells (row major) */ export declare const tableCanvas: (opts: TableOpts, cells: (string | RawCell)[][]) => Canvas; //# sourceMappingURL=table.d.ts.map