@flesler/cursor-canvas-web 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cursor-canvas.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),r=require("react/jsx-runtime"),I=require("@mantine/charts"),h=require("@mantine/core"),k=require("./host-tokens-Lz69pkRj.cjs");function ge(t,e){const n=`canvas:${t}`,[o,s]=x.useState(()=>{if(typeof localStorage>"u")return e;try{const c=localStorage.getItem(n);return c===null?e:JSON.parse(c)}catch{return e}}),a=x.useCallback(c=>{s(f=>{const u=typeof c=="function"?c(f):c;try{localStorage==null||localStorage.setItem(n,JSON.stringify(u))}catch{}return u})},[n]);return[o,a]}function ye(){return x.useCallback(t=>{},[])}function xe(t,e){return{...t,...e}}const T={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},te={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function y(){const e=h.useComputedColorScheme("light")==="dark"?"dark":"light";return k.resolveThemeForColorScheme(e)}const ne={verticalAlign:"bottom",align:"center"},re={legend:{justifyContent:"center"}};function G(){const e=y().chart.sequence;return(n,o)=>n?T[n]:e[o%e.length]}function oe(){const e=y().text.primary;return{textColor:e,barLabelColor:e}}function se(t,e){return t.map((n,o)=>{const s={category:n};for(const a of e)s[a.name]=a.data[o]??0;return s})}function ae(t,e){return t.map((n,o)=>({name:n.name,color:e(n.tone,o)}))}function ie(t,e){return n=>`${e??""}${n}${t??""}`}function me(t,e){if(t!=null&&t.length)return t.map(n=>({...e?{x:n.value}:{y:n.value},label:n.label,color:n.tone?T[n.tone]:T.neutral}))}const be=new Set(["log","symlog","pow","sqrt"]);function ve(t){const{scale:e}=t;return typeof e!="string"||!be.has(e)?t:{...t,type:t.type??"number",allowDataOverflow:t.allowDataOverflow??!0,allowDecimals:t.allowDecimals??!0,domain:t.domain??[1,"dataMax"]}}function le(t){const e=me(t.referenceLines,!!t.horizontal);let n;if(!t.stacked&&!t.normalized){const a=t.beginAtZero!==!1;n=[t.yMin??(a?0:"auto"),t.yMax??"auto"]}const o=t.valueAxis?ve(t.valueAxis):void 0;if(!n&&!o)return{referenceLines:e};const s={...n&&{domain:n},...o};return t.horizontal?{xAxisProps:s,referenceLines:e}:{yAxisProps:s,referenceLines:e}}function je(t,e,n){return t!==void 0?t:e.length===1&&n.length<=8}function Se(t,e,n){return e.length!==1||e[0].tone?t:t.map((o,s)=>({...o,color:n(void 0,s)}))}const Ce=96,ke=6.5;function Te(t,e){return t.length<=e?t:`${t.slice(0,Math.max(0,e-1))}…`}function we(t,e){var c;const n=typeof e.x=="number"?e.x:Number(e.x)||0,o=typeof e.y=="number"?e.y:Number(e.y)||0,s=String(((c=e.payload)==null?void 0:c.value)??""),a=Te(s,t);return r.jsx("g",{transform:`translate(${n},${o})`,children:r.jsxs("text",{x:-10,y:0,dy:4,textAnchor:"end",fill:"currentColor",fontSize:12,children:[r.jsx("title",{children:s}),a]})})}function ce(t){return{fontWeight:700,fill:t}}function Le(t){return{...ce(t),position:"right"}}function Pe(t=Ce,e=!1){const n=Math.floor(t/ke);return{yAxisProps:{tick:o=>we(n,o),width:t},barChartProps:{margin:{right:e?48:32}},gridAxis:"y"}}function Ae(){return{barChartProps:{margin:{top:22}}}}function Me({categories:t,series:e,height:n=240,stacked:o,horizontal:s,normalized:a,valueSuffix:c,valuePrefix:f,showValues:u,beginAtZero:l,yMin:d,yMax:m,referenceLines:v,style:p,extra:j}){var A;const w=G(),L=oe(),P=Se(se(t,e),e,w),B=a?"percent":o?"stacked":"default",E=le({beginAtZero:l,yMin:d,yMax:m,referenceLines:v,horizontal:s,stacked:o,normalized:a,valueAxis:j==null?void 0:j.valueAxis}),S=!o&&!a&&je(u,e,t);return r.jsx(I.BarChart,{h:n,data:P,dataKey:"category",series:ae(e,w),type:B,orientation:s?"vertical":"horizontal",withLegend:e.length>1,legendProps:ne,valueFormatter:ie(c,f),withBarValueLabel:S,...S?{valueLabelProps:s?Le(L.barLabelColor):ce(L.barLabelColor)}:{},...s?Pe((A=j==null?void 0:j.categoryAxis)==null?void 0:A.width,S):S?Ae():{},styles:{...re,legendItemName:{color:L.textColor}},...E,style:p})}function Be({categories:t,series:e,height:n=240,fill:o,valueSuffix:s,valuePrefix:a,showValues:c,showHoverGuide:f=!0,beginAtZero:u,yMin:l,yMax:d,referenceLines:m,style:v,extra:p,smooth:j}){const w=(p==null?void 0:p.smooth)??j,L=G(),P=oe(),B=se(t,e),E=ae(e,L),S=!!(o&&(p!=null&&p.stacked)),A=le({beginAtZero:u,yMin:l,yMax:d,referenceLines:m,horizontal:!1,stacked:S,valueAxis:p==null?void 0:p.valueAxis}),M={h:n,data:B,dataKey:"category",series:E,curveType:w?"monotone":"linear",withLegend:e.length>1,legendProps:ne,valueFormatter:ie(s,a),withPointLabels:c??t.length<=20,tooltipProps:f?void 0:{cursor:!1},styles:{...re,legendItemName:{color:P.textColor}},...A,style:v};return o?r.jsx(I.AreaChart,{...M,type:S?"stacked":"default"}):r.jsx(I.LineChart,{...M})}const De=x.lazy(()=>Promise.resolve().then(()=>require("./pie-donut-DNbA0GeH.cjs")).then(t=>({default:t.PieDonutChart}))),Ee=180,Ie=540;function He(t,e){if(e<=0)return"0%";const n=t/e*100;return n<10&&Math.abs(n-Math.round(n))>.05?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function Re(t){return t.map(e=>({dataKey:e.name,value:e.name,color:e.color,type:"circle"}))}function Fe(t,e){return t.map(n=>({name:n.name,color:n.color,label:`${n.name} ${He(n.value,e)}`}))}function Ne({data:t,size:e=200,donut:n,style:o}){const[s,a]=x.useState(null),c=y(),f=G(),u=t.map((p,j)=>({name:p.label,value:p.value,color:f(p.tone,j)})),l=u.reduce((p,j)=>p+j.value,0),d={startAngle:Ee,endAngle:Ie},m=p=>({opacity:s===null||s===p?1:.35}),v=n?r.jsx(x.Suspense,{fallback:null,children:r.jsx(De,{data:u,size:e,highlighted:s})}):r.jsx(I.PieChart,{data:u,size:e,withTooltip:!0,withLabelsLine:!1,cellProps:p=>m(p.name),...d});return r.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",...o},children:[r.jsx("div",{style:{width:"100%",height:e,minHeight:e,display:"flex",alignItems:"center",justifyContent:"center"},children:v}),r.jsx(I.ChartLegend,{payload:Re(u),series:Fe(u,l),legendPosition:"bottom",centered:!0,onHighlight:a,mt:"sm",w:"100%",styles:{legend:{justifyContent:"center",gap:12,color:c.text.primary},legendItemName:{color:c.text.primary}}})]})}function _e(t){const{nodes:e,edges:n,direction:o="vertical",nodeWidth:s=160,nodeHeight:a=40,rankGap:c=64,nodeGap:f=48,padding:u=24}=t,l=e.map(i=>i.id),d=new Set(l),m=new Map;for(const i of l)m.set(i,[]);for(const i of n)d.has(i.from)&&d.has(i.to)&&m.get(i.from).push(i.to);const v=0,p=1,j=2,w=new Map(l.map(i=>[i,v])),L=new Set,P=(i,g)=>`${i}\0${g}`,B=i=>{w.set(i,p);for(const g of m.get(i)??[]){const b=w.get(g);b===p?L.add(P(i,g)):b===v&&B(g)}w.set(i,j)};for(const i of l)w.get(i)===v&&B(i);const E=n.filter(i=>d.has(i.from)&&d.has(i.to)&&!L.has(P(i.from,i.to))),S=new Map(l.map(i=>[i,0])),A=new Map(l.map(i=>[i,[]]));for(const i of E)A.get(i.from).push(i.to),S.set(i.to,(S.get(i.to)??0)+1);const M=new Map(l.map(i=>[i,0])),N=l.filter(i=>(S.get(i)??0)===0);for(;N.length>0;){const i=N.shift(),g=M.get(i);for(const b of A.get(i))M.set(b,Math.max(M.get(b),g+1)),S.set(b,S.get(b)-1),S.get(b)===0&&N.push(b)}const D=new Map;for(const i of l){const g=M.get(i);D.has(g)||D.set(g,[]),D.get(g).push(i)}const H=[...D.keys()].sort((i,g)=>i-g),C=o==="vertical",$=i=>i*(C?s:a)+Math.max(0,i-1)*f,q=Math.max(0,...H.map(i=>$(D.get(i).length))),R=new Map,V=[];H.forEach((i,g)=>{const b=D.get(i),_=$(b.length),z=u+(q-_)/2,F=u+g*((C?a:s)+c);b.forEach((U,Z)=>{const J=z+Z*((C?s:a)+f),he=C?J:F,pe=C?F:J;R.set(U,{id:U,x:he,y:pe,rank:i,order:Z})}),V.push({rank:i,x:C?z:F,y:C?F:z,width:C?_:s,height:C?a:_,nodeIds:b})});const K=(i,g)=>i?C?{x:i.x+s/2,y:g==="source"?i.y+a:i.y}:{x:g==="source"?i.x+s:i.x,y:i.y+a/2}:{x:0,y:0},fe=n.filter(i=>d.has(i.from)&&d.has(i.to)).map(i=>{const g=K(R.get(i.from),"source"),b=K(R.get(i.to),"target");return{from:i.from,to:i.to,sourceX:g.x,sourceY:g.y,targetX:b.x,targetY:b.y,isBackEdge:L.has(P(i.from,i.to))}}),X=u*2+H.length*(C?a:s)+Math.max(0,H.length-1)*c,Y=u*2+q;return{nodes:[...R.values()],edges:fe,ranks:V,direction:o,width:C?Y:X,height:C?X:Y}}function ze({additions:t=0,deletions:e=0,style:n}){return t===0&&e===0?null:r.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...n},children:[t>0&&r.jsxs("span",{style:{color:T.added},children:["+",t]}),e>0&&r.jsxs("span",{style:{color:T.deleted},children:["-",e]})]})}const Ge={added:"+",removed:"-",unchanged:" "};function Oe({lines:t,showLineNumbers:e=!0,coloredLineNumbers:n=!0,showAccentStrip:o=!0,style:s}){const a=y(),c=l=>l==="added"?a.diff.insertedLine:l==="removed"?a.diff.removedLine:"transparent",f=l=>l==="added"?a.diff.stripAdded:l==="removed"?a.diff.stripRemoved:"transparent",u=l=>n&&l==="added"?T.added:n&&l==="removed"?T.deleted:a.text.tertiary;return r.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:a.text.primary,overflowX:"auto",...s},children:t.map((l,d)=>r.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:c(l.type),borderLeft:o?`3px solid ${f(l.type)}`:void 0},children:[e&&r.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:u(l.type)},children:l.lineNumber??""}),r.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:u(l.type)},children:Ge[l.type]}),r.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:l.content})]},d))})}function We({status:t}){const e=y(),n=t==="completed"?T.success:t==="in_progress"?e.accent.primary:t==="cancelled"?T.danger:e.text.tertiary;return r.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[r.jsx("circle",{cx:7,cy:7,r:6,stroke:n,strokeWidth:1.4}),t==="completed"&&r.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),t==="in_progress"&&r.jsx("circle",{cx:7,cy:7,r:3,fill:n}),t==="cancelled"&&r.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round"})]})}function ue({todos:t,dimmedTodoIds:e,onTodoClick:n,style:o}){const s=y();return t.length===0?null:r.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:t.map(a=>{const c=e==null?void 0:e.has(a.id);return r.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(a),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:n?"pointer":"default",color:s.text.primary,fontSize:14,lineHeight:"20px",opacity:c?.45:1},children:[r.jsx(We,{status:a.status}),r.jsx("span",{style:{textDecoration:a.status==="cancelled"?"line-through":void 0,color:a.status==="cancelled"?s.text.tertiary:void 0},children:a.content})]},a.id)})})}function $e({todos:t,dimmedTodoIds:e,defaultExpanded:n=!1,onTodoClick:o,style:s}){const a=y(),[c,f]=x.useState(n);if(t.length===0)return null;const u=t.filter(l=>l.status==="completed").length;return r.jsxs("div",{style:{border:`1px solid ${a.stroke.primary}`,borderRadius:6,overflow:"hidden",...s},children:[r.jsxs("button",{type:"button",onClick:()=>f(l=>!l),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:a.fill.secondary,border:"none",cursor:"pointer",color:a.text.secondary,fontSize:12,fontWeight:600},children:[r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:c?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),r.jsx("span",{children:"Todos"}),r.jsx("span",{style:{flex:1}}),r.jsxs("span",{children:[u," of ",t.length," Done"]})]}),c&&r.jsx("div",{style:{padding:6},children:r.jsx(ue,{todos:t,dimmedTodoIds:e,onTodoClick:o})})]})}const qe={primary:"filled",secondary:"default",ghost:"subtle"};function Ve({children:t,variant:e="secondary",disabled:n,type:o="button",style:s,onClick:a}){return r.jsx(h.Button,{variant:qe[e],color:e==="primary"?"accent":void 0,size:"xs",disabled:n,type:o,onClick:a,style:s,children:t})}function Ke({children:t,onClick:e,disabled:n,title:o,variant:s="default",size:a="md",style:c}){return r.jsx(h.ActionIcon,{variant:s==="circle"?"light":"subtle",radius:s==="circle"?"xl":"sm",size:a==="sm"?"sm":"md",color:"gray",disabled:n,title:o,"aria-label":o,onClick:e,style:c,children:t})}const O=x.createContext({collapsible:!1,open:!0,toggle:()=>{}});function de({expanded:t}){return r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:t?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xe({children:t,variant:e="default",collapsible:n=!1,defaultOpen:o=!0,open:s,onOpenChange:a,style:c}){const f=y(),[u,l]=x.useState(o),d=s??u,m=x.useCallback(()=>{const v=!d;s===void 0&&l(v),a==null||a(v)},[d,s,a]);return r.jsx(h.Card,{withBorder:e!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...c},children:r.jsx(O.Provider,{value:{collapsible:n,open:d,toggle:m},children:t})})}function Ye({children:t,trailing:e,style:n}){const o=y(),{collapsible:s,open:a,toggle:c}=x.useContext(O);return r.jsxs("div",{onClick:s?c:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:`1px solid ${o.stroke.secondary}`,fontSize:o.typography.small.fontSize,fontWeight:o.typography.h3.fontWeight,color:o.text.primary,fontFamily:o.typography.fontFamily,cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...n},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&r.jsx(de,{expanded:a}),t]}),e!=null&&r.jsx("span",{children:e})]})}function Ue({children:t,style:e}){const{collapsible:n,open:o}=x.useContext(O);return n&&!o?null:r.jsx("div",{style:{padding:14,...e},children:t})}function Ze({value:t,label:e,tone:n,style:o}){const s=y();return r.jsxs("div",{style:o,children:[r.jsx(h.Text,{fz:22,fw:700,lh:1.2,style:{color:n?T[n]:s.text.primary,fontFamily:s.typography.fontFamily},children:t}),r.jsx(h.Text,{fz:12,style:{color:s.text.tertiary,fontFamily:s.typography.fontFamily},children:e})]})}function Je({children:t,active:e,tone:n="neutral",size:o="md",leadingContent:s,keyboardHint:a,title:c,style:f,onClick:u}){return r.jsx(h.Badge,{color:te[n],variant:e?"filled":"light",size:o==="sm"?"sm":"md",leftSection:s,rightSection:a,title:c,onClick:u,style:{cursor:u?"pointer":void 0,textTransform:"none",...f},children:t})}function Qe({children:t,tone:e="neutral",title:n,icon:o,style:s}){return r.jsx(h.Alert,{color:te[e],title:n,icon:o,variant:"light",style:s,children:t})}function et({value:t,onChange:e,options:n,placeholder:o,disabled:s,style:a}){return r.jsx(h.Select,{value:t,data:n,placeholder:o,disabled:s,allowDeselect:!1,onChange:c=>{c!==null&&(e==null||e(c))},style:a})}function tt({checked:t,onChange:e,disabled:n,label:o,style:s}){return r.jsx(h.Checkbox,{checked:t,disabled:n,label:o,onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function nt({checked:t,onChange:e,disabled:n,size:o="sm",style:s}){return r.jsx(h.Switch,{checked:t,disabled:n,size:o==="sm"?"sm":"md",onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function rt({value:t,onChange:e,placeholder:n,disabled:o,type:s,style:a}){return r.jsx(h.TextInput,{value:t,placeholder:n,disabled:o,type:s,onChange:c=>e==null?void 0:e(c.currentTarget.value),style:a})}function ot({value:t,onChange:e,placeholder:n,disabled:o,rows:s=3,style:a}){return r.jsx(h.Textarea,{value:t,placeholder:n,disabled:o,autosize:!0,minRows:s,onChange:c=>e==null?void 0:e(c.currentTarget.value),style:a})}function st({children:t,gap:e,style:n}){return r.jsx(h.Stack,{gap:e,style:n,children:t})}const Q={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function at({children:t,gap:e,align:n="center",justify:o="start",wrap:s=!1,style:a}){return r.jsx(h.Group,{gap:e,align:Q[n],justify:Q[o],wrap:s?"wrap":"nowrap",style:a,children:t})}function it(){return r.jsx("div",{style:{flex:1}})}function lt({children:t,columns:e,gap:n=16,align:o,style:s}){const a=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e;return r.jsx("div",{style:{display:"grid",gridTemplateColumns:a,gap:n,alignItems:o,...s},children:t})}function ct({style:t}){return r.jsx(h.Divider,{style:t})}function ut({color:t,style:e}){const n=y();return r.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:n.category[t],flex:"0 0 auto",...e}})}function dt({segments:t,total:e,topLeftLabel:n,topRightLabel:o,style:s}){const a=y(),c=e>0?e:1,f=t.reduce((l,d)=>l+(Number.isFinite(d.value)&&d.value>0?d.value:0),0),u=Math.max(0,c-f);return r.jsxs("div",{style:s,children:[(n!=null||o!=null)&&r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:a.text.secondary,marginBottom:6},children:[r.jsx("span",{children:n}),r.jsx("span",{children:o})]}),r.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[t.map((l,d)=>{const m=Number.isFinite(l.value)&&l.value>0?l.value:0,v=a.category[l.color??k.usageColorSequence[d%k.usageColorSequence.length]];return r.jsx("div",{style:{width:`${m/c*100}%`,background:v,borderRadius:3}},l.id)}),u>0&&r.jsx("div",{style:{width:`${u/c*100}%`,background:a.fill.tertiary,borderRadius:3}})]})]})}function ft({title:t,leading:e,count:n,trailing:o,children:s,defaultOpen:a=!1,style:c}){const f=y(),[u,l]=x.useState(a);return r.jsxs("div",{style:c,children:[r.jsxs("div",{onClick:()=>l(d=>!d),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[r.jsx(de,{expanded:u}),e,r.jsx("span",{style:{fontWeight:500},children:t}),n!=null&&r.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:n}),r.jsx("span",{style:{flex:1}}),o!=null&&r.jsx("span",{style:{color:f.text.tertiary},children:o})]}),u&&r.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:s})]})}const ht={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function pt({headers:t,rows:e,columnAlign:n,rowTone:o,framed:s=!0,striped:a,stickyHeader:c,style:f,emptyMessage:u}){return r.jsxs(h.Table,{withTableBorder:s,withColumnBorders:!1,striped:a,stickyHeader:c,highlightOnHover:!0,style:f,children:[r.jsx(h.Table.Thead,{children:r.jsx(h.Table.Tr,{children:t.map((l,d)=>r.jsx(h.Table.Th,{ta:(n==null?void 0:n[d])??"left",children:l},d))})}),r.jsx(h.Table.Tbody,{children:e.length===0?r.jsx(h.Table.Tr,{children:r.jsx(h.Table.Td,{colSpan:t.length,ta:"center",c:"dimmed",children:u??"No data"})}):e.map((l,d)=>{const m=o==null?void 0:o[d];return r.jsx(h.Table.Tr,{style:m?{background:ht[m]}:void 0,children:t.map((v,p)=>r.jsx(h.Table.Td,{ta:(n==null?void 0:n[p])??"left",children:l[p]},p))},d)})})]})}function W(t,e,n){const o=t.typography[e];return{fontFamily:t.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:t.text.primary,margin:0,...n}}function gt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:1,style:W(n,"h1",e),children:t})}function yt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:2,style:W(n,"h2",e),children:t})}function xt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:3,style:W(n,"h3",e),children:t})}const mt={normal:400,medium:500,semibold:600,bold:700},ee=x.createContext(!1);function bt({children:t,tone:e="primary",size:n="body",as:o="p",weight:s="normal",italic:a,truncate:c,style:f}){const u=y(),d=x.useContext(ee)&&o==="p"?"span":o,m=o==="p";return r.jsx(ee.Provider,{value:!0,children:r.jsx(h.Text,{component:d,size:n==="small"?"xs":"sm",fw:mt[s],c:e==="primary"?void 0:u.text[e],truncate:c,style:{fontStyle:a?"italic":void 0,...e==="primary"?{color:u.text.primary}:void 0,...m&&d==="span"?{display:"block"}:void 0,fontFamily:u.typography.fontFamily,...f},children:t})})}function vt({children:t,style:e}){const n=y();return r.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:n.text.primary,background:n.fill.secondary,borderRadius:n.radius.sm,padding:"1px 4px",...e},children:t})}function jt({children:t,href:e,style:n}){const o=y();return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...n},children:t})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>x.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>x.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>x.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>x.useState});exports.canvasPaletteDark=k.canvasPaletteDark;exports.canvasPaletteGrokDark=k.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=k.canvasPaletteGrokLight;exports.canvasPaletteLight=k.canvasPaletteLight;exports.canvasTokens=k.canvasTokens;exports.canvasTokensLight=k.canvasTokensLight;exports.categoryPaletteDark=k.categoryPaletteDark;exports.categoryPaletteLight=k.categoryPaletteLight;exports.colorPalette=k.colorPalette;exports.usageColorSequence=k.usageColorSequence;exports.BarChart=Me;exports.Button=Ve;exports.Callout=Qe;exports.Card=Xe;exports.CardBody=Ue;exports.CardHeader=Ye;exports.Checkbox=tt;exports.Code=vt;exports.CollapsibleSection=ft;exports.DiffStats=ze;exports.DiffView=Oe;exports.Divider=ct;exports.Grid=lt;exports.H1=gt;exports.H2=yt;exports.H3=xt;exports.IconButton=Ke;exports.LineChart=Be;exports.Link=jt;exports.PieChart=Ne;exports.Pill=Je;exports.Row=at;exports.Select=et;exports.Spacer=it;exports.Stack=st;exports.Stat=Ze;exports.Swatch=ut;exports.Table=pt;exports.Text=bt;exports.TextArea=ot;exports.TextInput=rt;exports.TodoList=ue;exports.TodoListCard=$e;exports.Toggle=nt;exports.UsageBar=dt;exports.computeDAGLayout=_e;exports.mergeStyle=xe;exports.useCanvasAction=ye;exports.useCanvasState=ge;exports.useHostTheme=y;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),r=require("react/jsx-runtime"),E=require("@mantine/charts"),h=require("@mantine/core"),k=require("./host-tokens-Lz69pkRj.cjs");function ye(t,e){const n=`canvas:${t}`,[o,s]=x.useState(()=>{if(typeof localStorage>"u")return e;try{const c=localStorage.getItem(n);return c===null?e:JSON.parse(c)}catch{return e}}),a=x.useCallback(c=>{s(f=>{const u=typeof c=="function"?c(f):c;try{localStorage==null||localStorage.setItem(n,JSON.stringify(u))}catch{}return u})},[n]);return[o,a]}function xe(){return x.useCallback(t=>{},[])}function me(t,e){return{...t,...e}}const T={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},te={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function y(){const e=h.useComputedColorScheme("light")==="dark"?"dark":"light";return k.resolveThemeForColorScheme(e)}const ne={verticalAlign:"bottom",align:"center",itemSorter:null},re={itemSorter:null},oe={legend:{justifyContent:"center"}};function z(){const e=y().chart.sequence;return(n,o)=>n?T[n]:e[o%e.length]}function se(){const e=y().text.primary;return{textColor:e,barLabelColor:e}}function ae(t,e){return t.map((n,o)=>{const s={category:n};for(const a of e)s[a.name]=a.data[o]??0;return s})}function ie(t,e){return t.map((n,o)=>({name:n.name,color:e(n.tone,o)}))}function le(t,e){return n=>`${e??""}${n}${t??""}`}function be(t,e){if(t!=null&&t.length)return t.map(n=>({...e?{x:n.value}:{y:n.value},label:n.label,color:n.tone?T[n.tone]:T.neutral}))}const ve=new Set(["log","symlog","pow","sqrt"]);function je(t){const{scale:e}=t;return typeof e!="string"||!ve.has(e)?t:{...t,type:t.type??"number",allowDataOverflow:t.allowDataOverflow??!0,allowDecimals:t.allowDecimals??!0,domain:t.domain??[1,"dataMax"]}}function ce(t){const e=be(t.referenceLines,!!t.horizontal);let n;if(!t.stacked&&!t.normalized){const a=t.beginAtZero!==!1;n=[t.yMin??(a?0:"auto"),t.yMax??"auto"]}const o=t.valueAxis?je(t.valueAxis):void 0;if(!n&&!o)return{referenceLines:e};const s={...n&&{domain:n},...o};return t.horizontal?{xAxisProps:s,referenceLines:e}:{yAxisProps:s,referenceLines:e}}function Se(t,e,n){return t!==void 0?t:e.length===1&&n.length<=8}function Ce(t,e,n){return e.length!==1||e[0].tone?t:t.map((o,s)=>({...o,color:n(void 0,s)}))}const ke=96,Te=6.5;function we(t,e){return t.length<=e?t:`${t.slice(0,Math.max(0,e-1))}…`}function Le(t,e){var c;const n=typeof e.x=="number"?e.x:Number(e.x)||0,o=typeof e.y=="number"?e.y:Number(e.y)||0,s=String(((c=e.payload)==null?void 0:c.value)??""),a=we(s,t);return r.jsx("g",{transform:`translate(${n},${o})`,children:r.jsxs("text",{x:-10,y:0,dy:4,textAnchor:"end",fill:"currentColor",fontSize:12,children:[r.jsx("title",{children:s}),a]})})}function ue(t){return{fontWeight:700,fill:t}}function Pe(t){return{...ue(t),position:"right"}}function Ae(t=ke,e=!1){const n=Math.floor(t/Te);return{yAxisProps:{tick:o=>Le(n,o),width:t},barChartProps:{margin:{right:e?48:32}},gridAxis:"y"}}function Me(){return{barChartProps:{margin:{top:22}}}}function Be({categories:t,series:e,height:n=240,stacked:o,horizontal:s,normalized:a,valueSuffix:c,valuePrefix:f,showValues:u,beginAtZero:l,yMin:d,yMax:m,referenceLines:v,style:p,extra:j}){var A;const w=z(),L=se(),P=Ce(ae(t,e),e,w),B=a?"percent":o?"stacked":"default",I=ce({beginAtZero:l,yMin:d,yMax:m,referenceLines:v,horizontal:s,stacked:o,normalized:a,valueAxis:j==null?void 0:j.valueAxis}),S=!o&&!a&&Se(u,e,t);return r.jsx(E.BarChart,{h:n,data:P,dataKey:"category",series:ie(e,w),type:B,orientation:s?"vertical":"horizontal",withLegend:e.length>1,legendProps:ne,tooltipProps:re,valueFormatter:le(c,f),withBarValueLabel:S,...S?{valueLabelProps:s?Pe(L.barLabelColor):ue(L.barLabelColor)}:{},...s?Ae((A=j==null?void 0:j.categoryAxis)==null?void 0:A.width,S):S?Me():{},styles:{...oe,legendItemName:{color:L.textColor}},...I,style:p})}function De({categories:t,series:e,height:n=240,fill:o,valueSuffix:s,valuePrefix:a,showValues:c,showHoverGuide:f=!0,beginAtZero:u,yMin:l,yMax:d,referenceLines:m,style:v,extra:p,smooth:j}){const w=(p==null?void 0:p.smooth)??j,L=z(),P=se(),B=ae(t,e),I=ie(e,L),S=!!(o&&(p!=null&&p.stacked)),A=ce({beginAtZero:u,yMin:l,yMax:d,referenceLines:m,horizontal:!1,stacked:S,valueAxis:p==null?void 0:p.valueAxis}),M={h:n,data:B,dataKey:"category",series:I,curveType:w?"monotone":"linear",withLegend:e.length>1,legendProps:ne,valueFormatter:le(s,a),withPointLabels:c??t.length<=20,tooltipProps:{...re,...!f&&{cursor:!1}},styles:{...oe,legendItemName:{color:P.textColor}},...A,style:v};return o?r.jsx(E.AreaChart,{...M,type:S?"stacked":"default"}):r.jsx(E.LineChart,{...M})}const Ie=x.lazy(()=>Promise.resolve().then(()=>require("./pie-donut-DNbA0GeH.cjs")).then(t=>({default:t.PieDonutChart}))),Ee=180,Re=540;function He(t,e){if(e<=0)return"0%";const n=t/e*100;return n<10&&Math.abs(n-Math.round(n))>.05?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function Fe(t){return t.map(e=>({dataKey:e.name,value:e.name,color:e.color,type:"circle"}))}function _e(t,e){return t.map(n=>({name:n.name,color:n.color,label:`${n.name} ${He(n.value,e)}`}))}function Ne({data:t,size:e=200,donut:n,style:o}){const[s,a]=x.useState(null),c=y(),f=z(),u=t.map((p,j)=>({name:p.label,value:p.value,color:f(p.tone,j)})),l=u.reduce((p,j)=>p+j.value,0),d={startAngle:Ee,endAngle:Re},m=p=>({opacity:s===null||s===p?1:.35}),v=n?r.jsx(x.Suspense,{fallback:null,children:r.jsx(Ie,{data:u,size:e,highlighted:s})}):r.jsx(E.PieChart,{data:u,size:e,withTooltip:!0,withLabelsLine:!1,cellProps:p=>m(p.name),...d});return r.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",...o},children:[r.jsx("div",{style:{width:"100%",height:e,minHeight:e,display:"flex",alignItems:"center",justifyContent:"center"},children:v}),r.jsx(E.ChartLegend,{payload:Fe(u),series:_e(u,l),legendPosition:"bottom",centered:!0,onHighlight:a,mt:"sm",w:"100%",styles:{legend:{justifyContent:"center",gap:12,color:c.text.primary},legendItemName:{color:c.text.primary}}})]})}function Oe(t){const{nodes:e,edges:n,direction:o="vertical",nodeWidth:s=160,nodeHeight:a=40,rankGap:c=64,nodeGap:f=48,padding:u=24}=t,l=e.map(i=>i.id),d=new Set(l),m=new Map;for(const i of l)m.set(i,[]);for(const i of n)d.has(i.from)&&d.has(i.to)&&m.get(i.from).push(i.to);const v=0,p=1,j=2,w=new Map(l.map(i=>[i,v])),L=new Set,P=(i,g)=>`${i}\0${g}`,B=i=>{w.set(i,p);for(const g of m.get(i)??[]){const b=w.get(g);b===p?L.add(P(i,g)):b===v&&B(g)}w.set(i,j)};for(const i of l)w.get(i)===v&&B(i);const I=n.filter(i=>d.has(i.from)&&d.has(i.to)&&!L.has(P(i.from,i.to))),S=new Map(l.map(i=>[i,0])),A=new Map(l.map(i=>[i,[]]));for(const i of I)A.get(i.from).push(i.to),S.set(i.to,(S.get(i.to)??0)+1);const M=new Map(l.map(i=>[i,0])),_=l.filter(i=>(S.get(i)??0)===0);for(;_.length>0;){const i=_.shift(),g=M.get(i);for(const b of A.get(i))M.set(b,Math.max(M.get(b),g+1)),S.set(b,S.get(b)-1),S.get(b)===0&&_.push(b)}const D=new Map;for(const i of l){const g=M.get(i);D.has(g)||D.set(g,[]),D.get(g).push(i)}const R=[...D.keys()].sort((i,g)=>i-g),C=o==="vertical",$=i=>i*(C?s:a)+Math.max(0,i-1)*f,q=Math.max(0,...R.map(i=>$(D.get(i).length))),H=new Map,V=[];R.forEach((i,g)=>{const b=D.get(i),N=$(b.length),O=u+(q-N)/2,F=u+g*((C?a:s)+c);b.forEach((U,Z)=>{const J=O+Z*((C?s:a)+f),pe=C?J:F,ge=C?F:J;H.set(U,{id:U,x:pe,y:ge,rank:i,order:Z})}),V.push({rank:i,x:C?O:F,y:C?F:O,width:C?N:s,height:C?a:N,nodeIds:b})});const K=(i,g)=>i?C?{x:i.x+s/2,y:g==="source"?i.y+a:i.y}:{x:g==="source"?i.x+s:i.x,y:i.y+a/2}:{x:0,y:0},he=n.filter(i=>d.has(i.from)&&d.has(i.to)).map(i=>{const g=K(H.get(i.from),"source"),b=K(H.get(i.to),"target");return{from:i.from,to:i.to,sourceX:g.x,sourceY:g.y,targetX:b.x,targetY:b.y,isBackEdge:L.has(P(i.from,i.to))}}),X=u*2+R.length*(C?a:s)+Math.max(0,R.length-1)*c,Y=u*2+q;return{nodes:[...H.values()],edges:he,ranks:V,direction:o,width:C?Y:X,height:C?X:Y}}function ze({additions:t=0,deletions:e=0,style:n}){return t===0&&e===0?null:r.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...n},children:[t>0&&r.jsxs("span",{style:{color:T.added},children:["+",t]}),e>0&&r.jsxs("span",{style:{color:T.deleted},children:["-",e]})]})}const Ge={added:"+",removed:"-",unchanged:" "};function We({lines:t,showLineNumbers:e=!0,coloredLineNumbers:n=!0,showAccentStrip:o=!0,style:s}){const a=y(),c=l=>l==="added"?a.diff.insertedLine:l==="removed"?a.diff.removedLine:"transparent",f=l=>l==="added"?a.diff.stripAdded:l==="removed"?a.diff.stripRemoved:"transparent",u=l=>n&&l==="added"?T.added:n&&l==="removed"?T.deleted:a.text.tertiary;return r.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:a.text.primary,overflowX:"auto",...s},children:t.map((l,d)=>r.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:c(l.type),borderLeft:o?`3px solid ${f(l.type)}`:void 0},children:[e&&r.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:u(l.type)},children:l.lineNumber??""}),r.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:u(l.type)},children:Ge[l.type]}),r.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:l.content})]},d))})}function $e({status:t}){const e=y(),n=t==="completed"?T.success:t==="in_progress"?e.accent.primary:t==="cancelled"?T.danger:e.text.tertiary;return r.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[r.jsx("circle",{cx:7,cy:7,r:6,stroke:n,strokeWidth:1.4}),t==="completed"&&r.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),t==="in_progress"&&r.jsx("circle",{cx:7,cy:7,r:3,fill:n}),t==="cancelled"&&r.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round"})]})}function de({todos:t,dimmedTodoIds:e,onTodoClick:n,style:o}){const s=y();return t.length===0?null:r.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:t.map(a=>{const c=e==null?void 0:e.has(a.id);return r.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(a),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:n?"pointer":"default",color:s.text.primary,fontSize:14,lineHeight:"20px",opacity:c?.45:1},children:[r.jsx($e,{status:a.status}),r.jsx("span",{style:{textDecoration:a.status==="cancelled"?"line-through":void 0,color:a.status==="cancelled"?s.text.tertiary:void 0},children:a.content})]},a.id)})})}function qe({todos:t,dimmedTodoIds:e,defaultExpanded:n=!1,onTodoClick:o,style:s}){const a=y(),[c,f]=x.useState(n);if(t.length===0)return null;const u=t.filter(l=>l.status==="completed").length;return r.jsxs("div",{style:{border:`1px solid ${a.stroke.primary}`,borderRadius:6,overflow:"hidden",...s},children:[r.jsxs("button",{type:"button",onClick:()=>f(l=>!l),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:a.fill.secondary,border:"none",cursor:"pointer",color:a.text.secondary,fontSize:12,fontWeight:600},children:[r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:c?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),r.jsx("span",{children:"Todos"}),r.jsx("span",{style:{flex:1}}),r.jsxs("span",{children:[u," of ",t.length," Done"]})]}),c&&r.jsx("div",{style:{padding:6},children:r.jsx(de,{todos:t,dimmedTodoIds:e,onTodoClick:o})})]})}const Ve={primary:"filled",secondary:"default",ghost:"subtle"};function Ke({children:t,variant:e="secondary",disabled:n,type:o="button",style:s,onClick:a}){return r.jsx(h.Button,{variant:Ve[e],color:e==="primary"?"accent":void 0,size:"xs",disabled:n,type:o,onClick:a,style:s,children:t})}function Xe({children:t,onClick:e,disabled:n,title:o,variant:s="default",size:a="md",style:c}){return r.jsx(h.ActionIcon,{variant:s==="circle"?"light":"subtle",radius:s==="circle"?"xl":"sm",size:a==="sm"?"sm":"md",color:"gray",disabled:n,title:o,"aria-label":o,onClick:e,style:c,children:t})}const G=x.createContext({collapsible:!1,open:!0,toggle:()=>{}});function fe({expanded:t}){return r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:t?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ye({children:t,variant:e="default",collapsible:n=!1,defaultOpen:o=!0,open:s,onOpenChange:a,style:c}){const f=y(),[u,l]=x.useState(o),d=s??u,m=x.useCallback(()=>{const v=!d;s===void 0&&l(v),a==null||a(v)},[d,s,a]);return r.jsx(h.Card,{withBorder:e!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...c},children:r.jsx(G.Provider,{value:{collapsible:n,open:d,toggle:m},children:t})})}function Ue({children:t,trailing:e,style:n}){const o=y(),{collapsible:s,open:a,toggle:c}=x.useContext(G);return r.jsxs("div",{onClick:s?c:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:`1px solid ${o.stroke.secondary}`,fontSize:o.typography.small.fontSize,fontWeight:o.typography.h3.fontWeight,color:o.text.primary,fontFamily:o.typography.fontFamily,cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...n},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&r.jsx(fe,{expanded:a}),t]}),e!=null&&r.jsx("span",{children:e})]})}function Ze({children:t,style:e}){const{collapsible:n,open:o}=x.useContext(G);return n&&!o?null:r.jsx("div",{style:{padding:14,...e},children:t})}function Je({value:t,label:e,tone:n,style:o}){const s=y();return r.jsxs("div",{style:o,children:[r.jsx(h.Text,{fz:22,fw:700,lh:1.2,style:{color:n?T[n]:s.text.primary,fontFamily:s.typography.fontFamily},children:t}),r.jsx(h.Text,{fz:12,style:{color:s.text.tertiary,fontFamily:s.typography.fontFamily},children:e})]})}function Qe({children:t,active:e,tone:n="neutral",size:o="md",leadingContent:s,keyboardHint:a,title:c,style:f,onClick:u}){return r.jsx(h.Badge,{color:te[n],variant:e?"filled":"light",size:o==="sm"?"sm":"md",leftSection:s,rightSection:a,title:c,onClick:u,style:{cursor:u?"pointer":void 0,textTransform:"none",...f},children:t})}function et({children:t,tone:e="neutral",title:n,icon:o,style:s}){return r.jsx(h.Alert,{color:te[e],title:n,icon:o,variant:"light",style:s,children:t})}function tt({value:t,onChange:e,options:n,placeholder:o,disabled:s,style:a}){return r.jsx(h.Select,{value:t,data:n,placeholder:o,disabled:s,allowDeselect:!1,onChange:c=>{c!==null&&(e==null||e(c))},style:a})}function nt({checked:t,onChange:e,disabled:n,label:o,style:s}){return r.jsx(h.Checkbox,{checked:t,disabled:n,label:o,onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function rt({checked:t,onChange:e,disabled:n,size:o="sm",style:s}){return r.jsx(h.Switch,{checked:t,disabled:n,size:o==="sm"?"sm":"md",onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function ot({value:t,onChange:e,placeholder:n,disabled:o,type:s,style:a}){return r.jsx(h.TextInput,{value:t,placeholder:n,disabled:o,type:s,onChange:c=>e==null?void 0:e(c.currentTarget.value),style:a})}function st({value:t,onChange:e,placeholder:n,disabled:o,rows:s=3,style:a}){return r.jsx(h.Textarea,{value:t,placeholder:n,disabled:o,autosize:!0,minRows:s,onChange:c=>e==null?void 0:e(c.currentTarget.value),style:a})}function at({children:t,gap:e,style:n}){return r.jsx(h.Stack,{gap:e,style:n,children:t})}const Q={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function it({children:t,gap:e,align:n="center",justify:o="start",wrap:s=!1,style:a}){return r.jsx(h.Group,{gap:e,align:Q[n],justify:Q[o],wrap:s?"wrap":"nowrap",style:a,children:t})}function lt(){return r.jsx("div",{style:{flex:1}})}function ct({children:t,columns:e,gap:n=16,align:o,style:s}){const a=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e;return r.jsx("div",{style:{display:"grid",gridTemplateColumns:a,gap:n,alignItems:o,...s},children:t})}function ut({style:t}){return r.jsx(h.Divider,{style:t})}function dt({color:t,style:e}){const n=y();return r.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:n.category[t],flex:"0 0 auto",...e}})}function ft({segments:t,total:e,topLeftLabel:n,topRightLabel:o,style:s}){const a=y(),c=e>0?e:1,f=t.reduce((l,d)=>l+(Number.isFinite(d.value)&&d.value>0?d.value:0),0),u=Math.max(0,c-f);return r.jsxs("div",{style:s,children:[(n!=null||o!=null)&&r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:a.text.secondary,marginBottom:6},children:[r.jsx("span",{children:n}),r.jsx("span",{children:o})]}),r.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[t.map((l,d)=>{const m=Number.isFinite(l.value)&&l.value>0?l.value:0,v=a.category[l.color??k.usageColorSequence[d%k.usageColorSequence.length]];return r.jsx("div",{style:{width:`${m/c*100}%`,background:v,borderRadius:3}},l.id)}),u>0&&r.jsx("div",{style:{width:`${u/c*100}%`,background:a.fill.tertiary,borderRadius:3}})]})]})}function ht({title:t,leading:e,count:n,trailing:o,children:s,defaultOpen:a=!1,style:c}){const f=y(),[u,l]=x.useState(a);return r.jsxs("div",{style:c,children:[r.jsxs("div",{onClick:()=>l(d=>!d),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[r.jsx(fe,{expanded:u}),e,r.jsx("span",{style:{fontWeight:500},children:t}),n!=null&&r.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:n}),r.jsx("span",{style:{flex:1}}),o!=null&&r.jsx("span",{style:{color:f.text.tertiary},children:o})]}),u&&r.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:s})]})}const pt={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function gt({headers:t,rows:e,columnAlign:n,rowTone:o,framed:s=!0,striped:a,stickyHeader:c,style:f,emptyMessage:u}){return r.jsxs(h.Table,{withTableBorder:s,withColumnBorders:!1,striped:a,stickyHeader:c,highlightOnHover:!0,style:f,children:[r.jsx(h.Table.Thead,{children:r.jsx(h.Table.Tr,{children:t.map((l,d)=>r.jsx(h.Table.Th,{ta:(n==null?void 0:n[d])??"left",children:l},d))})}),r.jsx(h.Table.Tbody,{children:e.length===0?r.jsx(h.Table.Tr,{children:r.jsx(h.Table.Td,{colSpan:t.length,ta:"center",c:"dimmed",children:u??"No data"})}):e.map((l,d)=>{const m=o==null?void 0:o[d];return r.jsx(h.Table.Tr,{style:m?{background:pt[m]}:void 0,children:t.map((v,p)=>r.jsx(h.Table.Td,{ta:(n==null?void 0:n[p])??"left",children:l[p]},p))},d)})})]})}function W(t,e,n){const o=t.typography[e];return{fontFamily:t.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:t.text.primary,margin:0,...n}}function yt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:1,style:W(n,"h1",e),children:t})}function xt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:2,style:W(n,"h2",e),children:t})}function mt({children:t,style:e}){const n=y();return r.jsx(h.Title,{order:3,style:W(n,"h3",e),children:t})}const bt={normal:400,medium:500,semibold:600,bold:700},ee=x.createContext(!1);function vt({children:t,tone:e="primary",size:n="body",as:o="p",weight:s="normal",italic:a,truncate:c,style:f}){const u=y(),d=x.useContext(ee)&&o==="p"?"span":o,m=o==="p";return r.jsx(ee.Provider,{value:!0,children:r.jsx(h.Text,{component:d,size:n==="small"?"xs":"sm",fw:bt[s],c:e==="primary"?void 0:u.text[e],truncate:c,style:{fontStyle:a?"italic":void 0,...e==="primary"?{color:u.text.primary}:void 0,...m&&d==="span"?{display:"block"}:void 0,fontFamily:u.typography.fontFamily,...f},children:t})})}function jt({children:t,style:e}){const n=y();return r.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:n.text.primary,background:n.fill.secondary,borderRadius:n.radius.sm,padding:"1px 4px",...e},children:t})}function St({children:t,href:e,style:n}){const o=y();return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...n},children:t})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>x.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>x.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>x.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>x.useState});exports.canvasPaletteDark=k.canvasPaletteDark;exports.canvasPaletteGrokDark=k.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=k.canvasPaletteGrokLight;exports.canvasPaletteLight=k.canvasPaletteLight;exports.canvasTokens=k.canvasTokens;exports.canvasTokensLight=k.canvasTokensLight;exports.categoryPaletteDark=k.categoryPaletteDark;exports.categoryPaletteLight=k.categoryPaletteLight;exports.colorPalette=k.colorPalette;exports.usageColorSequence=k.usageColorSequence;exports.BarChart=Be;exports.Button=Ke;exports.Callout=et;exports.Card=Ye;exports.CardBody=Ze;exports.CardHeader=Ue;exports.Checkbox=nt;exports.Code=jt;exports.CollapsibleSection=ht;exports.DiffStats=ze;exports.DiffView=We;exports.Divider=ut;exports.Grid=ct;exports.H1=yt;exports.H2=xt;exports.H3=mt;exports.IconButton=Xe;exports.LineChart=De;exports.Link=St;exports.PieChart=Ne;exports.Pill=Qe;exports.Row=it;exports.Select=tt;exports.Spacer=lt;exports.Stack=at;exports.Stat=Je;exports.Swatch=dt;exports.Table=gt;exports.Text=vt;exports.TextArea=st;exports.TextInput=ot;exports.TodoList=de;exports.TodoListCard=qe;exports.Toggle=rt;exports.UsageBar=ft;exports.computeDAGLayout=Oe;exports.mergeStyle=me;exports.useCanvasAction=xe;exports.useCanvasState=ye;exports.useHostTheme=y;
|
package/dist/cursor-canvas.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useEffect as
|
|
1
|
+
import { useCallback as O, useState as I, Suspense as be, lazy as Se, createContext as ae, useContext as W } from "react";
|
|
2
|
+
import { useEffect as rn, useMemo as on, useRef as an, useState as sn } from "react";
|
|
3
3
|
import { jsx as i, jsxs as y } from "react/jsx-runtime";
|
|
4
|
-
import { BarChart as
|
|
5
|
-
import { useComputedColorScheme as
|
|
6
|
-
import { r as
|
|
7
|
-
import { c as
|
|
8
|
-
function
|
|
9
|
-
const n = `canvas:${t}`, [r, o] =
|
|
4
|
+
import { BarChart as Ce, AreaChart as ke, LineChart as we, ChartLegend as Le, PieChart as Te } from "@mantine/charts";
|
|
5
|
+
import { useComputedColorScheme as Pe, Button as Ae, ActionIcon as Me, Card as Be, Alert as $e, Badge as De, Text as z, Checkbox as Ie, Select as Ee, Textarea as Fe, TextInput as Re, Switch as _e, Divider as Ne, Group as He, Stack as ze, Table as T, Title as G } from "@mantine/core";
|
|
6
|
+
import { r as Oe, u as ne } from "./host-tokens-Bt6GPXN1.js";
|
|
7
|
+
import { c as cn, a as dn, b as un, d as fn, e as hn, f as pn, g as yn, h as gn, i as mn } from "./host-tokens-Bt6GPXN1.js";
|
|
8
|
+
function mt(t, e) {
|
|
9
|
+
const n = `canvas:${t}`, [r, o] = I(() => {
|
|
10
10
|
if (typeof localStorage > "u") return e;
|
|
11
11
|
try {
|
|
12
12
|
const c = localStorage.getItem(n);
|
|
@@ -14,7 +14,7 @@ function gt(t, e) {
|
|
|
14
14
|
} catch {
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
|
-
}), a =
|
|
17
|
+
}), a = O(
|
|
18
18
|
(c) => {
|
|
19
19
|
o((f) => {
|
|
20
20
|
const d = typeof c == "function" ? c(f) : c;
|
|
@@ -29,14 +29,14 @@ function gt(t, e) {
|
|
|
29
29
|
);
|
|
30
30
|
return [r, a];
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function xt() {
|
|
33
|
+
return O((t) => {
|
|
34
34
|
}, []);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function vt(t, e) {
|
|
37
37
|
return { ...t, ...e };
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const k = {
|
|
40
40
|
success: "#1F8A65",
|
|
41
41
|
danger: "#CF2D56",
|
|
42
42
|
warning: "#E8A33D",
|
|
@@ -56,24 +56,27 @@ const C = {
|
|
|
56
56
|
renamed: "indigo"
|
|
57
57
|
};
|
|
58
58
|
function g() {
|
|
59
|
-
const e =
|
|
60
|
-
return
|
|
59
|
+
const e = Pe("light") === "dark" ? "dark" : "light";
|
|
60
|
+
return Oe(e);
|
|
61
61
|
}
|
|
62
62
|
const se = {
|
|
63
63
|
verticalAlign: "bottom",
|
|
64
|
-
align: "center"
|
|
64
|
+
align: "center",
|
|
65
|
+
itemSorter: null
|
|
65
66
|
}, le = {
|
|
67
|
+
itemSorter: null
|
|
68
|
+
}, ce = {
|
|
66
69
|
legend: { justifyContent: "center" }
|
|
67
70
|
};
|
|
68
71
|
function j() {
|
|
69
72
|
const e = g().chart.sequence;
|
|
70
|
-
return (n, r) => n ?
|
|
73
|
+
return (n, r) => n ? k[n] : e[r % e.length];
|
|
71
74
|
}
|
|
72
|
-
function
|
|
75
|
+
function de() {
|
|
73
76
|
const e = g().text.primary;
|
|
74
77
|
return { textColor: e, barLabelColor: e };
|
|
75
78
|
}
|
|
76
|
-
function
|
|
79
|
+
function ue(t, e) {
|
|
77
80
|
return t.map((n, r) => {
|
|
78
81
|
const o = { category: n };
|
|
79
82
|
for (const a of e)
|
|
@@ -81,13 +84,13 @@ function de(t, e) {
|
|
|
81
84
|
return o;
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
|
-
function
|
|
87
|
+
function fe(t, e) {
|
|
85
88
|
return t.map((n, r) => ({
|
|
86
89
|
name: n.name,
|
|
87
90
|
color: e(n.tone, r)
|
|
88
91
|
}));
|
|
89
92
|
}
|
|
90
|
-
function
|
|
93
|
+
function he(t, e) {
|
|
91
94
|
return (n) => `${e ?? ""}${n}${t ?? ""}`;
|
|
92
95
|
}
|
|
93
96
|
function We(t, e) {
|
|
@@ -95,11 +98,11 @@ function We(t, e) {
|
|
|
95
98
|
return t.map((n) => ({
|
|
96
99
|
...e ? { x: n.value } : { y: n.value },
|
|
97
100
|
label: n.label,
|
|
98
|
-
color: n.tone ?
|
|
101
|
+
color: n.tone ? k[n.tone] : k.neutral
|
|
99
102
|
}));
|
|
100
103
|
}
|
|
101
104
|
const Ge = /* @__PURE__ */ new Set(["log", "symlog", "pow", "sqrt"]);
|
|
102
|
-
function
|
|
105
|
+
function je(t) {
|
|
103
106
|
const { scale: e } = t;
|
|
104
107
|
return typeof e != "string" || !Ge.has(e) ? t : {
|
|
105
108
|
...t,
|
|
@@ -109,35 +112,35 @@ function Oe(t) {
|
|
|
109
112
|
domain: t.domain ?? [1, "dataMax"]
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
|
-
function
|
|
115
|
+
function pe(t) {
|
|
113
116
|
const e = We(t.referenceLines, !!t.horizontal);
|
|
114
117
|
let n;
|
|
115
118
|
if (!t.stacked && !t.normalized) {
|
|
116
119
|
const a = t.beginAtZero !== !1;
|
|
117
120
|
n = [t.yMin ?? (a ? 0 : "auto"), t.yMax ?? "auto"];
|
|
118
121
|
}
|
|
119
|
-
const r = t.valueAxis ?
|
|
122
|
+
const r = t.valueAxis ? je(t.valueAxis) : void 0;
|
|
120
123
|
if (!n && !r)
|
|
121
124
|
return { referenceLines: e };
|
|
122
125
|
const o = { ...n && { domain: n }, ...r };
|
|
123
126
|
return t.horizontal ? { xAxisProps: o, referenceLines: e } : { yAxisProps: o, referenceLines: e };
|
|
124
127
|
}
|
|
125
|
-
function
|
|
128
|
+
function Ke(t, e, n) {
|
|
126
129
|
return t !== void 0 ? t : e.length === 1 && n.length <= 8;
|
|
127
130
|
}
|
|
128
|
-
function
|
|
131
|
+
function Ve(t, e, n) {
|
|
129
132
|
return e.length !== 1 || e[0].tone ? t : t.map((r, o) => ({
|
|
130
133
|
...r,
|
|
131
134
|
color: n(void 0, o)
|
|
132
135
|
}));
|
|
133
136
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
137
|
+
const Xe = 96, Ye = 6.5;
|
|
138
|
+
function qe(t, e) {
|
|
136
139
|
return t.length <= e ? t : `${t.slice(0, Math.max(0, e - 1))}…`;
|
|
137
140
|
}
|
|
138
|
-
function
|
|
141
|
+
function Ze(t, e) {
|
|
139
142
|
var c;
|
|
140
|
-
const n = typeof e.x == "number" ? e.x : Number(e.x) || 0, r = typeof e.y == "number" ? e.y : Number(e.y) || 0, o = String(((c = e.payload) == null ? void 0 : c.value) ?? ""), a =
|
|
143
|
+
const n = typeof e.x == "number" ? e.x : Number(e.x) || 0, r = typeof e.y == "number" ? e.y : Number(e.y) || 0, o = String(((c = e.payload) == null ? void 0 : c.value) ?? ""), a = qe(o, t);
|
|
141
144
|
return /* @__PURE__ */ i("g", { transform: `translate(${n},${r})`, children: /* @__PURE__ */ y(
|
|
142
145
|
"text",
|
|
143
146
|
{
|
|
@@ -154,23 +157,23 @@ function qe(t, e) {
|
|
|
154
157
|
}
|
|
155
158
|
) });
|
|
156
159
|
}
|
|
157
|
-
function
|
|
160
|
+
function ye(t) {
|
|
158
161
|
return {
|
|
159
162
|
fontWeight: 700,
|
|
160
163
|
fill: t
|
|
161
164
|
};
|
|
162
165
|
}
|
|
163
|
-
function
|
|
166
|
+
function Je(t) {
|
|
164
167
|
return {
|
|
165
|
-
...
|
|
168
|
+
...ye(t),
|
|
166
169
|
position: "right"
|
|
167
170
|
};
|
|
168
171
|
}
|
|
169
|
-
function
|
|
170
|
-
const n = Math.floor(t /
|
|
172
|
+
function Ue(t = Xe, e = !1) {
|
|
173
|
+
const n = Math.floor(t / Ye);
|
|
171
174
|
return {
|
|
172
175
|
yAxisProps: {
|
|
173
|
-
tick: (r) =>
|
|
176
|
+
tick: (r) => Ze(n, r),
|
|
174
177
|
width: t
|
|
175
178
|
},
|
|
176
179
|
barChartProps: {
|
|
@@ -179,14 +182,14 @@ function Je(t = Ve, e = !1) {
|
|
|
179
182
|
gridAxis: "y"
|
|
180
183
|
};
|
|
181
184
|
}
|
|
182
|
-
function
|
|
185
|
+
function Qe() {
|
|
183
186
|
return {
|
|
184
187
|
barChartProps: {
|
|
185
188
|
margin: { top: 22 }
|
|
186
189
|
}
|
|
187
190
|
};
|
|
188
191
|
}
|
|
189
|
-
function
|
|
192
|
+
function bt({
|
|
190
193
|
categories: t,
|
|
191
194
|
series: e,
|
|
192
195
|
height: n = 240,
|
|
@@ -204,11 +207,11 @@ function vt({
|
|
|
204
207
|
extra: b
|
|
205
208
|
}) {
|
|
206
209
|
var A;
|
|
207
|
-
const w = j(), L =
|
|
208
|
-
|
|
210
|
+
const w = j(), L = de(), P = Ve(
|
|
211
|
+
ue(t, e),
|
|
209
212
|
e,
|
|
210
213
|
w
|
|
211
|
-
), B = a ? "percent" : r ? "stacked" : "default", D =
|
|
214
|
+
), B = a ? "percent" : r ? "stacked" : "default", D = pe({
|
|
212
215
|
beginAtZero: l,
|
|
213
216
|
yMin: u,
|
|
214
217
|
yMax: m,
|
|
@@ -217,26 +220,27 @@ function vt({
|
|
|
217
220
|
stacked: r,
|
|
218
221
|
normalized: a,
|
|
219
222
|
valueAxis: b == null ? void 0 : b.valueAxis
|
|
220
|
-
}), S = !r && !a &&
|
|
223
|
+
}), S = !r && !a && Ke(d, e, t);
|
|
221
224
|
return /* @__PURE__ */ i(
|
|
222
|
-
|
|
225
|
+
Ce,
|
|
223
226
|
{
|
|
224
227
|
h: n,
|
|
225
228
|
data: P,
|
|
226
229
|
dataKey: "category",
|
|
227
|
-
series:
|
|
230
|
+
series: fe(e, w),
|
|
228
231
|
type: B,
|
|
229
232
|
orientation: o ? "vertical" : "horizontal",
|
|
230
233
|
withLegend: e.length > 1,
|
|
231
234
|
legendProps: se,
|
|
232
|
-
|
|
235
|
+
tooltipProps: le,
|
|
236
|
+
valueFormatter: he(c, f),
|
|
233
237
|
withBarValueLabel: S,
|
|
234
238
|
...S ? {
|
|
235
|
-
valueLabelProps: o ?
|
|
239
|
+
valueLabelProps: o ? Je(L.barLabelColor) : ye(L.barLabelColor)
|
|
236
240
|
} : {},
|
|
237
|
-
...o ?
|
|
241
|
+
...o ? Ue((A = b == null ? void 0 : b.categoryAxis) == null ? void 0 : A.width, S) : S ? Qe() : {},
|
|
238
242
|
styles: {
|
|
239
|
-
...
|
|
243
|
+
...ce,
|
|
240
244
|
legendItemName: { color: L.textColor }
|
|
241
245
|
},
|
|
242
246
|
...D,
|
|
@@ -244,7 +248,7 @@ function vt({
|
|
|
244
248
|
}
|
|
245
249
|
);
|
|
246
250
|
}
|
|
247
|
-
function
|
|
251
|
+
function St({
|
|
248
252
|
categories: t,
|
|
249
253
|
series: e,
|
|
250
254
|
height: n = 240,
|
|
@@ -261,7 +265,7 @@ function bt({
|
|
|
261
265
|
extra: h,
|
|
262
266
|
smooth: b
|
|
263
267
|
}) {
|
|
264
|
-
const w = (h == null ? void 0 : h.smooth) ?? b, L = j(), P =
|
|
268
|
+
const w = (h == null ? void 0 : h.smooth) ?? b, L = j(), P = de(), B = ue(t, e), D = fe(e, L), S = !!(r && (h != null && h.stacked)), A = pe({
|
|
265
269
|
beginAtZero: d,
|
|
266
270
|
yMin: l,
|
|
267
271
|
yMax: u,
|
|
@@ -277,28 +281,31 @@ function bt({
|
|
|
277
281
|
curveType: w ? "monotone" : "linear",
|
|
278
282
|
withLegend: e.length > 1,
|
|
279
283
|
legendProps: se,
|
|
280
|
-
valueFormatter:
|
|
284
|
+
valueFormatter: he(o, a),
|
|
281
285
|
withPointLabels: c ?? t.length <= 20,
|
|
282
|
-
tooltipProps:
|
|
283
|
-
styles: {
|
|
286
|
+
tooltipProps: {
|
|
284
287
|
...le,
|
|
288
|
+
...!f && { cursor: !1 }
|
|
289
|
+
},
|
|
290
|
+
styles: {
|
|
291
|
+
...ce,
|
|
285
292
|
legendItemName: { color: P.textColor }
|
|
286
293
|
},
|
|
287
294
|
...A,
|
|
288
295
|
style: v
|
|
289
296
|
};
|
|
290
|
-
return r ? /* @__PURE__ */ i(ke, { ...M, type: S ? "stacked" : "default" }) : /* @__PURE__ */ i(
|
|
297
|
+
return r ? /* @__PURE__ */ i(ke, { ...M, type: S ? "stacked" : "default" }) : /* @__PURE__ */ i(we, { ...M });
|
|
291
298
|
}
|
|
292
|
-
const
|
|
299
|
+
const et = Se(
|
|
293
300
|
() => import("./pie-donut-qRBFP0tT.js").then((t) => ({ default: t.PieDonutChart }))
|
|
294
|
-
),
|
|
295
|
-
function
|
|
301
|
+
), tt = 180, nt = 540;
|
|
302
|
+
function rt(t, e) {
|
|
296
303
|
if (e <= 0)
|
|
297
304
|
return "0%";
|
|
298
305
|
const n = t / e * 100;
|
|
299
306
|
return n < 10 && Math.abs(n - Math.round(n)) > 0.05 ? `${n.toFixed(1)}%` : `${Math.round(n)}%`;
|
|
300
307
|
}
|
|
301
|
-
function
|
|
308
|
+
function ot(t) {
|
|
302
309
|
return t.map((e) => ({
|
|
303
310
|
dataKey: e.name,
|
|
304
311
|
value: e.name,
|
|
@@ -306,32 +313,32 @@ function rt(t) {
|
|
|
306
313
|
type: "circle"
|
|
307
314
|
}));
|
|
308
315
|
}
|
|
309
|
-
function
|
|
316
|
+
function at(t, e) {
|
|
310
317
|
return t.map((n) => ({
|
|
311
318
|
name: n.name,
|
|
312
319
|
color: n.color,
|
|
313
|
-
label: `${n.name} ${
|
|
320
|
+
label: `${n.name} ${rt(n.value, e)}`
|
|
314
321
|
}));
|
|
315
322
|
}
|
|
316
|
-
function
|
|
317
|
-
const [o, a] =
|
|
323
|
+
function Ct({ data: t, size: e = 200, donut: n, style: r }) {
|
|
324
|
+
const [o, a] = I(null), c = g(), f = j(), d = t.map((h, b) => ({
|
|
318
325
|
name: h.label,
|
|
319
326
|
value: h.value,
|
|
320
327
|
color: f(h.tone, b)
|
|
321
328
|
})), l = d.reduce((h, b) => h + b.value, 0), u = {
|
|
322
|
-
startAngle:
|
|
323
|
-
endAngle:
|
|
329
|
+
startAngle: tt,
|
|
330
|
+
endAngle: nt
|
|
324
331
|
}, m = (h) => ({
|
|
325
332
|
opacity: o === null || o === h ? 1 : 0.35
|
|
326
|
-
}), v = n ? /* @__PURE__ */ i(
|
|
327
|
-
|
|
333
|
+
}), v = n ? /* @__PURE__ */ i(be, { fallback: null, children: /* @__PURE__ */ i(
|
|
334
|
+
et,
|
|
328
335
|
{
|
|
329
336
|
data: d,
|
|
330
337
|
size: e,
|
|
331
338
|
highlighted: o
|
|
332
339
|
}
|
|
333
340
|
) }) : /* @__PURE__ */ i(
|
|
334
|
-
|
|
341
|
+
Te,
|
|
335
342
|
{
|
|
336
343
|
data: d,
|
|
337
344
|
size: e,
|
|
@@ -367,10 +374,10 @@ function St({ data: t, size: e = 200, donut: n, style: r }) {
|
|
|
367
374
|
}
|
|
368
375
|
),
|
|
369
376
|
/* @__PURE__ */ i(
|
|
370
|
-
|
|
377
|
+
Le,
|
|
371
378
|
{
|
|
372
|
-
payload:
|
|
373
|
-
series:
|
|
379
|
+
payload: ot(d),
|
|
380
|
+
series: at(d, l),
|
|
374
381
|
legendPosition: "bottom",
|
|
375
382
|
centered: !0,
|
|
376
383
|
onHighlight: a,
|
|
@@ -420,42 +427,42 @@ function kt(t) {
|
|
|
420
427
|
), S = new Map(l.map((s) => [s, 0])), A = new Map(l.map((s) => [s, []]));
|
|
421
428
|
for (const s of D)
|
|
422
429
|
A.get(s.from).push(s.to), S.set(s.to, (S.get(s.to) ?? 0) + 1);
|
|
423
|
-
const M = new Map(l.map((s) => [s, 0])),
|
|
424
|
-
for (;
|
|
425
|
-
const s =
|
|
430
|
+
const M = new Map(l.map((s) => [s, 0])), _ = l.filter((s) => (S.get(s) ?? 0) === 0);
|
|
431
|
+
for (; _.length > 0; ) {
|
|
432
|
+
const s = _.shift(), p = M.get(s);
|
|
426
433
|
for (const x of A.get(s))
|
|
427
|
-
M.set(x, Math.max(M.get(x), p + 1)), S.set(x, S.get(x) - 1), S.get(x) === 0 &&
|
|
434
|
+
M.set(x, Math.max(M.get(x), p + 1)), S.set(x, S.get(x) - 1), S.get(x) === 0 && _.push(x);
|
|
428
435
|
}
|
|
429
436
|
const $ = /* @__PURE__ */ new Map();
|
|
430
437
|
for (const s of l) {
|
|
431
438
|
const p = M.get(s);
|
|
432
439
|
$.has(p) || $.set(p, []), $.get(p).push(s);
|
|
433
440
|
}
|
|
434
|
-
const
|
|
441
|
+
const E = [...$.keys()].sort((s, p) => s - p), C = r === "vertical", X = (s) => s * (C ? o : a) + Math.max(0, s - 1) * f, Y = Math.max(
|
|
435
442
|
0,
|
|
436
|
-
...
|
|
443
|
+
...E.map((s) => X($.get(s).length))
|
|
437
444
|
), F = /* @__PURE__ */ new Map(), q = [];
|
|
438
|
-
|
|
439
|
-
const x = $.get(s),
|
|
445
|
+
E.forEach((s, p) => {
|
|
446
|
+
const x = $.get(s), N = X(x.length), H = d + (Y - N) / 2, R = d + p * ((C ? a : o) + c);
|
|
440
447
|
x.forEach((Q, ee) => {
|
|
441
|
-
const te =
|
|
442
|
-
F.set(Q, { id: Q, x:
|
|
448
|
+
const te = H + ee * ((C ? o : a) + f), xe = C ? te : R, ve = C ? R : te;
|
|
449
|
+
F.set(Q, { id: Q, x: xe, y: ve, rank: s, order: ee });
|
|
443
450
|
}), q.push({
|
|
444
451
|
rank: s,
|
|
445
|
-
x:
|
|
446
|
-
y:
|
|
447
|
-
width:
|
|
448
|
-
height:
|
|
452
|
+
x: C ? H : R,
|
|
453
|
+
y: C ? R : H,
|
|
454
|
+
width: C ? N : o,
|
|
455
|
+
height: C ? a : N,
|
|
449
456
|
nodeIds: x
|
|
450
457
|
});
|
|
451
458
|
});
|
|
452
|
-
const Z = (s, p) => s ?
|
|
459
|
+
const Z = (s, p) => s ? C ? {
|
|
453
460
|
x: s.x + o / 2,
|
|
454
461
|
y: p === "source" ? s.y + a : s.y
|
|
455
462
|
} : {
|
|
456
463
|
x: p === "source" ? s.x + o : s.x,
|
|
457
464
|
y: s.y + a / 2
|
|
458
|
-
} : { x: 0, y: 0 },
|
|
465
|
+
} : { x: 0, y: 0 }, me = n.filter((s) => u.has(s.from) && u.has(s.to)).map((s) => {
|
|
459
466
|
const p = Z(F.get(s.from), "source"), x = Z(F.get(s.to), "target");
|
|
460
467
|
return {
|
|
461
468
|
from: s.from,
|
|
@@ -466,17 +473,17 @@ function kt(t) {
|
|
|
466
473
|
targetY: x.y,
|
|
467
474
|
isBackEdge: L.has(P(s.from, s.to))
|
|
468
475
|
};
|
|
469
|
-
}), J = d * 2 +
|
|
476
|
+
}), J = d * 2 + E.length * (C ? a : o) + Math.max(0, E.length - 1) * c, U = d * 2 + Y;
|
|
470
477
|
return {
|
|
471
478
|
nodes: [...F.values()],
|
|
472
|
-
edges:
|
|
479
|
+
edges: me,
|
|
473
480
|
ranks: q,
|
|
474
481
|
direction: r,
|
|
475
|
-
width:
|
|
476
|
-
height:
|
|
482
|
+
width: C ? U : J,
|
|
483
|
+
height: C ? J : U
|
|
477
484
|
};
|
|
478
485
|
}
|
|
479
|
-
function
|
|
486
|
+
function wt({
|
|
480
487
|
additions: t = 0,
|
|
481
488
|
deletions: e = 0,
|
|
482
489
|
style: n
|
|
@@ -493,11 +500,11 @@ function Ct({
|
|
|
493
500
|
...n
|
|
494
501
|
},
|
|
495
502
|
children: [
|
|
496
|
-
t > 0 && /* @__PURE__ */ y("span", { style: { color:
|
|
503
|
+
t > 0 && /* @__PURE__ */ y("span", { style: { color: k.added }, children: [
|
|
497
504
|
"+",
|
|
498
505
|
t
|
|
499
506
|
] }),
|
|
500
|
-
e > 0 && /* @__PURE__ */ y("span", { style: { color:
|
|
507
|
+
e > 0 && /* @__PURE__ */ y("span", { style: { color: k.deleted }, children: [
|
|
501
508
|
"-",
|
|
502
509
|
e
|
|
503
510
|
] })
|
|
@@ -505,19 +512,19 @@ function Ct({
|
|
|
505
512
|
}
|
|
506
513
|
);
|
|
507
514
|
}
|
|
508
|
-
const
|
|
515
|
+
const it = {
|
|
509
516
|
added: "+",
|
|
510
517
|
removed: "-",
|
|
511
518
|
unchanged: " "
|
|
512
519
|
};
|
|
513
|
-
function
|
|
520
|
+
function Lt({
|
|
514
521
|
lines: t,
|
|
515
522
|
showLineNumbers: e = !0,
|
|
516
523
|
coloredLineNumbers: n = !0,
|
|
517
524
|
showAccentStrip: r = !0,
|
|
518
525
|
style: o
|
|
519
526
|
}) {
|
|
520
|
-
const a = g(), c = (l) => l === "added" ? a.diff.insertedLine : l === "removed" ? a.diff.removedLine : "transparent", f = (l) => l === "added" ? a.diff.stripAdded : l === "removed" ? a.diff.stripRemoved : "transparent", d = (l) => n && l === "added" ?
|
|
527
|
+
const a = g(), c = (l) => l === "added" ? a.diff.insertedLine : l === "removed" ? a.diff.removedLine : "transparent", f = (l) => l === "added" ? a.diff.stripAdded : l === "removed" ? a.diff.stripRemoved : "transparent", d = (l) => n && l === "added" ? k.added : n && l === "removed" ? k.deleted : a.text.tertiary;
|
|
521
528
|
return /* @__PURE__ */ i(
|
|
522
529
|
"div",
|
|
523
530
|
{
|
|
@@ -563,7 +570,7 @@ function wt({
|
|
|
563
570
|
userSelect: "none",
|
|
564
571
|
color: d(l.type)
|
|
565
572
|
},
|
|
566
|
-
children:
|
|
573
|
+
children: it[l.type]
|
|
567
574
|
}
|
|
568
575
|
),
|
|
569
576
|
/* @__PURE__ */ i(
|
|
@@ -585,8 +592,8 @@ function wt({
|
|
|
585
592
|
}
|
|
586
593
|
);
|
|
587
594
|
}
|
|
588
|
-
function
|
|
589
|
-
const e = g(), n = t === "completed" ?
|
|
595
|
+
function st({ status: t }) {
|
|
596
|
+
const e = g(), n = t === "completed" ? k.success : t === "in_progress" ? e.accent.primary : t === "cancelled" ? k.danger : e.text.tertiary;
|
|
590
597
|
return /* @__PURE__ */ y(
|
|
591
598
|
"svg",
|
|
592
599
|
{
|
|
@@ -622,7 +629,7 @@ function it({ status: t }) {
|
|
|
622
629
|
}
|
|
623
630
|
);
|
|
624
631
|
}
|
|
625
|
-
function
|
|
632
|
+
function lt({
|
|
626
633
|
todos: t,
|
|
627
634
|
dimmedTodoIds: e,
|
|
628
635
|
onTodoClick: n,
|
|
@@ -652,7 +659,7 @@ function st({
|
|
|
652
659
|
opacity: c ? 0.45 : 1
|
|
653
660
|
},
|
|
654
661
|
children: [
|
|
655
|
-
/* @__PURE__ */ i(
|
|
662
|
+
/* @__PURE__ */ i(st, { status: a.status }),
|
|
656
663
|
/* @__PURE__ */ i(
|
|
657
664
|
"span",
|
|
658
665
|
{
|
|
@@ -669,14 +676,14 @@ function st({
|
|
|
669
676
|
);
|
|
670
677
|
}) });
|
|
671
678
|
}
|
|
672
|
-
function
|
|
679
|
+
function Tt({
|
|
673
680
|
todos: t,
|
|
674
681
|
dimmedTodoIds: e,
|
|
675
682
|
defaultExpanded: n = !1,
|
|
676
683
|
onTodoClick: r,
|
|
677
684
|
style: o
|
|
678
685
|
}) {
|
|
679
|
-
const a = g(), [c, f] =
|
|
686
|
+
const a = g(), [c, f] = I(n);
|
|
680
687
|
if (t.length === 0) return null;
|
|
681
688
|
const d = t.filter((l) => l.status === "completed").length;
|
|
682
689
|
return /* @__PURE__ */ y(
|
|
@@ -744,7 +751,7 @@ function Lt({
|
|
|
744
751
|
}
|
|
745
752
|
),
|
|
746
753
|
c && /* @__PURE__ */ i("div", { style: { padding: 6 }, children: /* @__PURE__ */ i(
|
|
747
|
-
|
|
754
|
+
lt,
|
|
748
755
|
{
|
|
749
756
|
todos: t,
|
|
750
757
|
dimmedTodoIds: e,
|
|
@@ -755,12 +762,12 @@ function Lt({
|
|
|
755
762
|
}
|
|
756
763
|
);
|
|
757
764
|
}
|
|
758
|
-
const
|
|
765
|
+
const ct = {
|
|
759
766
|
primary: "filled",
|
|
760
767
|
secondary: "default",
|
|
761
768
|
ghost: "subtle"
|
|
762
769
|
};
|
|
763
|
-
function
|
|
770
|
+
function Pt({
|
|
764
771
|
children: t,
|
|
765
772
|
variant: e = "secondary",
|
|
766
773
|
disabled: n,
|
|
@@ -769,9 +776,9 @@ function Tt({
|
|
|
769
776
|
onClick: a
|
|
770
777
|
}) {
|
|
771
778
|
return /* @__PURE__ */ i(
|
|
772
|
-
|
|
779
|
+
Ae,
|
|
773
780
|
{
|
|
774
|
-
variant:
|
|
781
|
+
variant: ct[e],
|
|
775
782
|
color: e === "primary" ? "accent" : void 0,
|
|
776
783
|
size: "xs",
|
|
777
784
|
disabled: n,
|
|
@@ -782,7 +789,7 @@ function Tt({
|
|
|
782
789
|
}
|
|
783
790
|
);
|
|
784
791
|
}
|
|
785
|
-
function
|
|
792
|
+
function At({
|
|
786
793
|
children: t,
|
|
787
794
|
onClick: e,
|
|
788
795
|
disabled: n,
|
|
@@ -792,7 +799,7 @@ function Pt({
|
|
|
792
799
|
style: c
|
|
793
800
|
}) {
|
|
794
801
|
return /* @__PURE__ */ i(
|
|
795
|
-
|
|
802
|
+
Me,
|
|
796
803
|
{
|
|
797
804
|
variant: o === "circle" ? "light" : "subtle",
|
|
798
805
|
radius: o === "circle" ? "xl" : "sm",
|
|
@@ -813,7 +820,7 @@ const K = ae({
|
|
|
813
820
|
toggle: () => {
|
|
814
821
|
}
|
|
815
822
|
});
|
|
816
|
-
function
|
|
823
|
+
function ge({ expanded: t }) {
|
|
817
824
|
return /* @__PURE__ */ i(
|
|
818
825
|
"svg",
|
|
819
826
|
{
|
|
@@ -839,7 +846,7 @@ function ye({ expanded: t }) {
|
|
|
839
846
|
}
|
|
840
847
|
);
|
|
841
848
|
}
|
|
842
|
-
function
|
|
849
|
+
function Mt({
|
|
843
850
|
children: t,
|
|
844
851
|
variant: e = "default",
|
|
845
852
|
collapsible: n = !1,
|
|
@@ -848,12 +855,12 @@ function At({
|
|
|
848
855
|
onOpenChange: a,
|
|
849
856
|
style: c
|
|
850
857
|
}) {
|
|
851
|
-
const f = g(), [d, l] =
|
|
858
|
+
const f = g(), [d, l] = I(r), u = o ?? d, m = O(() => {
|
|
852
859
|
const v = !u;
|
|
853
860
|
o === void 0 && l(v), a == null || a(v);
|
|
854
861
|
}, [u, o, a]);
|
|
855
862
|
return /* @__PURE__ */ i(
|
|
856
|
-
|
|
863
|
+
Be,
|
|
857
864
|
{
|
|
858
865
|
withBorder: e !== "borderless",
|
|
859
866
|
radius: f.radius.md,
|
|
@@ -867,8 +874,8 @@ function At({
|
|
|
867
874
|
}
|
|
868
875
|
);
|
|
869
876
|
}
|
|
870
|
-
function
|
|
871
|
-
const r = g(), { collapsible: o, open: a, toggle: c } =
|
|
877
|
+
function Bt({ children: t, trailing: e, style: n }) {
|
|
878
|
+
const r = g(), { collapsible: o, open: a, toggle: c } = W(K);
|
|
872
879
|
return /* @__PURE__ */ y(
|
|
873
880
|
"div",
|
|
874
881
|
{
|
|
@@ -890,7 +897,7 @@ function Mt({ children: t, trailing: e, style: n }) {
|
|
|
890
897
|
},
|
|
891
898
|
children: [
|
|
892
899
|
/* @__PURE__ */ y("span", { style: { display: "inline-flex", alignItems: "center", gap: 6 }, children: [
|
|
893
|
-
o && /* @__PURE__ */ i(
|
|
900
|
+
o && /* @__PURE__ */ i(ge, { expanded: a }),
|
|
894
901
|
t
|
|
895
902
|
] }),
|
|
896
903
|
e != null && /* @__PURE__ */ i("span", { children: e })
|
|
@@ -898,28 +905,28 @@ function Mt({ children: t, trailing: e, style: n }) {
|
|
|
898
905
|
}
|
|
899
906
|
);
|
|
900
907
|
}
|
|
901
|
-
function
|
|
902
|
-
const { collapsible: n, open: r } =
|
|
908
|
+
function $t({ children: t, style: e }) {
|
|
909
|
+
const { collapsible: n, open: r } = W(K);
|
|
903
910
|
return n && !r ? null : /* @__PURE__ */ i("div", { style: { padding: 14, ...e }, children: t });
|
|
904
911
|
}
|
|
905
|
-
function
|
|
912
|
+
function Dt({ value: t, label: e, tone: n, style: r }) {
|
|
906
913
|
const o = g();
|
|
907
914
|
return /* @__PURE__ */ y("div", { style: r, children: [
|
|
908
915
|
/* @__PURE__ */ i(
|
|
909
|
-
|
|
916
|
+
z,
|
|
910
917
|
{
|
|
911
918
|
fz: 22,
|
|
912
919
|
fw: 700,
|
|
913
920
|
lh: 1.2,
|
|
914
921
|
style: {
|
|
915
|
-
color: n ?
|
|
922
|
+
color: n ? k[n] : o.text.primary,
|
|
916
923
|
fontFamily: o.typography.fontFamily
|
|
917
924
|
},
|
|
918
925
|
children: t
|
|
919
926
|
}
|
|
920
927
|
),
|
|
921
928
|
/* @__PURE__ */ i(
|
|
922
|
-
|
|
929
|
+
z,
|
|
923
930
|
{
|
|
924
931
|
fz: 12,
|
|
925
932
|
style: {
|
|
@@ -931,7 +938,7 @@ function $t({ value: t, label: e, tone: n, style: r }) {
|
|
|
931
938
|
)
|
|
932
939
|
] });
|
|
933
940
|
}
|
|
934
|
-
function
|
|
941
|
+
function It({
|
|
935
942
|
children: t,
|
|
936
943
|
active: e,
|
|
937
944
|
tone: n = "neutral",
|
|
@@ -943,7 +950,7 @@ function Dt({
|
|
|
943
950
|
onClick: d
|
|
944
951
|
}) {
|
|
945
952
|
return /* @__PURE__ */ i(
|
|
946
|
-
|
|
953
|
+
De,
|
|
947
954
|
{
|
|
948
955
|
color: ie[n],
|
|
949
956
|
variant: e ? "filled" : "light",
|
|
@@ -969,7 +976,7 @@ function Et({
|
|
|
969
976
|
style: o
|
|
970
977
|
}) {
|
|
971
978
|
return /* @__PURE__ */ i(
|
|
972
|
-
|
|
979
|
+
$e,
|
|
973
980
|
{
|
|
974
981
|
color: ie[e],
|
|
975
982
|
title: n,
|
|
@@ -980,7 +987,7 @@ function Et({
|
|
|
980
987
|
}
|
|
981
988
|
);
|
|
982
989
|
}
|
|
983
|
-
function
|
|
990
|
+
function Ft({
|
|
984
991
|
value: t,
|
|
985
992
|
onChange: e,
|
|
986
993
|
options: n,
|
|
@@ -1003,7 +1010,7 @@ function It({
|
|
|
1003
1010
|
}
|
|
1004
1011
|
);
|
|
1005
1012
|
}
|
|
1006
|
-
function
|
|
1013
|
+
function Rt({
|
|
1007
1014
|
checked: t,
|
|
1008
1015
|
onChange: e,
|
|
1009
1016
|
disabled: n,
|
|
@@ -1011,7 +1018,7 @@ function Ft({
|
|
|
1011
1018
|
style: o
|
|
1012
1019
|
}) {
|
|
1013
1020
|
return /* @__PURE__ */ i(
|
|
1014
|
-
|
|
1021
|
+
Ie,
|
|
1015
1022
|
{
|
|
1016
1023
|
checked: t,
|
|
1017
1024
|
disabled: n,
|
|
@@ -1021,7 +1028,7 @@ function Ft({
|
|
|
1021
1028
|
}
|
|
1022
1029
|
);
|
|
1023
1030
|
}
|
|
1024
|
-
function
|
|
1031
|
+
function _t({
|
|
1025
1032
|
checked: t,
|
|
1026
1033
|
onChange: e,
|
|
1027
1034
|
disabled: n,
|
|
@@ -1029,7 +1036,7 @@ function Nt({
|
|
|
1029
1036
|
style: o
|
|
1030
1037
|
}) {
|
|
1031
1038
|
return /* @__PURE__ */ i(
|
|
1032
|
-
|
|
1039
|
+
_e,
|
|
1033
1040
|
{
|
|
1034
1041
|
checked: t,
|
|
1035
1042
|
disabled: n,
|
|
@@ -1039,7 +1046,7 @@ function Nt({
|
|
|
1039
1046
|
}
|
|
1040
1047
|
);
|
|
1041
1048
|
}
|
|
1042
|
-
function
|
|
1049
|
+
function Nt({
|
|
1043
1050
|
value: t,
|
|
1044
1051
|
onChange: e,
|
|
1045
1052
|
placeholder: n,
|
|
@@ -1048,7 +1055,7 @@ function Rt({
|
|
|
1048
1055
|
style: a
|
|
1049
1056
|
}) {
|
|
1050
1057
|
return /* @__PURE__ */ i(
|
|
1051
|
-
|
|
1058
|
+
Re,
|
|
1052
1059
|
{
|
|
1053
1060
|
value: t,
|
|
1054
1061
|
placeholder: n,
|
|
@@ -1059,7 +1066,7 @@ function Rt({
|
|
|
1059
1066
|
}
|
|
1060
1067
|
);
|
|
1061
1068
|
}
|
|
1062
|
-
function
|
|
1069
|
+
function Ht({
|
|
1063
1070
|
value: t,
|
|
1064
1071
|
onChange: e,
|
|
1065
1072
|
placeholder: n,
|
|
@@ -1068,7 +1075,7 @@ function _t({
|
|
|
1068
1075
|
style: a
|
|
1069
1076
|
}) {
|
|
1070
1077
|
return /* @__PURE__ */ i(
|
|
1071
|
-
|
|
1078
|
+
Fe,
|
|
1072
1079
|
{
|
|
1073
1080
|
value: t,
|
|
1074
1081
|
placeholder: n,
|
|
@@ -1090,7 +1097,7 @@ const re = {
|
|
|
1090
1097
|
stretch: "stretch",
|
|
1091
1098
|
"space-between": "space-between"
|
|
1092
1099
|
};
|
|
1093
|
-
function
|
|
1100
|
+
function Ot({
|
|
1094
1101
|
children: t,
|
|
1095
1102
|
gap: e,
|
|
1096
1103
|
align: n = "center",
|
|
@@ -1099,7 +1106,7 @@ function Ht({
|
|
|
1099
1106
|
style: a
|
|
1100
1107
|
}) {
|
|
1101
1108
|
return /* @__PURE__ */ i(
|
|
1102
|
-
|
|
1109
|
+
He,
|
|
1103
1110
|
{
|
|
1104
1111
|
gap: e,
|
|
1105
1112
|
align: re[n],
|
|
@@ -1129,10 +1136,10 @@ function Gt({ children: t, columns: e, gap: n = 16, align: r, style: o }) {
|
|
|
1129
1136
|
}
|
|
1130
1137
|
);
|
|
1131
1138
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return /* @__PURE__ */ i(
|
|
1139
|
+
function jt({ style: t }) {
|
|
1140
|
+
return /* @__PURE__ */ i(Ne, { style: t });
|
|
1134
1141
|
}
|
|
1135
|
-
function
|
|
1142
|
+
function Kt({ color: t, style: e }) {
|
|
1136
1143
|
const n = g();
|
|
1137
1144
|
return /* @__PURE__ */ i(
|
|
1138
1145
|
"span",
|
|
@@ -1149,7 +1156,7 @@ function jt({ color: t, style: e }) {
|
|
|
1149
1156
|
}
|
|
1150
1157
|
);
|
|
1151
1158
|
}
|
|
1152
|
-
function
|
|
1159
|
+
function Vt({
|
|
1153
1160
|
segments: t,
|
|
1154
1161
|
total: e,
|
|
1155
1162
|
topLeftLabel: n,
|
|
@@ -1205,7 +1212,7 @@ function Kt({
|
|
|
1205
1212
|
] })
|
|
1206
1213
|
] });
|
|
1207
1214
|
}
|
|
1208
|
-
function
|
|
1215
|
+
function Xt({
|
|
1209
1216
|
title: t,
|
|
1210
1217
|
leading: e,
|
|
1211
1218
|
count: n,
|
|
@@ -1214,7 +1221,7 @@ function Vt({
|
|
|
1214
1221
|
defaultOpen: a = !1,
|
|
1215
1222
|
style: c
|
|
1216
1223
|
}) {
|
|
1217
|
-
const f = g(), [d, l] =
|
|
1224
|
+
const f = g(), [d, l] = I(a);
|
|
1218
1225
|
return /* @__PURE__ */ y("div", { style: c, children: [
|
|
1219
1226
|
/* @__PURE__ */ y(
|
|
1220
1227
|
"div",
|
|
@@ -1231,7 +1238,7 @@ function Vt({
|
|
|
1231
1238
|
fontSize: 14
|
|
1232
1239
|
},
|
|
1233
1240
|
children: [
|
|
1234
|
-
/* @__PURE__ */ i(
|
|
1241
|
+
/* @__PURE__ */ i(ge, { expanded: d }),
|
|
1235
1242
|
e,
|
|
1236
1243
|
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: t }),
|
|
1237
1244
|
n != null && /* @__PURE__ */ i("span", { style: { color: f.text.tertiary, fontSize: 12 }, children: n }),
|
|
@@ -1243,14 +1250,14 @@ function Vt({
|
|
|
1243
1250
|
d && /* @__PURE__ */ i("div", { style: { paddingLeft: 18, paddingBottom: 4 }, children: o })
|
|
1244
1251
|
] });
|
|
1245
1252
|
}
|
|
1246
|
-
const
|
|
1253
|
+
const dt = {
|
|
1247
1254
|
success: "rgba(31,138,101,0.12)",
|
|
1248
1255
|
danger: "rgba(207,45,86,0.12)",
|
|
1249
1256
|
warning: "rgba(232,163,61,0.14)",
|
|
1250
1257
|
info: "rgba(46,121,181,0.12)",
|
|
1251
1258
|
neutral: "rgba(136,136,168,0.12)"
|
|
1252
1259
|
};
|
|
1253
|
-
function
|
|
1260
|
+
function Yt({
|
|
1254
1261
|
headers: t,
|
|
1255
1262
|
rows: e,
|
|
1256
1263
|
columnAlign: n,
|
|
@@ -1277,7 +1284,7 @@ function Xt({
|
|
|
1277
1284
|
return /* @__PURE__ */ i(
|
|
1278
1285
|
T.Tr,
|
|
1279
1286
|
{
|
|
1280
|
-
style: m ? { background:
|
|
1287
|
+
style: m ? { background: dt[m] } : void 0,
|
|
1281
1288
|
children: t.map((v, h) => /* @__PURE__ */ i(
|
|
1282
1289
|
T.Td,
|
|
1283
1290
|
{
|
|
@@ -1306,25 +1313,25 @@ function V(t, e, n) {
|
|
|
1306
1313
|
...n
|
|
1307
1314
|
};
|
|
1308
1315
|
}
|
|
1309
|
-
function Yt({ children: t, style: e }) {
|
|
1310
|
-
const n = g();
|
|
1311
|
-
return /* @__PURE__ */ i(O, { order: 1, style: V(n, "h1", e), children: t });
|
|
1312
|
-
}
|
|
1313
1316
|
function qt({ children: t, style: e }) {
|
|
1314
1317
|
const n = g();
|
|
1315
|
-
return /* @__PURE__ */ i(
|
|
1318
|
+
return /* @__PURE__ */ i(G, { order: 1, style: V(n, "h1", e), children: t });
|
|
1316
1319
|
}
|
|
1317
1320
|
function Zt({ children: t, style: e }) {
|
|
1318
1321
|
const n = g();
|
|
1319
|
-
return /* @__PURE__ */ i(
|
|
1322
|
+
return /* @__PURE__ */ i(G, { order: 2, style: V(n, "h2", e), children: t });
|
|
1320
1323
|
}
|
|
1321
|
-
|
|
1324
|
+
function Jt({ children: t, style: e }) {
|
|
1325
|
+
const n = g();
|
|
1326
|
+
return /* @__PURE__ */ i(G, { order: 3, style: V(n, "h3", e), children: t });
|
|
1327
|
+
}
|
|
1328
|
+
const ut = {
|
|
1322
1329
|
normal: 400,
|
|
1323
1330
|
medium: 500,
|
|
1324
1331
|
semibold: 600,
|
|
1325
1332
|
bold: 700
|
|
1326
1333
|
}, oe = ae(!1);
|
|
1327
|
-
function
|
|
1334
|
+
function Ut({
|
|
1328
1335
|
children: t,
|
|
1329
1336
|
tone: e = "primary",
|
|
1330
1337
|
size: n = "body",
|
|
@@ -1334,13 +1341,13 @@ function Jt({
|
|
|
1334
1341
|
truncate: c,
|
|
1335
1342
|
style: f
|
|
1336
1343
|
}) {
|
|
1337
|
-
const d = g(), u =
|
|
1344
|
+
const d = g(), u = W(oe) && r === "p" ? "span" : r, m = r === "p";
|
|
1338
1345
|
return /* @__PURE__ */ i(oe.Provider, { value: !0, children: /* @__PURE__ */ i(
|
|
1339
|
-
|
|
1346
|
+
z,
|
|
1340
1347
|
{
|
|
1341
1348
|
component: u,
|
|
1342
1349
|
size: n === "small" ? "xs" : "sm",
|
|
1343
|
-
fw:
|
|
1350
|
+
fw: ut[o],
|
|
1344
1351
|
c: e === "primary" ? void 0 : d.text[e],
|
|
1345
1352
|
truncate: c,
|
|
1346
1353
|
style: {
|
|
@@ -1354,7 +1361,7 @@ function Jt({
|
|
|
1354
1361
|
}
|
|
1355
1362
|
) });
|
|
1356
1363
|
}
|
|
1357
|
-
function
|
|
1364
|
+
function Qt({ children: t, style: e }) {
|
|
1358
1365
|
const n = g();
|
|
1359
1366
|
return /* @__PURE__ */ i(
|
|
1360
1367
|
"code",
|
|
@@ -1372,7 +1379,7 @@ function Ut({ children: t, style: e }) {
|
|
|
1372
1379
|
}
|
|
1373
1380
|
);
|
|
1374
1381
|
}
|
|
1375
|
-
function
|
|
1382
|
+
function en({ children: t, href: e, style: n }) {
|
|
1376
1383
|
const r = g();
|
|
1377
1384
|
return /* @__PURE__ */ i(
|
|
1378
1385
|
"a",
|
|
@@ -1386,58 +1393,58 @@ function Qt({ children: t, href: e, style: n }) {
|
|
|
1386
1393
|
);
|
|
1387
1394
|
}
|
|
1388
1395
|
export {
|
|
1389
|
-
|
|
1390
|
-
|
|
1396
|
+
bt as BarChart,
|
|
1397
|
+
Pt as Button,
|
|
1391
1398
|
Et as Callout,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1399
|
+
Mt as Card,
|
|
1400
|
+
$t as CardBody,
|
|
1401
|
+
Bt as CardHeader,
|
|
1402
|
+
Rt as Checkbox,
|
|
1403
|
+
Qt as Code,
|
|
1404
|
+
Xt as CollapsibleSection,
|
|
1405
|
+
wt as DiffStats,
|
|
1406
|
+
Lt as DiffView,
|
|
1407
|
+
jt as Divider,
|
|
1401
1408
|
Gt as Grid,
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1409
|
+
qt as H1,
|
|
1410
|
+
Zt as H2,
|
|
1411
|
+
Jt as H3,
|
|
1412
|
+
At as IconButton,
|
|
1413
|
+
St as LineChart,
|
|
1414
|
+
en as Link,
|
|
1415
|
+
Ct as PieChart,
|
|
1416
|
+
It as Pill,
|
|
1417
|
+
Ot as Row,
|
|
1418
|
+
Ft as Select,
|
|
1412
1419
|
Wt as Spacer,
|
|
1413
1420
|
zt as Stack,
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1421
|
+
Dt as Stat,
|
|
1422
|
+
Kt as Swatch,
|
|
1423
|
+
Yt as Table,
|
|
1424
|
+
Ut as Text,
|
|
1425
|
+
Ht as TextArea,
|
|
1426
|
+
Nt as TextInput,
|
|
1427
|
+
lt as TodoList,
|
|
1428
|
+
Tt as TodoListCard,
|
|
1429
|
+
_t as Toggle,
|
|
1430
|
+
Vt as UsageBar,
|
|
1431
|
+
cn as canvasPaletteDark,
|
|
1432
|
+
dn as canvasPaletteGrokDark,
|
|
1433
|
+
un as canvasPaletteGrokLight,
|
|
1434
|
+
fn as canvasPaletteLight,
|
|
1435
|
+
hn as canvasTokens,
|
|
1436
|
+
pn as canvasTokensLight,
|
|
1437
|
+
yn as categoryPaletteDark,
|
|
1438
|
+
gn as categoryPaletteLight,
|
|
1439
|
+
mn as colorPalette,
|
|
1433
1440
|
kt as computeDAGLayout,
|
|
1434
|
-
|
|
1441
|
+
vt as mergeStyle,
|
|
1435
1442
|
ne as usageColorSequence,
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1443
|
+
xt as useCanvasAction,
|
|
1444
|
+
mt as useCanvasState,
|
|
1445
|
+
rn as useEffect,
|
|
1439
1446
|
g as useHostTheme,
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1447
|
+
on as useMemo,
|
|
1448
|
+
an as useRef,
|
|
1449
|
+
sn as useState
|
|
1443
1450
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { renderWithProvider } from '../../test/render'
|
|
3
|
+
import { BarChart } from '../bar-chart'
|
|
4
|
+
import { CHART_LEGEND_PROPS, CHART_TOOLTIP_PROPS } from '../chart-shared'
|
|
5
|
+
import { LineChart } from '../line-chart'
|
|
6
|
+
|
|
7
|
+
describe('chart label order', () => {
|
|
8
|
+
it('disables Recharts default legend and tooltip sorters', () => {
|
|
9
|
+
expect(CHART_LEGEND_PROPS.itemSorter).toBeNull()
|
|
10
|
+
expect(CHART_TOOLTIP_PROPS.itemSorter).toBeNull()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const series = [
|
|
14
|
+
{ name: 'Off-heap reclaimed', data: [12, 18], tone: 'info' as const },
|
|
15
|
+
{ name: 'Heap reclaimed', data: [58, 55], tone: 'warning' as const },
|
|
16
|
+
]
|
|
17
|
+
const categories = ['T+5s', 'T+10s']
|
|
18
|
+
const seriesNames = series.map(s => s.name)
|
|
19
|
+
|
|
20
|
+
it.each([
|
|
21
|
+
['LineChart', LineChart],
|
|
22
|
+
['BarChart', BarChart],
|
|
23
|
+
] as const)('keeps %s legend order in source series order', (_, Chart) => {
|
|
24
|
+
const { container } = renderWithProvider(
|
|
25
|
+
<Chart categories={categories} series={series} height={160} />,
|
|
26
|
+
)
|
|
27
|
+
const legend = container.querySelector('[class*="ChartLegend-legend"]')
|
|
28
|
+
expect(legend).toBeTruthy()
|
|
29
|
+
const names = legend!.querySelectorAll(
|
|
30
|
+
'[class*="ChartLegend-legendItemName"]',
|
|
31
|
+
)
|
|
32
|
+
expect([...names].map(el => el.textContent?.trim())).toEqual(seriesNames)
|
|
33
|
+
})
|
|
34
|
+
})
|
package/src/shim/bar-chart.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BarChart as MantineBarChart } from '@mantine/charts'
|
|
2
2
|
import '@mantine/charts/styles.css'
|
|
3
3
|
import type { BarChartProps } from '../superset/index'
|
|
4
|
-
import { barValueLabelProps, CHART_LEGEND_PROPS, CHART_LEGEND_STYLES, defaultShowBarValues, horizontalBarProps, horizontalBarValueLabelProps, reshapeLineChartData, toMantineSeries, useChartColorProps, useSeriesColor, valueAxisChartProps, valueFormatter, verticalBarLabelProps, withPerCategoryBarColors } from './chart-shared'
|
|
4
|
+
import { barValueLabelProps, CHART_LEGEND_PROPS, CHART_LEGEND_STYLES, CHART_TOOLTIP_PROPS, defaultShowBarValues, horizontalBarProps, horizontalBarValueLabelProps, reshapeLineChartData, toMantineSeries, useChartColorProps, useSeriesColor, valueAxisChartProps, valueFormatter, verticalBarLabelProps, withPerCategoryBarColors } from './chart-shared'
|
|
5
5
|
|
|
6
6
|
export function BarChart({
|
|
7
7
|
categories,
|
|
@@ -52,6 +52,7 @@ export function BarChart({
|
|
|
52
52
|
orientation={horizontal ? 'vertical' : 'horizontal'}
|
|
53
53
|
withLegend={series.length > 1}
|
|
54
54
|
legendProps={CHART_LEGEND_PROPS}
|
|
55
|
+
tooltipProps={CHART_TOOLTIP_PROPS}
|
|
55
56
|
valueFormatter={valueFormatter(valueSuffix, valuePrefix)}
|
|
56
57
|
withBarValueLabel={withBarValueLabel}
|
|
57
58
|
{...(withBarValueLabel
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Shared chart data shaping and axis helpers (no @mantine/charts component imports).
|
|
3
3
|
*/
|
|
4
4
|
import type { ChartReferenceLineProps } from '@mantine/charts'
|
|
5
|
-
import type { XAxisProps, YAxisProps } from 'recharts'
|
|
5
|
+
import type { LegendProps, XAxisProps, YAxisProps } from 'recharts'
|
|
6
6
|
import type { CanvasChartValueAxisExtra } from '../superset/chart-extra'
|
|
7
7
|
import type { BarChartProps } from '../superset/index'
|
|
8
8
|
import { toneHex } from './theme'
|
|
@@ -26,9 +26,16 @@ export type {
|
|
|
26
26
|
|
|
27
27
|
import type { ChartReferenceLine, ChartSeries, ChartTone } from '../vendor/canvas-sdk/chart-primitives.js'
|
|
28
28
|
|
|
29
|
+
/** Recharts 3 defaults to sorting legend rows; keep SDK `series[]` order. */
|
|
29
30
|
export const CHART_LEGEND_PROPS = {
|
|
30
31
|
verticalAlign: 'bottom' as const,
|
|
31
32
|
align: 'center' as const,
|
|
33
|
+
itemSorter: null,
|
|
34
|
+
} satisfies Pick<LegendProps, 'verticalAlign' | 'align' | 'itemSorter'>
|
|
35
|
+
|
|
36
|
+
/** Same for tooltip series rows (default `itemSorter: 'name'`). `null` disables sort at runtime. */
|
|
37
|
+
export const CHART_TOOLTIP_PROPS = {
|
|
38
|
+
itemSorter: null as never,
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
export const CHART_LEGEND_STYLES = {
|
package/src/shim/line-chart.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { LineChartCurveType } from '@mantine/charts'
|
|
|
2
2
|
import { AreaChart, LineChart as MantineLineChart } from '@mantine/charts'
|
|
3
3
|
import '@mantine/charts/styles.css'
|
|
4
4
|
import type { LineChartProps } from '../superset/index'
|
|
5
|
-
import { CHART_LEGEND_PROPS, CHART_LEGEND_STYLES, reshapeLineChartData, toMantineSeries, useChartColorProps, useSeriesColor, valueAxisChartProps, valueFormatter } from './chart-shared'
|
|
5
|
+
import { CHART_LEGEND_PROPS, CHART_LEGEND_STYLES, CHART_TOOLTIP_PROPS, reshapeLineChartData, toMantineSeries, useChartColorProps, useSeriesColor, valueAxisChartProps, valueFormatter } from './chart-shared'
|
|
6
6
|
|
|
7
7
|
export function LineChart({
|
|
8
8
|
categories,
|
|
@@ -46,7 +46,10 @@ export function LineChart({
|
|
|
46
46
|
legendProps: CHART_LEGEND_PROPS,
|
|
47
47
|
valueFormatter: valueFormatter(valueSuffix, valuePrefix),
|
|
48
48
|
withPointLabels: showValues ?? categories.length <= 20,
|
|
49
|
-
tooltipProps:
|
|
49
|
+
tooltipProps: {
|
|
50
|
+
...CHART_TOOLTIP_PROPS,
|
|
51
|
+
...(!showHoverGuide && { cursor: false }),
|
|
52
|
+
},
|
|
50
53
|
styles: {
|
|
51
54
|
...CHART_LEGEND_STYLES,
|
|
52
55
|
legendItemName: { color: chartColors.textColor },
|