vue-codemirror6 1.3.3 → 1.3.6

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/README.md CHANGED
@@ -362,7 +362,7 @@ const config: UserConfig = {
362
362
  // ...
363
363
  codemirror: [
364
364
  // Split CodeMirror code.
365
- 'vue-codemirror6'
365
+ 'vue-codemirror6',
366
366
  'codemirror',
367
367
  '@codemirror/autocomplete',
368
368
  '@codemirror/commands',
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.2
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -13,27 +13,25 @@ import { indentWithTab as G } from "@codemirror/commands";
13
13
  import { indentUnit as I } from "@codemirror/language";
14
14
  import { forceLinting as b, linter as P, lintGutter as Z, diagnosticCount as k } from "@codemirror/lint";
15
15
  import { EditorState as s, Compartment as C, StateEffect as y, EditorSelection as w } from "@codemirror/state";
16
- import { EditorView as r, keymap as q, placeholder as H } from "@codemirror/view";
16
+ import { EditorView as c, keymap as q, placeholder as H } from "@codemirror/view";
17
17
  import { basicSetup as K, minimalSetup as Q } from "codemirror";
18
- import { isVue2 as X, h as O, defineComponent as Y, ref as v, shallowRef as ee, computed as d, watch as $, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
19
- const ie = {
20
- version: "1.3.2",
21
- date: "2024-06-10T11:57:17.342Z"
22
- };
23
- var ge = ie;
24
- const le = (e) => e ? Object.entries(e).reduce((l, [i, u]) => (i = i.charAt(0).toUpperCase() + i.slice(1), i = `on${i}`, { ...l, [i]: u }), {}) : {};
25
- function B(e, l = {}, i) {
18
+ import { isVue2 as X, h as O, defineComponent as Y, ref as v, shallowRef as ee, computed as r, watch as B, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
19
+ const me = {
20
+ version: "1.3.6",
21
+ date: "2024-11-05T16:13:38.583Z"
22
+ }, ie = (e) => e ? Object.entries(e).reduce((l, [i, u]) => (i = i.charAt(0).toUpperCase() + i.slice(1), i = `on${i}`, { ...l, [i]: u }), {}) : {};
23
+ function M(e, l = {}, i) {
26
24
  if (X)
27
25
  return O(e, l, i);
28
- const { props: u, domProps: t, on: f, ...c } = l, m = f ? le(f) : {};
26
+ const { props: u, domProps: t, on: d, ...f } = l, m = d ? ie(d) : {};
29
27
  return O(
30
28
  e,
31
- { ...c, ...u, ...t, ...m },
29
+ { ...f, ...u, ...t, ...m },
32
30
  i
33
31
  );
34
32
  }
35
- const oe = (e) => typeof e == "function" ? e() : e;
36
- var se = Y({
33
+ const le = (e) => typeof e == "function" ? e() : e;
34
+ var oe = Y({
37
35
  /** Component Name */
38
36
  name: "CodeMirror",
39
37
  /** Model Definition */
@@ -272,23 +270,23 @@ var se = Y({
272
270
  * @param context - Context
273
271
  */
274
272
  setup(e, l) {
275
- const i = v(), u = v(e.modelValue), t = ee(new r()), f = d({
273
+ const i = v(), u = v(e.modelValue), t = ee(new c()), d = r({
276
274
  get: () => t.value.hasFocus,
277
275
  set: (a) => {
278
276
  a && t.value.focus();
279
277
  }
280
- }), c = d({
278
+ }), f = r({
281
279
  get: () => t.value.state.selection,
282
280
  set: (a) => t.value.dispatch({ selection: a })
283
- }), m = d({
281
+ }), m = r({
284
282
  get: () => t.value.state.selection.main.head,
285
283
  set: (a) => t.value.dispatch({ selection: { anchor: a } })
286
- }), M = d(
284
+ }), V = r(
287
285
  {
288
286
  get: () => t.value.state.toJSON(),
289
287
  set: (a) => t.value.setState(s.fromJSON(a))
290
288
  }
291
- ), S = v(0), g = v(0), h = d(() => {
289
+ ), S = v(0), h = v(0), g = r(() => {
292
290
  const a = new C(), n = new C();
293
291
  if (e.basic && e.minimal)
294
292
  throw "[Vue CodeMirror] Both basic and minimal cannot be specified.";
@@ -298,13 +296,13 @@ var se = Y({
298
296
  // Toggle minimal setup
299
297
  e.minimal && !e.basic ? Q : void 0,
300
298
  // ViewUpdate event listener
301
- r.updateListener.of((o) => {
302
- l.emit("focus", t.value.hasFocus), S.value = t.value.state.doc?.length, !(o.changes.empty || !o.docChanged) && (e.linter && (e.forceLinting && b(t.value), g.value = e.linter(t.value).length), l.emit("update", o));
299
+ c.updateListener.of((o) => {
300
+ l.emit("focus", t.value.hasFocus), S.value = t.value.state.doc?.length, !(o.changes.empty || !o.docChanged) && (e.linter && (e.forceLinting && b(t.value), h.value = e.linter(t.value).length), l.emit("update", o));
303
301
  }),
304
302
  // Toggle light/dark mode.
305
- r.theme(e.theme, { dark: e.dark }),
303
+ c.theme(e.theme, { dark: e.dark }),
306
304
  // Toggle line wrapping
307
- e.wrap ? r.lineWrapping : void 0,
305
+ e.wrap ? c.lineWrapping : void 0,
308
306
  // Indent with tab
309
307
  e.tab ? q.of([G]) : void 0,
310
308
  // Tab character
@@ -318,7 +316,7 @@ var se = Y({
318
316
  // Readonly option
319
317
  s.readOnly.of(e.readonly),
320
318
  // Editable option
321
- r.editable.of(!e.disabled),
319
+ c.editable.of(!e.disabled),
322
320
  // Set Line break char
323
321
  e.lineSeparator ? s.lineSeparator.of(e.lineSeparator) : void 0,
324
322
  // Lang
@@ -333,24 +331,27 @@ var se = Y({
333
331
  ...e.extensions
334
332
  ].filter((o) => !!o);
335
333
  });
336
- $(
337
- h,
334
+ B(
335
+ g,
338
336
  (a) => {
339
337
  t.value?.dispatch({
340
338
  effects: y.reconfigure.of(a)
341
339
  });
342
340
  },
343
341
  { immediate: !0 }
344
- ), $(
342
+ ), B(
345
343
  () => e.modelValue,
346
344
  async (a) => {
347
- t.value.composing || // IME fix
345
+ if (t.value.composing || // IME fix
348
346
  t.value.state.doc.toJSON().join(e.lineSeparator ?? `
349
- `) === a || c.value.ranges.every(
350
- (n) => n.anchor < a.length && n.head < a.length
351
- ) && t.value.dispatch({
347
+ `) === a)
348
+ return;
349
+ const n = !t.value.state.selection.ranges.every(
350
+ (o) => o.anchor < a.length && o.head < a.length
351
+ );
352
+ t.value.dispatch({
352
353
  changes: { from: 0, to: t.value.state.doc.length, insert: a },
353
- selection: t.value.state.selection,
354
+ selection: n ? { anchor: 0, head: 0 } : t.value.state.selection,
354
355
  scrollIntoView: !0
355
356
  });
356
357
  },
@@ -359,9 +360,9 @@ var se = Y({
359
360
  let a = u.value;
360
361
  i.value && (i.value.childNodes[0] && (u.value !== "" && console.warn(
361
362
  "[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
362
- ), a = i.value.childNodes[0].innerText.trim()), t.value = new r({
363
+ ), a = i.value.childNodes[0].innerText.trim()), t.value = new c({
363
364
  parent: i.value,
364
- state: s.create({ doc: a, extensions: h.value }),
365
+ state: s.create({ doc: a, extensions: g.value }),
365
366
  dispatch: (n) => {
366
367
  t.value.update([n]), !(n.changes.empty || !n.docChanged) && (l.emit("update:modelValue", n.state.doc.toString() ?? ""), l.emit("change", n.state));
367
368
  }
@@ -373,13 +374,13 @@ var se = Y({
373
374
  }), ne(() => {
374
375
  t.value.destroy(), l.emit("destroy");
375
376
  });
376
- const V = () => {
377
- !e.linter || !t.value || (e.forceLinting && b(t.value), g.value = k(t.value.state));
377
+ const $ = () => {
378
+ !e.linter || !t.value || (e.forceLinting && b(t.value), h.value = k(t.value.state));
378
379
  }, j = () => {
379
380
  t.value?.dispatch({
380
381
  effects: y.reconfigure.of([])
381
382
  }), t.value?.dispatch({
382
- effects: y.appendConfig.of(h.value)
383
+ effects: y.appendConfig.of(g.value)
383
384
  });
384
385
  }, x = (a, n) => t.value.state.sliceDoc(a, n), _ = (a) => t.value.state.doc.line(a + 1).text, L = () => t.value.state.doc.lines, N = () => t.value.state.selection.main.head, U = () => {
385
386
  let a;
@@ -390,32 +391,32 @@ var se = Y({
390
391
  t.value.state.selection.main.from,
391
392
  t.value.state.selection.main.to
392
393
  )) !== null && a !== void 0 ? a : "";
393
- }, T = () => {
394
+ }, R = () => {
394
395
  const a = t.value.state;
395
396
  return a ? a.selection.ranges.map(
396
397
  (n) => a.sliceDoc(n.from, n.to)
397
398
  ) : [];
398
- }, D = () => t.value.state.selection.ranges.some(
399
+ }, T = () => t.value.state.selection.ranges.some(
399
400
  (a) => !a.empty
400
- ), E = (a, n, o) => t.value.dispatch({
401
+ ), D = (a, n, o) => t.value.dispatch({
401
402
  changes: { from: n, to: o, insert: a }
402
- }), R = (a) => t.value.dispatch(t.value.state.replaceSelection(a)), F = (a) => t.value.dispatch({ selection: { anchor: a } }), J = (a, n) => t.value.dispatch({ selection: { anchor: a, head: n } }), A = (a, n) => t.value.dispatch({
403
+ }), E = (a) => t.value.dispatch(t.value.state.replaceSelection(a)), F = (a) => t.value.dispatch({ selection: { anchor: a } }), J = (a, n) => t.value.dispatch({ selection: { anchor: a, head: n } }), A = (a, n) => t.value.dispatch({
403
404
  selection: w.create(a, n)
404
405
  }), W = (a) => t.value.dispatch({
405
406
  selection: w.create(
406
- c.value.ranges.map((n) => n.extend(a(n)))
407
+ f.value.ranges.map((n) => n.extend(a(n)))
407
408
  )
408
409
  }), p = {
409
410
  editor: i,
410
411
  view: t,
411
412
  cursor: m,
412
- selection: c,
413
- focus: f,
413
+ selection: f,
414
+ focus: d,
414
415
  length: S,
415
- json: M,
416
- diagnosticCount: g,
416
+ json: V,
417
+ diagnosticCount: h,
417
418
  dom: t.value.contentDOM,
418
- lint: V,
419
+ lint: $,
419
420
  forceReconfigure: j,
420
421
  // Bellow is CodeMirror5's function
421
422
  getRange: x,
@@ -424,10 +425,10 @@ var se = Y({
424
425
  getCursor: N,
425
426
  listSelections: U,
426
427
  getSelection: z,
427
- getSelections: T,
428
- somethingSelected: D,
429
- replaceRange: E,
430
- replaceSelection: R,
428
+ getSelections: R,
429
+ somethingSelected: T,
430
+ replaceRange: D,
431
+ replaceSelection: E,
431
432
  setCursor: F,
432
433
  setSelection: J,
433
434
  setSelections: A,
@@ -436,7 +437,7 @@ var se = Y({
436
437
  return l.expose(p), p;
437
438
  },
438
439
  render() {
439
- return B(
440
+ return M(
440
441
  this.$props.tag,
441
442
  {
442
443
  ref: "editor",
@@ -444,18 +445,18 @@ var se = Y({
444
445
  },
445
446
  this.$slots.default ? (
446
447
  // Hide original content
447
- B(
448
+ M(
448
449
  "aside",
449
450
  { style: "display: none;", "aria-hidden": "true" },
450
- oe(this.$slots.default)
451
+ le(this.$slots.default)
451
452
  )
452
453
  ) : void 0
453
454
  );
454
455
  }
455
456
  });
456
- const he = (e) => e.component("CodeMirror", se);
457
+ const he = (e) => e.component("CodeMirror", oe);
457
458
  export {
458
- ge as Meta,
459
- se as default,
459
+ me as Meta,
460
+ oe as default,
460
461
  he as install
461
462
  };
@@ -5,9 +5,9 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.2
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
12
- var CodeMirror=function(u,E,V,f,i,c,y,l){"use strict";var M={version:"1.3.2",date:"2024-06-10T11:57:17.342Z"};const O=e=>e?Object.entries(e).reduce((r,[o,s])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...r,[o]:s}),{}):{};function b(e,r={},o){if(l.isVue2)return l.h(e,r,o);const{props:s,domProps:t,on:g,...v}=r,h=g?O(g):{};return l.h(e,{...v,...s,...t,...h},o)}const $=e=>typeof e=="function"?e():e;var C=l.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},tag:{type:String,default:"div"}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,r){const o=l.ref(),s=l.ref(e.modelValue),t=l.shallowRef(new c.EditorView),g=l.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),v=l.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),h=l.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=l.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(i.EditorState.fromJSON(a))}),w=l.ref(0),m=l.ref(0),S=l.computed(()=>{const a=new i.Compartment,n=new i.Compartment;if(e.basic&&e.minimal)throw"[Vue CodeMirror] Both basic and minimal cannot be specified.";return[e.basic&&!e.minimal?y.basicSetup:void 0,e.minimal&&!e.basic?y.minimalSetup:void 0,c.EditorView.updateListener.of(d=>{r.emit("focus",t.value.hasFocus),w.value=t.value.state.doc?.length,!(d.changes.empty||!d.docChanged)&&(e.linter&&(e.forceLinting&&f.forceLinting(t.value),m.value=e.linter(t.value).length),r.emit("update",d))}),c.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?c.EditorView.lineWrapping:void 0,e.tab?c.keymap.of([E.indentWithTab]):void 0,e.indentUnit?V.indentUnit.of(e.indentUnit):void 0,i.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(i.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?i.EditorState.phrases.of(e.phrases):void 0,i.EditorState.readOnly.of(e.readonly),c.EditorView.editable.of(!e.disabled),e.lineSeparator?i.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?f.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?f.lintGutter(e.gutterConfig):void 0,e.placeholder?c.placeholder(e.placeholder):void 0,...e.extensions].filter(d=>!!d)});l.watch(S,a=>{t.value?.dispatch({effects:i.StateEffect.reconfigure.of(a)})},{immediate:!0}),l.watch(()=>e.modelValue,async a=>{t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
13
- `)===a||v.value.ranges.every(n=>n.anchor<a.length&&n.head<a.length)&&t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),l.onMounted(async()=>{let a=s.value;o.value&&(o.value.childNodes[0]&&(s.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=o.value.childNodes[0].innerText.trim()),t.value=new c.EditorView({parent:o.value,state:i.EditorState.create({doc:a,extensions:S.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(r.emit("update:modelValue",n.state.doc.toString()??""),r.emit("change",n.state))}}),await l.nextTick(),r.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),l.onUnmounted(()=>{t.value.destroy(),r.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&f.forceLinting(t.value),m.value=f.diagnosticCount(t.value.state))},L=()=>{t.value?.dispatch({effects:i.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:i.StateEffect.appendConfig.of(S.value)})},N=(a,n)=>t.value.state.sliceDoc(a,n),U=a=>t.value.state.doc.line(a+1).text,z=()=>t.value.state.doc.lines,T=()=>t.value.state.selection.main.head,R=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},F=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},J=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},x=()=>t.value.state.selection.ranges.some(a=>!a.empty),A=(a,n,d)=>t.value.dispatch({changes:{from:n,to:d,insert:a}}),P=a=>t.value.dispatch(t.value.state.replaceSelection(a)),W=a=>t.value.dispatch({selection:{anchor:a}}),G=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),I=(a,n)=>t.value.dispatch({selection:i.EditorSelection.create(a,n)}),Z=a=>t.value.dispatch({selection:i.EditorSelection.create(v.value.ranges.map(n=>n.extend(a(n))))}),p={editor:o,view:t,cursor:h,selection:v,focus:g,length:w,json:j,diagnosticCount:m,dom:t.value.contentDOM,lint:_,forceReconfigure:L,getRange:N,getLine:U,lineCount:z,getCursor:T,listSelections:R,getSelection:F,getSelections:J,somethingSelected:x,replaceRange:A,replaceSelection:P,setCursor:W,setSelection:G,setSelections:I,extendSelectionsBy:Z};return r.expose(p),p},render(){return b(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?b("aside",{style:"display: none;","aria-hidden":"true"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);return u.Meta=M,u.default=C,u.install=B,Object.defineProperty(u,"__esModule",{value:!0}),u}({},commands,language,lint,state,view,codemirror,VueDemi);
12
+ var CodeMirror=function(u,E,V,f,i,r,y,l){"use strict";const O={version:"1.3.6",date:"2024-11-05T16:13:38.583Z"},M=e=>e?Object.entries(e).reduce((c,[o,s])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...c,[o]:s}),{}):{};function b(e,c={},o){if(l.isVue2)return l.h(e,c,o);const{props:s,domProps:t,on:v,...g}=c,h=v?M(v):{};return l.h(e,{...g,...s,...t,...h},o)}const $=e=>typeof e=="function"?e():e;var C=l.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},tag:{type:String,default:"div"}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,c){const o=l.ref(),s=l.ref(e.modelValue),t=l.shallowRef(new r.EditorView),v=l.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),g=l.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),h=l.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=l.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(i.EditorState.fromJSON(a))}),w=l.ref(0),m=l.ref(0),S=l.computed(()=>{const a=new i.Compartment,n=new i.Compartment;if(e.basic&&e.minimal)throw"[Vue CodeMirror] Both basic and minimal cannot be specified.";return[e.basic&&!e.minimal?y.basicSetup:void 0,e.minimal&&!e.basic?y.minimalSetup:void 0,r.EditorView.updateListener.of(d=>{c.emit("focus",t.value.hasFocus),w.value=t.value.state.doc?.length,!(d.changes.empty||!d.docChanged)&&(e.linter&&(e.forceLinting&&f.forceLinting(t.value),m.value=e.linter(t.value).length),c.emit("update",d))}),r.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?r.EditorView.lineWrapping:void 0,e.tab?r.keymap.of([E.indentWithTab]):void 0,e.indentUnit?V.indentUnit.of(e.indentUnit):void 0,i.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(i.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?i.EditorState.phrases.of(e.phrases):void 0,i.EditorState.readOnly.of(e.readonly),r.EditorView.editable.of(!e.disabled),e.lineSeparator?i.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?f.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?f.lintGutter(e.gutterConfig):void 0,e.placeholder?r.placeholder(e.placeholder):void 0,...e.extensions].filter(d=>!!d)});l.watch(S,a=>{t.value?.dispatch({effects:i.StateEffect.reconfigure.of(a)})},{immediate:!0}),l.watch(()=>e.modelValue,async a=>{if(t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
13
+ `)===a)return;const n=!t.value.state.selection.ranges.every(d=>d.anchor<a.length&&d.head<a.length);t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:n?{anchor:0,head:0}:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),l.onMounted(async()=>{let a=s.value;o.value&&(o.value.childNodes[0]&&(s.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=o.value.childNodes[0].innerText.trim()),t.value=new r.EditorView({parent:o.value,state:i.EditorState.create({doc:a,extensions:S.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(c.emit("update:modelValue",n.state.doc.toString()??""),c.emit("change",n.state))}}),await l.nextTick(),c.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),l.onUnmounted(()=>{t.value.destroy(),c.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&f.forceLinting(t.value),m.value=f.diagnosticCount(t.value.state))},L=()=>{t.value?.dispatch({effects:i.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:i.StateEffect.appendConfig.of(S.value)})},N=(a,n)=>t.value.state.sliceDoc(a,n),U=a=>t.value.state.doc.line(a+1).text,z=()=>t.value.state.doc.lines,R=()=>t.value.state.selection.main.head,T=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},F=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},J=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},x=()=>t.value.state.selection.ranges.some(a=>!a.empty),A=(a,n,d)=>t.value.dispatch({changes:{from:n,to:d,insert:a}}),P=a=>t.value.dispatch(t.value.state.replaceSelection(a)),W=a=>t.value.dispatch({selection:{anchor:a}}),G=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),I=(a,n)=>t.value.dispatch({selection:i.EditorSelection.create(a,n)}),Z=a=>t.value.dispatch({selection:i.EditorSelection.create(g.value.ranges.map(n=>n.extend(a(n))))}),p={editor:o,view:t,cursor:h,selection:g,focus:v,length:w,json:j,diagnosticCount:m,dom:t.value.contentDOM,lint:_,forceReconfigure:L,getRange:N,getLine:U,lineCount:z,getCursor:R,listSelections:T,getSelection:F,getSelections:J,somethingSelected:x,replaceRange:A,replaceSelection:P,setCursor:W,setSelection:G,setSelections:I,extendSelectionsBy:Z};return c.expose(p),p},render(){return b(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?b("aside",{style:"display: none;","aria-hidden":"true"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);return u.Meta=O,u.default=C,u.install=B,Object.defineProperty(u,"__esModule",{value:!0}),u}({},commands,language,lint,state,view,codemirror,VueDemi);
package/dist/index.umd.js CHANGED
@@ -5,9 +5,9 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.2
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
12
- (function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("@codemirror/commands"),require("@codemirror/language"),require("@codemirror/lint"),require("@codemirror/state"),require("@codemirror/view"),require("codemirror"),require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","@codemirror/commands","@codemirror/language","@codemirror/lint","@codemirror/state","@codemirror/view","codemirror","vue-demi"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.CodeMirror={},l.commands,l.language,l.lint,l.state,l.view,l.codemirror,l.VueDemi))})(this,function(l,f,V,v,r,c,p,i){"use strict";var M={version:"1.3.2",date:"2024-06-10T11:57:17.342Z"};const O=e=>e?Object.entries(e).reduce((d,[o,u])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...d,[o]:u}),{}):{};function w(e,d={},o){if(i.isVue2)return i.h(e,d,o);const{props:u,domProps:t,on:h,...m}=d,g=h?O(h):{};return i.h(e,{...m,...u,...t,...g},o)}const $=e=>typeof e=="function"?e():e;var C=i.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},tag:{type:String,default:"div"}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,d){const o=i.ref(),u=i.ref(e.modelValue),t=i.shallowRef(new c.EditorView),h=i.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),m=i.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),g=i.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=i.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(r.EditorState.fromJSON(a))}),b=i.ref(0),S=i.ref(0),y=i.computed(()=>{const a=new r.Compartment,n=new r.Compartment;if(e.basic&&e.minimal)throw"[Vue CodeMirror] Both basic and minimal cannot be specified.";return[e.basic&&!e.minimal?p.basicSetup:void 0,e.minimal&&!e.basic?p.minimalSetup:void 0,c.EditorView.updateListener.of(s=>{d.emit("focus",t.value.hasFocus),b.value=t.value.state.doc?.length,!(s.changes.empty||!s.docChanged)&&(e.linter&&(e.forceLinting&&v.forceLinting(t.value),S.value=e.linter(t.value).length),d.emit("update",s))}),c.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?c.EditorView.lineWrapping:void 0,e.tab?c.keymap.of([f.indentWithTab]):void 0,e.indentUnit?V.indentUnit.of(e.indentUnit):void 0,r.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(r.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?r.EditorState.phrases.of(e.phrases):void 0,r.EditorState.readOnly.of(e.readonly),c.EditorView.editable.of(!e.disabled),e.lineSeparator?r.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?v.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?v.lintGutter(e.gutterConfig):void 0,e.placeholder?c.placeholder(e.placeholder):void 0,...e.extensions].filter(s=>!!s)});i.watch(y,a=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of(a)})},{immediate:!0}),i.watch(()=>e.modelValue,async a=>{t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
13
- `)===a||m.value.ranges.every(n=>n.anchor<a.length&&n.head<a.length)&&t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),i.onMounted(async()=>{let a=u.value;o.value&&(o.value.childNodes[0]&&(u.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=o.value.childNodes[0].innerText.trim()),t.value=new c.EditorView({parent:o.value,state:r.EditorState.create({doc:a,extensions:y.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(d.emit("update:modelValue",n.state.doc.toString()??""),d.emit("change",n.state))}}),await i.nextTick(),d.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),i.onUnmounted(()=>{t.value.destroy(),d.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&v.forceLinting(t.value),S.value=v.diagnosticCount(t.value.state))},q=()=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:r.StateEffect.appendConfig.of(y.value)})},L=(a,n)=>t.value.state.sliceDoc(a,n),T=a=>t.value.state.doc.line(a+1).text,x=()=>t.value.state.doc.lines,N=()=>t.value.state.selection.main.head,U=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},z=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},R=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},F=()=>t.value.state.selection.ranges.some(a=>!a.empty),J=(a,n,s)=>t.value.dispatch({changes:{from:n,to:s,insert:a}}),A=a=>t.value.dispatch(t.value.state.replaceSelection(a)),P=a=>t.value.dispatch({selection:{anchor:a}}),W=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),G=(a,n)=>t.value.dispatch({selection:r.EditorSelection.create(a,n)}),I=a=>t.value.dispatch({selection:r.EditorSelection.create(m.value.ranges.map(n=>n.extend(a(n))))}),E={editor:o,view:t,cursor:g,selection:m,focus:h,length:b,json:j,diagnosticCount:S,dom:t.value.contentDOM,lint:_,forceReconfigure:q,getRange:L,getLine:T,lineCount:x,getCursor:N,listSelections:U,getSelection:z,getSelections:R,somethingSelected:F,replaceRange:J,replaceSelection:A,setCursor:P,setSelection:W,setSelections:G,extendSelectionsBy:I};return d.expose(E),E},render(){return w(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?w("aside",{style:"display: none;","aria-hidden":"true"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);l.Meta=M,l.default=C,l.install=B,Object.defineProperty(l,"__esModule",{value:!0})});
12
+ (function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("@codemirror/commands"),require("@codemirror/language"),require("@codemirror/lint"),require("@codemirror/state"),require("@codemirror/view"),require("codemirror"),require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","@codemirror/commands","@codemirror/language","@codemirror/lint","@codemirror/state","@codemirror/view","codemirror","vue-demi"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.CodeMirror={},l.commands,l.language,l.lint,l.state,l.view,l.codemirror,l.VueDemi))})(this,function(l,f,V,v,r,s,p,i){"use strict";const O={version:"1.3.6",date:"2024-11-05T16:13:38.583Z"},M=e=>e?Object.entries(e).reduce((d,[o,u])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...d,[o]:u}),{}):{};function w(e,d={},o){if(i.isVue2)return i.h(e,d,o);const{props:u,domProps:t,on:m,...h}=d,g=m?M(m):{};return i.h(e,{...h,...u,...t,...g},o)}const $=e=>typeof e=="function"?e():e;var C=i.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},tag:{type:String,default:"div"}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,d){const o=i.ref(),u=i.ref(e.modelValue),t=i.shallowRef(new s.EditorView),m=i.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),h=i.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),g=i.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=i.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(r.EditorState.fromJSON(a))}),b=i.ref(0),S=i.ref(0),y=i.computed(()=>{const a=new r.Compartment,n=new r.Compartment;if(e.basic&&e.minimal)throw"[Vue CodeMirror] Both basic and minimal cannot be specified.";return[e.basic&&!e.minimal?p.basicSetup:void 0,e.minimal&&!e.basic?p.minimalSetup:void 0,s.EditorView.updateListener.of(c=>{d.emit("focus",t.value.hasFocus),b.value=t.value.state.doc?.length,!(c.changes.empty||!c.docChanged)&&(e.linter&&(e.forceLinting&&v.forceLinting(t.value),S.value=e.linter(t.value).length),d.emit("update",c))}),s.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?s.EditorView.lineWrapping:void 0,e.tab?s.keymap.of([f.indentWithTab]):void 0,e.indentUnit?V.indentUnit.of(e.indentUnit):void 0,r.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(r.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?r.EditorState.phrases.of(e.phrases):void 0,r.EditorState.readOnly.of(e.readonly),s.EditorView.editable.of(!e.disabled),e.lineSeparator?r.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?v.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?v.lintGutter(e.gutterConfig):void 0,e.placeholder?s.placeholder(e.placeholder):void 0,...e.extensions].filter(c=>!!c)});i.watch(y,a=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of(a)})},{immediate:!0}),i.watch(()=>e.modelValue,async a=>{if(t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
13
+ `)===a)return;const n=!t.value.state.selection.ranges.every(c=>c.anchor<a.length&&c.head<a.length);t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:n?{anchor:0,head:0}:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),i.onMounted(async()=>{let a=u.value;o.value&&(o.value.childNodes[0]&&(u.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=o.value.childNodes[0].innerText.trim()),t.value=new s.EditorView({parent:o.value,state:r.EditorState.create({doc:a,extensions:y.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(d.emit("update:modelValue",n.state.doc.toString()??""),d.emit("change",n.state))}}),await i.nextTick(),d.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),i.onUnmounted(()=>{t.value.destroy(),d.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&v.forceLinting(t.value),S.value=v.diagnosticCount(t.value.state))},q=()=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:r.StateEffect.appendConfig.of(y.value)})},L=(a,n)=>t.value.state.sliceDoc(a,n),T=a=>t.value.state.doc.line(a+1).text,x=()=>t.value.state.doc.lines,N=()=>t.value.state.selection.main.head,U=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},z=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},R=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},F=()=>t.value.state.selection.ranges.some(a=>!a.empty),J=(a,n,c)=>t.value.dispatch({changes:{from:n,to:c,insert:a}}),A=a=>t.value.dispatch(t.value.state.replaceSelection(a)),P=a=>t.value.dispatch({selection:{anchor:a}}),W=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),G=(a,n)=>t.value.dispatch({selection:r.EditorSelection.create(a,n)}),I=a=>t.value.dispatch({selection:r.EditorSelection.create(h.value.ranges.map(n=>n.extend(a(n))))}),E={editor:o,view:t,cursor:g,selection:h,focus:m,length:b,json:j,diagnosticCount:S,dom:t.value.contentDOM,lint:_,forceReconfigure:q,getRange:L,getLine:T,lineCount:x,getCursor:N,listSelections:U,getSelection:z,getSelections:R,somethingSelected:F,replaceRange:J,replaceSelection:A,setCursor:P,setSelection:W,setSelections:G,extendSelectionsBy:I};return d.expose(E),E},render(){return w(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?w("aside",{style:"display: none;","aria-hidden":"true"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);l.Meta=O,l.default=C,l.install=B,Object.defineProperty(l,"__esModule",{value:!0})});
@@ -1,4 +1,4 @@
1
1
  import { default as MetaInterface } from './interfaces/MetaInterface';
2
-
3
2
  declare const meta: MetaInterface;
4
3
  export default meta;
4
+ //# sourceMappingURL=Meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAC;AAG5D,QAAA,MAAM,IAAI,EAAE,aAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,496 @@
1
+ import { LanguageSupport } from '@codemirror/language';
2
+ import { LintSource } from '@codemirror/lint';
3
+ import { EditorSelection, EditorState, Extension, SelectionRange, StateField, Text } from '@codemirror/state';
4
+ import { EditorView, ViewUpdate } from '@codemirror/view';
5
+ import { PropType, Ref, ShallowRef, WritableComputedRef } from 'vue-demi';
6
+ import { StyleSpec } from 'style-mod';
7
+ /** CodeMirror Component */
8
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
9
+ /** Model value */
10
+ modelValue: {
11
+ type: PropType<string | Text>;
12
+ default: string;
13
+ };
14
+ /**
15
+ * Theme
16
+ *
17
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
18
+ */
19
+ theme: {
20
+ type: PropType<Record<string, StyleSpec>>;
21
+ default: () => {};
22
+ };
23
+ /** Dark Mode */
24
+ dark: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ /**
29
+ * Use Basic Setup
30
+ *
31
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
32
+ */
33
+ basic: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ /**
38
+ * Use Minimal Setup (The basic setting has priority.)
39
+ *
40
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
41
+ */
42
+ minimal: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ /**
47
+ * Placeholder
48
+ *
49
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
50
+ */
51
+ placeholder: {
52
+ type: PropType<string | HTMLElement>;
53
+ default: undefined;
54
+ };
55
+ /**
56
+ * Line wrapping
57
+ *
58
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
59
+ *
60
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
61
+ */
62
+ wrap: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ /**
67
+ * Allow tab key indent.
68
+ *
69
+ * @see {@link https://codemirror.net/examples/tab/}
70
+ */
71
+ tab: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ /**
76
+ * Tab character
77
+ */
78
+ indentUnit: {
79
+ type: StringConstructor;
80
+ default: undefined;
81
+ };
82
+ /**
83
+ * Allow Multiple Selection.
84
+ *
85
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
86
+ */
87
+ allowMultipleSelections: {
88
+ type: BooleanConstructor;
89
+ default: boolean;
90
+ };
91
+ /**
92
+ * Tab size
93
+ *
94
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
95
+ */
96
+ tabSize: {
97
+ type: NumberConstructor;
98
+ default: undefined;
99
+ };
100
+ /**
101
+ * Set line break (separetor) char.
102
+ *
103
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
104
+ */
105
+ lineSeparator: {
106
+ type: StringConstructor;
107
+ default: undefined;
108
+ };
109
+ /**
110
+ * Readonly
111
+ *
112
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
113
+ */
114
+ readonly: {
115
+ type: BooleanConstructor;
116
+ default: boolean;
117
+ };
118
+ /**
119
+ * Disable input.
120
+ *
121
+ * This is the reversed value of the CodeMirror editable.
122
+ * Similar to `readonly`, but setting this value to true disables dragging.
123
+ *
124
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
125
+ */
126
+ disabled: {
127
+ type: BooleanConstructor;
128
+ default: boolean;
129
+ };
130
+ /**
131
+ * Additional Extension
132
+ *
133
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
134
+ */
135
+ extensions: {
136
+ type: PropType<Extension[]>;
137
+ default: () => never[];
138
+ };
139
+ /**
140
+ * Language Phreses
141
+ *
142
+ * @see {@link https://codemirror.net/examples/translate/}
143
+ */
144
+ phrases: {
145
+ type: PropType<Record<string, string>>;
146
+ default: () => undefined;
147
+ };
148
+ /**
149
+ * CodeMirror Language
150
+ *
151
+ * @see {@link https://codemirror.net/docs/ref/#language}
152
+ */
153
+ lang: {
154
+ type: PropType<LanguageSupport>;
155
+ default: () => undefined;
156
+ };
157
+ /**
158
+ * CodeMirror Linter
159
+ *
160
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
161
+ */
162
+ linter: {
163
+ type: PropType<LintSource | any>;
164
+ default: undefined;
165
+ };
166
+ /**
167
+ * Linter Config
168
+ *
169
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
170
+ */
171
+ linterConfig: {
172
+ type: ObjectConstructor;
173
+ default: () => {};
174
+ };
175
+ /**
176
+ * Forces any linters configured to run when the editor is idle to run right away.
177
+ *
178
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
179
+ */
180
+ forceLinting: {
181
+ type: BooleanConstructor;
182
+ default: boolean;
183
+ };
184
+ /**
185
+ * Show Linter Gutter
186
+ *
187
+ * An area to 🔴 the lines with errors will be displayed.
188
+ * This feature is not enabled if `linter` is not specified.
189
+ *
190
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
191
+ */
192
+ gutter: {
193
+ type: BooleanConstructor;
194
+ default: boolean;
195
+ };
196
+ /**
197
+ * Gutter Config
198
+ *
199
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
200
+ */
201
+ gutterConfig: {
202
+ type: ObjectConstructor;
203
+ default: () => undefined;
204
+ };
205
+ /**
206
+ * Using tag
207
+ */
208
+ tag: {
209
+ type: StringConstructor;
210
+ default: string;
211
+ };
212
+ }>, {
213
+ editor: Ref<HTMLElement | undefined, HTMLElement | undefined>;
214
+ view: ShallowRef<EditorView>;
215
+ cursor: WritableComputedRef<number, number>;
216
+ selection: WritableComputedRef<EditorSelection, EditorSelection>;
217
+ focus: WritableComputedRef<boolean, boolean>;
218
+ length: Ref<number, number>;
219
+ json: WritableComputedRef<Record<string, StateField<any>>, Record<string, StateField<any>>>;
220
+ diagnosticCount: Ref<number, number>;
221
+ dom: HTMLElement;
222
+ lint: () => void;
223
+ forceReconfigure: () => void;
224
+ getRange: (from?: number, to?: number) => string | undefined;
225
+ getLine: (number: number) => string;
226
+ lineCount: () => number;
227
+ getCursor: () => number;
228
+ listSelections: () => readonly SelectionRange[];
229
+ getSelection: () => string;
230
+ getSelections: () => string[];
231
+ somethingSelected: () => boolean;
232
+ replaceRange: (replacement: string | Text, from: number, to: number) => void;
233
+ replaceSelection: (replacement: string | Text) => void;
234
+ setCursor: (position: number) => void;
235
+ setSelection: (anchor: number, head?: number) => void;
236
+ setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
237
+ extendSelectionsBy: (f: any) => void;
238
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
239
+ /** Model Update */
240
+ 'update:modelValue': (_value?: string | Text) => true;
241
+ /** CodeMirror ViewUpdate */
242
+ update: (_value: ViewUpdate) => true;
243
+ /** CodeMirror onReady */
244
+ ready: (_value: {
245
+ view: EditorView;
246
+ state: EditorState;
247
+ container: HTMLElement;
248
+ }) => true;
249
+ /** CodeMirror onFocus */
250
+ focus: (_value: boolean) => true;
251
+ /** State Changed */
252
+ change: (_value: EditorState) => true;
253
+ /** CodeMirror onDestroy */
254
+ destroy: () => true;
255
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
256
+ /** Model value */
257
+ modelValue: {
258
+ type: PropType<string | Text>;
259
+ default: string;
260
+ };
261
+ /**
262
+ * Theme
263
+ *
264
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
265
+ */
266
+ theme: {
267
+ type: PropType<Record<string, StyleSpec>>;
268
+ default: () => {};
269
+ };
270
+ /** Dark Mode */
271
+ dark: {
272
+ type: BooleanConstructor;
273
+ default: boolean;
274
+ };
275
+ /**
276
+ * Use Basic Setup
277
+ *
278
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
279
+ */
280
+ basic: {
281
+ type: BooleanConstructor;
282
+ default: boolean;
283
+ };
284
+ /**
285
+ * Use Minimal Setup (The basic setting has priority.)
286
+ *
287
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
288
+ */
289
+ minimal: {
290
+ type: BooleanConstructor;
291
+ default: boolean;
292
+ };
293
+ /**
294
+ * Placeholder
295
+ *
296
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
297
+ */
298
+ placeholder: {
299
+ type: PropType<string | HTMLElement>;
300
+ default: undefined;
301
+ };
302
+ /**
303
+ * Line wrapping
304
+ *
305
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
306
+ *
307
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
308
+ */
309
+ wrap: {
310
+ type: BooleanConstructor;
311
+ default: boolean;
312
+ };
313
+ /**
314
+ * Allow tab key indent.
315
+ *
316
+ * @see {@link https://codemirror.net/examples/tab/}
317
+ */
318
+ tab: {
319
+ type: BooleanConstructor;
320
+ default: boolean;
321
+ };
322
+ /**
323
+ * Tab character
324
+ */
325
+ indentUnit: {
326
+ type: StringConstructor;
327
+ default: undefined;
328
+ };
329
+ /**
330
+ * Allow Multiple Selection.
331
+ *
332
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
333
+ */
334
+ allowMultipleSelections: {
335
+ type: BooleanConstructor;
336
+ default: boolean;
337
+ };
338
+ /**
339
+ * Tab size
340
+ *
341
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
342
+ */
343
+ tabSize: {
344
+ type: NumberConstructor;
345
+ default: undefined;
346
+ };
347
+ /**
348
+ * Set line break (separetor) char.
349
+ *
350
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
351
+ */
352
+ lineSeparator: {
353
+ type: StringConstructor;
354
+ default: undefined;
355
+ };
356
+ /**
357
+ * Readonly
358
+ *
359
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
360
+ */
361
+ readonly: {
362
+ type: BooleanConstructor;
363
+ default: boolean;
364
+ };
365
+ /**
366
+ * Disable input.
367
+ *
368
+ * This is the reversed value of the CodeMirror editable.
369
+ * Similar to `readonly`, but setting this value to true disables dragging.
370
+ *
371
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
372
+ */
373
+ disabled: {
374
+ type: BooleanConstructor;
375
+ default: boolean;
376
+ };
377
+ /**
378
+ * Additional Extension
379
+ *
380
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
381
+ */
382
+ extensions: {
383
+ type: PropType<Extension[]>;
384
+ default: () => never[];
385
+ };
386
+ /**
387
+ * Language Phreses
388
+ *
389
+ * @see {@link https://codemirror.net/examples/translate/}
390
+ */
391
+ phrases: {
392
+ type: PropType<Record<string, string>>;
393
+ default: () => undefined;
394
+ };
395
+ /**
396
+ * CodeMirror Language
397
+ *
398
+ * @see {@link https://codemirror.net/docs/ref/#language}
399
+ */
400
+ lang: {
401
+ type: PropType<LanguageSupport>;
402
+ default: () => undefined;
403
+ };
404
+ /**
405
+ * CodeMirror Linter
406
+ *
407
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
408
+ */
409
+ linter: {
410
+ type: PropType<LintSource | any>;
411
+ default: undefined;
412
+ };
413
+ /**
414
+ * Linter Config
415
+ *
416
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
417
+ */
418
+ linterConfig: {
419
+ type: ObjectConstructor;
420
+ default: () => {};
421
+ };
422
+ /**
423
+ * Forces any linters configured to run when the editor is idle to run right away.
424
+ *
425
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
426
+ */
427
+ forceLinting: {
428
+ type: BooleanConstructor;
429
+ default: boolean;
430
+ };
431
+ /**
432
+ * Show Linter Gutter
433
+ *
434
+ * An area to 🔴 the lines with errors will be displayed.
435
+ * This feature is not enabled if `linter` is not specified.
436
+ *
437
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
438
+ */
439
+ gutter: {
440
+ type: BooleanConstructor;
441
+ default: boolean;
442
+ };
443
+ /**
444
+ * Gutter Config
445
+ *
446
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
447
+ */
448
+ gutterConfig: {
449
+ type: ObjectConstructor;
450
+ default: () => undefined;
451
+ };
452
+ /**
453
+ * Using tag
454
+ */
455
+ tag: {
456
+ type: StringConstructor;
457
+ default: string;
458
+ };
459
+ }>> & Readonly<{
460
+ onChange?: ((_value: EditorState) => any) | undefined;
461
+ onFocus?: ((_value: boolean) => any) | undefined;
462
+ "onUpdate:modelValue"?: ((_value?: string | Text | undefined) => any) | undefined;
463
+ onUpdate?: ((_value: ViewUpdate) => any) | undefined;
464
+ onReady?: ((_value: {
465
+ view: EditorView;
466
+ state: EditorState;
467
+ container: HTMLElement;
468
+ }) => any) | undefined;
469
+ onDestroy?: (() => any) | undefined;
470
+ }>, {
471
+ modelValue: string | Text;
472
+ theme: Record<string, StyleSpec>;
473
+ dark: boolean;
474
+ basic: boolean;
475
+ minimal: boolean;
476
+ placeholder: string | HTMLElement;
477
+ wrap: boolean;
478
+ tab: boolean;
479
+ indentUnit: string;
480
+ allowMultipleSelections: boolean;
481
+ tabSize: number;
482
+ lineSeparator: string;
483
+ readonly: boolean;
484
+ disabled: boolean;
485
+ extensions: Extension[];
486
+ phrases: Record<string, string>;
487
+ lang: LanguageSupport;
488
+ linter: any;
489
+ linterConfig: Record<string, any>;
490
+ forceLinting: boolean;
491
+ gutter: boolean;
492
+ gutterConfig: Record<string, any>;
493
+ tag: string;
494
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
495
+ export default _default;
496
+ //# sourceMappingURL=CodeMirror.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeMirror.d.ts","sourceRoot":"","sources":["../../../src/components/CodeMirror.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,eAAe,EACf,WAAW,EAGX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,IAAI,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,UAAU,EAGV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAUL,KAAK,QAAQ,EACb,KAAK,GAAG,EACR,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,2BAA2B;;IAWvB,kBAAkB;;cAEA,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGzC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;;;IAKrD,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC;;;IAGhD;;;;;;OAMG;;;;;IAKH;;;;OAIG;;;;;IAKH;;OAEG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;;;;OAOG;;;;;IAKH;;;;OAIG;;cAEc,QAAQ,CAAC,SAAS,EAAE,CAAC;;;IAKtC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD;;;;OAIG;;cAEe,QAAQ,CAAC,eAAe,CAAC;;;IAG3C;;;;OAIG;;cAEiB,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC;;;IAG9C;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAKH;;;;;;;OAOG;;;;;IAKH;;;;OAIG;;;;;IAKH;;OAEG;;;;;;;;;;;;;;;gBA8Qc,IAAI;4BAeQ,IAAI;sBAmBR,MAAM,OAAO,MAAM,KAAG,MAAM,GAAG,SAAS;sBAOxC,MAAM,KAAG,MAAM;qBAGlB,MAAM;qBAEN,MAAM;0BAED,SAAS,cAAc,EAAE;wBAQ3B,MAAM;yBAaL,MAAM,EAAE;6BAWJ,OAAO;gCAatB,MAAM,GAAG,IAAI,QACpB,MAAM,MACR,MAAM,KACT,IAAI;oCAUgC,MAAM,GAAG,IAAI,KAAG,IAAI;0BAO9B,MAAM,KAAG,IAAI;2BAQZ,MAAM,SAAS,MAAM,KAAG,IAAI;4BAShD,SAAS,cAAc,EAAE,YACvB,MAAM,KACf,IAAI;4BASwB,GAAG,KAAG,IAAI;;IAnZzC,mBAAmB;mCACW,MAAM,GAAG,IAAI;IAC3C,4BAA4B;qBACX,UAAU;IAC3B,yBAAyB;oBACT;QACd,IAAI,EAAE,UAAU,CAAC;QACjB,KAAK,EAAE,WAAW,CAAC;QACnB,SAAS,EAAE,WAAW,CAAC;KACxB;IACD,yBAAyB;oBACT,OAAO;IACvB,oBAAoB;qBACH,WAAW;IAC5B,2BAA2B;;;IAlO3B,kBAAkB;;cAEA,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGzC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;;;IAKrD,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC;;;IAGhD;;;;;;OAMG;;;;;IAKH;;;;OAIG;;;;;IAKH;;OAEG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;;;;OAOG;;;;;IAKH;;;;OAIG;;cAEc,QAAQ,CAAC,SAAS,EAAE,CAAC;;;IAKtC;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD;;;;OAIG;;cAEe,QAAQ,CAAC,eAAe,CAAC;;;IAG3C;;;;OAIG;;cAEiB,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC;;;IAG9C;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAKH;;;;;;;OAOG;;;;;IAKH;;;;OAIG;;;;;IAKH;;OAEG;;;;;;;;;;;cAcK,UAAU;eACT,WAAW;mBACP,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAtO5B,wBA+qBG"}
@@ -0,0 +1,16 @@
1
+ import { Slots, VNode, VNodeProps } from 'vue-demi';
2
+ interface Options extends VNodeProps {
3
+ class?: string;
4
+ domProps?: VNodeProps;
5
+ on?: Record<string, () => void>;
6
+ props?: VNodeProps;
7
+ style?: string;
8
+ 'aria-hidden'?: string;
9
+ }
10
+ /**
11
+ * hDemi function.
12
+ */
13
+ export default function h(type: string | Record<any, any>, options?: Options, chidren?: any): VNode;
14
+ export declare const slot: (defaultSlots: any) => Slots;
15
+ export {};
16
+ //# sourceMappingURL=h-demi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"h-demi.d.ts","sourceRoot":"","sources":["../../../src/helpers/h-demi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAElB,UAAU,OAAQ,SAAQ,UAAU;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAaD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,CAAC,CACvB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAC/B,OAAO,GAAE,OAAY,EACrB,OAAO,CAAC,EAAE,GAAG,GACZ,KAAK,CAcP;AAED,eAAO,MAAM,IAAI,iBAAkB,GAAG,KAAG,KAC2B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { default as Meta } from './Meta';
2
2
  import { default as CodeMirror } from './components/CodeMirror';
3
-
4
3
  declare const installCodeMirror: (app: any) => void;
5
4
  export { CodeMirror as default, installCodeMirror as install, Meta };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAGjD,QAAA,MAAM,iBAAiB,QAAS,GAAG,KAAG,IACG,CAAC;AAE1C,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Build information meta data */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build date */
6
+ date: string;
7
+ }
8
+ //# sourceMappingURL=MetaInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetaInterface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/MetaInterface.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,MAAM,CAAC,OAAO,WAAW,aAAa;IACpC,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "vue-codemirror6",
4
- "version": "1.3.3",
4
+ "version": "1.3.6",
5
5
  "license": "MIT",
6
6
  "description": "CodeMirror6 Component for vue2 and vue3.",
7
7
  "keywords": [
@@ -36,12 +36,12 @@
36
36
  },
37
37
  "main": "dist/index.umd.js",
38
38
  "module": "dist/index.es.js",
39
- "types": "dist/index.d.ts",
39
+ "types": "dist/src/index.d.ts",
40
40
  "exports": {
41
41
  ".": {
42
42
  "import": "./dist/index.es.js",
43
43
  "require": "./dist/index.umd.js",
44
- "types": "./dist/index.d.ts"
44
+ "types": "./dist/src/index.d.ts"
45
45
  }
46
46
  },
47
47
  "files": [
@@ -53,9 +53,9 @@
53
53
  "./sfc": "./src/components/CodeMirror.ts"
54
54
  },
55
55
  "engines": {
56
- "yarn": ">=1.22.19"
56
+ "pnpm": ">=9.12.3"
57
57
  },
58
- "packageManager": "yarn@4.3.1",
58
+ "packageManager": "pnpm@9.12.3",
59
59
  "sideEffects": false,
60
60
  "scripts": {
61
61
  "dev": "vite",
@@ -67,58 +67,67 @@
67
67
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
68
68
  "preview": "vite preview --mode=docs",
69
69
  "build-only": "vite build",
70
- "type-check": "vue-tsc --build --force",
71
- "prepare": "husky install",
70
+ "type-check": "vue-tsc --declaration --emitDeclarationOnly",
71
+ "prepare": "husky",
72
72
  "version": "auto-changelog -p && git add CHANGELOG.md"
73
73
  },
74
74
  "dependencies": {
75
+ "@codemirror/commands": "^6.7.1",
76
+ "@codemirror/language": "^6.10.3",
77
+ "@codemirror/lint": "^6.8.2",
78
+ "@codemirror/state": "^6.4.1",
79
+ "@codemirror/view": "^6.34.2",
75
80
  "codemirror": "^6.0.1",
81
+ "style-mod": "^4.1.2",
82
+ "vue-codemirror6": "file:",
76
83
  "vue-demi": "latest"
77
84
  },
78
85
  "peerDependencies": {
79
86
  "vue": "^2.7.14 || ^3.4"
80
87
  },
81
88
  "devDependencies": {
89
+ "@codemirror/autocomplete": "^6.18.2",
82
90
  "@codemirror/lang-javascript": "^6.2.2",
83
91
  "@codemirror/lang-json": "^6.0.1",
84
- "@codemirror/lang-markdown": "^6.2.5",
85
- "@codemirror/lang-vue": "0.1.2",
86
- "@eslint/js": "^9.6.0",
87
- "@tsconfig/node-lts": "^20.1.3",
88
- "@types/node": "^20.14.10",
89
- "@typescript-eslint/eslint-plugin": "^7.16.0",
90
- "@vitejs/plugin-vue": "^5.0.5",
91
- "@vue/compiler-sfc": "^3.4.31",
92
- "@vue/eslint-config-prettier": "^9.0.0",
92
+ "@codemirror/lang-markdown": "^6.3.0",
93
+ "@codemirror/lang-vue": "^0.1.3",
94
+ "@codemirror/search": "^6.5.7",
95
+ "@eslint/js": "^9.14.0",
96
+ "@tsconfig/node-lts": "^22.0.0",
97
+ "@types/node": "^22.9.0",
98
+ "@typescript-eslint/eslint-plugin": "^8.13.0",
99
+ "@vitejs/plugin-vue": "^5.1.4",
100
+ "@vue/compiler-sfc": "^3.5.12",
101
+ "@vue/eslint-config-prettier": "^10.1.0",
93
102
  "@vue/tsconfig": "^0.5.1",
94
- "@vueuse/core": "^10.11.0",
103
+ "@vueuse/core": "^11.2.0",
95
104
  "bootstrap": "^5.3.3",
96
- "eslint": "^9.6.0",
105
+ "eslint": "^9.14.0",
97
106
  "eslint-import-resolver-alias": "^1.1.2",
98
- "eslint-import-resolver-typescript": "^3.6.1",
99
- "eslint-linter-browserify": "^9.6.0",
100
- "eslint-plugin-import": "^2.29.1",
107
+ "eslint-import-resolver-typescript": "^3.6.3",
108
+ "eslint-linter-browserify": "^9.14.0",
109
+ "eslint-plugin-import": "^2.31.0",
101
110
  "eslint-plugin-tsdoc": "^0.3.0",
102
- "eslint-plugin-vue": "^9.27.0",
103
- "eslint-plugin-vuejs-accessibility": "^2.3.1",
111
+ "eslint-plugin-vue": "^9.30.0",
112
+ "eslint-plugin-vuejs-accessibility": "^2.4.1",
104
113
  "eslint-plugin-yaml": "^1.0.3",
105
- "husky": "^9.0.11",
106
- "lint-staged": "^15.2.7",
114
+ "husky": "^9.1.6",
115
+ "lint-staged": "^15.2.10",
107
116
  "npm-run-all": "^4.1.5",
108
- "prettier": "^3.3.2",
117
+ "prettier": "^3.3.3",
109
118
  "rimraf": "^6.0.1",
110
119
  "rollup-plugin-visualizer": "^5.12.0",
111
- "sass": "^1.77.7",
112
- "typescript": "^5.5.3",
113
- "typescript-eslint": "^7.16.0",
114
- "vite": "^5.3.3",
115
- "vite-plugin-banner": "^0.7.1",
116
- "vite-plugin-checker": "^0.7.1",
117
- "vite-plugin-dts": "^3.9.1",
118
- "vue": "^3.4.31",
120
+ "sass": "^1.80.6",
121
+ "typescript": "~5.6.3",
122
+ "typescript-eslint": "^8.13.0",
123
+ "vite": "^5.4.10",
124
+ "vite-plugin-banner": "^0.8.0",
125
+ "vite-plugin-checker": "^0.8.0",
126
+ "vite-plugin-dts": "^4.3.0",
127
+ "vue": "^3.5.12",
119
128
  "vue-eslint-parser": "^9.4.3",
120
129
  "vue-markdown-wasm": "^0.4.0",
121
- "vue-tsc": "^2.0.26"
130
+ "vue-tsc": "^2.1.10"
122
131
  },
123
132
  "husky": {
124
133
  "hooks": {
@@ -462,14 +462,16 @@ export default defineComponent({
462
462
 
463
463
  // Range Fix ?
464
464
  // https://github.com/logue/vue-codemirror6/issues/27
465
- const isSelectionOutOfRange = !view.value.state.selection.ranges.every(
465
+ const isSelectionOutOfRange = !view.value.state.selection.ranges.every(
466
466
  range => range.anchor < value.length && range.head < value.length
467
- )
468
-
467
+ );
468
+
469
469
  // Update
470
470
  view.value.dispatch({
471
471
  changes: { from: 0, to: view.value.state.doc.length, insert: value },
472
- selection: isSelectionOutOfRange ? { anchor: 0, head: 0 } : view.value.state.selection,
472
+ selection: isSelectionOutOfRange
473
+ ? { anchor: 0, head: 0 }
474
+ : view.value.state.selection,
473
475
  scrollIntoView: true,
474
476
  });
475
477
  },
@@ -1,3 +0,0 @@
1
- /** CodeMirror Component */
2
- declare const _default: any;
3
- export default _default;