Permalink
Browse files

chore(release): 0.0.5

  • Loading branch information...
1 parent b207522 commit 574e34bf96a945b0723ef2ec973488cef137dea2 @rosslavery committed Jul 4, 2014
Showing with 182 additions and 150 deletions.
  1. +2 −1 .gitignore
  2. +24 −0 .jshintrc
  3. +28 −0 Gruntfile.js
  4. +10 −6 bower.json
  5. +32 −0 package.json
  6. +84 −143 rl-velocity.js
  7. +2 −0 rl-velocity.min.js
View
@@ -1 +1,2 @@
-bower_components
+bower_components
+node_modules
View
@@ -0,0 +1,24 @@
+{
+ "node": true,
+ "browser": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 2,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "smarttabs": true,
+ "globals": {
+ "angular": false
+ }
+}
View
@@ -0,0 +1,28 @@
+module.exports = function(grunt) {
+
+ require('load-grunt-tasks')(grunt);
+
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ jshint: {
+ options: {
+ jshintrc: true
+ },
+ build: ['rl-velocity.js']
+ },
+ uglify: {
+ options: {
+ mangle: true,
+ banner: '/*! <%= pkg.name %> - <%= pkg.author %> - <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
+ },
+ build: {
+ src: 'rl-velocity.js',
+ dest: 'rl-velocity.min.js'
+ }
+ }
+ });
+
+ grunt.registerTask('build', ['jshint:build', 'uglify:build']);
+ grunt.registerTask('default', ['build']);
+
+};
View
@@ -1,13 +1,17 @@
{
"name": "rl-velocity",
- "version": "0.0.3",
- "authors": [
- "Ross Lavery <rosslavery@gmail.com>"
- ],
+ "version": "0.0.5",
+ "author": "Ross Lavery <rosslavery@gmail.com>",
"description": "Velocity integration for AngularJS",
"main": "rl-velocity.js",
"keywords": [
- "AngularJS"
+ "AngularJS",
+ "angular",
+ "Velocity"
+ "animation",
+ "animate",
+ "velocityjs",
+ "velocity"
],
"license": "MIT",
"ignore": [
@@ -20,6 +24,6 @@
"dependencies": {
"angular-animate": "~1.2.15",
"angular": "~1.2.15",
- "velocity": "~0.2.1"
+ "velocity": "~0.4.1"
}
}
View
@@ -0,0 +1,32 @@
+{
+ "name": "rl-velocity",
+ "version": "0.0.5",
+ "description": "Velocity integration for AngularJS",
+ "main": "rl-velocity.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/rosslavery/rl-velocity.git"
+ },
+ "keywords": [
+ "AngularJS",
+ "angular",
+ "Velocity",
+ "animation",
+ "animate",
+ "velocityjs",
+ "velocity"
+ ],
+ "author": "Ross Lavery <rosslavery@gmail.com>",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/rosslavery/rl-velocity/issues"
+ },
+ "homepage": "https://github.com/rosslavery/rl-velocity",
+ "devDependencies": {
+ "grunt": "~0.4.5",
+ "grunt-contrib-jshint": "~0.10.0",
+ "grunt-contrib-uglify": "~0.5.0",
+ "load-grunt-tasks": "~0.6.0",
+ "grunt-shell": "~0.7.0"
+ }
+}
View
@@ -1,171 +1,112 @@
-(function() {
-
- var rlVelocity = angular.module('rl-velocity', []);
-
- var defaultOptions = {
- duration: 250,
- easing: 'easeInOutQuad'
- };
-
- var animationsList = [
- 'fadeIn',
- 'fadeOut',
- 'callout.bounce',
- 'callout.shake',
- 'callout.flash',
- 'callout.pulse',
- 'callout.swing',
- 'callout.tada',
- 'transition.flipXIn',
- 'transition.flipXOut',
- 'transition.flipYIn',
- 'transition.flipYOut',
- 'transition.flipBounceXIn',
- 'transition.flipBounceXOut',
- 'transition.flipBounceYIn',
- 'transition.flipBounceYOut',
- 'transition.swoopIn',
- 'transition.swoopOut',
- 'transition.whirlIn',
- 'transition.whirlOut',
- 'transition.shrinkIn',
- 'transition.shrinkOut',
- 'transition.expandIn',
- 'transition.expandOut',
- 'transition.bounceIn',
- 'transition.bounceOut',
- 'transition.bounceUpIn',
- 'transition.bounceUpOut',
- 'transition.bounceDownIn',
- 'transition.bounceDownOut',
- 'transition.bounceLeftIn',
- 'transition.bounceLeftOut',
- 'transition.bounceRightIn',
- 'transition.bounceRightOut',
- 'transition.slideUpIn',
- 'transition.slideUpOut',
- 'transition.slideDownIn',
- 'transition.slideDownOut',
- 'transition.slideLeftIn',
- 'transition.slideLeftOut',
- 'transition.slideRightIn',
- 'transition.slideRightOut',
- 'transition.slideUpBigIn',
- 'transition.slideUpBigOut',
- 'transition.slideDownBigIn',
- 'transition.slideDownBigOut',
- 'transition.slideLeftBigIn',
- 'transition.slideLeftBigOut',
- 'transition.slideRightBigIn',
- 'transition.slideRightBigOut',
- 'transition.perspectiveUpIn',
- 'transition.perspectiveUpOut',
- 'transition.perspectiveDownIn',
- 'transition.perspectiveDownOut',
- 'transition.perspectiveLeftIn',
- 'transition.perspectiveLeftOut',
- 'transition.perspectiveRightIn',
- 'transition.perspectiveRightOut'
- ];
+(function(angular) {
+ 'use strict';
- function _getClassName(animation) {
- return '.velocity-' + animation.replace('.', '-');
+ var Container = (window.jQuery || window.Zepto || window);
+ if (!Container.Velocity || !Container.Velocity.Utilities) {
+ console.log('Velocity UI Pack: Velocity must be loaded first. Aborting.');
+ return;
}
- function _parseClassList(classList) {
- var parsedOptions = {};
+ Container.rlVelocity = angular.module('rl.velocity', ['ngAnimate'])
- angular.forEach(classList, function(currClass) {
- if (currClass.indexOf('velocity-easing-') > -1) {
- parsedOptions.easing = currClass.split('velocity-easing-')[1];
- }
+ .constant('rlVelocityConfig', {
+ duration: 300
+ })
- if (currClass.indexOf('velocity-duration-') > -1) {
- parsedOptions.duration = currClass.split('velocity-duration-')[1];
- }
+ .factory('VelocityUtils', ['$timeout', 'rlVelocityConfig', function($timeout, rlVelocityConfig) {
- });
+ return {
- return parsedOptions;
+ _parseClassList: function(classList) {
+ var parsedOptions = {};
- }
-
- function _createVelocityAnimation(animation) {
- return function($el, done) {
+ angular.forEach(classList, function(currClass) {
+ if (currClass.indexOf('velocity-duration-') > -1) {
+ parsedOptions.duration = currClass.split('velocity-duration-')[1];
+ }
+ });
- var parsedOptions = _parseClassList($el[0].classList);
- var options = angular.extend(defaultOptions, parsedOptions);
- options.display = $el.css('display');
- options.complete = done;
+ return parsedOptions;
+ },
- $el.velocity(animation, options);
+ _createAngularAnimation: function(animation) {
+ var self = this;
+ var opp = animation.replace('In', 'Out');
- return function(cancel) {
- if (cancel) {
- $el.velocity('stop');
+ if (opp.indexOf('Down') > -1) {
+ opp = opp.replace('Down', 'Up');
+ }
+ else if (opp.indexOf('Up') > -1) {
+ opp = opp.replace('Up', 'Down');
}
- }
- }
- }
- function _createVelocityClassAnimation(animation) {
- return function ($el, className, done) {
+ return {
+ enter: self._createVelocityAnimation(animation),
+ leave: self._createVelocityAnimation(opp),
+ move: self._createVelocityAnimation(animation),
+ beforeAddClass: self._createVelocityClassAnimation(opp),
+ removeClass: self._createVelocityClassAnimation(animation)
+ };
+ },
- var parsedOptions = _parseClassList($el[0].classList);
- var options = angular.extend(defaultOptions, parsedOptions);
- options.display = $el.css('display');
- options.complete = done;
+ _createVelocityAnimation: function(animation) {
+ var self = this;
+
+ return function($el, done) {
+ var parsedOptions = self._parseClassList($el[0].classList);
+ var options = angular.extend(rlVelocityConfig, parsedOptions);
+
+ $el.velocity(animation, options);
+ $timeout(done, options.duration);
+ };
+ },
- if ('ng-hide' === className || 'ng-show' === className) {
- $el.velocity(animation, options);
+ _createVelocityClassAnimation: function(animation) {
+ var self = this;
- return function (cancel) {
- if (cancel) {
- $el.velocity('stop');
+ return function ($el, className, done) {
+ var parsedOptions = self._parseClassList($el[0].classList);
+ var options = angular.extend(rlVelocityConfig, parsedOptions);
+
+ if (className === 'ng-hide') {
+ $el.velocity(animation, options);
+ $timeout(done, options.duration);
+ }
+ else {
+ done();
}
};
}
- };
- }
- function _createAngularAnimation(animation) {
-
- var opp = animation.replace('In', 'Out');
-
- if (opp.indexOf('Down') > -1) {
- opp = opp.replace('Down', 'Up');
- }
- else if (opp.indexOf('Up') > -1) {
- opp = opp.replace('Up', 'Down');
- }
- else if (opp.indexOf('Left') > -1) {
- opp = opp.replace('Left', 'Right');
- }
- else if (opp.indexOf('Right') > -1) {
- opp = opp.replace('Right', 'Left');
- }
-
- return function() {
- return {
- enter: _createVelocityAnimation(animation),
- leave: _createVelocityAnimation(opp),
- move: _createVelocityAnimation(animation),
- addClass: _createVelocityClassAnimation(animation),
- removeClass: _createVelocityClassAnimation(opp)
- }
};
+
+ }]);
+
+
+ // Convert animation name to class name
+ function _getClassName(animation) {
+ return '.velocity-' + animation.replace('.', '-');
}
- /*
- Build the animations
- */
- var className, oppositeClassName;
- angular.forEach(animationsList, function(animation) {
- className = _getClassName(animation);
+ // Iterate through the packaged effects to register them as Angular animations
+ var className;
+ angular.forEach(Container.Velocity.RegisterUI.packagedEffects, function(animationProps, animationName) {
- rlVelocity.animation(className, _createAngularAnimation(animation));
+ /*
+ Disabled to experiment with $timeout method used above
+ Skips 'Reset' Codeblock in Velocity to avoid callback scoping issue
+ animationProps.reset && delete animationProps.reset;
+ Container.Velocity.RegisterUI(animationName, animationProps);
+ */
+
+ className = _getClassName(animationName);
+
+ Container.rlVelocity.animation(className, ['VelocityUtils', function(VelocityUtils) {
+ return VelocityUtils._createAngularAnimation(animationName);
+ }]);
});
-})();
+
+})(angular);
View
@@ -0,0 +1,2 @@
+/*! rl-velocity - Ross Lavery <rosslavery@gmail.com> - 0.0.5 2014-07-04 */
+!function(a){"use strict";function b(a){return".velocity-"+a.replace(".","-")}var c=window.jQuery||window.Zepto||window;if(!c.Velocity||!c.Velocity.Utilities)return void console.log("Velocity UI Pack: Velocity must be loaded first. Aborting.");c.rlVelocity=a.module("rl.velocity",["ngAnimate"]).constant("rlVelocityConfig",{duration:300}).factory("VelocityUtils",["$timeout","rlVelocityConfig",function(b,c){return{_parseClassList:function(b){var c={};return a.forEach(b,function(a){a.indexOf("velocity-duration-")>-1&&(c.duration=a.split("velocity-duration-")[1])}),c},_createAngularAnimation:function(a){var b=this,c=a.replace("In","Out");return c.indexOf("Down")>-1?c=c.replace("Down","Up"):c.indexOf("Up")>-1&&(c=c.replace("Up","Down")),{enter:b._createVelocityAnimation(a),leave:b._createVelocityAnimation(c),move:b._createVelocityAnimation(a),beforeAddClass:b._createVelocityClassAnimation(c),removeClass:b._createVelocityClassAnimation(a)}},_createVelocityAnimation:function(d){var e=this;return function(f,g){var h=e._parseClassList(f[0].classList),i=a.extend(c,h);f.velocity(d,i),b(g,i.duration)}},_createVelocityClassAnimation:function(d){var e=this;return function(f,g,h){var i=e._parseClassList(f[0].classList),j=a.extend(c,i);"ng-hide"===g?(f.velocity(d,j),b(h,j.duration)):h()}}}}]);var d;a.forEach(c.Velocity.RegisterUI.packagedEffects,function(a,e){d=b(e),c.rlVelocity.animation(d,["VelocityUtils",function(a){return a._createAngularAnimation(e)}])})}(angular);

0 comments on commit 574e34b

Please sign in to comment.