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.
@@ -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_a824d39613a69e2e: 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) {
@@ -604,7 +604,7 @@ function __wbg_get_imports() {
604
604
  __wbg_set_onopen_7ffeb01f8a628209: function(arg0, arg1) {
605
605
  getObject(arg0).onopen = getObject(arg1);
606
606
  },
607
- __wbg_warn_a05f18037e80c870: function(arg0, arg1) {
607
+ __wbg_warn_d8fb60272adc4bb8: function(arg0, arg1) {
608
608
  console.warn(getStringFromWasm0(arg0, arg1));
609
609
  },
610
610
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -623,8 +623,8 @@ function __wbg_get_imports() {
623
623
  return addHeapObject(ret);
624
624
  },
625
625
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
626
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
627
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_43);
626
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
627
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42);
628
628
  return addHeapObject(ret);
629
629
  },
630
630
  __wbindgen_cast_0000000000000005: function(arg0) {
@@ -661,8 +661,8 @@ function __wbg_get_imports() {
661
661
  };
662
662
  }
663
663
 
664
- function __wasm_bindgen_func_elem_43(arg0, arg1) {
665
- wasm.__wasm_bindgen_func_elem_43(arg0, arg1);
664
+ function __wasm_bindgen_func_elem_42(arg0, arg1) {
665
+ wasm.__wasm_bindgen_func_elem_42(arg0, arg1);
666
666
  }
667
667
 
668
668
  function __wasm_bindgen_func_elem_39(arg0, arg1, arg2) {
@@ -1132,6 +1132,10 @@ const PhirepassTerminal = class {
1132
1132
  this.try_connect();
1133
1133
  }
1134
1134
  async disconnectedCallback() {
1135
+ if (this.resizeDebounceHandle) {
1136
+ clearTimeout(this.resizeDebounceHandle);
1137
+ this.resizeDebounceHandle = undefined;
1138
+ }
1135
1139
  if (this.resizeObserver) {
1136
1140
  this.resizeObserver.disconnect();
1137
1141
  }
@@ -1141,6 +1145,20 @@ const PhirepassTerminal = class {
1141
1145
  this.close_comms();
1142
1146
  this.destroy_terminal();
1143
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
+ }
1144
1162
  try_connect() {
1145
1163
  if (this.connected || !this.domReady || !this.runtimeReady) {
1146
1164
  return;
@@ -1248,7 +1266,7 @@ const PhirepassTerminal = class {
1248
1266
  console.warn('Cannot send terminal resize: session_id is missing');
1249
1267
  return;
1250
1268
  }
1251
- this.fitAddon.fit();
1269
+ this.fit_terminal_safely();
1252
1270
  const cols = this.terminal?.cols ?? 0;
1253
1271
  const rows = this.terminal?.rows ?? 0;
1254
1272
  const px_width = this.containerEl.clientWidth ?? 0;
@@ -1326,7 +1344,7 @@ const PhirepassTerminal = class {
1326
1344
  handle_tunnel_opened(web) {
1327
1345
  this.session_id = web.sid;
1328
1346
  this.terminal.reset();
1329
- this.fitAddon.fit();
1347
+ this.fit_terminal_safely();
1330
1348
  this.send_ssh_terminal_resize();
1331
1349
  }
1332
1350
  handle_tunnel_data(web) {
@@ -1346,12 +1364,12 @@ const PhirepassTerminal = class {
1346
1364
  if (container) {
1347
1365
  this.terminal.open(container);
1348
1366
  console.log('Terminal opened in container');
1349
- this.fitAddon.fit();
1367
+ this.connected = true;
1368
+ this.fit_terminal_safely();
1350
1369
  this.terminal.focus();
1351
1370
  this.terminal.onData(this.handle_terminal_data.bind(this));
1352
1371
  this.channel.connect();
1353
1372
  this.setup_resize_observer();
1354
- this.connected = true;
1355
1373
  console.log('Terminal connected and ready');
1356
1374
  }
1357
1375
  }
@@ -1362,7 +1380,7 @@ const PhirepassTerminal = class {
1362
1380
  clearTimeout(this.resizeDebounceHandle);
1363
1381
  }
1364
1382
  this.resizeDebounceHandle = setTimeout(() => {
1365
- this.fitAddon.fit();
1383
+ this.fit_terminal_safely();
1366
1384
  this.send_ssh_terminal_resize();
1367
1385
  }, 100);
1368
1386
  });
@@ -1461,7 +1479,7 @@ const PhirepassTerminal = class {
1461
1479
  this.usernameBuffer = "";
1462
1480
  }
1463
1481
  render() {
1464
- 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) })));
1465
1483
  }
1466
1484
  static get watchers() { return {
1467
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"; }