react-zeugma 6.4.0 → 6.4.1

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.
@@ -1,4 +1,4 @@
1
- import { ReactNode, RefObject, Dispatch, SetStateAction } from 'react';
1
+ import { Dispatch, SetStateAction, ReactNode } from 'react';
2
2
 
3
3
  type SplitDirection = 'row' | 'column';
4
4
  interface SplitNode {
@@ -90,20 +90,6 @@ interface ZeugmaQueries {
90
90
  }
91
91
  interface ZeugmaController extends ZeugmaState, ZeugmaStateSetters, ZeugmaActions, ZeugmaQueries {
92
92
  }
93
- /** @internal Internal controller containing transient drag-and-drop orchestration state. */
94
- interface ZeugmaControllerInternal extends ZeugmaController {
95
- _internalSetLayout: Dispatch<SetStateAction<TreeNode | null>>;
96
- activeId: string | null;
97
- setActiveId: Dispatch<SetStateAction<string | null>>;
98
- activeType: 'pane' | 'tab' | null;
99
- setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
100
- dismissIntentId: string | null;
101
- setDismissIntentId: Dispatch<SetStateAction<string | null>>;
102
- containerRef: RefObject<HTMLElement | null>;
103
- setContainerRef: (element: HTMLElement | null) => void;
104
- layoutBeforeDrag: TreeNode | null;
105
- setLayoutBeforeDrag: Dispatch<SetStateAction<TreeNode | null>>;
106
- }
107
93
  interface ZeugmaClassNames {
108
94
  /** CSS class applied to the root dashboard container. */
109
95
  dashboard?: string;
@@ -157,13 +143,13 @@ interface DragOverlayActiveItem {
157
143
  }
158
144
  interface ZeugmaProps {
159
145
  /** The Zeugma Controller returned by useZeugma() */
160
- controller: ZeugmaController;
146
+ controller?: ZeugmaController;
161
147
  /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
162
148
  renderDragOverlay?: (active: DragOverlayActiveItem) => ReactNode;
163
149
  /** Optional CSS class name mapping overrides for custom styles of components like panes, drop previews, overlays, etc. */
164
150
  classNames?: ZeugmaClassNames;
165
151
  /** Render function mapping unique pane nodes to React elements. Usually renders a <Pane> wrapper. */
166
- renderPane: (paneId: string) => ReactNode;
152
+ renderPane?: (paneId: string) => ReactNode;
167
153
  /** Size/thickness of the split handle resizer bars in pixels. */
168
154
  resizerSize?: number;
169
155
  /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
@@ -197,59 +183,11 @@ interface ZeugmaProps {
197
183
  /** Callback triggered when the drag-out/dismiss intent changes. */
198
184
  onDismissIntentChange?: (paneId: string | null) => void;
199
185
  }
200
- /**
201
- * State context holds reactive values that change during runtime.
202
- * All consumers of this context will re-render when any of these values change.
203
- */
204
- /**
205
- * State context — holds reactive values that change during runtime.
206
- * All consumers of this context will re-render when any of these values change.
207
- */
208
- interface ZeugmaStateValue extends ZeugmaState, ZeugmaQueries {
209
- /** Callback to update the layout tree. */
210
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
211
- /** Programmatically updates the global locked status. */
212
- setLocked: Dispatch<SetStateAction<boolean>>;
213
- /** Normalized or overridden CSS classes for custom layout styling. */
214
- classNames: ZeugmaClassNames;
215
- /** Render function mapping unique pane nodes to React elements. */
216
- renderPane: (paneId: string) => ReactNode;
217
- /** The ID of the active dragged item (pane or tab). */
218
- activeId: string | null;
219
- /** The type of the active dragged item ('pane' | 'tab'). */
220
- activeType: 'pane' | 'tab' | null;
221
- /** The ID of the item with active dismiss intent, or null. */
222
- dismissIntentId: string | null;
223
- setContainerRef: (element: HTMLElement | null) => void;
224
- onRemove?: (paneId: string) => void;
225
- onFullscreenChange?: (paneId: string | null) => void;
226
- snapThreshold?: number;
227
- onResizeStart?: (currentNode: SplitNode) => void;
228
- onResize?: (currentNode: SplitNode, percentage: number) => void;
229
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
230
- minSplitPercentage?: number;
231
- maxSplitPercentage?: number;
232
- }
233
- interface ZeugmaDragStateValue {
234
- /** The ID of the tab currently hovered over during a tab drag, or null. */
235
- overTabId: string | null;
236
- /** The position of the tab drop preview relative to the hovered tab ('before' | 'after'). */
237
- overTabPosition: 'before' | 'after' | null;
238
- }
239
- /**
240
- * Actions context — holds stable dispatch functions with permanent identity.
241
- * Consumers of only this context will never re-render from layout/drag state changes.
242
- */
243
- interface ZeugmaActionsValue extends ZeugmaActions {
244
- /** Programmatically sets the fullscreen pane ID. */
245
- setFullscreenPaneId: (paneId: string | null) => void;
246
- /** Programmatically updates the global locked status. */
247
- setLocked: Dispatch<SetStateAction<boolean>>;
248
- }
249
- interface PortalRegistryValue {
250
- registerPortalTarget: (tabId: string, el: HTMLDivElement | null) => void;
251
- registerRenderCallback: (tabId: string, render: (tab: TabDetails) => ReactNode) => void;
252
- renderCallbacksRef: RefObject<Record<string, (tab: TabDetails) => ReactNode>>;
186
+ interface ZeugmaProviderProps extends Omit<ZeugmaProps, 'controller'> {
187
+ /** The Zeugma Controller returned by useZeugma() */
188
+ controller: ZeugmaController;
189
+ /** Children components that will have access to the Zeugma context */
190
+ children: ReactNode;
253
191
  }
254
192
 
255
- export type { DragOverlayActiveItem as D, PortalRegistryValue as P, SplitDirection as S, TreeNode as T, UseZeugmaOptions as U, ZeugmaActionsValue as Z, ZeugmaDragStateValue as a, ZeugmaStateValue as b, ZeugmaController as c, ZeugmaProps as d, SplitNode as e, TabDetails as f, PaneNode as g, ZeugmaActions as h, ZeugmaClassNames as i, ZeugmaControllerInternal as j, ZeugmaQueries as k, ZeugmaState as l, ZeugmaStateSetters as m };
193
+ export type { DragOverlayActiveItem as D, PaneNode as P, SplitDirection as S, TreeNode as T, UseZeugmaOptions as U, ZeugmaController as Z, ZeugmaProps as a, ZeugmaProviderProps as b, SplitNode as c, TabDetails as d, ZeugmaClassNames as e };
@@ -1,4 +1,4 @@
1
- import { ReactNode, RefObject, Dispatch, SetStateAction } from 'react';
1
+ import { Dispatch, SetStateAction, ReactNode } from 'react';
2
2
 
3
3
  type SplitDirection = 'row' | 'column';
4
4
  interface SplitNode {
@@ -90,20 +90,6 @@ interface ZeugmaQueries {
90
90
  }
91
91
  interface ZeugmaController extends ZeugmaState, ZeugmaStateSetters, ZeugmaActions, ZeugmaQueries {
92
92
  }
93
- /** @internal Internal controller containing transient drag-and-drop orchestration state. */
94
- interface ZeugmaControllerInternal extends ZeugmaController {
95
- _internalSetLayout: Dispatch<SetStateAction<TreeNode | null>>;
96
- activeId: string | null;
97
- setActiveId: Dispatch<SetStateAction<string | null>>;
98
- activeType: 'pane' | 'tab' | null;
99
- setActiveType: Dispatch<SetStateAction<'pane' | 'tab' | null>>;
100
- dismissIntentId: string | null;
101
- setDismissIntentId: Dispatch<SetStateAction<string | null>>;
102
- containerRef: RefObject<HTMLElement | null>;
103
- setContainerRef: (element: HTMLElement | null) => void;
104
- layoutBeforeDrag: TreeNode | null;
105
- setLayoutBeforeDrag: Dispatch<SetStateAction<TreeNode | null>>;
106
- }
107
93
  interface ZeugmaClassNames {
108
94
  /** CSS class applied to the root dashboard container. */
109
95
  dashboard?: string;
@@ -157,13 +143,13 @@ interface DragOverlayActiveItem {
157
143
  }
158
144
  interface ZeugmaProps {
159
145
  /** The Zeugma Controller returned by useZeugma() */
160
- controller: ZeugmaController;
146
+ controller?: ZeugmaController;
161
147
  /** Custom overlay renderer function used to customize the cursor-following drag preview for an active pane or tab. */
162
148
  renderDragOverlay?: (active: DragOverlayActiveItem) => ReactNode;
163
149
  /** Optional CSS class name mapping overrides for custom styles of components like panes, drop previews, overlays, etc. */
164
150
  classNames?: ZeugmaClassNames;
165
151
  /** Render function mapping unique pane nodes to React elements. Usually renders a <Pane> wrapper. */
166
- renderPane: (paneId: string) => ReactNode;
152
+ renderPane?: (paneId: string) => ReactNode;
167
153
  /** Size/thickness of the split handle resizer bars in pixels. */
168
154
  resizerSize?: number;
169
155
  /** Minimum pixel distance that a user must drag a pane handle before dragging triggers. Defaults to 8. */
@@ -197,59 +183,11 @@ interface ZeugmaProps {
197
183
  /** Callback triggered when the drag-out/dismiss intent changes. */
198
184
  onDismissIntentChange?: (paneId: string | null) => void;
199
185
  }
200
- /**
201
- * State context holds reactive values that change during runtime.
202
- * All consumers of this context will re-render when any of these values change.
203
- */
204
- /**
205
- * State context — holds reactive values that change during runtime.
206
- * All consumers of this context will re-render when any of these values change.
207
- */
208
- interface ZeugmaStateValue extends ZeugmaState, ZeugmaQueries {
209
- /** Callback to update the layout tree. */
210
- setLayout: Dispatch<SetStateAction<TreeNode | null>>;
211
- /** Programmatically updates the global locked status. */
212
- setLocked: Dispatch<SetStateAction<boolean>>;
213
- /** Normalized or overridden CSS classes for custom layout styling. */
214
- classNames: ZeugmaClassNames;
215
- /** Render function mapping unique pane nodes to React elements. */
216
- renderPane: (paneId: string) => ReactNode;
217
- /** The ID of the active dragged item (pane or tab). */
218
- activeId: string | null;
219
- /** The type of the active dragged item ('pane' | 'tab'). */
220
- activeType: 'pane' | 'tab' | null;
221
- /** The ID of the item with active dismiss intent, or null. */
222
- dismissIntentId: string | null;
223
- setContainerRef: (element: HTMLElement | null) => void;
224
- onRemove?: (paneId: string) => void;
225
- onFullscreenChange?: (paneId: string | null) => void;
226
- snapThreshold?: number;
227
- onResizeStart?: (currentNode: SplitNode) => void;
228
- onResize?: (currentNode: SplitNode, percentage: number) => void;
229
- onResizeEnd?: (currentNode: SplitNode, percentage: number) => void;
230
- minSplitPercentage?: number;
231
- maxSplitPercentage?: number;
232
- }
233
- interface ZeugmaDragStateValue {
234
- /** The ID of the tab currently hovered over during a tab drag, or null. */
235
- overTabId: string | null;
236
- /** The position of the tab drop preview relative to the hovered tab ('before' | 'after'). */
237
- overTabPosition: 'before' | 'after' | null;
238
- }
239
- /**
240
- * Actions context — holds stable dispatch functions with permanent identity.
241
- * Consumers of only this context will never re-render from layout/drag state changes.
242
- */
243
- interface ZeugmaActionsValue extends ZeugmaActions {
244
- /** Programmatically sets the fullscreen pane ID. */
245
- setFullscreenPaneId: (paneId: string | null) => void;
246
- /** Programmatically updates the global locked status. */
247
- setLocked: Dispatch<SetStateAction<boolean>>;
248
- }
249
- interface PortalRegistryValue {
250
- registerPortalTarget: (tabId: string, el: HTMLDivElement | null) => void;
251
- registerRenderCallback: (tabId: string, render: (tab: TabDetails) => ReactNode) => void;
252
- renderCallbacksRef: RefObject<Record<string, (tab: TabDetails) => ReactNode>>;
186
+ interface ZeugmaProviderProps extends Omit<ZeugmaProps, 'controller'> {
187
+ /** The Zeugma Controller returned by useZeugma() */
188
+ controller: ZeugmaController;
189
+ /** Children components that will have access to the Zeugma context */
190
+ children: ReactNode;
253
191
  }
254
192
 
255
- export type { DragOverlayActiveItem as D, PortalRegistryValue as P, SplitDirection as S, TreeNode as T, UseZeugmaOptions as U, ZeugmaActionsValue as Z, ZeugmaDragStateValue as a, ZeugmaStateValue as b, ZeugmaController as c, ZeugmaProps as d, SplitNode as e, TabDetails as f, PaneNode as g, ZeugmaActions as h, ZeugmaClassNames as i, ZeugmaControllerInternal as j, ZeugmaQueries as k, ZeugmaState as l, ZeugmaStateSetters as m };
193
+ export type { DragOverlayActiveItem as D, PaneNode as P, SplitDirection as S, TreeNode as T, UseZeugmaOptions as U, ZeugmaController as Z, ZeugmaProps as a, ZeugmaProviderProps as b, SplitNode as c, TabDetails as d, ZeugmaClassNames as e };
package/dist/utils.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as PaneNode, e as SplitNode, S as SplitDirection, T as TreeNode, f as TabDetails } from './types-B9LrYapR.cjs';
1
+ import { P as PaneNode, c as SplitNode, S as SplitDirection, T as TreeNode, d as TabDetails } from './types-BN5W7EvY.cjs';
2
2
  import 'react';
3
3
 
4
4
  declare function generateUniqueId(): string;
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as PaneNode, e as SplitNode, S as SplitDirection, T as TreeNode, f as TabDetails } from './types-B9LrYapR.js';
1
+ import { P as PaneNode, c as SplitNode, S as SplitDirection, T as TreeNode, d as TabDetails } from './types-BN5W7EvY.js';
2
2
  import 'react';
3
3
 
4
4
  declare function generateUniqueId(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-zeugma",
3
- "version": "6.4.0",
3
+ "version": "6.4.1",
4
4
  "description": "Recursive drag-and-drop dashboard layout engine for React — combining the tree-based splitting of react-mosaic with the declarative API of react-grid-layout.",
5
5
  "type": "module",
6
6
  "sideEffects": false,