@techsquidtv/canvas-timeline-core
packages/core/src/index.ts
Common Entry Points
Start with these essential APIs, then check the full reference index below.
TimelineEngine
The central orchestrator and coordinator for the high-performance timeline editor. Maintains state (tracks, clips, markers, playhead position, zoom scale, scrolls, snaps), builds dynamic snap indexes for magnetic snap guidance, handles split and edit actions, and publishes state events to trigger low-latency canvas renderings and lightweight React layouts.
InterfaceTimelineState
Represents the complete, serialized state model of the high performance timeline.
InterfaceTrack
A horizontal timeline lane containing clips and editing state. Tracks are app-owned rows in the timeline model. The engine uses each track's stable id for editing operations, reads the ordered clip list for rendering and hit testing, and honors view/editing flags such as visible, collapsed, locked, and muted.
InterfaceClip
Represents an individual media clip node positioned at a specific timeline interval.
API Index
Exhaustive list of all public exports grouped by category.
Class
3Binary-searchable timeline snap target index.
TimelineEngineThe central orchestrator and coordinator for the high-performance timeline editor. Maintains state (tracks, clips, markers, playhead position, zoom scale, scrolls, snaps), builds dynamic snap indexes for magnetic snap guidance, handles split and edit actions, and publishes state events to trigger low-latency canvas renderings and lightweight React layouts.
TypedEventEmitterA general, generic type-safe event emitter class. Extended by components needing typed event publishing and subscription contracts.
Interface
97Clip that is active at a timeline time, including its mapped source time.
ActiveClipQueryFilters for selecting active clips at a timeline time.
ActiveLayerOptionsOptions for selecting active timeline layers at a timeline time. Use this when integrations need named layers such as `visuals`, `audio`, `subtitles`, or `effects` instead of one flat active-clip list. The same active clip can match more than one layer.
ActiveLayerResultActive timeline layer lookup result. Results include every active clip matched by the requested selectors plus convenience `primary` entries for apps that only need the first match in each layer. Each `ActiveClip` includes mapped source time and source range data for preview and playback synchronization.
ClipRepresents an individual media clip node positioned at a specific timeline interval.
ClipCreatedEventPayload emitted by `clip:created` for committed clip creation.
ClipEditPreviewTransient edit-preview state attached to clips while an interaction is active. This state is not intended to be persisted with project data. UI layers can use it to render live editing affordances such as overwrite cut indicators.
ClipHitTestInputViewport-space pointer query for timeline clip hit testing.
ClipHitTestResultHit-test result for a clip pointer target.
ClipKeyframeChangeEventKeyframe add/update event payload.
ClipKeyframeRemoveEventKeyframe removal event payload.
ClipKeyframeSelectEventKeyframe selection change event payload.
ClipMoveEventLive clip movement event payload.
ClipPlayheadEventEvent payload emitted when the playhead enters, updates within, or leaves a clip.
ClipRemovedEventPayload emitted by `clip:removed` for committed clip removal.
ClipResizeEventLive clip resizing event payload.
ClipSelectEventClip selection change event payload.
ClipSlipEventLive clip slip event payload.
ClipSnapOptionsPersistent snap settings for one clip.
ClipSourceRangeSource-media interval covered by a timeline clip.
ClipSplitEventPayload emitted by `clip:split` for committed clip split.
ClipViewportRectViewport-space rectangle for a clip and its containing track.
EngineEventMapCentral event mapping definition for all engine events.
HistoryChangeEventUndo/redo history state change event payload.
InOutChangeEventSelection in/out point boundary change event payload.
MarkerRepresents a bookmark or annotation pin on the timeline's top time ruler.
MarkerChangeEventMarker change event payload (add, remove, update).
MarkerSnapOptionsPersistent snap settings for one marker.
PlaybackOptionsOptions for starting timeline playback.
SnapTargetOptionsControls which built-in timeline boundaries are indexed as magnetic snap targets.
SourceFrameExact source-frame timestamp returned by a media integration.
SourceFrameResolverApp or media-player supplied exact source-frame resolver.
TimelineClipDropFeedbackTransient feedback for a live cross-track clip drag.
TimelineClipEntryFlattened clip metadata shared by core geometry APIs, React hooks, and custom renderers.
TimelineClipMoveOptionsOptions for moving a clip in time and optionally into another track.
TimelineClipMoveResultResult metadata for a committed or previewed clip move.
TimelineClipRectClip entry with viewport geometry and editing/display state.
TimelineCubicBezierCubic Bezier easing control points used by Bezier keyframe interpolation.
TimelineDeleteRangeEditCommandCommand that removes a timeline range and ripples later clips closed by default.
TimelineEditAffectedRangeRange of timeline content affected by an edit command.
TimelineEditCommitResultResult returned after committing an edit command.
TimelineEditImpactDescribes how an active timeline edit affects one clip. This state is transient and is intended for headless UI affordances during live editing interactions. It is not part of the persisted project model.
TimelineEditImpactsActive live edit impacts for the current interaction. The model is operation-based so editing modes share the same headless React surface.
TimelineEditPolicyApp-defined behavioral policy for timeline edit commands.
TimelineEditPolicyContextContext passed to product-defined edit policy callbacks.
TimelineEditPreviewShared preview result produced for every edit command.
TimelineEditValidationResultResult returned by command validation and policy callbacks.
TimelineInsertEditCommandCommand that inserts a new clip and pushes later clips forward.
TimelineInteractionGeometryCanvas-aligned geometry settings for clip hit testing and affordance placement.
TimelineKeyframeOne clip-scoped property keyframe positioned at an absolute timeline time.
TimelineKeyframeCurveGeometryOptionsOptions for keyframe curve segment and handle geometry.
TimelineKeyframeCurveHandleBezier curve handle entry with viewport geometry and edit state.
TimelineKeyframeCurveHandleViewportRectViewport-space rectangle for one keyframe curve handle affordance.
TimelineKeyframeCurveHitTestInputViewport-space pointer query for keyframe curve handle hit testing.
TimelineKeyframeCurvePointViewport-space point used by keyframe curve segments and handles.
TimelineKeyframeCurveSegmentKeyframe curve segment entry with viewport geometry and optional Bezier handles.
TimelineKeyframeGeometryOptionsOptions for keyframe geometry and hit-testing.
TimelineKeyframeHitTestInputViewport-space pointer query for timeline keyframe hit testing.
TimelineKeyframeMutationOptionsOptions for committing or previewing keyframe mutations.
TimelineKeyframePointInputInputs for mapping a keyframe time/value pair into viewport space.
TimelineKeyframeRectKeyframe entry with viewport geometry and edit/display state.
TimelineKeyframeViewportRectViewport-space rectangle for one keyframe affordance.
TimelineLiftRangeEditCommandCommand that removes a timeline range while leaving the gap in place.
TimelineMoveEditCommandCommand that moves an existing clip.
TimelineOverwriteEditCommandCommand that places a new clip and removes or trims overlaps on the target track.
TimelinePlaceClipCommandClip placement command shared by insert and overwrite edits.
TimelineRippleTrimEditCommandCommand that trims one boundary and ripples later clips on the same track.
TimelineRollTrimEditCommandCommand that rolls the shared boundary between two adjacent clips.
TimelineRulerTickOne viewport-space ruler tick for canvas, DOM, or custom rendering.
TimelineRulerTickOptionsOptions for building shared headless timeline ruler ticks.
TimelineSetClipKeyframeOptionsInput for creating or upserting a clip keyframe.
TimelineSlideEditCommandCommand that moves an existing clip by a relative timeline offset.
TimelineSlipEditCommandCommand that shifts an existing clip's source start without moving timeline bounds.
TimelineSnapFeedbackTransient snap feedback consumed by canvas rendering and focused hooks.
TimelineSnapProviderContextContext passed to runtime snap target providers.
TimelineSnapResultResult of resolving a candidate time against the prepared snap index.
TimelineSnapTargetOne timeline time that can attract an edited boundary.
TimelineStateRepresents the complete, serialized state model of the high performance timeline.
TimelineTrackGeometryOptionsOptions for building track viewport geometry.
TimelineTrackHeightBatchOptionsOptions for batching row-height updates with related viewport state.
TimelineTrackHeightUpdateExpanded row height update for a timeline track.
TimelineTrackHitTestResultHit-test result for a timeline track row.
TimelineTrackRectViewport-space rectangle for a timeline track row.
TimelineTrimEditCommandCommand that trims one existing clip boundary.
TimelineUpdateClipKeyframeOptionsInput for updating one existing clip keyframe.
TimelineZoomConstraintsEngine-owned constraints for horizontal timeline zoom.
TrackA horizontal timeline lane containing clips and editing state. Tracks are app-owned rows in the timeline model. The engine uses each track's stable id for editing operations, reads the ordered clip list for rendering and hit testing, and honors view/editing flags such as visible, collapsed, locked, and muted.
TrackChangeEventTrack change event payload (add, remove).
TrackHitTestInputViewport-space pointer query for timeline track hit testing.
TrackLockEventTrack lock change event payload.
TrackMuteEventTrack mute change event payload.
TrackResizeEventTrack resize event payload.
TrackSelectEventTrack selection change event payload.
TrackSnapOptionsPersistent snap settings for one track and its clips.
TrackVisibilityEventTrack visibility change event payload.
VisibleTimelineClipViewport-intersecting clip entry with clipped timeline and source-media ranges.
VisibleTimelineClipOptionsOptions for building viewport-intersecting clip geometry.
Type Alias
27Filters for one named active layer. A layer selector describes the kind of active clips an app wants to drive, such as visual previews, audio playback, subtitles, effects, or a particular source asset. Selectors are matched against the active clips returned for a single timeline time.
ClipCreatedReasonReason a committed engine command created a new clip.
ClipHitRegionRegion of a timeline clip hit by pointer interaction.
ClipRemovedReasonReason a committed engine command removed a clip.
MaybePromiseA value that may be available immediately or after asynchronous media lookup.
PlaybackClockSourceClock responsible for advancing playback. Internal playback uses the engine's requestAnimationFrame loop. External playback lets a media player or audio clock drive playhead updates.
SnapPreparationOptionsOptions for building snap targets before a drag, trim, or range-boundary edit.
SourceFrameResolveModeSource-frame lookup strategy for media integrations.
TimelineClipDropFailureReasonReason a clip cannot currently be dropped on a track.
TimelineClipGeometryOptionsOptions for building all clip viewport geometry.
TimelineEditCommandFirst-class edit command accepted by TimelineEngine edit APIs.
TimelineEditImpactEffectConsequence of an active edit for an affected clip.
TimelineEditModeCurrent tool or intent family selected by product editor chrome.
TimelineEditOperationEditing operation that can produce live edit impacts.
TimelineEditRejectionReasonMachine-readable reason an edit command cannot be resolved or committed.
TimelineKeyframeCurveHandleHitTestResultHit-test result for a keyframe curve handle pointer target.
TimelineKeyframeCurveHandleKindBezier control handle edited by a curve interaction.
TimelineKeyframeHitTestResultHit-test result for a timeline keyframe pointer target.
TimelineKeyframeInterpolationSegment interpolation mode used from one keyframe to the next.
TimelineKeyframePropertyFirst-party clip property that can be animated with timeline keyframes.
TimelineRulerLabelFormatLabel style used by timeline ruler ticks.
TimelineRulerTickKindRuler tick visual weight.
TimelineSnapInteractionOperationTimeline interaction currently preparing or resolving snap targets.
TimelineSnapProviderRuntime source of app-defined snap targets such as grids, beats, and captions.
TimelineSnapTargetKindBuilt-in and application-defined magnetic snap target categories.
VisibleTimelineKeyframeViewport-intersecting keyframe entry.
VisibleTimelineKeyframeCurveSegmentViewport-intersecting keyframe curve segment.
Variable
3Default ease-in-out curve used when a Bezier keyframe omits easing control points.
defaultTimelineInteractionGeometryGeometry defaults shared by canvas-aligned interaction layers.
defaultTimelineMaxPixelsPerFrameDefault zoom-in density when a frame rate constrains timeline zoom.
Function
9Creates a sanitized marker array for timeline state and history snapshots.
getTimelineCubicBezierProgressEvaluates a Cubic Bezier easing curve at normalized time progress.
getTimelineKeyframeBezierControlPointsReturns viewport-space cubic Bezier control points between two keyframe points.
getTimelineKeyframeInterpolationProgressEvaluates normalized segment progress for a keyframe interpolation mode.
getTimelineKeyframeValuePointMaps one keyframe value to the same viewport point used by canvas drawing and DOM handles.
getTimelineRulerTicksBuilds shared viewport-space ruler ticks for canvas, DOM, and custom renderers.
normalizeTimelineCubicBezierValidates and clamps Cubic Bezier control points to the timeline interpolation domain.
normalizeTimelineKeyframeInterpolationNormalizes a keyframe interpolation mode. Unknown or omitted values are treated as linear.
shiftClipKeyframesShifts all keyframes on a clip by a timeline delta.