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.
@@ -532,7 +532,7 @@ function __wbg_get_imports() {
532
532
  const ret = Array.from(getObject(arg0));
533
533
  return addHeapObject(ret);
534
534
  },
535
- __wbg_info_a52c6d8366fb49c2: function(arg0, arg1) {
535
+ __wbg_info_38afa9e6e86ac5a5: function(arg0, arg1) {
536
536
  console.info(getStringFromWasm0(arg0, arg1));
537
537
  },
538
538
  __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
@@ -561,13 +561,17 @@ function __wbg_get_imports() {
561
561
  const ret = new Array();
562
562
  return addHeapObject(ret);
563
563
  },
564
- __wbg_new_with_str_7cf464e6e0f54ec2: function() { return handleError(function (arg0, arg1, arg2, arg3) {
565
- const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
564
+ __wbg_new_with_str_sequence_e6b5bb982fdcf253: function() { return handleError(function (arg0, arg1, arg2) {
565
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
566
566
  return addHeapObject(ret);
567
567
  }, arguments); },
568
568
  __wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
569
569
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
570
570
  },
571
+ __wbg_push_6bdbc990be5ac37b: function(arg0, arg1) {
572
+ const ret = getObject(arg0).push(getObject(arg1));
573
+ return ret;
574
+ },
571
575
  __wbg_readyState_631d9f7c37e595d7: function(arg0) {
572
576
  const ret = getObject(arg0).readyState;
573
577
  return ret;
@@ -600,26 +604,26 @@ function __wbg_get_imports() {
600
604
  __wbg_set_onopen_7ffeb01f8a628209: function(arg0, arg1) {
601
605
  getObject(arg0).onopen = getObject(arg1);
602
606
  },
603
- __wbg_warn_19b8f2420663d61d: function(arg0, arg1) {
607
+ __wbg_warn_d8fb60272adc4bb8: function(arg0, arg1) {
604
608
  console.warn(getStringFromWasm0(arg0, arg1));
605
609
  },
606
610
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
607
611
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
608
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38);
612
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39);
609
613
  return addHeapObject(ret);
610
614
  },
611
615
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
612
616
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
613
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38_1);
617
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39_1);
614
618
  return addHeapObject(ret);
615
619
  },
616
620
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
617
621
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
618
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_38_2);
622
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39_2);
619
623
  return addHeapObject(ret);
620
624
  },
621
625
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
622
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
626
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
623
627
  const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42);
624
628
  return addHeapObject(ret);
625
629
  },
@@ -661,16 +665,16 @@ function __wasm_bindgen_func_elem_42(arg0, arg1) {
661
665
  wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
662
666
  }
663
667
 
