import * as i0 from '@angular/core'; import { OnChanges, OnInit, OnDestroy, EventEmitter, SimpleChanges } from '@angular/core'; import * as _codemirror_state from '@codemirror/state'; import { Extension, EditorState } from '@codemirror/state'; import { ControlValueAccessor } from '@angular/forms'; import { LanguageDescription } from '@codemirror/language'; import { EditorView } from '@codemirror/view'; import { DiffConfig, MergeView } from '@codemirror/merge'; type Theme = 'light' | 'dark' | Extension; type Setup = 'basic' | 'minimal' | null; declare const External: _codemirror_state.AnnotationType; declare class CodeEditor implements OnChanges, OnInit, OnDestroy, ControlValueAccessor { private _elementRef; /** * EditorView's [root](https://codemirror.net/docs/ref/#view.EditorView.root). * * Don't support change dynamically! */ root?: Document | ShadowRoot; /** * Whether focus on the editor after init. * * Don't support change dynamically! */ autoFocus: boolean; /** The editor's value. */ value: string; /** Whether the editor is disabled. */ disabled: boolean; /** Whether the editor is readonly. */ readonly: boolean; /** The editor's theme. */ theme: Theme; /** The editor's placecholder. */ placeholder: string; /** Whether indent with Tab key. */ indentWithTab: boolean; /** Should be a string consisting either entirely of the same whitespace character. */ indentUnit: string; /** Whether the editor wraps lines. */ lineWrapping: boolean; /** Whether highlight the whitespace. */ highlightWhitespace: boolean; /** * An array of language descriptions for known * [language-data](https://github.com/codemirror/language-data/blob/main/src/language-data.ts). * * Don't support change dynamically! */ languages: LanguageDescription[]; /** The editor's language. You should set the `languages` prop at first. */ language: string; /** * The editor's built-in setup. The value can be set to * [`basic`](https://codemirror.net/docs/ref/#codemirror.basicSetup), * [`minimal`](https://codemirror.net/docs/ref/#codemirror.minimalSetup) or `null`. */ setup: Setup; /** * It will be appended to the root * [extensions](https://codemirror.net/docs/ref/#state.EditorStateConfig.extensions). */ extensions: Extension[]; /** Event emitted when the editor's value changes. */ change: EventEmitter; /** Event emitted when focus on the editor. */ focus: EventEmitter; /** Event emitted when the editor has lost focus. */ blur: EventEmitter; private _onChange; private _onTouched; /** * The instance of [EditorView](https://codemirror.net/docs/ref/#view.EditorView). */ view: EditorView; /** * The new state created by [EditorState](https://codemirror.net/docs/ref/#state.EditorState) */ state: EditorState; private _updateListener; private _editableConf; private _readonlyConf; private _themeConf; private _placeholderConf; private _indentWithTabConf; private _indentUnitConf; private _lineWrappingConf; private _highlightWhitespaceConf; private _languageConf; private _getAllExtensions; ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; ngOnDestroy(): void; writeValue(value: any): void; registerOnChange(fn: (value: string) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** Sets editor's value. */ setValue(value: string): void; private _dispatchEffects; /** Sets the root extensions of the editor. */ setExtensions(value: Extension[]): void; /** Sets editor's editable state. */ setEditable(value: boolean): void; /** Sets editor's readonly state. */ setReadonly(value: boolean): void; /** Sets editor's theme. */ setTheme(value: Theme): void; /** Sets editor's placeholder. */ setPlaceholder(value: string): void; /** Sets editor' indentWithTab. */ setIndentWithTab(value: boolean): void; /** Sets editor's indentUnit. */ setIndentUnit(value: string): void; /** Sets editor's lineWrapping. */ setLineWrapping(value: boolean): void; /** Sets editor's highlightWhitespace. */ setHighlightWhitespace(value: boolean): void; /** Sets editor's language dynamically. */ setLanguage(lang: string): void; /** Find the language's extension by its name. Case insensitive. */ private _findLanguage; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_autoFocus: unknown; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_readonly: unknown; static ngAcceptInputType_indentWithTab: unknown; static ngAcceptInputType_lineWrapping: unknown; static ngAcceptInputType_highlightWhitespace: unknown; } type Orientation = 'a-b' | 'b-a'; type RevertControls = 'a-to-b' | 'b-to-a'; type RenderRevertControl = () => HTMLElement; interface DiffEditorModel { original: string; modified: string; } declare class DiffEditor implements OnChanges, OnInit, OnDestroy, ControlValueAccessor { private _elementRef; /** * The editor's built-in setup. The value can be set to * [`basic`](https://codemirror.net/docs/ref/#codemirror.basicSetup), * [`minimal`](https://codemirror.net/docs/ref/#codemirror.minimalSetup) or `null`. * * Don't support change dynamically! */ setup: Setup; /** The diff-editor's original value. */ originalValue: string; /** * The MergeView original config's * [extensions](https://codemirror.net/docs/ref/#state.EditorStateConfig.extensions). * * Don't support change dynamically! */ originalExtensions: Extension[]; /** The diff-editor's modified value. */ modifiedValue: string; /** * The MergeView modified config's * [extensions](https://codemirror.net/docs/ref/#state.EditorStateConfig.extensions). * * Don't support change dynamically! */ modifiedExtensions: Extension[]; /** Controls whether editor A or editor B is shown first. Defaults to `"a-b"`. */ orientation?: Orientation; /** Controls whether revert controls are shown between changed chunks. */ revertControls?: RevertControls; /** When given, this function is called to render the button to revert a chunk. */ renderRevertControl?: RenderRevertControl; /** * By default, the merge view will mark inserted and deleted text * in changed chunks. Set this to false to turn that off. */ highlightChanges: boolean; /** Controls whether a gutter marker is shown next to changed lines. */ gutter: boolean; /** Whether the diff-editor is disabled. */ disabled: boolean; /** * When given, long stretches of unchanged text are collapsed. * `margin` gives the number of lines to leave visible after/before * a change (default is 3), and `minSize` gives the minimum amount * of collapsible lines that need to be present (defaults to 4). */ collapseUnchanged?: { margin?: number; minSize?: number; }; /** Pass options to the diff algorithm. */ diffConfig?: DiffConfig; /** Event emitted when the editor's original value changes. */ originalValueChange: EventEmitter; /** Event emitted when focus on the original editor. */ originalFocus: EventEmitter; /** Event emitted when blur on the original editor. */ originalBlur: EventEmitter; /** Event emitted when the editor's modified value changes. */ modifiedValueChange: EventEmitter; /** Event emitted when focus on the modified editor. */ modifiedFocus: EventEmitter; /** Event emitted when blur on the modified editor. */ modifiedBlur: EventEmitter; private _onChange; private _onTouched; /** The merge view instance. */ mergeView?: MergeView; private _updateListener; private _editableConf; ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; ngOnDestroy(): void; writeValue(value: DiffEditorModel): void; registerOnChange(fn: (value: DiffEditorModel) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** Sets diff-editor's value. */ setValue(editor: 'a' | 'b', value: string): void; /** Sets diff-editor's editable state. */ setEditable(editor: 'a' | 'b', value: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_highlightChanges: unknown; static ngAcceptInputType_gutter: unknown; static ngAcceptInputType_disabled: unknown; } declare class CodeEditorModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { CodeEditor, CodeEditorModule, DiffEditor, External }; export type { DiffEditorModel, Orientation, RenderRevertControl, RevertControls, Setup, Theme };