@hyperframes/sdk, verified against packages/sdk/src/types.ts and the export barrel at packages/sdk/src/index.ts. Adapter, history, and persistence types live with the APIs that take them — see Adapters, Utilities, Composition, and openComposition.
See also: Composition for the main session interface, Edit Operations for the EditOp catalog.
HfId
data-hf-id attribute stamped on every editable element by ensureHfIds. Use HfId wherever you would write a raw string to signal that the value is an element id.
HyperFramesElement
Full DOM-level view of one editable element. Returned bycomp.getElements() and comp.getElement(id).
Fully-qualified scoped identifier:
host-chain-prefix/leaf, separated by /. For top-level elements scopedId === id. For elements inside inlined sub-compositions the format is "hf-HOST/hf-LEAF" (any depth). Use scopedId — not id — as the canonical key in dispatch() targets, getElement(), find(), and OverrideSet keys when addressing sub-composition elements.Direct child elements. Build a flat list with
flatElements() from @hyperframes/sdk utilities.Inline CSS properties in camelCase, mirroring
CSSStyleDeclaration convention (fontSize, not font-size).All HTML attributes except
style, class, and data-hf-* (those are represented elsewhere in the model).The element’s direct text content, intended as the
setText target. Not a full descendant-text snapshot.Timing start in seconds (
data-start). null when the element carries no timing attribute.IDs of GSAP tweens whose target is this element. Pass these to the GSAP tween ops in
dispatch().ElementSnapshot
HyperFramesElement. Used in return types of getElements() and getElement() to signal that the value is a read-only snapshot — it does not update after subsequent mutations.
SdkDocument
The SDK’s in-memory document model. Returned bybuildDocument().
Top-level elements of the composition body. Walk the tree via
.children.Build-time snapshot of the
ensureHfIds-stamped HTML. This value is never updated after mutations — call comp.serialize() to get the current document state.OverrideSet
overrides to openComposition(), or read the accumulated delta with comp.getOverrides().
Key format: hfId.prop.path, where:
hfId.style.fontSize— inline style property overridehfId.text— text content overridehfId.attr.src— attribute overridehfId(key only, valuenull) — element removed by uservar.{id}— variable override; value is a scalar or an object (FontValue/ImageValue)
null value = removal marker: the element or property was deleted by the user.
FindQuery
Passed tocomp.find(query) to search elements by descriptor.
Match by the element’s direct text content (case-sensitive substring match — implemented with
String.includes).Restrict results to elements inside a specific sub-composition, identified by the host element’s hf-id.
GsapTweenSpec
Describes a single GSAP tween entry to create or update.GSAP tween method.
"from" animates from the given values to the computed values; "to" animates toward the given values; "fromTo" animates from fromProperties to toProperties; "set" snaps without interpolation.Timeline insertion position. A number is seconds from the timeline start. A string is a label-relative offset such as
"intro" or "outro-=0.5". Omit to append.Starting values for
"from", target values for "to", or immediate values for "set".
Also supplies the destination of "fromTo" when toProperties is omitted.KeyframeSpec
A single keyframe entry foraddWithKeyframes and replaceWithKeyframes. This is a structural shape, not a runtime export — you pass plain objects of this form to those methods; it is not re-exported from the @hyperframes/sdk barrel, so there is nothing to import.
ElasticHold
Controls the elastic hold (freeze or loop) window for an element."freeze" holds the last frame statically; "loop" cycles the animation within the window.CompositionVariable
The full schema for one declared variable — used bycomp.declareVariable(), returned from comp.listVariables(). A closed union discriminated on type; every variant shares the same base fields plus its own type-specific ones.
Stable identifier, referenced by
setVariableValue, getVariableValue, removeVariable, and var.{id} override-set keys.The variable’s default value.
font accepts a font-family string or FontValue; image accepts a URL string or ImageValue. setVariableValue persists the whole value here, including font source and image metadata. Declaration reads, validation, and save/reopen preserve these objects.Optional semantic label for brand-system tooling, e.g.
"color:primary" or "logo:primary".Font stylesheet URL (e.g. a Google Fonts CSS link) paired with the
default font-family name.FontValue
Object value for afont composition variable. Always an object — never a raw CSS string.
ImageValue
Object value for animage composition variable. Always an object — never a raw URL string.
Object-fit behavior for the image within its container. Maps to the CSS
object-fit property.JsonPatchOp
An emit-only subset of RFC 6902 JSON Patch. The SDK never emitsmove, copy, or test ops, and applyPatches() ignores operations outside this subset.
PatchEvent
Emitted bycomp.on('patch', handler) after every committed change (single dispatch() or completed batch()).
Always
1. A bump in formatVersion is a breaking change. Hosts should check this value once on startup and reject unknown versions.Forward patches that transform the previous document state into the new state.
Inverse patches that undo this change — apply to the new state to return to the previous state. Store these for host-side undo stacks.
Re-emitted verbatim from the mutation entry. Identify automated patches by checking
origin === ORIGIN_APPLY_PATCHES.Semantic op names from the
EditOp.type field (e.g. ["setStyle", "setText"]). Intended for analytics and history labels. Not versioned — do not use in branching logic.applyPatches(), it must skip events that originated from that call to avoid infinite loops:
CanResult
Returned bycomp.can(op). See Edit Operations for the full usage pattern.
Stable error code for
ok: false — safe to use in switch statements. See the code table in Edit Operations.ElementTimingSnapshot
Resolved timing for one element, returned as values in theRecord<HfId, ElementTimingSnapshot> from comp.getElementTimings().
Time in seconds when the element enters. Derived from
data-duration (preferred) or data-end − data-start as fallback, using the same logic as setTiming.GSAP
addLabel names whose numeric position falls within [enterAt, exitAt] for this element. Parsed fresh from the GSAP script on every getElementTimings() call — never cached.SelectionProxy
Proxy returned bycomp.selection(). Resolves the current selection at call time and applies ops per-id within a single batch. Selection changes between calls are picked up automatically since ids is resolved fresh each time you call comp.selection().
ElementHandle
A curried element handle returned bycomp.element(id). Holds only the id string — no stale-reference hazard — and provides the same mutation methods as typed methods on Composition.
CompositionVariableType
@hyperframes/parsers; VARIABLE_TYPES is the matching runtime list, useful
for validators that need the set rather than the union.
VariableUsageScan
usedIds is in first-seen order. scanIncomplete is true when the script
reaches variables in a way the scan cannot resolve — computed keys, rest
spreads, the values object escaping into a call — or when it fails to parse;
usedIds is then a lower bound, not a complete list, so treat an unlisted id as
unknown rather than unused.
ORIGIN_APPLY_PATCHES / ORIGIN_LOCAL
origin tag constants:
ORIGIN_APPLY_PATCHES— automatically set bycomp.applyPatches(). Listeners must skip this origin to prevent undo loops when mirroring patch events back into the SDK. Uses a namespaced string (not a unique Symbol) so the sentinel survives realm boundaries such aspostMessageand structured clone, which T3 embedded hosts may use to forward patch events.ORIGIN_LOCAL— default origin used whendispatch()orbatch()is called without an explicitoriginoption. Signals UI-driven user edits.
EditOp
The full union of all dispatchable edit operations. See Edit Operations for the complete catalog with field descriptions and code examples.PersistErrorEvent
Emitted bycomp.on('persist:error', handler) when an autosave write fails. Failures are non-fatal — the session continues operating normally.