@flesler/cursor-canvas-web 1.0.0 → 1.0.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/README.md +10 -3
- package/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +85 -60
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -6,9 +6,16 @@ Deploy **Cursor canvases** to the web.
|
|
|
6
6
|
|
|
7
7
|
A Cursor canvas is a `.tsx` that imports only from `cursor/canvas`. That module isn't an installable package; it's provided by the Cursor IDE at compile time, so a canvas can't build or render anywhere outside the IDE. This project is an open, **Mantine-backed shim** of `cursor/canvas`. A build-time Vite alias swaps the module for the shim, so the same `.tsx` renders in the Cursor IDE and on the web. No converter, no fork of your source.
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Live demo (this fork):** <https://flesler.github.io/cursor-canvas-web/> — built from
|
|
10
|
+
[`.cursor/canvases/demo.canvas.tsx`](./.cursor/canvases/demo.canvas.tsx) (max SDK showcase + vitest smoke).
|
|
11
|
+
**Upstream reference:** <https://thisismydesign.github.io/cursor-canvas-web/>
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
<p>
|
|
14
|
+
<img src="docs/demo-light.png" alt="Demo canvas (light)" width="49%" />
|
|
15
|
+
<img src="docs/demo-dark.png" alt="Demo canvas (dark)" width="49%" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
Regenerate demo: `pnpm sync:demo` then `pnpm demo:screenshot` (sibling [open-canvas](https://github.com/flesler/open-canvas) built; sync uses `open-canvas generate --formats cursor`).
|
|
12
19
|
|
|
13
20
|
## How it works: a module shim, not a converter
|
|
14
21
|
|
|
@@ -138,7 +145,7 @@ single source of truth: the web app imports it directly, and the same file is
|
|
|
138
145
|
copied into Cursor's managed canvases folder so it renders in the IDE too.
|
|
139
146
|
|
|
140
147
|
The deployed result lives at
|
|
141
|
-
<https://
|
|
148
|
+
<https://flesler.github.io/cursor-canvas-web/>.
|
|
142
149
|
|
|
143
150
|
`deploy.yml` builds and publishes to GitHub Pages on push to `main` via
|
|
144
151
|
`configure-pages` / `upload-pages-artifact` / `deploy-pages`. The Vite `base`
|
package/dist/cursor-canvas.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("@mantine/core"),y=require("react"),B=require("@mantine/charts"),O={foreground:"#E4E4E4EB",foregroundSecondary:"#E4E4E48D",foregroundTertiary:"#E4E4E45E",foregroundQuaternary:"#E4E4E442",editor:"#181818",chrome:"#141414",sidebar:"#141414",elevated:"#181818",fillPrimary:"#E4E4E430",fillSecondary:"#E4E4E41E",fillTertiary:"#E4E4E411",fillQuaternary:"#E4E4E40A",strokePrimary:"#E4E4E433",strokeSecondary:"#E4E4E41F",strokeTertiary:"#E4E4E414",strokeFocused:"#599CE7",accent:"#599CE7",buttonBackground:"#599CE7",buttonForeground:"#191c22",buttonHoverBackground:"#6AABE9",link:"#87c3ff",diffInsertedLine:"#3FA26633",diffRemovedLine:"#B8004933",diffStripAdded:"#3FA2668F",diffStripRemoved:"#FC6B838F"},G={foreground:"#141414F0",foregroundSecondary:"#141414BD",foregroundTertiary:"#1414148A",foregroundQuaternary:"#1414145C",editor:"#FCFCFC",chrome:"#F8F8F8",sidebar:"#F3F3F3",elevated:"#FCFCFC",fillPrimary:"#14141433",fillSecondary:"#14141424",fillTertiary:"#14141414",fillQuaternary:"#1414140F",strokePrimary:"#14141433",strokeSecondary:"#1414141F",strokeTertiary:"#14141414",strokeFocused:"#3685BF",accent:"#3685BF",buttonBackground:"#3685BF",buttonForeground:"#FCFCFC",buttonHoverBackground:"#2E76AB",link:"#3685BF",diffInsertedLine:"#1F8A651F",diffRemovedLine:"#CF2D5614",diffStripAdded:"#1F8A65CC",diffStripRemoved:"#CF2D56CC"},M={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A040E0",red:"#C04848E0"},$={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A088E0",red:"#CF2D56E0"};function oe(e,t){return{bg:{editor:e.editor,chrome:e.chrome,elevated:e.elevated},text:{primary:e.foreground,secondary:e.foregroundSecondary,tertiary:e.foregroundTertiary,quaternary:e.foregroundQuaternary,link:e.link,onAccent:e.buttonForeground},stroke:{primary:e.strokePrimary,secondary:e.strokeSecondary,tertiary:e.strokeTertiary,focused:e.strokeFocused},fill:{primary:e.fillPrimary,secondary:e.fillSecondary,tertiary:e.fillTertiary,quaternary:e.fillQuaternary},accent:{primary:e.accent,control:e.buttonBackground,controlHover:e.buttonHoverBackground},diff:{insertedLine:e.diffInsertedLine,removedLine:e.diffRemovedLine,stripAdded:e.diffStripAdded,stripRemoved:e.diffStripRemoved},category:t}}const ae=oe(O,M),se=oe(G,$),ye=M,I=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],me={green:"#1F8A65E8",darkGreen:"#0D855AE0",lightGreen:"#52B896E0",mintGreen:"#7DCAB0E0",blue:"#2E79B5E0",lightBlue:"#70B0D8E0",indigo:"#5A6CC0F0",lightIndigo:"#9AAADCE0",purple:"#7B64B8F0",lightPurple:"#AA98D8E0",warmPink:"#C85898E0",lightPink:"#E8A0C4E0",brightOrange:"#F0A040E0",deepOrange:"#C06028E0",goldenYellow:"#E8C030E0",darkAmber:"#C04848E0",warmPeach:"#F0A088E0",vibrantTeal:"#2A9A8AE0",muted:"#8888A8E0",neutralLine:"#888899D0"},ve={h1:{fontSize:"24px",lineHeight:"30px",fontWeight:590},h2:{fontSize:"18px",lineHeight:"24px",fontWeight:590},h3:{fontSize:"16px",lineHeight:"22px",fontWeight:590},body:{fontSize:"14px",lineHeight:"20px",fontWeight:400},small:{fontSize:"12px",lineHeight:"16px",fontWeight:400}},be={"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,"4.5":18,5:20,6:24,7:28,8:32,9:36,10:40},Ee={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},W=["#1F8A65E8","#70B0D8E0","#5A6CC0F0","#F0A040E0","#C06028E0","#E8C030E0","#C85898E0","#F0A088E0","#7B64B8F0","#7DCAB0E0","#8888A8E0","#2A9A8AE0"],E={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},q={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function je(e){const t=e==="dark"?ae:se;return{...t,kind:e,tokens:t,palette:e==="dark"?O:G,category:e==="dark"?M:$,chart:{palette:me,sequence:W},radius:Ee,typography:ve,spacing:be}}function j(){const e=u.useComputedColorScheme("light");return je(e==="dark"?"dark":"light")}function ie(e,t){return e?E[e]:W[t%W.length]}function N(e,t){return e.map((r,s)=>{const i={category:r};for(const o of t)i[o.name]=o.data[s]??0;return i})}function ce(e){return e.map((t,r)=>({name:t.name,color:ie(t.tone,r)}))}function le(e,t){if(!(!e&&!t))return r=>`${t??""}${r}${e??""}`}function ke(e,t){if(e!=null&&e.length)return e.map(r=>({...t?{x:r.value}:{y:r.value},label:r.label,color:r.tone?E[r.tone]:E.neutral}))}function de(e){const t=ke(e.referenceLines,!!e.horizontal);if(e.stacked||e.normalized)return{referenceLines:t};const r=e.beginAtZero!==!1,s=[e.yMin??(r?0:"auto"),e.yMax??"auto"];return e.horizontal?{xAxisProps:{domain:s},referenceLines:t}:{yAxisProps:{domain:s},referenceLines:t}}function Se(e,t,r){return e!==void 0?e:t.length===1&&r.length<=8}function Ce({categories:e,series:t,height:r=240,fill:s,valueSuffix:i,valuePrefix:o,showValues:l,showHoverGuide:f=!0,beginAtZero:d,yMin:c,yMax:h,referenceLines:x,style:v}){const b=N(e,t),F=ce(t),k=de({beginAtZero:d,yMin:c,yMax:h,referenceLines:x,horizontal:!1}),S={h:r,data:b,dataKey:"category",series:F,curveType:"monotone",withLegend:t.length>1,valueFormatter:le(i,o),withPointLabels:l??e.length<=20,tooltipProps:f?void 0:{cursor:!1},...k,style:v};return s?n.jsx(B.AreaChart,{...S}):n.jsx(B.LineChart,{...S})}function Ae({categories:e,series:t,height:r=240,stacked:s,horizontal:i,normalized:o,valueSuffix:l,valuePrefix:f,showValues:d,beginAtZero:c,yMin:h,yMax:x,referenceLines:v,style:b}){const F=N(e,t),k=o?"percent":s?"stacked":"default",S=de({beginAtZero:c,yMin:h,yMax:x,referenceLines:v,horizontal:i,stacked:s,normalized:o}),T=!s&&!o&&Se(d,t,e);return n.jsx(B.BarChart,{h:r,data:F,dataKey:"category",series:ce(t),type:k,orientation:i?"vertical":"horizontal",withLegend:t.length>1,valueFormatter:le(l,f),withBarValueLabel:T,...S,style:b})}function Fe({data:e,size:t=200,donut:r,style:s}){const o={data:e.map((l,f)=>({name:l.label,value:l.value,color:ie(l.tone,f)})),size:t,withTooltip:!0,style:s};return r?n.jsx(B.DonutChart,{...o}):n.jsx(B.PieChart,{...o,withLabelsLine:!1})}function Te(e){const{nodes:t,edges:r,direction:s="vertical",nodeWidth:i=160,nodeHeight:o=40,rankGap:l=64,nodeGap:f=48,padding:d=24}=e,c=t.map(a=>a.id),h=new Set(c),x=new Map;for(const a of c)x.set(a,[]);for(const a of r)h.has(a.from)&&h.has(a.to)&&x.get(a.from).push(a.to);const v=0,b=1,F=2,k=new Map(c.map(a=>[a,v])),S=new Set,T=(a,g)=>`${a}\0${g}`,Q=a=>{k.set(a,b);for(const g of x.get(a)??[]){const p=k.get(g);p===b?S.add(T(a,g)):p===v&&Q(g)}k.set(a,F)};for(const a of c)k.get(a)===v&&Q(a);const he=r.filter(a=>h.has(a.from)&&h.has(a.to)&&!S.has(T(a.from,a.to))),C=new Map(c.map(a=>[a,0])),K=new Map(c.map(a=>[a,[]]));for(const a of he)K.get(a.from).push(a.to),C.set(a.to,(C.get(a.to)??0)+1);const w=new Map(c.map(a=>[a,0])),z=c.filter(a=>(C.get(a)??0)===0);for(;z.length>0;){const a=z.shift(),g=w.get(a);for(const p of K.get(a))w.set(p,Math.max(w.get(p),g+1)),C.set(p,C.get(p)-1),C.get(p)===0&&z.push(p)}const A=new Map;for(const a of c){const g=w.get(a);A.has(g)||A.set(g,[]),A.get(g).push(a)}const L=[...A.keys()].sort((a,g)=>a-g),m=s==="vertical",X=a=>a*(m?i:o)+Math.max(0,a-1)*f,V=Math.max(0,...L.map(a=>X(A.get(a).length))),D=new Map,Y=[];L.forEach((a,g)=>{const p=A.get(a),H=X(p.length),R=d+(V-H)/2,P=d+g*((m?o:i)+l);p.forEach((ee,te)=>{const re=R+te*((m?i:o)+f),pe=m?re:P,xe=m?P:re;D.set(ee,{id:ee,x:pe,y:xe,rank:a,order:te})}),Y.push({rank:a,x:m?R:P,y:m?P:R,width:m?H:i,height:m?o:H,nodeIds:p})});const U=(a,g)=>a?m?{x:a.x+i/2,y:g==="source"?a.y+o:a.y}:{x:g==="source"?a.x+i:a.x,y:a.y+o/2}:{x:0,y:0},ge=r.filter(a=>h.has(a.from)&&h.has(a.to)).map(a=>{const g=U(D.get(a.from),"source"),p=U(D.get(a.to),"target");return{from:a.from,to:a.to,sourceX:g.x,sourceY:g.y,targetX:p.x,targetY:p.y,isBackEdge:S.has(T(a.from,a.to))}}),J=d*2+L.length*(m?o:i)+Math.max(0,L.length-1)*l,Z=d*2+V;return{nodes:[...D.values()],edges:ge,ranks:Y,direction:s,width:m?Z:J,height:m?J:Z}}function Be({additions:e=0,deletions:t=0,style:r}){return e===0&&t===0?null:n.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...r},children:[e>0&&n.jsxs("span",{style:{color:E.added},children:["+",e]}),t>0&&n.jsxs("span",{style:{color:E.deleted},children:["-",t]})]})}const we={added:"+",removed:"-",unchanged:" "};function Le({lines:e,showLineNumbers:t=!0,coloredLineNumbers:r=!0,showAccentStrip:s=!0,style:i}){const o=j(),l=c=>c==="added"?o.diff.insertedLine:c==="removed"?o.diff.removedLine:"transparent",f=c=>c==="added"?o.diff.stripAdded:c==="removed"?o.diff.stripRemoved:"transparent",d=c=>r&&c==="added"?E.added:r&&c==="removed"?E.deleted:o.text.tertiary;return n.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:o.text.primary,overflowX:"auto",...i},children:e.map((c,h)=>n.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:s?`3px solid ${f(c.type)}`:void 0},children:[t&&n.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:d(c.type)},children:c.lineNumber??""}),n.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:d(c.type)},children:we[c.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},h))})}function De({status:e}){const t=j(),r=e==="completed"?E.success:e==="in_progress"?t.accent.primary:e==="cancelled"?E.danger:t.text.tertiary;return n.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[n.jsx("circle",{cx:7,cy:7,r:6,stroke:r,strokeWidth:1.4}),e==="completed"&&n.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),e==="in_progress"&&n.jsx("circle",{cx:7,cy:7,r:3,fill:r}),e==="cancelled"&&n.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round"})]})}function ue({todos:e,dimmedTodoIds:t,onTodoClick:r,style:s}){const i=j();return e.length===0?null:n.jsx("div",{style:{display:"flex",flexDirection:"column",...s},children:e.map(o=>{const l=t==null?void 0:t.has(o.id);return n.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(o),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:r?"pointer":"default",color:i.text.primary,fontSize:14,lineHeight:"20px",opacity:l?.45:1},children:[n.jsx(De,{status:o.status}),n.jsx("span",{style:{textDecoration:o.status==="cancelled"?"line-through":void 0,color:o.status==="cancelled"?i.text.tertiary:void 0},children:o.content})]},o.id)})})}function Pe({todos:e,dimmedTodoIds:t,defaultExpanded:r=!1,onTodoClick:s,style:i}){const o=j(),[l,f]=y.useState(r);if(e.length===0)return null;const d=e.filter(c=>c.status==="completed").length;return n.jsxs("div",{style:{border:`1px solid ${o.stroke.primary}`,borderRadius:6,overflow:"hidden",...i},children:[n.jsxs("button",{type:"button",onClick:()=>f(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:"transparent",border:"none",cursor:"pointer",color:o.text.secondary,fontSize:12,fontWeight:600},children:[n.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:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),n.jsx("span",{children:"Todos"}),n.jsx("span",{style:{flex:1}}),n.jsxs("span",{children:[d," of ",e.length," Done"]})]}),l&&n.jsx("div",{style:{padding:6},children:n.jsx(ue,{todos:e,dimmedTodoIds:t,onTodoClick:s})})]})}function Me(e,t){const r=`canvas:${e}`,[s,i]=y.useState(()=>{if(typeof localStorage>"u")return t;try{const l=localStorage.getItem(r);return l===null?t:JSON.parse(l)}catch{return t}}),o=y.useCallback(l=>{i(f=>{const d=typeof l=="function"?l(f):l;try{localStorage==null||localStorage.setItem(r,JSON.stringify(d))}catch{}return d})},[r]);return[s,o]}function ze(){return y.useCallback(e=>{},[])}function He(e,t){return{...e,...t}}function Re({children:e,style:t}){return n.jsx(u.Title,{order:1,fz:24,lh:"30px",style:t,children:e})}function Ie({children:e,style:t}){return n.jsx(u.Title,{order:2,fz:18,lh:"24px",style:t,children:e})}function We({children:e,style:t}){return n.jsx(u.Title,{order:3,fz:16,lh:"22px",style:t,children:e})}const Oe={normal:400,medium:500,semibold:600,bold:700};function Ge({children:e,tone:t="primary",size:r="body",as:s="p",weight:i="normal",italic:o,truncate:l,style:f}){const d=j();return n.jsx(u.Text,{component:s,size:r==="small"?"xs":"sm",fw:Oe[i],c:t==="primary"?void 0:d.text[t],truncate:l,style:{fontStyle:o?"italic":void 0,...f},children:e})}function $e({children:e,style:t}){return n.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",background:"var(--mantine-color-default-hover)",borderRadius:4,padding:"1px 4px",...t},children:e})}function qe({children:e,href:t,style:r}){return n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:"var(--mantine-color-anchor)",...r},children:e})}function Ne({children:e,gap:t,style:r}){return n.jsx(u.Stack,{gap:t,style:r,children:e})}const ne={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function _e({children:e,gap:t,align:r="center",justify:s="start",wrap:i=!1,style:o}){return n.jsx(u.Group,{gap:t,align:ne[r],justify:ne[s],wrap:i?"wrap":"nowrap",style:o,children:e})}function Qe(){return n.jsx("div",{style:{flex:1}})}function Ke({children:e,columns:t,gap:r=16,align:s,style:i}){const o=typeof t=="number"?`repeat(${t}, minmax(0, 1fr))`:t;return n.jsx("div",{style:{display:"grid",gridTemplateColumns:o,gap:r,alignItems:s,...i},children:e})}function Xe({style:e}){return n.jsx(u.Divider,{style:e})}const _=y.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Ve({children:e,variant:t="default",collapsible:r=!1,defaultOpen:s=!0,open:i,onOpenChange:o,style:l}){const[f,d]=y.useState(s),c=i??f,h=y.useCallback(()=>{const x=!c;i===void 0&&d(x),o==null||o(x)},[c,i,o]);return n.jsx(u.Card,{withBorder:t!=="borderless",radius:"md",padding:0,style:l,children:n.jsx(_.Provider,{value:{collapsible:r,open:c,toggle:h},children:e})})}function Ye({children:e,trailing:t,style:r}){const{collapsible:s,open:i,toggle:o}=y.useContext(_);return n.jsxs("div",{onClick:s?o:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:"1px solid var(--mantine-color-default-border)",fontSize:12,fontWeight:600,color:"var(--mantine-color-dimmed)",cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...r},children:[n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&n.jsx(fe,{expanded:i}),e]}),t!=null&&n.jsx("span",{children:t})]})}function Ue({children:e,style:t}){const{collapsible:r,open:s}=y.useContext(_);return r&&!s?null:n.jsx("div",{style:{padding:14,...t},children:e})}function fe({expanded:e}){return n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:e?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Je({value:e,label:t,tone:r,style:s}){return n.jsxs("div",{style:s,children:[n.jsx(u.Text,{fz:22,fw:700,lh:1.2,c:r?`${q[r]}.6`:void 0,children:e}),n.jsx(u.Text,{fz:12,c:"dimmed",children:t})]})}function Ze({children:e,active:t,tone:r="neutral",size:s="md",leadingContent:i,keyboardHint:o,title:l,style:f,onClick:d}){return n.jsx(u.Badge,{color:q[r],variant:t?"filled":"light",size:s==="sm"?"sm":"md",leftSection:i,rightSection:o,title:l,onClick:d,style:{cursor:d?"pointer":void 0,textTransform:"none",...f},children:e})}function et({children:e,tone:t="neutral",title:r,icon:s,style:i}){return n.jsx(u.Alert,{color:q[t],title:r,icon:s,variant:"light",style:i,children:e})}const tt={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 rt({headers:e,rows:t,columnAlign:r,rowTone:s,framed:i=!0,striped:o,stickyHeader:l,style:f,emptyMessage:d}){return n.jsxs(u.Table,{withTableBorder:i,withColumnBorders:!1,striped:o,stickyHeader:l,highlightOnHover:!0,style:f,children:[n.jsx(u.Table.Thead,{children:n.jsx(u.Table.Tr,{children:e.map((c,h)=>n.jsx(u.Table.Th,{ta:(r==null?void 0:r[h])??"left",children:c},h))})}),n.jsx(u.Table.Tbody,{children:t.length===0?n.jsx(u.Table.Tr,{children:n.jsx(u.Table.Td,{colSpan:e.length,ta:"center",c:"dimmed",children:d??"No data"})}):t.map((c,h)=>{const x=s==null?void 0:s[h];return n.jsx(u.Table.Tr,{style:x?{background:tt[x]}:void 0,children:e.map((v,b)=>n.jsx(u.Table.Td,{ta:(r==null?void 0:r[b])??"left",children:c[b]},b))},h)})})]})}const nt={primary:"filled",secondary:"default",ghost:"subtle"};function ot({children:e,variant:t="secondary",disabled:r,type:s="button",style:i,onClick:o}){return n.jsx(u.Button,{variant:nt[t],size:"xs",disabled:r,type:s,onClick:o,style:i,children:e})}function at({children:e,onClick:t,disabled:r,title:s,variant:i="default",size:o="md",style:l}){return n.jsx(u.ActionIcon,{variant:i==="circle"?"light":"subtle",radius:i==="circle"?"xl":"sm",size:o==="sm"?"sm":"md",color:"gray",disabled:r,title:s,"aria-label":s,onClick:t,style:l,children:e})}function st({value:e,onChange:t,options:r,placeholder:s,disabled:i,style:o}){return n.jsx(u.Select,{value:e,data:r,placeholder:s,disabled:i,allowDeselect:!1,onChange:l=>{l!==null&&(t==null||t(l))},style:o})}function it({checked:e,onChange:t,disabled:r,label:s,style:i}){return n.jsx(u.Checkbox,{checked:e,disabled:r,label:s,onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function ct({checked:e,onChange:t,disabled:r,size:s="sm",style:i}){return n.jsx(u.Switch,{checked:e,disabled:r,size:s==="sm"?"sm":"md",onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function lt({value:e,onChange:t,placeholder:r,disabled:s,type:i,style:o}){return n.jsx(u.TextInput,{value:e,placeholder:r,disabled:s,type:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function dt({value:e,onChange:t,placeholder:r,disabled:s,rows:i=3,style:o}){return n.jsx(u.Textarea,{value:e,placeholder:r,disabled:s,autosize:!0,minRows:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function ut({color:e,style:t}){const r=j();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[e],flex:"0 0 auto",...t}})}function ft({segments:e,total:t,topLeftLabel:r,topRightLabel:s,style:i}){const o=j(),l=t>0?t:1,f=e.reduce((c,h)=>c+(Number.isFinite(h.value)&&h.value>0?h.value:0),0),d=Math.max(0,l-f);return n.jsxs("div",{style:i,children:[(r!=null||s!=null)&&n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:o.text.secondary,marginBottom:6},children:[n.jsx("span",{children:r}),n.jsx("span",{children:s})]}),n.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[e.map((c,h)=>{const x=Number.isFinite(c.value)&&c.value>0?c.value:0,v=o.category[c.color??I[h%I.length]];return n.jsx("div",{style:{width:`${x/l*100}%`,background:v,borderRadius:3}},c.id)}),d>0&&n.jsx("div",{style:{width:`${d/l*100}%`,background:o.fill.tertiary,borderRadius:3}})]})]})}function ht({title:e,leading:t,count:r,trailing:s,children:i,defaultOpen:o=!1,style:l}){const f=j(),[d,c]=y.useState(o);return n.jsxs("div",{style:l,children:[n.jsxs("div",{onClick:()=>c(h=>!h),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[n.jsx(fe,{expanded:d}),t,n.jsx("span",{style:{fontWeight:500},children:e}),r!=null&&n.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:r}),n.jsx("span",{style:{flex:1}}),s!=null&&n.jsx("span",{style:{color:f.text.tertiary},children:s})]}),d&&n.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:i})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>y.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>y.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>y.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>y.useState});exports.BarChart=Ae;exports.Button=ot;exports.Callout=et;exports.Card=Ve;exports.CardBody=Ue;exports.CardHeader=Ye;exports.Checkbox=it;exports.Code=$e;exports.CollapsibleSection=ht;exports.DiffStats=Be;exports.DiffView=Le;exports.Divider=Xe;exports.Grid=Ke;exports.H1=Re;exports.H2=Ie;exports.H3=We;exports.IconButton=at;exports.LineChart=Ce;exports.Link=qe;exports.PieChart=Fe;exports.Pill=Ze;exports.Row=_e;exports.Select=st;exports.Spacer=Qe;exports.Stack=Ne;exports.Stat=Je;exports.Swatch=ut;exports.Table=rt;exports.Text=Ge;exports.TextArea=dt;exports.TextInput=lt;exports.TodoList=ue;exports.TodoListCard=Pe;exports.Toggle=ct;exports.UsageBar=ft;exports.canvasPaletteDark=O;exports.canvasPaletteLight=G;exports.canvasTokens=ae;exports.canvasTokensLight=se;exports.categoryPaletteDark=M;exports.categoryPaletteLight=$;exports.colorPalette=ye;exports.computeDAGLayout=Te;exports.mergeStyle=He;exports.reshapeLineChartData=N;exports.usageColorSequence=I;exports.useCanvasAction=ze;exports.useCanvasState=Me;exports.useHostTheme=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("@mantine/core"),y=require("react"),w=require("@mantine/charts"),O={foreground:"#E4E4E4EB",foregroundSecondary:"#E4E4E48D",foregroundTertiary:"#E4E4E45E",foregroundQuaternary:"#E4E4E442",editor:"#181818",chrome:"#141414",sidebar:"#141414",elevated:"#181818",fillPrimary:"#E4E4E430",fillSecondary:"#E4E4E41E",fillTertiary:"#E4E4E411",fillQuaternary:"#E4E4E40A",strokePrimary:"#E4E4E433",strokeSecondary:"#E4E4E41F",strokeTertiary:"#E4E4E414",strokeFocused:"#599CE7",accent:"#599CE7",buttonBackground:"#599CE7",buttonForeground:"#191c22",buttonHoverBackground:"#6AABE9",link:"#87c3ff",diffInsertedLine:"#3FA26633",diffRemovedLine:"#B8004933",diffStripAdded:"#3FA2668F",diffStripRemoved:"#FC6B838F"},G={foreground:"#141414F0",foregroundSecondary:"#141414BD",foregroundTertiary:"#1414148A",foregroundQuaternary:"#1414145C",editor:"#FCFCFC",chrome:"#F8F8F8",sidebar:"#F3F3F3",elevated:"#FCFCFC",fillPrimary:"#14141433",fillSecondary:"#14141424",fillTertiary:"#14141414",fillQuaternary:"#1414140F",strokePrimary:"#14141433",strokeSecondary:"#1414141F",strokeTertiary:"#14141414",strokeFocused:"#3685BF",accent:"#3685BF",buttonBackground:"#3685BF",buttonForeground:"#FCFCFC",buttonHoverBackground:"#2E76AB",link:"#3685BF",diffInsertedLine:"#1F8A651F",diffRemovedLine:"#CF2D5614",diffStripAdded:"#1F8A65CC",diffStripRemoved:"#CF2D56CC"},M={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A040E0",red:"#C04848E0"},$={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A088E0",red:"#CF2D56E0"};function oe(e,t){return{bg:{editor:e.editor,chrome:e.chrome,elevated:e.elevated},text:{primary:e.foreground,secondary:e.foregroundSecondary,tertiary:e.foregroundTertiary,quaternary:e.foregroundQuaternary,link:e.link,onAccent:e.buttonForeground},stroke:{primary:e.strokePrimary,secondary:e.strokeSecondary,tertiary:e.strokeTertiary,focused:e.strokeFocused},fill:{primary:e.fillPrimary,secondary:e.fillSecondary,tertiary:e.fillTertiary,quaternary:e.fillQuaternary},accent:{primary:e.accent,control:e.buttonBackground,controlHover:e.buttonHoverBackground},diff:{insertedLine:e.diffInsertedLine,removedLine:e.diffRemovedLine,stripAdded:e.diffStripAdded,stripRemoved:e.diffStripRemoved},category:t}}const ae=oe(O,M),se=oe(G,$),ye=M,I=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],me={green:"#1F8A65E8",darkGreen:"#0D855AE0",lightGreen:"#52B896E0",mintGreen:"#7DCAB0E0",blue:"#2E79B5E0",lightBlue:"#70B0D8E0",indigo:"#5A6CC0F0",lightIndigo:"#9AAADCE0",purple:"#7B64B8F0",lightPurple:"#AA98D8E0",warmPink:"#C85898E0",lightPink:"#E8A0C4E0",brightOrange:"#F0A040E0",deepOrange:"#C06028E0",goldenYellow:"#E8C030E0",darkAmber:"#C04848E0",warmPeach:"#F0A088E0",vibrantTeal:"#2A9A8AE0",muted:"#8888A8E0",neutralLine:"#888899D0"},ve={h1:{fontSize:"24px",lineHeight:"30px",fontWeight:590},h2:{fontSize:"18px",lineHeight:"24px",fontWeight:590},h3:{fontSize:"16px",lineHeight:"22px",fontWeight:590},body:{fontSize:"14px",lineHeight:"20px",fontWeight:400},small:{fontSize:"12px",lineHeight:"16px",fontWeight:400}},be={"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,"4.5":18,5:20,6:24,7:28,8:32,9:36,10:40},Ee={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},W=["#1F8A65E8","#70B0D8E0","#5A6CC0F0","#F0A040E0","#C06028E0","#E8C030E0","#C85898E0","#F0A088E0","#7B64B8F0","#7DCAB0E0","#8888A8E0","#2A9A8AE0"],E={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},q={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function je(e){const t=e==="dark"?ae:se;return{...t,kind:e,tokens:t,palette:e==="dark"?O:G,category:e==="dark"?M:$,chart:{palette:me,sequence:W},radius:Ee,typography:ve,spacing:be}}function j(){const e=u.useComputedColorScheme("light");return je(e==="dark"?"dark":"light")}function ie(e,t){return e?E[e]:W[t%W.length]}function N(e,t){return e.map((r,s)=>{const i={category:r};for(const o of t)i[o.name]=o.data[s]??0;return i})}function ce(e){return e.map((t,r)=>({name:t.name,color:ie(t.tone,r)}))}function le(e,t){if(!(!e&&!t))return r=>`${t??""}${r}${e??""}`}function ke(e,t){if(e!=null&&e.length)return e.map(r=>({...t?{x:r.value}:{y:r.value},label:r.label,color:r.tone?E[r.tone]:E.neutral}))}function de(e){const t=ke(e.referenceLines,!!e.horizontal);if(e.stacked||e.normalized)return{referenceLines:t};const r=e.beginAtZero!==!1,s=[e.yMin??(r?0:"auto"),e.yMax??"auto"];return e.horizontal?{xAxisProps:{domain:s},referenceLines:t}:{yAxisProps:{domain:s},referenceLines:t}}function Ce(e,t,r){return e!==void 0?e:t.length===1&&r.length<=8}function Se({categories:e,series:t,height:r=240,fill:s,valueSuffix:i,valuePrefix:o,showValues:l,showHoverGuide:f=!0,beginAtZero:d,yMin:c,yMax:h,referenceLines:x,style:v}){const b=N(e,t),F=ce(t),k=de({beginAtZero:d,yMin:c,yMax:h,referenceLines:x,horizontal:!1}),C={h:r,data:b,dataKey:"category",series:F,curveType:"monotone",withLegend:t.length>1,valueFormatter:le(i,o),withPointLabels:l??e.length<=20,tooltipProps:f?void 0:{cursor:!1},...k,style:v};return s?n.jsx(w.AreaChart,{...C}):n.jsx(w.LineChart,{...C})}function Ae({categories:e,series:t,height:r=240,stacked:s,horizontal:i,normalized:o,valueSuffix:l,valuePrefix:f,showValues:d,beginAtZero:c,yMin:h,yMax:x,referenceLines:v,style:b}){const F=N(e,t),k=o?"percent":s?"stacked":"default",C=de({beginAtZero:c,yMin:h,yMax:x,referenceLines:v,horizontal:i,stacked:s,normalized:o}),T=!s&&!o&&Ce(d,t,e);return n.jsx(w.BarChart,{h:r,data:F,dataKey:"category",series:ce(t),type:k,orientation:i?"vertical":"horizontal",withLegend:t.length>1,valueFormatter:le(l,f),withBarValueLabel:T,...C,style:b})}function Fe({data:e,size:t=200,donut:r,style:s}){const i=e.map((l,f)=>({name:l.label,value:l.value,color:ie(l.tone,f)})),o=r?n.jsx(w.DonutChart,{data:i,size:t,withTooltip:!0,style:s}):n.jsx(w.PieChart,{data:i,size:t,withTooltip:!0,withLabelsLine:!1,style:s});return n.jsx("div",{style:{width:"100%",height:t,minHeight:t,display:"flex",alignItems:"center",justifyContent:"center"},children:o})}function Te(e){const{nodes:t,edges:r,direction:s="vertical",nodeWidth:i=160,nodeHeight:o=40,rankGap:l=64,nodeGap:f=48,padding:d=24}=e,c=t.map(a=>a.id),h=new Set(c),x=new Map;for(const a of c)x.set(a,[]);for(const a of r)h.has(a.from)&&h.has(a.to)&&x.get(a.from).push(a.to);const v=0,b=1,F=2,k=new Map(c.map(a=>[a,v])),C=new Set,T=(a,g)=>`${a}\0${g}`,Q=a=>{k.set(a,b);for(const g of x.get(a)??[]){const p=k.get(g);p===b?C.add(T(a,g)):p===v&&Q(g)}k.set(a,F)};for(const a of c)k.get(a)===v&&Q(a);const he=r.filter(a=>h.has(a.from)&&h.has(a.to)&&!C.has(T(a.from,a.to))),S=new Map(c.map(a=>[a,0])),K=new Map(c.map(a=>[a,[]]));for(const a of he)K.get(a.from).push(a.to),S.set(a.to,(S.get(a.to)??0)+1);const B=new Map(c.map(a=>[a,0])),H=c.filter(a=>(S.get(a)??0)===0);for(;H.length>0;){const a=H.shift(),g=B.get(a);for(const p of K.get(a))B.set(p,Math.max(B.get(p),g+1)),S.set(p,S.get(p)-1),S.get(p)===0&&H.push(p)}const A=new Map;for(const a of c){const g=B.get(a);A.has(g)||A.set(g,[]),A.get(g).push(a)}const L=[...A.keys()].sort((a,g)=>a-g),m=s==="vertical",X=a=>a*(m?i:o)+Math.max(0,a-1)*f,V=Math.max(0,...L.map(a=>X(A.get(a).length))),D=new Map,Y=[];L.forEach((a,g)=>{const p=A.get(a),R=X(p.length),z=d+(V-R)/2,P=d+g*((m?o:i)+l);p.forEach((ee,te)=>{const re=z+te*((m?i:o)+f),pe=m?re:P,xe=m?P:re;D.set(ee,{id:ee,x:pe,y:xe,rank:a,order:te})}),Y.push({rank:a,x:m?z:P,y:m?P:z,width:m?R:i,height:m?o:R,nodeIds:p})});const U=(a,g)=>a?m?{x:a.x+i/2,y:g==="source"?a.y+o:a.y}:{x:g==="source"?a.x+i:a.x,y:a.y+o/2}:{x:0,y:0},ge=r.filter(a=>h.has(a.from)&&h.has(a.to)).map(a=>{const g=U(D.get(a.from),"source"),p=U(D.get(a.to),"target");return{from:a.from,to:a.to,sourceX:g.x,sourceY:g.y,targetX:p.x,targetY:p.y,isBackEdge:C.has(T(a.from,a.to))}}),J=d*2+L.length*(m?o:i)+Math.max(0,L.length-1)*l,Z=d*2+V;return{nodes:[...D.values()],edges:ge,ranks:Y,direction:s,width:m?Z:J,height:m?J:Z}}function we({additions:e=0,deletions:t=0,style:r}){return e===0&&t===0?null:n.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...r},children:[e>0&&n.jsxs("span",{style:{color:E.added},children:["+",e]}),t>0&&n.jsxs("span",{style:{color:E.deleted},children:["-",t]})]})}const Be={added:"+",removed:"-",unchanged:" "};function Le({lines:e,showLineNumbers:t=!0,coloredLineNumbers:r=!0,showAccentStrip:s=!0,style:i}){const o=j(),l=c=>c==="added"?o.diff.insertedLine:c==="removed"?o.diff.removedLine:"transparent",f=c=>c==="added"?o.diff.stripAdded:c==="removed"?o.diff.stripRemoved:"transparent",d=c=>r&&c==="added"?E.added:r&&c==="removed"?E.deleted:o.text.tertiary;return n.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:o.text.primary,overflowX:"auto",...i},children:e.map((c,h)=>n.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:s?`3px solid ${f(c.type)}`:void 0},children:[t&&n.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:d(c.type)},children:c.lineNumber??""}),n.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:d(c.type)},children:Be[c.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},h))})}function De({status:e}){const t=j(),r=e==="completed"?E.success:e==="in_progress"?t.accent.primary:e==="cancelled"?E.danger:t.text.tertiary;return n.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[n.jsx("circle",{cx:7,cy:7,r:6,stroke:r,strokeWidth:1.4}),e==="completed"&&n.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),e==="in_progress"&&n.jsx("circle",{cx:7,cy:7,r:3,fill:r}),e==="cancelled"&&n.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round"})]})}function ue({todos:e,dimmedTodoIds:t,onTodoClick:r,style:s}){const i=j();return e.length===0?null:n.jsx("div",{style:{display:"flex",flexDirection:"column",...s},children:e.map(o=>{const l=t==null?void 0:t.has(o.id);return n.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(o),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:r?"pointer":"default",color:i.text.primary,fontSize:14,lineHeight:"20px",opacity:l?.45:1},children:[n.jsx(De,{status:o.status}),n.jsx("span",{style:{textDecoration:o.status==="cancelled"?"line-through":void 0,color:o.status==="cancelled"?i.text.tertiary:void 0},children:o.content})]},o.id)})})}function Pe({todos:e,dimmedTodoIds:t,defaultExpanded:r=!1,onTodoClick:s,style:i}){const o=j(),[l,f]=y.useState(r);if(e.length===0)return null;const d=e.filter(c=>c.status==="completed").length;return n.jsxs("div",{style:{border:`1px solid ${o.stroke.primary}`,borderRadius:6,overflow:"hidden",...i},children:[n.jsxs("button",{type:"button",onClick:()=>f(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:"transparent",border:"none",cursor:"pointer",color:o.text.secondary,fontSize:12,fontWeight:600},children:[n.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:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),n.jsx("span",{children:"Todos"}),n.jsx("span",{style:{flex:1}}),n.jsxs("span",{children:[d," of ",e.length," Done"]})]}),l&&n.jsx("div",{style:{padding:6},children:n.jsx(ue,{todos:e,dimmedTodoIds:t,onTodoClick:s})})]})}function Me(e,t){const r=`canvas:${e}`,[s,i]=y.useState(()=>{if(typeof localStorage>"u")return t;try{const l=localStorage.getItem(r);return l===null?t:JSON.parse(l)}catch{return t}}),o=y.useCallback(l=>{i(f=>{const d=typeof l=="function"?l(f):l;try{localStorage==null||localStorage.setItem(r,JSON.stringify(d))}catch{}return d})},[r]);return[s,o]}function He(){return y.useCallback(e=>{},[])}function Re(e,t){return{...e,...t}}function ze({children:e,style:t}){return n.jsx(u.Title,{order:1,fz:24,lh:"30px",style:t,children:e})}function Ie({children:e,style:t}){return n.jsx(u.Title,{order:2,fz:18,lh:"24px",style:t,children:e})}function We({children:e,style:t}){return n.jsx(u.Title,{order:3,fz:16,lh:"22px",style:t,children:e})}const Oe={normal:400,medium:500,semibold:600,bold:700};function Ge({children:e,tone:t="primary",size:r="body",as:s="p",weight:i="normal",italic:o,truncate:l,style:f}){const d=j();return n.jsx(u.Text,{component:s,size:r==="small"?"xs":"sm",fw:Oe[i],c:t==="primary"?void 0:d.text[t],truncate:l,style:{fontStyle:o?"italic":void 0,...f},children:e})}function $e({children:e,style:t}){return n.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",background:"var(--mantine-color-default-hover)",borderRadius:4,padding:"1px 4px",...t},children:e})}function qe({children:e,href:t,style:r}){return n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:"var(--mantine-color-anchor)",...r},children:e})}function Ne({children:e,gap:t,style:r}){return n.jsx(u.Stack,{gap:t,style:r,children:e})}const ne={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function _e({children:e,gap:t,align:r="center",justify:s="start",wrap:i=!1,style:o}){return n.jsx(u.Group,{gap:t,align:ne[r],justify:ne[s],wrap:i?"wrap":"nowrap",style:o,children:e})}function Qe(){return n.jsx("div",{style:{flex:1}})}function Ke({children:e,columns:t,gap:r=16,align:s,style:i}){const o=typeof t=="number"?`repeat(${t}, minmax(0, 1fr))`:t;return n.jsx("div",{style:{display:"grid",gridTemplateColumns:o,gap:r,alignItems:s,...i},children:e})}function Xe({style:e}){return n.jsx(u.Divider,{style:e})}const _=y.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Ve({children:e,variant:t="default",collapsible:r=!1,defaultOpen:s=!0,open:i,onOpenChange:o,style:l}){const[f,d]=y.useState(s),c=i??f,h=y.useCallback(()=>{const x=!c;i===void 0&&d(x),o==null||o(x)},[c,i,o]);return n.jsx(u.Card,{withBorder:t!=="borderless",radius:"md",padding:0,style:l,children:n.jsx(_.Provider,{value:{collapsible:r,open:c,toggle:h},children:e})})}function Ye({children:e,trailing:t,style:r}){const{collapsible:s,open:i,toggle:o}=y.useContext(_);return n.jsxs("div",{onClick:s?o:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:"1px solid var(--mantine-color-default-border)",fontSize:12,fontWeight:600,color:"var(--mantine-color-dimmed)",cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...r},children:[n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&n.jsx(fe,{expanded:i}),e]}),t!=null&&n.jsx("span",{children:t})]})}function Ue({children:e,style:t}){const{collapsible:r,open:s}=y.useContext(_);return r&&!s?null:n.jsx("div",{style:{padding:14,...t},children:e})}function fe({expanded:e}){return n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:e?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Je({value:e,label:t,tone:r,style:s}){return n.jsxs("div",{style:s,children:[n.jsx(u.Text,{fz:22,fw:700,lh:1.2,c:r?`${q[r]}.6`:void 0,children:e}),n.jsx(u.Text,{fz:12,c:"dimmed",children:t})]})}function Ze({children:e,active:t,tone:r="neutral",size:s="md",leadingContent:i,keyboardHint:o,title:l,style:f,onClick:d}){return n.jsx(u.Badge,{color:q[r],variant:t?"filled":"light",size:s==="sm"?"sm":"md",leftSection:i,rightSection:o,title:l,onClick:d,style:{cursor:d?"pointer":void 0,textTransform:"none",...f},children:e})}function et({children:e,tone:t="neutral",title:r,icon:s,style:i}){return n.jsx(u.Alert,{color:q[t],title:r,icon:s,variant:"light",style:i,children:e})}const tt={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 rt({headers:e,rows:t,columnAlign:r,rowTone:s,framed:i=!0,striped:o,stickyHeader:l,style:f,emptyMessage:d}){return n.jsxs(u.Table,{withTableBorder:i,withColumnBorders:!1,striped:o,stickyHeader:l,highlightOnHover:!0,style:f,children:[n.jsx(u.Table.Thead,{children:n.jsx(u.Table.Tr,{children:e.map((c,h)=>n.jsx(u.Table.Th,{ta:(r==null?void 0:r[h])??"left",children:c},h))})}),n.jsx(u.Table.Tbody,{children:t.length===0?n.jsx(u.Table.Tr,{children:n.jsx(u.Table.Td,{colSpan:e.length,ta:"center",c:"dimmed",children:d??"No data"})}):t.map((c,h)=>{const x=s==null?void 0:s[h];return n.jsx(u.Table.Tr,{style:x?{background:tt[x]}:void 0,children:e.map((v,b)=>n.jsx(u.Table.Td,{ta:(r==null?void 0:r[b])??"left",children:c[b]},b))},h)})})]})}const nt={primary:"filled",secondary:"default",ghost:"subtle"};function ot({children:e,variant:t="secondary",disabled:r,type:s="button",style:i,onClick:o}){return n.jsx(u.Button,{variant:nt[t],size:"xs",disabled:r,type:s,onClick:o,style:i,children:e})}function at({children:e,onClick:t,disabled:r,title:s,variant:i="default",size:o="md",style:l}){return n.jsx(u.ActionIcon,{variant:i==="circle"?"light":"subtle",radius:i==="circle"?"xl":"sm",size:o==="sm"?"sm":"md",color:"gray",disabled:r,title:s,"aria-label":s,onClick:t,style:l,children:e})}function st({value:e,onChange:t,options:r,placeholder:s,disabled:i,style:o}){return n.jsx(u.Select,{value:e,data:r,placeholder:s,disabled:i,allowDeselect:!1,onChange:l=>{l!==null&&(t==null||t(l))},style:o})}function it({checked:e,onChange:t,disabled:r,label:s,style:i}){return n.jsx(u.Checkbox,{checked:e,disabled:r,label:s,onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function ct({checked:e,onChange:t,disabled:r,size:s="sm",style:i}){return n.jsx(u.Switch,{checked:e,disabled:r,size:s==="sm"?"sm":"md",onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function lt({value:e,onChange:t,placeholder:r,disabled:s,type:i,style:o}){return n.jsx(u.TextInput,{value:e,placeholder:r,disabled:s,type:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function dt({value:e,onChange:t,placeholder:r,disabled:s,rows:i=3,style:o}){return n.jsx(u.Textarea,{value:e,placeholder:r,disabled:s,autosize:!0,minRows:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function ut({color:e,style:t}){const r=j();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[e],flex:"0 0 auto",...t}})}function ft({segments:e,total:t,topLeftLabel:r,topRightLabel:s,style:i}){const o=j(),l=t>0?t:1,f=e.reduce((c,h)=>c+(Number.isFinite(h.value)&&h.value>0?h.value:0),0),d=Math.max(0,l-f);return n.jsxs("div",{style:i,children:[(r!=null||s!=null)&&n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:o.text.secondary,marginBottom:6},children:[n.jsx("span",{children:r}),n.jsx("span",{children:s})]}),n.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[e.map((c,h)=>{const x=Number.isFinite(c.value)&&c.value>0?c.value:0,v=o.category[c.color??I[h%I.length]];return n.jsx("div",{style:{width:`${x/l*100}%`,background:v,borderRadius:3}},c.id)}),d>0&&n.jsx("div",{style:{width:`${d/l*100}%`,background:o.fill.tertiary,borderRadius:3}})]})]})}function ht({title:e,leading:t,count:r,trailing:s,children:i,defaultOpen:o=!1,style:l}){const f=j(),[d,c]=y.useState(o);return n.jsxs("div",{style:l,children:[n.jsxs("div",{onClick:()=>c(h=>!h),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[n.jsx(fe,{expanded:d}),t,n.jsx("span",{style:{fontWeight:500},children:e}),r!=null&&n.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:r}),n.jsx("span",{style:{flex:1}}),s!=null&&n.jsx("span",{style:{color:f.text.tertiary},children:s})]}),d&&n.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:i})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>y.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>y.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>y.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>y.useState});exports.BarChart=Ae;exports.Button=ot;exports.Callout=et;exports.Card=Ve;exports.CardBody=Ue;exports.CardHeader=Ye;exports.Checkbox=it;exports.Code=$e;exports.CollapsibleSection=ht;exports.DiffStats=we;exports.DiffView=Le;exports.Divider=Xe;exports.Grid=Ke;exports.H1=ze;exports.H2=Ie;exports.H3=We;exports.IconButton=at;exports.LineChart=Se;exports.Link=qe;exports.PieChart=Fe;exports.Pill=Ze;exports.Row=_e;exports.Select=st;exports.Spacer=Qe;exports.Stack=Ne;exports.Stat=Je;exports.Swatch=ut;exports.Table=rt;exports.Text=Ge;exports.TextArea=dt;exports.TextInput=lt;exports.TodoList=ue;exports.TodoListCard=Pe;exports.Toggle=ct;exports.UsageBar=ft;exports.canvasPaletteDark=O;exports.canvasPaletteLight=G;exports.canvasTokens=ae;exports.canvasTokensLight=se;exports.categoryPaletteDark=M;exports.categoryPaletteLight=$;exports.colorPalette=ye;exports.computeDAGLayout=Te;exports.mergeStyle=Re;exports.reshapeLineChartData=N;exports.usageColorSequence=I;exports.useCanvasAction=He;exports.useCanvasState=Me;exports.useHostTheme=j;
|
package/dist/cursor-canvas.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as i, jsxs as g } from "react/jsx-runtime";
|
|
2
|
-
import { useComputedColorScheme as xe, Button as ve, Alert as Ee, Card as be, Checkbox as ke, Divider as Ce, Title as W, ActionIcon as Se, Badge as Fe, Group as Ae, Select as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { useComputedColorScheme as xe, Button as ve, Alert as Ee, Card as be, Checkbox as ke, Divider as Ce, Title as W, ActionIcon as Se, Badge as Fe, Group as Ae, Select as we, Stack as Be, Text as H, Table as E, Textarea as Te, TextInput as Le, Switch as De } from "@mantine/core";
|
|
3
|
+
import { useState as P, createContext as Me, useCallback as G, useContext as ne } from "react";
|
|
4
4
|
import { useEffect as _t, useMemo as qt, useRef as Qt, useState as Kt } from "react";
|
|
5
|
-
import { BarChart as
|
|
5
|
+
import { BarChart as Pe, AreaChart as ze, LineChart as Re, DonutChart as $e, PieChart as He } from "@mantine/charts";
|
|
6
6
|
const oe = {
|
|
7
7
|
foreground: "#E4E4E4EB",
|
|
8
8
|
foregroundSecondary: "#E4E4E48D",
|
|
@@ -55,7 +55,7 @@ const oe = {
|
|
|
55
55
|
diffRemovedLine: "#CF2D5614",
|
|
56
56
|
diffStripAdded: "#1F8A65CC",
|
|
57
57
|
diffStripRemoved: "#CF2D56CC"
|
|
58
|
-
},
|
|
58
|
+
}, j = {
|
|
59
59
|
gray: "#8888A8E0",
|
|
60
60
|
purple: "#7B64B8F0",
|
|
61
61
|
green: "#1F8A65E8",
|
|
@@ -119,11 +119,11 @@ function ce(e, t) {
|
|
|
119
119
|
}
|
|
120
120
|
const Ie = ce(
|
|
121
121
|
oe,
|
|
122
|
-
|
|
122
|
+
j
|
|
123
123
|
), We = ce(
|
|
124
124
|
ae,
|
|
125
125
|
ie
|
|
126
|
-
), nt =
|
|
126
|
+
), nt = j, te = [
|
|
127
127
|
"blue",
|
|
128
128
|
"purple",
|
|
129
129
|
"green",
|
|
@@ -154,13 +154,13 @@ const Ie = ce(
|
|
|
154
154
|
vibrantTeal: "#2A9A8AE0",
|
|
155
155
|
muted: "#8888A8E0",
|
|
156
156
|
neutralLine: "#888899D0"
|
|
157
|
-
},
|
|
157
|
+
}, je = {
|
|
158
158
|
h1: { fontSize: "24px", lineHeight: "30px", fontWeight: 590 },
|
|
159
159
|
h2: { fontSize: "18px", lineHeight: "24px", fontWeight: 590 },
|
|
160
160
|
h3: { fontSize: "16px", lineHeight: "22px", fontWeight: 590 },
|
|
161
161
|
body: { fontSize: "14px", lineHeight: "20px", fontWeight: 400 },
|
|
162
162
|
small: { fontSize: "12px", lineHeight: "16px", fontWeight: 400 }
|
|
163
|
-
},
|
|
163
|
+
}, Ne = {
|
|
164
164
|
"0.5": 2,
|
|
165
165
|
1: 4,
|
|
166
166
|
"1.5": 6,
|
|
@@ -206,7 +206,7 @@ const Ie = ce(
|
|
|
206
206
|
added: "#1F8A65",
|
|
207
207
|
deleted: "#CF2D56",
|
|
208
208
|
renamed: "#5A6CC0"
|
|
209
|
-
},
|
|
209
|
+
}, N = {
|
|
210
210
|
success: "green",
|
|
211
211
|
danger: "red",
|
|
212
212
|
warning: "orange",
|
|
@@ -223,13 +223,13 @@ function _e(e) {
|
|
|
223
223
|
kind: e,
|
|
224
224
|
tokens: t,
|
|
225
225
|
palette: e === "dark" ? oe : ae,
|
|
226
|
-
category: e === "dark" ?
|
|
226
|
+
category: e === "dark" ? j : ie,
|
|
227
227
|
// Back-compat: real IDE canvases read these on useHostTheme(); public hooks.d.ts
|
|
228
228
|
// is sometimes narrower — see COMPAT.md (not a second theme API version).
|
|
229
229
|
chart: { palette: Ge, sequence: I },
|
|
230
230
|
radius: Oe,
|
|
231
|
-
typography:
|
|
232
|
-
spacing:
|
|
231
|
+
typography: je,
|
|
232
|
+
spacing: Ne
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
function S() {
|
|
@@ -293,7 +293,7 @@ function ot({
|
|
|
293
293
|
referenceLines: y,
|
|
294
294
|
style: x
|
|
295
295
|
}) {
|
|
296
|
-
const v = le(e, t),
|
|
296
|
+
const v = le(e, t), w = de(t), k = fe({
|
|
297
297
|
beginAtZero: d,
|
|
298
298
|
yMin: s,
|
|
299
299
|
yMax: f,
|
|
@@ -303,7 +303,7 @@ function ot({
|
|
|
303
303
|
h: r,
|
|
304
304
|
data: v,
|
|
305
305
|
dataKey: "category",
|
|
306
|
-
series:
|
|
306
|
+
series: w,
|
|
307
307
|
curveType: "monotone",
|
|
308
308
|
withLegend: t.length > 1,
|
|
309
309
|
valueFormatter: ue(c, n),
|
|
@@ -312,7 +312,7 @@ function ot({
|
|
|
312
312
|
...k,
|
|
313
313
|
style: x
|
|
314
314
|
};
|
|
315
|
-
return a ? /* @__PURE__ */ i(
|
|
315
|
+
return a ? /* @__PURE__ */ i(ze, { ...C }) : /* @__PURE__ */ i(Re, { ...C });
|
|
316
316
|
}
|
|
317
317
|
function at({
|
|
318
318
|
categories: e,
|
|
@@ -330,7 +330,7 @@ function at({
|
|
|
330
330
|
referenceLines: x,
|
|
331
331
|
style: v
|
|
332
332
|
}) {
|
|
333
|
-
const
|
|
333
|
+
const w = le(e, t), k = n ? "percent" : a ? "stacked" : "default", C = fe({
|
|
334
334
|
beginAtZero: s,
|
|
335
335
|
yMin: f,
|
|
336
336
|
yMax: y,
|
|
@@ -338,36 +338,61 @@ function at({
|
|
|
338
338
|
horizontal: c,
|
|
339
339
|
stacked: a,
|
|
340
340
|
normalized: n
|
|
341
|
-
}),
|
|
341
|
+
}), B = !a && !n && Qe(d, t, e);
|
|
342
342
|
return /* @__PURE__ */ i(
|
|
343
|
-
|
|
343
|
+
Pe,
|
|
344
344
|
{
|
|
345
345
|
h: r,
|
|
346
|
-
data:
|
|
346
|
+
data: w,
|
|
347
347
|
dataKey: "category",
|
|
348
348
|
series: de(t),
|
|
349
349
|
type: k,
|
|
350
350
|
orientation: c ? "vertical" : "horizontal",
|
|
351
351
|
withLegend: t.length > 1,
|
|
352
352
|
valueFormatter: ue(l, u),
|
|
353
|
-
withBarValueLabel:
|
|
353
|
+
withBarValueLabel: B,
|
|
354
354
|
...C,
|
|
355
355
|
style: v
|
|
356
356
|
}
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
359
|
function it({ data: e, size: t = 200, donut: r, style: a }) {
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
360
|
+
const c = e.map((l, u) => ({
|
|
361
|
+
name: l.label,
|
|
362
|
+
value: l.value,
|
|
363
|
+
color: se(l.tone, u)
|
|
364
|
+
}));
|
|
365
|
+
return /* @__PURE__ */ i(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
style: {
|
|
369
|
+
width: "100%",
|
|
370
|
+
height: t,
|
|
371
|
+
minHeight: t,
|
|
372
|
+
display: "flex",
|
|
373
|
+
alignItems: "center",
|
|
374
|
+
justifyContent: "center"
|
|
375
|
+
},
|
|
376
|
+
children: r ? /* @__PURE__ */ i(
|
|
377
|
+
$e,
|
|
378
|
+
{
|
|
379
|
+
data: c,
|
|
380
|
+
size: t,
|
|
381
|
+
withTooltip: !0,
|
|
382
|
+
style: a
|
|
383
|
+
}
|
|
384
|
+
) : /* @__PURE__ */ i(
|
|
385
|
+
He,
|
|
386
|
+
{
|
|
387
|
+
data: c,
|
|
388
|
+
size: t,
|
|
389
|
+
withTooltip: !0,
|
|
390
|
+
withLabelsLine: !1,
|
|
391
|
+
style: a
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
);
|
|
371
396
|
}
|
|
372
397
|
function ct(e) {
|
|
373
398
|
const {
|
|
@@ -383,25 +408,25 @@ function ct(e) {
|
|
|
383
408
|
for (const o of s) y.set(o, []);
|
|
384
409
|
for (const o of r)
|
|
385
410
|
f.has(o.from) && f.has(o.to) && y.get(o.from).push(o.to);
|
|
386
|
-
const x = 0, v = 1,
|
|
411
|
+
const x = 0, v = 1, w = 2, k = new Map(s.map((o) => [o, x])), C = /* @__PURE__ */ new Set(), B = (o, h) => `${o}\0${h}`, _ = (o) => {
|
|
387
412
|
k.set(o, v);
|
|
388
413
|
for (const h of y.get(o) ?? []) {
|
|
389
414
|
const p = k.get(h);
|
|
390
|
-
p === v ? C.add(
|
|
415
|
+
p === v ? C.add(B(o, h)) : p === x && _(h);
|
|
391
416
|
}
|
|
392
|
-
k.set(o,
|
|
417
|
+
k.set(o, w);
|
|
393
418
|
};
|
|
394
419
|
for (const o of s) k.get(o) === x && _(o);
|
|
395
420
|
const ge = r.filter(
|
|
396
|
-
(o) => f.has(o.from) && f.has(o.to) && !C.has(
|
|
421
|
+
(o) => f.has(o.from) && f.has(o.to) && !C.has(B(o.from, o.to))
|
|
397
422
|
), F = new Map(s.map((o) => [o, 0])), q = new Map(s.map((o) => [o, []]));
|
|
398
423
|
for (const o of ge)
|
|
399
424
|
q.get(o.from).push(o.to), F.set(o.to, (F.get(o.to) ?? 0) + 1);
|
|
400
|
-
const T = new Map(s.map((o) => [o, 0])),
|
|
401
|
-
for (;
|
|
402
|
-
const o =
|
|
425
|
+
const T = new Map(s.map((o) => [o, 0])), z = s.filter((o) => (F.get(o) ?? 0) === 0);
|
|
426
|
+
for (; z.length > 0; ) {
|
|
427
|
+
const o = z.shift(), h = T.get(o);
|
|
403
428
|
for (const p of q.get(o))
|
|
404
|
-
T.set(p, Math.max(T.get(p), h + 1)), F.set(p, F.get(p) - 1), F.get(p) === 0 &&
|
|
429
|
+
T.set(p, Math.max(T.get(p), h + 1)), F.set(p, F.get(p) - 1), F.get(p) === 0 && z.push(p);
|
|
405
430
|
}
|
|
406
431
|
const A = /* @__PURE__ */ new Map();
|
|
407
432
|
for (const o of s) {
|
|
@@ -441,7 +466,7 @@ function ct(e) {
|
|
|
441
466
|
sourceY: h.y,
|
|
442
467
|
targetX: p.x,
|
|
443
468
|
targetY: p.y,
|
|
444
|
-
isBackEdge: C.has(
|
|
469
|
+
isBackEdge: C.has(B(o.from, o.to))
|
|
445
470
|
};
|
|
446
471
|
}), V = d * 2 + L.length * (m ? n : c) + Math.max(0, L.length - 1) * l, J = d * 2 + K;
|
|
447
472
|
return {
|
|
@@ -653,7 +678,7 @@ function dt({
|
|
|
653
678
|
onTodoClick: a,
|
|
654
679
|
style: c
|
|
655
680
|
}) {
|
|
656
|
-
const n = S(), [l, u] =
|
|
681
|
+
const n = S(), [l, u] = P(r);
|
|
657
682
|
if (e.length === 0) return null;
|
|
658
683
|
const d = e.filter((s) => s.status === "completed").length;
|
|
659
684
|
return /* @__PURE__ */ g(
|
|
@@ -733,7 +758,7 @@ function dt({
|
|
|
733
758
|
);
|
|
734
759
|
}
|
|
735
760
|
function ut(e, t) {
|
|
736
|
-
const r = `canvas:${e}`, [a, c] =
|
|
761
|
+
const r = `canvas:${e}`, [a, c] = P(() => {
|
|
737
762
|
if (typeof localStorage > "u") return t;
|
|
738
763
|
try {
|
|
739
764
|
const l = localStorage.getItem(r);
|
|
@@ -831,7 +856,7 @@ function vt({ children: e, href: t, style: r }) {
|
|
|
831
856
|
);
|
|
832
857
|
}
|
|
833
858
|
function Et({ children: e, gap: t, style: r }) {
|
|
834
|
-
return /* @__PURE__ */ i(
|
|
859
|
+
return /* @__PURE__ */ i(Be, { gap: t, style: r, children: e });
|
|
835
860
|
}
|
|
836
861
|
const re = {
|
|
837
862
|
start: "flex-start",
|
|
@@ -897,7 +922,7 @@ function Ft({
|
|
|
897
922
|
onOpenChange: n,
|
|
898
923
|
style: l
|
|
899
924
|
}) {
|
|
900
|
-
const [u, d] =
|
|
925
|
+
const [u, d] = P(a), s = c ?? u, f = G(() => {
|
|
901
926
|
const y = !s;
|
|
902
927
|
c === void 0 && d(y), n == null || n(y);
|
|
903
928
|
}, [s, c, n]);
|
|
@@ -942,7 +967,7 @@ function At({ children: e, trailing: t, style: r }) {
|
|
|
942
967
|
}
|
|
943
968
|
);
|
|
944
969
|
}
|
|
945
|
-
function
|
|
970
|
+
function wt({ children: e, style: t }) {
|
|
946
971
|
const { collapsible: r, open: a } = ne(O);
|
|
947
972
|
return r && !a ? null : /* @__PURE__ */ i("div", { style: { padding: 14, ...t }, children: e });
|
|
948
973
|
}
|
|
@@ -972,7 +997,7 @@ function he({ expanded: e }) {
|
|
|
972
997
|
}
|
|
973
998
|
);
|
|
974
999
|
}
|
|
975
|
-
function
|
|
1000
|
+
function Bt({ value: e, label: t, tone: r, style: a }) {
|
|
976
1001
|
return /* @__PURE__ */ g("div", { style: a, children: [
|
|
977
1002
|
/* @__PURE__ */ i(
|
|
978
1003
|
H,
|
|
@@ -980,7 +1005,7 @@ function wt({ value: e, label: t, tone: r, style: a }) {
|
|
|
980
1005
|
fz: 22,
|
|
981
1006
|
fw: 700,
|
|
982
1007
|
lh: 1.2,
|
|
983
|
-
c: r ? `${
|
|
1008
|
+
c: r ? `${N[r]}.6` : void 0,
|
|
984
1009
|
children: e
|
|
985
1010
|
}
|
|
986
1011
|
),
|
|
@@ -1001,7 +1026,7 @@ function Tt({
|
|
|
1001
1026
|
return /* @__PURE__ */ i(
|
|
1002
1027
|
Fe,
|
|
1003
1028
|
{
|
|
1004
|
-
color:
|
|
1029
|
+
color: N[r],
|
|
1005
1030
|
variant: t ? "filled" : "light",
|
|
1006
1031
|
size: a === "sm" ? "sm" : "md",
|
|
1007
1032
|
leftSection: c,
|
|
@@ -1027,7 +1052,7 @@ function Lt({
|
|
|
1027
1052
|
return /* @__PURE__ */ i(
|
|
1028
1053
|
Ee,
|
|
1029
1054
|
{
|
|
1030
|
-
color:
|
|
1055
|
+
color: N[t],
|
|
1031
1056
|
title: r,
|
|
1032
1057
|
icon: a,
|
|
1033
1058
|
variant: "light",
|
|
@@ -1113,7 +1138,7 @@ function Mt({
|
|
|
1113
1138
|
}
|
|
1114
1139
|
);
|
|
1115
1140
|
}
|
|
1116
|
-
function
|
|
1141
|
+
function Pt({
|
|
1117
1142
|
children: e,
|
|
1118
1143
|
onClick: t,
|
|
1119
1144
|
disabled: r,
|
|
@@ -1138,7 +1163,7 @@ function zt({
|
|
|
1138
1163
|
}
|
|
1139
1164
|
);
|
|
1140
1165
|
}
|
|
1141
|
-
function
|
|
1166
|
+
function zt({
|
|
1142
1167
|
value: e,
|
|
1143
1168
|
onChange: t,
|
|
1144
1169
|
options: r,
|
|
@@ -1147,7 +1172,7 @@ function Pt({
|
|
|
1147
1172
|
style: n
|
|
1148
1173
|
}) {
|
|
1149
1174
|
return /* @__PURE__ */ i(
|
|
1150
|
-
|
|
1175
|
+
we,
|
|
1151
1176
|
{
|
|
1152
1177
|
value: e,
|
|
1153
1178
|
data: r,
|
|
@@ -1311,7 +1336,7 @@ function Gt({
|
|
|
1311
1336
|
] })
|
|
1312
1337
|
] });
|
|
1313
1338
|
}
|
|
1314
|
-
function
|
|
1339
|
+
function jt({
|
|
1315
1340
|
title: e,
|
|
1316
1341
|
leading: t,
|
|
1317
1342
|
count: r,
|
|
@@ -1320,7 +1345,7 @@ function Nt({
|
|
|
1320
1345
|
defaultOpen: n = !1,
|
|
1321
1346
|
style: l
|
|
1322
1347
|
}) {
|
|
1323
|
-
const u = S(), [d, s] =
|
|
1348
|
+
const u = S(), [d, s] = P(n);
|
|
1324
1349
|
return /* @__PURE__ */ g("div", { style: l, children: [
|
|
1325
1350
|
/* @__PURE__ */ g(
|
|
1326
1351
|
"div",
|
|
@@ -1354,11 +1379,11 @@ export {
|
|
|
1354
1379
|
Mt as Button,
|
|
1355
1380
|
Lt as Callout,
|
|
1356
1381
|
Ft as Card,
|
|
1357
|
-
|
|
1382
|
+
wt as CardBody,
|
|
1358
1383
|
At as CardHeader,
|
|
1359
1384
|
Rt as Checkbox,
|
|
1360
1385
|
xt as Code,
|
|
1361
|
-
|
|
1386
|
+
jt as CollapsibleSection,
|
|
1362
1387
|
st as DiffStats,
|
|
1363
1388
|
lt as DiffView,
|
|
1364
1389
|
St as Divider,
|
|
@@ -1366,16 +1391,16 @@ export {
|
|
|
1366
1391
|
gt as H1,
|
|
1367
1392
|
pt as H2,
|
|
1368
1393
|
yt as H3,
|
|
1369
|
-
|
|
1394
|
+
Pt as IconButton,
|
|
1370
1395
|
ot as LineChart,
|
|
1371
1396
|
vt as Link,
|
|
1372
1397
|
it as PieChart,
|
|
1373
1398
|
Tt as Pill,
|
|
1374
1399
|
bt as Row,
|
|
1375
|
-
|
|
1400
|
+
zt as Select,
|
|
1376
1401
|
kt as Spacer,
|
|
1377
1402
|
Et as Stack,
|
|
1378
|
-
|
|
1403
|
+
Bt as Stat,
|
|
1379
1404
|
Wt as Swatch,
|
|
1380
1405
|
Dt as Table,
|
|
1381
1406
|
mt as Text,
|
|
@@ -1389,7 +1414,7 @@ export {
|
|
|
1389
1414
|
ae as canvasPaletteLight,
|
|
1390
1415
|
Ie as canvasTokens,
|
|
1391
1416
|
We as canvasTokensLight,
|
|
1392
|
-
|
|
1417
|
+
j as categoryPaletteDark,
|
|
1393
1418
|
ie as categoryPaletteLight,
|
|
1394
1419
|
nt as colorPalette,
|
|
1395
1420
|
ct as computeDAGLayout,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesler/cursor-canvas-web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"repository": "github:flesler/cursor-canvas-web",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Deploy your Cursor canvases to the web.",
|
|
@@ -50,6 +50,11 @@
|
|
|
50
50
|
"sync:sdk": "bash scripts/sync-cursor-sdk-snapshot.sh",
|
|
51
51
|
"check:sdk-exports": "node scripts/diff-sdk-exports.mjs",
|
|
52
52
|
"test:contract": "pnpm run build:lib && pnpm run sync:sdk && node scripts/generate-contract-consumer.mjs && pnpm run check:sdk-exports && pnpm exec tsc -p test/contract/tsconfig.json",
|
|
53
|
+
"test:contract:ci": "pnpm run build:lib && node scripts/generate-contract-consumer.mjs && pnpm run check:sdk-exports && pnpm exec tsc -p test/contract/tsconfig.json",
|
|
54
|
+
"sync:demo": "bash scripts/sync-demo-canvas.sh",
|
|
55
|
+
"demo:screenshot": "bash scripts/readme-screenshot.sh",
|
|
56
|
+
"ci:local": "pnpm typecheck && pnpm lint && pnpm test && pnpm test:contract:ci",
|
|
57
|
+
"prepare": "[ \"$CI\" != \"true\" ] && [ -d node_modules/husky ] && husky || true",
|
|
53
58
|
"prepublishOnly": "pnpm typecheck && pnpm test && pnpm build:lib"
|
|
54
59
|
},
|
|
55
60
|
"peerDependencies": {
|
|
@@ -61,12 +66,12 @@
|
|
|
61
66
|
},
|
|
62
67
|
"devDependencies": {
|
|
63
68
|
"@eslint/js": "^9.20.0",
|
|
64
|
-
"@mantine/charts": "^8.3.
|
|
65
|
-
"@mantine/core": "^8.3.
|
|
66
|
-
"@mantine/hooks": "^8.3.
|
|
69
|
+
"@mantine/charts": "^8.3.18",
|
|
70
|
+
"@mantine/core": "^8.3.18",
|
|
71
|
+
"@mantine/hooks": "^8.3.18",
|
|
67
72
|
"react": "^18.3.1",
|
|
68
73
|
"react-dom": "^18.3.1",
|
|
69
|
-
"recharts": "^
|
|
74
|
+
"recharts": "^3.10.1",
|
|
70
75
|
"@testing-library/jest-dom": "^6.6.3",
|
|
71
76
|
"@testing-library/react": "^16.2.0",
|
|
72
77
|
"@types/node": "^22.13.1",
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
78
83
|
"eslint-plugin-react-refresh": "^0.4.18",
|
|
79
84
|
"globals": "^15.14.0",
|
|
85
|
+
"husky": "^9.1.7",
|
|
80
86
|
"jsdom": "^26.0.0",
|
|
81
87
|
"prettier": "^3.5.1",
|
|
82
88
|
"typescript": "^5.7.3",
|