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

regular-layout

v0.4.0

Published

A regular CSS `grid` container

Readme

A library for resizable & repositionable panel layouts.

  • Zero depedencies, pure TypeScript, tiny.
  • Implemented as a Web Component, interoperable with any framework.
  • Zero DOM mutation at runtime, implemented entirely by generating using CSS grid rules.
  • Supports arbitrary theming via CSS variables and ::part.
  • Supports async-aware container rendering for smooth animations even when rendering ovvurs over an event loop boundary.
  • Covered in bees.

Demo

Installation

npm install regular-layout

Quick Start

Import the library and add <regular-layout> to your HTML. Children are matched to layout slots by their name attribute.

<script type="module" src="regular-layout/dist/index.js"></script>

<regular-layout>
    <div name="main">Main content</div>
    <div name="sidebar">Sidebar content</div>
</regular-layout>

For draggable, tabbed panels, use <regular-layout-frame>:

<regular-layout>
    <regular-layout-frame name="main">
        Main content
    </regular-layout-frame>
    <regular-layout-frame name="sidebar">
        Sidebar content
    </regular-layout-frame>
</regular-layout>

Panels must be added and remove programmatically (e.g they are not auto-registered):

const layout = document.querySelector("regular-layout");

// This adds the panel definition to the layout (and makes it visible via CSS),
// but does not mutat the DOM.
layout.insertPanel("main");
layout.insertPanel("sidebar");

// This removes the panel from the layout (and hides it via CSS) but does not
// mutate the DOM.
layout.removePanel("sidebar");

Save/Restore

Layout state serializes to a JSON tree of splits and tabs, which can be persisted and restored:

const state = layout.save();
localStorage.setItem("layout", JSON.stringify(state));

// Later...
layout.restore(JSON.parse(localStorage.getItem("layout")));

restore() dispatches a cancelable regular-layout-before-resize event before applying the new state. Call preventDefault() to suspend the update, then layout.resumeResize() when ready:

layout.addEventListener("regular-layout-before-resize", (event) => {
    event.preventDefault();
    // ... prepare for resize ...
    layout.resumeResize();
});

The restore() API can also be used as an alternative to insertPanel/removePanel for initializing a <regular-layout>.

Theming

Themes are plain CSS files that style the layout and its ::part() selectors, scoped by a class on <regular-layout>. Apply a theme by adding its stylesheet and setting the class:

<link rel="stylesheet" href="regular-layout/themes/chicago.css">

<regular-layout class="chicago">
    ...
</regular-layout>

<regular-layout-frame> exposes these CSS parts:

| Part | Description | |------|-------------| | titlebar | Tab bar container | | tab | Individual tab | | active-tab | Currently selected tab | | close | Close button | | active-close | Close button on the active tab | | container | Content area |

regular-layout.mytheme regular-layout-frame::part(titlebar) {
    background: #333;
}

regular-layout.mytheme regular-layout-frame::part(active-tab) {
    background: #fff;
    color: #000;
}

See the example themes/ directory for examples of how to write a complete theme for <regular-layout> and regular-layout-frame>.

Events

| Event | Detail | Cancelable | Description | |-------|--------|------------|-------------| | regular-layout-before-resize | { calculatePresizePaths() } | Yes | Fired before any layout change. Cancel to suspend until resumeResize(). | | regular-layout-update | Layout | No | Fired after layout state is updated. |

layout.addEventListener("regular-layout-update", (event) => {
    console.log("New layout:", event.detail);
});