@vuu-ui/vuu-codemirror 0.8.17-debug → 0.8.18-debug
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/cjs/index.js +277 -555
- package/cjs/index.js.map +4 -4
- package/esm/index.js +277 -556
- package/esm/index.js.map +4 -4
- package/package.json +5 -3
- package/types/codemirror-basic-setup.d.ts +2 -0
- package/types/index.d.ts +21 -0
- package/types/parser-utils.d.ts +7 -0
- package/types/suggestion-utils.d.ts +27 -0
package/cjs/index.js
CHANGED
|
@@ -16,19 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __accessCheck = (obj, member, msg) => {
|
|
20
|
-
if (!member.has(obj))
|
|
21
|
-
throw TypeError("Cannot " + msg);
|
|
22
|
-
};
|
|
23
|
-
var __privateGet = (obj, member, getter) => {
|
|
24
|
-
__accessCheck(obj, member, "read from private field");
|
|
25
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
26
|
-
};
|
|
27
|
-
var __privateAdd = (obj, member, value) => {
|
|
28
|
-
if (member.has(obj))
|
|
29
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
30
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
31
|
-
};
|
|
32
19
|
|
|
33
20
|
// src/index.ts
|
|
34
21
|
var src_exports = {};
|
|
@@ -73,7 +60,7 @@ __export(src_exports, {
|
|
|
73
60
|
module.exports = __toCommonJS(src_exports);
|
|
74
61
|
|
|
75
62
|
// ../../node_modules/@codemirror/state/dist/index.js
|
|
76
|
-
var Text = class {
|
|
63
|
+
var Text = class _Text {
|
|
77
64
|
/**
|
|
78
65
|
Get the line description around the given position.
|
|
79
66
|
*/
|
|
@@ -216,15 +203,15 @@ var Text = class {
|
|
|
216
203
|
if (text.length == 0)
|
|
217
204
|
throw new RangeError("A document must have at least one line");
|
|
218
205
|
if (text.length == 1 && !text[0])
|
|
219
|
-
return
|
|
206
|
+
return _Text.empty;
|
|
220
207
|
return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
221
208
|
}
|
|
222
209
|
};
|
|
223
|
-
var TextLeaf = class extends Text {
|
|
224
|
-
constructor(text,
|
|
210
|
+
var TextLeaf = class _TextLeaf extends Text {
|
|
211
|
+
constructor(text, length = textLength(text)) {
|
|
225
212
|
super();
|
|
226
213
|
this.text = text;
|
|
227
|
-
this.length =
|
|
214
|
+
this.length = length;
|
|
228
215
|
}
|
|
229
216
|
get lines() {
|
|
230
217
|
return this.text.length;
|
|
@@ -242,28 +229,28 @@ var TextLeaf = class extends Text {
|
|
|
242
229
|
}
|
|
243
230
|
}
|
|
244
231
|
decompose(from, to, target, open) {
|
|
245
|
-
let text = from <= 0 && to >= this.length ? this : new
|
|
232
|
+
let text = from <= 0 && to >= this.length ? this : new _TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
|
|
246
233
|
if (open & 1) {
|
|
247
234
|
let prev = target.pop();
|
|
248
235
|
let joined = appendText(text.text, prev.text.slice(), 0, text.length);
|
|
249
236
|
if (joined.length <= 32) {
|
|
250
|
-
target.push(new
|
|
237
|
+
target.push(new _TextLeaf(joined, prev.length + text.length));
|
|
251
238
|
} else {
|
|
252
239
|
let mid = joined.length >> 1;
|
|
253
|
-
target.push(new
|
|
240
|
+
target.push(new _TextLeaf(joined.slice(0, mid)), new _TextLeaf(joined.slice(mid)));
|
|
254
241
|
}
|
|
255
242
|
} else {
|
|
256
243
|
target.push(text);
|
|
257
244
|
}
|
|
258
245
|
}
|
|
259
246
|
replace(from, to, text) {
|
|
260
|
-
if (!(text instanceof
|
|
247
|
+
if (!(text instanceof _TextLeaf))
|
|
261
248
|
return super.replace(from, to, text);
|
|
262
249
|
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
|
|
263
250
|
let newLen = this.length + text.length - (to - from);
|
|
264
251
|
if (lines.length <= 32)
|
|
265
|
-
return new
|
|
266
|
-
return TextNode.from(
|
|
252
|
+
return new _TextLeaf(lines, newLen);
|
|
253
|
+
return TextNode.from(_TextLeaf.split(lines, []), newLen);
|
|
267
254
|
}
|
|
268
255
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
269
256
|
let result = "";
|
|
@@ -290,21 +277,21 @@ var TextLeaf = class extends Text {
|
|
|
290
277
|
part.push(line);
|
|
291
278
|
len += line.length + 1;
|
|
292
279
|
if (part.length == 32) {
|
|
293
|
-
target.push(new
|
|
280
|
+
target.push(new _TextLeaf(part, len));
|
|
294
281
|
part = [];
|
|
295
282
|
len = -1;
|
|
296
283
|
}
|
|
297
284
|
}
|
|
298
285
|
if (len > -1)
|
|
299
|
-
target.push(new
|
|
286
|
+
target.push(new _TextLeaf(part, len));
|
|
300
287
|
return target;
|
|
301
288
|
}
|
|
302
289
|
};
|
|
303
|
-
var TextNode = class extends Text {
|
|
304
|
-
constructor(children,
|
|
290
|
+
var TextNode = class _TextNode extends Text {
|
|
291
|
+
constructor(children, length) {
|
|
305
292
|
super();
|
|
306
293
|
this.children = children;
|
|
307
|
-
this.length =
|
|
294
|
+
this.length = length;
|
|
308
295
|
this.lines = 0;
|
|
309
296
|
for (let child of children)
|
|
310
297
|
this.lines += child.lines;
|
|
@@ -341,7 +328,7 @@ var TextNode = class extends Text {
|
|
|
341
328
|
if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) {
|
|
342
329
|
let copy = this.children.slice();
|
|
343
330
|
copy[i] = updated;
|
|
344
|
-
return new
|
|
331
|
+
return new _TextNode(copy, this.length - (to - from) + text.length);
|
|
345
332
|
}
|
|
346
333
|
return super.replace(pos, end, updated);
|
|
347
334
|
}
|
|
@@ -366,20 +353,20 @@ var TextNode = class extends Text {
|
|
|
366
353
|
child.flatten(target);
|
|
367
354
|
}
|
|
368
355
|
scanIdentical(other, dir) {
|
|
369
|
-
if (!(other instanceof
|
|
356
|
+
if (!(other instanceof _TextNode))
|
|
370
357
|
return 0;
|
|
371
|
-
let
|
|
358
|
+
let length = 0;
|
|
372
359
|
let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length] : [this.children.length - 1, other.children.length - 1, -1, -1];
|
|
373
360
|
for (; ; iA += dir, iB += dir) {
|
|
374
361
|
if (iA == eA || iB == eB)
|
|
375
|
-
return
|
|
362
|
+
return length;
|
|
376
363
|
let chA = this.children[iA], chB = other.children[iB];
|
|
377
364
|
if (chA != chB)
|
|
378
|
-
return
|
|
379
|
-
|
|
365
|
+
return length + chA.scanIdentical(chB, dir);
|
|
366
|
+
length += chA.length + 1;
|
|
380
367
|
}
|
|
381
368
|
}
|
|
382
|
-
static from(children,
|
|
369
|
+
static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {
|
|
383
370
|
let lines = 0;
|
|
384
371
|
for (let ch of children)
|
|
385
372
|
lines += ch.lines;
|
|
@@ -387,7 +374,7 @@ var TextNode = class extends Text {
|
|
|
387
374
|
let flat = [];
|
|
388
375
|
for (let ch of children)
|
|
389
376
|
ch.flatten(flat);
|
|
390
|
-
return new TextLeaf(flat,
|
|
377
|
+
return new TextLeaf(flat, length);
|
|
391
378
|
}
|
|
392
379
|
let chunk = Math.max(
|
|
393
380
|
32,
|
|
@@ -397,7 +384,7 @@ var TextNode = class extends Text {
|
|
|
397
384
|
let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];
|
|
398
385
|
function add(child) {
|
|
399
386
|
let last;
|
|
400
|
-
if (child.lines > maxChunk && child instanceof
|
|
387
|
+
if (child.lines > maxChunk && child instanceof _TextNode) {
|
|
401
388
|
for (let node of child.children)
|
|
402
389
|
add(node);
|
|
403
390
|
} else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {
|
|
@@ -418,22 +405,22 @@ var TextNode = class extends Text {
|
|
|
418
405
|
function flush() {
|
|
419
406
|
if (currentLines == 0)
|
|
420
407
|
return;
|
|
421
|
-
chunked.push(currentChunk.length == 1 ? currentChunk[0] :
|
|
408
|
+
chunked.push(currentChunk.length == 1 ? currentChunk[0] : _TextNode.from(currentChunk, currentLen));
|
|
422
409
|
currentLen = -1;
|
|
423
410
|
currentLines = currentChunk.length = 0;
|
|
424
411
|
}
|
|
425
412
|
for (let child of children)
|
|
426
413
|
add(child);
|
|
427
414
|
flush();
|
|
428
|
-
return chunked.length == 1 ? chunked[0] : new
|
|
415
|
+
return chunked.length == 1 ? chunked[0] : new _TextNode(chunked, length);
|
|
429
416
|
}
|
|
430
417
|
};
|
|
431
418
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
432
419
|
function textLength(text) {
|
|
433
|
-
let
|
|
420
|
+
let length = -1;
|
|
434
421
|
for (let line of text)
|
|
435
|
-
|
|
436
|
-
return
|
|
422
|
+
length += line.length + 1;
|
|
423
|
+
return length;
|
|
437
424
|
}
|
|
438
425
|
function appendText(text, target, from = 0, to = 1e9) {
|
|
439
426
|
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
@@ -695,7 +682,7 @@ var MapMode = /* @__PURE__ */ function(MapMode2) {
|
|
|
695
682
|
MapMode2[MapMode2["TrackAfter"] = 3] = "TrackAfter";
|
|
696
683
|
return MapMode2;
|
|
697
684
|
}(MapMode || (MapMode = {}));
|
|
698
|
-
var ChangeDesc = class {
|
|
685
|
+
var ChangeDesc = class _ChangeDesc {
|
|
699
686
|
// Sections are encoded as pairs of integers. The first is the
|
|
700
687
|
// length in the current document, and the second is -1 for
|
|
701
688
|
// unaffected sections, and the length of the replacement content
|
|
@@ -777,7 +764,7 @@ var ChangeDesc = class {
|
|
|
777
764
|
else
|
|
778
765
|
sections.push(ins, len);
|
|
779
766
|
}
|
|
780
|
-
return new
|
|
767
|
+
return new _ChangeDesc(sections);
|
|
781
768
|
}
|
|
782
769
|
/**
|
|
783
770
|
Compute the combined effect of applying another set of changes
|
|
@@ -855,16 +842,16 @@ var ChangeDesc = class {
|
|
|
855
842
|
static fromJSON(json) {
|
|
856
843
|
if (!Array.isArray(json) || json.length % 2 || json.some((a) => typeof a != "number"))
|
|
857
844
|
throw new RangeError("Invalid JSON representation of ChangeDesc");
|
|
858
|
-
return new
|
|
845
|
+
return new _ChangeDesc(json);
|
|
859
846
|
}
|
|
860
847
|
/**
|
|
861
848
|
@internal
|
|
862
849
|
*/
|
|
863
850
|
static create(sections) {
|
|
864
|
-
return new
|
|
851
|
+
return new _ChangeDesc(sections);
|
|
865
852
|
}
|
|
866
853
|
};
|
|
867
|
-
var ChangeSet = class extends ChangeDesc {
|
|
854
|
+
var ChangeSet = class _ChangeSet extends ChangeDesc {
|
|
868
855
|
constructor(sections, inserted) {
|
|
869
856
|
super(sections);
|
|
870
857
|
this.inserted = inserted;
|
|
@@ -902,7 +889,7 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
902
889
|
}
|
|
903
890
|
pos += len;
|
|
904
891
|
}
|
|
905
|
-
return new
|
|
892
|
+
return new _ChangeSet(sections, inserted);
|
|
906
893
|
}
|
|
907
894
|
/**
|
|
908
895
|
Combine two subsequent change sets into a single set. `other`
|
|
@@ -981,7 +968,7 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
981
968
|
}
|
|
982
969
|
}
|
|
983
970
|
return {
|
|
984
|
-
changes: new
|
|
971
|
+
changes: new _ChangeSet(resultSections, resultInserted),
|
|
985
972
|
filtered: ChangeDesc.create(filteredSections)
|
|
986
973
|
};
|
|
987
974
|
}
|
|
@@ -1005,33 +992,33 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
1005
992
|
Create a change set for the given changes, for a document of the
|
|
1006
993
|
given length, using `lineSep` as line separator.
|
|
1007
994
|
*/
|
|
1008
|
-
static of(changes,
|
|
995
|
+
static of(changes, length, lineSep) {
|
|
1009
996
|
let sections = [], inserted = [], pos = 0;
|
|
1010
997
|
let total = null;
|
|
1011
998
|
function flush(force = false) {
|
|
1012
999
|
if (!force && !sections.length)
|
|
1013
1000
|
return;
|
|
1014
|
-
if (pos <
|
|
1015
|
-
addSection(sections,
|
|
1016
|
-
let set = new
|
|
1001
|
+
if (pos < length)
|
|
1002
|
+
addSection(sections, length - pos, -1);
|
|
1003
|
+
let set = new _ChangeSet(sections, inserted);
|
|
1017
1004
|
total = total ? total.compose(set.map(total)) : set;
|
|
1018
1005
|
sections = [];
|
|
1019
1006
|
inserted = [];
|
|
1020
1007
|
pos = 0;
|
|
1021
1008
|
}
|
|
1022
|
-
function
|
|
1009
|
+
function process(spec) {
|
|
1023
1010
|
if (Array.isArray(spec)) {
|
|
1024
1011
|
for (let sub of spec)
|
|
1025
|
-
|
|
1026
|
-
} else if (spec instanceof
|
|
1027
|
-
if (spec.length !=
|
|
1028
|
-
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${
|
|
1012
|
+
process(sub);
|
|
1013
|
+
} else if (spec instanceof _ChangeSet) {
|
|
1014
|
+
if (spec.length != length)
|
|
1015
|
+
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);
|
|
1029
1016
|
flush();
|
|
1030
1017
|
total = total ? total.compose(spec.map(total)) : spec;
|
|
1031
1018
|
} else {
|
|
1032
1019
|
let { from, to = from, insert: insert2 } = spec;
|
|
1033
|
-
if (from > to || from < 0 || to >
|
|
1034
|
-
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${
|
|
1020
|
+
if (from > to || from < 0 || to > length)
|
|
1021
|
+
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);
|
|
1035
1022
|
let insText = !insert2 ? Text.empty : typeof insert2 == "string" ? Text.of(insert2.split(lineSep || DefaultSplit)) : insert2;
|
|
1036
1023
|
let insLen = insText.length;
|
|
1037
1024
|
if (from == to && insLen == 0)
|
|
@@ -1045,15 +1032,15 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
1045
1032
|
pos = to;
|
|
1046
1033
|
}
|
|
1047
1034
|
}
|
|
1048
|
-
|
|
1035
|
+
process(changes);
|
|
1049
1036
|
flush(!total);
|
|
1050
1037
|
return total;
|
|
1051
1038
|
}
|
|
1052
1039
|
/**
|
|
1053
1040
|
Create an empty changeset of the given length.
|
|
1054
1041
|
*/
|
|
1055
|
-
static empty(
|
|
1056
|
-
return new
|
|
1042
|
+
static empty(length) {
|
|
1043
|
+
return new _ChangeSet(length ? [length, -1] : [], []);
|
|
1057
1044
|
}
|
|
1058
1045
|
/**
|
|
1059
1046
|
Create a changeset from its JSON representation (as produced by
|
|
@@ -1078,13 +1065,13 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
1078
1065
|
sections.push(part[0], inserted[i].length);
|
|
1079
1066
|
}
|
|
1080
1067
|
}
|
|
1081
|
-
return new
|
|
1068
|
+
return new _ChangeSet(sections, inserted);
|
|
1082
1069
|
}
|
|
1083
1070
|
/**
|
|
1084
1071
|
@internal
|
|
1085
1072
|
*/
|
|
1086
1073
|
static createSet(sections, inserted) {
|
|
1087
|
-
return new
|
|
1074
|
+
return new _ChangeSet(sections, inserted);
|
|
1088
1075
|
}
|
|
1089
1076
|
};
|
|
1090
1077
|
function addSection(sections, len, ins, forceJoin = false) {
|
|
@@ -1278,7 +1265,7 @@ var SectionIter = class {
|
|
|
1278
1265
|
}
|
|
1279
1266
|
}
|
|
1280
1267
|
};
|
|
1281
|
-
var SelectionRange = class {
|
|
1268
|
+
var SelectionRange = class _SelectionRange {
|
|
1282
1269
|
constructor(from, to, flags) {
|
|
1283
1270
|
this.from = from;
|
|
1284
1271
|
this.to = to;
|
|
@@ -1343,7 +1330,7 @@ var SelectionRange = class {
|
|
|
1343
1330
|
from = change.mapPos(this.from, 1);
|
|
1344
1331
|
to = change.mapPos(this.to, -1);
|
|
1345
1332
|
}
|
|
1346
|
-
return from == this.from && to == this.to ? this : new
|
|
1333
|
+
return from == this.from && to == this.to ? this : new _SelectionRange(from, to, this.flags);
|
|
1347
1334
|
}
|
|
1348
1335
|
/**
|
|
1349
1336
|
Extend this range to cover at least `from` to `to`.
|
|
@@ -1379,10 +1366,10 @@ var SelectionRange = class {
|
|
|
1379
1366
|
@internal
|
|
1380
1367
|
*/
|
|
1381
1368
|
static create(from, to, flags) {
|
|
1382
|
-
return new
|
|
1369
|
+
return new _SelectionRange(from, to, flags);
|
|
1383
1370
|
}
|
|
1384
1371
|
};
|
|
1385
|
-
var EditorSelection = class {
|
|
1372
|
+
var EditorSelection = class _EditorSelection {
|
|
1386
1373
|
constructor(ranges, mainIndex) {
|
|
1387
1374
|
this.ranges = ranges;
|
|
1388
1375
|
this.mainIndex = mainIndex;
|
|
@@ -1394,7 +1381,7 @@ var EditorSelection = class {
|
|
|
1394
1381
|
map(change, assoc = -1) {
|
|
1395
1382
|
if (change.empty)
|
|
1396
1383
|
return this;
|
|
1397
|
-
return
|
|
1384
|
+
return _EditorSelection.create(this.ranges.map((r) => r.map(change, assoc)), this.mainIndex);
|
|
1398
1385
|
}
|
|
1399
1386
|
/**
|
|
1400
1387
|
Compare this selection to another selection.
|
|
@@ -1420,13 +1407,13 @@ var EditorSelection = class {
|
|
|
1420
1407
|
holding only the main range from this selection.
|
|
1421
1408
|
*/
|
|
1422
1409
|
asSingle() {
|
|
1423
|
-
return this.ranges.length == 1 ? this : new
|
|
1410
|
+
return this.ranges.length == 1 ? this : new _EditorSelection([this.main], 0);
|
|
1424
1411
|
}
|
|
1425
1412
|
/**
|
|
1426
1413
|
Extend this selection with an extra range.
|
|
1427
1414
|
*/
|
|
1428
1415
|
addRange(range, main = true) {
|
|
1429
|
-
return
|
|
1416
|
+
return _EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);
|
|
1430
1417
|
}
|
|
1431
1418
|
/**
|
|
1432
1419
|
Replace a given range with another range, and then normalize the
|
|
@@ -1435,7 +1422,7 @@ var EditorSelection = class {
|
|
|
1435
1422
|
replaceRange(range, which = this.mainIndex) {
|
|
1436
1423
|
let ranges = this.ranges.slice();
|
|
1437
1424
|
ranges[which] = range;
|
|
1438
|
-
return
|
|
1425
|
+
return _EditorSelection.create(ranges, this.mainIndex);
|
|
1439
1426
|
}
|
|
1440
1427
|
/**
|
|
1441
1428
|
Convert this selection to an object that can be serialized to
|
|
@@ -1450,13 +1437,13 @@ var EditorSelection = class {
|
|
|
1450
1437
|
static fromJSON(json) {
|
|
1451
1438
|
if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length)
|
|
1452
1439
|
throw new RangeError("Invalid JSON representation for EditorSelection");
|
|
1453
|
-
return new
|
|
1440
|
+
return new _EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);
|
|
1454
1441
|
}
|
|
1455
1442
|
/**
|
|
1456
1443
|
Create a selection holding a single range.
|
|
1457
1444
|
*/
|
|
1458
1445
|
static single(anchor, head = anchor) {
|
|
1459
|
-
return new
|
|
1446
|
+
return new _EditorSelection([_EditorSelection.range(anchor, head)], 0);
|
|
1460
1447
|
}
|
|
1461
1448
|
/**
|
|
1462
1449
|
Sort and merge the given set of ranges, creating a valid
|
|
@@ -1468,10 +1455,10 @@ var EditorSelection = class {
|
|
|
1468
1455
|
for (let pos = 0, i = 0; i < ranges.length; i++) {
|
|
1469
1456
|
let range = ranges[i];
|
|
1470
1457
|
if (range.empty ? range.from <= pos : range.from < pos)
|
|
1471
|
-
return
|
|
1458
|
+
return _EditorSelection.normalized(ranges.slice(), mainIndex);
|
|
1472
1459
|
pos = range.to;
|
|
1473
1460
|
}
|
|
1474
|
-
return new
|
|
1461
|
+
return new _EditorSelection(ranges, mainIndex);
|
|
1475
1462
|
}
|
|
1476
1463
|
/**
|
|
1477
1464
|
Create a cursor selection range at the given position. You can
|
|
@@ -1500,10 +1487,10 @@ var EditorSelection = class {
|
|
|
1500
1487
|
let from = prev.from, to = Math.max(range.to, prev.to);
|
|
1501
1488
|
if (i <= mainIndex)
|
|
1502
1489
|
mainIndex--;
|
|
1503
|
-
ranges.splice(--i, 2, range.anchor > range.head ?
|
|
1490
|
+
ranges.splice(--i, 2, range.anchor > range.head ? _EditorSelection.range(to, from) : _EditorSelection.range(from, to));
|
|
1504
1491
|
}
|
|
1505
1492
|
}
|
|
1506
|
-
return new
|
|
1493
|
+
return new _EditorSelection(ranges, mainIndex);
|
|
1507
1494
|
}
|
|
1508
1495
|
};
|
|
1509
1496
|
function checkSelection(selection, docLength) {
|
|
@@ -1512,7 +1499,7 @@ function checkSelection(selection, docLength) {
|
|
|
1512
1499
|
throw new RangeError("Selection points outside of document");
|
|
1513
1500
|
}
|
|
1514
1501
|
var nextID = 0;
|
|
1515
|
-
var Facet = class {
|
|
1502
|
+
var Facet = class _Facet {
|
|
1516
1503
|
constructor(combine, compareInput, compare2, isStatic, enables) {
|
|
1517
1504
|
this.combine = combine;
|
|
1518
1505
|
this.compareInput = compareInput;
|
|
@@ -1526,7 +1513,7 @@ var Facet = class {
|
|
|
1526
1513
|
Define a new facet.
|
|
1527
1514
|
*/
|
|
1528
1515
|
static define(config2 = {}) {
|
|
1529
|
-
return new
|
|
1516
|
+
return new _Facet(config2.combine || ((a) => a), config2.compareInput || ((a, b) => a === b), config2.compare || (!config2.combine ? sameArray : (a, b) => a === b), !!config2.static, config2.enables);
|
|
1530
1517
|
}
|
|
1531
1518
|
/**
|
|
1532
1519
|
Returns an extension that adds the given value to this facet.
|
|
@@ -1688,7 +1675,7 @@ function dynamicFacetSlot(addresses, facet, providers) {
|
|
|
1688
1675
|
};
|
|
1689
1676
|
}
|
|
1690
1677
|
var initField = /* @__PURE__ */ Facet.define({ static: true });
|
|
1691
|
-
var StateField = class {
|
|
1678
|
+
var StateField = class _StateField {
|
|
1692
1679
|
constructor(id, createF, updateF, compareF, spec) {
|
|
1693
1680
|
this.id = id;
|
|
1694
1681
|
this.createF = createF;
|
|
@@ -1701,7 +1688,7 @@ var StateField = class {
|
|
|
1701
1688
|
Define a state field.
|
|
1702
1689
|
*/
|
|
1703
1690
|
static define(config2) {
|
|
1704
|
-
let field = new
|
|
1691
|
+
let field = new _StateField(nextID++, config2.create, config2.update, config2.compare || ((a, b) => a === b), config2);
|
|
1705
1692
|
if (config2.provide)
|
|
1706
1693
|
field.provides = config2.provide(field);
|
|
1707
1694
|
return field;
|
|
@@ -1791,7 +1778,7 @@ var PrecExtension = class {
|
|
|
1791
1778
|
this.prec = prec2;
|
|
1792
1779
|
}
|
|
1793
1780
|
};
|
|
1794
|
-
var Compartment = class {
|
|
1781
|
+
var Compartment = class _Compartment {
|
|
1795
1782
|
/**
|
|
1796
1783
|
Create an instance of this compartment to add to your [state
|
|
1797
1784
|
configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).
|
|
@@ -1804,7 +1791,7 @@ var Compartment = class {
|
|
|
1804
1791
|
reconfigures this compartment.
|
|
1805
1792
|
*/
|
|
1806
1793
|
reconfigure(content) {
|
|
1807
|
-
return
|
|
1794
|
+
return _Compartment.reconfigure.of({ compartment: this, extension: content });
|
|
1808
1795
|
}
|
|
1809
1796
|
/**
|
|
1810
1797
|
Get the current content of the compartment in the state, or
|
|
@@ -1820,7 +1807,7 @@ var CompartmentInstance = class {
|
|
|
1820
1807
|
this.inner = inner;
|
|
1821
1808
|
}
|
|
1822
1809
|
};
|
|
1823
|
-
var Configuration = class {
|
|
1810
|
+
var Configuration = class _Configuration {
|
|
1824
1811
|
constructor(base2, compartments, dynamicSlots, address, staticValues, facets) {
|
|
1825
1812
|
this.base = base2;
|
|
1826
1813
|
this.compartments = compartments;
|
|
@@ -1886,7 +1873,7 @@ var Configuration = class {
|
|
|
1886
1873
|
}
|
|
1887
1874
|
}
|
|
1888
1875
|
let dynamic = dynamicSlots.map((f) => f(address));
|
|
1889
|
-
return new
|
|
1876
|
+
return new _Configuration(base2, newCompartments, dynamic, address, staticValues, facets);
|
|
1890
1877
|
}
|
|
1891
1878
|
};
|
|
1892
1879
|
function flatten(extension, compartments, newCompartments) {
|
|
@@ -2002,7 +1989,7 @@ var StateEffectType = class {
|
|
|
2002
1989
|
return new StateEffect(this, value);
|
|
2003
1990
|
}
|
|
2004
1991
|
};
|
|
2005
|
-
var StateEffect = class {
|
|
1992
|
+
var StateEffect = class _StateEffect {
|
|
2006
1993
|
/**
|
|
2007
1994
|
@internal
|
|
2008
1995
|
*/
|
|
@@ -2016,7 +2003,7 @@ var StateEffect = class {
|
|
|
2016
2003
|
*/
|
|
2017
2004
|
map(mapping) {
|
|
2018
2005
|
let mapped = this.type.map(this.value, mapping);
|
|
2019
|
-
return mapped === void 0 ? void 0 : mapped == this.value ? this : new
|
|
2006
|
+
return mapped === void 0 ? void 0 : mapped == this.value ? this : new _StateEffect(this.type, mapped);
|
|
2020
2007
|
}
|
|
2021
2008
|
/**
|
|
2022
2009
|
Tells you whether this effect object is of a given
|
|
@@ -2052,7 +2039,7 @@ var StateEffect = class {
|
|
|
2052
2039
|
};
|
|
2053
2040
|
StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define();
|
|
2054
2041
|
StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define();
|
|
2055
|
-
var Transaction = class {
|
|
2042
|
+
var Transaction = class _Transaction {
|
|
2056
2043
|
constructor(startState, changes, selection, effects, annotations, scrollIntoView3) {
|
|
2057
2044
|
this.startState = startState;
|
|
2058
2045
|
this.changes = changes;
|
|
@@ -2064,14 +2051,14 @@ var Transaction = class {
|
|
|
2064
2051
|
this._state = null;
|
|
2065
2052
|
if (selection)
|
|
2066
2053
|
checkSelection(selection, changes.newLength);
|
|
2067
|
-
if (!annotations.some((a) => a.type ==
|
|
2068
|
-
this.annotations = annotations.concat(
|
|
2054
|
+
if (!annotations.some((a) => a.type == _Transaction.time))
|
|
2055
|
+
this.annotations = annotations.concat(_Transaction.time.of(Date.now()));
|
|
2069
2056
|
}
|
|
2070
2057
|
/**
|
|
2071
2058
|
@internal
|
|
2072
2059
|
*/
|
|
2073
2060
|
static create(startState, changes, selection, effects, annotations, scrollIntoView3) {
|
|
2074
|
-
return new
|
|
2061
|
+
return new _Transaction(startState, changes, selection, effects, annotations, scrollIntoView3);
|
|
2075
2062
|
}
|
|
2076
2063
|
/**
|
|
2077
2064
|
The new document produced by the transaction. Contrary to
|
|
@@ -2136,7 +2123,7 @@ var Transaction = class {
|
|
|
2136
2123
|
`"select.pointer"` will match it.
|
|
2137
2124
|
*/
|
|
2138
2125
|
isUserEvent(event) {
|
|
2139
|
-
let e = this.annotation(
|
|
2126
|
+
let e = this.annotation(_Transaction.userEvent);
|
|
2140
2127
|
return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == "."));
|
|
2141
2128
|
}
|
|
2142
2129
|
};
|
|
@@ -2290,7 +2277,7 @@ function makeCategorizer(wordChars) {
|
|
|
2290
2277
|
return CharCategory.Other;
|
|
2291
2278
|
};
|
|
2292
2279
|
}
|
|
2293
|
-
var EditorState = class {
|
|
2280
|
+
var EditorState = class _EditorState {
|
|
2294
2281
|
constructor(config2, doc2, selection, values, computeSlot, tr) {
|
|
2295
2282
|
this.config = config2;
|
|
2296
2283
|
this.doc = doc2;
|
|
@@ -2356,12 +2343,12 @@ var EditorState = class {
|
|
|
2356
2343
|
let startValues;
|
|
2357
2344
|
if (!conf) {
|
|
2358
2345
|
conf = Configuration.resolve(base2, compartments, this);
|
|
2359
|
-
let intermediateState = new
|
|
2346
|
+
let intermediateState = new _EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);
|
|
2360
2347
|
startValues = intermediateState.values;
|
|
2361
2348
|
} else {
|
|
2362
2349
|
startValues = tr.startState.values.slice();
|
|
2363
2350
|
}
|
|
2364
|
-
new
|
|
2351
|
+
new _EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr);
|
|
2365
2352
|
}
|
|
2366
2353
|
/**
|
|
2367
2354
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
@@ -2415,7 +2402,7 @@ var EditorState = class {
|
|
|
2415
2402
|
changes(spec = []) {
|
|
2416
2403
|
if (spec instanceof ChangeSet)
|
|
2417
2404
|
return spec;
|
|
2418
|
-
return ChangeSet.of(spec, this.doc.length, this.facet(
|
|
2405
|
+
return ChangeSet.of(spec, this.doc.length, this.facet(_EditorState.lineSeparator));
|
|
2419
2406
|
}
|
|
2420
2407
|
/**
|
|
2421
2408
|
Using the state's [line
|
|
@@ -2423,7 +2410,7 @@ var EditorState = class {
|
|
|
2423
2410
|
[`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.
|
|
2424
2411
|
*/
|
|
2425
2412
|
toText(string) {
|
|
2426
|
-
return Text.of(string.split(this.facet(
|
|
2413
|
+
return Text.of(string.split(this.facet(_EditorState.lineSeparator) || DefaultSplit));
|
|
2427
2414
|
}
|
|
2428
2415
|
/**
|
|
2429
2416
|
Return the given range of the document as a string.
|
|
@@ -2477,7 +2464,7 @@ var EditorState = class {
|
|
|
2477
2464
|
fieldInit.push(field.init((state) => field.spec.fromJSON(value, state)));
|
|
2478
2465
|
}
|
|
2479
2466
|
}
|
|
2480
|
-
return
|
|
2467
|
+
return _EditorState.create({
|
|
2481
2468
|
doc: json.doc,
|
|
2482
2469
|
selection: EditorSelection.fromJSON(json.selection),
|
|
2483
2470
|
extensions: config2.extensions ? fieldInit.concat([config2.extensions]) : fieldInit
|
|
@@ -2490,26 +2477,26 @@ var EditorState = class {
|
|
|
2490
2477
|
*/
|
|
2491
2478
|
static create(config2 = {}) {
|
|
2492
2479
|
let configuration = Configuration.resolve(config2.extensions || [], /* @__PURE__ */ new Map());
|
|
2493
|
-
let doc2 = config2.doc instanceof Text ? config2.doc : Text.of((config2.doc || "").split(configuration.staticFacet(
|
|
2480
|
+
let doc2 = config2.doc instanceof Text ? config2.doc : Text.of((config2.doc || "").split(configuration.staticFacet(_EditorState.lineSeparator) || DefaultSplit));
|
|
2494
2481
|
let selection = !config2.selection ? EditorSelection.single(0) : config2.selection instanceof EditorSelection ? config2.selection : EditorSelection.single(config2.selection.anchor, config2.selection.head);
|
|
2495
2482
|
checkSelection(selection, doc2.length);
|
|
2496
2483
|
if (!configuration.staticFacet(allowMultipleSelections))
|
|
2497
2484
|
selection = selection.asSingle();
|
|
2498
|
-
return new
|
|
2485
|
+
return new _EditorState(configuration, doc2, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);
|
|
2499
2486
|
}
|
|
2500
2487
|
/**
|
|
2501
2488
|
The size (in columns) of a tab in the document, determined by
|
|
2502
2489
|
the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.
|
|
2503
2490
|
*/
|
|
2504
2491
|
get tabSize() {
|
|
2505
|
-
return this.facet(
|
|
2492
|
+
return this.facet(_EditorState.tabSize);
|
|
2506
2493
|
}
|
|
2507
2494
|
/**
|
|
2508
2495
|
Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)
|
|
2509
2496
|
string for this state.
|
|
2510
2497
|
*/
|
|
2511
2498
|
get lineBreak() {
|
|
2512
|
-
return this.facet(
|
|
2499
|
+
return this.facet(_EditorState.lineSeparator) || "\n";
|
|
2513
2500
|
}
|
|
2514
2501
|
/**
|
|
2515
2502
|
Returns true when the editor is
|
|
@@ -2529,7 +2516,7 @@ var EditorState = class {
|
|
|
2529
2516
|
literal dollar sign.
|
|
2530
2517
|
*/
|
|
2531
2518
|
phrase(phrase, ...insert2) {
|
|
2532
|
-
for (let map of this.facet(
|
|
2519
|
+
for (let map of this.facet(_EditorState.phrases))
|
|
2533
2520
|
if (Object.prototype.hasOwnProperty.call(map, phrase)) {
|
|
2534
2521
|
phrase = map[phrase];
|
|
2535
2522
|
break;
|
|
@@ -2590,7 +2577,7 @@ var EditorState = class {
|
|
|
2590
2577
|
this returns null.
|
|
2591
2578
|
*/
|
|
2592
2579
|
wordAt(pos) {
|
|
2593
|
-
let { text, from, length
|
|
2580
|
+
let { text, from, length } = this.doc.lineAt(pos);
|
|
2594
2581
|
let cat = this.charCategorizer(pos);
|
|
2595
2582
|
let start = pos - from, end = pos - from;
|
|
2596
2583
|
while (start > 0) {
|
|
@@ -2599,7 +2586,7 @@ var EditorState = class {
|
|
|
2599
2586
|
break;
|
|
2600
2587
|
start = prev;
|
|
2601
2588
|
}
|
|
2602
|
-
while (end <
|
|
2589
|
+
while (end < length) {
|
|
2603
2590
|
let next = findClusterBreak(text, end);
|
|
2604
2591
|
if (cat(text.slice(end, next)) != CharCategory.Word)
|
|
2605
2592
|
break;
|
|
@@ -2665,7 +2652,7 @@ var RangeValue = class {
|
|
|
2665
2652
|
RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;
|
|
2666
2653
|
RangeValue.prototype.point = false;
|
|
2667
2654
|
RangeValue.prototype.mapMode = MapMode.TrackDel;
|
|
2668
|
-
var Range = class {
|
|
2655
|
+
var Range = class _Range {
|
|
2669
2656
|
constructor(from, to, value) {
|
|
2670
2657
|
this.from = from;
|
|
2671
2658
|
this.to = to;
|
|
@@ -2675,13 +2662,13 @@ var Range = class {
|
|
|
2675
2662
|
@internal
|
|
2676
2663
|
*/
|
|
2677
2664
|
static create(from, to, value) {
|
|
2678
|
-
return new
|
|
2665
|
+
return new _Range(from, to, value);
|
|
2679
2666
|
}
|
|
2680
2667
|
};
|
|
2681
2668
|
function cmpRange(a, b) {
|
|
2682
2669
|
return a.from - b.from || a.value.startSide - b.value.startSide;
|
|
2683
2670
|
}
|
|
2684
|
-
var Chunk = class {
|
|
2671
|
+
var Chunk = class _Chunk {
|
|
2685
2672
|
constructor(from, to, value, maxPoint) {
|
|
2686
2673
|
this.from = from;
|
|
2687
2674
|
this.to = to;
|
|
@@ -2743,10 +2730,10 @@ var Chunk = class {
|
|
|
2743
2730
|
from.push(newFrom - newPos);
|
|
2744
2731
|
to.push(newTo - newPos);
|
|
2745
2732
|
}
|
|
2746
|
-
return { mapped: value.length ? new
|
|
2733
|
+
return { mapped: value.length ? new _Chunk(from, to, value, maxPoint) : null, pos: newPos };
|
|
2747
2734
|
}
|
|
2748
2735
|
};
|
|
2749
|
-
var RangeSet = class {
|
|
2736
|
+
var RangeSet = class _RangeSet {
|
|
2750
2737
|
constructor(chunkPos, chunk, nextLayer, maxPoint) {
|
|
2751
2738
|
this.chunkPos = chunkPos;
|
|
2752
2739
|
this.chunk = chunk;
|
|
@@ -2757,7 +2744,7 @@ var RangeSet = class {
|
|
|
2757
2744
|
@internal
|
|
2758
2745
|
*/
|
|
2759
2746
|
static create(chunkPos, chunk, nextLayer, maxPoint) {
|
|
2760
|
-
return new
|
|
2747
|
+
return new _RangeSet(chunkPos, chunk, nextLayer, maxPoint);
|
|
2761
2748
|
}
|
|
2762
2749
|
/**
|
|
2763
2750
|
@internal
|
|
@@ -2800,7 +2787,7 @@ var RangeSet = class {
|
|
|
2800
2787
|
if (sort)
|
|
2801
2788
|
add = add.slice().sort(cmpRange);
|
|
2802
2789
|
if (this.isEmpty)
|
|
2803
|
-
return add.length ?
|
|
2790
|
+
return add.length ? _RangeSet.of(add) : this;
|
|
2804
2791
|
let cur2 = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];
|
|
2805
2792
|
let builder = new RangeSetBuilder();
|
|
2806
2793
|
while (cur2.value || i < add.length) {
|
|
@@ -2818,7 +2805,7 @@ var RangeSet = class {
|
|
|
2818
2805
|
cur2.next();
|
|
2819
2806
|
}
|
|
2820
2807
|
}
|
|
2821
|
-
return builder.finishInner(this.nextLayer.isEmpty && !spill.length ?
|
|
2808
|
+
return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? _RangeSet.empty : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));
|
|
2822
2809
|
}
|
|
2823
2810
|
/**
|
|
2824
2811
|
Map this range set through a set of changes, return the new set.
|
|
@@ -2844,7 +2831,7 @@ var RangeSet = class {
|
|
|
2844
2831
|
}
|
|
2845
2832
|
}
|
|
2846
2833
|
let next = this.nextLayer.map(changes);
|
|
2847
|
-
return chunks.length == 0 ? next : new
|
|
2834
|
+
return chunks.length == 0 ? next : new _RangeSet(chunkPos, chunks, next || _RangeSet.empty, maxPoint);
|
|
2848
2835
|
}
|
|
2849
2836
|
/**
|
|
2850
2837
|
Iterate over the ranges that touch the region `from` to `to`,
|
|
@@ -2892,7 +2879,7 @@ var RangeSet = class {
|
|
|
2892
2879
|
let sharedChunks = findSharedChunks(a, b, textDiff);
|
|
2893
2880
|
let sideA = new SpanCursor(a, sharedChunks, minPointSize);
|
|
2894
2881
|
let sideB = new SpanCursor(b, sharedChunks, minPointSize);
|
|
2895
|
-
textDiff.iterGaps((fromA, fromB,
|
|
2882
|
+
textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));
|
|
2896
2883
|
if (textDiff.empty && textDiff.length == 0)
|
|
2897
2884
|
compare(sideA, 0, sideB, 0, 0, comparator);
|
|
2898
2885
|
}
|
|
@@ -2973,7 +2960,7 @@ function lazySort(ranges) {
|
|
|
2973
2960
|
return ranges;
|
|
2974
2961
|
}
|
|
2975
2962
|
RangeSet.empty.nextLayer = RangeSet.empty;
|
|
2976
|
-
var RangeSetBuilder = class {
|
|
2963
|
+
var RangeSetBuilder = class _RangeSetBuilder {
|
|
2977
2964
|
finishChunk(newArrays) {
|
|
2978
2965
|
this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));
|
|
2979
2966
|
this.chunkPos.push(this.chunkStart);
|
|
@@ -3009,7 +2996,7 @@ var RangeSetBuilder = class {
|
|
|
3009
2996
|
*/
|
|
3010
2997
|
add(from, to, value) {
|
|
3011
2998
|
if (!this.addInner(from, to, value))
|
|
3012
|
-
(this.nextLayer || (this.nextLayer = new
|
|
2999
|
+
(this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).add(from, to, value);
|
|
3013
3000
|
}
|
|
3014
3001
|
/**
|
|
3015
3002
|
@internal
|
|
@@ -3162,7 +3149,7 @@ var LayerCursor = class {
|
|
|
3162
3149
|
return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || this.to - other.to || this.endSide - other.endSide;
|
|
3163
3150
|
}
|
|
3164
3151
|
};
|
|
3165
|
-
var HeapCursor = class {
|
|
3152
|
+
var HeapCursor = class _HeapCursor {
|
|
3166
3153
|
constructor(heap) {
|
|
3167
3154
|
this.heap = heap;
|
|
3168
3155
|
}
|
|
@@ -3174,7 +3161,7 @@ var HeapCursor = class {
|
|
|
3174
3161
|
heap.push(new LayerCursor(cur2, skip, minPoint, i));
|
|
3175
3162
|
}
|
|
3176
3163
|
}
|
|
3177
|
-
return heap.length == 1 ? heap[0] : new
|
|
3164
|
+
return heap.length == 1 ? heap[0] : new _HeapCursor(heap);
|
|
3178
3165
|
}
|
|
3179
3166
|
get startSide() {
|
|
3180
3167
|
return this.value ? this.value.startSide : 0;
|
|
@@ -3344,10 +3331,10 @@ var SpanCursor = class {
|
|
|
3344
3331
|
return open;
|
|
3345
3332
|
}
|
|
3346
3333
|
};
|
|
3347
|
-
function compare(a, startA, b, startB,
|
|
3334
|
+
function compare(a, startA, b, startB, length, comparator) {
|
|
3348
3335
|
a.goto(startA);
|
|
3349
3336
|
b.goto(startB);
|
|
3350
|
-
let endB = startB +
|
|
3337
|
+
let endB = startB + length;
|
|
3351
3338
|
let pos = startB, dPos = startB - startA;
|
|
3352
3339
|
for (; ; ) {
|
|
3353
3340
|
let diff = a.to + dPos - b.to || a.endSide - b.endSide;
|
|
@@ -3956,21 +3943,21 @@ function atElementStart(doc2, selection) {
|
|
|
3956
3943
|
function isScrolledToBottom(elt) {
|
|
3957
3944
|
return elt.scrollTop > Math.max(1, elt.scrollHeight - elt.clientHeight - 4);
|
|
3958
3945
|
}
|
|
3959
|
-
var DOMPos = class {
|
|
3946
|
+
var DOMPos = class _DOMPos {
|
|
3960
3947
|
constructor(node, offset, precise = true) {
|
|
3961
3948
|
this.node = node;
|
|
3962
3949
|
this.offset = offset;
|
|
3963
3950
|
this.precise = precise;
|
|
3964
3951
|
}
|
|
3965
3952
|
static before(dom, precise) {
|
|
3966
|
-
return new
|
|
3953
|
+
return new _DOMPos(dom.parentNode, domIndex(dom), precise);
|
|
3967
3954
|
}
|
|
3968
3955
|
static after(dom, precise) {
|
|
3969
|
-
return new
|
|
3956
|
+
return new _DOMPos(dom.parentNode, domIndex(dom) + 1, precise);
|
|
3970
3957
|
}
|
|
3971
3958
|
};
|
|
3972
3959
|
var noChildren = [];
|
|
3973
|
-
var ContentView = class {
|
|
3960
|
+
var ContentView = class _ContentView {
|
|
3974
3961
|
constructor() {
|
|
3975
3962
|
this.parent = null;
|
|
3976
3963
|
this.dom = null;
|
|
@@ -4004,7 +3991,7 @@ var ContentView = class {
|
|
|
4004
3991
|
for (let child of this.children) {
|
|
4005
3992
|
if (child.flags & 7) {
|
|
4006
3993
|
if (!child.dom && (next = prev ? prev.nextSibling : parent.firstChild)) {
|
|
4007
|
-
let contentView =
|
|
3994
|
+
let contentView = _ContentView.get(next);
|
|
4008
3995
|
if (!contentView || !contentView.parent && contentView.canReuseDOM(child))
|
|
4009
3996
|
child.reuseDOM(next);
|
|
4010
3997
|
}
|
|
@@ -4062,7 +4049,7 @@ var ContentView = class {
|
|
|
4062
4049
|
}
|
|
4063
4050
|
if (after == this.dom.firstChild)
|
|
4064
4051
|
return 0;
|
|
4065
|
-
while (after && !
|
|
4052
|
+
while (after && !_ContentView.get(after))
|
|
4066
4053
|
after = after.nextSibling;
|
|
4067
4054
|
if (!after)
|
|
4068
4055
|
return this.length;
|
|
@@ -4413,7 +4400,7 @@ var browser = {
|
|
|
4413
4400
|
tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"
|
|
4414
4401
|
};
|
|
4415
4402
|
var MaxJoinLen = 256;
|
|
4416
|
-
var TextView = class extends ContentView {
|
|
4403
|
+
var TextView = class _TextView extends ContentView {
|
|
4417
4404
|
constructor(text) {
|
|
4418
4405
|
super();
|
|
4419
4406
|
this.text = text;
|
|
@@ -4438,14 +4425,14 @@ var TextView = class extends ContentView {
|
|
|
4438
4425
|
this.createDOM(dom);
|
|
4439
4426
|
}
|
|
4440
4427
|
merge(from, to, source) {
|
|
4441
|
-
if (this.flags & 8 || source && (!(source instanceof
|
|
4428
|
+
if (this.flags & 8 || source && (!(source instanceof _TextView) || this.length - (to - from) + source.length > MaxJoinLen || source.flags & 8))
|
|
4442
4429
|
return false;
|
|
4443
4430
|
this.text = this.text.slice(0, from) + (source ? source.text : "") + this.text.slice(to);
|
|
4444
4431
|
this.markDirty();
|
|
4445
4432
|
return true;
|
|
4446
4433
|
}
|
|
4447
4434
|
split(from) {
|
|
4448
|
-
let result = new
|
|
4435
|
+
let result = new _TextView(this.text.slice(from));
|
|
4449
4436
|
this.text = this.text.slice(0, from);
|
|
4450
4437
|
this.markDirty();
|
|
4451
4438
|
result.flags |= this.flags & 8;
|
|
@@ -4464,12 +4451,12 @@ var TextView = class extends ContentView {
|
|
|
4464
4451
|
return textCoords(this.dom, pos, side);
|
|
4465
4452
|
}
|
|
4466
4453
|
};
|
|
4467
|
-
var MarkView = class extends ContentView {
|
|
4468
|
-
constructor(mark, children = [],
|
|
4454
|
+
var MarkView = class _MarkView extends ContentView {
|
|
4455
|
+
constructor(mark, children = [], length = 0) {
|
|
4469
4456
|
super();
|
|
4470
4457
|
this.mark = mark;
|
|
4471
4458
|
this.children = children;
|
|
4472
|
-
this.length =
|
|
4459
|
+
this.length = length;
|
|
4473
4460
|
for (let ch of children)
|
|
4474
4461
|
ch.setParent(this);
|
|
4475
4462
|
}
|
|
@@ -4499,7 +4486,7 @@ var MarkView = class extends ContentView {
|
|
|
4499
4486
|
super.sync(view, track);
|
|
4500
4487
|
}
|
|
4501
4488
|
merge(from, to, source, _hasStart, openStart, openEnd) {
|
|
4502
|
-
if (source && (!(source instanceof
|
|
4489
|
+
if (source && (!(source instanceof _MarkView && source.mark.eq(this.mark)) || from && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
4503
4490
|
return false;
|
|
4504
4491
|
mergeChildrenInto(this, from, to, source ? source.children : [], openStart - 1, openEnd - 1);
|
|
4505
4492
|
this.markDirty();
|
|
@@ -4516,13 +4503,13 @@ var MarkView = class extends ContentView {
|
|
|
4516
4503
|
off = end;
|
|
4517
4504
|
i++;
|
|
4518
4505
|
}
|
|
4519
|
-
let
|
|
4506
|
+
let length = this.length - from;
|
|
4520
4507
|
this.length = from;
|
|
4521
4508
|
if (detachFrom > -1) {
|
|
4522
4509
|
this.children.length = detachFrom;
|
|
4523
4510
|
this.markDirty();
|
|
4524
4511
|
}
|
|
4525
|
-
return new
|
|
4512
|
+
return new _MarkView(this.mark, result, length);
|
|
4526
4513
|
}
|
|
4527
4514
|
domAtPos(pos) {
|
|
4528
4515
|
return inlineDOMAtPos(this, pos);
|
|
@@ -4532,16 +4519,16 @@ var MarkView = class extends ContentView {
|
|
|
4532
4519
|
}
|
|
4533
4520
|
};
|
|
4534
4521
|
function textCoords(text, pos, side) {
|
|
4535
|
-
let
|
|
4536
|
-
if (pos >
|
|
4537
|
-
pos =
|
|
4522
|
+
let length = text.nodeValue.length;
|
|
4523
|
+
if (pos > length)
|
|
4524
|
+
pos = length;
|
|
4538
4525
|
let from = pos, to = pos, flatten2 = 0;
|
|
4539
|
-
if (pos == 0 && side < 0 || pos ==
|
|
4526
|
+
if (pos == 0 && side < 0 || pos == length && side >= 0) {
|
|
4540
4527
|
if (!(browser.chrome || browser.gecko)) {
|
|
4541
4528
|
if (pos) {
|
|
4542
4529
|
from--;
|
|
4543
4530
|
flatten2 = 1;
|
|
4544
|
-
} else if (to <
|
|
4531
|
+
} else if (to < length) {
|
|
4545
4532
|
to++;
|
|
4546
4533
|
flatten2 = -1;
|
|
4547
4534
|
}
|
|
@@ -4549,7 +4536,7 @@ function textCoords(text, pos, side) {
|
|
|
4549
4536
|
} else {
|
|
4550
4537
|
if (side < 0)
|
|
4551
4538
|
from--;
|
|
4552
|
-
else if (to <
|
|
4539
|
+
else if (to < length)
|
|
4553
4540
|
to++;
|
|
4554
4541
|
}
|
|
4555
4542
|
let rects = textRange(text, from, to).getClientRects();
|
|
@@ -4560,19 +4547,19 @@ function textCoords(text, pos, side) {
|
|
|
4560
4547
|
rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
|
|
4561
4548
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
4562
4549
|
}
|
|
4563
|
-
var WidgetView = class extends ContentView {
|
|
4564
|
-
constructor(widget,
|
|
4550
|
+
var WidgetView = class _WidgetView extends ContentView {
|
|
4551
|
+
constructor(widget, length, side) {
|
|
4565
4552
|
super();
|
|
4566
4553
|
this.widget = widget;
|
|
4567
|
-
this.length =
|
|
4554
|
+
this.length = length;
|
|
4568
4555
|
this.side = side;
|
|
4569
4556
|
this.prevWidget = null;
|
|
4570
4557
|
}
|
|
4571
|
-
static create(widget,
|
|
4572
|
-
return new
|
|
4558
|
+
static create(widget, length, side) {
|
|
4559
|
+
return new _WidgetView(widget, length, side);
|
|
4573
4560
|
}
|
|
4574
4561
|
split(from) {
|
|
4575
|
-
let result =
|
|
4562
|
+
let result = _WidgetView.create(this.widget, this.length - from, this.side);
|
|
4576
4563
|
this.length -= from;
|
|
4577
4564
|
return result;
|
|
4578
4565
|
}
|
|
@@ -4589,13 +4576,13 @@ var WidgetView = class extends ContentView {
|
|
|
4589
4576
|
return this.side;
|
|
4590
4577
|
}
|
|
4591
4578
|
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
4592
|
-
if (source && (!(source instanceof
|
|
4579
|
+
if (source && (!(source instanceof _WidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
4593
4580
|
return false;
|
|
4594
4581
|
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
4595
4582
|
return true;
|
|
4596
4583
|
}
|
|
4597
4584
|
become(other) {
|
|
4598
|
-
if (other instanceof
|
|
4585
|
+
if (other instanceof _WidgetView && other.side == this.side && this.widget.constructor == other.widget.constructor) {
|
|
4599
4586
|
if (!this.widget.compare(other.widget))
|
|
4600
4587
|
this.markDirty(true);
|
|
4601
4588
|
if (this.dom && !this.prevWidget)
|
|
@@ -4657,7 +4644,7 @@ var WidgetView = class extends ContentView {
|
|
|
4657
4644
|
this.widget.destroy(this.dom);
|
|
4658
4645
|
}
|
|
4659
4646
|
};
|
|
4660
|
-
var WidgetBufferView = class extends ContentView {
|
|
4647
|
+
var WidgetBufferView = class _WidgetBufferView extends ContentView {
|
|
4661
4648
|
constructor(side) {
|
|
4662
4649
|
super();
|
|
4663
4650
|
this.side = side;
|
|
@@ -4669,10 +4656,10 @@ var WidgetBufferView = class extends ContentView {
|
|
|
4669
4656
|
return false;
|
|
4670
4657
|
}
|
|
4671
4658
|
become(other) {
|
|
4672
|
-
return other instanceof
|
|
4659
|
+
return other instanceof _WidgetBufferView && other.side == this.side;
|
|
4673
4660
|
}
|
|
4674
4661
|
split() {
|
|
4675
|
-
return new
|
|
4662
|
+
return new _WidgetBufferView(this.side);
|
|
4676
4663
|
}
|
|
4677
4664
|
sync() {
|
|
4678
4665
|
if (!this.dom) {
|
|
@@ -4980,7 +4967,7 @@ var Decoration = class extends RangeValue {
|
|
|
4980
4967
|
}
|
|
4981
4968
|
};
|
|
4982
4969
|
Decoration.none = RangeSet.empty;
|
|
4983
|
-
var MarkDecoration = class extends Decoration {
|
|
4970
|
+
var MarkDecoration = class _MarkDecoration extends Decoration {
|
|
4984
4971
|
constructor(spec) {
|
|
4985
4972
|
let { start, end } = getInclusive(spec);
|
|
4986
4973
|
super(start ? -1 : 5e8, end ? 1 : -6e8, null, spec);
|
|
@@ -4990,7 +4977,7 @@ var MarkDecoration = class extends Decoration {
|
|
|
4990
4977
|
}
|
|
4991
4978
|
eq(other) {
|
|
4992
4979
|
var _a2, _b;
|
|
4993
|
-
return this == other || other instanceof
|
|
4980
|
+
return this == other || other instanceof _MarkDecoration && this.tagName == other.tagName && (this.class || ((_a2 = this.attrs) === null || _a2 === void 0 ? void 0 : _a2.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) && attrsEq(this.attrs, other.attrs, "class");
|
|
4994
4981
|
}
|
|
4995
4982
|
range(from, to = from) {
|
|
4996
4983
|
if (from >= to)
|
|
@@ -4999,12 +4986,12 @@ var MarkDecoration = class extends Decoration {
|
|
|
4999
4986
|
}
|
|
5000
4987
|
};
|
|
5001
4988
|
MarkDecoration.prototype.point = false;
|
|
5002
|
-
var LineDecoration = class extends Decoration {
|
|
4989
|
+
var LineDecoration = class _LineDecoration extends Decoration {
|
|
5003
4990
|
constructor(spec) {
|
|
5004
4991
|
super(-2e8, -2e8, null, spec);
|
|
5005
4992
|
}
|
|
5006
4993
|
eq(other) {
|
|
5007
|
-
return other instanceof
|
|
4994
|
+
return other instanceof _LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
5008
4995
|
}
|
|
5009
4996
|
range(from, to = from) {
|
|
5010
4997
|
if (to != from)
|
|
@@ -5014,7 +5001,7 @@ var LineDecoration = class extends Decoration {
|
|
|
5014
5001
|
};
|
|
5015
5002
|
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
|
|
5016
5003
|
LineDecoration.prototype.point = true;
|
|
5017
|
-
var PointDecoration = class extends Decoration {
|
|
5004
|
+
var PointDecoration = class _PointDecoration extends Decoration {
|
|
5018
5005
|
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
5019
5006
|
super(startSide, endSide, widget, spec);
|
|
5020
5007
|
this.block = block;
|
|
@@ -5029,7 +5016,7 @@ var PointDecoration = class extends Decoration {
|
|
|
5029
5016
|
return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
|
|
5030
5017
|
}
|
|
5031
5018
|
eq(other) {
|
|
5032
|
-
return other instanceof
|
|
5019
|
+
return other instanceof _PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide;
|
|
5033
5020
|
}
|
|
5034
5021
|
range(from, to = from) {
|
|
5035
5022
|
if (this.isReplace && (from > to || from == to && this.startSide > 0 && this.endSide <= 0))
|
|
@@ -5058,7 +5045,7 @@ function addRange(from, to, ranges, margin = 0) {
|
|
|
5058
5045
|
else
|
|
5059
5046
|
ranges.push(from, to);
|
|
5060
5047
|
}
|
|
5061
|
-
var LineView = class extends ContentView {
|
|
5048
|
+
var LineView = class _LineView extends ContentView {
|
|
5062
5049
|
constructor() {
|
|
5063
5050
|
super(...arguments);
|
|
5064
5051
|
this.children = [];
|
|
@@ -5070,7 +5057,7 @@ var LineView = class extends ContentView {
|
|
|
5070
5057
|
// Consumes source
|
|
5071
5058
|
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
5072
5059
|
if (source) {
|
|
5073
|
-
if (!(source instanceof
|
|
5060
|
+
if (!(source instanceof _LineView))
|
|
5074
5061
|
return false;
|
|
5075
5062
|
if (!this.dom)
|
|
5076
5063
|
source.transferDOM(this);
|
|
@@ -5081,7 +5068,7 @@ var LineView = class extends ContentView {
|
|
|
5081
5068
|
return true;
|
|
5082
5069
|
}
|
|
5083
5070
|
split(at) {
|
|
5084
|
-
let end = new
|
|
5071
|
+
let end = new _LineView();
|
|
5085
5072
|
end.breakAfter = this.breakAfter;
|
|
5086
5073
|
if (this.length == 0)
|
|
5087
5074
|
return end;
|
|
@@ -5204,7 +5191,7 @@ var LineView = class extends ContentView {
|
|
|
5204
5191
|
for (let i = 0, off = 0; i < docView.children.length; i++) {
|
|
5205
5192
|
let block = docView.children[i], end = off + block.length;
|
|
5206
5193
|
if (end >= pos) {
|
|
5207
|
-
if (block instanceof
|
|
5194
|
+
if (block instanceof _LineView)
|
|
5208
5195
|
return block;
|
|
5209
5196
|
if (end > pos)
|
|
5210
5197
|
break;
|
|
@@ -5214,17 +5201,17 @@ var LineView = class extends ContentView {
|
|
|
5214
5201
|
return null;
|
|
5215
5202
|
}
|
|
5216
5203
|
};
|
|
5217
|
-
var BlockWidgetView = class extends ContentView {
|
|
5218
|
-
constructor(widget,
|
|
5204
|
+
var BlockWidgetView = class _BlockWidgetView extends ContentView {
|
|
5205
|
+
constructor(widget, length, type) {
|
|
5219
5206
|
super();
|
|
5220
5207
|
this.widget = widget;
|
|
5221
|
-
this.length =
|
|
5208
|
+
this.length = length;
|
|
5222
5209
|
this.type = type;
|
|
5223
5210
|
this.breakAfter = 0;
|
|
5224
5211
|
this.prevWidget = null;
|
|
5225
5212
|
}
|
|
5226
5213
|
merge(from, to, source, _takeDeco, openStart, openEnd) {
|
|
5227
|
-
if (source && (!(source instanceof
|
|
5214
|
+
if (source && (!(source instanceof _BlockWidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
5228
5215
|
return false;
|
|
5229
5216
|
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
5230
5217
|
return true;
|
|
@@ -5235,7 +5222,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5235
5222
|
split(at) {
|
|
5236
5223
|
let len = this.length - at;
|
|
5237
5224
|
this.length = at;
|
|
5238
|
-
let end = new
|
|
5225
|
+
let end = new _BlockWidgetView(this.widget, len, this.type);
|
|
5239
5226
|
end.breakAfter = this.breakAfter;
|
|
5240
5227
|
return end;
|
|
5241
5228
|
}
|
|
@@ -5258,7 +5245,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5258
5245
|
return null;
|
|
5259
5246
|
}
|
|
5260
5247
|
become(other) {
|
|
5261
|
-
if (other instanceof
|
|
5248
|
+
if (other instanceof _BlockWidgetView && other.widget.constructor == this.widget.constructor) {
|
|
5262
5249
|
if (!other.widget.compare(this.widget))
|
|
5263
5250
|
this.markDirty(true);
|
|
5264
5251
|
if (this.dom && !this.prevWidget)
|
|
@@ -5292,7 +5279,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5292
5279
|
this.widget.destroy(this.dom);
|
|
5293
5280
|
}
|
|
5294
5281
|
};
|
|
5295
|
-
var ContentBuilder = class {
|
|
5282
|
+
var ContentBuilder = class _ContentBuilder {
|
|
5296
5283
|
constructor(doc2, pos, end, disallowBlockEffectsFor) {
|
|
5297
5284
|
this.doc = doc2;
|
|
5298
5285
|
this.pos = pos;
|
|
@@ -5343,8 +5330,8 @@ var ContentBuilder = class {
|
|
|
5343
5330
|
if (!this.posCovered())
|
|
5344
5331
|
this.getLine();
|
|
5345
5332
|
}
|
|
5346
|
-
buildText(
|
|
5347
|
-
while (
|
|
5333
|
+
buildText(length, active, openStart) {
|
|
5334
|
+
while (length > 0) {
|
|
5348
5335
|
if (this.textOff == this.text.length) {
|
|
5349
5336
|
let { value, lineBreak, done } = this.cursor.next(this.skip);
|
|
5350
5337
|
this.skip = 0;
|
|
@@ -5360,7 +5347,7 @@ var ContentBuilder = class {
|
|
|
5360
5347
|
this.flushBuffer();
|
|
5361
5348
|
this.curLine = null;
|
|
5362
5349
|
this.atCursorPos = true;
|
|
5363
|
-
|
|
5350
|
+
length--;
|
|
5364
5351
|
continue;
|
|
5365
5352
|
} else {
|
|
5366
5353
|
this.text = value;
|
|
@@ -5369,7 +5356,7 @@ var ContentBuilder = class {
|
|
|
5369
5356
|
}
|
|
5370
5357
|
let take = Math.min(
|
|
5371
5358
|
this.text.length - this.textOff,
|
|
5372
|
-
|
|
5359
|
+
length,
|
|
5373
5360
|
512
|
|
5374
5361
|
/* Chunk */
|
|
5375
5362
|
);
|
|
@@ -5377,7 +5364,7 @@ var ContentBuilder = class {
|
|
|
5377
5364
|
this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);
|
|
5378
5365
|
this.atCursorPos = true;
|
|
5379
5366
|
this.textOff += take;
|
|
5380
|
-
|
|
5367
|
+
length -= take;
|
|
5381
5368
|
openStart = 0;
|
|
5382
5369
|
}
|
|
5383
5370
|
}
|
|
@@ -5436,7 +5423,7 @@ var ContentBuilder = class {
|
|
|
5436
5423
|
this.openStart = openStart;
|
|
5437
5424
|
}
|
|
5438
5425
|
static build(text, from, to, decorations2, dynamicDecorationMap) {
|
|
5439
|
-
let builder = new
|
|
5426
|
+
let builder = new _ContentBuilder(text, from, to, dynamicDecorationMap);
|
|
5440
5427
|
builder.openEnd = RangeSet.spans(decorations2, from, to, builder);
|
|
5441
5428
|
if (builder.openStart < 0)
|
|
5442
5429
|
builder.openStart = builder.openEnd;
|
|
@@ -5480,7 +5467,7 @@ var perLineTextDirection = /* @__PURE__ */ Facet.define({
|
|
|
5480
5467
|
var nativeSelectionHidden = /* @__PURE__ */ Facet.define({
|
|
5481
5468
|
combine: (values) => values.some((x) => x)
|
|
5482
5469
|
});
|
|
5483
|
-
var ScrollTarget = class {
|
|
5470
|
+
var ScrollTarget = class _ScrollTarget {
|
|
5484
5471
|
constructor(range, y = "nearest", x = "nearest", yMargin = 5, xMargin = 5) {
|
|
5485
5472
|
this.range = range;
|
|
5486
5473
|
this.y = y;
|
|
@@ -5489,7 +5476,7 @@ var ScrollTarget = class {
|
|
|
5489
5476
|
this.xMargin = xMargin;
|
|
5490
5477
|
}
|
|
5491
5478
|
map(changes) {
|
|
5492
|
-
return changes.empty ? this : new
|
|
5479
|
+
return changes.empty ? this : new _ScrollTarget(this.range.map(changes), this.y, this.x, this.yMargin, this.xMargin);
|
|
5493
5480
|
}
|
|
5494
5481
|
};
|
|
5495
5482
|
var scrollIntoView = /* @__PURE__ */ StateEffect.define({ map: (t, ch) => t.map(ch) });
|
|
@@ -5507,7 +5494,7 @@ function logException(state, exception, context) {
|
|
|
5507
5494
|
var editable = /* @__PURE__ */ Facet.define({ combine: (values) => values.length ? values[0] : true });
|
|
5508
5495
|
var nextPluginID = 0;
|
|
5509
5496
|
var viewPlugin = /* @__PURE__ */ Facet.define();
|
|
5510
|
-
var ViewPlugin = class {
|
|
5497
|
+
var ViewPlugin = class _ViewPlugin {
|
|
5511
5498
|
constructor(id, create, domEventHandlers, buildExtensions) {
|
|
5512
5499
|
this.id = id;
|
|
5513
5500
|
this.create = create;
|
|
@@ -5520,7 +5507,7 @@ var ViewPlugin = class {
|
|
|
5520
5507
|
*/
|
|
5521
5508
|
static define(create, spec) {
|
|
5522
5509
|
const { eventHandlers, provide, decorations: deco } = spec || {};
|
|
5523
|
-
return new
|
|
5510
|
+
return new _ViewPlugin(nextPluginID++, create, eventHandlers, (plugin) => {
|
|
5524
5511
|
let ext = [viewPlugin.of(plugin)];
|
|
5525
5512
|
if (deco)
|
|
5526
5513
|
ext.push(decorations.of((view) => {
|
|
@@ -5537,7 +5524,7 @@ var ViewPlugin = class {
|
|
|
5537
5524
|
editor view as argument.
|
|
5538
5525
|
*/
|
|
5539
5526
|
static fromClass(cls, spec) {
|
|
5540
|
-
return
|
|
5527
|
+
return _ViewPlugin.define((view) => new cls(view), spec);
|
|
5541
5528
|
}
|
|
5542
5529
|
};
|
|
5543
5530
|
var PluginInstance = class {
|
|
@@ -5612,7 +5599,7 @@ function getScrollMargins(view) {
|
|
|
5612
5599
|
return { left, right, top: top2, bottom };
|
|
5613
5600
|
}
|
|
5614
5601
|
var styleModule = /* @__PURE__ */ Facet.define();
|
|
5615
|
-
var ChangedRange = class {
|
|
5602
|
+
var ChangedRange = class _ChangedRange {
|
|
5616
5603
|
constructor(fromA, toA, fromB, toB) {
|
|
5617
5604
|
this.fromA = fromA;
|
|
5618
5605
|
this.toA = toA;
|
|
@@ -5620,7 +5607,7 @@ var ChangedRange = class {
|
|
|
5620
5607
|
this.toB = toB;
|
|
5621
5608
|
}
|
|
5622
5609
|
join(other) {
|
|
5623
|
-
return new
|
|
5610
|
+
return new _ChangedRange(Math.min(this.fromA, other.fromA), Math.max(this.toA, other.toA), Math.min(this.fromB, other.fromB), Math.max(this.toB, other.toB));
|
|
5624
5611
|
}
|
|
5625
5612
|
addToSet(set) {
|
|
5626
5613
|
let i = set.length, me = this;
|
|
@@ -5647,7 +5634,7 @@ var ChangedRange = class {
|
|
|
5647
5634
|
let from = ranges[rI], to = ranges[rI + 1];
|
|
5648
5635
|
let fromB = Math.max(posB, from), toB = Math.min(end, to);
|
|
5649
5636
|
if (fromB <= toB)
|
|
5650
|
-
new
|
|
5637
|
+
new _ChangedRange(fromB + off, toB + off, fromB, toB).addToSet(result);
|
|
5651
5638
|
if (to > end)
|
|
5652
5639
|
break;
|
|
5653
5640
|
else
|
|
@@ -5655,13 +5642,13 @@ var ChangedRange = class {
|
|
|
5655
5642
|
}
|
|
5656
5643
|
if (!next)
|
|
5657
5644
|
return result;
|
|
5658
|
-
new
|
|
5645
|
+
new _ChangedRange(next.fromA, next.toA, next.fromB, next.toB).addToSet(result);
|
|
5659
5646
|
posA = next.toA;
|
|
5660
5647
|
posB = next.toB;
|
|
5661
5648
|
}
|
|
5662
5649
|
}
|
|
5663
5650
|
};
|
|
5664
|
-
var ViewUpdate = class {
|
|
5651
|
+
var ViewUpdate = class _ViewUpdate {
|
|
5665
5652
|
constructor(view, state, transactions) {
|
|
5666
5653
|
this.view = view;
|
|
5667
5654
|
this.state = state;
|
|
@@ -5679,7 +5666,7 @@ var ViewUpdate = class {
|
|
|
5679
5666
|
@internal
|
|
5680
5667
|
*/
|
|
5681
5668
|
static create(view, state, transactions) {
|
|
5682
|
-
return new
|
|
5669
|
+
return new _ViewUpdate(view, state, transactions);
|
|
5683
5670
|
}
|
|
5684
5671
|
/**
|
|
5685
5672
|
Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or
|
|
@@ -5909,8 +5896,8 @@ function computeOrder(line, direction) {
|
|
|
5909
5896
|
}
|
|
5910
5897
|
return order;
|
|
5911
5898
|
}
|
|
5912
|
-
function trivialOrder(
|
|
5913
|
-
return [new BidiSpan(0,
|
|
5899
|
+
function trivialOrder(length) {
|
|
5900
|
+
return [new BidiSpan(0, length, 0)];
|
|
5914
5901
|
}
|
|
5915
5902
|
var movedOver = "";
|
|
5916
5903
|
function moveVisually(line, order, dir, start, forward) {
|
|
@@ -7582,10 +7569,10 @@ var HeightOracle = class {
|
|
|
7582
7569
|
lines += Math.max(0, Math.ceil((to - from - lines * this.lineLength * 0.5) / this.lineLength));
|
|
7583
7570
|
return this.lineHeight * lines;
|
|
7584
7571
|
}
|
|
7585
|
-
heightForLine(
|
|
7572
|
+
heightForLine(length) {
|
|
7586
7573
|
if (!this.lineWrapping)
|
|
7587
7574
|
return this.lineHeight;
|
|
7588
|
-
let lines = 1 + Math.max(0, Math.ceil((
|
|
7575
|
+
let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5)));
|
|
7589
7576
|
return lines * this.lineHeight;
|
|
7590
7577
|
}
|
|
7591
7578
|
setDoc(doc2) {
|
|
@@ -7639,13 +7626,13 @@ var MeasuredHeights = class {
|
|
|
7639
7626
|
return this.index < this.heights.length;
|
|
7640
7627
|
}
|
|
7641
7628
|
};
|
|
7642
|
-
var BlockInfo = class {
|
|
7629
|
+
var BlockInfo = class _BlockInfo {
|
|
7643
7630
|
/**
|
|
7644
7631
|
@internal
|
|
7645
7632
|
*/
|
|
7646
|
-
constructor(from,
|
|
7633
|
+
constructor(from, length, top2, height, _content) {
|
|
7647
7634
|
this.from = from;
|
|
7648
|
-
this.length =
|
|
7635
|
+
this.length = length;
|
|
7649
7636
|
this.top = top2;
|
|
7650
7637
|
this.height = height;
|
|
7651
7638
|
this._content = _content;
|
|
@@ -7688,7 +7675,7 @@ var BlockInfo = class {
|
|
|
7688
7675
|
*/
|
|
7689
7676
|
join(other) {
|
|
7690
7677
|
let content = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(other._content) ? other._content : [other]);
|
|
7691
|
-
return new
|
|
7678
|
+
return new _BlockInfo(this.from, this.length + other.length, this.top, this.height + other.height, content);
|
|
7692
7679
|
}
|
|
7693
7680
|
};
|
|
7694
7681
|
var QueryType = /* @__PURE__ */ function(QueryType2) {
|
|
@@ -7698,9 +7685,9 @@ var QueryType = /* @__PURE__ */ function(QueryType2) {
|
|
|
7698
7685
|
return QueryType2;
|
|
7699
7686
|
}(QueryType || (QueryType = {}));
|
|
7700
7687
|
var Epsilon = 1e-3;
|
|
7701
|
-
var HeightMap = class {
|
|
7702
|
-
constructor(
|
|
7703
|
-
this.length =
|
|
7688
|
+
var HeightMap = class _HeightMap {
|
|
7689
|
+
constructor(length, height, flags = 2) {
|
|
7690
|
+
this.length = length;
|
|
7704
7691
|
this.height = height;
|
|
7705
7692
|
this.flags = flags;
|
|
7706
7693
|
}
|
|
@@ -7721,7 +7708,7 @@ var HeightMap = class {
|
|
|
7721
7708
|
// from the new nodes and returns that (HeightMapBranch and
|
|
7722
7709
|
// HeightMapGap override this to actually use from/to)
|
|
7723
7710
|
replace(_from, _to, nodes) {
|
|
7724
|
-
return
|
|
7711
|
+
return _HeightMap.of(nodes);
|
|
7725
7712
|
}
|
|
7726
7713
|
// Again, these are base cases, and are overridden for branch and gap nodes.
|
|
7727
7714
|
decomposeLeft(_to, result) {
|
|
@@ -7802,13 +7789,13 @@ var HeightMap = class {
|
|
|
7802
7789
|
brk = 1;
|
|
7803
7790
|
j++;
|
|
7804
7791
|
}
|
|
7805
|
-
return new HeightMapBranch(
|
|
7792
|
+
return new HeightMapBranch(_HeightMap.of(nodes.slice(0, i)), brk, _HeightMap.of(nodes.slice(j)));
|
|
7806
7793
|
}
|
|
7807
7794
|
};
|
|
7808
7795
|
HeightMap.prototype.size = 1;
|
|
7809
7796
|
var HeightMapBlock = class extends HeightMap {
|
|
7810
|
-
constructor(
|
|
7811
|
-
super(
|
|
7797
|
+
constructor(length, height, deco) {
|
|
7798
|
+
super(length, height);
|
|
7812
7799
|
this.deco = deco;
|
|
7813
7800
|
}
|
|
7814
7801
|
blockAt(_height, _oracle, top2, offset) {
|
|
@@ -7831,9 +7818,9 @@ var HeightMapBlock = class extends HeightMap {
|
|
|
7831
7818
|
return `block(${this.length})`;
|
|
7832
7819
|
}
|
|
7833
7820
|
};
|
|
7834
|
-
var HeightMapText = class extends HeightMapBlock {
|
|
7835
|
-
constructor(
|
|
7836
|
-
super(
|
|
7821
|
+
var HeightMapText = class _HeightMapText extends HeightMapBlock {
|
|
7822
|
+
constructor(length, height) {
|
|
7823
|
+
super(length, height, null);
|
|
7837
7824
|
this.collapsed = 0;
|
|
7838
7825
|
this.widgetHeight = 0;
|
|
7839
7826
|
this.breaks = 0;
|
|
@@ -7843,9 +7830,9 @@ var HeightMapText = class extends HeightMapBlock {
|
|
|
7843
7830
|
}
|
|
7844
7831
|
replace(_from, _to, nodes) {
|
|
7845
7832
|
let node = nodes[0];
|
|
7846
|
-
if (nodes.length == 1 && (node instanceof
|
|
7833
|
+
if (nodes.length == 1 && (node instanceof _HeightMapText || node instanceof HeightMapGap && node.flags & 4) && Math.abs(this.length - node.length) < 10) {
|
|
7847
7834
|
if (node instanceof HeightMapGap)
|
|
7848
|
-
node = new
|
|
7835
|
+
node = new _HeightMapText(node.length, this.height);
|
|
7849
7836
|
else
|
|
7850
7837
|
node.height = this.height;
|
|
7851
7838
|
if (!this.outdated)
|
|
@@ -7867,9 +7854,9 @@ var HeightMapText = class extends HeightMapBlock {
|
|
|
7867
7854
|
return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;
|
|
7868
7855
|
}
|
|
7869
7856
|
};
|
|
7870
|
-
var HeightMapGap = class extends HeightMap {
|
|
7871
|
-
constructor(
|
|
7872
|
-
super(
|
|
7857
|
+
var HeightMapGap = class _HeightMapGap extends HeightMap {
|
|
7858
|
+
constructor(length) {
|
|
7859
|
+
super(length, 0);
|
|
7873
7860
|
}
|
|
7874
7861
|
heightMetrics(oracle, offset) {
|
|
7875
7862
|
let firstLine = oracle.doc.lineAt(offset).number, lastLine = oracle.doc.lineAt(offset + this.length).number;
|
|
@@ -7894,8 +7881,8 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7894
7881
|
return new BlockInfo(line.from, line.length, lineTop, lineHeight, 0);
|
|
7895
7882
|
} else {
|
|
7896
7883
|
let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top2) / perLine)));
|
|
7897
|
-
let { from, length
|
|
7898
|
-
return new BlockInfo(from,
|
|
7884
|
+
let { from, length } = oracle.doc.line(firstLine + line);
|
|
7885
|
+
return new BlockInfo(from, length, top2 + perLine * line, perLine, 0);
|
|
7899
7886
|
}
|
|
7900
7887
|
}
|
|
7901
7888
|
lineAt(value, type, oracle, top2, offset) {
|
|
@@ -7931,32 +7918,32 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7931
7918
|
let after = this.length - to;
|
|
7932
7919
|
if (after > 0) {
|
|
7933
7920
|
let last = nodes[nodes.length - 1];
|
|
7934
|
-
if (last instanceof
|
|
7935
|
-
nodes[nodes.length - 1] = new
|
|
7921
|
+
if (last instanceof _HeightMapGap)
|
|
7922
|
+
nodes[nodes.length - 1] = new _HeightMapGap(last.length + after);
|
|
7936
7923
|
else
|
|
7937
|
-
nodes.push(null, new
|
|
7924
|
+
nodes.push(null, new _HeightMapGap(after - 1));
|
|
7938
7925
|
}
|
|
7939
7926
|
if (from > 0) {
|
|
7940
7927
|
let first = nodes[0];
|
|
7941
|
-
if (first instanceof
|
|
7942
|
-
nodes[0] = new
|
|
7928
|
+
if (first instanceof _HeightMapGap)
|
|
7929
|
+
nodes[0] = new _HeightMapGap(from + first.length);
|
|
7943
7930
|
else
|
|
7944
|
-
nodes.unshift(new
|
|
7931
|
+
nodes.unshift(new _HeightMapGap(from - 1), null);
|
|
7945
7932
|
}
|
|
7946
7933
|
return HeightMap.of(nodes);
|
|
7947
7934
|
}
|
|
7948
7935
|
decomposeLeft(to, result) {
|
|
7949
|
-
result.push(new
|
|
7936
|
+
result.push(new _HeightMapGap(to - 1), null);
|
|
7950
7937
|
}
|
|
7951
7938
|
decomposeRight(from, result) {
|
|
7952
|
-
result.push(null, new
|
|
7939
|
+
result.push(null, new _HeightMapGap(this.length - from - 1));
|
|
7953
7940
|
}
|
|
7954
7941
|
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
7955
7942
|
let end = offset + this.length;
|
|
7956
7943
|
if (measured && measured.from <= offset + this.length && measured.more) {
|
|
7957
7944
|
let nodes = [], pos = Math.max(offset, measured.from), singleHeight = -1;
|
|
7958
7945
|
if (measured.from > offset)
|
|
7959
|
-
nodes.push(new
|
|
7946
|
+
nodes.push(new _HeightMapGap(measured.from - offset - 1).updateHeight(oracle, offset));
|
|
7960
7947
|
while (pos <= end && measured.more) {
|
|
7961
7948
|
let len = oracle.doc.lineAt(pos).length;
|
|
7962
7949
|
if (nodes.length)
|
|
@@ -7972,7 +7959,7 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7972
7959
|
pos += len + 1;
|
|
7973
7960
|
}
|
|
7974
7961
|
if (pos <= end)
|
|
7975
|
-
nodes.push(null, new
|
|
7962
|
+
nodes.push(null, new _HeightMapGap(end - pos).updateHeight(oracle, pos));
|
|
7976
7963
|
let result = HeightMap.of(nodes);
|
|
7977
7964
|
if (singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon || Math.abs(singleHeight - this.heightMetrics(oracle, offset).perLine) >= Epsilon)
|
|
7978
7965
|
oracle.heightChanged = true;
|
|
@@ -8111,7 +8098,7 @@ function mergeGaps(nodes, around) {
|
|
|
8111
8098
|
nodes.splice(around - 1, 3, new HeightMapGap(before.length + 1 + after.length));
|
|
8112
8099
|
}
|
|
8113
8100
|
var relevantWidgetHeight = 5;
|
|
8114
|
-
var NodeBuilder = class {
|
|
8101
|
+
var NodeBuilder = class _NodeBuilder {
|
|
8115
8102
|
constructor(pos, oracle) {
|
|
8116
8103
|
this.pos = pos;
|
|
8117
8104
|
this.oracle = oracle;
|
|
@@ -8199,13 +8186,13 @@ var NodeBuilder = class {
|
|
|
8199
8186
|
if (type != BlockType.WidgetBefore)
|
|
8200
8187
|
this.covering = block;
|
|
8201
8188
|
}
|
|
8202
|
-
addLineDeco(height, breaks,
|
|
8189
|
+
addLineDeco(height, breaks, length) {
|
|
8203
8190
|
let line = this.ensureLine();
|
|
8204
|
-
line.length +=
|
|
8205
|
-
line.collapsed +=
|
|
8191
|
+
line.length += length;
|
|
8192
|
+
line.collapsed += length;
|
|
8206
8193
|
line.widgetHeight = Math.max(line.widgetHeight, height);
|
|
8207
8194
|
line.breaks += breaks;
|
|
8208
|
-
this.writtenTo = this.pos = this.pos +
|
|
8195
|
+
this.writtenTo = this.pos = this.pos + length;
|
|
8209
8196
|
}
|
|
8210
8197
|
finish(from) {
|
|
8211
8198
|
let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
|
|
@@ -8227,7 +8214,7 @@ var NodeBuilder = class {
|
|
|
8227
8214
|
// starts or ends in a line break, or has multiple line breaks next
|
|
8228
8215
|
// to each other.
|
|
8229
8216
|
static build(oracle, decorations2, from, to) {
|
|
8230
|
-
let builder = new
|
|
8217
|
+
let builder = new _NodeBuilder(from, oracle);
|
|
8231
8218
|
RangeSet.spans(decorations2, from, to, builder, 0);
|
|
8232
8219
|
return builder.finish(from);
|
|
8233
8220
|
}
|
|
@@ -9641,7 +9628,7 @@ function safariSelectionRangeHack(view) {
|
|
|
9641
9628
|
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
9642
9629
|
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
9643
9630
|
}
|
|
9644
|
-
var EditorView = class {
|
|
9631
|
+
var EditorView = class _EditorView {
|
|
9645
9632
|
/**
|
|
9646
9633
|
Construct a new view. You'll want to either provide a `parent`
|
|
9647
9634
|
option, or put `view.dom` into your document after creating a
|
|
@@ -10044,7 +10031,7 @@ var EditorView = class {
|
|
|
10044
10031
|
let first = true;
|
|
10045
10032
|
for (let tr of trs)
|
|
10046
10033
|
for (let effect of tr.effects)
|
|
10047
|
-
if (effect.is(
|
|
10034
|
+
if (effect.is(_EditorView.announce)) {
|
|
10048
10035
|
if (first)
|
|
10049
10036
|
this.announceDOM.textContent = "";
|
|
10050
10037
|
first = false;
|
|
@@ -10462,7 +10449,7 @@ EditorView.lineWrapping = /* @__PURE__ */ EditorView.contentAttributes.of({ "cla
|
|
|
10462
10449
|
EditorView.announce = /* @__PURE__ */ StateEffect.define();
|
|
10463
10450
|
var MaxBidiLine = 4096;
|
|
10464
10451
|
var BadMeasure = {};
|
|
10465
|
-
var CachedOrder = class {
|
|
10452
|
+
var CachedOrder = class _CachedOrder {
|
|
10466
10453
|
constructor(from, to, dir, order) {
|
|
10467
10454
|
this.from = from;
|
|
10468
10455
|
this.to = to;
|
|
@@ -10476,7 +10463,7 @@ var CachedOrder = class {
|
|
|
10476
10463
|
for (let i = Math.max(0, cache.length - 10); i < cache.length; i++) {
|
|
10477
10464
|
let entry = cache[i];
|
|
10478
10465
|
if (entry.dir == lastDir && !changes.touchesRange(entry.from, entry.to))
|
|
10479
|
-
result.push(new
|
|
10466
|
+
result.push(new _CachedOrder(changes.mapPos(entry.from, 1), changes.mapPos(entry.to, -1), entry.dir, entry.order));
|
|
10480
10467
|
}
|
|
10481
10468
|
return result;
|
|
10482
10469
|
}
|
|
@@ -10671,7 +10658,7 @@ function runHandlers(map, event, view, scope) {
|
|
|
10671
10658
|
event.stopPropagation();
|
|
10672
10659
|
return handled;
|
|
10673
10660
|
}
|
|
10674
|
-
var RectangleMarker = class {
|
|
10661
|
+
var RectangleMarker = class _RectangleMarker {
|
|
10675
10662
|
/**
|
|
10676
10663
|
Create a marker with the given class and dimensions. If `width`
|
|
10677
10664
|
is null, the DOM element will get no width style.
|
|
@@ -10718,7 +10705,7 @@ var RectangleMarker = class {
|
|
|
10718
10705
|
if (!pos)
|
|
10719
10706
|
return [];
|
|
10720
10707
|
let base2 = getBase(view);
|
|
10721
|
-
return [new
|
|
10708
|
+
return [new _RectangleMarker(className, pos.left - base2.left, pos.top - base2.top, null, pos.bottom - pos.top)];
|
|
10722
10709
|
} else {
|
|
10723
10710
|
return rectanglesForRange(view, className, range);
|
|
10724
10711
|
}
|
|
@@ -11677,7 +11664,7 @@ function topNodeAt(state, pos, side) {
|
|
|
11677
11664
|
}
|
|
11678
11665
|
return tree;
|
|
11679
11666
|
}
|
|
11680
|
-
var LRLanguage = class extends Language {
|
|
11667
|
+
var LRLanguage = class _LRLanguage extends Language {
|
|
11681
11668
|
constructor(data, parser, name) {
|
|
11682
11669
|
super(data, parser, [], name);
|
|
11683
11670
|
this.parser = parser;
|
|
@@ -11687,7 +11674,7 @@ var LRLanguage = class extends Language {
|
|
|
11687
11674
|
*/
|
|
11688
11675
|
static define(spec) {
|
|
11689
11676
|
let data = defineLanguageFacet(spec.languageData);
|
|
11690
|
-
return new
|
|
11677
|
+
return new _LRLanguage(data, spec.parser.configure({
|
|
11691
11678
|
props: [languageDataProp.add((type) => type.isTop ? data : void 0)]
|
|
11692
11679
|
}), spec.name);
|
|
11693
11680
|
}
|
|
@@ -11696,7 +11683,7 @@ var LRLanguage = class extends Language {
|
|
|
11696
11683
|
version of its parser and optionally a new name.
|
|
11697
11684
|
*/
|
|
11698
11685
|
configure(options, name) {
|
|
11699
|
-
return new
|
|
11686
|
+
return new _LRLanguage(this.data, this.parser.configure(options), name || this.name);
|
|
11700
11687
|
}
|
|
11701
11688
|
get allowsNesting() {
|
|
11702
11689
|
return this.parser.hasWrappers();
|
|
@@ -11751,7 +11738,7 @@ var DocInput = class {
|
|
|
11751
11738
|
}
|
|
11752
11739
|
};
|
|
11753
11740
|
var currentContext = null;
|
|
11754
|
-
var ParseContext = class {
|
|
11741
|
+
var ParseContext = class _ParseContext {
|
|
11755
11742
|
constructor(parser, state, fragments = [], tree, treeLen, viewport, skipped, scheduleOn) {
|
|
11756
11743
|
this.parser = parser;
|
|
11757
11744
|
this.state = state;
|
|
@@ -11768,7 +11755,7 @@ var ParseContext = class {
|
|
|
11768
11755
|
@internal
|
|
11769
11756
|
*/
|
|
11770
11757
|
static create(parser, state, viewport) {
|
|
11771
|
-
return new
|
|
11758
|
+
return new _ParseContext(parser, state, [], import_common.Tree.empty, 0, viewport, [], null);
|
|
11772
11759
|
}
|
|
11773
11760
|
startParse() {
|
|
11774
11761
|
return this.parser.startParse(new DocInput(this.state.doc), this.fragments);
|
|
@@ -11864,7 +11851,7 @@ var ParseContext = class {
|
|
|
11864
11851
|
}
|
|
11865
11852
|
}
|
|
11866
11853
|
}
|
|
11867
|
-
return new
|
|
11854
|
+
return new _ParseContext(this.parser, newState, fragments, tree, treeLen, viewport, skipped, this.scheduleOn);
|
|
11868
11855
|
}
|
|
11869
11856
|
/**
|
|
11870
11857
|
@internal
|
|
@@ -11956,7 +11943,7 @@ var ParseContext = class {
|
|
|
11956
11943
|
function cutFragments(fragments, from, to) {
|
|
11957
11944
|
return import_common.TreeFragment.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]);
|
|
11958
11945
|
}
|
|
11959
|
-
var LanguageState = class {
|
|
11946
|
+
var LanguageState = class _LanguageState {
|
|
11960
11947
|
constructor(context) {
|
|
11961
11948
|
this.context = context;
|
|
11962
11949
|
this.tree = context.tree;
|
|
@@ -11968,14 +11955,14 @@ var LanguageState = class {
|
|
|
11968
11955
|
let upto = this.context.treeLen == tr.startState.doc.length ? void 0 : Math.max(tr.changes.mapPos(this.context.treeLen), newCx.viewport.to);
|
|
11969
11956
|
if (!newCx.work(20, upto))
|
|
11970
11957
|
newCx.takeTree();
|
|
11971
|
-
return new
|
|
11958
|
+
return new _LanguageState(newCx);
|
|
11972
11959
|
}
|
|
11973
11960
|
static init(state) {
|
|
11974
11961
|
let vpTo = Math.min(3e3, state.doc.length);
|
|
11975
11962
|
let parseState = ParseContext.create(state.facet(language).parser, state, { from: 0, to: vpTo });
|
|
11976
11963
|
if (!parseState.work(20, vpTo))
|
|
11977
11964
|
parseState.takeTree();
|
|
11978
|
-
return new
|
|
11965
|
+
return new _LanguageState(parseState);
|
|
11979
11966
|
}
|
|
11980
11967
|
};
|
|
11981
11968
|
Language.state = /* @__PURE__ */ StateField.define({
|
|
@@ -12259,7 +12246,7 @@ function indentFrom(node, pos, base2) {
|
|
|
12259
12246
|
function topIndent() {
|
|
12260
12247
|
return 0;
|
|
12261
12248
|
}
|
|
12262
|
-
var TreeIndentContext = class extends IndentContext {
|
|
12249
|
+
var TreeIndentContext = class _TreeIndentContext extends IndentContext {
|
|
12263
12250
|
constructor(base2, pos, node) {
|
|
12264
12251
|
super(base2.state, base2.options);
|
|
12265
12252
|
this.base = base2;
|
|
@@ -12270,7 +12257,7 @@ var TreeIndentContext = class extends IndentContext {
|
|
|
12270
12257
|
@internal
|
|
12271
12258
|
*/
|
|
12272
12259
|
static create(base2, pos, node) {
|
|
12273
|
-
return new
|
|
12260
|
+
return new _TreeIndentContext(base2, pos, node);
|
|
12274
12261
|
}
|
|
12275
12262
|
/**
|
|
12276
12263
|
Get the text directly after `this.pos`, either the entire line
|
|
@@ -12345,7 +12332,7 @@ function delimitedStrategy(context, align, units, closing2, closedAt) {
|
|
|
12345
12332
|
return closed ? context.column(aligned.from) : context.column(aligned.to);
|
|
12346
12333
|
return context.baseIndent + (closed ? 0 : context.unit * units);
|
|
12347
12334
|
}
|
|
12348
|
-
var HighlightStyle = class {
|
|
12335
|
+
var HighlightStyle = class _HighlightStyle {
|
|
12349
12336
|
constructor(specs, options) {
|
|
12350
12337
|
this.specs = specs;
|
|
12351
12338
|
let modSpec;
|
|
@@ -12382,7 +12369,7 @@ var HighlightStyle = class {
|
|
|
12382
12369
|
defined earlier.
|
|
12383
12370
|
*/
|
|
12384
12371
|
static define(specs, options) {
|
|
12385
|
-
return new
|
|
12372
|
+
return new _HighlightStyle(specs, options || {});
|
|
12386
12373
|
}
|
|
12387
12374
|
};
|
|
12388
12375
|
var highlighterFacet = /* @__PURE__ */ Facet.define();
|
|
@@ -13312,7 +13299,7 @@ function sortOptions(active, state) {
|
|
|
13312
13299
|
}
|
|
13313
13300
|
return result;
|
|
13314
13301
|
}
|
|
13315
|
-
var CompletionDialog = class {
|
|
13302
|
+
var CompletionDialog = class _CompletionDialog {
|
|
13316
13303
|
constructor(options, attrs, tooltip, timestamp, selected, disabled) {
|
|
13317
13304
|
this.options = options;
|
|
13318
13305
|
this.attrs = attrs;
|
|
@@ -13322,7 +13309,7 @@ var CompletionDialog = class {
|
|
|
13322
13309
|
this.disabled = disabled;
|
|
13323
13310
|
}
|
|
13324
13311
|
setSelected(selected, id) {
|
|
13325
|
-
return selected == this.selected || selected >= this.options.length ? this : new
|
|
13312
|
+
return selected == this.selected || selected >= this.options.length ? this : new _CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
|
|
13326
13313
|
}
|
|
13327
13314
|
static build(active, state, id, prev, conf) {
|
|
13328
13315
|
let options = sortOptions(active, state);
|
|
@@ -13330,7 +13317,7 @@ var CompletionDialog = class {
|
|
|
13330
13317
|
return prev && active.some(
|
|
13331
13318
|
(a) => a.state == 1
|
|
13332
13319
|
/* Pending */
|
|
13333
|
-
) ? new
|
|
13320
|
+
) ? new _CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;
|
|
13334
13321
|
}
|
|
13335
13322
|
let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
|
|
13336
13323
|
if (prev && prev.selected != selected && prev.selected != -1) {
|
|
@@ -13341,24 +13328,24 @@ var CompletionDialog = class {
|
|
|
13341
13328
|
break;
|
|
13342
13329
|
}
|
|
13343
13330
|
}
|
|
13344
|
-
return new
|
|
13331
|
+
return new _CompletionDialog(options, makeAttrs(id, selected), {
|
|
13345
13332
|
pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),
|
|
13346
13333
|
create: completionTooltip(completionState, applyCompletion),
|
|
13347
13334
|
above: conf.aboveCursor
|
|
13348
13335
|
}, prev ? prev.timestamp : Date.now(), selected, false);
|
|
13349
13336
|
}
|
|
13350
13337
|
map(changes) {
|
|
13351
|
-
return new
|
|
13338
|
+
return new _CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled);
|
|
13352
13339
|
}
|
|
13353
13340
|
};
|
|
13354
|
-
var CompletionState = class {
|
|
13341
|
+
var CompletionState = class _CompletionState {
|
|
13355
13342
|
constructor(active, id, open) {
|
|
13356
13343
|
this.active = active;
|
|
13357
13344
|
this.id = id;
|
|
13358
13345
|
this.open = open;
|
|
13359
13346
|
}
|
|
13360
13347
|
static start() {
|
|
13361
|
-
return new
|
|
13348
|
+
return new _CompletionState(none2, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
13362
13349
|
}
|
|
13363
13350
|
update(tr) {
|
|
13364
13351
|
let { state } = tr, conf = state.facet(completionConfig);
|
|
@@ -13398,7 +13385,7 @@ var CompletionState = class {
|
|
|
13398
13385
|
for (let effect of tr.effects)
|
|
13399
13386
|
if (effect.is(setSelectedEffect))
|
|
13400
13387
|
open = open && open.setSelected(effect.value, this.id);
|
|
13401
|
-
return active == this.active && open == this.open ? this : new
|
|
13388
|
+
return active == this.active && open == this.open ? this : new _CompletionState(active, this.id, open);
|
|
13402
13389
|
}
|
|
13403
13390
|
get tooltip() {
|
|
13404
13391
|
return this.open ? this.open.tooltip : null;
|
|
@@ -13439,7 +13426,7 @@ var none2 = [];
|
|
|
13439
13426
|
function getUserEvent(tr) {
|
|
13440
13427
|
return tr.isUserEvent("input.type") ? "input" : tr.isUserEvent("delete.backward") ? "delete" : null;
|
|
13441
13428
|
}
|
|
13442
|
-
var ActiveSource = class {
|
|
13429
|
+
var ActiveSource = class _ActiveSource {
|
|
13443
13430
|
constructor(source, state, explicitPos = -1) {
|
|
13444
13431
|
this.source = source;
|
|
13445
13432
|
this.state = state;
|
|
@@ -13455,16 +13442,16 @@ var ActiveSource = class {
|
|
|
13455
13442
|
else if (tr.docChanged)
|
|
13456
13443
|
value = value.handleChange(tr);
|
|
13457
13444
|
else if (tr.selection && value.state != 0)
|
|
13458
|
-
value = new
|
|
13445
|
+
value = new _ActiveSource(
|
|
13459
13446
|
value.source,
|
|
13460
13447
|
0
|
|
13461
13448
|
/* Inactive */
|
|
13462
13449
|
);
|
|
13463
13450
|
for (let effect of tr.effects) {
|
|
13464
13451
|
if (effect.is(startCompletionEffect))
|
|
13465
|
-
value = new
|
|
13452
|
+
value = new _ActiveSource(value.source, 1, effect.value ? cur(tr.state) : -1);
|
|
13466
13453
|
else if (effect.is(closeCompletionEffect))
|
|
13467
|
-
value = new
|
|
13454
|
+
value = new _ActiveSource(
|
|
13468
13455
|
value.source,
|
|
13469
13456
|
0
|
|
13470
13457
|
/* Inactive */
|
|
@@ -13478,24 +13465,24 @@ var ActiveSource = class {
|
|
|
13478
13465
|
return value;
|
|
13479
13466
|
}
|
|
13480
13467
|
handleUserEvent(tr, type, conf) {
|
|
13481
|
-
return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new
|
|
13468
|
+
return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new _ActiveSource(
|
|
13482
13469
|
this.source,
|
|
13483
13470
|
1
|
|
13484
13471
|
/* Pending */
|
|
13485
13472
|
);
|
|
13486
13473
|
}
|
|
13487
13474
|
handleChange(tr) {
|
|
13488
|
-
return tr.changes.touchesRange(cur(tr.startState)) ? new
|
|
13475
|
+
return tr.changes.touchesRange(cur(tr.startState)) ? new _ActiveSource(
|
|
13489
13476
|
this.source,
|
|
13490
13477
|
0
|
|
13491
13478
|
/* Inactive */
|
|
13492
13479
|
) : this.map(tr.changes);
|
|
13493
13480
|
}
|
|
13494
13481
|
map(changes) {
|
|
13495
|
-
return changes.empty || this.explicitPos < 0 ? this : new
|
|
13482
|
+
return changes.empty || this.explicitPos < 0 ? this : new _ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));
|
|
13496
13483
|
}
|
|
13497
13484
|
};
|
|
13498
|
-
var ActiveResult = class extends ActiveSource {
|
|
13485
|
+
var ActiveResult = class _ActiveResult extends ActiveSource {
|
|
13499
13486
|
constructor(source, explicitPos, result, from, to) {
|
|
13500
13487
|
super(source, 2, explicitPos);
|
|
13501
13488
|
this.result = result;
|
|
@@ -13517,9 +13504,9 @@ var ActiveResult = class extends ActiveSource {
|
|
|
13517
13504
|
);
|
|
13518
13505
|
let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos), updated;
|
|
13519
13506
|
if (checkValid(this.result.validFor, tr.state, from, to))
|
|
13520
|
-
return new
|
|
13507
|
+
return new _ActiveResult(this.source, explicitPos, this.result, from, to);
|
|
13521
13508
|
if (this.result.update && (updated = this.result.update(this.result, from, to, new CompletionContext(tr.state, pos, explicitPos >= 0))))
|
|
13522
|
-
return new
|
|
13509
|
+
return new _ActiveResult(this.source, explicitPos, updated, updated.from, (_a2 = updated.to) !== null && _a2 !== void 0 ? _a2 : cur(tr.state));
|
|
13523
13510
|
return new ActiveSource(this.source, 1, explicitPos);
|
|
13524
13511
|
}
|
|
13525
13512
|
handleChange(tr) {
|
|
@@ -13530,7 +13517,7 @@ var ActiveResult = class extends ActiveSource {
|
|
|
13530
13517
|
) : this.map(tr.changes);
|
|
13531
13518
|
}
|
|
13532
13519
|
map(mapping) {
|
|
13533
|
-
return mapping.empty ? this : new
|
|
13520
|
+
return mapping.empty ? this : new _ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
13534
13521
|
}
|
|
13535
13522
|
};
|
|
13536
13523
|
function checkValid(validFor, state, from, to) {
|
|
@@ -13576,12 +13563,12 @@ function moveCompletionSelection(forward, by = "option") {
|
|
|
13576
13563
|
let step = 1, tooltip;
|
|
13577
13564
|
if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip)))
|
|
13578
13565
|
step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
|
|
13579
|
-
let { length
|
|
13580
|
-
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 :
|
|
13566
|
+
let { length } = cState.open.options;
|
|
13567
|
+
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;
|
|
13581
13568
|
if (selected < 0)
|
|
13582
|
-
selected = by == "page" ? 0 :
|
|
13583
|
-
else if (selected >=
|
|
13584
|
-
selected = by == "page" ?
|
|
13569
|
+
selected = by == "page" ? 0 : length - 1;
|
|
13570
|
+
else if (selected >= length)
|
|
13571
|
+
selected = by == "page" ? length - 1 : 0;
|
|
13585
13572
|
view.dispatch({ effects: setSelectedEffect.of(selected) });
|
|
13586
13573
|
return true;
|
|
13587
13574
|
};
|
|
@@ -14352,7 +14339,7 @@ var undo = /* @__PURE__ */ cmd(0, false);
|
|
|
14352
14339
|
var redo = /* @__PURE__ */ cmd(1, false);
|
|
14353
14340
|
var undoSelection = /* @__PURE__ */ cmd(0, true);
|
|
14354
14341
|
var redoSelection = /* @__PURE__ */ cmd(1, true);
|
|
14355
|
-
var HistEvent = class {
|
|
14342
|
+
var HistEvent = class _HistEvent {
|
|
14356
14343
|
constructor(changes, effects, mapped, startSelection, selectionsAfter) {
|
|
14357
14344
|
this.changes = changes;
|
|
14358
14345
|
this.effects = effects;
|
|
@@ -14361,7 +14348,7 @@ var HistEvent = class {
|
|
|
14361
14348
|
this.selectionsAfter = selectionsAfter;
|
|
14362
14349
|
}
|
|
14363
14350
|
setSelAfter(after) {
|
|
14364
|
-
return new
|
|
14351
|
+
return new _HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);
|
|
14365
14352
|
}
|
|
14366
14353
|
toJSON() {
|
|
14367
14354
|
var _a2, _b, _c;
|
|
@@ -14373,7 +14360,7 @@ var HistEvent = class {
|
|
|
14373
14360
|
};
|
|
14374
14361
|
}
|
|
14375
14362
|
static fromJSON(json) {
|
|
14376
|
-
return new
|
|
14363
|
+
return new _HistEvent(json.changes && ChangeSet.fromJSON(json.changes), [], json.mapped && ChangeDesc.fromJSON(json.mapped), json.startSelection && EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(EditorSelection.fromJSON));
|
|
14377
14364
|
}
|
|
14378
14365
|
// This does not check `addToHistory` and such, it assumes the
|
|
14379
14366
|
// transaction needs to be converted to an item. Returns null when
|
|
@@ -14387,10 +14374,10 @@ var HistEvent = class {
|
|
|
14387
14374
|
}
|
|
14388
14375
|
if (!effects.length && tr.changes.empty)
|
|
14389
14376
|
return null;
|
|
14390
|
-
return new
|
|
14377
|
+
return new _HistEvent(tr.changes.invert(tr.startState.doc), effects, void 0, selection || tr.startState.selection, none3);
|
|
14391
14378
|
}
|
|
14392
14379
|
static selection(selections) {
|
|
14393
|
-
return new
|
|
14380
|
+
return new _HistEvent(void 0, none3, void 0, void 0, selections);
|
|
14394
14381
|
}
|
|
14395
14382
|
};
|
|
14396
14383
|
function updateBranch(branch, to, maxLen, newEvent) {
|
|
@@ -14440,16 +14427,16 @@ function popSelection(branch) {
|
|
|
14440
14427
|
function addMappingToBranch(branch, mapping) {
|
|
14441
14428
|
if (!branch.length)
|
|
14442
14429
|
return branch;
|
|
14443
|
-
let
|
|
14444
|
-
while (
|
|
14445
|
-
let event = mapEvent(branch[
|
|
14430
|
+
let length = branch.length, selections = none3;
|
|
14431
|
+
while (length) {
|
|
14432
|
+
let event = mapEvent(branch[length - 1], mapping, selections);
|
|
14446
14433
|
if (event.changes && !event.changes.empty || event.effects.length) {
|
|
14447
|
-
let result = branch.slice(0,
|
|
14448
|
-
result[
|
|
14434
|
+
let result = branch.slice(0, length);
|
|
14435
|
+
result[length - 1] = event;
|
|
14449
14436
|
return result;
|
|
14450
14437
|
} else {
|
|
14451
14438
|
mapping = event.mapped;
|
|
14452
|
-
|
|
14439
|
+
length--;
|
|
14453
14440
|
selections = event.selectionsAfter;
|
|
14454
14441
|
}
|
|
14455
14442
|
}
|
|
@@ -14464,7 +14451,7 @@ function mapEvent(event, mapping, extraSelections) {
|
|
|
14464
14451
|
return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);
|
|
14465
14452
|
}
|
|
14466
14453
|
var joinableUserEvent = /^(input\.type|delete)($|\.)/;
|
|
14467
|
-
var HistoryState = class {
|
|
14454
|
+
var HistoryState = class _HistoryState {
|
|
14468
14455
|
constructor(done, undone, prevTime = 0, prevUserEvent = void 0) {
|
|
14469
14456
|
this.done = done;
|
|
14470
14457
|
this.undone = undone;
|
|
@@ -14472,7 +14459,7 @@ var HistoryState = class {
|
|
|
14472
14459
|
this.prevUserEvent = prevUserEvent;
|
|
14473
14460
|
}
|
|
14474
14461
|
isolate() {
|
|
14475
|
-
return this.prevTime ? new
|
|
14462
|
+
return this.prevTime ? new _HistoryState(this.done, this.undone) : this;
|
|
14476
14463
|
}
|
|
14477
14464
|
addChanges(event, time, userEvent, config2, tr) {
|
|
14478
14465
|
let done = this.done, lastEvent = done[done.length - 1];
|
|
@@ -14482,16 +14469,16 @@ var HistoryState = class {
|
|
|
14482
14469
|
} else {
|
|
14483
14470
|
done = updateBranch(done, done.length, config2.minDepth, event);
|
|
14484
14471
|
}
|
|
14485
|
-
return new
|
|
14472
|
+
return new _HistoryState(done, none3, time, userEvent);
|
|
14486
14473
|
}
|
|
14487
14474
|
addSelection(selection, time, userEvent, newGroupDelay) {
|
|
14488
14475
|
let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none3;
|
|
14489
14476
|
if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection))
|
|
14490
14477
|
return this;
|
|
14491
|
-
return new
|
|
14478
|
+
return new _HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);
|
|
14492
14479
|
}
|
|
14493
14480
|
addMapping(mapping) {
|
|
14494
|
-
return new
|
|
14481
|
+
return new _HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);
|
|
14495
14482
|
}
|
|
14496
14483
|
pop(side, state, selection) {
|
|
14497
14484
|
let branch = side == 0 ? this.done : this.undone;
|
|
@@ -15210,271 +15197,6 @@ var metadataKeys = {
|
|
|
15210
15197
|
};
|
|
15211
15198
|
var { DEPTH, IS_LEAF } = metadataKeys;
|
|
15212
15199
|
|
|
15213
|
-
// ../vuu-utils/src/cookie-utils.ts
|
|
15214
|
-
var getCookieValue = (name) => {
|
|
15215
|
-
var _a2, _b;
|
|
15216
|
-
if (((_a2 = globalThis.document) == null ? void 0 : _a2.cookie) !== void 0) {
|
|
15217
|
-
return (_b = globalThis.document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _b.split("=")[1];
|
|
15218
|
-
}
|
|
15219
|
-
};
|
|
15220
|
-
|
|
15221
|
-
// ../vuu-utils/src/DataWindow.ts
|
|
15222
|
-
var { KEY } = metadataKeys;
|
|
15223
|
-
|
|
15224
|
-
// ../vuu-utils/src/date/formatter.ts
|
|
15225
|
-
var baseTimeFormatOptions = {
|
|
15226
|
-
hour: "2-digit",
|
|
15227
|
-
minute: "2-digit",
|
|
15228
|
-
second: "2-digit"
|
|
15229
|
-
};
|
|
15230
|
-
var formatConfigByTimePatterns = {
|
|
15231
|
-
"hh:mm:ss": {
|
|
15232
|
-
locale: "en-GB",
|
|
15233
|
-
options: { ...baseTimeFormatOptions, hour12: false }
|
|
15234
|
-
},
|
|
15235
|
-
"hh:mm:ss a": {
|
|
15236
|
-
locale: "en-GB",
|
|
15237
|
-
options: { ...baseTimeFormatOptions, hour12: true }
|
|
15238
|
-
}
|
|
15239
|
-
};
|
|
15240
|
-
var baseDateFormatOptions = {
|
|
15241
|
-
day: "2-digit",
|
|
15242
|
-
month: "2-digit",
|
|
15243
|
-
year: "numeric"
|
|
15244
|
-
};
|
|
15245
|
-
var formatConfigByDatePatterns = {
|
|
15246
|
-
"dd.mm.yyyy": {
|
|
15247
|
-
locale: "en-GB",
|
|
15248
|
-
options: { ...baseDateFormatOptions },
|
|
15249
|
-
postProcessor: (s) => s.replaceAll("/", ".")
|
|
15250
|
-
},
|
|
15251
|
-
"dd/mm/yyyy": { locale: "en-GB", options: { ...baseDateFormatOptions } },
|
|
15252
|
-
"dd MMM yyyy": {
|
|
15253
|
-
locale: "en-GB",
|
|
15254
|
-
options: { ...baseDateFormatOptions, month: "short" }
|
|
15255
|
-
},
|
|
15256
|
-
"dd MMMM yyyy": {
|
|
15257
|
-
locale: "en-GB",
|
|
15258
|
-
options: { ...baseDateFormatOptions, month: "long" }
|
|
15259
|
-
},
|
|
15260
|
-
"mm/dd/yyyy": { locale: "en-US", options: { ...baseDateFormatOptions } },
|
|
15261
|
-
"MMM dd, yyyy": {
|
|
15262
|
-
locale: "en-US",
|
|
15263
|
-
options: { ...baseDateFormatOptions, month: "short" }
|
|
15264
|
-
},
|
|
15265
|
-
"MMMM dd, yyyy": {
|
|
15266
|
-
locale: "en-US",
|
|
15267
|
-
options: { ...baseDateFormatOptions, month: "long" }
|
|
15268
|
-
}
|
|
15269
|
-
};
|
|
15270
|
-
var formatConfigByDateTimePatterns = { ...formatConfigByDatePatterns, ...formatConfigByTimePatterns };
|
|
15271
|
-
|
|
15272
|
-
// ../vuu-utils/src/logging-utils.ts
|
|
15273
|
-
var logLevels = ["error", "warn", "info", "debug"];
|
|
15274
|
-
var isValidLogLevel = (value) => typeof value === "string" && logLevels.includes(value);
|
|
15275
|
-
var DEFAULT_LOG_LEVEL = "error";
|
|
15276
|
-
var NO_OP = () => void 0;
|
|
15277
|
-
var DEFAULT_DEBUG_LEVEL = false ? "error" : "info";
|
|
15278
|
-
var { loggingLevel = DEFAULT_DEBUG_LEVEL } = getLoggingSettings();
|
|
15279
|
-
var logger = (category) => {
|
|
15280
|
-
const debugEnabled2 = loggingLevel === "debug";
|
|
15281
|
-
const infoEnabled = debugEnabled2 || loggingLevel === "info";
|
|
15282
|
-
const warnEnabled = infoEnabled || loggingLevel === "warn";
|
|
15283
|
-
const errorEnabled = warnEnabled || loggingLevel === "error";
|
|
15284
|
-
const info = infoEnabled ? (message) => console.info(`[${category}] ${message}`) : NO_OP;
|
|
15285
|
-
const warn = warnEnabled ? (message) => console.warn(`[${category}] ${message}`) : NO_OP;
|
|
15286
|
-
const debug2 = debugEnabled2 ? (message) => console.debug(`[${category}] ${message}`) : NO_OP;
|
|
15287
|
-
const error = errorEnabled ? (message) => console.error(`[${category}] ${message}`) : NO_OP;
|
|
15288
|
-
if (false) {
|
|
15289
|
-
return {
|
|
15290
|
-
errorEnabled,
|
|
15291
|
-
error
|
|
15292
|
-
};
|
|
15293
|
-
} else {
|
|
15294
|
-
return {
|
|
15295
|
-
debugEnabled: debugEnabled2,
|
|
15296
|
-
infoEnabled,
|
|
15297
|
-
warnEnabled,
|
|
15298
|
-
errorEnabled,
|
|
15299
|
-
info,
|
|
15300
|
-
warn,
|
|
15301
|
-
debug: debug2,
|
|
15302
|
-
error
|
|
15303
|
-
};
|
|
15304
|
-
}
|
|
15305
|
-
};
|
|
15306
|
-
function getLoggingSettings() {
|
|
15307
|
-
if (typeof loggingSettings !== "undefined") {
|
|
15308
|
-
return loggingSettings;
|
|
15309
|
-
} else {
|
|
15310
|
-
return {
|
|
15311
|
-
loggingLevel: getLoggingLevelFromCookie()
|
|
15312
|
-
};
|
|
15313
|
-
}
|
|
15314
|
-
}
|
|
15315
|
-
function getLoggingLevelFromCookie() {
|
|
15316
|
-
const value = getCookieValue("vuu-logging-level");
|
|
15317
|
-
if (isValidLogLevel(value)) {
|
|
15318
|
-
return value;
|
|
15319
|
-
} else {
|
|
15320
|
-
return DEFAULT_LOG_LEVEL;
|
|
15321
|
-
}
|
|
15322
|
-
}
|
|
15323
|
-
|
|
15324
|
-
// ../vuu-utils/src/debug-utils.ts
|
|
15325
|
-
var { debug, debugEnabled } = logger("range-monitor");
|
|
15326
|
-
|
|
15327
|
-
// ../vuu-utils/src/event-emitter.ts
|
|
15328
|
-
function isArrayOfListeners(listeners) {
|
|
15329
|
-
return Array.isArray(listeners);
|
|
15330
|
-
}
|
|
15331
|
-
function isOnlyListener(listeners) {
|
|
15332
|
-
return !Array.isArray(listeners);
|
|
15333
|
-
}
|
|
15334
|
-
var _events;
|
|
15335
|
-
var EventEmitter = class {
|
|
15336
|
-
constructor() {
|
|
15337
|
-
__privateAdd(this, _events, /* @__PURE__ */ new Map());
|
|
15338
|
-
}
|
|
15339
|
-
addListener(event, listener) {
|
|
15340
|
-
const listeners = __privateGet(this, _events).get(event);
|
|
15341
|
-
if (!listeners) {
|
|
15342
|
-
__privateGet(this, _events).set(event, listener);
|
|
15343
|
-
} else if (isArrayOfListeners(listeners)) {
|
|
15344
|
-
listeners.push(listener);
|
|
15345
|
-
} else if (isOnlyListener(listeners)) {
|
|
15346
|
-
__privateGet(this, _events).set(event, [listeners, listener]);
|
|
15347
|
-
}
|
|
15348
|
-
}
|
|
15349
|
-
removeListener(event, listener) {
|
|
15350
|
-
if (!__privateGet(this, _events).has(event)) {
|
|
15351
|
-
return;
|
|
15352
|
-
}
|
|
15353
|
-
const listenerOrListeners = __privateGet(this, _events).get(event);
|
|
15354
|
-
let position = -1;
|
|
15355
|
-
if (listenerOrListeners === listener) {
|
|
15356
|
-
__privateGet(this, _events).delete(event);
|
|
15357
|
-
} else if (Array.isArray(listenerOrListeners)) {
|
|
15358
|
-
for (let i = length; i-- > 0; ) {
|
|
15359
|
-
if (listenerOrListeners[i] === listener) {
|
|
15360
|
-
position = i;
|
|
15361
|
-
break;
|
|
15362
|
-
}
|
|
15363
|
-
}
|
|
15364
|
-
if (position < 0) {
|
|
15365
|
-
return;
|
|
15366
|
-
}
|
|
15367
|
-
if (listenerOrListeners.length === 1) {
|
|
15368
|
-
listenerOrListeners.length = 0;
|
|
15369
|
-
__privateGet(this, _events).delete(event);
|
|
15370
|
-
} else {
|
|
15371
|
-
listenerOrListeners.splice(position, 1);
|
|
15372
|
-
}
|
|
15373
|
-
}
|
|
15374
|
-
}
|
|
15375
|
-
removeAllListeners(event) {
|
|
15376
|
-
if (event && __privateGet(this, _events).has(event)) {
|
|
15377
|
-
__privateGet(this, _events).delete(event);
|
|
15378
|
-
} else if (event === void 0) {
|
|
15379
|
-
__privateGet(this, _events).clear();
|
|
15380
|
-
}
|
|
15381
|
-
}
|
|
15382
|
-
emit(event, ...args) {
|
|
15383
|
-
if (__privateGet(this, _events)) {
|
|
15384
|
-
const handler = __privateGet(this, _events).get(event);
|
|
15385
|
-
if (handler) {
|
|
15386
|
-
this.invokeHandler(handler, args);
|
|
15387
|
-
}
|
|
15388
|
-
}
|
|
15389
|
-
}
|
|
15390
|
-
once(event, listener) {
|
|
15391
|
-
const handler = (...args) => {
|
|
15392
|
-
this.removeListener(event, handler);
|
|
15393
|
-
listener(...args);
|
|
15394
|
-
};
|
|
15395
|
-
this.on(event, handler);
|
|
15396
|
-
}
|
|
15397
|
-
on(event, listener) {
|
|
15398
|
-
this.addListener(event, listener);
|
|
15399
|
-
}
|
|
15400
|
-
hasListener(event, listener) {
|
|
15401
|
-
const listeners = __privateGet(this, _events).get(event);
|
|
15402
|
-
if (Array.isArray(listeners)) {
|
|
15403
|
-
return listeners.includes(listener);
|
|
15404
|
-
} else {
|
|
15405
|
-
return listeners === listener;
|
|
15406
|
-
}
|
|
15407
|
-
}
|
|
15408
|
-
invokeHandler(handler, args) {
|
|
15409
|
-
if (isArrayOfListeners(handler)) {
|
|
15410
|
-
handler.slice().forEach((listener) => this.invokeHandler(listener, args));
|
|
15411
|
-
} else {
|
|
15412
|
-
switch (args.length) {
|
|
15413
|
-
case 0:
|
|
15414
|
-
handler();
|
|
15415
|
-
break;
|
|
15416
|
-
case 1:
|
|
15417
|
-
handler(args[0]);
|
|
15418
|
-
break;
|
|
15419
|
-
case 2:
|
|
15420
|
-
handler(args[0], args[1]);
|
|
15421
|
-
break;
|
|
15422
|
-
default:
|
|
15423
|
-
handler.call(null, ...args);
|
|
15424
|
-
}
|
|
15425
|
-
}
|
|
15426
|
-
}
|
|
15427
|
-
};
|
|
15428
|
-
_events = new WeakMap();
|
|
15429
|
-
|
|
15430
|
-
// ../vuu-utils/src/round-decimal.ts
|
|
15431
|
-
var PUNCTUATION_STR = String.fromCharCode(8200);
|
|
15432
|
-
var DIGIT_STR = String.fromCharCode(8199);
|
|
15433
|
-
var Space = {
|
|
15434
|
-
DIGIT: DIGIT_STR,
|
|
15435
|
-
TWO_DIGITS: DIGIT_STR + DIGIT_STR,
|
|
15436
|
-
THREE_DIGITS: DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
15437
|
-
FULL_PADDING: [
|
|
15438
|
-
null,
|
|
15439
|
-
PUNCTUATION_STR + DIGIT_STR,
|
|
15440
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR,
|
|
15441
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
15442
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR
|
|
15443
|
-
]
|
|
15444
|
-
};
|
|
15445
|
-
var LEADING_FILL = DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR;
|
|
15446
|
-
|
|
15447
|
-
// ../vuu-utils/src/json-utils.ts
|
|
15448
|
-
var { COUNT: COUNT2 } = metadataKeys;
|
|
15449
|
-
|
|
15450
|
-
// ../vuu-utils/src/row-utils.ts
|
|
15451
|
-
var { IDX } = metadataKeys;
|
|
15452
|
-
|
|
15453
|
-
// ../vuu-utils/src/selection-utils.ts
|
|
15454
|
-
var { SELECTED } = metadataKeys;
|
|
15455
|
-
var RowSelected = {
|
|
15456
|
-
False: 0,
|
|
15457
|
-
True: 1,
|
|
15458
|
-
First: 2,
|
|
15459
|
-
Last: 4
|
|
15460
|
-
};
|
|
15461
|
-
var SINGLE_SELECTED_ROW = RowSelected.True + RowSelected.First + RowSelected.Last;
|
|
15462
|
-
var FIRST_SELECTED_ROW_OF_BLOCK = RowSelected.True + RowSelected.First;
|
|
15463
|
-
var LAST_SELECTED_ROW_OF_BLOCK = RowSelected.True + RowSelected.Last;
|
|
15464
|
-
|
|
15465
|
-
// ../../node_modules/html-to-image/es/util.js
|
|
15466
|
-
var uuid = (() => {
|
|
15467
|
-
let counter = 0;
|
|
15468
|
-
const random = () => (
|
|
15469
|
-
// eslint-disable-next-line no-bitwise
|
|
15470
|
-
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
15471
|
-
);
|
|
15472
|
-
return () => {
|
|
15473
|
-
counter += 1;
|
|
15474
|
-
return `u${random()}${counter}`;
|
|
15475
|
-
};
|
|
15476
|
-
})();
|
|
15477
|
-
|
|
15478
15200
|
// src/suggestion-utils.ts
|
|
15479
15201
|
var NO_OPTIONS = {};
|
|
15480
15202
|
var applyWithCursorMove = () => (view, completion, from) => {
|