react-zeugma 6.4.2 → 6.5.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 +3 -16
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-BN5W7EvY.d.cts → types-DO2k-HLr.d.cts} +3 -7
- package/dist/{types-BN5W7EvY.d.ts → types-DO2k-HLr.d.ts} +3 -7
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,25 +88,12 @@ export default function Dashboard() {
|
|
|
88
88
|
|
|
89
89
|
## API Reference
|
|
90
90
|
|
|
91
|
-
### `<ZeugmaProvider>`
|
|
92
|
-
|
|
93
|
-
The context provider that sets up the drag-and-drop state machine, monitors active drags, and registers layout change notifications. This is a headless component that does not render any visual grid container. Wrap your custom dashboard structure (including sidebars, toolbars, and the `<Zeugma>` grid layout) with `<ZeugmaProvider>` to allow descendant components to consume the layout context.
|
|
94
|
-
|
|
95
|
-
It accepts a required `controller` and `children` props:
|
|
96
|
-
|
|
97
|
-
| Prop | Type | Required | Description |
|
|
98
|
-
| :----------- | :----------------- | :------- | :--------------------------------------------------------------------- |
|
|
99
|
-
| `controller` | `ZeugmaController` | Yes | The Zeugma controller object returned by `useZeugma(options)`. |
|
|
100
|
-
| `children` | `React.ReactNode` | Yes | Sibling or descendant components that will have access to the context. |
|
|
101
|
-
|
|
102
|
-
Additionally, `<ZeugmaProvider>` accepts all configuration settings and lifecycle callbacks listed for `<Zeugma>` below (such as `classNames`, `resizerSize`, `renderPane`, `onDragStart`, etc.).
|
|
103
|
-
|
|
104
91
|
### `<Zeugma>`
|
|
105
92
|
|
|
106
|
-
The main visual dashboard grid renderer.
|
|
93
|
+
The main visual dashboard grid renderer and context provider.
|
|
107
94
|
|
|
108
|
-
- **
|
|
109
|
-
- **
|
|
95
|
+
- **With Children (Provider Mode)**: If `<Zeugma>` is rendered with children, it acts as the context provider. You must pass the `controller` prop to it, and the children will have access to the Zeugma context functions.
|
|
96
|
+
- **Without Children (Renderer/Standalone Mode)**: If `<Zeugma>` is rendered without children, it acts as both the provider and the visual layout renderer. If it is nested within a parent `<Zeugma>` provider, it automatically reads the state, configuration, and callbacks directly from the parent context.
|
|
110
97
|
|
|
111
98
|
| Prop | Type | Required | Description |
|
|
112
99
|
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------- |
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var nn=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 nn__default=/*#__PURE__*/_interopDefault(nn);function ut(e){let t=nn.useRef(null);return nn.useEffect(()=>{if(!e){t.current=null;return}let n=o=>{t.current={x:o.clientX,y:o.clientY};},r=o=>{let i=o.touches[0]||o.changedTouches[0];i&&(t.current={x:i.clientX,y:i.clientY});};return window.addEventListener("pointermove",n,{passive:true}),window.addEventListener("touchmove",r,{passive:true}),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("touchmove",r);}},[e]),t}function dt(e){nn.useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function pt(){let[e,t]=nn.useState({}),n=nn.useRef({}),r=nn.useRef(true);nn.useEffect(()=>(r.current=true,()=>{r.current=false;}),[]);let o=nn.useCallback((a,l)=>{r.current&&t(c=>{if(!l){if(!c[a])return c;let p={...c};return delete p[a],p}return c[a]===l?c:{...c,[a]:l}});},[]),i=nn.useCallback((a,l)=>{n.current[a]=l;},[]);return {portalTargets:e,registerPortalTarget:o,registerRenderCallback:i,renderCallbacksRef:n}}function ue(){return "pane-"+Math.random().toString(36).substring(2,11)}function be(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=be(e.first,t),r=be(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function de(e,t){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let o=e.tabs.filter(l=>l!==t);if(o.length===0)return null;let i=e.activeTabId;e.activeTabId===t&&(i=o[0]);let a={...e.tabsMetadata};return delete a[t],{...e,tabs:o,activeTabId:i,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}let n=de(e.first,t),r=de(e.second,t);return n===null?r:r===null?n:{...e,first:n,second:r}}function ye(e,t,n,r,o){if(e===null)return typeof o=="string"?{type:"pane",id:ue(),tabs:[o],activeTabId:o}:o;if(e.type==="pane"){if(e.id===t){let i=typeof o=="string"?{type:"pane",id:ue(),tabs:[o],activeTabId:o}:o,a=r==="left"||r==="top";return {type:"split",direction:n,first:a?i:e,second:a?e:i,splitPercentage:50}}return e}return {...e,first:ye(e.first,t,n,r,o)||e.first,second:ye(e.second,t,n,r,o)||e.second}}function Vt(e,t){if(e===null)return t;function n(r,o){return r.type==="pane"?{type:"split",direction:o==="row"?"column":"row",splitPercentage:50,first:r,second:t}:{...r,second:n(r.second,r.direction)}}return n(e,null)}function ft(e,t,n,r){if(e===null)return {type:"pane",id:ue(),tabs:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};let o=t?Q(e,t):null;if(o&&o.type==="pane"){let l=function(c){if(c.type==="pane"&&c.id===t){let p=[...c.tabs];p.includes(n)||p.push(n);let g=c.tabsMetadata;return r&&(g={...c.tabsMetadata,[n]:r}),{...c,tabs:p,activeTabId:n,tabsMetadata:g}}return c.type==="split"?{...c,first:l(c.first),second:l(c.second)}:c};return l(e)}let i={type:"pane",id:ue(),tabs:[n],activeTabId:n,tabsMetadata:r?{[n]:r}:void 0};return Vt(e,i)}function he(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:he(e.first,t,n)||e.first,second:he(e.second,t,n)||e.second}:e}function Q(e,t){return e===null?null:e.type==="pane"?e.id===t?e:null:e.type==="split"?Q(e.first,t)??Q(e.second,t):null}function K(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:e.type==="split"?K(e.first,t)??K(e.second,t):null}function qe(e,t){let n=K(e,t);if(!n)return null;let r=n.tabs.indexOf(t);return {id:t,paneId:n.id,isActive:n.activeTabId===t,index:r,metadata:n.tabsMetadata?.[t]}}function Je(e,t){return K(e,t)?.tabsMetadata?.[t]}function _e(e,t){let n=Q(e,t);return n?.tabsMetadata?.[n.activeTabId]}function Ee(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.tabs.includes(t)){let r=e.tabsMetadata||{},o=r[t],i=n(o),a={...r};return i===void 0?delete a[t]:a[t]=i,{...e,tabsMetadata:Object.keys(a).length>0?a:void 0}}return e}return e.type==="split"?{...e,first:Ee(e.first,t,n)??e.first,second:Ee(e.second,t,n)??e.second}:e}function Me(e,t,n){if(e===null)return null;if(e.type==="pane"){if(e.id===t){if(n===false){let{locked:r,...o}=e;return o}return {...e,locked:n}}return e}return e.type==="split"?{...e,first:Me(e.first,t,n)??e.first,second:Me(e.second,t,n)??e.second}:e}function Re(e,t,n){return e===null?null:e.type==="pane"?e.id===t?e.activeTabId===n?e:{...e,activeTabId:n}:e:e.type==="split"?{...e,first:Re(e.first,t,n)??e.first,second:Re(e.second,t,n)??e.second}:e}function gt(e,t,n){if(e===null)return null;let o=K(e,t)?.tabsMetadata?.[t],i=de(e,t);if(i===null)return {type:"pane",id:ue(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function a(l){if(l.type==="pane"){if(l.id===n){let c=[...l.tabs];c.includes(t)||c.push(t);let p={...l.tabsMetadata};return o&&(p[t]=o),{...l,tabs:c,activeTabId:t,tabsMetadata:Object.keys(p).length>0?p:void 0}}return l}return l.type==="split"?{...l,first:a(l.first),second:a(l.second)}:l}return a(i)}function ke(e,t,n,r="before"){if(e===null)return null;let i=K(e,t)?.tabsMetadata?.[t],a=de(e,t);if(a===null)return {type:"pane",id:ue(),tabs:[t],activeTabId:t,tabsMetadata:i?{[t]:i}:void 0};function l(c){if(c.type==="pane"){if(c.tabs.includes(n)){let g=[...c.tabs].filter(N=>N!==t),v=g.indexOf(n);v<0&&(v=0),r==="after"&&(v+=1),g.splice(v,0,t);let D={...c.tabsMetadata};return i&&(D[t]=i),{...c,tabs:g,activeTabId:t,tabsMetadata:Object.keys(D).length>0?D:void 0}}return c}return c.type==="split"?{...c,first:l(c.first),second:l(c.second)}:c}return l(a)}function ge(e,t=0,n=0,r=100,o=100,i="root"){if(e===null)return {panes:[],splitters:[]};if(e.type==="pane")return {panes:[{paneId:e.id,left:t,top:n,width:r,height:o,node:e}],splitters:[]};let{direction:a,splitPercentage:l,first:c,second:p}=e,v={id:`splitter-${i}-${a}`,currentNode:e,direction:a,left:a==="row"?t+r*(l/100):t,top:a==="column"?n+o*(l/100):n,width:a==="row"?0:r,height:a==="column"?0:o,parentLeft:t,parentTop:n,parentWidth:r,parentHeight:o},D={panes:[],splitters:[]},N={panes:[],splitters:[]};if(a==="row"){let P=r*(l/100);D=ge(c,t,n,P,o,`${i}-L`),N=ge(p,t+P,n,r-P,o,`${i}-R`);}else {let P=o*(l/100);D=ge(c,t,n,r,P,`${i}-T`),N=ge(p,t,n+P,r,o-P,`${i}-B`);}return {panes:[...D.panes,...N.panes],splitters:[v,...D.splitters,...N.splitters]}}function mt(e,t,n,r){if(!(t==="tab"&&n&&e.includes(n))||!r)return -1;let a=e.indexOf(n);return r==="before"?a:a+1}function Ne(e){try{return JSON.stringify(e)}catch{return ""}}function Wt(e){let{initialLayout:t,layout:n,onChange:r,fullscreenPaneId:o,onFullscreenChange:i,locked:a=false}=e,[l,c]=nn.useState(()=>n!==void 0?n:t??null),[p,g]=nn.useState(()=>Ne(n!==void 0?n:null)),[v,D]=nn.useState(o||null),[N,P]=nn.useState(a),[z,I]=nn.useState(null),[$,m]=nn.useState(null),[B,U]=nn.useState(null),[E,f]=nn.useState(null),T=nn.useRef(null),j=nn.useCallback(s=>{T.current=s;},[]),L=nn.useRef(l);L.current=l;let Z=nn.useRef(z);Z.current=z;let q=nn.useRef(r);q.current=r;let ee=nn.useRef(i);ee.current=i;let J=nn.useCallback(s=>{D(s),ee.current?.(s);},[]);if(nn.useEffect(()=>{P(a);},[a]),nn.useEffect(()=>{o!==void 0&&D(o);},[o]),n!==void 0){let s=Ne(n);s!==p&&(g(s),c(n));}let S=nn.useCallback(s=>(...d)=>{let H=L.current,M=s(H,...d);Ne(H)!==Ne(M)&&(L.current=M,c(M),q.current?.(M));},[]),ie=nn.useCallback(S((s,d)=>typeof d=="function"?d(s):d),[S]),k=ie,x=nn.useCallback(s=>{D(null),ee.current?.(null),I(null),m(null),U(null),f(null),ie(s);},[ie]),A=nn.useCallback(S((s,d)=>be(s,d)),[S]),w=nn.useCallback(S((s,d,H,M)=>{let G=de(s,d)??s;return ft(G,H,d,M)}),[S]),R=nn.useCallback(S((s,d,H,M,G)=>{let X=Q(s,d)??K(s,d);if(!X)return s;let le=Q(s,G)??K(s,G)??{type:"pane",id:G,tabs:[G],activeTabId:G},ne=be(s,G);return ye(ne,X.id,H,M,le)}),[S]),u=nn.useCallback(S((s,d,H)=>he(s,d,H)),[S]),F=nn.useCallback(S((s,d,H)=>Ee(s,d,H)),[S]),y=nn.useCallback(S((s,d,H)=>{let M=Q(s,d)??K(s,d);return M?Me(s,M.id,H):s}),[S]),C=nn.useCallback(S((s,d,H)=>{let M=Q(s,d)??K(s,d);return M?Re(s,M.id,H):s}),[S]),te=nn.useCallback(S((s,d,H)=>{let M=Q(s,H)??K(s,H);return M?gt(s,d,M.id):s}),[S]),V=nn.useCallback(S((s,d,H,M)=>ke(s,d,H,M)),[S]),O=nn.useCallback(S((s,d)=>de(s,d)),[S]),W=nn.useCallback(s=>{let d=Q(L.current,s);return !d&&Z.current&&(d=Q(Z.current,s)),d},[]),_=nn.useCallback(s=>{let d=K(L.current,s);return !d&&Z.current&&(d=K(Z.current,s)),d},[]),b=nn.useCallback(s=>{let d=qe(L.current,s);return !d&&Z.current&&(d=qe(Z.current,s)),d},[]),h=nn.useCallback(s=>{let d=Je(L.current,s);return !d&&Z.current&&(d=Je(Z.current,s)),d},[]),re=nn.useCallback(s=>{let d=_e(L.current,s);return !d&&Z.current&&(d=_e(Z.current,s)),d},[]);return {layout:l,setLayout:x,_internalSetLayout:k,layoutBeforeDrag:z,setLayoutBeforeDrag:I,fullscreenPaneId:v,setFullscreenPaneId:J,locked:N,setLocked:P,activeId:$,setActiveId:m,activeType:B,setActiveType:U,dismissIntentId:E,setDismissIntentId:f,containerRef:T,setContainerRef:j,removePane:A,addTab:w,updateMetadata:F,updatePaneLock:y,selectTab:C,mergeTab:te,moveTab:V,removeTab:O,splitPane:R,updateSplitPercentage:u,findPaneById:W,findPaneContainingTab:_,findTabById:b,getTabMetadata:h,getActiveTabMetadata:re}}function vt({cursor:e,resizerEl:t,onMove:n,onEnd:r}){document.body.classList.add("zeugma-resizing");let o=document.createElement("style");o.id="zeugma-global-cursor-style",o.textContent=`
|
|
2
2
|
* {
|
|
3
3
|
cursor: ${e} !important;
|
|
4
4
|
user-select: none !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let i=l=>{n(l);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let l=document.getElementById("zeugma-global-cursor-style");l&&l.remove(),document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",a),r();};document.addEventListener("pointermove",i),document.addEventListener("pointerup",a);}var ze=rn.createContext(void 0),Qe=rn.createContext(void 0),$e=rn.createContext(void 0),je=rn.createContext(void 0),se=()=>{let e=rn.useContext(ze);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Ae=()=>{let e=rn.useContext(Qe);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Be=()=>{let e=rn.useContext(je);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};var Yt=()=>{let e=se(),t=Ae();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updateMetadata:t.updateMetadata,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata}};var He=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},Oe=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Fe(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 Tt(e){let{layout:t,_internalSetLayout:n,layoutBeforeDrag:r,setLayoutBeforeDrag:o,activeId:i,setActiveId:a,setActiveType:l,dismissIntentId:c,setDismissIntentId:p,setOverTabId:g,setOverTabPosition:v,containerRef:D,dragActivationDistance:N,enableDragToDismiss:P,dismissThreshold:z,onRemove:I,onDragStart:$,onDragEnd:m,onDismissIntentChange:B,removeTab:U,removePane:E}=e,f=rn.useRef(null),T=ut(i),[j,L]=rn.useState(false);dt(j);let k=core.useSensors(core.useSensor(He,{activationConstraint:{distance:N}}),core.useSensor(Oe,{activationConstraint:{delay:250,tolerance:5}})),q=rn.useCallback(Z=>{let A=Z.active.id.toString().startsWith("tab-header-"),w=core.pointerWithin(Z),R=A?w:w.filter(u=>!u.id.toString().startsWith("tab-drop-"));if(R.length>0)return [...R].sort((F,y)=>{let C=F.id.toString(),te=y.id.toString();if(A){let W=C.startsWith("tab-drop-"),_=te.startsWith("tab-drop-");if(W&&!_)return -1;if(!W&&_)return 1}let V=C.startsWith("drop-root-"),O=te.startsWith("drop-root-");return V&&!O?-1:!V&&O?1:0});if(A){let u=Z.droppableContainers.filter(F=>F.id.toString().startsWith("tab-drop-"));return core.closestCenter({...Z,droppableContainers:u})}return []},[]);return {sensors:k,collisionDetection:q,onDragStart:Z=>{let x=Z.active.id.toString(),A=x.startsWith("tab-header-"),w=A?x.substring(11):x;a(w),l(A?"tab":"pane"),g(null),v(null);let R=Z.activatorEvent;T.current=Fe(R),P&&D.current?f.current=D.current.getBoundingClientRect():f.current=null;let u=t;if(A){let F=K(t,w);F&&(u=Re(t,F.id,w)||t);}o(u),A&&u!==t&&n(u),$&&$(w);},onDragMove:Z=>{let{over:x}=Z,A=x?.id.toString()||"",w=A.startsWith("drop-locked-");L(b=>b===w?b:w);let R=Z.active.id.toString(),u=R.startsWith("tab-header-"),F=u?R.substring(11):R,y=A.match(/^tab-drop-(.+)$/);if(y&&x&&u){let[,b]=y;if(F!==b){let h="before",re=x.rect,ae=Z.activatorEvent,s=null;if(T.current)s=T.current.x;else {let d=Fe(ae);d&&(s=d.x+Z.delta.x);}if(s!==null){let d=re.left+re.width/2;s>d&&(h="after");}g(d=>d===b?d:b),v(d=>d===h?d:h);}else g(h=>h===null?h:null),v(h=>h===null?h:null);}else g(b=>b===null?b:null),v(b=>b===null?b:null);if(!P)return;let C=f.current;if(!C){c!==null&&(p(null),B?.(null));return}let te=Z.activatorEvent,V=null,O=null;if(T.current)V=T.current.x,O=T.current.y;else {let b=Fe(te);b&&(V=b.x+Z.delta.x,O=b.y+Z.delta.y);}let W=0;if(V!==null&&O!==null){let b=0,h=0;V<C.left?b=C.left-V:V>C.right&&(b=V-C.right),O<C.top?h=C.top-O:O>C.bottom&&(h=O-C.bottom),W=Math.sqrt(b*b+h*h);}else {let b=Z.active.rect.current.translated;if(b){let h=b.left+b.width/2,re=b.top+b.height/2,ae=0,s=0;h<C.left?ae=C.left-h:h>C.right&&(ae=h-C.right),re<C.top?s=C.top-re:re>C.bottom&&(s=re-C.bottom),W=Math.sqrt(ae*ae+s*s);}}W>z?c!==F&&(p(F),B?.(F)):c!==null&&(p(null),B?.(null));},onDragEnd:Z=>{a(null),l(null),L(false),g(null),v(null);let{active:x,over:A}=Z,w=x.id.toString(),R=w.startsWith("tab-header-"),u=R?w.substring(11):w,F=P&&c===u;p(null),B?.(null),f.current=null;let y=r||t;if(o(null),F){I?I(u):R?U(u):E(u),m&&m(u,null,null);return}if(!A){n(y),m&&m(u,null,null);return}let C=A.id.toString();if(C.startsWith("drop-locked-")){n(y),m&&m(u,null,null);return}let te=C.match(/^tab-drop-(.+)$/);if(te){if(!R){n(y),m&&m(u,null,null);return}let[,M]=te;if(u!==M){let G="before",X=A.rect,le=Z.activatorEvent,ne=null;if(T.current)ne=T.current.x;else {let oe=Fe(le);oe&&(ne=oe.x+Z.delta.x);}if(ne!==null){let oe=X.left+X.width/2;ne>oe&&(G="after");}let xe=Ze(y,u,M,G);n(xe),m&&m(u,M,{type:"move",position:"center"});}else n(y),m&&m(u,null,null);return}let V=C.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(V){let[,M,G]=V,X=G;X==="start"&&(X="left"),X==="end"&&(X="right");let le=R?pe(y,u):be(y,u),ne;if(R){let oe=K(y,u)?.tabsMetadata?.[u];ne={type:"pane",id:ue(),tabs:[u],activeTabId:u,tabsMetadata:oe?{[u]:oe}:void 0};}else ne=Q(y,u)??{type:"pane",id:ue(),tabs:[u],activeTabId:u};if(le===null)n(ne);else {let xe=X==="left"||X==="right",oe=X==="left"||X==="top",we=50;M==="1/4"?we=oe?25:75:M==="1/3"&&(we=oe?100/3:200/3),n({type:"split",direction:xe?"row":"column",first:oe?ne:le,second:oe?le:ne,splitPercentage:we});}m&&m(u,"root",{type:"split",direction:X==="left"||X==="right"?"row":"column",position:X});return}let O=C.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!O){n(y),m&&m(u,null,null);return}let[,W,_]=O,b=R?K(y,u):Q(y,u),h=b&&b.id===_,re=b&&b.tabs.length===1;if(u===_||h&&re){n(y),m&&m(u,null,null);return}let ae=W==="left"||W==="right"?"row":"column",s;if(R){let G=K(y,u)?.tabsMetadata?.[u];s={type:"pane",id:ue(),tabs:[u],activeTabId:u,tabsMetadata:G?{[u]:G}:void 0};}else s=Q(y,u)??{type:"pane",id:ue(),tabs:[u],activeTabId:u};let d=R?pe(y,u):be(y,u),H=ye(d,_,ae,W,s);n(H),m&&m(u,_,{type:"split",direction:ae,position:W});},onDragCancel:()=>{a(null),l(null),L(false),g(null),v(null),p(null),B?.(null),f.current=null,r!==null&&(n(r),o(null));}}}var Pt=({activeId:e,render:t,className:n})=>{let r=rn.useRef(null);return rn.useEffect(()=>{let o=i=>{r.current&&(r.current.style.transform=`translate(${i.clientX+12}px, ${i.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var xt=rn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,[o,i]=rn.useState(false),a=rn.useRef(null);if(rn.useEffect(()=>{i(true);},[]),rn.useEffect(()=>{if(!o||!a.current)return;let c=a.current;if(t)t.appendChild(c);else {let p=document.getElementById("zeugma-hidden-portal-container");p||(p=document.createElement("div"),p.id="zeugma-hidden-portal-container",p.style.display="none",document.body.appendChild(p)),p.appendChild(c);}},[t,o]),rn.useEffect(()=>()=>{a.current&&a.current.remove();},[]),!o)return null;a.current||(a.current=document.createElement("div"),a.current.className=`zeugma-portal-wrapper-${r}`,a.current.style.width="100%",a.current.style.height="100%");let l=a.current;return !l||!n?null:reactDom.createPortal(n(e),l)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index&&e.tabDetails.metadata===t.tabDetails.metadata);function tt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:i,layout:a,currentNode:l,onLayoutChange:c,onResizeStart:p,onResizeEnd:g,parentLeft:v,parentTop:D,parentWidth:N,parentHeight:P}){let{onResizeStart:z,onResize:I,onResizeEnd:$,minSplitPercentage:m=5,maxSplitPercentage:B=95,locked:U=false}=se();return rn.useCallback(E=>{if(U)return;E.preventDefault();let f=e.current;if(!f)return;p&&p(),z&&z(l);let T=f.getBoundingClientRect(),j=E.clientX,L=E.clientY,k=r,q=E.currentTarget,ee=T.left+T.width*(v/100),J=T.top+T.height*(D/100),S=T.width*(N/100),ie=T.height*(P/100),x=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(w=>w!==q&&w.getAttribute("data-direction")===n).map(w=>{let R=w.getBoundingClientRect();return t?R.left+R.width/2:R.top+R.height/2}),A=k;vt({cursor:t?"col-resize":"row-resize",resizerEl:q,onMove:w=>{let R=t?(w.clientX-j)/S*100:(w.clientY-L)/ie*100,u=k+R,F=t?ee+(S-o)*(u/100)+o/2:J+(ie-o)*(u/100)+o/2,y=1/0,C=null;for(let W of x){let _=Math.abs(F-W);_<i&&_<y&&(y=_,C=W);}let te=u;C!==null&&(te=t?(C-o/2-ee)/(S-o)*100:(C-o/2-J)/(ie-o)*100);let V=Math.max(m,Math.min(B,te));A=V;let O=he(a,l,V);if(O){let{panes:W,splitters:_}=ge(O),b=e.current;if(b){for(let h of W)b.style.setProperty(`--pane-left-${h.paneId}`,`${h.left}%`),b.style.setProperty(`--pane-top-${h.paneId}`,`${h.top}%`),b.style.setProperty(`--pane-width-${h.paneId}`,`${h.width}%`),b.style.setProperty(`--pane-height-${h.paneId}`,`${h.height}%`);for(let h of _)b.style.setProperty(`--splitter-pos-${h.id}`,`${h.direction==="row"?h.left:h.top}%`);}}I&&I(l,V);},onEnd:()=>{let w=he(a,l,A),R=e.current;if(R){let{panes:u,splitters:F}=ge(w);for(let y of u)R.style.removeProperty(`--pane-left-${y.paneId}`),R.style.removeProperty(`--pane-top-${y.paneId}`),R.style.removeProperty(`--pane-width-${y.paneId}`),R.style.removeProperty(`--pane-height-${y.paneId}`);for(let y of F)R.style.removeProperty(`--splitter-pos-${y.id}`);}c(w),g&&g(),$&&$(l,A);}});},[e,t,n,r,o,i,a,l,c,p,g,z,I,$,m,B,v,D,N,P])}var gn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{layout:o,setLayout:i,classNames:a,locked:l}=se(),[c,p]=rn.useState(false),{currentNode:g,direction:v,left:D,top:N,width:P,height:z,parentLeft:I,parentTop:$,parentWidth:m,parentHeight:B}=e,U=v==="row",E=tt({containerRef:r,isRow:U,direction:v,splitPercentage:g.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:g,onLayoutChange:i,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:I,parentTop:$,parentWidth:m,parentHeight:B}),f=U?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${D}%) - ${t/2}px)`,top:`calc(${N}% + ${t/2}px)`,width:`${t}px`,height:`calc(${z}% - ${t}px)`,cursor:l?"default":"col-resize",pointerEvents:l?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${D}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${N}%) - ${t/2}px)`,width:`calc(${P}% - ${t}px)`,height:`${t}px`,cursor:l?"default":"row-resize",pointerEvents:l?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":v,"data-resizing":c||void 0,style:f,onPointerDown:E,role:"separator","aria-valuenow":g.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},mn=rn__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),nt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{let{layout:o,activeId:i,dismissIntentId:a,setContainerRef:l,fullscreenPaneId:c,snapThreshold:p,locked:g,classNames:v,renderPane:D,resizerSize:N}=se(),P=r!==void 0?r:p??8,z=n!==void 0?n:N??4,I=e!==void 0?e:D;if(!I)throw new Error("PaneTree must be provided a renderPane prop or used within a Zeugma provider with renderPane.");let $=t!==void 0?t:o,m=rn.useRef(null),{panes:B,splitters:U}=rn.useMemo(()=>$?ge($):{panes:[],splitters:[]},[$]);if(!$)return null;let E=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[B.map(f=>{let T=c===f.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:T?"0%":`var(--pane-left-${f.paneId}, ${f.left}%)`,top:T?"0%":`var(--pane-top-${f.paneId}, ${f.top}%)`,width:T?"100%":`var(--pane-width-${f.paneId}, ${f.width}%)`,height:T?"100%":`var(--pane-height-${f.paneId}, ${f.height}%)`,overflow:"hidden",zIndex:T?20:1,display:c&&!T?"none":"block",padding:T?"0px":`${z/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(mn,{paneId:f.paneId,renderPane:I})},f.paneId)}),!c&&U.map(f=>jsxRuntime.jsx(gn,{splitter:f,resizerSize:z,snapThreshold:P,containerRef:m},f.id))]});if(t===void 0){let f=i!==null&&i===a,T=L=>{l(L),m.current=L;},j=`${v.dashboard||""} ${f&&v.dashboardDismissActive||""} ${g&&v.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:T,className:j,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[E(),i!==null&&!g&&jsxRuntime.jsx(Ct,{activeClassName:v.rootDropPreview??v.dropPreview})]})}return jsxRuntime.jsx("div",{ref:m,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:E()})};var wt=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:i,resizerSize:a,dragActivationDistance:l=8,snapThreshold:c=8,minSplitPercentage:p=5,maxSplitPercentage:g=95,enableDragToDismiss:v=false,dismissThreshold:D=60,onRemove:N,onDragStart:P,onDragEnd:z,onResizeStart:I,onResize:$,onResizeEnd:m,onDismissIntentChange:B}=e,U=t,{layout:E,setLayout:f,_internalSetLayout:T,fullscreenPaneId:j,setFullscreenPaneId:L,locked:k,setLocked:q,findPaneById:ee,findPaneContainingTab:J,findTabById:S,getTabMetadata:ie,getActiveTabMetadata:Z,activeId:x,setActiveId:A,activeType:w,setActiveType:R,dismissIntentId:u,setDismissIntentId:F,containerRef:y,setContainerRef:C,layoutBeforeDrag:te,setLayoutBeforeDrag:V,removePane:O,addTab:W,updateMetadata:_,updatePaneLock:b,selectTab:h,mergeTab:re,removeTab:ae,splitPane:s,updateSplitPercentage:d,moveTab:H}=U,{portalTargets:M,registerPortalTarget:G,registerRenderCallback:X,renderCallbacksRef:le}=pt(),[ne,xe]=rn.useState(null),[oe,we]=rn.useState(null),st=Tt({layout:E,_internalSetLayout:T,layoutBeforeDrag:te,setLayoutBeforeDrag:V,activeId:x,setActiveId:A,setActiveType:R,dismissIntentId:u,setDismissIntentId:F,setOverTabId:xe,setOverTabPosition:we,containerRef:y,dragActivationDistance:l,enableDragToDismiss:v,dismissThreshold:D,onRemove:N,onDragStart:P,onDragEnd:z,onDismissIntentChange:B,removeTab:ae,removePane:O}),it=rn.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),lt=rn.useCallback((ce,me)=>{m&&m(ce,me);},[m]),At=rn.useMemo(()=>({layout:E,setLayout:f,activeId:x,activeType:w,dismissIntentId:u,setContainerRef:C,fullscreenPaneId:j,classNames:it,onRemove:N,onFullscreenChange:L,snapThreshold:c,onResizeStart:I,onResize:$,onResizeEnd:lt,minSplitPercentage:p,maxSplitPercentage:g,locked:k,setLocked:q,findPaneById:ee,findPaneContainingTab:J,findTabById:S,getTabMetadata:ie,getActiveTabMetadata:Z,renderPane:i,resizerSize:a}),[E,x,w,u,C,j,it,N,L,c,I,$,p,g,f,lt,k,q,ee,J,S,ie,Z,i,a]),Bt=rn.useMemo(()=>({overTabId:ne,overTabPosition:oe}),[ne,oe]),Ht=rn.useMemo(()=>({removePane:O,addTab:W,updateMetadata:_,updatePaneLock:b,selectTab:h,mergeTab:re,removeTab:ae,setFullscreenPaneId:L,setLocked:q,splitPane:s,updateSplitPercentage:d,moveTab:H}),[O,W,_,b,h,re,ae,L,q,s,d,H]),Ot=rn.useMemo(()=>{let ce=new Set;function me(fe){fe&&(fe.type==="pane"?fe.tabs.forEach(Vt=>{ce.add(Vt);}):fe.type==="split"&&(me(fe.first),me(fe.second)));}return me(E),te&&me(te),Array.from(ce).sort()},[E,x,te]),Ft=rn.useMemo(()=>({registerPortalTarget:G,registerRenderCallback:X,renderCallbacksRef:le}),[G,X,le]);return jsxRuntime.jsx(Qe.Provider,{value:Ht,children:jsxRuntime.jsx(ze.Provider,{value:At,children:jsxRuntime.jsx(je.Provider,{value:Bt,children:jsxRuntime.jsxs($e.Provider,{value:Ft,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...st,children:n}),x&&w&&r&&jsxRuntime.jsx(Pt,{activeId:x,render:ce=>r({type:w,id:ce,isDismissing:x===u}),className:`${o.dragOverlay||""} ${x===u&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Ot.map(ce=>{let me=M[ce],fe=S(ce);return fe?jsxRuntime.jsx(xt,{tabDetails:fe,target:me||null,renderWidget:le.current[ce]},ce):null})})]})})})})},St=({renderPane:e,resizerSize:t,snapThreshold:n})=>jsxRuntime.jsx(nt,{renderPane:e,resizerSize:t,snapThreshold:n}),Tn=e=>{if(!(rn.useContext(ze)!==void 0)){let{controller:r,renderPane:o,...i}=e;if(!r)throw new Error("Zeugma component requires a controller when used standalone.");return jsxRuntime.jsx(wt,{controller:r,renderPane:o,...i,children:jsxRuntime.jsx(St,{...i})})}return jsxRuntime.jsx(St,{...e})};var yn={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},Rn={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Cn=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:i}=core.useDroppable({id:e}),a={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...Rn[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:yn[n][t]}),i&&jsxRuntime.jsx("div",{className:r,style:a})]})},Ct=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Cn,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var We=rn.createContext(null);var In={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},Ln={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"}},ot=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:In[t]}),o&&jsxRuntime.jsx("div",{className:n,style:Ln[t]})]})};var It=({children:e,className:t,style:n})=>{let r=rn.useContext(We);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...i}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:i,children:e})};var On=rn.createContext(void 0);var Le=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:i,classNames:a={},activeType:l}=se(),{overTabId:c}=Be(),p=rn.useContext(rt),g=t||i||(p?.locked??false),{attributes:v,listeners:D,setNodeRef:N,isDragging:P}=core.useDraggable({id:`tab-header-${e}`,disabled:g}),{setNodeRef:z,isOver:I}=core.useDroppable({id:`tab-drop-${e}`,disabled:g||l==="pane"}),$=J=>{N(J),z(J);},m=I&&c===e,B=p?.tabs||[],U=B.indexOf(e),E=p?.activeTabId,T=U>0&&e!==E&&B[U-1]!==E?jsxRuntime.jsx("div",{className:a.tabSeparator}):null,j=p?p.activeTabId===e:false,L=p?.tabsMetadata?.[e],k=rn.useCallback(()=>{p?.selectTab(e);},[p,e]),q=rn.useCallback(()=>{p?.removeTab(e);},[p,e]),ee=rn.useMemo(()=>({tabId:e,isActive:j,isDragging:P,isOver:m,metadata:L,locked:g,selectTab:k,removeTab:q}),[e,j,P,m,L,g,k,q]);return jsxRuntime.jsx(On.Provider,{value:ee,children:jsxRuntime.jsxs("div",{ref:$,className:r,style:{display:"inline-flex",position:"relative",cursor:g?"default":"grab",...o},...g?{}:D,...g?{}:v,children:[T,n({isDragging:P,isOver:m})]})})};var rt=rn.createContext(void 0);var Mt=(e,t)=>typeof e=="function"?e(t):e,at=({tabs:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:i,renderTab:a,classNames:l,styles:c})=>{let p=rn.useContext(Ue),g=e??p?.tabs??[],v=t??p?.activeTabId??"",D=n??p?.locked??false,N=r??p?.tabsMetadata,P=o??p?.selectTab??(()=>{}),z=i??p?.removeTab??(()=>{}),{classNames:I={},activeType:$}=se(),{overTabId:m,overTabPosition:B}=Be(),U=rn.useMemo(()=>({tabs:g,activeTabId:v,locked:D,tabsMetadata:N,selectTab:P,removeTab:z}),[g,v,D,N,P,z]),E=mt(g,$,m,B);return jsxRuntime.jsx(rt.Provider,{value:U,children:jsxRuntime.jsxs("div",{className:l?.container,style:{display:"flex",alignItems:"center",height:"100%",...c?.container},children:[g.map((f,T)=>{let j=N?.[f],L=Mt(l?.tab,f),k=Mt(c?.tab,f),q=T===E;return jsxRuntime.jsxs(rn__default.default.Fragment,{children:[q&&I.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:I.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:T===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Le,{id:f,locked:D,className:L,style:k,children:({isDragging:ee,isOver:J})=>a({tabId:f,activeTabId:v,isDragging:ee,isOver:J,metadata:j,onSelect:()=>P(f),onRemove:()=>z(f)})})]},f)}),E===g.length&&I.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:I.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};at.Tab=Le;var kt=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var Ue=rn.createContext(void 0),$t=()=>{let e=rn.useContext(Ue);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},Kn=({children:e,className:t,style:n})=>{let{activeTabId:r}=$t(),{classNames:o}=se(),i=rn.useRef(null),a=rn.useContext($e);if(!a)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:l,registerRenderCallback:c}=a,p=rn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);return c(r,p),rn.useEffect(()=>{let g=i.current;return l(r,g),()=>{l(r,null);}},[r,l]),jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",...n}})},Se=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,activeId:i,classNames:a,fullscreenPaneId:l,onFullscreenChange:c,locked:p}=se(),{removePane:g,updateMetadata:v,selectTab:D,removeTab:N}=Ae(),P=rn.useMemo(()=>Q(o,e),[o,e]),z=P?.id??e,I=P?.tabs??[e],$=P?.activeTabId??e,m=P?.tabsMetadata,B=m?.[e],U=P?.locked??false,E=r||U,f=p||E,T=p||E,j=i!==null&&i!==e&&(!I.includes(i)||I.length>1)&&!T,{attributes:L,listeners:k,setNodeRef:q}=core.useDraggable({id:e,disabled:f}),ee=i!==null&&I.includes(i),J=l===e,S=rn.useMemo(()=>({isDragging:ee,isFullscreen:J,toggleFullscreen:()=>c?.(J?null:e),remove:()=>{J&&c?.(null),g(z);},metadata:B,updateMetadata:x=>{v(e,x);},locked:f,tabs:I,activeTabId:$,selectTab:x=>D(z,x),removeTab:x=>{J&&x===$&&c?.(null),N(x);},tabsMetadata:m,updateTabMetadata:(x,A)=>{v(x,A);}}),[ee,J,c,e,N,B,v,f,I,$,D,z,m]),ie=rn.useMemo(()=>f?{disabled:true}:{...k,...L},[k,L,f]),Z=`${a.pane||""} ${E&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(Ue.Provider,{value:{id:e,...S},children:jsxRuntime.jsx(We.Provider,{value:ie,children:jsxRuntime.jsxs("div",{ref:q,className:Z,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,j&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(x=>jsxRuntime.jsx(ot,{id:`drop-${x}-${e}`,position:x,activeClassName:a.dropPreview},x))}),i!==null&&i!==e&&T&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(ot,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})})};Se.Content=Kn;Se.DragHandle=It;Se.Tabs=at;Se.Tab=Le;Se.Controls=kt;exports.Pane=Se;exports.PaneTree=nt;exports.Zeugma=Tn;exports.ZeugmaProvider=wt;exports.usePaneContext=$t;exports.useResizer=tt;exports.useZeugma=Xt;exports.useZeugmaContext=Yt;//# sourceMappingURL=index.cjs.map
|
|
6
|
+
`,document.head.appendChild(o),t.setAttribute("data-resizing","true");let i=l=>{n(l);},a=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let l=document.getElementById("zeugma-global-cursor-style");l&&l.remove(),document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",a),r();};document.addEventListener("pointermove",i),document.addEventListener("pointerup",a);}var Ke=nn.createContext(void 0),Qe=nn.createContext(void 0),ze=nn.createContext(void 0),je=nn.createContext(void 0),se=()=>{let e=nn.useContext(Ke);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},$e=()=>{let e=nn.useContext(Qe);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},Ae=()=>{let e=nn.useContext(je);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};var Ut=()=>{let e=se(),t=$e();return {layout:e.layout,setLayout:e.setLayout,fullscreenPaneId:e.fullscreenPaneId,setFullscreenPaneId:t.setFullscreenPaneId,locked:e.locked,setLocked:t.setLocked,removePane:t.removePane,addTab:t.addTab,updateMetadata:t.updateMetadata,updatePaneLock:t.updatePaneLock,selectTab:t.selectTab,mergeTab:t.mergeTab,removeTab:t.removeTab,splitPane:t.splitPane,updateSplitPercentage:t.updateSplitPercentage,moveTab:t.moveTab,findPaneById:e.findPaneById,findPaneContainingTab:e.findPaneContainingTab,findTabById:e.findTabById,getTabMetadata:e.getTabMetadata,getActiveTabMetadata:e.getActiveTabMetadata}};var Be=class extends core.PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},He=class extends core.TouchSensor{static activators=[{eventName:"onTouchStart",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]};function Oe(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 Tt(e){let{layout:t,_internalSetLayout:n,layoutBeforeDrag:r,setLayoutBeforeDrag:o,activeId:i,setActiveId:a,setActiveType:l,dismissIntentId:c,setDismissIntentId:p,setOverTabId:g,setOverTabPosition:v,containerRef:D,dragActivationDistance:N,enableDragToDismiss:P,dismissThreshold:z,onRemove:I,onDragStart:$,onDragEnd:m,onDismissIntentChange:B,removeTab:U,removePane:E}=e,f=nn.useRef(null),T=ut(i),[j,L]=nn.useState(false);dt(j);let Z=core.useSensors(core.useSensor(Be,{activationConstraint:{distance:N}}),core.useSensor(He,{activationConstraint:{delay:250,tolerance:5}})),q=nn.useCallback(k=>{let A=k.active.id.toString().startsWith("tab-header-"),w=core.pointerWithin(k),R=A?w:w.filter(u=>!u.id.toString().startsWith("tab-drop-"));if(R.length>0)return [...R].sort((F,y)=>{let C=F.id.toString(),te=y.id.toString();if(A){let W=C.startsWith("tab-drop-"),_=te.startsWith("tab-drop-");if(W&&!_)return -1;if(!W&&_)return 1}let V=C.startsWith("drop-root-"),O=te.startsWith("drop-root-");return V&&!O?-1:!V&&O?1:0});if(A){let u=k.droppableContainers.filter(F=>F.id.toString().startsWith("tab-drop-"));return core.closestCenter({...k,droppableContainers:u})}return []},[]);return {sensors:Z,collisionDetection:q,onDragStart:k=>{let x=k.active.id.toString(),A=x.startsWith("tab-header-"),w=A?x.substring(11):x;a(w),l(A?"tab":"pane"),g(null),v(null);let R=k.activatorEvent;T.current=Oe(R),P&&D.current?f.current=D.current.getBoundingClientRect():f.current=null;let u=t;if(A){let F=K(t,w);F&&(u=Re(t,F.id,w)||t);}o(u),A&&u!==t&&n(u),$&&$(w);},onDragMove:k=>{let{over:x}=k,A=x?.id.toString()||"",w=A.startsWith("drop-locked-");L(b=>b===w?b:w);let R=k.active.id.toString(),u=R.startsWith("tab-header-"),F=u?R.substring(11):R,y=A.match(/^tab-drop-(.+)$/);if(y&&x&&u){let[,b]=y;if(F!==b){let h="before",re=x.rect,ae=k.activatorEvent,s=null;if(T.current)s=T.current.x;else {let d=Oe(ae);d&&(s=d.x+k.delta.x);}if(s!==null){let d=re.left+re.width/2;s>d&&(h="after");}g(d=>d===b?d:b),v(d=>d===h?d:h);}else g(h=>h===null?h:null),v(h=>h===null?h:null);}else g(b=>b===null?b:null),v(b=>b===null?b:null);if(!P)return;let C=f.current;if(!C){c!==null&&(p(null),B?.(null));return}let te=k.activatorEvent,V=null,O=null;if(T.current)V=T.current.x,O=T.current.y;else {let b=Oe(te);b&&(V=b.x+k.delta.x,O=b.y+k.delta.y);}let W=0;if(V!==null&&O!==null){let b=0,h=0;V<C.left?b=C.left-V:V>C.right&&(b=V-C.right),O<C.top?h=C.top-O:O>C.bottom&&(h=O-C.bottom),W=Math.sqrt(b*b+h*h);}else {let b=k.active.rect.current.translated;if(b){let h=b.left+b.width/2,re=b.top+b.height/2,ae=0,s=0;h<C.left?ae=C.left-h:h>C.right&&(ae=h-C.right),re<C.top?s=C.top-re:re>C.bottom&&(s=re-C.bottom),W=Math.sqrt(ae*ae+s*s);}}W>z?c!==F&&(p(F),B?.(F)):c!==null&&(p(null),B?.(null));},onDragEnd:k=>{a(null),l(null),L(false),g(null),v(null);let{active:x,over:A}=k,w=x.id.toString(),R=w.startsWith("tab-header-"),u=R?w.substring(11):w,F=P&&c===u;p(null),B?.(null),f.current=null;let y=r||t;if(o(null),F){I?I(u):R?U(u):E(u),m&&m(u,null,null);return}if(!A){n(y),m&&m(u,null,null);return}let C=A.id.toString();if(C.startsWith("drop-locked-")){n(y),m&&m(u,null,null);return}let te=C.match(/^tab-drop-(.+)$/);if(te){if(!R){n(y),m&&m(u,null,null);return}let[,M]=te;if(u!==M){let G="before",X=A.rect,le=k.activatorEvent,ne=null;if(T.current)ne=T.current.x;else {let oe=Oe(le);oe&&(ne=oe.x+k.delta.x);}if(ne!==null){let oe=X.left+X.width/2;ne>oe&&(G="after");}let xe=ke(y,u,M,G);n(xe),m&&m(u,M,{type:"move",position:"center"});}else n(y),m&&m(u,null,null);return}let V=C.match(/^drop-root-(1\/4|1\/3)-(top|bottom|left|right|start|end)$/);if(V){let[,M,G]=V,X=G;X==="start"&&(X="left"),X==="end"&&(X="right");let le=R?de(y,u):be(y,u),ne;if(R){let oe=K(y,u)?.tabsMetadata?.[u];ne={type:"pane",id:ue(),tabs:[u],activeTabId:u,tabsMetadata:oe?{[u]:oe}:void 0};}else ne=Q(y,u)??{type:"pane",id:ue(),tabs:[u],activeTabId:u};if(le===null)n(ne);else {let xe=X==="left"||X==="right",oe=X==="left"||X==="top",we=50;M==="1/4"?we=oe?25:75:M==="1/3"&&(we=oe?100/3:200/3),n({type:"split",direction:xe?"row":"column",first:oe?ne:le,second:oe?le:ne,splitPercentage:we});}m&&m(u,"root",{type:"split",direction:X==="left"||X==="right"?"row":"column",position:X});return}let O=C.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!O){n(y),m&&m(u,null,null);return}let[,W,_]=O,b=R?K(y,u):Q(y,u),h=b&&b.id===_,re=b&&b.tabs.length===1;if(u===_||h&&re){n(y),m&&m(u,null,null);return}let ae=W==="left"||W==="right"?"row":"column",s;if(R){let G=K(y,u)?.tabsMetadata?.[u];s={type:"pane",id:ue(),tabs:[u],activeTabId:u,tabsMetadata:G?{[u]:G}:void 0};}else s=Q(y,u)??{type:"pane",id:ue(),tabs:[u],activeTabId:u};let d=R?de(y,u):be(y,u),H=ye(d,_,ae,W,s);n(H),m&&m(u,_,{type:"split",direction:ae,position:W});},onDragCancel:()=>{a(null),l(null),L(false),g(null),v(null),p(null),B?.(null),f.current=null,r!==null&&(n(r),o(null));}}}var Pt=({activeId:e,render:t,className:n})=>{let r=nn.useRef(null);return nn.useEffect(()=>{let o=i=>{r.current&&(r.current.style.transform=`translate(${i.clientX+12}px, ${i.clientY+12}px)`);};return document.addEventListener("pointermove",o),()=>document.removeEventListener("pointermove",o)},[]),jsxRuntime.jsx("div",{ref:r,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var xt=nn__default.default.memo(({tabDetails:e,target:t,renderWidget:n})=>{let{id:r}=e,[o,i]=nn.useState(false),a=nn.useRef(null);if(nn.useEffect(()=>{i(true);},[]),nn.useEffect(()=>{if(!o||!a.current)return;let c=a.current;if(t)t.appendChild(c);else {let p=document.getElementById("zeugma-hidden-portal-container");p||(p=document.createElement("div"),p.id="zeugma-hidden-portal-container",p.style.display="none",document.body.appendChild(p)),p.appendChild(c);}},[t,o]),nn.useEffect(()=>()=>{a.current&&a.current.remove();},[]),!o)return null;a.current||(a.current=document.createElement("div"),a.current.className=`zeugma-portal-wrapper-${r}`,a.current.style.width="100%",a.current.style.height="100%");let l=a.current;return !l||!n?null:reactDom.createPortal(n(e),l)},(e,t)=>e.target===t.target&&e.renderWidget===t.renderWidget&&e.tabDetails.id===t.tabDetails.id&&e.tabDetails.paneId===t.tabDetails.paneId&&e.tabDetails.isActive===t.tabDetails.isActive&&e.tabDetails.index===t.tabDetails.index&&e.tabDetails.metadata===t.tabDetails.metadata);function tt({containerRef:e,isRow:t,direction:n,splitPercentage:r,resizerSize:o,snapThreshold:i,layout:a,currentNode:l,onLayoutChange:c,onResizeStart:p,onResizeEnd:g,parentLeft:v,parentTop:D,parentWidth:N,parentHeight:P}){let{onResizeStart:z,onResize:I,onResizeEnd:$,minSplitPercentage:m=5,maxSplitPercentage:B=95,locked:U=false}=se();return nn.useCallback(E=>{if(U)return;E.preventDefault();let f=e.current;if(!f)return;p&&p(),z&&z(l);let T=f.getBoundingClientRect(),j=E.clientX,L=E.clientY,Z=r,q=E.currentTarget,ee=T.left+T.width*(v/100),J=T.top+T.height*(D/100),S=T.width*(N/100),ie=T.height*(P/100),x=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(w=>w!==q&&w.getAttribute("data-direction")===n).map(w=>{let R=w.getBoundingClientRect();return t?R.left+R.width/2:R.top+R.height/2}),A=Z;vt({cursor:t?"col-resize":"row-resize",resizerEl:q,onMove:w=>{let R=t?(w.clientX-j)/S*100:(w.clientY-L)/ie*100,u=Z+R,F=t?ee+(S-o)*(u/100)+o/2:J+(ie-o)*(u/100)+o/2,y=1/0,C=null;for(let W of x){let _=Math.abs(F-W);_<i&&_<y&&(y=_,C=W);}let te=u;C!==null&&(te=t?(C-o/2-ee)/(S-o)*100:(C-o/2-J)/(ie-o)*100);let V=Math.max(m,Math.min(B,te));A=V;let O=he(a,l,V);if(O){let{panes:W,splitters:_}=ge(O),b=e.current;if(b){for(let h of W)b.style.setProperty(`--pane-left-${h.paneId}`,`${h.left}%`),b.style.setProperty(`--pane-top-${h.paneId}`,`${h.top}%`),b.style.setProperty(`--pane-width-${h.paneId}`,`${h.width}%`),b.style.setProperty(`--pane-height-${h.paneId}`,`${h.height}%`);for(let h of _)b.style.setProperty(`--splitter-pos-${h.id}`,`${h.direction==="row"?h.left:h.top}%`);}}I&&I(l,V);},onEnd:()=>{let w=he(a,l,A),R=e.current;if(R){let{panes:u,splitters:F}=ge(w);for(let y of u)R.style.removeProperty(`--pane-left-${y.paneId}`),R.style.removeProperty(`--pane-top-${y.paneId}`),R.style.removeProperty(`--pane-width-${y.paneId}`),R.style.removeProperty(`--pane-height-${y.paneId}`);for(let y of F)R.style.removeProperty(`--splitter-pos-${y.id}`);}c(w),g&&g(),$&&$(l,A);}});},[e,t,n,r,o,i,a,l,c,p,g,z,I,$,m,B,v,D,N,P])}var pn=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:r})=>{let{layout:o,setLayout:i,classNames:a,locked:l}=se(),[c,p]=nn.useState(false),{currentNode:g,direction:v,left:D,top:N,width:P,height:z,parentLeft:I,parentTop:$,parentWidth:m,parentHeight:B}=e,U=v==="row",E=tt({containerRef:r,isRow:U,direction:v,splitPercentage:g.splitPercentage,resizerSize:t,snapThreshold:n,layout:o,currentNode:g,onLayoutChange:i,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:I,parentTop:$,parentWidth:m,parentHeight:B}),f=U?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${D}%) - ${t/2}px)`,top:`calc(${N}% + ${t/2}px)`,width:`${t}px`,height:`calc(${z}% - ${t}px)`,cursor:l?"default":"col-resize",pointerEvents:l?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"}:{position:"absolute",left:`calc(${D}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${N}%) - ${t/2}px)`,width:`calc(${P}% - ${t}px)`,height:`${t}px`,cursor:l?"default":"row-resize",pointerEvents:l?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsxRuntime.jsx("div",{className:a.resizer||"","data-direction":v,"data-resizing":c||void 0,style:f,onPointerDown:E,role:"separator","aria-valuenow":g.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},fn=nn__default.default.memo(({paneId:e,renderPane:t})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),nt=({renderPane:e,tree:t,resizerSize:n,snapThreshold:r})=>{let{layout:o,activeId:i,dismissIntentId:a,setContainerRef:l,fullscreenPaneId:c,snapThreshold:p,locked:g,classNames:v,renderPane:D,resizerSize:N}=se(),P=r!==void 0?r:p??8,z=n!==void 0?n:N??4,I=e!==void 0?e:D;if(!I)throw new Error("PaneTree must be provided a renderPane prop or used within a Zeugma provider with renderPane.");let $=t!==void 0?t:o,m=nn.useRef(null),{panes:B,splitters:U}=nn.useMemo(()=>$?ge($):{panes:[],splitters:[]},[$]);if(!$)return null;let E=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[B.map(f=>{let T=c===f.paneId;return jsxRuntime.jsx("div",{style:{position:"absolute",left:T?"0%":`var(--pane-left-${f.paneId}, ${f.left}%)`,top:T?"0%":`var(--pane-top-${f.paneId}, ${f.top}%)`,width:T?"100%":`var(--pane-width-${f.paneId}, ${f.width}%)`,height:T?"100%":`var(--pane-height-${f.paneId}, ${f.height}%)`,overflow:"hidden",zIndex:T?20:1,display:c&&!T?"none":"block",padding:T?"0px":`${z/2}px`,boxSizing:"border-box"},children:jsxRuntime.jsx(fn,{paneId:f.paneId,renderPane:I})},f.paneId)}),!c&&U.map(f=>jsxRuntime.jsx(pn,{splitter:f,resizerSize:z,snapThreshold:P,containerRef:m},f.id))]});if(t===void 0){let f=i!==null&&i===a,T=L=>{l(L),m.current=L;},j=`${v.dashboard||""} ${f&&v.dashboardDismissActive||""} ${g&&v.dashboardLocked||""}`.trim();return jsxRuntime.jsxs("div",{ref:T,className:j,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[E(),i!==null&&!g&&jsxRuntime.jsx(Ct,{activeClassName:v.rootDropPreview??v.dropPreview})]})}return jsxRuntime.jsx("div",{ref:m,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:E()})};var bn=e=>{let{controller:t,children:n,renderDragOverlay:r,classNames:o={},renderPane:i,resizerSize:a,dragActivationDistance:l=8,snapThreshold:c=8,minSplitPercentage:p=5,maxSplitPercentage:g=95,enableDragToDismiss:v=false,dismissThreshold:D=60,onRemove:N,onDragStart:P,onDragEnd:z,onResizeStart:I,onResize:$,onResizeEnd:m,onDismissIntentChange:B}=e,U=t,{layout:E,setLayout:f,_internalSetLayout:T,fullscreenPaneId:j,setFullscreenPaneId:L,locked:Z,setLocked:q,findPaneById:ee,findPaneContainingTab:J,findTabById:S,getTabMetadata:ie,getActiveTabMetadata:k,activeId:x,setActiveId:A,activeType:w,setActiveType:R,dismissIntentId:u,setDismissIntentId:F,containerRef:y,setContainerRef:C,layoutBeforeDrag:te,setLayoutBeforeDrag:V,removePane:O,addTab:W,updateMetadata:_,updatePaneLock:b,selectTab:h,mergeTab:re,removeTab:ae,splitPane:s,updateSplitPercentage:d,moveTab:H}=U,{portalTargets:M,registerPortalTarget:G,registerRenderCallback:X,renderCallbacksRef:le}=pt(),[ne,xe]=nn.useState(null),[oe,we]=nn.useState(null),st=Tt({layout:E,_internalSetLayout:T,layoutBeforeDrag:te,setLayoutBeforeDrag:V,activeId:x,setActiveId:A,setActiveType:R,dismissIntentId:u,setDismissIntentId:F,setOverTabId:xe,setOverTabPosition:we,containerRef:y,dragActivationDistance:l,enableDragToDismiss:v,dismissThreshold:D,onRemove:N,onDragStart:P,onDragEnd:z,onDismissIntentChange:B,removeTab:ae,removePane:O}),it=nn.useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.rootDropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview,o.tabSeparator,o.tabsContainer,o.tab,o.paneContainer,o.paneHeader,o.paneControls,o.paneButton,o.tabCloseButton,o.dragHandle]),lt=nn.useCallback((ce,me)=>{m&&m(ce,me);},[m]),zt=nn.useMemo(()=>({layout:E,setLayout:f,activeId:x,activeType:w,dismissIntentId:u,setContainerRef:C,fullscreenPaneId:j,classNames:it,onRemove:N,onFullscreenChange:L,snapThreshold:c,onResizeStart:I,onResize:$,onResizeEnd:lt,minSplitPercentage:p,maxSplitPercentage:g,locked:Z,setLocked:q,findPaneById:ee,findPaneContainingTab:J,findTabById:S,getTabMetadata:ie,getActiveTabMetadata:k,renderPane:i,resizerSize:a}),[E,x,w,u,C,j,it,N,L,c,I,$,p,g,f,lt,Z,q,ee,J,S,ie,k,i,a]),$t=nn.useMemo(()=>({overTabId:ne,overTabPosition:oe}),[ne,oe]),At=nn.useMemo(()=>({removePane:O,addTab:W,updateMetadata:_,updatePaneLock:b,selectTab:h,mergeTab:re,removeTab:ae,setFullscreenPaneId:L,setLocked:q,splitPane:s,updateSplitPercentage:d,moveTab:H}),[O,W,_,b,h,re,ae,L,q,s,d,H]),Bt=nn.useMemo(()=>{let ce=new Set;function me(fe){fe&&(fe.type==="pane"?fe.tabs.forEach(Ot=>{ce.add(Ot);}):fe.type==="split"&&(me(fe.first),me(fe.second)));}return me(E),te&&me(te),Array.from(ce).sort()},[E,x,te]),Ht=nn.useMemo(()=>({registerPortalTarget:G,registerRenderCallback:X,renderCallbacksRef:le}),[G,X,le]);return jsxRuntime.jsx(Qe.Provider,{value:At,children:jsxRuntime.jsx(Ke.Provider,{value:zt,children:jsxRuntime.jsx(je.Provider,{value:$t,children:jsxRuntime.jsxs(ze.Provider,{value:Ht,children:[jsxRuntime.jsx(core.DndContext,{id:"zeugma-dnd-context",...st,children:n}),x&&w&&r&&jsxRuntime.jsx(Pt,{activeId:x,render:ce=>r({type:w,id:ce,isDismissing:x===u}),className:`${o.dragOverlay||""} ${x===u&&o.dismissPreview||""}`.trim()}),jsxRuntime.jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:Bt.map(ce=>{let me=M[ce],fe=S(ce);return fe?jsxRuntime.jsx(xt,{tabDetails:fe,target:me||null,renderWidget:le.current[ce]},ce):null})})]})})})})},vn=({renderPane:e,resizerSize:t,snapThreshold:n})=>jsxRuntime.jsx(nt,{renderPane:e,resizerSize:t,snapThreshold:n}),hn=e=>{let{children:t,...n}=e,{controller:r}=e;if(!r)throw new Error("Zeugma component requires a controller.");return jsxRuntime.jsx(bn,{...e,children:t!==void 0?t:jsxRuntime.jsx(vn,{...n})})};var xn={top:{"1/4":{position:"absolute",top:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",top:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},bottom:{"1/4":{position:"absolute",bottom:0,left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",bottom:"24px",left:0,width:"100%",height:"24px",zIndex:100,pointerEvents:"auto"}},left:{"1/4":{position:"absolute",left:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",left:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}},right:{"1/4":{position:"absolute",right:0,top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"},"1/3":{position:"absolute",right:"24px",top:"48px",width:"24px",height:"calc(100% - 96px)",zIndex:100,pointerEvents:"auto"}}},yn={top:{"1/4":{top:0,left:0,width:"100%",height:"60px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"},"1/3":{top:0,left:0,width:"100%",height:"96px",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},bottom:{"1/4":{bottom:0,left:0,width:"100%",height:"60px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{bottom:0,left:0,width:"100%",height:"96px",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"}},left:{"1/4":{left:0,top:0,width:"60px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},"1/3":{left:0,top:0,width:"96px",height:"100%",borderTopRightRadius:"12px",borderBottomRightRadius:"12px",borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"}},right:{"1/4":{right:0,top:0,width:"60px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"},"1/3":{right:0,top:0,width:"96px",height:"100%",borderTopLeftRadius:"12px",borderBottomLeftRadius:"12px",borderTopRightRadius:"0px",borderBottomRightRadius:"0px"}}},Rn=({id:e,fraction:t,edge:n,activeClassName:r})=>{let{setNodeRef:o,isOver:i}=core.useDroppable({id:e}),a={position:"absolute",pointerEvents:"none",zIndex:101,boxSizing:"border-box",...yn[n][t]};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:o,style:xn[n][t]}),i&&jsxRuntime.jsx("div",{className:r,style:a})]})},Ct=({activeClassName:e})=>jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:99,pointerEvents:"none"},children:[{id:"drop-root-1/4-top",fraction:"1/4",edge:"top"},{id:"drop-root-1/3-top",fraction:"1/3",edge:"top"},{id:"drop-root-1/4-bottom",fraction:"1/4",edge:"bottom"},{id:"drop-root-1/3-bottom",fraction:"1/3",edge:"bottom"},{id:"drop-root-1/4-left",fraction:"1/4",edge:"left"},{id:"drop-root-1/3-left",fraction:"1/3",edge:"left"},{id:"drop-root-1/4-right",fraction:"1/4",edge:"right"},{id:"drop-root-1/3-right",fraction:"1/3",edge:"right"}].map(n=>jsxRuntime.jsx(Rn,{id:n.id,fraction:n.fraction,edge:n.edge,activeClassName:e},n.id))});var Ve=nn.createContext(null);var Nn={top:{position:"absolute",top:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},bottom:{position:"absolute",bottom:0,left:0,width:"100%",height:"25%",zIndex:20,pointerEvents:"auto"},left:{position:"absolute",top:"25%",left:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},right:{position:"absolute",top:"25%",right:0,width:"50%",height:"50%",zIndex:20,pointerEvents:"auto"},full:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:20,pointerEvents:"auto",cursor:"not-allowed"}},In={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"}},ot=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:r,isOver:o}=core.useDroppable({id:e});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:r,style:Nn[t]}),o&&jsxRuntime.jsx("div",{className:n,style:In[t]})]})};var wt=({children:e,className:t,style:n})=>{let r=nn.useContext(Ve);if(!r)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:o,...i}=r;return jsxRuntime.jsx("div",{className:t,style:{cursor:o?"default":"grab",userSelect:o?"auto":"none",touchAction:o?"auto":"none",...n},...o?{}:i,children:e})};var Hn=nn.createContext(void 0);var Le=({id:e,locked:t=false,children:n,className:r,style:o})=>{let{locked:i,classNames:a={},activeType:l}=se(),{overTabId:c}=Ae(),p=nn.useContext(rt),g=t||i||(p?.locked??false),{attributes:v,listeners:D,setNodeRef:N,isDragging:P}=core.useDraggable({id:`tab-header-${e}`,disabled:g}),{setNodeRef:z,isOver:I}=core.useDroppable({id:`tab-drop-${e}`,disabled:g||l==="pane"}),$=J=>{N(J),z(J);},m=I&&c===e,B=p?.tabs||[],U=B.indexOf(e),E=p?.activeTabId,T=U>0&&e!==E&&B[U-1]!==E?jsxRuntime.jsx("div",{className:a.tabSeparator}):null,j=p?p.activeTabId===e:false,L=p?.tabsMetadata?.[e],Z=nn.useCallback(()=>{p?.selectTab(e);},[p,e]),q=nn.useCallback(()=>{p?.removeTab(e);},[p,e]),ee=nn.useMemo(()=>({tabId:e,isActive:j,isDragging:P,isOver:m,metadata:L,locked:g,selectTab:Z,removeTab:q}),[e,j,P,m,L,g,Z,q]);return jsxRuntime.jsx(Hn.Provider,{value:ee,children:jsxRuntime.jsxs("div",{ref:$,className:r,style:{display:"inline-flex",position:"relative",cursor:g?"default":"grab",...o},...g?{}:D,...g?{}:v,children:[T,n({isDragging:P,isOver:m})]})})};var rt=nn.createContext(void 0);var Lt=(e,t)=>typeof e=="function"?e(t):e,at=({tabs:e,activeTabId:t,locked:n,tabsMetadata:r,selectTab:o,removeTab:i,renderTab:a,classNames:l,styles:c})=>{let p=nn.useContext(We),g=e??p?.tabs??[],v=t??p?.activeTabId??"",D=n??p?.locked??false,N=r??p?.tabsMetadata,P=o??p?.selectTab??(()=>{}),z=i??p?.removeTab??(()=>{}),{classNames:I={},activeType:$}=se(),{overTabId:m,overTabPosition:B}=Ae(),U=nn.useMemo(()=>({tabs:g,activeTabId:v,locked:D,tabsMetadata:N,selectTab:P,removeTab:z}),[g,v,D,N,P,z]),E=mt(g,$,m,B);return jsxRuntime.jsx(rt.Provider,{value:U,children:jsxRuntime.jsxs("div",{className:l?.container,style:{display:"flex",alignItems:"center",height:"100%",...c?.container},children:[g.map((f,T)=>{let j=N?.[f],L=Lt(l?.tab,f),Z=Lt(c?.tab,f),q=T===E;return jsxRuntime.jsxs(nn__default.default.Fragment,{children:[q&&I.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:I.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:T===0?"none":"translateX(-50%)"}})}),jsxRuntime.jsx(Le,{id:f,locked:D,className:L,style:Z,children:({isDragging:ee,isOver:J})=>a({tabId:f,activeTabId:v,isDragging:ee,isOver:J,metadata:j,onSelect:()=>P(f),onRemove:()=>z(f)})})]},f)}),E===g.length&&I.tabDropPreview&&jsxRuntime.jsx("div",{style:{position:"relative",height:"100%",width:0,zIndex:10},children:jsxRuntime.jsx("div",{className:I.tabDropPreview,style:{position:"absolute",top:0,bottom:0,transform:"translateX(-100%)"}})})]})})};at.Tab=Le;var Mt=({className:e,style:t,children:n})=>jsxRuntime.jsx("div",{className:e,style:t,children:n});var We=nn.createContext(void 0),Zt=()=>{let e=nn.useContext(We);if(!e)throw new Error("usePaneContext must be used within a Pane component");return e},Gn=({children:e,className:t,style:n})=>{let{activeTabId:r}=Zt(),{classNames:o}=se(),i=nn.useRef(null),a=nn.useContext(ze);if(!a)throw new Error("PaneContent must be used within a Zeugma provider");let{registerPortalTarget:l,registerRenderCallback:c}=a,p=nn.useMemo(()=>typeof e=="function"?e:()=>e,[e]);return c(r,p),nn.useEffect(()=>{let g=i.current;return l(r,g),()=>{l(r,null);}},[r,l]),jsxRuntime.jsx("div",{ref:i,id:`zeugma-tab-target-${r}`,className:`${o.tabContentWrapper||""} ${t||""}`.trim(),style:{height:"100%",width:"100%",...n}})},Se=({id:e,children:t,style:n,locked:r=false})=>{let{layout:o,activeId:i,classNames:a,fullscreenPaneId:l,onFullscreenChange:c,locked:p}=se(),{removePane:g,updateMetadata:v,selectTab:D,removeTab:N}=$e(),P=nn.useMemo(()=>Q(o,e),[o,e]),z=P?.id??e,I=P?.tabs??[e],$=P?.activeTabId??e,m=P?.tabsMetadata,B=m?.[e],U=P?.locked??false,E=r||U,f=p||E,T=p||E,j=i!==null&&i!==e&&(!I.includes(i)||I.length>1)&&!T,{attributes:L,listeners:Z,setNodeRef:q}=core.useDraggable({id:e,disabled:f}),ee=i!==null&&I.includes(i),J=l===e,S=nn.useMemo(()=>({isDragging:ee,isFullscreen:J,toggleFullscreen:()=>c?.(J?null:e),remove:()=>{J&&c?.(null),g(z);},metadata:B,updateMetadata:x=>{v(e,x);},locked:f,tabs:I,activeTabId:$,selectTab:x=>D(z,x),removeTab:x=>{J&&x===$&&c?.(null),N(x);},tabsMetadata:m,updateTabMetadata:(x,A)=>{v(x,A);}}),[ee,J,c,e,N,B,v,f,I,$,D,z,m]),ie=nn.useMemo(()=>f?{disabled:true}:{...Z,...L},[Z,L,f]),k=`${a.pane||""} ${E&&a.paneLocked||""}`.trim();return jsxRuntime.jsx(We.Provider,{value:{id:e,...S},children:jsxRuntime.jsx(Ve.Provider,{value:ie,children:jsxRuntime.jsxs("div",{ref:q,className:k,style:{position:"relative",width:"100%",height:"100%",...n},children:[t,j&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(x=>jsxRuntime.jsx(ot,{id:`drop-${x}-${e}`,position:x,activeClassName:a.dropPreview},x))}),i!==null&&i!==e&&T&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsxRuntime.jsx(ot,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})})};Se.Content=Gn;Se.DragHandle=wt;Se.Tabs=at;Se.Tab=Le;Se.Controls=Mt;exports.Pane=Se;exports.PaneTree=nt;exports.Zeugma=hn;exports.usePaneContext=Zt;exports.useResizer=tt;exports.useZeugma=Wt;exports.useZeugmaContext=Ut;//# sourceMappingURL=index.cjs.map
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|