@object-ui/runner 0.5.0 → 2.0.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.
@@ -1,4 +1,4 @@
1
- import{r as C,e as K,j as h,f as U,g as Y,h as G,B as k,T as J,C as Q,a as X,b as Z,c as ee,d as te}from"./index-CaiAD2yc.js";import{u as se,a as ne,P as ie,D as re,c as oe,b as le,d as ae,e as $,S as he,v as ce,C as de}from"./sortable.esm-D2YJ7QKB.js";function A(n,l,e){let s=e.initialDeps??[],t,r=!0;function o(){var i,a,c;let f;e.key&&((i=e.debug)!=null&&i.call(e))&&(f=Date.now());const x=n();if(!(x.length!==s.length||x.some((S,p)=>s[p]!==S)))return t;s=x;let b;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(b=Date.now()),t=l(...x),e.key&&((c=e.debug)!=null&&c.call(e))){const S=Math.round((Date.now()-f)*100)/100,p=Math.round((Date.now()-b)*100)/100,w=p/16,E=(u,g)=>{for(u=String(u);u.length<g;)u=" "+u;return u};console.info(`%c⏱ ${E(p,5)} /${E(S,5)} ms`,`
1
+ import{r as C,e as K,j as h,f as U,g as Y,h as G,B as k,T as J,C as Q,a as X,b as Z,c as ee,d as te}from"./index-CVtA56x5.js";import{u as se,a as ne,P as ie,D as re,c as oe,b as le,d as ae,e as $,S as he,v as ce,C as de}from"./sortable.esm-Cpqc3Ogp.js";function A(n,l,e){let s=e.initialDeps??[],t,r=!0;function o(){var i,a,c;let f;e.key&&((i=e.debug)!=null&&i.call(e))&&(f=Date.now());const x=n();if(!(x.length!==s.length||x.some((S,p)=>s[p]!==S)))return t;s=x;let b;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(b=Date.now()),t=l(...x),e.key&&((c=e.debug)!=null&&c.call(e))){const S=Math.round((Date.now()-f)*100)/100,p=Math.round((Date.now()-b)*100)/100,w=p/16,E=(u,g)=>{for(u=String(u);u.length<g;)u=" "+u;return u};console.info(`%c⏱ ${E(p,5)} /${E(S,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(r&&e.skipInitialOnChange)&&e.onChange(t),r=!1,t}return o.updateDeps=i=>{s=i},o}function L(n,l){if(n===void 0)throw new Error("Unexpected undefined");return n}const ue=(n,l)=>Math.abs(n-l)<1.01,fe=(n,l,e)=>{let s;return function(...t){n.clearTimeout(s),s=n.setTimeout(()=>l.apply(this,t),e)}},B=n=>{const{offsetWidth:l,offsetHeight:e}=n;return{width:l,height:e}},me=n=>n,ge=n=>{const l=Math.max(n.startIndex-n.overscan,0),e=Math.min(n.endIndex+n.overscan,n.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},pe=(n,l)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;const t=o=>{const{width:i,height:a}=o;l({width:Math.round(i),height:Math.round(a)})};if(t(B(e)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(o=>{const i=()=>{const a=o[0];if(a!=null&&a.borderBoxSize){const c=a.borderBoxSize[0];if(c){t({width:c.inlineSize,height:c.blockSize});return}}t(B(e))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},V={passive:!0},P=typeof window>"u"?!0:"onscrollend"in window,xe=(n,l)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;let t=0;const r=n.options.useScrollendEvent&&P?()=>{}:fe(s,()=>{l(t,!1)},n.options.isScrollingResetDelay),o=f=>()=>{const{horizontal:x,isRtl:d}=n.options;t=x?e.scrollLeft*(d&&-1||1):e.scrollTop,r(),l(t,f)},i=o(!0),a=o(!1);e.addEventListener("scroll",i,V);const c=n.options.useScrollendEvent&&P;return c&&e.addEventListener("scrollend",a,V),()=>{e.removeEventListener("scroll",i),c&&e.removeEventListener("scrollend",a)}},ve=(n,l,e)=>{if(l!=null&&l.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return n[e.options.horizontal?"offsetWidth":"offsetHeight"]},be=(n,{adjustments:l=0,behavior:e},s)=>{var t,r;const o=n+l;(r=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||r.call(t,{[s.options.horizontal?"left":"top"]:o,behavior:e})};class Ce{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(r=>{const o=()=>{this._measureElement(r.target,r)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var r;return(r=s())==null?void 0:r.observe(t,{box:"border-box"})},unobserve:t=>{var r;return(r=s())==null?void 0:r.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:me,rangeExtractor:ge,onChange:()=>{},measureElement:ve,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=A(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=r,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,r=new Map;for(let o=s-1;o>=0;o--){const i=e[o];if(t.has(i.lane))continue;const a=r.get(i.lane);if(a==null||i.end>a.end?r.set(i.lane,i):i.end<a.end&&t.set(i.lane,!0),t.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((o,i)=>o.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=A(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,r,o,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:r,enabled:o,lanes:i}),{key:!1}),this.getMeasurements=A(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:r,enabled:o,lanes:i},a)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const d of this.laneAssignments.keys())d>=e&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,c),x=new Array(i).fill(void 0);for(let d=0;d<c;d++){const b=f[d];b&&(x[b.lane]=d)}for(let d=c;d<e;d++){const b=r(d),S=this.laneAssignments.get(d);let p,w;if(S!==void 0&&this.options.lanes>1){p=S;const m=x[p],v=m!==void 0?f[m]:void 0;w=v?v.end+this.options.gap:s+t}else{const m=this.options.lanes===1?f[d-1]:this.getFurthestMeasurement(f,d);w=m?m.end+this.options.gap:s+t,p=m?m.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,p)}const E=a.get(b),u=typeof E=="number"?E:this.options.estimateSize(d),g=w+u;f[d]={index:d,start:w,size:u,end:g,key:b,lane:p},x[p]=d}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=A(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,r)=>this.range=e.length>0&&s>0?Se({measurements:e,outerSize:s,scrollOffset:t,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=A(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,r,o)=>r===null||o===null?[]:e({startIndex:r,endIndex:o,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),r=this.measurementsCache[t];if(!r)return;const o=r.key,i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const r=this.itemSizeCache.get(t.key)??t.size,o=s-r;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,o,this):t.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=A(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let r=0,o=e.length;r<o;r++){const i=e[r],a=s[i];t.push(a)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return L(s[q(0,s.length-1,t=>L(s[t]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,s,t=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=e>=o+r?"end":"start"),s==="center"?e+=(t-r)/2:s==="end"&&(e-=r);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const r=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(t.end>=o+r-this.options.scrollPaddingEnd)s="end";else if(t.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];if(s==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),s];const i=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1)),this.currentScrollToIndex=e;let r=0;const o=10,i=c=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(e,c);if(!f){console.warn("Failed to get offset for index:",e);return}const[x,d]=f;this._scrollToOffset(x,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const b=()=>{if(this.currentScrollToIndex!==e)return;const S=this.getScrollOffset(),p=this.getOffsetForIndex(e,d);if(!p){console.warn("Failed to get offset for index:",e);return}ue(p[0],S)||a(d)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(b):b()})},a=c=>{this.targetWindow&&this.currentScrollToIndex===e&&(r++,r<o?this.targetWindow.requestAnimationFrame(()=>i(c)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};i(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const r=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&r.some(i=>i===null);){const i=s[o];r[i.lane]===null&&(r[i.lane]=i.end),o--}t=Math.max(...r.filter(i=>i!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(l)}}const q=(n,l,e,s)=>{for(;n<=l;){const t=(n+l)/2|0,r=e(t);if(r<s)n=t+1;else if(r>s)l=t-1;else return t}return n>0?n-1:0};function Se({measurements:n,outerSize:l,scrollOffset:e,lanes:s}){const t=n.length-1,r=a=>n[a].start;if(n.length<=s)return{startIndex:0,endIndex:t};let o=q(0,t,r,e),i=o;if(s===1)for(;i<t&&n[i].end<e+l;)i++;else if(s>1){const a=Array(s).fill(0);for(;i<t&&a.some(f=>f<e+l);){const f=n[i];a[f.lane]=f.end,i++}const c=Array(s).fill(e+l);for(;o>=0&&c.some(f=>f>=e);){const f=n[o];c[f.lane]=f.start,o--}o=Math.max(0,o-o%s),i=Math.min(t,i+(s-1-i%s))}return{startIndex:o,endIndex:i}}const H=typeof document<"u"?C.useLayoutEffect:C.useEffect;function we({useFlushSync:n=!0,...l}){const e=C.useReducer(()=>({}),{})[1],s={...l,onChange:(r,o)=>{var i;n&&o?K.flushSync(e):e(),(i=l.onChange)==null||i.call(l,r,o)}},[t]=C.useState(()=>new Ce(s));return t.setOptions(s),H(()=>t._didMount(),[]),H(()=>t._willUpdate()),t}function ye(n){return we({observeElementRect:pe,observeElementOffset:xe,scrollToFn:be,...n})}const T=(...n)=>n.filter(Boolean).join(" ");function _({card:n}){const{attributes:l,listeners:e,setNodeRef:s,transform:t,transition:r,isDragging:o}=$({id:n.id}),i={transform:de.Transform.toString(t),transition:r,opacity:o?.5:void 0};return h.jsx("div",{ref:s,style:i,...l,...e,children:h.jsxs(Q,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[h.jsxs(X,{className:"p-4",children:[h.jsx(Z,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:n.title}),n.description&&h.jsx(ee,{className:"text-xs text-muted-foreground font-mono",children:n.description})]}),n.badges&&n.badges.length>0&&h.jsx(te,{className:"p-4 pt-0",children:h.jsx("div",{className:"flex flex-wrap gap-1",children:n.badges.map((a,c)=>h.jsx(k,{variant:a.variant||"default",className:"text-xs",children:a.label},c))})})]})})}function Ee({cards:n,parentRef:l}){const e=ye({count:n.length,getScrollElement:()=>l.current,estimateSize:()=>120,overscan:5});return h.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(s=>{const t=n[s.index];return h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${s.start}px)`},children:h.jsx(_,{card:t})},t.id)})})}function ze({column:n,cards:l,onToggle:e,enableVirtual:s}){const t=l||[],r=C.useRef(null),{setNodeRef:o}=$({id:n.id,data:{type:"column"}}),i=n.limit&&t.length>=n.limit,a=n.limit&&t.length>=n.limit*.8;return h.jsxs("div",{ref:o,className:T("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",n.collapsed?"w-16":"w-80",n.className),children:[h.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[h.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>e(!n.collapsed),children:n.collapsed?h.jsx(Y,{className:"h-4 w-4"}):h.jsx(G,{className:"h-4 w-4"})}),!n.collapsed&&h.jsxs(h.Fragment,{children:[h.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:n.title}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("span",{className:T("font-mono text-xs",i?"text-destructive":a?"text-yellow-500":"text-muted-foreground"),children:[t.length,n.limit&&` / ${n.limit}`]}),i&&h.jsx(k,{variant:"destructive",className:"text-xs",children:"Full"}),a&&!i&&h.jsx(J,{className:"h-3 w-3 text-yellow-500"})]})]})]}),n.collapsed&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:n.title}),h.jsx(k,{variant:"secondary",className:"text-xs",children:t.length})]})]}),!n.collapsed&&h.jsx("div",{ref:r,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:h.jsx(he,{items:t.map(c=>c.id),strategy:ce,children:s?h.jsx(Ee,{cards:t,parentRef:r}):h.jsx("div",{className:"space-y-2",children:t.map(c=>h.jsx(_,{card:c},c.id))})})})]})}function Oe({columns:n,onCardMove:l,onColumnToggle:e,enableVirtualScrolling:s=!1,virtualScrollThreshold:t=50,className:r}){const[o,i]=C.useState(null),a=C.useMemo(()=>(n||[]).map(u=>({...u,cards:u.cards||[]})),[n]),[c,f]=C.useState(a);C.useEffect(()=>{f(a)},[a]);const x=se(ne(ie,{activationConstraint:{distance:8}})),d=u=>{const{active:g}=u,m=S(g.id);i(m)},b=u=>{const{active:g,over:m}=u;if(i(null),!m)return;const v=g.id,I=m.id;if(v===I)return;const z=p(v),O=p(I)||w(I);if(!(!z||!O))if(z.id===O.id){const M=[...z.cards],j=M.findIndex(y=>y.id===v),F=M.findIndex(y=>y.id===I),W=ae(M,j,F);f(y=>y.map(N=>N.id===z.id?{...N,cards:W}:N))}else{const M=[...z.cards],j=[...O.cards],F=M.findIndex(R=>R.id===v),y=I===O.id?j.length:j.findIndex(R=>R.id===I),[N]=M.splice(F,1);j.splice(y,0,N),f(R=>R.map(D=>D.id===z.id?{...D,cards:M}:D.id===O.id?{...D,cards:j}:D)),l&&l(v,z.id,O.id,y)}},S=C.useCallback(u=>{for(const g of c){const m=g.cards.find(v=>v.id===u);if(m)return m}return null},[c]),p=C.useCallback(u=>c.find(g=>g.cards.some(m=>m.id===u))||null,[c]),w=C.useCallback(u=>c.find(g=>g.id===u)||null,[c]),E=C.useCallback((u,g)=>{f(m=>m.map(v=>v.id===u?{...v,collapsed:g}:v)),e==null||e(u,g)},[e]);return h.jsxs(re,{sensors:x,collisionDetection:oe,onDragStart:d,onDragEnd:b,children:[h.jsx("div",{className:T("flex gap-4 overflow-x-auto p-4",r),children:c.map(u=>{const g=s&&u.cards.length>t;return h.jsx(ze,{column:u,cards:u.cards,onToggle:m=>E(u.id,m),enableVirtual:g},u.id)})}),h.jsx(le,{children:o?h.jsx(_,{card:o}):null})]})}export{Oe as KanbanEnhanced,Oe as default};
@@ -1 +1 @@
1
- import{r as x,j as e,B as k,S as L,C as P,a as T,b as F,c as H,d as M}from"./index-CaiAD2yc.js";import{u as $,a as q,D as z,c as G,b as J,d as Q,P as U,e as B,S as V,v as W,C as X}from"./sortable.esm-D2YJ7QKB.js";const E=(...s)=>s.filter(Boolean).join(" ");function O({card:s}){const{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:t,isDragging:a}=B({id:s.id}),b={transform:X.Transform.toString(p),transition:t,opacity:a?.5:void 0};return e.jsx("div",{ref:f,style:b,...u,...d,children:e.jsxs(P,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[e.jsxs(T,{className:"p-4",children:[e.jsx(F,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(H,{className:"text-xs text-muted-foreground font-mono",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(M,{className:"p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((S,y)=>e.jsx(k,{variant:S.variant||"default",className:"text-xs",children:S.label},y))})})]})})}function Y({column:s,cards:u}){const d=u||[],{setNodeRef:f}=B({id:s.id,data:{type:"column"}}),p=s.limit&&d.length>=s.limit;return e.jsxs("div",{ref:f,className:E("flex flex-col w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl",s.className),children:[e.jsx("div",{className:"p-4 border-b border-border/50 bg-muted/20",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[d.length,s.limit&&` / ${s.limit}`]}),p&&e.jsx(k,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsx(L,{className:"flex-1 p-4",children:e.jsx(V,{items:d.map(t=>t.id),strategy:W,children:e.jsx("div",{className:"space-y-2",children:d.map(t=>e.jsx(O,{card:t},t.id))})})})]})}function ee({columns:s,onCardMove:u,className:d}){const[f,p]=x.useState(null),t=x.useMemo(()=>(s||[]).map(r=>({...r,cards:r.cards||[]})),[s]),[a,b]=x.useState(t);x.useEffect(()=>{b(t)},[t]);const S=$(q(U,{activationConstraint:{distance:8}})),y=r=>{const{active:n}=r,i=A(n.id);p(i)},R=r=>{const{active:n,over:i}=r;if(p(null),!i)return;const c=n.id,g=i.id;if(c===g)return;const l=I(c),h=I(g)||K(g);if(!(!l||!h))if(l.id===h.id){const m=[...l.cards],v=m.findIndex(o=>o.id===c),D=m.findIndex(o=>o.id===g),w=Q(m,v,D);b(o=>o.map(C=>C.id===l.id?{...C,cards:w}:C))}else{const m=[...l.cards],v=[...h.cards],D=m.findIndex(j=>j.id===c),o=g===h.id?v.length:v.findIndex(j=>j.id===g),[C]=m.splice(D,1);v.splice(o,0,C),b(j=>j.map(N=>N.id===l.id?{...N,cards:m}:N.id===h.id?{...N,cards:v}:N)),u&&u(c,l.id,h.id,o)}},A=x.useCallback(r=>{for(const n of a){const i=n.cards.find(c=>c.id===r);if(i)return i}return null},[a]),I=x.useCallback(r=>a.find(n=>n.cards.some(i=>i.id===r))||null,[a]),K=x.useCallback(r=>a.find(n=>n.id===r)||null,[a]);return e.jsxs(z,{sensors:S,collisionDetection:G,onDragStart:y,onDragEnd:R,children:[e.jsx("div",{className:E("flex gap-4 overflow-x-auto p-4",d),children:a.map(r=>e.jsx(Y,{column:r,cards:r.cards},r.id))}),e.jsx(J,{children:f?e.jsx(O,{card:f}):null})]})}export{ee as default};
1
+ import{r as x,j as e,B as k,S as L,C as P,a as T,b as F,c as H,d as M}from"./index-CVtA56x5.js";import{u as $,a as q,D as z,c as G,b as J,d as Q,P as U,e as B,S as V,v as W,C as X}from"./sortable.esm-Cpqc3Ogp.js";const E=(...s)=>s.filter(Boolean).join(" ");function O({card:s}){const{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:t,isDragging:a}=B({id:s.id}),b={transform:X.Transform.toString(p),transition:t,opacity:a?.5:void 0};return e.jsx("div",{ref:f,style:b,...u,...d,children:e.jsxs(P,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[e.jsxs(T,{className:"p-4",children:[e.jsx(F,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(H,{className:"text-xs text-muted-foreground font-mono",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(M,{className:"p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((S,y)=>e.jsx(k,{variant:S.variant||"default",className:"text-xs",children:S.label},y))})})]})})}function Y({column:s,cards:u}){const d=u||[],{setNodeRef:f}=B({id:s.id,data:{type:"column"}}),p=s.limit&&d.length>=s.limit;return e.jsxs("div",{ref:f,className:E("flex flex-col w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl",s.className),children:[e.jsx("div",{className:"p-4 border-b border-border/50 bg-muted/20",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[d.length,s.limit&&` / ${s.limit}`]}),p&&e.jsx(k,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsx(L,{className:"flex-1 p-4",children:e.jsx(V,{items:d.map(t=>t.id),strategy:W,children:e.jsx("div",{className:"space-y-2",children:d.map(t=>e.jsx(O,{card:t},t.id))})})})]})}function ee({columns:s,onCardMove:u,className:d}){const[f,p]=x.useState(null),t=x.useMemo(()=>(s||[]).map(r=>({...r,cards:r.cards||[]})),[s]),[a,b]=x.useState(t);x.useEffect(()=>{b(t)},[t]);const S=$(q(U,{activationConstraint:{distance:8}})),y=r=>{const{active:n}=r,i=A(n.id);p(i)},R=r=>{const{active:n,over:i}=r;if(p(null),!i)return;const c=n.id,g=i.id;if(c===g)return;const l=I(c),h=I(g)||K(g);if(!(!l||!h))if(l.id===h.id){const m=[...l.cards],v=m.findIndex(o=>o.id===c),D=m.findIndex(o=>o.id===g),w=Q(m,v,D);b(o=>o.map(C=>C.id===l.id?{...C,cards:w}:C))}else{const m=[...l.cards],v=[...h.cards],D=m.findIndex(j=>j.id===c),o=g===h.id?v.length:v.findIndex(j=>j.id===g),[C]=m.splice(D,1);v.splice(o,0,C),b(j=>j.map(N=>N.id===l.id?{...N,cards:m}:N.id===h.id?{...N,cards:v}:N)),u&&u(c,l.id,h.id,o)}},A=x.useCallback(r=>{for(const n of a){const i=n.cards.find(c=>c.id===r);if(i)return i}return null},[a]),I=x.useCallback(r=>a.find(n=>n.cards.some(i=>i.id===r))||null,[a]),K=x.useCallback(r=>a.find(n=>n.id===r)||null,[a]);return e.jsxs(z,{sensors:S,collisionDetection:G,onDragStart:y,onDragEnd:R,children:[e.jsx("div",{className:E("flex gap-4 overflow-x-auto p-4",d),children:a.map(r=>e.jsx(Y,{column:r,cards:r.cards},r.id))}),e.jsx(J,{children:f?e.jsx(O,{card:f}):null})]})}export{ee as default};