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

@volt-package/calendar-timeline

v0.1.1

Published

Week/Day timeline view plugin for Volt Calendar - 24-hour timeline with smart overlap algorithm

Readme

@volt-package/calendar-timeline

Week and Day timeline view plugin for Volt Calendar. Provides 24-hour timeline layouts with a sophisticated event overlap algorithm.

📦 Installation

npm install @volt-package/calendar-core @volt-package/calendar-timeline
# or
pnpm add @volt-package/calendar-core @volt-package/calendar-timeline

🚀 Usage

import { VoltCalendar } from '@volt-package/calendar-core';
import { TimelinePlugin } from '@volt-package/calendar-timeline';

const calendar = new VoltCalendar({
  plugins: [TimelinePlugin],
  initialView: 'week', // or 'day'
  events: [
    {
      id: '1',
      title: 'Meeting',
      start: '2025-12-15T10:00:00',
      end: '2025-12-15T11:30:00',
    },
  ],
});

calendar.subscribe((state) => {
  console.log('Timeline state:', state);
  // state.grid: Time slots for each day
  // state.events: Events with calculated positions (top, left, width, height)
});

📊 Features

Week View

  • 7-day Timeline: Full week with 24-hour slots per day
  • Smart Overlap: Google Calendar-style event positioning
  • Column Packing: Automatically arranges overlapping events
  • CSS Coordinates: Returns percentage-based positions

Day View

  • Single Day: 24-hour timeline for focused view
  • Same Algorithm: Uses the same overlap detection
  • High Precision: Minute-level accuracy

🎨 Smart Overlap Algorithm

The Timeline plugin implements a sophisticated algorithm for handling overlapping events:

1. Cluster Detection

Groups events that overlap in time:

Events: [A: 10:00-11:00, B: 10:30-11:30, C: 14:00-15:00]
Clusters: [[A, B], [C]]

2. Column Assignment

Uses Graph Coloring algorithm to assign columns:

Cluster [A, B]:
  - A overlaps with B → different columns
  - Column 0: [A]
  - Column 1: [B]

3. Coordinate Calculation

Returns CSS percentage coordinates:

{
  style: {
    top: "41.67%",    // 10:00 = 41.67% of 24 hours
    height: "6.25%",  // 1.5 hours duration
    left: "0%",       // Column 0
    width: "50%",     // 2 columns total → 50% width
    zIndex: 1
  }
}

📐 Output Data

GridCell

Time slots for each day:

interface GridCell {
  date: Date; // e.g., 2025-12-15 10:00:00
  isToday: boolean;
  isOtherMonth: boolean; // Always false for timeline
  props: {
    'aria-label': string; // "12/15/2025 10:00"
    'data-date': string; // ISO format
  };
}

RenderedEvent

Events with calculated positions:

interface RenderedEvent {
  def: CalendarEventInput;
  style: {
    top: string; // "25.5%" - start time position
    height: string; // "12.5%" - duration
    left: string; // "0%" - column position
    width: string; // "33.33%" - width based on overlaps
    zIndex: number; // Layer order
  };
  isStart: boolean;
  isEnd: boolean;
}

🔧 API

TimelinePlugin

class TimelinePlugin {
  name = 'timeline';

  // Standard calculation
  calculate(store: Store, viewType: 'week' | 'day' = 'week'): ViewState;

  // With recurring event expansion
  calculateWithRecurrence(store: Store, viewType: 'week' | 'day' = 'week'): ViewState;
}

🧮 Overlap Algorithm Functions

Exported helper functions:

// Detect overlapping event clusters
detectClusters(events: CalendarEvent[]): EventCluster[];

// Calculate column width (percentage)
calculateColumnWidth(columnIndex: number, totalColumns: number): string;

// Calculate column position (percentage)
calculateColumnPosition(columnIndex: number, totalColumns: number): string;

// Calculate event height (percentage, 24-hour basis)
calculateEventHeight(start: Date, end: Date): string;

// Calculate event position (percentage, 00:00 basis)
calculateEventPosition(startTime: Date): string;

// Calculate expansion factor
calculateExpansionFactor(columnIndex: number, totalColumns: number): number;

📝 ViewState

{
  viewType: 'week' | 'day',
  currentDate: Date,
  dateRange: {
    start: Date, // Week/day start
    end: Date    // Week/day end
  },
  grid: GridCell[],      // 24-hour slots × days
  events: RenderedEvent[] // Positioned events with overlap handling
}

🎯 Use Cases

  • Weekly/daily schedule views
  • Time-based event management
  • Meeting room scheduling
  • Appointment booking
  • Resource timeline views

🔗 Related Packages

📄 License

MIT

🤝 Contributing

Issues and PRs are welcome at volt-calendar.