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/README.md +34 -6
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -295
- package/dist/index.d.ts +4 -295
- 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/README.md
CHANGED
|
@@ -132,10 +132,10 @@ A custom state hook that initializes and manages the recursive layout tree and h
|
|
|
132
132
|
|
|
133
133
|
A custom React context hook that returns the unified layout controller properties and state actions. Must be used within a `<Zeugma>` provider component.
|
|
134
134
|
|
|
135
|
-
Provides direct access to the current layout state (e.g., `layout`, `locked`) and mutation actions (e.g., `addPane`, `removePane`, `updateTabMetadata`, `removeTab`, `selectTab`, etc.).
|
|
135
|
+
Provides direct access to the current layout state (e.g., `layout`, `locked`), state setters (e.g., `setLocked`), queries (e.g., `findTabById`, `findPaneContainingTab`, `findPaneById`), and mutation actions (e.g., `addPane`, `removePane`, `updateTabMetadata`, `removeTab`, `selectTab`, etc.).
|
|
136
136
|
|
|
137
137
|
```ts
|
|
138
|
-
const { layout, locked,
|
|
138
|
+
const { layout, locked, findTabById, setLocked } = useZeugmaContext()
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
### `<PaneTree>`
|
|
@@ -196,7 +196,7 @@ A vertical-resize container wrapper that wraps any node (typically `<PaneTree />
|
|
|
196
196
|
|
|
197
197
|
## Tree Utilities
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
Import these serializable tree utility functions from `react-zeugma/utils` for programmatically mutating or querying layout schemas.
|
|
200
200
|
|
|
201
201
|
#### `removePane(tree: TreeNode | null, id: string): TreeNode | null`
|
|
202
202
|
|
|
@@ -210,10 +210,18 @@ Recursively matches the bottommost/rightmost pane leaf in the tree, splits it, a
|
|
|
210
210
|
|
|
211
211
|
Splits the targeted `targetId` pane inside the tree with `direction` (_row_ / _column_) and type (_left_, _right_, _top_, _bottom_) to insert `paneToAdd`.
|
|
212
212
|
|
|
213
|
-
#### `
|
|
213
|
+
#### `findPaneById(tree: TreeNode | null, paneId: string): PaneNode | null`
|
|
214
214
|
|
|
215
215
|
Recursively searches the layout tree and returns the target `PaneNode` if found, or `null` otherwise.
|
|
216
216
|
|
|
217
|
+
#### `findPaneContainingTab(tree: TreeNode | null, tabId: string): PaneNode | null`
|
|
218
|
+
|
|
219
|
+
Recursively searches the layout tree and returns the `PaneNode` containing the specified `tabId`.
|
|
220
|
+
|
|
221
|
+
#### `findTabById(tree: TreeNode | null, tabId: string): TabDetails | null`
|
|
222
|
+
|
|
223
|
+
Searches the layout tree for the given `tabId` and returns computed details (parent `paneId`, `isActive`, `index`, and custom `metadata`).
|
|
224
|
+
|
|
217
225
|
---
|
|
218
226
|
|
|
219
227
|
## Custom Styling
|
|
@@ -262,6 +270,14 @@ export interface PaneNode {
|
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
export type TreeNode = SplitNode | PaneNode
|
|
273
|
+
|
|
274
|
+
export interface TabDetails {
|
|
275
|
+
id: string
|
|
276
|
+
paneId: string
|
|
277
|
+
isActive: boolean
|
|
278
|
+
index: number
|
|
279
|
+
metadata: Record<string, unknown> | undefined
|
|
280
|
+
}
|
|
265
281
|
```
|
|
266
282
|
|
|
267
283
|
---
|
|
@@ -309,6 +325,14 @@ export interface PaneNode {
|
|
|
309
325
|
}
|
|
310
326
|
|
|
311
327
|
export type TreeNode = SplitNode | PaneNode
|
|
328
|
+
|
|
329
|
+
export interface TabDetails {
|
|
330
|
+
id: string
|
|
331
|
+
paneId: string
|
|
332
|
+
isActive: boolean
|
|
333
|
+
index: number
|
|
334
|
+
metadata: Record<string, unknown> | undefined
|
|
335
|
+
}
|
|
312
336
|
```
|
|
313
337
|
|
|
314
338
|
- **`PaneNode` (Leaf):** Represents a single content pane. It must have a unique `paneId`.
|
|
@@ -433,7 +457,7 @@ A vertical-resize container wrapper that wraps any node (typically `<PaneTree />
|
|
|
433
457
|
|
|
434
458
|
## 3. Programmatic State Utilities
|
|
435
459
|
|
|
436
|
-
Import these helpers from `react-zeugma` to manipulate the tree layout programmatically in your state handlers:
|
|
460
|
+
Import these helpers from `react-zeugma/utils` to manipulate or query the tree layout programmatically in your state handlers:
|
|
437
461
|
|
|
438
462
|
- **`removePane(tree: TreeNode | null, idToRemove: string): TreeNode | null`**
|
|
439
463
|
Removes a pane from the tree and collapses the leftover sibling split node.
|
|
@@ -441,8 +465,12 @@ Import these helpers from `react-zeugma` to manipulate the tree layout programma
|
|
|
441
465
|
Splits a specific target pane by nesting it under a new `SplitNode` along with a new pane.
|
|
442
466
|
- **`updateTabMetadata(tree: TreeNode | null, tabId: string, updater: (current: Record<string, unknown> | undefined) => Record<string, unknown> | undefined): TreeNode | null`**
|
|
443
467
|
Updates the metadata of a specific tab.
|
|
444
|
-
- **`
|
|
468
|
+
- **`findPaneById(tree: TreeNode | null, paneId: string): PaneNode | null`**
|
|
445
469
|
Recursively searches the layout tree and returns the target `PaneNode` if found, or `null` otherwise.
|
|
470
|
+
- **`findPaneContainingTab(tree: TreeNode | null, tabId: string): PaneNode | null`**
|
|
471
|
+
Recursively searches the layout tree and returns the `PaneNode` containing the specified `tabId`.
|
|
472
|
+
- **`findTabById(tree: TreeNode | null, tabId: string): TabDetails | null`**
|
|
473
|
+
Searches the layout tree for the given `tabId` and returns computed details (parent `paneId`, `isActive`, `index`, and custom `metadata`).
|
|
446
474
|
|
|
447
475
|
---
|
|
448
476
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var At=require('react'),core=require('@dnd-kit/core'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var At__default=/*#__PURE__*/_interopDefault(At);function Ve(e){let t=At.useRef(null);return At.useEffect(()=>{if(!e){t.current=null;return}let n=r=>{t.current={x:r.clientX,y:r.clientY};},s=r=>{let o=r.touches[0]||r.changedTouches[0];o&&(t.current={x:o.clientX,y:o.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",s,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",s);}},[e]),t}function Be(e){At.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function We(){let[e,t]=At.useState({}),n=At.useRef(true);At.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=At.useCallback((r,o)=>{n.current&&t(i=>i[r]===o?i:{...i,[r]:o});},[]);return {portalTargets:e,registerPortalTarget:s}}var gt=8,bt=8,Pn=4;function le(){return "pane-"+Math.random().toString(36).substring(2,11)}function de(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=de(e.first,t),s=de(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function ce(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let r=e.tabs.filter(a=>a!==t);if(r.length===0)return null;let o=e.activeTabId;e.activeTabId===t&&(o=r[0]);let i={...e.tabsMetadata};return delete i[t],{...e,tabs:r,activeTabId:o,tabsMetadata:Object.keys(i).length>0?i:void 0}}return e}let n=ce(e.first,t),s=ce(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function be(e,t,n,s,r){if(e===null)return typeof r=="string"?{type:"pane",id:le(),tabs:[r],activeTabId:r}:r;if(e.type==="pane"){if(e.id===t){let o=typeof r=="string"?{type:"pane",id:le(),tabs:[r],activeTabId:r}:r,i=s==="left"||s==="top";return {type:"split",direction:n,first:i?o:e,second:i?e:o,splitPercentage:50}}return e}return {...e,first:be(e.first,t,n,s,r)||e.first,second:be(e.second,t,n,s,r)||e.second}}function Ue(e,t){if(e===null)return {type:"pane",id:le(),tabs:[t],activeTabId:t};function n(s,r){return s.type==="pane"?{type:"split",direction:r==="row"?"column":"row",splitPercentage:50,first:s,second:{type:"pane",id:le(),tabs:[t],activeTabId:t}}:{...s,second:n(s.second,s.direction)}}return n(e,null)}function pe(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:pe(e.first,t,n)||e.first,second:pe(e.second,t,n)||e.second}:e}function te(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:te(e.first,t)??te(e.second,t)}function G(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:G(e.first,t)??G(e.second,t)}function _e(e,t){let n=G(e,t);if(!n)return null;let s=n.tabs.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:s,metadata:n.tabsMetadata?.[t]}}function ye(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let s=e.tabsMetadata||{},r=s[t],o=n(r),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:ye(e.first,t,n)??e.first,second:ye(e.second,t,n)??e.second}}function Te(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:s,...r}=e;return r}return {...e,locked:n}}return e}return {...e,first:Te(e.first,t,n)??e.first,second:Te(e.second,t,n)??e.second}}function xe(e,t,n){return e===null?null:e.type==="pane"?e.id===t?{...e,activeTabId:n}:e:{...e,first:xe(e.first,t,n)??e.first,second:xe(e.second,t,n)??e.second}}function Ye(e,t,n){if(e===null)return null;let r=G(e,t)?.tabsMetadata?.[t],o=ce(e,t);if(o===null)return {type:"pane",id:le(),tabs:[t],activeTabId:t,tabsMetadata:r?{[t]:r}:void 0};function i(a){if(a.type==="pane"){if(a.id===n){let u=[...a.tabs];u.includes(t)||u.push(t);let m={...a.tabsMetadata};return r&&(m[t]=r),{...a,tabs:u,activeTabId:t,tabsMetadata:Object.keys(m).length>0?m:void 0}}return a}return {...a,first:i(a.first),second:i(a.second)}}return i(o)}function Xe(e,t,n,s="before"){if(e===null)return null;let o=G(e,t)?.tabsMetadata?.[t],i=ce(e,t);if(i===null)return {type:"pane",id:le(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(u){if(u.type==="pane"){if(u.tabs.includes(n)){let E=[...u.tabs].filter(S=>S!==t),v=E.indexOf(n);v<0&&(v=0),s==="after"&&(v+=1),E.splice(v,0,t);let P={...u.tabsMetadata};return o&&(P[t]=o),{...u,tabs:E,activeTabId:t,tabsMetadata:Object.keys(P).length>0?P:void 0}}return u}return {...u,first:a(u.first),second:a(u.second)}}return a(i)}function ae(e,t=0,n=0,s=100,r=100,o="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:s,height:r,node:e}],splitters:[]};let{direction:i,splitPercentage:a,first:u,second:m}=e,v={id:`splitter-${o}-${i}`,currentNode:e,direction:i,left:i==="row"?t+s*(a/100):t,top:i==="column"?n+r*(a/100):n,width:i==="row"?0:s,height:i==="column"?0:r,parentLeft:t,parentTop:n,parentWidth:s,parentHeight:r},P={panes:[],splitters:[]},S={panes:[],splitters:[]};if(i==="row"){let R=s*(a/100);P=ae(u,t,n,R,r,`${o}-L`),S=ae(m,t+R,n,s-R,r,`${o}-R`);}else {let R=r*(a/100);P=ae(u,t,n,s,R,`${o}-T`),S=ae(m,t,n+R,s,r-R,`${o}-B`);}return {panes:[...P.panes,...S.panes],splitters:[v,...P.splitters,...S.splitters]}}function he(e){try{return JSON.stringify(e)}catch{return ""}}function ht(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:i=false,dragActivationDistance:a=8,snapThreshold:u=8,minSplitPercentage:m=5,maxSplitPercentage:E=95,enableDragToDismiss:v=false,dismissThreshold:P=60,onRemove:S,onDragStart:R,onDragEnd:L,onResizeStart:f,onResize:D,onResizeEnd:g,onDismissIntentChange:C}=e,[b,I]=At.useState(()=>n!==void 0?n:t??null),[k,B]=At.useState(()=>he(n!==void 0?n:null)),[Y,$]=At.useState(r||null),[K,V]=At.useState(i),[X,Q]=At.useState(null),[ee,d]=At.useState(null),[y,Z]=At.useState(null),w=At.useRef(null),T=At.useCallback(l=>{w.current=l;},[]),c=At.useCallback(l=>{$(l),o?.(l);},[o]);if(At.useEffect(()=>{V(i);},[i]),At.useEffect(()=>{r!==void 0&&$(r);},[r]),n!==void 0){let l=he(n);l!==k&&(B(l),I(n));}let p=At.useCallback(l=>(...x)=>{let A=b,J=l(A,...x);he(A)!==he(J)&&(I(J),s?.(J));},[b,s]),h=At.useCallback(p((l,x)=>typeof x=="function"?x(l):x),[p]),ne=At.useCallback(p((l,x)=>de(l,x)),[p]),O=At.useCallback(p((l,x)=>Ue(l,x)),[p]),F=At.useCallback(p((l,x,A,J,ge)=>{let Fe=te(l,x)??G(l,x);if(!Fe)return l;let dt=te(l,ge)??G(l,ge)??{type:"pane",id:ge,tabs:[ge],activeTabId:ge},pt=de(l,ge);return be(pt,Fe.id,A,J,dt)}),[p]),q=At.useCallback(p((l,x,A)=>pe(l,x,A)),[p]),re=At.useCallback(p((l,x,A)=>ye(l,x,A)),[p]),N=At.useCallback(p((l,x,A)=>{let J=te(l,x)??G(l,x);return J?Te(l,J.id,A):l}),[p]),M=At.useCallback(p((l,x,A)=>{let J=te(l,x)??G(l,x);return J?xe(l,J.id,A):l}),[p]),z=At.useCallback(p((l,x,A)=>{let J=te(l,A)??G(l,A);return J?Ye(l,x,J.id):l}),[p]),H=At.useCallback(p((l,x,A,J)=>Xe(l,x,A,J)),[p]),U=At.useCallback(p((l,x)=>ce(l,x)),[p]),j=At.useCallback(l=>te(b,l),[b]),se=At.useCallback(l=>G(b,l),[b]),ie=At.useCallback(l=>_e(b,l),[b]);return {layout:b,setLayout:h,fullscreenPaneId:Y,setFullscreenPaneId:c,locked:K,setLocked:V,activeId:X,setActiveId:Q,activeType:ee,setActiveType:d,dismissIntentId:y,setDismissIntentId:Z,containerRef:w,setContainerRef:T,dragActivationDistance:a,snapThreshold:u,minSplitPercentage:m,maxSplitPercentage:E,enableDragToDismiss:v,dismissThreshold:P,onRemove:S,onDragStart:R,onDragEnd:L,onResizeStart:f,onResize:D,onResizeEnd:g,onDismissIntentChange:C,removePane:ne,addPane:O,splitPane:F,updateSplitPercentage:q,updateTabMetadata:re,updatePaneLock:N,selectTab:M,mergeTab:z,moveTab:H,removeTab:U,findPaneById:j,findPaneContainingTab:se,findTabById:ie}}function Se({cursor:e,resizerEl:t,onMove:n,onEnd:s}){document.body.classList.add("zeugma-resizing");let r=document.createElement("style");r.id="zeugma-global-cursor-style",r.textContent=`
|
|
2
2
|
* {
|
|
3
3
|
cursor: ${e} !important;
|
|
4
4
|
user-select: none !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=a=>{n(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 be(e){try{return JSON.stringify(e)}catch{return ""}}var Me=$t.createContext(void 0),ze=$t.createContext(void 0),xe=$t.createContext(void 0),re=()=>{let e=$t.useContext(Me);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Se=()=>{let e=$t.useContext(ze);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};function mt(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:i=false,dragActivationDistance:a=8,snapThreshold:u=8,minSplitPercentage:f=5,maxSplitPercentage:I=95,enableDragToDismiss:b=false,dismissThreshold:v=60,onRemove:R,onDragStart:y,onDragEnd:M,onResizeStart:m,onResize:D,onResizeEnd:g,onDismissIntentChange:C}=e,[T,L]=$t.useState(()=>n!==void 0?n:t??null),[$,U]=$t.useState(()=>be(n!==void 0?n:null)),[Y,z]=$t.useState(r||null),[q,V]=$t.useState(i),[B,J]=$t.useState(null),[j,d]=$t.useState(null),[x,Z]=$t.useState(null),N=$t.useRef(null),E=$t.useCallback(c=>{N.current=c;},[]),l=$t.useCallback(c=>{z(c),o?.(c);},[o]);if($t.useEffect(()=>{V(i);},[i]),$t.useEffect(()=>{r!==void 0&&z(r);},[r]),n!==void 0){let c=be(n);c!==$&&(U(c),L(n));}let p=$t.useCallback(c=>(...h)=>{let H=T,A=c(H,...h);be(H)!==be(A)&&(L(A),s?.(A));},[T,s]),P=$t.useCallback(p((c,h)=>typeof h=="function"?h(c):h),[p]),Q=$t.useCallback(p((c,h)=>ue(c,h)),[p]),W=$t.useCallback(p((c,h)=>Ve(c,h)),[p]),O=$t.useCallback(p((c,h,H,A,ne)=>{let ce=ee(c,h)??G(c,h);if(!ce)return c;let at=ee(c,ne)??G(c,ne)??{type:"pane",id:ne,tabs:[ne],activeTabId:ne},lt=ue(c,ne);return me(lt,ce.id,H,A,at)}),[p]),X=$t.useCallback(p((c,h,H)=>de(c,h,H)),[p]),F=$t.useCallback(p((c,h,H)=>he(c,h,H)),[p]),S=$t.useCallback(p((c,h,H)=>{let A=ee(c,h)??G(c,h);return A?Pe(c,A.id,H):c}),[p]),w=$t.useCallback(p((c,h,H)=>{let A=ee(c,h)??G(c,h);return A?ye(c,A.id,H):c}),[p]),k=$t.useCallback(p((c,h,H)=>{let A=ee(c,H)??G(c,H);return A?We(c,h,A.id):c}),[p]),oe=$t.useCallback(p((c,h,H,A)=>Ue(c,h,H,A)),[p]),te=$t.useCallback(p((c,h)=>ae(c,h)),[p]);return {layout:T,setLayout:P,fullscreenPaneId:Y,setFullscreenPaneId:l,locked:q,setLocked:V,activeId:B,setActiveId:J,activeType:j,setActiveType:d,dismissIntentId:x,setDismissIntentId:Z,containerRef:N,setContainerRef:E,dragActivationDistance:a,snapThreshold:u,minSplitPercentage:f,maxSplitPercentage:I,enableDragToDismiss:b,dismissThreshold:v,onRemove:R,onDragStart:y,onDragEnd:M,onResizeStart:m,onResize:D,onResizeEnd:g,onDismissIntentChange:C,removePane:Q,addPane:W,splitPane:O,updateSplitPercentage:X,updateTabMetadata:F,updatePaneLock:S,selectTab:w,mergeTab:k,moveTab:oe,removeTab:te}}var gt=()=>{let e=re(),t=Se();return {...e,...t}};var Re=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},De=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Ce(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}function Xe(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:i,setDismissIntentId:a,setOverTabId:u,setOverTabPosition:f,containerRef:I,dragActivationDistance:b,enableDragToDismiss:v,dismissThreshold:R,onRemove:y,onDragStart:M,onDragEnd:m,onDismissIntentChange:D,removeTab:g,moveTab:C,selectTab:T}=e,L=$t.useRef(null),$=Ae(s),[U,Y]=$t.useState(false);Fe(U);let z=core.useSensors(core.useSensor(Re,{activationConstraint:{distance:b}}),core.useSensor(De,{activationConstraint:{delay:250,tolerance:5}})),q=$t.useCallback(d=>{let x=core.pointerWithin(d);if(x.length>0)return x;if(d.active.id.toString().startsWith("tab-header-")){let N=d.droppableContainers.filter(E=>E.id.toString().startsWith("tab-drop-"));return core.closestCenter({...d,droppableContainers:N})}return []},[]);return {sensors:z,collisionDetection:q,onDragStart:d=>{let x=d.active.id.toString(),Z=x.startsWith("tab-header-"),N=Z?x.substring(11):x;r(N),o(Z?"tab":"pane"),u(null),f(null);let E=d.activatorEvent;if($.current=Ce(E),v&&I.current?L.current=I.current.getBoundingClientRect():L.current=null,Z){let l=G(t,N);l&&T(l.id,N);}M&&M(N);},onDragMove:d=>{let{over:x}=d,Z=x?.id.toString()||"",N=Z.startsWith("drop-locked-");Y(N);let E=Z.match(/^tab-drop-(.+)$/);if(E&&x){let[,S]=E,w=d.active.id.toString();if((w.startsWith("tab-header-")?w.substring(11):w)!==S){let te="before",c=x.rect,h=d.activatorEvent,H=null;if($.current)H=$.current.x;else {let A=Ce(h);A&&(H=A.x+d.delta.x);}if(H!==null){let A=c.left+c.width/2;H>A&&(te="after");}u(S),f(te);}else u(null),f(null);}else u(null),f(null);if(!v)return;let l=d.active.id.toString(),_=l.startsWith("tab-header-")?l.substring(11):l,P=L.current;if(!P){i!==null&&(a(null),D?.(null));return}let Q=d.activatorEvent,W=null,O=null;if($.current)W=$.current.x,O=$.current.y;else {let S=Ce(Q);S&&(W=S.x+d.delta.x,O=S.y+d.delta.y);}let X=0;if(W!==null&&O!==null){let S=0,w=0;W<P.left?S=P.left-W:W>P.right&&(S=W-P.right),O<P.top?w=P.top-O:O>P.bottom&&(w=O-P.bottom),X=Math.sqrt(S*S+w*w);}else {let S=d.active.rect.current.translated;if(S){let w=S.left+S.width/2,k=S.top+S.height/2,oe=0,te=0;w<P.left?oe=P.left-w:w>P.right&&(oe=w-P.right),k<P.top?te=P.top-k:k>P.bottom&&(te=k-P.bottom),X=Math.sqrt(oe*oe+te*te);}}X>R?i!==_&&(a(_),D?.(_)):i!==null&&(a(null),D?.(null));},onDragEnd:d=>{r(null),o(null),Y(false),u(null),f(null);let{active:x,over:Z}=d,N=x.id.toString(),E=N.startsWith("tab-header-"),l=E?N.substring(11):N,p=v&&i===l;if(a(null),D?.(null),L.current=null,p){y?y(l):g(l),m&&m(l,null,null);return}if(!Z){m&&m(l,null,null);return}let _=Z.id.toString();if(_.startsWith("drop-locked-")){m&&m(l,null,null);return}let P=_.match(/^tab-drop-(.+)$/);if(P){let[,c]=P;if(l!==c){let h="before",H=Z.rect,A=d.activatorEvent,ne=null;if($.current)ne=$.current.x;else {let ce=Ce(A);ce&&(ne=ce.x+d.delta.x);}if(ne!==null){let ce=H.left+H.width/2;ne>ce&&(h="after");}C(l,c,h),m&&m(l,c,{type:"move",position:"center"});}else m&&m(l,null,null);return}let Q=_.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!Q){m&&m(l,null,null);return}let[,W,O]=Q,X=E?G(t,l):ee(t,l),F=X&&X.id===O,S=X&&X.tabs.length===1;if(l===O||F&&S){m&&m(l,null,null);return}let w=W==="left"||W==="right"?"row":"column",k;if(E){let h=G(t,l)?.tabsMetadata?.[l];k={type:"pane",id:ie(),tabs:[l],activeTabId:l,tabsMetadata:h?{[l]:h}:void 0};}else k=ee(t,l)??{type:"pane",id:ie(),tabs:[l],activeTabId:l};let oe=E?ae(t,l):ue(t,l),te=me(oe,O,w,W,k);n(te),m&&m(l,O,{type:"split",direction:w,position:W});},onDragCancel:()=>{r(null),o(null),Y(false),u(null),f(null),a(null),D?.(null),L.current=null;}}}var qe=({activeId:e,render:t,className:n})=>{let s=$t.useRef(null);return $t.useEffect(()=>{let r=o=>{s.current&&(s.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",r),()=>document.removeEventListener("pointermove",r)},[]),jsxRuntime.jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var Je=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=$t.useState(false),o=$t.useRef(null);if($t.useEffect(()=>{r(true);},[]),$t.useEffect(()=>{if(!s||!o.current)return;let a=o.current;if(t)t.appendChild(a);else {let u=document.getElementById("zeugma-hidden-portal-container");u||(u=document.createElement("div"),u.id="zeugma-hidden-portal-container",u.style.display="none",document.body.appendChild(u)),u.appendChild(a);}},[t,s]),$t.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||!n?null:reactDom.createPortal(n(e),i)};var Lt=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:i,layout:a,setLayout:u,fullscreenPaneId:f,setFullscreenPaneId:I,locked:b,activeId:v,activeType:R,dismissIntentId:y,setContainerRef:M,snapThreshold:m,minSplitPercentage:D,maxSplitPercentage:g,onRemove:C,onResizeStart:T,onResize:L,onResizeEnd:$,removePane:U,addPane:Y,updateTabMetadata:z,updatePaneLock:q,selectTab:V,mergeTab:B,removeTab:J}=t,{portalTargets:j,registerPortalTarget:d}=Oe(),[x,Z]=$t.useState(null),[N,E]=$t.useState(null),l=Xe({...t,setOverTabId:Z,setOverTabPosition:E}),p=$t.useCallback(F=>n(F),[n]),_=$t.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),P=$t.useCallback((F,S)=>{$&&$(F,S);},[$]),Q=$t.useMemo(()=>({layout:a,setLayout:u,renderPane:p,activeId:v,dismissIntentId:y,overTabId:x,overTabPosition:N,setContainerRef:M,fullscreenPaneId:f,classNames:_,onRemove:C,onFullscreenChange:I,snapThreshold:m,onResizeStart:T,onResize:L,onResizeEnd:P,minSplitPercentage:D,maxSplitPercentage:g,locked:b}),[a,v,y,x,N,M,f,_,C,I,m,T,L,D,g,u,p,P,b]),W=$t.useMemo(()=>({removePane:U,addPane:Y,updateTabMetadata:z,updatePaneLock:q,selectTab:V,mergeTab:B,removeTab:J}),[U,Y,z,q,V,B,J]),O=$t.useMemo(()=>{let F=[];function S(w){w&&(w.type==="pane"?F.push(...w.tabs):(S(w.first),S(w.second)));}return S(a),F},[a]),X=$t.useMemo(()=>({registerPortalTarget:d}),[d]);return jsxRuntime.jsx(ze.Provider,{value:W,children:jsxRuntime.jsx(Me.Provider,{value:Q,children:jsxRuntime.jsxs(xe.Provider,{value:X,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...l,children:i}),v&&R&&r&&jsxRuntime.jsx(qe,{activeId:v,render:F=>r(F,R),className:`${o.dragOverlay||""} ${v===y&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:O.map(F=>jsxRuntime.jsx(Je,{tabId:F,target:j[F]||null,renderWidget:s},F))})]})})})};function Ze({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:i,currentNode:a,onLayoutChange:u,onResizeStart:f,onResizeEnd:I,parentLeft:b,parentTop:v,parentWidth:R,parentHeight:y}){let{onResizeStart:M,onResize:m,onResizeEnd:D,minSplitPercentage:g=5,maxSplitPercentage:C=95,locked:T=false}=re();return $t.useCallback(L=>{if(T)return;L.preventDefault();let $=e.current;if(!$)return;f&&f(),M&&M(a);let U=$.getBoundingClientRect(),Y=L.clientX,z=L.clientY,q=s,V=L.currentTarget,B=U.left+U.width*(b/100),J=U.top+U.height*(v/100),j=U.width*(R/100),d=U.height*(y/100),Z=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(E=>E!==V&&E.getAttribute("data-direction")===n).map(E=>{let l=E.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),N=q;Te({cursor:t?"col-resize":"row-resize",resizerEl:V,onMove:E=>{let l=t?(E.clientX-Y)/j*100:(E.clientY-z)/d*100,p=q+l,_=t?B+(j-r)*(p/100)+r/2:J+(d-r)*(p/100)+r/2,P=1/0,Q=null;for(let F of Z){let S=Math.abs(_-F);S<o&&S<P&&(P=S,Q=F);}let W=p;Q!==null&&(W=t?(Q-r/2-B)/(j-r)*100:(Q-r/2-J)/(d-r)*100);let O=Math.max(g,Math.min(C,W));N=O;let X=de(i,a,O);if(X){let{panes:F,splitters:S}=se(X),w=e.current;if(w){for(let k of F)w.style.setProperty(`--pane-left-${k.paneId}`,`${k.left}%`),w.style.setProperty(`--pane-top-${k.paneId}`,`${k.top}%`),w.style.setProperty(`--pane-width-${k.paneId}`,`${k.width}%`),w.style.setProperty(`--pane-height-${k.paneId}`,`${k.height}%`);for(let k of S)w.style.setProperty(`--splitter-pos-${k.id}`,`${k.direction==="row"?k.left:k.top}%`);}}m&&m(a,O);},onEnd:()=>{let E=de(i,a,N),l=e.current;if(l){let{panes:p,splitters:_}=se(E);for(let P of p)l.style.removeProperty(`--pane-left-${P.paneId}`),l.style.removeProperty(`--pane-top-${P.paneId}`),l.style.removeProperty(`--pane-width-${P.paneId}`),l.style.removeProperty(`--pane-height-${P.paneId}`);for(let P of _)l.style.removeProperty(`--splitter-pos-${P.id}`);}u(E),I&&I(),D&&D(a,N);}});},[e,t,n,s,r,o,i,a,u,f,I,M,m,D,g,C,b,v,R,y])}var At=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:i,locked:a}=re(),[u,f]=$t.useState(false),{currentNode:I,direction:b,left:v,top:R,width:y,height:M,parentLeft:m,parentTop:D,parentWidth:g,parentHeight:C}=e,T=b==="row",L=Ze({containerRef:s,isRow:T,direction:b,splitPercentage:I.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:I,onLayoutChange:o,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:m,parentTop:D,parentWidth:g,parentHeight:C}),$=T?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${v}%) - ${t/2}px)`,top:`calc(${R}% + ${t/2}px)`,width:`${t}px`,height:`calc(${M}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${v}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${R}%) - ${t/2}px)`,width:`calc(${y}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:i.resizer||"","data-direction":b,"data-resizing":u||void 0,style:$,onPointerDown:L,role:"separator","aria-valuenow":I.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},Ft=$t__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),Ot=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:i,setContainerRef:a,fullscreenPaneId:u,snapThreshold:f,locked:I,classNames:b}=re(),v=n!==void 0?n:f??8,R=e!==void 0?e:s,y=$t.useRef(null),{panes:M,splitters:m}=$t.useMemo(()=>R?se(R):{panes:[],splitters:[]},[R]);if(!R)return null;let D=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M.map(g=>{let C=u===g.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:C?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:C?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:C?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:C?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:C?20:1,display:u&&!C?"none":"block",padding:C?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(Ft,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&m.map(g=>jsxRuntime.jsx(At,{splitter:g,resizerSize:t,snapThreshold:v,containerRef:y},g.id))]});if(e===void 0){let g=o!==null&&o===i,C=L=>{a(L),y.current=L;},T=`${b.dashboard||""} ${g&&b.dashboardDismissActive||""} ${I&&b.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:C,className:T,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})}return jsxRuntime.jsx("div",{ref:y,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})};var nt="zeugma-height:",_t="default-pane";function Yt(e){try{let t=localStorage.getItem(nt+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function tt(e,t){try{localStorage.setItem(nt+e,String(Math.round(t)));}catch{}}var rt=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:i,localStorageKey:a,resizerHeight:u=6,className:f,resizerClassName:I})=>{let b=i?a||_t:null,v=()=>{let T=(b?Yt(b):null)??n??400;return Ee(T,r,o)},[R,y]=$t.useState(v),M=$t.useRef(null),m=b?R:n??R,D=$t.useRef(n);$t.useEffect(()=>{if(n!==void 0&&n!==D.current){let T=Ee(n,r,o);y(T),b&&tt(b,T);}D.current=n;},[n,r,o,b]);let g=$t.useCallback(()=>o,[o]),C=$t.useCallback(T=>{T.preventDefault();let L=T.clientY,$=m,U=g(),Y=T.currentTarget,z=ot(M.current),q=z?z.scrollTop:0,V=L,B=null,J=(d,x)=>{let Z=x-q,E=d-L+Z,l=Ee($+E,r,U);return M.current&&(M.current.style.height=`${l}px`),l},j=()=>{if(!z)return;let d=z===document.documentElement||z===document.body?{top:0,bottom:window.innerHeight}:z.getBoundingClientRect(),x=40,Z=10,N=0;V>d.bottom-x?N=Math.min(1,(V-(d.bottom-x))/x)*Z:V<d.top+x&&(N=-Math.min(1,(d.top+x-V)/x)*Z),N!==0&&(z.scrollTop+=N,J(V,z.scrollTop)),B=requestAnimationFrame(j);};B=requestAnimationFrame(j),Te({cursor:"row-resize",resizerEl:Y,onMove:d=>{V=d.clientY,z&&J(V,z.scrollTop);},onEnd:()=>{B!==null&&cancelAnimationFrame(B);let d=$;M.current&&(d=M.current.getBoundingClientRect().height),d=Ee(d,r,U),y(d),s&&s(d),b&&tt(b,d);}});},[m,r,g,s,b]);return t?jsxRuntime.jsxs("div",{ref:M,className:`zeugma-resizable-container ${f||""}`.trim(),style:{height:`${m}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsxRuntime.jsx("div",{className:`zeugma-resizable-handle ${I||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:C,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(m),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsxRuntime.jsx("div",{className:`zeugma-resizable-container disabled ${f||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsxRuntime.jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ee(e,t,n){return Math.max(t,Math.min(n,e))}function ot(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:ot(t)}var Ne=$t.createContext(null);var en={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"}},st=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:s,style:en[t]}),r&&jsxRuntime.jsx("div",{className:n,style:tn[t]})]})},nn=({id:e,children:t,style:n,locked:s=false})=>{let r=$t.useRef(null),{layout:o,activeId:i,classNames:a,fullscreenPaneId:u,onFullscreenChange:f,locked:I}=re(),{removePane:b,updateTabMetadata:v,selectTab:R,removeTab:y}=Se(),M=$t.useContext(xe);if(!M)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:m}=M,D=$t.useMemo(()=>ee(o,e),[o,e]),g=D?.id??e,C=D?.tabs??[e],T=D?.activeTabId??e,L=D?.tabsMetadata,$=L?.[e],U=D?.locked??false,Y=s||U,z=I||Y,q=I||Y,V=i!==null&&i!==e&&(!C.includes(i)||C.length>1)&&!q,{attributes:B,listeners:J,setNodeRef:j}=core.useDraggable({id:e,disabled:z}),d=i!==null&&C.includes(i),x=u===e,Z=$t.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${T}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[T]);$t.useEffect(()=>{let p=r.current;return m(T,p),()=>{m(T,null);}},[T,m]);let N=$t.useMemo(()=>({isDragging:d,isFullscreen:x,toggleFullscreen:()=>f?.(x?null:e),remove:()=>{x&&f?.(null),b(g);},metadata:$,updateMetadata:p=>{v(e,p);},locked:z,tabs:C,activeTabId:T,selectTab:p=>R(g,p),removeTab:p=>{x&&p===T&&f?.(null),y(p);},tabsMetadata:L,updateTabMetadata:(p,_)=>{v(p,_);},renderActiveTab:Z}),[d,x,f,e,y,$,v,z,C,T,R,g,L,Z]),E=$t.useMemo(()=>z?{disabled:true}:{...J,...B},[J,B,z]),l=`${a.pane||""} ${Y&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(Ne.Provider,{value:E,children:jsxRuntime.jsxs("div",{ref:j,className:l,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(N),V&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(p=>jsxRuntime.jsx(st,{id:`drop-${p}-${e}`,position:p,activeClassName:a.dropPreview},p))}),i!==null&&i!==e&&q&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(st,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})};var sn=({children:e,className:t,style:n})=>{let s=$t.useContext(Ne);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsxRuntime.jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var un=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:i={},overTabId:a,overTabPosition:u}=re(),f=t||o,{attributes:I,listeners:b,setNodeRef:v,isDragging:R}=core.useDraggable({id:`tab-header-${e}`,disabled:f}),{setNodeRef:y,isOver:M}=core.useDroppable({id:`tab-drop-${e}`,disabled:f}),m=C=>{v(C),y(C);},D=M&&a===e,g=D?u:null;return jsxRuntime.jsxs("div",{ref:m,className:s,style:{display:"inline-flex",position:"relative",cursor:f?"default":"grab",...r},...f?{}:b,...f?{}:I,children:[n({isDragging:R,isOver:D}),D&&g&&jsxRuntime.jsx("div",{className:i.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:g==="before"?0:void 0,right:g==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=pt;exports.DEFAULT_RESIZER_SIZE=gn;exports.DEFAULT_SNAP_THRESHOLD=dt;exports.DragHandle=sn;exports.Pane=nn;exports.PaneTree=Ot;exports.PortalRegistryContext=xe;exports.ResizableContainer=rt;exports.Tab=un;exports.Zeugma=Lt;exports.ZeugmaActionsContext=ze;exports.ZeugmaStateContext=Me;exports.addPane=Ve;exports.computeLayout=se;exports.createDragSession=Te;exports.findPaneById=ee;exports.findPaneContainingTab=G;exports.generateUniqueId=ie;exports.mergeTab=We;exports.moveTab=Ue;exports.removePane=ue;exports.removeTab=ae;exports.safeJsonStringify=be;exports.selectTab=ye;exports.splitPane=me;exports.updatePaneLock=Pe;exports.updateSplitPercentage=de;exports.updateTabMetadata=he;exports.useResizer=Ze;exports.useZeugma=mt;exports.useZeugmaActions=Se;exports.useZeugmaContext=gt;exports.useZeugmaState=re;//# sourceMappingURL=index.cjs.map
|
|
6
|
+
`,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=a=>{n(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);}var $e=At.createContext(void 0),Ze=At.createContext(void 0),Re=At.createContext(void 0),oe=()=>{let e=At.useContext($e);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},De=()=>{let e=At.useContext(Ze);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var Pt=()=>{let e=oe(),t=De();return {...e,...t}};var Ce=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Ee=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function we(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}function Ke(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:i,setDismissIntentId:a,setOverTabId:u,setOverTabPosition:m,containerRef:E,dragActivationDistance:v,enableDragToDismiss:P,dismissThreshold:S,onRemove:R,onDragStart:L,onDragEnd:f,onDismissIntentChange:D,removeTab:g,moveTab:C,selectTab:b}=e,I=At.useRef(null),k=Ve(s),[B,Y]=At.useState(false);Be(B);let $=core.useSensors(core.useSensor(Ce,{activationConstraint:{distance:v}}),core.useSensor(Ee,{activationConstraint:{delay:250,tolerance:5}})),K=At.useCallback(d=>{let y=core.pointerWithin(d);if(y.length>0)return y;if(d.active.id.toString().startsWith("tab-header-")){let w=d.droppableContainers.filter(T=>T.id.toString().startsWith("tab-drop-"));return core.closestCenter({...d,droppableContainers:w})}return []},[]);return {sensors:$,collisionDetection:K,onDragStart:d=>{let y=d.active.id.toString(),Z=y.startsWith("tab-header-"),w=Z?y.substring(11):y;r(w),o(Z?"tab":"pane"),u(null),m(null);let T=d.activatorEvent;if(k.current=we(T),P&&E.current?I.current=E.current.getBoundingClientRect():I.current=null,Z){let c=G(t,w);c&&b(c.id,w);}L&&L(w);},onDragMove:d=>{let{over:y}=d,Z=y?.id.toString()||"",w=Z.startsWith("drop-locked-");Y(w);let T=Z.match(/^tab-drop-(.+)$/);if(T&&y){let[,N]=T,M=d.active.id.toString();if((M.startsWith("tab-header-")?M.substring(11):M)!==N){let U="before",j=y.rect,se=d.activatorEvent,ie=null;if(k.current)ie=k.current.x;else {let l=we(se);l&&(ie=l.x+d.delta.x);}if(ie!==null){let l=j.left+j.width/2;ie>l&&(U="after");}u(N),m(U);}else u(null),m(null);}else u(null),m(null);if(!P)return;let c=d.active.id.toString(),W=c.startsWith("tab-header-")?c.substring(11):c,h=I.current;if(!h){i!==null&&(a(null),D?.(null));return}let ne=d.activatorEvent,O=null,F=null;if(k.current)O=k.current.x,F=k.current.y;else {let N=we(ne);N&&(O=N.x+d.delta.x,F=N.y+d.delta.y);}let q=0;if(O!==null&&F!==null){let N=0,M=0;O<h.left?N=h.left-O:O>h.right&&(N=O-h.right),F<h.top?M=h.top-F:F>h.bottom&&(M=F-h.bottom),q=Math.sqrt(N*N+M*M);}else {let N=d.active.rect.current.translated;if(N){let M=N.left+N.width/2,z=N.top+N.height/2,H=0,U=0;M<h.left?H=h.left-M:M>h.right&&(H=M-h.right),z<h.top?U=h.top-z:z>h.bottom&&(U=z-h.bottom),q=Math.sqrt(H*H+U*U);}}q>S?i!==W&&(a(W),D?.(W)):i!==null&&(a(null),D?.(null));},onDragEnd:d=>{r(null),o(null),Y(false),u(null),m(null);let{active:y,over:Z}=d,w=y.id.toString(),T=w.startsWith("tab-header-"),c=T?w.substring(11):w,p=P&&i===c;if(a(null),D?.(null),I.current=null,p){R?R(c):g(c),f&&f(c,null,null);return}if(!Z){f&&f(c,null,null);return}let W=Z.id.toString();if(W.startsWith("drop-locked-")){f&&f(c,null,null);return}let h=W.match(/^tab-drop-(.+)$/);if(h){let[,j]=h;if(c!==j){let se="before",ie=Z.rect,l=d.activatorEvent,x=null;if(k.current)x=k.current.x;else {let A=we(l);A&&(x=A.x+d.delta.x);}if(x!==null){let A=ie.left+ie.width/2;x>A&&(se="after");}C(c,j,se),f&&f(c,j,{type:"move",position:"center"});}else f&&f(c,null,null);return}let ne=W.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!ne){f&&f(c,null,null);return}let[,O,F]=ne,q=T?G(t,c):te(t,c),re=q&&q.id===F,N=q&&q.tabs.length===1;if(c===F||re&&N){f&&f(c,null,null);return}let M=O==="left"||O==="right"?"row":"column",z;if(T){let se=G(t,c)?.tabsMetadata?.[c];z={type:"pane",id:le(),tabs:[c],activeTabId:c,tabsMetadata:se?{[c]:se}:void 0};}else z=te(t,c)??{type:"pane",id:le(),tabs:[c],activeTabId:c};let H=T?ce(t,c):de(t,c),U=be(H,F,M,O,z);n(U),f&&f(c,F,{type:"split",direction:M,position:O});},onDragCancel:()=>{r(null),o(null),Y(false),u(null),m(null),a(null),D?.(null),I.current=null;}}}var je=({activeId:e,render:t,className:n})=>{let s=At.useRef(null);return At.useEffect(()=>{let r=o=>{s.current&&(s.current.style.transform=`translate(${o.clientX+12}px, ${o.clientY+12}px)`);};return document.addEventListener("pointermove",r),()=>document.removeEventListener("pointermove",r)},[]),jsxRuntime.jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var Qe=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=At.useState(false),o=At.useRef(null);if(At.useEffect(()=>{r(true);},[]),At.useEffect(()=>{if(!s||!o.current)return;let a=o.current;if(t)t.appendChild(a);else {let u=document.getElementById("zeugma-hidden-portal-container");u||(u=document.createElement("div"),u.id="zeugma-hidden-portal-container",u.style.display="none",document.body.appendChild(u)),u.appendChild(a);}},[t,s]),At.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||!n?null:reactDom.createPortal(n(e),i)};var Zt=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:i,layout:a,setLayout:u,fullscreenPaneId:m,setFullscreenPaneId:E,locked:v,setLocked:P,findPaneById:S,findPaneContainingTab:R,findTabById:L,activeId:f,activeType:D,dismissIntentId:g,setContainerRef:C,snapThreshold:b,minSplitPercentage:I,maxSplitPercentage:k,onRemove:B,onResizeStart:Y,onResize:$,onResizeEnd:K,removePane:V,addPane:X,updateTabMetadata:Q,updatePaneLock:ee,selectTab:d,mergeTab:y,removeTab:Z}=t,{portalTargets:w,registerPortalTarget:T}=We(),[c,p]=At.useState(null),[W,h]=At.useState(null),ne=Ke({...t,setOverTabId:p,setOverTabPosition:h}),O=At.useCallback(H=>n(H),[n]),F=At.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),q=At.useCallback((H,U)=>{K&&K(H,U);},[K]),re=At.useMemo(()=>({layout:a,setLayout:u,renderPane:O,activeId:f,dismissIntentId:g,overTabId:c,overTabPosition:W,setContainerRef:C,fullscreenPaneId:m,classNames:F,onRemove:B,onFullscreenChange:E,snapThreshold:b,onResizeStart:Y,onResize:$,onResizeEnd:q,minSplitPercentage:I,maxSplitPercentage:k,locked:v,setLocked:P,findPaneById:S,findPaneContainingTab:R,findTabById:L}),[a,f,g,c,W,C,m,F,B,E,b,Y,$,I,k,u,O,q,v,P,S,R,L]),N=At.useMemo(()=>({removePane:V,addPane:X,updateTabMetadata:Q,updatePaneLock:ee,selectTab:d,mergeTab:y,removeTab:Z}),[V,X,Q,ee,d,y,Z]),M=At.useMemo(()=>{let H=[];function U(j){j&&(j.type==="pane"?H.push(...j.tabs):(U(j.first),U(j.second)));}return U(a),H},[a]),z=At.useMemo(()=>({registerPortalTarget:T}),[T]);return jsxRuntime.jsx(Ze.Provider,{value:N,children:jsxRuntime.jsx($e.Provider,{value:re,children:jsxRuntime.jsxs(Re.Provider,{value:z,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...ne,children:i}),f&&D&&r&&jsxRuntime.jsx(je,{activeId:f,render:H=>r(H,D),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:M.map(H=>jsxRuntime.jsx(Qe,{tabId:H,target:w[H]||null,renderWidget:s},H))})]})})})};function He({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:i,currentNode:a,onLayoutChange:u,onResizeStart:m,onResizeEnd:E,parentLeft:v,parentTop:P,parentWidth:S,parentHeight:R}){let{onResizeStart:L,onResize:f,onResizeEnd:D,minSplitPercentage:g=5,maxSplitPercentage:C=95,locked:b=false}=oe();return At.useCallback(I=>{if(b)return;I.preventDefault();let k=e.current;if(!k)return;m&&m(),L&&L(a);let B=k.getBoundingClientRect(),Y=I.clientX,$=I.clientY,K=s,V=I.currentTarget,X=B.left+B.width*(v/100),Q=B.top+B.height*(P/100),ee=B.width*(S/100),d=B.height*(R/100),Z=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(T=>T!==V&&T.getAttribute("data-direction")===n).map(T=>{let c=T.getBoundingClientRect();return t?c.left+c.width/2:c.top+c.height/2}),w=K;Se({cursor:t?"col-resize":"row-resize",resizerEl:V,onMove:T=>{let c=t?(T.clientX-Y)/ee*100:(T.clientY-$)/d*100,p=K+c,W=t?X+(ee-r)*(p/100)+r/2:Q+(d-r)*(p/100)+r/2,h=1/0,ne=null;for(let re of Z){let N=Math.abs(W-re);N<o&&N<h&&(h=N,ne=re);}let O=p;ne!==null&&(O=t?(ne-r/2-X)/(ee-r)*100:(ne-r/2-Q)/(d-r)*100);let F=Math.max(g,Math.min(C,O));w=F;let q=pe(i,a,F);if(q){let{panes:re,splitters:N}=ae(q),M=e.current;if(M){for(let z of re)M.style.setProperty(`--pane-left-${z.paneId}`,`${z.left}%`),M.style.setProperty(`--pane-top-${z.paneId}`,`${z.top}%`),M.style.setProperty(`--pane-width-${z.paneId}`,`${z.width}%`),M.style.setProperty(`--pane-height-${z.paneId}`,`${z.height}%`);for(let z of N)M.style.setProperty(`--splitter-pos-${z.id}`,`${z.direction==="row"?z.left:z.top}%`);}}f&&f(a,F);},onEnd:()=>{let T=pe(i,a,w),c=e.current;if(c){let{panes:p,splitters:W}=ae(T);for(let h of p)c.style.removeProperty(`--pane-left-${h.paneId}`),c.style.removeProperty(`--pane-top-${h.paneId}`),c.style.removeProperty(`--pane-width-${h.paneId}`),c.style.removeProperty(`--pane-height-${h.paneId}`);for(let h of W)c.style.removeProperty(`--splitter-pos-${h.id}`);}u(T),E&&E(),D&&D(a,w);}});},[e,t,n,s,r,o,i,a,u,m,E,L,f,D,g,C,v,P,S,R])}var Bt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:i,locked:a}=oe(),[u,m]=At.useState(false),{currentNode:E,direction:v,left:P,top:S,width:R,height:L,parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}=e,b=v==="row",I=He({containerRef:s,isRow:b,direction:v,splitPercentage:E.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:E,onLayoutChange:o,onResizeStart:()=>m(true),onResizeEnd:()=>m(false),parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}),k=b?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${P}%) - ${t/2}px)`,top:`calc(${S}% + ${t/2}px)`,width:`${t}px`,height:`calc(${L}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"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}, ${S}%) - ${t/2}px)`,width:`calc(${R}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:i.resizer||"","data-direction":v,"data-resizing":u||void 0,style:k,onPointerDown:I,role:"separator","aria-valuenow":E.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},Wt=At__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),Ut=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:i,setContainerRef:a,fullscreenPaneId:u,snapThreshold:m,locked:E,classNames:v}=oe(),P=n!==void 0?n:m??8,S=e!==void 0?e:s,R=At.useRef(null),{panes:L,splitters:f}=At.useMemo(()=>S?ae(S):{panes:[],splitters:[]},[S]);if(!S)return null;let D=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L.map(g=>{let C=u===g.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:C?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:C?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:C?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:C?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:C?20:1,display:u&&!C?"none":"block",padding:C?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(Wt,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsxRuntime.jsx(Bt,{splitter:g,resizerSize:t,snapThreshold:P,containerRef:R},g.id))]});if(e===void 0){let g=o!==null&&o===i,C=I=>{a(I),R.current=I;},b=`${v.dashboard||""} ${g&&v.dashboardDismissActive||""} ${E&&v.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:C,className:b,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})}return jsxRuntime.jsx("div",{ref:R,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:D()})};var it="zeugma-height:",qt="default-pane";function Jt(e){try{let t=localStorage.getItem(it+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function st(e,t){try{localStorage.setItem(it+e,String(Math.round(t)));}catch{}}var at=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:i,localStorageKey:a,resizerHeight:u=6,className:m,resizerClassName:E})=>{let v=i?a||qt:null,P=()=>{let b=(v?Jt(v):null)??n??400;return Ne(b,r,o)},[S,R]=At.useState(P),L=At.useRef(null),f=v?S:n??S,D=At.useRef(n);At.useEffect(()=>{if(n!==void 0&&n!==D.current){let b=Ne(n,r,o);R(b),v&&st(v,b);}D.current=n;},[n,r,o,v]);let g=At.useCallback(()=>o,[o]),C=At.useCallback(b=>{b.preventDefault();let I=b.clientY,k=f,B=g(),Y=b.currentTarget,$=lt(L.current),K=$?$.scrollTop:0,V=I,X=null,Q=(d,y)=>{let Z=y-K,T=d-I+Z,c=Ne(k+T,r,B);return L.current&&(L.current.style.height=`${c}px`),c},ee=()=>{if(!$)return;let d=$===document.documentElement||$===document.body?{top:0,bottom:window.innerHeight}:$.getBoundingClientRect(),y=40,Z=10,w=0;V>d.bottom-y?w=Math.min(1,(V-(d.bottom-y))/y)*Z:V<d.top+y&&(w=-Math.min(1,(d.top+y-V)/y)*Z),w!==0&&($.scrollTop+=w,Q(V,$.scrollTop)),X=requestAnimationFrame(ee);};X=requestAnimationFrame(ee),Se({cursor:"row-resize",resizerEl:Y,onMove:d=>{V=d.clientY,$&&Q(V,$.scrollTop);},onEnd:()=>{X!==null&&cancelAnimationFrame(X);let d=k;L.current&&(d=L.current.getBoundingClientRect().height),d=Ne(d,r,B),R(d),s&&s(d),v&&st(v,d);}});},[f,r,g,s,v]);return t?jsxRuntime.jsxs("div",{ref:L,className:`zeugma-resizable-container ${m||""}`.trim(),style:{height:`${f}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsxRuntime.jsx("div",{className:`zeugma-resizable-handle ${E||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:C,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(f),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsxRuntime.jsx("div",{className:`zeugma-resizable-container disabled ${m||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsxRuntime.jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ne(e,t,n){return Math.max(t,Math.min(n,e))}function lt(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:lt(t)}var Le=At.createContext(null);var on={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"}},sn={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"}},ct=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:s,style:on[t]}),r&&jsxRuntime.jsx("div",{className:n,style:sn[t]})]})},an=({id:e,children:t,style:n,locked:s=false})=>{let r=At.useRef(null),{layout:o,activeId:i,classNames:a,fullscreenPaneId:u,onFullscreenChange:m,locked:E}=oe(),{removePane:v,updateTabMetadata:P,selectTab:S,removeTab:R}=De(),L=At.useContext(Re);if(!L)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=L,D=At.useMemo(()=>te(o,e),[o,e]),g=D?.id??e,C=D?.tabs??[e],b=D?.activeTabId??e,I=D?.tabsMetadata,k=I?.[e],B=D?.locked??false,Y=s||B,$=E||Y,K=E||Y,V=i!==null&&i!==e&&(!C.includes(i)||C.length>1)&&!K,{attributes:X,listeners:Q,setNodeRef:ee}=core.useDraggable({id:e,disabled:$}),d=i!==null&&C.includes(i),y=u===e,Z=At.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${b}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[b]);At.useEffect(()=>{let p=r.current;return f(b,p),()=>{f(b,null);}},[b,f]);let w=At.useMemo(()=>({isDragging:d,isFullscreen:y,toggleFullscreen:()=>m?.(y?null:e),remove:()=>{y&&m?.(null),v(g);},metadata:k,updateMetadata:p=>{P(e,p);},locked:$,tabs:C,activeTabId:b,selectTab:p=>S(g,p),removeTab:p=>{y&&p===b&&m?.(null),R(p);},tabsMetadata:I,updateTabMetadata:(p,W)=>{P(p,W);},renderActiveTab:Z}),[d,y,m,e,R,k,P,$,C,b,S,g,I,Z]),T=At.useMemo(()=>$?{disabled:true}:{...Q,...X},[Q,X,$]),c=`${a.pane||""} ${Y&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(Le.Provider,{value:T,children:jsxRuntime.jsxs("div",{ref:ee,className:c,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(w),V&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(p=>jsxRuntime.jsx(ct,{id:`drop-${p}-${e}`,position:p,activeClassName:a.dropPreview},p))}),i!==null&&i!==e&&K&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(ct,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})};var un=({children:e,className:t,style:n})=>{let s=At.useContext(Le);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsxRuntime.jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var mn=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:i={},overTabId:a,overTabPosition:u}=oe(),m=t||o,{attributes:E,listeners:v,setNodeRef:P,isDragging:S}=core.useDraggable({id:`tab-header-${e}`,disabled:m}),{setNodeRef:R,isOver:L}=core.useDroppable({id:`tab-drop-${e}`,disabled:m}),f=C=>{P(C),R(C);},D=L&&a===e,g=D?u:null;return jsxRuntime.jsxs("div",{ref:f,className:s,style:{display:"inline-flex",position:"relative",cursor:m?"default":"grab",...r},...m?{}:v,...m?{}:E,children:[n({isDragging:S,isOver:D}),D&&g&&jsxRuntime.jsx("div",{className:i.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:g==="before"?0:void 0,right:g==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=bt;exports.DEFAULT_RESIZER_SIZE=Pn;exports.DEFAULT_SNAP_THRESHOLD=gt;exports.DragHandle=un;exports.Pane=an;exports.PaneTree=Ut;exports.PortalRegistryContext=Re;exports.ResizableContainer=at;exports.Tab=mn;exports.Zeugma=Zt;exports.ZeugmaActionsContext=Ze;exports.ZeugmaStateContext=$e;exports.createDragSession=Se;exports.safeJsonStringify=he;exports.useResizer=He;exports.useZeugma=ht;exports.useZeugmaActions=De;exports.useZeugmaContext=Pt;exports.useZeugmaState=oe;//# sourceMappingURL=index.cjs.map
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|