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

rsx-z

v1.0.0

Published

Minimal atomic CSS-in-JS engine. Deterministic hashing, runtime style execution, and SSR-ready injection.

Readme

🧱 rsx-z

NPM Downloads

LIVE EXAMPLE

rsx-z is a minimal atomic CSS-in-JS engine.
It converts style objects into deterministic atomic class names at runtime.
Framework-agnostic, SSR-ready, and tiny by design.

Typed. Atomic. Deterministic CSS runtime.


Why rsx-z?

Modern CSS-in-JS libraries are often:

  • Heavy
  • Framework-coupled
  • Runtime-expensive
  • Over-abstracted

rsx-z focuses strictly on:

  • Style execution
  • Atomic rule generation
  • Deterministic hashing
  • Predictable injection

No virtual DOM.
No template DSL.
No compile step.
Nothing more.


Mental Model

style(object)
   ↓
normalize + sort keys
   ↓
atomic(prop, value)
   ↓
hash
   ↓
sheet.insert(rule)

Deterministic.
Cached.
Idempotent.


Installation

npm install rsx-z

Basic Usage (Vanilla)

import { createStyleEngine, createDOMSheet } from "rsx-z"

const engine = createStyleEngine(createDOMSheet())

const className = engine.style({
  backgroundColor: "black",
  color: "white",
  padding: 12,
  borderRadius: 8,
})

document.body.className = className

Generated CSS (atomic)

.a1b2c3{background-color:black;}
.d4e5f6{color:white;}
.g7h8i9{padding:12px;}
.j1k2l3{border-radius:8px;}

Features

✅ Atomic rule generation

Each declaration becomes its own class.

Benefits

  • Maximum deduplication
  • Minimal CSS output
  • Efficient caching

✅ Typed CSS (via csstype)

Full IntelliSense support:

engine.style({
  backgroundColor: "red",
  display: "flex",
})

✅ Auto camelCase → kebab-case

borderRadius → border-radius

✅ Auto unit append (px)

padding: 12

Becomes:

padding:12px;

Unitless properties are respected:

  • lineHeight
  • opacity
  • zIndex
  • etc.

✅ Nested selectors

engine.style({
  color: "black",
  ":hover": { color: "red" },
  "& > span": { color: "blue" }
})

✅ Media queries

engine.style({
  color: "black",
  "@media (max-width: 600px)": {
    color: "red"
  }
})

✅ Keyframes

engine.style({
  "@keyframes": {
    fadeIn: {
      from: { opacity: 0 },
      to: { opacity: 1 }
    }
  },
  animation: "fadeIn 0.3s ease"
})

Keyframes are hashed and injected once.


✅ Vendor prefix support

Required prefixes are automatically added where necessary.


✅ SSR Support

Extract critical CSS:

const css = engine.extractCritical()

Hydrate on the client:

engine.hydrate(existingCSS)

Framework Examples

React

import { useMemo } from "react"
import { createStyleEngine, createDOMSheet } from "rsx-z"

const engine = createStyleEngine(createDOMSheet())

export function useStyle(style) {
  return useMemo(() => engine.style(style), [style])
}
const className = useStyle({
  backgroundColor: "black",
  color: "white"
})

return <div className={className} />

Vue

import { computed } from "vue"
import { createStyleEngine, createDOMSheet } from "rsx-z"

const engine = createStyleEngine(createDOMSheet())

export function useStyle(styleRef) {
  return computed(() => engine.style(styleRef.value))
}

Comparison

| Feature | rsx-z | Emotion | styled-components | StyleX | Vanilla Extract | |---------------------------------|--------|----------|------------------|--------|-----------------| | Atomic CSS | ✅ | ❌ | ❌ | ✅ | ❌ | | Runtime styling | ✅ | ✅ | ✅ | ⚠️ Partial | ❌ (build-time) | | Zero config | ✅ | ✅ | ✅ | ❌ (Babel) | ❌ (build step) | | Framework agnostic | ✅ | ⚠️ React-focused | ❌ React only | ⚠️ React-focused | ✅ | | Deterministic hashing | ✅ | ⚠️ | ⚠️ | ✅ | ✅ | | SSR support | ✅ | ✅ | ✅ | ✅ | ✅ | | Type-safe via csstype | ✅ | ⚠️ | ⚠️ | ✅ | ✅ | | No compile step required | ✅ | ✅ | ✅ | ❌ | ❌ | | Minimal bundle size | ✅ | ❌ | ❌ | ✅ | ✅ |


Key Differences

rsx-z vs Emotion / styled-components

  • Atomic output → smaller CSS
  • No component abstraction layer
  • Framework-agnostic core
  • Avoids repeated runtime style parsing

rsx-z vs StyleX

  • No Babel plugin required
  • Pure runtime engine
  • No compile-time dependency
  • Simpler integration surface

rsx-z vs Vanilla Extract

  • Fully runtime-based
  • No build-time extraction
  • Better suited for dynamic styles

When to use rsx-z

Use rsx-z if you need:

  • Atomic runtime CSS
  • Framework independence
  • Deterministic output
  • Dynamic style generation
  • Minimal abstraction surface

Avoid rsx-z if you require:

  • Compile-time CSS extraction only
  • Component-based styling DSL
  • Strict design-token pipelines

Design Principles

  • Deterministic hashing
  • Stable output ordering
  • Minimal runtime overhead
  • No framework coupling
  • Predictable injection
  • Small surface area

License

MIT