@fusion.dev/helix-headless 0.208.0 → 0.209.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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/carousel/root/carousel-root.js +9 -5
- package/dist/chat/root/chat-root.js +6 -3
- package/dist/data-table/root/data-table-root.js +8 -7
- package/dist/element-events.generated.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/outline/root/outline-root.js +12 -7
- package/dist/terminal/index.d.ts +3 -0
- package/dist/terminal/index.js +1 -0
- package/dist/terminal/keys.d.ts +14 -0
- package/dist/terminal/keys.js +20 -0
- package/dist/terminal/root/terminal-root.d.ts +489 -0
- package/dist/terminal/root/terminal-root.js +710 -0
- package/dist/toolbar/root/toolbar-root.d.ts +14 -0
- package/dist/toolbar/root/toolbar-root.js +6 -3
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +899 -0
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +220 -1
- package/types/words.d.ts +112 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { HelixElement, type TerminalResizeDetail } from '@fusion.dev/helix-core';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import '../../button/index.js';
|
|
4
|
+
import '../../icon-button/index.js';
|
|
5
|
+
import '../../toolbar/index.js';
|
|
6
|
+
/** How a search through a terminal's output moves. */
|
|
7
|
+
export interface TerminalFindOptions {
|
|
8
|
+
/** Toward the top of the output, for the previous match. */
|
|
9
|
+
backward: boolean;
|
|
10
|
+
/** Whether the search is the reader still typing, which stays on the match it has where it still matches. */
|
|
11
|
+
incremental: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** What the frame asks of whatever draws the terminal, as the frame's settings stand. */
|
|
14
|
+
export interface TerminalSettings {
|
|
15
|
+
/** The grid's width in cells, or `undefined` for as many as fit the frame. */
|
|
16
|
+
columns: number | undefined;
|
|
17
|
+
/** Whether the cursor is drawn, which it is not while `readonly`. */
|
|
18
|
+
cursor: boolean;
|
|
19
|
+
/** Whether the reader's keys reach the program: not while `readonly`, and not once its process has exited. */
|
|
20
|
+
input: boolean;
|
|
21
|
+
/** The grid's height in lines, or `undefined` for as many as fit the frame. */
|
|
22
|
+
rows: number | undefined;
|
|
23
|
+
/** Whether the renderer keeps an accessible copy of the grid and says new output. */
|
|
24
|
+
screenReader: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What draws a terminal for the frame: `connectTerminal` from
|
|
28
|
+
* `@fusion.dev/helix-terminal` builds one from a driver, and a page drawing its
|
|
29
|
+
* own terminal hands the frame its own.
|
|
30
|
+
*
|
|
31
|
+
* `write` is the one method it must have. Each other one turns on what it is
|
|
32
|
+
* named for, and the frame leaves out the control a renderer cannot answer.
|
|
33
|
+
*/
|
|
34
|
+
export interface TerminalRenderer {
|
|
35
|
+
/** Clears the scrollback, keeping the line the cursor is on. */
|
|
36
|
+
clear?(): void;
|
|
37
|
+
/** Searches the output for `query` and highlights the matches, reporting them through `found`. */
|
|
38
|
+
find?(query: string, options: TerminalFindOptions): void;
|
|
39
|
+
/** Takes the highlights off once the find bar closes. */
|
|
40
|
+
findEnd?(): void;
|
|
41
|
+
/** Focuses the renderer's input. */
|
|
42
|
+
focus?(): void;
|
|
43
|
+
/** The element that takes the reader's keys, which the frame names. */
|
|
44
|
+
input?(): HTMLElement | null | undefined;
|
|
45
|
+
/** Inputs text as a paste does, in bracketed paste mode where the program asked for it. */
|
|
46
|
+
paste?(text: string): void;
|
|
47
|
+
/** Resets the emulator: its modes, its colors, and its screen. */
|
|
48
|
+
reset?(): void;
|
|
49
|
+
/** The text selected in the grid, or an empty string. */
|
|
50
|
+
selection?(): string;
|
|
51
|
+
/** Applies the frame's settings. Called when attached and whenever one changes. */
|
|
52
|
+
settings?(settings: TerminalSettings): void;
|
|
53
|
+
/** The grid as plain text: the lines on screen, or every line the scrollback holds. */
|
|
54
|
+
text?(scope: 'all' | 'screen'): string;
|
|
55
|
+
/** Writes the program's output, and calls `done` once it has been parsed. */
|
|
56
|
+
write(data: string | Uint8Array, done: () => void): void;
|
|
57
|
+
}
|
|
58
|
+
/** A color the frame reads, by the name a renderer's theme gives it. */
|
|
59
|
+
export type TerminalColorName = 'activeMatch' | 'activeMatchBorder' | 'background' | 'black' | 'blue' | 'brightBlack' | 'brightBlue' | 'brightCyan' | 'brightGreen' | 'brightMagenta' | 'brightRed' | 'brightWhite' | 'brightYellow' | 'cursor' | 'cyan' | 'foreground' | 'green' | 'magenta' | 'match' | 'red' | 'scrollbar' | 'selection' | 'white' | 'yellow';
|
|
60
|
+
/**
|
|
61
|
+
* The colors and the face the terminal is to be drawn in, as the `--terminal-*`
|
|
62
|
+
* properties where the frame is resolve them: each color as the browser
|
|
63
|
+
* computed it, and none for a property nothing set.
|
|
64
|
+
*/
|
|
65
|
+
export interface TerminalLook {
|
|
66
|
+
colors: Partial<Record<TerminalColorName, string>>;
|
|
67
|
+
/** The viewport's face, which the grid's cells are measured in. */
|
|
68
|
+
font: {
|
|
69
|
+
family: string;
|
|
70
|
+
size: number;
|
|
71
|
+
} | undefined;
|
|
72
|
+
}
|
|
73
|
+
/** What the frame gives back to whatever it is attached to: how a renderer tells the frame what happened. */
|
|
74
|
+
export interface TerminalSink {
|
|
75
|
+
/** The program rang the bell. */
|
|
76
|
+
bell(): void;
|
|
77
|
+
/** Detaches the renderer, which the frame stops writing to and asking. */
|
|
78
|
+
detach(): void;
|
|
79
|
+
/** A search found `count` matches, the one at `index` current, counting from `0`, or `-1` for none. */
|
|
80
|
+
found(index: number, count: number): void;
|
|
81
|
+
/** The reader typed or pasted `data`, encoded for the program. */
|
|
82
|
+
input(data: string, binary?: boolean): void;
|
|
83
|
+
/** A link in the output was activated. */
|
|
84
|
+
link(href: string): void;
|
|
85
|
+
/** The grid changed size. */
|
|
86
|
+
resized(size: TerminalResizeDetail): void;
|
|
87
|
+
/** Whether any text is selected now, which the copy control follows. */
|
|
88
|
+
selected(any: boolean): void;
|
|
89
|
+
/** The program set its title. */
|
|
90
|
+
title(title: string): void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @summary A frame around a terminal emulator that runs a shell you connect.
|
|
94
|
+
*
|
|
95
|
+
* @description
|
|
96
|
+
* Wraps a terminal drawn by xterm.js or another emulator. The frame adds a
|
|
97
|
+
* header with the terminal's name and its controls, a find bar, and a status
|
|
98
|
+
* line. `connectTerminal` in `@fusion.dev/helix-terminal` connects it to the
|
|
99
|
+
* emulator and draws the terminal in the colors the `--terminal-*` properties
|
|
100
|
+
* set, which the styled tier sets from your theme. Helix does not start a
|
|
101
|
+
* process: you connect the stream. Write the program's output with `write()`, send what the
|
|
102
|
+
* reader types to the process from `helix-terminal-input`, and resize the
|
|
103
|
+
* process's pseudo-terminal from `helix-terminal-resize`.
|
|
104
|
+
*
|
|
105
|
+
* Output written before a renderer is connected is held and written first, so
|
|
106
|
+
* the process can start before the emulator loads. `write()` resolves once
|
|
107
|
+
* the renderer has parsed the output, which is how a page pauses a process
|
|
108
|
+
* that writes faster than the terminal draws.
|
|
109
|
+
*
|
|
110
|
+
* The controls are a row in the header, and `controls` names which ones:
|
|
111
|
+
* `find`, `copy`, `clear`, and `fullscreen`. `find clear` by default. A control
|
|
112
|
+
* the renderer cannot answer is left out once it is connected. Set `exit-code`
|
|
113
|
+
* when the process exits: the frame says how it exited, stops sending input,
|
|
114
|
+
* and shows a Restart button that sends `helix-terminal-restart`.
|
|
115
|
+
*
|
|
116
|
+
* **Keyboard.** Every key goes to the program, Tab, Shift+Tab, and Escape
|
|
117
|
+
* included, except these:
|
|
118
|
+
*
|
|
119
|
+
* - Control+Shift+F, or Command+F on a Mac, opens the find bar. Enter and
|
|
120
|
+
* Shift+Enter move between the matches, and Escape closes the bar and
|
|
121
|
+
* returns focus to the terminal.
|
|
122
|
+
* - Control+Shift+C copies the selection. On a Mac, Command+C does.
|
|
123
|
+
* - Control+M, or Control+Shift+M on a Mac, switches Tab between typing in the
|
|
124
|
+
* terminal and moving focus out of it. The status line says when Tab moves
|
|
125
|
+
* focus, and the terminal's input describes the key to a screen reader.
|
|
126
|
+
*
|
|
127
|
+
* **Screen readers.** A terminal draws its grid as a picture of text, so a
|
|
128
|
+
* screen reader reads nothing in it by default. Set `screen-reader-mode` to
|
|
129
|
+
* have the renderer keep the grid as lines a screen reader can move through
|
|
130
|
+
* and announce new output as it arrives, which xterm.js calls screen reader
|
|
131
|
+
* mode. It costs time on every write, so it is off by default: connect it to
|
|
132
|
+
* a setting your reader can turn on.
|
|
133
|
+
*
|
|
134
|
+
* @since 0.209.0
|
|
135
|
+
* @status experimental
|
|
136
|
+
* @category media
|
|
137
|
+
* @aliases Terminal emulator, Shell, xterm
|
|
138
|
+
* @documentation https://fusion.dev/helix/components/terminal
|
|
139
|
+
*
|
|
140
|
+
* @slot - The element your renderer draws the terminal in.
|
|
141
|
+
* @slot actions - Controls of your own in the header, before the built-in ones, such as a button that splits the pane.
|
|
142
|
+
* @slot clear-icon - Replaces the glyph inside the clear button.
|
|
143
|
+
* @slot copy-icon - Replaces the glyph inside the copy button.
|
|
144
|
+
* @slot exit-actions - Controls of your own beside Restart, shown once the process exits, such as a button that opens the whole log.
|
|
145
|
+
* @slot find-actions - Controls of your own in the find bar, between the count and the buttons that move between matches.
|
|
146
|
+
* @slot find-close-icon - Replaces the glyph inside the button that closes the find bar.
|
|
147
|
+
* @slot find-icon - Replaces the glyph inside the find button.
|
|
148
|
+
* @slot find-next-icon - Replaces the glyph inside the next match button.
|
|
149
|
+
* @slot find-previous-icon - Replaces the glyph inside the previous match button.
|
|
150
|
+
* @slot fullscreen-icon - Replaces the glyph inside the fullscreen button.
|
|
151
|
+
* @slot label - The terminal's name in the header, such as an icon beside the shell's name. Replaces `label` there.
|
|
152
|
+
* @slot restart-icon - Replaces the glyph inside the Restart button.
|
|
153
|
+
*
|
|
154
|
+
* @event {HelixCopyEvent} helix-copy - The copy control or its key put the selection on the clipboard.
|
|
155
|
+
* @event {HelixTerminalBellEvent} helix-terminal-bell - The program rang the bell. The frame flashes once.
|
|
156
|
+
* @event {HelixTerminalInputEvent} helix-terminal-input - The reader typed or pasted, with `data` encoded for the program. Write it to the process. Not sent while `readonly`, or once `exit-code` is set.
|
|
157
|
+
* @event {HelixTerminalLinkEvent} helix-terminal-link - A link in the output was activated, with its `href`. Cancelable: cancel it to open the link yourself. Left alone, a web address opens in a new tab.
|
|
158
|
+
* @event {HelixTerminalResizeEvent} helix-terminal-resize - The grid changed size, with `columns`, `rows`, `width`, and `height`. Resize the process's pseudo-terminal to match.
|
|
159
|
+
* @event {HelixTerminalRestartEvent} helix-terminal-restart - The Restart button was pressed after the process exited. Start a new process and clear `exit-code`.
|
|
160
|
+
* @event {HelixTerminalTitleEvent} helix-terminal-title - The program set its title, with `title`. The frame keeps its own `label`.
|
|
161
|
+
*
|
|
162
|
+
* @csspart actions - The `actions` slot, first in the header's toolbar.
|
|
163
|
+
* @csspart clear - The button that clears the scrollback.
|
|
164
|
+
* @csspart clear-button - The clear button's inner button.
|
|
165
|
+
* @csspart clear-live - The clear button's live region, which speaks while the button is pending.
|
|
166
|
+
* @csspart clear-spinner - The ring the clear button turns while it is pending.
|
|
167
|
+
* @csspart clear-text - The box the clear button's icon sits in.
|
|
168
|
+
* @csspart controls - The toolbar at the end of the header: your actions, then the built-in buttons, one tab stop that the arrows move along.
|
|
169
|
+
* @csspart controls-toolbar - The box inside the header's toolbar that lays its buttons out.
|
|
170
|
+
* @csspart copy - The button that copies the selection. Disabled while nothing is selected.
|
|
171
|
+
* @csspart copy-button - The copy button's inner button.
|
|
172
|
+
* @csspart copy-live - The copy button's live region, which speaks while the button is pending.
|
|
173
|
+
* @csspart copy-spinner - The ring the copy button turns while it is pending.
|
|
174
|
+
* @csspart copy-text - The box the copy button's icon sits in.
|
|
175
|
+
* @csspart exit-actions - The `exit-actions` slot, beside Restart in the status line.
|
|
176
|
+
* @csspart find - The button that opens and closes the find bar. Expanded while it is open.
|
|
177
|
+
* @csspart find-actions - The `find-actions` slot, first in the find bar's toolbar.
|
|
178
|
+
* @csspart find-bar - The bar under the header where the reader searches the output.
|
|
179
|
+
* @csspart find-button - The find button's inner button.
|
|
180
|
+
* @csspart find-close - The button that closes the find bar.
|
|
181
|
+
* @csspart find-close-button - The find bar's close button's inner button.
|
|
182
|
+
* @csspart find-close-live - The find bar's close button's live region, which speaks while the button is pending.
|
|
183
|
+
* @csspart find-close-spinner - The ring the find bar's close button turns while it is pending.
|
|
184
|
+
* @csspart find-close-text - The box the find bar's close button's icon sits in.
|
|
185
|
+
* @csspart find-controls - The toolbar at the end of the find bar: your find actions, then the buttons that move between matches and close the bar.
|
|
186
|
+
* @csspart find-controls-toolbar - The box inside the find bar's toolbar that lays its buttons out.
|
|
187
|
+
* @csspart find-count - Which match is current and how many there are, such as "3 of 12 matches".
|
|
188
|
+
* @csspart find-field - The search field in the find bar.
|
|
189
|
+
* @csspart find-live - The find button's live region, which speaks while the button is pending.
|
|
190
|
+
* @csspart find-next - The button that moves to the next match.
|
|
191
|
+
* @csspart find-next-button - The next match button's inner button.
|
|
192
|
+
* @csspart find-next-live - The next match button's live region, which speaks while the button is pending.
|
|
193
|
+
* @csspart find-next-spinner - The ring the next match button turns while it is pending.
|
|
194
|
+
* @csspart find-next-text - The box the next match button's icon sits in.
|
|
195
|
+
* @csspart find-previous - The button that moves to the previous match.
|
|
196
|
+
* @csspart find-previous-button - The previous match button's inner button.
|
|
197
|
+
* @csspart find-previous-live - The previous match button's live region, which speaks while the button is pending.
|
|
198
|
+
* @csspart find-previous-spinner - The ring the previous match button turns while it is pending.
|
|
199
|
+
* @csspart find-previous-text - The box the previous match button's icon sits in.
|
|
200
|
+
* @csspart find-spinner - The ring the find button turns while it is pending.
|
|
201
|
+
* @csspart find-text - The box the find button's icon sits in.
|
|
202
|
+
* @csspart fullscreen - The button that makes the terminal fill the screen. Pressed while it does.
|
|
203
|
+
* @csspart fullscreen-button - The fullscreen button's inner button.
|
|
204
|
+
* @csspart fullscreen-live - The fullscreen button's live region, which speaks while the button is pending.
|
|
205
|
+
* @csspart fullscreen-spinner - The ring the fullscreen button turns while it is pending.
|
|
206
|
+
* @csspart fullscreen-text - The box the fullscreen button's icon sits in.
|
|
207
|
+
* @csspart header - The strip above the terminal, with its name, your actions, and the controls.
|
|
208
|
+
* @csspart label - The terminal's name in the header.
|
|
209
|
+
* @csspart live - What screen readers hear after the frame acts: a match count, a copy, or a change to what Tab does. Visually hidden in the styled tier.
|
|
210
|
+
* @csspart region - The named group the terminal sits in.
|
|
211
|
+
* @csspart restart - The button in the status line that asks for a new process after the last one exited.
|
|
212
|
+
* @csspart restart-button - The Restart button's inner button.
|
|
213
|
+
* @csspart restart-live - The Restart button's live region, which speaks while the button is pending.
|
|
214
|
+
* @csspart restart-spinner - The ring the Restart button turns while it is pending.
|
|
215
|
+
* @csspart restart-text - The Restart button's label.
|
|
216
|
+
* @csspart status - The line under the terminal that says the process exited, or that Tab moves focus.
|
|
217
|
+
* @csspart viewport - The box the terminal is drawn in.
|
|
218
|
+
*
|
|
219
|
+
* @cssproperty --terminal-active-match-background-color - The ground of the current match of a search.
|
|
220
|
+
* @cssproperty --terminal-active-match-border-color - The edge of the current match of a search.
|
|
221
|
+
* @cssproperty --terminal-ansi-black - ANSI black, which codes `30` and `40` draw.
|
|
222
|
+
* @cssproperty --terminal-ansi-blue - ANSI blue, which codes `34` and `44` draw.
|
|
223
|
+
* @cssproperty --terminal-ansi-bright-black - ANSI bright black, which codes `90` and `100` draw.
|
|
224
|
+
* @cssproperty --terminal-ansi-bright-blue - ANSI bright blue, which codes `94` and `104` draw.
|
|
225
|
+
* @cssproperty --terminal-ansi-bright-cyan - ANSI bright cyan, which codes `96` and `106` draw.
|
|
226
|
+
* @cssproperty --terminal-ansi-bright-green - ANSI bright green, which codes `92` and `102` draw.
|
|
227
|
+
* @cssproperty --terminal-ansi-bright-magenta - ANSI bright magenta, which codes `95` and `105` draw.
|
|
228
|
+
* @cssproperty --terminal-ansi-bright-red - ANSI bright red, which codes `91` and `101` draw.
|
|
229
|
+
* @cssproperty --terminal-ansi-bright-white - ANSI bright white, which codes `97` and `107` draw.
|
|
230
|
+
* @cssproperty --terminal-ansi-bright-yellow - ANSI bright yellow, which codes `93` and `103` draw.
|
|
231
|
+
* @cssproperty --terminal-ansi-cyan - ANSI cyan, which codes `36` and `46` draw.
|
|
232
|
+
* @cssproperty --terminal-ansi-green - ANSI green, which codes `32` and `42` draw.
|
|
233
|
+
* @cssproperty --terminal-ansi-magenta - ANSI magenta, which codes `35` and `45` draw.
|
|
234
|
+
* @cssproperty --terminal-ansi-red - ANSI red, which codes `31` and `41` draw.
|
|
235
|
+
* @cssproperty --terminal-ansi-white - ANSI white, which codes `37` and `47` draw.
|
|
236
|
+
* @cssproperty --terminal-ansi-yellow - ANSI yellow, which codes `33` and `43` draw.
|
|
237
|
+
* @cssproperty --terminal-background-color - The ground of the grid.
|
|
238
|
+
* @cssproperty --terminal-color - The text of the grid where the program sets no color.
|
|
239
|
+
* @cssproperty --terminal-cursor-color - The cursor.
|
|
240
|
+
* @cssproperty --terminal-match-background-color - The ground of every match of a search but the current one.
|
|
241
|
+
* @cssproperty --terminal-scrollbar-thumb-color - The grid's scrollbar.
|
|
242
|
+
* @cssproperty --terminal-selection-background-color - The ground of selected text. See-through, so the text keeps its color.
|
|
243
|
+
*
|
|
244
|
+
* @cssstate bell - The program rang the bell, held for a moment for a visual bell.
|
|
245
|
+
* @cssstate exited - The process has exited, by `exit-code`.
|
|
246
|
+
* @cssstate find-open - The find bar is open.
|
|
247
|
+
* @cssstate fullscreen - The terminal fills the screen.
|
|
248
|
+
* @cssstate tab-moves-focus - Tab moves focus out of the terminal, after Control+M.
|
|
249
|
+
*/
|
|
250
|
+
export declare class HelixHeadlessTerminal extends HelixElement {
|
|
251
|
+
/**
|
|
252
|
+
* The key this family's words are registered under, its styled tag:
|
|
253
|
+
* `registerWords('de', { 'helix-terminal': { findLabel: 'Suchen' } })`.
|
|
254
|
+
*/
|
|
255
|
+
static words: string;
|
|
256
|
+
/** The clear button's label. */
|
|
257
|
+
clearLabel: string;
|
|
258
|
+
/** The grid's width in character cells. Set it with `rows` to fix the grid's size; unset, the grid fills the frame. */
|
|
259
|
+
columns?: number | undefined;
|
|
260
|
+
/**
|
|
261
|
+
* Which built-in controls the header shows, as a list of `find`, `copy`,
|
|
262
|
+
* `clear`, and `fullscreen`, or `none`. Absent is `find clear`.
|
|
263
|
+
*/
|
|
264
|
+
controls?: string;
|
|
265
|
+
/** The name of the row of controls, read by screen readers. */
|
|
266
|
+
controlsLabel: string;
|
|
267
|
+
/** What screen readers hear after a copy. */
|
|
268
|
+
copiedLabel: string;
|
|
269
|
+
/** The copy button's label. */
|
|
270
|
+
copyLabel: string;
|
|
271
|
+
/**
|
|
272
|
+
* How the process exited, which the page sets when it does. While it is set,
|
|
273
|
+
* the status line says it, the frame sends no input, and Restart is shown.
|
|
274
|
+
* Clear it when a new process starts.
|
|
275
|
+
*/
|
|
276
|
+
exitCode?: number | undefined;
|
|
277
|
+
/**
|
|
278
|
+
* What the status line says once the process has exited. `{code}` is its
|
|
279
|
+
* exit code, written as the process gave it, and code `0` is a clean exit.
|
|
280
|
+
*/
|
|
281
|
+
exitedLabel: string;
|
|
282
|
+
/** The terminal's name where `label` is empty and the host has no `aria-label`. */
|
|
283
|
+
fallbackLabel: string;
|
|
284
|
+
/** The label of the button that closes the find bar. */
|
|
285
|
+
findCloseLabel: string;
|
|
286
|
+
/** The name of the find bar's row of buttons, read by screen readers. */
|
|
287
|
+
findControlsLabel: string;
|
|
288
|
+
/** The find button's label, and the find field's name and placeholder. */
|
|
289
|
+
findLabel: string;
|
|
290
|
+
/** The next match button's label. */
|
|
291
|
+
findNextLabel: string;
|
|
292
|
+
/** The previous match button's label. */
|
|
293
|
+
findPreviousLabel: string;
|
|
294
|
+
/** The fullscreen button's label. */
|
|
295
|
+
fullscreenLabel: string;
|
|
296
|
+
/** The name of the element the reader types into, which the renderer draws. */
|
|
297
|
+
inputLabel: string;
|
|
298
|
+
/**
|
|
299
|
+
* The terminal's name, in the header and for screen readers, such as the
|
|
300
|
+
* shell or the folder it runs in. Several terminals on a page need names
|
|
301
|
+
* that tell them apart.
|
|
302
|
+
*/
|
|
303
|
+
label: string;
|
|
304
|
+
/**
|
|
305
|
+
* What the find bar says of its matches. `{index}` is the current match,
|
|
306
|
+
* counting from 1, and `{count}` how many there are.
|
|
307
|
+
*/
|
|
308
|
+
matchesLabel: string;
|
|
309
|
+
/**
|
|
310
|
+
* Draws the output and sends no input, with no cursor, for a transcript or
|
|
311
|
+
* a command an agent ran. The attribute is `readonly`, the platform's
|
|
312
|
+
* spelling.
|
|
313
|
+
*/
|
|
314
|
+
readOnly: boolean;
|
|
315
|
+
/** The Restart button's label. */
|
|
316
|
+
restartLabel: string;
|
|
317
|
+
/** The grid's height in lines. Set it with `columns` to fix the grid's size; unset, the grid fills the frame. */
|
|
318
|
+
rows?: number | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Keeps the grid as lines a screen reader moves through, and says new
|
|
321
|
+
* output as it arrives. Off by default, since it costs time on every
|
|
322
|
+
* write. Connect it to a setting your reader can turn on.
|
|
323
|
+
*/
|
|
324
|
+
screenReaderMode: boolean;
|
|
325
|
+
/** What the terminal's input describes to a screen reader. `{key}` is the key that switches Tab. */
|
|
326
|
+
tabHintLabel: string;
|
|
327
|
+
/** What the status line says while Tab moves focus. `{key}` is the key that switches it back. */
|
|
328
|
+
tabMovesFocusLabel: string;
|
|
329
|
+
/** What screen readers hear when Tab goes back to typing in the terminal. */
|
|
330
|
+
tabTypesLabel: string;
|
|
331
|
+
/** Whether the find bar is open. */
|
|
332
|
+
private findOpen;
|
|
333
|
+
/** What the find field holds. */
|
|
334
|
+
private query;
|
|
335
|
+
/** The current match, counting from `0`, or `-1` for none. */
|
|
336
|
+
private matchIndex;
|
|
337
|
+
/** How many matches the search found, or `undefined` before one ran. */
|
|
338
|
+
private matchCount;
|
|
339
|
+
/** Whether Tab moves focus, after Control+M. */
|
|
340
|
+
private tabMovesFocus;
|
|
341
|
+
/** Whether any text is selected in the grid. */
|
|
342
|
+
private anySelected;
|
|
343
|
+
/** Whether the page slotted controls of its own into the header. */
|
|
344
|
+
private hasActions;
|
|
345
|
+
/** Whether the page slotted a name of its own into the header. */
|
|
346
|
+
private hasLabel;
|
|
347
|
+
/** What the live region says now, and how many times something has been said. */
|
|
348
|
+
private announcement;
|
|
349
|
+
private said;
|
|
350
|
+
/** What draws the terminal, while one is attached. */
|
|
351
|
+
private renderer;
|
|
352
|
+
/** Output written before a renderer was attached, in order. */
|
|
353
|
+
private pending;
|
|
354
|
+
/** The attributes the frame wrote on the renderer's input, as they were before, to put back. */
|
|
355
|
+
private inputWas;
|
|
356
|
+
/** The wait before the bell's flash ends. */
|
|
357
|
+
private ringing;
|
|
358
|
+
private readonly copier;
|
|
359
|
+
/** Whether the terminal fills the screen. */
|
|
360
|
+
private filled;
|
|
361
|
+
private readonly fullscreen;
|
|
362
|
+
/**
|
|
363
|
+
* Writes the program's output. Resolves once the renderer has parsed it,
|
|
364
|
+
* which is how a page pauses a process that writes faster than the
|
|
365
|
+
* terminal draws. Output written before a renderer is attached is held and
|
|
366
|
+
* written first.
|
|
367
|
+
*/
|
|
368
|
+
write(data: string | Uint8Array): Promise<void>;
|
|
369
|
+
/**
|
|
370
|
+
* Inputs text as a paste does, in bracketed paste mode where the program
|
|
371
|
+
* asked for it. It arrives as `helix-terminal-input`, like typed text.
|
|
372
|
+
*/
|
|
373
|
+
paste(text: string): void;
|
|
374
|
+
/** Clears the scrollback, keeping the line the cursor is on. */
|
|
375
|
+
clear(): void;
|
|
376
|
+
/** Resets the emulator: its modes, its colors, and its screen. */
|
|
377
|
+
reset(): void;
|
|
378
|
+
/**
|
|
379
|
+
* The terminal as plain text, as the renderer drew it: the lines on screen,
|
|
380
|
+
* or with `all`, every line the scrollback holds. Empty before a renderer is
|
|
381
|
+
* attached.
|
|
382
|
+
*/
|
|
383
|
+
text(scope?: 'all' | 'screen'): string;
|
|
384
|
+
/**
|
|
385
|
+
* The colors and the face the terminal is to be drawn in, as the
|
|
386
|
+
* `--terminal-*` properties resolve where the frame is. `connectTerminal`
|
|
387
|
+
* themes the renderer from it. A color nothing sets is left out, so the
|
|
388
|
+
* renderer keeps its own: the headless tier sets none, and the styled tier
|
|
389
|
+
* sets every one from the theme.
|
|
390
|
+
*/
|
|
391
|
+
look(): TerminalLook;
|
|
392
|
+
/** Focuses the terminal's input, where a renderer is attached. */
|
|
393
|
+
focus(options?: FocusOptions): void;
|
|
394
|
+
/**
|
|
395
|
+
* Attaches what draws the terminal, and returns how it tells the frame what
|
|
396
|
+
* happened. `connectTerminal` calls it; a page drawing its own terminal calls
|
|
397
|
+
* it with its own renderer. Attaching another detaches the first.
|
|
398
|
+
*/
|
|
399
|
+
attach(renderer: TerminalRenderer): TerminalSink;
|
|
400
|
+
/** The settings a renderer applies, as the frame's properties stand. */
|
|
401
|
+
private get settings();
|
|
402
|
+
/** Sends input to the page, unless input is closed. */
|
|
403
|
+
private send;
|
|
404
|
+
/** Offers a link to the page, and opens a web address where the page did not take it. */
|
|
405
|
+
private follow;
|
|
406
|
+
/** Flashes for the bell, and says so to the page. */
|
|
407
|
+
private ring;
|
|
408
|
+
/** Says something in the live region, once, even where it is what was said last. */
|
|
409
|
+
private say;
|
|
410
|
+
/** Whether `controls`, or the resting controls, names a control the renderer can answer. */
|
|
411
|
+
private draws;
|
|
412
|
+
/** The find bar's count, as the reader reads it. */
|
|
413
|
+
private get countText();
|
|
414
|
+
/** The chord that switches Tab, as a reader says it. */
|
|
415
|
+
private get tabKey();
|
|
416
|
+
/**
|
|
417
|
+
* Names the renderer's input for a screen reader: what it is, how Tab
|
|
418
|
+
* leaves it, and which keys the frame takes. What was there is kept, and put
|
|
419
|
+
* back on detach.
|
|
420
|
+
*/
|
|
421
|
+
private nameInput;
|
|
422
|
+
/** Puts the renderer's input back as it was before the frame named it. */
|
|
423
|
+
private restoreInput;
|
|
424
|
+
/** Lets go of the renderer that is attached: its input put back, and the find bar closed. */
|
|
425
|
+
private release;
|
|
426
|
+
/** Whether the frame answers a shortcut with the renderer it has. */
|
|
427
|
+
private takes;
|
|
428
|
+
/**
|
|
429
|
+
* The frame's keys, heard before the renderer's: in the capture phase, on
|
|
430
|
+
* the host, which is an ancestor of the renderer's element in the page, so
|
|
431
|
+
* a key the frame takes never reaches the program.
|
|
432
|
+
*/
|
|
433
|
+
private readonly handleKeys;
|
|
434
|
+
/** Opens the find bar and puts focus in its field, searching again for what it holds. */
|
|
435
|
+
private openFind;
|
|
436
|
+
/** Closes the find bar, takes its highlights off, and returns focus to the terminal. */
|
|
437
|
+
private closeFind;
|
|
438
|
+
/** Searches for what the field holds, toward the bottom or with `backward` toward the top. */
|
|
439
|
+
private search;
|
|
440
|
+
private readonly handleFindInput;
|
|
441
|
+
private readonly handleFindKeys;
|
|
442
|
+
/** Copies the selection, and says so. */
|
|
443
|
+
private copySelection;
|
|
444
|
+
private readonly handleActions;
|
|
445
|
+
private readonly handleLabel;
|
|
446
|
+
private readonly handleRestart;
|
|
447
|
+
/**
|
|
448
|
+
* Says the process exited, where it exited after the first render: an exit
|
|
449
|
+
* written in the markup is shown and not news. Here and not in `updated`, so
|
|
450
|
+
* the words go out in the update the exit caused rather than in another one.
|
|
451
|
+
*/
|
|
452
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
453
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
454
|
+
connectedCallback(): void;
|
|
455
|
+
disconnectedCallback(): void;
|
|
456
|
+
/** Whether any built-in control is drawn. */
|
|
457
|
+
private get drawsAny();
|
|
458
|
+
/**
|
|
459
|
+
* The header's toolbar: the page's `actions`, then the built-in controls,
|
|
460
|
+
* one tab stop between them, the arrows moving along it.
|
|
461
|
+
*
|
|
462
|
+
* **Always drawn**, empty where nothing is in it, because the `actions` slot
|
|
463
|
+
* is inside it and a slot drawn only once something is slotted is a slot
|
|
464
|
+
* nothing can be slotted into.
|
|
465
|
+
*/
|
|
466
|
+
protected renderControls(): TemplateResult;
|
|
467
|
+
/**
|
|
468
|
+
* The find bar, kept in the tree while closed so its field keeps what was
|
|
469
|
+
* typed. The field stands before the toolbar and outside it, because a
|
|
470
|
+
* toolbar leaves the arrows to a text field, and the buttons in one with it
|
|
471
|
+
* would be out of their reach.
|
|
472
|
+
*/
|
|
473
|
+
protected renderFind(): TemplateResult | typeof nothing;
|
|
474
|
+
/**
|
|
475
|
+
* One probe for each color `look()` reads, each painted in its property,
|
|
476
|
+
* inside a box painted transparent: a property nothing sets leaves its probe
|
|
477
|
+
* the box's color, which is how an unset one is told from a set one. Hidden,
|
|
478
|
+
* and read only by `look()`.
|
|
479
|
+
*/
|
|
480
|
+
protected renderLook(): TemplateResult;
|
|
481
|
+
/** The status line: how the process exited and Restart, and what Tab does while it moves focus. */
|
|
482
|
+
protected renderStatus(): TemplateResult;
|
|
483
|
+
protected render(): TemplateResult;
|
|
484
|
+
}
|
|
485
|
+
declare global {
|
|
486
|
+
interface HTMLElementTagNameMap {
|
|
487
|
+
'helix-headless-terminal': HelixHeadlessTerminal;
|
|
488
|
+
}
|
|
489
|
+
}
|