vue-codemirror6 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,719 +1,770 @@
1
- import { LanguageSupport } from '@codemirror/language';
2
- import { LintSource } from '@codemirror/lint';
3
- import { EditorSelection, EditorState, Extension, SelectionRange, StateField, Text as Text$1 } from '@codemirror/state';
4
- import { EditorView, KeyBinding, ViewUpdate } from '@codemirror/view';
5
- import { StyleSpec } from 'style-mod';
6
- import { App, PropType, Ref, ShallowRef, WritableComputedRef } from 'vue-demi';
7
-
8
- /** Build information meta data */
9
- export interface MetaInterface {
10
- /** Version */
11
- version: string;
12
- /** Build date */
13
- date: string;
14
- }
15
- export declare const Meta: MetaInterface;
16
- /** CodeMirror Component */
17
- declare const CodeMirror: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
18
- /** Model value */
19
- modelValue: {
20
- type: PropType<string | Text$1>;
21
- default: string;
22
- };
23
- /**
24
- * Theme
25
- *
26
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
27
- */
28
- theme: {
29
- type: PropType<Record<string, StyleSpec>>;
30
- default: () => {};
31
- };
32
- /** Dark Mode */
33
- dark: {
34
- type: BooleanConstructor;
35
- default: boolean;
36
- };
37
- /**
38
- * Use Basic Setup
39
- *
40
- * This will enable the basic setup for the editor.
41
- *
42
- * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
43
- */
44
- basic: {
45
- type: BooleanConstructor;
46
- default: boolean;
47
- };
48
- /**
49
- * Use Minimal Setup (The basic setting has priority.)
50
- *
51
- * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
52
- */
53
- minimal: {
54
- type: BooleanConstructor;
55
- default: boolean;
56
- };
57
- /**
58
- * Placeholder
59
- *
60
- * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
61
- */
62
- placeholder: {
63
- type: PropType<string | HTMLElement>;
64
- default: undefined;
65
- };
66
- /**
67
- * Line wrapping
68
- *
69
- * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
70
- *
71
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
72
- */
73
- wrap: {
74
- type: BooleanConstructor;
75
- default: boolean;
76
- };
77
- /**
78
- * Allow tab key indent.
79
- *
80
- * This will enable the tab key to indent the current line or selection.
81
- *
82
- * @see {@link https://codemirror.net/examples/tab/}
83
- */
84
- tab: {
85
- type: BooleanConstructor;
86
- default: boolean;
87
- };
88
- /**
89
- * Tab character
90
- *
91
- * This is the unit of indentation used when the editor is configured to indent with tabs.
92
- * It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
93
- *
94
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
95
- */
96
- indentUnit: {
97
- type: StringConstructor;
98
- default: undefined;
99
- };
100
- /**
101
- * Allow Multiple Selection.
102
- *
103
- * This allows the editor to have multiple selections at the same time.
104
- * This is useful for editing multiple parts of the document at once.
105
- * If this is set to true, the editor will allow multiple selections.
106
- * If this is set to false, the editor will only allow a single selection.
107
- *
108
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
109
- */
110
- allowMultipleSelections: {
111
- type: BooleanConstructor;
112
- default: boolean;
113
- };
114
- /**
115
- * Tab size
116
- *
117
- * This is the number of spaces that a tab character represents in the editor.
118
- * It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
119
- * If this is set to a number, the editor will use that number of spaces for each tab character.
120
- *
121
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
122
- */
123
- tabSize: {
124
- type: NumberConstructor;
125
- default: undefined;
126
- };
127
- /**
128
- * Set line break (separetor) char.
129
- *
130
- * This is the character that is used to separate lines in the editor.
131
- * It is used to determine the line break character when the editor is configured to use a specific line break character.
132
- *
133
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
134
- */
135
- lineSeparator: {
136
- type: StringConstructor;
137
- default: undefined;
138
- };
139
- /**
140
- * Readonly
141
- *
142
- * This is a CodeMirror Facet that allows you to set the editor to read-only mode.
143
- * When this is set to true, the editor will not allow any changes to be made to the document.
144
- * This is useful for displaying code that should not be edited, such as documentation or examples.
145
- * If this is set to false, the editor will allow changes to be made to the document.
146
- *
147
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
148
- */
149
- readonly: {
150
- type: BooleanConstructor;
151
- default: boolean;
152
- };
153
- /**
154
- * Disable input.
155
- *
156
- * This is the reversed value of the CodeMirror editable.
157
- * Similar to `readonly`, but setting this value to true disables dragging.
158
- *
159
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
160
- */
161
- disabled: {
162
- type: BooleanConstructor;
163
- default: boolean;
164
- };
165
- /**
166
- * Additional Extension
167
- *
168
- * You can use this to add any additional extensions that you want to use in the editor.
169
- *
170
- * @see {@link https://codemirror.net/docs/ref/#state.Extension}
171
- */
172
- extensions: {
173
- type: PropType<Extension[]>;
174
- default: () => never[];
175
- };
176
- /**
177
- * Language Phreses
178
- *
179
- * This is a CodeMirror Facet that allows you to define custom phrases for the editor.
180
- * It can be used to override default phrases or add new ones.
181
- * This is useful for translating the editor to different languages or for customizing the editor's UI.
182
- *
183
- * @see {@link https://codemirror.net/examples/translate/}
184
- */
185
- phrases: {
186
- type: PropType<Record<string, string>>;
187
- default: undefined;
188
- };
189
- /**
190
- * CodeMirror Language
191
- *
192
- * This is a CodeMirror Facet that allows you to define the language of the editor.
193
- * It can be used to enable syntax highlighting and other language-specific features.
194
- * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
195
- *
196
- * @see {@link https://codemirror.net/docs/ref/#language}
197
- */
198
- lang: {
199
- type: PropType<LanguageSupport>;
200
- default: undefined;
201
- };
202
- /**
203
- * CodeMirror Linter
204
- *
205
- * This is a CodeMirror Facet that allows you to define a linter for the editor.
206
- * It can be used to check the code for errors and warnings, and to provide feedback to the user.
207
- * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
208
- * This is useful for providing feedback to the user about the code they are writing.
209
- *
210
- * @see {@link https://codemirror.net/docs/ref/#lint.linter}
211
- */
212
- linter: {
213
- type: PropType<LintSource>;
214
- default: undefined;
215
- };
216
- /**
217
- * Linter Config
218
- *
219
- * This is a CodeMirror Facet that allows you to define the configuration for the linter.
220
- * It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
221
- * This is useful for providing feedback to the user about the code they are writing.
222
- *
223
- * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
224
- */
225
- linterConfig: {
226
- type: ObjectConstructor;
227
- default: () => {};
228
- };
229
- /**
230
- * Forces any linters configured to run when the editor is idle to run right away.
231
- *
232
- * This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
233
- *
234
- * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
235
- */
236
- forceLinting: {
237
- type: BooleanConstructor;
238
- default: boolean;
239
- };
240
- /**
241
- * Show Linter Gutter
242
- *
243
- * An area to 🔴 the lines with errors will be displayed.
244
- * This feature is not enabled if `linter` is not specified.
245
- *
246
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
247
- */
248
- gutter: {
249
- type: BooleanConstructor;
250
- default: boolean;
251
- };
252
- /**
253
- * Gutter Config
254
- *
255
- * This is a CodeMirror Facet that allows you to define the configuration for the gutter.
256
- * It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
257
- * This is useful for providing feedback to the user about the code they are writing.
258
- *
259
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
260
- */
261
- gutterConfig: {
262
- type: ObjectConstructor;
263
- default: undefined;
264
- };
265
- /**
266
- * Using tag
267
- */
268
- tag: {
269
- type: StringConstructor;
270
- default: string;
271
- };
272
- /**
273
- * Allows an external update to scroll the form.
274
- *
275
- * This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
276
- * If this is set to true, the editor will scroll to the position specified in the transaction.
277
- * If this is set to false, the editor will not scroll to the position specified in the transaction.
278
- *
279
- * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
280
- */
281
- scrollIntoView: {
282
- type: BooleanConstructor;
283
- default: boolean;
284
- };
285
- /**
286
- * Preserve the current scroll position on external updates.
287
- *
288
- * This keeps the editor's own scroll container from jumping when
289
- * `modelValue` is updated from outside the component.
290
- *
291
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView.scrollSnapshot}
292
- */
293
- preserveScrollPosition: {
294
- type: BooleanConstructor;
295
- default: boolean;
296
- };
297
- /**
298
- * Key map
299
- * This is a CodeMirror Facet that allows you to define custom key bindings.
300
- * It can be used to override default key bindings or add new ones.
301
- *
302
- * @see {@link https://codemirror.net/docs/ref/#view.keymap}
303
- */
304
- keymap: {
305
- type: PropType<KeyBinding[]>;
306
- default: () => never[];
307
- };
308
- }>, {
309
- editor: Ref<HTMLElement | undefined, HTMLElement | undefined>;
310
- view: ShallowRef<EditorView | undefined>;
311
- cursor: WritableComputedRef<number, number>;
312
- selection: WritableComputedRef<EditorSelection | undefined, EditorSelection | undefined>;
313
- focus: WritableComputedRef<boolean, boolean>;
314
- length: Ref<number, number>;
315
- json: WritableComputedRef<Record<string, StateField<unknown>> | undefined, Record<string, StateField<unknown>> | undefined>;
316
- diagnosticCount: Ref<number, number>;
317
- dom: HTMLElement | undefined;
318
- lint: () => void;
319
- forceReconfigure: () => void;
320
- getRange: (from?: number, to?: number) => string | undefined;
321
- getLine: (number: number) => string | undefined;
322
- lineCount: () => number;
323
- getCursor: () => number;
324
- listSelections: () => readonly SelectionRange[];
325
- getSelection: () => string;
326
- getSelections: () => string[];
327
- somethingSelected: () => boolean;
328
- replaceRange: (replacement: string | Text$1, from: number, to: number) => void;
329
- replaceSelection: (replacement: string | Text$1) => void;
330
- setCursor: (position: number) => void;
331
- setSelection: (anchor: number, head?: number) => void;
332
- setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
333
- extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
334
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
335
- /** Model Update */
336
- "update:modelValue": (_value?: string | Text$1) => true;
337
- /** CodeMirror ViewUpdate */
338
- update: (_value: ViewUpdate) => true;
339
- /** CodeMirror onReady */
340
- ready: (_value: {
341
- view: EditorView;
342
- state: EditorState;
343
- container: HTMLElement;
344
- }) => true;
345
- /** CodeMirror onFocus */
346
- focus: (_value: boolean) => true;
347
- /** State Changed */
348
- change: (_value: EditorState) => true;
349
- /** CodeMirror onDestroy */
350
- destroy: () => true;
351
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
352
- /** Model value */
353
- modelValue: {
354
- type: PropType<string | Text$1>;
355
- default: string;
356
- };
357
- /**
358
- * Theme
359
- *
360
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
361
- */
362
- theme: {
363
- type: PropType<Record<string, StyleSpec>>;
364
- default: () => {};
365
- };
366
- /** Dark Mode */
367
- dark: {
368
- type: BooleanConstructor;
369
- default: boolean;
370
- };
371
- /**
372
- * Use Basic Setup
373
- *
374
- * This will enable the basic setup for the editor.
375
- *
376
- * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
377
- */
378
- basic: {
379
- type: BooleanConstructor;
380
- default: boolean;
381
- };
382
- /**
383
- * Use Minimal Setup (The basic setting has priority.)
384
- *
385
- * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
386
- */
387
- minimal: {
388
- type: BooleanConstructor;
389
- default: boolean;
390
- };
391
- /**
392
- * Placeholder
393
- *
394
- * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
395
- */
396
- placeholder: {
397
- type: PropType<string | HTMLElement>;
398
- default: undefined;
399
- };
400
- /**
401
- * Line wrapping
402
- *
403
- * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
404
- *
405
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
406
- */
407
- wrap: {
408
- type: BooleanConstructor;
409
- default: boolean;
410
- };
411
- /**
412
- * Allow tab key indent.
413
- *
414
- * This will enable the tab key to indent the current line or selection.
415
- *
416
- * @see {@link https://codemirror.net/examples/tab/}
417
- */
418
- tab: {
419
- type: BooleanConstructor;
420
- default: boolean;
421
- };
422
- /**
423
- * Tab character
424
- *
425
- * This is the unit of indentation used when the editor is configured to indent with tabs.
426
- * It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
427
- *
428
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
429
- */
430
- indentUnit: {
431
- type: StringConstructor;
432
- default: undefined;
433
- };
434
- /**
435
- * Allow Multiple Selection.
436
- *
437
- * This allows the editor to have multiple selections at the same time.
438
- * This is useful for editing multiple parts of the document at once.
439
- * If this is set to true, the editor will allow multiple selections.
440
- * If this is set to false, the editor will only allow a single selection.
441
- *
442
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
443
- */
444
- allowMultipleSelections: {
445
- type: BooleanConstructor;
446
- default: boolean;
447
- };
448
- /**
449
- * Tab size
450
- *
451
- * This is the number of spaces that a tab character represents in the editor.
452
- * It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
453
- * If this is set to a number, the editor will use that number of spaces for each tab character.
454
- *
455
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
456
- */
457
- tabSize: {
458
- type: NumberConstructor;
459
- default: undefined;
460
- };
461
- /**
462
- * Set line break (separetor) char.
463
- *
464
- * This is the character that is used to separate lines in the editor.
465
- * It is used to determine the line break character when the editor is configured to use a specific line break character.
466
- *
467
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
468
- */
469
- lineSeparator: {
470
- type: StringConstructor;
471
- default: undefined;
472
- };
473
- /**
474
- * Readonly
475
- *
476
- * This is a CodeMirror Facet that allows you to set the editor to read-only mode.
477
- * When this is set to true, the editor will not allow any changes to be made to the document.
478
- * This is useful for displaying code that should not be edited, such as documentation or examples.
479
- * If this is set to false, the editor will allow changes to be made to the document.
480
- *
481
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
482
- */
483
- readonly: {
484
- type: BooleanConstructor;
485
- default: boolean;
486
- };
487
- /**
488
- * Disable input.
489
- *
490
- * This is the reversed value of the CodeMirror editable.
491
- * Similar to `readonly`, but setting this value to true disables dragging.
492
- *
493
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
494
- */
495
- disabled: {
496
- type: BooleanConstructor;
497
- default: boolean;
498
- };
499
- /**
500
- * Additional Extension
501
- *
502
- * You can use this to add any additional extensions that you want to use in the editor.
503
- *
504
- * @see {@link https://codemirror.net/docs/ref/#state.Extension}
505
- */
506
- extensions: {
507
- type: PropType<Extension[]>;
508
- default: () => never[];
509
- };
510
- /**
511
- * Language Phreses
512
- *
513
- * This is a CodeMirror Facet that allows you to define custom phrases for the editor.
514
- * It can be used to override default phrases or add new ones.
515
- * This is useful for translating the editor to different languages or for customizing the editor's UI.
516
- *
517
- * @see {@link https://codemirror.net/examples/translate/}
518
- */
519
- phrases: {
520
- type: PropType<Record<string, string>>;
521
- default: undefined;
522
- };
523
- /**
524
- * CodeMirror Language
525
- *
526
- * This is a CodeMirror Facet that allows you to define the language of the editor.
527
- * It can be used to enable syntax highlighting and other language-specific features.
528
- * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
529
- *
530
- * @see {@link https://codemirror.net/docs/ref/#language}
531
- */
532
- lang: {
533
- type: PropType<LanguageSupport>;
534
- default: undefined;
535
- };
536
- /**
537
- * CodeMirror Linter
538
- *
539
- * This is a CodeMirror Facet that allows you to define a linter for the editor.
540
- * It can be used to check the code for errors and warnings, and to provide feedback to the user.
541
- * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
542
- * This is useful for providing feedback to the user about the code they are writing.
543
- *
544
- * @see {@link https://codemirror.net/docs/ref/#lint.linter}
545
- */
546
- linter: {
547
- type: PropType<LintSource>;
548
- default: undefined;
549
- };
550
- /**
551
- * Linter Config
552
- *
553
- * This is a CodeMirror Facet that allows you to define the configuration for the linter.
554
- * It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
555
- * This is useful for providing feedback to the user about the code they are writing.
556
- *
557
- * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
558
- */
559
- linterConfig: {
560
- type: ObjectConstructor;
561
- default: () => {};
562
- };
563
- /**
564
- * Forces any linters configured to run when the editor is idle to run right away.
565
- *
566
- * This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
567
- *
568
- * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
569
- */
570
- forceLinting: {
571
- type: BooleanConstructor;
572
- default: boolean;
573
- };
574
- /**
575
- * Show Linter Gutter
576
- *
577
- * An area to 🔴 the lines with errors will be displayed.
578
- * This feature is not enabled if `linter` is not specified.
579
- *
580
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
581
- */
582
- gutter: {
583
- type: BooleanConstructor;
584
- default: boolean;
585
- };
586
- /**
587
- * Gutter Config
588
- *
589
- * This is a CodeMirror Facet that allows you to define the configuration for the gutter.
590
- * It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
591
- * This is useful for providing feedback to the user about the code they are writing.
592
- *
593
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
594
- */
595
- gutterConfig: {
596
- type: ObjectConstructor;
597
- default: undefined;
598
- };
599
- /**
600
- * Using tag
601
- */
602
- tag: {
603
- type: StringConstructor;
604
- default: string;
605
- };
606
- /**
607
- * Allows an external update to scroll the form.
608
- *
609
- * This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
610
- * If this is set to true, the editor will scroll to the position specified in the transaction.
611
- * If this is set to false, the editor will not scroll to the position specified in the transaction.
612
- *
613
- * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
614
- */
615
- scrollIntoView: {
616
- type: BooleanConstructor;
617
- default: boolean;
618
- };
619
- /**
620
- * Preserve the current scroll position on external updates.
621
- *
622
- * This keeps the editor's own scroll container from jumping when
623
- * `modelValue` is updated from outside the component.
624
- *
625
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView.scrollSnapshot}
626
- */
627
- preserveScrollPosition: {
628
- type: BooleanConstructor;
629
- default: boolean;
630
- };
631
- /**
632
- * Key map
633
- * This is a CodeMirror Facet that allows you to define custom key bindings.
634
- * It can be used to override default key bindings or add new ones.
635
- *
636
- * @see {@link https://codemirror.net/docs/ref/#view.keymap}
637
- */
638
- keymap: {
639
- type: PropType<KeyBinding[]>;
640
- default: () => never[];
641
- };
642
- }>> & Readonly<{
643
- onChange?: ((_value: EditorState) => any) | undefined;
644
- onFocus?: ((_value: boolean) => any) | undefined;
645
- "onUpdate:modelValue"?: ((_value?: string | Text$1 | undefined) => any) | undefined;
646
- onUpdate?: ((_value: ViewUpdate) => any) | undefined;
647
- onReady?: ((_value: {
648
- view: EditorView;
649
- state: EditorState;
650
- container: HTMLElement;
651
- }) => any) | undefined;
652
- onDestroy?: (() => any) | undefined;
653
- }>, {
654
- modelValue: string | Text$1;
655
- theme: Record<string, StyleSpec>;
656
- dark: boolean;
657
- basic: boolean;
658
- minimal: boolean;
659
- placeholder: string | HTMLElement;
660
- wrap: boolean;
661
- tab: boolean;
662
- indentUnit: string;
663
- allowMultipleSelections: boolean;
664
- tabSize: number;
665
- lineSeparator: string;
666
- readonly: boolean;
667
- disabled: boolean;
668
- extensions: Extension[];
669
- phrases: Record<string, string>;
670
- lang: LanguageSupport;
671
- linter: LintSource;
672
- linterConfig: Record<string, any>;
673
- forceLinting: boolean;
674
- gutter: boolean;
675
- gutterConfig: Record<string, any>;
676
- tag: string;
677
- scrollIntoView: boolean;
678
- preserveScrollPosition: boolean;
679
- keymap: KeyBinding[];
680
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
681
- declare const installCodeMirror: (app: App) => void;
682
- /** Public API exposed from the CodeMirror component instance.
683
- * Note: Vue 3 auto-unwraps refs on the component instance proxy,
684
- * so reactive refs appear as their underlying value types here.
685
- */
686
- export type CodeMirrorExposed = {
687
- editor: HTMLElement | undefined;
688
- view: EditorView | undefined;
689
- cursor: number;
690
- selection: EditorSelection | undefined;
691
- focus: boolean;
692
- length: number;
693
- json: Record<string, StateField<unknown>> | undefined;
694
- diagnosticCount: number;
695
- dom: Element | undefined;
696
- lint: () => void;
697
- forceReconfigure: () => void;
698
- getRange: (from?: number, to?: number) => string | undefined;
699
- getLine: (number: number) => string | undefined;
700
- lineCount: () => number;
701
- getCursor: () => number;
702
- listSelections: () => readonly SelectionRange[];
703
- getSelection: () => string;
704
- getSelections: () => string[];
705
- somethingSelected: () => boolean;
706
- replaceRange: (replacement: string | Text$1, from: number, to: number) => void;
707
- replaceSelection: (replacement: string | Text$1) => void;
708
- setCursor: (position: number) => void;
709
- setSelection: (anchor: number, head?: number) => void;
710
- setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
711
- extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
712
- };
713
-
714
- export {
715
- CodeMirror as default,
716
- installCodeMirror as install,
717
- };
718
-
719
- export {};
1
+ import { App } from 'vue-demi';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { DefineComponent } from 'vue';
5
+ import { EditorSelection } from '@codemirror/state';
6
+ import { EditorState } from '@codemirror/state';
7
+ import { EditorView } from '@codemirror/view';
8
+ import { Extension } from '@codemirror/state';
9
+ import { ExtractPropTypes } from 'vue';
10
+ import { KeyBinding } from '@codemirror/view';
11
+ import { LanguageSupport } from '@codemirror/language';
12
+ import { LintSource } from '@codemirror/lint';
13
+ import { PropType } from 'vue-demi';
14
+ import { PublicProps } from 'vue';
15
+ import { Ref } from 'vue-demi';
16
+ import { SelectionRange } from '@codemirror/state';
17
+ import { ShallowRef } from 'vue-demi';
18
+ import { StateField } from '@codemirror/state';
19
+ import type { StyleSpec } from 'style-mod';
20
+ import { Text as Text_2 } from '@codemirror/state';
21
+ import { ViewUpdate } from '@codemirror/view';
22
+ import { WritableComputedRef } from 'vue-demi';
23
+
24
+ /** CodeMirror Component */
25
+ declare const CodeMirror: DefineComponent<ExtractPropTypes< {
26
+ /** Model value */
27
+ modelValue: {
28
+ type: PropType<string | Text_2>;
29
+ default: string;
30
+ };
31
+ /**
32
+ * Theme
33
+ *
34
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
35
+ */
36
+ theme: {
37
+ type: PropType<Record<string, StyleSpec>>;
38
+ default: () => {};
39
+ };
40
+ /** Dark Mode */
41
+ dark: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ /**
46
+ * Use Basic Setup
47
+ *
48
+ * This will enable the basic setup for the editor.
49
+ *
50
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
51
+ */
52
+ basic: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ /**
57
+ * Use Minimal Setup (The basic setting has priority.)
58
+ *
59
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
60
+ */
61
+ minimal: {
62
+ type: BooleanConstructor;
63
+ default: boolean;
64
+ };
65
+ /**
66
+ * Placeholder
67
+ *
68
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
69
+ */
70
+ placeholder: {
71
+ type: PropType<string | HTMLElement>;
72
+ default: undefined;
73
+ };
74
+ /**
75
+ * Line wrapping
76
+ *
77
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
78
+ *
79
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
80
+ */
81
+ wrap: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ /**
86
+ * Allow tab key indent.
87
+ *
88
+ * This will enable the tab key to indent the current line or selection.
89
+ *
90
+ * @see {@link https://codemirror.net/examples/tab/}
91
+ */
92
+ tab: {
93
+ type: BooleanConstructor;
94
+ default: boolean;
95
+ };
96
+ /**
97
+ * Tab character
98
+ *
99
+ * This is the unit of indentation used when the editor is configured to indent with tabs.
100
+ * It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
101
+ *
102
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
103
+ */
104
+ indentUnit: {
105
+ type: StringConstructor;
106
+ default: undefined;
107
+ };
108
+ /**
109
+ * Allow Multiple Selection.
110
+ *
111
+ * This allows the editor to have multiple selections at the same time.
112
+ * This is useful for editing multiple parts of the document at once.
113
+ * If this is set to true, the editor will allow multiple selections.
114
+ * If this is set to false, the editor will only allow a single selection.
115
+ *
116
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
117
+ */
118
+ allowMultipleSelections: {
119
+ type: BooleanConstructor;
120
+ default: boolean;
121
+ };
122
+ /**
123
+ * Tab size
124
+ *
125
+ * This is the number of spaces that a tab character represents in the editor.
126
+ * It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
127
+ * If this is set to a number, the editor will use that number of spaces for each tab character.
128
+ *
129
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
130
+ */
131
+ tabSize: {
132
+ type: NumberConstructor;
133
+ default: undefined;
134
+ };
135
+ /**
136
+ * Set line break (separetor) char.
137
+ *
138
+ * This is the character that is used to separate lines in the editor.
139
+ * It is used to determine the line break character when the editor is configured to use a specific line break character.
140
+ *
141
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
142
+ */
143
+ lineSeparator: {
144
+ type: StringConstructor;
145
+ default: undefined;
146
+ };
147
+ /**
148
+ * Readonly
149
+ *
150
+ * This is a CodeMirror Facet that allows you to set the editor to read-only mode.
151
+ * When this is set to true, the editor will not allow any changes to be made to the document.
152
+ * This is useful for displaying code that should not be edited, such as documentation or examples.
153
+ * If this is set to false, the editor will allow changes to be made to the document.
154
+ *
155
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
156
+ */
157
+ readonly: {
158
+ type: BooleanConstructor;
159
+ default: boolean;
160
+ };
161
+ /**
162
+ * Disable input.
163
+ *
164
+ * This is the reversed value of the CodeMirror editable.
165
+ * Similar to `readonly`, but setting this value to true disables dragging.
166
+ *
167
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
168
+ */
169
+ disabled: {
170
+ type: BooleanConstructor;
171
+ default: boolean;
172
+ };
173
+ /**
174
+ * Additional Extension
175
+ *
176
+ * You can use this to add any additional extensions that you want to use in the editor.
177
+ *
178
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
179
+ */
180
+ extensions: {
181
+ type: PropType<Extension[]>;
182
+ default: () => never[];
183
+ };
184
+ /**
185
+ * Language Phreses
186
+ *
187
+ * This is a CodeMirror Facet that allows you to define custom phrases for the editor.
188
+ * It can be used to override default phrases or add new ones.
189
+ * This is useful for translating the editor to different languages or for customizing the editor's UI.
190
+ *
191
+ * @see {@link https://codemirror.net/examples/translate/}
192
+ */
193
+ phrases: {
194
+ type: PropType<Record<string, string>>;
195
+ default: undefined;
196
+ };
197
+ /**
198
+ * CodeMirror Language
199
+ *
200
+ * This is a CodeMirror Facet that allows you to define the language of the editor.
201
+ * It can be used to enable syntax highlighting and other language-specific features.
202
+ * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
203
+ *
204
+ * @see {@link https://codemirror.net/docs/ref/#language}
205
+ */
206
+ lang: {
207
+ type: PropType<LanguageSupport>;
208
+ default: undefined;
209
+ };
210
+ /**
211
+ * CodeMirror Linter
212
+ *
213
+ * This is a CodeMirror Facet that allows you to define a linter for the editor.
214
+ * It can be used to check the code for errors and warnings, and to provide feedback to the user.
215
+ * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
216
+ * This is useful for providing feedback to the user about the code they are writing.
217
+ *
218
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
219
+ */
220
+ linter: {
221
+ type: PropType<LintSource>;
222
+ default: undefined;
223
+ };
224
+ /**
225
+ * Linter Config
226
+ *
227
+ * This is a CodeMirror Facet that allows you to define the configuration for the linter.
228
+ * It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
229
+ * This is useful for providing feedback to the user about the code they are writing.
230
+ *
231
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
232
+ */
233
+ linterConfig: {
234
+ type: ObjectConstructor;
235
+ default: () => {};
236
+ };
237
+ /**
238
+ * Forces any linters configured to run when the editor is idle to run right away.
239
+ *
240
+ * This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
241
+ *
242
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
243
+ */
244
+ forceLinting: {
245
+ type: BooleanConstructor;
246
+ default: boolean;
247
+ };
248
+ /**
249
+ * Show Linter Gutter
250
+ *
251
+ * An area to 🔴 the lines with errors will be displayed.
252
+ * This feature is not enabled if `linter` is not specified.
253
+ *
254
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
255
+ */
256
+ gutter: {
257
+ type: BooleanConstructor;
258
+ default: boolean;
259
+ };
260
+ /**
261
+ * Gutter Config
262
+ *
263
+ * This is a CodeMirror Facet that allows you to define the configuration for the gutter.
264
+ * It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
265
+ * This is useful for providing feedback to the user about the code they are writing.
266
+ *
267
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
268
+ */
269
+ gutterConfig: {
270
+ type: ObjectConstructor;
271
+ default: undefined;
272
+ };
273
+ /**
274
+ * Using tag
275
+ */
276
+ tag: {
277
+ type: StringConstructor;
278
+ default: string;
279
+ };
280
+ /**
281
+ * Allows an external update to scroll the form.
282
+ *
283
+ * This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
284
+ * If this is set to true, the editor will scroll to the position specified in the transaction.
285
+ * If this is set to false, the editor will not scroll to the position specified in the transaction.
286
+ *
287
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
288
+ */
289
+ scrollIntoView: {
290
+ type: BooleanConstructor;
291
+ default: boolean;
292
+ };
293
+ /**
294
+ * Preserve the current scroll position on external updates.
295
+ *
296
+ * This keeps the editor's own scroll container from jumping when
297
+ * `modelValue` is updated from outside the component.
298
+ *
299
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView.scrollSnapshot}
300
+ */
301
+ preserveScrollPosition: {
302
+ type: BooleanConstructor;
303
+ default: boolean;
304
+ };
305
+ /**
306
+ * Key map
307
+ * This is a CodeMirror Facet that allows you to define custom key bindings.
308
+ * It can be used to override default key bindings or add new ones.
309
+ *
310
+ * @see {@link https://codemirror.net/docs/ref/#view.keymap}
311
+ */
312
+ keymap: {
313
+ type: PropType<KeyBinding[]>;
314
+ default: () => never[];
315
+ };
316
+ }>, {
317
+ editor: Ref<HTMLElement | undefined, HTMLElement | undefined>;
318
+ view: ShallowRef<EditorView | undefined>;
319
+ cursor: WritableComputedRef<number, number>;
320
+ selection: WritableComputedRef<EditorSelection | undefined, EditorSelection | undefined>;
321
+ focus: WritableComputedRef<boolean, boolean>;
322
+ length: Ref<number, number>;
323
+ json: WritableComputedRef<Record<string, StateField<unknown>> | undefined, Record<string, StateField<unknown>> | undefined>;
324
+ diagnosticCount: Ref<number, number>;
325
+ dom: HTMLElement | undefined;
326
+ lint: () => void;
327
+ forceReconfigure: () => void;
328
+ getRange: (from?: number, to?: number) => string | undefined;
329
+ getLine: (number: number) => string | undefined;
330
+ lineCount: () => number;
331
+ getCursor: () => number;
332
+ listSelections: () => readonly SelectionRange[];
333
+ getSelection: () => string;
334
+ getSelections: () => string[];
335
+ somethingSelected: () => boolean;
336
+ replaceRange: (replacement: string | Text_2, from: number, to: number) => void;
337
+ replaceSelection: (replacement: string | Text_2) => void;
338
+ setCursor: (position: number) => void;
339
+ setSelection: (anchor: number, head?: number) => void;
340
+ setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
341
+ extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
342
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
343
+ /** Model Update */
344
+ 'update:modelValue': (_value?: string | Text_2) => true;
345
+ /** CodeMirror ViewUpdate */
346
+ update: (_value: ViewUpdate) => true;
347
+ /** CodeMirror onReady */
348
+ ready: (_value: {
349
+ view: EditorView;
350
+ state: EditorState;
351
+ container: HTMLElement;
352
+ }) => true;
353
+ /** CodeMirror onFocus */
354
+ focus: (_value: boolean) => true;
355
+ /** State Changed */
356
+ change: (_value: EditorState) => true;
357
+ /** CodeMirror onDestroy */
358
+ destroy: () => true;
359
+ }, string, PublicProps, Readonly<ExtractPropTypes< {
360
+ /** Model value */
361
+ modelValue: {
362
+ type: PropType<string | Text_2>;
363
+ default: string;
364
+ };
365
+ /**
366
+ * Theme
367
+ *
368
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
369
+ */
370
+ theme: {
371
+ type: PropType<Record<string, StyleSpec>>;
372
+ default: () => {};
373
+ };
374
+ /** Dark Mode */
375
+ dark: {
376
+ type: BooleanConstructor;
377
+ default: boolean;
378
+ };
379
+ /**
380
+ * Use Basic Setup
381
+ *
382
+ * This will enable the basic setup for the editor.
383
+ *
384
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
385
+ */
386
+ basic: {
387
+ type: BooleanConstructor;
388
+ default: boolean;
389
+ };
390
+ /**
391
+ * Use Minimal Setup (The basic setting has priority.)
392
+ *
393
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
394
+ */
395
+ minimal: {
396
+ type: BooleanConstructor;
397
+ default: boolean;
398
+ };
399
+ /**
400
+ * Placeholder
401
+ *
402
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
403
+ */
404
+ placeholder: {
405
+ type: PropType<string | HTMLElement>;
406
+ default: undefined;
407
+ };
408
+ /**
409
+ * Line wrapping
410
+ *
411
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
412
+ *
413
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
414
+ */
415
+ wrap: {
416
+ type: BooleanConstructor;
417
+ default: boolean;
418
+ };
419
+ /**
420
+ * Allow tab key indent.
421
+ *
422
+ * This will enable the tab key to indent the current line or selection.
423
+ *
424
+ * @see {@link https://codemirror.net/examples/tab/}
425
+ */
426
+ tab: {
427
+ type: BooleanConstructor;
428
+ default: boolean;
429
+ };
430
+ /**
431
+ * Tab character
432
+ *
433
+ * This is the unit of indentation used when the editor is configured to indent with tabs.
434
+ * It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
435
+ *
436
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
437
+ */
438
+ indentUnit: {
439
+ type: StringConstructor;
440
+ default: undefined;
441
+ };
442
+ /**
443
+ * Allow Multiple Selection.
444
+ *
445
+ * This allows the editor to have multiple selections at the same time.
446
+ * This is useful for editing multiple parts of the document at once.
447
+ * If this is set to true, the editor will allow multiple selections.
448
+ * If this is set to false, the editor will only allow a single selection.
449
+ *
450
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
451
+ */
452
+ allowMultipleSelections: {
453
+ type: BooleanConstructor;
454
+ default: boolean;
455
+ };
456
+ /**
457
+ * Tab size
458
+ *
459
+ * This is the number of spaces that a tab character represents in the editor.
460
+ * It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
461
+ * If this is set to a number, the editor will use that number of spaces for each tab character.
462
+ *
463
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
464
+ */
465
+ tabSize: {
466
+ type: NumberConstructor;
467
+ default: undefined;
468
+ };
469
+ /**
470
+ * Set line break (separetor) char.
471
+ *
472
+ * This is the character that is used to separate lines in the editor.
473
+ * It is used to determine the line break character when the editor is configured to use a specific line break character.
474
+ *
475
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
476
+ */
477
+ lineSeparator: {
478
+ type: StringConstructor;
479
+ default: undefined;
480
+ };
481
+ /**
482
+ * Readonly
483
+ *
484
+ * This is a CodeMirror Facet that allows you to set the editor to read-only mode.
485
+ * When this is set to true, the editor will not allow any changes to be made to the document.
486
+ * This is useful for displaying code that should not be edited, such as documentation or examples.
487
+ * If this is set to false, the editor will allow changes to be made to the document.
488
+ *
489
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
490
+ */
491
+ readonly: {
492
+ type: BooleanConstructor;
493
+ default: boolean;
494
+ };
495
+ /**
496
+ * Disable input.
497
+ *
498
+ * This is the reversed value of the CodeMirror editable.
499
+ * Similar to `readonly`, but setting this value to true disables dragging.
500
+ *
501
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
502
+ */
503
+ disabled: {
504
+ type: BooleanConstructor;
505
+ default: boolean;
506
+ };
507
+ /**
508
+ * Additional Extension
509
+ *
510
+ * You can use this to add any additional extensions that you want to use in the editor.
511
+ *
512
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
513
+ */
514
+ extensions: {
515
+ type: PropType<Extension[]>;
516
+ default: () => never[];
517
+ };
518
+ /**
519
+ * Language Phreses
520
+ *
521
+ * This is a CodeMirror Facet that allows you to define custom phrases for the editor.
522
+ * It can be used to override default phrases or add new ones.
523
+ * This is useful for translating the editor to different languages or for customizing the editor's UI.
524
+ *
525
+ * @see {@link https://codemirror.net/examples/translate/}
526
+ */
527
+ phrases: {
528
+ type: PropType<Record<string, string>>;
529
+ default: undefined;
530
+ };
531
+ /**
532
+ * CodeMirror Language
533
+ *
534
+ * This is a CodeMirror Facet that allows you to define the language of the editor.
535
+ * It can be used to enable syntax highlighting and other language-specific features.
536
+ * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
537
+ *
538
+ * @see {@link https://codemirror.net/docs/ref/#language}
539
+ */
540
+ lang: {
541
+ type: PropType<LanguageSupport>;
542
+ default: undefined;
543
+ };
544
+ /**
545
+ * CodeMirror Linter
546
+ *
547
+ * This is a CodeMirror Facet that allows you to define a linter for the editor.
548
+ * It can be used to check the code for errors and warnings, and to provide feedback to the user.
549
+ * It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
550
+ * This is useful for providing feedback to the user about the code they are writing.
551
+ *
552
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
553
+ */
554
+ linter: {
555
+ type: PropType<LintSource>;
556
+ default: undefined;
557
+ };
558
+ /**
559
+ * Linter Config
560
+ *
561
+ * This is a CodeMirror Facet that allows you to define the configuration for the linter.
562
+ * It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
563
+ * This is useful for providing feedback to the user about the code they are writing.
564
+ *
565
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
566
+ */
567
+ linterConfig: {
568
+ type: ObjectConstructor;
569
+ default: () => {};
570
+ };
571
+ /**
572
+ * Forces any linters configured to run when the editor is idle to run right away.
573
+ *
574
+ * This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
575
+ *
576
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
577
+ */
578
+ forceLinting: {
579
+ type: BooleanConstructor;
580
+ default: boolean;
581
+ };
582
+ /**
583
+ * Show Linter Gutter
584
+ *
585
+ * An area to 🔴 the lines with errors will be displayed.
586
+ * This feature is not enabled if `linter` is not specified.
587
+ *
588
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
589
+ */
590
+ gutter: {
591
+ type: BooleanConstructor;
592
+ default: boolean;
593
+ };
594
+ /**
595
+ * Gutter Config
596
+ *
597
+ * This is a CodeMirror Facet that allows you to define the configuration for the gutter.
598
+ * It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
599
+ * This is useful for providing feedback to the user about the code they are writing.
600
+ *
601
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
602
+ */
603
+ gutterConfig: {
604
+ type: ObjectConstructor;
605
+ default: undefined;
606
+ };
607
+ /**
608
+ * Using tag
609
+ */
610
+ tag: {
611
+ type: StringConstructor;
612
+ default: string;
613
+ };
614
+ /**
615
+ * Allows an external update to scroll the form.
616
+ *
617
+ * This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
618
+ * If this is set to true, the editor will scroll to the position specified in the transaction.
619
+ * If this is set to false, the editor will not scroll to the position specified in the transaction.
620
+ *
621
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
622
+ */
623
+ scrollIntoView: {
624
+ type: BooleanConstructor;
625
+ default: boolean;
626
+ };
627
+ /**
628
+ * Preserve the current scroll position on external updates.
629
+ *
630
+ * This keeps the editor's own scroll container from jumping when
631
+ * `modelValue` is updated from outside the component.
632
+ *
633
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView.scrollSnapshot}
634
+ */
635
+ preserveScrollPosition: {
636
+ type: BooleanConstructor;
637
+ default: boolean;
638
+ };
639
+ /**
640
+ * Key map
641
+ * This is a CodeMirror Facet that allows you to define custom key bindings.
642
+ * It can be used to override default key bindings or add new ones.
643
+ *
644
+ * @see {@link https://codemirror.net/docs/ref/#view.keymap}
645
+ */
646
+ keymap: {
647
+ type: PropType<KeyBinding[]>;
648
+ default: () => never[];
649
+ };
650
+ }>> & Readonly<{
651
+ onChange?: ((_value: EditorState) => any) | undefined;
652
+ onDestroy?: (() => any) | undefined;
653
+ onFocus?: ((_value: boolean) => any) | undefined;
654
+ onReady?: ((_value: {
655
+ view: EditorView;
656
+ state: EditorState;
657
+ container: HTMLElement;
658
+ }) => any) | undefined;
659
+ onUpdate?: ((_value: ViewUpdate) => any) | undefined;
660
+ "onUpdate:modelValue"?: ((_value?: string | Text_2 | undefined) => any) | undefined;
661
+ }>, {
662
+ modelValue: string | Text_2;
663
+ theme: Record<string, StyleSpec>;
664
+ dark: boolean;
665
+ basic: boolean;
666
+ minimal: boolean;
667
+ placeholder: string | HTMLElement;
668
+ wrap: boolean;
669
+ tab: boolean;
670
+ indentUnit: string;
671
+ allowMultipleSelections: boolean;
672
+ tabSize: number;
673
+ lineSeparator: string;
674
+ readonly: boolean;
675
+ disabled: boolean;
676
+ extensions: Extension[];
677
+ phrases: Record<string, string>;
678
+ lang: LanguageSupport;
679
+ linter: LintSource;
680
+ linterConfig: Record<string, any>;
681
+ forceLinting: boolean;
682
+ gutter: boolean;
683
+ gutterConfig: Record<string, any>;
684
+ tag: string;
685
+ scrollIntoView: boolean;
686
+ preserveScrollPosition: boolean;
687
+ keymap: KeyBinding[];
688
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
689
+ export default CodeMirror;
690
+
691
+ /**
692
+ * Public API exposed from the CodeMirror component instance.
693
+ *
694
+ * Note: Vue 3 auto-unwraps refs on the component instance proxy,
695
+ * so reactive refs appear as their underlying value types here.
696
+ */
697
+ export declare type CodeMirrorExposed = {
698
+ /** Editor DOM element. */
699
+ editor: HTMLElement | undefined;
700
+ /** CodeMirror Editor View. @see {@link https://codemirror.net/docs/ref/#view.EditorView} */
701
+ view: EditorView | undefined;
702
+ /** Cursor position. */
703
+ cursor: number;
704
+ /** Editor selection. @see {@link https://codemirror.net/docs/ref/#state.EditorSelection} */
705
+ selection: EditorSelection | undefined;
706
+ /** Whether the editor has focus. @see {@link https://codemirror.net/docs/ref/#view.EditorView.hasFocus} */
707
+ focus: boolean;
708
+ /** Document text length. */
709
+ length: number;
710
+ /** Serialized editor state. */
711
+ json: Record<string, StateField<unknown>> | undefined;
712
+ /** Number of active lint diagnostics. @see {@link https://codemirror.net/docs/ref/#lint.diagnosticCount} */
713
+ diagnosticCount: number;
714
+ /** Editor content DOM element. */
715
+ dom: Element | undefined;
716
+ /** Forces any linters configured to run when the editor is idle to run right away. */
717
+ lint: () => void;
718
+ /** Deconfigures and re-registers all extensions. @see {@link https://codemirror.net/examples/config/#top-level-reconfiguration} */
719
+ forceReconfigure: () => void;
720
+ /** Get the text between the given points in the editor. */
721
+ getRange: (from?: number, to?: number) => string | undefined;
722
+ /** Get the content of the given line. */
723
+ getLine: (number: number) => string | undefined;
724
+ /** Get the number of lines in the editor. */
725
+ lineCount: () => number;
726
+ /** Retrieve one end of the primary selection. */
727
+ getCursor: () => number;
728
+ /** Retrieves a list of all current selections. */
729
+ listSelections: () => readonly SelectionRange[];
730
+ /** Get the currently selected code. */
731
+ getSelection: () => string;
732
+ /** Get the currently selected code for every selection range. */
733
+ getSelections: () => string[];
734
+ /** Return true if any text is selected. */
735
+ somethingSelected: () => boolean;
736
+ /** Replace the part of the document between from and to with the given string. */
737
+ replaceRange: (replacement: string | Text_2, from: number, to: number) => void;
738
+ /** Replace the selection(s) with the given string. */
739
+ replaceSelection: (replacement: string | Text_2) => void;
740
+ /** Set the cursor position. */
741
+ setCursor: (position: number) => void;
742
+ /** Set a single selection range. */
743
+ setSelection: (anchor: number, head?: number) => void;
744
+ /** Sets a new set of selections. There must be at least one selection in the given array. */
745
+ setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
746
+ /** Applies the given function to all existing selections, and calls extendSelections on the result. */
747
+ extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
748
+ };
749
+
750
+ /**
751
+ * Vue plugin install function that registers the CodeMirror component globally.
752
+ *
753
+ * @param app - Vue application instance.
754
+ */
755
+ export declare const install: (app: App) => void;
756
+
757
+ /** Build information meta data */
758
+ export declare type Meta = {
759
+ /** Version */
760
+ version: string;
761
+ /** Build date */
762
+ date: string;
763
+ };
764
+
765
+ export declare const Meta: Meta = {
766
+ version: __APP_VERSION__,
767
+ date: __BUILD_DATE__,
768
+ };
769
+
770
+ export { }