@zag-js/popover 0.0.0-dev-20220526115355 → 0.0.0-dev-20220603082742

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
@@ -42,36 +42,36 @@ __export(src_exports, {
42
42
  module.exports = __toCommonJS(src_exports);
43
43
 
44
44
  // ../../../node_modules/compute-scroll-into-view/dist/index.module.js
45
- function t(t3) {
46
- return typeof t3 == "object" && t3 != null && t3.nodeType === 1;
45
+ function t(t2) {
46
+ return typeof t2 == "object" && t2 != null && t2.nodeType === 1;
47
47
  }
48
- function e(t3, e2) {
49
- return (!e2 || t3 !== "hidden") && t3 !== "visible" && t3 !== "clip";
48
+ function e(t2, e2) {
49
+ return (!e2 || t2 !== "hidden") && t2 !== "visible" && t2 !== "clip";
50
50
  }
51
- function n(t3, n2) {
52
- if (t3.clientHeight < t3.scrollHeight || t3.clientWidth < t3.scrollWidth) {
53
- var r2 = getComputedStyle(t3, null);
54
- return e(r2.overflowY, n2) || e(r2.overflowX, n2) || function(t4) {
55
- var e2 = function(t5) {
56
- if (!t5.ownerDocument || !t5.ownerDocument.defaultView)
51
+ function n(t2, n2) {
52
+ if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
53
+ var r2 = getComputedStyle(t2, null);
54
+ return e(r2.overflowY, n2) || e(r2.overflowX, n2) || function(t3) {
55
+ var e2 = function(t4) {
56
+ if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
57
57
  return null;
58
58
  try {
59
- return t5.ownerDocument.defaultView.frameElement;
60
- } catch (t6) {
59
+ return t4.ownerDocument.defaultView.frameElement;
60
+ } catch (t5) {
61
61
  return null;
62
62
  }
63
- }(t4);
64
- return !!e2 && (e2.clientHeight < t4.scrollHeight || e2.clientWidth < t4.scrollWidth);
65
- }(t3);
63
+ }(t3);
64
+ return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);
65
+ }(t2);
66
66
  }
67
67
  return false;
68
68
  }
69
- function r(t3, e2, n2, r2, i, o, l, d) {
70
- return o < t3 && l > e2 || o > t3 && l < e2 ? 0 : o <= t3 && d <= n2 || l >= e2 && d >= n2 ? o - t3 - r2 : l > e2 && d < n2 || o < t3 && d > n2 ? l - e2 + i : 0;
69
+ function r(t2, e2, n2, r2, i, o, l, d) {
70
+ return o < t2 && l > e2 || o > t2 && l < e2 ? 0 : o <= t2 && d <= n2 || l >= e2 && d >= n2 ? o - t2 - r2 : l > e2 && d < n2 || o < t2 && d > n2 ? l - e2 + i : 0;
71
71
  }
72
72
  function index_module_default(e2, i) {
73
- var o = window, l = i.scrollMode, d = i.block, u = i.inline, h = i.boundary, a = i.skipOverflowHiddenElements, c = typeof h == "function" ? h : function(t3) {
74
- return t3 !== h;
73
+ var o = window, l = i.scrollMode, d = i.block, u = i.inline, h = i.boundary, a = i.skipOverflowHiddenElements, c = typeof h == "function" ? h : function(t2) {
74
+ return t2 !== h;
75
75
  };
76
76
  if (!t(e2))
77
77
  throw new TypeError("Invalid target");
@@ -191,15 +191,20 @@ function raf(fn) {
191
191
  globalThis.cancelAnimationFrame(id);
192
192
  };
193
193
  }
194
+ var runIfFn = (v, ...a) => {
195
+ const res = typeof v === "function" ? v(...a) : v;
196
+ return res != null ? res : void 0;
197
+ };
194
198
  var noop = () => {
195
199
  };
196
200
  var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
197
201
  var platform = (v) => isDom() && v.test(navigator.platform);
198
- var isDom = () => !!(typeof window !== "undefined");
202
+ var isDom = () => typeof window !== "undefined";
199
203
  var isMac = () => platform(/^Mac/);
200
204
  var isIPhone = () => platform(/^iPhone/);
201
205
  var isIPad = () => platform(/^iPad/) || isMac() && navigator.maxTouchPoints > 1;
202
206
  var isIos = () => isIPhone() || isIPad();
207
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
203
208
  var isLeftClick = (v) => v.button === 0;
204
209
  function getListenerElements() {
205
210
  ;
@@ -211,7 +216,7 @@ function getListenerCache() {
211
216
  globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
212
217
  return globalThis.__listenerCache__;
213
218
  }
214
- function globalEventBus(node, type, handler, options) {
219
+ function addGlobalEventListener(node, type, handler, options) {
215
220
  var _a;
216
221
  if (!node)
217
222
  return noop;
@@ -263,12 +268,10 @@ function globalEventBus(node, type, handler, options) {
263
268
  }
264
269
  };
265
270
  }
266
- var t2 = (v) => Object.prototype.toString.call(v).slice(8, -1);
267
- var isRef = (v) => t2(v) === "Object" && "current" in v;
268
- var runIfFn = (fn) => t2(fn) === "Function" ? fn() : fn;
271
+ var isRef = (v) => hasProp(v, "current");
269
272
  function addDomEvent(target, event, listener, options) {
270
273
  const node = isRef(target) ? target.current : runIfFn(target);
271
- return globalEventBus(node, event, listener, options);
274
+ return addGlobalEventListener(node, event, listener, options);
272
275
  }
273
276
  var changeCount = 0;
274
277
  var originalBodyPointerEvents;