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

layout-lint

v1.2.1

Published

A declarative DSL for testing CSS layout constraints in the browser

Downloads

399

Readme

layout-lint

npm

Try it live →

A DSL for testing layout in the browser. Rules read as short sentences about the page, and a floating widget shows pass and fail against the live DOM.

define card-* as ".card";
group chrome as header, nav, footer;

main below header 24px;
card-1 same-width card-2;
@chrome visible;
count visible card-* is >= 3;

Selecting a rule draws its target and source on the page. Interactive demos, a parse-tree explorer, and the grammar reference with a syntax diagram per rule are on the live site, or run them locally with npm run serve.

Install

npm install layout-lint

Or from a CDN without an install step:

<script type="module" src="https://esm.sh/layout-lint/auto"></script>

Static HTML

One script tag. On load, the module reads every <script type="layout-lint"> block, evaluates the spec against the live DOM, and mounts the widget.

<script type="layout-lint">
  header above nav 0px;
  nav above main 24px;
</script>
<script type="module" src="https://esm.sh/layout-lint/auto"></script>

The same is available as a custom element through layout-lint/web-component. The spec goes inside the <layout-lint> element or its spec attribute.

Bundler apps

Import the devtools entry behind a dev-mode check so the widget never ships to production.

if (import.meta.env.DEV) {
  const { createLayoutLintMonitor, createLayoutLintWidget } = await import('layout-lint/devtools');
  const monitor = createLayoutLintMonitor({ specText });
  createLayoutLintWidget(monitor);
}

The widget's spec button opens an inline editor with syntax highlighting and live diagnostics. Apply with Cmd/Ctrl+Enter.

CI and Node

import { createLayoutLint } from 'layout-lint';

const lint = createLayoutLint({ specText });
const { results, diagnostics } = await lint.run();

if (diagnostics.length) console.error(lint.formatDiagnostics(diagnostics));
if (results.some((r) => !r.pass)) process.exit(1);

The grammar and the Tree-sitter runtime are inlined, so no wasmUrl or locateFile is needed. For a synthetic DOM, pass dom: window.document. jsdom runs no layout engine, so spatial rules need a real browser.

External WASM

The inlined WASM adds about 230 KiB to the bundle. To serve it over the network instead:

const lint = createLayoutLint({
  specText,
  wasmUrl: '/assets/layout_lint.wasm',          // grammar
  locateFile: () => '/assets/tree-sitter.wasm', // runtime
});

License

MIT