UNPKG

asciitorium

Version:

an ASCII ui framework for web + cli

61 lines (60 loc) 1.68 kB
import { Alignment } from './types'; import type { State } from './State'; import { LayoutType, LayoutOptions } from './layouts/LayoutStrategy'; import './layouts'; export interface ComponentProps { label?: string; comment?: string; showLabel?: boolean; width?: number; height?: number; border?: boolean; fill?: string; align?: Alignment; bind?: State<any> | ((state: State<any>) => void); fixed?: boolean; x?: number; y?: number; z?: number; gap?: number; children?: Component[]; layout?: LayoutType; layoutOptions?: LayoutOptions; } export declare abstract class Component { label: string | undefined; comment: string | undefined; showLabel: boolean; width: number; height: number; border: boolean; fill: string; align?: Alignment; fixed: boolean; x: number; y: number; z: number; gap: number; focusable: boolean; hasFocus: boolean; transparentChar: string; protected buffer: string[][]; private unbindFns; parent?: Component; protected children: Component[]; protected layoutType: LayoutType; protected layoutOptions?: LayoutOptions; private layoutStrategy?; constructor(props: ComponentProps); setParent(parent: Component): void; addChild(child: Component): void; removeChild(child: Component): void; getChildren(): Component[]; getAllDescendants(): Component[]; protected invalidateLayout(): void; protected recalculateLayout(): void; bind<T>(state: State<T>, apply: (val: T) => void): void; destroy(): void; handleEvent(event: string): boolean; draw(): string[][]; }