From af5f63c6a393ee97b01fbbbaf6508204e9742edf Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 27 Apr 2016 07:39:39 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20add=20stagger=20option;=20?= =?UTF-8?q?=F0=9F=91=B7=20build=20v4.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + ⬆️ Outlayer v2.1.0 for stagger option + 📦 ^ dependencies + 📝 README.mdown -> .md + 🛠 Fix vendor CSS properties. Fixes #834 + 🍹 Fix gulp version task --- README.mdown => README.md | 4 +- bower.json | 4 +- dist/masonry.pkgd.js | 119 ++++++++++++++++++++++++++------------ dist/masonry.pkgd.min.js | 4 +- gulpfile.js | 4 +- masonry.js | 2 +- package.json | 6 +- 7 files changed, 96 insertions(+), 47 deletions(-) rename README.mdown => README.md (92%) diff --git a/README.mdown b/README.md similarity index 92% rename from README.mdown rename to README.md index 23e73798..e6890d37 100644 --- a/README.mdown +++ b/README.md @@ -18,9 +18,9 @@ See [masonry.desandro.com](http://masonry.desandro.com) for complete docs and de Link directly to Masonry files on [npmcdn](https://npmcdn.com/). ``` html - + - + ``` ### Package managers diff --git a/bower.json b/bower.json index f7f4fa1f..8dca00f8 100644 --- a/bower.json +++ b/bower.json @@ -3,8 +3,8 @@ "description": "Cascading grid layout library", "main": "masonry.js", "dependencies": { - "get-size": "~2.0.2", - "outlayer": "~2.0.0" + "get-size": "^2.0.2", + "outlayer": "^2.1.0" }, "devDependencies": { "jquery-bridget": "~2.0.0", diff --git a/dist/masonry.pkgd.js b/dist/masonry.pkgd.js index dc67d694..e5774a30 100644 --- a/dist/masonry.pkgd.js +++ b/dist/masonry.pkgd.js @@ -1,5 +1,5 @@ /*! - * Masonry PACKAGED v4.0.0 + * Masonry PACKAGED v4.1.0 * Cascading grid layout library * http://masonry.desandro.com * MIT License @@ -152,7 +152,7 @@ return jQueryBridget; })); /** - * EvEmitter v1.0.1 + * EvEmitter v1.0.2 * Lil' event emitter * MIT License */ @@ -206,8 +206,8 @@ proto.once = function( eventName, listener ) { // set once flag // set onceEvents hash var onceEvents = this._onceEvents = this._onceEvents || {}; - // set onceListeners array - var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || []; + // set onceListeners object + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; // set flag onceListeners[ listener ] = true; @@ -485,7 +485,7 @@ return getSize; // universal module definition if ( typeof define == 'function' && define.amd ) { // AMD - define( 'matches-selector/matches-selector',factory ); + define( 'desandro-matches-selector/matches-selector',factory ); } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory(); @@ -526,21 +526,20 @@ return getSize; })); /** - * Fizzy UI utils v2.0.0 + * Fizzy UI utils v2.0.1 * MIT license */ /*jshint browser: true, undef: true, unused: true, strict: true */ ( function( window, factory ) { - /*global define: false, module: false, require: false */ - 'use strict'; // universal module definition + /*jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD define( 'fizzy-ui-utils/utils',[ - 'matches-selector/matches-selector' + 'desandro-matches-selector/matches-selector' ], function( matchesSelector ) { return factory( window, matchesSelector ); }); @@ -775,14 +774,11 @@ return utils; 'ev-emitter/ev-emitter', 'get-size/get-size' ], - function( EvEmitter, getSize ) { - return factory( window, EvEmitter, getSize ); - } + factory ); } else if ( typeof module == 'object' && module.exports ) { // CommonJS - Browserify, Webpack module.exports = factory( - window, require('ev-emitter'), require('get-size') ); @@ -790,13 +786,12 @@ return utils; // browser global window.Outlayer = {}; window.Outlayer.Item = factory( - window, window.EvEmitter, window.getSize ); } -}( window, function factory( window, EvEmitter, getSize ) { +}( window, function factory( EvEmitter, getSize ) { 'use strict'; // ----- helpers ----- // @@ -824,13 +819,14 @@ var transitionEndEvent = { transition: 'transitionend' }[ transitionProperty ]; -// cache all vendor properties -var vendorProperties = [ - transformProperty, - transitionProperty, - transitionProperty + 'Duration', - transitionProperty + 'Property' -]; +// cache all vendor properties that could have vendor prefix +var vendorProperties = { + transform: transformProperty, + transition: transitionProperty, + transitionDuration: transitionProperty + 'Duration', + transitionProperty: transitionProperty + 'Property', + transitionDelay: transitionProperty + 'Delay' +}; // -------------------------- Item -------------------------- // @@ -1044,7 +1040,7 @@ proto._nonTransition = function( args ) { * @param {Boolean} isCleaning - removes transition styles after transition * @param {Function} onTransitionEnd - callback */ -proto._transition = function( args ) { +proto.transition = function( args ) { // redirect to nonTransition if no transition duration if ( !parseFloat( this.layout.options.transitionDuration ) ) { this._nonTransition( args ); @@ -1090,8 +1086,7 @@ function toDashedAll( str ) { }); } -var transitionProps = 'opacity,' + - toDashedAll( vendorProperties.transform || 'transform' ); +var transitionProps = 'opacity,' + toDashedAll( transformProperty ); proto.enableTransition = function(/* style */) { // HACK changing transitionProperty during a transition @@ -1109,17 +1104,19 @@ proto.enableTransition = function(/* style */) { // prop = vendorProperties[ prop ] || prop; // transitionValues.push( toDashedAll( prop ) ); // } + // munge number to millisecond, to match stagger + var duration = this.layout.options.transitionDuration; + duration = typeof duration == 'number' ? duration + 'ms' : duration; // enable transition styles this.css({ transitionProperty: transitionProps, - transitionDuration: this.layout.options.transitionDuration + transitionDuration: duration, + transitionDelay: this.staggerDelay || 0 }); // listen for transition end event this.element.addEventListener( transitionEndEvent, this, false ); }; -proto.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ]; - // ----- events ----- // proto.onwebkitTransitionEnd = function( event ) { @@ -1188,7 +1185,8 @@ proto._removeStyles = function( style ) { var cleanTransitionStyle = { transitionProperty: '', - transitionDuration: '' + transitionDuration: '', + transitionDelay: '' }; proto.removeTransitionStyles = function() { @@ -1196,6 +1194,13 @@ proto.removeTransitionStyles = function() { this.css( cleanTransitionStyle ); }; +// ----- stagger ----- // + +proto.stagger = function( delay ) { + delay = isNaN( delay ) ? 0 : delay; + this.staggerDelay = delay + 'ms'; +}; + // ----- show/hide/remove ----- // // remove element from DOM @@ -1311,7 +1316,7 @@ return Item; })); /*! - * Outlayer v2.0.0 + * Outlayer v2.1.0 * the brains and guts of a layout library * MIT license */ @@ -1660,11 +1665,23 @@ proto._getItemLayoutPosition = function( /* item */ ) { * @param {Array} queue */ proto._processLayoutQueue = function( queue ) { - queue.forEach( function( obj ) { - this._positionItem( obj.item, obj.x, obj.y, obj.isInstant ); + this.updateStagger(); + queue.forEach( function( obj, i ) { + this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i ); }, this ); }; +// set stagger from option in milliseconds number +proto.updateStagger = function() { + var stagger = this.options.stagger; + if ( stagger === null || stagger === undefined ) { + this.stagger = 0; + return; + } + this.stagger = getMilliseconds( stagger ); + return this.stagger; +}; + /** * Sets position of item in DOM * @param {Outlayer.Item} item @@ -1672,11 +1689,12 @@ proto._processLayoutQueue = function( queue ) { * @param {Number} y - vertical position * @param {Boolean} isInstant - disables transitions */ -proto._positionItem = function( item, x, y, isInstant ) { +proto._positionItem = function( item, x, y, isInstant, i ) { if ( isInstant ) { // if not transition, just set CSS item.goTo( x, y ); } else { + item.stagger( i * this.stagger ); item.moveTo( x, y ); } }; @@ -2020,7 +2038,9 @@ proto.reveal = function( items ) { if ( !items || !items.length ) { return; } - items.forEach( function( item ) { + var stagger = this.updateStagger(); + items.forEach( function( item, i ) { + item.stagger( i * stagger ); item.reveal(); }); }; @@ -2034,7 +2054,9 @@ proto.hide = function( items ) { if ( !items || !items.length ) { return; } - items.forEach( function( item ) { + var stagger = this.updateStagger(); + items.forEach( function( item, i ) { + item.stagger( i * stagger ); item.hide(); }); }; @@ -2199,6 +2221,31 @@ function subclass( Parent ) { return SubClass; } +// ----- helpers ----- // + +// how many milliseconds are in each unit +var msUnits = { + ms: 1, + s: 1000 +}; + +// munge time-like parameter into millisecond number +// '0.4s' -> 40 +function getMilliseconds( time ) { + if ( typeof time == 'number' ) { + return time; + } + var matches = time.match( /(^\d*\.?\d*)(\w*)/ ); + var num = matches && matches[1]; + var unit = matches && matches[2]; + if ( !num.length ) { + return 0; + } + num = parseFloat( num ); + var mult = msUnits[ unit ] || 1; + return num * mult; +} + // ----- fin ----- // // back in global @@ -2209,7 +2256,7 @@ return Outlayer; })); /*! - * Masonry v4.0.0 + * Masonry v4.1.0 * Cascading grid layout library * http://masonry.desandro.com * MIT License diff --git a/dist/masonry.pkgd.min.js b/dist/masonry.pkgd.min.js index 05c63088..b2d4759b 100644 --- a/dist/masonry.pkgd.min.js +++ b/dist/masonry.pkgd.min.js @@ -1,9 +1,9 @@ /*! - * Masonry PACKAGED v4.0.0 + * Masonry PACKAGED v4.1.0 * Cascading grid layout library * http://masonry.desandro.com * MIT License * by David DeSandro */ -!function(t,e){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var c=d.apply(u,n);o=void 0===o?c:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||[];return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u>e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);r.isBoxSizeOuter=s=200==t(o.width),i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,c=0;u>c;c++){var l=h[c],f=r[l],m=parseFloat(f);a[l]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,E=a.borderTopWidth+a.borderBottomWidth,z=d&&s,b=t(r.width);b!==!1&&(a.width=b+(z?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(z?0:g+E)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+E),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},i.prototype.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},i.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this._getColGroup(n),r=Math.min.apply(Math,o),s=o.indexOf(r),a={x:this.columnWidth*s,y:r},h=r+t.size.outerHeight,u=this.cols+1-o.length,d=0;u>d;d++)this.colYs[s+d]=h;return a},i.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++){var o=this.colYs.slice(n,n+t);e[n]=Math.max.apply(Math,o)}return e},i.prototype._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,c=a;h>=c;c++)this.colYs[c]=Math.max(d,this.colYs[c])},i.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.prototype.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}); \ No newline at end of file +!function(t,e){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u>e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);r.isBoxSizeOuter=s=200==t(o.width),i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,E=a.borderTopWidth+a.borderBottomWidth,z=d&&s,b=t(r.width);b!==!1&&(a.width=b+(z?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(z?0:g+E)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+E),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},i.prototype.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},i.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this._getColGroup(n),r=Math.min.apply(Math,o),s=o.indexOf(r),a={x:this.columnWidth*s,y:r},h=r+t.size.outerHeight,u=this.cols+1-o.length,d=0;u>d;d++)this.colYs[s+d]=h;return a},i.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++){var o=this.colYs.slice(n,n+t);e[n]=Math.max.apply(Math,o)}return e},i.prototype._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},i.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.prototype.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 1dce15e6..3be2703d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -100,6 +100,8 @@ gulp.task( 'uglify', [ 'requirejs' ], function() { // set version in source files var minimist = require('minimist'); +var gutil = require('gulp-util'); +var chalk = require('chalk'); // use gulp version -t 1.2.3 gulp.task( 'version', function() { @@ -120,7 +122,7 @@ gulp.task( 'version', function() { .pipe( gulp.dest('.') ); // replace CDN links in README var minorVersion = version.match( /^\d\.\d+/ )[0]; - gulp.src('README.mdown') + gulp.src('README.md') .pipe( replace( /masonry\-layout@\d\.\d+/g, 'masonry-layout@' + minorVersion )) .pipe( gulp.dest('.') ); }); diff --git a/masonry.js b/masonry.js index 30901774..7aa8025f 100644 --- a/masonry.js +++ b/masonry.js @@ -1,5 +1,5 @@ /*! - * Masonry v4.0.0 + * Masonry v4.1.0 * Cascading grid layout library * http://masonry.desandro.com * MIT License diff --git a/package.json b/package.json index ce48acec..895f5cc3 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "masonry-layout", - "version": "4.0.0", + "version": "4.1.0", "description": "Cascading grid layout library", "main": "masonry.js", "dependencies": { - "get-size": "~2.0.2", - "outlayer": "~2.0.0" + "get-size": "^2.0.2", + "outlayer": "^2.1.0" }, "devDependencies": { "chalk": "^1.1.1",