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

slideshow-react

v0.1.4

Published

![Header Image](react-slideshow.png)

Downloads

12

Readme

Header Image

npm version npm downloads codecov

Slideshow React

This library is still a heavy work in progress!

Create a slideshow with lazy loaded image (and other elements) using the IntersectionObserver API with support for thumbnails and scrolling. Styling/style sheets are not bundled with this library but examples of styling implementations are provided.

Storybook Link

Examples

Philosophy

There are a couple design decisions that impact the way the current iteration is implemented detailed below.

Load Only What is Viewable

Only what is viewable and is presumed to be viewed soon should be loaded/requested.

Images

Images should typically be loaded into the DOM with a small file size footprint and then load the full quality one when needed. NextJS for example does this with their blur prop and providing two different srcs for an image and then loading the full quality image when it comes into the viewport. This library does the same using the intersection observer API. As a slideshow is scrolled, it will request and load the full quality one. In addition, a preloadingDepth can be provided to load the full quality images of neighboring slides as well at a given depth away from the current active slide to ensure slides are loaded before being viewed.

Offset most Logic to Browser Functionality

Slideshow functionality can be built with native browser supported CSS and JavaScript.

Between built-in JavaScript functions and CSS properties, building out a slideshow is doable with little else. Adding lazy loading of images and other convenient hooks and functions as part of the slideshow is where slideshow-react comes in. Under the covers, the examples slideshow-react uses are implemented mostly using CSS (technically SCSS) to show an agnostic way of implementing slideshow styling separate from any other styling methods (JSS, TailwindCSS, etc).

Images

The general practice when implementing CSS around images in a slideshow is:

  • The dimensions should not change (use srcset and sizes attributes on images to load responsive versions)
  • The rendered image should match the dimensions as closely as possible to that of the loaded image

Typical implementations will involve the usage of:

  • CSS object-fit property
  • srcset and sizes image attributes