vue-codemirror6 1.5.2 → 1.6.1

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