@zag-js/number-input 0.1.8 → 0.1.9
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 +33 -20
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +33 -20
- package/dist/index.mjs.map +3 -3
- package/dist/number-input.types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -54,6 +54,13 @@ function raf(fn) {
|
|
|
54
54
|
globalThis.cancelAnimationFrame(id);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
var isDom = () => typeof window !== "undefined";
|
|
58
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
59
|
+
var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
|
|
60
|
+
var runIfFn = (v, ...a) => {
|
|
61
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
62
|
+
return res != null ? res : void 0;
|
|
63
|
+
};
|
|
57
64
|
var noop = () => {
|
|
58
65
|
};
|
|
59
66
|
var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
|
|
@@ -67,7 +74,7 @@ function getListenerCache() {
|
|
|
67
74
|
globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
|
|
68
75
|
return globalThis.__listenerCache__;
|
|
69
76
|
}
|
|
70
|
-
function
|
|
77
|
+
function addGlobalEventListener(node, type, handler, options) {
|
|
71
78
|
var _a;
|
|
72
79
|
if (!node)
|
|
73
80
|
return noop;
|
|
@@ -119,17 +126,15 @@ function globalEventBus(node, type, handler, options) {
|
|
|
119
126
|
}
|
|
120
127
|
};
|
|
121
128
|
}
|
|
122
|
-
var
|
|
123
|
-
var isRef = (v) => t(v) === "Object" && "current" in v;
|
|
124
|
-
var runIfFn = (fn) => t(fn) === "Function" ? fn() : fn;
|
|
129
|
+
var isRef = (v) => hasProp(v, "current");
|
|
125
130
|
function addDomEvent(target, event, listener, options) {
|
|
126
131
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
127
|
-
return
|
|
132
|
+
return addGlobalEventListener(node, event, listener, options);
|
|
128
133
|
}
|
|
129
134
|
var MAX_Z_INDEX = 2147483647;
|
|
130
|
-
function getNativeEvent(
|
|
135
|
+
function getNativeEvent(e) {
|
|
131
136
|
var _a;
|
|
132
|
-
return (_a =
|
|
137
|
+
return (_a = e.nativeEvent) != null ? _a : e;
|
|
133
138
|
}
|
|
134
139
|
function observeAttributes(node, attributes, fn) {
|
|
135
140
|
if (!node)
|
|
@@ -316,13 +321,16 @@ function decimalOperation(a, op, b) {
|
|
|
316
321
|
var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
|
|
317
322
|
|
|
318
323
|
// ../../utilities/rect/dist/index.mjs
|
|
324
|
+
var isDom2 = () => typeof window !== "undefined";
|
|
319
325
|
var isArray = (v) => Array.isArray(v);
|
|
320
326
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
321
|
-
var
|
|
327
|
+
var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
328
|
+
var isTouchDevice2 = isDom2() && !!navigator.maxTouchPoints;
|
|
329
|
+
var isTouchEvent = (v) => isObject(v) && hasProp2(v, "touches");
|
|
322
330
|
var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
323
|
-
function getEventPoint(e,
|
|
331
|
+
function getEventPoint(e, t = "page") {
|
|
324
332
|
const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
|
|
325
|
-
return { x: p[`${
|
|
333
|
+
return { x: p[`${t}X`], y: p[`${t}Y`] };
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
// ../../types/dist/index.mjs
|
|
@@ -336,18 +344,23 @@ function createNormalizer(fn) {
|
|
|
336
344
|
var normalizeProp = createNormalizer((v) => v);
|
|
337
345
|
|
|
338
346
|
// ../../utilities/core/dist/index.mjs
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
var
|
|
346
|
-
var
|
|
347
|
-
var
|
|
348
|
-
var
|
|
347
|
+
var isDom3 = () => typeof window !== "undefined";
|
|
348
|
+
function getPlatform() {
|
|
349
|
+
var _a;
|
|
350
|
+
const agent = navigator.userAgentData;
|
|
351
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
352
|
+
}
|
|
353
|
+
var pt = (v) => isDom3() && v.test(getPlatform());
|
|
354
|
+
var vn = (v) => isDom3() && v.test(navigator.vendor);
|
|
355
|
+
var isTouchDevice3 = isDom3() && !!navigator.maxTouchPoints;
|
|
356
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice3;
|
|
357
|
+
var isSafari = () => isApple() && vn(/apple/i);
|
|
358
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
359
|
+
var isIos = () => isApple() && !isMac();
|
|
360
|
+
var supportsPointerEvent = () => isDom3() && window.onpointerdown === null;
|
|
349
361
|
var isLeftClick = (v) => v.button === 0;
|
|
350
362
|
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
363
|
+
var pipe2 = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
|
|
351
364
|
|
|
352
365
|
// src/number-input.dom.ts
|
|
353
366
|
var dom = {
|