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

@tlt/infinite-gallery

v0.3.0

Published

Infinite gallery component. You set an image-provider, the component makes you scroll smoothly through all the images it provides

Downloads

1

Readme

infinite-gallery

Infinite gallery component. You set an image-provider, the component makes you scroll smoothly through all the images it provides.

Usage

To use the component, essentially do a new TLTInfiniteGallery and give it the following parameters

  • A div (from the DOM) to contain the gallery. The gallery will not make the div grow (or shrink for that matter). Therefore it is very important to you force it to have the size and position you want it to have.
  • A javascript "class" known as the ImageProvider, implemented something a-la this
function MyImageProvider() {}
MyImageProvider.prototype.size = function() {
    // Return the number of images in the gallery
    // If the size is unknown (very very big) you can just return a very very big number. It does not have to be exact, if you know the user will never scroll to the end anyway
}
MyImageProvider.prototype.url = function(index) {
    // Return the full URL of image number #index (parameter)
}
MyImageProvider.prototype.setResultsChangedObserver = function(observer) {
    // Used by the componenet to hand over an observer. You have to call function "changed" (no parameters) if the images in the gallery changes
    // Useful if you use the compoenent to show images found by a search done by the user. When the user makes a new search, call "changed" on the observer
    // and start responding from the other functions on this ImageProvider adhering to the images found in the new search
}
  • The number of pixels to "fetch ahead". The componenet will try to fetch images for that many pixels ahead of the current scroll position. Higher values will make the container use more memory in the browser and make the DOM bigger. But a higher values will also give a more smooth scrolling experience, especially if the server providing the images is slow (or the images are very big). Find a good balance. Try starting out with e.g. 2000.
  • The width in pixels of each column in the gallery. The componenet will create as many columns with this width as it can within the width of the div.
  • The minimum width and height in pixels of an image for it to be displayed. Sometimes you might get small irrelevant images in your set of images. Of course your ImageProvider can filter them, but you can also have the componenet ignore them if you want to. The component will not display images where either the width or the height (in pixels) is not at least the value provided here. To disable this feature just use 0.

See demo for demonstrations of using the componenet

This component also comes wrapped in a Angular directive

Bower

  • Dependency: tlt.infinite-gallery
  • Use bower info tlt.infinite-gallery to list available versions

NPM

  • Dependency: @tlt/infinite-gallery
  • Use npm view @tlt/infinite-gallery to list available versions

Meteor