import type { ExtractPropTypes, PropType, SlotsType } from 'vue'; import type { ComponentThemeVars } from '@yh-ui/theme'; export type ArtifactType = 'code' | 'html' | 'markdown' | 'react' | 'vue' | 'diagram' | 'chart' | 'sandbox' | 'canvas' | 'echarts' | 'image' | 'video' | 'audio' | 'pdf' | 'text' | 'iframe' | (string & {}); export interface ArtifactVersion { /** * 版本号或标识 */ version: number | string; /** * 内容源码 */ content: string; /** * 该版本的更新说明 */ description?: string; /** * 时间戳 */ timestamp?: string | number; } /** ECharts 图表配置 */ export interface ArtifactEChartsOption { /** 图表类型 */ chartType: 'line' | 'bar' | 'pie' | 'scatter' | 'gauge' | 'radar' | 'funnel' | 'treemap' | 'sunburst' | 'heatmap' | 'candlestick' | 'boxplot' | 'sankey' | 'themeRiver' | 'graph' | 'custom'; /** ECharts 配置项 */ option: Record; /** 主题 */ theme?: 'light' | 'dark' | 'default'; /** 是否启用数据缩放 */ dataZoom?: boolean; /** 是否显示工具栏 */ toolbox?: boolean; /** 是否可交互 */ interactive?: boolean; } export interface ArtifactData { /** * 唯一标识 */ id: string; /** * 文件名或标题 */ title: string; /** * 类型 */ type: ArtifactType; /** * 当前选中的版本号 */ currentVersion?: number | string; /** * 版本历史 */ versions: ArtifactVersion[]; /** * ECharts 配置(仅 chart/echarts 类型使用) */ echartsOption?: ArtifactEChartsOption; } export declare const aiArtifactsProps: { /** * 是否显示侧边栏 */ visible: { type: BooleanConstructor; default: boolean; }; /** * 正在展示的 Artifact 数据 */ data: { type: PropType; }; /** * 侧边栏宽度 */ width: { type: PropType; default: string; }; /** * 是否全屏展示 */ fullscreen: { type: BooleanConstructor; default: boolean; }; /** * 渲染模式:preview (预览) | code (源码) | inline (行内/嵌入) */ mode: { type: PropType<"preview" | "code" | "inline">; default: string; }; /** * 主题覆盖变量 */ themeOverrides: { type: PropType; default: undefined; }; /** * ECharts 图表配置(用于 chart/echarts 类型) */ echartsOption: { type: PropType; default: undefined; }; /** * 是否自动加载 ECharts 库 */ autoLoadECharts: { type: BooleanConstructor; default: boolean; }; /** * ECharts 主题 */ echartsTheme: { type: PropType<"light" | "dark" | "default">; default: string; }; /** * 是否启用数据缩放 */ echartsDataZoom: { type: BooleanConstructor; default: boolean; }; /** * 是否显示工具栏 */ echartsToolbox: { type: BooleanConstructor; default: boolean; }; /** * 图表高度 */ chartHeight: { type: (StringConstructor | NumberConstructor)[]; default: number; }; /** * 是否响应式宽度 */ responsiveWidth: { type: BooleanConstructor; default: boolean; }; /** * 加载时显示的占位符 */ chartLoadingText: { type: StringConstructor; default: undefined; }; /** * Vue SFC 沙箱渲染器使用的 yh-ui bundle URL。 * 默认使用 esm.sh CDN(会自动打包 @yh-ui/icons 等所有依赖,只需外部化 vue)。 * 消费端可传入自托管的 bundle 地址,文档站可通过 provide('yhSandboxYhUiUrl', ...) 全局覆盖。 * * @example '/assets/yh-ui-sandbox-bundle.js' * @default 'https://esm.sh/@yh-ui/yh-ui?external=vue' */ sandboxYhUiUrl: { type: StringConstructor; default: undefined; }; /** * Vue SFC 沙箱渲染器使用的 yh-ui CSS URL。 * * @example '/assets/yh-ui-bundle.css' * @default 'https://unpkg.com/@yh-ui/yh-ui/dist/style.css' */ sandboxYhUiCssUrl: { type: StringConstructor; default: undefined; }; }; export type AiArtifactsProps = ExtractPropTypes; export declare const aiArtifactsEmits: { 'update:visible': (_val: boolean) => boolean; 'update:mode': (_val: "preview" | "code" | "inline") => boolean; 'version-change': (_version: ArtifactVersion) => boolean; 'chart-click': (_params: unknown) => boolean; 'chart-ready': (_chart: unknown) => boolean; 'chart-error': (_error: Error) => boolean; close: () => boolean; }; export type AiArtifactsEmits = typeof aiArtifactsEmits; export interface AiArtifactsSlots { chart?: (props: { data: ArtifactVersion | null; title: string; }) => unknown; canvas?: (props: { data: ArtifactVersion | null; }) => unknown; [key: string]: ((props: { data: ArtifactVersion | null; title: string; }) => unknown) | undefined; } export type AiArtifactsSlotTypes = SlotsType;