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 🙏

© 2025 – Pkg Stats / Ryan Hefner

svelte5-heatmap

v0.0.4

Published

A Svelte 5 heatmap component inspired by GitHub’s contribution graph

Downloads

688

Readme

🔥 svelte5-heatmap

image

A Svelte 5 heatmap component inspired by GitHub’s contribution graph

🚀 Getting Started

npm install svelte5-heatmap
<script>
  import Heatmap from "svelte5-heatmap";

  let data = $state<{ [key: string]: number }>({});
  let year = 2025;
  function fillMap() {
    let map: { [key: string]: number } = {};
    let max = Math.round(Math.random() * 24) + 8;
    for (let m = 0; m <= 12; m++) {
      for (let d = 0; d <= 31; d++) {
        let key = `${year}-${("0" + m).slice(-2)}-${("0" + d).slice(-2)}`;
        map[key] = Math.round(Math.random() * max);
      }
    }
    data = map;
  }
  fillMap();
</script>

<div style="font-size:12px">
  <Heatmap
    {data}
    {year}
    onclick={(e) => alert(`${e.target.dataset.date} | ${e.target.dataset.value}`)}
  />
</div>

⚙️ Props

  • data (object, required)
    An object containing chart data where each key is a date in ISO format (YYYY-MM-DD) and the value is a number.
    Example: { '2025-01-02': 5 }

  • colors (array, optional)
    An array of color values used for the heatmap cells, ordered from the lowest to highest value.
    Default: GitHub's contribution graph colors.

  • className (string, optional)
    Custom CSS class name applied to the heatmap. Default: "Heatmap"

  • year (number, optional)
    The year to display in the heatmap.
    Default: Current year.

  • lday (boolean, optional)
    Whether to display day-of-week labels on the left side.
    Default: true

  • lmonth (boolean, optional)
    Whether to display month labels above the calendar.
    Default: true

  • onclick (function, optional)
    Function to be called when a heatmap cell is clicked.

  • onmouseover (function, optional)
    Function to be called when the mouse hovers over a cell.

  • onmouseout (function, optional)
    Function to be called when the mouse leaves a cell.

[!NOTE] The heatmap size is determined by the parent element's font size, as it uses em units.

📜 License