react-zeugma 4.1.1 → 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/README.md +71 -11
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -318
- package/dist/index.d.ts +52 -318
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types-CaiXD2pG.d.cts +242 -0
- package/dist/types-CaiXD2pG.d.ts +242 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +83 -0
- package/dist/utils.d.ts +83 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/package.json +7 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,217 +1,53 @@
|
|
|
1
|
-
import
|
|
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';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import React__default, { ReactNode } from 'react';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
direction: SplitDirection;
|
|
7
|
-
first: TreeNode;
|
|
8
|
-
second: TreeNode;
|
|
9
|
-
splitPercentage: number;
|
|
10
|
-
}
|
|
11
|
-
interface PaneNode {
|
|
12
|
-
type: 'pane';
|
|
13
|
-
id: string;
|
|
14
|
-
tabs: string[];
|
|
15
|
-
activeTabId: string;
|
|
16
|
-
locked?: boolean;
|
|
17
|
-
tabsMetadata?: Record<string, Record<string, unknown>>;
|
|
18
|
-
}
|
|
19
|
-
type TreeNode = SplitNode | PaneNode;
|
|
6
|
+
declare const DEFAULT_SNAP_THRESHOLD = 8;
|
|
7
|
+
declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
|
|
8
|
+
declare const DEFAULT_RESIZER_SIZE = 4;
|
|
20
9
|
|
|
21
|
-
interface UseZeugmaOptions {
|
|
22
|
-
/** Initial layout tree model defining pane organization for uncontrolled mode. Only used on initial mount. */
|
|
23
|
-
initialLayout?: TreeNode | null;
|
|
24
|
-
/** Controlled layout tree model. If provided, the hook will run in controlled mode and sync with this value. */
|
|
25
|
-
layout?: TreeNode | null;
|
|
26
|
-
/** Callback triggered when the layout changes via drag-and-drop actions, splits, swaps, or resizes. */
|
|
27
|
-
onChange?: (newLayout: TreeNode | null) => void;
|
|
28
|
-
/** The ID of the pane that is currently taking up the full dashboard area. Null if no pane is fullscreen. */
|
|
29
|
-
fullscreenPaneId?: string | null;
|
|
30
|
-
/** Callback triggered when a pane is toggled to/from fullscreen mode. Passes the active fullscreen paneId or null. */
|
|
31
|
-
onFullscreenChange?: (paneId: string | null) => void;
|
|
32
|
-
/** Whether the layout is locked. When locked, resizing, dragging, and dropping are disabled. */
|
|
33
|
-
locked?: boolean;
|
|
34
|
-
/** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
|
|
35
|
-
dragActivationDistance?: number;
|
|
36
|
-
/** Threshold value in pixels for snapping layout resizing handles to adjacent edges. Defaults to 8. */
|
|
37
|
-
snapThreshold?: number;
|
|
38
|
-
/** Minimum split percentage allowed when resizing split panes. Defaults to 5. */
|
|
39
|
-
minSplitPercentage?: number;
|
|
40
|
-
/** Maximum split percentage allowed when resizing split panes. Defaults to 95. */
|
|
41
|
-
maxSplitPercentage?: number;
|
|
42
|
-
/** Whether dragging a pane far enough outside the container triggers a drag-out/dismiss action. Defaults to false. */
|
|
43
|
-
enableDragToDismiss?: boolean;
|
|
44
|
-
/** The threshold in pixels beyond the container boundaries required to activate the drag-out/dismiss action. Defaults to 60. */
|
|
45
|
-
dismissThreshold?: number;
|
|
46
|
-
/** Callback triggered when a pane is removed from the dashboard layout tree. */
|
|
47
|
-
onRemove?: (paneId: string) => void;
|
|
48
|
-
/** Callback triggered when dragging starts for a pane. */
|
|
49
|
-
onDragStart?: (activeId: string) => void;
|
|
50
|
-
/** Callback triggered when dragging ends, providing details on target pane and drop action (split or swap). */
|
|
51
|
-
onDragEnd?: (activeId: string, overId: string | null, dropAction: {
|
|
52
|
-
type: 'split' | 'swap';
|
|
53
|
-
direction?: SplitDirection;
|
|
54
|
-
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
55
|
-
} | null) => void;
|
|
56
|
-
/** Callback triggered when the user starts dragging a resizing handle between split panes. */
|
|
57
|
-
onResizeStart?: (currentNode: SplitNode) => void;
|
|
58
|
-
/** Callback triggered continuously while the user is dragging a resizing handle. Passes the new split percentage. */
|
|
59
|
-
onResize?: (currentNode: SplitNode, percentage: number) => void;
|
|
60
|
-
/** Callback triggered when the user stops dragging a resizing handle. Passes the final split percentage. */
|
|
61
|
-
onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
|
|
62
|
-
/** Callback triggered when the drag-out/dismiss intent changes. */
|
|
63
|
-
onDismissIntentChange?: (paneId: string | null) => void;
|
|
64
|
-
}
|
|
65
|
-
interface ZeugmaController {
|
|
66
|
-
layout: TreeNode | null;
|
|
67
|
-
setLayout: Dispatch<SetStateAction<TreeNode | null>>;
|
|
68
|
-
fullscreenPaneId: string | null;
|
|
69
|
-
setFullscreenPaneId: (paneId: string | null) => void;
|
|
70
|
-
locked: boolean;
|
|
71
|
-
setLocked: Dispatch<SetStateAction<boolean>>;
|
|
72
|
-
activeId: string | null;
|
|
73
|
-
setActiveId: Dispatch<SetStateAction<string | null>>;
|
|
74
|
-
activeType: 'pane' | 'tab' | null;
|
|
75
|
-
setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
|
|
76
|
-
dismissIntentId: string | null;
|
|
77
|
-
setDismissIntentId: Dispatch<SetStateAction<string | null>>;
|
|
78
|
-
containerRef: RefObject<HTMLElement | null>;
|
|
79
|
-
setContainerRef: (element: HTMLElement | null) => void;
|
|
80
|
-
dragActivationDistance: number;
|
|
81
|
-
snapThreshold: number;
|
|
82
|
-
minSplitPercentage: number;
|
|
83
|
-
maxSplitPercentage: number;
|
|
84
|
-
enableDragToDismiss: boolean;
|
|
85
|
-
dismissThreshold: number;
|
|
86
|
-
onRemove?: (paneId: string) => void;
|
|
87
|
-
onDragStart?: (activeId: string) => void;
|
|
88
|
-
onDragEnd?: (activeId: string, overId: string | null, dropAction: {
|
|
89
|
-
type: 'split' | 'swap';
|
|
90
|
-
direction?: SplitDirection;
|
|
91
|
-
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
92
|
-
} | null) => void;
|
|
93
|
-
onResizeStart?: (currentNode: SplitNode) => void;
|
|
94
|
-
onResize?: (currentNode: SplitNode, percentage: number) => void;
|
|
95
|
-
onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
|
|
96
|
-
onDismissIntentChange?: (paneId: string | null) => void;
|
|
97
|
-
removePane: (paneId: string) => void;
|
|
98
|
-
addPane: (paneId: string) => void;
|
|
99
|
-
splitPane: (targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string) => void;
|
|
100
|
-
updateSplitPercentage: (currentNode: SplitNode, percentage: number) => void;
|
|
101
|
-
updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
|
|
102
|
-
updatePaneLock: (paneId: string, locked: boolean) => void;
|
|
103
|
-
selectTab: (paneId: string, tabId: string) => void;
|
|
104
|
-
mergeTab: (draggedTabId: string, targetPaneId: string) => void;
|
|
105
|
-
moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
|
|
106
|
-
removeTab: (tabId: string) => void;
|
|
107
|
-
}
|
|
108
|
-
interface ZeugmaClassNames {
|
|
109
|
-
/** CSS class applied to the outer container div of each `<Pane>`. */
|
|
110
|
-
pane?: string;
|
|
111
|
-
/** CSS class applied to the pane container when locked. */
|
|
112
|
-
paneLocked?: string;
|
|
113
|
-
/** CSS class applied to drop zone indicators when hovering over layout edges to split a pane. */
|
|
114
|
-
dropPreview?: string;
|
|
115
|
-
/** CSS class applied to the custom cursor-following drag preview portal wrapper. */
|
|
116
|
-
dragOverlay?: string;
|
|
117
|
-
/** CSS class applied to the drag-to-resize split bar handles. */
|
|
118
|
-
resizer?: string;
|
|
119
|
-
/** CSS class applied to the background dismiss zone indicator during a drag-out dismiss gesture. */
|
|
120
|
-
dismissPreview?: string;
|
|
121
|
-
/** CSS class applied to root container when dashboard is globally locked. */
|
|
122
|
-
dashboardLocked?: string;
|
|
123
|
-
/** CSS class applied to drop zone indicator when hovering over a locked pane. */
|
|
124
|
-
lockedPreview?: string;
|
|
125
|
-
}
|
|
126
|
-
interface ZeugmaProps extends ZeugmaController {
|
|
127
|
-
/** Render function mapping unique pane IDs to React elements. Usually renders a <Pane> wrapper. */
|
|
128
|
-
renderPane: (paneId: string) => ReactNode;
|
|
129
|
-
/** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
|
|
130
|
-
renderDragOverlay?: (activeId: string, type: 'pane' | 'tab') => ReactNode;
|
|
131
|
-
/** Optional CSS class name mapping overrides for custom styles of components like panes, drop/swap previews, overlays, etc. */
|
|
132
|
-
classNames?: ZeugmaClassNames;
|
|
133
|
-
/** Render function mapping tab IDs to React elements. Used to render tab widgets inside portals. */
|
|
134
|
-
renderWidget?: (tabId: string) => ReactNode;
|
|
135
|
-
/** Child nodes nested inside the Zeugma context, usually containing a <PaneTree> or similar layout viewer. */
|
|
136
|
-
children: ReactNode;
|
|
137
|
-
}
|
|
138
10
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
activeId: string | null;
|
|
151
|
-
/** The ID of the pane currently targeted for dismiss/drag-out, or null. */
|
|
152
|
-
dismissIntentId: string | null;
|
|
153
|
-
/** Ref setter to measure and track the dashboard root container element. */
|
|
154
|
-
setContainerRef: (element: HTMLElement | null) => void;
|
|
155
|
-
/** The ID of the pane currently zoomed to fullscreen, or null. */
|
|
156
|
-
fullscreenPaneId: string | null;
|
|
157
|
-
/** Normalized or overridden CSS classes for custom layout styling. */
|
|
158
|
-
classNames: ZeugmaClassNames;
|
|
159
|
-
/** Callback triggered when a pane is closed/removed from the dashboard. */
|
|
160
|
-
onRemove?: (paneId: string) => void;
|
|
161
|
-
/** Callback triggered to toggle fullscreen status for a pane. */
|
|
162
|
-
onFullscreenChange?: (paneId: string | null) => void;
|
|
163
|
-
/** Threshold in pixels to snap layout resizers to adjacent edges. */
|
|
164
|
-
snapThreshold?: number;
|
|
165
|
-
/** Callback triggered when a split pane starts being resized. */
|
|
166
|
-
onResizeStart?: (currentNode: SplitNode) => void;
|
|
167
|
-
/** Callback triggered continuously during a split pane resize. */
|
|
168
|
-
onResize?: (currentNode: SplitNode, percentage: number) => void;
|
|
169
|
-
/** Callback triggered when a split pane resize action is completed. */
|
|
170
|
-
onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
|
|
171
|
-
/** Minimum split percentage allowed when resizing. */
|
|
172
|
-
minSplitPercentage?: number;
|
|
173
|
-
/** Maximum split percentage allowed when resizing. */
|
|
174
|
-
maxSplitPercentage?: number;
|
|
175
|
-
/** Whether the layout is globally locked. */
|
|
176
|
-
locked: boolean;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Actions context — holds stable dispatch functions with permanent identity.
|
|
180
|
-
* Consumers of only this context will never re-render from layout/drag state changes.
|
|
11
|
+
* Shared drag-session lifecycle utility.
|
|
12
|
+
*
|
|
13
|
+
* Handles the common boilerplate for pointer-based resize operations:
|
|
14
|
+
* - Adds `zeugma-resizing` class to `document.body`
|
|
15
|
+
* - Injects a global `cursor` style so the resize cursor stays active
|
|
16
|
+
* even when the pointer leaves the handle element
|
|
17
|
+
* - Sets `data-resizing` on the resizer element
|
|
18
|
+
* - Attaches `pointermove` / `pointerup` listeners to `document`
|
|
19
|
+
* - Cleans everything up on pointer-up
|
|
20
|
+
*
|
|
21
|
+
* Consumers provide domain-specific `onMove` and `onEnd` callbacks.
|
|
181
22
|
*/
|
|
182
|
-
interface
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
/** Stable callback to update metadata for a specific tab. */
|
|
192
|
-
updateTabMetadata: (tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined) => void;
|
|
193
|
-
/** Stable callback to update the locked status of a specific pane in the layout tree. */
|
|
194
|
-
updatePaneLock: (paneId: string, locked: boolean) => void;
|
|
195
|
-
/** Stable callback to activate a tab within a pane. */
|
|
196
|
-
selectTab: (paneId: string, tabId: string) => void;
|
|
197
|
-
/** Stable callback to merge a dragged tab/pane into another pane's tab list. */
|
|
198
|
-
mergeTab: (draggedTabId: string, targetPaneId: string) => void;
|
|
199
|
-
/** Stable callback to move/reorder a tab to another pane next to a target tab. */
|
|
200
|
-
moveTab: (draggedTabId: string, targetTabId: string, position?: 'before' | 'after') => void;
|
|
201
|
-
/** Stable callback to remove/close a specific tab from the layout. */
|
|
202
|
-
removeTab: (tabId: string) => void;
|
|
203
|
-
}
|
|
204
|
-
interface ZeugmaContextValue extends ZeugmaStateValue, ZeugmaActionsValue {
|
|
23
|
+
interface DragSessionConfig {
|
|
24
|
+
/** CSS cursor to enforce globally during the drag */
|
|
25
|
+
cursor: 'col-resize' | 'row-resize';
|
|
26
|
+
/** The resizer DOM element (receives `data-resizing` attribute) */
|
|
27
|
+
resizerEl: HTMLElement;
|
|
28
|
+
/** Called on every `pointermove` during the drag */
|
|
29
|
+
onMove: (e: PointerEvent) => void;
|
|
30
|
+
/** Called once on `pointerup` — after cleanup has already run */
|
|
31
|
+
onEnd: () => void;
|
|
205
32
|
}
|
|
33
|
+
declare function createDragSession({ cursor, resizerEl, onMove, onEnd }: DragSessionConfig): void;
|
|
34
|
+
|
|
35
|
+
declare function safeJsonStringify(val: unknown): string;
|
|
36
|
+
|
|
37
|
+
declare const ZeugmaStateContext: React.Context<ZeugmaInternalStateValue | undefined>;
|
|
38
|
+
declare const ZeugmaActionsContext: React.Context<ZeugmaActionsValue | undefined>;
|
|
39
|
+
declare const PortalRegistryContext: React.Context<PortalRegistryValue | undefined>;
|
|
40
|
+
declare const useZeugmaState: () => ZeugmaStateValue;
|
|
41
|
+
declare const useZeugmaActions: () => ZeugmaActionsValue;
|
|
206
42
|
|
|
207
43
|
declare function useZeugma(options: UseZeugmaOptions): ZeugmaController;
|
|
208
44
|
|
|
209
45
|
declare const useZeugmaContext: () => ZeugmaContextValue;
|
|
210
46
|
|
|
211
|
-
declare const Zeugma:
|
|
47
|
+
declare const Zeugma: React__default.FC<ZeugmaProps>;
|
|
212
48
|
|
|
213
49
|
interface UseResizerProps {
|
|
214
|
-
containerRef:
|
|
50
|
+
containerRef: React__default.RefObject<HTMLDivElement | null>;
|
|
215
51
|
isRow: boolean;
|
|
216
52
|
direction: SplitDirection;
|
|
217
53
|
splitPercentage: number;
|
|
@@ -227,7 +63,7 @@ interface UseResizerProps {
|
|
|
227
63
|
parentWidth: number;
|
|
228
64
|
parentHeight: number;
|
|
229
65
|
}
|
|
230
|
-
declare function useResizer({ containerRef, isRow, direction, splitPercentage, resizerSize, snapThreshold, layout, currentNode, onLayoutChange, onResizeStart: localOnResizeStart, onResizeEnd: localOnResizeEnd, parentLeft, parentTop, parentWidth, parentHeight, }: UseResizerProps): (e:
|
|
66
|
+
declare function useResizer({ containerRef, isRow, direction, splitPercentage, resizerSize, snapThreshold, layout, currentNode, onLayoutChange, onResizeStart: localOnResizeStart, onResizeEnd: localOnResizeEnd, parentLeft, parentTop, parentWidth, parentHeight, }: UseResizerProps): (e: React__default.PointerEvent<HTMLDivElement>) => void;
|
|
231
67
|
|
|
232
68
|
interface PaneTreeProps {
|
|
233
69
|
/** The layout subtree node to render. If not specified, defaults to the root layout tree from the Zeugma context. */
|
|
@@ -237,10 +73,10 @@ interface PaneTreeProps {
|
|
|
237
73
|
/** Threshold distance in pixels to snap layout resizers to adjacent edges (default 8). */
|
|
238
74
|
snapThreshold?: number;
|
|
239
75
|
}
|
|
240
|
-
declare const PaneTree:
|
|
76
|
+
declare const PaneTree: React__default.FC<PaneTreeProps>;
|
|
241
77
|
|
|
242
78
|
interface ResizableContainerProps {
|
|
243
|
-
children:
|
|
79
|
+
children: React__default.ReactNode;
|
|
244
80
|
/** Whether the resizable container is active. When false, acts as a normal 100% height container. */
|
|
245
81
|
active?: boolean;
|
|
246
82
|
/** Current height in pixels (controlled mode) or default/initial height */
|
|
@@ -262,7 +98,7 @@ interface ResizableContainerProps {
|
|
|
262
98
|
/** CSS class applied to the resizer handle */
|
|
263
99
|
resizerClassName?: string;
|
|
264
100
|
}
|
|
265
|
-
declare const ResizableContainer:
|
|
101
|
+
declare const ResizableContainer: React__default.FC<ResizableContainerProps>;
|
|
266
102
|
|
|
267
103
|
interface PaneRenderProps {
|
|
268
104
|
/** True if the pane is actively being dragged. */
|
|
@@ -299,23 +135,23 @@ interface PaneProps {
|
|
|
299
135
|
/** The unique ID of the pane, matching a `paneId` in the layout tree schema. */
|
|
300
136
|
id: string;
|
|
301
137
|
/** Render prop function providing pane state (isDragging, isFullscreen, etc.) and handlers. */
|
|
302
|
-
children: (props: PaneRenderProps) =>
|
|
138
|
+
children: (props: PaneRenderProps) => React__default.ReactNode;
|
|
303
139
|
/** Optional inline CSS styles applied to the pane outer container. */
|
|
304
|
-
style?:
|
|
140
|
+
style?: React__default.CSSProperties;
|
|
305
141
|
/** Optional override to lock this specific pane. */
|
|
306
142
|
locked?: boolean;
|
|
307
143
|
}
|
|
308
|
-
declare const Pane:
|
|
144
|
+
declare const Pane: React__default.FC<PaneProps>;
|
|
309
145
|
|
|
310
146
|
interface DragHandleProps {
|
|
311
147
|
/** The children elements that will trigger dragging when held and dragged. */
|
|
312
|
-
children?:
|
|
148
|
+
children?: React__default.ReactNode;
|
|
313
149
|
/** Custom CSS class applied to the drag handle element. */
|
|
314
150
|
className?: string;
|
|
315
151
|
/** Optional inline CSS styles applied to the drag handle. */
|
|
316
|
-
style?:
|
|
152
|
+
style?: React__default.CSSProperties;
|
|
317
153
|
}
|
|
318
|
-
declare const DragHandle:
|
|
154
|
+
declare const DragHandle: React__default.FC<DragHandleProps>;
|
|
319
155
|
|
|
320
156
|
interface TabRenderProps {
|
|
321
157
|
isDragging: boolean;
|
|
@@ -327,114 +163,12 @@ interface TabProps {
|
|
|
327
163
|
/** Whether dragging is locked on this tab. */
|
|
328
164
|
locked?: boolean;
|
|
329
165
|
/** Render prop child function. */
|
|
330
|
-
children: (props: TabRenderProps) =>
|
|
166
|
+
children: (props: TabRenderProps) => React__default.ReactNode;
|
|
331
167
|
/** Custom CSS class applied to the tab wrapper. */
|
|
332
168
|
className?: string;
|
|
333
169
|
/** Custom inline CSS style applied to the tab wrapper. */
|
|
334
|
-
style?:
|
|
170
|
+
style?: React__default.CSSProperties;
|
|
335
171
|
}
|
|
336
|
-
declare const Tab:
|
|
337
|
-
|
|
338
|
-
declare const DEFAULT_SNAP_THRESHOLD = 8;
|
|
339
|
-
declare const DEFAULT_DRAG_ACTIVATION_DISTANCE = 8;
|
|
340
|
-
declare const DEFAULT_RESIZER_SIZE = 4;
|
|
341
|
-
|
|
342
|
-
declare function generateUniqueId(): string;
|
|
343
|
-
/**
|
|
344
|
-
* Tree Helper: Remove a pane container and consolidate the tree structure.
|
|
345
|
-
*/
|
|
346
|
-
declare function removePane(tree: TreeNode | null, paneId: string): TreeNode | null;
|
|
347
|
-
/**
|
|
348
|
-
* Tree Helper: Remove a tab from a pane and consolidate the tree structure if no tabs remain.
|
|
349
|
-
*/
|
|
350
|
-
declare function removeTab(tree: TreeNode | null, tabId: string): TreeNode | null;
|
|
351
|
-
/**
|
|
352
|
-
* Tree Helper: Insert a pane by splitting an existing target node.
|
|
353
|
-
*/
|
|
354
|
-
declare function splitPane(tree: TreeNode | null, targetId: string, direction: SplitDirection, splitType: 'left' | 'right' | 'top' | 'bottom', paneToAdd: string | PaneNode): TreeNode | null;
|
|
355
|
-
/**
|
|
356
|
-
* Tree Helper: Add a pane by recursively splitting the rightmost/bottommost pane in the tree.
|
|
357
|
-
*/
|
|
358
|
-
declare function addPane(tree: TreeNode | null, paneToAdd: string): TreeNode;
|
|
359
|
-
/**
|
|
360
|
-
* Tree Helper: Update split percentage recursively.
|
|
361
|
-
*/
|
|
362
|
-
declare function updateSplitPercentage(tree: TreeNode | null, target: SplitNode, newPercentage: number): TreeNode | null;
|
|
363
|
-
/**
|
|
364
|
-
* Find a PaneNode by its ID or by any of its tab IDs.
|
|
365
|
-
*/
|
|
366
|
-
declare function findPane(tree: TreeNode | null, paneId: string): PaneNode | null;
|
|
367
|
-
/**
|
|
368
|
-
* Update metadata on a specific tab node using an updater function.
|
|
369
|
-
*/
|
|
370
|
-
declare function updateTabMetadata(tree: TreeNode | null, tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined): TreeNode | null;
|
|
371
|
-
/**
|
|
372
|
-
* Update the locked status on a specific pane node in the layout tree.
|
|
373
|
-
*/
|
|
374
|
-
declare function updatePaneLock(tree: TreeNode | null, paneId: string, locked: boolean): TreeNode | null;
|
|
375
|
-
/**
|
|
376
|
-
* Tree Helper: Activate a tab within a pane.
|
|
377
|
-
*/
|
|
378
|
-
declare function selectTab(tree: TreeNode | null, paneId: string, tabId: string): TreeNode | null;
|
|
379
|
-
/**
|
|
380
|
-
* Tree Helper: Merge a tab into a target pane node.
|
|
381
|
-
*/
|
|
382
|
-
declare function mergeTab(tree: TreeNode | null, draggedTabId: string, targetPaneId: string): TreeNode | null;
|
|
383
|
-
/**
|
|
384
|
-
* Tree Helper: Move/reorder a tab inside or to a target pane next to a target tab.
|
|
385
|
-
*/
|
|
386
|
-
declare function moveTab(tree: TreeNode | null, draggedTabId: string, targetTabId: string, position?: 'before' | 'after'): TreeNode | null;
|
|
387
|
-
interface ComputedPane {
|
|
388
|
-
paneId: string;
|
|
389
|
-
left: number;
|
|
390
|
-
top: number;
|
|
391
|
-
width: number;
|
|
392
|
-
height: number;
|
|
393
|
-
node: PaneNode;
|
|
394
|
-
}
|
|
395
|
-
interface ComputedSplitter {
|
|
396
|
-
id: string;
|
|
397
|
-
currentNode: SplitNode;
|
|
398
|
-
direction: SplitDirection;
|
|
399
|
-
left: number;
|
|
400
|
-
top: number;
|
|
401
|
-
width: number;
|
|
402
|
-
height: number;
|
|
403
|
-
parentLeft: number;
|
|
404
|
-
parentTop: number;
|
|
405
|
-
parentWidth: number;
|
|
406
|
-
parentHeight: number;
|
|
407
|
-
}
|
|
408
|
-
declare function computeLayout(node: TreeNode | null, left?: number, top?: number, width?: number, height?: number, path?: string): {
|
|
409
|
-
panes: ComputedPane[];
|
|
410
|
-
splitters: ComputedSplitter[];
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Shared drag-session lifecycle utility.
|
|
415
|
-
*
|
|
416
|
-
* Handles the common boilerplate for pointer-based resize operations:
|
|
417
|
-
* - Adds `zeugma-resizing` class to `document.body`
|
|
418
|
-
* - Injects a global `cursor` style so the resize cursor stays active
|
|
419
|
-
* even when the pointer leaves the handle element
|
|
420
|
-
* - Sets `data-resizing` on the resizer element
|
|
421
|
-
* - Attaches `pointermove` / `pointerup` listeners to `document`
|
|
422
|
-
* - Cleans everything up on pointer-up
|
|
423
|
-
*
|
|
424
|
-
* Consumers provide domain-specific `onMove` and `onEnd` callbacks.
|
|
425
|
-
*/
|
|
426
|
-
interface DragSessionConfig {
|
|
427
|
-
/** CSS cursor to enforce globally during the drag */
|
|
428
|
-
cursor: 'col-resize' | 'row-resize';
|
|
429
|
-
/** The resizer DOM element (receives `data-resizing` attribute) */
|
|
430
|
-
resizerEl: HTMLElement;
|
|
431
|
-
/** Called on every `pointermove` during the drag */
|
|
432
|
-
onMove: (e: PointerEvent) => void;
|
|
433
|
-
/** Called once on `pointerup` — after cleanup has already run */
|
|
434
|
-
onEnd: () => void;
|
|
435
|
-
}
|
|
436
|
-
declare function createDragSession({ cursor, resizerEl, onMove, onEnd }: DragSessionConfig): void;
|
|
437
|
-
|
|
438
|
-
declare function safeJsonStringify(val: unknown): string;
|
|
172
|
+
declare const Tab: React__default.FC<TabProps>;
|
|
439
173
|
|
|
440
|
-
export {
|
|
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 };
|