source: trip-planner-front/node_modules/ansi-escapes/index.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/// <reference types="node"/>
2import {LiteralUnion} from 'type-fest';
3
4declare namespace ansiEscapes {
5 interface ImageOptions {
6 /**
7 The width is given as a number followed by a unit, or the word `'auto'`.
8
9 - `N`: N character cells.
10 - `Npx`: N pixels.
11 - `N%`: N percent of the session's width or height.
12 - `auto`: The image's inherent size will be used to determine an appropriate dimension.
13 */
14 readonly width?: LiteralUnion<'auto', number | string>;
15
16 /**
17 The height is given as a number followed by a unit, or the word `'auto'`.
18
19 - `N`: N character cells.
20 - `Npx`: N pixels.
21 - `N%`: N percent of the session's width or height.
22 - `auto`: The image's inherent size will be used to determine an appropriate dimension.
23 */
24 readonly height?: LiteralUnion<'auto', number | string>;
25
26 readonly preserveAspectRatio?: boolean;
27 }
28
29 interface AnnotationOptions {
30 /**
31 Nonzero number of columns to annotate.
32
33 Default: The remainder of the line.
34 */
35 readonly length?: number;
36
37 /**
38 Starting X coordinate.
39
40 Must be used with `y` and `length`.
41
42 Default: The cursor position
43 */
44 readonly x?: number;
45
46 /**
47 Starting Y coordinate.
48
49 Must be used with `x` and `length`.
50
51 Default: Cursor position.
52 */
53 readonly y?: number;
54
55 /**
56 Create a "hidden" annotation.
57
58 Annotations created this way can be shown using the "Show Annotations" iTerm command.
59 */
60 readonly isHidden?: boolean;
61 }
62}
63
64declare const ansiEscapes: {
65 /**
66 Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
67 */
68 cursorTo(x: number, y?: number): string;
69
70 /**
71 Set the position of the cursor relative to its current position.
72 */
73 cursorMove(x: number, y?: number): string;
74
75 /**
76 Move cursor up a specific amount of rows.
77
78 @param count - Count of rows to move up. Default is `1`.
79 */
80 cursorUp(count?: number): string;
81
82 /**
83 Move cursor down a specific amount of rows.
84
85 @param count - Count of rows to move down. Default is `1`.
86 */
87 cursorDown(count?: number): string;
88
89 /**
90 Move cursor forward a specific amount of rows.
91
92 @param count - Count of rows to move forward. Default is `1`.
93 */
94 cursorForward(count?: number): string;
95
96 /**
97 Move cursor backward a specific amount of rows.
98
99 @param count - Count of rows to move backward. Default is `1`.
100 */
101 cursorBackward(count?: number): string;
102
103 /**
104 Move cursor to the left side.
105 */
106 cursorLeft: string;
107
108 /**
109 Save cursor position.
110 */
111 cursorSavePosition: string;
112
113 /**
114 Restore saved cursor position.
115 */
116 cursorRestorePosition: string;
117
118 /**
119 Get cursor position.
120 */
121 cursorGetPosition: string;
122
123 /**
124 Move cursor to the next line.
125 */
126 cursorNextLine: string;
127
128 /**
129 Move cursor to the previous line.
130 */
131 cursorPrevLine: string;
132
133 /**
134 Hide cursor.
135 */
136 cursorHide: string;
137
138 /**
139 Show cursor.
140 */
141 cursorShow: string;
142
143 /**
144 Erase from the current cursor position up the specified amount of rows.
145
146 @param count - Count of rows to erase.
147 */
148 eraseLines(count: number): string;
149
150 /**
151 Erase from the current cursor position to the end of the current line.
152 */
153 eraseEndLine: string;
154
155 /**
156 Erase from the current cursor position to the start of the current line.
157 */
158 eraseStartLine: string;
159
160 /**
161 Erase the entire current line.
162 */
163 eraseLine: string;
164
165 /**
166 Erase the screen from the current line down to the bottom of the screen.
167 */
168 eraseDown: string;
169
170 /**
171 Erase the screen from the current line up to the top of the screen.
172 */
173 eraseUp: string;
174
175 /**
176 Erase the screen and move the cursor the top left position.
177 */
178 eraseScreen: string;
179
180 /**
181 Scroll display up one line.
182 */
183 scrollUp: string;
184
185 /**
186 Scroll display down one line.
187 */
188 scrollDown: string;
189
190 /**
191 Clear the terminal screen. (Viewport)
192 */
193 clearScreen: string;
194
195 /**
196 Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
197 */
198 clearTerminal: string;
199
200 /**
201 Output a beeping sound.
202 */
203 beep: string;
204
205 /**
206 Create a clickable link.
207
208 [Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
209 */
210 link(text: string, url: string): string;
211
212 /**
213 Display an image.
214
215 _Currently only supported on iTerm2 >=3_
216
217 See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
218
219 @param buffer - Buffer of an image. Usually read in with `fs.readFile()`.
220 */
221 image(buffer: Buffer, options?: ansiEscapes.ImageOptions): string;
222
223 iTerm: {
224 /**
225 [Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
226
227 @param cwd - Current directory. Default: `process.cwd()`.
228 */
229 setCwd(cwd?: string): string;
230
231 /**
232 An annotation looks like this when shown:
233
234 ![screenshot of iTerm annotation](https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png)
235
236 See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
237
238 @param message - The message to display within the annotation. The `|` character is disallowed and will be stripped.
239 @returns An escape code which will create an annotation when printed in iTerm2.
240 */
241 annotation(message: string, options?: ansiEscapes.AnnotationOptions): string;
242 };
243
244 // TODO: remove this in the next major version
245 default: typeof ansiEscapes;
246};
247
248export = ansiEscapes;
Note: See TracBrowser for help on using the repository browser.