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

@pantoken/core

v0.2.4

Published

The pantoken transformer: resolves Instructure design tokens + ui-icons into the canonical @property-aligned token IR.

Readme

@pantoken/core

The pantoken transformer. It performs the first and only source transformation: it reads @instructure/instructure-design-tokens and @instructure/ui-icons, resolves the Tokens Studio graph, and produces the canonical @property-aligned token IR that every other pantoken package consumes.

Install

npm i @pantoken/core

Usage

import { buildTokens, toStyleDictionary } from "@pantoken/core";

const tokens = buildTokens({ theme: "rebrand" });
// → Token[] : { name, syntax, inherits, value, themed?, refersTo?, meta? }

const forSwift = toStyleDictionary(tokens, "light");
// → concrete, single-mode dictionary for the native lineage

Plugins

Every producer accepts { plugins }. A plugin's tokens hook receives the current IR and returns the full replacement list:

import { buildTokens, type PantokenPlugin } from "@pantoken/core";

const focus: PantokenPlugin = {
  name: "focus",
  tokens: ({ tokens, define }) => [
    ...tokens,
    define({ name: "--instui-focus-color", value: "var(--instui-color-border-brand)" }),
  ],
};

buildTokens({ theme: "rebrand", plugins: [focus] });

What it does

  • Resolves {path.to.token} references into var(...) pointers, preserving the token graph.
  • Merges light and dark colours into light-dark() only where they differ.
  • Rolls icons in as <image> tokens with metadata (source, bidirectional, viewBox).
  • Sniffs the CSS @property syntax for every concrete value.
  • Honors Tokens Studio modify extensions (darken, lighten, alpha) on concrete colours, and preserves reference-valued modifiers as metadata for the native lineage.

API

  • buildTokens(options): Token[] — build the IR for a theme, running plugin tokens and icons hooks. Options: theme, plugins, includeIcons, includeInstui, includeLucide.
  • toStyleDictionary(tokens, mode): Record<string, SdLeaf> — shape the resolved IR as a flat Style Dictionary dictionary for the native emitters.
  • resolveReferences(tokens, mode): Map<string, string> — resolve every token to a concrete, single-mode value.
  • defineToken(input): Token — build a full Token from partial input (defaults syntax and inherits). dedupeByName, runTokenPlugins, runIconPlugins — the plugin-stage runners.
  • collectIcons(options): IconLayer — read glyphs from @instructure/ui-icons as <image> tokens plus the icon-colour special values.
  • decodeIconSvg, getIconSvgs, toVectorDrawable, toXcodeImageset, flutterIconManifest — native icon-asset emitters (decode a data-URI SVG, then convert to Android VectorDrawable, an Xcode imageset, or a Flutter manifest).
  • collectLeaves, referenceToVarName, resolveValue, varName — the Tokens Studio graph walker and reference resolver.
  • cssSyntaxForValue, isContextual, toKebab, ICON_COLOR_SPECIAL_VALUES — value-level helpers (@property syntax sniffing, name casing, icon-colour constants).
  • applyModify(value, modify) — apply a Tokens Studio colour modifier to a concrete hex value.
  • Re-exports the IR types from @pantoken/model: Token, TokenInput, TokenMeta, TokenModify, Theme, PantokenPlugin (and the hook-context and CSS-contribution types).

The Token shape

The IR is aligned to the CSS @property schema and extended into a superset:

| Field | Meaning | | ---------- | ---------------------------------------------------------------- | | name | Custom-property name, e.g. --instui-color-background-base. | | syntax | @property syntax (<color>, <length>, <image>, …) or *. | | inherits | @property inherits flag. | | value | Concrete value, var(...) reference, or light-dark(a, b). | | themed | True when light and dark differ. | | refersTo | The referenced token, when value is a single var(...). | | meta | Non-value metadata (icons, colour modifiers). |

Related

  • Types come from @pantoken/model.
  • @pantoken/plugin-kit builds and composes the plugins buildTokens runs.
  • @pantoken/utils provides the reference resolver used by resolveReferences.

License

MIT