import { Dispatch, MutableRefObject, SetStateAction } from 'react'; import { CodeEditorV2Variant } from './codeEditorV2.types'; import { CodeEditorV2Tokens } from './codeEditorV2.tokens'; import { CSSObject } from 'styled-components'; import type * as Monaco from 'monaco-editor'; /** Delay before focusing the editor after mount (ms). */ export declare const EDITOR_FOCUS_DELAY_MS = 100; /** How long the “copied” state stays visible after copy (ms). */ export declare const COPY_FEEDBACK_RESET_MS = 2000; /** Minimum Monaco vertical/horizontal scrollbar thickness (px). */ export declare const MIN_SCROLLBAR_SIZE = 8; /** Ref must be stable across renders (e.g. from `useRef`) so timeout ids persist. */ export type CopyFeedbackTimeoutRef = MutableRefObject | null>; /** * Writes `code` to the clipboard, sets copied feedback to true, and schedules * resetting it after `resetMs`. Clears any previous reset timeout on the same ref. */ export declare const copyToClipboardWithTemporaryFeedback: (code: string, setIsCopied: Dispatch>, feedbackTimeoutRef: CopyFeedbackTimeoutRef, resetMs?: number) => void; export declare const shouldShowLineNumbers: (showLineNumbers: boolean | undefined, variant: CodeEditorV2Variant) => boolean; /** True when Monaco should render the diff editor (either explicit `diff` or `variant="diff"`). */ export declare const isDiffEditorMode: (diff: boolean | undefined, variant: CodeEditorV2Variant) => boolean; /** * Calculates container styles with min/max height */ export declare const getCodeEditorV2ContainerStyles: (minHeight?: string | number, maxHeight?: string | number) => React.CSSProperties; export declare const toCssValue: (value?: string | number) => string | undefined; export declare const toNumericValue: (value: string | number | undefined, fallback?: number) => number; export type EditorMetrics = { fontSize: number; lineHeight: number; verticalPadding: number; codePaddingLeft: number; gutterWidth: number; lineDecorationsWidth: number; lineNumbersMinChars: number; scrollbarSize: number; }; export declare function getEditorMetrics(tokens: CodeEditorV2Tokens, showLineNumbers: boolean): EditorMetrics; export declare function getContainerDimensions(height: CSSObject['height'] | undefined, minHeight: CSSObject['minHeight'], maxHeight?: CSSObject['maxHeight']): { minHeight?: CSSObject['minHeight']; maxHeight?: CSSObject['maxHeight']; height?: CSSObject['height']; }; export declare function getPlaceholderPosition(metrics: EditorMetrics, showLineNumbers: boolean): { top: string; left: string; }; export declare function configureLanguageDefaults(monaco: typeof import('monaco-editor')): void; /** Monaco `IEditor` has `focus()` but no `blur()` — clear focus on the editor subtree. */ export declare function blurMonacoEditorDom(editor: Monaco.editor.ICodeEditor): void; /** * Single place for “view only” vs editable: locks model + DOM (no edit tooltip), * empty read-only message, calmer code-block chrome, and restores IDE defaults when editable. */ export declare function getMonacoViewModeOptions(readOnly: boolean, disabled: boolean): Partial; /** Diff panes do not always inherit root options — push view mode + scrollbar to both sides. */ export declare function syncDiffEditorPaneViewMode(diffEditor: Monaco.editor.IStandaloneDiffEditor, readOnly: boolean, disabled: boolean): void; /** Options applied on editor mount (full set) */ export declare function getMountEditorOptions(metrics: EditorMetrics, tokens: CodeEditorV2Tokens, showLineNumbers: boolean, readOnly: boolean, disabled: boolean): Monaco.editor.IStandaloneEditorConstructionOptions; /** Options applied when props change (subset) */ export declare function getUpdateEditorOptions(metrics: EditorMetrics, showLineNumbers: boolean, readOnly: boolean, disabled: boolean): Monaco.editor.IEditorOptions; export declare function getDiffEditorOptions(metrics: EditorMetrics, tokens: CodeEditorV2Tokens, showLineNumbers: boolean, renderSideBySide: boolean, readOnly: boolean, disabled: boolean, isDiffUnchangedCollapsed: boolean, diffContextLines: number, diffExpandChunk: number): Monaco.editor.IDiffEditorConstructionOptions; export declare function getInitialEditorOptions(metrics: EditorMetrics, tokens: CodeEditorV2Tokens, showLineNumbers: boolean, readOnly: boolean, disabled: boolean): Monaco.editor.IStandaloneEditorConstructionOptions; export declare const backupColor: { body: { backgroundColor: string; gutter: { color: string; backgroundColor: { added: string; removed: string; unchanged: string; }; borderColor: { added: string; removed: string; unchanged: string; }; }; highlightedLine: { backgroundColor: string; }; }; header: { backgroundColor: string; }; };