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

ember-gen-helpers

v0.1.1

Published

ember hbs template helpers for managing css transition classes and generators in hbs

Downloads

3

Readme

Build Status

ember-gen-helpers

Ember template helpers for manipulating generators in particular for handling css-based transitions

Philosophy

As an front-end developer, you should strive to do as much as you can with as low-powered tools as possible.

Nowhere is this maxim more true than in the construction of spiffy looking animations and transitions; as much as possible, we should use css instead of javascript to construct beautiful UI

Usage

This library exposes two helpers:

gen-anime

Suppose you want to move some stars around when a user clicks a button on your index page:

Your index.hbs might look like this:

<div class='index-page'>
  <div class='index-page__anime-square'>
    <img src='/assets/images/star.png' class='index-page__anime-image'>
  </div>
  <button>animate!</button>
</div>

We'd like to fly and rotate the stars from &--x1-y0 to &--x1-y1 to &--x0-y1 and none of the anime classes when the user clicks the animate button as according to the below scss file:

.index-page {
  &__anime-square {
    width: 50px;
    height: 50px;
    transition-property: transform;
    transition-duration: 500ms;
    transition-timing-function: ease-in-out;

    &--x1-y0 {
      transform: translateX(100px) rotate(15deg) translateY(0);
    }
    &--x1-y1 {
      transform: translateX(100px) rotate(30deg) translateY(100px);
    }
    &--x0-y1 {
      transform: translateX(0) rotate(45deg) translateY(100px);
    }

  }
  &__anime-image {
    width: 100%;
    height: auto;
  }
}

In traditional ember, you might use an observer, wrap in a component, or some other rather obtrusive strategy:

<div class='index-page'>
  {{#animate-stars isAnimating=isAnimating onDone=(action 'doSomething') as |animatingClass|}}
    <div class='index-page__anime-square {{animatingClass}}'>
      <img src='/assets/images/star.png' class='index-page__anime-image'>
    </div>
  {{/animate-stars}}
  <button {{action (mut isAnimating) true}}>animate!</button>
</div>
Ember.Component.extend({
  didInsertElement() {
    this.$('index-page__anime-square').one('transitionend', () => this.goToNextTransitionClass())
  }
});

With the {{gen-anime}} helper, we can skip the ember component creation step:

<div class='index-page'>
  <div class='index-page__anime-square 
    {{gen-anime 
      isAnimating
      'anime-square--x1-y0'
      'anime-square--x1-y1'
      'anime-square--x0-y1'
      'anime-square--x0-y0' 
      onDone=(action (mut isAnimating) false)}}'>
    <img src='/assets/images/star.png' class='index-page__anime-image'>
  </div>
  <button {{action (mut isAnimating) true}}>animate!</button>
</div>

This has the benefit of making the animation process entirely css and hbs (no javascript) and has the additional benefit of being more declarative

See it working here: https://foxnewsnetwork.github.io/ember-gen-helpers

gen-wrap

TODO

Installation

  • git clone <repository-url> this repository
  • cd ember-anime-helper
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.