phirepass-widgets 0.0.38 → 0.0.40

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_a824d39613a69e2e: 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) {
@@ -601,7 +601,7 @@ function __wbg_get_imports() {
601
601
  __wbg_set_onopen_7ffeb01f8a628209: function(arg0, arg1) {
602
602
  getObject(arg0).onopen = getObject(arg1);
603
603
  },
604
- __wbg_warn_a05f18037e80c870: function(arg0, arg1) {
604
+ __wbg_warn_d8fb60272adc4bb8: function(arg0, arg1) {
605
605
  console.warn(getStringFromWasm0(arg0, arg1));
606
606
  },
607
607
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -620,8 +620,8 @@ function __wbg_get_imports() {
620
620
  return addHeapObject(ret);
621
621
  },
622
622
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
623
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
624
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_43);
623
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
624
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42);
625
625
  return addHeapObject(ret);
626
626
  },
627
627
  __wbindgen_cast_0000000000000005: function(arg0) {
@@ -658,8 +658,8 @@ function __wbg_get_imports() {
658
658
  };
659
659
  }
660
660
 
661
- function __wasm_bindgen_func_elem_43(arg0, arg1) {
662
- wasm.__wasm_bindgen_func_elem_43(arg0, arg1);
661
+ function __wasm_bindgen_func_elem_42(arg0, arg1) {
662
+ wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
663
663
  }
664
664
 
665
665
  function __wasm_bindgen_func_elem_39(arg0, arg1, arg2) {
@@ -1129,6 +1129,10 @@ const PhirepassTerminal = class {
1129
1129
  this.try_connect();
1130
1130
  }
1131
1131
  async disconnectedCallback() {
1132
+ if (this.resizeDebounceHandle) {
1133
+ clearTimeout(this.resizeDebounceHandle);
1134
+ this.resizeDebounceHandle = undefined;
1135
+ }
1132
1136
  if (this.resizeObserver) {
1133
1137
  this.resizeObserver.disconnect();
1134
1138
  }
@@ -1138,6 +1142,20 @@ const PhirepassTerminal = class {
1138
1142
  this.close_comms();
1139
1143
  this.destroy_terminal();
1140
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
+ }
1141
1159
  try_connect() {
1142
1160
  if (this.connected || !this.domReady || !this.runtimeReady) {
1143
1161
  return;
@@ -1245,7 +1263,7 @@ const PhirepassTerminal = class {
1245
1263
  console.warn('Cannot send terminal resize: session_id is missing');
1246
1264
  return;
1247
1265
  }
1248
- this.fitAddon.fit();
1266
+ this.fit_terminal_safely();
1249
1267
  const cols = this.terminal?.cols ?? 0;
1250
1268
  const rows = this.terminal?.rows ?? 0;
1251
1269
  const px_width = this.containerEl.clientWidth ?? 0;
@@ -1323,7 +1341,7 @@ const PhirepassTerminal = class {
1323
1341
  handle_tunnel_opened(web) {
1324
1342
  this.session_id = web.sid;
1325
1343
  this.terminal.reset();
1326
- this.fitAddon.fit();
1344
+ this.fit_terminal_safely();
1327
1345
  this.send_ssh_terminal_resize();
1328
1346
  }
1329
1347
  handle_tunnel_data(web) {
@@ -1343,12 +1361,12 @@ const PhirepassTerminal = class {
1343
1361
  if (container) {
1344
1362
  this.terminal.open(container);
1345
1363
  console.log('Terminal opened in container');
1346
- this.fitAddon.fit();
1364
+ this.connected = true;
1365
+ this.fit_terminal_safely();
1347
1366
  this.terminal.focus();
1348
1367
  this.terminal.onData(this.handle_terminal_data.bind(this));
1349
1368
  this.channel.connect();
1350
1369
  this.setup_resize_observer();
1351
- this.connected = true;
1352
1370
  console.log('Terminal connected and ready');
1353
1371
  }
1354
1372
  }
@@ -1359,7 +1377,7 @@ const PhirepassTerminal = class {
1359
1377
  clearTimeout(this.resizeDebounceHandle);
1360
1378
  }
1361
1379
  this.resizeDebounceHandle = setTimeout(() => {
1362
- this.fitAddon.fit();
1380
+ this.fit_terminal_safely();
1363
1381
  this.send_ssh_terminal_resize();
1364
1382
  }, 100);
1365
1383
  });
@@ -1458,7 +1476,7 @@ const PhirepassTerminal = class {
1458
1476
  this.usernameBuffer = "";
1459
1477
  }
1460
1478
  render() {
1461
- 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) })));
1462
1480
  }
1463
1481
  static get watchers() { return {
1464
1482
  "nodeId": [{