thepopebot 1.2.76-beta.0 → 1.2.76-beta.2

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.
@@ -175,7 +175,7 @@ function TerminalView({ codeWorkspaceId, wsPath, isActive = true, showToolbar =
175
175
  fitAddonRef.current = fitAddon;
176
176
  term.open(containerRef.current);
177
177
  const style = document.createElement("style");
178
- style.textContent = `.xterm { padding: 5px; background-color: ${theme.background} !important; } .xterm-viewport { background-color: ${theme.background} !important; }`;
178
+ style.textContent = `.xterm { padding: 5px; background-color: ${theme.background} !important; } .xterm-viewport { background-color: ${theme.background} !important; } .xterm-rows span { pointer-events: none; }`;
179
179
  containerRef.current.appendChild(style);
180
180
  styleRef.current = style;
181
181
  containerRef.current.style.backgroundColor = theme.background;
@@ -188,6 +188,38 @@ function TerminalView({ codeWorkspaceId, wsPath, isActive = true, showToolbar =
188
188
  toolbarRef.current.style.setProperty("--tb-dropup-bg", theme.background);
189
189
  }
190
190
  fitAddon.fit();
191
+ const screenEl = containerRef.current.querySelector(".xterm-screen");
192
+ let lastTouchY = null;
193
+ let touchScrollAccum = 0;
194
+ const LINE_HEIGHT = 15;
195
+ const onTouchStart = (ev) => {
196
+ if (ev.touches.length === 1) {
197
+ lastTouchY = ev.touches[0].clientY;
198
+ touchScrollAccum = 0;
199
+ }
200
+ };
201
+ const onTouchMove = (ev) => {
202
+ if (lastTouchY === null || ev.touches.length !== 1) return;
203
+ const currentY = ev.touches[0].clientY;
204
+ const deltaY = lastTouchY - currentY;
205
+ lastTouchY = currentY;
206
+ touchScrollAccum += deltaY;
207
+ const lines = Math.trunc(touchScrollAccum / LINE_HEIGHT);
208
+ if (lines !== 0) {
209
+ term.scrollLines(lines);
210
+ touchScrollAccum -= lines * LINE_HEIGHT;
211
+ }
212
+ ev.preventDefault();
213
+ };
214
+ const onTouchEnd = () => {
215
+ lastTouchY = null;
216
+ touchScrollAccum = 0;
217
+ };
218
+ if (screenEl) {
219
+ screenEl.addEventListener("touchstart", onTouchStart, { passive: true });
220
+ screenEl.addEventListener("touchmove", onTouchMove, { passive: false });
221
+ screenEl.addEventListener("touchend", onTouchEnd, { passive: true });
222
+ }
191
223
  term.onData((data) => {
192
224
  const ws = wsRef.current;
193
225
  if (ws && ws.readyState === WebSocket.OPEN) {
@@ -226,6 +258,11 @@ function TerminalView({ codeWorkspaceId, wsPath, isActive = true, showToolbar =
226
258
  clearTimeout(resizeTimeout);
227
259
  clearTimeout(retryTimer.current);
228
260
  window.removeEventListener("resize", handleResize);
261
+ if (screenEl) {
262
+ screenEl.removeEventListener("touchstart", onTouchStart);
263
+ screenEl.removeEventListener("touchmove", onTouchMove);
264
+ screenEl.removeEventListener("touchend", onTouchEnd);
265
+ }
229
266
  if (wsRef.current) wsRef.current.close();
230
267
  term.dispose();
231
268
  };
@@ -211,7 +211,7 @@ export default function TerminalView({ codeWorkspaceId, wsPath, isActive = true,
211
211
  term.open(containerRef.current);
212
212
 
213
213
  const style = document.createElement('style');
214
- style.textContent = `.xterm { padding: 5px; background-color: ${theme.background} !important; } .xterm-viewport { background-color: ${theme.background} !important; }`;
214
+ style.textContent = `.xterm { padding: 5px; background-color: ${theme.background} !important; } .xterm-viewport { background-color: ${theme.background} !important; } .xterm-rows span { pointer-events: none; }`;
215
215
  containerRef.current.appendChild(style);
216
216
  styleRef.current = style;
217
217
 
@@ -227,6 +227,39 @@ export default function TerminalView({ codeWorkspaceId, wsPath, isActive = true,
227
227
 
228
228
  fitAddon.fit();
229
229
 
230
+ // Mobile touch scroll: translate finger swipes into terminal scrollLines()
231
+ const screenEl = containerRef.current.querySelector('.xterm-screen');
232
+ let lastTouchY = null;
233
+ let touchScrollAccum = 0;
234
+ const LINE_HEIGHT = 15; // approximate px per line at fontSize 16
235
+
236
+ const onTouchStart = (ev) => {
237
+ if (ev.touches.length === 1) {
238
+ lastTouchY = ev.touches[0].clientY;
239
+ touchScrollAccum = 0;
240
+ }
241
+ };
242
+ const onTouchMove = (ev) => {
243
+ if (lastTouchY === null || ev.touches.length !== 1) return;
244
+ const currentY = ev.touches[0].clientY;
245
+ const deltaY = lastTouchY - currentY;
246
+ lastTouchY = currentY;
247
+ touchScrollAccum += deltaY;
248
+ const lines = Math.trunc(touchScrollAccum / LINE_HEIGHT);
249
+ if (lines !== 0) {
250
+ term.scrollLines(lines);
251
+ touchScrollAccum -= lines * LINE_HEIGHT;
252
+ }
253
+ ev.preventDefault();
254
+ };
255
+ const onTouchEnd = () => { lastTouchY = null; touchScrollAccum = 0; };
256
+
257
+ if (screenEl) {
258
+ screenEl.addEventListener('touchstart', onTouchStart, { passive: true });
259
+ screenEl.addEventListener('touchmove', onTouchMove, { passive: false });
260
+ screenEl.addEventListener('touchend', onTouchEnd, { passive: true });
261
+ }
262
+
230
263
  term.onData((data) => {
231
264
  const ws = wsRef.current;
232
265
  if (ws && ws.readyState === WebSocket.OPEN) {
@@ -269,6 +302,11 @@ export default function TerminalView({ codeWorkspaceId, wsPath, isActive = true,
269
302
  clearTimeout(resizeTimeout);
270
303
  clearTimeout(retryTimer.current);
271
304
  window.removeEventListener('resize', handleResize);
305
+ if (screenEl) {
306
+ screenEl.removeEventListener('touchstart', onTouchStart);
307
+ screenEl.removeEventListener('touchmove', onTouchMove);
308
+ screenEl.removeEventListener('touchend', onTouchEnd);
309
+ }
272
310
  if (wsRef.current) wsRef.current.close();
273
311
  term.dispose();
274
312
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thepopebot",
3
- "version": "1.2.76-beta.0",
3
+ "version": "1.2.76-beta.2",
4
4
  "type": "module",
5
5
  "description": "Create autonomous AI agents with a two-layer architecture: Next.js Event Handler + Docker Agent.",
6
6
  "bin": {