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

@ggsvelte/spec

v0.20.0

Published

ggsvelte plot spec: TypeBox schemas, PortableSpec types, normalize(), validate() with agent errors, fluent builder, JSON Schema artifact.

Downloads

4,101

Readme

@ggsvelte/spec

codecov

PortableSpec types, published JSON Schema (schema/v0.json), normalize(), two-tier validate() with the agent error contract ({ code, path, message, allowed?, fix } — every fix carries a machine-applicable example), lintSpec(), and the fluent gg()/aes() builder. No DOM, no d3. Pre-1.0.

bun add @ggsvelte/spec     # or: npm install @ggsvelte/spec

Install alone for validation and authoring without a renderer. @ggsvelte/svelte re-exports this package.

Quick example

import { gg, aes, validate } from "@ggsvelte/spec";
// constrained decoding / tool schemas
import schema from "@ggsvelte/spec/schema/v0.json";

const spec = gg(
  [
    { year: "1835", value: 12 },
    { year: "2026", value: 31 },
  ],
  aes({ x: "year", y: "value" }),
)
  .geomLine()
  .spec();

const result = validate(spec, {
  profile: {
    fields: [
      { name: "year", type: "temporal" },
      { name: "value", type: "quantitative" },
    ],
  },
  lint: true,
});
if (!result.ok) {
  // { code, path, message, allowed?, fix: { description, example } }
}

Contract

  • Emit, validate, fix. validate(spec) is shape; validate(spec, { profile }) is data-aware without shipping rows; { lint: true } adds advisories. Apply fix.example at path and re-validate.
  • Temporal. Automatic inference covers ISO, YYYY, year-month, month-year, and year-quarter after whole-column validation. Ambiguous ordered dates need an explicit parser (parse: "dmy", etc.).
  • Numeric transforms. Closed names (identity | log10 | sqrt) run before statistics. Domains/limits are semantic; OOB censor/squish runs before the transform. Authored type: "log" normalizes to linear + log10.
  • Color/fill. ordinal, sequential, binned, manual, identity. Binned color caps at 64 intervals; manual needs one range color per domain value.
  • Style channels. size / linewidth / alpha share sequential–identity families. shape and linetype use finite named sets — quantitative mappings require explicit binning.
  • Guides. Separate from scale math. Top-level guides wins over scale-local guide. Invalid aesthetic/variant pairs fail validation.
  • Coords. coordTransform is post-stat projection. coordFixed({ ratio }) is physical y-unit/x-unit length; free positional facet scales are rejected.
  • PortableSpec. No Date, callbacks, or regular expressions. Builder Date values canonicalize to ISO strings.

Render with @ggsvelte/core (headless SVG) or @ggsvelte/svelte (Svelte 5).

Repo + docs: https://github.com/ljodea/ggsvelte · MIT © Liam O'Dea