ansimax 1.3.0 → 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,165 @@
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
+
43
+ ## [1.3.1] — Polish for panels + json
44
+
45
+ Patch release improving the two modules introduced in v1.3.0 — adds layout
46
+ helpers, JSON readability options, and tests. No breaking changes.
47
+
48
+ ### Added — `panels.center(block, opts)`
49
+
50
+ Center a multi-line block horizontally (and optionally vertically) within
51
+ a fixed width/height. Useful for centering boxes, banners, or any pre-rendered
52
+ block in a known terminal width.
53
+
54
+ ```js
55
+ import { panels, ascii } from 'ansimax';
56
+
57
+ // Horizontal centering only
58
+ console.log(panels.center('Hello!', { width: 30 }));
59
+ // " Hello! "
60
+
61
+ // Vertical too — content fits in 5 rows
62
+ console.log(panels.center('X', { width: 5, height: 5, align: 'center' }));
63
+
64
+ // Combine with box for a centered card
65
+ console.log(panels.center(ascii.box('Hello'), { width: 80 }));
66
+ ```
67
+
68
+ Exported as `centerBlock` from the main barrel (to avoid colliding with the
69
+ existing `center` text helper). The namespaced form `panels.center` works
70
+ identically.
71
+
72
+ ### Added — `panels.frame(block, opts)`
73
+
74
+ Lighter alternative to `ascii.box`: draws only top/bottom decorative rules
75
+ (not full sides). Supports a centered title, padding, and custom characters.
76
+
77
+ ```js
78
+ import { panels } from 'ansimax';
79
+
80
+ // Simple rules
81
+ console.log(panels.frame('Hello world!'));
82
+ // ─────────────
83
+ // Hello world!
84
+ // ─────────────
85
+
86
+ // With title + padding
87
+ console.log(panels.frame('Body content\nMore content', {
88
+ title: 'Header',
89
+ padding: 1,
90
+ }));
91
+ // ───── Header ─────
92
+ //
93
+ // Body content
94
+ // More content
95
+ //
96
+ // ──────────────────
97
+
98
+ // Custom decoration chars
99
+ console.log(panels.frame('Important!', {
100
+ topChar: '═',
101
+ padding: 2,
102
+ }));
103
+ ```
104
+
105
+ ### Added — `json.pretty` option `sortKeys`
106
+
107
+ Sort object keys alphabetically for deterministic output. Useful for diffs,
108
+ snapshots, and visual scanning of large objects.
109
+
110
+ ```js
111
+ import { json } from 'ansimax';
112
+
113
+ console.log(json.pretty({ zebra: 1, apple: 2, mango: 3 }, { sortKeys: true }));
114
+ // {
115
+ // "apple": 2,
116
+ // "mango": 3,
117
+ // "zebra": 1
118
+ // }
119
+ ```
120
+
121
+ Recursive — applies to all nested objects. Default `false` (preserves
122
+ insertion order).
123
+
124
+ ### Added — `json.pretty` option `inlineArrayMaxLength`
125
+
126
+ Arrays of primitives now render on a single line when their rendered length
127
+ is short enough (default threshold: 60 visible characters). This improves
128
+ readability significantly for typical configs:
129
+
130
+ ```js
131
+ // Before v1.3.1:
132
+ {
133
+ "tags": [
134
+ "frontend",
135
+ "react",
136
+ "typescript"
137
+ ]
138
+ }
139
+
140
+ // In v1.3.1 (default behavior):
141
+ {
142
+ "tags": ["frontend", "react", "typescript"]
143
+ }
144
+ ```
145
+
146
+ Arrays containing objects/arrays never inline regardless of length. Set
147
+ `inlineArrayMaxLength: 0` to restore the v1.3.0 always-expand behavior.
148
+
149
+ ### Improved — Tests
150
+
151
+ - `+11` tests for `panels.center` + `panels.frame`
152
+ - `+15` tests for `json.pretty` `sortKeys` + `inlineArrayMaxLength`
153
+ - Total tests: 2,000+ → **~2,026** across 18 suites
154
+
155
+ ### Notes
156
+
157
+ - No runtime dependencies — still zero
158
+ - No breaking changes — drop-in replacement for `1.3.0`
159
+ - `panels.center` is exposed as `centerBlock` at the top level to avoid
160
+ conflict with the existing `center` text helper; both `panels.center` and
161
+ `centerBlock` reference the same function
162
+
163
+ ---
164
+
6
165
  ## [1.3.0] — Phase 4 progress: Panels + JSON pretty-print
