ansimax 1.3.3 → 1.3.4
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 +141 -0
- package/README.es.md +31 -3
- package/README.md +31 -3
- package/dist/index.d.mts +346 -195
- package/dist/index.d.ts +346 -195
- package/dist/index.js +187 -4
- package/dist/index.mjs +180 -4
- package/examples/all-in-one.cjs +1 -1
- package/examples/all-in-one.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,147 @@
|
|
|
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.4] — Feature additions across animations, configure, utils
|
|
7
|
+
|
|
8
|
+
Patch release adding small but useful features to several modules. No
|
|
9
|
+
breaking changes — every addition is opt-in.
|
|
10
|
+
|
|
11
|
+
### Added — `animations` module
|
|
12
|
+
|
|
13
|
+
**`animate.shake(text, opts)`** — horizontal tremble effect for errors or alerts:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { animate } from 'ansimax';
|
|
17
|
+
|
|
18
|
+
await animate.shake('Connection failed', {
|
|
19
|
+
times: 5,
|
|
20
|
+
intensity: 2,
|
|
21
|
+
interval: 50,
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**`animate.countUp(from, to, opts)`** — numeric animation for counters:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
await animate.countUp(0, 100, {
|
|
29
|
+
duration: 1500,
|
|
30
|
+
decimals: 0,
|
|
31
|
+
format: (n) => `$${n.toLocaleString()}`,
|
|
32
|
+
easing: (t) => 1 - (1 - t) ** 3, // ease-out cubic
|
|
33
|
+
});
|
|
34
|
+
// Animates from "$0" → "$100" over 1.5 seconds
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Both functions support the standard animation pattern: `signal`, `reducedMotion`,
|
|
38
|
+
`onFrame`, `onDone`, `onAbort`.
|
|
39
|
+
|
|
40
|
+
### Added — `configure` module
|
|
41
|
+
|
|
42
|
+
**`setConfigValue(key, value)`** — single-key shortcut:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import { setConfigValue } from 'ansimax';
|
|
46
|
+
|
|
47
|
+
setConfigValue('theme', 'dracula');
|
|
48
|
+
setConfigValue('animationSpeed', 'fast');
|
|
49
|
+
// equivalent to: configure({ theme: 'dracula' })
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**`subscribeConfig(listener)`** — alias for `onConfigChange` matching the
|
|
53
|
+
naming convention used by `themes.onChange`:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import { subscribeConfig } from 'ansimax';
|
|
57
|
+
|
|
58
|
+
const unsubscribe = subscribeConfig((newCfg, oldCfg) => {
|
|
59
|
+
console.log('Config changed:', newCfg);
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Added — `utils/ansi` module
|
|
64
|
+
|
|
65
|
+
**`hyperlink(url, label?)`** — OSC 8 escape sequence for clickable terminal links:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import { hyperlink } from 'ansimax';
|
|
69
|
+
|
|
70
|
+
console.log(`Visit ${hyperlink('https://github.com/Brashkie/ansimax', 'the repo')}`);
|
|
71
|
+
console.log(`Email: ${hyperlink('mailto:hi@example.com')}`);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Supported terminals: VS Code, iTerm2, WezTerm, Kitty, Hyper, Alacritty, modern
|
|
75
|
+
Windows Terminal. Terminals without support just show the label text.
|
|
76
|
+
|
|
77
|
+
**`clearLine()`** — convenience for clearing current line + carriage return:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import { clearLine } from 'ansimax';
|
|
81
|
+
|
|
82
|
+
for (let i = 0; i <= 100; i++) {
|
|
83
|
+
process.stdout.write(clearLine() + `Progress: ${i}%`);
|
|
84
|
+
await sleep(30);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Added — `utils/helpers` module
|
|
89
|
+
|
|
90
|
+
**`gradientStops(start, end, count)`** — interpolate N hex stops between two colors:
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import { gradientStops } from 'ansimax';
|
|
94
|
+
|
|
95
|
+
const stops = gradientStops('#ff0000', '#0000ff', 5);
|
|
96
|
+
// → ['#ff0000', '#bf003f', '#7f007f', '#3f00bf', '#0000ff']
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**`escapeForRegex(str)`** — escape regex meta-characters in user input:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import { escapeForRegex } from 'ansimax';
|
|
103
|
+
|
|
104
|
+
const userInput = 'hello.world+code';
|
|
105
|
+
const re = new RegExp(escapeForRegex(userInput));
|
|
106
|
+
// Matches the literal string, not as a regex pattern
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**`measureBlock(block)`** — get dimensions of a multi-line string (ANSI-aware):
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { measureBlock, ascii } from 'ansimax';
|
|
113
|
+
|
|
114
|
+
const box = ascii.box('Hello world!');
|
|
115
|
+
const { width, height } = measureBlock(box);
|
|
116
|
+
// → { width: 15, height: 3 }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Improved — `node-globals.d.ts`
|
|
120
|
+
|
|
121
|
+
Added ambient declarations for `AsyncIterator`, `AsyncIterable`, `AsyncGenerator`,
|
|
122
|
+
and `Symbol.asyncIterator`. Lets code using `for await...of` type-check without
|
|
123
|
+
needing `@types/node` installed at consumer projects.
|
|
124
|
+
|
|
125
|
+
### Improved — Tests
|
|
126
|
+
|
|
127
|
+
- `+6` tests for `gradientStops`
|
|
128
|
+
- `+5` tests for `escapeForRegex`
|
|
129
|
+
- `+7` tests for `measureBlock`
|
|
130
|
+
- `+5` tests for `hyperlink`
|
|
131
|
+
- `+2` tests for `clearLine`
|
|
132
|
+
- `+4` tests for `setConfigValue`
|
|
133
|
+
- `+3` tests for `subscribeConfig`
|
|
134
|
+
- `+5` tests for `animate.shake`
|
|
135
|
+
- `+8` tests for `animate.countUp`
|
|
136
|
+
|
|
137
|
+
Total: **+45 tests** across utils, ansi, configure, animations.
|
|
138
|
+
|
|
139
|
+
### Notes
|
|
140
|
+
|
|
141
|
+
- No runtime dependencies — still zero
|
|
142
|
+
- No breaking changes — drop-in replacement for `1.3.3`
|
|
143
|
+
- All new exports backward-compatible by default
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
6
147
|
## [1.3.3] — Feature additions to panels, json, ascii
|
|
7
148
|
|
|
8
149
|
Patch release adding new functionality to three modules. No breaking changes —
|
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)
|
|
10
|
-
[](https://www.npmjs.com/package/ansimax)
|
|
11
11
|
[](tsconfig.json)
|
|
12
12
|
[](#testing)
|
|
13
13
|
[](#testing)
|
|
@@ -478,7 +478,7 @@ console.log(components.table([
|
|
|
478
478
|
['loaders', color.green('● listo'), '100%'],
|
|
479
479
|
], { borderStyle: 'rounded' }));
|
|
480
480
|
|
|
481
|
-
console.log(components.badge('VERSION', 'v1.3.
|
|
481
|
+
console.log(components.badge('VERSION', 'v1.3.4'));
|
|
482
482
|
console.log(components.badge('BUILD', 'passing'));
|
|
483
483
|
```
|
|
484
484
|
|
|
@@ -1065,6 +1065,34 @@ ansimax/
|
|
|
1065
1065
|
|
|
1066
1066
|
## 📝 Changelog
|
|
1067
1067
|
|
|
1068
|
+
### v1.3.4 — Features para animations, configure, utils
|
|
1069
|
+
|
|
1070
|
+
Release patch con features opt-in en varios módulos. Cero breaking changes:
|
|
1071
|
+
|
|
1072
|
+
- 🎬 **`animate.shake(text, opts)`** — efecto tremor horizontal para errores
|
|
1073
|
+
- 🔢 **`animate.countUp(from, to, opts)`** — contadores numéricos animados con format/easing
|
|
1074
|
+
- ⚙️ **`setConfigValue(key, value)`** — atajo single-key + alias `subscribeConfig`
|
|
1075
|
+
- 🔗 **`hyperlink(url, label)`** — links clickables vía OSC 8 (VS Code, iTerm2, WezTerm, Kitty...)
|
|
1076
|
+
- 🧹 **`clearLine()`** — helper conveniente para render loops
|
|
1077
|
+
- 🎨 **`gradientStops(start, end, count)`** — N stops procedurales entre dos colores
|
|
1078
|
+
- 🛡️ **`escapeForRegex(str)`** — escapa input de usuario para regex literals
|
|
1079
|
+
- 📏 **`measureBlock(block)`** — dimensiones ANSI-aware de texto multi-línea
|
|
1080
|
+
- 📐 **`node-globals.d.ts`** — añadidos tipos `AsyncIterator`/`AsyncIterable`/`AsyncGenerator`
|
|
1081
|
+
- 🧪 **+45 tests** entre animations, configure, utils
|
|
1082
|
+
|
|
1083
|
+
```js
|
|
1084
|
+
import { animate, hyperlink } from 'ansimax';
|
|
1085
|
+
|
|
1086
|
+
await animate.countUp(0, 1000, {
|
|
1087
|
+
duration: 1500,
|
|
1088
|
+
format: (n) => `$${n.toLocaleString()}`,
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
console.log(`Ver ${hyperlink('https://npmjs.com/ansimax', 'la página de npm')}`);
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
Drop-in replacement para `1.3.3`.
|
|
1095
|
+
|
|
1068
1096
|
### v1.3.3 — Features para panels, json, ascii
|
|
1069
1097
|
|
|
1070
1098
|
Release patch con nuevas features opt-in. Cero breaking changes:
|
|
@@ -1458,4 +1486,4 @@ Ansimax está licenciada bajo **Apache License, Version 2.0** — una licencia p
|
|
|
1458
1486
|
|
|
1459
1487
|
Si Ansimax te ayuda a hacer mejores CLIs, ¡dale ⭐ en [GitHub](https://github.com/Brashkie/ansimax)!
|
|
1460
1488
|
|
|
1461
|
-
</div>
|
|
1489
|
+
</div>
|
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)
|
|
10
|
-
[](https://www.npmjs.com/package/ansimax)
|
|
11
11
|
[](tsconfig.json)
|
|
12
12
|
[](#testing)
|
|
13
13
|
[](#testing)
|
|
@@ -478,7 +478,7 @@ console.log(components.table([
|
|
|
478
478
|
['loaders', color.green('● ready'), '100%'],
|
|
479
479
|
], { borderStyle: 'rounded' }));
|
|
480
480
|
|
|
481
|
-
console.log(components.badge('VERSION', 'v1.3.
|
|
481
|
+
console.log(components.badge('VERSION', 'v1.3.4'));
|
|
482
482
|
console.log(components.badge('BUILD', 'passing'));
|
|
483
483
|
```
|
|
484
484
|
|
|
@@ -1065,6 +1065,34 @@ ansimax/
|
|
|
1065
1065
|
|
|
1066
1066
|
## 📝 Changelog
|
|
1067
1067
|
|
|
1068
|
+
### v1.3.4 — Feature additions across animations, configure, utils
|
|
1069
|
+
|
|
1070
|
+
Patch release with opt-in additions to several modules. Zero breaking changes:
|
|
1071
|
+
|
|
1072
|
+
- 🎬 **`animate.shake(text, opts)`** — horizontal tremble effect for error feedback
|
|
1073
|
+
- 🔢 **`animate.countUp(from, to, opts)`** — animated numeric counters with format/easing
|
|
1074
|
+
- ⚙️ **`setConfigValue(key, value)`** — single-key config shortcut + `subscribeConfig` alias
|
|
1075
|
+
- 🔗 **`hyperlink(url, label)`** — OSC 8 clickable terminal links (VS Code, iTerm2, WezTerm, Kitty...)
|
|
1076
|
+
- 🧹 **`clearLine()`** — convenience helper for render loops
|
|
1077
|
+
- 🎨 **`gradientStops(start, end, count)`** — procedural N-color stops
|
|
1078
|
+
- 🛡️ **`escapeForRegex(str)`** — escape user input for regex literals
|
|
1079
|
+
- 📏 **`measureBlock(block)`** — get ANSI-aware dimensions of multi-line text
|
|
1080
|
+
- 📐 **`node-globals.d.ts`** — added `AsyncIterator`/`AsyncIterable`/`AsyncGenerator` ambient types
|
|
1081
|
+
- 🧪 **+45 tests** across animations, configure, utils
|
|
1082
|
+
|
|
1083
|
+
```js
|
|
1084
|
+
import { animate, hyperlink } from 'ansimax';
|
|
1085
|
+
|
|
1086
|
+
await animate.countUp(0, 1000, {
|
|
1087
|
+
duration: 1500,
|
|
1088
|
+
format: (n) => `$${n.toLocaleString()}`,
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
console.log(`See ${hyperlink('https://npmjs.com/ansimax', 'the npm page')}`);
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
Drop-in replacement for `1.3.3`.
|
|
1095
|
+
|
|
1068
1096
|
### v1.3.3 — Features for panels, json, ascii
|
|
1069
1097
|
|
|
1070
1098
|
Patch release with new opt-in features. Zero breaking changes:
|
|
@@ -1458,4 +1486,4 @@ Ansimax is licensed under the **Apache License, Version 2.0** — a permissive l
|
|
|
1458
1486
|
|
|
1459
1487
|
If Ansimax helps you ship better CLIs, give it a ⭐ on [GitHub](https://github.com/Brashkie/ansimax)!
|
|
1460
1488
|
|
|
1461
|
-
</div>
|
|
1489
|
+
</div>
|