/** * [WHO]: Provides EditorComponentAdapter, EditorComponentContext — extension editor replacement * [FROM]: Depends on @catui/tui (Component/Container/TUI/EditorComponent/EditorTheme/ * CombinedAutocompleteProvider), keybindings (KeybindingsManager), components (CustomEditor), theme * [TO]: Consumed by modes/interactive/interactive-mode.ts (held as `this.editorAdapter`; wired into * ExtensionUIContext.setEditorComponent; reset by resetExtensionUI) * [HERE]: modes/interactive/controllers/extension-ui/editor-component-adapter.ts — P5 extension-ui rewrite, host 4/4 (UI02, 纯搬) * * Owns ExtensionUIContext.setEditorComponent: swap the active editor for an extension-provided one * (or restore the default), preserving text, submit/change callbacks, appearance, autocomplete, and — * for CustomEditor subclasses — the app-level key/action handlers. The active editor reference is * mount state, so the adapter reads/writes it through the context (getEditor/setEditor). Behavior is * identical to the former InteractiveMode.setCustomEditorComponent (纯搬). */ import type { CombinedAutocompleteProvider, Container, EditorComponent, EditorTheme, TUI } from "@catui/tui"; import type { KeybindingsManager } from "../../../../core/platform/keybindings.js"; import type { CustomEditor } from "../../components/custom-editor.js"; /** Narrow capability seam: the active-editor reference + editor-shell the adapter swaps. */ export interface EditorComponentContext { getEditor(): EditorComponent; /** Swap the active editor reference (mount state). */ setEditor(editor: EditorComponent): void; getDefaultEditor(): CustomEditor; getEditorContainer(): Container; getUi(): TUI; getKeybindings(): KeybindingsManager; getAutocompleteProvider(): CombinedAutocompleteProvider | undefined; remountEditorShell(): void; } export declare class EditorComponentAdapter { private readonly ctx; constructor(ctx: EditorComponentContext); /** * Set a custom editor component from an extension. Pass undefined to restore the default editor. */ setComponent(factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => EditorComponent) | undefined): void; }