first commit
This commit is contained in:
22
node_modules/@inquirer/ansi/LICENSE
generated
vendored
Normal file
22
node_modules/@inquirer/ansi/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2025 Simon Boudrias
|
||||
|
||||
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.
|
||||
99
node_modules/@inquirer/ansi/README.md
generated
vendored
Normal file
99
node_modules/@inquirer/ansi/README.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# @inquirer/ansi
|
||||
|
||||
A lightweight package providing ANSI escape sequences for terminal cursor manipulation and screen clearing.
|
||||
|
||||
# Special Thanks
|
||||
|
||||
<div align="center" markdown="1">
|
||||
|
||||
[](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)<br>
|
||||
|
||||
### [Graphite is the AI developer productivity platform helping teams on GitHub ship higher quality software, faster](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)
|
||||
|
||||
</div>
|
||||
|
||||
# Installation
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>npm</th>
|
||||
<th>yarn</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
npm install @inquirer/ansi
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/ansi
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import {
|
||||
cursorUp,
|
||||
cursorDown,
|
||||
cursorTo,
|
||||
cursorLeft,
|
||||
cursorHide,
|
||||
cursorShow,
|
||||
eraseLines,
|
||||
} from '@inquirer/ansi';
|
||||
|
||||
// Move cursor up 3 lines
|
||||
process.stdout.write(cursorUp(3));
|
||||
|
||||
// Move cursor to specific position (x: 10, y: 5)
|
||||
process.stdout.write(cursorTo(10, 5));
|
||||
|
||||
// Hide/show cursor
|
||||
process.stdout.write(cursorHide);
|
||||
process.stdout.write(cursorShow);
|
||||
|
||||
// Clear 5 lines
|
||||
process.stdout.write(eraseLines(5));
|
||||
```
|
||||
|
||||
Or when used inside an inquirer prompt:
|
||||
|
||||
```js
|
||||
import { cursorHide } from '@inquirer/ansi';
|
||||
import { createPrompt } from '@inquirer/core';
|
||||
|
||||
export default createPrompt((config, done: (value: void) => void) => {
|
||||
return `Choose an option${cursorHide}`;
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Cursor Movement
|
||||
|
||||
- **`cursorUp(count?: number)`** - Move cursor up by `count` lines (default: 1)
|
||||
- **`cursorDown(count?: number)`** - Move cursor down by `count` lines (default: 1)
|
||||
- **`cursorTo(x: number, y?: number)`** - Move cursor to position (x, y). If y is omitted, only moves horizontally
|
||||
- **`cursorLeft`** - Move cursor to beginning of line
|
||||
|
||||
### Cursor Visibility
|
||||
|
||||
- **`cursorHide`** - Hide the cursor
|
||||
- **`cursorShow`** - Show the cursor
|
||||
|
||||
### Screen Manipulation
|
||||
|
||||
- **`eraseLines(count: number)`** - Clear `count` lines and position cursor at the beginning of the first cleared line
|
||||
|
||||
# License
|
||||
|
||||
Copyright (c) 2025 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
|
||||
Licensed under the MIT license.
|
||||
14
node_modules/@inquirer/ansi/dist/commonjs/index.d.ts
generated
vendored
Normal file
14
node_modules/@inquirer/ansi/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/** Move cursor to first column */
|
||||
export declare const cursorLeft: string;
|
||||
/** Hide the cursor */
|
||||
export declare const cursorHide: string;
|
||||
/** Show the cursor */
|
||||
export declare const cursorShow: string;
|
||||
/** Move cursor up by count rows */
|
||||
export declare const cursorUp: (rows?: number) => string;
|
||||
/** Move cursor down by count rows */
|
||||
export declare const cursorDown: (rows?: number) => string;
|
||||
/** Move cursor to position (x, y) */
|
||||
export declare const cursorTo: (x: number, y?: number) => string;
|
||||
/** Erase the specified number of lines above the cursor */
|
||||
export declare const eraseLines: (lines: number) => string;
|
||||
28
node_modules/@inquirer/ansi/dist/commonjs/index.js
generated
vendored
Normal file
28
node_modules/@inquirer/ansi/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.eraseLines = exports.cursorTo = exports.cursorDown = exports.cursorUp = exports.cursorShow = exports.cursorHide = exports.cursorLeft = void 0;
|
||||
const ESC = '\u001B[';
|
||||
/** Move cursor to first column */
|
||||
exports.cursorLeft = ESC + 'G';
|
||||
/** Hide the cursor */
|
||||
exports.cursorHide = ESC + '?25l';
|
||||
/** Show the cursor */
|
||||
exports.cursorShow = ESC + '?25h';
|
||||
/** Move cursor up by count rows */
|
||||
const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');
|
||||
exports.cursorUp = cursorUp;
|
||||
/** Move cursor down by count rows */
|
||||
const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';
|
||||
exports.cursorDown = cursorDown;
|
||||
/** Move cursor to position (x, y) */
|
||||
const cursorTo = (x, y) => {
|
||||
if (typeof y === 'number' && !Number.isNaN(y)) {
|
||||
return `${ESC}${y + 1};${x + 1}H`;
|
||||
}
|
||||
return `${ESC}${x + 1}G`;
|
||||
};
|
||||
exports.cursorTo = cursorTo;
|
||||
const eraseLine = ESC + '2K';
|
||||
/** Erase the specified number of lines above the cursor */
|
||||
const eraseLines = (lines) => lines > 0 ? (eraseLine + (0, exports.cursorUp)(1)).repeat(lines - 1) + eraseLine + exports.cursorLeft : '';
|
||||
exports.eraseLines = eraseLines;
|
||||
3
node_modules/@inquirer/ansi/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@inquirer/ansi/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
14
node_modules/@inquirer/ansi/dist/esm/index.d.ts
generated
vendored
Normal file
14
node_modules/@inquirer/ansi/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/** Move cursor to first column */
|
||||
export declare const cursorLeft: string;
|
||||
/** Hide the cursor */
|
||||
export declare const cursorHide: string;
|
||||
/** Show the cursor */
|
||||
export declare const cursorShow: string;
|
||||
/** Move cursor up by count rows */
|
||||
export declare const cursorUp: (rows?: number) => string;
|
||||
/** Move cursor down by count rows */
|
||||
export declare const cursorDown: (rows?: number) => string;
|
||||
/** Move cursor to position (x, y) */
|
||||
export declare const cursorTo: (x: number, y?: number) => string;
|
||||
/** Erase the specified number of lines above the cursor */
|
||||
export declare const eraseLines: (lines: number) => string;
|
||||
21
node_modules/@inquirer/ansi/dist/esm/index.js
generated
vendored
Normal file
21
node_modules/@inquirer/ansi/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
const ESC = '\u001B[';
|
||||
/** Move cursor to first column */
|
||||
export const cursorLeft = ESC + 'G';
|
||||
/** Hide the cursor */
|
||||
export const cursorHide = ESC + '?25l';
|
||||
/** Show the cursor */
|
||||
export const cursorShow = ESC + '?25h';
|
||||
/** Move cursor up by count rows */
|
||||
export const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');
|
||||
/** Move cursor down by count rows */
|
||||
export const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';
|
||||
/** Move cursor to position (x, y) */
|
||||
export const cursorTo = (x, y) => {
|
||||
if (typeof y === 'number' && !Number.isNaN(y)) {
|
||||
return `${ESC}${y + 1};${x + 1}H`;
|
||||
}
|
||||
return `${ESC}${x + 1}G`;
|
||||
};
|
||||
const eraseLine = ESC + '2K';
|
||||
/** Erase the specified number of lines above the cursor */
|
||||
export const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : '';
|
||||
3
node_modules/@inquirer/ansi/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/@inquirer/ansi/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
96
node_modules/@inquirer/ansi/package.json
generated
vendored
Normal file
96
node_modules/@inquirer/ansi/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"name": "@inquirer/ansi",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"answer",
|
||||
"answers",
|
||||
"ask",
|
||||
"base",
|
||||
"cli",
|
||||
"command",
|
||||
"command-line",
|
||||
"confirm",
|
||||
"enquirer",
|
||||
"generate",
|
||||
"generator",
|
||||
"hyper",
|
||||
"input",
|
||||
"inquire",
|
||||
"inquirer",
|
||||
"interface",
|
||||
"iterm",
|
||||
"javascript",
|
||||
"menu",
|
||||
"node",
|
||||
"nodejs",
|
||||
"prompt",
|
||||
"promptly",
|
||||
"prompts",
|
||||
"question",
|
||||
"readline",
|
||||
"scaffold",
|
||||
"scaffolder",
|
||||
"scaffolding",
|
||||
"stdin",
|
||||
"stdout",
|
||||
"terminal",
|
||||
"tty",
|
||||
"ui",
|
||||
"yeoman",
|
||||
"yo",
|
||||
"zsh",
|
||||
"ansi"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.18.2",
|
||||
"tshy": "^3.0.2"
|
||||
},
|
||||
"tshy": {
|
||||
"exclude": [
|
||||
"src/**/*.test.ts"
|
||||
],
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"tsc": "tshy",
|
||||
"attw": "attw --pack"
|
||||
},
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"module": "./dist/esm/index.js",
|
||||
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/README.md",
|
||||
"gitHead": "87cb01e67a25983bdaf0d74a7685915c0afb5f23"
|
||||
}
|
||||
Reference in New Issue
Block a user