react-zeugma 3.0.0 → 4.1.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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { Dispatch, SetStateAction, RefObject, ReactNode } from 'react';
2
2
 
3
3
  type SplitDirection = 'row' | 'column';
4
4
  interface SplitNode {
@@ -18,47 +18,31 @@ interface PaneNode {
18
18
  }
19
19
  type TreeNode = SplitNode | PaneNode;
20
20
 
21
- interface ZeugmaClassNames {
22
- /** CSS class applied to the outer container div of each `<Pane>`. */
23
- pane?: string;
24
- /** CSS class applied to the pane container when locked. */
25
- paneLocked?: string;
26
- /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
27
- dropPreview?: string;
28
- /** CSS class applied to the drop zone indicator when hovering over the center of a pane to swap. */
29
- swapPreview?: string;
30
- /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
31
- dragOverlay?: string;
32
- /** CSS class applied to the drag-to-resize split bar handles. */
33
- resizer?: string;
34
- /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
35
- dismissPreview?: string;
36
- /** CSS class applied to root container when dashboard is globally locked. */
37
- dashboardLocked?: string;
38
- /** CSS class applied to drop zone indicator when hovering over a locked pane. */
39
- lockedPreview?: string;
40
- }
41
- interface ZeugmaProps {
42
- /** The layout tree model (TreeNode) defining pane organization and split percentages. Set to null for empty layout. */
43
- layout: TreeNode | null;
21
+ interface UseZeugmaOptions {
22
+ /** Initial layout tree model defining pane organization and split percentages. Set to null for empty layout. */
23
+ initialLayout: TreeNode | null;
44
24
  /** Callback triggered when the layout changes via drag-and-drop actions, splits, swaps, or resizes. */
45
- onChange: (newLayout: TreeNode | null) => void;
46
- /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
47
- renderPane: (paneId: string) => ReactNode;
48
- /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
49
- renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
50
- /** Optional CSS class name mapping overrides for custom styles of components like panes, drop/swap previews, overlays, etc. */
51
- classNames?: ZeugmaClassNames;
25
+ onChange?: (newLayout: TreeNode | null) => void;
52
26
  /** The ID of the pane that is currently taking up the full dashboard area. Null if no pane is fullscreen. */
53
27
  fullscreenPaneId?: string | null;
54
28
  /** Callback triggered when a pane is toggled to/from fullscreen mode. Passes the active fullscreen paneId or null. */
55
29
  onFullscreenChange?: (paneId: string | null) => void;
56
- /** Callback triggered when a pane is removed from the dashboard layout tree. */
57
- onRemove?: (paneId: string) => void;
30
+ /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
31
+ locked?: boolean;
58
32
  /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
59
33
  dragActivationDistance?: number;
60
34
  /** Threshold value in pixels for snapping layout resizing handles to adjacent edges. Defaults to 8. */
61
35
  snapThreshold?: number;
36
+ /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
37
+ minSplitPercentage?: number;
38
+ /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
39
+ maxSplitPercentage?: number;
40
+ /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
41
+ enableDragToDismiss?: boolean;
42
+ /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. Defaults to 60. */
43
+ dismissThreshold?: number;
44
+ /** Callback triggered when a pane is removed from the dashboard layout tree. */
45
+ onRemove?: (paneId: string) => void;
62
46
  /** Callback triggered when dragging starts for a pane. */
63
47
  onDragStart?: (activeId: string) => void;
64
48
  /** Callback triggered when dragging ends, providing details on target pane and drop action (split or swap). */
@@ -73,18 +57,77 @@ interface ZeugmaProps {
73
57
  onResize?: (currentNode: SplitNode, percentage: number) => void;
74
58
  /** Callback triggered when the user stops dragging a resizing handle. Passes the final split percentage. */
75
59
  onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
76
- /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
77
- minSplitPercentage?: number;
78
- /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
79
- maxSplitPercentage?: number;
80
- /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
81
- enableDragToDismiss?: boolean;
82
- /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. */
83
- dismissThreshold?: number;
84
- /** Callback triggered when the drag-out/dismiss intent changes (active pane ID or null when drag returns inside bounds). */
60
+ /** Callback triggered when the drag-out/dismiss intent changes. */
85
61
  onDismissIntentChange?: (paneId: string | null) => void;
86
- /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
87
- locked?: boolean;
62
+ }
63
+ interface ZeugmaController {
64
+ layout: TreeNode | null;
65
+ setLayout: Dispatch<SetStateAction<TreeNode | null>>;
66
+ fullscreenPaneId: string | null;
67
+ setFullscreenPaneId: (paneId: string | null) => void;
68
+ locked: boolean;
69
+ setLocked: Dispatch<SetStateAction<boolean>>;
70
+ activeId: string | null;
71
+ setActiveId: Dispatch<SetStateAction<string | null>>;
72
+ activeType: 'pane' | 'tab' | null;
73
+ setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
74
+ dismissIntentId: string | null;
75
+ setDismissIntentId: Dispatch<SetStateAction<string | null>>;
76
+ containerRef: RefObject<HTMLElement | null>;
77
+ setContainerRef: (element: HTMLElement | null) => void;
78
+ dragActivationDistance: number;
79
+ snapThreshold: number;
80
+ minSplitPercentage: number;
81
+ maxSplitPercentage: number;
82
+ enableDragToDismiss: boolean;
83
+ dismissThreshold: number;
84
+ onRemove?: (paneId: string) => void;
85
+ onDragStart?: (activeId: string) => void;
86
+ onDragEnd?: (activeId: string, overId: string | null, dropAction: {
87
+ type: 'split' | 'swap';
88
+ direction?: SplitDirection;
89
+ position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
90
+ } | null) => void;
91
+ onResizeStart?: (currentNode: SplitNode) => void;
92
+ onResize?: (currentNode: SplitNode, percentage: number) => void;
93
+ onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
94
+ onDismissIntentChange?: (paneId: string | null) => void;
95
+ removePane: (paneId: string) => void;
96
+ addPane: (paneId: string) => void;
97
+ splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
98
+ updateSplitPercentage: (currentNode: SplitNode, percentage: number) => void;
99
+ updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
100
+ updatePaneLock: (paneId: string, locked: boolean) => void;
101
+ selectTab: (paneId: string, tabId: string) => void;
102
+ mergeTab: (draggedTabId: string, targetPaneId: string) => void;
103
+ moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
104
+ removeTab: (tabId: string) => void;
105
+ }
106
+ interface ZeugmaClassNames {
107
+ /** CSS class applied to the outer container div of each `<Pane>`. */
108
+ pane?: string;
109
+ /** CSS class applied to the pane container when locked. */
110
+ paneLocked?: string;
111
+ /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
112
+ dropPreview?: string;
113
+ /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
114
+ dragOverlay?: string;
115
+ /** CSS class applied to the drag-to-resize split bar handles. */
116
+ resizer?: string;
117
+ /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
118
+ dismissPreview?: string;
119
+ /** CSS class applied to root container when dashboard is globally locked. */
120
+ dashboardLocked?: string;
121
+ /** CSS class applied to drop zone indicator when hovering over a locked pane. */
122
+ lockedPreview?: string;
123
+ }
124
+ interface ZeugmaProps extends ZeugmaController {
125
+ /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
126
+ renderPane: (paneId: string) => ReactNode;
127
+ /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
128
+ renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
129
+ /** Optional CSS class name mapping overrides for custom styles of components like panes, drop/swap previews, overlays, etc. */
130
+ classNames?: ZeugmaClassNames;
88
131
  /** Render function mapping tab IDs to React elements. Used to render tab widgets inside portals. */
89
132
  renderWidget?: (tabId: string) => ReactNode;
90
133
  /** Child nodes nested inside the Zeugma context, usually containing a <PaneTree> or similar layout viewer. */
@@ -139,8 +182,6 @@ interface ZeugmaActionsValue {
139
182
  removePane: (paneId: string) => void;
140
183
  /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
141
184
  addPane: (paneId: string) => void;
142
- /** Swaps the positions of two panes in the layout tree. */
143
- swapPanes: (paneIdA: string, paneIdB: string) => void;
144
185
  /** Splits a target pane with a new pane in the specified direction and side. */
145
186
  splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
146
187
  /** Updates the split percentage of a specific split branch node. */
@@ -158,9 +199,12 @@ interface ZeugmaActionsValue {
158
199
  /** Stable callback to remove/close a specific tab from the layout. */
159
200
  removeTab: (tabId: string) => void;
160
201
  }
202
+ interface ZeugmaContextValue extends ZeugmaStateValue, ZeugmaActionsValue {
203
+ }
161
204
 
162
- declare const useZeugmaState: () => ZeugmaStateValue;
163
- declare const useZeugmaActions: () => ZeugmaActionsValue;
205
+ declare function useZeugma(options: UseZeugmaOptions): ZeugmaController;
206
+
207
+ declare const useZeugmaContext: () => ZeugmaContextValue;
164
208
 
165
209
  declare const Zeugma: React.FC<ZeugmaProps>;
166
210
 
@@ -293,6 +337,7 @@ declare const DEFAULT_SNAP_THRESHOLD = 8;
293
337
  declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
294
338
  declare const DEFAULT_RESIZER_SIZE = 4;
295
339
 
340
+ declare function generateUniqueId(): string;
296
341
  /**
297
342
  * Tree Helper: Remove a pane container and consolidate the tree structure.
298
343
  */
@@ -305,10 +350,6 @@ declare function removeTab(tree: TreeNode | null, tabId: string): TreeNode | nul
305
350
  * Tree Helper: Insert a pane by splitting an existing target node.
306
351
  */
307
352
  declare function splitPane(tree: TreeNode | null, targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string | PaneNode): TreeNode | null;
308
- /**
309
- * Tree Helper: Swap the position of two panes in the tree structure.
310
- */
311
- declare function swapPanes(tree: TreeNode | null, idA: string, idB: string): TreeNode | null;
312
353
  /**
313
354
  * Tree Helper: Add a pane by recursively splitting the rightmost/bottommost pane in the tree.
314
355
  */
@@ -392,4 +433,4 @@ interface DragSessionConfig {
392
433
  }
393
434
  declare function createDragSession({ cursor, resizerEl, onMove, onEnd }: DragSessionConfig): void;
394
435
 
395
- export { type ComputedPane, type ComputedSplitter, DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneNode, type PaneProps, type PaneRenderProps, PaneTree, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, Zeugma, type ZeugmaActionsValue, type ZeugmaClassNames, type ZeugmaProps, type ZeugmaStateValue, addPane, computeLayout, createDragSession, findPane, mergeTab, moveTab, removePane, removeTab, selectTab, splitPane, swapPanes, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugmaActions, useZeugmaState };
436
+ export { type ComputedPane, type ComputedSplitter, DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneNode, type PaneProps, type PaneRenderProps, PaneTree, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, type UseZeugmaOptions, Zeugma, type ZeugmaClassNames, type ZeugmaContextValue, type ZeugmaController, type ZeugmaProps, addPane, computeLayout, createDragSession, findPane, generateUniqueId, mergeTab, moveTab, removePane, removeTab, selectTab, splitPane, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugma, useZeugmaContext };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { Dispatch, SetStateAction, RefObject, ReactNode } from 'react';
2
2
 
3
3
  type SplitDirection = 'row' | 'column';
4
4
  interface SplitNode {
@@ -18,47 +18,31 @@ interface PaneNode {
18
18
  }
19
19
  type TreeNode = SplitNode | PaneNode;
20
20
 
21
- interface ZeugmaClassNames {
22
- /** CSS class applied to the outer container div of each `<Pane>`. */
23
- pane?: string;
24
- /** CSS class applied to the pane container when locked. */
25
- paneLocked?: string;
26
- /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
27
- dropPreview?: string;
28
- /** CSS class applied to the drop zone indicator when hovering over the center of a pane to swap. */
29
- swapPreview?: string;
30
- /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
31
- dragOverlay?: string;
32
- /** CSS class applied to the drag-to-resize split bar handles. */
33
- resizer?: string;
34
- /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
35
- dismissPreview?: string;
36
- /** CSS class applied to root container when dashboard is globally locked. */
37
- dashboardLocked?: string;
38
- /** CSS class applied to drop zone indicator when hovering over a locked pane. */
39
- lockedPreview?: string;
40
- }
41
- interface ZeugmaProps {
42
- /** The layout tree model (TreeNode) defining pane organization and split percentages. Set to null for empty layout. */
43
- layout: TreeNode | null;
21
+ interface UseZeugmaOptions {
22
+ /** Initial layout tree model defining pane organization and split percentages. Set to null for empty layout. */
23
+ initialLayout: TreeNode | null;
44
24
  /** Callback triggered when the layout changes via drag-and-drop actions, splits, swaps, or resizes. */
45
- onChange: (newLayout: TreeNode | null) => void;
46
- /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
47
- renderPane: (paneId: string) => ReactNode;
48
- /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
49
- renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
50
- /** Optional CSS class name mapping overrides for custom styles of components like panes, drop/swap previews, overlays, etc. */
51
- classNames?: ZeugmaClassNames;
25
+ onChange?: (newLayout: TreeNode | null) => void;
52
26
  /** The ID of the pane that is currently taking up the full dashboard area. Null if no pane is fullscreen. */
53
27
  fullscreenPaneId?: string | null;
54
28
  /** Callback triggered when a pane is toggled to/from fullscreen mode. Passes the active fullscreen paneId or null. */
55
29
  onFullscreenChange?: (paneId: string | null) => void;
56
- /** Callback triggered when a pane is removed from the dashboard layout tree. */
57
- onRemove?: (paneId: string) => void;
30
+ /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
31
+ locked?: boolean;
58
32
  /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
59
33
  dragActivationDistance?: number;
60
34
  /** Threshold value in pixels for snapping layout resizing handles to adjacent edges. Defaults to 8. */
61
35
  snapThreshold?: number;
36
+ /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
37
+ minSplitPercentage?: number;
38
+ /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
39
+ maxSplitPercentage?: number;
40
+ /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
41
+ enableDragToDismiss?: boolean;
42
+ /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. Defaults to 60. */
43
+ dismissThreshold?: number;
44
+ /** Callback triggered when a pane is removed from the dashboard layout tree. */
45
+ onRemove?: (paneId: string) => void;
62
46
  /** Callback triggered when dragging starts for a pane. */
63
47
  onDragStart?: (activeId: string) => void;
64
48
  /** Callback triggered when dragging ends, providing details on target pane and drop action (split or swap). */
@@ -73,18 +57,77 @@ interface ZeugmaProps {
73
57
  onResize?: (currentNode: SplitNode, percentage: number) => void;
74
58
  /** Callback triggered when the user stops dragging a resizing handle. Passes the final split percentage. */
75
59
  onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
76
- /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
77
- minSplitPercentage?: number;
78
- /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
79
- maxSplitPercentage?: number;
80
- /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
81
- enableDragToDismiss?: boolean;
82
- /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. */
83
- dismissThreshold?: number;
84
- /** Callback triggered when the drag-out/dismiss intent changes (active pane ID or null when drag returns inside bounds). */
60
+ /** Callback triggered when the drag-out/dismiss intent changes. */
85
61
  onDismissIntentChange?: (paneId: string | null) => void;
86
- /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
87
- locked?: boolean;
62
+ }
63
+ interface ZeugmaController {
64
+ layout: TreeNode | null;
65
+ setLayout: Dispatch<SetStateAction<TreeNode | null>>;
66
+ fullscreenPaneId: string | null;
67
+ setFullscreenPaneId: (paneId: string | null) => void;
68
+ locked: boolean;
69
+ setLocked: Dispatch<SetStateAction<boolean>>;
70
+ activeId: string | null;
71
+ setActiveId: Dispatch<SetStateAction<string | null>>;
72
+ activeType: 'pane' | 'tab' | null;
73
+ setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
74
+ dismissIntentId: string | null;
75
+ setDismissIntentId: Dispatch<SetStateAction<string | null>>;
76
+ containerRef: RefObject<HTMLElement | null>;
77
+ setContainerRef: (element: HTMLElement | null) => void;
78
+ dragActivationDistance: number;
79
+ snapThreshold: number;
80
+ minSplitPercentage: number;
81
+ maxSplitPercentage: number;
82
+ enableDragToDismiss: boolean;
83
+ dismissThreshold: number;
84
+ onRemove?: (paneId: string) => void;
85
+ onDragStart?: (activeId: string) => void;
86
+ onDragEnd?: (activeId: string, overId: string | null, dropAction: {
87
+ type: 'split' | 'swap';
88
+ direction?: SplitDirection;
89
+ position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
90
+ } | null) => void;
91
+ onResizeStart?: (currentNode: SplitNode) => void;
92
+ onResize?: (currentNode: SplitNode, percentage: number) => void;
93
+ onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
94
+ onDismissIntentChange?: (paneId: string | null) => void;
95
+ removePane: (paneId: string) => void;
96
+ addPane: (paneId: string) => void;
97
+ splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
98
+ updateSplitPercentage: (currentNode: SplitNode, percentage: number) => void;
99
+ updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
100
+ updatePaneLock: (paneId: string, locked: boolean) => void;
101
+ selectTab: (paneId: string, tabId: string) => void;
102
+ mergeTab: (draggedTabId: string, targetPaneId: string) => void;
103
+ moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
104
+ removeTab: (tabId: string) => void;
105
+ }
106
+ interface ZeugmaClassNames {
107
+ /** CSS class applied to the outer container div of each `<Pane>`. */
108
+ pane?: string;
109
+ /** CSS class applied to the pane container when locked. */
110
+ paneLocked?: string;
111
+ /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
112
+ dropPreview?: string;
113
+ /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
114
+ dragOverlay?: string;
115
+ /** CSS class applied to the drag-to-resize split bar handles. */
116
+ resizer?: string;
117
+ /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
118
+ dismissPreview?: string;
119
+ /** CSS class applied to root container when dashboard is globally locked. */
120
+ dashboardLocked?: string;
121
+ /** CSS class applied to drop zone indicator when hovering over a locked pane. */
122
+ lockedPreview?: string;
123
+ }
124
+ interface ZeugmaProps extends ZeugmaController {
125
+ /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
126
+ renderPane: (paneId: string) => ReactNode;
127
+ /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
128
+ renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
129
+ /** Optional CSS class name mapping overrides for custom styles of components like panes, drop/swap previews, overlays, etc. */
130
+ classNames?: ZeugmaClassNames;
88
131
  /** Render function mapping tab IDs to React elements. Used to render tab widgets inside portals. */
89
132
  renderWidget?: (tabId: string) => ReactNode;
90
133
  /** Child nodes nested inside the Zeugma context, usually containing a <PaneTree> or similar layout viewer. */
@@ -139,8 +182,6 @@ interface ZeugmaActionsValue {
139
182
  removePane: (paneId: string) => void;
140
183
  /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
141
184
  addPane: (paneId: string) => void;
142
- /** Swaps the positions of two panes in the layout tree. */
143
- swapPanes: (paneIdA: string, paneIdB: string) => void;
144
185
  /** Splits a target pane with a new pane in the specified direction and side. */
145
186
  splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
146
187
  /** Updates the split percentage of a specific split branch node. */
@@ -158,9 +199,12 @@ interface ZeugmaActionsValue {
158
199
  /** Stable callback to remove/close a specific tab from the layout. */
159
200
  removeTab: (tabId: string) => void;
160
201
  }
202
+ interface ZeugmaContextValue extends ZeugmaStateValue, ZeugmaActionsValue {
203
+ }
161
204
 
162
- declare const useZeugmaState: () => ZeugmaStateValue;
163
- declare const useZeugmaActions: () => ZeugmaActionsValue;
205
+ declare function useZeugma(options: UseZeugmaOptions): ZeugmaController;
206
+
207
+ declare const useZeugmaContext: () => ZeugmaContextValue;
164
208
 
165
209
  declare const Zeugma: React.FC<ZeugmaProps>;
166
210
 
@@ -293,6 +337,7 @@ declare const DEFAULT_SNAP_THRESHOLD = 8;
293
337
  declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
294
338
  declare const DEFAULT_RESIZER_SIZE = 4;
295
339
 
340
+ declare function generateUniqueId(): string;
296
341
  /**
297
342
  * Tree Helper: Remove a pane container and consolidate the tree structure.
298
343
  */
@@ -305,10 +350,6 @@ declare function removeTab(tree: TreeNode | null, tabId: string): TreeNode | nul
305
350
  * Tree Helper: Insert a pane by splitting an existing target node.
306
351
  */
307
352
  declare function splitPane(tree: TreeNode | null, targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string | PaneNode): TreeNode | null;
308
- /**
309
- * Tree Helper: Swap the position of two panes in the tree structure.
310
- */
311
- declare function swapPanes(tree: TreeNode | null, idA: string, idB: string): TreeNode | null;
312
353
  /**
313
354
  * Tree Helper: Add a pane by recursively splitting the rightmost/bottommost pane in the tree.
314
355
  */
@@ -392,4 +433,4 @@ interface DragSessionConfig {
392
433
  }
393
434
  declare function createDragSession({ cursor, resizerEl, onMove, onEnd }: DragSessionConfig): void;
394
435
 
395
- export { type ComputedPane, type ComputedSplitter, DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneNode, type PaneProps, type PaneRenderProps, PaneTree, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, Zeugma, type ZeugmaActionsValue, type ZeugmaClassNames, type ZeugmaProps, type ZeugmaStateValue, addPane, computeLayout, createDragSession, findPane, mergeTab, moveTab, removePane, removeTab, selectTab, splitPane, swapPanes, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugmaActions, useZeugmaState };
436
+ export { type ComputedPane, type ComputedSplitter, DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneNode, type PaneProps, type PaneRenderProps, PaneTree, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, type UseZeugmaOptions, Zeugma, type ZeugmaClassNames, type ZeugmaContextValue, type ZeugmaController, type ZeugmaProps, addPane, computeLayout, createDragSession, findPane, generateUniqueId, mergeTab, moveTab, removePane, removeTab, selectTab, splitPane, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugma, useZeugmaContext };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import nn,{createContext,useContext,useState,useRef,useCallback,useMemo,useEffect}from'react';import {createPortal}from'react-dom';import {useSensors,useSensor,pointerWithin,closestCenter,DndContext,useDraggable,useDroppable,PointerSensor,TouchSensor}from'@dnd-kit/core';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var De=createContext(void 0),Me=createContext(void 0);var Q=()=>{let e=useContext(De);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},We=()=>{let e=useContext(Me);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};function bt(e){let t=useRef(null);return useEffect(()=>{if(!e){t.current=null;return}let r=n=>{t.current={x:n.clientX,y:n.clientY};},i=n=>{let o=n.touches[0]||n.changedTouches[0];o&&(t.current={x:o.clientX,y:o.clientY});};return window.addEventListener("pointermove",r,{passive:true}),window.addEventListener("touchmove",i,{passive:true}),()=>{window.removeEventListener("pointermove",r),window.removeEventListener("touchmove",i);}},[e]),t}function gt(e){useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function vt(){let[e,t]=useState({}),r=useCallback((i,n)=>{t(o=>o[i]===n?o:{...o,[i]:n});},[]);return {portalTargets:e,registerPortalTarget:r}}var Ce=createContext(void 0);function he(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let r=he(e.first,t),i=he(e.second,t);return r===null?i:i===null?r:{...e,first:r,second:i}}function de(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let n=e.tabs.filter(s=>s!==t);if(n.length===0)return null;let o=e.activeTabId;return e.activeTabId===t&&(o=n[0]),{...e,tabs:n,activeTabId:o}}return e}let r=de(e.first,t),i=de(e.second,t);return r===null?i:i===null?r:{...e,first:r,second:i}}function we(e,t,r,i,n){if(e===null)return typeof n=="string"?{type:"pane",id:n,tabs:[n],activeTabId:n}:n;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){let o=typeof n=="string"?{type:"pane",id:n,tabs:[n],activeTabId:n}:n,s=i==="left"||i==="top";return {type:"split",direction:r,first:s?o:e,second:s?e:o,splitPercentage:50}}return e}return {...e,first:we(e.first,t,r,i,n)||e.first,second:we(e.second,t,r,i,n)||e.second}}function _e(e,t,r){if(e===null)return null;let i=_(e,t),n=_(e,r);if(!i||!n)return e;function o(s){return s.type==="pane"?s.id===i.id?{...n}:s.id===n.id?{...i}:s:{...s,first:o(s.first),second:o(s.second)}}return o(e)}function ht(e,t){if(e===null)return {type:"pane",id:t,tabs:[t],activeTabId:t};function r(i,n){return i.type==="pane"?{type:"split",direction:n==="row"?"column":"row",splitPercentage:50,first:i,second:{type:"pane",id:t,tabs:[t],activeTabId:t}}:{...i,second:r(i.second,i.direction)}}return r(e,null)}function pe(e,t,r){return e===null?null:e===t?{...e,splitPercentage:r}:e.type==="split"?{...e,first:pe(e.first,t,r)||e.first,second:pe(e.second,t,r)||e.second}:e}function _(e,t){return e===null?null:e.type==="pane"?e.id===t||e.tabs.includes(t)?e:null:_(e.first,t)??_(e.second,t)}function ze(e,t,r){if(e===null)return null;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){let i=e.tabsMetadata||{},n=i[t],o=r(n),s={...i};return o===void 0?delete s[t]:s[t]=o,{...e,tabsMetadata:Object.keys(s).length>0?s:void 0}}return e}return {...e,first:ze(e.first,t,r)??e.first,second:ze(e.second,t,r)??e.second}}function $e(e,t,r){if(e===null)return null;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){if(r===false){let{locked:i,...n}=e;return n}return {...e,locked:r}}return e}return {...e,first:$e(e.first,t,r)??e.first,second:$e(e.second,t,r)??e.second}}function Ie(e,t,r){return e===null?null:e.type==="pane"?e.id===t||e.tabs.includes(t)?{...e,activeTabId:r}:e:{...e,first:Ie(e.first,t,r)??e.first,second:Ie(e.second,t,r)??e.second}}function Pt(e,t,r){if(e===null)return null;let n=_(e,t)?.tabsMetadata?.[t],o=de(e,t);if(o===null)return {type:"pane",id:t,tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0};function s(c){if(c.type==="pane"){if(c.id===r||c.tabs.includes(r)){let d=[...c.tabs];d.includes(t)||d.push(t);let T={...c.tabsMetadata};return n&&(T[t]=n),{...c,tabs:d,activeTabId:t,tabsMetadata:Object.keys(T).length>0?T:void 0}}return c}return {...c,first:s(c.first),second:s(c.second)}}return s(o)}function Ye(e,t,r,i="before"){if(e===null)return null;let o=_(e,t)?.tabsMetadata?.[t],s=de(e,t);if(s===null)return {type:"pane",id:t,tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function c(d){if(d.type==="pane"){if(d.id===r||d.tabs.includes(r)){let S=[...d.tabs].filter(x=>x!==t),g=S.indexOf(r);g<0&&(g=0),i==="after"&&(g+=1),S.splice(g,0,t);let p={...d.tabsMetadata};return o&&(p[t]=o),{...d,tabs:S,activeTabId:t,tabsMetadata:Object.keys(p).length>0?p:void 0}}return d}return {...d,first:c(d.first),second:c(d.second)}}return c(s)}function j(e,t=0,r=0,i=100,n=100,o="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:r,width:i,height:n,node:e}],splitters:[]};let{direction:s,splitPercentage:c,first:d,second:T}=e,g={id:`splitter-${o}-${s}`,currentNode:e,direction:s,left:s==="row"?t+i*(c/100):t,top:s==="column"?r+n*(c/100):r,width:s==="row"?0:i,height:s==="column"?0:n,parentLeft:t,parentTop:r,parentWidth:i,parentHeight:n},p={panes:[],splitters:[]},x={panes:[],splitters:[]};if(s==="row"){let P=i*(c/100);p=j(d,t,r,P,n,`${o}-L`),x=j(T,t+P,r,i-P,n,`${o}-R`);}else {let P=n*(c/100);p=j(d,t,r,i,P,`${o}-T`),x=j(T,t,r+P,i,n-P,`${o}-B`);}return {panes:[...p.panes,...x.panes],splitters:[g,...p.splitters,...x.splitters]}}var Ot=8,Vt=8,Vn=4;var yt=({activeId:e,render:t,className:r})=>{let i=useRef(null);return useEffect(()=>{let n=o=>{i.current&&(i.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",n),()=>document.removeEventListener("pointermove",n)},[]),jsx("div",{ref:i,className:r,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var ke=class extends PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},He=class extends TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Be(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}var Qt=({layout:e,onChange:t,renderPane:r,renderWidget:i,renderDragOverlay:n,classNames:o={},fullscreenPaneId:s=null,onFullscreenChange:c,onRemove:d,dragActivationDistance:T=8,snapThreshold:S=8,onDragStart:g,onDragEnd:p,onResizeStart:x,onResize:P,onResizeEnd:E,minSplitPercentage:N=5,maxSplitPercentage:$=95,enableDragToDismiss:b=false,dismissThreshold:y=60,onDismissIntentChange:R,locked:I=false,children:B})=>{let[l,w]=useState(e),[k,ee]=useState(e);e!==k&&(ee(e),w(e));let[D,V]=useState(null),[q,Y]=useState(null),[v,H]=useState(null),{portalTargets:G,registerPortalTarget:F}=vt(),M=useRef(null),f=useRef(null),O=bt(D),me=useCallback(a=>{M.current=a;},[]),[U,le]=useState(false);gt(U);let xe=useCallback(a=>r(a),[r]),be=useMemo(()=>o,[o.pane,o.paneLocked,o.dropPreview,o.swapPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview]),Se=useSensors(useSensor(ke,{activationConstraint:{distance:T}}),useSensor(He,{activationConstraint:{delay:250,tolerance:5}})),ge=useCallback(a=>{let u=pointerWithin(a);if(u.length>0)return u;if(a.active.id.toString().startsWith("tab-header-")){let C=a.droppableContainers.filter(W=>W.id.toString().startsWith("tab-drop-"));return closestCenter({...a,droppableContainers:C})}return []},[]),ce=a=>{let u=a.active.id.toString(),m=u.startsWith("tab-header-"),C=m?u.substring(11):u;V(C),Y(m?"tab":"pane");let W=a.activatorEvent;O.current=Be(W),b&&M.current?f.current=M.current.getBoundingClientRect():f.current=null,g&&g(C);},te=a=>{let{over:u}=a,C=(u?.id.toString()||"").startsWith("drop-locked-");if(le(C),!b)return;let W=a.active.id.toString(),ne=W.startsWith("tab-header-")?W.substring(11):W,L=f.current;if(!L){v!==null&&(H(null),R?.(null));return}let Ee=a.activatorEvent,K=null,J=null;if(O.current)K=O.current.x,J=O.current.y;else {let z=Be(Ee);z&&(K=z.x+a.delta.x,J=z.y+a.delta.y);}let re=0;if(K!==null&&J!==null){let z=0,X=0;K<L.left?z=L.left-K:K>L.right&&(z=K-L.right),J<L.top?X=L.top-J:J>L.bottom&&(X=J-L.bottom),re=Math.sqrt(z*z+X*X);}else {let z=a.active.rect.current.translated;if(z){let X=z.left+z.width/2,ve=z.top+z.height/2,ue=0,oe=0;X<L.left?ue=L.left-X:X>L.right&&(ue=X-L.right),ve<L.top?oe=L.top-ve:ve>L.bottom&&(oe=ve-L.bottom),re=Math.sqrt(ue*ue+oe*oe);}}re>y?v!==ne&&(H(ne),R?.(ne)):v!==null&&(H(null),R?.(null));},A=a=>{V(null),Y(null),le(false);let{active:u,over:m}=a,C=u.id.toString(),W=C.startsWith("tab-header-"),h=W?C.substring(11):C,ne=b&&v===h;if(H(null),R?.(null),f.current=null,ne){d?d(h):Ve(h),p&&p(h,null,null);return}if(!m){p&&p(h,null,null);return}let L=m.id.toString();if(L.startsWith("drop-locked-")){p&&p(h,null,null);return}let Ee=L.match(/^tab-drop-(.+)$/);if(Ee){let[,ie]=Ee;if(h!==ie){let se="before",ut=m.rect,kt=a.activatorEvent,Le=null;if(O.current)Le=O.current.x;else {let Ne=Be(kt);Ne&&(Le=Ne.x+a.delta.x);}if(Le!==null){let Ne=ut.left+ut.width/2;Le>Ne&&(se="after");}let dt=Ye(l,h,ie,se);w(dt),t(dt);}p&&p(h,ie,{type:"swap",position:"center"});return}let K=L.match(/^drop-center-(.+)$/);if(K){let[,ie]=K;if(h!==ie){let se=_e(l,h,ie);w(se),t(se);}p&&p(h,ie,{type:"swap",position:"center"});return}let J=L.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!J){p&&p(h,null,null);return}let[,re,Te]=J,z=_(l,h),X=z&&z.id===Te,ve=z&&z.tabs.length===1;if(h===Te||X&&ve){p&&p(h,null,null);return}let ue=re==="left"||re==="right"?"row":"column",oe;if(W){let se=_(l,h)?.tabsMetadata?.[h];oe={type:"pane",id:h,tabs:[h],activeTabId:h,tabsMetadata:se?{[h]:se}:void 0};}else oe=_(l,h)??{type:"pane",id:h,tabs:[h],activeTabId:h};let It=W?de(l,h):he(l,h),ct=we(It,Te,ue,re,oe);w(ct),t(ct),p&&p(h,Te,{type:"split",direction:ue,position:re});},Je=useCallback((a,u=false)=>{w(a),u||t(a);},[t]),Qe=useCallback(a=>{let u=he(l,a);w(u),t(u);},[l,t]),je=useCallback(a=>{let u=ht(l,a);w(u),t(u);},[l,t]),et=useCallback((a,u)=>{let m=_e(l,a,u);w(m),t(m);},[l,t]),tt=useCallback((a,u,m,C)=>{let W=_(l,C)??{type:"pane",id:C,tabs:[C],activeTabId:C},h=he(l,C),ne=we(h,a,u,m,W);w(ne),t(ne);},[l,t]),nt=useCallback((a,u)=>{let m=Ie(l,a,u);w(m),t(m);},[l,t]),rt=useCallback((a,u)=>{let m=Pt(l,a,u);w(m),t(m);},[l,t]),ot=useCallback((a,u,m)=>{let C=Ye(l,a,u,m);w(C),t(C);},[l,t]),Ve=useCallback(a=>{let u=de(l,a);w(u),t(u);},[l,t]),it=useCallback((a,u)=>{let m=pe(l,a,u);w(m),t(m);},[l,t]),st=useCallback((a,u)=>{let m=ze(l,a,u);w(m),t(m);},[l,t]),at=useCallback((a,u)=>{let m=$e(l,a,u);w(m),t(m);},[l,t]),lt=useCallback((a,u)=>{E&&E(a,u);},[E]),Mt=useMemo(()=>({layout:l,onLayoutChange:Je,renderPane:xe,activeId:D,dismissIntentId:v,setContainerRef:me,fullscreenPaneId:s,classNames:be,onRemove:d,onFullscreenChange:c,snapThreshold:S,onResizeStart:x,onResize:P,onResizeEnd:lt,minSplitPercentage:N,maxSplitPercentage:$,locked:I}),[l,D,v,me,s,be,d,c,S,x,P,N,$,Je,xe,lt,I]),Ct=useMemo(()=>({removePane:Qe,addPane:je,swapPanes:et,splitPane:tt,updateSplitPercentage:it,updateTabMetadata:st,updatePaneLock:at,selectTab:nt,mergeTab:rt,moveTab:ot,removeTab:Ve}),[Qe,je,et,tt,it,st,at,nt,rt,ot,Ve]),zt=useMemo(()=>{let a=[];function u(m){m&&(m.type==="pane"?a.push(...m.tabs):(u(m.first),u(m.second)));}return u(l),a},[l]),$t=useMemo(()=>({registerPortalTarget:F}),[F]);return jsx(Me.Provider,{value:Ct,children:jsx(De.Provider,{value:Mt,children:jsxs(Ce.Provider,{value:$t,children:[jsx(DndContext,{id:"zeugma-dnd-context",sensors:Se,collisionDetection:ge,onDragStart:ce,onDragMove:te,onDragEnd:A,children:B}),D&&q&&n&&jsx(yt,{activeId:D,render:a=>n(a,q),className:`${o.dragOverlay||""} ${D===v?o.dismissPreview||"zeugma-dismiss-preview":""}`.trim()}),jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:zt.map(a=>jsx(jt,{tabId:a,target:G[a]||null,renderWidget:i},a))})]})})})},jt=({tabId:e,target:t,renderWidget:r})=>{let i=useRef(null);!i.current&&typeof window<"u"&&(i.current=document.createElement("div"),i.current.className=`zeugma-portal-wrapper-${e}`,i.current.style.width="100%",i.current.style.height="100%");let n=i.current;return useEffect(()=>{if(n)if(t)t.appendChild(n);else {let o=document.getElementById("zeugma-hidden-portal-container");o||(o=document.createElement("div"),o.id="zeugma-hidden-portal-container",o.style.display="none",document.body.appendChild(o)),o.appendChild(n);}},[t,n]),useEffect(()=>()=>{i.current&&i.current.remove();},[]),!n||!r?null:createPortal(r(e),n)};function Ze({cursor:e,resizerEl:t,onMove:r,onEnd:i}){document.body.classList.add("zeugma-resizing");let n=document.createElement("style");n.id="zeugma-global-cursor-style",n.textContent=`
1
+ import tn,{createContext,useState,useRef,useCallback,useEffect,useMemo,useContext}from'react';import {createPortal}from'react-dom';import {useSensors,useSensor,pointerWithin,closestCenter,DndContext,useDraggable,useDroppable,PointerSensor,TouchSensor}from'@dnd-kit/core';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var ze=createContext(void 0),Ie=createContext(void 0);var ee=()=>{let e=useContext(ze);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},$e=()=>{let e=useContext(Ie);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};function st(e){let t=useRef(null);return useEffect(()=>{if(!e){t.current=null;return}let r=n=>{t.current={x:n.clientX,y:n.clientY};},s=n=>{let o=n.touches[0]||n.changedTouches[0];o&&(t.current={x:o.clientX,y:o.clientY});};return window.addEventListener("pointermove",r,{passive:true}),window.addEventListener("touchmove",s,{passive:true}),()=>{window.removeEventListener("pointermove",r),window.removeEventListener("touchmove",s);}},[e]),t}function it(e){useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function at(){let[e,t]=useState({}),r=useRef(true);useEffect(()=>(r.current=true,()=>{r.current=false;}),[]);let s=useCallback((n,o)=>{setTimeout(()=>{r.current&&t(i=>i[n]===o?i:{...i,[n]:o});},0);},[]);return {portalTargets:e,registerPortalTarget:s}}var ke=createContext(void 0);var Ht=8,At=8,Fn=4;function ie(){return "pane-"+Math.random().toString(36).substring(2,11)}function be(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let r=be(e.first,t),s=be(e.second,t);return r===null?s:s===null?r:{...e,first:r,second:s}}function de(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let n=e.tabs.filter(a=>a!==t);if(n.length===0)return null;let o=e.activeTabId;e.activeTabId===t&&(o=n[0]);let i={...e.tabsMetadata};return delete i[t],{...e,tabs:n,activeTabId:o,tabsMetadata:Object.keys(i).length>0?i:void 0}}return e}let r=de(e.first,t),s=de(e.second,t);return r===null?s:s===null?r:{...e,first:r,second:s}}function ye(e,t,r,s,n){if(e===null)return typeof n=="string"?{type:"pane",id:ie(),tabs:[n],activeTabId:n}:n;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){let o=typeof n=="string"?{type:"pane",id:ie(),tabs:[n],activeTabId:n}:n,i=s==="left"||s==="top";return {type:"split",direction:r,first:i?o:e,second:i?e:o,splitPercentage:50}}return e}return {...e,first:ye(e.first,t,r,s,n)||e.first,second:ye(e.second,t,r,s,n)||e.second}}function lt(e,t){if(e===null)return {type:"pane",id:ie(),tabs:[t],activeTabId:t};function r(s,n){return s.type==="pane"?{type:"split",direction:n==="row"?"column":"row",splitPercentage:50,first:s,second:{type:"pane",id:ie(),tabs:[t],activeTabId:t}}:{...s,second:r(s.second,s.direction)}}return r(e,null)}function ve(e,t,r){return e===null?null:e===t?{...e,splitPercentage:r}:e.type==="split"?{...e,first:ve(e.first,t,r)||e.first,second:ve(e.second,t,r)||e.second}:e}function q(e,t){return e===null?null:e.type==="pane"?e.id===t||e.tabs.includes(t)?e:null:q(e.first,t)??q(e.second,t)}function Ze(e,t,r){if(e===null)return null;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){let s=e.tabsMetadata||{},n=s[t],o=r(n),i={...s};return o===void 0?delete i[t]:i[t]=o,{...e,tabsMetadata:Object.keys(i).length>0?i:void 0}}return e}return {...e,first:Ze(e.first,t,r)??e.first,second:Ze(e.second,t,r)??e.second}}function He(e,t,r){if(e===null)return null;if(e.type==="pane"){if(e.id===t||e.tabs.includes(t)){if(r===false){let{locked:s,...n}=e;return n}return {...e,locked:r}}return e}return {...e,first:He(e.first,t,r)??e.first,second:He(e.second,t,r)??e.second}}function Ae(e,t,r){return e===null?null:e.type==="pane"?e.id===t||e.tabs.includes(t)?{...e,activeTabId:r}:e:{...e,first:Ae(e.first,t,r)??e.first,second:Ae(e.second,t,r)??e.second}}function ct(e,t,r){if(e===null)return null;let n=q(e,t)?.tabsMetadata?.[t],o=de(e,t);if(o===null)return {type:"pane",id:ie(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0};function i(a){if(a.type==="pane"){if(a.id===r||a.tabs.includes(r)){let l=[...a.tabs];l.includes(t)||l.push(t);let y={...a.tabsMetadata};return n&&(y[t]=n),{...a,tabs:l,activeTabId:t,tabsMetadata:Object.keys(y).length>0?y:void 0}}return a}return {...a,first:i(a.first),second:i(a.second)}}return i(o)}function ut(e,t,r,s="before"){if(e===null)return null;let o=q(e,t)?.tabsMetadata?.[t],i=de(e,t);if(i===null)return {type:"pane",id:ie(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(l){if(l.type==="pane"){if(l.id===r||l.tabs.includes(r)){let D=[...l.tabs].filter(x=>x!==t),c=D.indexOf(r);c<0&&(c=0),s==="after"&&(c+=1),D.splice(c,0,t);let T={...l.tabsMetadata};return o&&(T[t]=o),{...l,tabs:D,activeTabId:t,tabsMetadata:Object.keys(T).length>0?T:void 0}}return l}return {...l,first:a(l.first),second:a(l.second)}}return a(i)}function se(e,t=0,r=0,s=100,n=100,o="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:r,width:s,height:n,node:e}],splitters:[]};let{direction:i,splitPercentage:a,first:l,second:y}=e,c={id:`splitter-${o}-${i}`,currentNode:e,direction:i,left:i==="row"?t+s*(a/100):t,top:i==="column"?r+n*(a/100):r,width:i==="row"?0:s,height:i==="column"?0:n,parentLeft:t,parentTop:r,parentWidth:s,parentHeight:n},T={panes:[],splitters:[]},x={panes:[],splitters:[]};if(i==="row"){let v=s*(a/100);T=se(l,t,r,v,n,`${o}-L`),x=se(y,t+v,r,s-v,n,`${o}-R`);}else {let v=n*(a/100);T=se(l,t,r,s,v,`${o}-T`),x=se(y,t,r+v,s,n-v,`${o}-B`);}return {panes:[...T.panes,...x.panes],splitters:[c,...T.splitters,...x.splitters]}}function Ft(e){let{initialLayout:t,onChange:r,fullscreenPaneId:s,onFullscreenChange:n,locked:o=false,dragActivationDistance:i=8,snapThreshold:a=8,minSplitPercentage:l=5,maxSplitPercentage:y=95,enableDragToDismiss:D=false,dismissThreshold:c=60,onRemove:T,onDragStart:x,onDragEnd:v,onResizeStart:R,onResize:E,onResizeEnd:L,onDismissIntentChange:p}=e,[b,f]=useState(t),[z,A]=useState(s||null),[I,V]=useState(o),[w,K]=useState(null),[h,F]=useState(null),[Y,O]=useState(null),m=useRef(null),$=useCallback(u=>{m.current=u;},[]),_=useCallback(u=>{A(u),n?.(u);},[n]);useEffect(()=>{V(o);},[o]),useEffect(()=>{s!==void 0&&A(s);},[s]);let k=useRef(true);useEffect(()=>{if(k.current){k.current=false;return}r?.(b);},[b,r]);let N=useCallback(u=>{f(S=>be(S,u));},[]),d=useCallback(u=>{f(S=>lt(S,u));},[]),B=useCallback((u,S,P,ne)=>{f(Re=>{let Ye=q(Re,ne)??{type:"pane",id:ne,tabs:[ne],activeTabId:ne},Be=be(Re,ne);return ye(Be,u,S,P,Ye)});},[]),ae=useCallback((u,S)=>{f(P=>ve(P,u,S));},[]),W=useCallback((u,S)=>{f(P=>Ze(P,u,S));},[]),te=useCallback((u,S)=>{f(P=>He(P,u,S));},[]),le=useCallback((u,S)=>{f(P=>Ae(P,u,S));},[]),fe=useCallback((u,S)=>{f(P=>ct(P,u,S));},[]),me=useCallback((u,S,P)=>{f(ne=>ut(ne,u,S,P));},[]),j=useCallback(u=>{f(S=>de(S,u));},[]);return {layout:b,setLayout:f,fullscreenPaneId:z,setFullscreenPaneId:_,locked:I,setLocked:V,activeId:w,setActiveId:K,activeType:h,setActiveType:F,dismissIntentId:Y,setDismissIntentId:O,containerRef:m,setContainerRef:$,dragActivationDistance:i,snapThreshold:a,minSplitPercentage:l,maxSplitPercentage:y,enableDragToDismiss:D,dismissThreshold:c,onRemove:T,onDragStart:x,onDragEnd:v,onResizeStart:R,onResize:E,onResizeEnd:L,onDismissIntentChange:p,removePane:N,addPane:d,splitPane:B,updateSplitPercentage:ae,updateTabMetadata:W,updatePaneLock:te,selectTab:le,mergeTab:fe,moveTab:me,removeTab:j}}var Ot=()=>{let e=ee(),t=$e();return {...e,...t}};var pt=({activeId:e,render:t,className:r})=>{let s=useRef(null);return useEffect(()=>{let n=o=>{s.current&&(s.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",n),()=>document.removeEventListener("pointermove",n)},[]),jsx("div",{ref:s,className:r,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var Fe=class extends PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Oe=class extends TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function je(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return {x:e.clientX,y:e.clientY};if(typeof TouchEvent<"u"&&e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t)return {x:t.clientX,y:t.clientY}}return null}var jt=e=>{let{renderPane:t,renderWidget:r,renderDragOverlay:s,classNames:n={},children:o,layout:i,setLayout:a,fullscreenPaneId:l,setFullscreenPaneId:y,locked:D,activeId:c,setActiveId:T,activeType:x,setActiveType:v,dismissIntentId:R,setDismissIntentId:E,containerRef:L,setContainerRef:p,dragActivationDistance:b,snapThreshold:f,minSplitPercentage:z,maxSplitPercentage:A,enableDragToDismiss:I,dismissThreshold:V,onRemove:w,onDragStart:K,onDragEnd:h,onResizeStart:F,onResize:Y,onResizeEnd:O,onDismissIntentChange:m,removePane:$,addPane:_,splitPane:k,updateSplitPercentage:N,updateTabMetadata:d,updatePaneLock:B,selectTab:ae,mergeTab:W,moveTab:te,removeTab:le}=e,{portalTargets:fe,registerPortalTarget:me}=at(),j=useRef(null),u=st(c),[S,P]=useState(false);it(S);let ne=useCallback(g=>t(g),[t]),Re=useMemo(()=>n,[n.pane,n.paneLocked,n.dropPreview,n.dragOverlay,n.resizer,n.dismissPreview,n.dashboardLocked,n.lockedPreview]),Ye=useSensors(useSensor(Fe,{activationConstraint:{distance:b}}),useSensor(Oe,{activationConstraint:{delay:250,tolerance:5}})),Be=useCallback(g=>{let Z=pointerWithin(g);if(Z.length>0)return Z;if(g.active.id.toString().startsWith("tab-header-")){let re=g.droppableContainers.filter(J=>J.id.toString().startsWith("tab-drop-"));return closestCenter({...g,droppableContainers:re})}return []},[]),Dt=g=>{let Z=g.active.id.toString(),U=Z.startsWith("tab-header-"),re=U?Z.substring(11):Z;T(re),v(U?"tab":"pane");let J=g.activatorEvent;u.current=je(J),I&&L.current?j.current=L.current.getBoundingClientRect():j.current=null,K&&K(re);},Et=g=>{let{over:Z}=g,re=(Z?.id.toString()||"").startsWith("drop-locked-");if(P(re),!I)return;let J=g.active.id.toString(),Se=J.startsWith("tab-header-")?J.substring(11):J,M=j.current;if(!M){R!==null&&(E(null),m?.(null));return}let we=g.activatorEvent,oe=null,X=null;if(u.current)oe=u.current.x,X=u.current.y;else {let H=je(we);H&&(oe=H.x+g.delta.x,X=H.y+g.delta.y);}let ce=0;if(oe!==null&&X!==null){let H=0,Q=0;oe<M.left?H=M.left-oe:oe>M.right&&(H=oe-M.right),X<M.top?Q=M.top-X:X>M.bottom&&(Q=X-M.bottom),ce=Math.sqrt(H*H+Q*Q);}else {let H=g.active.rect.current.translated;if(H){let Q=H.left+H.width/2,ge=H.top+H.height/2,ue=0,Pe=0;Q<M.left?ue=M.left-Q:Q>M.right&&(ue=Q-M.right),ge<M.top?Pe=M.top-ge:ge>M.bottom&&(Pe=ge-M.bottom),ce=Math.sqrt(ue*ue+Pe*Pe);}}ce>V?R!==Se&&(E(Se),m?.(Se)):R!==null&&(E(null),m?.(null));},Ct=g=>{T(null),v(null),P(false);let{active:Z,over:U}=g,re=Z.id.toString(),J=re.startsWith("tab-header-"),C=J?re.substring(11):re,Se=I&&R===C;if(E(null),m?.(null),j.current=null,Se){w?w(C):le(C),h&&h(C,null,null);return}if(!U){h&&h(C,null,null);return}let M=U.id.toString();if(M.startsWith("drop-locked-")){h&&h(C,null,null);return}let we=M.match(/^tab-drop-(.+)$/);if(we){let[,Ne]=we;if(C!==Ne){let Ee="before",tt=U.rect,It=g.activatorEvent,Me=null;if(u.current)Me=u.current.x;else {let Le=je(It);Le&&(Me=Le.x+g.delta.x);}if(Me!==null){let Le=tt.left+tt.width/2;Me>Le&&(Ee="after");}te(C,Ne,Ee);}h&&h(C,Ne,{type:"swap",position:"center"});return}let oe=M.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!oe){h&&h(C,null,null);return}let[,X,ce]=oe,De=q(i,C),H=De&&De.id===ce,Q=De&&De.tabs.length===1;if(C===ce||H&&Q){h&&h(C,null,null);return}let ge=X==="left"||X==="right"?"row":"column",ue;if(J){let Ee=q(i,C)?.tabsMetadata?.[C];ue={type:"pane",id:ie(),tabs:[C],activeTabId:C,tabsMetadata:Ee?{[C]:Ee}:void 0};}else ue=q(i,C)??{type:"pane",id:ie(),tabs:[C],activeTabId:C};let Pe=J?de(i,C):be(i,C),zt=ye(Pe,ce,ge,X,ue);a(zt),h&&h(C,ce,{type:"split",direction:ge,position:X});},et=useCallback((g,Z)=>{O&&O(g,Z);},[O]),wt=useMemo(()=>({layout:i,onLayoutChange:g=>a(g),renderPane:ne,activeId:c,dismissIntentId:R,setContainerRef:p,fullscreenPaneId:l,classNames:Re,onRemove:w,onFullscreenChange:y,snapThreshold:f,onResizeStart:F,onResize:Y,onResizeEnd:et,minSplitPercentage:z,maxSplitPercentage:A,locked:D}),[i,c,R,p,l,Re,w,y,f,F,Y,z,A,a,ne,et,D]),Nt=useMemo(()=>({removePane:$,addPane:_,splitPane:k,updateSplitPercentage:N,updateTabMetadata:d,updatePaneLock:B,selectTab:ae,mergeTab:W,moveTab:te,removeTab:le}),[$,_,k,N,d,B,ae,W,te,le]),Mt=useMemo(()=>{let g=[];function Z(U){U&&(U.type==="pane"?g.push(...U.tabs):(Z(U.first),Z(U.second)));}return Z(i),g},[i]),Lt=useMemo(()=>({registerPortalTarget:me}),[me]);return jsx(Ie.Provider,{value:Nt,children:jsx(ze.Provider,{value:wt,children:jsxs(ke.Provider,{value:Lt,children:[jsx(DndContext,{id:"zeugma-dnd-context",sensors:Ye,collisionDetection:Be,onDragStart:Dt,onDragMove:Et,onDragEnd:Ct,children:o}),c&&x&&s&&jsx(pt,{activeId:c,render:g=>s(g,x),className:`${n.dragOverlay||""} ${c===R?n.dismissPreview||"zeugma-dismiss-preview":""}`.trim()}),jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Mt.map(g=>jsx(Jt,{tabId:g,target:fe[g]||null,renderWidget:r},g))})]})})})},Jt=({tabId:e,target:t,renderWidget:r})=>{let[s,n]=useState(false),o=useRef(null);if(useEffect(()=>{n(true);},[]),useEffect(()=>{if(!s||!o.current)return;let a=o.current;if(t)t.appendChild(a);else {let l=document.getElementById("zeugma-hidden-portal-container");l||(l=document.createElement("div"),l.id="zeugma-hidden-portal-container",l.style.display="none",document.body.appendChild(l)),l.appendChild(a);}},[t,s]),useEffect(()=>()=>{o.current&&o.current.remove();},[]),!s)return null;o.current||(o.current=document.createElement("div"),o.current.className=`zeugma-portal-wrapper-${e}`,o.current.style.width="100%",o.current.style.height="100%");let i=o.current;return !i||!r?null:createPortal(r(e),i)};function Ve({cursor:e,resizerEl:t,onMove:r,onEnd:s}){document.body.classList.add("zeugma-resizing");let n=document.createElement("style");n.id="zeugma-global-cursor-style",n.textContent=`
2
2
  * {
3
3
  cursor: ${e} !important;
4
4
  user-select: none !important;
5
5
  }
6
- `,document.head.appendChild(n),t.setAttribute("data-resizing","true");let o=c=>{r(c);},s=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let c=document.getElementById("zeugma-global-cursor-style");c&&c.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",s),i();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",s);}function Xe({containerRef:e,isRow:t,direction:r,splitPercentage:i,resizerSize:n,snapThreshold:o,layout:s,currentNode:c,onLayoutChange:d,onResizeStart:T,onResizeEnd:S,parentLeft:g,parentTop:p,parentWidth:x,parentHeight:P}){let{onResizeStart:E,onResize:N,onResizeEnd:$,minSplitPercentage:b=5,maxSplitPercentage:y=95,locked:R=false}=Q();return useCallback(I=>{if(R)return;I.preventDefault();let B=e.current;if(!B)return;T&&T(),E&&E(c);let l=B.getBoundingClientRect(),w=I.clientX,k=I.clientY,ee=i,D=I.currentTarget,V=l.left+l.width*(g/100),q=l.top+l.height*(p/100),Y=l.width*(x/100),v=l.height*(P/100),G=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(M=>M!==D&&M.getAttribute("data-direction")===r).map(M=>{let f=M.getBoundingClientRect();return t?f.left+f.width/2:f.top+f.height/2}),F=ee;Ze({cursor:t?"col-resize":"row-resize",resizerEl:D,onMove:M=>{let f=t?(M.clientX-w)/Y*100:(M.clientY-k)/v*100,O=ee+f,me=t?V+(Y-n)*(O/100)+n/2:q+(v-n)*(O/100)+n/2,U=1/0,le=null;for(let ge of G){let ce=Math.abs(me-ge);ce<o&&ce<U&&(U=ce,le=ge);}let xe=O;le!==null&&(xe=t?(le-n/2-V)/(Y-n)*100:(le-n/2-q)/(v-n)*100);let be=Math.max(b,Math.min(y,xe));F=be;let Se=pe(s,c,be);if(Se){let{panes:ge,splitters:ce}=j(Se),te=e.current;if(te){for(let A of ge)te.style.setProperty(`--pane-left-${A.paneId}`,`${A.left}%`),te.style.setProperty(`--pane-top-${A.paneId}`,`${A.top}%`),te.style.setProperty(`--pane-width-${A.paneId}`,`${A.width}%`),te.style.setProperty(`--pane-height-${A.paneId}`,`${A.height}%`);for(let A of ce)te.style.setProperty(`--splitter-pos-${A.id}`,`${A.direction==="row"?A.left:A.top}%`);}}N&&N(c,be);},onEnd:()=>{let M=pe(s,c,F),f=e.current;if(f){let{panes:O,splitters:me}=j(M);for(let U of O)f.style.removeProperty(`--pane-left-${U.paneId}`),f.style.removeProperty(`--pane-top-${U.paneId}`),f.style.removeProperty(`--pane-width-${U.paneId}`),f.style.removeProperty(`--pane-height-${U.paneId}`);for(let U of me)f.style.removeProperty(`--splitter-pos-${U.id}`);}d(M),S&&S(),$&&$(c,F);}});},[e,t,r,i,n,o,s,c,d,T,S,E,N,$,b,y,g,p,x,P])}var an=({splitter:e,resizerSize:t,snapThreshold:r,containerRef:i})=>{let{layout:n,onLayoutChange:o,classNames:s,locked:c}=Q(),[d,T]=useState(false),{currentNode:S,direction:g,left:p,top:x,width:P,height:E,parentLeft:N,parentTop:$,parentWidth:b,parentHeight:y}=e,R=g==="row",I=Xe({containerRef:i,isRow:R,direction:g,splitPercentage:S.splitPercentage,resizerSize:t,snapThreshold:r,layout:n,currentNode:S,onLayoutChange:o,onResizeStart:()=>T(true),onResizeEnd:()=>T(false),parentLeft:N,parentTop:$,parentWidth:b,parentHeight:y}),B=R?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${p}%) - ${t/2}px)`,top:`calc(${x}% + ${t/2}px)`,width:`${t}px`,height:`calc(${E}% - ${t}px)`,cursor:c?"default":"col-resize",pointerEvents:c?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${p}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${x}%) - ${t/2}px)`,width:`calc(${P}% - ${t}px)`,height:`${t}px`,cursor:c?"default":"row-resize",pointerEvents:c?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsx("div",{className:`zeugma-resizer ${s.resizer||""}`.trim(),"data-direction":g,"data-resizing":d||void 0,style:B,onPointerDown:I,role:"separator","aria-valuenow":S.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},ln=nn.memo(({paneId:e,renderPane:t})=>jsx(Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),cn=({tree:e,resizerSize:t=4,snapThreshold:r})=>{let{layout:i,renderPane:n,activeId:o,dismissIntentId:s,setContainerRef:c,fullscreenPaneId:d,snapThreshold:T,locked:S,classNames:g}=Q(),p=r!==void 0?r:T??8,x=e!==void 0?e:i,P=useRef(null),{panes:E,splitters:N}=useMemo(()=>x?j(x):{panes:[],splitters:[]},[x]);if(!x)return null;let $=()=>jsxs(Fragment,{children:[E.map(b=>{let y=d===b.paneId;return jsx("div",{style:{position:"absolute",left:y?"0%":`var(--pane-left-${b.paneId}, ${b.left}%)`,top:y?"0%":`var(--pane-top-${b.paneId}, ${b.top}%)`,width:y?"100%":`var(--pane-width-${b.paneId}, ${b.width}%)`,height:y?"100%":`var(--pane-height-${b.paneId}, ${b.height}%)`,overflow:"hidden",zIndex:y?20:1,display:d&&!y?"none":"block",padding:y?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsx(ln,{paneId:b.paneId,renderPane:n})},b.paneId)}),!d&&N.map(b=>jsx(an,{splitter:b,resizerSize:t,snapThreshold:p,containerRef:P},b.id))]});if(e===void 0){let b=o!==null&&o===s,y=I=>{c(I),P.current=I;},R=`zeugma-dashboard-root ${b?"zeugma-dashboard-dismiss-active":""} ${S?g.dashboardLocked||"zeugma-dashboard-locked":""}`.trim();return jsx("div",{ref:y,className:R,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:$()})}return jsx("div",{ref:P,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:$()})};var Lt="zeugma-height:",fn="default-pane";function mn(e){try{let t=localStorage.getItem(Lt+e);if(t!==null){let r=Number(t);if(Number.isFinite(r)&&r>0)return r}}catch{}return null}function Et(e,t){try{localStorage.setItem(Lt+e,String(Math.round(t)));}catch{}}var Nt=({children:e,active:t=true,height:r,onHeightChange:i,minHeight:n=100,maxHeight:o=1/0,persist:s,localStorageKey:c,resizerHeight:d=6,className:T,resizerClassName:S})=>{let g=s?c||fn:null,p=()=>{let R=(g?mn(g):null)??r??400;return Ae(R,n,o)},[x,P]=useState(p),E=useRef(null),N=g?x:r??x,$=useRef(r);useEffect(()=>{if(r!==void 0&&r!==$.current){let R=Ae(r,n,o);P(R),g&&Et(g,R);}$.current=r;},[r,n,o,g]);let b=useCallback(()=>o,[o]),y=useCallback(R=>{R.preventDefault();let I=R.clientY,B=N,l=b(),w=R.currentTarget,k=Dt(E.current),ee=k?k.scrollTop:0,D=I,V=null,q=(v,H)=>{let G=H-ee,M=v-I+G,f=Ae(B+M,n,l);return E.current&&(E.current.style.height=`${f}px`),f},Y=()=>{if(!k)return;let v=k===document.documentElement||k===document.body?{top:0,bottom:window.innerHeight}:k.getBoundingClientRect(),H=40,G=10,F=0;D>v.bottom-H?F=Math.min(1,(D-(v.bottom-H))/H)*G:D<v.top+H&&(F=-Math.min(1,(v.top+H-D)/H)*G),F!==0&&(k.scrollTop+=F,q(D,k.scrollTop)),V=requestAnimationFrame(Y);};V=requestAnimationFrame(Y),Ze({cursor:"row-resize",resizerEl:w,onMove:v=>{D=v.clientY,k&&q(D,k.scrollTop);},onEnd:()=>{V!==null&&cancelAnimationFrame(V);let v=B;E.current&&(v=E.current.getBoundingClientRect().height),v=Ae(v,n,l),P(v),i&&i(v),g&&Et(g,v);}});},[N,n,b,i,g]);return t?jsxs("div",{ref:E,className:`zeugma-resizable-container ${T||""}`.trim(),style:{height:`${N}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsx("div",{style:{height:`calc(100% - ${d}px)`,overflow:"hidden"},children:e}),jsx("div",{className:`zeugma-resizable-handle ${S||""}`.trim(),style:{height:`${d}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:y,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(N),"aria-valuemin":n,"aria-valuemax":o===1/0?void 0:o})]}):jsx("div",{className:`zeugma-resizable-container disabled ${T||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ae(e,t,r){return Math.max(t,Math.min(r,e))}function Dt(e){if(typeof window>"u"||!e)return null;let t=e.parentElement;if(!t)return document.documentElement;let i=window.getComputedStyle(t).overflowY;return i==="auto"||i==="scroll"?t:Dt(t)}var Oe=createContext(null);var Tn={top:{position:"absolute",top:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},center:{position:"absolute",top:"25%",left:"25%",width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},wn={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},center:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},Ge=({id:e,position:t,activeClassName:r})=>{let{setNodeRef:i,isOver:n}=useDroppable({id:e});return jsxs(Fragment,{children:[jsx("div",{ref:i,style:Tn[t]}),n&&jsx("div",{className:r,style:wn[t]})]})},Rn=({id:e,children:t,style:r,locked:i=false})=>{let{layout:n,activeId:o,classNames:s,fullscreenPaneId:c,onFullscreenChange:d,locked:T}=Q(),{removePane:S,updateTabMetadata:g,selectTab:p,removeTab:x}=We(),P=useContext(Ce);if(!P)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:E}=P,N=useMemo(()=>_(n,e),[n,e]),$=N?.id??e,b=N?.tabs??[e],y=N?.activeTabId??e,R=N?.tabsMetadata,I=R?.[e],B=N?.locked??false,l=i||B,w=T||l,k=T||l,ee=o!==null&&o!==e&&(!b.includes(o)||b.length>1)&&!k,{attributes:D,listeners:V,setNodeRef:q}=useDraggable({id:e,disabled:w}),Y=o!==null&&b.includes(o),v=c===e,H=useCallback(()=>jsx("div",{id:`zeugma-tab-target-${y}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[y]);useEffect(()=>{let f=document.getElementById(`zeugma-tab-target-${y}`);return E(y,f),()=>{E(y,null);}},[y,E]);let G=useMemo(()=>({isDragging:Y,isFullscreen:v,toggleFullscreen:()=>d?.(v?null:e),remove:()=>{v&&d?.(null),S($);},metadata:I,updateMetadata:f=>{g(e,f);},locked:w,tabs:b,activeTabId:y,selectTab:f=>p($,f),removeTab:f=>{v&&f===y&&d?.(null),x(f);},tabsMetadata:R,updateTabMetadata:(f,O)=>{g(f,O);},renderActiveTab:H}),[Y,v,d,e,x,I,g,w,b,y,p,$,R,H]),F=useMemo(()=>w?{disabled:true}:{...V,...D},[V,D,w]),M=`${s.pane||""} ${l?s.paneLocked||"zeugma-pane-locked":""}`.trim();return jsx(Oe.Provider,{value:F,children:jsxs("div",{ref:q,className:M,style:{position:"relative",width:"100%",height:"100%",...r},children:[t(G),ee&&jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:[["top","bottom","left","right"].map(f=>jsx(Ge,{id:`drop-${f}-${e}`,position:f,activeClassName:s.dropPreview},f)),!b.includes(o)&&jsx(Ge,{id:`drop-center-${e}`,position:"center",activeClassName:s.swapPreview})]}),o!==null&&o!==e&&k&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsx(Ge,{id:`drop-locked-${e}`,position:"full",activeClassName:s.lockedPreview||"zeugma-locked-preview"})})]})})};var Ln=({children:e,className:t,style:r})=>{let i=useContext(Oe);if(!i)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:n,...o}=i;return jsx("div",{className:t,style:{cursor:n?"default":"grab",userSelect:n?"auto":"none",touchAction:n?"auto":"none",...r},...n?{}:o,children:e})};var Cn=({id:e,locked:t=false,children:r,className:i,style:n})=>{let{locked:o}=Q(),s=t||o,{attributes:c,listeners:d,setNodeRef:T,isDragging:S}=useDraggable({id:`tab-header-${e}`,disabled:s}),{setNodeRef:g,isOver:p}=useDroppable({id:`tab-drop-${e}`,disabled:s});return jsx("div",{ref:P=>{T(P),g(P);},className:i,style:{display:"inline-flex",cursor:s?"default":"grab",...n},...s?{}:d,...s?{}:c,children:r({isDragging:S,isOver:p})})};export{Vt as DEFAULT_DRAG_ACTIVATION_DISTANCE,Vn as DEFAULT_RESIZER_SIZE,Ot as DEFAULT_SNAP_THRESHOLD,Ln as DragHandle,Rn as Pane,cn as PaneTree,Nt as ResizableContainer,Cn as Tab,Qt as Zeugma,ht as addPane,j as computeLayout,Ze as createDragSession,_ as findPane,Pt as mergeTab,Ye as moveTab,he as removePane,de as removeTab,Ie as selectTab,we as splitPane,_e as swapPanes,$e as updatePaneLock,pe as updateSplitPercentage,ze as updateTabMetadata,Xe as useResizer,We as useZeugmaActions,Q as useZeugmaState};//# sourceMappingURL=index.js.map
6
+ `,document.head.appendChild(n),t.setAttribute("data-resizing","true");let o=a=>{r(a);},i=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let a=document.getElementById("zeugma-global-cursor-style");a&&a.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",i),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",i);}function Je({containerRef:e,isRow:t,direction:r,splitPercentage:s,resizerSize:n,snapThreshold:o,layout:i,currentNode:a,onLayoutChange:l,onResizeStart:y,onResizeEnd:D,parentLeft:c,parentTop:T,parentWidth:x,parentHeight:v}){let{onResizeStart:R,onResize:E,onResizeEnd:L,minSplitPercentage:p=5,maxSplitPercentage:b=95,locked:f=false}=ee();return useCallback(z=>{if(f)return;z.preventDefault();let A=e.current;if(!A)return;y&&y(),R&&R(a);let I=A.getBoundingClientRect(),V=z.clientX,w=z.clientY,K=s,h=z.currentTarget,F=I.left+I.width*(c/100),Y=I.top+I.height*(T/100),O=I.width*(x/100),m=I.height*(v/100),_=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(N=>N!==h&&N.getAttribute("data-direction")===r).map(N=>{let d=N.getBoundingClientRect();return t?d.left+d.width/2:d.top+d.height/2}),k=K;Ve({cursor:t?"col-resize":"row-resize",resizerEl:h,onMove:N=>{let d=t?(N.clientX-V)/O*100:(N.clientY-w)/m*100,B=K+d,ae=t?F+(O-n)*(B/100)+n/2:Y+(m-n)*(B/100)+n/2,W=1/0,te=null;for(let j of _){let u=Math.abs(ae-j);u<o&&u<W&&(W=u,te=j);}let le=B;te!==null&&(le=t?(te-n/2-F)/(O-n)*100:(te-n/2-Y)/(m-n)*100);let fe=Math.max(p,Math.min(b,le));k=fe;let me=ve(i,a,fe);if(me){let{panes:j,splitters:u}=se(me),S=e.current;if(S){for(let P of j)S.style.setProperty(`--pane-left-${P.paneId}`,`${P.left}%`),S.style.setProperty(`--pane-top-${P.paneId}`,`${P.top}%`),S.style.setProperty(`--pane-width-${P.paneId}`,`${P.width}%`),S.style.setProperty(`--pane-height-${P.paneId}`,`${P.height}%`);for(let P of u)S.style.setProperty(`--splitter-pos-${P.id}`,`${P.direction==="row"?P.left:P.top}%`);}}E&&E(a,fe);},onEnd:()=>{let N=ve(i,a,k),d=e.current;if(d){let{panes:B,splitters:ae}=se(N);for(let W of B)d.style.removeProperty(`--pane-left-${W.paneId}`),d.style.removeProperty(`--pane-top-${W.paneId}`),d.style.removeProperty(`--pane-width-${W.paneId}`),d.style.removeProperty(`--pane-height-${W.paneId}`);for(let W of ae)d.style.removeProperty(`--splitter-pos-${W.id}`);}l(N),D&&D(),L&&L(a,k);}});},[e,t,r,s,n,o,i,a,l,y,D,R,E,L,p,b,c,T,x,v])}var sn=({splitter:e,resizerSize:t,snapThreshold:r,containerRef:s})=>{let{layout:n,onLayoutChange:o,classNames:i,locked:a}=ee(),[l,y]=useState(false),{currentNode:D,direction:c,left:T,top:x,width:v,height:R,parentLeft:E,parentTop:L,parentWidth:p,parentHeight:b}=e,f=c==="row",z=Je({containerRef:s,isRow:f,direction:c,splitPercentage:D.splitPercentage,resizerSize:t,snapThreshold:r,layout:n,currentNode:D,onLayoutChange:o,onResizeStart:()=>y(true),onResizeEnd:()=>y(false),parentLeft:E,parentTop:L,parentWidth:p,parentHeight:b}),A=f?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${T}%) - ${t/2}px)`,top:`calc(${x}% + ${t/2}px)`,width:`${t}px`,height:`calc(${R}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${T}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${x}%) - ${t/2}px)`,width:`calc(${v}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsx("div",{className:`zeugma-resizer ${i.resizer||""}`.trim(),"data-direction":c,"data-resizing":l||void 0,style:A,onPointerDown:z,role:"separator","aria-valuenow":D.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},an=tn.memo(({paneId:e,renderPane:t})=>jsx(Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),ln=({tree:e,resizerSize:t=4,snapThreshold:r})=>{let{layout:s,renderPane:n,activeId:o,dismissIntentId:i,setContainerRef:a,fullscreenPaneId:l,snapThreshold:y,locked:D,classNames:c}=ee(),T=r!==void 0?r:y??8,x=e!==void 0?e:s,v=useRef(null),{panes:R,splitters:E}=useMemo(()=>x?se(x):{panes:[],splitters:[]},[x]);if(!x)return null;let L=()=>jsxs(Fragment,{children:[R.map(p=>{let b=l===p.paneId;return jsx("div",{style:{position:"absolute",left:b?"0%":`var(--pane-left-${p.paneId}, ${p.left}%)`,top:b?"0%":`var(--pane-top-${p.paneId}, ${p.top}%)`,width:b?"100%":`var(--pane-width-${p.paneId}, ${p.width}%)`,height:b?"100%":`var(--pane-height-${p.paneId}, ${p.height}%)`,overflow:"hidden",zIndex:b?20:1,display:l&&!b?"none":"block",padding:b?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsx(an,{paneId:p.paneId,renderPane:n})},p.paneId)}),!l&&E.map(p=>jsx(sn,{splitter:p,resizerSize:t,snapThreshold:T,containerRef:v},p.id))]});if(e===void 0){let p=o!==null&&o===i,b=z=>{a(z),v.current=z;},f=`zeugma-dashboard-root ${p?"zeugma-dashboard-dismiss-active":""} ${D?c.dashboardLocked||"zeugma-dashboard-locked":""}`.trim();return jsx("div",{ref:b,className:f,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:L()})}return jsx("div",{ref:v,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:L()})};var yt="zeugma-height:",pn="default-pane";function fn(e){try{let t=localStorage.getItem(yt+e);if(t!==null){let r=Number(t);if(Number.isFinite(r)&&r>0)return r}}catch{}return null}function Pt(e,t){try{localStorage.setItem(yt+e,String(Math.round(t)));}catch{}}var xt=({children:e,active:t=true,height:r,onHeightChange:s,minHeight:n=100,maxHeight:o=1/0,persist:i,localStorageKey:a,resizerHeight:l=6,className:y,resizerClassName:D})=>{let c=i?a||pn:null,T=()=>{let f=(c?fn(c):null)??r??400;return We(f,n,o)},[x,v]=useState(T),R=useRef(null),E=c?x:r??x,L=useRef(r);useEffect(()=>{if(r!==void 0&&r!==L.current){let f=We(r,n,o);v(f),c&&Pt(c,f);}L.current=r;},[r,n,o,c]);let p=useCallback(()=>o,[o]),b=useCallback(f=>{f.preventDefault();let z=f.clientY,A=E,I=p(),V=f.currentTarget,w=Tt(R.current),K=w?w.scrollTop:0,h=z,F=null,Y=(m,$)=>{let _=$-K,N=m-z+_,d=We(A+N,n,I);return R.current&&(R.current.style.height=`${d}px`),d},O=()=>{if(!w)return;let m=w===document.documentElement||w===document.body?{top:0,bottom:window.innerHeight}:w.getBoundingClientRect(),$=40,_=10,k=0;h>m.bottom-$?k=Math.min(1,(h-(m.bottom-$))/$)*_:h<m.top+$&&(k=-Math.min(1,(m.top+$-h)/$)*_),k!==0&&(w.scrollTop+=k,Y(h,w.scrollTop)),F=requestAnimationFrame(O);};F=requestAnimationFrame(O),Ve({cursor:"row-resize",resizerEl:V,onMove:m=>{h=m.clientY,w&&Y(h,w.scrollTop);},onEnd:()=>{F!==null&&cancelAnimationFrame(F);let m=A;R.current&&(m=R.current.getBoundingClientRect().height),m=We(m,n,I),v(m),s&&s(m),c&&Pt(c,m);}});},[E,n,p,s,c]);return t?jsxs("div",{ref:R,className:`zeugma-resizable-container ${y||""}`.trim(),style:{height:`${E}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsx("div",{style:{height:`calc(100% - ${l}px)`,overflow:"hidden"},children:e}),jsx("div",{className:`zeugma-resizable-handle ${D||""}`.trim(),style:{height:`${l}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:b,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(E),"aria-valuemin":n,"aria-valuemax":o===1/0?void 0:o})]}):jsx("div",{className:`zeugma-resizable-container disabled ${y||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function We(e,t,r){return Math.max(t,Math.min(r,e))}function Tt(e){if(typeof window>"u"||!e)return null;let t=e.parentElement;if(!t)return document.documentElement;let s=window.getComputedStyle(t).overflowY;return s==="auto"||s==="scroll"?t:Tt(t)}var _e=createContext(null);var xn={top:{position:"absolute",top:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:"25%",width:"50%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"25%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},Tn={top:{position:"absolute",top:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},bottom:{position:"absolute",bottom:0,left:0,right:0,height:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},left:{position:"absolute",top:0,bottom:0,left:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},right:{position:"absolute",top:0,bottom:0,right:0,width:"50%",zIndex:21,pointerEvents:"none",boxSizing:"border-box"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:21,pointerEvents:"none",boxSizing:"border-box"}},Rt=({id:e,position:t,activeClassName:r})=>{let{setNodeRef:s,isOver:n}=useDroppable({id:e});return jsxs(Fragment,{children:[jsx("div",{ref:s,style:xn[t]}),n&&jsx("div",{className:r,style:Tn[t]})]})},Rn=({id:e,children:t,style:r,locked:s=false})=>{let{layout:n,activeId:o,classNames:i,fullscreenPaneId:a,onFullscreenChange:l,locked:y}=ee(),{removePane:D,updateTabMetadata:c,selectTab:T,removeTab:x}=$e(),v=useContext(ke);if(!v)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:R}=v,E=useMemo(()=>q(n,e),[n,e]),L=E?.id??e,p=E?.tabs??[e],b=E?.activeTabId??e,f=E?.tabsMetadata,z=f?.[e],A=E?.locked??false,I=s||A,V=y||I,w=y||I,K=o!==null&&o!==e&&(!p.includes(o)||p.length>1)&&!w,{attributes:h,listeners:F,setNodeRef:Y}=useDraggable({id:e,disabled:V}),O=o!==null&&p.includes(o),m=a===e,$=useCallback(()=>jsx("div",{id:`zeugma-tab-target-${b}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[b]);useEffect(()=>{let d=document.getElementById(`zeugma-tab-target-${b}`);return R(b,d),()=>{R(b,null);}},[b,R]);let _=useMemo(()=>({isDragging:O,isFullscreen:m,toggleFullscreen:()=>l?.(m?null:e),remove:()=>{m&&l?.(null),D(L);},metadata:z,updateMetadata:d=>{c(e,d);},locked:V,tabs:p,activeTabId:b,selectTab:d=>T(L,d),removeTab:d=>{m&&d===b&&l?.(null),x(d);},tabsMetadata:f,updateTabMetadata:(d,B)=>{c(d,B);},renderActiveTab:$}),[O,m,l,e,x,z,c,V,p,b,T,L,f,$]),k=useMemo(()=>V?{disabled:true}:{...F,...h},[F,h,V]),N=`${i.pane||""} ${I?i.paneLocked||"zeugma-pane-locked":""}`.trim();return jsx(_e.Provider,{value:k,children:jsxs("div",{ref:Y,className:N,style:{position:"relative",width:"100%",height:"100%",...r},children:[t(_),K&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(d=>jsx(Rt,{id:`drop-${d}-${e}`,position:d,activeClassName:i.dropPreview},d))}),o!==null&&o!==e&&w&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsx(Rt,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||"zeugma-locked-preview"})})]})})};var En=({children:e,className:t,style:r})=>{let s=useContext(_e);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:n,...o}=s;return jsx("div",{className:t,style:{cursor:n?"default":"grab",userSelect:n?"auto":"none",touchAction:n?"auto":"none",...r},...n?{}:o,children:e})};var Mn=({id:e,locked:t=false,children:r,className:s,style:n})=>{let{locked:o}=ee(),i=t||o,{attributes:a,listeners:l,setNodeRef:y,isDragging:D}=useDraggable({id:`tab-header-${e}`,disabled:i}),{setNodeRef:c,isOver:T}=useDroppable({id:`tab-drop-${e}`,disabled:i});return jsx("div",{ref:v=>{y(v),c(v);},className:s,style:{display:"inline-flex",cursor:i?"default":"grab",...n},...i?{}:l,...i?{}:a,children:r({isDragging:D,isOver:T})})};export{At as DEFAULT_DRAG_ACTIVATION_DISTANCE,Fn as DEFAULT_RESIZER_SIZE,Ht as DEFAULT_SNAP_THRESHOLD,En as DragHandle,Rn as Pane,ln as PaneTree,xt as ResizableContainer,Mn as Tab,jt as Zeugma,lt as addPane,se as computeLayout,Ve as createDragSession,q as findPane,ie as generateUniqueId,ct as mergeTab,ut as moveTab,be as removePane,de as removeTab,Ae as selectTab,ye as splitPane,He as updatePaneLock,ve as updateSplitPercentage,Ze as updateTabMetadata,Je as useResizer,Ft as useZeugma,Ot as useZeugmaContext};//# sourceMappingURL=index.js.map
7
7
  //# sourceMappingURL=index.js.map