UNPKG

10.4 kBTypeScriptView Raw
1declare namespace figlet {
2 type Fonts =
3 | "1Row"
4 | "3-D"
5 | "3D Diagonal"
6 | "3D-ASCII"
7 | "3x5"
8 | "4Max"
9 | "5 Line Oblique"
10 | "AMC 3 Line"
11 | "AMC 3 Liv1"
12 | "AMC AAA01"
13 | "AMC Neko"
14 | "AMC Razor"
15 | "AMC Razor2"
16 | "AMC Slash"
17 | "AMC Slider"
18 | "AMC Thin"
19 | "AMC Tubes"
20 | "AMC Untitled"
21 | "ANSI Regular"
22 | "ANSI Shadow"
23 | "ASCII New Roman"
24 | "Acrobatic"
25 | "Alligator"
26 | "Alligator2"
27 | "Alpha"
28 | "Alphabet"
29 | "Arrows"
30 | "Avatar"
31 | "B1FF"
32 | "B1FF"
33 | "Banner"
34 | "Banner3-D"
35 | "Banner3"
36 | "Banner4"
37 | "Barbwire"
38 | "Basic"
39 | "Bear"
40 | "Bell"
41 | "Benjamin"
42 | "Big Chief"
43 | "Big Money-ne"
44 | "Big Money-nw"
45 | "Big Money-se"
46 | "Big Money-sw"
47 | "Big"
48 | "Bigfig"
49 | "Binary"
50 | "Block"
51 | "Blocks"
52 | "Bloody"
53 | "Bolger"
54 | "Braced"
55 | "Bright"
56 | "Broadway KB"
57 | "Broadway"
58 | "Bubble"
59 | "Bulbhead"
60 | "Caligraphy"
61 | "Caligraphy2"
62 | "Calvin S"
63 | "Cards"
64 | "Catwalk"
65 | "Chiseled"
66 | "Chunky"
67 | "Coinstak"
68 | "Cola"
69 | "Colossal"
70 | "Computer"
71 | "Contessa"
72 | "Contrast"
73 | "Cosmike"
74 | "Crawford"
75 | "Crawford2"
76 | "Crazy"
77 | "Cricket"
78 | "Cursive"
79 | "Cyberlarge"
80 | "Cybermedium"
81 | "Cybersmall"
82 | "Cygnet"
83 | "DANC4"
84 | "DOS Rebel"
85 | "DWhistled"
86 | "Dancing Font"
87 | "Decimal"
88 | "Def Leppard"
89 | "Delta Corps Priest 1"
90 | "Diamond"
91 | "Diet Cola"
92 | "Digital"
93 | "Doh"
94 | "Doom"
95 | "Dot Matrix"
96 | "Double Shorts"
97 | "Double"
98 | "Dr Pepper"
99 | "Efti Chess"
100 | "Efti Font"
101 | "Efti Italic"
102 | "Efti Piti"
103 | "Efti Robot"
104 | "Efti Wall"
105 | "Efti Water"
106 | "Electronic"
107 | "Elite"
108 | "Epic"
109 | "Fender"
110 | "Filter"
111 | "Fire Font-k"
112 | "Fire Font-s"
113 | "Flipped"
114 | "Flower Power"
115 | "Four Tops"
116 | "Fraktur"
117 | "Fun Face"
118 | "Fun Faces"
119 | "Fuzzy"
120 | "Georgi16"
121 | "Georgia11"
122 | "Ghost"
123 | "Ghoulish"
124 | "Glenyn"
125 | "Goofy"
126 | "Gothic"
127 | "Graceful"
128 | "Gradient"
129 | "Graffiti"
130 | "Greek"
131 | "Heart Left"
132 | "Heart Right"
133 | "Henry 3D"
134 | "Hex"
135 | "Hieroglyphs"
136 | "Hollywood"
137 | "Horizontal Left"
138 | "Horizontal Right"
139 | "ICL-1900"
140 | "Impossible"
141 | "Invita"
142 | "Isometric1"
143 | "Isometric2"
144 | "Isometric3"
145 | "Isometric4"
146 | "Italic"
147 | "Ivrit"
148 | "JS Block Letters"
149 | "JS Bracket Letters"
150 | "JS Capital Curves"
151 | "JS Cursive"
152 | "JS Stick Letters"
153 | "Jacky"
154 | "Jazmine"
155 | "Jerusalem"
156 | "Katakana"
157 | "Kban"
158 | "Keyboard"
159 | "Knob"
160 | "Konto Slant"
161 | "Konto"
162 | "LCD"
163 | "Larry 3D 2"
164 | "Larry 3D"
165 | "Lean"
166 | "Letters"
167 | "Lil Devil"
168 | "Line Blocks"
169 | "Linux"
170 | "Lockergnome"
171 | "Madrid"
172 | "Marquee"
173 | "Maxfour"
174 | "Merlin1"
175 | "Merlin2"
176 | "Mike"
177 | "Mini"
178 | "Mirror"
179 | "Mnemonic"
180 | "Modular"
181 | "Morse"
182 | "Morse2"
183 | "Moscow"
184 | "Mshebrew210"
185 | "Muzzle"
186 | "NScript"
187 | "NT Greek"
188 | "NV Script"
189 | "Nancyj-Fancy"
190 | "Nancyj-Improved"
191 | "Nancyj-Underlined"
192 | "Nancyj"
193 | "Nipples"
194 | "O8"
195 | "OS2"
196 | "Octal"
197 | "Ogre"
198 | "Old Banner"
199 | "Pagga"
200 | "Patorjk's Cheese"
201 | "Patorjk-HeX"
202 | "Pawp"
203 | "Peaks Slant"
204 | "Peaks"
205 | "Pebbles"
206 | "Pepper"
207 | "Poison"
208 | "Puffy"
209 | "Puzzle"
210 | "Pyramid"
211 | "Rammstein"
212 | "Rectangles"
213 | "Red Phoenix"
214 | "Relief"
215 | "Relief2"
216 | "Reverse"
217 | "Roman"
218 | "Rot13"
219 | "Rot13"
220 | "Rotated"
221 | "Rounded"
222 | "Rowan Cap"
223 | "Rozzo"
224 | "Runic"
225 | "Runyc"
226 | "S Blood"
227 | "SL Script"
228 | "Santa Clara"
229 | "Script"
230 | "Serifcap"
231 | "Shadow"
232 | "Shimrod"
233 | "Short"
234 | "Slant Relief"
235 | "Slant"
236 | "Slide"
237 | "Small Caps"
238 | "Small Isometric1"
239 | "Small Keyboard"
240 | "Small Poison"
241 | "Small Script"
242 | "Small Shadow"
243 | "Small Slant"
244 | "Small Tengwar"
245 | "Small"
246 | "Soft"
247 | "Speed"
248 | "Spliff"
249 | "Stacey"
250 | "Stampate"
251 | "Stampatello"
252 | "Standard"
253 | "Star Strips"
254 | "Star Wars"
255 | "Stellar"
256 | "Stforek"
257 | "Stick Letters"
258 | "Stop"
259 | "Straight"
260 | "Stronger Than All"
261 | "Sub-Zero"
262 | "Swamp Land"
263 | "Swan"
264 | "Sweet"
265 | "THIS"
266 | "Tanja"
267 | "Tengwar"
268 | "Term"
269 | "Test1"
270 | "The Edge"
271 | "Thick"
272 | "Thin"
273 | "Thorned"
274 | "Three Point"
275 | "Ticks Slant"
276 | "Ticks"
277 | "Tiles"
278 | "Tinker-Toy"
279 | "Tombstone"
280 | "Train"
281 | "Trek"
282 | "Tsalagi"
283 | "Tubular"
284 | "Twisted"
285 | "Two Point"
286 | "USA Flag"
287 | "Univers"
288 | "Varsity"
289 | "Wavy"
290 | "Weird"
291 | "Wet Letter"
292 | "Whimsy"
293 | "Wow";
294
295 type KerningMethods = "default" | "full" | "fitted" | "controlled smushing" | "universal smushing";
296 type PrintDirection = number;
297
298 interface FittingRules {
299 vLayout: number;
300 vRule5: boolean;
301 vRule4: boolean;
302 vRule3: boolean;
303 vRule2: boolean;
304 vRule1: boolean;
305 hLayout: number;
306 hRule6: boolean;
307 hRule5: boolean;
308 hRule4: boolean;
309 hRule3: boolean;
310 hRule2: boolean;
311 hRule1: boolean;
312 }
313
314 interface Options {
315 font?: Fonts | undefined;
316 horizontalLayout?: KerningMethods | undefined;
317 verticalLayout?: KerningMethods | undefined;
318 printDirection?: PrintDirection | undefined;
319 showHardBlanks?: boolean | undefined;
320 /**
321 * This option allows you to limit the width of the output.
322 * For example, if you want your output to be a max of 80 characters wide, you would set this option to 80.
323 * @default undefined
324 */
325 width?: number | undefined;
326 /**
327 * This option works in conjunction with "width".
328 * If this option is set to true, then the library will attempt to break text up on whitespace when limiting the width.
329 * @default false
330 */
331 whitespaceBreak?: boolean | undefined;
332 }
333 interface FontOptions {
334 hardBlank: string;
335 height: number;
336 baseline: number;
337 maxLength: number;
338 oldLayout: number;
339 numCommentLines: number;
340 printDirection: PrintDirection;
341 fullLayout: number | null;
342 codeTagCount: number | null;
343 fittingRules: FittingRules;
344 }
345 interface Defaults {
346 font: Fonts;
347 fontPath: string;
348 }
349
350 function text(txt: string, cb: (error: Error | null, result?: string) => void): void;
351 function text(txt: string, font: Fonts, cb: (error: Error | null, result?: string) => void): void;
352 /**
353 * @description
354 * This `unified-signatures` is disabled because `Fonts` type is too long
355 */
356 // tslint:disable-next-line: unified-signatures
357 function text(txt: string, options: Options | undefined, cb: (error: Error | null, result?: string) => void): void;
358
359 function textSync(txt: string, font?: Fonts): string;
360 /**
361 * @description
362 * This `unified-signatures` is disabled because `Fonts` type is too long
363 */
364 function textSync(txt: string, options: Options): string;
365
366 function metadata(
367 font: Fonts,
368 cb: (error: Error | null, fontOptions?: FontOptions, headerComment?: string) => void,
369 ): void;
370
371 function defaults(opt?: Partial<Defaults>): Defaults;
372
373 function loadFont(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions) => void): void;
374 /**
375 * @todo
376 * Use 'node' namespace to add following methods only in node environment.
377 */
378 /**
379 * @warn
380 * This method works in node environment only.
381 * In browser environment, this method does not work.
382 */
383 function loadFontSync(font: Fonts): FontOptions;
384 /**
385 * @warn
386 * This method exists in node environment only.
387 * In browser environment, this method does not exist.
388 */
389 function fonts(cb: (error: Error | null, fontList?: Fonts[]) => void): void;
390 /**
391 * @warn
392 * This method exists in node environment only.
393 * In browser environment, this method does not exist.
394 */
395 function fontsSync(): Fonts[];
396
397 /**
398 * @description
399 * Load a custom font from a file.
400 *
401 * @param fontName
402 * The name you want to give the new font.
403 * @param fontFile
404 * The data from the font file.
405 */
406 function parseFont(fontName: string, fontFile: string): void;
407}
408
409declare function figlet(txt: string, cb: (error: Error | null, result?: string) => void): void;
410declare function figlet(txt: string, font: figlet.Fonts, cb: (error: Error | null, result?: string) => void): void;
411
412declare function figlet(
413 txt: string,
414 // This `unified-signatures` is disabled because `Fonts` type is too long
415 // tslint:disable-next-line: unified-signatures
416 options: figlet.Options | undefined,
417 cb: (error: Error | null, result?: string) => void,
418): void;
419
420export as namespace figlet;
421export = figlet;