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

@phollyer/elm-motion

v1.0.3

Published

JavaScript companion for the phollyer/elm-motion Elm package - Web Animations API integration via Elm ports

Readme

@phollyer/elm-motion

JavaScript companion for the phollyer/elm-motion Elm package. Provides Web Animations API integration via Elm ports, enabling hardware-accelerated animations and scroll-driven animations (ScrollTimeline, ViewTimeline) from Elm.

This package is ESM-only. Use import from an ESM-aware bundler or runtime.

Installation

npm install @phollyer/elm-motion

Usage

1. Install the Elm package

elm install phollyer/elm-motion

2. Add the JavaScript companion to your app

ES module (bundler)

import ElmMotion from '@phollyer/elm-motion'

Script tag (CDN)

<script src="https://unpkg.com/@phollyer/elm-motion/elm-motion.js"></script>

3. Initialize after your Elm app starts

const app = Elm.Main.init({ node: document.getElementById('app') })

ElmMotion.init(app.ports)

4. Define ports in your Elm module

port module Main exposing (..)

port motionCmd : Json.Encode.Value -> Cmd msg
port motionMsg : (Json.Encode.Value -> msg) -> Sub msg

Pass these ports to the engine:

import Anim.Engine.WAAPI as WAAPI

animState =
    WAAPI.init motionCmd motionMsg [ Opacity.init "box" 0 ]

What this companion does

ElmMotion.init(ports) subscribes to the motionCmd port and drives animations using the browser's Web Animations API. It sends animation events (started, ended, progress) back to Elm via the motionMsg port.

The same companion handles all three WAAPI-based engines:

| Elm Engine | Use case | | ---------- | -------- | | Anim.Engine.WAAPI | State-tracked animations with full control | | Anim.Engine.ScrollTimeline | Animation progress tied to scroll position | | Anim.Engine.ViewTimeline | Animation progress tied to element viewport position |

Error reporting

The companion is silent by default. Opt in to receive reports via onError (your own subscriber) or the built-in console adapter useConsoleReporter.

import ElmMotion from '@phollyer/elm-motion';

// Development
if (process.env.NODE_ENV !== 'production') {
    ElmMotion.useConsoleReporter();
}

// Production
ElmMotion.onError((error, context) => {
    Sentry.captureException(error, { extra: context });
});

ElmMotion.init(app.ports);

Each subscriber receives (error, context). The context object always contains a source, a severity ('error' or 'warning') and usually a stable code you can route on (e.g. TARGET_NOT_FOUND, API_UNSUPPORTED, POLYFILL_LOAD_FAILED).

See the full Error Reporting guide for the API reference, the complete list of error codes, and routing patterns.

TypeScript

Type definitions are included at elm-motion.d.ts.

Documentation

Full documentation, guides, and live examples at phollyer.github.io/elm-motion.

License

BSD-3-Clause — see LICENSE file for details.

Author

Created by Paul Hollyer