@visulima/ansi 4.0.0-alpha.9 → 4.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 (85) hide show
  1. package/CHANGELOG.md +290 -0
  2. package/LICENSE.md +0 -20
  3. package/README.md +41 -10
  4. package/dist/alternative-screen.d.ts +71 -70
  5. package/dist/alternative-screen.js +1 -8
  6. package/dist/background.d.ts +72 -0
  7. package/dist/background.js +1 -0
  8. package/dist/charset.d.ts +52 -0
  9. package/dist/charset.js +1 -0
  10. package/dist/clear.d.ts +74 -73
  11. package/dist/clear.js +1 -10
  12. package/dist/clipboard.d.ts +76 -0
  13. package/dist/clipboard.js +1 -0
  14. package/dist/constants.d.ts +18 -10
  15. package/dist/constants.js +1 -0
  16. package/dist/cursor.d.ts +421 -406
  17. package/dist/cursor.js +1 -3
  18. package/dist/cwd.d.ts +26 -0
  19. package/dist/cwd.js +1 -0
  20. package/dist/erase.d.ts +193 -192
  21. package/dist/erase.js +1 -47
  22. package/dist/finalterm.d.ts +47 -0
  23. package/dist/finalterm.js +1 -0
  24. package/dist/focus.d.ts +20 -0
  25. package/dist/focus.js +1 -0
  26. package/dist/hyperlink.d.ts +25 -25
  27. package/dist/hyperlink.js +1 -5
  28. package/dist/image.d.ts +70 -70
  29. package/dist/image.js +1 -40
  30. package/dist/index.d.ts +38 -35
  31. package/dist/index.js +1 -26
  32. package/dist/iterm2.d.ts +285 -58
  33. package/dist/iterm2.js +1 -12
  34. package/dist/keypad.d.ts +27 -0
  35. package/dist/keypad.js +1 -0
  36. package/dist/kitty-graphics.d.ts +17 -0
  37. package/dist/kitty-graphics.js +1 -0
  38. package/dist/mode.d.ts +585 -584
  39. package/dist/mode.js +1 -245
  40. package/dist/mouse.d.ts +227 -226
  41. package/dist/mouse.js +1 -106
  42. package/dist/notification.d.ts +30 -0
  43. package/dist/notification.js +1 -0
  44. package/dist/packem_shared/IT2_AUTO-K3GubKy7.js +1 -0
  45. package/dist/packem_shared/ITerm2File-BkLc5ipB.js +1 -0
  46. package/dist/packem_shared/cursor-BXG1O_IE.js +1 -0
  47. package/dist/packem_shared/restoreCursor-CyaXIMQf.js +2 -0
  48. package/dist/passthrough.d.ts +74 -73
  49. package/dist/passthrough.js +1 -29
  50. package/dist/paste.d.ts +23 -0
  51. package/dist/paste.js +1 -0
  52. package/dist/progress.d.ts +37 -36
  53. package/dist/progress.js +1 -0
  54. package/dist/reset.d.ts +25 -24
  55. package/dist/reset.js +1 -4
  56. package/dist/screen.d.ts +226 -225
  57. package/dist/screen.js +1 -27
  58. package/dist/scroll.d.ts +64 -63
  59. package/dist/scroll.js +1 -18
  60. package/dist/sixel.d.ts +19 -0
  61. package/dist/sixel.js +1 -0
  62. package/dist/status.d.ts +521 -520
  63. package/dist/status.js +1 -95
  64. package/dist/strip.d.ts +26 -1
  65. package/dist/strip.js +1 -13
  66. package/dist/termcap.d.ts +36 -35
  67. package/dist/termcap.js +1 -25
  68. package/dist/title.d.ts +176 -175
  69. package/dist/title.js +1 -19
  70. package/dist/urxvt.d.ts +15 -0
  71. package/dist/urxvt.js +1 -0
  72. package/dist/window-ops.d.ts +399 -398
  73. package/dist/window-ops.js +1 -61
  74. package/dist/xterm.d.ts +167 -84
  75. package/dist/xterm.js +1 -33
  76. package/package.json +60 -9
  77. package/dist/helpers.d.ts +0 -14
  78. package/dist/iterm2/iterm2-properties.d.ts +0 -135
  79. package/dist/iterm2/iterm2-sequences.d.ts +0 -96
  80. package/dist/packem_shared/IT2_AUTO-DyYWsxno.js +0 -6
  81. package/dist/packem_shared/ITerm2File-CUZDBk99.js +0 -137
  82. package/dist/packem_shared/constants-CE7WkXh_.js +0 -9
  83. package/dist/packem_shared/cursor-ChpV7cgs.js +0 -72
  84. package/dist/packem_shared/resetProgressBar-D9r2s7eV.js +0 -18
  85. package/dist/packem_shared/restoreCursor-GfYEeJqN.js +0 -323
