Use this file to discover all available pages before exploring further.
The core package provides the foundational types, HTML parsing/generation, runtime, and composition linter that all other Hyperframes packages build on. If you are building tooling, writing a custom integration, or extending Hyperframes itself, this is the package you need.
Most users do not need to install @hyperframes/core directly. The CLI, producer, and studio packages all depend on core internally. You only need it if you are doing one of the things listed below.
import type { Keyframe, KeyframeProperties, ElementKeyframes, StageZoom, StageZoomKeyframe,} from '@hyperframes/core';import { getDefaultStageZoom } from '@hyperframes/core';
import { generateBaseHtml, getStageStyles, GSAP_CDN, BASE_STYLES, ELEMENT_BASE_STYLES, MEDIA_STYLES, TEXT_STYLES, ZOOM_CONTAINER_STYLES,} from '@hyperframes/core';// Generate base HTML structure for a resolutionconst baseHtml = generateBaseHtml('landscape');const styles = getStageStyles('portrait');
The composition linter checks for structural issues that would cause rendering failures or unexpected behavior. You can run it from the CLI with npx hyperframes lint, or call it programmatically:
The compiler sub-package handles timing resolution, HTML compilation, and bundling:
// Timing compiler (browser-safe — no Node.js dependencies)import { compileTimingAttrs, injectDurations, extractResolvedMedia, clampDurations,} from '@hyperframes/core/compiler';import type { UnresolvedElement, ResolvedDuration, ResolvedMediaElement, CompilationResult,} from '@hyperframes/core/compiler';// Compile timing attributes from HTMLconst compiled: CompilationResult = compileTimingAttrs(html);// Inject resolved durations back into HTMLconst updatedHtml = injectDurations(html, compiled.durations);// Extract resolved media elementsconst media: ResolvedMediaElement[] = extractResolvedMedia(html);
// HTML compiler (Node.js — requires media probing)import { compileHtml } from '@hyperframes/core/compiler';import type { MediaDurationProber } from '@hyperframes/core/compiler';const prober: MediaDurationProber = async (src) => getDuration(src);const compiledHtml = await compileHtml(html, prober);
// HTML bundler (Node.js — bundles to single file)import { bundleToSingleHtml } from '@hyperframes/core/compiler';import type { BundleOptions } from '@hyperframes/core/compiler';const bundled = await bundleToSingleHtml({ entryPath: './index.html', inline: true });
// Static guard — validate HTML contractimport { validateHyperframeHtmlContract } from '@hyperframes/core/compiler';import type { HyperframeStaticGuardResult, HyperframeStaticFailureReason,} from '@hyperframes/core/compiler';const guard: HyperframeStaticGuardResult = validateHyperframeHtmlContract(html);// guard.ok, guard.failures[]// Failure reasons: "missing_composition_id" | "missing_composition_dimensions"// | "missing_timeline_registry" | "invalid_script_syntax"// | "invalid_static_hyperframe_contract"
The Hyperframes runtime manages playback, seeking, and clip lifecycle in the browser. The core package provides utilities for building and loading the runtime:
import { loadHyperframeRuntimeSource, buildHyperframesRuntimeScript, HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS,} from '@hyperframes/core';import type { HyperframeControlAction, HyperframesRuntimeBuildOptions,} from '@hyperframes/core';// Load the pre-built runtime IIFEconst runtimeSource = loadHyperframeRuntimeSource();// Build a custom runtime scriptconst script = buildHyperframesRuntimeScript(options);
The pre-built runtime IIFE is available as a direct import:
import { MEDIA_VISUAL_STYLE_PROPERTIES, copyMediaVisualStyles, quantizeTimeToFrame,} from '@hyperframes/core';import type { MediaVisualStyleProperty } from '@hyperframes/core';// Quantize a time value to the nearest frame boundaryconst frameTime = quantizeTimeToFrame(5.033, 30); // → 5.033... snapped to frame// Copy visual styles between media elementscopyMediaVisualStyles(fromElement, toElement);