When to Use
Use@hyperframes/sdk when you need to:
- Build a custom composition editor in your own application
- Let an agent inspect and edit composition HTML without driving a browser UI
- Apply batch text, style, timing, asset, variable, or animation edits from code
- Track undo/redo and patch events for host application history
- Persist edited HTML through memory, filesystem, or custom storage adapters
- Layer sparse overrides on top of a reusable base composition template
- Render compositions to MP4 or WebM - use the CLI or producer
- Preview and edit visually out of the box - use the CLI (
npx hyperframes preview) or studio - Parse, lint, or generate low-level composition HTML - use core
- Capture frames from a headless browser - use engine
This page is the package overview. For the full API — guides and a complete reference for every method, operation, type, and adapter — see the SDK tab.
Package Exports
| Import | Description |
|---|---|
@hyperframes/sdk | Main editing API, types, memory/headless adapters, iframe preview adapter |
@hyperframes/sdk/adapters/memory | In-memory persistence adapter for tests, demos, and ephemeral sessions |
@hyperframes/sdk/adapters/fs | Node.js filesystem persistence adapter with version history |
@hyperframes/sdk/adapters/headless | No-op preview adapter for agents, CI, and server-side editing |
Quick Start
Open HTML, edit explicit element IDs, then serialize the updated composition:Core Concepts
Explicit Element IDs
All edits target stable HyperFrames element IDs. This makes the SDK safe for headless agents and backend jobs because mutations do not depend on mouse state or a current UI selection.Typed Methods
The common editing operations have typed convenience methods:batch() when several mutations should become one undo entry, one persist write, and one change notification:
Advanced Dispatch API
Agents and automation can emit data-shaped operations throughdispatch():
can():
Persistence
Pass a persistence adapter to autosave edits. The SDK ships memory and filesystem adapters, and host applications can implement the samePersistAdapter interface for S3, HTTP, IndexedDB, or app-specific storage.
Undo, Redo, and Patch Events
Standalone sessions include undo/redo by default:Embedded Override Mode
For template-driven products, open a composition with anoverrides object. The SDK applies the sparse override set on top of the base HTML, accumulates additional edits into that override set, and lets the host store only the delta.
applyPatches() when the host owns undo/redo and needs to replay inverse patches into the SDK without creating loops.
Preview Adapters
The SDK can run headlessly, or it can connect to a preview surface:createIframePreviewAdapter() bridges the SDK to a same-origin composition iframe so hit-testing, selection, and draft preview updates can stay outside the model mutation path.
Related Packages
@hyperframes/core
Low-level types, HTML utilities, runtime helpers, and linter APIs.
@hyperframes/studio
Ready-made visual editor UI that can embed SDK-driven editing flows.
@hyperframes/producer
Programmatic rendering pipeline for turning edited HTML into video.
CLI
Command-line create, preview, lint, and render workflows.