@visulima/ansi 4.0.0-alpha.12 → 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.
Files changed (61) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE.md +0 -3
  3. package/README.md +3 -0
  4. package/dist/alternative-screen.d.ts +71 -70
  5. package/dist/alternative-screen.js +1 -8
  6. package/dist/clear.d.ts +74 -73
  7. package/dist/clear.js +1 -10
  8. package/dist/cursor.d.ts +421 -406
  9. package/dist/cursor.js +1 -3
  10. package/dist/erase.d.ts +193 -192
  11. package/dist/erase.js +1 -47
  12. package/dist/hyperlink.d.ts +25 -25
  13. package/dist/hyperlink.js +1 -5
  14. package/dist/image.d.ts +71 -70
  15. package/dist/image.js +1 -40
  16. package/dist/index.d.ts +65 -35
  17. package/dist/index.js +1 -26
  18. package/dist/iterm2.d.ts +285 -58
  19. package/dist/iterm2.js +1 -12
  20. package/dist/mode.d.ts +585 -584
  21. package/dist/mode.js +1 -245
  22. package/dist/mouse.d.ts +227 -226
  23. package/dist/mouse.js +1 -106
  24. package/dist/packem_shared/IT2_AUTO-OiB8EaxU.js +1 -0
  25. package/dist/packem_shared/ITerm2File-XoC8RMzs.js +1 -0
  26. package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
  27. package/dist/packem_shared/cursor-BAcJR4p_.js +1 -0
  28. package/dist/packem_shared/resetProgressBar-H_gzPKNE.js +1 -0
  29. package/dist/packem_shared/restoreCursor-CHy0jZuu.js +2 -0
  30. package/dist/passthrough.d.ts +74 -73
  31. package/dist/passthrough.js +1 -29
  32. package/dist/reset.d.ts +25 -24
  33. package/dist/reset.js +1 -4
  34. package/dist/screen.d.ts +226 -225
  35. package/dist/screen.js +1 -27
  36. package/dist/scroll.d.ts +64 -63
  37. package/dist/scroll.js +1 -18
  38. package/dist/status.d.ts +521 -520
  39. package/dist/status.js +1 -95
  40. package/dist/strip.d.ts +1 -1
  41. package/dist/strip.js +1 -13
  42. package/dist/termcap.d.ts +36 -35
  43. package/dist/termcap.js +1 -25
  44. package/dist/title.d.ts +176 -175
  45. package/dist/title.js +1 -19
  46. package/dist/window-ops.d.ts +399 -398
  47. package/dist/window-ops.js +1 -61
  48. package/dist/xterm.d.ts +85 -84
  49. package/dist/xterm.js +1 -33
  50. package/package.json +2 -5
  51. package/dist/constants.d.ts +0 -20
  52. package/dist/helpers.d.ts +0 -14
  53. package/dist/iterm2/iterm2-properties.d.ts +0 -135
  54. package/dist/iterm2/iterm2-sequences.d.ts +0 -96
  55. package/dist/packem_shared/IT2_AUTO-DyYWsxno.js +0 -6
  56. package/dist/packem_shared/ITerm2File-CUZDBk99.js +0 -137
  57. package/dist/packem_shared/constants-CE7WkXh_.js +0 -9
  58. package/dist/packem_shared/cursor-ChpV7cgs.js +0 -72
  59. package/dist/packem_shared/resetProgressBar-D9r2s7eV.js +0 -18
  60. package/dist/packem_shared/restoreCursor-GfYEeJqN.js +0 -323
  61. package/dist/progress.d.ts +0 -41
