@inquirer/ansi 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,16 +2,6 @@
2
2
 
3
3
  A lightweight package providing ANSI escape sequences for terminal cursor manipulation and screen clearing.
4
4
 
5
- # Special Thanks
6
-
7
- <div align="center" markdown="1">
8
-
9
- [![Graphite](https://github.com/user-attachments/assets/53db40ca-2254-481a-a094-6597f8716e29)](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)<br>
10
-
11
- ### [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)
12
-
13
- </div>
14
-
15
5
  # Installation
16
6
 
17
7
  <table>
@@ -0,0 +1,14 @@
1
+ /** Move cursor to first column */
2
+ export declare const cursorLeft: string;
3
+ /** Hide the cursor */
4
+ export declare const cursorHide: string;
5
+ /** Show the cursor */
6
+ export declare const cursorShow: string;
7
+ /** Move cursor up by count rows */
8
+ export declare const cursorUp: (rows?: number) => string;
9
+ /** Move cursor down by count rows */
10
+ export declare const cursorDown: (rows?: number) => string;
11
+ /** Move cursor to position (x, y) */
12
+ export declare const cursorTo: (x: number, y?: number) => string;
13
+ /** Erase the specified number of lines above the cursor */
14
+ export declare const eraseLines: (lines: number) => string;
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ const ESC = '\u001B[';
2
+ /** Move cursor to first column */
3
+ export const cursorLeft = ESC + 'G';
4
+ /** Hide the cursor */
5
+ export const cursorHide = ESC + '?25l';
6
+ /** Show the cursor */
7
+ export const cursorShow = ESC + '?25h';
8
+ /** Move cursor up by count rows */
9
+ export const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');
10
+ /** Move cursor down by count rows */
11
+ export const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';
12
+ /** Move cursor to position (x, y) */
13
+ export const cursorTo = (x, y) => {
14
+ if (typeof y === 'number' && !Number.isNaN(y)) {
15
+ return `${ESC}${y + 1};${x + 1}H`;
16
+ }
17
+ return `${ESC}${x + 1}G`;
18
+ };
19
+ const eraseLine = ESC + '2K';
20
+ /** Erase the specified number of lines above the cursor */
21
+ export const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : '';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@inquirer/ansi",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "engines": {
5
- "node": ">=18"
5
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
6
6
  },
7
7
  "author": "Simon Boudrias <admin@simonboudrias.com>",
8
8
  "license": "MIT",
@@ -55,42 +55,27 @@
55
55
  "dist"
56
56
  ],
57
57
  "devDependencies": {
58
- "@arethetypeswrong/cli": "^0.18.2",
59
- "tshy": "^3.0.2"
60
- },
61
- "tshy": {
62
- "exclude": [
63
- "src/**/*.test.ts"
64
- ],
65
- "exports": {
66
- "./package.json": "./package.json",
67
- ".": "./src/index.ts"
68
- }
58
+ "@repo/tsconfig": "0.0.0",
59
+ "typescript": "^5.9.3"
69
60
  },
70
61
  "scripts": {
71
- "tsc": "tshy",
72
- "attw": "attw --pack"
62
+ "tsc": "tsc"
73
63
  },
74
64
  "type": "module",
75
65
  "publishConfig": {
76
- "access": "public"
66
+ "access": "public",
67
+ "exports": {
68
+ "./package.json": "./package.json",
69
+ ".": {
70
+ "types": "./dist/index.d.ts",
71
+ "default": "./dist/index.js"
72
+ }
73
+ }
77
74
  },
78
75
  "exports": {
79
76
  "./package.json": "./package.json",
80
- ".": {
81
- "import": {
82
- "types": "./dist/esm/index.d.ts",
83
- "default": "./dist/esm/index.js"
84
- },
85
- "require": {
86
- "types": "./dist/commonjs/index.d.ts",
87
- "default": "./dist/commonjs/index.js"
88
- }
89
- }
77
+ ".": "./src/index.ts"
90
78
  },
91
- "main": "./dist/commonjs/index.js",
92
- "types": "./dist/commonjs/index.d.ts",
93
- "module": "./dist/esm/index.js",
94
79
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/README.md",
95
- "gitHead": "87cb01e67a25983bdaf0d74a7685915c0afb5f23"
80
+ "gitHead": "676685d33374a30340c1b9f0831c7eae2b2357dd"
96
81
  }