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

revelio

v0.0.5

Published

A very small library to reveal elements on scroll using an IntersectionObserver and CSS.

Downloads

9

Readme

Revelio

A very small library to reveal elements on scroll using an IntersectionObserver and CSS.

Installation

Install from npm using your favourite package manager.

yarn add revelio

Import into your project.

import { revelio } from 'revelio'

Usage

  • Add a [data-revelio] attribute to DOM elements you wish to animate. This attribute identifies elements to observe for entries into the viewport.

  • Add one or more comma-separated animation names as the [data-revelio] attribute value to the element.

  • Define the CSS for the animation names used. This will control the actual animation. Basic examples:

:root {
  --animate-distance: 20px;
  --animate-timing: 450ms;
  --animate-easing: ease-out;
}

[data-revelio] {
  transition: all var(--animate-timing) var(--animate-easing);
}

[data-revelio*="slide-up"] {
  transform: translateY(var(--animate-distance));
}

[data-revelio*="fade-in"] {
  opacity: 0;
}
  • Call the revelio() method in your code.

  • That's it! Ensure that the bundle containing the revelio script is loaded with the defer attribute or has a DOMContentLoaded event listener to ensure that all DOM elements are detected correctly.

Options

  • Users can tailor revelio by including a revelioConfig object on the global window object. This must be included in the HTML before the bundle containing revelio.
// Default values shown.
<script>
  window.revelioConfig = {
    root: null,
    rootMargin: null,
    threshold: 0.25,
    ignoreDisplayNone: true,
    ignoreHidden: false,
  };
</script>

|Variable|Description| |:-----:|:-----| |root|IntersectionObserver root element. Default is the browser viewport, but can be any scrollable element represented by a DOMString (eg. document.body)| |rootMargin|Used to modify the root element shape. Can only be set if root is not null (viewport).| |threshold|Amount (%) that an element must have entered the root to trigger the animation. Decimal value from 0.00 to 1.00| |ignoreDisplayNone|Whether to ignore elements with display: none when triggering animations. Boolean value that defaults to true.| |ignoreHidden|Whether to ignore elements with visibility: hidden when triggering animations. Boolean value that defaults to false.|