take4-console 0.15.0
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 +287 -0
- package/LICENSE +21 -0
- package/README.md +986 -0
- package/dist/Screen/InterfaceBuilder.d.mts +43 -0
- package/dist/Screen/InterfaceBuilder.d.mts.map +1 -0
- package/dist/Screen/InterfaceBuilder.mjs +355 -0
- package/dist/Screen/InterfaceBuilder.mjs.map +1 -0
- package/dist/Screen/Pos.d.mts +52 -0
- package/dist/Screen/Pos.d.mts.map +1 -0
- package/dist/Screen/Pos.mjs +105 -0
- package/dist/Screen/Pos.mjs.map +1 -0
- package/dist/Screen/Region.d.mts +31 -0
- package/dist/Screen/Region.d.mts.map +1 -0
- package/dist/Screen/Region.mjs +73 -0
- package/dist/Screen/Region.mjs.map +1 -0
- package/dist/Screen/RegistryHolder.d.mts +6 -0
- package/dist/Screen/RegistryHolder.d.mts.map +1 -0
- package/dist/Screen/RegistryHolder.mjs +14 -0
- package/dist/Screen/RegistryHolder.mjs.map +1 -0
- package/dist/Screen/Screen.d.mts +25 -0
- package/dist/Screen/Screen.d.mts.map +1 -0
- package/dist/Screen/Screen.mjs +100 -0
- package/dist/Screen/Screen.mjs.map +1 -0
- package/dist/Screen/Size.d.mts +23 -0
- package/dist/Screen/Size.d.mts.map +1 -0
- package/dist/Screen/Size.mjs +48 -0
- package/dist/Screen/Size.mjs.map +1 -0
- package/dist/Screen/StyleRegistry.d.mts +32 -0
- package/dist/Screen/StyleRegistry.d.mts.map +1 -0
- package/dist/Screen/StyleRegistry.mjs +80 -0
- package/dist/Screen/StyleRegistry.mjs.map +1 -0
- package/dist/Screen/Window.d.mts +121 -0
- package/dist/Screen/Window.d.mts.map +1 -0
- package/dist/Screen/Window.mjs +407 -0
- package/dist/Screen/Window.mjs.map +1 -0
- package/dist/Screen/WindowManager.d.mts +86 -0
- package/dist/Screen/WindowManager.d.mts.map +1 -0
- package/dist/Screen/WindowManager.mjs +399 -0
- package/dist/Screen/WindowManager.mjs.map +1 -0
- package/dist/Screen/controls/BarChart.d.mts +29 -0
- package/dist/Screen/controls/BarChart.d.mts.map +1 -0
- package/dist/Screen/controls/BarChart.mjs +90 -0
- package/dist/Screen/controls/BarChart.mjs.map +1 -0
- package/dist/Screen/controls/Button.d.mts +16 -0
- package/dist/Screen/controls/Button.d.mts.map +1 -0
- package/dist/Screen/controls/Button.mjs +34 -0
- package/dist/Screen/controls/Button.mjs.map +1 -0
- package/dist/Screen/controls/Checkbox.d.mts +23 -0
- package/dist/Screen/controls/Checkbox.d.mts.map +1 -0
- package/dist/Screen/controls/Checkbox.mjs +55 -0
- package/dist/Screen/controls/Checkbox.mjs.map +1 -0
- package/dist/Screen/controls/LineChart.d.mts +29 -0
- package/dist/Screen/controls/LineChart.d.mts.map +1 -0
- package/dist/Screen/controls/LineChart.mjs +172 -0
- package/dist/Screen/controls/LineChart.mjs.map +1 -0
- package/dist/Screen/controls/ListBox.d.mts +34 -0
- package/dist/Screen/controls/ListBox.d.mts.map +1 -0
- package/dist/Screen/controls/ListBox.mjs +138 -0
- package/dist/Screen/controls/ListBox.mjs.map +1 -0
- package/dist/Screen/controls/ProgressBar.d.mts +26 -0
- package/dist/Screen/controls/ProgressBar.d.mts.map +1 -0
- package/dist/Screen/controls/ProgressBar.mjs +70 -0
- package/dist/Screen/controls/ProgressBar.mjs.map +1 -0
- package/dist/Screen/controls/ProgressBarV.d.mts +22 -0
- package/dist/Screen/controls/ProgressBarV.d.mts.map +1 -0
- package/dist/Screen/controls/ProgressBarV.mjs +61 -0
- package/dist/Screen/controls/ProgressBarV.mjs.map +1 -0
- package/dist/Screen/controls/Radio.d.mts +23 -0
- package/dist/Screen/controls/Radio.d.mts.map +1 -0
- package/dist/Screen/controls/Radio.mjs +55 -0
- package/dist/Screen/controls/Radio.mjs.map +1 -0
- package/dist/Screen/controls/Sparkline.d.mts +29 -0
- package/dist/Screen/controls/Sparkline.d.mts.map +1 -0
- package/dist/Screen/controls/Sparkline.mjs +82 -0
- package/dist/Screen/controls/Sparkline.mjs.map +1 -0
- package/dist/Screen/controls/Spinner.d.mts +37 -0
- package/dist/Screen/controls/Spinner.d.mts.map +1 -0
- package/dist/Screen/controls/Spinner.mjs +87 -0
- package/dist/Screen/controls/Spinner.mjs.map +1 -0
- package/dist/Screen/controls/StatusLED.d.mts +22 -0
- package/dist/Screen/controls/StatusLED.d.mts.map +1 -0
- package/dist/Screen/controls/StatusLED.mjs +51 -0
- package/dist/Screen/controls/StatusLED.mjs.map +1 -0
- package/dist/Screen/controls/Tabs.d.mts +42 -0
- package/dist/Screen/controls/Tabs.d.mts.map +1 -0
- package/dist/Screen/controls/Tabs.mjs +126 -0
- package/dist/Screen/controls/Tabs.mjs.map +1 -0
- package/dist/Screen/controls/TextArea.d.mts +41 -0
- package/dist/Screen/controls/TextArea.d.mts.map +1 -0
- package/dist/Screen/controls/TextArea.mjs +197 -0
- package/dist/Screen/controls/TextArea.mjs.map +1 -0
- package/dist/Screen/controls/TextBox.d.mts +35 -0
- package/dist/Screen/controls/TextBox.d.mts.map +1 -0
- package/dist/Screen/controls/TextBox.mjs +135 -0
- package/dist/Screen/controls/TextBox.mjs.map +1 -0
- package/dist/Screen/types.d.mts +399 -0
- package/dist/Screen/types.d.mts.map +1 -0
- package/dist/Screen/types.mjs +22 -0
- package/dist/Screen/types.mjs.map +1 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +41 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -0
- package/src/Screen/InterfaceBuilder.mts +403 -0
- package/src/Screen/Pos.mts +119 -0
- package/src/Screen/Region.mts +88 -0
- package/src/Screen/RegistryHolder.mts +16 -0
- package/src/Screen/Screen.mts +103 -0
- package/src/Screen/Size.mts +55 -0
- package/src/Screen/StyleRegistry.mts +95 -0
- package/src/Screen/Window.mts +439 -0
- package/src/Screen/WindowManager.mts +472 -0
- package/src/Screen/controls/BarChart.mts +109 -0
- package/src/Screen/controls/Button.mts +40 -0
- package/src/Screen/controls/Checkbox.mts +66 -0
- package/src/Screen/controls/LineChart.mts +202 -0
- package/src/Screen/controls/ListBox.mts +154 -0
- package/src/Screen/controls/ProgressBar.mts +88 -0
- package/src/Screen/controls/ProgressBarV.mts +77 -0
- package/src/Screen/controls/Radio.mts +66 -0
- package/src/Screen/controls/Sparkline.mts +101 -0
- package/src/Screen/controls/Spinner.mts +102 -0
- package/src/Screen/controls/StatusLED.mts +65 -0
- package/src/Screen/controls/Tabs.mts +140 -0
- package/src/Screen/controls/TextArea.mts +194 -0
- package/src/Screen/controls/TextBox.mts +139 -0
- package/src/Screen/types.mts +416 -0
- package/src/demo.mts +171 -0
- package/src/index.mts +105 -0
- package/src/layout.yaml +236 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { BUILTIN_TEXT, BUILTIN_TEXT_FOCUSED, BUILTIN_TEXT_DISABLED, BUILTIN_BORDER, BUILTIN_BORDER_FOCUSED, BUILTIN_BORDER_DISABLED } from './types.mjs';
|
|
2
|
+
import { Region } from './Region.mjs';
|
|
3
|
+
import { getRegistry } from './RegistryHolder.mjs';
|
|
4
|
+
import { Size } from './Size.mjs';
|
|
5
|
+
/** Characters used for each border style. */
|
|
6
|
+
const BORDER_CHARS = {
|
|
7
|
+
single: { h: '─', v: '│', tl: '┌', tr: '┐', bl: '└', br: '┘' },
|
|
8
|
+
double: { h: '═', v: '║', tl: '╔', tr: '╗', bl: '╚', br: '╝' },
|
|
9
|
+
rounded: { h: '─', v: '│', tl: '╭', tr: '╮', bl: '╰', br: '╯' },
|
|
10
|
+
};
|
|
11
|
+
/** Resolves a border option (true / object / false) to a full WindowBorder or false. */
|
|
12
|
+
const resolveBorder = (border) => {
|
|
13
|
+
if (!border)
|
|
14
|
+
return false;
|
|
15
|
+
if (border === true)
|
|
16
|
+
return { top: true, right: true, bottom: true, left: true };
|
|
17
|
+
return border;
|
|
18
|
+
};
|
|
19
|
+
export class Window {
|
|
20
|
+
x;
|
|
21
|
+
y;
|
|
22
|
+
/** Composited display buffer – rebuilt by render(); read by blitChild and Screen. */
|
|
23
|
+
region;
|
|
24
|
+
/** Global style registry shared by all windows and controls. */
|
|
25
|
+
registry;
|
|
26
|
+
children;
|
|
27
|
+
/** Whether this window currently has keyboard focus. */
|
|
28
|
+
focused = false;
|
|
29
|
+
/** Whether this window is disabled (inactive and visually dimmed). */
|
|
30
|
+
disabled = false;
|
|
31
|
+
/** Optional text label displayed by the control. */
|
|
32
|
+
label = '';
|
|
33
|
+
/** Style ID used for normal (default) text rendering. Initialized from BUILTIN_TEXT. */
|
|
34
|
+
normalStyleId;
|
|
35
|
+
/** Style ID used when the control is focused. Initialized from BUILTIN_TEXT_FOCUSED. */
|
|
36
|
+
focusedStyleId;
|
|
37
|
+
/** Style ID used when the control is disabled. Initialized from BUILTIN_TEXT_DISABLED. */
|
|
38
|
+
disabledStyleId;
|
|
39
|
+
/** User-written content – survives render() cycles. */
|
|
40
|
+
content;
|
|
41
|
+
background;
|
|
42
|
+
border;
|
|
43
|
+
/** True when the original border config included an explicit color; prevents auto-sync. */
|
|
44
|
+
borderColorExplicit = false;
|
|
45
|
+
active;
|
|
46
|
+
posSpec;
|
|
47
|
+
sizeSpec;
|
|
48
|
+
/** Creates a window from the given properties.
|
|
49
|
+
* For percentage-based sizes, call addChild() before writing content to the window.
|
|
50
|
+
* Uses the global StyleRegistry set by the Screen constructor. */
|
|
51
|
+
constructor(wp) {
|
|
52
|
+
const pos = wp.pos;
|
|
53
|
+
const size = wp.size ?? new Size(1, 1);
|
|
54
|
+
this.posSpec = pos;
|
|
55
|
+
this.sizeSpec = size;
|
|
56
|
+
this.registry = getRegistry();
|
|
57
|
+
this.normalStyleId = this.registry.getNamed(BUILTIN_TEXT);
|
|
58
|
+
this.focusedStyleId = this.registry.getNamed(BUILTIN_TEXT_FOCUSED);
|
|
59
|
+
this.disabledStyleId = this.registry.getNamed(BUILTIN_TEXT_DISABLED);
|
|
60
|
+
this.children = [];
|
|
61
|
+
this.focused = wp.focused ?? false;
|
|
62
|
+
this.disabled = wp.disabled ?? false;
|
|
63
|
+
this.active = wp.active ?? !this.disabled;
|
|
64
|
+
this.label = wp.label ?? '';
|
|
65
|
+
this.background = wp.background ?? 0;
|
|
66
|
+
this.border = resolveBorder(wp.border ?? wp.defaultBorder);
|
|
67
|
+
this.borderColorExplicit = this.border !== false && this.border.color !== undefined;
|
|
68
|
+
const { w, h } = size.isAbsolute() ? size.resolve(0, 0) : { w: 1, h: 1 };
|
|
69
|
+
this.region = new Region(w, h);
|
|
70
|
+
this.content = new Region(w, h);
|
|
71
|
+
if (pos.isAbsolute()) {
|
|
72
|
+
const abs = pos.resolveAbsolute();
|
|
73
|
+
this.x = abs.x;
|
|
74
|
+
this.y = abs.y;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.x = 0;
|
|
78
|
+
this.y = 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Returns the window dimensions (columns × rows). */
|
|
82
|
+
getSize() {
|
|
83
|
+
return this.region.getSize();
|
|
84
|
+
}
|
|
85
|
+
/** Returns the number of cells consumed by decorations on each edge. */
|
|
86
|
+
borderInset() {
|
|
87
|
+
const b = this.border;
|
|
88
|
+
if (!b)
|
|
89
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
90
|
+
return {
|
|
91
|
+
top: (b.top ?? false) ? 1 : 0,
|
|
92
|
+
right: (b.right ?? false) ? 1 : 0,
|
|
93
|
+
bottom: (b.bottom ?? false) ? 1 : 0,
|
|
94
|
+
left: (b.left ?? false) ? 1 : 0,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Returns the top-left offset of the content area, accounting for decorations such as borders. */
|
|
98
|
+
getInnerOffset() {
|
|
99
|
+
const { left, top } = this.borderInset();
|
|
100
|
+
return { x: left, y: top };
|
|
101
|
+
}
|
|
102
|
+
/** Returns the dimensions of the content area, accounting for decorations such as borders. */
|
|
103
|
+
getInnerSize() {
|
|
104
|
+
const { width, height } = this.getSize();
|
|
105
|
+
const { top, right, bottom, left } = this.borderInset();
|
|
106
|
+
return {
|
|
107
|
+
width: Math.max(0, width - left - right),
|
|
108
|
+
height: Math.max(0, height - top - bottom),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** Sets the active state. Affects border and background appearance on next render(). */
|
|
112
|
+
setActive(active) {
|
|
113
|
+
this.active = active;
|
|
114
|
+
}
|
|
115
|
+
/** Sets the focused state. Controls use this to change visual appearance on focus. */
|
|
116
|
+
setFocused(focused) {
|
|
117
|
+
this.focused = focused;
|
|
118
|
+
}
|
|
119
|
+
/** Returns whether this window currently has keyboard focus. */
|
|
120
|
+
isFocused() {
|
|
121
|
+
return this.focused;
|
|
122
|
+
}
|
|
123
|
+
/** Sets the disabled state and deactivates the window when disabled. */
|
|
124
|
+
setDisabled(disabled) {
|
|
125
|
+
this.disabled = disabled;
|
|
126
|
+
this.setActive(!disabled);
|
|
127
|
+
}
|
|
128
|
+
/** Returns whether this window is currently disabled. */
|
|
129
|
+
isDisabled() {
|
|
130
|
+
return this.disabled;
|
|
131
|
+
}
|
|
132
|
+
/** Sets the label text displayed by the control. */
|
|
133
|
+
setLabel(label) {
|
|
134
|
+
this.label = label;
|
|
135
|
+
}
|
|
136
|
+
/** Returns the current label text. */
|
|
137
|
+
getLabel() {
|
|
138
|
+
return this.label;
|
|
139
|
+
}
|
|
140
|
+
/** Updates the border configuration. Effective on the next render() call.
|
|
141
|
+
* Intended for use by subclasses that need dynamic decoration (e.g. focus-state colour). */
|
|
142
|
+
updateBorder(border) {
|
|
143
|
+
this.border = resolveBorder(border);
|
|
144
|
+
}
|
|
145
|
+
/** Recomputes the border color from the current focused/disabled state.
|
|
146
|
+
* Called automatically at the start of render() so subclasses never need to do it manually.
|
|
147
|
+
* Only updates the color when no explicit color was provided in the original border config. */
|
|
148
|
+
syncBorderColor() {
|
|
149
|
+
if (!this.border || this.borderColorExplicit)
|
|
150
|
+
return;
|
|
151
|
+
this.border.color = this.disabled
|
|
152
|
+
? this.registry.getNamedForeground(BUILTIN_BORDER_DISABLED, 238)
|
|
153
|
+
: this.focused
|
|
154
|
+
? this.registry.getNamedForeground(BUILTIN_BORDER_FOCUSED, 75)
|
|
155
|
+
: this.registry.getNamedForeground(BUILTIN_BORDER, 240);
|
|
156
|
+
}
|
|
157
|
+
/** Adds a child window. If the child uses percentage-based sizes they are resolved immediately
|
|
158
|
+
* against this window's inner dimensions (excluding decorations such as borders).
|
|
159
|
+
* Position is resolved relative to the inner area and stored on child.x/y. */
|
|
160
|
+
addChild(child) {
|
|
161
|
+
const { width: pw, height: ph } = this.getInnerSize();
|
|
162
|
+
const { x: ox, y: oy } = this.getInnerOffset();
|
|
163
|
+
if (!child.sizeSpec.isAbsolute()) {
|
|
164
|
+
const { w, h } = child.sizeSpec.resolve(pw, ph);
|
|
165
|
+
child.resizeRegions(w, h);
|
|
166
|
+
}
|
|
167
|
+
const { width: cw, height: ch } = child.getSize();
|
|
168
|
+
const { x, y } = child.posSpec.resolve(pw, ph, cw, ch);
|
|
169
|
+
child.x = x + ox;
|
|
170
|
+
child.y = y + oy;
|
|
171
|
+
this.children.push(child);
|
|
172
|
+
}
|
|
173
|
+
/** Returns a resolved Cell (char + CellAttributes) at (x, y) from the display buffer.
|
|
174
|
+
* Throws RangeError if out of bounds. */
|
|
175
|
+
getCell(x, y) {
|
|
176
|
+
const char = this.region.getChars()[this.flatIndex(x, y)];
|
|
177
|
+
const styleId = this.region.getStyleId(x, y);
|
|
178
|
+
const attributes = { ...this.registry.get(styleId) };
|
|
179
|
+
return { char, attributes };
|
|
180
|
+
}
|
|
181
|
+
/** Sets only the character at (x, y) without modifying the style ID. Throws RangeError if out of bounds. */
|
|
182
|
+
setChar(x, y, char) {
|
|
183
|
+
this.content.setChar(x, y, char);
|
|
184
|
+
this.region.setChar(x, y, char);
|
|
185
|
+
}
|
|
186
|
+
/** Sets the character and style ID at (x, y). Throws RangeError if out of bounds. */
|
|
187
|
+
setCell(x, y, char, styleId = 0) {
|
|
188
|
+
this.content.setCell(x, y, char, styleId);
|
|
189
|
+
this.region.setCell(x, y, char, styleId);
|
|
190
|
+
}
|
|
191
|
+
/** Merges the given style ID onto the existing style at (x, y) without changing the character.
|
|
192
|
+
* Throws RangeError if out of bounds. */
|
|
193
|
+
mergeStyle(x, y, styleId) {
|
|
194
|
+
const mergedContent = this.registry.merge(this.content.getStyleId(x, y), styleId);
|
|
195
|
+
const mergedRegion = this.registry.merge(this.region.getStyleId(x, y), styleId);
|
|
196
|
+
this.content.setStyleId(x, y, mergedContent);
|
|
197
|
+
this.region.setStyleId(x, y, mergedRegion);
|
|
198
|
+
}
|
|
199
|
+
/** Resets every cell to a blank space with style ID 0. */
|
|
200
|
+
clear() {
|
|
201
|
+
this.content.clear();
|
|
202
|
+
this.region.clear();
|
|
203
|
+
}
|
|
204
|
+
/** Fills every cell with the given character and style ID. */
|
|
205
|
+
fill(char, styleId = 0) {
|
|
206
|
+
this.content.fill(char, styleId);
|
|
207
|
+
this.region.fill(char, styleId);
|
|
208
|
+
}
|
|
209
|
+
/** Writes text into the window's content area starting at (x, y) (default 0, 0).
|
|
210
|
+
* Coordinates are relative to the inner content area (i.e. decorations such as borders are excluded).
|
|
211
|
+
* Newline characters move to the next row, resetting x to startX.
|
|
212
|
+
* Characters outside the inner bounds are silently clipped.
|
|
213
|
+
* When no style is provided, automatically picks disabledStyleId, focusedStyleId, or normalStyleId
|
|
214
|
+
* based on the current disabled/focused state. */
|
|
215
|
+
writeText(text, options) {
|
|
216
|
+
const { x: ox, y: oy } = this.getInnerOffset();
|
|
217
|
+
const { width: iw, height: ih } = this.getInnerSize();
|
|
218
|
+
const startX = (options?.x ?? 0) + ox;
|
|
219
|
+
const startY = (options?.y ?? 0) + oy;
|
|
220
|
+
const styleId = options?.style ?? (this.disabled ? this.disabledStyleId :
|
|
221
|
+
this.focused ? this.focusedStyleId :
|
|
222
|
+
this.normalStyleId);
|
|
223
|
+
let cx = startX;
|
|
224
|
+
let cy = startY;
|
|
225
|
+
for (const ch of text) {
|
|
226
|
+
if (ch === '\n') {
|
|
227
|
+
cx = startX;
|
|
228
|
+
cy++;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (cx >= ox && cx < ox + iw && cy >= oy && cy < oy + ih) {
|
|
232
|
+
this.setCell(cx, cy, ch, styleId);
|
|
233
|
+
}
|
|
234
|
+
cx++;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Builds the display buffer: background → user content → border → children.
|
|
239
|
+
* The result is stored in region and used by blitChild / Screen.render().
|
|
240
|
+
*/
|
|
241
|
+
render() {
|
|
242
|
+
this.syncBorderColor();
|
|
243
|
+
this.paintBackground();
|
|
244
|
+
this.blitContent();
|
|
245
|
+
this.paintBorder();
|
|
246
|
+
for (const child of this.children) {
|
|
247
|
+
child.render();
|
|
248
|
+
this.blitChild(child);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** Fills the display buffer with the background style. When inactive, adds dim to every cell.
|
|
252
|
+
* No-op when background is 0 (transparent). */
|
|
253
|
+
paintBackground() {
|
|
254
|
+
if (this.background === 0)
|
|
255
|
+
return;
|
|
256
|
+
let bgId = this.background;
|
|
257
|
+
if (!this.active) {
|
|
258
|
+
bgId = this.registry.merge(bgId, this.registry.register({ dim: true }));
|
|
259
|
+
}
|
|
260
|
+
this.region.fill(' ', bgId);
|
|
261
|
+
}
|
|
262
|
+
/** Overlays user-written content onto the display buffer, merging with any background already set. */
|
|
263
|
+
blitContent() {
|
|
264
|
+
const contentChars = this.content.getChars();
|
|
265
|
+
const contentStyleIds = this.content.getStyleIds();
|
|
266
|
+
const regionStyleIds = this.region.getStyleIds();
|
|
267
|
+
const { width, height } = this.content.getSize();
|
|
268
|
+
for (let y = 0; y < height; y++) {
|
|
269
|
+
for (let x = 0; x < width; x++) {
|
|
270
|
+
const i = y * width + x;
|
|
271
|
+
const mergedId = this.registry.merge(regionStyleIds[i], contentStyleIds[i]);
|
|
272
|
+
this.region.setCell(x, y, contentChars[i], mergedId);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/** Draws border characters on the display buffer edges. When inactive, adds dim to border cells. */
|
|
277
|
+
paintBorder() {
|
|
278
|
+
if (!this.border)
|
|
279
|
+
return;
|
|
280
|
+
const b = this.border;
|
|
281
|
+
const { width, height } = this.region.getSize();
|
|
282
|
+
if (width < 2 && height < 2)
|
|
283
|
+
return;
|
|
284
|
+
const chars = BORDER_CHARS[b.style ?? 'single'];
|
|
285
|
+
const bgColor = this.background !== 0
|
|
286
|
+
? this.registry.get(this.background).background
|
|
287
|
+
: undefined;
|
|
288
|
+
const baseAttrsParts = {};
|
|
289
|
+
if (b.color !== undefined)
|
|
290
|
+
baseAttrsParts.foreground = b.color;
|
|
291
|
+
if (bgColor !== undefined)
|
|
292
|
+
baseAttrsParts.background = bgColor;
|
|
293
|
+
if (!this.active)
|
|
294
|
+
baseAttrsParts.dim = true;
|
|
295
|
+
const baseId = this.registry.register(baseAttrsParts);
|
|
296
|
+
const top = b.top ?? false;
|
|
297
|
+
const bottom = b.bottom ?? false;
|
|
298
|
+
const left = b.left ?? false;
|
|
299
|
+
const right = b.right ?? false;
|
|
300
|
+
// top row
|
|
301
|
+
if (top && height >= 1) {
|
|
302
|
+
for (let x = 0; x < width; x++) {
|
|
303
|
+
const isLeft = x === 0;
|
|
304
|
+
const isRight = x === width - 1;
|
|
305
|
+
let ch;
|
|
306
|
+
if (isLeft && left)
|
|
307
|
+
ch = chars.tl;
|
|
308
|
+
else if (isRight && right)
|
|
309
|
+
ch = chars.tr;
|
|
310
|
+
else
|
|
311
|
+
ch = chars.h;
|
|
312
|
+
this.region.setCell(x, 0, ch, baseId);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// bottom row
|
|
316
|
+
if (bottom && height >= 2) {
|
|
317
|
+
for (let x = 0; x < width; x++) {
|
|
318
|
+
const isLeft = x === 0;
|
|
319
|
+
const isRight = x === width - 1;
|
|
320
|
+
let ch;
|
|
321
|
+
if (isLeft && left)
|
|
322
|
+
ch = chars.bl;
|
|
323
|
+
else if (isRight && right)
|
|
324
|
+
ch = chars.br;
|
|
325
|
+
else
|
|
326
|
+
ch = chars.h;
|
|
327
|
+
this.region.setCell(x, height - 1, ch, baseId);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// left column (skip corners already drawn)
|
|
331
|
+
if (left && width >= 1) {
|
|
332
|
+
const rowStart = top ? 1 : 0;
|
|
333
|
+
const rowEnd = bottom ? height - 2 : height - 1;
|
|
334
|
+
for (let y = rowStart; y <= rowEnd; y++) {
|
|
335
|
+
this.region.setCell(0, y, chars.v, baseId);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// right column (skip corners already drawn)
|
|
339
|
+
if (right && width >= 2) {
|
|
340
|
+
const rowStart = top ? 1 : 0;
|
|
341
|
+
const rowEnd = bottom ? height - 2 : height - 1;
|
|
342
|
+
for (let y = rowStart; y <= rowEnd; y++) {
|
|
343
|
+
this.region.setCell(width - 1, y, chars.v, baseId);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/** Copies a child's display buffer onto this window's display buffer, clipping to this window's bounds.
|
|
348
|
+
* Styles are transferred from the child's registry into this window's registry.
|
|
349
|
+
* Position is re-resolved from the child's Pos spec relative to the inner content area on every render. */
|
|
350
|
+
blitChild(child) {
|
|
351
|
+
const chars = child.region.getChars();
|
|
352
|
+
const childStyleIds = child.region.getStyleIds();
|
|
353
|
+
const { width: cw, height: ch } = child.getSize();
|
|
354
|
+
const { width: pw, height: ph } = this.getInnerSize();
|
|
355
|
+
const { x: ox, y: oy } = this.getInnerOffset();
|
|
356
|
+
const { x: cx, y: cy } = child.posSpec.resolve(pw, ph, cw, ch);
|
|
357
|
+
const ax = cx + ox;
|
|
358
|
+
const ay = cy + oy;
|
|
359
|
+
const { width: totalW, height: totalH } = this.getSize();
|
|
360
|
+
for (let childY = 0; childY < ch; childY++) {
|
|
361
|
+
for (let childX = 0; childX < cw; childX++) {
|
|
362
|
+
const px = ax + childX;
|
|
363
|
+
const py = ay + childY;
|
|
364
|
+
if (px >= 0 && px < totalW && py >= 0 && py < totalH) {
|
|
365
|
+
const i = childY * cw + childX;
|
|
366
|
+
const attrs = child.registry.get(childStyleIds[i]);
|
|
367
|
+
const parentId = this.registry.register(attrs);
|
|
368
|
+
this.region.setCell(px, py, chars[i], parentId);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** Removes a previously added child window. No-op if the child is not found. */
|
|
374
|
+
removeChild(child) {
|
|
375
|
+
const idx = this.children.indexOf(child);
|
|
376
|
+
if (idx !== -1)
|
|
377
|
+
this.children.splice(idx, 1);
|
|
378
|
+
}
|
|
379
|
+
/** Replaces both internal regions with new ones of the given dimensions,
|
|
380
|
+
* then re-resolves sizes and positions of all direct children against the updated inner area. */
|
|
381
|
+
resizeRegions(w, h) {
|
|
382
|
+
this.region = new Region(w, h);
|
|
383
|
+
this.content = new Region(w, h);
|
|
384
|
+
this.reflowChildren();
|
|
385
|
+
}
|
|
386
|
+
/** Re-resolves sizes and absolute positions for every direct child against the current inner area.
|
|
387
|
+
* Called after this window is resized so that percentage-based children get correct dimensions. */
|
|
388
|
+
reflowChildren() {
|
|
389
|
+
const { width: pw, height: ph } = this.getInnerSize();
|
|
390
|
+
const { x: ox, y: oy } = this.getInnerOffset();
|
|
391
|
+
for (const child of this.children) {
|
|
392
|
+
if (!child.sizeSpec.isAbsolute()) {
|
|
393
|
+
const { w, h } = child.sizeSpec.resolve(pw, ph);
|
|
394
|
+
child.resizeRegions(w, h);
|
|
395
|
+
}
|
|
396
|
+
const { width: cw, height: ch } = child.getSize();
|
|
397
|
+
const { x, y } = child.posSpec.resolve(pw, ph, cw, ch);
|
|
398
|
+
child.x = x + ox;
|
|
399
|
+
child.y = y + oy;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/** Returns the flat index for (x, y) in the region buffer (used by getCell). */
|
|
403
|
+
flatIndex(x, y) {
|
|
404
|
+
return y * this.region.getSize().width + x;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=Window.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Window.mjs","sourceRoot":"","sources":["../../src/Screen/Window.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACzJ,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,6CAA6C;AAC7C,MAAM,YAAY,GAAkG;IACnH,MAAM,EAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE;IAC/D,MAAM,EAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE;IAC/D,OAAO,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE;CAC/D,CAAC;AAEF,wFAAwF;AACxF,MAAM,aAAa,GAAG,CAAC,MAA0C,EAAwB,EAAE;IAC1F,IAAI,CAAC,MAAM;QA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GAAG,EAAE,CAAC;QAClB,CAAC;IACF,CAAC;IAED,gFAAgF;IACxE,SAAS,CAAC,CAAS,EAAE,CAAS;QACrC,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;IAC5C,CAAC;CACD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Focusable, WindowManagerOptions } from './types.mjs';
|
|
2
|
+
import { Screen } from './Screen.mjs';
|
|
3
|
+
import { Window } from './Window.mjs';
|
|
4
|
+
/** Manages the application input loop, focus, and modal dialogs.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* 1. Create a Screen and add windows/controls to it.
|
|
8
|
+
* 2. Instantiate WindowManager and call register() for each focusable control.
|
|
9
|
+
* 3. Call run() to start the event loop.
|
|
10
|
+
*
|
|
11
|
+
* Focus is cycled with Tab / Shift-Tab. Keys are dispatched to the focused
|
|
12
|
+
* control's handleKey() method. Ctrl+C (or a configured exitKey) stops the loop.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WindowManager {
|
|
15
|
+
private screen;
|
|
16
|
+
private exitKeys;
|
|
17
|
+
private onExit?;
|
|
18
|
+
private onKey?;
|
|
19
|
+
private onMouse?;
|
|
20
|
+
private mouseEnabled;
|
|
21
|
+
private mainEntries;
|
|
22
|
+
private mainFocusIndex;
|
|
23
|
+
private dialogStack;
|
|
24
|
+
private running;
|
|
25
|
+
/** Bound reference kept so we can remove the listener in stop(). */
|
|
26
|
+
private boundHandleInput;
|
|
27
|
+
/** Bound SIGTERM handler for clean shutdown. */
|
|
28
|
+
private boundSigterm;
|
|
29
|
+
/** Creates a WindowManager for the given Screen.
|
|
30
|
+
* Does not start the input loop; call run() to begin. */
|
|
31
|
+
constructor(screen: Screen, options?: WindowManagerOptions);
|
|
32
|
+
/** Registers a focusable control for Tab-cycling in the main (non-dialog) context.
|
|
33
|
+
* Pass the chain of parent Windows so the absolute screen position can be computed
|
|
34
|
+
* for mouse hit-testing (innermost parent first, outermost last is NOT required —
|
|
35
|
+
* just pass them in nesting order from the control outward). */
|
|
36
|
+
register(control: Focusable & Window, ...parents: Window[]): void;
|
|
37
|
+
/** Removes a previously registered control from the main focus list. */
|
|
38
|
+
unregister(control: Focusable & Window): void;
|
|
39
|
+
/** Returns the currently focused control, or null if no control has focus. */
|
|
40
|
+
getFocused(): (Focusable & Window) | null;
|
|
41
|
+
/** Moves focus to the given control if it belongs to the active context and is enabled. */
|
|
42
|
+
setFocus(control: Focusable & Window): void;
|
|
43
|
+
/** Opens a modal dialog: blurs the current context, adds the dialog Window to
|
|
44
|
+
* the Screen, and activates a new focus context for the provided controls.
|
|
45
|
+
*
|
|
46
|
+
* @param dialog - The Window to display (will be added to Screen via addChild).
|
|
47
|
+
* @param controls - Array of { control, parents? } entries within the dialog.
|
|
48
|
+
* parents are Windows between the dialog and the control, used
|
|
49
|
+
* to compute absolute screen positions for mouse hit-testing. */
|
|
50
|
+
openDialog(dialog: Window, controls: ReadonlyArray<{
|
|
51
|
+
control: Focusable & Window;
|
|
52
|
+
parents?: Window[];
|
|
53
|
+
}>): void;
|
|
54
|
+
/** Closes the topmost modal dialog, removes it from the Screen, and restores
|
|
55
|
+
* the previous focus context. */
|
|
56
|
+
closeDialog(): void;
|
|
57
|
+
/** Starts the input loop: enables raw mode, optional mouse tracking, and renders
|
|
58
|
+
* the initial frame. The method returns immediately; events are handled
|
|
59
|
+
* asynchronously via stdin. */
|
|
60
|
+
run(): void;
|
|
61
|
+
/** Stops the input loop, restores terminal state, and fires the onExit callback.
|
|
62
|
+
* Safe to call even when the loop was not started (skips terminal teardown). */
|
|
63
|
+
stop(): void;
|
|
64
|
+
/** Processes a raw stdin Buffer. Exposed as public so tests can drive it directly
|
|
65
|
+
* without needing a real TTY. Tab / Shift-Tab navigation works even before run()
|
|
66
|
+
* because moveFocus() handles the "no current focus" case. Dispatching to a
|
|
67
|
+
* control triggers lazy focus initialization so the key reaches the right target. */
|
|
68
|
+
handleInput(data: Buffer): void;
|
|
69
|
+
/** Returns the FocusEntry array for the active context (topmost dialog or main). */
|
|
70
|
+
private activeEntries;
|
|
71
|
+
/** Returns the focus index for the active context. */
|
|
72
|
+
private getActiveFocusIndex;
|
|
73
|
+
/** Sets the focus index for the active context. */
|
|
74
|
+
private setActiveFocusIndex;
|
|
75
|
+
/** Removes focus from the currently focused control without moving it elsewhere. */
|
|
76
|
+
private blurCurrent;
|
|
77
|
+
/** Finds the first already-focused (or first non-disabled) control and focuses it. */
|
|
78
|
+
private initializeFocus;
|
|
79
|
+
/** Moves focus by delta (+1 for Tab, -1 for Shift-Tab), skipping disabled controls. */
|
|
80
|
+
private moveFocus;
|
|
81
|
+
/** Handles a parsed mouse event: left click moves focus to the clicked control. */
|
|
82
|
+
private handleMouseEvent;
|
|
83
|
+
/** Renders a frame to the screen. */
|
|
84
|
+
private renderFrame;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=WindowManager.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowManager.d.mts","sourceRoot":"","sources":["../../src/Screen/WindowManager.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAsB,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAoHtC;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAa;IAC5B,OAAO,CAAC,KAAK,CAAC,CAAwB;IACtC,OAAO,CAAC,OAAO,CAAC,CAAsC;IACtD,OAAO,CAAC,YAAY,CAAU;IAE9B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAgB;IACn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