@zag-js/splitter 0.1.7 → 0.1.10

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.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export { connect } from "./splitter.connect";
2
2
  export { machine } from "./splitter.machine";
3
3
  export type { UserDefinedContext as Context, MachineState } from "./splitter.types";
4
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -39,122 +40,154 @@ __export(src_exports, {
39
40
  module.exports = __toCommonJS(src_exports);
40
41
 
41
42
  // ../../utilities/dom/dist/index.mjs
43
+ var __defProp2 = Object.defineProperty;
44
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
45
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
46
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
42
47
  var __pow = Math.pow;
48
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues2 = (a, b) => {
50
+ for (var prop in b || (b = {}))
51
+ if (__hasOwnProp2.call(b, prop))
52
+ __defNormalProp2(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols2)
54
+ for (var prop of __getOwnPropSymbols2(b)) {
55
+ if (__propIsEnum2.call(b, prop))
56
+ __defNormalProp2(a, prop, b[prop]);
57
+ }
58
+ return a;
59
+ };
43
60
  var dataAttr = (guard) => {
44
61
  return guard ? "" : void 0;
45
62
  };
46
- function nextTick(fn) {
47
- const set = /* @__PURE__ */ new Set();
48
- function raf2(fn2) {
49
- const id = globalThis.requestAnimationFrame(fn2);
50
- set.add(() => globalThis.cancelAnimationFrame(id));
51
- }
52
- raf2(() => raf2(fn));
53
- return function cleanup() {
54
- set.forEach(function(fn2) {
55
- fn2();
56
- });
57
- };
58
- }
59
- function raf(fn) {
60
- const id = globalThis.requestAnimationFrame(fn);
61
- return function cleanup() {
62
- globalThis.cancelAnimationFrame(id);
63
- };
64
- }
65
- var isDom = () => typeof window !== "undefined";
63
+ var runIfFn = (v, ...a) => {
64
+ const res = typeof v === "function" ? v(...a) : v;
65
+ return res != null ? res : void 0;
66
+ };
67
+ var callAll = (...fns) => (...a) => {
68
+ fns.forEach(function(fn) {
69
+ fn == null ? void 0 : fn(...a);
70
+ });
71
+ };
66
72
  var isArray = (v) => Array.isArray(v);
67
73
  var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
68
74
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
75
+ var isDom = () => typeof window !== "undefined";
69
76
  function getPlatform() {
70
77
  var _a;
71
78
  const agent = navigator.userAgentData;
72
79
  return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
73
80
  }
74
81
  var pt = (v) => isDom() && v.test(getPlatform());
75
- var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
82
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
76
83
  var isMac = () => pt(/^Mac/) && !isTouchDevice;
77
84
  var isApple = () => pt(/mac|iphone|ipad|ipod/i);
78
85
  var isIos = () => isApple() && !isMac();
86
+ function isDocument(el) {
87
+ return el.nodeType === Node.DOCUMENT_NODE;
88
+ }
89
+ function isWindow(value) {
90
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
91
+ }
92
+ function getDocument(el) {
93
+ var _a;
94
+ if (isWindow(el))
95
+ return el.document;
96
+ if (isDocument(el))
97
+ return el;
98
+ return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
99
+ }
100
+ function defineDomHelpers(helpers) {
101
+ const dom2 = {
102
+ getRootNode: (ctx) => {
103
+ var _a, _b;
104
+ return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
105
+ },
106
+ getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
107
+ getWin: (ctx) => {
108
+ var _a;
109
+ return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
110
+ },
111
+ getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
112
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
113
+ };
114
+ return __spreadValues2(__spreadValues2({}, dom2), helpers);
115
+ }
79
116
  var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
80
117
  var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
81
118
  var supportsMouseEvent = () => isDom() && window.onmousedown === null;
82
119
  var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
83
120
  var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
84
121
  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);
92
- function getListenerElements() {
93
- ;
94
- globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
95
- return globalThis.__listenerElements__;
122
+ function getElementOffset(element) {
123
+ let left = 0;
124
+ let top = 0;
125
+ let el = element;
126
+ if (el.parentNode) {
127
+ do {
128
+ left += el.offsetLeft;
129
+ top += el.offsetTop;
130
+ } while ((el = el.offsetParent) && el.nodeType < 9);
131
+ el = element;
132
+ do {
133
+ left -= el.scrollLeft;
134
+ top -= el.scrollTop;
135
+ } while ((el = el.parentNode) && !/body/i.test(el.nodeName));
136
+ }
137
+ return {
138
+ top,
139
+ right: innerWidth - left - element.offsetWidth,
140
+ bottom: innerHeight - top - element.offsetHeight,
141
+ left
142
+ };
96
143
  }
97
- function getListenerCache() {
98
- ;
99
- globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
100
- return globalThis.__listenerCache__;
144
+ function getPointRelativeToNode(point, element) {
145
+ const offset = getElementOffset(element);
146
+ const x = point.x - offset.left;
147
+ const y = point.y - offset.top;
148
+ return { x, y };
101
149
  }
102
- function addGlobalEventListener(node, type, handler, options) {
150
+ var rtlKeyMap = {
151
+ ArrowLeft: "ArrowRight",
152
+ ArrowRight: "ArrowLeft",
153
+ Home: "End",
154
+ End: "Home"
155
+ };
156
+ var sameKeyMap = {
157
+ Up: "ArrowUp",
158
+ Down: "ArrowDown",
159
+ Esc: "Escape",
160
+ " ": "Space",
161
+ ",": "Comma",
162
+ Left: "ArrowLeft",
163
+ Right: "ArrowRight"
164
+ };
165
+ function getEventKey(event, options = {}) {
103
166
  var _a;
104
- if (!node)
105
- return noop;
106
- const hash = JSON.stringify({ type, options });
107
- const listenerElements = getListenerElements();
108
- const listenerCache = getListenerCache();
109
- const group = listenerElements.get(node);
110
- if (!listenerElements.has(node)) {
111
- const group2 = /* @__PURE__ */ new Map([[hash, /* @__PURE__ */ new Set([handler])]]);
112
- listenerElements.set(node, group2);
113
- } else if (group == null ? void 0 : group.has(hash)) {
114
- (_a = group == null ? void 0 : group.get(hash)) == null ? void 0 : _a.add(handler);
115
- } else {
116
- group == null ? void 0 : group.set(hash, /* @__PURE__ */ new Set([handler]));
167
+ const { dir = "ltr", orientation = "horizontal" } = options;
168
+ let { key } = event;
169
+ key = (_a = sameKeyMap[key]) != null ? _a : key;
170
+ const isRtl = dir === "rtl" && orientation === "horizontal";
171
+ if (isRtl && key in rtlKeyMap) {
172
+ key = rtlKeyMap[key];
117
173
  }
118
- function attach(node2) {
119
- var _a2, _b;
120
- function listener(event) {
121
- var _a3;
122
- const group2 = listenerElements.get(node2);
123
- (_a3 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a3.forEach((fn) => fn(event));
124
- }
125
- if (!(listenerCache == null ? void 0 : listenerCache.has(node2))) {
126
- listenerCache.set(node2, /* @__PURE__ */ new Map([[hash, listener]]));
127
- node2.addEventListener(type, listener, options);
128
- return;
129
- }
130
- if (!((_a2 = listenerCache == null ? void 0 : listenerCache.get(node2)) == null ? void 0 : _a2.has(hash))) {
131
- (_b = listenerCache.get(node2)) == null ? void 0 : _b.set(hash, listener);
132
- node2.addEventListener(type, listener, options);
133
- }
174
+ return key;
175
+ }
176
+ var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
177
+ var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
178
+ function getEventStep(event) {
179
+ if (event.ctrlKey || event.metaKey) {
180
+ return 0.1;
181
+ } else {
182
+ const isPageKey = PAGE_KEYS.has(event.key);
183
+ const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
184
+ return isSkipKey ? 10 : 1;
134
185
  }
135
- attach(node);
136
- return function remove() {
137
- var _a2, _b, _c, _d;
138
- if (!listenerElements.has(node))
139
- return;
140
- const group2 = listenerElements.get(node);
141
- (_a2 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a2.delete(handler);
142
- if (((_b = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _b.size) === 0) {
143
- const listener = (_c = listenerCache.get(node)) == null ? void 0 : _c.get(hash);
144
- node.removeEventListener(type, listener, options);
145
- group2 == null ? void 0 : group2.delete(hash);
146
- (_d = listenerCache.get(node)) == null ? void 0 : _d.delete(hash);
147
- if ((group2 == null ? void 0 : group2.size) === 0) {
148
- listenerElements.delete(node);
149
- listenerCache.delete(node);
150
- }
151
- }
152
- };
153
186
  }
154
187
  var isRef = (v) => hasProp(v, "current");
155
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
188
+ var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
156
189
  function extractInfo(event, type = "page") {
157
- const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
190
+ const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
158
191
  return {
159
192
  point: {
160
193
  x: point[`${type}X`],
@@ -162,9 +195,12 @@ function extractInfo(event, type = "page") {
162
195
  }
163
196
  };
164
197
  }
165
- function addDomEvent(target, event, listener, options) {
198
+ function addDomEvent(target, eventName, handler, options) {
166
199
  const node = isRef(target) ? target.current : runIfFn(target);
167
- return addGlobalEventListener(node, event, listener, options);
200
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
201
+ return () => {
202
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
203
+ };
168
204
  }
169
205
  function addPointerEvent(target, event, listener, options) {
170
206
  var _a;
@@ -212,66 +248,24 @@ function getEventName(evt) {
212
248
  return mouseEventNames[evt];
213
249
  return evt;
214
250
  }
215
- var rtlKeyMap = {
216
- ArrowLeft: "ArrowRight",
217
- ArrowRight: "ArrowLeft",
218
- Home: "End",
219
- End: "Home"
220
- };
221
- var sameKeyMap = {
222
- Up: "ArrowUp",
223
- Down: "ArrowDown",
224
- Esc: "Escape",
225
- " ": "Space",
226
- ",": "Comma",
227
- Left: "ArrowLeft",
228
- Right: "ArrowRight"
229
- };
230
- function getEventKey(event, options = {}) {
231
- var _a;
232
- const { dir = "ltr", orientation = "horizontal" } = options;
233
- let { key } = event;
234
- key = (_a = sameKeyMap[key]) != null ? _a : key;
235
- const isRtl = dir === "rtl" && orientation === "horizontal";
236
- if (isRtl && key in rtlKeyMap) {
237
- key = rtlKeyMap[key];
238
- }
239
- return key;
240
- }
241
- var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
242
- var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
243
- function getEventStep(event) {
244
- if (event.ctrlKey || event.metaKey) {
245
- return 0.1;
246
- } else {
247
- const isPageKey = PAGE_KEYS.has(event.key);
248
- const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
249
- return isSkipKey ? 10 : 1;
251
+ function nextTick(fn) {
252
+ const set = /* @__PURE__ */ new Set();
253
+ function raf2(fn2) {
254
+ const id = globalThis.requestAnimationFrame(fn2);
255
+ set.add(() => globalThis.cancelAnimationFrame(id));
250
256
  }
257
+ raf2(() => raf2(fn));
258
+ return function cleanup() {
259
+ set.forEach(function(fn2) {
260
+ fn2();
261
+ });
262
+ };
251
263
  }
252
- function itemById(v, id) {
253
- return v.find((node) => node.id === id);
254
- }
255
- function indexOfId(v, id) {
256
- const item = itemById(v, id);
257
- return item ? v.indexOf(item) : -1;
258
- }
259
- var getValueText = (item) => {
260
- var _a, _b;
261
- return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
262
- };
263
- var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
264
- var wrap = (v, idx) => {
265
- return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
266
- };
267
- function findByText(v, text, currentId) {
268
- const index = currentId ? indexOfId(v, currentId) : -1;
269
- let items = currentId ? wrap(v, index) : v;
270
- const isSingleKey = text.length === 1;
271
- if (isSingleKey) {
272
- items = items.filter((item) => item.id !== currentId);
273
- }
274
- return items.find((item) => match(getValueText(item), text));
264
+ function raf(fn) {
265
+ const id = globalThis.requestAnimationFrame(fn);
266
+ return function cleanup() {
267
+ globalThis.cancelAnimationFrame(id);
268
+ };
275
269
  }
276
270
  var state = "default";
277
271
  var savedUserSelect = "";
@@ -334,83 +328,37 @@ function trackPointerMove(opts) {
334
328
  }
335
329
  onPointerMove(info, event);
336
330
  };
337
- return pipe(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
331
+ return callAll(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
338
332
  }
339
- function findByTypeahead(_items, options) {
340
- const { state: state2, activeId, key, timeout = 350 } = options;
341
- const search = state2.keysSoFar + key;
342
- const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
343
- const query2 = isRepeated ? search[0] : search;
344
- let items = _items.slice();
345
- const next = findByText(items, query2, activeId);
346
- function cleanup() {
347
- clearTimeout(state2.timer);
348
- state2.timer = -1;
349
- }
350
- function update(value) {
351
- state2.keysSoFar = value;
352
- cleanup();
353
- if (value !== "") {
354
- state2.timer = +setTimeout(() => {
355
- update("");
356
- cleanup();
357
- }, timeout);
358
- }
359
- }
360
- update(search);
361
- return next;
362
- }
363
- findByTypeahead.defaultOptions = {
364
- keysSoFar: "",
365
- timer: -1
366
- };
367
-
368
- // ../../types/dist/index.mjs
369
- function createNormalizer(fn) {
370
- return new Proxy({}, {
371
- get() {
372
- return fn;
373
- }
374
- });
375
- }
376
- var normalizeProp = createNormalizer((v) => v);
377
333
 
378
334
  // src/splitter.dom.ts
379
- var dom = {
380
- getDoc: (ctx) => {
381
- var _a;
382
- return (_a = ctx.doc) != null ? _a : document;
383
- },
384
- getRootNode: (ctx) => {
385
- var _a;
386
- return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
387
- },
335
+ var dom = defineDomHelpers({
388
336
  getRootId: (ctx) => {
389
337
  var _a, _b;
390
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `splitter:${ctx.uid}`;
338
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `splitter:${ctx.id}`;
391
339
  },
392
340
  getSplitterId: (ctx) => {
393
341
  var _a, _b;
394
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.splitter) != null ? _b : `splitter:${ctx.uid}:splitter`;
342
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.splitter) != null ? _b : `splitter:${ctx.id}:splitter`;
395
343
  },
396
344
  getToggleButtonId: (ctx) => {
397
345
  var _a, _b;
398
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.toggleBtn) != null ? _b : `splitter:${ctx.uid}:toggle-btn`;
346
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.toggleBtn) != null ? _b : `splitter:${ctx.id}:toggle-btn`;
399
347
  },
400
348
  getLabelId: (ctx) => {
401
349
  var _a, _b;
402
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `splitter:${ctx.uid}:label`;
350
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `splitter:${ctx.id}:label`;
403
351
  },
404
352
  getPrimaryPaneId: (ctx) => {
405
353
  var _a, _b;
406
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.primaryPane) != null ? _b : `splitter:${ctx.uid}:primary`;
354
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.primaryPane) != null ? _b : `splitter:${ctx.id}:primary`;
407
355
  },
408
356
  getSecondaryPaneId: (ctx) => {
409
357
  var _a, _b;
410
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.secondaryPane) != null ? _b : `splitter:${ctx.uid}:secondary`;
358
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.secondaryPane) != null ? _b : `splitter:${ctx.id}:secondary`;
411
359
  },
412
- getSplitterEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getSplitterId(ctx)),
413
- getPrimaryPaneEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getPrimaryPaneId(ctx)),
360
+ getSplitterEl: (ctx) => dom.getById(ctx, dom.getSplitterId(ctx)),
361
+ getPrimaryPaneEl: (ctx) => dom.getById(ctx, dom.getPrimaryPaneId(ctx)),
414
362
  getCursor(ctx) {
415
363
  if (ctx.disabled || ctx.fixed)
416
364
  return "default";
@@ -422,10 +370,10 @@ var dom = {
422
370
  cursor = x ? "w-resize" : "n-resize";
423
371
  return cursor;
424
372
  }
425
- };
373
+ });
426
374
 
427
375
  // src/splitter.connect.ts
428
- function connect(state2, send, normalize = normalizeProp) {
376
+ function connect(state2, send, normalize) {
429
377
  const isHorizontal = state2.context.isHorizontal;
430
378
  const isDisabled = state2.context.disabled;
431
379
  const isFocused = state2.hasTag("focus");
@@ -639,26 +587,13 @@ function decimalOperation(a, op, b) {
639
587
  }
640
588
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
641
589
 
642
- // ../../utilities/rect/dist/index.mjs
643
- var isDom2 = () => typeof window !== "undefined";
644
- var isTouchDevice2 = isDom2() && !!navigator.maxTouchPoints;
645
- function relativeToNode(p, el) {
646
- const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
647
- const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
648
- return {
649
- point: { x: dx, y: dy },
650
- progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
651
- };
652
- }
653
-
654
590
  // src/splitter.machine.ts
655
591
  var { not } = import_core.guards;
656
- function machine(ctx = {}) {
592
+ function machine(ctx) {
657
593
  return (0, import_core.createMachine)({
658
594
  id: "splitter",
659
595
  initial: "unknown",
660
596
  context: __spreadValues({
661
- uid: "",
662
597
  orientation: "horizontal",
663
598
  min: 224,
664
599
  max: 340,
@@ -691,10 +626,7 @@ function machine(ctx = {}) {
691
626
  states: {
692
627
  unknown: {
693
628
  on: {
694
- SETUP: {
695
- target: "idle",
696
- actions: "setupDocument"
697
- }
629
+ SETUP: "idle"
698
630
  }
699
631
  },
700
632
  idle: {
@@ -831,13 +763,6 @@ function machine(ctx = {}) {
831
763
  var _a;
832
764
  (_a = ctx2.onChangeEnd) == null ? void 0 : _a.call(ctx2, { value: ctx2.value });
833
765
  },
834
- setupDocument(ctx2, evt) {
835
- if (evt.doc)
836
- ctx2.doc = (0, import_core.ref)(evt.doc);
837
- if (evt.root)
838
- ctx2.rootNode = (0, import_core.ref)(evt.root);
839
- ctx2.uid = evt.id;
840
- },
841
766
  setToMin(ctx2) {
842
767
  ctx2.value = ctx2.min;
843
768
  },
@@ -857,11 +782,11 @@ function machine(ctx = {}) {
857
782
  });
858
783
  },
859
784
  setPointerValue(ctx2, evt) {
860
- const primaryPane = dom.getPrimaryPaneEl(ctx2);
861
- if (!primaryPane)
785
+ const el = dom.getPrimaryPaneEl(ctx2);
786
+ if (!el)
862
787
  return;
863
- const { point } = relativeToNode(evt.point, primaryPane);
864
- let currentPoint = ctx2.isHorizontal ? point.x : point.y;
788
+ const relativePoint = getPointRelativeToNode(evt.point, el);
789
+ let currentPoint = ctx2.isHorizontal ? relativePoint.x : relativePoint.y;
865
790
  let value = parseFloat(snapToStep(clamp(currentPoint, ctx2), ctx2.step));
866
791
  if (Math.abs(value - ctx2.min) <= ctx2.snapOffset) {
867
792
  value = ctx2.min;
@@ -873,4 +798,3 @@ function machine(ctx = {}) {
873
798
  }
874
799
  });
875
800
  }
876
- //# sourceMappingURL=index.js.map