import type { ColorValue, TableCellAlignKeyword, TableCellImage, TableCellVerticalAlign, TableCellPos, TableModel } from '../types.js'; /** Position of a cell within the grid (zero-based row/column). */ export type CellPos = TableCellPos; /** An inclusive rectangular range of cells, defined by two corners. */ export interface CellRange { start: CellPos; end: CellPos; } /** Horizontal alignment of a cell's content (`'start'` / `'end'` included, * #371). */ export type Align = TableCellAlignKeyword; /** Vertical alignment of a cell's content. */ export type VAlign = TableCellVerticalAlign; /** * Insert a new (empty) row. `at` is the index the new row will occupy; it is * clamped to `[0, rowCount]`, so `at >= rowCount` appends. */ export declare const addRow: (m: TableModel, at: number) => TableModel; /** * Insert a new (empty) column. `at` is the index the new column will occupy in * every row; it is clamped to `[0, columnCount]`. */ export declare const addColumn: (m: TableModel, at: number) => TableModel; /** Remove the row at `at`. Out-of-range indices leave the model unchanged. */ export declare const removeRow: (m: TableModel, at: number) => TableModel; /** Remove the column at `at`. Out-of-range indices leave the model unchanged. */ export declare const removeColumn: (m: TableModel, at: number) => TableModel; /** Replace the textual content of the cell at `at`. */ export declare const setCellContent: (m: TableModel, at: CellPos, content: string) => TableModel; /** * Set (or clear, with `undefined`) the image embedded in the cell at `at`: * a bitmap / SVG resource referenced by id, drawn inside the cell above its * content (see {@link TableCellImage}). */ export declare const setCellImage: (m: TableModel, at: CellPos, image: TableCellImage | undefined) => TableModel; /** * Set (or clear, with `undefined`) the fill colour of the cell at `at` * (`TableCell.background`), painted instead of the table style's header / * body fill. */ export declare const setCellBackground: (m: TableModel, at: CellPos, background: ColorValue | undefined) => TableModel; /** * Set (or clear) horizontal / vertical alignment for the cell at `at`. Passing * `undefined` for either argument removes that alignment. */ export declare const setAlignment: (m: TableModel, at: CellPos, align?: Align, vAlign?: VAlign) => TableModel; /** * Merge every cell in `range` into the top-left (primary) cell. The primary * cell receives the appropriate `colSpan`/`rowSpan`; the remaining cells are * marked `hiddenBy` the primary position so renderers can skip them. The * primary cell's content is preserved. A 1x1 range is a no-op. */ export declare const mergeCells: (m: TableModel, range: CellRange) => TableModel; /** * Undo a merge. `at` may be the primary cell of a merge or any cell hidden by * one. The primary cell's spans are cleared and all covered cells have their * `hiddenBy` markers removed. A non-merged cell is left unchanged. */ export declare const unmergeCell: (m: TableModel, at: CellPos) => TableModel; /** Options of {@link parseTSV}. */ export interface ParseTSVOptions { /** Leading rows that form the table header: their cells are marked * `isHeader` and the model gets `headerRowCount` (clamped to the row * count), so a table split across pages repeats them. Default 0 (no * header). */ headerRows?: number; } /** * Build a {@link TableModel} from tab-separated text. Rows are split on * newlines (CRLF / CR / LF), cells on tabs. Shorter rows are padded with empty * cells so the grid is rectangular. Empty input yields an empty model. * `options.headerRows` turns the leading rows into header rows. */ export declare const parseTSV: (input: string, options?: ParseTSVOptions) => TableModel; /** A place where a table model is not the rectangular grid the layout * expects (see {@link tableGridIssues}). */ export interface TableGridIssue { /** `'spanOverlap'`: a visible cell sits under another cell's `colSpan` / * `rowSpan` — the cell a merge covers must stay in its row, marked * `hiddenBy`, or the cells after it shift. `'missingCells'`: a row ends * before the grid's last column with no merge covering the rest, which * leaves a hole. */ kind: 'spanOverlap' | 'missingCells'; /** The offending cell (`spanOverlap`), or the first position of the row * with no cell (`missingCells`). */ row: number; col: number; /** For `spanOverlap`: the primary cell whose merge covers the position. */ coveredBy?: CellPos; } /** * Check that a table model is a rectangular grid once its merges are * counted. Cells are laid out by their array index — `rows[r][c]` sits in * column `c` — so a model written HTML-style, leaving out the cells a * `colSpan` / `rowSpan` covers instead of keeping them with `hiddenBy` (what * {@link mergeCells} does), shifts the cells after the merge onto it. * Returns the issues in row-major order (at most one `missingCells` per * row); an empty list means the grid is sound. */ export declare const tableGridIssues: (m: TableModel) => TableGridIssue[]; //# sourceMappingURL=model.d.ts.map