@zag-js/interact-outside 1.37.0 → 1.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -95,7 +95,14 @@ function trackInteractOutsideImpl(node, options) {
|
|
|
95
95
|
}
|
|
96
96
|
const pointerdownCleanups = /* @__PURE__ */ new Set();
|
|
97
97
|
const isInShadowRoot = (0, import_dom_query.isShadowRoot)(node?.getRootNode());
|
|
98
|
+
let isPointerDown = false;
|
|
98
99
|
function onPointerDown(event) {
|
|
100
|
+
isPointerDown = true;
|
|
101
|
+
const onPointerUp = () => {
|
|
102
|
+
isPointerDown = false;
|
|
103
|
+
};
|
|
104
|
+
doc.addEventListener("pointerup", onPointerUp, { once: true });
|
|
105
|
+
win.addEventListener("pointerup", onPointerUp, { once: true });
|
|
99
106
|
function handler(clickEvent) {
|
|
100
107
|
const func = defer && !(0, import_dom_query.isTouchDevice)() ? import_dom_query2.raf : (v) => v();
|
|
101
108
|
const evt = clickEvent ?? event;
|
|
@@ -135,6 +142,7 @@ function trackInteractOutsideImpl(node, options) {
|
|
|
135
142
|
cleanups.add(frames.addEventListener("pointerdown", onPointerDown, true));
|
|
136
143
|
}, 0);
|
|
137
144
|
function onFocusin(event) {
|
|
145
|
+
if (isPointerDown) return;
|
|
138
146
|
const func = defer ? import_dom_query2.raf : (v) => v();
|
|
139
147
|
func(() => {
|
|
140
148
|
const composedPath = event?.composedPath?.() ?? [event?.target];
|
package/dist/index.mjs
CHANGED
|
@@ -81,7 +81,14 @@ function trackInteractOutsideImpl(node, options) {
|
|
|
81
81
|
}
|
|
82
82
|
const pointerdownCleanups = /* @__PURE__ */ new Set();
|
|
83
83
|
const isInShadowRoot = isShadowRoot(node?.getRootNode());
|
|
84
|
+
let isPointerDown = false;
|
|
84
85
|
function onPointerDown(event) {
|
|
86
|
+
isPointerDown = true;
|
|
87
|
+
const onPointerUp = () => {
|
|
88
|
+
isPointerDown = false;
|
|
89
|
+
};
|
|
90
|
+
doc.addEventListener("pointerup", onPointerUp, { once: true });
|
|
91
|
+
win.addEventListener("pointerup", onPointerUp, { once: true });
|
|
85
92
|
function handler(clickEvent) {
|
|
86
93
|
const func = defer && !isTouchDevice() ? raf : (v) => v();
|
|
87
94
|
const evt = clickEvent ?? event;
|
|
@@ -121,6 +128,7 @@ function trackInteractOutsideImpl(node, options) {
|
|
|
121
128
|
cleanups.add(frames.addEventListener("pointerdown", onPointerDown, true));
|
|
122
129
|
}, 0);
|
|
123
130
|
function onFocusin(event) {
|
|
131
|
+
if (isPointerDown) return;
|
|
124
132
|
const func = defer ? raf : (v) => v();
|
|
125
133
|
func(() => {
|
|
126
134
|
const composedPath = event?.composedPath?.() ?? [event?.target];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/interact-outside",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.1",
|
|
4
4
|
"description": "Track interactions or focus outside an element",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@zag-js/dom-query": "1.
|
|
20
|
-
"@zag-js/utils": "1.
|
|
19
|
+
"@zag-js/dom-query": "1.38.1",
|
|
20
|
+
"@zag-js/utils": "1.38.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"clean-package": "2.2.0"
|