@@ -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 };
1
+ import{CSI as T}from"./constants.js";var E=(_=>(_[_.DEICONIFY_WINDOW=1]="DEICONIFY_WINDOW",_[_.ICONIFY_WINDOW=2]="ICONIFY_WINDOW",_[_.MOVE_WINDOW=3]="MOVE_WINDOW",_[_.RESIZE_TEXT_AREA_CHARS=4]="RESIZE_TEXT_AREA_CHARS",_[_.RAISE_WINDOW=5]="RAISE_WINDOW",_[_.LOWER_WINDOW=6]="LOWER_WINDOW",_[_.REFRESH_WINDOW=7]="REFRESH_WINDOW",_[_.RESIZE_TEXT_AREA_PIXELS=8]="RESIZE_TEXT_AREA_PIXELS",_[_.RESTORE_MAXIMIZED_WINDOW=9]="RESTORE_MAXIMIZED_WINDOW",_[_.MAXIMIZE_WINDOW=10]="MAXIMIZE_WINDOW",_[_.MAXIMIZE_WINDOW_VERTICALLY=10.1]="MAXIMIZE_WINDOW_VERTICALLY",_[_.MAXIMIZE_WINDOW_HORIZONTALLY=10.2]="MAXIMIZE_WINDOW_HORIZONTALLY",_[_.UNDO_FULL_SCREEN_MODE=10.3]="UNDO_FULL_SCREEN_MODE",_[_.REPORT_WINDOW_STATE=11]="REPORT_WINDOW_STATE",_[_.REPORT_WINDOW_POSITION=13]="REPORT_WINDOW_POSITION",_[_.REPORT_TEXT_AREA_SIZE_CHARS=14]="REPORT_TEXT_AREA_SIZE_CHARS",_[_.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT=14]="REQUEST_WINDOW_SIZE_WIN_OP_COMPAT",_[_.REPORT_CELL_SIZE_PIXELS=16]="REPORT_CELL_SIZE_PIXELS",_[_.REPORT_TEXT_AREA_SIZE_PIXELS=18]="REPORT_TEXT_AREA_SIZE_PIXELS",_[_.REPORT_ICON_LABEL=19]="REPORT_ICON_LABEL",_[_.REPORT_WINDOW_TITLE=21]="REPORT_WINDOW_TITLE",_[_.PUSH_WINDOW_TITLE=22]="PUSH_WINDOW_TITLE",_[_.POP_WINDOW_TITLE=23]="POP_WINDOW_TITLE",_[_.RESIZE_SCREEN_AND_TEXT_AREA=24]="RESIZE_SCREEN_AND_TEXT_AREA",_))(E||{});const I=(_,...W)=>{if(![10.1,10.2,10.3].includes(_)&&_<=0)return"";const O=[_];return W.forEach(R=>{R>=0&&O.push(R)}),`${T}${O.join(";")}t`},A=I,S=(_,W)=>I(4,_,W),e=()=>I(14),D=()=>I(16),i=()=>I(18),P=()=>I(1),L=()=>I(2),r=(_,W)=>I(3,_,W),o=()=>I(5),X=()=>I(6),C=()=>I(7),Z=(_,W)=>I(8,_,W),t=()=>I(9),M=()=>I(10),n=()=>I(13),s=()=>I(11),d=_=>I(24,_);export{A as XTWINOPS,E as XTermWindowOp,P as deiconifyWindow,L as iconifyWindow,X as lowerWindow,M as maximizeWindow,r as moveWindow,o as raiseWindow,C as refreshWindow,n as reportWindowPosition,s as reportWindowState,D as requestCellSizePixels,e as requestTextAreaSizeChars,i as requestTextAreaSizePixels,S as resizeTextAreaChars,Z as resizeTextAreaPixels,t as restoreMaximizedWindow,d as setPageSizeLines,I as xtermWindowOp};
package/dist/xterm.d.ts CHANGED
@@ -1,94 +1,177 @@
1
1
  /**
2
- * XTerm Key Modifier Options (XTMODKEYS).
3
- * Sets or resets XTerm key modifier resources.
4
- *
5
- * Sequence: `CSI > Pp m` (to reset resource Pp).
6
- * Sequence: `CSI > Pp ; Pv m` (to set resource Pp to value Pv).
7
- * @param resource The resource parameter (Pp), a non-negative integer.
8
- * @param value Optional. The value parameter (Pv), a non-negative integer. If omitted, the resource is reset.
9
- * If provided and not positive, it's treated as if omitted (resource is reset).
10
- * @returns The ANSI escape sequence.
11
- * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_}
12
- */
13
- export declare const keyModifierOptions: (resource: number, value?: number) => string;
2
+ * XTerm Key Modifier Options (XTMODKEYS).
3
+ * Sets or resets XTerm key modifier resources.
4
+ *
5
+ * Sequence: `CSI > Pp m` (to reset resource Pp).
6
+ * Sequence: `CSI > Pp ; Pv m` (to set resource Pp to value Pv).
7
+ * @param resource The resource parameter (Pp), a non-negative integer.
8
+ * @param value Optional. The value parameter (Pv), a non-negative integer. If omitted, the resource is reset.
9
+ * If provided and not positive, it's treated as if omitted (resource is reset).
10
+ * @returns The ANSI escape sequence.
11
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_}
12
+ */
13
+ declare const keyModifierOptions: (resource: number, value?: number) => string;
14
14
  /**
15
- * Alias for {@link keyModifierOptions}.
16
- * Provides a shorthand for setting or resetting XTerm key modifier resources.
17
- * @see keyModifierOptions
18
- */
19
- export declare const XTMODKEYS: (resource: number, value?: number) => string;
15
+ * Alias for {@link keyModifierOptions}.
16
+ * Provides a shorthand for setting or resetting XTerm key modifier resources.
17
+ * @see keyModifierOptions
18
+ */
19
+ declare const XTMODKEYS: (resource: number, value?: number) => string;
20
20
  /**
21
- * Query XTerm Key Modifier Options (XTQMODKEYS).
22
- * Requests the current setting of an XTerm key modifier resource.
23
- *
24
- * Sequence: `CSI ? Pp m`
25
- * @param resource The resource parameter (Pp), a non-negative integer.
26
- * @returns The ANSI escape sequence.
27
- * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_}
28
- */
29
- export declare const queryKeyModifierOptions: (resource: number) => string;
21
+ * Query XTerm Key Modifier Options (XTQMODKEYS).
22
+ * Requests the current setting of an XTerm key modifier resource.
23
+ *
24
+ * Sequence: `CSI ? Pp m`
25
+ * @param resource The resource parameter (Pp), a non-negative integer.
26
+ * @returns The ANSI escape sequence.
27
+ * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_}
28
+ */
29
+ declare const queryKeyModifierOptions: (resource: number) => string;
30
30
  /**
31
- * Resets an XTerm key modifier resource to its initial value.
32
- * This is an alias for `keyModifierOptions(resource)`.
33
- * @param resource The resource parameter (Pp).
34
- */
35
- export declare const resetKeyModifierOptions: (resource: number) => string;
31
+ * Resets an XTerm key modifier resource to its initial value.
32
+ * This is an alias for `keyModifierOptions(resource)`.
33
+ * @param resource The resource parameter (Pp).
34
+ */
35
+ declare const resetKeyModifierOptions: (resource: number) => string;
36
36
  /**
37
- * Sets an XTerm key modifier resource to a specific value.
38
- * This is a more explicit alias for `keyModifierOptions(resource, value)`.
39
- * @param resource The resource parameter (Pp).
40
- * @param value The value parameter (Pv).
41
- */
42
- export declare const setKeyModifierOptions: (resource: number, value: number) => string;
37
+ * Sets an XTerm key modifier resource to a specific value.
38
+ * This is a more explicit alias for `keyModifierOptions(resource, value)`.
39
+ * @param resource The resource parameter (Pp).
40
+ * @param value The value parameter (Pv).
41
+ */
42
+ declare const setKeyModifierOptions: (resource: number, value: number) => string;
43
43
  /** Alias for {@link queryKeyModifierOptions}. */
