@blit-sh/browser 0.17.1 → 0.19.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/blit_browser.d.ts CHANGED
@@ -50,6 +50,7 @@ export class Terminal {
50
50
  */
51
51
  overflow_text_op(index: number): any;
52
52
  prepare_render_ops(): void;
53
+ row_col_map(row: number): Uint16Array;
53
54
  scrollback_lines(): number;
54
55
  set_ansi_color(idx: number, r: number, g: number, b: number): void;
55
56
  set_cell_size(cell_width: number, cell_height: number): void;
@@ -101,6 +102,7 @@ export interface InitOutput {
101
102
  readonly terminal_overflow_text_count: (a: number) => number;
102
103
  readonly terminal_overflow_text_op: (a: number, b: number) => any;
103
104
  readonly terminal_prepare_render_ops: (a: number) => void;
105
+ readonly terminal_row_col_map: (a: number, b: number) => [number, number];
104
106
  readonly terminal_rows: (a: number) => number;
105
107
  readonly terminal_scrollback_lines: (a: number) => number;
106
108
  readonly terminal_set_ansi_color: (a: number, b: number, c: number, d: number, e: number) => void;
package/blit_browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* @ts-self-types="./blit_browser.d.ts" */
2
- import { blitFillTextCodePoint, blitFillTextStretched } from './snippets/blit-browser-85b5a69c470db3e8/inline0.js';
2
+ import { blitFillTextCodePoint, blitFillTextStretched } from './snippets/blit-browser-897aa25ccaa8ae04/inline0.js';
3
3
 
4
4
  export class Terminal {
5
5
  __destroy_into_raw() {
@@ -234,6 +234,16 @@ export class Terminal {
234
234
  prepare_render_ops() {
235
235
  wasm.terminal_prepare_render_ops(this.__wbg_ptr);
236
236
  }
237
+ /**
238
+ * @param {number} row
239
+ * @returns {Uint16Array}
240
+ */
241
+ row_col_map(row) {
242
+ const ret = wasm.terminal_row_col_map(this.__wbg_ptr, row);
243
+ var v1 = getArrayU16FromWasm0(ret[0], ret[1]).slice();
244
+ wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
245
+ return v1;
246
+ }
237
247
  /**
238
248
  * @returns {number}
239
249
  */
@@ -322,7 +332,7 @@ export function wasm_memory() {
322
332
  const ret = wasm.wasm_memory();
323
333
  return ret;
324
334
  }
325
- import * as import1 from "./snippets/blit-browser-85b5a69c470db3e8/inline0.js"
335
+ import * as import1 from "./snippets/blit-browser-897aa25ccaa8ae04/inline0.js"
326
336
 
327
337
  function __wbg_get_imports() {
328
338
  const import0 = {
@@ -341,10 +351,10 @@ function __wbg_get_imports() {
341
351
  __wbg_beginPath_596efed55075dbc3: function(arg0) {
342
352
  arg0.beginPath();
343
353
  },
344
- __wbg_blitFillTextCodePoint_34b207b79f73d27c: function(arg0, arg1, arg2, arg3) {
354
+ __wbg_blitFillTextCodePoint_664f64b67966b0d6: function(arg0, arg1, arg2, arg3) {
345
355
  blitFillTextCodePoint(arg0, arg1 >>> 0, arg2, arg3);
346
356
  },
347
- __wbg_blitFillTextStretched_f04a21864dd4037e: function(arg0, arg1, arg2, arg3, arg4) {
357
+ __wbg_blitFillTextStretched_b1a7be16ffaa17be: function(arg0, arg1, arg2, arg3, arg4) {
348
358
  blitFillTextStretched(arg0, arg1 >>> 0, arg2, arg3, arg4);
349
359
  },
350
360
  __wbg_clearRect_ea4f3d34d76f4bc5: function(arg0, arg1, arg2, arg3, arg4) {
@@ -477,7 +487,7 @@ function __wbg_get_imports() {
477
487
  return {
478
488
  __proto__: null,
479
489
  "./blit_browser_bg.js": import0,
480
- "./snippets/blit-browser-85b5a69c470db3e8/inline0.js": import1,
490
+ "./snippets/blit-browser-897aa25ccaa8ae04/inline0.js": import1,
481
491
  };
482
492
  }
483
493
 
@@ -491,11 +501,24 @@ function addToExternrefTable0(obj) {
491
501
  return idx;
492
502
  }
493
503
 
504
+ function getArrayU16FromWasm0(ptr, len) {
505
+ ptr = ptr >>> 0;
506
+ return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
507
+ }
508
+
494
509
  function getStringFromWasm0(ptr, len) {
495
510
  ptr = ptr >>> 0;
496
511
  return decodeText(ptr, len);
497
512
  }
498
513
 
514
+ let cachedUint16ArrayMemory0 = null;
515
+ function getUint16ArrayMemory0() {
516
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
517
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
518
+ }
519
+ return cachedUint16ArrayMemory0;
520
+ }
521
+
499
522
  let cachedUint8ArrayMemory0 = null;
500
523
  function getUint8ArrayMemory0() {
501
524
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -594,6 +617,7 @@ let wasmModule, wasm;
594
617
  function __wbg_finalize_init(instance, module) {
595
618
  wasm = instance.exports;
596
619
  wasmModule = module;
620
+ cachedUint16ArrayMemory0 = null;
597
621
  cachedUint8ArrayMemory0 = null;
598
622
  wasm.__wbindgen_start();
599
623
  return wasm;
Binary file
@@ -29,6 +29,7 @@ export const terminal_new: (a: number, b: number, c: number, d: number) => numbe
29
29
  export const terminal_overflow_text_count: (a: number) => number;
30
30
  export const terminal_overflow_text_op: (a: number, b: number) => any;
31
31
  export const terminal_prepare_render_ops: (a: number) => void;
32
+ export const terminal_row_col_map: (a: number, b: number) => [number, number];
32
33
  export const terminal_rows: (a: number) => number;
33
34
  export const terminal_scrollback_lines: (a: number) => number;
34
35
  export const terminal_set_ansi_color: (a: number, b: number, c: number, d: number, e: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blit-sh/browser",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "description": "Low-latency terminal streaming — browser WASM renderer",
6
6
  "main": "blit_browser.js",