feat(script): scale-to-fit preview + DESIGN.md overlays named theme#8
Merged
feat(script): scale-to-fit preview + DESIGN.md overlays named theme#8
Conversation
Two fixes that together let projects render the way their DESIGN.md says they should and let humans actually see what they rendered. Preview scale-to-fit: - assembleMaster's body switches to 100vw/100vh with flex centering. - .hf-stage keeps its native pixel dimensions but applies transform: scale(min(calc(100vw / Wpx), calc(100vh / Hpx))) so the whole canvas stays visible inside any viewport instead of being cropped to the upper-left chunk in narrow embeds and small browser windows. The producer launches Puppeteer at viewport === canvas, so scale evaluates to 1 during real renders — no impact on captured output. Both length operands carry px so calc() yields a unitless number; scale() rejects raw lengths. DESIGN.md overlays named theme: - resolveProjectTokens used to short-circuit: if hyperframes.json had design.theme it returned that theme and ignored DESIGN.md entirely. After hyperframes init that was the common case — every project shipped with a default theme name and DESIGN.md was dead weight. - New composition: DEFAULT_TOKENS → named theme → DESIGN.md, with DESIGN.md only overriding the roles its parser actually finds. So a project can pick "data-drift-dark" as a starting palette and tweak individual hex codes in DESIGN.md without losing the rest of the theme. - parseDesignBriefToTokens takes an optional base parameter so callers can stack briefs on any starting tokens; defaults to DEFAULT_TOKENS, preserving its existing signature. Verified on my-first-video: hyperframes.json says hackernoon-ft (cream) but DESIGN.md says deep black + electric purple + cyan. Tokens now resolve to bg #0a0a0a, accent #7c3aed, accent2 #06b6d4 — and the rendered chart-scene reads as the HyperSpeedrun "Data Drift meets Swiss Pulse" brief instead of cream data-journalism.
This was referenced Apr 25, 2026
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.
Summary
Two fixes that together let projects render the way their
DESIGN.mdsays they should — and let humans actually see what they rendered.Preview scale-to-fit
Before:
bodywas hardcoded to1920×1080pixels. In any viewport smaller than 1920×1080 (preview embeds, narrow browser windows, the studio's own iframe panel), only the upper-left chunk of the canvas was visible.After:
bodyis100vw / 100vhwith flex centering.hf-stagekeeps native pixel dimensions but appliestransform: scale(min(calc(100vw / Wpx), calc(100vh / Hpx)))so the whole canvas stays visible at any viewportscaleevaluates to 1 during real renders — no impact on captured outputcalc()operands carrypxunits so the division yields a unitless number (scale()rejects raw lengths)DESIGN.md overlays the named theme instead of being skipped
Before:
resolveProjectTokensshort-circuited — ifhyperframes.jsonhaddesign.theme, it returned that theme and ignoredDESIGN.mdentirely. Afterhyperframes initthat was the common case: every project shipped with a default theme name, andDESIGN.mdwas dead weight.After: composition order is
DEFAULT_TOKENS→ named theme →DESIGN.md, withDESIGN.mdoverlaying only the roles its parser actually finds. So a project can pickdata-drift-darkas a starting palette and tweak individual hex codes inDESIGN.mdwithout losing the rest of the theme.parseDesignBriefToTokensnow takes an optionalbaseparameter (defaults toDEFAULT_TOKENS) so callers can stack briefs on any starting tokens — backwards-compatible signature.Test plan
my-first-video(hyperframes.jsonsayshackernoon-ft,DESIGN.mdsays deep black + electric purple + cyan) now resolves tobg=#0a0a0a, accent=#7c3aed, accent2=#06b6d4transform: matrix(0.666667, ...)applied, full 1920×1080 canvas visible inside, body bg is darkNotes
This compounds with PR #7 (atmospheres + transitions + kinetic templates) — once both land, the dark-themed projects will get the dramatic aurora/mesh atmospheres on their actual brand colours instead of the muted cream-multiplied versions.