@kofany/beamterm-terx 0.12.1 → 0.12.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.
@@ -52,15 +52,9 @@ export class BeamtermRenderer {
52
52
  */
53
53
  clearSelection(): void;
54
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.
55
+ * Enable default mouse selection behavior with built-in copy to clipboard
62
56
  */
63
- enableSelection(mode: SelectionMode, trim_whitespace: boolean, drag_threshold_ms?: number | null): void;
57
+ enableSelection(mode: SelectionMode, trim_whitespace: boolean): void;
64
58
  /**
65
59
  * Create a new render batch
66
60
  */
@@ -102,6 +96,68 @@ export class BeamtermRenderer {
102
96
  * ```
103
97
  */
104
98
  static withDynamicAtlas(canvas_id: string, font_family: Array<any>, font_size: number): BeamtermRenderer;
99
+ /**
100
+ * Replace the current font atlas with a new static atlas.
101
+ *
102
+ * This method enables runtime font switching by loading a new `.atlas` file.
103
+ * All existing cell content is preserved and translated to the new atlas.
104
+ *
105
+ * # Arguments
106
+ * * `atlas_data` - Binary atlas data (from .atlas file), or null for default
107
+ *
108
+ * # Example
109
+ * ```javascript
110
+ * const atlasData = await fetch('new-font.atlas').then(r => r.arrayBuffer());
111
+ * renderer.replaceWithStaticAtlas(new Uint8Array(atlasData));
112
+ * ```
113
+ */
114
+ replaceWithStaticAtlas(atlas_data?: Uint8Array | null): void;
115
+ /**
116
+ * Replace the current font atlas with a new dynamic atlas.
117
+ *
118
+ * This method enables runtime font switching by creating a new dynamic atlas
119
+ * with the specified font family and size. All existing cell content is
120
+ * preserved and translated to the new atlas.
121
+ *
122
+ * # Arguments
123
+ * * `font_family` - Array of font family names (e.g., `["Hack", "JetBrains Mono"]`)
124
+ * * `font_size` - Font size in pixels
125
+ *
126
+ * # Example
127
+ * ```javascript
128
+ * renderer.replaceWithDynamicAtlas(["Fira Code", "monospace"], 18.0);
129
+ * ```
130
+ */
131
+ replaceWithDynamicAtlas(font_family: Array<any>, font_size: number): void;
132
+ /**
133
+ * Enable mouse selection with full configuration options.
134
+ *
135
+ * This method allows specifying modifier keys that must be held for selection
136
+ * to activate, in addition to the selection mode and whitespace trimming.
137
+ *
138
+ * # Arguments
139
+ * * `mode` - Selection mode (Block or Linear)
140
+ * * `trim_whitespace` - Whether to trim trailing whitespace from selected text
141
+ * * `require_modifiers` - Modifier keys that must be held to start selection
142
+ *
143
+ * # Example
144
+ * ```javascript
145
+ * // Require Shift+Click to start selection
146
+ * renderer.enableSelectionWithOptions(
147
+ * SelectionMode.Linear,
148
+ * true,
149
+ * ModifierKeys.SHIFT
150
+ * );
151
+ *
152
+ * // Require Ctrl+Shift+Click
153
+ * renderer.enableSelectionWithOptions(
154
+ * SelectionMode.Block,
155
+ * false,
156
+ * ModifierKeys.CONTROL.or(ModifierKeys.SHIFT)
157
+ * );
158
+ * ```
159
+ */
160
+ enableSelectionWithOptions(mode: SelectionMode, trim_whitespace: boolean, require_modifiers: ModifierKeys): void;
105
161
  /**
106
162
  * Create a new terminal renderer with the default embedded font atlas.
107
163
  */
@@ -196,6 +252,36 @@ export class CellStyle {
196
252
  readonly bits: number;
197
253
  }
198
254
 
255
+ export class ModifierKeys {
256
+ private constructor();
257
+ free(): void;
258
+ [Symbol.dispose](): void;
259
+ /**
260
+ * Combines two modifier key sets using bitwise OR
261
+ */
262
+ or(other: ModifierKeys): ModifierKeys;
263
+ /**
264
+ * Alt key (Option on macOS)
265
+ */
266
+ static readonly ALT: ModifierKeys;
267
+ /**
268
+ * Meta key (Command on macOS, Windows key on Windows)
269
+ */
270
+ static readonly META: ModifierKeys;
271
+ /**
272
+ * No modifier keys required
273
+ */
274
+ static readonly NONE: ModifierKeys;
275
+ /**
276
+ * Shift key
277
+ */
278
+ static readonly SHIFT: ModifierKeys;
279
+ /**
280
+ * Control key (Ctrl)
281
+ */
282
+ static readonly CONTROL: ModifierKeys;
283
+ }
284
+
199
285
  export class MouseEvent {
200
286
  private constructor();
201
287
  free(): void;
@@ -228,6 +314,10 @@ export class MouseEvent {
228
314
  * Whether Alt key was pressed
229
315
  */
230
316
  alt_key: boolean;
317
+ /**
318
+ * Whether Meta key was pressed (Command on macOS, Windows key on Windows)
319
+ */
320
+ meta_key: boolean;
231
321
  }
232
322
 
233
323
  /**
@@ -247,8 +247,8 @@ function wasm_bindgen__convert__closures_____invoke__hbee1b5e623a87165(arg0, arg
247
247
  wasm.wasm_bindgen__convert__closures_____invoke__hbee1b5e623a87165(arg0, arg1, arg2);
248
248
  }
249
249
 
250
- function wasm_bindgen__convert__closures_____invoke__h4d1e7414f3e2b484(arg0, arg1, arg2) {
251
- wasm.wasm_bindgen__convert__closures_____invoke__h4d1e7414f3e2b484(arg0, arg1, arg2);
250
+ function wasm_bindgen__convert__closures_____invoke__h9fc62350024edcc7(arg0, arg1, arg2) {
251
+ wasm.wasm_bindgen__convert__closures_____invoke__h9fc62350024edcc7(arg0, arg1, arg2);
252
252
  }
253
253
 
254
254
  const BatchFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -271,6 +271,10 @@ const CellStyleFinalization = (typeof FinalizationRegistry === 'undefined')
271
271
  ? { register: () => {}, unregister: () => {} }
272
272
  : new FinalizationRegistry(ptr => wasm.__wbg_cellstyle_free(ptr >>> 0, 1));
273
273
 
274
+ const ModifierKeysFinalization = (typeof FinalizationRegistry === 'undefined')
275
+ ? { register: () => {}, unregister: () => {} }
276
+ : new FinalizationRegistry(ptr => wasm.__wbg_modifierkeys_free(ptr >>> 0, 1));
277
+
274
278
  const MouseEventFinalization = (typeof FinalizationRegistry === 'undefined')
275
279
  ? { register: () => {}, unregister: () => {} }
276
280
  : new FinalizationRegistry(ptr => wasm.__wbg_mouseevent_free(ptr >>> 0, 1));
@@ -428,19 +432,12 @@ export class BeamtermRenderer {
428
432
  wasm.beamtermrenderer_clearSelection(this.__wbg_ptr);
429
433
  }
430
434
  /**
431
- * Enable default mouse selection behavior with built-in copy to clipboard.
432
- *
433
- * # Arguments
434
- * * `mode` - Selection mode (Linear or Block)
435
- * * `trim_whitespace` - Whether to trim trailing whitespace from selections
436
- * * `drag_threshold_ms` - Optional minimum time (ms) before drag activates selection.
437
- * Defaults to 200ms. Higher values prevent accidental selections during fast gestures.
435
+ * Enable default mouse selection behavior with built-in copy to clipboard
438
436
  * @param {SelectionMode} mode
439
437
  * @param {boolean} trim_whitespace
440
- * @param {number | null} [drag_threshold_ms]
441
438
  */
442
- enableSelection(mode, trim_whitespace, drag_threshold_ms) {
443
- const ret = wasm.beamtermrenderer_enableSelection(this.__wbg_ptr, mode, trim_whitespace, !isLikeNone(drag_threshold_ms), isLikeNone(drag_threshold_ms) ? 0 : drag_threshold_ms);
439
+ enableSelection(mode, trim_whitespace) {
440
+ const ret = wasm.beamtermrenderer_enableSelection(this.__wbg_ptr, mode, trim_whitespace);
444
441
  if (ret[1]) {
445
442
  throw takeFromExternrefTable0(ret[0]);
446
443
  }
@@ -524,6 +521,90 @@ export class BeamtermRenderer {
524
521
  }
525
522
  return BeamtermRenderer.__wrap(ret[0]);
526
523
  }
524
+ /**
525
+ * Replace the current font atlas with a new static atlas.
526
+ *
527
+ * This method enables runtime font switching by loading a new `.atlas` file.
528
+ * All existing cell content is preserved and translated to the new atlas.
529
+ *
530
+ * # Arguments
531
+ * * `atlas_data` - Binary atlas data (from .atlas file), or null for default
532
+ *
533
+ * # Example
534
+ * ```javascript
535
+ * const atlasData = await fetch('new-font.atlas').then(r => r.arrayBuffer());
536
+ * renderer.replaceWithStaticAtlas(new Uint8Array(atlasData));
537
+ * ```
538
+ * @param {Uint8Array | null} [atlas_data]
539
+ */
540
+ replaceWithStaticAtlas(atlas_data) {
541
+ const ret = wasm.beamtermrenderer_replaceWithStaticAtlas(this.__wbg_ptr, isLikeNone(atlas_data) ? 0 : addToExternrefTable0(atlas_data));
542
+ if (ret[1]) {
543
+ throw takeFromExternrefTable0(ret[0]);
544
+ }
545
+ }
546
+ /**
547
+ * Replace the current font atlas with a new dynamic atlas.
548
+ *
549
+ * This method enables runtime font switching by creating a new dynamic atlas
550
+ * with the specified font family and size. All existing cell content is
551
+ * preserved and translated to the new atlas.
552
+ *
553
+ * # Arguments
554
+ * * `font_family` - Array of font family names (e.g., `["Hack", "JetBrains Mono"]`)
555
+ * * `font_size` - Font size in pixels
556
+ *
557
+ * # Example
558
+ * ```javascript
559
+ * renderer.replaceWithDynamicAtlas(["Fira Code", "monospace"], 18.0);
560
+ * ```
561
+ * @param {Array<any>} font_family
562
+ * @param {number} font_size
563
+ */
564
+ replaceWithDynamicAtlas(font_family, font_size) {
565
+ const ret = wasm.beamtermrenderer_replaceWithDynamicAtlas(this.__wbg_ptr, font_family, font_size);
566
+ if (ret[1]) {
567
+ throw takeFromExternrefTable0(ret[0]);
568
+ }
569
+ }
570
+ /**
571
+ * Enable mouse selection with full configuration options.
572
+ *
573
+ * This method allows specifying modifier keys that must be held for selection
574
+ * to activate, in addition to the selection mode and whitespace trimming.
575
+ *
576
+ * # Arguments
577
+ * * `mode` - Selection mode (Block or Linear)
578
+ * * `trim_whitespace` - Whether to trim trailing whitespace from selected text
579
+ * * `require_modifiers` - Modifier keys that must be held to start selection
580
+ *
581
+ * # Example
582
+ * ```javascript
583
+ * // Require Shift+Click to start selection
584
+ * renderer.enableSelectionWithOptions(
585
+ * SelectionMode.Linear,
586
+ * true,
587
+ * ModifierKeys.SHIFT
588
+ * );
589
+ *
590
+ * // Require Ctrl+Shift+Click
591
+ * renderer.enableSelectionWithOptions(
592
+ * SelectionMode.Block,
593
+ * false,
594
+ * ModifierKeys.CONTROL.or(ModifierKeys.SHIFT)
595
+ * );
596
+ * ```
597
+ * @param {SelectionMode} mode
598
+ * @param {boolean} trim_whitespace
599
+ * @param {ModifierKeys} require_modifiers
600
+ */
601
+ enableSelectionWithOptions(mode, trim_whitespace, require_modifiers) {
602
+ _assertClass(require_modifiers, ModifierKeys);
603
+ const ret = wasm.beamtermrenderer_enableSelectionWithOptions(this.__wbg_ptr, mode, trim_whitespace, require_modifiers.__wbg_ptr);
604
+ if (ret[1]) {
605
+ throw takeFromExternrefTable0(ret[0]);
606
+ }
607
+ }
527
608
  /**
528
609
  * Create a new terminal renderer with the default embedded font atlas.
529
610
  * @param {string} canvas_id
@@ -852,6 +933,86 @@ export class CellStyle {
852
933
  }
853
934
  if (Symbol.dispose) CellStyle.prototype[Symbol.dispose] = CellStyle.prototype.free;
854
935
 
936
+ /**
937
+ * Modifier key flags for mouse selection.
938
+ *
939
+ * Use bitwise OR to combine multiple modifiers:
940
+ * ```javascript
941
+ * const modifiers = ModifierKeys.SHIFT | ModifierKeys.CONTROL;
942
+ * renderer.enableSelectionWithOptions(SelectionMode.Block, true, modifiers);
943
+ * ```
944
+ */
945
+ export class ModifierKeys {
946
+ static __wrap(ptr) {
947
+ ptr = ptr >>> 0;
948
+ const obj = Object.create(ModifierKeys.prototype);
949
+ obj.__wbg_ptr = ptr;
950
+ ModifierKeysFinalization.register(obj, obj.__wbg_ptr, obj);
951
+ return obj;
952
+ }
953
+ __destroy_into_raw() {
954
+ const ptr = this.__wbg_ptr;
955
+ this.__wbg_ptr = 0;
956
+ ModifierKeysFinalization.unregister(this);
957
+ return ptr;
958
+ }
959
+ free() {
960
+ const ptr = this.__destroy_into_raw();
961
+ wasm.__wbg_modifierkeys_free(ptr, 0);
962
+ }
963
+ /**
964
+ * Combines two modifier key sets using bitwise OR
965
+ * @param {ModifierKeys} other
966
+ * @returns {ModifierKeys}
967
+ */
968
+ or(other) {
969
+ _assertClass(other, ModifierKeys);
970
+ const ret = wasm.modifierkeys_or(this.__wbg_ptr, other.__wbg_ptr);
971
+ return ModifierKeys.__wrap(ret);
972
+ }
973
+ /**
974
+ * Alt key (Option on macOS)
975
+ * @returns {ModifierKeys}
976
+ */
977
+ static get ALT() {
978
+ const ret = wasm.modifierkeys_ALT();
979
+ return ModifierKeys.__wrap(ret);
980
+ }
981
+ /**
982
+ * Meta key (Command on macOS, Windows key on Windows)
983
+ * @returns {ModifierKeys}
984
+ */
985
+ static get META() {
986
+ const ret = wasm.modifierkeys_META();
987
+ return ModifierKeys.__wrap(ret);
988
+ }
989
+ /**
990
+ * No modifier keys required
991
+ * @returns {ModifierKeys}
992
+ */
993
+ static get NONE() {
994
+ const ret = wasm.modifierkeys_NONE();
995
+ return ModifierKeys.__wrap(ret);
996
+ }
997
+ /**
998
+ * Shift key
999
+ * @returns {ModifierKeys}
1000
+ */
1001
+ static get SHIFT() {
1002
+ const ret = wasm.modifierkeys_SHIFT();
1003
+ return ModifierKeys.__wrap(ret);
1004
+ }
1005
+ /**
1006
+ * Control key (Ctrl)
1007
+ * @returns {ModifierKeys}
1008
+ */
1009
+ static get CONTROL() {
1010
+ const ret = wasm.modifierkeys_CONTROL();
1011
+ return ModifierKeys.__wrap(ret);
1012
+ }
1013
+ }
1014
+ if (Symbol.dispose) ModifierKeys.prototype[Symbol.dispose] = ModifierKeys.prototype.free;
1015
+
855
1016
  /**
856
1017
  * Mouse event data with terminal coordinates
857
1018
  */
@@ -978,6 +1139,21 @@ export class MouseEvent {
978
1139
  set alt_key(arg0) {
979
1140
  wasm.__wbg_set_mouseevent_alt_key(this.__wbg_ptr, arg0);
980
1141
  }
1142
+ /**
1143
+ * Whether Meta key was pressed (Command on macOS, Windows key on Windows)
1144
+ * @returns {boolean}
1145
+ */
1146
+ get meta_key() {
1147
+ const ret = wasm.__wbg_get_mouseevent_meta_key(this.__wbg_ptr);
1148
+ return ret !== 0;
1149
+ }
1150
+ /**
1151
+ * Whether Meta key was pressed (Command on macOS, Windows key on Windows)
1152
+ * @param {boolean} arg0
1153
+ */
1154
+ set meta_key(arg0) {
1155
+ wasm.__wbg_set_mouseevent_meta_key(this.__wbg_ptr, arg0);
1156
+ }
981
1157
  }
982
1158
  if (Symbol.dispose) MouseEvent.prototype[Symbol.dispose] = MouseEvent.prototype.free;
983
1159
 
@@ -1312,6 +1488,10 @@ export function __wbg_bufferData_ca0a87aa6811791d(arg0, arg1, arg2, arg3, arg4)
1312
1488
  arg0.bufferData(arg1 >>> 0, getArrayU8FromWasm0(arg2, arg3), arg4 >>> 0);
1313
1489
  };
1314
1490
 
1491
+ export function __wbg_bufferSubData_16db9d7d9f1c86bb(arg0, arg1, arg2, arg3) {
1492
+ arg0.bufferSubData(arg1 >>> 0, arg2, arg3);
1493
+ };
1494
+
1315
1495
  export function __wbg_button_a54acd25bab5d442(arg0) {
1316
1496
  const ret = arg0.button;
1317
1497
  return ret;
@@ -1611,6 +1791,11 @@ export function __wbg_log_1d990106d99dacb7(arg0) {
1611
1791
  console.log(arg0);
1612
1792
  };
1613
1793
 
1794
+ export function __wbg_metaKey_448c751accad2eba(arg0) {
1795
+ const ret = arg0.metaKey;
1796
+ return ret;
1797
+ };
1798
+
1614
1799
  export function __wbg_mouseevent_new(arg0) {
1615
1800
  const ret = MouseEvent.__wrap(arg0);
1616
1801
  return ret;
@@ -1661,11 +1846,6 @@ export function __wbg_next_3cfe5c0fe2a4cc53() { return handleError(function (arg
1661
1846
  return ret;
1662
1847
  }, arguments) };
1663
1848
 
1664
- export function __wbg_now_8cf15d6e317793e1(arg0) {
1665
- const ret = arg0.now();
1666
- return ret;
1667
- };
1668
-
1669
1849
  export function __wbg_offsetX_cef943cf53ab2b5a(arg0) {
1670
1850
  const ret = arg0.offsetX;
1671
1851
  return ret;
@@ -1676,11 +1856,6 @@ export function __wbg_offsetY_9a093457f71ef493(arg0) {
1676
1856
  return ret;
1677
1857
  };
1678
1858
 
1679
- export function __wbg_performance_c77a440eff2efd9b(arg0) {
1680
- const ret = arg0.performance;
1681
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1682
- };
1683
-
1684
1859
  export function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) {
1685
1860
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1686
1861
  };
@@ -1861,24 +2036,18 @@ export function __wbg_writeText_c9776abb6826901c(arg0, arg1, arg2) {
1861
2036
  return ret;
1862
2037
  };
1863
2038
 
1864
- export function __wbindgen_cast_146fd35f906c65cd(arg0, arg1) {
1865
- // Cast intrinsic for `Closure(Closure { dtor_idx: 111, function: Function { arguments: [Externref], shim_idx: 112, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1866
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h128802127193e191, wasm_bindgen__convert__closures_____invoke__hbee1b5e623a87165);
1867
- return ret;
1868
- };
1869
-
1870
- export function __wbindgen_cast_195a282855cb0b65(arg0, arg1) {
1871
- // Cast intrinsic for `Closure(Closure { dtor_idx: 61, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 62, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1872
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h63d9d38af9217a8f, wasm_bindgen__convert__closures_____invoke__h4d1e7414f3e2b484);
1873
- return ret;
1874
- };
1875
-
1876
2039
  export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
1877
2040
  // Cast intrinsic for `Ref(String) -> Externref`.
1878
2041
  const ret = getStringFromWasm0(arg0, arg1);
1879
2042
  return ret;
1880
2043
  };
1881
2044
 
2045
+ export function __wbindgen_cast_5f9a13552260be22(arg0, arg1) {
2046
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 112, function: Function { arguments: [Externref], shim_idx: 113, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2047
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h128802127193e191, wasm_bindgen__convert__closures_____invoke__hbee1b5e623a87165);
2048
+ return ret;
2049
+ };
2050
+
1882
2051
  export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
1883
2052
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1884
2053
  const ret = getArrayU8FromWasm0(arg0, arg1);
@@ -1897,6 +2066,12 @@ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
1897
2066
  return ret;
1898
2067
  };
