waygraph 0.15.0 → 0.15.1

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/dist/cli.js +68 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3809,6 +3809,62 @@ async function hideRing(page) {
3809
3809
  .catch(() => {});
3810
3810
  }
3811
3811
 
3812
+ /**
3813
+ * Real navigation wipes document + overlay helpers. Reinstall and re-paint
3814
+ * carried todos / device / optional stubBefore ring so keep-dock and nav
3815
+ * highlights do not vanish until the next ctx.todos() / stubAfter (PIA #15).
3816
+ */
3817
+ async function restoreTheaterAfterNavigation(page, todoDockRef, deviceRef, stubBeforeRef) {
3818
+ const needs =
3819
+ (await page
3820
+ .evaluate(() => !window.__wgSyncTodos || !document.getElementById("wg-ring"))
3821
+ .catch(() => true)) || false;
3822
+ if (!needs) {
3823
+ // Overlay survived (SPA / no full document wipe) - still refresh dock
3824
+ // if Node has a carry and the DOM lost .wg-todo-dock.
3825
+ const hasDock = await page
3826
+ .evaluate(() => !!document.querySelector(".wg-todo-dock, #wg-todo-dock"))
3827
+ .catch(() => false);
3828
+ if (hasDock || !todoDockRef || !todoDockRef.current) return;
3829
+ }
3830
+ await installOverlay(page);
3831
+ const dock = todoDockRef && todoDockRef.current;
3832
+ if (dock) {
3833
+ await page
3834
+ .evaluate((d) => {
3835
+ if (window.__wgSyncTodos) window.__wgSyncTodos({ sync: "set", dock: d });
3836
+ }, dock)
3837
+ .catch(() => {});
3838
+ }
3839
+ if (deviceRef && deviceRef.current) {
3840
+ await applyDeviceToPage(page, deviceRef.current, "set").catch(() => {});
3841
+ }
3842
+ // Re-show first matching stubBefore ring if selector still exists (sidebar
3843
+ // nav targets often survive the route change).
3844
+ const stubs = (stubBeforeRef && stubBeforeRef.current) || [];
3845
+ for (const h of stubs) {
3846
+ if (!h || !h.selector) continue;
3847
+ const box = await page
3848
+ .evaluate((sel) => {
3849
+ const el = document.querySelector(sel);
3850
+ if (!el) return null;
3851
+ const r = el.getBoundingClientRect();
3852
+ if (r.width < 2 || r.height < 2) return null;
3853
+ return { x: r.x, y: r.y, width: r.width, height: r.height };
3854
+ }, h.selector)
3855
+ .catch(() => null);
3856
+ if (box) {
3857
+ await showRing(page, box, formatHighlightCaption(h), h.tone || "planned", {
3858
+ size: h.size,
3859
+ weight: h.weight,
3860
+ selector: h.selector,
3861
+ focus: !!h.focus,
3862
+ }).catch(() => {});
3863
+ break;
3864
+ }
3865
+ }
3866
+ }
3867
+
3812
3868
  /**
3813
3869
  * Removes every overlay element (panel, ring, ring-label, cursor,
3814
3870
  * click-pulse, banner) and stops the live resize/scroll ring tracker, once
@@ -4542,6 +4598,7 @@ function instrumentInteractionHighlighting(page, mem, slowMo, pacing, stubBefore
4542
4598
  // of leaving it lit until the next Block's own before-panel clears
4543
4599
  // it - it was sticking around through the whole rest of the step.
4544
4600
  await hideRing(page);
4601
+ await restoreTheaterAfterNavigation(page, todoDockRef, deviceRef, stubBeforeRef);
4545
4602
  return result;
4546
4603
  };
4547
4604
  }
@@ -4670,6 +4727,8 @@ function instrumentInteractionHighlighting(page, mem, slowMo, pacing, stubBefore
4670
4727
  }
4671
4728
  await new Promise((res) => setTimeout(res, clickPostPop()));
4672
4729
  await hideRing(page);
4730
+ // Full document navigation drops #wg-todo-dock + rings; restore carry.
4731
+ await restoreTheaterAfterNavigation(page, todoDockRef, deviceRef, stubBeforeRef);
4673
4732
  return result;
4674
4733
  };
4675
4734
  }
@@ -4921,17 +4980,21 @@ async function runStepMode(engine, start, end, context, page, mem, resolved, slo
4921
4980
  if (sync === "set" && dock) {
4922
4981
  if (!parallel) todoDockById.clear();
4923
4982
  todoDockById.set(dockRegistryKey(dock), dock);
4983
+ return;
4984
+ }
4985
+ // keep: refresh / re-seed so syncAllTodoDocks never sees an empty map
4986
+ // while lastTodoDock still carries (nav wipe + mid-act advance).
4987
+ if (sync === "keep" && dock) {
4988
+ todoDockById.set(dockRegistryKey(dock), dock);
4924
4989
  }
4925
4990
  };
4926
4991
  const syncAllTodoDocks = async (opts) => {
4927
4992
  const docks = [...todoDockById.values()];
4928
4993
  const parallel = !!(opts && opts.parallel);
4929
4994
  if (!docks.length) {
4930
- await page
4931
- .evaluate(() => {
4932
- if (window.__wgSyncTodos) window.__wgSyncTodos({ sync: "clear" });
4933
- })
4934
- .catch(() => {});
4995
+ // Empty registry: do NOT clear the DOM. renderBefore/After may have
4996
+ // just painted from lastTodoDock (keep). Clearing here made todos
4997
+ // vanish until the next ctx.todos() set (PIA #15).
4935
4998
  return;
4936
4999
  }
4937
5000
  await page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waygraph",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
6
6
  "license": "MIT",