vue-codemirror6 0.5.2 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CodeMirror.d.ts +28 -31
- package/dist/components/CodeMirror.d.ts.map +1 -1
- package/dist/index.es.js +73 -31
- package/dist/index.umd.js +2 -2
- package/package.json +22 -27
- package/dist/interfaces/CodeMirrorEmitsInterface.d.ts +0 -9
- package/dist/interfaces/CodeMirrorEmitsInterface.d.ts.map +0 -1
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type PropType, type Ref, type SetupContext } from 'vue-demi';
|
|
2
2
|
import { EditorSelection } from '@codemirror/state';
|
|
3
|
-
import type { Extension, Text } from '@codemirror/state';
|
|
3
|
+
import type { Extension, SelectionRange, Text } from '@codemirror/state';
|
|
4
4
|
import type { LanguageSupport } from '@codemirror/language';
|
|
5
|
+
import type { ViewUpdate } from '@codemirror/view';
|
|
5
6
|
import type { LintSource } from '@codemirror/lint';
|
|
6
7
|
import type { StyleSpec } from 'style-mod';
|
|
8
|
+
/** Emit Interface */
|
|
9
|
+
export interface CodeMirrorEmitsInterface {
|
|
10
|
+
/** Model Update */
|
|
11
|
+
(e: 'update:modelValue', value: string | Text): void;
|
|
12
|
+
/** CodeMirror ViewUpdate */
|
|
13
|
+
(e: 'update', value: ViewUpdate): void;
|
|
14
|
+
}
|
|
7
15
|
/** CodeMirror Component */
|
|
8
16
|
declare const _default: import("vue-demi").DefineComponent<{
|
|
9
17
|
/** Model value */
|
|
@@ -11,18 +19,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
11
19
|
type: PropType<string | Text>;
|
|
12
20
|
default: string;
|
|
13
21
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Selection
|
|
16
|
-
*
|
|
17
|
-
* @see {@link https://codemirror.net/6/docs/ref/#state.EditorSelection | EditorSelection}
|
|
18
|
-
*/
|
|
19
|
-
selection: {
|
|
20
|
-
type: PropType<EditorSelection | {
|
|
21
|
-
anchor: number;
|
|
22
|
-
head?: number | undefined;
|
|
23
|
-
}>;
|
|
24
|
-
default: () => undefined;
|
|
25
|
-
};
|
|
26
22
|
/**
|
|
27
23
|
* Theme
|
|
28
24
|
*
|
|
@@ -118,7 +114,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
118
114
|
*/
|
|
119
115
|
linter: {
|
|
120
116
|
type: PropType<LintSource>;
|
|
121
|
-
default:
|
|
117
|
+
default: undefined;
|
|
122
118
|
};
|
|
123
119
|
/** Show Gutter */
|
|
124
120
|
lintGutter: {
|
|
@@ -128,24 +124,29 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
128
124
|
}, {
|
|
129
125
|
context: SetupContext<import("vue-demi").EmitsOptions>;
|
|
130
126
|
editor: Ref<Element | undefined>;
|
|
127
|
+
selection: () => EditorSelection;
|
|
128
|
+
getRange: (a?: number, b?: number) => string;
|
|
129
|
+
getLine: (n: number) => string;
|
|
130
|
+
lineCount: () => number;
|
|
131
|
+
getCursor: () => number;
|
|
132
|
+
listSelections: () => readonly SelectionRange[];
|
|
133
|
+
getSelection: () => string;
|
|
134
|
+
getSelections: () => string[];
|
|
135
|
+
somethingSelected: () => boolean;
|
|
136
|
+
replaceRange: (text: string | Text, from: number, to: number) => void;
|
|
137
|
+
replaceSelection: (text: string | Text) => void;
|
|
138
|
+
setCursor: (pos: number) => void;
|
|
139
|
+
setSelection: (anchor: number, head: number) => void;
|
|
140
|
+
setSelections: (ranges: readonly SelectionRange[], mainIndex?: number | undefined) => void;
|
|
141
|
+
extendSelectionsBy: (f: any) => void;
|
|
142
|
+
focus: () => void;
|
|
143
|
+
hasFocus: () => boolean;
|
|
131
144
|
}, 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<{
|
|
132
145
|
/** Model value */
|
|
133
146
|
modelValue: {
|
|
134
147
|
type: PropType<string | Text>;
|
|
135
148
|
default: string;
|
|
136
149
|
};
|
|
137
|
-
/**
|
|
138
|
-
* Selection
|
|
139
|
-
*
|
|
140
|
-
* @see {@link https://codemirror.net/6/docs/ref/#state.EditorSelection | EditorSelection}
|
|
141
|
-
*/
|
|
142
|
-
selection: {
|
|
143
|
-
type: PropType<EditorSelection | {
|
|
144
|
-
anchor: number;
|
|
145
|
-
head?: number | undefined;
|
|
146
|
-
}>;
|
|
147
|
-
default: () => undefined;
|
|
148
|
-
};
|
|
149
150
|
/**
|
|
150
151
|
* Theme
|
|
151
152
|
*
|
|
@@ -241,7 +242,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
241
242
|
*/
|
|
242
243
|
linter: {
|
|
243
244
|
type: PropType<LintSource>;
|
|
244
|
-
default:
|
|
245
|
+
default: undefined;
|
|
245
246
|
};
|
|
246
247
|
/** Show Gutter */
|
|
247
248
|
lintGutter: {
|
|
@@ -250,10 +251,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
250
251
|
};
|
|
251
252
|
}>>, {
|
|
252
253
|
modelValue: string | Text;
|
|
253
|
-
selection: EditorSelection | {
|
|
254
|
-
anchor: number;
|
|
255
|
-
head?: number | undefined;
|
|
256
|
-
};
|
|
257
254
|
theme: {
|
|
258
255
|
[selector: string]: StyleSpec;
|
|
259
256
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeMirror.d.ts","sourceRoot":"","sources":["../../src/components/CodeMirror.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CodeMirror.d.ts","sourceRoot":"","sources":["../../src/components/CodeMirror.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,QAAQ,EACb,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,eAAe,EAAe,MAAM,mBAAmB,CAAC;AAUjE,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,IAAI,EAEL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,qBAAqB;AACrB,MAAM,WAAW,wBAAwB;IACvC,mBAAmB;IACnB,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACrD,4BAA4B;IAC5B,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC;AAED,2BAA2B;;IAWvB,kBAAkB;;;;;IAKlB;;;;OAIG;;;;;;;IAOH,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH,kBAAkB;;;;;;;;;mBAsJI,MAAM,MAAM,MAAM,KAAG,MAAM;iBAE7B,MAAM,KAAG,MAAM;qBACb,MAAM;qBACN,MAAM;0BACD,SAAS,cAAc,EAAE;wBAC3B,MAAM;yBAEL,MAAM,EAAE;6BAEJ,OAAO;yBAIT,MAAM,GAAG,IAAI,QAAQ,MAAM,MAAM,MAAM;6BAInC,MAAM,GAAG,IAAI;qBAErB,MAAM;2BAEA,MAAM,QAAQ,MAAM;4BAGxC,SAAS,cAAc,EAAE,cACrB,MAAM,GAAG,SAAS;;;oBAeX,OAAO;;IAvS5B,kBAAkB;;;;;IAKlB;;;;OAIG;;;;;;;IAOH,gBAAgB;;;;;IAKhB;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;IAKH,kBAAkB;;;;;;;;;;;;;;;;;;;;;;AAlHtB,wBA2VG"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isVue2, h as h$1, defineComponent, ref, toRefs,
|
|
2
|
-
import { EditorState } from "@codemirror/state";
|
|
1
|
+
import { isVue2, h as h$1, defineComponent, ref, toRefs, watch, onMounted, nextTick, onUnmounted, toRaw } from "vue-demi";
|
|
2
|
+
import { EditorState, EditorSelection } from "@codemirror/state";
|
|
3
3
|
import { EditorView, keymap } from "@codemirror/view";
|
|
4
4
|
import { linter, lintGutter } from "@codemirror/lint";
|
|
5
5
|
import { basicSetup } from "@codemirror/basic-setup";
|
|
6
6
|
import { indentWithTab } from "@codemirror/commands";
|
|
7
|
-
import {
|
|
7
|
+
import { trim, compact } from "lodash";
|
|
8
8
|
const adaptOnsV3 = (ons) => {
|
|
9
9
|
if (!ons)
|
|
10
10
|
return null;
|
|
@@ -33,10 +33,6 @@ var CodeMirror = defineComponent({
|
|
|
33
33
|
type: String,
|
|
34
34
|
default: ""
|
|
35
35
|
},
|
|
36
|
-
selection: {
|
|
37
|
-
type: Object,
|
|
38
|
-
default: () => void 0
|
|
39
|
-
},
|
|
40
36
|
theme: {
|
|
41
37
|
type: Object,
|
|
42
38
|
default: () => {
|
|
@@ -83,7 +79,7 @@ var CodeMirror = defineComponent({
|
|
|
83
79
|
},
|
|
84
80
|
linter: {
|
|
85
81
|
type: Function,
|
|
86
|
-
default:
|
|
82
|
+
default: void 0
|
|
87
83
|
},
|
|
88
84
|
lintGutter: {
|
|
89
85
|
type: Boolean,
|
|
@@ -93,53 +89,41 @@ var CodeMirror = defineComponent({
|
|
|
93
89
|
emits: ["update:modelValue", "update"],
|
|
94
90
|
setup(props, context) {
|
|
95
91
|
const editor = ref();
|
|
96
|
-
const doc = ref(props.modelValue);
|
|
97
92
|
const { dark } = toRefs(props);
|
|
93
|
+
const doc = ref(props.modelValue);
|
|
98
94
|
const emit = context.emit;
|
|
99
|
-
const exts = computed(() => compact([
|
|
100
|
-
props.basic ? basicSetup : void 0,
|
|
101
|
-
EditorView.updateListener.of((update) => emit("update", update)),
|
|
102
|
-
EditorView.theme(props.theme, { dark: dark.value }),
|
|
103
|
-
props.wrap ? EditorView.lineWrapping : void 0,
|
|
104
|
-
props.tab ? keymap.of([indentWithTab]) : void 0,
|
|
105
|
-
props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
|
|
106
|
-
props.readonly ? EditorState.readOnly.of(props.readonly) : void 0,
|
|
107
|
-
props.editable ? EditorView.editable.of(props.editable) : void 0,
|
|
108
|
-
props.lang ? toRaw(props.lang) : void 0,
|
|
109
|
-
props.linter ? linter(props.linter) : void 0,
|
|
110
|
-
props.linter && props.lintGutter ? lintGutter() : void 0,
|
|
111
|
-
...props.extensions
|
|
112
|
-
]));
|
|
113
95
|
let view;
|
|
114
|
-
watch(doc, (
|
|
96
|
+
watch(doc, (value) => {
|
|
115
97
|
if (view.composing) {
|
|
116
98
|
return;
|
|
117
99
|
}
|
|
118
100
|
const previous = view.state.selection;
|
|
119
101
|
view.setState(EditorState.create({
|
|
120
|
-
doc:
|
|
121
|
-
extensions:
|
|
102
|
+
doc: value,
|
|
103
|
+
extensions: getExtensions(),
|
|
122
104
|
selection: previous
|
|
123
105
|
}));
|
|
124
106
|
});
|
|
107
|
+
watch(() => props.modelValue, (text) => view.dispatch({
|
|
108
|
+
changes: { from: 0, to: view.state.doc.length, insert: text }
|
|
109
|
+
}));
|
|
125
110
|
watch(dark, () => {
|
|
126
111
|
view.setState(EditorState.create({
|
|
127
112
|
doc: doc.value,
|
|
128
|
-
extensions:
|
|
113
|
+
extensions: getExtensions()
|
|
129
114
|
}));
|
|
130
115
|
});
|
|
131
116
|
onMounted(async () => {
|
|
132
117
|
if (editor.value && editor.value.childNodes[0]) {
|
|
133
118
|
if (doc.value !== "") {
|
|
134
|
-
console.warn("[CodeMirror.vue] The
|
|
119
|
+
console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values.");
|
|
135
120
|
}
|
|
136
121
|
doc.value = trim(editor.value.childNodes[0].innerText);
|
|
137
122
|
}
|
|
138
123
|
view = new EditorView({
|
|
139
124
|
state: EditorState.create({
|
|
140
125
|
doc: doc.value,
|
|
141
|
-
|
|
142
|
-
extensions: exts.value
|
|
126
|
+
extensions: getExtensions()
|
|
143
127
|
}),
|
|
144
128
|
parent: editor.value,
|
|
145
129
|
dispatch: (tr) => {
|
|
@@ -153,9 +137,67 @@ var CodeMirror = defineComponent({
|
|
|
153
137
|
await nextTick();
|
|
154
138
|
});
|
|
155
139
|
onUnmounted(() => view.destroy());
|
|
140
|
+
const getExtensions = () => {
|
|
141
|
+
const extensions = compact([
|
|
142
|
+
props.basic ? basicSetup : void 0,
|
|
143
|
+
EditorView.updateListener.of((update) => emit("update", update)),
|
|
144
|
+
EditorView.theme(props.theme, { dark: dark.value }),
|
|
145
|
+
props.wrap ? EditorView.lineWrapping : void 0,
|
|
146
|
+
props.tab ? keymap.of([indentWithTab]) : void 0,
|
|
147
|
+
props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
|
|
148
|
+
props.readonly ? EditorState.readOnly.of(props.readonly) : void 0,
|
|
149
|
+
props.editable ? EditorView.editable.of(props.editable) : void 0,
|
|
150
|
+
props.lang ? toRaw(props.lang) : void 0,
|
|
151
|
+
props.linter ? linter(props.linter) : void 0,
|
|
152
|
+
props.linter && props.lintGutter ? lintGutter() : void 0,
|
|
153
|
+
...props.extensions
|
|
154
|
+
]);
|
|
155
|
+
console.debug("[CodeMirror.vue] Loaded extensions: ", extensions);
|
|
156
|
+
return extensions;
|
|
157
|
+
};
|
|
158
|
+
const selection = () => view.state.selection;
|
|
159
|
+
const getRange = (a, b) => view.state.sliceDoc(a, b);
|
|
160
|
+
const getLine = (n) => view.state.doc.line(n + 1).text;
|
|
161
|
+
const lineCount = () => view.state.doc.lines;
|
|
162
|
+
const getCursor = () => selection().main.head;
|
|
163
|
+
const listSelections = () => selection().ranges;
|
|
164
|
+
const getSelection = () => view.state.sliceDoc(selection().main.from, selection().main.to);
|
|
165
|
+
const getSelections = () => selection().ranges.map((r) => view.state.sliceDoc(r.from, r.to));
|
|
166
|
+
const somethingSelected = () => selection().ranges.some((r) => !r.empty);
|
|
167
|
+
const replaceRange = (text, from, to) => view.dispatch({
|
|
168
|
+
changes: { from, to, insert: text }
|
|
169
|
+
});
|
|
170
|
+
const replaceSelection = (text) => view.dispatch(view.state.replaceSelection(text));
|
|
171
|
+
const setCursor = (pos) => view.dispatch({ selection: { anchor: pos } });
|
|
172
|
+
const setSelection = (anchor, head) => view.dispatch({ selection: { anchor, head } });
|
|
173
|
+
const setSelections = (ranges, mainIndex) => view.dispatch({
|
|
174
|
+
selection: EditorSelection.create(ranges, mainIndex)
|
|
175
|
+
});
|
|
176
|
+
const extendSelectionsBy = (f) => view.dispatch({
|
|
177
|
+
selection: EditorSelection.create(selection().ranges.map((r) => r.extend(f(r))))
|
|
178
|
+
});
|
|
179
|
+
const focus = () => view.focus();
|
|
180
|
+
const hasFocus = () => view.hasFocus;
|
|
156
181
|
return {
|
|
157
182
|
context,
|
|
158
|
-
editor
|
|
183
|
+
editor,
|
|
184
|
+
selection,
|
|
185
|
+
getRange,
|
|
186
|
+
getLine,
|
|
187
|
+
lineCount,
|
|
188
|
+
getCursor,
|
|
189
|
+
listSelections,
|
|
190
|
+
getSelection,
|
|
191
|
+
getSelections,
|
|
192
|
+
somethingSelected,
|
|
193
|
+
replaceRange,
|
|
194
|
+
replaceSelection,
|
|
195
|
+
setCursor,
|
|
196
|
+
setSelection,
|
|
197
|
+
setSelections,
|
|
198
|
+
extendSelectionsBy,
|
|
199
|
+
focus,
|
|
200
|
+
hasFocus
|
|
159
201
|
};
|
|
160
202
|
},
|
|
161
203
|
render() {
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(r,
|
|
1
|
+
(function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue-demi"),require("@codemirror/state"),require("@codemirror/view"),require("@codemirror/lint"),require("@codemirror/basic-setup"),require("@codemirror/commands"),require("lodash")):typeof define=="function"&&define.amd?define(["exports","vue-demi","@codemirror/state","@codemirror/view","@codemirror/lint","@codemirror/basic-setup","@codemirror/commands","lodash"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.CodeMirror={},r.VueDemi,r.state,r.view,r.lint,r.basicSetup,r.commands,r.lodash))})(this,function(r,n,d,u,p,v,x,S){"use strict";const C=e=>e?Object.entries(e).reduce((l,[i,f])=>(i=i.charAt(0).toUpperCase()+i.slice(1),i=`on${i}`,{...l,[i]:f}),{}):null,g=(e,l={},i)=>{if(n.isVue2)return n.h(e,l,i);const{props:f,domProps:a,on:m,...o}=l,h=m?C(m):{};return n.h(e,{...o,...f,...a,...h},i)},V=e=>typeof e=="function"?e():e;var y=n.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},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},lintGutter:{type:Boolean,defalt:!1}},emits:["update:modelValue","update"],setup(e,l){const i=n.ref(),{dark:f}=n.toRefs(e),a=n.ref(e.modelValue),m=l.emit;let o;n.watch(a,t=>{if(o.composing)return;const s=o.state.selection;o.setState(d.EditorState.create({doc:t,extensions:h(),selection:s}))}),n.watch(()=>e.modelValue,t=>o.dispatch({changes:{from:0,to:o.state.doc.length,insert:t}})),n.watch(f,()=>{o.setState(d.EditorState.create({doc:a.value,extensions:h()}))}),n.onMounted(async()=>{i.value&&i.value.childNodes[0]&&(a.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a.value=S.trim(i.value.childNodes[0].innerText)),o=new u.EditorView({state:d.EditorState.create({doc:a.value,extensions:h()}),parent:i.value,dispatch:t=>{o.update([t]),!t.changes.empty&&(a.value=o.state.doc.toString(),m("update:modelValue",a.value))}}),await n.nextTick()}),n.onUnmounted(()=>o.destroy());const h=()=>{const t=S.compact([e.basic?v.basicSetup:void 0,u.EditorView.updateListener.of(s=>m("update",s)),u.EditorView.theme(e.theme,{dark:f.value}),e.wrap?u.EditorView.lineWrapping:void 0,e.tab?u.keymap.of([x.indentWithTab]):void 0,e.phrases?d.EditorState.phrases.of(e.phrases):void 0,e.readonly?d.EditorState.readOnly.of(e.readonly):void 0,e.editable?u.EditorView.editable.of(e.editable):void 0,e.lang?n.toRaw(e.lang):void 0,e.linter?p.linter(e.linter):void 0,e.linter&&e.lintGutter?p.lintGutter():void 0,...e.extensions]);return console.debug("[CodeMirror.vue] Loaded extensions: ",t),t},c=()=>o.state.selection;return{context:l,editor:i,selection:c,getRange:(t,s)=>o.state.sliceDoc(t,s),getLine:t=>o.state.doc.line(t+1).text,lineCount:()=>o.state.doc.lines,getCursor:()=>c().main.head,listSelections:()=>c().ranges,getSelection:()=>o.state.sliceDoc(c().main.from,c().main.to),getSelections:()=>c().ranges.map(t=>o.state.sliceDoc(t.from,t.to)),somethingSelected:()=>c().ranges.some(t=>!t.empty),replaceRange:(t,s,w)=>o.dispatch({changes:{from:s,to:w,insert:t}}),replaceSelection:t=>o.dispatch(o.state.replaceSelection(t)),setCursor:t=>o.dispatch({selection:{anchor:t}}),setSelection:(t,s)=>o.dispatch({selection:{anchor:t,head:s}}),setSelections:(t,s)=>o.dispatch({selection:d.EditorSelection.create(t,s)}),extendSelectionsBy:t=>o.dispatch({selection:d.EditorSelection.create(c().ranges.map(s=>s.extend(t(s))))}),focus:()=>o.focus(),hasFocus:()=>o.hasFocus}},render(){return g("div",{ref:"editor",class:"vue-codemirror"},this.$slots.default?g("aside",{style:"display: none;"},V(this.$slots.default)):void 0)}});/**
|
|
2
2
|
* Vue CodeMirror6 Component
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author Logue {@link logue@hotmail.co.jp}
|
|
6
6
|
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
7
7
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
8
|
-
*/const
|
|
8
|
+
*/const b=e=>e.component("CodeMirror",y);r.default=y,r.install=b,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
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": "0.5.
|
|
4
|
+
"version": "0.5.5",
|
|
5
5
|
"description": "CodeMirror6 Component for vue2 and vue3",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -40,9 +40,6 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"main": "./dist/index.umd.js",
|
|
42
42
|
"module": "./dist/index.es.js",
|
|
43
|
-
"browser": {
|
|
44
|
-
"./sfc": "./src/components/CodeMirror.vue"
|
|
45
|
-
},
|
|
46
43
|
"exports": {
|
|
47
44
|
".": {
|
|
48
45
|
"import": "./dist/index.es.js",
|
|
@@ -51,8 +48,7 @@
|
|
|
51
48
|
},
|
|
52
49
|
"types": "./dist/index.d.ts",
|
|
53
50
|
"files": [
|
|
54
|
-
"/dist"
|
|
55
|
-
"/src/components/CodeMirror.vue"
|
|
51
|
+
"/dist"
|
|
56
52
|
],
|
|
57
53
|
"sideEffects": false,
|
|
58
54
|
"scripts": {
|
|
@@ -68,16 +64,16 @@
|
|
|
68
64
|
"prepare": "husky install"
|
|
69
65
|
},
|
|
70
66
|
"dependencies": {
|
|
71
|
-
"@codemirror/basic-setup": "
|
|
72
|
-
"@codemirror/commands": "
|
|
73
|
-
"@codemirror/lint": "
|
|
74
|
-
"@codemirror/state": "
|
|
75
|
-
"@codemirror/view": "
|
|
67
|
+
"@codemirror/basic-setup": "0.20.0",
|
|
68
|
+
"@codemirror/commands": "0.20.0",
|
|
69
|
+
"@codemirror/lint": "0.20.3",
|
|
70
|
+
"@codemirror/state": "0.20.1",
|
|
71
|
+
"@codemirror/view": "0.20.7",
|
|
76
72
|
"vue-demi": "latest"
|
|
77
73
|
},
|
|
78
74
|
"peerDependencies": {
|
|
79
75
|
"@vue/composition-api": "^1.6.2",
|
|
80
|
-
"vue": "^2.6.14 || ^3.2.
|
|
76
|
+
"vue": "^2.6.14 || ^3.2.37"
|
|
81
77
|
},
|
|
82
78
|
"peerDependenciesMeta": {
|
|
83
79
|
"@vue/composition-api": {
|
|
@@ -85,40 +81,39 @@
|
|
|
85
81
|
}
|
|
86
82
|
},
|
|
87
83
|
"devDependencies": {
|
|
88
|
-
"@codemirror/lang-javascript": "^0.20.
|
|
84
|
+
"@codemirror/lang-javascript": "^0.20.1",
|
|
89
85
|
"@codemirror/lang-markdown": "^0.20.1",
|
|
90
86
|
"@types/lodash": "^4.14.182",
|
|
91
|
-
"@types/node": "^17.0.
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
93
|
-
"@typescript-eslint/parser": "^5.
|
|
87
|
+
"@types/node": "^17.0.41",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
89
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
94
90
|
"@vitejs/plugin-vue": "^2.3.3",
|
|
95
91
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
96
|
-
"eslint": "^8.
|
|
92
|
+
"eslint": "^8.17.0",
|
|
97
93
|
"eslint-config-google": "^0.14.0",
|
|
98
94
|
"eslint-config-prettier": "^8.5.0",
|
|
99
95
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
100
96
|
"eslint-import-resolver-typescript": "^2.7.1",
|
|
97
|
+
"eslint-plugin-html": "^6.2.0",
|
|
101
98
|
"eslint-plugin-import": "^2.26.0",
|
|
102
99
|
"eslint-plugin-jsdoc": "^39.3.2",
|
|
103
100
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
104
|
-
"eslint-plugin-vue": "^9.0
|
|
105
|
-
"eslint-plugin-vuejs-accessibility": "^1.
|
|
101
|
+
"eslint-plugin-vue": "^9.1.0",
|
|
102
|
+
"eslint-plugin-vuejs-accessibility": "^1.2.0",
|
|
103
|
+
"eslint-plugin-yaml": "^0.5.0",
|
|
106
104
|
"eslint4b-prebuilt": "^6.7.2",
|
|
107
105
|
"husky": "^8.0.1",
|
|
108
|
-
"lint-staged": "^
|
|
106
|
+
"lint-staged": "^13.0.0",
|
|
109
107
|
"lodash": "^4.17.21",
|
|
110
108
|
"prettier": "^2.6.2",
|
|
111
|
-
"prettier-plugin-jsdoc": "^0.3.38",
|
|
112
|
-
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
113
|
-
"prettier-plugin-sort-imports": "^1.7.0",
|
|
114
109
|
"rimraf": "^3.0.2",
|
|
115
110
|
"rollup-plugin-visualizer": "^5.6.0",
|
|
116
|
-
"typescript": "^4.7.
|
|
117
|
-
"vite": "^2.9.
|
|
111
|
+
"typescript": "^4.7.3",
|
|
112
|
+
"vite": "^2.9.10",
|
|
118
113
|
"vite-plugin-checker": "^0.4.6",
|
|
119
|
-
"vue": "^3.2.
|
|
114
|
+
"vue": "^3.2.37",
|
|
120
115
|
"vue-eslint-parser": "^9.0.2",
|
|
121
|
-
"vue-tsc": "^0.
|
|
116
|
+
"vue-tsc": "^0.37.3"
|
|
122
117
|
},
|
|
123
118
|
"husky": {
|
|
124
119
|
"hooks": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ViewUpdate } from '@codemirror/view';
|
|
2
|
-
/** Emit Interface */
|
|
3
|
-
export default interface CodeMirrorEmitsInterface {
|
|
4
|
-
/** Model Update */
|
|
5
|
-
(e: 'update:modelValue', value: string | Text): void;
|
|
6
|
-
/** CodeMirror ViewUpdate */
|
|
7
|
-
(e: 'update', value: ViewUpdate): void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=CodeMirrorEmitsInterface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,GAAG,IAAI,CAAC;IACrD,4BAA4B;IAC5B,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC"}
|