@zag-js/splitter 1.34.1 → 1.35.0

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.
Files changed (53) hide show
  1. package/dist/index.d.mts +9 -254
  2. package/dist/index.d.ts +9 -254
  3. package/dist/index.js +37 -1158
  4. package/dist/index.mjs +11 -1151
  5. package/dist/splitter.anatomy.d.mts +6 -0
  6. package/dist/splitter.anatomy.d.ts +6 -0
  7. package/dist/splitter.anatomy.js +34 -0
  8. package/dist/splitter.anatomy.mjs +8 -0
  9. package/dist/splitter.connect.d.mts +7 -0
  10. package/dist/splitter.connect.d.ts +7 -0
  11. package/dist/splitter.connect.js +298 -0
  12. package/dist/splitter.connect.mjs +263 -0
  13. package/dist/splitter.dom.d.mts +19 -0
  14. package/dist/splitter.dom.d.ts +19 -0
  15. package/dist/splitter.dom.js +89 -0
  16. package/dist/splitter.dom.mjs +52 -0
  17. package/dist/splitter.machine.d.mts +7 -0
  18. package/dist/splitter.machine.d.ts +7 -0
  19. package/dist/splitter.machine.js +509 -0
  20. package/dist/splitter.machine.mjs +482 -0
  21. package/dist/splitter.props.d.mts +12 -0
  22. package/dist/splitter.props.d.ts +12 -0
  23. package/dist/splitter.props.js +63 -0
  24. package/dist/splitter.props.mjs +33 -0
  25. package/dist/splitter.types.d.mts +237 -0
  26. package/dist/splitter.types.d.ts +237 -0
  27. package/dist/splitter.types.js +18 -0
  28. package/dist/splitter.types.mjs +0 -0
  29. package/dist/utils/aria.d.mts +27 -0
  30. package/dist/utils/aria.d.ts +27 -0
  31. package/dist/utils/aria.js +79 -0
  32. package/dist/utils/aria.mjs +53 -0
  33. package/dist/utils/fuzzy.d.mts +10 -0
  34. package/dist/utils/fuzzy.d.ts +10 -0
  35. package/dist/utils/fuzzy.js +60 -0
  36. package/dist/utils/fuzzy.mjs +32 -0
  37. package/dist/utils/panel.d.mts +34 -0
  38. package/dist/utils/panel.d.ts +34 -0
  39. package/dist/utils/panel.js +147 -0
  40. package/dist/utils/panel.mjs +114 -0
  41. package/dist/utils/resize-by-delta.d.mts +20 -0
  42. package/dist/utils/resize-by-delta.d.ts +20 -0
  43. package/dist/utils/resize-by-delta.js +165 -0
  44. package/dist/utils/resize-by-delta.mjs +140 -0
  45. package/dist/utils/resize-panel.d.mts +16 -0
  46. package/dist/utils/resize-panel.d.ts +16 -0
  47. package/dist/utils/resize-panel.js +51 -0
  48. package/dist/utils/resize-panel.mjs +26 -0
  49. package/dist/utils/validate-sizes.d.mts +15 -0
  50. package/dist/utils/validate-sizes.d.ts +15 -0
  51. package/dist/utils/validate-sizes.js +72 -0
  52. package/dist/utils/validate-sizes.mjs +47 -0
  53. package/package.json +17 -7
