vue-codemirror6 1.6.2 → 1.7.0

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.es.js CHANGED
@@ -4,17 +4,366 @@
4
4
  * @description CodeMirror6 Component for vue2 and vue3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @license MIT
7
- * @version 1.6.2
7
+ * @version 1.7.0
8
8
  * @see {@link https://github.com/logue/vue-codemirror6}
9
9
  */
10
10
 
11
+ import { computed, defineComponent, defineCustomElement, h, isVue2, nextTick, onMounted, onUnmounted, ref, shallowRef, watch } from "vue-demi";
11
12
  import { indentWithTab } from "@codemirror/commands";
12
13
  import { indentUnit } from "@codemirror/language";
13
14
  import { diagnosticCount as lint_diagnosticCount, forceLinting, lintGutter, linter } from "@codemirror/lint";
14
15
  import { Compartment, EditorSelection, EditorState, StateEffect } from "@codemirror/state";
15
16
  import { EditorView, keymap, placeholder } from "@codemirror/view";
16
17
  import { basicSetup, minimalSetup } from "codemirror";
17
- import { computed, defineComponent, h, isVue2, nextTick, onMounted, onUnmounted, ref, shallowRef, watch } from "vue-demi";
18
+ const codeMirrorProps = {
19
+ modelValue: {
20
+ type: String,
21
+ default: ''
22
+ },
23
+ theme: {
24
+ type: Object,
25
+ default: ()=>({})
26
+ },
27
+ dark: {
28
+ type: Boolean,
29
+ default: false
30
+ },
31
+ basic: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ minimal: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ placeholder: {
40
+ type: String,
41
+ default: void 0
42
+ },
43
+ wrap: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ tab: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ indentUnit: {
52
+ type: String,
53
+ default: void 0
54
+ },
55
+ allowMultipleSelections: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ tabSize: {
60
+ type: Number,
61
+ default: void 0
62
+ },
63
+ lineSeparator: {
64
+ type: String,
65
+ default: void 0
66
+ },
67
+ readonly: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ disabled: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ extensions: {
76
+ type: Array,
77
+ default: ()=>[]
78
+ },
79
+ phrases: {
80
+ type: Object,
81
+ default: void 0
82
+ },
83
+ lang: {
84
+ type: Object,
85
+ default: void 0
86
+ },
87
+ linter: {
88
+ type: Function,
89
+ default: void 0
90
+ },
91
+ linterConfig: {
92
+ type: Object,
93
+ default: ()=>({})
94
+ },
95
+ forceLinting: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ gutter: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ gutterConfig: {
104
+ type: Object,
105
+ default: void 0
106
+ },
107
+ tag: {
108
+ type: String,
109
+ default: 'div'
110
+ },
111
+ scrollIntoView: {
112
+ type: Boolean,
113
+ default: true
114
+ },
115
+ preserveScrollPosition: {
116
+ type: Boolean,
117
+ default: false
118
+ },
119
+ keymap: {
120
+ type: Array,
121
+ default: ()=>[]
122
+ }
123
+ };
124
+ const codeMirrorEmits = {
125
+ 'update:modelValue': (_value = '')=>true,
126
+ update: (_value)=>true,
127
+ ready: (_value)=>true,
128
+ focus: (_value)=>true,
129
+ change: (_value)=>true,
130
+ destroy: ()=>true
131
+ };
132
+ function useCodeMirror(props, emit) {
133
+ const editor = ref();
134
+ const doc = ref(props.modelValue);
135
+ const view = shallowRef(void 0);
136
+ const focus = computed({
137
+ get: ()=>view.value?.hasFocus ?? false,
138
+ set: (f)=>{
139
+ if (f && view.value) view.value.focus();
140
+ }
141
+ });
142
+ const selection = computed({
143
+ get: ()=>view.value?.state.selection,
144
+ set: (selection)=>{
145
+ if (view.value && selection) view.value.dispatch({
146
+ selection
147
+ });
148
+ }
149
+ });
150
+ const cursor = computed({
151
+ get: ()=>view.value?.state.selection.main.head ?? 0,
152
+ set: (anchor)=>{
153
+ if (view.value) view.value.dispatch({
154
+ selection: {
155
+ anchor
156
+ }
157
+ });
158
+ }
159
+ });
160
+ const json = computed({
161
+ get: ()=>view.value?.state.toJSON(),
162
+ set: (j)=>{
163
+ if (view.value && j) view.value.setState(EditorState.fromJSON(j));
164
+ }
165
+ });
166
+ const length = ref(0);
167
+ const diagnosticCount = ref(0);
168
+ const extensions = computed(()=>{
169
+ const language = new Compartment();
170
+ const tabSize = new Compartment();
171
+ if (props.basic && props.minimal) throw new Error('[Vue CodeMirror] Both basic and minimal cannot be specified.');
172
+ const keymaps = props.keymap?.length ? [
173
+ ...props.keymap
174
+ ] : [];
175
+ if (props.tab) keymaps.push(indentWithTab);
176
+ return [
177
+ props.basic && !props.minimal ? basicSetup : void 0,
178
+ props.minimal && !props.basic ? minimalSetup : void 0,
179
+ EditorView.updateListener.of((update)=>{
180
+ if (!view.value) return;
181
+ emit('focus', view.value.hasFocus);
182
+ length.value = view.value.state.doc?.length;
183
+ if (update.changes.empty || !update.docChanged) return;
184
+ if (props.linter) {
185
+ if (props.forceLinting) forceLinting(view.value);
186
+ diagnosticCount.value = props.linter(view.value).length;
187
+ }
188
+ emit('update', update);
189
+ }),
190
+ EditorView.theme(props.theme, {
191
+ dark: props.dark
192
+ }),
193
+ props.wrap ? EditorView.lineWrapping : void 0,
194
+ props.indentUnit ? indentUnit.of(props.indentUnit) : void 0,
195
+ EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
196
+ props.tabSize ? tabSize.of(EditorState.tabSize.of(props.tabSize)) : void 0,
197
+ props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
198
+ EditorState.readOnly.of(props.readonly),
199
+ EditorView.editable.of(!props.disabled),
200
+ props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
201
+ props.lang ? language.of(props.lang) : void 0,
202
+ props.linter ? linter(props.linter, props.linterConfig) : void 0,
203
+ props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
204
+ props.placeholder ? placeholder(props.placeholder) : void 0,
205
+ keymaps.length > 0 ? keymap.of(keymaps) : void 0,
206
+ ...props.extensions
207
+ ].filter((extension)=>Boolean(extension));
208
+ });
209
+ watch(extensions, (exts)=>view.value?.dispatch({
210
+ effects: StateEffect.reconfigure.of(exts)
211
+ }), {
212
+ immediate: true
213
+ });
214
+ watch(()=>props.modelValue, async (value)=>{
215
+ if (!view.value) return;
216
+ if (view.value.composing || view.value.state.doc.toJSON().join(props.lineSeparator ?? '\n') === value) return;
217
+ const isSelectionOutOfRange = !view.value.state.selection.ranges.every((range)=>range.anchor < value.length && range.head < value.length);
218
+ const changes = {
219
+ from: 0,
220
+ to: view.value.state.doc.length,
221
+ insert: value
222
+ };
223
+ const scrollSnapshot = props.preserveScrollPosition ? view.value.scrollSnapshot().map(view.value.state.changes(changes)) : void 0;
224
+ view.value.dispatch({
225
+ changes,
226
+ selection: isSelectionOutOfRange ? {
227
+ anchor: 0,
228
+ head: 0
229
+ } : view.value.state.selection,
230
+ scrollIntoView: props.scrollIntoView,
231
+ effects: scrollSnapshot ? [
232
+ scrollSnapshot
233
+ ] : void 0
234
+ });
235
+ }, {
236
+ immediate: true
237
+ });
238
+ onMounted(async ()=>{
239
+ if (void 0 === globalThis.window || !editor.value) return;
240
+ let value = doc.value;
241
+ if (editor.value.childNodes[0]) {
242
+ if ('' !== doc.value) console.warn('[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values.');
243
+ value = editor.value.childNodes[0].innerText.trim();
244
+ }
245
+ view.value = new EditorView({
246
+ parent: editor.value,
247
+ state: EditorState.create({
248
+ doc: value,
249
+ extensions: extensions.value
250
+ }),
251
+ dispatch: (tr)=>{
252
+ if (!view.value) return;
253
+ view.value.update([
254
+ tr
255
+ ]);
256
+ if (tr.changes.empty || !tr.docChanged) return;
257
+ emit('update:modelValue', tr.state.doc.toString());
258
+ emit('change', tr.state);
259
+ }
260
+ });
261
+ await nextTick();
262
+ emit('ready', {
263
+ view: view.value,
264
+ state: view.value.state,
265
+ container: editor.value
266
+ });
267
+ });
268
+ onUnmounted(()=>{
269
+ if (view.value) {
270
+ view.value.destroy();
271
+ emit('destroy');
272
+ }
273
+ });
274
+ const lint = ()=>{
275
+ if (!(props.linter && view.value)) return;
276
+ if (props.forceLinting) forceLinting(view.value);
277
+ diagnosticCount.value = lint_diagnosticCount(view.value.state);
278
+ };
279
+ const forceReconfigure = ()=>{
280
+ view.value?.dispatch({
281
+ effects: StateEffect.reconfigure.of([])
282
+ });
283
+ view.value?.dispatch({
284
+ effects: StateEffect.appendConfig.of(extensions.value)
285
+ });
286
+ };
287
+ const getRange = (from, to)=>view.value?.state.sliceDoc(from, to);
288
+ const getLine = (number)=>view.value?.state.doc.line(number + 1).text;
289
+ const lineCount = ()=>view.value?.state.doc.lines ?? 0;
290
+ const getCursor = ()=>view.value?.state.selection.main.head ?? 0;
291
+ const listSelections = ()=>view.value?.state.selection.ranges ?? [];
292
+ const getSelection = ()=>{
293
+ if (!view.value) return '';
294
+ return view.value.state.sliceDoc(view.value.state.selection.main.from, view.value.state.selection.main.to);
295
+ };
296
+ const getSelections = ()=>{
297
+ const s = view.value?.state;
298
+ if (!s) return [];
299
+ return s.selection.ranges.map((r)=>s.sliceDoc(r.from, r.to));
300
+ };
301
+ const somethingSelected = ()=>view.value?.state.selection.ranges.some((r)=>!r.empty) ?? false;
302
+ const replaceRange = (replacement, from, to)=>{
303
+ if (view.value) view.value.dispatch({
304
+ changes: {
305
+ from,
306
+ to,
307
+ insert: replacement
308
+ }
309
+ });
310
+ };
311
+ const replaceSelection = (replacement)=>{
312
+ if (view.value) view.value.dispatch(view.value.state.replaceSelection(replacement));
313
+ };
314
+ const setCursor = (position)=>{
315
+ if (view.value) view.value.dispatch({
316
+ selection: {
317
+ anchor: position
318
+ }
319
+ });
320
+ };
321
+ const setSelection = (anchor, head)=>{
322
+ if (view.value) view.value.dispatch({
323
+ selection: {
324
+ anchor,
325
+ head
326
+ }
327
+ });
328
+ };
329
+ const setSelections = (ranges, primary)=>{
330
+ if (view.value) view.value.dispatch({
331
+ selection: EditorSelection.create(ranges, primary)
332
+ });
333
+ };
334
+ const extendSelectionsBy = (f)=>{
335
+ if (view.value && selection.value) view.value.dispatch({
336
+ selection: EditorSelection.create(selection.value.ranges.map((r)=>r.extend(f(r))))
337
+ });
338
+ };
339
+ return {
340
+ editor,
341
+ view,
342
+ cursor,
343
+ selection,
344
+ focus,
345
+ length,
346
+ json,
347
+ diagnosticCount,
348
+ dom: view.value?.contentDOM,
349
+ lint,
350
+ forceReconfigure,
351
+ getRange,
352
+ getLine,
353
+ lineCount,
354
+ getCursor,
355
+ listSelections,
356
+ getSelection,
357
+ getSelections,
358
+ somethingSelected,
359
+ replaceRange,
360
+ replaceSelection,
361
+ setCursor,
362
+ setSelection,
363
+ setSelections,
364
+ extendSelectionsBy
365
+ };
366
+ }
18
367
  const adaptOnsV3 = (ons)=>{
19
368
  if (!ons) return {};
20
369
  return Object.entries(ons).reduce((ret, [key, handler])=>{
@@ -35,362 +384,19 @@ function h_demi_h(type, options = {}, children) {
35
384
  }
36
385
  const slot = (defaultSlots)=>'function' == typeof defaultSlots ? defaultSlots() : defaultSlots ?? [];
37
386
  const Meta = {
38
- version: "1.6.2",
39
- date: "2026-08-30T08:07:40.512Z"
387
+ version: "1.7.0",
388
+ date: "2026-09-24T00:25:20.981Z"
40
389
  };
41
- const CodeMirror = defineComponent({
390
+ const component = defineComponent({
42
391
  name: 'CodeMirror',
43
392
  model: {
44
393
  prop: 'modelValue',
45
394
  event: 'update:modelValue'
46
395
  },
47
- props: {
48
- modelValue: {
49
- type: String,
50
- default: ''
51
- },
52
- theme: {
53
- type: Object,
54
- default: ()=>({})
55
- },
56
- dark: {
57
- type: Boolean,
58
- default: false
59
- },
60
- basic: {
61
- type: Boolean,
62
- default: false
63
- },
64
- minimal: {
65
- type: Boolean,
66
- default: false
67
- },
68
- placeholder: {
69
- type: String,
70
- default: void 0
71
- },
72
- wrap: {
73
- type: Boolean,
74
- default: false
75
- },
76
- tab: {
77
- type: Boolean,
78
- default: false
79
- },
80
- indentUnit: {
81
- type: String,
82
- default: void 0
83
- },
84
- allowMultipleSelections: {
85
- type: Boolean,
86
- default: false
87
- },
88
- tabSize: {
89
- type: Number,
90
- default: void 0
91
- },
92
- lineSeparator: {
93
- type: String,
94
- default: void 0
95
- },
96
- readonly: {
97
- type: Boolean,
98
- default: false
99
- },
100
- disabled: {
101
- type: Boolean,
102
- default: false
103
- },
104
- extensions: {
105
- type: Array,
106
- default: ()=>[]
107
- },
108
- phrases: {
109
- type: Object,
110
- default: void 0
111
- },
112
- lang: {
113
- type: Object,
114
- default: void 0
115
- },
116
- linter: {
117
- type: Function,
118
- default: void 0
119
- },
120
- linterConfig: {
121
- type: Object,
122
- default: ()=>({})
123
- },
124
- forceLinting: {
125
- type: Boolean,
126
- default: false
127
- },
128
- gutter: {
129
- type: Boolean,
130
- default: false
131
- },
132
- gutterConfig: {
133
- type: Object,
134
- default: void 0
135
- },
136
- tag: {
137
- type: String,
138
- default: 'div'
139
- },
140
- scrollIntoView: {
141
- type: Boolean,
142
- default: true
143
- },
144
- preserveScrollPosition: {
145
- type: Boolean,
146
- default: false
147
- },
148
- keymap: {
149
- type: Array,
150
- default: ()=>[]
151
- }
152
- },
153
- emits: {
154
- 'update:modelValue': (_value = '')=>true,
155
- update: (_value)=>true,
156
- ready: (_value)=>true,
157
- focus: (_value)=>true,
158
- change: (_value)=>true,
159
- destroy: ()=>true
160
- },
396
+ props: codeMirrorProps,
397
+ emits: codeMirrorEmits,
161
398
  setup (props, context) {
162
- const editor = ref();
163
- const doc = ref(props.modelValue);
164
- const view = shallowRef(void 0);
165
- const focus = computed({
166
- get: ()=>view.value?.hasFocus ?? false,
167
- set: (f)=>{
168
- if (f && view.value) view.value.focus();
169
- }
170
- });
171
- const selection = computed({
172
- get: ()=>view.value?.state.selection,
173
- set: (selection)=>{
174
- if (view.value && selection) view.value.dispatch({
175
- selection
176
- });
177
- }
178
- });
179
- const cursor = computed({
180
- get: ()=>view.value?.state.selection.main.head ?? 0,
181
- set: (anchor)=>{
182
- if (view.value) view.value.dispatch({
183
- selection: {
184
- anchor
185
- }
186
- });
187
- }
188
- });
189
- const json = computed({
190
- get: ()=>view.value?.state.toJSON(),
191
- set: (j)=>{
192
- if (view.value && j) view.value.setState(EditorState.fromJSON(j));
193
- }
194
- });
195
- const length = ref(0);
196
- const diagnosticCount = ref(0);
197
- const extensions = computed(()=>{
198
- const language = new Compartment();
199
- const tabSize = new Compartment();
200
- if (props.basic && props.minimal) throw new Error('[Vue CodeMirror] Both basic and minimal cannot be specified.');
201
- let keymaps = [];
202
- if (props.keymap && props.keymap.length > 0) keymaps = props.keymap;
203
- if (props.tab) keymaps.push(indentWithTab);
204
- return [
205
- props.basic && !props.minimal ? basicSetup : void 0,
206
- props.minimal && !props.basic ? minimalSetup : void 0,
207
- EditorView.updateListener.of((update)=>{
208
- if (!view.value) return;
209
- context.emit('focus', view.value.hasFocus);
210
- length.value = view.value.state.doc?.length;
211
- if (update.changes.empty || !update.docChanged) return;
212
- if (props.linter) {
213
- if (props.forceLinting) forceLinting(view.value);
214
- diagnosticCount.value = props.linter(view.value).length;
215
- }
216
- context.emit('update', update);
217
- }),
218
- EditorView.theme(props.theme, {
219
- dark: props.dark
220
- }),
221
- props.wrap ? EditorView.lineWrapping : void 0,
222
- props.indentUnit ? indentUnit.of(props.indentUnit) : void 0,
223
- EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
224
- props.tabSize ? tabSize.of(EditorState.tabSize.of(props.tabSize)) : void 0,
225
- props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
226
- EditorState.readOnly.of(props.readonly),
227
- EditorView.editable.of(!props.disabled),
228
- props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
229
- props.lang ? language.of(props.lang) : void 0,
230
- props.linter ? linter(props.linter, props.linterConfig) : void 0,
231
- props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
232
- props.placeholder ? placeholder(props.placeholder) : void 0,
233
- keymaps.length > 0 ? keymap.of(keymaps) : void 0,
234
- ...props.extensions
235
- ].filter((extension)=>Boolean(extension));
236
- });
237
- watch(extensions, (exts)=>view.value?.dispatch({
238
- effects: StateEffect.reconfigure.of(exts)
239
- }), {
240
- immediate: true
241
- });
242
- watch(()=>props.modelValue, async (value)=>{
243
- if (!view.value) return;
244
- if (view.value.composing || view.value.state.doc.toJSON().join(props.lineSeparator ?? '\n') === value) return;
245
- const isSelectionOutOfRange = !view.value.state.selection.ranges.every((range)=>range.anchor < value.length && range.head < value.length);
246
- const changes = {
247
- from: 0,
248
- to: view.value.state.doc.length,
249
- insert: value
250
- };
251
- const scrollSnapshot = props.preserveScrollPosition ? view.value.scrollSnapshot().map(view.value.state.changes(changes)) : void 0;
252
- view.value.dispatch({
253
- changes,
254
- selection: isSelectionOutOfRange ? {
255
- anchor: 0,
256
- head: 0
257
- } : view.value.state.selection,
258
- scrollIntoView: props.scrollIntoView,
259
- effects: scrollSnapshot ? [
260
- scrollSnapshot
261
- ] : void 0
262
- });
263
- }, {
264
- immediate: true
265
- });
266
- onMounted(async ()=>{
267
- if (void 0 === globalThis.window || !editor.value) return;
268
- let value = doc.value;
269
- if (editor.value.childNodes[0]) {
270
- if ('' !== doc.value) console.warn('[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values.');
271
- value = editor.value.childNodes[0].innerText.trim();
272
- }
273
- view.value = new EditorView({
274
- parent: editor.value,
275
- state: EditorState.create({
276
- doc: value,
277
- extensions: extensions.value
278
- }),
279
- dispatch: (tr)=>{
280
- if (!view.value) return;
281
- view.value.update([
282
- tr
283
- ]);
284
- if (tr.changes.empty || !tr.docChanged) return;
285
- context.emit('update:modelValue', tr.state.doc.toString());
286
- context.emit('change', tr.state);
287
- }
288
- });
289
- await nextTick();
290
- context.emit('ready', {
291
- view: view.value,
292
- state: view.value.state,
293
- container: editor.value
294
- });
295
- });
296
- onUnmounted(()=>{
297
- if (view.value) {
298
- view.value.destroy();
299
- context.emit('destroy');
300
- }
301
- });
302
- const lint = ()=>{
303
- if (!(props.linter && view.value)) return;
304
- if (props.forceLinting) forceLinting(view.value);
305
- diagnosticCount.value = lint_diagnosticCount(view.value.state);
306
- };
307
- const forceReconfigure = ()=>{
308
- view.value?.dispatch({
309
- effects: StateEffect.reconfigure.of([])
310
- });
311
- view.value?.dispatch({
312
- effects: StateEffect.appendConfig.of(extensions.value)
313
- });
314
- };
315
- const getRange = (from, to)=>view.value?.state.sliceDoc(from, to);
316
- const getLine = (number)=>view.value?.state.doc.line(number + 1).text;
317
- const lineCount = ()=>view.value?.state.doc.lines ?? 0;
318
- const getCursor = ()=>view.value?.state.selection.main.head ?? 0;
319
- const listSelections = ()=>view.value?.state.selection.ranges ?? [];
320
- const getSelection = ()=>{
321
- if (!view.value) return '';
322
- return view.value.state.sliceDoc(view.value.state.selection.main.from, view.value.state.selection.main.to);
323
- };
324
- const getSelections = ()=>{
325
- const s = view.value?.state;
326
- if (!s) return [];
327
- return s.selection.ranges.map((r)=>s.sliceDoc(r.from, r.to));
328
- };
329
- const somethingSelected = ()=>view.value?.state.selection.ranges.some((r)=>!r.empty) ?? false;
330
- const replaceRange = (replacement, from, to)=>{
331
- if (view.value) view.value.dispatch({
332
- changes: {
333
- from,
334
- to,
335
- insert: replacement
336
- }
337
- });
338
- };
339
- const replaceSelection = (replacement)=>{
340
- if (view.value) view.value.dispatch(view.value.state.replaceSelection(replacement));
341
- };
342
- const setCursor = (position)=>{
343
- if (view.value) view.value.dispatch({
344
- selection: {
345
- anchor: position
346
- }
347
- });
348
- };
349
- const setSelection = (anchor, head)=>{
350
- if (view.value) view.value.dispatch({
351
- selection: {
352
- anchor,
353
- head
354
- }
355
- });
356
- };
357
- const setSelections = (ranges, primary)=>{
358
- if (view.value) view.value.dispatch({
359
- selection: EditorSelection.create(ranges, primary)
360
- });
361
- };
362
- const extendSelectionsBy = (f)=>{
363
- if (view.value && selection.value) view.value.dispatch({
364
- selection: EditorSelection.create(selection.value.ranges.map((r)=>r.extend(f(r))))
365
- });
366
- };
367
- const exposed = {
368
- editor,
369
- view,
370
- cursor,
371
- selection,
372
- focus,
373
- length,
374
- json,
375
- diagnosticCount,
376
- dom: view.value?.contentDOM,
377
- lint,
378
- forceReconfigure,
379
- getRange,
380
- getLine,
381
- lineCount,
382
- getCursor,
383
- listSelections,
384
- getSelection,
385
- getSelections,
386
- somethingSelected,
387
- replaceRange,
388
- replaceSelection,
389
- setCursor,
390
- setSelection,
391
- setSelections,
392
- extendSelectionsBy
393
- };
399
+ const exposed = useCodeMirror(props, context.emit);
394
400
  context.expose(exposed);
395
401
  return exposed;
396
402
  },
@@ -404,10 +410,11 @@ const CodeMirror = defineComponent({
404
410
  }, slot(this.$slots.default)) : void 0);
405
411
  }
406
412
  });
413
+ const src_element = defineCustomElement(component);
407
414
  const installCodeMirror = (app)=>{
408
- app.component('CodeMirror', CodeMirror);
415
+ app.component('CodeMirror', component);
409
416
  };
410
- export default CodeMirror;
411
- export { Meta, installCodeMirror as install };
417
+ export default component;
418
+ export { Meta, installCodeMirror as install, src_element as CodeMirror };
412
419
 
413
420
  //# sourceMappingURL=index.es.js.map