waygraph 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.js +50 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -367,10 +367,13 @@ const RING_CSS =
367
367
  "#wg-modules .wg-mod-done{background:#2a1650;color:#9a7ad1;}" +
368
368
  "#wg-modules .wg-mod-current{background:#7C3AED;color:#fff;}" +
369
369
  "#wg-modules .wg-mod-upcoming{background:transparent;color:#5a4a80;border:1px solid #3a2a60;}" +
370
- "#wg-banner{position:fixed;z-index:2147483647;top:14px;right:14px;max-width:320px;" +
370
+ "#wg-banner{position:fixed;z-index:2147483647;top:14px;max-width:320px;" +
371
371
  "background:rgba(20,10,40,.94);color:#fff;border-radius:12px;padding:10px 16px;" +
372
372
  "font:14px/1.4 system-ui,sans-serif;box-shadow:0 8px 20px rgba(0,0,0,.3);" +
373
- "border:1px solid rgba(124,58,237,.4);}" +
373
+ "border:1px solid rgba(124,58,237,.4);cursor:pointer;user-select:none;}" +
374
+ "#wg-banner[data-pos=left]{left:14px;right:auto;transform:none;}" +
375
+ "#wg-banner[data-pos=center]{left:50%;right:auto;transform:translateX(-50%);}" +
376
+ "#wg-banner[data-pos=right]{right:14px;left:auto;transform:none;}" +
374
377
  "#wg-banner .wg-banner-tag{display:block;font-size:10px;font-weight:700;color:#c9a6ff;" +
375
378
  "letter-spacing:.05em;text-transform:uppercase;margin-bottom:2px;}" +
376
379
  "#wg-panel .wg-key{margin:8px 0;}" +
@@ -400,17 +403,46 @@ const WAYGRAPH_FAVICON =
400
403
 
401
404
  async function installOverlay(page, title) {
402
405
  await page.addStyleTag({ content: RING_CSS }).catch(() => {});
406
+ // Default top-left; override with WAYGRAPH_TITLE_POS=left|center|right.
407
+ // Click cycles left -> center -> right (persisted in localStorage so a
408
+ // navigation that rebuilds the banner keeps the human's last pick).
409
+ const envPos = (process.env.WAYGRAPH_TITLE_POS || "left").toLowerCase();
410
+ const bannerPos = envPos === "center" || envPos === "right" ? envPos : "left";
403
411
  await page
404
412
  .evaluate(
405
- ({ title, favicon }) => {
413
+ ({ title, favicon, bannerPos }) => {
406
414
  if (!document.getElementById("wg-ring")) {
407
415
  const ring = document.createElement("div");
408
416
  ring.id = "wg-ring";
409
417
  document.documentElement.appendChild(ring);
410
418
  }
419
+ const POSITIONS = ["left", "center", "right"];
420
+ const applyPos = (el, pos) => {
421
+ el.dataset.pos = pos;
422
+ try {
423
+ localStorage.setItem("wg-banner-pos", pos);
424
+ } catch {
425
+ /* private mode / blocked storage - position still applies this page */
426
+ }
427
+ };
411
428
  if (title && !document.getElementById("wg-banner")) {
412
429
  const banner = document.createElement("div");
413
430
  banner.id = "wg-banner";
431
+ let saved = null;
432
+ try {
433
+ saved = localStorage.getItem("wg-banner-pos");
434
+ } catch {
435
+ /* ignore */
436
+ }
437
+ const startPos =
438
+ saved && POSITIONS.includes(saved) ? saved : bannerPos;
439
+ applyPos(banner, startPos);
440
+ banner.title = "Click to move: top left / center / right";
441
+ banner.addEventListener("click", (e) => {
442
+ e.stopPropagation();
443
+ const i = POSITIONS.indexOf(banner.dataset.pos || "left");
444
+ applyPos(banner, POSITIONS[(i + 1) % POSITIONS.length]);
445
+ });
414
446
  const tag = document.createElement("span");
415
447
  tag.className = "wg-banner-tag";
416
448
  tag.textContent = "waygraph demo";
@@ -434,7 +466,7 @@ async function installOverlay(page, title) {
434
466
  }
435
467
  if (iconLink.href !== favicon) iconLink.href = favicon;
436
468
  },
437
- { title, favicon: WAYGRAPH_FAVICON },
469
+ { title, favicon: WAYGRAPH_FAVICON, bannerPos },
438
470
  )
439
471
  .catch(() => {});
440
472
  }
@@ -1022,10 +1054,16 @@ async function main() {
1022
1054
  // launched at Chromium's own default size/position, which stayed put
1023
1055
  // where it was for a previous, larger monitor and looked chopped off on
1024
1056
  // a smaller one. Maximizing fills whatever screen it's actually on.
1057
+ // Same CHROME_PATH/CHROMIUM_PATH rule as Engine.run(mem): prefer the
1058
+ // system/Flatpak Chromium when set, otherwise Playwright's bundled build.
1059
+ // Without this, STEP mode always launched a different-looking browser than
1060
+ // headed Engine runs / waygraph-demo.mjs (which already resolve Flatpak).
1061
+ const executablePath = process.env.CHROME_PATH || process.env.CHROMIUM_PATH || undefined;
1025
1062
  const browser = await chromium.launch({
1026
1063
  headless: !headed,
1027
1064
  slowMo,
1028
1065
  args: step ? ["--start-maximized"] : [],
1066
+ ...(executablePath ? { executablePath } : {}),
1029
1067
  });
1030
1068
  const context = await browser.newContext(
1031
1069
  step ? { baseURL, viewport: null } : { baseURL, viewport: { width: 1280, height: 720 } },
@@ -1176,10 +1214,15 @@ Usage:
1176
1214
  WAYGRAPH_AUTOPLAY=1 step mode only - hands-off, advances on a
1177
1215
  timer instead of waiting for clicks
1178
1216
  WAYGRAPH_AUTOPLAY_MS=ms delay between auto-advances (default 1800)
1179
- WAYGRAPH_TITLE="..." step mode only - a persistent top-right
1180
- banner naming what this whole run is about
1217
+ WAYGRAPH_TITLE="..." step mode only - a persistent top banner
1218
+ naming what this whole run is about (default
1219
+ top-left; click the banner to cycle left /
1220
+ center / right)
1221
+ WAYGRAPH_TITLE_POS=left|center|right
1222
+ initial banner position (default left); click
1223
+ still cycles and remembers via localStorage
1181
1224
 
1182
- "project" defaults to the current directory.
1225
+ "project" defaults to the current directory.
1183
1226
  `);
1184
1227
  process.exit(0);
1185
1228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waygraph",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
6
6
  "main": "./dist/index.js",