UNPKG

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