@techsquidtv/canvas-timeline
packages/timeline/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.
FunctionTimelineProvider
Sets up a bridge between the central event-driven `TimelineEngine` model and standard React functional layouts. Subscribes to settled state, selection, playback, content, and clipboard changes, pushing lightweight state updates downwards into hooks.
VariableTimeline
Namespace of timeline UI components for composing an editor surface.
FunctionCanvasRenderer
Renders the timeline canvas layer using an offscreen worker.
FunctionfromSeconds
Converts seconds to rational timeline time at the requested tick rate.
HooksuseTimeline
Reads the timeline engine and synchronized state from React context. Use this hook inside components wrapped by `TimelineProvider` when you need to call imperative engine commands and read the latest React-rendered state in the same component. Prefer narrower hooks such as `useTimelineState`, `useTimelinePlayback`, or `useTimelineClips` when a component only needs one slice of timeline behavior.
API Index
Exhaustive list of all public exports grouped by category.
Hooks
54Returns clips that intersect the current playhead time. A clip is active when the playhead is at or after `timelineStart` and before `timelineEnd`. Clips on hidden tracks, muted tracks, and clips marked `disabled` are omitted. The returned array contains clips only; read the timeline state when you also need the containing track id.
useActiveLayersReturns active timeline layers at a timeline time. The hook is collection-first: each named layer returns every matching active clip in stable track order. `primary` is only a convenience first match.
useActiveMarkersSubscribes to live marker proximity derived from the current playhead. Use this focused live hook for readouts and marker navigation UI that should update during playback or scrubbing. Use `useTimelineMarkers` for ordinary marker lists and marker editing commands.
useClipEditPreviewReads the transient edit-preview state for a clip. Use this for custom clip UIs that need to render live editing affordances, such as overwrite cut indicators, without depending on internal engine flags.
usePlaybackEffectSubscribes to real-time playback events (enter, update, leave) for a specific clip as the global playhead crosses the clip's boundary timestamps.
useRangeScrollbarDerives geometry and controlled update helpers for a generic range scrollbar.
useTimelineReads the timeline engine and synchronized state from React context. Use this hook inside components wrapped by `TimelineProvider` when you need to call imperative engine commands and read the latest React-rendered state in the same component. Prefer narrower hooks such as `useTimelineState`, `useTimelinePlayback`, or `useTimelineClips` when a component only needs one slice of timeline behavior.
useTimelineCanvasLayerWires an app-owned canvas to timeline geometry and redraw events. Drawing is imperative and scheduled through requestAnimationFrame so dense visual layers do not push scroll or zoom updates through React state.
useTimelineClipboardProvides access to clipboard operations for copying, cutting, and pasting clips.
useTimelineClipDragHeadless clip body drag behavior shared by canvas and custom timeline UIs.
useTimelineClipDropFeedbackSubscribes to live cross-track clip drop feedback. This is a focused live interaction hook intended for custom drag affordances.
useTimelineClipNavigationProvides constant-DOM keyboard navigation and commands for canvas clips. The hook flattens canvas-rendered clips into a navigable model without mounting one DOM element per clip. Consumers can use the returned `focusTargetProps` on a single focused element, or wire the navigation and edit commands into their own shortcut system and selected-clip inspector.
useTimelineClipRectsReturns viewport-space geometry for every timeline clip. The hook subscribes to geometry-affecting timeline events and intentionally does not subscribe to playhead-only updates.
useTimelineClipsProvides the canonical clip collection and editing actions for React editor UI.
useTimelineEditCommandsExposes command-layer edit APIs for React product chrome. The hook is a thin adapter over `TimelineEngine` command methods; it does not implement edit math or range mutation rules in React.
useTimelineEditImpactsSubscribes to live edit impacts produced by active timeline interactions. This is a live interaction hook: it can update during drag and trim gestures. Use it for custom headless UI affordances that show which clips are trimmed, split, or removed by the active edit.
useTimelineEditModeOwns local edit-mode state for product toolbar chrome. The selected mode does not mutate engine state by itself. Compose it with `useTimelineEditCommands` to build and preview typed edit commands.
useTimelineEditPreviewSubscribes to live command-layer edit previews. This is a focused live hook. It updates when command previews change and does not broaden provider state with drag-time edit consequences.
useTimelineEventSubscribes to a typed TimelineEngine event with a React-safe latest handler. The hook keeps the event subscription stable while updating the callback ref every render, avoiding stale closures without resubscribing for handler-only changes.
useTimelineHistoryProvides canonical undo/redo history access for timeline editor chrome.
useTimelineInOutRangeControlAdapts timeline In/Out points to a Base UI-compatible range slider. The hook keeps loop or export boundaries in sync with `TimelineEngine` `inPoint` and `outPoint` values while returning semantic labels and `aria-valuetext` strings for each thumb. `Timeline.RangeSelector.Root` uses this hook internally; consumers can call it directly when composing their own Base UI slider surface.
useTimelineKeyboardProvides focus-scoped timeline keyboard shortcuts. The hook never installs global listeners. It handles shortcuts only from the element that spreads `scopeProps` or one of that element's descendants.
useTimelineKeyframeCurveDragHeadless Bezier curve handle drag behavior shared by package and custom timeline UIs.
useTimelineKeyframeCurvesReads timeline keyframe curve geometry and exposes Bezier easing commands.
useTimelineKeyframeDragHeadless keyframe drag behavior shared by canvas and custom timeline UIs.
useTimelineKeyframesReads timeline keyframe geometry and exposes canonical keyframe commands.
useTimelineMarkersAccesses and manages bookmark/annotation pins (markers). This canonical marker hook does not subscribe to live playhead ticks. Compose it with `useActiveMarkers` when UI needs marker proximity at the current playhead.
useTimelineMediaPlaybackCoordinates timeline playback with an external media clock. The hook is media-library agnostic. Apps provide a clock and a single layer sync callback while the hook advances the TimelineEngine playhead and decides when active layer clips need to be resynchronized.
useTimelineMediaSyncHigh-level synchronization for external media surfaces. The hook remains media-library agnostic: apps provide an adapter for decoding, rendering, and audio scheduling, while the hook handles active layer lookup, first-content seeking, external-clock playback, rate changes, and pause state.
useTimelinePanControlAdapts horizontal timeline scroll to a Base UI-compatible scalar slider. Use this hook when an application wants a semantic pan control for `TimelineEngine.scrollLeft`. It overlaps with `useTimelineViewport` only at the engine command layer; this hook adds slider props, bounds, and formatted ARIA value text for custom UI primitives.
useTimelinePlaybackProvides canonical transport, playhead command, and in/out range commands. Compose this with `useTimelinePlayheadTime` when a component also needs a live clock readout.
useTimelinePlayheadControlAdapts the timeline playhead to a Base UI-compatible scalar slider. Use this hook when an application wants its own playhead scrubber, time field, or transport control while preserving the shared `TimelineEngine` state. It composes with `useTimelinePlayback`, which exposes imperative transport commands without subscribing to live playhead ticks.
useTimelinePlayheadTimeHook to subscribe directly to playhead scrubbing changes. Bypasses root-level context state updates to keep scrubbing high-performance.
useTimelineRangeSelectionAdapts timeline In/Out points to command-layer range selection. The hook treats a complete In/Out pair as the selected edit range and delegates range mutations to `useTimelineEditCommands`.
useTimelineRulerTicksReturns shared viewport-space ruler ticks for DOM and custom timeline chrome. The hook subscribes to geometry-affecting timeline events and intentionally does not subscribe to playhead-only updates.
useTimelineScrollLeftHook to subscribe directly to scroll left position changes. Bypasses root-level context state updates for smooth scroll navigation.
useTimelineScrollTopHook to subscribe directly to scroll top position changes. Bypasses root-level context state updates for smooth vertical navigation.
useTimelineSelectionProvides the canonical selected clip/track model for timeline editor chrome.
useTimelineSnappingProvides the canonical snapping state and commands for editor UI.
useTimelineStateReads the current synchronized timeline state. This is a render-focused shortcut for components that need track, playhead, zoom, scroll, marker, or playback state without calling engine methods. The returned value updates when `TimelineProvider` receives engine state events.
useTimelineTimePositionImperatively positions a low-count DOM affordance at a timeline time. The returned transform is viewport-space: `seconds * zoomScale - scrollLeft`. Use it for standalone affordances such as the playhead grabber. Range controls that already live inside a transformed timeline overlay should use their local control primitive positioning instead.
useTimelineTrackAccesses one timeline track with canvas-aligned row geometry and commands.
useTimelineTrackDropTargetsBuilds headless track drop targets for cross-track clip movement.
useTimelineTrackHeaderAdapts one timeline track into DOM-ready track header state.
useTimelineTrackLockControlAdapts one timeline track into a semantic lock toggle button.
useTimelineTracksAccesses and manages the list of timeline tracks.
useTimelineVerticalRangeControlAdds formatted accessibility values to the vertical timeline scrollbar adapter.
useTimelineVerticalScrollbarAdapts generic range scrollbar state to the timeline's vertical track viewport. The hook derives a controlled `{ start, end }` value from `scrollTop`, `viewportHeight`, and track-stack bounds. Thumb changes pan the engine-owned vertical scroll position so canvas rows and external DOM chrome can stay in sync. Handle changes scale expanded track heights, giving the range handles a vertical zoom behavior that matches the horizontal viewport scrollbar's shape.
useTimelineViewportProvides canonical viewport metrics and setters for custom timeline chrome.
useTimelineViewportRangeControlAdds formatted accessibility values to the timeline viewport range adapter. This hook builds on `useTimelineViewportScrollbar`, preserving the same lean viewport scrollbar geometry and keyboard behavior while adding `aria-valuetext` formatting for the thumb and resize handles. Use it with the generic `RangeScrollbar` primitive when composing a custom viewport control.
useTimelineViewportScrollbarAdapts generic range scrollbar state to the current timeline viewport. The hook derives a controlled `{ start, end }` value from timeline `scrollLeft`, `zoomScale`, `viewportWidth`, and content duration. Thumb changes pan the engine, while handle changes update zoom and then restore the requested range start.
useTimelineVisibleClipsReturns viewport-intersecting timeline clips with clipped time/source ranges. This is the preferred hook for custom DOM clip renderers and custom canvas layers that only need visible or near-visible clips.
useTimelineZoomControlAdapts timeline zoom scale to a Base UI-compatible scalar slider. Use this hook when a product toolbar needs a focused, semantic zoom control rather than broad viewport commands from `useTimelineViewport`. The returned root props mutate `TimelineEngine.zoomScale`; thumb props provide the default label and formatted `aria-valuetext`.
useTimelineZoomScaleHook to subscribe directly to zoom changes. Bypasses root-level context state updates for low-latency zoom interaction.
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
217Clip 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.
CanvasRendererErrorRenderer setup or worker failure details.
CanvasRendererPropsProps for the timeline canvas renderer layer.
CanvasRendererStatsDiagnostic timing details emitted after a canvas renderer draw pass.
ClipRepresents an individual media clip node positioned at a specific timeline interval.
ClipCreatedEventPayload emitted by `clip:created` for committed clip creation.
ClipDoubleClickDetailsDetails passed to a clip double-click or double-tap callback.
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.
ClipInteractionLayerPropsProps for the delegated clip interaction layer.
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.
KeyboardScopePropsProps for the focus-scoped timeline keyboard shortcut wrapper.
KeyframeCurveHandleDoubleClickDetailsDetails passed to a Bezier curve handle double-click or double-tap callback.
KeyframeCurveInteractionLayerPropsProps for the delegated Bezier curve interaction layer.
KeyframeDeleteDetailsDetails passed to a keyframe keyboard delete callback.
KeyframeDoubleClickDetailsDetails passed to a keyframe double-click or double-tap callback.
KeyframeInteractionLayerPropsProps for the delegated keyframe interaction layer.
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.
ParseTimecodeToRationalTimeOptionsOptions for parsing editable timecode text into `RationalTime`.
PlaybackOptionsOptions for starting timeline playback.
PlayheadAreaPropsProps for the interactive playhead scrub area.
PlayheadGrabberPropsProps for the draggable playhead handle.
RangeChangeDetailsChange metadata emitted by Base UI range slider interactions.
RangeScrollbarAriaValueTextDetailsContext passed to a range scrollbar `aria-valuetext` formatter.
RangeScrollbarHandlePropsProps for a range scrollbar resize handle.
RangeScrollbarRootPropsProps for the controlled range scrollbar root.
RangeScrollbarThumbPropsProps for the draggable range scrollbar thumb.
RangeScrollbarValueControlled numeric range represented by a range scrollbar. `start` and `end` use the caller's domain units. For a timeline adapter those units might be seconds; for a chart they might be indexes, prices, or pixels.
RangeScrollbarValueChangeDetailsDetails passed with a controlled range scrollbar value change.
RangeSelectorGrabberRenderPropsRender-prop payload for custom range selector grabber children.
RangeSelectorPropsProps for the high-level timeline range selector overlay.
RangeSelectorRootPropsProps for the RangeSelector Root component.
RationalTimeStores a timeline time as integer ticks at a fixed rate.
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.
TimecodeFieldCommitDetailsDetails passed when a `TimecodeField` commits a valid value.
TimecodeFieldInputPropsProps for the temporary typed timecode editor.
TimecodeFieldRootPropsProps for the compact inline timecode editing root.
TimecodeFieldTriggerPropsProps for the compact displayed timecode value.
TimecodeFormatOptionsOptions for formatting a seconds value into editable timecode text.
TimecodeInputPropsProps for the timecode text input primitive. Extends Base UI `Input` props, so controlled and uncontrolled React input patterns both work. Use `onValueChange` for the current text value as the user types, or `onChange` when composing with native form handlers. By default it renders as a plain text input, disables browser autocomplete, and disables spellcheck so punctuation-heavy values such as `1:02:03.04` stay visually stable. Pass explicit native input props when a form needs different behavior.
TimecodeParseOptionsOptions for parsing editable timecode text into seconds.
TimeGrabberRenderPropsRender-prop payload for custom draggable time grabber children.
TimelineCanvasLayerDrawContextContext passed to a custom canvas layer draw callback.
TimelineCanvasLayerHandleImperative handle returned by `useTimelineCanvasLayer`.
TimelineCanvasLayerPropsProps for the package custom canvas layer component.
TimelineCanvasLayerViewportViewport metrics supplied to a custom canvas layer draw callback.
TimelineClipDragMoveInputPointer data needed to update a clip body drag.
TimelineClipDragStartInputPointer data needed to begin a clip body drag.
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.
TimelineClipNavigationOptionsOptions for constant-DOM canvas clip navigation.
TimelineClipRectClip entry with viewport geometry and editing/display state.
TimelineCommandResultConsistent result returned by React hook command APIs.
TimelineContextValueInterface representing the context bundle of the timeline provider.
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.
TimelineEventOptionsOptions for `useTimelineEvent`.
TimelineInOutRangeControlOptionsOptions for adapting timeline In/Out points to a range control.
TimelineInsertEditCommandCommand that inserts a new clip and pushes later clips forward.
TimelineInteractionGeometryCanvas-aligned geometry settings for clip hit testing and affordance placement.
TimelineKeyBindingSingle keyboard chord mapped to a timeline command.
TimelineKeyboardBindingOptionsOptions for creating preset timeline keyboard bindings.
TimelineKeyboardEventLikeKeyboard-event fields used by the pure shortcut matcher.
TimelineKeyboardOptionsOptions for `useTimelineKeyboard`.
TimelineKeyframeOne clip-scoped property keyframe positioned at an absolute timeline time.
TimelineKeyframeCurveDragMoveInputPointer data needed to update a Bezier curve handle drag.
TimelineKeyframeCurveDragStartInputPointer data needed to begin a Bezier curve handle drag.
TimelineKeyframeCurveDragUpdateSuccessful Bezier curve handle drag update payload.
TimelineKeyframeCurveEasingUpdateInputInput for updating one keyframe's Bezier easing.
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.
TimelineKeyframeDragMoveInputPointer data needed to update a keyframe drag.
TimelineKeyframeDragStartInputPointer data needed to begin a keyframe drag.
TimelineKeyframeDragUpdateSuccessful keyframe drag update payload.
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.
TimelineLayerSyncDetailsDetails passed to external media sync callbacks.
TimelineLiftRangeEditCommandCommand that removes a timeline range while leaving the gap in place.
TimelineMediaSyncAdapterAdapter callbacks used to connect timeline playback to an external media clock.
TimelineMoveEditCommandCommand that moves an existing clip.
TimelineNavigableClipMetadata for one canvas-rendered clip exposed through clip navigation.
TimelineOverwriteEditCommandCommand that places a new clip and removes or trims overlaps on the target track.
TimelinePanControlOptionsOptions for adapting horizontal timeline scroll to a scalar control.
TimelinePlaceClipCommandClip placement command shared by insert and overwrite edits.
TimelinePlayheadControlOptionsOptions for adapting the timeline playhead to a scalar control.
TimelineProviderPropsProps for wiring a TimelineEngine into React context.
TimelineRangeSelectionTimeline range selected for range edit commands.
TimelineRangeValueFormatOptionsOptions for formatting a timeline start/end range for assistive technology.
TimelineRendererThemeCore rendering theme settings used by the Offscreen Canvas Web Worker to draw the timeline grid.
TimelineRenderOptionsToggles optional canvas feedback overlays that may be paired with separate interactive layers.
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.
TimelineSelectionStateSelected clip and track state derived from the current timeline snapshot.
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.
TimelineTimeValueFormatOptionsOptions for formatting a single timeline time value for assistive technology.
TimelineTrackDropContextContext passed to custom clip track-drop guards.
TimelineTrackDropResultResult of resolving whether a clip may drop on a track.
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.
TimelineViewportRangeControlOptionsOptions for viewport scrollbar accessibility formatting.
TimelineZoomConstraintsEngine-owned constraints for horizontal timeline zoom.
TimelineZoomControlOptionsOptions for adapting timeline zoom to a scalar control.
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).
TrackHeaderListPropsProps for the track header list column.
TrackHeaderPropsProps for one timeline track header row.
TrackHeaderResizeHandlePropsProps for the track header resize handle.
TrackHitTestInputViewport-space pointer query for timeline track hit testing.
TrackItemPropsProps for a timeline track row bound to a track id.
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.
UseActiveMarkersResultResult returned by `useActiveMarkers`.
UseRangeScrollbarOptionsOptions for deriving generic range scrollbar state and update helpers.
UseRangeScrollbarResultGeneric range scrollbar geometry and mutation helpers.
UseTimelineCanvasLayerOptionsOptions for `useTimelineCanvasLayer`.
UseTimelineClipboardResultResult returned by `useTimelineClipboard`.
UseTimelineClipDragOptionsOptions accepted by `useTimelineClipDrag`.
UseTimelineClipDragResultResult returned by `useTimelineClipDrag`.
UseTimelineClipDropFeedbackResultResult returned by `useTimelineClipDropFeedback`.
UseTimelineClipsResultResult returned by `useTimelineClips`.
UseTimelineEditCommandsResultResult returned by `useTimelineEditCommands`.
UseTimelineEditImpactsResultResult returned by `useTimelineEditImpacts`.
UseTimelineEditModeResultResult returned by `useTimelineEditMode`.
UseTimelineEditPreviewResultResult returned by `useTimelineEditPreview`.
UseTimelineHistoryResultResult returned by `useTimelineHistory`.
UseTimelineKeyboardResultResult returned by `useTimelineKeyboard`.
UseTimelineKeyframeCurveDragResultResult returned by `useTimelineKeyframeCurveDrag`.
UseTimelineKeyframeCurvesOptionsOptions accepted by `useTimelineKeyframeCurves`.
UseTimelineKeyframeCurvesResultResult returned by `useTimelineKeyframeCurves`.
UseTimelineKeyframeDragOptionsOptions accepted by `useTimelineKeyframeDrag`.
UseTimelineKeyframeDragResultResult returned by `useTimelineKeyframeDrag`.
UseTimelineKeyframesOptionsOptions accepted by `useTimelineKeyframes`.
UseTimelineKeyframesResultResult returned by `useTimelineKeyframes`.
UseTimelineMarkersResultResult returned by `useTimelineMarkers`.
UseTimelineMediaPlaybackOptionsOptions for coordinating timeline playback with an external media clock.
UseTimelineMediaPlaybackResultResult returned by `useTimelineMediaPlayback`.
UseTimelineMediaSyncOptionsOptions for high-level timeline media synchronization.
UseTimelineMediaSyncResultResult returned by `useTimelineMediaSync`.
UseTimelinePlaybackResultResult returned by `useTimelinePlayback`.
UseTimelineRangeSelectionResultResult returned by `useTimelineRangeSelection`.
UseTimelineSelectionResultResult returned by `useTimelineSelection`.
UseTimelineSnappingResultResult returned by `useTimelineSnapping`.
UseTimelineTimePositionOptionsOptions for `useTimelineTimePosition`.
UseTimelineTimePositionResultResult returned by `useTimelineTimePosition`.
UseTimelineTrackDropTargetsOptionsOptions accepted by `useTimelineTrackDropTargets`.
UseTimelineTrackDropTargetsResultResult returned by `useTimelineTrackDropTargets`.
UseTimelineTrackHeaderResultResult returned by `useTimelineTrackHeader`.
UseTimelineTrackLockControlResultResult returned by `useTimelineTrackLockControl`.
UseTimelineTrackResultResult returned by `useTimelineTrack`.
UseTimelineTracksResultResult returned by `useTimelineTracks`.
UseTimelineVerticalRangeControlResultState and formatted accessibility props for a vertical timeline scrollbar.
UseTimelineVerticalScrollbarResultState and control props for rendering a vertical timeline scrollbar.
UseTimelineViewportResultResult returned by `useTimelineViewport`.
UseTimelineViewportScrollbarOptionsOptions for adapting a generic range scrollbar to the timeline viewport.
UseTimelineViewportScrollbarResultState and control props for rendering a timeline viewport scrollbar.
ViewportScrollbarRootPropsProps for the timeline viewport scrollbar root.
VisibleTimelineClipViewport-intersecting clip entry with clipped timeline and source-media ranges.
VisibleTimelineClipOptionsOptions for building viewport-intersecting clip geometry.
Type Alias
75Filters 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.
CanvasRendererRenderReasonReason the worker rendered a new canvas timeline frame.
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.
DeepPartialMakes every nested property in a type optional.
InOutBoundaryTimeline range boundary controlled by an In/Out grabber.
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.
RangeScrollbarChangeReasonReason a range scrollbar requested a controlled value change.
RangeScrollbarHandleSideSide of the range scrollbar thumb controlled by a resize handle.
RangeScrollbarOrientationVisual and interaction axis used by a range scrollbar.
RangeSelectorGrabberChildrenCustom node or render prop used inside an In/Out range selector grabber.
SnapPreparationOptionsOptions for building snap targets before a drag, trim, or range-boundary edit.
SourceFrameResolveModeSource-frame lookup strategy for media integrations.
TimecodeFieldCommitReasonReason a `TimecodeField` committed the current draft text.
TimecodeFormatDisplay shape used when formatting seconds for editable timecode text. `auto` keeps common decimal clock text unless a frame rate is provided. With a frame rate, `auto` formats frame timecode. `seconds`, `minutes`, and `hours` keep decimal centiseconds. `frames` formats `HH:MM:SS:FF`, and `drop-frame` formats `HH:MM:SS;FF`.
TimecodeFrameRateFrame rate accepted by frame-based timecode helpers. Pass a number for simple rates such as `24`, `25`, `30`, or `60`. Pass a rational object for exact fractional media rates such as `{ numerator: 30000, denominator: 1001 }`.
TimecodeInputFormatDisplay shape used when formatting seconds for a `TimecodeInput`. `auto` keeps common decimal clock text unless a frame rate is provided. With a frame rate, `auto` formats frame timecode. `seconds`, `minutes`, and `hours` keep decimal centiseconds. `frames` formats `HH:MM:SS:FF`, and `drop-frame` formats `HH:MM:SS;FF`.
TimecodeInputFormatOptionsOptions for formatting a seconds value into editable `TimecodeInput` text.
TimecodeInputParseOptionsOptions for parsing editable `TimecodeInput` text into seconds.
TimecodeInputParseRoundingRounding policy used when parsing editable `TimecodeInput` text. `none` preserves the decimal precision entered by the user, within normal JavaScript number limits. `centisecond` rounds parsed seconds to two decimal places for legacy or display-like workflows.
TimecodeParseRoundingRounding policy used when parsing editable timecode text. `none` preserves the decimal precision entered by the user, within normal JavaScript number limits. `centisecond` rounds the parsed seconds to two decimal places for legacy or display-like workflows.
TimeGrabberChildrenCustom node or render prop used inside a draggable time grabber.
TimelineCanvasLayerDrawDraw callback used by custom canvas layers.
TimelineCanvasLayerRenderReasonReason a custom canvas layer redraw was requested.
TimelineClipDropFailureReasonReason a clip cannot currently be dropped on a track.
TimelineClipGeometryOptionsOptions for building all clip viewport geometry.
TimelineClipUpdateEditable presentation fields accepted by `useTimelineClips().updateClip`.
TimelineCommandFailureReasonMachine-readable reason a timeline command could not be applied.
TimelineContentPlaybackStatusStatus emitted by the timeline media playback hook.
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.
TimelineEventHandlerCallback signature for a typed TimelineEngine event subscription.
TimelineKeyboardBindingsCommand-to-bindings map accepted by `useTimelineKeyboard`.
TimelineKeyboardCommandTimeline command names supported by the keyboard scope.
TimelineKeyboardPlatformPlatform bucket used for platform-specific professional editor bindings.
TimelineKeyboardPresetNamed shortcut presets for `useTimelineKeyboard`.
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.
TimelineMarkerUpdateEditable marker fields accepted by `useTimelineMarkers().updateMarker`.
TimelineMediaPlayFailureReasonReason high-level media-synchronized playback could not begin.
TimelineMediaPlayResultResult returned from a media-synchronized timeline play request. This high-level media adapter result is intentionally richer than `TimelineCommandResult` because failures include user-facing adapter messages in addition to machine-readable reasons.
TimelineMediaSyncReasonReason an external media callback is being synchronized.
TimelineRendererThemeInputPartial renderer theme overrides merged with the built-in canvas defaults.
TimelineRulerLabelFormatLabel style used by timeline ruler ticks.
TimelineRulerOptionsOptional ruler behavior for canvas-painted timeline ticks and labels.
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.
TimelineTimePositionEventEngine events that should refresh an imperatively positioned timeline element.
TimelineTrackDropGuardCustom policy for accepting or rejecting track drop targets.
TimelineTrackHeaderRootPropsDOM props returned for a track header row.
TimelineTrackLockControlButtonPropsProps returned for a track lock button.
TimelineVerticalScrollbarRangePropsControlled props required by `RangeScrollbar.Root` for vertical timeline scrolling.
TimelineViewportScrollbarRangePropsControlled props required by `RangeScrollbar.Root` for a timeline viewport.
TrackHeaderChildrenRender prop accepted by `Timeline.TrackHeader`.
UseTimelineClipRectsOptionsOptions accepted by `useTimelineClipRects`.
UseTimelineKeyframeCurveDragOptionsOptions accepted by `useTimelineKeyframeCurveDrag`.
UseTimelineRulerTicksOptionsOptions accepted by `useTimelineRulerTicks`.
UseTimelineVisibleClipsOptionsOptions accepted by `useTimelineVisibleClips`.
VerticalScrollbarHandlePropsProps for a timeline vertical scrollbar resize handle.
VerticalScrollbarRootPropsProps for the timeline vertical scrollbar root.
VerticalScrollbarThumbPropsProps for the timeline vertical scrollbar thumb.
ViewportScrollbarHandlePropsProps for a timeline viewport scrollbar resize handle.
ViewportScrollbarThumbPropsProps for the timeline viewport scrollbar thumb.
VisibleTimelineKeyframeViewport-intersecting keyframe entry.
VisibleTimelineKeyframeCurveSegmentViewport-intersecting keyframe curve segment.
Variable
16List of aesthetic color presets available for custom clip colors.
defaultTimelineCubicBezierDefault 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.
defaultTimelineRendererThemeBuilt-in renderer defaults. These values are serializable and safe to send to a Worker.
minimalTimelineKeyboardBindingsMinimal keyboard preset: playback only.
professionalEditorTimelineKeyboardBindingsProfessional editor preset bindings that do not depend on frame rate or platform.
RangeScrollbarNamespace of generic controlled range scrollbar primitives.
RangeScrollbarHandleResize handle for moving one side of the visible range.
RangeScrollbarRootRoot element for a controlled generic range scrollbar.
RangeScrollbarThumbDraggable thumb representing the visible range within a larger domain.
TimecodeFieldCompact timecode field parts. `TimecodeField.Root` owns editing state. `TimecodeField.Trigger` renders the compact displayed value, and `TimecodeField.Input` renders the temporary `TimecodeInput` used for typed edits.
TimecodeInputText input for entering timeline positions as timecode. Use `TimecodeInput` when a toolbar, inspector, or properties panel needs a native text input for clip starts, clip ends, playhead positions, or range boundaries. It keeps flexible entry open to the user (`90`, `1:30.25`, `1:02:03.4567`, and `00:01:30:12` can all represent timeline positions) while the companion helpers parse precise input and format display text consistently. This component renders only the input. Pair it with `parseTimecodeInput` to validate the current text, pass `invalid` when parsing returns `null`, and convert valid seconds back to `RationalTime` with `fromSeconds(parsed, rate)` at your timeline boundary. The rendered input receives `data-slot="timecode-input"` and a `timecode-input` class before consumer classes, which keeps it compatible with shadcn-style slot selectors and Canvas Timeline's semantic stylesheet approach. It forwards refs to the underlying native input element.
TimelineNamespace of timeline UI components for composing an editor surface.
TimelineCanvasLayerApp-owned canvas layer for drawing custom dense timeline visuals.
TimelineContextReact context containing the global engine controller and its reactive state model.
Function
46Adds two rational timeline times.
assertValidRationalTimeAsserts that a value is a finite rational timeline time.
CanvasRendererRenders the timeline canvas layer using an offscreen worker.
clampRestricts a number to an inclusive minimum and maximum range.
compareRationalCompares two rational timeline times.
createLeanMarkersCreates a sanitized marker array for timeline state and history snapshots.
createTimelineKeyboardBindingsCreates the built-in keyboard binding map for a preset.
createTimelineRendererThemeCreates a complete renderer theme from optional nested overrides.
deriveTimelineSelectionDerives selected clip and track metadata from timeline tracks.
flattenTimelineClipsFlattens timeline tracks into stable clip entries.
formatRationalTimecodeFormats a `RationalTime` as editable timecode text.
formatSecondsFormats a rational timeline time as decimal seconds.
formatTimeFormats a rational timeline time as mm:ss.
formatTimecodeFormats seconds for flexible editable timecode text. Decimal formats are rounded to centiseconds and clamped at zero. Non-finite values are treated as zero. Frame formats round to the nearest frame for the supplied frame rate.
formatTimecodeInputFormats seconds for editable `TimecodeInput` text. Decimal formats are rounded to centiseconds and clamped at zero. Frame formats round to the nearest frame for the supplied frame rate. Use this at UI boundaries after converting from `RationalTime` with `toSeconds`.
formatTimelineRangeValueFormats a start/end timeline range for assistive technology.
formatTimelineTimeValueFormats a timeline time for assistive technology. The result intentionally avoids timecode punctuation and raw floating point artifacts so controls can use it as `aria-valuetext`.
fromSecondsConverts seconds to rational timeline time at the requested tick rate.
fromTimecodeFrameNumberConverts a zero-based frame number to rational timeline time.
getClipAccessibleDescriptionReturns a richer clip description without requiring one DOM node per clip.
getClipAccessibleNameReturns a concise clip name suitable for labels or active-item summaries.
getPresetColorGenerates a random color value from the predefined list of aesthetic presets. Used when creating new clips, markers, or dynamic color selections.
getTimelineCubicBezierProgressEvaluates a Cubic Bezier easing curve at normalized time progress.
getTimelineKeyboardCommandResolves a keyboard event to the first matching command in stable command order.
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.
maxRationalReturns the later of two rational timeline times.
minRationalReturns the earlier of two rational timeline times.
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.
parseTimecodeParses flexible editable timecode text into seconds. Accepts plain seconds, decimal seconds, `m:ss`, `m:ss.cc`, `h:mm:ss`, `h:mm:ss.cc`, flexible single-digit colon segments such as `1:2`, and unit suffixes like `s` (seconds), `ms` (milliseconds), `m` (minutes), or `f` (frames, which requires a `frameRate` option). Invalid, negative, missing, or out-of-range user text returns `null`. Invalid developer options such as unsupported drop-frame rates throw `RangeError`.
parseTimecodeInputParses editable `TimecodeInput` text into seconds. Accepts plain seconds, decimal seconds, `m:ss`, `m:ss.cc`, `h:mm:ss`, `h:mm:ss.cc`, flexible single-digit colon segments such as `1:2`, and unit suffixes like `s` (seconds), `ms` (milliseconds), `m` (minutes), or `f` (frames, which requires a `frameRate` option). Invalid, negative, missing, or out-of-range user text returns `null`. Invalid developer options such as unsupported drop-frame rates throw `RangeError`.
parseTimecodeToRationalTimeParses editable timecode text into `RationalTime`.
rationalEqualsChecks whether two rational timeline times represent the same moment.
resolveTimecodeFrameRateResolves a frame-rate option to frames per second. This uses the same validation and normalization path as the timecode formatter/parser helpers, so invalid rates throw the same `RangeError`.
resolveTimelineRendererThemeFromElementResolves shadcn/CSS custom properties into a serializable renderer theme. CSS is read on the main thread only. The returned object can be passed through postMessage to the worker without the worker touching DOM APIs.
roundRounds a number to the requested number of decimal places.
shiftClipKeyframesShifts all keyframes on a clip by a timeline delta.
subRationalSubtracts one rational timeline time from another.
timelineCommandFailCreates a failed timeline command result.
timelineCommandOkCreates a successful timeline command result.
TimelineProviderSets up a bridge between the central event-driven `TimelineEngine` model and standard React functional layouts. Subscribes to settled state, selection, playback, content, and clipboard changes, pushing lightweight state updates downwards into hooks.
toSecondsConverts a rational timeline time to seconds.
toTimecodeFrameNumberConverts a rational time to the nearest source frame number.