'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const csi = some => '\x1b[' + some; const csiSet = (...vec) => { let tx = ''; for (let x of vec) tx += csi(x); return tx; }; class Clear { static AFTER_CURSOR = csi('0J'); // 'Clear everything after the cursor.' static BEFORE_CURSOR = csi('1J'); // 'Clear everything before the cursor.' static ENTIRE_SCREEN = csi('2J'); // 'Clear the entire screen. Move cursor to top-left.' static ENTIRE_TERMINAL = csi('3J'); // 'Clear the entire screen + entire scroll-back buffer.' static RIGHT_TO_CURSOR = csi('0K'); // 'Clear from cursor to the end of the line. Cursor unchanged.' static LEFT_TO_CURSOR = csi('1K'); // 'Clear from cursor to the beginning of the line. Cursor unchanged.' static ENTIRE_LINE = csi('2K'); // 'Clear the current line. Cursor unchanged.' } class Cursor { static goto = (x, y) => csi(`${++x};${++y}H`); static up = d => csi(d + 'A'); static down = d => csi(d + 'B'); static right = d => csi(d + 'C'); static left = d => csi(d + 'D'); static prevLine = d => csi(d + 'E'); static nextLine = d => csi(d + 'F'); static charTo = d => csi(d + 'G'); static QUERY_POS = csi("6n"); // Where is the cursor? Use `ESC [ 6 n`. And answers: `ESC [ Cy ; Cx R`. static SHOW = csi("?25h"); // "Show the cursor." // static HIDE = csi("?25l"); // "Hide the cursor." // static SAVE = csi("s"); // "Save the cursor." // static RESTORE = csi("u"); // "Restore the cursor." // static BLINK_BLOCK = csi("\x31 q"); // "Change the cursor style to blinking block" // static STEADY_BLOCK = csi("\x32 q"); // "Change the cursor style to steady block" // static BLINK_UNDERLINE = csi("\x33 q"); // "Change the cursor style to blinking underline" // static STEADY_UNDERLINE = csi("\x34 q"); // "Change the cursor style to steady underline" // static BLINK_BAR = csi("\x35 q"); // "Change the cursor style to blinking bar" // static STEADY_BAR = csi("\x36 q"); // "Change the cursor style to steady bar" // } class Scroll { static up = n => csi(`${n}S`); static down = n => csi(`${n}T`); } class DECSet { static WRAP_ON = csi('?7h'); static WRAP_OFF = csi('?7l'); } exports.Clear = Clear; exports.Cursor = Cursor; exports.DECSet = DECSet; exports.Scroll = Scroll; exports.clear = Clear; exports.csi = csi; exports.csiSet = csiSet; exports.cursor = Cursor; exports.decset = DECSet; exports.scroll = Scroll;