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

vanilla-justified-gallery

v1.0.5

Published

Esta es una galeria que ajusta las imagenes sin importar su relación de aspecto, para que se justifique respecto a los bordes. Sin frameworks, sin librerias externas.

Downloads

10

Readme

Vanilla Justified Gallery

This is a gallery that adjusts images no matter their aspect ratio, so they are justified with respect to the borders. No frameworks, no external libraries.

Screenshots

Vanilla Justified Gallery Demo

Built with TypeScript.

Installation

Install my-project with npm

  npm install vanilla-justified-gallery

  or 

  yarn add vanilla-justified-gallery

Usage/Examples

Create a div tag with the id "justified_gallery".

// index.html
<body>
    <header>
      <h1>My app with Justified Gallery</h1>
    </header>
    <div id="justified_gallery"></div>
    <script type="module" src="/main.js"></script>
</body>

Or injects with JavaScript

// index.html
<body>
    <div id="app"></div>
    <script type="module" src="/main.js"></script>
</body>
//main.js
import './style.css'
(function(){
  document.querySelector('#app').innerHTML = `
    <header>
      <h1>My app with Vite</h1>
    </header>
    <section class="gallery-coontainer">
      <div id="justified_gallery"></div>
    </section>
  `
}())

Import the gallery function and your images

//main.js
import './style.css'
import {gallery} from "vanilla-justified-gallery"
import images from "./data/images.json"

(function(){
  document.querySelector('#app').innerHTML = `
    <header>
      <h1>My app with Vite</h1>
    </header>
    <section class="gallery-coontainer">
      <div id="justified_gallery"></div>
    </section>
  `
  gallery({images})
}())

Your image array should look as follows

// array of ImageOpject

ImageOpject {
  url: string;
  title?: string;
  description?: string;
  altText?: string;
}

Example:

[
    {
      "id": "photo_1",
      "url": "https://images.unsplash.com/photo-1593318917163-76fa09974ba5?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80",
      "title": "Photo 1",
      "altText": "Photo 1",
      "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit."
    },
    {
      "id": "photo_2",
      "url": "https://images.unsplash.com/photo-1603251581451-c87f8ee7febc?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1881&q=80",
      "title": "Photo 2",
      "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit."
    }
]

The gallery function accepts the following values

| param | value | default | requiredrequired | Description | | ------------ | --- | ------- | --- | ------------------------------------------------------------------- | | images | ImageOpject | undefined | true | array of ImageOpject | | showTitle | boolean | false | false | boolean value indicating whether to display the title of the image when hover | | centerTitle | boolean | false | false | boolean value indicating if the title should be centered | | showDescription | boolean | false | false | boolean value indicating whether to display the desciption text on hover | | centerDescription | boolean | false | false | boolean value indicating if the description should be centered | | separation | number | 1 | false | numerical value, will be the number of pixels separating the images. |

Features

  • Right arrow key
  • Left arrow key
  • Esc key
  • Lighbox
  • Infinite loop

Puedes encontrar la muestra del proyecto aqui Justified Gallery

Great! You can add any number of images 🌠🎆🎇🎑🩻.

A tip, intersperse between portrait and landscape images, success!!!!!

@poncegl