react-zeugma 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-BjBbRjIM.d.cts → types-C0Yf1Bdw.d.cts} +5 -3
- package/dist/{types-BjBbRjIM.d.ts → types-C0Yf1Bdw.d.ts} +5 -3
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as ZeugmaDragStateValue, b as ZeugmaInternalStateValue, c as ZeugmaStateValue, U as UseZeugmaOptions, d as ZeugmaController, e as ZeugmaContextValue, f as ZeugmaProps, S as SplitDirection, T as TreeNode, g as SplitNode } from './types-C0Yf1Bdw.cjs';
|
|
2
|
+
export { h as PaneNode, i as TabDetails, j as ZeugmaClassNames, k as ZeugmaInternalController } from './types-C0Yf1Bdw.cjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { ReactNode } from 'react';
|
|
5
5
|
|
|
@@ -37,8 +37,10 @@ declare function safeJsonStringify(val: unknown): string;
|
|
|
37
37
|
declare const ZeugmaStateContext: React.Context<ZeugmaInternalStateValue | undefined>;
|
|
38
38
|
declare const ZeugmaActionsContext: React.Context<ZeugmaActionsValue | undefined>;
|
|
39
39
|
declare const PortalRegistryContext: React.Context<PortalRegistryValue | undefined>;
|
|
40
|
+
declare const ZeugmaDragContext: React.Context<ZeugmaDragStateValue | undefined>;
|
|
40
41
|
declare const useZeugmaState: () => ZeugmaStateValue;
|
|
41
42
|
declare const useZeugmaActions: () => ZeugmaActionsValue;
|
|
43
|
+
declare const useZeugmaDrag: () => ZeugmaDragStateValue;
|
|
42
44
|
|
|
43
45
|
declare function useZeugma(options: UseZeugmaOptions): ZeugmaController;
|
|
44
46
|
|
|
@@ -183,4 +185,4 @@ interface TabsProps {
|
|
|
183
185
|
}
|
|
184
186
|
declare const Tabs: React__default.FC<TabsProps>;
|
|
185
187
|
|
|
186
|
-
export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tabs, type TabsProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };
|
|
188
|
+
export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tabs, type TabsProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaDragContext, ZeugmaDragStateValue, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaDrag, useZeugmaState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PortalRegistryValue, Z as ZeugmaActionsValue, a as ZeugmaDragStateValue, b as ZeugmaInternalStateValue, c as ZeugmaStateValue, U as UseZeugmaOptions, d as ZeugmaController, e as ZeugmaContextValue, f as ZeugmaProps, S as SplitDirection, T as TreeNode, g as SplitNode } from './types-C0Yf1Bdw.js';
|
|
2
|
+
export { h as PaneNode, i as TabDetails, j as ZeugmaClassNames, k as ZeugmaInternalController } from './types-C0Yf1Bdw.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { ReactNode } from 'react';
|
|
5
5
|
|
|
@@ -37,8 +37,10 @@ declare function safeJsonStringify(val: unknown): string;
|
|
|
37
37
|
declare const ZeugmaStateContext: React.Context<ZeugmaInternalStateValue | undefined>;
|
|
38
38
|
declare const ZeugmaActionsContext: React.Context<ZeugmaActionsValue | undefined>;
|
|
39
39
|
declare const PortalRegistryContext: React.Context<PortalRegistryValue | undefined>;
|
|
40
|
+
declare const ZeugmaDragContext: React.Context<ZeugmaDragStateValue | undefined>;
|
|
40
41
|
declare const useZeugmaState: () => ZeugmaStateValue;
|
|
41
42
|
declare const useZeugmaActions: () => ZeugmaActionsValue;
|
|
43
|
+
declare const useZeugmaDrag: () => ZeugmaDragStateValue;
|
|
42
44
|
|
|
43
45
|
declare function useZeugma(options: UseZeugmaOptions): ZeugmaController;
|
|
44
46
|
|
|
@@ -183,4 +185,4 @@ interface TabsProps {
|
|
|
183
185
|
}
|
|
184
186
|
declare const Tabs: React__default.FC<TabsProps>;
|
|
185
187
|
|
|
186
|
-
export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tabs, type TabsProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaState };
|
|
188
|
+
export { DEFAULT_DRAG_ACTIVATION_DISTANCE, DEFAULT_RESIZER_SIZE, DEFAULT_SNAP_THRESHOLD, DragHandle, type DragHandleProps, type DragSessionConfig, Pane, type PaneProps, type PaneRenderProps, PaneTree, PortalRegistryContext, PortalRegistryValue, ResizableContainer, type ResizableContainerProps, SplitDirection, SplitNode, Tabs, type TabsProps, TreeNode, UseZeugmaOptions, Zeugma, ZeugmaActionsContext, ZeugmaActionsValue, ZeugmaContextValue, ZeugmaController, ZeugmaDragContext, ZeugmaDragStateValue, ZeugmaInternalStateValue, ZeugmaProps, ZeugmaStateContext, ZeugmaStateValue, createDragSession, safeJsonStringify, useResizer, useZeugma, useZeugmaActions, useZeugmaContext, useZeugmaDrag, useZeugmaState };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Tt,{createContext,useState,useRef,useEffect,useCallback,useContext,useMemo}from'react';import {DndContext,useDraggable,useSensors,useSensor,pointerWithin,closestCenter,useDroppable,PointerSensor,TouchSensor}from'@dnd-kit/core';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {createPortal}from'react-dom';function Ge(e){let t=useRef(null);return 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 Ke(e){useEffect(()=>(e?document.body.style.setProperty("cursor","not-allowed","important"):document.body.style.removeProperty("cursor"),()=>{document.body.style.removeProperty("cursor");}),[e]);}function je(){let[e,t]=useState({}),n=useRef(true);useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=useCallback((r,o)=>{n.current&&t(a=>a[r]===o?a:{...a,[r]:o});},[]);return {portalTargets:e,registerPortalTarget:s}}var Ct=8,wt=8,In=4;function pe(){return "pane-"+Math.random().toString(36).substring(2,11)}function ge(e,t){if(e===null)return null;if(e.type==="pane")return e.id===t?null:e;let n=ge(e.first,t),s=ge(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function fe(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=fe(e.first,t),s=fe(e.second,t);return n===null?s:s===null?n:{...e,first:n,second:s}}function Te(e,t,n,s,r){if(e===null)return typeof r=="string"?{type:"pane",id:pe(),tabs:[r],activeTabId:r}:r;if(e.type==="pane"){if(e.id===t){let o=typeof r=="string"?{type:"pane",id:pe(),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:Te(e.first,t,n,s,r)||e.first,second:Te(e.second,t,n,s,r)||e.second}}function Qe(e,t,n){if(e===null)return {type:"pane",id:pe(),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:pe(),tabs:[t],activeTabId:t,tabsMetadata:n?{[t]:n}:void 0}}:{...r,second:s(r.second,r.direction)}}return s(e,null)}function be(e,t,n){return e===null?null:e===t?{...e,splitPercentage:n}:e.type==="split"?{...e,first:be(e.first,t,n)||e.first,second:be(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 X(e,t){return e===null?null:e.type==="pane"?e.tabs.includes(t)?e:null:X(e.first,t)??X(e.second,t)}function et(e,t){let n=X(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 Se(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:Se(e.first,t,n)??e.first,second:Se(e.second,t,n)??e.second}}function De(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:De(e.first,t,n,s)||e.first,second:De(e.second,t,n,s)||e.second}}function Ce(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:Ce(e.first,t,n)??e.first,second:Ce(e.second,t,n)??e.second}}function we(e,t,n){return e===null?null:e.type==="pane"?e.id===t?{...e,activeTabId:n}:e:{...e,first:we(e.first,t,n)??e.first,second:we(e.second,t,n)??e.second}}function tt(e,t,n){if(e===null)return null;let r=X(e,t)?.tabsMetadata?.[t],o=fe(e,t);if(o===null)return {type:"pane",id:pe(),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 p={...i.tabsMetadata};return r&&(p[t]=r),{...i,tabs:u,activeTabId:t,tabsMetadata:Object.keys(p).length>0?p:void 0}}return i}return {...i,first:a(i.first),second:a(i.second)}}return a(o)}function nt(e,t,n,s="before"){if(e===null)return null;let o=X(e,t)?.tabsMetadata?.[t],a=fe(e,t);if(a===null)return {type:"pane",id:pe(),tabs:[t],activeTabId:t,tabsMetadata:o?{[t]:o}:void 0};function i(u){if(u.type==="pane"){if(u.tabs.includes(n)){let x=[...u.tabs].filter(D=>D!==t),m=x.indexOf(n);m<0&&(m=0),s==="after"&&(m+=1),x.splice(m,0,t);let v={...u.tabsMetadata};return o&&(v[t]=o),{...u,tabs:x,activeTabId:t,tabsMetadata:Object.keys(v).length>0?v:void 0}}return u}return {...u,first:i(u.first),second:i(u.second)}}return i(a)}function de(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:p}=e,m={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},v={panes:[],splitters:[]},D={panes:[],splitters:[]};if(a==="row"){let C=s*(i/100);v=de(u,t,n,C,r,`${o}-L`),D=de(p,t+C,n,s-C,r,`${o}-R`);}else {let C=r*(i/100);v=de(u,t,n,s,C,`${o}-T`),D=de(p,t,n+C,s,r-C,`${o}-B`);}return {panes:[...v.panes,...D.panes],splitters:[m,...v.splitters,...D.splitters]}}function Re(e){try{return JSON.stringify(e)}catch{return ""}}function Et(e){let{initialLayout:t,layout:n,onChange:s,fullscreenPaneId:r,onFullscreenChange:o,locked:a=false,dragActivationDistance:i=8,snapThreshold:u=8,minSplitPercentage:p=5,maxSplitPercentage:x=95,enableDragToDismiss:m=false,dismissThreshold:v=60,onRemove:D,onDragStart:C,onDragEnd:$,onResizeStart:f,onResize:w,onResizeEnd:g,onDismissIntentChange:y}=e,[P,E]=useState(()=>n!==void 0?n:t??null),[k,N]=useState(()=>Re(n!==void 0?n:null)),[J,H]=useState(r||null),[K,W]=useState(a),[G,ee]=useState(null),[te,d]=useState(null),[R,F]=useState(null),I=useRef(null),S=useCallback(c=>{I.current=c;},[]),l=useRef(P);l.current=P;let L=useRef(s);L.current=s;let _=useRef(o);_.current=o;let T=useCallback(c=>{H(c),_.current?.(c);},[]);if(useEffect(()=>{W(a);},[a]),useEffect(()=>{r!==void 0&&H(r);},[r]),n!==void 0){let c=Re(n);c!==k&&(N(c),E(n));}let h=useCallback(c=>(...M)=>{let O=l.current,U=c(O,...M);Re(O)!==Re(U)&&(l.current=U,E(U),L.current?.(U));},[]),V=useCallback(h((c,M)=>typeof M=="function"?M(c):M),[h]),j=useCallback(h((c,M)=>ge(c,M)),[h]),oe=useCallback(h((c,M,O)=>Qe(c,M,O)),[h]),b=useCallback(h((c,M,O,U)=>{let ue=Q(c,M)??X(c,M);if(!ue)return c;let xe=X(c,O),Fe=xe&&xe.id===ue.id?c:fe(c,O)??c;return De(Fe,ue.id,O,U)}),[h]),Z=useCallback(h((c,M,O,U,ue)=>{let xe=Q(c,M)??X(c,M);if(!xe)return c;let qe=Q(c,ue)??X(c,ue)??{type:"pane",id:ue,tabs:[ue],activeTabId:ue},Fe=ge(c,ue);return Te(Fe,xe.id,O,U,qe)}),[h]),z=useCallback(h((c,M,O)=>be(c,M,O)),[h]),se=useCallback(h((c,M,O)=>Se(c,M,O)),[h]),B=useCallback(h((c,M,O)=>{let U=Q(c,M)??X(c,M);return U?Ce(c,U.id,O):c}),[h]),ae=useCallback(h((c,M,O)=>{let U=Q(c,M)??X(c,M);return U?we(c,U.id,O):c}),[h]),ie=useCallback(h((c,M,O)=>{let U=Q(c,O)??X(c,O);return U?tt(c,M,U.id):c}),[h]),le=useCallback(h((c,M,O,U)=>nt(c,M,O,U)),[h]),A=useCallback(h((c,M)=>fe(c,M)),[h]),ne=useCallback(c=>Q(l.current,c),[]),re=useCallback(c=>X(l.current,c),[]),Rt=useCallback(c=>et(l.current,c),[]);return {layout:P,setLayout:V,fullscreenPaneId:J,setFullscreenPaneId:T,locked:K,setLocked:W,activeId:G,setActiveId:ee,activeType:te,setActiveType:d,dismissIntentId:R,setDismissIntentId:F,containerRef:I,setContainerRef:S,dragActivationDistance:i,snapThreshold:u,minSplitPercentage:p,maxSplitPercentage:x,enableDragToDismiss:m,dismissThreshold:v,onRemove:D,onDragStart:C,onDragEnd:$,onResizeStart:f,onResize:w,onResizeEnd:g,onDismissIntentChange:y,removePane:j,addPane:oe,addTab:b,splitPane:Z,updateSplitPercentage:z,updateTabMetadata:se,updatePaneLock:B,selectTab:ae,mergeTab:ie,moveTab:le,removeTab:A,findPaneById:ne,findPaneContainingTab:re,findTabById:Rt}}function Ne({cursor:e,resizerEl:t,onMove:n,onEnd:s}){document.body.classList.add("zeugma-resizing");let r=document.createElement("style");r.id="zeugma-global-cursor-style",r.textContent=`
|
|
2
2
|
* {
|
|
3
3
|
cursor: ${e} !important;
|
|
4
4
|
user-select: none !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(r),t.setAttribute("data-resizing","true");let o=a=>{n(a);},i=()=>{document.body.classList.remove("zeugma-resizing"),t.removeAttribute("data-resizing");let a=document.getElementById("zeugma-global-cursor-style");a&&a.remove(),document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",i),s();};document.addEventListener("pointermove",o),document.addEventListener("pointerup",i);}var Ve=createContext(void 0),Be=createContext(void 0),Ie=createContext(void 0),le=()=>{let e=useContext(Ve);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Me=()=>{let e=useContext(Be);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e};var wt=()=>{let e=le(),t=Me();return {...e,...t}};var Le=class extends PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ze=class extends 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 ot(e){let{layout:t,setLayout:n,activeId:s,setActiveId:r,setActiveType:o,dismissIntentId:i,setDismissIntentId:a,setOverTabId:u,setOverTabPosition:p,containerRef:y,dragActivationDistance:m,enableDragToDismiss:b,dismissThreshold:S,onRemove:D,onDragStart:Z,onDragEnd:f,onDismissIntentChange:C,removeTab:g,moveTab:T,selectTab:h}=e,w=useRef(null),k=qe(s),[E,q]=useState(false);Je(E);let A=useSensors(useSensor(Le,{activationConstraint:{distance:m}}),useSensor(ze,{activationConstraint:{delay:250,tolerance:5}})),G=useCallback(d=>{let x=pointerWithin(d);if(x.length>0)return x;if(d.active.id.toString().startsWith("tab-header-")){let I=d.droppableContainers.filter(R=>R.id.toString().startsWith("tab-drop-"));return closestCenter({...d,droppableContainers:I})}return []},[]);return {sensors:A,collisionDetection:G,onDragStart:d=>{let x=d.active.id.toString(),H=x.startsWith("tab-header-"),I=H?x.substring(11):x;r(I),o(H?"tab":"pane"),u(null),p(null);let R=d.activatorEvent;if(k.current=$e(R),b&&y.current?w.current=y.current.getBoundingClientRect():w.current=null,H){let l=Y(t,I);l&&h(l.id,I);}Z&&Z(I);},onDragMove:d=>{let{over:x}=d,H=x?.id.toString()||"",I=H.startsWith("drop-locked-");q(I);let R=H.match(/^tab-drop-(.+)$/);if(R&&x){let[,M]=R,z=d.active.id.toString();if((z.startsWith("tab-header-")?z.substring(11):z)!==M){let ne="before",ie=x.rect,ae=d.activatorEvent,O=null;if(k.current)O=k.current.x;else {let te=$e(ae);te&&(O=te.x+d.delta.x);}if(O!==null){let te=ie.left+ie.width/2;O>te&&(ne="after");}u(M),p(ne);}else u(null),p(null);}else u(null),p(null);if(!b)return;let l=d.active.id.toString(),U=l.startsWith("tab-header-")?l.substring(11):l,P=w.current;if(!P){i!==null&&(a(null),C?.(null));return}let v=d.activatorEvent,_=null,V=null;if(k.current)_=k.current.x,V=k.current.y;else {let M=$e(v);M&&(_=M.x+d.delta.x,V=M.y+d.delta.y);}let K=0;if(_!==null&&V!==null){let M=0,z=0;_<P.left?M=P.left-_:_>P.right&&(M=_-P.right),V<P.top?z=P.top-V:V>P.bottom&&(z=V-P.bottom),K=Math.sqrt(M*M+z*z);}else {let M=d.active.rect.current.translated;if(M){let z=M.left+M.width/2,$=M.top+M.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>S?i!==U&&(a(U),C?.(U)):i!==null&&(a(null),C?.(null));},onDragEnd:d=>{r(null),o(null),q(false),u(null),p(null);let{active:x,over:H}=d,I=x.id.toString(),R=I.startsWith("tab-header-"),l=R?I.substring(11):I,L=b&&i===l;if(a(null),C?.(null),w.current=null,L){D?D(l):g(l),f&&f(l,null,null);return}if(!H){f&&f(l,null,null);return}let U=H.id.toString();if(U.startsWith("drop-locked-")){f&&f(l,null,null);return}let P=U.match(/^tab-drop-(.+)$/);if(P){let[,ie]=P;if(l!==ie){let ae="before",O=H.rect,te=d.activatorEvent,re=null;if(k.current)re=k.current.x;else {let he=$e(te);he&&(re=he.x+d.delta.x);}if(re!==null){let he=O.left+O.width/2;re>he&&(ae="after");}T(l,ie,ae),f&&f(l,ie,{type:"move",position:"center"});}else f&&f(l,null,null);return}let v=U.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!v){f&&f(l,null,null);return}let[,_,V]=v,K=R?Y(t,l):j(t,l),oe=K&&K.id===V,M=K&&K.tabs.length===1;if(l===V||oe&&M){f&&f(l,null,null);return}let z=_==="left"||_==="right"?"row":"column",$;if(R){let ae=Y(t,l)?.tabsMetadata?.[l];$={type:"pane",id:de(),tabs:[l],activeTabId:l,tabsMetadata:ae?{[l]:ae}:void 0};}else $=j(t,l)??{type:"pane",id:de(),tabs:[l],activeTabId:l};let se=R?pe(t,l):me(t,l),ne=Pe(se,V,z,_,$);n(ne),f&&f(l,V,{type:"split",direction:z,position:_});},onDragCancel:()=>{r(null),o(null),q(false),u(null),p(null),a(null),C?.(null),w.current=null;}}}var st=({activeId:e,render:t,className:n})=>{let s=useRef(null);return 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)},[]),jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var it=({tabId:e,target:t,renderWidget:n})=>{let[s,r]=useState(false),o=useRef(null);if(useEffect(()=>{r(true);},[]),useEffect(()=>{if(!s||!o.current)return;let a=o.current;if(t)t.appendChild(a);else {let u=document.getElementById("zeugma-hidden-portal-container");u||(u=document.createElement("div"),u.id="zeugma-hidden-portal-container",u.style.display="none",document.body.appendChild(u)),u.appendChild(a);}},[t,s]),useEffect(()=>()=>{o.current&&o.current.remove();},[]),!s)return null;o.current||(o.current=document.createElement("div"),o.current.className=`zeugma-portal-wrapper-${e}`,o.current.style.width="100%",o.current.style.height="100%");let i=o.current;return !i||!n?null:createPortal(n(e),i)};var Wt=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:i,layout:a,setLayout:u,fullscreenPaneId:p,setFullscreenPaneId:y,locked:m,setLocked:b,findPaneById:S,findPaneContainingTab:D,findTabById:Z,activeId:f,activeType:C,dismissIntentId:g,setContainerRef:T,snapThreshold:h,minSplitPercentage:w,maxSplitPercentage:k,onRemove:E,onResizeStart:q,onResize:A,onResizeEnd:G,removePane:B,addPane:J,addTab:Q,updateTabMetadata:ee,updatePaneLock:d,selectTab:x,mergeTab:H,removeTab:I,splitPane:R,updateSplitPercentage:l,moveTab:L}=t,{portalTargets:U,registerPortalTarget:P}=Ge(),[v,_]=useState(null),[V,K]=useState(null),oe=ot({...t,setOverTabId:_,setOverTabPosition:K}),M=useCallback(O=>n(O),[n]),z=useMemo(()=>o,[o.dashboard,o.dashboardDismissActive,o.pane,o.paneLocked,o.dropPreview,o.dragOverlay,o.resizer,o.dismissPreview,o.dashboardLocked,o.lockedPreview,o.tabDropPreview]),$=useCallback((O,te)=>{G&&G(O,te);},[G]),se=useMemo(()=>({layout:a,setLayout:u,renderPane:M,activeId:f,dismissIntentId:g,overTabId:v,overTabPosition:V,setContainerRef:T,fullscreenPaneId:p,classNames:z,onRemove:E,onFullscreenChange:y,snapThreshold:h,onResizeStart:q,onResize:A,onResizeEnd:$,minSplitPercentage:w,maxSplitPercentage:k,locked:m,setLocked:b,findPaneById:S,findPaneContainingTab:D,findTabById:Z}),[a,f,g,v,V,T,p,z,E,y,h,q,A,w,k,u,M,$,m,b,S,D,Z]),ne=useMemo(()=>({removePane:B,addPane:J,addTab:Q,updateTabMetadata:ee,updatePaneLock:d,selectTab:x,mergeTab:H,removeTab:I,setFullscreenPaneId:y,setLocked:b,splitPane:R,updateSplitPercentage:l,moveTab:L}),[B,J,Q,ee,d,x,H,I,y,b,R,l,L]),ie=useMemo(()=>{let O=[];function te(re){re&&(re.type==="pane"?O.push(...re.tabs):(te(re.first),te(re.second)));}return te(a),O},[a]),ae=useMemo(()=>({registerPortalTarget:P}),[P]);return jsx(Be.Provider,{value:ne,children:jsx(Ve.Provider,{value:se,children:jsxs(Ie.Provider,{value:ae,children:[jsx(DndContext,{id:"zeugma-dnd-context",...oe,children:i}),f&&C&&r&&jsx(st,{activeId:f,render:O=>r(O,C),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:ie.map(O=>jsx(it,{tabId:O,target:U[O]||null,renderWidget:s},O))})]})})})};function Ue({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:i,currentNode:a,onLayoutChange:u,onResizeStart:p,onResizeEnd:y,parentLeft:m,parentTop:b,parentWidth:S,parentHeight:D}){let{onResizeStart:Z,onResize:f,onResizeEnd:C,minSplitPercentage:g=5,maxSplitPercentage:T=95,locked:h=false}=le();return useCallback(w=>{if(h)return;w.preventDefault();let k=e.current;if(!k)return;p&&p(),Z&&Z(a);let E=k.getBoundingClientRect(),q=w.clientX,A=w.clientY,G=s,B=w.currentTarget,J=E.left+E.width*(m/100),Q=E.top+E.height*(b/100),ee=E.width*(S/100),d=E.height*(D/100),H=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(R=>R!==B&&R.getAttribute("data-direction")===n).map(R=>{let l=R.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),I=G;Ne({cursor:t?"col-resize":"row-resize",resizerEl:B,onMove:R=>{let l=t?(R.clientX-q)/ee*100:(R.clientY-A)/d*100,L=G+l,U=t?J+(ee-r)*(L/100)+r/2:Q+(d-r)*(L/100)+r/2,P=1/0,v=null;for(let oe of H){let M=Math.abs(U-oe);M<o&&M<P&&(P=M,v=oe);}let _=L;v!==null&&(_=t?(v-r/2-J)/(ee-r)*100:(v-r/2-Q)/(d-r)*100);let V=Math.max(g,Math.min(T,_));I=V;let K=ge(i,a,V);if(K){let{panes:oe,splitters:M}=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 M)z.style.setProperty(`--splitter-pos-${$.id}`,`${$.direction==="row"?$.left:$.top}%`);}}f&&f(a,V);},onEnd:()=>{let R=ge(i,a,I),l=e.current;if(l){let{panes:L,splitters:U}=ue(R);for(let P of L)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(R),y&&y(),C&&C(a,I);}});},[e,t,n,s,r,o,i,a,u,p,y,Z,f,C,g,T,m,b,S,D])}var Gt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:i,locked:a}=le(),[u,p]=useState(false),{currentNode:y,direction:m,left:b,top:S,width:D,height:Z,parentLeft:f,parentTop:C,parentWidth:g,parentHeight:T}=e,h=m==="row",w=Ue({containerRef:s,isRow:h,direction:m,splitPercentage:y.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:y,onLayoutChange:o,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:f,parentTop:C,parentWidth:g,parentHeight:T}),k=h?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${b}%) - ${t/2}px)`,top:`calc(${S}% + ${t/2}px)`,width:`${t}px`,height:`calc(${Z}% - ${t}px)`,cursor:a?"default":"col-resize",pointerEvents:a?"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}, ${S}%) - ${t/2}px)`,width:`calc(${D}% - ${t}px)`,height:`${t}px`,cursor:a?"default":"row-resize",pointerEvents:a?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsx("div",{className:i.resizer||"","data-direction":m,"data-resizing":u||void 0,style:k,onPointerDown:w,role:"separator","aria-valuenow":y.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},Kt=ht.memo(({paneId:e,renderPane:t})=>jsx(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:i,setContainerRef:a,fullscreenPaneId:u,snapThreshold:p,locked:y,classNames:m}=le(),b=n!==void 0?n:p??8,S=e!==void 0?e:s,D=useRef(null),{panes:Z,splitters:f}=useMemo(()=>S?ue(S):{panes:[],splitters:[]},[S]);if(!S)return null;let C=()=>jsxs(Fragment,{children:[Z.map(g=>{let T=u===g.paneId;return jsx("div",{style:{position:"absolute",left:T?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:T?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:T?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:T?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:T?20:1,display:u&&!T?"none":"block",padding:T?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsx(Kt,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsx(Gt,{splitter:g,resizerSize:t,snapThreshold:b,containerRef:D},g.id))]});if(e===void 0){let g=o!==null&&o===i,T=w=>{a(w),D.current=w;},h=`${m.dashboard||""} ${g&&m.dashboardDismissActive||""} ${y&&m.dashboardLocked||""}`.trim();return jsx("div",{ref:T,className:h,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:C()})}return jsx("div",{ref:D,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:C()})};var ft="zeugma-height:",nn="default-pane";function rn(e){try{let t=localStorage.getItem(ft+e);if(t!==null){let n=Number(t);if(Number.isFinite(n)&&n>0)return n}}catch{}return null}function pt(e,t){try{localStorage.setItem(ft+e,String(Math.round(t)));}catch{}}var mt=({children:e,active:t=true,height:n,onHeightChange:s,minHeight:r=100,maxHeight:o=1/0,persist:i,localStorageKey:a,resizerHeight:u=6,className:p,resizerClassName:y})=>{let m=i?a||nn:null,b=()=>{let h=(m?rn(m):null)??n??400;return Ze(h,r,o)},[S,D]=useState(b),Z=useRef(null),f=m?S:n??S,C=useRef(n);useEffect(()=>{if(n!==void 0&&n!==C.current){let h=Ze(n,r,o);D(h),m&&pt(m,h);}C.current=n;},[n,r,o,m]);let g=useCallback(()=>o,[o]),T=useCallback(h=>{h.preventDefault();let w=h.clientY,k=f,E=g(),q=h.currentTarget,A=gt(Z.current),G=A?A.scrollTop:0,B=w,J=null,Q=(d,x)=>{let H=x-G,R=d-w+H,l=Ze(k+R,r,E);return Z.current&&(Z.current.style.height=`${l}px`),l},ee=()=>{if(!A)return;let d=A===document.documentElement||A===document.body?{top:0,bottom:window.innerHeight}:A.getBoundingClientRect(),x=40,H=10,I=0;B>d.bottom-x?I=Math.min(1,(B-(d.bottom-x))/x)*H:B<d.top+x&&(I=-Math.min(1,(d.top+x-B)/x)*H),I!==0&&(A.scrollTop+=I,Q(B,A.scrollTop)),J=requestAnimationFrame(ee);};J=requestAnimationFrame(ee),Ne({cursor:"row-resize",resizerEl:q,onMove:d=>{B=d.clientY,A&&Q(B,A.scrollTop);},onEnd:()=>{J!==null&&cancelAnimationFrame(J);let d=k;Z.current&&(d=Z.current.getBoundingClientRect().height),d=Ze(d,r,E),D(d),s&&s(d),m&&pt(m,d);}});},[f,r,g,s,m]);return t?jsxs("div",{ref:Z,className:`zeugma-resizable-container ${p||""}`.trim(),style:{height:`${f}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsx("div",{className:`zeugma-resizable-handle ${y||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:T,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(f),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsx("div",{className:`zeugma-resizable-container disabled ${p||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function Ze(e,t,n){return Math.max(t,Math.min(n,e))}function gt(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:gt(t)}var Ae=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"}},bt=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=useDroppable({id:e});return jsxs(Fragment,{children:[jsx("div",{ref:s,style:fn[t]}),r&&jsx("div",{className:n,style:mn[t]})]})},gn=({id:e,children:t,style:n,locked:s=false})=>{let r=useRef(null),{layout:o,activeId:i,classNames:a,fullscreenPaneId:u,onFullscreenChange:p,locked:y}=le(),{removePane:m,updateTabMetadata:b,selectTab:S,removeTab:D}=Me(),Z=useContext(Ie);if(!Z)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=Z,C=useMemo(()=>j(o,e),[o,e]),g=C?.id??e,T=C?.tabs??[e],h=C?.activeTabId??e,w=C?.tabsMetadata,k=w?.[e],E=C?.locked??false,q=s||E,A=y||q,G=y||q,B=i!==null&&i!==e&&(!T.includes(i)||T.length>1)&&!G,{attributes:J,listeners:Q,setNodeRef:ee}=useDraggable({id:e,disabled:A}),d=i!==null&&T.includes(i),x=u===e,H=useCallback(()=>jsx("div",{ref:r,id:`zeugma-tab-target-${h}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[h]);useEffect(()=>{let L=r.current;return f(h,L),()=>{f(h,null);}},[h,f]);let I=useMemo(()=>({isDragging:d,isFullscreen:x,toggleFullscreen:()=>p?.(x?null:e),remove:()=>{x&&p?.(null),m(g);},metadata:k,updateMetadata:L=>{b(e,L);},locked:A,tabs:T,activeTabId:h,selectTab:L=>S(g,L),removeTab:L=>{x&&L===h&&p?.(null),D(L);},tabsMetadata:w,updateTabMetadata:(L,U)=>{b(L,U);},renderActiveTab:H}),[d,x,p,e,D,k,b,A,T,h,S,g,w,H]),R=useMemo(()=>A?{disabled:true}:{...Q,...J},[Q,J,A]),l=`${a.pane||""} ${q&&a.paneLocked||""}`.trim();return jsx(Ae.Provider,{value:R,children:jsxs("div",{ref:ee,className:l,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(I),B&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(L=>jsx(bt,{id:`drop-${L}-${e}`,position:L,activeClassName:a.dropPreview},L))}),i!==null&&i!==e&&G&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsx(bt,{id:`drop-locked-${e}`,position:"full",activeClassName:a.lockedPreview||""})})]})})};var hn=({children:e,className:t,style:n})=>{let s=useContext(Ae);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var Pt=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:i={},overTabId:a,overTabPosition:u}=le(),p=t||o,{attributes:y,listeners:m,setNodeRef:b,isDragging:S}=useDraggable({id:`tab-header-${e}`,disabled:p}),{setNodeRef:D,isOver:Z}=useDroppable({id:`tab-drop-${e}`,disabled:p}),f=E=>{b(E),D(E);},C=Z&&a===e,g=C?u:null,T=n({isDragging:S,isOver:C}),h=s,w=r,k=T;if(ht.isValidElement(T)){let E=T.props;E&&typeof E=="object"&&("className"in E&&typeof E.className=="string"&&(h=`${s||""} ${E.className}`.trim()),"style"in E&&E.style&&typeof E.style=="object"&&(w={...r,...E.style})),k=ht.cloneElement(T,{className:void 0,style:void 0});}return jsxs("div",{ref:f,className:h,style:{display:"inline-flex",position:"relative",cursor:p?"default":"grab",...w},...p?{}:m,...p?{}:y,children:[k,C&&g&&jsx("div",{className:i.tabDropPreview||"",style:{position:"absolute",top:0,bottom:0,width:"2px",backgroundColor:"#6366f1",left:g==="before"?0:void 0,right:g==="after"?0:void 0,pointerEvents:"none",zIndex:10}})]})};var Sn=({tabs:e,activeTabId:t,locked:n=false,tabsMetadata:s,selectTab:r,removeTab:o,renderTab:i,className:a,style:u})=>jsx("div",{className:a,style:{display:"flex",alignItems:"center",height:"100%",...u},children:e.map(p=>{let y=s?.[p];return jsx(Pt,{id:p,locked:n,children:({isDragging:m,isOver:b})=>i({tabId:p,activeTabId:t,isDragging:m,isOver:b,metadata:y,selectTab:r,removeTab:o})},p)})});export{Dt as DEFAULT_DRAG_ACTIVATION_DISTANCE,wn as DEFAULT_RESIZER_SIZE,St as DEFAULT_SNAP_THRESHOLD,hn as DragHandle,gn as Pane,jt as PaneTree,Ie as PortalRegistryContext,mt as ResizableContainer,Sn as Tabs,Wt as Zeugma,Be as ZeugmaActionsContext,Ve as ZeugmaStateContext,Ne as createDragSession,xe as safeJsonStringify,Ue as useResizer,Ct as useZeugma,Me as useZeugmaActions,wt as useZeugmaContext,le as useZeugmaState};//# sourceMappingURL=index.js.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 Be=createContext(void 0),We=createContext(void 0),Me=createContext(void 0),Ue=createContext(void 0),ce=()=>{let e=useContext(Be);if(!e)throw new Error("useZeugmaState must be used within a Zeugma provider");return e},Le=()=>{let e=useContext(We);if(!e)throw new Error("useZeugmaActions must be used within a Zeugma provider");return e},ot=()=>{let e=useContext(Ue);if(!e)throw new Error("useZeugmaDrag must be used within a Zeugma provider");return e};var Nt=()=>{let e=ce(),t=Le();return {...e,...t}};var Ze=class extends PointerSensor{static activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!t.target?.closest(".drag-cancel")}]},ze=class extends 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:x,dragActivationDistance:m,enableDragToDismiss:v,dismissThreshold:D,onRemove:C,onDragStart:$,onDragEnd:f,onDismissIntentChange:w,removeTab:g,moveTab:y,selectTab:P}=e,E=useRef(null),k=Ge(s),[N,J]=useState(false);Ke(N);let H=useSensors(useSensor(Ze,{activationConstraint:{distance:m}}),useSensor(ze,{activationConstraint:{delay:250,tolerance:5}})),K=useCallback(d=>{let R=pointerWithin(d);if(R.length>0)return R;if(d.active.id.toString().startsWith("tab-header-")){let I=d.droppableContainers.filter(S=>S.id.toString().startsWith("tab-drop-"));return closestCenter({...d,droppableContainers:I})}return []},[]);return {sensors:H,collisionDetection:K,onDragStart:d=>{let R=d.active.id.toString(),F=R.startsWith("tab-header-"),I=F?R.substring(11):R;r(I),o(F?"tab":"pane"),u(null),p(null);let S=d.activatorEvent;if(k.current=$e(S),v&&x.current?E.current=x.current.getBoundingClientRect():E.current=null,F){let l=X(t,I);l&&P(l.id,I);}$&&$(I);},onDragMove:d=>{let{over:R}=d,F=R?.id.toString()||"",I=F.startsWith("drop-locked-");J(b=>b===I?b:I);let S=F.match(/^tab-drop-(.+)$/);if(S&&R){let[,b]=S,Z=d.active.id.toString();if((Z.startsWith("tab-header-")?Z.substring(11):Z)!==b){let B="before",ae=R.rect,ie=d.activatorEvent,le=null;if(k.current)le=k.current.x;else {let A=$e(ie);A&&(le=A.x+d.delta.x);}if(le!==null){let A=ae.left+ae.width/2;le>A&&(B="after");}u(A=>A===b?A:b),p(A=>A===B?A:B);}else u(B=>B===null?B:null),p(B=>B===null?B:null);}else u(b=>b===null?b:null),p(b=>b===null?b:null);if(!v)return;let l=d.active.id.toString(),_=l.startsWith("tab-header-")?l.substring(11):l,T=E.current;if(!T){a!==null&&(i(null),w?.(null));return}let h=d.activatorEvent,Y=null,V=null;if(k.current)Y=k.current.x,V=k.current.y;else {let b=$e(h);b&&(Y=b.x+d.delta.x,V=b.y+d.delta.y);}let j=0;if(Y!==null&&V!==null){let b=0,Z=0;Y<T.left?b=T.left-Y:Y>T.right&&(b=Y-T.right),V<T.top?Z=T.top-V:V>T.bottom&&(Z=V-T.bottom),j=Math.sqrt(b*b+Z*Z);}else {let b=d.active.rect.current.translated;if(b){let Z=b.left+b.width/2,z=b.top+b.height/2,se=0,B=0;Z<T.left?se=T.left-Z:Z>T.right&&(se=Z-T.right),z<T.top?B=T.top-z:z>T.bottom&&(B=z-T.bottom),j=Math.sqrt(se*se+B*B);}}j>D?a!==_&&(i(_),w?.(_)):a!==null&&(i(null),w?.(null));},onDragEnd:d=>{r(null),o(null),J(false),u(null),p(null);let{active:R,over:F}=d,I=R.id.toString(),S=I.startsWith("tab-header-"),l=S?I.substring(11):I,L=v&&a===l;if(i(null),w?.(null),E.current=null,L){C?C(l):g(l),f&&f(l,null,null);return}if(!F){f&&f(l,null,null);return}let _=F.id.toString();if(_.startsWith("drop-locked-")){f&&f(l,null,null);return}let T=_.match(/^tab-drop-(.+)$/);if(T){let[,ae]=T;if(l!==ae){let ie="before",le=F.rect,A=d.activatorEvent,ne=null;if(k.current)ne=k.current.x;else {let re=$e(A);re&&(ne=re.x+d.delta.x);}if(ne!==null){let re=le.left+le.width/2;ne>re&&(ie="after");}y(l,ae,ie),f&&f(l,ae,{type:"move",position:"center"});}else f&&f(l,null,null);return}let h=_.match(/^drop-(left|right|top|bottom)-(.+)$/);if(!h){f&&f(l,null,null);return}let[,Y,V]=h,j=S?X(t,l):Q(t,l),oe=j&&j.id===V,b=j&&j.tabs.length===1;if(l===V||oe&&b){f&&f(l,null,null);return}let Z=Y==="left"||Y==="right"?"row":"column",z;if(S){let ie=X(t,l)?.tabsMetadata?.[l];z={type:"pane",id:pe(),tabs:[l],activeTabId:l,tabsMetadata:ie?{[l]:ie}:void 0};}else z=Q(t,l)??{type:"pane",id:pe(),tabs:[l],activeTabId:l};let se=S?fe(t,l):ge(t,l),B=Te(se,V,Z,Y,z);n(B),f&&f(l,V,{type:"split",direction:Z,position:Y});},onDragCancel:()=>{r(null),o(null),J(false),u(null),p(null),i(null),w?.(null),E.current=null;}}}var it=({activeId:e,render:t,className:n})=>{let s=useRef(null);return 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)},[]),jsx("div",{ref:s,className:n,style:{position:"fixed",top:0,left:0,zIndex:9999,pointerEvents:"none"},children:t(e)})};var lt=Tt.memo(({tabId:e,target:t,renderWidget:n})=>{let[s,r]=useState(false),o=useRef(null);if(useEffect(()=>{r(true);},[]),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]),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:createPortal(n(e),a)});var Yt=e=>{let t=e,{renderPane:n,renderWidget:s,renderDragOverlay:r,classNames:o={},children:a,layout:i,setLayout:u,fullscreenPaneId:p,setFullscreenPaneId:x,locked:m,setLocked:v,findPaneById:D,findPaneContainingTab:C,findTabById:$,activeId:f,activeType:w,dismissIntentId:g,setContainerRef:y,snapThreshold:P,minSplitPercentage:E,maxSplitPercentage:k,onRemove:N,onResizeStart:J,onResize:H,onResizeEnd:K,removePane:W,addPane:G,addTab:ee,updateTabMetadata:te,updatePaneLock:d,selectTab:R,mergeTab:F,removeTab:I,splitPane:S,updateSplitPercentage:l,moveTab:L}=t,{portalTargets:_,registerPortalTarget:T}=je(),[h,Y]=useState(null),[V,j]=useState(null),oe=at({...t,setOverTabId:Y,setOverTabPosition:j}),b=useCallback(A=>n(A),[n]),Z=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=useCallback((A,ne)=>{K&&K(A,ne);},[K]),se=useMemo(()=>({layout:i,setLayout:u,renderPane:b,activeId:f,dismissIntentId:g,setContainerRef:y,fullscreenPaneId:p,classNames:Z,onRemove:N,onFullscreenChange:x,snapThreshold:P,onResizeStart:J,onResize:H,onResizeEnd:z,minSplitPercentage:E,maxSplitPercentage:k,locked:m,setLocked:v,findPaneById:D,findPaneContainingTab:C,findTabById:$}),[i,f,g,y,p,Z,N,x,P,J,H,E,k,u,b,z,m,v,D,C,$]),B=useMemo(()=>({overTabId:h,overTabPosition:V}),[h,V]),ae=useMemo(()=>({removePane:W,addPane:G,addTab:ee,updateTabMetadata:te,updatePaneLock:d,selectTab:R,mergeTab:F,removeTab:I,setFullscreenPaneId:x,setLocked:v,splitPane:S,updateSplitPercentage:l,moveTab:L}),[W,G,ee,te,d,R,F,I,x,v,S,l,L]),ie=useMemo(()=>{let A=[];function ne(re){re&&(re.type==="pane"?A.push(...re.tabs):(ne(re.first),ne(re.second)));}return ne(i),A},[i]),le=useMemo(()=>({registerPortalTarget:T}),[T]);return jsx(We.Provider,{value:ae,children:jsx(Be.Provider,{value:se,children:jsx(Ue.Provider,{value:B,children:jsxs(Me.Provider,{value:le,children:[jsx(DndContext,{id:"zeugma-dnd-context",...oe,children:a}),f&&w&&r&&jsx(it,{activeId:f,render:A=>r(A,w),className:`${o.dragOverlay||""} ${f===g&&o.dismissPreview||""}`.trim()}),jsx("div",{id:"zeugma-portal-host",style:{display:"none"},children:ie.map(A=>jsx(lt,{tabId:A,target:_[A]||null,renderWidget:s},A))})]})})})})};function Ye({containerRef:e,isRow:t,direction:n,splitPercentage:s,resizerSize:r,snapThreshold:o,layout:a,currentNode:i,onLayoutChange:u,onResizeStart:p,onResizeEnd:x,parentLeft:m,parentTop:v,parentWidth:D,parentHeight:C}){let{onResizeStart:$,onResize:f,onResizeEnd:w,minSplitPercentage:g=5,maxSplitPercentage:y=95,locked:P=false}=ce();return useCallback(E=>{if(P)return;E.preventDefault();let k=e.current;if(!k)return;p&&p(),$&&$(i);let N=k.getBoundingClientRect(),J=E.clientX,H=E.clientY,K=s,W=E.currentTarget,G=N.left+N.width*(m/100),ee=N.top+N.height*(v/100),te=N.width*(D/100),d=N.height*(C/100),F=Array.from(document.querySelectorAll('div[role="separator"][data-direction]')).filter(S=>S!==W&&S.getAttribute("data-direction")===n).map(S=>{let l=S.getBoundingClientRect();return t?l.left+l.width/2:l.top+l.height/2}),I=K;Ne({cursor:t?"col-resize":"row-resize",resizerEl:W,onMove:S=>{let l=t?(S.clientX-J)/te*100:(S.clientY-H)/d*100,L=K+l,_=t?G+(te-r)*(L/100)+r/2:ee+(d-r)*(L/100)+r/2,T=1/0,h=null;for(let oe of F){let b=Math.abs(_-oe);b<o&&b<T&&(T=b,h=oe);}let Y=L;h!==null&&(Y=t?(h-r/2-G)/(te-r)*100:(h-r/2-ee)/(d-r)*100);let V=Math.max(g,Math.min(y,Y));I=V;let j=be(a,i,V);if(j){let{panes:oe,splitters:b}=de(j),Z=e.current;if(Z){for(let z of oe)Z.style.setProperty(`--pane-left-${z.paneId}`,`${z.left}%`),Z.style.setProperty(`--pane-top-${z.paneId}`,`${z.top}%`),Z.style.setProperty(`--pane-width-${z.paneId}`,`${z.width}%`),Z.style.setProperty(`--pane-height-${z.paneId}`,`${z.height}%`);for(let z of b)Z.style.setProperty(`--splitter-pos-${z.id}`,`${z.direction==="row"?z.left:z.top}%`);}}f&&f(i,V);},onEnd:()=>{let S=be(a,i,I),l=e.current;if(l){let{panes:L,splitters:_}=de(S);for(let T of L)l.style.removeProperty(`--pane-left-${T.paneId}`),l.style.removeProperty(`--pane-top-${T.paneId}`),l.style.removeProperty(`--pane-width-${T.paneId}`),l.style.removeProperty(`--pane-height-${T.paneId}`);for(let T of _)l.style.removeProperty(`--splitter-pos-${T.id}`);}u(S),x&&x(),w&&w(i,I);}});},[e,t,n,s,r,o,a,i,u,p,x,$,f,w,g,y,m,v,D,C])}var Qt=({splitter:e,resizerSize:t,snapThreshold:n,containerRef:s})=>{let{layout:r,setLayout:o,classNames:a,locked:i}=ce(),[u,p]=useState(false),{currentNode:x,direction:m,left:v,top:D,width:C,height:$,parentLeft:f,parentTop:w,parentWidth:g,parentHeight:y}=e,P=m==="row",E=Ye({containerRef:s,isRow:P,direction:m,splitPercentage:x.splitPercentage,resizerSize:t,snapThreshold:n,layout:r,currentNode:x,onLayoutChange:o,onResizeStart:()=>p(true),onResizeEnd:()=>p(false),parentLeft:f,parentTop:w,parentWidth:g,parentHeight:y}),k=P?{position:"absolute",left:`calc(var(--splitter-pos-${e.id}, ${v}%) - ${t/2}px)`,top:`calc(${D}% + ${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(${v}% + ${t/2}px)`,top:`calc(var(--splitter-pos-${e.id}, ${D}%) - ${t/2}px)`,width:`calc(${C}% - ${t}px)`,height:`${t}px`,cursor:i?"default":"row-resize",pointerEvents:i?"none":"auto",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box"};return jsx("div",{className:a.resizer||"","data-direction":m,"data-resizing":u||void 0,style:k,onPointerDown:E,role:"separator","aria-valuenow":x.splitPercentage,"aria-valuemin":5,"aria-valuemax":95})},en=Tt.memo(({paneId:e,renderPane:t})=>jsx(Fragment,{children:t(e)}),(e,t)=>e.paneId===t.paneId&&e.renderPane===t.renderPane),tn=({tree:e,resizerSize:t=4,snapThreshold:n})=>{let{layout:s,renderPane:r,activeId:o,dismissIntentId:a,setContainerRef:i,fullscreenPaneId:u,snapThreshold:p,locked:x,classNames:m}=ce(),v=n!==void 0?n:p??8,D=e!==void 0?e:s,C=useRef(null),{panes:$,splitters:f}=useMemo(()=>D?de(D):{panes:[],splitters:[]},[D]);if(!D)return null;let w=()=>jsxs(Fragment,{children:[$.map(g=>{let y=u===g.paneId;return jsx("div",{style:{position:"absolute",left:y?"0%":`var(--pane-left-${g.paneId}, ${g.left}%)`,top:y?"0%":`var(--pane-top-${g.paneId}, ${g.top}%)`,width:y?"100%":`var(--pane-width-${g.paneId}, ${g.width}%)`,height:y?"100%":`var(--pane-height-${g.paneId}, ${g.height}%)`,overflow:"hidden",zIndex:y?20:1,display:u&&!y?"none":"block",padding:y?"0px":`${t/2}px`,boxSizing:"border-box"},children:jsx(en,{paneId:g.paneId,renderPane:r})},g.paneId)}),!u&&f.map(g=>jsx(Qt,{splitter:g,resizerSize:t,snapThreshold:v,containerRef:C},g.id))]});if(e===void 0){let g=o!==null&&o===a,y=E=>{i(E),C.current=E;},P=`${m.dashboard||""} ${g&&m.dashboardDismissActive||""} ${x&&m.dashboardLocked||""}`.trim();return jsx("div",{ref:y,className:P,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:w()})}return jsx("div",{ref:C,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:w()})};var gt="zeugma-height:",sn="default-pane";function an(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:x})=>{let m=a?i||sn:null,v=()=>{let P=(m?an(m):null)??n??400;return ke(P,r,o)},[D,C]=useState(v),$=useRef(null),f=m?D:n??D,w=useRef(n);useEffect(()=>{if(n!==void 0&&n!==w.current){let P=ke(n,r,o);C(P),m&&mt(m,P);}w.current=n;},[n,r,o,m]);let g=useCallback(()=>o,[o]),y=useCallback(P=>{P.preventDefault();let E=P.clientY,k=f,N=g(),J=P.currentTarget,H=vt($.current),K=H?H.scrollTop:0,W=E,G=null,ee=(d,R)=>{let F=R-K,S=d-E+F,l=ke(k+S,r,N);return $.current&&($.current.style.height=`${l}px`),l},te=()=>{if(!H)return;let d=H===document.documentElement||H===document.body?{top:0,bottom:window.innerHeight}:H.getBoundingClientRect(),R=40,F=10,I=0;W>d.bottom-R?I=Math.min(1,(W-(d.bottom-R))/R)*F:W<d.top+R&&(I=-Math.min(1,(d.top+R-W)/R)*F),I!==0&&(H.scrollTop+=I,ee(W,H.scrollTop)),G=requestAnimationFrame(te);};G=requestAnimationFrame(te),Ne({cursor:"row-resize",resizerEl:J,onMove:d=>{W=d.clientY,H&&ee(W,H.scrollTop);},onEnd:()=>{G!==null&&cancelAnimationFrame(G);let d=k;$.current&&(d=$.current.getBoundingClientRect().height),d=ke(d,r,N),C(d),s&&s(d),m&&mt(m,d);}});},[f,r,g,s,m]);return t?jsxs("div",{ref:$,className:`zeugma-resizable-container ${p||""}`.trim(),style:{height:`${f}px`,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[jsx("div",{style:{height:`calc(100% - ${u}px)`,overflow:"hidden"},children:e}),jsx("div",{className:`zeugma-resizable-handle ${x||""}`.trim(),style:{height:`${u}px`,cursor:"row-resize",position:"relative",zIndex:10,userSelect:"none",touchAction:"none",boxSizing:"border-box",flexShrink:0},onPointerDown:y,role:"separator","aria-orientation":"horizontal","aria-valuenow":Math.round(f),"aria-valuemin":r,"aria-valuemax":o===1/0?void 0:o})]}):jsx("div",{className:`zeugma-resizable-container disabled ${p||""}`.trim(),style:{height:"100%",position:"relative",overflow:"hidden",boxSizing:"border-box"},children:jsx("div",{style:{height:"100%",overflow:"hidden"},children:e})})};function ke(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 He=createContext(null);var bn={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"}},vn={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"}},ht=({id:e,position:t,activeClassName:n})=>{let{setNodeRef:s,isOver:r}=useDroppable({id:e});return jsxs(Fragment,{children:[jsx("div",{ref:s,style:bn[t]}),r&&jsx("div",{className:n,style:vn[t]})]})},hn=({id:e,children:t,style:n,locked:s=false})=>{let r=useRef(null),{layout:o,activeId:a,classNames:i,fullscreenPaneId:u,onFullscreenChange:p,locked:x}=ce(),{removePane:m,updateTabMetadata:v,selectTab:D,removeTab:C}=Le(),$=useContext(Me);if(!$)throw new Error("Pane must be used within a Zeugma provider");let{registerPortalTarget:f}=$,w=useMemo(()=>Q(o,e),[o,e]),g=w?.id??e,y=w?.tabs??[e],P=w?.activeTabId??e,E=w?.tabsMetadata,k=E?.[e],N=w?.locked??false,J=s||N,H=x||J,K=x||J,W=a!==null&&a!==e&&(!y.includes(a)||y.length>1)&&!K,{attributes:G,listeners:ee,setNodeRef:te}=useDraggable({id:e,disabled:H}),d=a!==null&&y.includes(a),R=u===e,F=useCallback(()=>jsx("div",{ref:r,id:`zeugma-tab-target-${P}`,className:"zeugma-tab-content-wrapper",style:{height:"100%",width:"100%"}}),[P]);useEffect(()=>{let L=r.current;return f(P,L),()=>{f(P,null);}},[P,f]);let I=useMemo(()=>({isDragging:d,isFullscreen:R,toggleFullscreen:()=>p?.(R?null:e),remove:()=>{R&&p?.(null),m(g);},metadata:k,updateMetadata:L=>{v(e,L);},locked:H,tabs:y,activeTabId:P,selectTab:L=>D(g,L),removeTab:L=>{R&&L===P&&p?.(null),C(L);},tabsMetadata:E,updateTabMetadata:(L,_)=>{v(L,_);},renderActiveTab:F}),[d,R,p,e,C,k,v,H,y,P,D,g,E,F]),S=useMemo(()=>H?{disabled:true}:{...ee,...G},[ee,G,H]),l=`${i.pane||""} ${J&&i.paneLocked||""}`.trim();return jsx(He.Provider,{value:S,children:jsxs("div",{ref:te,className:l,style:{position:"relative",width:"100%",height:"100%",...n},children:[t(I),W&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:["top","bottom","left","right"].map(L=>jsx(ht,{id:`drop-${L}-${e}`,position:L,activeClassName:i.dropPreview},L))}),a!==null&&a!==e&&K&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:15,pointerEvents:"none"},children:jsx(ht,{id:`drop-locked-${e}`,position:"full",activeClassName:i.lockedPreview||""})})]})})};var yn=({children:e,className:t,style:n})=>{let s=useContext(He);if(!s)throw new Error("<DragHandle> must be used inside a <Pane>");let{disabled:r,...o}=s;return jsx("div",{className:t,style:{cursor:r?"default":"grab",userSelect:r?"auto":"none",touchAction:r?"auto":"none",...n},...r?{}:o,children:e})};var yt=({id:e,locked:t=false,children:n,className:s,style:r})=>{let{locked:o,classNames:a={}}=ce(),{overTabId:i,overTabPosition:u}=ot(),p=t||o,{attributes:x,listeners:m,setNodeRef:v,isDragging:D}=useDraggable({id:`tab-header-${e}`,disabled:p}),{setNodeRef:C,isOver:$}=useDroppable({id:`tab-drop-${e}`,disabled:p}),f=N=>{v(N),C(N);},w=$&&i===e,g=w?u:null,y=n({isDragging:D,isOver:w}),P=s,E=r,k=y;if(Tt.isValidElement(y)){let N=y.props;N&&typeof N=="object"&&("className"in N&&typeof N.className=="string"&&(P=`${s||""} ${N.className}`.trim()),"style"in N&&N.style&&typeof N.style=="object"&&(E={...r,...N.style})),k=Tt.cloneElement(y,{className:void 0,style:void 0});}return jsxs("div",{ref:f,className:P,style:{display:"inline-flex",position:"relative",cursor:p?"default":"grab",...E},...p?{}:m,...p?{}:x,children:[k,w&&g&&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 wn=({tabs:e,activeTabId:t,locked:n=false,tabsMetadata:s,selectTab:r,removeTab:o,renderTab:a,className:i,style:u})=>jsx("div",{className:i,style:{display:"flex",alignItems:"center",height:"100%",...u},children:e.map(p=>{let x=s?.[p];return jsx(yt,{id:p,locked:n,children:({isDragging:m,isOver:v})=>a({tabId:p,activeTabId:t,isDragging:m,isOver:v,metadata:x,selectTab:r,removeTab:o})},p)})});export{wt as DEFAULT_DRAG_ACTIVATION_DISTANCE,In as DEFAULT_RESIZER_SIZE,Ct as DEFAULT_SNAP_THRESHOLD,yn as DragHandle,hn as Pane,tn as PaneTree,Me as PortalRegistryContext,bt as ResizableContainer,wn as Tabs,Yt as Zeugma,We as ZeugmaActionsContext,Ue as ZeugmaDragContext,Be as ZeugmaStateContext,Ne as createDragSession,Re as safeJsonStringify,Ye as useResizer,Et as useZeugma,Le as useZeugmaActions,Nt as useZeugmaContext,ot as useZeugmaDrag,ce as useZeugmaState};//# sourceMappingURL=index.js.map
|
|
7
7
|
//# sourceMappingURL=index.js.map
|