Files
Miguel Ángel ca244027c3 feat(core): warn when a variable value is not a declared option
A composition can set a variable to a value outside that variable declared
enum options. The value silently falls back, the composition renders
something the author did not ask for, and no signal says a choice was
ignored.

Warns on both paths that resolve a variable, because they are separate. The
runtime guard covers a top-level composition. The compile guard covers a
sub-composition given instance values: those are baked into the variables
table at compile time and the scoped getVariables shim only reads that
table, so the runtime guard never runs there. That sub-comp case is the one
that motivated this, and it was the silent one.

Both call the same helper, so the message and the per-process dedupe set are
shared and an author sees one warning either way.

A warning rather than an error, for symmetry: the same defect must not carry
two severities depending on which mount path an author happened to use.
Escalation already has a home in lint, which a project can make blocking.

The check is split across four small helpers rather than one function:
parsing the declaration, naming the composition, reducing the option set to
comparable scalars, and deciding whether a value actually fell back. As one
function it audited at 21 cyclomatic and 25 cognitive.

Tests were mutation-checked. Five distinct breakages each killed a test,
including one that coerces the unknown value to the default instead of
warning, which would turn a diagnostic into a silent rewrite.
2026-08-08 20:59:54 +00:00
..
2026-08-08 13:13:50 -07:00

@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