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

@csszyx/dynamic

v0.11.7

Published

Runtime CSS injection engine for @csszyx — injects only CSS not already in the pre-built stylesheet

Readme

@csszyx/dynamic

Runtime CSS injection for CSSzyx — turn sz objects into class strings at runtime, injecting CSS only for classes not already in your pre-built stylesheet.

Static styles belong in the build (sz prop / szv — zero runtime cost). dynamic() is the escape hatch for values that genuinely cannot be known at build time: styling driven by a CMS, an API response, or user configuration.

import { dynamic } from "@csszyx/dynamic";

const cls = dynamic(apiResponse.field.style); // e.g. { p: 4, bg: 'blue-500' }
<div className={cls} />;

How it works

  1. Manifest delta check — a build-generated manifest lists every class in the built CSS. Classes already covered are returned as-is (mangled in production), with no injection.
  2. CSS generation — classes NOT in the manifest get a CSS rule generated in the browser using Tailwind v4 variable patterns.
  3. 21-tier injection — rules insert into per-breakpoint CSSStyleSheets whose order matches the Tailwind cascade, so sm:/md:/max-*/container-query variants win in the right order regardless of injection timing.

SSR-safe: on the server, dynamic() returns class names without touching the CSSOM (and applies the build's mangle map during SSG so classes match the mangled CSS).

Installation

pnpm add @csszyx/dynamic

API

import { dynamic, preloadManifest, cleanup, purifySz } from "@csszyx/dynamic";

// Optional: eagerly fetch the manifest at startup for zero-latency first inject
await preloadManifest("/csszyx-manifest.json");

// Untrusted input (JSON from a CMS)? Sanitize before injecting:
const cls = dynamic(purifySz(untrustedSzObject));

// Release injected sheets + manifest cache (e.g. on route teardown)
cleanup();

React

import { useSz, CsszyxProvider } from "@csszyx/dynamic/react";

function FormField({ schema }) {
  const { sz } = useSz(); // stable reference; manages manifest + cleanup
  return <div className={sz(schema.style)}>{schema.label}</div>;
}

// Custom manifest URL (non-root deployments):
<CsszyxProvider manifest="/assets/csszyx-manifest.json">
  <App />
</CsszyxProvider>;

useSz handles manifest preloading on mount and releases the shared stylesheets when the last consumer unmounts (StrictMode-safe).

When NOT to use this

  • A finite set of styles selected by a prop → use szv (build-time, typed).
  • Literal styles → use the sz prop.
  • A runtime value inside an otherwise static rule (bg-(--user-color)) → consider @csszyx/vars + a CSS variable instead of generating rules per value.

Injected rules live for the session and are not individually removed — apps that feed continuously varying values (a new arbitrary width per animation frame) will grow the CSSOM. In development, a one-time warning fires if a session crosses a large number of unique injected classes.

Documentation

https://csszyx.com/docs/dynamic/

License

MIT