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.11 to 0.0.12

2

dist/index.d.ts

@@ -6,4 +6,4 @@ import { ConnectableElement, ReadonlySignal } from '@aria-ui/core';

*/
declare function usePresence(element: ConnectableElement, present: ReadonlySignal<boolean>): void;
declare function usePresence(element: ConnectableElement, open: ReadonlySignal<boolean>): ReadonlySignal<boolean>;
export { usePresence };
// src/use-presence.ts
import {
createSignal,
useEffect,

@@ -7,6 +8,6 @@ useEventListener

import { getEventTarget } from "@zag-js/dom-query";
function usePresence(element, present) {
function usePresence(element, open) {
const visible = createSignal(open.peek());
useEffect(element, () => {
const initialPresent = present.peek();
if (initialPresent) {
if (visible.get()) {
show(element);

@@ -17,18 +18,15 @@ } else {

});
const handleAnimationEnd = (event) => {
if (getAnimationName(element).includes(event.animationName) && getEventTarget(event) === element && !present.peek()) {
hide(element);
useEffect(element, () => {
if (open.get()) {
visible.set(true);
} else if (getAnimationName(element) === "none") {
visible.set(false);
}
};
useEffect(element, () => handlePresentChange(element, present.get()));
useEventListener(element, "animationend", handleAnimationEnd);
}
function handlePresentChange(element, present) {
if (present) {
show(element);
} else {
if (getAnimationName(element) === "none") {
hide(element);
});
useEventListener(element, "animationend", (event) => {
if (getAnimationName(element).includes(event.animationName) && getEventTarget(event) === element && !open.peek()) {
visible.set(false);
}
}
});
return visible;
}

@@ -35,0 +33,0 @@ function getAnimationName(element) {

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

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

"@aria-ui/core": "^0.0.16",
"@zag-js/dom-query": "^0.58.0"
"@zag-js/dom-query": "^0.59.0"
},
"devDependencies": {
"tsup": "^8.1.0",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
},

@@ -20,0 +20,0 @@ "publishConfig": {

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