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

@aria-ui/presence

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aria-ui/presence - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

29

dist/index.js
// src/use-presence.ts
import {
createSignal,
useEffect,
useEventListener
useEffect
} from "@aria-ui/core";
import { getEventTarget } from "@zag-js/dom-query";
function usePresence(element, open) {

@@ -20,16 +18,25 @@ const visible = createSignal(open.peek());

visible.set(true);
} else if (getAnimationName(element) === "none") {
visible.set(false);
return;
}
});
useEventListener(element, "animationend", (event) => {
if (getAnimationName(element).includes(event.animationName) && getEventTarget(event) === element && !open.peek()) {
const animations = element.getAnimations();
if (animations.length === 0) {
visible.set(false);
return;
}
let canceled = false;
Promise.all(animations.map((animation) => animation.finished)).then(() => {
if (!canceled) {
visible.set(false);
}
}).catch((error) => {
throw new Error("[aria-ui] Failed to wait for animation to finish", {
cause: error
});
});
return () => {
canceled = true;
};
});
return visible;
}
function getAnimationName(element) {
return getComputedStyle(element).animationName || "none";
}
function show(element) {

@@ -36,0 +43,0 @@ if (element.style.display === "none") {

{
"name": "@aria-ui/presence",
"type": "module",
"version": "0.0.15",
"version": "0.0.16",
"private": false,

@@ -18,7 +18,7 @@ "sideEffects": false,

"dependencies": {
"@zag-js/dom-query": "^0.74.2",
"@zag-js/dom-query": "^0.77.0",
"@aria-ui/core": "^0.0.19"
},
"devDependencies": {
"tsup": "^8.3.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3"

@@ -25,0 +25,0 @@ },

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