ai-remote 0.4.18 → 0.5.0

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.
@@ -3,7 +3,7 @@ import {
3
3
  VERSION,
4
4
  isTitlebarDragPoint,
5
5
  logicalDisplaySize
6
- } from "./cli-chunk-R2ZEHRBG.mjs";
6
+ } from "./cli-chunk-OZG2CODR.mjs";
7
7
 
8
8
  // src/cli/window.ts
9
9
  import { spawn } from "node:child_process";
@@ -412,6 +412,29 @@ async function runWindow(argv) {
412
412
  } catch {
413
413
  }
414
414
  const webview = window.createWebview({ url, enableDevtools: false });
415
+ const SETTLE_MS = 400;
416
+ let reportedFullscreen = null;
417
+ let seen = null;
418
+ let seenSince = 0;
419
+ let publishing = !flags.fullscreen;
420
+ function publishFullscreen(force = false) {
421
+ if (!publishing) return;
422
+ const on = window.fullscreen !== null;
423
+ const now = Date.now();
424
+ if (on !== seen) {
425
+ seen = on;
426
+ seenSince = now;
427
+ }
428
+ if (!force && (on === reportedFullscreen || now - seenSince < SETTLE_MS)) return;
429
+ reportedFullscreen = on;
430
+ try {
431
+ webview.evaluateScript(`window.aiRemoteFullscreen && window.aiRemoteFullscreen(${on})`);
432
+ } catch {
433
+ }
434
+ }
435
+ window.on("resize", () => publishFullscreen());
436
+ webview.on("page-load-finished", () => publishFullscreen(true));
437
+ setInterval(() => publishFullscreen(), 150).unref();
415
438
  const debugDrag = process.env.AI_REMOTE_DEBUG_DRAG === "1";
416
439
  let pageDrag = null;
417
440
  let dragPointer = null;
@@ -427,6 +450,14 @@ async function runWindow(argv) {
427
450
  pageDrag = null;
428
451
  return;
429
452
  }
453
+ if (note.t === "fullscreen") {
454
+ try {
455
+ window.setFullscreen(window.fullscreen !== null ? void 0 : FullscreenType.Borderless);
456
+ } catch {
457
+ }
458
+ publishFullscreen();
459
+ return;
460
+ }
430
461
  if (typeof note.x !== "number" || typeof note.y !== "number") return;
431
462
  if (note.t === "drag-start") {
432
463
  if (window.fullscreen !== null) return;
@@ -468,6 +499,7 @@ async function runWindow(argv) {
468
499
  window.setFullscreen(FullscreenType.Borderless);
469
500
  } catch {
470
501
  }
502
+ publishing = true;
471
503
  }, 400);
472
504
  }
473
505
  await application.whenReady({ interval: 33 });
@@ -1,5 +1,5 @@
1
1
  // src/cli/generated/version.ts
2
- var VERSION = "0.4.18";
2
+ var VERSION = "0.5.0";
3
3
 
4
4
  // src/cli/viewer-layout.ts
5
5
  var TERMINAL_COLUMNS = 80;