Repository navigation
Show canvases at their artboard proportions and phones in a device frame - #239
Merged
Merged
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 30 slice F. Slices B to E made a phone screen something framesmith can declare, build and judge, but the viewer still showed every canvas as a desktop page. Gallery thumbnails were hardcoded to a 1440×900 iframe at
scale(0.222), so a 390×844 phone canvas filled about a quarter of its card. The detail view offered breakpoint buttons hardcoded to 390 and 768 and had no way to present a phone as a phone. This PR fixes both.Thumbnails at the artboard's proportions
Device mode for mobile canvases
mobileopens at 1:1 inside a CSS device frame: a dark bezel and a rounded screen, with no images and no notch. The canvas scrolls inside the screen, so pinned chrome such as a tab bar stays put while the content moves, as on the phone.safeAreawhen it sets one, and the device's inset otherwise (47 and 34 oniphone-390). A canvas made mobile withcanvas_set_type, which never writessafeArea, therefore still shows the bands its content has to clear. A side whose inset is 0 draws no band./canvas/:id/htmlrender route is unchanged, so screenshots and theversionHashare unaffected. A verifier compared the route's output before and after for five canvases and three query variants, and every one was byte-identical.Changes to existing behaviour
safeAreachanges. Before, the two-second poll refreshed only the iframes, so acanvas_set_typecall left the old toolbar and frame in place until a manual reload. A content-only edit still refreshes just the iframes.Known limits, recorded in the spec
Docs
The README viewer paragraph no longer says every canvas has breakpoints. It, the README routes list, and a new bullet in the "Declaring the medium" section of
docs/GUIDELINES.mddescribe the card clamp, device mode, the overlay and its fallback insets, and what an undeclared 390px canvas looks like. The spec's slice F build contract and its "As built" block record each departure. No MCP tool changed, so the docstrings,INSTRUCTIONSandGOTCHASneeded no edits; the docs audit confirmed none of them describe the viewer's sizing.Testing
test-viewer-surface.ts(no browser) checks the card markup (sizes, aspect ratios, clamps, scale, the archive page), the mobile detail page (frame, bands, toolbar), profile-driven web breakpoints, the zero-inset and invalid-size cases, and the reload and theme wiring.test-viewer-surface-browser.ts(full tier) drives the real viewer in Chrome. It measures that thumbnails fill their cards at two window widths, toggles the overlay and measures the bands at the screen edges, and checks breakpoint state. It also checks that an open page switches to the device frame aftercanvas_set_type, redraws the bands after asafeAreaedit, and keeps a wide device's left edge reachable.safeAreaedit, which the last commit fixes. Every new check was shown failing on the commit before its fix.npm run test:full: 115/115.