mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
Where the phantom rows came from. The runtime stamps `data-start="0"` and `data-duration=<whole composition>` on every id'd child of the composition root "so they appear in the timeline even without animations" (init.ts, the `window.parent !== window` block). Its only skips were SCRIPT / STYLE / LINK, so an `<hf-audio-group>` got stamped too — which made it match the clip-manifest selector `[data-start], …`, so the bus entered `__clipManifest` as `kind: "element"`, `tagName: "hf-audio-group"`, 0 → 40s, and the studio drew it as an ordinary full-width clip row directly above the real group header. Observed on audio-real: 18 timeline elements, two of them `Voiceover|voiceover|hf-audio-group|manifest|0-40.0` and the same for `sfx`. 16 after this change, and the group rows and FX rack are unaffected. That row was draggable, trimmable and DELETABLE, and deleting it deletes the bus element — which is why deleting it took the group's automation lanes and its FX rack with it. Nothing was corrupted; the rack's subject was gone. `isTimelineIgnoredElement` in studio already excluded the tag with this exact reasoning, but it only guards the DOM-scan and implicit-layer paths. The bus arrived through the manifest, upstream of all of them, so the guard never saw it. Fixed at the source instead: both stamp loops now skip the tag. Not fixed: the `Stage` row in the same screenshot. That one is a real implicit layer for `<div class="stage">` — a visual container the author wrote — and it belongs in the timeline. `data-hf-ignore` on such a wrapper suppresses its row. Regression test asserts the bus keeps no timing while an id'd sibling still gets stamped; verified it fails on a revert. It has to stage `window.parent !== window` because the stamp only runs inside the studio preview, and it lives inside the `initSandboxRuntimeModular` describe so it gets the DOM reset — outside it, a previous test's leftover root wins `resolveRootCompositionElement()` and nothing is stamped at all, which reads as a pass. core: 122 files, 2481 tests.
@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) |
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