Overview
The core package is the timeline model and editor brain without a view layer. It owns tracks, clips, markers, selections, edits, playback state, snapping, history, and active-content queries.
Use it directly when React is not the right boundary, or when you want tests and non-visual logic to run without pulling in DOM components.
Install
pnpm add @techsquidtv/canvas-timeline-corenpm install @techsquidtv/canvas-timeline-coreyarn add @techsquidtv/canvas-timeline-corebun add @techsquidtv/canvas-timeline-coreReach for core when
- You are building a timeline in another UI framework or platform.
- You want isolated tests for edits, snapping, history, or playback behavior.
- You need to keep timeline state serializable and separate from app-owned media metadata.
Usage
Own the model, bring your own UI
Instantiate TimelineEngine with plain timeline data, then call engine commands from your UI or service layer. Keep media URLs, files, waveforms, and transcripts in application storage keyed by stable ids such as clip.sourceId.
- 1Represent all times as
RationalTimevalues, usually created with helpers from@techsquidtv/canvas-timeline-utils. - 2Use stable ids for tracks and clips; do not derive ids from array positions.
- 3Use engine commands to preview, commit, cancel, undo, and redo edits.
- 4Subscribe to engine events when your UI needs to react to state changes.
Example
import { TimelineEngine } from '@techsquidtv/canvas-timeline-core';import { fromSeconds } from '@techsquidtv/canvas-timeline-utils';
const engine = new TimelineEngine({ tracks: [] });
const preview = engine.previewEdit({ type: 'move', clipId: 'clip-intro', startTime: fromSeconds(4),});
if (preview.valid) { engine.commitEdit(preview.command);}