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

@responsivejs/design

v1.0.0-alpha.0

Published

The layout & design oracle of r$ — measure, validate and score responsive design: constraints, aesthetic score, machine-readable reports with fix suggestions.

Readme

@responsivejs/design

The layout & design oracle of r$: measure a page across widths, validate it with constraints, score its aesthetics, and get machine-readable reports with fix suggestions — built for humans and AI agents.

npm install --save-dev @responsivejs/design

@playwright/test is an optional peer dependency: only the sweep driver needs it. The browser core runs anywhere a DOM exists.

Validate with Playwright

import { test, expect } from '@playwright/test';
import { r$ } from '@responsivejs/design';

test('layout is correct at all viewports', async ({ page }) => {
    const r = r$(page);
    await r.sweep({
        url: 'http://localhost:3000',
        widths: [320, 768, 1280, 1920],
        selectors: ['h1', '.btn', '.card'],
    });

    r.assert
        .noOverflow()
        .sameHeight('.btn', '.input')
        .minSize('.btn', { height: 44 })
        .monotonic('h1', 'fontSize', 'up')
        .gapUniform('.card');

    expect(r.report().pass).toBe(true);
});

27 chainable constraints: containment, alignment, monotonicity, continuity, proportions, touch targets, WCAG contrast, typography scales, spacing tokens, z-order, focus visibility, visibility contracts… Violations carry a fix suggestion ({ selector, property, value, reason }).

Zero-driver browser core

import { scoreDOM, collectStore } from '@responsivejs/design/browser';

const { average, suggestions } = scoreDOM(['main', '.card', 'nav a']);

Playwright-free by construction: import it in a browser app or inject it into any page via a driver's eval (CDP, agent-browser, devtools). It exposes the live-DOM collector plus the pure scoring core — 17 aesthetic metrics (Ngo/Teo/Byrne 2003 + Birkhoff 1933).

The unified oracle: analyze()

One call → geometry + responsive constraints + a11y (axe) + aesthetic score, merged in a single machine-readable UnifiedReport { violations, fixes, scores, summary }:

import { analyze, PlaywrightSource } from '@responsivejs/design';

const report = await analyze({
    source: new PlaywrightSource(page),
    url: 'http://localhost:3000',
    selectors: ['h1', '.btn', '.card'],
    widths: [320, 768, 1280],
});
report.pass; // no error-severity violations
report.fixes; // flattened {selector, property, value, reason} — agent-loop native

pass fails only on error severity; clean demands zero violations of any kind. Axe rules are namespaced (axe:aria-required-attr) with impact mapped to severity (critical/serious → error, moderate → warning, minor → info). formatSARIF(report) emits SARIF 2.1.0 for code-scanning CI.

a11y degradationaxe-core is an optional peer, injected through the driver's eval seam (works on every driver, not just Playwright): omitted + installed → runs; omitted + missing → silently skipped (sources.a11y: 'unavailable'); explicitly configured + missing → throws; store-only input or a11y: false → skipped. color-contrast is always delegated to the deterministic contrastRatio constraint (axe false-positives on gradients/translucency).

MeasurementSource: bring your own driver

The oracle is driver-neutral. A source is just:

interface MeasurementSource {
    kind: string;
    open?(url: string): Promise<void>;
    setViewport(width: number, height: number): Promise<void>;
    measure(selectors: string[]): Promise<ViewportSnapshot>;
    evaluate?<T>(expression: string): Promise<T>; // string-only: CDP-compatible
}

Shipped adapters: PlaywrightSource (CI) and CdpSource — the latter takes any structural { send(method, params) } client (chrome-remote-interface, Playwright CDPSession, agent-browser bridges) and injects the browser collector via Runtime.evaluate:

import { CdpSource, analyze } from '@responsivejs/design';
const source = new CdpSource(await context.newCDPSession(page));

The pure half — analyzeStore(store) — is also exported from @responsivejs/design/browser (driver-free) together with collectPage/buildCollectExpression (the injectable collector) and storeToJSON/storeFromJSON (JSON transport of measurements).

Design-system profiles

Ready-made validation profiles ship as JSON assets:

import { applyDesignSystem } from '@responsivejs/design';
import materialDesign from '@responsivejs/design/design-systems/material-design-3.json' with { type: 'json' };

applyDesignSystem(r.assert, materialDesign, { interactive: ['.btn', 'a'] });

Available: apple-hig, fluent-ui-2, material-design-3.

Documentation

Full API reference: docs/api/design.md · guides: CI regression, AI agents

Licensed under MPL-2.0.