diff --git a/dist/index.js b/dist/index.js index ef3a2ee..75e01a6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-xmasonry"]=t(require("react")):e["react-xmasonry"]=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get: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,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.XBlock=t.XMasonry=void 0;var i=n(3),o=r(i),a=n(4),s=r(a);t.XMasonry=o.default,t.XBlock=s.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:45,n=0;return function(){0!==n&&clearTimeout(n),n=setTimeout(function(){n=0,e()},t)}},t.isServer=!("undefined"!=typeof document&&"undefined"!=typeof window)},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1,n=Math.min(e.length-t+1,this.props.maxColumns-t+1),r=0,i=1/0,o=0;o0&&void 0!==arguments[0]?arguments[0]:100;if(100===t&&this.smartUpdate)clearInterval(this.smartUpdate),this.smartUpdate=0;else if(this.smartUpdate)return;this.smartUpdate=setTimeout(function(){var n=!d.isServer&&void 0!==document.hidden&&document.hidden;if(n)var r=document.addEventListener("visibilitychange",function(){document.hidden||(document.removeEventListener("visibilitychange",r),e.runSmartUpdate(2*t))},!1);if(e.smartUpdate=0,e.updateInternal())return void e.runSmartUpdate();n||e.runSmartUpdate(2*t)},Math.min(t,this.props.smartUpdateCeil))}},{key:"getColumnsNumber",value:function(e){return Math.max(1,Math.round(e/this.props.targetBlockWidth))}},{key:"updateContainerWidth",value:function(){var e=d.isServer&&!this.container?this.props.width||999*this.props.targetBlockWidth:this.container?this.container.clientWidth:0;return e!==this.containerWidth&&e!==this.containerWidth+h&&(this.setState({columns:this.columns=this.getColumnsNumber(e),containerWidth:this.containerWidth=e,blocks:this.blocks={}}),!0)}},{key:"measureChildren",value:function(){if(!this.container)return!1;for(var e={},t=!1,n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=void 0,r=[],i=0;i0||0===a.length?this.fixedHeight=this.state.containerHeight:this.fixedHeight,h=this.props,p=(h.center,h.maxColumns,h.responsive,h.smartUpdate,h.smartUpdateCeil,h.targetBlockWidth,h.updateOnImagesLoad,h.updateOnFontLoad,h.className),f=h.style,v=r(h,["center","maxColumns","responsive","smartUpdate","smartUpdateCeil","targetBlockWidth","updateOnImagesLoad","updateOnFontLoad","className","style"]);return c.default.createElement("div",s({className:"xmasonry"+(d.isServer?" xmasonry-static":"")+(p?" "+p:""),style:s({},t.containerStyle,{height:d.isServer?void 0:u},f),ref:function(t){return e.container=t}},v),a)}}]),t}(c.default.Component);v.defaultProps={center:!0,maxColumns:d.isServer?3:1/0,responsive:!0,smartUpdate:!0,smartUpdateCeil:1/0,targetBlockWidth:300,updateOnFontLoad:!0,updateOnImagesLoad:!0},v.containerStyle={position:"relative"},t.default=v},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t0&&t.props.updateOnImagesLoad&&n.forEach(function(e){return!e.complete&&e.addEventListener("load",t.update)}),e.props.height!==e.divElement.clientHeight&&t.update()}})}}},{key:"render",value:function(){var e=this,n=this.props,i=n.width,o=(n.height,n.measured),a=(n.parent,n.style),l=r(n,["width","height","measured","parent","style"]),u=this.props.parent.columns,h=Math.min(i||1,u,this.props.parent.props.maxColumns);return a.width=Math.floor(h*this.props.parent.containerWidth/u),c.default.createElement("div",s({"data-width":h},l,{style:s({},a,t.defaultStyle),className:o?"xblock":d.isServer?"xblock xblock-static":"",ref:function(t){return e.divElement=t}}),this.props.children)}}]),t}(c.default.Component);h.defaultProps={width:1,measured:!1},h.defaultStyle={position:d.isServer?void 0:"absolute",boxSizing:"border-box"},t.default=h}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-xmasonry"]=t(require("react")):e["react-xmasonry"]=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get: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,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.XBlock=t.XMasonry=void 0;var i=n(3),o=r(i),a=n(5),s=r(a);t.XMasonry=o.default,t.XBlock=s.default},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:45,n=0;return function(){0!==n&&clearTimeout(n),n=setTimeout(function(){n=0,e()},t)}},t.isServer="false"!==((e||{}).env||{}).REACT_XMASONRY_SSR_ENABLED&&!("undefined"!=typeof document&&"undefined"!=typeof window)}).call(t,n(4))},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1,n=Math.min(e.length-t+1,this.props.maxColumns-t+1),r=0,i=1/0,o=0;o0&&void 0!==arguments[0]?arguments[0]:100;if(100===t&&this.smartUpdate)clearInterval(this.smartUpdate),this.smartUpdate=0;else if(this.smartUpdate)return;this.smartUpdate=setTimeout(function(){var n=!d.isServer&&void 0!==document.hidden&&document.hidden;if(n)var r=document.addEventListener("visibilitychange",function(){document.hidden||(document.removeEventListener("visibilitychange",r),e.runSmartUpdate(2*t))},!1);if(e.smartUpdate=0,e.updateInternal())return void e.runSmartUpdate();n||e.runSmartUpdate(2*t)},Math.min(t,this.props.smartUpdateCeil))}},{key:"getColumnsNumber",value:function(e){return Math.max(1,Math.round(e/this.props.targetBlockWidth))}},{key:"updateContainerWidth",value:function(){var e=d.isServer&&!this.container?this.props.width||999*this.props.targetBlockWidth:this.container?this.container.clientWidth:0;return e!==this.containerWidth&&e!==this.containerWidth+h&&(this.setState({columns:this.columns=this.getColumnsNumber(e),containerWidth:this.containerWidth=e,blocks:this.blocks={}}),!0)}},{key:"measureChildren",value:function(){if(!this.container)return!1;for(var e={},t=!1,n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=void 0,r=[],i=0;i0||0===a.length?this.fixedHeight=this.state.containerHeight:this.fixedHeight,h=this.props,p=(h.center,h.maxColumns,h.responsive,h.smartUpdate,h.smartUpdateCeil,h.targetBlockWidth,h.updateOnImagesLoad,h.updateOnFontLoad,h.className),f=h.style,m=r(h,["center","maxColumns","responsive","smartUpdate","smartUpdateCeil","targetBlockWidth","updateOnImagesLoad","updateOnFontLoad","className","style"]);return c.default.createElement("div",s({className:"xmasonry"+(d.isServer?" xmasonry-static":"")+(p?" "+p:""),style:s({},t.containerStyle,{height:d.isServer?void 0:l},f),ref:function(t){return e.container=t}},m),a)}}]),t}(c.default.Component);m.defaultProps={center:!0,maxColumns:d.isServer?3:1/0,responsive:!0,smartUpdate:!0,smartUpdateCeil:1/0,targetBlockWidth:300,updateOnFontLoad:!0,updateOnImagesLoad:!0},m.containerStyle={position:"relative"},t.default=m},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){m&&p&&(m=!1,p.length?f=p.concat(f):v=-1,f.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=f.length;t;){for(p=f,f=[];++v1)for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t0&&t.props.updateOnImagesLoad&&n.forEach(function(e){return!e.complete&&e.addEventListener("load",t.update)}),e.props.height!==e.divElement.clientHeight&&t.update()}})}}},{key:"render",value:function(){var e=this,n=this.props,i=n.width,o=(n.height,n.measured),a=(n.parent,n.style),u=r(n,["width","height","measured","parent","style"]),l=this.props.parent.columns,h=Math.min(i||1,l,this.props.parent.props.maxColumns);return a.width=Math.floor(h*this.props.parent.containerWidth/l),c.default.createElement("div",s({"data-width":h},u,{style:s({},a,t.defaultStyle),className:o?"xblock":d.isServer?"xblock xblock-static":"",ref:function(t){return e.divElement=t}}),this.props.children)}}]),t}(c.default.Component);h.defaultProps={width:1,measured:!1},h.defaultStyle={position:d.isServer?void 0:"absolute",boxSizing:"border-box"},t.default=h}])}); \ No newline at end of file diff --git a/docs/index.js b/docs/index.js index b8e4f09..4e8f7e5 100644 --- a/docs/index.js +++ b/docs/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-xmasonry"]=t(require("react")):e["react-xmasonry"]=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get: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,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.XBlock=t.XMasonry=void 0;var a=n(3),o=r(a),i=n(4),l=r(i);t.XMasonry=o.default,t.XBlock=l.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:45,n=0;return function(){0!==n&&clearTimeout(n),n=setTimeout(function(){n=0,e()},t)}},t.isServer=!("undefined"!=typeof document&&"undefined"!=typeof window)},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1,n=Math.min(e.length-t+1,this.props.maxColumns-t+1),r=0,a=1/0,o=0;o0&&void 0!==arguments[0]?arguments[0]:100;if(100===t&&this.smartUpdate)clearInterval(this.smartUpdate),this.smartUpdate=0;else if(this.smartUpdate)return;this.smartUpdate=setTimeout(function(){var n=!d.isServer&&void 0!==document.hidden&&document.hidden;if(n)var r=document.addEventListener("visibilitychange",function(){document.hidden||(document.removeEventListener("visibilitychange",r),e.runSmartUpdate(2*t))},!1);if(e.smartUpdate=0,e.updateInternal())return void e.runSmartUpdate();n||e.runSmartUpdate(2*t)},Math.min(t,this.props.smartUpdateCeil))}},{key:"getColumnsNumber",value:function(e){return Math.max(1,Math.round(e/this.props.targetBlockWidth))}},{key:"updateContainerWidth",value:function(){var e=d.isServer&&!this.container?this.props.width||999*this.props.targetBlockWidth:this.container?this.container.clientWidth:0;return e!==this.containerWidth&&e!==this.containerWidth+f&&(this.setState({columns:this.columns=this.getColumnsNumber(e),containerWidth:this.containerWidth=e,blocks:this.blocks={}}),!0)}},{key:"measureChildren",value:function(){if(!this.container)return!1;for(var e={},t=!1,n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=void 0,r=[],a=0;a0||0===i.length?this.fixedHeight=this.state.containerHeight:this.fixedHeight,f=this.props,h=(f.center,f.maxColumns,f.responsive,f.smartUpdate,f.smartUpdateCeil,f.targetBlockWidth,f.updateOnImagesLoad,f.updateOnFontLoad,f.className),p=f.style,m=r(f,["center","maxColumns","responsive","smartUpdate","smartUpdateCeil","targetBlockWidth","updateOnImagesLoad","updateOnFontLoad","className","style"]);return u.default.createElement("div",l({className:"xmasonry"+(d.isServer?" xmasonry-static":"")+(h?" "+h:""),style:l({},t.containerStyle,{height:d.isServer?void 0:c},p),ref:function(t){return e.container=t}},m),i)}}]),t}(u.default.Component);m.defaultProps={center:!0,maxColumns:d.isServer?3:1/0,responsive:!0,smartUpdate:!0,smartUpdateCeil:1/0,targetBlockWidth:300,updateOnFontLoad:!0,updateOnImagesLoad:!0},m.containerStyle={position:"relative"},t.default=m},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&t.props.updateOnImagesLoad&&n.forEach(function(e){return!e.complete&&e.addEventListener("load",t.update)}),e.props.height!==e.divElement.clientHeight&&t.update()}})}}},{key:"render",value:function(){var e=this,n=this.props,a=n.width,o=(n.height,n.measured),i=(n.parent,n.style),s=r(n,["width","height","measured","parent","style"]),c=this.props.parent.columns,f=Math.min(a||1,c,this.props.parent.props.maxColumns);return i.width=Math.floor(f*this.props.parent.containerWidth/c),u.default.createElement("div",l({"data-width":f},s,{style:l({},i,t.defaultStyle),className:o?"xblock":d.isServer?"xblock xblock-static":"",ref:function(t){return e.divElement=t}}),this.props.children)}}]),t}(u.default.Component);f.defaultProps={width:1,measured:!1},f.defaultStyle={position:d.isServer?void 0:"absolute",boxSizing:"border-box"},t.default=f},function(e,t,n){"use strict";function r(){var e=["#ffff8d","#ff8a80","#a7ffeb","#ffd180","#80d8ff","#ccff90","#cfd8dc"];return e[Math.floor(Math.random()*e.length)]}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=s.split(/\./g),n=Math.floor(Math.random()*(t.length-2)),r=e||1+Math.floor(Math.random()*(t.length-n+1));return t.splice(n,r).join(".")}function o(){for(var e=new Array(7+Math.floor(5*Math.random())),t=0;t.8?2:1};return e}function i(e){return{id:e,header:"This is a dummy card",body:a(),width:Math.random()>.8?2:1,color:r()}}Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomColor=r,t.getRandomText=a,t.generateArticles=o,t.getRandomCard=i;var l=0,s="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vehicula leo a justo auctor, ut tristique mauris finibus. Curabitur sit amet dignissim lorem. Sed semper, mauris vel maximus efficitur, erat sem facilisis tellus, nec porta libero odio non nisi. Ut sed mi at metus pharetra vehicula et ut urna. Vestibulum sed nibh aliquet, tempor quam sed, facilisis erat. In commodo porttitor lacus, eget feugiat ipsum aliquam at. Donec ut suscipit odio. Ut dictum porttitor nunc, vel fringilla neque interdum vitae. Etiam non dolor eget arcu iaculis vehicula. Nulla volutpat varius venenatis. Praesent ac porttitor nunc. Fusce quis ex arcu. Donec at erat velit. Mauris nec metus nisi. Nunc ex lorem, vulputate nec felis id, commodo fringilla nunc. Donec dui velit, consequat venenatis rutrum sit amet, imperdiet nec nulla. In hac habitasse platea dictumst. Sed at ligula quis tortor consequat gravida a ac ex. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent vel bibendum ante. Fusce eros turpis, accumsan sit amet lobortis non, egestas in tellus. Phasellus lacinia nec odio quis molestie. Nullam vestibulum sed lectus a molestie. Nulla varius ligula sollicitudin."},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var a=n(7),o=r(a),i=n(8),l=r(i),s=n(9),c=r(s);window.init=function(){ReactDOM.render(React.createElement("div",null,React.createElement("h1",{style:{textAlign:"center"}},"Cards Demo"),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/CardsDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/CardsDemo.jsx"},"JavaScript source")),React.createElement(o.default,null),React.createElement("h1",{style:{textAlign:"center"}},"Content Changes Demo"),React.createElement("div",{className:"littleGray limited centerText"},"When grid items change their size dynamically (like dynamically loaded CSS stylesheets or interactive layout), you need to update the layout manually each time when changes happen.",React.createElement("br",null),"Update XMasonry any time by triggering its ",React.createElement("a",{target:"_blank",href:"https://www.npmjs.com/package/react-xmasonry#accessing-xmasonry-by-reference"},"update")," method."),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/ContentChangesDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/ContentChangesDemo.jsx"},"JavaScript source")),React.createElement(c.default,null),React.createElement("h1",{style:{textAlign:"center"}},"Articles Demo"),React.createElement("div",{className:"littleGray centerText"},"Use better CSS fixed ratio approach when possible (no image load hooks are triggered, content appears immediately)"),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/ArticlesDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/ArticlesDemo.jsx"},"JavaScript source")),React.createElement(l.default,null)),document.getElementById("demoApp"))}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:45,n=0;return function(){0!==n&&clearTimeout(n),n=setTimeout(function(){n=0,e()},t)}},t.isServer="false"!==((e||{}).env||{}).REACT_XMASONRY_SSR_ENABLED&&!("undefined"!=typeof document&&"undefined"!=typeof window)}).call(t,n(4))},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:1,n=Math.min(e.length-t+1,this.props.maxColumns-t+1),r=0,a=1/0,o=0;o0&&void 0!==arguments[0]?arguments[0]:100;if(100===t&&this.smartUpdate)clearInterval(this.smartUpdate),this.smartUpdate=0;else if(this.smartUpdate)return;this.smartUpdate=setTimeout(function(){var n=!d.isServer&&void 0!==document.hidden&&document.hidden;if(n)var r=document.addEventListener("visibilitychange",function(){document.hidden||(document.removeEventListener("visibilitychange",r),e.runSmartUpdate(2*t))},!1);if(e.smartUpdate=0,e.updateInternal())return void e.runSmartUpdate();n||e.runSmartUpdate(2*t)},Math.min(t,this.props.smartUpdateCeil))}},{key:"getColumnsNumber",value:function(e){return Math.max(1,Math.round(e/this.props.targetBlockWidth))}},{key:"updateContainerWidth",value:function(){var e=d.isServer&&!this.container?this.props.width||999*this.props.targetBlockWidth:this.container?this.container.clientWidth:0;return e!==this.containerWidth&&e!==this.containerWidth+f&&(this.setState({columns:this.columns=this.getColumnsNumber(e),containerWidth:this.containerWidth=e,blocks:this.blocks={}}),!0)}},{key:"measureChildren",value:function(){if(!this.container)return!1;for(var e={},t=!1,n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=void 0,r=[],a=0;a0||0===i.length?this.fixedHeight=this.state.containerHeight:this.fixedHeight,f=this.props,h=(f.center,f.maxColumns,f.responsive,f.smartUpdate,f.smartUpdateCeil,f.targetBlockWidth,f.updateOnImagesLoad,f.updateOnFontLoad,f.className),p=f.style,m=r(f,["center","maxColumns","responsive","smartUpdate","smartUpdateCeil","targetBlockWidth","updateOnImagesLoad","updateOnFontLoad","className","style"]);return u.default.createElement("div",l({className:"xmasonry"+(d.isServer?" xmasonry-static":"")+(h?" "+h:""),style:l({},t.containerStyle,{height:d.isServer?void 0:c},p),ref:function(t){return e.container=t}},m),i)}}]),t}(u.default.Component);m.defaultProps={center:!0,maxColumns:d.isServer?3:1/0,responsive:!0,smartUpdate:!0,smartUpdateCeil:1/0,targetBlockWidth:300,updateOnFontLoad:!0,updateOnImagesLoad:!0},m.containerStyle={position:"relative"},t.default=m},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function a(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function i(){m&&h&&(m=!1,h.length?p=h.concat(p):y=-1,p.length&&l())}function l(){if(!m){var e=a(i);m=!0;for(var t=p.length;t;){for(h=p,p=[];++y1)for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&t.props.updateOnImagesLoad&&n.forEach(function(e){return!e.complete&&e.addEventListener("load",t.update)}),e.props.height!==e.divElement.clientHeight&&t.update()}})}}},{key:"render",value:function(){var e=this,n=this.props,a=n.width,o=(n.height,n.measured),i=(n.parent,n.style),s=r(n,["width","height","measured","parent","style"]),c=this.props.parent.columns,f=Math.min(a||1,c,this.props.parent.props.maxColumns);return i.width=Math.floor(f*this.props.parent.containerWidth/c),u.default.createElement("div",l({"data-width":f},s,{style:l({},i,t.defaultStyle),className:o?"xblock":d.isServer?"xblock xblock-static":"",ref:function(t){return e.divElement=t}}),this.props.children)}}]),t}(u.default.Component);f.defaultProps={width:1,measured:!1},f.defaultStyle={position:d.isServer?void 0:"absolute",boxSizing:"border-box"},t.default=f},function(e,t,n){"use strict";function r(){var e=["#ffff8d","#ff8a80","#a7ffeb","#ffd180","#80d8ff","#ccff90","#cfd8dc"];return e[Math.floor(Math.random()*e.length)]}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=s.split(/\./g),n=Math.floor(Math.random()*(t.length-2)),r=e||1+Math.floor(Math.random()*(t.length-n+1));return t.splice(n,r).join(".")}function o(){for(var e=new Array(7+Math.floor(5*Math.random())),t=0;t.8?2:1};return e}function i(e){return{id:e,header:"This is a dummy card",body:a(),width:Math.random()>.8?2:1,color:r()}}Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomColor=r,t.getRandomText=a,t.generateArticles=o,t.getRandomCard=i;var l=0,s="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vehicula leo a justo auctor, ut tristique mauris finibus. Curabitur sit amet dignissim lorem. Sed semper, mauris vel maximus efficitur, erat sem facilisis tellus, nec porta libero odio non nisi. Ut sed mi at metus pharetra vehicula et ut urna. Vestibulum sed nibh aliquet, tempor quam sed, facilisis erat. In commodo porttitor lacus, eget feugiat ipsum aliquam at. Donec ut suscipit odio. Ut dictum porttitor nunc, vel fringilla neque interdum vitae. Etiam non dolor eget arcu iaculis vehicula. Nulla volutpat varius venenatis. Praesent ac porttitor nunc. Fusce quis ex arcu. Donec at erat velit. Mauris nec metus nisi. Nunc ex lorem, vulputate nec felis id, commodo fringilla nunc. Donec dui velit, consequat venenatis rutrum sit amet, imperdiet nec nulla. In hac habitasse platea dictumst. Sed at ligula quis tortor consequat gravida a ac ex. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent vel bibendum ante. Fusce eros turpis, accumsan sit amet lobortis non, egestas in tellus. Phasellus lacinia nec odio quis molestie. Nullam vestibulum sed lectus a molestie. Nulla varius ligula sollicitudin."},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var a=n(8),o=r(a),i=n(9),l=r(i),s=n(10),c=r(s);window.init=function(){ReactDOM.render(React.createElement("div",null,React.createElement("h1",{style:{textAlign:"center"}},"Cards Demo"),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/CardsDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/CardsDemo.jsx"},"JavaScript source")),React.createElement(o.default,null),React.createElement("h1",{style:{textAlign:"center"}},"Content Changes Demo"),React.createElement("div",{className:"littleGray limited centerText"},"When grid items change their size dynamically (like dynamically loaded CSS stylesheets or interactive layout), you need to update the layout manually each time when changes happen.",React.createElement("br",null),"Update XMasonry any time by triggering its ",React.createElement("a",{target:"_blank",href:"https://www.npmjs.com/package/react-xmasonry#accessing-xmasonry-by-reference"},"update")," method."),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/ContentChangesDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/ContentChangesDemo.jsx"},"JavaScript source")),React.createElement(c.default,null),React.createElement("h1",{style:{textAlign:"center"}},"Articles Demo"),React.createElement("div",{className:"littleGray centerText"},"Use better CSS fixed ratio approach when possible (no image load hooks are triggered, content appears immediately)"),React.createElement("div",{className:"littleGray centerText"},React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/css/ArticlesDemo.css"},"CSS source")," | ",React.createElement("a",{target:"_blank",href:"https://github.com/ZitRos/react-xmasonry/blob/master/docs/jsx/ArticlesDemo.jsx"},"JavaScript source")),React.createElement(l.default,null)),document.getElementById("demoApp"))}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n { } }; -export const isServer = !(typeof document !== "undefined" && typeof window !== "undefined"); \ No newline at end of file +export const isServer = ((process || {}).env || {}).REACT_XMASONRY_SSR_ENABLED !== 'false' + && !(typeof document !== "undefined" && typeof window !== "undefined"); \ No newline at end of file