@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/keybindings.d.ts
CHANGED
|
@@ -24,60 +24,152 @@ import type { KeyMsg } from './types.js';
|
|
|
24
24
|
import type { InputHandler } from './inputstack.js';
|
|
25
25
|
/** A parsed key descriptor: the key name + modifier flags. */
|
|
26
26
|
export interface KeyCombo {
|
|
27
|
+
/** Key name (e.g. `"q"`, `"enter"`, `"tab"`). */
|
|
27
28
|
readonly key: string;
|
|
29
|
+
/** Whether the Ctrl modifier is required. */
|
|
28
30
|
readonly ctrl: boolean;
|
|
31
|
+
/** Whether the Alt modifier is required. */
|
|
29
32
|
readonly alt: boolean;
|
|
33
|
+
/** Whether the Shift modifier is required. */
|
|
30
34
|
readonly shift: boolean;
|
|
31
35
|
}
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* A single registered binding associating a key combo with an action.
|
|
38
|
+
*
|
|
39
|
+
* @template A - Action type returned when this binding matches.
|
|
40
|
+
*/
|
|
33
41
|
export interface Binding<A> {
|
|
42
|
+
/** Key combination that triggers this binding. */
|
|
34
43
|
readonly combo: KeyCombo;
|
|
44
|
+
/** Human-readable description for help text. */
|
|
35
45
|
readonly description: string;
|
|
46
|
+
/** Group name this binding belongs to (empty string if ungrouped). */
|
|
36
47
|
readonly group: string;
|
|
48
|
+
/** Action to return when this binding matches. */
|
|
37
49
|
readonly action: A;
|
|
50
|
+
/** Whether this binding is currently active. */
|
|
38
51
|
enabled: boolean;
|
|
39
52
|
}
|
|
40
|
-
/** Read-only view of a binding for help generation. */
|
|
53
|
+
/** Read-only view of a binding for help generation and introspection. */
|
|
41
54
|
export interface BindingInfo {
|
|
55
|
+
/** Key combination that triggers this binding. */
|
|
42
56
|
readonly combo: KeyCombo;
|
|
57
|
+
/** Human-readable description for help text. */
|
|
43
58
|
readonly description: string;
|
|
59
|
+
/** Group name this binding belongs to. */
|
|
44
60
|
readonly group: string;
|
|
61
|
+
/** Whether this binding is currently active. */
|
|
45
62
|
readonly enabled: boolean;
|
|
46
63
|
}
|
|
47
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The keybinding manager.
|
|
66
|
+
*
|
|
67
|
+
* Provide a fluent API for registering key bindings, matching incoming
|
|
68
|
+
* key events, and managing binding state at runtime.
|
|
69
|
+
*
|
|
70
|
+
* @template A - Action type returned when a binding matches.
|
|
71
|
+
*/
|
|
48
72
|
export interface KeyMap<A> extends InputHandler<KeyMsg, A> {
|
|
49
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Register a binding. `key` is a descriptor like `"q"`, `"ctrl+c"`, `"shift+tab"`.
|
|
75
|
+
*
|
|
76
|
+
* @param key - Key descriptor string.
|
|
77
|
+
* @param description - Human-readable description for help text.
|
|
78
|
+
* @param action - Action to return when this binding matches.
|
|
79
|
+
* @returns This key map for chaining.
|
|
80
|
+
*/
|
|
50
81
|
bind(key: string, description: string, action: A): KeyMap<A>;
|
|
51
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Register bindings under a named group.
|
|
84
|
+
*
|
|
85
|
+
* @param name - Group name for categorizing bindings.
|
|
86
|
+
* @param fn - Builder callback receiving a scoped group builder.
|
|
87
|
+
* @returns This key map for chaining.
|
|
88
|
+
*/
|
|
52
89
|
group(name: string, fn: (g: KeyMapGroup<A>) => KeyMapGroup<A>): KeyMap<A>;
|
|
53
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Match a {@link KeyMsg} and return its action, or `undefined` if no match.
|
|
92
|
+
*
|
|
93
|
+
* @param msg - Incoming key message to match against registered bindings.
|
|
94
|
+
* @returns The matched action, or `undefined` if no enabled binding matches.
|
|
95
|
+
*/
|
|
54
96
|
handle(msg: KeyMsg): A | undefined;
|
|
55
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Enable bindings whose description matches the predicate.
|
|
99
|
+
*
|
|
100
|
+
* @param predicate - Description string for exact match, or a filter function.
|
|
101
|
+
*/
|
|
56
102
|
enable(predicate: string | ((b: BindingInfo) => boolean)): void;
|
|
57
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Disable bindings whose description matches the predicate.
|
|
105
|
+
*
|
|
106
|
+
* @param predicate - Description string for exact match, or a filter function.
|
|
107
|
+
*/
|
|
58
108
|
disable(predicate: string | ((b: BindingInfo) => boolean)): void;
|
|
59
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Enable all bindings in a group.
|
|
111
|
+
*
|
|
112
|
+
* @param group - Group name to enable.
|
|
113
|
+
*/
|
|
60
114
|
enableGroup(group: string): void;
|
|
61
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Disable all bindings in a group.
|
|
117
|
+
*
|
|
118
|
+
* @param group - Group name to disable.
|
|
119
|
+
*/
|
|
62
120
|
disableGroup(group: string): void;
|
|
63
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* Return a snapshot of all bindings for help generation.
|
|
123
|
+
*
|
|
124
|
+
* @returns Read-only array of binding info objects.
|
|
125
|
+
*/
|
|
64
126
|
bindings(): readonly BindingInfo[];
|
|
65
127
|
}
|
|
66
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Group builder — same as KeyMap but scoped to a group name.
|
|
130
|
+
*
|
|
131
|
+
* @template A - Action type returned when a binding matches.
|
|
132
|
+
*/
|
|
67
133
|
export interface KeyMapGroup<A> {
|
|
134
|
+
/**
|
|
135
|
+
* Register a binding within this group.
|
|
136
|
+
*
|
|
137
|
+
* @param key - Key descriptor string (e.g. `"j"`, `"ctrl+c"`).
|
|
138
|
+
* @param description - Human-readable description for help text.
|
|
139
|
+
* @param action - Action to return when this binding matches.
|
|
140
|
+
* @returns This group builder for chaining.
|
|
141
|
+
*/
|
|
68
142
|
bind(key: string, description: string, action: A): KeyMapGroup<A>;
|
|
69
143
|
}
|
|
70
144
|
/**
|
|
71
|
-
* Parse a key descriptor string into a KeyCombo.
|
|
145
|
+
* Parse a key descriptor string into a {@link KeyCombo}.
|
|
72
146
|
*
|
|
73
147
|
* Examples: `"q"`, `"ctrl+c"`, `"alt+shift+tab"`, `"enter"`, `"space"`
|
|
148
|
+
*
|
|
149
|
+
* @param descriptor - Key descriptor string with optional modifier prefixes.
|
|
150
|
+
* @returns Parsed key combo with key name and modifier flags.
|
|
151
|
+
* @throws {Error} If a modifier is duplicated, unknown, or the key part is empty.
|
|
74
152
|
*/
|
|
75
153
|
export declare function parseKeyCombo(descriptor: string): KeyCombo;
|
|
76
154
|
/**
|
|
77
|
-
* Format a KeyCombo back into a human-readable string.
|
|
155
|
+
* Format a {@link KeyCombo} back into a human-readable string.
|
|
78
156
|
*
|
|
157
|
+
* Capitalize modifier names and multi-character key names.
|
|
79
158
|
* Examples: `"Ctrl+c"`, `"q"`, `"Shift+Tab"`
|
|
159
|
+
*
|
|
160
|
+
* @param combo - Key combo to format.
|
|
161
|
+
* @returns Human-readable key string.
|
|
80
162
|
*/
|
|
81
163
|
export declare function formatKeyCombo(combo: KeyCombo): string;
|
|
164
|
+
/**
|
|
165
|
+
* Create a new keybinding manager.
|
|
166
|
+
*
|
|
167
|
+
* Return a fluent {@link KeyMap} that registers key bindings, matches
|
|
168
|
+
* incoming {@link KeyMsg} events, and supports runtime enable/disable
|
|
169
|
+
* of individual bindings or groups.
|
|
170
|
+
*
|
|
171
|
+
* @template A - Action type returned when a binding matches.
|
|
172
|
+
* @returns A new empty key map.
|
|
173
|
+
*/
|
|
82
174
|
export declare function createKeyMap<A>(): KeyMap<A>;
|
|
83
175
|
//# sourceMappingURL=keybindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,8DAA8D;AAC9D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,8DAA8D;AAC9D,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,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;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;;OAIG;IACH,QAAQ,IAAI,SAAS,WAAW,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;;;;;;;OAOG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;CACnE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAiC1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAatD;AA6BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CA4F3C"}
|
package/dist/keybindings.js
CHANGED
|
@@ -24,9 +24,13 @@
|
|
|
24
24
|
// Key descriptor parsing
|
|
25
25
|
// ---------------------------------------------------------------------------
|
|
26
26
|
/**
|
|
27
|
-
* Parse a key descriptor string into a KeyCombo.
|
|
27
|
+
* Parse a key descriptor string into a {@link KeyCombo}.
|
|
28
28
|
*
|
|
29
29
|
* Examples: `"q"`, `"ctrl+c"`, `"alt+shift+tab"`, `"enter"`, `"space"`
|
|
30
|
+
*
|
|
31
|
+
* @param descriptor - Key descriptor string with optional modifier prefixes.
|
|
32
|
+
* @returns Parsed key combo with key name and modifier flags.
|
|
33
|
+
* @throws {Error} If a modifier is duplicated, unknown, or the key part is empty.
|
|
30
34
|
*/
|
|
31
35
|
export function parseKeyCombo(descriptor) {
|
|
32
36
|
// Lowercase the entire descriptor for consistency with parseKey(), which always
|
|
@@ -65,9 +69,13 @@ export function parseKeyCombo(descriptor) {
|
|
|
65
69
|
return { key, ctrl, alt, shift };
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
68
|
-
* Format a KeyCombo back into a human-readable string.
|
|
72
|
+
* Format a {@link KeyCombo} back into a human-readable string.
|
|
69
73
|
*
|
|
74
|
+
* Capitalize modifier names and multi-character key names.
|
|
70
75
|
* Examples: `"Ctrl+c"`, `"q"`, `"Shift+Tab"`
|
|
76
|
+
*
|
|
77
|
+
* @param combo - Key combo to format.
|
|
78
|
+
* @returns Human-readable key string.
|
|
71
79
|
*/
|
|
72
80
|
export function formatKeyCombo(combo) {
|
|
73
81
|
const parts = [];
|
|
@@ -87,6 +95,13 @@ export function formatKeyCombo(combo) {
|
|
|
87
95
|
// ---------------------------------------------------------------------------
|
|
88
96
|
// Matching
|
|
89
97
|
// ---------------------------------------------------------------------------
|
|
98
|
+
/**
|
|
99
|
+
* Test whether a key combo matches a key message exactly.
|
|
100
|
+
*
|
|
101
|
+
* @param combo - Registered key combo to match against.
|
|
102
|
+
* @param msg - Incoming key message from the terminal.
|
|
103
|
+
* @returns `true` if all key name and modifier flags match.
|
|
104
|
+
*/
|
|
90
105
|
function matches(combo, msg) {
|
|
91
106
|
return (combo.key === msg.key &&
|
|
92
107
|
combo.ctrl === msg.ctrl &&
|
|
@@ -96,7 +111,18 @@ function matches(combo, msg) {
|
|
|
96
111
|
// ---------------------------------------------------------------------------
|
|
97
112
|
// Implementation
|
|
98
113
|
// ---------------------------------------------------------------------------
|
|
114
|
+
/** Group name used for bindings registered outside any named group. */
|
|
99
115
|
const DEFAULT_GROUP = '';
|
|
116
|
+
/**
|
|
117
|
+
* Create a new keybinding manager.
|
|
118
|
+
*
|
|
119
|
+
* Return a fluent {@link KeyMap} that registers key bindings, matches
|
|
120
|
+
* incoming {@link KeyMsg} events, and supports runtime enable/disable
|
|
121
|
+
* of individual bindings or groups.
|
|
122
|
+
*
|
|
123
|
+
* @template A - Action type returned when a binding matches.
|
|
124
|
+
* @returns A new empty key map.
|
|
125
|
+
*/
|
|
100
126
|
export function createKeyMap() {
|
|
101
127
|
const allBindings = [];
|
|
102
128
|
let currentGroup = DEFAULT_GROUP;
|
package/dist/keybindings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA4IH,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,gFAAgF;IAChF,yEAAyE;IACzE,0DAA0D;IAC1D,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,IAAI,KAAK,GAAG,KAAK,CAAC;IAElB,0CAA0C;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YACnB,IAAI,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,UAAU,GAAG,CAAC,CAAC;YACzF,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;YACzB,IAAI,GAAG;gBAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,UAAU,GAAG,CAAC,CAAC;YACvF,GAAG,GAAG,IAAI,CAAC;QACb,CAAC;aAAM,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;YAC3B,IAAI,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,i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AC,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3C,CAAC;QACH,CAAC;QAED,QAAQ;YACN,8EAA8E;YAC9E,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC7B,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC,CAAC;QACN,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/keys.d.ts
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard and mouse input parsing for raw ANSI/SGR terminal sequences.
|
|
3
|
+
*
|
|
4
|
+
* Convert raw byte strings from stdin into structured {@link KeyMsg} and
|
|
5
|
+
* {@link MouseMsg} objects for use in the TEA update loop.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
1
9
|
import type { KeyMsg, MouseMsg } from './types.js';
|
|
2
10
|
/**
|
|
3
|
-
* Parse a raw ANSI byte string from rawInput() into a structured KeyMsg.
|
|
4
|
-
*
|
|
11
|
+
* Parse a raw ANSI byte string from `rawInput()` into a structured {@link KeyMsg}.
|
|
12
|
+
*
|
|
13
|
+
* Handle arrow keys, function keys, enter, tab, backspace, space, escape,
|
|
14
|
+
* Ctrl+A through Ctrl+Z, and printable ASCII characters. Unrecognized
|
|
15
|
+
* sequences produce `{ key: 'unknown' }`.
|
|
16
|
+
*
|
|
17
|
+
* @param raw - Raw byte string from terminal stdin.
|
|
18
|
+
* @returns Parsed key message.
|
|
5
19
|
*/
|
|
6
20
|
export declare function parseKey(raw: string): KeyMsg;
|
|
7
21
|
/**
|
|
8
|
-
* Parse an SGR extended mouse sequence into a MouseMsg.
|
|
9
|
-
*
|
|
22
|
+
* Parse an SGR extended mouse sequence into a {@link MouseMsg}.
|
|
23
|
+
*
|
|
24
|
+
* SGR format: `ESC [ < button ; col ; row M/m`
|
|
25
|
+
* - `M` = press, `m` = release
|
|
26
|
+
* - Button byte bits: 0-1 = button, 2 = shift, 3 = alt, 4 = ctrl, 5 = motion, 6-7 = scroll
|
|
27
|
+
* - Column and row are 1-based in the protocol, converted to 0-based here
|
|
10
28
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* - button byte bits: 0-1 = button, 2 = shift, 3 = alt, 4 = ctrl, 5 = motion, 6-7 = scroll
|
|
14
|
-
* - col/row are 1-based in the protocol, converted to 0-based here
|
|
29
|
+
* @param raw - Raw byte string that may contain an SGR mouse sequence.
|
|
30
|
+
* @returns Parsed mouse message, or `null` if the string is not a valid SGR mouse sequence.
|
|
15
31
|
*/
|
|
16
32
|
export declare function parseMouse(raw: string): MouseMsg | null;
|
|
17
33
|
//# sourceMappingURL=keys.d.ts.map
|
package/dist/keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAA4B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAA4B,MAAM,YAAY,CAAC;AAe7E;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA2C5C;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAqCvD"}
|
package/dist/keys.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard and mouse input parsing for raw ANSI/SGR terminal sequences.
|
|
3
|
+
*
|
|
4
|
+
* Convert raw byte strings from stdin into structured {@link KeyMsg} and
|
|
5
|
+
* {@link MouseMsg} objects for use in the TEA update loop.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a {@link KeyMsg} with the given key name and modifier flags.
|
|
11
|
+
*
|
|
12
|
+
* @param key - Key name (e.g. `"a"`, `"enter"`, `"up"`).
|
|
13
|
+
* @param ctrl - Whether the Ctrl modifier is active.
|
|
14
|
+
* @param alt - Whether the Alt modifier is active.
|
|
15
|
+
* @param shift - Whether the Shift modifier is active.
|
|
16
|
+
* @returns A new `KeyMsg`.
|
|
17
|
+
*/
|
|
1
18
|
function keyMsg(key, ctrl = false, alt = false, shift = false) {
|
|
2
19
|
return { type: 'key', key, ctrl, alt, shift };
|
|
3
20
|
}
|
|
4
21
|
/**
|
|
5
|
-
* Parse a raw ANSI byte string from rawInput() into a structured KeyMsg.
|
|
6
|
-
*
|
|
22
|
+
* Parse a raw ANSI byte string from `rawInput()` into a structured {@link KeyMsg}.
|
|
23
|
+
*
|
|
24
|
+
* Handle arrow keys, function keys, enter, tab, backspace, space, escape,
|
|
25
|
+
* Ctrl+A through Ctrl+Z, and printable ASCII characters. Unrecognized
|
|
26
|
+
* sequences produce `{ key: 'unknown' }`.
|
|
27
|
+
*
|
|
28
|
+
* @param raw - Raw byte string from terminal stdin.
|
|
29
|
+
* @returns Parsed key message.
|
|
7
30
|
*/
|
|
8
31
|
export function parseKey(raw) {
|
|
9
32
|
// Arrow keys and other CSI sequences
|
|
@@ -59,16 +82,18 @@ export function parseKey(raw) {
|
|
|
59
82
|
}
|
|
60
83
|
return keyMsg('unknown');
|
|
61
84
|
}
|
|
62
|
-
|
|
85
|
+
/** Regular expression matching SGR extended mouse sequences: `ESC [ < button ; col ; row M/m`. */
|
|
63
86
|
const SGR_MOUSE_RE = /^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/;
|
|
64
87
|
/**
|
|
65
|
-
* Parse an SGR extended mouse sequence into a MouseMsg.
|
|
66
|
-
*
|
|
88
|
+
* Parse an SGR extended mouse sequence into a {@link MouseMsg}.
|
|
89
|
+
*
|
|
90
|
+
* SGR format: `ESC [ < button ; col ; row M/m`
|
|
91
|
+
* - `M` = press, `m` = release
|
|
92
|
+
* - Button byte bits: 0-1 = button, 2 = shift, 3 = alt, 4 = ctrl, 5 = motion, 6-7 = scroll
|
|
93
|
+
* - Column and row are 1-based in the protocol, converted to 0-based here
|
|
67
94
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* - button byte bits: 0-1 = button, 2 = shift, 3 = alt, 4 = ctrl, 5 = motion, 6-7 = scroll
|
|
71
|
-
* - col/row are 1-based in the protocol, converted to 0-based here
|
|
95
|
+
* @param raw - Raw byte string that may contain an SGR mouse sequence.
|
|
96
|
+
* @returns Parsed mouse message, or `null` if the string is not a valid SGR mouse sequence.
|
|
72
97
|
*/
|
|
73
98
|
export function parseMouse(raw) {
|
|
74
99
|
const match = SGR_MOUSE_RE.exec(raw);
|
package/dist/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,GAAW,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,EAAE,KAAK,GAAG,KAAK;IACnE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,qCAAqC;IACrC,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC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AAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,GAAG,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC"}
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,24 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout primitives for composing terminal UI views.
|
|
3
|
+
*
|
|
4
|
+
* Provides `place()` for positioning content within a fixed rectangle,
|
|
5
|
+
* and `vstack()`/`hstack()` for vertical and horizontal composition.
|
|
6
|
+
*
|
|
7
|
+
* @module layout
|
|
8
|
+
*/
|
|
9
|
+
/** Horizontal alignment option for {@link place}. */
|
|
1
10
|
export type HAlign = 'left' | 'center' | 'right';
|
|
11
|
+
/** Vertical alignment option for {@link place}. */
|
|
2
12
|
export type VAlign = 'top' | 'middle' | 'bottom';
|
|
13
|
+
/** Configuration for the {@link place} layout function. */
|
|
3
14
|
export interface PlaceOptions {
|
|
15
|
+
/** Width of the bounding rectangle in visible characters. */
|
|
4
16
|
readonly width: number;
|
|
17
|
+
/** Height of the bounding rectangle in lines. */
|
|
5
18
|
readonly height: number;
|
|
19
|
+
/** Horizontal alignment within the rectangle. Default: `'left'`. */
|
|
6
20
|
readonly hAlign?: HAlign;
|
|
21
|
+
/** Vertical alignment within the rectangle. Default: `'top'`. */
|
|
7
22
|
readonly vAlign?: VAlign;
|
|
8
23
|
}
|
|
9
24
|
/**
|
|
10
25
|
* Place content within a fixed-size rectangle, aligned horizontally and
|
|
11
26
|
* vertically. Lines are padded/clipped to exactly `width` visible characters
|
|
12
27
|
* and the output is exactly `height` lines tall.
|
|
28
|
+
*
|
|
29
|
+
* @param content - The text content to place (may contain newlines).
|
|
30
|
+
* @param options - Rectangle dimensions and alignment settings.
|
|
31
|
+
* @returns A string of exactly `height` lines, each exactly `width` visible characters.
|
|
13
32
|
*/
|
|
14
33
|
export declare function place(content: string, options: PlaceOptions): string;
|
|
15
34
|
/**
|
|
16
35
|
* Vertical stack — join blocks with newlines.
|
|
36
|
+
*
|
|
37
|
+
* @param blocks - One or more rendered string blocks to stack vertically.
|
|
38
|
+
* @returns A single string with blocks separated by newlines.
|
|
17
39
|
*/
|
|
18
40
|
export declare function vstack(...blocks: string[]): string;
|
|
19
41
|
/**
|
|
20
42
|
* Horizontal stack — place blocks side by side with a gap between columns.
|
|
21
43
|
* Pads shorter blocks with empty lines to align rows.
|
|
44
|
+
*
|
|
45
|
+
* @param gap - Number of space characters between adjacent columns.
|
|
46
|
+
* @param blocks - One or more rendered string blocks to stack horizontally.
|
|
47
|
+
* @returns A single string with blocks arranged side by side.
|
|
22
48
|
*/
|
|
23
49
|
export declare function hstack(gap: number, ...blocks: string[]): string;
|
|
24
50
|
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,qDAAqD;AACrD,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACjD,mDAAmD;AACnD,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjD,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAqEpE;AAMD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAElD;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAwB/D"}
|
package/dist/layout.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout primitives for composing terminal UI views.
|
|
3
|
+
*
|
|
4
|
+
* Provides `place()` for positioning content within a fixed rectangle,
|
|
5
|
+
* and `vstack()`/`hstack()` for vertical and horizontal composition.
|
|
6
|
+
*
|
|
7
|
+
* @module layout
|
|
8
|
+
*/
|
|
1
9
|
import { visibleLength, clipToWidth } from './viewport.js';
|
|
2
10
|
// ---------------------------------------------------------------------------
|
|
3
11
|
// place()
|
|
@@ -6,6 +14,10 @@ import { visibleLength, clipToWidth } from './viewport.js';
|
|
|
6
14
|
* Place content within a fixed-size rectangle, aligned horizontally and
|
|
7
15
|
* vertically. Lines are padded/clipped to exactly `width` visible characters
|
|
8
16
|
* and the output is exactly `height` lines tall.
|
|
17
|
+
*
|
|
18
|
+
* @param content - The text content to place (may contain newlines).
|
|
19
|
+
* @param options - Rectangle dimensions and alignment settings.
|
|
20
|
+
* @returns A string of exactly `height` lines, each exactly `width` visible characters.
|
|
9
21
|
*/
|
|
10
22
|
export function place(content, options) {
|
|
11
23
|
const { width, height, hAlign = 'left', vAlign = 'top' } = options;
|
|
@@ -71,6 +83,9 @@ export function place(content, options) {
|
|
|
71
83
|
// ---------------------------------------------------------------------------
|
|
72
84
|
/**
|
|
73
85
|
* Vertical stack — join blocks with newlines.
|
|
86
|
+
*
|
|
87
|
+
* @param blocks - One or more rendered string blocks to stack vertically.
|
|
88
|
+
* @returns A single string with blocks separated by newlines.
|
|
74
89
|
*/
|
|
75
90
|
export function vstack(...blocks) {
|
|
76
91
|
return blocks.join('\n');
|
|
@@ -78,6 +93,10 @@ export function vstack(...blocks) {
|
|
|
78
93
|
/**
|
|
79
94
|
* Horizontal stack — place blocks side by side with a gap between columns.
|
|
80
95
|
* Pads shorter blocks with empty lines to align rows.
|
|
96
|
+
*
|
|
97
|
+
* @param gap - Number of space characters between adjacent columns.
|
|
98
|
+
* @param blocks - One or more rendered string blocks to stack horizontally.
|
|
99
|
+
* @returns A single string with blocks arranged side by side.
|
|
81
100
|
*/
|
|
82
101
|
export function hstack(gap, ...blocks) {
|
|
83
102
|
if (blocks.length === 0)
|
|
@@ -105,7 +124,12 @@ export function hstack(gap, ...blocks) {
|
|
|
105
124
|
}
|
|
106
125
|
return rows.join('\n');
|
|
107
126
|
}
|
|
108
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Compute the visible width of a string after stripping ANSI escape sequences.
|
|
129
|
+
*
|
|
130
|
+
* @param s - The string possibly containing ANSI color/style codes.
|
|
131
|
+
* @returns The character count excluding escape sequences.
|
|
132
|
+
*/
|
|
109
133
|
function visualWidth(s) {
|
|
110
134
|
// Strip ANSI escape sequences
|
|
111
135
|
// eslint-disable-next-line no-control-regex
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAuB3D,8EAA8E;AAC9E,UAAU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I,EAAE,CAAC;YAChC,yCAAyC;YACzC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzB,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,CAAS;IAC5B,8BAA8B;IAC9B,4CAA4C;IAC5C,OAAO,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC"}
|
|
@@ -18,41 +18,81 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { type TableColumn, type BijouContext } from '@flyingrobots/bijou';
|
|
20
20
|
import { type KeyMap } from './keybindings.js';
|
|
21
|
+
/** Immutable state for the navigable table widget. */
|
|
21
22
|
export interface NavigableTableState {
|
|
23
|
+
/** Column definitions (headers, widths, alignment). */
|
|
22
24
|
readonly columns: TableColumn[];
|
|
25
|
+
/** All data rows as arrays of cell strings. */
|
|
23
26
|
readonly rows: readonly (readonly string[])[];
|
|
27
|
+
/** Index of the currently focused row. */
|
|
24
28
|
readonly focusRow: number;
|
|
29
|
+
/** Vertical scroll offset (first visible row index). */
|
|
25
30
|
readonly scrollY: number;
|
|
31
|
+
/** Maximum number of visible data rows. */
|
|
26
32
|
readonly height: number;
|
|
27
33
|
}
|
|
34
|
+
/** Options for creating a new navigable table state. */
|
|
28
35
|
export interface NavigableTableOptions {
|
|
36
|
+
/** Column definitions (headers, widths, alignment). */
|
|
29
37
|
readonly columns: TableColumn[];
|
|
38
|
+
/** Data rows as arrays of cell strings. */
|
|
30
39
|
readonly rows: readonly (readonly string[])[];
|
|
40
|
+
/** Maximum number of visible data rows (default: 10). */
|
|
31
41
|
readonly height?: number;
|
|
32
42
|
}
|
|
43
|
+
/** Options for rendering the navigable table view. */
|
|
33
44
|
export interface NavTableRenderOptions {
|
|
45
|
+
/** Character(s) prepended to the focused row's first cell (default: `"\u25b8"`). */
|
|
34
46
|
readonly focusIndicator?: string;
|
|
47
|
+
/** Bijou context for theming and styling. */
|
|
35
48
|
readonly ctx?: BijouContext;
|
|
36
49
|
}
|
|
37
50
|
/**
|
|
38
51
|
* Create initial navigable table state.
|
|
39
52
|
*
|
|
40
53
|
* `height` defaults to 10 rows when not provided.
|
|
54
|
+
*
|
|
55
|
+
* @param options - Columns, rows, and optional viewport height.
|
|
56
|
+
* @returns Fresh table state with focus on the first row.
|
|
41
57
|
*/
|
|
42
58
|
export declare function createNavigableTableState(options: NavigableTableOptions): NavigableTableState;
|
|
43
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Move focus to the next row (wraps around).
|
|
61
|
+
*
|
|
62
|
+
* @param state - Current table state.
|
|
63
|
+
* @returns Updated table state with focus on the next row.
|
|
64
|
+
*/
|
|
44
65
|
export declare function navTableFocusNext(state: NavigableTableState): NavigableTableState;
|
|
45
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Move focus to the previous row (wraps around).
|
|
68
|
+
*
|
|
69
|
+
* @param state - Current table state.
|
|
70
|
+
* @returns Updated table state with focus on the previous row.
|
|
71
|
+
*/
|
|
46
72
|
export declare function navTableFocusPrev(state: NavigableTableState): NavigableTableState;
|
|
47
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Move focus down by one page (clamps to last row).
|
|
75
|
+
*
|
|
76
|
+
* @param state - Current table state.
|
|
77
|
+
* @returns Updated table state with focus advanced by one page.
|
|
78
|
+
*/
|
|
48
79
|
export declare function navTablePageDown(state: NavigableTableState): NavigableTableState;
|
|
49
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Move focus up by one page (clamps to first row).
|
|
82
|
+
*
|
|
83
|
+
* @param state - Current table state.
|
|
84
|
+
* @returns Updated table state with focus moved back by one page.
|
|
85
|
+
*/
|
|
50
86
|
export declare function navTablePageUp(state: NavigableTableState): NavigableTableState;
|
|
51
87
|
/**
|
|
52
88
|
* Render the navigable table with a focus indicator on the focused row.
|
|
53
89
|
*
|
|
54
90
|
* Slices visible rows based on `scrollY` and `height`, prepends a focus
|
|
55
91
|
* indicator to the first column, then delegates to core `table()`.
|
|
92
|
+
*
|
|
93
|
+
* @param state - Current table state.
|
|
94
|
+
* @param options - Rendering options (focus indicator, context).
|
|
95
|
+
* @returns Rendered table string with focus indicator on the active row.
|
|
56
96
|
*/
|
|
57
97
|
export declare function navigableTable(state: NavigableTableState, options?: NavTableRenderOptions): string;
|
|
58
98
|
/**
|
|
@@ -68,6 +108,10 @@ export declare function navigableTable(state: NavigableTableState, options?: Nav
|
|
|
68
108
|
* quit: { type: 'quit' },
|
|
69
109
|
* });
|
|
70
110
|
* ```
|
|
111
|
+
*
|
|
112
|
+
* @template Msg - Application message type dispatched by key bindings.
|
|
113
|
+
* @param actions - Map of navigation actions to message values.
|
|
114
|
+
* @returns Preconfigured key map with vim-style table row bindings.
|
|
71
115
|
*/
|
|
72
116
|
export declare function navTableKeyMap<Msg>(actions: {
|
|
73
117
|
focusNext: Msg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigable-table.d.ts","sourceRoot":"","sources":["../src/navigable-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAgB,KAAK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