@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/esm/index.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
var __accessCheck = (obj, member, msg) => {
|
|
2
|
-
if (!member.has(obj))
|
|
3
|
-
throw TypeError("Cannot " + msg);
|
|
4
|
-
};
|
|
5
|
-
var __privateGet = (obj, member, getter) => {
|
|
6
|
-
__accessCheck(obj, member, "read from private field");
|
|
7
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
8
|
-
};
|
|
9
|
-
var __privateAdd = (obj, member, value) => {
|
|
10
|
-
if (member.has(obj))
|
|
11
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
12
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
1
|
// ../../node_modules/@codemirror/state/dist/index.js
|
|
16
|
-
var Text = class {
|
|
2
|
+
var Text = class _Text {
|
|
17
3
|
/**
|
|
18
4
|
Get the line description around the given position.
|
|
19
5
|
*/
|
|
@@ -156,15 +142,15 @@ var Text = class {
|
|
|
156
142
|
if (text.length == 0)
|
|
157
143
|
throw new RangeError("A document must have at least one line");
|
|
158
144
|
if (text.length == 1 && !text[0])
|
|
159
|
-
return
|
|
145
|
+
return _Text.empty;
|
|
160
146
|
return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
161
147
|
}
|
|
162
148
|
};
|
|
163
|
-
var TextLeaf = class extends Text {
|
|
164
|
-
constructor(text,
|
|
149
|
+
var TextLeaf = class _TextLeaf extends Text {
|
|
150
|
+
constructor(text, length = textLength(text)) {
|
|
165
151
|
super();
|
|
166
152
|
this.text = text;
|
|
167
|
-
this.length =
|
|
153
|
+
this.length = length;
|
|
168
154
|
}
|
|
169
155
|
get lines() {
|
|
170
156
|
return this.text.length;
|
|
@@ -182,28 +168,28 @@ var TextLeaf = class extends Text {
|
|
|
182
168
|
}
|
|
183
169
|
}
|
|
184
170
|
decompose(from, to, target, open) {
|
|
185
|
-
let text = from <= 0 && to >= this.length ? this : new
|
|
171
|
+
let text = from <= 0 && to >= this.length ? this : new _TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
|
|
186
172
|
if (open & 1) {
|
|
187
173
|
let prev = target.pop();
|
|
188
174
|
let joined = appendText(text.text, prev.text.slice(), 0, text.length);
|
|
189
175
|
if (joined.length <= 32) {
|
|
190
|
-
target.push(new
|
|
176
|
+
target.push(new _TextLeaf(joined, prev.length + text.length));
|
|
191
177
|
} else {
|
|
192
178
|
let mid = joined.length >> 1;
|
|
193
|
-
target.push(new
|
|
179
|
+
target.push(new _TextLeaf(joined.slice(0, mid)), new _TextLeaf(joined.slice(mid)));
|
|
194
180
|
}
|
|
195
181
|
} else {
|
|
196
182
|
target.push(text);
|
|
197
183
|
}
|
|
198
184
|
}
|
|
199
185
|
replace(from, to, text) {
|
|
200
|
-
if (!(text instanceof
|
|
186
|
+
if (!(text instanceof _TextLeaf))
|
|
201
187
|
return super.replace(from, to, text);
|
|
202
188
|
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
|
|
203
189
|
let newLen = this.length + text.length - (to - from);
|
|
204
190
|
if (lines.length <= 32)
|
|
205
|
-
return new
|
|
206
|
-
return TextNode.from(
|
|
191
|
+
return new _TextLeaf(lines, newLen);
|
|
192
|
+
return TextNode.from(_TextLeaf.split(lines, []), newLen);
|
|
207
193
|
}
|
|
208
194
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
209
195
|
let result = "";
|
|
@@ -230,21 +216,21 @@ var TextLeaf = class extends Text {
|
|
|
230
216
|
part.push(line);
|
|
231
217
|
len += line.length + 1;
|
|
232
218
|
if (part.length == 32) {
|
|
233
|
-
target.push(new
|
|
219
|
+
target.push(new _TextLeaf(part, len));
|
|
234
220
|
part = [];
|
|
235
221
|
len = -1;
|
|
236
222
|
}
|
|
237
223
|
}
|
|
238
224
|
if (len > -1)
|
|
239
|
-
target.push(new
|
|
225
|
+
target.push(new _TextLeaf(part, len));
|
|
240
226
|
return target;
|
|
241
227
|
}
|
|
242
228
|
};
|
|
243
|
-
var TextNode = class extends Text {
|
|
244
|
-
constructor(children,
|
|
229
|
+
var TextNode = class _TextNode extends Text {
|
|
230
|
+
constructor(children, length) {
|
|
245
231
|
super();
|
|
246
232
|
this.children = children;
|
|
247
|
-
this.length =
|
|
233
|
+
this.length = length;
|
|
248
234
|
this.lines = 0;
|
|
249
235
|
for (let child of children)
|
|
250
236
|
this.lines += child.lines;
|
|
@@ -281,7 +267,7 @@ var TextNode = class extends Text {
|
|
|
281
267
|
if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) {
|
|
282
268
|
let copy = this.children.slice();
|
|
283
269
|
copy[i] = updated;
|
|
284
|
-
return new
|
|
270
|
+
return new _TextNode(copy, this.length - (to - from) + text.length);
|
|
285
271
|
}
|
|
286
272
|
return super.replace(pos, end, updated);
|
|
287
273
|
}
|
|
@@ -306,20 +292,20 @@ var TextNode = class extends Text {
|
|
|
306
292
|
child.flatten(target);
|
|
307
293
|
}
|
|
308
294
|
scanIdentical(other, dir) {
|
|
309
|
-
if (!(other instanceof
|
|
295
|
+
if (!(other instanceof _TextNode))
|
|
310
296
|
return 0;
|
|
311
|
-
let
|
|
297
|
+
let length = 0;
|
|
312
298
|
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];
|
|
313
299
|
for (; ; iA += dir, iB += dir) {
|
|
314
300
|
if (iA == eA || iB == eB)
|
|
315
|
-
return
|
|
301
|
+
return length;
|
|
316
302
|
let chA = this.children[iA], chB = other.children[iB];
|
|
317
303
|
if (chA != chB)
|
|
318
|
-
return
|
|
319
|
-
|
|
304
|
+
return length + chA.scanIdentical(chB, dir);
|
|
305
|
+
length += chA.length + 1;
|
|
320
306
|
}
|
|
321
307
|
}
|
|
322
|
-
static from(children,
|
|
308
|
+
static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {
|
|
323
309
|
let lines = 0;
|
|
324
310
|
for (let ch of children)
|
|
325
311
|
lines += ch.lines;
|
|
@@ -327,7 +313,7 @@ var TextNode = class extends Text {
|
|
|
327
313
|
let flat = [];
|
|
328
314
|
for (let ch of children)
|
|
329
315
|
ch.flatten(flat);
|
|
330
|
-
return new TextLeaf(flat,
|
|
316
|
+
return new TextLeaf(flat, length);
|
|
331
317
|
}
|
|
332
318
|
let chunk = Math.max(
|
|
333
319
|
32,
|
|
@@ -337,7 +323,7 @@ var TextNode = class extends Text {
|
|
|
337
323
|
let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];
|
|
338
324
|
function add(child) {
|
|
339
325
|
let last;
|
|
340
|
-
if (child.lines > maxChunk && child instanceof
|
|
326
|
+
if (child.lines > maxChunk && child instanceof _TextNode) {
|
|
341
327
|
for (let node of child.children)
|
|
342
328
|
add(node);
|
|
343
329
|
} else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {
|
|
@@ -358,22 +344,22 @@ var TextNode = class extends Text {
|
|
|
358
344
|
function flush() {
|
|
359
345
|
if (currentLines == 0)
|
|
360
346
|
return;
|
|
361
|
-
chunked.push(currentChunk.length == 1 ? currentChunk[0] :
|
|
347
|
+
chunked.push(currentChunk.length == 1 ? currentChunk[0] : _TextNode.from(currentChunk, currentLen));
|
|
362
348
|
currentLen = -1;
|
|
363
349
|
currentLines = currentChunk.length = 0;
|
|
364
350
|
}
|
|
365
351
|
for (let child of children)
|
|
366
352
|
add(child);
|
|
367
353
|
flush();
|
|
368
|
-
return chunked.length == 1 ? chunked[0] : new
|
|
354
|
+
return chunked.length == 1 ? chunked[0] : new _TextNode(chunked, length);
|
|
369
355
|
}
|
|
370
356
|
};
|
|
371
357
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
372
358
|
function textLength(text) {
|
|
373
|
-
let
|
|
359
|
+
let length = -1;
|
|
374
360
|
for (let line of text)
|
|
375
|
-
|
|
376
|
-
return
|
|
361
|
+
length += line.length + 1;
|
|
362
|
+
return length;
|
|
377
363
|
}
|
|
378
364
|
function appendText(text, target, from = 0, to = 1e9) {
|
|
379
365
|
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
@@ -635,7 +621,7 @@ var MapMode = /* @__PURE__ */ function(MapMode2) {
|
|
|
635
621
|
MapMode2[MapMode2["TrackAfter"] = 3] = "TrackAfter";
|
|
636
622
|
return MapMode2;
|
|
637
623
|
}(MapMode || (MapMode = {}));
|
|
638
|
-
var ChangeDesc = class {
|
|
624
|
+
var ChangeDesc = class _ChangeDesc {
|
|
639
625
|
// Sections are encoded as pairs of integers. The first is the
|
|
640
626
|
// length in the current document, and the second is -1 for
|
|
641
627
|
// unaffected sections, and the length of the replacement content
|
|
@@ -717,7 +703,7 @@ var ChangeDesc = class {
|
|
|
717
703
|
else
|
|
718
704
|
sections.push(ins, len);
|
|
719
705
|
}
|
|
720
|
-
return new
|
|
706
|
+
return new _ChangeDesc(sections);
|
|
721
707
|
}
|
|
722
708
|
/**
|
|
723
709
|
Compute the combined effect of applying another set of changes
|
|
@@ -795,16 +781,16 @@ var ChangeDesc = class {
|
|
|
795
781
|
static fromJSON(json) {
|
|
796
782
|
if (!Array.isArray(json) || json.length % 2 || json.some((a) => typeof a != "number"))
|
|
797
783
|
throw new RangeError("Invalid JSON representation of ChangeDesc");
|
|
798
|
-
return new
|
|
784
|
+
return new _ChangeDesc(json);
|
|
799
785
|
}
|
|
800
786
|
/**
|
|
801
787
|
@internal
|
|
802
788
|
*/
|
|
803
789
|
static create(sections) {
|
|
804
|
-
return new
|
|
790
|
+
return new _ChangeDesc(sections);
|
|
805
791
|
}
|
|
806
792
|
};
|
|
807
|
-
var ChangeSet = class extends ChangeDesc {
|
|
793
|
+
var ChangeSet = class _ChangeSet extends ChangeDesc {
|
|
808
794
|
constructor(sections, inserted) {
|
|
809
795
|
super(sections);
|
|
810
796
|
this.inserted = inserted;
|
|
@@ -842,7 +828,7 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
842
828
|
}
|
|
843
829
|
pos += len;
|
|
844
830
|
}
|
|
845
|
-
return new
|
|
831
|
+
return new _ChangeSet(sections, inserted);
|
|
846
832
|
}
|
|
847
833
|
/**
|
|
848
834
|
Combine two subsequent change sets into a single set. `other`
|
|
@@ -921,7 +907,7 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
921
907
|
}
|
|
922
908
|
}
|
|
923
909
|
return {
|
|
924
|
-
changes: new
|
|
910
|
+
changes: new _ChangeSet(resultSections, resultInserted),
|
|
925
911
|
filtered: ChangeDesc.create(filteredSections)
|
|
926
912
|
};
|
|
927
913
|
}
|
|
@@ -945,33 +931,33 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
945
931
|
Create a change set for the given changes, for a document of the
|
|
946
932
|
given length, using `lineSep` as line separator.
|
|
947
933
|
*/
|
|
948
|
-
static of(changes,
|
|
934
|
+
static of(changes, length, lineSep) {
|
|
949
935
|
let sections = [], inserted = [], pos = 0;
|
|
950
936
|
let total = null;
|
|
951
937
|
function flush(force = false) {
|
|
952
938
|
if (!force && !sections.length)
|
|
953
939
|
return;
|
|
954
|
-
if (pos <
|
|
955
|
-
addSection(sections,
|
|
956
|
-
let set = new
|
|
940
|
+
if (pos < length)
|
|
941
|
+
addSection(sections, length - pos, -1);
|
|
942
|
+
let set = new _ChangeSet(sections, inserted);
|
|
957
943
|
total = total ? total.compose(set.map(total)) : set;
|
|
958
944
|
sections = [];
|
|
959
945
|
inserted = [];
|
|
960
946
|
pos = 0;
|
|
961
947
|
}
|
|
962
|
-
function
|
|
948
|
+
function process(spec) {
|
|
963
949
|
if (Array.isArray(spec)) {
|
|
964
950
|
for (let sub of spec)
|
|
965
|
-
|
|
966
|
-
} else if (spec instanceof
|
|
967
|
-
if (spec.length !=
|
|
968
|
-
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${
|
|
951
|
+
process(sub);
|
|
952
|
+
} else if (spec instanceof _ChangeSet) {
|
|
953
|
+
if (spec.length != length)
|
|
954
|
+
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);
|
|
969
955
|
flush();
|
|
970
956
|
total = total ? total.compose(spec.map(total)) : spec;
|
|
971
957
|
} else {
|
|
972
958
|
let { from, to = from, insert: insert2 } = spec;
|
|
973
|
-
if (from > to || from < 0 || to >
|
|
974
|
-
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${
|
|
959
|
+
if (from > to || from < 0 || to > length)
|
|
960
|
+
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);
|
|
975
961
|
let insText = !insert2 ? Text.empty : typeof insert2 == "string" ? Text.of(insert2.split(lineSep || DefaultSplit)) : insert2;
|
|
976
962
|
let insLen = insText.length;
|
|
977
963
|
if (from == to && insLen == 0)
|
|
@@ -985,15 +971,15 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
985
971
|
pos = to;
|
|
986
972
|
}
|
|
987
973
|
}
|
|
988
|
-
|
|
974
|
+
process(changes);
|
|
989
975
|
flush(!total);
|
|
990
976
|
return total;
|
|
991
977
|
}
|
|
992
978
|
/**
|
|
993
979
|
Create an empty changeset of the given length.
|
|
994
980
|
*/
|
|
995
|
-
static empty(
|
|
996
|
-
return new
|
|
981
|
+
static empty(length) {
|
|
982
|
+
return new _ChangeSet(length ? [length, -1] : [], []);
|
|
997
983
|
}
|
|
998
984
|
/**
|
|
999
985
|
Create a changeset from its JSON representation (as produced by
|
|
@@ -1018,13 +1004,13 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
1018
1004
|
sections.push(part[0], inserted[i].length);
|
|
1019
1005
|
}
|
|
1020
1006
|
}
|
|
1021
|
-
return new
|
|
1007
|
+
return new _ChangeSet(sections, inserted);
|
|
1022
1008
|
}
|
|
1023
1009
|
/**
|
|
1024
1010
|
@internal
|
|
1025
1011
|
*/
|
|
1026
1012
|
static createSet(sections, inserted) {
|
|
1027
|
-
return new
|
|
1013
|
+
return new _ChangeSet(sections, inserted);
|
|
1028
1014
|
}
|
|
1029
1015
|
};
|
|
1030
1016
|
function addSection(sections, len, ins, forceJoin = false) {
|
|
@@ -1218,7 +1204,7 @@ var SectionIter = class {
|
|
|
1218
1204
|
}
|
|
1219
1205
|
}
|
|
1220
1206
|
};
|
|
1221
|
-
var SelectionRange = class {
|
|
1207
|
+
var SelectionRange = class _SelectionRange {
|
|
1222
1208
|
constructor(from, to, flags) {
|
|
1223
1209
|
this.from = from;
|
|
1224
1210
|
this.to = to;
|
|
@@ -1283,7 +1269,7 @@ var SelectionRange = class {
|
|
|
1283
1269
|
from = change.mapPos(this.from, 1);
|
|
1284
1270
|
to = change.mapPos(this.to, -1);
|
|
1285
1271
|
}
|
|
1286
|
-
return from == this.from && to == this.to ? this : new
|
|
1272
|
+
return from == this.from && to == this.to ? this : new _SelectionRange(from, to, this.flags);
|
|
1287
1273
|
}
|
|
1288
1274
|
/**
|
|
1289
1275
|
Extend this range to cover at least `from` to `to`.
|
|
@@ -1319,10 +1305,10 @@ var SelectionRange = class {
|
|
|
1319
1305
|
@internal
|
|
1320
1306
|
*/
|
|
1321
1307
|
static create(from, to, flags) {
|
|
1322
|
-
return new
|
|
1308
|
+
return new _SelectionRange(from, to, flags);
|
|
1323
1309
|
}
|
|
1324
1310
|
};
|
|
1325
|
-
var EditorSelection = class {
|
|
1311
|
+
var EditorSelection = class _EditorSelection {
|
|
1326
1312
|
constructor(ranges, mainIndex) {
|
|
1327
1313
|
this.ranges = ranges;
|
|
1328
1314
|
this.mainIndex = mainIndex;
|
|
@@ -1334,7 +1320,7 @@ var EditorSelection = class {
|
|
|
1334
1320
|
map(change, assoc = -1) {
|
|
1335
1321
|
if (change.empty)
|
|
1336
1322
|
return this;
|
|
1337
|
-
return
|
|
1323
|
+
return _EditorSelection.create(this.ranges.map((r) => r.map(change, assoc)), this.mainIndex);
|
|
1338
1324
|
}
|
|
1339
1325
|
/**
|
|
1340
1326
|
Compare this selection to another selection.
|
|
@@ -1360,13 +1346,13 @@ var EditorSelection = class {
|
|
|
1360
1346
|
holding only the main range from this selection.
|
|
1361
1347
|
*/
|
|
1362
1348
|
asSingle() {
|
|
1363
|
-
return this.ranges.length == 1 ? this : new
|
|
1349
|
+
return this.ranges.length == 1 ? this : new _EditorSelection([this.main], 0);
|
|
1364
1350
|
}
|
|
1365
1351
|
/**
|
|
1366
1352
|
Extend this selection with an extra range.
|
|
1367
1353
|
*/
|
|
1368
1354
|
addRange(range, main = true) {
|
|
1369
|
-
return
|
|
1355
|
+
return _EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);
|
|
1370
1356
|
}
|
|
1371
1357
|
/**
|
|
1372
1358
|
Replace a given range with another range, and then normalize the
|
|
@@ -1375,7 +1361,7 @@ var EditorSelection = class {
|
|
|
1375
1361
|
replaceRange(range, which = this.mainIndex) {
|
|
1376
1362
|
let ranges = this.ranges.slice();
|
|
1377
1363
|
ranges[which] = range;
|
|
1378
|
-
return
|
|
1364
|
+
return _EditorSelection.create(ranges, this.mainIndex);
|
|
1379
1365
|
}
|
|
1380
1366
|
/**
|
|
1381
1367
|
Convert this selection to an object that can be serialized to
|
|
@@ -1390,13 +1376,13 @@ var EditorSelection = class {
|
|
|
1390
1376
|
static fromJSON(json) {
|
|
1391
1377
|
if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length)
|
|
1392
1378
|
throw new RangeError("Invalid JSON representation for EditorSelection");
|
|
1393
|
-
return new
|
|
1379
|
+
return new _EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);
|
|
1394
1380
|
}
|
|
1395
1381
|
/**
|
|
1396
1382
|
Create a selection holding a single range.
|
|
1397
1383
|
*/
|
|
1398
1384
|
static single(anchor, head = anchor) {
|
|
1399
|
-
return new
|
|
1385
|
+
return new _EditorSelection([_EditorSelection.range(anchor, head)], 0);
|
|
1400
1386
|
}
|
|
1401
1387
|
/**
|
|
1402
1388
|
Sort and merge the given set of ranges, creating a valid
|
|
@@ -1408,10 +1394,10 @@ var EditorSelection = class {
|
|
|
1408
1394
|
for (let pos = 0, i = 0; i < ranges.length; i++) {
|
|
1409
1395
|
let range = ranges[i];
|
|
1410
1396
|
if (range.empty ? range.from <= pos : range.from < pos)
|
|
1411
|
-
return
|
|
1397
|
+
return _EditorSelection.normalized(ranges.slice(), mainIndex);
|
|
1412
1398
|
pos = range.to;
|
|
1413
1399
|
}
|
|
1414
|
-
return new
|
|
1400
|
+
return new _EditorSelection(ranges, mainIndex);
|
|
1415
1401
|
}
|
|
1416
1402
|
/**
|
|
1417
1403
|
Create a cursor selection range at the given position. You can
|
|
@@ -1440,10 +1426,10 @@ var EditorSelection = class {
|
|
|
1440
1426
|
let from = prev.from, to = Math.max(range.to, prev.to);
|
|
1441
1427
|
if (i <= mainIndex)
|
|
1442
1428
|
mainIndex--;
|
|
1443
|
-
ranges.splice(--i, 2, range.anchor > range.head ?
|
|
1429
|
+
ranges.splice(--i, 2, range.anchor > range.head ? _EditorSelection.range(to, from) : _EditorSelection.range(from, to));
|
|
1444
1430
|
}
|
|
1445
1431
|
}
|
|
1446
|
-
return new
|
|
1432
|
+
return new _EditorSelection(ranges, mainIndex);
|
|
1447
1433
|
}
|
|
1448
1434
|
};
|
|
1449
1435
|
function checkSelection(selection, docLength) {
|
|
@@ -1452,7 +1438,7 @@ function checkSelection(selection, docLength) {
|
|
|
1452
1438
|
throw new RangeError("Selection points outside of document");
|
|
1453
1439
|
}
|
|
1454
1440
|
var nextID = 0;
|
|
1455
|
-
var Facet = class {
|
|
1441
|
+
var Facet = class _Facet {
|
|
1456
1442
|
constructor(combine, compareInput, compare2, isStatic, enables) {
|
|
1457
1443
|
this.combine = combine;
|
|
1458
1444
|
this.compareInput = compareInput;
|
|
@@ -1466,7 +1452,7 @@ var Facet = class {
|
|
|
1466
1452
|
Define a new facet.
|
|
1467
1453
|
*/
|
|
1468
1454
|
static define(config2 = {}) {
|
|
1469
|
-
return new
|
|
1455
|
+
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);
|
|
1470
1456
|
}
|
|
1471
1457
|
/**
|
|
1472
1458
|
Returns an extension that adds the given value to this facet.
|
|
@@ -1628,7 +1614,7 @@ function dynamicFacetSlot(addresses, facet, providers) {
|
|
|
1628
1614
|
};
|
|
1629
1615
|
}
|
|
1630
1616
|
var initField = /* @__PURE__ */ Facet.define({ static: true });
|
|
1631
|
-
var StateField = class {
|
|
1617
|
+
var StateField = class _StateField {
|
|
1632
1618
|
constructor(id, createF, updateF, compareF, spec) {
|
|
1633
1619
|
this.id = id;
|
|
1634
1620
|
this.createF = createF;
|
|
@@ -1641,7 +1627,7 @@ var StateField = class {
|
|
|
1641
1627
|
Define a state field.
|
|
1642
1628
|
*/
|
|
1643
1629
|
static define(config2) {
|
|
1644
|
-
let field = new
|
|
1630
|
+
let field = new _StateField(nextID++, config2.create, config2.update, config2.compare || ((a, b) => a === b), config2);
|
|
1645
1631
|
if (config2.provide)
|
|
1646
1632
|
field.provides = config2.provide(field);
|
|
1647
1633
|
return field;
|
|
@@ -1731,7 +1717,7 @@ var PrecExtension = class {
|
|
|
1731
1717
|
this.prec = prec2;
|
|
1732
1718
|
}
|
|
1733
1719
|
};
|
|
1734
|
-
var Compartment = class {
|
|
1720
|
+
var Compartment = class _Compartment {
|
|
1735
1721
|
/**
|
|
1736
1722
|
Create an instance of this compartment to add to your [state
|
|
1737
1723
|
configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).
|
|
@@ -1744,7 +1730,7 @@ var Compartment = class {
|
|
|
1744
1730
|
reconfigures this compartment.
|
|
1745
1731
|
*/
|
|
1746
1732
|
reconfigure(content) {
|
|
1747
|
-
return
|
|
1733
|
+
return _Compartment.reconfigure.of({ compartment: this, extension: content });
|
|
1748
1734
|
}
|
|
1749
1735
|
/**
|
|
1750
1736
|
Get the current content of the compartment in the state, or
|
|
@@ -1760,7 +1746,7 @@ var CompartmentInstance = class {
|
|
|
1760
1746
|
this.inner = inner;
|
|
1761
1747
|
}
|
|
1762
1748
|
};
|
|
1763
|
-
var Configuration = class {
|
|
1749
|
+
var Configuration = class _Configuration {
|
|
1764
1750
|
constructor(base2, compartments, dynamicSlots, address, staticValues, facets) {
|
|
1765
1751
|
this.base = base2;
|
|
1766
1752
|
this.compartments = compartments;
|
|
@@ -1826,7 +1812,7 @@ var Configuration = class {
|
|
|
1826
1812
|
}
|
|
1827
1813
|
}
|
|
1828
1814
|
let dynamic = dynamicSlots.map((f) => f(address));
|
|
1829
|
-
return new
|
|
1815
|
+
return new _Configuration(base2, newCompartments, dynamic, address, staticValues, facets);
|
|
1830
1816
|
}
|
|
1831
1817
|
};
|
|
1832
1818
|
function flatten(extension, compartments, newCompartments) {
|
|
@@ -1942,7 +1928,7 @@ var StateEffectType = class {
|
|
|
1942
1928
|
return new StateEffect(this, value);
|
|
1943
1929
|
}
|
|
1944
1930
|
};
|
|
1945
|
-
var StateEffect = class {
|
|
1931
|
+
var StateEffect = class _StateEffect {
|
|
1946
1932
|
/**
|
|
1947
1933
|
@internal
|
|
1948
1934
|
*/
|
|
@@ -1956,7 +1942,7 @@ var StateEffect = class {
|
|
|
1956
1942
|
*/
|
|
1957
1943
|
map(mapping) {
|
|
1958
1944
|
let mapped = this.type.map(this.value, mapping);
|
|
1959
|
-
return mapped === void 0 ? void 0 : mapped == this.value ? this : new
|
|
1945
|
+
return mapped === void 0 ? void 0 : mapped == this.value ? this : new _StateEffect(this.type, mapped);
|
|
1960
1946
|
}
|
|
1961
1947
|
/**
|
|
1962
1948
|
Tells you whether this effect object is of a given
|
|
@@ -1992,7 +1978,7 @@ var StateEffect = class {
|
|
|
1992
1978
|
};
|
|
1993
1979
|
StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define();
|
|
1994
1980
|
StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define();
|
|
1995
|
-
var Transaction = class {
|
|
1981
|
+
var Transaction = class _Transaction {
|
|
1996
1982
|
constructor(startState, changes, selection, effects, annotations, scrollIntoView3) {
|
|
1997
1983
|
this.startState = startState;
|
|
1998
1984
|
this.changes = changes;
|
|
@@ -2004,14 +1990,14 @@ var Transaction = class {
|
|
|
2004
1990
|
this._state = null;
|
|
2005
1991
|
if (selection)
|
|
2006
1992
|
checkSelection(selection, changes.newLength);
|
|
2007
|
-
if (!annotations.some((a) => a.type ==
|
|
2008
|
-
this.annotations = annotations.concat(
|
|
1993
|
+
if (!annotations.some((a) => a.type == _Transaction.time))
|
|
1994
|
+
this.annotations = annotations.concat(_Transaction.time.of(Date.now()));
|
|
2009
1995
|
}
|
|
2010
1996
|
/**
|
|
2011
1997
|
@internal
|
|
2012
1998
|
*/
|
|
2013
1999
|
static create(startState, changes, selection, effects, annotations, scrollIntoView3) {
|
|
2014
|
-
return new
|
|
2000
|
+
return new _Transaction(startState, changes, selection, effects, annotations, scrollIntoView3);
|
|
2015
2001
|
}
|
|
2016
2002
|
/**
|
|
2017
2003
|
The new document produced by the transaction. Contrary to
|
|
@@ -2076,7 +2062,7 @@ var Transaction = class {
|
|
|
2076
2062
|
`"select.pointer"` will match it.
|
|
2077
2063
|
*/
|
|
2078
2064
|
isUserEvent(event) {
|
|
2079
|
-
let e = this.annotation(
|
|
2065
|
+
let e = this.annotation(_Transaction.userEvent);
|
|
2080
2066
|
return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == "."));
|
|
2081
2067
|
}
|
|
2082
2068
|
};
|
|
@@ -2230,7 +2216,7 @@ function makeCategorizer(wordChars) {
|
|
|
2230
2216
|
return CharCategory.Other;
|
|
2231
2217
|
};
|
|
2232
2218
|
}
|
|
2233
|
-
var EditorState = class {
|
|
2219
|
+
var EditorState = class _EditorState {
|
|
2234
2220
|
constructor(config2, doc2, selection, values, computeSlot, tr) {
|
|
2235
2221
|
this.config = config2;
|
|
2236
2222
|
this.doc = doc2;
|
|
@@ -2296,12 +2282,12 @@ var EditorState = class {
|
|
|
2296
2282
|
let startValues;
|
|
2297
2283
|
if (!conf) {
|
|
2298
2284
|
conf = Configuration.resolve(base2, compartments, this);
|
|
2299
|
-
let intermediateState = new
|
|
2285
|
+
let intermediateState = new _EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);
|
|
2300
2286
|
startValues = intermediateState.values;
|
|
2301
2287
|
} else {
|
|
2302
2288
|
startValues = tr.startState.values.slice();
|
|
2303
2289
|
}
|
|
2304
|
-
new
|
|
2290
|
+
new _EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr);
|
|
2305
2291
|
}
|
|
2306
2292
|
/**
|
|
2307
2293
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
@@ -2355,7 +2341,7 @@ var EditorState = class {
|
|
|
2355
2341
|
changes(spec = []) {
|
|
2356
2342
|
if (spec instanceof ChangeSet)
|
|
2357
2343
|
return spec;
|
|
2358
|
-
return ChangeSet.of(spec, this.doc.length, this.facet(
|
|
2344
|
+
return ChangeSet.of(spec, this.doc.length, this.facet(_EditorState.lineSeparator));
|
|
2359
2345
|
}
|
|
2360
2346
|
/**
|
|
2361
2347
|
Using the state's [line
|
|
@@ -2363,7 +2349,7 @@ var EditorState = class {
|
|
|
2363
2349
|
[`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.
|
|
2364
2350
|
*/
|
|
2365
2351
|
toText(string) {
|
|
2366
|
-
return Text.of(string.split(this.facet(
|
|
2352
|
+
return Text.of(string.split(this.facet(_EditorState.lineSeparator) || DefaultSplit));
|
|
2367
2353
|
}
|
|
2368
2354
|
/**
|
|
2369
2355
|
Return the given range of the document as a string.
|
|
@@ -2417,7 +2403,7 @@ var EditorState = class {
|
|
|
2417
2403
|
fieldInit.push(field.init((state) => field.spec.fromJSON(value, state)));
|
|
2418
2404
|
}
|
|
2419
2405
|
}
|
|
2420
|
-
return
|
|
2406
|
+
return _EditorState.create({
|
|
2421
2407
|
doc: json.doc,
|
|
2422
2408
|
selection: EditorSelection.fromJSON(json.selection),
|
|
2423
2409
|
extensions: config2.extensions ? fieldInit.concat([config2.extensions]) : fieldInit
|
|
@@ -2430,26 +2416,26 @@ var EditorState = class {
|
|
|
2430
2416
|
*/
|
|
2431
2417
|
static create(config2 = {}) {
|
|
2432
2418
|
let configuration = Configuration.resolve(config2.extensions || [], /* @__PURE__ */ new Map());
|
|
2433
|
-
let doc2 = config2.doc instanceof Text ? config2.doc : Text.of((config2.doc || "").split(configuration.staticFacet(
|
|
2419
|
+
let doc2 = config2.doc instanceof Text ? config2.doc : Text.of((config2.doc || "").split(configuration.staticFacet(_EditorState.lineSeparator) || DefaultSplit));
|
|
2434
2420
|
let selection = !config2.selection ? EditorSelection.single(0) : config2.selection instanceof EditorSelection ? config2.selection : EditorSelection.single(config2.selection.anchor, config2.selection.head);
|
|
2435
2421
|
checkSelection(selection, doc2.length);
|
|
2436
2422
|
if (!configuration.staticFacet(allowMultipleSelections))
|
|
2437
2423
|
selection = selection.asSingle();
|
|
2438
|
-
return new
|
|
2424
|
+
return new _EditorState(configuration, doc2, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);
|
|
2439
2425
|
}
|
|
2440
2426
|
/**
|
|
2441
2427
|
The size (in columns) of a tab in the document, determined by
|
|
2442
2428
|
the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.
|
|
2443
2429
|
*/
|
|
2444
2430
|
get tabSize() {
|
|
2445
|
-
return this.facet(
|
|
2431
|
+
return this.facet(_EditorState.tabSize);
|
|
2446
2432
|
}
|
|
2447
2433
|
/**
|
|
2448
2434
|
Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)
|
|
2449
2435
|
string for this state.
|
|
2450
2436
|
*/
|
|
2451
2437
|
get lineBreak() {
|
|
2452
|
-
return this.facet(
|
|
2438
|
+
return this.facet(_EditorState.lineSeparator) || "\n";
|
|
2453
2439
|
}
|
|
2454
2440
|
/**
|
|
2455
2441
|
Returns true when the editor is
|
|
@@ -2469,7 +2455,7 @@ var EditorState = class {
|
|
|
2469
2455
|
literal dollar sign.
|
|
2470
2456
|
*/
|
|
2471
2457
|
phrase(phrase, ...insert2) {
|
|
2472
|
-
for (let map of this.facet(
|
|
2458
|
+
for (let map of this.facet(_EditorState.phrases))
|
|
2473
2459
|
if (Object.prototype.hasOwnProperty.call(map, phrase)) {
|
|
2474
2460
|
phrase = map[phrase];
|
|
2475
2461
|
break;
|
|
@@ -2530,7 +2516,7 @@ var EditorState = class {
|
|
|
2530
2516
|
this returns null.
|
|
2531
2517
|
*/
|
|
2532
2518
|
wordAt(pos) {
|
|
2533
|
-
let { text, from, length
|
|
2519
|
+
let { text, from, length } = this.doc.lineAt(pos);
|
|
2534
2520
|
let cat = this.charCategorizer(pos);
|
|
2535
2521
|
let start = pos - from, end = pos - from;
|
|
2536
2522
|
while (start > 0) {
|
|
@@ -2539,7 +2525,7 @@ var EditorState = class {
|
|
|
2539
2525
|
break;
|
|
2540
2526
|
start = prev;
|
|
2541
2527
|
}
|
|
2542
|
-
while (end <
|
|
2528
|
+
while (end < length) {
|
|
2543
2529
|
let next = findClusterBreak(text, end);
|
|
2544
2530
|
if (cat(text.slice(end, next)) != CharCategory.Word)
|
|
2545
2531
|
break;
|
|
@@ -2605,7 +2591,7 @@ var RangeValue = class {
|
|
|
2605
2591
|
RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;
|
|
2606
2592
|
RangeValue.prototype.point = false;
|
|
2607
2593
|
RangeValue.prototype.mapMode = MapMode.TrackDel;
|
|
2608
|
-
var Range = class {
|
|
2594
|
+
var Range = class _Range {
|
|
2609
2595
|
constructor(from, to, value) {
|
|
2610
2596
|
this.from = from;
|
|
2611
2597
|
this.to = to;
|
|
@@ -2615,13 +2601,13 @@ var Range = class {
|
|
|
2615
2601
|
@internal
|
|
2616
2602
|
*/
|
|
2617
2603
|
static create(from, to, value) {
|
|
2618
|
-
return new
|
|
2604
|
+
return new _Range(from, to, value);
|
|
2619
2605
|
}
|
|
2620
2606
|
};
|
|
2621
2607
|
function cmpRange(a, b) {
|
|
2622
2608
|
return a.from - b.from || a.value.startSide - b.value.startSide;
|
|
2623
2609
|
}
|
|
2624
|
-
var Chunk = class {
|
|
2610
|
+
var Chunk = class _Chunk {
|
|
2625
2611
|
constructor(from, to, value, maxPoint) {
|
|
2626
2612
|
this.from = from;
|
|
2627
2613
|
this.to = to;
|
|
@@ -2683,10 +2669,10 @@ var Chunk = class {
|
|
|
2683
2669
|
from.push(newFrom - newPos);
|
|
2684
2670
|
to.push(newTo - newPos);
|
|
2685
2671
|
}
|
|
2686
|
-
return { mapped: value.length ? new
|
|
2672
|
+
return { mapped: value.length ? new _Chunk(from, to, value, maxPoint) : null, pos: newPos };
|
|
2687
2673
|
}
|
|
2688
2674
|
};
|
|
2689
|
-
var RangeSet = class {
|
|
2675
|
+
var RangeSet = class _RangeSet {
|
|
2690
2676
|
constructor(chunkPos, chunk, nextLayer, maxPoint) {
|
|
2691
2677
|
this.chunkPos = chunkPos;
|
|
2692
2678
|
this.chunk = chunk;
|
|
@@ -2697,7 +2683,7 @@ var RangeSet = class {
|
|
|
2697
2683
|
@internal
|
|
2698
2684
|
*/
|
|
2699
2685
|
static create(chunkPos, chunk, nextLayer, maxPoint) {
|
|
2700
|
-
return new
|
|
2686
|
+
return new _RangeSet(chunkPos, chunk, nextLayer, maxPoint);
|
|
2701
2687
|
}
|
|
2702
2688
|
/**
|
|
2703
2689
|
@internal
|
|
@@ -2740,7 +2726,7 @@ var RangeSet = class {
|
|
|
2740
2726
|
if (sort)
|
|
2741
2727
|
add = add.slice().sort(cmpRange);
|
|
2742
2728
|
if (this.isEmpty)
|
|
2743
|
-
return add.length ?
|
|
2729
|
+
return add.length ? _RangeSet.of(add) : this;
|
|
2744
2730
|
let cur2 = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];
|
|
2745
2731
|
let builder = new RangeSetBuilder();
|
|
2746
2732
|
while (cur2.value || i < add.length) {
|
|
@@ -2758,7 +2744,7 @@ var RangeSet = class {
|
|
|
2758
2744
|
cur2.next();
|
|
2759
2745
|
}
|
|
2760
2746
|
}
|
|
2761
|
-
return builder.finishInner(this.nextLayer.isEmpty && !spill.length ?
|
|
2747
|
+
return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? _RangeSet.empty : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));
|
|
2762
2748
|
}
|
|
2763
2749
|
/**
|
|
2764
2750
|
Map this range set through a set of changes, return the new set.
|
|
@@ -2784,7 +2770,7 @@ var RangeSet = class {
|
|
|
2784
2770
|
}
|
|
2785
2771
|
}
|
|
2786
2772
|
let next = this.nextLayer.map(changes);
|
|
2787
|
-
return chunks.length == 0 ? next : new
|
|
2773
|
+
return chunks.length == 0 ? next : new _RangeSet(chunkPos, chunks, next || _RangeSet.empty, maxPoint);
|
|
2788
2774
|
}
|
|
2789
2775
|
/**
|
|
2790
2776
|
Iterate over the ranges that touch the region `from` to `to`,
|
|
@@ -2832,7 +2818,7 @@ var RangeSet = class {
|
|
|
2832
2818
|
let sharedChunks = findSharedChunks(a, b, textDiff);
|
|
2833
2819
|
let sideA = new SpanCursor(a, sharedChunks, minPointSize);
|
|
2834
2820
|
let sideB = new SpanCursor(b, sharedChunks, minPointSize);
|
|
2835
|
-
textDiff.iterGaps((fromA, fromB,
|
|
2821
|
+
textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));
|
|
2836
2822
|
if (textDiff.empty && textDiff.length == 0)
|
|
2837
2823
|
compare(sideA, 0, sideB, 0, 0, comparator);
|
|
2838
2824
|
}
|
|
@@ -2913,7 +2899,7 @@ function lazySort(ranges) {
|
|
|
2913
2899
|
return ranges;
|
|
2914
2900
|
}
|
|
2915
2901
|
RangeSet.empty.nextLayer = RangeSet.empty;
|
|
2916
|
-
var RangeSetBuilder = class {
|
|
2902
|
+
var RangeSetBuilder = class _RangeSetBuilder {
|
|
2917
2903
|
finishChunk(newArrays) {
|
|
2918
2904
|
this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));
|
|
2919
2905
|
this.chunkPos.push(this.chunkStart);
|
|
@@ -2949,7 +2935,7 @@ var RangeSetBuilder = class {
|
|
|
2949
2935
|
*/
|
|
2950
2936
|
add(from, to, value) {
|
|
2951
2937
|
if (!this.addInner(from, to, value))
|
|
2952
|
-
(this.nextLayer || (this.nextLayer = new
|
|
2938
|
+
(this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).add(from, to, value);
|
|
2953
2939
|
}
|
|
2954
2940
|
/**
|
|
2955
2941
|
@internal
|
|
@@ -3102,7 +3088,7 @@ var LayerCursor = class {
|
|
|
3102
3088
|
return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank || this.to - other.to || this.endSide - other.endSide;
|
|
3103
3089
|
}
|
|
3104
3090
|
};
|
|
3105
|
-
var HeapCursor = class {
|
|
3091
|
+
var HeapCursor = class _HeapCursor {
|
|
3106
3092
|
constructor(heap) {
|
|
3107
3093
|
this.heap = heap;
|
|
3108
3094
|
}
|
|
@@ -3114,7 +3100,7 @@ var HeapCursor = class {
|
|
|
3114
3100
|
heap.push(new LayerCursor(cur2, skip, minPoint, i));
|
|
3115
3101
|
}
|
|
3116
3102
|
}
|
|
3117
|
-
return heap.length == 1 ? heap[0] : new
|
|
3103
|
+
return heap.length == 1 ? heap[0] : new _HeapCursor(heap);
|
|
3118
3104
|
}
|
|
3119
3105
|
get startSide() {
|
|
3120
3106
|
return this.value ? this.value.startSide : 0;
|
|
@@ -3284,10 +3270,10 @@ var SpanCursor = class {
|
|
|
3284
3270
|
return open;
|
|
3285
3271
|
}
|
|
3286
3272
|
};
|
|
3287
|
-
function compare(a, startA, b, startB,
|
|
3273
|
+
function compare(a, startA, b, startB, length, comparator) {
|
|
3288
3274
|
a.goto(startA);
|
|
3289
3275
|
b.goto(startB);
|
|
3290
|
-
let endB = startB +
|
|
3276
|
+
let endB = startB + length;
|
|
3291
3277
|
let pos = startB, dPos = startB - startA;
|
|
3292
3278
|
for (; ; ) {
|
|
3293
3279
|
let diff = a.to + dPos - b.to || a.endSide - b.endSide;
|
|
@@ -3896,21 +3882,21 @@ function atElementStart(doc2, selection) {
|
|
|
3896
3882
|
function isScrolledToBottom(elt) {
|
|
3897
3883
|
return elt.scrollTop > Math.max(1, elt.scrollHeight - elt.clientHeight - 4);
|
|
3898
3884
|
}
|
|
3899
|
-
var DOMPos = class {
|
|
3885
|
+
var DOMPos = class _DOMPos {
|
|
3900
3886
|
constructor(node, offset, precise = true) {
|
|
3901
3887
|
this.node = node;
|
|
3902
3888
|
this.offset = offset;
|
|
3903
3889
|
this.precise = precise;
|
|
3904
3890
|
}
|
|
3905
3891
|
static before(dom, precise) {
|
|
3906
|
-
return new
|
|
3892
|
+
return new _DOMPos(dom.parentNode, domIndex(dom), precise);
|
|
3907
3893
|
}
|
|
3908
3894
|
static after(dom, precise) {
|
|
3909
|
-
return new
|
|
3895
|
+
return new _DOMPos(dom.parentNode, domIndex(dom) + 1, precise);
|
|
3910
3896
|
}
|
|
3911
3897
|
};
|
|
3912
3898
|
var noChildren = [];
|
|
3913
|
-
var ContentView = class {
|
|
3899
|
+
var ContentView = class _ContentView {
|
|
3914
3900
|
constructor() {
|
|
3915
3901
|
this.parent = null;
|
|
3916
3902
|
this.dom = null;
|
|
@@ -3944,7 +3930,7 @@ var ContentView = class {
|
|
|
3944
3930
|
for (let child of this.children) {
|
|
3945
3931
|
if (child.flags & 7) {
|
|
3946
3932
|
if (!child.dom && (next = prev ? prev.nextSibling : parent.firstChild)) {
|
|
3947
|
-
let contentView =
|
|
3933
|
+
let contentView = _ContentView.get(next);
|
|
3948
3934
|
if (!contentView || !contentView.parent && contentView.canReuseDOM(child))
|
|
3949
3935
|
child.reuseDOM(next);
|
|
3950
3936
|
}
|
|
@@ -4002,7 +3988,7 @@ var ContentView = class {
|
|
|
4002
3988
|
}
|
|
4003
3989
|
if (after == this.dom.firstChild)
|
|
4004
3990
|
return 0;
|
|
4005
|
-
while (after && !
|
|
3991
|
+
while (after && !_ContentView.get(after))
|
|
4006
3992
|
after = after.nextSibling;
|
|
4007
3993
|
if (!after)
|
|
4008
3994
|
return this.length;
|
|
@@ -4353,7 +4339,7 @@ var browser = {
|
|
|
4353
4339
|
tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"
|
|
4354
4340
|
};
|
|
4355
4341
|
var MaxJoinLen = 256;
|
|
4356
|
-
var TextView = class extends ContentView {
|
|
4342
|
+
var TextView = class _TextView extends ContentView {
|
|
4357
4343
|
constructor(text) {
|
|
4358
4344
|
super();
|
|
4359
4345
|
this.text = text;
|
|
@@ -4378,14 +4364,14 @@ var TextView = class extends ContentView {
|
|
|
4378
4364
|
this.createDOM(dom);
|
|
4379
4365
|
}
|
|
4380
4366
|
merge(from, to, source) {
|
|
4381
|
-
if (this.flags & 8 || source && (!(source instanceof
|
|
4367
|
+
if (this.flags & 8 || source && (!(source instanceof _TextView) || this.length - (to - from) + source.length > MaxJoinLen || source.flags & 8))
|
|
4382
4368
|
return false;
|
|
4383
4369
|
this.text = this.text.slice(0, from) + (source ? source.text : "") + this.text.slice(to);
|
|
4384
4370
|
this.markDirty();
|
|
4385
4371
|
return true;
|
|
4386
4372
|
}
|
|
4387
4373
|
split(from) {
|
|
4388
|
-
let result = new
|
|
4374
|
+
let result = new _TextView(this.text.slice(from));
|
|
4389
4375
|
this.text = this.text.slice(0, from);
|
|
4390
4376
|
this.markDirty();
|
|
4391
4377
|
result.flags |= this.flags & 8;
|
|
@@ -4404,12 +4390,12 @@ var TextView = class extends ContentView {
|
|
|
4404
4390
|
return textCoords(this.dom, pos, side);
|
|
4405
4391
|
}
|
|
4406
4392
|
};
|
|
4407
|
-
var MarkView = class extends ContentView {
|
|
4408
|
-
constructor(mark, children = [],
|
|
4393
|
+
var MarkView = class _MarkView extends ContentView {
|
|
4394
|
+
constructor(mark, children = [], length = 0) {
|
|
4409
4395
|
super();
|
|
4410
4396
|
this.mark = mark;
|
|
4411
4397
|
this.children = children;
|
|
4412
|
-
this.length =
|
|
4398
|
+
this.length = length;
|
|
4413
4399
|
for (let ch of children)
|
|
4414
4400
|
ch.setParent(this);
|
|
4415
4401
|
}
|
|
@@ -4439,7 +4425,7 @@ var MarkView = class extends ContentView {
|
|
|
4439
4425
|
super.sync(view, track);
|
|
4440
4426
|
}
|
|
4441
4427
|
merge(from, to, source, _hasStart, openStart, openEnd) {
|
|
4442
|
-
if (source && (!(source instanceof
|
|
4428
|
+
if (source && (!(source instanceof _MarkView && source.mark.eq(this.mark)) || from && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
4443
4429
|
return false;
|
|
4444
4430
|
mergeChildrenInto(this, from, to, source ? source.children : [], openStart - 1, openEnd - 1);
|
|
4445
4431
|
this.markDirty();
|
|
@@ -4456,13 +4442,13 @@ var MarkView = class extends ContentView {
|
|
|
4456
4442
|
off = end;
|
|
4457
4443
|
i++;
|
|
4458
4444
|
}
|
|
4459
|
-
let
|
|
4445
|
+
let length = this.length - from;
|
|
4460
4446
|
this.length = from;
|
|
4461
4447
|
if (detachFrom > -1) {
|
|
4462
4448
|
this.children.length = detachFrom;
|
|
4463
4449
|
this.markDirty();
|
|
4464
4450
|
}
|
|
4465
|
-
return new
|
|
4451
|
+
return new _MarkView(this.mark, result, length);
|
|
4466
4452
|
}
|
|
4467
4453
|
domAtPos(pos) {
|
|
4468
4454
|
return inlineDOMAtPos(this, pos);
|
|
@@ -4472,16 +4458,16 @@ var MarkView = class extends ContentView {
|
|
|
4472
4458
|
}
|
|
4473
4459
|
};
|
|
4474
4460
|
function textCoords(text, pos, side) {
|
|
4475
|
-
let
|
|
4476
|
-
if (pos >
|
|
4477
|
-
pos =
|
|
4461
|
+
let length = text.nodeValue.length;
|
|
4462
|
+
if (pos > length)
|
|
4463
|
+
pos = length;
|
|
4478
4464
|
let from = pos, to = pos, flatten2 = 0;
|
|
4479
|
-
if (pos == 0 && side < 0 || pos ==
|
|
4465
|
+
if (pos == 0 && side < 0 || pos == length && side >= 0) {
|
|
4480
4466
|
if (!(browser.chrome || browser.gecko)) {
|
|
4481
4467
|
if (pos) {
|
|
4482
4468
|
from--;
|
|
4483
4469
|
flatten2 = 1;
|
|
4484
|
-
} else if (to <
|
|
4470
|
+
} else if (to < length) {
|
|
4485
4471
|
to++;
|
|
4486
4472
|
flatten2 = -1;
|
|
4487
4473
|
}
|
|
@@ -4489,7 +4475,7 @@ function textCoords(text, pos, side) {
|
|
|
4489
4475
|
} else {
|
|
4490
4476
|
if (side < 0)
|
|
4491
4477
|
from--;
|
|
4492
|
-
else if (to <
|
|
4478
|
+
else if (to < length)
|
|
4493
4479
|
to++;
|
|
4494
4480
|
}
|
|
4495
4481
|
let rects = textRange(text, from, to).getClientRects();
|
|
@@ -4500,19 +4486,19 @@ function textCoords(text, pos, side) {
|
|
|
4500
4486
|
rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
|
|
4501
4487
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
4502
4488
|
}
|
|
4503
|
-
var WidgetView = class extends ContentView {
|
|
4504
|
-
constructor(widget,
|
|
4489
|
+
var WidgetView = class _WidgetView extends ContentView {
|
|
4490
|
+
constructor(widget, length, side) {
|
|
4505
4491
|
super();
|
|
4506
4492
|
this.widget = widget;
|
|
4507
|
-
this.length =
|
|
4493
|
+
this.length = length;
|
|
4508
4494
|
this.side = side;
|
|
4509
4495
|
this.prevWidget = null;
|
|
4510
4496
|
}
|
|
4511
|
-
static create(widget,
|
|
4512
|
-
return new
|
|
4497
|
+
static create(widget, length, side) {
|
|
4498
|
+
return new _WidgetView(widget, length, side);
|
|
4513
4499
|
}
|
|
4514
4500
|
split(from) {
|
|
4515
|
-
let result =
|
|
4501
|
+
let result = _WidgetView.create(this.widget, this.length - from, this.side);
|
|
4516
4502
|
this.length -= from;
|
|
4517
4503
|
return result;
|
|
4518
4504
|
}
|
|
@@ -4529,13 +4515,13 @@ var WidgetView = class extends ContentView {
|
|
|
4529
4515
|
return this.side;
|
|
4530
4516
|
}
|
|
4531
4517
|
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
4532
|
-
if (source && (!(source instanceof
|
|
4518
|
+
if (source && (!(source instanceof _WidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
4533
4519
|
return false;
|
|
4534
4520
|
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
4535
4521
|
return true;
|
|
4536
4522
|
}
|
|
4537
4523
|
become(other) {
|
|
4538
|
-
if (other instanceof
|
|
4524
|
+
if (other instanceof _WidgetView && other.side == this.side && this.widget.constructor == other.widget.constructor) {
|
|
4539
4525
|
if (!this.widget.compare(other.widget))
|
|
4540
4526
|
this.markDirty(true);
|
|
4541
4527
|
if (this.dom && !this.prevWidget)
|
|
@@ -4597,7 +4583,7 @@ var WidgetView = class extends ContentView {
|
|
|
4597
4583
|
this.widget.destroy(this.dom);
|
|
4598
4584
|
}
|
|
4599
4585
|
};
|
|
4600
|
-
var WidgetBufferView = class extends ContentView {
|
|
4586
|
+
var WidgetBufferView = class _WidgetBufferView extends ContentView {
|
|
4601
4587
|
constructor(side) {
|
|
4602
4588
|
super();
|
|
4603
4589
|
this.side = side;
|
|
@@ -4609,10 +4595,10 @@ var WidgetBufferView = class extends ContentView {
|
|
|
4609
4595
|
return false;
|
|
4610
4596
|
}
|
|
4611
4597
|
become(other) {
|
|
4612
|
-
return other instanceof
|
|
4598
|
+
return other instanceof _WidgetBufferView && other.side == this.side;
|
|
4613
4599
|
}
|
|
4614
4600
|
split() {
|
|
4615
|
-
return new
|
|
4601
|
+
return new _WidgetBufferView(this.side);
|
|
4616
4602
|
}
|
|
4617
4603
|
sync() {
|
|
4618
4604
|
if (!this.dom) {
|
|
@@ -4920,7 +4906,7 @@ var Decoration = class extends RangeValue {
|
|
|
4920
4906
|
}
|
|
4921
4907
|
};
|
|
4922
4908
|
Decoration.none = RangeSet.empty;
|
|
4923
|
-
var MarkDecoration = class extends Decoration {
|
|
4909
|
+
var MarkDecoration = class _MarkDecoration extends Decoration {
|
|
4924
4910
|
constructor(spec) {
|
|
4925
4911
|
let { start, end } = getInclusive(spec);
|
|
4926
4912
|
super(start ? -1 : 5e8, end ? 1 : -6e8, null, spec);
|
|
@@ -4930,7 +4916,7 @@ var MarkDecoration = class extends Decoration {
|
|
|
4930
4916
|
}
|
|
4931
4917
|
eq(other) {
|
|
4932
4918
|
var _a2, _b;
|
|
4933
|
-
return this == other || other instanceof
|
|
4919
|
+
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");
|
|
4934
4920
|
}
|
|
4935
4921
|
range(from, to = from) {
|
|
4936
4922
|
if (from >= to)
|
|
@@ -4939,12 +4925,12 @@ var MarkDecoration = class extends Decoration {
|
|
|
4939
4925
|
}
|
|
4940
4926
|
};
|
|
4941
4927
|
MarkDecoration.prototype.point = false;
|
|
4942
|
-
var LineDecoration = class extends Decoration {
|
|
4928
|
+
var LineDecoration = class _LineDecoration extends Decoration {
|
|
4943
4929
|
constructor(spec) {
|
|
4944
4930
|
super(-2e8, -2e8, null, spec);
|
|
4945
4931
|
}
|
|
4946
4932
|
eq(other) {
|
|
4947
|
-
return other instanceof
|
|
4933
|
+
return other instanceof _LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
4948
4934
|
}
|
|
4949
4935
|
range(from, to = from) {
|
|
4950
4936
|
if (to != from)
|
|
@@ -4954,7 +4940,7 @@ var LineDecoration = class extends Decoration {
|
|
|
4954
4940
|
};
|
|
4955
4941
|
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
|
|
4956
4942
|
LineDecoration.prototype.point = true;
|
|
4957
|
-
var PointDecoration = class extends Decoration {
|
|
4943
|
+
var PointDecoration = class _PointDecoration extends Decoration {
|
|
4958
4944
|
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
4959
4945
|
super(startSide, endSide, widget, spec);
|
|
4960
4946
|
this.block = block;
|
|
@@ -4969,7 +4955,7 @@ var PointDecoration = class extends Decoration {
|
|
|
4969
4955
|
return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
|
|
4970
4956
|
}
|
|
4971
4957
|
eq(other) {
|
|
4972
|
-
return other instanceof
|
|
4958
|
+
return other instanceof _PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide;
|
|
4973
4959
|
}
|
|
4974
4960
|
range(from, to = from) {
|
|
4975
4961
|
if (this.isReplace && (from > to || from == to && this.startSide > 0 && this.endSide <= 0))
|
|
@@ -4998,7 +4984,7 @@ function addRange(from, to, ranges, margin = 0) {
|
|
|
4998
4984
|
else
|
|
4999
4985
|
ranges.push(from, to);
|
|
5000
4986
|
}
|
|
5001
|
-
var LineView = class extends ContentView {
|
|
4987
|
+
var LineView = class _LineView extends ContentView {
|
|
5002
4988
|
constructor() {
|
|
5003
4989
|
super(...arguments);
|
|
5004
4990
|
this.children = [];
|
|
@@ -5010,7 +4996,7 @@ var LineView = class extends ContentView {
|
|
|
5010
4996
|
// Consumes source
|
|
5011
4997
|
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
5012
4998
|
if (source) {
|
|
5013
|
-
if (!(source instanceof
|
|
4999
|
+
if (!(source instanceof _LineView))
|
|
5014
5000
|
return false;
|
|
5015
5001
|
if (!this.dom)
|
|
5016
5002
|
source.transferDOM(this);
|
|
@@ -5021,7 +5007,7 @@ var LineView = class extends ContentView {
|
|
|
5021
5007
|
return true;
|
|
5022
5008
|
}
|
|
5023
5009
|
split(at) {
|
|
5024
|
-
let end = new
|
|
5010
|
+
let end = new _LineView();
|
|
5025
5011
|
end.breakAfter = this.breakAfter;
|
|
5026
5012
|
if (this.length == 0)
|
|
5027
5013
|
return end;
|
|
@@ -5144,7 +5130,7 @@ var LineView = class extends ContentView {
|
|
|
5144
5130
|
for (let i = 0, off = 0; i < docView.children.length; i++) {
|
|
5145
5131
|
let block = docView.children[i], end = off + block.length;
|
|
5146
5132
|
if (end >= pos) {
|
|
5147
|
-
if (block instanceof
|
|
5133
|
+
if (block instanceof _LineView)
|
|
5148
5134
|
return block;
|
|
5149
5135
|
if (end > pos)
|
|
5150
5136
|
break;
|
|
@@ -5154,17 +5140,17 @@ var LineView = class extends ContentView {
|
|
|
5154
5140
|
return null;
|
|
5155
5141
|
}
|
|
5156
5142
|
};
|
|
5157
|
-
var BlockWidgetView = class extends ContentView {
|
|
5158
|
-
constructor(widget,
|
|
5143
|
+
var BlockWidgetView = class _BlockWidgetView extends ContentView {
|
|
5144
|
+
constructor(widget, length, type) {
|
|
5159
5145
|
super();
|
|
5160
5146
|
this.widget = widget;
|
|
5161
|
-
this.length =
|
|
5147
|
+
this.length = length;
|
|
5162
5148
|
this.type = type;
|
|
5163
5149
|
this.breakAfter = 0;
|
|
5164
5150
|
this.prevWidget = null;
|
|
5165
5151
|
}
|
|
5166
5152
|
merge(from, to, source, _takeDeco, openStart, openEnd) {
|
|
5167
|
-
if (source && (!(source instanceof
|
|
5153
|
+
if (source && (!(source instanceof _BlockWidgetView) || !this.widget.compare(source.widget) || from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
5168
5154
|
return false;
|
|
5169
5155
|
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
5170
5156
|
return true;
|
|
@@ -5175,7 +5161,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5175
5161
|
split(at) {
|
|
5176
5162
|
let len = this.length - at;
|
|
5177
5163
|
this.length = at;
|
|
5178
|
-
let end = new
|
|
5164
|
+
let end = new _BlockWidgetView(this.widget, len, this.type);
|
|
5179
5165
|
end.breakAfter = this.breakAfter;
|
|
5180
5166
|
return end;
|
|
5181
5167
|
}
|
|
@@ -5198,7 +5184,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5198
5184
|
return null;
|
|
5199
5185
|
}
|
|
5200
5186
|
become(other) {
|
|
5201
|
-
if (other instanceof
|
|
5187
|
+
if (other instanceof _BlockWidgetView && other.widget.constructor == this.widget.constructor) {
|
|
5202
5188
|
if (!other.widget.compare(this.widget))
|
|
5203
5189
|
this.markDirty(true);
|
|
5204
5190
|
if (this.dom && !this.prevWidget)
|
|
@@ -5232,7 +5218,7 @@ var BlockWidgetView = class extends ContentView {
|
|
|
5232
5218
|
this.widget.destroy(this.dom);
|
|
5233
5219
|
}
|
|
5234
5220
|
};
|
|
5235
|
-
var ContentBuilder = class {
|
|
5221
|
+
var ContentBuilder = class _ContentBuilder {
|
|
5236
5222
|
constructor(doc2, pos, end, disallowBlockEffectsFor) {
|
|
5237
5223
|
this.doc = doc2;
|
|
5238
5224
|
this.pos = pos;
|
|
@@ -5283,8 +5269,8 @@ var ContentBuilder = class {
|
|
|
5283
5269
|
if (!this.posCovered())
|
|
5284
5270
|
this.getLine();
|
|
5285
5271
|
}
|
|
5286
|
-
buildText(
|
|
5287
|
-
while (
|
|
5272
|
+
buildText(length, active, openStart) {
|
|
5273
|
+
while (length > 0) {
|
|
5288
5274
|
if (this.textOff == this.text.length) {
|
|
5289
5275
|
let { value, lineBreak, done } = this.cursor.next(this.skip);
|
|
5290
5276
|
this.skip = 0;
|
|
@@ -5300,7 +5286,7 @@ var ContentBuilder = class {
|
|
|
5300
5286
|
this.flushBuffer();
|
|
5301
5287
|
this.curLine = null;
|
|
5302
5288
|
this.atCursorPos = true;
|
|
5303
|
-
|
|
5289
|
+
length--;
|
|
5304
5290
|
continue;
|
|
5305
5291
|
} else {
|
|
5306
5292
|
this.text = value;
|
|
@@ -5309,7 +5295,7 @@ var ContentBuilder = class {
|
|
|
5309
5295
|
}
|
|
5310
5296
|
let take = Math.min(
|
|
5311
5297
|
this.text.length - this.textOff,
|
|
5312
|
-
|
|
5298
|
+
length,
|
|
5313
5299
|
512
|
|
5314
5300
|
/* Chunk */
|
|
5315
5301
|
);
|
|
@@ -5317,7 +5303,7 @@ var ContentBuilder = class {
|
|
|
5317
5303
|
this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);
|
|
5318
5304
|
this.atCursorPos = true;
|
|
5319
5305
|
this.textOff += take;
|
|
5320
|
-
|
|
5306
|
+
length -= take;
|
|
5321
5307
|
openStart = 0;
|
|
5322
5308
|
}
|
|
5323
5309
|
}
|
|
@@ -5376,7 +5362,7 @@ var ContentBuilder = class {
|
|
|
5376
5362
|
this.openStart = openStart;
|
|
5377
5363
|
}
|
|
5378
5364
|
static build(text, from, to, decorations2, dynamicDecorationMap) {
|
|
5379
|
-
let builder = new
|
|
5365
|
+
let builder = new _ContentBuilder(text, from, to, dynamicDecorationMap);
|
|
5380
5366
|
builder.openEnd = RangeSet.spans(decorations2, from, to, builder);
|
|
5381
5367
|
if (builder.openStart < 0)
|
|
5382
5368
|
builder.openStart = builder.openEnd;
|
|
@@ -5420,7 +5406,7 @@ var perLineTextDirection = /* @__PURE__ */ Facet.define({
|
|
|
5420
5406
|
var nativeSelectionHidden = /* @__PURE__ */ Facet.define({
|
|
5421
5407
|
combine: (values) => values.some((x) => x)
|
|
5422
5408
|
});
|
|
5423
|
-
var ScrollTarget = class {
|
|
5409
|
+
var ScrollTarget = class _ScrollTarget {
|
|
5424
5410
|
constructor(range, y = "nearest", x = "nearest", yMargin = 5, xMargin = 5) {
|
|
5425
5411
|
this.range = range;
|
|
5426
5412
|
this.y = y;
|
|
@@ -5429,7 +5415,7 @@ var ScrollTarget = class {
|
|
|
5429
5415
|
this.xMargin = xMargin;
|
|
5430
5416
|
}
|
|
5431
5417
|
map(changes) {
|
|
5432
|
-
return changes.empty ? this : new
|
|
5418
|
+
return changes.empty ? this : new _ScrollTarget(this.range.map(changes), this.y, this.x, this.yMargin, this.xMargin);
|
|
5433
5419
|
}
|
|
5434
5420
|
};
|
|
5435
5421
|
var scrollIntoView = /* @__PURE__ */ StateEffect.define({ map: (t, ch) => t.map(ch) });
|
|
@@ -5447,7 +5433,7 @@ function logException(state, exception, context) {
|
|
|
5447
5433
|
var editable = /* @__PURE__ */ Facet.define({ combine: (values) => values.length ? values[0] : true });
|
|
5448
5434
|
var nextPluginID = 0;
|
|
5449
5435
|
var viewPlugin = /* @__PURE__ */ Facet.define();
|
|
5450
|
-
var ViewPlugin = class {
|
|
5436
|
+
var ViewPlugin = class _ViewPlugin {
|
|
5451
5437
|
constructor(id, create, domEventHandlers, buildExtensions) {
|
|
5452
5438
|
this.id = id;
|
|
5453
5439
|
this.create = create;
|
|
@@ -5460,7 +5446,7 @@ var ViewPlugin = class {
|
|
|
5460
5446
|
*/
|
|
5461
5447
|
static define(create, spec) {
|
|
5462
5448
|
const { eventHandlers, provide, decorations: deco } = spec || {};
|
|
5463
|
-
return new
|
|
5449
|
+
return new _ViewPlugin(nextPluginID++, create, eventHandlers, (plugin) => {
|
|
5464
5450
|
let ext = [viewPlugin.of(plugin)];
|
|
5465
5451
|
if (deco)
|
|
5466
5452
|
ext.push(decorations.of((view) => {
|
|
@@ -5477,7 +5463,7 @@ var ViewPlugin = class {
|
|
|
5477
5463
|
editor view as argument.
|
|
5478
5464
|
*/
|
|
5479
5465
|
static fromClass(cls, spec) {
|
|
5480
|
-
return
|
|
5466
|
+
return _ViewPlugin.define((view) => new cls(view), spec);
|
|
5481
5467
|
}
|
|
5482
5468
|
};
|
|
5483
5469
|
var PluginInstance = class {
|
|
@@ -5552,7 +5538,7 @@ function getScrollMargins(view) {
|
|
|
5552
5538
|
return { left, right, top: top2, bottom };
|
|
5553
5539
|
}
|
|
5554
5540
|
var styleModule = /* @__PURE__ */ Facet.define();
|
|
5555
|
-
var ChangedRange = class {
|
|
5541
|
+
var ChangedRange = class _ChangedRange {
|
|
5556
5542
|
constructor(fromA, toA, fromB, toB) {
|
|
5557
5543
|
this.fromA = fromA;
|
|
5558
5544
|
this.toA = toA;
|
|
@@ -5560,7 +5546,7 @@ var ChangedRange = class {
|
|
|
5560
5546
|
this.toB = toB;
|
|
5561
5547
|
}
|
|
5562
5548
|
join(other) {
|
|
5563
|
-
return new
|
|
5549
|
+
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));
|
|
5564
5550
|
}
|
|
5565
5551
|
addToSet(set) {
|
|
5566
5552
|
let i = set.length, me = this;
|
|
@@ -5587,7 +5573,7 @@ var ChangedRange = class {
|
|
|
5587
5573
|
let from = ranges[rI], to = ranges[rI + 1];
|
|
5588
5574
|
let fromB = Math.max(posB, from), toB = Math.min(end, to);
|
|
5589
5575
|
if (fromB <= toB)
|
|
5590
|
-
new
|
|
5576
|
+
new _ChangedRange(fromB + off, toB + off, fromB, toB).addToSet(result);
|
|
5591
5577
|
if (to > end)
|
|
5592
5578
|
break;
|
|
5593
5579
|
else
|
|
@@ -5595,13 +5581,13 @@ var ChangedRange = class {
|
|
|
5595
5581
|
}
|
|
5596
5582
|
if (!next)
|
|
5597
5583
|
return result;
|
|
5598
|
-
new
|
|
5584
|
+
new _ChangedRange(next.fromA, next.toA, next.fromB, next.toB).addToSet(result);
|
|
5599
5585
|
posA = next.toA;
|
|
5600
5586
|
posB = next.toB;
|
|
5601
5587
|
}
|
|
5602
5588
|
}
|
|
5603
5589
|
};
|
|
5604
|
-
var ViewUpdate = class {
|
|
5590
|
+
var ViewUpdate = class _ViewUpdate {
|
|
5605
5591
|
constructor(view, state, transactions) {
|
|
5606
5592
|
this.view = view;
|
|
5607
5593
|
this.state = state;
|
|
@@ -5619,7 +5605,7 @@ var ViewUpdate = class {
|
|
|
5619
5605
|
@internal
|
|
5620
5606
|
*/
|
|
5621
5607
|
static create(view, state, transactions) {
|
|
5622
|
-
return new
|
|
5608
|
+
return new _ViewUpdate(view, state, transactions);
|
|
5623
5609
|
}
|
|
5624
5610
|
/**
|
|
5625
5611
|
Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or
|
|
@@ -5849,8 +5835,8 @@ function computeOrder(line, direction) {
|
|
|
5849
5835
|
}
|
|
5850
5836
|
return order;
|
|
5851
5837
|
}
|
|
5852
|
-
function trivialOrder(
|
|
5853
|
-
return [new BidiSpan(0,
|
|
5838
|
+
function trivialOrder(length) {
|
|
5839
|
+
return [new BidiSpan(0, length, 0)];
|
|
5854
5840
|
}
|
|
5855
5841
|
var movedOver = "";
|
|
5856
5842
|
function moveVisually(line, order, dir, start, forward) {
|
|
@@ -7522,10 +7508,10 @@ var HeightOracle = class {
|
|
|
7522
7508
|
lines += Math.max(0, Math.ceil((to - from - lines * this.lineLength * 0.5) / this.lineLength));
|
|
7523
7509
|
return this.lineHeight * lines;
|
|
7524
7510
|
}
|
|
7525
|
-
heightForLine(
|
|
7511
|
+
heightForLine(length) {
|
|
7526
7512
|
if (!this.lineWrapping)
|
|
7527
7513
|
return this.lineHeight;
|
|
7528
|
-
let lines = 1 + Math.max(0, Math.ceil((
|
|
7514
|
+
let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5)));
|
|
7529
7515
|
return lines * this.lineHeight;
|
|
7530
7516
|
}
|
|
7531
7517
|
setDoc(doc2) {
|
|
@@ -7579,13 +7565,13 @@ var MeasuredHeights = class {
|
|
|
7579
7565
|
return this.index < this.heights.length;
|
|
7580
7566
|
}
|
|
7581
7567
|
};
|
|
7582
|
-
var BlockInfo = class {
|
|
7568
|
+
var BlockInfo = class _BlockInfo {
|
|
7583
7569
|
/**
|
|
7584
7570
|
@internal
|
|
7585
7571
|
*/
|
|
7586
|
-
constructor(from,
|
|
7572
|
+
constructor(from, length, top2, height, _content) {
|
|
7587
7573
|
this.from = from;
|
|
7588
|
-
this.length =
|
|
7574
|
+
this.length = length;
|
|
7589
7575
|
this.top = top2;
|
|
7590
7576
|
this.height = height;
|
|
7591
7577
|
this._content = _content;
|
|
@@ -7628,7 +7614,7 @@ var BlockInfo = class {
|
|
|
7628
7614
|
*/
|
|
7629
7615
|
join(other) {
|
|
7630
7616
|
let content = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(other._content) ? other._content : [other]);
|
|
7631
|
-
return new
|
|
7617
|
+
return new _BlockInfo(this.from, this.length + other.length, this.top, this.height + other.height, content);
|
|
7632
7618
|
}
|
|
7633
7619
|
};
|
|
7634
7620
|
var QueryType = /* @__PURE__ */ function(QueryType2) {
|
|
@@ -7638,9 +7624,9 @@ var QueryType = /* @__PURE__ */ function(QueryType2) {
|
|
|
7638
7624
|
return QueryType2;
|
|
7639
7625
|
}(QueryType || (QueryType = {}));
|
|
7640
7626
|
var Epsilon = 1e-3;
|
|
7641
|
-
var HeightMap = class {
|
|
7642
|
-
constructor(
|
|
7643
|
-
this.length =
|
|
7627
|
+
var HeightMap = class _HeightMap {
|
|
7628
|
+
constructor(length, height, flags = 2) {
|
|
7629
|
+
this.length = length;
|
|
7644
7630
|
this.height = height;
|
|
7645
7631
|
this.flags = flags;
|
|
7646
7632
|
}
|
|
@@ -7661,7 +7647,7 @@ var HeightMap = class {
|
|
|
7661
7647
|
// from the new nodes and returns that (HeightMapBranch and
|
|
7662
7648
|
// HeightMapGap override this to actually use from/to)
|
|
7663
7649
|
replace(_from, _to, nodes) {
|
|
7664
|
-
return
|
|
7650
|
+
return _HeightMap.of(nodes);
|
|
7665
7651
|
}
|
|
7666
7652
|
// Again, these are base cases, and are overridden for branch and gap nodes.
|
|
7667
7653
|
decomposeLeft(_to, result) {
|
|
@@ -7742,13 +7728,13 @@ var HeightMap = class {
|
|
|
7742
7728
|
brk = 1;
|
|
7743
7729
|
j++;
|
|
7744
7730
|
}
|
|
7745
|
-
return new HeightMapBranch(
|
|
7731
|
+
return new HeightMapBranch(_HeightMap.of(nodes.slice(0, i)), brk, _HeightMap.of(nodes.slice(j)));
|
|
7746
7732
|
}
|
|
7747
7733
|
};
|
|
7748
7734
|
HeightMap.prototype.size = 1;
|
|
7749
7735
|
var HeightMapBlock = class extends HeightMap {
|
|
7750
|
-
constructor(
|
|
7751
|
-
super(
|
|
7736
|
+
constructor(length, height, deco) {
|
|
7737
|
+
super(length, height);
|
|
7752
7738
|
this.deco = deco;
|
|
7753
7739
|
}
|
|
7754
7740
|
blockAt(_height, _oracle, top2, offset) {
|
|
@@ -7771,9 +7757,9 @@ var HeightMapBlock = class extends HeightMap {
|
|
|
7771
7757
|
return `block(${this.length})`;
|
|
7772
7758
|
}
|
|
7773
7759
|
};
|
|
7774
|
-
var HeightMapText = class extends HeightMapBlock {
|
|
7775
|
-
constructor(
|
|
7776
|
-
super(
|
|
7760
|
+
var HeightMapText = class _HeightMapText extends HeightMapBlock {
|
|
7761
|
+
constructor(length, height) {
|
|
7762
|
+
super(length, height, null);
|
|
7777
7763
|
this.collapsed = 0;
|
|
7778
7764
|
this.widgetHeight = 0;
|
|
7779
7765
|
this.breaks = 0;
|
|
@@ -7783,9 +7769,9 @@ var HeightMapText = class extends HeightMapBlock {
|
|
|
7783
7769
|
}
|
|
7784
7770
|
replace(_from, _to, nodes) {
|
|
7785
7771
|
let node = nodes[0];
|
|
7786
|
-
if (nodes.length == 1 && (node instanceof
|
|
7772
|
+
if (nodes.length == 1 && (node instanceof _HeightMapText || node instanceof HeightMapGap && node.flags & 4) && Math.abs(this.length - node.length) < 10) {
|
|
7787
7773
|
if (node instanceof HeightMapGap)
|
|
7788
|
-
node = new
|
|
7774
|
+
node = new _HeightMapText(node.length, this.height);
|
|
7789
7775
|
else
|
|
7790
7776
|
node.height = this.height;
|
|
7791
7777
|
if (!this.outdated)
|
|
@@ -7807,9 +7793,9 @@ var HeightMapText = class extends HeightMapBlock {
|
|
|
7807
7793
|
return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;
|
|
7808
7794
|
}
|
|
7809
7795
|
};
|
|
7810
|
-
var HeightMapGap = class extends HeightMap {
|
|
7811
|
-
constructor(
|
|
7812
|
-
super(
|
|
7796
|
+
var HeightMapGap = class _HeightMapGap extends HeightMap {
|
|
7797
|
+
constructor(length) {
|
|
7798
|
+
super(length, 0);
|
|
7813
7799
|
}
|
|
7814
7800
|
heightMetrics(oracle, offset) {
|
|
7815
7801
|
let firstLine = oracle.doc.lineAt(offset).number, lastLine = oracle.doc.lineAt(offset + this.length).number;
|
|
@@ -7834,8 +7820,8 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7834
7820
|
return new BlockInfo(line.from, line.length, lineTop, lineHeight, 0);
|
|
7835
7821
|
} else {
|
|
7836
7822
|
let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top2) / perLine)));
|
|
7837
|
-
let { from, length
|
|
7838
|
-
return new BlockInfo(from,
|
|
7823
|
+
let { from, length } = oracle.doc.line(firstLine + line);
|
|
7824
|
+
return new BlockInfo(from, length, top2 + perLine * line, perLine, 0);
|
|
7839
7825
|
}
|
|
7840
7826
|
}
|
|
7841
7827
|
lineAt(value, type, oracle, top2, offset) {
|
|
@@ -7871,32 +7857,32 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7871
7857
|
let after = this.length - to;
|
|
7872
7858
|
if (after > 0) {
|
|
7873
7859
|
let last = nodes[nodes.length - 1];
|
|
7874
|
-
if (last instanceof
|
|
7875
|
-
nodes[nodes.length - 1] = new
|
|
7860
|
+
if (last instanceof _HeightMapGap)
|
|
7861
|
+
nodes[nodes.length - 1] = new _HeightMapGap(last.length + after);
|
|
7876
7862
|
else
|
|
7877
|
-
nodes.push(null, new
|
|
7863
|
+
nodes.push(null, new _HeightMapGap(after - 1));
|
|
7878
7864
|
}
|
|
7879
7865
|
if (from > 0) {
|
|
7880
7866
|
let first = nodes[0];
|
|
7881
|
-
if (first instanceof
|
|
7882
|
-
nodes[0] = new
|
|
7867
|
+
if (first instanceof _HeightMapGap)
|
|
7868
|
+
nodes[0] = new _HeightMapGap(from + first.length);
|
|
7883
7869
|
else
|
|
7884
|
-
nodes.unshift(new
|
|
7870
|
+
nodes.unshift(new _HeightMapGap(from - 1), null);
|
|
7885
7871
|
}
|
|
7886
7872
|
return HeightMap.of(nodes);
|
|
7887
7873
|
}
|
|
7888
7874
|
decomposeLeft(to, result) {
|
|
7889
|
-
result.push(new
|
|
7875
|
+
result.push(new _HeightMapGap(to - 1), null);
|
|
7890
7876
|
}
|
|
7891
7877
|
decomposeRight(from, result) {
|
|
7892
|
-
result.push(null, new
|
|
7878
|
+
result.push(null, new _HeightMapGap(this.length - from - 1));
|
|
7893
7879
|
}
|
|
7894
7880
|
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
7895
7881
|
let end = offset + this.length;
|
|
7896
7882
|
if (measured && measured.from <= offset + this.length && measured.more) {
|
|
7897
7883
|
let nodes = [], pos = Math.max(offset, measured.from), singleHeight = -1;
|
|
7898
7884
|
if (measured.from > offset)
|
|
7899
|
-
nodes.push(new
|
|
7885
|
+
nodes.push(new _HeightMapGap(measured.from - offset - 1).updateHeight(oracle, offset));
|
|
7900
7886
|
while (pos <= end && measured.more) {
|
|
7901
7887
|
let len = oracle.doc.lineAt(pos).length;
|
|
7902
7888
|
if (nodes.length)
|
|
@@ -7912,7 +7898,7 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7912
7898
|
pos += len + 1;
|
|
7913
7899
|
}
|
|
7914
7900
|
if (pos <= end)
|
|
7915
|
-
nodes.push(null, new
|
|
7901
|
+
nodes.push(null, new _HeightMapGap(end - pos).updateHeight(oracle, pos));
|
|
7916
7902
|
let result = HeightMap.of(nodes);
|
|
7917
7903
|
if (singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon || Math.abs(singleHeight - this.heightMetrics(oracle, offset).perLine) >= Epsilon)
|
|
7918
7904
|
oracle.heightChanged = true;
|
|
@@ -8051,7 +8037,7 @@ function mergeGaps(nodes, around) {
|
|
|
8051
8037
|
nodes.splice(around - 1, 3, new HeightMapGap(before.length + 1 + after.length));
|
|
8052
8038
|
}
|
|
8053
8039
|
var relevantWidgetHeight = 5;
|
|
8054
|
-
var NodeBuilder = class {
|
|
8040
|
+
var NodeBuilder = class _NodeBuilder {
|
|
8055
8041
|
constructor(pos, oracle) {
|
|
8056
8042
|
this.pos = pos;
|
|
8057
8043
|
this.oracle = oracle;
|
|
@@ -8139,13 +8125,13 @@ var NodeBuilder = class {
|
|
|
8139
8125
|
if (type != BlockType.WidgetBefore)
|
|
8140
8126
|
this.covering = block;
|
|
8141
8127
|
}
|
|
8142
|
-
addLineDeco(height, breaks,
|
|
8128
|
+
addLineDeco(height, breaks, length) {
|
|
8143
8129
|
let line = this.ensureLine();
|
|
8144
|
-
line.length +=
|
|
8145
|
-
line.collapsed +=
|
|
8130
|
+
line.length += length;
|
|
8131
|
+
line.collapsed += length;
|
|
8146
8132
|
line.widgetHeight = Math.max(line.widgetHeight, height);
|
|
8147
8133
|
line.breaks += breaks;
|
|
8148
|
-
this.writtenTo = this.pos = this.pos +
|
|
8134
|
+
this.writtenTo = this.pos = this.pos + length;
|
|
8149
8135
|
}
|
|
8150
8136
|
finish(from) {
|
|
8151
8137
|
let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
|
|
@@ -8167,7 +8153,7 @@ var NodeBuilder = class {
|
|
|
8167
8153
|
// starts or ends in a line break, or has multiple line breaks next
|
|
8168
8154
|
// to each other.
|
|
8169
8155
|
static build(oracle, decorations2, from, to) {
|
|
8170
|
-
let builder = new
|
|
8156
|
+
let builder = new _NodeBuilder(from, oracle);
|
|
8171
8157
|
RangeSet.spans(decorations2, from, to, builder, 0);
|
|
8172
8158
|
return builder.finish(from);
|
|
8173
8159
|
}
|
|
@@ -9581,7 +9567,7 @@ function safariSelectionRangeHack(view) {
|
|
|
9581
9567
|
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
9582
9568
|
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
9583
9569
|
}
|
|
9584
|
-
var EditorView = class {
|
|
9570
|
+
var EditorView = class _EditorView {
|
|
9585
9571
|
/**
|
|
9586
9572
|
Construct a new view. You'll want to either provide a `parent`
|
|
9587
9573
|
option, or put `view.dom` into your document after creating a
|
|
@@ -9984,7 +9970,7 @@ var EditorView = class {
|
|
|
9984
9970
|
let first = true;
|
|
9985
9971
|
for (let tr of trs)
|
|
9986
9972
|
for (let effect of tr.effects)
|
|
9987
|
-
if (effect.is(
|
|
9973
|
+
if (effect.is(_EditorView.announce)) {
|
|
9988
9974
|
if (first)
|
|
9989
9975
|
this.announceDOM.textContent = "";
|
|
9990
9976
|
first = false;
|
|
@@ -10402,7 +10388,7 @@ EditorView.lineWrapping = /* @__PURE__ */ EditorView.contentAttributes.of({ "cla
|
|
|
10402
10388
|
EditorView.announce = /* @__PURE__ */ StateEffect.define();
|
|
10403
10389
|
var MaxBidiLine = 4096;
|
|
10404
10390
|
var BadMeasure = {};
|
|
10405
|
-
var CachedOrder = class {
|
|
10391
|
+
var CachedOrder = class _CachedOrder {
|
|
10406
10392
|
constructor(from, to, dir, order) {
|
|
10407
10393
|
this.from = from;
|
|
10408
10394
|
this.to = to;
|
|
@@ -10416,7 +10402,7 @@ var CachedOrder = class {
|
|
|
10416
10402
|
for (let i = Math.max(0, cache.length - 10); i < cache.length; i++) {
|
|
10417
10403
|
let entry = cache[i];
|
|
10418
10404
|
if (entry.dir == lastDir && !changes.touchesRange(entry.from, entry.to))
|
|
10419
|
-
result.push(new
|
|
10405
|
+
result.push(new _CachedOrder(changes.mapPos(entry.from, 1), changes.mapPos(entry.to, -1), entry.dir, entry.order));
|
|
10420
10406
|
}
|
|
10421
10407
|
return result;
|
|
10422
10408
|
}
|
|
@@ -10611,7 +10597,7 @@ function runHandlers(map, event, view, scope) {
|
|
|
10611
10597
|
event.stopPropagation();
|
|
10612
10598
|
return handled;
|
|
10613
10599
|
}
|
|
10614
|
-
var RectangleMarker = class {
|
|
10600
|
+
var RectangleMarker = class _RectangleMarker {
|
|
10615
10601
|
/**
|
|
10616
10602
|
Create a marker with the given class and dimensions. If `width`
|
|
10617
10603
|
is null, the DOM element will get no width style.
|
|
@@ -10658,7 +10644,7 @@ var RectangleMarker = class {
|
|
|
10658
10644
|
if (!pos)
|
|
10659
10645
|
return [];
|
|
10660
10646
|
let base2 = getBase(view);
|
|
10661
|
-
return [new
|
|
10647
|
+
return [new _RectangleMarker(className, pos.left - base2.left, pos.top - base2.top, null, pos.bottom - pos.top)];
|
|
10662
10648
|
} else {
|
|
10663
10649
|
return rectanglesForRange(view, className, range);
|
|
10664
10650
|
}
|
|
@@ -11617,7 +11603,7 @@ function topNodeAt(state, pos, side) {
|
|
|
11617
11603
|
}
|
|
11618
11604
|
return tree;
|
|
11619
11605
|
}
|
|
11620
|
-
var LRLanguage = class extends Language {
|
|
11606
|
+
var LRLanguage = class _LRLanguage extends Language {
|
|
11621
11607
|
constructor(data, parser, name) {
|
|
11622
11608
|
super(data, parser, [], name);
|
|
11623
11609
|
this.parser = parser;
|
|
@@ -11627,7 +11613,7 @@ var LRLanguage = class extends Language {
|
|
|
11627
11613
|
*/
|
|
11628
11614
|
static define(spec) {
|
|
11629
11615
|
let data = defineLanguageFacet(spec.languageData);
|
|
11630
|
-
return new
|
|
11616
|
+
return new _LRLanguage(data, spec.parser.configure({
|
|
11631
11617
|
props: [languageDataProp.add((type) => type.isTop ? data : void 0)]
|
|
11632
11618
|
}), spec.name);
|
|
11633
11619
|
}
|
|
@@ -11636,7 +11622,7 @@ var LRLanguage = class extends Language {
|
|
|
11636
11622
|
version of its parser and optionally a new name.
|
|
11637
11623
|
*/
|
|
11638
11624
|
configure(options, name) {
|
|
11639
|
-
return new
|
|
11625
|
+
return new _LRLanguage(this.data, this.parser.configure(options), name || this.name);
|
|
11640
11626
|
}
|
|
11641
11627
|
get allowsNesting() {
|
|
11642
11628
|
return this.parser.hasWrappers();
|
|
@@ -11691,7 +11677,7 @@ var DocInput = class {
|
|
|
11691
11677
|
}
|
|
11692
11678
|
};
|
|
11693
11679
|
var currentContext = null;
|
|
11694
|
-
var ParseContext = class {
|
|
11680
|
+
var ParseContext = class _ParseContext {
|
|
11695
11681
|
constructor(parser, state, fragments = [], tree, treeLen, viewport, skipped, scheduleOn) {
|
|
11696
11682
|
this.parser = parser;
|
|
11697
11683
|
this.state = state;
|
|
@@ -11708,7 +11694,7 @@ var ParseContext = class {
|
|
|
11708
11694
|
@internal
|
|
11709
11695
|
*/
|
|
11710
11696
|
static create(parser, state, viewport) {
|
|
11711
|
-
return new
|
|
11697
|
+
return new _ParseContext(parser, state, [], Tree.empty, 0, viewport, [], null);
|
|
11712
11698
|
}
|
|
11713
11699
|
startParse() {
|
|
11714
11700
|
return this.parser.startParse(new DocInput(this.state.doc), this.fragments);
|
|
@@ -11804,7 +11790,7 @@ var ParseContext = class {
|
|
|
11804
11790
|
}
|
|
11805
11791
|
}
|
|
11806
11792
|
}
|
|
11807
|
-
return new
|
|
11793
|
+
return new _ParseContext(this.parser, newState, fragments, tree, treeLen, viewport, skipped, this.scheduleOn);
|
|
11808
11794
|
}
|
|
11809
11795
|
/**
|
|
11810
11796
|
@internal
|
|
@@ -11896,7 +11882,7 @@ var ParseContext = class {
|
|
|
11896
11882
|
function cutFragments(fragments, from, to) {
|
|
11897
11883
|
return TreeFragment.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]);
|
|
11898
11884
|
}
|
|
11899
|
-
var LanguageState = class {
|
|
11885
|
+
var LanguageState = class _LanguageState {
|
|
11900
11886
|
constructor(context) {
|
|
11901
11887
|
this.context = context;
|
|
11902
11888
|
this.tree = context.tree;
|
|
@@ -11908,14 +11894,14 @@ var LanguageState = class {
|
|
|
11908
11894
|
let upto = this.context.treeLen == tr.startState.doc.length ? void 0 : Math.max(tr.changes.mapPos(this.context.treeLen), newCx.viewport.to);
|
|
11909
11895
|
if (!newCx.work(20, upto))
|
|
11910
11896
|
newCx.takeTree();
|
|
11911
|
-
return new
|
|
11897
|
+
return new _LanguageState(newCx);
|
|
11912
11898
|
}
|
|
11913
11899
|
static init(state) {
|
|
11914
11900
|
let vpTo = Math.min(3e3, state.doc.length);
|
|
11915
11901
|
let parseState = ParseContext.create(state.facet(language).parser, state, { from: 0, to: vpTo });
|
|
11916
11902
|
if (!parseState.work(20, vpTo))
|
|
11917
11903
|
parseState.takeTree();
|
|
11918
|
-
return new
|
|
11904
|
+
return new _LanguageState(parseState);
|
|
11919
11905
|
}
|
|
11920
11906
|
};
|
|
11921
11907
|
Language.state = /* @__PURE__ */ StateField.define({
|
|
@@ -12199,7 +12185,7 @@ function indentFrom(node, pos, base2) {
|
|
|
12199
12185
|
function topIndent() {
|
|
12200
12186
|
return 0;
|
|
12201
12187
|
}
|
|
12202
|
-
var TreeIndentContext = class extends IndentContext {
|
|
12188
|
+
var TreeIndentContext = class _TreeIndentContext extends IndentContext {
|
|
12203
12189
|
constructor(base2, pos, node) {
|
|
12204
12190
|
super(base2.state, base2.options);
|
|
12205
12191
|
this.base = base2;
|
|
@@ -12210,7 +12196,7 @@ var TreeIndentContext = class extends IndentContext {
|
|
|
12210
12196
|
@internal
|
|
12211
12197
|
*/
|
|
12212
12198
|
static create(base2, pos, node) {
|
|
12213
|
-
return new
|
|
12199
|
+
return new _TreeIndentContext(base2, pos, node);
|
|
12214
12200
|
}
|
|
12215
12201
|
/**
|
|
12216
12202
|
Get the text directly after `this.pos`, either the entire line
|
|
@@ -12285,7 +12271,7 @@ function delimitedStrategy(context, align, units, closing2, closedAt) {
|
|
|
12285
12271
|
return closed ? context.column(aligned.from) : context.column(aligned.to);
|
|
12286
12272
|
return context.baseIndent + (closed ? 0 : context.unit * units);
|
|
12287
12273
|
}
|
|
12288
|
-
var HighlightStyle = class {
|
|
12274
|
+
var HighlightStyle = class _HighlightStyle {
|
|
12289
12275
|
constructor(specs, options) {
|
|
12290
12276
|
this.specs = specs;
|
|
12291
12277
|
let modSpec;
|
|
@@ -12322,7 +12308,7 @@ var HighlightStyle = class {
|
|
|
12322
12308
|
defined earlier.
|
|
12323
12309
|
*/
|
|
12324
12310
|
static define(specs, options) {
|
|
12325
|
-
return new
|
|
12311
|
+
return new _HighlightStyle(specs, options || {});
|
|
12326
12312
|
}
|
|
12327
12313
|
};
|
|
12328
12314
|
var highlighterFacet = /* @__PURE__ */ Facet.define();
|
|
@@ -13252,7 +13238,7 @@ function sortOptions(active, state) {
|
|
|
13252
13238
|
}
|
|
13253
13239
|
return result;
|
|
13254
13240
|
}
|
|
13255
|
-
var CompletionDialog = class {
|
|
13241
|
+
var CompletionDialog = class _CompletionDialog {
|
|
13256
13242
|
constructor(options, attrs, tooltip, timestamp, selected, disabled) {
|
|
13257
13243
|
this.options = options;
|
|
13258
13244
|
this.attrs = attrs;
|
|
@@ -13262,7 +13248,7 @@ var CompletionDialog = class {
|
|
|
13262
13248
|
this.disabled = disabled;
|
|
13263
13249
|
}
|
|
13264
13250
|
setSelected(selected, id) {
|
|
13265
|
-
return selected == this.selected || selected >= this.options.length ? this : new
|
|
13251
|
+
return selected == this.selected || selected >= this.options.length ? this : new _CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
|
|
13266
13252
|
}
|
|
13267
13253
|
static build(active, state, id, prev, conf) {
|
|
13268
13254
|
let options = sortOptions(active, state);
|
|
@@ -13270,7 +13256,7 @@ var CompletionDialog = class {
|
|
|
13270
13256
|
return prev && active.some(
|
|
13271
13257
|
(a) => a.state == 1
|
|
13272
13258
|
/* Pending */
|
|
13273
|
-
) ? new
|
|
13259
|
+
) ? new _CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;
|
|
13274
13260
|
}
|
|
13275
13261
|
let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
|
|
13276
13262
|
if (prev && prev.selected != selected && prev.selected != -1) {
|
|
@@ -13281,24 +13267,24 @@ var CompletionDialog = class {
|
|
|
13281
13267
|
break;
|
|
13282
13268
|
}
|
|
13283
13269
|
}
|
|
13284
|
-
return new
|
|
13270
|
+
return new _CompletionDialog(options, makeAttrs(id, selected), {
|
|
13285
13271
|
pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),
|
|
13286
13272
|
create: completionTooltip(completionState, applyCompletion),
|
|
13287
13273
|
above: conf.aboveCursor
|
|
13288
13274
|
}, prev ? prev.timestamp : Date.now(), selected, false);
|
|
13289
13275
|
}
|
|
13290
13276
|
map(changes) {
|
|
13291
|
-
return new
|
|
13277
|
+
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);
|
|
13292
13278
|
}
|
|
13293
13279
|
};
|
|
13294
|
-
var CompletionState = class {
|
|
13280
|
+
var CompletionState = class _CompletionState {
|
|
13295
13281
|
constructor(active, id, open) {
|
|
13296
13282
|
this.active = active;
|
|
13297
13283
|
this.id = id;
|
|
13298
13284
|
this.open = open;
|
|
13299
13285
|
}
|
|
13300
13286
|
static start() {
|
|
13301
|
-
return new
|
|
13287
|
+
return new _CompletionState(none2, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
13302
13288
|
}
|
|
13303
13289
|
update(tr) {
|
|
13304
13290
|
let { state } = tr, conf = state.facet(completionConfig);
|
|
@@ -13338,7 +13324,7 @@ var CompletionState = class {
|
|
|
13338
13324
|
for (let effect of tr.effects)
|
|
13339
13325
|
if (effect.is(setSelectedEffect))
|
|
13340
13326
|
open = open && open.setSelected(effect.value, this.id);
|
|
13341
|
-
return active == this.active && open == this.open ? this : new
|
|
13327
|
+
return active == this.active && open == this.open ? this : new _CompletionState(active, this.id, open);
|
|
13342
13328
|
}
|
|
13343
13329
|
get tooltip() {
|
|
13344
13330
|
return this.open ? this.open.tooltip : null;
|
|
@@ -13379,7 +13365,7 @@ var none2 = [];
|
|
|
13379
13365
|
function getUserEvent(tr) {
|
|
13380
13366
|
return tr.isUserEvent("input.type") ? "input" : tr.isUserEvent("delete.backward") ? "delete" : null;
|
|
13381
13367
|
}
|
|
13382
|
-
var ActiveSource = class {
|
|
13368
|
+
var ActiveSource = class _ActiveSource {
|
|
13383
13369
|
constructor(source, state, explicitPos = -1) {
|
|
13384
13370
|
this.source = source;
|
|
13385
13371
|
this.state = state;
|
|
@@ -13395,16 +13381,16 @@ var ActiveSource = class {
|
|
|
13395
13381
|
else if (tr.docChanged)
|
|
13396
13382
|
value = value.handleChange(tr);
|
|
13397
13383
|
else if (tr.selection && value.state != 0)
|
|
13398
|
-
value = new
|
|
13384
|
+
value = new _ActiveSource(
|
|
13399
13385
|
value.source,
|
|
13400
13386
|
0
|
|
13401
13387
|
/* Inactive */
|
|
13402
13388
|
);
|
|
13403
13389
|
for (let effect of tr.effects) {
|
|
13404
13390
|
if (effect.is(startCompletionEffect))
|
|
13405
|
-
value = new
|
|
13391
|
+
value = new _ActiveSource(value.source, 1, effect.value ? cur(tr.state) : -1);
|
|
13406
13392
|
else if (effect.is(closeCompletionEffect))
|
|
13407
|
-
value = new
|
|
13393
|
+
value = new _ActiveSource(
|
|
13408
13394
|
value.source,
|
|
13409
13395
|
0
|
|
13410
13396
|
/* Inactive */
|
|
@@ -13418,24 +13404,24 @@ var ActiveSource = class {
|
|
|
13418
13404
|
return value;
|
|
13419
13405
|
}
|
|
13420
13406
|
handleUserEvent(tr, type, conf) {
|
|
13421
|
-
return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new
|
|
13407
|
+
return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new _ActiveSource(
|
|
13422
13408
|
this.source,
|
|
13423
13409
|
1
|
|
13424
13410
|
/* Pending */
|
|
13425
13411
|
);
|
|
13426
13412
|
}
|
|
13427
13413
|
handleChange(tr) {
|
|
13428
|
-
return tr.changes.touchesRange(cur(tr.startState)) ? new
|
|
13414
|
+
return tr.changes.touchesRange(cur(tr.startState)) ? new _ActiveSource(
|
|
13429
13415
|
this.source,
|
|
13430
13416
|
0
|
|
13431
13417
|
/* Inactive */
|
|
13432
13418
|
) : this.map(tr.changes);
|
|
13433
13419
|
}
|
|
13434
13420
|
map(changes) {
|
|
13435
|
-
return changes.empty || this.explicitPos < 0 ? this : new
|
|
13421
|
+
return changes.empty || this.explicitPos < 0 ? this : new _ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));
|
|
13436
13422
|
}
|
|
13437
13423
|
};
|
|
13438
|
-
var ActiveResult = class extends ActiveSource {
|
|
13424
|
+
var ActiveResult = class _ActiveResult extends ActiveSource {
|
|
13439
13425
|
constructor(source, explicitPos, result, from, to) {
|
|
13440
13426
|
super(source, 2, explicitPos);
|
|
13441
13427
|
this.result = result;
|
|
@@ -13457,9 +13443,9 @@ var ActiveResult = class extends ActiveSource {
|
|
|
13457
13443
|
);
|
|
13458
13444
|
let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos), updated;
|
|
13459
13445
|
if (checkValid(this.result.validFor, tr.state, from, to))
|
|
13460
|
-
return new
|
|
13446
|
+
return new _ActiveResult(this.source, explicitPos, this.result, from, to);
|
|
13461
13447
|
if (this.result.update && (updated = this.result.update(this.result, from, to, new CompletionContext(tr.state, pos, explicitPos >= 0))))
|
|
13462
|
-
return new
|
|
13448
|
+
return new _ActiveResult(this.source, explicitPos, updated, updated.from, (_a2 = updated.to) !== null && _a2 !== void 0 ? _a2 : cur(tr.state));
|
|
13463
13449
|
return new ActiveSource(this.source, 1, explicitPos);
|
|
13464
13450
|
}
|
|
13465
13451
|
handleChange(tr) {
|
|
@@ -13470,7 +13456,7 @@ var ActiveResult = class extends ActiveSource {
|
|
|
13470
13456
|
) : this.map(tr.changes);
|
|
13471
13457
|
}
|
|
13472
13458
|
map(mapping) {
|
|
13473
|
-
return mapping.empty ? this : new
|
|
13459
|
+
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));
|
|
13474
13460
|
}
|
|
13475
13461
|
};
|
|
13476
13462
|
function checkValid(validFor, state, from, to) {
|
|
@@ -13516,12 +13502,12 @@ function moveCompletionSelection(forward, by = "option") {
|
|
|
13516
13502
|
let step = 1, tooltip;
|
|
13517
13503
|
if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip)))
|
|
13518
13504
|
step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
|
|
13519
|
-
let { length
|
|
13520
|
-
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 :
|
|
13505
|
+
let { length } = cState.open.options;
|
|
13506
|
+
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;
|
|
13521
13507
|
if (selected < 0)
|
|
13522
|
-
selected = by == "page" ? 0 :
|
|
13523
|
-
else if (selected >=
|
|
13524
|
-
selected = by == "page" ?
|
|
13508
|
+
selected = by == "page" ? 0 : length - 1;
|
|
13509
|
+
else if (selected >= length)
|
|
13510
|
+
selected = by == "page" ? length - 1 : 0;
|
|
13525
13511
|
view.dispatch({ effects: setSelectedEffect.of(selected) });
|
|
13526
13512
|
return true;
|
|
13527
13513
|
};
|
|
@@ -14292,7 +14278,7 @@ var undo = /* @__PURE__ */ cmd(0, false);
|
|
|
14292
14278
|
var redo = /* @__PURE__ */ cmd(1, false);
|
|
14293
14279
|
var undoSelection = /* @__PURE__ */ cmd(0, true);
|
|
14294
14280
|
var redoSelection = /* @__PURE__ */ cmd(1, true);
|
|
14295
|
-
var HistEvent = class {
|
|
14281
|
+
var HistEvent = class _HistEvent {
|
|
14296
14282
|
constructor(changes, effects, mapped, startSelection, selectionsAfter) {
|
|
14297
14283
|
this.changes = changes;
|
|
14298
14284
|
this.effects = effects;
|
|
@@ -14301,7 +14287,7 @@ var HistEvent = class {
|
|
|
14301
14287
|
this.selectionsAfter = selectionsAfter;
|
|
14302
14288
|
}
|
|
14303
14289
|
setSelAfter(after) {
|
|
14304
|
-
return new
|
|
14290
|
+
return new _HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);
|
|
14305
14291
|
}
|
|
14306
14292
|
toJSON() {
|
|
14307
14293
|
var _a2, _b, _c;
|
|
@@ -14313,7 +14299,7 @@ var HistEvent = class {
|
|
|
14313
14299
|
};
|
|
14314
14300
|
}
|
|
14315
14301
|
static fromJSON(json) {
|
|
14316
|
-
return new
|
|
14302
|
+
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));
|
|
14317
14303
|
}
|
|
14318
14304
|
// This does not check `addToHistory` and such, it assumes the
|
|
14319
14305
|
// transaction needs to be converted to an item. Returns null when
|
|
@@ -14327,10 +14313,10 @@ var HistEvent = class {
|
|
|
14327
14313
|
}
|
|
14328
14314
|
if (!effects.length && tr.changes.empty)
|
|
14329
14315
|
return null;
|
|
14330
|
-
return new
|
|
14316
|
+
return new _HistEvent(tr.changes.invert(tr.startState.doc), effects, void 0, selection || tr.startState.selection, none3);
|
|
14331
14317
|
}
|
|
14332
14318
|
static selection(selections) {
|
|
14333
|
-
return new
|
|
14319
|
+
return new _HistEvent(void 0, none3, void 0, void 0, selections);
|
|
14334
14320
|
}
|
|
14335
14321
|
};
|
|
14336
14322
|
function updateBranch(branch, to, maxLen, newEvent) {
|
|
@@ -14380,16 +14366,16 @@ function popSelection(branch) {
|
|
|
14380
14366
|
function addMappingToBranch(branch, mapping) {
|
|
14381
14367
|
if (!branch.length)
|
|
14382
14368
|
return branch;
|
|
14383
|
-
let
|
|
14384
|
-
while (
|
|
14385
|
-
let event = mapEvent(branch[
|
|
14369
|
+
let length = branch.length, selections = none3;
|
|
14370
|
+
while (length) {
|
|
14371
|
+
let event = mapEvent(branch[length - 1], mapping, selections);
|
|
14386
14372
|
if (event.changes && !event.changes.empty || event.effects.length) {
|
|
14387
|
-
let result = branch.slice(0,
|
|
14388
|
-
result[
|
|
14373
|
+
let result = branch.slice(0, length);
|
|
14374
|
+
result[length - 1] = event;
|
|
14389
14375
|
return result;
|
|
14390
14376
|
} else {
|
|
14391
14377
|
mapping = event.mapped;
|
|
14392
|
-
|
|
14378
|
+
length--;
|
|
14393
14379
|
selections = event.selectionsAfter;
|
|
14394
14380
|
}
|
|
14395
14381
|
}
|
|
@@ -14404,7 +14390,7 @@ function mapEvent(event, mapping, extraSelections) {
|
|
|
14404
14390
|
return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);
|
|
14405
14391
|
}
|
|
14406
14392
|
var joinableUserEvent = /^(input\.type|delete)($|\.)/;
|
|
14407
|
-
var HistoryState = class {
|
|
14393
|
+
var HistoryState = class _HistoryState {
|
|
14408
14394
|
constructor(done, undone, prevTime = 0, prevUserEvent = void 0) {
|
|
14409
14395
|
this.done = done;
|
|
14410
14396
|
this.undone = undone;
|
|
@@ -14412,7 +14398,7 @@ var HistoryState = class {
|
|
|
14412
14398
|
this.prevUserEvent = prevUserEvent;
|
|
14413
14399
|
}
|
|
14414
14400
|
isolate() {
|
|
14415
|
-
return this.prevTime ? new
|
|
14401
|
+
return this.prevTime ? new _HistoryState(this.done, this.undone) : this;
|
|
14416
14402
|
}
|
|
14417
14403
|
addChanges(event, time, userEvent, config2, tr) {
|
|
14418
14404
|
let done = this.done, lastEvent = done[done.length - 1];
|
|
@@ -14422,16 +14408,16 @@ var HistoryState = class {
|
|
|
14422
14408
|
} else {
|
|
14423
14409
|
done = updateBranch(done, done.length, config2.minDepth, event);
|
|
14424
14410
|
}
|
|
14425
|
-
return new
|
|
14411
|
+
return new _HistoryState(done, none3, time, userEvent);
|
|
14426
14412
|
}
|
|
14427
14413
|
addSelection(selection, time, userEvent, newGroupDelay) {
|
|
14428
14414
|
let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none3;
|
|
14429
14415
|
if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection))
|
|
14430
14416
|
return this;
|
|
14431
|
-
return new
|
|
14417
|
+
return new _HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);
|
|
14432
14418
|
}
|
|
14433
14419
|
addMapping(mapping) {
|
|
14434
|
-
return new
|
|
14420
|
+
return new _HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);
|
|
14435
14421
|
}
|
|
14436
14422
|
pop(side, state, selection) {
|
|
14437
14423
|
let branch = side == 0 ? this.done : this.undone;
|
|
@@ -15150,271 +15136,6 @@ var metadataKeys = {
|
|
|
15150
15136
|
};
|
|
15151
15137
|
var { DEPTH, IS_LEAF } = metadataKeys;
|
|
15152
15138
|
|
|
15153
|
-
// ../vuu-utils/src/cookie-utils.ts
|
|
15154
|
-
var getCookieValue = (name) => {
|
|
15155
|
-
var _a2, _b;
|
|
15156
|
-
if (((_a2 = globalThis.document) == null ? void 0 : _a2.cookie) !== void 0) {
|
|
15157
|
-
return (_b = globalThis.document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _b.split("=")[1];
|
|
15158
|
-
}
|
|
15159
|
-
};
|
|
15160
|
-
|
|
15161
|
-
// ../vuu-utils/src/DataWindow.ts
|
|
15162
|
-
var { KEY } = metadataKeys;
|
|
15163
|
-
|
|
15164
|
-
// ../vuu-utils/src/date/formatter.ts
|
|
15165
|
-
var baseTimeFormatOptions = {
|
|
15166
|
-
hour: "2-digit",
|
|
15167
|
-
minute: "2-digit",
|
|
15168
|
-
second: "2-digit"
|
|
15169
|
-
};
|
|
15170
|
-
var formatConfigByTimePatterns = {
|
|
15171
|
-
"hh:mm:ss": {
|
|
15172
|
-
locale: "en-GB",
|
|
15173
|
-
options: { ...baseTimeFormatOptions, hour12: false }
|
|
15174
|
-
},
|
|
15175
|
-
"hh:mm:ss a": {
|
|
15176
|
-
locale: "en-GB",
|
|
15177
|
-
options: { ...baseTimeFormatOptions, hour12: true }
|
|
15178
|
-
}
|
|
15179
|
-
};
|
|
15180
|
-
var baseDateFormatOptions = {
|
|
15181
|
-
day: "2-digit",
|
|
15182
|
-
month: "2-digit",
|
|
15183
|
-
year: "numeric"
|
|
15184
|
-
};
|
|
15185
|
-
var formatConfigByDatePatterns = {
|
|
15186
|
-
"dd.mm.yyyy": {
|
|
15187
|
-
locale: "en-GB",
|
|
15188
|
-
options: { ...baseDateFormatOptions },
|
|
15189
|
-
postProcessor: (s) => s.replaceAll("/", ".")
|
|
15190
|
-
},
|
|
15191
|
-
"dd/mm/yyyy": { locale: "en-GB", options: { ...baseDateFormatOptions } },
|
|
15192
|
-
"dd MMM yyyy": {
|
|
15193
|
-
locale: "en-GB",
|
|
15194
|
-
options: { ...baseDateFormatOptions, month: "short" }
|
|
15195
|
-
},
|
|
15196
|
-
"dd MMMM yyyy": {
|
|
15197
|
-
locale: "en-GB",
|
|
15198
|
-
options: { ...baseDateFormatOptions, month: "long" }
|
|
15199
|
-
},
|
|
15200
|
-
"mm/dd/yyyy": { locale: "en-US", options: { ...baseDateFormatOptions } },
|
|
15201
|
-
"MMM dd, yyyy": {
|
|
15202
|
-
locale: "en-US",
|
|
15203
|
-
options: { ...baseDateFormatOptions, month: "short" }
|
|
15204
|
-
},
|
|
15205
|
-
"MMMM dd, yyyy": {
|
|
15206
|
-
locale: "en-US",
|
|
15207
|
-
options: { ...baseDateFormatOptions, month: "long" }
|
|
15208
|
-
}
|
|
15209
|
-
};
|
|
15210
|
-
var formatConfigByDateTimePatterns = { ...formatConfigByDatePatterns, ...formatConfigByTimePatterns };
|
|
15211
|
-
|
|
15212
|
-
// ../vuu-utils/src/logging-utils.ts
|
|
15213
|
-
var logLevels = ["error", "warn", "info", "debug"];
|
|
15214
|
-
var isValidLogLevel = (value) => typeof value === "string" && logLevels.includes(value);
|
|
15215
|
-
var DEFAULT_LOG_LEVEL = "error";
|
|
15216
|
-
var NO_OP = () => void 0;
|
|
15217
|
-
var DEFAULT_DEBUG_LEVEL = false ? "error" : "info";
|
|
15218
|
-
var { loggingLevel = DEFAULT_DEBUG_LEVEL } = getLoggingSettings();
|
|
15219
|
-
var logger = (category) => {
|
|
15220
|
-
const debugEnabled2 = loggingLevel === "debug";
|
|
15221
|
-
const infoEnabled = debugEnabled2 || loggingLevel === "info";
|
|
15222
|
-
const warnEnabled = infoEnabled || loggingLevel === "warn";
|
|
15223
|
-
const errorEnabled = warnEnabled || loggingLevel === "error";
|
|
15224
|
-
const info = infoEnabled ? (message) => console.info(`[${category}] ${message}`) : NO_OP;
|
|
15225
|
-
const warn = warnEnabled ? (message) => console.warn(`[${category}] ${message}`) : NO_OP;
|
|
15226
|
-
const debug2 = debugEnabled2 ? (message) => console.debug(`[${category}] ${message}`) : NO_OP;
|
|
15227
|
-
const error = errorEnabled ? (message) => console.error(`[${category}] ${message}`) : NO_OP;
|
|
15228
|
-
if (false) {
|
|
15229
|
-
return {
|
|
15230
|
-
errorEnabled,
|
|
15231
|
-
error
|
|
15232
|
-
};
|
|
15233
|
-
} else {
|
|
15234
|
-
return {
|
|
15235
|
-
debugEnabled: debugEnabled2,
|
|
15236
|
-
infoEnabled,
|
|
15237
|
-
warnEnabled,
|
|
15238
|
-
errorEnabled,
|
|
15239
|
-
info,
|
|
15240
|
-
warn,
|
|
15241
|
-
debug: debug2,
|
|
15242
|
-
error
|
|
15243
|
-
};
|
|
15244
|
-
}
|
|
15245
|
-
};
|
|
15246
|
-
function getLoggingSettings() {
|
|
15247
|
-
if (typeof loggingSettings !== "undefined") {
|
|
15248
|
-
return loggingSettings;
|
|
15249
|
-
} else {
|
|
15250
|
-
return {
|
|
15251
|
-
loggingLevel: getLoggingLevelFromCookie()
|
|
15252
|
-
};
|
|
15253
|
-
}
|
|
15254
|
-
}
|
|
15255
|
-
function getLoggingLevelFromCookie() {
|
|
15256
|
-
const value = getCookieValue("vuu-logging-level");
|
|
15257
|
-
if (isValidLogLevel(value)) {
|
|
15258
|
-
return value;
|
|
15259
|
-
} else {
|
|
15260
|
-
return DEFAULT_LOG_LEVEL;
|
|
15261
|
-
}
|
|
15262
|
-
}
|
|
15263
|
-
|
|
15264
|
-
// ../vuu-utils/src/debug-utils.ts
|
|
15265
|
-
var { debug, debugEnabled } = logger("range-monitor");
|
|
15266
|
-
|
|
15267
|
-
// ../vuu-utils/src/event-emitter.ts
|
|
15268
|
-
function isArrayOfListeners(listeners) {
|
|
15269
|
-
return Array.isArray(listeners);
|
|
15270
|
-
}
|
|
15271
|
-
function isOnlyListener(listeners) {
|
|
15272
|
-
return !Array.isArray(listeners);
|
|
15273
|
-
}
|
|
15274
|
-
var _events;
|
|
15275
|
-
var EventEmitter = class {
|
|
15276
|
-
constructor() {
|
|
15277
|
-
__privateAdd(this, _events, /* @__PURE__ */ new Map());
|
|
15278
|
-
}
|
|
15279
|
-
addListener(event, listener) {
|
|
15280
|
-
const listeners = __privateGet(this, _events).get(event);
|
|
15281
|
-
if (!listeners) {
|
|
15282
|
-
__privateGet(this, _events).set(event, listener);
|
|
15283
|
-
} else if (isArrayOfListeners(listeners)) {
|
|
15284
|
-
listeners.push(listener);
|
|
15285
|
-
} else if (isOnlyListener(listeners)) {
|
|
15286
|
-
__privateGet(this, _events).set(event, [listeners, listener]);
|
|
15287
|
-
}
|
|
15288
|
-
}
|
|
15289
|
-
removeListener(event, listener) {
|
|
15290
|
-
if (!__privateGet(this, _events).has(event)) {
|
|
15291
|
-
return;
|
|
15292
|
-
}
|
|
15293
|
-
const listenerOrListeners = __privateGet(this, _events).get(event);
|
|
15294
|
-
let position = -1;
|
|
15295
|
-
if (listenerOrListeners === listener) {
|
|
15296
|
-
__privateGet(this, _events).delete(event);
|
|
15297
|
-
} else if (Array.isArray(listenerOrListeners)) {
|
|
15298
|
-
for (let i = length; i-- > 0; ) {
|
|
15299
|
-
if (listenerOrListeners[i] === listener) {
|
|
15300
|
-
position = i;
|
|
15301
|
-
break;
|
|
15302
|
-
}
|
|
15303
|
-
}
|
|
15304
|
-
if (position < 0) {
|
|
15305
|
-
return;
|
|
15306
|
-
}
|
|
15307
|
-
if (listenerOrListeners.length === 1) {
|
|
15308
|
-
listenerOrListeners.length = 0;
|
|
15309
|
-
__privateGet(this, _events).delete(event);
|
|
15310
|
-
} else {
|
|
15311
|
-
listenerOrListeners.splice(position, 1);
|
|
15312
|
-
}
|
|
15313
|
-
}
|
|
15314
|
-
}
|
|
15315
|
-
removeAllListeners(event) {
|
|
15316
|
-
if (event && __privateGet(this, _events).has(event)) {
|
|
15317
|
-
__privateGet(this, _events).delete(event);
|
|
15318
|
-
} else if (event === void 0) {
|
|
15319
|
-
__privateGet(this, _events).clear();
|
|
15320
|
-
}
|
|
15321
|
-
}
|
|
15322
|
-
emit(event, ...args) {
|
|
15323
|
-
if (__privateGet(this, _events)) {
|
|
15324
|
-
const handler = __privateGet(this, _events).get(event);
|
|
15325
|
-
if (handler) {
|
|
15326
|
-
this.invokeHandler(handler, args);
|
|
15327
|
-
}
|
|
15328
|
-
}
|
|
15329
|
-
}
|
|
15330
|
-
once(event, listener) {
|
|
15331
|
-
const handler = (...args) => {
|
|
15332
|
-
this.removeListener(event, handler);
|
|
15333
|
-
listener(...args);
|
|
15334
|
-
};
|
|
15335
|
-
this.on(event, handler);
|
|
15336
|
-
}
|
|
15337
|
-
on(event, listener) {
|
|
15338
|
-
this.addListener(event, listener);
|
|
15339
|
-
}
|
|
15340
|
-
hasListener(event, listener) {
|
|
15341
|
-
const listeners = __privateGet(this, _events).get(event);
|
|
15342
|
-
if (Array.isArray(listeners)) {
|
|
15343
|
-
return listeners.includes(listener);
|
|
15344
|
-
} else {
|
|
15345
|
-
return listeners === listener;
|
|
15346
|
-
}
|
|
15347
|
-
}
|
|
15348
|
-
invokeHandler(handler, args) {
|
|
15349
|
-
if (isArrayOfListeners(handler)) {
|
|
15350
|
-
handler.slice().forEach((listener) => this.invokeHandler(listener, args));
|
|
15351
|
-
} else {
|
|
15352
|
-
switch (args.length) {
|
|
15353
|
-
case 0:
|
|
15354
|
-
handler();
|
|
15355
|
-
break;
|
|
15356
|
-
case 1:
|
|
15357
|
-
handler(args[0]);
|
|
15358
|
-
break;
|
|
15359
|
-
case 2:
|
|
15360
|
-
handler(args[0], args[1]);
|
|
15361
|
-
break;
|
|
15362
|
-
default:
|
|
15363
|
-
handler.call(null, ...args);
|
|
15364
|
-
}
|
|
15365
|
-
}
|
|
15366
|
-
}
|
|
15367
|
-
};
|
|
15368
|
-
_events = new WeakMap();
|
|
15369
|
-
|
|
15370
|
-
// ../vuu-utils/src/round-decimal.ts
|
|
15371
|
-
var PUNCTUATION_STR = String.fromCharCode(8200);
|
|
15372
|
-
var DIGIT_STR = String.fromCharCode(8199);
|
|
15373
|
-
var Space = {
|
|
15374
|
-
DIGIT: DIGIT_STR,
|
|
15375
|
-
TWO_DIGITS: DIGIT_STR + DIGIT_STR,
|
|
15376
|
-
THREE_DIGITS: DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
15377
|
-
FULL_PADDING: [
|
|
15378
|
-
null,
|
|
15379
|
-
PUNCTUATION_STR + DIGIT_STR,
|
|
15380
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR,
|
|
15381
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
15382
|
-
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR
|
|
15383
|
-
]
|
|
15384
|
-
};
|
|
15385
|
-
var LEADING_FILL = DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR;
|
|
15386
|
-
|
|
15387
|
-
// ../vuu-utils/src/json-utils.ts
|
|
15388
|
-
var { COUNT: COUNT2 } = metadataKeys;
|
|
15389
|
-
|
|
15390
|
-
// ../vuu-utils/src/row-utils.ts
|
|
15391
|
-
var { IDX } = metadataKeys;
|
|
15392
|
-
|
|
15393
|
-
// ../vuu-utils/src/selection-utils.ts
|
|
15394
|
-
var { SELECTED } = metadataKeys;
|
|
15395
|
-
var RowSelected = {
|
|
15396
|
-
False: 0,
|
|
15397
|
-
True: 1,
|
|
15398
|
-
First: 2,
|
|
15399
|
-
Last: 4
|
|
15400
|
-
};
|
|
15401
|
-
var SINGLE_SELECTED_ROW = RowSelected.True + RowSelected.First + RowSelected.Last;
|
|
15402
|
-
var FIRST_SELECTED_ROW_OF_BLOCK = RowSelected.True + RowSelected.First;
|
|
15403
|
-
var LAST_SELECTED_ROW_OF_BLOCK = RowSelected.True + RowSelected.Last;
|
|
15404
|
-
|
|
15405
|
-
// ../../node_modules/html-to-image/es/util.js
|
|
15406
|
-
var uuid = (() => {
|
|
15407
|
-
let counter = 0;
|
|
15408
|
-
const random = () => (
|
|
15409
|
-
// eslint-disable-next-line no-bitwise
|
|
15410
|
-
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
15411
|
-
);
|
|
15412
|
-
return () => {
|
|
15413
|
-
counter += 1;
|
|
15414
|
-
return `u${random()}${counter}`;
|
|
15415
|
-
};
|
|
15416
|
-
})();
|
|
15417
|
-
|
|
15418
15139
|
// src/suggestion-utils.ts
|
|
15419
15140
|
var NO_OPTIONS = {};
|
|
15420
15141
|
var applyWithCursorMove = () => (view, completion, from) => {
|