Package

React Timeline Math & Time Utilities

Rational time and shared math helpers.

Use the utility package when you need stable time conversions or math helpers without importing the editor layers.

Installation

pnpm
pnpm add @techsquidtv/canvas-timeline-utils

When to use it

You need to perform time operations (addition, subtraction, scaling) using exact `RationalTime` fractions rather than float seconds.
You require extremely lightweight time conversions, formatting (e.g., timecodes), or rounding helpers without importing any UI/editor dependencies.
You want to share identical time-parsing logic across both your core application state (like server exports or video playback APIs) and your timeline components.

Common imports

Time helpers
import {
formatTime,
fromSeconds,
toSeconds,
} from '@techsquidtv/canvas-timeline-utils';
Time-only entrypoint
import { fromSeconds } from '@techsquidtv/canvas-timeline-utils/time';

Usage notes

  • Implements pure `RationalTime` arithmetic and conversion functions to eliminate decimal precision drifting and ensure frame-perfect math.
  • Lightweight and decoupled, suitable for usage in backend services, export routines, or external metadata stores that require time semantic compatibility.
  • Provides core utilities like `fromSeconds`, `toSeconds`, and `formatTime` alongside shared math functions such as clamping and rounding.

API Surface

Explore the key components, hooks, and classes exported by this package. Click any symbol to view its full TSDoc parameter signatures.

Subpath Imports

Import specific files or modules directly to reduce bundle size or target specialized package layers.

Import PathDescription
@techsquidtv/canvas-timeline-utilsTime and math helper exports.
@techsquidtv/canvas-timeline-utils/timeRationalTime conversions and formatting.
@techsquidtv/canvas-timeline-utils/mathShared clamp and rounding helpers.