import type { ColorName } from "./colors.js"; export type Element = { type: "box" | "text" | "list" | "textInput"; style?: Style; content?: string; children?: Element[]; items?: string[]; selectedIndex?: number; value?: string; key?: string; }; /** * Color fields accept either a `ColorName` from the named palette or * an arbitrary string (used for hex values like `"#abc"` in the HTML * adapter). The `string & {}` intersection preserves autocomplete on * the named branch while keeping the string escape hatch. */ export type Color = ColorName | (string & {}); export type Style = { flexDirection?: "row" | "column"; flex?: number; justifyContent?: "flex-start" | "center" | "flex-end" | "space-between"; alignItems?: "flex-start" | "center" | "flex-end" | "stretch"; width?: number | string; height?: number | string; minWidth?: number; minHeight?: number; maxWidth?: number; maxHeight?: number; padding?: number | { top?: number; bottom?: number; left?: number; right?: number; }; margin?: number | { top?: number; bottom?: number; left?: number; right?: number; }; border?: boolean; borderColor?: Color; label?: string; labelColor?: Color; fg?: Color; bg?: Color; bold?: boolean; fill?: string; scrollable?: boolean; scrollOffset?: number; visible?: boolean; }; export type StyleProps = Style & { key?: string; }; export type Cell = { char: string; fg?: string; bg?: string; bold?: boolean; }; export type FrameStyle = Pick; export type PositionedElement = Element & { resolvedX: number; resolvedY: number; resolvedWidth: number; resolvedHeight: number; children?: PositionedElement[]; };