@flesler/cursor-canvas-web 1.0.2 → 1.1.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 +9 -8
- package/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +702 -746
- package/dist/host-tokens-Cjzmp0z_.cjs +1 -0
- package/dist/host-tokens-Dh2BFFjv.js +412 -0
- package/dist/runtime/index.d.ts +5 -7
- package/dist/runtime.cjs +5 -1
- package/dist/runtime.js +109 -14
- package/package.json +22 -13
- package/src/vendor/canvas/SKILL.md +113 -0
- package/src/vendor/canvas-sdk/callout-tone-icons.d.ts +10 -0
- package/src/vendor/canvas-sdk/canvas-tokens.d.ts +259 -0
- package/src/vendor/canvas-sdk/chart-primitives.d.ts +272 -0
- package/src/vendor/canvas-sdk/collapsible-section.d.ts +66 -0
- package/src/vendor/canvas-sdk/dag-layout.d.ts +101 -0
- package/src/vendor/canvas-sdk/diff-view.d.ts +129 -0
- package/src/vendor/canvas-sdk/form-primitives.d.ts +194 -0
- package/src/vendor/canvas-sdk/hooks.d.ts +173 -0
- package/src/vendor/canvas-sdk/index.d.ts +65 -0
- package/src/vendor/canvas-sdk/internal/canvas-action-dispatch.d.ts +17 -0
- package/src/vendor/canvas-sdk/manifest.json +5 -0
- package/src/vendor/canvas-sdk/swatch.d.ts +39 -0
- package/src/vendor/canvas-sdk/theme.d.ts +107 -0
- package/src/vendor/canvas-sdk/todo-list.d.ts +48 -0
- package/src/vendor/canvas-sdk/ui-primitives.d.ts +569 -0
- package/src/vendor/canvas-sdk/usage-bar.d.ts +55 -0
- package/dist/shim/charts.d.ts +0 -66
- package/dist/shim/cursor-canvas.d.ts +0 -278
- package/dist/shim/dag.d.ts +0 -55
- package/dist/shim/diff.d.ts +0 -23
- package/dist/shim/theme.d.ts +0 -323
- package/dist/shim/todo.d.ts +0 -22
- package/dist/shim/use-tokens.d.ts +0 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cursor-canvas-web
|
|
2
2
|
|
|
3
|
-
> **Fork** of [`@thisismydesign/cursor-canvas-web`](https://github.com/thisismydesign/cursor-canvas-web) ([npm](https://www.npmjs.com/package/@thisismydesign/cursor-canvas-web)), published as
|
|
3
|
+
> **Fork** of [`@thisismydesign/cursor-canvas-web`](https://github.com/thisismydesign/cursor-canvas-web) ([npm](https://www.npmjs.com/package/@thisismydesign/cursor-canvas-web)), published as `@flesler/cursor-canvas-web`. We keep the shim aligned with the Cursor IDE `cursor/canvas` SDK (see [`COMPAT.md`](./COMPAT.md), `pnpm test:contract`) and track current stack versions — **Mantine 8** and **Recharts 2 or 3** — instead of the upstream Mantine 7 line.
|
|
4
4
|
|
|
5
5
|
Deploy **Cursor canvases** to the web.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ A Cursor canvas is a `.tsx` that imports only from `cursor/canvas`. That module
|
|
|
15
15
|
<img src="docs/demo-dark.png" alt="Demo canvas (dark)" width="49%" />
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
-
Regenerate demo: `pnpm sync:demo` then `pnpm demo:screenshot` (sibling [open-canvas](https://github.com/flesler/open-canvas) built;
|
|
18
|
+
Regenerate demo: `pnpm sync:demo` then `pnpm demo:screenshot` (sibling [open-canvas](https://github.com/flesler/open-canvas) built; uses `open-canvas generate --formats cursor`).
|
|
19
19
|
|
|
20
20
|
## How it works: a module shim, not a converter
|
|
21
21
|
|
|
@@ -44,8 +44,8 @@ pnpm add react react-dom @mantine/core@^8 @mantine/charts@^8 recharts@^2
|
|
|
44
44
|
|
|
45
45
|
The package ships two entry points:
|
|
46
46
|
|
|
47
|
-
| Import
|
|
48
|
-
|
|
|
47
|
+
| Import | Provides |
|
|
48
|
+
| ------------------------------------ | --------------------------------------------- |
|
|
49
49
|
| `@flesler/cursor-canvas-web` | The `cursor/canvas` shim (components, hooks). |
|
|
50
50
|
| `@flesler/cursor-canvas-web/runtime` | `CanvasRoot` + `mountCanvas` web host glue. |
|
|
51
51
|
|
|
@@ -130,9 +130,10 @@ The shim implements the **full public `cursor/canvas` surface**:
|
|
|
130
130
|
and `spacing` (see `COMPAT.md` for IDE vs web)
|
|
131
131
|
|
|
132
132
|
Known fidelity gaps (behavior is reproduced, not the exact renderer):
|
|
133
|
-
`DiffView` skips Shiki
|
|
134
|
-
|
|
135
|
-
Cursor theme rather than
|
|
133
|
+
`DiffView` skips IDE Shiki highlighting (plain-text lines; gutters/backgrounds
|
|
134
|
+
stay). Charts use Recharts instead of inline SVG; `useCanvasAction` is a
|
|
135
|
+
no-op on the web (IDE-only). Styling approximates the Cursor theme rather than
|
|
136
|
+
matching it pixel-for-pixel.
|
|
136
137
|
|
|
137
138
|
If your canvas needs an export the shim doesn't yet provide, see
|
|
138
139
|
[Extending the shim](#extending-the-shim).
|
|
@@ -170,7 +171,7 @@ pnpm typecheck # tsc --noEmit, strict
|
|
|
170
171
|
pnpm lint # eslint
|
|
171
172
|
pnpm test # vitest run
|
|
172
173
|
pnpm test:contract # IDE SDK snapshot + export parity + consumer tsc
|
|
173
|
-
pnpm sync:sdk # refresh
|
|
174
|
+
pnpm sync:sdk # refresh src/vendor/canvas-sdk from ~/.cursor/skills-cursor/canvas/sdk
|
|
174
175
|
pnpm build # typecheck + vite build -> dist/
|
|
175
176
|
```
|
|
176
177
|
|
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"),T=require("@mantine/charts"),H={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"},M={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"},ye={accent:"#1084FE",buttonBackground:"#1084FE",buttonForeground:"#070707",buttonHoverBackground:"#459FFE",link:"#80BEFE",strokeFocused:"#1084FE"},me={accent:"#0C64C1",buttonBackground:"#0C64C1",buttonForeground:"#FAFAFA",buttonHoverBackground:"#1084FE",link:"#0C64C1",strokeFocused:"#0C64C1"},ve={...H,...ye},be={...M,...me},R={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(H,R),se=oe(M,$),Ee=R,W=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],ke={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"},je={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}},Ce={"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},Se={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},O=["#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 Fe(e){const t=e==="dark"?ae:se;return{...t,kind:e,tokens:t,palette:e==="dark"?H:M,category:e==="dark"?R:$,chart:{palette:ke,sequence:O},radius:Se,typography:je,spacing:Ce}}function k(){const e=u.useComputedColorScheme("light");return Fe(e==="dark"?"dark":"light")}function ie(e,t){return e?E[e]:O[t%O.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 Ae(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=Ae(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 Be(e,t,r){return e!==void 0?e:t.length===1&&r.length<=8}function Te({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),A=ce(t),j=de({beginAtZero:d,yMin:c,yMax:h,referenceLines:x,horizontal:!1}),C={h:r,data:b,dataKey:"category",series:A,curveType:"monotone",withLegend:t.length>1,valueFormatter:le(i,o),withPointLabels:l??e.length<=20,tooltipProps:f?void 0:{cursor:!1},...j,style:v};return s?n.jsx(T.AreaChart,{...C}):n.jsx(T.LineChart,{...C})}function we({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 A=N(e,t),j=o?"percent":s?"stacked":"default",C=de({beginAtZero:c,yMin:h,yMax:x,referenceLines:v,horizontal:i,stacked:s,normalized:o}),B=!s&&!o&&Be(d,t,e);return n.jsx(T.BarChart,{h:r,data:A,dataKey:"category",series:ce(t),type:j,orientation:i?"vertical":"horizontal",withLegend:t.length>1,valueFormatter:le(l,f),withBarValueLabel:B,...C,style:b})}function Le({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(T.DonutChart,{data:i,size:t,withTooltip:!0,style:s}):n.jsx(T.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 De(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,A=2,j=new Map(c.map(a=>[a,v])),C=new Set,B=(a,g)=>`${a}\0${g}`,Q=a=>{j.set(a,b);for(const g of x.get(a)??[]){const p=j.get(g);p===b?C.add(B(a,g)):p===v&&Q(g)}j.set(a,A)};for(const a of c)j.get(a)===v&&Q(a);const he=r.filter(a=>h.has(a.from)&&h.has(a.to)&&!C.has(B(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 w=new Map(c.map(a=>[a,0])),z=c.filter(a=>(S.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)),S.set(p,S.get(p)-1),S.get(p)===0&&z.push(p)}const F=new Map;for(const a of c){const g=w.get(a);F.has(g)||F.set(g,[]),F.get(g).push(a)}const L=[...F.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(F.get(a).length))),D=new Map,Y=[];L.forEach((a,g)=>{const p=F.get(a),I=X(p.length),G=d+(V-I)/2,P=d+g*((m?o:i)+l);p.forEach((ee,te)=>{const re=G+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?G:P,y:m?P:G,width:m?I:i,height:m?o:I,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(B(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 Pe({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 He={added:"+",removed:"-",unchanged:" "};function Me({lines:e,showLineNumbers:t=!0,coloredLineNumbers:r=!0,showAccentStrip:s=!0,style:i}){const o=k(),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:He[c.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},h))})}function Re({status:e}){const t=k(),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=k();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(Re,{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 ze({todos:e,dimmedTodoIds:t,defaultExpanded:r=!1,onTodoClick:s,style:i}){const o=k(),[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 Ie(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 Ge(){return y.useCallback(e=>{},[])}function We(e,t){return{...e,...t}}function Oe({children:e,style:t}){return n.jsx(u.Title,{order:1,fz:24,lh:"30px",style:t,children:e})}function $e({children:e,style:t}){return n.jsx(u.Title,{order:2,fz:18,lh:"24px",style:t,children:e})}function qe({children:e,style:t}){return n.jsx(u.Title,{order:3,fz:16,lh:"22px",style:t,children:e})}const Ne={normal:400,medium:500,semibold:600,bold:700};function _e({children:e,tone:t="primary",size:r="body",as:s="p",weight:i="normal",italic:o,truncate:l,style:f}){const d=k();return n.jsx(u.Text,{component:s,size:r==="small"?"xs":"sm",fw:Ne[i],c:t==="primary"?void 0:d.text[t],truncate:l,style:{fontStyle:o?"italic":void 0,...f},children:e})}function Qe({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 Ke({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 Xe({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 Ve({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 Ye(){return n.jsx("div",{style:{flex:1}})}function Ue({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 Je({style:e}){return n.jsx(u.Divider,{style:e})}const _=y.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Ze({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 et({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 tt({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 rt({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 nt({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 ot({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 at={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 st({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:at[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 it={primary:"filled",secondary:"default",ghost:"subtle"};function ct({children:e,variant:t="secondary",disabled:r,type:s="button",style:i,onClick:o}){return n.jsx(u.Button,{variant:it[t],size:"xs",disabled:r,type:s,onClick:o,style:i,children:e})}function lt({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 dt({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 ut({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 ft({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 ht({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 gt({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 pt({color:e,style:t}){const r=k();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[e],flex:"0 0 auto",...t}})}function xt({segments:e,total:t,topLeftLabel:r,topRightLabel:s,style:i}){const o=k(),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??W[h%W.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 yt({title:e,leading:t,count:r,trailing:s,children:i,defaultOpen:o=!1,style:l}){const f=k(),[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=we;exports.Button=ct;exports.Callout=ot;exports.Card=Ze;exports.CardBody=tt;exports.CardHeader=et;exports.Checkbox=ut;exports.Code=Qe;exports.CollapsibleSection=yt;exports.DiffStats=Pe;exports.DiffView=Me;exports.Divider=Je;exports.Grid=Ue;exports.H1=Oe;exports.H2=$e;exports.H3=qe;exports.IconButton=lt;exports.LineChart=Te;exports.Link=Ke;exports.PieChart=Le;exports.Pill=nt;exports.Row=Ve;exports.Select=dt;exports.Spacer=Ye;exports.Stack=Xe;exports.Stat=rt;exports.Swatch=pt;exports.Table=st;exports.Text=_e;exports.TextArea=gt;exports.TextInput=ht;exports.TodoList=ue;exports.TodoListCard=ze;exports.Toggle=ft;exports.UsageBar=xt;exports.canvasPaletteDark=H;exports.canvasPaletteGrokDark=ve;exports.canvasPaletteGrokLight=be;exports.canvasPaletteLight=M;exports.canvasTokens=ae;exports.canvasTokensLight=se;exports.categoryPaletteDark=R;exports.categoryPaletteLight=$;exports.colorPalette=Ee;exports.computeDAGLayout=De;exports.mergeStyle=We;exports.reshapeLineChartData=N;exports.usageColorSequence=W;exports.useCanvasAction=Ge;exports.useCanvasState=Ie;exports.useHostTheme=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),h=require("@mantine/core"),j=require("react"),S=require("./host-tokens-Cjzmp0z_.cjs"),D=require("@mantine/charts"),C={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 t=h.useComputedColorScheme("light")==="dark"?"dark":"light";return S.resolveThemeForColorScheme(t)}const re={verticalAlign:"bottom",align:"center"},ne={legend:{justifyContent:"center"}};function G(){const t=g().chart.sequence;return(r,o)=>r?C[r]:t[o%t.length]}function oe(){const t=g().text.primary;return{textColor:t,barLabelColor:t}}function ae(e,t){return e.map((r,o)=>{const s={category:r};for(const a of t)s[a.name]=a.data[o]??0;return s})}function se(e,t){return e.map((r,o)=>({name:r.name,color:t(r.tone,o)}))}function ie(e,t){return r=>`${t??""}${r}${e??""}`}function pe(e,t){if(e!=null&&e.length)return e.map(r=>({...t?{x:r.value}:{y:r.value},label:r.label,color:r.tone?C[r.tone]:C.neutral}))}function le(e){const t=pe(e.referenceLines,!!e.horizontal);if(e.stacked||e.normalized)return{referenceLines:t};const r=e.beginAtZero!==!1,o=[e.yMin??(r?0:"auto"),e.yMax??"auto"];return e.horizontal?{xAxisProps:{domain:o},referenceLines:t}:{yAxisProps:{domain:o},referenceLines:t}}function xe(e,t,r){return e!==void 0?e:t.length===1&&r.length<=8}const Q=14;function ge(e){return e.length<=Q?e:`${e.slice(0,Q-1)}…`}function ye(e){var a;const t=typeof e.x=="number"?e.x:Number(e.x)||0,r=typeof e.y=="number"?e.y:Number(e.y)||0,o=String(((a=e.payload)==null?void 0:a.value)??""),s=ge(o);return n.jsx("g",{transform:`translate(${t},${r})`,children:n.jsxs("text",{x:-10,y:0,dy:4,textAnchor:"end",fill:"currentColor",fontSize:12,children:[n.jsx("title",{children:o}),s]})})}function me(e){return{fontWeight:700,fill:e}}function be(){return{yAxisProps:{tick:ye,width:96},barChartProps:{margin:{right:32}}}}function je(){return{barChartProps:{margin:{top:22}}}}function ve({categories:e,series:t,height:r=240,fill:o,valueSuffix:s,valuePrefix:a,showValues:c,showHoverGuide:f=!0,beginAtZero:u,yMin:l,yMax:d,referenceLines:y,style:b,smooth:p}){const T=G(),k=oe(),L=ae(e,t),P=se(t,T),A=le({beginAtZero:u,yMin:l,yMax:d,referenceLines:y,horizontal:!1}),w={h:r,data:L,dataKey:"category",series:P,curveType:p?"monotone":"linear",withLegend:t.length>1,legendProps:re,valueFormatter:ie(s,a),withPointLabels:c??e.length<=20,tooltipProps:f?void 0:{cursor:!1},styles:{...ne,legendItemName:{color:k.textColor}},...k,...A,style:b};return o?n.jsx(D.AreaChart,{...w}):n.jsx(D.LineChart,{...w})}function Se({categories:e,series:t,height:r=240,stacked:o,horizontal:s,normalized:a,valueSuffix:c,valuePrefix:f,showValues:u,beginAtZero:l,yMin:d,yMax:y,referenceLines:b,style:p}){const T=G(),k=oe(),L=ae(e,t),P=a?"percent":o?"stacked":"default",A=le({beginAtZero:l,yMin:d,yMax:y,referenceLines:b,horizontal:s,stacked:o,normalized:a}),w=!o&&!a&&xe(u,t,e);return n.jsx(D.BarChart,{h:r,data:L,dataKey:"category",series:se(t,T),type:P,orientation:s?"vertical":"horizontal",withLegend:t.length>1,legendProps:re,valueFormatter:ie(c,f),withBarValueLabel:w,...w?{valueLabelProps:me(k.barLabelColor)}:{},...s?be():w?je():{},styles:{...ne,legendItemName:{color:k.textColor}},...k,...A,style:p})}const ke=180,Ce=540;function Te(e,t){if(t<=0)return"0%";const r=e/t*100;return r<10&&Math.abs(r-Math.round(r))>.05?`${r.toFixed(1)}%`:`${Math.round(r)}%`}function we(e){return Math.max(28,Math.round(e*.22))}function Le(e){return e.map(t=>({dataKey:t.name,value:t.name,color:t.color,type:"circle"}))}function Pe(e,t){return e.map(r=>({name:r.name,color:r.color,label:`${r.name} ${Te(r.value,t)}`}))}function Ae({data:e,size:t=200,donut:r,style:o}){const[s,a]=j.useState(null),c=g(),f=G(),u=e.map((p,T)=>({name:p.label,value:p.value,color:f(p.tone,T)})),l=u.reduce((p,T)=>p+T.value,0),d={startAngle:ke,endAngle:Ce},y=p=>({opacity:s===null||s===p?1:.35}),b=r?n.jsx(D.DonutChart,{data:u,size:t,thickness:we(t),withTooltip:!0,chartLabel:l,cellProps:p=>y(p.name),...d}):n.jsx(D.PieChart,{data:u,size:t,withTooltip:!0,withLabelsLine:!1,cellProps:p=>y(p.name),...d});return n.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",...o},children:[n.jsx("div",{style:{width:"100%",height:t,minHeight:t,display:"flex",alignItems:"center",justifyContent:"center"},children:b}),n.jsx(D.ChartLegend,{payload:Le(u),series:Pe(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 Me(e){const{nodes:t,edges:r,direction:o="vertical",nodeWidth:s=160,nodeHeight:a=40,rankGap:c=64,nodeGap:f=48,padding:u=24}=e,l=t.map(i=>i.id),d=new Set(l),y=new Map;for(const i of l)y.set(i,[]);for(const i of r)d.has(i.from)&&d.has(i.to)&&y.get(i.from).push(i.to);const b=0,p=1,T=2,k=new Map(l.map(i=>[i,b])),L=new Set,P=(i,x)=>`${i}\0${x}`,A=i=>{k.set(i,p);for(const x of y.get(i)??[]){const m=k.get(x);m===p?L.add(P(i,x)):m===b&&A(x)}k.set(i,T)};for(const i of l)k.get(i)===b&&A(i);const w=r.filter(i=>d.has(i.from)&&d.has(i.to)&&!L.has(P(i.from,i.to))),M=new Map(l.map(i=>[i,0])),O=new Map(l.map(i=>[i,[]]));for(const i of w)O.get(i.from).push(i.to),M.set(i.to,(M.get(i.to)??0)+1);const F=new Map(l.map(i=>[i,0])),I=l.filter(i=>(M.get(i)??0)===0);for(;I.length>0;){const i=I.shift(),x=F.get(i);for(const m of O.get(i))F.set(m,Math.max(F.get(m),x+1)),M.set(m,M.get(m)-1),M.get(m)===0&&I.push(m)}const B=new Map;for(const i of l){const x=F.get(i);B.has(x)||B.set(x,[]),B.get(x).push(i)}const E=[...B.keys()].sort((i,x)=>i-x),v=o==="vertical",W=i=>i*(v?s:a)+Math.max(0,i-1)*f,q=Math.max(0,...E.map(i=>W(B.get(i).length))),H=new Map,K=[];E.forEach((i,x)=>{const m=B.get(i),N=W(m.length),z=u+(q-N)/2,R=u+x*((v?a:s)+c);m.forEach((U,Z)=>{const J=z+Z*((v?s:a)+f),fe=v?J:R,he=v?R:J;H.set(U,{id:U,x:fe,y:he,rank:i,order:Z})}),K.push({rank:i,x:v?z:R,y:v?R:z,width:v?N:s,height:v?a:N,nodeIds:m})});const X=(i,x)=>i?v?{x:i.x+s/2,y:x==="source"?i.y+a:i.y}:{x:x==="source"?i.x+s:i.x,y:i.y+a/2}:{x:0,y:0},de=r.filter(i=>d.has(i.from)&&d.has(i.to)).map(i=>{const x=X(H.get(i.from),"source"),m=X(H.get(i.to),"target");return{from:i.from,to:i.to,sourceX:x.x,sourceY:x.y,targetX:m.x,targetY:m.y,isBackEdge:L.has(P(i.from,i.to))}}),V=u*2+E.length*(v?a:s)+Math.max(0,E.length-1)*c,Y=u*2+q;return{nodes:[...H.values()],edges:de,ranks:K,direction:o,width:v?Y:V,height:v?V:Y}}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:C.added},children:["+",e]}),t>0&&n.jsxs("span",{style:{color:C.deleted},children:["-",t]})]})}const De={added:"+",removed:"-",unchanged:" "};function Fe({lines:e,showLineNumbers:t=!0,coloredLineNumbers:r=!0,showAccentStrip:o=!0,style:s}){const a=g(),c=l=>l==="added"?a.diff.insertedLine:l==="removed"?a.diff.removedLine:"transparent",f=l=>l==="added"?a.diff.stripAdded:l==="removed"?a.diff.stripRemoved:"transparent",u=l=>r&&l==="added"?C.added:r&&l==="removed"?C.deleted:a.text.tertiary;return n.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:e.map((l,d)=>n.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:c(l.type),borderLeft:o?`3px solid ${f(l.type)}`:void 0},children:[t&&n.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:u(l.type)},children:l.lineNumber??""}),n.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:u(l.type)},children:De[l.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:l.content})]},d))})}function Ee({status:e}){const t=g(),r=e==="completed"?C.success:e==="in_progress"?t.accent.primary:e==="cancelled"?C.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 ce({todos:e,dimmedTodoIds:t,onTodoClick:r,style:o}){const s=g();return e.length===0?null:n.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:e.map(a=>{const c=t==null?void 0:t.has(a.id);return n.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(a),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:r?"pointer":"default",color:s.text.primary,fontSize:14,lineHeight:"20px",opacity:c?.45:1},children:[n.jsx(Ee,{status:a.status}),n.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 He({todos:e,dimmedTodoIds:t,defaultExpanded:r=!1,onTodoClick:o,style:s}){const a=g(),[c,f]=j.useState(r);if(e.length===0)return null;const u=e.filter(l=>l.status==="completed").length;return n.jsxs("div",{style:{border:`1px solid ${a.stroke.primary}`,borderRadius:6,overflow:"hidden",...s},children:[n.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:[n.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: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:[u," of ",e.length," Done"]})]}),c&&n.jsx("div",{style:{padding:6},children:n.jsx(ce,{todos:e,dimmedTodoIds:t,onTodoClick:o})})]})}function Re(e,t){const r=`canvas:${e}`,[o,s]=j.useState(()=>{if(typeof localStorage>"u")return t;try{const c=localStorage.getItem(r);return c===null?t:JSON.parse(c)}catch{return t}}),a=j.useCallback(c=>{s(f=>{const u=typeof c=="function"?c(f):c;try{localStorage==null||localStorage.setItem(r,JSON.stringify(u))}catch{}return u})},[r]);return[o,a]}function Ie(){return j.useCallback(e=>{},[])}function Ne(e,t){return{...e,...t}}function _(e,t,r){const o=e.typography[t];return{fontFamily:e.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:e.text.primary,margin:0,...r}}function ze({children:e,style:t}){const r=g();return n.jsx(h.Title,{order:1,style:_(r,"h1",t),children:e})}function Ge({children:e,style:t}){const r=g();return n.jsx(h.Title,{order:2,style:_(r,"h2",t),children:e})}function _e({children:e,style:t}){const r=g();return n.jsx(h.Title,{order:3,style:_(r,"h3",t),children:e})}const $e={normal:400,medium:500,semibold:600,bold:700};function Oe({children:e,tone:t="primary",size:r="body",as:o="p",weight:s="normal",italic:a,truncate:c,style:f}){const u=g();return n.jsx(h.Text,{component:o,size:r==="small"?"xs":"sm",fw:$e[s],c:t==="primary"?void 0:u.text[t],truncate:c,style:{fontStyle:a?"italic":void 0,...t==="primary"?{color:u.text.primary}:void 0,fontFamily:u.typography.fontFamily,...f},children:e})}function We({children:e,style:t}){const r=g();return n.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:r.text.primary,background:r.fill.secondary,borderRadius:r.radius.sm,padding:"1px 4px",...t},children:e})}function qe({children:e,href:t,style:r}){const o=g();return n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...r},children:e})}function Ke({children:e,gap:t,style:r}){return n.jsx(h.Stack,{gap:t,style:r,children:e})}const ee={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function Xe({children:e,gap:t,align:r="center",justify:o="start",wrap:s=!1,style:a}){return n.jsx(h.Group,{gap:t,align:ee[r],justify:ee[o],wrap:s?"wrap":"nowrap",style:a,children:e})}function Ve(){return n.jsx("div",{style:{flex:1}})}function Ye({children:e,columns:t,gap:r=16,align:o,style:s}){const a=typeof t=="number"?`repeat(${t}, minmax(0, 1fr))`:t;return n.jsx("div",{style:{display:"grid",gridTemplateColumns:a,gap:r,alignItems:o,...s},children:e})}function Ue({style:e}){return n.jsx(h.Divider,{style:e})}const $=j.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Ze({children:e,variant:t="default",collapsible:r=!1,defaultOpen:o=!0,open:s,onOpenChange:a,style:c}){const f=g(),[u,l]=j.useState(o),d=s??u,y=j.useCallback(()=>{const b=!d;s===void 0&&l(b),a==null||a(b)},[d,s,a]);return n.jsx(h.Card,{withBorder:t!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...c},children:n.jsx($.Provider,{value:{collapsible:r,open:d,toggle:y},children:e})})}function Je({children:e,trailing:t,style:r}){const o=g(),{collapsible:s,open:a,toggle:c}=j.useContext($);return n.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,...r},children:[n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&n.jsx(ue,{expanded:a}),e]}),t!=null&&n.jsx("span",{children:t})]})}function Qe({children:e,style:t}){const{collapsible:r,open:o}=j.useContext($);return r&&!o?null:n.jsx("div",{style:{padding:14,...t},children:e})}function ue({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 et({value:e,label:t,tone:r,style:o}){const s=g();return n.jsxs("div",{style:o,children:[n.jsx(h.Text,{fz:22,fw:700,lh:1.2,style:{color:r?C[r]:s.text.primary,fontFamily:s.typography.fontFamily},children:e}),n.jsx(h.Text,{fz:12,style:{color:s.text.tertiary,fontFamily:s.typography.fontFamily},children:t})]})}function tt({children:e,active:t,tone:r="neutral",size:o="md",leadingContent:s,keyboardHint:a,title:c,style:f,onClick:u}){return n.jsx(h.Badge,{color:te[r],variant:t?"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:e})}function rt({children:e,tone:t="neutral",title:r,icon:o,style:s}){return n.jsx(h.Alert,{color:te[t],title:r,icon:o,variant:"light",style:s,children:e})}const nt={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 ot({headers:e,rows:t,columnAlign:r,rowTone:o,framed:s=!0,striped:a,stickyHeader:c,style:f,emptyMessage:u}){return n.jsxs(h.Table,{withTableBorder:s,withColumnBorders:!1,striped:a,stickyHeader:c,highlightOnHover:!0,style:f,children:[n.jsx(h.Table.Thead,{children:n.jsx(h.Table.Tr,{children:e.map((l,d)=>n.jsx(h.Table.Th,{ta:(r==null?void 0:r[d])??"left",children:l},d))})}),n.jsx(h.Table.Tbody,{children:t.length===0?n.jsx(h.Table.Tr,{children:n.jsx(h.Table.Td,{colSpan:e.length,ta:"center",c:"dimmed",children:u??"No data"})}):t.map((l,d)=>{const y=o==null?void 0:o[d];return n.jsx(h.Table.Tr,{style:y?{background:nt[y]}:void 0,children:e.map((b,p)=>n.jsx(h.Table.Td,{ta:(r==null?void 0:r[p])??"left",children:l[p]},p))},d)})})]})}const at={primary:"filled",secondary:"default",ghost:"subtle"};function st({children:e,variant:t="secondary",disabled:r,type:o="button",style:s,onClick:a}){return n.jsx(h.Button,{variant:at[t],color:t==="primary"?"accent":void 0,size:"xs",disabled:r,type:o,onClick:a,style:s,children:e})}function it({children:e,onClick:t,disabled:r,title:o,variant:s="default",size:a="md",style:c}){return n.jsx(h.ActionIcon,{variant:s==="circle"?"light":"subtle",radius:s==="circle"?"xl":"sm",size:a==="sm"?"sm":"md",color:"gray",disabled:r,title:o,"aria-label":o,onClick:t,style:c,children:e})}function lt({value:e,onChange:t,options:r,placeholder:o,disabled:s,style:a}){return n.jsx(h.Select,{value:e,data:r,placeholder:o,disabled:s,allowDeselect:!1,onChange:c=>{c!==null&&(t==null||t(c))},style:a})}function ct({checked:e,onChange:t,disabled:r,label:o,style:s}){return n.jsx(h.Checkbox,{checked:e,disabled:r,label:o,onChange:a=>t==null?void 0:t(a.currentTarget.checked),style:s})}function ut({checked:e,onChange:t,disabled:r,size:o="sm",style:s}){return n.jsx(h.Switch,{checked:e,disabled:r,size:o==="sm"?"sm":"md",onChange:a=>t==null?void 0:t(a.currentTarget.checked),style:s})}function dt({value:e,onChange:t,placeholder:r,disabled:o,type:s,style:a}){return n.jsx(h.TextInput,{value:e,placeholder:r,disabled:o,type:s,onChange:c=>t==null?void 0:t(c.currentTarget.value),style:a})}function ft({value:e,onChange:t,placeholder:r,disabled:o,rows:s=3,style:a}){return n.jsx(h.Textarea,{value:e,placeholder:r,disabled:o,autosize:!0,minRows:s,onChange:c=>t==null?void 0:t(c.currentTarget.value),style:a})}function ht({color:e,style:t}){const r=g();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[e],flex:"0 0 auto",...t}})}function pt({segments:e,total:t,topLeftLabel:r,topRightLabel:o,style:s}){const a=g(),c=t>0?t:1,f=e.reduce((l,d)=>l+(Number.isFinite(d.value)&&d.value>0?d.value:0),0),u=Math.max(0,c-f);return n.jsxs("div",{style:s,children:[(r!=null||o!=null)&&n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:a.text.secondary,marginBottom:6},children:[n.jsx("span",{children:r}),n.jsx("span",{children:o})]}),n.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[e.map((l,d)=>{const y=Number.isFinite(l.value)&&l.value>0?l.value:0,b=a.category[l.color??S.usageColorSequence[d%S.usageColorSequence.length]];return n.jsx("div",{style:{width:`${y/c*100}%`,background:b,borderRadius:3}},l.id)}),u>0&&n.jsx("div",{style:{width:`${u/c*100}%`,background:a.fill.tertiary,borderRadius:3}})]})]})}function xt({title:e,leading:t,count:r,trailing:o,children:s,defaultOpen:a=!1,style:c}){const f=g(),[u,l]=j.useState(a);return n.jsxs("div",{style:c,children:[n.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:[n.jsx(ue,{expanded:u}),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}}),o!=null&&n.jsx("span",{style:{color:f.text.tertiary},children:o})]}),u&&n.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:s})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>j.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>j.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>j.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>j.useState});exports.canvasPaletteDark=S.canvasPaletteDark;exports.canvasPaletteGrokDark=S.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=S.canvasPaletteGrokLight;exports.canvasPaletteLight=S.canvasPaletteLight;exports.canvasTokens=S.canvasTokens;exports.canvasTokensLight=S.canvasTokensLight;exports.categoryPaletteDark=S.categoryPaletteDark;exports.categoryPaletteLight=S.categoryPaletteLight;exports.colorPalette=S.colorPalette;exports.usageColorSequence=S.usageColorSequence;exports.BarChart=Se;exports.Button=st;exports.Callout=rt;exports.Card=Ze;exports.CardBody=Qe;exports.CardHeader=Je;exports.Checkbox=ct;exports.Code=We;exports.CollapsibleSection=xt;exports.DiffStats=Be;exports.DiffView=Fe;exports.Divider=Ue;exports.Grid=Ye;exports.H1=ze;exports.H2=Ge;exports.H3=_e;exports.IconButton=it;exports.LineChart=ve;exports.Link=qe;exports.PieChart=Ae;exports.Pill=tt;exports.Row=Xe;exports.Select=lt;exports.Spacer=Ve;exports.Stack=Ke;exports.Stat=et;exports.Swatch=ht;exports.Table=ot;exports.Text=Oe;exports.TextArea=ft;exports.TextInput=dt;exports.TodoList=ce;exports.TodoListCard=He;exports.Toggle=ut;exports.UsageBar=pt;exports.computeDAGLayout=Me;exports.mergeStyle=Ne;exports.useCanvasAction=Ie;exports.useCanvasState=Re;exports.useHostTheme=g;
|