@zag-js/splitter 0.2.4 → 0.2.6

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
@@ -38,10 +38,12 @@ var anatomy = (0, import_anatomy.createAnatomy)("splitter").parts(
38
38
  );
39
39
  var parts = anatomy.build();
40
40
 
41
- // ../../utilities/dom/dist/index.mjs
41
+ // ../../utilities/dom/src/attrs.ts
42
42
  var dataAttr = (guard) => {
43
43
  return guard ? "" : void 0;
44
44
  };
45
+
46
+ // ../../utilities/core/src/functions.ts
45
47
  var runIfFn = (v, ...a) => {
46
48
  const res = typeof v === "function" ? v(...a) : v;
47
49
  return res != null ? res : void 0;
@@ -51,9 +53,22 @@ var callAll = (...fns) => (...a) => {
51
53
  fn == null ? void 0 : fn(...a);
52
54
  });
53
55
  };
56
+
57
+ // ../../utilities/core/src/guard.ts
54
58
  var isArray = (v) => Array.isArray(v);
55
59
  var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
56
60
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
61
+
62
+ // ../../utilities/core/src/object.ts
63
+ function compact(obj) {
64
+ if (obj === void 0)
65
+ return obj;
66
+ return Object.fromEntries(
67
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
68
+ );
69
+ }
70
+
71
+ // ../../utilities/dom/src/platform.ts
57
72
  var isDom = () => typeof window !== "undefined";
58
73
  function getPlatform() {
59
74
  var _a;
@@ -65,6 +80,8 @@ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
65
80
  var isMac = () => pt(/^Mac/) && !isTouchDevice;
66
81
  var isApple = () => pt(/mac|iphone|ipad|ipod/i);
67
82
  var isIos = () => isApple() && !isMac();
83
+
84
+ // ../../utilities/dom/src/query.ts
68
85
  function isDocument(el) {
69
86
  return el.nodeType === Node.DOCUMENT_NODE;
70
87
  }
@@ -116,12 +133,16 @@ function defineDomHelpers(helpers) {
116
133
  ...helpers
117
134
  };
118
135
  }
136
+
137
+ // ../../utilities/dom/src/event.ts
119
138
  var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
120
139
  var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
121
140
  var supportsMouseEvent = () => isDom() && window.onmousedown === null;
122
141
  var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
123
142
  var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
124
143
  var isLeftClick = (v) => v.button === 0;
144
+
145
+ // ../../utilities/dom/src/get-element-offset.ts
125
146
  function getElementOffset(element) {
126
147
  let left = 0;
127
148
  let top = 0;
@@ -144,12 +165,16 @@ function getElementOffset(element) {
144
165
  left
145
166
  };
146
167
  }
168
+
169
+ // ../../utilities/dom/src/get-point-relative-to-element.ts
147
170
  function getPointRelativeToNode(point, element) {
148
171
  const offset = getElementOffset(element);
149
172
  const x = point.x - offset.left;
150
173
  const y = point.y - offset.top;
151
174
  return { x, y };
152
175
  }
176
+
177
+ // ../../utilities/dom/src/keyboard-event.ts
153
178
  var rtlKeyMap = {
154
179
  ArrowLeft: "ArrowRight",
155
180
  ArrowRight: "ArrowLeft"
@@ -185,10 +210,12 @@ function getEventStep(event) {
185
210
  return isSkipKey ? 10 : 1;
186
211
  }
187
212
  }
213
+
214
+ // ../../utilities/dom/src/listener.ts
188
215
  var isRef = (v) => hasProp(v, "current");
189
- var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
216
+ var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
190
217
  function extractInfo(event, type = "page") {
191
- const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
218
+ const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
192
219
  return {
193
220
  point: {
194
221
  x: point[`${type}X`],
@@ -249,6 +276,8 @@ function getEventName(evt) {
249
276
  return mouseEventNames[evt];
250
277
  return evt;
251
278
  }
279
+
280
+ // ../../utilities/dom/src/next-tick.ts
252
281
  function nextTick(fn) {
253
282
  const set = /* @__PURE__ */ new Set();
254
283
  function raf2(fn2) {
@@ -268,6 +297,8 @@ function raf(fn) {
268
297
  globalThis.cancelAnimationFrame(id);
269
298
  };
270
299
  }
300
+
301
+ // ../../utilities/dom/src/text-selection.ts
271
302
  var state = "default";
272
303
  var savedUserSelect = "";
273
304
  var modifiedElementMap = /* @__PURE__ */ new WeakMap();
@@ -315,6 +346,8 @@ function restoreTextSelection({ target, doc } = {}) {
315
346
  }
316
347
  }
317
348
  }
349
+
350
+ // ../../utilities/dom/src/pointer-event.ts
318
351
  var THRESHOLD = 5;
319
352
  function trackPointerMove(doc, opts) {
320
353
  const { onPointerMove, onPointerUp } = opts;
@@ -547,7 +580,7 @@ function connect(state2, send, normalize) {
547
580
  // src/splitter.machine.ts
548
581
  var import_core = require("@zag-js/core");
549
582
 
550
- // ../../utilities/number/dist/index.mjs
583
+ // ../../utilities/number/src/number.ts
551
584
  function round(v, t) {
552
585
  let num = valueOf(v);
553
586
  const p = 10 ** (t != null ? t : 10);
@@ -592,18 +625,6 @@ function decimalOperation(a, op, b) {
592
625
  }
593
626
  return result;
594
627
  }
595
- var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
596
-
597
- // ../../utilities/core/dist/index.mjs
598
- var isArray2 = (v) => Array.isArray(v);
599
- var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
600
- function compact(obj) {
601
- if (obj === void 0)
602
- return obj;
603
- return Object.fromEntries(
604
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
605
- );
606
- }
607
628
 
608
629
  // src/splitter.machine.ts
609
630
  var { not } = import_core.guards;