@zag-js/splitter 0.2.11 → 0.2.13

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
@@ -31,333 +31,13 @@ var import_anatomy = require("@zag-js/anatomy");
31
31
  var anatomy = (0, import_anatomy.createAnatomy)("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
32
32
  var parts = anatomy.build();
33
33
 
34
- // ../../utilities/dom/src/attrs.ts
35
- var dataAttr = (guard) => {
36
- return guard ? "" : void 0;
37
- };
38
-
39
- // ../../utilities/core/src/functions.ts
40
- var runIfFn = (v, ...a) => {
41
- const res = typeof v === "function" ? v(...a) : v;
42
- return res ?? void 0;
43
- };
44
- var callAll = (...fns) => (...a) => {
45
- fns.forEach(function(fn) {
46
- fn?.(...a);
47
- });
48
- };
49
-
50
- // ../../utilities/core/src/guard.ts
51
- var isArray = (v) => Array.isArray(v);
52
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
53
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
54
-
55
- // ../../utilities/core/src/object.ts
56
- function compact(obj) {
57
- if (obj === void 0)
58
- return obj;
59
- return Object.fromEntries(
60
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
61
- );
62
- }
63
-
64
- // ../../utilities/dom/src/platform.ts
65
- var isDom = () => typeof window !== "undefined";
66
- function getPlatform() {
67
- const agent = navigator.userAgentData;
68
- return agent?.platform ?? navigator.platform;
69
- }
70
- var pt = (v) => isDom() && v.test(getPlatform());
71
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
72
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
73
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
74
- var isIos = () => isApple() && !isMac();
75
-
76
- // ../../utilities/dom/src/query.ts
77
- function isDocument(el) {
78
- return el.nodeType === Node.DOCUMENT_NODE;
79
- }
80
- function isWindow(value) {
81
- return value?.toString() === "[object Window]";
82
- }
83
- function getDocument(el) {
84
- if (isWindow(el))
85
- return el.document;
86
- if (isDocument(el))
87
- return el;
88
- return el?.ownerDocument ?? document;
89
- }
90
- function defineDomHelpers(helpers) {
91
- const dom2 = {
92
- getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
93
- getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
94
- getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
95
- getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
96
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
97
- };
98
- return {
99
- ...dom2,
100
- ...helpers
101
- };
102
- }
103
-
104
- // ../../utilities/dom/src/event.ts
105
- var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
106
- var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
107
- var supportsMouseEvent = () => isDom() && window.onmousedown === null;
108
- var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
109
- var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
110
- var isLeftClick = (v) => v.button === 0;
111
-
112
- // ../../utilities/dom/src/get-element-offset.ts
113
- function getElementOffset(element) {
114
- let left = 0;
115
- let top = 0;
116
- let el = element;
117
- if (el.parentNode) {
118
- do {
119
- left += el.offsetLeft;
120
- top += el.offsetTop;
121
- } while ((el = el.offsetParent) && el.nodeType < 9);
122
- el = element;
123
- do {
124
- left -= el.scrollLeft;
125
- top -= el.scrollTop;
126
- } while ((el = el.parentNode) && !/body/i.test(el.nodeName));
127
- }
128
- return {
129
- top,
130
- right: innerWidth - left - element.offsetWidth,
131
- bottom: innerHeight - top - element.offsetHeight,
132
- left
133
- };
134
- }
135
-
136
- // ../../utilities/dom/src/get-point-relative-to-element.ts
137
- function getPointRelativeToNode(point, element) {
138
- const offset = getElementOffset(element);
139
- const x = point.x - offset.left;
140
- const y = point.y - offset.top;
141
- return { x, y };
142
- }
143
- var clampPercent = (value) => Math.max(0, Math.min(100, value));
144
- function getPointPercentRelativeToNode(point, element) {
145
- const relativePoint = getPointRelativeToNode(point, element);
146
- const x = relativePoint.x / element.offsetWidth * 100;
147
- const y = relativePoint.y / element.offsetHeight * 100;
148
- return { x: clampPercent(x), y: clampPercent(y) };
149
- }
150
- function normalizePointValue(point, options) {
151
- const { dir = "ltr", orientation = "horizontal" } = options;
152
- const { x, y } = point;
153
- let result = { x, y };
154
- if (orientation === "horizontal" && dir === "rtl") {
155
- result = { x: 100 - x, y };
156
- }
157
- return orientation === "horizontal" ? result.x : result.y;
158
- }
159
-
160
- // ../../utilities/dom/src/keyboard-event.ts
161
- var rtlKeyMap = {
162
- ArrowLeft: "ArrowRight",
163
- ArrowRight: "ArrowLeft"
164
- };
165
- var sameKeyMap = {
166
- Up: "ArrowUp",
167
- Down: "ArrowDown",
168
- Esc: "Escape",
169
- " ": "Space",
170
- ",": "Comma",
171
- Left: "ArrowLeft",
172
- Right: "ArrowRight"
173
- };
174
- function getEventKey(event, options = {}) {
175
- const { dir = "ltr", orientation = "horizontal" } = options;
176
- let { key } = event;
177
- key = sameKeyMap[key] ?? key;
178
- const isRtl = dir === "rtl" && orientation === "horizontal";
179
- if (isRtl && key in rtlKeyMap) {
180
- key = rtlKeyMap[key];
181
- }
182
- return key;
183
- }
184
- var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
185
- var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
186
- function getEventStep(event) {
187
- if (event.ctrlKey || event.metaKey) {
188
- return 0.1;
189
- } else {
190
- const isPageKey = PAGE_KEYS.has(event.key);
191
- const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
192
- return isSkipKey ? 10 : 1;
193
- }
194
- }
195
-
196
- // ../../utilities/dom/src/listener.ts
197
- var isRef = (v) => hasProp(v, "current");
198
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
199
- function extractInfo(event, type = "page") {
200
- const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
201
- return {
202
- point: {
203
- x: point[`${type}X`],
204
- y: point[`${type}Y`]
205
- }
206
- };
207
- }
208
- function addDomEvent(target, eventName, handler, options) {
209
- const node = isRef(target) ? target.current : runIfFn(target);
210
- node?.addEventListener(eventName, handler, options);
211
- return () => {
212
- node?.removeEventListener(eventName, handler, options);
213
- };
214
- }
215
- function addPointerEvent(target, event, listener, options) {
216
- const type = getEventName(event) ?? event;
217
- return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
218
- }
219
- function wrapHandler(fn, filter = false) {
220
- const listener = (event) => {
221
- fn(event, extractInfo(event));
222
- };
223
- return filter ? filterPrimaryPointer(listener) : listener;
224
- }
225
- function filterPrimaryPointer(fn) {
226
- return (event) => {
227
- const win = event.view ?? window;
228
- const isMouseEvent2 = event instanceof win.MouseEvent;
229
- const isPrimary = !isMouseEvent2 || isMouseEvent2 && event.button === 0;
230
- if (isPrimary)
231
- fn(event);
232
- };
233
- }
234
- var mouseEventNames = {
235
- pointerdown: "mousedown",
236
- pointermove: "mousemove",
237
- pointerup: "mouseup",
238
- pointercancel: "mousecancel",
239
- pointerover: "mouseover",
240
- pointerout: "mouseout",
241
- pointerenter: "mouseenter",
242
- pointerleave: "mouseleave"
243
- };
244
- var touchEventNames = {
245
- pointerdown: "touchstart",
246
- pointermove: "touchmove",
247
- pointerup: "touchend",
248
- pointercancel: "touchcancel"
249
- };
250
- function getEventName(evt) {
251
- if (supportsPointerEvent())
252
- return evt;
253
- if (supportsTouchEvent())
254
- return touchEventNames[evt];
255
- if (supportsMouseEvent())
256
- return mouseEventNames[evt];
257
- return evt;
258
- }
259
-
260
- // ../../utilities/dom/src/next-tick.ts
261
- function nextTick(fn) {
262
- const set = /* @__PURE__ */ new Set();
263
- function raf2(fn2) {
264
- const id = globalThis.requestAnimationFrame(fn2);
265
- set.add(() => globalThis.cancelAnimationFrame(id));
266
- }
267
- raf2(() => raf2(fn));
268
- return function cleanup() {
269
- set.forEach(function(fn2) {
270
- fn2();
271
- });
272
- };
273
- }
274
- function raf(fn) {
275
- const id = globalThis.requestAnimationFrame(fn);
276
- return function cleanup() {
277
- globalThis.cancelAnimationFrame(id);
278
- };
279
- }
280
-
281
- // ../../utilities/dom/src/nodelist.ts
282
- function queryAll(root, selector) {
283
- return Array.from(root?.querySelectorAll(selector) ?? []);
284
- }
285
-
286
- // ../../utilities/dom/src/text-selection.ts
287
- var state = "default";
288
- var savedUserSelect = "";
289
- var modifiedElementMap = /* @__PURE__ */ new WeakMap();
290
- function disableTextSelection({ target, doc } = {}) {
291
- const _document = doc ?? document;
292
- if (isIos()) {
293
- if (state === "default") {
294
- savedUserSelect = _document.documentElement.style.webkitUserSelect;
295
- _document.documentElement.style.webkitUserSelect = "none";
296
- }
297
- state = "disabled";
298
- } else if (target) {
299
- modifiedElementMap.set(target, target.style.userSelect);
300
- target.style.userSelect = "none";
301
- }
302
- return () => restoreTextSelection({ target, doc: _document });
303
- }
304
- function restoreTextSelection({ target, doc } = {}) {
305
- const _document = doc ?? document;
306
- if (isIos()) {
307
- if (state !== "disabled")
308
- return;
309
- state = "restoring";
310
- setTimeout(() => {
311
- nextTick(() => {
312
- if (state === "restoring") {
313
- if (_document.documentElement.style.webkitUserSelect === "none") {
314
- _document.documentElement.style.webkitUserSelect = savedUserSelect || "";
315
- }
316
- savedUserSelect = "";
317
- state = "default";
318
- }
319
- });
320
- }, 300);
321
- } else {
322
- if (target && modifiedElementMap.has(target)) {
323
- let targetOldUserSelect = modifiedElementMap.get(target);
324
- if (target.style.userSelect === "none") {
325
- target.style.userSelect = targetOldUserSelect ?? "";
326
- }
327
- if (target.getAttribute("style") === "") {
328
- target.removeAttribute("style");
329
- }
330
- modifiedElementMap.delete(target);
331
- }
332
- }
333
- }
334
-
335
- // ../../utilities/dom/src/pointer-event.ts
336
- var THRESHOLD = 5;
337
- function trackPointerMove(doc, opts) {
338
- const { onPointerMove, onPointerUp } = opts;
339
- const handlePointerMove = (event, info) => {
340
- const { point: p } = info;
341
- const distance = Math.sqrt(p.x ** 2 + p.y ** 2);
342
- if (distance < THRESHOLD)
343
- return;
344
- if (isMouseEvent(event) && isLeftClick(event)) {
345
- onPointerUp();
346
- return;
347
- }
348
- onPointerMove(info, event);
349
- };
350
- return callAll(
351
- addPointerEvent(doc, "pointermove", handlePointerMove, false),
352
- addPointerEvent(doc, "pointerup", onPointerUp, false),
353
- addPointerEvent(doc, "pointercancel", onPointerUp, false),
354
- addPointerEvent(doc, "contextmenu", onPointerUp, false),
355
- disableTextSelection({ doc })
356
- );
357
- }
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");
358
37
 
359
38
  // src/splitter.dom.ts
360
- var dom = defineDomHelpers({
39
+ var import_dom_query = require("@zag-js/dom-query");
40
+ var dom = (0, import_dom_query.createScope)({
361
41
  getRootId: (ctx) => `splitter:${ctx.id}`,
362
42
  getResizeTriggerId: (ctx, id) => `splitter:${ctx.id}:splitter:${id}`,
363
43
  getToggleTriggerId: (ctx) => `splitter:${ctx.id}:toggle-btn`,
@@ -393,7 +73,7 @@ var dom = defineDomHelpers({
393
73
  },
394
74
  getResizeTriggerEls(ctx) {
395
75
  const ownerId = CSS.escape(dom.getRootId(ctx));
396
- return queryAll(dom.getRootEl(ctx), `[role=separator][data-ownedby='${ownerId}']`);
76
+ return (0, import_dom_query.queryAll)(dom.getRootEl(ctx), `[role=separator][data-ownedby='${ownerId}']`);
397
77
  },
398
78
  setupGlobalCursor(ctx) {
399
79
  const styleEl = dom.getById(ctx, dom.globalCursorId(ctx));
@@ -535,31 +215,69 @@ function clamp(value, min, max) {
535
215
  }
536
216
 
537
217
  // src/splitter.connect.ts
538
- function connect(state2, send, normalize) {
539
- const isHorizontal = state2.context.isHorizontal;
540
- const isFocused = state2.hasTag("focus");
541
- const isDragging = state2.matches("dragging");
218
+ function connect(state, send, normalize) {
219
+ const isHorizontal = state.context.isHorizontal;
220
+ const isFocused = state.hasTag("focus");
221
+ const isDragging = state.matches("dragging");
542
222
  const api = {
223
+ /**
224
+ * Whether the splitter is focused.
225
+ */
543
226
  isFocused,
227
+ /**
228
+ * Whether the splitter is being dragged.
229
+ */
544
230
  isDragging,
545
- bounds: getHandleBounds(state2.context),
231
+ /**
232
+ * The bounds of the currently dragged splitter handle.
233
+ */
234
+ bounds: getHandleBounds(state.context),
235
+ /**
236
+ * Function to collapse a panel.
237
+ */
546
238
  collapse(id) {
547
239
  send({ type: "COLLAPSE", id });
548
240
  },
241
+ /**
242
+ * Function to expand a panel.
243
+ */
549
244
  expand(id) {
550
245
  send({ type: "EXPAND", id });
551
246
  },
247
+ /**
248
+ * Function to toggle a panel between collapsed and expanded.
249
+ */
552
250
  toggle(id) {
553
251
  send({ type: "TOGGLE", id });
554
252
  },
253
+ /**
254
+ * Function to set the size of a panel.
255
+ */
555
256
  setSize(id, size) {
556
257
  send({ type: "SET_SIZE", id, size });
557
258
  },
259
+ /**
260
+ * Returns the state details for a resize trigger.
261
+ */
262
+ getResizeTriggerState(props) {
263
+ const { id, disabled } = props;
264
+ const ids = id.split(":");
265
+ const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
266
+ const panels = getHandleBounds(state.context, id);
267
+ return {
268
+ isDisabled: !!disabled,
269
+ isFocused: state.context.activeResizeId === id && isFocused,
270
+ panelIds,
271
+ min: panels?.min,
272
+ max: panels?.max,
273
+ value: 0
274
+ };
275
+ },
558
276
  rootProps: normalize.element({
559
277
  ...parts.root.attrs,
560
- "data-orientation": state2.context.orientation,
561
- id: dom.getRootId(state2.context),
562
- dir: state2.context.dir,
278
+ "data-orientation": state.context.orientation,
279
+ id: dom.getRootId(state.context),
280
+ dir: state.context.dir,
563
281
  style: {
564
282
  display: "flex",
565
283
  flexDirection: isHorizontal ? "row" : "column",
@@ -572,44 +290,38 @@ function connect(state2, send, normalize) {
572
290
  const { id } = props;
573
291
  return normalize.element({
574
292
  ...parts.panel.attrs,
575
- dir: state2.context.dir,
576
- id: dom.getPanelId(state2.context, id),
577
- "data-ownedby": dom.getRootId(state2.context),
578
- style: dom.getPanelStyle(state2.context, id)
293
+ dir: state.context.dir,
294
+ id: dom.getPanelId(state.context, id),
295
+ "data-ownedby": dom.getRootId(state.context),
296
+ style: dom.getPanelStyle(state.context, id)
579
297
  });
580
298
  },
581
- getResizeTriggerState(props) {
582
- const { id, disabled } = props;
583
- const ids = id.split(":");
584
- const panelIds = ids.map((id2) => dom.getPanelId(state2.context, id2));
585
- const panels = getHandleBounds(state2.context, id);
586
- return {
587
- isDisabled: !!disabled,
588
- isFocused: state2.context.activeResizeId === id && isFocused,
589
- panelIds,
590
- min: panels?.min,
591
- max: panels?.max,
592
- value: 0
593
- };
594
- },
299
+ // toggleTriggerProps: normalize.element({
300
+ // ...parts.toggleButton.attrs,
301
+ // id: dom.getToggleButtonId(state.context),
302
+ // "aria-label": state.context.isAtMin ? "Expand Primary Pane" : "Collapse Primary Pane",
303
+ // onClick() {
304
+ // send("TOGGLE")
305
+ // },
306
+ // }),
595
307
  getResizeTriggerProps(props) {
596
308
  const { id, disabled, step = 1 } = props;
597
309
  const triggerState = api.getResizeTriggerState(props);
598
310
  return normalize.element({
599
311
  ...parts.resizeTrigger.attrs,
600
- dir: state2.context.dir,
601
- id: dom.getResizeTriggerId(state2.context, id),
312
+ dir: state.context.dir,
313
+ id: dom.getResizeTriggerId(state.context, id),
602
314
  role: "separator",
603
- "data-ownedby": dom.getRootId(state2.context),
315
+ "data-ownedby": dom.getRootId(state.context),
604
316
  tabIndex: disabled ? void 0 : 0,
605
317
  "aria-valuenow": triggerState.value,
606
318
  "aria-valuemin": triggerState.min,
607
319
  "aria-valuemax": triggerState.max,
608
- "data-orientation": state2.context.orientation,
609
- "aria-orientation": state2.context.orientation,
320
+ "data-orientation": state.context.orientation,
321
+ "aria-orientation": state.context.orientation,
610
322
  "aria-controls": triggerState.panelIds.join(" "),
611
- "data-focus": dataAttr(triggerState.isFocused),
612
- "data-disabled": dataAttr(disabled),
323
+ "data-focus": (0, import_dom_query2.dataAttr)(triggerState.isFocused),
324
+ "data-disabled": (0, import_dom_query2.dataAttr)(disabled),
613
325
  style: {
614
326
  touchAction: "none",
615
327
  userSelect: "none",
@@ -651,7 +363,7 @@ function connect(state2, send, normalize) {
651
363
  onKeyDown(event) {
652
364
  if (disabled)
653
365
  return;
654
- const moveStep = getEventStep(event) * step;
366
+ const moveStep = (0, import_dom_event.getEventStep)(event) * step;
655
367
  const keyMap = {
656
368
  Enter() {
657
369
  send("ENTER");
@@ -675,7 +387,7 @@ function connect(state2, send, normalize) {
675
387
  send("END");
676
388
  }
677
389
  };
678
- const key = getEventKey(event, state2.context);
390
+ const key = (0, import_dom_event.getEventKey)(event, state.context);
679
391
  const exec = keyMap[key];
680
392
  if (exec) {
681
393
  exec(event);
@@ -690,8 +402,11 @@ function connect(state2, send, normalize) {
690
402
 
691
403
  // src/splitter.machine.ts
692
404
  var import_core = require("@zag-js/core");
405
+ var import_dom_event2 = require("@zag-js/dom-event");
406
+ var import_dom_query3 = require("@zag-js/dom-query");
407
+ var import_utils = require("@zag-js/utils");
693
408
  function machine(userContext) {
694
- const ctx = compact(userContext);
409
+ const ctx = (0, import_utils.compact)(userContext);
695
410
  return (0, import_core.createMachine)(
696
411
  {
697
412
  id: "splitter",
@@ -831,7 +546,7 @@ function machine(userContext) {
831
546
  activities: {
832
547
  trackPointerMove: (ctx2, _evt, { send }) => {
833
548
  const doc = dom.getDoc(ctx2);
834
- return trackPointerMove(doc, {
549
+ return (0, import_dom_event2.trackPointerMove)(doc, {
835
550
  onPointerMove(info) {
836
551
  send({ type: "POINTER_MOVE", point: info.point });
837
552
  },
@@ -919,12 +634,12 @@ function machine(userContext) {
919
634
  ctx2.size[after.index].size = ctx2.initialSize[after.index].size;
920
635
  },
921
636
  focusResizeHandle(ctx2) {
922
- raf(() => {
923
- dom.getActiveHandleEl(ctx2)?.focus();
637
+ (0, import_dom_query3.raf)(() => {
638
+ dom.getActiveHandleEl(ctx2)?.focus({ preventScroll: true });
924
639
  });
925
640
  },
926
641
  blurResizeHandle(ctx2) {
927
- raf(() => {
642
+ (0, import_dom_query3.raf)(() => {
928
643
  dom.getActiveHandleEl(ctx2)?.blur();
929
644
  });
930
645
  },
@@ -947,8 +662,7 @@ function machine(userContext) {
947
662
  const rootEl = dom.getRootEl(ctx2);
948
663
  if (!panels || !rootEl || !bounds)
949
664
  return;
950
- const percent = getPointPercentRelativeToNode(evt.point, rootEl);
951
- let pointValue = normalizePointValue(percent, ctx2);
665
+ let pointValue = (0, import_dom_event2.getRelativePointPercent)(evt.point, rootEl).normalize(ctx2);
952
666
  ctx2.activeResizeState = {
953
667
  isAtMin: pointValue < bounds.min,
954
668
  isAtMax: pointValue > bounds.max
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-JYQICU6Y.mjs";
3
+ } from "./chunk-CQT32RFW.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-HPRMFGOY.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-EABXMZ6N.mjs";
10
- import "./chunk-QY3R66FZ.mjs";
9
+ } from "./chunk-63NJ553U.mjs";
10
+ import "./chunk-BSW3DTW4.mjs";
11
11
  import "./chunk-MV44GBQY.mjs";
12
12
  export {
13
13
  anatomy,
@@ -1,20 +1,42 @@
1
1
  import { PropTypes, NormalizeProps } from '@zag-js/types';
2
- import { State, Send, PanelId, PanelProps, ResizeTriggerProps } from './splitter.types.js';
2
+ import { State, Send, PanelId, ResizeTriggerProps, PanelProps } from './splitter.types.js';
3
3
  import '@zag-js/core';
4
4
 
5
5
  declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
6
+ /**
7
+ * Whether the splitter is focused.
8
+ */
6
9
  isFocused: boolean;
10
+ /**
11
+ * Whether the splitter is being dragged.
12
+ */
7
13
  isDragging: boolean;
14
+ /**
15
+ * The bounds of the currently dragged splitter handle.
16
+ */
8
17
  bounds: {
9
18
  min: number;
10
19
  max: number;
11
20
  } | undefined;
21
+ /**
22
+ * Function to collapse a panel.
23
+ */
12
24
  collapse(id: PanelId): void;
25
+ /**
26
+ * Function to expand a panel.
27
+ */
13
28
  expand(id: PanelId): void;
29
+ /**
30
+ * Function to toggle a panel between collapsed and expanded.
31
+ */
14
32
  toggle(id: PanelId): void;
33
+ /**
34
+ * Function to set the size of a panel.
35
+ */
15
36
  setSize(id: PanelId, size: number): void;
16
- rootProps: T["element"];
17
- getPanelProps(props: PanelProps): T["element"];
37
+ /**
38
+ * Returns the state details for a resize trigger.
39
+ */
18
40
  getResizeTriggerState(props: ResizeTriggerProps): {
19
41
  isDisabled: boolean;
20
42
  isFocused: boolean;
@@ -23,6 +45,8 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
23
45
  max: number | undefined;
24
46
  value: number;
25
47
  };
48
+ rootProps: T["element"];
49
+ getPanelProps(props: PanelProps): T["element"];
26
50
  getResizeTriggerProps(props: ResizeTriggerProps): T["element"];
27
51
  };
28
52