@sigrun/tui 0.1.0 → 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/CHANGELOG.md +6 -0
- package/dist/actions.d.ts +43 -2
- package/dist/api.d.ts +5 -0
- package/dist/api.js +5 -1
- package/dist/blocks/braille.d.ts +41 -0
- package/dist/blocks/braille.js +131 -0
- package/dist/blocks/chart.d.ts +20 -0
- package/dist/blocks/chart.js +397 -0
- package/dist/blocks/collection/calendar.d.ts +28 -0
- package/dist/blocks/collection/calendar.js +232 -0
- package/dist/blocks/collection/card.d.ts +36 -0
- package/dist/blocks/collection/card.js +128 -0
- package/dist/blocks/collection/collection.d.ts +9 -0
- package/dist/blocks/collection/collection.js +26 -0
- package/dist/blocks/collection/grid.d.ts +18 -0
- package/dist/blocks/collection/grid.js +72 -0
- package/dist/blocks/collection/lanes.d.ts +32 -0
- package/dist/blocks/collection/lanes.js +320 -0
- package/dist/blocks/collection/list.d.ts +30 -0
- package/dist/blocks/collection/list.js +273 -0
- package/dist/blocks/collection/move.d.ts +67 -0
- package/dist/blocks/collection/move.js +96 -0
- package/dist/blocks/collection/shared.d.ts +87 -0
- package/dist/blocks/collection/shared.js +177 -0
- package/dist/blocks/collection/table.d.ts +26 -0
- package/dist/blocks/collection/table.js +221 -0
- package/dist/blocks/content.d.ts +48 -0
- package/dist/blocks/content.js +253 -0
- package/dist/blocks/context.d.ts +96 -0
- package/dist/blocks/context.js +65 -0
- package/dist/blocks/diff.d.ts +21 -0
- package/dist/blocks/diff.js +25 -0
- package/dist/blocks/ext-transport.d.ts +70 -0
- package/dist/blocks/ext-transport.js +165 -0
- package/dist/blocks/form/choice.d.ts +54 -0
- package/dist/blocks/form/choice.js +175 -0
- package/dist/blocks/form/fields.d.ts +56 -0
- package/dist/blocks/form/fields.js +136 -0
- package/dist/blocks/form/file.d.ts +61 -0
- package/dist/blocks/form/file.js +121 -0
- package/dist/blocks/form/form.d.ts +53 -0
- package/dist/blocks/form/form.js +703 -0
- package/dist/blocks/form/list.d.ts +37 -0
- package/dist/blocks/form/list.js +70 -0
- package/dist/blocks/form/values.d.ts +20 -0
- package/dist/blocks/form/values.js +104 -0
- package/dist/blocks/icons.d.ts +14 -0
- package/dist/blocks/icons.js +74 -0
- package/dist/blocks/image.d.ts +39 -0
- package/dist/blocks/image.js +82 -0
- package/dist/blocks/layout.d.ts +31 -0
- package/dist/blocks/layout.js +155 -0
- package/dist/blocks/log.d.ts +24 -0
- package/dist/blocks/log.js +111 -0
- package/dist/blocks/meter.d.ts +16 -0
- package/dist/blocks/meter.js +50 -0
- package/dist/blocks/page.d.ts +54 -0
- package/dist/blocks/page.js +355 -0
- package/dist/blocks/render.d.ts +31 -0
- package/dist/blocks/render.js +145 -0
- package/dist/blocks/surface-view.d.ts +33 -0
- package/dist/blocks/surface-view.js +86 -0
- package/dist/blocks/surface.d.ts +75 -0
- package/dist/blocks/surface.js +468 -0
- package/dist/blocks/tones.d.ts +23 -0
- package/dist/blocks/tones.js +63 -0
- package/dist/blocks/treeview.d.ts +22 -0
- package/dist/blocks/treeview.js +121 -0
- package/dist/blocks/width.d.ts +32 -0
- package/dist/blocks/width.js +70 -0
- package/dist/keymaps/emacs.js +39 -0
- package/dist/keymaps/standard.js +45 -1
- package/dist/keymaps/vim.js +37 -0
- package/dist/launch.js +13 -0
- package/dist/sse.d.ts +8 -0
- package/dist/sse.js +27 -0
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +16 -2
- package/dist/ui/app.d.ts +36 -0
- package/dist/ui/app.js +84 -0
- package/dist/ui/interactions.js +2 -7
- package/dist/ui/sidebar.d.ts +25 -2
- package/dist/ui/sidebar.js +64 -0
- package/package.json +3 -3
package/dist/ui/sidebar.js
CHANGED
|
@@ -35,6 +35,9 @@ export class Sidebar {
|
|
|
35
35
|
#rowComponents = [];
|
|
36
36
|
/** Conversation rows only (the action row is {@link #newRow}). */
|
|
37
37
|
#rows = [];
|
|
38
|
+
/** The extension VIEW rows (U3 Task 5): one per declared view surface,
|
|
39
|
+
* rendered under the VIEWS group header. */
|
|
40
|
+
#views = [];
|
|
38
41
|
/** The trailing `+ New conversation` action row (always present). */
|
|
39
42
|
#newRow = {
|
|
40
43
|
id: NEW_ROW_ID,
|
|
@@ -95,6 +98,44 @@ export class Sidebar {
|
|
|
95
98
|
this.#clampCursor();
|
|
96
99
|
this.#mount();
|
|
97
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* The extension views (U3 Task 5): refetch `GET /v1/extensions` and
|
|
103
|
+
* rebuild the VIEWS group (one row per declared view surface, in
|
|
104
|
+
* declaration order, status "ok" only). Panels live in the side pane,
|
|
105
|
+
* not here. Failures keep the last good list (a flaky server must
|
|
106
|
+
* never blank the sidebar).
|
|
107
|
+
*/
|
|
108
|
+
async refreshViews() {
|
|
109
|
+
try {
|
|
110
|
+
const list = await this.#client.listExtensions();
|
|
111
|
+
const views = [];
|
|
112
|
+
for (const extension of list.extensions) {
|
|
113
|
+
if (extension.status !== "ok")
|
|
114
|
+
continue;
|
|
115
|
+
for (const surface of extension.surfaces ?? []) {
|
|
116
|
+
if (surface.placement !== "view")
|
|
117
|
+
continue;
|
|
118
|
+
views.push({ slug: extension.name, id: surface.id, title: surface.title });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this.#views = views;
|
|
122
|
+
this.#mount();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// fail quiet — the last good list stands
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** The extension view rows (the app's openExtView reads them). */
|
|
129
|
+
get views() {
|
|
130
|
+
return this.#views;
|
|
131
|
+
}
|
|
132
|
+
/** Select the Nth extension view (the action layer's seam). */
|
|
133
|
+
confirmView(index) {
|
|
134
|
+
const view = this.#views[index];
|
|
135
|
+
if (view === undefined)
|
|
136
|
+
return;
|
|
137
|
+
this.onSelect?.({ view: { slug: view.slug, id: view.id } });
|
|
138
|
+
}
|
|
98
139
|
/** Mark the active conversation (accent fg + bold); pass `undefined` to clear. */
|
|
99
140
|
setActive(id) {
|
|
100
141
|
if (id === this.#activeId)
|
|
@@ -167,6 +208,22 @@ export class Sidebar {
|
|
|
167
208
|
this.#rowComponents.push(component);
|
|
168
209
|
this.#stack.addChild(component);
|
|
169
210
|
}
|
|
211
|
+
// The VIEWS group (U3 Task 5): one row per declared extension view.
|
|
212
|
+
if (this.#views.length > 0) {
|
|
213
|
+
this.#stack.addChild(new Text(this.#theme.dim("VIEWS"), 1, 0));
|
|
214
|
+
for (const view of this.#views) {
|
|
215
|
+
const line = this.#rowLine();
|
|
216
|
+
const component = new MouseRegion(line, (event) => {
|
|
217
|
+
if (event.type === "click" && event.button === "left") {
|
|
218
|
+
this.onSelect?.({ view: { slug: view.slug, id: view.id } });
|
|
219
|
+
return { handled: true };
|
|
220
|
+
}
|
|
221
|
+
return undefined;
|
|
222
|
+
});
|
|
223
|
+
this.#rowComponents.push(component);
|
|
224
|
+
this.#stack.addChild(component);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
170
227
|
this.#stack.invalidate();
|
|
171
228
|
}
|
|
172
229
|
/** One row's styled text at the render width. */
|
|
@@ -197,6 +254,13 @@ export class Sidebar {
|
|
|
197
254
|
for (const [index, row] of this.#display.entries()) {
|
|
198
255
|
lines[index + 1] = this.#rowText(row, index, width);
|
|
199
256
|
}
|
|
257
|
+
// The VIEWS group rows (after the conversations + the VIEWS header).
|
|
258
|
+
if (this.#views.length > 0) {
|
|
259
|
+
const base = this.#display.length + 2; // header + rows + VIEWS header
|
|
260
|
+
for (const [index, view] of this.#views.entries()) {
|
|
261
|
+
lines[base + index] = truncateToWidth(` ${view.title}`, width);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
200
264
|
return lines;
|
|
201
265
|
}
|
|
202
266
|
invalidate() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigrun/tui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "sigrun terminal client (pi-tui based) over the
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "sigrun terminal client (pi-tui based) over the \u00a75 API \u2014 spawned by the sigrun CLI, or standalone against a server URL",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"sigrun-tui": "dist/launch.js"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@earendil-works/pi-tui": "^1.3.0",
|
|
23
|
-
"@sigrun/shared": "0.1.
|
|
23
|
+
"@sigrun/shared": "0.1.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "^7.0.2",
|