@zag-js/splitter 0.10.1 → 0.10.3

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,7 +1,4 @@
1
- export { anatomy } from './splitter.anatomy.js';
2
- export { connect } from './splitter.connect.js';
3
- export { machine } from './splitter.machine.js';
4
- export { UserDefinedContext as Context, MachineState, PanelProps, ResizeTriggerProps } from './splitter.types.js';
5
- import '@zag-js/anatomy';
6
- import '@zag-js/types';
7
- import '@zag-js/core';
1
+ export { anatomy } from "./splitter.anatomy";
2
+ export { connect } from "./splitter.connect";
3
+ export { machine } from "./splitter.machine";
4
+ export type { MachineState, UserDefinedContext as Context, PanelProps, ResizeTriggerProps } from "./splitter.types";
package/dist/index.js CHANGED
@@ -1,689 +1,13 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- anatomy: () => anatomy,
24
- connect: () => connect,
25
- machine: () => machine
26
- });
27
- module.exports = __toCommonJS(src_exports);
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
28
4
 
29
- // src/splitter.anatomy.ts
30
- var import_anatomy = require("@zag-js/anatomy");
31
- var anatomy = (0, import_anatomy.createAnatomy)("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
32
- var parts = anatomy.build();
5
+ const splitter_anatomy = require('./splitter.anatomy.js');
6
+ const splitter_connect = require('./splitter.connect.js');
7
+ const splitter_machine = require('./splitter.machine.js');
33
8
 
34
- // src/splitter.connect.ts
35
- var import_dom_event = require("@zag-js/dom-event");
36
- var import_dom_query2 = require("@zag-js/dom-query");
37
9
 
38
- // src/splitter.dom.ts
39
- var import_dom_query = require("@zag-js/dom-query");
40
- var dom = (0, import_dom_query.createScope)({
41
- getRootId: (ctx) => ctx.ids?.root ?? `splitter:${ctx.id}`,
42
- getResizeTriggerId: (ctx, id) => ctx.ids?.resizeTrigger?.(id) ?? `splitter:${ctx.id}:splitter:${id}`,
43
- getToggleTriggerId: (ctx) => ctx.ids?.toggleTrigger?.(ctx.id) ?? `splitter:${ctx.id}:toggle-btn`,
44
- getLabelId: (ctx) => ctx.ids?.label ?? `splitter:${ctx.id}:label`,
45
- getPanelId: (ctx, id) => ctx.ids?.panel?.(id) ?? `splitter:${ctx.id}:panel:${id}`,
46
- globalCursorId: (ctx) => `splitter:${ctx.id}:global-cursor`,
47
- getRootEl: (ctx) => dom.queryById(ctx, dom.getRootId(ctx)),
48
- getResizeTriggerEl: (ctx, id) => dom.getById(ctx, dom.getResizeTriggerId(ctx, id)),
49
- getPanelEl: (ctx, id) => dom.getById(ctx, dom.getPanelId(ctx, id)),
50
- getCursor(ctx) {
51
- const x = ctx.isHorizontal;
52
- let cursor = x ? "col-resize" : "row-resize";
53
- if (ctx.activeResizeState.isAtMin)
54
- cursor = x ? "e-resize" : "s-resize";
55
- if (ctx.activeResizeState.isAtMax)
56
- cursor = x ? "w-resize" : "n-resize";
57
- return cursor;
58
- },
59
- getPanelStyle(ctx, id) {
60
- const flexGrow = ctx.panels.find((panel) => panel.id === id)?.size ?? "0";
61
- return {
62
- flexBasis: 0,
63
- flexGrow,
64
- flexShrink: 1,
65
- overflow: "hidden"
66
- };
67
- },
68
- getActiveHandleEl(ctx) {
69
- const activeId = ctx.activeResizeId;
70
- if (activeId == null)
71
- return;
72
- return dom.getById(ctx, dom.getResizeTriggerId(ctx, activeId));
73
- },
74
- getResizeTriggerEls(ctx) {
75
- const ownerId = CSS.escape(dom.getRootId(ctx));
76
- return (0, import_dom_query.queryAll)(dom.getRootEl(ctx), `[role=separator][data-ownedby='${ownerId}']`);
77
- },
78
- setupGlobalCursor(ctx) {
79
- const styleEl = dom.getById(ctx, dom.globalCursorId(ctx));
80
- const textContent = `* { cursor: ${dom.getCursor(ctx)} !important; }`;
81
- if (styleEl) {
82
- styleEl.textContent = textContent;
83
- } else {
84
- const style = dom.getDoc(ctx).createElement("style");
85
- style.id = dom.globalCursorId(ctx);
86
- style.textContent = textContent;
87
- dom.getDoc(ctx).head.appendChild(style);
88
- }
89
- },
90
- removeGlobalCursor(ctx) {
91
- dom.getById(ctx, dom.globalCursorId(ctx))?.remove();
92
- }
93
- });
94
10
 
95
- // src/splitter.utils.ts
96
- function validateSize(key, size) {
97
- if (Math.floor(size) > 100) {
98
- throw new Error(`Total ${key} of panels cannot be greater than 100`);
99
- }
100
- }
101
- function getNormalizedPanels(ctx) {
102
- let numOfPanelsWithoutSize = 0;
103
- let totalSize = 0;
104
- let totalMinSize = 0;
105
- const panels = ctx.size.map((panel) => {
106
- const minSize = panel.minSize ?? 10;
107
- const maxSize = panel.maxSize ?? 100;
108
- totalMinSize += minSize;
109
- if (panel.size == null) {
110
- numOfPanelsWithoutSize++;
111
- } else {
112
- totalSize += panel.size;
113
- }
114
- return {
115
- ...panel,
116
- minSize,
117
- maxSize
118
- };
119
- });
120
- validateSize("minSize", totalMinSize);
121
- validateSize("size", totalSize);
122
- let end = 0;
123
- let remainingSize = 0;
124
- const result = panels.map((panel) => {
125
- let start = end;
126
- if (panel.size != null) {
127
- end += panel.size;
128
- remainingSize = panel.size - panel.minSize;
129
- return {
130
- ...panel,
131
- start,
132
- end,
133
- remainingSize
134
- };
135
- }
136
- const size = (100 - totalSize) / numOfPanelsWithoutSize;
137
- end += size;
138
- remainingSize = size - panel.minSize;
139
- return { ...panel, size, start, end, remainingSize };
140
- });
141
- return result;
142
- }
143
- function getHandlePanels(ctx, id = ctx.activeResizeId) {
144
- const [beforeId, afterId] = id?.split(":") ?? [];
145
- if (!beforeId || !afterId)
146
- return;
147
- const beforeIndex = ctx.previousPanels.findIndex((panel) => panel.id === beforeId);
148
- const afterIndex = ctx.previousPanels.findIndex((panel) => panel.id === afterId);
149
- if (beforeIndex === -1 || afterIndex === -1)
150
- return;
151
- const before = ctx.previousPanels[beforeIndex];
152
- const after = ctx.previousPanels[afterIndex];
153
- return {
154
- before: {
155
- ...before,
156
- index: beforeIndex
157
- },
158
- after: {
159
- ...after,
160
- index: afterIndex
161
- }
162
- };
163
- }
164
- function getHandleBounds(ctx, id = ctx.activeResizeId) {
165
- const panels = getHandlePanels(ctx, id);
166
- if (!panels)
167
- return;
168
- const { before, after } = panels;
169
- return {
170
- min: Math.max(before.start + before.minSize, after.end - after.maxSize),
171
- max: Math.min(after.end - after.minSize, before.maxSize + before.start)
172
- };
173
- }
174
- function getPanelBounds(ctx, id) {
175
- const bounds = getHandleBounds(ctx, id);
176
- const panels = getHandlePanels(ctx, id);
177
- if (!bounds || !panels)
178
- return;
179
- const { before, after } = panels;
180
- const beforeMin = Math.abs(before.start - bounds.min);
181
- const afterMin = after.size + (before.size - beforeMin);
182
- const beforeMax = Math.abs(before.start - bounds.max);
183
- const afterMax = after.size - (beforeMax - before.size);
184
- return {
185
- before: {
186
- index: before.index,
187
- min: beforeMin,
188
- max: beforeMax,
189
- isAtMin: beforeMin === before.size,
190
- isAtMax: beforeMax === before.size,
191
- up(step) {
192
- return Math.min(before.size + step, beforeMax);
193
- },
194
- down(step) {
195
- return Math.max(before.size - step, beforeMin);
196
- }
197
- },
198
- after: {
199
- index: after.index,
200
- min: afterMin,
201
- max: afterMax,
202
- isAtMin: afterMin === after.size,
203
- isAtMax: afterMax === after.size,
204
- up(step) {
205
- return Math.min(after.size + step, afterMin);
206
- },
207
- down(step) {
208
- return Math.max(after.size - step, afterMax);
209
- }
210
- }
211
- };
212
- }
213
- function clamp(value, min, max) {
214
- return Math.min(Math.max(value, min), max);
215
- }
216
-
217
- // src/splitter.connect.ts
218
- function connect(state, send, normalize) {
219
- const isHorizontal = state.context.isHorizontal;
220
- const isFocused = state.hasTag("focus");
221
- const isDragging = state.matches("dragging");
222
- const panels = state.context.panels;
223
- const api = {
224
- /**
225
- * Whether the splitter is focused.
226
- */
227
- isFocused,
228
- /**
229
- * Whether the splitter is being dragged.
230
- */
231
- isDragging,
232
- /**
233
- * The bounds of the currently dragged splitter handle.
234
- */
235
- bounds: getHandleBounds(state.context),
236
- /**
237
- * Function to set a panel to its minimum size.
238
- */
239
- setToMinSize(id) {
240
- const panel = panels.find((panel2) => panel2.id === id);
241
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" });
242
- },
243
- /**
244
- * Function to set a panel to its maximum size.
245
- */
246
- setToMaxSize(id) {
247
- const panel = panels.find((panel2) => panel2.id === id);
248
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" });
249
- },
250
- /**
251
- * Function to set the size of a panel.
252
- */
253
- setSize(id, size) {
254
- send({ type: "SET_SIZE", id, size });
255
- },
256
- /**
257
- * Returns the state details for a resize trigger.
258
- */
259
- getResizeTriggerState(props) {
260
- const { id, disabled } = props;
261
- const ids = id.split(":");
262
- const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
263
- const panels2 = getHandleBounds(state.context, id);
264
- return {
265
- isDisabled: !!disabled,
266
- isFocused: state.context.activeResizeId === id && isFocused,
267
- panelIds,
268
- min: panels2?.min,
269
- max: panels2?.max,
270
- value: 0
271
- };
272
- },
273
- rootProps: normalize.element({
274
- ...parts.root.attrs,
275
- "data-orientation": state.context.orientation,
276
- id: dom.getRootId(state.context),
277
- dir: state.context.dir,
278
- style: {
279
- display: "flex",
280
- flexDirection: isHorizontal ? "row" : "column",
281
- height: "100%",
282
- width: "100%",
283
- overflow: "hidden"
284
- }
285
- }),
286
- getPanelProps(props) {
287
- const { id } = props;
288
- return normalize.element({
289
- ...parts.panel.attrs,
290
- dir: state.context.dir,
291
- id: dom.getPanelId(state.context, id),
292
- "data-ownedby": dom.getRootId(state.context),
293
- style: dom.getPanelStyle(state.context, id)
294
- });
295
- },
296
- getResizeTriggerProps(props) {
297
- const { id, disabled, step = 1 } = props;
298
- const triggerState = api.getResizeTriggerState(props);
299
- return normalize.element({
300
- ...parts.resizeTrigger.attrs,
301
- dir: state.context.dir,
302
- id: dom.getResizeTriggerId(state.context, id),
303
- role: "separator",
304
- "data-ownedby": dom.getRootId(state.context),
305
- tabIndex: disabled ? void 0 : 0,
306
- "aria-valuenow": triggerState.value,
307
- "aria-valuemin": triggerState.min,
308
- "aria-valuemax": triggerState.max,
309
- "data-orientation": state.context.orientation,
310
- "aria-orientation": state.context.orientation,
311
- "aria-controls": triggerState.panelIds.join(" "),
312
- "data-focus": (0, import_dom_query2.dataAttr)(triggerState.isFocused),
313
- "data-disabled": (0, import_dom_query2.dataAttr)(disabled),
314
- style: {
315
- touchAction: "none",
316
- userSelect: "none",
317
- flex: "0 0 auto",
318
- pointerEvents: isDragging && !triggerState.isFocused ? "none" : void 0,
319
- cursor: isHorizontal ? "col-resize" : "row-resize",
320
- [isHorizontal ? "minHeight" : "minWidth"]: "0"
321
- },
322
- onPointerDown(event) {
323
- if (disabled) {
324
- event.preventDefault();
325
- return;
326
- }
327
- send({ type: "POINTER_DOWN", id });
328
- event.preventDefault();
329
- event.stopPropagation();
330
- },
331
- onPointerOver() {
332
- if (disabled)
333
- return;
334
- send({ type: "POINTER_OVER", id });
335
- },
336
- onPointerLeave() {
337
- if (disabled)
338
- return;
339
- send({ type: "POINTER_LEAVE", id });
340
- },
341
- onBlur() {
342
- send("BLUR");
343
- },
344
- onFocus() {
345
- send({ type: "FOCUS", id });
346
- },
347
- onDoubleClick() {
348
- if (disabled)
349
- return;
350
- send({ type: "DOUBLE_CLICK", id });
351
- },
352
- onKeyDown(event) {
353
- if (disabled)
354
- return;
355
- const moveStep = (0, import_dom_event.getEventStep)(event) * step;
356
- const keyMap = {
357
- Enter() {
358
- send("ENTER");
359
- },
360
- ArrowUp() {
361
- send({ type: "ARROW_UP", step: moveStep });
362
- },
363
- ArrowDown() {
364
- send({ type: "ARROW_DOWN", step: moveStep });
365
- },
366
- ArrowLeft() {
367
- send({ type: "ARROW_LEFT", step: moveStep });
368
- },
369
- ArrowRight() {
370
- send({ type: "ARROW_RIGHT", step: moveStep });
371
- },
372
- Home() {
373
- send("HOME");
374
- },
375
- End() {
376
- send("END");
377
- }
378
- };
379
- const key = (0, import_dom_event.getEventKey)(event, state.context);
380
- const exec = keyMap[key];
381
- if (exec) {
382
- exec(event);
383
- event.preventDefault();
384
- }
385
- }
386
- });
387
- }
388
- };
389
- return api;
390
- }
391
-
392
- // src/splitter.machine.ts
393
- var import_core = require("@zag-js/core");
394
- var import_dom_event2 = require("@zag-js/dom-event");
395
- var import_dom_query3 = require("@zag-js/dom-query");
396
- var import_utils = require("@zag-js/utils");
397
- function machine(userContext) {
398
- const ctx = (0, import_utils.compact)(userContext);
399
- return (0, import_core.createMachine)(
400
- {
401
- id: "splitter",
402
- initial: "idle",
403
- context: {
404
- orientation: "horizontal",
405
- activeResizeId: null,
406
- previousPanels: [],
407
- size: [],
408
- initialSize: [],
409
- activeResizeState: {
410
- isAtMin: false,
411
- isAtMax: false
412
- },
413
- ...ctx
414
- },
415
- created: ["setPreviousPanels", "setInitialSize"],
416
- watch: {
417
- size: ["setActiveResizeState"]
418
- },
419
- computed: {
420
- isHorizontal: (ctx2) => ctx2.orientation === "horizontal",
421
- panels: (ctx2) => getNormalizedPanels(ctx2)
422
- },
423
- on: {
424
- COLLAPSE: {
425
- actions: "setStartPanelToMin"
426
- },
427
- EXPAND: {
428
- actions: "setStartPanelToMax"
429
- },
430
- TOGGLE: [
431
- {
432
- guard: "isStartPanelAtMin",
433
- actions: "setStartPanelToMax"
434
- },
435
- {
436
- actions: "setStartPanelToMin"
437
- }
438
- ],
439
- SET_SIZE: {
440
- actions: "setPanelSize"
441
- }
442
- },
443
- states: {
444
- idle: {
445
- entry: ["clearActiveHandleId"],
446
- on: {
447
- POINTER_OVER: {
448
- target: "hover:temp",
449
- actions: ["setActiveHandleId"]
450
- },
451
- FOCUS: {
452
- target: "focused",
453
- actions: ["setActiveHandleId"]
454
- },
455
- DOUBLE_CLICK: {
456
- actions: ["resetStartPanel", "setPreviousPanels"]
457
- }
458
- }
459
- },
460
- "hover:temp": {
461
- after: {
462
- HOVER_DELAY: "hover"
463
- },
464
- on: {
465
- POINTER_DOWN: {
466
- target: "dragging",
467
- actions: ["setActiveHandleId", "invokeOnResizeStart"]
468
- },
469
- POINTER_LEAVE: "idle"
470
- }
471
- },
472
- hover: {
473
- tags: ["focus"],
474
- on: {
475
- POINTER_DOWN: {
476
- target: "dragging",
477
- actions: ["invokeOnResizeStart"]
478
- },
479
- POINTER_LEAVE: "idle"
480
- }
481
- },
482
- focused: {
483
- tags: ["focus"],
484
- on: {
485
- BLUR: "idle",
486
- POINTER_DOWN: {
487
- target: "dragging",
488
- actions: ["setActiveHandleId", "invokeOnResizeStart"]
489
- },
490
- ARROW_LEFT: {
491
- guard: "isHorizontal",
492
- actions: ["shrinkStartPanel", "setPreviousPanels"]
493
- },
494
- ARROW_RIGHT: {
495
- guard: "isHorizontal",
496
- actions: ["expandStartPanel", "setPreviousPanels"]
497
- },
498
- ARROW_UP: {
499
- guard: "isVertical",
500
- actions: ["shrinkStartPanel", "setPreviousPanels"]
501
- },
502
- ARROW_DOWN: {
503
- guard: "isVertical",
504
- actions: ["expandStartPanel", "setPreviousPanels"]
505
- },
506
- ENTER: [
507
- {
508
- guard: "isStartPanelAtMax",
509
- actions: ["setStartPanelToMin", "setPreviousPanels"]
510
- },
511
- { actions: ["setStartPanelToMax", "setPreviousPanels"] }
512
- ],
513
- HOME: {
514
- actions: ["setStartPanelToMin", "setPreviousPanels"]
515
- },
516
- END: {
517
- actions: ["setStartPanelToMax", "setPreviousPanels"]
518
- }
519
- }
520
- },
521
- dragging: {
522
- tags: ["focus"],
523
- entry: "focusResizeHandle",
524
- activities: ["trackPointerMove"],
525
- on: {
526
- POINTER_MOVE: {
527
- actions: ["setPointerValue", "setGlobalCursor"]
528
- },
529
- POINTER_UP: {
530
- target: "focused",
531
- actions: ["invokeOnResizeEnd", "setPreviousPanels", "clearGlobalCursor", "blurResizeHandle"]
532
- }
533
- }
534
- }
535
- }
536
- },
537
- {
538
- activities: {
539
- trackPointerMove: (ctx2, _evt, { send }) => {
540
- const doc = dom.getDoc(ctx2);
541
- return (0, import_dom_event2.trackPointerMove)(doc, {
542
- onPointerMove(info) {
543
- send({ type: "POINTER_MOVE", point: info.point });
544
- },
545
- onPointerUp() {
546
- send("POINTER_UP");
547
- }
548
- });
549
- }
550
- },
551
- guards: {
552
- isStartPanelAtMin: (ctx2) => ctx2.activeResizeState.isAtMin,
553
- isStartPanelAtMax: (ctx2) => ctx2.activeResizeState.isAtMax,
554
- isHorizontal: (ctx2) => ctx2.isHorizontal,
555
- isVertical: (ctx2) => !ctx2.isHorizontal
556
- },
557
- delays: {
558
- HOVER_DELAY: 250
559
- },
560
- actions: {
561
- setGlobalCursor(ctx2) {
562
- dom.setupGlobalCursor(ctx2);
563
- },
564
- clearGlobalCursor(ctx2) {
565
- dom.removeGlobalCursor(ctx2);
566
- },
567
- invokeOnResize(ctx2) {
568
- ctx2.onResize?.({ size: ctx2.size, activeHandleId: ctx2.activeResizeId });
569
- },
570
- invokeOnResizeStart(ctx2) {
571
- ctx2.onResizeStart?.({ size: ctx2.size, activeHandleId: ctx2.activeResizeId });
572
- },
573
- invokeOnResizeEnd(ctx2) {
574
- ctx2.onResizeEnd?.({ size: ctx2.size, activeHandleId: ctx2.activeResizeId });
575
- },
576
- setActiveHandleId(ctx2, evt) {
577
- ctx2.activeResizeId = evt.id;
578
- },
579
- clearActiveHandleId(ctx2) {
580
- ctx2.activeResizeId = null;
581
- },
582
- setInitialSize(ctx2) {
583
- ctx2.initialSize = ctx2.panels.slice().map((panel) => ({
584
- id: panel.id,
585
- size: panel.size
586
- }));
587
- },
588
- setPanelSize(ctx2, evt) {
589
- const { id, size } = evt;
590
- ctx2.size = ctx2.size.map((panel) => {
591
- const panelSize = clamp(size, panel.minSize ?? 0, panel.maxSize ?? 100);
592
- return panel.id === id ? { ...panel, size: panelSize } : panel;
593
- });
594
- },
595
- setStartPanelToMin(ctx2) {
596
- const bounds = getPanelBounds(ctx2);
597
- if (!bounds)
598
- return;
599
- const { before, after } = bounds;
600
- ctx2.size[before.index].size = before.min;
601
- ctx2.size[after.index].size = after.min;
602
- },
603
- setStartPanelToMax(ctx2) {
604
- const bounds = getPanelBounds(ctx2);
605
- if (!bounds)
606
- return;
607
- const { before, after } = bounds;
608
- ctx2.size[before.index].size = before.max;
609
- ctx2.size[after.index].size = after.max;
610
- },
611
- expandStartPanel(ctx2, evt) {
612
- const bounds = getPanelBounds(ctx2);
613
- if (!bounds)
614
- return;
615
- const { before, after } = bounds;
616
- ctx2.size[before.index].size = before.up(evt.step);
617
- ctx2.size[after.index].size = after.down(evt.step);
618
- },
619
- shrinkStartPanel(ctx2, evt) {
620
- const bounds = getPanelBounds(ctx2);
621
- if (!bounds)
622
- return;
623
- const { before, after } = bounds;
624
- ctx2.size[before.index].size = before.down(evt.step);
625
- ctx2.size[after.index].size = after.up(evt.step);
626
- },
627
- resetStartPanel(ctx2, evt) {
628
- const bounds = getPanelBounds(ctx2, evt.id);
629
- if (!bounds)
630
- return;
631
- const { before, after } = bounds;
632
- ctx2.size[before.index].size = ctx2.initialSize[before.index].size;
633
- ctx2.size[after.index].size = ctx2.initialSize[after.index].size;
634
- },
635
- focusResizeHandle(ctx2) {
636
- (0, import_dom_query3.raf)(() => {
637
- dom.getActiveHandleEl(ctx2)?.focus({ preventScroll: true });
638
- });
639
- },
640
- blurResizeHandle(ctx2) {
641
- (0, import_dom_query3.raf)(() => {
642
- dom.getActiveHandleEl(ctx2)?.blur();
643
- });
644
- },
645
- setPreviousPanels(ctx2) {
646
- ctx2.previousPanels = ctx2.panels.slice();
647
- },
648
- setActiveResizeState(ctx2) {
649
- const panels = getPanelBounds(ctx2);
650
- if (!panels)
651
- return;
652
- const { before } = panels;
653
- ctx2.activeResizeState = {
654
- isAtMin: before.isAtMin,
655
- isAtMax: before.isAtMax
656
- };
657
- },
658
- setPointerValue(ctx2, evt) {
659
- const panels = getHandlePanels(ctx2);
660
- const bounds = getHandleBounds(ctx2);
661
- if (!panels || !bounds)
662
- return;
663
- const rootEl = dom.getRootEl(ctx2);
664
- const relativePoint = (0, import_dom_event2.getRelativePoint)(evt.point, rootEl);
665
- const percentValue = relativePoint.getPercentValue({
666
- dir: ctx2.dir,
667
- orientation: ctx2.orientation
668
- });
669
- let pointValue = percentValue * 100;
670
- ctx2.activeResizeState = {
671
- isAtMin: pointValue < bounds.min,
672
- isAtMax: pointValue > bounds.max
673
- };
674
- pointValue = clamp(pointValue, bounds.min, bounds.max);
675
- const { before, after } = panels;
676
- const offset = pointValue - before.end;
677
- ctx2.size[before.index].size = before.size + offset;
678
- ctx2.size[after.index].size = after.size - offset;
679
- }
680
- }
681
- }
682
- );
683
- }
684
- // Annotate the CommonJS export names for ESM import in node:
685
- 0 && (module.exports = {
686
- anatomy,
687
- connect,
688
- machine
689
- });
11
+ exports.anatomy = splitter_anatomy.anatomy;
12
+ exports.connect = splitter_connect.connect;
13
+ exports.machine = splitter_machine.machine;