• Stars
    star
    99
  • Rank 343,315 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ember implementation of CSS Transitions. Just like ng-animate and react animation but for Ember :)

Ember CSS Transitions Build Status Ember Observer Score

This addon provides a nice way of defining CSS Transitions for Ember Components. Which means, only css based animations for performance - and no animation library needed.

Ember CSS Transitions is heavily inspired (and CSS compatible) with Vue's CSS Transitions.

Animations are completely based on CSS classes.

Documentation

How it works

Ultimately you define your animations and transitions with only css like:

/* initial state */
.example-enter,
.example-leave-to {
  opacity: 0;
}

/* final state */
.example-enter-to,
.example-leave {
  opacity: 1;
}

/* easings */
.example-enter-active,
.example-leave-active {
  transition: opacity 0.5s ease-in;
}

And using the included modifier like:

<div {{css-transition "example"}}>
  <h1>Hello world</h1>
</div>

or by manually specifying classes, perfect for libraries like Animate.css and Tailwind CSS.

{{!-- Using Tailwind CSS provided classes --}}
<div {{css-transition
  enterClass="opacity-0"
  enterActiveClass="transition-opacity duration-500 ease-in-out"
  enterToClass="opacity-100"
  leaveClass="opacity-100"
  leaveActiveClass="transition-opacity duration-500 ease-in-out"
  leaveToClass="opacity-0"}}>
  <h1>Hello world</h1>
</div>

If you are using TailwindUI then you will see transition instructions included in the code, as in this example:

<!--
  Slide-over panel, show/hide based on slide-over state.

  Entering: "transform transition ease-in-out duration-500 sm:duration-700"
    From: "translate-x-full"
    To: "translate-x-0"
  Leaving: "transform transition ease-in-out duration-500 sm:duration-700"
    From: "translate-x-0"
    To: "translate-x-full"
-->

You should map these instructions to this addon's API in the following way:

TailwindUI Addon
Entering enterActiveClass
From enterClass
To enterToClass
Leaving leaveActiveClass
From leaveClass
To leaveToClass

Check out the homepage for more detailed documentation: https://miguelcobain.github.io/ember-css-transitions/

Install

Run:

ember install ember-css-transitions

Note Using ember-cli-autoprefixer is suggested for CSS transitions:

ember install ember-cli-autoprefixer

Tested in the following browsers / platforms:

  • IE 10
  • IE 11
  • Microsoft Edge
  • Chrome
  • Firefox
  • Safari
  • Android
  • iPhone

Note: IE9 does not support CSS3 transitions / animations. They must live with no animations / transitions.

Glint usage

css-transition ships Glint types, which allow you when using TypeScript to get strict type checking in your templates.

Unless you are using strict mode templates (via first class component templates), Glint needs a Template Registry that contains entries for the element modifier provided by this addon. To add these registry entries automatically to your app, you just need to import ember-css-transitions/template-registry from somewhere in your app. When using Glint already, you will likely have a file like types/glint.d.ts where you already import glint types, so just add the import there:

import '@glint/environment-ember-loose';

import type CssTransitionsRegistry from 'ember-css-transitions/template-registry';

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry extends CssTransitionsRegistry, /* other addon registries */ {
    // local entries
  }
}

Usage with <template> tag

For usage in gts or gjs files, modifier is exported from the index:

import { cssTransition } from 'ember-css-transitions';

<template>
  <div
    {{cssTransition
      enterClass="opacity-0"
      enterActiveClass="transition-opacity duration-500 ease-in-out"
      enterToClass="opacity-100"
      leaveClass="opacity-100"
      leaveActiveClass="transition-opacity duration-500 ease-in-out"
      leaveToClass="opacity-0"
    }}
  >
    <h1>Hello world</h1>
  </div>
</template>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

More Repositories

1

ember-paper

The Ember approach to Material Design.
JavaScript
885
star
2

ember-leaflet

πŸ”₯ πŸƒ Easy and declarative mapping for ember
JavaScript
209
star
3

ember-cli-selectize

An Ember and Selectize integration, packaged as an Ember-cli addon.
JavaScript
153
star
4

hapi-boilerplate

A Hapi boilerplate with Sequelize, Sequelize-CLI and node-config
JavaScript
74
star
5

ember-yeti-table

Yeti Table
JavaScript
61
star
6

ember-selectize

An Ember and Selectize integration.
JavaScript
47
star
7

ember-composability-tools

ember-composability-tools - Helpers for building a somewhat different kind of components.
JavaScript
39
star
8

ember-fullscreen

Fullscreen API packaged as an Ember service.
JavaScript
26
star
9

ember-paper-expansion-panel

Material expansion panels for ember-paper.
JavaScript
23
star
10

ember-dynamic-render-template

Render DOM from a template string.
JavaScript
14
star
11

ember-leaflet-2

Project moved to https://github.com/gabesmed/ember-leaflet
JavaScript
12
star
12

ember-data-cascade-delete

Cascade delete your relationships
JavaScript
8
star
13

ember-clerk

Integrates Clerk with Ember.js applications
JavaScript
7
star
14

ember-leaflet-google-tile-layer

Google's tile layers for ember-leaflet
JavaScript
6
star
15

ember-cli-element-closest-polyfill

Includes a polyfill for closest if needed
JavaScript
4
star
16

ember-empathy

Because every talk should end with an "ember install" slide.
JavaScript
4
star
17

ember-select

Advanced EmberJS select component
JavaScript
3
star
18

ember-fractals

An experiment -> Fractals in Ember.
JavaScript
3
star
19

solar-system-poc

JavaScript
3
star
20

ColabOT-Server

Web-Based Real-Time Collaborative Editor
Java
2
star
21

ember-sticky

Stick your divs
HTML
2
star
22

ember-cli-promises-polyfill

Includes a polyfill for promises if needed
JavaScript
2
star
23

pulsing-colors

JavaScript
1
star
24

IPapp

Instant Places application generator
JavaScript
1
star
25

ember-cli-matchmedia-polyfill

Includes a polyfill for matchMedia if needed
JavaScript
1
star
26

ColabOT-Client

Client
JavaScript
1
star
27

IP.API

Instant Places API Javascript Client
JavaScript
1
star
28

ember-cli-polyfill-importer

A general purpose polyfill/script importer for ember-cli
JavaScript
1
star
29

IP.UI

UI Components for Public Display Web Applications
JavaScript
1
star
30

ember-leaflet-rotated-marker

Extends marker layers to support rotation
JavaScript
1
star
31

jalphabet

The Java Alphabet Library (JAL) - Custom alphabet manipulation library
Java
1
star
32

ember-canvas

JavaScript
1
star