@roadline/core
v0.2.0
Published
Framework-agnostic engine for the Roadline timeline: time scale, ticks, layout, interactions.
Maintainers
Readme
@roadline/core
The engine behind Roadline, a headless timeline / Gantt library. Plain TypeScript: no React, no DOM, no dependencies.
Most people want @roadline/react.
Install this directly to drive a timeline from another framework, or to use the
pieces on their own.
npm install @roadline/coreScale — toPx, toTime, zoomAt, panBy, fitRange, clampScale,
visibleRange. A scale is { start, msPerPx }; zooming is anchored, so the
instant under the cursor stays under the cursor even at the zoom limits.
Ticks — chooseTier, generateTicks, alignTick, formatTick. Generation
is a calendar walk rather than a fixed millisecond step, so months keep their
real lengths and DST days their real durations.
Dates — createDateAdapter({ timeZone, locale, weekStartsOn }). Any IANA
zone with nothing to ship: offsets are resolved through
Intl.DateTimeFormat.formatToParts. Wall-clock times that do not exist or occur
twice — the two DST edges — are resolved explicitly rather than by rounding.
Data — createItemIndex (bucketed interval index; a viewport query over
50 000 items takes about 0.13 ms), buildGroupTree, groupSummaries,
computeRowWindow.
Interactions — reduceInteraction, a pure gesture state machine with no
DOM, plus snapTime and edgeScrollVelocity.
Links — elbowPath and friends: orthogonal routing for dependency arrows,
FS / SS / FF / SF.
import { fitRange, toPx, zoomAt } from '@roadline/core'
let scale = fitRange({ start: q1Start, end: q1End }, 800)
scale = zoomAt(scale, 400, 2) // zoom in around the middle
const x = toPx(scale, Date.now())MIT
