import type { Component } from "svelte"; import { Editor } from "@tiptap/core"; import { type LoadingNodeViewState, type PromptEditorConfig } from "@pixerate/editor"; type MaybeGetter = T | (() => T); export interface UsePromptEditorProps extends PromptEditorConfig { /** Optional DOM element to mount the editor into (or use `mount()` / `use:prompt.action`). */ element?: HTMLElement; /** * Svelte component drawn inside each `loadingNode` placeholder instead of the default SVG spinner, * e.g. your design system's loader. It receives `view` (`id`, `label`). Read when a * placeholder renders, so changing it does not recreate the editor. */ loadingIndicator?: Component<{ view: LoadingNodeViewState; }>; } export interface SveltePromptEditor { /** The active TipTap `Editor` instance (reactive). */ readonly editor: Editor | null; /** Alias for `editor` (matches `createReactiveEditor`). */ readonly current: Editor | null; /** Mounts the editor DOM into `element`. */ mount(element: HTMLElement): Editor | null; /** Svelte action (`use:prompt.action`) that mounts the editor DOM into `node`. */ action(node: HTMLElement): { destroy(): void; }; /** Destroys the editor instance. */ destroy(): void; } /** * Reactive prompt editor for Svelte 5 (the counterpart of React's `usePromptEditor`). * Manages plain-text serialization, animated gradient tokens, `{{template}}` autocomplete, * `/command` slash triggers, milestone tracking (`used_variable`, `used_magic`), * plain-text clipboard handling, and custom `loadingNode` indicators without recreating * the editor when content, editability, placeholder, className, or inline `templateColorMap` * references update. * * Pass a getter `() => ({ content, onContentChange, ... })` to react to prop/state updates. */ export declare function usePromptEditor(props: MaybeGetter): SveltePromptEditor; export declare const createPromptEditor: typeof usePromptEditor; export {};