@@ -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
+ var R=Object.defineProperty;var T=(_,W)=>R(_,"name",{value:W,configurable:!0});import{C as E}from"./packem_shared/constants-D12jy2Zh.js";var r=Object.defineProperty,e=T((_,W)=>r(_,"name",{value:W,configurable:!0}),"_"),A=(_=>(_[_.DEICONIFY_WINDOW=1]="DEICONIFY_WINDOW",_[_.ICONIFY_WINDOW=2]="ICONIFY_WINDOW",_[_.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",_))(A||{});const I=e((_,...W)=>{if(![10.1,10.2,10.3].includes(_)&&_<=0)return"";const O=[_];return W.forEach(i=>{i>=0&&O.push(i)}),`${E}${O.join(";")}t`},"xtermWindowOp"),o=I,P=e((_,W)=>I(4,_,W),"resizeTextAreaChars"),D=e(()=>I(14),"requestTextAreaSizeChars"),n=e(()=>I(16),"requestCellSizePixels"),t=e(()=>I(18),"requestTextAreaSizePixels"),s=e(()=>I(1),"deiconifyWindow"),L=e(()=>I(2),"iconifyWindow"),a=e((_,W)=>I(3,_,W),"moveWindow"),d=e(()=>I(5),"raiseWindow"),C=e(()=>I(6),"lowerWindow"),X=e(()=>I(7),"refreshWindow"),w=e((_,W)=>I(8,_,W),"resizeTextAreaPixels"),M=e(()=>I(9),"restoreMaximizedWindow"),Z=e(()=>I(10),"maximizeWindow"),x=e(()=>I(13),"reportWindowPosition"),z=e(()=>I(11),"reportWindowState"),l=e(_=>I(24,_),"setPageSizeLines");export{o as XTWINOPS,A as XTermWindowOp,s as deiconifyWindow,L as iconifyWindow,C as lowerWindow,Z as maximizeWindow,a as moveWindow,d as raiseWindow,X as refreshWindow,x as reportWindowPosition,z as reportWindowState,n as requestCellSizePixels,D as requestTextAreaSizeChars,t as requestTextAreaSizePixels,P as resizeTextAreaChars,w as resizeTextAreaPixels,M as restoreMaximizedWindow,l as setPageSizeLines,I as xtermWindowOp};
package/dist/xterm.d.ts CHANGED
@@ -1,94 +1,95 @@
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
+ export { XTMODKEYS, XTQMODKEYS, keyModifierOptions, queryKeyModifierOptions, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, 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
+ var f=Object.defineProperty;var s=(e,r)=>f(e,"name",{value:r,configurable:!0});import{C as i}from"./packem_shared/constants-D12jy2Zh.js";var u=Object.defineProperty,t=s((e,r)=>u(e,"name",{value:r,configurable:!0}),"n");const o=t((e,r)=>{if(e<0||!Number.isInteger(e))return"";const n=e.toString();if(r!==void 0){if(!Number.isInteger(r))return"";const y=r.toString();return`${i}>${n};${y}m`}return`${i}>${n}m`},"keyModifierOptions"),m=o,O=t(e=>{if(e<0||!Number.isInteger(e))return"";const r=e.toString();return`${i}?${r}m`},"queryKeyModifierOptions"),K=t(e=>o(e),"resetKeyModifierOptions"),p=t((e,r)=>o(e,r),"setKeyModifierOptions"),$=O,g=`${i}>4;1m`,a=`${i}>4;2m`,c=`${i}>4m`,S=`${i}?4m`;export{m as XTMODKEYS,$ as XTQMODKEYS,o as keyModifierOptions,O as queryKeyModifierOptions,S as queryModifyOtherKeys,K as resetKeyModifierOptions,c as resetModifyOtherKeys,p as setKeyModifierOptions,g as setModifyOtherKeys1,a as setModifyOtherKeys2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ansi",
3
- "version": "4.0.0-alpha.12",
3
+ "version": "4.0.0-alpha.14",
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",
@@ -153,9 +153,6 @@
153
153
  "README.md",
154
154
  "CHANGELOG.md"
155
155
  ],
156
- "dependencies": {
157
- "type-fest": "5.6.0"
158
- },
159
156
  "engines": {
160
157
  "node": "^22.14.0 || >=24.10.0"
161
158
  },
@@ -1,20 +0,0 @@
1
- /** Escape character (\u001B). */
2
- export declare const ESC: string;
3
- /** Control Sequence Introducer (ESC [). */
4
- export declare const CSI: string;
5
- /** Operating System Command (ESC ]). */
6
- export declare const OSC: string;
7
- /** Bell character (\u0007). Often used to terminate OSC sequences. */
8
- export declare const BEL: string;
9
- /** Separator used in some ANSI sequences, typically a semicolon. */
10
- export declare const SEP: string;
11
- /** Device Control String (ESC P). */
12
- export declare const DCS: string;
13
- /** String Terminator (ESC \\). Used to terminate DCS, SOS, PM, APC sequences. */
14
- export declare const ST: string;
15
- /** Application Program Command (ESC _). */
16
- export declare const APC: string;
17
- /** Start of String (ESC X). */
18
- export declare const SOS: string;
19
- /** Privacy Message (ESC ^). */
20
- export declare const PM: string;
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
- }
@@ -1,96 +0,0 @@
1
- import type { IITerm2Payload, ITerm2FileProperties } from "./iterm2-properties.d.ts";
2
- /**
3
- * Represents the payload for a complete iTerm2 file transfer or an inline image display command.
4
- * This class is used to construct the part of the OSC 1337 sequence that follows `File=`.
5
- * The generated payload can be either:
6
- * - `File=[PROPERTIES]:[BASE64_CONTENT]` (for inline content)
7
- * - `File=[PROPERTIES]` (if content is not provided directly, e.g., for a download announcement)
8
- *
9
- * Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
10
- * @see {@link ITerm2FileProperties} for property details.
11
- * @see `iTerm2` for the function that wraps this payload into a full escape sequence.
12
- */
13
- export declare class ITerm2File implements IITerm2Payload {
14
- private readonly fileProps;
15
- /**
16
- * Constructs an `ITerm2File` payload object.
17
- * @param properties An object containing properties for the file/image, as defined by {@link ITerm2FileProperties}.
18
- * The `name` property within `props` should be pre-Base64 encoded by the caller if it might
19
- * contain special characters (like `;`, `=`, or non-ASCII characters).
20
- * If `fileData` is provided, `props.content` will be overridden, and `props.size` will be
21
- * set from `fileData.byteLength` if not already present in `props`.
22
- * @param fileData (Optional) A `Uint8Array` containing the raw file data. If provided, this data will be
23
- * Base64 encoded and used as the `content` of the file transfer. The `size` property
24
- * will also be automatically set from `fileData.byteLength` if not specified in `props`.
25
- */
26
- constructor(properties: ITerm2FileProperties, fileData?: Uint8Array);
27
- /**
28
- * Converts the file properties and its content (if any) into the string payload
29
- * suitable for the iTerm2 `File=` command.
30
- * @returns The string payload (e.g., `"File=name=...;size=...:BASE64_CONTENT"` or `"File=name=...;size=..."`).
31
- */
32
- toString(): string;
33
- }
34
- /**
35
- * Represents the payload for ending an iTerm2 multipart file transfer.
36
- * This class is used to construct the part of the OSC 1337 sequence that is simply `FileEnd`.
37
- *
38
- * Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
39
- * @see {@link ITerm2MultipartFileStart} to initiate the transfer.
40
- * @see {@link ITerm2FilePart} for sending file chunks.
41
- */
42
- export declare class ITerm2FileEnd implements IITerm2Payload {
43
- /**
44
- * Generates the string payload for the iTerm2 `FileEnd` command.
45
- * @returns The string `"FileEnd"`.
46
- */
47
- toString(): string;
48
- }
49
- /**
50
- * Represents the payload for a part (chunk) of an iTerm2 multipart file transfer.
51
- * This class is used to construct the part of the OSC 1337 sequence that follows `FilePart=`.
52
- * The provided chunk must already be Base64 encoded.
53
- *
54
- * Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
55
- * @see {@link ITerm2MultipartFileStart} to initiate the transfer.
56
- * @see {@link ITerm2FileEnd} to finalize the transfer.
57
- */
58
- export declare class ITerm2FilePart implements IITerm2Payload {
59
- private readonly base64Chunk;
60
- /**
61
- * Constructs an `ITerm2FilePart` payload object.
62
- * @param base64Chunk A string containing a Base64 encoded chunk of the file data.
63
- * The caller is responsible for chunking the file and Base64 encoding each chunk.
64
- */
65
- constructor(base64Chunk: string);
66
- /**
67
- * Converts the Base64 encoded chunk into the string payload suitable for the iTerm2 `FilePart=` command.
68
- * @returns The string payload (e.g., `"FilePart=U09NRURBVEE="`).
69
- */
70
- toString(): string;
71
- }
72
- /**
73
- * Represents the payload for starting an iTerm2 multipart file transfer.
74
- * This class is used to construct the part of the OSC 1337 sequence that follows `MultipartFile=`.
75
- * This command initiates a transfer; the actual file data is sent in subsequent `FilePart` commands.
76
- *
77
- * Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
78
- * @see {@link ITerm2FileProperties} for property details (omitting `content`).
79
- * @see {@link ITerm2FilePart} for sending file chunks.
80
- * @see {@link ITerm2FileEnd} for finalizing the transfer.
81
- */
82
- export declare class ITerm2MultipartFileStart implements IITerm2Payload {
83
- private readonly properties;
84
- /**
85
- * Constructs an `ITerm2MultipartFileStart` payload object.
86
- * @param properties Properties for the multipart file (e.g., `name`, `size`). Content is not part of this command.
87
- * The `name` property within `props` should be pre-Base64 encoded by the caller if it might
88
- * contain special characters.
89
- */
90
- constructor(properties: Omit<ITerm2FileProperties, "content">);
91
- /**
92
- * Converts the file properties into the string payload suitable for the iTerm2 `MultipartFile=` command.
93
- * @returns The string payload (e.g., `"MultipartFile=name=...;size=..."`).
94
- */
95
- toString(): string;
96
- }
@@ -1,6 +0,0 @@
1
- const IT2_AUTO = "auto";
2
- const it2Cells = (n) => n.toString();
3
- const it2Pixels = (n) => `${String(n)}px`;
4
- const it2Percent = (n) => `${String(n)}%`;
5
-
6
- export { IT2_AUTO, it2Cells, it2Percent, it2Pixels };