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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unlike
4
4
 
5
5
  ## Usage
6
6
 
7
- When using as a Markdown editor on Vuetify.
7
+ When using as a Markdown editor on [Vuetify](https://vuetifyjs.com/).
8
8
 
9
9
  ```vue
10
10
  <template>
@@ -14,6 +14,7 @@ When using as a Markdown editor on Vuetify.
14
14
  :phrases="phreses"
15
15
  :extensions="extensions"
16
16
  :dark="$vuetify.theme.dark"
17
+ @update="onCmUpdate"
17
18
  />
18
19
  </template>
19
20
 
@@ -25,8 +26,10 @@ import CodeMirror from 'vue-codemirror6';
25
26
 
26
27
  // CodeMirror extensions
27
28
  import { basicSetup } from '@codemirror/basic-setup';
28
- import { LanguageSupport } from '@codemirror/language';
29
29
  import { markdown } from '@codemirror/lang-markdown';
30
+ import type { ViewUpdate } from '@codemirror/view';
31
+ import type { Extension } from '@codemirror/state';
32
+ import type { LanguageSupport } from '@codemirror/language';
30
33
 
31
34
  @Component({ components: { CodeMirror } })
32
35
  export default class Home extends Vue {
@@ -81,10 +84,21 @@ export default class Home extends Vue {
81
84
  *
82
85
  * @see {@link:https://codemirror.net/6/docs/ref/#state.Extension|Extending Editor State}
83
86
  */
84
- extensions: [
87
+ extensions: Extension[] = [
85
88
  /** @see {@link:https://codemirror.net/6/docs/ref/#basic-setup|basic-setup} */
86
89
  basicSetup
87
90
  ]
91
+
92
+ /**
93
+ * CodeMirror Hook View update event
94
+ *
95
+ * @param update View Update
96
+ *
97
+ * @see {@link https://codemirror.net/6/docs/ref/#view.ViewUpdate|class ViewUpdate}
98
+ */
99
+ onCmUpdate(update: ViewUpdate) {
100
+ console.log(update)
101
+ }
88
102
  }
89
103
  ```
90
104
 
@@ -0,0 +1,37 @@
1
+ import { Vue } from 'vue-property-decorator';
2
+ import type { Extension } from '@codemirror/state';
3
+ import type { LanguageSupport } from '@codemirror/language';
4
+ import type { Diagnostic } from '@codemirror/lint';
5
+ import type { StyleSpec } from 'style-mod';
6
+ /** CodeMirror Component */
7
+ export default class CodeMirror extends Vue {
8
+ /** Editor */
9
+ private editor;
10
+ /** Theme */
11
+ readonly theme: {
12
+ [selector: string]: StyleSpec;
13
+ };
14
+ /** Dark Mode */
15
+ readonly dark: boolean;
16
+ /** Language Phreses */
17
+ readonly phrases: Record<string, string>;
18
+ /** Additional Extension */
19
+ readonly extensions: Extension[];
20
+ /** CodeMirror Language */
21
+ readonly lang: LanguageSupport;
22
+ /** CodeMirror Linter */
23
+ readonly linter: Diagnostic[];
24
+ /** Input */
25
+ readonly value: string;
26
+ /** Input value changed */
27
+ onValueChanged(): void;
28
+ /** Darkmode */
29
+ onToggleDarkMode(): void;
30
+ /** CodeMirror Extension */
31
+ get extension(): Extension[];
32
+ /** When loaded */
33
+ mounted(): void;
34
+ /** Destroy */
35
+ beforeDestroy(): void;
36
+ }
37
+ //# sourceMappingURL=CodeMirror.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeMirror.vue.d.ts","sourceRoot":"","sources":["../../src/components/CodeMirror.vue.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,GAAG,EAAS,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,2BAA2B;AAC3B,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,GAAG;IACzC,aAAa;IACb,OAAO,CAAC,MAAM,CAAc;IAE5B,YAAY;IAEZ,QAAQ,CAAC,KAAK,EAAG;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAEnD,gBAAgB;IAEhB,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAC;IAExB,uBAAuB;IAEvB,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,2BAA2B;IAE3B,QAAQ,CAAC,UAAU,EAAG,SAAS,EAAE,CAAC;IAElC,0BAA0B;IAE1B,QAAQ,CAAC,IAAI,EAAG,eAAe,CAAC;IAEhC,wBAAwB;IAExB,QAAQ,CAAC,MAAM,EAAG,UAAU,EAAE,CAAC;IAE/B,YAAY;IAEZ,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB,0BAA0B;IAE1B,cAAc;IAUd,eAAe;IAEf,gBAAgB;IAShB,2BAA2B;IAC3B,IAAI,SAAS,IAAI,SAAS,EAAE,CAyB3B;IAED,kBAAkB;IAClB,OAAO;IAkBP,cAAc;IACd,aAAa;CAGd"}
@@ -0,0 +1,4 @@
1
+ import * as namedExports from './index.esm';
2
+ declare const _default: typeof import("./components/CodeMirror.vue").default & import("vue").PluginObject<any> & typeof namedExports;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAkB,KAAK,YAAY,MAAM,aAAa,CAAC;;AASvD,wBAC0C"}
@@ -1,6 +1,6 @@
1
- import { PluginObject } from 'vue';
2
- import component from './components/CodeMirror.vue';
3
- declare type InstallableComponent = typeof component & PluginObject<any>;
4
- declare const _default: InstallableComponent;
5
- export default _default;
6
- //# sourceMappingURL=entry.esm.d.ts.map
1
+ import { PluginObject } from 'vue';
2
+ import component from './components/CodeMirror.vue';
3
+ declare type InstallableComponent = typeof component & PluginObject<any>;
4
+ declare const _default: InstallableComponent;
5
+ export default _default;
6
+ //# sourceMappingURL=index.esm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["../src/index.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"}