@zag-js/number-input 0.2.5 → 0.2.7

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,14 +39,18 @@ var anatomy = (0, import_anatomy.createAnatomy)("numberInput").parts(
39
39
  );
40
40
  var parts = anatomy.build();
41
41
 
42
- // ../../utilities/dom/dist/index.mjs
42
+ // ../../utilities/dom/src/attrs.ts
43
43
  var dataAttr = (guard) => {
44
44
  return guard ? "" : void 0;
45
45
  };
46
46
  var ariaAttr = (guard) => {
47
47
  return guard ? "true" : void 0;
48
48
  };
49
+
50
+ // ../../utilities/dom/src/constants.ts
49
51
  var MAX_Z_INDEX = 2147483647;
52
+
53
+ // ../../utilities/core/src/functions.ts
50
54
  var runIfFn = (v, ...a) => {
51
55
  const res = typeof v === "function" ? v(...a) : v;
52
56
  return res != null ? res : void 0;
@@ -56,9 +60,22 @@ var callAll = (...fns) => (...a) => {
56
60
  fn == null ? void 0 : fn(...a);
57
61
  });
58
62
  };
63
+
64
+ // ../../utilities/core/src/guard.ts
59
65
  var isArray = (v) => Array.isArray(v);
60
66
  var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
61
67
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
68
+
69
+ // ../../utilities/core/src/object.ts
70
+ function compact(obj) {
71
+ if (obj === void 0)
72
+ return obj;
73
+ return Object.fromEntries(
74
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
75
+ );
76
+ }
77
+
78
+ // ../../utilities/dom/src/platform.ts
62
79
  var isDom = () => typeof window !== "undefined";
63
80
  function getPlatform() {
64
81
  var _a;
@@ -69,6 +86,8 @@ var pt = (v) => isDom() && v.test(getPlatform());
69
86
  var vn = (v) => isDom() && v.test(navigator.vendor);
70
87
  var isSafari = () => isApple() && vn(/apple/i);
71
88
  var isApple = () => pt(/mac|iphone|ipad|ipod/i);
89
+
90
+ // ../../utilities/dom/src/query.ts
72
91
  function isDocument(el) {
73
92
  return el.nodeType === Node.DOCUMENT_NODE;
74
93
  }
@@ -83,6 +102,10 @@ function getDocument(el) {
83
102
  return el;
84
103
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
85
104
  }
105
+ function getWindow(el) {
106
+ var _a;
107
+ return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
108
+ }
86
109
  function defineDomHelpers(helpers) {
87
110
  const dom2 = {
88
111
  getRootNode: (ctx) => {
@@ -120,6 +143,8 @@ function defineDomHelpers(helpers) {
120
143
  ...helpers
121
144
  };
122
145
  }
146
+
147
+ // ../../utilities/dom/src/event.ts
123
148
  function getNativeEvent(e) {
124
149
  var _a;
125
150
  return (_a = e.nativeEvent) != null ? _a : e;
@@ -128,6 +153,8 @@ var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
128
153
  var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
129
154
  var isLeftClick = (v) => v.button === 0;
130
155
  var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
156
+
157
+ // ../../utilities/dom/src/get-event-point.ts
131
158
  var fallback = {
132
159
  pageX: 0,
133
160
  pageY: 0,
@@ -139,6 +166,8 @@ function getEventPoint(event, type = "page") {
139
166
  const point = isTouchEvent(event) ? (_b = (_a = event.touches[0]) != null ? _a : event.changedTouches[0]) != null ? _b : fallback : event;
140
167
  return { x: point[`${type}X`], y: point[`${type}Y`] };
141
168
  }
169
+
170
+ // ../../utilities/dom/src/keyboard-event.ts
142
171
  var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
143
172
  var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
144
173
  function getEventStep(event) {
@@ -150,6 +179,8 @@ function getEventStep(event) {
150
179
  return isSkipKey ? 10 : 1;
151
180
  }
152
181
  }
182
+
183
+ // ../../utilities/dom/src/listener.ts
153
184
  var isRef = (v) => hasProp(v, "current");
154
185
  function addDomEvent(target, eventName, handler, options) {
155
186
  const node = isRef(target) ? target.current : runIfFn(target);
@@ -158,6 +189,8 @@ function addDomEvent(target, eventName, handler, options) {
158
189
  node == null ? void 0 : node.removeEventListener(eventName, handler, options);
159
190
  };
160
191
  }
192
+
193
+ // ../../utilities/dom/src/mutation-observer.ts
161
194
  function observeAttributes(node, attributes, fn) {
162
195
  if (!node)
163
196
  return;
@@ -173,12 +206,16 @@ function observeAttributes(node, attributes, fn) {
173
206
  obs.observe(node, { attributes: true, attributeFilter: attrs });
174
207
  return () => obs.disconnect();
175
208
  }
209
+
210
+ // ../../utilities/dom/src/next-tick.ts
176
211
  function raf(fn) {
177
212
  const id = globalThis.requestAnimationFrame(fn);
178
213
  return function cleanup() {
179
214
  globalThis.cancelAnimationFrame(id);
180
215
  };
181
216
  }
217
+
218
+ // ../../utilities/dom/src/pointerlock.ts
182
219
  function addPointerlockChangeListener(doc, fn) {
183
220
  return addDomEvent(doc, "pointerlockchange", fn, false);
184
221
  }
@@ -223,7 +260,7 @@ function requestPointerLock(doc, handlers = {}) {
223
260
  };
224
261
  }
225
262
 
226
- // ../../utilities/number/dist/index.mjs
263
+ // ../../utilities/number/src/number.ts
227
264
  function wrap(num, max) {
228
265
  return (num % max + max) % max;
229
266
  }
@@ -285,7 +322,6 @@ function decimalOperation(a, op, b) {
285
322
  }
286
323
  return result;
287
324
  }
288
- var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
289
325
 
290
326
  // src/number-input.dom.ts
291
327
  var dom = defineDomHelpers({
@@ -640,27 +676,7 @@ function connect(state, send, normalize) {
640
676
  // src/number-input.machine.ts
641
677
  var import_core = require("@zag-js/core");
642
678
 
643
- // ../../utilities/core/dist/index.mjs
644
- var callAll2 = (...fns) => (...a) => {
645
- fns.forEach(function(fn) {
646
- fn == null ? void 0 : fn(...a);
647
- });
648
- };
649
- var isArray2 = (v) => Array.isArray(v);
650
- var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
651
- function compact(obj) {
652
- if (obj === void 0)
653
- return obj;
654
- return Object.fromEntries(
655
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
656
- );
657
- }
658
-
659
- // ../../utilities/form-utils/dist/index.mjs
660
- function getWindow(el) {
661
- var _a;
662
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
663
- }
679
+ // ../../utilities/form-utils/src/input-event.ts
664
680
  function getDescriptor(el, options) {
665
681
  var _a;
666
682
  const { type, property = "value" } = options;
@@ -957,7 +973,7 @@ function machine(userContext) {
957
973
  function onMouseup() {
958
974
  send("POINTER_UP_SCRUBBER");
959
975
  }
960
- return callAll2(
976
+ return callAll(
961
977
  addDomEvent(doc, "mousemove", onMousemove, false),
962
978
  addDomEvent(doc, "mouseup", onMouseup, false)
963
979
  );