Skip to content

Phase 5 item #7: viewer Compare view (side-by-side breakpoints)#14

Merged
vicmaster merged 1 commit into
masterfrom
feat/phase5-side-by-side-viewer
May 16, 2026
Merged

Phase 5 item #7: viewer Compare view (side-by-side breakpoints)#14
vicmaster merged 1 commit into
masterfrom
feat/phase5-side-by-side-viewer

Conversation

@vicmaster
Copy link
Copy Markdown
Owner

Summary

New Compare toolbar button puts mobile (390×844), tablet (768×1024), and desktop (canvas natural width/height) iframes side by side in the viewport area. Each iframe loads through the per-breakpoint render route added in PR #13, so the reflow is real — not a CSS-scaled snapshot of the desktop layout.

How it works

  • setCompareMode() puts the .viewport element in a compare class. CSS hides the single #frame and reveals .compare-grid.
  • setViewport() removes the compare class so the toggle is mutually exclusive with the single-breakpoint modes.
  • Auto-refresh now goes through a refreshFrames() helper that picks the right iframe(s) based on current mode.
  • Each cell uses CSS transform: scale() with --bp-w / --bp-h / --scale variables so the iframe renders at the true viewport size but presents at a fraction of that pixel area. Default scale is 0.35 (~960px total at desktop chrome width); media queries drop it to 0.28 / 0.22 / 0.18 on narrower viewers.
  • Fit button is dimmed in compare mode where it doesn't apply.
  • renderDetailPage is now exported so the smoke can render it directly without spinning up the HTTP server (which tends to cache stale code across long-running tsx processes — observed today).

Test plan

  • npm run build clean
  • npx tsx test-viewer-compare.ts → 11/11 pass
    • 9 markup checks (Compare button, compare-grid container, three iframe srcs pointing at the per-breakpoint route, the JS handlers, the CSS hooks)
    • 2 runtime checks via puppeteer (initial: single iframe visible, grid hidden; after #bp-compare click: grid visible with 3 cells, single hidden, button marked active)
  • test-fluid-widths, test-default-font, test-root-centering, test-ops-parser, test-guidelines, test-responsive-reflow all still pass — no regression on PRs Phase 5: responsive hint API + renderer mapping (items #1+#2) #6-13

Out of scope

  • Per-breakpoint label customization, persistent layout preference, or a "Compare + Diff" mode pairing this with canvas_diff — natural follow-ups, kept separate.

New "Compare" toolbar button puts mobile (390×844), tablet (768×1024),
and desktop (canvas natural width/height) iframes side by side in the
viewport area. Each iframe still loads through the per-breakpoint render
route added in PR #13, so the reflow is real — not a CSS-scaled
snapshot of the desktop layout. Each cell uses CSS `transform: scale()`
with --bp-w / --bp-h / --scale variables to fit at ~0.35 scale on a
typical viewer width, dropping to 0.28 / 0.22 / 0.18 on narrower
viewers via media queries.

- `setCompareMode()` puts the .viewport in `compare` class. CSS hides
  the single #frame and reveals .compare-grid.
- `setViewport()` removes the `compare` class so the toggle is mutually
  exclusive with single-breakpoint modes.
- Auto-refresh now goes through a `refreshFrames()` helper that picks
  the right iframe(s) based on current mode — single frame in normal
  mode, all three cells in compare mode.
- `Fit` button is dimmed (pointer-events: none) in compare mode where
  it doesn't make sense.
- `renderDetailPage` is now exported so the smoke can render it
  directly without spinning up the HTTP server (which tends to cache
  stale code across long-running tsx processes).

`test-viewer-compare.ts` covers 9 markup checks + 2 runtime checks
(initial state has single iframe visible / grid hidden; clicking
Compare swaps them and marks the button active). 11/11 pass. All six
existing smokes still pass — no regression on PRs #6-13.
@vicmaster vicmaster merged commit 8795fb6 into master May 16, 2026
@vicmaster vicmaster deleted the feat/phase5-side-by-side-viewer branch May 16, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant