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

@4rk/css-transition

v1.0.0

Published

Apply a CSS class for each stage of a CSS transition

Downloads

6

Readme

CSSTransition

Apply a CSS class for each stage of a CSS transition.

This is basically a react-free rip-off of react-transition-group.

It is super useful to make CSS transitions from display: none; to display: whatever;.

Demo

There is a simple usage demo which can be run as follows:

yarn
yarn start

Usage

The basic idea of this library is that in order to control a CSS transition using JavaScript, you have to think of it as a three-staged process:

  1. Start:
    • Set prerequisites for the animation, e.g. set display: block; and transition: all 0.3s ease;
  2. Active:
    • One requestAnimationFrame after start
    • Change transitioning properties, e.g. set opacity: 1;
  3. Done:
    • After transitionend or a timeout
    • Make transition changes permanent, this means usually setting the same properties as during active stage
    • During exit, this would be the place to set display back to none.

For a code example, please take a look at the demo.

Tricks

  • Apply pointer-events: none; during .exit and .exit-active to prevent user interaction during transition
  • How to cope with the timeout warning:
    1. Make sure that a transition is happening on the element specified during instantiation, e.g. it is not a parent element but the direct element on which the transitions are happening. If not, create separate CSSTransition instances for each element.
    2. Make sure that there is actually a transition. The instance is waiting for the first transitionend event.
    3. Check whether your transition takes less time than the configured timeout which is by default 500ms. If not, increase the timeout.

Creating a release

Certain steps need to be done in order to create a new release:

  1. Decide on a semver version number
  2. Start a new release using git flow release start [version number]
  3. Update the package.json version
  4. Run yarn run release
  5. Commit changes: git commit -a -m "Prepare release [version number]"
  6. Finish release using git flow release finish
  7. Push all changes: git push origin --all && git push origin --tags

License

See LICENSE