/** * vue-codemirror6 * * @description CodeMirror6 Component for vue2 and vue3. * @author Logue * @license MIT * @version 1.7.0 * @see {@link https://github.com/logue/vue-codemirror6} */ import { App } from 'vue-demi'; import { ComponentOptionsMixin } from 'vue'; import { ComponentProvideOptions } from 'vue'; import { DefineComponent } from 'vue'; import { EditorSelection } from '@codemirror/state'; import { EditorState } from '@codemirror/state'; import type { EditorView } from '@codemirror/view'; import { EditorView as EditorView_2 } from 'codemirror'; import { Extension } from '@codemirror/state'; import { ExtractPropTypes } from 'vue'; import { KeyBinding } from '@codemirror/view'; import { LanguageSupport } from '@codemirror/language'; import { LintSource } from '@codemirror/lint'; import { PropType } from 'vue'; import { PublicProps } from 'vue'; import { Ref } from 'vue'; import { SelectionRange } from '@codemirror/state'; import { ShallowRef } from 'vue'; import { StateField } from '@codemirror/state'; import { StyleSpec } from 'style-mod'; import { Text as Text_2 } from '@codemirror/state'; import { ViewUpdate } from '@codemirror/view'; import { VueElementConstructor } from 'vue'; import { WritableComputedRef } from 'vue'; export declare const CodeMirror: VueElementConstructor; readonly default: ''; }; readonly theme: { readonly type: PropType>; readonly default: () => {}; }; readonly dark: { readonly type: BooleanConstructor; readonly default: false; }; readonly basic: { readonly type: BooleanConstructor; readonly default: false; }; readonly minimal: { readonly type: BooleanConstructor; readonly default: false; }; readonly placeholder: { readonly type: PropType; readonly default: undefined; }; readonly wrap: { readonly type: BooleanConstructor; readonly default: false; }; readonly tab: { readonly type: BooleanConstructor; readonly default: false; }; readonly indentUnit: { readonly type: StringConstructor; readonly default: undefined; }; readonly allowMultipleSelections: { readonly type: BooleanConstructor; readonly default: false; }; readonly tabSize: { readonly type: NumberConstructor; readonly default: undefined; }; readonly lineSeparator: { readonly type: StringConstructor; readonly default: undefined; }; readonly readonly: { readonly type: BooleanConstructor; readonly default: false; }; readonly disabled: { readonly type: BooleanConstructor; readonly default: false; }; readonly extensions: { readonly type: PropType; readonly default: () => never[]; }; readonly phrases: { readonly type: PropType>; readonly default: undefined; }; readonly lang: { readonly type: PropType; readonly default: undefined; }; readonly linter: { readonly type: PropType; readonly default: undefined; }; readonly linterConfig: { readonly type: ObjectConstructor; readonly default: () => {}; }; readonly forceLinting: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutter: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutterConfig: { readonly type: ObjectConstructor; readonly default: undefined; }; readonly tag: { readonly type: StringConstructor; readonly default: 'div'; }; readonly scrollIntoView: { readonly type: BooleanConstructor; readonly default: true; }; readonly preserveScrollPosition: { readonly type: BooleanConstructor; readonly default: false; }; readonly keymap: { readonly type: PropType; readonly default: () => never[]; }; }>>; /** * Public API exposed from the CodeMirror component instance. * * Note: Vue 3 auto-unwraps refs on the component instance proxy, * so reactive refs appear as their underlying value types here. */ export declare type CodeMirrorExposed = { /** Editor DOM element. */ editor: HTMLElement | undefined; /** CodeMirror Editor View. @see {@link https://codemirror.net/docs/ref/#view.EditorView} */ view: EditorView | undefined; /** Cursor position. */ cursor: number; /** Editor selection. @see {@link https://codemirror.net/docs/ref/#state.EditorSelection} */ selection: EditorSelection | undefined; /** Whether the editor has focus. @see {@link https://codemirror.net/docs/ref/#view.EditorView.hasFocus} */ focus: boolean; /** Document text length. */ length: number; /** Serialized editor state. */ json: Record> | undefined; /** Number of active lint diagnostics. @see {@link https://codemirror.net/docs/ref/#lint.diagnosticCount} */ diagnosticCount: number; /** Editor content DOM element. */ dom: Element | undefined; /** Forces any linters configured to run when the editor is idle to run right away. */ lint: () => void; /** Deconfigures and re-registers all extensions. @see {@link https://codemirror.net/examples/config/#top-level-reconfiguration} */ forceReconfigure: () => void; /** Get the text between the given points in the editor. */ getRange: (from?: number, to?: number) => string | undefined; /** Get the content of the given line. */ getLine: (number: number) => string | undefined; /** Get the number of lines in the editor. */ lineCount: () => number; /** Retrieve one end of the primary selection. */ getCursor: () => number; /** Retrieves a list of all current selections. */ listSelections: () => readonly SelectionRange[]; /** Get the currently selected code. */ getSelection: () => string; /** Get the currently selected code for every selection range. */ getSelections: () => string[]; /** Return true if any text is selected. */ somethingSelected: () => boolean; /** Replace the part of the document between from and to with the given string. */ replaceRange: (replacement: string | Text_2, from: number, to: number) => void; /** Replace the selection(s) with the given string. */ replaceSelection: (replacement: string | Text_2) => void; /** Set the cursor position. */ setCursor: (position: number) => void; /** Set a single selection range. */ setSelection: (anchor: number, head?: number) => void; /** Sets a new set of selections. There must be at least one selection in the given array. */ setSelections: (ranges: readonly SelectionRange[], primary?: number) => void; /** Applies the given function to all existing selections, and calls extendSelections on the result. */ extendSelectionsBy: (f: (range: SelectionRange) => number) => void; }; /** CodeMirror Component */ declare const component: DefineComponent; readonly default: ''; }; readonly theme: { readonly type: PropType>; readonly default: () => {}; }; readonly dark: { readonly type: BooleanConstructor; readonly default: false; }; readonly basic: { readonly type: BooleanConstructor; readonly default: false; }; readonly minimal: { readonly type: BooleanConstructor; readonly default: false; }; readonly placeholder: { readonly type: PropType; readonly default: undefined; }; readonly wrap: { readonly type: BooleanConstructor; readonly default: false; }; readonly tab: { readonly type: BooleanConstructor; readonly default: false; }; readonly indentUnit: { readonly type: StringConstructor; readonly default: undefined; }; readonly allowMultipleSelections: { readonly type: BooleanConstructor; readonly default: false; }; readonly tabSize: { readonly type: NumberConstructor; readonly default: undefined; }; readonly lineSeparator: { readonly type: StringConstructor; readonly default: undefined; }; readonly readonly: { readonly type: BooleanConstructor; readonly default: false; }; readonly disabled: { readonly type: BooleanConstructor; readonly default: false; }; readonly extensions: { readonly type: PropType; readonly default: () => never[]; }; readonly phrases: { readonly type: PropType>; readonly default: undefined; }; readonly lang: { readonly type: PropType; readonly default: undefined; }; readonly linter: { readonly type: PropType; readonly default: undefined; }; readonly linterConfig: { readonly type: ObjectConstructor; readonly default: () => {}; }; readonly forceLinting: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutter: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutterConfig: { readonly type: ObjectConstructor; readonly default: undefined; }; readonly tag: { readonly type: StringConstructor; readonly default: 'div'; }; readonly scrollIntoView: { readonly type: BooleanConstructor; readonly default: true; }; readonly preserveScrollPosition: { readonly type: BooleanConstructor; readonly default: false; }; readonly keymap: { readonly type: PropType; readonly default: () => never[]; }; }>, { editor: Ref; view: ShallowRef; cursor: WritableComputedRef; selection: WritableComputedRef; focus: WritableComputedRef; length: Ref; json: WritableComputedRef> | undefined, Record> | undefined>; diagnosticCount: Ref; dom: HTMLElement | undefined; lint: () => void; forceReconfigure: () => void; getRange: (from?: number, to?: number) => string | undefined; getLine: (number: number) => string | undefined; lineCount: () => number; getCursor: () => number; listSelections: () => readonly SelectionRange[]; getSelection: () => string; getSelections: () => string[]; somethingSelected: () => boolean; replaceRange: (replacement: string | Text_2, from: number, to: number) => void; replaceSelection: (replacement: string | Text_2) => void; setCursor: (position: number) => void; setSelection: (anchor: number, head?: number) => void; setSelections: (ranges: readonly SelectionRange[], primary?: number) => void; extendSelectionsBy: (f: (range: SelectionRange) => number) => void; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { 'update:modelValue': (_value?: string | Text_2) => boolean; update: (_value: ViewUpdate) => boolean; ready: (_value: { view: EditorView_2; state: EditorState; container: HTMLElement; }) => boolean; focus: (_value: boolean) => boolean; change: (_value: EditorState) => boolean; destroy: () => boolean; }, string, PublicProps, Readonly; readonly default: ''; }; readonly theme: { readonly type: PropType>; readonly default: () => {}; }; readonly dark: { readonly type: BooleanConstructor; readonly default: false; }; readonly basic: { readonly type: BooleanConstructor; readonly default: false; }; readonly minimal: { readonly type: BooleanConstructor; readonly default: false; }; readonly placeholder: { readonly type: PropType; readonly default: undefined; }; readonly wrap: { readonly type: BooleanConstructor; readonly default: false; }; readonly tab: { readonly type: BooleanConstructor; readonly default: false; }; readonly indentUnit: { readonly type: StringConstructor; readonly default: undefined; }; readonly allowMultipleSelections: { readonly type: BooleanConstructor; readonly default: false; }; readonly tabSize: { readonly type: NumberConstructor; readonly default: undefined; }; readonly lineSeparator: { readonly type: StringConstructor; readonly default: undefined; }; readonly readonly: { readonly type: BooleanConstructor; readonly default: false; }; readonly disabled: { readonly type: BooleanConstructor; readonly default: false; }; readonly extensions: { readonly type: PropType; readonly default: () => never[]; }; readonly phrases: { readonly type: PropType>; readonly default: undefined; }; readonly lang: { readonly type: PropType; readonly default: undefined; }; readonly linter: { readonly type: PropType; readonly default: undefined; }; readonly linterConfig: { readonly type: ObjectConstructor; readonly default: () => {}; }; readonly forceLinting: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutter: { readonly type: BooleanConstructor; readonly default: false; }; readonly gutterConfig: { readonly type: ObjectConstructor; readonly default: undefined; }; readonly tag: { readonly type: StringConstructor; readonly default: 'div'; }; readonly scrollIntoView: { readonly type: BooleanConstructor; readonly default: true; }; readonly preserveScrollPosition: { readonly type: BooleanConstructor; readonly default: false; }; readonly keymap: { readonly type: PropType; readonly default: () => never[]; }; }>> & Readonly<{ onChange?: ((_value: EditorState) => any) | undefined; onDestroy?: (() => any) | undefined; onFocus?: ((_value: boolean) => any) | undefined; onReady?: ((_value: { view: EditorView_2; state: EditorState; container: HTMLElement; }) => any) | undefined; onUpdate?: ((_value: ViewUpdate) => any) | undefined; "onUpdate:modelValue"?: ((_value?: string | Text_2 | undefined) => any) | undefined; }>, { readonly modelValue: string | Text_2; readonly theme: Record; readonly dark: boolean; readonly basic: boolean; readonly minimal: boolean; readonly placeholder: string | HTMLElement; readonly wrap: boolean; readonly tab: boolean; readonly indentUnit: string; readonly allowMultipleSelections: boolean; readonly tabSize: number; readonly lineSeparator: string; readonly readonly: boolean; readonly disabled: boolean; readonly extensions: Extension[]; readonly phrases: Record; readonly lang: LanguageSupport; readonly linter: LintSource; readonly linterConfig: Record; readonly forceLinting: boolean; readonly gutter: boolean; readonly gutterConfig: Record; readonly tag: string; readonly scrollIntoView: boolean; readonly preserveScrollPosition: boolean; readonly keymap: KeyBinding[]; }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>; export default component; /** * Vue plugin install function that registers the CodeMirror component globally. * * @param app - Vue application instance. */ export declare const install: (app: App) => void; /** Build information meta data */ export declare type Meta = { /** Version */ version: string; /** Build date */ date: string; }; export declare const Meta: Meta = { version: import.meta.env.APP_VERSION, date: import.meta.env.BUILD_DATE, }; export { }