@visulima/ansi 3.0.5 → 4.0.0-alpha.2

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +32 -14
  3. package/package.json +51 -3
  4. package/dist/alternative-screen.d.ts +0 -74
  5. package/dist/alternative-screen.js +0 -1
  6. package/dist/clear.d.ts +0 -77
  7. package/dist/clear.js +0 -1
  8. package/dist/constants.d.ts +0 -20
  9. package/dist/cursor.d.ts +0 -437
  10. package/dist/cursor.js +0 -1
  11. package/dist/erase.d.ts +0 -206
  12. package/dist/erase.js +0 -1
  13. package/dist/helpers.d.ts +0 -14
  14. package/dist/hyperlink.d.ts +0 -27
  15. package/dist/hyperlink.js +0 -1
  16. package/dist/image.d.ts +0 -73
  17. package/dist/image.js +0 -1
  18. package/dist/index.d.ts +0 -36
  19. package/dist/index.js +0 -1
  20. package/dist/iterm2/iterm2-properties.d.ts +0 -135
  21. package/dist/iterm2/iterm2-sequences.d.ts +0 -96
  22. package/dist/iterm2.d.ts +0 -58
  23. package/dist/iterm2.js +0 -1
  24. package/dist/mode.d.ts +0 -726
  25. package/dist/mode.js +0 -1
  26. package/dist/mouse.d.ts +0 -230
  27. package/dist/mouse.js +0 -1
  28. package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +0 -1
  29. package/dist/packem_shared/ITerm2File-C88DBJC-.js +0 -1
  30. package/dist/packem_shared/constants-D12jy2Zh.js +0 -1
  31. package/dist/packem_shared/cursor-nxpKt8Tn.js +0 -1
  32. package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +0 -1
  33. package/dist/packem_shared/restoreCursor-CHy0jZuu.js +0 -2
  34. package/dist/passthrough.d.ts +0 -77
  35. package/dist/passthrough.js +0 -1
  36. package/dist/progress.d.ts +0 -41
  37. package/dist/reset.d.ts +0 -26
  38. package/dist/reset.js +0 -1
  39. package/dist/screen.d.ts +0 -234
  40. package/dist/screen.js +0 -1
  41. package/dist/scroll.d.ts +0 -67
  42. package/dist/scroll.js +0 -1
  43. package/dist/status.d.ts +0 -524
  44. package/dist/status.js +0 -1
  45. package/dist/strip.d.ts +0 -23
  46. package/dist/strip.js +0 -1
  47. package/dist/termcap.d.ts +0 -38
  48. package/dist/termcap.js +0 -1
  49. package/dist/title.d.ts +0 -185
  50. package/dist/title.js +0 -1
  51. package/dist/window-ops.d.ts +0 -418
  52. package/dist/window-ops.js +0 -1
  53. package/dist/xterm.d.ts +0 -94
  54. package/dist/xterm.js +0 -1
