@radix-ui/react-use-body-pointer-events
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
var e=require("@radix-ui/react-use-layout-effect").useLayoutEffect;let t,n=0;exports.useBodyPointerEvents=function({disabled:o}){e((()=>{if(o)return 0===n&&(t=document.body.style.pointerEvents),document.body.style.pointerEvents="none",n++,()=>{n--,0===n&&(document.body.style.pointerEvents=t)}}),[o])}; | ||
var e,t,n=require("@radix-ui/react-use-layout-effect").useLayoutEffect,r=(e={},t=require("react"),Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e);let o,u=0;exports.useBodyPointerEvents=function({disabled:e}){const t=r.useRef(!1),c=r.useRef(!1);r.useEffect((()=>{const e=e=>{const n="mouse"===e.pointerType;t.current=!n,c.current=n&&0===e.button},n=()=>{t.current=!1,c.current=!1};return document.addEventListener("pointerdown",e),document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("pointerup",n)}}),[]),n((()=>{if(e){function n(){0===u&&(document.body.style.pointerEvents=o)}return 0===u&&(o=document.body.style.pointerEvents),document.body.style.pointerEvents="none",u++,()=>{u--,t.current?document.addEventListener("click",n,{once:!0}):c.current?document.addEventListener("pointerup",n,{once:!0}):n()}}}),[e])}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{useLayoutEffect as e}from"@radix-ui/react-use-layout-effect";let t,o=0;export function useBodyPointerEvents({disabled:n}){e((()=>{if(n)return 0===o&&(t=document.body.style.pointerEvents),document.body.style.pointerEvents="none",o++,()=>{o--,0===o&&(document.body.style.pointerEvents=t)}}),[n])} | ||
import{useLayoutEffect as e}from"@radix-ui/react-use-layout-effect";import*as t from"react";let n,o=0;export function useBodyPointerEvents({disabled:r}){const u=t.useRef(!1),c=t.useRef(!1);t.useEffect((()=>{const e=e=>{const t="mouse"===e.pointerType;u.current=!t,c.current=t&&0===e.button},t=()=>{u.current=!1,c.current=!1};return document.addEventListener("pointerdown",e),document.addEventListener("pointerup",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("pointerup",t)}}),[]),e((()=>{if(r){function e(){0===o&&(document.body.style.pointerEvents=n)}return 0===o&&(n=document.body.style.pointerEvents),document.body.style.pointerEvents="none",o++,()=>{o--,u.current?document.addEventListener("click",e,{once:!0}):c.current?document.addEventListener("pointerup",e,{once:!0}):e()}}}),[r])} | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-use-body-pointer-events", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "source": "src/index.ts", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
13822
14
2