@visulima/ansi 4.0.0-alpha.13 → 4.0.0-alpha.14
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 +15 -0
- package/LICENSE.md +0 -3
- package/README.md +3 -0
- package/dist/alternative-screen.d.ts +71 -70
- package/dist/alternative-screen.js +1 -8
- package/dist/clear.d.ts +74 -73
- package/dist/clear.js +1 -10
- package/dist/cursor.d.ts +421 -406
- package/dist/cursor.js +1 -3
- package/dist/erase.d.ts +193 -192
- package/dist/erase.js +1 -47
- package/dist/hyperlink.d.ts +25 -25
- package/dist/hyperlink.js +1 -5
- package/dist/image.d.ts +71 -70
- package/dist/image.js +1 -40
- package/dist/index.d.ts +65 -35
- package/dist/index.js +1 -26
- package/dist/iterm2.d.ts +285 -58
- package/dist/iterm2.js +1 -12
- package/dist/mode.d.ts +585 -584
- package/dist/mode.js +1 -245
- package/dist/mouse.d.ts +227 -226
- package/dist/mouse.js +1 -106
- package/dist/packem_shared/IT2_AUTO-OiB8EaxU.js +1 -0
- package/dist/packem_shared/ITerm2File-XoC8RMzs.js +1 -0
- package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
- package/dist/packem_shared/cursor-BAcJR4p_.js +1 -0
- package/dist/packem_shared/resetProgressBar-H_gzPKNE.js +1 -0
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +2 -0
- package/dist/passthrough.d.ts +74 -73
- package/dist/passthrough.js +1 -29
- package/dist/reset.d.ts +25 -24
- package/dist/reset.js +1 -4
- package/dist/screen.d.ts +226 -225
- package/dist/screen.js +1 -27
- package/dist/scroll.d.ts +64 -63
- package/dist/scroll.js +1 -18
- package/dist/status.d.ts +521 -520
- package/dist/status.js +1 -95
- package/dist/strip.d.ts +1 -1
- package/dist/strip.js +1 -13
- package/dist/termcap.d.ts +36 -35
- package/dist/termcap.js +1 -25
- package/dist/title.d.ts +176 -175
- package/dist/title.js +1 -19
- package/dist/window-ops.d.ts +399 -398
- package/dist/window-ops.js +1 -61
- package/dist/xterm.d.ts +85 -84
- package/dist/xterm.js +1 -33
- package/package.json +2 -5
- package/dist/constants.d.ts +0 -20
- package/dist/helpers.d.ts +0 -14
- package/dist/iterm2/iterm2-properties.d.ts +0 -135
- package/dist/iterm2/iterm2-sequences.d.ts +0 -96
- package/dist/packem_shared/IT2_AUTO-DyYWsxno.js +0 -6
- package/dist/packem_shared/ITerm2File-CUZDBk99.js +0 -137
- package/dist/packem_shared/constants-CE7WkXh_.js +0 -9
- package/dist/packem_shared/cursor-ChpV7cgs.js +0 -72
- package/dist/packem_shared/resetProgressBar-D9r2s7eV.js +0 -18
- package/dist/packem_shared/restoreCursor-GfYEeJqN.js +0 -323
- package/dist/progress.d.ts +0 -41
package/dist/passthrough.d.ts
CHANGED
|
@@ -1,77 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
* Default value for the `limit` parameter in {@link screenPassthrough}, indicating no chunking.
|
|
3
|
+
* When this value is used (or any value <= 0), the passthrough sequence is not split into smaller chunks.
|
|
4
|
+
*/
|
|
5
|
+
declare const SCREEN_MAX_LEN_DEFAULT: number;
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
* A typical limit for string sequences in GNU Screen (e.g., 768 bytes).
|
|
8
|
+
* This constant can be used as a practical value for the `limit` parameter in {@link screenPassthrough}
|
|
9
|
+
* to avoid issues with Screen's internal buffers, though the function itself defaults to no limit.
|
|
10
|
+
* It's provided for informational purposes and as a suggested practical chunking limit.
|
|
11
|
+
*/
|
|
12
|
+
declare const SCREEN_TYPICAL_LIMIT: number;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
14
|
+
* Wraps a given ANSI escape sequence in a DCS (Device Control String) passthrough sequence
|
|
15
|
+
* specifically for GNU Screen. This allows raw escape sequences to be sent to the
|
|
16
|
+
* terminal emulator that is hosting Screen, bypassing Screen's own interpretation.
|
|
17
|
+
*
|
|
18
|
+
* The basic format is: `DCS <data> ST` (where `DCS` is `ESC P` and `ST` is `ESC \`).
|
|
19
|
+
*
|
|
20
|
+
* GNU Screen has limitations on the length of string sequences it can handle (often around 768 bytes).
|
|
21
|
+
* This function can optionally chunk the input `sequence` into smaller parts, each wrapped
|
|
22
|
+
* in its own `DCS...ST` sequence, to work around this limitation.
|
|
23
|
+
* @param sequence The ANSI escape sequence string to be wrapped.
|
|
24
|
+
* @param limit The maximum length for each chunk of the `sequence` before it's wrapped.
|
|
25
|
+
* If `0` or a negative number, the sequence is not chunked. Defaults to {@link SCREEN_MAX_LEN_DEFAULT} (0).
|
|
26
|
+
* Consider using {@link SCREEN_TYPICAL_LIMIT} (768) for practical chunking with Screen.
|
|
27
|
+
* @returns The wrapped string, possibly chunked into multiple `DCS...ST` sequences if `limit` is positive and the `sequence` exceeds it.
|
|
28
|
+
* @see {@link https://www.gnu.org/software/screen/manual/screen.html#String-Escapes} GNU Screen Manual - String Escapes.
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { screenPassthrough, SCREEN_TYPICAL_LIMIT } from \'@visulima/ansi/passthrough\';
|
|
32
|
+
* import { cursorShow, cursorHide } from \'@visulima/ansi/cursor\';
|
|
33
|
+
*
|
|
34
|
+
* const longSequence = cursorHide + "Some very long output..." + cursorShow;
|
|
35
|
+
*
|
|
36
|
+
* // No chunking (default behavior if sequence is short enough or limit is 0)
|
|
37
|
+
* const passthrough1 = screenPassthrough(cursorHide);
|
|
38
|
+
* console.log(JSON.stringify(passthrough1)); // "\u001bP?25l\u001b\\"
|
|
39
|
+
*
|
|
40
|
+
* // With chunking, assuming SCREEN_TYPICAL_LIMIT is small for demonstration
|
|
41
|
+
* const limitedPassthrough = screenPassthrough(longSequence, 10); // Hypothetical small limit
|
|
42
|
+
* // Example output if longSequence was "0123456789abcde" and limit 10:
|
|
43
|
+
* // "\u001bP0123456789\u001b\\\u001bPabcde\u001b\\"
|
|
44
|
+
* console.log(JSON.stringify(limitedPassthrough));
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare const screenPassthrough: (sequence: string, limit?: number) => string;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
49
|
+
* Wraps a given ANSI escape sequence in a special DCS (Device Control String) passthrough sequence
|
|
50
|
+
* designed for tmux (Terminal Multiplexer). This allows raw escape sequences to be sent to the
|
|
51
|
+
* terminal emulator hosting tmux, bypassing tmux's own interpretation.
|
|
52
|
+
*
|
|
53
|
+
* The format is: `DCS tmux ; <escaped-data> ST`
|
|
54
|
+
* (where `DCS` is `ESC P`, and `ST` is `ESC \`).
|
|
55
|
+
*
|
|
56
|
+
* The `<escaped-data>` is the original `sequence` with all occurrences of the ESC character (`\u001B`)
|
|
57
|
+
* doubled (i.e., `ESC` becomes `ESC ESC`).
|
|
58
|
+
*
|
|
59
|
+
* **Note:** For this to work, the tmux option `allow-passthrough` must be enabled (`on`) in the tmux configuration.
|
|
60
|
+
* By default, it might be off.
|
|
61
|
+
* @param sequence The ANSI escape sequence string to be wrapped and properly escaped for tmux.
|
|
62
|
+
* @returns The wrapped and escaped string suitable for tmux passthrough.
|
|
63
|
+
* @see {@link https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it} Tmux FAQ on Passthrough.
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { tmuxPassthrough } from \'@visulima/ansi/passthrough\';
|
|
67
|
+
* import { cursorShow } from \'@visulima/ansi/cursor\';
|
|
68
|
+
*
|
|
69
|
+
* const originalSequence = cursorShow; // e.g., "\u001b[?25h"
|
|
70
|
+
* const passthrough = tmuxPassthrough(originalSequence);
|
|
71
|
+
*
|
|
72
|
+
* // Expected: "\u001bPtmux;\u001b\u001b[?25h\u001b\\"
|
|
73
|
+
* // (ESC P tmux ; ESC ESC [ ? 2 5 h ESC \)
|
|
74
|
+
* console.log(JSON.stringify(passthrough));
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare const tmuxPassthrough: (sequence: string) => string;
|
|
78
|
+
export { SCREEN_MAX_LEN_DEFAULT, SCREEN_TYPICAL_LIMIT, screenPassthrough, tmuxPassthrough };
|
package/dist/passthrough.js
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const SCREEN_MAX_LEN_DEFAULT = 0;
|
|
4
|
-
const SCREEN_TYPICAL_LIMIT = 768;
|
|
5
|
-
const screenPassthrough = (sequence, limit = SCREEN_MAX_LEN_DEFAULT) => {
|
|
6
|
-
let result = DCS;
|
|
7
|
-
if (limit > 0 && sequence.length > limit) {
|
|
8
|
-
for (let index = 0; index < sequence.length; index += limit) {
|
|
9
|
-
const end = Math.min(index + limit, sequence.length);
|
|
10
|
-
result += sequence.slice(index, end);
|
|
11
|
-
if (end < sequence.length) {
|
|
12
|
-
result += ST + DCS;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
result += sequence;
|
|
17
|
-
}
|
|
18
|
-
result += ST;
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
const tmuxPassthrough = (sequence) => {
|
|
22
|
-
let escapedSequence = "";
|
|
23
|
-
for (const element of sequence) {
|
|
24
|
-
escapedSequence += element === ESC ? ESC + ESC : element;
|
|
25
|
-
}
|
|
26
|
-
return `${DCS}tmux;${escapedSequence}${ST}`;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export { SCREEN_MAX_LEN_DEFAULT, SCREEN_TYPICAL_LIMIT, screenPassthrough, tmuxPassthrough };
|
|
1
|
+
var g=Object.defineProperty;var l=(e,t)=>g(e,"name",{value:t,configurable:!0});import{a as o,D as a,E as n}from"./packem_shared/constants-D12jy2Zh.js";var c=Object.defineProperty,u=l((e,t)=>c(e,"name",{value:t,configurable:!0}),"o");const E=0,i=768,P=u((e,t=E)=>{let r=a;if(t>0&&e.length>t)for(let s=0;s<e.length;s+=t){const h=Math.min(s+t,e.length);r+=e.slice(s,h),h<e.length&&(r+=o+a)}else r+=e;return r+=o,r},"screenPassthrough"),x=u(e=>{let t="";for(const r of e)t+=r===n?n+n:r;return`${a}tmux;${t}${o}`},"tmuxPassthrough");export{E as SCREEN_MAX_LEN_DEFAULT,i as SCREEN_TYPICAL_LIMIT,P as screenPassthrough,x as tmuxPassthrough};
|
package/dist/reset.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
* The ANSI escape sequence for Reset Initial State (RIS).
|
|
3
|
+
* This command attempts to reset the terminal to its power-up state or initial configuration.
|
|
4
|
+
* The exact behavior can vary between terminal emulators, but it typically includes:
|
|
5
|
+
* - Resetting graphic rendition (SGR parameters) to default.
|
|
6
|
+
* - Clearing the screen.
|
|
7
|
+
* - Moving the cursor to the top-left (home position).
|
|
8
|
+
* - Resetting character sets.
|
|
9
|
+
* - Resetting tab stops.
|
|
10
|
+
* - Resetting modes (like DECAWM, DECOM) to their defaults.
|
|
11
|
+
*
|
|
12
|
+
* Sequence: `ESC c`
|
|
13
|
+
*
|
|
14
|
+
* This is a more comprehensive reset than `CSI 0 m` (which only resets SGR) or `CSI 2 J` (which only clears the screen).
|
|
15
|
+
* It is often referred to as a "hard reset".
|
|
16
|
+
* @see {@link https://vt100.net/docs/vt510-rm/RIS.html VT510 RIS Documentation}
|
|
17
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Reset} Xterm Control Sequences - Reset
|
|
18
|
+
*/
|
|
19
|
+
declare const RESET_INITIAL_STATE: string;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
* Alias for {@link RESET_INITIAL_STATE} (Reset Initial State).
|
|
22
|
+
*
|
|
23
|
+
* Provides a shorter name for the RIS sequence `ESC c`.
|
|
24
|
+
* @see {@link RESET_INITIAL_STATE}
|
|
25
|
+
*/
|
|
26
|
+
declare const RIS: string;
|
|
27
|
+
export { RESET_INITIAL_STATE, RIS };
|
package/dist/reset.js
CHANGED