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

@taqwim/calendar-core

v0.1.0-beta.8

Published

Framework-agnostic Hijri calendar state machine: grid building, selection, keyboard navigation and accessibility props

Readme

@taqwim/calendar-core

Framework-agnostic Hijri calendar state machine. Grid building, selection, paging, roving-focus keyboard navigation and accessibility attributes — with no dependency on any UI framework.

This is the layer every Taqwim adapter (@taqwim/vue, @taqwim/react, @taqwim/svelte, @taqwim/solid, @taqwim/angular) binds to, so calendar behaviour is written once and is identical everywhere.

npm install @taqwim/calendar-core

Usage

import { createCalendar } from '@taqwim/calendar-core'

const calendar = createCalendar({
  locale: 'ar',
  dir: 'rtl',
  weekStartsOn: 6, // Saturday
  fixedWeeks: true,
  onValueChange: value => console.log(value),
})

calendar.subscribe(() => render(calendar.getSnapshot()))

Pass an imported strategy to opt into another calendar. Leaving it out keeps the Umm al-Qura default.

import { createCalendar } from '@taqwim/calendar-core'
import { islamicCivil } from '@taqwim/core/calendars/islamic-civil'

const calendar = createCalendar({ calendarSystem: islamicCivil })

The active strategy is used consistently for grid dates, navigation, validation, formatting and Gregorian equivalents. Changing it with setOptions rebuilds derived state without emitting a selection change.

See the calendar-system guide for the Umm al-Qura, Civil and TBLA comparison and framework examples.

The store exposes a subscribe / getSnapshot pair, so it plugs directly into React's useSyncExternalStore and the equivalent primitive in every other framework. getSnapshot() returns a stable reference until something actually changes.

The state

const { months, weekDays, headingValue, isInvalid } = calendar.getSnapshot()

for (const month of months) {
  for (const week of month.weeks) {
    for (const day of week) {
      // day.date, day.isToday, day.isSelected, day.isDisabled,
      // day.isUnavailable, day.isOutsideMonth, day.isFocused
    }
  }
}

Accessibility

Prop getters return the attributes an adapter should spread onto its elements. Because every adapter uses these, the emitted DOM is identical across frameworks — which is what lets one shared end-to-end suite verify all of them.

calendar.getRootProps() // role="application", aria-label, dir, data-taqwim-calendar
calendar.getGridProps(month) // role="grid", aria-label
calendar.getCellTriggerProps(day) // roving tabindex, aria-*, data-*
calendar.getPrevButtonProps()
calendar.getNextButtonProps()

Keyboard

handleKeydown(event) implements roving focus and returns true when it consumed the event, so the adapter knows whether to call preventDefault().

| Key | Action | | ------------------------------- | ------------------------------------------------ | | ← / → | Previous / next day (mirrored under dir="rtl") | | ↑ / ↓ | Previous / next week | | Home / End | First / last day of the focused week | | PageUp / PageDown | Previous / next month | | Shift + PageUp / PageDown | Previous / next year | | Enter / Space | Select the focused date |

The store owns which date has focus; the adapter owns the DOM. Use the onFocusedDateChange callback to call .focus() on the matching cell.

Controlled and uncontrolled

Pass defaultValue / defaultPlaceholder to let the store own its state, or value / placeholder to own it yourself. In controlled mode the store reports changes through onValueChange / onPlaceholderChange and waits for you to push a new value back via setOptions.

License

MIT