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

gradient-lab

v1.0.2

Published

An image-sampled CSS gradient studio. Drop a photo, draw sampling lines across it, refine the color stops, and export Bootstrap-ready CSS gradient classes.

Downloads

347

Readme

Gradient Lab

An image-sampled CSS gradient studio. Drop a photo, draw sampling lines across it, refine the color stops, and export Bootstrap-ready CSS gradient classes.

Running

npm start

The dev server opens the app at http://localhost:48187 (or next available port). Files are served from the project root — no build step required.

File structure

gradient-lab/
├── index.html              # App shell — importmap + component tree
├── app.js                  # Entry point — imports all components
├── app.css                 # Application stylesheet
├── reactive-framework.js   # Generic reactive primitives (no dependencies)
├── utils.js                # Pure utility functions (color math, CSS generation)
├── server.js               # Zero-dependency static file server
└── components/
    ├── gradient-element.js       # GradientElement base class
    ├── gradient-lab-app.js       # Root component — owns all application state
    ├── app-shell.js              # Layout wrapper
    ├── app-hero.js               # Header section
    ├── gradient-workbench.js     # Two-column layout for sampler + editor
    ├── lux-card.js               # Styled card with title/icon/subtitle slots
    ├── sampler-toolbar.js        # File upload, sample count, angle controls
    ├── image-sampling-stage.js   # Canvas + SVG overlay, drag-to-sample
    ├── sampled-gradient-list.js  # List of sampled gradient lines
    ├── gradient-editor.js        # Stop bar, color pickers, CSS preview
    ├── library-controls.js       # Prefix / domain inputs, copy-all button
    ├── gradient-library.js       # Grid of saved gradients
    ├── library-code.js           # Collapsible full CSS output
    └── toast-zone.js             # Fixed toast notifications

Module graph

reactive-framework.js   (no imports)
utils.js                (no imports)
  └── components/gradient-element.js  ← reactive-framework
        └── components/*.js           ← gradient-element + utils
              └── app.js              ← all components

The importmap in index.html resolves bare specifiers:

| Specifier | File | |--------------------|-----------------------------------| | reactive-framework | ./reactive-framework.js | | utils | ./utils.js | | gradient-element | ./components/gradient-element.js|

Reactive framework overview

Scope

Tracks disposables (functions, objects with .dispose(), Symbol.dispose). Disposes them in reverse order on .dispose(). Supports timeout, interval, frame, and child scopes.

Signal<T>

A reactive value cell. Notifies subscribers only when the value changes (Object.is equality by default). Supports .subscribe(fn), .map(fn), .once(fn), .mutate(fn).

Concern extends Scope

Combines a Signal registry with binding helpers. Key methods:

  • signal(name, value?) — get or create a named signal
  • effect(sources, fn) — run fn whenever any source changes
  • computed(name, sources, fn) — derived signal
  • on(target, event, handler) — event listener tracked for disposal
  • bindText / bindHTML / bindValue / bindChecked / bindStyle / bindClass / bindAttribute — one-way or two-way DOM bindings
  • render(source, host, fn) — render signal value into a DOM host

ReactiveHTMLElement extends HTMLElement

Base class for all web components. Mounts once on first connectedCallback, disposes on disconnectedCallback. Exposes signal, subscribe, effect, computed, on, delegate, emit, $, $$, html, appendTemplate.

GradientElement extends ReactiveHTMLElement

Thin base for app-specific components. Adds .app, .state, .commit(mutator), and .watchState(fn).

Application state

All state lives in a single Signal<AppState> on <gradient-lab-app>. Components read it via this.state and write via this.commit(draft => { ... }), which deep-copies lines and library before mutating.

{
  image: HTMLImageElement | null,
  imageName: string,
  sampleCount: number,       // 2–16
  direction: string,         // e.g. "90deg"
  domain: string,            // for permalink generation
  prefix: string,            // CSS class prefix, e.g. "gr-"
  selectedLineId: string | null,
  selectedEndpoint: "start" | "end" | null,
  selectedStopId: string | null,
  lines: GradientLine[],
  library: LibraryItem[],
}

No build step

Everything runs as native ES modules. No bundler, no transpiler, no npm dependencies at runtime. Bootstrap and Bootstrap Icons are loaded from CDN.