@flyingrobots/bijou-tui 0.10.0 → 1.1.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/README.md +25 -0
- package/dist/accordion.d.ts +46 -5
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +41 -5
- package/dist/accordion.js.map +1 -1
- package/dist/animate.d.ts +30 -0
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +33 -0
- package/dist/animate.js.map +1 -1
- package/dist/browsable-list.d.ts +67 -4
- package/dist/browsable-list.d.ts.map +1 -1
- package/dist/browsable-list.js +49 -4
- package/dist/browsable-list.js.map +1 -1
- package/dist/canvas.d.ts +13 -4
- package/dist/canvas.d.ts.map +1 -1
- package/dist/canvas.js +9 -3
- package/dist/canvas.js.map +1 -1
- package/dist/command-palette.d.ts +67 -6
- package/dist/command-palette.d.ts.map +1 -1
- package/dist/command-palette.js +67 -6
- package/dist/command-palette.js.map +1 -1
- package/dist/commands.d.ts +32 -3
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +32 -3
- package/dist/commands.js.map +1 -1
- package/dist/dag-pane.d.ts +225 -0
- package/dist/dag-pane.d.ts.map +1 -0
- package/dist/dag-pane.js +510 -0
- package/dist/dag-pane.js.map +1 -0
- package/dist/driver.d.ts +14 -0
- package/dist/driver.d.ts.map +1 -1
- package/dist/driver.js +7 -0
- package/dist/driver.js.map +1 -1
- package/dist/eventbus.d.ts +43 -6
- package/dist/eventbus.d.ts.map +1 -1
- package/dist/eventbus.js +9 -0
- package/dist/eventbus.js.map +1 -1
- package/dist/file-picker.d.ts +56 -4
- package/dist/file-picker.d.ts.map +1 -1
- package/dist/file-picker.js +52 -4
- package/dist/file-picker.js.map +1 -1
- package/dist/flex.d.ts +17 -0
- package/dist/flex.d.ts.map +1 -1
- package/dist/flex.js +106 -12
- package/dist/flex.js.map +1 -1
- package/dist/focus-area.d.ts +179 -0
- package/dist/focus-area.d.ts.map +1 -0
- package/dist/focus-area.js +261 -0
- package/dist/focus-area.js.map +1 -0
- package/dist/help.d.ts +16 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +13 -0
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/inputstack.d.ts +32 -4
- package/dist/inputstack.d.ts.map +1 -1
- package/dist/inputstack.js +11 -0
- package/dist/inputstack.js.map +1 -1
- package/dist/keybindings.d.ts +106 -14
- package/dist/keybindings.d.ts.map +1 -1
- package/dist/keybindings.js +28 -2
- package/dist/keybindings.js.map +1 -1
- package/dist/keys.d.ts +24 -8
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +34 -9
- package/dist/keys.js.map +1 -1
- package/dist/layout.d.ts +26 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +25 -1
- package/dist/layout.js.map +1 -1
- package/dist/navigable-table.d.ts +48 -4
- package/dist/navigable-table.d.ts.map +1 -1
- package/dist/navigable-table.js +44 -4
- package/dist/navigable-table.js.map +1 -1
- package/dist/overlay.d.ts +110 -3
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +87 -7
- package/dist/overlay.js.map +1 -1
- package/dist/pager.d.ts +66 -7
- package/dist/pager.d.ts.map +1 -1
- package/dist/pager.js +56 -7
- package/dist/pager.js.map +1 -1
- package/dist/panels.d.ts +55 -0
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +11 -0
- package/dist/panels.js.map +1 -1
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -0
- package/dist/runtime.js.map +1 -1
- package/dist/screen.d.ts +37 -3
- package/dist/screen.d.ts.map +1 -1
- package/dist/screen.js +37 -3
- package/dist/screen.js.map +1 -1
- package/dist/spring.d.ts +56 -7
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +44 -7
- package/dist/spring.js.map +1 -1
- package/dist/status-bar.d.ts +15 -2
- package/dist/status-bar.d.ts.map +1 -1
- package/dist/status-bar.js +9 -0
- package/dist/status-bar.js.map +1 -1
- package/dist/timeline.d.ts +68 -5
- package/dist/timeline.d.ts.map +1 -1
- package/dist/timeline.js +33 -0
- package/dist/timeline.js.map +1 -1
- package/dist/types.d.ts +86 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +27 -3
- package/dist/types.js.map +1 -1
- package/dist/viewport.d.ts +71 -11
- package/dist/viewport.d.ts.map +1 -1
- package/dist/viewport.js +79 -11
- package/dist/viewport.js.map +1 -1
- package/package.json +2 -2
package/dist/dag-pane.js
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive DAG pane building block.
|
|
3
|
+
*
|
|
4
|
+
* Composes `dagLayout()` with `focusArea()` to provide a scrollable,
|
|
5
|
+
* keyboard-navigable DAG viewer with arrow-key node selection,
|
|
6
|
+
* auto-scroll-to-selection, and auto-highlight-path.
|
|
7
|
+
*
|
|
8
|
+
* Follows the building block pattern: immutable state + pure transformers +
|
|
9
|
+
* pure render + convenience keymap factory.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* // In TEA init:
|
|
13
|
+
* const pane = createDagPaneState({ source: nodes, width: 80, height: 24, ctx });
|
|
14
|
+
*
|
|
15
|
+
* // In TEA view:
|
|
16
|
+
* const output = dagPane(pane, { focused: true, ctx });
|
|
17
|
+
*
|
|
18
|
+
* // In TEA update:
|
|
19
|
+
* case 'select-child':
|
|
20
|
+
* return [{ ...model, pane: dagPaneSelectChild(model.pane, ctx) }, []];
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { dagLayout, isSlicedDagSource } from '@flyingrobots/bijou';
|
|
24
|
+
import { createFocusAreaState, focusArea, focusAreaScrollBy, focusAreaScrollToTop, focusAreaScrollToBottom, focusAreaPageDown, focusAreaPageUp, focusAreaScrollByX, focusAreaSetContent, } from './focus-area.js';
|
|
25
|
+
import { scrollTo, scrollToX } from './viewport.js';
|
|
26
|
+
import { createKeyMap } from './keybindings.js';
|
|
27
|
+
function buildAdjacency(source) {
|
|
28
|
+
const childMap = new Map();
|
|
29
|
+
const parentMap = new Map();
|
|
30
|
+
if (isSlicedDagSource(source)) {
|
|
31
|
+
const ids = source.ids();
|
|
32
|
+
const idSet = new Set(ids);
|
|
33
|
+
for (const id of ids) {
|
|
34
|
+
const children = source.children(id).filter((c) => idSet.has(c));
|
|
35
|
+
childMap.set(id, [...children]);
|
|
36
|
+
if (!parentMap.has(id))
|
|
37
|
+
parentMap.set(id, []);
|
|
38
|
+
for (const child of children) {
|
|
39
|
+
let parents = parentMap.get(child);
|
|
40
|
+
if (!parents) {
|
|
41
|
+
parents = [];
|
|
42
|
+
parentMap.set(child, parents);
|
|
43
|
+
}
|
|
44
|
+
parents.push(id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const idSet = new Set(source.map((n) => n.id));
|
|
50
|
+
for (const node of source) {
|
|
51
|
+
const children = (node.edges ?? []).filter((e) => idSet.has(e));
|
|
52
|
+
childMap.set(node.id, children);
|
|
53
|
+
if (!parentMap.has(node.id))
|
|
54
|
+
parentMap.set(node.id, []);
|
|
55
|
+
for (const child of children) {
|
|
56
|
+
let parents = parentMap.get(child);
|
|
57
|
+
if (!parents) {
|
|
58
|
+
parents = [];
|
|
59
|
+
parentMap.set(child, parents);
|
|
60
|
+
}
|
|
61
|
+
parents.push(node.id);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const roots = [];
|
|
66
|
+
for (const [id, parents] of parentMap) {
|
|
67
|
+
if (parents.length === 0)
|
|
68
|
+
roots.push(id);
|
|
69
|
+
}
|
|
70
|
+
// Also add any nodes that are in childMap but not parentMap (shouldn't happen, but safe)
|
|
71
|
+
for (const id of childMap.keys()) {
|
|
72
|
+
if (!parentMap.has(id))
|
|
73
|
+
roots.push(id);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
children: childMap,
|
|
77
|
+
parents: parentMap,
|
|
78
|
+
roots,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Internal: Highlight path computation
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
function computeHighlightPath(selectedId, adjacency) {
|
|
85
|
+
if (!selectedId)
|
|
86
|
+
return [];
|
|
87
|
+
// BFS upward from selected to find a root, then reverse
|
|
88
|
+
const visited = new Set();
|
|
89
|
+
const cameFrom = new Map();
|
|
90
|
+
const queue = [selectedId];
|
|
91
|
+
visited.add(selectedId);
|
|
92
|
+
let rootFound;
|
|
93
|
+
while (queue.length > 0) {
|
|
94
|
+
const current = queue.shift();
|
|
95
|
+
const parents = adjacency.parents.get(current) ?? [];
|
|
96
|
+
if (parents.length === 0) {
|
|
97
|
+
rootFound = current;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
for (const parent of parents) {
|
|
101
|
+
if (!visited.has(parent)) {
|
|
102
|
+
visited.add(parent);
|
|
103
|
+
cameFrom.set(parent, current);
|
|
104
|
+
queue.push(parent);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (rootFound === undefined) {
|
|
109
|
+
// Selected node is itself a root (or disconnected)
|
|
110
|
+
return [selectedId];
|
|
111
|
+
}
|
|
112
|
+
// Reconstruct path from root to selected
|
|
113
|
+
const path = [];
|
|
114
|
+
let cursor = rootFound;
|
|
115
|
+
while (cursor !== undefined) {
|
|
116
|
+
path.push(cursor);
|
|
117
|
+
if (cursor === selectedId)
|
|
118
|
+
break;
|
|
119
|
+
cursor = cameFrom.get(cursor);
|
|
120
|
+
}
|
|
121
|
+
// If we couldn't reach selectedId from the root, just return selected
|
|
122
|
+
if (path[path.length - 1] !== selectedId) {
|
|
123
|
+
return [selectedId];
|
|
124
|
+
}
|
|
125
|
+
return path;
|
|
126
|
+
}
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Internal: Spatial navigation helpers
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
function closestByCol(candidates, currentCenter, positions) {
|
|
131
|
+
let best;
|
|
132
|
+
let bestDist = Infinity;
|
|
133
|
+
for (const id of candidates) {
|
|
134
|
+
const pos = positions.get(id);
|
|
135
|
+
if (!pos)
|
|
136
|
+
continue;
|
|
137
|
+
const center = pos.col + pos.width / 2;
|
|
138
|
+
const dist = Math.abs(center - currentCenter);
|
|
139
|
+
if (dist < bestDist) {
|
|
140
|
+
bestDist = dist;
|
|
141
|
+
best = id;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return best;
|
|
145
|
+
}
|
|
146
|
+
function nodesOnSameRow(row, positions) {
|
|
147
|
+
const result = [];
|
|
148
|
+
for (const [id, pos] of positions) {
|
|
149
|
+
if (pos.row === row)
|
|
150
|
+
result.push(id);
|
|
151
|
+
}
|
|
152
|
+
return result.sort((a, b) => {
|
|
153
|
+
const pa = positions.get(a);
|
|
154
|
+
const pb = positions.get(b);
|
|
155
|
+
return pa.col - pb.col;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Internal: Auto-scroll to node
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
function scrollToNode(faState, nodePos) {
|
|
162
|
+
let scroll = faState.scroll;
|
|
163
|
+
// Vertical: ensure node box (row .. row+height) is within viewport
|
|
164
|
+
const nodeTop = nodePos.row;
|
|
165
|
+
const nodeBottom = nodePos.row + nodePos.height - 1;
|
|
166
|
+
const viewTop = scroll.y;
|
|
167
|
+
const viewBottom = scroll.y + faState.height - 1;
|
|
168
|
+
if (nodeTop < viewTop) {
|
|
169
|
+
scroll = scrollTo(scroll, nodeTop);
|
|
170
|
+
}
|
|
171
|
+
else if (nodeBottom > viewBottom) {
|
|
172
|
+
scroll = scrollTo(scroll, nodeBottom - faState.height + 1);
|
|
173
|
+
}
|
|
174
|
+
// Horizontal: ensure node box (col .. col+width) is within viewport
|
|
175
|
+
if (faState.overflowX === 'scroll') {
|
|
176
|
+
const contentWidth = Math.max(1, faState.width - 1); // minus gutter
|
|
177
|
+
const nodeLeft = nodePos.col;
|
|
178
|
+
const nodeRight = nodePos.col + nodePos.width - 1;
|
|
179
|
+
const viewLeft = scroll.x;
|
|
180
|
+
const viewRight = scroll.x + contentWidth - 1;
|
|
181
|
+
if (nodeLeft < viewLeft) {
|
|
182
|
+
scroll = scrollToX(scroll, nodeLeft);
|
|
183
|
+
}
|
|
184
|
+
else if (nodeRight > viewRight) {
|
|
185
|
+
scroll = scrollToX(scroll, nodeRight - contentWidth + 1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { ...faState, scroll };
|
|
189
|
+
}
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// Internal: Selection update
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
function renderLayout(source, selectedId, highlightPath, dagOptions, ctx) {
|
|
194
|
+
const opts = {
|
|
195
|
+
...dagOptions,
|
|
196
|
+
selectedId,
|
|
197
|
+
highlightPath: highlightPath.length > 0 ? [...highlightPath] : undefined,
|
|
198
|
+
ctx,
|
|
199
|
+
};
|
|
200
|
+
// Type narrowing required — dagLayout has separate overloads for
|
|
201
|
+
// DagNode[] and SlicedDagSource; a union won't resolve either overload.
|
|
202
|
+
return isSlicedDagSource(source)
|
|
203
|
+
? dagLayout(source, opts)
|
|
204
|
+
: dagLayout(source, opts);
|
|
205
|
+
}
|
|
206
|
+
function updateSelection(state, newId, adjacency, ctx) {
|
|
207
|
+
const highlightPath = computeHighlightPath(newId, adjacency);
|
|
208
|
+
const layout = renderLayout(state.source, newId, highlightPath, state.dagOptions, ctx);
|
|
209
|
+
let fa = focusAreaSetContent(state.focusArea, layout.output);
|
|
210
|
+
// Auto-scroll to selected node
|
|
211
|
+
if (newId) {
|
|
212
|
+
const nodePos = layout.nodes.get(newId);
|
|
213
|
+
if (nodePos) {
|
|
214
|
+
fa = scrollToNode(fa, nodePos);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
...state,
|
|
219
|
+
selectedId: newId,
|
|
220
|
+
highlightPath,
|
|
221
|
+
layout,
|
|
222
|
+
focusArea: fa,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// State creation
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
/**
|
|
229
|
+
* Create initial DAG pane state for the given source and dimensions.
|
|
230
|
+
*
|
|
231
|
+
* @param options - Source, dimensions, and rendering options.
|
|
232
|
+
* @returns Fresh DAG pane state.
|
|
233
|
+
*/
|
|
234
|
+
export function createDagPaneState(options) {
|
|
235
|
+
const { source, width, height, selectedId, overflowX = 'scroll', dagOptions = {}, ctx, } = options;
|
|
236
|
+
const adjacency = buildAdjacency(source);
|
|
237
|
+
// Validate selectedId — fall back to no selection if not in the source
|
|
238
|
+
const validatedId = selectedId !== undefined && adjacency.children.has(selectedId) ? selectedId : undefined;
|
|
239
|
+
const highlightPath = computeHighlightPath(validatedId, adjacency);
|
|
240
|
+
const layout = renderLayout(source, validatedId, highlightPath, dagOptions, ctx);
|
|
241
|
+
const fa = createFocusAreaState({
|
|
242
|
+
content: layout.output,
|
|
243
|
+
width,
|
|
244
|
+
height,
|
|
245
|
+
overflowX,
|
|
246
|
+
});
|
|
247
|
+
// Auto-scroll to initial selection
|
|
248
|
+
let finalFa = fa;
|
|
249
|
+
if (validatedId) {
|
|
250
|
+
const nodePos = layout.nodes.get(validatedId);
|
|
251
|
+
if (nodePos) {
|
|
252
|
+
finalFa = scrollToNode(fa, nodePos);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
source,
|
|
257
|
+
selectedId: validatedId,
|
|
258
|
+
layout,
|
|
259
|
+
highlightPath,
|
|
260
|
+
focusArea: finalFa,
|
|
261
|
+
dagOptions,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
// ---------------------------------------------------------------------------
|
|
265
|
+
// Navigation transformers
|
|
266
|
+
// ---------------------------------------------------------------------------
|
|
267
|
+
/**
|
|
268
|
+
* Select a child node (arrow down).
|
|
269
|
+
* If nothing is selected, auto-selects the first root node.
|
|
270
|
+
*
|
|
271
|
+
* @param state - Current DAG pane state.
|
|
272
|
+
* @param ctx - Bijou context for re-rendering.
|
|
273
|
+
* @returns Updated state with new selection.
|
|
274
|
+
*/
|
|
275
|
+
export function dagPaneSelectChild(state, ctx) {
|
|
276
|
+
const adjacency = buildAdjacency(state.source);
|
|
277
|
+
if (!state.selectedId) {
|
|
278
|
+
const firstRoot = adjacency.roots[0];
|
|
279
|
+
return firstRoot ? updateSelection(state, firstRoot, adjacency, ctx) : state;
|
|
280
|
+
}
|
|
281
|
+
const children = adjacency.children.get(state.selectedId) ?? [];
|
|
282
|
+
if (children.length === 0)
|
|
283
|
+
return state;
|
|
284
|
+
const currentPos = state.layout.nodes.get(state.selectedId);
|
|
285
|
+
const currentCenter = currentPos ? currentPos.col + currentPos.width / 2 : 0;
|
|
286
|
+
const target = closestByCol(children, currentCenter, state.layout.nodes);
|
|
287
|
+
return target ? updateSelection(state, target, adjacency, ctx) : state;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Select a parent node (arrow up).
|
|
291
|
+
* If nothing is selected, auto-selects the first root node.
|
|
292
|
+
*
|
|
293
|
+
* @param state - Current DAG pane state.
|
|
294
|
+
* @param ctx - Bijou context for re-rendering.
|
|
295
|
+
* @returns Updated state with new selection.
|
|
296
|
+
*/
|
|
297
|
+
export function dagPaneSelectParent(state, ctx) {
|
|
298
|
+
const adjacency = buildAdjacency(state.source);
|
|
299
|
+
if (!state.selectedId) {
|
|
300
|
+
const firstRoot = adjacency.roots[0];
|
|
301
|
+
return firstRoot ? updateSelection(state, firstRoot, adjacency, ctx) : state;
|
|
302
|
+
}
|
|
303
|
+
const parents = adjacency.parents.get(state.selectedId) ?? [];
|
|
304
|
+
if (parents.length === 0)
|
|
305
|
+
return state;
|
|
306
|
+
const currentPos = state.layout.nodes.get(state.selectedId);
|
|
307
|
+
const currentCenter = currentPos ? currentPos.col + currentPos.width / 2 : 0;
|
|
308
|
+
const target = closestByCol(parents, currentCenter, state.layout.nodes);
|
|
309
|
+
return target ? updateSelection(state, target, adjacency, ctx) : state;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Select the sibling node to the left in the same layer.
|
|
313
|
+
* If nothing is selected, auto-selects the first root node.
|
|
314
|
+
*
|
|
315
|
+
* @param state - Current DAG pane state.
|
|
316
|
+
* @param ctx - Bijou context for re-rendering.
|
|
317
|
+
* @returns Updated state with new selection.
|
|
318
|
+
*/
|
|
319
|
+
export function dagPaneSelectLeft(state, ctx) {
|
|
320
|
+
const adjacency = buildAdjacency(state.source);
|
|
321
|
+
if (!state.selectedId) {
|
|
322
|
+
const firstRoot = adjacency.roots[0];
|
|
323
|
+
return firstRoot ? updateSelection(state, firstRoot, adjacency, ctx) : state;
|
|
324
|
+
}
|
|
325
|
+
const currentPos = state.layout.nodes.get(state.selectedId);
|
|
326
|
+
if (!currentPos)
|
|
327
|
+
return state;
|
|
328
|
+
const siblings = nodesOnSameRow(currentPos.row, state.layout.nodes);
|
|
329
|
+
const idx = siblings.indexOf(state.selectedId);
|
|
330
|
+
if (idx <= 0)
|
|
331
|
+
return state; // already leftmost
|
|
332
|
+
return updateSelection(state, siblings[idx - 1], adjacency, ctx);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Select the sibling node to the right in the same layer.
|
|
336
|
+
* If nothing is selected, auto-selects the first root node.
|
|
337
|
+
*
|
|
338
|
+
* @param state - Current DAG pane state.
|
|
339
|
+
* @param ctx - Bijou context for re-rendering.
|
|
340
|
+
* @returns Updated state with new selection.
|
|
341
|
+
*/
|
|
342
|
+
export function dagPaneSelectRight(state, ctx) {
|
|
343
|
+
const adjacency = buildAdjacency(state.source);
|
|
344
|
+
if (!state.selectedId) {
|
|
345
|
+
const firstRoot = adjacency.roots[0];
|
|
346
|
+
return firstRoot ? updateSelection(state, firstRoot, adjacency, ctx) : state;
|
|
347
|
+
}
|
|
348
|
+
const currentPos = state.layout.nodes.get(state.selectedId);
|
|
349
|
+
if (!currentPos)
|
|
350
|
+
return state;
|
|
351
|
+
const siblings = nodesOnSameRow(currentPos.row, state.layout.nodes);
|
|
352
|
+
const idx = siblings.indexOf(state.selectedId);
|
|
353
|
+
if (idx < 0 || idx >= siblings.length - 1)
|
|
354
|
+
return state; // already rightmost
|
|
355
|
+
return updateSelection(state, siblings[idx + 1], adjacency, ctx);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Select a specific node by ID.
|
|
359
|
+
* If the ID is not found in the layout, returns state unchanged (no selection).
|
|
360
|
+
*
|
|
361
|
+
* @param state - Current DAG pane state.
|
|
362
|
+
* @param nodeId - ID of the node to select.
|
|
363
|
+
* @param ctx - Bijou context for re-rendering.
|
|
364
|
+
* @returns Updated state with new selection.
|
|
365
|
+
*/
|
|
366
|
+
export function dagPaneSelectNode(state, nodeId, ctx) {
|
|
367
|
+
if (!state.layout.nodes.has(nodeId)) {
|
|
368
|
+
return state;
|
|
369
|
+
}
|
|
370
|
+
const adjacency = buildAdjacency(state.source);
|
|
371
|
+
return updateSelection(state, nodeId, adjacency, ctx);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Clear the current selection.
|
|
375
|
+
*
|
|
376
|
+
* @param state - Current DAG pane state.
|
|
377
|
+
* @param ctx - Bijou context for re-rendering.
|
|
378
|
+
* @returns Updated state with no selection.
|
|
379
|
+
*/
|
|
380
|
+
export function dagPaneClearSelection(state, ctx) {
|
|
381
|
+
const adjacency = buildAdjacency(state.source);
|
|
382
|
+
return updateSelection(state, undefined, adjacency, ctx);
|
|
383
|
+
}
|
|
384
|
+
// ---------------------------------------------------------------------------
|
|
385
|
+
// Scroll transformers
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
/**
|
|
388
|
+
* Scroll vertically by a relative amount.
|
|
389
|
+
*
|
|
390
|
+
* @param state - Current DAG pane state.
|
|
391
|
+
* @param dy - Relative vertical offset (positive = down).
|
|
392
|
+
* @returns Updated state.
|
|
393
|
+
*/
|
|
394
|
+
export function dagPaneScrollBy(state, dy) {
|
|
395
|
+
return { ...state, focusArea: focusAreaScrollBy(state.focusArea, dy) };
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Scroll to the top.
|
|
399
|
+
*
|
|
400
|
+
* @param state - Current DAG pane state.
|
|
401
|
+
* @returns Updated state.
|
|
402
|
+
*/
|
|
403
|
+
export function dagPaneScrollToTop(state) {
|
|
404
|
+
return { ...state, focusArea: focusAreaScrollToTop(state.focusArea) };
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Scroll to the bottom.
|
|
408
|
+
*
|
|
409
|
+
* @param state - Current DAG pane state.
|
|
410
|
+
* @returns Updated state.
|
|
411
|
+
*/
|
|
412
|
+
export function dagPaneScrollToBottom(state) {
|
|
413
|
+
return { ...state, focusArea: focusAreaScrollToBottom(state.focusArea) };
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Page down.
|
|
417
|
+
*
|
|
418
|
+
* @param state - Current DAG pane state.
|
|
419
|
+
* @returns Updated state.
|
|
420
|
+
*/
|
|
421
|
+
export function dagPanePageDown(state) {
|
|
422
|
+
return { ...state, focusArea: focusAreaPageDown(state.focusArea) };
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Page up.
|
|
426
|
+
*
|
|
427
|
+
* @param state - Current DAG pane state.
|
|
428
|
+
* @returns Updated state.
|
|
429
|
+
*/
|
|
430
|
+
export function dagPanePageUp(state) {
|
|
431
|
+
return { ...state, focusArea: focusAreaPageUp(state.focusArea) };
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Scroll horizontally by a relative amount.
|
|
435
|
+
*
|
|
436
|
+
* @param state - Current DAG pane state.
|
|
437
|
+
* @param dx - Relative horizontal offset (positive = right).
|
|
438
|
+
* @returns Updated state.
|
|
439
|
+
*/
|
|
440
|
+
export function dagPaneScrollByX(state, dx) {
|
|
441
|
+
return { ...state, focusArea: focusAreaScrollByX(state.focusArea, dx) };
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Replace the graph source and re-render. Clears selection.
|
|
445
|
+
*
|
|
446
|
+
* @param state - Current DAG pane state.
|
|
447
|
+
* @param source - New graph data source.
|
|
448
|
+
* @param ctx - Bijou context for re-rendering.
|
|
449
|
+
* @returns Updated state with new source and cleared selection.
|
|
450
|
+
*/
|
|
451
|
+
export function dagPaneSetSource(state, source, ctx) {
|
|
452
|
+
const highlightPath = [];
|
|
453
|
+
const layout = renderLayout(source, undefined, highlightPath, state.dagOptions, ctx);
|
|
454
|
+
const fa = focusAreaSetContent(state.focusArea, layout.output);
|
|
455
|
+
return {
|
|
456
|
+
...state,
|
|
457
|
+
source,
|
|
458
|
+
selectedId: undefined,
|
|
459
|
+
highlightPath,
|
|
460
|
+
layout,
|
|
461
|
+
focusArea: fa,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
// ---------------------------------------------------------------------------
|
|
465
|
+
// Render
|
|
466
|
+
// ---------------------------------------------------------------------------
|
|
467
|
+
/**
|
|
468
|
+
* Render the DAG pane — focus area wrapping the DAG layout output.
|
|
469
|
+
*
|
|
470
|
+
* @param state - Current DAG pane state.
|
|
471
|
+
* @param options - Rendering options (focus, tokens, scrollbar, ctx).
|
|
472
|
+
* @returns Rendered DAG pane string.
|
|
473
|
+
*/
|
|
474
|
+
export function dagPane(state, options) {
|
|
475
|
+
return focusArea(state.focusArea, options);
|
|
476
|
+
}
|
|
477
|
+
// ---------------------------------------------------------------------------
|
|
478
|
+
// Convenience keymap
|
|
479
|
+
// ---------------------------------------------------------------------------
|
|
480
|
+
/**
|
|
481
|
+
* Create a preconfigured KeyMap for DAG pane interaction.
|
|
482
|
+
*
|
|
483
|
+
* Arrow keys are bound to node selection. Vim keys (j/k/h/l) are bound
|
|
484
|
+
* to scroll. `Enter` confirms, `q`/`Ctrl+C` quits.
|
|
485
|
+
*
|
|
486
|
+
* @template Msg - Application message type dispatched by key bindings.
|
|
487
|
+
* @param actions - Map of actions to message values.
|
|
488
|
+
* @returns Preconfigured key map with DAG pane bindings.
|
|
489
|
+
*/
|
|
490
|
+
export function dagPaneKeyMap(actions) {
|
|
491
|
+
return createKeyMap()
|
|
492
|
+
.group('Selection', (g) => g
|
|
493
|
+
.bind('up', 'Select parent', actions.selectParent)
|
|
494
|
+
.bind('down', 'Select child', actions.selectChild)
|
|
495
|
+
.bind('left', 'Select left', actions.selectLeft)
|
|
496
|
+
.bind('right', 'Select right', actions.selectRight))
|
|
497
|
+
.group('Scroll', (g) => g
|
|
498
|
+
.bind('j', 'Down', actions.scrollDown)
|
|
499
|
+
.bind('k', 'Up', actions.scrollUp)
|
|
500
|
+
.bind('h', 'Scroll left', actions.scrollLeft)
|
|
501
|
+
.bind('l', 'Scroll right', actions.scrollRight)
|
|
502
|
+
.bind('d', 'Page down', actions.pageDown)
|
|
503
|
+
.bind('u', 'Page up', actions.pageUp)
|
|
504
|
+
.bind('g', 'Top', actions.top)
|
|
505
|
+
.bind('shift+g', 'Bottom', actions.bottom))
|
|
506
|
+
.bind('enter', 'Confirm', actions.confirm)
|
|
507
|
+
.bind('q', 'Quit', actions.quit)
|
|
508
|
+
.bind('ctrl+c', 'Quit', actions.quit);
|
|
509
|
+
}
|
|
510
|
+
//# sourceMappingURL=dag-pane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dag-pane.js","sourceRoot":"","sources":["../src/dag-pane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBA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Ac,EAAE,OAAO,CAAC,WAAW,CAAC;SACjD,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC;SAC/C,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CACpD;SACA,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACtB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC;SACrC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;SACjC,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC;SAC5C,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC;SAC9C,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC;SACxC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC;SACpC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;SAC7B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAC3C;SACA,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC;SACzC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;SAC/B,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/driver.d.ts
CHANGED
|
@@ -16,16 +16,23 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
import type { App, RunOptions } from './types.js';
|
|
19
|
+
/** A single step in a scripted key sequence. */
|
|
19
20
|
export interface ScriptStep {
|
|
20
21
|
/** Key to send (raw terminal key string, e.g., 'a', '\x1b[A', '\x03'). */
|
|
21
22
|
key: string;
|
|
22
23
|
/** Milliseconds to wait before sending this key. Default: 0. */
|
|
23
24
|
delay?: number;
|
|
24
25
|
}
|
|
26
|
+
/** Options for {@link runScript}, extending the base {@link RunOptions}. */
|
|
25
27
|
export interface RunScriptOptions extends RunOptions {
|
|
26
28
|
/** Capture each rendered frame. */
|
|
27
29
|
onFrame?: (frame: string, index: number) => void;
|
|
28
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Result returned by {@link runScript} after all steps have been processed.
|
|
33
|
+
*
|
|
34
|
+
* @template Model - The application model type.
|
|
35
|
+
*/
|
|
29
36
|
export interface RunScriptResult<Model> {
|
|
30
37
|
/** Final model state after all steps. */
|
|
31
38
|
model: Model;
|
|
@@ -50,6 +57,13 @@ export interface RunScriptResult<Model> {
|
|
|
50
57
|
* Commands that use `setTimeout`, real I/O, or other macrotask-based async
|
|
51
58
|
* may not have completed before the next key is dispatched. Use `delay`
|
|
52
59
|
* on subsequent steps to allow time for macrotask-based commands.
|
|
60
|
+
*
|
|
61
|
+
* @template Model - The application model type.
|
|
62
|
+
* @template M - The message (action) type for the TEA update cycle.
|
|
63
|
+
* @param app - The TEA application definition (init, update, view).
|
|
64
|
+
* @param steps - Ordered key events to feed into the app.
|
|
65
|
+
* @param options - Optional callbacks and runtime configuration.
|
|
66
|
+
* @returns The final model, all rendered frames, and elapsed time.
|
|
53
67
|
*/
|
|
54
68
|
export declare function runScript<Model, M>(app: App<Model, M>, steps: ScriptStep[], options?: RunScriptOptions): Promise<RunScriptResult<Model>>;
|
|
55
69
|
//# sourceMappingURL=driver.d.ts.map
|
package/dist/driver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQlD,MAAM,WAA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,KAAK,EAAE,CAAC,CAAC,EAClB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAqEjC"}
|
package/dist/driver.js
CHANGED
|
@@ -36,6 +36,13 @@ import { parseKey } from './keys.js';
|
|
|
36
36
|
* Commands that use `setTimeout`, real I/O, or other macrotask-based async
|
|
37
37
|
* may not have completed before the next key is dispatched. Use `delay`
|
|
38
38
|
* on subsequent steps to allow time for macrotask-based commands.
|
|
39
|
+
*
|
|
40
|
+
* @template Model - The application model type.
|
|
41
|
+
* @template M - The message (action) type for the TEA update cycle.
|
|
42
|
+
* @param app - The TEA application definition (init, update, view).
|
|
43
|
+
* @param steps - Ordered key events to feed into the app.
|
|
44
|
+
* @param options - Optional callbacks and runtime configuration.
|
|
45
|
+
* @returns The final model, all rendered frames, and elapsed time.
|
|
39
46
|
*/
|
|
40
47
|
export async function runScript(app, steps, options) {
|
|
41
48
|
const start = Date.now();
|
package/dist/driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAkCrC,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAkB,EAClB,KAAmB,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