truecanvas 0.6.4 → 0.6.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.
@@ -340,7 +340,7 @@ button:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
340
340
  const el = document.createElement("div");
341
341
  el.className = "frame";
342
342
  el.style.cssText = "left:" + (f.x - minX) + "px;top:" + (f.y - minY) + "px;width:" + f.width + "px;height:" + f.height + "px";
343
- el.innerHTML = '<div class="frame-label"><b>' + esc(f.name) + "</b>" + f.width + " \xD7 " + Math.round(f.height) + (manifest.live ? '<button class="live-btn" title="Open the live site at this width"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor"><path d="M7 4.5v15l13-7.5z"/></svg>View live</button>' : "") + '<span class="interact-tag">Interacting<button type="button" class="interact-done">Done</button></span>' + "</div>" +
343
+ el.innerHTML = '<div class="frame-label"><b>' + esc(f.name) + "</b>" + f.width + " \xD7 " + Math.round(f.height) + (manifest.live ? '<button class="live-btn" title="The real site in a screen-sized window: it scrolls like on a real screen, so scroll animations and pinned sections behave as they will for visitors"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>Full screen</button>' : "") + '<span class="interact-tag">Interacting<button type="button" class="interact-done">Done</button></span>' + "</div>" +
344
344
  '<div class="frame-box" style="width:' + f.width + "px;height:" + f.height + 'px"><img alt="" src="' + esc(f.image) + '"><iframe title="' + esc(f.name) + '" scrolling="no" loading="lazy"></iframe></div>';
345
345
  restFrame(f, el.querySelector("iframe"), el.querySelector("img"));
346
346
  const liveBtn = el.querySelector(".live-btn");
@@ -398,12 +398,30 @@ button:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
398
398
  else { x -= e.deltaX; y -= e.deltaY; apply(); }
399
399
  }, { passive: false });
400
400
 
401
+ // a real-site frame that has the mouse forwards its wheel and Esc (the review
402
+ // site adds a small bridge to those pages): the canvas keeps scrolling
403
+ addEventListener("message", (e) => {
404
+ const m = e.data;
405
+ if (!m || m.__tc !== 1) return;
406
+ const iframe = [...world.querySelectorAll(".frame-box iframe")].find((f) => f.contentWindow === e.source);
407
+ if (!iframe) return;
408
+ if (m.t === "escape") { setInteracting(null); return; }
409
+ if (m.t !== "wheel") return;
410
+ const unit = m.dm === 1 ? 16 : m.dm === 2 ? innerHeight : 1;
411
+ const dx = (+m.dx || 0) * unit, dy = (+m.dy || 0) * unit;
412
+ if (m.zoom) {
413
+ // the frame is drawn at the canvas zoom: its coordinates scale with it
414
+ const r = iframe.getBoundingClientRect();
415
+ zoomAt(z * Math.exp(-dy * 0.01), r.left + (+m.x || 0) * z, r.top + (+m.y || 0) * z);
416
+ } else { x -= dx; y -= dy; apply(); }
417
+ });
418
+
401
419
  // drag to pan, two fingers to pinch
402
420
  const pointers = new Map();
403
421
  let pinch = null;
404
422
  let moved = false, downAt = null;
405
423
  stage.addEventListener("pointerdown", (e) => {
406
- // pins and View live are buttons: they take their own clicks
424
+ // pins, Full screen and Done are buttons: they take their own clicks
407
425
  if (e.target.closest && e.target.closest(".pin, .live-btn, .interact-done")) return;
408
426
  stage.setPointerCapture(e.pointerId);
409
427
  moved = false;
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  responseHeaders,
23
23
  safePath,
24
24
  viewerHtml
25
- } from "./chunk-56Z2KSBF.js";
25
+ } from "./chunk-7KJVGN4O.js";
26
26
  import {
27
27
  DEVICES,
28
28
  Workspace,
@@ -3,7 +3,7 @@
3
3
  * frozen frames out at their canvas positions, with pan and zoom (drag,
4
4
  * wheel, pinch, keys). Frames are sandboxed iframes without scripts, under a
5
5
  * transparent layer that takes every pointer event. When the version has a
6
- * live site, each frame gets a "View live" button: the real site in a
6
+ * live site, each frame gets a "Full screen" button: the real site in a
7
7
  * device-sized window, scripts and animations included, on its own origin.
8
8
  * Self-contained: no
9
9
  * build step, no dependencies, so the same file works locally and on a
@@ -6,7 +6,7 @@ import {
6
6
  responseHeaders,
7
7
  safePath,
8
8
  viewerHtml
9
- } from "../chunk-56Z2KSBF.js";
9
+ } from "../chunk-7KJVGN4O.js";
10
10
  export {
11
11
  CHUNK,
12
12
  decodeFrame,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truecanvas",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Design with your real React components: a Figma-like canvas for Next.js and Vite where layers are your .tsx and agents edit through MCP.",
5
5
  "license": "MIT",
6
6
  "type": "module",