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

adoquin

v0.2.1

Published

A ResizeObserver-based library for building masonry layouts

Readme

Adoquín

Adoquín builds a masonry layout from a list of HTML elements.

It doesn't matter if you have list of canvas, images, videos, text, etc. You just need to specify the container of the elements and Adoquín does everything.

How to use Adoquín?

Just needs to follow 2 steps:

1. Create the HTML structure:

<div>
    <div id="grid">
        <!-- items -->
        <div></div>
        <div></div>
    </div>
</div>

[!NOTE] You don't need create <div> containers, these could be any HTML (of container type) tag that you want.

The structure is composed of 3 parts:

  • "Grandparent": It's important because it's the element that Adoquín observes, if you need add an extra space inline (margin or padding) from CSS you should use this element. You no need add any class or id to this container.
  • "Parent": It's the only one needs id, because is the element that Adoquín uses to reference the other elements ("Grandparent" and "children").
  • "Children": Must contain the content of the cards/pin/etc. You don't need specify class or id for these elements.

[!IMPORTANT] Follow this structure it's necesary for Adoquín to work.

[!WARNING] If you're working with images, videos, etc. we recommended giving them a width: 100% style so they adapt to the width of their parent content.

2. Specify elements and initialize Adoquinado

import { Adoquinado } from "Adoquin"

const grid = new Adoquinado("id_of_the_parent_elements"); // ej: "grid"

grid.init(); // Initialize Adoquinado

Options object (optional)

The previous sintax accepts an options object as a second param if you want personalize the view of elements, the object signature is:

export type GridOptions = Partial<{
	gap: number; // Separation of elements (defaul: 16px)
	minColumns: number; // Min column when screen is too small (default: 2)
	columnWidth: number; // The column or elements width (default: 225px)
	minContainerWidth: number; // The min Layout width (default 268px)
	onlyInternalGap: boolean; // Internal separation only (default: false)
}>;

Use with object

import { Adoquinado } from "Adoquin"

const grid = new Adoquinado("grid", {
    gap: 24,
    minColumns: 1,
    columnWidth: 200,
    minContainerWidth: 150,
    onlyInternalGap: true
});

grid.init();

/* 
initialize = | Create container and individual observers
             | Calc layout positions
             | Apply calculated coords and position styles
*/

[!NOTE] Each of option for this object can be omitted, you don't need declare them all at the same time.

Extra methods

Adoquín includes extra methods for differents situations.

append

Useful when you want add items to the grid container (e.g. for scroll infinite)

  • Signature:
append(newItems: HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollection);
  • Use:
import { Adoquinado } from "Adoquin";

const $grid = document.getElementByd("grid");
const children = $grid.children;

const masonry = new Adoquinado("grid");
masonry.init();

// Then...
function infiniteScroll(){
    // ...logic
    masonry.append(children);
}

update

If you modify styles or elements externally, you can force a manual recalculation.

import { Adoquinado } from "Adoquin";

const masonry = new Adoquinado("grid");
masonry.init();

// Then...
masonry.update();

destroy

This method destroy the instance if memory is the component is unmounted (React, Vue, etc.)

import { Adoquinado } from "Adoquin"

const masonry = new Adoquinado("grid");
masonry.init();

// Then, when you decide
masonry.destroy();

License

MIT

See LICENSE