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

@super-calendar/core

v2.17.0

Published

Render-agnostic core for super-calendar: date math, selection model, event layout, the month-grid builder, headless hooks, and neutral theme tokens. No renderer.

Readme

@super-calendar/core

npm JSR npmx

The render-agnostic core of super-calendar: date math, the selection model, event layout, the month-grid builder, the headless hooks, and the neutral theme tokens.

It imports nothing from React Native, react-dom, Reanimated, Gesture Handler, or Legend List, so it bundles into any renderer. Use it to drive your own UI, or pair it with @super-calendar/dom (react-dom) or @super-calendar/native (React Native).

Install

npm install @super-calendar/core

Also on JSR: deno add jsr:@super-calendar/core.

Peer dependencies: date-fns (>=3) and optional react (>=18). The root entry includes React hooks and requires React at runtime. Use @super-calendar/core/vanilla for pure logic without React:

import { buildMonthGrid, layoutDayEvents, nextDateRange } from "@super-calendar/core/vanilla";

The vanilla entry exports the pure types, date calculations, selection, layout, recurrence, time-zone, iCalendar, presentation, and theme-token utilities. It also exports the framework-independent loadEventSource loader. It excludes React hooks and providers. Existing root imports remain supported. @super-calendar/solid uses this entry for its Solid 2 renderer.

Usage

Build a fully custom month grid from the headless useMonthGrid hook. It returns the weeks, the weekday headers, and per-day state for you to render however you like.

import { useMonthGrid } from "@super-calendar/core";

function MyGrid({ month }: { month: Date }) {
  const { weeks, weekdays } = useMonthGrid(month, { weekStartsOn: 1 });

  return weeks.map((week) =>
    week.days.map((day) => (
      // day carries isToday / isSelected / isInRange / isDisabled / isCurrentMonth
      <DayCell key={day.date.toISOString()} day={day} />
    )),
  );
}

Manage single, multiple, or range selection with useDateRange:

import { useDateRange } from "@super-calendar/core";

const range = useDateRange({ minDate: new Date() });

For a custom time-grid drag, clampMoveStartMinutes keeps the moved event's start inside the visible hour window while allowing its unchanged duration to carry the end past midnight:

import { clampMoveStartMinutes } from "@super-calendar/core";

const startMinutes = clampMoveStartMinutes(rawStartMinutes, minHour, maxHour, snapMinutes);

To position your own marks on a time grid, wallClockHours(date, dayStart, nextDayStart) returns the fractional clock hour, clamped to the day. It matches layoutDayEvents, which places events by clock time so they line up with the hour labels on a daylight saving change day. clockHoursBetween(from, to) returns how many rows a span covers.

Use resolveDraggedBounds to commit a move or resize. Equal start and end deltas move the event while preserving elapsed duration, including across daylight saving changes. For a resize, pass zero for the edge you want to keep fixed.

CalendarEvent<T> includes an optional dragHandleColor: string for the native renderer's time-grid and resource-timeline resize grips. When omitted, those grips use theme.colors.eventText. Core preserves the field without interpreting it.

CalendarLabels supplies shared accessibility and editing text. The optional editEvents and eventActions(title) fields name the web event chooser and its move and resize dialog. eventChangeRejected supplies the web dialog's rejection message (default "This change is not allowed."). resolveCalendarLabels fills omitted labels with English defaults from defaultCalendarLabels.

Multi-week grids

buildMultiWeekGrid is available from both core entries. It builds consecutive full weeks without month padding or hourly slots.

import { buildMultiWeekGrid } from "@super-calendar/core/vanilla";

const grid = buildMultiWeekGrid(new Date(2026, 11, 28), {
  numberOfWeeks: 3,
  weekStartsOn: 1,
  hiddenDays: [0, 6],
});
console.log(grid.weeks, grid.period, grid.visibleRange);

numberOfWeeks defaults to 2 and must be a positive safe integer. Invalid dates, invalid counts, and spans outside JavaScript's date range throw RangeError before allocating rows. The builder materializes O(7 × N) days. period covers full weeks; visibleRange gives the chronological visible endpoints after hidden weekdays. Both use { start, endExclusive }. RTL reverses row display only. MultiWeekGridDay has the month builder's day state without isCurrentMonth; MultiWeekGridWeek.id uses the unfiltered week start. getViewDays and viewDayCount reject multiweek, so use this builder for it.

Recurrence limits

Recurring-event expansion stops at JavaScript's date limits and omits occurrences whose end would overflow.

Event sources

loadEventSource({ source, format?, map?, signal? }) loads one JSON or iCalendar batch without React. Import it from @super-calendar/core/vanilla or the root entry. source accepts a URL or an async function returning events. URL requests accept an AbortSignal. The loader rejects HTTP errors and malformed JSON events; the default mapper revives start, end, and recurrence dates. Custom mappers receive an unknown array and own their validation and date conversion.

The React useEventSource(source, options?) hook adds events, loading, error, and refetch. A failed refresh keeps the last successful batch. refetchIntervalMs enables polling for finite values greater than zero and no larger than 2147483647 ms. Other values disable it. Unmounting aborts pending URL requests, stops polling, and disables retained refetch callbacks. Solid consumers use createEventSource from @super-calendar/solid.

Documentation

See the full documentation and the API reference.

License

MIT