@swmansion/argent 0.25.3-next.3 → 0.25.3-next.5

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -2342,6 +2342,11 @@ var FAILURE_CODES = {
2342
2342
  IOS_SETTINGS_PERMISSION_FAILED: "IOS_SETTINGS_PERMISSION_FAILED",
2343
2343
  IOS_SHAKE_FAILED: "IOS_SHAKE_FAILED",
2344
2344
  ANDROID_SHAKE_FAILED: "ANDROID_SHAKE_FAILED",
2345
+ // The hinge of a foldable iOS simulator: the server refused the request on a
2346
+ // foldable (a bad angle, a hinge that would not move) vs. nothing to fold —
2347
+ // a device that is not foldable, no hinge route, a remote simulator.
2348
+ IOS_FOLD_FAILED: "IOS_FOLD_FAILED",
2349
+ IOS_FOLD_UNSUPPORTED: "IOS_FOLD_UNSUPPORTED",
2345
2350
  PASTE_CLIPBOARD_SET_FAILED: "PASTE_CLIPBOARD_SET_FAILED",
2346
2351
  PASTE_CLIPBOARD_UNSUPPORTED: "PASTE_CLIPBOARD_UNSUPPORTED",
2347
2352
  SETTINGS_PERMISSION_UNSUPPORTED: "SETTINGS_PERMISSION_UNSUPPORTED",
@@ -21872,7 +21877,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21872
21877
  var SESSION_ID2 = randomUUID5();
21873
21878
  function readCliVersion() {
21874
21879
  if (true) {
21875
- return "0.25.3-next.3";
21880
+ return "0.25.3-next.5";
21876
21881
  }
21877
21882
  return "0.0.0";
21878
21883
  }
@@ -15727,6 +15727,11 @@ var FAILURE_CODES = {
15727
15727
  IOS_SETTINGS_PERMISSION_FAILED: "IOS_SETTINGS_PERMISSION_FAILED",
15728
15728
  IOS_SHAKE_FAILED: "IOS_SHAKE_FAILED",
15729
15729
  ANDROID_SHAKE_FAILED: "ANDROID_SHAKE_FAILED",
15730
+ // The hinge of a foldable iOS simulator: the server refused the request on a
15731
+ // foldable (a bad angle, a hinge that would not move) vs. nothing to fold —
15732
+ // a device that is not foldable, no hinge route, a remote simulator.
15733
+ IOS_FOLD_FAILED: "IOS_FOLD_FAILED",
15734
+ IOS_FOLD_UNSUPPORTED: "IOS_FOLD_UNSUPPORTED",
15730
15735
  PASTE_CLIPBOARD_SET_FAILED: "PASTE_CLIPBOARD_SET_FAILED",
15731
15736
  PASTE_CLIPBOARD_UNSUPPORTED: "PASTE_CLIPBOARD_UNSUPPORTED",
15732
15737
  SETTINGS_PERMISSION_UNSUPPORTED: "SETTINGS_PERMISSION_UNSUPPORTED",
@@ -16725,7 +16730,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16725
16730
  var SESSION_ID = randomUUID4();
16726
16731
  function readCliVersion() {
16727
16732
  if (true) {
16728
- return "0.25.3-next.3";
16733
+ return "0.25.3-next.5";
16729
16734
  }
16730
16735
  return "0.0.0";
16731
16736
  }
@@ -16522,6 +16522,11 @@ var FAILURE_CODES = {
16522
16522
  IOS_SETTINGS_PERMISSION_FAILED: "IOS_SETTINGS_PERMISSION_FAILED",
16523
16523
  IOS_SHAKE_FAILED: "IOS_SHAKE_FAILED",
16524
16524
  ANDROID_SHAKE_FAILED: "ANDROID_SHAKE_FAILED",
16525
+ // The hinge of a foldable iOS simulator: the server refused the request on a
16526
+ // foldable (a bad angle, a hinge that would not move) vs. nothing to fold —
16527
+ // a device that is not foldable, no hinge route, a remote simulator.
16528
+ IOS_FOLD_FAILED: "IOS_FOLD_FAILED",
16529
+ IOS_FOLD_UNSUPPORTED: "IOS_FOLD_UNSUPPORTED",
16525
16530
  PASTE_CLIPBOARD_SET_FAILED: "PASTE_CLIPBOARD_SET_FAILED",
16526
16531
  PASTE_CLIPBOARD_UNSUPPORTED: "PASTE_CLIPBOARD_UNSUPPORTED",
16527
16532
  SETTINGS_PERMISSION_UNSUPPORTED: "SETTINGS_PERMISSION_UNSUPPORTED",
@@ -18639,6 +18644,7 @@ var AUTO_SCREENSHOT_TOOLS = /* @__PURE__ */ new Set([
18639
18644
  "keyboard",
18640
18645
  "paste",
18641
18646
  "rotate",
18647
+ "fold",
18642
18648
  "launch-app",
18643
18649
  "restart-app",
18644
18650
  "open-url",
@@ -18659,6 +18665,9 @@ var AUTO_SCREENSHOT_DELAY_MS_BY_TOOL = {
18659
18665
  "run-sequence": 15e3,
18660
18666
  "button": 1500,
18661
18667
  "rotate": 1e3,
18668
+ // The fold tool already waits for the panel hand-over; the cap covers the
18669
+ // repaint after it.
18670
+ "fold": 1500,
18662
18671
  "keyboard": 300,
18663
18672
  "paste": 300,
18664
18673
  "describe": 100
@@ -18679,6 +18688,7 @@ var AUTO_DESCRIBE_TOOLS = /* @__PURE__ */ new Set([
18679
18688
  "keyboard",
18680
18689
  "paste",
18681
18690
  "rotate",
18691
+ "fold",
18682
18692
  "launch-app",
18683
18693
  "restart-app",
18684
18694
  "open-url",
@@ -1976,6 +1976,16 @@
1976
1976
  let ws = null;
1977
1977
  let wsOpen = false;
1978
1978
  let currentUdid = null;
1979
+ // A foldable's panel: the CoreSimulator screen id its stream shows and
1980
+ // its touches name (1 the cover panel, 3 the inner one on the iPhone
1981
+ // Duo). null for a device with one panel, where commands name none.
1982
+ // This page's touches and wheels go to the simulator-server directly and
1983
+ // name this value, which the panel poll below refreshes every 1.5 s: for
1984
+ // up to that long after a fold, a preview touch can go to the panel that
1985
+ // went dark. An accepted limitation of the manual preview; the agent
1986
+ // tools resolve the panel on every touch.
1987
+ let activeScreen = null;
1988
+ let panelPollTimer = null;
1979
1989
  let img = null;
1980
1990
  let stage = null;
1981
1991
  // Auto-reconnect bookkeeping (see scheduleReconnect): the simulator-server
@@ -2021,7 +2031,14 @@
2021
2031
  // While the element-comment inspector is active the stream is a
2022
2032
  // read-only annotation surface — never drive the device.
2023
2033
  if (typeof vp !== "undefined" && vp.inspect) return;
2024
- ws.send(JSON.stringify({ id: nextCmdId(), ...obj }));
2034
+ const payload = { id: nextCmdId(), ...obj };
2035
+ // simulator-server captures every panel of a foldable and follows
2036
+ // none: a touch or wheel that names no screen goes to the cover panel,
2037
+ // black once the device is open.
2038
+ if (activeScreen !== null && (obj.cmd === "touch" || obj.cmd === "wheel")) {
2039
+ payload.screen = activeScreen;
2040
+ }
2041
+ ws.send(JSON.stringify(payload));
2025
2042
  // Every command (touch/scroll/key) likely moved the screen — wake the
2026
2043
  // describe loop *now* so connectors/pins track interaction, not just
2027
2044
  // the fixed cadence. Only when something is actually anchored to the
@@ -2311,6 +2328,8 @@
2311
2328
  // /preview/describe/<oldUdid> after teardown.
2312
2329
  setDeviceIndicator(null);
2313
2330
  currentUdid = null;
2331
+ stopPanelPoll();
2332
+ activeScreen = null;
2314
2333
  describeWarmupPending = false;
2315
2334
  // Explicitly clear the img src — otherwise the browser keeps the MJPEG
2316
2335
  // HTTP connection open after the element is detached, and re-selecting
@@ -2338,6 +2357,46 @@
2338
2357
  // route) heals it instead of stranding the user on a refresh. The
2339
2358
  // reconnectTimer guard collapses the simultaneous img.onerror + ws.onclose
2340
2359
  // into a single attempt; backoff resets on a successful ws.onopen.
2360
+ // A foldable's stream URL already carries `?screen=<id>`.
2361
+ function withCacheBuster(url) {
2362
+ return `${url}${url.includes("?") ? "&" : "?"}t=${Date.now()}`;
2363
+ }
2364
+
2365
+ function stopPanelPoll() {
2366
+ if (panelPollTimer) {
2367
+ clearInterval(panelPollTimer);
2368
+ panelPollTimer = null;
2369
+ }
2370
+ }
2371
+
2372
+ // Follow a foldable across folds: re-ask the tool-server which panel the
2373
+ // device renders to, and move the stream and the touches when it changes.
2374
+ function startPanelPoll(udid) {
2375
+ stopPanelPoll();
2376
+ let inFlight = false;
2377
+ panelPollTimer = setInterval(async () => {
2378
+ if (inFlight || currentUdid !== udid || !img) return;
2379
+ inFlight = true;
2380
+ try {
2381
+ const res = await fetch(
2382
+ `${TOOL_SERVER}/preview/simulator-server/${encodeURIComponent(udid)}`
2383
+ );
2384
+ if (!res.ok) return;
2385
+ const info = await res.json();
2386
+ if (currentUdid !== udid || !img || !info.foldable) return;
2387
+ if (info.activeScreen !== activeScreen) {
2388
+ activeScreen = info.activeScreen;
2389
+ img.src = withCacheBuster(info.streamUrl);
2390
+ setStatus("");
2391
+ }
2392
+ } catch {
2393
+ /* transient; the next tick asks again */
2394
+ } finally {
2395
+ inFlight = false;
2396
+ }
2397
+ }, 1500);
2398
+ }
2399
+
2341
2400
  function scheduleReconnect(udid) {
2342
2401
  if (currentUdid !== udid || reconnectTimer) return;
2343
2402
  const delay = Math.min(1000 * 2 ** reconnectAttempts, 8000);
@@ -2428,7 +2487,9 @@
2428
2487
  img.alt = `Simulator ${udid.slice(0, 8)}`;
2429
2488
  img.draggable = false;
2430
2489
  // Append a cache-buster so re-connects don't reuse a stale MJPEG stream.
2431
- img.src = `${info.streamUrl}?t=${Date.now()}`;
2490
+ img.src = withCacheBuster(info.streamUrl);
2491
+ activeScreen = info.foldable ? info.activeScreen : null;
2492
+ if (info.foldable) startPanelPoll(udid);
2432
2493
  img.onerror = () => {
2433
2494
  setStatus("stream error", "error");
2434
2495
  scheduleReconnect(udid);