ansimax 1.2.7 → 1.2.8

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,45 @@
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.2.8] — Documentation polish
7
+
8
+ Patch release improving JSDoc and IntelliSense coverage across previously
9
+ under-documented modules. No code changes — pure documentation upgrade.
10
+
11
+ ### Improved — JSDoc with runnable examples
12
+
13
+ The following functions now have full JSDoc with `@example` blocks visible
14
+ in editor IntelliSense (VS Code, IntelliJ, etc.):
15
+
16
+ **`components/` (previously 0 examples → now 4):**
17
+ - `components.table` — 3 examples (basic, custom borders, colored cells)
18
+ - `components.badge` — 3 examples (basic, custom colors, inline composition)
19
+ - `components.status` — 3 examples (basic, multiline, custom icons)
20
+ - `components.timeline` — 3 examples (basic, done/pending, custom symbols)
21
+
22
+ **`loaders/` (previously 0 examples → now 2):**
23
+ - `loader.spin` — 3 examples (basic, custom type/color, try/finally pattern)
24
+ - `loader.tasks` — 4 examples (serial, subtasks, parallel mode, error handling)
25
+
26
+ **`themes/` (previously 0 examples → now 4):**
27
+ - `themes` object — 4 examples (switching, registering, subscribing, fallback)
28
+
29
+ **`animations/` (previously 1 example → now 6):**
30
+ - `animate.typewriter` — 4 examples (basic, colored, abortable, reduced-motion)
31
+ - `animate.fadeIn` — 3 examples (basic, custom timing, abortable)
32
+
33
+ **`ascii/`:**
34
+ - `ascii.box` — 4 examples (basic, multiline, fixed-width, with color)
35
+
36
+ ### Notes
37
+
38
+ - No new tests required — pure documentation changes
39
+ - No runtime dependencies — still zero
40
+ - No API changes — drop-in replacement for `1.2.7`
41
+ - IntelliSense quality dramatically improved for new users
42
+
43
+ ---
44
+
6
45
  ## [1.2.7] — Bug fixes + robustness
7
46
 
