Installation
pnpm add @techsquidtv/canvas-timeline-corenpm install @techsquidtv/canvas-timeline-coreyarn add @techsquidtv/canvas-timeline-corebun add @techsquidtv/canvas-timeline-coreWhen to use it
Common imports
import { TimelineEngine, type TimelineEditCommand, type TimelineState, type Track,} from '@techsquidtv/canvas-timeline-core';import { fromSeconds } from '@techsquidtv/canvas-timeline-utils';
const preview = engine.previewEdit({ type: 'move', clipId: 'clip-intro', startTime: fromSeconds(4),});
if (preview.valid) { engine.commitEdit(preview.command);}import { SnapIndex } from '@techsquidtv/canvas-timeline-core/snapping';Usage notes
- •Manages the serializable `TimelineState` source of truth, encapsulating tracks, clips, playback cursor, markers, and range selection.
- •Encapsulates typed edit commands (`validateEdit`, `previewEdit`, `commitEdit`, and `cancelEdit`), playback loops, history stacks (undo/redo), and typed snapping logic in a UI-agnostic environment.
- •Ideal for headless testing or custom platform integrations (such as Node.js or alternative rendering engines) due to zero DOM or UI dependencies.
API Surface
Explore the key components, hooks, and classes exported by this package. Click any symbol to view its full TSDoc parameter signatures.
Key Entry Points
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.
Represents the complete, serialized state model of the high performance timeline.
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.
Represents an individual media clip node positioned at a specific timeline interval.
Subpath Imports
Import specific files or modules directly to reduce bundle size or target specialized package layers.
| Import Path | Description |
|---|---|
| @techsquidtv/canvas-timeline-core | Types, engine, and snapping utilities. |
| @techsquidtv/canvas-timeline-core/engine | TimelineEngine entrypoint. |
| @techsquidtv/canvas-timeline-core/types | Track, Clip, Marker, and TimelineState types. |
| @techsquidtv/canvas-timeline-core/snapping | SnapIndex helpers for snapping and lookups. |