@visulima/ansi 4.0.0-alpha.2 → 4.0.0-alpha.3

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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/alternative-screen.d.ts +74 -0
  3. package/dist/alternative-screen.js +1 -0
  4. package/dist/clear.d.ts +77 -0
  5. package/dist/clear.js +1 -0
  6. package/dist/constants.d.ts +20 -0
  7. package/dist/cursor.d.ts +437 -0
  8. package/dist/cursor.js +1 -0
  9. package/dist/erase.d.ts +206 -0
  10. package/dist/erase.js +1 -0
  11. package/dist/helpers.d.ts +14 -0
  12. package/dist/hyperlink.d.ts +27 -0
  13. package/dist/hyperlink.js +1 -0
  14. package/dist/image.d.ts +73 -0
  15. package/dist/image.js +1 -0
  16. package/dist/index.d.ts +36 -0
  17. package/dist/index.js +1 -0
  18. package/dist/iterm2/iterm2-properties.d.ts +135 -0
  19. package/dist/iterm2/iterm2-sequences.d.ts +96 -0
  20. package/dist/iterm2.d.ts +58 -0
  21. package/dist/iterm2.js +1 -0
  22. package/dist/mode.d.ts +726 -0
  23. package/dist/mode.js +1 -0
  24. package/dist/mouse.d.ts +230 -0
  25. package/dist/mouse.js +1 -0
  26. package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +1 -0
  27. package/dist/packem_shared/ITerm2File-C88DBJC-.js +1 -0
  28. package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
  29. package/dist/packem_shared/cursor-nxpKt8Tn.js +1 -0
  30. package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +1 -0
  31. package/dist/packem_shared/restoreCursor-CHy0jZuu.js +2 -0
  32. package/dist/passthrough.d.ts +77 -0
  33. package/dist/passthrough.js +1 -0
  34. package/dist/progress.d.ts +41 -0
  35. package/dist/reset.d.ts +26 -0
  36. package/dist/reset.js +1 -0
  37. package/dist/screen.d.ts +234 -0
  38. package/dist/screen.js +1 -0
  39. package/dist/scroll.d.ts +67 -0
  40. package/dist/scroll.js +1 -0
  41. package/dist/status.d.ts +524 -0
  42. package/dist/status.js +1 -0
  43. package/dist/strip.d.ts +23 -0
  44. package/dist/strip.js +1 -0
  45. package/dist/termcap.d.ts +38 -0
  46. package/dist/termcap.js +1 -0
  47. package/dist/title.d.ts +185 -0
  48. package/dist/title.js +1 -0
  49. package/dist/window-ops.d.ts +418 -0
  50. package/dist/window-ops.js +1 -0
  51. package/dist/xterm.d.ts +94 -0
  52. package/dist/xterm.js +1 -0
  53. package/package.json +1 -46
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Sets the icon name and window title using an OSC (Operating System Command) sequence.
3
+ * This typically affects the title shown in the window's title bar and the name used for the icon
4
+ * when the window is minimized or in a taskbar.
5
+ *
6
+ * Uses the sequence: `OSC 0 ; title BEL`
7
+ * - `OSC`: Operating System Command (`\x1b]`).
8
+ * - `0`: Parameter indicating to set both icon name and window title.
9
+ * - `title`: The string to set.
10
+ * - `BEL`: Bell character (`\x07`) as terminator.
11
+ * @param title The string to be set as both the icon name and the window title.
12
+ * @returns The ANSI escape sequence for setting the icon name and window title.
13
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
14
+ * @example
15
+ * ```typescript
16
+ * import { setIconNameAndWindowTitle } from "@visulima/ansi";
17
+ *
18
+ * process.stdout.write(setIconNameAndWindowTitle("My Application"));
19
+ * // Sends: "\x1b]0;My Application\x07"
20
+ * ```
21
+ */
22
+ export declare const setIconNameAndWindowTitle: (title: string) => string;
23
+ /**
24
+ * Sets the icon name using an OSC (Operating System Command) sequence.
25
+ * This affects the name used for the icon when the window is minimized or in a taskbar.
26
+ *
27
+ * Uses the sequence: `OSC 1 ; iconName BEL`
28
+ * - `OSC`: Operating System Command (`\x1b]`).
29
+ * - `1`: Parameter indicating to set only the icon name.
30
+ * - `iconName`: The string to set as the icon name.
31
+ * - `BEL`: Bell character (`\x07`) as terminator.
32
+ * @param iconName The string to be set as the icon name.
33
+ * @returns The ANSI escape sequence for setting the icon name.
34
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
35
+ * @example
36
+ * ```typescript
37
+ * import { setIconName } from "@visulima/ansi";
38
+ *
39
+ * process.stdout.write(setIconName("AppIcon"));
40
+ * // Sends: "\x1b]1;AppIcon\x07"
41
+ * ```
42
+ */
43
+ export declare const setIconName: (iconName: string) => string;
44
+ /**
45
+ * Sets the window title using an OSC (Operating System Command) sequence.
46
+ * This affects the title shown in the window's title bar.
47
+ *
48
+ * Uses the sequence: `OSC 2 ; title BEL`
49
+ * - `OSC`: Operating System Command (`\x1b]`).
50
+ * - `2`: Parameter indicating to set only the window title.
51
+ * - `title`: The string to set as the window title.
52
+ * - `BEL`: Bell character (`\x07`) as terminator.
53
+ * @param title The string to be set as the window title.
54
+ * @returns The ANSI escape sequence for setting the window title.
55
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
56
+ * @example
57
+ * ```typescript
58
+ * import { setWindowTitle } from "@visulima/ansi";
59
+ *
60
+ * process.stdout.write(setWindowTitle("Current Document - Editor"));
61
+ * // Sends: "\x1b]2;Current Document - Editor\x07"
62
+ * ```
63
+ */
64
+ export declare const setWindowTitle: (title: string) => string;
65
+ /**
66
+ * Sets a DEC Special Window Title (DECSWT) using an OSC sequence.
67
+ * The original Go library implemented this by prepending "1;" to the title and using `setWindowTitle`,
68
+ * resulting in an `OSC 2 ; 1;<title> BEL` sequence.
69
+ * This differs from some interpretations where DECSWT might use `OSC 1`.
70
+ * This implementation replicates the Go library's specific behavior.
71
+ *
72
+ * Note: DECSWT (`OSC 2;1;...BEL`) was introduced in the DEC VT520/VT525 family
73
+ * and is ignored by earlier DEC terminals. Support varies across modern emulators;
74
+ * for example, Zutty 0.6+ claims VT520 compatibility, but many others that handle
75
+ * common OSC sequences may drop or ignore DECSWT.
76
+ * If relying on this sequence, testing on actual VT520 hardware or emulators
77
+ * with known VT520 support is recommended. Unsupported sequences are typically
78
+ * silently ignored by most terminals.
79
+ *
80
+ * Uses the sequence: `OSC 2 ; 1;<title> BEL` (based on Go library's behavior)
81
+ * @param title The title string.
82
+ * @returns The ANSI escape sequence for DECSWT (as implemented).
83
+ * @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
84
+ * @see setWindowTitle
85
+ * @example
86
+ * ```typescript
87
+ * import { decswt } from "@visulima/ansi";
88
+ *
89
+ * process.stdout.write(decswt("My Special Window"));
90
+ * // Sends: "\\x1b]2;1;My Special Window\\x07"
91
+ * ```
92
+ */
93
+ export declare const decswt: (title: string) => string;
94
+ /**
95
+ * Sets a DEC Special Icon Name (DECSIN) using an OSC sequence.
96
+ * The original Go library implemented this by prepending "L;" to the name and using `setWindowTitle`,
97
+ * resulting in an `OSC 2 ; L;<name> BEL` sequence.
98
+ * This differs from some interpretations where DECSIN might use `OSC L` or `OSC 1`.
99
+ * This implementation replicates the Go library's specific behavior.
100
+ *
101
+ * Note: DECSIN (`OSC 2;L;...BEL`) was introduced in the DEC VT520/VT525 family
102
+ * and is ignored by earlier DEC terminals. Support varies across modern emulators;
103
+ * for example, Zutty 0.6+ claims VT520 compatibility, but many others that handle
104
+ * common OSC sequences may drop or ignore DECSIN.
105
+ * If relying on this sequence, testing on actual VT520 hardware or emulators
106
+ * with known VT520 support is recommended. Unsupported sequences are typically
107
+ * silently ignored by most terminals.
108
+ *
109
+ * Uses the sequence: `OSC 2 ; L;<name> BEL` (based on Go library's behavior)
110
+ * @param name The name or content for the DEC-style icon name.
111
+ * @returns The ANSI escape sequence for DECSIN (as implemented).
112
+ * @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
113
+ * @see setWindowTitle
114
+ * @example
115
+ * ```typescript
116
+ * import { decsin } from "@visulima/ansi";
117
+ *
118
+ * process.stdout.write(decsin("SpecialIcon"));
119
+ * // Sends: "\\x1b]2;L;SpecialIcon\\x07"
120
+ * ```
121
+ */
122
+ export declare const decsin: (name: string) => string;
123
+ /**
124
+ * Sets the icon name and window title using an OSC sequence, terminated with ST (String Terminator).
125
+ * This is an alternative to the BEL-terminated version.
126
+ *
127
+ * Uses the sequence: `OSC 0 ; title ST`
128
+ * - `OSC`: Operating System Command (`\x1b]`).
129
+ * - `0`: Parameter indicating to set both icon name and window title.
130
+ * - `title`: The string to set.
131
+ * - `ST`: String Terminator (`\x1b\\`).
132
+ * @param title The string to be set as both the icon name and the window title.
133
+ * @returns The ANSI escape sequence for setting the icon name and window title, using ST.
134
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
135
+ * @example
136
+ * ```typescript
137
+ * import { setIconNameAndWindowTitleWithST } from "@visulima/ansi";
138
+ *
139
+ * process.stdout.write(setIconNameAndWindowTitleWithST("My App ST"));
140
+ * // Sends: "\x1b]0;My App ST\x1b\\"
141
+ * ```
142
+ */
143
+ export declare const setIconNameAndWindowTitleWithST: (title: string) => string;
144
+ /**
145
+ * Sets the icon name using an OSC sequence, terminated with ST (String Terminator).
146
+ * This is an alternative to the BEL-terminated version.
147
+ *
148
+ * Uses the sequence: `OSC 1 ; iconName ST`
149
+ * - `OSC`: Operating System Command (`\x1b]`).
150
+ * - `1`: Parameter indicating to set only the icon name.
151
+ * - `iconName`: The string to set as the icon name.
152
+ * - `ST`: String Terminator (`\x1b\\`).
153
+ * @param iconName The string to be set as the icon name.
154
+ * @returns The ANSI escape sequence for setting the icon name, using ST.
155
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
156
+ * @example
157
+ * ```typescript
158
+ * import { setIconNameWithST } from "@visulima/ansi";
159
+ *
160
+ * process.stdout.write(setIconNameWithST("AppIcon ST"));
161
+ * // Sends: "\x1b]1;AppIcon ST\x1b\\"
162
+ * ```
163
+ */
164
+ export declare const setIconNameWithST: (iconName: string) => string;
165
+ /**
166
+ * Sets the window title using an OSC sequence, terminated with ST (String Terminator).
167
+ * This is an alternative to the BEL-terminated version.
168
+ *
169
+ * Uses the sequence: `OSC 2 ; title ST`
170
+ * - `OSC`: Operating System Command (`\x1b]`).
171
+ * - `2`: Parameter indicating to set only the window title.
172
+ * - `title`: The string to set as the window title.
173
+ * - `ST`: String Terminator (`\x1b\\`).
174
+ * @param title The string to be set as the window title.
175
+ * @returns The ANSI escape sequence for setting the window title, using ST.
176
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
177
+ * @example
178
+ * ```typescript
179
+ * import { setWindowTitleWithST } from "@visulima/ansi";
180
+ *
181
+ * process.stdout.write(setWindowTitleWithST("Document ST - Editor"));
182
+ * // Sends: "\x1b]2;Document ST - Editor\x1b\\"
183
+ * ```
184
+ */
185
+ export declare const setWindowTitleWithST: (title: string) => string;
package/dist/title.js ADDED
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var a=(e,n)=>d(e,"name",{value:n,configurable:!0});import{O as i,B as o,a as s}from"./packem_shared/constants-D12jy2Zh.js";var r=Object.defineProperty,t=a((e,n)=>r(e,"name",{value:n,configurable:!0}),"n");const T=t(e=>{if(typeof e!="string")throw new TypeError("Title must be a string");return e.replaceAll(/[\u0007\u001B]/g,"")},"validateTitle"),W=t(e=>`${i}0;${T(e)}${o}`,"setIconNameAndWindowTitle"),m=t(e=>`${i}1;${e}${o}`,"setIconName"),$=t(e=>`${i}2;${e}${o}`,"setWindowTitle"),w=t(e=>$(`1;${e}`),"decswt"),I=t(e=>$(`L;${e}`),"decsin"),N=t(e=>`${i}0;${e}${s}`,"setIconNameAndWindowTitleWithST"),S=t(e=>`${i}1;${e}${s}`,"setIconNameWithST"),h=t(e=>`${i}2;${e}${s}`,"setWindowTitleWithST");export{I as decsin,w as decswt,m as setIconName,W as setIconNameAndWindowTitle,N as setIconNameAndWindowTitleWithST,S as setIconNameWithST,$ as setWindowTitle,h as setWindowTitleWithST};
@@ -0,0 +1,418 @@
1
+ /**
2
+ * Enum for XTerm Window Operations (XTWINOPS).
3
+ * These are parameters for the `CSI Ps ; Ps ; Ps t` sequence.
4
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps;Ps;Ps-t.1EB0}
5
+ */
6
+ export declare enum XTermWindowOp {
7
+ /**
8
+ * De-iconify window.
9
+ */
10
+ DEICONIFY_WINDOW = 1,
11
+ /**
12
+ * Iconify window.
13
+ */
14
+ ICONIFY_WINDOW = 2,
15
+ /**
16
+ * Lower the window to the bottom of the stacking order.
17
+ */
18
+ LOWER_WINDOW = 6,
19
+ /**
20
+ * Maximize window (i.e., "zoom" or "toggle").
21
+ */
22
+ MAXIMIZE_WINDOW = 10,
23
+ /**
24
+ * Maximize window horizontally.
25
+ */
26
+ MAXIMIZE_WINDOW_HORIZONTALLY = 10.2,
27
+ /**
28
+ * Maximize window vertically.
29
+ */
30
+ MAXIMIZE_WINDOW_VERTICALLY = 10.1,
31
+ /**
32
+ * Move window to `[x, y]`.
33
+ */
34
+ MOVE_WINDOW = 3,
35
+ /**
36
+ * Pop window title from stack.
37
+ */
38
+ POP_WINDOW_TITLE = 23,
39
+ /**
40
+ * Push window title on stack.
41
+ */
42
+ PUSH_WINDOW_TITLE = 22,
43
+ /**
44
+ * Raise the window to the front of the stacking order.
45
+ */
46
+ RAISE_WINDOW = 5,
47
+ /**
48
+ * Refresh the window.
49
+ */
50
+ REFRESH_WINDOW = 7,
51
+ /**
52
+ * Report cell size in pixels.
53
+ * Response: `CSI 6 ; height ; width t`
54
+ */
55
+ REPORT_CELL_SIZE_PIXELS = 16,// From Go code
56
+ /**
57
+ * Report icon label.
58
+ * Response: `OSC L label ST`
59
+ */
60
+ REPORT_ICON_LABEL = 19,
61
+ /**
62
+ * Report text area size in characters.
63
+ * Response: `CSI 4 ; height ; width t`
64
+ */
65
+ REPORT_TEXT_AREA_SIZE_CHARS = 14,
66
+ /**
67
+ * Report text area size in pixels.
68
+ * Response: `CSI 8 ; height ; width t`
69
+ */
70
+ REPORT_TEXT_AREA_SIZE_PIXELS = 18,
71
+ /**
72
+ * Report window position.
73
+ * Response: `CSI 3 ; x ; y t`
74
+ */
75
+ REPORT_WINDOW_POSITION = 13,
76
+ /**
77
+ * Report window state.
78
+ * Response: `CSI code t` where `code` is 1 if de-iconified, 2 if iconified.
79
+ */
80
+ REPORT_WINDOW_STATE = 11,
81
+ /**
82
+ * Report window title.
83
+ * Response: `OSC l label ST`
84
+ */
85
+ REPORT_WINDOW_TITLE = 21,
86
+ /**
87
+ * Report window size in pixels.
88
+ * Alias for `REPORT_TEXT_AREA_SIZE_PIXELS` for compatibility with some terminals (e.g., mintty).
89
+ * Response: `CSI 4 ; height ; width t`
90
+ * Should be REPORT_TEXT_AREA_SIZE_PIXELS (18) for XTerm, but using Go's value.
91
+ */
92
+ REQUEST_WINDOW_SIZE_WIN_OP_COMPAT = 14,// From Go code
93
+ /**
94
+ * Resize the screen to `[width, height]` in pixels and resize the text area to `[cols, lines]` in characters.
95
+ * (DECSLPP - Set Lines Per Page)
96
+ */
97
+ RESIZE_SCREEN_AND_TEXT_AREA = 24,// Typically with one param (lines), but XTerm extends it for width/height too
98
+ /**
99
+ * Resize the text area to `[height, width]` in characters.
100
+ */
101
+ RESIZE_TEXT_AREA_CHARS = 4,
102
+ /**
103
+ * Resize the text area to `[height, width]` in pixels.
104
+ */
105
+ RESIZE_TEXT_AREA_PIXELS = 8,
106
+ /**
107
+ * Restore maximized window.
108
+ */
109
+ RESTORE_MAXIMIZED_WINDOW = 9,
110
+ /**
111
+ * Undo full-screen mode.
112
+ */
113
+ UNDO_FULL_SCREEN_MODE = 10.3
114
+ }
115
+ /**
116
+ * Generates an XTerm Window Operation (XTWINOPS) sequence.
117
+ *
118
+ * `CSI Ps ; Ps ; Ps t`
119
+ * @param p The primary parameter, typically one of {@link XTermWindowOp}.
120
+ * @param ps Additional parameters.
121
+ * @returns The ANSI sequence string, or an empty string if `p` is invalid.
122
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps;Ps;Ps-t.1EB0}
123
+ */
124
+ export declare const xtermWindowOp: (p: number, ...ps: number[]) => string;
125
+ /**
126
+ * Alias for {@link xtermWindowOp}.
127
+ */
128
+ export declare const XTWINOPS: (p: number, ...ps: number[]) => string;
129
+ /**
130
+ * Resizes the terminal window's text area to a specified height and width in characters.
131
+ * This effectively sets the number of rows and columns for text display.
132
+ *
133
+ * Sequence: `CSI 4 ; height ; width t`
134
+ * @param height The desired height in characters (number of rows).
135
+ * @param width The desired width in characters (number of columns).
136
+ * @returns The ANSI escape sequence to resize the text area.
137
+ * @see xtermWindowOp
138
+ * @see XTermWindowOp.RESIZE_TEXT_AREA_CHARS
139
+ * @example
140
+ * ```typescript
141
+ * import { resizeTextAreaChars } from "@visulima/ansi";
142
+ *
143
+ * // Resize to 24 rows, 80 columns
144
+ * process.stdout.write(resizeTextAreaChars(24, 80));
145
+ * // Sends: "\x1b[4;24;80t"
146
+ * ```
147
+ */
148
+ export declare const resizeTextAreaChars: (height: number, width: number) => string;
149
+ /**
150
+ * Requests a report of the terminal window's text area size in characters (rows and columns).
151
+ * The terminal is expected to respond with a sequence like `CSI 4 ; height ; width t`.
152
+ *
153
+ * This function uses `XTermWindowOp.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT` (14), which corresponds to
154
+ * `XTermWindowOp.REPORT_TEXT_AREA_SIZE_CHARS` in XTerm.
155
+ *
156
+ * Sequence: `CSI 14 t` (which triggers the report `CSI 4 ; height ; width t`)
157
+ * @returns The ANSI escape sequence to request the text area size in characters.
158
+ * @see xtermWindowOp
159
+ * @see XTermWindowOp.REPORT_TEXT_AREA_SIZE_CHARS
160
+ * @see XTermWindowOp.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT
161
+ * @example
162
+ * ```typescript
163
+ * import { requestTextAreaSizeChars } from "@visulima/ansi";
164
+ *
165
+ * process.stdout.write(requestTextAreaSizeChars());
166
+ * // Sends: "\x1b[14t"
167
+ * // Expect response like: "\x1b[4;24;80t" if terminal is 24x80
168
+ * ```
169
+ */
170
+ export declare const requestTextAreaSizeChars: () => string;
171
+ /**
172
+ * Requests a report of the terminal's character cell size in pixels.
173
+ * The terminal is expected to respond with a sequence like `CSI 6 ; height ; width t`,
174
+ * where height and width are the dimensions of a single character cell in pixels.
175
+ *
176
+ * Sequence: `CSI 16 t` (which triggers the report `CSI 6 ; height ; width t`)
177
+ * @returns The ANSI escape sequence to request the cell size in pixels.
178
+ * @see xtermWindowOp
179
+ * @see XTermWindowOp.REPORT_CELL_SIZE_PIXELS
180
+ * @example
181
+ * ```typescript
182
+ * import { requestCellSizePixels } from "@visulima/ansi";
183
+ *
184
+ * process.stdout.write(requestCellSizePixels());
185
+ * // Sends: "\x1b[16t"
186
+ * // Expect response like: "\x1b[6;15;8t" if cell size is 15px height, 8px width
187
+ * ```
188
+ */
189
+ export declare const requestCellSizePixels: () => string;
190
+ /**
191
+ * Requests a report of the terminal window's text area size in pixels.
192
+ * The terminal is expected to respond with a sequence like `CSI 8 ; height ; width t`.
193
+ *
194
+ * Sequence: `CSI 18 t` (which triggers the report `CSI 8 ; height ; width t`)
195
+ * @returns The ANSI escape sequence to request the text area size in pixels.
196
+ * @see xtermWindowOp
197
+ * @see XTermWindowOp.REPORT_TEXT_AREA_SIZE_PIXELS
198
+ * @example
199
+ * ```typescript
200
+ * import { requestTextAreaSizePixels } from "@visulima/ansi";
201
+ *
202
+ * process.stdout.write(requestTextAreaSizePixels());
203
+ * // Sends: "\x1b[18t"
204
+ * // Expect response like: "\x1b[8;600;800t" if text area is 600px height, 800px width
205
+ * ```
206
+ */
207
+ export declare const requestTextAreaSizePixels: () => string;
208
+ /**
209
+ * De-iconifies the terminal window (restores it if minimized).
210
+ *
211
+ * Sequence: `CSI 1 t`
212
+ * @returns The ANSI escape sequence to de-iconify the window.
213
+ * @see xtermWindowOp
214
+ * @see XTermWindowOp.DEICONIFY_WINDOW
215
+ * @example
216
+ * ```typescript
217
+ * import { deiconifyWindow } from "@visulima/ansi";
218
+ *
219
+ * process.stdout.write(deiconifyWindow()); // Sends: "\x1b[1t"
220
+ * ```
221
+ */
222
+ export declare const deiconifyWindow: () => string;
223
+ /**
224
+ * Iconifies the terminal window (minimizes it).
225
+ *
226
+ * Sequence: `CSI 2 t`
227
+ * @returns The ANSI escape sequence to iconify the window.
228
+ * @see xtermWindowOp
229
+ * @see XTermWindowOp.ICONIFY_WINDOW
230
+ * @example
231
+ * ```typescript
232
+ * import { iconifyWindow } from "@visulima/ansi";
233
+ *
234
+ * process.stdout.write(iconifyWindow()); // Sends: "\x1b[2t"
235
+ * ```
236
+ */
237
+ export declare const iconifyWindow: () => string;
238
+ /**
239
+ * Moves the terminal window to the specified screen coordinates (top-left corner).
240
+ *
241
+ * Sequence: `CSI 3 ; x ; y t`
242
+ * - `x`: The X-coordinate (horizontal position in pixels from the left edge).
243
+ * - `y`: The Y-coordinate (vertical position in pixels from the top edge).
244
+ * @param x The target X-coordinate for the window's top-left corner.
245
+ * @param y The target Y-coordinate for the window's top-left corner.
246
+ * @returns The ANSI escape sequence to move the window.
247
+ * @see xtermWindowOp
248
+ * @see XTermWindowOp.MOVE_WINDOW
249
+ * @example
250
+ * ```typescript
251
+ * import { moveWindow } from "@visulima/ansi";
252
+ *
253
+ * // Move window to X=100, Y=50
254
+ * process.stdout.write(moveWindow(100, 50)); // Sends: "\x1b[3;100;50t"
255
+ * ```
256
+ */
257
+ export declare const moveWindow: (x: number, y: number) => string;
258
+ /**
259
+ * Raises the terminal window to the front of the stacking order.
260
+ *
261
+ * Sequence: `CSI 5 t`
262
+ * @returns The ANSI escape sequence to raise the window.
263
+ * @see xtermWindowOp
264
+ * @see XTermWindowOp.RAISE_WINDOW
265
+ * @example
266
+ * ```typescript
267
+ * import { raiseWindow } from "@visulima/ansi";
268
+ *
269
+ * process.stdout.write(raiseWindow()); // Sends: "\x1b[5t"
270
+ * ```
271
+ */
272
+ export declare const raiseWindow: () => string;
273
+ /**
274
+ * Lowers the terminal window to the bottom of the stacking order.
275
+ *
276
+ * Sequence: `CSI 6 t`
277
+ * @returns The ANSI escape sequence to lower the window.
278
+ * @see xtermWindowOp
279
+ * @see XTermWindowOp.LOWER_WINDOW
280
+ * @example
281
+ * ```typescript
282
+ * import { lowerWindow } from "@visulima/ansi";
283
+ *
284
+ * process.stdout.write(lowerWindow()); // Sends: "\x1b[6t"
285
+ * ```
286
+ */
287
+ export declare const lowerWindow: () => string;
288
+ /**
289
+ * Refreshes the terminal window content.
290
+ * This can be useful if the display becomes corrupted or needs redrawing.
291
+ *
292
+ * Sequence: `CSI 7 t`
293
+ * @returns The ANSI escape sequence to refresh the window.
294
+ * @see xtermWindowOp
295
+ * @see XTermWindowOp.REFRESH_WINDOW
296
+ * @example
297
+ * ```typescript
298
+ * import { refreshWindow } from "@visulima/ansi";
299
+ *
300
+ * process.stdout.write(refreshWindow()); // Sends: "\x1b[7t"
301
+ * ```
302
+ */
303
+ export declare const refreshWindow: () => string;
304
+ /**
305
+ * Resizes the terminal window's text area to a specified height and width in pixels.
306
+ *
307
+ * Sequence: `CSI 8 ; height ; width t`
308
+ * @param height The desired height in pixels.
309
+ * @param width The desired width in pixels.
310
+ * @returns The ANSI escape sequence to resize the text area in pixels.
311
+ * @see xtermWindowOp
312
+ * @see XTermWindowOp.RESIZE_TEXT_AREA_PIXELS
313
+ * @example
314
+ * ```typescript
315
+ * import { resizeTextAreaPixels } from "@visulima/ansi";
316
+ *
317
+ * // Resize text area to 600px height, 800px width
318
+ * process.stdout.write(resizeTextAreaPixels(600, 800));
319
+ * // Sends: "\x1b[8;600;800t"
320
+ * ```
321
+ */
322
+ export declare const resizeTextAreaPixels: (height: number, width: number) => string;
323
+ /**
324
+ * Restores a maximized terminal window to its previous size and position.
325
+ * XTerm typically uses `CSI 9 ; 0 t` for this operation, where 0 signifies restore.
326
+ * Some interpretations might use `CSI 9 t` if no other parameter implies restore.
327
+ *
328
+ * Sequence: `CSI 9 t` (simplified, relies on `XTermWindowOp.RESTORE_MAXIMIZED_WINDOW` which is 9)
329
+ * More specific might be `CSI 9 ; 0 t`.
330
+ * @returns The ANSI escape sequence to restore a maximized window.
331
+ * @see xtermWindowOp
332
+ * @see XTermWindowOp.RESTORE_MAXIMIZED_WINDOW
333
+ * @example
334
+ * ```typescript
335
+ * import { restoreMaximizedWindow } from "@visulima/ansi";
336
+ *
337
+ * process.stdout.write(restoreMaximizedWindow()); // Sends: "\x1b[9t"
338
+ * ```
339
+ */
340
+ export declare const restoreMaximizedWindow: () => string;
341
+ /**
342
+ * Maximizes the terminal window (often a "zoom" or toggle effect).
343
+ * XTerm typically uses `CSI 9 ; 1 t` for this, where 1 signifies maximize.
344
+ * Some terminals might use `CSI 10 t` for a general maximize/toggle.
345
+ * This function uses `XTermWindowOp.MAXIMIZE_WINDOW` which is 10.
346
+ *
347
+ * Sequence: `CSI 10 t` (using `XTermWindowOp.MAXIMIZE_WINDOW`)
348
+ * @returns The ANSI escape sequence to maximize the window.
349
+ * @see xtermWindowOp
350
+ * @see XTermWindowOp.MAXIMIZE_WINDOW
351
+ * @example
352
+ * ```typescript
353
+ * import { maximizeWindow } from "@visulima/ansi";
354
+ *
355
+ * process.stdout.write(maximizeWindow()); // Sends: "\x1b[10t"
356
+ * ```
357
+ */
358
+ export declare const maximizeWindow: () => string;
359
+ /**
360
+ * Report window position.
361
+ * Response: `CSI 3 ; x ; y t`
362
+ * `CSI 1 3 t`
363
+ *
364
+ * Requests a report of the terminal window's position on the screen.
365
+ * The terminal responds with `CSI 3 ; x ; y t` where x and y are the window coordinates.
366
+ * @returns The ANSI escape sequence to request window position.
367
+ * @see xtermWindowOp
368
+ * @see XTermWindowOp.REPORT_WINDOW_POSITION
369
+ * @example
370
+ * ```typescript
371
+ * import { reportWindowPosition } from "@visulima/ansi";
372
+ *
373
+ * process.stdout.write(reportWindowPosition());
374
+ * // Sends: "\x1b[13t"
375
+ * // Expect response like: "\x1b[3;100;50t" if window is at position (100, 50)
376
+ * ```
377
+ */
378
+ export declare const reportWindowPosition: () => string;
379
+ /**
380
+ * Report window state.
381
+ * Response: `CSI 1 t` if de-iconified, `CSI 2 t` if iconified.
382
+ * (XTerm doc uses `CSI ? 1 t` and `CSI ? 2 t`, but general form `CSI Ps t` is also listed for 11)
383
+ * `CSI 1 1 t`
384
+ *
385
+ * Requests a report of the terminal window's state (iconified/minimized or de-iconified/normal).
386
+ * The terminal responds with `CSI 1 t` if de-iconified or `CSI 2 t` if iconified.
387
+ * @returns The ANSI escape sequence to request window state.
388
+ * @see xtermWindowOp
389
+ * @see XTermWindowOp.REPORT_WINDOW_STATE
390
+ * @example
391
+ * ```typescript
392
+ * import { reportWindowState } from "@visulima/ansi";
393
+ *
394
+ * process.stdout.write(reportWindowState());
395
+ * // Sends: "\x1b[11t"
396
+ * // Expect response: "\x1b[1t" (de-iconified) or "\x1b[2t" (iconified)
397
+ * ```
398
+ */
399
+ export declare const reportWindowState: () => string;
400
+ /**
401
+ * Set page size (DECSLPP - Set Lines Per Page), often used for resizing the screen.
402
+ * `CSI Pl t` where Pl is the number of lines.
403
+ * XTerm extends this to `CSI > lines ; width ; height t` where width/height are in pixels.
404
+ * `CSI 24 ; lines t`
405
+ * @param lines The number of lines for the page.
406
+ * @returns The ANSI escape sequence to set page size.
407
+ * @see xtermWindowOp
408
+ * @see XTermWindowOp.RESIZE_SCREEN_AND_TEXT_AREA
409
+ * @example
410
+ * ```typescript
411
+ * import { setPageSizeLines } from "@visulima/ansi";
412
+ *
413
+ * // Set page size to 30 lines
414
+ * process.stdout.write(setPageSizeLines(30));
415
+ * // Sends: "\x1b[24;30t"
416
+ * ```
417
+ */
418
+ export declare const setPageSizeLines: (lines: number) => string;
@@ -0,0 +1 @@
1
+ var R=Object.defineProperty;var T=(_,W)=>R(_,"name",{value:W,configurable:!0});import{C as E}from"./packem_shared/constants-D12jy2Zh.js";var r=Object.defineProperty,e=T((_,W)=>r(_,"name",{value:W,configurable:!0}),"_"),A=(_=>(_[_.DEICONIFY_WINDOW=1]="DEICONIFY_WINDOW",_[_.ICONIFY_WINDOW=2]="ICONIFY_WINDOW",_[_.LOWER_WINDOW=6]="LOWER_WINDOW",_[_.MAXIMIZE_WINDOW=10]="MAXIMIZE_WINDOW",_[_.MAXIMIZE_WINDOW_HORIZONTALLY=10.2]="MAXIMIZE_WINDOW_HORIZONTALLY",_[_.MAXIMIZE_WINDOW_VERTICALLY=10.1]="MAXIMIZE_WINDOW_VERTICALLY",_[_.MOVE_WINDOW=3]="MOVE_WINDOW",_[_.POP_WINDOW_TITLE=23]="POP_WINDOW_TITLE",_[_.PUSH_WINDOW_TITLE=22]="PUSH_WINDOW_TITLE",_[_.RAISE_WINDOW=5]="RAISE_WINDOW",_[_.REFRESH_WINDOW=7]="REFRESH_WINDOW",_[_.REPORT_CELL_SIZE_PIXELS=16]="REPORT_CELL_SIZE_PIXELS",_[_.REPORT_ICON_LABEL=19]="REPORT_ICON_LABEL",_[_.REPORT_TEXT_AREA_SIZE_CHARS=14]="REPORT_TEXT_AREA_SIZE_CHARS",_[_.REPORT_TEXT_AREA_SIZE_PIXELS=18]="REPORT_TEXT_AREA_SIZE_PIXELS",_[_.REPORT_WINDOW_POSITION=13]="REPORT_WINDOW_POSITION",_[_.REPORT_WINDOW_STATE=11]="REPORT_WINDOW_STATE",_[_.REPORT_WINDOW_TITLE=21]="REPORT_WINDOW_TITLE",_[_.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT=14]="REQUEST_WINDOW_SIZE_WIN_OP_COMPAT",_[_.RESIZE_SCREEN_AND_TEXT_AREA=24]="RESIZE_SCREEN_AND_TEXT_AREA",_[_.RESIZE_TEXT_AREA_CHARS=4]="RESIZE_TEXT_AREA_CHARS",_[_.RESIZE_TEXT_AREA_PIXELS=8]="RESIZE_TEXT_AREA_PIXELS",_[_.RESTORE_MAXIMIZED_WINDOW=9]="RESTORE_MAXIMIZED_WINDOW",_[_.UNDO_FULL_SCREEN_MODE=10.3]="UNDO_FULL_SCREEN_MODE",_))(A||{});const I=e((_,...W)=>{if(![10.1,10.2,10.3].includes(_)&&_<=0)return"";const O=[_];for(const i of W)i>=0&&O.push(i);return`${E}${O.join(";")}t`},"xtermWindowOp"),o=I,P=e((_,W)=>I(4,_,W),"resizeTextAreaChars"),D=e(()=>I(14),"requestTextAreaSizeChars"),n=e(()=>I(16),"requestCellSizePixels"),t=e(()=>I(18),"requestTextAreaSizePixels"),s=e(()=>I(1),"deiconifyWindow"),L=e(()=>I(2),"iconifyWindow"),a=e((_,W)=>I(3,_,W),"moveWindow"),d=e(()=>I(5),"raiseWindow"),C=e(()=>I(6),"lowerWindow"),X=e(()=>I(7),"refreshWindow"),w=e((_,W)=>I(8,_,W),"resizeTextAreaPixels"),M=e(()=>I(9),"restoreMaximizedWindow"),Z=e(()=>I(10),"maximizeWindow"),x=e(()=>I(13),"reportWindowPosition"),z=e(()=>I(11),"reportWindowState"),l=e(_=>I(24,_),"setPageSizeLines");export{o as XTWINOPS,A as XTermWindowOp,s as deiconifyWindow,L as iconifyWindow,C as lowerWindow,Z as maximizeWindow,a as moveWindow,d as raiseWindow,X as refreshWindow,x as reportWindowPosition,z as reportWindowState,n as requestCellSizePixels,D as requestTextAreaSizeChars,t as requestTextAreaSizePixels,P as resizeTextAreaChars,w as resizeTextAreaPixels,M as restoreMaximizedWindow,l as setPageSizeLines,I as xtermWindowOp};