* feat(studio): drag and resize draw live on an opaque preview over its channel On a preview frame Studio cannot script, a drag moved only the selection outline: the element stayed put until the save reloaded the preview. A resize threw on every pointer move (it measured the frame's element for the centre pin), saved its size without the centring shift, and then a drag or resize save threw while re-syncing the preview's timeline, which stopped the save queue and paused the preview. The runtime answers a new `draft` request: it adds a gesture's translate to the one the element had and sets its border box, the way the save writes them, and an end either keeps what is drawn (the save landed) or puts back what was there (a cancel, a tap, a failed save). Studio mirrors what a gesture draws on an opaque selection's stand-in to the frame, one request in flight per frame with later moves merged into the next. An opaque resize grows the outline about its centre from the size it wrote rather than measuring the frame. The timeline re-sync after a save reports a frame it cannot reach, so its caller re-seeks or reloads instead of throwing. A stand-in now starts with the inline translate and Studio size and offset of the element it stands for, so a drag on a freshly reloaded preview starts from where the element is. Before, a second drag after a reload saved only its own distance and dropped the first. Same-origin frames do not change: only an opaque selection's stand-in is mirrored, and the re-sync change only catches a read such a frame refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): draft writes test an element by its namespace, not its realm The runtime preview guard bans instanceof HTMLElement/SVGElement in the runtime, since a node from another realm fails it; the draft handler uses isStylableElement from domRealm.ts, as other runtime style writes do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(studio): keep the opaque preview's gesture drafts in step with the saved edit - Grabbing a layer again before its last save settles keeps that save's draft on the frame and draws the new gesture from there; the movement probe's restore no longer ends a draft it never drew. - A move on an opaque preview starts from the px the frame renders the translate at (%, em, var(), or a stylesheet translate), records the author's own value for Reset, and refuses a % it cannot size instead of dropping it. The frame's draft base resolves % to px, so a resize can't shift it again. - The stand-in carries Studio's translate marks, so Reset after a reload restores the author's translate. - A resize with no offset member keeps its draft once saved. - An undo painted over a pending move draws the move again when it is put back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@hyperframes/core
Types, parsers, generators, compiler, linter, runtime, and frame adapters for the Hyperframes video framework.
Install
npm install @hyperframes/core
Most users don't need to install core directly — the CLI, producer, and studio packages depend on it internally.
What's inside
| Module | Description |
|---|---|
| Types | TimelineElement, CompositionSpec, Asset, canvas dimensions, defaults |
| Parsers | parseHtml — extract timeline elements from HTML; parseGsapScript — parse GSAP animations |
| Generators | generateHyperframesHtml — produce valid Hyperframes HTML from a composition spec |
| Compiler | compileTimingAttrs — resolve data-start / data-duration into absolute times |
| Linter | lintHyperframeHtml — validate Hyperframes HTML (missing attributes, overlapping tracks, etc.) |
| Runtime | IIFE script injected into the browser — manages seek, media playback, and the window.__hf protocol |
| Frame Adapters | Pluggable animation drivers (GSAP, Lottie, CSS, or custom) |
Generated composition trust
Composition generators require trusted authors for code-bearing inputs. styles and
generateHyperframesStyles preserve authored CSS, which can load external resources.
animations may contain __raw: values that are emitted as JavaScript;
includeScripts: true includes executable timeline code. serializeGsapAnimations
also accepts raw preamble, postamble, and a code-bearing timelineVar. Never fill
these inputs with untrusted data. Attribute encoding and closing-tag containment
are not a sandbox; render untrusted compositions in an appropriately isolated
execution environment and never serve them on a privileged origin.
Text content retains the supported inline-formatting sanitizer contract. The clip parser intentionally flattens inner formatting to text, so parse/generate is not a lossless replacement for editing the source HTML.
Frame Adapters
A frame adapter tells the engine how to seek your animation to a specific frame:
import { createGSAPFrameAdapter } from "@hyperframes/core";
const adapter = createGSAPFrameAdapter({
getTimeline: () => gsap.timeline(),
compositionId: "my-video",
});
Implement FrameAdapter for custom animation runtimes:
import type { FrameAdapter } from "@hyperframes/core";
const myAdapter: FrameAdapter = {
id: "my-adapter",
getDurationFrames: () => 300,
seekFrame: (frame) => {
/* seek your animation */
},
};
Parsing and generating HTML
import { parseHtml, generateHyperframesHtml } from "@hyperframes/core";
const { elements, metadata } = parseHtml(htmlString);
const html = generateHyperframesHtml(spec);
Linting
import { lintHyperframeHtml } from "@hyperframes/core/lint";
const result = lintHyperframeHtml(htmlString);
// result.findings: { severity, message, elementId }[]
Documentation
Full documentation: hyperframes.heygen.com/packages/core
Related packages
@hyperframes/engine— rendering engine that drives the browser@hyperframes/producer— full render pipeline (capture + encode)hyperframes— CLI