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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@polgubau/astro-reveal

v1.0.2

Published

Beautiful scroll-reveal animations for Astro with zero JavaScript in production

Readme

@polgubau/astro-reveal

Beautiful scroll-reveal animations for Astro with zero JavaScript in production. GPU-accelerated, performant, and accessible.

✨ Features

  • 🎨 9 animation directions (top, bottom, left, right, scale, diagonals)
  • Zero JS in production - Pure CSS animations
  • 🎯 IntersectionObserver - No scroll listeners
  • 🎭 Presets - Speed, easing, and distance presets
  • 🔄 Stagger animations - Automatic sequential delays
  • Accessible - Respects prefers-reduced-motion
  • 📦 Tiny - < 2KB gzipped
  • 🎨 Customizable - Full control via data attributes

📦 Installation

pnpm add @polgubau/astro-reveal
# or
npm install @polgubau/astro-reveal
# or
yarn add @polgubau/astro-reveal

🚀 Quick Start

1. Add the script to your layout

---
// src/layouts/Layout.astro
---

<html>
  <head>
    <!-- ... -->
  </head>
  <body>
    <slot />

    <!-- Add reveal script -->
    <script>
      import '@polgubau/astro-reveal';
    </script>
  </body>
</html>

2. Import the CSS

---
// src/layouts/Layout.astro
import '@polgubau/astro-reveal/styles';
---

3. Use data attributes

<div data-reveal="bottom">Fades in from bottom</div>

<div data-reveal="scale" data-speed="fast" data-easing="bounce">Scales in with bounce</div>

4. Or use the component

---
import { Reveal } from '@polgubau/astro-reveal';
---

<Reveal direction="left" speed="fast" easing="smooth">
  <h1>Animated heading</h1>
</Reveal>

📖 Documentation

Directions

  • top - Fade from top ↓
  • bottom - Fade from bottom ↑
  • left - Fade from left →
  • right - Fade from right ←
  • scale - Scale from small 🔍
  • top-left - Diagonal ↖️
  • top-right - Diagonal ↗️
  • bottom-left - Diagonal ↙️
  • bottom-right - Diagonal ↘️

Speed Presets

| Speed | Duration | | --------- | --------------- | | instant | 200ms | | fast | 400ms | | normal | 700ms (default) | | slow | 1000ms |

Easing Presets

| Easing | Curve | Use Case | | --------- | -------------------------------------- | ----------------- | | smooth | cubic-bezier(0.4, 0, 0.2, 1) | General (default) | | bounce | cubic-bezier(0.68, -0.55, 0.265, 1.55) | Playful | | elastic | cubic-bezier(0.34, 1.56, 0.64, 1) | Elastic bounce | | sharp | cubic-bezier(0.4, 0, 0.6, 1) | Quick movements | | soft | cubic-bezier(0.25, 0.1, 0.25, 1) | Smooth & elegant |

Distance Presets

| Distance | Pixels | | -------- | -------------- | | small | 16px | | medium | 32px (default) | | large | 64px |

Data Attributes

<div
  data-reveal="bottom"           <!-- Direction -->
  data-speed="fast"              <!-- Speed preset -->
  data-easing="bounce"           <!-- Easing preset -->
  data-distance="large"          <!-- Distance preset -->
  data-delay="200"               <!-- Delay in ms -->
  data-duration="600"            <!-- Custom duration in ms -->
  data-threshold="0.5"           <!-- IntersectionObserver threshold (0-1) -->
  data-root-margin="0px"         <!-- IntersectionObserver rootMargin -->
>
  Content
</div>

Stagger Animations

<div data-stagger="100">
  <div data-reveal="bottom">Item 1</div>
  <!-- 0ms -->
  <div data-reveal="bottom">Item 2</div>
  <!-- 100ms -->
  <div data-reveal="bottom">Item 3</div>
  <!-- 200ms -->
</div>

Component API

---
import { Reveal, RevealList } from '@polgubau/astro-reveal';
---

<Reveal
  direction="bottom"
  speed="fast"
  easing="bounce"
  distance="large"
  delay={200}
  duration={600}
  threshold={0.5}
  rootMargin="0px"
  as="section"
  class="custom-class"
>
  <h1>Content</h1>
</Reveal>

<RevealList stagger={100} class="grid">
  <Reveal direction="left">Item 1</Reveal>
  <Reveal direction="right">Item 2</Reveal>
</RevealList>

🎨 Examples

Hero Section

<section data-stagger="100">
  <div data-reveal="scale" data-speed="fast" data-easing="bounce">
    <h1>Welcome</h1>
  </div>

  <div data-reveal="bottom" data-speed="normal" data-easing="soft">
    <p>Subtitle</p>
  </div>

  <div data-reveal="scale" data-speed="fast" data-easing="elastic">
    <button>CTA</button>
  </div>
</section>

Grid with Alternating Directions

<div class="grid" data-stagger="150">
  {items.map((item, i) => <div data-reveal={i % 2 === 0 ? 'left' : 'right'}>{item}</div>)}
</div>

⚙️ Advanced

Custom Easing

<div data-reveal="bottom" data-easing="cubic-bezier(0.68, -0.55, 0.265, 1.55)">Custom easing</div>

Custom Distance

<div data-reveal="left" data-distance="100">100px distance</div>

Events

element.addEventListener('reveal', (e) => {
  console.log('Element revealed!', e.detail);
});

🎯 Performance

  • ✅ GPU-accelerated (uses transform and opacity)
  • ✅ No layout shifts (uses will-change)
  • ✅ Respects prefers-reduced-motion
  • ✅ IntersectionObserver (no scroll listeners)
  • ✅ Lazy initialization (only observes visible elements)

� Advanced Usage

Manual Initialization

If you need more control, you can import and call init() manually:

<script>
  import { init } from '@polgubau/astro-reveal/reveal';

  // Initialize manually when you want
  init();

  // Or re-initialize after dynamic content loads
  document.addEventListener('my-custom-event', () => {
    init();
  });
</script>

Programmatic Control

import { init, getObserver } from '@polgubau/astro-reveal/reveal';

// Initialize all reveal elements
init();

// Get a custom observer with specific settings
const observer = getObserver(0.5, '0px');
observer?.observe(myElement);

Without Auto-initialization

If you want to handle everything manually, import only the reveal module:

<script>
  // This won't auto-initialize
  import { init } from '@polgubau/astro-reveal/reveal';

  // You control when to initialize
  window.addEventListener('load', () => {
    init();
  });
</script>

�📄 License

MIT © polgubau

🤝 Contributing

Contributions welcome! Please open an issue or PR.

🔗 Links