scrollable-cli
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { type Options as WrapOptions } from 'wrap-ansi'; | ||
@@ -32,2 +33,7 @@ /** | ||
wrapOptions: WrapOptions; | ||
/** | ||
* The stream to write to. | ||
* @default process.stdout | ||
*/ | ||
stdout: NodeJS.WriteStream; | ||
}; | ||
@@ -34,0 +40,0 @@ /** |
@@ -23,3 +23,3 @@ "use strict"; | ||
constructor(options) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; | ||
this.lines = []; | ||
@@ -33,10 +33,11 @@ this.currentLine = 0; | ||
}, | ||
stdout: (_e = options === null || options === void 0 ? void 0 : options.stdout) !== null && _e !== void 0 ? _e : process.stdout, | ||
size: { | ||
width: (_f = (_e = options === null || options === void 0 ? void 0 : options.size) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : process.stdout.columns, | ||
height: (_h = (_g = options === null || options === void 0 ? void 0 : options.size) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : process.stdout.rows | ||
width: (_j = (_g = (_f = options === null || options === void 0 ? void 0 : options.size) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : (_h = options === null || options === void 0 ? void 0 : options.stdout) === null || _h === void 0 ? void 0 : _h.columns) !== null && _j !== void 0 ? _j : process.stdout.columns, | ||
height: (_o = (_l = (_k = options === null || options === void 0 ? void 0 : options.size) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : (_m = options === null || options === void 0 ? void 0 : options.stdout) === null || _m === void 0 ? void 0 : _m.rows) !== null && _o !== void 0 ? _o : process.stdout.rows | ||
}, | ||
wrapOptions: { | ||
hard: (_k = (_j = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _j === void 0 ? void 0 : _j.hard) !== null && _k !== void 0 ? _k : false, | ||
wordWrap: (_m = (_l = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _l === void 0 ? void 0 : _l.wordWrap) !== null && _m !== void 0 ? _m : true, | ||
trim: (_p = (_o = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _o === void 0 ? void 0 : _o.trim) !== null && _p !== void 0 ? _p : true | ||
hard: (_q = (_p = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _p === void 0 ? void 0 : _p.hard) !== null && _q !== void 0 ? _q : false, | ||
wordWrap: (_s = (_r = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _r === void 0 ? void 0 : _r.wordWrap) !== null && _s !== void 0 ? _s : true, | ||
trim: (_u = (_t = options === null || options === void 0 ? void 0 : options.wrapOptions) === null || _t === void 0 ? void 0 : _t.trim) !== null && _u !== void 0 ? _u : true | ||
} | ||
@@ -95,9 +96,10 @@ }; | ||
const emptyLine = Array(width).fill(' ').join(''); | ||
const { stdout } = this._options; | ||
// Clear the area. | ||
this.clear(); | ||
process.stdout.cursorTo(x, y); | ||
stdout.cursorTo(x, y); | ||
for (let i = 0; i < height; i++) { | ||
const line = this.lines[i + this.currentLine]; | ||
process.stdout.cursorTo(x); | ||
console.log(line !== null && line !== void 0 ? line : emptyLine); | ||
stdout.cursorTo(x); | ||
stdout.write((line !== null && line !== void 0 ? line : emptyLine) + '\n'); | ||
} | ||
@@ -123,6 +125,7 @@ return this; | ||
const emptyLine = Array(width).fill(' ').join(''); | ||
process.stdout.cursorTo(x, y); | ||
const { stdout } = this._options; | ||
stdout.cursorTo(x, y); | ||
for (let i = 0; i < height; i++) { | ||
process.stdout.cursorTo(x); | ||
console.log(emptyLine); | ||
stdout.cursorTo(x); | ||
stdout.write(emptyLine + '\n'); | ||
} | ||
@@ -129,0 +132,0 @@ return this; |
{ | ||
"name": "scrollable-cli", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Create independent scrollable areas in the terminal.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14722
262
0