phirepass-widgets 0.0.37 → 0.0.39

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.
@@ -529,7 +529,7 @@ function __wbg_get_imports() {
529
529
  const ret = Array.from(getObject(arg0));
530
530
  return addHeapObject(ret);
531
531
  },
532
- __wbg_info_a52c6d8366fb49c2: function(arg0, arg1) {
532
+ __wbg_info_38afa9e6e86ac5a5: function(arg0, arg1) {
533
533
  console.info(getStringFromWasm0(arg0, arg1));
534
534
  },
535
535
  __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
@@ -558,13 +558,17 @@ function __wbg_get_imports() {
558
558
  const ret = new Array();
559
559
  return addHeapObject(ret);
560
560
  },
561
- __wbg_new_with_str_7cf464e6e0f54ec2: function() { return handleError(function (arg0, arg1, arg2, arg3) {
562
- const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
561
+ __wbg_new_with_str_sequence_e6b5bb982fdcf253: function() { return handleError(function (arg0, arg1, arg2) {
562
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
563
563
  return addHeapObject(ret);
564
564
  }, arguments); },
565
565
  __wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
566
566
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
567
567
  },
568
+ __wbg_push_6bdbc990be5ac37b: function(arg0, arg1) {
569
+ const ret = getObject(arg0).push(getObject(arg1));
570
+ return ret;
571
+ },
568
572
  __wbg_readyState_631d9f7c37e595d7: function(arg0) {
569
573
  const ret = getObject(arg0).readyState;
570
574
  return ret;
@@ -597,26 +601,26 @@ function __wbg_get_imports() {
597
601
  __wbg_set_onopen_7ffeb01f8a628209: function(arg0, arg1) {
598
602
  getObject(arg0).onopen = getObject(arg1);
599
603
  },
600
- __wbg_warn_19b8f2420663d61d: function(arg0, arg1) {
604
+ __wbg_warn_d8fb60272adc4bb8: function(arg0, arg1) {
601
605
  console.warn(getStringFromWasm0(arg0, arg1));
602
606
  },
603
607
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
604
608
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
605
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38);
609
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39);
606
610
  return addHeapObject(ret);
607
611
  },
608
612
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
609
613
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
610
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38_1);
614
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39_1);
611
615
  return addHeapObject(ret);
612
616
  },
613
617
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
614
618
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
615
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38_2);
619
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39_2);
616
620
  return addHeapObject(ret);
617
621
  },
618
622
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
619
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
623
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
620
624
  const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42);
621
625
  return addHeapObject(ret);
622
626
  },
@@ -658,16 +662,16 @@ function __wasm_bindgen_func_elem_42(arg0, arg1) {
658
662
  wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
659
663
  }
660
664
 
