@rsktash/beads-ui 0.1.49 → 0.1.50
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.
|
@@ -122,4 +122,4 @@ Please report this to https://github.com/markedjs/marked.`,i){const s="<p>An err
|
|
|
122
122
|
prose-code:text-sm prose-code:font-mono
|
|
123
123
|
prose-headings:font-semibold
|
|
124
124
|
prose-a:no-underline hover:prose-a:underline`,style:{"--tw-prose-body":"var(--text-secondary)","--tw-prose-headings":"var(--text-primary)","--tw-prose-links":"#268bd2","--tw-prose-bold":"var(--text-primary)","--tw-prose-counters":"var(--text-tertiary)","--tw-prose-bullets":"var(--text-tertiary)","--tw-prose-hr":"var(--border-default)","--tw-prose-quotes":"var(--text-secondary)","--tw-prose-quote-borders":"var(--border-default)","--tw-prose-code":"var(--text-primary)","--tw-prose-pre-bg":"var(--bg-surface)","--tw-prose-pre-code":"var(--text-primary)","--tw-prose-th-borders":"var(--border-default)","--tw-prose-td-borders":"var(--border-subtle)"},dangerouslySetInnerHTML:{__html:l}}),s&&_.jsx(YS,{issue:s.issue,fragment:s.fragment,style:{left:s.x,top:s.y}})]})}function Zs({label:i,value:l,placeholder:r,onSave:s}){const[u,f]=Y.useState(!1),[d,p]=Y.useState(l),[h,m]=Y.useState("edit"),[v,b]=Y.useState(!1);Y.useEffect(()=>{u||p(l)},[l,u]);const S=Y.useCallback(async()=>{b(!0);try{await s(d),f(!1),m("edit")}finally{b(!1)}},[d,s]),T=Y.useCallback(()=>{p(l),f(!1),m("edit")},[l]),O=Y.useCallback(U=>{U.key==="s"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),S()),U.key==="Escape"&&(U.preventDefault(),T())},[S,T]);return u?_.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--accent)",boxShadow:"var(--shadow-card)"},onKeyDown:O,children:[_.jsxs("div",{className:"flex items-center justify-between mb-2",children:[_.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),_.jsxs("div",{className:"flex overflow-hidden text-xs rounded-md",style:{border:"1px solid var(--border-default)"},children:[_.jsx("button",{onClick:()=>m("edit"),className:"px-2.5 py-1 font-medium",style:{background:h==="edit"?"var(--bg-hover)":"var(--bg-elevated)",color:h==="edit"?"var(--text-primary)":"var(--text-secondary)"},children:"Edit"}),_.jsx("button",{onClick:()=>m("preview"),className:"px-2.5 py-1 font-medium",style:{background:h==="preview"?"var(--bg-hover)":"var(--bg-elevated)",color:h==="preview"?"var(--text-primary)":"var(--text-secondary)",borderLeft:"1px solid var(--border-default)"},children:"Preview"})]})]}),h==="edit"?_.jsx("textarea",{value:d,onChange:U=>p(U.target.value),rows:10,className:"w-full p-3 text-sm font-mono rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:U=>{U.currentTarget.style.borderColor="var(--accent)"},onBlur:U=>{U.currentTarget.style.borderColor="var(--border-default)"},autoFocus:!0}):_.jsx("div",{className:"p-3 rounded-md min-h-[160px]",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)"},children:_.jsx(mf,{content:d})}),_.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[_.jsx("span",{className:"text-xs mr-auto",style:{color:"var(--text-tertiary)"},children:"Cmd+S to save, Esc to cancel"}),_.jsx("button",{onClick:T,className:"px-3 py-1.5 text-sm rounded-md transition-colors",style:{color:"var(--text-secondary)",border:"1px solid var(--border-default)",background:"var(--bg-elevated)"},onMouseEnter:U=>{U.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:U=>{U.currentTarget.style.background="var(--bg-elevated)"},children:"Cancel"}),_.jsx("button",{onClick:S,disabled:v,className:"px-3 py-1.5 text-sm rounded-md font-medium disabled:opacity-50 transition-colors",style:{background:"var(--accent)",color:"white"},onMouseEnter:U=>{U.currentTarget.style.opacity="0.9"},onMouseLeave:U=>{U.currentTarget.style.opacity="1"},children:v?"Saving...":"Save"})]})]}):_.jsxs("div",{id:i.toLowerCase().replace(/\s+/g,"-"),className:"group rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[_.jsxs("div",{className:"flex items-center justify-between mb-2",children:[_.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),_.jsx("button",{onClick:()=>f(!0),className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"var(--text-tertiary)"},onMouseEnter:U=>{U.currentTarget.style.color="var(--accent)"},onMouseLeave:U=>{U.currentTarget.style.color="var(--text-tertiary)"},title:`Edit ${i}`,children:_.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:_.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),l?_.jsx(mf,{content:l}):_.jsx("p",{className:"text-sm italic",style:{color:"var(--text-tertiary)"},children:r||`Add ${i.toLowerCase()}...`})]})}function XS(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}function QS(i){const l=[],r=[{label:"Description",id:"description",content:i.description},{label:"Acceptance Criteria",id:"acceptance-criteria",content:i.acceptance},{label:"Notes",id:"notes",content:i.notes},{label:"Design",id:"design",content:i.design}];for(const s of r){if(!s.content)continue;l.push({id:s.id,label:s.label,depth:0});const u=s.content.split(`
|
|
125
|
-
`);for(const f of u){const d=f.match(/^(#{1,6})\s+(.+)/);if(!d)continue;const p=d[1].length,h=d[2].replace(/[#*`\[\]]/g,"").trim();l.push({id:XS(h),label:h,depth:p})}}return l}function ZS({issue:i,scrollContainer:l}){const r=QS(i),[s,u]=Y.useState(""),f=Y.useRef(!1);Y.useEffect(()=>{if(!l||r.length===0)return;const h=r.map(v=>v.id).map(v=>document.getElementById(v)).filter(Boolean);if(h.length===0)return;const m=new IntersectionObserver(v=>{if(!f.current){for(const b of v)if(b.isIntersecting){u(b.target.id);break}}},{root:l,rootMargin:"-10% 0px -80% 0px",threshold:0});for(const v of h)m.observe(v);return()=>m.disconnect()},[l,r]);const d=Y.useCallback(p=>{const h=document.getElementById(p);h&&(f.current=!0,u(p),h.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{f.current=!1},800))},[]);return r.length<2?null:_.jsxs("div",{className:"sticky top-6",style:{width:"180px",maxHeight:"calc(100vh - 48px)",overflowY:"auto"},children:[_.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"On this page"}),_.jsx("nav",{className:"space-y-0.5",children:r.map(p=>_.jsx("button",{onClick:()=>d(p.id),className:"block w-full text-left text-xs truncate rounded px-1.5 py-1 transition-colors bg-transparent border-none cursor-pointer",style:{paddingLeft:`${6+p.depth*10}px`,color:s===p.id?"var(--accent)":"var(--text-tertiary)",fontWeight:p.depth===0?600:400,font:"inherit",fontSize:"12px"},onMouseEnter:h=>{s!==p.id&&(h.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:h=>{s!==p.id&&(h.currentTarget.style.color="var(--text-tertiary)")},title:p.label,children:p.label},p.id))})]})}function Rn({label:i,children:l}){return _.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--border-subtle)"},children:[_.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-1.5",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),l]})}function KS({issue:i,onUpdate:l}){const r=i.parent_id||i.parent,s=i.parent_title||i.parent_title,u=i.parent_status||i.parent_status,f=new Date(i.updated_at).toLocaleDateString();return _.jsxs("aside",{className:"shrink-0 p-4 space-y-3 overflow-y-auto",style:{width:"280px",borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-base)"},children:[_.jsx(Rn,{label:"Status",children:_.jsxs("select",{value:i.status,onChange:d=>l.updateStatus(i.id,d.target.value),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[_.jsx("option",{value:"open",children:"Open"}),_.jsx("option",{value:"in_progress",children:"In Progress"}),_.jsx("option",{value:"closed",children:"Closed"})]})}),i.status==="closed"&&i.close_reason&&_.jsx(Rn,{label:"Close Reason",children:_.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:i.close_reason})}),_.jsx(Rn,{label:"Priority",children:_.jsx("select",{value:i.priority,onChange:d=>l.updatePriority(i.id,Number(d.target.value)),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[0,1,2,3,4].map(d=>_.jsxs("option",{value:d,children:["P",d]},d))})}),_.jsx(Rn,{label:"Type",children:_.jsx(bf,{type:i.issue_type})}),_.jsx(Rn,{label:"Assignee",children:i.assignee?_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("div",{className:"flex items-center justify-center rounded-full text-[10px] font-bold shrink-0",style:{width:"24px",height:"24px",backgroundColor:go(i.assignee),color:"var(--text-inverse)"},children:mo(i.assignee)}),_.jsx("span",{className:"text-sm",style:{color:"var(--text-primary)"},children:i.assignee})]}):_.jsx("span",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Unassigned"})}),_.jsx(Rn,{label:"Updated",children:_.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:f})}),i.labels&&i.labels.length>0&&_.jsx(Rn,{label:"Labels",children:_.jsx("div",{className:"flex flex-wrap gap-1",children:i.labels.map(d=>_.jsx("span",{className:"px-2 py-0.5 text-xs rounded",style:{background:"var(--bg-hover)",color:"var(--text-secondary)"},children:d},d))})}),r&&_.jsx(Rn,{label:"Parent",children:_.jsxs("a",{href:`/detail/${r}`,className:"block rounded px-1 py-1 -mx-1 transition-colors",style:{color:"var(--text-primary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[_.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[u&&_.jsx(fr,{status:u}),_.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-tertiary)"},children:r})]}),s&&_.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:s})]})}),(()=>{const d=(i.dependencies||[]).filter(p=>p.type==="blocks"&&p.issue_id===i.id);return d.length===0?null:_.jsx(Rn,{label:"Blocked By",children:_.jsx("div",{className:"space-y-1",children:d.map(p=>_.jsx("a",{href:`/detail/${p.depends_on_id}`,className:"block text-xs font-mono px-1 py-0.5 transition-colors",style:{color:"var(--accent)"},onMouseEnter:h=>{h.currentTarget.style.textDecoration="underline"},onMouseLeave:h=>{h.currentTarget.style.textDecoration="none"},children:p.depends_on_id},p.depends_on_id))})})})(),i.dependents&&i.dependents.length>0&&_.jsx(Rn,{label:"Children / Dependents",children:_.jsx("div",{className:"space-y-1",children:i.dependents.map(d=>_.jsxs("a",{href:`/detail/${d.id}`,className:"block text-xs rounded px-1 py-1.5 -mx-1 transition-colors",onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[_.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[_.jsx(fr,{status:d.status}),_.jsx("span",{className:"font-mono",style:{color:"var(--text-tertiary)"},children:d.id})]}),d.title&&_.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:d.title})]},d.id))})})]})}function $S({comment:i}){const l=i.author||"anonymous",r=mo(l),s=go(l),u=new Date(i.created_at*1e3).toLocaleString();return _.jsxs("div",{className:"flex gap-3",children:[_.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-xs font-semibold text-white",style:{background:s},title:l,children:r}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsxs("div",{className:"flex items-baseline gap-2",children:[_.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:l}),_.jsx("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:u})]}),_.jsx("div",{className:"mt-0.5",children:_.jsx(mf,{content:i.text})})]})]})}function JS({issueId:i,comments:l}){const r=kg(),[s,u]=Y.useState(""),f=async()=>{s.trim()&&(await r.addComment(i,s.trim()),u(""))};return _.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[_.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Comments ",l.length>0&&_.jsxs("span",{style:{color:"var(--text-secondary)"},children:["(",l.length,")"]})]}),l.length>0&&_.jsx("div",{className:"flex flex-col gap-4 mb-4",children:l.map(d=>_.jsx($S,{comment:d},d.id))}),_.jsx("div",{className:"flex gap-2",children:_.jsx("textarea",{value:s,onChange:d=>u(d.target.value),placeholder:"Add a comment... (Ctrl+Enter to submit)",rows:3,className:"flex-1 p-2 text-sm rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:d=>{d.currentTarget.style.borderColor="var(--accent)"},onBlur:d=>{d.currentTarget.style.borderColor="var(--border-default)"},onKeyDown:d=>{d.key==="Enter"&&(d.ctrlKey||d.metaKey)&&f()}})}),_.jsx("button",{onClick:f,className:"mt-2 px-3 py-1.5 text-sm rounded-md font-medium transition-colors",style:{background:"var(--bg-hover)",color:"var(--text-primary)",border:"1px solid var(--border-default)"},onMouseEnter:d=>{d.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:d=>{d.currentTarget.style.borderColor="var(--border-default)"},children:"Add Comment"})]})}function WS({issueId:i}){const{issues:l,loading:r}=Qa("issue-detail",{id:i}),s=kg(),u=l[0],f=Y.useRef(null);return Y.useEffect(()=>{if(!u)return;const d=window.location.hash.slice(1);if(!d)return;const p=setTimeout(()=>{const h=document.getElementById(d);h&&h.scrollIntoView({behavior:"smooth",block:"start"})},500);return()=>clearTimeout(p)},[u]),r?_.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Loading..."}):u?_.jsxs("div",{className:"flex h-full",style:{background:"var(--bg-base)"},children:[_.jsx("div",{className:"shrink-0 p-6 pr-0 hidden xl:block",children:_.jsx(ZS,{issue:u,scrollContainer:f.current})}),_.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto p-6 space-y-5",children:[_.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--text-tertiary)"},children:[_.jsx("button",{onClick:()=>window.history.length>1?window.history.back():zl("/board"),className:"flex items-center gap-1 transition-colors bg-transparent border-none cursor-pointer p-0",style:{color:"var(--text-tertiary)",font:"inherit"},onMouseEnter:d=>{d.currentTarget.style.color="var(--accent)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--text-tertiary)"},children:"← Back"}),_.jsx("span",{children:"/"}),_.jsx(yf,{id:u.id})]}),_.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--text-primary)"},children:u.title}),_.jsx(Zs,{label:"Description",value:u.description||"",onSave:d=>s.editText({id:u.id,field:"description",value:d})}),_.jsx(Zs,{label:"Acceptance Criteria",value:u.acceptance||"",placeholder:"Add acceptance criteria...",onSave:d=>s.editText({id:u.id,field:"acceptance",value:d})}),_.jsx(Zs,{label:"Notes",value:u.notes||"",placeholder:"Add notes...",onSave:d=>s.editText({id:u.id,field:"notes",value:d})}),_.jsx(Zs,{label:"Design",value:u.design||"",placeholder:"Add design notes...",onSave:d=>s.editText({id:u.id,field:"design",value:d})}),u.issue_type==="epic"&&u.dependents&&u.dependents.length>0&&_.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[_.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Children (",u.closed_children??0," / ",u.total_children??u.dependents.length,")"]}),_.jsx("div",{className:"space-y-0.5",children:u.dependents.map(d=>_.jsxs("a",{href:`/detail/${d.id}`,className:"flex items-center gap-2.5 px-2 py-2 rounded-md transition-colors",style:{opacity:d.status==="closed"?.6:1},onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[_.jsx(fr,{status:d.status}),_.jsx("span",{className:"text-xs font-mono",style:{color:"var(--text-tertiary)"},children:d.id}),_.jsx("span",{className:"text-sm truncate",style:{color:"var(--text-primary)"},children:d.title})]},d.id))})]}),_.jsx(JS,{issueId:u.id,comments:u.comments??[]})]}),_.jsx(KS,{issue:u,onUpdate:s})]}):_.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Issue not found"})}function FS(i){const[l,r]=Y.useState(""),s=Y.useMemo(()=>{if(!l.trim())return i;const u=l.toLowerCase();return i.filter(f=>f.id.toLowerCase().includes(u)||f.title.toLowerCase().includes(u)||(f.description||"").toLowerCase().includes(u))},[i,l]);return{query:l,setQuery:r,results:s}}function eE(){const[i,l]=Y.useState(!1),{issues:r}=Qa("all-issues"),{query:s,setQuery:u,results:f}=FS(r),[d,p]=Y.useState(0),h=Y.useRef(null);Y.useEffect(()=>{const b=S=>{var O;const T=(O=S.target)==null?void 0:O.tagName;S.key==="k"&&(S.metaKey||S.ctrlKey)&&T!=="TEXTAREA"&&(S.preventDefault(),l(!0)),S.key==="Escape"&&i&&(S.preventDefault(),l(!1),u(""),p(0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[i,u]),Y.useEffect(()=>{i&&setTimeout(()=>{var b;return(b=h.current)==null?void 0:b.focus()},0)},[i]),Y.useEffect(()=>p(0),[f]);const m=b=>{const S=f.slice(0,20);b.key==="ArrowDown"&&(b.preventDefault(),p(T=>Math.min(T+1,S.length-1))),b.key==="ArrowUp"&&(b.preventDefault(),p(T=>Math.max(T-1,0))),b.key==="Enter"&&S[d]&&(zl(`/detail/${S[d].id}`),l(!1),u(""))};if(!i)return null;const v=f.slice(0,20);return _.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>{l(!1),u("")},children:[_.jsx("div",{className:"absolute inset-0",style:{background:"var(--bg-overlay)"}}),_.jsxs("div",{className:"relative w-full max-w-lg overflow-hidden",style:{background:"var(--bg-elevated)",borderRadius:"var(--radius-lg)",border:"1px solid var(--border-subtle)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.15)"},onClick:b=>b.stopPropagation(),children:[_.jsx("input",{ref:h,type:"text",value:s,onChange:b=>u(b.target.value),onKeyDown:m,placeholder:"Search issues...",className:"w-full px-4 py-3 text-sm outline-none",style:{borderBottom:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-primary)"}}),_.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[v.length===0&&s&&_.jsx("div",{className:"px-4 py-6 text-sm text-center",style:{color:"var(--text-tertiary)"},children:"No results"}),v.map((b,S)=>_.jsxs("button",{onClick:()=>{zl(`/detail/${b.id}`),l(!1),u("")},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors",style:{background:S===d?"var(--bg-hover)":"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:T=>{T.currentTarget.style.background=S===d?"var(--bg-hover)":"transparent"},children:[_.jsx("span",{className:"font-mono text-xs w-28 shrink-0",style:{color:"var(--text-tertiary)"},children:b.id}),_.jsx(fr,{status:b.status}),_.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:b.title}),_.jsx(vf,{priority:b.priority})]},b.id))]}),_.jsx("div",{className:"px-4 py-2 text-xs",style:{color:"var(--text-tertiary)",borderTop:"1px solid var(--border-subtle)"},children:"↑↓ navigate · ↵ open · esc close"})]})]})}function tE(){const{loading:i,authEnabled:l,token:r}=_f();return i?_.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--bg-base)"},children:_.jsx("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading..."})}):l&&!r?_.jsx(r0,{}):_.jsxs(t0,{children:[_.jsx(eE,{}),_.jsx(i0,{children:s=>{if(s.startsWith("/detail/")){const u=s.replace("/detail/","");return _.jsx(WS,{issueId:u},u)}return s.startsWith("/list")?_.jsx(A0,{}):s.startsWith("/board")||s==="/"?_.jsx(g0,{}):_.jsx("div",{className:"p-6 text-stone-400",children:"View not implemented yet"})}})]})}function nE(){return _.jsx(Wv,{children:_.jsx(tE,{})})}Jv.createRoot(document.getElementById("root")).render(_.jsx(Y.StrictMode,{children:_.jsx(nE,{})}));
|
|
125
|
+
`);for(const f of u){const d=f.match(/^(#{1,6})\s+(.+)/);if(!d)continue;const p=d[1].length,h=d[2].replace(/[#*`\[\]]/g,"").trim();l.push({id:XS(h),label:h,depth:p})}}return l}function ZS({issue:i,scrollContainer:l}){const r=QS(i),[s,u]=Y.useState(""),f=Y.useRef(!1);Y.useEffect(()=>{if(!l||r.length===0)return;const h=r.map(v=>v.id).map(v=>document.getElementById(v)).filter(Boolean);if(h.length===0)return;const m=new IntersectionObserver(v=>{if(!f.current){for(const b of v)if(b.isIntersecting){u(b.target.id);break}}},{root:l,rootMargin:"-10% 0px -80% 0px",threshold:0});for(const v of h)m.observe(v);return()=>m.disconnect()},[l,r]);const d=Y.useCallback(p=>{const h=document.getElementById(p);h&&(f.current=!0,u(p),h.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{f.current=!1},800))},[]);return r.length<2?null:_.jsxs("div",{className:"sticky top-6",style:{width:"180px",maxHeight:"calc(100vh - 48px)",overflowY:"auto"},children:[_.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"On this page"}),_.jsx("nav",{className:"space-y-0.5",children:r.map(p=>_.jsx("button",{onClick:()=>d(p.id),className:"block w-full text-left text-xs truncate rounded px-1.5 py-1 transition-colors bg-transparent border-none cursor-pointer",style:{paddingLeft:`${6+p.depth*10}px`,color:s===p.id?"var(--accent)":"var(--text-tertiary)",fontWeight:p.depth===0?600:400,font:"inherit",fontSize:"12px"},onMouseEnter:h=>{s!==p.id&&(h.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:h=>{s!==p.id&&(h.currentTarget.style.color="var(--text-tertiary)")},title:p.label,children:p.label},p.id))})]})}function Rn({label:i,children:l}){return _.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--border-subtle)"},children:[_.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-1.5",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),l]})}function KS({issue:i,onUpdate:l}){const r=i.parent_id||i.parent,s=i.parent_title||i.parent_title,u=i.parent_status||i.parent_status,f=new Date(i.updated_at).toLocaleDateString();return _.jsxs("aside",{className:"shrink-0 p-4 space-y-3 overflow-y-auto",style:{width:"280px",borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-base)"},children:[_.jsx(Rn,{label:"Status",children:_.jsxs("select",{value:i.status,onChange:d=>l.updateStatus(i.id,d.target.value),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[_.jsx("option",{value:"open",children:"Open"}),_.jsx("option",{value:"in_progress",children:"In Progress"}),_.jsx("option",{value:"closed",children:"Closed"})]})}),i.status==="closed"&&i.close_reason&&_.jsx(Rn,{label:"Close Reason",children:_.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:i.close_reason})}),_.jsx(Rn,{label:"Priority",children:_.jsx("select",{value:i.priority,onChange:d=>l.updatePriority(i.id,Number(d.target.value)),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[0,1,2,3,4].map(d=>_.jsxs("option",{value:d,children:["P",d]},d))})}),_.jsx(Rn,{label:"Type",children:_.jsx(bf,{type:i.issue_type})}),_.jsx(Rn,{label:"Assignee",children:i.assignee?_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("div",{className:"flex items-center justify-center rounded-full text-[10px] font-bold shrink-0",style:{width:"24px",height:"24px",backgroundColor:go(i.assignee),color:"var(--text-inverse)"},children:mo(i.assignee)}),_.jsx("span",{className:"text-sm",style:{color:"var(--text-primary)"},children:i.assignee})]}):_.jsx("span",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Unassigned"})}),_.jsx(Rn,{label:"Updated",children:_.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:f})}),i.labels&&i.labels.length>0&&_.jsx(Rn,{label:"Labels",children:_.jsx("div",{className:"flex flex-wrap gap-1",children:i.labels.map(d=>_.jsx("span",{className:"px-2 py-0.5 text-xs rounded",style:{background:"var(--bg-hover)",color:"var(--text-secondary)"},children:d},d))})}),r&&_.jsx(Rn,{label:"Parent",children:_.jsxs("a",{href:`/detail/${r}`,className:"block rounded px-1 py-1 -mx-1 transition-colors",style:{color:"var(--text-primary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[_.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[u&&_.jsx(fr,{status:u}),_.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-tertiary)"},children:r})]}),s&&_.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:s})]})}),(()=>{const d=(i.dependencies||[]).filter(p=>p.type==="blocks"&&p.issue_id===i.id);return d.length===0?null:_.jsx(Rn,{label:"Blocked By",children:_.jsx("div",{className:"space-y-1",children:d.map(p=>_.jsx("a",{href:`/detail/${p.depends_on_id}`,className:"block text-xs font-mono px-1 py-0.5 transition-colors",style:{color:"var(--accent)"},onMouseEnter:h=>{h.currentTarget.style.textDecoration="underline"},onMouseLeave:h=>{h.currentTarget.style.textDecoration="none"},children:p.depends_on_id},p.depends_on_id))})})})(),i.dependents&&i.dependents.length>0&&_.jsx(Rn,{label:"Children / Dependents",children:_.jsx("div",{className:"space-y-1",children:i.dependents.map(d=>_.jsxs("a",{href:`/detail/${d.id}`,className:"block text-xs rounded px-1 py-1.5 -mx-1 transition-colors",onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[_.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[_.jsx(fr,{status:d.status}),_.jsx("span",{className:"font-mono",style:{color:"var(--text-tertiary)"},children:d.id})]}),d.title&&_.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:d.title})]},d.id))})})]})}function $S({comment:i}){const l=i.author||"anonymous",r=mo(l),s=go(l),u=new Date(i.created_at).toLocaleString();return _.jsxs("div",{className:"flex gap-3",children:[_.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-xs font-semibold text-white",style:{background:s},title:l,children:r}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsxs("div",{className:"flex items-baseline gap-2",children:[_.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:l}),_.jsx("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:u})]}),_.jsx("div",{className:"mt-0.5",children:_.jsx(mf,{content:i.text})})]})]})}function JS({issueId:i,comments:l}){const r=kg(),[s,u]=Y.useState(""),f=async()=>{s.trim()&&(await r.addComment(i,s.trim()),u(""))};return _.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[_.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Comments ",l.length>0&&_.jsxs("span",{style:{color:"var(--text-secondary)"},children:["(",l.length,")"]})]}),l.length>0&&_.jsx("div",{className:"flex flex-col gap-4 mb-4",children:l.map(d=>_.jsx($S,{comment:d},d.id))}),_.jsx("div",{className:"flex gap-2",children:_.jsx("textarea",{value:s,onChange:d=>u(d.target.value),placeholder:"Add a comment... (Ctrl+Enter to submit)",rows:3,className:"flex-1 p-2 text-sm rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:d=>{d.currentTarget.style.borderColor="var(--accent)"},onBlur:d=>{d.currentTarget.style.borderColor="var(--border-default)"},onKeyDown:d=>{d.key==="Enter"&&(d.ctrlKey||d.metaKey)&&f()}})}),_.jsx("button",{onClick:f,className:"mt-2 px-3 py-1.5 text-sm rounded-md font-medium transition-colors",style:{background:"var(--bg-hover)",color:"var(--text-primary)",border:"1px solid var(--border-default)"},onMouseEnter:d=>{d.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:d=>{d.currentTarget.style.borderColor="var(--border-default)"},children:"Add Comment"})]})}function WS({issueId:i}){const{issues:l,loading:r}=Qa("issue-detail",{id:i}),s=kg(),u=l[0],f=Y.useRef(null);return Y.useEffect(()=>{if(!u)return;const d=window.location.hash.slice(1);if(!d)return;const p=setTimeout(()=>{const h=document.getElementById(d);h&&h.scrollIntoView({behavior:"smooth",block:"start"})},500);return()=>clearTimeout(p)},[u]),r?_.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Loading..."}):u?_.jsxs("div",{className:"flex h-full",style:{background:"var(--bg-base)"},children:[_.jsx("div",{className:"shrink-0 p-6 pr-0 hidden xl:block",children:_.jsx(ZS,{issue:u,scrollContainer:f.current})}),_.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto p-6 space-y-5",children:[_.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--text-tertiary)"},children:[_.jsx("button",{onClick:()=>window.history.length>1?window.history.back():zl("/board"),className:"flex items-center gap-1 transition-colors bg-transparent border-none cursor-pointer p-0",style:{color:"var(--text-tertiary)",font:"inherit"},onMouseEnter:d=>{d.currentTarget.style.color="var(--accent)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--text-tertiary)"},children:"← Back"}),_.jsx("span",{children:"/"}),_.jsx(yf,{id:u.id})]}),_.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--text-primary)"},children:u.title}),_.jsx(Zs,{label:"Description",value:u.description||"",onSave:d=>s.editText({id:u.id,field:"description",value:d})}),_.jsx(Zs,{label:"Acceptance Criteria",value:u.acceptance||"",placeholder:"Add acceptance criteria...",onSave:d=>s.editText({id:u.id,field:"acceptance",value:d})}),_.jsx(Zs,{label:"Notes",value:u.notes||"",placeholder:"Add notes...",onSave:d=>s.editText({id:u.id,field:"notes",value:d})}),_.jsx(Zs,{label:"Design",value:u.design||"",placeholder:"Add design notes...",onSave:d=>s.editText({id:u.id,field:"design",value:d})}),u.issue_type==="epic"&&u.dependents&&u.dependents.length>0&&_.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[_.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Children (",u.closed_children??0," / ",u.total_children??u.dependents.length,")"]}),_.jsx("div",{className:"space-y-0.5",children:u.dependents.map(d=>_.jsxs("a",{href:`/detail/${d.id}`,className:"flex items-center gap-2.5 px-2 py-2 rounded-md transition-colors",style:{opacity:d.status==="closed"?.6:1},onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[_.jsx(fr,{status:d.status}),_.jsx("span",{className:"text-xs font-mono",style:{color:"var(--text-tertiary)"},children:d.id}),_.jsx("span",{className:"text-sm truncate",style:{color:"var(--text-primary)"},children:d.title})]},d.id))})]}),_.jsx(JS,{issueId:u.id,comments:u.comments??[]})]}),_.jsx(KS,{issue:u,onUpdate:s})]}):_.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Issue not found"})}function FS(i){const[l,r]=Y.useState(""),s=Y.useMemo(()=>{if(!l.trim())return i;const u=l.toLowerCase();return i.filter(f=>f.id.toLowerCase().includes(u)||f.title.toLowerCase().includes(u)||(f.description||"").toLowerCase().includes(u))},[i,l]);return{query:l,setQuery:r,results:s}}function eE(){const[i,l]=Y.useState(!1),{issues:r}=Qa("all-issues"),{query:s,setQuery:u,results:f}=FS(r),[d,p]=Y.useState(0),h=Y.useRef(null);Y.useEffect(()=>{const b=S=>{var O;const T=(O=S.target)==null?void 0:O.tagName;S.key==="k"&&(S.metaKey||S.ctrlKey)&&T!=="TEXTAREA"&&(S.preventDefault(),l(!0)),S.key==="Escape"&&i&&(S.preventDefault(),l(!1),u(""),p(0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[i,u]),Y.useEffect(()=>{i&&setTimeout(()=>{var b;return(b=h.current)==null?void 0:b.focus()},0)},[i]),Y.useEffect(()=>p(0),[f]);const m=b=>{const S=f.slice(0,20);b.key==="ArrowDown"&&(b.preventDefault(),p(T=>Math.min(T+1,S.length-1))),b.key==="ArrowUp"&&(b.preventDefault(),p(T=>Math.max(T-1,0))),b.key==="Enter"&&S[d]&&(zl(`/detail/${S[d].id}`),l(!1),u(""))};if(!i)return null;const v=f.slice(0,20);return _.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>{l(!1),u("")},children:[_.jsx("div",{className:"absolute inset-0",style:{background:"var(--bg-overlay)"}}),_.jsxs("div",{className:"relative w-full max-w-lg overflow-hidden",style:{background:"var(--bg-elevated)",borderRadius:"var(--radius-lg)",border:"1px solid var(--border-subtle)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.15)"},onClick:b=>b.stopPropagation(),children:[_.jsx("input",{ref:h,type:"text",value:s,onChange:b=>u(b.target.value),onKeyDown:m,placeholder:"Search issues...",className:"w-full px-4 py-3 text-sm outline-none",style:{borderBottom:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-primary)"}}),_.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[v.length===0&&s&&_.jsx("div",{className:"px-4 py-6 text-sm text-center",style:{color:"var(--text-tertiary)"},children:"No results"}),v.map((b,S)=>_.jsxs("button",{onClick:()=>{zl(`/detail/${b.id}`),l(!1),u("")},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors",style:{background:S===d?"var(--bg-hover)":"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:T=>{T.currentTarget.style.background=S===d?"var(--bg-hover)":"transparent"},children:[_.jsx("span",{className:"font-mono text-xs w-28 shrink-0",style:{color:"var(--text-tertiary)"},children:b.id}),_.jsx(fr,{status:b.status}),_.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:b.title}),_.jsx(vf,{priority:b.priority})]},b.id))]}),_.jsx("div",{className:"px-4 py-2 text-xs",style:{color:"var(--text-tertiary)",borderTop:"1px solid var(--border-subtle)"},children:"↑↓ navigate · ↵ open · esc close"})]})]})}function tE(){const{loading:i,authEnabled:l,token:r}=_f();return i?_.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--bg-base)"},children:_.jsx("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading..."})}):l&&!r?_.jsx(r0,{}):_.jsxs(t0,{children:[_.jsx(eE,{}),_.jsx(i0,{children:s=>{if(s.startsWith("/detail/")){const u=s.replace("/detail/","");return _.jsx(WS,{issueId:u},u)}return s.startsWith("/list")?_.jsx(A0,{}):s.startsWith("/board")||s==="/"?_.jsx(g0,{}):_.jsx("div",{className:"p-6 text-stone-400",children:"View not implemented yet"})}})]})}function nE(){return _.jsx(Wv,{children:_.jsx(tE,{})})}Jv.createRoot(document.getElementById("root")).render(_.jsx(Y.StrictMode,{children:_.jsx(nE,{})}));
|
package/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Beads UI</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DclShbpd.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-BuQ1xTdM.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="background: #FDFBF7; color: #1A1A1A;">
|