@flexkit/studio 0.2.1 → 0.2.2
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/chat-page-YWENJEUP.js +4 -0
- package/dist/chat-page-YWENJEUP.js.map +1 -0
- package/dist/chunk-2FQWBOU6.js +6 -0
- package/dist/chunk-2FQWBOU6.js.map +1 -0
- package/dist/chunk-3FIKCGSP.js +4 -0
- package/dist/{chunk-ANVO5P65.js.map → chunk-3FIKCGSP.js.map} +1 -1
- package/dist/{chunk-JYHZU2UZ.js → chunk-4BX7OJJ6.js} +2 -2
- package/dist/{chunk-JYHZU2UZ.js.map → chunk-4BX7OJJ6.js.map} +1 -1
- package/dist/{chunk-ZBI744KS.js → chunk-66N44IKJ.js} +3 -3
- package/dist/chunk-66N44IKJ.js.map +1 -0
- package/dist/{chunk-2IRKGO2B.js → chunk-7ZDMZVDA.js} +5 -5
- package/dist/{chunk-2IRKGO2B.js.map → chunk-7ZDMZVDA.js.map} +1 -1
- package/dist/{chunk-S7M5CQ5S.js → chunk-GW37ZTR2.js} +2 -2
- package/dist/{chunk-S7M5CQ5S.js.map → chunk-GW37ZTR2.js.map} +1 -1
- package/dist/chunk-H6TOYVW2.js +3 -0
- package/dist/chunk-H6TOYVW2.js.map +1 -0
- package/dist/{chunk-5TQF5UQQ.js → chunk-LYGHDJ5A.js} +2 -2
- package/dist/{chunk-5TQF5UQQ.js.map → chunk-LYGHDJ5A.js.map} +1 -1
- package/dist/chunk-OFLU53AC.js +2 -0
- package/dist/{chunk-LQVZWFM2.js.map → chunk-OFLU53AC.js.map} +1 -1
- package/dist/chunk-YIGEER6B.js +7 -0
- package/dist/chunk-YIGEER6B.js.map +1 -0
- package/dist/chunk-Z6IEBNKV.js +2 -0
- package/dist/{chunk-GM5OZTHL.js.map → chunk-Z6IEBNKV.js.map} +1 -1
- package/dist/index.css +378 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/list-3K2PBGML.js +2 -0
- package/dist/{list-ZQJ6NHKQ.js.map → list-3K2PBGML.js.map} +1 -1
- package/dist/pages-BDZ4ZXBS.js +3 -0
- package/dist/{pages-2GQVTLL2.js.map → pages-BDZ4ZXBS.js.map} +1 -1
- package/dist/plugin-pages-Q77CBW45.js +2 -0
- package/dist/{plugin-pages-E5TUDDT5.js.map → plugin-pages-Q77CBW45.js.map} +1 -1
- package/dist/root-4TME2KMP.js +2 -0
- package/dist/{root-HC5QZ2JM.js.map → root-4TME2KMP.js.map} +1 -1
- package/dist/root-4ZVGVCYY.js +23 -0
- package/dist/{root-TXKDRPOK.js.map → root-4ZVGVCYY.js.map} +1 -1
- package/dist/{root-BD4VN3RD.js → root-EZWV5VA4.js} +3 -3
- package/dist/{root-BD4VN3RD.js.map → root-EZWV5VA4.js.map} +1 -1
- package/dist/{root-P6CVZ5ZB.js → root-YKNISFWH.js} +2 -2
- package/dist/{root-P6CVZ5ZB.js.map → root-YKNISFWH.js.map} +1 -1
- package/dist/{search-PVXTPIYJ.js → search-7NX232AW.js} +2 -2
- package/dist/{search-PVXTPIYJ.js.map → search-7NX232AW.js.map} +1 -1
- package/dist/{skills-pages-N5KDEHLT.js → skills-pages-SMJ4EWZW.js} +2 -2
- package/dist/{skills-pages-N5KDEHLT.js.map → skills-pages-SMJ4EWZW.js.map} +1 -1
- package/dist/{spec-renderer-ZZ3GPVKU.js → spec-renderer-5YGDRF52.js} +2 -2
- package/dist/{spec-renderer-ZZ3GPVKU.js.map → spec-renderer-5YGDRF52.js.map} +1 -1
- package/dist/ui.d.ts +28 -4
- package/dist/ui.js +1 -1
- package/package.json +4 -4
- package/dist/chat-page-H6I3XOKS.js +0 -2
- package/dist/chat-page-H6I3XOKS.js.map +0 -1
- package/dist/chunk-ANVO5P65.js +0 -4
- package/dist/chunk-BURKG2UC.js +0 -6
- package/dist/chunk-BURKG2UC.js.map +0 -1
- package/dist/chunk-GM5OZTHL.js +0 -2
- package/dist/chunk-HROHAMPM.js +0 -3
- package/dist/chunk-HROHAMPM.js.map +0 -1
- package/dist/chunk-LQVZWFM2.js +0 -2
- package/dist/chunk-QHDL6CA2.js +0 -7
- package/dist/chunk-QHDL6CA2.js.map +0 -1
- package/dist/chunk-ZBI744KS.js.map +0 -1
- package/dist/list-ZQJ6NHKQ.js +0 -2
- package/dist/pages-2GQVTLL2.js +0 -3
- package/dist/plugin-pages-E5TUDDT5.js +0 -2
- package/dist/root-HC5QZ2JM.js +0 -2
- package/dist/root-TXKDRPOK.js +0 -23
|
@@ -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":"uuBA2DA,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,CAAAA,CAAM,cAAgBF,CA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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-ZZ3GPVKU.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":"uuBA2DA,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,CAAAA,CAAM,cAAgBF,CAAAA,CAAW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AO,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-5YGDRF52.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
|
@@ -349,7 +349,6 @@ type AttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
349
349
|
data: AttachmentData;
|
|
350
350
|
onRemove?: () => void;
|
|
351
351
|
};
|
|
352
|
-
declare const Attachment: ({ data, onRemove, className, children, ...props }: AttachmentProps) => react_jsx_runtime.JSX.Element;
|
|
353
352
|
type AttachmentPreviewProps = HTMLAttributes<HTMLDivElement> & {
|
|
354
353
|
fallbackIcon?: ReactNode;
|
|
355
354
|
};
|
|
@@ -571,7 +570,11 @@ declare const PromptInputBody: ({ className, ...props }: PromptInputBodyProps) =
|
|
|
571
570
|
type PromptInputTextareaProps = ComponentProps<typeof InputGroupTextarea>;
|
|
572
571
|
declare const PromptInputTextarea: ({ onChange, onKeyDown, className, placeholder, ...props }: PromptInputTextareaProps) => react_jsx_runtime.JSX.Element;
|
|
573
572
|
type PromptInputHeaderProps = Omit<ComponentProps<typeof InputGroupAddon>, 'align'>;
|
|
574
|
-
|
|
573
|
+
/**
|
|
574
|
+
* The strip above the textarea. Without children it lists the drafted
|
|
575
|
+
* attachments as chips; children replace that list for custom renderings.
|
|
576
|
+
*/
|
|
577
|
+
declare const PromptInputHeader: ({ className, children, ...props }: PromptInputHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
575
578
|
type PromptInputFooterProps = Omit<ComponentProps<typeof InputGroupAddon>, 'align'>;
|
|
576
579
|
declare const PromptInputFooter: ({ className, ...props }: PromptInputFooterProps) => react_jsx_runtime.JSX.Element;
|
|
577
580
|
type PromptInputToolsProps = HTMLAttributes<HTMLDivElement>;
|
|
@@ -588,7 +591,7 @@ declare const PromptInputButton: ({ variant, className, size, tooltip, ...props
|
|
|
588
591
|
type PromptInputActionMenuProps = ComponentProps<typeof DropdownMenu>;
|
|
589
592
|
declare const PromptInputActionMenu: (props: PromptInputActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
590
593
|
type PromptInputActionMenuTriggerProps = PromptInputButtonProps;
|
|
591
|
-
declare const PromptInputActionMenuTrigger: ({ className, children, ...props }: PromptInputActionMenuTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
594
|
+
declare const PromptInputActionMenuTrigger: ({ className, children, size, variant, ...props }: PromptInputActionMenuTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
592
595
|
type PromptInputActionMenuContentProps = ComponentProps<typeof DropdownMenuContent>;
|
|
593
596
|
declare const PromptInputActionMenuContent: ({ className, onCloseAutoFocus, ...props }: PromptInputActionMenuContentProps) => react_jsx_runtime.JSX.Element;
|
|
594
597
|
type PromptInputActionMenuItemProps = ComponentProps<typeof DropdownMenuItem>;
|
|
@@ -738,4 +741,25 @@ declare function Alert({ className, variant, ...props }: React$1.ComponentProps<
|
|
|
738
741
|
declare function AlertTitle({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
739
742
|
declare function AlertDescription({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
740
743
|
|
|
741
|
-
|
|
744
|
+
declare const attachmentVariants: (props?: ({
|
|
745
|
+
size?: "default" | "xs" | "sm" | null | undefined;
|
|
746
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
747
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
748
|
+
declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<'div'> & VariantProps<typeof attachmentVariants> & {
|
|
749
|
+
state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
750
|
+
}): react_jsx_runtime.JSX.Element;
|
|
751
|
+
declare const attachmentMediaVariants: (props?: ({
|
|
752
|
+
variant?: "icon" | "image" | null | undefined;
|
|
753
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
754
|
+
declare function AttachmentMedia({ className, variant, ...props }: React$1.ComponentProps<'div'> & VariantProps<typeof attachmentMediaVariants>): react_jsx_runtime.JSX.Element;
|
|
755
|
+
declare function AttachmentContent({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
756
|
+
declare function AttachmentTitle({ className, ...props }: React$1.ComponentProps<'span'>): react_jsx_runtime.JSX.Element;
|
|
757
|
+
declare function AttachmentDescription({ className, ...props }: React$1.ComponentProps<'span'>): react_jsx_runtime.JSX.Element;
|
|
758
|
+
declare function AttachmentActions({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
759
|
+
declare function AttachmentAction({ className, variant, size, ...props }: React$1.ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element;
|
|
760
|
+
declare function AttachmentTrigger({ className, asChild, type, ...props }: React$1.ComponentProps<'button'> & {
|
|
761
|
+
asChild?: boolean;
|
|
762
|
+
}): react_jsx_runtime.JSX.Element;
|
|
763
|
+
declare function AttachmentGroup({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
764
|
+
|
|
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 };
|
package/dist/ui.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';export{
|
|
1
|
+
import'./index.css';export{Wc as Alert,Yc as AlertDescription,Xc as AlertTitle,Jb as Attachment,Pb as AttachmentAction,Ob as AttachmentActions,Lb as AttachmentContent,Nb as AttachmentDescription,Qa as AttachmentEmpty,Rb as AttachmentGroup,Na as AttachmentHoverCard,Pa as AttachmentHoverCardContent,Oa as AttachmentHoverCardTrigger,La as AttachmentInfo,Kb as AttachmentMedia,Ka as AttachmentPreview,Ma as AttachmentRemove,Mb as AttachmentTitle,Qb as AttachmentTrigger,Ja as Attachments,o as Checkbox,Ya as CodeBlock,Wa as CodeBlockActions,Sa as CodeBlockContainer,Xa as CodeBlockContent,Za as CodeBlockCopyButton,Va as CodeBlockFilename,Ta as CodeBlockHeader,_a as CodeBlockLanguageSelector,bb as CodeBlockLanguageSelectorContent,cb as CodeBlockLanguageSelectorItem,$a as CodeBlockLanguageSelectorTrigger,ab as CodeBlockLanguageSelectorValue,Ua as CodeBlockTitle,p as Collapsible,r as CollapsibleContent,q as CollapsibleTrigger,db as Conversation,eb as ConversationContent,ib as ConversationDownload,fb as ConversationEmptyState,gb as ConversationScrollButton,sa 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,va as HoverCard,xa as HoverCardContent,wa as HoverCardTrigger,s as Input,za as InputGroup,Aa as InputGroupAddon,Ba as InputGroupButton,Da as InputGroupInput,Ca as InputGroupText,Ea as InputGroupTextarea,qa as InsufficientPermissionsTooltipContent,e as Label,Wb as LocalReferencedSourcesContext,jb as Message,mb as MessageAction,lb as MessageActions,nb as MessageBranch,ob as MessageBranchContent,rb as MessageBranchNext,sb as MessageBranchPage,qb as MessageBranchPrevious,pb as MessageBranchSelector,kb as MessageContent,tb as MessageResponse,ub as MessageToolbar,vb as ModelSelector,xb as ModelSelectorContent,yb as ModelSelectorDialog,Bb as ModelSelectorEmpty,Cb as ModelSelectorGroup,zb as ModelSelectorInput,Db as ModelSelectorItem,Ab as ModelSelectorList,Gb as ModelSelectorLogo,Hb as ModelSelectorLogoGroup,Ib as ModelSelectorName,Fb as ModelSelectorSeparator,Eb as ModelSelectorShortcut,wb as ModelSelectorTrigger,ra as PermissionTooltip,t as Popover,w as PopoverAnchor,v as PopoverContent,u as PopoverTrigger,_b as PromptInput,Yb as PromptInputActionAddAttachments,Zb as PromptInputActionAddScreenshot,fc as PromptInputActionMenu,hc as PromptInputActionMenuContent,ic as PromptInputActionMenuItem,gc as PromptInputActionMenuTrigger,$b as PromptInputBody,ec as PromptInputButton,xc as PromptInputCommand,Ac as PromptInputCommandEmpty,Bc as PromptInputCommandGroup,yc as PromptInputCommandInput,Cc as PromptInputCommandItem,zc as PromptInputCommandList,Dc as PromptInputCommandSeparator,cc as PromptInputFooter,bc as PromptInputHeader,pc as PromptInputHoverCard,rc as PromptInputHoverCardContent,qc as PromptInputHoverCardTrigger,Ub as PromptInputProvider,kc as PromptInputSelect,mc as PromptInputSelectContent,nc as PromptInputSelectItem,lc as PromptInputSelectTrigger,oc as PromptInputSelectValue,jc as PromptInputSubmit,tc as PromptInputTab,vc as PromptInputTabBody,wc as PromptInputTabItem,uc as PromptInputTabLabel,sc as PromptInputTabsList,ac as PromptInputTextarea,dc as PromptInputTools,Gc as Reasoning,Ic as ReasoningContent,Hc 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,Ec as Shimmer,ba as Sidebar,V as SidebarContent,W as SidebarGroup,Y as SidebarGroupContent,X as SidebarGroupLabel,U as SidebarInset,Z as SidebarMenu,$ as SidebarMenuButton,_ as SidebarMenuItem,R as SidebarPanel,Q as SidebarProvider,T as SidebarRail,S as SidebarTrigger,Mc as Source,Jc as Sources,Lc as SourcesContent,Kc as SourcesTrigger,Nc as SpeechInput,ya as Spinner,Pc as Suggestion,Oc as Suggestions,ca as Switch,da as Table,fa as TableBody,ka as TableCaption,ja as TableCell,ga as TableFooter,ia as TableHead,ea as TableHeader,ha as TableRow,la as Tabs,oa as TabsContent,ma as TabsList,na as TabsTrigger,pa as Textarea,ua as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,Qc as Tool,Tc as ToolContent,Sc as ToolHeader,Uc as ToolInput,Vc as ToolOutput,L as Tooltip,O as TooltipContent,N as TooltipPortal,K as TooltipProvider,M as TooltipTrigger,Ga as getAttachmentLabel,Fa as getMediaCategory,Rc as getStatusBadge,Ra as highlightCode,hb as messagesToMarkdown,ta as toast,a as toggleVariants,Ia as useAttachmentContext,Ha as useAttachmentsContext,i as useFormField,Vb as usePromptInputAttachments,Sb as usePromptInputController,Xb as usePromptInputReferencedSources,Tb as useProviderAttachments,Fc as useReasoning,P as useSidebar}from'./chunk-YIGEER6B.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-ODORXGGY.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{d as Button,c as buttonVariants}from'./chunk-5DHOBLAE.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';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.2",
|
|
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",
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
"uuid": "^9.0.1",
|
|
158
158
|
"vaul": "1.1.2",
|
|
159
159
|
"zod": "4.4.3",
|
|
160
|
-
"@flexkit/
|
|
161
|
-
"@flexkit/
|
|
160
|
+
"@flexkit/agent-protocol": "^0.3.1",
|
|
161
|
+
"@flexkit/schema": "0.2.2"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
164
164
|
"react": "^19.0.0",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"test:performance": "tsup --config tests/performance.config.ts && node --test build/tests/list-performance.test.js build/tests/editor-preview.test.js",
|
|
186
186
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
187
187
|
"ui:add": "pnpm dlx shadcn@latest add",
|
|
188
|
-
"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",
|
|
188
|
+
"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",
|
|
189
189
|
"test:ai": "tsup --config tests/ai.config.ts && node --test build/tests/ai/*.test.js",
|
|
190
190
|
"test": "pnpm run test:core && pnpm run test:ai && pnpm run test:performance"
|
|
191
191
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-LQVZWFM2.js';import {f as f$1,b,c,g as g$1,a as a$1,e,d as d$1}from'./chunk-CSUHZFEP.js';import {i,l,s,j,d as d$2,r,o,m,f as f$2,g as g$2,e as e$1,k,q,t,p}from'./chunk-BURKG2UC.js';import {g,f,a as a$2}from'./chunk-HROHAMPM.js';import'./chunk-ZBI744KS.js';import'./chunk-NNA4MLFC.js';import {Mb,L,M,S,O,eb,fb,hb,Kb,Sb,Vb,Tb,Ub,Wb,Xb,Zb,_b,$b,Qb,cc,dc,gc,ec,fc,Fc,bc,Nb,ya}from'./chunk-QHDL6CA2.js';import {v,c as c$1,h,k as k$1,f as f$3}from'./chunk-ODORXGGY.js';import'./chunk-SZEGGBOC.js';import {d}from'./chunk-5DHOBLAE.js';import'./chunk-HDOIOXMP.js';import'./chunk-O2QMYUPS.js';import {useRef,useMemo,useState,useEffect,useCallback}from'react';import {LoaderCircle,CheckIcon,CopyIcon,PencilIcon,CornerDownRightIcon,FileIcon,XIcon}from'lucide-react';import {useParams,useNavigate}from'react-router-dom';import V,{useSWRConfig}from'swr';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ae=20*1024*1024,kt=10,vt=new Set(["css","csv","gif","gql","graphql","htm","html","jpeg","jpg","js","json","jsx","log","markdown","md","mjs","ndjson","pdf","png","py","sql","ts","tsv","tsx","txt","webp","xml","yaml","yml"]),At=new Set(["application/pdf","image/gif","image/jpeg","image/png","image/webp"]),Ct=[...[...vt].map(e=>`.${e}`),...At].join(",");function yt(e){let t=e.lastIndexOf(".");return t<=0?"":e.slice(t+1).toLowerCase()}function Jt(e){let t=yt(e.name);return (t?vt.has(t):At.has(e.type))?e.size===0?`"${e.name}" is empty.`:e.size>ae?`"${e.name}" exceeds the ${String(Math.round(ae/(1024*1024)))} MB limit.`:null:`"${e.name}" is not supported. Attach images, PDFs, or text files.`}async function qt(e){let n=await(await fetch(e.url)).blob();return new File([n],e.filename??"file",{type:e.mediaType||n.type})}function bt(e,t){let{attachments:n}=Kb(),a=useRef({}),[,r]=useState(0),o=useCallback(()=>r(w=>w+1),[]),d=useRef(n.remove);d.current=n.remove;let m=useRef(t);m.current=t,useEffect(()=>{let w=new Set(n.files.map(l=>l.id));for(let[l,g]of Object.entries(a.current))w.has(l)||(g.controller.abort(),delete a.current[l]);for(let l of n.files){if(a.current[l.id])continue;let g=new AbortController,b={controller:g,status:"uploading"};a.current[l.id]=b,(async()=>{try{let y=await qt(l),M=Jt(y);if(M)throw new Error(M);let h=await e.uploadAgentChatAttachment(y,g.signal);if(g.signal.aborted)return;b.attachment=h,b.status="done";}catch(y){if(g.signal.aborted)return;b.status="error",delete a.current[l.id],d.current(l.id),m.current(y instanceof Error?y.message:"The file could not be uploaded.");}finally{o();}})();}o();},[e,n.files,o]);let N=Object.values(a.current).some(w=>w.status==="uploading");return {getUploaded:w=>w.map(l=>a.current[l]?.attachment).filter(l=>!!l),isUploading:N,isUploadingFile:w=>a.current[w]?.status==="uploading"}}function ye(e){return !!e?.startsWith("image/")}function St({image:e,onClose:t}){return jsx(c$1,{onOpenChange:n=>n?void 0:t(),open:e!==null,children:jsxs(h,{className:"fk:h-dvh fk:w-dvw fk:max-w-none fk:sm:max-w-none fk:rounded-none fk:border-0 fk:bg-black/90 fk:p-4 fk:shadow-none fk:flex fk:items-center fk:justify-center fk:corner-squircle",showCloseButton:false,children:[jsx(k$1,{className:"fk:sr-only",children:e?.filename??"Image preview"}),e?jsx("img",{alt:e.filename,className:"fk:block fk:h-auto fk:w-auto fk:max-h-full fk:max-w-full fk:object-contain",src:e.url}):null,jsx(f$3,{"aria-label":"Close preview",className:"fk:absolute fk:top-4 fk:right-4 fk:flex fk:size-9 fk:items-center fk:justify-center fk:rounded-full fk:bg-white/10 fk:text-white fk:transition-colors fk:hover:bg-white/20 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-white/60 fk:corner-squircle",children:jsx(XIcon,{className:"fk:size-5"})})]})})}function wt({label:e,onRemove:t}){return jsx("button",{"aria-label":e,className:"fk:absolute fk:top-1 fk:right-1 fk:z-10 fk:flex fk:size-5 fk:items-center fk:justify-center fk:rounded-full fk:border fk:border-border fk:bg-background fk:text-foreground fk:shadow-sm fk:transition-colors fk:hover:bg-accent fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:corner-squircle",onClick:n=>{n.stopPropagation(),t();},type:"button",children:jsx(XIcon,{className:"fk:size-3"})})}function xt({image:e,isUploading:t=false,onOpen:n,onRemove:a,sizeClassName:r}){return jsxs("div",{className:`fk:relative fk:shrink-0 fk:overflow-hidden fk:rounded-xl fk:bg-muted ${r} fk:corner-squircle`,children:[jsx("button",{"aria-label":`Preview ${e.filename}`,className:"fk:block fk:size-full fk:cursor-zoom-in fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring",onClick:n,type:"button",children:jsx("img",{alt:e.filename,className:"fk:size-full fk:object-cover",src:e.url})}),t?jsx("div",{className:"fk:pointer-events-none fk:absolute fk:inset-0 fk:flex fk:items-center fk:justify-center fk:bg-background/60",children:jsx(ya,{className:"fk:size-4"})}):null,a?jsx(wt,{label:`Remove ${e.filename}`,onRemove:a}):null]})}function Gt(e,t){let n=yt(e);if(n)return n.toUpperCase();let a=t?.split("/")[1]?.split("+")[0];return a?a.toUpperCase():"FILE"}function Mt({file:e,href:t,isUploading:n=false,onRemove:a}){let r=jsxs(Fragment,{children:[jsx("div",{className:"fk:flex fk:size-10 fk:shrink-0 fk:items-center fk:justify-center fk:rounded-lg fk:bg-muted fk:text-muted-foreground fk:corner-squircle",children:n?jsx(ya,{className:"fk:size-4"}):jsx(FileIcon,{className:"fk:size-5"})}),jsxs("div",{className:"fk:min-w-0 fk:pr-4 fk:text-left",children:[jsx("div",{className:"fk:truncate fk:text-sm fk:font-medium fk:text-foreground",children:e.filename}),jsx("div",{className:"fk:truncate fk:text-xs fk:text-muted-foreground",children:Gt(e.filename,e.mediaType)})]})]}),o="fk:flex fk:h-14 fk:max-w-64 fk:items-center fk:gap-2.5 fk:rounded-xl fk:border fk:border-border fk:bg-background fk:px-2 fk:corner-squircle";return jsxs("div",{className:"fk:relative fk:shrink-0",children:[t?jsx("a",{className:`${o} fk:transition-colors fk:hover:bg-accent/50 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring`,href:t,rel:"noreferrer",target:"_blank",children:r}):jsx("div",{className:o,children:r}),a?jsx(wt,{label:`Remove ${e.filename}`,onRemove:a}):null]})}function Tt({uploads:e}){let t=Nb(),[n,a]=useState(null);return t.files.length===0?null:jsxs(Fragment,{children:[jsx("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:t.files.map(r=>{if(ye(r.mediaType)&&r.url){let o={filename:r.filename??"Image",url:r.url};return jsx(xt,{image:o,isUploading:e.isUploadingFile(r.id),onOpen:()=>a(o),onRemove:()=>t.remove(r.id),sizeClassName:"fk:size-14"},r.id)}return jsx(Mt,{file:{filename:r.filename??"file",mediaType:r.mediaType},isUploading:e.isUploadingFile(r.id),onRemove:()=>t.remove(r.id)},r.id)})}),jsx(St,{image:n,onClose:()=>a(null)})]})}function It(e){return Array.isArray(e)?e.filter(t=>t.type==="file"&&typeof t.url=="string").map(t=>({filename:t.filename??"file",mediaType:t.mediaType??"application/octet-stream",sizeBytes:t.sizeBytes??0,url:t.url??""})):[]}function Pt({attachments:e}){let[t,n]=useState(null);if(e.length===0)return null;let a=e.filter(o=>ye(o.mediaType)),r=e.filter(o=>!ye(o.mediaType));return jsxs("div",{className:"fk:flex fk:flex-col fk:items-end fk:gap-2",children:[a.length>0?jsx("div",{className:"fk:flex fk:flex-wrap fk:justify-end fk:gap-2",children:a.map(o=>jsx(xt,{image:o,onOpen:()=>n(o),sizeClassName:"fk:size-24"},o.url))}):null,jsx(St,{image:t,onClose:()=>n(null)}),r.length>0?jsx("div",{className:"fk:flex fk:flex-wrap fk:justify-end fk:gap-2",children:r.map(o=>jsx(Mt,{file:o,href:o.url},o.url))}):null]})}function Nt(e,t){let n=Date.parse(e.createdAt)-Date.parse(t.createdAt);return Number.isFinite(n)&&n!==0?n:e.createdAt!==t.createdAt?e.createdAt<t.createdAt?-1:1:e.id===t.id?0:e.id<t.id?-1:1}function re(e){return [...new Map(e.map(n=>[n.id,n])).values()].sort(Nt)}function Se(e,t){if(!t)return e;if(!e)return t;let n=new Set(t.messages.map(o=>o.id)),a=t.messages[t.messages.length-1],r=e.messages.filter(o=>!n.has(o.id)&&(!a||Nt(o,a)>0));return r.length===0?t:{...t,messages:re([...t.messages,...r])}}var sn=6e4;function Me(e){return e==="pending"||e==="streaming"||e==="awaiting_approval"}function an(e){if(!e)return 0;let t=e.messages[e.messages.length-1];if(t&&t.role==="assistant"&&Me(t.status))return j;if(!e.messages.some(r=>r.role==="assistant"&&r.status==="complete"))return 0;let a=new Date(e.chat.lastMessageAt??e.chat.updatedAt).getTime();return Date.now()-a<sn?j:0}function rn(e,t,n){return {chat:{createdAt:n,id:e,lastMessageAt:n,modelId:t,title:null,updatedAt:n},messages:[],pendingApproval:null}}function on(e,t,n,a,r,o){return e||(t?{chat:t,messages:[],pendingApproval:null}:n||rn(a,r,o))}function ln(e,t){let n=new Set([t.userMessage.id,t.assistantMessage.id]);return {...e,messages:[...e.messages.filter(a=>!n.has(a.id)),t.userMessage,t.assistantMessage]}}function fn(e,t,n){return t?Se(e[t],n):n}function un(e){return e==="awaiting_approval"?"awaiting_approval":e==="complete"?"success":e==="failed"?"failed":"running"}function Dt({attachments:e=[],text:t}){let{textInput:n}=Kb(),[a,r]=useState(false),o=t.trim().length>0;async function d$1(){await navigator.clipboard.writeText(t),r(true),setTimeout(()=>r(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(Pt,{attachments:e}),o?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:t}):null,jsxs("div",{className:o?"fk:flex fk:gap-0.5 fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100":"fk:hidden",children:[jsxs(L,{children:[jsx(M,{asChild:true,children:jsx(d,{"aria-label":"Copy prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>{d$1();},children:a?jsx(CheckIcon,{className:"fk:size-3.5"}):jsx(CopyIcon,{className:"fk:size-3.5"})})}),jsx(O,{children:"Copy"})]}),jsxs(L,{children:[jsx(M,{asChild:true,children:jsx(d,{"aria-label":"Edit prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>n.setInput(t),children:jsx(PencilIcon,{className:"fk:size-3.5"})})}),jsx(O,{children:"Edit"})]})]})]})}function _t(e){let n=e.find(a=>a.type==="data-suggested-prompt")?.data?.prompt;return typeof n=="string"&&n.trim()?n:null}function Ut({prompt:e}){let{textInput:t}=Kb();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 cn({api:e,part:t,partIndex:n,parts:a}){return t.type.startsWith("tool-")?t.state==="output-error"?jsx(r,{message:t.errorText??"The tool call failed."}):null:jsx(q,{api:e,part:t,partIndex:n,parts:a})}function dn({api:e,message:t,showSuggestion:n=false}){if(t.role==="user")return jsx(Dt,{attachments:It(t.parts),text:t.textContent});let a=(Array.isArray(t.parts)?t.parts:[]).filter(d=>!d$2(d)&&!(d.type.startsWith("tool-")&&d.state!=="output-error")),r$1=a.some(d=>d.type==="data-turn-error"),o=n&&!t.error?_t(a):null;return a.length===0&&!t.error?null:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[a.map((d,m)=>jsx(cn,{api:e,part:d,partIndex:m,parts:a},d.toolCallId??`${t.id}-${m.toString()}`)),t.error&&!r$1?jsx(r,{message:t.error}):null,o?jsx(Ut,{prompt:o}):null]})}function gn({api:e,chatId:t$1,detail:n,message:a,onStatusChange:r,onTurnUpdated:o$1}){let d=un(a.status),m$1=a.workflowRunId?e.getAgentChatStreamUrl(t$1,a.workflowRunId):"",[N,w]=useState(0),[l,g]=useState(false),[b,y]=useState({}),M=useRef(null),{message:h,status:S}=o(m$1,{decidedApprovals:b,recordStatus:d,resumeToken:N,suppressApprovalPause:l}),P=useMemo(()=>h?[{...h,parts:h.parts.filter(u=>!d$2(u))}]:[],[h]),_=m(P),j=useRef(o$1);j.current=o$1;let R=useRef(r);R.current=r;let p$1=useMemo(()=>({onApprovalDecided:(u,C)=>{u&&C&&C!=="pending"&&y(k=>({...k,[u]:C})),!(u&&M.current===u)&&(u&&(M.current=u),g(true),w(k=>k+1),j.current());}}),[]);useEffect(()=>{w(0),g(false),M.current=null,y({});},[a.id]),useEffect(()=>{l&&a.status==="streaming"&&g(false);},[a.status,l]),useEffect(()=>{(S==="finished"||S==="paused")&&j.current();},[S]);let U=!l&&a.status!=="streaming"&&(a.status==="awaiting_approval"||S==="paused"||f$2(h)),B=useMemo(()=>new Set(g$2(h)),[h]),f=n.pendingApproval&&!B.has(n.pendingApproval.id)?n.pendingApproval:null,E=h?.parts[h.parts.length-1],T=E?.type==="text"&&E.state==="streaming",x=U?"Awaiting approval":e$1(h)??"Thinking",O=U?S!=="finished"&&S!=="error":S==="streaming"&&!T;useEffect(()=>{R.current({label:x,visible:O});},[x,O]);let J=!!f&&U,i=S==="finished"?_t(_.flatMap(u=>u.parts)):null;return _.length===0&&!J?jsx(k.Provider,{value:p$1,children:null}):jsx(k.Provider,{value:p$1,children:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[_.map(u=>jsx("div",{className:"fk:space-y-8 fk:min-w-0",children:u.parts.map((C,k)=>jsx(q,{api:e,part:C,partIndex:k,parts:u.parts},k))},u.id)),f&&J?jsx(t,{api:e,message:p(f)}):null,i?jsx(Ut,{prompt:i}):null]})})}function pn({api:e$1,effort:t,modelKey:n,modelPending:a,models:r,onEffortChange:o,onError:d,onModelChange:m,onSend:N,onStop:w,sending:l,streaming:g}){let{attachments:b$1,textInput:y}=Kb(),M=bt(e$1,d),h=useRef(false),S=r.filter(f=>!f.deprecated||b(f)===n),P=c(r,n),_=e(P),j=d$1(P,t),R=g?"streaming":l?"submitted":void 0,p=l||g,B=(y.value.trim().length>0||b$1.files.length>0)&&!M.isUploading&&!p&&!a;return jsxs(Sb,{accept:Ct,className:"fk:mx-auto fk:max-w-4xl",maxFileSize:ae,maxFiles:kt,multiple:true,onError:f=>d(f.message),onSubmit:({text:f})=>{let E=f?.trim()??"",T=M.getUploaded(b$1.files.map(x=>x.id));return !E&&T.length===0||M.isUploading||p||h.current||a?Promise.reject(new Error("The message cannot be sent right now.")):(h.current=true,y.clear(),N(E,T).catch(x=>{throw y.setInput(f),x}).finally(()=>{h.current=false;}))},children:[b$1.files.length>0?jsx(Vb,{children:jsx(Tt,{uploads:M})}):null,jsx(Tb,{children:jsx(Ub,{disabled:p,placeholder:"Ask the agent anything about your project..."})}),jsxs(Wb,{children:[jsxs(Xb,{children:[jsxs(Zb,{children:[jsx(_b,{"aria-label":"Add attachments",disabled:p,tooltip:"Add photos or files"}),jsx($b,{children:jsx(Qb,{})})]}),S.length>0?jsxs(cc,{value:n??void 0,onValueChange:m,children:[jsx(dc,{"aria-label":"Model",className:"fk:min-w-44",children:jsx(gc,{placeholder:"Model"})}),jsx(ec,{children:S.map(f=>jsx(fc,{value:b(f),children:f.name},b(f)))})]}):null,_.length>1&&j?jsxs(cc,{value:j,onValueChange:o,children:[jsx(dc,{"aria-label":"Reasoning effort",className:"fk:min-w-28",children:jsx(gc,{placeholder:"Effort"})}),jsx(ec,{children:_.map(f=>jsx(fc,{value:f.value,children:f.label},f.value))})]}):null]}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[jsx(Fc,{disabled:p,onAudioRecorded:async(f,E)=>{let{text:T}=await e$1.transcribeAgentAudio(f,E);return T},onError:f=>d(f.message),onTranscriptionChange:f=>{d(null),y.setInput(a$2(y.value,f));}}),jsx(bc,{disabled:!p&&!B,status:R,onStop:()=>{w();}})]})]})]})}var we={chatId:null,error:null,loading:false,older:[],page:null};function mn({api:e,chatId:t,projectId:n,pendingMessage:a,resolveDetail:r}){let{data:o,mutate:d$1}=V(t?g(n).agentChat(t):null,f,{refreshInterval:0}),m=r(o),[N,w]=useState(we),l=N.chatId===t?N:we,g$1=useRef(t);g$1.current=t;let b=(i,u)=>w(C=>{if(C.chatId!==i&&g$1.current!==i)return C;let k=C.chatId===i?C:{...we,chatId:i};return {...k,...u(k)}}),y=useRef({chatId:null,messages:[]}),M=m?.messages;useEffect(()=>{let i=y.current,u=M??[];if(y.current={chatId:t,messages:u},!t||i.chatId!==t)return;let C=new Set(u.map(I=>I.id)),k=i.messages.filter(I=>!C.has(I.id));k.length>0&&b(t,I=>({older:re([...I.older,...k])}));},[t,M]);let h=new Set(m?.messages.map(i=>i.id)??[]),S=[...l.older.filter(i=>!h.has(i.id)),...m?.messages??[]],P=useRef(m);P.current=m;let _=useRef(void 0);V(t?`${g(n).agentChat(t)}?view=status`:null,f,{refreshInterval:()=>an(P.current),onSuccess:i=>{let u=JSON.stringify(i),C=_.current;_.current=u;let{current:k}=P,I=k?.messages.at(-1);(C&&C!==u||I&&i.latestMessage&&(I.id!==i.latestMessage.id||I.status!==i.latestMessage.status||I.workflowRunId!==i.latestMessage.workflowRunId||k?.chat.updatedAt!==i.chat.updatedAt))&&d$1();}});let j=async()=>{let i=l.page?.cursor??m?.nextCursor;if(!t||!i||l.loading)return;let u=t;b(u,()=>({error:null,loading:true}));try{let C=await f(`${g(n).agentChat(u)}?before=${encodeURIComponent(i)}`);b(u,k=>({loading:!1,older:re([...C.messages,...k.older]),page:{cursor:C.nextCursor??null,hasMore:C.hasMore??!1}}));}catch{b(u,()=>({error:"Could not load earlier messages. Try again.",loading:false}));}},R=S[S.length-1],p=R&&R.role==="assistant"&&Me(R.status)?R:null,U=p?S.slice(0,-1):S,[B,f$1]=useState(null),E=p&&B?.messageId===p.id?B.status:null;if(t&&!m&&!a)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 T=!!a||!!p,x=[...U].reverse().find(i=>i.role==="assistant")?.id??null,O=p?E?.label??"Thinking":"Sending",J=p?E?.visible??true:true;return jsxs(eb,{className:"fk:h-0 fk:min-h-0 fk:flex-1",children:[jsx(fb,{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:[l.page?.hasMore??m?.hasMore?jsx(d,{variant:"ghost",disabled:l.loading,onClick:()=>{j();},children:l.loading?"Loading\u2026":"Load earlier messages"}):null,l.error?jsx("p",{role:"alert",children:l.error}):null,U.map(i=>jsx(dn,{api:e,message:i,showSuggestion:!T&&i.id===x},i.id)),p&&t&&m?jsx(gn,{api:e,chatId:t,detail:m,message:p,onStatusChange:i=>f$1({messageId:p.id,status:i}),onTurnUpdated:()=>{d$1();}}):null,a&&!p?jsx(Dt,{attachments:a.attachments,text:a.text}):null,T?jsx(s,{label:O,visible:J}):null]})}),jsx(hb,{})]})}var Rt=["Where should we begin?","Ready when you are","What\u2019s on the agenda today?","What\u2019s on your mind today?"];function hn(e){return [`How can I help, ${e}?`,`Good to see you, ${e}.`,`Hey, ${e}. Ready to dive in?`]}function kn(e){let t=e?[...Rt,...hn(e)]:Rt;return t[Math.floor(Math.random()*t.length)]??"How can I help?"}var zt="flexkit-ai:lastModelId",xe="flexkit-ai:lastEffort";function vn(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(zt);return e?{effort:localStorage.getItem(xe),modelKey:e}:null}catch{return null}}function An(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 Cn(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(zt,e.modelKey),e.effort?localStorage.setItem(xe,e.effort):localStorage.removeItem(xe);}catch{}}function yn({projectId:e}){let{data:t,isLoading:n}=V(g(e).agentProfile(),f),a=useMemo(()=>n?null:kn(t?.preferredName??null),[t,n]);return jsxs("div",{className:"fk:flex fk:flex-1 fk:flex-col fk:items-center fk:justify-center fk:gap-3 fk:text-center",children:[jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:a??"\xA0"}),jsx("p",{className:"fk:max-w-md fk:text-sm fk:text-muted-foreground",children:"Ask about your project data, run analyses, or propose changes. The agent works with your own role and space access, and every data change needs your approval."})]})}function Kn(){let{api:e,projectId:t}=i(),{chatId:n}=useParams(),a$2=useNavigate(),r=a(),{mutate:o}=useSWRConfig(),{data:d}=V(t?g(t).tools():null,f),{data:m}=V(t&&n?g(t).agentChat(n):null,f),N=useRef({});function w(v){return fn(N.current,n,v)}let l$1=w(m),g$2=useMemo(()=>d?.tools.models??[],[d]),[b$1,y]=useState(null),[M$1,h]=useState(null),S$1=useRef(null),[P,_]=useState(vn),[j,R]=useState(false),p=useRef(false),[U,B]=useState(null),f$2=U&&U.chatId===n?U:void 0,[E,T]=useState(null),x=l$1?.chat.modelId??null,O$1=!!n&&l$1===void 0,J=useMemo(()=>f$1(x,g$2)??(x?{effort:null,modelKey:x}:null),[x,g$2]),i$1=useMemo(()=>{let v=g$2.find(Q=>!Q.deprecated);return v?b(v):null},[g$2]),u=useMemo(()=>{let v=c(g$2,P?.modelKey??null);return P&&v&&!v.deprecated?P:null},[g$2,P]),{effort:C,modelKey:k}=An({awaitingChatModel:O$1,chatSelection:J,defaultModelKey:i$1,lastUsed:u,selectedEffort:M$1,selectedModelKey:b$1}),I=k?g$1({effort:C,modelKey:k},g$2):null,Te=O$1&&!b$1;useEffect(()=>{S$1.current=null,y(null),h(null),T(null);},[n]),useEffect(()=>{b$1===a$1&&x&&x!==a$1&&x!==S$1.current&&(y(null),h(null));},[x,b$1]);function Ie(v){_(v),Cn(v);}function jt(v){S$1.current=v===a$1?x:null,y(v),h(null),Ie({effort:null,modelKey:v});}function Bt(v){h(v),k&&Ie({effort:v,modelKey:k});}if(!t||!e)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 G=e,oe=t,le=l$1?.messages[l$1.messages.length-1],Ft=!!(le&&le.role==="assistant"&&Me(le.status));async function Kt(v,Q){if(p.current)throw new Error("A message is already being sent.");if(Te)throw new Error("This chat is still loading.");p.current=true,R(true),B({attachments:Q,chatId:n,text:v}),T(null);try{let K=n?null:(await G.createAgentChat({modelId:I})).chat,Y=n??K.id,Pe=await G.sendAgentChatMessage(Y,{attachments:Q,content:v,modelId:I});await o(g(oe).agentChat(Y),Ot=>{let Ee=ln(on(Se(N.current[Y],Ot),K,m,Y,I,Pe.userMessage.createdAt),Pe);return N.current[Y]=Ee,Ee},{revalidate:!1}),K&&a$2(`${r}/chats/${K.id}`),B(null);}catch(K){throw B(null),T(K instanceof Error?K.message:"Failed to send the message."),K}finally{p.current=false,R(false);}}async function Lt(){if(n)try{await G.stopAgentChat(n);}catch(v){T(v instanceof Error?v.message:"Failed to stop the turn.");}finally{await o(g(oe).agentChat(n));}}return jsx(Mb,{children: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(L,{children:[jsx(M,{asChild:true,children:jsx(S,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(O,{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:n?l$1?.chat.title?.trim()??"Chat":"Agent"})})]}),jsx("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:gap-4",children:jsxs("div",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-3",children:[n||f$2?jsx(l.Provider,{value:true,children:jsx(mn,{api:G,chatId:n??null,pendingMessage:f$2,projectId:t,resolveDetail:w})}):jsx(yn,{projectId:oe}),jsxs("div",{className:"fk:shrink-0 fk:pb-3",children:[E?jsx("p",{className:"fk:mx-auto fk:mb-2 fk:max-w-4xl fk:text-xs fk:text-destructive",children:E}):null,jsx(pn,{api:G,effort:C,modelKey:k,modelPending:Te,models:g$2,sending:j,streaming:Ft,onEffortChange:Bt,onError:T,onModelChange:jt,onSend:Kt,onStop:Lt})]})]})})]})})}export{Kn as AgentChatPage};//# sourceMappingURL=chat-page-H6I3XOKS.js.map
|
|
2
|
-
//# sourceMappingURL=chat-page-H6I3XOKS.js.map
|