ansimax 1.3.1 → 1.3.2

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,43 @@
3
3
  All notable changes to **ansimax** are documented in this file.
4
4
  This project follows [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.3.2] — Documentation polish for frames + images
7
+
8
+ Patch release improving JSDoc + IntelliSense coverage for the two largest
9
+ modules that were under-documented. No code changes — pure DX upgrade.
10
+
11
+ ### Improved — JSDoc with runnable examples
12
+
13
+ **`frames` module (previously 0 examples → now 17):**
14
+ - `frames.play` — 5 examples (basic loop, play-once, abortable, pause/resume, custom onFrame)
15
+ - `frames.generate` — 3 examples (pulsing dot, progress bar, error tolerance)
16
+ - `frames.live` — 3 examples (reactive counter, async data stream, FPS clamping)
17
+ - `frames.morph` — 3 examples (basic, custom charset, chained sequences)
18
+ - `frames.presets` — 3 examples (loadingBar, pulse, wave with custom rendering)
19
+
20
+ **`images` module (previously 0 examples → now 18):**
21
+ - `renderPixelArt` — 4 examples (heart sprite, scaling, background, sprite lookup)
22
+ - `gradientRect` — 7 examples (horizontal, vertical, diagonal, radial, conic, dithered, braille)
23
+ - `createCanvas` — 4 examples (basic scene, animated frame, sprite composition, resize)
24
+ - `SPRITES` — 3 examples (render single, list all, compose on canvas)
25
+
26
+ ### Why this matters
27
+
28
+ Before v1.3.2, users hovering `frames.play(...)` in their editor saw just
29
+ the signature `(frames: string[], opts?: PlayOptions): PlayController`.
30
+ Now they see 5 runnable examples showing pause/resume patterns, AbortSignal
31
+ integration, custom rendering callbacks — significantly reducing the
32
+ "what do I pass here?" friction for new users.
33
+
34
+ ### Notes
35
+
36
+ - No code changes — pure documentation
37
+ - No runtime dependencies — still zero
38
+ - No new tests required — existing test coverage unchanged
39
+ - Drop-in replacement for `1.3.1`
40
+
41
+ ---
42
+
6
43
  ## [1.3.1] — Polish for panels + json
7
44
 
8
45
  Patch release improving the two modules introduced in v1.3.0 — adds layout
package/README.es.md CHANGED
@@ -7,7 +7,7 @@
7
7
  _Colores • Gradientes • Animaciones • ASCII Art • Pixel Art • Árboles • Componentes • Temas_
8
8
 