44
- export declare const XTQMODKEYS: (resource: number) => string;
44
+ declare const XTQMODKEYS: (resource: number) => string;
45
45
  /**
46
- * Set XTerm "modifyOtherKeys" mode to mode 1 (sends modified escape sequences for certain keys).
47
- * Sequence: `CSI > 4 ; 1 m`
48
- * @example
49
- * ```typescript
50
- * import { setModifyOtherKeys1 } from "@visulima/ansi";
51
- *
52
- * process.stdout.write(setModifyOtherKeys1);
53
- * // Sends: "\x1b[>4;1m"
54
- * ```
55
- */
56
- export declare const setModifyOtherKeys1: string;
46
+ * Set XTerm "modifyOtherKeys" mode to mode 1 (sends modified escape sequences for certain keys).
47
+ * Sequence: `CSI > 4 ; 1 m`
48
+ * @example
49
+ * ```typescript
50
+ * import { setModifyOtherKeys1 } from "@visulima/ansi";
51
+ *
52
+ * process.stdout.write(setModifyOtherKeys1);
53
+ * // Sends: "\x1b[>4;1m"
54
+ * ```
55
+ */
56
+ declare const setModifyOtherKeys1: string;
57
57
  /**
58
- * Set XTerm "modifyOtherKeys" mode to mode 2 (alternative modified escape sequences).
59
- * Sequence: `CSI > 4 ; 2 m`
60
- * @example
61
- * ```typescript
62
- * import { setModifyOtherKeys2 } from "@visulima/ansi";
63
- *
64
- * process.stdout.write(setModifyOtherKeys2);
65
- * // Sends: "\x1b[>4;2m"
66
- * ```
67
- */
68
- export declare const setModifyOtherKeys2: string;
58
+ * Set XTerm "modifyOtherKeys" mode to mode 2 (alternative modified escape sequences).
59
+ * Sequence: `CSI > 4 ; 2 m`
60
+ * @example
61
+ * ```typescript
62
+ * import { setModifyOtherKeys2 } from "@visulima/ansi";
63
+ *
64
+ * process.stdout.write(setModifyOtherKeys2);
65
+ * // Sends: "\x1b[>4;2m"
66
+ * ```
67
+ */
68
+ declare const setModifyOtherKeys2: string;
69
69
  /**
70
- * Reset XTerm "modifyOtherKeys" to its default behavior (mode 0 or initial value).
71
- * Sequence: `CSI > 4 m` (This effectively sets resource 4, value 0, or resets resource 4).
72
- * @example
73
- * ```typescript
74
- * import { resetModifyOtherKeys } from "@visulima/ansi";
75
- *
76
- * process.stdout.write(resetModifyOtherKeys);
77
- * // Sends: "\x1b[>4m"
78
- * ```
79
- */
80
- export declare const resetModifyOtherKeys: string;
70
+ * Reset XTerm "modifyOtherKeys" to its default behavior (mode 0 or initial value).
71
+ * Sequence: `CSI > 4 m` (This effectively sets resource 4, value 0, or resets resource 4).
72
+ * @example
73
+ * ```typescript
74
+ * import { resetModifyOtherKeys } from "@visulima/ansi";
75
+ *
76
+ * process.stdout.write(resetModifyOtherKeys);
77
+ * // Sends: "\x1b[>4m"
78
+ * ```
79
+ */
80
+ declare const resetModifyOtherKeys: string;
81
81
  /**
82
- * Query the current XTerm "modifyOtherKeys" mode.
83
- * Sequence: `CSI ? 4 m`
84
- * Response: `CSI > 4 ; Ps m` where Ps is 0, 1, or 2.
85
- * @example
86
- * ```typescript
87
- * import { queryModifyOtherKeys } from "@visulima/ansi";
88
- *
89
- * process.stdout.write(queryModifyOtherKeys);
90
- * // Sends: "\x1b[?4m"
91
- * // Expect a response like: "\x1b[>4;1m" if mode 1 is set.
92
- * ```
93
- */
94
- export declare const queryModifyOtherKeys: string;
82
+ * Query the current XTerm "modifyOtherKeys" mode.
83
+ * Sequence: `CSI ? 4 m`
84
+ * Response: `CSI > 4 ; Ps m` where Ps is 0, 1, or 2.
85
+ * @example
86
+ * ```typescript
87
+ * import { queryModifyOtherKeys } from "@visulima/ansi";
88
+ *
89
+ * process.stdout.write(queryModifyOtherKeys);
90
+ * // Sends: "\x1b[?4m"
91
+ * // Expect a response like: "\x1b[>4;1m" if mode 1 is set.
92
+ * ```
93
+ */
94
+ declare const queryModifyOtherKeys: string;
95
+ /**
96
+ * Bit flags for the Kitty keyboard protocol progressive-enhancement level.
97
+ *
98
+ * Combine members with bitwise OR to request multiple enhancements at once.
99
+ * @see {@link https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement}
100
+ */
101
+ declare const KittyKeyboardFlag: {
102
+ /** Disambiguate escape codes so modifier+key combos are unambiguous. */
103
+ readonly DisambiguateEscapeCodes: 1;
104
+ /** Report all keys as escape codes (so e.g. Enter/Tab/Backspace are reported uniformly). */
105
+ readonly ReportAllKeysAsEscapeCodes: 16;
106
+ /** Report alternate keys (e.g. shifted layout keys and the base layout key). */
107
+ readonly ReportAlternateKeys: 8;
108
+ /** Embed the text the key would produce in the escape code. */
109
+ readonly ReportAssociatedText: 4;
110
+ /** Add event-type data, enabling key-release (and repeat) reporting. */
111
+ readonly ReportEventTypes: 2;
112
+ };
113
+ /**
114
+ * A Kitty keyboard protocol flag value: a bitwise OR of {@link KittyKeyboardFlag}
115
+ * members (range `0`-`31`).
116
+ */
117
+ type KittyKeyboardFlags = number;
118
+ /**
119
+ * Pushes a new set of Kitty keyboard protocol flags onto the terminal's stack.
120
+ *
121
+ * Sequence: `CSI > flags u`
122
+ * @param flags Bitwise OR of {@link KittyKeyboardFlag} values. Defaults to {@link KittyKeyboardFlag.DisambiguateEscapeCodes}.
123
+ * @returns The escape sequence enabling the requested enhancement level.
124
+ * @example
125
+ * ```typescript
126
+ * import { pushKittyKeyboard, KittyKeyboardFlag as Flag } from "@visulima/ansi/xterm";
127
+ *
128
+ * const flags = Flag.DisambiguateEscapeCodes | Flag.ReportEventTypes;
129
+ *
130
+ * process.stdout.write(pushKittyKeyboard(flags));
131
+ * ```
132
+ * @see {@link https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement}
133
+ */
134
+ declare const pushKittyKeyboard: (flags?: KittyKeyboardFlags) => string;
135
+ /**
136
+ * Pops one or more entries from the terminal's Kitty keyboard protocol flag stack,
137
+ * restoring the previous enhancement level. Call this on exit to undo {@link pushKittyKeyboard}.
138
+ *
139
+ * Sequence: `CSI < number u`
140
+ * @param count How many stack entries to pop. Defaults to `1`.
141
+ * @returns The escape sequence popping the stack.
142
+ * @example
143
+ * ```typescript
144
+ * import { popKittyKeyboard } from "@visulima/ansi/xterm";
145
+ *
146
+ * process.stdout.write(popKittyKeyboard());
147
+ * ```
148
+ * @see {@link https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement}
149
+ */
150
+ declare const popKittyKeyboard: (count?: number) => string;
151
+ /**
152
+ * Sets the Kitty keyboard protocol flags, replacing the current top-of-stack
153
+ * entry (mode `1`) rather than pushing a new one.
154
+ *
155
+ * Sequence: `CSI = flags ; 1 u`
156
+ * @param flags Bitwise OR of {@link KittyKeyboardFlag} values.
157
+ * @returns The escape sequence setting the flags.
158
+ * @see {@link https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement}
159
+ */
160
+ declare const setKittyKeyboard: (flags?: KittyKeyboardFlags) => string;
161
+ /**
162
+ * Queries the terminal's current Kitty keyboard protocol flags.
163
+ *
164
+ * Sequence: `CSI ? u`
165
+ * Response: `CSI ? flags u`.
166
+ * @returns The query escape sequence.
167
+ * @example
168
+ * ```typescript
169
+ * import { queryKittyKeyboard } from "@visulima/ansi/xterm";
170
+ *
171
+ * process.stdout.write(queryKittyKeyboard);
172
+ * // Expect a response like: "\x1b[?1u"
173
+ * ```
174
+ * @see {@link https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement}
175
+ */
176
+ declare const queryKittyKeyboard: string;
177
+ export { KittyKeyboardFlag, KittyKeyboardFlags, XTMODKEYS, XTQMODKEYS, keyModifierOptions, popKittyKeyboard, pushKittyKeyboard, queryKeyModifierOptions, queryKittyKeyboard, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, setKittyKeyboard, setModifyOtherKeys1, setModifyOtherKeys2 };
package/dist/xterm.js CHANGED
@@ -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 };
1
+ import{CSI as t}from"./constants.js";const i=(e,r)=>{if(e<0||!Number.isInteger(e))return"";const s=e.toString();if(r!==void 0){if(!Number.isInteger(r))return"";const n=r.toString();return`${t}>${s};${n}m`}return`${t}>${s}m`},K=i,y=e=>{if(e<0||!Number.isInteger(e))return"";const r=e.toString();return`${t}?${r}m`},d=e=>i(e),a=(e,r)=>i(e,r),m=y,p=`${t}>4;1m`,$=`${t}>4;2m`,g=`${t}>4m`,b=`${t}?4m`,o={DisambiguateEscapeCodes:1,ReportAllKeysAsEscapeCodes:16,ReportAlternateKeys:8,ReportAssociatedText:4,ReportEventTypes:2},f=(e=o.DisambiguateEscapeCodes)=>`${t}>${(Number.isInteger(e)&&e>=0?e:0).toString()}u`,M=(e=1)=>`${t}<${(Number.isInteger(e)&&e>0?e:1).toString()}u`,O=(e=o.DisambiguateEscapeCodes)=>`${t}=${(Number.isInteger(e)&&e>=0?e:0).toString()};1u`,c=`${t}?u`;export{o as KittyKeyboardFlag,K as XTMODKEYS,m as XTQMODKEYS,i as keyModifierOptions,M as popKittyKeyboard,f as pushKittyKeyboard,y as queryKeyModifierOptions,c as queryKittyKeyboard,b as queryModifyOtherKeys,d as resetKeyModifierOptions,g as resetModifyOtherKeys,a as setKeyModifierOptions,O as setKittyKeyboard,p as setModifyOtherKeys1,$ as setModifyOtherKeys2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ansi",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.0",
4
4
  "description": "ANSI escape codes for some terminal swag.",
5
5
  "keywords": [
6
6
  "alternative-screen",
@@ -17,11 +17,11 @@
17
17
  "escape",
18
18
  "escapes",
19
19
  "formatting",
20
+ "hyperlink",
20
21
  "image",
21
22
  "iterm",
22
23
  "iterm2",
23
24
  "link",
24
- "hyperlink",
25
25
  "log",
26
26
  "logging",
27
27
  "screen",
@@ -40,9 +40,7 @@
40
40
  "xterm"
41
41
  ],
42
42
  "homepage": "https://visulima.com/packages/ansi",
43
- "bugs": {
44
- "url": "https://github.com/visulima/visulima/issues"
45
- },
43
+ "bugs": "https://github.com/visulima/visulima/issues",
46
44
  "repository": {
47
45
  "type": "git",
48
46
  "url": "git+https://github.com/visulima/visulima.git",
@@ -74,18 +72,46 @@
74
72
  "types": "./dist/alternative-screen.d.ts",
75
73
  "default": "./dist/alternative-screen.js"
76
74
  },
75
+ "./background": {
76
+ "types": "./dist/background.d.ts",
77
+ "default": "./dist/background.js"
78
+ },
79
+ "./charset": {
80
+ "types": "./dist/charset.d.ts",
81
+ "default": "./dist/charset.js"
82
+ },
77
83
  "./clear": {
78
84
  "types": "./dist/clear.d.ts",
79
85
  "default": "./dist/clear.js"
80
86
  },
87
+ "./clipboard": {
88
+ "types": "./dist/clipboard.d.ts",
89
+ "default": "./dist/clipboard.js"
90
+ },
91
+ "./constants": {
92
+ "types": "./dist/constants.d.ts",
93
+ "default": "./dist/constants.js"
94
+ },
81
95
  "./cursor": {
82
96
  "types": "./dist/cursor.d.ts",
83
97
  "default": "./dist/cursor.js"
84
98
  },
99
+ "./cwd": {
100
+ "types": "./dist/cwd.d.ts",
101
+ "default": "./dist/cwd.js"
102
+ },
85
103
  "./erase": {
86
104
  "types": "./dist/erase.d.ts",
87
105
  "default": "./dist/erase.js"
88
106
  },
107
+ "./finalterm": {
108
+ "types": "./dist/finalterm.d.ts",
109
+ "default": "./dist/finalterm.js"
110
+ },
111
+ "./focus": {
112
+ "types": "./dist/focus.d.ts",
113
+ "default": "./dist/focus.js"
114
+ },
89
115
  "./image": {
90
116
  "types": "./dist/image.d.ts",
91
117
  "default": "./dist/image.js"
@@ -98,6 +124,10 @@
98
124
  "types": "./dist/scroll.d.ts",
99
125
  "default": "./dist/scroll.js"
100
126
  },
127
+ "./sixel": {
128
+ "types": "./dist/sixel.d.ts",
129
+ "default": "./dist/sixel.js"
130
+ },
101
131
  "./strip": {
102
132
  "types": "./dist/strip.d.ts",
103
133
  "default": "./dist/strip.js"
@@ -110,6 +140,10 @@
110
140
  "types": "./dist/title.d.ts",
111
141
  "default": "./dist/title.js"
112
142
  },
143
+ "./urxvt": {
144
+ "types": "./dist/urxvt.d.ts",
145
+ "default": "./dist/urxvt.js"
146
+ },
113
147
  "./window-ops": {
114
148
  "types": "./dist/window-ops.d.ts",
115
149
  "default": "./dist/window-ops.js"
@@ -122,6 +156,14 @@
122
156
  "types": "./dist/iterm2.d.ts",
123
157
  "default": "./dist/iterm2.js"
124
158
  },
159
+ "./keypad": {
160
+ "types": "./dist/keypad.d.ts",
161
+ "default": "./dist/keypad.js"
162
+ },
163
+ "./kitty-graphics": {
164
+ "types": "./dist/kitty-graphics.d.ts",
165
+ "default": "./dist/kitty-graphics.js"
166
+ },
125
167
  "./mode": {
126
168
  "types": "./dist/mode.d.ts",
127
169
  "default": "./dist/mode.js"
@@ -130,10 +172,22 @@
130
172
  "types": "./dist/mouse.d.ts",
131
173
  "default": "./dist/mouse.js"
132
174
  },
175
+ "./notification": {
176
+ "types": "./dist/notification.d.ts",
177
+ "default": "./dist/notification.js"
178
+ },
133
179
  "./passthrough": {
134
180
  "types": "./dist/passthrough.d.ts",
135
181
  "default": "./dist/passthrough.js"
136
182
  },
183
+ "./paste": {
184
+ "types": "./dist/paste.d.ts",
185
+ "default": "./dist/paste.js"
186
+ },
187
+ "./progress": {
188
+ "types": "./dist/progress.d.ts",
189
+ "default": "./dist/progress.js"
190
+ },
137
191
  "./reset": {
138
192
  "types": "./dist/reset.d.ts",
139
193
  "default": "./dist/reset.js"
@@ -153,11 +207,8 @@
153
207
  "README.md",
154
208
  "CHANGELOG.md"
155
209
  ],
156
- "dependencies": {
157
- "type-fest": "5.5.0"
158
- },
159
210
  "engines": {
160
- "node": ">=22.13 <=25.x"
211
+ "node": "^22.14.0 || >=24.10.0"
161
212
  },
162
213
  "publishConfig": {
163
214
  "access": "public",
package/dist/helpers.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * Checks if the current environment is a browser-like environment.
3
- * It specifically checks for the presence of `globalThis.window.document`.
4
- */
5
- /**
6
- * Indicates whether the code is running inside Apple's Terminal.app.
7
- * This is true if not in a browser and the `TERM_PROGRAM` environment variable is "Apple_Terminal".
8
- */
9
- export declare const isTerminalApp: boolean;
10
- /**
11
- * Indicates whether the current platform is Windows.
12
- * This is true if not in a browser and `process.platform` is "win32".
13
- */
14
- export declare const isWindows: boolean;
@@ -1,135 +0,0 @@
1
- import type { LiteralUnion } from "type-fest";
2
- /**
3
- * Represents the special string value `'auto'` used for iTerm2 image or file dimensions.
4
- * When `'auto'` is used for width or height, the terminal (iTerm2) determines the appropriate dimension
5
- * based on the image's inherent size or other context.
6
- * @example `width: IT2_AUTO`
7
- */
8
- export declare const IT2_AUTO: string;
9
- /**
10
- * Formats a number as a string representing a dimension in character cells for iTerm2.
11
- * iTerm2 interprets plain numbers for width/height as character cell counts.
12
- * @param n The number of character cells.
13
- * @returns A string representation of the number (e.g., `10` becomes `"10"`).
14
- * @example
15
- * ```typescript
16
- * const widthInCells = it2Cells(20); // "20"
17
- * const sequence = `File=width=${widthInCells}`;
18
- * ```
19
- */
20
- export declare const it2Cells: (n: number) => string;
21
- /**
22
- * Formats a number as a string representing a dimension in pixels for iTerm2.
23
- * Appends `px` to the number.
24
- * @param n The number of pixels.
25
- * @returns A string representing the dimension in pixels (e.g., `100` becomes `"100px"`).
26
- * @example
27
- * ```typescript
28
- * const heightInPixels = it2Pixels(150);
29
- * const sequence = `File=height=${heightInPixels}`;
30
- * ```
31
- */
32
- export declare const it2Pixels: (n: number) => string;
33
- /**
34
- * Formats a number as a string representing a dimension as a percentage for iTerm2.
35
- * Appends `%` to the number.
36
- * @param n The percentage value (e.g., `50` for 50%).
37
- * @returns A string representing the dimension as a percentage (e.g., `50` becomes `"50%"`).
38
- * @example
39
- * ```typescript
40
- * const widthAsPercentage = it2Percent(75);
41
- * const sequence = `File=width=${widthAsPercentage}`;
42
- * ```
43
- */
44
- export declare const it2Percent: (n: number) => string;
45
- /**
46
- * Defines the interface for any iTerm2 OSC 1337 payload object.
47
- *
48
- * An OSC 1337 sequence has the general form: `OSC 1337 ; &lt;payload_string> BEL`.
49
- * Objects implementing this interface are responsible for generating that `&lt;payload_string>`
50
- * via their `toString()` method. This allows for a structured way to build various iTerm2 commands.
51
- * @see `iTerm2` function in `iterm2.ts` which consumes objects of this type.
52
- */
53
- export interface IITerm2Payload {
54
- /**
55
- * Converts the payload object into its specific string representation required for an iTerm2 OSC 1337 command.
56
- * For example, for a file transfer, this might return `"File=name=...;size=...:content..."`.
57
- * @returns The string payload part of the OSC 1337 sequence.
58
- */
59
- toString: () => string;
60
- }
61
- /**
62
- * Defines the properties for an iTerm2 file transfer or inline image display command (`File=...`).
63
- * These correspond to the key-value pairs used within the `File=` argument of the OSC 1337 sequence.
64
- * @see {@link https://iterm2.com/documentation-escape-codes.html} iTerm2 Escape Codes (search for `File=`)
65
- * @see {@link https://iterm2.com/documentation-images.html} iTerm2 Inline Images Protocol
66
- */
67
- export interface ITerm2FileProperties {
68
- /**
69
- * The Base64 encoded content of the file or image.
70
- * This is typically used when `inline=1` is set for images, or for transferring small files directly
71
- * within the escape sequence. For larger files, multipart transfer is recommended.
72
- * @remarks The `ITerm2File` class can handle the Base64 encoding of `Uint8Array` data automatically.
73
- */
74
- content?: string;
75
- /**
76
- * If `true`, instructs the terminal not to move the cursor after displaying an inline image.
77
- * Corresponds to `doNotMoveCursor=1` in the sequence.
78
- * This is a WezTerm extension, also supported by iTerm2 beta/nightly builds as of some versions.
79
- * @default false (cursor behavior is default terminal behavior)
80
- */
81
- doNotMoveCursor?: boolean;
82
- /**
83
- * The display height of the image or file placeholder.
84
- * Can be:
85
- * - A number (interpreted as character cells, e.g., `10`).
86
- * - A string with units: `"Npx"` (N pixels), `"N%"` (N percent of session height).
87
- * - The string {@link IT2_AUTO} (`"auto"`) for automatic sizing.
88
- * Use helper functions like {@link it2Cells}, {@link it2Pixels}, {@link it2Percent} for formatting if needed.
89
- * @example `10`, `"100px"`, `"50%"`, `IT2_AUTO`
90
- */
91
- height?: LiteralUnion<typeof IT2_AUTO, number | string>;
92
- /**
93
- * Controls aspect ratio preservation for inline images.
94
- * - If `true` (or omitted), the aspect ratio *is* preserved (`preserveAspectRatio=1`, which is the default iTerm2 behavior if the param is absent).
95
- * - If `false`, the aspect ratio is *not* preserved, and the image may stretch (`preserveAspectRatio=0`).
96
- * @remarks Note the slight inversion: this property `ignoreAspectRatio: true` means `preserveAspectRatio=0` in the sequence.
97
- * The default iTerm2 behavior *is* to preserve aspect ratio if the `preserveAspectRatio` parameter is not given.
98
- * So, to *not* preserve, you set this to true to *add* `preserveAspectRatio=0`.
99
- * If you want to preserve (default), you can omit this or set it to `false`.
100
- * @default false (meaning aspect ratio is preserved by iTerm2 default unless overridden)
101
- */
102
- ignoreAspectRatio?: boolean;
103
- /**
104
- * If `true`, the file (typically an image) should be displayed inline in the terminal.
105
- * Corresponds to `inline=1` in the sequence.
106
- * If `false` or omitted, iTerm2 might prompt for download or handle based on file type.
107
- * @default false
108
- */
109
- inline?: boolean;
110
- /**
111
- * The name of the file. This is displayed in UI elements (like a download prompt or image info)
112
- * and used as the default filename if downloaded.
113
- * The name **must be Base64 encoded** if it contains special characters (like `;`, `=`, or non-ASCII characters)
114
- * to ensure correct parsing of the escape sequence by iTerm2.
115
- * The `ITerm2File` and `ITerm2MultipartFileStart` classes generally expect the name to be pre-encoded if necessary.
116
- * @example `"bXlmaWxlLnR4dA=="` (Base64 for "myfile.txt")
117
- */
118
- name?: string;
119
- /**
120
- * The size of the file in bytes. This is used by iTerm2 for progress indication during downloads
121
- * or to inform inline display mechanisms.
122
- * JavaScript `number` type is generally sufficient for typical file sizes (up to `Number.MAX_SAFE_INTEGER`).
123
- */
124
- size?: number;
125
- /**
126
- * The display width of the image or file placeholder.
127
- * Can be:
128
- * - A number (interpreted as character cells, e.g., `20`).
129
- * - A string with units: `"Npx"` (N pixels), `"N%"` (N percent of session width).
130
- * - The string {@link IT2_AUTO} (`"auto"`) for automatic sizing.
131
- * Use helper functions like {@link it2Cells}, {@link it2Pixels}, {@link it2Percent} for formatting if needed.
132
- * @example `20`, `"200px"`, `"75%"`, `IT2_AUTO`
133
- */
134
- width?: LiteralUnion<typeof IT2_AUTO, number | string>;
135
- }