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 🙏

© 2024 – Pkg Stats / Ryan Hefner

masory-layout

v1.0.2

Published

Create your own masory layout of images very easy.

Downloads

3

Readme

Massory Layout

Build Status

Masonry layout is a light and small library to build an adaptable image gallery design, you can define the columns and in turn it has internally slow loading of images.

  • Light and small
  • Easy to use and familiarize
  • Does not need extensive configuration

Installation

Massory layout requires Node.js v4+ to run. Install the dependencies and devDependencies and start the server.

$ cd your_folder
$ npm i massory-layout
const massory = require("masory-layout").default;

const ma = new massory(...);

ma.show(...)

Api

To start using the library you need to instantiate a new Massory({...}) object. Receive a configuration object to manage the behavior.

The configuration object receives a couple of basic properties for the structure, a complete example:

{
  container: document.getElementById("container"),
  width: "100%",
  maxWidth: "1200px",
  center: true,
  columns: 5,
  lazyLoad: true,
  margin: "5px",
}
  • container indicates the container where the images will be added to the DOM. This property can be optional, you can define it in the method: show(imagesArray, container) .
  • width determines the width in any unit of measure of the container.
  • maxWidth maxWidth determines the maximum width that the container should have, similar to the previous one.
  • center a boolean indicating whether the container is centered.
  • columns An integer that indicates the number of columns to place images.
  • lazyLoad A boolean that indicates if lazy loading is used in the images, to use this feature, you must provide an array of objects when displaying the images, it is better explained below.
  • margin a string that determines the margin around the images.

To show your images, you use the method show(imagesArray, container). This method creates a node and adds it in the container that you have defined in the constructor or in the show method. If you don't provide a container, the default will be the <body>. Examples:

const container = document.getElementById("container");

const ma = new Massory({
//container,       (you may also put it here.)
  width: "100%",
  maxWidth: "1200px",
  center: true,
  columns: 5,
  lazyLoad: true,
  margin: "5px",
});

const images = ["blablalba.png", "blablabla.jpg"]

// Show all images in the container
ma.show(images, container);

Lazy load

To use these features, in the arrangement of the images, instead of using a string, you use an object with 2 properties:

{
    src: "original_image.png",
    lazy: "tiny_image.png"
}
  • src The url of the original image.
  • lazy The url of the lightest image while loading the largest.

Responsive

This library is responsive, even though you do not have control over this part, this library implements 2 breakpoints:

  • screens medium and small

Breakpoints occur when you have more than 3 columns. The measurements are:

  • Medium screens 992px (3 columns)
  • Small screens: 612px (1 column)

"Large Screens"

In this way all the characteristics of this small library are used :)