7
166
 
8
167
  Minor release adding **split layout primitives** and **JSON pretty-printing**.
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.0-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.0'));
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,58 @@ 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
+
1064
+ ### v1.3.1 — Pulido de panels + json
1065
+
1066
+ Release patch que mejora los módulos de v1.3.0 con quality-of-life:
1067
+
1068
+ - 🎯 **`panels.center(block, opts)`** — centra un block horizontalmente (y opcionalmente verticalmente) en un ancho conocido
1069
+ - 🖼️ **`panels.frame(block, opts)`** — alternativa más ligera a `ascii.box`: solo top/bottom con title + padding opcionales
1070
+ - 📋 **`json.pretty` opción `sortKeys`** — orden alfabético de keys para diffs deterministas
1071
+ - 📐 **`json.pretty` opción `inlineArrayMaxLength`** — arrays cortos de primitivos ahora se renderizan como `[1, 2, 3]` en una línea (threshold default: 60 chars)
1072
+ - 🧪 **+26 tests** entre panels + json
1073
+
1074
+ ```js
1075
+ import { panels, json } from 'ansimax';
1076
+
1077
+ // Centrar un box dentro de la terminal
1078
+ console.log(panels.center(ascii.box('Hello'), { width: 80 }));
1079
+
1080
+ // Frame decorativo más ligero
1081
+ console.log(panels.frame('Body', { title: 'Header', padding: 1 }));
1082
+
1083
+ // Sorted, con inline arrays
1084
+ console.log(json.pretty({ zebra: [1, 2, 3], apple: 'A' }, { sortKeys: true }));
1085
+ // {
1086
+ // "apple": "A",
1087
+ // "zebra": [1, 2, 3]
1088
+ // }
1089
+ ```
1090
+
1091
+ Drop-in replacement para `1.3.0`.
1092
+
1009
1093
  ### v1.3.0 — Avance Fase 4: Panels + JSON pretty-print
1010
1094
 
1011
1095
  Release minor que añade dos nuevos módulos top-level — split layouts y pretty-print de JSON:
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.0-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.0'));
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,58 @@ 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
+
1064
+ ### v1.3.1 — Polish for panels + json
1065
+
1066
+ Patch release improving the modules from v1.3.0 with quality-of-life additions:
1067
+
1068
+ - 🎯 **`panels.center(block, opts)`** — center a block horizontally (and optionally vertically) in a known width
1069
+ - 🖼️ **`panels.frame(block, opts)`** — lighter alternative to `ascii.box`: top/bottom rules only, with optional title + padding
1070
+ - 📋 **`json.pretty` option `sortKeys`** — alphabetic key order for deterministic diffs
1071
+ - 📐 **`json.pretty` option `inlineArrayMaxLength`** — short arrays of primitives now render as `[1, 2, 3]` on one line (default threshold: 60 chars)
1072
+ - 🧪 **+26 tests** across panels + json modules
1073
+
1074
+ ```js
1075
+ import { panels, json } from 'ansimax';
1076
+
1077
+ // Center a box inside the terminal
1078
+ console.log(panels.center(ascii.box('Hello'), { width: 80 }));
1079
+
1080
+ // Lighter decorative frame
1081
+ console.log(panels.frame('Body', { title: 'Header', padding: 1 }));
1082
+
1083
+ // Sorted, with inline arrays
1084
+ console.log(json.pretty({ zebra: [1, 2, 3], apple: 'A' }, { sortKeys: true }));
1085
+ // {
1086
+ // "apple": "A",
1087
+ // "zebra": [1, 2, 3]
1088
+ // }
1089
+ ```
1090
+
1091
+ Drop-in replacement for `1.3.0`.
1092
+
1009
1093
  ### v1.3.0 — Phase 4 progress: Panels + JSON pretty-print
1010
1094
 
1011
1095
  Minor release adding two new top-level modules — split layouts and JSON pretty-printing: