mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
* fix(studio-server): let opaque preview frames load project fonts and module scripts A preview framed with an opaque origin, such as the Compositions hover preview, makes its font and module-script loads in CORS mode with `Origin: null`. Without a CORS grant they failed: the frame fell back to a system font and module scripts never ran. The preview asset route now answers those two loads with `Access-Control-Allow-Origin: null`, `Vary: Origin` and `X-Content-Type-Options: nosniff`. The grant is chosen by `Sec-Fetch-Dest`, which the browser sets and page script cannot: `font` for a font file and `script` for a .js/.mjs file, served with the matching content type. A page's own `fetch()` is always `empty`, so it still gets no grant and composition script still cannot read project files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(studio-server): keep opaque-frame grant comments within the package share Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(studio-server): let opaque preview frames load project fonts Narrow the opaque-frame grant to fonts. Every sandboxed frame sends the same `Origin: null` and fetch metadata, so a CORS grant for module scripts could not be limited to frames the Studio itself serves. Module scripts stay unloaded in the hover preview for now; fonts keep their grant, and `Sec-Fetch-Dest: script` loads of .js/.mjs get none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(studio-server): load fonts and modules only in the Studio's own preview frames A CORS grant to `Origin: null` reaches every sandboxed frame, whichever page it sits in. The grant now lives on a per-project path instead: `/projects/:id/preview/~<token>/...` serves exactly what `/preview/...` serves, and only there do font loads (`Sec-Fetch-Dest: font`, a font file served as `font/*`) and module-script loads (`script`, a .js/.mjs file served as `text/javascript`) from an opaque frame get `Access-Control-Allow-Origin: null`. The plain path gets no grant. The token is an HMAC-SHA256 of the project id under a random per-server secret, compared in constant time. The Studio reads it from `/projects/:id/frame-token`, which refuses cross-site and same-site requests, and the Compositions hover preview frames its composition at the token path. Documents served there are re-based under the token and carry `Referrer-Policy: no-referrer`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(studio-server): raise the packed size budget for the preview frame tokens The per-project frame-token path adds server code to the package, and the packed tarball measured 166941 bytes in CI against a 164800 budget. Set the budget to the measured size plus about 1% headroom. — Rames Jusso Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@hyperframes/studio
Browser-based composition editor UI for Hyperframes. Provides a visual timeline, code editor, and live preview for building video compositions.
Install
npm install @hyperframes/studio
What it does
The studio is a React application with:
- Visual timeline — drag, resize, and arrange elements on tracks
- Code editor — edit HTML and GSAP scripts with CodeMirror (syntax highlighting, autocomplete)
- Live preview — see changes in real time as you edit
- Composition inspector — view and modify element properties
Development
The studio is embedded in the hyperframes preview command. To develop the studio UI itself:
cd packages/studio
bun run dev # Start Vite dev server
bun run build # Build for production
bun run typecheck # Type-check
Tech stack
- React 19, Zustand 4/5 (state management; development uses Zustand 5)
- CodeMirror 6 (editor)
- Tailwind CSS (styling)
- Vite (bundler)
- Phosphor Icons
Documentation
Full documentation: hyperframes.heygen.com/packages/studio
Related packages
@hyperframes/core— types and parsers used by the editorhyperframes— CLI that serves the studio viahyperframes preview