@visulima/ansi 2.0.1 → 3.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/CHANGELOG.md +30 -0
- package/LICENSE.md +1 -132
- package/README.md +226 -226
- package/dist/alternative-screen.d.ts +6 -74
- package/dist/alternative-screen.js +1 -0
- package/dist/clear.d.ts +6 -77
- package/dist/clear.js +1 -0
- package/dist/cursor.d.ts +48 -429
- package/dist/cursor.js +1 -0
- package/dist/erase.d.ts +14 -197
- package/dist/erase.js +1 -0
- package/dist/hyperlink.d.ts +2 -26
- package/dist/hyperlink.js +1 -0
- package/dist/image.d.ts +7 -69
- package/dist/image.js +1 -0
- package/dist/index.d.ts +30 -35
- package/dist/index.js +1 -0
- package/dist/iterm2.d.ts +43 -58
- package/dist/iterm2.js +1 -0
- package/dist/mode.d.ts +174 -648
- package/dist/mode.js +1 -0
- package/dist/mouse.d.ts +21 -203
- package/dist/mouse.js +1 -0
- package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +1 -0
- package/dist/packem_shared/ITerm2File-C88DBJC-.js +1 -0
- package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
- package/dist/packem_shared/cursor-D2UOfUc_.js +1 -0
- package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +1 -0
- package/dist/packem_shared/restoreCursor-D3XBmqcY.js +2 -0
- package/dist/passthrough.d.ts +6 -77
- package/dist/passthrough.js +1 -0
- package/dist/reset.d.ts +4 -26
- package/dist/reset.js +1 -0
- package/dist/screen.d.ts +11 -234
- package/dist/screen.js +1 -0
- package/dist/scroll.d.ts +6 -67
- package/dist/scroll.js +1 -0
- package/dist/status.d.ts +48 -498
- package/dist/status.js +1 -0
- package/dist/strip.d.ts +2 -22
- package/dist/strip.js +1 -0
- package/dist/termcap.d.ts +5 -38
- package/dist/termcap.js +1 -0
- package/dist/title.d.ts +10 -185
- package/dist/title.js +1 -0
- package/dist/window-ops.d.ts +24 -396
- package/dist/window-ops.js +1 -0
- package/dist/xterm.d.ts +12 -94
- package/dist/xterm.js +1 -0
- package/package.json +45 -230
- package/dist/alternative-screen.cjs +0 -17
- package/dist/alternative-screen.d.cts +0 -74
- package/dist/alternative-screen.d.mts +0 -74
- package/dist/alternative-screen.mjs +0 -10
- package/dist/clear.cjs +0 -17
- package/dist/clear.d.cts +0 -77
- package/dist/clear.d.mts +0 -77
- package/dist/clear.mjs +0 -10
- package/dist/constants.d.cts +0 -20
- package/dist/constants.d.mts +0 -20
- package/dist/constants.d.ts +0 -20
- package/dist/cursor.cjs +0 -41
- package/dist/cursor.d.cts +0 -437
- package/dist/cursor.d.mts +0 -437
- package/dist/cursor.mjs +0 -3
- package/dist/erase.cjs +0 -64
- package/dist/erase.d.cts +0 -206
- package/dist/erase.d.mts +0 -206
- package/dist/erase.mjs +0 -49
- package/dist/helpers.d.cts +0 -14
- package/dist/helpers.d.mts +0 -14
- package/dist/helpers.d.ts +0 -14
- package/dist/hyperlink.cjs +0 -9
- package/dist/hyperlink.d.cts +0 -27
- package/dist/hyperlink.d.mts +0 -27
- package/dist/hyperlink.mjs +0 -7
- package/dist/image.cjs +0 -28
- package/dist/image.d.cts +0 -73
- package/dist/image.d.mts +0 -73
- package/dist/image.mjs +0 -24
- package/dist/index.cjs +0 -246
- package/dist/index.d.cts +0 -35
- package/dist/index.d.mts +0 -35
- package/dist/index.mjs +0 -25
- package/dist/iterm2/iterm2-properties.d.cts +0 -135
- package/dist/iterm2/iterm2-properties.d.mts +0 -135
- package/dist/iterm2/iterm2-properties.d.ts +0 -135
- package/dist/iterm2/iterm2-sequences.d.cts +0 -96
- package/dist/iterm2/iterm2-sequences.d.mts +0 -96
- package/dist/iterm2/iterm2-sequences.d.ts +0 -96
- package/dist/iterm2.cjs +0 -26
- package/dist/iterm2.d.cts +0 -58
- package/dist/iterm2.d.mts +0 -58
- package/dist/iterm2.mjs +0 -14
- package/dist/mode.cjs +0 -388
- package/dist/mode.d.cts +0 -657
- package/dist/mode.d.mts +0 -657
- package/dist/mode.mjs +0 -235
- package/dist/mouse.cjs +0 -127
- package/dist/mouse.d.cts +0 -230
- package/dist/mouse.d.mts +0 -230
- package/dist/mouse.mjs +0 -108
- package/dist/packem_shared/IT2_AUTO-5vTJQMm6.cjs +0 -15
- package/dist/packem_shared/IT2_AUTO-DnfCUXso.mjs +0 -8
- package/dist/packem_shared/ITerm2File-BGPqNSjB.cjs +0 -137
- package/dist/packem_shared/ITerm2File-DKFkdqdA.mjs +0 -130
- package/dist/packem_shared/constants-BK26O-46.cjs +0 -17
- package/dist/packem_shared/constants-CE7WkXh_.mjs +0 -9
- package/dist/packem_shared/cursor-CQKLCu7U.cjs +0 -105
- package/dist/packem_shared/cursor-DhFQcQ9g.mjs +0 -73
- package/dist/packem_shared/restoreCursor-C6pNB8UY.mjs +0 -336
- package/dist/packem_shared/restoreCursor-DC_ZKZwT.cjs +0 -342
- package/dist/passthrough.cjs +0 -38
- package/dist/passthrough.d.cts +0 -77
- package/dist/passthrough.d.mts +0 -77
- package/dist/passthrough.mjs +0 -31
- package/dist/reset.cjs +0 -9
- package/dist/reset.d.cts +0 -26
- package/dist/reset.d.mts +0 -26
- package/dist/reset.mjs +0 -4
- package/dist/screen.cjs +0 -41
- package/dist/screen.d.cts +0 -234
- package/dist/screen.d.mts +0 -234
- package/dist/screen.mjs +0 -29
- package/dist/scroll.cjs +0 -27
- package/dist/scroll.d.cts +0 -67
- package/dist/scroll.d.mts +0 -67
- package/dist/scroll.mjs +0 -20
- package/dist/status.cjs +0 -147
- package/dist/status.d.cts +0 -501
- package/dist/status.d.mts +0 -501
- package/dist/status.mjs +0 -104
- package/dist/strip.cjs +0 -20
- package/dist/strip.d.cts +0 -23
- package/dist/strip.d.mts +0 -23
- package/dist/strip.mjs +0 -18
- package/dist/termcap.cjs +0 -33
- package/dist/termcap.d.cts +0 -38
- package/dist/termcap.d.mts +0 -38
- package/dist/termcap.mjs +0 -27
- package/dist/title.cjs +0 -31
- package/dist/title.d.cts +0 -185
- package/dist/title.d.mts +0 -185
- package/dist/title.mjs +0 -20
- package/dist/window-ops.cjs +0 -85
- package/dist/window-ops.d.cts +0 -418
- package/dist/window-ops.d.mts +0 -418
- package/dist/window-ops.mjs +0 -63
- package/dist/xterm.cjs +0 -48
- package/dist/xterm.d.cts +0 -94
- package/dist/xterm.d.mts +0 -94
- package/dist/xterm.mjs +0 -35
package/dist/erase.d.ts
CHANGED
|
@@ -1,206 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
* Defines the modes for erasing parts of the display using the ED (Erase in Display) sequence.
|
|
3
|
-
* The ED sequence is `CSI Ps J`, where `Ps` is one of these mode values.
|
|
4
|
-
* @see {@link eraseDisplay} for the function that generates ED sequences.
|
|
5
|
-
* @see {@link https://vt100.net/docs/vt510-rm/ED.html} VT510 Erase in Display (ED) documentation.
|
|
6
|
-
* @enum {number}
|
|
7
|
-
*/
|
|
8
|
-
export declare enum EraseDisplayMode {
|
|
9
|
-
/**
|
|
10
|
-
* Clears the entire screen. The cursor position usually does not change, but this can be
|
|
11
|
-
* terminal-dependent. Some terminals might move the cursor to the home position (top-left).
|
|
12
|
-
* This corresponds to `Ps=2` in `CSI Ps J`.
|
|
13
|
-
* Sequence: `CSI 2J`.
|
|
14
|
-
*/
|
|
1
|
+
declare enum EraseDisplayMode {
|
|
15
2
|
EntireScreen = 2,
|
|
16
|
-
/**
|
|
17
|
-
* Clears the entire screen and, on supported terminals (like XTerm and derivatives),
|
|
18
|
-
* also deletes all lines saved in the scrollback buffer.
|
|
19
|
-
* This corresponds to `Ps=3` in `CSI Ps J` (an XTerm extension, widely adopted).
|
|
20
|
-
* Sequence: `CSI 3J`.
|
|
21
|
-
* @remarks This mode is particularly useful for a more complete "reset" of the terminal view.
|
|
22
|
-
*/
|
|
23
3
|
EntireScreenAndScrollback = 3,
|
|
24
|
-
/**
|
|
25
|
-
* Clears from the beginning of the screen to the current cursor position (inclusive).
|
|
26
|
-
* This corresponds to `Ps=1` in `CSI Ps J`.
|
|
27
|
-
* Sequence: `CSI 1J`.
|
|
28
|
-
*/
|
|
29
4
|
ToBeginning = 1,
|
|
30
|
-
/**
|
|
31
|
-
* Clears from the current cursor position to the end of the screen (inclusive).
|
|
32
|
-
* If the cursor is at the top-left, this clears the entire screen.
|
|
33
|
-
* This corresponds to `Ps=0` (or `Ps` omitted) in `CSI Ps J`.
|
|
34
|
-
* Sequence: `CSI J` or `CSI 0J`.
|
|
35
|
-
*/
|
|
36
5
|
ToEnd = 0
|
|
37
6
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* The specific sequence is `CSI <mode>J`, where `<mode>` is a parameter from {@link EraseDisplayMode}.
|
|
41
|
-
*
|
|
42
|
-
* - If `mode` is `EraseDisplayMode.ToEnd` (or `0`), the sequence can be shortened to `CSI J`.
|
|
43
|
-
* - The function validates the input `mode`. If an invalid number is provided, it defaults to `EraseDisplayMode.ToEnd`.
|
|
44
|
-
* @param mode The erase mode, specified as a value from `EraseDisplayMode` or its corresponding number (0, 1, 2, 3).
|
|
45
|
-
* @returns The ANSI escape sequence string for erasing in display.
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* import { eraseDisplay, EraseDisplayMode } from '@visulima/ansi/erase';
|
|
49
|
-
*
|
|
50
|
-
* // Erase from cursor to end of screen
|
|
51
|
-
* process.stdout.write(eraseDisplay(EraseDisplayMode.ToEnd)); // or eraseDisplay(0)
|
|
52
|
-
*
|
|
53
|
-
* // Erase entire screen
|
|
54
|
-
* process.stdout.write(eraseDisplay(EraseDisplayMode.EntireScreen)); // or eraseDisplay(2)
|
|
55
|
-
*
|
|
56
|
-
* // Erase entire screen and scrollback buffer
|
|
57
|
-
* process.stdout.write(eraseDisplay(EraseDisplayMode.EntireScreenAndScrollback)); // or eraseDisplay(3)
|
|
58
|
-
* ```
|
|
59
|
-
* @see {@link EraseDisplayMode}
|
|
60
|
-
* @see {@link https://vt100.net/docs/vt510-rm/ED.html} VT510 Erase in Display (ED) documentation.
|
|
61
|
-
*/
|
|
62
|
-
export declare const eraseDisplay: (mode: EraseDisplayMode | 0 | 1 | 2 | 3) => string;
|
|
63
|
-
/**
|
|
64
|
-
* Defines the modes for erasing parts of the current line using the EL (Erase in Line) sequence.
|
|
65
|
-
* The EL sequence is `CSI Ps K`, where `Ps` is one of these mode values.
|
|
66
|
-
* The cursor position is NOT affected by EL sequences.
|
|
67
|
-
* @see {@link eraseInLine} for the function that generates EL sequences.
|
|
68
|
-
* @see {@link https://vt100.net/docs/vt510-rm/EL.html} VT510 Erase in Line (EL) documentation.
|
|
69
|
-
* @enum {number}
|
|
70
|
-
*/
|
|
71
|
-
export declare enum EraseLineMode {
|
|
72
|
-
/**
|
|
73
|
-
* Clears the entire current line.
|
|
74
|
-
* This corresponds to `Ps=2` in `CSI Ps K`.
|
|
75
|
-
* Sequence: `CSI 2K`.
|
|
76
|
-
*/
|
|
7
|
+
declare const eraseDisplay: (mode: EraseDisplayMode | 0 | 1 | 2 | 3) => string;
|
|
8
|
+
declare enum EraseLineMode {
|
|
77
9
|
EntireLine = 2,
|
|
78
|
-
/**
|
|
79
|
-
* Clears from the beginning of the line to the current cursor position (inclusive).
|
|
80
|
-
* This corresponds to `Ps=1` in `CSI Ps K`.
|
|
81
|
-
* Sequence: `CSI 1K`.
|
|
82
|
-
*/
|
|
83
10
|
ToBeginning = 1,
|
|
84
|
-
/**
|
|
85
|
-
* Clears from the current cursor position to the end of the line (inclusive).
|
|
86
|
-
* This corresponds to `Ps=0` (or `Ps` omitted) in `CSI Ps K`.
|
|
87
|
-
* Sequence: `CSI K` or `CSI 0K`.
|
|
88
|
-
*/
|
|
89
11
|
ToEnd = 0
|
|
90
12
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* import { eraseInLine, EraseLineMode } from '@visulima/ansi/erase';
|
|
103
|
-
*
|
|
104
|
-
* // Erase from cursor to end of line
|
|
105
|
-
* process.stdout.write(eraseInLine(EraseLineMode.ToEnd)); // or eraseInLine(0)
|
|
106
|
-
*
|
|
107
|
-
* // Erase entire current line
|
|
108
|
-
* process.stdout.write(eraseInLine(EraseLineMode.EntireLine)); // or eraseInLine(2)
|
|
109
|
-
* ```
|
|
110
|
-
* @see {@link EraseLineMode}
|
|
111
|
-
* @see {@link https://vt100.net/docs/vt510-rm/EL.html} VT510 Erase in Line (EL) documentation.
|
|
112
|
-
*/
|
|
113
|
-
export declare const eraseInLine: (mode: EraseLineMode | 0 | 1 | 2) => string;
|
|
114
|
-
/**
|
|
115
|
-
* Erases the screen from the current cursor position down to the bottom of the screen (inclusive).
|
|
116
|
-
* This is a convenience constant for `eraseDisplay(EraseDisplayMode.ToEnd)`.
|
|
117
|
-
* Sequence: `CSI J` (or `CSI 0J`).
|
|
118
|
-
* @returns The ANSI escape sequence `CSI J`.
|
|
119
|
-
* @see {@link eraseDisplay}
|
|
120
|
-
* @see {@link EraseDisplayMode.ToEnd}
|
|
121
|
-
*/
|
|
122
|
-
export declare const eraseDown: string;
|
|
123
|
-
/**
|
|
124
|
-
* Erases the entire current line. The cursor position does not change.
|
|
125
|
-
* This is a convenience constant for `eraseInLine(EraseLineMode.EntireLine)`.
|
|
126
|
-
* Sequence: `CSI 2K`.
|
|
127
|
-
* @returns The ANSI escape sequence `CSI 2K`.
|
|
128
|
-
* @see {@link eraseInLine}
|
|
129
|
-
* @see {@link EraseLineMode.EntireLine}
|
|
130
|
-
*/
|
|
131
|
-
export declare const eraseLine: string;
|
|
132
|
-
/**
|
|
133
|
-
* Erases from the current cursor position to the end of the current line (inclusive).
|
|
134
|
-
* The cursor position does not change.
|
|
135
|
-
* This is a convenience constant for `eraseInLine(EraseLineMode.ToEnd)`.
|
|
136
|
-
* Sequence: `CSI K` (or `CSI 0K`).
|
|
137
|
-
* @returns The ANSI escape sequence `CSI K`.
|
|
138
|
-
* @see {@link eraseInLine}
|
|
139
|
-
* @see {@link EraseLineMode.ToEnd}
|
|
140
|
-
*/
|
|
141
|
-
export declare const eraseLineEnd: string;
|
|
142
|
-
/**
|
|
143
|
-
* Erases from the current cursor position to the beginning of the current line (inclusive).
|
|
144
|
-
* The cursor position does not change.
|
|
145
|
-
* This is a convenience constant for `eraseInLine(EraseLineMode.ToBeginning)`.
|
|
146
|
-
* Sequence: `CSI 1K`.
|
|
147
|
-
* @returns The ANSI escape sequence `CSI 1K`.
|
|
148
|
-
* @see {@link eraseInLine}
|
|
149
|
-
* @see {@link EraseLineMode.ToBeginning}
|
|
150
|
-
*/
|
|
151
|
-
export declare const eraseLineStart: string;
|
|
152
|
-
/**
|
|
153
|
-
* Erases a specified number of lines, starting from the current line and moving upwards,
|
|
154
|
-
* then moves the cursor to the beginning of the topmost erased line (which becomes the new current line).
|
|
155
|
-
*
|
|
156
|
-
* This is a custom helper function, not a single standard ANSI/VT sequence. It combines
|
|
157
|
-
* multiple sequences: {@link eraseLine} to clear each line, {@link cursorUp} to move to the line above,
|
|
158
|
-
* and finally {@link cursorToColumn1} to position the cursor at the start of the resulting current line.
|
|
159
|
-
* @param count The total number of lines to erase. This includes the current line and `count-1` lines above it.
|
|
160
|
-
* If `count` is 0 or negative, an empty string is returned (no operation).
|
|
161
|
-
* @returns A string of concatenated ANSI escape sequences to perform the operation.
|
|
162
|
-
* @example
|
|
163
|
-
* ```typescript
|
|
164
|
-
* import { eraseLines } from '@visulima/ansi/erase';
|
|
165
|
-
*
|
|
166
|
-
* // To erase the current line and the 2 lines above it (total 3 lines):
|
|
167
|
-
* process.stdout.write(eraseLines(3));
|
|
168
|
-
* // Conceptual sequence of operations:
|
|
169
|
-
* // 1. Erase current line
|
|
170
|
-
* // 2. Cursor up
|
|
171
|
-
* // 3. Erase current line (which was the line above the original)
|
|
172
|
-
* // 4. Cursor up
|
|
173
|
-
* // 5. Erase current line (which was two lines above the original)
|
|
174
|
-
* // 6. Cursor to column 1 (on this topmost erased line)
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
export declare const eraseLines: (count: number) => string;
|
|
178
|
-
/**
|
|
179
|
-
* Erases the entire screen. The cursor position usually does not change, though this can be terminal-dependent.
|
|
180
|
-
* This is a convenience constant for `eraseDisplay(EraseDisplayMode.EntireScreen)`.
|
|
181
|
-
* Sequence: `CSI 2J`.
|
|
182
|
-
* @returns The ANSI escape sequence `CSI 2J`.
|
|
183
|
-
* @see {@link eraseDisplay}
|
|
184
|
-
* @see {@link EraseDisplayMode.EntireScreen}
|
|
185
|
-
*/
|
|
186
|
-
export declare const eraseScreen: string;
|
|
187
|
-
/**
|
|
188
|
-
* Erases the screen from the current cursor position up to the top of the screen (inclusive).
|
|
189
|
-
* This is a convenience constant for `eraseDisplay(EraseDisplayMode.ToBeginning)`.
|
|
190
|
-
* Sequence: `CSI 1J`.
|
|
191
|
-
* @returns The ANSI escape sequence `CSI 1J`.
|
|
192
|
-
* @see {@link eraseDisplay}
|
|
193
|
-
* @see {@link EraseDisplayMode.ToBeginning}
|
|
194
|
-
*/
|
|
195
|
-
export declare const eraseUp: string;
|
|
196
|
-
/**
|
|
197
|
-
* Erases the entire screen and, on supported terminals (like XTerm and derivatives),
|
|
198
|
-
* also deletes all lines saved in the scrollback buffer.
|
|
199
|
-
* This is a convenience constant for `eraseDisplay(EraseDisplayMode.EntireScreenAndScrollback)`.
|
|
200
|
-
* Sequence: `CSI 3J` (an XTerm extension, widely adopted).
|
|
201
|
-
* @returns The ANSI escape sequence `CSI 3J`.
|
|
202
|
-
* @remarks This mode is particularly useful for a more complete "reset" of the terminal view.
|
|
203
|
-
* @see {@link eraseDisplay}
|
|
204
|
-
* @see {@link EraseDisplayMode.EntireScreenAndScrollback}
|
|
205
|
-
*/
|
|
206
|
-
export declare const eraseScreenAndScrollback: string;
|
|
13
|
+
declare const eraseInLine: (mode: EraseLineMode | 0 | 1 | 2) => string;
|
|
14
|
+
declare const eraseDown: string;
|
|
15
|
+
declare const eraseLine: string;
|
|
16
|
+
declare const eraseLineEnd: string;
|
|
17
|
+
declare const eraseLineStart: string;
|
|
18
|
+
declare const eraseLines: (count: number) => string;
|
|
19
|
+
declare const eraseScreen: string;
|
|
20
|
+
declare const eraseUp: string;
|
|
21
|
+
declare const eraseScreenAndScrollback: string;
|
|
22
|
+
|
|
23
|
+
export { EraseDisplayMode, EraseLineMode, eraseDisplay, eraseDown, eraseInLine, eraseLine, eraseLineEnd, eraseLineStart, eraseLines, eraseScreen, eraseScreenAndScrollback, eraseUp };
|
package/dist/erase.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var s=(e,r)=>t(e,"name",{value:r,configurable:!0});import{C as c}from"./packem_shared/constants-D12jy2Zh.js";import{s as l,r as E}from"./packem_shared/cursor-D2UOfUc_.js";var S=Object.defineProperty,a=s((e,r)=>S(e,"name",{value:r,configurable:!0}),"o"),d=(e=>(e[e.EntireScreen=2]="EntireScreen",e[e.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",e[e.ToBeginning=1]="ToBeginning",e[e.ToEnd=0]="ToEnd",e))(d||{});const n=a(e=>{const r=e>=0&&e<=3?e:0;return`${c+(r===0?"":String(r))}J`},"eraseDisplay");var g=(e=>(e[e.EntireLine=2]="EntireLine",e[e.ToBeginning=1]="ToBeginning",e[e.ToEnd=0]="ToEnd",e))(g||{});const o=a(e=>{const r=e>=0&&e<=2?e:0;return`${c+(r===0?"":String(r))}K`},"eraseInLine"),f=n(0),u=o(2),m=o(0),b=o(1),v=a(e=>{if(e<=0)return"";let r="";for(let i=0;i<e;i+=1)r+=u,i<e-1&&(r+=l());return r+=E,r},"eraseLines"),y=n(2),B=n(1),D=n(3);export{d as EraseDisplayMode,g as EraseLineMode,n as eraseDisplay,f as eraseDown,o as eraseInLine,u as eraseLine,m as eraseLineEnd,b as eraseLineStart,v as eraseLines,y as eraseScreen,D as eraseScreenAndScrollback,B as eraseUp};
|
package/dist/hyperlink.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a clickable hyperlink in the terminal.
|
|
3
|
-
*
|
|
4
|
-
* This function constructs an ANSI escape sequence that, when printed to a compatible terminal,
|
|
5
|
-
* renders as a clickable link. The link's visible text and its target URL are specified
|
|
6
|
-
* by the `text` and `url` parameters, respectively.
|
|
7
|
-
*
|
|
8
|
-
* For information on terminal support for hyperlinks, see this
|
|
9
|
-
* [Gist by Egmont Kob](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
|
|
10
|
-
* To programmatically check for hyperlink support in the current environment,
|
|
11
|
-
* consider using a library like [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks).
|
|
12
|
-
* @param text The visible text of the link.
|
|
13
|
-
* @param url The URL the link should point to.
|
|
14
|
-
* @returns A string representing the ANSI escape sequence for the hyperlink.
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { hyperlink } from "@visulima/ansi/hyperlink"; // Adjust import path as needed
|
|
18
|
-
*
|
|
19
|
-
* const aLink = hyperlink("Visulima", "https://www.visulima.com");
|
|
20
|
-
* console.log(`Visit ${aLink} for more information.`);
|
|
21
|
-
* // In a supported terminal, this will output:
|
|
22
|
-
* // Visit Visulima for more information. (where "Visulima" is a clickable link)
|
|
23
|
-
* ```
|
|
24
|
-
* @see {@link https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda} for supported terminals.
|
|
25
|
-
*/
|
|
26
1
|
declare const hyperlink: (text: string, url: string) => string;
|
|
27
|
-
|
|
2
|
+
|
|
3
|
+
export { hyperlink as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var o=(e,a)=>n(e,"name",{value:a,configurable:!0});import{O as t,S as r,B as i}from"./packem_shared/constants-D12jy2Zh.js";var f=Object.defineProperty,p=o((e,a)=>f(e,"name",{value:a,configurable:!0}),"i");const u=p((e,a)=>[t,"8",r,r,a,i,e,t,"8",r,r,i].join(""),"hyperlink");export{u as default};
|
package/dist/image.d.ts
CHANGED
|
@@ -1,73 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export interface ImageOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The display height of the image. It can be specified as:
|
|
8
|
-
* - A number: Interpreted as the number of character cells (e.g., `10`).
|
|
9
|
-
* - A string with `px`: Interpreted as pixels (e.g., `"100px"`).
|
|
10
|
-
* - A string with `%`: Interpreted as a percentage of the terminal session's height (e.g., `"50%"`).
|
|
11
|
-
* - The string `"auto"`: The image's inherent height will be used, or the terminal will decide.
|
|
12
|
-
*/
|
|
1
|
+
import { LiteralUnion } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
interface ImageOptions {
|
|
13
4
|
readonly height?: LiteralUnion<"auto", number | string>;
|
|
14
|
-
/**
|
|
15
|
-
* Controls whether the image's aspect ratio is preserved when scaling.
|
|
16
|
-
* - If `true` (default), the aspect ratio is preserved.
|
|
17
|
-
* - If `false`, the image may be stretched to fit the specified width and height.
|
|
18
|
-
* Corresponds to the `preserveAspectRatio` argument in the iTerm2 sequence (`1` for true, `0` for false).
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
5
|
readonly preserveAspectRatio?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* The display width of the image. It can be specified as:
|
|
24
|
-
* - A number: Interpreted as the number of character cells (e.g., `20`).
|
|
25
|
-
* - A string with `px`: Interpreted as pixels (e.g., `"200px"`).
|
|
26
|
-
* - A string with `%`: Interpreted as a percentage of the terminal session's width (e.g., `"75%"`).
|
|
27
|
-
* - The string `"auto"`: The image's inherent width will be used, or the terminal will decide.
|
|
28
|
-
*/
|
|
29
6
|
readonly width?: LiteralUnion<"auto", number | string>;
|
|
30
7
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* that allows raw image data to be displayed directly in the terminal.
|
|
36
|
-
* @param data The raw image data as a `Uint8Array`. This data will be Base64 encoded.
|
|
37
|
-
* @param options Optional parameters to control how the image is displayed (e.g., width, height, aspect ratio).
|
|
38
|
-
* See {@link ImageOptions}.
|
|
39
|
-
* @returns A string containing the ANSI escape sequence for displaying the image in iTerm2.
|
|
40
|
-
* Returns an empty string if `data` is null or undefined, though TypeScript should prevent this.
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* import { image } from '@visulima/ansi/image'; // Adjust import path
|
|
44
|
-
* import { promises as fs } from 'fs';
|
|
45
|
-
*
|
|
46
|
-
* async function displayImage() {
|
|
47
|
-
* try {
|
|
48
|
-
* const imageData = await fs.readFile('path/to/your/image.png');
|
|
49
|
-
* const imageSequence = image(new Uint8Array(imageData), {
|
|
50
|
-
* width: 50, // 50 character cells wide
|
|
51
|
-
* height: "auto",
|
|
52
|
-
* preserveAspectRatio: true,
|
|
53
|
-
* });
|
|
54
|
-
* console.log(imageSequence);
|
|
55
|
-
* } catch (error) {
|
|
56
|
-
* console.error("Error reading or displaying image:", error);
|
|
57
|
-
* }
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* displayImage();
|
|
61
|
-
* ```
|
|
62
|
-
* @remarks
|
|
63
|
-
* - This sequence is specific to iTerm2 and may not work in other terminal emulators.
|
|
64
|
-
* - For Node.js environments, `Buffer.from(data).toString("base64")` is used for Base64 encoding.
|
|
65
|
-
* In browser environments, a polyfill or an alternative method for Base64 encoding `Uint8Array` would be necessary
|
|
66
|
-
* if `Buffer` is not available (e.g., `btoa(String.fromCharCode(...data))` after careful handling of binary data).
|
|
67
|
-
* - The `name` parameter (for filename) is not directly supported by this simplified helper but is part of the
|
|
68
|
-
* full iTerm2 inline image protocol. For more advanced features, consider using the more detailed iTerm2 sequence
|
|
69
|
-
* builders in `iterm2/` files.
|
|
70
|
-
* @see {@link https://iterm2.com/documentation-images.html} iTerm2 Inline Images Protocol.
|
|
71
|
-
* @see {@link ImageOptions}
|
|
72
|
-
*/
|
|
73
|
-
export declare const image: (data: Uint8Array, options?: ImageOptions) => string;
|
|
8
|
+
declare const image: (data: Uint8Array, options?: ImageOptions) => string;
|
|
9
|
+
|
|
10
|
+
export { image };
|
|
11
|
+
export type { ImageOptions };
|
package/dist/image.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var o=(r,e)=>n(r,"name",{value:e,configurable:!0});import{createRequire as a}from"node:module";import{O as l,B as p}from"./packem_shared/constants-D12jy2Zh.js";const c=a(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o(r=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,t]=i.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return i.getBuiltinModule(r)}return c(r)},"__cjs_getBuiltinModule"),{Buffer:f}=u("node:buffer");var d=Object.defineProperty,g=o((r,e)=>d(r,"name",{value:e,configurable:!0}),"i");const v=g((r,e={})=>{if(!r)return"";let t=`${l}1337;File=inline=1`;e.width!==void 0&&(t+=`;width=${e.width}`),e.height!==void 0&&(t+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(t+=";preserveAspectRatio=0");const s=f.from(r).toString("base64");return`${t}:${s}${p}`},"image");export{v as image};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export { default as
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
export { requestTermcap, requestTerminfo, XTGETTCAP, } from "./termcap.d.ts";
|
|
32
|
-
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST, } from "./title.d.ts";
|
|
33
|
-
export type { XTermWindowOp } from "./window-ops.d.ts";
|
|
34
|
-
export { deiconifyWindow, iconifyWindow, lowerWindow, maximizeWindow, moveWindow, raiseWindow, refreshWindow, reportWindowPosition, reportWindowState, requestCellSizePixels, requestTextAreaSizeChars, requestTextAreaSizePixels, resizeTextAreaChars, resizeTextAreaPixels, restoreMaximizedWindow, setPageSizeLines, xtermWindowOp, XTWINOPS, } from "./window-ops.d.ts";
|
|
35
|
-
export { keyModifierOptions, queryKeyModifierOptions, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, setModifyOtherKeys1, setModifyOtherKeys2, XTMODKEYS, XTQMODKEYS, } from "./xterm.d.ts";
|
|
1
|
+
export { ALT_SCREEN_OFF, ALT_SCREEN_ON, alternativeScreenOff, alternativeScreenOn } from './alternative-screen.js';
|
|
2
|
+
export { clearLineAndHomeCursor, clearScreenAndHomeCursor, clearScreenFromTopLeft, resetTerminal } from './clear.js';
|
|
3
|
+
export { CURSOR_BACKWARD_1, CURSOR_DOWN_1, CURSOR_FORWARD_1, CURSOR_UP_1, CursorStyle, REQUEST_CURSOR_POSITION, REQUEST_EXTENDED_CURSOR_POSITION, RESTORE_CURSOR_DEC, SAVE_CURSOR_DEC, cursorBackward, cursorBackwardTab, cursorDown, cursorForward, cursorHide, cursorHorizontalAbsolute, cursorHorizontalForwardTab, cursorLeft, cursorMove, cursorNextLine, cursorPosition, cursorPreviousLine, cursorRestore, cursorSave, cursorShow, cursorTo, cursorToColumn1, cursorUp, cursorVerticalAbsolute, eraseCharacter, setCursorStyle } from './cursor.js';
|
|
4
|
+
export { EraseDisplayMode, EraseLineMode, eraseDisplay, eraseDown, eraseInLine, eraseLine, eraseLineEnd, eraseLineStart, eraseLines, eraseScreen, eraseScreenAndScrollback, eraseUp } from './erase.js';
|
|
5
|
+
export { default as hyperlink } from './hyperlink.js';
|
|
6
|
+
export { ImageOptions, image } from './image.js';
|
|
7
|
+
export { IITerm2Payload, IT2_AUTO, ITerm2File, ITerm2FileEnd, ITerm2FilePart, ITerm2FileProperties, ITerm2MultipartFileStart, iTerm2, it2Cells, it2Percent, it2Pixels } from './iterm2.js';
|
|
8
|
+
export { AnsiMode, BDSM, BiDirectionalSupportMode, BracketedPasteMode, DECRPM, DECRQM, DecMode, DisableModifiersMode, IRM, InBandResizeMode, InsertReplaceMode, KAM, KeyboardActionMode, LNM, LightDarkMode, LineFeedNewLineMode, LocalEchoMode, Mode, ModeSetting, OriginMode, RM, RequestBiDirectionalSupportMode, RequestInBandResizeMode, RequestInsertReplaceMode, RequestKeyboardActionMode, RequestLineFeedNewLineMode, RequestLocalEchoMode, RequestSendReceiveMode, RequestUnicodeCoreMode, ResetBiDirectionalSupportMode, ResetInBandResizeMode, ResetInsertReplaceMode, ResetKeyboardActionMode, ResetLineFeedNewLineMode, ResetLocalEchoMode, ResetSendReceiveMode, ResetUnicodeCoreMode, SGRMouseMode, SM, SRM, SendFocusEventsMode, SendReceiveMode, SetBiDirectionalSupportMode, SetInBandResizeMode, SetInsertReplaceMode, SetKeyboardActionMode, SetLineFeedNewLineMode, SetLocalEchoMode, SetSendReceiveMode, SetUnicodeCoreMode, TextCursorEnableMode, UnicodeCoreMode, createAnsiMode, createDecMode, isModeNotRecognized, isModePermanentlyReset, isModePermanentlySet, isModeReset, isModeSet, reportMode, requestMode, resetMode, setMode } from './mode.js';
|
|
9
|
+
export { MouseButton, MouseButtonType, MouseModifiers, disableAnyEventMouse, disableButtonEventMouse, disableFocusTracking, disableNormalMouse, disableSgrMouse, disableX10Mouse, enableAnyEventMouse, enableButtonEventMouse, enableFocusTracking, enableNormalMouse, enableSgrMouse, enableX10Mouse, encodeMouseButtonByte, mouseSgrSequence, mouseX10Sequence } from './mouse.js';
|
|
10
|
+
export { SCREEN_MAX_LEN_DEFAULT, SCREEN_TYPICAL_LIMIT, screenPassthrough, tmuxPassthrough } from './passthrough.js';
|
|
11
|
+
export { RESET_INITIAL_STATE, RIS } from './reset.js';
|
|
12
|
+
export { clearTabStop, deleteCharacter, deleteLine, insertCharacter, insertLine, repeatPreviousCharacter, requestPresentationStateReport, setLeftRightMargins, setTopBottomMargins } from './screen.js';
|
|
13
|
+
export { SCROLL_DOWN_1, SCROLL_UP_1, scrollDown, scrollUp } from './scroll.js';
|
|
14
|
+
export { AnsiStatusReport, CPR, DA1, DA2, DA3, DECXCPR, DSR, DSR_KeyboardLanguageDEC, DSR_PrinterStatusDEC, DSR_TerminalStatus, DSR_UDKStatusDEC, DecStatusReport, LightDarkReport, RequestLightDarkReport, RequestNameVersion, StatusReport, XTVERSION, createAnsiStatusReport, createDecStatusReport, cursorPositionReport, deviceStatusReport, extendedCursorPositionReport, reportKeyboardLanguageDEC, reportPrimaryDeviceAttributes, reportPrinterNoPaperDEC, reportPrinterNotReadyDEC, reportPrinterReadyDEC, reportSecondaryDeviceAttributes, reportTerminalNotOK, reportTerminalOK, reportTertiaryDeviceAttributes, reportUDKLockedDEC, reportUDKUnlockedDEC, requestCursorPositionReport, requestExtendedCursorPositionReport, requestKeyboardLanguageDEC, requestPrimaryDeviceAttributes, requestPrimaryDeviceAttributesParam0, requestPrinterStatusDEC, requestSecondaryDeviceAttributes, requestSecondaryDeviceAttributesParam0, requestTerminalStatus, requestTertiaryDeviceAttributes, requestTertiaryDeviceAttributesParam0, requestUDKStatusDEC } from './status.js';
|
|
15
|
+
export { default as strip } from './strip.js';
|
|
16
|
+
export { XTGETTCAP, requestTermcap, requestTerminfo } from './termcap.js';
|
|
17
|
+
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST } from './title.js';
|
|
18
|
+
export { XTWINOPS, XTermWindowOp, deiconifyWindow, iconifyWindow, lowerWindow, maximizeWindow, moveWindow, raiseWindow, refreshWindow, reportWindowPosition, reportWindowState, requestCellSizePixels, requestTextAreaSizeChars, requestTextAreaSizePixels, resizeTextAreaChars, resizeTextAreaPixels, restoreMaximizedWindow, setPageSizeLines, xtermWindowOp } from './window-ops.js';
|
|
19
|
+
export { XTMODKEYS, XTQMODKEYS, keyModifierOptions, queryKeyModifierOptions, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, setModifyOtherKeys1, setModifyOtherKeys2 } from './xterm.js';
|
|
20
|
+
import 'type-fest';
|
|
21
|
+
|
|
22
|
+
declare const resetProgressBar: string;
|
|
23
|
+
declare const setProgressBar: (percentage: number) => string;
|
|
24
|
+
declare const setErrorProgressBar: (percentage: number) => string;
|
|
25
|
+
declare const setIndeterminateProgressBar: string;
|
|
26
|
+
declare const setWarningProgressBar: (percentage: number) => string;
|
|
27
|
+
|
|
28
|
+
declare const beep = "\u0007";
|
|
29
|
+
|
|
30
|
+
export { beep, resetProgressBar, setErrorProgressBar, setIndeterminateProgressBar, setProgressBar, setWarningProgressBar };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ALT_SCREEN_OFF as t,ALT_SCREEN_ON as s,alternativeScreenOff as i,alternativeScreenOn as a}from"./alternative-screen.js";import{clearLineAndHomeCursor as d,clearScreenAndHomeCursor as u,clearScreenFromTopLeft as c,resetTerminal as R}from"./clear.js";import{C as S,a as l,b as p,c as m,R as D,v as T,w as E,d as C,e as P,f as L,g as A,h as f,i as y,j as x,k as b,l as O,m as _,n as q,o as I,p as N,q as g,r as w,s as h,t as v,u as U}from"./packem_shared/cursor-D2UOfUc_.js";import{eraseDisplay as W,eraseDown as B,eraseInLine as F,eraseLine as z,eraseLineEnd as k,eraseLineStart as X,eraseLines as H,eraseScreen as Q,eraseScreenAndScrollback as V,eraseUp as Y}from"./erase.js";import{default as j}from"./hyperlink.js";import{image as Z}from"./image.js";import{IT2_AUTO as ee,it2Cells as re,it2Percent as oe,it2Pixels as te}from"./packem_shared/IT2_AUTO-BYrffRAq.js";import{iTerm2 as ie}from"./iterm2.js";import{ITerm2File as ne,ITerm2FileEnd as de,ITerm2FilePart as ue,ITerm2MultipartFileStart as ce}from"./packem_shared/ITerm2File-C88DBJC-.js";import{BDSM as Me,BiDirectionalSupportMode as Se,DECRPM as le,DECRQM as pe,DisableModifiersMode as me,IRM as De,InBandResizeMode as Te,InsertReplaceMode as Ee,KAM as Ce,KeyboardActionMode as Pe,LNM as Le,LightDarkMode as Ae,LineFeedNewLineMode as fe,LocalEchoMode as ye,OriginMode as xe,RM as be,RequestBiDirectionalSupportMode as Oe,RequestInBandResizeMode as _e,RequestInsertReplaceMode as qe,RequestKeyboardActionMode as Ie,RequestLineFeedNewLineMode as Ne,RequestLocalEchoMode as ge,RequestSendReceiveMode as we,RequestUnicodeCoreMode as he,ResetBiDirectionalSupportMode as ve,ResetInBandResizeMode as Ue,ResetInsertReplaceMode as Ke,ResetKeyboardActionMode as We,ResetLineFeedNewLineMode as Be,ResetLocalEchoMode as Fe,ResetSendReceiveMode as ze,ResetUnicodeCoreMode as ke,SGRMouseMode as Xe,SM as He,SRM as Qe,SendFocusEventsMode as Ve,SendReceiveMode as Ye,SetBiDirectionalSupportMode as Ge,SetInBandResizeMode as je,SetInsertReplaceMode as Je,SetKeyboardActionMode as Ze,SetLineFeedNewLineMode as $e,SetLocalEchoMode as er,SetSendReceiveMode as rr,SetUnicodeCoreMode as or,TextCursorEnableMode as tr,UnicodeCoreMode as sr,createAnsiMode as ir,createDecMode as ar,isModeNotRecognized as nr,isModePermanentlyReset as dr,isModePermanentlySet as ur,isModeReset as cr,isModeSet as Rr,reportMode as Mr,requestMode as Sr,resetMode as lr,setMode as pr}from"./mode.js";import{MouseButton as Dr,disableAnyEventMouse as Tr,disableButtonEventMouse as Er,disableFocusTracking as Cr,disableNormalMouse as Pr,disableSgrMouse as Lr,disableX10Mouse as Ar,enableAnyEventMouse as fr,enableButtonEventMouse as yr,enableFocusTracking as xr,enableNormalMouse as br,enableSgrMouse as Or,enableX10Mouse as _r,encodeMouseButtonByte as qr,mouseSgrSequence as Ir,mouseX10Sequence as Nr}from"./mouse.js";import{SCREEN_MAX_LEN_DEFAULT as wr,SCREEN_TYPICAL_LIMIT as hr,screenPassthrough as vr,tmuxPassthrough as Ur}from"./passthrough.js";import{resetProgressBar as Wr,setErrorProgressBar as Br,setIndeterminateProgressBar as Fr,setProgressBar as zr,setWarningProgressBar as kr}from"./packem_shared/resetProgressBar-BtBbpWCM.js";import{RESET_INITIAL_STATE as Hr,RIS as Qr}from"./reset.js";import{clearTabStop as Yr,deleteCharacter as Gr,deleteLine as jr,insertCharacter as Jr,insertLine as Zr,repeatPreviousCharacter as $r,requestPresentationStateReport as eo,setLeftRightMargins as ro,setTopBottomMargins as oo}from"./screen.js";import{SCROLL_DOWN_1 as so,SCROLL_UP_1 as io,scrollDown as ao,scrollUp as no}from"./scroll.js";import{CPR as co,DA1 as Ro,DA2 as Mo,DA3 as So,DECXCPR as lo,DSR as po,DSR_KeyboardLanguageDEC as mo,DSR_PrinterStatusDEC as Do,DSR_TerminalStatus as To,DSR_UDKStatusDEC as Eo,LightDarkReport as Co,RequestLightDarkReport as Po,RequestNameVersion as Lo,XTVERSION as Ao,createAnsiStatusReport as fo,createDecStatusReport as yo,cursorPositionReport as xo,deviceStatusReport as bo,extendedCursorPositionReport as Oo,reportKeyboardLanguageDEC as _o,reportPrimaryDeviceAttributes as qo,reportPrinterNoPaperDEC as Io,reportPrinterNotReadyDEC as No,reportPrinterReadyDEC as go,reportSecondaryDeviceAttributes as wo,reportTerminalNotOK as ho,reportTerminalOK as vo,reportTertiaryDeviceAttributes as Uo,reportUDKLockedDEC as Ko,reportUDKUnlockedDEC as Wo,requestCursorPositionReport as Bo,requestExtendedCursorPositionReport as Fo,requestKeyboardLanguageDEC as zo,requestPrimaryDeviceAttributes as ko,requestPrimaryDeviceAttributesParam0 as Xo,requestPrinterStatusDEC as Ho,requestSecondaryDeviceAttributes as Qo,requestSecondaryDeviceAttributesParam0 as Vo,requestTerminalStatus as Yo,requestTertiaryDeviceAttributes as Go,requestTertiaryDeviceAttributesParam0 as jo,requestUDKStatusDEC as Jo}from"./status.js";import{default as $o}from"./strip.js";import{XTGETTCAP as rt,requestTermcap as ot,requestTerminfo as tt}from"./termcap.js";import{decsin as it,decswt as at,setIconName as nt,setIconNameAndWindowTitle as dt,setIconNameAndWindowTitleWithST as ut,setIconNameWithST as ct,setWindowTitle as Rt,setWindowTitleWithST as Mt}from"./title.js";import{XTWINOPS as lt,deiconifyWindow as pt,iconifyWindow as mt,lowerWindow as Dt,maximizeWindow as Tt,moveWindow as Et,raiseWindow as Ct,refreshWindow as Pt,reportWindowPosition as Lt,reportWindowState as At,requestCellSizePixels as ft,requestTextAreaSizeChars as yt,requestTextAreaSizePixels as xt,resizeTextAreaChars as bt,resizeTextAreaPixels as Ot,restoreMaximizedWindow as _t,setPageSizeLines as qt,xtermWindowOp as It}from"./window-ops.js";import{XTMODKEYS as gt,XTQMODKEYS as wt,keyModifierOptions as ht,queryKeyModifierOptions as vt,queryModifyOtherKeys as Ut,resetKeyModifierOptions as Kt,resetModifyOtherKeys as Wt,setKeyModifierOptions as Bt,setModifyOtherKeys1 as Ft,setModifyOtherKeys2 as zt}from"./xterm.js";const e="\x07";export{t as ALT_SCREEN_OFF,s as ALT_SCREEN_ON,Me as BDSM,Se as BiDirectionalSupportMode,co as CPR,S as CURSOR_BACKWARD_1,l as CURSOR_DOWN_1,p as CURSOR_FORWARD_1,m as CURSOR_UP_1,Ro as DA1,Mo as DA2,So as DA3,le as DECRPM,pe as DECRQM,lo as DECXCPR,po as DSR,mo as DSR_KeyboardLanguageDEC,Do as DSR_PrinterStatusDEC,To as DSR_TerminalStatus,Eo as DSR_UDKStatusDEC,me as DisableModifiersMode,De as IRM,ee as IT2_AUTO,ne as ITerm2File,de as ITerm2FileEnd,ue as ITerm2FilePart,ce as ITerm2MultipartFileStart,Te as InBandResizeMode,Ee as InsertReplaceMode,Ce as KAM,Pe as KeyboardActionMode,Le as LNM,Ae as LightDarkMode,Co as LightDarkReport,fe as LineFeedNewLineMode,ye as LocalEchoMode,Dr as MouseButton,xe as OriginMode,D as REQUEST_CURSOR_POSITION,T as REQUEST_EXTENDED_CURSOR_POSITION,Hr as RESET_INITIAL_STATE,E as RESTORE_CURSOR_DEC,Qr as RIS,be as RM,Oe as RequestBiDirectionalSupportMode,_e as RequestInBandResizeMode,qe as RequestInsertReplaceMode,Ie as RequestKeyboardActionMode,Po as RequestLightDarkReport,Ne as RequestLineFeedNewLineMode,ge as RequestLocalEchoMode,Lo as RequestNameVersion,we as RequestSendReceiveMode,he as RequestUnicodeCoreMode,ve as ResetBiDirectionalSupportMode,Ue as ResetInBandResizeMode,Ke as ResetInsertReplaceMode,We as ResetKeyboardActionMode,Be as ResetLineFeedNewLineMode,Fe as ResetLocalEchoMode,ze as ResetSendReceiveMode,ke as ResetUnicodeCoreMode,wr as SCREEN_MAX_LEN_DEFAULT,hr as SCREEN_TYPICAL_LIMIT,so as SCROLL_DOWN_1,io as SCROLL_UP_1,Xe as SGRMouseMode,He as SM,Qe as SRM,Ve as SendFocusEventsMode,Ye as SendReceiveMode,Ge as SetBiDirectionalSupportMode,je as SetInBandResizeMode,Je as SetInsertReplaceMode,Ze as SetKeyboardActionMode,$e as SetLineFeedNewLineMode,er as SetLocalEchoMode,rr as SetSendReceiveMode,or as SetUnicodeCoreMode,tr as TextCursorEnableMode,sr as UnicodeCoreMode,rt as XTGETTCAP,gt as XTMODKEYS,wt as XTQMODKEYS,Ao as XTVERSION,lt as XTWINOPS,i as alternativeScreenOff,a as alternativeScreenOn,e as beep,d as clearLineAndHomeCursor,u as clearScreenAndHomeCursor,c as clearScreenFromTopLeft,Yr as clearTabStop,ir as createAnsiMode,fo as createAnsiStatusReport,ar as createDecMode,yo as createDecStatusReport,C as cursorBackward,P as cursorBackwardTab,L as cursorDown,A as cursorForward,f as cursorHide,y as cursorHorizontalAbsolute,x as cursorHorizontalForwardTab,b as cursorLeft,O as cursorMove,_ as cursorNextLine,q as cursorPosition,xo as cursorPositionReport,I as cursorPreviousLine,N as cursorRestore,g as cursorTo,w as cursorToColumn1,h as cursorUp,v as cursorVerticalAbsolute,it as decsin,at as decswt,pt as deiconifyWindow,Gr as deleteCharacter,jr as deleteLine,bo as deviceStatusReport,Tr as disableAnyEventMouse,Er as disableButtonEventMouse,Cr as disableFocusTracking,Pr as disableNormalMouse,Lr as disableSgrMouse,Ar as disableX10Mouse,fr as enableAnyEventMouse,yr as enableButtonEventMouse,xr as enableFocusTracking,br as enableNormalMouse,Or as enableSgrMouse,_r as enableX10Mouse,qr as encodeMouseButtonByte,U as eraseCharacter,W as eraseDisplay,B as eraseDown,F as eraseInLine,z as eraseLine,k as eraseLineEnd,X as eraseLineStart,H as eraseLines,Q as eraseScreen,V as eraseScreenAndScrollback,Y as eraseUp,Oo as extendedCursorPositionReport,j as hyperlink,ie as iTerm2,mt as iconifyWindow,Z as image,Jr as insertCharacter,Zr as insertLine,nr as isModeNotRecognized,dr as isModePermanentlyReset,ur as isModePermanentlySet,cr as isModeReset,Rr as isModeSet,re as it2Cells,oe as it2Percent,te as it2Pixels,ht as keyModifierOptions,Dt as lowerWindow,Tt as maximizeWindow,Ir as mouseSgrSequence,Nr as mouseX10Sequence,Et as moveWindow,vt as queryKeyModifierOptions,Ut as queryModifyOtherKeys,Ct as raiseWindow,Pt as refreshWindow,$r as repeatPreviousCharacter,_o as reportKeyboardLanguageDEC,Mr as reportMode,qo as reportPrimaryDeviceAttributes,Io as reportPrinterNoPaperDEC,No as reportPrinterNotReadyDEC,go as reportPrinterReadyDEC,wo as reportSecondaryDeviceAttributes,ho as reportTerminalNotOK,vo as reportTerminalOK,Uo as reportTertiaryDeviceAttributes,Ko as reportUDKLockedDEC,Wo as reportUDKUnlockedDEC,Lt as reportWindowPosition,At as reportWindowState,ft as requestCellSizePixels,Bo as requestCursorPositionReport,Fo as requestExtendedCursorPositionReport,zo as requestKeyboardLanguageDEC,Sr as requestMode,eo as requestPresentationStateReport,ko as requestPrimaryDeviceAttributes,Xo as requestPrimaryDeviceAttributesParam0,Ho as requestPrinterStatusDEC,Qo as requestSecondaryDeviceAttributes,Vo as requestSecondaryDeviceAttributesParam0,ot as requestTermcap,Yo as requestTerminalStatus,tt as requestTerminfo,Go as requestTertiaryDeviceAttributes,jo as requestTertiaryDeviceAttributesParam0,yt as requestTextAreaSizeChars,xt as requestTextAreaSizePixels,Jo as requestUDKStatusDEC,Kt as resetKeyModifierOptions,lr as resetMode,Wt as resetModifyOtherKeys,Wr as resetProgressBar,R as resetTerminal,bt as resizeTextAreaChars,Ot as resizeTextAreaPixels,_t as restoreMaximizedWindow,vr as screenPassthrough,ao as scrollDown,no as scrollUp,Br as setErrorProgressBar,nt as setIconName,dt as setIconNameAndWindowTitle,ut as setIconNameAndWindowTitleWithST,ct as setIconNameWithST,Fr as setIndeterminateProgressBar,Bt as setKeyModifierOptions,ro as setLeftRightMargins,pr as setMode,Ft as setModifyOtherKeys1,zt as setModifyOtherKeys2,qt as setPageSizeLines,zr as setProgressBar,oo as setTopBottomMargins,kr as setWarningProgressBar,Rt as setWindowTitle,Mt as setWindowTitleWithST,$o as strip,Ur as tmuxPassthrough,It as xtermWindowOp};
|
package/dist/iterm2.d.ts
CHANGED
|
@@ -1,58 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* console.log(imageSequence);
|
|
45
|
-
* // Expected output (simplified, actual base64 will be longer):
|
|
46
|
-
* // OSC1337;File=name=bXlfaW1hZ2UucG5n;inline=1;width=50%;height=auto:ZHVtbXlpbWFnZWNvbnRlbnQ=BEL
|
|
47
|
-
* // Note: if ignoreAspectRatio was true, preserveAspectRatio=0 would be in the sequence.
|
|
48
|
-
*
|
|
49
|
-
* // Example 2: A hypothetical simple command (e.g., shell integration handshake)
|
|
50
|
-
* const shellIntegrationPayload: IITerm2Payload = {
|
|
51
|
-
* toString: () => "ShellIntegrationVersion=15;Shell=zsh"
|
|
52
|
-
* };
|
|
53
|
-
* const shellSequence = iTerm2(shellIntegrationPayload);
|
|
54
|
-
* console.log(shellSequence);
|
|
55
|
-
* // Output: OSC1337;ShellIntegrationVersion=15;Shell=zshBEL
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const iTerm2: (payload: IITerm2Payload) => string;
|
|
1
|
+
import { LiteralUnion } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
declare const IT2_AUTO: string;
|
|
4
|
+
declare const it2Cells: (n: number) => string;
|
|
5
|
+
declare const it2Pixels: (n: number) => string;
|
|
6
|
+
declare const it2Percent: (n: number) => string;
|
|
7
|
+
interface IITerm2Payload {
|
|
8
|
+
toString: () => string;
|
|
9
|
+
}
|
|
10
|
+
interface ITerm2FileProperties {
|
|
11
|
+
content?: string;
|
|
12
|
+
doNotMoveCursor?: boolean;
|
|
13
|
+
height?: LiteralUnion<typeof IT2_AUTO, number | string>;
|
|
14
|
+
ignoreAspectRatio?: boolean;
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
width?: LiteralUnion<typeof IT2_AUTO, number | string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class ITerm2File implements IITerm2Payload {
|
|
22
|
+
private readonly fileProps;
|
|
23
|
+
constructor(properties: ITerm2FileProperties, fileData?: Uint8Array);
|
|
24
|
+
toString(): string;
|
|
25
|
+
}
|
|
26
|
+
declare class ITerm2FileEnd implements IITerm2Payload {
|
|
27
|
+
toString(): string;
|
|
28
|
+
}
|
|
29
|
+
declare class ITerm2FilePart implements IITerm2Payload {
|
|
30
|
+
private readonly base64Chunk;
|
|
31
|
+
constructor(base64Chunk: string);
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|
|
34
|
+
declare class ITerm2MultipartFileStart implements IITerm2Payload {
|
|
35
|
+
private readonly properties;
|
|
36
|
+
constructor(properties: Omit<ITerm2FileProperties, "content">);
|
|
37
|
+
toString(): string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare const iTerm2: (payload: IITerm2Payload) => string;
|
|
41
|
+
|
|
42
|
+
export { IT2_AUTO, ITerm2File, ITerm2FileEnd, ITerm2FilePart, ITerm2MultipartFileStart, iTerm2, it2Cells, it2Percent, it2Pixels };
|
|
43
|
+
export type { IITerm2Payload, ITerm2FileProperties };
|
package/dist/iterm2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});import{O as i,B as m}from"./packem_shared/constants-D12jy2Zh.js";import{IT2_AUTO as I,it2Cells as c,it2Percent as s,it2Pixels as S}from"./packem_shared/IT2_AUTO-BYrffRAq.js";import{ITerm2File as g,ITerm2FileEnd as y,ITerm2FilePart as O,ITerm2MultipartFileStart as P}from"./packem_shared/ITerm2File-C88DBJC-.js";var n=Object.defineProperty,a=r((t,e)=>n(t,"name",{value:e,configurable:!0}),"t");const T=a(t=>{if(!t||typeof t.toString!="function"||t.toString===Object.prototype.toString)throw new Error("Invalid payload: must implement IITerm2Payload with a custom toString method");return`${i}1337;${t.toString()}${m}`},"iTerm2");export{I as IT2_AUTO,g as ITerm2File,y as ITerm2FileEnd,O as ITerm2FilePart,P as ITerm2MultipartFileStart,T as iTerm2,c as it2Cells,s as it2Percent,S as it2Pixels};
|