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

jstyle

v0.4.0

Published

Programmatic CSS builder

Readme

jstyle

TypeScript-first CSS builder.

Features

  • Scoped Identifiers — Class names, CSS vars and animation names are isolated
  • Type-Safe Properties — All CSS properties are typed
  • Minified Identifiers — Generates short, unique identifiers (class names, vars, …)
  • Deterministic Builds — Minified identifiers are stored in a map file
  • Multi-Language Support — Outputs modules with constant identifiers for TypeScript and Rust
  • Class Maps — Efficient (interned strings) runtime state to class name mapping for conditional styles
  • CSS Minification — Built-in minification via Lightning CSS
  • Manifest File — Supports assetcraft manifest files (resolve urls and emit)

Installation

npm install jstyle
# or
bun add jstyle

Quick Start

import { ns, style, emit } from 'jstyle';
import * as p from 'jstyle/props';

const APP = ns('app');

const BUTTON = APP.class('button');

const rules = [
  style(BUTTON, [p.display('inline-flex'), p.padding('8px 16px'), p.backgroundColor('blue')]),
  style(BUTTON.hover, [p.backgroundColor('darkblue')]),
];

await emit({
  input: [{ name: 'app', build: async () => ({ css: rules }) }],
  outDir: './dist',
  renderURL: (name, hash) => `/assets/${name}.${hash}.css`,
});

Imports

import { ns, style, media, $, env, important } from 'jstyle'; // Core types and factories
import * as p from 'jstyle/props'; // CSS property constructors
import { emit } from 'jstyle/emit'; // Emit orchestrator
import { JSEmitter } from 'jstyle/emit/js'; // JS emitter
import { RustEmitter } from 'jstyle/emit/rust'; // Rust emitter

Core Concepts

Namespaces

Each module gets its own namespace to avoid identifier collisions:

import { ns } from 'jstyle';

const SCAFFOLD = ns('app.scaffold');
const CONTAINER = SCAFFOLD.class('container');

Properties

Typed constructors from jstyle/props:

import * as p from 'jstyle/props';

p.display('grid');
p.margin('0 auto');
p.color('#333');

// Predefined constants
p.FLEX; // display: flex
p.BORDER_BOX; // box-sizing: border-box

Value Helpers

// CSS variables
const SPACING = NS.dashedIdent('spacing');
style('section', [p.padding($(SPACING))]); // padding: var(--spacing);

// Environment variables
style('input', [p.padding(env('safe-area-inset-top'))]);

// !important
style('modal', [important(p.zIndex('9999'))]); // z-index: 9999 !important;

Selectors

Pseudo-classes and pseudo-elements via getter properties:

const btn = NS.class('button');
btn.hover; // :hover
btn.before; // ::before
btn.nthChild('2n+1'); // :nth-child(2n+1)
btn.has(p.color('red')); // :has(.red)

Combinators for complex selectors:

const CARD = NS.class('card');
const CARD_TITLE = CARD.join('title');

CARD.descendant(CARD_TITLE); // .card .card_title
CARD.child(CARD_TITLE); // .card > .card_title

At-Rules

Factory functions for all CSS at-rules:

import { media, container, keyframes, layer, supports, fontFace } from 'jstyle';

media('(min-width: 768px)', [style(container, [p.margin('0')])]);
keyframes('fade', [pct(0, [p.opacity('0')]), pct(100, [p.opacity('1')])]);
layer('utilities', [style(highlight, [p.backgroundColor('yellow')])]);
fontFace([p.fontFamily('MyFont'), p.src('url(font.woff2)')]);

Size and Color Utilities

import { Size, rgba } from 'jstyle';

Size.px(16); // 16px
Size.rem(2); // 2rem

rgba(255, 0, 0, 1); // rgba(255, 0, 0, 1)

Class Maps

Efficient runtime state to class name mapping:

const buttonMap = NS.classMap({
  base: BUTTON,
  states: {
    hovered: BUTTON_HOVER,
    active: BUTTON_ACTIVE,
    size: [null, BUTTON_SM, BUTTON_MD, BUTTON_LG],
  },
  exclude: (state) => state.get('hovered') === true && state.get('active') === true,
});

Emitting

import { emit } from 'jstyle/emit';
import { JSEmitter } from 'jstyle/emit/js';
import { RustEmitter } from 'jstyle/emit/rust';

await emit({
  input: [
    {
      name: 'app',
      build: async (ctx) => ({
        css: [
          /* your rules */
        ],
      }),
    },
  ],
  outDir: './dist',
  renderURL: (name, sha) => `/assets/${name}.${sha}.css`,
  emit: [
    new JSEmitter({ outDir: './packages/css/src', clean: true }), // optional: emit JS modules
    new RustEmitter({ outDir: './crates/css', clean: true }), // optional: emit Rust module
  ],
  minify: true, // optional: minify CSS
  map: './dist/.cssmap.json', // optional: persist ID mappings
});

Output Formats

  • CSS — Always emitted
  • JS — Via JSEmitter from jstyle/emit/js: identifier bindings + TypeScript declarations
  • Rust — Via RustEmitter from jstyle/emit/rust: identifier bindings
  • Custom — Implement the Emitter interface from jstyle/emit/emitter for custom output formats

License

MIT OR Apache-2.0