@zag-js/interact-outside 0.0.0-dev-20220706194607 → 0.0.0-dev-20220709094240
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 +7 -1
- package/dist/index.mjs +7 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -39,6 +39,9 @@ function getPlatform() {
|
|
|
39
39
|
var pt = (v) => isDom() && v.test(getPlatform());
|
|
40
40
|
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
41
41
|
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
42
|
+
function isDocument(el) {
|
|
43
|
+
return el.nodeType === Node.DOCUMENT_NODE;
|
|
44
|
+
}
|
|
42
45
|
function isWindow(value) {
|
|
43
46
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
44
47
|
}
|
|
@@ -46,6 +49,8 @@ function getDocument(el) {
|
|
|
46
49
|
var _a;
|
|
47
50
|
if (isWindow(el))
|
|
48
51
|
return el.document;
|
|
52
|
+
if (isDocument(el))
|
|
53
|
+
return el;
|
|
49
54
|
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
50
55
|
}
|
|
51
56
|
function getWindow(el) {
|
|
@@ -76,7 +81,8 @@ var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaK
|
|
|
76
81
|
function fireCustomEvent(el, type, init) {
|
|
77
82
|
if (!el)
|
|
78
83
|
return;
|
|
79
|
-
const
|
|
84
|
+
const win = getWindow(el);
|
|
85
|
+
const event = new win.CustomEvent(type, init);
|
|
80
86
|
return el.dispatchEvent(event);
|
|
81
87
|
}
|
|
82
88
|
var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
|
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,9 @@ function getPlatform() {
|
|
|
13
13
|
var pt = (v) => isDom() && v.test(getPlatform());
|
|
14
14
|
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
15
15
|
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
16
|
+
function isDocument(el) {
|
|
17
|
+
return el.nodeType === Node.DOCUMENT_NODE;
|
|
18
|
+
}
|
|
16
19
|
function isWindow(value) {
|
|
17
20
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
18
21
|
}
|
|
@@ -20,6 +23,8 @@ function getDocument(el) {
|
|
|
20
23
|
var _a;
|
|
21
24
|
if (isWindow(el))
|
|
22
25
|
return el.document;
|
|
26
|
+
if (isDocument(el))
|
|
27
|
+
return el;
|
|
23
28
|
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
24
29
|
}
|
|
25
30
|
function getWindow(el) {
|
|
@@ -50,7 +55,8 @@ var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaK
|
|
|
50
55
|
function fireCustomEvent(el, type, init) {
|
|
51
56
|
if (!el)
|
|
52
57
|
return;
|
|
53
|
-
const
|
|
58
|
+
const win = getWindow(el);
|
|
59
|
+
const event = new win.CustomEvent(type, init);
|
|
54
60
|
return el.dispatchEvent(event);
|
|
55
61
|
}
|
|
56
62
|
var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/interact-outside",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20220709094240",
|
|
4
4
|
"description": "Track interations or focus outside an element",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test:watch": "yarn test --watchAll"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
31
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220709094240"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|