@webda/debug 4.0.0-beta.3

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.
Files changed (66) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +95 -0
  3. package/lib/bodycapture.d.ts +66 -0
  4. package/lib/bodycapture.js +162 -0
  5. package/lib/bodycapture.js.map +1 -0
  6. package/lib/debugservice.service.d.ts +166 -0
  7. package/lib/debugservice.service.js +609 -0
  8. package/lib/debugservice.service.js.map +1 -0
  9. package/lib/index.d.ts +7 -0
  10. package/lib/index.js +7 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/introspection.d.ts +115 -0
  13. package/lib/introspection.js +260 -0
  14. package/lib/introspection.js.map +1 -0
  15. package/lib/logbuffer.d.ts +75 -0
  16. package/lib/logbuffer.js +98 -0
  17. package/lib/logbuffer.js.map +1 -0
  18. package/lib/requestlog.d.ts +181 -0
  19. package/lib/requestlog.js +153 -0
  20. package/lib/requestlog.js.map +1 -0
  21. package/lib/tui/client.d.ts +165 -0
  22. package/lib/tui/client.js +220 -0
  23. package/lib/tui/client.js.map +1 -0
  24. package/lib/tui/panels/config.d.ts +79 -0
  25. package/lib/tui/panels/config.js +291 -0
  26. package/lib/tui/panels/config.js.map +1 -0
  27. package/lib/tui/panels/logs.d.ts +106 -0
  28. package/lib/tui/panels/logs.js +342 -0
  29. package/lib/tui/panels/logs.js.map +1 -0
  30. package/lib/tui/panels/models.d.ts +47 -0
  31. package/lib/tui/panels/models.js +193 -0
  32. package/lib/tui/panels/models.js.map +1 -0
  33. package/lib/tui/panels/operations.d.ts +55 -0
  34. package/lib/tui/panels/operations.js +241 -0
  35. package/lib/tui/panels/operations.js.map +1 -0
  36. package/lib/tui/panels/panel.d.ts +55 -0
  37. package/lib/tui/panels/panel.js +31 -0
  38. package/lib/tui/panels/panel.js.map +1 -0
  39. package/lib/tui/panels/requests.d.ts +156 -0
  40. package/lib/tui/panels/requests.js +512 -0
  41. package/lib/tui/panels/requests.js.map +1 -0
  42. package/lib/tui/panels/routes.d.ts +45 -0
  43. package/lib/tui/panels/routes.js +154 -0
  44. package/lib/tui/panels/routes.js.map +1 -0
  45. package/lib/tui/panels/services.d.ts +49 -0
  46. package/lib/tui/panels/services.js +266 -0
  47. package/lib/tui/panels/services.js.map +1 -0
  48. package/lib/tui/tui.d.ts +58 -0
  49. package/lib/tui/tui.js +236 -0
  50. package/lib/tui/tui.js.map +1 -0
  51. package/package.json +60 -0
  52. package/webui/app.js +177 -0
  53. package/webui/components/logs.js +128 -0
  54. package/webui/components/model-graph.js +292 -0
  55. package/webui/components/models.js +213 -0
  56. package/webui/components/operations.js +315 -0
  57. package/webui/components/requests.js +264 -0
  58. package/webui/components/schema-form.js +268 -0
  59. package/webui/components/services.js +248 -0
  60. package/webui/index.html +22 -0
  61. package/webui/logo.svg +1 -0
  62. package/webui/styles.css +685 -0
  63. package/webui/vendor/htm.js +1 -0
  64. package/webui/vendor/preact-hooks.js +2 -0
  65. package/webui/vendor/preact.js +2 -0
  66. package/webui/webda.png +0 -0