661
- function __wasm_bindgen_func_elem_38(arg0, arg1, arg2) {
662
- wasm.__wasm_bindgen_func_elem_38(arg0, arg1, addHeapObject(arg2));
665
+ function __wasm_bindgen_func_elem_39(arg0, arg1, arg2) {
666
+ wasm.__wasm_bindgen_func_elem_39(arg0, arg1, addHeapObject(arg2));
663
667
  }
664
668
 
665
- function __wasm_bindgen_func_elem_38_1(arg0, arg1, arg2) {
666
- wasm.__wasm_bindgen_func_elem_38_1(arg0, arg1, addHeapObject(arg2));
669
+ function __wasm_bindgen_func_elem_39_1(arg0, arg1, arg2) {
670
+ wasm.__wasm_bindgen_func_elem_39_1(arg0, arg1, addHeapObject(arg2));
667
671
  }
668
672
 
669
- function __wasm_bindgen_func_elem_38_2(arg0, arg1, arg2) {
670
- wasm.__wasm_bindgen_func_elem_38_2(arg0, arg1, addHeapObject(arg2));
673
+ function __wasm_bindgen_func_elem_39_2(arg0, arg1, arg2) {
674
+ wasm.__wasm_bindgen_func_elem_39_2(arg0, arg1, addHeapObject(arg2));
671
675
  }
672
676
 
673
677
 
@@ -1125,6 +1129,10 @@ const PhirepassTerminal = class {
1125
1129
  this.try_connect();
1126
1130
  }
1127
1131
  async disconnectedCallback() {
1132
+ if (this.resizeDebounceHandle) {
1133
+ clearTimeout(this.resizeDebounceHandle);
1134
+ this.resizeDebounceHandle = undefined;
1135
+ }
1128
1136
  if (this.resizeObserver) {
1129
1137
  this.resizeObserver.disconnect();
1130
1138
  }
@@ -1134,6 +1142,20 @@ const PhirepassTerminal = class {
1134
1142
  this.close_comms();
1135
1143
  this.destroy_terminal();
1136
1144
  }
1145
+ is_terminal_open() {
1146
+ return Boolean(this.connected && this.containerEl && this.terminal.element);
1147
+ }
1148
+ fit_terminal_safely() {
1149
+ if (!this.fitAddon || !this.is_terminal_open()) {
1150
+ return;
1151
+ }
1152
+ try {
1153
+ this.fitAddon.fit();
1154
+ }
1155
+ catch (err) {
1156
+ console.warn('Skipping terminal fit before renderer is ready:', err);
1157
+ }
1158
+ }
1137
1159
  try_connect() {
1138
1160
  if (this.connected || !this.domReady || !this.runtimeReady) {
1139
1161
  return;
@@ -1241,7 +1263,7 @@ const PhirepassTerminal = class {
1241
1263
  console.warn('Cannot send terminal resize: session_id is missing');
1242
1264
  return;
1243
1265
  }
1244
- this.fitAddon.fit();
1266
+ this.fit_terminal_safely();
1245
1267
  const cols = this.terminal?.cols ?? 0;
1246
1268
  const rows = this.terminal?.rows ?? 0;
1247
1269
  const px_width = this.containerEl.clientWidth ?? 0;
@@ -1319,7 +1341,7 @@ const PhirepassTerminal = class {
1319
1341
  handle_tunnel_opened(web) {
1320
1342
  this.session_id = web.sid;
1321
1343
  this.terminal.reset();
1322
- this.fitAddon.fit();
1344
+ this.fit_terminal_safely();
1323
1345
  this.send_ssh_terminal_resize();
1324
1346
  }
1325
1347
  handle_tunnel_data(web) {
@@ -1339,12 +1361,12 @@ const PhirepassTerminal = class {
1339
1361
  if (container) {
1340
1362
  this.terminal.open(container);
1341
1363
  console.log('Terminal opened in container');
1342
- this.fitAddon.fit();
1364
+ this.connected = true;
1365
+ this.fit_terminal_safely();
1343
1366
  this.terminal.focus();
1344
1367
  this.terminal.onData(this.handle_terminal_data.bind(this));
1345
1368
  this.channel.connect();
1346
1369
  this.setup_resize_observer();
1347
- this.connected = true;
1348
1370
  console.log('Terminal connected and ready');
1349
1371
  }
1350
1372
  }
@@ -1355,7 +1377,7 @@ const PhirepassTerminal = class {
1355
1377
  clearTimeout(this.resizeDebounceHandle);
1356
1378
  }
1357
1379
  this.resizeDebounceHandle = setTimeout(() => {
1358
- this.fitAddon.fit();
1380
+ this.fit_terminal_safely();
1359
1381
  this.send_ssh_terminal_resize();
1360
1382
  }, 100);
1361
1383
  });
@@ -1454,7 +1476,7 @@ const PhirepassTerminal = class {
1454
1476
  this.usernameBuffer = "";
1455
1477
  }
1456
1478
  render() {
1457
- return (h$1(Host, { key: '2abcfab709121bce05b034d345c4e5ae72e9d48d' }, h$1("div", { key: 'a155b05f943f1ee2a9f001316474df9d33b1a0ef', id: "ccc", ref: el => (this.containerEl = el) })));
1479
+ return (h$1(Host, { key: 'e56bf0b0f8825571a341588cfc4c99432d056eb6' }, h$1("div", { key: '91e2d8d168fac1c488059ba0b42da089d0b2bf30', id: "ccc", ref: el => (this.containerEl = el) })));
1458
1480
  }
1459
1481
  static get watchers() { return {
1460
1482
  "nodeId": [{