termites 1.0.8 → 1.0.10

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/package.json +1 -1
  2. package/server.js +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termites",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Web terminal with server-client architecture for remote shell access",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server.js CHANGED
@@ -1073,6 +1073,7 @@ class TermitesServer {
1073
1073
  document.querySelectorAll('.mod-btn').forEach(b => b.classList.remove('active'));
1074
1074
  }
1075
1075
  ws.send(JSON.stringify({ type: 'input', clientId: selectedClientId, text: sendData }));
1076
+ term.scrollToBottom();
1076
1077
  }
1077
1078
  });
1078
1079
  function handleResize() {
@@ -1084,14 +1085,27 @@ class TermitesServer {
1084
1085
  }));
1085
1086
  }
1086
1087
  }
1088
+ function handleViewportResize() {
1089
+ // Adjust body height to visual viewport (handles mobile keyboard)
1090
+ if (window.visualViewport) {
1091
+ const vh = window.visualViewport.height;
1092
+ document.body.style.height = vh + 'px';
1093
+ // Scroll viewport to top to prevent offset issues
1094
+ window.scrollTo(0, 0);
1095
+ }
1096
+ handleResize();
1097
+ }
1087
1098
  window.addEventListener('resize', handleResize);
1088
1099
  window.addEventListener('orientationchange', () => {
1089
1100
  // Delay fit after orientation change to let browser settle
1090
- setTimeout(handleResize, 100);
1101
+ setTimeout(handleViewportResize, 100);
1091
1102
  });
1092
1103
  // Also handle visual viewport changes (mobile keyboard show/hide)
1093
1104
  if (window.visualViewport) {
1094
- window.visualViewport.addEventListener('resize', handleResize);
1105
+ window.visualViewport.addEventListener('resize', handleViewportResize);
1106
+ window.visualViewport.addEventListener('scroll', () => window.scrollTo(0, 0));
1107
+ // Initial adjustment
1108
+ handleViewportResize();
1095
1109
  }
1096
1110
  connect();
1097
1111
  applyTheme(currentTheme);