ansimax 1.0.0

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.
@@ -0,0 +1,708 @@
1
+ type ColorMode = 'basic' | '256' | 'truecolor';
2
+ type AnimationSpeed = 'slow' | 'normal' | 'fast';
3
+ interface AnsimaxConfig {
4
+ colorMode?: ColorMode;
5
+ animationSpeed?: AnimationSpeed;
6
+ asciiFont?: 'big' | 'small';
7
+ locale?: string;
8
+ theme?: string;
9
+ }
10
+ declare const configure: (opts?: AnsimaxConfig) => void;
11
+ declare const getConfig: () => Required<AnsimaxConfig>;
12
+ declare const getSpeedMultiplier: () => number;
13
+
14
+ type FrameCallback = (frame: string, index: number) => string;
15
+ interface PlayOptions {
16
+ interval?: number;
17
+ repeat?: number;
18
+ clearOnFinish?: boolean;
19
+ onFrame?: FrameCallback | null;
20
+ signal?: AbortSignal;
21
+ }
22
+ interface LiveOptions {
23
+ fps?: number;
24
+ autoStart?: boolean;
25
+ }
26
+ interface LiveController {
27
+ start: () => void;
28
+ stop: () => void;
29
+ update: (frame: string) => void;
30
+ }
31
+ declare const frames: {
32
+ play: (frames: string[], opts?: PlayOptions) => Promise<void>;
33
+ generate: (count: number, fn: (i: number, total: number) => string) => string[];
34
+ live: (opts?: LiveOptions) => LiveController;
35
+ morph: (frameA: string, frameB: string, steps?: number, charset?: string) => string[];
36
+ presets: {
37
+ loadingBar: (opts?: {
38
+ width?: number;
39
+ char?: string;
40
+ empty?: string;
41
+ label?: string;
42
+ }) => string[];
43
+ ball: (opts?: {
44
+ width?: number;
45
+ char?: string;
46
+ }) => string[];
47
+ breathe: (text: string, opts?: {
48
+ steps?: number;
49
+ }) => string[];
50
+ typeDelete: (text: string, opts?: {
51
+ cursor?: string;
52
+ }) => string[];
53
+ };
54
+ };
55
+
56
+ type SpinnerType = 'dots' | 'dots2' | 'line' | 'arrow' | 'bounce' | 'star' | 'pong' | 'aesthetic' | 'blocks' | 'moon' | 'clock';
57
+ declare const SPINNERS: Record<SpinnerType, string[]>;
58
+ interface SpinOptions {
59
+ type?: SpinnerType;
60
+ interval?: number;
61
+ color?: string | null;
62
+ prefix?: string;
63
+ suffix?: string;
64
+ persist?: boolean;
65
+ signal?: AbortSignal;
66
+ reducedMotion?: boolean;
67
+ }
68
+ interface ProgressOptions {
69
+ width?: number;
70
+ char?: string;
71
+ emptyChar?: string;
72
+ showPercentage?: boolean;
73
+ color?: string | null;
74
+ label?: string;
75
+ }
76
+ interface Task {
77
+ text: string;
78
+ fn: () => Promise<unknown>;
79
+ }
80
+ interface TaskResult {
81
+ success: boolean;
82
+ result?: unknown;
83
+ error?: Error;
84
+ }
85
+ interface TaskOptions {
86
+ type?: SpinnerType;
87
+ spinColor?: string;
88
+ parallel?: boolean;
89
+ }
90
+ declare const loader: {
91
+ spin: (text?: string, opts?: SpinOptions) => ((message?: string, success?: boolean) => void);
92
+ dots: (text?: string, opts?: {
93
+ interval?: number;
94
+ max?: number;
95
+ signal?: AbortSignal;
96
+ }) => (() => void);
97
+ progress: (percent: number, label?: string, opts?: ProgressOptions) => void;
98
+ progressAnimate: (steps: number, label?: string, opts?: ProgressOptions & {
99
+ delay?: number;
100
+ signal?: AbortSignal;
101
+ }) => Promise<void>;
102
+ tasks: (taskList: Task[], opts?: TaskOptions) => Promise<TaskResult[]>;
103
+ custom: (frames: string[], text?: string, opts?: {
104
+ interval?: number;
105
+ signal?: AbortSignal;
106
+ }) => (() => void);
107
+ countdown: (seconds: number, opts?: {
108
+ label?: string;
109
+ color?: string;
110
+ signal?: AbortSignal;
111
+ }) => Promise<void>;
112
+ spinners: Record<SpinnerType, string[]>;
113
+ };
114
+
115
+ type ColorFn = (text: string) => string;
116
+ /** Override color suppression at runtime. Pass true to suppress, false to force on. */
117
+ declare const setNoColor: (v: boolean) => void;
118
+ /** Reset to auto-detect mode (reads NO_COLOR + isTTY at call time). */
119
+ declare const resetNoColor: () => void;
120
+ /** Returns true when colors should be suppressed. */
121
+ declare const isNoColor: () => boolean;
122
+ declare const compose: (...fns: ColorFn[]) => ColorFn;
123
+ declare const gradient: (text: string, stops: string[]) => string;
124
+ declare const rainbow: ColorFn;
125
+ declare const presets: {
126
+ sunset: (t: string) => string;
127
+ ocean: (t: string) => string;
128
+ fire: (t: string) => string;
129
+ neon: (t: string) => string;
130
+ forest: (t: string) => string;
131
+ aurora: (t: string) => string;
132
+ candy: (t: string) => string;
133
+ gold: (t: string) => string;
134
+ };
135
+ declare const color: {
136
+ sunset: (t: string) => string;
137
+ ocean: (t: string) => string;
138
+ fire: (t: string) => string;
139
+ neon: (t: string) => string;
140
+ forest: (t: string) => string;
141
+ aurora: (t: string) => string;
142
+ candy: (t: string) => string;
143
+ gold: (t: string) => string;
144
+ black: ColorFn;
145
+ red: ColorFn;
146
+ green: ColorFn;
147
+ yellow: ColorFn;
148
+ blue: ColorFn;
149
+ magenta: ColorFn;
150
+ cyan: ColorFn;
151
+ white: ColorFn;
152
+ brightBlack: ColorFn;
153
+ brightRed: ColorFn;
154
+ brightGreen: ColorFn;
155
+ brightYellow: ColorFn;
156
+ brightBlue: ColorFn;
157
+ brightMagenta: ColorFn;
158
+ brightCyan: ColorFn;
159
+ brightWhite: ColorFn;
160
+ gray: ColorFn;
161
+ grey: ColorFn;
162
+ orange: (t: string) => string;
163
+ purple: ColorFn;
164
+ bgBlack: ColorFn;
165
+ bgRed: ColorFn;
166
+ bgGreen: ColorFn;
167
+ bgYellow: ColorFn;
168
+ bgBlue: ColorFn;
169
+ bgMagenta: ColorFn;
170
+ bgCyan: ColorFn;
171
+ bgWhite: ColorFn;
172
+ bold: (t: string) => string;
173
+ dim: (t: string) => string;
174
+ italic: (t: string) => string;
175
+ underline: (t: string) => string;
176
+ blink: (t: string) => string;
177
+ inverse: (t: string) => string;
178
+ strikethrough: (t: string) => string;
179
+ hidden: (t: string) => string;
180
+ rgb: (r: number, g: number, b: number) => ColorFn;
181
+ bgRgb: (r: number, g: number, b: number) => ColorFn;
182
+ hex: (h: string) => ColorFn;
183
+ bgHex: (h: string) => ColorFn;
184
+ color256: (n: number) => ColorFn;
185
+ bgColor256: (n: number) => ColorFn;
186
+ gradient: (text: string, stops: string[]) => string;
187
+ rainbow: ColorFn;
188
+ };
189
+
190
+ interface RGB {
191
+ r: number;
192
+ g: number;
193
+ b: number;
194
+ }
195
+ declare const clamp: (n: number, min: number, max: number) => number;
196
+ declare const lerp: (a: number, b: number, t: number) => number;
197
+ /** Returns true when a string is a valid 3- or 6-digit hex color. */
198
+ declare const isHexColor: (hex: string) => boolean;
199
+ /**
200
+ * Parses a hex color string to RGB. Throws on invalid input.
201
+ * Use isHexColor() first if you need fail-soft behaviour.
202
+ */
203
+ declare const hexToRgb: (hex: string) => RGB;
204
+ /** Converts R, G, B values to a hex string. Values are clamped to 0–255. */
205
+ declare const rgbToHex: (r: number, g: number, b: number) => string;
206
+ /** Linearly interpolates between two RGB colors. t is clamped to [0, 1]. */
207
+ declare const lerpColor: (a: RGB, b: RGB, t: number) => RGB;
208
+ declare const rgbTo256: (r: number, g: number, b: number) => number;
209
+ declare const stripAnsi: (str: string) => string;
210
+ declare const visibleLen: (str: string) => number;
211
+ /**
212
+ * Truncates a string with ANSI escapes to a max visible width.
213
+ * Preserves color codes that started before the cut and emits a final reset.
214
+ */
215
+ declare const truncateAnsi: (str: string, width: number, ellipsis?: string) => string;
216
+ declare const padEnd: (str: string, width: number, ch?: string) => string;
217
+ declare const padStart: (str: string, width: number, ch?: string) => string;
218
+ declare const center: (str: string, width: number, ch?: string) => string;
219
+ /** Repeats a string until its visible length reaches the target width. */
220
+ declare const repeatVisible: (str: string, width: number) => string;
221
+ declare const termSize: () => {
222
+ cols: number;
223
+ rows: number;
224
+ };
225
+ declare const wordWrap: (text: string, width: number) => string[];
226
+
227
+ interface TypewriterOptions {
228
+ speed?: number;
229
+ newline?: boolean;
230
+ colorFn?: ColorFn | null;
231
+ signal?: AbortSignal;
232
+ reducedMotion?: boolean;
233
+ }
234
+ interface FadeOptions {
235
+ duration?: number;
236
+ steps?: number;
237
+ newline?: boolean;
238
+ color?: string | RGB;
239
+ signal?: AbortSignal;
240
+ reducedMotion?: boolean;
241
+ }
242
+ interface SlideOptions {
243
+ direction?: 'left' | 'right';
244
+ duration?: number;
245
+ newline?: boolean;
246
+ signal?: AbortSignal;
247
+ reducedMotion?: boolean;
248
+ }
249
+ interface PulseOptions {
250
+ times?: number;
251
+ interval?: number;
252
+ color1?: string | RGB;
253
+ color2?: string | RGB;
254
+ newline?: boolean;
255
+ signal?: AbortSignal;
256
+ reducedMotion?: boolean;
257
+ }
258
+ interface WaveOptions {
259
+ duration?: number;
260
+ steps?: number;
261
+ colors?: string[];
262
+ newline?: boolean;
263
+ signal?: AbortSignal;
264
+ reducedMotion?: boolean;
265
+ }
266
+ interface GlitchOptions {
267
+ duration?: number;
268
+ intensity?: number;
269
+ newline?: boolean;
270
+ signal?: AbortSignal;
271
+ reducedMotion?: boolean;
272
+ }
273
+ interface RevealOptions {
274
+ duration?: number;
275
+ charset?: string;
276
+ newline?: boolean;
277
+ signal?: AbortSignal;
278
+ reducedMotion?: boolean;
279
+ }
280
+ declare const animate: {
281
+ typewriter: (text: string, opts?: TypewriterOptions) => Promise<void>;
282
+ fadeIn: (text: string, opts?: FadeOptions) => Promise<void>;
283
+ fadeOut: (text: string, opts?: FadeOptions) => Promise<void>;
284
+ slide: (text: string, opts?: SlideOptions) => Promise<void>;
285
+ pulse: (text: string, opts?: PulseOptions) => Promise<void>;
286
+ wave: (text: string, opts?: WaveOptions) => Promise<void>;
287
+ glitch: (text: string, opts?: GlitchOptions) => Promise<void>;
288
+ reveal: (text: string, opts?: RevealOptions) => Promise<void>;
289
+ };
290
+
291
+ type BoxStyle = 'single' | 'double' | 'rounded' | 'heavy' | 'dashed' | 'ascii';
292
+ interface BoxChars {
293
+ tl: string;
294
+ tr: string;
295
+ bl: string;
296
+ br: string;
297
+ h: string;
298
+ v: string;
299
+ }
300
+ declare const BOX_STYLES: Record<BoxStyle, BoxChars>;
301
+ interface BoxOptions {
302
+ padding?: number;
303
+ borderStyle?: BoxStyle;
304
+ width?: number | null;
305
+ }
306
+ interface BannerOptions {
307
+ font?: 'big' | 'small';
308
+ colorFn?: ColorFn | null;
309
+ align?: 'left' | 'center';
310
+ }
311
+ interface DividerOptions {
312
+ char?: string;
313
+ width?: number | null;
314
+ label?: string | null;
315
+ style?: BoxStyle;
316
+ }
317
+ interface LogoOptions {
318
+ gradient?: ColorFn | null;
319
+ boxStyle?: BoxStyle;
320
+ }
321
+ declare const ascii: {
322
+ big: (text: string) => string;
323
+ small: (text: string) => string;
324
+ figlet: (text: string, opts?: {
325
+ font?: "big" | "small";
326
+ }) => string;
327
+ banner: (text: string, opts?: BannerOptions) => string;
328
+ box: (text: string, opts?: BoxOptions) => string;
329
+ divider: (opts?: DividerOptions) => string;
330
+ logo: (text: string, opts?: LogoOptions) => string;
331
+ boxStyles: Array<keyof typeof BOX_STYLES>;
332
+ };
333
+
334
+ type TableBorderStyle = 'single' | 'double' | 'rounded' | 'heavy';
335
+ interface TableOptions {
336
+ header?: boolean;
337
+ borderStyle?: TableBorderStyle;
338
+ padding?: number;
339
+ }
340
+ interface BadgeOptions {
341
+ labelBg?: number;
342
+ valueBg?: number;
343
+ labelFg?: number;
344
+ valueFg?: number;
345
+ }
346
+ interface ProgressBarOptions {
347
+ width?: number;
348
+ char?: string;
349
+ emptyChar?: string;
350
+ showPercentage?: boolean;
351
+ label?: string;
352
+ color?: number | null;
353
+ }
354
+ type StatusType = 'success' | 'error' | 'warn' | 'info' | 'wait';
355
+ interface SectionOptions {
356
+ char?: string;
357
+ width?: number | null;
358
+ color?: number;
359
+ }
360
+ interface ColumnsOptions {
361
+ cols?: number;
362
+ gap?: number;
363
+ width?: number | null;
364
+ }
365
+ interface TimelineEvent {
366
+ label: string;
367
+ done?: boolean;
368
+ time?: string;
369
+ }
370
+ interface TimelineOptions {
371
+ connector?: string;
372
+ node?: string;
373
+ color?: number;
374
+ doneColor?: number;
375
+ pendingColor?: number;
376
+ }
377
+ interface MenuInput {
378
+ isTTY?: boolean;
379
+ setRawMode?: (mode: boolean) => unknown;
380
+ resume: () => unknown;
381
+ on: (event: string, listener: (...args: unknown[]) => void) => unknown;
382
+ removeListener: (event: string, listener: (...args: unknown[]) => void) => unknown;
383
+ }
384
+ interface MenuOutput {
385
+ write: (str: string) => unknown;
386
+ }
387
+ interface MenuOptions {
388
+ title?: string | null;
389
+ pointer?: string;
390
+ multiSelect?: boolean;
391
+ color?: number;
392
+ input?: MenuInput;
393
+ output?: MenuOutput;
394
+ }
395
+ /** Resolved value when user presses Ctrl+C — library never calls process.exit() */
396
+ declare const MENU_CANCELLED: unique symbol;
397
+ type MenuResult = number | number[] | typeof MENU_CANCELLED;
398
+ declare const components: {
399
+ table: (rows: string[][], opts?: TableOptions) => string;
400
+ badge: (label: string, value: string, opts?: BadgeOptions) => string;
401
+ progressBar: (percent: number, opts?: ProgressBarOptions) => string;
402
+ status: (type: StatusType, message: string) => string;
403
+ section: (title: string, opts?: SectionOptions) => string;
404
+ columns: (items: string[], opts?: ColumnsOptions) => string;
405
+ timeline: (events: TimelineEvent[], opts?: TimelineOptions) => string;
406
+ menu: (items: string[], opts?: MenuOptions) => Promise<MenuResult>;
407
+ };
408
+
409
+ interface Theme {
410
+ name: string;
411
+ primary: string;
412
+ secondary: string;
413
+ accent: string;
414
+ warning: string;
415
+ error: string;
416
+ info: string;
417
+ muted: string;
418
+ bg: string;
419
+ surface: string;
420
+ text: string;
421
+ gradient: string[];
422
+ }
423
+ declare const themes: {
424
+ list: () => string[];
425
+ get: (name: string) => Theme | null;
426
+ use(name: string): /*elided*/ any;
427
+ current: () => Theme;
428
+ primary: (text: string) => string;
429
+ secondary: (text: string) => string;
430
+ accent: (text: string) => string;
431
+ warning: (text: string) => string;
432
+ error: (text: string) => string;
433
+ info: (text: string) => string;
434
+ muted: (text: string) => string;
435
+ text: (text: string) => string;
436
+ bold: (text: string) => string;
437
+ gradient: (text: string) => string;
438
+ register: (name: string, def: Theme) => void;
439
+ preview: () => void;
440
+ };
441
+
442
+ type Pixel = RGB | null;
443
+ type PixelGrid = Pixel[][];
444
+ declare const renderPixelArt: (pixels: PixelGrid, opts?: {
445
+ scale?: number;
446
+ halfBlock?: boolean;
447
+ }) => string;
448
+ declare const SPRITES: Record<string, {
449
+ pixels: PixelGrid;
450
+ }>;
451
+ declare const gradientRect: (opts?: {
452
+ width?: number;
453
+ height?: number;
454
+ colors?: string[];
455
+ style?: "horizontal" | "vertical" | "diagonal" | "radial";
456
+ }) => string;
457
+ interface Canvas {
458
+ set: (x: number, y: number, color: Pixel) => void;
459
+ get: (x: number, y: number) => Pixel;
460
+ fill: (color: Pixel) => void;
461
+ drawRect: (x: number, y: number, w: number, h: number, color: RGB, fill?: boolean) => void;
462
+ drawCircle: (cx: number, cy: number, radius: number, color: RGB, fill?: boolean) => void;
463
+ render: (opts?: {
464
+ scale?: number;
465
+ halfBlock?: boolean;
466
+ }) => string;
467
+ print: (opts?: {
468
+ scale?: number;
469
+ halfBlock?: boolean;
470
+ }) => void;
471
+ width: number;
472
+ height: number;
473
+ pixels: PixelGrid;
474
+ }
475
+ declare const createCanvas: (width: number, height: number, fillColor?: Pixel) => Canvas;
476
+ declare const images: {
477
+ render: (pixels: PixelGrid, opts?: {
478
+ scale?: number;
479
+ halfBlock?: boolean;
480
+ }) => string;
481
+ sprites: Record<string, {
482
+ pixels: PixelGrid;
483
+ }>;
484
+ flipHorizontal: (pixels: PixelGrid) => PixelGrid;
485
+ flipVertical: (pixels: PixelGrid) => PixelGrid;
486
+ rotate90: (pixels: PixelGrid) => PixelGrid;
487
+ sprite(name: string, opts?: {
488
+ scale?: number;
489
+ halfBlock?: boolean;
490
+ }): string;
491
+ gradientRect: (opts?: {
492
+ width?: number;
493
+ height?: number;
494
+ colors?: string[];
495
+ style?: "horizontal" | "vertical" | "diagonal" | "radial";
496
+ }) => string;
497
+ createCanvas: (width: number, height: number, fillColor?: Pixel) => Canvas;
498
+ };
499
+
500
+ declare const cursor: {
501
+ readonly up: (n?: number) => string;
502
+ readonly down: (n?: number) => string;
503
+ readonly right: (n?: number) => string;
504
+ readonly left: (n?: number) => string;
505
+ readonly to: (x: number, y: number) => string;
506
+ readonly save: () => string;
507
+ readonly restore: () => string;
508
+ readonly hide: () => string;
509
+ readonly show: () => string;
510
+ };
511
+ declare const screen: {
512
+ readonly clear: () => string;
513
+ readonly clearLine: () => string;
514
+ readonly clearRight: () => string;
515
+ readonly clearDown: () => string;
516
+ readonly scrollUp: (n?: number) => string;
517
+ readonly scrollDown: (n?: number) => string;
518
+ };
519
+ declare const sgr: (...codes: number[]) => string;
520
+ declare const reset: () => string;
521
+ declare const fgRgb: (r: number, g: number, b: number) => string;
522
+ declare const bgRgb: (r: number, g: number, b: number) => string;
523
+ type ColorSupport = 'none' | 'basic' | '256' | 'truecolor';
524
+ declare const supportsColor: () => ColorSupport;
525
+ declare const sleep: (ms: number) => Promise<void>;
526
+ declare const write: (str: string) => boolean;
527
+ declare const writeln: (str?: string) => boolean;
528
+
529
+ declare const ansimax: {
530
+ color: {
531
+ sunset: (t: string) => string;
532
+ ocean: (t: string) => string;
533
+ fire: (t: string) => string;
534
+ neon: (t: string) => string;
535
+ forest: (t: string) => string;
536
+ aurora: (t: string) => string;
537
+ candy: (t: string) => string;
538
+ gold: (t: string) => string;
539
+ black: ColorFn;
540
+ red: ColorFn;
541
+ green: ColorFn;
542
+ yellow: ColorFn;
543
+ blue: ColorFn;
544
+ magenta: ColorFn;
545
+ cyan: ColorFn;
546
+ white: ColorFn;
547
+ brightBlack: ColorFn;
548
+ brightRed: ColorFn;
549
+ brightGreen: ColorFn;
550
+ brightYellow: ColorFn;
551
+ brightBlue: ColorFn;
552
+ brightMagenta: ColorFn;
553
+ brightCyan: ColorFn;
554
+ brightWhite: ColorFn;
555
+ gray: ColorFn;
556
+ grey: ColorFn;
557
+ orange: (t: string) => string;
558
+ purple: ColorFn;
559
+ bgBlack: ColorFn;
560
+ bgRed: ColorFn;
561
+ bgGreen: ColorFn;
562
+ bgYellow: ColorFn;
563
+ bgBlue: ColorFn;
564
+ bgMagenta: ColorFn;
565
+ bgCyan: ColorFn;
566
+ bgWhite: ColorFn;
567
+ bold: (t: string) => string;
568
+ dim: (t: string) => string;
569
+ italic: (t: string) => string;
570
+ underline: (t: string) => string;
571
+ blink: (t: string) => string;
572
+ inverse: (t: string) => string;
573
+ strikethrough: (t: string) => string;
574
+ hidden: (t: string) => string;
575
+ rgb: (r: number, g: number, b: number) => ColorFn;
576
+ bgRgb: (r: number, g: number, b: number) => ColorFn;
577
+ hex: (h: string) => ColorFn;
578
+ bgHex: (h: string) => ColorFn;
579
+ color256: (n: number) => ColorFn;
580
+ bgColor256: (n: number) => ColorFn;
581
+ gradient: (text: string, stops: string[]) => string;
582
+ rainbow: ColorFn;
583
+ };
584
+ animate: {
585
+ typewriter: (text: string, opts?: TypewriterOptions) => Promise<void>;
586
+ fadeIn: (text: string, opts?: FadeOptions) => Promise<void>;
587
+ fadeOut: (text: string, opts?: FadeOptions) => Promise<void>;
588
+ slide: (text: string, opts?: SlideOptions) => Promise<void>;
589
+ pulse: (text: string, opts?: PulseOptions) => Promise<void>;
590
+ wave: (text: string, opts?: WaveOptions) => Promise<void>;
591
+ glitch: (text: string, opts?: GlitchOptions) => Promise<void>;
592
+ reveal: (text: string, opts?: RevealOptions) => Promise<void>;
593
+ };
594
+ ascii: {
595
+ big: (text: string) => string;
596
+ small: (text: string) => string;
597
+ figlet: (text: string, opts?: {
598
+ font?: "big" | "small";
599
+ }) => string;
600
+ banner: (text: string, opts?: BannerOptions) => string;
601
+ box: (text: string, opts?: BoxOptions) => string;
602
+ divider: (opts?: DividerOptions) => string;
603
+ logo: (text: string, opts?: LogoOptions) => string;
604
+ boxStyles: Array<BoxStyle>;
605
+ };
606
+ loader: {
607
+ spin: (text?: string, opts?: SpinOptions) => ((message?: string, success?: boolean) => void);
608
+ dots: (text?: string, opts?: {
609
+ interval?: number;
610
+ max?: number;
611
+ signal?: AbortSignal;
612
+ }) => (() => void);
613
+ progress: (percent: number, label?: string, opts?: ProgressOptions) => void;
614
+ progressAnimate: (steps: number, label?: string, opts?: ProgressOptions & {
615
+ delay?: number;
616
+ signal?: AbortSignal;
617
+ }) => Promise<void>;
618
+ tasks: (taskList: Task[], opts?: TaskOptions) => Promise<TaskResult[]>;
619
+ custom: (frames: string[], text?: string, opts?: {
620
+ interval?: number;
621
+ signal?: AbortSignal;
622
+ }) => (() => void);
623
+ countdown: (seconds: number, opts?: {
624
+ label?: string;
625
+ color?: string;
626
+ signal?: AbortSignal;
627
+ }) => Promise<void>;
628
+ spinners: Record<SpinnerType, string[]>;
629
+ };
630
+ frames: {
631
+ play: (frames: string[], opts?: PlayOptions) => Promise<void>;
632
+ generate: (count: number, fn: (i: number, total: number) => string) => string[];
633
+ live: (opts?: LiveOptions) => LiveController;
634
+ morph: (frameA: string, frameB: string, steps?: number, charset?: string) => string[];
635
+ presets: {
636
+ loadingBar: (opts?: {
637
+ width?: number;
638
+ char?: string;
639
+ empty?: string;
640
+ label?: string;
641
+ }) => string[];
642
+ ball: (opts?: {
643
+ width?: number;
644
+ char?: string;
645
+ }) => string[];
646
+ breathe: (text: string, opts?: {
647
+ steps?: number;
648
+ }) => string[];
649
+ typeDelete: (text: string, opts?: {
650
+ cursor?: string;
651
+ }) => string[];
652
+ };
653
+ };
654
+ components: {
655
+ table: (rows: string[][], opts?: TableOptions) => string;
656
+ badge: (label: string, value: string, opts?: BadgeOptions) => string;
657
+ progressBar: (percent: number, opts?: ProgressBarOptions) => string;
658
+ status: (type: StatusType, message: string) => string;
659
+ section: (title: string, opts?: SectionOptions) => string;
660
+ columns: (items: string[], opts?: ColumnsOptions) => string;
661
+ timeline: (events: TimelineEvent[], opts?: TimelineOptions) => string;
662
+ menu: (items: string[], opts?: MenuOptions) => Promise<MenuResult>;
663
+ };
664
+ themes: {
665
+ list: () => string[];
666
+ get: (name: string) => Theme | null;
667
+ use(name: string): /*elided*/ any;
668
+ current: () => Theme;
669
+ primary: (text: string) => string;
670
+ secondary: (text: string) => string;
671
+ accent: (text: string) => string;
672
+ warning: (text: string) => string;
673
+ error: (text: string) => string;
674
+ info: (text: string) => string;
675
+ muted: (text: string) => string;
676
+ text: (text: string) => string;
677
+ bold: (text: string) => string;
678
+ gradient: (text: string) => string;
679
+ register: (name: string, def: Theme) => void;
680
+ preview: () => void;
681
+ };
682
+ images: {
683
+ render: (pixels: (RGB | null)[][], opts?: {
684
+ scale?: number;
685
+ halfBlock?: boolean;
686
+ }) => string;
687
+ sprites: Record<string, {
688
+ pixels: (RGB | null)[][];
689
+ }>;
690
+ flipHorizontal: (pixels: (RGB | null)[][]) => (RGB | null)[][];
691
+ flipVertical: (pixels: (RGB | null)[][]) => (RGB | null)[][];
692
+ rotate90: (pixels: (RGB | null)[][]) => (RGB | null)[][];
693
+ sprite(name: string, opts?: {
694
+ scale?: number;
695
+ halfBlock?: boolean;
696
+ }): string;
697
+ gradientRect: (opts?: {
698
+ width?: number;
699
+ height?: number;
700
+ colors?: string[];
701
+ style?: "horizontal" | "vertical" | "diagonal" | "radial";
702
+ }) => string;
703
+ createCanvas: (width: number, height: number, fillColor?: RGB | null) => Canvas;
704
+ };
705
+ configure: (opts?: AnsimaxConfig) => void;
706
+ };
707
+
708
+ export { type AnimationSpeed, type AnsimaxConfig, type BadgeOptions, type BannerOptions, type BoxOptions, type BoxStyle, type Canvas, type ColorFn, type ColorMode, type ColumnsOptions, type DividerOptions, type FadeOptions, type GlitchOptions, type LiveController, type LogoOptions, type MenuInput, type MenuOptions, type MenuOutput, type MenuResult, type PlayOptions, type ProgressBarOptions, type ProgressOptions, type PulseOptions, type RGB, type RevealOptions, SPINNERS, SPRITES, type SectionOptions, type SlideOptions, type SpinOptions, type SpinnerType, type StatusType, type TableOptions, type Task, type TaskResult, type Theme, type TimelineEvent, type TimelineOptions, type TypewriterOptions, type WaveOptions, animate, ascii, bgRgb, center, clamp, color, presets as colorPresets, components, compose, configure, createCanvas, cursor, ansimax as default, fgRgb, frames, getConfig, getSpeedMultiplier, gradient, gradientRect, hexToRgb, images, isHexColor, isNoColor, lerp, lerpColor, loader, padEnd, padStart, rainbow, renderPixelArt, repeatVisible, reset, resetNoColor, rgbTo256, rgbToHex, screen, setNoColor, sgr, sleep, stripAnsi, supportsColor, termSize, themes, truncateAnsi, visibleLen, wordWrap, write, writeln };