UNPKG

@teachingtextbooks/keyboard

Version:

Customizable TypeScript soft keyboard

93 lines (92 loc) 2.68 kB
export default interface IKeyboard { resize(width: number): void; move(x: number, y: number, width: number): void; enable(bool: Boolean): void; isShowed(): boolean; show(quick?: boolean): void; hide(quick?: boolean): void; input(code: string, down: boolean): void; shiftOn(capsLock: boolean): void; shiftOff(capsLock: boolean): void; setCallbacks(input?: Function | null, hardKey?: Function | null, showHide?: Function | null, key?: Function | null): void; } export interface IKeyboardConfig { type: string; layout: IKeyboardLayout; align?: string; position?: string; width?: number; maxBtnScale?: number; padding?: number; keysGap?: number; rowsGap?: number; cross?: boolean; showed?: boolean; showType?: string; scale?: number; upperCase?: boolean; stickDelay?: number; } export interface IKeyboardLayout { rows: IKeyRowConfig[]; } export interface IKeyRowConfig { keys: (string | [string, string | null])[]; } export interface IKeyConfig { key?: string; code: string; label?: string; caseSens?: boolean; service?: boolean; isSpace?: boolean; isShift?: boolean; isBackspace?: boolean; isDelete?: boolean; isTab?: boolean; } export interface IKeyBtn { getCode(): string; getSideMargins(): number; getHolder(): HTMLElement; setScale(val: number): void; enable(bool: Boolean): void; addClass(val: string): void; removeClass(val: string): void; setPosition(top: number, right: number, bottom: number, left: number): void; upperCase(): void; lowerCase(): void; show(bool: boolean): void; } export interface IKeysRow { getID(): number; attach(): void; remove(): void; setScale(val: number): void; getClientWidth(): number; getKeysMargin(): number; enable(bool: Boolean): void; hasUpperCase(): boolean; hasShift(): boolean; hasCapsLock(): boolean; shift(bool: boolean, capsLock: boolean, capsLocked: boolean): void; } export interface IFauxInput { getID(): string; getValue(): string; input(key: string, code: string, shift: boolean): void; enable(): void; disable(): void; isEnabled(): boolean; addClass(val: string): void; isPassword: boolean; isFocused(): boolean; focusIn(silent?: boolean): void; focusOut(silent?: boolean): void; removeClass(val: string): void; resetFocusCallbacks(): void; setFocusCallbacks(cIn: Function | null, cOut: Function | null): void; resetInputCallbacks(): void; setInputCallbacks(down: Function | null, up: Function | null): void; dispose(): void; }