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

@defisaver/ui

v0.0.2

Published

DeFi Saver design system — React components styled with StyleX, pre-compiled so consumers need no StyleX tooling.

Readme

@defisaver/ui

DeFi Saver design system — React components written in TypeScript and styled with StyleX, pre-compiled so consumer apps need no StyleX tooling at all.

Installation

npm i @defisaver/ui

Requires React 18+ as a peer dependency.

Usage

import { Panel, PanelHeader, PanelTitle, PanelFooter } from '@defisaver/ui';
import '@defisaver/ui/styles.css'; // once, at the app entry

How it works

StyleX needs a compiler, and defisaver-app's esbuild pipeline doesn't have one. So this repo compiles StyleX at library build time (@stylexjs/rollup-plugin): dist/ contains plain ESM JavaScript with the atomic class names already inlined, plus a single static dist/styles.css. Consumers import the package and the stylesheet — that works identically under esbuild, Vite, and Next.js. No Babel, no plugins.

Customizing components from the app

Library styles are emitted inside @layer, and unlayered CSS beats layered CSS regardless of specificity. So the escape hatch is the one the app already knows: pass a className and write plain (S)CSS — a single class selector is enough, and media queries work like anywhere else:

// ChartPanel.module.scss — wins over the library defaults, no !important
.chartHeader {
  min-height: 44px;
  justify-content: flex-start;

  @media (max-width: 750px) {
    flex-direction: column;
    align-items: flex-start;
  }
}
<PanelHeader className={styles.chartHeader}>…</PanelHeader>

Only the properties you declare are overridden; everything else keeps the library value. The flip side: the library also yields to careless broad selectors (.someParent span { … }), same as any app-local component — keep overrides scoped to a class on the component itself.

A repeated override is a bug report against the design system. If several call sites override the same property (say, three headers all forcing min-height: 44px), that's not customization — it's a missing variant or token. Request it here instead of copying the override.

Design tokens

Tokens live in src/tokens/*.stylex.ts (colors, space, radius, text). The spacing and radius scales are fully defined — they're stable primitives, and as defineConsts they're inlined at compile time (zero CSS cost when unused). Colors and typography are deliberately minimal: a token is added the moment a component being ported needs it, never speculatively. The old app's full token inventory was audited but not imported wholesale — most of it is legacy design debt, and every unused defineVars entry would ship as dead CSS to consumers. Figma is the intended long-term source of truth for the token set (sync pipeline TBD).

Each value defers to defisaver-app's custom property with a standalone fallback, e.g. var(--surface, #1F272E) — inside the app, components follow theme.scss including [data-theme] switching with zero migration; standalone, the app's dark-theme fallbacks apply. Names mirror the app's (--text-color-secondarycolors.textSecondary) so porting stays mechanical.

src/tokens/tokens.test.ts compiles every token file through a real stylex.create() as a regression guard.

StyleX constraint: defineVars/defineConsts must live in *.stylex.ts files containing nothing else, named exports only.

Commands

npm run dev              # Storybook on :6006 (dev playground + docs)
npm run test             # Vitest + React Testing Library
npm run lint             # ESLint (org config + @stylexjs plugin), autofixes
npm run typecheck        # tsc --noEmit
npm run build            # Rollup (pre-compile StyleX, emit styles.css) + d.ts
npm run pack:local       # build + npm pack → defisaver-ui-x.y.z.tgz

Local development against a consumer app

To test unpublished changes in a consumer (e.g. defisaver-app) before releasing:

# here
npm run pack:local

# in defisaver-app/client
npm i ../../defisaver-ui/defisaver-ui-0.0.1.tgz

A tarball install behaves identically to a registry install, so swapping back to the published version is just a version number change.

Adding a component

  1. Create src/components/<Name>/ with <Name>.tsx, <Name>.stories.tsx, <Name>.test.tsx, index.ts (stories/tests are excluded from the build).
  2. Style with stylex.create(), using tokens from src/tokens/ — add missing tokens there with var(--app-var, fallback) values, mirroring defisaver-app/client/src/common/theme.scss. Raw color literals in component styles fail lint (propLimits on @stylexjs/valid-styles) — a missing color means "add a token", never "inline a hex".
  3. Export it from src/index.ts.
  4. Verify: npm run lint && npm run typecheck && npm test && npm run build.

When porting from defisaver-app/client/src/elements/, keep the public prop API identical so migration is a drop-in import swap.

Repo layout

src/
├── tokens/            # *.stylex.ts — defineConsts/defineVars design tokens
├── components/
│   └── Panel/         # component + stories + tests, co-located
└── index.ts           # public barrel export
.storybook/            # Storybook 10, react-vite, uses vite.config.ts
rollup.config.mjs      # publish build (pre-compiled JS + styles.css)
vite.config.ts         # internal toolchain: Storybook + Vitest (StyleX unplugin)

Roadmap (deferred, in rough order)

  • Migrate components from defisaver-app/client/src/elements/ in dependency order (Icon → primitives → composites)
  • GitHub Actions CI (lint / typecheck / test / build / build-storybook)
  • Changesets versioning + release automation
  • ./tokens.stylex source subpath export for StyleX-enabled consumers (future Next.js site)
  • createTheme-based ThemeProvider so themes work without the app's theme.scss

License

ISC