UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

39 lines (38 loc) 1.68 kB
import { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter'; import { EventContract } from '@sprucelabs/mercury-types'; import { Terminal } from 'terminal-kit'; import { BaseWidget, UniversalWidgetOptions, WidgetFrame, WidgetFrameCalculated, WidgetPadding } from '../types/widgets.types'; export type BaseWidgetWithTermKitAddons = BaseWidget & { getTermKitElement: () => any | null; }; export type TkWidgetOptions = UniversalWidgetOptions & { term: Terminal; parent: BaseWidgetWithTermKitAddons; }; export default abstract class TkBaseWidget<Contract extends EventContract = any> extends AbstractEventEmitter<Contract> implements BaseWidget<Contract> { type: string; protected parent: BaseWidgetWithTermKitAddons | null; protected term: Terminal; private id; private children; protected shouldLockWidthWithParent: boolean; protected shouldLockHeightWithParent: boolean; protected shouldLockRightWithParent: boolean; protected shouldLockBottomWithParent: boolean; protected padding: WidgetPadding; private frameLockDeltas; constructor(options: TkWidgetOptions); getChildren(): BaseWidget[]; addChild(child: BaseWidget): void; getId(): string | null; getParent(): BaseWidget | null; getFrame(): WidgetFrameCalculated; setFrame(frame: Partial<WidgetFrame>): void; protected sizeLockedChildren(): void; getChildById(id?: string): BaseWidget | null; removeChild(child: BaseWidget): void; protected handleParentResize(parentFrame: WidgetFrameCalculated): void; destroy(): Promise<void>; getTermKitElement(): any | null; protected calculateSizeLockDeltas(): void; }