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 | "Pagga"
205 | "Patorjk's Cheese"
206 | "Patorjk-HeX"
207 | "Pawp"
208 | "Peaks Slant"
209 | "Peaks"
210 | "Pebbles"
211 | "Pepper"
212 | "Poison"
213 | "Puffy"
214 | "Puzzle"
215 | "Pyramid"
216 | "Rammstein"
217 | "Rectangles"
218 | "Red Phoenix"
219 | "Relief"
220 | "Relief2"
221 | "Reverse"
222 | "Roman"
223 | "Rot13"
224 | "Rot13"
225 | "Rotated"
226 | "Rounded"
227 | "Rowan Cap"
228 | "Rozzo"
229 | "Runic"
230 | "Runyc"
231 | "S Blood"
232 | "SL Script"
233 | "Santa Clara"
234 | "Script"
235 | "Serifcap"
236 | "Shadow"
237 | "Shimrod"
238 | "Short"
239 | "Slant Relief"
240 | "Slant"
241 | "Slide"
242 | "Small Caps"
243 | "Small Isometric1"
244 | "Small Keyboard"
245 | "Small Poison"
246 | "Small Script"
247 | "Small Shadow"
248 | "Small Slant"
249 | "Small Tengwar"
250 | "Small"
251 | "Soft"
252 | "Speed"
253 | "Spliff"
254 | "Stacey"
255 | "Stampate"
256 | "Stampatello"
257 | "Standard"
258 | "Star Strips"
259 | "Star Wars"
260 | "Stellar"
261 | "Stforek"
262 | "Stick Letters"
263 | "Stop"
264 | "Straight"
265 | "Stronger Than All"
266 | "Sub-Zero"
267 | "Swamp Land"
268 | "Swan"
269 | "Sweet"
270 | "THIS"
271 | "Tanja"
272 | "Tengwar"
273 | "Term"
274 | "Test1"
275 | "The Edge"
276 | "Thick"
277 | "Thin"
278 | "Thorned"
279 | "Three Point"
280 | "Ticks Slant"
281 | "Ticks"
282 | "Tiles"
283 | "Tinker-Toy"
284 | "Tombstone"
285 | "Train"
286 | "Trek"
287 | "Tsalagi"
288 | "Tubular"
289 | "Twisted"
290 | "Two Point"
291 | "USA Flag"
292 | "Univers"
293 | "Varsity"
294 | "Wavy"
295 | "Weird"
296 | "Wet Letter"
297 | "Whimsy"
298 | "Wow";
299
300 type KerningMethods = "default" | "full" | "fitted" | "controlled smushing" | "universal smushing";
301 type PrintDirection = number;
302
303 interface FittingRules {
304 vLayout: number;
305 vRule5: boolean;
306 vRule4: boolean;
307 vRule3: boolean;
308 vRule2: boolean;
309 vRule1: boolean;
310 hLayout: number;
311 hRule6: boolean;
312 hRule5: boolean;
313 hRule4: boolean;
314 hRule3: boolean;
315 hRule2: boolean;
316 hRule1: boolean;
317 }
318
319 interface Options {
320 font?: Fonts | undefined;
321 horizontalLayout?: KerningMethods | undefined;
322 verticalLayout?: KerningMethods | undefined;
323 printDirection?: PrintDirection | undefined;
324 showHardBlanks?: boolean | undefined;
325 /**
326 * This option allows you to limit the width of the output.
327 * For example, if you want your output to be a max of 80 characters wide, you would set this option to 80.
328 * @default undefined
329 */
330 width?: number | undefined;
331 /**
332 * This option works in conjunction with "width".
333 * If this option is set to true, then the library will attempt to break text up on whitespace when limiting the width.
334 * @default false
335 */
336 whitespaceBreak?: boolean | undefined;
337 }
338 interface FontOptions {
339 hardBlank: string;
340 height: number;
341 baseline: number;
342 maxLength: number;
343 oldLayout: number;
344 numCommentLines: number;
345 printDirection: PrintDirection;
346 fullLayout: number | null;
347 codeTagCount: number | null;
348 fittingRules: FittingRules;
349 }
350 interface Defaults {
351 font: Fonts;
352 fontPath: string;
353 }
354
355 function text(txt: string, cb: (error: Error | null, result?: string) => void): void;
356 function text(txt: string, font: Fonts, cb: (error: Error | null, result?: string) => void): void;
357 /**
358 * @description
359 * This `unified-signatures` is disabled because `Fonts` type is too long
360 */
361 // tslint:disable-next-line: unified-signatures
362 function text(txt: string, options: Options | undefined, cb: (error: Error | null, result?: string) => void): void;
363
364 function textSync(txt: string, font?: Fonts): string;
365 /**
366 * @description
367 * This `unified-signatures` is disabled because `Fonts` type is too long
368 */
369 function textSync(txt: string, options: Options): string;
370
371 function metadata(
372 font: Fonts,
373 cb: (error: Error | null, fontOptions?: FontOptions, headerComment?: string) => void,
374 ): void;
375
376 function defaults(opt?: Partial<Defaults>): Defaults;
377
378 function loadFont(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions) => void): void;
379 /**
380 * @todo
381 * Use 'node' namespace to add following methods only in node environment.
382 */
383 /**
384 * @warn
385 * This method works in node environment only.
386 * In browser environment, this method does not work.
387 */
388 function loadFontSync(font: Fonts): FontOptions;
389 /**
390 * @warn
391 * This method exists in node environment only.
392 * In browser environment, this method does not exist.
393 */
394 function fonts(cb: (error: Error | null, fontList?: Fonts[]) => void): void;
395 /**
396 * @warn
397 * This method exists in node environment only.
398 * In browser environment, this method does not exist.
399 */
400 function fontsSync(): Fonts[];
401
402 /**
403 * @description
404 * Load a custom font from a file.
405 *
406 * @param fontName
407 * The name you want to give the new font.
408 * @param fontFile
409 * The data from the font file.
410 */
411 function parseFont(fontName: string, fontFile: string): void;
412}
413
414declare function figlet(txt: string, cb: (error: Error | null, result?: string) => void): void;
415declare function figlet(txt: string, font: figlet.Fonts, cb: (error: Error | null, result?: string) => void): void;
416
417declare function figlet(
418 txt: string,
419 // This `unified-signatures` is disabled because `Fonts` type is too long
420 // tslint:disable-next-line: unified-signatures
421 options: figlet.Options | undefined,
422 cb: (error: Error | null, result?: string) => void,
423): void;
424
425export as namespace figlet;
426export = figlet;