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

jeep-photoviewer

v1.2.3

Published

PhotoViewer Stencil Component

Downloads

7,737

Readme

Built With Stencil

jeep-photoviewer

Stencil web component using a CSS grid to display one image or a set of images as gallery or slider and using CSS snap points to walk through images. A selected image can be viewed in fullscreen mode with zoom in/out and pan capabilities.

The Web component tag is is the main component. It is using the following embedded components:

  • Horizontal scrolling through images.
  • Set of buttons (Share , Fullscreen, Close) which could be visible or hidden (Single Tap).
  • Zoom In (Double Tap) / Out (Single Tap) and Pan features.
  • Based on Web Share API. No fallback for Browsers not compatible with Web Share API.

All components use Shadow DOM

Since 1.1.0, the background color can be specified in the options parameter and must be in the range

["white","ivory","lightgrey","darkgrey","dimgrey", "grey", "black"]

Getting Started

Script tag

  • Put a script tag similar to this
    <script type="module" src="https://unpkg.com/jeep-photoviewer/dist/jeep-photoviewer.esm.js"></script>
    <script nomodule src="https://unpkg.com/jeep-photoviewer/dist/jeep-photoviewer.js"></script>

in the head of your index.html

  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install jeep-photoviewer --save
  • Put a script tag similar to this
<script src='node_modules/my-component/dist/my-component.esm.js'></script>

in the head of your index.html

  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil-starter app

  • Run npm install jeep-photoviewer --save
  • Add an import to the npm packages import jeep-photoviewer;
  • Then you can use the element anywhere in your template, JSX, html etc

Usage

Grid Display

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    <title>Stencil Component Starter</title>

    <script type="module" src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.esm.js"></script>
    <script nomodule src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.js"></script>
  </head>
  <body>
    <jeep-photoviewer></jeep-photoviewer>
  </body>
  <style>
    body {
      background-color: #000;
    }
  </style>
  <script>
    var cmp = document.querySelector('jeep-photoviewer');
    cmp.imageList = [
      {url: "https://i.ibb.co/wBYDxLq/beach.jpg", title: "Beach Houses"},
      {url: "https://i.ibb.co/gM5NNJX/butterfly.jpg", title: "Butterfly"},
      {url: "https://i.ibb.co/10fFGkZ/car-race.jpg", title: "Car Racing"},
      {url: "https://i.ibb.co/ygqHsHV/coffee-milk.jpg", title: "Coffee with Milk"},
      {url: "https://i.ibb.co/7XqwsLw/fox.jpg", title: "Fox"},
      {url: "https://i.ibb.co/L1m1NxP/girl.jpg", title: "Mountain Girl"},
      {url: "https://i.ibb.co/wc9rSgw/desserts.jpg", title: "Desserts Table"},
      {url: "https://i.picsum.photos/id/1009/5000/7502.jpg?hmac=Uj6crVILzsKbyZreBjHuMiaq_-n30qoHjqP0i7r30r8", title: "Surfer"},
      {url: "https://i.picsum.photos/id/1011/5472/3648.jpg?hmac=Koo9845x2akkVzVFX3xxAc9BCkeGYA9VRVfLE4f0Zzk", title: "On a Lac"},
      {url: "https://i.ibb.co/wdrdpKC/kitten.jpg", title: "Kitten"},
      {url: "https://i.ibb.co/dBCHzXQ/paris.jpg", title: "Paris Eiffel"},
      {url: "https://i.ibb.co/JKB0KPk/pizza.jpg", title: "Pizza Time"},
      {url: "https://i.ibb.co/VYYPZGk/salmon.jpg", title: "Salmon "},
    ];
    const options = {};
    options.maxzoomscale = 3;
    options.compressionquality = 0.6;
    cmp.options = options;
    cmp.mode = "gallery";
    cmp.addEventListener('jeepPhotoViewerResult',(ev) => {
      if(ev.detail) {
        if(ev.detail.result) {
          if( Object.keys(ev.detail).includes("imageIndex")) {
            console.log(`${ev.detail.imageIndex}`);
          }
          if( Object.keys(ev.detail).includes("message")) {
            console.log(`${ev.detail.message}`);
          }
        } else {
          console.log(`${ev.detail.message}`);
        }
      }
    },false);
  </script>
</html>

