@zag-js/interact-outside 0.0.0-dev-20220707125149 → 0.0.0-dev-20220709094318

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 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) {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/interact-outside",
3
- "version": "0.0.0-dev-20220707125149",
3
+ "version": "0.0.0-dev-20220709094318",
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-20220707125149"
31
+ "@zag-js/dom-utils": "0.0.0-dev-20220709094318"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"