react-zeugma 5.0.0 → 5.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,303 +1,12 @@
1
+ import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as ZeugmaInternalStateValue, b as ZeugmaStateValue, U as UseZeugmaOptions, c as ZeugmaController, d as ZeugmaContextValue, e as ZeugmaProps, S as SplitDirection, T as TreeNode, f as SplitNode } from './types-CaiXD2pG.cjs';
2
+ export { g as PaneNode, h as TabDetails, i as ZeugmaClassNames, j as ZeugmaInternalController } from './types-CaiXD2pG.cjs';
1
3
  import * as React from 'react';
2
- import React__default, { Dispatch, SetStateAction, ReactNode, RefObject } from 'react';
4
+ import React__default, { ReactNode } from 'react';
3
5
 
4
6
  declare const DEFAULT_SNAP_THRESHOLD = 8;
5
7
  declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
6
8
  declare const DEFAULT_RESIZER_SIZE = 4;
7
9
 
8
- type SplitDirection = 'row' | 'column';
9
- interface SplitNode {
10
- type: 'split';
11
- direction: SplitDirection;
12
- first: TreeNode;
13
- second: TreeNode;
14
- splitPercentage: number;
15
- }
16
- interface PaneNode {
17
- type: 'pane';
18
- id: string;
19
- tabs: string[];
20
- activeTabId: string;
21
- locked?: boolean;
22
- tabsMetadata?: Record<string, Record<string, unknown>>;
23
- }
24
- type TreeNode = SplitNode | PaneNode;
25
- interface UseZeugmaOptions {
26
- /** Initial layout tree model defining pane organization for uncontrolled mode. Only used on initial mount. */
27
- initialLayout?: TreeNode | null;
28
- /** Controlled layout tree model. If provided, the hook will run in controlled mode and sync with this value. */
29
- layout?: TreeNode | null;
30
- /** Callback triggered when the layout changes via drag-and-drop actions, splits, moves, or resizes. */
31
- onChange?: (newLayout: TreeNode | null) => void;
32
- /** The ID of the pane that is currently taking up the full dashboard area. Null if no pane is fullscreen. */
33
- fullscreenPaneId?: string | null;
34
- /** Callback triggered when a pane is toggled to/from fullscreen mode. Passes the active fullscreen paneId or null. */
35
- onFullscreenChange?: (paneId: string | null) => void;
36
- /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
37
- locked?: boolean;
38
- /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
39
- dragActivationDistance?: number;
40
- /** Threshold value in pixels for snapping layout resizing handles to adjacent edges. Defaults to 8. */
41
- snapThreshold?: number;
42
- /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
43
- minSplitPercentage?: number;
44
- /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
45
- maxSplitPercentage?: number;
46
- /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
47
- enableDragToDismiss?: boolean;
48
- /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. Defaults to 60. */
49
- dismissThreshold?: number;
50
- /** Callback triggered when a pane is removed from the dashboard layout tree. */
51
- onRemove?: (paneId: string) => void;
52
- /** Callback triggered when dragging starts for a pane. */
53
- onDragStart?: (activeId: string) => void;
54
- /** Callback triggered when dragging ends, providing details on target pane and drop action (split or move). */
55
- onDragEnd?: (activeId: string, overId: string | null, dropAction: {
56
- type: 'split' | 'move';
57
- direction?: SplitDirection;
58
- position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
59
- } | null) => void;
60
- /** Callback triggered when the user starts dragging a resizing handle between split panes. */
61
- onResizeStart?: (currentNode: SplitNode) => void;
62
- /** Callback triggered continuously while the user is dragging a resizing handle. Passes the new split percentage. */
63
- onResize?: (currentNode: SplitNode, percentage: number) => void;
64
- /** Callback triggered when the user stops dragging a resizing handle. Passes the final split percentage. */
65
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
66
- /** Callback triggered when the drag-out/dismiss intent changes. */
67
- onDismissIntentChange?: (paneId: string | null) => void;
68
- }
69
- interface ZeugmaController {
70
- /** The current active layout tree structure, or null if empty. */
71
- layout: TreeNode | null;
72
- /** Updates the layout tree. */
73
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
74
- /** The ID of the pane currently zoomed to fullscreen, or null. */
75
- fullscreenPaneId: string | null;
76
- /** Programmatically sets the fullscreen pane ID. */
77
- setFullscreenPaneId: (paneId: string | null) => void;
78
- /** Whether the layout is globally locked. */
79
- locked: boolean;
80
- /** Programmatically updates the global locked status. */
81
- setLocked: Dispatch<SetStateAction<boolean>>;
82
- /** Removes the specified pane from the layout tree and collapses its parent split. */
83
- removePane: (paneId: string) => void;
84
- /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
85
- addPane: (paneId: string) => void;
86
- /** Stable callback to update metadata for a specific tab. */
87
- updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
88
- /** Stable callback to update the locked status of a specific pane in the layout tree. */
89
- updatePaneLock: (paneId: string, locked: boolean) => void;
90
- /** Stable callback to activate a tab within a pane. */
91
- selectTab: (paneId: string, tabId: string) => void;
92
- /** Stable callback to merge a dragged tab/pane into another pane's tab list. */
93
- mergeTab: (draggedTabId: string, targetPaneId: string) => void;
94
- /** Stable callback to remove/close a specific tab from the layout. */
95
- removeTab: (tabId: string) => void;
96
- }
97
- /** @internal */
98
- interface ZeugmaInternalController extends ZeugmaController {
99
- activeId: string | null;
100
- setActiveId: Dispatch<SetStateAction<string | null>>;
101
- activeType: 'pane' | 'tab' | null;
102
- setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
103
- dismissIntentId: string | null;
104
- setDismissIntentId: Dispatch<SetStateAction<string | null>>;
105
- containerRef: RefObject<HTMLElement | null>;
106
- setContainerRef: (element: HTMLElement | null) => void;
107
- dragActivationDistance: number;
108
- snapThreshold: number;
109
- minSplitPercentage: number;
110
- maxSplitPercentage: number;
111
- enableDragToDismiss: boolean;
112
- dismissThreshold: number;
113
- onRemove?: (paneId: string) => void;
114
- onDragStart?: (activeId: string) => void;
115
- onDragEnd?: (activeId: string, overId: string | null, dropAction: {
116
- type: 'split' | 'move';
117
- direction?: SplitDirection;
118
- position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
119
- } | null) => void;
120
- onResizeStart?: (currentNode: SplitNode) => void;
121
- onResize?: (currentNode: SplitNode, percentage: number) => void;
122
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
123
- onDismissIntentChange?: (paneId: string | null) => void;
124
- splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
125
- updateSplitPercentage: (currentNode: SplitNode, percentage: number) => void;
126
- moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
127
- }
128
- interface ZeugmaClassNames {
129
- /** CSS class applied to the root dashboard container. */
130
- dashboard?: string;
131
- /** CSS class applied to the root dashboard container when a drag-out dismiss is active. */
132
- dashboardDismissActive?: string;
133
- /** CSS class applied to the outer container div of each `<Pane>`. */
134
- pane?: string;
135
- /** CSS class applied to the pane container when locked. */
136
- paneLocked?: string;
137
- /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
138
- dropPreview?: string;
139
- /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
140
- dragOverlay?: string;
141
- /** CSS class applied to the drag-to-resize split bar handles. */
142
- resizer?: string;
143
- /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
144
- dismissPreview?: string;
145
- /** CSS class applied to root container when dashboard is globally locked. */
146
- dashboardLocked?: string;
147
- /** CSS class applied to drop zone indicator when hovering over a locked pane. */
148
- lockedPreview?: string;
149
- /** CSS class applied to tab container when dragging a tab over it. */
150
- tabDropPreview?: string;
151
- }
152
- interface ZeugmaProps extends ZeugmaController {
153
- /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
154
- renderPane: (paneId: string) => ReactNode;
155
- /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
156
- renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
157
- /** Optional CSS class name mapping overrides for custom styles of components like panes, drop previews, overlays, etc. */
158
- classNames?: ZeugmaClassNames;
159
- /** Render function mapping tab IDs to React elements. Used to render tab widgets inside portals. */
160
- renderWidget?: (tabId: string) => ReactNode;
161
- /** Child nodes nested inside the Zeugma context, usually containing a <PaneTree> or similar layout viewer. */
162
- children: ReactNode;
163
- }
164
- /**
165
- * State context — holds reactive values that change during runtime.
166
- * All consumers of this context will re-render when any of these values change.
167
- */
168
- interface ZeugmaStateValue {
169
- /** The current active layout tree structure, or null if empty. */
170
- layout: TreeNode | null;
171
- /** Callback to update the layout tree. */
172
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
173
- /** Renders the inner content of a pane given its unique ID. */
174
- renderPane: (paneId: string) => ReactNode;
175
- /** The ID of the pane currently zoomed to fullscreen, or null. */
176
- fullscreenPaneId: string | null;
177
- /** Normalized or overridden CSS classes for custom layout styling. */
178
- classNames: ZeugmaClassNames;
179
- /** Whether the layout is globally locked. */
180
- locked: boolean;
181
- }
182
- /** @internal */
183
- interface ZeugmaInternalStateValue extends ZeugmaStateValue {
184
- /** The ID of the tab currently hovered over during a tab drag, or null. */
185
- overTabId: string | null;
186
- /** The position of the tab drop preview relative to the hovered tab ('before' | 'after'). */
187
- overTabPosition: 'before' | 'after' | null;
188
- activeId: string | null;
189
- dismissIntentId: string | null;
190
- setContainerRef: (element: HTMLElement | null) => void;
191
- onRemove?: (paneId: string) => void;
192
- onFullscreenChange?: (paneId: string | null) => void;
193
- snapThreshold?: number;
194
- onResizeStart?: (currentNode: SplitNode) => void;
195
- onResize?: (currentNode: SplitNode, percentage: number) => void;
196
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
197
- minSplitPercentage?: number;
198
- maxSplitPercentage?: number;
199
- }
200
- /**
201
- * Actions context — holds stable dispatch functions with permanent identity.
202
- * Consumers of only this context will never re-render from layout/drag state changes.
203
- */
204
- interface ZeugmaActionsValue {
205
- /** Removes the specified pane from the layout tree and collapses its parent split. */
206
- removePane: (paneId: string) => void;
207
- /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
208
- addPane: (paneId: string) => void;
209
- /** Stable callback to update metadata for a specific tab. */
210
- updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
211
- /** Stable callback to update the locked status of a specific pane in the layout tree. */
212
- updatePaneLock: (paneId: string, locked: boolean) => void;
213
- /** Stable callback to activate a tab within a pane. */
214
- selectTab: (paneId: string, tabId: string) => void;
215
- /** Stable callback to merge a dragged tab/pane into another pane's tab list. */
216
- mergeTab: (draggedTabId: string, targetPaneId: string) => void;
217
- /** Stable callback to remove/close a specific tab from the layout. */
218
- removeTab: (tabId: string) => void;
219
- }
220
- interface ZeugmaContextValue extends ZeugmaStateValue, ZeugmaActionsValue {
221
- }
222
- interface PortalRegistryValue {
223
- registerPortalTarget: (tabId: string, el: HTMLDivElement | null) => void;
224
- }
225
-
226
- declare function generateUniqueId(): string;
227
- /**
228
- * Tree Helper: Remove a pane container and consolidate the tree structure.
229
- */
230
- declare function removePane(tree: TreeNode | null, paneId: string): TreeNode | null;
231
- /**
232
- * Tree Helper: Remove a tab from a pane and consolidate the tree structure if no tabs remain.
233
- */
234
- declare function removeTab(tree: TreeNode | null, tabId: string): TreeNode | null;
235
- /**
236
- * Tree Helper: Insert a pane by splitting an existing target node.
237
- */
238
- declare function splitPane(tree: TreeNode | null, targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string | PaneNode): TreeNode | null;
239
- /**
240
- * Tree Helper: Add a pane by recursively splitting the rightmost/bottommost pane in the tree.
241
- */
242
- declare function addPane(tree: TreeNode | null, paneToAdd: string): TreeNode;
243
- /**
244
- * Tree Helper: Update split percentage recursively.
245
- */
246
- declare function updateSplitPercentage(tree: TreeNode | null, target: SplitNode, newPercentage: number): TreeNode | null;
247
- /**
248
- * Find a PaneNode by its ID.
249
- */
250
- declare function findPaneById(tree: TreeNode | null, paneId: string): PaneNode | null;
251
- /**
252
- * Find a PaneNode containing the given tab ID.
253
- */
254
- declare function findPaneContainingTab(tree: TreeNode | null, tabId: string): PaneNode | null;
255
- /**
256
- * Update metadata on a specific tab node using an updater function.
257
- */
258
- declare function updateTabMetadata(tree: TreeNode | null, tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined): TreeNode | null;
259
- /**
260
- * Update the locked status on a specific pane node in the layout tree.
261
- */
262
- declare function updatePaneLock(tree: TreeNode | null, paneId: string, locked: boolean): TreeNode | null;
263
- /**
264
- * Tree Helper: Activate a tab within a pane.
265
- */
266
- declare function selectTab(tree: TreeNode | null, paneId: string, tabId: string): TreeNode | null;
267
- /**
268
- * Tree Helper: Merge a tab into a target pane node.
269
- */
270
- declare function mergeTab(tree: TreeNode | null, draggedTabId: string, targetPaneId: string): TreeNode | null;
271
- /**
272
- * Tree Helper: Move/reorder a tab inside or to a target pane next to a target tab.
273
- */
274
- declare function moveTab(tree: TreeNode | null, draggedTabId: string, targetTabId: string, position?: 'before' | 'after'): TreeNode | null;
275
- interface ComputedPane {
276
- paneId: string;
277
- left: number;
278
- top: number;
279
- width: number;
280
- height: number;
281
- node: PaneNode;
282
- }
283
- interface ComputedSplitter {
284
- id: string;
285
- currentNode: SplitNode;
286
- direction: SplitDirection;
287
- left: number;
288
- top: number;
289
- width: number;
290
- height: number;
291
- parentLeft: number;
292
- parentTop: number;
293
- parentWidth: number;
294
- parentHeight: number;
295
- }
296
- declare function computeLayout(node: TreeNode | null, left?: number, top?: number, width?: number, height?: number, path?: string): {
297
- panes: ComputedPane[];
298
- splitters: ComputedSplitter[];
299
- };
300
-
301
10
  /**
302
11
  * Shared drag-session lifecycle utility.
303
12
  *
@@ -462,4 +171,4 @@ interface TabProps {
462
171
  }
463
172
  declare const Tab: React__default.FC<TabProps>;
464
173
 
465
- 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, PortalRegistryContext, type PortalRegistryValue, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, type UseZeugmaOptions, Zeugma, ZeugmaActionsContext, type ZeugmaActionsValue, type ZeugmaClassNames, type ZeugmaContextValue, type ZeugmaController, type ZeugmaInternalController, type ZeugmaInternalStateValue, type ZeugmaProps, ZeugmaStateContext, type ZeugmaStateValue, addPane, computeLayout, createDragSession, findPaneById, findPaneContainingTab, generateUniqueId, mergeTab, moveTab, removePane, removeTab, safeJsonStringify, selectTab, splitPane, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };
174
+ export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tab, type TabProps, type TabRenderProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };
package/dist/index.d.ts CHANGED
@@ -1,303 +1,12 @@
1
+ import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as ZeugmaInternalStateValue, b as ZeugmaStateValue, U as UseZeugmaOptions, c as ZeugmaController, d as ZeugmaContextValue, e as ZeugmaProps, S as SplitDirection, T as TreeNode, f as SplitNode } from './types-CaiXD2pG.js';
2
+ export { g as PaneNode, h as TabDetails, i as ZeugmaClassNames, j as ZeugmaInternalController } from './types-CaiXD2pG.js';
1
3
  import * as React from 'react';
2
- import React__default, { Dispatch, SetStateAction, ReactNode, RefObject } from 'react';
4
+ import React__default, { ReactNode } from 'react';
3
5
 
4
6
  declare const DEFAULT_SNAP_THRESHOLD = 8;
5
7
  declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
6
8
  declare const DEFAULT_RESIZER_SIZE = 4;
7
9
 
8
- type SplitDirection = 'row' | 'column';
9
- interface SplitNode {
10
- type: 'split';
11
- direction: SplitDirection;
12
- first: TreeNode;
13
- second: TreeNode;
14
- splitPercentage: number;
15
- }
16
- interface PaneNode {
17
- type: 'pane';
18
- id: string;
19
- tabs: string[];
20
- activeTabId: string;
21
- locked?: boolean;
22
- tabsMetadata?: Record<string, Record<string, unknown>>;
23
- }
24
- type TreeNode = SplitNode | PaneNode;
25
- interface UseZeugmaOptions {
26
- /** Initial layout tree model defining pane organization for uncontrolled mode. Only used on initial mount. */
27
- initialLayout?: TreeNode | null;
28
- /** Controlled layout tree model. If provided, the hook will run in controlled mode and sync with this value. */
29
- layout?: TreeNode | null;
30
- /** Callback triggered when the layout changes via drag-and-drop actions, splits, moves, or resizes. */
31
- onChange?: (newLayout: TreeNode | null) => void;
32
- /** The ID of the pane that is currently taking up the full dashboard area. Null if no pane is fullscreen. */
33
- fullscreenPaneId?: string | null;
34
- /** Callback triggered when a pane is toggled to/from fullscreen mode. Passes the active fullscreen paneId or null. */
35
- onFullscreenChange?: (paneId: string | null) => void;
36
- /** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
37
- locked?: boolean;
38
- /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
39
- dragActivationDistance?: number;
40
- /** Threshold value in pixels for snapping layout resizing handles to adjacent edges. Defaults to 8. */
41
- snapThreshold?: number;
42
- /** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
43
- minSplitPercentage?: number;
44
- /** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
45
- maxSplitPercentage?: number;
46
- /** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
47
- enableDragToDismiss?: boolean;
48
- /** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. Defaults to 60. */
49
- dismissThreshold?: number;
50
- /** Callback triggered when a pane is removed from the dashboard layout tree. */
51
- onRemove?: (paneId: string) => void;
52
- /** Callback triggered when dragging starts for a pane. */
53
- onDragStart?: (activeId: string) => void;
54
- /** Callback triggered when dragging ends, providing details on target pane and drop action (split or move). */
55
- onDragEnd?: (activeId: string, overId: string | null, dropAction: {
56
- type: 'split' | 'move';
57
- direction?: SplitDirection;
58
- position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
59
- } | null) => void;
60
- /** Callback triggered when the user starts dragging a resizing handle between split panes. */
61
- onResizeStart?: (currentNode: SplitNode) => void;
62
- /** Callback triggered continuously while the user is dragging a resizing handle. Passes the new split percentage. */
63
- onResize?: (currentNode: SplitNode, percentage: number) => void;
64
- /** Callback triggered when the user stops dragging a resizing handle. Passes the final split percentage. */
65
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
66
- /** Callback triggered when the drag-out/dismiss intent changes. */
67
- onDismissIntentChange?: (paneId: string | null) => void;
68
- }
69
- interface ZeugmaController {
70
- /** The current active layout tree structure, or null if empty. */
71
- layout: TreeNode | null;
72
- /** Updates the layout tree. */
73
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
74
- /** The ID of the pane currently zoomed to fullscreen, or null. */
75
- fullscreenPaneId: string | null;
76
- /** Programmatically sets the fullscreen pane ID. */
77
- setFullscreenPaneId: (paneId: string | null) => void;
78
- /** Whether the layout is globally locked. */
79
- locked: boolean;
80
- /** Programmatically updates the global locked status. */
81
- setLocked: Dispatch<SetStateAction<boolean>>;
82
- /** Removes the specified pane from the layout tree and collapses its parent split. */
83
- removePane: (paneId: string) => void;
84
- /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
85
- addPane: (paneId: string) => void;
86
- /** Stable callback to update metadata for a specific tab. */
87
- updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
88
- /** Stable callback to update the locked status of a specific pane in the layout tree. */
89
- updatePaneLock: (paneId: string, locked: boolean) => void;
90
- /** Stable callback to activate a tab within a pane. */
91
- selectTab: (paneId: string, tabId: string) => void;
92
- /** Stable callback to merge a dragged tab/pane into another pane's tab list. */
93
- mergeTab: (draggedTabId: string, targetPaneId: string) => void;
94
- /** Stable callback to remove/close a specific tab from the layout. */
95
- removeTab: (tabId: string) => void;
96
- }
97
- /** @internal */
98
- interface ZeugmaInternalController extends ZeugmaController {
99
- activeId: string | null;
100
- setActiveId: Dispatch<SetStateAction<string | null>>;
101
- activeType: 'pane' | 'tab' | null;
102
- setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
103
- dismissIntentId: string | null;
104
- setDismissIntentId: Dispatch<SetStateAction<string | null>>;
105
- containerRef: RefObject<HTMLElement | null>;
106
- setContainerRef: (element: HTMLElement | null) => void;
107
- dragActivationDistance: number;
108
- snapThreshold: number;
109
- minSplitPercentage: number;
110
- maxSplitPercentage: number;
111
- enableDragToDismiss: boolean;
112
- dismissThreshold: number;
113
- onRemove?: (paneId: string) => void;
114
- onDragStart?: (activeId: string) => void;
115
- onDragEnd?: (activeId: string, overId: string | null, dropAction: {
116
- type: 'split' | 'move';
117
- direction?: SplitDirection;
118
- position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
119
- } | null) => void;
120
- onResizeStart?: (currentNode: SplitNode) => void;
121
- onResize?: (currentNode: SplitNode, percentage: number) => void;
122
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
123
- onDismissIntentChange?: (paneId: string | null) => void;
124
- splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
125
- updateSplitPercentage: (currentNode: SplitNode, percentage: number) => void;
126
- moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
127
- }
128
- interface ZeugmaClassNames {
129
- /** CSS class applied to the root dashboard container. */
130
- dashboard?: string;
131
- /** CSS class applied to the root dashboard container when a drag-out dismiss is active. */
132
- dashboardDismissActive?: string;
133
- /** CSS class applied to the outer container div of each `<Pane>`. */
134
- pane?: string;
135
- /** CSS class applied to the pane container when locked. */
136
- paneLocked?: string;
137
- /** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
138
- dropPreview?: string;
139
- /** CSS class applied to the custom cursor-following drag preview portal wrapper. */
140
- dragOverlay?: string;
141
- /** CSS class applied to the drag-to-resize split bar handles. */
142
- resizer?: string;
143
- /** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
144
- dismissPreview?: string;
145
- /** CSS class applied to root container when dashboard is globally locked. */
146
- dashboardLocked?: string;
147
- /** CSS class applied to drop zone indicator when hovering over a locked pane. */
148
- lockedPreview?: string;
149
- /** CSS class applied to tab container when dragging a tab over it. */
150
- tabDropPreview?: string;
151
- }
152
- interface ZeugmaProps extends ZeugmaController {
153
- /** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
154
- renderPane: (paneId: string) => ReactNode;
155
- /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
156
- renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
157
- /** Optional CSS class name mapping overrides for custom styles of components like panes, drop previews, overlays, etc. */
158
- classNames?: ZeugmaClassNames;
159
- /** Render function mapping tab IDs to React elements. Used to render tab widgets inside portals. */
160
- renderWidget?: (tabId: string) => ReactNode;
161
- /** Child nodes nested inside the Zeugma context, usually containing a <PaneTree> or similar layout viewer. */
162
- children: ReactNode;
163
- }
164
- /**
165
- * State context — holds reactive values that change during runtime.
166
- * All consumers of this context will re-render when any of these values change.
167
- */
168
- interface ZeugmaStateValue {
169
- /** The current active layout tree structure, or null if empty. */
170
- layout: TreeNode | null;
171
- /** Callback to update the layout tree. */
172
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
173
- /** Renders the inner content of a pane given its unique ID. */
174
- renderPane: (paneId: string) => ReactNode;
175
- /** The ID of the pane currently zoomed to fullscreen, or null. */
176
- fullscreenPaneId: string | null;
177
- /** Normalized or overridden CSS classes for custom layout styling. */
178
- classNames: ZeugmaClassNames;
179
- /** Whether the layout is globally locked. */
180
- locked: boolean;
181
- }
182
- /** @internal */
183
- interface ZeugmaInternalStateValue extends ZeugmaStateValue {
184
- /** The ID of the tab currently hovered over during a tab drag, or null. */
185
- overTabId: string | null;
186
- /** The position of the tab drop preview relative to the hovered tab ('before' | 'after'). */
187
- overTabPosition: 'before' | 'after' | null;
188
- activeId: string | null;
189
- dismissIntentId: string | null;
190
- setContainerRef: (element: HTMLElement | null) => void;
191
- onRemove?: (paneId: string) => void;
192
- onFullscreenChange?: (paneId: string | null) => void;
193
- snapThreshold?: number;
194
- onResizeStart?: (currentNode: SplitNode) => void;
195
- onResize?: (currentNode: SplitNode, percentage: number) => void;
196
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
197
- minSplitPercentage?: number;
198
- maxSplitPercentage?: number;
199
- }
200
- /**
201
- * Actions context — holds stable dispatch functions with permanent identity.
202
- * Consumers of only this context will never re-render from layout/drag state changes.
203
- */
204
- interface ZeugmaActionsValue {
205
- /** Removes the specified pane from the layout tree and collapses its parent split. */
206
- removePane: (paneId: string) => void;
207
- /** Appends/inserts a pane at the bottom-rightmost leaf of the layout tree. */
208
- addPane: (paneId: string) => void;
209
- /** Stable callback to update metadata for a specific tab. */
210
- updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
211
- /** Stable callback to update the locked status of a specific pane in the layout tree. */
212
- updatePaneLock: (paneId: string, locked: boolean) => void;
213
- /** Stable callback to activate a tab within a pane. */
214
- selectTab: (paneId: string, tabId: string) => void;
215
- /** Stable callback to merge a dragged tab/pane into another pane's tab list. */
216
- mergeTab: (draggedTabId: string, targetPaneId: string) => void;
217
- /** Stable callback to remove/close a specific tab from the layout. */
218
- removeTab: (tabId: string) => void;
219
- }
220
- interface ZeugmaContextValue extends ZeugmaStateValue, ZeugmaActionsValue {
221
- }
222
- interface PortalRegistryValue {
223
- registerPortalTarget: (tabId: string, el: HTMLDivElement | null) => void;
224
- }
225
-
226
- declare function generateUniqueId(): string;
227
- /**
228
- * Tree Helper: Remove a pane container and consolidate the tree structure.
229
- */
230
- declare function removePane(tree: TreeNode | null, paneId: string): TreeNode | null;
231
- /**
232
- * Tree Helper: Remove a tab from a pane and consolidate the tree structure if no tabs remain.
233
- */
234
- declare function removeTab(tree: TreeNode | null, tabId: string): TreeNode | null;
235
- /**
236
- * Tree Helper: Insert a pane by splitting an existing target node.
237
- */
238
- declare function splitPane(tree: TreeNode | null, targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string | PaneNode): TreeNode | null;
239
- /**
240
- * Tree Helper: Add a pane by recursively splitting the rightmost/bottommost pane in the tree.
241
- */
242
- declare function addPane(tree: TreeNode | null, paneToAdd: string): TreeNode;
243
- /**
244
- * Tree Helper: Update split percentage recursively.
245
- */
246
- declare function updateSplitPercentage(tree: TreeNode | null, target: SplitNode, newPercentage: number): TreeNode | null;
247
- /**
248
- * Find a PaneNode by its ID.
249
- */
250
- declare function findPaneById(tree: TreeNode | null, paneId: string): PaneNode | null;
251
- /**
252
- * Find a PaneNode containing the given tab ID.
253
- */
254
- declare function findPaneContainingTab(tree: TreeNode | null, tabId: string): PaneNode | null;
255
- /**
256
- * Update metadata on a specific tab node using an updater function.
257
- */
258
- declare function updateTabMetadata(tree: TreeNode | null, tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined): TreeNode | null;
259
- /**
260
- * Update the locked status on a specific pane node in the layout tree.
261
- */
262
- declare function updatePaneLock(tree: TreeNode | null, paneId: string, locked: boolean): TreeNode | null;
263
- /**
264
- * Tree Helper: Activate a tab within a pane.
265
- */
266
- declare function selectTab(tree: TreeNode | null, paneId: string, tabId: string): TreeNode | null;
267
- /**
268
- * Tree Helper: Merge a tab into a target pane node.
269
- */
270
- declare function mergeTab(tree: TreeNode | null, draggedTabId: string, targetPaneId: string): TreeNode | null;
271
- /**
272
- * Tree Helper: Move/reorder a tab inside or to a target pane next to a target tab.
273
- */
274
- declare function moveTab(tree: TreeNode | null, draggedTabId: string, targetTabId: string, position?: 'before' | 'after'): TreeNode | null;
275
- interface ComputedPane {
276
- paneId: string;
277
- left: number;
278
- top: number;
279
- width: number;
280
- height: number;
281
- node: PaneNode;
282
- }
283
- interface ComputedSplitter {
284
- id: string;
285
- currentNode: SplitNode;
286
- direction: SplitDirection;
287
- left: number;
288
- top: number;
289
- width: number;
290
- height: number;
291
- parentLeft: number;
292
- parentTop: number;
293
- parentWidth: number;
294
- parentHeight: number;
295
- }
296
- declare function computeLayout(node: TreeNode | null, left?: number, top?: number, width?: number, height?: number, path?: string): {
297
- panes: ComputedPane[];
298
- splitters: ComputedSplitter[];
299
- };
300
-
301
10
  /**
302
11
  * Shared drag-session lifecycle utility.
303
12
  *
@@ -462,4 +171,4 @@ interface TabProps {
462
171
  }
463
172
  declare const Tab: React__default.FC<TabProps>;
464
173
 
465
- 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, PortalRegistryContext, type PortalRegistryValue, ResizableContainer, type ResizableContainerProps, type SplitDirection, type SplitNode, Tab, type TabProps, type TabRenderProps, type TreeNode, type UseZeugmaOptions, Zeugma, ZeugmaActionsContext, type ZeugmaActionsValue, type ZeugmaClassNames, type ZeugmaContextValue, type ZeugmaController, type ZeugmaInternalController, type ZeugmaInternalStateValue, type ZeugmaProps, ZeugmaStateContext, type ZeugmaStateValue, addPane, computeLayout, createDragSession, findPaneById, findPaneContainingTab, generateUniqueId, mergeTab, moveTab, removePane, removeTab, safeJsonStringify, selectTab, splitPane, updatePaneLock, updateSplitPercentage, updateTabMetadata, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };
174
+ export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tab, type TabProps, type TabRenderProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };