Socket
Socket
Sign inDemoInstall

boxen

Package Overview
Dependencies
34
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

283

index.d.ts

@@ -0,34 +1,130 @@

import {LiteralUnion} from 'type-fest';
import cliBoxes, {BoxStyle} from 'cli-boxes';
/**
* Placeholder type allowing hex values in `borderColor` and `backgroundColor`.
*
* @todo Remove if [TypeScript issue](https://github.com/Microsoft/TypeScript/issues/29729) is resolved.
*/
type HexColor = string & {hex?: any};
declare namespace boxen {
/**
Characters used for custom border.
/**
* Characters used for custom border.
*
* @example
*
* // affffb
* // e e
* // dffffc
*
* const border: CustomBorderStyle = {
* topLeft: 'a',
* topRight: 'b',
* bottomRight: 'c',
* bottomLeft: 'd',
* vertical: 'e',
* horizontal: 'f'
* };
*/
export interface CustomBorderStyle extends BoxStyle {}
@example
```
// affffb
// e e
// dffffc
/**
* Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
*/
export const enum BorderStyle {
const border: CustomBorderStyle = {
topLeft: 'a',
topRight: 'b',
bottomRight: 'c',
bottomLeft: 'd',
vertical: 'e',
horizontal: 'f'
};
```
*/
interface CustomBorderStyle extends BoxStyle {}
/**
Spacing used for `padding` and `margin`.
*/
interface Spacing {
readonly top: number;
readonly right: number;
readonly bottom: number;
readonly left: number;
}
interface Options {
/**
Color of the box border.
*/
readonly borderColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;
/**
Style of the box border.
@default BorderStyle.Single
*/
readonly borderStyle?: BorderStyle | CustomBorderStyle;
/**
Reduce opacity of the border.
@default false
*/
readonly dimBorder?: boolean;
/**
Space between the text and box border.
@default 0
*/
readonly padding?: number | Spacing;
/**
Space around the box.
@default 0
*/
readonly margin?: number | Spacing;
/**
Float the box on the available terminal screen space.
@default 'left'
*/
readonly float?: 'left' | 'right' | 'center';
/**
Color of the background.
*/
readonly backgroundColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;
/**
Align the text in the box based on the widest line.
@default 'left'
*/
readonly align?: 'left' | 'right' | 'center';
}
}
declare const enum BorderStyle {
Single = 'single',

@@ -42,108 +138,41 @@ Double = 'double',

/**
* Spacing used for `padding` and `margin`.
*/
export interface Spacing {
readonly top: number;
readonly right: number;
readonly bottom: number;
readonly left: number;
}
export interface Options {
declare const boxen: {
/**
* Color of the box border.
*/
readonly borderColor?:
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright'
| HexColor;
Creates a box in the terminal.
/**
* Style of the box border.
*
* @default BorderStyle.Single
*/
readonly borderStyle?: BorderStyle | CustomBorderStyle;
@param text - The text inside the box.
@returns The box.
/**
* Reduce opacity of the border.
*
* @default false
*/
readonly dimBorder?: boolean;
@example
```
import boxen = require('boxen');
/**
* Space between the text and box border.
*
* @default 0
*/
readonly padding?: number | Spacing;
console.log(boxen('unicorn', {padding: 1}));
// ┌─────────────┐
// │ │
// │ unicorn │
// │ │
// └─────────────┘
/**
* Space around the box.
*
* @default 0
*/
readonly margin?: number | Spacing;
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
//
// ╔═════════════╗
// ║ ║
// ║ unicorn ║
// ║ ║
// ╚═════════════╝
//
```
*/
(text: string, options?: boxen.Options): string;
/**
* Float the box on the available terminal screen space.
*
* @default 'left'
*/
readonly float?: 'left' | 'right' | 'center';
Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
*/
BorderStyle: typeof BorderStyle;
/**
* Color of the background.
*/
readonly backgroundColor?:
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright'
| HexColor;
// TODO: Remove this for the next major release
default: typeof boxen;
};
/**
* Align the text in the box based on the widest line.
*
* @default 'left'
*/
readonly align?: 'left' | 'right' | 'center';
}
/**
* Creates a box in the terminal.
*
* @param text - The text inside the box.
* @returns The box.
*/
export default function boxen(text: string, options?: Options): string;
export = boxen;

@@ -138,4 +138,5 @@ 'use strict';

module.exports = boxen;
// TODO: Remove this for the next major release
module.exports.default = boxen;
module.exports._borderStyles = cliBoxes;
{
"name": "boxen",
"version": "3.0.0",
"version": "3.1.0",
"description": "Create boxes in the terminal",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "xo && nyc ava && tsd-check"
"test": "xo && nyc ava && tsd"
},

@@ -37,15 +37,16 @@ "files": [

"ansi-align": "^3.0.0",
"camelcase": "^5.0.0",
"camelcase": "^5.3.1",
"chalk": "^2.4.2",
"cli-boxes": "^2.0.0",
"cli-boxes": "^2.1.0",
"string-width": "^3.0.0",
"term-size": "^1.2.0",
"type-fest": "^0.3.0",
"widest-line": "^2.0.0"
},
"devDependencies": {
"ava": "^1.2.1",
"ava": "^1.4.1",
"nyc": "^13.3.0",
"tsd-check": "^0.3.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc