Socket
Socket
Sign inDemoInstall

@tueri/react

Package Overview
Dependencies
13
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.6 to 1.2.7

2

lib/index.js

@@ -14,2 +14,2 @@ module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";e.exports=n(3)},function(e,t,n){e.exports=n(5)()},function(e,t,n){(function(t){var n=1/0,r="[object Symbol]",o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",c="["+u+"]",a="[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]",f="\\d+",l="[\\u2700-\\u27bf]",s="[a-z\\xdf-\\xf6\\xf8-\\xff]",p="[^\\ud800-\\udfff"+u+f+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",b="[A-Z\\xc0-\\xd6\\xd8-\\xde]",h="(?:"+s+"|"+p+")",m="(?:"+b+"|"+p+")",v="(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?",g="[\\ufe0e\\ufe0f]?"+v+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",d,y].join("|")+")[\\ufe0e\\ufe0f]?"+v+")*"),w="(?:"+[l,d,y].join("|")+")"+g,O=RegExp("['’]","g"),x=RegExp(a,"g"),j=RegExp([b+"?"+s+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[c,b,"$"].join("|")+")",m+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[c,b+h,"$"].join("|")+")",b+"?"+h+"+(?:['’](?:d|ll|m|re|s|t|ve))?",b+"+(?:['’](?:D|LL|M|RE|S|T|VE))?",f,w].join("|"),"g"),S=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_="object"==typeof t&&t&&t.Object===Object&&t,E="object"==typeof self&&self&&self.Object===Object&&self,P=_||E||Function("return this")();var R,k=(R={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},function(e){return null==R?void 0:R[e]});var A=Object.prototype.toString,I=P.Symbol,L=I?I.prototype:void 0,T=L?L.toString:void 0;function C(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&A.call(e)==r}(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-n?"-0":t}function z(e){return null==e?"":C(e)}var $,U=($=function(e,t,n){return e+(n?"-":"")+t.toLowerCase()},function(e){return function(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}(function(e,t,n){return e=z(e),void 0===(t=n?void 0:t)?function(e){return S.test(e)}(e)?function(e){return e.match(j)||[]}(e):function(e){return e.match(o)||[]}(e):e.match(t)||[]}(function(e){return(e=z(e))&&e.replace(i,k).replace(x,"")}(e).replace(O,"")),$,"")});e.exports=U}).call(this,n(7))},function(e,t,n){"use strict";

@license MIT
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a<arguments.length;a++){for(var f in n=Object(arguments[a]))o.call(n,f)&&(c[f]=n[f]);if(r){u=r(n);for(var l=0;l<u.length;l++)i.call(n,u[l])&&(c[u[l]]=n[u[l]])}}return c}},function(e,t,n){"use strict";var r=n(6);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,u){if(u!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1),u=n.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f(e,t,n[t])})}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=o.a.createContext(!0),b=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(o=s(t).call(this,e))||"object"!==c(o)&&"function"!=typeof o?p(r):o).state={isLoaded:!1,supports:{webp:!1}},n.supportsWebp=n.supportsWebp.bind(p(n)),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,o.a.Component),n=t,(r=[{key:"supportsWebp",value:function(){if(!self.createImageBitmap)return!1;return fetch("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=").then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e).then(function(){return!0},function(){return!1})})}},{key:"componentDidMount",value:function(){this.setState({supports:a({},this.state.supports,{webp:this.supportsWebp()}),isLoaded:!0})}},{key:"render",value:function(){var e=this.state,t=(e.isLoaded,e.supports),n=this.props,r=n.domain,i=void 0===r?"https://cdn.tueri.io":r,u=n.accountId,c=n.children;return o.a.createElement(y.Provider,{value:{domain:i,accountId:u,supports:t}},c)}}])&&l(n.prototype,r),i&&l(n,i),t}();b.propTypes={domain:u.a.string,accountId:u.a.string,children:u.a.any};var h=n(2),m=n.n(h);function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var S=function(e){function t(e){var n,r,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(i=O(t).call(this,e))||"object"!==g(i)&&"function"!=typeof i?x(r):i).state={isInViewport:!1,width:0,height:0,lqipLoaded:!1,fullsizeLoaded:!1},n.imgRef=o.a.createRef(),n.window="undefined"!=typeof window&&window,n.handleScroll=n.handleScroll.bind(x(n)),n.handleResize=n.handleResize.bind(x(n)),n.isInViewport=n.isInViewport.bind(x(n)),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,o.a.Component),n=t,(r=[{key:"isInViewport",value:function(){var e=this.window.innerHeight,t=this.imgRef.current.getBoundingClientRect().top;return e*("number"==typeof this.props.buffer&&this.props.buffer>1&&this.props.buffer<10?this.props.buffer:1.5)>t}},{key:"handleScroll",value:function(){this.imgRef.current&&!this.state.lqipLoaded&&this.setState({isInViewport:this.isInViewport()})}},{key:"handleResize",value:function(){if(this.imgRef.current){var e=this.imgRef.current.clientWidth,t=this.state.width,n=Math.abs(e-t)/t*100,r=this.isInViewport();n>=10&&this.setState({width:e,lqipLoaded:!1,fullsizeLoaded:r,isInViewport:r})}}},{key:"componentDidMount",value:function(){var e=this.imgRef.current.clientWidth;this.setState({width:e,isInViewport:this.isInViewport()}),this.window.addEventListener("scroll",this.handleScroll),this.window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){this.window.removeEventListener("scroll",this.handleScroll),this.window.removeEventListener("resize",this.handleResize)}},{key:"render",value:function(){var e=this,t=this.props,n=t.src,r=t.alt,i=t.options,u=void 0===i?{}:i,c=t.ext,a=void 0===c?"jpg":c,f=t.domain,l=t.supports,s=this.state,p=s.isInViewport,d=s.width,y=s.height,b=s.fullsizeLoaded,h=n.split("/"),v=h.length>1?h[3]:n,g=6===h.length?n:"".concat(f,"/").concat(v,"/").concat(m()(r||j),".").concat(a),w="";u.w=u.w||d,!u.fm&&l.webp&&(u.fm="webp"),Object.keys(u).map(function(e,t){return w+="".concat(t<1?"?":"&").concat(e,"=").concat(u[e])});var O=w.replace("w=".concat(d),"w=".concat(Math.round(.1*d)));y&&O.replace("h=".concat(y),"w=".concat(Math.round(.1*y)));var x={figure:{position:"relative",margin:0},lqip:{width:"100%",filter:"blur(5px)",opacity:1,transition:"all 0.5s ease-in"},fullsize:{position:"absolute",top:"0px",left:"0px",width:"100%",transition:"all 0.5s ease-in"}};b&&(x.lqip.opacity=0);var j="ALT TEXT IS REQUIRED";return o.a.createElement("figure",{style:x.figure,ref:this.imgRef},p&&d>0?o.a.createElement(o.a.Fragment,null,o.a.createElement("img",{onLoad:function(){e.setState({fullsizeLoaded:!0})},style:x.fullsize,src:"".concat(g).concat(w),alt:r||j}),o.a.createElement("img",{onLoad:function(){e.setState({lqipLoaded:!0})},style:x.lqip,src:"".concat(g).concat(O),alt:r||j})):null)}}])&&w(n.prototype,r),i&&w(n,i),t}();S.propTypes={src:u.a.string.isRequired,alt:u.a.string.isRequired,options:u.a.object,ext:u.a.string,buffer:u.a.number};var _=function(e){return o.a.createElement(y.Consumer,null,function(t){return o.a.createElement(S,v({},e,t))})};n.d(t,"Img",function(){return _});t.default=b}]);
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a<arguments.length;a++){for(var f in n=Object(arguments[a]))o.call(n,f)&&(c[f]=n[f]);if(r){u=r(n);for(var l=0;l<u.length;l++)i.call(n,u[l])&&(c[u[l]]=n[u[l]])}}return c}},function(e,t,n){"use strict";var r=n(6);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,u){if(u!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1),u=n.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f(e,t,n[t])})}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=o.a.createContext(!0),b=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(o=s(t).call(this,e))||"object"!==c(o)&&"function"!=typeof o?p(r):o).state={isLoaded:!1,supports:{webp:!1}},n.supportsWebp=n.supportsWebp.bind(p(n)),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,o.a.Component),n=t,(r=[{key:"supportsWebp",value:function(){if(!self.createImageBitmap)return!1;return fetch("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=").then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e).then(function(){return!0},function(){return!1})})}},{key:"componentDidMount",value:function(){this.setState({supports:a({},this.state.supports,{webp:this.supportsWebp()}),isLoaded:!0})}},{key:"render",value:function(){var e=this.state,t=(e.isLoaded,e.supports),n=this.props,r=n.domain,i=void 0===r?"https://cdn.tueri.io":r,u=n.accountId,c=n.children;return o.a.createElement(y.Provider,{value:{domain:i,accountId:u,supports:t}},c)}}])&&l(n.prototype,r),i&&l(n,i),t}();b.propTypes={domain:u.a.string,accountId:u.a.string,children:u.a.any};var h=n(2),m=n.n(h);function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var S=function(e){function t(e){var n,r,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,(n=!(i=O(t).call(this,e))||"object"!==g(i)&&"function"!=typeof i?x(r):i).state={isInViewport:!1,width:0,height:0,lqipLoaded:!1,fullsizeLoaded:!1},n.imgRef=o.a.createRef(),n.window="undefined"!=typeof window&&window,n.handleScroll=n.handleScroll.bind(x(n)),n.handleResize=n.handleResize.bind(x(n)),n.isInViewport=n.isInViewport.bind(x(n)),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,o.a.Component),n=t,(r=[{key:"isInViewport",value:function(){var e=this.window.innerHeight,t=this.imgRef.current.getBoundingClientRect().top;return e*("number"==typeof this.props.buffer&&this.props.buffer>1&&this.props.buffer<10?this.props.buffer:1.5)>t}},{key:"handleScroll",value:function(){this.imgRef.current&&!this.state.lqipLoaded&&this.setState({isInViewport:this.isInViewport()})}},{key:"handleResize",value:function(){if(this.imgRef.current){var e=this.imgRef.current.clientWidth,t=this.state.width,n=Math.abs(e-t)/t*100,r=this.isInViewport();n>=10&&this.setState({width:e,lqipLoaded:!1,fullsizeLoaded:r,isInViewport:r})}}},{key:"componentDidMount",value:function(){var e=this.imgRef.current.clientWidth;this.setState({width:e,isInViewport:this.isInViewport()}),this.window.addEventListener("scroll",this.handleScroll),this.window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){this.window.removeEventListener("scroll",this.handleScroll),this.window.removeEventListener("resize",this.handleResize)}},{key:"render",value:function(){var e=this,t=this.props,n=t.src,r=t.alt,i=t.options,u=void 0===i?{}:i,c=t.ext,a=void 0===c?"jpg":c,f=t.domain,l=t.supports,s=this.state,p=s.isInViewport,d=s.width,y=s.fullsizeLoaded,b=n.split("/"),h=b.length>1?b[3]:n,v=6===b.length?n:"".concat(f,"/").concat(h,"/").concat(m()(r||x),".").concat(a),g="";u.w=u.w||d,!u.fm&&l.webp&&(u.fm="webp"),Object.keys(u).map(function(e,t){return g+="".concat(t<1?"?":"&").concat(e,"=").concat(u[e])});var w=g.replace("w=".concat(d),"w=".concat(Math.round(.1*d)));new RegExp("h=").test(w)&&w.replace("h=".concat(height),"h=".concat(Math.round(.1*height)));var O={figure:{position:"relative",margin:0},lqip:{width:"100%",filter:"blur(5px)",opacity:1,transition:"all 0.5s ease-in"},fullsize:{position:"absolute",top:"0px",left:"0px",width:"100%",transition:"all 0.5s ease-in"}};y&&(O.lqip.opacity=0);var x="ALT TEXT IS REQUIRED";return o.a.createElement("figure",{style:O.figure,ref:this.imgRef},p&&d>0?o.a.createElement(o.a.Fragment,null,o.a.createElement("img",{onLoad:function(){e.setState({fullsizeLoaded:!0})},style:O.fullsize,src:"".concat(v).concat(g),alt:r||x}),o.a.createElement("img",{onLoad:function(){e.setState({lqipLoaded:!0})},style:O.lqip,src:"".concat(v).concat(w),alt:r||x})):null)}}])&&w(n.prototype,r),i&&w(n,i),t}();S.propTypes={src:u.a.string.isRequired,alt:u.a.string.isRequired,options:u.a.object,ext:u.a.string,buffer:u.a.number};var _=function(e){return o.a.createElement(y.Consumer,null,function(t){return o.a.createElement(S,v({},e,t))})};n.d(t,"Img",function(){return _});t.default=b}]);
{
"name": "@tueri/react",
"version": "1.2.6",
"version": "1.2.7",
"description": "Tueri integration for ReactJS",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc