@zag-js/number-input 0.0.0-dev-20220627111117 → 0.0.0-dev-20220627213111

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
@@ -49,13 +49,14 @@ var dataAttr = (guard) => {
49
49
  var ariaAttr = (guard) => {
50
50
  return guard ? "true" : void 0;
51
51
  };
52
+ var isArray = (v) => Array.isArray(v);
53
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
52
54
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
55
+ var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
53
56
  var runIfFn = (v, ...a) => {
54
57
  const res = typeof v === "function" ? v(...a) : v;
55
58
  return res != null ? res : void 0;
56
59
  };
57
- var noop = () => {
58
- };
59
60
  var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
60
61
  var isRef = (v) => hasProp(v, "current");
61
62
  function addDomEvent(target, eventName, handler, options) {
@@ -78,7 +79,7 @@ function getNativeEvent(e) {
78
79
  }
79
80
  function observeAttributes(node, attributes, fn) {
80
81
  if (!node)
81
- return noop;
82
+ return;
82
83
  const attrs = Array.isArray(attributes) ? attributes : [attributes];
83
84
  const win = node.ownerDocument.defaultView || window;
84
85
  const obs = new win.MutationObserver((changes) => {
@@ -91,6 +92,17 @@ function observeAttributes(node, attributes, fn) {
91
92
  obs.observe(node, { attributes: true, attributeFilter: attrs });
92
93
  return () => obs.disconnect();
93
94
  }
95
+ var fallback2 = {
96
+ pageX: 0,
97
+ pageY: 0,
98
+ clientX: 0,
99
+ clientY: 0
100
+ };
101
+ function getEventPoint(event, type = "page") {
102
+ var _a, _b;
103
+ const point = isTouchEvent(event) ? (_b = (_a = event.touches[0]) != null ? _a : event.changedTouches[0]) != null ? _b : fallback2 : event;
104
+ return { x: point[`${type}X`], y: point[`${type}Y`] };
105
+ }
94
106
  var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
95
107
  var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
96
108
  function getEventStep(event) {
@@ -208,17 +220,6 @@ function decimalOperation(a, op, b) {
208
220
  }
209
221
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
210
222
 
211
- // ../../utilities/rect/dist/index.mjs
212
- var isArray = (v) => Array.isArray(v);
213
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
214
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
215
- var isTouchEvent = (v) => isObject(v) && hasProp2(v, "touches");
216
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
217
- function getEventPoint(e, t = "page") {
218
- const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
219
- return { x: p[`${t}X`], y: p[`${t}Y`] };
220
- }
221
-
222
223
  // ../../types/dist/index.mjs
223
224
  function createNormalizer(fn) {
224
225
  return new Proxy({}, {
package/dist/index.mjs CHANGED
@@ -26,13 +26,14 @@ var dataAttr = (guard) => {
26
26
  var ariaAttr = (guard) => {
27
27
  return guard ? "true" : void 0;
28
28
  };
29
+ var isArray = (v) => Array.isArray(v);
30
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
29
31
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
32
+ var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
30
33
  var runIfFn = (v, ...a) => {
31
34
  const res = typeof v === "function" ? v(...a) : v;
32
35
  return res != null ? res : void 0;
33
36
  };
34
- var noop = () => {
35
- };
36
37
  var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
37
38
  var isRef = (v) => hasProp(v, "current");
38
39
  function addDomEvent(target, eventName, handler, options) {
@@ -55,7 +56,7 @@ function getNativeEvent(e) {
55
56
  }
56
57
  function observeAttributes(node, attributes, fn) {
57
58
  if (!node)
58
- return noop;
59
+ return;
59
60
  const attrs = Array.isArray(attributes) ? attributes : [attributes];
60
61
  const win = node.ownerDocument.defaultView || window;
61
62
  const obs = new win.MutationObserver((changes) => {
@@ -68,6 +69,17 @@ function observeAttributes(node, attributes, fn) {
68
69
  obs.observe(node, { attributes: true, attributeFilter: attrs });
69
70
  return () => obs.disconnect();
70
71
  }
72
+ var fallback2 = {
73
+ pageX: 0,
74
+ pageY: 0,
75
+ clientX: 0,
76
+ clientY: 0
77
+ };
78
+ function getEventPoint(event, type = "page") {
79
+ var _a, _b;
80
+ const point = isTouchEvent(event) ? (_b = (_a = event.touches[0]) != null ? _a : event.changedTouches[0]) != null ? _b : fallback2 : event;
81
+ return { x: point[`${type}X`], y: point[`${type}Y`] };
82
+ }
71
83
  var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
72
84
  var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
73
85
  function getEventStep(event) {
@@ -185,17 +197,6 @@ function decimalOperation(a, op, b) {
185
197
  }
186
198
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
187
199
 
188
- // ../../utilities/rect/dist/index.mjs
189
- var isArray = (v) => Array.isArray(v);
190
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
191
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
192
- var isTouchEvent = (v) => isObject(v) && hasProp2(v, "touches");
193
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
194
- function getEventPoint(e, t = "page") {
195
- const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
196
- return { x: p[`${t}X`], y: p[`${t}Y`] };
197
- }
198
-
199
200
  // ../../types/dist/index.mjs
200
201
  function createNormalizer(fn) {
201
202
  return new Proxy({}, {
@@ -1,6 +1,5 @@
1
1
  import type { StateMachine as S } from "@zag-js/core";
2
2
  import { FormatDecimalOptions } from "@zag-js/number-utils";
3
- import type { Point } from "@zag-js/rect-utils";
4
3
  import type { Context, DirectionProperty } from "@zag-js/types";
5
4
  declare type ValidityState = "rangeUnderflow" | "rangeOverflow";
6
5
  declare type ElementIds = Partial<{
@@ -186,7 +185,10 @@ declare type PrivateContext = Context<{
186
185
  * @internal
187
186
  * The scrubber cursor position
188
187
  */
189
- scrubberCursorPoint: Point | null;
188
+ scrubberCursorPoint: {
189
+ x: number;
190
+ y: number;
191
+ } | null;
190
192
  }>;
191
193
  export declare type MachineContext = PublicContext & PrivateContext & ComputedContext;
192
194
  export declare type MachineState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/number-input",
3
- "version": "0.0.0-dev-20220627111117",
3
+ "version": "0.0.0-dev-20220627213111",
4
4
  "description": "Core logic for the number-input widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,10 +29,9 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.0.0-dev-20220627111117",
33
- "@zag-js/dom-utils": "0.0.0-dev-20220627111117",
32
+ "@zag-js/core": "0.0.0-dev-20220627213111",
33
+ "@zag-js/dom-utils": "0.0.0-dev-20220627213111",
34
34
  "@zag-js/number-utils": "0.1.2",
35
- "@zag-js/rect-utils": "0.1.2",
36
35
  "@zag-js/types": "0.2.0",
37
36
  "@zag-js/utils": "0.1.2"
38
37
  },