6.0.4 • Published 7 months ago

@types/cli-box v6.0.4

Weekly downloads
24
License
MIT
Repository
github
Last release
7 months ago

Installation

npm install --save @types/cli-box

Summary

This package contains type definitions for cli-box (https://github.com/IonicaBizau/node-cli-box).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cli-box.

index.d.ts

// Type definitions for cli-box 6.0
// Project: https://github.com/IonicaBizau/node-cli-box
// Definitions by: Kent Wong <https://github.com/athasach>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/*~ Note that ES6 modules cannot directly export callable functions.
 *~ This file should be imported using the CommonJS-style:
 *~   import x = require('someLibrary');
 *~
 *~ Refer to the documentation to understand common
 *~ workarounds for this limitation of ES6 modules.
 */

/*~ This declaration specifies that the function
 *~ is the exported object from the file
 */
export = Box;

type MarksKeys = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'b';
type Marks = Record<MarksKeys, string>;

interface Options {
    w?: number | undefined;
    width?: number | undefined;
    h?: number | undefined;
    height?: number | undefined;
    fullscreen?: boolean | undefined;
    stringify?: boolean | undefined;
    marks?: Partial<Marks> | undefined;
}

interface Text {
    text?: string | undefined;
    stretch?: boolean | undefined;
    autoEOL?: boolean | undefined;
    hAlign?: 'left' | 'middle' | 'right' | undefined;
    vAlign?: 'top' | 'center' | 'bottom' | undefined;
}

interface Box {
    stringify(): string;
    settings: {
        width: number;
        height: number;
        marks: Marks;
        lines: Array<{
            text: string;
            offset: {
                y: number;
            }
        }>
    };
    options: {
        width: number;
        height: number;
        marks: Marks;
        fullscreen: boolean;
        stringify: boolean;
    };
}

interface BoxConstructor {
    new(options: Options | string, text?: Text | string): Box;
    (options: (Exclude<Options, 'stringify'> & { stringify: true }), text?: Text | string): string;
    (options: Options | string, text?: Text | string): Box;
    defaults: { marks: Marks };
}

declare const Box: BoxConstructor;

Additional Details

  • Last updated: Thu, 08 Jul 2021 09:07:56 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Kent Wong.