1899
2068
 
2069
+ export function __wbindgen_cast_dac1fd37d8c7b8e4(arg0, arg1) {
2070
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 27, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 28, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2071
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4e834c369ab09e90, wasm_bindgen__convert__closures_____invoke__h9fc62350024edcc7);
2072
+ return ret;
2073
+ };
2074
+
1900
2075
  export function __wbindgen_init_externref_table() {
1901
2076
  const table = wasm.__wbindgen_externrefs;
1902
2077
  const offset = table.grow(4);
Binary file
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "Adrian Papari <junkdog@angelhill.net>",
6
6
  "kofany <j@dabrowski.biz>"
7
7
  ],
8
- "description": "WebGL2 terminal renderer (terX fork with HiDPI selection fix)",
9
- "version": "0.12.1",
8
+ "description": "High-performance WebGL2 terminal renderer for beamterm, targeting sub-millisecond render times in web browsers",
9
+ "version": "0.12.2",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "beamterm_renderer.d.ts"
23
23
  ],
24
24
  "main": "beamterm_renderer.js",
25
- "homepage": "https://github.com/junkdog/beamterm",
25
+ "homepage": "https://github.com/kofany/beamterm",
26
26
  "types": "beamterm_renderer.d.ts",
27
27
  "sideEffects": [
28
28
  "./beamterm_renderer.js",
@@ -35,4 +35,4 @@
35
35
  "rendering",
36
36
  "gpu"
37
37
  ]
38
- }
38
+ }