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

meowsonry-layout

v0.0.1

Published

Masonry layout package

Readme

Meowsonry

License npm version

A lightweight, extensible masonry layout library for modern web applications. Built with TypeScript and inspired by middleware architecture patterns.

Features

  • Intelligent row-based positioning - Optimizes vertical space across columns
  • Middleware architecture - Extend and customize layout behavior
  • Responsive design - Automatically adapts to container width changes
  • Type-safe - Fully typed with strict TypeScript
  • Zero dependencies - Pure JavaScript/TypeScript implementation
  • Auto-update support - Built-in ResizeObserver integration

Installation

npm install meowsonry-layout

Basic Usage

import { meowsonry } from "meowsonry-layout";

const container = document.querySelector(".masonry") as HTMLElement;

meowsonry({ container });
<div class="masonry">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</div>

Configuration

meowsonry({
  container: HTMLElement,
  middleware?: Middleware[]
});

Options

| Option | Type | Description | | ------------ | -------------- | ---------------------------- | | container | HTMLElement | Container element (required) | | middleware | Middleware[] | Array of custom middleware |

Advanced Usage

With Gap Spacing

import { meowsonry, gap } from "meowsonry-layout";

const container = document.querySelector(".masonry") as HTMLElement;

meowsonry({
  container,
  middleware: [gap(16)], // 16px gap between items
});

With Auto-Update

import { meowsonry, autoUpdate } from "meowsonry-layout";

const container = document.querySelector(".masonry") as HTMLElement;

// Initialize layout
meowsonry({ container });

// Automatically update on resize
const cleanup = autoUpdate(container, () => {
  meowsonry({ container });
});

// Cleanup when no longer needed
cleanup();

Middleware System

Meowsonry uses a middleware pipeline architecture with three execution phases:

| Type | When | Context | | ----------------- | -------------------- | --------------- | | beforePlacement | Once before children | Container-level | | placement | For each child | Child-specific | | common | In both phases | Shared |

Creating Custom Middleware

import { MIDDLEWARE_TYPE } from "meowsonry-layout";

const myMiddleware = {
  type: MIDDLEWARE_TYPE.placement,
  callback: ({ context, setContext }) => {
    // Access and modify context
    console.log("Processing child:", context.currentChildElement);

    // Update context with new values
    setContext((prev) => ({
      ...prev,
      customValue: "example",
    }));
  },
};

meowsonry({
  container,
  middleware: [myMiddleware],
});

See MIDDLEWARE.md for detailed documentation.

API Reference

meowsonry(options)

Main layout function that arranges child elements in a masonry grid.

function meowsonry({
  container: HTMLElement,
  middleware?: Middleware[]
}): void

autoUpdate(container, updateFn)

Sets up automatic updates using ResizeObserver.

function autoUpdate(container: HTMLElement, updateFn: () => void): () => void; // cleanup function

gap(value)

Creates middleware to add spacing between items.

function gap(value: number): BeforePlacementMiddleware;

Testing

Run unit tests:

npm test

Run e2e screenshot tests:

npm run test.playwright

Run e2e tests in UI mode:

npm run test.playwright.ui

Update screenshot snapshots:

npm run test.playwright.update

Type checking:

npm run typecheck

Linting:

npm run lint
npm run lint.fix

Architecture

Meowsonry uses a middleware pipeline architecture:

  1. beforePlacement phase - Container initialization (executed once)
  2. placement phase - Child element processing (executed per child)

This approach makes the library highly extensible while keeping the core logic clean and maintainable.

See ARCHITECTURE.md for detailed architecture documentation.

Contributing

See CODESTYLE.md for detailed coding standards.

See AGENTS.md for agents guidelines including:

  • Code style and conventions
  • Testing standards
  • Commit message format
  • Development workflow

License

MIT - See LICENSE for details.

Meow :3