@@ -0,0 +1,482 @@
1
+ // src/splitter.machine.ts
2
+ import { createMachine } from "@zag-js/core";
3
+ import { trackPointerMove } from "@zag-js/dom-query";
4
+ import { ensure, ensureProps, isEqual, next, prev, setRafTimeout } from "@zag-js/utils";
5
+ import * as dom from "./splitter.dom.mjs";
6
+ import { getAriaValue } from "./utils/aria.mjs";
7
+ import { fuzzyNumbersEqual, fuzzySizeEqual } from "./utils/fuzzy.mjs";
8
+ import {
9
+ findPanelDataIndex,
10
+ getPanelById,
11
+ getPanelLayout,
12
+ getUnsafeDefaultSize,
13
+ panelDataHelper,
14
+ serializePanels,
15
+ sortPanels
16
+ } from "./utils/panel.mjs";
17
+ import { resizeByDelta } from "./utils/resize-by-delta.mjs";
18
+ import { validateSizes } from "./utils/validate-sizes.mjs";
19
+ var machine = createMachine({
20
+ props({ props }) {
21
+ ensureProps(props, ["panels"]);
22
+ return {
23
+ orientation: "horizontal",
24
+ defaultSize: [],
25
+ dir: "ltr",
26
+ ...props,
27
+ panels: sortPanels(props.panels)
28
+ };
29
+ },
30
+ initialState() {
31
+ return "idle";
32
+ },
33
+ context({ prop, bindable, getContext, getRefs }) {
34
+ return {
35
+ size: bindable(() => ({
36
+ value: prop("size"),
37
+ defaultValue: prop("defaultSize"),
38
+ isEqual(a, b) {
39
+ return b != null && fuzzySizeEqual(a, b);
40
+ },
41
+ onChange(value) {
42
+ const ctx = getContext();
43
+ const refs = getRefs();
44
+ const sizesBeforeCollapse = refs.get("panelSizeBeforeCollapse");
45
+ const expandToSizes = Object.fromEntries(sizesBeforeCollapse.entries());
46
+ const resizeTriggerId = ctx.get("dragState")?.resizeTriggerId ?? null;
47
+ const layout = getPanelLayout(prop("panels"));
48
+ prop("onResize")?.({
49
+ size: value,
50
+ layout,
51
+ resizeTriggerId,
52
+ expandToSizes
53
+ });
54
+ }
55
+ })),
56
+ dragState: bindable(() => ({
57
+ defaultValue: null
58
+ })),
59
+ keyboardState: bindable(() => ({
60
+ defaultValue: null
61
+ }))
62
+ };
63
+ },
64
+ watch({ track, action, prop }) {
65
+ track([() => serializePanels(prop("panels"))], () => {
66
+ action(["syncSize"]);
67
+ });
68
+ },
69
+ refs() {
70
+ return {
71
+ panelSizeBeforeCollapse: /* @__PURE__ */ new Map(),
72
+ prevDelta: 0,
73
+ panelIdToLastNotifiedSizeMap: /* @__PURE__ */ new Map()
74
+ };
75
+ },
76
+ computed: {
77
+ horizontal({ prop }) {
78
+ return prop("orientation") === "horizontal";
79
+ }
80
+ },
81
+ on: {
82
+ "SIZE.SET": {
83
+ actions: ["setSize"]
84
+ },
85
+ "PANEL.COLLAPSE": {
86
+ actions: ["collapsePanel"]
87
+ },
88
+ "PANEL.EXPAND": {
89
+ actions: ["expandPanel"]
90
+ },
91
+ "PANEL.RESIZE": {
92
+ actions: ["resizePanel"]
93
+ }
94
+ },
95
+ entry: ["syncSize"],
96
+ exit: ["clearGlobalCursor"],
97
+ states: {
98
+ idle: {
99
+ entry: ["clearDraggingState", "clearKeyboardState"],
100
+ on: {
101
+ POINTER_OVER: {
102
+ target: "hover:temp",
103
+ actions: ["setKeyboardState"]
104
+ },
105
+ FOCUS: {
106
+ target: "focused",
107
+ actions: ["setKeyboardState"]
108
+ },
109
+ POINTER_DOWN: {
110
+ target: "dragging",
111
+ actions: ["setDraggingState"]
112
+ }
113
+ }
114
+ },
115
+ "hover:temp": {
116
+ effects: ["waitForHoverDelay"],
117
+ on: {
118
+ HOVER_DELAY: {
119
+ target: "hover"
120
+ },
121
+ POINTER_DOWN: {
122
+ target: "dragging",
123
+ actions: ["setDraggingState"]
124
+ },
125
+ POINTER_LEAVE: {
126
+ target: "idle"
127
+ }
128
+ }
129
+ },
130
+ hover: {
131
+ tags: ["focus"],
132
+ on: {
133
+ POINTER_DOWN: {
134
+ target: "dragging",
135
+ actions: ["setDraggingState"]
136
+ },
137
+ POINTER_LEAVE: {
138
+ target: "idle"
139
+ }
140
+ }
141
+ },
142
+ focused: {
143
+ tags: ["focus"],
144
+ on: {
145
+ BLUR: {
146
+ target: "idle"
147
+ },
148
+ ENTER: {
149
+ actions: ["collapseOrExpandPanel"]
150
+ },
151
+ POINTER_DOWN: {
152
+ target: "dragging",
153
+ actions: ["setDraggingState"]
154
+ },
155
+ KEYBOARD_MOVE: {
156
+ actions: ["invokeOnResizeStart", "setKeyboardValue", "invokeOnResizeEnd"]
157
+ },
158
+ "FOCUS.CYCLE": {
159
+ actions: ["focusNextResizeTrigger"]
160
+ }
161
+ }
162
+ },
163
+ dragging: {
164
+ tags: ["focus"],
165
+ effects: ["trackPointerMove"],
166
+ entry: ["invokeOnResizeStart"],
167
+ on: {
168
+ POINTER_MOVE: {
169
+ actions: ["setPointerValue", "setGlobalCursor"]
170
+ },
171
+ POINTER_UP: {
172
+ target: "idle",
173
+ actions: ["invokeOnResizeEnd", "clearGlobalCursor"]
174
+ }
175
+ }
176
+ }
177
+ },
178
+ implementations: {
179
+ effects: {
180
+ waitForHoverDelay: ({ send }) => {
181
+ return setRafTimeout(() => {
182
+ send({ type: "HOVER_DELAY" });
183
+ }, 250);
184
+ },
185
+ trackPointerMove: ({ scope, send }) => {
186
+ const doc = scope.getDoc();
187
+ return trackPointerMove(doc, {
188
+ onPointerMove(info) {
189
+ send({ type: "POINTER_MOVE", point: info.point });
190
+ },
191
+ onPointerUp() {
192
+ send({ type: "POINTER_UP" });
193
+ }
194
+ });
195
+ }
196
+ },
197
+ actions: {
198
+ setSize(params) {
199
+ const { context, event, prop } = params;
200
+ const unsafeSize = event.size;
201
+ const prevSize = context.get("size");
202
+ const panels = prop("panels");
203
+ const safeSize = validateSizes({
204
+ size: unsafeSize,
205
+ panels
206
+ });
207
+ if (!isEqual(prevSize, safeSize)) {
208
+ setSize(params, safeSize);
209
+ }
210
+ },
211
+ syncSize({ context, prop }) {
212
+ const panels = prop("panels");
213
+ let prevSize = context.get("size");
214
+ let unsafeSize = null;
215
+ if (prevSize.length === 0) {
216
+ unsafeSize = getUnsafeDefaultSize({
217
+ panels,
218
+ size: context.initial("size")
219
+ });
220
+ }
221
+ const nextSize = validateSizes({
222
+ size: unsafeSize ?? prevSize,
223
+ panels
224
+ });
225
+ if (!isEqual(prevSize, nextSize)) {
226
+ context.set("size", nextSize);
227
+ }
228
+ },
229
+ setDraggingState({ context, event, prop, scope }) {
230
+ const orientation = prop("orientation");
231
+ const size = context.get("size");
232
+ const resizeTriggerId = event.id;
233
+ const panelGroupEl = dom.getRootEl(scope);
234
+ if (!panelGroupEl) return;
235
+ const handleElement = dom.getResizeTriggerEl(scope, resizeTriggerId);
236
+ ensure(handleElement, () => `Drag handle element not found for id "${resizeTriggerId}"`);
237
+ const initialCursorPosition = orientation === "horizontal" ? event.point.x : event.point.y;
238
+ context.set("dragState", {
239
+ resizeTriggerId: event.id,
240
+ resizeTriggerRect: handleElement.getBoundingClientRect(),
241
+ initialCursorPosition,
242
+ initialSize: size
243
+ });
244
+ },
245
+ clearDraggingState({ context }) {
246
+ context.set("dragState", null);
247
+ },
248
+ setKeyboardState({ context, event }) {
249
+ context.set("keyboardState", {
250
+ resizeTriggerId: event.id
251
+ });
252
+ },
253
+ clearKeyboardState({ context }) {
254
+ context.set("keyboardState", null);
255
+ },
256
+ collapsePanel(params) {
257
+ const { context, prop, event, refs } = params;
258
+ const prevSize = context.get("size");
259
+ const panels = prop("panels");
260
+ const panel = panels.find((panel2) => panel2.id === event.id);
261
+ ensure(panel, () => `Panel data not found for id "${event.id}"`);
262
+ if (panel.collapsible) {
263
+ const { collapsedSize = 0, panelSize, pivotIndices } = panelDataHelper(panels, panel, prevSize);
264
+ ensure(panelSize, () => `Panel size not found for panel "${panel.id}"`);
265
+ if (!fuzzyNumbersEqual(panelSize, collapsedSize)) {
266
+ refs.get("panelSizeBeforeCollapse").set(panel.id, panelSize);
267
+ const isLastPanel = findPanelDataIndex(panels, panel) === panels.length - 1;
268
+ const delta = isLastPanel ? panelSize - collapsedSize : collapsedSize - panelSize;
269
+ const nextSize = resizeByDelta({
270
+ delta,
271
+ initialSize: prevSize,
272
+ panels,
273
+ pivotIndices,
274
+ prevSize,
275
+ trigger: "imperative-api"
276
+ });
277
+ if (!isEqual(prevSize, nextSize)) {
278
+ setSize(params, nextSize);
279
+ }
280
+ }
281
+ }
282
+ },
283
+ expandPanel(params) {
284
+ const { context, prop, event, refs } = params;
285
+ const panels = prop("panels");
286
+ const prevSize = context.get("size");
287
+ const panel = panels.find((panel2) => panel2.id === event.id);
288
+ ensure(panel, () => `Panel data not found for id "${event.id}"`);
289
+ if (panel.collapsible) {
290
+ const {
291
+ collapsedSize = 0,
292
+ panelSize = 0,
293
+ minSize: minSizeFromProps = 0,
294
+ pivotIndices
295
+ } = panelDataHelper(panels, panel, prevSize);
296
+ const minSize = event.minSize ?? minSizeFromProps;
297
+ if (fuzzyNumbersEqual(panelSize, collapsedSize)) {
298
+ const prevPanelSize = refs.get("panelSizeBeforeCollapse").get(panel.id);
299
+ const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
300
+ const isLastPanel = findPanelDataIndex(panels, panel) === panels.length - 1;
301
+ const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
302
+ const nextSize = resizeByDelta({
303
+ delta,
304
+ initialSize: prevSize,
305
+ panels,
306
+ pivotIndices,
307
+ prevSize,
308
+ trigger: "imperative-api"
309
+ });
310
+ if (!isEqual(prevSize, nextSize)) {
311
+ setSize(params, nextSize);
312
+ }
313
+ }
314
+ }
315
+ },
316
+ resizePanel(params) {
317
+ const { context, prop, event } = params;
318
+ const prevSize = context.get("size");
319
+ const panels = prop("panels");
320
+ const panel = getPanelById(panels, event.id);
321
+ const unsafePanelSize = event.size;
322
+ const { panelSize, pivotIndices } = panelDataHelper(panels, panel, prevSize);
323
+ ensure(panelSize, () => `Panel size not found for panel "${panel.id}"`);
324
+ const isLastPanel = findPanelDataIndex(panels, panel) === panels.length - 1;
325
+ const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
326
+ const nextSize = resizeByDelta({
327
+ delta,
328
+ initialSize: prevSize,
329
+ panels,
330
+ pivotIndices,
331
+ prevSize,
332
+ trigger: "imperative-api"
333
+ });
334
+ if (!isEqual(prevSize, nextSize)) {
335
+ setSize(params, nextSize);
336
+ }
337
+ },
338
+ setPointerValue(params) {
339
+ const { context, event, prop, scope } = params;
340
+ const dragState = context.get("dragState");
341
+ if (!dragState) return;
342
+ const { resizeTriggerId, initialSize, initialCursorPosition } = dragState;
343
+ const panels = prop("panels");
344
+ const panelGroupElement = dom.getRootEl(scope);
345
+ ensure(panelGroupElement, () => `Panel group element not found`);
346
+ const pivotIndices = resizeTriggerId.split(":").map((id) => panels.findIndex((panel) => panel.id === id));
347
+ const horizontal = prop("orientation") === "horizontal";
348
+ const cursorPosition = horizontal ? event.point.x : event.point.y;
349
+ const groupRect = panelGroupElement.getBoundingClientRect();
350
+ const groupSizeInPixels = horizontal ? groupRect.width : groupRect.height;
351
+ const offsetPixels = cursorPosition - initialCursorPosition;
352
+ const offsetPercentage = offsetPixels / groupSizeInPixels * 100;
353
+ const prevSize = context.get("size");
354
+ const nextSize = resizeByDelta({
355
+ delta: offsetPercentage,
356
+ initialSize: initialSize ?? prevSize,
357
+ panels,
358
+ pivotIndices,
359
+ prevSize,
360
+ trigger: "mouse-or-touch"
361
+ });
362
+ if (!isEqual(prevSize, nextSize)) {
363
+ setSize(params, nextSize);
364
+ }
365
+ },
366
+ setKeyboardValue(params) {
367
+ const { context, event, prop } = params;
368
+ const panelDataArray = prop("panels");
369
+ const resizeTriggerId = event.id;
370
+ const delta = event.delta;
371
+ const pivotIndices = resizeTriggerId.split(":").map((id) => panelDataArray.findIndex((panelData) => panelData.id === id));
372
+ const prevSize = context.get("size");
373
+ const nextSize = resizeByDelta({
374
+ delta,
375
+ initialSize: prevSize,
376
+ panels: panelDataArray,
377
+ pivotIndices,
378
+ prevSize,
379
+ trigger: "keyboard"
380
+ });
381
+ if (!isEqual(prevSize, nextSize)) {
382
+ setSize(params, nextSize);
383
+ }
384
+ },
385
+ invokeOnResizeEnd({ context, prop }) {
386
+ queueMicrotask(() => {
387
+ const dragState = context.get("dragState");
388
+ prop("onResizeEnd")?.({
389
+ size: context.get("size"),
390
+ resizeTriggerId: dragState?.resizeTriggerId ?? null
391
+ });
392
+ });
393
+ },
394
+ invokeOnResizeStart({ prop }) {
395
+ queueMicrotask(() => {
396
+ prop("onResizeStart")?.();
397
+ });
398
+ },
399
+ collapseOrExpandPanel(params) {
400
+ const { context, prop } = params;
401
+ const panelDataArray = prop("panels");
402
+ const sizes = context.get("size");
403
+ const resizeTriggerId = context.get("keyboardState")?.resizeTriggerId;
404
+ const [idBefore, idAfter] = resizeTriggerId?.split(":") ?? [];
405
+ const index = panelDataArray.findIndex((panelData2) => panelData2.id === idBefore);
406
+ if (index === -1) return;
407
+ const panelData = panelDataArray[index];
408
+ ensure(panelData, () => `No panel data found for index ${index}`);
409
+ const size = sizes[index];
410
+ const { collapsedSize = 0, collapsible, minSize = 0 } = panelData;
411
+ if (size != null && collapsible) {
412
+ const pivotIndices = [idBefore, idAfter].map(
413
+ (id) => panelDataArray.findIndex((panelData2) => panelData2.id === id)
414
+ );
415
+ const nextSize = resizeByDelta({
416
+ delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
417
+ initialSize: context.initial("size"),
418
+ panels: panelDataArray,
419
+ pivotIndices,
420
+ prevSize: sizes,
421
+ trigger: "keyboard"
422
+ });
423
+ if (!isEqual(sizes, nextSize)) {
424
+ setSize(params, nextSize);
425
+ }
426
+ }
427
+ },
428
+ setGlobalCursor({ context, scope, prop }) {
429
+ const dragState = context.get("dragState");
430
+ if (!dragState) return;
431
+ const panels = prop("panels");
432
+ const horizontal = prop("orientation") === "horizontal";
433
+ const [idBefore] = dragState.resizeTriggerId.split(":");
434
+ const indexBefore = panels.findIndex((panel2) => panel2.id === idBefore);
435
+ const panel = panels[indexBefore];
436
+ const size = context.get("size");
437
+ const aria = getAriaValue(size, panels, dragState.resizeTriggerId);
438
+ const isAtMin = fuzzyNumbersEqual(aria.valueNow, aria.valueMin) || fuzzyNumbersEqual(aria.valueNow, panel.collapsedSize);
439
+ const isAtMax = fuzzyNumbersEqual(aria.valueNow, aria.valueMax);
440
+ const cursorState = { isAtMin, isAtMax };
441
+ dom.setupGlobalCursor(scope, cursorState, horizontal, prop("nonce"));
442
+ },
443
+ clearGlobalCursor({ scope }) {
444
+ dom.removeGlobalCursor(scope);
445
+ },
446
+ focusNextResizeTrigger({ event, scope }) {
447
+ const resizeTriggers = dom.getResizeTriggerEls(scope);
448
+ const index = resizeTriggers.findIndex((el) => el.dataset.id === event.id);
449
+ const handleEl = event.shiftKey ? prev(resizeTriggers, index) : next(resizeTriggers, index);
450
+ handleEl?.focus();
451
+ }
452
+ }
453
+ }
454
+ });
455
+ function setSize(params, sizes) {
456
+ const { refs, prop, context } = params;
457
+ const panelsArray = prop("panels");
458
+ const onCollapse = prop("onCollapse");
459
+ const onExpand = prop("onExpand");
460
+ const panelIdToLastNotifiedSizeMap = refs.get("panelIdToLastNotifiedSizeMap");
461
+ context.set("size", sizes);
462
+ sizes.forEach((size, index) => {
463
+ const panelData = panelsArray[index];
464
+ ensure(panelData, () => `Panel data not found for index ${index}`);
465
+ const { collapsedSize = 0, collapsible, id: panelId } = panelData;
466
+ const lastNotifiedSize = panelIdToLastNotifiedSizeMap.get(panelId);
467
+ if (lastNotifiedSize == null || size !== lastNotifiedSize) {
468
+ panelIdToLastNotifiedSizeMap.set(panelId, size);
469
+ if (collapsible && (onCollapse || onExpand)) {
470
+ if ((lastNotifiedSize == null || fuzzyNumbersEqual(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual(size, collapsedSize)) {
471
+ onExpand?.({ panelId, size });
472
+ }
473
+ if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual(size, collapsedSize)) {
474
+ onCollapse?.({ panelId, size });
475
+ }
476
+ }
477
+ }
478
+ });
479
+ }
480
+ export {
481
+ machine
482
+ };
@@ -0,0 +1,12 @@
1
+ import { SplitterProps, ResizeTriggerProps, PanelProps } from './splitter.types.mjs';
2
+ import '@zag-js/core';
3
+ import '@zag-js/types';
4
+
5
+ declare const props: (keyof SplitterProps)[];
6
+ declare const splitProps: <Props extends Partial<SplitterProps>>(props: Props) => [Partial<SplitterProps>, Omit<Props, keyof SplitterProps>];
7
+ declare const panelProps: "id"[];
8
+ declare const splitPanelProps: <Props extends PanelProps>(props: Props) => [PanelProps, Omit<Props, "id">];
9
+ declare const resizeTriggerProps: (keyof ResizeTriggerProps)[];
10
+ declare const splitResizeTriggerProps: <Props extends ResizeTriggerProps>(props: Props) => [ResizeTriggerProps, Omit<Props, keyof ResizeTriggerProps>];
11
+
12
+ export { panelProps, props, resizeTriggerProps, splitPanelProps, splitProps, splitResizeTriggerProps };
@@ -0,0 +1,12 @@
1
+ import { SplitterProps, ResizeTriggerProps, PanelProps } from './splitter.types.js';
2
+ import '@zag-js/core';
3
+ import '@zag-js/types';
4
+
5
+ declare const props: (keyof SplitterProps)[];
6
+ declare const splitProps: <Props extends Partial<SplitterProps>>(props: Props) => [Partial<SplitterProps>, Omit<Props, keyof SplitterProps>];
7
+ declare const panelProps: "id"[];
8
+ declare const splitPanelProps: <Props extends PanelProps>(props: Props) => [PanelProps, Omit<Props, "id">];
9
+ declare const resizeTriggerProps: (keyof ResizeTriggerProps)[];
10
+ declare const splitResizeTriggerProps: <Props extends ResizeTriggerProps>(props: Props) => [ResizeTriggerProps, Omit<Props, keyof ResizeTriggerProps>];
11
+
12
+ export { panelProps, props, resizeTriggerProps, splitPanelProps, splitProps, splitResizeTriggerProps };
@@ -0,0 +1,63 @@
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);
19
+
20
+ // src/splitter.props.ts
21
+ var splitter_props_exports = {};
22
+ __export(splitter_props_exports, {
23
+ panelProps: () => panelProps,
24
+ props: () => props,
25
+ resizeTriggerProps: () => resizeTriggerProps,
26
+ splitPanelProps: () => splitPanelProps,
27
+ splitProps: () => splitProps,
28
+ splitResizeTriggerProps: () => splitResizeTriggerProps
29
+ });
30
+ module.exports = __toCommonJS(splitter_props_exports);
31
+ var import_types = require("@zag-js/types");
32
+ var import_utils = require("@zag-js/utils");
33
+ var props = (0, import_types.createProps)()([
34
+ "dir",
35
+ "getRootNode",
36
+ "id",
37
+ "ids",
38
+ "onResize",
39
+ "onResizeStart",
40
+ "onResizeEnd",
41
+ "onCollapse",
42
+ "onExpand",
43
+ "orientation",
44
+ "size",
45
+ "defaultSize",
46
+ "panels",
47
+ "keyboardResizeBy",
48
+ "nonce"
49
+ ]);
50
+ var splitProps = (0, import_utils.createSplitProps)(props);
51
+ var panelProps = (0, import_types.createProps)()(["id"]);
52
+ var splitPanelProps = (0, import_utils.createSplitProps)(panelProps);
53
+ var resizeTriggerProps = (0, import_types.createProps)()(["disabled", "id"]);
54
+ var splitResizeTriggerProps = (0, import_utils.createSplitProps)(resizeTriggerProps);
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ panelProps,
58
+ props,
59
+ resizeTriggerProps,
60
+ splitPanelProps,
61
+ splitProps,
62
+ splitResizeTriggerProps
63
+ });
@@ -0,0 +1,33 @@
1
+ // src/splitter.props.ts
2
+ import { createProps } from "@zag-js/types";
3
+ import { createSplitProps } from "@zag-js/utils";
4
+ var props = createProps()([
5
+ "dir",
6
+ "getRootNode",
7
+ "id",
8
+ "ids",
9
+ "onResize",
10
+ "onResizeStart",
11
+ "onResizeEnd",
12
+ "onCollapse",
13
+ "onExpand",
14
+ "orientation",
15
+ "size",
16
+ "defaultSize",
17
+ "panels",
18
+ "keyboardResizeBy",
19
+ "nonce"
20
+ ]);
21
+ var splitProps = createSplitProps(props);
22
+ var panelProps = createProps()(["id"]);
23
+ var splitPanelProps = createSplitProps(panelProps);
24
+ var resizeTriggerProps = createProps()(["disabled", "id"]);
25
+ var splitResizeTriggerProps = createSplitProps(resizeTriggerProps);
26
+ export {
27
+ panelProps,
28
+ props,
29
+ resizeTriggerProps,
30
+ splitPanelProps,
31
+ splitProps,
32
+ splitResizeTriggerProps
33
+ };