@visulima/ansi 2.0.0 → 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.
Files changed (152) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE.md +1 -132
  3. package/README.md +226 -226
  4. package/dist/alternative-screen.d.ts +6 -74
  5. package/dist/alternative-screen.js +1 -0
  6. package/dist/clear.d.ts +6 -77
  7. package/dist/clear.js +1 -0
  8. package/dist/cursor.d.ts +48 -429
  9. package/dist/cursor.js +1 -0
  10. package/dist/erase.d.ts +14 -197
  11. package/dist/erase.js +1 -0
  12. package/dist/hyperlink.d.ts +1 -27
  13. package/dist/hyperlink.js +1 -0
  14. package/dist/image.d.ts +7 -69
  15. package/dist/image.js +1 -0
  16. package/dist/index.d.ts +30 -35
  17. package/dist/index.js +1 -0
  18. package/dist/iterm2.d.ts +43 -58
  19. package/dist/iterm2.js +1 -0
  20. package/dist/mode.d.ts +174 -648
  21. package/dist/mode.js +1 -0
  22. package/dist/mouse.d.ts +21 -203
  23. package/dist/mouse.js +1 -0
  24. package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +1 -0
  25. package/dist/packem_shared/ITerm2File-C88DBJC-.js +1 -0
  26. package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
  27. package/dist/packem_shared/cursor-D2UOfUc_.js +1 -0
  28. package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +1 -0
  29. package/dist/packem_shared/restoreCursor-D3XBmqcY.js +2 -0
  30. package/dist/passthrough.d.ts +6 -77
  31. package/dist/passthrough.js +1 -0
  32. package/dist/reset.d.ts +4 -26
  33. package/dist/reset.js +1 -0
  34. package/dist/screen.d.ts +11 -234
  35. package/dist/screen.js +1 -0
  36. package/dist/scroll.d.ts +6 -67
  37. package/dist/scroll.js +1 -0
  38. package/dist/status.d.ts +48 -498
  39. package/dist/status.js +1 -0
  40. package/dist/strip.d.ts +1 -23
  41. package/dist/strip.js +1 -0
  42. package/dist/termcap.d.ts +5 -38
  43. package/dist/termcap.js +1 -0
  44. package/dist/title.d.ts +10 -185
  45. package/dist/title.js +1 -0
  46. package/dist/window-ops.d.ts +24 -396
  47. package/dist/window-ops.js +1 -0
  48. package/dist/xterm.d.ts +12 -94
  49. package/dist/xterm.js +1 -0
  50. package/package.json +45 -230
  51. package/dist/alternative-screen.cjs +0 -17
  52. package/dist/alternative-screen.d.cts +0 -74
  53. package/dist/alternative-screen.d.mts +0 -74
  54. package/dist/alternative-screen.mjs +0 -10
  55. package/dist/clear.cjs +0 -17
  56. package/dist/clear.d.cts +0 -77
  57. package/dist/clear.d.mts +0 -77
  58. package/dist/clear.mjs +0 -10
  59. package/dist/constants.d.cts +0 -20
  60. package/dist/constants.d.mts +0 -20
  61. package/dist/constants.d.ts +0 -20
  62. package/dist/cursor.cjs +0 -41
  63. package/dist/cursor.d.cts +0 -437
  64. package/dist/cursor.d.mts +0 -437
  65. package/dist/cursor.mjs +0 -3
  66. package/dist/erase.cjs +0 -64
  67. package/dist/erase.d.cts +0 -206
  68. package/dist/erase.d.mts +0 -206
  69. package/dist/erase.mjs +0 -49
  70. package/dist/helpers.d.cts +0 -14
  71. package/dist/helpers.d.mts +0 -14
  72. package/dist/helpers.d.ts +0 -14
  73. package/dist/hyperlink.cjs +0 -9
  74. package/dist/hyperlink.d.cts +0 -29
  75. package/dist/hyperlink.d.mts +0 -27
  76. package/dist/hyperlink.mjs +0 -7
  77. package/dist/image.cjs +0 -28
  78. package/dist/image.d.cts +0 -73
  79. package/dist/image.d.mts +0 -73
  80. package/dist/image.mjs +0 -24
  81. package/dist/index.cjs +0 -246
  82. package/dist/index.d.cts +0 -35
  83. package/dist/index.d.mts +0 -35
  84. package/dist/index.mjs +0 -25
  85. package/dist/iterm2/iterm2-properties.d.cts +0 -135
  86. package/dist/iterm2/iterm2-properties.d.mts +0 -135
  87. package/dist/iterm2/iterm2-properties.d.ts +0 -135
  88. package/dist/iterm2/iterm2-sequences.d.cts +0 -96
  89. package/dist/iterm2/iterm2-sequences.d.mts +0 -96
  90. package/dist/iterm2/iterm2-sequences.d.ts +0 -96
  91. package/dist/iterm2.cjs +0 -26
  92. package/dist/iterm2.d.cts +0 -58
  93. package/dist/iterm2.d.mts +0 -58
  94. package/dist/iterm2.mjs +0 -14
  95. package/dist/mode.cjs +0 -388
  96. package/dist/mode.d.cts +0 -657
  97. package/dist/mode.d.mts +0 -657
  98. package/dist/mode.mjs +0 -235
  99. package/dist/mouse.cjs +0 -127
  100. package/dist/mouse.d.cts +0 -230
  101. package/dist/mouse.d.mts +0 -230
  102. package/dist/mouse.mjs +0 -108
  103. package/dist/packem_shared/IT2_AUTO-5vTJQMm6.cjs +0 -15
  104. package/dist/packem_shared/IT2_AUTO-DnfCUXso.mjs +0 -8
  105. package/dist/packem_shared/ITerm2File-BGPqNSjB.cjs +0 -137
  106. package/dist/packem_shared/ITerm2File-DKFkdqdA.mjs +0 -130
  107. package/dist/packem_shared/constants-BK26O-46.cjs +0 -17
  108. package/dist/packem_shared/constants-CE7WkXh_.mjs +0 -9
  109. package/dist/packem_shared/cursor-CQKLCu7U.cjs +0 -105
  110. package/dist/packem_shared/cursor-DhFQcQ9g.mjs +0 -73
  111. package/dist/packem_shared/restoreCursor-C6pNB8UY.mjs +0 -336
  112. package/dist/packem_shared/restoreCursor-DC_ZKZwT.cjs +0 -342
  113. package/dist/passthrough.cjs +0 -38
  114. package/dist/passthrough.d.cts +0 -77
  115. package/dist/passthrough.d.mts +0 -77
  116. package/dist/passthrough.mjs +0 -31
  117. package/dist/reset.cjs +0 -9
  118. package/dist/reset.d.cts +0 -26
  119. package/dist/reset.d.mts +0 -26
  120. package/dist/reset.mjs +0 -4
  121. package/dist/screen.cjs +0 -41
  122. package/dist/screen.d.cts +0 -234
  123. package/dist/screen.d.mts +0 -234
  124. package/dist/screen.mjs +0 -29
  125. package/dist/scroll.cjs +0 -27
  126. package/dist/scroll.d.cts +0 -67
  127. package/dist/scroll.d.mts +0 -67
  128. package/dist/scroll.mjs +0 -20
  129. package/dist/status.cjs +0 -147
  130. package/dist/status.d.cts +0 -501
  131. package/dist/status.d.mts +0 -501
  132. package/dist/status.mjs +0 -104
  133. package/dist/strip.cjs +0 -20
  134. package/dist/strip.d.cts +0 -25
  135. package/dist/strip.d.mts +0 -23
  136. package/dist/strip.mjs +0 -18
  137. package/dist/termcap.cjs +0 -33
  138. package/dist/termcap.d.cts +0 -38
  139. package/dist/termcap.d.mts +0 -38
  140. package/dist/termcap.mjs +0 -27
  141. package/dist/title.cjs +0 -31
  142. package/dist/title.d.cts +0 -185
  143. package/dist/title.d.mts +0 -185
  144. package/dist/title.mjs +0 -20
  145. package/dist/window-ops.cjs +0 -85
  146. package/dist/window-ops.d.cts +0 -418
  147. package/dist/window-ops.d.mts +0 -418
  148. package/dist/window-ops.mjs +0 -63
  149. package/dist/xterm.cjs +0 -48
  150. package/dist/xterm.d.cts +0 -94
  151. package/dist/xterm.d.mts +0 -94
  152. package/dist/xterm.mjs +0 -35
