blessed-components 0.0.1
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/LICENSE +21 -0
- package/README.md +174 -0
- package/ROADMAP.md +406 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 el_jijuna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# blessed-components
|
|
2
|
+
|
|
3
|
+
Composable, typed terminal UI components for
|
|
4
|
+
[Blessed](https://github.com/chjj/blessed).
|
|
5
|
+
|
|
6
|
+
> **Project status:** foundation stage. The package structure and automated
|
|
7
|
+
> release pipeline are ready; UI components are coming soon.
|
|
8
|
+
|
|
9
|
+
## Goals
|
|
10
|
+
|
|
11
|
+
- Small, consistent component APIs.
|
|
12
|
+
- Deterministic renderers that can be tested without a terminal.
|
|
13
|
+
- Thin adapters for Blessed elements and lifecycle.
|
|
14
|
+
- Responsive layouts for narrow terminals.
|
|
15
|
+
- Unicode, ASCII, color, and no-color modes.
|
|
16
|
+
- TypeScript types included with every release.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Components are not available yet. Once the first component ships:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install blessed blessed-components
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`blessed` is a peer dependency.
|
|
27
|
+
|
|
28
|
+
## Coming soon
|
|
29
|
+
|
|
30
|
+
### Core components
|
|
31
|
+
|
|
32
|
+
| Component | Purpose | Priority |
|
|
33
|
+
| ------------- | ---------------------------------------------------- | -------- |
|
|
34
|
+
| `ProgressBar` | Render one bounded horizontal progress bar. | P0 |
|
|
35
|
+
| `Sparkline` | Render compact time-series data with Unicode blocks. | P0 |
|
|
36
|
+
| `MetricBars` | Render labeled metrics as aligned progress bars. | P0 |
|
|
37
|
+
| `Stat` | Display a label and highlighted value. | P0 |
|
|
38
|
+
|
|
39
|
+
### Composition
|
|
40
|
+
|
|
41
|
+
| Component | Purpose | Priority |
|
|
42
|
+
| ---------- | ----------------------------------------------------- | -------- |
|
|
43
|
+
| `Card` | Frame content with an optional title and footer. | P1 |
|
|
44
|
+
| `KeyValue` | Display aligned label/value rows. | P1 |
|
|
45
|
+
| `Badge` | Display compact semantic status text. | P1 |
|
|
46
|
+
| `Divider` | Separate terminal content horizontally or vertically. | P1 |
|
|
47
|
+
| `Stack` | Arrange components with consistent spacing. | P2 |
|
|
48
|
+
|
|
49
|
+
### Feedback and live data
|
|
50
|
+
|
|
51
|
+
| Component | Purpose | Priority |
|
|
52
|
+
| ----------- | -------------------------------------------------- | -------- |
|
|
53
|
+
| `Spinner` | Show ongoing work. | P1 |
|
|
54
|
+
| `Status` | Display semantic state and optional details. | P1 |
|
|
55
|
+
| `Alert` | Display informational, warning, or error messages. | P1 |
|
|
56
|
+
| `LogViewer` | Stream and retain bounded log output. | P1 |
|
|
57
|
+
| `Timer` | Display elapsed or remaining time. | P1 |
|
|
58
|
+
|
|
59
|
+
### Data visualization
|
|
60
|
+
|
|
61
|
+
| Component | Purpose | Priority |
|
|
62
|
+
| ----------- | ------------------------------------- | -------- |
|
|
63
|
+
| `Table` | Display structured tabular data. | P1 |
|
|
64
|
+
| `BarChart` | Compare categorical values. | P2 |
|
|
65
|
+
| `LineChart` | Display one or more time series. | P2 |
|
|
66
|
+
| `Histogram` | Display value distributions. | P2 |
|
|
67
|
+
| `Tree` | Navigate hierarchical data. | P3 |
|
|
68
|
+
| `Heatmap` | Display dense two-dimensional values. | P3 |
|
|
69
|
+
|
|
70
|
+
### Interaction
|
|
71
|
+
|
|
72
|
+
| Component | Purpose | Priority |
|
|
73
|
+
| ---------------- | ---------------------------- | -------- |
|
|
74
|
+
| `Tabs` | Switch between views. | P2 |
|
|
75
|
+
| `Menu` | Navigate a list of actions. | P2 |
|
|
76
|
+
| `Select` | Choose one or more values. | P3 |
|
|
77
|
+
| `TextField` | Enter and validate text. | P3 |
|
|
78
|
+
| `Form` | Compose terminal inputs. | P3 |
|
|
79
|
+
| `CommandPalette` | Search and execute commands. | P3 |
|
|
80
|
+
|
|
81
|
+
See [ROADMAP.md](./ROADMAP.md) for milestones, proposed APIs, and TDD strategy.
|
|
82
|
+
|
|
83
|
+
## Architecture
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
src/
|
|
87
|
+
core/ framework-independent rendering primitives
|
|
88
|
+
components/ pure component renderers
|
|
89
|
+
adapters/ Blessed widget adapters
|
|
90
|
+
tests/
|
|
91
|
+
public-api/ behavior through exported APIs
|
|
92
|
+
blessed-integration/ integration with real Blessed elements
|
|
93
|
+
examples/
|
|
94
|
+
dashboard/ executable component showcase
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Renderers remain independent from Blessed. Adapters own element updates,
|
|
98
|
+
listeners, timers, and cleanup.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
Requires Node.js 22.14 or newer.
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
npm install
|
|
106
|
+
npm run validate
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Useful commands:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
npm run build
|
|
113
|
+
npm test
|
|
114
|
+
npm run test:watch
|
|
115
|
+
npm run lint
|
|
116
|
+
npm run typecheck
|
|
117
|
+
npm run format
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Testing
|
|
121
|
+
|
|
122
|
+
Development follows vertical TDD slices:
|
|
123
|
+
|
|
124
|
+
1. Add one failing test for public behavior.
|
|
125
|
+
2. Add minimum implementation needed to pass.
|
|
126
|
+
3. Refactor while tests remain green.
|
|
127
|
+
4. Repeat with next behavior.
|
|
128
|
+
|
|
129
|
+
Tests should use public interfaces and observable output. Internal mocks and
|
|
130
|
+
large snapshots are avoided.
|
|
131
|
+
|
|
132
|
+
## Releases
|
|
133
|
+
|
|
134
|
+
[semantic-release](https://github.com/semantic-release/semantic-release)
|
|
135
|
+
publishes from `main`.
|
|
136
|
+
|
|
137
|
+
Commit messages follow
|
|
138
|
+
[Conventional Commits](https://www.conventionalcommits.org/):
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
fix: clamp progress values
|
|
142
|
+
feat: add progress bar renderer
|
|
143
|
+
feat!: change component update contract
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Release mapping:
|
|
147
|
+
|
|
148
|
+
| Commit | Release |
|
|
149
|
+
| --------------- | ------- |
|
|
150
|
+
| `fix:` | Patch |
|
|
151
|
+
| `feat:` | Minor |
|
|
152
|
+
| Breaking change | Major |
|
|
153
|
+
|
|
154
|
+
The release workflow:
|
|
155
|
+
|
|
156
|
+
1. Validates formatting, linting, types, tests, and build.
|
|
157
|
+
2. Calculates the next version from commits.
|
|
158
|
+
3. Publishes the package to npm.
|
|
159
|
+
4. Creates a GitHub release with generated notes.
|
|
160
|
+
|
|
161
|
+
### npm trusted publishing setup
|
|
162
|
+
|
|
163
|
+
Before the first release, configure an npm trusted publisher for:
|
|
164
|
+
|
|
165
|
+
- Organization or user: `ElJijuna`
|
|
166
|
+
- Repository: `blessed-components`
|
|
167
|
+
- Workflow filename: `release.yml`
|
|
168
|
+
|
|
169
|
+
The workflow uses GitHub Actions OIDC and npm provenance. No long-lived
|
|
170
|
+
`NPM_TOKEN` is required.
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
[MIT](./LICENSE)
|
package/ROADMAP.md
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
# blessed-components — Roadmap
|
|
2
|
+
|
|
3
|
+
Biblioteca de componentes reutilizables para interfaces de terminal construidas
|
|
4
|
+
sobre `blessed`.
|
|
5
|
+
|
|
6
|
+
## Visión
|
|
7
|
+
|
|
8
|
+
Convertir bloques de texto, tags, Unicode, cálculo de ancho y estado en
|
|
9
|
+
componentes con:
|
|
10
|
+
|
|
11
|
+
- API pequeña y consistente.
|
|
12
|
+
- renderizado determinista.
|
|
13
|
+
- actualización de datos sin reconstruir pantalla.
|
|
14
|
+
- soporte para terminales estrechas, sin color y sin Unicode.
|
|
15
|
+
- integración directa con elementos `blessed`.
|
|
16
|
+
- pruebas mediante API pública.
|
|
17
|
+
|
|
18
|
+
## Vocabulario
|
|
19
|
+
|
|
20
|
+
Los ejemplos iniciales representan dos componentes distintos:
|
|
21
|
+
|
|
22
|
+
| Nombre | Responsabilidad |
|
|
23
|
+
| ------------- | -------------------------------------------------------- |
|
|
24
|
+
| `Sparkline` | Serie temporal compacta usando `▁▂▃▄▅▆▇█`. |
|
|
25
|
+
| `MetricBars` | Grupo de métricas con barras horizontales y porcentajes. |
|
|
26
|
+
| `ProgressBar` | Una sola barra horizontal. Base usada por `MetricBars`. |
|
|
27
|
+
| `Stat` | Etiqueta y valor destacado. |
|
|
28
|
+
| `Card` | Marco opcional que compone título, contenido y pie. |
|
|
29
|
+
|
|
30
|
+
`BarChart` queda reservado para barras que representan categorías o series. No
|
|
31
|
+
debe usarse para `Sparkline` ni `ProgressBar`.
|
|
32
|
+
|
|
33
|
+
## API pública propuesta
|
|
34
|
+
|
|
35
|
+
Dos capas:
|
|
36
|
+
|
|
37
|
+
1. Renderers puros: reciben datos y retornan contenido compatible con
|
|
38
|
+
`blessed`.
|
|
39
|
+
2. Widgets: crean elementos `blessed`, conservan estado y exponen `setData`.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import {
|
|
43
|
+
renderSparkline,
|
|
44
|
+
renderMetricBars,
|
|
45
|
+
sparkline,
|
|
46
|
+
metricBars,
|
|
47
|
+
} from 'blessed-components'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Renderer puro
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const content = renderSparkline({
|
|
54
|
+
label: 'Last 30 days',
|
|
55
|
+
values: [1, 2, 3, 4, 3, 5, 6, 7, 8],
|
|
56
|
+
summary: 'peak: 3.8M',
|
|
57
|
+
width: 40,
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Widget Blessed
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const downloads = sparkline({
|
|
65
|
+
parent: screen,
|
|
66
|
+
label: 'Weekly downloads',
|
|
67
|
+
value: 25_200_000,
|
|
68
|
+
values: downloadsByDay,
|
|
69
|
+
summary: 'peak: 3.8M',
|
|
70
|
+
top: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
width: 42,
|
|
73
|
+
height: 7,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
downloads.setData(nextDownloadsByDay)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### MetricBars
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const score = metricBars({
|
|
83
|
+
parent: screen,
|
|
84
|
+
label: 'Overall',
|
|
85
|
+
value: 85,
|
|
86
|
+
metrics: [
|
|
87
|
+
{ label: 'Quality', value: 78 },
|
|
88
|
+
{ label: 'Popularity', value: 99 },
|
|
89
|
+
{ label: 'Maintenance', value: 82 },
|
|
90
|
+
],
|
|
91
|
+
min: 0,
|
|
92
|
+
max: 100,
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Principios de diseño
|
|
97
|
+
|
|
98
|
+
- Datos separados de presentación.
|
|
99
|
+
- Renderer puro como fuente única del contenido.
|
|
100
|
+
- Widget `blessed` como adaptador fino.
|
|
101
|
+
- `setData` actualiza contenido; caller decide cuándo ejecutar
|
|
102
|
+
`screen.render()`.
|
|
103
|
+
- Dimensiones automáticas usan ancho interior real.
|
|
104
|
+
- Valores fuera de rango se limitan mediante `clamp`.
|
|
105
|
+
- Datos inválidos producen error descriptivo o estado vacío documentado.
|
|
106
|
+
- Tema mediante tokens semánticos, no tags escritos por consumidor.
|
|
107
|
+
- Colores y caracteres configurables por componente.
|
|
108
|
+
- Sin mutación de arrays u objetos recibidos.
|
|
109
|
+
- TypeScript primero; tipos publicados con paquete.
|
|
110
|
+
- Dependencia `blessed` como `peerDependency`.
|
|
111
|
+
|
|
112
|
+
## Arquitectura objetivo
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
src/
|
|
116
|
+
core/
|
|
117
|
+
width.ts
|
|
118
|
+
scale.ts
|
|
119
|
+
format.ts
|
|
120
|
+
theme.ts
|
|
121
|
+
tags.ts
|
|
122
|
+
components/
|
|
123
|
+
stat/
|
|
124
|
+
progress-bar/
|
|
125
|
+
sparkline/
|
|
126
|
+
metric-bars/
|
|
127
|
+
adapters/
|
|
128
|
+
blessed.ts
|
|
129
|
+
index.ts
|
|
130
|
+
tests/
|
|
131
|
+
public-api/
|
|
132
|
+
blessed-integration/
|
|
133
|
+
examples/
|
|
134
|
+
dashboard/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`core` no conoce `blessed`. `components` usa `core` para producir modelos o
|
|
138
|
+
contenido. `adapters` conecta contenido, eventos y ciclo de vida con
|
|
139
|
+
`blessed`.
|
|
140
|
+
|
|
141
|
+
## Estrategia TDD
|
|
142
|
+
|
|
143
|
+
Desarrollo por cortes verticales. Nunca escribir todas las pruebas antes de
|
|
144
|
+
toda la implementación.
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
RED: prueba de un comportamiento público
|
|
148
|
+
↓
|
|
149
|
+
GREEN: implementación mínima
|
|
150
|
+
↓
|
|
151
|
+
REFACTOR: limpiar manteniendo verde
|
|
152
|
+
↓
|
|
153
|
+
siguiente comportamiento
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Prioridad de pruebas:
|
|
157
|
+
|
|
158
|
+
1. Salida visible del renderer público.
|
|
159
|
+
2. Límites, escalado y ancho disponible.
|
|
160
|
+
3. Actualización mediante `setData`.
|
|
161
|
+
4. Integración real con elemento `blessed`.
|
|
162
|
+
5. Fallbacks ASCII, sin color y estado vacío.
|
|
163
|
+
|
|
164
|
+
Evitar pruebas de funciones privadas, mocks internos o estructura de carpetas.
|
|
165
|
+
Snapshots grandes no serán contrato principal; usar expectativas pequeñas y
|
|
166
|
+
legibles.
|
|
167
|
+
|
|
168
|
+
## Hitos
|
|
169
|
+
|
|
170
|
+
### M0 — Fundación del paquete
|
|
171
|
+
|
|
172
|
+
Objetivo: paquete instalable, testeable y publicable.
|
|
173
|
+
|
|
174
|
+
- Configurar TypeScript.
|
|
175
|
+
- Elegir runner de pruebas.
|
|
176
|
+
- Definir builds ESM y CommonJS según compatibilidad real de `blessed`.
|
|
177
|
+
- Configurar lint, format, coverage y CI.
|
|
178
|
+
- Publicar exports y tipos.
|
|
179
|
+
- Añadir ejemplo mínimo que monte un componente en `blessed`.
|
|
180
|
+
|
|
181
|
+
Criterio de salida:
|
|
182
|
+
|
|
183
|
+
- `npm test`, `npm run build` y typecheck pasan.
|
|
184
|
+
- consumidor externo puede importar un renderer.
|
|
185
|
+
- CI prueba versiones Node soportadas.
|
|
186
|
+
|
|
187
|
+
### M1 — Tracer bullet: ProgressBar
|
|
188
|
+
|
|
189
|
+
Objetivo: probar camino completo renderer → widget → pantalla.
|
|
190
|
+
|
|
191
|
+
Ciclos RED→GREEN:
|
|
192
|
+
|
|
193
|
+
1. Renderiza barra al 50% con ancho fijo.
|
|
194
|
+
2. Limita valores menores que `min` y mayores que `max`.
|
|
195
|
+
3. Muestra etiqueta y valor formateado.
|
|
196
|
+
4. Respeta ancho interior estrecho.
|
|
197
|
+
5. `setData` cambia contenido del widget.
|
|
198
|
+
6. Usa caracteres ASCII cuando Unicode está desactivado.
|
|
199
|
+
|
|
200
|
+
Criterio de salida:
|
|
201
|
+
|
|
202
|
+
- API pública validada con un componente pequeño.
|
|
203
|
+
- patrón reutilizable para próximos widgets.
|
|
204
|
+
|
|
205
|
+
### M2 — Sparkline
|
|
206
|
+
|
|
207
|
+
Objetivo: componetizar gráfico de descargas.
|
|
208
|
+
|
|
209
|
+
Ciclos RED→GREEN:
|
|
210
|
+
|
|
211
|
+
1. Escala valores al rango `▁`…`█`.
|
|
212
|
+
2. Conserva orden de serie.
|
|
213
|
+
3. Maneja serie constante sin división por cero.
|
|
214
|
+
4. Maneja serie vacía con placeholder.
|
|
215
|
+
5. Reduce o recorta datos según ancho disponible.
|
|
216
|
+
6. Renderiza label, valor principal y summary opcionales.
|
|
217
|
+
7. Actualiza serie mediante `setData`.
|
|
218
|
+
8. Permite dominio explícito `{ min, max }`.
|
|
219
|
+
|
|
220
|
+
Criterio de salida:
|
|
221
|
+
|
|
222
|
+
- ejemplo `downloads` ya no contiene strings de presentación manuales.
|
|
223
|
+
- salida estable en terminal estrecha.
|
|
224
|
+
|
|
225
|
+
### M3 — MetricBars
|
|
226
|
+
|
|
227
|
+
Objetivo: componetizar score general y desglose.
|
|
228
|
+
|
|
229
|
+
Ciclos RED→GREEN:
|
|
230
|
+
|
|
231
|
+
1. Renderiza una métrica mediante `ProgressBar`.
|
|
232
|
+
2. Alinea labels usando ancho visible, no longitud bruta con tags.
|
|
233
|
+
3. Renderiza varias métricas en orden.
|
|
234
|
+
4. Calcula ancho restante para barra y valor.
|
|
235
|
+
5. Trunca labels largos.
|
|
236
|
+
6. Admite valor general opcional.
|
|
237
|
+
7. Actualiza una lista completa mediante `setData`.
|
|
238
|
+
|
|
239
|
+
Criterio de salida:
|
|
240
|
+
|
|
241
|
+
- ejemplo `score` usa datos estructurados.
|
|
242
|
+
- `MetricBars` compone `ProgressBar`; no duplica escalado.
|
|
243
|
+
|
|
244
|
+
### M4 — Sistema visual
|
|
245
|
+
|
|
246
|
+
Objetivo: consistencia entre componentes.
|
|
247
|
+
|
|
248
|
+
- `Theme`: `primary`, `muted`, `success`, `warning`, `danger`, `border`.
|
|
249
|
+
- Presets `unicode`, `ascii`, `noColor`.
|
|
250
|
+
- `formatNumber`, `formatPercent`, `formatDuration`, `formatBytes`.
|
|
251
|
+
- Utilidad de ancho visible compatible con tags `blessed`.
|
|
252
|
+
- Escape seguro de texto dinámico.
|
|
253
|
+
- Estados `empty`, `loading`, `error`, `disabled`.
|
|
254
|
+
|
|
255
|
+
Criterio de salida:
|
|
256
|
+
|
|
257
|
+
- consumidor cambia apariencia sin construir tags manuales.
|
|
258
|
+
- texto con llaves o tags no rompe contenido.
|
|
259
|
+
|
|
260
|
+
### M5 — Composición de dashboard
|
|
261
|
+
|
|
262
|
+
Objetivo: construir pantallas completas sin strings monolíticos.
|
|
263
|
+
|
|
264
|
+
Componentes:
|
|
265
|
+
|
|
266
|
+
- `Stat`
|
|
267
|
+
- `Card`
|
|
268
|
+
- `KeyValue`
|
|
269
|
+
- `Badge`
|
|
270
|
+
- `Divider`
|
|
271
|
+
- `Stack`
|
|
272
|
+
|
|
273
|
+
Validación:
|
|
274
|
+
|
|
275
|
+
- dashboard de ejemplo combina `Stat`, `Sparkline` y `MetricBars`.
|
|
276
|
+
- resize recalcula contenido sin fugas de listeners.
|
|
277
|
+
- navegación de foco sigue siendo responsabilidad clara.
|
|
278
|
+
|
|
279
|
+
### M6 — Feedback y datos vivos
|
|
280
|
+
|
|
281
|
+
Componentes:
|
|
282
|
+
|
|
283
|
+
- `Spinner`
|
|
284
|
+
- `Status`
|
|
285
|
+
- `Alert`
|
|
286
|
+
- `LogViewer`
|
|
287
|
+
- `Timer`
|
|
288
|
+
|
|
289
|
+
Capacidades:
|
|
290
|
+
|
|
291
|
+
- actualizaciones frecuentes con render mínimo.
|
|
292
|
+
- pausa, reanudación y limpieza de timers/listeners.
|
|
293
|
+
- límite configurable de historial.
|
|
294
|
+
|
|
295
|
+
### M7 — Datos avanzados
|
|
296
|
+
|
|
297
|
+
Componentes:
|
|
298
|
+
|
|
299
|
+
- `BarChart`
|
|
300
|
+
- `LineChart`
|
|
301
|
+
- `Histogram`
|
|
302
|
+
- `Heatmap`
|
|
303
|
+
- `Table`
|
|
304
|
+
- `Tree`
|
|
305
|
+
|
|
306
|
+
Regla: construir solo cuando primitives actuales no puedan componer caso.
|
|
307
|
+
Evitar duplicar `blessed-contrib` sin ventaja clara de API, tamaño, pruebas o
|
|
308
|
+
accesibilidad.
|
|
309
|
+
|
|
310
|
+
### M8 — Interacción
|
|
311
|
+
|
|
312
|
+
Componentes:
|
|
313
|
+
|
|
314
|
+
- `Tabs`
|
|
315
|
+
- `Menu`
|
|
316
|
+
- `CommandPalette`
|
|
317
|
+
- `Select`
|
|
318
|
+
- `TextField`
|
|
319
|
+
- `Form`
|
|
320
|
+
|
|
321
|
+
Requisitos:
|
|
322
|
+
|
|
323
|
+
- teclado configurable.
|
|
324
|
+
- foco visible.
|
|
325
|
+
- cleanup completo de eventos.
|
|
326
|
+
- acciones públicas testeables sin inspeccionar internals.
|
|
327
|
+
|
|
328
|
+
### M9 — Release 1.0
|
|
329
|
+
|
|
330
|
+
- API estable y política SemVer.
|
|
331
|
+
- documentación por componente.
|
|
332
|
+
- ejemplos copiables.
|
|
333
|
+
- tabla de compatibilidad Node, terminal y `blessed`.
|
|
334
|
+
- changelog y guía de migración.
|
|
335
|
+
- pruebas en Linux, macOS y Windows.
|
|
336
|
+
- presupuesto de tamaño y rendimiento.
|
|
337
|
+
|
|
338
|
+
## Backlog de componentes
|
|
339
|
+
|
|
340
|
+
| Prioridad | Componente | Estado objetivo |
|
|
341
|
+
| --------- | ------------------------------------------- | ----------------- |
|
|
342
|
+
| P0 | `ProgressBar` | tracer bullet |
|
|
343
|
+
| P0 | `Sparkline` | ejemplo downloads |
|
|
344
|
+
| P0 | `MetricBars` | ejemplo score |
|
|
345
|
+
| P0 | `Stat` | valor destacado |
|
|
346
|
+
| P1 | `Card`, `KeyValue`, `Badge`, `Divider` | composición |
|
|
347
|
+
| P1 | `Spinner`, `Status`, `Alert` | feedback |
|
|
348
|
+
| P1 | `Table`, `LogViewer` | datos |
|
|
349
|
+
| P2 | `Stack`, `Tabs`, `Menu` | layout/navegación |
|
|
350
|
+
| P2 | `BarChart`, `LineChart`, `Histogram` | charts |
|
|
351
|
+
| P3 | `CommandPalette`, `Form`, `Tree`, `Heatmap` | avanzado |
|
|
352
|
+
|
|
353
|
+
## Contratos comunes
|
|
354
|
+
|
|
355
|
+
Todos los componentes deben definir:
|
|
356
|
+
|
|
357
|
+
- datos aceptados.
|
|
358
|
+
- salida para datos vacíos.
|
|
359
|
+
- comportamiento ante valores inválidos.
|
|
360
|
+
- política de truncado y resize.
|
|
361
|
+
- soporte color/Unicode.
|
|
362
|
+
- métodos de actualización.
|
|
363
|
+
- eventos emitidos, si existen.
|
|
364
|
+
- ownership de listeners, timers y destrucción.
|
|
365
|
+
|
|
366
|
+
Interfaz común candidata:
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
interface ComponentHandle<T> {
|
|
370
|
+
element: blessed.Widgets.BoxElement
|
|
371
|
+
setData(data: T): void
|
|
372
|
+
destroy(): void
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Adoptar solo después del tracer bullet. Si retornar directamente elemento
|
|
377
|
+
`blessed` resulta más natural, preferir API menor.
|
|
378
|
+
|
|
379
|
+
## Definition of Done por componente
|
|
380
|
+
|
|
381
|
+
- API pública documentada.
|
|
382
|
+
- cada comportamiento agregado mediante ciclo RED→GREEN.
|
|
383
|
+
- tests ejercen renderer/widget público.
|
|
384
|
+
- estados normal, vacío, inválido y estrecho cubiertos.
|
|
385
|
+
- Unicode y ASCII cubiertos.
|
|
386
|
+
- ejemplo ejecutable.
|
|
387
|
+
- cero listeners o timers después de `destroy`.
|
|
388
|
+
- exports y tipos verificados desde paquete compilado.
|
|
389
|
+
- changelog actualizado.
|
|
390
|
+
|
|
391
|
+
## Decisiones antes de implementar M0
|
|
392
|
+
|
|
393
|
+
1. Runtime mínimo de Node.
|
|
394
|
+
2. TypeScript obligatorio o JS con tipos generados.
|
|
395
|
+
3. Runner: Vitest, Node test runner u otro.
|
|
396
|
+
4. Soporte ESM, CommonJS o ambos.
|
|
397
|
+
5. `blessed` exacto soportado: paquete original o fork mantenido.
|
|
398
|
+
6. Primera API de widget:
|
|
399
|
+
- retornar elemento `blessed` extendido; o
|
|
400
|
+
- retornar `ComponentHandle`.
|
|
401
|
+
7. Política de resize:
|
|
402
|
+
- automática mediante eventos; o
|
|
403
|
+
- explícita mediante `setSize`/`render`.
|
|
404
|
+
|
|
405
|
+
Recomendación inicial: resolver estas decisiones durante M0; después ejecutar
|
|
406
|
+
M1 como tracer bullet antes de ampliar catálogo.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "blessed-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Composable, typed terminal UI components for Blessed.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"blessed",
|
|
7
|
+
"cli",
|
|
8
|
+
"components",
|
|
9
|
+
"terminal",
|
|
10
|
+
"tui"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/ElJijuna/blessed-components#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ElJijuna/blessed-components/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/ElJijuna/blessed-components.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "pilmee <pilmee@gmail.com> (https://github.com/ElJijuna)",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"README.md",
|
|
37
|
+
"ROADMAP.md"
|
|
38
|
+
],
|
|
39
|
+
"sideEffects": false,
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22.14.0"
|
|
42
|
+
},
|
|
43
|
+
"packageManager": "npm@11.16.0",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup",
|
|
49
|
+
"clean": "rm -rf coverage dist",
|
|
50
|
+
"format": "prettier --write .",
|
|
51
|
+
"format:check": "prettier --check .",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"release": "semantic-release",
|
|
54
|
+
"test": "vitest run --passWithNoTests",
|
|
55
|
+
"test:watch": "vitest",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"validate": "npm run format:check && npm run lint && npm run typecheck && npm test && npm run build",
|
|
58
|
+
"prepublishOnly": "npm run validate"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"blessed": "^0.1.81"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@eslint/js": "^10.0.1",
|
|
65
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
66
|
+
"@semantic-release/github": "^12.0.8",
|
|
67
|
+
"@semantic-release/npm": "^13.1.5",
|
|
68
|
+
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
69
|
+
"@types/blessed": "^0.1.27",
|
|
70
|
+
"@types/node": "^22.20.0",
|
|
71
|
+
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
72
|
+
"eslint": "^10.5.0",
|
|
73
|
+
"eslint-config-prettier": "^10.1.8",
|
|
74
|
+
"prettier": "^3.8.4",
|
|
75
|
+
"semantic-release": "^25.0.5",
|
|
76
|
+
"tsup": "^8.5.1",
|
|
77
|
+
"typescript": "^6.0.3",
|
|
78
|
+
"typescript-eslint": "^8.61.1",
|
|
79
|
+
"vitest": "^4.1.9"
|
|
80
|
+
}
|
|
81
|
+
}
|