UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

164 lines (163 loc) • 5.35 kB
import TKButtonWidget from '../terminalKit/TKButtonWidget'; import TkInputWidget from '../terminalKit/TkInputWidget'; import TkLayoutCellWidget from '../terminalKit/TkLayoutCellWidget'; import TkLayoutWidget from '../terminalKit/TkLayoutWidget'; import TkMenuBarWidget from '../terminalKit/TkMenuBarWidget'; import TkPopupWidget from '../terminalKit/TkPopupWidget'; import TkProgressBarWidget from '../terminalKit/TkProgressBarWidget'; import TkTextWidget from '../terminalKit/TkTextWidget'; import TkWindowWidget from '../terminalKit/TkWindowWidget'; import { ButtonWidget, ButtonWidgetOptions } from './button.types'; import { InputWidget, InputWidgetOptions } from './input.types'; import { LayoutWidgetOptions, LayoutWidget, LayoutCellWidgetOptions, LayoutCellWidget } from './layout.types'; import { MenuBarWidgetOptions, MenuBarWidget } from './menuBar.types'; import { PopupWidget, PopupWidgetOptions } from './popup.types'; import { ProgressBarWidgetOptions, ProgressBarWidget } from './progressBar.types'; import { TextWidgetOptions, TextWidget } from './text.types'; import { UniversalWidgetOptions } from './widgets.types'; import { WindowWidgetOptions, WindowWidget } from './window.types'; export type WidgetType = keyof WidgetRegistry; export type Widget<T extends WidgetType = WidgetType> = WidgetRegistry[T]; export type FactoryOptions<T extends WidgetType> = UniversalWidgetOptions & OptionsMap[T]; interface OptionsMap { text: TextWidgetOptions; window: WindowWidgetOptions; layout: LayoutWidgetOptions; layoutCell: LayoutCellWidgetOptions; progressBar: ProgressBarWidgetOptions; menuBar: MenuBarWidgetOptions; popup: PopupWidgetOptions; button: ButtonWidgetOptions; input: InputWidgetOptions; } export interface WidgetRegistry { text: TextWidget; window: WindowWidget; layout: LayoutWidget; layoutCell: LayoutCellWidget; progressBar: ProgressBarWidget; menuBar: MenuBarWidget; popup: PopupWidget; button: ButtonWidget; input: InputWidget; } export declare const widgetRegistry: { window: typeof TkWindowWidget; text: typeof TkTextWidget; layout: typeof TkLayoutWidget; layoutCell: typeof TkLayoutCellWidget; progressBar: typeof TkProgressBarWidget; menuBar: typeof TkMenuBarWidget; popup: typeof TkPopupWidget; button: typeof TKButtonWidget; input: typeof TkInputWidget; }; export declare const contractRegistry: { window: { eventSignatures: { key: { emitPayloadSchema: { id: string; fields: { key: { type: "text"; isRequired: true; }; }; }; }; kill: { emitPayloadSchema: { id: string; fields: { code: { type: "number"; isRequired: true; }; }; }; }; resize: { emitPayloadSchema: { id: string; fields: { width: { type: "number"; isRequired: true; }; height: { type: "number"; isRequired: true; }; }; }; }; }; }; text: { eventSignatures: { click: { emitPayloadSchema: { id: string; fields: { column: { type: "number"; isRequired: true; }; row: { type: "number"; isRequired: true; }; text: { type: "text"; }; }; }; }; }; }; layout: null; layoutCell: null; progressBar: null; menuBar: { eventSignatures: { select: { emitPayloadSchema: { id: string; fields: { value: { type: "text"; isRequired: true; }; }; }; }; }; }; popup: null; button: { eventSignatures: { click: {}; }; }; input: { eventSignatures: { submit: { emitPayloadSchema: { id: string; fields: { value: { type: "raw"; isRequired: true; options: { valueType: string; }; }; }; }; }; cancel: {}; }; }; }; export {};