@ghostty-web/demo 0.3.0-next.8.ge297e6c → 0.3.0-next.9.g59bb045
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.
- package/bin/demo.js +27 -0
- 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>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghostty-web/demo",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.9.g59bb045",
|
|
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.
|
|
15
|
+
"ghostty-web": "0.3.0-next.9.g59bb045",
|
|
16
16
|
"ws": "^8.18.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|