One Image Display

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    <title>Stencil Component Starter</title>

    <script type="module" src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.esm.js"></script>
    <script nomodule src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.js"></script>
  </head>
  <body>
    <jeep-photoviewer></jeep-photoviewer>
  </body>
  <style>
    body {
      background-color: #000;
    }
  </style>
  <script>
    var cmp = document.querySelector('jeep-photoviewer');
      {url: "https://i.ibb.co/wBYDxLq/beach.jpg", title: "Beach Houses"},
      {url: "https://i.ibb.co/gM5NNJX/butterfly.jpg", title: "Butterfly"},
      {url: "https://i.ibb.co/10fFGkZ/car-race.jpg", title: "Car Racing"},
      {url: "https://i.ibb.co/ygqHsHV/coffee-milk.jpg", title: "Coffee with Milk"},
      {url: "https://i.ibb.co/7XqwsLw/fox.jpg", title: "Fox"},
      {url: "https://i.ibb.co/L1m1NxP/girl.jpg", title: "Mountain Girl"},
      {url: "https://i.ibb.co/wc9rSgw/desserts.jpg", title: "Desserts Table"},
      {url: "https://i.picsum.photos/id/1009/5000/7502.jpg?hmac=Uj6crVILzsKbyZreBjHuMiaq_-n30qoHjqP0i7r30r8", title: "Surfer"},
      {url: "https://i.picsum.photos/id/1011/5472/3648.jpg?hmac=Koo9845x2akkVzVFX3xxAc9BCkeGYA9VRVfLE4f0Zzk", title: "On a Lac"},
      {url: "https://i.ibb.co/wdrdpKC/kitten.jpg", title: "Kitten"},
      {url: "https://i.ibb.co/dBCHzXQ/paris.jpg", title: "Paris Eiffel"},
      {url: "https://i.ibb.co/JKB0KPk/pizza.jpg", title: "Pizza Time"},
      {url: "https://i.ibb.co/VYYPZGk/salmon.jpg", title: "Salmon "},
    const options = {};
    options.maxzoomscale = 3;
    options.compressionquality = 0.6;
    options.backgroundcolor = 'lightgrey';
    cmp.options = options;
    cmp.mode = "one";
    cmp.startFrom = 3;
    cmp.addEventListener('jeepPhotoViewerResult',(ev) => {
      if(ev.detail) {
        if(ev.detail.result) {
          if( Object.keys(ev.detail).includes("imageIndex")) {
            console.log(`${ev.detail.imageIndex}`);
          }
          if( Object.keys(ev.detail).includes("message")) {
            console.log(`${ev.detail.message}`);
          }
        } else {
          console.log(`${ev.detail.message}`);
        }
      }
    },false);
  </script>
</html>

Slider Display

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    <title>Stencil Component Starter</title>

    <script type="module" src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.esm.js"></script>
    <script nomodule src="https://unpkg.com/[email protected]/dist/jeep-photoviewer/jeep-photoviewer.js"></script>
  </head>
  <body>
    <jeep-photoviewer></jeep-photoviewer>
  </body>
  <style>
    body {
      background-color: #000;
    }
  </style>
  <script>
    var cmp = document.querySelector('jeep-photoviewer');
      {url: "https://i.ibb.co/wBYDxLq/beach.jpg", title: "Beach Houses"},
      {url: "https://i.ibb.co/gM5NNJX/butterfly.jpg", title: "Butterfly"},
      {url: "https://i.ibb.co/10fFGkZ/car-race.jpg", title: "Car Racing"},
      {url: "https://i.ibb.co/ygqHsHV/coffee-milk.jpg", title: "Coffee with Milk"},
      {url: "https://i.ibb.co/7XqwsLw/fox.jpg", title: "Fox"},
      {url: "https://i.ibb.co/L1m1NxP/girl.jpg", title: "Mountain Girl"},
      {url: "https://i.ibb.co/wc9rSgw/desserts.jpg", title: "Desserts Table"},
      {url: "https://i.picsum.photos/id/1009/5000/7502.jpg?hmac=Uj6crVILzsKbyZreBjHuMiaq_-n30qoHjqP0i7r30r8", title: "Surfer"},
      {url: "https://i.picsum.photos/id/1011/5472/3648.jpg?hmac=Koo9845x2akkVzVFX3xxAc9BCkeGYA9VRVfLE4f0Zzk", title: "On a Lac"},
      {url: "https://i.ibb.co/wdrdpKC/kitten.jpg", title: "Kitten"},
      {url: "https://i.ibb.co/dBCHzXQ/paris.jpg", title: "Paris Eiffel"},
      {url: "https://i.ibb.co/JKB0KPk/pizza.jpg", title: "Pizza Time"},
      {url: "https://i.ibb.co/VYYPZGk/salmon.jpg", title: "Salmon "},
    const options = {};
    options.maxzoomscale = 3;
    options.compressionquality = 0.6;
    options.backgroundcolor = 'ivory';
    cmp.options = options;
    cmp.mode = "slider";
    cmp.startFrom = 5;
    cmp.addEventListener('jeepPhotoViewerResult',(ev) => {
      if(ev.detail) {
        if(ev.detail.result) {
          if( Object.keys(ev.detail).includes("imageIndex")) {
            console.log(`${ev.detail.imageIndex}`);
          }
          if( Object.keys(ev.detail).includes("message")) {
            console.log(`${ev.detail.message}`);
          }
        } else {
          console.log(`${ev.detail.message}`);
        }
      }
    },false);
  </script>
</html>