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

helium-animated-pages

v2.1.1

Published

A light spiritual successor to neon-animated-pages using only css animations

Downloads

55

Readme

<helium-animated-pages>

Published on webcomponents.orgnpm version

Docs/Demo

This is a light spiritual successor to the now deprecated <neon-animated-pages>.

It works with CSS animations and only depends on lit. So, you don't have to worry about including any heavy JS libraries.

This component takes care of the logic behind triggering the animations so that you can focus on making your views and your animations. Alternatively, you can use the animations included in the sample-animations folder. 😉

To begin using it follow these simple steps:

  • Install it:

    npm i --save helium-animated-pages

  • Import the script:

    In html:

    <!-- type="module" is essential -->
    <script type="module" src="node_modules/helium-animated-pages"></script>

    In a js module:

    import 'helium-animated-pages';
  • Create an instance of <helium-animated-pages> in your HTML page. You can also use any framework that supports rendering Custom Elements.

    <style>
      /*
        Define your animation keyframes and classes
          in the same context that contains
          <helium-animated-pages>.
        You can also use the provided sample animations.
      */
      /*
        The sample code here only uses a simple
          fade animation to keep the code short.
      */
      .page-fadeIn {
        animation: fadeIn 0.7s ease both;
      }
      @keyframes fadeIn {
        from {
          opacity: 0.3;
        }
        to {
        }
      }
      .page-fadeOut {
        animation: fadeOut 0.7s ease both;
      }
      @keyframes fadeOut {
        from {
        }
        to {
          opacity: 0;
        }
      }
    </style>
    <section>
      <h2>Select a page</h2>
      <select id="selector">
        <option value="page1">Page 1</option>
        <option value="page2">Page 2</option>
        <option value="page3">Page 3</option>
      </select>
    </section>
    <!--
      Use attrForSelected to define which attribute will
        act as the identifier for the pages.
      You can also opt to not use it and use numerical indexes instead.
    -->
    <helium-animated-pages id="pages" attrForSelected="name">
      <!-- The pages can be almost anything -->
      <section name="page1">Page 1</section>
      <div name="page2">Page 2</div>
      <custom-element name="page3"></custom-element>
    </helium-animated-pages>
    <script>
      /*
        Here's a sample way of switching pages.
        You can use a router to do this switching.
      */
      document.querySelector('#selector').addEventListener('change', e => {
        // Switch pages; you can use the numerical index too.
        document.querySelector('#pages').selected = e.target.value;
      });
      /*
        Here we define the "rules" about which CSS classes
          should be applied on the different page transitions.
        For more info go to:
          https://helium-animated-pages.glitch.me/demo/
        I'm using CSS classes that aren't actually defined in
          this context for illustrative purposes.
        You must define every class that you want to use.
      */
      document.querySelector('#pages').animationClasses = {
        /*
          The animation classes rules are like CSS rules:
            the most specific ones apply first.
        */
        // from page1 to page2
        page1_page2: {
          in: 'page_moveFromRight',
          out: 'page_moveToLeft',
        },
        // from anything other than page1 to page2
        '*_page2': {
          in: 'page_moveFromLeft',
          out: 'page_moveToRight',
        },
        // from page1 to anything other than page2
        'page1_*': {
          in: 'page_moveFromTop',
          out: 'page_moveToBottom',
        },
        // from nothing selected to page1
        _page1: {
          in: 'page_moveFromBottom',
          out: 'page_moveToTop',
        },
        // fallback in case none of the rules above apply
        default: {
          in: 'page-fadeIn',
          out: 'page-fadeOut',
        },
      };
    </script>

Credits