@ghostty-web/demo 0.3.0-next.0.g4ef099b → 0.3.0-next.11.ge879eef

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.
Files changed (2) hide show
  1. package/bin/demo.js +41 -17
  2. package/package.json +2 -2
package/bin/demo.js CHANGED
@@ -286,6 +286,33 @@ const HTML_TEMPLATE = `<!doctype html>
286
286
  window.addEventListener('resize', () => {
287
287
  fitAddon.fit();
288
288
  });
289
+
290
+ // Handle mobile keyboard showing/hiding using visualViewport API
291
+ if (window.visualViewport) {
292
+ const terminalContent = document.querySelector('.terminal-content');
293
+ const terminalWindow = document.querySelector('.terminal-window');
294
+ const originalHeight = terminalContent.style.height;
295
+ const body = document.body;
296
+
297
+ window.visualViewport.addEventListener('resize', () => {
298
+ const keyboardHeight = window.innerHeight - window.visualViewport.height;
299
+ if (keyboardHeight > 100) {
300
+ body.style.padding = '0';
301
+ body.style.alignItems = 'flex-start';
302
+ terminalWindow.style.borderRadius = '0';
303
+ terminalWindow.style.maxWidth = '100%';
304
+ terminalContent.style.height = (window.visualViewport.height - 60) + 'px';
305
+ window.scrollTo(0, 0);
306
+ } else {
307
+ body.style.padding = '40px 20px';
308
+ body.style.alignItems = 'center';
309
+ terminalWindow.style.borderRadius = '12px';
310
+ terminalWindow.style.maxWidth = '1000px';
311
+ terminalContent.style.height = originalHeight || '600px';
312
+ }
313
+ fitAddon.fit();
314
+ });
315
+ }
289
316
  </script>
290
317
  </body>
291
318
  </html>`;
@@ -446,23 +473,20 @@ wss.on('connection', (ws, req) => {
446
473
  });
447
474
 
448
475
  // Send welcome message
449
- setTimeout(() => {
450
- if (ws.readyState !== ws.OPEN) return;
451
- const C = '\x1b[1;36m'; // Cyan
452
- const G = '\x1b[1;32m'; // Green
453
- const Y = '\x1b[1;33m'; // Yellow
454
- const R = '\x1b[0m'; // Reset
455
- ws.send(`${C}╔══════════════════════════════════════════════════════════════╗${R}\r\n`);
456
- ws.send(
457
- `${C}║${R} ${G}Welcome to ghostty-web!${R} ${C}║${R}\r\n`
458
- );
459
- ws.send(`${C}║${R} ${C}║${R}\r\n`);
460
- ws.send(`${C}║${R} You have a real shell session with full PTY support. ${C}║${R}\r\n`);
461
- ws.send(
462
- `${C}║${R} Try: ${Y}ls${R}, ${Y}cd${R}, ${Y}top${R}, ${Y}vim${R}, or any command! ${C}║${R}\r\n`
463
- );
464
- ws.send(`${C}╚══════════════════════════════════════════════════════════════╝${R}\r\n\r\n`);
465
- }, 100);
476
+ const C = '\x1b[1;36m'; // Cyan
477
+ const G = '\x1b[1;32m'; // Green
478
+ const Y = '\x1b[1;33m'; // Yellow
479
+ const R = '\x1b[0m'; // Reset
480
+ ws.send(`${C}╔══════════════════════════════════════════════════════════════╗${R}\r\n`);
481
+ ws.send(
482
+ `${C}║${R} ${G}Welcome to ghostty-web!${R} ${C}║${R}\r\n`
483
+ );
484
+ ws.send(`${C}║${R} ${C}║${R}\r\n`);
485
+ ws.send(`${C}║${R} You have a real shell session with full PTY support. ${C}║${R}\r\n`);
486
+ ws.send(
487
+ `${C}║${R} Try: ${Y}ls${R}, ${Y}cd${R}, ${Y}top${R}, ${Y}vim${R}, or any command! ${C}║${R}\r\n`
488
+ );
489
+ ws.send(`${C}╚══════════════════════════════════════════════════════════════╝${R}\r\n\r\n`);
466
490
  });
467
491
 
468
492
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostty-web/demo",
3
- "version": "0.3.0-next.0.g4ef099b",
3
+ "version": "0.3.0-next.11.ge879eef",
4
4
  "description": "Cross-platform demo server for ghostty-web terminal emulator",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@lydell/node-pty": "^1.0.1",
15
- "ghostty-web": "0.3.0-next.0.g4ef099b",
15
+ "ghostty-web": "0.3.0-next.11.ge879eef",
16
16
  "ws": "^8.18.0"
17
17
  },
18
18
  "files": [