import { ComponentType, PuptElement } from './types'; /** * Custom component registration for browser environments. * * In browser environments, dynamically evaluated code can only import from URLs * that the import map knows about. For custom components that aren't published * to npm, you can pass them here and reference them by name in your source. * * @example * ```typescript * const element = await createPromptFromSource(source, 'test.prompt', { * components: { * MyHeader: MyHeaderComponent, * CustomCard: CustomCardComponent, * } * }); * ``` * * Then in your source: * ```tsx * * Title * Content * * ``` */ export interface CreatePromptOptions { /** * Custom components to make available in the evaluated source. * Keys are component names, values are component classes. * * In browser environments, this is the primary way to use custom components * that aren't published to npm. */ components?: Record; } /** * Prefix used for per-invocation globalThis keys. * @internal */ export declare const CUSTOM_COMPONENTS_PREFIX = "__PUPT_CC_"; /** * Create a PuptElement from a TSX source string. * Transforms the JSX and evaluates it to produce an element tree. * * For .prompt files or raw JSX without imports, built-in component imports * are automatically injected. * * For .tsx files with imports, the source is used as-is. * * @param source - TSX source code * @param filename - Filename for error messages and source maps * @param options - Optional configuration * @returns The default export as a PuptElement * * @example * ```typescript * // .tsx file with imports * const source = ` * import { Prompt, Role } from '@pupt/lib'; * export default ( * * Assistant * * ); * `; * const element = await createPromptFromSource(source, 'test.tsx'); * ``` * * @example * ```typescript * // .prompt file (auto-imports built-in components) * const source = ` * * Assistant * * `; * const element = await createPromptFromSource(source, 'test.prompt'); * ``` * * @example * ```typescript * // Using custom components in browser environments * const source = ` * * Welcome * * `; * const element = await createPromptFromSource(source, 'test.prompt', { * components: { * MyCustomHeader: MyCustomHeaderComponent, * } * }); * ``` */ export declare function createPromptFromSource(source: string, filename: string, options?: CreatePromptOptions): Promise; /** * Create a PuptElement by loading and transforming a TSX file. * Reads the file, transforms the JSX, and evaluates it. * * @param filePath - Path to the TSX file * @param options - Optional configuration * @returns The default export as a PuptElement * * @example * ```typescript * const element = await createPrompt('./prompts/greeting.tsx'); * const result = render(element, { inputs: { name: 'World' } }); * ``` */ export declare function createPrompt(filePath: string, options?: CreatePromptOptions): Promise; //# sourceMappingURL=create-prompt.d.ts.map