import { type ReactNode } from "react"; /** Map a filename to a grammar key (or null for plain text — still fully editable). */ export declare function languageForPath(path: string): string | null; export type CodeEditorProps = { /** Workspace-relative path — drives language inference (and the save target upstream). */ path: string; /** The decoded text contents to seed the editor with. */ initialContents: string; /** * Persist the current buffer against the exact contents it was edited from. * The second argument is the immutable compare-and-swap baseline; hosts must * not replace it with a newer remote snapshot or concurrent writes can be * silently overwritten. */ onSave: (contents: string, expectedContents: string) => Promise; /** Explicitly overwrite after a visible expected-content conflict. */ onOverwrite?: ((contents: string) => Promise) | undefined; /** Re-read the selected file after a visible save conflict. */ onReload?: (() => void) | undefined; /** Fired once when the buffer FIRST diverges from its baseline (the first real * keystroke) — the wake-on-edit intent. The host warms the box on this so the * eventual save lands fast; merely opening the file for reading never fires it. */ onEditIntent?: (() => void) | undefined; /** Read-only mode (e.g. a truncated/too-large file shown for reference only). */ readOnly?: boolean | undefined; themeType?: "dark" | "light" | undefined; /** Rendered while the (lazy) CodeMirror bundle loads. */ loading?: ReactNode | undefined; /** Rendered if `@uiw/react-codemirror` is not installed / fails to import. */ fallback?: ReactNode | undefined; className?: string | undefined; }; export type EditorBufferState = { path: string; value: string; baseline: string; }; /** * Reconcile a remote file snapshot without destroying unsaved local work. * * A different path is a new document and always resets. For the same path, a * clean editor follows the remote snapshot while a dirty editor retains both * its local value and the original CAS baseline. The eventual save will then * either succeed against that baseline or surface a typed conflict. */ export declare function reconcileEditorBuffer(current: EditorBufferState, incoming: { path: string; contents: string; }): EditorBufferState; /** * The EDITABLE single-file pane: CodeMirror 6 with a per-language grammar chosen * from the filename, og-* themed, with dirty tracking and a save path wired to * `Cmd/Ctrl+S` *and* an explicit Save button. The viewer (Pierre `File`) stays * the read-only complement — this is only mounted when the user opts to edit. * * Save semantics: the buffer is "dirty" the moment it diverges from the last * saved baseline; a successful `onSave` clears dirty and re-baselines. A failed * save keeps the buffer dirty (nothing is lost) and surfaces the error inline. * `readOnly` suppresses every mutation path so a truncated/binary file can never * be saved back (which would corrupt it by writing the truncated prefix). */ export declare function CodeEditor({ path, initialContents, onSave, onOverwrite, onReload, onEditIntent, readOnly, themeType, loading, fallback, className, }: CodeEditorProps): import("react").JSX.Element;