664
- function __wasm_bindgen_func_elem_38(arg0, arg1, arg2) {
665
- wasm.__wasm_bindgen_func_elem_38(arg0, arg1, addHeapObject(arg2));
668
+ function __wasm_bindgen_func_elem_39(arg0, arg1, arg2) {
669
+ wasm.__wasm_bindgen_func_elem_39(arg0, arg1, addHeapObject(arg2));
666
670
  }
667
671
 
668
- function __wasm_bindgen_func_elem_38_1(arg0, arg1, arg2) {
669
- wasm.__wasm_bindgen_func_elem_38_1(arg0, arg1, addHeapObject(arg2));
672
+ function __wasm_bindgen_func_elem_39_1(arg0, arg1, arg2) {
673
+ wasm.__wasm_bindgen_func_elem_39_1(arg0, arg1, addHeapObject(arg2));
670
674
  }
671
675
 
672
- function __wasm_bindgen_func_elem_38_2(arg0, arg1, arg2) {
673
- wasm.__wasm_bindgen_func_elem_38_2(arg0, arg1, addHeapObject(arg2));
676
+ function __wasm_bindgen_func_elem_39_2(arg0, arg1, arg2) {
677
+ wasm.__wasm_bindgen_func_elem_39_2(arg0, arg1, addHeapObject(arg2));
674
678
  }
675
679
 
676
680
 
@@ -1128,6 +1132,10 @@ const PhirepassTerminal = class {
1128
1132
  this.try_connect();
1129
1133
  }
1130
1134
  async disconnectedCallback() {
1135
+ if (this.resizeDebounceHandle) {
1136
+ clearTimeout(this.resizeDebounceHandle);
1137
+ this.resizeDebounceHandle = undefined;
1138
+ }
1131
1139
  if (this.resizeObserver) {
1132
1140
  this.resizeObserver.disconnect();
1133
1141
  }
@@ -1137,6 +1145,20 @@ const PhirepassTerminal = class {
1137
1145
  this.close_comms();
1138
1146
  this.destroy_terminal();
1139
1147
  }
1148
+ is_terminal_open() {
1149
+ return Boolean(this.connected && this.containerEl && this.terminal.element);
1150
+ }
1151
+ fit_terminal_safely() {
1152
+ if (!this.fitAddon || !this.is_terminal_open()) {
1153
+ return;
1154
+ }
1155
+ try {
1156
+ this.fitAddon.fit();
1157
+ }
1158
+ catch (err) {
1159
+ console.warn('Skipping terminal fit before renderer is ready:', err);
1160
+ }
1161
+ }
1140
1162
  try_connect() {
1141
1163
  if (this.connected || !this.domReady || !this.runtimeReady) {
1142
1164
  return;
@@ -1244,7 +1266,7 @@ const PhirepassTerminal = class {
1244
1266
  console.warn('Cannot send terminal resize: session_id is missing');
1245
1267
  return;
1246
1268
  }
1247
- this.fitAddon.fit();
1269
+ this.fit_terminal_safely();
1248
1270
  const cols = this.terminal?.cols ?? 0;
1249
1271
  const rows = this.terminal?.rows ?? 0;
1250
1272
  const px_width = this.containerEl.clientWidth ?? 0;
@@ -1322,7 +1344,7 @@ const PhirepassTerminal = class {
1322
1344
  handle_tunnel_opened(web) {
1323
1345
  this.session_id = web.sid;
1324
1346
  this.terminal.reset();
1325
- this.fitAddon.fit();
1347
+ this.fit_terminal_safely();
1326
1348
  this.send_ssh_terminal_resize();
1327
1349
  }
1328
1350
  handle_tunnel_data(web) {
@@ -1342,12 +1364,12 @@ const PhirepassTerminal = class {
1342
1364
  if (container) {
1343
1365
  this.terminal.open(container);
1344
1366
  console.log('Terminal opened in container');
1345
- this.fitAddon.fit();
1367
+ this.connected = true;
1368
+ this.fit_terminal_safely();
1346
1369
  this.terminal.focus();
1347
1370
  this.terminal.onData(this.handle_terminal_data.bind(this));
1348
1371
  this.channel.connect();
1349
1372
  this.setup_resize_observer();
1350
- this.connected = true;
1351
1373
  console.log('Terminal connected and ready');
1352
1374
  }
1353
1375
  }
@@ -1358,7 +1380,7 @@ const PhirepassTerminal = class {
1358
1380
  clearTimeout(this.resizeDebounceHandle);
1359
1381
  }
1360
1382
  this.resizeDebounceHandle = setTimeout(() => {
1361
- this.fitAddon.fit();
1383
+ this.fit_terminal_safely();
1362
1384
  this.send_ssh_terminal_resize();
1363
1385
  }, 100);
1364
1386
  });
@@ -1457,7 +1479,7 @@ const PhirepassTerminal = class {
1457
1479
  this.usernameBuffer = "";
1458
1480
  }
1459
1481
  render() {
1460
- return (index.h(index.Host, { key: '2abcfab709121bce05b034d345c4e5ae72e9d48d' }, index.h("div", { key: 'a155b05f943f1ee2a9f001316474df9d33b1a0ef', id: "ccc", ref: el => (this.containerEl = el) })));
1482
+ return (index.h(index.Host, { key: 'e56bf0b0f8825571a341588cfc4c99432d056eb6' }, index.h("div", { key: '91e2d8d168fac1c488059ba0b42da089d0b2bf30', id: "ccc", ref: el => (this.containerEl = el) })));
1461
1483
  }
1462
1484
  static get watchers() { return {
1463
1485
  "nodeId": [{
@@ -146,6 +146,10 @@ export class PhirepassTerminal {
146
146
  this.try_connect();
147
147
  }
148
148
  async disconnectedCallback() {
149
+ if (this.resizeDebounceHandle) {
150
+ clearTimeout(this.resizeDebounceHandle);
151
+ this.resizeDebounceHandle = undefined;
152
+ }
149
153
  if (this.resizeObserver) {
150
154
  this.resizeObserver.disconnect();
151
155
  }
@@ -155,6 +159,20 @@ export class PhirepassTerminal {
155
159
  this.close_comms();
156
160
  this.destroy_terminal();
157
161
  }
162
+ is_terminal_open() {
163
+ return Boolean(this.connected && this.containerEl && this.terminal.element);
164
+ }
165
+ fit_terminal_safely() {
166
+ if (!this.fitAddon || !this.is_terminal_open()) {
167
+ return;
168
+ }
169
+ try {
170
+ this.fitAddon.fit();
171
+ }
172
+ catch (err) {
173
+ console.warn('Skipping terminal fit before renderer is ready:', err);
174
+ }
175
+ }
158
176
  try_connect() {
159
177
  if (this.connected || !this.domReady || !this.runtimeReady) {
160
178
  return;
@@ -262,7 +280,7 @@ export class PhirepassTerminal {
262
280
  console.warn('Cannot send terminal resize: session_id is missing');
263
281
  return;
264
282
  }
265
- this.fitAddon.fit();
283
+ this.fit_terminal_safely();
266
284
  const cols = this.terminal?.cols ?? 0;
267
285
  const rows = this.terminal?.rows ?? 0;
268
286
  const px_width = this.containerEl.clientWidth ?? 0;
@@ -340,7 +358,7 @@ export class PhirepassTerminal {
340
358
  handle_tunnel_opened(web) {
341
359
  this.session_id = web.sid;
342
360
  this.terminal.reset();
343
- this.fitAddon.fit();
361
+ this.fit_terminal_safely();
344
362
  this.send_ssh_terminal_resize();
345
363
  }
346
364
  handle_tunnel_data(web) {
@@ -360,12 +378,12 @@ export class PhirepassTerminal {
360
378
  if (container) {
361
379
  this.terminal.open(container);
362
380
  console.log('Terminal opened in container');
363
- this.fitAddon.fit();
381
+ this.connected = true;
382
+ this.fit_terminal_safely();
364
383
  this.terminal.focus();
365
384
  this.terminal.onData(this.handle_terminal_data.bind(this));
366
385
  this.channel.connect();
367
386
  this.setup_resize_observer();
368
- this.connected = true;
369
387
  console.log('Terminal connected and ready');
370
388
  }
371
389
  }
@@ -376,7 +394,7 @@ export class PhirepassTerminal {
376
394
  clearTimeout(this.resizeDebounceHandle);
377
395
  }
378
396
  this.resizeDebounceHandle = setTimeout(() => {
379
- this.fitAddon.fit();
397
+ this.fit_terminal_safely();
380
398
  this.send_ssh_terminal_resize();
381
399
  }, 100);
382
400
  });
@@ -475,7 +493,7 @@ export class PhirepassTerminal {
475
493
  this.usernameBuffer = "";
476
494
  }
477
495
  render() {
478
- return (h(Host, { key: '2abcfab709121bce05b034d345c4e5ae72e9d48d' }, h("div", { key: 'a155b05f943f1ee2a9f001316474df9d33b1a0ef', id: "ccc", ref: el => (this.containerEl = el) })));
496
+ return (h(Host, { key: 'e56bf0b0f8825571a341588cfc4c99432d056eb6' }, h("div", { key: '91e2d8d168fac1c488059ba0b42da089d0b2bf30', id: "ccc", ref: el => (this.containerEl = el) })));
479
497
  }
480
498
  static get is() { return "phirepass-terminal"; }
481
499
  static get encapsulation() { return "shadow"; }