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

@decantr/css

v1.0.0

Published

Framework-agnostic CSS atoms runtime for Decantr projects

Readme

@decantr/css

Framework-agnostic CSS atoms runtime for Decantr projects.

Installation

npm install @decantr/css

Usage

import { css } from '@decantr/css';

// In your components
<div className={css('_flex _col _gap4 _p4')}>
  <h1 className={css('_heading1')}>Title</h1>
  <p className={css('_textsm _fgmuted')}>Description</p>
</div>

How It Works

The css() function:

  1. Parses atom strings (e.g., '_flex _col _gap4')
  2. Resolves each atom to CSS (e.g., _flex -> display:flex)
  3. Injects the CSS into the DOM via <style> tags
  4. Returns the class names for use in your markup

CSS is injected into @layer d.atoms for proper cascade control.

API

css(...classes)

Process atom strings and inject CSS. Returns space-separated class names.

css('_flex _col')  // Returns: '_flex _col', injects CSS
css('_flex', '_col', condition && '_gap4')  // Handles multiple args, falsy values

define(name, declaration)

Register a custom atom.

define('_brand', 'color:var(--brand);font-weight:700');
css('_brand')  // Now works

extractCSS()

Get all injected CSS as a string (for SSR).

const cssString = extractCSS();
// Returns: '@layer d.atoms{._flex{display:flex}...}'

reset()

Clear all injected styles (for testing).

reset();

Atom Reference

Display

_flex, _grid, _block, _inline, _none, _contents

Flexbox

_col, _row, _wrap, _nowrap, _flex1, _grow, _shrink0

Alignment

_aic (align-items:center), _jcc (justify-content:center), _jcsb (space-between)

Spacing

_gap{n}, _p{n}, _m{n}, _pt{n}, _px{n}, _my{n} where n = 0-96

Sizing

_wfull, _hfull, _w{n}, _h{n}, _minw0, _maxwfull

Typography

_textsm, _textlg, _text2xl, _heading1-_heading6, _fontbold

Colors (use CSS variables)

_bgprimary, _bgsurface, _fgmuted, _bcborder

Responsive Prefixes

Mobile-first breakpoints: _sm: (640px), _md: (768px), _lg: (1024px), _xl: (1280px)

<div className={css('_gc1 _sm:gc2 _lg:gc4')}>
  {/* 1 col -> 2 cols at 640px -> 4 cols at 1024px */}
</div>

Pseudo-class Prefixes

_h: (hover), _f: (focus), _fv: (focus-visible), _a: (active)

<button className={css('_bgprimary _h:bgprimary/80')}>
  Hover me
</button>

Opacity Modifiers

_bgprimary/50 -> 50% opacity via color-mix()

Arbitrary Values

_w[512px], _p[clamp(1rem,3vw,2rem)], _bg[#1a1a2e]

Integration with Decantr

When you scaffold a project with @decantr/cli, it generates:

  • src/styles/tokens.css - Theme tokens (colors, spacing, radii)
  • src/styles/decorators.css - Recipe decorator classes

Import these alongside @decantr/css:

import { css } from '@decantr/css';
import './styles/tokens.css';
import './styles/decorators.css';

License

MIT