diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b3085b8..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.pyc -*.sw? -*.sqlite3 -.DS_STORE -*.egg-info -.venv -.tox -build -dist diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 69d6cea..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include README.txt -recursive-include xstatic/pkg/angular_animate * - -global-exclude *.pyc -global-exclude *.pyo -global-exclude *.orig -global-exclude *.rej - diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..9006052 --- /dev/null +++ b/README.rst @@ -0,0 +1,7 @@ +This project is no longer maintained. + +The contents of this repository are still available in the Git source code +management system. To see the contents of this repository before it reached +its end of life, please check out the previous commit with +"git checkout HEAD^1". + diff --git a/README.txt b/README.txt deleted file mode 100644 index 9e5fc6a..0000000 --- a/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -XStatic-Angular-Animate ------------------------ - -Angular-Animate JavaScript library packaged for setuptools (easy_install) / pip. - -This package is intended to be used by **any** project that needs these files. - -It intentionally does **not** provide any extra code except some metadata -**nor** has any extra requirements. You MAY use some minimal support code from -the XStatic base package, if you like. - -You can find more info about the xstatic packaging way in the package `XStatic`. - diff --git a/setup.py b/setup.py deleted file mode 100644 index 5f4913f..0000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -from xstatic.pkg import angular_animate as xs - -# The README.txt file should be written in reST so that PyPI can use -# it to generate your project's PyPI page. -long_description = open('README.txt').read() - -from setuptools import setup, find_packages - -setup( - name=xs.PACKAGE_NAME, - version=xs.PACKAGE_VERSION, - description=xs.DESCRIPTION, - long_description=long_description, - classifiers=xs.CLASSIFIERS, - keywords=xs.KEYWORDS, - maintainer=xs.MAINTAINER, - maintainer_email=xs.MAINTAINER_EMAIL, - license=xs.LICENSE, - url=xs.HOMEPAGE, - platforms=xs.PLATFORMS, - packages=find_packages(), - namespace_packages=['xstatic', 'xstatic.pkg', ], - include_package_data=True, - zip_safe=False, - install_requires=[], # nothing! :) - # if you like, you MAY use the 'XStatic' package. -) diff --git a/xstatic/__init__.py b/xstatic/__init__.py deleted file mode 100644 index de40ea7..0000000 --- a/xstatic/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/xstatic/pkg/__init__.py b/xstatic/pkg/__init__.py deleted file mode 100644 index de40ea7..0000000 --- a/xstatic/pkg/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/xstatic/pkg/angular_animate/__init__.py b/xstatic/pkg/angular_animate/__init__.py deleted file mode 100644 index a66d9cc..0000000 --- a/xstatic/pkg/angular_animate/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -XStatic resource package - -See package 'XStatic' for documentation and basic tools. -""" - -DISPLAY_NAME = 'Angular-Animate' # official name, upper/lowercase allowed, no spaces -PACKAGE_NAME = 'XStatic-%s' % DISPLAY_NAME # name used for PyPi - -NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar') - # please use a all-lowercase valid python - # package name - -VERSION = '1.2.1' # version of the packaged files, please use the upstream - # version number -BUILD = '1' # our package build number, so we can release new builds - # with fixes for xstatic stuff. -PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi - -DESCRIPTION = "%s %s (XStatic packaging standard)" % (DISPLAY_NAME, VERSION) - -PLATFORMS = 'any' -CLASSIFIERS = [] -KEYWORDS = '%s xstatic' % NAME - -# XStatic-* package maintainer: -MAINTAINER = 'Maxime Vidori' -MAINTAINER_EMAIL = 'maxime.vidori@enovance.com' - -# this refers to the project homepage of the stuff we packaged: -HOMEPAGE = 'https://angularjs.org/' - -# this refers to all files: -LICENSE = '(same as %s)' % DISPLAY_NAME - -from os.path import join, dirname -BASE_DIR = join(dirname(__file__), 'data') -# linux package maintainers just can point to their file locations like this: -#BASE_DIR = '/usr/share/javascript/angular_cookies' - -LOCATIONS = { - # CDN locations (if no public CDN exists, use an empty dict) - # if value is a string, it is a base location, just append relative - # path/filename. if value is a dict, do another lookup using the - # relative path/filename you want. - # your relative path/filenames should usually be without version - # information, because either the base dir/url is exactly for this - # version or the mapping will care for accessing this version. -} diff --git a/xstatic/pkg/angular_animate/data/angular-animate.js b/xstatic/pkg/angular_animate/data/angular-animate.js deleted file mode 100755 index 737ac0e..0000000 --- a/xstatic/pkg/angular_animate/data/angular-animate.js +++ /dev/null @@ -1,1226 +0,0 @@ -/** - * @license AngularJS v1.2.1 - * (c) 2010-2012 Google, Inc. http://angularjs.org - * License: MIT - */ -(function(window, angular, undefined) {'use strict'; - -/* jshint maxlen: false */ - -/** - * @ngdoc overview - * @name ngAnimate - * @description - * - * # ngAnimate - * - * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives. - * - * {@installModule animate} - * - *
- * - * # Usage - * - * To see animations in action, all that is required is to define the appropriate CSS classes - * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are: - * `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation - * by using the `$animate` service. - * - * Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives: - * - * | Directive | Supported Animations | - * |---------------------------------------------------------- |----------------------------------------------------| - * | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move | - * | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave | - * | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave | - * | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave | - * | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave | - * | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove | - * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) | - * - * You can find out more information about animations upon visiting each directive page. - * - * Below is an example of how to apply animations to a directive that supports animation hooks: - * - *- * - * - * - *- * - * Keep in mind that if an animation is running, any child elements cannot be animated until the parent element's - * animation has completed. - * - *- *
- * - * - *- * - * The following code below demonstrates how to perform animations using **CSS animations** with Angular: - * - *- * - *- *
- * - * - *- * - * Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing. - * - * Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add - * the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically - * detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be - * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end - * immediately resulting in a DOM element that is at its final state. This final state is when the DOM element - * has no CSS transition/animation classes applied to it. - * - *- * - *- *
- * .my-animation.ng-enter { - * /* standard transition code */ - * -webkit-transition: 1s linear all; - * transition: 1s linear all; - * opacity:0; - * } - * .my-animation.ng-enter-stagger { - * /* this will have a 100ms delay between each successive leave animation */ - * -webkit-transition-delay: 0.1s; - * transition-delay: 0.1s; - * - * /* in case the stagger doesn't work then these two values - * must be set to 0 to avoid an accidental CSS inheritance */ - * -webkit-transition-duration: 0s; - * transition-duration: 0s; - * } - * .my-animation.ng-enter.ng-enter-active { - * /* standard transition styles */ - * opacity:1; - * } - *- * - * Staggering animations work by default in ngRepeat (so long as the CSS class is defiend). Outside of ngRepeat, to use staggering animations - * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this - * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation - * will also be reset if more than 10ms has passed after the last animation has been fired. - * - * The following code will issue the **ng-leave-stagger** event on the element provided: - * - *
- * var kids = parent.children(); - * - * $animate.leave(kids[0]); //stagger index=0 - * $animate.leave(kids[1]); //stagger index=1 - * $animate.leave(kids[2]); //stagger index=2 - * $animate.leave(kids[3]); //stagger index=3 - * $animate.leave(kids[4]); //stagger index=4 - * - * $timeout(function() { - * //stagger has reset itself - * $animate.leave(kids[5]); //stagger index=0 - * $animate.leave(kids[6]); //stagger index=1 - * }, 100, false); - *- * - * Stagger animations are currently only supported within CSS-defined animations. - * - *
- * //!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application. - * var ngModule = angular.module('YourApp', []); - * ngModule.animation('.my-crazy-animation', function() { - * return { - * enter: function(element, done) { - * //run the animation here and call done when the animation is complete - * return function(cancelled) { - * //this (optional) function will be called when the animation - * //completes or when the animation is cancelled (the cancelled - * //flag will be set to true if cancelled). - * } - * } - * leave: function(element, done) { }, - * move: function(element, done) { }, - * - * //animation that can be triggered before the class is added - * beforeAddClass: function(element, className, done) { }, - * - * //animation that can be triggered after the class is added - * addClass: function(element, className, done) { }, - * - * //animation that can be triggered before the class is removed - * beforeRemoveClass: function(element, className, done) { }, - * - * //animation that can be triggered after the class is removed - * removeClass: function(element, className, done) { } - * } - * }); - *- * - * JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run - * a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits - * the element's CSS class attribute value and then run the matching animation event function (if found). - * In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function - * be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported). - * - * Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned. - * As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run, - * and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation - * or transition code that is defined via a stylesheet). - * - */ - -angular.module('ngAnimate', ['ng']) - - /** - * @ngdoc object - * @name ngAnimate.$animateProvider - * @description - * - * The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module. - * When an animation is triggered, the $animate service will query the $animate service to find any animations that match - * the provided name value. - * - * Requires the {@link ngAnimate `ngAnimate`} module to be installed. - * - * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application. - * - */ - .config(['$provide', '$animateProvider', function($provide, $animateProvider) { - var noop = angular.noop; - var forEach = angular.forEach; - var selectors = $animateProvider.$$selectors; - - var ELEMENT_NODE = 1; - var NG_ANIMATE_STATE = '$$ngAnimateState'; - var NG_ANIMATE_CLASS_NAME = 'ng-animate'; - var rootAnimateState = {running: true}; - - $provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document', - function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) { - - $rootElement.data(NG_ANIMATE_STATE, rootAnimateState); - - // disable animations during bootstrap, but once we bootstrapped, enable animations - $rootScope.$$postDigest(function() { - rootAnimateState.running = false; - }); - - function lookup(name) { - if (name) { - var matches = [], - flagMap = {}, - classes = name.substr(1).split('.'); - - //the empty string value is the default animation - //operation which performs CSS transition and keyframe - //animations sniffing. This is always included for each - //element animation procedure if the browser supports - //transitions and/or keyframe animations - if ($sniffer.transitions || $sniffer.animations) { - classes.push(''); - } - - for(var i=0; i < classes.length; i++) { - var klass = classes[i], - selectorFactoryName = selectors[klass]; - if(selectorFactoryName && !flagMap[klass]) { - matches.push($injector.get(selectorFactoryName)); - flagMap[klass] = true; - } - } - return matches; - } - } - - /** - * @ngdoc object - * @name ngAnimate.$animate - * @function - * - * @description - * The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations. - * When any of these operations are run, the $animate service - * will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object) - * as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run. - * - * The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives - * will work out of the box without any extra configuration. - * - * Requires the {@link ngAnimate `ngAnimate`} module to be installed. - * - * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application. - * - */ - return { - /** - * @ngdoc function - * @name ngAnimate.$animate#enter - * @methodOf ngAnimate.$animate - * @function - * - * @description - * Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once - * the animation is started, the following CSS classes will be present on the element for the duration of the animation: - * - * Below is a breakdown of each step that occurs during enter animation: - * - * | Animation Step | What the element class attribute looks like | - * |----------------------------------------------------------------------------------------------|---------------------------------------------| - * | 1. $animate.enter(...) is called | class="my-animation" | - * | 2. element is inserted into the parentElement element or beside the afterElement element | class="my-animation" | - * | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | - * | 4. the .ng-enter class is added to the element | class="my-animation ng-animate ng-enter" | - * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-enter" | - * | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-enter" | - * | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" | - * | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" | - * | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | - * | 10. The doneCallback() callback is fired (if provided) | class="my-animation" | - * - * @param {jQuery/jqLite element} element the element that will be the focus of the enter animation - * @param {jQuery/jqLite element} parentElement the parent element of the element that will be the focus of the enter animation - * @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation - * @param {function()=} doneCallback the callback function that will be called once the animation is complete - */ - enter : function(element, parentElement, afterElement, doneCallback) { - this.enabled(false, element); - $delegate.enter(element, parentElement, afterElement); - $rootScope.$$postDigest(function() { - performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback); - }); - }, - - /** - * @ngdoc function - * @name ngAnimate.$animate#leave - * @methodOf ngAnimate.$animate - * @function - * - * @description - * Runs the leave animation operation and, upon completion, removes the element from the DOM. Once - * the animation is started, the following CSS classes will be added for the duration of the animation: - * - * Below is a breakdown of each step that occurs during enter animation: - * - * | Animation Step | What the element class attribute looks like | - * |----------------------------------------------------------------------------------------------|---------------------------------------------| - * | 1. $animate.leave(...) is called | class="my-animation" | - * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | - * | 3. the .ng-leave class is added to the element | class="my-animation ng-animate ng-leave" | - * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-leave" | - * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-leave" | - * | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" | - * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" | - * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | - * | 9. The element is removed from the DOM | ... | - * | 10. The doneCallback() callback is fired (if provided) | ... | - * - * @param {jQuery/jqLite element} element the element that will be the focus of the leave animation - * @param {function()=} doneCallback the callback function that will be called once the animation is complete - */ - leave : function(element, doneCallback) { - cancelChildAnimations(element); - this.enabled(false, element); - $rootScope.$$postDigest(function() { - performAnimation('leave', 'ng-leave', element, null, null, function() { - $delegate.leave(element); - }, doneCallback); - }); - }, - - /** - * @ngdoc function - * @name ngAnimate.$animate#move - * @methodOf ngAnimate.$animate - * @function - * - * @description - * Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or - * add the element directly after the afterElement element if present. Then the move animation will be run. Once - * the animation is started, the following CSS classes will be added for the duration of the animation: - * - * Below is a breakdown of each step that occurs during move animation: - * - * | Animation Step | What the element class attribute looks like | - * |----------------------------------------------------------------------------------------------|---------------------------------------------| - * | 1. $animate.move(...) is called | class="my-animation" | - * | 2. element is moved into the parentElement element or beside the afterElement element | class="my-animation" | - * | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | - * | 4. the .ng-move class is added to the element | class="my-animation ng-animate ng-move" | - * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-move" | - * | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-move" | - * | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" | - * | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" | - * | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | - * | 10. The doneCallback() callback is fired (if provided) | class="my-animation" | - * - * @param {jQuery/jqLite element} element the element that will be the focus of the move animation - * @param {jQuery/jqLite element} parentElement the parentElement element of the element that will be the focus of the move animation - * @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation - * @param {function()=} doneCallback the callback function that will be called once the animation is complete - */ - move : function(element, parentElement, afterElement, doneCallback) { - cancelChildAnimations(element); - this.enabled(false, element); - $delegate.move(element, parentElement, afterElement); - $rootScope.$$postDigest(function() { - performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback); - }); - }, - - /** - * @ngdoc function - * @name ngAnimate.$animate#addClass - * @methodOf ngAnimate.$animate - * - * @description - * Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class. - * Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide - * the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions - * or keyframes are defined on the -add or base CSS class). - * - * Below is a breakdown of each step that occurs during addClass animation: - * - * | Animation Step | What the element class attribute looks like | - * |------------------------------------------------------------------------------------------------|---------------------------------------------| - * | 1. $animate.addClass(element, 'super') is called | class="my-animation" | - * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" | - * | 3. the .super-add class are added to the element | class="my-animation ng-animate super-add" | - * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate super-add" | - * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate super-add" | - * | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super super-add super-add-active" | - * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation super-add super-add-active" | - * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation super" | - * | 9. The super class is kept on the element | class="my-animation super" | - * | 10. The doneCallback() callback is fired (if provided) | class="my-animation super" | - * - * @param {jQuery/jqLite element} element the element that will be animated - * @param {string} className the CSS class that will be added to the element and then animated - * @param {function()=} doneCallback the callback function that will be called once the animation is complete - */ - addClass : function(element, className, doneCallback) { - performAnimation('addClass', className, element, null, null, function() { - $delegate.addClass(element, className); - }, doneCallback); - }, - - /** - * @ngdoc function - * @name ngAnimate.$animate#removeClass - * @methodOf ngAnimate.$animate - * - * @description - * Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value - * from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in - * order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if - * no CSS transitions or keyframes are defined on the -remove or base CSS classes). - * - * Below is a breakdown of each step that occurs during removeClass animation: - * - * | Animation Step | What the element class attribute looks like | - * |-----------------------------------------------------------------------------------------------|---------------------------------------------| - * | 1. $animate.removeClass(element, 'super') is called | class="my-animation super" | - * | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation super ng-animate" | - * | 3. the .super-remove class are added to the element | class="my-animation super ng-animate super-remove"| - * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation super ng-animate super-remove" | - * | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation super ng-animate super-remove" | - * | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" | - * | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" | - * | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" | - * | 9. The doneCallback() callback is fired (if provided) | class="my-animation" | - * - * - * @param {jQuery/jqLite element} element the element that will be animated - * @param {string} className the CSS class that will be animated and then removed from the element - * @param {function()=} doneCallback the callback function that will be called once the animation is complete - */ - removeClass : function(element, className, doneCallback) { - performAnimation('removeClass', className, element, null, null, function() { - $delegate.removeClass(element, className); - }, doneCallback); - }, - - /** - * @ngdoc function - * @name ngAnimate.$animate#enabled - * @methodOf ngAnimate.$animate - * @function - * - * @param {boolean=} value If provided then set the animation on or off. - * @return {boolean} Current animation state. - * - * @description - * Globally enables/disables animations. - * - */ - enabled : function(value, element) { - switch(arguments.length) { - case 2: - if(value) { - cleanup(element); - } else { - var data = element.data(NG_ANIMATE_STATE) || {}; - data.disabled = true; - element.data(NG_ANIMATE_STATE, data); - } - break; - - case 1: - rootAnimateState.disabled = !value; - break; - - default: - value = !rootAnimateState.disabled; - break; - } - return !!value; - } - }; - - /* - all animations call this shared animation triggering function internally. - The animationEvent variable refers to the JavaScript animation event that will be triggered - and the className value is the name of the animation that will be applied within the - CSS code. Element, parentElement and afterElement are provided DOM elements for the animation - and the onComplete callback will be fired once the animation is fully complete. - */ - function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) { - var classes = (element.attr('class') || '') + ' ' + className; - var animationLookup = (' ' + classes).replace(/\s+/g,'.'); - if (!parentElement) { - parentElement = afterElement ? afterElement.parent() : element.parent(); - } - - var matches = lookup(animationLookup); - var isClassBased = animationEvent == 'addClass' || animationEvent == 'removeClass'; - var ngAnimateState = element.data(NG_ANIMATE_STATE) || {}; - - //skip the animation if animations are disabled, a parent is already being animated, - //the element is not currently attached to the document body or then completely close - //the animation if any matching animations are not found at all. - //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found. - if (animationsDisabled(element, parentElement) || matches.length === 0) { - domOperation(); - closeAnimation(); - return; - } - - var animations = []; - //only add animations if the currently running animation is not structural - //or if there is no animation running at all - if(!ngAnimateState.running || !(isClassBased && ngAnimateState.structural)) { - forEach(matches, function(animation) { - //add the animation to the queue to if it is allowed to be cancelled - if(!animation.allowCancel || animation.allowCancel(element, animationEvent, className)) { - var beforeFn, afterFn = animation[animationEvent]; - - //Special case for a leave animation since there is no point in performing an - //animation on a element node that has already been removed from the DOM - if(animationEvent == 'leave') { - beforeFn = afterFn; - afterFn = null; //this must be falsy so that the animation is skipped for leave - } else { - beforeFn = animation['before' + animationEvent.charAt(0).toUpperCase() + animationEvent.substr(1)]; - } - animations.push({ - before : beforeFn, - after : afterFn - }); - } - }); - } - - //this would mean that an animation was not allowed so let the existing - //animation do it's thing and close this one early - if(animations.length === 0) { - domOperation(); - fireDoneCallbackAsync(); - return; - } - - if(ngAnimateState.running) { - //if an animation is currently running on the element then lets take the steps - //to cancel that animation and fire any required callbacks - $timeout.cancel(ngAnimateState.closeAnimationTimeout); - cleanup(element); - cancelAnimations(ngAnimateState.animations); - (ngAnimateState.done || noop)(true); - } - - //There is no point in perform a class-based animation if the element already contains - //(on addClass) or doesn't contain (on removeClass) the className being animated. - //The reason why this is being called after the previous animations are cancelled - //is so that the CSS classes present on the element can be properly examined. - if((animationEvent == 'addClass' && element.hasClass(className)) || - (animationEvent == 'removeClass' && !element.hasClass(className))) { - domOperation(); - fireDoneCallbackAsync(); - return; - } - - //the ng-animate class does nothing, but it's here to allow for - //parent animations to find and cancel child animations when needed - element.addClass(NG_ANIMATE_CLASS_NAME); - - element.data(NG_ANIMATE_STATE, { - running:true, - structural:!isClassBased, - animations:animations, - done:onBeforeAnimationsComplete - }); - - //first we run the before animations and when all of those are complete - //then we perform the DOM operation and run the next set of animations - invokeRegisteredAnimationFns(animations, 'before', onBeforeAnimationsComplete); - - function onBeforeAnimationsComplete(cancelled) { - domOperation(); - if(cancelled === true) { - closeAnimation(); - return; - } - - //set the done function to the final done function - //so that the DOM event won't be executed twice by accident - //if the after animation is cancelled as well - var data = element.data(NG_ANIMATE_STATE); - if(data) { - data.done = closeAnimation; - element.data(NG_ANIMATE_STATE, data); - } - invokeRegisteredAnimationFns(animations, 'after', closeAnimation); - } - - function invokeRegisteredAnimationFns(animations, phase, allAnimationFnsComplete) { - var endFnName = phase + 'End'; - forEach(animations, function(animation, index) { - var animationPhaseCompleted = function() { - progress(index, phase); - }; - - //there are no before functions for enter + move since the DOM - //operations happen before the performAnimation method fires - if(phase == 'before' && (animationEvent == 'enter' || animationEvent == 'move')) { - animationPhaseCompleted(); - return; - } - - if(animation[phase]) { - animation[endFnName] = isClassBased ? - animation[phase](element, className, animationPhaseCompleted) : - animation[phase](element, animationPhaseCompleted); - } else { - animationPhaseCompleted(); - } - }); - - function progress(index, phase) { - var phaseCompletionFlag = phase + 'Complete'; - var currentAnimation = animations[index]; - currentAnimation[phaseCompletionFlag] = true; - (currentAnimation[endFnName] || noop)(); - - for(var i=0;i