diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..f616485 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "printWidth": 400, + "tabWidth": 4, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": false, + "arrowParens": "avoid" +} \ No newline at end of file diff --git a/dist/flexmasonry.css b/dist/flexmasonry.css index 82cde48..371a3b3 100644 --- a/dist/flexmasonry.css +++ b/dist/flexmasonry.css @@ -4,74 +4,4 @@ * Author: Gilbert Pellegrom * License: MIT */ -.flexmasonry { - display: flex; - flex-flow: column wrap; - align-content: space-between; -} - -.flexmasonry-item { width: 100%; } -.flexmasonry-cols-2 .flexmasonry-item { width: 50%; } -.flexmasonry-cols-3 .flexmasonry-item { width: 33.333%; } -.flexmasonry-cols-4 .flexmasonry-item { width: 25%; } -.flexmasonry-cols-5 .flexmasonry-item { width: 20%; } -.flexmasonry-cols-6 .flexmasonry-item { width: 16.666%; } -.flexmasonry-cols-7 .flexmasonry-item { width: 14.285%; } -.flexmasonry-cols-8 .flexmasonry-item { width: 12.5%; } - -.flexmasonry-cols-2 .flexmasonry-item:nth-child(2n+1) { order: 1; } -.flexmasonry-cols-2 .flexmasonry-item:nth-child(2n) { order: 2; } - -.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n+1) { order: 1; } -.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n+2) { order: 2; } -.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n) { order: 3; } - -.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+1) { order: 1; } -.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+2) { order: 2; } -.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+3) { order: 3; } -.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n) { order: 4; } - -.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+1) { order: 1; } -.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+2) { order: 2; } -.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+3) { order: 3; } -.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+4) { order: 4; } -.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n) { order: 5; } - -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+1) { order: 1; } -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+2) { order: 2; } -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+3) { order: 3; } -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+4) { order: 4; } -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+5) { order: 5; } -.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n) { order: 6; } - -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+1) { order: 1; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+2) { order: 2; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+3) { order: 3; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+4) { order: 4; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+5) { order: 5; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+6) { order: 6; } -.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n) { order: 7; } - -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+1) { order: 1; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+2) { order: 2; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+3) { order: 3; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+4) { order: 4; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+5) { order: 5; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+6) { order: 6; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+7) { order: 7; } -.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n) { order: 8; } - -.flexmasonry-break { - content: ""; - flex-basis: 100%; - width: 0 !important; - margin: 0; -} -.flexmasonry-break-1 { order: 1; } -.flexmasonry-break-2 { order: 2; } -.flexmasonry-break-3 { order: 3; } -.flexmasonry-break-4 { order: 4; } -.flexmasonry-break-5 { order: 5; } -.flexmasonry-break-6 { order: 6; } -.flexmasonry-break-7 { order: 7; } - +.flexmasonry{display:flex;flex-flow:column wrap;align-content:space-between}.flexmasonry-item{width:100%}.flexmasonry-cols-2 .flexmasonry-item{width:50%}.flexmasonry-cols-3 .flexmasonry-item{width:33.333%}.flexmasonry-cols-4 .flexmasonry-item{width:25%}.flexmasonry-cols-5 .flexmasonry-item{width:20%}.flexmasonry-cols-6 .flexmasonry-item{width:16.666%}.flexmasonry-cols-7 .flexmasonry-item{width:14.285%}.flexmasonry-cols-8 .flexmasonry-item{width:12.5%}.flexmasonry-cols-2 .flexmasonry-item:nth-child(2n+1){order:1}.flexmasonry-cols-2 .flexmasonry-item:nth-child(2n){order:2}.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n+1){order:1}.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n+2){order:2}.flexmasonry-cols-3 .flexmasonry-item:nth-child(3n){order:3}.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+1){order:1}.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+2){order:2}.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n+3){order:3}.flexmasonry-cols-4 .flexmasonry-item:nth-child(4n){order:4}.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+1){order:1}.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+2){order:2}.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+3){order:3}.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n+4){order:4}.flexmasonry-cols-5 .flexmasonry-item:nth-child(5n){order:5}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+1){order:1}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+2){order:2}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+3){order:3}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+4){order:4}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n+5){order:5}.flexmasonry-cols-6 .flexmasonry-item:nth-child(6n){order:6}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+1){order:1}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+2){order:2}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+3){order:3}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+4){order:4}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+5){order:5}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n+6){order:6}.flexmasonry-cols-7 .flexmasonry-item:nth-child(7n){order:7}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+1){order:1}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+2){order:2}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+3){order:3}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+4){order:4}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+5){order:5}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+6){order:6}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n+7){order:7}.flexmasonry-cols-8 .flexmasonry-item:nth-child(8n){order:8}.flexmasonry-break{content:'';flex-basis:100%;width:0!important;margin:0}.flexmasonry-break-1{order:1}.flexmasonry-break-2{order:2}.flexmasonry-break-3{order:3}.flexmasonry-break-4{order:4}.flexmasonry-break-5{order:5}.flexmasonry-break-6{order:6}.flexmasonry-break-7{order:7} \ No newline at end of file diff --git a/dist/flexmasonry.js b/dist/flexmasonry.js index f729e88..689e7c0 100644 --- a/dist/flexmasonry.js +++ b/dist/flexmasonry.js @@ -4,4 +4,4 @@ * Author: Gilbert Pellegrom * License: MIT */ -var FlexMasonry=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){t(1),e.exports=t(2)},function(e,n,t){},function(e,n,t){"use strict";t.r(n);const r={responsive:!0,breakpointCols:{"min-width: 1500px":6,"min-width: 1200px":5,"min-width: 992px":4,"min-width: 768px":3,"min-width: 576px":2},numCols:4};let o=null,i={},s=[];function a(){s.forEach(function(e){c(e)})}function l(){o&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(function(){y()})}function c(e){if(d()<2)return void e.style.removeProperty("height");let n=[];Array.from(e.children).forEach(function(e){if(e.classList.contains("flexmasonry-break"))return;const t=window.getComputedStyle(e),r=t.getPropertyValue("order"),o=t.getPropertyValue("height");n[r-1]||(n[r-1]=0),n[r-1]+=Math.ceil(parseFloat(o))});const t=Math.max(...n);e.style.height=t+"px"}function f(e){const n=e.querySelectorAll(".flexmasonry-break");if(Array.from(n).length!==d()-1)for(let n=1;n