bricklayer
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -25,3 +25,3 @@ { | ||
], | ||
"version": "0.2.12" | ||
"version": "0.2.13" | ||
} |
@@ -1,1 +0,1 @@ | ||
!function t(e,n,r){function i(s,u){if(!n[s]){if(!e[s]){var l="function"==typeof require&&require;if(!u&&l)return l(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e,n){var r,i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)};!function(t){function e(t){return[].slice.call(t)}function n(t,e,n){if(window.CustomEvent)var r=new CustomEvent(e,{detail:n});else{var r=document.createEvent("CustomEvent");r.initCustomEvent(e,!0,!0,n)}return t.dispatchEvent(r)}var r={rulerClassName:"bricklayer-column-sizer",columnClassName:"bricklayer-column"},o=function(){function t(t){this.element=document.createElement("div"),this.element.className=t}return t}(),s=function(t){function e(){t.apply(this,arguments)}return i(e,t),e.prototype.getWidth=function(){this.element.setAttribute("style","\n display: block;\n visibility: hidden !important;\n top: -1000px !important;\n ");var t=this.element.offsetWidth;return this.element.removeAttribute("style"),t},e}(o),u=function(t){function e(){t.apply(this,arguments)}return i(e,t),e}(o),l=function(){function t(t,e){void 0===e&&(e=r),this.element=t,this.options=e,this.ruler=new s(e.rulerClassName),this.build(),this.buildResponsive()}return t.prototype.append=function(t){var n=this;if(Array.isArray(t))return void t.forEach(function(t){return n.append(t)});var r=this.findMinHeightColumn();this.elements=e(this.elements).concat([t]),this.applyPosition("append",r,t)},t.prototype.prepend=function(t){var n=this;if(Array.isArray(t))return void t.forEach(function(t){return n.prepend(t)});var r=this.findMinHeightColumn();this.elements=[t].concat(e(this.elements)),this.applyPosition("prepend",r,t)},t.prototype.on=function(t,e){return this.element.addEventListener("bricklayer."+t,e),this},t.prototype.build=function(){this.elements=this.getElementsInOrder(),this.element.insertBefore(this.ruler.element,this.element.firstChild)},t.prototype.buildResponsive=function(){var t=this;window.addEventListener("resize",function(e){return t.checkColumnCount()}),this.checkColumnCount(),this.on("breakpoint",function(e){return t.reorderElements(e.detail.columnCount)}),this.columnCount>=1&&this.reorderElements(this.columnCount)},t.prototype.getColumns=function(){return this.element.querySelectorAll(":scope > ."+this.options.columnClassName)},t.prototype.findMinHeightColumn=function(){var t=this.getColumns(),n=e(t).sort(function(t,e){var n=t.offsetHeight,r=e.offsetHeight;return n>r?1:n==r?0:-1});return n[0]},t.prototype.getElementsInOrder=function(){return this.element.querySelectorAll(":scope > *:not(."+this.options.columnClassName+"):not(."+this.options.rulerClassName+")")},t.prototype.checkColumnCount=function(){var t=this.getColumnCount();this.columnCount!==t&&(n(this.element,"bricklayer.breakpoint",{columnCount:t}),this.columnCount=t)},t.prototype.reorderElements=function(t){var n=this;void 0===t&&(t=1),(t==1/0||1>t)&&(t=1);for(var r=e(this.elements).map(function(t){var e=t.parentNode.removeChild(t);return e}),i=this.getColumns(),o=0;o<i.length;o++)i[o].parentNode.removeChild(i[o]);for(var o=0;t>o;o++){var s=new u(this.options.columnClassName).element;this.element.appendChild(s)}r.forEach(function(t){var e=n.findMinHeightColumn();e.appendChild(t)})},t.prototype.getColumnCount=function(){var t=this.element.offsetWidth,e=this.ruler.getWidth();return Math.round(t/e)},t.prototype.applyPosition=function(t,e,r){var i=this,o=function(o){var s=o+t.charAt(0).toUpperCase()+t.substr(1);n(i.element,"bricklayer."+s,{item:r,column:e})};switch(o("before"),t){case"append":e.appendChild(r);break;case"prepend":e.insertBefore(r,e.firstChild)}o("after")},t}();t.Container=l}(r||(r={})),window.Bricklayer=r.Container,void 0!==jQuery&&!function(t){t.fn.bricklayer=function(e){return t(this).forEach(function(){var n=new r.Container(this,e);t(this).data("bricklayer",n)}),this}}(jQuery)},{}]},{},[1]); | ||
!function t(e,n,r){function i(s,u){if(!n[s]){if(!e[s]){var l="function"==typeof require&&require;if(!u&&l)return l(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e,n){var r,i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)};!function(t){function e(t){return[].slice.call(t)}function n(t,e,n){if(window.CustomEvent)var r=new CustomEvent(e,{detail:n});else{var r=document.createEvent("CustomEvent");r.initCustomEvent(e,!0,!0,n)}return t.dispatchEvent(r)}var r={rulerClassName:"bricklayer-column-sizer",columnClassName:"bricklayer-column"},o=function(){function t(t){this.element=document.createElement("div"),this.element.className=t}return t}(),s=function(t){function e(){t.apply(this,arguments)}return i(e,t),e.prototype.getWidth=function(){this.element.setAttribute("style","\n display: block;\n visibility: hidden !important;\n top: -1000px !important;\n ");var t=this.element.offsetWidth;return this.element.removeAttribute("style"),t},e}(o),u=function(t){function e(){t.apply(this,arguments)}return i(e,t),e}(o),l=function(){function t(t,e){void 0===e&&(e=r),this.element=t,this.options=e,this.ruler=new s(e.rulerClassName),this.build(),this.buildResponsive()}return t.prototype.append=function(t){var n=this;if(Array.isArray(t))return void t.forEach(function(t){return n.append(t)});var r=this.findMinHeightColumn();this.elements=e(this.elements).concat([t]),this.applyPosition("append",r,t)},t.prototype.prepend=function(t){var n=this;if(Array.isArray(t))return void t.forEach(function(t){return n.prepend(t)});var r=this.findMinHeightColumn();this.elements=[t].concat(e(this.elements)),this.applyPosition("prepend",r,t)},t.prototype.on=function(t,e){return this.element.addEventListener("bricklayer."+t,e),this},t.prototype.build=function(){this.elements=this.getElementsInOrder(),this.element.insertBefore(this.ruler.element,this.element.firstChild)},t.prototype.buildResponsive=function(){var t=this;window.addEventListener("resize",function(e){return t.checkColumnCount()}),this.checkColumnCount(),this.on("breakpoint",function(e){return t.reorderElements(e.detail.columnCount)}),this.columnCount>=1&&this.reorderElements(this.columnCount)},t.prototype.getColumns=function(){return this.element.querySelectorAll(":scope > ."+this.options.columnClassName)},t.prototype.findMinHeightColumn=function(){var t=this.getColumns(),n=e(t).sort(function(t,e){var n=t.offsetHeight,r=e.offsetHeight;return n>r?1:n==r?0:-1});return n[0]},t.prototype.getElementsInOrder=function(){return this.element.querySelectorAll(":scope > *:not(."+this.options.columnClassName+"):not(."+this.options.rulerClassName+")")},t.prototype.checkColumnCount=function(){var t=this.getColumnCount();this.columnCount!==t&&(n(this.element,"bricklayer.breakpoint",{columnCount:t}),this.columnCount=t)},t.prototype.reorderElements=function(t){var n=this;void 0===t&&(t=1),(t==1/0||1>t)&&(t=1);for(var r=e(this.elements).map(function(t){var e=t.parentNode?t.parentNode.removeChild(t):t;return e}),i=this.getColumns(),o=0;o<i.length;o++)i[o].parentNode.removeChild(i[o]);for(var o=0;t>o;o++){var s=new u(this.options.columnClassName).element;this.element.appendChild(s)}r.forEach(function(t){var e=n.findMinHeightColumn();e.appendChild(t)})},t.prototype.getColumnCount=function(){var t=this.element.offsetWidth,e=this.ruler.getWidth();return Math.round(t/e)},t.prototype.applyPosition=function(t,e,r){var i=this,o=function(o){var s=o+t.charAt(0).toUpperCase()+t.substr(1);n(i.element,"bricklayer."+s,{item:r,column:e})};switch(o("before"),t){case"append":e.appendChild(r);break;case"prepend":e.insertBefore(r,e.firstChild)}o("after")},t}();t.Container=l}(r||(r={})),window.Bricklayer=r.Container,void 0!==jQuery&&!function(t){t.fn.bricklayer=function(e){return t(this).forEach(function(){var n=new r.Container(this,e);t(this).data("bricklayer",n)}),this}}(jQuery)},{}]},{},[1]); |
{ | ||
"name": "bricklayer", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "Lightweight and strong Masonry alternative", | ||
@@ -5,0 +5,0 @@ "main": "dist/bricklayer.js", |
# Bricklayer | ||
Lightweight & independent cascading grid layout library. Inspired and a lighter alternative to [Masonry](http://masonry.desandro.com/) | ||
Lightweight & independent cascading grid layout library. Inspired by and a lighter alternative to [Masonry](http://masonry.desandro.com/). | ||
@@ -14,3 +14,3 @@ [Play with example](http://ademilter.github.io/bricklayer) | ||
- **No frameworks required**, but if you use jQuery it integrates itself as a plugin. | ||
- **Responsive** support with no glitch. | ||
- **Responsive** support with no glitches. | ||
- Easy configuration. | ||
@@ -23,3 +23,2 @@ - Static positioning, no inline styles. | ||
<link rel="stylesheet" href="//rawgit.com/ademilter/bricklayer/master/dist/bricklayer.css"> | ||
<script src="//rawgit.com/ademilter/bricklayer/master/dist/bricklayer.min.js"></script> | ||
@@ -36,3 +35,3 @@ ``` | ||
- Create a simple list. | ||
- Create a simple list: | ||
@@ -68,3 +67,3 @@ ```html | ||
- Make them bricks using `Bricklayer` class. | ||
- Make them bricks using `Bricklayer` class: | ||
@@ -76,7 +75,7 @@ ```js | ||
## Methods | ||
- Add bricks dynamically | ||
- Add bricks dynamically: | ||
```js | ||
bricklayer.append( | ||
"<div>My awesome content</div>" | ||
myAwesomeElement | ||
) | ||
@@ -89,4 +88,4 @@ ``` | ||
bricklayer.prepend([ | ||
"<div>My awesome content</div>", | ||
"<div>My another awesome but very long content</div>" | ||
myAwesomeElement, | ||
myAwesomeButVeryLongElement | ||
]) | ||
@@ -97,3 +96,3 @@ ``` | ||
Bricklayer integrates itself into jQuery if it founds any jQuery instance on page. | ||
Bricklayer integrates itself into jQuery if it finds any jQuery instance on the page. | ||
@@ -110,3 +109,3 @@ ```js | ||
You can add listeners to Bricklayer to have full control. They allows you to | ||
You can add listeners to Bricklayer for full control. These allow you to | ||
create more extensible layouts. You can use these events especially for | ||
@@ -153,3 +152,3 @@ animations. Please see examples. | ||
Please add more and open a pull request if you tested successfully on more browsers. | ||
Please add more and open a pull request if you tested successfully on other browsers. | ||
@@ -156,0 +155,0 @@ ## License |
2200064
170