@visulima/ansi 4.0.0-alpha.6 → 4.0.0-alpha.8
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 +34 -0
- package/dist/alternative-screen.js +8 -1
- package/dist/clear.d.ts +1 -1
- package/dist/clear.js +10 -1
- package/dist/cursor.d.ts +11 -11
- package/dist/cursor.js +3 -1
- package/dist/erase.d.ts +22 -22
- package/dist/erase.js +47 -1
- package/dist/hyperlink.js +5 -1
- package/dist/image.js +40 -1
- package/dist/index.js +26 -1
- package/dist/iterm2/iterm2-properties.d.ts +1 -1
- package/dist/iterm2/iterm2-sequences.d.ts +4 -4
- package/dist/iterm2.js +12 -1
- package/dist/mode.d.ts +11 -11
- package/dist/mode.js +245 -1
- package/dist/mouse.js +106 -1
- package/dist/packem_shared/IT2_AUTO-DyYWsxno.js +6 -0
- package/dist/packem_shared/ITerm2File-CUZDBk99.js +137 -0
- package/dist/packem_shared/constants-CE7WkXh_.js +9 -0
- package/dist/packem_shared/cursor-ChpV7cgs.js +72 -0
- package/dist/packem_shared/resetProgressBar-D9r2s7eV.js +18 -0
- package/dist/packem_shared/restoreCursor-GfYEeJqN.js +323 -0
- package/dist/passthrough.js +29 -1
- package/dist/reset.js +4 -1
- package/dist/screen.js +27 -1
- package/dist/scroll.js +18 -1
- package/dist/status.d.ts +6 -5
- package/dist/status.js +95 -1
- package/dist/strip.d.ts +0 -21
- package/dist/strip.js +13 -1
- package/dist/termcap.d.ts +1 -1
- package/dist/termcap.js +25 -1
- package/dist/title.d.ts +32 -34
- package/dist/title.js +19 -1
- package/dist/window-ops.d.ts +55 -55
- package/dist/window-ops.js +61 -1
- package/dist/xterm.d.ts +3 -3
- package/dist/xterm.js +33 -1
- package/package.json +1 -3
- package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +0 -1
- package/dist/packem_shared/ITerm2File-C88DBJC-.js +0 -1
- package/dist/packem_shared/constants-D12jy2Zh.js +0 -1
- package/dist/packem_shared/cursor-8eSvcJ2I.js +0 -1
- package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +0 -1
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +0 -2
package/dist/title.d.ts
CHANGED
|
@@ -64,59 +64,57 @@ export declare const setIconName: (iconName: string) => string;
|
|
|
64
64
|
export declare const setWindowTitle: (title: string) => string;
|
|
65
65
|
/**
|
|
66
66
|
* Sets a DEC Special Window Title (DECSWT) using an OSC sequence.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
67
|
+
*
|
|
68
|
+
* DECSWT was introduced in the DEC VT520/VT525 family and uses the dedicated
|
|
69
|
+
* OSC code `21` (not to be confused with OSC 2 for standard window titles).
|
|
70
|
+
* It is terminated with ST (String Terminator) per the VT520 specification.
|
|
71
|
+
*
|
|
72
|
+
* Uses the sequence: `OSC 21 ; title ST`
|
|
73
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
74
|
+
* - `21`: Parameter for DEC Special Window Title.
|
|
75
|
+
* - `title`: The string to set.
|
|
76
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
77
|
+
*
|
|
78
|
+
* Support varies across modern emulators; Zutty 0.6+ claims VT520 compatibility,
|
|
79
|
+
* and Microsoft's Windows Terminal also supports this sequence.
|
|
80
|
+
* Unsupported sequences are typically silently ignored by most terminals.
|
|
81
81
|
* @param title The title string.
|
|
82
|
-
* @returns The ANSI escape sequence for DECSWT
|
|
82
|
+
* @returns The ANSI escape sequence for DECSWT.
|
|
83
83
|
* @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
|
|
84
|
-
* @see setWindowTitle
|
|
85
84
|
* @example
|
|
86
85
|
* ```typescript
|
|
87
86
|
* import { decswt } from "@visulima/ansi";
|
|
88
87
|
*
|
|
89
88
|
* process.stdout.write(decswt("My Special Window"));
|
|
90
|
-
* // Sends: "
|
|
89
|
+
* // Sends: "\x1b]21;My Special Window\x1b\\"
|
|
91
90
|
* ```
|
|
92
91
|
*/
|
|
93
92
|
export declare const decswt: (title: string) => string;
|
|
94
93
|
/**
|
|
95
94
|
* Sets a DEC Special Icon Name (DECSIN) using an OSC sequence.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
95
|
+
*
|
|
96
|
+
* DECSIN was introduced in the DEC VT520/VT525 family and uses the dedicated
|
|
97
|
+
* OSC code `2L` (not to be confused with OSC 1 for standard icon names).
|
|
98
|
+
* It is terminated with ST (String Terminator) per the VT520 specification.
|
|
99
|
+
*
|
|
100
|
+
* Uses the sequence: `OSC 2L ; name ST`
|
|
101
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
102
|
+
* - `2L`: Parameter for DEC Special Icon Name.
|
|
103
|
+
* - `name`: The string to set.
|
|
104
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
105
|
+
*
|
|
106
|
+
* Support varies across modern emulators; Zutty 0.6+ claims VT520 compatibility,
|
|
107
|
+
* and Microsoft's Windows Terminal also supports this sequence.
|
|
108
|
+
* Unsupported sequences are typically silently ignored by most terminals.
|
|
110
109
|
* @param name The name or content for the DEC-style icon name.
|
|
111
|
-
* @returns The ANSI escape sequence for DECSIN
|
|
110
|
+
* @returns The ANSI escape sequence for DECSIN.
|
|
112
111
|
* @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
|
|
113
|
-
* @see setWindowTitle
|
|
114
112
|
* @example
|
|
115
113
|
* ```typescript
|
|
116
114
|
* import { decsin } from "@visulima/ansi";
|
|
117
115
|
*
|
|
118
116
|
* process.stdout.write(decsin("SpecialIcon"));
|
|
119
|
-
* // Sends: "
|
|
117
|
+
* // Sends: "\x1b]2L;SpecialIcon\x1b\\"
|
|
120
118
|
* ```
|
|
121
119
|
*/
|
|
122
120
|
export declare const decsin: (name: string) => string;
|
package/dist/title.js
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { O as OSC, a as ST, B as BEL } from './packem_shared/constants-CE7WkXh_.js';
|
|
2
|
+
|
|
3
|
+
const TITLE_SANITIZE_REGEX = /[\u0007\u001B]/g;
|
|
4
|
+
const validateTitle = (title) => {
|
|
5
|
+
if (typeof title !== "string") {
|
|
6
|
+
throw new TypeError("Title must be a string");
|
|
7
|
+
}
|
|
8
|
+
return title.replaceAll(TITLE_SANITIZE_REGEX, "");
|
|
9
|
+
};
|
|
10
|
+
const setIconNameAndWindowTitle = (title) => `${OSC}0;${validateTitle(title)}${BEL}`;
|
|
11
|
+
const setIconName = (iconName) => `${OSC}1;${iconName}${BEL}`;
|
|
12
|
+
const setWindowTitle = (title) => `${OSC}2;${title}${BEL}`;
|
|
13
|
+
const decswt = (title) => `${OSC}21;${title}${ST}`;
|
|
14
|
+
const decsin = (name) => `${OSC}2L;${name}${ST}`;
|
|
15
|
+
const setIconNameAndWindowTitleWithST = (title) => `${OSC}0;${title}${ST}`;
|
|
16
|
+
const setIconNameWithST = (iconName) => `${OSC}1;${iconName}${ST}`;
|
|
17
|
+
const setWindowTitleWithST = (title) => `${OSC}2;${title}${ST}`;
|
|
18
|
+
|
|
19
|
+
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST };
|
package/dist/window-ops.d.ts
CHANGED
|
@@ -12,77 +12,65 @@ export declare enum XTermWindowOp {
|
|
|
12
12
|
* Iconify window.
|
|
13
13
|
*/
|
|
14
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
15
|
/**
|
|
32
16
|
* Move window to `[x, y]`.
|
|
33
17
|
*/
|
|
34
18
|
MOVE_WINDOW = 3,
|
|
35
19
|
/**
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
POP_WINDOW_TITLE = 23,
|
|
39
|
-
/**
|
|
40
|
-
* Push window title on stack.
|
|
20
|
+
* Resize the text area to `[height, width]` in characters.
|
|
41
21
|
*/
|
|
42
|
-
|
|
22
|
+
RESIZE_TEXT_AREA_CHARS = 4,
|
|
43
23
|
/**
|
|
44
24
|
* Raise the window to the front of the stacking order.
|
|
45
25
|
*/
|
|
46
26
|
RAISE_WINDOW = 5,
|
|
27
|
+
/**
|
|
28
|
+
* Lower the window to the bottom of the stacking order.
|
|
29
|
+
*/
|
|
30
|
+
LOWER_WINDOW = 6,
|
|
47
31
|
/**
|
|
48
32
|
* Refresh the window.
|
|
49
33
|
*/
|
|
50
34
|
REFRESH_WINDOW = 7,
|
|
51
35
|
/**
|
|
52
|
-
*
|
|
53
|
-
* Response: `CSI 6 ; height ; width t`
|
|
36
|
+
* Resize the text area to `[height, width]` in pixels.
|
|
54
37
|
*/
|
|
55
|
-
|
|
38
|
+
RESIZE_TEXT_AREA_PIXELS = 8,
|
|
56
39
|
/**
|
|
57
|
-
*
|
|
58
|
-
* Response: `OSC L label ST`
|
|
40
|
+
* Restore maximized window.
|
|
59
41
|
*/
|
|
60
|
-
|
|
42
|
+
RESTORE_MAXIMIZED_WINDOW = 9,
|
|
61
43
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Response: `CSI 4 ; height ; width t`
|
|
44
|
+
* Maximize window (i.e., "zoom" or "toggle").
|
|
64
45
|
*/
|
|
65
|
-
|
|
46
|
+
MAXIMIZE_WINDOW = 10,
|
|
66
47
|
/**
|
|
67
|
-
*
|
|
68
|
-
* Response: `CSI 8 ; height ; width t`
|
|
48
|
+
* Maximize window vertically.
|
|
69
49
|
*/
|
|
70
|
-
|
|
50
|
+
MAXIMIZE_WINDOW_VERTICALLY = 10.1,
|
|
71
51
|
/**
|
|
72
|
-
*
|
|
73
|
-
* Response: `CSI 3 ; x ; y t`
|
|
52
|
+
* Maximize window horizontally.
|
|
74
53
|
*/
|
|
75
|
-
|
|
54
|
+
MAXIMIZE_WINDOW_HORIZONTALLY = 10.2,
|
|
55
|
+
/**
|
|
56
|
+
* Undo full-screen mode.
|
|
57
|
+
*/
|
|
58
|
+
UNDO_FULL_SCREEN_MODE = 10.3,// Note: XTerm docs list 10 ; 0, 10 ; 1, 10 ; 2, this is simplified.
|
|
76
59
|
/**
|
|
77
60
|
* Report window state.
|
|
78
61
|
* Response: `CSI code t` where `code` is 1 if de-iconified, 2 if iconified.
|
|
79
62
|
*/
|
|
80
63
|
REPORT_WINDOW_STATE = 11,
|
|
81
64
|
/**
|
|
82
|
-
* Report window
|
|
83
|
-
* Response: `
|
|
65
|
+
* Report window position.
|
|
66
|
+
* Response: `CSI 3 ; x ; y t`
|
|
84
67
|
*/
|
|
85
|
-
|
|
68
|
+
REPORT_WINDOW_POSITION = 13,
|
|
69
|
+
/**
|
|
70
|
+
* Report text area size in characters.
|
|
71
|
+
* Response: `CSI 4 ; height ; width t`
|
|
72
|
+
*/
|
|
73
|
+
REPORT_TEXT_AREA_SIZE_CHARS = 14,
|
|
86
74
|
/**
|
|
87
75
|
* Report window size in pixels.
|
|
88
76
|
* Alias for `REPORT_TEXT_AREA_SIZE_PIXELS` for compatibility with some terminals (e.g., mintty).
|
|
@@ -91,26 +79,38 @@ export declare enum XTermWindowOp {
|
|
|
91
79
|
*/
|
|
92
80
|
REQUEST_WINDOW_SIZE_WIN_OP_COMPAT = 14,// From Go code
|
|
93
81
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
82
|
+
* Report cell size in pixels.
|
|
83
|
+
* Response: `CSI 6 ; height ; width t`
|
|
96
84
|
*/
|
|
97
|
-
|
|
85
|
+
REPORT_CELL_SIZE_PIXELS = 16,// From Go code
|
|
98
86
|
/**
|
|
99
|
-
*
|
|
87
|
+
* Report text area size in pixels.
|
|
88
|
+
* Response: `CSI 8 ; height ; width t`
|
|
100
89
|
*/
|
|
101
|
-
|
|
90
|
+
REPORT_TEXT_AREA_SIZE_PIXELS = 18,
|
|
102
91
|
/**
|
|
103
|
-
*
|
|
92
|
+
* Report icon label.
|
|
93
|
+
* Response: `OSC L label ST`
|
|
104
94
|
*/
|
|
105
|
-
|
|
95
|
+
REPORT_ICON_LABEL = 19,
|
|
106
96
|
/**
|
|
107
|
-
*
|
|
97
|
+
* Report window title.
|
|
98
|
+
* Response: `OSC l label ST`
|
|
108
99
|
*/
|
|
109
|
-
|
|
100
|
+
REPORT_WINDOW_TITLE = 21,
|
|
110
101
|
/**
|
|
111
|
-
*
|
|
102
|
+
* Push window title on stack.
|
|
103
|
+
*/
|
|
104
|
+
PUSH_WINDOW_TITLE = 22,
|
|
105
|
+
/**
|
|
106
|
+
* Pop window title from stack.
|
|
107
|
+
*/
|
|
108
|
+
POP_WINDOW_TITLE = 23,
|
|
109
|
+
/**
|
|
110
|
+
* Resize the screen to `[width, height]` in pixels and resize the text area to `[cols, lines]` in characters.
|
|
111
|
+
* (DECSLPP - Set Lines Per Page)
|
|
112
112
|
*/
|
|
113
|
-
|
|
113
|
+
RESIZE_SCREEN_AND_TEXT_AREA = 24
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Generates an XTerm Window Operation (XTWINOPS) sequence.
|
|
@@ -153,7 +153,7 @@ export declare const resizeTextAreaChars: (height: number, width: number) => str
|
|
|
153
153
|
* This function uses `XTermWindowOp.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT` (14), which corresponds to
|
|
154
154
|
* `XTermWindowOp.REPORT_TEXT_AREA_SIZE_CHARS` in XTerm.
|
|
155
155
|
*
|
|
156
|
-
* Sequence: `CSI 14 t` (which triggers the report `CSI 4 ; height ; width t`)
|
|
156
|
+
* Sequence: `CSI 14 t` (which triggers the report `CSI 4 ; height ; width t`).
|
|
157
157
|
* @returns The ANSI escape sequence to request the text area size in characters.
|
|
158
158
|
* @see xtermWindowOp
|
|
159
159
|
* @see XTermWindowOp.REPORT_TEXT_AREA_SIZE_CHARS
|
|
@@ -173,7 +173,7 @@ export declare const requestTextAreaSizeChars: () => string;
|
|
|
173
173
|
* The terminal is expected to respond with a sequence like `CSI 6 ; height ; width t`,
|
|
174
174
|
* where height and width are the dimensions of a single character cell in pixels.
|
|
175
175
|
*
|
|
176
|
-
* Sequence: `CSI 16 t` (which triggers the report `CSI 6 ; height ; width t`)
|
|
176
|
+
* Sequence: `CSI 16 t` (which triggers the report `CSI 6 ; height ; width t`).
|
|
177
177
|
* @returns The ANSI escape sequence to request the cell size in pixels.
|
|
178
178
|
* @see xtermWindowOp
|
|
179
179
|
* @see XTermWindowOp.REPORT_CELL_SIZE_PIXELS
|
|
@@ -191,7 +191,7 @@ export declare const requestCellSizePixels: () => string;
|
|
|
191
191
|
* Requests a report of the terminal window's text area size in pixels.
|
|
192
192
|
* The terminal is expected to respond with a sequence like `CSI 8 ; height ; width t`.
|
|
193
193
|
*
|
|
194
|
-
* Sequence: `CSI 18 t` (which triggers the report `CSI 8 ; height ; width t`)
|
|
194
|
+
* Sequence: `CSI 18 t` (which triggers the report `CSI 8 ; height ; width t`).
|
|
195
195
|
* @returns The ANSI escape sequence to request the text area size in pixels.
|
|
196
196
|
* @see xtermWindowOp
|
|
197
197
|
* @see XTermWindowOp.REPORT_TEXT_AREA_SIZE_PIXELS
|
|
@@ -344,7 +344,7 @@ export declare const restoreMaximizedWindow: () => string;
|
|
|
344
344
|
* Some terminals might use `CSI 10 t` for a general maximize/toggle.
|
|
345
345
|
* This function uses `XTermWindowOp.MAXIMIZE_WINDOW` which is 10.
|
|
346
346
|
*
|
|
347
|
-
* Sequence: `CSI 10 t` (using `XTermWindowOp.MAXIMIZE_WINDOW`)
|
|
347
|
+
* Sequence: `CSI 10 t` (using `XTermWindowOp.MAXIMIZE_WINDOW`).
|
|
348
348
|
* @returns The ANSI escape sequence to maximize the window.
|
|
349
349
|
* @see xtermWindowOp
|
|
350
350
|
* @see XTermWindowOp.MAXIMIZE_WINDOW
|
package/dist/window-ops.js
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as CSI } from './packem_shared/constants-CE7WkXh_.js';
|
|
2
|
+
|
|
3
|
+
var XTermWindowOp = /* @__PURE__ */ ((XTermWindowOp2) => {
|
|
4
|
+
XTermWindowOp2[XTermWindowOp2["DEICONIFY_WINDOW"] = 1] = "DEICONIFY_WINDOW";
|
|
5
|
+
XTermWindowOp2[XTermWindowOp2["ICONIFY_WINDOW"] = 2] = "ICONIFY_WINDOW";
|
|
6
|
+
XTermWindowOp2[XTermWindowOp2["MOVE_WINDOW"] = 3] = "MOVE_WINDOW";
|
|
7
|
+
XTermWindowOp2[XTermWindowOp2["RESIZE_TEXT_AREA_CHARS"] = 4] = "RESIZE_TEXT_AREA_CHARS";
|
|
8
|
+
XTermWindowOp2[XTermWindowOp2["RAISE_WINDOW"] = 5] = "RAISE_WINDOW";
|
|
9
|
+
XTermWindowOp2[XTermWindowOp2["LOWER_WINDOW"] = 6] = "LOWER_WINDOW";
|
|
10
|
+
XTermWindowOp2[XTermWindowOp2["REFRESH_WINDOW"] = 7] = "REFRESH_WINDOW";
|
|
11
|
+
XTermWindowOp2[XTermWindowOp2["RESIZE_TEXT_AREA_PIXELS"] = 8] = "RESIZE_TEXT_AREA_PIXELS";
|
|
12
|
+
XTermWindowOp2[XTermWindowOp2["RESTORE_MAXIMIZED_WINDOW"] = 9] = "RESTORE_MAXIMIZED_WINDOW";
|
|
13
|
+
XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW"] = 10] = "MAXIMIZE_WINDOW";
|
|
14
|
+
XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW_VERTICALLY"] = 10.1] = "MAXIMIZE_WINDOW_VERTICALLY";
|
|
15
|
+
XTermWindowOp2[XTermWindowOp2["MAXIMIZE_WINDOW_HORIZONTALLY"] = 10.2] = "MAXIMIZE_WINDOW_HORIZONTALLY";
|
|
16
|
+
XTermWindowOp2[XTermWindowOp2["UNDO_FULL_SCREEN_MODE"] = 10.3] = "UNDO_FULL_SCREEN_MODE";
|
|
17
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_STATE"] = 11] = "REPORT_WINDOW_STATE";
|
|
18
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_POSITION"] = 13] = "REPORT_WINDOW_POSITION";
|
|
19
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_TEXT_AREA_SIZE_CHARS"] = 14] = "REPORT_TEXT_AREA_SIZE_CHARS";
|
|
20
|
+
XTermWindowOp2[XTermWindowOp2["REQUEST_WINDOW_SIZE_WIN_OP_COMPAT"] = 14] = "REQUEST_WINDOW_SIZE_WIN_OP_COMPAT";
|
|
21
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_CELL_SIZE_PIXELS"] = 16] = "REPORT_CELL_SIZE_PIXELS";
|
|
22
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_TEXT_AREA_SIZE_PIXELS"] = 18] = "REPORT_TEXT_AREA_SIZE_PIXELS";
|
|
23
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_ICON_LABEL"] = 19] = "REPORT_ICON_LABEL";
|
|
24
|
+
XTermWindowOp2[XTermWindowOp2["REPORT_WINDOW_TITLE"] = 21] = "REPORT_WINDOW_TITLE";
|
|
25
|
+
XTermWindowOp2[XTermWindowOp2["PUSH_WINDOW_TITLE"] = 22] = "PUSH_WINDOW_TITLE";
|
|
26
|
+
XTermWindowOp2[XTermWindowOp2["POP_WINDOW_TITLE"] = 23] = "POP_WINDOW_TITLE";
|
|
27
|
+
XTermWindowOp2[XTermWindowOp2["RESIZE_SCREEN_AND_TEXT_AREA"] = 24] = "RESIZE_SCREEN_AND_TEXT_AREA";
|
|
28
|
+
return XTermWindowOp2;
|
|
29
|
+
})(XTermWindowOp || {});
|
|
30
|
+
const xtermWindowOp = (p, ...ps) => {
|
|
31
|
+
const allowedFloats = [10.1 /* MAXIMIZE_WINDOW_VERTICALLY */, 10.2 /* MAXIMIZE_WINDOW_HORIZONTALLY */, 10.3 /* UNDO_FULL_SCREEN_MODE */];
|
|
32
|
+
if (allowedFloats.includes(p)) ; else if (p <= 0) {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
const parameters = [p];
|
|
36
|
+
ps.forEach((value) => {
|
|
37
|
+
if (value >= 0) {
|
|
38
|
+
parameters.push(value);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return `${CSI}${parameters.join(";")}t`;
|
|
42
|
+
};
|
|
43
|
+
const XTWINOPS = xtermWindowOp;
|
|
44
|
+
const resizeTextAreaChars = (height, width) => xtermWindowOp(4 /* RESIZE_TEXT_AREA_CHARS */, height, width);
|
|
45
|
+
const requestTextAreaSizeChars = () => xtermWindowOp(14 /* REQUEST_WINDOW_SIZE_WIN_OP_COMPAT */);
|
|
46
|
+
const requestCellSizePixels = () => xtermWindowOp(16 /* REPORT_CELL_SIZE_PIXELS */);
|
|
47
|
+
const requestTextAreaSizePixels = () => xtermWindowOp(18 /* REPORT_TEXT_AREA_SIZE_PIXELS */);
|
|
48
|
+
const deiconifyWindow = () => xtermWindowOp(1 /* DEICONIFY_WINDOW */);
|
|
49
|
+
const iconifyWindow = () => xtermWindowOp(2 /* ICONIFY_WINDOW */);
|
|
50
|
+
const moveWindow = (x, y) => xtermWindowOp(3 /* MOVE_WINDOW */, x, y);
|
|
51
|
+
const raiseWindow = () => xtermWindowOp(5 /* RAISE_WINDOW */);
|
|
52
|
+
const lowerWindow = () => xtermWindowOp(6 /* LOWER_WINDOW */);
|
|
53
|
+
const refreshWindow = () => xtermWindowOp(7 /* REFRESH_WINDOW */);
|
|
54
|
+
const resizeTextAreaPixels = (height, width) => xtermWindowOp(8 /* RESIZE_TEXT_AREA_PIXELS */, height, width);
|
|
55
|
+
const restoreMaximizedWindow = () => xtermWindowOp(9 /* RESTORE_MAXIMIZED_WINDOW */);
|
|
56
|
+
const maximizeWindow = () => xtermWindowOp(10 /* MAXIMIZE_WINDOW */);
|
|
57
|
+
const reportWindowPosition = () => xtermWindowOp(13 /* REPORT_WINDOW_POSITION */);
|
|
58
|
+
const reportWindowState = () => xtermWindowOp(11 /* REPORT_WINDOW_STATE */);
|
|
59
|
+
const setPageSizeLines = (lines) => xtermWindowOp(24 /* RESIZE_SCREEN_AND_TEXT_AREA */, lines);
|
|
60
|
+
|
|
61
|
+
export { XTWINOPS, XTermWindowOp, deiconifyWindow, iconifyWindow, lowerWindow, maximizeWindow, moveWindow, raiseWindow, refreshWindow, reportWindowPosition, reportWindowState, requestCellSizePixels, requestTextAreaSizeChars, requestTextAreaSizePixels, resizeTextAreaChars, resizeTextAreaPixels, restoreMaximizedWindow, setPageSizeLines, xtermWindowOp };
|
package/dist/xterm.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* XTerm Key Modifier Options XTMODKEYS.
|
|
2
|
+
* XTerm Key Modifier Options (XTMODKEYS).
|
|
3
3
|
* Sets or resets XTerm key modifier resources.
|
|
4
4
|
*
|
|
5
|
-
* Sequence: `CSI > Pp m` (to reset resource Pp)
|
|
6
|
-
* Sequence: `CSI > Pp ; Pv m` (to set resource Pp to value Pv)
|
|
5
|
+
* Sequence: `CSI > Pp m` (to reset resource Pp).
|
|
6
|
+
* Sequence: `CSI > Pp ; Pv m` (to set resource Pp to value Pv).
|
|
7
7
|
* @param resource The resource parameter (Pp), a non-negative integer.
|
|
8
8
|
* @param value Optional. The value parameter (Pv), a non-negative integer. If omitted, the resource is reset.
|
|
9
9
|
* If provided and not positive, it's treated as if omitted (resource is reset).
|
package/dist/xterm.js
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as CSI } from './packem_shared/constants-CE7WkXh_.js';
|
|
2
|
+
|
|
3
|
+
const keyModifierOptions = (resource, value) => {
|
|
4
|
+
if (resource < 0 || !Number.isInteger(resource)) {
|
|
5
|
+
return "";
|
|
6
|
+
}
|
|
7
|
+
const pp = resource.toString();
|
|
8
|
+
if (value !== void 0) {
|
|
9
|
+
if (!Number.isInteger(value)) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
const pv = value.toString();
|
|
13
|
+
return `${CSI}>${pp};${pv}m`;
|
|
14
|
+
}
|
|
15
|
+
return `${CSI}>${pp}m`;
|
|
16
|
+
};
|
|
17
|
+
const XTMODKEYS = keyModifierOptions;
|
|
18
|
+
const queryKeyModifierOptions = (resource) => {
|
|
19
|
+
if (resource < 0 || !Number.isInteger(resource)) {
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
const pp = resource.toString();
|
|
23
|
+
return `${CSI}?${pp}m`;
|
|
24
|
+
};
|
|
25
|
+
const resetKeyModifierOptions = (resource) => keyModifierOptions(resource);
|
|
26
|
+
const setKeyModifierOptions = (resource, value) => keyModifierOptions(resource, value);
|
|
27
|
+
const XTQMODKEYS = queryKeyModifierOptions;
|
|
28
|
+
const setModifyOtherKeys1 = `${CSI}>4;1m`;
|
|
29
|
+
const setModifyOtherKeys2 = `${CSI}>4;2m`;
|
|
30
|
+
const resetModifyOtherKeys = `${CSI}>4m`;
|
|
31
|
+
const queryModifyOtherKeys = `${CSI}?4m`;
|
|
32
|
+
|
|
33
|
+
export { XTMODKEYS, XTQMODKEYS, keyModifierOptions, queryKeyModifierOptions, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, setModifyOtherKeys1, setModifyOtherKeys2 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/ansi",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"description": "ANSI escape codes for some terminal swag.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alternative-screen",
|
|
@@ -156,8 +156,6 @@
|
|
|
156
156
|
"dependencies": {
|
|
157
157
|
"type-fest": "5.5.0"
|
|
158
158
|
},
|
|
159
|
-
"peerDependencies": {},
|
|
160
|
-
"optionalDependencies": {},
|
|
161
159
|
"engines": {
|
|
162
160
|
"node": ">=22.13 <=25.x"
|
|
163
161
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var l=Object.defineProperty;var r=(e,t)=>l(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,i=r((e,t)=>n(e,"name",{value:t,configurable:!0}),"e");const o="auto",c=i(e=>e.toString(),"it2Cells"),s=i(e=>`${e}px`,"it2Pixels"),P=i(e=>`${e}%`,"it2Percent");export{o as IT2_AUTO,c as it2Cells,P as it2Percent,s as it2Pixels};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var l=Object.defineProperty;var r=(t,e)=>l(t,"name",{value:e,configurable:!0});import{createRequire as a}from"node:module";const h=a(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,i]=s.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return s.getBuiltinModule(t)}return h(t)},"__cjs_getBuiltinModule"),{Buffer:c}=u("node:buffer");var p=Object.defineProperty,o=r((t,e)=>p(t,"name",{value:e,configurable:!0}),"t");const n=o(t=>{const e=[];return t.name&&e.push(`name=${t.name}`),t.size!==void 0&&e.push(`size=${t.size}`),t.width!==void 0&&e.push(`width=${t.width.toString()}`),t.height!==void 0&&e.push(`height=${t.height.toString()}`),t.ignoreAspectRatio&&e.push("preserveAspectRatio=0"),t.inline&&e.push("inline=1"),t.doNotMoveCursor&&e.push("doNotMoveCursor=1"),e.join(";")},"formatITerm2FileProperties");class m{static{r(this,"ITerm2File")}static{o(this,"ITerm2File")}fileProps;constructor(e,i){if(this.fileProps={...e},i){if(i.byteLength>10*1024*1024)throw new Error("File size exceeds maximum limit of 10MB");if(this.fileProps.content=c.from(i).toString("base64"),this.fileProps.size===void 0&&(this.fileProps.size=i.byteLength),this.fileProps.size!==i.byteLength)throw new Error("File size property doesn't match actual data length")}}toString(){let e="File=";return e+=n(this.fileProps),this.fileProps.content!==void 0&&(e+=`:${this.fileProps.content}`),e}}class g{static{r(this,"ITerm2FileEnd")}static{o(this,"ITerm2FileEnd")}toString(){return"FileEnd"}}class F{static{r(this,"ITerm2FilePart")}constructor(e){this.base64Chunk=e}static{o(this,"ITerm2FilePart")}toString(){return`FilePart=${this.base64Chunk}`}}class P{static{r(this,"ITerm2MultipartFileStart")}constructor(e){this.properties=e}static{o(this,"ITerm2MultipartFileStart")}toString(){return`MultipartFile=${n(this.properties)}`}}export{m as ITerm2File,g as ITerm2FileEnd,F as ITerm2FilePart,P as ITerm2MultipartFileStart};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const a="\x1B",s="\x1B[",x="\x1B]",B="\x07",S=";",C="\x1BP",E="\x1B\\";export{B,s as C,C as D,a as E,x as O,S,E as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var l=Object.defineProperty;var n=(r,o)=>l(r,"name",{value:o,configurable:!0});import{C as s,S as u,E as c}from"./constants-D12jy2Zh.js";import"./restoreCursor-CHy0jZuu.js";const i=globalThis?.window?.document!==void 0,t=!i&&process.env.TERM_PROGRAM==="Apple_Terminal",T=!i&&(process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE));var $=Object.defineProperty,a=n((r,o)=>$(r,"name",{value:o,configurable:!0}),"n");const S=`${c}7`,d=`${c}8`,w=`${s}A`,U=`${s}B`,k=`${s}C`,p=`${s}D`,v=`${s}6n`,A=`${s}?6n`,R=a((r=1)=>`${s+r}D`,"cursorBackward"),D=a((r=1)=>`${s+r}B`,"cursorDown"),y=a((r=1)=>`${s+r}C`,"cursorForward"),b=`${s}?25l`,g=`${s}G`,m=a((r=1)=>R(r),"cursorLeft"),C=a((r=1)=>`${s+r}G`,"cursorHorizontalAbsolute"),P=a((r,o)=>{let e="";return r<0?e+=`${s+-r}D`:r>0&&(e+=`${s+r}C`),o<0?e+=`${s+-o}A`:o>0&&(e+=`${s+o}B`),e},"cursorMove"),f=a((r=1)=>`${s+r}E`,"cursorNextLine"),H=a((r=1)=>`${s+r}F`,"cursorPreviousLine"),h=t?d:`${c}u`,F=t?S:`${c}s`,I=`${s}?25h`,L=a((r,o)=>o===void 0?C(r+1):`${s+(o+1)+u+(r+1)}H`,"cursorTo"),N=a((r,o)=>o===void 0?`${s+r}H`:`${s+r+u+o}H`,"cursorPosition"),z=a((r=1)=>`${s+r}I`,"cursorHorizontalForwardTab"),x=a((r=1)=>`${s+r}Z`,"cursorBackwardTab"),M=a((r=1)=>`${s+r}X`,"eraseCharacter"),W=a((r=1)=>`${s+r}d`,"cursorVerticalAbsolute"),G=a((r=1)=>`${s+r}A`,"cursorUp");var B=(r=>(r[r.BlinkingBar=5]="BlinkingBar",r[r.BlinkingBlock=1]="BlinkingBlock",r[r.BlinkingUnderline=3]="BlinkingUnderline",r[r.Default=0]="Default",r[r.SteadyBar=6]="SteadyBar",r[r.SteadyBlock=2]="SteadyBlock",r[r.SteadyUnderline=4]="SteadyUnderline",r))(B||{});const V=a(r=>`${s+r} q`,"setCursorStyle");export{T as A,B,p as C,v as R,S,U as a,k as b,w as c,A as d,d as e,R as f,x as g,D as h,y as i,b as j,C as k,z as l,m,P as n,f as o,N as p,H as q,h as r,F as s,I as t,L as u,g as v,G as w,W as x,M as y,V as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(r,e)=>o(r,"name",{value:e,configurable:!0});import{O as t,B as s}from"./constants-D12jy2Zh.js";var $=Object.defineProperty,a=n((r,e)=>$(r,"name",{value:e,configurable:!0}),"n");const B=`${t}9;4;0${s}`,i=a(r=>{const e=Math.min(Math.max(0,r),100);return`${t}9;4;1;${e}${s}`},"setProgressBar"),P=a(r=>{const e=Math.min(Math.max(0,r),100);return`${t}9;4;2;${e}${s}`},"setErrorProgressBar"),c=`${t}9;4;3${s}`,h=a(r=>{const e=Math.min(Math.max(0,r),100);return`${t}9;4;4;${e}${s}`},"setWarningProgressBar");export{B as resetProgressBar,P as setErrorProgressBar,c as setIndeterminateProgressBar,i as setProgressBar,h as setWarningProgressBar};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var _=Object.defineProperty;var s=(e,t)=>_(e,"name",{value:t,configurable:!0});import{createRequire as E}from"node:module";const B=E(import.meta.url),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=P;var I=Object.defineProperty,l=s((e,t)=>I(e,"name",{value:t,configurable:!0}),"r$2");const T=l((e,t,i,r)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const n=Object.getOwnPropertyDescriptor(e,i),o=Object.getOwnPropertyDescriptor(t,i);!v(n,o)&&r||Object.defineProperty(e,i,o)},"copyProperty"),v=l(function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},"canCopyProperty"),G=l((e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},"changePrototype"),j=l((e,t)=>`/* Wrapped ${e}*/
|
|
2
|
-
${t}`,"wrappedToString"),$=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),L=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),R=l((e,t,i)=>{const r=i===""?"":`with ${i.trim()}() `,n=j.bind(null,r,t.toString());Object.defineProperty(n,"name",L);const{writable:o,enumerable:u,configurable:m}=$;Object.defineProperty(e,"toString",{value:n,writable:o,enumerable:u,configurable:m})},"changeToString");function S(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:r}=e;for(const n of Reflect.ownKeys(t))T(e,t,n,i);return G(e,t),R(e,t,r),e}s(S,"P");l(S,"mimicFunction");var C=Object.defineProperty,b=s((e,t)=>C(e,"name",{value:t,configurable:!0}),"a$1");const p=new WeakMap,w=b((e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let i,r=0;const n=e.displayName||e.name||"<anonymous>",o=b(function(...u){if(p.set(o,++r),r===1)i=e.apply(this,u),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${n}\` can only be called once`);return i},"onetime");return S(o,e),p.set(o,r),o},"onetime");w.callCount=e=>{if(!p.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return p.get(e)};const a=[];a.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&a.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&a.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var F=Object.defineProperty,c=s((e,t)=>F(e,"name",{value:t,configurable:!0}),"r$1");const h=c(e=>!!e&&!0&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function","processOk"),d=Symbol.for("signal-exit emitter"),g=globalThis,k=Object.defineProperty.bind(Object);class U{static{s(this,"y")}static{c(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g[d])return g[d];k(g,d,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,i){this.listeners[t].push(i)}removeListener(t,i){const r=this.listeners[t],n=r.indexOf(i);n!==-1&&(n===0&&r.length===1?r.length=0:r.splice(n,1))}emit(t,i,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(const o of this.listeners[t])n=o(i,r)===!0||n;return t==="exit"&&(n=this.emit("afterExit",i,r)||n),n}}class O{static{s(this,"c")}static{c(this,"SignalExitBase")}}const M=c(e=>({onExit(t,i){return e.onExit(t,i)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap");class A extends O{static{s(this,"_")}static{c(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}}class D extends O{static{s(this,"p")}static{c(this,"SignalExit")}#s=y.platform==="win32"?"SIGINT":"SIGHUP";#e=new U;#t;#n;#o;#r={};#i=!1;constructor(t){super(),this.#t=t,this.#r={};for(const i of a)this.#r[i]=()=>{const r=this.#t.listeners(i);let{count:n}=this.#e;const o=t;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(n+=o.__signal_exit_emitter__.count),r.length===n){this.unload();const u=this.#e.emit("exit",null,i),m=i==="SIGHUP"?this.#s:i;u||t.kill(t.pid,m)}};this.#o=t.reallyExit,this.#n=t.emit}onExit(t,i){if(!h(this.#t))return()=>{};this.#i===!1&&this.load();const r=i?.alwaysLast?"afterExit":"exit";return this.#e.on(r,t),()=>{this.#e.removeListener(r,t),this.#e.listeners.exit.length===0&&this.#e.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#e.count+=1;for(const t of a)try{const i=this.#r[t];i&&this.#t.on(t,i)}catch{}this.#t.emit=(t,...i)=>this.#l(t,...i),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#i&&(this.#i=!1,a.forEach(t=>{const i=this.#r[t];if(!i)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,i)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#e.count-=1)}#a(t){return h(this.#t)?(this.#t.exitCode=t||0,this.#e.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#l(t,...i){const r=this.#n;if(t==="exit"&&h(this.#t)){typeof i[0]=="number"&&(this.#t.exitCode=i[0]);const n=r.call(this.#t,t,...i);return this.#e.emit("exit",this.#t.exitCode,null),n}else return r.call(this.#t,t,...i)}}const y=globalThis.process,{onExit:N}=M(h(y)?new D(y):new A),x=f.stderr.isTTY?f.stderr:f.stdout.isTTY?f.stdout:void 0,H=x?w(()=>{N(()=>{x.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{};export{H as default};
|