@@ -1,85 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const constants = require('./packem_shared/constants-BK26O-46.cjs');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var XTermWindowOp = /* @__PURE__ */ ((XTermWindowOp2) => {
10
- XTermWindowOp2[XTermWindowOp2["DEICONIFY_WINDOW"] = 1] = "DEICONIFY_WINDOW";
11
- XTermWindowOp2[XTermWindowOp2["ICONIFY_WINDOW"] = 2] = "ICONIFY_WINDOW";
12
- XTermWindowOp2[XTermWindowOp2["LOWER_WINDOW"] = 6] = "LOWER_WINDOW";
13
- XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW"] = 10] = "MAXIMIZE_WINDOW";
14
- XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW_HORIZONTALLY"] = 10.2] = "MAXIMIZE_WINDOW_HORIZONTALLY";
15
- XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW_VERTICALLY"] = 10.1] = "MAXIMIZE_WINDOW_VERTICALLY";
16
- XTermWindowOp2[XTermWindowOp2["MOVE_WINDOW"] = 3] = "MOVE_WINDOW";
17
- XTermWindowOp2[XTermWindowOp2["POP_WINDOW_TITLE"] = 23] = "POP_WINDOW_TITLE";
18
- XTermWindowOp2[XTermWindowOp2["PUSH_WINDOW_TITLE"] = 22] = "PUSH_WINDOW_TITLE";
19
- XTermWindowOp2[XTermWindowOp2["RAISE_WINDOW"] = 5] = "RAISE_WINDOW";
20
- XTermWindowOp2[XTermWindowOp2["REFRESH_WINDOW"] = 7] = "REFRESH_WINDOW";
21
- XTermWindowOp2[XTermWindowOp2["REPORT_CELL_SIZE_PIXELS"] = 16] = "REPORT_CELL_SIZE_PIXELS";
22
- XTermWindowOp2[XTermWindowOp2["REPORT_ICON_LABEL"] = 19] = "REPORT_ICON_LABEL";
23
- XTermWindowOp2[XTermWindowOp2["REPORT_TEXT_AREA_SIZE_CHARS"] = 14] = "REPORT_TEXT_AREA_SIZE_CHARS";
24
- XTermWindowOp2[XTermWindowOp2["REPORT_TEXT_AREA_SIZE_PIXELS"] = 18] = "REPORT_TEXT_AREA_SIZE_PIXELS";
25
- XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_POSITION"] = 13] = "REPORT_WINDOW_POSITION";
26
- XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_STATE"] = 11] = "REPORT_WINDOW_STATE";
27
- XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_TITLE"] = 21] = "REPORT_WINDOW_TITLE";
28
- XTermWindowOp2[XTermWindowOp2["REQUEST_WINDOW_SIZE_WIN_OP_COMPAT"] = 14] = "REQUEST_WINDOW_SIZE_WIN_OP_COMPAT";
29
- XTermWindowOp2[XTermWindowOp2["RESIZE_SCREEN_AND_TEXT_AREA"] = 24] = "RESIZE_SCREEN_AND_TEXT_AREA";
30
- XTermWindowOp2[XTermWindowOp2["RESIZE_TEXT_AREA_CHARS"] = 4] = "RESIZE_TEXT_AREA_CHARS";
31
- XTermWindowOp2[XTermWindowOp2["RESIZE_TEXT_AREA_PIXELS"] = 8] = "RESIZE_TEXT_AREA_PIXELS";
32
- XTermWindowOp2[XTermWindowOp2["RESTORE_MAXIMIZED_WINDOW"] = 9] = "RESTORE_MAXIMIZED_WINDOW";
33
- XTermWindowOp2[XTermWindowOp2["UNDO_FULL_SCREEN_MODE"] = 10.3] = "UNDO_FULL_SCREEN_MODE";
34
- return XTermWindowOp2;
35
- })(XTermWindowOp || {});
36
- const xtermWindowOp = /* @__PURE__ */ __name((p, ...ps) => {
37
- const allowedFloats = [10.1 /* MAXIMIZE_WINDOW_VERTICALLY */, 10.2 /* MAXIMIZE_WINDOW_HORIZONTALLY */, 10.3 /* UNDO_FULL_SCREEN_MODE */];
38
- if (allowedFloats.includes(p)) ; else if (p <= 0) {
39
- return "";
40
- }
41
- const parameters = [p];
42
- for (const value of ps) {
43
- if (value >= 0) {
44
- parameters.push(value);
45
- }
46
- }
47
- return `${constants.CSI}${parameters.join(";")}t`;
48
- }, "xtermWindowOp");
49
- const XTWINOPS = xtermWindowOp;
50
- const resizeTextAreaChars = /* @__PURE__ */ __name((height, width) => xtermWindowOp(4 /* RESIZE_TEXT_AREA_CHARS */, height, width), "resizeTextAreaChars");
51
- const requestTextAreaSizeChars = /* @__PURE__ */ __name(() => xtermWindowOp(14 /* REQUEST_WINDOW_SIZE_WIN_OP_COMPAT */), "requestTextAreaSizeChars");
52
- const requestCellSizePixels = /* @__PURE__ */ __name(() => xtermWindowOp(16 /* REPORT_CELL_SIZE_PIXELS */), "requestCellSizePixels");
53
- const requestTextAreaSizePixels = /* @__PURE__ */ __name(() => xtermWindowOp(18 /* REPORT_TEXT_AREA_SIZE_PIXELS */), "requestTextAreaSizePixels");
54
- const deiconifyWindow = /* @__PURE__ */ __name(() => xtermWindowOp(1 /* DEICONIFY_WINDOW */), "deiconifyWindow");
55
- const iconifyWindow = /* @__PURE__ */ __name(() => xtermWindowOp(2 /* ICONIFY_WINDOW */), "iconifyWindow");
56
- const moveWindow = /* @__PURE__ */ __name((x, y) => xtermWindowOp(3 /* MOVE_WINDOW */, x, y), "moveWindow");
57
- const raiseWindow = /* @__PURE__ */ __name(() => xtermWindowOp(5 /* RAISE_WINDOW */), "raiseWindow");
58
- const lowerWindow = /* @__PURE__ */ __name(() => xtermWindowOp(6 /* LOWER_WINDOW */), "lowerWindow");
59
- const refreshWindow = /* @__PURE__ */ __name(() => xtermWindowOp(7 /* REFRESH_WINDOW */), "refreshWindow");
60
- const resizeTextAreaPixels = /* @__PURE__ */ __name((height, width) => xtermWindowOp(8 /* RESIZE_TEXT_AREA_PIXELS */, height, width), "resizeTextAreaPixels");
61
- const restoreMaximizedWindow = /* @__PURE__ */ __name(() => xtermWindowOp(9 /* RESTORE_MAXIMIZED_WINDOW */), "restoreMaximizedWindow");
62
- const maximizeWindow = /* @__PURE__ */ __name(() => xtermWindowOp(10 /* MAXIMIZE_WINDOW */), "maximizeWindow");
63
- const reportWindowPosition = /* @__PURE__ */ __name(() => xtermWindowOp(13 /* REPORT_WINDOW_POSITION */), "reportWindowPosition");
64
- const reportWindowState = /* @__PURE__ */ __name(() => xtermWindowOp(11 /* REPORT_WINDOW_STATE */), "reportWindowState");
65
- const setPageSizeLines = /* @__PURE__ */ __name((lines) => xtermWindowOp(24 /* RESIZE_SCREEN_AND_TEXT_AREA */, lines), "setPageSizeLines");
66
-
67
- exports.XTWINOPS = XTWINOPS;
68
- exports.XTermWindowOp = XTermWindowOp;
69
- exports.deiconifyWindow = deiconifyWindow;
70
- exports.iconifyWindow = iconifyWindow;
71
- exports.lowerWindow = lowerWindow;
72
- exports.maximizeWindow = maximizeWindow;
73
- exports.moveWindow = moveWindow;
74
- exports.raiseWindow = raiseWindow;
75
- exports.refreshWindow = refreshWindow;
76
- exports.reportWindowPosition = reportWindowPosition;
77
- exports.reportWindowState = reportWindowState;
78
- exports.requestCellSizePixels = requestCellSizePixels;
79
- exports.requestTextAreaSizeChars = requestTextAreaSizeChars;
80
- exports.requestTextAreaSizePixels = requestTextAreaSizePixels;
81
- exports.resizeTextAreaChars = resizeTextAreaChars;
82
- exports.resizeTextAreaPixels = resizeTextAreaPixels;
83
- exports.restoreMaximizedWindow = restoreMaximizedWindow;
84
- exports.setPageSizeLines = setPageSizeLines;
85
- exports.xtermWindowOp = xtermWindowOp;
@@ -1,418 +0,0 @@
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;