mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-04 07:19:52 +00:00
C1: getElementTimings/setElementTiming typed session methods + setHold typed wrapper. getElementTimings reads data-duration (preferred) or data-end−data-start (fallback) — same attr-preference as handleSetTiming. setElementTiming dispatches a sparse map as one batch → one patch event → one undo step. setHold mirrors setVariableValue pattern. Also fixes a pre-existing apply-patches.ts gap: the timing/duration patch case was absent, causing undo of duration changes to silently no-op. Added the duration branch so inverse patches restore data-duration correctly. C2: packages/core/src/compiler/timingResolver.ts — shared pure resolveTimings() consumed by BOTH preview (sdk session) and render (timingCompiler) paths. Word- anchored elements get enterAt = wordTimings[k].start + offset; elastic hold = max(0, slotEnd − (enterAt + enterDuration + exitDuration)), clamped ≥ 0; never timescales animated content. Un-anchored elements keep authored timing (align-on- adjust). Deterministic + pure: no Date.now, no Math.random, no DOM. extractGsapLabels() added to gsapParserAcorn.ts to parse tl.addLabel() calls for the getElementTimings labels field. Tests: timingResolver.test.ts (10 pure-function tests including preview==render parity golden test); session.timings.test.ts (15 session-layer tests covering duration-authored, end-authored, label extraction, batching, undo, and setHold regression). Gates: build ✓ · bun test (sdk+core/compiler) 434/434 ✓ · oxlint 0 warnings ✓ · oxfmt --check ✓ · fallow --gate new-only ✓ (complexity suppressed on 2 new inline functions, duplication warn-only pre-existing) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
export type {
|
|
HyperFramesElement,
|
|
SdkDocument,
|
|
OverrideSet,
|
|
EditOp,
|
|
ElasticHold,
|
|
FontValue,
|
|
ImageValue,
|
|
GsapTweenSpec,
|
|
HfId,
|
|
JsonPatchOp,
|
|
PatchEvent,
|
|
PersistErrorEvent,
|
|
ElementSnapshot,
|
|
ElementTimingSnapshot,
|
|
FindQuery,
|
|
SelectionProxy,
|
|
ElementHandle,
|
|
Composition,
|
|
CanResult,
|
|
} from "./types.js";
|
|
|
|
export { ORIGIN_APPLY_PATCHES, ORIGIN_LOCAL } from "./types.js";
|
|
|
|
export { UnsupportedOpError } from "./engine/mutate.js";
|
|
|
|
export { buildDocument, buildRoots, flatElements } from "./document.js";
|
|
|
|
export { openComposition } from "./session.js";
|
|
export type { OpenCompositionOptions } from "./session.js";
|
|
|
|
export { createHistory } from "./history.js";
|
|
export type { HistoryModule, HistoryOptions, HistoryEntry } from "./history.js";
|
|
|
|
export { createPersistQueue } from "./persist-queue.js";
|
|
export type { PersistQueueModule, PersistQueueOptions } from "./persist-queue.js";
|
|
|
|
export type { PersistAdapter, PreviewAdapter, PersistVersionEntry } from "./adapters/types.js";
|
|
|
|
// Concrete adapter factories (browser-safe — Node-only fs adapter: @hyperframes/sdk/adapters/fs).
|
|
export { createMemoryAdapter } from "./adapters/memory.js";
|
|
export { createHeadlessAdapter } from "./adapters/headless.js";
|
|
export { createIframePreviewAdapter, resolveNearestHfElement } from "./adapters/iframe.js";
|