npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-feature-track-lane-react

v1.0.2

Published

Horizontal track lane primitive for music-DAW, video-editor, animation-tool — a single row in a multi-track timeline rendering draggable/resizable clips on a time-base axis

Readme

@molecule/app-feature-track-lane-react

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Horizontal track-lane primitive for multi-track timelines (music DAW, video editor, animation tool). Renders one lane row of draggable + resizable clip blocks on a pixelsPerSecond time axis.

Exports <TrackLane> and the Clip type, plus the pure-function helpers clipToPixels, pixelsToTime, and clampClipMove that back the pointer-event drag/resize math.

Quick Start

import { TrackLane } from '@molecule/app-feature-track-lane-react'

;<TrackLane
  name="Drums"
  clips={[
    { id: 'a', startTime: 0, duration: 2, color: '#0af', label: 'Kick' },
    { id: 'b', startTime: 4, duration: 1.5, label: 'Snare' },
  ]}
  pixelsPerSecond={20}
  onClipMove={(id, t) => updateClip(id, { startTime: t })}
  onClipResize={(id, d) => updateClip(id, { duration: d })}
  onClipClick={(id) => setSelected(id)}
  selectedClipId={selected}
/>

Type

feature

Installation

npm install @molecule/app-feature-track-lane-react @molecule/app-react @molecule/app-ui react
npm install -D @types/react

API

Interfaces

Clip

A single clip block on a track lane. startTime and duration are both in seconds; pixelsPerSecond on the lane converts them to the on-screen geometry. id is a stable identifier used as the React key and as the argument passed back to all event handlers. color accents the body fill (defaults to a neutral surface) and label is rendered inside the clip when given.

interface Clip {
  /** Stable identifier for the clip (used as a React key + handler arg). */
  id: string
  /** Clip start time on the lane in seconds. */
  startTime: number
  /** Clip duration in seconds. Always positive — minimum is enforced. */
  duration: number
  /** Optional accent color for the clip body (any valid CSS color). */
  color?: string
  /** Optional inline label rendered on top of the clip body. */
  label?: ReactNode
}

TrackLaneProps

Props for <TrackLane>.

interface TrackLaneProps {
  /** Optional lane name shown in the leading lane header. */
  name?: ReactNode
  /** Clips on this lane. Order is preserved as-is. */
  clips: Clip[]
  /** Horizontal time scale, defaults to 20. */
  pixelsPerSecond?: number
  /**
   * Optional opaque lane identifier. Forwarded to handlers and emitted
   * as `data-lane` so multi-lane parents can tell lanes apart.
   */
  lane?: string
  /** Lane row height in pixels. Defaults to 44. */
  height?: number
  /** Called when a clip is dragged horizontally. */
  onClipMove?: (clipId: string, startTime: number, lane?: string) => void
  /** Called when a clip's right edge handle is dragged. */
  onClipResize?: (clipId: string, duration: number, lane?: string) => void
  /** Called when a clip body is clicked (no drag). */
  onClipClick?: (clipId: string, lane?: string) => void
  /** Currently-selected clip id (renders the selection ring on that clip). */
  selectedClipId?: string
  /** Extra classes merged onto the root element. */
  className?: string
}

Functions

clampClipMove(proposedStartTime)

Clamp the proposed new startTime for a clip move so the clip stays non-negative. (No upper bound — the parent decides whether to clip to a song length.)

function clampClipMove(proposedStartTime: number): number
  • proposedStartTime — The candidate start time in seconds.

Returns: The clamped start time.

clipToPixels(clip, pixelsPerSecond)

Convert a Clip to its on-lane pixel geometry.

function clipToPixels(
  clip: Pick<Clip, 'startTime' | 'duration'>,
  pixelsPerSecond: number,
): { left: number; width: number }
  • clip — The clip to project.
  • pixelsPerSecond — Horizontal scale.

Returns: { left, width } in pixels.

pixelsToTime(pixels, pixelsPerSecond)

Convert a pixel offset back to a time value, clamped to >= 0.

function pixelsToTime(pixels: number, pixelsPerSecond: number): number
  • pixels — Offset in pixels.
  • pixelsPerSecond — Horizontal scale.

Returns: Time in seconds (never negative).

TrackLane(props)

One row of a multi-track timeline — renders draggable + resizable clip blocks on a pixelsPerSecond time axis. Pointer-down on a clip body starts a drag-to-move, pointer-down on the right-edge handle starts a drag-to-resize, and a click without movement fires onClipClick. All styling routes through getClassMap() and all user-visible text routes through t() (via the companion @molecule/app-locales-feature-track-lane locale bond).

function TrackLane(props: TrackLaneProps): JSX.Element
  • props — Component props.

Returns: The track-lane element.

Constants

DRAG_DISTANCE_THRESHOLD_PX

Pointer-distance threshold (px) before a press becomes a drag.

const DRAG_DISTANCE_THRESHOLD_PX: 3

MIN_CLIP_DURATION_SECONDS

Minimum clip duration in seconds — clips can't be resized below this.

const MIN_CLIP_DURATION_SECONDS: 0.05

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-react ^1.0.1
  • @molecule/app-ui ^1.0.1
  • react ^18.0.0 || ^19.0.0

Runtime Dependencies

  • @molecule/app-react
  • @molecule/app-ui
  • react

Translations

Translation strings are provided by @molecule/app-locales-feature-track-lane.