@zag-js/interact-outside 0.0.0-dev-20220704095222 → 0.0.0-dev-20220704163406

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
@@ -25,6 +25,20 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
27
  // ../dom/dist/index.mjs
28
+ var runIfFn = (v, ...a) => {
29
+ const res = typeof v === "function" ? v(...a) : v;
30
+ return res != null ? res : void 0;
31
+ };
32
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
33
+ var isDom = () => typeof window !== "undefined";
34
+ function getPlatform() {
35
+ var _a;
36
+ const agent = navigator.userAgentData;
37
+ return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
38
+ }
39
+ var pt = (v) => isDom() && v.test(getPlatform());
40
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
41
+ var isMac = () => pt(/^Mac/) && !isTouchDevice;
28
42
  function isWindow(value) {
29
43
  return (value == null ? void 0 : value.toString()) === "[object Window]";
30
44
  }
@@ -55,6 +69,10 @@ function isVisible(el) {
55
69
  return false;
56
70
  return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
57
71
  }
72
+ var isContextMenuEvent = (e) => {
73
+ return e.button === 2 || isCtrlKey(e) && e.button === 0;
74
+ };
75
+ var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
58
76
  function fireCustomEvent(el, type, init) {
59
77
  if (!el)
60
78
  return;
@@ -67,11 +85,6 @@ function isFocusable(element) {
67
85
  return false;
68
86
  return element.matches(focusableSelector) && isVisible(element);
69
87
  }
70
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
71
- var runIfFn = (v, ...a) => {
72
- const res = typeof v === "function" ? v(...a) : v;
73
- return res != null ? res : void 0;
74
- };
75
88
  var isRef = (v) => hasProp(v, "current");
76
89
  function addDomEvent(target, eventName, handler, options) {
77
90
  const node = isRef(target) ? target.current : runIfFn(target);
@@ -81,21 +94,6 @@ function addDomEvent(target, eventName, handler, options) {
81
94
  };
82
95
  }
83
96
 
84
- // ../core/dist/index.mjs
85
- var isDom = () => typeof window !== "undefined";
86
- function getPlatform() {
87
- var _a;
88
- const agent = navigator.userAgentData;
89
- return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
90
- }
91
- var pt = (v) => isDom() && v.test(getPlatform());
92
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
93
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
94
- var isContextMenuEvent = (e) => {
95
- return e.button === 2 || isCtrlKey(e) && e.button === 0;
96
- };
97
- var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
98
-
99
97
  // src/index.ts
100
98
  var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
101
99
  var FOCUS_OUTSIDE_EVENT = "focus.outside";
package/dist/index.mjs CHANGED
@@ -1,4 +1,18 @@
1
1
  // ../dom/dist/index.mjs
2
+ var runIfFn = (v, ...a) => {
3
+ const res = typeof v === "function" ? v(...a) : v;
4
+ return res != null ? res : void 0;
5
+ };
6
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
7
+ var isDom = () => typeof window !== "undefined";
8
+ function getPlatform() {
9
+ var _a;
10
+ const agent = navigator.userAgentData;
11
+ return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
12
+ }
13
+ var pt = (v) => isDom() && v.test(getPlatform());
14
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
15
+ var isMac = () => pt(/^Mac/) && !isTouchDevice;
2
16
  function isWindow(value) {
3
17
  return (value == null ? void 0 : value.toString()) === "[object Window]";
4
18
  }
@@ -29,6 +43,10 @@ function isVisible(el) {
29
43
  return false;
30
44
  return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
31
45
  }
46
+ var isContextMenuEvent = (e) => {
47
+ return e.button === 2 || isCtrlKey(e) && e.button === 0;
48
+ };
49
+ var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
32
50
  function fireCustomEvent(el, type, init) {
33
51
  if (!el)
34
52
  return;
@@ -41,11 +59,6 @@ function isFocusable(element) {
41
59
  return false;
42
60
  return element.matches(focusableSelector) && isVisible(element);
43
61
  }
44
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
45
- var runIfFn = (v, ...a) => {
46
- const res = typeof v === "function" ? v(...a) : v;
47
- return res != null ? res : void 0;
48
- };
49
62
  var isRef = (v) => hasProp(v, "current");
50
63
  function addDomEvent(target, eventName, handler, options) {
51
64
  const node = isRef(target) ? target.current : runIfFn(target);
@@ -55,21 +68,6 @@ function addDomEvent(target, eventName, handler, options) {
55
68
  };
56
69
  }
57
70
 
58
- // ../core/dist/index.mjs
59
- var isDom = () => typeof window !== "undefined";
60
- function getPlatform() {
61
- var _a;
62
- const agent = navigator.userAgentData;
63
- return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
64
- }
65
- var pt = (v) => isDom() && v.test(getPlatform());
66
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
67
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
68
- var isContextMenuEvent = (e) => {
69
- return e.button === 2 || isCtrlKey(e) && e.button === 0;
70
- };
71
- var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey;
72
-
73
71
  // src/index.ts
74
72
  var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
75
73
  var FOCUS_OUTSIDE_EVENT = "focus.outside";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/interact-outside",
3
- "version": "0.0.0-dev-20220704095222",
3
+ "version": "0.0.0-dev-20220704163406",
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-20220704095222"
31
+ "@zag-js/dom-utils": "0.0.0-dev-20220704163406"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"