diff --git a/packages/velocity/bower.json b/packages/velocity/bower.json index ae139402..02cbcb95 100644 --- a/packages/velocity/bower.json +++ b/packages/velocity/bower.json @@ -1,6 +1,6 @@ { "name": "velocity", - "version": "0.11.2", + "version": "0.11.3", "homepage": "http://velocityjs.org", "authors": [ { "name" : "Julian Shapiro", diff --git a/packages/velocity/component.json b/packages/velocity/component.json index 59e9680a..b3d6ffcd 100644 --- a/packages/velocity/component.json +++ b/packages/velocity/component.json @@ -1,7 +1,7 @@ { "name": "velocity", "repository": "julianshapiro/velocity", - "version": "0.11.2", + "version": "0.11.3", "description": "Accelerated JavaScript animation.", "keywords": [ "animation", diff --git a/packages/velocity/jquery.velocity.js b/packages/velocity/jquery.velocity.js index c95d342f..b58a5486 100644 --- a/packages/velocity/jquery.velocity.js +++ b/packages/velocity/jquery.velocity.js @@ -4,19 +4,18 @@ /*! * Velocity.js: Accelerated JavaScript animation. -* @version 0.11.2 +* @version 0.11.3 * @docs http://VelocityJS.org * @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /**************** - Overview + Structure ****************/ /* -Velocity's structure: -- CSS Stack: Works independently from the rest of Velocity. -- Velocity.animate(): Core method that iterates over the targeted elements and queues the incoming call onto each element individually. Consists of: +- CSS: CSS stack that works independently from the rest of Velocity. +- animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). @@ -30,16 +29,16 @@ Velocity's structure: ******************/ ;(function (factory) { + /* CommonJS module. */ + if (typeof module === "object" && typeof module.exports === "object") { + module.exports = factory(window.Velocity ? undefined : require("jquery")); /* AMD module. */ - if (typeof define === "function" && define.amd) { + } else if (typeof define === "function" && define.amd) { if (window.Velocity) { - define(factory); + define("velocity", factory); } else { - define(["jquery"], factory) + define("velocity", [ "jquery" ], factory) } - /* CommonJS module. */ - } else if (typeof exports === "object") { - factory(window.Velocity ? undefined : require("jquery")); /* Browser globals. */ } else { factory(window.jQuery); @@ -166,13 +165,14 @@ return function (global, window, document, undefined) { *****************/ /* Local to our Velocity scope, assign $ to jQuery or the jQuery shim. (The shim is a port of the jQuery utility functions that Velocity uses.) */ - var $; + var $; + /* The argument passed in by the module loader can either be jQuery (if it was required) or a helper function provided by the module loader (in the case that Velocity's jQuery shim is being used). We check for jQuery by sniffing its unique .fn property. */ - if (jQuery && jQuery.fn !== undefined) { $ = jQuery; } else if (window.Velocity && window.Velocity.Utilities) { + $ = window.Velocity.Utilities; } @@ -288,7 +288,7 @@ return function (global, window, document, undefined) { }); }, /* Velocity's core animation method, later aliased to $.fn if a framework (jQuery or Zepto) is detected. */ - animate: function () { /* Defined below. */ }, + animate: null, /* Defined below. */ /* A reimplementation of jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ hook: function (elements, arg2, arg3) { var value = undefined; @@ -327,7 +327,7 @@ return function (global, window, document, undefined) { }, /* Set to true to force a duration of 1ms for all animations so that UI testing can be performed without waiting on animations to complete. */ mock: false, - version: { major: 0, minor: 11, patch: 2 }, + version: { major: 0, minor: 11, patch: 3 }, /* Set to 1 or 2 (most verbose) to output debug info to console. */ debug: false }; @@ -1555,11 +1555,11 @@ return function (global, window, document, undefined) { CSS.Hooks.register(); CSS.Normalizations.register(); - /********************** - Velocity.animate - **********************/ + /***************** + Animation + *****************/ - Velocity.animate = function() { + var animate = function() { /****************** Call Chain @@ -1587,7 +1587,7 @@ return function (global, window, document, undefined) { var syntacticSugar = (arguments[0] && (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties))), /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ isUtility, - /* When Velocity is called via the utility function ($.Velocity.animate()/Velocity.animate()), elements are explicitly + /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ elementsWrapped, argumentIndex; @@ -2806,7 +2806,7 @@ return function (global, window, document, undefined) { reverseOptions.complete = opts.complete; } - Velocity.animate(elements, "reverse", reverseOptions); + Velocity(elements, "reverse", reverseOptions); } } @@ -2818,6 +2818,11 @@ return function (global, window, document, undefined) { return getChain(); }; + /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ + Velocity = $.extend(animate, Velocity); + /* For legacy support, also expose the literal animate method. */ + Velocity.animate = animate; + /************** Timing **************/ @@ -3062,8 +3067,7 @@ return function (global, window, document, undefined) { /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ if (Velocity.State.isTicking) { - /* If mock is on (http://VelocityJS.org/#mock), use synchronous code (with mock's forced duration of 0) to immediately toggle end values. */ - Velocity.mock ? tick(true) : ticker(tick); + ticker(tick); } } @@ -3094,7 +3098,7 @@ return function (global, window, document, undefined) { var element = call[i].element; /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ - /* Note: display:none isn't set when calls are manually stopped (via Velocity.animate("stop"). */ + /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ if (!isStopped && !opts.loop) { if (opts.display === "none") { @@ -3151,7 +3155,7 @@ return function (global, window, document, undefined) { *********************/ /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */ - /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity.animate("stop"). */ + /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) { /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ try { @@ -3177,7 +3181,7 @@ return function (global, window, document, undefined) { ****************************/ if (opts.loop === true && !isStopped) { - Velocity.animate(element, "reverse", { loop: true, delay: opts.delay }); + Velocity(element, "reverse", { loop: true, delay: opts.delay }); } /*************** @@ -3228,7 +3232,7 @@ return function (global, window, document, undefined) { If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. */ var framework; - if (jQuery && jQuery.fn) { + if (jQuery && jQuery.fn !== undefined) { framework = jQuery; } else if (window.Zepto) { framework = window.Zepto; @@ -3241,7 +3245,7 @@ return function (global, window, document, undefined) { if (framework) { /* Assign the element function to Velocity's core animate() method. */ - framework.fn.velocity = Velocity.animate; + framework.fn.velocity = animate; /* Assign the object function's defaults to Velocity's global defaults object. */ framework.fn.velocity.defaults = Velocity.defaults; } @@ -3379,7 +3383,7 @@ return function (global, window, document, undefined) { }; /* Animation triggering. */ - Velocity.animate(element, originalValues, opts); + Velocity(element, originalValues, opts); }; }); @@ -3413,7 +3417,7 @@ return function (global, window, document, undefined) { opts.display = opts.display || ((direction === "In") ? "auto" : "none"); } - Velocity.animate(this, propertiesMap, opts); + Velocity(this, propertiesMap, opts); }; }); diff --git a/packages/velocity/package.json b/packages/velocity/package.json index 846404b3..23c3585b 100644 --- a/packages/velocity/package.json +++ b/packages/velocity/package.json @@ -1,6 +1,6 @@ { "name": "velocity-animate", - "version": "0.11.2", + "version": "0.11.3", "description": "Accelerated JavaScript animation.", "keywords": [ "velocity", diff --git a/packages/velocity/velocity.ui.js b/packages/velocity/velocity.ui.js index a5214a09..085eed27 100644 --- a/packages/velocity/velocity.ui.js +++ b/packages/velocity/velocity.ui.js @@ -4,9 +4,9 @@ /*! * velocity.ui.js: UI effects pack for Velocity. Load this file after jquery.velocity.js. -* @version 4.1.0 +* @version 4.1.1 * @docs http://velocityjs.org/#uiPack -* @support <=IE8: Callouts will have no effect, and transitions will simply fade in/out. IE9/Android 2.3: Most effects are fully supported, the rest fade in/out. All other browsers: Full support. +* @support <=IE8: Callouts will have no effect, and transitions will simply fade in/out. IE9/Android 2.3: Most effects are fully supported, the rest fade in/out. All other browsers: full support. * @license Copyright Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License * @license Indicated portions adapted from Animate.css, copyright Daniel Eden. MIT License: http://en.wikipedia.org/wiki/MIT_License * @license Indicated portions adapted from Magic.css, copyright Christian Pucci. MIT License: http://en.wikipedia.org/wiki/MIT_License @@ -21,7 +21,7 @@ var Container = (window.jQuery || window.Zepto || window); if (!Container.Velocity || !Container.Velocity.Utilities) { - console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."); + window.console && console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."); return; } @@ -34,7 +34,7 @@ } /****************** - Registration + Register UI ******************/ Container.Velocity.RegisterUI = function (effectName, properties) { @@ -83,6 +83,7 @@ opts.queue = sequenceOptions.queue || ""; opts.easing = callOptions.easing || "ease"; opts.delay = callOptions.delay || 0; + opts._cacheValues = callOptions._cacheValues || true; /* Special processing for the first effect call. */ if (callIndex === 0) {