@@ -0,0 +1,193 @@
1
+ import { ScrollablePanel } from "./panel.js";
2
+ /**
3
+ * Models panel: displays registered models in a scrollable list.
4
+ * Press Enter to toggle detail view showing schema, relations, and actions.
5
+ */
6
+ export class ModelsPanel extends ScrollablePanel {
7
+ /**
8
+ * @param client - Debug API client
9
+ */
10
+ constructor(client) {
11
+ super();
12
+ this.client = client;
13
+ this.name = "Models";
14
+ this.models = [];
15
+ this.detailMode = false;
16
+ /** Number of visible rows in the viewport (updated on render) */
17
+ this.visibleRows = 0;
18
+ }
19
+ /**
20
+ * Fetch models from the debug server.
21
+ */
22
+ async refresh() {
23
+ try {
24
+ this.models = await this.client.getModels();
25
+ this.itemCount = this.models.length;
26
+ this.cursor = Math.min(this.cursor, Math.max(0, this.itemCount - 1));
27
+ }
28
+ catch {
29
+ this.models = [];
30
+ this.itemCount = 0;
31
+ }
32
+ }
33
+ /**
34
+ * Handle keyboard input.
35
+ * @param key - key name from terminal-kit
36
+ */
37
+ onKey(key) {
38
+ if (this.detailMode) {
39
+ if (key === "ESCAPE" || key === "BACKSPACE" || key === "ENTER") {
40
+ this.detailMode = false;
41
+ }
42
+ return;
43
+ }
44
+ switch (key) {
45
+ case "UP":
46
+ this.moveCursor(-1, this.visibleRows);
47
+ break;
48
+ case "DOWN":
49
+ this.moveCursor(1, this.visibleRows);
50
+ break;
51
+ case "ENTER":
52
+ if (this.models.length > 0) {
53
+ this.detailMode = true;
54
+ }
55
+ break;
56
+ }
57
+ }
58
+ /**
59
+ * Render the models list or detail view.
60
+ * @param term - terminal-kit instance
61
+ * @param startRow - first available row
62
+ * @param endRow - last available row
63
+ * @param width - terminal width in columns
64
+ */
65
+ render(term, startRow, endRow, width) {
66
+ this.visibleRows = endRow - startRow;
67
+ if (this.models.length === 0) {
68
+ term.moveTo(1, startRow);
69
+ term.eraseLine();
70
+ term(" No models found. Is the debug server running?");
71
+ return;
72
+ }
73
+ if (this.detailMode) {
74
+ this.renderDetail(term, startRow, endRow, width);
75
+ return;
76
+ }
77
+ // Column header
78
+ term.moveTo(1, startRow);
79
+ term.eraseLine();
80
+ term.bold(" ID" + " ".repeat(Math.max(1, 40 - 4)) + "Plural" + " ".repeat(Math.max(1, 20 - 6)) + "Actions");
81
+ const dataStart = startRow + 1;
82
+ const visible = endRow - dataStart;
83
+ for (let i = 0; i < visible; i++) {
84
+ const idx = this.scrollOffset + i;
85
+ const row = dataStart + i;
86
+ term.moveTo(1, row);
87
+ term.eraseLine();
88
+ if (idx >= this.models.length)
89
+ continue;
90
+ const model = this.models[idx];
91
+ const isSelected = idx === this.cursor;
92
+ const id = (model.id || "unknown").substring(0, 38);
93
+ const plural = (model.plural || "").substring(0, 18);
94
+ const actions = (model.actions || []).join(", ").substring(0, width - 65);
95
+ const line = ` ${id.padEnd(38)} ${plural.padEnd(18)} ${actions}`;
96
+ if (isSelected) {
97
+ term.inverse(line.padEnd(width));
98
+ }
99
+ else {
100
+ term(line);
101
+ }
102
+ }
103
+ }
104
+ /**
105
+ * Render detail view for the selected model.
106
+ * @param term - terminal-kit instance
107
+ * @param startRow - first available row
108
+ * @param endRow - last available row
109
+ * @param width - terminal width in columns
110
+ */
111
+ renderDetail(term, startRow, endRow, width) {
112
+ const model = this.models[this.cursor];
113
+ if (!model)
114
+ return;
115
+ const lines = [];
116
+ const addText = function addTextLine(text, style) {
117
+ lines.push({
118
+ render: function renderText(t, w) {
119
+ const s = text.substring(0, w);
120
+ if (style === "bold")
121
+ t.bold(s);
122
+ else if (style === "dim")
123
+ t.dim(s);
124
+ else if (style === "cyan")
125
+ t.cyan(s);
126
+ else
127
+ t(s);
128
+ }
129
+ });
130
+ };
131
+ const addEmpty = function addEmptyLine() {
132
+ lines.push({ render: function renderEmpty() { } });
133
+ };
134
+ addText(` Model: ${model.id}`, "bold");
135
+ if (model.plural)
136
+ addText(` Plural: ${model.plural}`);
137
+ if (model.store)
138
+ addText(` Store: ${model.store}${model.storeType ? " (" + model.storeType + ")" : ""}`);
139
+ addEmpty();
140
+ // Inheritance
141
+ const ancestors = model.metadata?.Ancestors || [];
142
+ const subclasses = model.metadata?.Subclasses || [];
143
+ if (ancestors.length > 0 || subclasses.length > 0) {
144
+ addText(" Inheritance:", "bold");
145
+ if (ancestors.length > 0) {
146
+ addText(` Ancestors: ${[...ancestors].reverse().join(" → ")} → ${model.id.split("/").pop()}`);
147
+ }
148
+ if (subclasses.length > 0) {
149
+ addText(` Subclasses: ${subclasses.join(", ")}`);
150
+ }
151
+ addEmpty();
152
+ }
153
+ // Relations
154
+ const rel = model.relations || {};
155
+ const relLines = [];
156
+ if (rel.parent)
157
+ relLines.push(` parent ${rel.parent.attribute.padEnd(20)} → ${rel.parent.model}`);
158
+ (rel.links || []).forEach((l) => relLines.push(` ${(l.type || "link").padEnd(10)} ${l.attribute.padEnd(20)} → ${l.model}`));
159
+ (rel.queries || []).forEach((q) => relLines.push(` query ${q.attribute.padEnd(20)} → ${q.model}`));
160
+ (rel.maps || []).forEach((m) => relLines.push(` map ${m.attribute.padEnd(20)} → ${m.model}`));
161
+ (rel.children || []).forEach((c) => relLines.push(` child ${"".padEnd(20)} → ${c}`));
162
+ (rel.binaries || []).forEach((b) => relLines.push(` binary ${b.attribute.padEnd(20)} (${b.cardinality})`));
163
+ if (relLines.length > 0) {
164
+ addText(" Relations:", "bold");
165
+ relLines.forEach(l => addText(l));
166
+ addEmpty();
167
+ }
168
+ // Actions
169
+ if (model.actions?.length > 0) {
170
+ addText(" Actions:", "bold");
171
+ addText(` ${model.actions.join(", ")}`);
172
+ addEmpty();
173
+ }
174
+ addText(" Press ENTER or ESC to go back", "dim");
175
+ // Render with scroll (reuse detailMode scroll if we had one)
176
+ const visible = endRow - startRow;
177
+ for (let i = 0; i < visible; i++) {
178
+ const row = startRow + i;
179
+ term.moveTo(1, row);
180
+ term.eraseLine();
181
+ if (i < lines.length) {
182
+ lines[i].render(term, width);
183
+ }
184
+ }
185
+ }
186
+ /**
187
+ * Clean up panel resources.
188
+ */
189
+ destroy() {
190
+ this.models = [];
191
+ }
192
+ }
193
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/tui/panels/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IAO9C;;OAEG;IACH,YAAoB,MAAmB;QACrC,KAAK,EAAE,CAAC;QADU,WAAM,GAAN,MAAM,CAAa;QATvC,SAAI,GAAG,QAAQ,CAAC;QACR,WAAM,GAAU,EAAE,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QAC3B,iEAAiE;QACzD,gBAAW,GAAG,CAAC,CAAC;IAOxB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,C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;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,QAAQ,GAAG,CAAC,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBACrB,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,55 @@
1
+ import { ScrollablePanel } from "./panel.js";
2
+ import { DebugClient } from "../client.js";
3
+ /**
4
+ * Operations panel: displays all registered operations in a table
5
+ * with ID, REST method/URL, and input/output schemas.
6
+ * Press Enter for detail view with implementor, schemas, and code.
7
+ */
8
+ export declare class OperationsPanel extends ScrollablePanel {
9
+ private client;
10
+ name: string;
11
+ private operations;
12
+ private visibleRows;
13
+ private detailMode;
14
+ private detailScroll;
15
+ /**
16
+ * @param client - Debug API client
17
+ */
18
+ constructor(client: DebugClient);
19
+ /**
20
+ * Fetch operations from the debug server.
21
+ */
22
+ refresh(): Promise<void>;
23
+ /**
24
+ * Handle keyboard input.
25
+ * @param key - key name from terminal-kit
26
+ */
27
+ onKey(key: string): void;
28
+ /**
29
+ * Color an HTTP method string.
30
+ * @param term - terminal-kit instance
31
+ * @param method - HTTP method
32
+ * @param inverse - apply inverse
33
+ */
34
+ private colorMethod;
35
+ /**
36
+ * Render the operations table or detail view.
37
+ * @param term - terminal-kit instance
38
+ * @param startRow - first available row
39
+ * @param endRow - last available row
40
+ * @param width - terminal width in columns
41
+ */
42
+ render(term: any, startRow: number, endRow: number, width: number): void;
43
+ /**
44
+ * Render detail view for the selected operation.
45
+ * @param term - terminal-kit instance
46
+ * @param startRow - first available row
47
+ * @param endRow - last available row
48
+ * @param width - terminal width in columns
49
+ */
50
+ private renderDetail;
51
+ /**
52
+ * Clean up panel resources.
53
+ */
54
+ destroy(): void;
55
+ }
@@ -0,0 +1,241 @@
1
+ import { ScrollablePanel } from "./panel.js";
2
+ /**
3
+ * Operations panel: displays all registered operations in a table
4
+ * with ID, REST method/URL, and input/output schemas.
5
+ * Press Enter for detail view with implementor, schemas, and code.
6
+ */
7
+ export class OperationsPanel extends ScrollablePanel {
8
+ /**
9
+ * @param client - Debug API client
10
+ */
11
+ constructor(client) {
12
+ super();
13
+ this.client = client;
14
+ this.name = "Operations";
15
+ this.operations = [];
16
+ this.visibleRows = 0;
17
+ this.detailMode = false;
18
+ this.detailScroll = 0;
19
+ }
20
+ /**
21
+ * Fetch operations from the debug server.
22
+ */
23
+ async refresh() {
24
+ try {
25
+ this.operations = await this.client.getOperations();
26
+ this.itemCount = this.operations.length;
27
+ this.cursor = Math.min(this.cursor, Math.max(0, this.itemCount - 1));
28
+ }
29
+ catch {
30
+ this.operations = [];
31
+ this.itemCount = 0;
32
+ }
33
+ }
34
+ /**
35
+ * Handle keyboard input.
36
+ * @param key - key name from terminal-kit
37
+ */
38
+ onKey(key) {
39
+ if (this.detailMode) {
40
+ switch (key) {
41
+ case "ESCAPE":
42
+ case "BACKSPACE":
43
+ this.detailMode = false;
44
+ this.detailScroll = 0;
45
+ break;
46
+ case "UP":
47
+ this.detailScroll = Math.max(0, this.detailScroll - 1);
48
+ break;
49
+ case "DOWN":
50
+ this.detailScroll++;
51
+ break;
52
+ case "PAGE_UP":
53
+ this.detailScroll = Math.max(0, this.detailScroll - this.visibleRows);
54
+ break;
55
+ case "PAGE_DOWN":
56
+ this.detailScroll += this.visibleRows;
57
+ break;
58
+ }
59
+ return;
60
+ }
61
+ switch (key) {
62
+ case "UP":
63
+ this.moveCursor(-1, this.visibleRows);
64
+ break;
65
+ case "DOWN":
66
+ this.moveCursor(1, this.visibleRows);
67
+ break;
68
+ case "ENTER":
69
+ if (this.operations.length > 0) {
70
+ this.detailMode = true;
71
+ this.detailScroll = 0;
72
+ }
73
+ break;
74
+ }
75
+ }
76
+ /**
77
+ * Color an HTTP method string.
78
+ * @param term - terminal-kit instance
79
+ * @param method - HTTP method
80
+ * @param inverse - apply inverse
81
+ */
82
+ colorMethod(term, method, inverse = false) {
83
+ const m = (method || "").toUpperCase();
84
+ const fn = m === "GET"
85
+ ? term.green
86
+ : m === "POST"
87
+ ? term.cyan
88
+ : m === "PUT"
89
+ ? term.yellow
90
+ : m === "DELETE"
91
+ ? term.red
92
+ : m === "PATCH"
93
+ ? term.magenta
94
+ : term;
95
+ if (inverse)
96
+ fn.inverse(m.padEnd(7));
97
+ else
98
+ fn(m.padEnd(7));
99
+ }
100
+ /**
101
+ * Render the operations table or detail view.
102
+ * @param term - terminal-kit instance
103
+ * @param startRow - first available row
104
+ * @param endRow - last available row
105
+ * @param width - terminal width in columns
106
+ */
107
+ render(term, startRow, endRow, width) {
108
+ this.visibleRows = endRow - startRow - 1;
109
+ if (this.operations.length === 0) {
110
+ term.moveTo(1, startRow);
111
+ term.eraseLine();
112
+ term(" No operations found. Is the debug server running?");
113
+ return;
114
+ }
115
+ if (this.detailMode) {
116
+ this.renderDetail(term, startRow, endRow, width);
117
+ return;
118
+ }
119
+ // Header
120
+ term.moveTo(1, startRow);
121
+ term.eraseLine();
122
+ term.bold(" Method ID" + " ".repeat(Math.max(1, 32 - 2)) + "URL");
123
+ const dataStart = startRow + 1;
124
+ const visible = endRow - dataStart;
125
+ for (let i = 0; i < visible; i++) {
126
+ const idx = this.scrollOffset + i;
127
+ const row = dataStart + i;
128
+ term.moveTo(1, row);
129
+ term.eraseLine();
130
+ if (idx >= this.operations.length)
131
+ continue;
132
+ const op = this.operations[idx];
133
+ const isSelected = idx === this.cursor;
134
+ const rest = typeof op.rest === "object" ? op.rest : null;
135
+ if (isSelected)
136
+ term.inverse(" ");
137
+ else
138
+ term(" ");
139
+ // HTTP method
140
+ if (rest?.method) {
141
+ this.colorMethod(term, rest.method, isSelected);
142
+ }
143
+ else {
144
+ if (isSelected)
145
+ term.inverse(" ");
146
+ else
147
+ term(" ");
148
+ }
149
+ const id = (op.id || "unknown").substring(0, 30);
150
+ const url = (rest?.url || "").substring(0, width - 45);
151
+ if (isSelected) {
152
+ term.inverse(` ${id.padEnd(30)} `);
153
+ term.dim.inverse(url.padEnd(Math.max(0, width - 43)));
154
+ }
155
+ else {
156
+ term(` ${id.padEnd(30)} `);
157
+ term.dim(url);
158
+ }
159
+ }
160
+ }
161
+ /**
162
+ * Render detail view for the selected operation.
163
+ * @param term - terminal-kit instance
164
+ * @param startRow - first available row
165
+ * @param endRow - last available row
166
+ * @param width - terminal width in columns
167
+ */
168
+ renderDetail(term, startRow, endRow, width) {
169
+ const op = this.operations[this.cursor];
170
+ if (!op)
171
+ return;
172
+ const lines = [];
173
+ const add = function addLine(text) {
174
+ lines.push(text);
175
+ };
176
+ add(` Operation: ${op.id}`);
177
+ if (op.summary)
178
+ add(` ${op.summary}`);
179
+ add("");
180
+ // REST
181
+ const rest = typeof op.rest === "object" ? op.rest : null;
182
+ if (rest?.method) {
183
+ add(` REST: ${rest.method.toUpperCase()} ${rest.url || rest.path || "/"}`);
184
+ }
185
+ // Input/Output
186
+ add(` Input: ${op.input || "void"}`);
187
+ add(` Output: ${op.output || "void"}`);
188
+ add("");
189
+ // Implementor
190
+ if (op.implementor) {
191
+ const impl = op.implementor;
192
+ add(` ${impl.type === "model" ? "Model" : "Service"}: ${impl.name}${impl.method ? "." + impl.method + "()" : ""}`);
193
+ add("");
194
+ // Code
195
+ if (impl.code) {
196
+ add(" Code:");
197
+ const codeLines = impl.code.split("\n");
198
+ for (const line of codeLines) {
199
+ add(` ${line}`);
200
+ }
201
+ add("");
202
+ }
203
+ }
204
+ // Tags
205
+ if (op.tags?.length > 0) {
206
+ add(` Tags: ${op.tags.join(", ")}`);
207
+ add("");
208
+ }
209
+ add(" Press ESC to go back | UP/DOWN to scroll");
210
+ // Render with scroll
211
+ const visible = endRow - startRow;
212
+ this.detailScroll = Math.min(this.detailScroll, Math.max(0, lines.length - visible));
213
+ for (let i = 0; i < visible; i++) {
214
+ const lineIdx = this.detailScroll + i;
215
+ const row = startRow + i;
216
+ term.moveTo(1, row);
217
+ term.eraseLine();
218
+ if (lineIdx < lines.length) {
219
+ const text = lines[lineIdx].substring(0, width);
220
+ // Highlight keywords
221
+ if (text.startsWith(" Operation:") || text.startsWith(" Code:") || text.startsWith(" REST:")) {
222
+ term.bold(text);
223
+ }
224
+ else if (text.startsWith(" ")) {
225
+ // Code lines
226
+ term.dim(text);
227
+ }
228
+ else {
229
+ term(text);
230
+ }
231
+ }
232
+ }
233
+ }
234
+ /**
235
+ * Clean up panel resources.
236
+ */
237
+ destroy() {
238
+ this.operations = [];
239
+ }
240
+ }
241
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/tui/panels/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAOlD;;OAEG;IACH,YAAoB,MAAmB;QACrC,KAAK,EAAE,CAAC;QADU,WAAM,GAAN,MAAM,CAAa;QATvC,SAAI,GAAG,YAAY,CAAC;QACZ,eAAU,GAAU,EAAE,CAAC;QACvB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,KAAK,CAAC;QACnB,iBAAY,GAAG,CAAC,CAAC;IAOzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;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,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAChD,qBAAqB;gBACrB,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;oBAChG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC;qBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnC,aAAa;oBACb,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACjB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,IAAI,CAAC,CAAC;gBACb,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Interface for TUI panels.
3
+ *
4
+ * Each panel represents a tab in the debug dashboard and is responsible
5
+ * for rendering its content area and handling keyboard input.
6
+ */
7
+ export interface Panel {
8
+ /** Display name shown in the tab bar */
9
+ name: string;
10
+ /**
11
+ * Render the panel content into the terminal.
12
+ *
13
+ * @param term - terminal-kit terminal instance
14
+ * @param startRow - first row available for content (after header)
15
+ * @param endRow - last row available for content (before status bar)
16
+ * @param width - terminal width in columns
17
+ */
18
+ render(term: any, startRow: number, endRow: number, width: number): void;
19
+ /**
20
+ * Handle a keypress while this panel is active.
21
+ *
22
+ * @param key - Key name from terminal-kit (e.g. "UP", "DOWN", "ENTER")
23
+ */
24
+ onKey?(key: string): void;
25
+ /**
26
+ * Update panel data (called on initial load and on restart events).
27
+ */
28
+ refresh?(): Promise<void>;
29
+ /**
30
+ * Clean up resources when the panel is no longer needed.
31
+ */
32
+ destroy(): void;
33
+ }
34
+ /**
35
+ * Base class for panels that display a scrollable list of items.
36
+ * Provides cursor movement and scroll offset logic.
37
+ */
38
+ export declare abstract class ScrollablePanel implements Panel {
39
+ abstract name: string;
40
+ /** Current cursor position in the items array */
41
+ protected cursor: number;
42
+ /** Scroll offset (first visible row index) */
43
+ protected scrollOffset: number;
44
+ /** Total number of items */
45
+ protected itemCount: number;
46
+ /**
47
+ * Move the cursor, clamping to valid range and adjusting scroll.
48
+ *
49
+ * @param delta - Number of rows to move (negative = up)
50
+ * @param visibleRows - Number of rows visible in the viewport
51
+ */
52
+ protected moveCursor(delta: number, visibleRows: number): void;
53
+ abstract render(term: any, startRow: number, endRow: number, width: number): void;
54
+ abstract destroy(): void;
55
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Base class for panels that display a scrollable list of items.
3
+ * Provides cursor movement and scroll offset logic.
4
+ */
5
+ export class ScrollablePanel {
6
+ constructor() {
7
+ /** Current cursor position in the items array */
8
+ this.cursor = 0;
9
+ /** Scroll offset (first visible row index) */
10
+ this.scrollOffset = 0;
11
+ /** Total number of items */
12
+ this.itemCount = 0;
13
+ }
14
+ /**
15
+ * Move the cursor, clamping to valid range and adjusting scroll.
16
+ *
17
+ * @param delta - Number of rows to move (negative = up)
18
+ * @param visibleRows - Number of rows visible in the viewport
19
+ */
20
+ moveCursor(delta, visibleRows) {
21
+ this.cursor = Math.max(0, Math.min(this.itemCount - 1, this.cursor + delta));
22
+ // Adjust scroll offset to keep cursor visible
23
+ if (this.cursor < this.scrollOffset) {
24
+ this.scrollOffset = this.cursor;
25
+ }
26
+ else if (this.cursor >= this.scrollOffset + visibleRows) {
27
+ this.scrollOffset = this.cursor - visibleRows + 1;
28
+ }
29
+ }
30
+ }
31
+ //# sourceMappingURL=panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.js","sourceRoot":"","sources":["../../../src/tui/panels/panel.ts"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,MAAM,OAAgB,eAAe;IAArC;QAEE,iDAAiD;QACvC,WAAM,GAAG,CAAC,CAAC;QACrB,8CAA8C;QACpC,iBAAY,GAAG,CAAC,CAAC;QAC3B,4BAA4B;QAClB,cAAS,GAAG,CAAC,CAAC;IAoB1B,CAAC;IAlBC;;;;;OAKG;IACO,UAAU,CAAC,KAAa,EAAE,WAAmB;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;QAC7E,8CAA8C;QAC9C,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAClC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,GAAG,WAAW,EAAE,CAAC;YAC1D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;CAIF"}