@zag-js/splitter 0.1.4 → 0.1.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 +37 -23
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +37 -23
- package/dist/index.mjs.map +3 -3
- package/dist/splitter.types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -62,19 +62,33 @@ function raf(fn) {
|
|
|
62
62
|
globalThis.cancelAnimationFrame(id);
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
var
|
|
66
|
-
};
|
|
67
|
-
var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
|
|
68
|
-
var platform = (v) => isDom() && v.test(navigator.platform);
|
|
69
|
-
var isDom = () => !!(typeof window !== "undefined");
|
|
70
|
-
var isMac = () => platform(/^Mac/);
|
|
71
|
-
var isIPhone = () => platform(/^iPhone/);
|
|
72
|
-
var isIPad = () => platform(/^iPad/) || isMac() && navigator.maxTouchPoints > 1;
|
|
73
|
-
var isIos = () => isIPhone() || isIPad();
|
|
65
|
+
var isDom = () => typeof window !== "undefined";
|
|
74
66
|
var isArray = (v) => Array.isArray(v);
|
|
75
67
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
76
|
-
var
|
|
68
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
69
|
+
function getPlatform() {
|
|
70
|
+
var _a;
|
|
71
|
+
const agent = navigator.userAgentData;
|
|
72
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
73
|
+
}
|
|
74
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
75
|
+
var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
|
|
76
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
77
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
78
|
+
var isIos = () => isApple() && !isMac();
|
|
79
|
+
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
80
|
+
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
81
|
+
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
82
|
+
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
83
|
+
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
77
84
|
var isLeftClick = (v) => v.button === 0;
|
|
85
|
+
var runIfFn = (v, ...a) => {
|
|
86
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
87
|
+
return res != null ? res : void 0;
|
|
88
|
+
};
|
|
89
|
+
var noop = () => {
|
|
90
|
+
};
|
|
91
|
+
var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
|
|
78
92
|
function getListenerElements() {
|
|
79
93
|
;
|
|
80
94
|
globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
|
|
@@ -85,7 +99,7 @@ function getListenerCache() {
|
|
|
85
99
|
globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
|
|
86
100
|
return globalThis.__listenerCache__;
|
|
87
101
|
}
|
|
88
|
-
function
|
|
102
|
+
function addGlobalEventListener(node, type, handler, options) {
|
|
89
103
|
var _a;
|
|
90
104
|
if (!node)
|
|
91
105
|
return noop;
|
|
@@ -137,10 +151,7 @@ function globalEventBus(node, type, handler, options) {
|
|
|
137
151
|
}
|
|
138
152
|
};
|
|
139
153
|
}
|
|
140
|
-
var
|
|
141
|
-
var isRef = (v) => t(v) === "Object" && "current" in v;
|
|
142
|
-
var runIfFn = (fn) => t(fn) === "Function" ? fn() : fn;
|
|
143
|
-
var isTouchEvent = (v) => t(v) === "Object" && !!v.touches;
|
|
154
|
+
var isRef = (v) => hasProp(v, "current");
|
|
144
155
|
var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
145
156
|
function extractInfo(event, type = "page") {
|
|
146
157
|
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
|
|
@@ -153,7 +164,7 @@ function extractInfo(event, type = "page") {
|
|
|
153
164
|
}
|
|
154
165
|
function addDomEvent(target, event, listener, options) {
|
|
155
166
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
156
|
-
return
|
|
167
|
+
return addGlobalEventListener(node, event, listener, options);
|
|
157
168
|
}
|
|
158
169
|
function addPointerEvent(target, event, listener, options) {
|
|
159
170
|
var _a;
|
|
@@ -176,9 +187,6 @@ function filterPrimaryPointer(fn) {
|
|
|
176
187
|
fn(event);
|
|
177
188
|
};
|
|
178
189
|
}
|
|
179
|
-
var supportsPointerEvent = () => typeof window !== "undefined" && window.onpointerdown === null;
|
|
180
|
-
var supportsTouchEvent = () => typeof window !== "undefined" && window.ontouchstart === null;
|
|
181
|
-
var supportsMouseEvent = () => typeof window !== "undefined" && window.onmousedown === null;
|
|
182
190
|
var mouseEventNames = {
|
|
183
191
|
pointerdown: "mousedown",
|
|
184
192
|
pointermove: "mousemove",
|
|
@@ -359,7 +367,11 @@ findByTypeahead.defaultOptions = {
|
|
|
359
367
|
|
|
360
368
|
// ../../types/dist/index.mjs
|
|
361
369
|
function createNormalizer(fn) {
|
|
362
|
-
return {
|
|
370
|
+
return new Proxy({}, {
|
|
371
|
+
get() {
|
|
372
|
+
return fn;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
363
375
|
}
|
|
364
376
|
var normalizeProp = createNormalizer((v) => v);
|
|
365
377
|
|
|
@@ -581,11 +593,11 @@ var import_core = require("@zag-js/core");
|
|
|
581
593
|
|
|
582
594
|
// ../../utilities/number/dist/index.mjs
|
|
583
595
|
var __pow2 = Math.pow;
|
|
584
|
-
function round(v,
|
|
596
|
+
function round(v, t) {
|
|
585
597
|
let num = valueOf(v);
|
|
586
|
-
const p = __pow2(10,
|
|
598
|
+
const p = __pow2(10, t != null ? t : 10);
|
|
587
599
|
num = Math.round(num * p) / p;
|
|
588
|
-
return
|
|
600
|
+
return t ? num.toFixed(t) : v.toString();
|
|
589
601
|
}
|
|
590
602
|
function clamp(v, o) {
|
|
591
603
|
return Math.min(Math.max(valueOf(v), o.min), o.max);
|
|
@@ -628,6 +640,8 @@ function decimalOperation(a, op, b) {
|
|
|
628
640
|
var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
|
|
629
641
|
|
|
630
642
|
// ../../utilities/rect/dist/index.mjs
|
|
643
|
+
var isDom2 = () => typeof window !== "undefined";
|
|
644
|
+
var isTouchDevice2 = isDom2() && !!navigator.maxTouchPoints;
|
|
631
645
|
function relativeToNode(p, el) {
|
|
632
646
|
const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
|
|
633
647
|
const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
|