@kofany/beamterm-terx 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +439 -0
- package/beamterm_renderer.d.ts +315 -0
- package/beamterm_renderer.js +5 -0
- package/beamterm_renderer_bg.js +1908 -0
- package/beamterm_renderer_bg.wasm +0 -0
- package/package.json +38 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class Batch {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
/**
|
|
9
|
+
* Updates a cell by its buffer index.
|
|
10
|
+
*/
|
|
11
|
+
cellByIndex(idx: number, cell_data: Cell): void;
|
|
12
|
+
/**
|
|
13
|
+
* Updates a single cell at the given position.
|
|
14
|
+
*/
|
|
15
|
+
cell(x: number, y: number, cell_data: Cell): void;
|
|
16
|
+
/**
|
|
17
|
+
* Fill a rectangular region
|
|
18
|
+
*/
|
|
19
|
+
fill(x: number, y: number, width: number, height: number, cell_data: Cell): void;
|
|
20
|
+
/**
|
|
21
|
+
* Write text to the terminal
|
|
22
|
+
*/
|
|
23
|
+
text(x: number, y: number, text: string, style: CellStyle): void;
|
|
24
|
+
/**
|
|
25
|
+
* Updates multiple cells from an array.
|
|
26
|
+
* Each element should be [x, y, cellData].
|
|
27
|
+
*/
|
|
28
|
+
cells(cells_json: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Clear the terminal with specified background color
|
|
31
|
+
*/
|
|
32
|
+
clear(bg: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Synchronize all pending updates to the GPU
|
|
35
|
+
*/
|
|
36
|
+
flush(): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class BeamtermRenderer {
|
|
40
|
+
free(): void;
|
|
41
|
+
[Symbol.dispose](): void;
|
|
42
|
+
/**
|
|
43
|
+
* Check if there is an active selection
|
|
44
|
+
*/
|
|
45
|
+
hasSelection(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get the terminal dimensions in cells
|
|
48
|
+
*/
|
|
49
|
+
terminalSize(): Size;
|
|
50
|
+
/**
|
|
51
|
+
* Clear any active selection
|
|
52
|
+
*/
|
|
53
|
+
clearSelection(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Enable default mouse selection behavior with built-in copy to clipboard.
|
|
56
|
+
*
|
|
57
|
+
* # Arguments
|
|
58
|
+
* * `mode` - Selection mode (Linear or Block)
|
|
59
|
+
* * `trim_whitespace` - Whether to trim trailing whitespace from selections
|
|
60
|
+
* * `drag_threshold_ms` - Optional minimum time (ms) before drag activates selection.
|
|
61
|
+
* Defaults to 200ms. Higher values prevent accidental selections during fast gestures.
|
|
62
|
+
*/
|
|
63
|
+
enableSelection(mode: SelectionMode, trim_whitespace: boolean, drag_threshold_ms?: number | null): void;
|
|
64
|
+
/**
|
|
65
|
+
* Create a new render batch
|
|
66
|
+
*/
|
|
67
|
+
batch(): Batch;
|
|
68
|
+
/**
|
|
69
|
+
* Copy text to the system clipboard
|
|
70
|
+
*/
|
|
71
|
+
copyToClipboard(text: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Set a custom mouse event handler
|
|
74
|
+
*/
|
|
75
|
+
setMouseHandler(handler: Function): void;
|
|
76
|
+
/**
|
|
77
|
+
* Create a terminal renderer with custom static font atlas data.
|
|
78
|
+
*
|
|
79
|
+
* # Arguments
|
|
80
|
+
* * `canvas_id` - CSS selector for the canvas element
|
|
81
|
+
* * `atlas_data` - Binary atlas data (from .atlas file), or null for default
|
|
82
|
+
*/
|
|
83
|
+
static withStaticAtlas(canvas_id: string, atlas_data?: Uint8Array | null): BeamtermRenderer;
|
|
84
|
+
/**
|
|
85
|
+
* Create a terminal renderer with a dynamic font atlas using browser fonts.
|
|
86
|
+
*
|
|
87
|
+
* The dynamic atlas rasterizes glyphs on-demand using the browser's canvas API,
|
|
88
|
+
* enabling support for any system font, emoji, and complex scripts.
|
|
89
|
+
*
|
|
90
|
+
* # Arguments
|
|
91
|
+
* * `canvas_id` - CSS selector for the canvas element
|
|
92
|
+
* * `font_family` - Array of font family names (e.g., `["Hack", "JetBrains Mono"]`)
|
|
93
|
+
* * `font_size` - Font size in pixels
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
* ```javascript
|
|
97
|
+
* const renderer = BeamtermRenderer.withDynamicAtlas(
|
|
98
|
+
* "#terminal",
|
|
99
|
+
* ["JetBrains Mono", "Fira Code"],
|
|
100
|
+
* 16.0
|
|
101
|
+
* );
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
static withDynamicAtlas(canvas_id: string, font_family: Array<any>, font_size: number): BeamtermRenderer;
|
|
105
|
+
/**
|
|
106
|
+
* Create a new terminal renderer with the default embedded font atlas.
|
|
107
|
+
*/
|
|
108
|
+
constructor(canvas_id: string);
|
|
109
|
+
/**
|
|
110
|
+
* Render the terminal to the canvas
|
|
111
|
+
*/
|
|
112
|
+
render(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Resize the terminal to fit new canvas dimensions
|
|
115
|
+
*/
|
|
116
|
+
resize(width: number, height: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Get selected text based on a cell query
|
|
119
|
+
*/
|
|
120
|
+
getText(query: CellQuery): string;
|
|
121
|
+
/**
|
|
122
|
+
* Get the cell size in pixels
|
|
123
|
+
*/
|
|
124
|
+
cellSize(): Size;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export class Cell {
|
|
128
|
+
free(): void;
|
|
129
|
+
[Symbol.dispose](): void;
|
|
130
|
+
constructor(symbol: string, style: CellStyle);
|
|
131
|
+
symbol: string;
|
|
132
|
+
bg: number;
|
|
133
|
+
fg: number;
|
|
134
|
+
style: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class CellQuery {
|
|
138
|
+
free(): void;
|
|
139
|
+
[Symbol.dispose](): void;
|
|
140
|
+
/**
|
|
141
|
+
* Configure whether to trim trailing whitespace from lines
|
|
142
|
+
*/
|
|
143
|
+
trimTrailingWhitespace(enabled: boolean): CellQuery;
|
|
144
|
+
/**
|
|
145
|
+
* Set the ending position for the selection
|
|
146
|
+
*/
|
|
147
|
+
end(col: number, row: number): CellQuery;
|
|
148
|
+
/**
|
|
149
|
+
* Create a new cell query with the specified selection mode
|
|
150
|
+
*/
|
|
151
|
+
constructor(mode: SelectionMode);
|
|
152
|
+
/**
|
|
153
|
+
* Set the starting position for the selection
|
|
154
|
+
*/
|
|
155
|
+
start(col: number, row: number): CellQuery;
|
|
156
|
+
/**
|
|
157
|
+
* Check if the query is empty (no selection range)
|
|
158
|
+
*/
|
|
159
|
+
isEmpty(): boolean;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export class CellStyle {
|
|
163
|
+
free(): void;
|
|
164
|
+
[Symbol.dispose](): void;
|
|
165
|
+
/**
|
|
166
|
+
* Add strikethrough effect
|
|
167
|
+
*/
|
|
168
|
+
strikethrough(): CellStyle;
|
|
169
|
+
/**
|
|
170
|
+
* Sets the background color
|
|
171
|
+
*/
|
|
172
|
+
bg(color: number): CellStyle;
|
|
173
|
+
/**
|
|
174
|
+
* Sets the foreground color
|
|
175
|
+
*/
|
|
176
|
+
fg(color: number): CellStyle;
|
|
177
|
+
/**
|
|
178
|
+
* Create a new TextStyle with default (normal) style
|
|
179
|
+
*/
|
|
180
|
+
constructor();
|
|
181
|
+
/**
|
|
182
|
+
* Add bold style
|
|
183
|
+
*/
|
|
184
|
+
bold(): CellStyle;
|
|
185
|
+
/**
|
|
186
|
+
* Add italic style
|
|
187
|
+
*/
|
|
188
|
+
italic(): CellStyle;
|
|
189
|
+
/**
|
|
190
|
+
* Add underline effect
|
|
191
|
+
*/
|
|
192
|
+
underline(): CellStyle;
|
|
193
|
+
/**
|
|
194
|
+
* Get the combined style bits
|
|
195
|
+
*/
|
|
196
|
+
readonly bits: number;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export class MouseEvent {
|
|
200
|
+
private constructor();
|
|
201
|
+
free(): void;
|
|
202
|
+
[Symbol.dispose](): void;
|
|
203
|
+
/**
|
|
204
|
+
* Type of mouse event
|
|
205
|
+
*/
|
|
206
|
+
event_type: MouseEventType;
|
|
207
|
+
/**
|
|
208
|
+
* Column in terminal grid (0-based)
|
|
209
|
+
*/
|
|
210
|
+
col: number;
|
|
211
|
+
/**
|
|
212
|
+
* Row in terminal grid (0-based)
|
|
213
|
+
*/
|
|
214
|
+
row: number;
|
|
215
|
+
/**
|
|
216
|
+
* Mouse button (0=left, 1=middle, 2=right)
|
|
217
|
+
*/
|
|
218
|
+
button: number;
|
|
219
|
+
/**
|
|
220
|
+
* Whether Ctrl key was pressed
|
|
221
|
+
*/
|
|
222
|
+
ctrl_key: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Whether Shift key was pressed
|
|
225
|
+
*/
|
|
226
|
+
shift_key: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Whether Alt key was pressed
|
|
229
|
+
*/
|
|
230
|
+
alt_key: boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Type of mouse event
|
|
235
|
+
*/
|
|
236
|
+
export enum MouseEventType {
|
|
237
|
+
/**
|
|
238
|
+
* Mouse button pressed
|
|
239
|
+
*/
|
|
240
|
+
MouseDown = 0,
|
|
241
|
+
/**
|
|
242
|
+
* Mouse button released
|
|
243
|
+
*/
|
|
244
|
+
MouseUp = 1,
|
|
245
|
+
/**
|
|
246
|
+
* Mouse moved
|
|
247
|
+
*/
|
|
248
|
+
MouseMove = 2,
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Selection mode for text selection in the terminal
|
|
253
|
+
*/
|
|
254
|
+
export enum SelectionMode {
|
|
255
|
+
/**
|
|
256
|
+
* Rectangular block selection
|
|
257
|
+
*/
|
|
258
|
+
Block = 0,
|
|
259
|
+
/**
|
|
260
|
+
* Linear text flow selection
|
|
261
|
+
*/
|
|
262
|
+
Linear = 1,
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export class Size {
|
|
266
|
+
private constructor();
|
|
267
|
+
free(): void;
|
|
268
|
+
[Symbol.dispose](): void;
|
|
269
|
+
width: number;
|
|
270
|
+
height: number;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export class TerminalDebugApi {
|
|
274
|
+
private constructor();
|
|
275
|
+
free(): void;
|
|
276
|
+
[Symbol.dispose](): void;
|
|
277
|
+
/**
|
|
278
|
+
* Returns the symbol for a given glyph ID, or null if not found.
|
|
279
|
+
*/
|
|
280
|
+
getSymbol(glyph_id: number): string | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* Returns the cell size in pixels as an object with `width` and `height` fields.
|
|
283
|
+
*/
|
|
284
|
+
getCellSize(): any;
|
|
285
|
+
/**
|
|
286
|
+
* Returns the canvas size in pixels as an object with `width` and `height` fields.
|
|
287
|
+
*/
|
|
288
|
+
getCanvasSize(): any;
|
|
289
|
+
/**
|
|
290
|
+
* Returns the number of glyphs available in the font atlas.
|
|
291
|
+
*/
|
|
292
|
+
getGlyphCount(): number;
|
|
293
|
+
/**
|
|
294
|
+
* Returns the base glyph ID for a given symbol, or null if not found.
|
|
295
|
+
*/
|
|
296
|
+
getBaseGlyphId(symbol: string): number | undefined;
|
|
297
|
+
getAtlasLookup(): Array<any>;
|
|
298
|
+
/**
|
|
299
|
+
* Returns the terminal size in cells as an object with `cols` and `rows` fields.
|
|
300
|
+
*/
|
|
301
|
+
getTerminalSize(): any;
|
|
302
|
+
/**
|
|
303
|
+
* Returns an array of glyphs that were requested but not found in the font atlas.
|
|
304
|
+
*/
|
|
305
|
+
getMissingGlyphs(): Array<any>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export function cell(symbol: string, style: CellStyle): Cell;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Initialize the WASM module
|
|
312
|
+
*/
|
|
313
|
+
export function main(): void;
|
|
314
|
+
|
|
315
|
+
export function style(): CellStyle;
|