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

@brinda_yawa/easycal

v1.0.17

Published

A lightweight, zero-dependency JavaScript calendar library

Readme

@brinda_yawa/easycal

A lightweight, zero-dependency JavaScript calendar library with:

  • mode: 'standard' for month, week, and day views
  • mode: 'timeline' for resourceTimelineDay, resourceTimelineWeek, and resourceTimelineMonth
  • Built-in event form logic that can now be fully customized

Installation

npm install @brinda_yawa/easycal

Quick start

import EasyCal from '@brinda_yawa/easycal';
import '@brinda_yawa/easycal/style.css';

const cal = new EasyCal('#calendar', {
  mode: 'standard',
  defaultView: 'month',
  events: []
});

Event Form Customization

Use eventFormRenderer to override create/edit form UI while keeping EasyCal's internal create/update/delete logic:

const cal = new EasyCal('#calendar', {
  mode: 'timeline',
  defaultView: 'resourceTimelineWeek',
  eventFormRenderer: (context) => {
    return `
      <form data-ec-form>
        <h3>${context.mode === 'edit' ? 'Edit event' : 'Create event'}</h3>
        <input name="title" value="${context.event?.title || ''}" placeholder="Title" required />
        <input name="start" type="datetime-local" required />
        <input name="end" type="datetime-local" required />
        <select name="resourceId"></select>
        <p class="ec-popup-error" hidden></p>
        <button type="button" data-ec-action="cancel">Cancel</button>
        ${context.mode === 'edit' ? '<button type="button" data-ec-action="delete">Delete</button>' : ''}
        <button type="submit" data-ec-action="${context.mode === 'edit' ? 'update' : 'save'}">
          ${context.mode === 'edit' ? 'Update' : 'Save'}
        </button>
      </form>
    `;
  }
});

Context Object Explained

eventFormRenderer receives:

{
  mode: 'create' | 'edit',
  event?: EventObject,
  date?: Date,
  resourceId?: string,
  save: (data?) => void,
  update: (data?) => void,
  delete: () => void,
  close: () => void,
}

Behavior:

  • dateClick opens create mode with prefilled date and resourceId.
  • eventClick opens edit mode with the selected event.
  • resourceId is normalized and passed in standard/timeline payloads.
  • Internal event lifecycle stays centralized in EasyCal (addEvent, updateEvent, removeEvent).

Event hooks

All hooks are supported and normalized:

  • dateClick(info) (alias: onDateClick)
  • eventClick(info) (alias: onEventClick)
  • eventDrop(info) (alias: eventDrag)
  • onDateChange(info)

Resource Basics

Resources work out of the box with a minimal structure:

const cal = new EasyCal('#calendar', {
  mode: 'timeline',
  defaultView: 'resourceTimelineDay',
  resources: [
    { id: 'room-a', title: 'Room A' },
    { id: 'room-b', title: 'Room B' }
  ]
});

Custom Resource Structure

Resources are fully flexible. You can pass any shape (including nested children) as long as each resource resolves to a stable id.

const resources = [
  { id: 'a', label: 'Room A', icon: '🏢', description: 'Main hall' },
  { id: 'b', name: 'Room B', capacity: 50, type: 'conference' },
  {
    id: 'c',
    name: 'Floor C',
    children: [
      { id: 'c1', name: 'Room C1', capacity: 16 }
    ]
  }
];

resourceRenderer

Use resourceRenderer to fully control each resource row cell:

const cal = new EasyCal('#calendar', {
  mode: 'timeline',
  defaultView: 'resourceTimelineWeek',
  resources,
  resourceRenderer: (resource) => {
    return `
      <div class="my-resource">
        <span>${resource.icon || ''}</span>
        <strong>${resource.label || resource.title || resource.name}</strong>
        <small>${resource.description || ''}</small>
      </div>
    `;
  }
});

resourceRenderer supports returning either:

  • string (HTML string)
  • HTMLElement

Best practices

  • Keep resource ids stable across renders (resourceId matching depends on this).
  • Keep custom renderers lightweight.
  • Use resourceFieldMap for API adaptation.
  • In custom forms, prefer data-ec-form + data-ec-action to reuse built-in validation + persistence.

API

cal.addEvent(event)
cal.removeEvent(id)
cal.updateEvent(id, patch)
cal.getEvents()
cal.changeView(viewName)
cal.next()
cal.prev()
cal.today()
cal.destroy()

License

MIT