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

@git-stats-components/svelte

v1.0.7

Published

Beautiful GitHub/GitLab/Bitbucket contribution graphs for Svelte

Readme

@git-stats-components/svelte

Beautiful contribution graphs for Svelte

npm version License: MIT

Demo

View Live Demo

Git Stats Components Git Stats Components

Installation

npm install @git-stats-components/svelte

Quick Start

<script>
  import { ContributionGraph, StatsBreakdown } from '@git-stats-components/svelte'
</script>

<ContributionGraph dataUrl="/data/git-stats.json" colorScheme="green" />
<StatsBreakdown dataUrl="/data/git-stats.json" />

Components

ContributionGraph

GitHub-style contribution heatmap.

Props:

  • dataUrl (string) - Path to stats JSON file (default: /data/git-stats.json)
  • profileIndex (number) - Which profile to display (default: 0)
  • colorScheme ('green' | 'blue' | 'purple' | 'orange') - Color theme (default: 'green')
  • showSettings (boolean) - Show color scheme dropdown (default: true)
  • cacheTTL (number) - Cache duration in milliseconds

Events:

  • dayClick - Dispatched when a day is clicked (detail: { date, count })
  • colorSchemeChange - Dispatched when color scheme changes (detail: scheme)

Example:

<script>
  import { ContributionGraph } from '@git-stats-components/svelte'

  function handleDayClick(event) {
    console.log('Clicked:', event.detail)
  }

  function handleColorChange(event) {
    console.log('Color:', event.detail)
  }
</script>

<svelte:window
  on:dayClick={handleDayClick}
  on:colorSchemeChange={handleColorChange}
/>

<ContributionGraph
  dataUrl="/data/git-stats.json"
  profileIndex={0}
  colorScheme="blue"
  showSettings={true}
/>

StatsBreakdown

Project and commit count statistics.

Props:

  • dataUrl (string) - Path to stats JSON file
  • profileIndexes (number[]) - Which profiles to aggregate (default: [])
  • experienceData (ExperienceEntry[]) - Work experience for years calculation (default: [])
  • showCustomStat (boolean) - Show custom stat (default: true)
  • customStatCalculator (function) - Custom stat calculation function

Slots:

  • icon-experience - Custom icon for experience stat
  • icon-projects - Custom icon for projects stat
  • icon-commits - Custom icon for commits stat
  • icon-custom - Custom icon for custom stat
  • custom-stat-label - Custom label for custom stat
  • Default slot for additional content

Example:

<script>
  import { StatsBreakdown } from '@git-stats-components/svelte'

  const experienceData = [
    {
      startDate: '2020-01-01',
      endDate: null, // current
      skills: ['JavaScript', 'Svelte', 'Node.js']
    }
  ]

  function calculatePizzas({ projects, commits, years }) {
    return (projects * 2 + commits * 0.5 + years * 100).toFixed(0)
  }
</script>

<StatsBreakdown
  dataUrl="/data/git-stats.json"
  {experienceData}
  showCustomStat={true}
  customStatCalculator={calculatePizzas}
>
  <div slot="icon-custom">🍕</div>
  <div slot="custom-stat-label">Pizzas Ordered</div>

  <!-- Additional content goes here -->
  <p>Custom footer content</p>
</StatsBreakdown>

TypeScript Support

Full TypeScript support with exported types:

import type {
  GitStatsData,
  ColorScheme,
  Platform,
  ExperienceEntry,
  CustomStatCalculator,
} from '@git-stats-components/svelte'

let colorScheme: ColorScheme = 'green'

const experienceData: ExperienceEntry[] = [
  {
    startDate: '2020-01-01',
    endDate: null,
    skills: ['JavaScript', 'Svelte'],
  },
]

SvelteKit

<!-- +page.svelte -->
<script lang="ts">
  import { ContributionGraph, StatsBreakdown } from '@git-stats-components/svelte'
  import type { PageData } from './$types'

  export let data: PageData
</script>

<ContributionGraph dataUrl={data.statsUrl} />
<StatsBreakdown dataUrl={data.statsUrl} />

Reactive Props

All props are reactive-update them and the component updates:

<script>
  import { ContributionGraph } from '@git-stats-components/svelte'

  let colorScheme = 'green'

  function changeColor() {
    colorScheme = 'blue'
  }
</script>

<button on:click={changeColor}>Change Color</button>
<ContributionGraph {colorScheme} />

Styling

Components use scoped styles but you can override using global styles:

/* In your global CSS */
:global(.git-contribution-graph) {
  /* Custom styles */
}

:global(.contribution-day.level-4.green) {
  background-color: #00ff00 !important;
}

Setup

Quick Setup

Initialize in your project:

npx @git-stats-components/svelte init

This creates:

  • git-stats.config.js - Configuration file
  • .github/workflows/update-git-stats.yml - GitHub Action workflow
  • public/data/ - Directory for stats data

Configuration

Edit git-stats.config.js:

export default {
  profiles: [
    {
      username: 'your-github-username',
      platform: 'github',
      tokenSecret: 'GITHUB_TOKEN'
    }
  ],
  dataPath: 'public/data/git-stats.json',
  schedule: '0 2 * * *' // Daily at 2 AM UTC
}

Add Secrets

Go to Settings → Secrets and variables → Actions and add your tokens.

That's it! The GitHub Action will fetch your stats daily.

For more details, see the main git-stats-components repository.

License

MIT © Derek Johnston