react-zeugma 5.3.0 → 5.3.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.
- package/README.md +47 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -176,6 +176,28 @@ Defines the interactive drag region inside a `<Pane>`. **Must be placed inside a
|
|
|
176
176
|
| `className` | `string` | No | Custom CSS class for the drag handle wrapper. |
|
|
177
177
|
| `style` | `React.CSSProperties` | No | Inline styles for the drag handle wrapper. |
|
|
178
178
|
|
|
179
|
+
### `<Tab>`
|
|
180
|
+
|
|
181
|
+
Defines an interactive draggable and droppable tab area inside a `<Pane>`. **Must be placed inside a `<Pane>` component.**
|
|
182
|
+
|
|
183
|
+
| Prop | Type | Required | Description |
|
|
184
|
+
| ----------- | -------------------------------------- | -------- | -------------------------------------------------------------- |
|
|
185
|
+
| `id` | `string` | Yes | The unique ID of the tab (matching the tab layout schema). |
|
|
186
|
+
| `locked` | `boolean` | No | If true, disables drag reordering on this tab. |
|
|
187
|
+
| `children` | `(props: TabRenderProps) => ReactNode` | Yes | Render prop function exposing tab states (isDragging, isOver). |
|
|
188
|
+
| `className` | `string` | No | Custom CSS class for the tab wrapper. |
|
|
189
|
+
| `style` | `React.CSSProperties` | No | Inline styles for the tab wrapper. |
|
|
190
|
+
|
|
191
|
+
### `<TabsList>`
|
|
192
|
+
|
|
193
|
+
A context-aware, prop-less helper that automatically loops over the parent pane's `tabs` array and renders a draggable `<Tab>` component for each. **Must be placed inside a `<Pane>` component.** It does not render any wrapping container element (renders as a Fragment).
|
|
194
|
+
|
|
195
|
+
| Prop | Type | Required | Description |
|
|
196
|
+
| ----------- | ------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
|
|
197
|
+
| `children` | `(props: TabsListRenderProps) => ReactNode` | Yes | Render prop function exposing individual tab details and pre-bound actions (select, remove, metadata). |
|
|
198
|
+
| `className` | `string` | No | Custom CSS class applied to individual tab wrappers. |
|
|
199
|
+
| `style` | `React.CSSProperties` | No | Inline styles applied to individual tab wrappers. |
|
|
200
|
+
|
|
179
201
|
### `<ResizableContainer>`
|
|
180
202
|
|
|
181
203
|
A vertical-resize container wrapper that wraps any node (typically `<PaneTree />` or a dashboard component) and allows the user to resize its height by dragging a handle at the bottom edge. Includes smooth scroll parent propagation and drag-to-scroll infinite scrolling behavior.
|
|
@@ -431,9 +453,33 @@ interface PaneRenderProps {
|
|
|
431
453
|
|
|
432
454
|
Defines the interactive drag region inside a `<Pane>`. **Must be placed inside a `<Pane>` component.**
|
|
433
455
|
|
|
456
|
+
- `children: React.ReactNode` — Element(s) that function as the drag handle (e.g., pane header).
|
|
457
|
+
- `className?: string`
|
|
458
|
+
- `style?: React.CSSProperties`
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
### `<Tab>`
|
|
463
|
+
|
|
464
|
+
Defines an interactive draggable and droppable tab area inside a `<Pane>`. **Must be placed inside a `<Pane>` component.**
|
|
465
|
+
|
|
434
466
|
#### Props
|
|
435
467
|
|
|
436
|
-
- `
|
|
468
|
+
- `id: string` — The unique ID of the tab (matching the tab layout schema).
|
|
469
|
+
- `locked?: boolean` — If true, disables drag reordering on this tab.
|
|
470
|
+
- `children: (props: TabRenderProps) => React.ReactNode` — Render prop function.
|
|
471
|
+
- `className?: string`
|
|
472
|
+
- `style?: React.CSSProperties`
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
### `<TabsList>`
|
|
477
|
+
|
|
478
|
+
A context-aware helper that automatically loops over the parent pane's `tabs` array and renders a draggable `<Tab>` component for each. **Must be placed inside a `<Pane>` component.**
|
|
479
|
+
|
|
480
|
+
#### Props
|
|
481
|
+
|
|
482
|
+
- `children: (props: TabsListRenderProps) => React.ReactNode` — Render prop function exposing tab states and pre-bound handlers (`select`, `remove`, `metadata`).
|
|
437
483
|
- `className?: string`
|
|
438
484
|
- `style?: React.CSSProperties`
|
|
439
485
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var jt=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 jt__default=/*#__PURE__*/_interopDefault(jt);function Qe(e){let t=jt.useRef(null);return jt.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 je(e){jt.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function et(){let[e,t]=jt.useState({}),n=jt.useRef(true);jt.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=jt.useCallback((r,o)=>{n.current&&t(a=>a[r]===o?a:{...a,[r]:o});},[]);return {portalTargets:e,registerPortalTarget:s}}var It=8,Mt=8,$n=4;function de(){return "pane-"+Math.random().toString(36).substring(2,11)}function me(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=me(e.first,t),s=me(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function pe(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let r=e.tabs.filter(i=>i!==t);if(r.length===0)return null;let o=e.activeTabId;e.activeTabId===t&&(o=r[0]);let a={...e.tabsMetadata};return delete a[t],{...e,tabs:r,activeTabId:o,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}let n=pe(e.first,t),s=pe(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function Pe(e,t,n,s,r){if(e===null)return typeof r=="string"?{type:"pane",id:de(),tabs:[r],activeTabId:r}:r;if(e.type==="pane"){if(e.id===t){let o=typeof r=="string"?{type:"pane",id:de(),tabs:[r],activeTabId:r}:r,a=s==="left"||s==="top";return {type:"split",direction:n,first:a?o:e,second:a?e:o,splitPercentage:50}}return e}return {...e,first:Pe(e.first,t,n,s,r)||e.first,second:Pe(e.second,t,n,s,r)||e.second}}function tt(e,t,n){if(e===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0};function s(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:{type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0}}:{...r,second:s(r.second,r.direction)}}return s(e,null)}function ge(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:ge(e.first,t,n)||e.first,second:ge(e.second,t,n)||e.second}:e}function Q(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:Q(e.first,t)??Q(e.second,t)}function Y(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:Y(e.first,t)??Y(e.second,t)}function nt(e,t){let n=Y(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 De(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),a={...s};return o===void 0?delete a[t]:a[t]=o,{...e,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}return {...e,first:De(e.first,t,n)??e.first,second:De(e.second,t,n)??e.second}}function Ce(e,t,n,s){if(e===null)return null;if(e.type==="pane"){if(e.id===t){let r=[...e.tabs];r.includes(n)||r.push(n);let o=e.tabsMetadata;return s&&(o={...e.tabsMetadata,[n]:s}),{...e,tabs:r,activeTabId:n,tabsMetadata:o}}return e}return {...e,first:Ce(e.first,t,n,s)||e.first,second:Ce(e.second,t,n,s)||e.second}}function we(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:we(e.first,t,n)??e.first,second:we(e.second,t,n)??e.second}}function Ne(e,t,n){return e===null?null:e.type==="pane"?e.id===t?{...e,activeTabId:n}:e:{...e,first:Ne(e.first,t,n)??e.first,second:Ne(e.second,t,n)??e.second}}function rt(e,t,n){if(e===null)return null;let r=Y(e,t)?.tabsMetadata?.[t],o=pe(e,t);if(o===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:r?{[t]:r}:void 0};function a(i){if(i.type==="pane"){if(i.id===n){let u=[...i.tabs];u.includes(t)||u.push(t);let f={...i.tabsMetadata};return r&&(f[t]=r),{...i,tabs:u,activeTabId:t,tabsMetadata:Object.keys(f).length>0?f:void 0}}return i}return {...i,first:a(i.first),second:a(i.second)}}return a(o)}function ot(e,t,n,s="before"){if(e===null)return null;let o=Y(e,t)?.tabsMetadata?.[t],a=pe(e,t);if(a===null)return {type:"pane",id:de(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function i(u){if(u.type==="pane"){if(u.tabs.includes(n)){let g=[...u.tabs].filter(P=>P!==t),p=g.indexOf(n);p<0&&(p=0),s==="after"&&(p+=1),g.splice(p,0,t);let b={...u.tabsMetadata};return o&&(b[t]=o),{...u,tabs:g,activeTabId:t,tabsMetadata:Object.keys(b).length>0?b:void 0}}return u}return {...u,first:i(u.first),second:i(u.second)}}return i(a)}function ue(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:a,splitPercentage:i,first:u,second:f}=e,p={id:`splitter-${o}-${a}`,currentNode:e,direction:a,left:a==="row"?t+s*(i/100):t,top:a==="column"?n+r*(i/100):n,width:a==="row"?0:s,height:a==="column"?0:r,parentLeft:t,parentTop:n,parentWidth:s,parentHeight:r},b={panes:[],splitters:[]},P={panes:[],splitters:[]};if(a==="row"){let T=s*(i/100);b=ue(u,t,n,T,r,`${o}-L`),P=ue(f,t+T,n,s-T,r,`${o}-R`);}else {let T=r*(i/100);b=ue(u,t,n,s,T,`${o}-T`),P=ue(f,t,n+T,s,r-T,`${o}-B`);}return {panes:[...b.panes,...P.panes],splitters:[p,...b.splitters,...P.splitters]}}function Re(e){try{return JSON.stringify(e)}catch{return ""}}function zt(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:a=false,dragActivationDistance:i=8,snapThreshold:u=8,minSplitPercentage:f=5,maxSplitPercentage:g=95,enableDragToDismiss:p=false,dismissThreshold:b=60,onRemove:P,onDragStart:T,onDragEnd:$,onResizeStart:m,onResize:L,onResizeEnd:h,onDismissIntentChange:N}=e,[R,I]=jt.useState(()=>n!==void 0?n:t??null),[A,W]=jt.useState(()=>Re(n!==void 0?n:null)),[q,k]=jt.useState(r||null),[G,V]=jt.useState(a),[J,j]=jt.useState(null),[ee,d]=jt.useState(null),[x,Z]=jt.useState(null),D=jt.useRef(null),S=jt.useCallback(c=>{D.current=c;},[]),l=jt.useRef(R);l.current=R;let E=jt.useRef(s);E.current=s;let U=jt.useRef(o);U.current=o;let y=jt.useCallback(c=>{k(c),U.current?.(c);},[]);if(jt.useEffect(()=>{V(a);},[a]),jt.useEffect(()=>{r!==void 0&&k(r);},[r]),n!==void 0){let c=Re(n);c!==A&&(W(c),I(n));}let v=jt.useCallback(c=>(...C)=>{let H=l.current,B=c(H,...C);Re(H)!==Re(B)&&(l.current=B,I(B),E.current?.(B));},[]),O=jt.useCallback(v((c,C)=>typeof C=="function"?C(c):C),[v]),K=jt.useCallback(v((c,C)=>me(c,C)),[v]),se=jt.useCallback(v((c,C,H)=>tt(c,C,H)),[v]),w=jt.useCallback(v((c,C,H,B)=>{let ce=Q(c,C)??Y(c,C);if(!ce)return c;let ye=Y(c,H),Oe=ye&&ye.id===ce.id?c:pe(c,H)??c;return Ce(Oe,ce.id,H,B)}),[v]),M=jt.useCallback(v((c,C,H,B,ce)=>{let ye=Q(c,C)??Y(c,C);if(!ye)return c;let Ge=Q(c,ce)??Y(c,ce)??{type:"pane",id:ce,tabs:[ce],activeTabId:ce},Oe=me(c,ce);return Pe(Oe,ye.id,H,B,Ge)}),[v]),z=jt.useCallback(v((c,C,H)=>ge(c,C,H)),[v]),ae=jt.useCallback(v((c,C,H)=>De(c,C,H)),[v]),ne=jt.useCallback(v((c,C,H)=>{let B=Q(c,C)??Y(c,C);return B?we(c,B.id,H):c}),[v]),ie=jt.useCallback(v((c,C,H)=>{let B=Q(c,C)??Y(c,C);return B?Ne(c,B.id,H):c}),[v]),le=jt.useCallback(v((c,C,H)=>{let B=Q(c,H)??Y(c,H);return B?rt(c,C,B.id):c}),[v]),F=jt.useCallback(v((c,C,H,B)=>ot(c,C,H,B)),[v]),te=jt.useCallback(v((c,C)=>pe(c,C)),[v]),re=jt.useCallback(c=>Q(l.current,c),[]),he=jt.useCallback(c=>Y(l.current,c),[]),Nt=jt.useCallback(c=>nt(l.current,c),[]);return {layout:R,setLayout:O,fullscreenPaneId:q,setFullscreenPaneId:y,locked:G,setLocked:V,activeId:J,setActiveId:j,activeType:ee,setActiveType:d,dismissIntentId:x,setDismissIntentId:Z,containerRef:D,setContainerRef:S,dragActivationDistance:i,snapThreshold:u,minSplitPercentage:f,maxSplitPercentage:g,enableDragToDismiss:p,dismissThreshold:b,onRemove:P,onDragStart:T,onDragEnd:$,onResizeStart:m,onResize:L,onResizeEnd:h,onDismissIntentChange:N,removePane:K,addPane:se,addTab:w,splitPane:M,updateSplitPercentage:z,updateTabMetadata:ae,updatePaneLock:ne,selectTab:ie,mergeTab:le,moveTab:F,removeTab:te,findPaneById:re,findPaneContainingTab:he,findTabById:Nt}}function Le({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=i=>{n(i);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",a),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",a);}var Be=Xt.createContext(void 0),We=Xt.createContext(void 0),Le=Xt.createContext(void 0),le=()=>{let e=Xt.useContext(Be);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Ie=()=>{let e=Xt.useContext(We);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var Et=()=>{let e=le(),t=Ie();return {...e,...t}};var Me=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ze=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function $e(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 at(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:a,setDismissIntentId:i,setOverTabId:u,setOverTabPosition:p,containerRef:b,dragActivationDistance:m,enableDragToDismiss:v,dismissThreshold:T,onRemove:y,onDragStart:L,onDragEnd:f,onDismissIntentChange:D,removeTab:g,moveTab:C,selectTab:x}=e,M=Xt.useRef(null),A=Ge(s),[W,q]=Xt.useState(false);Ke(W);let Z=core.useSensors(core.useSensor(Me,{activationConstraint:{distance:m}}),core.useSensor(ze,{activationConstraint:{delay:250,tolerance:5}})),G=Xt.useCallback(d=>{let R=core.pointerWithin(d);if(R.length>0)return R;if(d.active.id.toString().startsWith("tab-header-")){let w=d.droppableContainers.filter(S=>S.id.toString().startsWith("tab-drop-"));return core.closestCenter({...d,droppableContainers:w})}return []},[]);return {sensors:Z,collisionDetection:G,onDragStart:d=>{let R=d.active.id.toString(),k=R.startsWith("tab-header-"),w=k?R.substring(11):R;r(w),o(k?"tab":"pane"),u(null),p(null);let S=d.activatorEvent;if(A.current=$e(S),v&&b.current?M.current=b.current.getBoundingClientRect():M.current=null,k){let l=Y(t,w);l&&x(l.id,w);}L&&L(w);},onDragMove:d=>{let{over:R}=d,k=R?.id.toString()||"",w=k.startsWith("drop-locked-");q(w);let S=k.match(/^tab-drop-(.+)$/);if(S&&R){let[,N]=S,z=d.active.id.toString();if((z.startsWith("tab-header-")?z.substring(11):z)!==N){let ne="before",ae=R.rect,ie=d.activatorEvent,F=null;if(A.current)F=A.current.x;else {let te=$e(ie);te&&(F=te.x+d.delta.x);}if(F!==null){let te=ae.left+ae.width/2;F>te&&(ne="after");}u(N),p(ne);}else u(null),p(null);}else u(null),p(null);if(!v)return;let l=d.active.id.toString(),U=l.startsWith("tab-header-")?l.substring(11):l,P=M.current;if(!P){a!==null&&(i(null),D?.(null));return}let h=d.activatorEvent,_=null,O=null;if(A.current)_=A.current.x,O=A.current.y;else {let N=$e(h);N&&(_=N.x+d.delta.x,O=N.y+d.delta.y);}let K=0;if(_!==null&&O!==null){let N=0,z=0;_<P.left?N=P.left-_:_>P.right&&(N=_-P.right),O<P.top?z=P.top-O:O>P.bottom&&(z=O-P.bottom),K=Math.sqrt(N*N+z*z);}else {let N=d.active.rect.current.translated;if(N){let z=N.left+N.width/2,$=N.top+N.height/2,se=0,ne=0;z<P.left?se=P.left-z:z>P.right&&(se=z-P.right),$<P.top?ne=P.top-$:$>P.bottom&&(ne=$-P.bottom),K=Math.sqrt(se*se+ne*ne);}}K>T?a!==U&&(i(U),D?.(U)):a!==null&&(i(null),D?.(null));},onDragEnd:d=>{r(null),o(null),q(false),u(null),p(null);let{active:R,over:k}=d,w=R.id.toString(),S=w.startsWith("tab-header-"),l=S?w.substring(11):w,I=v&&a===l;if(i(null),D?.(null),M.current=null,I){y?y(l):g(l),f&&f(l,null,null);return}if(!k){f&&f(l,null,null);return}let U=k.id.toString();if(U.startsWith("drop-locked-")){f&&f(l,null,null);return}let P=U.match(/^tab-drop-(.+)$/);if(P){let[,ae]=P;if(l!==ae){let ie="before",F=k.rect,te=d.activatorEvent,re=null;if(A.current)re=A.current.x;else {let he=$e(te);he&&(re=he.x+d.delta.x);}if(re!==null){let he=F.left+F.width/2;re>he&&(ie="after");}C(l,ae,ie),f&&f(l,ae,{type:"move",position:"center"});}else f&&f(l,null,null);return}let h=U.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!h){f&&f(l,null,null);return}let[,_,O]=h,K=S?Y(t,l):Q(t,l),oe=K&&K.id===O,N=K&&K.tabs.length===1;if(l===O||oe&&N){f&&f(l,null,null);return}let z=_==="left"||_==="right"?"row":"column",$;if(S){let ie=Y(t,l)?.tabsMetadata?.[l];$={type:"pane",id:de(),tabs:[l],activeTabId:l,tabsMetadata:ie?{[l]:ie}:void 0};}else $=Q(t,l)??{type:"pane",id:de(),tabs:[l],activeTabId:l};let se=S?pe(t,l):me(t,l),ne=Pe(se,O,z,_,$);n(ne),f&&f(l,O,{type:"split",direction:z,position:_});},onDragCancel:()=>{r(null),o(null),q(false),u(null),p(null),i(null),D?.(null),M.current=null;}}}var it=({activeId:e,render:t,className:n})=>{let s=Xt.useRef(null);return Xt.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 lt=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=Xt.useState(false),o=Xt.useRef(null);if(Xt.useEffect(()=>{r(true);},[]),Xt.useEffect(()=>{if(!s||!o.current)return;let i=o.current;if(t)t.appendChild(i);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(i);}},[t,s]),Xt.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 a=o.current;return !a||!n?null:reactDom.createPortal(n(e),a)};var Ut=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:a,layout:i,setLayout:u,fullscreenPaneId:p,setFullscreenPaneId:b,locked:m,setLocked:v,findPaneById:T,findPaneContainingTab:y,findTabById:L,activeId:f,activeType:D,dismissIntentId:g,setContainerRef:C,snapThreshold:x,minSplitPercentage:M,maxSplitPercentage:A,onRemove:W,onResizeStart:q,onResize:Z,onResizeEnd:G,removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:R,mergeTab:k,removeTab:w,splitPane:S,updateSplitPercentage:l,moveTab:I}=t,{portalTargets:U,registerPortalTarget:P}=Qe(),[h,_]=Xt.useState(null),[O,K]=Xt.useState(null),oe=at({...t,setOverTabId:_,setOverTabPosition:K}),N=Xt.useCallback(F=>n(F),[n]),z=Xt.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),$=Xt.useCallback((F,te)=>{G&&G(F,te);},[G]),se=Xt.useMemo(()=>({layout:i,setLayout:u,renderPane:N,activeId:f,dismissIntentId:g,overTabId:h,overTabPosition:O,setContainerRef:C,fullscreenPaneId:p,classNames:z,onRemove:W,onFullscreenChange:b,snapThreshold:x,onResizeStart:q,onResize:Z,onResizeEnd:$,minSplitPercentage:M,maxSplitPercentage:A,locked:m,setLocked:v,findPaneById:T,findPaneContainingTab:y,findTabById:L}),[i,f,g,h,O,C,p,z,W,b,x,q,Z,M,A,u,N,$,m,v,T,y,L]),ne=Xt.useMemo(()=>({removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:R,mergeTab:k,removeTab:w,setFullscreenPaneId:b,setLocked:v,splitPane:S,updateSplitPercentage:l,moveTab:I}),[V,J,j,ee,d,R,k,w,b,v,S,l,I]),ae=Xt.useMemo(()=>{let F=[];function te(re){re&&(re.type==="pane"?F.push(...re.tabs):(te(re.first),te(re.second)));}return te(i),F},[i]),ie=Xt.useMemo(()=>({registerPortalTarget:P}),[P]);return jsxRuntime.jsx(We.Provider,{value:ne,children:jsxRuntime.jsx(Be.Provider,{value:se,children:jsxRuntime.jsxs(Le.Provider,{value:ie,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...oe,children:a}),f&&D&&r&&jsxRuntime.jsx(it,{activeId:f,render:F=>r(F,D),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:ae.map(F=>jsxRuntime.jsx(lt,{tabId:F,target:U[F]||null,renderWidget:s},F))})]})})})};function _e({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:a,currentNode:i,onLayoutChange:u,onResizeStart:p,onResizeEnd:b,parentLeft:m,parentTop:v,parentWidth:T,parentHeight:y}){let{onResizeStart:L,onResize:f,onResizeEnd:D,minSplitPercentage:g=5,maxSplitPercentage:C=95,locked:x=false}=le();return Xt.useCallback(M=>{if(x)return;M.preventDefault();let A=e.current;if(!A)return;p&&p(),L&&L(i);let W=A.getBoundingClientRect(),q=M.clientX,Z=M.clientY,G=s,V=M.currentTarget,J=W.left+W.width*(m/100),j=W.top+W.height*(v/100),ee=W.width*(T/100),d=W.height*(y/100),k=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(S=>S!==V&&S.getAttribute("data-direction")===n).map(S=>{let l=S.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),w=G;Ne({cursor:t?"col-resize":"row-resize",resizerEl:V,onMove:S=>{let l=t?(S.clientX-q)/ee*100:(S.clientY-Z)/d*100,I=G+l,U=t?J+(ee-r)*(I/100)+r/2:j+(d-r)*(I/100)+r/2,P=1/0,h=null;for(let oe of k){let N=Math.abs(U-oe);N<o&&N<P&&(P=N,h=oe);}let _=I;h!==null&&(_=t?(h-r/2-J)/(ee-r)*100:(h-r/2-j)/(d-r)*100);let O=Math.max(g,Math.min(C,_));w=O;let K=ge(a,i,O);if(K){let{panes:oe,splitters:N}=ue(K),z=e.current;if(z){for(let $ of oe)z.style.setProperty(`--pane-left-${$.paneId}`,`${$.left}%`),z.style.setProperty(`--pane-top-${$.paneId}`,`${$.top}%`),z.style.setProperty(`--pane-width-${$.paneId}`,`${$.width}%`),z.style.setProperty(`--pane-height-${$.paneId}`,`${$.height}%`);for(let $ of N)z.style.setProperty(`--splitter-pos-${$.id}`,`${$.direction==="row"?$.left:$.top}%`);}}f&&f(i,O);},onEnd:()=>{let S=ge(a,i,w),l=e.current;if(l){let{panes:I,splitters:U}=ue(S);for(let P of I)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 U)l.style.removeProperty(`--splitter-pos-${P.id}`);}u(S),b&&b(),D&&D(i,w);}});},[e,t,n,s,r,o,a,i,u,p,b,L,f,D,g,C,m,v,T,y])}var Kt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:a,locked:i}=le(),[u,p]=Xt.useState(false),{currentNode:b,direction:m,left:v,top:T,width:y,height:L,parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}=e,x=m==="row",M=_e({containerRef:s,isRow:x,direction:m,splitPercentage:b.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:b,onLayoutChange:o,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:f,parentTop:D,parentWidth:g,parentHeight:C}),A=x?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${v}%) - ${t/2}px)`,top:`calc(${T}% + ${t/2}px)`,width:`${t}px`,height:`calc(${L}% - ${t}px)`,cursor:i?"default":"col-resize",pointerEvents:i?"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}, ${T}%) - ${t/2}px)`,width:`calc(${y}% - ${t}px)`,height:`${t}px`,cursor:i?"default":"row-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":m,"data-resizing":u||void 0,style:A,onPointerDown:M,role:"separator","aria-valuenow":b.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},Qt=Xt__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),jt=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:a,setContainerRef:i,fullscreenPaneId:u,snapThreshold:p,locked:b,classNames:m}=le(),v=n!==void 0?n:p??8,T=e!==void 0?e:s,y=Xt.useRef(null),{panes:L,splitters:f}=Xt.useMemo(()=>T?ue(T):{panes:[],splitters:[]},[T]);if(!T)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(Qt,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsxRuntime.jsx(Kt,{splitter:g,resizerSize:t,snapThreshold:v,containerRef:y},g.id))]});if(e===void 0){let g=o!==null&&o===a,C=M=>{i(M),y.current=M;},x=`${m.dashboard||""} ${g&&m.dashboardDismissActive||""} ${b&&m.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:C,className:x,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 gt="zeugma-height:",rn="default-pane";function on(e){try{let t=localStorage.getItem(gt+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function mt(e,t){try{localStorage.setItem(gt+e,String(Math.round(t)));}catch{}}var bt=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:a,localStorageKey:i,resizerHeight:u=6,className:p,resizerClassName:b})=>{let m=a?i||rn:null,v=()=>{let x=(m?on(m):null)??n??400;return Ze(x,r,o)},[T,y]=Xt.useState(v),L=Xt.useRef(null),f=m?T:n??T,D=Xt.useRef(n);Xt.useEffect(()=>{if(n!==void 0&&n!==D.current){let x=Ze(n,r,o);y(x),m&&mt(m,x);}D.current=n;},[n,r,o,m]);let g=Xt.useCallback(()=>o,[o]),C=Xt.useCallback(x=>{x.preventDefault();let M=x.clientY,A=f,W=g(),q=x.currentTarget,Z=vt(L.current),G=Z?Z.scrollTop:0,V=M,J=null,j=(d,R)=>{let k=R-G,S=d-M+k,l=Ze(A+S,r,W);return L.current&&(L.current.style.height=`${l}px`),l},ee=()=>{if(!Z)return;let d=Z===document.documentElement||Z===document.body?{top:0,bottom:window.innerHeight}:Z.getBoundingClientRect(),R=40,k=10,w=0;V>d.bottom-R?w=Math.min(1,(V-(d.bottom-R))/R)*k:V<d.top+R&&(w=-Math.min(1,(d.top+R-V)/R)*k),w!==0&&(Z.scrollTop+=w,j(V,Z.scrollTop)),J=requestAnimationFrame(ee);};J=requestAnimationFrame(ee),Ne({cursor:"row-resize",resizerEl:q,onMove:d=>{V=d.clientY,Z&&j(V,Z.scrollTop);},onEnd:()=>{J!==null&&cancelAnimationFrame(J);let d=A;L.current&&(d=L.current.getBoundingClientRect().height),d=Ze(d,r,W),y(d),s&&s(d),m&&mt(m,d);}});},[f,r,g,s,m]);return t?jsxRuntime.jsxs("div",{ref:L,className:`zeugma-resizable-container ${p||""}`.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 ${b||""}`.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 ${p||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsxRuntime.jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ze(e,t,n){return Math.max(t,Math.min(n,e))}function vt(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:vt(t)}var Ae=Xt.createContext(null),He=Xt.createContext(null);var fn={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"}},mn={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"}},Pt=({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:fn[t]}),r&&jsxRuntime.jsx("div",{className:n,style:mn[t]})]})},gn=({id:e,children:t,style:n,locked:s=false})=>{let r=Xt.useRef(null),{layout:o,activeId:a,classNames:i,fullscreenPaneId:u,onFullscreenChange:p,locked:b}=le(),{removePane:m,updateTabMetadata:v,selectTab:T,removeTab:y}=Ie(),L=Xt.useContext(Le);if(!L)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=L,D=Xt.useMemo(()=>Q(o,e),[o,e]),g=D?.id??e,C=D?.tabs??[e],x=D?.activeTabId??e,M=D?.tabsMetadata,A=M?.[e],W=D?.locked??false,q=s||W,Z=b||q,G=b||q,V=a!==null&&a!==e&&(!C.includes(a)||C.length>1)&&!G,{attributes:J,listeners:j,setNodeRef:ee}=core.useDraggable({id:e,disabled:Z}),d=a!==null&&C.includes(a),R=u===e,k=Xt.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${x}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[x]);Xt.useEffect(()=>{let I=r.current;return f(x,I),()=>{f(x,null);}},[x,f]);let w=Xt.useMemo(()=>({isDragging:d,isFullscreen:R,toggleFullscreen:()=>p?.(R?null:e),remove:()=>{R&&p?.(null),m(g);},metadata:A,updateMetadata:I=>{v(e,I);},locked:Z,tabs:C,activeTabId:x,selectTab:I=>T(g,I),removeTab:I=>{R&&I===x&&p?.(null),y(I);},tabsMetadata:M,updateTabMetadata:(I,U)=>{v(I,U);},renderActiveTab:k}),[d,R,p,e,y,A,v,Z,C,x,T,g,M,k]),S=Xt.useMemo(()=>Z?{disabled:true}:{...j,...J},[j,J,Z]),l=`${i.pane||""} ${q&&i.paneLocked||""}`.trim();return jsxRuntime.jsx(Ae.Provider,{value:S,children:jsxRuntime.jsx(He.Provider,{value:w,children:jsxRuntime.jsxs("div",{ref:ee,className:l,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(I=>jsxRuntime.jsx(Pt,{id:`drop-${I}-${e}`,position:I,activeClassName:i.dropPreview},I))}),a!==null&&a!==e&&G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(Pt,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||""})})]})})})};var hn=({children:e,className:t,style:n})=>{let s=Xt.useContext(Ae);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 Xe=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:a={},overTabId:i,overTabPosition:u}=le(),p=t||o,{attributes:b,listeners:m,setNodeRef:v,isDragging:T}=core.useDraggable({id:`tab-header-${e}`,disabled:p}),{setNodeRef:y,isOver:L}=core.useDroppable({id:`tab-drop-${e}`,disabled:p}),f=C=>{v(C),y(C);},D=L&&i===e,g=D?u:null;return jsxRuntime.jsxs("div",{ref:f,className:s,style:{display:"inline-flex",position:"relative",cursor:p?"default":"grab",...r},...p?{}:m,...p?{}:b,children:[n({isDragging:T,isOver:D}),D&&g&&jsxRuntime.jsx("div",{className:a.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}})]})};var Dn=({children:e,className:t,style:n})=>{let s=Xt.useContext(He);if(!s)throw new Error("<TabsList> must be rendered inside a <Pane> component.");let{tabs:r,activeTabId:o,selectTab:a,removeTab:i,tabsMetadata:u,locked:p}=s;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r.map((b,m)=>{let v=b===o,T=m===r.length-1,y=u?.[b];return jsxRuntime.jsx(Xe,{id:b,locked:p,className:t,style:n,children:L=>e({...L,tabId:b,isActive:v,index:m,isLast:T,select:()=>a(b),remove:()=>i(b),metadata:y})},b)})})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=Ct;exports.DEFAULT_RESIZER_SIZE=Nn;exports.DEFAULT_SNAP_THRESHOLD=Dt;exports.DragHandle=hn;exports.Pane=gn;exports.PaneTree=jt;exports.PortalRegistryContext=Le;exports.ResizableContainer=bt;exports.Tab=Xe;exports.TabsList=Dn;exports.Zeugma=Ut;exports.ZeugmaActionsContext=We;exports.ZeugmaStateContext=Be;exports.createDragSession=Ne;exports.safeJsonStringify=xe;exports.useResizer=_e;exports.useZeugma=wt;exports.useZeugmaActions=Ie;exports.useZeugmaContext=Et;exports.useZeugmaState=le;//# sourceMappingURL=index.cjs.map
|
|
6
|
+
`,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=i=>{n(i);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let i=document.getElementById("zeugma-global-cursor-style");i&&i.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",a),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",a);}var We=jt.createContext(void 0),Ue=jt.createContext(void 0),Ie=jt.createContext(void 0),oe=()=>{let e=jt.useContext(We);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Me=()=>{let e=jt.useContext(Ue);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var kt=()=>{let e=oe(),t=Me();return {...e,...t}};var ze=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ke=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Ze(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 lt(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:a,setDismissIntentId:i,setOverTabId:u,setOverTabPosition:f,containerRef:g,dragActivationDistance:p,enableDragToDismiss:b,dismissThreshold:P,onRemove:T,onDragStart:$,onDragEnd:m,onDismissIntentChange:L,removeTab:h,moveTab:N,selectTab:R}=e,I=jt.useRef(null),A=Qe(s),[W,q]=jt.useState(false);je(W);let k=core.useSensors(core.useSensor(ze,{activationConstraint:{distance:p}}),core.useSensor(ke,{activationConstraint:{delay:250,tolerance:5}})),G=jt.useCallback(d=>{let x=core.pointerWithin(d);if(x.length>0)return x;if(d.active.id.toString().startsWith("tab-header-")){let D=d.droppableContainers.filter(S=>S.id.toString().startsWith("tab-drop-"));return core.closestCenter({...d,droppableContainers:D})}return []},[]);return {sensors:k,collisionDetection:G,onDragStart:d=>{let x=d.active.id.toString(),Z=x.startsWith("tab-header-"),D=Z?x.substring(11):x;r(D),o(Z?"tab":"pane"),u(null),f(null);let S=d.activatorEvent;if(A.current=Ze(S),b&&g.current?I.current=g.current.getBoundingClientRect():I.current=null,Z){let l=Y(t,D);l&&R(l.id,D);}$&&$(D);},onDragMove:d=>{let{over:x}=d,Z=x?.id.toString()||"",D=Z.startsWith("drop-locked-");q(D);let S=Z.match(/^tab-drop-(.+)$/);if(S&&x){let[,w]=S,M=d.active.id.toString();if((M.startsWith("tab-header-")?M.substring(11):M)!==w){let ne="before",ie=x.rect,le=d.activatorEvent,F=null;if(A.current)F=A.current.x;else {let te=Ze(le);te&&(F=te.x+d.delta.x);}if(F!==null){let te=ie.left+ie.width/2;F>te&&(ne="after");}u(w),f(ne);}else u(null),f(null);}else u(null),f(null);if(!b)return;let l=d.active.id.toString(),U=l.startsWith("tab-header-")?l.substring(11):l,y=I.current;if(!y){a!==null&&(i(null),L?.(null));return}let v=d.activatorEvent,_=null,O=null;if(A.current)_=A.current.x,O=A.current.y;else {let w=Ze(v);w&&(_=w.x+d.delta.x,O=w.y+d.delta.y);}let K=0;if(_!==null&&O!==null){let w=0,M=0;_<y.left?w=y.left-_:_>y.right&&(w=_-y.right),O<y.top?M=y.top-O:O>y.bottom&&(M=O-y.bottom),K=Math.sqrt(w*w+M*M);}else {let w=d.active.rect.current.translated;if(w){let M=w.left+w.width/2,z=w.top+w.height/2,ae=0,ne=0;M<y.left?ae=y.left-M:M>y.right&&(ae=M-y.right),z<y.top?ne=y.top-z:z>y.bottom&&(ne=z-y.bottom),K=Math.sqrt(ae*ae+ne*ne);}}K>P?a!==U&&(i(U),L?.(U)):a!==null&&(i(null),L?.(null));},onDragEnd:d=>{r(null),o(null),q(false),u(null),f(null);let{active:x,over:Z}=d,D=x.id.toString(),S=D.startsWith("tab-header-"),l=S?D.substring(11):D,E=b&&a===l;if(i(null),L?.(null),I.current=null,E){T?T(l):h(l),m&&m(l,null,null);return}if(!Z){m&&m(l,null,null);return}let U=Z.id.toString();if(U.startsWith("drop-locked-")){m&&m(l,null,null);return}let y=U.match(/^tab-drop-(.+)$/);if(y){let[,ie]=y;if(l!==ie){let le="before",F=Z.rect,te=d.activatorEvent,re=null;if(A.current)re=A.current.x;else {let he=Ze(te);he&&(re=he.x+d.delta.x);}if(re!==null){let he=F.left+F.width/2;re>he&&(le="after");}N(l,ie,le),m&&m(l,ie,{type:"move",position:"center"});}else m&&m(l,null,null);return}let v=U.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!v){m&&m(l,null,null);return}let[,_,O]=v,K=S?Y(t,l):Q(t,l),se=K&&K.id===O,w=K&&K.tabs.length===1;if(l===O||se&&w){m&&m(l,null,null);return}let M=_==="left"||_==="right"?"row":"column",z;if(S){let le=Y(t,l)?.tabsMetadata?.[l];z={type:"pane",id:de(),tabs:[l],activeTabId:l,tabsMetadata:le?{[l]:le}:void 0};}else z=Q(t,l)??{type:"pane",id:de(),tabs:[l],activeTabId:l};let ae=S?pe(t,l):me(t,l),ne=Pe(ae,O,M,_,z);n(ne),m&&m(l,O,{type:"split",direction:M,position:_});},onDragCancel:()=>{r(null),o(null),q(false),u(null),f(null),i(null),L?.(null),I.current=null;}}}var ct=({activeId:e,render:t,className:n})=>{let s=jt.useRef(null);return jt.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 ut=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=jt.useState(false),o=jt.useRef(null);if(jt.useEffect(()=>{r(true);},[]),jt.useEffect(()=>{if(!s||!o.current)return;let i=o.current;if(t)t.appendChild(i);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(i);}},[t,s]),jt.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 a=o.current;return !a||!n?null:reactDom.createPortal(n(e),a)};var Gt=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:a,layout:i,setLayout:u,fullscreenPaneId:f,setFullscreenPaneId:g,locked:p,setLocked:b,findPaneById:P,findPaneContainingTab:T,findTabById:$,activeId:m,activeType:L,dismissIntentId:h,setContainerRef:N,snapThreshold:R,minSplitPercentage:I,maxSplitPercentage:A,onRemove:W,onResizeStart:q,onResize:k,onResizeEnd:G,removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:x,mergeTab:Z,removeTab:D,splitPane:S,updateSplitPercentage:l,moveTab:E}=t,{portalTargets:U,registerPortalTarget:y}=et(),[v,_]=jt.useState(null),[O,K]=jt.useState(null),se=lt({...t,setOverTabId:_,setOverTabPosition:K}),w=jt.useCallback(F=>n(F),[n]),M=jt.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),z=jt.useCallback((F,te)=>{G&&G(F,te);},[G]),ae=jt.useMemo(()=>({layout:i,setLayout:u,renderPane:w,activeId:m,dismissIntentId:h,overTabId:v,overTabPosition:O,setContainerRef:N,fullscreenPaneId:f,classNames:M,onRemove:W,onFullscreenChange:g,snapThreshold:R,onResizeStart:q,onResize:k,onResizeEnd:z,minSplitPercentage:I,maxSplitPercentage:A,locked:p,setLocked:b,findPaneById:P,findPaneContainingTab:T,findTabById:$}),[i,m,h,v,O,N,f,M,W,g,R,q,k,I,A,u,w,z,p,b,P,T,$]),ne=jt.useMemo(()=>({removePane:V,addPane:J,addTab:j,updateTabMetadata:ee,updatePaneLock:d,selectTab:x,mergeTab:Z,removeTab:D,setFullscreenPaneId:g,setLocked:b,splitPane:S,updateSplitPercentage:l,moveTab:E}),[V,J,j,ee,d,x,Z,D,g,b,S,l,E]),ie=jt.useMemo(()=>{let F=[];function te(re){re&&(re.type==="pane"?F.push(...re.tabs):(te(re.first),te(re.second)));}return te(i),F},[i]),le=jt.useMemo(()=>({registerPortalTarget:y}),[y]);return jsxRuntime.jsx(Ue.Provider,{value:ne,children:jsxRuntime.jsx(We.Provider,{value:ae,children:jsxRuntime.jsxs(Ie.Provider,{value:le,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...se,children:a}),m&&L&&r&&jsxRuntime.jsx(ct,{activeId:m,render:F=>r(F,L),className:`${o.dragOverlay||""} ${m===h&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:ie.map(F=>jsxRuntime.jsx(ut,{tabId:F,target:U[F]||null,renderWidget:s},F))})]})})})};function Ye({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:a,currentNode:i,onLayoutChange:u,onResizeStart:f,onResizeEnd:g,parentLeft:p,parentTop:b,parentWidth:P,parentHeight:T}){let{onResizeStart:$,onResize:m,onResizeEnd:L,minSplitPercentage:h=5,maxSplitPercentage:N=95,locked:R=false}=oe();return jt.useCallback(I=>{if(R)return;I.preventDefault();let A=e.current;if(!A)return;f&&f(),$&&$(i);let W=A.getBoundingClientRect(),q=I.clientX,k=I.clientY,G=s,V=I.currentTarget,J=W.left+W.width*(p/100),j=W.top+W.height*(b/100),ee=W.width*(P/100),d=W.height*(T/100),Z=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(S=>S!==V&&S.getAttribute("data-direction")===n).map(S=>{let l=S.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),D=G;Le({cursor:t?"col-resize":"row-resize",resizerEl:V,onMove:S=>{let l=t?(S.clientX-q)/ee*100:(S.clientY-k)/d*100,E=G+l,U=t?J+(ee-r)*(E/100)+r/2:j+(d-r)*(E/100)+r/2,y=1/0,v=null;for(let se of Z){let w=Math.abs(U-se);w<o&&w<y&&(y=w,v=se);}let _=E;v!==null&&(_=t?(v-r/2-J)/(ee-r)*100:(v-r/2-j)/(d-r)*100);let O=Math.max(h,Math.min(N,_));D=O;let K=ge(a,i,O);if(K){let{panes:se,splitters:w}=ue(K),M=e.current;if(M){for(let z of se)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 w)M.style.setProperty(`--splitter-pos-${z.id}`,`${z.direction==="row"?z.left:z.top}%`);}}m&&m(i,O);},onEnd:()=>{let S=ge(a,i,D),l=e.current;if(l){let{panes:E,splitters:U}=ue(S);for(let y of E)l.style.removeProperty(`--pane-left-${y.paneId}`),l.style.removeProperty(`--pane-top-${y.paneId}`),l.style.removeProperty(`--pane-width-${y.paneId}`),l.style.removeProperty(`--pane-height-${y.paneId}`);for(let y of U)l.style.removeProperty(`--splitter-pos-${y.id}`);}u(S),g&&g(),L&&L(i,D);}});},[e,t,n,s,r,o,a,i,u,f,g,$,m,L,h,N,p,b,P,T])}var rn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:a,locked:i}=oe(),[u,f]=jt.useState(false),{currentNode:g,direction:p,left:b,top:P,width:T,height:$,parentLeft:m,parentTop:L,parentWidth:h,parentHeight:N}=e,R=p==="row",I=Ye({containerRef:s,isRow:R,direction:p,splitPercentage:g.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:g,onLayoutChange:o,onResizeStart:()=>f(true),onResizeEnd:()=>f(false),parentLeft:m,parentTop:L,parentWidth:h,parentHeight:N}),A=R?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${b}%) - ${t/2}px)`,top:`calc(${P}% + ${t/2}px)`,width:`${t}px`,height:`calc(${$}% - ${t}px)`,cursor:i?"default":"col-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${b}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${P}%) - ${t/2}px)`,width:`calc(${T}% - ${t}px)`,height:`${t}px`,cursor:i?"default":"row-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":p,"data-resizing":u||void 0,style:A,onPointerDown:I,role:"separator","aria-valuenow":g.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},on=jt__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),sn=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:a,setContainerRef:i,fullscreenPaneId:u,snapThreshold:f,locked:g,classNames:p}=oe(),b=n!==void 0?n:f??8,P=e!==void 0?e:s,T=jt.useRef(null),{panes:$,splitters:m}=jt.useMemo(()=>P?ue(P):{panes:[],splitters:[]},[P]);if(!P)return null;let L=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[$.map(h=>{let N=u===h.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:N?"0%":`var(--pane-left-${h.paneId}, ${h.left}%)`,top:N?"0%":`var(--pane-top-${h.paneId}, ${h.top}%)`,width:N?"100%":`var(--pane-width-${h.paneId}, ${h.width}%)`,height:N?"100%":`var(--pane-height-${h.paneId}, ${h.height}%)`,overflow:"hidden",zIndex:N?20:1,display:u&&!N?"none":"block",padding:N?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(on,{paneId:h.paneId,renderPane:r})},h.paneId)}),!u&&m.map(h=>jsxRuntime.jsx(rn,{splitter:h,resizerSize:t,snapThreshold:b,containerRef:T},h.id))]});if(e===void 0){let h=o!==null&&o===a,N=I=>{i(I),T.current=I;},R=`${p.dashboard||""} ${h&&p.dashboardDismissActive||""} ${g&&p.dashboardLocked||""}`.trim();return jsxRuntime.jsx("div",{ref:N,className:R,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:L()})}return jsxRuntime.jsx("div",{ref:T,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:L()})};var vt="zeugma-height:",un="default-pane";function dn(e){try{let t=localStorage.getItem(vt+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function bt(e,t){try{localStorage.setItem(vt+e,String(Math.round(t)));}catch{}}var ht=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:a,localStorageKey:i,resizerHeight:u=6,className:f,resizerClassName:g})=>{let p=a?i||un:null,b=()=>{let R=(p?dn(p):null)??n??400;return $e(R,r,o)},[P,T]=jt.useState(b),$=jt.useRef(null),m=p?P:n??P,L=jt.useRef(n);jt.useEffect(()=>{if(n!==void 0&&n!==L.current){let R=$e(n,r,o);T(R),p&&bt(p,R);}L.current=n;},[n,r,o,p]);let h=jt.useCallback(()=>o,[o]),N=jt.useCallback(R=>{R.preventDefault();let I=R.clientY,A=m,W=h(),q=R.currentTarget,k=Pt($.current),G=k?k.scrollTop:0,V=I,J=null,j=(d,x)=>{let Z=x-G,S=d-I+Z,l=$e(A+S,r,W);return $.current&&($.current.style.height=`${l}px`),l},ee=()=>{if(!k)return;let d=k===document.documentElement||k===document.body?{top:0,bottom:window.innerHeight}:k.getBoundingClientRect(),x=40,Z=10,D=0;V>d.bottom-x?D=Math.min(1,(V-(d.bottom-x))/x)*Z:V<d.top+x&&(D=-Math.min(1,(d.top+x-V)/x)*Z),D!==0&&(k.scrollTop+=D,j(V,k.scrollTop)),J=requestAnimationFrame(ee);};J=requestAnimationFrame(ee),Le({cursor:"row-resize",resizerEl:q,onMove:d=>{V=d.clientY,k&&j(V,k.scrollTop);},onEnd:()=>{J!==null&&cancelAnimationFrame(J);let d=A;$.current&&(d=$.current.getBoundingClientRect().height),d=$e(d,r,W),T(d),s&&s(d),p&&bt(p,d);}});},[m,r,h,s,p]);return t?jsxRuntime.jsxs("div",{ref:$,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 ${g||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:N,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 $e(e,t,n){return Math.max(t,Math.min(n,e))}function Pt(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:Pt(t)}var He=jt.createContext(null),Fe=jt.createContext(null);var Pn={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"}},yt=({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:Pn[t]}),r&&jsxRuntime.jsx("div",{className:n,style:Tn[t]})]})},yn=({id:e,children:t,style:n,locked:s=false})=>{let r=jt.useRef(null),{layout:o,activeId:a,classNames:i,fullscreenPaneId:u,onFullscreenChange:f,locked:g}=oe(),{removePane:p,updateTabMetadata:b,selectTab:P,removeTab:T}=Me(),$=jt.useContext(Ie);if(!$)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:m}=$,L=jt.useMemo(()=>Q(o,e),[o,e]),h=L?.id??e,N=L?.tabs??[e],R=L?.activeTabId??e,I=L?.tabsMetadata,A=I?.[e],W=L?.locked??false,q=s||W,k=g||q,G=g||q,V=a!==null&&a!==e&&(!N.includes(a)||N.length>1)&&!G,{attributes:J,listeners:j,setNodeRef:ee}=core.useDraggable({id:e,disabled:k}),d=a!==null&&N.includes(a),x=u===e,Z=jt.useCallback(()=>jsxRuntime.jsx("div",{ref:r,id:`zeugma-tab-target-${R}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[R]);jt.useEffect(()=>{let E=r.current;return m(R,E),()=>{m(R,null);}},[R,m]);let D=jt.useMemo(()=>({isDragging:d,isFullscreen:x,toggleFullscreen:()=>f?.(x?null:e),remove:()=>{x&&f?.(null),p(h);},metadata:A,updateMetadata:E=>{b(e,E);},locked:k,tabs:N,activeTabId:R,selectTab:E=>P(h,E),removeTab:E=>{x&&E===R&&f?.(null),T(E);},tabsMetadata:I,updateTabMetadata:(E,U)=>{b(E,U);},renderActiveTab:Z}),[d,x,f,e,T,A,b,k,N,R,P,h,I,Z]),S=jt.useMemo(()=>k?{disabled:true}:{...j,...J},[j,J,k]),l=`${i.pane||""} ${q&&i.paneLocked||""}`.trim();return jsxRuntime.jsx(He.Provider,{value:S,children:jsxRuntime.jsx(Fe.Provider,{value:D,children:jsxRuntime.jsxs("div",{ref:ee,className:l,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(D),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(E=>jsxRuntime.jsx(yt,{id:`drop-${E}-${e}`,position:E,activeClassName:i.dropPreview},E))}),a!==null&&a!==e&&G&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(yt,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||""})})]})})})};var Sn=({children:e,className:t,style:n})=>{let s=jt.useContext(He);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 xt=jt__default.default.memo(({isDragging:e,children:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t({isDragging:e,isOver:false})}));xt.displayName="TabNormal";var St=({id:e,isDragging:t,children:n})=>{let{overTabId:s,overTabPosition:r,classNames:o={}}=oe(),a=s===e,i=a?r:null;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n({isDragging:t,isOver:a}),a&&i&&jsxRuntime.jsx("div",{className:o.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:i==="before"?0:void 0,right:i==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};St.displayName="TabHovered";var qe=({id:e,locked:t=false,children:n,className:s,style:r})=>{let o=oe(),a=t||o.locked,{attributes:i,listeners:u,setNodeRef:f,isDragging:g}=core.useDraggable({id:`tab-header-${e}`,disabled:a}),{setNodeRef:p,isOver:b}=core.useDroppable({id:`tab-drop-${e}`,disabled:a});return jsxRuntime.jsx("div",{ref:T=>{f(T),p(T);},className:s,style:{display:"inline-flex",position:"relative",cursor:a?"default":"grab",...r},...a?{}:u,...a?{}:i,children:b?jsxRuntime.jsx(St,{id:e,isDragging:g,children:n}):jsxRuntime.jsx(xt,{isDragging:g,children:n})})};var wt=jt__default.default.memo(({tabId:e,isActive:t,isLast:n,index:s,locked:r,selectTab:o,removeTab:a,metadata:i,children:u,className:f,style:g})=>{let p=jt.useCallback(()=>o(e),[o,e]),b=jt.useCallback(()=>a(e),[a,e]);return jsxRuntime.jsx(qe,{id:e,locked:r,className:f,style:g,children:P=>u({...P,tabId:e,isActive:t,index:s,isLast:n,select:p,remove:b,metadata:i})})},(e,t)=>e.tabId===t.tabId&&e.isActive===t.isActive&&e.isLast===t.isLast&&e.index===t.index&&e.locked===t.locked&&e.className===t.className&&e.style===t.style&&e.metadata===t.metadata);wt.displayName="TabsListItem";var Mn=({children:e,className:t,style:n})=>{let s=jt.useContext(Fe);if(!s)throw new Error("<TabsList> must be rendered inside a <Pane> component.");let{tabs:r,activeTabId:o,selectTab:a,removeTab:i,tabsMetadata:u,locked:f}=s;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:r.map((g,p)=>{let b=g===o,P=p===r.length-1,T=u?.[g];return jsxRuntime.jsx(wt,{tabId:g,isActive:b,isLast:P,index:p,locked:f,selectTab:a,removeTab:i,metadata:T,className:t,style:n,children:e},g)})})};exports.DEFAULT_DRAG_ACTIVATION_DISTANCE=Mt;exports.DEFAULT_RESIZER_SIZE=$n;exports.DEFAULT_SNAP_THRESHOLD=It;exports.DragHandle=Sn;exports.Pane=yn;exports.PaneTree=sn;exports.PortalRegistryContext=Ie;exports.ResizableContainer=ht;exports.Tab=qe;exports.TabsList=Mn;exports.Zeugma=Gt;exports.ZeugmaActionsContext=Ue;exports.ZeugmaStateContext=We;exports.createDragSession=Le;exports.safeJsonStringify=Re;exports.useResizer=Ye;exports.useZeugma=zt;exports.useZeugmaActions=Me;exports.useZeugmaContext=kt;exports.useZeugmaState=oe;//# sourceMappingURL=index.cjs.map
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|