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

sc-green-score

v0.1.1

Published

Cross-framework green score tooltip library for React and Angular.

Readme

sc-green-score

Calm, responsive green score tooltip component for React and Angular applications.

sc-green-score ships in two forms:

  • React wrapper: sc-green-score/react
  • Custom element for Angular or plain HTML: sc-green-score/element

Install

npm install sc-green-score

For React projects, make sure react and react-dom are already installed.

React

import { GreenScoreTooltip } from "sc-green-score/react";

export function ProductCard() {
  return (
    <GreenScoreTooltip
      apiBaseUrl="https://api.example.com"
      unitId="ECU-1001"
      productName="Inverter Controller"
      regionCode="IN-MH"
      quantity={1}
      quantityUnit="piece"
    />
  );
}

Angular

Register the web component once, for example in main.ts:

import "sc-green-score/element";

Then use it in a template:

<sc-green-score-tooltip
  api-base-url="https://api.example.com"
  unit-id="ECU-1001"
  product-name="Inverter Controller"
  region-code="IN-MH"
  quantity="1"
  quantity-unit="piece"
></sc-green-score-tooltip>

Behavior

  • Popups are closed by default.
  • The tooltip opens on click.
  • The panel automatically flips to the side with more available space.
  • The popup styling adjusts softly based on the returned score band.

API Contract

This package assumes an API endpoint like:

GET /api/green-score?unitId=...

Expected response:

{
  "data": {
    "unitId": "ECU-1001",
    "productName": "Inverter Controller",
    "greenScore": 82,
    "band": "good",
    "carbonEmission": 12.4,
    "carbonEmissionUnit": "kg-co2e",
    "totalEmission": 15.8,
    "totalEmissionUnit": "kg-co2e",
    "breakdown": [
      { "key": "transport", "label": "Transport", "value": 2.1, "unit": "kg-co2e" },
      { "key": "material", "label": "Material", "value": 8.4, "unit": "kg-co2e" }
    ],
    "methodology": "ISO-14067 estimated footprint model",
    "updatedAt": "2026-04-09T10:00:00.000Z"
  },
  "meta": {
    "requestId": "req_123",
    "source": "sc-green-score"
  }
}

Props

Supported component props and attributes:

  • apiBaseUrl
  • unitId
  • productName
  • regionCode
  • quantity
  • quantityUnit
  • apiKey
  • autoOpen

Local Development

npm install
npm run check
npm run build
npm run demo

Local demo URLs:

  • http://localhost:4173/react
  • http://localhost:4173/angular