8
47
  Patch release focused on edge case handling, better error messages, and
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.2.7-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
10
+ [![npm](https://img.shields.io/badge/npm-v1.2.8-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-1900%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
@@ -434,7 +434,7 @@ console.log(components.table([
434
434
  ['loaders', color.green('● listo'), '100%'],
435
435
  ], { borderStyle: 'rounded' }));
436
436
 
437
- console.log(components.badge('VERSION', 'v1.2.7'));
437
+ console.log(components.badge('VERSION', 'v1.2.8'));
438
438
  console.log(components.badge('BUILD', 'passing'));
439
439
  ```
440
440
 
@@ -621,6 +621,40 @@ await withConfig({ animationSpeed: 'fast' }, async () => {
621
621
 
622
622
  ---
623
623
 
624
+ ## ⚠️ Códigos de error
625
+
626
+ Varias funciones de ansimax lanzan `Error` / `TypeError` / `RangeError` para inputs inválidos.
627
+ Hacer `catch` por código de error es la forma **estable y recomendada** para manejarlos programáticamente — el texto del mensaje puede cambiar, pero los valores `.code` están garantizados como semver-estables.
628
+
629
+ ```js
630
+ import { themes, ascii, parseFiglet } from 'ansimax';
631
+
632
+ try {
633
+ themes.use('tema-inexistente');
634
+ } catch (e) {
635
+ if (e.code === 'ANSIMAX_UNKNOWN_THEME') {
636
+ themes.use('dracula'); // fallback
637
+ } else {
638
+ throw e; // re-lanzar errores inesperados
639
+ }
640
+ }
641
+ ```
642
+
643
+ ### Todos los códigos de error
644
+
645
+ | Código | Lanzado por | Tipo | Cuándo |
646
+ |---|---|---|---|
647
+ | `ANSIMAX_INVALID_THEME` | `themes.register` | `TypeError` | El valor del tema no es un objeto plano |
648
+ | `ANSIMAX_INVALID_THEME_NAME` | `themes.register` | `TypeError` | El tema tiene `name` vacío o ausente |
649
+ | `ANSIMAX_UNKNOWN_THEME` | `themes.use` | `RangeError` | El nombre del tema solicitado no está registrado |
650
+ | `ANSIMAX_INVALID_FONT_NAME` | `ascii.registerFont` | `TypeError` | Nombre de fuente vacío o no string |
651
+ | `ANSIMAX_RESERVED_FONT_NAME` | `ascii.registerFont` | `Error` | Sobrescribir fuente built-in sin `{ force: true }` |
652
+ | `ANSIMAX_INVALID_FIGLET_INPUT` | `parseFiglet` | `TypeError` | Contenido `.flf` vacío o no string |
653
+ | `ANSIMAX_INVALID_FIGLET_HEADER` | `parseFiglet` | `TypeError` | La primera línea no es un header FIGfont válido |
654
+ | `ANSIMAX_INVALID_FIGLET_HEIGHT` | `parseFiglet` | `TypeError` | El header declara altura cero o negativa |
655
+
656
+ ---
657
+
624
658
  ## 🛣️ Roadmap
625
659
 
626
660
  Ansimax se está construyendo hacia una **plataforma completa de renderizado de terminal** — una respuesta nativa de Node a lo que los desarrolladores de Python obtienen de `rich` + `textual` combinados, con mejoras específicas de Node donde importa.
@@ -837,6 +871,22 @@ ansimax/
837
871
 
838
872
  ## 📝 Changelog
839
873
 
874
+ ### v1.2.8 — Pulido de documentación
875
+
876
+ Release patch con cobertura JSDoc + IntelliSense masivamente mejorada:
877
+
878
+ - 📝 **Módulo `components`** — `table`, `badge`, `status`, `timeline` ahora tienen JSDoc completo con ejemplos ejecutables
879
+ - 📝 **Módulo `loaders`** — `loader.spin` y `loader.tasks` ahora muestran patrones de uso en IntelliSense
880
+ - 📝 **Módulo `themes`** — JSDoc completo con ejemplos de cambio, registro y suscripción
881
+ - 📝 **Módulo `animations`** — `animate.typewriter` y `animate.fadeIn` muestran cómo usar abort signals, reduced-motion, colores custom
882
+ - 📝 **`ascii.box`** — 4 ejemplos (básico, multilínea, ancho fijo, con color)
883
+ - 📖 **Sección Códigos de error** en README — los 8 códigos `ANSIMAX_*` documentados
884
+
885
+ Total: ~30 nuevos bloques `@example` visibles en tu editor. Cero cambios en código —
886
+ tus programas existentes corren idéntico.
887
+
888
+ Drop-in replacement para `1.2.7`.
889
+
840
890
  ### v1.2.7 — Correcciones + robustez
841
891
 
842
892
  Release patch enfocado en manejo de edge cases y mejor DX:
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.2.7-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
10
+ [![npm](https://img.shields.io/badge/npm-v1.2.8-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-1900%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
@@ -434,7 +434,7 @@ console.log(components.table([
434
434
  ['loaders', color.green('● ready'), '100%'],
435
435
  ], { borderStyle: 'rounded' }));
436
436
 
437
- console.log(components.badge('VERSION', 'v1.2.7'));
437
+ console.log(components.badge('VERSION', 'v1.2.8'));
438
438
  console.log(components.badge('BUILD', 'passing'));
439
439
  ```
440
440
 
@@ -621,6 +621,40 @@ await withConfig({ animationSpeed: 'fast' }, async () => {
621
621
 
622
622
  ---
623
623
 
624
+ ## ⚠️ Error codes
625
+
626
+ Several ansimax functions throw `Error` / `TypeError` / `RangeError` for invalid input.
627
+ Catching by error code is the **stable, recommended** way to handle them programmatically — message text may evolve, but `.code` values are guaranteed semver-stable.
628
+
629
+ ```js
630
+ import { themes, ascii, parseFiglet } from 'ansimax';
631
+
632
+ try {
633
+ themes.use('inexistent-theme');
634
+ } catch (e) {
635
+ if (e.code === 'ANSIMAX_UNKNOWN_THEME') {
636
+ themes.use('dracula'); // fallback
637
+ } else {
638
+ throw e; // re-throw unexpected errors
639
+ }
640
+ }
641
+ ```
642
+
643
+ ### All error codes
644
+
645
+ | Code | Thrown by | Type | When |
646
+ |---|---|---|---|
647
+ | `ANSIMAX_INVALID_THEME` | `themes.register` | `TypeError` | Theme value is not a plain object |
648
+ | `ANSIMAX_INVALID_THEME_NAME` | `themes.register` | `TypeError` | Theme has missing/empty `name` |
649
+ | `ANSIMAX_UNKNOWN_THEME` | `themes.use` | `RangeError` | Requested theme name not registered |
650
+ | `ANSIMAX_INVALID_FONT_NAME` | `ascii.registerFont` | `TypeError` | Empty or non-string font name |
651
+ | `ANSIMAX_RESERVED_FONT_NAME` | `ascii.registerFont` | `Error` | Overwriting built-in font without `{ force: true }` |
652
+ | `ANSIMAX_INVALID_FIGLET_INPUT` | `parseFiglet` | `TypeError` | Non-string or empty `.flf` content |
653
+ | `ANSIMAX_INVALID_FIGLET_HEADER` | `parseFiglet` | `TypeError` | First line is not a valid FIGfont header |
654
+ | `ANSIMAX_INVALID_FIGLET_HEIGHT` | `parseFiglet` | `TypeError` | Header declared zero/negative height |
655
+
656
+ ---
657
+
624
658
  ## 🛣️ Roadmap
625
659
 
626
660
  Ansimax is being built toward a **full terminal rendering platform** — a Node-native answer to what Python developers get from `rich` + `textual` combined, with Node-specific improvements where it matters.
@@ -837,6 +871,22 @@ ansimax/
837
871
 
838
872
  ## 📝 Changelog
839
873
 
874
+ ### v1.2.8 — Documentation polish
875
+
876
+ Patch release with massively improved JSDoc + IntelliSense coverage:
877
+
878
+ - 📝 **`components` module** — `table`, `badge`, `status`, `timeline` now have full JSDoc with runnable examples
879
+ - 📝 **`loaders` module** — `loader.spin` and `loader.tasks` now show usage patterns in IntelliSense
880
+ - 📝 **`themes` module** — full JSDoc with switching, registering, subscribing examples
881
+ - 📝 **`animations` module** — `animate.typewriter` and `animate.fadeIn` show how to use abort signals, reduced-motion, custom colors
882
+ - 📝 **`ascii.box`** — 4 examples (basic, multiline, fixed-width, colored content)
883
+ - 📖 **Error codes section** in README — all 8 `ANSIMAX_*` codes documented
884
+
885
+ Total: ~30 new `@example` blocks visible in your editor. No code changes —
886
+ your existing programs run identically.
887
+
888
+ Drop-in replacement for `1.2.7`.
889
+
840
890
  ### v1.2.7 — Bug fixes + robustness
841
891
 
842
892
  Patch release focused on edge case handling and better DX:
package/dist/index.d.mts CHANGED
@@ -1844,6 +1844,64 @@ interface BannerOpts {
1844
1844
  declare const createTheme: (initial?: string) => ThemeInstance;
1845
1845
  /** Clear the global singleton's color cache. */
1846
1846
  declare const clearThemeColorCache: () => void;
1847
+ /**
1848
+ * The global theme registry — a singleton that holds all registered themes
1849
+ * (built-in + custom) and tracks the active one.
1850
+ *
1851
+ * @example switching the active theme
1852
+ * ```js
1853
+ * import { themes } from 'ansimax';
1854
+ *
1855
+ * themes.use('dracula'); // throws if name doesn't exist
1856
+ * themes.tryUse('nord'); // returns true/false, never throws
1857
+ *
1858
+ * const active = themes.current(); // get current Theme definition
1859
+ * console.log(active.primary); // → '#bd93f9'
1860
+ * ```
1861
+ *
1862
+ * @example registering a custom theme
1863
+ * ```js
1864
+ * themes.register('synthwave', {
1865
+ * name: 'synthwave',
1866
+ * primary: '#ff6ec7',
1867
+ * secondary: '#36d6e7',
1868
+ * accent: '#ffd93d',
1869
+ * success: '#06d6a0',
1870
+ * warning: '#ffd93d',
1871
+ * error: '#ff5e5b',
1872
+ * info: '#36d6e7',
1873
+ * muted: '#6c757d',
1874
+ * bg: '#241734',
1875
+ * surface: '#34174f',
1876
+ * text: '#ffffff',
1877
+ * gradient: ['#ff6ec7', '#36d6e7'],
1878
+ * });
1879
+ *
1880
+ * themes.use('synthwave');
1881
+ * ```
1882
+ *
1883
+ * @example subscribing to theme changes
1884
+ * ```js
1885
+ * const unsubscribe = themes.onChange((newT, oldT) => {
1886
+ * console.log(`Theme changed: ${oldT.name} → ${newT.name}`);
1887
+ * // re-render your UI here
1888
+ * });
1889
+ *
1890
+ * // Later: stop listening
1891
+ * unsubscribe();
1892
+ * ```
1893
+ *
1894
+ * @example handling missing themes gracefully
1895
+ * ```js
1896
+ * try {
1897
+ * themes.use('not-real');
1898
+ * } catch (e) {
1899
+ * if (e.code === 'ANSIMAX_UNKNOWN_THEME') {
1900
+ * themes.use('dracula'); // fallback
1901
+ * }
1902
+ * }
1903
+ * ```
1904
+ */
1847
1905
  declare const themes: ThemeInstance;
1848
1906
 
1849
1907
  declare const ansimax: {
package/dist/index.d.ts CHANGED
@@ -1844,6 +1844,64 @@ interface BannerOpts {
1844
1844
  declare const createTheme: (initial?: string) => ThemeInstance;
1845
1845
  /** Clear the global singleton's color cache. */
1846
1846
  declare const clearThemeColorCache: () => void;
1847
+ /**
1848
+ * The global theme registry — a singleton that holds all registered themes
1849
+ * (built-in + custom) and tracks the active one.
1850
+ *
1851
+ * @example switching the active theme
1852
+ * ```js
1853
+ * import { themes } from 'ansimax';
1854
+ *
1855
+ * themes.use('dracula'); // throws if name doesn't exist
1856
+ * themes.tryUse('nord'); // returns true/false, never throws
1857
+ *
1858
+ * const active = themes.current(); // get current Theme definition
1859
+ * console.log(active.primary); // → '#bd93f9'
1860
+ * ```
1861
+ *
1862
+ * @example registering a custom theme
1863
+ * ```js
1864
+ * themes.register('synthwave', {
1865
+ * name: 'synthwave',
1866
+ * primary: '#ff6ec7',
1867
+ * secondary: '#36d6e7',
1868
+ * accent: '#ffd93d',
1869
+ * success: '#06d6a0',
1870
+ * warning: '#ffd93d',
1871
+ * error: '#ff5e5b',
1872
+ * info: '#36d6e7',
1873
+ * muted: '#6c757d',
1874
+ * bg: '#241734',
1875
+ * surface: '#34174f',
1876
+ * text: '#ffffff',
1877
+ * gradient: ['#ff6ec7', '#36d6e7'],
1878
+ * });
1879
+ *
1880
+ * themes.use('synthwave');
1881
+ * ```
1882
+ *
1883
+ * @example subscribing to theme changes
1884
+ * ```js
1885
+ * const unsubscribe = themes.onChange((newT, oldT) => {
1886
+ * console.log(`Theme changed: ${oldT.name} → ${newT.name}`);
1887
+ * // re-render your UI here
1888
+ * });
1889
+ *
1890
+ * // Later: stop listening
1891
+ * unsubscribe();
1892
+ * ```
1893
+ *
1894
+ * @example handling missing themes gracefully
1895
+ * ```js
1896
+ * try {
1897
+ * themes.use('not-real');
1898
+ * } catch (e) {
1899
+ * if (e.code === 'ANSIMAX_UNKNOWN_THEME') {
1900
+ * themes.use('dracula'); // fallback
1901
+ * }
1902
+ * }
1903
+ * ```
1904
+ */
1847
1905
  declare const themes: ThemeInstance;
1848
1906
 
1849
1907
  declare const ansimax: {
@@ -118,7 +118,7 @@ async function main() {
118
118
  console.log(components.section('🏷️ Badges & Status', { width: 60 }));
119
119
  console.log();
120
120
  console.log(' ',
121
- components.badge('VERSION', 'v1.2.7'),
121
+ components.badge('VERSION', 'v1.2.8'),
122
122
  components.badge('BUILD', 'passing'),
123
123
  components.badge('LICENSE', 'Apache 2.0'));
124
124
  console.log();
@@ -117,7 +117,7 @@ console.log();
117
117
  console.log(components.section('🏷️ Badges & Status', { width: 60 }));
118
118
  console.log();
119
119
  console.log(' ',
120
- components.badge('VERSION', 'v1.2.7'),
120
+ components.badge('VERSION', 'v1.2.8'),
121
121
  components.badge('BUILD', 'passing'),
122
122
  components.badge('LICENSE', 'Apache 2.0'));
123
123
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansimax",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Zero-dependency CLI rendering library: colors, gradients, animations, ASCII art, pixel art, components, and themes \u2014 all in TypeScript.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",