@zag-js/number-input 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.mjs CHANGED
@@ -31,9 +31,14 @@ function raf(fn) {
31
31
  globalThis.cancelAnimationFrame(id);
32
32
  };
33
33
  }
34
+ var runIfFn = (v, ...a) => {
35
+ const res = typeof v === "function" ? v(...a) : v;
36
+ return res != null ? res : void 0;
37
+ };
34
38
  var noop = () => {
35
39
  };
36
40
  var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
41
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
37
42
  function getListenerElements() {
38
43
  ;
39
44
  globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
@@ -44,7 +49,7 @@ function getListenerCache() {
44
49
  globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
45
50
  return globalThis.__listenerCache__;
46
51
  }
47
- function globalEventBus(node, type, handler, options) {
52
+ function addGlobalEventListener(node, type, handler, options) {
48
53
  var _a;
49
54
  if (!node)
50
55
  return noop;
@@ -96,17 +101,15 @@ function globalEventBus(node, type, handler, options) {
96
101
  }
97
102
  };
98
103
  }
99
- var t = (v) => Object.prototype.toString.call(v).slice(8, -1);
100
- var isRef = (v) => t(v) === "Object" && "current" in v;
101
- var runIfFn = (fn) => t(fn) === "Function" ? fn() : fn;
104
+ var isRef = (v) => hasProp(v, "current");
102
105
  function addDomEvent(target, event, listener, options) {
103
106
  const node = isRef(target) ? target.current : runIfFn(target);
104
- return globalEventBus(node, event, listener, options);
107
+ return addGlobalEventListener(node, event, listener, options);
105
108
  }
106
109
  var MAX_Z_INDEX = 2147483647;
107
- function getNativeEvent(event) {
110
+ function getNativeEvent(e) {
108
111
  var _a;
109
- return (_a = event.nativeEvent) != null ? _a : event;
112
+ return (_a = e.nativeEvent) != null ? _a : e;
110
113
  }
111
114
  function observeAttributes(node, attributes, fn) {
112
115
  if (!node)
@@ -295,11 +298,12 @@ var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigit
295
298
  // ../../utilities/rect/dist/index.mjs
296
299
  var isArray = (v) => Array.isArray(v);
297
300
  var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
298
- var isTouchEvent = (v) => isObject(v) && "touches" in v;
301
+ var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
302
+ var isTouchEvent = (v) => isObject(v) && hasProp2(v, "touches");
299
303
  var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
300
- function getEventPoint(e, t2 = "page") {
304
+ function getEventPoint(e, t = "page") {
301
305
  const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
302
- return { x: p[`${t2}X`], y: p[`${t2}Y`] };
306
+ return { x: p[`${t}X`], y: p[`${t}Y`] };
303
307
  }
304
308
 
305
309
  // ../../types/dist/index.mjs
@@ -316,7 +320,7 @@ var normalizeProp = createNormalizer((v) => v);
316
320
  var pipe2 = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
317
321
  var platform = (v) => isDom() && v.test(navigator.platform);
318
322
  var ua = (v) => isDom() && v.test(navigator.userAgent);
319
- var isDom = () => !!(typeof window !== "undefined");
323
+ var isDom = () => typeof window !== "undefined";
320
324
  var isMac = () => platform(/^Mac/);
321
325
  var isIPhone = () => platform(/^iPhone/);
322
326
  var isIPad = () => platform(/^iPad/) || isMac() && navigator.maxTouchPoints > 1;