@object-ui/runner 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +11 -0
- package/dist/assets/AdvancedChartImpl-B5YHWGFu.js +7 -0
- package/dist/assets/{BarChart-BIxHwnDw.js → BarChart-DzxUYCwr.js} +1 -1
- package/dist/assets/{ChartImpl-DTGEGono.js → ChartImpl-CLrjD4L7.js} +1 -1
- package/dist/assets/KanbanEnhanced-BGfku4Ir.js +4 -0
- package/dist/assets/KanbanImpl-DhcXbpqj.js +1 -0
- package/dist/assets/index-CRtlK6XQ.js +8726 -0
- package/dist/assets/index-iSUxS8mA.css +1 -0
- package/dist/assets/{sortable.esm-gzhkDKye.js → sortable.esm-lMllE-Yw.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +13 -13
- package/src/LayoutRenderer.tsx +1 -1
- package/dist/assets/AdvancedChartImpl-C2RUFqxO.js +0 -7
- package/dist/assets/KanbanEnhanced-QvmDfB6a.js +0 -4
- package/dist/assets/KanbanImpl-LemNieQQ.js +0 -1
- package/dist/assets/index-hTFnVBMw.css +0 -1
- package/dist/assets/index-taqjqZHy.js +0 -8556
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as x,g as J,j as a,f as U,h as Q,i as X,B as W,T as Z,C as ee,b as te,c as se,d as ne,e as ie,P as re,I as oe}from"./index-CRtlK6XQ.js";import{u as le,a as ae,D as ce,c as de,b as he,d as ue,P as fe,e as Y,S as me,v as ge,C as pe}from"./sortable.esm-lMllE-Yw.js";function N(n,l,e){let s=e.initialDeps??[],t,i=!0;function o(){var r,h,d;let u;e.key&&((r=e.debug)!=null&&r.call(e))&&(u=Date.now());const m=n();if(!(m.length!==s.length||m.some((S,p)=>s[p]!==S)))return t;s=m;let g;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(g=Date.now()),t=l(...m),e.key&&((d=e.debug)!=null&&d.call(e))){const S=Math.round((Date.now()-u)*100)/100,p=Math.round((Date.now()-g)*100)/100,E=p/16,I=(C,R)=>{for(C=String(C);C.length<R;)C=" "+C;return C};console.info(`%c⏱ ${I(p,5)} /${I(S,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*E,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(i&&e.skipInitialOnChange)&&e.onChange(t),i=!1,t}return o.updateDeps=r=>{s=r},o}function P(n,l){if(n===void 0)throw new Error("Unexpected undefined");return n}const xe=(n,l)=>Math.abs(n-l)<1.01,ve=(n,l,e)=>{let s;return function(...t){n.clearTimeout(s),s=n.setTimeout(()=>l.apply(this,t),e)}},H=n=>{const{offsetWidth:l,offsetHeight:e}=n;return{width:l,height:e}},be=n=>n,Ce=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},we=(n,l)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;const t=o=>{const{width:r,height:h}=o;l({width:Math.round(r),height:Math.round(h)})};if(t(H(e)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const r=()=>{const h=o[0];if(h!=null&&h.borderBoxSize){const d=h.borderBoxSize[0];if(d){t({width:d.inlineSize,height:d.blockSize});return}}t(H(e))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},$={passive:!0},q=typeof window>"u"?!0:"onscrollend"in window,Se=(n,l)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;let t=0;const i=n.options.useScrollendEvent&&q?()=>{}:ve(s,()=>{l(t,!1)},n.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:m,isRtl:c}=n.options;t=m?e.scrollLeft*(c&&-1||1):e.scrollTop,i(),l(t,u)},r=o(!0),h=o(!1);e.addEventListener("scroll",r,$);const d=n.options.useScrollendEvent&&q;return d&&e.addEventListener("scrollend",h,$),()=>{e.removeEventListener("scroll",r),d&&e.removeEventListener("scrollend",h)}},ye=(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"]},Ee=(n,{adjustments:l=0,behavior:e},s)=>{var t,i;const o=n+l;(i=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||i.call(t,{[s.options.horizontal?"left":"top"]:o,behavior:e})};class ze{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(i=>{const o=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var i;return(i=s())==null?void 0:i.observe(t,{box:"border-box"})},unobserve:t=>{var i;return(i=s())==null?void 0:i.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:be,rangeExtractor:Ce,onChange:()=>{},measureElement:ye,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=N(()=>(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,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=i,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,i=new Map;for(let o=s-1;o>=0;o--){const r=e[o];if(t.has(r.lane))continue;const h=i.get(r.lane);if(h==null||r.end>h.end?i.set(r.lane,r):r.end<h.end&&t.set(r.lane,!0),t.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,r)=>o.end===r.end?o.index-r.index:o.end-r.end)[0]:void 0},this.getMeasurementOptions=N(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,i,o,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:i,enabled:o,lanes:r}),{key:!1}),this.getMeasurements=N(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:i,enabled:o,lanes:r},h)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const c of this.laneAssignments.keys())c>=e&&this.laneAssignments.delete(c);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(c=>{this.itemSizeCache.set(c.key,c.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,d),m=new Array(r).fill(void 0);for(let c=0;c<d;c++){const g=u[c];g&&(m[g.lane]=c)}for(let c=d;c<e;c++){const g=i(c),S=this.laneAssignments.get(c);let p,E;if(S!==void 0&&this.options.lanes>1){p=S;const y=m[p],f=y!==void 0?u[y]:void 0;E=f?f.end+this.options.gap:s+t}else{const y=this.options.lanes===1?u[c-1]:this.getFurthestMeasurement(u,c);E=y?y.end+this.options.gap:s+t,p=y?y.lane:c%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(c,p)}const I=h.get(g),C=typeof I=="number"?I:this.options.estimateSize(c),R=E+C;u[c]={index:c,start:E,size:C,end:R,key:g,lane:p},m[p]=c}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=N(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,i)=>this.range=e.length>0&&s>0?Ie({measurements:e,outerSize:s,scrollOffset:t,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=N(()=>{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,i,o)=>i===null||o===null?[]:e({startIndex:i,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),i=this.measurementsCache[t];if(!i)return;const o=i.key,r=this.elementsCache.get(o);r!==e&&(r&&this.observer.unobserve(r),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 i=this.itemSizeCache.get(t.key)??t.size,o=s-i;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=N(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let i=0,o=e.length;i<o;i++){const r=e[i],h=s[r];t.push(h)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return P(s[G(0,s.length-1,t=>P(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 i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=e>=o+i?"end":"start"),s==="center"?e+=(t-i)/2:s==="end"&&(e-=i);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,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 i=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(t.end>=o+i-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 r=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,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 i=0;const o=10,r=d=>{if(!this.targetWindow)return;const u=this.getOffsetForIndex(e,d);if(!u){console.warn("Failed to get offset for index:",e);return}const[m,c]=u;this._scrollToOffset(m,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{if(!this.targetWindow)return;const g=()=>{if(this.currentScrollToIndex!==e)return;const S=this.getScrollOffset(),p=this.getOffsetForIndex(e,c);if(!p){console.warn("Failed to get offset for index:",e);return}xe(p[0],S)||h(c)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(g):g()})},h=d=>{this.targetWindow&&this.currentScrollToIndex===e&&(i++,i<o?this.targetWindow.requestAnimationFrame(()=>r(d)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};r(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 i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(r=>r===null);){const r=s[o];i[r.lane]===null&&(i[r.lane]=r.end),o--}t=Math.max(...i.filter(r=>r!==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 G=(n,l,e,s)=>{for(;n<=l;){const t=(n+l)/2|0,i=e(t);if(i<s)n=t+1;else if(i>s)l=t-1;else return t}return n>0?n-1:0};function Ie({measurements:n,outerSize:l,scrollOffset:e,lanes:s}){const t=n.length-1,i=h=>n[h].start;if(n.length<=s)return{startIndex:0,endIndex:t};let o=G(0,t,i,e),r=o;if(s===1)for(;r<t&&n[r].end<e+l;)r++;else if(s>1){const h=Array(s).fill(0);for(;r<t&&h.some(u=>u<e+l);){const u=n[r];h[u.lane]=u.end,r++}const d=Array(s).fill(e+l);for(;o>=0&&d.some(u=>u>=e);){const u=n[o];d[u.lane]=u.start,o--}o=Math.max(0,o-o%s),r=Math.min(t,r+(s-1-r%s))}return{startIndex:o,endIndex:r}}const K=typeof document<"u"?x.useLayoutEffect:x.useEffect;function Me({useFlushSync:n=!0,...l}){const e=x.useReducer(()=>({}),{})[1],s={...l,onChange:(i,o)=>{var r;n&&o?J.flushSync(e):e(),(r=l.onChange)==null||r.call(l,i,o)}},[t]=x.useState(()=>new ze(s));return t.setOptions(s),K(()=>t._didMount(),[]),K(()=>t._willUpdate()),t}function je(n){return Me({observeElementRect:we,observeElementOffset:Se,scrollToFn:Ee,...n})}const L=(...n)=>n.filter(Boolean).join(" ");function Oe(n,l){if(!l||l.length===0)return{};for(const e of l){const s=n[e.field];if(s==null)continue;let t=!1;const i=String(s);switch(e.operator){case"equals":t=i===String(e.value);break;case"not_equals":t=i!==String(e.value);break;case"contains":t=i.toLowerCase().includes(String(e.value).toLowerCase());break;case"in":t=Array.isArray(e.value)&&e.value.includes(i);break}if(t)return{...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.borderColor?{borderColor:e.borderColor}:{}}}return{}}function B({card:n,conditionalFormatting:l}){const{attributes:e,listeners:s,setNodeRef:t,transform:i,transition:o,isDragging:r}=Y({id:n.id}),h={transform:pe.Transform.toString(i),transition:o,opacity:r?.5:void 0},d=Oe(n,l);return a.jsx("div",{ref:t,style:h,...e,...s,children:a.jsxs(ee,{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",style:d,children:[n.coverImage&&a.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:a.jsx("img",{src:n.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),a.jsxs(te,{className:"p-4",children:[a.jsx(se,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:n.title}),n.description&&a.jsx(ne,{className:"text-xs text-muted-foreground font-mono",children:n.description})]}),n.badges&&n.badges.length>0&&a.jsx(ie,{className:"p-4 pt-0",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:n.badges.map((u,m)=>a.jsx(W,{variant:u.variant||"default",className:"text-xs",children:u.label},m))})})]})})}function ke({cards:n,parentRef:l,conditionalFormatting:e}){const s=je({count:n.length,getScrollElement:()=>l.current,estimateSize:()=>120,overscan:5});return a.jsx("div",{style:{height:`${s.getTotalSize()}px`,width:"100%",position:"relative"},children:s.getVirtualItems().map(t=>{const i=n[t.index];return a.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${t.start}px)`},children:a.jsx(B,{card:i,conditionalFormatting:e})},i.id)})})}function Ae({columnId:n,onAdd:l}){const[e,s]=x.useState(!1),[t,i]=x.useState(""),o=x.useRef(null),r=()=>{const d=t.trim();d&&(l(n,d),i("")),s(!1)},h=d=>{d.key==="Enter"?(d.preventDefault(),r()):d.key==="Escape"&&(i(""),s(!1))};return e?a.jsx("div",{className:"mt-2 space-y-2",children:a.jsx(oe,{ref:o,value:t,onChange:d=>i(d.target.value),onKeyDown:h,onBlur:r,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):a.jsxs(U,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{s(!0),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.focus()},0)},children:[a.jsx(re,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function Ne({column:n,cards:l,onToggle:e,enableVirtual:s,quickAdd:t,onQuickAdd:i,conditionalFormatting:o}){const r=l||[],h=x.useRef(null),{setNodeRef:d}=Y({id:n.id,data:{type:"column"}}),u=n.limit&&r.length>=n.limit,m=n.limit&&r.length>=n.limit*.8;return a.jsxs("div",{ref:d,className:L("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:[a.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>e(!n.collapsed),children:n.collapsed?a.jsx(Q,{className:"h-4 w-4"}):a.jsx(X,{className:"h-4 w-4"})}),!n.collapsed&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:n.title}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:L("font-mono text-xs",u?"text-destructive":m?"text-yellow-500":"text-muted-foreground"),children:[r.length,n.limit&&` / ${n.limit}`]}),u&&a.jsx(W,{variant:"destructive",className:"text-xs",children:"Full"}),m&&!u&&a.jsx(Z,{className:"h-3 w-3 text-yellow-500"})]})]})]}),n.collapsed&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:n.title}),a.jsx(W,{variant:"secondary",className:"text-xs",children:r.length})]})]}),!n.collapsed&&a.jsxs("div",{ref:h,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[a.jsx(me,{items:r.map(c=>c.id),strategy:ge,children:s?a.jsx(ke,{cards:r,parentRef:h,conditionalFormatting:o}):a.jsx("div",{className:"space-y-2",children:r.map(c=>a.jsx(B,{card:c,conditionalFormatting:o},c.id))})}),t&&i&&a.jsx(Ae,{columnId:n.id,onAdd:i})]})]})}function Fe({columns:n,onCardMove:l,onColumnToggle:e,enableVirtualScrolling:s=!1,virtualScrollThreshold:t=50,className:i,quickAdd:o,onQuickAdd:r,conditionalFormatting:h}){const[d,u]=x.useState(null),m=x.useMemo(()=>(n||[]).map(f=>({...f,cards:f.cards||[]})),[n]),[c,g]=x.useState(m);x.useEffect(()=>{g(m)},[m]);const S=le(ae(fe,{activationConstraint:{distance:8}})),p=f=>{const{active:v}=f,b=I(v.id);u(b)},E=f=>{const{active:v,over:b}=f;if(u(null),!b)return;const w=v.id,O=b.id;if(w===O)return;const M=C(w),k=C(O)||R(O);if(!(!M||!k))if(M.id===k.id){const j=[...M.cards],A=j.findIndex(z=>z.id===w),_=j.findIndex(z=>z.id===O),V=ue(j,A,_);g(z=>z.map(D=>D.id===M.id?{...D,cards:V}:D))}else{const j=[...M.cards],A=[...k.cards],_=j.findIndex(F=>F.id===w),z=O===k.id?A.length:A.findIndex(F=>F.id===O),[D]=j.splice(_,1);A.splice(z,0,D),g(F=>F.map(T=>T.id===M.id?{...T,cards:j}:T.id===k.id?{...T,cards:A}:T)),l&&l(w,M.id,k.id,z)}},I=x.useCallback(f=>{for(const v of c){const b=v.cards.find(w=>w.id===f);if(b)return b}return null},[c]),C=x.useCallback(f=>c.find(v=>v.cards.some(b=>b.id===f))||null,[c]),R=x.useCallback(f=>c.find(v=>v.id===f)||null,[c]),y=x.useCallback((f,v)=>{g(b=>b.map(w=>w.id===f?{...w,collapsed:v}:w)),e==null||e(f,v)},[e]);return a.jsxs(ce,{sensors:S,collisionDetection:de,onDragStart:p,onDragEnd:E,children:[a.jsx("div",{className:L("flex gap-4 overflow-x-auto p-4",i),children:c.map(f=>{const v=s&&f.cards.length>t;return a.jsx(Ne,{column:f,cards:f.cards,onToggle:b=>y(f.id,b),enableVirtual:v,quickAdd:o,onQuickAdd:r,conditionalFormatting:h},f.id)})}),a.jsx(he,{children:d?a.jsx(B,{card:d,conditionalFormatting:h}):null})]})}export{Fe as KanbanEnhanced,Fe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as Q,j as e,a as F,r as p,C as ee,b as se,c as te,d as re,e as ae,B as $,S as ne,f as ie,P as oe,I as le}from"./index-CRtlK6XQ.js";import{u as de,a as V,D as ce,c as ue,S as _,v as H,b as me,d as xe,T as fe,P as pe,e as J,C as ge}from"./sortable.esm-lMllE-Yw.js";const E=(...s)=>s.filter(Boolean).join(" "),T="Uncategorized";function he(s,l){if(!l||l.length===0)return{};for(const i of l){const u=s[i.field];if(u==null)continue;let a=!1;const m=String(u);switch(i.operator){case"equals":a=m===String(i.value);break;case"not_equals":a=m!==String(i.value);break;case"contains":a=m.toLowerCase().includes(String(i.value).toLowerCase());break;case"in":a=Array.isArray(i.value)&&i.value.includes(m);break}if(a)return{...i.backgroundColor?{backgroundColor:i.backgroundColor}:{},...i.borderColor?{borderColor:i.borderColor}:{}}}return{}}function O({card:s,onCardClick:l,conditionalFormatting:i}){const{attributes:u,listeners:a,setNodeRef:m,transform:x,transition:b,isDragging:g}=J({id:s.id}),r={transform:ge.Transform.toString(x),transition:b,opacity:g?.5:void 0},v=he(s,i);return e.jsx("div",{ref:m,style:r,...u,...a,role:"listitem","aria-label":s.title,onClick:()=>l==null?void 0:l(s),children:e.jsxs(ee,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:v,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(se,{className:"p-2 sm:p-4",children:[e.jsx(te,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(re,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ae,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((w,y)=>e.jsx($,{variant:w.variant||"default",className:"text-xs",children:w.label},y))})})]})})}function be({columnId:s,onAdd:l}){const[i,u]=p.useState(!1),[a,m]=p.useState(""),x=p.useRef(null),b=()=>{const r=a.trim();r&&(l(s,r),m("")),u(!1)},g=r=>{r.key==="Enter"?(r.preventDefault(),b()):r.key==="Escape"&&(m(""),u(!1))};return i?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(le,{ref:x,value:a,onChange:r=>m(r.target.value),onKeyDown:g,onBlur:b,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(ie,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{u(!0),setTimeout(()=>{var r;return(r=x.current)==null?void 0:r.focus()},0)},children:[e.jsx(oe,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function ve({column:s,cards:l,onCardClick:i,quickAdd:u,onQuickAdd:a,conditionalFormatting:m}){const x=l||[],{setNodeRef:b}=J({id:s.id,data:{type:"column"}}),g=s.limit&&x.length>=s.limit;return e.jsxs("div",{ref:b,role:"group","aria-label":s.title,className:E("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[x.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx($,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsxs(ne,{className:"flex-1 p-4",children:[e.jsx(_,{items:x.map(r=>r.id),strategy:H,children:e.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:[x.length===0&&e.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:e.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),x.map(r=>e.jsx(O,{card:r,onCardClick:i,conditionalFormatting:m},r.id))]})}),u&&a&&e.jsx(be,{columnId:s.id,onAdd:a})]})]})}function je({children:s}){const l=F();return e.jsx(e.Fragment,{children:s(l)})}function Ne({columns:s,onCardMove:l,onCardClick:i,className:u,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g}){return Q()?e.jsx(je,{children:v=>e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:v,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}):e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:null,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}function z({columns:s,onCardMove:l,onCardClick:i,className:u,dnd:a,quickAdd:m,onQuickAdd:x,coverImageField:b,conditionalFormatting:g,swimlaneField:r}){const[v,w]=p.useState(null),y=r?`objectui:kanban-collapsed:${r}`:null,[M,U]=p.useState(()=>{if(!y)return new Set;try{const t=localStorage.getItem(y);if(t){const o=JSON.parse(t);if(Array.isArray(o))return new Set(o.filter(n=>typeof n=="string"))}}catch{}return new Set}),A=p.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[f,B]=p.useState(A);p.useEffect(()=>{B(A)},[A]);const R=p.useMemo(()=>{if(!r)return null;const t=f.flatMap(n=>n.cards),o=new Set;return t.forEach(n=>{const d=n[r];o.add(d!=null?String(d):T)}),Array.from(o).sort()},[f,r]),q=p.useCallback(t=>{U(o=>{const n=new Set(o);if(n.has(t)?n.delete(t):n.add(t),y)try{localStorage.setItem(y,JSON.stringify([...n]))}catch{}return n})},[y]),G=de(V(pe,{activationConstraint:{distance:5}}),V(fe,{activationConstraint:{delay:200,tolerance:5}})),Z=t=>{const{active:o}=t,n=X(o.id);if(w(n),a&&n){const d=K(n.id);d&&a.startDrag({id:n.id,type:"kanban-card",data:n,sourceId:d.id})}},W=t=>{const{active:o,over:n}=t;if(w(null),!n){a&&a.endDrag();return}const d=o.id,h=n.id;if(d===h){a&&a.endDrag();return}const c=K(d),C=K(h)||Y(h);if(!c||!C){a&&a.endDrag();return}if(c.id===C.id){const N=[...c.cards],S=N.findIndex(j=>j.id===d),L=N.findIndex(j=>j.id===h),P=xe(N,S,L);B(j=>j.map(D=>D.id===c.id?{...D,cards:P}:D))}else{const N=[...c.cards],S=[...C.cards],L=N.findIndex(I=>I.id===d),j=h===C.id?S.length:S.findIndex(I=>I.id===h),[D]=N.splice(L,1);S.splice(j,0,D),B(I=>I.map(k=>k.id===c.id?{...k,cards:N}:k.id===C.id?{...k,cards:S}:k)),l&&l(d,c.id,C.id,j)}a&&a.endDrag(C.id)},X=p.useCallback(t=>{for(const o of f){const n=o.cards.find(d=>d.id===t);if(n)return n}return null},[f]),K=p.useCallback(t=>f.find(o=>o.cards.some(n=>n.id===t))||null,[f]),Y=p.useCallback(t=>f.find(o=>o.id===t)||null,[f]);return e.jsxs(ce,{sensors:G,collisionDetection:ue,onDragStart:Z,onDragEnd:W,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[f.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),R?e.jsxs("div",{className:E("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",u),role:"region","aria-label":"Kanban board with swimlanes",children:[e.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:f.map(t=>e.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[e.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:t.title}),e.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",t.cards.length,")"]})]},t.id))}),R.map(t=>{const o=M.has(t),n=f.reduce((d,h)=>d+h.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t).length,0);return e.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>q(t),"aria-expanded":!o,children:[e.jsx("span",{className:E("transition-transform text-xs",o?"":"rotate-90"),children:"▶"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:t}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",n,")"]})]}),!o&&e.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:f.map(d=>{const h=d.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t);return e.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:e.jsx(_,{items:h.map(c=>c.id),strategy:H,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${d.title} - ${t} cards`,children:h.map(c=>e.jsx(O,{card:c,onCardClick:i,conditionalFormatting:g},c.id))})})},d.id)})})]},t)})]}):e.jsx("div",{className:E("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",u),role:"region","aria-label":"Kanban board",children:f.map(t=>e.jsx(ve,{column:t,cards:t.cards,onCardClick:i,quickAdd:m,onQuickAdd:x,conditionalFormatting:g},t.id))}),e.jsx(me,{children:e.jsx("div",{"aria-live":"assertive","aria-label":v?`Dragging ${v.title}`:void 0,children:v?e.jsx(O,{card:v,conditionalFormatting:g}):null})})]})}export{Ne as default};
|