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

@zag-js/interact-outside

Package Overview
Dependencies
Maintainers
1
Versions
817
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/interact-outside - npm Package Compare versions

Comparing version 0.0.0-dev-20220616105639 to 0.0.0-dev-20220616113129

71

dist/index.js

@@ -33,70 +33,9 @@ "use strict";

};
var noop = () => {
};
function getListenerElements() {
;
globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
return globalThis.__listenerElements__;
}
function getListenerCache() {
;
globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
return globalThis.__listenerCache__;
}
function addGlobalEventListener(node, type, handler, options) {
var _a;
if (!node)
return noop;
const hash = JSON.stringify({ type, options });
const listenerElements = getListenerElements();
const listenerCache = getListenerCache();
const group = listenerElements.get(node);
if (!listenerElements.has(node)) {
const group2 = /* @__PURE__ */ new Map([[hash, /* @__PURE__ */ new Set([handler])]]);
listenerElements.set(node, group2);
} else if (group == null ? void 0 : group.has(hash)) {
(_a = group == null ? void 0 : group.get(hash)) == null ? void 0 : _a.add(handler);
} else {
group == null ? void 0 : group.set(hash, /* @__PURE__ */ new Set([handler]));
}
function attach(node2) {
var _a2, _b;
function listener(event) {
var _a3;
const group2 = listenerElements.get(node2);
(_a3 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a3.forEach((fn) => fn(event));
}
if (!(listenerCache == null ? void 0 : listenerCache.has(node2))) {
listenerCache.set(node2, /* @__PURE__ */ new Map([[hash, listener]]));
node2.addEventListener(type, listener, options);
return;
}
if (!((_a2 = listenerCache == null ? void 0 : listenerCache.get(node2)) == null ? void 0 : _a2.has(hash))) {
(_b = listenerCache.get(node2)) == null ? void 0 : _b.set(hash, listener);
node2.addEventListener(type, listener, options);
}
}
attach(node);
return function remove() {
var _a2, _b, _c, _d;
if (!listenerElements.has(node))
return;
const group2 = listenerElements.get(node);
(_a2 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a2.delete(handler);
if (((_b = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _b.size) === 0) {
const listener = (_c = listenerCache.get(node)) == null ? void 0 : _c.get(hash);
node.removeEventListener(type, listener, options);
group2 == null ? void 0 : group2.delete(hash);
(_d = listenerCache.get(node)) == null ? void 0 : _d.delete(hash);
if ((group2 == null ? void 0 : group2.size) === 0) {
listenerElements.delete(node);
listenerCache.delete(node);
}
}
};
}
var isRef = (v) => hasProp(v, "current");
function addDomEvent(target, event, listener, options) {
function addDomEvent(target, eventName, handler, options) {
const node = isRef(target) ? target.current : runIfFn(target);
return addGlobalEventListener(node, event, listener, options);
node == null ? void 0 : node.addEventListener(eventName, handler, options);
return () => {
node == null ? void 0 : node.removeEventListener(eventName, handler, options);
};
}

@@ -103,0 +42,0 @@ function isWindow(value) {

4

package.json
{
"name": "@zag-js/interact-outside",
"version": "0.0.0-dev-20220616105639",
"version": "0.0.0-dev-20220616113129",
"description": "Track interations or focus outside an element",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"@zag-js/dom-utils": "0.0.0-dev-20220616105639"
"@zag-js/dom-utils": "0.0.0-dev-20220616113129"
},

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

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