aboutsummaryrefslogtreecommitdiff
path: root/node_modules/prompts/dist/util
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/prompts/dist/util')
-rw-r--r--node_modules/prompts/dist/util/action.js38
-rw-r--r--node_modules/prompts/dist/util/clear.js42
-rw-r--r--node_modules/prompts/dist/util/entriesToDisplay.js21
-rw-r--r--node_modules/prompts/dist/util/figures.js32
-rw-r--r--node_modules/prompts/dist/util/index.js12
-rw-r--r--node_modules/prompts/dist/util/lines.js14
-rw-r--r--node_modules/prompts/dist/util/strip.js7
-rw-r--r--node_modules/prompts/dist/util/style.js51
-rw-r--r--node_modules/prompts/dist/util/wrap.js16
9 files changed, 0 insertions, 233 deletions
diff --git a/node_modules/prompts/dist/util/action.js b/node_modules/prompts/dist/util/action.js
deleted file mode 100644
index c36b7db..0000000
--- a/node_modules/prompts/dist/util/action.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict';
-
-module.exports = (key, isSelect) => {
- if (key.meta && key.name !== 'escape') return;
-
- if (key.ctrl) {
- if (key.name === 'a') return 'first';
- if (key.name === 'c') return 'abort';
- if (key.name === 'd') return 'abort';
- if (key.name === 'e') return 'last';
- if (key.name === 'g') return 'reset';
- }
-
- if (isSelect) {
- if (key.name === 'j') return 'down';
- if (key.name === 'k') return 'up';
- }
-
- if (key.name === 'return') return 'submit';
- if (key.name === 'enter') return 'submit'; // ctrl + J
-
- if (key.name === 'backspace') return 'delete';
- if (key.name === 'delete') return 'deleteForward';
- if (key.name === 'abort') return 'abort';
- if (key.name === 'escape') return 'exit';
- if (key.name === 'tab') return 'next';
- if (key.name === 'pagedown') return 'nextPage';
- if (key.name === 'pageup') return 'prevPage'; // TODO create home() in prompt types (e.g. TextPrompt)
-
- if (key.name === 'home') return 'home'; // TODO create end() in prompt types (e.g. TextPrompt)
-
- if (key.name === 'end') return 'end';
- if (key.name === 'up') return 'up';
- if (key.name === 'down') return 'down';
- if (key.name === 'right') return 'right';
- if (key.name === 'left') return 'left';
- return false;
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/clear.js b/node_modules/prompts/dist/util/clear.js
deleted file mode 100644
index 5a313be..0000000
--- a/node_modules/prompts/dist/util/clear.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-
-function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
-
-function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-
-function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
-
-const strip = require('./strip');
-
-const _require = require('sisteransi'),
- erase = _require.erase,
- cursor = _require.cursor;
-
-const width = str => [...strip(str)].length;
-/**
- * @param {string} prompt
- * @param {number} perLine
- */
-
-
-module.exports = function (prompt, perLine) {
- if (!perLine) return erase.line + cursor.to(0);
- let rows = 0;
- const lines = prompt.split(/\r?\n/);
-
- var _iterator = _createForOfIteratorHelper(lines),
- _step;
-
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- let line = _step.value;
- rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-
- return erase.lines(rows);
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/entriesToDisplay.js b/node_modules/prompts/dist/util/entriesToDisplay.js
deleted file mode 100644
index fbb963a..0000000
--- a/node_modules/prompts/dist/util/entriesToDisplay.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-/**
- * Determine what entries should be displayed on the screen, based on the
- * currently selected index and the maximum visible. Used in list-based
- * prompts like `select` and `multiselect`.
- *
- * @param {number} cursor the currently selected entry
- * @param {number} total the total entries available to display
- * @param {number} [maxVisible] the number of entries that can be displayed
- */
-
-module.exports = (cursor, total, maxVisible) => {
- maxVisible = maxVisible || total;
- let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
- if (startIndex < 0) startIndex = 0;
- let endIndex = Math.min(startIndex + maxVisible, total);
- return {
- startIndex,
- endIndex
- };
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/figures.js b/node_modules/prompts/dist/util/figures.js
deleted file mode 100644
index 036ec50..0000000
--- a/node_modules/prompts/dist/util/figures.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict';
-
-const main = {
- arrowUp: '↑',
- arrowDown: '↓',
- arrowLeft: '←',
- arrowRight: '→',
- radioOn: '◉',
- radioOff: '◯',
- tick: '✔',
- cross: '✖',
- ellipsis: '…',
- pointerSmall: '›',
- line: '─',
- pointer: '❯'
-};
-const win = {
- arrowUp: main.arrowUp,
- arrowDown: main.arrowDown,
- arrowLeft: main.arrowLeft,
- arrowRight: main.arrowRight,
- radioOn: '(*)',
- radioOff: '( )',
- tick: '√',
- cross: '×',
- ellipsis: '...',
- pointerSmall: '»',
- line: '─',
- pointer: '>'
-};
-const figures = process.platform === 'win32' ? win : main;
-module.exports = figures; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/index.js b/node_modules/prompts/dist/util/index.js
deleted file mode 100644
index dbfe75e..0000000
--- a/node_modules/prompts/dist/util/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-module.exports = {
- action: require('./action'),
- clear: require('./clear'),
- style: require('./style'),
- strip: require('./strip'),
- figures: require('./figures'),
- lines: require('./lines'),
- wrap: require('./wrap'),
- entriesToDisplay: require('./entriesToDisplay')
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/lines.js b/node_modules/prompts/dist/util/lines.js
deleted file mode 100644
index 54a939a..0000000
--- a/node_modules/prompts/dist/util/lines.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-const strip = require('./strip');
-/**
- * @param {string} msg
- * @param {number} perLine
- */
-
-
-module.exports = function (msg, perLine) {
- let lines = String(strip(msg) || '').split(/\r?\n/);
- if (!perLine) return lines.length;
- return lines.map(l => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/strip.js b/node_modules/prompts/dist/util/strip.js
deleted file mode 100644
index dd289a0..0000000
--- a/node_modules/prompts/dist/util/strip.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-module.exports = str => {
- const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'].join('|');
- const RGX = new RegExp(pattern, 'g');
- return typeof str === 'string' ? str.replace(RGX, '') : str;
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/style.js b/node_modules/prompts/dist/util/style.js
deleted file mode 100644
index ed1a49b..0000000
--- a/node_modules/prompts/dist/util/style.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict';
-
-const c = require('kleur');
-
-const figures = require('./figures'); // rendering user input.
-
-
-const styles = Object.freeze({
- password: {
- scale: 1,
- render: input => '*'.repeat(input.length)
- },
- emoji: {
- scale: 2,
- render: input => '😃'.repeat(input.length)
- },
- invisible: {
- scale: 0,
- render: input => ''
- },
- default: {
- scale: 1,
- render: input => `${input}`
- }
-});
-
-const render = type => styles[type] || styles.default; // icon to signalize a prompt.
-
-
-const symbols = Object.freeze({
- aborted: c.red(figures.cross),
- done: c.green(figures.tick),
- exited: c.yellow(figures.cross),
- default: c.cyan('?')
-});
-
-const symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default; // between the question and the user's input.
-
-
-const delimiter = completing => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
-
-const item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : '+' : figures.line);
-
-module.exports = {
- styles,
- render,
- symbols,
- symbol,
- delimiter,
- item
-}; \ No newline at end of file
diff --git a/node_modules/prompts/dist/util/wrap.js b/node_modules/prompts/dist/util/wrap.js
deleted file mode 100644
index da5e67c..0000000
--- a/node_modules/prompts/dist/util/wrap.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-/**
- * @param {string} msg The message to wrap
- * @param {object} opts
- * @param {number|string} [opts.margin] Left margin
- * @param {number} opts.width Maximum characters per line including the margin
- */
-
-module.exports = (msg, opts = {}) => {
- const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(' ').join('') : opts.margin || '';
- const width = opts.width;
- return (msg || '').split(/\r?\n/g).map(line => line.split(/\s+/g).reduce((arr, w) => {
- if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width) arr[arr.length - 1] += ` ${w}`;else arr.push(`${tab}${w}`);
- return arr;
- }, [tab]).join('\n')).join('\n');
-}; \ No newline at end of file