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

mithril-transition

v4.0.0

Published

A lightweight library for MithrilJS to create your own custom transitions based on the lifecycle of your components.

Downloads

56

Readme

mithril-transition

Build Status

A lightweight library for MithrilJS to create your own custom transitions based on the lifecycle of your components.

NOTE: This package was updated for the rewrite of Mithril, if you are looking for the old and unmaintained package can be found it here

Install

With npm and browserify/webpack do:

npm install --save mithril-transition

Or you can use the UMD bundle

<script src="/lib/mithril-transition/dist/mithril-transition.min.js" type="text/javascript"></script>

How to use it

mithril-transition is a function factory that returns an object with an oncreate and onremove hooks to add in the vnode lifecycle (where you want animate it) of mithril.

Check our live example

Functions

createTransition(options = {}) -> {transition}

Factory function to create a new transition. The options are defined below.

transition.oncreate(vnode)

Function that you need hook up to the lifecycle of the vnode

transition.onremove(vnode)

Function that you need hook up to the lifecycle of the vnode

transition.enable()

Method to enable the animation. By default is enabled.

transition.disable()

Method to disable the animation.

Options

animation (required)

Callback function where you define the animation for the next/prev component.

The callback has an object argument {} with the next properties:

lastElm: The last DOM element that is removing.

nextElm: The new DOM element that is inserting.

direction: This option allow to you define differents animations based of next/prev direction of the lifecycle components. Is required have at least useHistory in true.

cbLast: Callback to complete the remove of the lastElm. (is required call it)

cbNext: Callback to complete the insert of the nextElm. (is required call it)

useHistory (default = true)

When is enabled the library keep the history of your components, to know if the next element in the transition is really the next element or a prev element.

persistHistoryAs ({string} default = null)

Save the history in the sessionStorage identified by a key.

classList ({object})

Before that the transition begin, the library set a list of classes for each parent|element and remove it when the transition is finished.

default = {
    parent: 'm-transition-parent',
    lastElem: 'm-transition-last-element',
    newElem: 'm-transition-next-element',
    direction: 'm-transition-<direction>'
}

On roadmap

  • Add unit tests

Credits

  • Thanks to @dpaez to work with me the last year in a mobile project using Mithril and exploring how to make transitions and animations with this excellent "MVC" framework.

License

MIT