Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-presence

Package Overview
Dependencies
Maintainers
5
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-presence - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

2

dist/index.js

@@ -1,2 +0,2 @@

var e,n,t=require("@radix-ui/react-compose-refs").useComposedRefs,r=(e={},n=require("react"),Object.keys(n).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),e);const u=e=>{const{present:n,children:u}=e,s=function(e){const[n,t]=r.useState(),u=r.useRef({}),s=r.useRef(e),i=r.useRef(),c=e?"mounted":"unmounted",[a,d]=function(e,n){return r.useReducer(((e,t)=>{const r=n[e][t];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const n=u.current,t=s.current;if(t!==e){const r=i.current,u=o(n);if(e)d("MOUNT");else if("none"===u||"none"===(null==n?void 0:n.display))d("UNMOUNT");else{const e=r!==u;d(t&&e?"ANIMATION_OUT":"UNMOUNT")}s.current=e}}),[e,d]),r.useEffect((()=>{if(n){const e=e=>{const t=o(u.current).includes(e.animationName);e.target===n&&t&&d("ANIMATION_END")},t=e=>{e.target===n&&(i.current=o(u.current))};return n.addEventListener("animationstart",t),n.addEventListener("animationcancel",e),n.addEventListener("animationend",e),()=>{n.removeEventListener("animationstart",t),n.removeEventListener("animationcancel",e),n.removeEventListener("animationend",e)}}}),[n,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:r.useCallback((e=>{e&&(u.current=getComputedStyle(e),t(e))}),[])}}(n),i="function"==typeof u?u({present:s.isPresent}):r.Children.only(u),c=t(s.ref,i.ref);return"function"==typeof u||s.isPresent?r.cloneElement(i,{ref:c}):null};function o(e){return(null==e?void 0:e.animationName)||"none"}exports.Presence=u,u.displayName="Presence";
var e,n,t=require("@radix-ui/react-compose-refs").useComposedRefs,r=(e={},n=require("react"),Object.keys(n).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),e);const u=e=>{const{present:n,children:u}=e,s=function(e){const[n,t]=r.useState(),u=r.useRef({}),s=r.useRef(e),i=r.useRef(),c=e?"mounted":"unmounted",[a,d]=function(e,n){return r.useReducer(((e,t)=>{const r=n[e][t];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const n=u.current,t=s.current;if(t!==e){const r=i.current,u=o(n);if(e)d("MOUNT");else if("none"===u||"none"===(null==n?void 0:n.display))d("UNMOUNT");else{const e=r!==u;d(t&&e?"ANIMATION_OUT":"UNMOUNT")}s.current=e}}),[e,d]),r.useEffect((()=>{if(n){const e=e=>{const t=o(u.current).includes(e.animationName);e.target===n&&t&&d("ANIMATION_END")},t=e=>{e.target===n&&(i.current=o(u.current))};return n.addEventListener("animationstart",t),n.addEventListener("animationcancel",e),n.addEventListener("animationend",e),()=>{n.removeEventListener("animationstart",t),n.removeEventListener("animationcancel",e),n.removeEventListener("animationend",e)}}}),[n,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:r.useCallback((e=>{e&&(u.current=getComputedStyle(e),t(e))}),[])}}(n),i="function"==typeof u?u({present:s.isPresent}):r.Children.only(u),c=t(s.ref,i.ref);return"function"==typeof u||s.isPresent?/*#__PURE__*/r.cloneElement(i,{ref:c}):null};function o(e){return(null==e?void 0:e.animationName)||"none"}exports.Presence=u,u.displayName="Presence";
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{useComposedRefs as e}from"@radix-ui/react-compose-refs";import*as n from"react";export const Presence=r=>{const{present:u,children:o}=r,s=function(e){const[r,u]=n.useState(),o=n.useRef({}),s=n.useRef(e),i=n.useRef(),c=e?"mounted":"unmounted",[a,d]=function(e,t){return n.useReducer(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect((()=>{const n=o.current,r=s.current;if(r!==e){const u=i.current,o=t(n);if(e)d("MOUNT");else if("none"===o||"none"===(null==n?void 0:n.display))d("UNMOUNT");else{const e=u!==o;d(r&&e?"ANIMATION_OUT":"UNMOUNT")}s.current=e}}),[e,d]),n.useEffect((()=>{if(r){const e=e=>{const n=t(o.current).includes(e.animationName);e.target===r&&n&&d("ANIMATION_END")},n=e=>{e.target===r&&(i.current=t(o.current))};return r.addEventListener("animationstart",n),r.addEventListener("animationcancel",e),r.addEventListener("animationend",e),()=>{r.removeEventListener("animationstart",n),r.removeEventListener("animationcancel",e),r.removeEventListener("animationend",e)}}}),[r,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:n.useCallback((e=>{e&&(o.current=getComputedStyle(e),u(e))}),[])}}(u),i="function"==typeof o?o({present:s.isPresent}):n.Children.only(o),c=e(s.ref,i.ref);return"function"==typeof o||s.isPresent?n.cloneElement(i,{ref:c}):null};function t(e){return(null==e?void 0:e.animationName)||"none"}Presence.displayName="Presence";
import{useComposedRefs as e}from"@radix-ui/react-compose-refs";import*as n from"react";export const Presence=r=>{const{present:u,children:o}=r,s=function(e){const[r,u]=n.useState(),o=n.useRef({}),s=n.useRef(e),i=n.useRef(),c=e?"mounted":"unmounted",[a,d]=function(e,t){return n.useReducer(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect((()=>{const n=o.current,r=s.current;if(r!==e){const u=i.current,o=t(n);if(e)d("MOUNT");else if("none"===o||"none"===(null==n?void 0:n.display))d("UNMOUNT");else{const e=u!==o;d(r&&e?"ANIMATION_OUT":"UNMOUNT")}s.current=e}}),[e,d]),n.useEffect((()=>{if(r){const e=e=>{const n=t(o.current).includes(e.animationName);e.target===r&&n&&d("ANIMATION_END")},n=e=>{e.target===r&&(i.current=t(o.current))};return r.addEventListener("animationstart",n),r.addEventListener("animationcancel",e),r.addEventListener("animationend",e),()=>{r.removeEventListener("animationstart",n),r.removeEventListener("animationcancel",e),r.removeEventListener("animationend",e)}}}),[r,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:n.useCallback((e=>{e&&(o.current=getComputedStyle(e),u(e))}),[])}}(u),i="function"==typeof o?o({present:s.isPresent}):n.Children.only(o),c=e(s.ref,i.ref);return"function"==typeof o||s.isPresent?/*#__PURE__*/n.cloneElement(i,{ref:c}):null};function t(e){return(null==e?void 0:e.animationName)||"none"}Presence.displayName="Presence";
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-presence",
"version": "0.0.12",
"version": "0.0.13",
"license": "MIT",

@@ -21,3 +21,3 @@ "source": "src/index.ts",

"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "0.0.4"
"@radix-ui/react-compose-refs": "0.0.5"
},

@@ -24,0 +24,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc