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

@designtools/codesurface

v0.1.11

Published

Visual editing CLI — hybrid architecture with selection overlays in the target app and editor UI served separately

Readme

@designtools/codesurface

A CLI-launched visual design layer for React applications. Select elements in your running app and edit styles, tokens, and component variants — changes write back to your source files.

Requirements

  • Node.js >= 18
  • Next.js >= 14 (App Router)
  • React >= 18
  • A supported styling system: Tailwind CSS v3/v4, CSS Custom Properties, Bootstrap, or plain CSS

Installation

npm install -D @designtools/next-plugin

Setup

1. Wrap your Next.js config

// next.config.ts
import { withDesigntools } from "@designtools/next-plugin";

const nextConfig = {
  // your existing config
};

export default withDesigntools(nextConfig);

In development, this:

  • Adds a Babel pass that injects data-source="file:line:col" attributes into every JSX element, mapping each element to its source location. These only exist in the compiled output — your source files are not modified.
  • Auto-mounts the <CodeSurface /> selection overlay component into your root layout (app/layout.tsx or src/app/layout.tsx).

Neither is included in production builds.

2. Add data-slot to your components

For CodeSurface to recognize reusable components (and distinguish them from plain HTML elements), add a data-slot attribute to the root element of each component:

// components/ui/button.tsx
export function Button({ children, className, ...props }) {
  return (
    <button data-slot="button" className={cn("...", className)} {...props}>
      {children}
    </button>
  );
}

The data-slot value should be a kebab-case name matching the component (e.g. card-title for CardTitle). This enables component-level editing — selecting a Button in the editor will let you modify its base styles in the component file, not just the instance.

Components without data-slot can still be selected and edited at the element level.

3. Run it

Start your Next.js dev server, then run CodeSurface from your project root:

# Terminal 1: start your app
npm run dev

# Terminal 2: start the editor
npx codesurface

The CLI auto-detects your dev server on port 3000 (also scanning 3001 and 3002 in case Next.js picked a different port). The editor opens at http://localhost:4400.

Your app loads inside an iframe — no proxy, no middleware.

CLI options

| Flag | Default | Description | |------|---------|-------------| | --port | 3000 | Port your dev server runs on | | --tool-port | 4400 | Port for the editor UI | | --components | auto-detected | Path to your UI components directory | | --css | auto-detected | Path to your CSS tokens file |

Both ports auto-increment if the default is busy. Component and CSS paths are auto-detected but can be overridden when detection fails.

How it works

  1. Click an element in the iframe to select it
  2. The editor panel shows its computed styles, Tailwind classes, and source location
  3. Edit values — changes are written directly to your source files
  4. Your dev server picks up the file change and hot-reloads

For Tailwind projects, changes are written as utility classes (e.g. text-sm, bg-blue-500). When no matching utility exists, arbitrary value syntax is used (e.g. text-[14px]).

What it can edit

  • Element styles — layout, spacing, typography, colors, borders, shadows, opacity
  • Design tokens — CSS custom properties in your stylesheets
  • Component variants — base classes and variant mappings (works with CVA)
  • Shadows — shadow token definitions in CSS or Tailwind @theme blocks
  • Gradients — gradient token definitions
  • Spacing — spacing scale tokens
  • Borders — border radius and border width tokens

Limitations

  • Next.js only — framework detection exists for Remix and Vite but they are untested
  • Tailwind for class writes — CSS variable and plain CSS token editing works, but className writes produce Tailwind utility classes
  • Development only — the plugin and overlays are stripped from production builds
  • App Router only — the auto-mount targets app/layout.tsx (or src/app/layout.tsx). Pages Router is not supported

License

CC-BY-NC-4.0