virtual-machine 0.4.0 → 0.4.2

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/build/index.d.ts CHANGED
@@ -73,6 +73,22 @@ declare class WasmVm {
73
73
  * Print a status message to UART output (visible in browser).
74
74
  */
75
75
  print_status(message: string): void;
76
+ /**
77
+ * Send a typed character to the D1 input device.
78
+ *
79
+ * This is the preferred way to send text input because it respects
80
+ * keyboard layouts. For example, Shift+7 produces '/' on German keyboards,
81
+ * and this method sends the actual '/' character.
82
+ *
83
+ * Use this for printable characters typed by the user.
84
+ * Use send_d1_key_event for special keys like Enter, Backspace, arrows.
85
+ *
86
+ * # Arguments
87
+ * * `char_code` - ASCII/Unicode code point (e.g., 47 for '/')
88
+ *
89
+ * Returns true if the character was sent successfully.
90
+ */
91
+ send_d1_char(char_code: number): boolean;
76
92
  /**
77
93
  * Get CPU count (from kernel-reported value).
78
94
  */
@@ -188,6 +204,19 @@ declare class WasmVm {
188
204
  * Returns None if not in SMP mode.
189
205
  */
190
206
  get_shared_buffer(): SharedArrayBuffer | undefined;
207
+ /**
208
+ * Send a keyboard event to the D1 input device.
209
+ *
210
+ * This is the primary way to send keyboard input to the VM when using
211
+ * the D1 touch/input device (as opposed to VirtIO input).
212
+ *
213
+ * # Arguments
214
+ * * `js_key_code` - JavaScript keyCode (e.g., 65 for 'A', 13 for Enter)
215
+ * * `pressed` - true for key press, false for key release
216
+ *
217
+ * Returns true if the event was sent successfully.
218
+ */
219
+ send_d1_key_event(js_key_code: number, pressed: boolean): boolean;
191
220
  /**
192
221
  * Send a mouse button event to the guest.
193
222
  *
@@ -493,6 +522,8 @@ interface InitOutput {
493
522
  readonly wasmvm_num_harts: (a: number) => number;
494
523
  readonly wasmvm_print_banner: (a: number) => void;
495
524
  readonly wasmvm_print_status: (a: number, b: number, c: number) => void;
525
+ readonly wasmvm_send_d1_char: (a: number, b: number) => number;
526
+ readonly wasmvm_send_d1_key_event: (a: number, b: number, c: number) => number;
496
527
  readonly wasmvm_send_key_event: (a: number, b: number, c: number) => number;
497
528
  readonly wasmvm_send_mouse_button: (a: number, b: number, c: number) => number;
498
529
  readonly wasmvm_send_mouse_event: (a: number, b: number, c: number, d: number) => number;
@@ -513,12 +544,12 @@ interface InitOutput {
513
544
  readonly workerstate_step_batch: (a: number, b: number) => number;
514
545
  readonly workerstate_step_count: (a: number) => bigint;
515
546
  readonly worker_entry: (a: number, b: any, c: bigint) => void;
516
- readonly wasm_bindgen__convert__closures_____invoke__h0d61c5f880e0f000: (a: number, b: number, c: any) => void;
517
- readonly wasm_bindgen__closure__destroy__h063f9d0e4e6d3305: (a: number, b: number) => void;
518
- readonly wasm_bindgen__convert__closures_____invoke__h784f747aa05330df: (a: number, b: number) => void;
519
- readonly wasm_bindgen__convert__closures_____invoke__hb71c6b908e43b529: (a: number, b: number) => void;
547
+ readonly wasm_bindgen__convert__closures_____invoke__h8f8124f6febb822b: (a: number, b: number) => void;
548
+ readonly wasm_bindgen__closure__destroy__h747faf247e91d978: (a: number, b: number) => void;
520
549
  readonly wasm_bindgen__convert__closures_____invoke__h260170fb96639bcf: (a: number, b: number, c: any) => void;
521
550
  readonly wasm_bindgen__closure__destroy__h612f8e24953b61d5: (a: number, b: number) => void;
551
+ readonly wasm_bindgen__convert__closures_____invoke__hdb5f2c9fdbbad746: (a: number, b: number) => void;
552
+ readonly wasm_bindgen__convert__closures_____invoke__hc92ef0219c4477f2: (a: number, b: number, c: any) => void;
522
553
  readonly __wbindgen_malloc: (a: number, b: number) => number;
523
554
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
524
555
  readonly __wbindgen_exn_store: (a: number) => void;