9
9
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
10
- [![npm](https://img.shields.io/badge/npm-v1.3.1-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
10
+ [![npm](https://img.shields.io/badge/npm-v1.3.2-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6.svg?style=flat-square)](tsconfig.json)
12
12
  [![Coverage](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat-square)](#testing)
13
13
  [![Tests](https://img.shields.io/badge/tests-2000%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
@@ -215,6 +215,8 @@ console.log(rainbow('preset rainbow integrado'));
215
215
 
216
216
  ### Gradientes animados (v1.2.0)
217
217
 
218
+ <img src="media/animated_gradients.png" alt="Vista previa de gradientes animados" />
219
+
218
220
  ```js
219
221
  import { animateGradient, sleep } from 'ansimax';
220
222
 
@@ -273,6 +275,8 @@ console.log(gradientRect({
273
275
 
274
276
  ### Gradientes reusables (v1.2.3)
275
277
 
278
+ <img src="media/reusable_gradients.png" alt="Vista previa de gradientes reusables" />
279
+
276
280
  ```js
277
281
  import { createGradient, reverseGradient, ascii } from 'ansimax';
278
282
 
@@ -319,6 +323,8 @@ console.log(ascii.box('¡Caja arcoiris!', { padding: 1, borderStyle: 'rounded' }
319
323
 
320
324
  ### Imagen → ASCII (v1.2.5)
321
325
 
326
+ <img src="media/image_to_ascii.png" alt="Vista previa de Image-to-ASCII" />
327
+
322
328
  ```js
323
329
  import { ascii } from 'ansimax';
324
330
  import sharp from 'sharp';
@@ -371,6 +377,8 @@ console.log(ascii.fromImage(pixels, {
371
377
 
372
378
  ### Fuentes Figlet (v1.2.5)
373
379
 
380
+ <img src="media/figlet_fonts.png" alt="Vista previa de fuentes figlet" />
381
+
374
382
  ```js
375
383
  import { readFileSync } from 'node:fs';
376
384
  import { parseFiglet, ascii, gradient } from 'ansimax';
@@ -445,7 +453,7 @@ console.log(components.table([
445
453
  ['loaders', color.green('● listo'), '100%'],
446
454
  ], { borderStyle: 'rounded' }));
447
455
 
448
- console.log(components.badge('VERSION', 'v1.3.1'));
456
+ console.log(components.badge('VERSION', 'v1.3.2'));
449
457
  console.log(components.badge('BUILD', 'passing'));
450
458
  ```
451
459
 
@@ -466,6 +474,8 @@ console.log(components.timeline([
466
474
 
467
475
  ### Loaders y Progreso
468
476
 
477
+ <img src="media/loaders.png" alt="Vista previa de loaders y barras de progreso" />
478
+
469
479
  ```js
470
480
  import { loader, sleep } from 'ansimax';
471
481
 
@@ -495,6 +505,8 @@ await loader.tasks([
495
505
 
496
506
  ### Animaciones
497
507
 
508
+ <img src="media/animations.png" alt="Vista previa de animaciones" />
509
+
498
510
  ```js
499
511
  import { animate, gradient, sleep } from 'ansimax';
500
512
 
@@ -557,6 +569,8 @@ console.log('tenantB incluye custom?', tenantB.list().includes('custom'));
557
569
 
558
570
  ### Panels — Layouts divididos (v1.3.0)
559
571
 
572
+ <img src="media/panels.png" alt="Vista previa de panels y layouts divididos" />
573
+
560
574
  ```js
561
575
  import { panels, ascii } from 'ansimax';
562
576
 
@@ -586,6 +600,8 @@ console.log(panels.hsplit([
586
600
 
587
601
  ### JSON Pretty-print (v1.3.0)
588
602
 
603
+ <img src="media/json_pretty.png" alt="Vista previa de JSON pretty-print" />
604
+
589
605
  ```js
590
606
  import { json } from 'ansimax';
591
607
 
@@ -612,6 +628,22 @@ console.log(json.pretty(obj)); // → "self": [Circular]
612
628
 
613
629
  ---
614
630
 
631
+ ## 📖 Documentación
632
+
633
+ La carpeta [`docs/`](./docs) contiene ejemplos completos para cada módulo:
634
+
635
+ | Documento | Descripción |
636
+ |---|---|
637
+ | [`docs/README.md`](./docs/README.md) | Índice de documentación — empieza aquí |
638
+ | [`docs/examples-ts.md`](./docs/examples-ts.md) | 33 ejemplos en TypeScript (3 por módulo × 11 módulos) |
639
+ | [`docs/examples-mjs.md`](./docs/examples-mjs.md) | 33 ejemplos en JavaScript ESM |
640
+ | [`docs/examples-cjs.md`](./docs/examples-cjs.md) | 33 ejemplos en JavaScript CommonJS |
641
+ | [`docs/showcase.md`](./docs/showcase.md) | App completa que combina todos los módulos |
642
+
643
+ Cada ejemplo es **copy-paste ejecutable** con escenarios realistas de complejidad media — no solo one-liners.
644
+
645
+ ---
646
+
615
647
  ## 📚 Ejemplos
616
648
 
617
649
  Once ejemplos de calidad de producción se publican en el paquete npm y son ejecutables directamente. Los encuentras en [`/examples`](./examples) después de instalar:
@@ -1006,6 +1038,29 @@ ansimax/
1006
1038
 
1007
1039
  ## 📝 Changelog
1008
1040
 
1041
+ ### v1.3.2 — Pulido de documentación para frames + images
1042
+
1043
+ Release patch con cobertura JSDoc + IntelliSense significativamente mejorada:
1044
+
1045
+ - 📝 **Módulo `frames`** — `play`, `generate`, `live`, `morph`, `presets` ahora tienen JSDoc completo con 17 ejemplos ejecutables
1046
+ - 📝 **Módulo `images`** — `renderPixelArt`, `gradientRect`, `createCanvas`, `SPRITES` ahora tienen 18 ejemplos ejecutables
1047
+ - 🎯 **Total**: +35 nuevos bloques `@example` visibles en tu editor
1048
+
1049
+ ```js
1050
+ // Pasando el cursor sobre frames.play() en VS Code ahora muestra patrones de uso:
1051
+ import { frames } from 'ansimax';
1052
+
1053
+ await frames.play(myFrames, {
1054
+ interval: 80,
1055
+ loop: true,
1056
+ signal: ctrl.signal,
1057
+ onFrame: (f, i) => color.cyan(`[${i}] ${f}`),
1058
+ }).promise;
1059
+ ```
1060
+
1061
+ Release puramente de documentación — cero cambios en código, API o tests.
1062
+ Drop-in replacement para `1.3.1`.
1063
+
1009
1064
  ### v1.3.1 — Pulido de panels + json
1010
1065
 
1011
1066
  Release patch que mejora los módulos de v1.3.0 con quality-of-life:
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  _Colors • Gradients • Animations • ASCII Art • Pixel Art • Trees • Components • Themes_
8
8
 
9
9
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
10
- [![npm](https://img.shields.io/badge/npm-v1.3.1-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
10
+ [![npm](https://img.shields.io/badge/npm-v1.3.2-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6.svg?style=flat-square)](tsconfig.json)
12
12
  [![Coverage](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat-square)](#testing)
13
13
  [![Tests](https://img.shields.io/badge/tests-2000%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
@@ -215,6 +215,8 @@ console.log(rainbow('built-in rainbow preset'));
215
215
 
216
216
  ### Animated Gradients (v1.2.0)
217
217
 
218
+ <img src="media/animated_gradients.png" alt="Animated gradients preview" />
219
+
218
220
  ```js
219
221
  import { animateGradient, sleep } from 'ansimax';
220
222
 
@@ -273,6 +275,8 @@ console.log(gradientRect({
273
275
 
274
276
  ### Reusable Gradients (v1.2.3)
275
277
 
278
+ <img src="media/reusable_gradients.png" alt="Reusable gradients preview" />
279
+
276
280
  ```js
277
281
  import { createGradient, reverseGradient, ascii } from 'ansimax';
278
282
 
@@ -319,6 +323,8 @@ console.log(ascii.box('Rainbow box!', { padding: 1, borderStyle: 'rounded' }));
319
323
 
320
324
  ### Image → ASCII (v1.2.5)
321
325
 
326
+ <img src="media/image_to_ascii.png" alt="Image-to-ASCII preview" />
327
+
322
328
  ```js
323
329
  import { ascii } from 'ansimax';
324
330
  import sharp from 'sharp';
@@ -371,6 +377,8 @@ console.log(ascii.fromImage(pixels, {
371
377
 
372
378
  ### Figlet Fonts (v1.2.5)
373
379
 
380
+ <img src="media/figlet_fonts.png" alt="Figlet fonts preview" />
381
+
374
382
  ```js
375
383
  import { readFileSync } from 'node:fs';
376
384
  import { parseFiglet, ascii, gradient } from 'ansimax';
@@ -445,7 +453,7 @@ console.log(components.table([
445
453
  ['loaders', color.green('● ready'), '100%'],
446
454
  ], { borderStyle: 'rounded' }));
447
455
 
448
- console.log(components.badge('VERSION', 'v1.3.1'));
456
+ console.log(components.badge('VERSION', 'v1.3.2'));
449
457
  console.log(components.badge('BUILD', 'passing'));
450
458
  ```
451
459
 
@@ -466,6 +474,8 @@ console.log(components.timeline([
466
474
 
467
475
  ### Loaders & Progress
468
476
 
477
+ <img src="media/loaders.png" alt="Loaders and progress bars preview" />
478
+
469
479
  ```js
470
480
  import { loader, sleep } from 'ansimax';
471
481
 
@@ -495,6 +505,8 @@ await loader.tasks([
495
505
 
496
506
  ### Animations
497
507
 
508
+ <img src="media/animations.png" alt="Animations preview" />
509
+
498
510
  ```js
499
511
  import { animate, gradient, sleep } from 'ansimax';
500
512
 
@@ -557,6 +569,8 @@ console.log('tenantB themes include custom?', tenantB.list().includes('custom'))
557
569
 
558
570
  ### Panels — Split Layouts (v1.3.0)
559
571
 
572
+ <img src="media/panels.png" alt="Panels and split layouts preview" />
573
+
560
574
  ```js
561
575
  import { panels, ascii } from 'ansimax';
562
576
 
@@ -586,6 +600,8 @@ console.log(panels.hsplit([
586
600
 
587
601
  ### JSON Pretty-print (v1.3.0)
588
602
 
603
+ <img src="media/json_pretty.png" alt="JSON pretty-print preview" />
604
+
589
605
  ```js
590
606
  import { json } from 'ansimax';
591
607
 
@@ -612,6 +628,22 @@ console.log(json.pretty(obj)); // → "self": [Circular]
612
628
 
613
629
  ---
614
630
 
631
+ ## 📖 Documentation
632
+
633
+ The [`docs/`](./docs) folder contains comprehensive examples for every module:
634
+
635
+ | Document | Description |
636
+ |---|---|
637
+ | [`docs/README.md`](./docs/README.md) | Documentation index — start here |
638
+ | [`docs/examples-ts.md`](./docs/examples-ts.md) | 33 TypeScript examples (3 per module × 11 modules) |
639
+ | [`docs/examples-mjs.md`](./docs/examples-mjs.md) | 33 JavaScript ESM examples |
640
+ | [`docs/examples-cjs.md`](./docs/examples-cjs.md) | 33 JavaScript CommonJS examples |
641
+ | [`docs/showcase.md`](./docs/showcase.md) | Complete demo app combining every module |
642
+
643
+ Every example is **copy-paste runnable** with realistic, mid-complexity scenarios — not just one-liners.
644
+
645
+ ---
646
+
615
647
  ## 📚 Examples
616
648
 
617
649
  Eleven production-grade examples ship in the npm package and are runnable directly. Find them in [`/examples`](./examples) once you install:
@@ -1006,6 +1038,29 @@ ansimax/
1006
1038
 
1007
1039
  ## 📝 Changelog
1008
1040
 
1041
+ ### v1.3.2 — Documentation polish for frames + images
1042
+
1043
+ Patch release with significantly improved JSDoc + IntelliSense coverage:
1044
+
1045
+ - 📝 **`frames` module** — `play`, `generate`, `live`, `morph`, `presets` now have full JSDoc with 17 runnable examples
1046
+ - 📝 **`images` module** — `renderPixelArt`, `gradientRect`, `createCanvas`, `SPRITES` now have 18 runnable examples
1047
+ - 🎯 **Total**: +35 new `@example` blocks visible in your editor
1048
+
1049
+ ```js
1050
+ // Hovering frames.play() in VS Code now shows usage patterns:
1051
+ import { frames } from 'ansimax';
1052
+
1053
+ await frames.play(myFrames, {
1054
+ interval: 80,
1055
+ loop: true,
1056
+ signal: ctrl.signal,
1057
+ onFrame: (f, i) => color.cyan(`[${i}] ${f}`),
1058
+ }).promise;
1059
+ ```
1060
+
1061
+ Pure documentation release — no code, API, or test changes.
1062
+ Drop-in replacement for `1.3.1`.
1063
+
1009
1064
  ### v1.3.1 — Polish for panels + json
1010
1065
 
1011
1066
  Patch release improving the modules from v1.3.0 with quality-of-life additions:
package/dist/index.d.mts CHANGED
@@ -960,7 +960,82 @@ interface RenderOptions$1 {
960
960
  /** Use braille (2×4 sub-char resolution). Overrides halfBlock. */
961
961
  braille?: boolean;
962
962
  }
963
+ /**
964
+ * Render a 2D grid of pixels (`{r, g, b, a?}` objects) as terminal output
965
+ * using half-block characters (`▀`) to fit two vertical pixels per row.
966
+ * This doubles vertical resolution compared to one-character-per-pixel.
967
+ *
968
+ * @param pixels - 2D grid of pixel objects.
969
+ * @param opts - Render options (scale, background, etc.).
970
+ *
971
+ * @example basic pixel art
972
+ * ```js
973
+ * import { renderPixelArt } from 'ansimax';
974
+ *
975
+ * const heart = [
976
+ * [null, {r:255,g:0,b:0}, null, {r:255,g:0,b:0}, null],
977
+ * [{r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}],
978
+ * [{r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}],
979
+ * [null, {r:255,g:0,b:0}, {r:255,g:0,b:0}, {r:255,g:0,b:0}, null],
980
+ * [null, null, {r:255,g:0,b:0}, null, null],
981
+ * ];
982
+ *
983
+ * console.log(renderPixelArt(heart));
984
+ * ```
985
+ *
986
+ * @example with scale (each pixel rendered as multiple chars)
987
+ * ```js
988
+ * console.log(renderPixelArt(myPixels, { scale: 2 }));
989
+ * // Each pixel becomes 2x2 in the output
990
+ * ```
991
+ *
992
+ * @example with background color (transparent pixels show through)
993
+ * ```js
994
+ * console.log(renderPixelArt(myPixels, {
995
+ * background: { r: 30, g: 30, b: 30 },
996
+ * }));
997
+ * ```
998
+ *
999
+ * @example combined with a sprite from SPRITES
1000
+ * ```js
1001
+ * import { renderPixelArt, SPRITES } from 'ansimax';
1002
+ *
1003
+ * console.log(renderPixelArt(SPRITES.heart.pixels, { scale: 3 }));
1004
+ * ```
1005
+ */
963
1006
  declare const renderPixelArt: (pixels: PixelGrid, opts?: RenderOptions$1) => string;
1007
+ /**
1008
+ * Built-in sprite library — small pre-defined pixel art ready for use.
1009
+ *
1010
+ * Each entry has a `pixels` property containing a `PixelGrid`.
1011
+ *
1012
+ * Currently available: `heart`, `star`, `arrow`, `check`, `x`, `bell`,
1013
+ * `gear`, `bolt`, `flag`, `crown`.
1014
+ *
1015
+ * @example render a built-in sprite
1016
+ * ```js
1017
+ * import { renderPixelArt, SPRITES } from 'ansimax';
1018
+ *
1019
+ * console.log(renderPixelArt(SPRITES.heart.pixels));
1020
+ * console.log(renderPixelArt(SPRITES.star.pixels, { scale: 2 }));
1021
+ * ```
1022
+ *
1023
+ * @example list all available sprites
1024
+ * ```js
1025
+ * console.log('Available sprites:', Object.keys(SPRITES).join(', '));
1026
+ * ```
1027
+ *
1028
+ * @example compose sprites on a canvas
1029
+ * ```js
1030
+ * import { createCanvas, SPRITES } from 'ansimax';
1031
+ *
1032
+ * const canvas = createCanvas(30, 10);
1033
+ * canvas.drawSprite(2, 2, SPRITES.heart.pixels);
1034
+ * canvas.drawSprite(10, 2, SPRITES.star.pixels);
1035
+ * canvas.drawSprite(18, 2, SPRITES.crown.pixels);
1036
+ * canvas.print();
1037
+ * ```
1038
+ */
964
1039
  declare const SPRITES: Record<string, {
965
1040
  pixels: PixelGrid;
966
1041
  }>;
@@ -985,6 +1060,78 @@ interface GradientRectOptions {
985
1060
  /** Render in braille mode for 2× horizontal × 4× vertical resolution. */
986
1061
  braille?: boolean;
987
1062
  }
1063
+ /**
1064
+ * Render a rectangle filled with a multi-color gradient. Supports horizontal,
1065
+ * vertical, diagonal, arbitrary-angle, radial, and conic gradient styles.
1066
+ *
1067
+ * @param opts - Configuration: dimensions, colors, style, dithering.
1068
+ *
1069
+ * @example horizontal gradient (default)
1070
+ * ```js
1071
+ * import { gradientRect } from 'ansimax';
1072
+ *
1073
+ * console.log(gradientRect({
1074
+ * width: 40, height: 10,
1075
+ * colors: ['#ff0000', '#0000ff'],
1076
+ * }));
1077
+ * ```
1078
+ *
1079
+ * @example vertical gradient with multiple stops
1080
+ * ```js
1081
+ * console.log(gradientRect({
1082
+ * width: 30, height: 15,
1083
+ * colors: ['#ff0000', '#ffff00', '#00ff00', '#0000ff'],
1084
+ * style: 'vertical',
1085
+ * }));
1086
+ * ```
1087
+ *
1088
+ * @example arbitrary angle (45° = bottom-left to top-right)
1089
+ * ```js
1090
+ * console.log(gradientRect({
1091
+ * width: 40, height: 20,
1092
+ * colors: ['#bd93f9', '#ff79c6'],
1093
+ * style: 'diagonal',
1094
+ * angle: 45,
1095
+ * }));
1096
+ * ```
1097
+ *
1098
+ * @example radial gradient (center to edge)
1099
+ * ```js
1100
+ * console.log(gradientRect({
1101
+ * width: 30, height: 15,
1102
+ * colors: ['#ffffff', '#000000'],
1103
+ * style: 'radial',
1104
+ * }));
1105
+ * ```
1106
+ *
1107
+ * @example conic (rainbow wheel) — v1.2.0+
1108
+ * ```js
1109
+ * console.log(gradientRect({
1110
+ * width: 30, height: 15,
1111
+ * colors: ['#ff0000', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#ff00ff', '#ff0000'],
1112
+ * style: 'conic',
1113
+ * startAngle: 0,
1114
+ * }));
1115
+ * ```
1116
+ *
1117
+ * @example with Bayer dithering for smoother tonal transitions
1118
+ * ```js
1119
+ * console.log(gradientRect({
1120
+ * width: 60, height: 20,
1121
+ * colors: ['#000033', '#ffcc00'],
1122
+ * dither: 'bayer',
1123
+ * }));
1124
+ * ```
1125
+ *
1126
+ * @example braille mode (4× vertical resolution per cell)
1127
+ * ```js
1128
+ * console.log(gradientRect({
1129
+ * width: 60, height: 30,
1130
+ * colors: ['#ff0000', '#0000ff'],
1131
+ * braille: true,
1132
+ * }));
1133
+ * ```
1134
+ */
988
1135
  declare const gradientRect: (opts?: GradientRectOptions) => string;
989
1136
  interface CanvasRenderOptions extends RenderOptions$1 {
990
1137
  /** Render only the dirty region instead of the whole canvas. Default: false. */
@@ -1011,6 +1158,61 @@ interface Canvas {
1011
1158
  /** Deep copy of the current pixel grid. Mutations don't affect the canvas. */
1012
1159
  pixels: PixelGrid;
1013
1160
  }
1161
+ /**
1162
+ * Create a mutable in-memory canvas with drawing primitives (line, rect,
1163
+ * circle, sprite). The canvas tracks dirty regions so subsequent renders
1164
+ * can update only changed pixels (useful for animation).
1165
+ *
1166
+ * @param width - Canvas width in pixels (1 to MAX_DIMENSION).
1167
+ * @param height - Canvas height in pixels (1 to MAX_DIMENSION).
1168
+ * @param fillColor - Initial fill (`null` for transparent). Default `null`.
1169
+ * @returns A Canvas object with drawing methods.
1170
+ *
1171
+ * @example draw and render a simple scene
1172
+ * ```js
1173
+ * import { createCanvas } from 'ansimax';
1174
+ *
1175
+ * const canvas = createCanvas(40, 20, { r: 20, g: 20, b: 30 });
1176
+ *
1177
+ * canvas.drawRect(5, 5, 30, 10, { r: 100, g: 200, b: 255 }, true);
1178
+ * canvas.drawCircle(20, 10, 4, { r: 255, g: 200, b: 0 }, true);
1179
+ * canvas.drawLine(0, 0, 39, 19, { r: 255, g: 0, b: 100 });
1180
+ *
1181
+ * canvas.print(); // render and write to stdout
1182
+ * ```
1183
+ *
1184
+ * @example animated frame with dirty-region tracking
1185
+ * ```js
1186
+ * const canvas = createCanvas(60, 30);
1187
+ *
1188
+ * for (let frame = 0; frame < 100; frame++) {
1189
+ * canvas.setPixel(frame % 60, 15, { r: 255, g: 0, b: 0 });
1190
+ *
1191
+ * // Only re-render changed pixels (much faster than full redraw)
1192
+ * process.stdout.write(canvas.render({ dirtyOnly: true }));
1193
+ * await new Promise(r => setTimeout(r, 50));
1194
+ * }
1195
+ * ```
1196
+ *
1197
+ * @example composite sprites
1198
+ * ```js
1199
+ * import { createCanvas, SPRITES } from 'ansimax';
1200
+ *
1201
+ * const canvas = createCanvas(40, 20);
1202
+ * canvas.drawSprite(5, 5, SPRITES.heart.pixels);
1203
+ * canvas.drawSprite(20, 5, SPRITES.star.pixels);
1204
+ * canvas.print();
1205
+ * ```
1206
+ *
1207
+ * @example resize while preserving content
1208
+ * ```js
1209
+ * const canvas = createCanvas(20, 10, { r: 50, g: 50, b: 50 });
1210
+ * canvas.drawCircle(10, 5, 3, { r: 255, g: 0, b: 0 });
1211
+ *
1212
+ * canvas.resize(40, 20); // existing pixels remain in upper-left
1213
+ * canvas.print();
1214
+ * ```
1215
+ */
1014
1216
  declare const createCanvas: (width: number, height: number, fillColor?: Pixel) => Canvas;
1015
1217
  declare const images: {
1016
1218
  render: (pixels: PixelGrid, opts?: RenderOptions$1) => string;