vue-codemirror6 0.0.3 → 0.0.4

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.
@@ -5,22 +5,23 @@
5
5
  <script lang="ts">
6
6
  import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
7
7
 
8
- import { EditorState, Extension, Transaction } from '@codemirror/state';
9
- import { EditorView, ViewUpdate } from '@codemirror/view';
10
- import type { Diagnostic } from '@codemirror/lint';
8
+ import type { Extension, Transaction } from '@codemirror/state';
11
9
  import type { LanguageSupport } from '@codemirror/language';
12
-
13
- import merge from 'lodash/merge';
10
+ import type { ViewUpdate } from '@codemirror/view';
11
+ import type { Diagnostic } from '@codemirror/lint';
12
+ import { EditorState } from '@codemirror/state';
13
+ import { EditorView } from '@codemirror/view';
14
14
  import type { StyleSpec } from 'style-mod';
15
+ import merge from 'lodash/merge';
15
16
 
16
- @Component
17
+ @Component({ name: 'CodeMirror' })
17
18
  /** CodeMirror Component */
18
19
  export default class CodeMirror extends Vue {
19
20
  /** Editor */
20
- editor!: EditorView;
21
+ private editor!: EditorView;
21
22
 
22
23
  /** Theme */
23
- @Prop({ type: Object })
24
+ @Prop({ type: Object, default: () => {} })
24
25
  readonly theme!: { [selector: string]: StyleSpec };
25
26
 
26
27
  /** Dark Mode */
@@ -74,13 +75,16 @@ export default class CodeMirror extends Vue {
74
75
  get extension(): Extension[] {
75
76
  /** Default extension */
76
77
  const ext = [
77
- EditorState.phrases.of(this.phrases),
78
78
  EditorView.updateListener.of((update: ViewUpdate) =>
79
79
  this.$emit('update', update)
80
80
  ),
81
81
  EditorView.theme(this.theme, { dark: this.dark }),
82
82
  ];
83
83
 
84
+ if (this.phrases) {
85
+ ext.push(EditorState.phrases.of(this.phrases));
86
+ }
87
+
84
88
  if (this.lang) {
85
89
  ext.push(this.lang);
86
90
  }
package/types/entry.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as namedExports from './entry.esm';
2
- declare const _default: import("vue").VueConstructor<import("vue").default> & import("vue").PluginObject<any> & typeof namedExports;
3
- export default _default;
4
- //# sourceMappingURL=entry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AACA,OAAkB,KAAK,YAAY,MAAM,aAAa,CAAC;;AASvD,wBAC0C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry.esm.d.ts","sourceRoot":"","sources":["../src/entry.esm.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAGzC,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAGpD,aAAK,oBAAoB,GAAG,OAAO,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;;AAKjE,wBASK"}