import type { ComponentRenderer } from "@openuidev/react-lang"; import { type ReactNode } from "react"; import { type ArtifactPanelProps } from "../components/_shared/artifact"; /** * Controls injected into `preview` and `panel` render functions. */ export interface ArtifactControls { /** Whether this artifact is the currently active (visible) one. */ isActive: boolean; /** Activates this artifact. */ open: () => void; /** Deactivates this artifact. */ close: () => void; /** Toggles this artifact: opens if closed, closes if open. */ toggle: () => void; } /** * Configuration for {@link Artifact}. */ export interface ArtifactConfig

> { /** Panel title — static string or derived from props. */ title: string | ((props: P) => string); /** Renders the inline preview shown in the chat message. */ preview: (props: P, controls: ArtifactControls) => ReactNode; /** Renders the content inside the artifact side panel. */ panel: (props: P, controls: ArtifactControls) => ReactNode; /** Optional props forwarded to the underlying ``. */ panelProps?: Pick; } /** * Factory that returns a `ComponentRenderer

` wiring up `useId`, `useArtifact`, * and `` internally. Pass the result as `defineComponent`'s `component`. * * @example * ```tsx * export const ArtifactCodeBlock = defineComponent({ * name: "ArtifactCodeBlock", * props: ArtifactCodeBlockSchema, * description: "Code block that opens in the artifact side panel", * component: Artifact({ * title: (props) => props.title, * preview: (props, { open, isActive }) => ( * * ), * panel: (props) => ( * * ), * }), * }); * ``` */ export declare function Artifact

>(config: ArtifactConfig

): ComponentRenderer

; //# sourceMappingURL=Artifact.d.ts.map