@flexkit/studio 0.2.17 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-nav-button-V5DFHADL.js +2 -0
- package/dist/{activity-nav-button-7SVTTHBQ.js.map → activity-nav-button-V5DFHADL.js.map} +1 -1
- package/dist/chat-page-LAK4TFN4.js +4 -0
- package/dist/chat-page-LAK4TFN4.js.map +1 -0
- package/dist/chunk-2NXQF2F7.js +2 -0
- package/dist/chunk-2NXQF2F7.js.map +1 -0
- package/dist/chunk-4IEOAKKK.js +2 -0
- package/dist/chunk-4IEOAKKK.js.map +1 -0
- package/dist/{chunk-3C2EG3SI.js → chunk-54AXLGAK.js} +2 -2
- package/dist/{chunk-3C2EG3SI.js.map → chunk-54AXLGAK.js.map} +1 -1
- package/dist/chunk-6RRB47OZ.js +8 -0
- package/dist/chunk-6RRB47OZ.js.map +1 -0
- package/dist/chunk-A7XHA2P6.js +3 -0
- package/dist/chunk-A7XHA2P6.js.map +1 -0
- package/dist/chunk-BMO7JFAX.js +2 -0
- package/dist/chunk-BMO7JFAX.js.map +1 -0
- package/dist/{chunk-U5D3EDCY.js → chunk-BMX4URYN.js} +2 -2
- package/dist/{chunk-U5D3EDCY.js.map → chunk-BMX4URYN.js.map} +1 -1
- package/dist/chunk-CLCIE5RF.js +2 -0
- package/dist/chunk-CLCIE5RF.js.map +1 -0
- package/dist/{chunk-RYKUNA7Z.js → chunk-DFLAX7EE.js} +2 -2
- package/dist/{chunk-RYKUNA7Z.js.map → chunk-DFLAX7EE.js.map} +1 -1
- package/dist/chunk-DGIY4SKN.js +7 -0
- package/dist/chunk-DGIY4SKN.js.map +1 -0
- package/dist/chunk-DHVKE36X.js +3 -0
- package/dist/chunk-DHVKE36X.js.map +1 -0
- package/dist/chunk-EMFHKTAV.js +2 -0
- package/dist/chunk-EMFHKTAV.js.map +1 -0
- package/dist/chunk-ERDARDGB.js +2 -0
- package/dist/chunk-ERDARDGB.js.map +1 -0
- package/dist/chunk-H2RWSC56.js +3 -0
- package/dist/chunk-H2RWSC56.js.map +1 -0
- package/dist/{chunk-FDN23BPI.js → chunk-HCJAM5LG.js} +2 -2
- package/dist/{chunk-FDN23BPI.js.map → chunk-HCJAM5LG.js.map} +1 -1
- package/dist/chunk-ME55YNBF.js +30 -0
- package/dist/chunk-ME55YNBF.js.map +1 -0
- package/dist/chunk-OOYCTZ3C.js +379 -0
- package/dist/chunk-OOYCTZ3C.js.map +1 -0
- package/dist/chunk-QWQHXMXW.js +2 -0
- package/dist/{chunk-FNWEP2NM.js.map → chunk-QWQHXMXW.js.map} +1 -1
- package/dist/{chunk-ALCK2BJY.js → chunk-UOR437J2.js} +2 -2
- package/dist/{chunk-ALCK2BJY.js.map → chunk-UOR437J2.js.map} +1 -1
- package/dist/{chunk-3KMR2CXS.js → chunk-V6RB45UU.js} +2 -2
- package/dist/{chunk-3KMR2CXS.js.map → chunk-V6RB45UU.js.map} +1 -1
- package/dist/chunk-VMWUMFUL.js +4 -0
- package/dist/chunk-VMWUMFUL.js.map +1 -0
- package/dist/chunk-XMOSCJOI.js +2 -0
- package/dist/chunk-XMOSCJOI.js.map +1 -0
- package/dist/chunk-XNHSHVG2.js +7 -0
- package/dist/chunk-XNHSHVG2.js.map +1 -0
- package/dist/chunk-YDVO6XWD.js +2 -0
- package/dist/chunk-YDVO6XWD.js.map +1 -0
- package/dist/chunk-ZKA2HKNI.js +2 -0
- package/dist/chunk-ZKA2HKNI.js.map +1 -0
- package/dist/entry-3JSFO4OU.js +2 -0
- package/dist/entry-3JSFO4OU.js.map +1 -0
- package/dist/index.css +712 -246
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/list-SY3L2ACH.js +3 -0
- package/dist/list-SY3L2ACH.js.map +1 -0
- package/dist/list-Z2C74QDN.js +2 -0
- package/dist/{list-EXNTXASK.js.map → list-Z2C74QDN.js.map} +1 -1
- package/dist/pages-INCA54HE.js +5 -0
- package/dist/{pages-NWZLOKQM.js.map → pages-INCA54HE.js.map} +1 -1
- package/dist/plugin-pages-WO3MCJKC.js +2 -0
- package/dist/{plugin-pages-2KMZFNFB.js.map → plugin-pages-WO3MCJKC.js.map} +1 -1
- package/dist/record-links-CTB4SC4J.js +2 -0
- package/dist/record-links-CTB4SC4J.js.map +1 -0
- package/dist/root-6MSWGFZX.js +2 -0
- package/dist/root-6MSWGFZX.js.map +1 -0
- package/dist/root-B4D3C37Q.js +2 -0
- package/dist/root-B4D3C37Q.js.map +1 -0
- package/dist/root-DOOWSYWY.js +23 -0
- package/dist/root-DOOWSYWY.js.map +1 -0
- package/dist/root-JA2LFGNX.js +2 -0
- package/dist/root-JA2LFGNX.js.map +1 -0
- package/dist/root-OGX4DUTM.js +2 -0
- package/dist/root-OGX4DUTM.js.map +1 -0
- package/dist/{root-BRCN3D2D.js → root-XHXX3SZG.js} +3 -3
- package/dist/{root-BRCN3D2D.js.map → root-XHXX3SZG.js.map} +1 -1
- package/dist/search-Z4M4R4NJ.js +2 -0
- package/dist/{search-7IJJYUSR.js.map → search-Z4M4R4NJ.js.map} +1 -1
- package/dist/skills-pages-TP2XQPCQ.js +2 -0
- package/dist/{skills-pages-4ELHNJVY.js.map → skills-pages-TP2XQPCQ.js.map} +1 -1
- package/dist/source-5J56KIFA.js +2 -0
- package/dist/source-5J56KIFA.js.map +1 -0
- package/dist/spec-renderer-3GAVSV52.js +2 -0
- package/dist/{spec-renderer-EX7SCFWH.js.map → spec-renderer-3GAVSV52.js.map} +1 -1
- package/dist/ui.d.ts +15 -5
- package/dist/ui.js +1 -1
- package/package.json +13 -5
- package/dist/activity-nav-button-7SVTTHBQ.js +0 -2
- package/dist/chat-page-X3MIN6YC.js +0 -4
- package/dist/chat-page-X3MIN6YC.js.map +0 -1
- package/dist/chunk-7ZFUS62K.js +0 -3
- package/dist/chunk-7ZFUS62K.js.map +0 -1
- package/dist/chunk-D6H64Z37.js +0 -8
- package/dist/chunk-D6H64Z37.js.map +0 -1
- package/dist/chunk-FNWEP2NM.js +0 -2
- package/dist/chunk-NLRSLQUT.js +0 -3
- package/dist/chunk-NLRSLQUT.js.map +0 -1
- package/dist/chunk-P6BZ4QP7.js +0 -2
- package/dist/chunk-P6BZ4QP7.js.map +0 -1
- package/dist/chunk-PKAWL5W4.js +0 -4
- package/dist/chunk-PKAWL5W4.js.map +0 -1
- package/dist/chunk-RNMAR527.js +0 -384
- package/dist/chunk-RNMAR527.js.map +0 -1
- package/dist/chunk-YCCFUGWJ.js +0 -7
- package/dist/chunk-YCCFUGWJ.js.map +0 -1
- package/dist/list-EXNTXASK.js +0 -2
- package/dist/pages-NWZLOKQM.js +0 -5
- package/dist/plugin-pages-2KMZFNFB.js +0 -2
- package/dist/root-A6FK3OR6.js +0 -2
- package/dist/root-A6FK3OR6.js.map +0 -1
- package/dist/root-CUNQWMK4.js +0 -23
- package/dist/root-CUNQWMK4.js.map +0 -1
- package/dist/root-SCCUPXFD.js +0 -2
- package/dist/root-SCCUPXFD.js.map +0 -1
- package/dist/search-7IJJYUSR.js +0 -2
- package/dist/skills-pages-4ELHNJVY.js +0 -2
- package/dist/spec-renderer-EX7SCFWH.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {ha,ia,ja,$,ga,aa,da,ea,ba,fa,ka,f}from'./chunk-DGIY4SKN.js';import {t}from'./chunk-SZEGGBOC.js';import {v as v$1,b as b$1}from'./chunk-32ZU4MLE.js';import'./chunk-U45E5X3H.js';import'./chunk-HDOIOXMP.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useMemo,useId,useState,useEffect}from'react';import {buildSpecFromParts,StateProvider,VisibilityProvider,ActionProvider,Renderer}from'@json-render/react';import {TrendingUpIcon,TrendingDownIcon,MinusIcon,InfoIcon,OctagonAlertIcon,AlertTriangleIcon,LightbulbIcon,XCircleIcon,CheckCircle2Icon}from'lucide-react';import {PieChart,Tooltip,Pie,Cell,LineChart,CartesianGrid,XAxis,YAxis,Line,BarChart,Bar,ResponsiveContainer}from'recharts';import {jsx,jsxs}from'react/jsx-runtime';var ke={sm:"fk:max-w-sm",md:"fk:max-w-md",lg:"fk:max-w-lg",full:"fk:max-w-full"},pe=({children:e,element:t})=>{let{props:n}=t,s=n.maxWidth?ke[n.maxWidth]:"",a=n.centered?"fk:mx-auto":"";return jsxs("div",{className:`fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:gap-2 fk:flex fk:flex-col ${s} ${a} ${n.className??""} fk:corner-squircle`,children:[n.title&&jsx("div",{className:"fk:text-sm fk:font-medium",children:n.title}),n.description&&jsx("div",{className:"fk:mt-0.5 fk:text-xs fk:text-muted-foreground",children:n.description}),(n.title??n.description)&&e?jsx("div",{className:"fk:mt-3"}):null,e]})},me={none:"fk:gap-0",sm:"fk:gap-2",md:"fk:gap-3",lg:"fk:gap-4",xl:"fk:gap-6"},ge={start:"fk:items-start",center:"fk:items-center",end:"fk:items-end",stretch:"fk:items-stretch"},he={start:"fk:justify-start",center:"fk:justify-center",end:"fk:justify-end",between:"fk:justify-between",around:"fk:justify-around"},be=({children:e,element:t})=>{let{props:n}=t,s=n.direction==="horizontal"?"fk:flex-row fk:flex-wrap":"fk:flex-col",a=me[n.gap??"md"],i=n.align?ge[n.align]:"",l=n.justify?he[n.justify]:"";return jsx("div",{className:`fk:flex fk:w-full ${s} ${a} ${i} ${l} ${n.className??""}`,children:e})},ve={1:"fk:grid-cols-1",2:"fk:grid-cols-2",3:"fk:grid-cols-3",4:"fk:grid-cols-4",5:"fk:grid-cols-5",6:"fk:grid-cols-6"},ye={sm:"fk:gap-2",md:"fk:gap-3",lg:"fk:gap-4",xl:"fk:gap-6"},xe=({children:e,element:t})=>{let{props:n}=t,s=ve[n.columns??1]??"fk:grid-cols-1",a=ye[n.gap??"md"];return jsx("div",{className:`fk:grid fk:w-full ${s} ${a} ${n.className??""}`,children:e})},Ce=({element:e})=>jsx(v$1,{orientation:e.props.orientation??"horizontal"}),Pe={h1:"fk:text-xl fk:font-semibold fk:tracking-tight",h2:"fk:text-lg fk:font-semibold fk:tracking-tight",h3:"fk:text-base fk:font-medium",h4:"fk:text-sm fk:font-medium"},we=({element:e})=>{let t=e.props.level??"h2";return jsx(t,{className:Pe[t],children:e.props.text})},Ne={body:"fk:text-sm",muted:"fk:text-sm fk:text-muted-foreground",caption:"fk:text-xs fk:text-muted-foreground",lead:"fk:text-base",code:"fk:rounded fk:bg-muted fk:px-1 fk:py-0.5 fk:font-mono fk:text-xs fk:corner-squircle"},Se=({element:e})=>jsx("p",{className:Ne[e.props.variant??"body"],children:e.props.text}),Te=({element:e})=>jsx(b$1,{variant:e.props.variant??"default",children:e.props.text});function Re({type:e}){switch(e){case "success":return jsx(CheckCircle2Icon,{className:"fk:size-4 fk:translate-y-0.5"});case "warning":return jsx(AlertTriangleIcon,{className:"fk:size-4 fk:translate-y-0.5"});case "error":return jsx(XCircleIcon,{className:"fk:size-4 fk:translate-y-0.5"});default:return jsx(InfoIcon,{className:"fk:size-4 fk:translate-y-0.5"})}}var Ae=({element:e})=>{let{props:t}=e,n=t.type==="error"?"fk:border-destructive/50 fk:text-destructive":"fk:text-foreground";return jsxs("div",{className:`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:bg-card fk:px-4 fk:py-3 fk:text-sm ${n} fk:corner-squircle`,role:"alert",children:[jsx(Re,{type:t.type}),jsxs("div",{className:"fk:min-w-0",children:[jsx("div",{className:"fk:font-medium",children:t.title}),t.message&&jsx("div",{className:"fk:text-muted-foreground",children:t.message})]})]})},Le=({element:e})=>{let t=e.props.columns??[],n=(e.props.rows??[]).map(s=>s.map(String));return jsx("div",{className:"fk:w-full fk:overflow-hidden fk:rounded-md fk:mt-2 fk:corner-squircle",children:jsxs($,{children:[e.props.caption&&jsx(ga,{children:e.props.caption}),jsx(aa,{children:jsx(da,{children:t.map((s,a)=>jsx(ea,{children:s},`${a.toString()}-${s}`))})}),jsx(ba,{children:n.map((s,a)=>jsx(da,{children:s.map((i,l)=>jsx(fa,{children:i},l))},a))})]})})},ze=({element:e})=>{let{props:t}=e,n=t.max??100,s=n>0?Math.min(100,Math.max(0,t.value/n*100)):0;return jsxs("div",{className:"fk:w-full",children:[t.label&&jsxs("div",{className:"fk:mb-1 fk:flex fk:items-center fk:justify-between fk:text-xs fk:text-muted-foreground",children:[jsx("span",{children:t.label}),jsxs("span",{className:"fk:tabular-nums",children:[Math.round(s),"%"]})]}),jsx("div",{className:"fk:h-2 fk:w-full fk:overflow-hidden fk:rounded-full fk:bg-secondary fk:corner-squircle",children:jsx("div",{className:"fk:h-full fk:rounded-full fk:bg-primary fk:corner-squircle",style:{width:`${s.toString()}%`}})})]})},Ke=({element:e})=>jsx(t,{className:e.props.rounded?"fk:rounded-full fk:corner-squircle":"",style:{height:e.props.height??"1rem",width:e.props.width??"100%"}}),Me=({element:e})=>jsx(f,{href:e.props.href,children:e.props.label}),$e=({element:e})=>e.props.src?jsx("img",{alt:e.props.alt,className:"fk:max-w-full fk:rounded-md fk:corner-squircle",height:e.props.height??void 0,src:e.props.src,width:e.props.width??void 0}):null,Ie=({element:e})=>jsx("div",{className:"fk:w-full fk:divide-y fk:divide-border fk:rounded-md fk:border fk:border-border fk:corner-squircle",children:(e.props.items??[]).map((t,n)=>jsxs("details",{className:"fk:group fk:px-4 fk:py-3",children:[jsx("summary",{className:"fk:cursor-pointer fk:list-none fk:text-sm fk:font-medium",children:t.title}),jsx("p",{className:"fk:mt-2 fk:text-sm fk:text-muted-foreground",children:t.content})]},n))}),Ee=({children:e,element:t})=>{let n=t.props.tabs??[];return jsxs(ha,{defaultValue:t.props.value??t.props.defaultValue??n[0]?.value,children:[jsx(ia,{children:n.map(s=>jsx(ja,{value:s.value,children:s.label},s.value))}),e]})},qe=({children:e,element:t})=>jsx(ka,{value:t.props.value,children:e}),je={up:"fk:text-success",down:"fk:text-destructive",neutral:"fk:text-muted-foreground"};function Be({trend:e}){return e==="up"?jsx(TrendingUpIcon,{className:"fk:size-4"}):e==="down"?jsx(TrendingDownIcon,{className:"fk:size-4"}):jsx(MinusIcon,{className:"fk:size-4"})}var He=({element:e})=>{let{props:t}=e;return jsxs("div",{className:"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle",children:[jsx("div",{className:"fk:text-xs fk:font-medium fk:text-muted-foreground",children:t.label}),jsxs("div",{className:"fk:mt-1 fk:flex fk:items-center fk:gap-2",children:[jsx("span",{className:"fk:text-2xl fk:font-semibold fk:tabular-nums fk:tracking-tight",children:t.value}),t.trend&&jsx("span",{className:je[t.trend],children:jsx(Be,{trend:t.trend})})]}),t.detail&&jsx("div",{className:"fk:mt-1 fk:text-xs fk:text-muted-foreground",children:t.detail})]})},Je={info:"fk:border-blue-500/30 fk:bg-blue-500/5 fk:text-blue-700 fk:dark:text-blue-400",tip:"fk:border-emerald-500/30 fk:bg-emerald-500/5 fk:text-emerald-700 fk:dark:text-emerald-400",warning:"fk:border-amber-500/30 fk:bg-amber-500/5 fk:text-amber-700 fk:dark:text-amber-400",important:"fk:border-red-500/30 fk:bg-red-500/5 fk:text-red-700 fk:dark:text-red-400"};function Xe({type:e}){switch(e){case "tip":return jsx(LightbulbIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});case "warning":return jsx(AlertTriangleIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});case "important":return jsx(OctagonAlertIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"});default:return jsx(InfoIcon,{className:"fk:size-4 fk:shrink-0 fk:translate-y-0.5"})}}var Fe=({element:e})=>{let{props:t}=e,n=t.type??"info";return jsxs("div",{className:`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:px-4 fk:py-3 fk:text-sm ${Je[n]} fk:corner-squircle`,children:[jsx(Xe,{type:n}),jsxs("div",{className:"fk:min-w-0",children:[t.title&&jsx("div",{className:"fk:font-medium",children:t.title}),jsx("div",{className:"fk:text-foreground",children:t.content})]})]})},Oe={completed:"fk:border-success fk:bg-success",current:"fk:border-primary fk:bg-primary",upcoming:"fk:border-border fk:bg-background"},Ge=({element:e})=>jsx("div",{className:"fk:w-full",children:(e.props.items??[]).map((t,n,s)=>jsxs("div",{className:"fk:relative fk:flex fk:gap-3 fk:pb-4 fk:last:pb-0",children:[n<s.length-1&&jsx("div",{className:"fk:absolute fk:left-[5px] fk:top-4 fk:h-full fk:w-px fk:bg-border"}),jsx("div",{className:`fk:mt-1 fk:size-[11px] fk:shrink-0 fk:rounded-full fk:border-2 ${Oe[t.status??"upcoming"]} fk:corner-squircle`}),jsxs("div",{className:"fk:min-w-0",children:[jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-baseline fk:gap-x-2",children:[jsx("span",{className:"fk:text-sm fk:font-medium",children:t.title}),t.date&&jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:t.date})]}),t.description&&jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:t.description})]})]},n))}),c=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4"],b={background:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:6,color:"hsl(var(--foreground))",fontSize:12},v={color:"hsl(var(--foreground))"},y={color:"hsl(var(--foreground))"},u={fill:"hsl(var(--muted-foreground))",fontSize:11};function g(e){let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:0}function X(e){let t=e.data??[];if(!e.aggregate)return t.map(s=>({x:String(s[e.xKey]??""),y:g(s[e.yKey])}));let n=new Map;for(let s of t){let a=String(s[e.xKey]??""),i=n.get(a)??{count:0,sum:0};i.count+=1,i.sum+=g(s[e.yKey]),n.set(a,i);}return Array.from(n.entries()).map(([s,a])=>e.aggregate==="count"?{x:s,y:a.count}:e.aggregate==="avg"?{x:s,y:a.count===0?0:a.sum/a.count}:{x:s,y:a.sum})}function x({children:e,height:t,title:n}){return jsxs("div",{className:"fk:w-full",children:[n&&jsx("div",{className:"fk:mb-2 fk:text-sm fk:font-medium",children:n}),jsx("div",{style:{height:t??256},children:jsx(ResponsiveContainer,{height:"100%",width:"100%",children:e})})]})}var We=({element:e})=>{let t=X(e.props),n=e.props.color??c[0];return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(BarChart,{data:t,children:[jsx(CartesianGrid,{stroke:"hsl(var(--border))",vertical:false}),jsx(XAxis,{axisLine:false,dataKey:"x",tick:u,tickLine:false,tickMargin:8}),jsx(YAxis,{axisLine:false,tick:u,tickLine:false,width:40}),jsx(Tooltip,{contentStyle:b,cursor:{fill:"hsl(var(--muted))"},itemStyle:v,labelStyle:y}),jsx(Bar,{dataKey:"y",fill:n,isAnimationActive:false,name:e.props.yKey,radius:4})]})})},_e=({element:e})=>{let t=X(e.props),n=e.props.color??c[0];return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(LineChart,{data:t,children:[jsx(CartesianGrid,{stroke:"hsl(var(--border))",vertical:false}),jsx(XAxis,{axisLine:false,dataKey:"x",tick:u,tickLine:false,tickMargin:8}),jsx(YAxis,{axisLine:false,tick:u,tickLine:false,width:40}),jsx(Tooltip,{contentStyle:b,itemStyle:v,labelStyle:y}),jsx(Line,{dataKey:"y",dot:false,isAnimationActive:false,name:e.props.yKey,stroke:n,strokeWidth:2,type:"monotone"})]})})},Ve=({element:e})=>{let t=(e.props.data??[]).map(n=>({name:String(n[e.props.nameKey]??""),value:g(n[e.props.valueKey])}));return jsx(x,{height:e.props.height,title:e.props.title,children:jsxs(PieChart,{children:[jsx(Tooltip,{contentStyle:b,itemStyle:v,labelStyle:y}),jsx(Pie,{data:t,dataKey:"value",innerRadius:"45%",isAnimationActive:false,nameKey:"name",children:t.map((n,s)=>jsx(Cell,{fill:c[s%c.length]},`${n.name}-${s.toString()}`))})]})})},De=({element:e})=>{let{chart:t$1,title:n}=e.props,s=useId().replace(/[^a-zA-Z0-9]/g,""),[a,i]=useState(null),[l,f]=useState(null);return useEffect(()=>{let k=false;return (async()=>{try{let{default:d}=await import('mermaid'),F=document.documentElement.classList.contains("dark");d.initialize({securityLevel:"strict",startOnLoad:!1,theme:F?"dark":"default"});let O=await d.render(`fk-mermaid-${s}`,t$1);k||(i(O.svg),f(null));}catch(d){k||f(d instanceof Error?d.message:"Failed to render the diagram.");}})(),()=>{k=true;}},[t$1,s]),jsxs("div",{className:"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle",children:[n&&jsx("div",{className:"fk:mb-2 fk:text-sm fk:font-medium",children:n}),l?jsx("pre",{className:"fk:overflow-x-auto fk:whitespace-pre-wrap fk:text-xs fk:text-muted-foreground",children:t$1}):null,!l&&a?jsx("div",{className:"fk:flex fk:justify-center fk:overflow-x-auto",dangerouslySetInnerHTML:{__html:a}}):null,!l&&!a?jsx(t,{className:"fk:h-40 fk:w-full"}):null]})},Ue={Accordion:Ie,Alert:Ae,Badge:Te,BarChart:We,Callout:Fe,Card:pe,Grid:xe,Heading:we,Image:$e,LineChart:_e,Link:Me,Mermaid:De,Metric:He,PieChart:Ve,Progress:ze,Separator:Ce,Skeleton:Ke,Stack:be,TabContent:qe,Table:Le,Tabs:Ee,Text:Se,Timeline:Ge},Ye=({element:e})=>jsxs("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:border-border fk:p-3 fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:["Unsupported component: ",e.type]});function Ze(e,t){let n=new Set,s=[];for(let a of e??[]){let i=String(a);n.has(i)||!t[i]||(n.add(i),s.push(i));}return s}function Qe(e,t){return e.length!==t.length?true:t.some((n,s)=>n!==e[s])}function et(e){if(!e.elements[e.root])return null;let t=false,n={};for(let s of Object.keys(e.elements)){let a=e.elements[s];if(!a)continue;let i=a.children??[],l=Ze(i,e.elements),f=Qe(i,l);f&&(t=true),n[s]=f?{...a,children:l}:a;}return t?{...e,elements:n}:e}var tt="data-spec";function rt(e){let t=new Set,n=[];for(let s of e){if(s.type!==tt)continue;let a=s.data;if(a&&typeof a=="object"&&"type"in a&&a.type==="patch"&&"patch"in a){let i=JSON.stringify(a.patch);if(t.has(i))continue;t.add(i);}n.push(s);}return n}function ft({parts:e}){let t=useMemo(()=>{let s=buildSpecFromParts(rt(e));return s?et(s):null},[e]),n=useMemo(()=>JSON.stringify(t?.state??{}),[t]);return t?jsx(StateProvider,{initialState:t.state,children:jsx(VisibilityProvider,{children:jsx(ActionProvider,{children:jsx(Renderer,{fallback:Ye,registry:Ue,spec:t})})})},n):null}export{ft as RunSpecPart};//# sourceMappingURL=spec-renderer-3GAVSV52.js.map
|
|
2
|
+
//# sourceMappingURL=spec-renderer-3GAVSV52.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/ai/spec-renderer.tsx"],"names":["cardMaxWidthClasses","Card","children","element","props","maxWidthClass","centeredClass","jsxs","jsx","stackGapClasses","stackAlignClasses","stackJustifyClasses","Stack","directionClass","gapClass","alignClass","justifyClass","gridColumnClasses","gridGapClasses","Grid","columnClass","Separator","headingClasses","Heading","level","textClasses","Text","BadgeComponent","Badge","AlertIcon","type","CheckCircle2Icon","AlertTriangleIcon","XCircleIcon","InfoIcon","Alert","typeClass","Table","columns","rows","row","TableCaption","TableHeader","TableRow","column","index","TableHead","TableBody","rowIndex","cell","cellIndex","TableCell","Progress","max","percent","Skeleton","LinkComponent","ExternalLink","Image","Accordion","item","Tabs","tabs","TabsList","tab","TabsTrigger","TabContent","TabsContent","trendClasses","TrendIcon","trend","TrendingUpIcon","TrendingDownIcon","MinusIcon","Metric","calloutClasses","CalloutIcon","LightbulbIcon","OctagonAlertIcon","Callout","timelineDotClasses","Timeline","items","CHART_COLORS","chartTooltipStyle","chartTooltipItemStyle","chartTooltipLabelStyle","chartTick","toNumber","value","parsed","getChartPoints","data","groups","key","group","x","ChartFrame","height","title","ResponsiveContainer","BarChart","points","color","RechartsBarChart","CartesianGrid","XAxis","YAxis","RechartsTooltip","Bar","LineChart","RechartsLineChart","Line","PieChart","slices","RechartsPieChart","Pie","slice","Cell","Mermaid","chart","diagramId","useId","svg","setSvg","useState","error","setError","useEffect","isCancelled","mermaid","isDark","result","renderError","registry","fallback","getSanitizedChildren","childKeys","elements","seen","childKey","normalizedKey","haveChildrenChanged","original","sanitized","sanitizeSpec","spec","hasChanged","elementKey","elementChildren","hasChildrenChanged","SPEC_DATA_PART_TYPE","dedupeSpecParts","parts","seenPatchLines","deduped","part","payload","line","RunSpecPart","useMemo","builtSpec","buildSpecFromParts","stateKey","StateProvider","VisibilityProvider","ActionProvider","Renderer"],"mappings":"6xBA2DA,IAAMA,EAAAA,CAAsB,CAC1B,EAAA,CAAI,cACJ,EAAA,CAAI,aAAA,CACJ,EAAA,CAAI,aAAA,CACJ,IAAA,CAAM,eACR,CAAA,CAEMC,EAAAA,CAAqC,CAAC,CAAE,QAAA,CAAAC,CAAAA,CAAU,OAAA,CAAAC,CAAQ,CAAA,GAAM,CACpE,GAAM,CAAE,KAAA,CAAAC,CAAM,CAAA,CAAID,CAAAA,CACZE,CAAAA,CAAgBD,CAAAA,CAAM,QAAA,CAAWJ,EAAAA,CAAoBI,EAAM,QAAQ,CAAA,CAAI,EAAA,CACvEE,CAAAA,CAAgBF,CAAAA,CAAM,QAAA,CAAW,YAAA,CAAe,EAAA,CAEtD,OACEG,IAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,kGAAA,EAAqGF,CAAa,CAAA,CAAA,EAAIC,CAAa,CAAA,CAAA,EAAIF,EAAM,SAAA,EAAa,EAAE,CAAA,mBAAA,CAAA,CAEtK,QAAA,CAAA,CAAAA,CAAAA,CAAM,KAAA,EAASI,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,2BAAA,CAA6B,QAAA,CAAAJ,CAAAA,CAAM,KAAA,CAAM,EACvEA,CAAAA,CAAM,WAAA,EAAeI,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,+CAAA,CAAiD,QAAA,CAAAJ,CAAAA,CAAM,WAAA,CAAY,CAAA,CAAA,CACtGA,CAAAA,CAAM,KAA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OAAA,GAAWA,EAAS,CACjH,IAAMC,CAAAA,CAAO,IAAA,CAAK,SAAA,CAAUD,CAAAA,CAAQ,KAAK,CAAA,CAEzC,GAAIH,CAAAA,CAAe,GAAA,CAAII,CAAI,CAAA,CACzB,SAGFJ,CAAAA,CAAe,GAAA,CAAII,CAAI,EACzB,CAEAH,CAAAA,CAAQ,IAAA,CAAKC,CAAI,EACnB,CAEA,OAAOD,CACT,CAEO,SAASI,EAAAA,CAAY,CAAE,KAAA,CAAAN,CAAM,CAAA,CAAqD,CACvF,IAAMP,CAAAA,CAAOc,QAAQ,IAAM,CACzB,IAAMC,CAAAA,CAAYC,kBAAAA,CAAmBV,EAAAA,CAAgBC,CAAK,CAAC,EAE3D,OAAOQ,CAAAA,CAAYhB,EAAAA,CAAagB,CAAS,CAAA,CAAI,IAC/C,CAAA,CAAG,CAACR,CAAK,CAAC,CAAA,CACJU,CAAAA,CAAWH,OAAAA,CAAQ,IAAM,IAAA,CAAK,SAAA,CAAUd,CAAAA,EAAM,KAAA,EAAS,EAAE,CAAA,CAAG,CAACA,CAAI,CAAC,CAAA,CAExE,OAAKA,CAAAA,CAKH1I,IAAC4J,aAAAA,CAAA,CAAc,YAAA,CAAclB,CAAAA,CAAK,KAAA,CAChC,QAAA,CAAA1I,GAAAA,CAAC6J,kBAAAA,CAAA,CACC,QAAA,CAAA7J,GAAAA,CAAC8J,cAAAA,CAAA,CACC,QAAA,CAAA9J,GAAAA,CAAC+J,QAAAA,CAAA,CAAS,SAAUhC,EAAAA,CAAU,QAAA,CAAUD,EAAAA,CAAU,IAAA,CAAMY,EAAM,CAAA,CAChE,CAAA,CACF,CAAA,CAAA,CAL4CiB,CAM9C,EAVO,IAYX","file":"spec-renderer-EX7SCFWH.js","sourcesContent":["import type { JSX } from 'react';\nimport type { ComponentRegistry, ComponentRenderer, Spec } from '@json-render/react';\nimport { useEffect, useId, useMemo, useState } from 'react';\nimport { ActionProvider, Renderer, StateProvider, VisibilityProvider, buildSpecFromParts } from '@json-render/react';\nimport {\n AlertTriangleIcon,\n CheckCircle2Icon,\n InfoIcon,\n LightbulbIcon,\n MinusIcon,\n OctagonAlertIcon,\n TrendingDownIcon,\n TrendingUpIcon,\n XCircleIcon,\n} from 'lucide-react';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n Cell,\n Line,\n LineChart as RechartsLineChart,\n Pie,\n PieChart as RechartsPieChart,\n ResponsiveContainer,\n Tooltip as RechartsTooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport {\n Badge,\n ExternalLink,\n Separator as SeparatorPrimitive,\n Skeleton as SkeletonPrimitive,\n Table as TablePrimitive,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n Tabs as TabsPrimitive,\n TabsContent,\n TabsList,\n TabsTrigger,\n} from '../../ui';\n\n// ---------------------------------------------------------------------------\n// Layout components\n// ---------------------------------------------------------------------------\n\ninterface CardProps {\n centered: boolean | null;\n className: string | null;\n description: string | null;\n maxWidth: 'sm' | 'md' | 'lg' | 'full' | null;\n title: string | null;\n}\n\nconst cardMaxWidthClasses = {\n sm: 'fk:max-w-sm',\n md: 'fk:max-w-md',\n lg: 'fk:max-w-lg',\n full: 'fk:max-w-full',\n};\n\nconst Card: ComponentRenderer<CardProps> = ({ children, element }) => {\n const { props } = element;\n const maxWidthClass = props.maxWidth ? cardMaxWidthClasses[props.maxWidth] : '';\n const centeredClass = props.centered ? 'fk:mx-auto' : '';\n\n return (\n <div\n className={`fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:gap-2 fk:flex fk:flex-col ${maxWidthClass} ${centeredClass} ${props.className ?? ''} fk:corner-squircle`}\n >\n {props.title && <div className=\"fk:text-sm fk:font-medium\">{props.title}</div>}\n {props.description && <div className=\"fk:mt-0.5 fk:text-xs fk:text-muted-foreground\">{props.description}</div>}\n {(props.title ?? props.description) && children ? <div className=\"fk:mt-3\" /> : null}\n {children}\n </div>\n );\n};\n\ninterface StackProps {\n align: 'start' | 'center' | 'end' | 'stretch' | null;\n className: string | null;\n direction: 'horizontal' | 'vertical' | null;\n gap: 'none' | 'sm' | 'md' | 'lg' | 'xl' | null;\n justify: 'start' | 'center' | 'end' | 'between' | 'around' | null;\n}\n\nconst stackGapClasses = {\n none: 'fk:gap-0',\n sm: 'fk:gap-2',\n md: 'fk:gap-3',\n lg: 'fk:gap-4',\n xl: 'fk:gap-6',\n};\n\nconst stackAlignClasses = {\n start: 'fk:items-start',\n center: 'fk:items-center',\n end: 'fk:items-end',\n stretch: 'fk:items-stretch',\n};\n\nconst stackJustifyClasses = {\n start: 'fk:justify-start',\n center: 'fk:justify-center',\n end: 'fk:justify-end',\n between: 'fk:justify-between',\n around: 'fk:justify-around',\n};\n\nconst Stack: ComponentRenderer<StackProps> = ({ children, element }) => {\n const { props } = element;\n const directionClass = props.direction === 'horizontal' ? 'fk:flex-row fk:flex-wrap' : 'fk:flex-col';\n const gapClass = stackGapClasses[props.gap ?? 'md'];\n const alignClass = props.align ? stackAlignClasses[props.align] : '';\n const justifyClass = props.justify ? stackJustifyClasses[props.justify] : '';\n\n return (\n <div\n className={`fk:flex fk:w-full ${directionClass} ${gapClass} ${alignClass} ${justifyClass} ${props.className ?? ''}`}\n >\n {children}\n </div>\n );\n};\n\ninterface GridProps {\n className: string | null;\n columns: number | null;\n gap: 'sm' | 'md' | 'lg' | 'xl' | null;\n}\n\nconst gridColumnClasses: { [columns: number]: string } = {\n 1: 'fk:grid-cols-1',\n 2: 'fk:grid-cols-2',\n 3: 'fk:grid-cols-3',\n 4: 'fk:grid-cols-4',\n 5: 'fk:grid-cols-5',\n 6: 'fk:grid-cols-6',\n};\n\nconst gridGapClasses = {\n sm: 'fk:gap-2',\n md: 'fk:gap-3',\n lg: 'fk:gap-4',\n xl: 'fk:gap-6',\n};\n\nconst Grid: ComponentRenderer<GridProps> = ({ children, element }) => {\n const { props } = element;\n const columnClass = gridColumnClasses[props.columns ?? 1] ?? 'fk:grid-cols-1';\n const gapClass = gridGapClasses[props.gap ?? 'md'];\n\n return <div className={`fk:grid fk:w-full ${columnClass} ${gapClass} ${props.className ?? ''}`}>{children}</div>;\n};\n\nconst Separator: ComponentRenderer<{ orientation: 'horizontal' | 'vertical' | null }> = ({ element }) => (\n <SeparatorPrimitive orientation={element.props.orientation ?? 'horizontal'} />\n);\n\n// ---------------------------------------------------------------------------\n// Typography and content components\n// ---------------------------------------------------------------------------\n\ninterface HeadingProps {\n level: 'h1' | 'h2' | 'h3' | 'h4' | null;\n text: string;\n}\n\nconst headingClasses = {\n h1: 'fk:text-xl fk:font-semibold fk:tracking-tight',\n h2: 'fk:text-lg fk:font-semibold fk:tracking-tight',\n h3: 'fk:text-base fk:font-medium',\n h4: 'fk:text-sm fk:font-medium',\n};\n\nconst Heading: ComponentRenderer<HeadingProps> = ({ element }) => {\n const level = element.props.level ?? 'h2';\n const HeadingTag = level;\n\n return <HeadingTag className={headingClasses[level]}>{element.props.text}</HeadingTag>;\n};\n\ninterface TextProps {\n text: string;\n variant: 'body' | 'muted' | 'caption' | 'lead' | 'code' | null;\n}\n\nconst textClasses = {\n body: 'fk:text-sm',\n muted: 'fk:text-sm fk:text-muted-foreground',\n caption: 'fk:text-xs fk:text-muted-foreground',\n lead: 'fk:text-base',\n code: 'fk:rounded fk:bg-muted fk:px-1 fk:py-0.5 fk:font-mono fk:text-xs fk:corner-squircle',\n};\n\nconst Text: ComponentRenderer<TextProps> = ({ element }) => (\n <p className={textClasses[element.props.variant ?? 'body']}>{element.props.text}</p>\n);\n\ninterface BadgeProps {\n text: string;\n variant: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}\n\nconst BadgeComponent: ComponentRenderer<BadgeProps> = ({ element }) => (\n <Badge variant={element.props.variant ?? 'default'}>{element.props.text}</Badge>\n);\n\ninterface AlertProps {\n message: string | null;\n title: string;\n type: 'success' | 'info' | 'warning' | 'error' | null;\n}\n\nfunction AlertIcon({ type }: { type: AlertProps['type'] }): JSX.Element {\n switch (type) {\n case 'success':\n return <CheckCircle2Icon className=\"fk:size-4 fk:translate-y-0.5\" />;\n case 'warning':\n return <AlertTriangleIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n case 'error':\n return <XCircleIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n default:\n return <InfoIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n }\n}\n\nconst Alert: ComponentRenderer<AlertProps> = ({ element }) => {\n const { props } = element;\n const typeClass = props.type === 'error' ? 'fk:border-destructive/50 fk:text-destructive' : 'fk:text-foreground';\n\n return (\n <div\n className={`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:bg-card fk:px-4 fk:py-3 fk:text-sm ${typeClass} fk:corner-squircle`}\n role=\"alert\"\n >\n <AlertIcon type={props.type} />\n <div className=\"fk:min-w-0\">\n <div className=\"fk:font-medium\">{props.title}</div>\n {props.message && <div className=\"fk:text-muted-foreground\">{props.message}</div>}\n </div>\n </div>\n );\n};\n\ninterface TableProps {\n caption: string | null;\n columns: string[];\n rows: string[][];\n}\n\nconst Table: ComponentRenderer<TableProps> = ({ element }) => {\n const columns = element.props.columns ?? [];\n const rows = (element.props.rows ?? []).map((row) => row.map(String));\n\n return (\n <div className=\"fk:w-full fk:overflow-hidden fk:rounded-md fk:mt-2 fk:corner-squircle\">\n <TablePrimitive>\n {element.props.caption && <TableCaption>{element.props.caption}</TableCaption>}\n <TableHeader>\n <TableRow>\n {columns.map((column, index) => (\n <TableHead key={`${index.toString()}-${column}`}>{column}</TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {rows.map((row, rowIndex) => (\n <TableRow key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <TableCell key={cellIndex}>{cell}</TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </TablePrimitive>\n </div>\n );\n};\n\ninterface ProgressProps {\n label: string | null;\n max: number | null;\n value: number;\n}\n\nconst Progress: ComponentRenderer<ProgressProps> = ({ element }) => {\n const { props } = element;\n const max = props.max ?? 100;\n const percent = max > 0 ? Math.min(100, Math.max(0, (props.value / max) * 100)) : 0;\n\n return (\n <div className=\"fk:w-full\">\n {props.label && (\n <div className=\"fk:mb-1 fk:flex fk:items-center fk:justify-between fk:text-xs fk:text-muted-foreground\">\n <span>{props.label}</span>\n <span className=\"fk:tabular-nums\">{Math.round(percent)}%</span>\n </div>\n )}\n <div className=\"fk:h-2 fk:w-full fk:overflow-hidden fk:rounded-full fk:bg-secondary fk:corner-squircle\">\n <div className=\"fk:h-full fk:rounded-full fk:bg-primary fk:corner-squircle\" style={{ width: `${percent.toString()}%` }} />\n </div>\n </div>\n );\n};\n\nconst Skeleton: ComponentRenderer<{ height: string | null; rounded: boolean | null; width: string | null }> = ({\n element,\n}) => (\n <SkeletonPrimitive\n className={element.props.rounded ? 'fk:rounded-full fk:corner-squircle' : ''}\n style={{ height: element.props.height ?? '1rem', width: element.props.width ?? '100%' }}\n />\n);\n\nconst LinkComponent: ComponentRenderer<{ href: string; label: string }> = ({ element }) => (\n <ExternalLink href={element.props.href}>{element.props.label}</ExternalLink>\n);\n\nconst Image: ComponentRenderer<{\n alt: string;\n height: number | null;\n src: string | null;\n width: number | null;\n}> = ({ element }) => {\n if (!element.props.src) {\n return null;\n }\n\n return (\n <img\n alt={element.props.alt}\n className=\"fk:max-w-full fk:rounded-md fk:corner-squircle\"\n height={element.props.height ?? undefined}\n src={element.props.src}\n width={element.props.width ?? undefined}\n />\n );\n};\n\ninterface AccordionProps {\n items: { content: string; title: string }[];\n type: 'single' | 'multiple' | null;\n}\n\nconst Accordion: ComponentRenderer<AccordionProps> = ({ element }) => (\n <div className=\"fk:w-full fk:divide-y fk:divide-border fk:rounded-md fk:border fk:border-border fk:corner-squircle\">\n {(element.props.items ?? []).map((item, index) => (\n <details className=\"fk:group fk:px-4 fk:py-3\" key={index}>\n <summary className=\"fk:cursor-pointer fk:list-none fk:text-sm fk:font-medium\">{item.title}</summary>\n <p className=\"fk:mt-2 fk:text-sm fk:text-muted-foreground\">{item.content}</p>\n </details>\n ))}\n </div>\n);\n\n// ---------------------------------------------------------------------------\n// Tabs\n// ---------------------------------------------------------------------------\n\ninterface TabsProps {\n defaultValue: string | null;\n tabs: { label: string; value: string }[];\n value: string | null;\n}\n\nconst Tabs: ComponentRenderer<TabsProps> = ({ children, element }) => {\n const tabs = element.props.tabs ?? [];\n\n return (\n <TabsPrimitive defaultValue={element.props.value ?? element.props.defaultValue ?? tabs[0]?.value}>\n <TabsList>\n {tabs.map((tab) => (\n <TabsTrigger key={tab.value} value={tab.value}>\n {tab.label}\n </TabsTrigger>\n ))}\n </TabsList>\n {children}\n </TabsPrimitive>\n );\n};\n\nconst TabContent: ComponentRenderer<{ value: string }> = ({ children, element }) => (\n <TabsContent value={element.props.value}>{children}</TabsContent>\n);\n\n// ---------------------------------------------------------------------------\n// Result-focused components (Metric, Callout, Timeline)\n// ---------------------------------------------------------------------------\n\ninterface MetricProps {\n detail: string | null;\n label: string;\n trend: 'up' | 'down' | 'neutral' | null;\n value: string;\n}\n\nconst trendClasses = {\n up: 'fk:text-success',\n down: 'fk:text-destructive',\n neutral: 'fk:text-muted-foreground',\n};\n\nfunction TrendIcon({ trend }: { trend: 'up' | 'down' | 'neutral' }): JSX.Element {\n if (trend === 'up') {\n return <TrendingUpIcon className=\"fk:size-4\" />;\n }\n\n if (trend === 'down') {\n return <TrendingDownIcon className=\"fk:size-4\" />;\n }\n\n return <MinusIcon className=\"fk:size-4\" />;\n}\n\nconst Metric: ComponentRenderer<MetricProps> = ({ element }) => {\n const { props } = element;\n\n return (\n <div className=\"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle\">\n <div className=\"fk:text-xs fk:font-medium fk:text-muted-foreground\">{props.label}</div>\n <div className=\"fk:mt-1 fk:flex fk:items-center fk:gap-2\">\n <span className=\"fk:text-2xl fk:font-semibold fk:tabular-nums fk:tracking-tight\">{props.value}</span>\n {props.trend && (\n <span className={trendClasses[props.trend]}>\n <TrendIcon trend={props.trend} />\n </span>\n )}\n </div>\n {props.detail && <div className=\"fk:mt-1 fk:text-xs fk:text-muted-foreground\">{props.detail}</div>}\n </div>\n );\n};\n\ninterface CalloutProps {\n content: string;\n title: string | null;\n type: 'info' | 'tip' | 'warning' | 'important' | null;\n}\n\nconst calloutClasses = {\n info: 'fk:border-blue-500/30 fk:bg-blue-500/5 fk:text-blue-700 fk:dark:text-blue-400',\n tip: 'fk:border-emerald-500/30 fk:bg-emerald-500/5 fk:text-emerald-700 fk:dark:text-emerald-400',\n warning: 'fk:border-amber-500/30 fk:bg-amber-500/5 fk:text-amber-700 fk:dark:text-amber-400',\n important: 'fk:border-red-500/30 fk:bg-red-500/5 fk:text-red-700 fk:dark:text-red-400',\n};\n\nfunction CalloutIcon({ type }: { type: 'info' | 'tip' | 'warning' | 'important' }): JSX.Element {\n switch (type) {\n case 'tip':\n return <LightbulbIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n case 'warning':\n return <AlertTriangleIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n case 'important':\n return <OctagonAlertIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n default:\n return <InfoIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n }\n}\n\nconst Callout: ComponentRenderer<CalloutProps> = ({ element }) => {\n const { props } = element;\n const type = props.type ?? 'info';\n\n return (\n <div\n className={`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:px-4 fk:py-3 fk:text-sm ${calloutClasses[type]} fk:corner-squircle`}\n >\n <CalloutIcon type={type} />\n <div className=\"fk:min-w-0\">\n {props.title && <div className=\"fk:font-medium\">{props.title}</div>}\n <div className=\"fk:text-foreground\">{props.content}</div>\n </div>\n </div>\n );\n};\n\ninterface TimelineProps {\n items: {\n date: string | null;\n description: string | null;\n status: 'completed' | 'current' | 'upcoming' | null;\n title: string;\n }[];\n}\n\nconst timelineDotClasses = {\n completed: 'fk:border-success fk:bg-success',\n current: 'fk:border-primary fk:bg-primary',\n upcoming: 'fk:border-border fk:bg-background',\n};\n\nconst Timeline: ComponentRenderer<TimelineProps> = ({ element }) => (\n <div className=\"fk:w-full\">\n {(element.props.items ?? []).map((item, index, items) => (\n <div className=\"fk:relative fk:flex fk:gap-3 fk:pb-4 fk:last:pb-0\" key={index}>\n {index < items.length - 1 && (\n <div className=\"fk:absolute fk:left-[5px] fk:top-4 fk:h-full fk:w-px fk:bg-border\" />\n )}\n <div\n className={`fk:mt-1 fk:size-[11px] fk:shrink-0 fk:rounded-full fk:border-2 ${timelineDotClasses[item.status ?? 'upcoming']} fk:corner-squircle`}\n />\n <div className=\"fk:min-w-0\">\n <div className=\"fk:flex fk:flex-wrap fk:items-baseline fk:gap-x-2\">\n <span className=\"fk:text-sm fk:font-medium\">{item.title}</span>\n {item.date && <span className=\"fk:text-xs fk:text-muted-foreground\">{item.date}</span>}\n </div>\n {item.description && <div className=\"fk:text-sm fk:text-muted-foreground\">{item.description}</div>}\n </div>\n </div>\n ))}\n </div>\n);\n\n// ---------------------------------------------------------------------------\n// Charts\n// ---------------------------------------------------------------------------\n\nconst CHART_COLORS = ['#6366f1', '#10b981', '#f59e0b', '#ef4444', '#06b6d4'];\n\nconst chartTooltipStyle = {\n background: 'hsl(var(--background))',\n border: '1px solid hsl(var(--border))',\n borderRadius: 6,\n color: 'hsl(var(--foreground))',\n fontSize: 12,\n};\n\nconst chartTooltipItemStyle = {\n color: 'hsl(var(--foreground))',\n};\n\nconst chartTooltipLabelStyle = {\n color: 'hsl(var(--foreground))',\n};\n\nconst chartTick = { fill: 'hsl(var(--muted-foreground))', fontSize: 11 };\n\ninterface ChartPoint {\n x: string;\n y: number;\n}\n\ninterface CartesianChartProps {\n aggregate: 'sum' | 'count' | 'avg' | null;\n color: string | null;\n data: { [key: string]: unknown }[];\n height: number | null;\n title: string | null;\n xKey: string;\n yKey: string;\n}\n\nfunction toNumber(value: unknown): number {\n const parsed = typeof value === 'number' ? value : Number(value);\n\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction getChartPoints(props: CartesianChartProps): ChartPoint[] {\n const data = props.data ?? [];\n\n if (!props.aggregate) {\n return data.map((row) => ({\n x: String(row[props.xKey] ?? ''),\n y: toNumber(row[props.yKey]),\n }));\n }\n\n const groups = new Map<string, { count: number; sum: number }>();\n\n for (const row of data) {\n const key = String(row[props.xKey] ?? '');\n const group = groups.get(key) ?? { count: 0, sum: 0 };\n\n group.count += 1;\n group.sum += toNumber(row[props.yKey]);\n groups.set(key, group);\n }\n\n return Array.from(groups.entries()).map(([x, group]) => {\n if (props.aggregate === 'count') {\n return { x, y: group.count };\n }\n\n if (props.aggregate === 'avg') {\n return { x, y: group.count === 0 ? 0 : group.sum / group.count };\n }\n\n return { x, y: group.sum };\n });\n}\n\nfunction ChartFrame({\n children,\n height,\n title,\n}: {\n children: JSX.Element;\n height: number | null;\n title: string | null;\n}): JSX.Element {\n return (\n <div className=\"fk:w-full\">\n {title && <div className=\"fk:mb-2 fk:text-sm fk:font-medium\">{title}</div>}\n <div style={{ height: height ?? 256 }}>\n <ResponsiveContainer height=\"100%\" width=\"100%\">\n {children}\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\nconst BarChart: ComponentRenderer<CartesianChartProps> = ({ element }) => {\n const points = getChartPoints(element.props);\n const color = element.props.color ?? CHART_COLORS[0];\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsBarChart data={points}>\n <CartesianGrid stroke=\"hsl(var(--border))\" vertical={false} />\n <XAxis axisLine={false} dataKey=\"x\" tick={chartTick} tickLine={false} tickMargin={8} />\n <YAxis axisLine={false} tick={chartTick} tickLine={false} width={40} />\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n cursor={{ fill: 'hsl(var(--muted))' }}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Bar dataKey=\"y\" fill={color} isAnimationActive={false} name={element.props.yKey} radius={4} />\n </RechartsBarChart>\n </ChartFrame>\n );\n};\n\nconst LineChart: ComponentRenderer<CartesianChartProps> = ({ element }) => {\n const points = getChartPoints(element.props);\n const color = element.props.color ?? CHART_COLORS[0];\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsLineChart data={points}>\n <CartesianGrid stroke=\"hsl(var(--border))\" vertical={false} />\n <XAxis axisLine={false} dataKey=\"x\" tick={chartTick} tickLine={false} tickMargin={8} />\n <YAxis axisLine={false} tick={chartTick} tickLine={false} width={40} />\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Line\n dataKey=\"y\"\n dot={false}\n isAnimationActive={false}\n name={element.props.yKey}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n </RechartsLineChart>\n </ChartFrame>\n );\n};\n\ninterface PieChartProps {\n data: { [key: string]: unknown }[];\n height: number | null;\n nameKey: string;\n title: string | null;\n valueKey: string;\n}\n\nconst PieChart: ComponentRenderer<PieChartProps> = ({ element }) => {\n const slices = (element.props.data ?? []).map((row) => ({\n name: String(row[element.props.nameKey] ?? ''),\n value: toNumber(row[element.props.valueKey]),\n }));\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsPieChart>\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Pie data={slices} dataKey=\"value\" innerRadius=\"45%\" isAnimationActive={false} nameKey=\"name\">\n {slices.map((slice, index) => (\n <Cell fill={CHART_COLORS[index % CHART_COLORS.length]} key={`${slice.name}-${index.toString()}`} />\n ))}\n </Pie>\n </RechartsPieChart>\n </ChartFrame>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Mermaid\n// ---------------------------------------------------------------------------\n\ninterface MermaidProps {\n chart: string;\n title: string | null;\n}\n\nconst Mermaid: ComponentRenderer<MermaidProps> = ({ element }) => {\n const { chart, title } = element.props;\n const diagramId = useId().replace(/[^a-zA-Z0-9]/g, '');\n const [svg, setSvg] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let isCancelled = false;\n\n const render = async (): Promise<void> => {\n try {\n const { default: mermaid } = await import('mermaid');\n const isDark = document.documentElement.classList.contains('dark');\n\n mermaid.initialize({ securityLevel: 'strict', startOnLoad: false, theme: isDark ? 'dark' : 'default' });\n\n const result = await mermaid.render(`fk-mermaid-${diagramId}`, chart);\n\n if (!isCancelled) {\n setSvg(result.svg);\n setError(null);\n }\n } catch (renderError) {\n if (!isCancelled) {\n setError(renderError instanceof Error ? renderError.message : 'Failed to render the diagram.');\n }\n }\n };\n\n void render();\n\n return () => {\n isCancelled = true;\n };\n }, [chart, diagramId]);\n\n return (\n <div className=\"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle\">\n {title && <div className=\"fk:mb-2 fk:text-sm fk:font-medium\">{title}</div>}\n {error ? (\n <pre className=\"fk:overflow-x-auto fk:whitespace-pre-wrap fk:text-xs fk:text-muted-foreground\">{chart}</pre>\n ) : null}\n {!error && svg ? (\n <div className=\"fk:flex fk:justify-center fk:overflow-x-auto\" dangerouslySetInnerHTML={{ __html: svg }} />\n ) : null}\n {!error && !svg ? <SkeletonPrimitive className=\"fk:h-40 fk:w-full\" /> : null}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Registry and spec rendering\n// ---------------------------------------------------------------------------\n\nconst registry: ComponentRegistry = {\n Accordion,\n Alert,\n Badge: BadgeComponent,\n BarChart,\n Callout,\n Card,\n Grid,\n Heading,\n Image,\n LineChart,\n Link: LinkComponent,\n Mermaid,\n Metric,\n PieChart,\n Progress,\n Separator,\n Skeleton,\n Stack,\n TabContent,\n Table,\n Tabs,\n Text,\n Timeline,\n};\n\nconst fallback: ComponentRenderer = ({ element }) => (\n <div className=\"fk:rounded-md fk:border fk:border-dashed fk:border-border fk:p-3 fk:text-sm fk:text-muted-foreground fk:corner-squircle\">\n Unsupported component: {element.type}\n </div>\n);\n\nfunction getSanitizedChildren(childKeys: string[] | undefined, elements: Spec['elements']): string[] {\n const seen = new Set<string>();\n const children: string[] = [];\n\n for (const childKey of childKeys ?? []) {\n const normalizedKey = String(childKey);\n\n if (seen.has(normalizedKey) || !elements[normalizedKey]) {\n continue;\n }\n\n seen.add(normalizedKey);\n children.push(normalizedKey);\n }\n\n return children;\n}\n\nfunction haveChildrenChanged(original: string[], sanitized: string[]): boolean {\n if (original.length !== sanitized.length) {\n return true;\n }\n\n return sanitized.some((childKey, index) => childKey !== original[index]);\n}\n\nfunction sanitizeSpec(spec: Spec): Spec | null {\n if (!spec.elements[spec.root]) {\n return null;\n }\n\n let hasChanged = false;\n const elements: Spec['elements'] = {};\n\n for (const elementKey of Object.keys(spec.elements)) {\n const element = spec.elements[elementKey];\n\n if (!element) {\n continue;\n }\n\n const elementChildren = element.children ?? [];\n const children = getSanitizedChildren(elementChildren, spec.elements);\n const hasChildrenChanged = haveChildrenChanged(elementChildren, children);\n\n if (hasChildrenChanged) {\n hasChanged = true;\n }\n\n elements[elementKey] = hasChildrenChanged ? { ...element, children } : element;\n }\n\n if (!hasChanged) {\n return spec;\n }\n\n return { ...spec, elements };\n}\n\ninterface SpecMessagePart {\n data?: unknown;\n text?: string;\n type: string;\n}\n\nconst SPEC_DATA_PART_TYPE = 'data-spec';\n\nfunction dedupeSpecParts(parts: SpecMessagePart[]): SpecMessagePart[] {\n const seenPatchLines = new Set<string>();\n const deduped: SpecMessagePart[] = [];\n\n for (const part of parts) {\n if (part.type !== SPEC_DATA_PART_TYPE) {\n continue;\n }\n\n const payload = part.data;\n\n if (payload && typeof payload === 'object' && 'type' in payload && payload.type === 'patch' && 'patch' in payload) {\n const line = JSON.stringify(payload.patch);\n\n if (seenPatchLines.has(line)) {\n continue;\n }\n\n seenPatchLines.add(line);\n }\n\n deduped.push(part);\n }\n\n return deduped;\n}\n\nexport function RunSpecPart({ parts }: { parts: SpecMessagePart[] }): JSX.Element | null {\n const spec = useMemo(() => {\n const builtSpec = buildSpecFromParts(dedupeSpecParts(parts));\n\n return builtSpec ? sanitizeSpec(builtSpec) : null;\n }, [parts]);\n const stateKey = useMemo(() => JSON.stringify(spec?.state ?? {}), [spec]);\n\n if (!spec) {\n return null;\n }\n\n return (\n <StateProvider initialState={spec.state} key={stateKey}>\n <VisibilityProvider>\n <ActionProvider>\n <Renderer fallback={fallback} registry={registry} spec={spec} />\n </ActionProvider>\n </VisibilityProvider>\n </StateProvider>\n );\n}\n\nexport type { SpecMessagePart };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/apps/ai/spec-renderer.tsx"],"names":["cardMaxWidthClasses","Card","children","element","props","maxWidthClass","centeredClass","jsxs","jsx","stackGapClasses","stackAlignClasses","stackJustifyClasses","Stack","directionClass","gapClass","alignClass","justifyClass","gridColumnClasses","gridGapClasses","Grid","columnClass","Separator","headingClasses","Heading","level","textClasses","Text","BadgeComponent","Badge","AlertIcon","type","CheckCircle2Icon","AlertTriangleIcon","XCircleIcon","InfoIcon","Alert","typeClass","Table","columns","rows","row","TableCaption","TableHeader","TableRow","column","index","TableHead","TableBody","rowIndex","cell","cellIndex","TableCell","Progress","max","percent","Skeleton","LinkComponent","ExternalLink","Image","Accordion","item","Tabs","tabs","TabsList","tab","TabsTrigger","TabContent","TabsContent","trendClasses","TrendIcon","trend","TrendingUpIcon","TrendingDownIcon","MinusIcon","Metric","calloutClasses","CalloutIcon","LightbulbIcon","OctagonAlertIcon","Callout","timelineDotClasses","Timeline","items","CHART_COLORS","chartTooltipStyle","chartTooltipItemStyle","chartTooltipLabelStyle","chartTick","toNumber","value","parsed","getChartPoints","data","groups","key","group","x","ChartFrame","height","title","ResponsiveContainer","BarChart","points","color","RechartsBarChart","CartesianGrid","XAxis","YAxis","RechartsTooltip","Bar","LineChart","RechartsLineChart","Line","PieChart","slices","RechartsPieChart","Pie","slice","Cell","Mermaid","chart","diagramId","useId","svg","setSvg","useState","error","setError","useEffect","isCancelled","mermaid","isDark","result","renderError","registry","fallback","getSanitizedChildren","childKeys","elements","seen","childKey","normalizedKey","haveChildrenChanged","original","sanitized","sanitizeSpec","spec","hasChanged","elementKey","elementChildren","hasChildrenChanged","SPEC_DATA_PART_TYPE","dedupeSpecParts","parts","seenPatchLines","deduped","part","payload","line","RunSpecPart","useMemo","builtSpec","buildSpecFromParts","stateKey","StateProvider","VisibilityProvider","ActionProvider","Renderer"],"mappings":"8xBA2DA,IAAMA,EAAAA,CAAsB,CAC1B,EAAA,CAAI,cACJ,EAAA,CAAI,aAAA,CACJ,EAAA,CAAI,aAAA,CACJ,IAAA,CAAM,eACR,CAAA,CAEMC,EAAAA,CAAqC,CAAC,CAAE,QAAA,CAAAC,CAAAA,CAAU,OAAA,CAAAC,CAAQ,CAAA,GAAM,CACpE,GAAM,CAAE,KAAA,CAAAC,CAAM,CAAA,CAAID,CAAAA,CACZE,CAAAA,CAAgBD,CAAAA,CAAM,QAAA,CAAWJ,EAAAA,CAAoBI,EAAM,QAAQ,CAAA,CAAI,EAAA,CACvEE,CAAAA,CAAgBF,CAAAA,CAAM,QAAA,CAAW,YAAA,CAAe,EAAA,CAEtD,OACEG,IAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAW,CAAA,kGAAA,EAAqGF,CAAa,CAAA,CAAA,EAAIC,CAAa,CAAA,CAAA,EAAIF,EAAM,SAAA,EAAa,EAAE,CAAA,mBAAA,CAAA,CAEtK,QAAA,CAAA,CAAAA,CAAAA,CAAM,KAAA,EAASI,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,2BAAA,CAA6B,QAAA,CAAAJ,CAAAA,CAAM,KAAA,CAAM,EACvEA,CAAAA,CAAM,WAAA,EAAeI,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,+CAAA,CAAiD,QAAA,CAAAJ,CAAAA,CAAM,WAAA,CAAY,CAAA,CAAA,CACtGA,CAAAA,CAAM,KAAA,EAASA,CAA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,EAAS,CACjH,IAAMC,CAAAA,CAAO,IAAA,CAAK,SAAA,CAAUD,CAAAA,CAAQ,KAAK,CAAA,CAEzC,GAAIH,CAAAA,CAAe,GAAA,CAAII,CAAI,CAAA,CACzB,SAGFJ,CAAAA,CAAe,GAAA,CAAII,CAAI,EACzB,CAEAH,CAAAA,CAAQ,IAAA,CAAKC,CAAI,EACnB,CAEA,OAAOD,CACT,CAEO,SAASI,EAAAA,CAAY,CAAE,KAAA,CAAAN,CAAM,CAAA,CAAqD,CACvF,IAAMP,CAAAA,CAAOc,QAAQ,IAAM,CACzB,IAAMC,CAAAA,CAAYC,kBAAAA,CAAmBV,EAAAA,CAAgBC,CAAK,CAAC,EAE3D,OAAOQ,CAAAA,CAAYhB,EAAAA,CAAagB,CAAS,CAAA,CAAI,IAC/C,CAAA,CAAG,CAACR,CAAK,CAAC,CAAA,CACJU,CAAAA,CAAWH,OAAAA,CAAQ,IAAM,IAAA,CAAK,SAAA,CAAUd,CAAAA,EAAM,KAAA,EAAS,EAAE,CAAA,CAAG,CAACA,CAAI,CAAC,CAAA,CAExE,OAAKA,CAAAA,CAKH1I,IAAC4J,aAAAA,CAAA,CAAc,YAAA,CAAclB,CAAAA,CAAK,KAAA,CAChC,QAAA,CAAA1I,GAAAA,CAAC6J,kBAAAA,CAAA,CACC,QAAA,CAAA7J,GAAAA,CAAC8J,cAAAA,CAAA,CACC,QAAA,CAAA9J,GAAAA,CAAC+J,QAAAA,CAAA,CAAS,SAAUhC,EAAAA,CAAU,QAAA,CAAUD,EAAAA,CAAU,IAAA,CAAMY,EAAM,CAAA,CAChE,CAAA,CACF,CAAA,CAAA,CAL4CiB,CAM9C,EAVO,IAYX","file":"spec-renderer-3GAVSV52.js","sourcesContent":["import type { JSX } from 'react';\nimport type { ComponentRegistry, ComponentRenderer, Spec } from '@json-render/react';\nimport { useEffect, useId, useMemo, useState } from 'react';\nimport { ActionProvider, Renderer, StateProvider, VisibilityProvider, buildSpecFromParts } from '@json-render/react';\nimport {\n AlertTriangleIcon,\n CheckCircle2Icon,\n InfoIcon,\n LightbulbIcon,\n MinusIcon,\n OctagonAlertIcon,\n TrendingDownIcon,\n TrendingUpIcon,\n XCircleIcon,\n} from 'lucide-react';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n Cell,\n Line,\n LineChart as RechartsLineChart,\n Pie,\n PieChart as RechartsPieChart,\n ResponsiveContainer,\n Tooltip as RechartsTooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport {\n Badge,\n ExternalLink,\n Separator as SeparatorPrimitive,\n Skeleton as SkeletonPrimitive,\n Table as TablePrimitive,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n Tabs as TabsPrimitive,\n TabsContent,\n TabsList,\n TabsTrigger,\n} from '../../ui';\n\n// ---------------------------------------------------------------------------\n// Layout components\n// ---------------------------------------------------------------------------\n\ninterface CardProps {\n centered: boolean | null;\n className: string | null;\n description: string | null;\n maxWidth: 'sm' | 'md' | 'lg' | 'full' | null;\n title: string | null;\n}\n\nconst cardMaxWidthClasses = {\n sm: 'fk:max-w-sm',\n md: 'fk:max-w-md',\n lg: 'fk:max-w-lg',\n full: 'fk:max-w-full',\n};\n\nconst Card: ComponentRenderer<CardProps> = ({ children, element }) => {\n const { props } = element;\n const maxWidthClass = props.maxWidth ? cardMaxWidthClasses[props.maxWidth] : '';\n const centeredClass = props.centered ? 'fk:mx-auto' : '';\n\n return (\n <div\n className={`fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:gap-2 fk:flex fk:flex-col ${maxWidthClass} ${centeredClass} ${props.className ?? ''} fk:corner-squircle`}\n >\n {props.title && <div className=\"fk:text-sm fk:font-medium\">{props.title}</div>}\n {props.description && <div className=\"fk:mt-0.5 fk:text-xs fk:text-muted-foreground\">{props.description}</div>}\n {(props.title ?? props.description) && children ? <div className=\"fk:mt-3\" /> : null}\n {children}\n </div>\n );\n};\n\ninterface StackProps {\n align: 'start' | 'center' | 'end' | 'stretch' | null;\n className: string | null;\n direction: 'horizontal' | 'vertical' | null;\n gap: 'none' | 'sm' | 'md' | 'lg' | 'xl' | null;\n justify: 'start' | 'center' | 'end' | 'between' | 'around' | null;\n}\n\nconst stackGapClasses = {\n none: 'fk:gap-0',\n sm: 'fk:gap-2',\n md: 'fk:gap-3',\n lg: 'fk:gap-4',\n xl: 'fk:gap-6',\n};\n\nconst stackAlignClasses = {\n start: 'fk:items-start',\n center: 'fk:items-center',\n end: 'fk:items-end',\n stretch: 'fk:items-stretch',\n};\n\nconst stackJustifyClasses = {\n start: 'fk:justify-start',\n center: 'fk:justify-center',\n end: 'fk:justify-end',\n between: 'fk:justify-between',\n around: 'fk:justify-around',\n};\n\nconst Stack: ComponentRenderer<StackProps> = ({ children, element }) => {\n const { props } = element;\n const directionClass = props.direction === 'horizontal' ? 'fk:flex-row fk:flex-wrap' : 'fk:flex-col';\n const gapClass = stackGapClasses[props.gap ?? 'md'];\n const alignClass = props.align ? stackAlignClasses[props.align] : '';\n const justifyClass = props.justify ? stackJustifyClasses[props.justify] : '';\n\n return (\n <div\n className={`fk:flex fk:w-full ${directionClass} ${gapClass} ${alignClass} ${justifyClass} ${props.className ?? ''}`}\n >\n {children}\n </div>\n );\n};\n\ninterface GridProps {\n className: string | null;\n columns: number | null;\n gap: 'sm' | 'md' | 'lg' | 'xl' | null;\n}\n\nconst gridColumnClasses: { [columns: number]: string } = {\n 1: 'fk:grid-cols-1',\n 2: 'fk:grid-cols-2',\n 3: 'fk:grid-cols-3',\n 4: 'fk:grid-cols-4',\n 5: 'fk:grid-cols-5',\n 6: 'fk:grid-cols-6',\n};\n\nconst gridGapClasses = {\n sm: 'fk:gap-2',\n md: 'fk:gap-3',\n lg: 'fk:gap-4',\n xl: 'fk:gap-6',\n};\n\nconst Grid: ComponentRenderer<GridProps> = ({ children, element }) => {\n const { props } = element;\n const columnClass = gridColumnClasses[props.columns ?? 1] ?? 'fk:grid-cols-1';\n const gapClass = gridGapClasses[props.gap ?? 'md'];\n\n return <div className={`fk:grid fk:w-full ${columnClass} ${gapClass} ${props.className ?? ''}`}>{children}</div>;\n};\n\nconst Separator: ComponentRenderer<{ orientation: 'horizontal' | 'vertical' | null }> = ({ element }) => (\n <SeparatorPrimitive orientation={element.props.orientation ?? 'horizontal'} />\n);\n\n// ---------------------------------------------------------------------------\n// Typography and content components\n// ---------------------------------------------------------------------------\n\ninterface HeadingProps {\n level: 'h1' | 'h2' | 'h3' | 'h4' | null;\n text: string;\n}\n\nconst headingClasses = {\n h1: 'fk:text-xl fk:font-semibold fk:tracking-tight',\n h2: 'fk:text-lg fk:font-semibold fk:tracking-tight',\n h3: 'fk:text-base fk:font-medium',\n h4: 'fk:text-sm fk:font-medium',\n};\n\nconst Heading: ComponentRenderer<HeadingProps> = ({ element }) => {\n const level = element.props.level ?? 'h2';\n const HeadingTag = level;\n\n return <HeadingTag className={headingClasses[level]}>{element.props.text}</HeadingTag>;\n};\n\ninterface TextProps {\n text: string;\n variant: 'body' | 'muted' | 'caption' | 'lead' | 'code' | null;\n}\n\nconst textClasses = {\n body: 'fk:text-sm',\n muted: 'fk:text-sm fk:text-muted-foreground',\n caption: 'fk:text-xs fk:text-muted-foreground',\n lead: 'fk:text-base',\n code: 'fk:rounded fk:bg-muted fk:px-1 fk:py-0.5 fk:font-mono fk:text-xs fk:corner-squircle',\n};\n\nconst Text: ComponentRenderer<TextProps> = ({ element }) => (\n <p className={textClasses[element.props.variant ?? 'body']}>{element.props.text}</p>\n);\n\ninterface BadgeProps {\n text: string;\n variant: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}\n\nconst BadgeComponent: ComponentRenderer<BadgeProps> = ({ element }) => (\n <Badge variant={element.props.variant ?? 'default'}>{element.props.text}</Badge>\n);\n\ninterface AlertProps {\n message: string | null;\n title: string;\n type: 'success' | 'info' | 'warning' | 'error' | null;\n}\n\nfunction AlertIcon({ type }: { type: AlertProps['type'] }): JSX.Element {\n switch (type) {\n case 'success':\n return <CheckCircle2Icon className=\"fk:size-4 fk:translate-y-0.5\" />;\n case 'warning':\n return <AlertTriangleIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n case 'error':\n return <XCircleIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n default:\n return <InfoIcon className=\"fk:size-4 fk:translate-y-0.5\" />;\n }\n}\n\nconst Alert: ComponentRenderer<AlertProps> = ({ element }) => {\n const { props } = element;\n const typeClass = props.type === 'error' ? 'fk:border-destructive/50 fk:text-destructive' : 'fk:text-foreground';\n\n return (\n <div\n className={`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:bg-card fk:px-4 fk:py-3 fk:text-sm ${typeClass} fk:corner-squircle`}\n role=\"alert\"\n >\n <AlertIcon type={props.type} />\n <div className=\"fk:min-w-0\">\n <div className=\"fk:font-medium\">{props.title}</div>\n {props.message && <div className=\"fk:text-muted-foreground\">{props.message}</div>}\n </div>\n </div>\n );\n};\n\ninterface TableProps {\n caption: string | null;\n columns: string[];\n rows: string[][];\n}\n\nconst Table: ComponentRenderer<TableProps> = ({ element }) => {\n const columns = element.props.columns ?? [];\n const rows = (element.props.rows ?? []).map((row) => row.map(String));\n\n return (\n <div className=\"fk:w-full fk:overflow-hidden fk:rounded-md fk:mt-2 fk:corner-squircle\">\n <TablePrimitive>\n {element.props.caption && <TableCaption>{element.props.caption}</TableCaption>}\n <TableHeader>\n <TableRow>\n {columns.map((column, index) => (\n <TableHead key={`${index.toString()}-${column}`}>{column}</TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {rows.map((row, rowIndex) => (\n <TableRow key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <TableCell key={cellIndex}>{cell}</TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </TablePrimitive>\n </div>\n );\n};\n\ninterface ProgressProps {\n label: string | null;\n max: number | null;\n value: number;\n}\n\nconst Progress: ComponentRenderer<ProgressProps> = ({ element }) => {\n const { props } = element;\n const max = props.max ?? 100;\n const percent = max > 0 ? Math.min(100, Math.max(0, (props.value / max) * 100)) : 0;\n\n return (\n <div className=\"fk:w-full\">\n {props.label && (\n <div className=\"fk:mb-1 fk:flex fk:items-center fk:justify-between fk:text-xs fk:text-muted-foreground\">\n <span>{props.label}</span>\n <span className=\"fk:tabular-nums\">{Math.round(percent)}%</span>\n </div>\n )}\n <div className=\"fk:h-2 fk:w-full fk:overflow-hidden fk:rounded-full fk:bg-secondary fk:corner-squircle\">\n <div className=\"fk:h-full fk:rounded-full fk:bg-primary fk:corner-squircle\" style={{ width: `${percent.toString()}%` }} />\n </div>\n </div>\n );\n};\n\nconst Skeleton: ComponentRenderer<{ height: string | null; rounded: boolean | null; width: string | null }> = ({\n element,\n}) => (\n <SkeletonPrimitive\n className={element.props.rounded ? 'fk:rounded-full fk:corner-squircle' : ''}\n style={{ height: element.props.height ?? '1rem', width: element.props.width ?? '100%' }}\n />\n);\n\nconst LinkComponent: ComponentRenderer<{ href: string; label: string }> = ({ element }) => (\n <ExternalLink href={element.props.href}>{element.props.label}</ExternalLink>\n);\n\nconst Image: ComponentRenderer<{\n alt: string;\n height: number | null;\n src: string | null;\n width: number | null;\n}> = ({ element }) => {\n if (!element.props.src) {\n return null;\n }\n\n return (\n <img\n alt={element.props.alt}\n className=\"fk:max-w-full fk:rounded-md fk:corner-squircle\"\n height={element.props.height ?? undefined}\n src={element.props.src}\n width={element.props.width ?? undefined}\n />\n );\n};\n\ninterface AccordionProps {\n items: { content: string; title: string }[];\n type: 'single' | 'multiple' | null;\n}\n\nconst Accordion: ComponentRenderer<AccordionProps> = ({ element }) => (\n <div className=\"fk:w-full fk:divide-y fk:divide-border fk:rounded-md fk:border fk:border-border fk:corner-squircle\">\n {(element.props.items ?? []).map((item, index) => (\n <details className=\"fk:group fk:px-4 fk:py-3\" key={index}>\n <summary className=\"fk:cursor-pointer fk:list-none fk:text-sm fk:font-medium\">{item.title}</summary>\n <p className=\"fk:mt-2 fk:text-sm fk:text-muted-foreground\">{item.content}</p>\n </details>\n ))}\n </div>\n);\n\n// ---------------------------------------------------------------------------\n// Tabs\n// ---------------------------------------------------------------------------\n\ninterface TabsProps {\n defaultValue: string | null;\n tabs: { label: string; value: string }[];\n value: string | null;\n}\n\nconst Tabs: ComponentRenderer<TabsProps> = ({ children, element }) => {\n const tabs = element.props.tabs ?? [];\n\n return (\n <TabsPrimitive defaultValue={element.props.value ?? element.props.defaultValue ?? tabs[0]?.value}>\n <TabsList>\n {tabs.map((tab) => (\n <TabsTrigger key={tab.value} value={tab.value}>\n {tab.label}\n </TabsTrigger>\n ))}\n </TabsList>\n {children}\n </TabsPrimitive>\n );\n};\n\nconst TabContent: ComponentRenderer<{ value: string }> = ({ children, element }) => (\n <TabsContent value={element.props.value}>{children}</TabsContent>\n);\n\n// ---------------------------------------------------------------------------\n// Result-focused components (Metric, Callout, Timeline)\n// ---------------------------------------------------------------------------\n\ninterface MetricProps {\n detail: string | null;\n label: string;\n trend: 'up' | 'down' | 'neutral' | null;\n value: string;\n}\n\nconst trendClasses = {\n up: 'fk:text-success',\n down: 'fk:text-destructive',\n neutral: 'fk:text-muted-foreground',\n};\n\nfunction TrendIcon({ trend }: { trend: 'up' | 'down' | 'neutral' }): JSX.Element {\n if (trend === 'up') {\n return <TrendingUpIcon className=\"fk:size-4\" />;\n }\n\n if (trend === 'down') {\n return <TrendingDownIcon className=\"fk:size-4\" />;\n }\n\n return <MinusIcon className=\"fk:size-4\" />;\n}\n\nconst Metric: ComponentRenderer<MetricProps> = ({ element }) => {\n const { props } = element;\n\n return (\n <div className=\"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle\">\n <div className=\"fk:text-xs fk:font-medium fk:text-muted-foreground\">{props.label}</div>\n <div className=\"fk:mt-1 fk:flex fk:items-center fk:gap-2\">\n <span className=\"fk:text-2xl fk:font-semibold fk:tabular-nums fk:tracking-tight\">{props.value}</span>\n {props.trend && (\n <span className={trendClasses[props.trend]}>\n <TrendIcon trend={props.trend} />\n </span>\n )}\n </div>\n {props.detail && <div className=\"fk:mt-1 fk:text-xs fk:text-muted-foreground\">{props.detail}</div>}\n </div>\n );\n};\n\ninterface CalloutProps {\n content: string;\n title: string | null;\n type: 'info' | 'tip' | 'warning' | 'important' | null;\n}\n\nconst calloutClasses = {\n info: 'fk:border-blue-500/30 fk:bg-blue-500/5 fk:text-blue-700 fk:dark:text-blue-400',\n tip: 'fk:border-emerald-500/30 fk:bg-emerald-500/5 fk:text-emerald-700 fk:dark:text-emerald-400',\n warning: 'fk:border-amber-500/30 fk:bg-amber-500/5 fk:text-amber-700 fk:dark:text-amber-400',\n important: 'fk:border-red-500/30 fk:bg-red-500/5 fk:text-red-700 fk:dark:text-red-400',\n};\n\nfunction CalloutIcon({ type }: { type: 'info' | 'tip' | 'warning' | 'important' }): JSX.Element {\n switch (type) {\n case 'tip':\n return <LightbulbIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n case 'warning':\n return <AlertTriangleIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n case 'important':\n return <OctagonAlertIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n default:\n return <InfoIcon className=\"fk:size-4 fk:shrink-0 fk:translate-y-0.5\" />;\n }\n}\n\nconst Callout: ComponentRenderer<CalloutProps> = ({ element }) => {\n const { props } = element;\n const type = props.type ?? 'info';\n\n return (\n <div\n className={`fk:flex fk:w-full fk:gap-3 fk:rounded-lg fk:border fk:px-4 fk:py-3 fk:text-sm ${calloutClasses[type]} fk:corner-squircle`}\n >\n <CalloutIcon type={type} />\n <div className=\"fk:min-w-0\">\n {props.title && <div className=\"fk:font-medium\">{props.title}</div>}\n <div className=\"fk:text-foreground\">{props.content}</div>\n </div>\n </div>\n );\n};\n\ninterface TimelineProps {\n items: {\n date: string | null;\n description: string | null;\n status: 'completed' | 'current' | 'upcoming' | null;\n title: string;\n }[];\n}\n\nconst timelineDotClasses = {\n completed: 'fk:border-success fk:bg-success',\n current: 'fk:border-primary fk:bg-primary',\n upcoming: 'fk:border-border fk:bg-background',\n};\n\nconst Timeline: ComponentRenderer<TimelineProps> = ({ element }) => (\n <div className=\"fk:w-full\">\n {(element.props.items ?? []).map((item, index, items) => (\n <div className=\"fk:relative fk:flex fk:gap-3 fk:pb-4 fk:last:pb-0\" key={index}>\n {index < items.length - 1 && (\n <div className=\"fk:absolute fk:left-[5px] fk:top-4 fk:h-full fk:w-px fk:bg-border\" />\n )}\n <div\n className={`fk:mt-1 fk:size-[11px] fk:shrink-0 fk:rounded-full fk:border-2 ${timelineDotClasses[item.status ?? 'upcoming']} fk:corner-squircle`}\n />\n <div className=\"fk:min-w-0\">\n <div className=\"fk:flex fk:flex-wrap fk:items-baseline fk:gap-x-2\">\n <span className=\"fk:text-sm fk:font-medium\">{item.title}</span>\n {item.date && <span className=\"fk:text-xs fk:text-muted-foreground\">{item.date}</span>}\n </div>\n {item.description && <div className=\"fk:text-sm fk:text-muted-foreground\">{item.description}</div>}\n </div>\n </div>\n ))}\n </div>\n);\n\n// ---------------------------------------------------------------------------\n// Charts\n// ---------------------------------------------------------------------------\n\nconst CHART_COLORS = ['#6366f1', '#10b981', '#f59e0b', '#ef4444', '#06b6d4'];\n\nconst chartTooltipStyle = {\n background: 'hsl(var(--background))',\n border: '1px solid hsl(var(--border))',\n borderRadius: 6,\n color: 'hsl(var(--foreground))',\n fontSize: 12,\n};\n\nconst chartTooltipItemStyle = {\n color: 'hsl(var(--foreground))',\n};\n\nconst chartTooltipLabelStyle = {\n color: 'hsl(var(--foreground))',\n};\n\nconst chartTick = { fill: 'hsl(var(--muted-foreground))', fontSize: 11 };\n\ninterface ChartPoint {\n x: string;\n y: number;\n}\n\ninterface CartesianChartProps {\n aggregate: 'sum' | 'count' | 'avg' | null;\n color: string | null;\n data: { [key: string]: unknown }[];\n height: number | null;\n title: string | null;\n xKey: string;\n yKey: string;\n}\n\nfunction toNumber(value: unknown): number {\n const parsed = typeof value === 'number' ? value : Number(value);\n\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction getChartPoints(props: CartesianChartProps): ChartPoint[] {\n const data = props.data ?? [];\n\n if (!props.aggregate) {\n return data.map((row) => ({\n x: String(row[props.xKey] ?? ''),\n y: toNumber(row[props.yKey]),\n }));\n }\n\n const groups = new Map<string, { count: number; sum: number }>();\n\n for (const row of data) {\n const key = String(row[props.xKey] ?? '');\n const group = groups.get(key) ?? { count: 0, sum: 0 };\n\n group.count += 1;\n group.sum += toNumber(row[props.yKey]);\n groups.set(key, group);\n }\n\n return Array.from(groups.entries()).map(([x, group]) => {\n if (props.aggregate === 'count') {\n return { x, y: group.count };\n }\n\n if (props.aggregate === 'avg') {\n return { x, y: group.count === 0 ? 0 : group.sum / group.count };\n }\n\n return { x, y: group.sum };\n });\n}\n\nfunction ChartFrame({\n children,\n height,\n title,\n}: {\n children: JSX.Element;\n height: number | null;\n title: string | null;\n}): JSX.Element {\n return (\n <div className=\"fk:w-full\">\n {title && <div className=\"fk:mb-2 fk:text-sm fk:font-medium\">{title}</div>}\n <div style={{ height: height ?? 256 }}>\n <ResponsiveContainer height=\"100%\" width=\"100%\">\n {children}\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\nconst BarChart: ComponentRenderer<CartesianChartProps> = ({ element }) => {\n const points = getChartPoints(element.props);\n const color = element.props.color ?? CHART_COLORS[0];\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsBarChart data={points}>\n <CartesianGrid stroke=\"hsl(var(--border))\" vertical={false} />\n <XAxis axisLine={false} dataKey=\"x\" tick={chartTick} tickLine={false} tickMargin={8} />\n <YAxis axisLine={false} tick={chartTick} tickLine={false} width={40} />\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n cursor={{ fill: 'hsl(var(--muted))' }}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Bar dataKey=\"y\" fill={color} isAnimationActive={false} name={element.props.yKey} radius={4} />\n </RechartsBarChart>\n </ChartFrame>\n );\n};\n\nconst LineChart: ComponentRenderer<CartesianChartProps> = ({ element }) => {\n const points = getChartPoints(element.props);\n const color = element.props.color ?? CHART_COLORS[0];\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsLineChart data={points}>\n <CartesianGrid stroke=\"hsl(var(--border))\" vertical={false} />\n <XAxis axisLine={false} dataKey=\"x\" tick={chartTick} tickLine={false} tickMargin={8} />\n <YAxis axisLine={false} tick={chartTick} tickLine={false} width={40} />\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Line\n dataKey=\"y\"\n dot={false}\n isAnimationActive={false}\n name={element.props.yKey}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n </RechartsLineChart>\n </ChartFrame>\n );\n};\n\ninterface PieChartProps {\n data: { [key: string]: unknown }[];\n height: number | null;\n nameKey: string;\n title: string | null;\n valueKey: string;\n}\n\nconst PieChart: ComponentRenderer<PieChartProps> = ({ element }) => {\n const slices = (element.props.data ?? []).map((row) => ({\n name: String(row[element.props.nameKey] ?? ''),\n value: toNumber(row[element.props.valueKey]),\n }));\n\n return (\n <ChartFrame height={element.props.height} title={element.props.title}>\n <RechartsPieChart>\n <RechartsTooltip\n contentStyle={chartTooltipStyle}\n itemStyle={chartTooltipItemStyle}\n labelStyle={chartTooltipLabelStyle}\n />\n <Pie data={slices} dataKey=\"value\" innerRadius=\"45%\" isAnimationActive={false} nameKey=\"name\">\n {slices.map((slice, index) => (\n <Cell fill={CHART_COLORS[index % CHART_COLORS.length]} key={`${slice.name}-${index.toString()}`} />\n ))}\n </Pie>\n </RechartsPieChart>\n </ChartFrame>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Mermaid\n// ---------------------------------------------------------------------------\n\ninterface MermaidProps {\n chart: string;\n title: string | null;\n}\n\nconst Mermaid: ComponentRenderer<MermaidProps> = ({ element }) => {\n const { chart, title } = element.props;\n const diagramId = useId().replace(/[^a-zA-Z0-9]/g, '');\n const [svg, setSvg] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let isCancelled = false;\n\n const render = async (): Promise<void> => {\n try {\n const { default: mermaid } = await import('mermaid');\n const isDark = document.documentElement.classList.contains('dark');\n\n mermaid.initialize({ securityLevel: 'strict', startOnLoad: false, theme: isDark ? 'dark' : 'default' });\n\n const result = await mermaid.render(`fk-mermaid-${diagramId}`, chart);\n\n if (!isCancelled) {\n setSvg(result.svg);\n setError(null);\n }\n } catch (renderError) {\n if (!isCancelled) {\n setError(renderError instanceof Error ? renderError.message : 'Failed to render the diagram.');\n }\n }\n };\n\n void render();\n\n return () => {\n isCancelled = true;\n };\n }, [chart, diagramId]);\n\n return (\n <div className=\"fk:w-full fk:rounded-lg fk:border fk:border-border fk:bg-card fk:p-4 fk:corner-squircle\">\n {title && <div className=\"fk:mb-2 fk:text-sm fk:font-medium\">{title}</div>}\n {error ? (\n <pre className=\"fk:overflow-x-auto fk:whitespace-pre-wrap fk:text-xs fk:text-muted-foreground\">{chart}</pre>\n ) : null}\n {!error && svg ? (\n <div className=\"fk:flex fk:justify-center fk:overflow-x-auto\" dangerouslySetInnerHTML={{ __html: svg }} />\n ) : null}\n {!error && !svg ? <SkeletonPrimitive className=\"fk:h-40 fk:w-full\" /> : null}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Registry and spec rendering\n// ---------------------------------------------------------------------------\n\nconst registry: ComponentRegistry = {\n Accordion,\n Alert,\n Badge: BadgeComponent,\n BarChart,\n Callout,\n Card,\n Grid,\n Heading,\n Image,\n LineChart,\n Link: LinkComponent,\n Mermaid,\n Metric,\n PieChart,\n Progress,\n Separator,\n Skeleton,\n Stack,\n TabContent,\n Table,\n Tabs,\n Text,\n Timeline,\n};\n\nconst fallback: ComponentRenderer = ({ element }) => (\n <div className=\"fk:rounded-md fk:border fk:border-dashed fk:border-border fk:p-3 fk:text-sm fk:text-muted-foreground fk:corner-squircle\">\n Unsupported component: {element.type}\n </div>\n);\n\nfunction getSanitizedChildren(childKeys: string[] | undefined, elements: Spec['elements']): string[] {\n const seen = new Set<string>();\n const children: string[] = [];\n\n for (const childKey of childKeys ?? []) {\n const normalizedKey = String(childKey);\n\n if (seen.has(normalizedKey) || !elements[normalizedKey]) {\n continue;\n }\n\n seen.add(normalizedKey);\n children.push(normalizedKey);\n }\n\n return children;\n}\n\nfunction haveChildrenChanged(original: string[], sanitized: string[]): boolean {\n if (original.length !== sanitized.length) {\n return true;\n }\n\n return sanitized.some((childKey, index) => childKey !== original[index]);\n}\n\nfunction sanitizeSpec(spec: Spec): Spec | null {\n if (!spec.elements[spec.root]) {\n return null;\n }\n\n let hasChanged = false;\n const elements: Spec['elements'] = {};\n\n for (const elementKey of Object.keys(spec.elements)) {\n const element = spec.elements[elementKey];\n\n if (!element) {\n continue;\n }\n\n const elementChildren = element.children ?? [];\n const children = getSanitizedChildren(elementChildren, spec.elements);\n const hasChildrenChanged = haveChildrenChanged(elementChildren, children);\n\n if (hasChildrenChanged) {\n hasChanged = true;\n }\n\n elements[elementKey] = hasChildrenChanged ? { ...element, children } : element;\n }\n\n if (!hasChanged) {\n return spec;\n }\n\n return { ...spec, elements };\n}\n\ninterface SpecMessagePart {\n data?: unknown;\n text?: string;\n type: string;\n}\n\nconst SPEC_DATA_PART_TYPE = 'data-spec';\n\nfunction dedupeSpecParts(parts: SpecMessagePart[]): SpecMessagePart[] {\n const seenPatchLines = new Set<string>();\n const deduped: SpecMessagePart[] = [];\n\n for (const part of parts) {\n if (part.type !== SPEC_DATA_PART_TYPE) {\n continue;\n }\n\n const payload = part.data;\n\n if (payload && typeof payload === 'object' && 'type' in payload && payload.type === 'patch' && 'patch' in payload) {\n const line = JSON.stringify(payload.patch);\n\n if (seenPatchLines.has(line)) {\n continue;\n }\n\n seenPatchLines.add(line);\n }\n\n deduped.push(part);\n }\n\n return deduped;\n}\n\nexport function RunSpecPart({ parts }: { parts: SpecMessagePart[] }): JSX.Element | null {\n const spec = useMemo(() => {\n const builtSpec = buildSpecFromParts(dedupeSpecParts(parts));\n\n return builtSpec ? sanitizeSpec(builtSpec) : null;\n }, [parts]);\n const stateKey = useMemo(() => JSON.stringify(spec?.state ?? {}), [spec]);\n\n if (!spec) {\n return null;\n }\n\n return (\n <StateProvider initialState={spec.state} key={stateKey}>\n <VisibilityProvider>\n <ActionProvider>\n <Renderer fallback={fallback} registry={registry} spec={spec} />\n </ActionProvider>\n </VisibilityProvider>\n </StateProvider>\n );\n}\n\nexport type { SpecMessagePart };\n"]}
|
package/dist/ui.d.ts
CHANGED
|
@@ -183,6 +183,8 @@ declare function TooltipTrigger({ ...props }: React$1.ComponentProps<typeof Tool
|
|
|
183
183
|
declare function TooltipPortal({ ...props }: React$1.ComponentProps<typeof Tooltip$1.Portal>): react_jsx_runtime.JSX.Element;
|
|
184
184
|
declare function TooltipContent({ className, sideOffset, children, ...props }: React$1.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
|
|
185
185
|
|
|
186
|
+
/** Whether the sidebar was last left open, as remembered in the cookie; open when unknown. */
|
|
187
|
+
declare function readSidebarCookieState(): boolean;
|
|
186
188
|
type SidebarContextProps = {
|
|
187
189
|
state: 'expanded' | 'collapsed';
|
|
188
190
|
open: boolean;
|
|
@@ -278,18 +280,26 @@ type Props = {
|
|
|
278
280
|
actions: ReactNode;
|
|
279
281
|
beforeClose?: () => boolean;
|
|
280
282
|
children: ReactNode;
|
|
281
|
-
|
|
283
|
+
/** @deprecated Stacking is handled by nesting (`nested`); kept for callers that still pass it. */
|
|
284
|
+
depth?: number;
|
|
282
285
|
/**
|
|
283
286
|
* Close the drawer without running `beforeClose` (used after confirming discard).
|
|
284
|
-
* Lets Vaul release its body lock instead of hard-unmounting an open drawer.
|
|
285
287
|
*/
|
|
286
288
|
forceClose?: boolean;
|
|
287
|
-
|
|
289
|
+
/** @deprecated The frontmost nested drawer handles Escape by itself; kept for callers that still pass it. */
|
|
290
|
+
isFocused?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* The drawer opened on top of this one. Rendering it inside this drawer's
|
|
293
|
+
* tree makes it a nested drawer: this one stays mounted and slides aside.
|
|
294
|
+
*/
|
|
295
|
+
nested?: ReactNode;
|
|
288
296
|
onFormChange?: Dispatch<SetStateAction<boolean>>;
|
|
289
297
|
onClose: () => void;
|
|
298
|
+
/** Pinned under the scrollable body; the body shrinks to make room for it. */
|
|
299
|
+
panel?: ReactNode;
|
|
290
300
|
title: string;
|
|
291
301
|
};
|
|
292
|
-
declare function DrawerModal({ actions, beforeClose, children, depth, forceClose, isFocused, onFormChange: _onFormChange, onClose, title, }: Props): JSX.Element;
|
|
302
|
+
declare function DrawerModal({ actions, beforeClose, children, depth: _depth, forceClose, isFocused: _isFocused, nested, onFormChange: _onFormChange, onClose, panel, title, }: Props): JSX.Element;
|
|
293
303
|
|
|
294
304
|
declare const Toaster: ({ richColors, style, ...props }: ToasterProps) => react_jsx_runtime.JSX.Element;
|
|
295
305
|
|
|
@@ -762,4 +772,4 @@ declare function AttachmentTrigger({ className, asChild, type, ...props }: React
|
|
|
762
772
|
}): react_jsx_runtime.JSX.Element;
|
|
763
773
|
declare function AttachmentGroup({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
764
774
|
|
|
765
|
-
export { Alert, AlertDescription, AlertTitle, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, type AttachmentData, AttachmentDescription, AttachmentEmpty, type AttachmentEmptyProps, AttachmentGroup, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, AttachmentMedia, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, AttachmentTitle, AttachmentTrigger, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpeechInput, type SpeechInputProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
|
|
775
|
+
export { Alert, AlertDescription, AlertTitle, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, type AttachmentData, AttachmentDescription, AttachmentEmpty, type AttachmentEmptyProps, AttachmentGroup, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, AttachmentMedia, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, AttachmentTitle, AttachmentTrigger, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpeechInput, type SpeechInputProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, readSidebarCookieState, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
|
package/dist/ui.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';export{
|
|
1
|
+
import'./index.css';export{Tc as Alert,Vc as AlertDescription,Uc as AlertTitle,Gb as Attachment,Mb as AttachmentAction,Lb as AttachmentActions,Ib as AttachmentContent,Kb as AttachmentDescription,Na as AttachmentEmpty,Ob as AttachmentGroup,Ka as AttachmentHoverCard,Ma as AttachmentHoverCardContent,La as AttachmentHoverCardTrigger,Ia as AttachmentInfo,Hb as AttachmentMedia,Ha as AttachmentPreview,Ja as AttachmentRemove,Jb as AttachmentTitle,Nb as AttachmentTrigger,Ga as Attachments,o as Checkbox,Va as CodeBlock,Ta as CodeBlockActions,Pa as CodeBlockContainer,Ua as CodeBlockContent,Wa as CodeBlockCopyButton,Sa as CodeBlockFilename,Qa as CodeBlockHeader,Xa as CodeBlockLanguageSelector,_a as CodeBlockLanguageSelectorContent,$a as CodeBlockLanguageSelectorItem,Ya as CodeBlockLanguageSelectorTrigger,Za as CodeBlockLanguageSelectorValue,Ra as CodeBlockTitle,p as Collapsible,r as CollapsibleContent,q as CollapsibleTrigger,ab as Conversation,bb as ConversationContent,fb as ConversationDownload,cb as ConversationEmptyState,db as ConversationScrollButton,pa as DrawerModal,f as ExternalLink,g as Form,l as FormControl,m as FormDescription,h as FormField,j as FormItem,k as FormLabel,n as FormMessage,sa as HoverCard,ua as HoverCardContent,ta as HoverCardTrigger,s as Input,wa as InputGroup,xa as InputGroupAddon,ya as InputGroupButton,Aa as InputGroupInput,za as InputGroupText,Ba as InputGroupTextarea,ma as InsufficientPermissionsTooltipContent,e as Label,Tb as LocalReferencedSourcesContext,gb as Message,jb as MessageAction,ib as MessageActions,kb as MessageBranch,lb as MessageBranchContent,ob as MessageBranchNext,pb as MessageBranchPage,nb as MessageBranchPrevious,mb as MessageBranchSelector,hb as MessageContent,qb as MessageResponse,rb as MessageToolbar,sb as ModelSelector,ub as ModelSelectorContent,vb as ModelSelectorDialog,yb as ModelSelectorEmpty,zb as ModelSelectorGroup,wb as ModelSelectorInput,Ab as ModelSelectorItem,xb as ModelSelectorList,Db as ModelSelectorLogo,Eb as ModelSelectorLogoGroup,Fb as ModelSelectorName,Cb as ModelSelectorSeparator,Bb as ModelSelectorShortcut,tb as ModelSelectorTrigger,na as PermissionTooltip,t as Popover,w as PopoverAnchor,v as PopoverContent,u as PopoverTrigger,Xb as PromptInput,Vb as PromptInputActionAddAttachments,Wb as PromptInputActionAddScreenshot,cc as PromptInputActionMenu,ec as PromptInputActionMenuContent,fc as PromptInputActionMenuItem,dc as PromptInputActionMenuTrigger,Yb as PromptInputBody,bc as PromptInputButton,uc as PromptInputCommand,xc as PromptInputCommandEmpty,yc as PromptInputCommandGroup,vc as PromptInputCommandInput,zc as PromptInputCommandItem,wc as PromptInputCommandList,Ac as PromptInputCommandSeparator,$b as PromptInputFooter,_b as PromptInputHeader,mc as PromptInputHoverCard,oc as PromptInputHoverCardContent,nc as PromptInputHoverCardTrigger,Rb as PromptInputProvider,hc as PromptInputSelect,jc as PromptInputSelectContent,kc as PromptInputSelectItem,ic as PromptInputSelectTrigger,lc as PromptInputSelectValue,gc as PromptInputSubmit,qc as PromptInputTab,sc as PromptInputTabBody,tc as PromptInputTabItem,rc as PromptInputTabLabel,pc as PromptInputTabsList,Zb as PromptInputTextarea,ac as PromptInputTools,Dc as Reasoning,Fc as ReasoningContent,Ec as ReasoningTrigger,z as ResizableHandle,y as ResizablePanel,x as ResizablePanelGroup,A as Sheet,C as SheetClose,F as SheetContent,J as SheetDescription,H as SheetFooter,G as SheetHeader,E as SheetOverlay,D as SheetPortal,I as SheetTitle,B as SheetTrigger,Bc as Shimmer,Z as Sidebar,R as SidebarContent,S as SidebarGroup,U as SidebarGroupContent,T as SidebarGroupLabel,Q as SidebarInset,V as SidebarMenu,X as SidebarMenuButton,W as SidebarMenuItem,N as SidebarPanel,M as SidebarProvider,P as SidebarRail,O as SidebarTrigger,Jc as Source,Gc as Sources,Ic as SourcesContent,Hc as SourcesTrigger,Kc as SpeechInput,va as Spinner,Mc as Suggestion,Lc as Suggestions,_ as Switch,$ as Table,ba as TableBody,ga as TableCaption,fa as TableCell,ca as TableFooter,ea as TableHead,aa as TableHeader,da as TableRow,ha as Tabs,ka as TabsContent,ia as TabsList,ja as TabsTrigger,la as Textarea,ra as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,Nc as Tool,Qc as ToolContent,Pc as ToolHeader,Rc as ToolInput,Sc as ToolOutput,Da as getAttachmentLabel,Ca as getMediaCategory,Oc as getStatusBadge,Oa as highlightCode,eb as messagesToMarkdown,K as readSidebarCookieState,qa as toast,a as toggleVariants,Fa as useAttachmentContext,Ea as useAttachmentsContext,i as useFormField,Sb as usePromptInputAttachments,Pb as usePromptInputController,Ub as usePromptInputReferencedSources,Qb as useProviderAttachments,Cc as useReasoning,L as useSidebar}from'./chunk-DGIY4SKN.js';export{a as Avatar,c as AvatarFallback,d as AvatarGroup,b as AvatarImage,e as DropdownMenu,k as DropdownMenuCheckboxItem,h as DropdownMenuContent,i as DropdownMenuGroup,j as DropdownMenuItem,n as DropdownMenuLabel,f as DropdownMenuPortal,l as DropdownMenuRadioGroup,m as DropdownMenuRadioItem,o as DropdownMenuSeparator,p as DropdownMenuShortcut,q as DropdownMenuSub,s as DropdownMenuSubContent,r as DropdownMenuSubTrigger,g as DropdownMenuTrigger,t as Skeleton}from'./chunk-SZEGGBOC.js';export{b as Badge,z as ButtonGroup,B as ButtonGroupSeparator,A as ButtonGroupText,m as Command,n as CommandDialog,q as CommandEmpty,r as CommandGroup,o as CommandInput,t as CommandItem,p as CommandList,s as CommandSeparator,u as CommandShortcut,c as Dialog,f as DialogClose,h as DialogContent,l as DialogDescription,j as DialogFooter,i as DialogHeader,g as DialogOverlay,e as DialogPortal,k as DialogTitle,d as DialogTrigger,w as ScrollArea,x as ScrollBar,v as Separator,a as badgeVariants,y as buttonGroupVariants}from'./chunk-32ZU4MLE.js';import'./chunk-U45E5X3H.js';export{a as Select,e as SelectContent,b as SelectGroup,g as SelectItem,f as SelectLabel,j as SelectScrollDownButton,i as SelectScrollUpButton,h as SelectSeparator,d as SelectTrigger,c as SelectValue}from'./chunk-HDOIOXMP.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-USNXQOMJ.js';export{b as Button,a as buttonVariants}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';//# sourceMappingURL=ui.js.map
|
|
2
2
|
//# sourceMappingURL=ui.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexkit/studio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Flexkit Studio - Build custom internal tools like PIMs, CRMs, and ERPs with a flexible React UI and a graph-backed API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flexkit",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@types/react-dom": "19.2.3",
|
|
70
70
|
"@types/react-file-icon": "1.0.4",
|
|
71
71
|
"@types/uuid": "^9.0.6",
|
|
72
|
+
"graphology-types": "0.24.8",
|
|
72
73
|
"react": "19.2.5",
|
|
73
74
|
"react-dom": "19.2.5",
|
|
74
75
|
"tailwindcss": "4.2.4",
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
"dependencies": {
|
|
83
84
|
"@ai-sdk/react": "3.0.118",
|
|
84
85
|
"@apollo/client": "4.0.9",
|
|
86
|
+
"@base-ui/react": "1.9.0",
|
|
85
87
|
"@codemirror/commands": "6.11.0",
|
|
86
88
|
"@codemirror/lang-markdown": "6.5.2",
|
|
87
89
|
"@codemirror/language": "6.12.4",
|
|
@@ -121,6 +123,7 @@
|
|
|
121
123
|
"@tiptap/html": "2.27.1",
|
|
122
124
|
"@tiptap/pm": "2.27.1",
|
|
123
125
|
"@uiw/codemirror-themes": "4.25.11",
|
|
126
|
+
"@untitledui/file-icons": "0.0.9",
|
|
124
127
|
"@vercel/blob": "0.25.0",
|
|
125
128
|
"ai": "6.0.116",
|
|
126
129
|
"boring-avatars": "2.0.4",
|
|
@@ -131,6 +134,9 @@
|
|
|
131
134
|
"cron-parser": "5.5.0",
|
|
132
135
|
"date-fns": "4.1.0",
|
|
133
136
|
"debug": "^4.3.4",
|
|
137
|
+
"graphology": "0.26.0",
|
|
138
|
+
"graphology-layout": "0.6.1",
|
|
139
|
+
"graphology-layout-forceatlas2": "0.10.1",
|
|
134
140
|
"graphql": "^16.8.1",
|
|
135
141
|
"graphql-ws": "5.14.2",
|
|
136
142
|
"lexical": "^0.12.2",
|
|
@@ -151,6 +157,7 @@
|
|
|
151
157
|
"recharts": "2.15.3",
|
|
152
158
|
"shadcn": "4.16.1",
|
|
153
159
|
"shiki": "4.4.3",
|
|
160
|
+
"sigma": "4.0.3",
|
|
154
161
|
"sonner": "^2.0.0",
|
|
155
162
|
"streamdown": "2.5.0",
|
|
156
163
|
"swr": "^2.4.1",
|
|
@@ -159,10 +166,9 @@
|
|
|
159
166
|
"use-debounce": "10.0.3",
|
|
160
167
|
"use-stick-to-bottom": "1.1.6",
|
|
161
168
|
"uuid": "^9.0.1",
|
|
162
|
-
"vaul": "1.1.2",
|
|
163
169
|
"zod": "4.4.3",
|
|
164
|
-
"@flexkit/
|
|
165
|
-
"@flexkit/
|
|
170
|
+
"@flexkit/agent-protocol": "^0.3.11",
|
|
171
|
+
"@flexkit/schema": "0.2.15"
|
|
166
172
|
},
|
|
167
173
|
"peerDependencies": {
|
|
168
174
|
"react": "^19.0.0",
|
|
@@ -191,6 +197,8 @@
|
|
|
191
197
|
"ui:add": "pnpm dlx shadcn@latest add",
|
|
192
198
|
"test:core": "tsup --config tests/core.config.ts && node --test build/tests/json-schema-to-zod.test.js build/tests/icon-name.test.js build/tests/project-schemas.test.js build/tests/rating-preview.test.js build/tests/last-project.test.js build/tests/proxy-target.test.js build/tests/project-label.test.js build/tests/hosted-session.test.js build/tests/bff-session.test.js build/tests/project-schema-key.test.js build/tests/schema-deploy-watch.test.js build/tests/app-sessions.test.js build/tests/electron-api.test.js",
|
|
193
199
|
"test:ai": "tsup --config tests/ai.config.ts && node --test build/tests/ai/*.test.js",
|
|
194
|
-
"test": "
|
|
200
|
+
"test:knowledge": "tsup --config tests/knowledge.config.ts && node --test build/tests/knowledge/*.test.js",
|
|
201
|
+
"test:graph": "tsup --config tests/graph.config.ts && node --test build/tests/graph/*.test.js",
|
|
202
|
+
"test": "pnpm run test:core && pnpm run test:ai && pnpm run test:knowledge && pnpm run test:graph && pnpm run test:performance"
|
|
195
203
|
}
|
|
196
204
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';export{b as ActivityNavButton,a as useActivitySummary}from'./chunk-U5D3EDCY.js';import'./chunk-NLRSLQUT.js';import'./chunk-5CVDMZUI.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';//# sourceMappingURL=activity-nav-button-7SVTTHBQ.js.map
|
|
2
|
-
//# sourceMappingURL=activity-nav-button-7SVTTHBQ.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-RYKUNA7Z.js';import {f as f$2,b,c,g as g$1,a as a$1,e as e$1,d}from'./chunk-CSUHZFEP.js';import {x,A,u,t,H,n,l,k,m,o,y,r,s,w,v as v$1,p,e as e$2,G,D,B,g as g$2,j,h,f as f$3,z,F,I,E,q}from'./chunk-D6H64Z37.js';import'./chunk-ALCK2BJY.js';import {g,f as f$1,a as a$3}from'./chunk-NLRSLQUT.js';import {f}from'./chunk-7ZFUS62K.js';import'./chunk-2HYQVMP3.js';import'./chunk-5CVDMZUI.js';import {Pb,N,Nb,_a,$a,bb,Vb,Yb,Wb,Xb,Zb,_b,ac,bc,cc,Tb,fc,gc,jc,hc,ic,Ic,ec}from'./chunk-YCCFUGWJ.js';import {v}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b as b$1,c as c$1,e}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import {a as a$2}from'./chunk-O2QMYUPS.js';import {useRef,useMemo,useState,useEffect,useLayoutEffect}from'react';import {LoaderCircle,CornerDownRightIcon,CheckIcon,CopyIcon,PencilIcon}from'lucide-react';import {useParams,useNavigate}from'react-router-dom';import de,{useSWRConfig}from'swr';import {jsx,jsxs}from'react/jsx-runtime';function Ft(e,t){let r=Date.parse(e.createdAt)-Date.parse(t.createdAt);return Number.isFinite(r)&&r!==0?r:e.createdAt!==t.createdAt?e.createdAt<t.createdAt?-1:1:e.id===t.id?0:e.id<t.id?-1:1}function ae(e){return [...new Map(e.map(r=>[r.id,r])).values()].sort(Ft)}function Ce(e,t){if(!t)return e;if(!e)return t;let r=new Set(t.messages.map(c=>c.id)),o=t.messages[t.messages.length-1],s=e.messages.filter(c=>!r.has(c.id)&&(!o||Ft(c,o)>0));return s.length===0?t:{...t,messages:ae([...t.messages,...s])}}var on="flexkit:agent:draft:";function Kt(){return typeof localStorage>"u"?null:localStorage}function Ht(e,t){return `${on}${e}:${t??"new"}`}function Ot(e,t=Kt()){try{return t?.getItem(e)??""}catch{return ""}}function Bt(e,t,r=Kt()){try{t.trim().length===0?r?.removeItem(e):r?.setItem(e,t);}catch{}}function an(e){return e==="pending"||e==="streaming"||e==="awaiting_approval"}function Qt(e){return e==="queued"||e==="steering"}function ke(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r.role==="assistant"){if(!an(r.status))break;return {after:e.slice(t+1),before:e.slice(0,t),live:r}}}return {after:[],before:e,live:null}}function Ne(e){return e==="steering"?"Picked up at the next step":e==="queued"?"Sends when this turn ends":null}function jt(e){let t=new Set;for(let r of e)if(!(r.role!=="assistant"||!Array.isArray(r.parts)))for(let o of r.parts){let s=o.type==="data-mid-turn-message"?o.data?.messageId:null;typeof s=="string"&&t.add(s);}return t}function ve(e){return e.find(t=>t.role==="user"&&t.status==="queued"&&t.kind!=="monitor_event")??null}function $t(e){return e.streaming&&!e.hasDraft?"stop":"send"}var hn=6e4,qt=15e3;function An(e){if(!e)return 0;if(ke(e.messages).live||ve(e.messages))return y;if(!e.messages.some(o=>o.role==="assistant"&&o.status==="complete"))return (e.monitors?.length??0)>0?qt:0;let r=new Date(e.chat.lastMessageAt??e.chat.updatedAt).getTime();return Date.now()-r<hn?y:(e.monitors?.length??0)>0?qt:0}function Cn(e,t,r){return {chat:{createdAt:r,id:e,lastMessageAt:r,modelId:t,title:null,updatedAt:r},messages:[],pendingApproval:null}}function Xt(e,t,r,o,s,c){return e||(t?{chat:t,messages:[],pendingApproval:null}:r||Cn(o,s,c))}function Gt(e,t){let r=new Set([t.userMessage.id,t.assistantMessage.id]);return {...e,messages:ae([...e.messages.filter(o=>!r.has(o.id)),t.userMessage,t.assistantMessage])}}function kn(e,t){return {...e,messages:ae([...e.messages.filter(r=>r.id!==t.id),t])}}function vn(e,t,r){return t?Ce(e[t],r):r}function Sn(e){return e==="awaiting_approval"?"awaiting_approval":e==="complete"?"success":e==="failed"?"failed":"running"}function Ue({attachments:e$1=[],label:t,text:r}){let{textInput:o}=Nb(),[s,c]=useState(false),u=r.trim().length>0;async function C(){await navigator.clipboard.writeText(r),c(true),setTimeout(()=>c(false),1500);}return jsxs("div",{className:"fk:group fk:ml-auto fk:flex fk:w-fit fk:max-w-[70%] fk:flex-col fk:items-end fk:gap-1",children:[jsx(q,{attachments:e$1}),u?jsx("div",{className:"fk:whitespace-pre-wrap fk:rounded-xl fk:bg-muted fk:dark:bg-white/20 fk:px-3.5 fk:py-2 fk:text-base fk:corner-squircle",children:r}):null,t?jsxs("span",{className:"fk:inline-flex fk:items-center fk:gap-1 fk:text-xs fk:text-muted-foreground",children:[jsx(CornerDownRightIcon,{className:"fk:size-3 fk:shrink-0"}),t]}):null,jsxs("div",{className:u?"fk:flex fk:gap-0.5 fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100":"fk:hidden",children:[jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{"aria-label":"Copy prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>{C();},children:s?jsx(CheckIcon,{className:"fk:size-3.5"}):jsx(CopyIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Copy"})]}),jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{"aria-label":"Edit prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>o.setInput(r),children:jsx(PencilIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Edit"})]})]})]})}function Yt(e){let r=e.find(o=>o.type==="data-suggested-prompt")?.data?.prompt;return typeof r=="string"&&r.trim()?r:null}function Vt({prompt:e}){let{textInput:t}=Nb();return jsx("div",{className:"fk:flex fk:justify-start",children:jsxs("button",{className:"fk:inline-flex fk:max-w-full fk:items-center fk:gap-1.5 fk:rounded-full fk:border fk:border-border/70 fk:bg-muted/40 fk:px-3 fk:py-1.5 fk:text-left fk:text-sm fk:text-muted-foreground fk:transition-colors fk:hover:border-border fk:hover:bg-muted fk:hover:ext-foreground fk:corner-squircle",title:"Use as your next message",type:"button",onClick:()=>t.setInput(e),children:[jsx(CornerDownRightIcon,{className:"fk:size-3 fk:shrink-0"}),jsx("span",{className:"fk:truncate",children:e})]})})}function yn({api:e,part:t,partIndex:r,parts:o}){return t.type.startsWith("tool-")?t.state==="output-error"?jsx(G,{message:t.errorText??"The tool call failed."}):null:jsx(F,{api:e,part:t,partIndex:r,parts:o})}function zt({api:e,message:t,showSuggestion:r$1=false}){if(t.kind==="monitor_event"){let u=r(t);return u?jsx(s,{data:u,error:t.error}):null}if(t.kind==="plugin_connected"){let u=w(t.parts);return u?jsx(v$1,{data:u,error:t.error,label:Ne(t.status)}):null}if(t.role==="user")return jsx(Ue,{attachments:p(t.parts),label:Ne(t.status),text:t.textContent});let o=(Array.isArray(t.parts)?t.parts:[]).filter(u=>!e$2(u)&&!(u.type.startsWith("tool-")&&u.state!=="output-error")),s$1=o.some(u=>u.type==="data-turn-error"),c=r$1&&!t.error?Yt(o):null;return o.length===0&&!t.error?null:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[o.map((u,C)=>jsx(yn,{api:e,part:u,partIndex:C,parts:o},u.toolCallId??`${t.id}-${C.toString()}`)),t.error&&!s$1?jsx(G,{message:t.error}):null,c?jsx(Vt,{prompt:c}):null]})}function Mn({api:e,chatId:t,detail:r,message:o,onMidTurnDelivered:s,onStatusChange:c,onTurnUpdated:u,questionAnsweredSignal:C}){let Q=Sn(o.status),S=o.workflowRunId?e.getAgentChatStreamUrl(t,o.workflowRunId):"",[L,x]=useState(0),[g,h$1]=useState(false),[y,D$1]=useState({}),F$1=useRef(null),{message:p,status:k}=D(S,{decidedApprovals:y,recordStatus:Q,resumeToken:L,suppressApprovalPause:g}),R=useMemo(()=>p?[{...p,parts:p.parts.filter(d=>!e$2(d))}]:[],[p]),j$1=B(R),K=useRef(u);K.current=u;let $=useRef(c);$.current=c;let H=useMemo(()=>({answerQuestion:async(d,B)=>{let{question:_}=await e.answerAgentChatQuestion(t,d,B);return h$1(true),x(J=>J+1),K.current(),_??null},onApprovalDecided:(d,B)=>{d&&B&&B!=="pending"&&D$1(_=>({..._,[d]:B})),!(d&&F$1.current===d)&&(d&&(F$1.current=d),h$1(true),x(_=>_+1),K.current());}}),[e,t]);useEffect(()=>{x(0),h$1(false),F$1.current=null,D$1({});},[o.id]);let l=useRef(C);useEffect(()=>{C!==l.current&&(l.current=C,C?.messageId===o.id&&(h$1(true),x(d=>d+1)));},[o.id,C]),useEffect(()=>{g&&o.status==="streaming"&&h$1(false);},[o.status,g]),useEffect(()=>{(k==="finished"||k==="paused")&&K.current();},[k]);let P=(p?.parts??[]).filter(d=>d.type==="data-mid-turn-message").map(d=>String(d.data?.messageId??"")).join(`
|
|
2
|
-
`),O=useRef(s);O.current=s,useEffect(()=>{P&&O.current(P.split(`
|
|
3
|
-
`));},[P]);let b=!g&&o.status!=="streaming"&&(o.status==="awaiting_approval"||k==="paused"||g$2(p)||j(p)),re=useMemo(()=>new Set(h(p)),[p]),W=r.pendingApproval&&!re.has(r.pendingApproval.id)?r.pendingApproval:null,le=p?.parts[p.parts.length-1],z$1=le?.type==="text"&&le.state==="streaming",se=j(p)?"Waiting for your answer":"Awaiting approval",N=b?se:f$3(p)??"Thinking",w=b?k!=="finished"&&k!=="error":k==="streaming"&&!z$1;useEffect(()=>{$.current({label:N,visible:w});},[N,w]);let Y=!!W&&b,oe=k==="finished"?Yt(j$1.flatMap(d=>d.parts)):null;return j$1.length===0&&!Y?jsx(z.Provider,{value:H,children:null}):jsx(z.Provider,{value:H,children:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[j$1.map(d=>jsx("div",{className:"fk:space-y-8 fk:min-w-0",children:d.parts.map((B,_)=>jsx(F,{api:e,part:B,partIndex:_,parts:d.parts},_))},d.id)),W&&Y?jsx(I,{api:e,message:E(W)}):null,oe?jsx(Vt,{prompt:oe}):null]})})}function wn({draftKey:e}){let{textInput:t}=Nb(),{setInput:r,value:o}=t,s=useRef(null);return useLayoutEffect(()=>{if(s.current===e){Bt(e,o);return}s.current=e;let c=Ot(e);c!==o&&r(c);},[e,r,o]),null}function In({api:e,effort:t,modelKey:r,modelPending:o$1,models:s,onEffortChange:c$1,onError:u,onModelChange:C,onSend:Q,onStop:S,placeholder:L,sending:x,streaming:g}){let{attachments:h,textInput:y}=Nb(),D=n(e,u),F=useRef(false),p=s.filter(l=>!l.deprecated||b(l)===r),k$1=c(s,r),R=e$1(k$1),j=d(k$1,t),K=y.value.trim().length>0||h.files.length>0,$=$t({hasDraft:K,streaming:g}),H=K&&!D.isUploading&&!x&&!o$1;return jsxs(Vb,{accept:m,className:"fk:mx-auto fk:max-w-4xl",maxFileSize:k,maxFiles:l,multiple:true,onError:l=>u(l.message),onSubmit:({text:l})=>{let P=l?.trim()??"",O=D.getUploaded(h.files.map(b=>b.id));return !P&&O.length===0||D.isUploading||x||F.current||o$1?Promise.reject(new Error("The message cannot be sent right now.")):(F.current=true,y.clear(),Q(P,O).catch(b=>{throw y.setInput(l),b}).finally(()=>{F.current=false;}))},children:[h.files.length>0?jsx(Yb,{children:jsx(o,{uploads:D})}):null,jsx(Wb,{children:jsx(Xb,{disabled:x,placeholder:L})}),jsxs(Zb,{children:[jsxs(_b,{children:[jsxs(ac,{children:[jsx(bc,{"aria-label":"Add attachments",className:"fk:border-0 fk:bg-border fk:corner-round",disabled:x,tooltip:"Add photos or files"}),jsx(cc,{children:jsx(Tb,{})})]}),p.length>0?jsxs(fc,{value:r??void 0,onValueChange:C,children:[jsx(gc,{"aria-label":"Model",className:"fk:min-w-44",children:jsx(jc,{placeholder:"Model"})}),jsx(hc,{children:p.map(l=>jsx(ic,{value:b(l),children:l.name},b(l)))})]}):null,R.length>1&&j?jsxs(fc,{value:j,onValueChange:c$1,children:[jsx(gc,{"aria-label":"Reasoning effort",className:"fk:min-w-28",children:jsx(jc,{placeholder:"Effort"})}),jsx(hc,{children:R.map(l=>jsx(ic,{value:l.value,children:l.label},l.value))})]}):null]}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[jsx(Ic,{disabled:x,onAudioRecorded:async(l,P)=>{let{text:O}=await e.transcribeAgentAudio(l,P);return O},onError:l=>u(l.message),onTranscriptionChange:l=>{u(null),y.setInput(a$3(y.value,l));}}),jsx(ec,{className:"fk:corner-round",disabled:$==="stop"?false:!H,status:$==="stop"?"streaming":void 0,onStop:()=>{S();}})]})]})]})}var _e={chatId:null,error:null,loading:false,older:[],page:null},Tn=3e3;function xn({api:e,chatId:t,projectId:r,pendingFollowUp:o,pendingMessage:s,questionAnsweredSignal:c,resolveDetail:u}){let{data:C,mutate:Q}=de(t?g(r).agentChat(t):null,f$1,{refreshInterval:0}),S=u(C),[L,x]=useState(_e),g$1=L.chatId===t?L:_e,h=useRef(t);h.current=t;let y=(a,v)=>x(M=>{if(M.chatId!==a&&h.current!==a)return M;let U=M.chatId===a?M:{..._e,chatId:a};return {...U,...v(U)}}),D=useRef({chatId:null,messages:[]}),F=S?.messages;useEffect(()=>{let a=D.current,v=F??[];if(D.current={chatId:t,messages:v},!t||a.chatId!==t)return;let M=new Set(v.map(A=>A.id)),U=a.messages.filter(A=>!M.has(A.id));U.length>0&&y(t,A=>({older:ae([...A.older,...U])}));},[t,F]);let p=new Set(S?.messages.map(a=>a.id)??[]),k=[...g$1.older.filter(a=>!p.has(a.id)),...S?.messages??[]],R=useRef(S);R.current=S;let j=useRef(void 0);de(t?`${g(r).agentChat(t)}?view=status`:null,f$1,{refreshInterval:()=>An(R.current),onSuccess:a=>{let v=JSON.stringify(a),M=j.current;j.current=v;let{current:U}=R,A=U?[...U.messages].reverse().find(V=>V.role==="assistant"):void 0;(M&&M!==v||A&&a.latestMessage&&(A.id!==a.latestMessage.id||A.status!==a.latestMessage.status||A.workflowRunId!==a.latestMessage.workflowRunId||U?.chat.updatedAt!==a.chat.updatedAt))&&Q();}});let K=async()=>{let a=g$1.page?.cursor??S?.nextCursor;if(!t||!a||g$1.loading)return;let v=t;y(v,()=>({error:null,loading:true}));try{let M=await f$1(`${g(r).agentChat(v)}?before=${encodeURIComponent(a)}`);y(v,U=>({loading:!1,older:ae([...M.messages,...U.older]),page:{cursor:M.nextCursor??null,hasMore:M.hasMore??!1}}));}catch{y(v,()=>({error:"Could not load earlier messages. Try again.",loading:false}));}},{after:$,before:H$1,live:l}=ke(k),[P,O]=useState({ids:[],messageId:""}),b=jt(k);for(let a of l&&P.messageId===l.id?P.ids:[])b.add(a);let re=$.filter(a=>Qt(a.status)&&!b.has(a.id)),W=H$1.filter(a=>!b.has(a.id)),z=(!l&&!s?ve(k):null)?.id??null,[se,N]=useState(0),w=useRef(null);useEffect(()=>{if(!t||!z||w.current===z)return;w.current=z;let a=false,v=null;return e.startQueuedAgentChatMessage(t,z).then(()=>{},()=>{v=setTimeout(()=>{a||N(M=>M+1);},Tn);}).finally(()=>{w.current=null,Q();}),()=>{a=true,v&&clearTimeout(v);}},[e,t,Q,z,se]);let[Y,oe]=useState(null),d=l&&Y?.messageId===l.id?Y.status:null;if(t&&!S&&!s)return jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:justify-center fk:gap-2 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),"Loading chat..."]});let B=!!s||!!l,_=[...W].reverse().find(a=>a.role==="assistant")?.id??null,J=l?d?.label??"Thinking":"Sending",ee=l?d?.visible??true:true;return jsxs(_a,{className:"fk:h-0 fk:min-h-0 fk:flex-1",children:[jsx($a,{className:"fk:gap-0 fk:p-0",children:jsxs("div",{className:"fk:mx-auto fk:w-full fk:max-w-4xl fk:space-y-5 fk:pb-6 fk:pr-4",children:[g$1.page?.hasMore??S?.hasMore?jsx(b$2,{variant:"ghost",disabled:g$1.loading,onClick:()=>{K();},children:g$1.loading?"Loading\u2026":"Load earlier messages"}):null,g$1.error?jsx("p",{role:"alert",children:g$1.error}):null,W.map(a=>jsx(zt,{api:e,message:a,showSuggestion:!B&&a.id===_},a.id)),l&&t&&S?jsx(Mn,{api:e,chatId:t,detail:S,message:l,onMidTurnDelivered:a=>O({ids:a,messageId:l.id}),onStatusChange:a=>oe({messageId:l.id,status:a}),onTurnUpdated:()=>{Q();},questionAnsweredSignal:c}):null,s&&!l?jsx(Ue,{attachments:s.attachments,text:s.text}):null,B?jsx(H,{label:J,visible:ee}):null,re.map(a=>jsx(zt,{api:e,message:a},a.id)),o&&l?jsx(Ue,{attachments:o.attachments,text:o.text}):null]})}),jsx(bb,{})]})}var Jt=["Where should we begin?","Ready when you are","What\u2019s on the agenda today?","What\u2019s on your mind today?"];function Pn(e){return [`How can I help, ${e}?`,`Good to see you, ${e}.`,`Hey, ${e}. Ready to dive in?`]}function bn(e){let t=e?[...Jt,...Pn(e)]:Jt;return t[Math.floor(Math.random()*t.length)]??"How can I help?"}var Zt="flexkit-ai:lastModelId",Le="flexkit-ai:lastEffort";function En(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Zt);return e?{effort:localStorage.getItem(Le),modelKey:e}:null}catch{return null}}function Dn(e){return e.selectedModelKey?{effort:e.selectedEffort,modelKey:e.selectedModelKey}:e.awaitingChatModel?{effort:null,modelKey:null}:e.chatSelection?{effort:e.selectedEffort??e.chatSelection.effort,modelKey:e.chatSelection.modelKey}:e.lastUsed?{effort:e.selectedEffort??e.lastUsed.effort,modelKey:e.lastUsed.modelKey}:{effort:e.selectedEffort,modelKey:e.defaultModelKey}}function Rn(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Zt,e.modelKey),e.effort?localStorage.setItem(Le,e.effort):localStorage.removeItem(Le);}catch{}}function Nn({projectId:e}){let{data:t,isLoading:r}=de(g(e).agentProfile(),f$1),o=useMemo(()=>r?null:bn(t?.preferredName??null),[t,r]);return jsx("div",{className:"fk:flex fk:flex-col fk:items-center fk:pb-2 fk:text-center",children:jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:o??"\xA0"})})}function tr(){let{api:e$1,projectId:t$1}=x(),{currentProject:r,projectSummaries:o}=f(),{chatId:s}=useParams(),c$2=useNavigate(),u$1=a(),{mutate:C}=useSWRConfig(),{data:Q}=de(t$1?g(t$1).tools():null,f$1),{data:S}=de(t$1&&s?g(t$1).agentChat(s):null,f$1),L=useRef({});function x$1(i){return vn(L.current,s,i)}let g$2=x$1(S),h=useMemo(()=>Q?.tools.models??[],[Q]),[y,D]=useState(null),[F,p]=useState(null),k=useRef(null),[R,j]=useState(En),[K,$]=useState(false),H=useRef(false),[l,P]=useState(null),O=l&&l.chatId===s?l:void 0,[b$2,re]=useState(null),[W,le]=useState(null),z=b$2&&b$2.chatId===s?b$2:void 0,[se,N$1]=useState(null),w=g$2?.chat.modelId??null,Y=!!s&&g$2===void 0,oe=useMemo(()=>f$2(w,h)??(w?{effort:null,modelKey:w}:null),[w,h]),d=useMemo(()=>{let i=h.find(m=>!m.deprecated);return i?b(i):null},[h]),B=useMemo(()=>{let i=c(h,R?.modelKey??null);return R&&i&&!i.deprecated?R:null},[h,R]),{effort:_,modelKey:J}=Dn({awaitingChatModel:Y,chatSelection:oe,defaultModelKey:d,lastUsed:B,selectedEffort:F,selectedModelKey:y}),ee=J?g$1({effort:_,modelKey:J},h):null,a$3=Y&&!y;useEffect(()=>{k.current=null,D(null),p(null),N$1(null);},[s]),useEffect(()=>{y===a$1&&w&&w!==a$1&&w!==k.current&&(D(null),p(null));},[w,y]);function v$1(i){j(i),Rn(i);}function M(i){k.current=i===a$1?w:null,D(i),p(null),v$1({effort:null,modelKey:i});}function U(i){p(i),J&&v$1({effort:i,modelKey:J});}if(!t$1||!e$1)return jsx("div",{className:"fk:flex fk:h-full fk:items-center fk:justify-center fk:text-sm fk:text-muted-foreground",children:"Select a project to chat with the agent."});let A$1=e$1,V=t$1,en=r?.title??o.find(i=>i.id===t$1)?.name??"your project",Fe=!s&&!O,ce=!!(g$2&&ke(g$2.messages).live);async function tn(i,m,q){re({attachments:q,chatId:i,text:m});try{let I=await A$1.sendAgentChatFollowUp(i,{attachments:q,content:m,modelId:ee});if("question"in I){le({messageId:I.question.chatMessageId}),await C(g(V).agentChat(i));return}await Ke(i,I);}finally{re(null);}}async function Ke(i,m){await C(g(V).agentChat(i),q=>{let I=Xt(Ce(L.current[i],q),null,S,i,ee,"turn"in m?m.turn.userMessage.createdAt:m.followUp.message.createdAt),te="turn"in m?Gt(I,m.turn):kn(I,m.followUp.message);return L.current[i]=te,te},{revalidate:false});}let nn={onConnected:async i=>{if(!s)return;let m=s;try{await Ke(m,await A$1.announcePluginConnected(m,i));}catch(q){N$1(q instanceof Error?q.message:"The agent could not continue after the connection.");}}};async function He(i,m){if(H.current)throw new Error("A message is already being sent.");if(a$3)throw new Error("This chat is still loading.");H.current=true,$(true),N$1(null);let q=g$2?ve(g$2.messages):null;if(s&&(ce||q)){try{!ce&&q&&await A$1.startQueuedAgentChatMessage(s,q.id).catch(()=>{}),await tn(s,i,m);}catch(I){throw N$1(I instanceof Error?I.message:"Failed to send the message."),I}finally{H.current=false,$(false);}return}P({attachments:m,chatId:s,text:i});try{let I=s?{chat:null,turn:await A$1.sendAgentChatMessage(s,{attachments:m,content:i,modelId:ee})}:await A$1.startAgentChat({attachments:m,content:i,modelId:ee}),{chat:te,turn:Oe}=I,fe=s??te.id;await C(g(V).agentChat(fe),sn=>{let Be=Gt(Xt(Ce(L.current[fe],sn),te,S,fe,ee,Oe.userMessage.createdAt),Oe);return L.current[fe]=Be,Be},{revalidate:!1}),te&&c$2(`${u$1}/chats/${te.id}`),P(null);}catch(I){throw P(null),N$1(I instanceof Error?I.message:"Failed to send the message."),I}finally{H.current=false,$(false);}}async function rn(){if(s)try{await A$1.stopAgentChat(s);}catch(i){N$1(i instanceof Error?i.message:"Failed to stop the turn.");}finally{await C(g(V).agentChat(s));}}return jsxs(Pb,{children:[jsx(wn,{draftKey:Ht(V,s)}),jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:flex-col fk:gap-2",children:[jsxs("div",{className:"fk:mb-2 fk:flex fk:shrink-0 fk:items-start fk:gap-2",children:[jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:mt-1 fk:h-4"}),jsx("div",{className:"fk:flex fk:flex-1 fk:items-center fk:gap-2",children:jsx("h1",{className:"fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:s?g$2?.chat.title?.trim()??"Chat":"Agent"})})]}),jsx("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:gap-4",children:jsxs("div",{className:a$2("fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-3",Fe&&"fk:justify-center fk:pb-[12vh]"),children:[Fe?jsx(Nn,{projectId:V}):jsx(A.Provider,{value:true,children:jsx(u.Provider,{value:nn,children:jsx(xn,{api:A$1,chatId:s??null,pendingFollowUp:z,pendingMessage:O,projectId:t$1,questionAnsweredSignal:W,resolveDetail:x$1})})}),jsxs("div",{className:"fk:shrink-0 fk:pb-3",children:[s?jsx(t,{api:A$1,chatId:s,projectId:t$1,sending:K||a$3,onTurnIntoAutomation:i=>{H.current||a$3||He(`Turn the monitor \u201C${i.description}\u201D into an automation.`,[]).catch(m=>N$1(m instanceof Error?m.message:"Failed to send the message."));}}):null,se?jsx("p",{className:"fk:mx-auto fk:mb-2 fk:max-w-4xl fk:text-xs fk:text-destructive",children:se}):null,jsx(In,{api:A$1,effort:_,modelKey:J,modelPending:a$3,models:h,sending:K,streaming:ce,onEffortChange:U,onError:N$1,onModelChange:M,onSend:He,onStop:rn,placeholder:ce?"Add context or steer the agent...":`Ask Flexkit anything about ${en}...`})]})]})})]})]})}export{tr as AgentChatPage};//# sourceMappingURL=chat-page-X3MIN6YC.js.map
|
|
4
|
-
//# sourceMappingURL=chat-page-X3MIN6YC.js.map
|