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

@nitlix-hq/aos

v1.0.2

Published

πŸ™ An AOS-Like Initaliser, with active updates and more features.

Readme

Intro

Aos is a lightweight, TypeScript-first scroll animation library powered by IntersectionObserver. It's a drop-in replacement for the original AOS library β€” actively maintained, with more features and zero dependencies.

If you've used AOS before, you'll feel right at home. If you haven't, here's what you get:

  • Zero dependencies β€” uses only the DOM and IntersectionObserver
  • Full TypeScript support β€” fully typed config, callbacks, and return values
  • Anchor support β€” trigger animations based on a different element's visibility
  • Mirror mode β€” reverse animations when elements leave the viewport
  • Per-element overrides β€” set data-aos-duration, data-aos-easing, and data-aos-delay on individual elements
  • Mobile control β€” disable animations on mobile devices or below a minimum window width
  • Custom disable logic β€” pass your own function to decide whether to initialise
  • Clean teardown β€” destroy() disconnects all observers and removes all added classes/attributes

Table of contents

Quickstart

Install:

bun add @nitlix-hq/aos

Other package managers:

pnpm add @nitlix-hq/aos
npm i @nitlix-hq/aos

1) Add data-aos attributes to your HTML

Apply the data-aos attribute with the name of the animation you want:

<div data-aos="fade-up">I animate when scrolled into view</div>
<div data-aos="fade-left" data-aos-duration="500">I'm faster</div>

2) Include AOS CSS

You'll need to include the AOS stylesheet for the built-in animation classes. You can use the original AOS CSS or write your own β€” Aos toggles the aos-init and aos-animate classes, so any CSS that targets those will work.

3) Initialise Aos

import init from "@nitlix-hq/aos";

const aos = init({
    duration: 800,
    easing: "ease-in-out",
    mirror: false,
});

That's it. Every element with data-aos is now observed and will animate when it enters the viewport.

4) Clean up when done

aos.destroy();

Configuration

Pass a config object to init(). All fields are optional:

| Option | Type | Default | Description | | ----------------- | -------------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------- | | duration | number | 1000 | Animation duration in milliseconds | | easing | string | "ease-in-out" | CSS easing function | | delay | number | 0 | Delay before the animation starts (ms) | | mirror | boolean | false | Reverse animations when elements scroll out of view | | offsetEnter | number | 0 | Offset (px) from the top of the viewport for triggering enter | | offsetExit | number | 0 | Offset (px) from the bottom of the viewport for triggering exit | | mobile | boolean | false | Disable animations on mobile devices (ignored if disableInitFunc is set) | | minWindowWidth | number | 0 | Minimum window width for animations to be enabled (ignored if disableInitFunc is set) | | callback | (element, status, observer, entry) => void | β€” | Called when an element enters or exits the viewport | | disableInitFunc | () => boolean | β€” | Custom function to determine whether Aos should be disabled |

HTML attributes

These attributes can be set on individual elements to override global config:

| Attribute | Description | | -------------------- | --------------------------------------- | | data-aos | The animation name (required) | | data-aos-duration | Override animation duration (ms) | | data-aos-easing | Override CSS easing function | | data-aos-delay | Override animation delay (ms) | | data-aos-anchor | CSS selector of an anchor element |

If a per-element attribute is already set, Aos won't overwrite it with the global default.

Anchors

By default, Aos observes the animated element itself. With data-aos-anchor, you can trigger an animation based on a different element entering the viewport:

<div id="trigger-point">Scroll past me...</div>
<div data-aos="fade-up" data-aos-anchor="#trigger-point">
    I animate when #trigger-point is visible
</div>

If the anchor selector is invalid or not found, Aos falls back to observing the element itself.

Callbacks

The callback option fires every time an observed element enters or exits the viewport:

init({
    callback: (element, status, observer, entry) => {
        console.log(element, status); // "enter" or "exit"
    },
});

Exit callbacks only fire when mirror is true.

Disabling animations

Mobile detection

init({ mobile: false }); // disables on mobile user agents

Minimum window width

init({ minWindowWidth: 768 }); // disables below 768px

Custom logic

init({
    disableInitFunc: () => {
        return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
    },
});

When disabled, Aos strips all data-aos related attributes from elements so they render in their final state without animation.

Cleanup

init() returns an object with a destroy() method. Calling it:

  1. Disconnects all IntersectionObserver instances
  2. Removes aos-init and aos-animate classes from all managed elements
  3. Removes any attributes that Aos added (preserves attributes that were already present)
const aos = init();

// Later (e.g. on route change in an SPA):
aos.destroy();

Framework examples

React

import { useEffect } from "react";
import init from "@nitlix-hq/aos";

function App() {
    useEffect(() => {
        const aos = init({ duration: 800, mirror: true });
        return () => aos.destroy();
    }, []);

    return <div data-aos="fade-up">Hello</div>;
}

Svelte

<script>
    import { onMount, onDestroy } from "svelte";
    import init from "@nitlix-hq/aos";

    let aos;
    onMount(() => {
        aos = init({ duration: 800 });
    });
    onDestroy(() => aos?.destroy());
</script>

<div data-aos="fade-up">Hello</div>

Vanilla JS

<script type="module">
    import init from "@nitlix-hq/aos";
    init({ duration: 1000, easing: "ease-out" });
</script>

<div data-aos="fade-up">Hello</div>

API reference

init(config?)

Initialises Aos. Scans the DOM for [data-aos] elements, sets up IntersectionObserver instances, and applies default attributes.

Parameters:

| Name | Type | Description | | -------- | -------- | ------------------------ | | config | Config | Optional config object |

Returns: { destroy: () => void }

Config

interface Config {
    duration?: number;
    easing?: string;
    callback?: (
        element: Element,
        status: "enter" | "exit",
        observer: IntersectionObserver,
        entry: IntersectionObserverEntry,
    ) => void;
    mirror?: boolean;
    disableInitFunc?: () => boolean;
    delay?: number;
    offsetEnter?: number;
    offsetExit?: number;
    mobile?: boolean;
    minWindowWidth?: number;
}

Contributor docs

License

MIT