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 ` ` wiring up `useId`, `useArtifact`,
* and ` >(config: ArtifactConfig ): ComponentRenderer ;
//# sourceMappingURL=Artifact.d.ts.map