fixed untracked files
This commit is contained in:
138
node_modules/boxen/index.js
generated
vendored
138
node_modules/boxen/index.js
generated
vendored
@ -1,138 +0,0 @@
|
||||
'use strict';
|
||||
const stringWidth = require('string-width');
|
||||
const chalk = require('chalk');
|
||||
const widestLine = require('widest-line');
|
||||
const cliBoxes = require('cli-boxes');
|
||||
const camelCase = require('camelcase');
|
||||
const ansiAlign = require('ansi-align');
|
||||
const termSize = require('term-size');
|
||||
|
||||
const getObject = detail => {
|
||||
let obj;
|
||||
|
||||
if (typeof detail === 'number') {
|
||||
obj = {
|
||||
top: detail,
|
||||
right: detail * 3,
|
||||
bottom: detail,
|
||||
left: detail * 3
|
||||
};
|
||||
} else {
|
||||
obj = Object.assign({
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
}, detail);
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
const getBorderChars = borderStyle => {
|
||||
const sides = [
|
||||
'topLeft',
|
||||
'topRight',
|
||||
'bottomRight',
|
||||
'bottomLeft',
|
||||
'vertical',
|
||||
'horizontal'
|
||||
];
|
||||
|
||||
let chars;
|
||||
|
||||
if (typeof borderStyle === 'string') {
|
||||
chars = cliBoxes[borderStyle];
|
||||
|
||||
if (!chars) {
|
||||
throw new TypeError(`Invalid border style: ${borderStyle}`);
|
||||
}
|
||||
} else {
|
||||
sides.forEach(key => {
|
||||
if (!borderStyle[key] || typeof borderStyle[key] !== 'string') {
|
||||
throw new TypeError(`Invalid border style: ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
chars = borderStyle;
|
||||
}
|
||||
|
||||
return chars;
|
||||
};
|
||||
|
||||
const getBackgroundColorName = x => camelCase('bg', x);
|
||||
|
||||
module.exports = (text, opts) => {
|
||||
opts = Object.assign({
|
||||
padding: 0,
|
||||
borderStyle: 'single',
|
||||
dimBorder: false,
|
||||
align: 'left',
|
||||
float: 'left'
|
||||
}, opts);
|
||||
|
||||
if (opts.backgroundColor) {
|
||||
opts.backgroundColor = getBackgroundColorName(opts.backgroundColor);
|
||||
}
|
||||
|
||||
if (opts.borderColor && !chalk[opts.borderColor]) {
|
||||
throw new Error(`${opts.borderColor} is not a valid borderColor`);
|
||||
}
|
||||
|
||||
if (opts.backgroundColor && !chalk[opts.backgroundColor]) {
|
||||
throw new Error(`${opts.backgroundColor} is not a valid backgroundColor`);
|
||||
}
|
||||
|
||||
const chars = getBorderChars(opts.borderStyle);
|
||||
const padding = getObject(opts.padding);
|
||||
const margin = getObject(opts.margin);
|
||||
|
||||
const colorizeBorder = x => {
|
||||
const ret = opts.borderColor ? chalk[opts.borderColor](x) : x;
|
||||
return opts.dimBorder ? chalk.dim(ret) : ret;
|
||||
};
|
||||
|
||||
const colorizeContent = x => opts.backgroundColor ? chalk[opts.backgroundColor](x) : x;
|
||||
|
||||
text = ansiAlign(text, {align: opts.align});
|
||||
|
||||
const NL = '\n';
|
||||
const PAD = ' ';
|
||||
|
||||
let lines = text.split(NL);
|
||||
|
||||
if (padding.top > 0) {
|
||||
lines = Array(padding.top).fill('').concat(lines);
|
||||
}
|
||||
|
||||
if (padding.bottom > 0) {
|
||||
lines = lines.concat(Array(padding.bottom).fill(''));
|
||||
}
|
||||
|
||||
const contentWidth = widestLine(text) + padding.left + padding.right;
|
||||
const paddingLeft = PAD.repeat(padding.left);
|
||||
const columns = termSize().columns;
|
||||
let marginLeft = PAD.repeat(margin.left);
|
||||
|
||||
if (opts.float === 'center') {
|
||||
const padWidth = Math.max((columns - contentWidth) / 2, 0);
|
||||
marginLeft = PAD.repeat(padWidth);
|
||||
} else if (opts.float === 'right') {
|
||||
const padWidth = Math.max(columns - contentWidth - margin.right - 2, 0);
|
||||
marginLeft = PAD.repeat(padWidth);
|
||||
}
|
||||
|
||||
const horizontal = chars.horizontal.repeat(contentWidth);
|
||||
const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + horizontal + chars.topRight);
|
||||
const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom));
|
||||
const side = colorizeBorder(chars.vertical);
|
||||
|
||||
const middle = lines.map(line => {
|
||||
const paddingRight = PAD.repeat(contentWidth - stringWidth(line) - padding.left);
|
||||
return marginLeft + side + colorizeContent(paddingLeft + line + paddingRight) + side;
|
||||
}).join(NL);
|
||||
|
||||
return top + NL + middle + NL + bottom;
|
||||
};
|
||||
|
||||
module.exports._borderStyles = cliBoxes;
|
9
node_modules/boxen/license
generated
vendored
9
node_modules/boxen/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
79
node_modules/boxen/package.json
generated
vendored
79
node_modules/boxen/package.json
generated
vendored
@ -1,79 +0,0 @@
|
||||
{
|
||||
"_from": "boxen@^1.2.1",
|
||||
"_id": "boxen@1.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==",
|
||||
"_location": "/boxen",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "boxen@^1.2.1",
|
||||
"name": "boxen",
|
||||
"escapedName": "boxen",
|
||||
"rawSpec": "^1.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/update-notifier"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz",
|
||||
"_shasum": "55c6c39a8ba58d9c61ad22cd877532deb665a20b",
|
||||
"_spec": "boxen@^1.2.1",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/update-notifier",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/boxen/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansi-align": "^2.0.0",
|
||||
"camelcase": "^4.0.0",
|
||||
"chalk": "^2.0.1",
|
||||
"cli-boxes": "^1.0.0",
|
||||
"string-width": "^2.0.0",
|
||||
"term-size": "^1.2.0",
|
||||
"widest-line": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Create boxes in the terminal",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"nyc": "^11.0.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/boxen#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"box",
|
||||
"boxes",
|
||||
"terminal",
|
||||
"term",
|
||||
"console",
|
||||
"ascii",
|
||||
"unicode",
|
||||
"border",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "boxen",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/boxen.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
}
|
175
node_modules/boxen/readme.md
generated
vendored
175
node_modules/boxen/readme.md
generated
vendored
@ -1,175 +0,0 @@
|
||||
# <img src="screenshot.png" width="400" alt="boxen">
|
||||
|
||||
> Create boxes in the terminal
|
||||
|
||||
[](https://travis-ci.org/sindresorhus/boxen)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install boxen
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const boxen = require('boxen');
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1}));
|
||||
/*
|
||||
┌─────────────┐
|
||||
│ │
|
||||
│ unicorn │
|
||||
│ │
|
||||
└─────────────┘
|
||||
*/
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
|
||||
/*
|
||||
|
||||
╔═════════════╗
|
||||
║ ║
|
||||
║ unicorn ║
|
||||
║ ║
|
||||
╚═════════════╝
|
||||
|
||||
*/
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### boxen(input, [options])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
Text inside the box.
|
||||
|
||||
#### options
|
||||
|
||||
##### borderColor
|
||||
|
||||
Type: `string`<br>
|
||||
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`
|
||||
|
||||
Color of the box border.
|
||||
|
||||
##### borderStyle
|
||||
|
||||
Type: `string` `object`<br>
|
||||
Default: `single`<br>
|
||||
Values:
|
||||
- `single`
|
||||
```
|
||||
┌───┐
|
||||
│foo│
|
||||
└───┘
|
||||
```
|
||||
- `double`
|
||||
```
|
||||
╔═══╗
|
||||
║foo║
|
||||
╚═══╝
|
||||
```
|
||||
- `round` (`single` sides with round corners)
|
||||
```
|
||||
╭───╮
|
||||
│foo│
|
||||
╰───╯
|
||||
```
|
||||
- `single-double` (`single` on top and bottom, `double` on right and left)
|
||||
```
|
||||
╓───╖
|
||||
║foo║
|
||||
╙───╜
|
||||
```
|
||||
- `double-single` (`double` on top and bottom, `single` on right and left)
|
||||
```
|
||||
╒═══╕
|
||||
│foo│
|
||||
╘═══╛
|
||||
```
|
||||
- `classic`
|
||||
```
|
||||
+---+
|
||||
|foo|
|
||||
+---+
|
||||
```
|
||||
|
||||
Style of the box border.
|
||||
|
||||
Can be any of the above predefined styles or an object with the following keys:
|
||||
|
||||
```js
|
||||
{
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
horizontal: '-',
|
||||
vertical: '|'
|
||||
}
|
||||
```
|
||||
|
||||
##### dimBorder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Reduce opacity of the border.
|
||||
|
||||
##### padding
|
||||
|
||||
Type: `number` `Object`<br>
|
||||
Default: `0`
|
||||
|
||||
Space between the text and box border.
|
||||
|
||||
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice.
|
||||
|
||||
##### margin
|
||||
|
||||
Type: `number` `Object`<br>
|
||||
Default: `0`
|
||||
|
||||
Space around the box.
|
||||
|
||||
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice.
|
||||
|
||||
##### float
|
||||
|
||||
Type: `string`<br>
|
||||
Values: `right` `center` `left`<br>
|
||||
Default: `left`
|
||||
|
||||
Float the box on the available terminal screen space.
|
||||
|
||||
##### backgroundColor
|
||||
|
||||
Type: `string`<br>
|
||||
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white`
|
||||
|
||||
Color of the background.
|
||||
|
||||
##### align
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `left`<br>
|
||||
Values: `left` `center` `right`
|
||||
|
||||
Align the text in the box based on the widest line.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module
|
||||
- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Reference in New Issue
Block a user