vue-codemirror6 1.2.5 → 1.3.0
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 +1 -0
- package/dist/Meta.d.ts +2 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +94 -86
- package/dist/index.iife.js +3 -3
- package/dist/index.umd.js +3 -3
- package/package.json +33 -29
- package/src/components/CodeMirror.ts +52 -41
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ This component can handle bidirectional binding by `v-model` like a general Vue
|
|
|
51
51
|
| extensions | Extension[] | Includes enhancements to extend CodeMirror. |
|
|
52
52
|
| linter | LintSource | Set Linter. Enter a linter (eg `esLint([arbitrary rule])` function for `@codemirror/lang-javascript`, `jsonParseLinter()`function for`@codemirror/json`). See the sources for various language libraries for more information. |
|
|
53
53
|
| linterConfig | Object | see <https://codemirror.net/docs/ref/#lint.linter^config> |
|
|
54
|
+
| forceLinting | boolean | see <https://codemirror.net/docs/ref/#lint.forceLinting> |
|
|
54
55
|
| gutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
|
|
55
56
|
| gutterConfig | Object | see <https://codemirror.net/docs/ref/#lint.lintGutter^config> |
|
|
56
57
|
| tag | string | HTML tags used in the component. (Default is `div` tag.) |
|
package/dist/Meta.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import CodeMirror from './components/CodeMirror';
|
|
2
|
-
import Meta from './Meta';
|
|
1
|
+
import { default as CodeMirror } from './components/CodeMirror';
|
|
2
|
+
import { default as Meta } from './Meta';
|
|
3
|
+
|
|
3
4
|
declare const installCodeMirror: (app: any) => void;
|
|
4
5
|
export { CodeMirror as default, installCodeMirror as install, Meta };
|
package/dist/index.es.js
CHANGED
|
@@ -5,29 +5,35 @@
|
|
|
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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { EditorState as s, Compartment as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
import { indentWithTab as G } from "@codemirror/commands";
|
|
13
|
+
import { indentUnit as I } from "@codemirror/language";
|
|
14
|
+
import { forceLinting as b, linter as P, lintGutter as Z, diagnosticCount as k } from "@codemirror/lint";
|
|
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";
|
|
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 c, watch as $, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
|
|
19
|
+
const le = {
|
|
20
|
+
version: "1.3.0",
|
|
21
|
+
date: "2024-04-24T08:18:55.338Z"
|
|
22
|
+
};
|
|
23
|
+
var ge = le;
|
|
24
|
+
const ie = (e) => e ? Object.entries(e).reduce((i, [l, u]) => (l = l.charAt(0).toUpperCase() + l.slice(1), l = `on${l}`, { ...i, [l]: u }), {}) : {};
|
|
25
|
+
function B(e, i = {}, l) {
|
|
26
|
+
if (X)
|
|
27
|
+
return O(e, i, l);
|
|
28
|
+
const { props: u, domProps: t, on: d, ...f } = i, m = d ? ie(d) : {};
|
|
29
|
+
return O(
|
|
24
30
|
e,
|
|
25
31
|
{ ...f, ...u, ...t, ...m },
|
|
26
|
-
|
|
32
|
+
l
|
|
27
33
|
);
|
|
28
34
|
}
|
|
29
|
-
const
|
|
30
|
-
var
|
|
35
|
+
const oe = (e) => typeof e == "function" ? e() : e;
|
|
36
|
+
var se = Y({
|
|
31
37
|
/** Component Name */
|
|
32
38
|
name: "CodeMirror",
|
|
33
39
|
/** Model Definition */
|
|
@@ -49,8 +55,7 @@ var oe = I({
|
|
|
49
55
|
*/
|
|
50
56
|
theme: {
|
|
51
57
|
type: Object,
|
|
52
|
-
default: () => {
|
|
53
|
-
}
|
|
58
|
+
default: () => ({})
|
|
54
59
|
},
|
|
55
60
|
/** Dark Mode */
|
|
56
61
|
dark: {
|
|
@@ -104,6 +109,13 @@ var oe = I({
|
|
|
104
109
|
type: Boolean,
|
|
105
110
|
default: !1
|
|
106
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* Tab character
|
|
114
|
+
*/
|
|
115
|
+
indentUnit: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: void 0
|
|
118
|
+
},
|
|
107
119
|
/**
|
|
108
120
|
* Allow Multiple Selection.
|
|
109
121
|
*
|
|
@@ -218,7 +230,7 @@ var oe = I({
|
|
|
218
230
|
*/
|
|
219
231
|
gutter: {
|
|
220
232
|
type: Boolean,
|
|
221
|
-
|
|
233
|
+
default: !1
|
|
222
234
|
},
|
|
223
235
|
/**
|
|
224
236
|
* Gutter Config
|
|
@@ -259,8 +271,8 @@ var oe = I({
|
|
|
259
271
|
* @param props - Props
|
|
260
272
|
* @param context - Context
|
|
261
273
|
*/
|
|
262
|
-
setup(e,
|
|
263
|
-
const
|
|
274
|
+
setup(e, i) {
|
|
275
|
+
const l = v(), u = v(e.modelValue), t = ee(new r()), d = c({
|
|
264
276
|
get: () => t.value.hasFocus,
|
|
265
277
|
set: (a) => {
|
|
266
278
|
a && t.value.focus();
|
|
@@ -276,27 +288,29 @@ var oe = I({
|
|
|
276
288
|
get: () => t.value.state.toJSON(),
|
|
277
289
|
set: (a) => t.value.setState(s.fromJSON(a))
|
|
278
290
|
}
|
|
279
|
-
),
|
|
280
|
-
const a = new
|
|
291
|
+
), S = v(0), g = v(0), h = c(() => {
|
|
292
|
+
const a = new C(), n = new C();
|
|
281
293
|
return [
|
|
282
294
|
// Toggle basic setup
|
|
283
|
-
e.basic ?
|
|
295
|
+
e.basic ? K : void 0,
|
|
284
296
|
// Toggle minimal setup
|
|
285
|
-
e.minimal && !e.basic ?
|
|
297
|
+
e.minimal && !e.basic ? Q : void 0,
|
|
286
298
|
// ViewUpdate event listener
|
|
287
|
-
r.updateListener.of((
|
|
288
|
-
|
|
299
|
+
r.updateListener.of((o) => {
|
|
300
|
+
i.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), i.emit("update", o));
|
|
289
301
|
}),
|
|
290
302
|
// Toggle light/dark mode.
|
|
291
303
|
r.theme(e.theme, { dark: e.dark }),
|
|
292
304
|
// Toggle line wrapping
|
|
293
305
|
e.wrap ? r.lineWrapping : void 0,
|
|
294
306
|
// Indent with tab
|
|
295
|
-
e.tab ?
|
|
307
|
+
e.tab ? q.of([G]) : void 0,
|
|
308
|
+
// Tab character
|
|
309
|
+
e.indentUnit ? I.of(e.indentUnit) : void 0,
|
|
296
310
|
// Allow Multiple Selections
|
|
297
311
|
s.allowMultipleSelections.of(e.allowMultipleSelections),
|
|
298
312
|
// Indent tab size
|
|
299
|
-
e.tabSize ?
|
|
313
|
+
e.tabSize ? n.of(s.tabSize.of(e.tabSize)) : void 0,
|
|
300
314
|
// locale settings
|
|
301
315
|
e.phrases ? s.phrases.of(e.phrases) : void 0,
|
|
302
316
|
// Readonly option
|
|
@@ -308,16 +322,16 @@ var oe = I({
|
|
|
308
322
|
// Lang
|
|
309
323
|
e.lang ? a.of(e.lang) : void 0,
|
|
310
324
|
// Append Linter settings
|
|
311
|
-
e.linter ?
|
|
325
|
+
e.linter ? P(e.linter, e.linterConfig) : void 0,
|
|
312
326
|
// Show 🔴 to error line when linter enabled.
|
|
313
|
-
e.linter && e.gutter ?
|
|
327
|
+
e.linter && e.gutter ? Z(e.gutterConfig) : void 0,
|
|
314
328
|
// Placeholder
|
|
315
|
-
e.placeholder ?
|
|
329
|
+
e.placeholder ? H(e.placeholder) : void 0,
|
|
316
330
|
// Append Extensions
|
|
317
331
|
...e.extensions
|
|
318
|
-
].filter((
|
|
332
|
+
].filter((o) => !!o);
|
|
319
333
|
});
|
|
320
|
-
|
|
334
|
+
$(
|
|
321
335
|
h,
|
|
322
336
|
(a) => {
|
|
323
337
|
t.value?.dispatch({
|
|
@@ -325,7 +339,7 @@ var oe = I({
|
|
|
325
339
|
});
|
|
326
340
|
},
|
|
327
341
|
{ immediate: !0 }
|
|
328
|
-
),
|
|
342
|
+
), $(
|
|
329
343
|
() => e.modelValue,
|
|
330
344
|
async (a) => {
|
|
331
345
|
t.value.composing || // IME fix
|
|
@@ -337,64 +351,63 @@ var oe = I({
|
|
|
337
351
|
});
|
|
338
352
|
},
|
|
339
353
|
{ immediate: !0 }
|
|
340
|
-
),
|
|
354
|
+
), te(async () => {
|
|
341
355
|
let a = u.value;
|
|
342
|
-
|
|
356
|
+
l.value && (l.value.childNodes[0] && (u.value !== "" && console.warn(
|
|
343
357
|
"[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
|
|
344
|
-
), a =
|
|
345
|
-
parent:
|
|
358
|
+
), a = l.value.childNodes[0].innerText.trim()), t.value = new r({
|
|
359
|
+
parent: l.value,
|
|
346
360
|
state: s.create({ doc: a, extensions: h.value }),
|
|
347
|
-
dispatch: (
|
|
348
|
-
t.value.update([
|
|
361
|
+
dispatch: (n) => {
|
|
362
|
+
t.value.update([n]), !(n.changes.empty || !n.docChanged) && (i.emit("update:modelValue", n.state.doc.toString() ?? ""), i.emit("change", n.state));
|
|
349
363
|
}
|
|
350
|
-
}), await
|
|
364
|
+
}), await ae(), i.emit("ready", {
|
|
351
365
|
view: t.value,
|
|
352
366
|
state: t.value.state,
|
|
353
|
-
container:
|
|
367
|
+
container: l.value
|
|
354
368
|
}));
|
|
355
|
-
}),
|
|
356
|
-
t.value.destroy(),
|
|
369
|
+
}), ne(() => {
|
|
370
|
+
t.value.destroy(), i.emit("destroy");
|
|
357
371
|
});
|
|
358
372
|
const V = () => {
|
|
359
|
-
!e.linter || !t.value || (e.forceLinting &&
|
|
373
|
+
!e.linter || !t.value || (e.forceLinting && b(t.value), g.value = k(t.value.state));
|
|
360
374
|
}, j = () => {
|
|
361
375
|
t.value?.dispatch({
|
|
362
376
|
effects: y.reconfigure.of([])
|
|
363
377
|
}), t.value?.dispatch({
|
|
364
378
|
effects: y.appendConfig.of(h.value)
|
|
365
379
|
});
|
|
366
|
-
}, x = (a,
|
|
380
|
+
}, 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 = () => {
|
|
367
381
|
let a;
|
|
368
382
|
return (a = t.value.state.selection.ranges) !== null && a !== void 0 ? a : [];
|
|
369
|
-
},
|
|
383
|
+
}, z = () => {
|
|
370
384
|
let a;
|
|
371
385
|
return (a = t.value.state.sliceDoc(
|
|
372
386
|
t.value.state.selection.main.from,
|
|
373
387
|
t.value.state.selection.main.to
|
|
374
388
|
)) !== null && a !== void 0 ? a : "";
|
|
375
|
-
},
|
|
389
|
+
}, T = () => {
|
|
376
390
|
const a = t.value.state;
|
|
377
391
|
return a ? a.selection.ranges.map(
|
|
378
|
-
(
|
|
392
|
+
(n) => a.sliceDoc(n.from, n.to)
|
|
379
393
|
) : [];
|
|
380
|
-
},
|
|
394
|
+
}, D = () => t.value.state.selection.ranges.some(
|
|
381
395
|
(a) => !a.empty
|
|
382
|
-
),
|
|
383
|
-
changes: { from:
|
|
384
|
-
}),
|
|
385
|
-
selection:
|
|
386
|
-
}),
|
|
387
|
-
selection:
|
|
388
|
-
|
|
389
|
-
f.value.ranges.map((l) => l.extend(a(l)))
|
|
396
|
+
), E = (a, n, o) => t.value.dispatch({
|
|
397
|
+
changes: { from: n, to: o, insert: a }
|
|
398
|
+
}), 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({
|
|
399
|
+
selection: w.create(a, n)
|
|
400
|
+
}), W = (a) => t.value.dispatch({
|
|
401
|
+
selection: w.create(
|
|
402
|
+
f.value.ranges.map((n) => n.extend(a(n)))
|
|
390
403
|
)
|
|
391
|
-
}),
|
|
392
|
-
editor:
|
|
404
|
+
}), p = {
|
|
405
|
+
editor: l,
|
|
393
406
|
view: t,
|
|
394
407
|
cursor: m,
|
|
395
408
|
selection: f,
|
|
396
409
|
focus: d,
|
|
397
|
-
length:
|
|
410
|
+
length: S,
|
|
398
411
|
json: M,
|
|
399
412
|
diagnosticCount: g,
|
|
400
413
|
dom: t.value.contentDOM,
|
|
@@ -402,21 +415,21 @@ var oe = I({
|
|
|
402
415
|
forceReconfigure: j,
|
|
403
416
|
// Bellow is CodeMirror5's function
|
|
404
417
|
getRange: x,
|
|
405
|
-
getLine:
|
|
406
|
-
lineCount:
|
|
407
|
-
getCursor:
|
|
408
|
-
listSelections:
|
|
409
|
-
getSelection:
|
|
410
|
-
getSelections:
|
|
411
|
-
somethingSelected:
|
|
412
|
-
replaceRange:
|
|
413
|
-
replaceSelection:
|
|
414
|
-
setCursor:
|
|
415
|
-
setSelection:
|
|
416
|
-
setSelections:
|
|
417
|
-
extendSelectionsBy:
|
|
418
|
+
getLine: _,
|
|
419
|
+
lineCount: L,
|
|
420
|
+
getCursor: N,
|
|
421
|
+
listSelections: U,
|
|
422
|
+
getSelection: z,
|
|
423
|
+
getSelections: T,
|
|
424
|
+
somethingSelected: D,
|
|
425
|
+
replaceRange: E,
|
|
426
|
+
replaceSelection: R,
|
|
427
|
+
setCursor: F,
|
|
428
|
+
setSelection: J,
|
|
429
|
+
setSelections: A,
|
|
430
|
+
extendSelectionsBy: W
|
|
418
431
|
};
|
|
419
|
-
return
|
|
432
|
+
return i.expose(p), p;
|
|
420
433
|
},
|
|
421
434
|
render() {
|
|
422
435
|
return B(
|
|
@@ -430,20 +443,15 @@ var oe = I({
|
|
|
430
443
|
B(
|
|
431
444
|
"aside",
|
|
432
445
|
{ style: "display: none;", "aria-hidden": "true" },
|
|
433
|
-
|
|
446
|
+
oe(this.$slots.default)
|
|
434
447
|
)
|
|
435
448
|
) : void 0
|
|
436
449
|
);
|
|
437
450
|
}
|
|
438
451
|
});
|
|
439
|
-
const
|
|
440
|
-
version: "1.2.5",
|
|
441
|
-
date: "2024-02-05T00:38:11.929Z"
|
|
442
|
-
};
|
|
443
|
-
var ve = ie;
|
|
444
|
-
const me = (e) => e.component("CodeMirror", oe);
|
|
452
|
+
const he = (e) => e.component("CodeMirror", se);
|
|
445
453
|
export {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
ge as Meta,
|
|
455
|
+
se as default,
|
|
456
|
+
he as install
|
|
449
457
|
};
|
package/dist/index.iife.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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var CodeMirror=function(u,
|
|
13
|
-
`)===a||t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),
|
|
12
|
+
var CodeMirror=function(u,E,V,f,i,c,y,l){"use strict";var O={version:"1.3.0",date:"2024-04-24T08:18:55.338Z"};const $=e=>e?Object.entries(e).reduce((r,[o,s])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...r,[o]:s}),{}):{};function p(e,r={},o){if(l.isVue2)return l.h(e,r,o);const{props:s,domProps:t,on:v,...g}=r,h=v?$(v):{};return l.h(e,{...g,...s,...t,...h},o)}const M=e=>typeof e=="function"?e():e;var b=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),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))}),C=l.ref(0),m=l.ref(0),S=l.computed(()=>{const a=new i.Compartment,n=new i.Compartment;return[e.basic?y.basicSetup:void 0,e.minimal&&!e.basic?y.minimalSetup:void 0,c.EditorView.updateListener.of(d=>{r.emit("focus",t.value.hasFocus),C.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||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(g.value.ranges.map(n=>n.extend(a(n))))}),w={editor:o,view:t,cursor:h,selection:g,focus:v,length:C,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(w),w},render(){return p(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?p("aside",{style:"display: none;","aria-hidden":"true"},M(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",b);return u.Meta=O,u.default=b,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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(l,
|
|
13
|
-
`)===a||t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),o.onMounted(async()=>{let a=u.value;i.value&&(i.value.childNodes[0]&&(u.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=i.value.childNodes[0].innerText.trim()),t.value=new c.EditorView({parent:i.value,state:r.EditorState.create({doc:a,extensions:
|
|
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,o){"use strict";var O={version:"1.3.0",date:"2024-04-24T08:18:55.338Z"};const $=e=>e?Object.entries(e).reduce((d,[i,u])=>(i=i.charAt(0).toUpperCase()+i.slice(1),i=`on${i}`,{...d,[i]:u}),{}):{};function w(e,d={},i){if(o.isVue2)return o.h(e,d,i);const{props:u,domProps:t,on:m,...h}=d,g=m?$(m):{};return o.h(e,{...h,...u,...t,...g},i)}const M=e=>typeof e=="function"?e():e;var C=o.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 i=o.ref(),u=o.ref(e.modelValue),t=o.shallowRef(new c.EditorView),m=o.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),h=o.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),g=o.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=o.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(r.EditorState.fromJSON(a))}),E=o.ref(0),S=o.ref(0),y=o.computed(()=>{const a=new r.Compartment,n=new r.Compartment;return[e.basic?p.basicSetup:void 0,e.minimal&&!e.basic?p.minimalSetup:void 0,c.EditorView.updateListener.of(s=>{d.emit("focus",t.value.hasFocus),E.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)});o.watch(y,a=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of(a)})},{immediate:!0}),o.watch(()=>e.modelValue,async a=>{t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
|
|
13
|
+
`)===a||t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:t.value.state.selection,scrollIntoView:!0})},{immediate:!0}),o.onMounted(async()=>{let a=u.value;i.value&&(i.value.childNodes[0]&&(u.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=i.value.childNodes[0].innerText.trim()),t.value=new c.EditorView({parent:i.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 o.nextTick(),d.emit("ready",{view:t.value,state:t.value.state,container:i.value}))}),o.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(h.value.ranges.map(n=>n.extend(a(n))))}),b={editor:i,view:t,cursor:g,selection:h,focus:m,length:E,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(b),b},render(){return w(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?w("aside",{style:"display: none;","aria-hidden":"true"},M(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})});
|
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.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CodeMirror6 Component for vue2 and vue3.",
|
|
7
7
|
"keywords": [
|
|
@@ -79,48 +79,50 @@
|
|
|
79
79
|
"vue": "^2.7.14 || ^3.4"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@codemirror/lang-javascript": "^6.2.
|
|
82
|
+
"@codemirror/lang-javascript": "^6.2.2",
|
|
83
83
|
"@codemirror/lang-json": "^6.0.1",
|
|
84
|
-
"@codemirror/lang-markdown": "^6.2.
|
|
84
|
+
"@codemirror/lang-markdown": "^6.2.5",
|
|
85
85
|
"@codemirror/lang-vue": "0.1.2",
|
|
86
|
-
"@
|
|
87
|
-
"@
|
|
88
|
-
"@
|
|
89
|
-
"@
|
|
90
|
-
"@
|
|
86
|
+
"@eslint/js": "^9.1.1",
|
|
87
|
+
"@tsconfig/node-lts": "^20.1.3",
|
|
88
|
+
"@types/node": "^20.12.7",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
90
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
91
|
+
"@vue/compiler-sfc": "^3.4.24",
|
|
91
92
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
92
93
|
"@vue/tsconfig": "^0.5.1",
|
|
93
|
-
"@vueuse/core": "^10.
|
|
94
|
-
"bootstrap": "^5.3.
|
|
95
|
-
"eslint": "^
|
|
94
|
+
"@vueuse/core": "^10.9.0",
|
|
95
|
+
"bootstrap": "^5.3.3",
|
|
96
|
+
"eslint": "^9.1.1",
|
|
96
97
|
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
97
98
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
98
99
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
99
|
-
"eslint-linter-browserify": "^
|
|
100
|
-
"eslint-plugin-html": "^
|
|
100
|
+
"eslint-linter-browserify": "^9.1.1",
|
|
101
|
+
"eslint-plugin-html": "^8.1.1",
|
|
101
102
|
"eslint-plugin-import": "^2.29.1",
|
|
102
|
-
"eslint-plugin-n": "^
|
|
103
|
+
"eslint-plugin-n": "^17.2.1",
|
|
103
104
|
"eslint-plugin-promise": "^6.1.1",
|
|
104
105
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
105
106
|
"eslint-plugin-vue": "latest",
|
|
106
|
-
"eslint-plugin-vuejs-accessibility": "^2.
|
|
107
|
+
"eslint-plugin-vuejs-accessibility": "^2.3.0",
|
|
107
108
|
"eslint-plugin-yaml": "^0.5.0",
|
|
108
|
-
"husky": "^9.0.
|
|
109
|
-
"lint-staged": "^15.2.
|
|
109
|
+
"husky": "^9.0.11",
|
|
110
|
+
"lint-staged": "^15.2.2",
|
|
110
111
|
"npm-run-all": "^4.1.5",
|
|
111
112
|
"prettier": "^3.2.5",
|
|
112
113
|
"rimraf": "^5.0.5",
|
|
113
114
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
114
|
-
"sass": "^1.
|
|
115
|
-
"typescript": "^5.
|
|
116
|
-
"
|
|
115
|
+
"sass": "^1.75.0",
|
|
116
|
+
"typescript": "^5.4.5",
|
|
117
|
+
"typescript-eslint": "^7.7.1",
|
|
118
|
+
"vite": "^5.2.10",
|
|
117
119
|
"vite-plugin-banner": "^0.7.1",
|
|
118
120
|
"vite-plugin-checker": "^0.6.4",
|
|
119
|
-
"vite-plugin-dts": "^3.
|
|
120
|
-
"vue": "^3.4.
|
|
121
|
+
"vite-plugin-dts": "^3.9.0",
|
|
122
|
+
"vue": "^3.4.24",
|
|
121
123
|
"vue-eslint-parser": "^9.4.2",
|
|
122
124
|
"vue-markdown-wasm": "^0.4.0",
|
|
123
|
-
"vue-tsc": "^
|
|
125
|
+
"vue-tsc": "^2.0.14"
|
|
124
126
|
},
|
|
125
127
|
"husky": {
|
|
126
128
|
"hooks": {
|
|
@@ -132,10 +134,12 @@
|
|
|
132
134
|
"*": "prettier -w -u"
|
|
133
135
|
},
|
|
134
136
|
"resolutions": {
|
|
135
|
-
"json5": "
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
137
|
+
"json5": ">=2.2.3",
|
|
138
|
+
"ip": ">=2.0.1",
|
|
139
|
+
"lodash": ">=4.17.21",
|
|
140
|
+
"postcss": ">=8.4.31",
|
|
141
|
+
"semver": ">=7.5.3",
|
|
142
|
+
"tar": ">=6.2.1",
|
|
143
|
+
"yaml": ">=2.3.2"
|
|
140
144
|
}
|
|
141
|
-
}
|
|
145
|
+
}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
defineComponent,
|
|
4
|
-
nextTick,
|
|
5
|
-
onMounted,
|
|
6
|
-
onUnmounted,
|
|
7
|
-
ref,
|
|
8
|
-
shallowRef,
|
|
9
|
-
watch,
|
|
10
|
-
type ComputedRef,
|
|
11
|
-
type PropType,
|
|
12
|
-
type Ref,
|
|
13
|
-
type ShallowRef,
|
|
14
|
-
type WritableComputedRef,
|
|
15
|
-
} from 'vue-demi';
|
|
16
|
-
|
|
17
1
|
// Helpers
|
|
18
|
-
import h, { slot } from '@/helpers/h-demi';
|
|
19
2
|
|
|
20
3
|
// CodeMirror
|
|
21
|
-
import {
|
|
4
|
+
import { indentWithTab } from '@codemirror/commands';
|
|
5
|
+
import { indentUnit, type LanguageSupport } from '@codemirror/language';
|
|
22
6
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
diagnosticCount as linterDagnosticCount,
|
|
8
|
+
forceLinting,
|
|
9
|
+
linter,
|
|
10
|
+
lintGutter,
|
|
11
|
+
type Diagnostic,
|
|
12
|
+
type LintSource,
|
|
13
|
+
} from '@codemirror/lint';
|
|
28
14
|
import {
|
|
29
15
|
Compartment,
|
|
30
16
|
EditorSelection,
|
|
@@ -37,17 +23,32 @@ import {
|
|
|
37
23
|
type Text,
|
|
38
24
|
} from '@codemirror/state';
|
|
39
25
|
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
EditorView,
|
|
27
|
+
keymap,
|
|
28
|
+
placeholder,
|
|
29
|
+
type ViewUpdate,
|
|
30
|
+
} from '@codemirror/view';
|
|
31
|
+
import { basicSetup, minimalSetup } from 'codemirror';
|
|
32
|
+
import {
|
|
33
|
+
computed,
|
|
34
|
+
defineComponent,
|
|
35
|
+
nextTick,
|
|
36
|
+
onMounted,
|
|
37
|
+
onUnmounted,
|
|
38
|
+
ref,
|
|
39
|
+
shallowRef,
|
|
40
|
+
watch,
|
|
41
|
+
type ComputedRef,
|
|
42
|
+
type PropType,
|
|
43
|
+
type Ref,
|
|
44
|
+
type ShallowRef,
|
|
45
|
+
type WritableComputedRef,
|
|
46
|
+
} from 'vue-demi';
|
|
47
|
+
|
|
49
48
|
import type { StyleSpec } from 'style-mod';
|
|
50
49
|
|
|
50
|
+
import h, { slot } from '@/helpers/h-demi';
|
|
51
|
+
|
|
51
52
|
/** CodeMirror Component */
|
|
52
53
|
export default defineComponent({
|
|
53
54
|
/** Component Name */
|
|
@@ -71,7 +72,9 @@ export default defineComponent({
|
|
|
71
72
|
*/
|
|
72
73
|
theme: {
|
|
73
74
|
type: Object as PropType<Record<string, StyleSpec>>,
|
|
74
|
-
default: () => {
|
|
75
|
+
default: () => {
|
|
76
|
+
return {};
|
|
77
|
+
},
|
|
75
78
|
},
|
|
76
79
|
/** Dark Mode */
|
|
77
80
|
dark: {
|
|
@@ -125,6 +128,13 @@ export default defineComponent({
|
|
|
125
128
|
type: Boolean,
|
|
126
129
|
default: false,
|
|
127
130
|
},
|
|
131
|
+
/**
|
|
132
|
+
* Tab character
|
|
133
|
+
*/
|
|
134
|
+
indentUnit: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: undefined,
|
|
137
|
+
},
|
|
128
138
|
/**
|
|
129
139
|
* Allow Multiple Selection.
|
|
130
140
|
*
|
|
@@ -208,7 +218,7 @@ export default defineComponent({
|
|
|
208
218
|
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
209
219
|
*/
|
|
210
220
|
linter: {
|
|
211
|
-
type: Function as PropType<LintSource>,
|
|
221
|
+
type: Function as PropType<LintSource | any>,
|
|
212
222
|
default: undefined,
|
|
213
223
|
},
|
|
214
224
|
/**
|
|
@@ -241,7 +251,7 @@ export default defineComponent({
|
|
|
241
251
|
*/
|
|
242
252
|
gutter: {
|
|
243
253
|
type: Boolean,
|
|
244
|
-
|
|
254
|
+
default: false,
|
|
245
255
|
},
|
|
246
256
|
/**
|
|
247
257
|
* Gutter Config
|
|
@@ -263,19 +273,19 @@ export default defineComponent({
|
|
|
263
273
|
/** Emits */
|
|
264
274
|
emits: {
|
|
265
275
|
/** Model Update */
|
|
266
|
-
'update:modelValue': (
|
|
276
|
+
'update:modelValue': (_value: string | Text = '') => true,
|
|
267
277
|
/** CodeMirror ViewUpdate */
|
|
268
|
-
update: (
|
|
278
|
+
update: (_value: ViewUpdate) => true,
|
|
269
279
|
/** CodeMirror onReady */
|
|
270
|
-
ready: (
|
|
280
|
+
ready: (_value: {
|
|
271
281
|
view: EditorView;
|
|
272
282
|
state: EditorState;
|
|
273
283
|
container: HTMLElement;
|
|
274
284
|
}) => true,
|
|
275
285
|
/** CodeMirror onFocus */
|
|
276
|
-
focus: (
|
|
286
|
+
focus: (_value: boolean) => true,
|
|
277
287
|
/** State Changed */
|
|
278
|
-
change: (
|
|
288
|
+
change: (_value: EditorState) => true,
|
|
279
289
|
/** CodeMirror onDestroy */
|
|
280
290
|
destroy: () => true,
|
|
281
291
|
},
|
|
@@ -391,6 +401,8 @@ export default defineComponent({
|
|
|
391
401
|
props.wrap ? EditorView.lineWrapping : undefined,
|
|
392
402
|
// Indent with tab
|
|
393
403
|
props.tab ? keymap.of([indentWithTab]) : undefined,
|
|
404
|
+
// Tab character
|
|
405
|
+
props.indentUnit ? indentUnit.of(props.indentUnit) : undefined,
|
|
394
406
|
// Allow Multiple Selections
|
|
395
407
|
EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
396
408
|
// Indent tab size
|
|
@@ -656,7 +668,6 @@ export default defineComponent({
|
|
|
656
668
|
const extendSelectionsBy = (f: any): void =>
|
|
657
669
|
view.value.dispatch({
|
|
658
670
|
selection: EditorSelection.create(
|
|
659
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
660
671
|
selection.value.ranges.map((r: SelectionRange) => r.extend(f(r)))
|
|
661
672
|
),
|
|
662
673
|
});
|