@visulima/ansi 1.0.18 → 1.1.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/CHANGELOG.md +21 -0
- package/LICENSE.md +76 -74
- package/README.md +335 -2
- package/dist/alternative-screen.cjs +11 -5
- package/dist/alternative-screen.d.cts +74 -4
- package/dist/alternative-screen.d.mts +74 -4
- package/dist/alternative-screen.d.ts +74 -4
- package/dist/alternative-screen.mjs +8 -4
- package/dist/clear.cjs +10 -18
- package/dist/clear.d.cts +77 -7
- package/dist/clear.d.mts +77 -7
- package/dist/clear.d.ts +77 -7
- package/dist/clear.mjs +8 -15
- package/dist/constants.d.cts +20 -0
- package/dist/constants.d.mts +20 -0
- package/dist/constants.d.ts +20 -0
- package/dist/cursor.cjs +19 -2
- package/dist/cursor.d.cts +436 -30
- package/dist/cursor.d.mts +436 -30
- package/dist/cursor.d.ts +436 -30
- package/dist/cursor.mjs +2 -2
- package/dist/erase.cjs +44 -13
- package/dist/erase.d.cts +206 -9
- package/dist/erase.d.mts +206 -9
- package/dist/erase.d.ts +206 -9
- package/dist/erase.mjs +40 -14
- package/dist/helpers.d.cts +14 -0
- package/dist/helpers.d.mts +14 -0
- package/dist/helpers.d.ts +14 -0
- package/dist/hyperlink.cjs +9 -0
- package/dist/hyperlink.d.cts +29 -0
- package/dist/hyperlink.d.mts +27 -0
- package/dist/hyperlink.d.ts +29 -0
- package/dist/hyperlink.mjs +7 -0
- package/dist/image.cjs +12 -5
- package/dist/image.d.cts +69 -58
- package/dist/image.d.mts +69 -58
- package/dist/image.d.ts +69 -58
- package/dist/image.mjs +10 -5
- package/dist/index.cjs +209 -11
- package/dist/index.d.cts +35 -12
- package/dist/index.d.mts +35 -12
- package/dist/index.d.ts +35 -12
- package/dist/index.mjs +20 -7
- package/dist/iterm2/iterm2-properties.d.cts +135 -0
- package/dist/iterm2/iterm2-properties.d.mts +135 -0
- package/dist/iterm2/iterm2-properties.d.ts +135 -0
- package/dist/iterm2/iterm2-sequences.d.cts +96 -0
- package/dist/iterm2/iterm2-sequences.d.mts +96 -0
- package/dist/iterm2/iterm2-sequences.d.ts +96 -0
- package/dist/iterm2.cjs +26 -0
- package/dist/iterm2.d.cts +58 -0
- package/dist/iterm2.d.mts +58 -0
- package/dist/iterm2.d.ts +58 -0
- package/dist/iterm2.mjs +14 -0
- package/dist/mode.cjs +388 -0
- package/dist/mode.d.cts +657 -0
- package/dist/mode.d.mts +657 -0
- package/dist/mode.d.ts +657 -0
- package/dist/mode.mjs +235 -0
- package/dist/mouse.cjs +127 -0
- package/dist/mouse.d.cts +230 -0
- package/dist/mouse.d.mts +230 -0
- package/dist/mouse.d.ts +230 -0
- package/dist/mouse.mjs +108 -0
- package/dist/packem_shared/IT2_AUTO-5vTJQMm6.cjs +15 -0
- package/dist/packem_shared/IT2_AUTO-DnfCUXso.mjs +8 -0
- package/dist/packem_shared/ITerm2File-BGPqNSjB.cjs +137 -0
- package/dist/packem_shared/ITerm2File-DKFkdqdA.mjs +130 -0
- package/dist/packem_shared/{constants-D8u2npjW.cjs → constants-BK26O-46.cjs} +4 -0
- package/dist/packem_shared/constants-CE7WkXh_.mjs +9 -0
- package/dist/packem_shared/cursor-CQKLCu7U.cjs +105 -0
- package/dist/packem_shared/cursor-DhFQcQ9g.mjs +73 -0
- package/dist/passthrough.cjs +38 -0
- package/dist/passthrough.d.cts +77 -0
- package/dist/passthrough.d.mts +77 -0
- package/dist/passthrough.d.ts +77 -0
- package/dist/passthrough.mjs +31 -0
- package/dist/reset.cjs +9 -0
- package/dist/reset.d.cts +26 -0
- package/dist/reset.d.mts +26 -0
- package/dist/reset.d.ts +26 -0
- package/dist/reset.mjs +4 -0
- package/dist/screen.cjs +41 -0
- package/dist/screen.d.cts +234 -0
- package/dist/screen.d.mts +234 -0
- package/dist/screen.d.ts +234 -0
- package/dist/screen.mjs +29 -0
- package/dist/scroll.cjs +17 -3
- package/dist/scroll.d.cts +67 -4
- package/dist/scroll.d.mts +67 -4
- package/dist/scroll.d.ts +67 -4
- package/dist/scroll.mjs +16 -4
- package/dist/status.cjs +147 -0
- package/dist/status.d.cts +501 -0
- package/dist/status.d.mts +501 -0
- package/dist/status.d.ts +501 -0
- package/dist/status.mjs +104 -0
- package/dist/strip.d.cts +23 -1
- package/dist/strip.d.mts +22 -2
- package/dist/strip.d.ts +23 -1
- package/dist/termcap.cjs +33 -0
- package/dist/termcap.d.cts +38 -0
- package/dist/termcap.d.mts +38 -0
- package/dist/termcap.d.ts +38 -0
- package/dist/termcap.mjs +27 -0
- package/dist/title.cjs +31 -0
- package/dist/title.d.cts +185 -0
- package/dist/title.d.mts +185 -0
- package/dist/title.d.ts +185 -0
- package/dist/title.mjs +20 -0
- package/dist/window-ops.cjs +85 -0
- package/dist/window-ops.d.cts +418 -0
- package/dist/window-ops.d.mts +418 -0
- package/dist/window-ops.d.ts +418 -0
- package/dist/window-ops.mjs +63 -0
- package/dist/xterm.cjs +48 -0
- package/dist/xterm.d.cts +94 -0
- package/dist/xterm.d.mts +94 -0
- package/dist/xterm.d.ts +94 -0
- package/dist/xterm.mjs +35 -0
- package/package.json +153 -9
- package/dist/link.cjs +0 -9
- package/dist/link.d.cts +0 -3
- package/dist/link.d.mts +0 -3
- package/dist/link.d.ts +0 -3
- package/dist/link.mjs +0 -7
- package/dist/packem_shared/constants-CqXMfQy0.mjs +0 -7
- package/dist/packem_shared/cursor-2tHgT9r6.cjs +0 -57
- package/dist/packem_shared/cursor-CDCWqbC9.mjs +0 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## @visulima/ansi [1.1.0](https://github.com/visulima/visulima/compare/@visulima/ansi@1.0.18...@visulima/ansi@1.1.0) (2025-05-30)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **ansi:** introduces a significant number of changes, including refactoring of exports, renaming of functions for clarity and consistency ([d80d2db](https://github.com/visulima/visulima/commit/d80d2dba2580e208cbf21f60d27bfb4e95417281))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **ansi:** improved readme, added all files as export ([a70ad00](https://github.com/visulima/visulima/commit/a70ad0026e05552b4c56b0be355bf439a40c3c3e))
|
|
10
|
+
* **ansi:** update dependencies ([85478c4](https://github.com/visulima/visulima/commit/85478c4614b3fe78ee80e090b36829bc64f6e4c1))
|
|
11
|
+
|
|
12
|
+
### Miscellaneous Chores
|
|
13
|
+
|
|
14
|
+
* updated dev dependencies ([2433ed5](https://github.com/visulima/visulima/commit/2433ed5fb662e0303c37edee8ddc21b46c21263f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* **@visulima/colorize:** upgraded to 1.4.22
|
|
20
|
+
* **@visulima/path:** upgraded to 1.3.6
|
|
21
|
+
|
|
1
22
|
## @visulima/ansi [1.0.18](https://github.com/visulima/visulima/compare/@visulima/ansi@1.0.17...@visulima/ansi@1.0.18) (2025-03-07)
|
|
2
23
|
|
|
3
24
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -122,11 +122,14 @@ Repository: https://github.com/tapjs/signal-exit.git
|
|
|
122
122
|
<!-- TYPE_DEPENDENCIES -->
|
|
123
123
|
|
|
124
124
|
# Licenses of bundled types
|
|
125
|
+
|
|
125
126
|
The published @visulima/ansi artifact additionally contains code with the following licenses:
|
|
126
127
|
MIT, (MIT OR CC0-1.0)
|
|
127
128
|
|
|
128
129
|
# Bundled types:
|
|
130
|
+
|
|
129
131
|
## restore-cursor
|
|
132
|
+
|
|
130
133
|
License: MIT
|
|
131
134
|
By: Sindre Sorhus
|
|
132
135
|
Repository: sindresorhus/restore-cursor
|
|
@@ -141,9 +144,10 @@ Repository: sindresorhus/restore-cursor
|
|
|
141
144
|
>
|
|
142
145
|
> 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.
|
|
143
146
|
|
|
144
|
-
|
|
147
|
+
---
|
|
145
148
|
|
|
146
149
|
## type-fest
|
|
150
|
+
|
|
147
151
|
License: (MIT OR CC0-1.0)
|
|
148
152
|
By: Sindre Sorhus
|
|
149
153
|
Repository: sindresorhus/type-fest
|
|
@@ -188,86 +192,84 @@ Repository: sindresorhus/type-fest
|
|
|
188
192
|
> Work and the meaning and intended legal effect of CC0 on those rights.
|
|
189
193
|
>
|
|
190
194
|
> 1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
191
|
-
>
|
|
192
|
-
>
|
|
193
|
-
>
|
|
195
|
+
> protected by copyright and related or neighboring rights ("Copyright and
|
|
196
|
+
> Related Rights"). Copyright and Related Rights include, but are not
|
|
197
|
+
> limited to, the following:
|
|
194
198
|
>
|
|
195
|
-
>
|
|
196
|
-
>
|
|
197
|
-
>
|
|
199
|
+
> i. the right to reproduce, adapt, distribute, perform, display,
|
|
200
|
+
> communicate, and translate a Work;
|
|
201
|
+
> ii. moral rights retained by the original author(s) and/or performer(s);
|
|
198
202
|
> iii. publicity and privacy rights pertaining to a person's image or
|
|
199
|
-
>
|
|
200
|
-
>
|
|
201
|
-
>
|
|
202
|
-
>
|
|
203
|
-
>
|
|
204
|
-
>
|
|
205
|
-
>
|
|
206
|
-
>
|
|
207
|
-
>
|
|
208
|
-
>
|
|
203
|
+
> likeness depicted in a Work;
|
|
204
|
+
> iv. rights protecting against unfair competition in regards to a Work,
|
|
205
|
+
> subject to the limitations in paragraph 4(a), below;
|
|
206
|
+
> v. rights protecting the extraction, dissemination, use and reuse of data
|
|
207
|
+
> in a Work;
|
|
208
|
+
> vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
209
|
+
> European Parliament and of the Council of 11 March 1996 on the legal
|
|
210
|
+
> protection of databases, and under any national implementation
|
|
211
|
+
> thereof, including any amended or successor version of such
|
|
212
|
+
> directive); and
|
|
209
213
|
> vii. other similar, equivalent or corresponding rights throughout the
|
|
210
|
-
>
|
|
211
|
-
>
|
|
214
|
+
> world based on applicable law or treaty, and any national
|
|
215
|
+
> implementations thereof.
|
|
212
216
|
>
|
|
213
217
|
> 2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
214
|
-
>
|
|
215
|
-
>
|
|
216
|
-
>
|
|
217
|
-
>
|
|
218
|
-
>
|
|
219
|
-
>
|
|
220
|
-
>
|
|
221
|
-
>
|
|
222
|
-
>
|
|
223
|
-
>
|
|
224
|
-
>
|
|
225
|
-
>
|
|
226
|
-
>
|
|
227
|
-
>
|
|
228
|
-
>
|
|
229
|
-
>
|
|
218
|
+
> of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
219
|
+
> irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
220
|
+
> Affirmer's Copyright and Related Rights and associated claims and causes
|
|
221
|
+
> of action, whether now known or unknown (including existing as well as
|
|
222
|
+
> future claims and causes of action), in the Work (i) in all territories
|
|
223
|
+
> worldwide, (ii) for the maximum duration provided by applicable law or
|
|
224
|
+
> treaty (including future time extensions), (iii) in any current or future
|
|
225
|
+
> medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
226
|
+
> including without limitation commercial, advertising or promotional
|
|
227
|
+
> purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
228
|
+
> member of the public at large and to the detriment of Affirmer's heirs and
|
|
229
|
+
> successors, fully intending that such Waiver shall not be subject to
|
|
230
|
+
> revocation, rescission, cancellation, termination, or any other legal or
|
|
231
|
+
> equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
232
|
+
> as contemplated by Affirmer's express Statement of Purpose.
|
|
230
233
|
> 3. Public License Fallback. Should any part of the Waiver for any reason
|
|
231
|
-
>
|
|
232
|
-
>
|
|
233
|
-
>
|
|
234
|
-
>
|
|
235
|
-
>
|
|
236
|
-
>
|
|
237
|
-
>
|
|
238
|
-
>
|
|
239
|
-
>
|
|
240
|
-
>
|
|
241
|
-
>
|
|
242
|
-
>
|
|
243
|
-
>
|
|
244
|
-
>
|
|
245
|
-
>
|
|
246
|
-
>
|
|
247
|
-
>
|
|
248
|
-
>
|
|
249
|
-
>
|
|
250
|
-
>
|
|
251
|
-
>
|
|
234
|
+
> be judged legally invalid or ineffective under applicable law, then the
|
|
235
|
+
> Waiver shall be preserved to the maximum extent permitted taking into
|
|
236
|
+
> account Affirmer's express Statement of Purpose. In addition, to the
|
|
237
|
+
> extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
238
|
+
> person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
239
|
+
> irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
240
|
+
> Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
241
|
+
> maximum duration provided by applicable law or treaty (including future
|
|
242
|
+
> time extensions), (iii) in any current or future medium and for any number
|
|
243
|
+
> of copies, and (iv) for any purpose whatsoever, including without
|
|
244
|
+
> limitation commercial, advertising or promotional purposes (the
|
|
245
|
+
> "License"). The License shall be deemed effective as of the date CC0 was
|
|
246
|
+
> applied by Affirmer to the Work. Should any part of the License for any
|
|
247
|
+
> reason be judged legally invalid or ineffective under applicable law, such
|
|
248
|
+
> partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
249
|
+
> of the License, and in such case Affirmer hereby affirms that he or she
|
|
250
|
+
> will not (i) exercise any of his or her remaining Copyright and Related
|
|
251
|
+
> Rights in the Work or (ii) assert any associated claims and causes of
|
|
252
|
+
> action with respect to the Work, in either case contrary to Affirmer's
|
|
253
|
+
> express Statement of Purpose.
|
|
252
254
|
> 4. Limitations and Disclaimers.
|
|
253
255
|
>
|
|
254
|
-
>
|
|
255
|
-
>
|
|
256
|
-
>
|
|
257
|
-
>
|
|
258
|
-
>
|
|
259
|
-
>
|
|
260
|
-
>
|
|
261
|
-
>
|
|
262
|
-
>
|
|
263
|
-
>
|
|
264
|
-
>
|
|
265
|
-
>
|
|
266
|
-
>
|
|
267
|
-
>
|
|
268
|
-
>
|
|
269
|
-
>
|
|
270
|
-
>
|
|
271
|
-
>
|
|
256
|
+
> a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
257
|
+
> surrendered, licensed or otherwise affected by this document.
|
|
258
|
+
> b. Affirmer offers the Work as-is and makes no representations or
|
|
259
|
+
> warranties of any kind concerning the Work, express, implied,
|
|
260
|
+
> statutory or otherwise, including without limitation warranties of
|
|
261
|
+
> title, merchantability, fitness for a particular purpose, non
|
|
262
|
+
> infringement, or the absence of latent or other defects, accuracy, or
|
|
263
|
+
> the present or absence of errors, whether or not discoverable, all to
|
|
264
|
+
> the greatest extent permissible under applicable law.
|
|
265
|
+
> c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
266
|
+
> that may apply to the Work or any use thereof, including without
|
|
267
|
+
> limitation any person's Copyright and Related Rights in the Work.
|
|
268
|
+
> Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
269
|
+
> consents, permissions or other rights required for any use of the
|
|
270
|
+
> Work.
|
|
271
|
+
> d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
272
|
+
> party to this document and has no duty or obligation with respect to
|
|
273
|
+
> this CC0 or use of the Work.
|
|
272
274
|
|
|
273
275
|
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -39,6 +39,19 @@ yarn add @visulima/ansi
|
|
|
39
39
|
pnpm add @visulima/ansi
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
* **Comprehensive Cursor Control:** Functions for precise cursor positioning, movement, visibility, and style.
|
|
45
|
+
* **Screen Manipulation:** Clear parts of the screen or the entire screen, manage alternative screen buffers, and control scrolling.
|
|
46
|
+
* **Text Erasure:** Erase characters, lines, or parts of lines.
|
|
47
|
+
* **iTerm2 Integration:** Support for iTerm2 specific features like image display.
|
|
48
|
+
* **Terminal Mode Management:** Control various terminal modes like line feed, local echo, and mouse events.
|
|
49
|
+
* **Mouse Event Handling:** Enable and disable different types of mouse tracking.
|
|
50
|
+
* **Window and Title Control:** Manipulate window titles, icons, and basic window operations (maximize, minimize, etc. for supported terminals).
|
|
51
|
+
* **Status Reporting:** Request and report various terminal statuses.
|
|
52
|
+
* **Hyperlinks:** Create clickable hyperlinks in the terminal.
|
|
53
|
+
* **Utility Functions:** Includes functions to strip ANSI codes and passthrough sequences for tmux.
|
|
54
|
+
|
|
42
55
|
## Usage
|
|
43
56
|
|
|
44
57
|
```js
|
|
@@ -65,6 +78,326 @@ const { cursorUp, cursorLeft } = require("@visulima/ansi");
|
|
|
65
78
|
// etc, as above...
|
|
66
79
|
```
|
|
67
80
|
|
|
81
|
+
**More Examples:**
|
|
82
|
+
|
|
83
|
+
**Cursor Manipulation**
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
import { cursorTo, cursorUp, eraseLine } from "@visulima/ansi";
|
|
87
|
+
|
|
88
|
+
// Move cursor to column 10, row 5
|
|
89
|
+
process.stdout.write(cursorTo(10, 5));
|
|
90
|
+
|
|
91
|
+
// Move cursor up 3 lines
|
|
92
|
+
process.stdout.write(cursorUp(3));
|
|
93
|
+
|
|
94
|
+
// Erase the current line
|
|
95
|
+
process.stdout.write(eraseLine);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Screen Clearing**
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
import { clearScreen, eraseDown } from "@visulima/ansi";
|
|
102
|
+
|
|
103
|
+
// Clear the entire screen
|
|
104
|
+
process.stdout.write(clearScreen);
|
|
105
|
+
|
|
106
|
+
// Clear from cursor to end of screen
|
|
107
|
+
process.stdout.write(eraseDown);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Text Styling (with other libraries)**
|
|
111
|
+
|
|
112
|
+
While `@visulima/ansi` focuses on terminal control, you can combine it with libraries like `chalk` for text styling:
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
import { cursorTo } from "@visulima/ansi";
|
|
116
|
+
import chalk from "chalk";
|
|
117
|
+
|
|
118
|
+
process.stdout.write(cursorTo(0,0));
|
|
119
|
+
process.stdout.write(chalk.blue("This is a blue message at the top left!"));
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## API
|
|
123
|
+
|
|
124
|
+
This package exports the following functions and constants. For a detailed list of all exports, see the `src/index.ts` file.
|
|
125
|
+
|
|
126
|
+
**General**
|
|
127
|
+
|
|
128
|
+
* `beep`
|
|
129
|
+
|
|
130
|
+
**Alternative Screen** (from `alternative-screen.ts`)
|
|
131
|
+
|
|
132
|
+
* `ALT_SCREEN_OFF`
|
|
133
|
+
* `ALT_SCREEN_ON`
|
|
134
|
+
* `alternativeScreenOff`
|
|
135
|
+
* `alternativeScreenOn`
|
|
136
|
+
|
|
137
|
+
**Clear** (from `clear.ts`)
|
|
138
|
+
|
|
139
|
+
* `clearLineAndHomeCursor`
|
|
140
|
+
* `clearScreenAndHomeCursor`
|
|
141
|
+
* `clearScreenFromTopLeft`
|
|
142
|
+
* `resetTerminal`
|
|
143
|
+
|
|
144
|
+
**Cursor** (from `cursor.ts`)
|
|
145
|
+
|
|
146
|
+
* `CURSOR_BACKWARD_1`
|
|
147
|
+
* `CURSOR_DOWN_1`
|
|
148
|
+
* `CURSOR_FORWARD_1`
|
|
149
|
+
* `CURSOR_UP_1`
|
|
150
|
+
* `cursorBackward`
|
|
151
|
+
* `cursorBackwardTab`
|
|
152
|
+
* `cursorDown`
|
|
153
|
+
* `cursorForward`
|
|
154
|
+
* `cursorHide`
|
|
155
|
+
* `cursorHorizontalAbsolute`
|
|
156
|
+
* `cursorHorizontalForwardTab`
|
|
157
|
+
* `cursorLeft`
|
|
158
|
+
* `cursorMove`
|
|
159
|
+
* `cursorNextLine`
|
|
160
|
+
* `cursorPosition`
|
|
161
|
+
* `cursorPreviousLine`
|
|
162
|
+
* `cursorRestore`
|
|
163
|
+
* `cursorSave`
|
|
164
|
+
* `cursorShow`
|
|
165
|
+
* `cursorTo`
|
|
166
|
+
* `cursorToColumn1`
|
|
167
|
+
* `cursorUp`
|
|
168
|
+
* `cursorVerticalAbsolute`
|
|
169
|
+
* `eraseCharacter` (Note: Also related to erase)
|
|
170
|
+
* `REQUEST_CURSOR_POSITION`
|
|
171
|
+
* `REQUEST_EXTENDED_CURSOR_POSITION`
|
|
172
|
+
* `RESTORE_CURSOR_DEC`
|
|
173
|
+
* `SAVE_CURSOR_DEC`
|
|
174
|
+
* `setCursorStyle`
|
|
175
|
+
|
|
176
|
+
**Erase** (from `erase.ts`)
|
|
177
|
+
|
|
178
|
+
* `eraseDisplay`
|
|
179
|
+
* `eraseDown`
|
|
180
|
+
* `eraseInLine`
|
|
181
|
+
* `eraseLine`
|
|
182
|
+
* `eraseLineEnd`
|
|
183
|
+
* `eraseLines`
|
|
184
|
+
* `eraseLineStart`
|
|
185
|
+
* `eraseScreen`
|
|
186
|
+
* `eraseScreenAndScrollback`
|
|
187
|
+
* `eraseUp`
|
|
188
|
+
|
|
189
|
+
**Hyperlink** (from `hyperlink.ts`)
|
|
190
|
+
|
|
191
|
+
* `hyperlink`
|
|
192
|
+
|
|
193
|
+
**Image** (from `image.ts`)
|
|
194
|
+
|
|
195
|
+
* `image`
|
|
196
|
+
|
|
197
|
+
**iTerm2 Integration** (from `iterm2.ts` and `iterm2/`)
|
|
198
|
+
|
|
199
|
+
* `IT2_AUTO`
|
|
200
|
+
* `it2Cells`
|
|
201
|
+
* `it2Percent`
|
|
202
|
+
* `it2Pixels`
|
|
203
|
+
* `iTerm2`
|
|
204
|
+
* `ITerm2File`
|
|
205
|
+
* `ITerm2FileEnd`
|
|
206
|
+
* `ITerm2FilePart`
|
|
207
|
+
* `ITerm2MultipartFileStart`
|
|
208
|
+
|
|
209
|
+
**Mode** (from `mode.ts`)
|
|
210
|
+
|
|
211
|
+
* `BDSM`
|
|
212
|
+
* `BiDirectionalSupportMode`
|
|
213
|
+
* `createAnsiMode`
|
|
214
|
+
* `createDecMode`
|
|
215
|
+
* `DECRPM`
|
|
216
|
+
* `DECRQM`
|
|
217
|
+
* `InsertReplaceMode`
|
|
218
|
+
* `IRM`
|
|
219
|
+
* `isModeNotRecognized`
|
|
220
|
+
* `isModePermanentlyReset`
|
|
221
|
+
* `isModePermanentlySet`
|
|
222
|
+
* `isModeReset`
|
|
223
|
+
* `isModeSet`
|
|
224
|
+
* `KAM`
|
|
225
|
+
* `KeyboardActionMode`
|
|
226
|
+
* `LineFeedNewLineMode`
|
|
227
|
+
* `LNM`
|
|
228
|
+
* `LocalEchoMode`
|
|
229
|
+
* `reportMode`
|
|
230
|
+
* `RequestBiDirectionalSupportMode`
|
|
231
|
+
* `RequestInsertReplaceMode`
|
|
232
|
+
* `RequestKeyboardActionMode`
|
|
233
|
+
* `RequestLineFeedNewLineMode`
|
|
234
|
+
* `RequestLocalEchoMode`
|
|
235
|
+
* `requestMode`
|
|
236
|
+
* `RequestSendReceiveMode`
|
|
237
|
+
* `ResetBiDirectionalSupportMode`
|
|
238
|
+
* `ResetInsertReplaceMode`
|
|
239
|
+
* `ResetKeyboardActionMode`
|
|
240
|
+
* `ResetLineFeedNewLineMode`
|
|
241
|
+
* `ResetLocalEchoMode`
|
|
242
|
+
* `resetMode`
|
|
243
|
+
* `ResetSendReceiveMode`
|
|
244
|
+
* `RM`
|
|
245
|
+
* `SendReceiveMode`
|
|
246
|
+
* `SetBiDirectionalSupportMode`
|
|
247
|
+
* `SetInsertReplaceMode`
|
|
248
|
+
* `SetKeyboardActionMode`
|
|
249
|
+
* `SetLineFeedNewLineMode`
|
|
250
|
+
* `SetLocalEchoMode`
|
|
251
|
+
* `setMode`
|
|
252
|
+
* `SetSendReceiveMode`
|
|
253
|
+
* `SM`
|
|
254
|
+
* `SRM`
|
|
255
|
+
|
|
256
|
+
**Mouse** (from `mouse.ts`)
|
|
257
|
+
|
|
258
|
+
* `disableAnyEventMouse`
|
|
259
|
+
* `disableButtonEventMouse`
|
|
260
|
+
* `disableFocusTracking`
|
|
261
|
+
* `disableNormalMouse`
|
|
262
|
+
* `disableSgrMouse`
|
|
263
|
+
* `disableX10Mouse`
|
|
264
|
+
* `enableAnyEventMouse`
|
|
265
|
+
* `enableButtonEventMouse`
|
|
266
|
+
* `enableFocusTracking`
|
|
267
|
+
* `enableNormalMouse`
|
|
268
|
+
* `enableSgrMouse`
|
|
269
|
+
* `enableX10Mouse`
|
|
270
|
+
* `encodeMouseButtonByte`
|
|
271
|
+
* `MouseButton`
|
|
272
|
+
* `mouseSgrSequence`
|
|
273
|
+
* `mouseX10Sequence`
|
|
274
|
+
|
|
275
|
+
**Passthrough** (from `passthrough.ts`)
|
|
276
|
+
|
|
277
|
+
* `SCREEN_MAX_LEN_DEFAULT`
|
|
278
|
+
* `SCREEN_TYPICAL_LIMIT`
|
|
279
|
+
* `screenPassthrough`
|
|
280
|
+
* `tmuxPassthrough`
|
|
281
|
+
|
|
282
|
+
**Reset** (from `reset.ts`)
|
|
283
|
+
|
|
284
|
+
* `RESET_INITIAL_STATE`
|
|
285
|
+
* `RIS`
|
|
286
|
+
|
|
287
|
+
**Screen** (from `screen.ts`)
|
|
288
|
+
|
|
289
|
+
* `clearTabStop`
|
|
290
|
+
* `deleteCharacter`
|
|
291
|
+
* `deleteLine`
|
|
292
|
+
* `insertCharacter`
|
|
293
|
+
* `insertLine`
|
|
294
|
+
* `repeatPreviousCharacter`
|
|
295
|
+
* `requestPresentationStateReport`
|
|
296
|
+
* `setLeftRightMargins`
|
|
297
|
+
* `setTopBottomMargins`
|
|
298
|
+
|
|
299
|
+
**Scroll** (from `scroll.ts`)
|
|
300
|
+
|
|
301
|
+
* `SCROLL_DOWN_1`
|
|
302
|
+
* `SCROLL_UP_1`
|
|
303
|
+
* `scrollDown`
|
|
304
|
+
* `scrollUp`
|
|
305
|
+
|
|
306
|
+
**Status** (from `status.ts`)
|
|
307
|
+
|
|
308
|
+
* `CPR`
|
|
309
|
+
* `createAnsiStatusReport`
|
|
310
|
+
* `createDecStatusReport`
|
|
311
|
+
* `cursorPositionReport`
|
|
312
|
+
* `DA1`
|
|
313
|
+
* `DA2`
|
|
314
|
+
* `DA3`
|
|
315
|
+
* `DECXCPR`
|
|
316
|
+
* `deviceStatusReport`
|
|
317
|
+
* `DSR`
|
|
318
|
+
* `DSR_KeyboardLanguageDEC`
|
|
319
|
+
* `DSR_PrinterStatusDEC`
|
|
320
|
+
* `DSR_TerminalStatus`
|
|
321
|
+
* `DSR_UDKStatusDEC`
|
|
322
|
+
* `extendedCursorPositionReport`
|
|
323
|
+
* `reportKeyboardLanguageDEC`
|
|
324
|
+
* `reportPrimaryDeviceAttributes`
|
|
325
|
+
* `reportPrinterNoPaperDEC`
|
|
326
|
+
* `reportPrinterNotReadyDEC`
|
|
327
|
+
* `reportPrinterReadyDEC`
|
|
328
|
+
* `reportSecondaryDeviceAttributes`
|
|
329
|
+
* `reportTerminalNotOK`
|
|
330
|
+
* `reportTerminalOK`
|
|
331
|
+
* `reportTertiaryDeviceAttributes`
|
|
332
|
+
* `reportUDKLockedDEC`
|
|
333
|
+
* `reportUDKUnlockedDEC`
|
|
334
|
+
* `requestCursorPositionReport`
|
|
335
|
+
* `requestExtendedCursorPositionReport`
|
|
336
|
+
* `requestKeyboardLanguageDEC`
|
|
337
|
+
* `RequestNameVersion`
|
|
338
|
+
* `requestPrimaryDeviceAttributes`
|
|
339
|
+
* `requestPrimaryDeviceAttributesParam0`
|
|
340
|
+
* `requestPrinterStatusDEC`
|
|
341
|
+
* `requestSecondaryDeviceAttributes`
|
|
342
|
+
* `requestSecondaryDeviceAttributesParam0`
|
|
343
|
+
* `requestTerminalStatus`
|
|
344
|
+
* `requestTertiaryDeviceAttributes`
|
|
345
|
+
* `requestTertiaryDeviceAttributesParam0`
|
|
346
|
+
* `requestUDKStatusDEC`
|
|
347
|
+
* `XTVERSION`
|
|
348
|
+
|
|
349
|
+
**Strip** (from `strip.ts`)
|
|
350
|
+
|
|
351
|
+
* `strip`
|
|
352
|
+
|
|
353
|
+
**Termcap/Terminfo** (from `termcap.ts`)
|
|
354
|
+
|
|
355
|
+
* `requestTermcap`
|
|
356
|
+
* `requestTerminfo`
|
|
357
|
+
* `XTGETTCAP`
|
|
358
|
+
|
|
359
|
+
**Title** (from `title.ts`)
|
|
360
|
+
|
|
361
|
+
* `decsin`
|
|
362
|
+
* `decswt`
|
|
363
|
+
* `setIconName`
|
|
364
|
+
* `setIconNameAndWindowTitle`
|
|
365
|
+
* `setIconNameAndWindowTitleWithST`
|
|
366
|
+
* `setIconNameWithST`
|
|
367
|
+
* `setWindowTitle`
|
|
368
|
+
* `setWindowTitleWithST`
|
|
369
|
+
|
|
370
|
+
**Window Operations** (from `window-ops.ts`)
|
|
371
|
+
|
|
372
|
+
* `deiconifyWindow`
|
|
373
|
+
* `iconifyWindow`
|
|
374
|
+
* `lowerWindow`
|
|
375
|
+
* `maximizeWindow`
|
|
376
|
+
* `moveWindow`
|
|
377
|
+
* `raiseWindow`
|
|
378
|
+
* `refreshWindow`
|
|
379
|
+
* `reportWindowPosition`
|
|
380
|
+
* `reportWindowState`
|
|
381
|
+
* `requestCellSizePixels`
|
|
382
|
+
* `requestFullScreen`
|
|
383
|
+
* `requestTextAreaSizeChars`
|
|
384
|
+
* `requestTextAreaSizePixels`
|
|
385
|
+
* `requestWindowPosition`
|
|
386
|
+
* `requestWindowSizeChars`
|
|
387
|
+
* `requestWindowSizePixels`
|
|
388
|
+
* `resizeTextAreaChars`
|
|
389
|
+
* `resizeTextAreaPixels`
|
|
390
|
+
* `restoreWindow`
|
|
391
|
+
* `XTWINOPS`
|
|
392
|
+
|
|
393
|
+
**XTerm** (from `xterm.ts`)
|
|
394
|
+
|
|
395
|
+
* `xtermBell`
|
|
396
|
+
* `xtermManipulateWindow`
|
|
397
|
+
* `xtermReport`
|
|
398
|
+
* `xtermRequest`
|
|
399
|
+
* `xtermSet`
|
|
400
|
+
|
|
68
401
|
## Related
|
|
69
402
|
|
|
70
403
|
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
|
@@ -73,8 +406,8 @@ const { cursorUp, cursorLeft } = require("@visulima/ansi");
|
|
|
73
406
|
|
|
74
407
|
## Supported Node.js Versions
|
|
75
408
|
|
|
76
|
-
Libraries in this ecosystem make the best effort to track [Node.js
|
|
77
|
-
Here
|
|
409
|
+
Libraries in this ecosystem make the best effort to track [Node.js' release schedule](https://github.com/nodejs/release#release-schedule).
|
|
410
|
+
Here's [a post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
78
411
|
|
|
79
412
|
## Contributing
|
|
80
413
|
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
|
-
const constants = require('./packem_shared/constants-
|
|
5
|
+
const constants = require('./packem_shared/constants-BK26O-46.cjs');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
const ALT_SCREEN_ON = `${constants.CSI}?1049h`;
|
|
10
|
+
const ALT_SCREEN_OFF = `${constants.CSI}?1049l`;
|
|
11
|
+
const alternativeScreenOn = /* @__PURE__ */ __name(() => ALT_SCREEN_ON, "alternativeScreenOn");
|
|
12
|
+
const alternativeScreenOff = /* @__PURE__ */ __name(() => ALT_SCREEN_OFF, "alternativeScreenOff");
|
|
9
13
|
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
14
|
+
exports.ALT_SCREEN_OFF = ALT_SCREEN_OFF;
|
|
15
|
+
exports.ALT_SCREEN_ON = ALT_SCREEN_ON;
|
|
16
|
+
exports.alternativeScreenOff = alternativeScreenOff;
|
|
17
|
+
exports.alternativeScreenOn = alternativeScreenOn;
|
|
@@ -1,4 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ANSI escape sequence to enable the alternative screen buffer.
|
|
3
|
+
*
|
|
4
|
+
* This sequence (`CSI ?1049h`) instructs the terminal to switch to the alternative screen buffer.
|
|
5
|
+
* This is a common practice for full-screen terminal applications (e.g., vim, less, htop)
|
|
6
|
+
* to provide a separate screen area for their interface, leaving the original shell content
|
|
7
|
+
* undisturbed and restoring it upon exit.
|
|
8
|
+
* When this mode is activated, the original screen content is typically saved by the terminal,
|
|
9
|
+
* and a blank screen is presented. Operations then occur on this alternative buffer.
|
|
10
|
+
*
|
|
11
|
+
* The specific behavior (like whether the screen is cleared on switch) can sometimes vary
|
|
12
|
+
* slightly between terminal emulators. `?1049h` generally includes saving the cursor position
|
|
13
|
+
* along with the screen content and clearing the alternative screen.
|
|
14
|
+
* It is closely related to mode `?47h`, which also switches to an alternative buffer but might
|
|
15
|
+
* have different semantics regarding screen clearing and cursor saving.
|
|
16
|
+
* Mode `?1049h` is generally preferred for a more robust alternative screen experience.
|
|
17
|
+
* @see {@link ALT_SCREEN_OFF} for the sequence to disable the alternative screen buffer.
|
|
18
|
+
* @see {@link alternativeScreenOn} for a function that returns this sequence.
|
|
19
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer} Xterm Control Sequences documentation.
|
|
20
|
+
* @see {@link https://vt100.net/docs/vt510-rm/DECSLPP.html} (related DEC modes, though 1049 is more common for this behavior).
|
|
21
|
+
*/
|
|
22
|
+
export declare const ALT_SCREEN_ON: string;
|
|
23
|
+
/**
|
|
24
|
+
* ANSI escape sequence to disable the alternative screen buffer.
|
|
25
|
+
*
|
|
26
|
+
* This sequence (`CSI ?1049l`) instructs the terminal to switch back from the alternative
|
|
27
|
+
* screen buffer to the main screen buffer. When this occurs, the terminal typically
|
|
28
|
+
* restores the screen content and cursor position that were saved when the alternative
|
|
29
|
+
* buffer was activated by {@link ALT_SCREEN_ON}.
|
|
30
|
+
*
|
|
31
|
+
* This is used when a full-screen application exits, allowing the user to return to their
|
|
32
|
+
* previous shell session seamlessly.
|
|
33
|
+
* @see {@link ALT_SCREEN_ON} for the sequence to enable the alternative screen buffer.
|
|
34
|
+
* @see {@link alternativeScreenOff} for a function that returns this sequence.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ALT_SCREEN_OFF: string;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the ANSI escape sequence to enable the alternative screen buffer.
|
|
39
|
+
*
|
|
40
|
+
* This function is a convenience wrapper around the {@link ALT_SCREEN_ON} constant.
|
|
41
|
+
* It provides a more descriptive way to obtain the sequence for enabling the
|
|
42
|
+
* alternative screen, often used at the initialization phase of a full-screen
|
|
43
|
+
* terminal application.
|
|
44
|
+
* @returns The ANSI escape sequence (`CSI ?1049h`) for enabling the alternative screen buffer.
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { alternativeScreenOn } from '@visulima/ansi/alternative-screen';
|
|
48
|
+
*
|
|
49
|
+
* process.stdout.write(alternativeScreenOn());
|
|
50
|
+
* // Terminal switches to the alternative screen buffer.
|
|
51
|
+
* ```
|
|
52
|
+
* @see {@link ALT_SCREEN_ON}
|
|
53
|
+
* @see {@link alternativeScreenOff}
|
|
54
|
+
*/
|
|
55
|
+
export declare const alternativeScreenOn: () => string;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the ANSI escape sequence to disable the alternative screen buffer.
|
|
58
|
+
*
|
|
59
|
+
* This function is a convenience wrapper around the {@link ALT_SCREEN_OFF} constant.
|
|
60
|
+
* It provides a more descriptive way to obtain the sequence for disabling the
|
|
61
|
+
* alternative screen, typically used when a full-screen terminal application is exiting
|
|
62
|
+
* to restore the user's original terminal state.
|
|
63
|
+
* @returns The ANSI escape sequence (`CSI ?1049l`) for disabling the alternative screen buffer.
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { alternativeScreenOff } from '@visulima/ansi/alternative-screen';
|
|
67
|
+
*
|
|
68
|
+
* process.stdout.write(alternativeScreenOff());
|
|
69
|
+
* // Terminal switches back to the main screen buffer, restoring previous content.
|
|
70
|
+
* ```
|
|
71
|
+
* @see {@link ALT_SCREEN_OFF}
|
|
72
|
+
* @see {@link alternativeScreenOn}
|
|
73
|
+
*/
|
|
74
|
+
export declare const alternativeScreenOff: () => string;
|