You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.cts 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. interface UIOptions {
  2. width: number;
  3. wrap?: boolean;
  4. rows?: string[];
  5. }
  6. interface Column {
  7. text: string;
  8. width?: number;
  9. align?: "right" | "left" | "center";
  10. padding: number[];
  11. border?: boolean;
  12. }
  13. interface ColumnArray extends Array<Column> {
  14. span: boolean;
  15. }
  16. interface Line {
  17. hidden?: boolean;
  18. text: string;
  19. span?: boolean;
  20. }
  21. declare class UI {
  22. width: number;
  23. wrap: boolean;
  24. rows: ColumnArray[];
  25. constructor(opts: UIOptions);
  26. span(...args: ColumnArray): void;
  27. resetOutput(): void;
  28. div(...args: (Column | string)[]): ColumnArray;
  29. private shouldApplyLayoutDSL;
  30. private applyLayoutDSL;
  31. private colFromString;
  32. private measurePadding;
  33. toString(): string;
  34. rowToString(row: ColumnArray, lines: Line[]): Line[];
  35. // if the full 'source' can render in
  36. // the target line, do so.
  37. private renderInline;
  38. private rasterize;
  39. private negatePadding;
  40. private columnWidths;
  41. }
  42. declare function ui(opts: UIOptions): UI;
  43. export { ui as default };