UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

31 lines (30 loc) 876 B
import type { Viewport } from '../Viewport.js'; import type { Props as ViewProps } from '../View.js'; import { View } from '../View.js'; import { Size } from '../geometry.js'; export interface LegendItem { key: string | string[]; label: string; } export interface Props extends ViewProps { separator?: string; } export interface ComputedItem { keyText: string; keyWidth: number; label: string; labelWidth: number; totalWidth: number; } export declare abstract class AbstractLegend extends View { #private; constructor(props: Props); update(props: Props): void; computeItems(items: LegendItem[]): ComputedItem[]; /** * called during render and naturalSize - subclasses cache the result. */ abstract collectItems(): ComputedItem[]; naturalSize(available: Size): Size; render(viewport: Viewport): void; }