@zag-js/splitter 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 +82 -70
- package/dist/index.mjs +82 -71
- package/dist/splitter.connect.d.ts +3 -3
- package/dist/splitter.dom.d.ts +2 -2
- package/dist/splitter.machine.d.ts +1 -1
- package/dist/splitter.types.d.ts +2 -2
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -44,10 +44,19 @@ var __pow = Math.pow;
|
|
|
44
44
|
var dataAttr = (guard) => {
|
|
45
45
|
return guard ? "" : void 0;
|
|
46
46
|
};
|
|
47
|
-
var
|
|
47
|
+
var runIfFn = (v, ...a) => {
|
|
48
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
49
|
+
return res != null ? res : void 0;
|
|
50
|
+
};
|
|
51
|
+
var callAll = (...fns) => (...a) => {
|
|
52
|
+
fns.forEach(function(fn) {
|
|
53
|
+
fn == null ? void 0 : fn(...a);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
48
56
|
var isArray = (v) => Array.isArray(v);
|
|
49
57
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
50
58
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
59
|
+
var isDom = () => typeof window !== "undefined";
|
|
51
60
|
function getPlatform() {
|
|
52
61
|
var _a;
|
|
53
62
|
const agent = navigator.userAgentData;
|
|
@@ -64,15 +73,75 @@ var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
|
64
73
|
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
65
74
|
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
66
75
|
var isLeftClick = (v) => v.button === 0;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
function getElementOffset(element) {
|
|
77
|
+
let left = 0;
|
|
78
|
+
let top = 0;
|
|
79
|
+
let el = element;
|
|
80
|
+
if (el.parentNode) {
|
|
81
|
+
do {
|
|
82
|
+
left += el.offsetLeft;
|
|
83
|
+
top += el.offsetTop;
|
|
84
|
+
} while ((el = el.offsetParent) && el.nodeType < 9);
|
|
85
|
+
el = element;
|
|
86
|
+
do {
|
|
87
|
+
left -= el.scrollLeft;
|
|
88
|
+
top -= el.scrollTop;
|
|
89
|
+
} while ((el = el.parentNode) && !/body/i.test(el.nodeName));
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
top,
|
|
93
|
+
right: innerWidth - left - element.offsetWidth,
|
|
94
|
+
bottom: innerHeight - top - element.offsetHeight,
|
|
95
|
+
left
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function getPointRelativeToNode(point, element) {
|
|
99
|
+
const offset = getElementOffset(element);
|
|
100
|
+
const x = point.x - offset.left;
|
|
101
|
+
const y = point.y - offset.top;
|
|
102
|
+
return { x, y };
|
|
103
|
+
}
|
|
104
|
+
var rtlKeyMap = {
|
|
105
|
+
ArrowLeft: "ArrowRight",
|
|
106
|
+
ArrowRight: "ArrowLeft",
|
|
107
|
+
Home: "End",
|
|
108
|
+
End: "Home"
|
|
70
109
|
};
|
|
71
|
-
var
|
|
110
|
+
var sameKeyMap = {
|
|
111
|
+
Up: "ArrowUp",
|
|
112
|
+
Down: "ArrowDown",
|
|
113
|
+
Esc: "Escape",
|
|
114
|
+
" ": "Space",
|
|
115
|
+
",": "Comma",
|
|
116
|
+
Left: "ArrowLeft",
|
|
117
|
+
Right: "ArrowRight"
|
|
118
|
+
};
|
|
119
|
+
function getEventKey(event, options = {}) {
|
|
120
|
+
var _a;
|
|
121
|
+
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
122
|
+
let { key } = event;
|
|
123
|
+
key = (_a = sameKeyMap[key]) != null ? _a : key;
|
|
124
|
+
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
125
|
+
if (isRtl && key in rtlKeyMap) {
|
|
126
|
+
key = rtlKeyMap[key];
|
|
127
|
+
}
|
|
128
|
+
return key;
|
|
129
|
+
}
|
|
130
|
+
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
131
|
+
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
132
|
+
function getEventStep(event) {
|
|
133
|
+
if (event.ctrlKey || event.metaKey) {
|
|
134
|
+
return 0.1;
|
|
135
|
+
} else {
|
|
136
|
+
const isPageKey = PAGE_KEYS.has(event.key);
|
|
137
|
+
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
138
|
+
return isSkipKey ? 10 : 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
72
141
|
var isRef = (v) => hasProp(v, "current");
|
|
73
|
-
var
|
|
142
|
+
var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
74
143
|
function extractInfo(event, type = "page") {
|
|
75
|
-
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] ||
|
|
144
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
|
|
76
145
|
return {
|
|
77
146
|
point: {
|
|
78
147
|
x: point[`${type}X`],
|
|
@@ -152,43 +221,6 @@ function raf(fn) {
|
|
|
152
221
|
globalThis.cancelAnimationFrame(id);
|
|
153
222
|
};
|
|
154
223
|
}
|
|
155
|
-
var rtlKeyMap = {
|
|
156
|
-
ArrowLeft: "ArrowRight",
|
|
157
|
-
ArrowRight: "ArrowLeft",
|
|
158
|
-
Home: "End",
|
|
159
|
-
End: "Home"
|
|
160
|
-
};
|
|
161
|
-
var sameKeyMap = {
|
|
162
|
-
Up: "ArrowUp",
|
|
163
|
-
Down: "ArrowDown",
|
|
164
|
-
Esc: "Escape",
|
|
165
|
-
" ": "Space",
|
|
166
|
-
",": "Comma",
|
|
167
|
-
Left: "ArrowLeft",
|
|
168
|
-
Right: "ArrowRight"
|
|
169
|
-
};
|
|
170
|
-
function getEventKey(event, options = {}) {
|
|
171
|
-
var _a;
|
|
172
|
-
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
173
|
-
let { key } = event;
|
|
174
|
-
key = (_a = sameKeyMap[key]) != null ? _a : key;
|
|
175
|
-
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
176
|
-
if (isRtl && key in rtlKeyMap) {
|
|
177
|
-
key = rtlKeyMap[key];
|
|
178
|
-
}
|
|
179
|
-
return key;
|
|
180
|
-
}
|
|
181
|
-
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
182
|
-
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
183
|
-
function getEventStep(event) {
|
|
184
|
-
if (event.ctrlKey || event.metaKey) {
|
|
185
|
-
return 0.1;
|
|
186
|
-
} else {
|
|
187
|
-
const isPageKey = PAGE_KEYS.has(event.key);
|
|
188
|
-
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
189
|
-
return isSkipKey ? 10 : 1;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
224
|
var state = "default";
|
|
193
225
|
var savedUserSelect = "";
|
|
194
226
|
var modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -250,18 +282,8 @@ function trackPointerMove(opts) {
|
|
|
250
282
|
}
|
|
251
283
|
onPointerMove(info, event);
|
|
252
284
|
};
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ../../types/dist/index.mjs
|
|
257
|
-
function createNormalizer(fn) {
|
|
258
|
-
return new Proxy({}, {
|
|
259
|
-
get() {
|
|
260
|
-
return fn;
|
|
261
|
-
}
|
|
262
|
-
});
|
|
285
|
+
return callAll(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
|
|
263
286
|
}
|
|
264
|
-
var normalizeProp = createNormalizer((v) => v);
|
|
265
287
|
|
|
266
288
|
// src/splitter.dom.ts
|
|
267
289
|
var dom = {
|
|
@@ -313,7 +335,7 @@ var dom = {
|
|
|
313
335
|
};
|
|
314
336
|
|
|
315
337
|
// src/splitter.connect.ts
|
|
316
|
-
function connect(state2, send, normalize
|
|
338
|
+
function connect(state2, send, normalize) {
|
|
317
339
|
const isHorizontal = state2.context.isHorizontal;
|
|
318
340
|
const isDisabled = state2.context.disabled;
|
|
319
341
|
const isFocused = state2.hasTag("focus");
|
|
@@ -527,16 +549,6 @@ function decimalOperation(a, op, b) {
|
|
|
527
549
|
}
|
|
528
550
|
var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
|
|
529
551
|
|
|
530
|
-
// ../../utilities/rect/dist/index.mjs
|
|
531
|
-
function relativeToNode(p, el) {
|
|
532
|
-
const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
|
|
533
|
-
const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
|
|
534
|
-
return {
|
|
535
|
-
point: { x: dx, y: dy },
|
|
536
|
-
progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
|
|
540
552
|
// src/splitter.machine.ts
|
|
541
553
|
var { not } = import_core.guards;
|
|
542
554
|
function machine(ctx = {}) {
|
|
@@ -743,11 +755,11 @@ function machine(ctx = {}) {
|
|
|
743
755
|
});
|
|
744
756
|
},
|
|
745
757
|
setPointerValue(ctx2, evt) {
|
|
746
|
-
const
|
|
747
|
-
if (!
|
|
758
|
+
const el = dom.getPrimaryPaneEl(ctx2);
|
|
759
|
+
if (!el)
|
|
748
760
|
return;
|
|
749
|
-
const
|
|
750
|
-
let currentPoint = ctx2.isHorizontal ?
|
|
761
|
+
const relativePoint = getPointRelativeToNode(evt.point, el);
|
|
762
|
+
let currentPoint = ctx2.isHorizontal ? relativePoint.x : relativePoint.y;
|
|
751
763
|
let value = parseFloat(snapToStep(clamp(currentPoint, ctx2), ctx2.step));
|
|
752
764
|
if (Math.abs(value - ctx2.min) <= ctx2.snapOffset) {
|
|
753
765
|
value = ctx2.min;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -21,10 +20,19 @@ var __pow = Math.pow;
|
|
|
21
20
|
var dataAttr = (guard) => {
|
|
22
21
|
return guard ? "" : void 0;
|
|
23
22
|
};
|
|
24
|
-
var
|
|
23
|
+
var runIfFn = (v, ...a) => {
|
|
24
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
25
|
+
return res != null ? res : void 0;
|
|
26
|
+
};
|
|
27
|
+
var callAll = (...fns) => (...a) => {
|
|
28
|
+
fns.forEach(function(fn) {
|
|
29
|
+
fn == null ? void 0 : fn(...a);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
25
32
|
var isArray = (v) => Array.isArray(v);
|
|
26
33
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
27
34
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
35
|
+
var isDom = () => typeof window !== "undefined";
|
|
28
36
|
function getPlatform() {
|
|
29
37
|
var _a;
|
|
30
38
|
const agent = navigator.userAgentData;
|
|
@@ -41,15 +49,75 @@ var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
|
41
49
|
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
42
50
|
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
43
51
|
var isLeftClick = (v) => v.button === 0;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
function getElementOffset(element) {
|
|
53
|
+
let left = 0;
|
|
54
|
+
let top = 0;
|
|
55
|
+
let el = element;
|
|
56
|
+
if (el.parentNode) {
|
|
57
|
+
do {
|
|
58
|
+
left += el.offsetLeft;
|
|
59
|
+
top += el.offsetTop;
|
|
60
|
+
} while ((el = el.offsetParent) && el.nodeType < 9);
|
|
61
|
+
el = element;
|
|
62
|
+
do {
|
|
63
|
+
left -= el.scrollLeft;
|
|
64
|
+
top -= el.scrollTop;
|
|
65
|
+
} while ((el = el.parentNode) && !/body/i.test(el.nodeName));
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
top,
|
|
69
|
+
right: innerWidth - left - element.offsetWidth,
|
|
70
|
+
bottom: innerHeight - top - element.offsetHeight,
|
|
71
|
+
left
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function getPointRelativeToNode(point, element) {
|
|
75
|
+
const offset = getElementOffset(element);
|
|
76
|
+
const x = point.x - offset.left;
|
|
77
|
+
const y = point.y - offset.top;
|
|
78
|
+
return { x, y };
|
|
79
|
+
}
|
|
80
|
+
var rtlKeyMap = {
|
|
81
|
+
ArrowLeft: "ArrowRight",
|
|
82
|
+
ArrowRight: "ArrowLeft",
|
|
83
|
+
Home: "End",
|
|
84
|
+
End: "Home"
|
|
47
85
|
};
|
|
48
|
-
var
|
|
86
|
+
var sameKeyMap = {
|
|
87
|
+
Up: "ArrowUp",
|
|
88
|
+
Down: "ArrowDown",
|
|
89
|
+
Esc: "Escape",
|
|
90
|
+
" ": "Space",
|
|
91
|
+
",": "Comma",
|
|
92
|
+
Left: "ArrowLeft",
|
|
93
|
+
Right: "ArrowRight"
|
|
94
|
+
};
|
|
95
|
+
function getEventKey(event, options = {}) {
|
|
96
|
+
var _a;
|
|
97
|
+
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
98
|
+
let { key } = event;
|
|
99
|
+
key = (_a = sameKeyMap[key]) != null ? _a : key;
|
|
100
|
+
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
101
|
+
if (isRtl && key in rtlKeyMap) {
|
|
102
|
+
key = rtlKeyMap[key];
|
|
103
|
+
}
|
|
104
|
+
return key;
|
|
105
|
+
}
|
|
106
|
+
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
107
|
+
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
108
|
+
function getEventStep(event) {
|
|
109
|
+
if (event.ctrlKey || event.metaKey) {
|
|
110
|
+
return 0.1;
|
|
111
|
+
} else {
|
|
112
|
+
const isPageKey = PAGE_KEYS.has(event.key);
|
|
113
|
+
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
114
|
+
return isSkipKey ? 10 : 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
49
117
|
var isRef = (v) => hasProp(v, "current");
|
|
50
|
-
var
|
|
118
|
+
var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
51
119
|
function extractInfo(event, type = "page") {
|
|
52
|
-
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] ||
|
|
120
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
|
|
53
121
|
return {
|
|
54
122
|
point: {
|
|
55
123
|
x: point[`${type}X`],
|
|
@@ -129,43 +197,6 @@ function raf(fn) {
|
|
|
129
197
|
globalThis.cancelAnimationFrame(id);
|
|
130
198
|
};
|
|
131
199
|
}
|
|
132
|
-
var rtlKeyMap = {
|
|
133
|
-
ArrowLeft: "ArrowRight",
|
|
134
|
-
ArrowRight: "ArrowLeft",
|
|
135
|
-
Home: "End",
|
|
136
|
-
End: "Home"
|
|
137
|
-
};
|
|
138
|
-
var sameKeyMap = {
|
|
139
|
-
Up: "ArrowUp",
|
|
140
|
-
Down: "ArrowDown",
|
|
141
|
-
Esc: "Escape",
|
|
142
|
-
" ": "Space",
|
|
143
|
-
",": "Comma",
|
|
144
|
-
Left: "ArrowLeft",
|
|
145
|
-
Right: "ArrowRight"
|
|
146
|
-
};
|
|
147
|
-
function getEventKey(event, options = {}) {
|
|
148
|
-
var _a;
|
|
149
|
-
const { dir = "ltr", orientation = "horizontal" } = options;
|
|
150
|
-
let { key } = event;
|
|
151
|
-
key = (_a = sameKeyMap[key]) != null ? _a : key;
|
|
152
|
-
const isRtl = dir === "rtl" && orientation === "horizontal";
|
|
153
|
-
if (isRtl && key in rtlKeyMap) {
|
|
154
|
-
key = rtlKeyMap[key];
|
|
155
|
-
}
|
|
156
|
-
return key;
|
|
157
|
-
}
|
|
158
|
-
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
159
|
-
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
160
|
-
function getEventStep(event) {
|
|
161
|
-
if (event.ctrlKey || event.metaKey) {
|
|
162
|
-
return 0.1;
|
|
163
|
-
} else {
|
|
164
|
-
const isPageKey = PAGE_KEYS.has(event.key);
|
|
165
|
-
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
166
|
-
return isSkipKey ? 10 : 1;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
200
|
var state = "default";
|
|
170
201
|
var savedUserSelect = "";
|
|
171
202
|
var modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -227,18 +258,8 @@ function trackPointerMove(opts) {
|
|
|
227
258
|
}
|
|
228
259
|
onPointerMove(info, event);
|
|
229
260
|
};
|
|
230
|
-
return
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// ../../types/dist/index.mjs
|
|
234
|
-
function createNormalizer(fn) {
|
|
235
|
-
return new Proxy({}, {
|
|
236
|
-
get() {
|
|
237
|
-
return fn;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
261
|
+
return callAll(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
|
|
240
262
|
}
|
|
241
|
-
var normalizeProp = createNormalizer((v) => v);
|
|
242
263
|
|
|
243
264
|
// src/splitter.dom.ts
|
|
244
265
|
var dom = {
|
|
@@ -290,7 +311,7 @@ var dom = {
|
|
|
290
311
|
};
|
|
291
312
|
|
|
292
313
|
// src/splitter.connect.ts
|
|
293
|
-
function connect(state2, send, normalize
|
|
314
|
+
function connect(state2, send, normalize) {
|
|
294
315
|
const isHorizontal = state2.context.isHorizontal;
|
|
295
316
|
const isDisabled = state2.context.disabled;
|
|
296
317
|
const isFocused = state2.hasTag("focus");
|
|
@@ -504,16 +525,6 @@ function decimalOperation(a, op, b) {
|
|
|
504
525
|
}
|
|
505
526
|
var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
|
|
506
527
|
|
|
507
|
-
// ../../utilities/rect/dist/index.mjs
|
|
508
|
-
function relativeToNode(p, el) {
|
|
509
|
-
const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
|
|
510
|
-
const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
|
|
511
|
-
return {
|
|
512
|
-
point: { x: dx, y: dy },
|
|
513
|
-
progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
|
|
517
528
|
// src/splitter.machine.ts
|
|
518
529
|
var { not } = guards;
|
|
519
530
|
function machine(ctx = {}) {
|
|
@@ -720,11 +731,11 @@ function machine(ctx = {}) {
|
|
|
720
731
|
});
|
|
721
732
|
},
|
|
722
733
|
setPointerValue(ctx2, evt) {
|
|
723
|
-
const
|
|
724
|
-
if (!
|
|
734
|
+
const el = dom.getPrimaryPaneEl(ctx2);
|
|
735
|
+
if (!el)
|
|
725
736
|
return;
|
|
726
|
-
const
|
|
727
|
-
let currentPoint = ctx2.isHorizontal ?
|
|
737
|
+
const relativePoint = getPointRelativeToNode(evt.point, el);
|
|
738
|
+
let currentPoint = ctx2.isHorizontal ? relativePoint.x : relativePoint.y;
|
|
728
739
|
let value = parseFloat(snapToStep(clamp(currentPoint, ctx2), ctx2.step));
|
|
729
740
|
if (Math.abs(value - ctx2.min) <= ctx2.snapOffset) {
|
|
730
741
|
value = ctx2.min;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Send, State } from "./splitter.types";
|
|
3
|
-
export declare function connect<T extends PropTypes
|
|
1
|
+
import type { NormalizeProps, PropTypes } from "@zag-js/types";
|
|
2
|
+
import type { Send, State } from "./splitter.types";
|
|
3
|
+
export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
4
4
|
isCollapsed: boolean;
|
|
5
5
|
isExpanded: boolean;
|
|
6
6
|
isFocused: boolean;
|
package/dist/splitter.dom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MachineContext as Ctx } from "./splitter.types";
|
|
1
|
+
import type { MachineContext as Ctx } from "./splitter.types";
|
|
2
2
|
export declare const dom: {
|
|
3
3
|
getDoc: (ctx: Ctx) => Document;
|
|
4
4
|
getRootNode: (ctx: Ctx) => Document | ShadowRoot;
|
|
@@ -10,5 +10,5 @@ export declare const dom: {
|
|
|
10
10
|
getSecondaryPaneId: (ctx: Ctx) => string;
|
|
11
11
|
getSplitterEl: (ctx: Ctx) => HTMLElement;
|
|
12
12
|
getPrimaryPaneEl: (ctx: Ctx) => HTMLElement;
|
|
13
|
-
getCursor(ctx: Ctx):
|
|
13
|
+
getCursor(ctx: Ctx): any;
|
|
14
14
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MachineContext, MachineState, UserDefinedContext } from "./splitter.types";
|
|
1
|
+
import type { MachineContext, MachineState, UserDefinedContext } from "./splitter.types";
|
|
2
2
|
export declare function machine(ctx?: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
|
package/dist/splitter.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StateMachine as S } from "@zag-js/core";
|
|
2
|
-
import { Context, DirectionProperty } from "@zag-js/types";
|
|
1
|
+
import type { StateMachine as S } from "@zag-js/core";
|
|
2
|
+
import type { Context, DirectionProperty } from "@zag-js/types";
|
|
3
3
|
declare type ElementIds = Partial<{
|
|
4
4
|
root: string;
|
|
5
5
|
splitter: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/splitter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Core logic for the splitter widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@zag-js/core": "0.1.
|
|
34
|
-
"@zag-js/dom-utils": "0.1.
|
|
33
|
+
"@zag-js/core": "0.1.7",
|
|
34
|
+
"@zag-js/dom-utils": "0.1.6",
|
|
35
35
|
"@zag-js/number-utils": "0.1.2",
|
|
36
|
-
"@zag-js/
|
|
37
|
-
"@zag-js/types": "0.2.0"
|
|
36
|
+
"@zag-js/types": "0.2.1"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
40
39
|
"build:fast": "zag build",
|