@aednzxy/smith-tui 0.0.0-stage → 0.1.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/README.md +160 -2
- package/dist/app/commands.js +58 -0
- package/dist/app/commands.js.map +1 -0
- package/dist/app/controller.js +5129 -0
- package/dist/app/controller.js.map +1 -0
- package/dist/app/state.js +266 -0
- package/dist/app/state.js.map +1 -0
- package/dist/cli.js +154 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/config.js +110 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/http.js +796 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/reducer.js +623 -0
- package/dist/client/reducer.js.map +1 -0
- package/dist/client/session-start.js +39 -0
- package/dist/client/session-start.js.map +1 -0
- package/dist/client/shell-ws.js +126 -0
- package/dist/client/shell-ws.js.map +1 -0
- package/dist/client/types.js +22 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/ws.js +233 -0
- package/dist/client/ws.js.map +1 -0
- package/dist/engine/color.js +142 -0
- package/dist/engine/color.js.map +1 -0
- package/dist/engine/editor.js +350 -0
- package/dist/engine/editor.js.map +1 -0
- package/dist/engine/input.js +351 -0
- package/dist/engine/input.js.map +1 -0
- package/dist/engine/screen.js +513 -0
- package/dist/engine/screen.js.map +1 -0
- package/dist/engine/terminal.js +163 -0
- package/dist/engine/terminal.js.map +1 -0
- package/dist/format/diff.js +85 -0
- package/dist/format/diff.js.map +1 -0
- package/dist/format/markdown.js +438 -0
- package/dist/format/markdown.js.map +1 -0
- package/dist/format/questions.js +78 -0
- package/dist/format/questions.js.map +1 -0
- package/dist/format/sessions.js +310 -0
- package/dist/format/sessions.js.map +1 -0
- package/dist/format/time.js +217 -0
- package/dist/format/time.js.map +1 -0
- package/dist/format/tools.js +169 -0
- package/dist/format/tools.js.map +1 -0
- package/dist/format/vt.js +233 -0
- package/dist/format/vt.js.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/palettes.js +1651 -0
- package/dist/theme/palettes.js.map +1 -0
- package/dist/views/activity-view.js +212 -0
- package/dist/views/activity-view.js.map +1 -0
- package/dist/views/auth-view.js +85 -0
- package/dist/views/auth-view.js.map +1 -0
- package/dist/views/boards-view.js +163 -0
- package/dist/views/boards-view.js.map +1 -0
- package/dist/views/chat-view.js +626 -0
- package/dist/views/chat-view.js.map +1 -0
- package/dist/views/compute-view.js +281 -0
- package/dist/views/compute-view.js.map +1 -0
- package/dist/views/files-skills-view.js +209 -0
- package/dist/views/files-skills-view.js.map +1 -0
- package/dist/views/fleet-view.js +282 -0
- package/dist/views/fleet-view.js.map +1 -0
- package/dist/views/inspector-view.js +612 -0
- package/dist/views/inspector-view.js.map +1 -0
- package/dist/views/memory-view.js +316 -0
- package/dist/views/memory-view.js.map +1 -0
- package/dist/views/modals-view.js +709 -0
- package/dist/views/modals-view.js.map +1 -0
- package/dist/views/notes-view.js +133 -0
- package/dist/views/notes-view.js.map +1 -0
- package/dist/views/select-agent-view.js +153 -0
- package/dist/views/select-agent-view.js.map +1 -0
- package/dist/views/settings-view.js +538 -0
- package/dist/views/settings-view.js.map +1 -0
- package/dist/views/shell-layout.js +802 -0
- package/dist/views/shell-layout.js.map +1 -0
- package/package.json +47 -4
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
// Double-buffered 2D terminal cell grid with Unicode display-width handling,
|
|
2
|
+
// clipping regions, drawing primitives, and synchronized-output minimal ANSI diffing.
|
|
3
|
+
import { sameColor, sgrBg, sgrFg } from './color.js';
|
|
4
|
+
const FLAG_BOLD = 1;
|
|
5
|
+
const FLAG_DIM = 2;
|
|
6
|
+
const FLAG_ITALIC = 4;
|
|
7
|
+
const FLAG_UNDERLINE = 8;
|
|
8
|
+
const FLAG_INVERSE = 16;
|
|
9
|
+
const FLAG_STRIKE = 32;
|
|
10
|
+
export function styleFlags(style) {
|
|
11
|
+
if (!style)
|
|
12
|
+
return 0;
|
|
13
|
+
let f = 0;
|
|
14
|
+
if (style.bold)
|
|
15
|
+
f |= FLAG_BOLD;
|
|
16
|
+
if (style.dim)
|
|
17
|
+
f |= FLAG_DIM;
|
|
18
|
+
if (style.italic)
|
|
19
|
+
f |= FLAG_ITALIC;
|
|
20
|
+
if (style.underline)
|
|
21
|
+
f |= FLAG_UNDERLINE;
|
|
22
|
+
if (style.inverse)
|
|
23
|
+
f |= FLAG_INVERSE;
|
|
24
|
+
if (style.strikethrough)
|
|
25
|
+
f |= FLAG_STRIKE;
|
|
26
|
+
return f;
|
|
27
|
+
}
|
|
28
|
+
/** Terminal column width of one Unicode code point (0, 1, or 2). */
|
|
29
|
+
export function codePointWidth(cp) {
|
|
30
|
+
if (cp === 0)
|
|
31
|
+
return 0;
|
|
32
|
+
// C0/C1 control characters
|
|
33
|
+
if (cp < 0x20 || (cp >= 0x7f && cp < 0xa0))
|
|
34
|
+
return 0;
|
|
35
|
+
// Zero-width / combining marks / variation selectors
|
|
36
|
+
if ((cp >= 0x0300 && cp <= 0x036f) ||
|
|
37
|
+
(cp >= 0x1ab0 && cp <= 0x1aff) ||
|
|
38
|
+
(cp >= 0x1dc0 && cp <= 0x1dff) ||
|
|
39
|
+
(cp >= 0x200b && cp <= 0x200f) ||
|
|
40
|
+
(cp >= 0x202a && cp <= 0x202e) ||
|
|
41
|
+
(cp >= 0x2060 && cp <= 0x206f) ||
|
|
42
|
+
(cp >= 0x20d0 && cp <= 0x20ff) ||
|
|
43
|
+
(cp >= 0xfe00 && cp <= 0xfe0f) ||
|
|
44
|
+
(cp >= 0xfe20 && cp <= 0xfe2f) ||
|
|
45
|
+
cp === 0xfeff) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
// East Asian Wide / Fullwidth + common emoji blocks
|
|
49
|
+
if (cp >= 0x1100 &&
|
|
50
|
+
(cp <= 0x115f ||
|
|
51
|
+
cp === 0x2329 ||
|
|
52
|
+
cp === 0x232a ||
|
|
53
|
+
(cp >= 0x2e80 && cp <= 0xa4cf && cp !== 0x303f) ||
|
|
54
|
+
(cp >= 0xac00 && cp <= 0xd7a3) ||
|
|
55
|
+
(cp >= 0xf900 && cp <= 0xfaff) ||
|
|
56
|
+
(cp >= 0xfe10 && cp <= 0xfe19) ||
|
|
57
|
+
(cp >= 0xfe30 && cp <= 0xfe6f) ||
|
|
58
|
+
(cp >= 0xff00 && cp <= 0xff60) ||
|
|
59
|
+
(cp >= 0xffe0 && cp <= 0xffe6) ||
|
|
60
|
+
(cp >= 0x1f300 && cp <= 0x1f9ff) ||
|
|
61
|
+
(cp >= 0x1fa70 && cp <= 0x1faff) ||
|
|
62
|
+
(cp >= 0x20000 && cp <= 0x3fffd))) {
|
|
63
|
+
return 2;
|
|
64
|
+
}
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
export function stringWidth(str) {
|
|
68
|
+
let width = 0;
|
|
69
|
+
for (const ch of str) {
|
|
70
|
+
const cp = ch.codePointAt(0);
|
|
71
|
+
if (cp !== undefined)
|
|
72
|
+
width += codePointWidth(cp);
|
|
73
|
+
}
|
|
74
|
+
return width;
|
|
75
|
+
}
|
|
76
|
+
/** Truncate `str` so its display width fits inside `maxWidth`, appending ellipsis if clipped. */
|
|
77
|
+
export function truncateWidth(str, maxWidth, ellipsis = '…') {
|
|
78
|
+
if (maxWidth <= 0)
|
|
79
|
+
return '';
|
|
80
|
+
if (stringWidth(str) <= maxWidth)
|
|
81
|
+
return str;
|
|
82
|
+
const ellipsisW = stringWidth(ellipsis);
|
|
83
|
+
const target = Math.max(0, maxWidth - ellipsisW);
|
|
84
|
+
let out = '';
|
|
85
|
+
let w = 0;
|
|
86
|
+
for (const ch of str) {
|
|
87
|
+
const cp = ch.codePointAt(0);
|
|
88
|
+
const cw = cp !== undefined ? codePointWidth(cp) : 0;
|
|
89
|
+
if (w + cw > target)
|
|
90
|
+
break;
|
|
91
|
+
out += ch;
|
|
92
|
+
w += cw;
|
|
93
|
+
}
|
|
94
|
+
return target > 0 ? out + ellipsis : ellipsis.slice(0, maxWidth);
|
|
95
|
+
}
|
|
96
|
+
/** Word-wrap a single paragraph (no embedded newlines) to `maxWidth` columns. */
|
|
97
|
+
export function wrapParagraph(text, maxWidth) {
|
|
98
|
+
const width = Math.max(1, maxWidth);
|
|
99
|
+
if (text.length === 0)
|
|
100
|
+
return [''];
|
|
101
|
+
if (stringWidth(text) <= width)
|
|
102
|
+
return [text];
|
|
103
|
+
const lines = [];
|
|
104
|
+
let current = '';
|
|
105
|
+
let currentW = 0;
|
|
106
|
+
// Tokenize keeping runs of spaces separate from non-space words
|
|
107
|
+
const tokens = text.match(/(\s+|\S+)/g) ?? [text];
|
|
108
|
+
for (const token of tokens) {
|
|
109
|
+
const tokenW = stringWidth(token);
|
|
110
|
+
const isSpace = /^\s+$/.test(token);
|
|
111
|
+
if (currentW === 0 && isSpace) {
|
|
112
|
+
// Preserve leading indentation only on the first line
|
|
113
|
+
if (lines.length === 0) {
|
|
114
|
+
if (tokenW <= width) {
|
|
115
|
+
current = token;
|
|
116
|
+
currentW = tokenW;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (currentW + tokenW <= width) {
|
|
122
|
+
current += token;
|
|
123
|
+
currentW += tokenW;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (isSpace) {
|
|
127
|
+
lines.push(current.trimEnd());
|
|
128
|
+
current = '';
|
|
129
|
+
currentW = 0;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (currentW > 0) {
|
|
133
|
+
lines.push(current.trimEnd());
|
|
134
|
+
current = '';
|
|
135
|
+
currentW = 0;
|
|
136
|
+
}
|
|
137
|
+
if (tokenW <= width) {
|
|
138
|
+
current = token;
|
|
139
|
+
currentW = tokenW;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Hard-break long unbreakable word / URL / hash
|
|
143
|
+
let chunk = '';
|
|
144
|
+
let chunkW = 0;
|
|
145
|
+
for (const ch of token) {
|
|
146
|
+
const cp = ch.codePointAt(0);
|
|
147
|
+
const cw = cp !== undefined ? codePointWidth(cp) : 0;
|
|
148
|
+
if (chunkW + cw > width && chunkW > 0) {
|
|
149
|
+
lines.push(chunk);
|
|
150
|
+
chunk = ch;
|
|
151
|
+
chunkW = cw;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
chunk += ch;
|
|
155
|
+
chunkW += cw;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
current = chunk;
|
|
159
|
+
currentW = chunkW;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (current.length > 0 || lines.length === 0) {
|
|
163
|
+
lines.push(current.trimEnd());
|
|
164
|
+
}
|
|
165
|
+
return lines;
|
|
166
|
+
}
|
|
167
|
+
export function wrapText(text, maxWidth) {
|
|
168
|
+
const paragraphs = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n');
|
|
169
|
+
const out = [];
|
|
170
|
+
for (const p of paragraphs) {
|
|
171
|
+
for (const line of wrapParagraph(p, maxWidth)) {
|
|
172
|
+
out.push(line);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
export function intersectRect(a, b) {
|
|
178
|
+
const x1 = Math.max(a.x, b.x);
|
|
179
|
+
const y1 = Math.max(a.y, b.y);
|
|
180
|
+
const x2 = Math.min(a.x + a.w, b.x + b.w);
|
|
181
|
+
const y2 = Math.min(a.y + a.h, b.y + b.h);
|
|
182
|
+
return { x: x1, y: y1, w: Math.max(0, x2 - x1), h: Math.max(0, y2 - y1) };
|
|
183
|
+
}
|
|
184
|
+
export function pointInRect(px, py, rect) {
|
|
185
|
+
return px >= rect.x && px < rect.x + rect.w && py >= rect.y && py < rect.y + rect.h;
|
|
186
|
+
}
|
|
187
|
+
export class ScreenBuffer {
|
|
188
|
+
width;
|
|
189
|
+
height;
|
|
190
|
+
cells;
|
|
191
|
+
cursor = { x: 0, y: 0, visible: false };
|
|
192
|
+
clipStack;
|
|
193
|
+
constructor(width, height, defaultBg = null, defaultFg = null) {
|
|
194
|
+
this.width = Math.max(1, Math.trunc(width));
|
|
195
|
+
this.height = Math.max(1, Math.trunc(height));
|
|
196
|
+
this.clipStack = [{ x: 0, y: 0, w: this.width, h: this.height }];
|
|
197
|
+
const total = this.width * this.height;
|
|
198
|
+
this.cells = new Array(total);
|
|
199
|
+
for (let i = 0; i < total; i++) {
|
|
200
|
+
this.cells[i] = { ch: ' ', fg: defaultFg, bg: defaultBg, flags: 0, wide: false };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
get clip() {
|
|
204
|
+
return this.clipStack[this.clipStack.length - 1];
|
|
205
|
+
}
|
|
206
|
+
pushClip(rect) {
|
|
207
|
+
this.clipStack.push(intersectRect(this.clip, rect));
|
|
208
|
+
}
|
|
209
|
+
popClip() {
|
|
210
|
+
if (this.clipStack.length > 1)
|
|
211
|
+
this.clipStack.pop();
|
|
212
|
+
}
|
|
213
|
+
clear(bg = null, fg = null) {
|
|
214
|
+
for (let i = 0; i < this.cells.length; i++) {
|
|
215
|
+
const c = this.cells[i];
|
|
216
|
+
c.ch = ' ';
|
|
217
|
+
c.fg = fg;
|
|
218
|
+
c.bg = bg;
|
|
219
|
+
c.flags = 0;
|
|
220
|
+
c.wide = false;
|
|
221
|
+
}
|
|
222
|
+
this.cursor = { x: 0, y: 0, visible: false };
|
|
223
|
+
}
|
|
224
|
+
setCell(x, y, ch, style) {
|
|
225
|
+
const clip = this.clip;
|
|
226
|
+
if (x < clip.x || x >= clip.x + clip.w || y < clip.y || y >= clip.y + clip.h)
|
|
227
|
+
return;
|
|
228
|
+
if (x < 0 || x >= this.width || y < 0 || y >= this.height)
|
|
229
|
+
return;
|
|
230
|
+
const idx = y * this.width + x;
|
|
231
|
+
const cell = this.cells[idx];
|
|
232
|
+
// If overwriting the second half of a wide char, blank the first half too
|
|
233
|
+
if (cell.wide && x > 0) {
|
|
234
|
+
const prev = this.cells[idx - 1];
|
|
235
|
+
prev.ch = ' ';
|
|
236
|
+
prev.wide = false;
|
|
237
|
+
}
|
|
238
|
+
const cp = ch.codePointAt(0);
|
|
239
|
+
const w = cp !== undefined ? codePointWidth(cp) : 1;
|
|
240
|
+
cell.ch = ch;
|
|
241
|
+
cell.wide = false;
|
|
242
|
+
if (style?.fg !== undefined)
|
|
243
|
+
cell.fg = style.fg;
|
|
244
|
+
if (style?.bg !== undefined)
|
|
245
|
+
cell.bg = style.bg;
|
|
246
|
+
cell.flags = styleFlags(style);
|
|
247
|
+
if (w === 2 && x + 1 < this.width && x + 1 < clip.x + clip.w) {
|
|
248
|
+
const next = this.cells[idx + 1];
|
|
249
|
+
next.ch = '';
|
|
250
|
+
next.fg = cell.fg;
|
|
251
|
+
next.bg = cell.bg;
|
|
252
|
+
next.flags = cell.flags;
|
|
253
|
+
next.wide = true;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
fill(rect, style, ch = ' ') {
|
|
257
|
+
const r = intersectRect(this.clip, rect);
|
|
258
|
+
if (r.w <= 0 || r.h <= 0)
|
|
259
|
+
return;
|
|
260
|
+
const flags = styleFlags(style);
|
|
261
|
+
for (let row = r.y; row < r.y + r.h; row++) {
|
|
262
|
+
const base = row * this.width;
|
|
263
|
+
for (let col = r.x; col < r.x + r.w; col++) {
|
|
264
|
+
const cell = this.cells[base + col];
|
|
265
|
+
cell.ch = ch;
|
|
266
|
+
if (style?.fg !== undefined)
|
|
267
|
+
cell.fg = style.fg;
|
|
268
|
+
if (style?.bg !== undefined)
|
|
269
|
+
cell.bg = style.bg;
|
|
270
|
+
cell.flags = flags;
|
|
271
|
+
cell.wide = false;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/** Draw single-line text clipped cleanly to `maxWidth` and active clip rect. Returns columns written. */
|
|
276
|
+
drawText(x, y, text, style, maxWidth) {
|
|
277
|
+
const clip = this.clip;
|
|
278
|
+
if (y < clip.y || y >= clip.y + clip.h)
|
|
279
|
+
return 0;
|
|
280
|
+
const limitX = maxWidth !== undefined ? Math.min(x + maxWidth, clip.x + clip.w) : clip.x + clip.w;
|
|
281
|
+
let cx = x;
|
|
282
|
+
for (const ch of text) {
|
|
283
|
+
if (ch === '\n' || ch === '\r')
|
|
284
|
+
break;
|
|
285
|
+
const cp = ch.codePointAt(0);
|
|
286
|
+
if (cp === undefined)
|
|
287
|
+
continue;
|
|
288
|
+
const cw = codePointWidth(cp);
|
|
289
|
+
if (cw === 0)
|
|
290
|
+
continue;
|
|
291
|
+
if (cx + cw > limitX)
|
|
292
|
+
break;
|
|
293
|
+
if (cx >= clip.x) {
|
|
294
|
+
this.setCell(cx, y, ch, style);
|
|
295
|
+
}
|
|
296
|
+
cx += cw;
|
|
297
|
+
}
|
|
298
|
+
return cx - x;
|
|
299
|
+
}
|
|
300
|
+
/** Draw truncated text with trailing ellipsis if it exceeds `maxWidth`. */
|
|
301
|
+
drawTruncated(x, y, text, maxWidth, style) {
|
|
302
|
+
if (maxWidth <= 0)
|
|
303
|
+
return 0;
|
|
304
|
+
return this.drawText(x, y, truncateWidth(text, maxWidth), style, maxWidth);
|
|
305
|
+
}
|
|
306
|
+
/** Draw consecutive styled spans on one line, respecting `maxWidth`. */
|
|
307
|
+
drawSegments(x, y, segments, maxWidth) {
|
|
308
|
+
let cx = x;
|
|
309
|
+
const maxEnd = maxWidth !== undefined ? x + maxWidth : this.clip.x + this.clip.w;
|
|
310
|
+
for (const seg of segments) {
|
|
311
|
+
if (cx >= maxEnd)
|
|
312
|
+
break;
|
|
313
|
+
const remaining = maxEnd - cx;
|
|
314
|
+
const drawn = this.drawText(cx, y, seg.text, seg.style, remaining);
|
|
315
|
+
cx += drawn;
|
|
316
|
+
}
|
|
317
|
+
return cx - x;
|
|
318
|
+
}
|
|
319
|
+
drawHLine(x, y, length, style, ch = '─') {
|
|
320
|
+
const clip = this.clip;
|
|
321
|
+
if (y < clip.y || y >= clip.y + clip.h)
|
|
322
|
+
return;
|
|
323
|
+
const start = Math.max(x, clip.x);
|
|
324
|
+
const end = Math.min(x + length, clip.x + clip.w);
|
|
325
|
+
for (let cx = start; cx < end; cx++) {
|
|
326
|
+
this.setCell(cx, y, ch, style);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
drawVLine(x, y, length, style, ch = '│') {
|
|
330
|
+
const clip = this.clip;
|
|
331
|
+
if (x < clip.x || x >= clip.x + clip.w)
|
|
332
|
+
return;
|
|
333
|
+
const start = Math.max(y, clip.y);
|
|
334
|
+
const end = Math.min(y + length, clip.y + clip.h);
|
|
335
|
+
for (let cy = start; cy < end; cy++) {
|
|
336
|
+
this.setCell(x, cy, ch, style);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
drawBox(rect, borderStyle, options) {
|
|
340
|
+
if (rect.w < 2 || rect.h < 2)
|
|
341
|
+
return;
|
|
342
|
+
if (options?.fillStyle) {
|
|
343
|
+
this.fill(rect, options.fillStyle);
|
|
344
|
+
}
|
|
345
|
+
const tl = options?.rounded === false ? '┌' : '╭';
|
|
346
|
+
const tr = options?.rounded === false ? '┐' : '╮';
|
|
347
|
+
const bl = options?.rounded === false ? '└' : '╰';
|
|
348
|
+
const br = options?.rounded === false ? '┘' : '╯';
|
|
349
|
+
this.setCell(rect.x, rect.y, tl, borderStyle);
|
|
350
|
+
this.setCell(rect.x + rect.w - 1, rect.y, tr, borderStyle);
|
|
351
|
+
this.setCell(rect.x, rect.y + rect.h - 1, bl, borderStyle);
|
|
352
|
+
this.setCell(rect.x + rect.w - 1, rect.y + rect.h - 1, br, borderStyle);
|
|
353
|
+
this.drawHLine(rect.x + 1, rect.y, rect.w - 2, borderStyle, '─');
|
|
354
|
+
this.drawHLine(rect.x + 1, rect.y + rect.h - 1, rect.w - 2, borderStyle, '─');
|
|
355
|
+
this.drawVLine(rect.x, rect.y + 1, rect.h - 2, borderStyle, '│');
|
|
356
|
+
this.drawVLine(rect.x + rect.w - 1, rect.y + 1, rect.h - 2, borderStyle, '│');
|
|
357
|
+
let titleMaxW = rect.w - 4;
|
|
358
|
+
if (options?.rightLabel && rect.w > 12) {
|
|
359
|
+
const rLabel = ` ${options.rightLabel} `;
|
|
360
|
+
const rW = stringWidth(rLabel);
|
|
361
|
+
const minTitleRoom = options?.title ? Math.min(18, stringWidth(options.title) + 2) : 0;
|
|
362
|
+
if (rW + minTitleRoom + 4 <= rect.w) {
|
|
363
|
+
this.drawText(rect.x + rect.w - 2 - rW, rect.y, rLabel, options.rightStyle ?? borderStyle, rW);
|
|
364
|
+
titleMaxW = Math.max(0, rect.w - 5 - rW);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (options?.title && titleMaxW > 2) {
|
|
368
|
+
const label = ` ${truncateWidth(options.title, Math.max(1, titleMaxW - 2))} `;
|
|
369
|
+
this.drawText(rect.x + 2, rect.y, label, options.titleStyle ?? borderStyle, titleMaxW);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/** Draw a compact pill/badge with single-space horizontal padding. Returns width drawn. */
|
|
373
|
+
drawBadge(x, y, label, style, maxWidth) {
|
|
374
|
+
const padded = ` ${label} `;
|
|
375
|
+
const w = maxWidth !== undefined ? Math.min(stringWidth(padded), maxWidth) : stringWidth(padded);
|
|
376
|
+
if (w <= 0)
|
|
377
|
+
return 0;
|
|
378
|
+
return this.drawTruncated(x, y, padded, w, style);
|
|
379
|
+
}
|
|
380
|
+
/** Draw a subtle 1-column scrollbar on the right edge of `rect`. */
|
|
381
|
+
drawScrollbar(rect, totalItems, viewportHeight, scrollOffset, trackStyle, thumbStyle) {
|
|
382
|
+
if (rect.h <= 0 || totalItems <= viewportHeight || viewportHeight <= 0)
|
|
383
|
+
return;
|
|
384
|
+
const x = rect.x + rect.w - 1;
|
|
385
|
+
const thumbSize = Math.max(1, Math.round((viewportHeight / totalItems) * rect.h));
|
|
386
|
+
const maxScroll = Math.max(1, totalItems - viewportHeight);
|
|
387
|
+
const ratio = Math.max(0, Math.min(1, scrollOffset / maxScroll));
|
|
388
|
+
const thumbStart = Math.round(ratio * (rect.h - thumbSize));
|
|
389
|
+
for (let i = 0; i < rect.h; i++) {
|
|
390
|
+
const inThumb = i >= thumbStart && i < thumbStart + thumbSize;
|
|
391
|
+
this.setCell(x, rect.y + i, inThumb ? '┃' : '│', inThumb ? thumbStyle : trackStyle);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/** Draw a horizontal progress / usage meter. */
|
|
395
|
+
drawProgressBar(x, y, width, ratio, fillStyle, trackStyle) {
|
|
396
|
+
if (width <= 0)
|
|
397
|
+
return;
|
|
398
|
+
const clamped = Math.max(0, Math.min(1, Number.isFinite(ratio) ? ratio : 0));
|
|
399
|
+
const filled = Math.round(clamped * width);
|
|
400
|
+
for (let i = 0; i < width; i++) {
|
|
401
|
+
this.setCell(x + i, y, i < filled ? '█' : '░', i < filled ? fillStyle : trackStyle);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/** Draw a single-line Unicode sparkline (`▁▂▃▄▅▆▇█`). */
|
|
405
|
+
drawSparkline(x, y, values, style) {
|
|
406
|
+
const glyphs = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
|
|
407
|
+
const max = Math.max(0, ...values);
|
|
408
|
+
for (let i = 0; i < values.length; i++) {
|
|
409
|
+
const v = values[i] ?? 0;
|
|
410
|
+
const idx = max <= 0 || v <= 0 ? 0 : Math.min(glyphs.length - 1, Math.floor((v / max) * (glyphs.length - 1)));
|
|
411
|
+
this.setCell(x + i, y, glyphs[idx], style);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/** Plain text representation of the grid for snapshot assertions and debugging. */
|
|
415
|
+
toPlainText() {
|
|
416
|
+
const rows = [];
|
|
417
|
+
for (let y = 0; y < this.height; y++) {
|
|
418
|
+
let line = '';
|
|
419
|
+
const base = y * this.width;
|
|
420
|
+
for (let x = 0; x < this.width; x++) {
|
|
421
|
+
const c = this.cells[base + x];
|
|
422
|
+
if (!c.wide)
|
|
423
|
+
line += c.ch;
|
|
424
|
+
}
|
|
425
|
+
rows.push(line.replace(/\s+$/, ''));
|
|
426
|
+
}
|
|
427
|
+
return rows.join('\n');
|
|
428
|
+
}
|
|
429
|
+
getRowText(y) {
|
|
430
|
+
if (y < 0 || y >= this.height)
|
|
431
|
+
return '';
|
|
432
|
+
let line = '';
|
|
433
|
+
const base = y * this.width;
|
|
434
|
+
for (let x = 0; x < this.width; x++) {
|
|
435
|
+
const c = this.cells[base + x];
|
|
436
|
+
if (!c.wide)
|
|
437
|
+
line += c.ch;
|
|
438
|
+
}
|
|
439
|
+
return line;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function sameCell(a, b) {
|
|
443
|
+
return (a.ch === b.ch &&
|
|
444
|
+
a.flags === b.flags &&
|
|
445
|
+
a.wide === b.wide &&
|
|
446
|
+
sameColor(a.fg, b.fg) &&
|
|
447
|
+
sameColor(a.bg, b.bg));
|
|
448
|
+
}
|
|
449
|
+
function buildSgr(cell, depth) {
|
|
450
|
+
const parts = ['0'];
|
|
451
|
+
if (cell.flags & FLAG_BOLD)
|
|
452
|
+
parts.push('1');
|
|
453
|
+
if (cell.flags & FLAG_DIM)
|
|
454
|
+
parts.push('2');
|
|
455
|
+
if (cell.flags & FLAG_ITALIC)
|
|
456
|
+
parts.push('3');
|
|
457
|
+
if (cell.flags & FLAG_UNDERLINE)
|
|
458
|
+
parts.push('4');
|
|
459
|
+
if (cell.flags & FLAG_INVERSE)
|
|
460
|
+
parts.push('7');
|
|
461
|
+
if (cell.flags & FLAG_STRIKE)
|
|
462
|
+
parts.push('9');
|
|
463
|
+
if (depth !== 'none') {
|
|
464
|
+
if (cell.fg !== null)
|
|
465
|
+
parts.push(sgrFg(cell.fg, depth));
|
|
466
|
+
if (cell.bg !== null)
|
|
467
|
+
parts.push(sgrBg(cell.bg, depth));
|
|
468
|
+
}
|
|
469
|
+
return `\x1b[${parts.join(';')}m`;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Emit minimal synchronized ANSI escape sequences to transform `prev` into `next`.
|
|
473
|
+
* Passing `prev = null` performs a clean full repaint.
|
|
474
|
+
*/
|
|
475
|
+
export function diffToAnsi(prev, next, depth) {
|
|
476
|
+
const full = prev === null || prev.width !== next.width || prev.height !== next.height;
|
|
477
|
+
const out = ['\x1b[?2026h', '\x1b[?25l'];
|
|
478
|
+
let curX = -1;
|
|
479
|
+
let curY = -1;
|
|
480
|
+
let lastSgr = '';
|
|
481
|
+
for (let y = 0; y < next.height; y++) {
|
|
482
|
+
const base = y * next.width;
|
|
483
|
+
for (let x = 0; x < next.width; x++) {
|
|
484
|
+
const cell = next.cells[base + x];
|
|
485
|
+
if (cell.wide)
|
|
486
|
+
continue;
|
|
487
|
+
if (!full && sameCell(prev.cells[base + x], cell))
|
|
488
|
+
continue;
|
|
489
|
+
if (curY !== y || curX !== x) {
|
|
490
|
+
out.push(`\x1b[${y + 1};${x + 1}H`);
|
|
491
|
+
curY = y;
|
|
492
|
+
curX = x;
|
|
493
|
+
}
|
|
494
|
+
const sgr = buildSgr(cell, depth);
|
|
495
|
+
if (sgr !== lastSgr) {
|
|
496
|
+
out.push(sgr);
|
|
497
|
+
lastSgr = sgr;
|
|
498
|
+
}
|
|
499
|
+
out.push(cell.ch);
|
|
500
|
+
const cp = cell.ch.codePointAt(0);
|
|
501
|
+
curX += cp !== undefined ? Math.max(1, codePointWidth(cp)) : 1;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
out.push('\x1b[0m');
|
|
505
|
+
if (next.cursor.visible) {
|
|
506
|
+
const cx = Math.max(0, Math.min(next.width - 1, next.cursor.x));
|
|
507
|
+
const cy = Math.max(0, Math.min(next.height - 1, next.cursor.y));
|
|
508
|
+
out.push(`\x1b[${cy + 1};${cx + 1}H\x1b[?25h`);
|
|
509
|
+
}
|
|
510
|
+
out.push('\x1b[?2026l');
|
|
511
|
+
return out.join('');
|
|
512
|
+
}
|
|
513
|
+
//# s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