package/dist/screen.d.ts DELETED
@@ -1,234 +0,0 @@
1
- /**
2
- * Inserts a specified number of blank lines at the current cursor position.
3
- * (IL - Insert Line)
4
- *
5
- * Existing lines from the cursor position to the bottom margin are moved downwards.
6
- * Lines moved past the bottom margin are lost. The cursor position is unchanged.
7
- * If the parameter `count` is 0 or 1, it defaults to inserting one line.
8
- *
9
- * Sequence: `CSI Pn L`
10
- * - `Pn`: Number of lines to insert (default: 1).
11
- * @param count The number of blank lines to insert. Defaults to 1.
12
- * @returns The ANSI escape sequence for inserting lines.
13
- * @see {@link https://vt100.net/docs/vt510-rm/IL.html VT510 IL Documentation}
14
- * @example
15
- * ```typescript
16
- * import { insertLine } from \'@visulima/ansi/screen\';
17
- *
18
- * // Insert 1 line (default)
19
- * process.stdout.write(insertLine()); // CSI L
20
- *
21
- * // Insert 5 lines
22
- * process.stdout.write(insertLine(5)); // CSI 5L
23
- * ```
24
- */
25
- export declare const insertLine: (count?: number) => string;
26
- /**
27
- * Deletes a specified number of lines starting from the line with the cursor.
28
- * (DL - Delete Line)
29
- *
30
- * Lines below the deleted ones are moved upwards. Blank lines are added at the bottom
31
- * of the scrolling region to fill the gap. The cursor position is unchanged.
32
- * If the parameter `count` is 0 or 1, it defaults to deleting one line.
33
- *
34
- * Sequence: `CSI Pn M`
35
- * - `Pn`: Number of lines to delete (default: 1).
36
- * @param count The number of lines to delete. Defaults to 1.
37
- * @returns The ANSI escape sequence for deleting lines.
38
- * @see {@link https://vt100.net/docs/vt510-rm/DL.html VT510 DL Documentation}
39
- * @example
40
- * ```typescript
41
- * import { deleteLine } from \'@visulima/ansi/screen\';
42
- *
43
- * // Delete 1 line (default)
44
- * process.stdout.write(deleteLine()); // CSI M
45
- *
46
- * // Delete 3 lines
47
- * process.stdout.write(deleteLine(3)); // CSI 3M
48
- * ```
49
- */
50
- export declare const deleteLine: (count?: number) => string;
51
- /**
52
- * Sets the top and bottom margins, defining the scrolling region.
53
- * (DECSTBM - Set Top and Bottom Margins)
54
- *
55
- * Cursor movement is typically confined to this region, especially when Origin Mode (DECOM) is active.
56
- * If parameters are omitted or invalid (e.g., `0`, `null`, `undefined`), they usually default to the
57
- * screen's current extents (e.g., line 1 for top, last line for bottom).
58
- *
59
- * Sequence: `CSI Pt ; Pb r`
60
- * - `Pt`: Line number for the top margin (1-indexed). Default: 1.
61
- * - `Pb`: Line number for the bottom margin (1-indexed). Default: screen height.
62
- * @param top The line number for the top margin (1-indexed). If `null`, `undefined`, or `< 1`, it's omitted, implying default.
63
- * @param bottom The line number for the bottom margin (1-indexed). If `null`, `undefined`, or `< 1`, it's omitted, implying default.
64
- * @returns The ANSI escape sequence for DECSTBM.
65
- * @see {@link https://vt100.net/docs/vt510-rm/DECSTBM.html VT510 DECSTBM Documentation}
66
- * @example
67
- * ```typescript
68
- * import { setTopBottomMargins } from \'@visulima/ansi/screen\';
69
- *
70
- * // Set scrolling region from line 5 to 20
71
- * process.stdout.write(setTopBottomMargins(5, 20)); // CSI 5;20r
72
- *
73
- * // Reset to default margins (full screen)
74
- * process.stdout.write(setTopBottomMargins()); // CSI ;r
75
- * ```
76
- */
77
- export declare const setTopBottomMargins: (top?: number | null, bottom?: number | null) => string;
78
- /**
79
- * Sets the left and right margins for the page or screen, defining horizontal boundaries.
80
- * (DECSLRM - Set Left and Right Margins)
81
- *
82
- * This command is common on VT420+ terminals and xterm.
83
- * If parameters are omitted or invalid, they usually default to the screen's current extents
84
- * (e.g., column 1 for left, last column for right).
85
- *
86
- * Sequence: `CSI Pl ; Pr s`
87
- * - `Pl`: Column number for the left margin (1-indexed). Default: 1.
88
- * - `Pr`: Column number for the right margin (1-indexed). Default: screen width.
89
- *
90
- * Note: The final character 's' should not be confused with save cursor sequences.
91
- * @param left The column number for the left margin (1-indexed). If `null`, `undefined`, or `< 1`, it's omitted.
92
- * @param right The column number for the right margin (1-indexed). If `null`, `undefined`, or `< 1`, it's omitted.
93
- * @returns The ANSI escape sequence for DECSLRM.
94
- * @see {@link https://vt100.net/docs/vt510-rm/DECSLRM.html VT510 DECSLRM Documentation}
95
- * @example
96
- * ```typescript
97
- * import { setLeftRightMargins } from \'@visulima/ansi/screen\';
98
- *
99
- * // Set left margin to 10, right margin to 70
100
- * process.stdout.write(setLeftRightMargins(10, 70)); // CSI 10;70s
101
- *
102
- * // Reset to default margins (full width)
103
- * process.stdout.write(setLeftRightMargins()); // CSI ;s
104
- * ```
105
- */
106
- export declare const setLeftRightMargins: (left?: number | null, right?: number | null) => string;
107
- /**
108
- * Inserts a specified number of blank characters at the current cursor position.
109
- * (ICH - Insert CHaracter)
110
- *
111
- * Existing characters from the cursor position to the right margin are shifted to the right.
112
- * Characters shifted past the right margin are lost. The cursor position is unchanged.
113
- * If the parameter `count` is 0 or 1, it defaults to inserting one character.
114
- *
115
- * Sequence: `CSI Pn @`
116
- * - `Pn`: Number of blank characters to insert (default: 1).
117
- * @param count The number of blank characters to insert. Defaults to 1.
118
- * @returns The ANSI escape sequence for inserting characters.
119
- * @see {@link https://vt100.net/docs/vt510-rm/ICH.html VT510 ICH Documentation}
120
- * @example
121
- * ```typescript
122
- * import { insertCharacter } from \'@visulima/ansi/screen\';
123
- *
124
- * // Insert 1 character (default)
125
- * process.stdout.write(insertCharacter()); // CSI @
126
- *
127
- * // Insert 10 characters
128
- * process.stdout.write(insertCharacter(10)); // CSI 10@
129
- * ```
130
- */
131
- export declare const insertCharacter: (count?: number) => string;
132
- /**
133
- * Deletes a specified number of characters starting from the current cursor position.
134
- * (DCH - Delete CHaracter)
135
- *
136
- * Remaining characters on the line (to the right of the cursor) are shifted to the left.
137
- * Character attributes move with the characters. Blank characters with default attributes
138
- * are inserted at the right margin. The cursor position is unchanged.
139
- * If the parameter `count` is 0 or 1, it defaults to deleting one character.
140
- *
141
- * Sequence: `CSI Pn P`
142
- * - `Pn`: Number of characters to delete (default: 1).
143
- * @param count The number of characters to delete. Defaults to 1.
144
- * @returns The ANSI escape sequence for deleting characters.
145
- * @see {@link https://vt100.net/docs/vt510-rm/DCH.html VT510 DCH Documentation}
146
- * @example
147
- * ```typescript
148
- * import { deleteCharacter } from \'@visulima/ansi/screen\';
149
- *
150
- * // Delete 1 character (default)
151
- * process.stdout.write(deleteCharacter()); // CSI P
152
- *
153
- * // Delete 5 characters
154
- * process.stdout.write(deleteCharacter(5)); // CSI 5P
155
- * ```
156
- */
157
- export declare const deleteCharacter: (count?: number) => string;
158
- /**
159
- * Clears horizontal tab stops.
160
- * (TBC - Tabulation Clear)
161
- *
162
- * Sequence: `CSI Ps g`
163
- * - `Ps = 0` (or omitted): Clear horizontal tab stop at the current column (default).
164
- * - `Ps = 3`: Clear all horizontal tab stops in the current line (or all lines, terminal-dependent).
165
- * @param mode Specifies which tab stops to clear:
166
- * - `0`: Clear tab stop at the current cursor column (default).
167
- * - `3`: Clear all horizontal tab stops.
168
- * @returns The ANSI escape sequence for clearing tab stops.
169
- * @see {@link https://vt100.net/docs/vt510-rm/TBC.html VT510 TBC Documentation}
170
- * @example
171
- * ```typescript
172
- * import { clearTabStop } from \'@visulima/ansi/screen\';
173
- *
174
- * // Clear tab stop at current column
175
- * process.stdout.write(clearTabStop(0)); // CSI 0g
176
- * process.stdout.write(clearTabStop()); // CSI 0g (default)
177
- *
178
- * // Clear all tab stops
179
- * process.stdout.write(clearTabStop(3)); // CSI 3g
180
- * ```
181
- */
182
- export declare const clearTabStop: (mode?: 0 | 3) => string;
183
- /**
184
- * Requests a report of the terminal's presentation state.
185
- * (DECRQPSR - Request Presentation State Report)
186
- *
187
- * The terminal responds with a corresponding report sequence (e.g., DECTPSSR, DECSGRSR, DECCPSR).
188
- * This is useful for querying current SGR settings, color palette, etc.
189
- *
190
- * Sequence: `CSI Ps $ u`
191
- * - `Ps = 0`: Report Text Presentation State (DECTPSSR) - font, decoration, etc.
192
- * - `Ps = 1`: Report SGR State (DECSGRSR) - current graphic rendition attributes.
193
- * - `Ps = 2`: Report Color Palette State (DECCPSR) - color table contents.
194
- * @param mode Specifies the type of presentation state report requested:
195
- * - `0`: Text Presentation State (DECTPSSR).
196
- * - `1`: SGR State (DECSGRSR).
197
- * - `2`: Color Palette State (DECCPSR).
198
- * @returns The ANSI escape sequence to request the presentation state report.
199
- * @see {@link https://vt100.net/docs/vt510-rm/DECRQPSR.html VT510 DECRQPSR Documentation}
200
- * @example
201
- * ```typescript
202
- * import { requestPresentationStateReport } from \'@visulima/ansi/screen\';
203
- *
204
- * // Request SGR state
205
- * process.stdout.write(requestPresentationStateReport(1)); // CSI 1$u
206
- * ```
207
- */
208
- export declare const requestPresentationStateReport: (mode: 0 | 1 | 2) => string;
209
- /**
210
- * Repeats the preceding graphic character a specified number of times.
211
- * (REP - Repeat Previous Character)
212
- *
213
- * The character repeated is the last non-control character that was processed by the terminal.
214
- * If the parameter `count` is 0 or 1, it defaults to repeating one time (i.e., printing it again).
215
- *
216
- * Sequence: `CSI Pn b`
217
- * - `Pn`: Number of times to repeat the character (default: 1).
218
- * @param count The number of times to repeat the preceding graphic character. Defaults to 1.
219
- * @returns The ANSI escape sequence for repeating the previous character.
220
- * @see {@link https://vt100.net/docs/vt510-rm/REP.html VT510 REP Documentation (though REP is less common or behavior varies)}
221
- * @example
222
- * ```typescript
223
- * import { repeatPreviousCharacter } from \'@visulima/ansi/screen\';
224
- *
225
- * process.stdout.write("A");
226
- * // Repeat 'A' 5 times
227
- * process.stdout.write(repeatPreviousCharacter(5)); // Output: AAAAA (total 6 'A's)
228
- *
229
- * process.stdout.write("B");
230
- * // Repeat 'B' 1 time (default)
231
- * process.stdout.write(repeatPreviousCharacter()); // Output: BB (total 2 'B's)
232
- * ```
233
- */
234
- export declare const repeatPreviousCharacter: (count?: number) => string;
package/dist/screen.js DELETED
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var o=(e,r)=>c(e,"name",{value:r,configurable:!0});import{C as t,S as s}from"./packem_shared/constants-D12jy2Zh.js";var g=Object.defineProperty,a=o((e,r)=>g(e,"name",{value:r,configurable:!0}),"n");const S=a((e=1)=>`${t+(e<=1?"":e)}L`,"insertLine"),u=a((e=1)=>`${t+(e<=1?"":e)}M`,"deleteLine"),h=a((e,r)=>{const n=e&&e>0?e.toString():"",i=r&&r>0?r.toString():"";return n===""&&i===""?`${t+s}r`:`${t+n+s+i}r`},"setTopBottomMargins"),l=a((e,r)=>{const n=e&&e>0?e.toString():"",i=r&&r>0?r.toString():"";return n===""&&i===""?`${t+s}s`:`${t+n+s+i}s`},"setLeftRightMargins"),C=a((e=1)=>`${t+(e<=1?"":e)}@`,"insertCharacter"),L=a((e=1)=>`${t+(e<=1?"":e)}P`,"deleteCharacter"),P=a((e=0)=>`${t+e}g`,"clearTabStop"),b=a(e=>`${t+e}$u`,"requestPresentationStateReport"),d=a((e=1)=>`${t+(e<=1?"":e)}b`,"repeatPreviousCharacter");export{P as clearTabStop,L as deleteCharacter,u as deleteLine,C as insertCharacter,S as insertLine,d as repeatPreviousCharacter,b as requestPresentationStateReport,l as setLeftRightMargins,h as setTopBottomMargins};
package/dist/scroll.d.ts DELETED
@@ -1,67 +0,0 @@
1
- /**
2
- * Scrolls the content of the active scrolling region upwards by a specified number of lines.
3
- * (SU - Scroll Up)
4
- *
5
- * New blank lines are added at the bottom of the scrolling region.
6
- * If the parameter `count` is 1 or omitted, it defaults to scrolling one line.
7
- * The cursor position is not affected by this command.
8
- *
9
- * Sequence: `CSI Pn S`
10
- * - `Pn`: Number of lines to scroll up (default: 1).
11
- * @param count The number of lines to scroll up. Defaults to 1. If 0, an empty string is returned as no operation is performed.
12
- * @returns The ANSI escape sequence for scrolling up.
13
- * @see {@link https://vt100.net/docs/vt510-rm/SU.html VT510 SU Documentation}
14
- * @example
15
- * ```typescript
16
- * import { scrollUp } from \'@visulima/ansi/scroll\';
17
- *
18
- * // Scroll up 1 line
19
- * process.stdout.write(scrollUp()); // CSI S
20
- * process.stdout.write(scrollUp(1)); // CSI S
21
- *
22
- * // Scroll up 5 lines
23
- * process.stdout.write(scrollUp(5)); // CSI 5S
24
- *
25
- * // No operation
26
- * process.stdout.write(scrollUp(0)); // ""
27
- * ```
28
- */
29
- export declare const scrollUp: (count?: number) => string;
30
- /**
31
- * Scrolls the content of the active scrolling region downwards by a specified number of lines.
32
- * (SD - Scroll Down)
33
- *
34
- * New blank lines are added at the top of the scrolling region.
35
- * If the parameter `count` is 1 or omitted, it defaults to scrolling one line.
36
- * The cursor position is not affected by this command.
37
- *
38
- * Sequence: `CSI Pn T`
39
- * - `Pn`: Number of lines to scroll down (default: 1).
40
- * @param count The number of lines to scroll down. Defaults to 1. If 0, an empty string is returned.
41
- * @returns The ANSI escape sequence for scrolling down.
42
- * @see {@link https://vt100.net/docs/vt510-rm/SD.html VT510 SD Documentation}
43
- * @example
44
- * ```typescript
45
- * import { scrollDown } from \'@visulima/ansi/scroll\';
46
- *
47
- * // Scroll down 1 line
48
- * process.stdout.write(scrollDown()); // CSI T
49
- * process.stdout.write(scrollDown(1)); // CSI T
50
- *
51
- * // Scroll down 3 lines
52
- * process.stdout.write(scrollDown(3)); // CSI 3T
53
- * ```
54
- */
55
- export declare const scrollDown: (count?: number) => string;
56
- /**
57
- * ANSI escape sequence to scroll up one line: `CSI S`.
58
- * This is equivalent to `scrollUp(1)`.
59
- * @see {@link scrollUp}
60
- */
61
- export declare const SCROLL_UP_1: string;
62
- /**
63
- * ANSI escape sequence to scroll down one line: `CSI T`.
64
- * This is equivalent to `scrollDown(1)`.
65
- * @see {@link scrollDown}
66
- */
67
- export declare const SCROLL_DOWN_1: string;
package/dist/scroll.js DELETED
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var r=(o,e)=>s(o,"name",{value:e,configurable:!0});import{C as l}from"./packem_shared/constants-D12jy2Zh.js";var a=Object.defineProperty,c=r((o,e)=>a(o,"name",{value:e,configurable:!0}),"s");const p=c((o=1)=>o===0?"":`${l+(o<=1?"":o)}S`,"scrollUp"),S=c((o=1)=>o===0?"":`${l+(o<=1?"":o)}T`,"scrollDown"),C=`${l}S`,L=`${l}T`;export{L as SCROLL_DOWN_1,C as SCROLL_UP_1,S as scrollDown,p as scrollUp};