vue-codemirror6 0.0.6 → 0.3.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/README.md CHANGED
@@ -1,119 +1,215 @@
1
1
  # vue-codemirror6
2
2
 
3
- A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unlike [surmon-china's vue-codemirror](https://github.com/surmon-china/vue-codemirror), it is for CodeMirror6.
3
+ [![jsdelivr CDN](https://data.jsdelivr.com/v1/package/npm/vue-codemirror6/badge)](https://www.jsdelivr.com/package/npm/vue-codemirror6)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/vue-codemirror6.svg?style=flat)](https://www.npmjs.com/package/vue-codemirror6)
5
+ [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/vue-codemirror6/file/README.md)
6
+ [![npm version](https://img.shields.io/npm/v/vue-codemirror6.svg)](https://www.npmjs.com/package/vue-codemirror6)
7
+ [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/vue-codemirror6)
8
+
9
+ A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unrelated to [surmon-china's vue-codemirror](https://github.com/surmon-china/vue-codemirror), it is for CodeMirror6.
4
10
 
5
11
  ## Usage
6
12
 
7
13
  This component can handle bidirectional binding by `v-model` like a general Vue component.
14
+ When using with Vue2, [@vue/composition-api](https://www.npmjs.com/package/@vue/composition-api) is required separately.
15
+
16
+ ### Props
17
+
18
+ | Props | Type | Information |
19
+ | ---------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
+ | dark | boolean | Toggle Darkmode. If you use Vuetify, I recommend that you enter `$vuetify.theme.dark`. |
21
+ | theme | { [selector: string]: StyleSpec } | Specify the theme. For example, if you use [@codemirror/theme-one-dark](https://github.com/codemirror/theme-one-dark), import `oneDark` and put it in this prop. |
22
+ | readonly | boolean | Makes the cursor visible or you can drag the text but not edit the value. |
23
+ | editable | boolean | When this is set to false, it is similar to `readonly`, except that the cursor is not displayed like the normal pre tag. |
24
+ | lang | LanguageSupport | The language you want to have syntax highlighting. see <https://codemirror.net/6/#languages> |
25
+ | phrases | Record&lt;string, string&gt; | Specify here if you want to make the displayed character string multilingual. see <https://codemirror.net/6/examples/translate/> |
26
+ | extensions | Extension[] | Includes enhancements to extend CodeMirror. Such as [@codemirror/basic-setup](https://github.com/codemirror/basic-setup). |
27
+ | linter | Diagnostic[] | Set Linter. see example <https://codesandbox.io/s/f6nb0?file=/src/index.js> |
28
+
29
+ Notice: `lang` and `linter` can also be set together in `extensions`. This is defined for usability compatibility with past CodeMirrors.
30
+
31
+ ### Supported Languages
32
+
33
+ - [`@codemirror/lang-cpp`](https://www.npmjs.com/package/@codemirror/lang-cpp)
34
+ - [`@codemirror/lang-html`](https://www.npmjs.com/package/@codemirror/lang-html)
35
+ - [`@codemirror/lang-java`](https://www.npmjs.com/package/@codemirror/lang-java)
36
+ - [`@codemirror/lang-javascript`](https://www.npmjs.com/package/@codemirror/lang-javascript)
37
+ - [`@codemirror/lang-json`](https://www.npmjs.com/package/@codemirror/lang-json)
38
+ - [`@codemirror/lang-lezer`](https://www.npmjs.com/package/@codemirror/lang-lezer)
39
+ - [`@codemirror/lang-markdown`](https://www.npmjs.com/package/@codemirror/lang-markdown)
40
+ - [`@codemirror/lang-php`](https://www.npmjs.com/package/@codemirror/lang-php)
41
+ - [`@codemirror/lang-python`](https://www.npmjs.com/package/@codemirror/lang-python)
42
+ - [`@codemirror/lang-rust`](https://www.npmjs.com/package/@codemirror/lang-rust)
43
+ - [`@codemirror/lang-sql`](https://www.npmjs.com/package/@codemirror/lang-sql)
44
+ - [`@codemirror/lang-xml`](https://www.npmjs.com/package/@codemirror/lang-xml)
45
+
46
+ ### Supported Themes
47
+
48
+ - [`@codemirror/theme-one-dark`](https://github.com/codemirror/theme-one-dark)
49
+ - [`upleveled/theme-vs-code-dark-plus`](https://github.com/upleveled/theme-vs-code-dark-plus)
8
50
 
9
- Other options are currently as follows:
51
+ ## Example
10
52
 
11
- | attribute | information |
12
- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- |
13
- | lang | The language you want to have syntax highlighting. see <https://codemirror.net/6/#languages> |
14
- | phrases | Specify here if you want to make the displayed character string multilingual. see <https://codemirror.net/6/examples/translate/> |
15
- | extensions | Includes enhancements to extend CodeMirror. Such as [@codemirror/basic-setup](https://github.com/codemirror/basic-setup). |
16
- | dark | Toggle Darkmode. |
17
- | linter | Set Linter. see example <https://codesandbox.io/s/f6nb0?file=/src/index.js> |
53
+ Mark up as follows to make it work at a minimum.
18
54
 
19
- ## Example
55
+ ```vue
56
+ <template>
57
+ <code-mirror v-model="value" />
58
+ </template>
59
+
60
+ <script>
61
+ import { ref, defineComponent } from 'vue';
62
+
63
+ import CodeMirror from 'vue-codeMirror6';
64
+
65
+ export default defineComponent({
66
+ components: {
67
+ CodeMirror,
68
+ },
69
+ setup() {
70
+ const value = ref('Cozy lummox gives smart squid who asks for job pen.');
71
+
72
+ return { value };
73
+ },
74
+ });
75
+ </script>
76
+ ```
77
+
78
+ ### Example using Slots
79
+
80
+ The contents of the slot will overwrite the existing `v-model`. For this reason, it is recommended to use it when simply displaying with a `readonly` prop without using `v-model`.
81
+
82
+ Also, insert a `<pre>` tag to prevent the text in the slot from being automatically formatted.
83
+
84
+ ```vue
85
+ <template>
86
+ <code-mirror :lang="lang" :editable="false">
87
+ <pre>
88
+ {
89
+ "key": "value"
90
+ }</pre
91
+ >
92
+ </code-mirror>
93
+ </template>
94
+
95
+ <script>
96
+ import { ref, defineComponent } from 'vue';
97
+
98
+ import { json } from '@codemirror/lang-json';
99
+
100
+ import CodeMirror from '@/components/CodeMirror.vue';
101
+
102
+ export default defineComponent({
103
+ components: {
104
+ CodeMirror,
105
+ },
106
+ setup() {
107
+ const lang = ref(json());
108
+ return { lang };
109
+ },
110
+ });
111
+ </script>
112
+ ```
113
+
114
+ ### Full Example
20
115
 
21
116
  When using as a Markdown editor on [Vuetify](https://vuetifyjs.com/).
22
117
 
23
118
  ```vue
24
119
  <template>
25
- <codemirror
120
+ <code-mirror
26
121
  v-model="value"
27
122
  :lang="lang"
28
123
  :phrases="phreses"
29
124
  :extensions="extensions"
30
125
  :dark="$vuetify.theme.dark"
31
- @update="onCmUpdate"
32
126
  />
33
127
  </template>
34
128
 
35
129
  <script lang="ts">
36
- import { Component, Vue } from 'vue-property-decorator';
130
+ import { ref, type Ref, defineComponent } from 'vue';
37
131
 
38
132
  // Load component
39
133
  import CodeMirror from 'vue-codemirror6';
40
134
 
41
135
  // CodeMirror extensions
42
- import { basicSetup } from '@codemirror/basic-setup';
136
+ import type { LanguageSupport } from '@codemirror/language';
43
137
  import { markdown } from '@codemirror/lang-markdown';
44
- import type { ViewUpdate } from '@codemirror/view';
138
+ import { basicSetup } from '@codemirror/basic-setup';
45
139
  import type { Extension } from '@codemirror/state';
46
- import type { LanguageSupport } from '@codemirror/language';
140
+ import type { ViewUpdate } from '@codemirror/view';
47
141
 
48
- @Component({ components: { CodeMirror } })
49
- export default class Home extends Vue {
50
- /** text */
51
- value: string;
52
-
53
- /**
54
- * CodeMirror Language
55
- *
56
- * @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
57
- */
58
- lang: LanguageSupport = markdown();
59
-
60
- /**
61
- * Internationalization Config. In this example, the display language is Japanese.
62
- *
63
- * @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
64
- */
65
- phrases: Record<string, string> = {
66
- // @codemirror/view
67
- 'Control character': '制御文字',
68
- // @codemirror/fold
69
- 'Folded lines': '折り畳まれた行',
70
- 'Unfolded lines': '折り畳める行',
71
- to: '行き先',
72
- 'folded code': '折り畳まれたコード',
73
- unfold: '折り畳む解除',
74
- 'Fold line': '行を折り畳む',
75
- 'Unfold line': '行の折り畳む解除',
76
- // @codemirror/search
77
- 'Go to line': '行き先の行',
78
- go: 'OK',
79
- Find: '検索',
80
- Replace: '置き換え',
81
- next: '▼',
82
- previous: '▲',
83
- all: 'すべて',
84
- 'match case': '一致条件',
85
- regexp: '正規表現',
86
- replace: '置き換え',
87
- 'replace all': 'すべてを置き換え',
88
- close: '閉じる',
89
- 'current match': '現在の一致',
90
- 'on line': 'した行',
91
- // @codemirror/lint
92
- Diagnostics: 'エラー',
93
- 'No diagnostics': 'エラーなし',
94
- }
95
-
96
- /**
97
- * CodeMirror Extensions
98
- *
99
- * @see {@link:https://codemirror.net/6/docs/ref/#state.Extension | Extending Editor State}
100
- */
101
- extensions: Extension[] = [
102
- /** @see {@link:https://codemirror.net/6/docs/ref/#basic-setup | basic-setup} */
103
- basicSetup
104
- ]
105
-
106
- /**
107
- * CodeMirror Hook View update event
108
- *
109
- * @param update View Update
110
- *
111
- * @see {@link https://codemirror.net/6/docs/ref/#view.ViewUpdate|class ViewUpdate}
112
- */
113
- onCmUpdate(update: ViewUpdate) {
114
- console.log(update)
115
- }
116
- }
142
+ export default defineComponent({
143
+ components: {
144
+ CodeMirror,
145
+ },
146
+ setup() {
147
+ /** text */
148
+ const value: Ref<string> = ref('');
149
+
150
+ /**
151
+ * CodeMirror Language
152
+ *
153
+ * @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
154
+ */
155
+ const lang: Ref<LanguageSupport> = ref(markdown());
156
+
157
+ /**
158
+ * Internationalization Config.
159
+ * In this example, the display language to Japanese.
160
+ *
161
+ * @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
162
+ */
163
+ const phrases: Ref<Record<string, string>> = ref({
164
+ // @codemirror/view
165
+ 'Control character': '制御文字',
166
+ // @codemirror/fold
167
+ 'Folded lines': '折り畳まれた行',
168
+ 'Unfolded lines': '折り畳める行',
169
+ to: '行き先',
170
+ 'folded code': '折り畳まれたコード',
171
+ unfold: '折り畳む解除',
172
+ 'Fold line': '行を折り畳む',
173
+ 'Unfold line': '行の折り畳む解除',
174
+ // @codemirror/search
175
+ 'Go to line': '行き先の行',
176
+ go: 'OK',
177
+ Find: '検索',
178
+ Replace: '置き換え',
179
+ next: '▼',
180
+ previous: '▲',
181
+ all: 'すべて',
182
+ 'match case': '一致条件',
183
+ regexp: '正規表現',
184
+ replace: '置き換え',
185
+ 'replace all': 'すべてを置き換え',
186
+ close: '閉じる',
187
+ 'current match': '現在の一致',
188
+ 'on line': 'した行',
189
+ // @codemirror/lint
190
+ Diagnostics: 'エラー',
191
+ 'No diagnostics': 'エラーなし',
192
+ });
193
+
194
+ /**
195
+ * CodeMirror Extensions
196
+ *
197
+ * @see {@link:https://codemirror.net/6/docs/ref/#state.Extension | Extending Editor State}
198
+ */
199
+ const extensions: Ref<Extension[]> = ref([
200
+ /** @see {@link:https://codemirror.net/6/docs/ref/#basic-setup | basic-setup} */
201
+ basicSetup,
202
+ ]);
203
+
204
+ return {
205
+ value,
206
+ lang,
207
+ phrases,
208
+ extensions,
209
+ };
210
+ },
211
+ });
212
+ </script>
117
213
  ```
118
214
 
119
215
  ## LICENSE
@@ -1,63 +1,176 @@
1
- import { Vue } from 'vue-property-decorator';
2
- import { type Extension } from '@codemirror/state';
1
+ import type { Ref, PropType, SetupContext } from 'vue-demi';
2
+ import type { Extension } from '@codemirror/state';
3
3
  import type { LanguageSupport } from '@codemirror/language';
4
4
  import type { Diagnostic } from '@codemirror/lint';
5
5
  import type { StyleSpec } from 'style-mod';
6
- /** CodeMirror Component */
7
- export default class CodeMirror extends Vue {
8
- /** Editor */
9
- private editor;
6
+ declare const _default: import("vue-demi").DefineComponent<{
7
+ /** Model value */
8
+ modelValue: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
10
12
  /**
11
13
  * Theme
12
14
  *
13
15
  * @see {@link https://codemirror.net/6/examples/styling/ | Example: Styling}
14
16
  */
15
- readonly theme: {
16
- [selector: string]: StyleSpec;
17
+ theme: {
18
+ type: PropType<{
19
+ [selector: string]: StyleSpec;
20
+ }>;
21
+ default: undefined;
17
22
  };
18
23
  /** Dark Mode */
19
- readonly dark: boolean;
24
+ dark: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ /**
29
+ * Readonly
30
+ *
31
+ * @see {@link https://codemirror.net/6/docs/ref/#state.EditorState%5EreadOnly | readOnly}
32
+ */
33
+ readonly: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ /**
38
+ * Editable
39
+ *
40
+ * @see {@link https://codemirror.net/6/docs/ref/#view.EditorView%5Eeditable | editable}
41
+ */
42
+ editable: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ /**
47
+ * Additional Extension
48
+ *
49
+ * @see {@link https://codemirror.net/6/docs/ref/#state.Extension | Extending Editor State}
50
+ */
51
+ extensions: {
52
+ type: PropType<Extension[]>;
53
+ default: undefined;
54
+ };
20
55
  /**
21
56
  * Language Phreses
22
57
  *
23
58
  * @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
24
59
  */
25
- readonly phrases: Record<string, string>;
60
+ phrases: {
61
+ type: PropType<Record<string, string>>;
62
+ default: undefined;
63
+ };
64
+ /**
65
+ * CodeMirror Language
66
+ *
67
+ * @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
68
+ */
69
+ lang: {
70
+ type: PropType<LanguageSupport>;
71
+ default: undefined;
72
+ };
73
+ /**
74
+ * CodeMirror Linter
75
+ *
76
+ * @see {@link https://codemirror.net/6/docs/ref/#lint | @codemirror/lint}
77
+ */
78
+ linter: {
79
+ type: PropType<Diagnostic[]>;
80
+ default: undefined;
81
+ };
82
+ }, {
83
+ context: SetupContext<import("vue-demi").EmitsOptions>;
84
+ editor: Ref<Element | undefined>;
85
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, import("vue-demi").EmitsOptions, "update:modelValue" | "update", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
86
+ /** Model value */
87
+ modelValue: {
88
+ type: StringConstructor;
89
+ default: string;
90
+ };
91
+ /**
92
+ * Theme
93
+ *
94
+ * @see {@link https://codemirror.net/6/examples/styling/ | Example: Styling}
95
+ */
96
+ theme: {
97
+ type: PropType<{
98
+ [selector: string]: StyleSpec;
99
+ }>;
100
+ default: undefined;
101
+ };
102
+ /** Dark Mode */
103
+ dark: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ /**
108
+ * Readonly
109
+ *
110
+ * @see {@link https://codemirror.net/6/docs/ref/#state.EditorState%5EreadOnly | readOnly}
111
+ */
112
+ readonly: {
113
+ type: BooleanConstructor;
114
+ default: boolean;
115
+ };
116
+ /**
117
+ * Editable
118
+ *
119
+ * @see {@link https://codemirror.net/6/docs/ref/#view.EditorView%5Eeditable | editable}
120
+ */
121
+ editable: {
122
+ type: BooleanConstructor;
123
+ default: boolean;
124
+ };
26
125
  /**
27
126
  * Additional Extension
28
127
  *
29
128
  * @see {@link https://codemirror.net/6/docs/ref/#state.Extension | Extending Editor State}
30
129
  */
31
- readonly extensions: Extension[];
130
+ extensions: {
131
+ type: PropType<Extension[]>;
132
+ default: undefined;
133
+ };
134
+ /**
135
+ * Language Phreses
136
+ *
137
+ * @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
138
+ */
139
+ phrases: {
140
+ type: PropType<Record<string, string>>;
141
+ default: undefined;
142
+ };
32
143
  /**
33
144
  * CodeMirror Language
34
145
  *
35
146
  * @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
36
147
  */
37
- readonly lang: LanguageSupport;
148
+ lang: {
149
+ type: PropType<LanguageSupport>;
150
+ default: undefined;
151
+ };
38
152
  /**
39
153
  * CodeMirror Linter
40
154
  *
41
155
  * @see {@link https://codemirror.net/6/docs/ref/#lint | @codemirror/lint}
42
156
  */
43
- readonly linter: Diagnostic[];
44
- /** Input */
45
- readonly value: string;
46
- /**
47
- * Input value changed
48
- *
49
- * @see {@link https://codemirror.net/6/docs/migration/#making-changes | Making Changes}
50
- */
51
- onValueChanged(): void;
52
- /** Darkmode */
53
- onToggleDarkMode(): void;
54
- /** CodeMirror Extension */
55
- get extension(): Extension[];
56
- /** When loaded */
57
- mounted(): void;
58
- /** Destroy */
59
- beforeDestroy(): void;
60
- /** Vue node to plain text */
61
- private getChildrenTextContent;
62
- }
157
+ linter: {
158
+ type: PropType<Diagnostic[]>;
159
+ default: undefined;
160
+ };
161
+ }>>, {
162
+ modelValue: string;
163
+ theme: {
164
+ [selector: string]: StyleSpec;
165
+ };
166
+ dark: boolean;
167
+ readonly: boolean;
168
+ editable: boolean;
169
+ extensions: Extension[];
170
+ phrases: Record<string, string>;
171
+ lang: LanguageSupport;
172
+ linter: Diagnostic[];
173
+ }>;
174
+ /** CodeMirror Component */
175
+ export default _default;
63
176
  //# sourceMappingURL=CodeMirror.vue.d.ts.map
@@ -1 +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;AAGrE,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,2BAA2B;AAC3B,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,GAAG;IACzC,aAAa;IACb,OAAO,CAAC,MAAM,CAAc;IAE5B;;;;OAIG;IAEH,QAAQ,CAAC,KAAK,EAAG;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAEnD,gBAAgB;IAEhB,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAC;IAExB;;;;OAIG;IAEH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;OAIG;IAEH,QAAQ,CAAC,UAAU,EAAG,SAAS,EAAE,CAAC;IAElC;;;;OAIG;IAEH,QAAQ,CAAC,IAAI,EAAG,eAAe,CAAC;IAEhC;;;;OAIG;IAEH,QAAQ,CAAC,MAAM,EAAG,UAAU,EAAE,CAAC;IAE/B,YAAY;IAEZ,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;;;OAIG;IAEH,cAAc;IAqBd,eAAe;IAEf,gBAAgB;IAShB,2BAA2B;IAC3B,IAAI,SAAS,IAAI,SAAS,EAAE,CA4B3B;IAED,kBAAkB;IAClB,OAAO;IAwBP,cAAc;IACd,aAAa;IAIb,6BAA6B;IAC7B,OAAO,CAAC,sBAAsB;CAS/B"}
1
+ {"version":3,"file":"CodeMirror.vue.d.ts","sourceRoot":"","sources":["../../src/components/CodeMirror.vue.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAe,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKzE,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;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;;IAavC,kBAAkB;;;;;IAKlB;;;;OAIG;;;;;;;IAKH,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;;IApEH,kBAAkB;;;;;IAKlB;;;;OAIG;;;;;;;IAKH,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;AA/EP,2BAA2B;AAC3B,wBA+MG"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,13 @@
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;
1
+ /**
2
+ * Vue CodeMirror6 Component
3
+ *
4
+ * @license MIT
5
+ * @author Logue {@link logue@hotmail.co.jp}
6
+ * @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
7
+ * @see {@link https://github.com/logue/vue-codemirror6}
8
+ */
9
+ import CodeMirror from './components/CodeMirror.vue';
10
+ import { App } from 'vue-demi';
11
+ declare const installCodeMirror: (app: App) => void;
12
+ export { CodeMirror, installCodeMirror as install };
4
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAW,GAAG,EAAE,MAAM,UAAU,CAAC;AAIxC,QAAA,MAAM,iBAAiB,QAAS,GAAG,SAElC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,iBAAiB,IAAI,OAAO,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ViewUpdate } from '@codemirror/view';
2
+ /** Emit Interface */
3
+ export default interface CodeMirrorEmitsInterface {
4
+ /** Model Update */
5
+ (e: 'update:modelValue', value: string): void;
6
+ /** CodeMirror ViewUpdate */
7
+ (e: 'update', value: ViewUpdate): void;
8
+ }
9
+ //# sourceMappingURL=CodeMirrorEmitsInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeMirrorEmitsInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/CodeMirrorEmitsInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qBAAqB;AACrB,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAC/C,mBAAmB;IACnB,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,4BAA4B;IAC5B,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC"}
@@ -0,0 +1,56 @@
1
+ import type { LanguageSupport } from '@codemirror/language';
2
+ import type { Extension } from '@codemirror/state';
3
+ import type { Diagnostic } from '@codemirror/lint';
4
+ import type { StyleSpec } from 'style-mod';
5
+ /** Prop Interface */
6
+ export default interface CodeMirrorPropsInterface {
7
+ /** Model value */
8
+ modelValue: string;
9
+ /**
10
+ * Theme
11
+ *
12
+ * @see {@link https://codemirror.net/6/examples/styling/ | Example: Styling}
13
+ */
14
+ theme?: {
15
+ [selector: string]: StyleSpec;
16
+ };
17
+ /** Dark Mode */
18
+ dark?: boolean;
19
+ /**
20
+ * Readonly
21
+ *
22
+ * @see {@link https://codemirror.net/6/docs/ref/#state.EditorState%5EreadOnly | readOnly}
23
+ */
24
+ readonly?: boolean;
25
+ /**
26
+ * Editable
27
+ *
28
+ * @see {@link https://codemirror.net/6/docs/ref/#view.EditorView%5Eeditable | editable}
29
+ */
30
+ editable?: boolean;
31
+ /**
32
+ * Additional Extension
33
+ *
34
+ * @see {@link https://codemirror.net/6/docs/ref/#state.Extension | Extending Editor State}
35
+ */
36
+ extensions?: Extension[];
37
+ /**
38
+ * Language Phreses
39
+ *
40
+ * @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
41
+ */
42
+ phrases?: Record<string, string>;
43
+ /**
44
+ * CodeMirror Language
45
+ *
46
+ * @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
47
+ */
48
+ lang?: LanguageSupport;
49
+ /**
50
+ * CodeMirror Linter
51
+ *
52
+ * @see {@link https://codemirror.net/6/docs/ref/#lint | @codemirror/lint}
53
+ */
54
+ linter?: Diagnostic[];
55
+ }
56
+ //# sourceMappingURL=CodeMirrorPropsInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeMirrorPropsInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/CodeMirrorPropsInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,qBAAqB;AACrB,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAC/C,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC1C,gBAAgB;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACvB"}