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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cartflow

v3.0.1

Published

A lightweight JavaScript library for creating smooth 'Add to Cart' animations with customizable options, sound effects, and cart shake effects.

Readme

CartFlow

Project Showcase Live Demo Minified Size TypeScript Supported Total Downloads npm version License

CartFlow is a lightweight, modern JavaScript library to animate items moving to a shopping cart. It supports Node.js, browser environments, and UMD/ES module formats.

  • ✨ Smooth "Add to Cart" animations
  • 🔈 Optional sound effect support
  • 🛒 Optional cart "shake" effect
  • ⚙️ Fully customizable via configuration options
  • 🌍 Works in modern browsers and Node.js
  • 📚 Typed API for great IDE experience (TypeScript definitions included)
  • ⚡ Uses GSAP if available, otherwise falls back gracefully

Table Of Contents

  1. Installation
  2. Demo
  3. Usage
  4. Configuration Options
  5. Browser & Nodejs Compatibility
  6. Built With Cartflow.js
  7. Contributing
  8. Changelog
  9. License

Installation

  • 1. Install with npm:

npm install cartflow
  • 2. Using a <script> tag (for browsers):

<script src="https://unpkg.com/cartflow"></script>

Or use your own hosted file if needed: <script src="dist/CartFlow.js"></script>.

Demo

See CartFlow in action here: Live Demo

Try adding items to the cart and watch the smooth animation!

Usage

  • 1. In Node.js / TypeScript / ESM

// CommonJS (Node.js)
const CartFlow = require('cartflow');

// ES Module or TypeScript
import CartFlow from 'cartflow';
  • 2. Quick Example

const animation = new CartFlow({
    cartSelector: ".shopping-cart",
    buttonSelector: ".add-to-cart",
    onComplete: (item) => {
        console.log("Item successfully animated to the cart!", item);
    },
    onCartShake: (cart) => {
        console.log("Cart shake effect completed!", cart);
    },
    soundEffect: "click-sound.mp3",
  });

Configuration Options

| Option | Type | Default | Description | | ------------- | ------------- | -------- | ------ | | cartSelector | string | .shopping-cart | CSS selector for the shopping cart element. | | buttonSelector | string | .add-to-cart | CSS selector for the "Add to Cart" buttons. | | itemSelector | string | .item | CSS selector for the item container. | | imageSelector | string | img | CSS selector for the item's image.| | animationDuration | number | 1000 | Duration of the animation in milliseconds. | | easing | string | ease-in-out | Easing function for the animation. | | shakeEffect | boolean | true | Enable or disable the cart shake effect. | | soundEffect | string or Audio | null | URL or Audio object for a sound effect. | | onComplete | function | null | Callback function after the animation completes, receives the affected item element. | | onCartShake | function | null | Callback function after the cart shake effect, receives the cart element. |

Browser & Nodejs Compatibility

Chrome | Firefox | Safari | Opera | Edge | Nodejs --- | --- | --- | --- | --- | --- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔

Built With Cartflow.js

See how others are using this library in our SHOWCASE.md.

Using this library? Add your project

Contributing

We welcome contributions! Please read the Contributions Guid to get started.

Changelog

See Changelog for full release history and version details.

License

This package is open-source software licensed under the MIT license.