@uiw/react-codemirror 4.25.8 → 4.25.10
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 +52 -33
- package/dist/codemirror.js +140 -88
- package/dist/codemirror.min.js +1 -1
- package/esm/getDefaultExtensions.js +13 -8
- package/esm/index.js +43 -43
- package/esm/useCodeMirror.js +44 -27
- package/package.json +2 -2
- package/src/__tests__/index.test.tsx +59 -0
package/dist/codemirror.js
CHANGED
|
@@ -314,8 +314,13 @@ class SearchCursor {
|
|
|
314
314
|
The current match (only holds a meaningful value after
|
|
315
315
|
[`next`](https://codemirror.net/6/docs/ref/#search.SearchCursor.next) has been called and when
|
|
316
316
|
`done` is false).
|
|
317
|
+
|
|
318
|
+
The `precise` flag will be set to false if the match starts or
|
|
319
|
+
ends _inside_ a character that, when normalized, expands to
|
|
320
|
+
multiple characters. It indicates that the `from`-`to` range
|
|
321
|
+
covers content that isn't part of the actual match.
|
|
317
322
|
*/
|
|
318
|
-
this.value = { from: 0, to: 0 };
|
|
323
|
+
this.value = { from: 0, to: 0, precise: false };
|
|
319
324
|
/**
|
|
320
325
|
Whether the end of the iterated region has been reached.
|
|
321
326
|
*/
|
|
@@ -366,44 +371,45 @@ class SearchCursor {
|
|
|
366
371
|
this.bufferPos += (0,state_.codePointSize)(next);
|
|
367
372
|
let norm = this.normalize(str);
|
|
368
373
|
if (norm.length)
|
|
369
|
-
for (let i = 0, pos = start;; i++) {
|
|
374
|
+
for (let i = 0, pos = start, posPrecise = true;; i++) {
|
|
370
375
|
let code = norm.charCodeAt(i);
|
|
371
|
-
let match = this.match(code, pos, this.bufferPos + this.bufferStart);
|
|
372
|
-
if (
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
return this;
|
|
376
|
-
}
|
|
377
|
-
break;
|
|
376
|
+
let match = this.match(code, pos, posPrecise, this.bufferPos + this.bufferStart, i == norm.length - 1);
|
|
377
|
+
if (match) {
|
|
378
|
+
this.value = match;
|
|
379
|
+
return this;
|
|
378
380
|
}
|
|
379
|
-
if (
|
|
381
|
+
if (i == norm.length - 1)
|
|
382
|
+
break;
|
|
383
|
+
if (posPrecise && i < str.length && str.charCodeAt(i) == code)
|
|
380
384
|
pos++;
|
|
385
|
+
else
|
|
386
|
+
posPrecise = false;
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
389
|
}
|
|
384
|
-
match(code, pos, end) {
|
|
390
|
+
match(code, pos, posPrecise, end, endPrecise) {
|
|
385
391
|
let match = null;
|
|
386
|
-
for (let i = 0; i < this.matches.length;
|
|
387
|
-
let
|
|
388
|
-
if (this.query.charCodeAt(index) == code) {
|
|
389
|
-
if (index == this.query.length - 1) {
|
|
390
|
-
match = { from:
|
|
392
|
+
for (let i = 0; i < this.matches.length;) {
|
|
393
|
+
let partial = this.matches[i], keep = false;
|
|
394
|
+
if (this.query.charCodeAt(partial.index) == code) {
|
|
395
|
+
if (partial.index == this.query.length - 1) {
|
|
396
|
+
match = { from: partial.from, to: end, precise: endPrecise && partial.precise };
|
|
391
397
|
}
|
|
392
398
|
else {
|
|
393
|
-
|
|
399
|
+
partial.index++;
|
|
394
400
|
keep = true;
|
|
395
401
|
}
|
|
396
402
|
}
|
|
397
|
-
if (
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
403
|
+
if (keep)
|
|
404
|
+
i++;
|
|
405
|
+
else
|
|
406
|
+
this.matches.splice(i, 1);
|
|
401
407
|
}
|
|
402
408
|
if (this.query.charCodeAt(0) == code) {
|
|
403
409
|
if (this.query.length == 1)
|
|
404
|
-
match = { from: pos, to: end };
|
|
410
|
+
match = { from: pos, to: end, precise: posPrecise && endPrecise };
|
|
405
411
|
else
|
|
406
|
-
this.matches.push(1,
|
|
412
|
+
this.matches.push({ from: pos, index: 1, precise: posPrecise });
|
|
407
413
|
}
|
|
408
414
|
if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferStart))
|
|
409
415
|
match = null;
|
|
@@ -413,7 +419,7 @@ class SearchCursor {
|
|
|
413
419
|
if (typeof Symbol != "undefined")
|
|
414
420
|
SearchCursor.prototype[Symbol.iterator] = function () { return this; };
|
|
415
421
|
|
|
416
|
-
const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec("") };
|
|
422
|
+
const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec(""), precise: true };
|
|
417
423
|
const baseFlags = "gm" + (/x/.unicode == null ? "" : "u");
|
|
418
424
|
/**
|
|
419
425
|
This class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)
|
|
@@ -438,7 +444,9 @@ class RegExpCursor {
|
|
|
438
444
|
/**
|
|
439
445
|
Will contain an object with the extent of the match and the
|
|
440
446
|
match object when [`next`](https://codemirror.net/6/docs/ref/#search.RegExpCursor.next)
|
|
441
|
-
sucessfully finds a match.
|
|
447
|
+
sucessfully finds a match. The `precise` flag is always true for
|
|
448
|
+
this type of cursor, and only there to make sure this cursor is
|
|
449
|
+
a subtype of `SearchCursor`.
|
|
442
450
|
*/
|
|
443
451
|
this.value = empty;
|
|
444
452
|
if (/\\[sWDnr]|\n|\r|\[\^/.test(query))
|
|
@@ -483,7 +491,7 @@ class RegExpCursor {
|
|
|
483
491
|
if (from == this.curLineStart + this.curLine.length)
|
|
484
492
|
this.nextLine();
|
|
485
493
|
if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {
|
|
486
|
-
this.value = { from, to, match };
|
|
494
|
+
this.value = { from, to, precise: true, match };
|
|
487
495
|
return this;
|
|
488
496
|
}
|
|
489
497
|
off = this.matchPos - this.curLineStart;
|
|
@@ -556,7 +564,7 @@ class MultilineRegExpCursor {
|
|
|
556
564
|
// again, since it'll likely be able to match more
|
|
557
565
|
if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) &&
|
|
558
566
|
(!this.test || this.test(from, to, match))) {
|
|
559
|
-
this.value = { from, to, match };
|
|
567
|
+
this.value = { from, to, precise: true, match };
|
|
560
568
|
this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));
|
|
561
569
|
return this;
|
|
562
570
|
}
|
|
@@ -1200,10 +1208,12 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
|
1200
1208
|
let next = match;
|
|
1201
1209
|
let changes = [], selection, replacement;
|
|
1202
1210
|
let effects = [];
|
|
1203
|
-
if (next.
|
|
1211
|
+
if (!next.precise) {
|
|
1212
|
+
next = query.nextMatch(state, next.from, next.to);
|
|
1213
|
+
}
|
|
1214
|
+
else if (next.from == from && next.to == to) {
|
|
1204
1215
|
replacement = state.toText(query.getReplacement(next));
|
|
1205
1216
|
changes.push({ from: next.from, to: next.to, insert: replacement });
|
|
1206
|
-
next = query.nextMatch(state, next.from, next.to);
|
|
1207
1217
|
effects.push(view_.EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
|
|
1208
1218
|
}
|
|
1209
1219
|
let changeSet = view.state.changes(changes);
|
|
@@ -1227,10 +1237,12 @@ replacement.
|
|
|
1227
1237
|
const replaceAll = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
1228
1238
|
if (view.state.readOnly)
|
|
1229
1239
|
return false;
|
|
1230
|
-
let changes =
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1240
|
+
let changes = [];
|
|
1241
|
+
for (let match of query.matchAll(view.state, 1e9)) {
|
|
1242
|
+
let { from, to, precise } = match;
|
|
1243
|
+
if (precise)
|
|
1244
|
+
changes.push({ from, to, insert: query.getReplacement(match) });
|
|
1245
|
+
}
|
|
1234
1246
|
if (!changes.length)
|
|
1235
1247
|
return false;
|
|
1236
1248
|
let announceText = view.state.phrase("replaced $ matches", changes.length) + ".";
|
|
@@ -1506,9 +1518,17 @@ const searchExtensions = [
|
|
|
1506
1518
|
var language_dist = __webpack_require__(194);
|
|
1507
1519
|
;// ../node_modules/@codemirror/autocomplete/dist/index.js
|
|
1508
1520
|
/* unused harmony import specifier */ var MapMode;
|
|
1521
|
+
/* unused harmony import specifier */ var StateEffect;
|
|
1522
|
+
/* unused harmony import specifier */ var StateField;
|
|
1523
|
+
/* unused harmony import specifier */ var EditorSelection;
|
|
1509
1524
|
/* unused harmony import specifier */ var Text;
|
|
1510
1525
|
/* unused harmony import specifier */ var Transaction;
|
|
1511
|
-
/* unused harmony import specifier */ var
|
|
1526
|
+
/* unused harmony import specifier */ var Facet;
|
|
1527
|
+
/* unused harmony import specifier */ var Prec;
|
|
1528
|
+
/* unused harmony import specifier */ var Decoration;
|
|
1529
|
+
/* unused harmony import specifier */ var WidgetType;
|
|
1530
|
+
/* unused harmony import specifier */ var EditorView;
|
|
1531
|
+
/* unused harmony import specifier */ var keymap;
|
|
1512
1532
|
/* unused harmony import specifier */ var syntaxTree;
|
|
1513
1533
|
/* unused harmony import specifier */ var indentUnit;
|
|
1514
1534
|
|
|
@@ -2008,8 +2028,8 @@ function rangeAroundSelected(total, selected, max) {
|
|
|
2008
2028
|
let off = Math.floor(selected / max);
|
|
2009
2029
|
return { from: off * max, to: (off + 1) * max };
|
|
2010
2030
|
}
|
|
2011
|
-
let off = Math.
|
|
2012
|
-
return { from: total -
|
|
2031
|
+
let off = Math.ceil((total - selected) / max);
|
|
2032
|
+
return { from: total - off * max, to: total - (off - 1) * max };
|
|
2013
2033
|
}
|
|
2014
2034
|
class CompletionTooltip {
|
|
2015
2035
|
constructor(view, stateField, applyCompletion) {
|
|
@@ -2868,7 +2888,8 @@ const dist_baseTheme = /*@__PURE__*/view_.EditorView.baseTheme({
|
|
|
2868
2888
|
content: '"···"',
|
|
2869
2889
|
opacity: 0.5,
|
|
2870
2890
|
display: "block",
|
|
2871
|
-
textAlign: "center"
|
|
2891
|
+
textAlign: "center",
|
|
2892
|
+
cursor: "pointer",
|
|
2872
2893
|
},
|
|
2873
2894
|
".cm-tooltip.cm-completionInfo": {
|
|
2874
2895
|
position: "absolute",
|
|
@@ -3028,20 +3049,20 @@ class Snippet {
|
|
|
3028
3049
|
return new Snippet(lines, positions);
|
|
3029
3050
|
}
|
|
3030
3051
|
}
|
|
3031
|
-
let fieldMarker = /*@__PURE__*/
|
|
3052
|
+
let fieldMarker = /*@__PURE__*/(/* unused pure expression or super */ null && (Decoration.widget({ widget: /*@__PURE__*/new class extends WidgetType {
|
|
3032
3053
|
toDOM() {
|
|
3033
3054
|
let span = document.createElement("span");
|
|
3034
3055
|
span.className = "cm-snippetFieldPosition";
|
|
3035
3056
|
return span;
|
|
3036
3057
|
}
|
|
3037
3058
|
ignoreEvent() { return false; }
|
|
3038
|
-
} });
|
|
3039
|
-
let fieldRange = /*@__PURE__*/
|
|
3059
|
+
} })));
|
|
3060
|
+
let fieldRange = /*@__PURE__*/(/* unused pure expression or super */ null && (Decoration.mark({ class: "cm-snippetField" })));
|
|
3040
3061
|
class ActiveSnippet {
|
|
3041
3062
|
constructor(ranges, active) {
|
|
3042
3063
|
this.ranges = ranges;
|
|
3043
3064
|
this.active = active;
|
|
3044
|
-
this.deco =
|
|
3065
|
+
this.deco = Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
|
|
3045
3066
|
}
|
|
3046
3067
|
map(changes) {
|
|
3047
3068
|
let ranges = [];
|
|
@@ -3057,11 +3078,11 @@ class ActiveSnippet {
|
|
|
3057
3078
|
return sel.ranges.every(range => this.ranges.some(r => r.field == this.active && r.from <= range.from && r.to >= range.to));
|
|
3058
3079
|
}
|
|
3059
3080
|
}
|
|
3060
|
-
const setActive = /*@__PURE__*/
|
|
3081
|
+
const setActive = /*@__PURE__*/(/* unused pure expression or super */ null && (StateEffect.define({
|
|
3061
3082
|
map(value, changes) { return value && value.map(changes); }
|
|
3062
|
-
});
|
|
3063
|
-
const moveToField = /*@__PURE__*/
|
|
3064
|
-
const snippetState = /*@__PURE__*/
|
|
3083
|
+
})));
|
|
3084
|
+
const moveToField = /*@__PURE__*/(/* unused pure expression or super */ null && (StateEffect.define()));
|
|
3085
|
+
const snippetState = /*@__PURE__*/(/* unused pure expression or super */ null && (StateField.define({
|
|
3065
3086
|
create() { return null; },
|
|
3066
3087
|
update(value, tr) {
|
|
3067
3088
|
for (let effect of tr.effects) {
|
|
@@ -3076,10 +3097,10 @@ const snippetState = /*@__PURE__*/state_.StateField.define({
|
|
|
3076
3097
|
value = null;
|
|
3077
3098
|
return value;
|
|
3078
3099
|
},
|
|
3079
|
-
provide: f =>
|
|
3080
|
-
});
|
|
3100
|
+
provide: f => EditorView.decorations.from(f, val => val ? val.deco : Decoration.none)
|
|
3101
|
+
})));
|
|
3081
3102
|
function fieldSelection(ranges, field) {
|
|
3082
|
-
return
|
|
3103
|
+
return EditorSelection.create(ranges.filter(r => r.field == field).map(r => EditorSelection.range(r.from, r.to)));
|
|
3083
3104
|
}
|
|
3084
3105
|
/**
|
|
3085
3106
|
Convert a snippet template to a function that can
|
|
@@ -3159,11 +3180,11 @@ const clearSnippet = ({ state, dispatch }) => {
|
|
|
3159
3180
|
/**
|
|
3160
3181
|
Move to the next snippet field, if available.
|
|
3161
3182
|
*/
|
|
3162
|
-
const nextSnippetField = /*@__PURE__*/moveField(1);
|
|
3183
|
+
const nextSnippetField = /*@__PURE__*/(/* unused pure expression or super */ null && (moveField(1)));
|
|
3163
3184
|
/**
|
|
3164
3185
|
Move to the previous snippet field, if available.
|
|
3165
3186
|
*/
|
|
3166
|
-
const prevSnippetField = /*@__PURE__*/moveField(-1);
|
|
3187
|
+
const prevSnippetField = /*@__PURE__*/(/* unused pure expression or super */ null && (moveField(-1)));
|
|
3167
3188
|
/**
|
|
3168
3189
|
Check if there is an active snippet with a next field for
|
|
3169
3190
|
`nextSnippetField` to move to.
|
|
@@ -3180,10 +3201,10 @@ function hasPrevSnippetField(state) {
|
|
|
3180
3201
|
let active = state.field(snippetState, false);
|
|
3181
3202
|
return !!(active && active.active > 0);
|
|
3182
3203
|
}
|
|
3183
|
-
const defaultSnippetKeymap = [
|
|
3204
|
+
const defaultSnippetKeymap = (/* unused pure expression or super */ null && ([
|
|
3184
3205
|
{ key: "Tab", run: nextSnippetField, shift: prevSnippetField },
|
|
3185
3206
|
{ key: "Escape", run: clearSnippet }
|
|
3186
|
-
];
|
|
3207
|
+
]));
|
|
3187
3208
|
/**
|
|
3188
3209
|
A facet that can be used to configure the key bindings used by
|
|
3189
3210
|
snippets. The default binds Tab to
|
|
@@ -3191,10 +3212,10 @@ snippets. The default binds Tab to
|
|
|
3191
3212
|
[`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape
|
|
3192
3213
|
to [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).
|
|
3193
3214
|
*/
|
|
3194
|
-
const snippetKeymap = /*@__PURE__*/
|
|
3215
|
+
const snippetKeymap = /*@__PURE__*/(/* unused pure expression or super */ null && (Facet.define({
|
|
3195
3216
|
combine(maps) { return maps.length ? maps[0] : defaultSnippetKeymap; }
|
|
3196
|
-
});
|
|
3197
|
-
const addSnippetKeymap = /*@__PURE__*/
|
|
3217
|
+
})));
|
|
3218
|
+
const addSnippetKeymap = /*@__PURE__*/(/* unused pure expression or super */ null && (Prec.highest(/*@__PURE__*/keymap.compute([snippetKeymap], state => state.facet(snippetKeymap)))));
|
|
3198
3219
|
/**
|
|
3199
3220
|
Create a completion from a snippet. Returns an object with the
|
|
3200
3221
|
properties from `completion`, plus an `apply` function that
|
|
@@ -3203,7 +3224,7 @@ applies the snippet.
|
|
|
3203
3224
|
function snippetCompletion(template, completion) {
|
|
3204
3225
|
return { ...completion, apply: snippet(template) };
|
|
3205
3226
|
}
|
|
3206
|
-
const snippetPointerHandler = /*@__PURE__*/
|
|
3227
|
+
const snippetPointerHandler = /*@__PURE__*/(/* unused pure expression or super */ null && (EditorView.domEventHandlers({
|
|
3207
3228
|
mousedown(event, view) {
|
|
3208
3229
|
let active = view.state.field(snippetState, false), pos;
|
|
3209
3230
|
if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
|
|
@@ -3219,7 +3240,7 @@ const snippetPointerHandler = /*@__PURE__*/view_.EditorView.domEventHandlers({
|
|
|
3219
3240
|
});
|
|
3220
3241
|
return true;
|
|
3221
3242
|
}
|
|
3222
|
-
});
|
|
3243
|
+
})));
|
|
3223
3244
|
|
|
3224
3245
|
function wordRE(wordChars) {
|
|
3225
3246
|
let escaped = wordChars.replace(/[\]\-\\]/g, "\\$&");
|
|
@@ -3591,7 +3612,7 @@ function completionStatus(state) {
|
|
|
3591
3612
|
return cState && cState.active.some(a => a.isPending) ? "pending"
|
|
3592
3613
|
: cState && cState.active.some(a => a.state != 0 /* State.Inactive */) ? "active" : null;
|
|
3593
3614
|
}
|
|
3594
|
-
const completionArrayCache = /*@__PURE__*/new WeakMap;
|
|
3615
|
+
const completionArrayCache = /*@__PURE__*/(/* unused pure expression or super */ null && (new WeakMap));
|
|
3595
3616
|
/**
|
|
3596
3617
|
Returns the available completions as an array.
|
|
3597
3618
|
*/
|
|
@@ -3633,9 +3654,13 @@ function setSelectedCompletion(index) {
|
|
|
3633
3654
|
|
|
3634
3655
|
|
|
3635
3656
|
;// ../node_modules/@codemirror/lint/dist/index.js
|
|
3657
|
+
/* unused harmony import specifier */ var activateHover;
|
|
3636
3658
|
/* unused harmony import specifier */ var ViewPlugin;
|
|
3637
3659
|
/* unused harmony import specifier */ var logException;
|
|
3660
|
+
/* unused harmony import specifier */ var gutter;
|
|
3661
|
+
/* unused harmony import specifier */ var dist_EditorView;
|
|
3638
3662
|
/* unused harmony import specifier */ var RangeSet;
|
|
3663
|
+
/* unused harmony import specifier */ var dist_StateField;
|
|
3639
3664
|
|
|
3640
3665
|
|
|
3641
3666
|
|
|
@@ -3886,12 +3911,17 @@ const nextDiagnostic = (view) => {
|
|
|
3886
3911
|
return false;
|
|
3887
3912
|
}
|
|
3888
3913
|
view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
|
|
3914
|
+
(0,view_.activateHover)(view, next.from, 1, {
|
|
3915
|
+
tooltip: lintHover,
|
|
3916
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < next.from || tr.newSelection.main.head > next.to
|
|
3917
|
+
});
|
|
3889
3918
|
return true;
|
|
3890
3919
|
};
|
|
3891
3920
|
/**
|
|
3892
3921
|
Move the selection to the previous diagnostic.
|
|
3893
3922
|
*/
|
|
3894
3923
|
const previousDiagnostic = (view) => {
|
|
3924
|
+
var _a;
|
|
3895
3925
|
let { state } = view, field = state.field(lintState, false);
|
|
3896
3926
|
if (!field)
|
|
3897
3927
|
return false;
|
|
@@ -3909,7 +3939,12 @@ const previousDiagnostic = (view) => {
|
|
|
3909
3939
|
});
|
|
3910
3940
|
if (lastFrom == null || prevFrom == null && lastFrom == sel.from)
|
|
3911
3941
|
return false;
|
|
3912
|
-
|
|
3942
|
+
let from = prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, to = (_a = prevTo !== null && prevTo !== void 0 ? prevTo : lastTo) !== null && _a !== void 0 ? _a : from;
|
|
3943
|
+
view.dispatch({ selection: { anchor: from, head: to }, scrollIntoView: true });
|
|
3944
|
+
activateHover(view, from, 1, {
|
|
3945
|
+
tooltip: lintHover,
|
|
3946
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < from || tr.newSelection.main.head > to
|
|
3947
|
+
});
|
|
3913
3948
|
return true;
|
|
3914
3949
|
};
|
|
3915
3950
|
/**
|
|
@@ -4303,7 +4338,7 @@ const lint_dist_baseTheme = /*@__PURE__*/view_.EditorView.baseTheme({
|
|
|
4303
4338
|
backgroundRepeat: "repeat-x",
|
|
4304
4339
|
paddingBottom: "0.7px",
|
|
4305
4340
|
},
|
|
4306
|
-
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#
|
|
4341
|
+
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#f11") },
|
|
4307
4342
|
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
|
|
4308
4343
|
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
|
|
4309
4344
|
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },
|
|
@@ -4459,9 +4494,9 @@ function markersForDiagnostics(doc, diagnostics) {
|
|
|
4459
4494
|
for (let line in byLine) {
|
|
4460
4495
|
markers.push(new LintGutterMarker(byLine[line]).range(+line));
|
|
4461
4496
|
}
|
|
4462
|
-
return
|
|
4497
|
+
return RangeSet.of(markers, true);
|
|
4463
4498
|
}
|
|
4464
|
-
const lintGutterExtension = /*@__PURE__*/(
|
|
4499
|
+
const lintGutterExtension = /*@__PURE__*/(/* unused pure expression or super */ null && (gutter({
|
|
4465
4500
|
class: "cm-gutter-lint",
|
|
4466
4501
|
markers: view => view.state.field(lintGutterMarkers),
|
|
4467
4502
|
widgetMarker: (view, widget, block) => {
|
|
@@ -4472,10 +4507,10 @@ const lintGutterExtension = /*@__PURE__*/(0,view_.gutter)({
|
|
|
4472
4507
|
});
|
|
4473
4508
|
return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
|
|
4474
4509
|
}
|
|
4475
|
-
});
|
|
4476
|
-
const lintGutterMarkers = /*@__PURE__*/
|
|
4510
|
+
})));
|
|
4511
|
+
const lintGutterMarkers = /*@__PURE__*/(/* unused pure expression or super */ null && (dist_StateField.define({
|
|
4477
4512
|
create() {
|
|
4478
|
-
return
|
|
4513
|
+
return RangeSet.empty;
|
|
4479
4514
|
},
|
|
4480
4515
|
update(markers, tr) {
|
|
4481
4516
|
markers = markers.map(tr.changes);
|
|
@@ -4490,7 +4525,7 @@ const lintGutterMarkers = /*@__PURE__*/state_.StateField.define({
|
|
|
4490
4525
|
}
|
|
4491
4526
|
return markers;
|
|
4492
4527
|
}
|
|
4493
|
-
});
|
|
4528
|
+
})));
|
|
4494
4529
|
const setLintGutterTooltip = /*@__PURE__*/state_.StateEffect.define();
|
|
4495
4530
|
const lintGutterTooltip = /*@__PURE__*/state_.StateField.define({
|
|
4496
4531
|
create() { return null; },
|
|
@@ -4501,7 +4536,7 @@ const lintGutterTooltip = /*@__PURE__*/state_.StateField.define({
|
|
|
4501
4536
|
},
|
|
4502
4537
|
provide: field => view_.showTooltip.from(field)
|
|
4503
4538
|
});
|
|
4504
|
-
const lintGutterTheme = /*@__PURE__*/
|
|
4539
|
+
const lintGutterTheme = /*@__PURE__*/(/* unused pure expression or super */ null && (dist_EditorView.baseTheme({
|
|
4505
4540
|
".cm-gutter-lint": {
|
|
4506
4541
|
width: "1.4em",
|
|
4507
4542
|
"& .cm-gutterElement": {
|
|
@@ -4521,7 +4556,8 @@ const lintGutterTheme = /*@__PURE__*/view_.EditorView.baseTheme({
|
|
|
4521
4556
|
".cm-lint-marker-error": {
|
|
4522
4557
|
content: /*@__PURE__*/svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
|
|
4523
4558
|
},
|
|
4524
|
-
});
|
|
4559
|
+
})));
|
|
4560
|
+
const lintHover = /*@__PURE__*/(0,view_.hoverTooltip)(lintTooltip, { hideOn: hideTooltip });
|
|
4525
4561
|
const lintExtensions = [
|
|
4526
4562
|
lintState,
|
|
4527
4563
|
/*@__PURE__*/view_.EditorView.decorations.compute([lintState], state => {
|
|
@@ -4530,7 +4566,7 @@ const lintExtensions = [
|
|
|
4530
4566
|
activeMark.range(selected.from, selected.to)
|
|
4531
4567
|
]);
|
|
4532
4568
|
}),
|
|
4533
|
-
|
|
4569
|
+
lintHover,
|
|
4534
4570
|
lint_dist_baseTheme
|
|
4535
4571
|
];
|
|
4536
4572
|
const lintGutterConfig = /*@__PURE__*/state_.Facet.define({
|
|
@@ -4631,9 +4667,9 @@ var basicSetup = function basicSetup(options) {
|
|
|
4631
4667
|
if (options === void 0) {
|
|
4632
4668
|
options = {};
|
|
4633
4669
|
}
|
|
4634
|
-
var
|
|
4635
|
-
|
|
4636
|
-
|
|
4670
|
+
var _options = options,
|
|
4671
|
+
_options$crosshairCur = _options.crosshairCursor,
|
|
4672
|
+
initCrosshairCursor = _options$crosshairCur === void 0 ? false : _options$crosshairCur;
|
|
4637
4673
|
var keymaps = [];
|
|
4638
4674
|
if (options.closeBracketsKeymap !== false) {
|
|
4639
4675
|
keymaps = keymaps.concat(closeBracketsKeymap);
|
|
@@ -5749,7 +5785,7 @@ const selectMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state,
|
|
|
5749
5785
|
function extendSel(target, how) {
|
|
5750
5786
|
let selection = updateSel(target.state.selection, range => {
|
|
5751
5787
|
let head = how(range);
|
|
5752
|
-
return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
|
|
5788
|
+
return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined, head.assoc);
|
|
5753
5789
|
});
|
|
5754
5790
|
if (selection.eq(target.state.selection))
|
|
5755
5791
|
return false;
|
|
@@ -7789,7 +7825,15 @@ class StyleSet {
|
|
|
7789
7825
|
// (min-width: 400px)": {...}}`.
|
|
7790
7826
|
|
|
7791
7827
|
;// ../node_modules/@codemirror/language/dist/index.js
|
|
7828
|
+
/* unused harmony import specifier */ var NodeProp;
|
|
7792
7829
|
/* unused harmony import specifier */ var RangeSet;
|
|
7830
|
+
/* unused harmony import specifier */ var Facet;
|
|
7831
|
+
/* unused harmony import specifier */ var Prec;
|
|
7832
|
+
/* unused harmony import specifier */ var RangeSetBuilder;
|
|
7833
|
+
/* unused harmony import specifier */ var ViewPlugin;
|
|
7834
|
+
/* unused harmony import specifier */ var Direction;
|
|
7835
|
+
/* unused harmony import specifier */ var EditorView;
|
|
7836
|
+
/* unused harmony import specifier */ var Decoration;
|
|
7793
7837
|
|
|
7794
7838
|
|
|
7795
7839
|
|
|
@@ -9773,6 +9817,8 @@ function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, bracket
|
|
|
9773
9817
|
return { start: firstToken, matched: false };
|
|
9774
9818
|
}
|
|
9775
9819
|
function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, brackets) {
|
|
9820
|
+
if (dir < 0 ? !pos : pos == state.doc.length)
|
|
9821
|
+
return null;
|
|
9776
9822
|
let startCh = dir < 0 ? state.sliceDoc(pos - 1, pos) : state.sliceDoc(pos, pos + 1);
|
|
9777
9823
|
let bracket = brackets.indexOf(startCh);
|
|
9778
9824
|
if (bracket < 0 || (bracket % 2 == 0) != (dir > 0))
|
|
@@ -10376,7 +10422,7 @@ function changeAddsRTL(change) {
|
|
|
10376
10422
|
});
|
|
10377
10423
|
return added;
|
|
10378
10424
|
}
|
|
10379
|
-
const alwaysIsolate = /*@__PURE__*/
|
|
10425
|
+
const alwaysIsolate = /*@__PURE__*/(/* unused pure expression or super */ null && (Facet.define({ combine: values => values.some(x => x) })));
|
|
10380
10426
|
/**
|
|
10381
10427
|
Make sure nodes
|
|
10382
10428
|
[marked](https://lezer.codemirror.net/docs/ref/#common.NodeProp^isolate)
|
|
@@ -10389,19 +10435,19 @@ function bidiIsolates(options = {}) {
|
|
|
10389
10435
|
extensions.push(alwaysIsolate.of(true));
|
|
10390
10436
|
return extensions;
|
|
10391
10437
|
}
|
|
10392
|
-
const isolateMarks = /*@__PURE__*/
|
|
10438
|
+
const isolateMarks = /*@__PURE__*/(/* unused pure expression or super */ null && (ViewPlugin.fromClass(class {
|
|
10393
10439
|
constructor(view) {
|
|
10394
10440
|
this.always = view.state.facet(alwaysIsolate) ||
|
|
10395
|
-
view.textDirection !=
|
|
10396
|
-
view.state.facet(
|
|
10441
|
+
view.textDirection != Direction.LTR ||
|
|
10442
|
+
view.state.facet(EditorView.perLineTextDirection);
|
|
10397
10443
|
this.hasRTL = !this.always && textHasRTL(view.state.doc);
|
|
10398
10444
|
this.tree = syntaxTree(view.state);
|
|
10399
|
-
this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) :
|
|
10445
|
+
this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : Decoration.none;
|
|
10400
10446
|
}
|
|
10401
10447
|
update(update) {
|
|
10402
10448
|
let always = update.state.facet(alwaysIsolate) ||
|
|
10403
|
-
update.view.textDirection !=
|
|
10404
|
-
update.state.facet(
|
|
10449
|
+
update.view.textDirection != Direction.LTR ||
|
|
10450
|
+
update.state.facet(EditorView.perLineTextDirection);
|
|
10405
10451
|
if (!always && !this.hasRTL && changeAddsRTL(update.changes))
|
|
10406
10452
|
this.hasRTL = true;
|
|
10407
10453
|
if (!always && !this.hasRTL)
|
|
@@ -10417,21 +10463,21 @@ const isolateMarks = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
10417
10463
|
provide: plugin => {
|
|
10418
10464
|
function access(view) {
|
|
10419
10465
|
var _a, _b;
|
|
10420
|
-
return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b :
|
|
10466
|
+
return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b : Decoration.none;
|
|
10421
10467
|
}
|
|
10422
|
-
return [
|
|
10423
|
-
|
|
10468
|
+
return [EditorView.outerDecorations.of(access),
|
|
10469
|
+
Prec.lowest(EditorView.bidiIsolatedRanges.of(access))];
|
|
10424
10470
|
}
|
|
10425
|
-
});
|
|
10471
|
+
})));
|
|
10426
10472
|
function buildDeco(view, tree, always) {
|
|
10427
|
-
let deco = new
|
|
10473
|
+
let deco = new RangeSetBuilder();
|
|
10428
10474
|
let ranges = view.visibleRanges;
|
|
10429
10475
|
if (!always)
|
|
10430
10476
|
ranges = clipRTLLines(ranges, view.state.doc);
|
|
10431
10477
|
for (let { from, to } of ranges) {
|
|
10432
10478
|
tree.iterate({
|
|
10433
10479
|
enter: node => {
|
|
10434
|
-
let iso = node.type.prop(
|
|
10480
|
+
let iso = node.type.prop(NodeProp.isolate);
|
|
10435
10481
|
if (iso)
|
|
10436
10482
|
deco.add(node.from, node.to, marks[iso]);
|
|
10437
10483
|
},
|
|
@@ -12524,8 +12570,14 @@ class StructureCursor {
|
|
|
12524
12570
|
let { cursor } = this, p = pos - this.offset;
|
|
12525
12571
|
while (!this.done && cursor.from < p) {
|
|
12526
12572
|
if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
|
|
12527
|
-
else if (
|
|
12528
|
-
|
|
12573
|
+
else if (cursor.to <= pos) {
|
|
12574
|
+
if (!cursor.next(false))
|
|
12575
|
+
this.done = true;
|
|
12576
|
+
// Moved to next node
|
|
12577
|
+
}
|
|
12578
|
+
else {
|
|
12579
|
+
break;
|
|
12580
|
+
}
|
|
12529
12581
|
}
|
|
12530
12582
|
}
|
|
12531
12583
|
hasNode(cursor) {
|