react-resize-aware
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
import{useEffect as e,useRef as n,createElement as t,useState as r,useCallback as i,useMemo as o}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 i=r.onResize,o=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function i(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?i():n.current&&n.current.addEventListener&&n.current.addEventListener("load",i),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(o,(function(){return i(o)})),t("iframe",{style:u,src:"about:blank",ref:o,"aria-hidden":!0,"aria-label":"resize-listener",tabIndex:-1,frameBorder:0})},a=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=a);var n=r(e(null)),u=n[0],f=n[1],l=i((function(n){return f(e(n.current))}),[e]);return[o((function(){return t(c,{onResize:l})}),[l]),u]} | ||
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]} | ||
//# 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,"aria-label":"resize-listener",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)),i=u[0],o=u[1],c=e.useCallback((function(e){return o(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),i]}; | ||
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]}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{useEffect as e,useRef as n,createElement as t,useState as r,useCallback as i,useMemo as o}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 i=r.onResize,o=n();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function i(){t();var e=r();e&&e.addEventListener("resize",t)}e((function(){return r()?i():n.current&&n.current.addEventListener&&n.current.addEventListener("load",i),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(o,(function(){return i(o)})),t("iframe",{style:u,src:"about:blank",ref:o,"aria-hidden":!0,"aria-label":"resize-listener",tabIndex:-1,frameBorder:0})},a=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};export default function(e){void 0===e&&(e=a);var n=r(e(null)),u=n[0],f=n[1],l=i((function(n){return f(e(n.current))}),[e]);return[o((function(){return t(c,{onResize:l})}),[l]),u]} | ||
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]} | ||
//# 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,i=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function i(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?i():n.current&&n.current.addEventListener&&n.current.addEventListener("load",i),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(i,(function(){return r(i)})),e.createElement("iframe",{style:n,src:"about:blank",ref:i,"aria-hidden":!0,"aria-label":"resize-listener",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 i=e.useState(n(null)),u=i[0],o=i[1],c=e.useCallback((function(e){return o(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),u]}})); | ||
!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]}})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "react-resize-aware", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A React hook that makes it possible to listen to element resize events.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/FezVrasta/react-resize-aware#readme", |
@@ -5,3 +5,3 @@ # react-resize-aware | ||
`react-resize-aware` is a zero dependency, **~400 bytes** [React Hook](https://reactjs.org/docs/hooks-reference.html) you can use to detect resize events without relying on intervals, loops, DOM manipulation detection or CSS redraws. | ||
`react-resize-aware` is a zero dependency, **~600 bytes** [React Hook](https://reactjs.org/docs/hooks-reference.html) you can use to detect resize events without relying on intervals, loops, DOM manipulation detection or CSS redraws. | ||
@@ -17,3 +17,3 @@ **It takes advantage of the `resize` event on the `HTMLObjectElement`, works on any browser I know of, and it's super lightweight.** | ||
``` | ||
yarn add react-resize-aware@3.0.0-beta.4 | ||
yarn add react-resize-aware | ||
``` | ||
@@ -24,3 +24,3 @@ | ||
``` | ||
npm install --save react-resize-aware@3.0.0-beta.4 | ||
npm install --save react-resize-aware | ||
``` | ||
@@ -27,0 +27,0 @@ |
@@ -34,3 +34,2 @@ // @flow | ||
aria-hidden={true} | ||
aria-label="resize-listener" | ||
tabIndex={-1} | ||
@@ -37,0 +36,0 @@ frameBorder={0} |
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
Sorry, the diff of this file is not supported yet
33195
119