@flesler/cursor-canvas-web 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cursor-canvas-web.css +1 -0
- package/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +530 -565
- package/dist/pie-donut-DNbA0GeH.cjs +1 -0
- package/dist/pie-donut-qRBFP0tT.js +63 -0
- package/package.json +6 -2
- package/src/runtime/index.tsx +64 -0
- package/src/shim/__tests__/barChart.test.ts +61 -0
- package/src/shim/__tests__/canvas.smoke.test.tsx +209 -0
- package/src/shim/__tests__/category-theme.test.tsx +58 -0
- package/src/shim/__tests__/dag.test.ts +49 -0
- package/src/shim/__tests__/host-tokens.test.ts +106 -0
- package/src/shim/__tests__/lineChart.test.ts +28 -0
- package/src/shim/__tests__/useCanvasState.test.tsx +35 -0
- package/src/shim/__tests__/useHostTheme.test.tsx +43 -0
- package/src/shim/__tests__/valueAxis.test.ts +39 -0
- package/src/shim/bar-chart.tsx +77 -0
- package/src/shim/canvas-hooks.tsx +57 -0
- package/src/shim/canvas-mantine-root.tsx +129 -0
- package/src/shim/chart-shared.tsx +252 -0
- package/src/shim/cursor-canvas.tsx +136 -0
- package/src/shim/dag.ts +179 -0
- package/src/shim/diff.tsx +161 -0
- package/src/shim/host-tokens.ts +614 -0
- package/src/shim/line-chart.tsx +62 -0
- package/src/shim/pie-chart.tsx +127 -0
- package/src/shim/pie-donut.tsx +79 -0
- package/src/shim/theme.ts +77 -0
- package/src/shim/todo.tsx +184 -0
- package/src/shim/ui/actions.tsx +58 -0
- package/src/shim/ui/card-context.tsx +11 -0
- package/src/shim/ui/card.tsx +79 -0
- package/src/shim/ui/chevron.tsx +23 -0
- package/src/shim/ui/display.tsx +83 -0
- package/src/shim/ui/form.tsx +102 -0
- package/src/shim/ui/layout.tsx +67 -0
- package/src/shim/ui/rich.tsx +136 -0
- package/src/shim/ui/table.tsx +71 -0
- package/src/shim/ui/typography.tsx +129 -0
- package/src/shim/use-tokens.ts +13 -0
- package/src/superset/chart-extra.d.ts +11 -11
- package/src/superset/index.d.ts +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.m_e4d36c9b{min-width:calc(12.5rem * var(--mantine-scale));background-color:var(--mantine-color-body);box-shadow:var(--mantine-shadow-md);border-radius:var(--mantine-radius-default)}:where([data-mantine-color-scheme=light]) .m_e4d36c9b{border:1px solid var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_e4d36c9b{border:1px solid var(--mantine-color-dark-4)}.m_7f4bcb19{padding:var(--mantine-spacing-xs) var(--mantine-spacing-md);font-size:var(--mantine-font-size-md);font-weight:500;color:var(--mantine-color-bright)}.m_3de554dd{padding:var(--mantine-spacing-sm) var(--mantine-spacing-md);padding-top:0}.m_e4d36c9b:where([data-type=radial]) :where(.m_3de554dd){padding-top:var(--mantine-spacing-sm)}.m_b30369b5{width:calc(.75rem * var(--mantine-scale));height:calc(.75rem * var(--mantine-scale));min-width:calc(.75rem * var(--mantine-scale));min-height:calc(.75rem * var(--mantine-scale))}.m_3de8964e{font-size:var(--mantine-font-size-sm);display:flex;align-items:center;justify-content:space-between}.m_3de8964e:where(.m_3de8964e+.m_3de8964e){margin-top:calc(var(--mantine-spacing-sm) / 2)}.m_3de8964e[data-type=scatter] .m_b30369b5{display:none}.m_50186d10{display:flex;align-items:center;gap:var(--mantine-spacing-sm);margin-inline-end:var(--mantine-spacing-xl)}.m_501dadf9{color:var(--mantine-color-text);font-size:var(--mantine-font-size-sm)}.m_50192318{color:var(--mantine-color-bright)}.m_847eaf{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;height:100%}.m_847eaf:where([data-centered]){justify-content:center}.m_847eaf:where([data-position=top]){padding-bottom:var(--mantine-spacing-md)}.m_847eaf:where([data-position=bottom]){padding-top:var(--mantine-spacing-md)}.m_17da7e62{display:flex;align-items:center;gap:calc(.4375rem * var(--mantine-scale));padding:7px var(--mantine-spacing-xs);border-radius:var(--mantine-radius-default);line-height:1}@media(hover:hover){:where([data-mantine-color-scheme=light]) .m_17da7e62:where(:hover){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_17da7e62:where(:hover){background-color:var(--mantine-color-dark-5)}}@media(hover:none){:where([data-mantine-color-scheme=light]) .m_17da7e62:where(:active){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_17da7e62:where(:active){background-color:var(--mantine-color-dark-5)}}.m_17da7e62[data-without-color] .m_6e236e21{display:none}.m_8ff56c0d{font-size:var(--mantine-font-size-sm);margin:0;padding:0}.m_a50f3e58{display:block;width:100%;--chart-bar-label-color: var(--mantine-color-dimmed)}.m_a50f3e58 svg{overflow:visible}:where([data-mantine-color-scheme=light]) .m_a50f3e58{--chart-grid-color: rgba(173, 181, 189, .6);--chart-cursor-fill: rgba(173, 181, 189, .15)}:where([data-mantine-color-scheme=dark]) .m_a50f3e58{--chart-cursor-fill: rgba(105, 105, 105, .15);--chart-grid-color: rgba(105, 105, 105, .6)}.m_a50f3e58 :where(text){font-family:var(--mantine-font-family);color:var(--chart-text-color, var(--mantine-color-dimmed))}.m_af9188cb{height:100%;width:100%}.m_a50a48bc{stroke:var(--chart-grid-color)}.m_a507a517{color:var(--chart-grid-color)}.m_2293801d{color:var(--chart-text-color, var(--mantine-color-dimmed))}.m_92b296cd{min-width:calc(12.5rem * var(--mantine-scale));background-color:var(--mantine-color-body);box-shadow:var(--mantine-shadow-md);border-radius:var(--mantine-radius-default);padding:var(--mantine-spacing-sm)}:where([data-mantine-color-scheme=light]) .m_92b296cd{border:1px solid var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_92b296cd{border:1px solid var(--mantine-color-dark-4)}.m_a410e613{min-height:var(--chart-size, auto);height:var(--chart-size, auto);width:var(--chart-size, auto);min-width:var(--chart-size, auto)}.m_a410e613 :where(*){outline:0}.m_ddb0bfe3{fill:var(--mantine-color-text);font-size:var(--mantine-font-size-sm)}.m_cd8943fd{min-height:var(--chart-size, auto);height:var(--chart-size, auto);width:var(--chart-size, auto);min-width:var(--chart-size, auto)}.m_cd8943fd :where(*){outline:0}:where([data-mantine-color-scheme=light]) .m_1f271cf7{--chart-grid-color: rgba(173, 181, 189, .6);--chart-text-color: var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_1f271cf7{--chart-grid-color: rgba(105, 105, 105, .6);--chart-text-color: var(--mantine-color-dark-1)}.m_1f271cf7 :where(text){font-size:var(--mantine-font-size-xs);fill:var(--chart-text-color, var(--mantine-color-dimmed));-webkit-user-select:none;user-select:none}.m_cf06f58c{height:100%;width:100%}:where([data-mantine-color-scheme=light]) .m_cd2bd9e5{--chart-empty-background: var(--mantine-color-gray-1);--chart-cursor-color: var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_cd2bd9e5{--chart-empty-background: var(--mantine-color-dark-6);--chart-cursor-color: var(--mantine-color-dark-4)}.m_6bcc3420{padding:var(--mantine-spacing-md);box-shadow:var(--mantine-shadow-md);min-width:calc(12.5rem * var(--mantine-scale));font-size:var(--mantine-font-size-sm);display:flex;align-items:center;justify-content:space-between}:where([data-mantine-color-scheme=light]) .m_6bcc3420{border:1px solid var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_6bcc3420{border:1px solid var(--mantine-color-dark-4)}.m_80d531e7{min-height:var(--chart-size, auto);height:var(--chart-size, auto);width:var(--chart-size, auto);min-width:var(--chart-size, auto)}.m_80d531e7 :where(*){outline:0}.m_2ef228c3{display:block;width:fit-content}:where([data-mantine-color-scheme=light]) .m_2ef228c3{--heatmap-level-1: rgba(81, 207, 102, .3);--heatmap-level-2: rgba(64, 192, 87, .45);--heatmap-level-3: rgba(55, 178, 77, .75);--heatmap-level-4: rgba(43, 138, 62, 1)}:where([data-mantine-color-scheme=dark]) .m_2ef228c3{--heatmap-level-1: rgba(43, 138, 62, .3);--heatmap-level-2: rgba(47, 158, 68, .45);--heatmap-level-3: rgba(55, 178, 77, .75);--heatmap-level-4: rgba(81, 207, 102, 1)}.m_2ef201c5{stroke-width:calc(.0625rem * var(--mantine-scale))}:where([data-mantine-color-scheme=light]) .m_2ef201c5{--heatmap-empty-rect-bg: var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_2ef201c5{--heatmap-empty-rect-bg: var(--mantine-color-dark-5)}.m_2ef201c5:where([data-empty]){fill:var(--heatmap-empty-rect-bg)}.m_7e977775,.m_c4b68f8d{cursor:default;-webkit-user-select:none;user-select:none;fill:var(--mantine-color-dimmed)}
|
package/dist/cursor-canvas.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("@mantine/core"),m=require("react"),k=require("./host-tokens-Lz69pkRj.cjs"),E=require("@mantine/charts"),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 g(){const e=p.useComputedColorScheme("light")==="dark"?"dark":"light";return k.resolveThemeForColorScheme(e)}const ne={verticalAlign:"bottom",align:"center"},re={legend:{justifyContent:"center"}};function G(){const e=g().chart.sequence;return(n,o)=>n?T[n]:e[o%e.length]}function oe(){const e=g().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 ye(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 ge=new Set(["log","symlog","pow","sqrt"]);function xe(t){const{scale:e}=t;return typeof e!="string"||!ge.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=ye(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?xe(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 me(t,e,n){return t!==void 0?t:e.length===1&&n.length<=8}function be(t,e,n){return e.length!==1||e[0].tone?t:t.map((o,s)=>({...o,color:n(void 0,s)}))}const je=96,ve=6.5;function Se(t,e){return t.length<=e?t:`${t.slice(0,e-1)}…`}function Ce(t,e){var l;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(((l=e.payload)==null?void 0:l.value)??""),a=Se(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 ke(t){return{...ce(t),position:"right"}}function Te(t=je,e=!1){const n=Math.floor(t/ve);return{yAxisProps:{tick:o=>Ce(n,o),width:t},barChartProps:{margin:{right:e?48:32}},gridAxis:"y"}}function we(){return{barChartProps:{margin:{top:22}}}}function Le({categories:t,series:e,height:n=240,fill:o,valueSuffix:s,valuePrefix:a,showValues:l,showHoverGuide:f=!0,beginAtZero:u,yMin:c,yMax:d,referenceLines:x,style:j,extra:h,smooth:v}){const w=(h==null?void 0:h.smooth)??v,L=G(),P=oe(),B=se(t,e),I=ae(e,L),S=!!(o&&(h!=null&&h.stacked)),A=le({beginAtZero:u,yMin:c,yMax:d,referenceLines:x,horizontal:!1,stacked:S,valueAxis:h==null?void 0:h.valueAxis}),M={h:n,data:B,dataKey:"category",series:I,curveType:w?"monotone":"linear",withLegend:e.length>1,legendProps:ne,valueFormatter:ie(s,a),withPointLabels:l??t.length<=20,tooltipProps:f?void 0:{cursor:!1},styles:{...re,legendItemName:{color:P.textColor}},...A,style:j};return o?r.jsx(E.AreaChart,{...M,type:S?"stacked":"default"}):r.jsx(E.LineChart,{...M})}function Pe({categories:t,series:e,height:n=240,stacked:o,horizontal:s,normalized:a,valueSuffix:l,valuePrefix:f,showValues:u,beginAtZero:c,yMin:d,yMax:x,referenceLines:j,style:h,extra:v}){var A;const w=G(),L=oe(),P=be(se(t,e),e,w),B=a?"percent":o?"stacked":"default",I=le({beginAtZero:c,yMin:d,yMax:x,referenceLines:j,horizontal:s,stacked:o,normalized:a,valueAxis:v==null?void 0:v.valueAxis}),S=!o&&!a&&me(u,e,t);return r.jsx(E.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(l,f),withBarValueLabel:S,...S?{valueLabelProps:s?ke(L.barLabelColor):ce(L.barLabelColor)}:{},...s?Te((A=v==null?void 0:v.categoryAxis)==null?void 0:A.width,S):S?we():{},styles:{...re,legendItemName:{color:L.textColor}},...I,style:h})}const Ae=180,Me=540;function Be(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 De(t){return Math.max(28,Math.round(t*.22))}function Ee(t){return t.map(e=>({dataKey:e.name,value:e.name,color:e.color,type:"circle"}))}function Ie(t,e){return t.map(n=>({name:n.name,color:n.color,label:`${n.name} ${Be(n.value,e)}`}))}function Fe({total:t,family:e,primary:n,subtitle:o}){return r.jsxs("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"central",fontFamily:e,children:[r.jsx("tspan",{x:"50%",dy:"-0.4em",fontSize:20,fontWeight:600,fill:n,children:t}),r.jsx("tspan",{x:"50%",dy:"1.55em",fontSize:16,fontWeight:500,fill:o,children:"Total"})]})}function He({data:t,size:e=200,donut:n,style:o}){const[s,a]=m.useState(null),l=g(),f=G(),u=t.map((h,v)=>({name:h.label,value:h.value,color:f(h.tone,v)})),c=u.reduce((h,v)=>h+v.value,0),d={startAngle:Ae,endAngle:Me},x=h=>({opacity:s===null||s===h?1:.35}),j=n?r.jsx(E.DonutChart,{data:u,size:e,thickness:De(e),withTooltip:!0,cellProps:h=>x(h.name),...d,children:r.jsx(Fe,{total:c,family:l.typography.fontFamily,primary:l.text.primary,subtitle:l.text.secondary})}):r.jsx(E.PieChart,{data:u,size:e,withTooltip:!0,withLabelsLine:!1,cellProps:h=>x(h.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:j}),r.jsx(E.ChartLegend,{payload:Ee(u),series:Ie(u,c),legendPosition:"bottom",centered:!0,onHighlight:a,mt:"sm",w:"100%",styles:{legend:{justifyContent:"center",gap:12,color:l.text.primary},legendItemName:{color:l.text.primary}}})]})}function Re(t){const{nodes:e,edges:n,direction:o="vertical",nodeWidth:s=160,nodeHeight:a=40,rankGap:l=64,nodeGap:f=48,padding:u=24}=t,c=e.map(i=>i.id),d=new Set(c),x=new Map;for(const i of c)x.set(i,[]);for(const i of n)d.has(i.from)&&d.has(i.to)&&x.get(i.from).push(i.to);const j=0,h=1,v=2,w=new Map(c.map(i=>[i,j])),L=new Set,P=(i,y)=>`${i}\0${y}`,B=i=>{w.set(i,h);for(const y of x.get(i)??[]){const b=w.get(y);b===h?L.add(P(i,y)):b===j&&B(y)}w.set(i,v)};for(const i of c)w.get(i)===j&&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(c.map(i=>[i,0])),A=new Map(c.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(c.map(i=>[i,0])),N=c.filter(i=>(S.get(i)??0)===0);for(;N.length>0;){const i=N.shift(),y=M.get(i);for(const b of A.get(i))M.set(b,Math.max(M.get(b),y+1)),S.set(b,S.get(b)-1),S.get(b)===0&&N.push(b)}const D=new Map;for(const i of c){const y=M.get(i);D.has(y)||D.set(y,[]),D.get(y).push(i)}const F=[...D.keys()].sort((i,y)=>i-y),C=o==="vertical",$=i=>i*(C?s:a)+Math.max(0,i-1)*f,q=Math.max(0,...F.map(i=>$(D.get(i).length))),H=new Map,V=[];F.forEach((i,y)=>{const b=D.get(i),_=$(b.length),z=u+(q-_)/2,R=u+y*((C?a:s)+l);b.forEach((U,Z)=>{const J=z+Z*((C?s:a)+f),he=C?J:R,pe=C?R:J;H.set(U,{id:U,x:he,y:pe,rank:i,order:Z})}),V.push({rank:i,x:C?z:R,y:C?R:z,width:C?_:s,height:C?a:_,nodeIds:b})});const K=(i,y)=>i?C?{x:i.x+s/2,y:y==="source"?i.y+a:i.y}:{x:y==="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 y=K(H.get(i.from),"source"),b=K(H.get(i.to),"target");return{from:i.from,to:i.to,sourceX:y.x,sourceY:y.y,targetX:b.x,targetY:b.y,isBackEdge:L.has(P(i.from,i.to))}}),X=u*2+F.length*(C?a:s)+Math.max(0,F.length-1)*l,Y=u*2+q;return{nodes:[...H.values()],edges:fe,ranks:V,direction:o,width:C?Y:X,height:C?X:Y}}function Ne({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 _e={added:"+",removed:"-",unchanged:" "};function ze({lines:t,showLineNumbers:e=!0,coloredLineNumbers:n=!0,showAccentStrip:o=!0,style:s}){const a=g(),l=c=>c==="added"?a.diff.insertedLine:c==="removed"?a.diff.removedLine:"transparent",f=c=>c==="added"?a.diff.stripAdded:c==="removed"?a.diff.stripRemoved:"transparent",u=c=>n&&c==="added"?T.added:n&&c==="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((c,d)=>r.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:o?`3px solid ${f(c.type)}`:void 0},children:[e&&r.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:u(c.type)},children:c.lineNumber??""}),r.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:u(c.type)},children:_e[c.type]}),r.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},d))})}function Ge({status:t}){const e=g(),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=g();return t.length===0?null:r.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:t.map(a=>{const l=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:l?.45:1},children:[r.jsx(Ge,{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 Oe({todos:t,dimmedTodoIds:e,defaultExpanded:n=!1,onTodoClick:o,style:s}){const a=g(),[l,f]=m.useState(n);if(t.length===0)return null;const u=t.filter(c=>c.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(c=>!c),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:l?"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"]})]}),l&&r.jsx("div",{style:{padding:6},children:r.jsx(ue,{todos:t,dimmedTodoIds:e,onTodoClick:o})})]})}function We(t,e){const n=`canvas:${t}`,[o,s]=m.useState(()=>{if(typeof localStorage>"u")return e;try{const l=localStorage.getItem(n);return l===null?e:JSON.parse(l)}catch{return e}}),a=m.useCallback(l=>{s(f=>{const u=typeof l=="function"?l(f):l;try{localStorage==null||localStorage.setItem(n,JSON.stringify(u))}catch{}return u})},[n]);return[o,a]}function $e(){return m.useCallback(t=>{},[])}function qe(t,e){return{...t,...e}}function O(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 Ve({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:1,style:O(n,"h1",e),children:t})}function Ke({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:2,style:O(n,"h2",e),children:t})}function Xe({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:3,style:O(n,"h3",e),children:t})}const Ye={normal:400,medium:500,semibold:600,bold:700},Q=m.createContext(!1);function Ue({children:t,tone:e="primary",size:n="body",as:o="p",weight:s="normal",italic:a,truncate:l,style:f}){const u=g(),d=m.useContext(Q)&&o==="p"?"span":o,x=o==="p";return r.jsx(Q.Provider,{value:!0,children:r.jsx(p.Text,{component:d,size:n==="small"?"xs":"sm",fw:Ye[s],c:e==="primary"?void 0:u.text[e],truncate:l,style:{fontStyle:a?"italic":void 0,...e==="primary"?{color:u.text.primary}:void 0,...x&&d==="span"?{display:"block"}:void 0,fontFamily:u.typography.fontFamily,...f},children:t})})}function Ze({children:t,style:e}){const n=g();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 Je({children:t,href:e,style:n}){const o=g();return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...n},children:t})}function Qe({children:t,gap:e,style:n}){return r.jsx(p.Stack,{gap:e,style:n,children:t})}const ee={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function et({children:t,gap:e,align:n="center",justify:o="start",wrap:s=!1,style:a}){return r.jsx(p.Group,{gap:e,align:ee[n],justify:ee[o],wrap:s?"wrap":"nowrap",style:a,children:t})}function tt(){return r.jsx("div",{style:{flex:1}})}function nt({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 rt({style:t}){return r.jsx(p.Divider,{style:t})}const W=m.createContext({collapsible:!1,open:!0,toggle:()=>{}});function ot({children:t,variant:e="default",collapsible:n=!1,defaultOpen:o=!0,open:s,onOpenChange:a,style:l}){const f=g(),[u,c]=m.useState(o),d=s??u,x=m.useCallback(()=>{const j=!d;s===void 0&&c(j),a==null||a(j)},[d,s,a]);return r.jsx(p.Card,{withBorder:e!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...l},children:r.jsx(W.Provider,{value:{collapsible:n,open:d,toggle:x},children:t})})}function st({children:t,trailing:e,style:n}){const o=g(),{collapsible:s,open:a,toggle:l}=m.useContext(W);return r.jsxs("div",{onClick:s?l: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 at({children:t,style:e}){const{collapsible:n,open:o}=m.useContext(W);return n&&!o?null:r.jsx("div",{style:{padding:14,...e},children:t})}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 it({value:t,label:e,tone:n,style:o}){const s=g();return r.jsxs("div",{style:o,children:[r.jsx(p.Text,{fz:22,fw:700,lh:1.2,style:{color:n?T[n]:s.text.primary,fontFamily:s.typography.fontFamily},children:t}),r.jsx(p.Text,{fz:12,style:{color:s.text.tertiary,fontFamily:s.typography.fontFamily},children:e})]})}function lt({children:t,active:e,tone:n="neutral",size:o="md",leadingContent:s,keyboardHint:a,title:l,style:f,onClick:u}){return r.jsx(p.Badge,{color:te[n],variant:e?"filled":"light",size:o==="sm"?"sm":"md",leftSection:s,rightSection:a,title:l,onClick:u,style:{cursor:u?"pointer":void 0,textTransform:"none",...f},children:t})}function ct({children:t,tone:e="neutral",title:n,icon:o,style:s}){return r.jsx(p.Alert,{color:te[e],title:n,icon:o,variant:"light",style:s,children:t})}const ut={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 dt({headers:t,rows:e,columnAlign:n,rowTone:o,framed:s=!0,striped:a,stickyHeader:l,style:f,emptyMessage:u}){return r.jsxs(p.Table,{withTableBorder:s,withColumnBorders:!1,striped:a,stickyHeader:l,highlightOnHover:!0,style:f,children:[r.jsx(p.Table.Thead,{children:r.jsx(p.Table.Tr,{children:t.map((c,d)=>r.jsx(p.Table.Th,{ta:(n==null?void 0:n[d])??"left",children:c},d))})}),r.jsx(p.Table.Tbody,{children:e.length===0?r.jsx(p.Table.Tr,{children:r.jsx(p.Table.Td,{colSpan:t.length,ta:"center",c:"dimmed",children:u??"No data"})}):e.map((c,d)=>{const x=o==null?void 0:o[d];return r.jsx(p.Table.Tr,{style:x?{background:ut[x]}:void 0,children:t.map((j,h)=>r.jsx(p.Table.Td,{ta:(n==null?void 0:n[h])??"left",children:c[h]},h))},d)})})]})}const ft={primary:"filled",secondary:"default",ghost:"subtle"};function ht({children:t,variant:e="secondary",disabled:n,type:o="button",style:s,onClick:a}){return r.jsx(p.Button,{variant:ft[e],color:e==="primary"?"accent":void 0,size:"xs",disabled:n,type:o,onClick:a,style:s,children:t})}function pt({children:t,onClick:e,disabled:n,title:o,variant:s="default",size:a="md",style:l}){return r.jsx(p.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:l,children:t})}function yt({value:t,onChange:e,options:n,placeholder:o,disabled:s,style:a}){return r.jsx(p.Select,{value:t,data:n,placeholder:o,disabled:s,allowDeselect:!1,onChange:l=>{l!==null&&(e==null||e(l))},style:a})}function gt({checked:t,onChange:e,disabled:n,label:o,style:s}){return r.jsx(p.Checkbox,{checked:t,disabled:n,label:o,onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function xt({checked:t,onChange:e,disabled:n,size:o="sm",style:s}){return r.jsx(p.Switch,{checked:t,disabled:n,size:o==="sm"?"sm":"md",onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function mt({value:t,onChange:e,placeholder:n,disabled:o,type:s,style:a}){return r.jsx(p.TextInput,{value:t,placeholder:n,disabled:o,type:s,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:a})}function bt({value:t,onChange:e,placeholder:n,disabled:o,rows:s=3,style:a}){return r.jsx(p.Textarea,{value:t,placeholder:n,disabled:o,autosize:!0,minRows:s,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:a})}function jt({color:t,style:e}){const n=g();return r.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:n.category[t],flex:"0 0 auto",...e}})}function vt({segments:t,total:e,topLeftLabel:n,topRightLabel:o,style:s}){const a=g(),l=e>0?e:1,f=t.reduce((c,d)=>c+(Number.isFinite(d.value)&&d.value>0?d.value:0),0),u=Math.max(0,l-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((c,d)=>{const x=Number.isFinite(c.value)&&c.value>0?c.value:0,j=a.category[c.color??k.usageColorSequence[d%k.usageColorSequence.length]];return r.jsx("div",{style:{width:`${x/l*100}%`,background:j,borderRadius:3}},c.id)}),u>0&&r.jsx("div",{style:{width:`${u/l*100}%`,background:a.fill.tertiary,borderRadius:3}})]})]})}function St({title:t,leading:e,count:n,trailing:o,children:s,defaultOpen:a=!1,style:l}){const f=g(),[u,c]=m.useState(a);return r.jsxs("div",{style:l,children:[r.jsxs("div",{onClick:()=>c(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})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>m.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>m.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>m.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>m.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=Pe;exports.Button=ht;exports.Callout=ct;exports.Card=ot;exports.CardBody=at;exports.CardHeader=st;exports.Checkbox=gt;exports.Code=Ze;exports.CollapsibleSection=St;exports.DiffStats=Ne;exports.DiffView=ze;exports.Divider=rt;exports.Grid=nt;exports.H1=Ve;exports.H2=Ke;exports.H3=Xe;exports.IconButton=pt;exports.LineChart=Le;exports.Link=Je;exports.PieChart=He;exports.Pill=lt;exports.Row=et;exports.Select=yt;exports.Spacer=tt;exports.Stack=Qe;exports.Stat=it;exports.Swatch=jt;exports.Table=dt;exports.Text=Ue;exports.TextArea=bt;exports.TextInput=mt;exports.TodoList=ue;exports.TodoListCard=Oe;exports.Toggle=xt;exports.UsageBar=vt;exports.computeDAGLayout=Re;exports.mergeStyle=qe;exports.useCanvasAction=$e;exports.useCanvasState=We;exports.useHostTheme=g;
|
|
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;
|