react-resize-aware
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -1,2 +0,2 @@ | ||
import{useEffect as e,useRef as n,createElement as t,useState as r,useCallback as o,useMemo as i}from"react";var u={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},c=function(r){var o=r.onResize,i=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function o(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?o():n.current&&n.current.addEventListener&&n.current.addEventListener("load",o),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(i,(function(){return o(i)})),t("iframe",{style:u,src:"about:blank",ref:i,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},f=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=f);var n=r(e(null)),u=n[0],a=n[1],d=o((function(n){return a(e(n.current))}),[e]);return[i((function(){return t(c,{onResize:d})}),[d]),u]} | ||
import{useEffect as e,useRef as n,useState as t,useCallback as r,useMemo as o}from"react";var i={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},u=function(t){var r=t.onResize,o=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function o(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?o():n.current&&n.current.addEventListener&&n.current.addEventListener("load",o),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(o,(function(){return r(o)})),jsx("iframe",{style:i,src:"about:blank",ref:o,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},c=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=c);var n=t(e(null)),i=n[0],f=n[1],a=r((function(n){return f(e(n.current))}),[e]);return[o((function(){return jsx(u,{onResize:a})}),[a]),i]} | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var e=require("react"),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]}; | ||
var e=require("react"),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),jsx("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return jsx(t,{onResize:c})}),[c]),o]}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{useEffect as e,useRef as n,createElement as t,useState as r,useCallback as o,useMemo as i}from"react";var u={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},c=function(r){var o=r.onResize,i=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function o(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?o():n.current&&n.current.addEventListener&&n.current.addEventListener("load",o),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(i,(function(){return o(i)})),t("iframe",{style:u,src:"about:blank",ref:i,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},f=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=f);var n=r(e(null)),u=n[0],a=n[1],d=o((function(n){return a(e(n.current))}),[e]);return[i((function(){return t(c,{onResize:d})}),[d]),u]} | ||
import{useEffect as e,useRef as n,useState as t,useCallback as r,useMemo as o}from"react";var i={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},u=function(t){var r=t.onResize,o=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function o(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?o():n.current&&n.current.addEventListener&&n.current.addEventListener("load",o),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(o,(function(){return r(o)})),jsx("iframe",{style:i,src:"about:blank",ref:o,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},c=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=c);var n=t(e(null)),i=n[0],f=n[1],a=r((function(n){return f(e(n.current))}),[e]);return[o((function(){return jsx(u,{onResize:a})}),[a]),i]} | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e=e||self).useResizeAware=n(e.React)}(this,(function(e){var n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};return function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]}})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e=e||self).useResizeAware=n(e.react)}(this,(function(e){var n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),jsx("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};return function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],f=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return jsx(t,{onResize:f})}),[f]),o]}})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "react-resize-aware", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A React hook that makes it possible to listen to element resize events.", | ||
@@ -31,3 +31,3 @@ "homepage": "https://github.com/FezVrasta/react-resize-aware#readme", | ||
"start": "microbundle watch", | ||
"prepare": "microbundle --name useResizeAware --globals react=React --jsx React.createElement && cp -f dist/index.umd.js docs/react-resize-aware.js && flow-copy-source src dist && cp src/index.d.ts dist/index.d.ts" | ||
"prepare": "microbundle --name useResizeAware --jsx jsx --jsxImportSource react --globals react/jsx-runtime=jsx && cp -f dist/index.umd.js docs/react-resize-aware.js && flow-copy-source src dist && cp src/index.d.ts dist/index.d.ts" | ||
}, | ||
@@ -45,4 +45,4 @@ "files": [ | ||
"peerDependencies": { | ||
"react": "^16.8.0 || 17.x" | ||
"react": "^16.8.0 || 17.x || 18.x" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32515
21
120