@vuu-ui/vuu-codemirror 0.6.13-debug → 0.6.14-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 +501 -131
- package/cjs/index.js.map +4 -4
- package/esm/index.js +502 -131
- package/esm/index.js.map +4 -4
- package/package.json +3 -2
package/cjs/index.js
CHANGED
|
@@ -16,31 +16,58 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __accessCheck = (obj, member, msg) => {
|
|
20
|
+
if (!member.has(obj))
|
|
21
|
+
throw TypeError("Cannot " + msg);
|
|
22
|
+
};
|
|
23
|
+
var __privateGet = (obj, member, getter) => {
|
|
24
|
+
__accessCheck(obj, member, "read from private field");
|
|
25
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
26
|
+
};
|
|
27
|
+
var __privateAdd = (obj, member, value) => {
|
|
28
|
+
if (member.has(obj))
|
|
29
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
30
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
31
|
+
};
|
|
19
32
|
|
|
20
33
|
// src/index.ts
|
|
21
34
|
var src_exports = {};
|
|
22
35
|
__export(src_exports, {
|
|
36
|
+
AnnotationType: () => AnnotationType,
|
|
23
37
|
EditorState: () => EditorState,
|
|
24
38
|
EditorView: () => EditorView,
|
|
25
39
|
HighlightStyle: () => HighlightStyle,
|
|
26
40
|
LRLanguage: () => LRLanguage,
|
|
27
41
|
LRParser: () => LRParser,
|
|
28
42
|
LanguageSupport: () => LanguageSupport,
|
|
43
|
+
asNameSuggestion: () => asNameSuggestion,
|
|
29
44
|
autocompletion: () => autocompletion,
|
|
45
|
+
booleanJoinSuggestions: () => booleanJoinSuggestions,
|
|
30
46
|
closeBrackets: () => closeBrackets,
|
|
31
47
|
defaultHighlightStyle: () => defaultHighlightStyle,
|
|
32
48
|
defaultKeymap: () => defaultKeymap,
|
|
33
49
|
drawSelection: () => drawSelection,
|
|
34
50
|
ensureSyntaxTree: () => ensureSyntaxTree,
|
|
51
|
+
equalityOperators: () => equalityOperators,
|
|
52
|
+
getNamedParentNode: () => getNamedParentNode,
|
|
53
|
+
getNodeByName: () => getNodeByName,
|
|
54
|
+
getPreviousNamedNode: () => getPreviousNamedNode,
|
|
55
|
+
getPreviousNode: () => getPreviousNode,
|
|
56
|
+
getRelationalOperators: () => getRelationalOperators,
|
|
57
|
+
getValue: () => getValue,
|
|
35
58
|
highlightSpecialChars: () => highlightSpecialChars,
|
|
36
59
|
history: () => history,
|
|
37
60
|
historyKeymap: () => historyKeymap,
|
|
38
61
|
keymap: () => keymap,
|
|
62
|
+
minimalSetup: () => minimalSetup,
|
|
63
|
+
numericOperators: () => numericOperators,
|
|
39
64
|
startCompletion: () => startCompletion,
|
|
65
|
+
stringOperators: () => stringOperators,
|
|
40
66
|
styleTags: () => styleTags,
|
|
41
67
|
syntaxHighlighting: () => syntaxHighlighting,
|
|
42
68
|
syntaxTree: () => syntaxTree,
|
|
43
|
-
tags: () => tags
|
|
69
|
+
tags: () => tags,
|
|
70
|
+
toSuggestions: () => toSuggestions
|
|
44
71
|
});
|
|
45
72
|
module.exports = __toCommonJS(src_exports);
|
|
46
73
|
|
|
@@ -192,10 +219,10 @@ var Text = class {
|
|
|
192
219
|
}
|
|
193
220
|
};
|
|
194
221
|
var TextLeaf = class extends Text {
|
|
195
|
-
constructor(text,
|
|
222
|
+
constructor(text, length2 = textLength(text)) {
|
|
196
223
|
super();
|
|
197
224
|
this.text = text;
|
|
198
|
-
this.length =
|
|
225
|
+
this.length = length2;
|
|
199
226
|
}
|
|
200
227
|
get lines() {
|
|
201
228
|
return this.text.length;
|
|
@@ -272,10 +299,10 @@ var TextLeaf = class extends Text {
|
|
|
272
299
|
}
|
|
273
300
|
};
|
|
274
301
|
var TextNode = class extends Text {
|
|
275
|
-
constructor(children,
|
|
302
|
+
constructor(children, length2) {
|
|
276
303
|
super();
|
|
277
304
|
this.children = children;
|
|
278
|
-
this.length =
|
|
305
|
+
this.length = length2;
|
|
279
306
|
this.lines = 0;
|
|
280
307
|
for (let child of children)
|
|
281
308
|
this.lines += child.lines;
|
|
@@ -339,18 +366,18 @@ var TextNode = class extends Text {
|
|
|
339
366
|
scanIdentical(other, dir) {
|
|
340
367
|
if (!(other instanceof TextNode))
|
|
341
368
|
return 0;
|
|
342
|
-
let
|
|
369
|
+
let length2 = 0;
|
|
343
370
|
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];
|
|
344
371
|
for (; ; iA += dir, iB += dir) {
|
|
345
372
|
if (iA == eA || iB == eB)
|
|
346
|
-
return
|
|
373
|
+
return length2;
|
|
347
374
|
let chA = this.children[iA], chB = other.children[iB];
|
|
348
375
|
if (chA != chB)
|
|
349
|
-
return
|
|
350
|
-
|
|
376
|
+
return length2 + chA.scanIdentical(chB, dir);
|
|
377
|
+
length2 += chA.length + 1;
|
|
351
378
|
}
|
|
352
379
|
}
|
|
353
|
-
static from(children,
|
|
380
|
+
static from(children, length2 = children.reduce((l, ch) => l + ch.length + 1, -1)) {
|
|
354
381
|
let lines = 0;
|
|
355
382
|
for (let ch of children)
|
|
356
383
|
lines += ch.lines;
|
|
@@ -358,7 +385,7 @@ var TextNode = class extends Text {
|
|
|
358
385
|
let flat = [];
|
|
359
386
|
for (let ch of children)
|
|
360
387
|
ch.flatten(flat);
|
|
361
|
-
return new TextLeaf(flat,
|
|
388
|
+
return new TextLeaf(flat, length2);
|
|
362
389
|
}
|
|
363
390
|
let chunk = Math.max(
|
|
364
391
|
32,
|
|
@@ -396,15 +423,15 @@ var TextNode = class extends Text {
|
|
|
396
423
|
for (let child of children)
|
|
397
424
|
add(child);
|
|
398
425
|
flush();
|
|
399
|
-
return chunked.length == 1 ? chunked[0] : new TextNode(chunked,
|
|
426
|
+
return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length2);
|
|
400
427
|
}
|
|
401
428
|
};
|
|
402
429
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
403
430
|
function textLength(text) {
|
|
404
|
-
let
|
|
431
|
+
let length2 = -1;
|
|
405
432
|
for (let line of text)
|
|
406
|
-
|
|
407
|
-
return
|
|
433
|
+
length2 += line.length + 1;
|
|
434
|
+
return length2;
|
|
408
435
|
}
|
|
409
436
|
function appendText(text, target, from = 0, to = 1e9) {
|
|
410
437
|
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
@@ -976,14 +1003,14 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
976
1003
|
Create a change set for the given changes, for a document of the
|
|
977
1004
|
given length, using `lineSep` as line separator.
|
|
978
1005
|
*/
|
|
979
|
-
static of(changes,
|
|
1006
|
+
static of(changes, length2, lineSep) {
|
|
980
1007
|
let sections = [], inserted = [], pos = 0;
|
|
981
1008
|
let total = null;
|
|
982
1009
|
function flush(force = false) {
|
|
983
1010
|
if (!force && !sections.length)
|
|
984
1011
|
return;
|
|
985
|
-
if (pos <
|
|
986
|
-
addSection(sections,
|
|
1012
|
+
if (pos < length2)
|
|
1013
|
+
addSection(sections, length2 - pos, -1);
|
|
987
1014
|
let set = new ChangeSet(sections, inserted);
|
|
988
1015
|
total = total ? total.compose(set.map(total)) : set;
|
|
989
1016
|
sections = [];
|
|
@@ -995,14 +1022,14 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
995
1022
|
for (let sub of spec)
|
|
996
1023
|
process2(sub);
|
|
997
1024
|
} else if (spec instanceof ChangeSet) {
|
|
998
|
-
if (spec.length !=
|
|
999
|
-
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${
|
|
1025
|
+
if (spec.length != length2)
|
|
1026
|
+
throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length2})`);
|
|
1000
1027
|
flush();
|
|
1001
1028
|
total = total ? total.compose(spec.map(total)) : spec;
|
|
1002
1029
|
} else {
|
|
1003
1030
|
let { from, to = from, insert: insert2 } = spec;
|
|
1004
|
-
if (from > to || from < 0 || to >
|
|
1005
|
-
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${
|
|
1031
|
+
if (from > to || from < 0 || to > length2)
|
|
1032
|
+
throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length2})`);
|
|
1006
1033
|
let insText = !insert2 ? Text.empty : typeof insert2 == "string" ? Text.of(insert2.split(lineSep || DefaultSplit)) : insert2;
|
|
1007
1034
|
let insLen = insText.length;
|
|
1008
1035
|
if (from == to && insLen == 0)
|
|
@@ -1023,8 +1050,8 @@ var ChangeSet = class extends ChangeDesc {
|
|
|
1023
1050
|
/**
|
|
1024
1051
|
Create an empty changeset of the given length.
|
|
1025
1052
|
*/
|
|
1026
|
-
static empty(
|
|
1027
|
-
return new ChangeSet(
|
|
1053
|
+
static empty(length2) {
|
|
1054
|
+
return new ChangeSet(length2 ? [length2, -1] : [], []);
|
|
1028
1055
|
}
|
|
1029
1056
|
/**
|
|
1030
1057
|
Create a changeset from its JSON representation (as produced by
|
|
@@ -2558,7 +2585,7 @@ var EditorState = class {
|
|
|
2558
2585
|
this returns null.
|
|
2559
2586
|
*/
|
|
2560
2587
|
wordAt(pos) {
|
|
2561
|
-
let { text, from, length } = this.doc.lineAt(pos);
|
|
2588
|
+
let { text, from, length: length2 } = this.doc.lineAt(pos);
|
|
2562
2589
|
let cat = this.charCategorizer(pos);
|
|
2563
2590
|
let start = pos - from, end = pos - from;
|
|
2564
2591
|
while (start > 0) {
|
|
@@ -2567,7 +2594,7 @@ var EditorState = class {
|
|
|
2567
2594
|
break;
|
|
2568
2595
|
start = prev;
|
|
2569
2596
|
}
|
|
2570
|
-
while (end <
|
|
2597
|
+
while (end < length2) {
|
|
2571
2598
|
let next = findClusterBreak(text, end);
|
|
2572
2599
|
if (cat(text.slice(end, next)) != CharCategory.Word)
|
|
2573
2600
|
break;
|
|
@@ -2860,7 +2887,7 @@ var RangeSet = class {
|
|
|
2860
2887
|
let sharedChunks = findSharedChunks(a, b, textDiff);
|
|
2861
2888
|
let sideA = new SpanCursor(a, sharedChunks, minPointSize);
|
|
2862
2889
|
let sideB = new SpanCursor(b, sharedChunks, minPointSize);
|
|
2863
|
-
textDiff.iterGaps((fromA, fromB,
|
|
2890
|
+
textDiff.iterGaps((fromA, fromB, length2) => compare(sideA, fromA, sideB, fromB, length2, comparator));
|
|
2864
2891
|
if (textDiff.empty && textDiff.length == 0)
|
|
2865
2892
|
compare(sideA, 0, sideB, 0, 0, comparator);
|
|
2866
2893
|
}
|
|
@@ -3312,10 +3339,10 @@ var SpanCursor = class {
|
|
|
3312
3339
|
return open;
|
|
3313
3340
|
}
|
|
3314
3341
|
};
|
|
3315
|
-
function compare(a, startA, b, startB,
|
|
3342
|
+
function compare(a, startA, b, startB, length2, comparator) {
|
|
3316
3343
|
a.goto(startA);
|
|
3317
3344
|
b.goto(startB);
|
|
3318
|
-
let endB = startB +
|
|
3345
|
+
let endB = startB + length2;
|
|
3319
3346
|
let pos = startB, dPos = startB - startA;
|
|
3320
3347
|
for (; ; ) {
|
|
3321
3348
|
let diff = a.to + dPos - b.to || a.endSide - b.endSide;
|
|
@@ -3466,11 +3493,11 @@ var StyleSet = class {
|
|
|
3466
3493
|
constructor(root) {
|
|
3467
3494
|
if (!root.head && root.adoptedStyleSheets && typeof CSSStyleSheet != "undefined") {
|
|
3468
3495
|
if (adoptedSet) {
|
|
3469
|
-
root.adoptedStyleSheets = [adoptedSet.sheet
|
|
3496
|
+
root.adoptedStyleSheets = [adoptedSet.sheet, ...root.adoptedStyleSheets];
|
|
3470
3497
|
return root[SET] = adoptedSet;
|
|
3471
3498
|
}
|
|
3472
3499
|
this.sheet = new CSSStyleSheet();
|
|
3473
|
-
root.adoptedStyleSheets = [this.sheet
|
|
3500
|
+
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
3474
3501
|
adoptedSet = this;
|
|
3475
3502
|
} else {
|
|
3476
3503
|
this.styleTag = (root.ownerDocument || root).createElement("style");
|
|
@@ -4329,11 +4356,11 @@ var TextView = class extends ContentView {
|
|
|
4329
4356
|
}
|
|
4330
4357
|
};
|
|
4331
4358
|
var MarkView = class extends ContentView {
|
|
4332
|
-
constructor(mark, children = [],
|
|
4359
|
+
constructor(mark, children = [], length2 = 0) {
|
|
4333
4360
|
super();
|
|
4334
4361
|
this.mark = mark;
|
|
4335
4362
|
this.children = children;
|
|
4336
|
-
this.length =
|
|
4363
|
+
this.length = length2;
|
|
4337
4364
|
for (let ch of children)
|
|
4338
4365
|
ch.setParent(this);
|
|
4339
4366
|
}
|
|
@@ -4377,13 +4404,13 @@ var MarkView = class extends ContentView {
|
|
|
4377
4404
|
off = end;
|
|
4378
4405
|
i++;
|
|
4379
4406
|
}
|
|
4380
|
-
let
|
|
4407
|
+
let length2 = this.length - from;
|
|
4381
4408
|
this.length = from;
|
|
4382
4409
|
if (detachFrom > -1) {
|
|
4383
4410
|
this.children.length = detachFrom;
|
|
4384
4411
|
this.markDirty();
|
|
4385
4412
|
}
|
|
4386
|
-
return new MarkView(this.mark, result,
|
|
4413
|
+
return new MarkView(this.mark, result, length2);
|
|
4387
4414
|
}
|
|
4388
4415
|
domAtPos(pos) {
|
|
4389
4416
|
return inlineDOMAtPos(this, pos);
|
|
@@ -4393,16 +4420,16 @@ var MarkView = class extends ContentView {
|
|
|
4393
4420
|
}
|
|
4394
4421
|
};
|
|
4395
4422
|
function textCoords(text, pos, side) {
|
|
4396
|
-
let
|
|
4397
|
-
if (pos >
|
|
4398
|
-
pos =
|
|
4423
|
+
let length2 = text.nodeValue.length;
|
|
4424
|
+
if (pos > length2)
|
|
4425
|
+
pos = length2;
|
|
4399
4426
|
let from = pos, to = pos, flatten2 = 0;
|
|
4400
|
-
if (pos == 0 && side < 0 || pos ==
|
|
4427
|
+
if (pos == 0 && side < 0 || pos == length2 && side >= 0) {
|
|
4401
4428
|
if (!(browser.chrome || browser.gecko)) {
|
|
4402
4429
|
if (pos) {
|
|
4403
4430
|
from--;
|
|
4404
4431
|
flatten2 = 1;
|
|
4405
|
-
} else if (to <
|
|
4432
|
+
} else if (to < length2) {
|
|
4406
4433
|
to++;
|
|
4407
4434
|
flatten2 = -1;
|
|
4408
4435
|
}
|
|
@@ -4410,7 +4437,7 @@ function textCoords(text, pos, side) {
|
|
|
4410
4437
|
} else {
|
|
4411
4438
|
if (side < 0)
|
|
4412
4439
|
from--;
|
|
4413
|
-
else if (to <
|
|
4440
|
+
else if (to < length2)
|
|
4414
4441
|
to++;
|
|
4415
4442
|
}
|
|
4416
4443
|
let rects = textRange(text, from, to).getClientRects();
|
|
@@ -4422,15 +4449,15 @@ function textCoords(text, pos, side) {
|
|
|
4422
4449
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
4423
4450
|
}
|
|
4424
4451
|
var WidgetView = class extends ContentView {
|
|
4425
|
-
constructor(widget,
|
|
4452
|
+
constructor(widget, length2, side) {
|
|
4426
4453
|
super();
|
|
4427
4454
|
this.widget = widget;
|
|
4428
|
-
this.length =
|
|
4455
|
+
this.length = length2;
|
|
4429
4456
|
this.side = side;
|
|
4430
4457
|
this.prevWidget = null;
|
|
4431
4458
|
}
|
|
4432
|
-
static create(widget,
|
|
4433
|
-
return new (widget.customView || WidgetView)(widget,
|
|
4459
|
+
static create(widget, length2, side) {
|
|
4460
|
+
return new (widget.customView || WidgetView)(widget, length2, side);
|
|
4434
4461
|
}
|
|
4435
4462
|
split(from) {
|
|
4436
4463
|
let result = WidgetView.create(this.widget, this.length - from, this.side);
|
|
@@ -4573,8 +4600,9 @@ function scanCompositionTree(pos, side, view, text, enterView, fromText) {
|
|
|
4573
4600
|
}
|
|
4574
4601
|
function posFromDOMInCompositionTree(node, offset, view, text) {
|
|
4575
4602
|
if (view instanceof MarkView) {
|
|
4603
|
+
let pos = 0;
|
|
4576
4604
|
for (let child of view.children) {
|
|
4577
|
-
let
|
|
4605
|
+
let hasComp = contains(child.dom, text);
|
|
4578
4606
|
if (contains(child.dom, node))
|
|
4579
4607
|
return pos + (hasComp ? posFromDOMInCompositionTree(node, offset, child, text) : child.localPosFromDOM(node, offset));
|
|
4580
4608
|
pos += hasComp ? text.nodeValue.length : child.length;
|
|
@@ -4613,7 +4641,7 @@ var WidgetBufferView = class extends ContentView {
|
|
|
4613
4641
|
return this.side;
|
|
4614
4642
|
}
|
|
4615
4643
|
domAtPos(pos) {
|
|
4616
|
-
return DOMPos.before(this.dom);
|
|
4644
|
+
return this.side > 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom);
|
|
4617
4645
|
}
|
|
4618
4646
|
localPosFromDOM() {
|
|
4619
4647
|
return 0;
|
|
@@ -5085,7 +5113,7 @@ var LineView = class extends ContentView {
|
|
|
5085
5113
|
measureTextSize() {
|
|
5086
5114
|
if (this.children.length == 0 || this.length > 20)
|
|
5087
5115
|
return null;
|
|
5088
|
-
let totalWidth = 0;
|
|
5116
|
+
let totalWidth = 0, textHeight;
|
|
5089
5117
|
for (let child of this.children) {
|
|
5090
5118
|
if (!(child instanceof TextView) || /[^ -~]/.test(child.text))
|
|
5091
5119
|
return null;
|
|
@@ -5093,14 +5121,24 @@ var LineView = class extends ContentView {
|
|
|
5093
5121
|
if (rects.length != 1)
|
|
5094
5122
|
return null;
|
|
5095
5123
|
totalWidth += rects[0].width;
|
|
5124
|
+
textHeight = rects[0].height;
|
|
5096
5125
|
}
|
|
5097
5126
|
return !totalWidth ? null : {
|
|
5098
5127
|
lineHeight: this.dom.getBoundingClientRect().height,
|
|
5099
|
-
charWidth: totalWidth / this.length
|
|
5128
|
+
charWidth: totalWidth / this.length,
|
|
5129
|
+
textHeight
|
|
5100
5130
|
};
|
|
5101
5131
|
}
|
|
5102
5132
|
coordsAt(pos, side) {
|
|
5103
|
-
|
|
5133
|
+
let rect = coordsInChildren(this, pos, side);
|
|
5134
|
+
if (!this.children.length && rect && this.parent) {
|
|
5135
|
+
let { heightOracle } = this.parent.view.viewState, height = rect.bottom - rect.top;
|
|
5136
|
+
if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) {
|
|
5137
|
+
let dist = (height - heightOracle.textHeight) / 2;
|
|
5138
|
+
return { top: rect.top + dist, bottom: rect.bottom - dist, left: rect.left, right: rect.left };
|
|
5139
|
+
}
|
|
5140
|
+
}
|
|
5141
|
+
return rect;
|
|
5104
5142
|
}
|
|
5105
5143
|
become(_other) {
|
|
5106
5144
|
return false;
|
|
@@ -5123,10 +5161,10 @@ var LineView = class extends ContentView {
|
|
|
5123
5161
|
}
|
|
5124
5162
|
};
|
|
5125
5163
|
var BlockWidgetView = class extends ContentView {
|
|
5126
|
-
constructor(widget,
|
|
5164
|
+
constructor(widget, length2, type) {
|
|
5127
5165
|
super();
|
|
5128
5166
|
this.widget = widget;
|
|
5129
|
-
this.length =
|
|
5167
|
+
this.length = length2;
|
|
5130
5168
|
this.type = type;
|
|
5131
5169
|
this.breakAfter = 0;
|
|
5132
5170
|
this.prevWidget = null;
|
|
@@ -5247,8 +5285,8 @@ var ContentBuilder = class {
|
|
|
5247
5285
|
if (!this.posCovered())
|
|
5248
5286
|
this.getLine();
|
|
5249
5287
|
}
|
|
5250
|
-
buildText(
|
|
5251
|
-
while (
|
|
5288
|
+
buildText(length2, active, openStart) {
|
|
5289
|
+
while (length2 > 0) {
|
|
5252
5290
|
if (this.textOff == this.text.length) {
|
|
5253
5291
|
let { value, lineBreak, done } = this.cursor.next(this.skip);
|
|
5254
5292
|
this.skip = 0;
|
|
@@ -5264,7 +5302,7 @@ var ContentBuilder = class {
|
|
|
5264
5302
|
this.flushBuffer();
|
|
5265
5303
|
this.curLine = null;
|
|
5266
5304
|
this.atCursorPos = true;
|
|
5267
|
-
|
|
5305
|
+
length2--;
|
|
5268
5306
|
continue;
|
|
5269
5307
|
} else {
|
|
5270
5308
|
this.text = value;
|
|
@@ -5273,7 +5311,7 @@ var ContentBuilder = class {
|
|
|
5273
5311
|
}
|
|
5274
5312
|
let take = Math.min(
|
|
5275
5313
|
this.text.length - this.textOff,
|
|
5276
|
-
|
|
5314
|
+
length2,
|
|
5277
5315
|
512
|
|
5278
5316
|
/* T.Chunk */
|
|
5279
5317
|
);
|
|
@@ -5281,7 +5319,7 @@ var ContentBuilder = class {
|
|
|
5281
5319
|
this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);
|
|
5282
5320
|
this.atCursorPos = true;
|
|
5283
5321
|
this.textOff += take;
|
|
5284
|
-
|
|
5322
|
+
length2 -= take;
|
|
5285
5323
|
openStart = 0;
|
|
5286
5324
|
}
|
|
5287
5325
|
}
|
|
@@ -5793,8 +5831,8 @@ function computeOrder(line, direction) {
|
|
|
5793
5831
|
}
|
|
5794
5832
|
return order;
|
|
5795
5833
|
}
|
|
5796
|
-
function trivialOrder(
|
|
5797
|
-
return [new BidiSpan(0,
|
|
5834
|
+
function trivialOrder(length2) {
|
|
5835
|
+
return [new BidiSpan(0, length2, 0)];
|
|
5798
5836
|
}
|
|
5799
5837
|
var movedOver = "";
|
|
5800
5838
|
function moveVisually(line, order, dir, start, forward) {
|
|
@@ -6193,7 +6231,7 @@ var DocView = class extends ContentView {
|
|
|
6193
6231
|
return measure;
|
|
6194
6232
|
}
|
|
6195
6233
|
}
|
|
6196
|
-
let dummy = document.createElement("div"), lineHeight, charWidth;
|
|
6234
|
+
let dummy = document.createElement("div"), lineHeight, charWidth, textHeight;
|
|
6197
6235
|
dummy.className = "cm-line";
|
|
6198
6236
|
dummy.style.width = "99999px";
|
|
6199
6237
|
dummy.textContent = "abc def ghi jkl mno pqr stu";
|
|
@@ -6202,9 +6240,10 @@ var DocView = class extends ContentView {
|
|
|
6202
6240
|
let rect = clientRectsFor(dummy.firstChild)[0];
|
|
6203
6241
|
lineHeight = dummy.getBoundingClientRect().height;
|
|
6204
6242
|
charWidth = rect ? rect.width / 27 : 7;
|
|
6243
|
+
textHeight = rect ? rect.height : lineHeight;
|
|
6205
6244
|
dummy.remove();
|
|
6206
6245
|
});
|
|
6207
|
-
return { lineHeight, charWidth };
|
|
6246
|
+
return { lineHeight, charWidth, textHeight };
|
|
6208
6247
|
}
|
|
6209
6248
|
childCursor(pos = this.length) {
|
|
6210
6249
|
let i = this.children.length;
|
|
@@ -6378,20 +6417,30 @@ var CompositionWidget = class extends WidgetType {
|
|
|
6378
6417
|
return CompositionView;
|
|
6379
6418
|
}
|
|
6380
6419
|
};
|
|
6381
|
-
function nearbyTextNode(
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
node
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
return null;
|
|
6420
|
+
function nearbyTextNode(startNode, startOffset, side) {
|
|
6421
|
+
if (side <= 0)
|
|
6422
|
+
for (let node = startNode, offset = startOffset; ; ) {
|
|
6423
|
+
if (node.nodeType == 3)
|
|
6424
|
+
return node;
|
|
6425
|
+
if (node.nodeType == 1 && offset > 0) {
|
|
6426
|
+
node = node.childNodes[offset - 1];
|
|
6427
|
+
offset = maxOffset(node);
|
|
6428
|
+
} else {
|
|
6429
|
+
break;
|
|
6430
|
+
}
|
|
6393
6431
|
}
|
|
6394
|
-
|
|
6432
|
+
if (side >= 0)
|
|
6433
|
+
for (let node = startNode, offset = startOffset; ; ) {
|
|
6434
|
+
if (node.nodeType == 3)
|
|
6435
|
+
return node;
|
|
6436
|
+
if (node.nodeType == 1 && offset < node.childNodes.length && side >= 0) {
|
|
6437
|
+
node = node.childNodes[offset];
|
|
6438
|
+
offset = 0;
|
|
6439
|
+
} else {
|
|
6440
|
+
break;
|
|
6441
|
+
}
|
|
6442
|
+
}
|
|
6443
|
+
return null;
|
|
6395
6444
|
}
|
|
6396
6445
|
function nextToUneditable(node, offset) {
|
|
6397
6446
|
if (node.nodeType != 1)
|
|
@@ -6547,7 +6596,7 @@ function domPosInText(node, x, y) {
|
|
|
6547
6596
|
return { node, offset: closestOffset > -1 ? closestOffset : generalSide > 0 ? node.nodeValue.length : 0 };
|
|
6548
6597
|
}
|
|
6549
6598
|
function posAtCoords(view, coords, precise, bias = -1) {
|
|
6550
|
-
var _a2;
|
|
6599
|
+
var _a2, _b;
|
|
6551
6600
|
let content2 = view.contentDOM.getBoundingClientRect(), docTop = content2.top + view.viewState.paddingTop;
|
|
6552
6601
|
let block, { docHeight } = view.viewState;
|
|
6553
6602
|
let { x, y } = coords, yOffset = y - docTop;
|
|
@@ -6610,7 +6659,7 @@ function posAtCoords(view, coords, precise, bias = -1) {
|
|
|
6610
6659
|
let nearest = view.docView.nearest(node);
|
|
6611
6660
|
if (!nearest)
|
|
6612
6661
|
return null;
|
|
6613
|
-
if (nearest.isWidget) {
|
|
6662
|
+
if (nearest.isWidget && ((_b = nearest.dom) === null || _b === void 0 ? void 0 : _b.nodeType) == 1) {
|
|
6614
6663
|
let rect = nearest.dom.getBoundingClientRect();
|
|
6615
6664
|
return coords.y < rect.top || coords.y <= rect.bottom && coords.x <= (rect.left + rect.right) / 2 ? nearest.posAtStart : nearest.posAtEnd;
|
|
6616
6665
|
} else {
|
|
@@ -6783,8 +6832,14 @@ var InputState = class {
|
|
|
6783
6832
|
this.registeredEvents.push(type);
|
|
6784
6833
|
}
|
|
6785
6834
|
view.scrollDOM.addEventListener("mousedown", (event) => {
|
|
6786
|
-
if (event.target == view.scrollDOM && event.clientY > view.contentDOM.getBoundingClientRect().bottom)
|
|
6835
|
+
if (event.target == view.scrollDOM && event.clientY > view.contentDOM.getBoundingClientRect().bottom) {
|
|
6787
6836
|
handleEvent(handlers.mousedown, event);
|
|
6837
|
+
if (!event.defaultPrevented && event.button == 2) {
|
|
6838
|
+
let start = view.contentDOM.style.minHeight;
|
|
6839
|
+
view.contentDOM.style.minHeight = "100%";
|
|
6840
|
+
setTimeout(() => view.contentDOM.style.minHeight = start, 200);
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6788
6843
|
});
|
|
6789
6844
|
if (browser.chrome && browser.chrome_version == 102) {
|
|
6790
6845
|
view.scrollDOM.addEventListener("wheel", () => {
|
|
@@ -7269,7 +7324,7 @@ handlers.paste = (view, event) => {
|
|
|
7269
7324
|
view.observer.flush();
|
|
7270
7325
|
let data = brokenClipboardAPI ? null : event.clipboardData;
|
|
7271
7326
|
if (data) {
|
|
7272
|
-
doPaste(view, data.getData("text/plain"));
|
|
7327
|
+
doPaste(view, data.getData("text/plain") || data.getData("text/uri-text"));
|
|
7273
7328
|
event.preventDefault();
|
|
7274
7329
|
} else {
|
|
7275
7330
|
capturePaste(view);
|
|
@@ -7412,6 +7467,7 @@ var HeightOracle = class {
|
|
|
7412
7467
|
this.heightSamples = {};
|
|
7413
7468
|
this.lineHeight = 14;
|
|
7414
7469
|
this.charWidth = 7;
|
|
7470
|
+
this.textHeight = 14;
|
|
7415
7471
|
this.lineLength = 30;
|
|
7416
7472
|
this.heightChanged = false;
|
|
7417
7473
|
}
|
|
@@ -7421,10 +7477,10 @@ var HeightOracle = class {
|
|
|
7421
7477
|
lines += Math.max(0, Math.ceil((to - from - lines * this.lineLength * 0.5) / this.lineLength));
|
|
7422
7478
|
return this.lineHeight * lines;
|
|
7423
7479
|
}
|
|
7424
|
-
heightForLine(
|
|
7480
|
+
heightForLine(length2) {
|
|
7425
7481
|
if (!this.lineWrapping)
|
|
7426
7482
|
return this.lineHeight;
|
|
7427
|
-
let lines = 1 + Math.max(0, Math.ceil((
|
|
7483
|
+
let lines = 1 + Math.max(0, Math.ceil((length2 - this.lineLength) / (this.lineLength - 5)));
|
|
7428
7484
|
return lines * this.lineHeight;
|
|
7429
7485
|
}
|
|
7430
7486
|
setDoc(doc2) {
|
|
@@ -7447,12 +7503,13 @@ var HeightOracle = class {
|
|
|
7447
7503
|
}
|
|
7448
7504
|
return newHeight;
|
|
7449
7505
|
}
|
|
7450
|
-
refresh(whiteSpace, lineHeight, charWidth, lineLength, knownHeights) {
|
|
7506
|
+
refresh(whiteSpace, lineHeight, charWidth, textHeight, lineLength, knownHeights) {
|
|
7451
7507
|
let lineWrapping = wrappingWhiteSpace.indexOf(whiteSpace) > -1;
|
|
7452
7508
|
let changed = Math.round(lineHeight) != Math.round(this.lineHeight) || this.lineWrapping != lineWrapping;
|
|
7453
7509
|
this.lineWrapping = lineWrapping;
|
|
7454
7510
|
this.lineHeight = lineHeight;
|
|
7455
7511
|
this.charWidth = charWidth;
|
|
7512
|
+
this.textHeight = textHeight;
|
|
7456
7513
|
this.lineLength = lineLength;
|
|
7457
7514
|
if (changed) {
|
|
7458
7515
|
this.heightSamples = {};
|
|
@@ -7481,9 +7538,9 @@ var BlockInfo = class {
|
|
|
7481
7538
|
/**
|
|
7482
7539
|
@internal
|
|
7483
7540
|
*/
|
|
7484
|
-
constructor(from,
|
|
7541
|
+
constructor(from, length2, top2, height, type) {
|
|
7485
7542
|
this.from = from;
|
|
7486
|
-
this.length =
|
|
7543
|
+
this.length = length2;
|
|
7487
7544
|
this.top = top2;
|
|
7488
7545
|
this.height = height;
|
|
7489
7546
|
this.type = type;
|
|
@@ -7516,8 +7573,8 @@ var QueryType = /* @__PURE__ */ function(QueryType2) {
|
|
|
7516
7573
|
}(QueryType || (QueryType = {}));
|
|
7517
7574
|
var Epsilon = 1e-3;
|
|
7518
7575
|
var HeightMap = class {
|
|
7519
|
-
constructor(
|
|
7520
|
-
this.length =
|
|
7576
|
+
constructor(length2, height, flags = 2) {
|
|
7577
|
+
this.length = length2;
|
|
7521
7578
|
this.height = height;
|
|
7522
7579
|
this.flags = flags;
|
|
7523
7580
|
}
|
|
@@ -7624,8 +7681,8 @@ var HeightMap = class {
|
|
|
7624
7681
|
};
|
|
7625
7682
|
HeightMap.prototype.size = 1;
|
|
7626
7683
|
var HeightMapBlock = class extends HeightMap {
|
|
7627
|
-
constructor(
|
|
7628
|
-
super(
|
|
7684
|
+
constructor(length2, height, type) {
|
|
7685
|
+
super(length2, height);
|
|
7629
7686
|
this.type = type;
|
|
7630
7687
|
}
|
|
7631
7688
|
blockAt(_height, _oracle, top2, offset) {
|
|
@@ -7649,8 +7706,8 @@ var HeightMapBlock = class extends HeightMap {
|
|
|
7649
7706
|
}
|
|
7650
7707
|
};
|
|
7651
7708
|
var HeightMapText = class extends HeightMapBlock {
|
|
7652
|
-
constructor(
|
|
7653
|
-
super(
|
|
7709
|
+
constructor(length2, height) {
|
|
7710
|
+
super(length2, height, BlockType.Text);
|
|
7654
7711
|
this.collapsed = 0;
|
|
7655
7712
|
this.widgetHeight = 0;
|
|
7656
7713
|
}
|
|
@@ -7681,8 +7738,8 @@ var HeightMapText = class extends HeightMapBlock {
|
|
|
7681
7738
|
}
|
|
7682
7739
|
};
|
|
7683
7740
|
var HeightMapGap = class extends HeightMap {
|
|
7684
|
-
constructor(
|
|
7685
|
-
super(
|
|
7741
|
+
constructor(length2) {
|
|
7742
|
+
super(length2, 0);
|
|
7686
7743
|
}
|
|
7687
7744
|
heightMetrics(oracle, offset) {
|
|
7688
7745
|
let firstLine = oracle.doc.lineAt(offset).number, lastLine = oracle.doc.lineAt(offset + this.length).number;
|
|
@@ -7706,8 +7763,8 @@ var HeightMapGap = class extends HeightMap {
|
|
|
7706
7763
|
return new BlockInfo(line.from, line.length, lineTop, lineHeight, BlockType.Text);
|
|
7707
7764
|
} else {
|
|
7708
7765
|
let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top2) / perLine)));
|
|
7709
|
-
let { from, length } = oracle.doc.line(firstLine + line);
|
|
7710
|
-
return new BlockInfo(from,
|
|
7766
|
+
let { from, length: length2 } = oracle.doc.line(firstLine + line);
|
|
7767
|
+
return new BlockInfo(from, length2, top2 + perLine * line, perLine, BlockType.Text);
|
|
7711
7768
|
}
|
|
7712
7769
|
}
|
|
7713
7770
|
lineAt(value, type, oracle, top2, offset) {
|
|
@@ -8008,12 +8065,12 @@ var NodeBuilder = class {
|
|
|
8008
8065
|
if (block.type != BlockType.WidgetBefore)
|
|
8009
8066
|
this.covering = block;
|
|
8010
8067
|
}
|
|
8011
|
-
addLineDeco(height,
|
|
8068
|
+
addLineDeco(height, length2) {
|
|
8012
8069
|
let line = this.ensureLine();
|
|
8013
|
-
line.length +=
|
|
8014
|
-
line.collapsed +=
|
|
8070
|
+
line.length += length2;
|
|
8071
|
+
line.collapsed += length2;
|
|
8015
8072
|
line.widgetHeight = Math.max(line.widgetHeight, height);
|
|
8016
|
-
this.writtenTo = this.pos = this.pos +
|
|
8073
|
+
this.writtenTo = this.pos = this.pos + length2;
|
|
8017
8074
|
}
|
|
8018
8075
|
finish(from) {
|
|
8019
8076
|
let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
|
|
@@ -8257,8 +8314,8 @@ var ViewState = class {
|
|
|
8257
8314
|
if (oracle.mustRefreshForHeights(lineHeights))
|
|
8258
8315
|
refresh = true;
|
|
8259
8316
|
if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) {
|
|
8260
|
-
let { lineHeight, charWidth } = view.docView.measureTextSize();
|
|
8261
|
-
refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, contentWidth / charWidth, lineHeights);
|
|
8317
|
+
let { lineHeight, charWidth, textHeight } = view.docView.measureTextSize();
|
|
8318
|
+
refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);
|
|
8262
8319
|
if (refresh) {
|
|
8263
8320
|
view.docView.minWidth = 0;
|
|
8264
8321
|
result |= 8;
|
|
@@ -8661,6 +8718,9 @@ var baseTheme$1 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
|
|
|
8661
8718
|
padding: "0 2px 0 6px"
|
|
8662
8719
|
},
|
|
8663
8720
|
".cm-layer": {
|
|
8721
|
+
position: "absolute",
|
|
8722
|
+
left: 0,
|
|
8723
|
+
top: 0,
|
|
8664
8724
|
contain: "size style",
|
|
8665
8725
|
"& > *": {
|
|
8666
8726
|
position: "absolute"
|
|
@@ -9689,7 +9749,7 @@ var EditorView = class {
|
|
|
9689
9749
|
if (this.destroyed)
|
|
9690
9750
|
return;
|
|
9691
9751
|
if (this.measureScheduled > -1)
|
|
9692
|
-
cancelAnimationFrame(this.measureScheduled);
|
|
9752
|
+
this.win.cancelAnimationFrame(this.measureScheduled);
|
|
9693
9753
|
this.measureScheduled = 0;
|
|
9694
9754
|
if (flush)
|
|
9695
9755
|
this.observer.forceFlush();
|
|
@@ -10120,7 +10180,7 @@ var EditorView = class {
|
|
|
10120
10180
|
this.dom.remove();
|
|
10121
10181
|
this.observer.destroy();
|
|
10122
10182
|
if (this.measureScheduled > -1)
|
|
10123
|
-
cancelAnimationFrame(this.measureScheduled);
|
|
10183
|
+
this.win.cancelAnimationFrame(this.measureScheduled);
|
|
10124
10184
|
this.destroyed = true;
|
|
10125
10185
|
}
|
|
10126
10186
|
/**
|
|
@@ -10483,9 +10543,9 @@ function rectanglesForRange(view, className, range) {
|
|
|
10483
10543
|
let from = Math.max(range.from, view.viewport.from), to = Math.min(range.to, view.viewport.to);
|
|
10484
10544
|
let ltr = view.textDirection == Direction.LTR;
|
|
10485
10545
|
let content2 = view.contentDOM, contentRect = content2.getBoundingClientRect(), base2 = getBase(view);
|
|
10486
|
-
let lineStyle = window.getComputedStyle(
|
|
10487
|
-
let leftSide = contentRect.left + parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent));
|
|
10488
|
-
let rightSide = contentRect.right - parseInt(lineStyle.paddingRight);
|
|
10546
|
+
let lineElt = content2.querySelector(".cm-line"), lineStyle = lineElt && window.getComputedStyle(lineElt);
|
|
10547
|
+
let leftSide = contentRect.left + (lineStyle ? parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent)) : 0);
|
|
10548
|
+
let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0);
|
|
10489
10549
|
let startBlock = blockAt(view, from), endBlock = blockAt(view, to);
|
|
10490
10550
|
let visualStart = startBlock.type == BlockType.Text ? startBlock : null;
|
|
10491
10551
|
let visualEnd = endBlock.type == BlockType.Text ? endBlock : null;
|
|
@@ -11473,11 +11533,11 @@ var IterMode;
|
|
|
11473
11533
|
})(IterMode || (IterMode = {}));
|
|
11474
11534
|
var Tree = class {
|
|
11475
11535
|
/// Construct a new tree. See also [`Tree.build`](#common.Tree^build).
|
|
11476
|
-
constructor(type, children, positions,
|
|
11536
|
+
constructor(type, children, positions, length2, props) {
|
|
11477
11537
|
this.type = type;
|
|
11478
11538
|
this.children = children;
|
|
11479
11539
|
this.positions = positions;
|
|
11480
|
-
this.length =
|
|
11540
|
+
this.length = length2;
|
|
11481
11541
|
this.props = null;
|
|
11482
11542
|
if (props && props.length) {
|
|
11483
11543
|
this.props = /* @__PURE__ */ Object.create(null);
|
|
@@ -11590,7 +11650,7 @@ var Tree = class {
|
|
|
11590
11650
|
/// which may have children grouped into subtrees with type
|
|
11591
11651
|
/// [`NodeType.none`](#common.NodeType^none).
|
|
11592
11652
|
balance(config2 = {}) {
|
|
11593
|
-
return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions,
|
|
11653
|
+
return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length2) => new Tree(this.type, children, positions, length2, this.propValues), config2.makeTree || ((children, positions, length2) => new Tree(NodeType.none, children, positions, length2)));
|
|
11594
11654
|
}
|
|
11595
11655
|
/// Build a tree from a postfix-ordered buffer of node information,
|
|
11596
11656
|
/// or a cursor over such a buffer.
|
|
@@ -11628,9 +11688,9 @@ var FlatBufferCursor = class {
|
|
|
11628
11688
|
};
|
|
11629
11689
|
var TreeBuffer = class {
|
|
11630
11690
|
/// Create a tree buffer.
|
|
11631
|
-
constructor(buffer,
|
|
11691
|
+
constructor(buffer, length2, set) {
|
|
11632
11692
|
this.buffer = buffer;
|
|
11633
|
-
this.length =
|
|
11693
|
+
this.length = length2;
|
|
11634
11694
|
this.set = set;
|
|
11635
11695
|
}
|
|
11636
11696
|
/// @internal
|
|
@@ -12441,15 +12501,15 @@ function buildTree(data) {
|
|
|
12441
12501
|
positions2.push(startPos);
|
|
12442
12502
|
}
|
|
12443
12503
|
function makeBalanced(type) {
|
|
12444
|
-
return (children2, positions2,
|
|
12504
|
+
return (children2, positions2, length3) => {
|
|
12445
12505
|
let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp;
|
|
12446
12506
|
if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) {
|
|
12447
|
-
if (!lastI && last.type == type && last.length ==
|
|
12507
|
+
if (!lastI && last.type == type && last.length == length3)
|
|
12448
12508
|
return last;
|
|
12449
12509
|
if (lookAheadProp = last.prop(NodeProp.lookAhead))
|
|
12450
12510
|
lookAhead2 = positions2[lastI] + last.length + lookAheadProp;
|
|
12451
12511
|
}
|
|
12452
|
-
return makeTree(type, children2, positions2,
|
|
12512
|
+
return makeTree(type, children2, positions2, length3, lookAhead2);
|
|
12453
12513
|
};
|
|
12454
12514
|
}
|
|
12455
12515
|
function makeRepeatLeaf(children2, positions2, base2, i, from, to, type, lookAhead2) {
|
|
@@ -12461,7 +12521,7 @@ function buildTree(data) {
|
|
|
12461
12521
|
children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead2 - to));
|
|
12462
12522
|
positions2.push(from - base2);
|
|
12463
12523
|
}
|
|
12464
|
-
function makeTree(type, children2, positions2,
|
|
12524
|
+
function makeTree(type, children2, positions2, length3, lookAhead2 = 0, props) {
|
|
12465
12525
|
if (contextHash) {
|
|
12466
12526
|
let pair2 = [NodeProp.contextHash, contextHash];
|
|
12467
12527
|
props = props ? [pair2].concat(props) : [pair2];
|
|
@@ -12470,7 +12530,7 @@ function buildTree(data) {
|
|
|
12470
12530
|
let pair2 = [NodeProp.lookAhead, lookAhead2];
|
|
12471
12531
|
props = props ? [pair2].concat(props) : [pair2];
|
|
12472
12532
|
}
|
|
12473
|
-
return new Tree(type, children2, positions2,
|
|
12533
|
+
return new Tree(type, children2, positions2, length3, props);
|
|
12474
12534
|
}
|
|
12475
12535
|
function findBufferSize(maxSize, inRepeat) {
|
|
12476
12536
|
let fork = cursor.fork();
|
|
@@ -12540,8 +12600,8 @@ function buildTree(data) {
|
|
|
12540
12600
|
let children = [], positions = [];
|
|
12541
12601
|
while (cursor.pos > 0)
|
|
12542
12602
|
takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1);
|
|
12543
|
-
let
|
|
12544
|
-
return new Tree(types2[data.topID], children.reverse(), positions.reverse(),
|
|
12603
|
+
let length2 = (_a2 = data.length) !== null && _a2 !== void 0 ? _a2 : children.length ? positions[0] + children[0].length : 0;
|
|
12604
|
+
return new Tree(types2[data.topID], children.reverse(), positions.reverse(), length2);
|
|
12545
12605
|
}
|
|
12546
12606
|
var nodeSizeCache = /* @__PURE__ */ new WeakMap();
|
|
12547
12607
|
function nodeSize(balanceType, node) {
|
|
@@ -12561,7 +12621,7 @@ function nodeSize(balanceType, node) {
|
|
|
12561
12621
|
}
|
|
12562
12622
|
return size;
|
|
12563
12623
|
}
|
|
12564
|
-
function balanceRange(balanceType, children, positions, from, to, start,
|
|
12624
|
+
function balanceRange(balanceType, children, positions, from, to, start, length2, mkTop, mkTree) {
|
|
12565
12625
|
let total = 0;
|
|
12566
12626
|
for (let i = from; i < to; i++)
|
|
12567
12627
|
total += nodeSize(balanceType, children[i]);
|
|
@@ -12588,14 +12648,14 @@ function balanceRange(balanceType, children, positions, from, to, start, length,
|
|
|
12588
12648
|
}
|
|
12589
12649
|
localChildren.push(children2[groupFrom]);
|
|
12590
12650
|
} else {
|
|
12591
|
-
let
|
|
12592
|
-
localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i, groupStart,
|
|
12651
|
+
let length3 = positions2[i - 1] + children2[i - 1].length - groupStart;
|
|
12652
|
+
localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i, groupStart, length3, null, mkTree));
|
|
12593
12653
|
}
|
|
12594
12654
|
localPositions.push(groupStart + offset - start);
|
|
12595
12655
|
}
|
|
12596
12656
|
}
|
|
12597
12657
|
divide(children, positions, from, to, 0);
|
|
12598
|
-
return (mkTop || mkTree)(localChildren, localPositions,
|
|
12658
|
+
return (mkTop || mkTree)(localChildren, localPositions, length2);
|
|
12599
12659
|
}
|
|
12600
12660
|
var TreeFragment = class {
|
|
12601
12661
|
/// Construct a tree fragment. You'll usually want to use
|
|
@@ -15153,12 +15213,12 @@ function moveCompletionSelection(forward, by = "option") {
|
|
|
15153
15213
|
let step = 1, tooltip;
|
|
15154
15214
|
if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip)))
|
|
15155
15215
|
step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
|
|
15156
|
-
let { length } = cState.open.options;
|
|
15157
|
-
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 :
|
|
15216
|
+
let { length: length2 } = cState.open.options;
|
|
15217
|
+
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length2 - 1;
|
|
15158
15218
|
if (selected < 0)
|
|
15159
|
-
selected = by == "page" ? 0 :
|
|
15160
|
-
else if (selected >=
|
|
15161
|
-
selected = by == "page" ?
|
|
15219
|
+
selected = by == "page" ? 0 : length2 - 1;
|
|
15220
|
+
else if (selected >= length2)
|
|
15221
|
+
selected = by == "page" ? length2 - 1 : 0;
|
|
15162
15222
|
view.dispatch({ effects: setSelectedEffect.of(selected) });
|
|
15163
15223
|
return true;
|
|
15164
15224
|
};
|
|
@@ -16012,16 +16072,16 @@ function popSelection(branch) {
|
|
|
16012
16072
|
function addMappingToBranch(branch, mapping) {
|
|
16013
16073
|
if (!branch.length)
|
|
16014
16074
|
return branch;
|
|
16015
|
-
let
|
|
16016
|
-
while (
|
|
16017
|
-
let event = mapEvent(branch[
|
|
16075
|
+
let length2 = branch.length, selections = none3;
|
|
16076
|
+
while (length2) {
|
|
16077
|
+
let event = mapEvent(branch[length2 - 1], mapping, selections);
|
|
16018
16078
|
if (event.changes && !event.changes.empty || event.effects.length) {
|
|
16019
|
-
let result = branch.slice(0,
|
|
16020
|
-
result[
|
|
16079
|
+
let result = branch.slice(0, length2);
|
|
16080
|
+
result[length2 - 1] = event;
|
|
16021
16081
|
return result;
|
|
16022
16082
|
} else {
|
|
16023
16083
|
mapping = event.mapped;
|
|
16024
|
-
|
|
16084
|
+
length2--;
|
|
16025
16085
|
selections = event.selectionsAfter;
|
|
16026
16086
|
}
|
|
16027
16087
|
}
|
|
@@ -18290,4 +18350,314 @@ function getSpecializer(spec) {
|
|
|
18290
18350
|
}
|
|
18291
18351
|
return spec.get;
|
|
18292
18352
|
}
|
|
18353
|
+
|
|
18354
|
+
// src/codemirror-basic-setup.ts
|
|
18355
|
+
var keyBindings = [
|
|
18356
|
+
...defaultKeymap,
|
|
18357
|
+
...historyKeymap
|
|
18358
|
+
];
|
|
18359
|
+
var minimalSetup = (() => [
|
|
18360
|
+
highlightSpecialChars(),
|
|
18361
|
+
history(),
|
|
18362
|
+
drawSelection(),
|
|
18363
|
+
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
|
18364
|
+
keymap.of(keyBindings)
|
|
18365
|
+
])();
|
|
18366
|
+
|
|
18367
|
+
// src/parser-utils.ts
|
|
18368
|
+
var getValue = (node, state) => state.doc.sliceString(node.from, node.to);
|
|
18369
|
+
var getNodeByName = (node, state, nodeName = "Column") => {
|
|
18370
|
+
var _a2;
|
|
18371
|
+
if (((_a2 = node.firstChild) == null ? void 0 : _a2.name) === nodeName) {
|
|
18372
|
+
return getValue(node.firstChild, state);
|
|
18373
|
+
} else {
|
|
18374
|
+
let maybeColumnNode = node.prevSibling || node.parent;
|
|
18375
|
+
while (maybeColumnNode && maybeColumnNode.name !== nodeName) {
|
|
18376
|
+
maybeColumnNode = maybeColumnNode.prevSibling || maybeColumnNode.parent;
|
|
18377
|
+
}
|
|
18378
|
+
if (maybeColumnNode) {
|
|
18379
|
+
return getValue(maybeColumnNode, state);
|
|
18380
|
+
}
|
|
18381
|
+
}
|
|
18382
|
+
};
|
|
18383
|
+
var getPreviousNode = (node) => {
|
|
18384
|
+
const prevNode = node.prevSibling;
|
|
18385
|
+
console.log(`prevNode ${prevNode == null ? void 0 : prevNode.name}`);
|
|
18386
|
+
return prevNode;
|
|
18387
|
+
};
|
|
18388
|
+
var getNamedParentNode = (node) => {
|
|
18389
|
+
let maybeParent = node.parent;
|
|
18390
|
+
while (maybeParent && maybeParent.name === "\u26A0") {
|
|
18391
|
+
maybeParent = maybeParent.parent;
|
|
18392
|
+
}
|
|
18393
|
+
return maybeParent;
|
|
18394
|
+
};
|
|
18395
|
+
var getPreviousNamedNode = (node) => {
|
|
18396
|
+
let maybeParent = node.prevSibling;
|
|
18397
|
+
while (maybeParent && maybeParent.name === "\u26A0") {
|
|
18398
|
+
maybeParent = maybeParent.prevSibling;
|
|
18399
|
+
}
|
|
18400
|
+
return maybeParent;
|
|
18401
|
+
};
|
|
18402
|
+
|
|
18403
|
+
// ../vuu-utils/src/column-utils.ts
|
|
18404
|
+
var isNumericColumn = ({ serverDataType, type }) => {
|
|
18405
|
+
if (serverDataType === "int" || serverDataType === "long" || serverDataType === "double") {
|
|
18406
|
+
return true;
|
|
18407
|
+
}
|
|
18408
|
+
if (typeof type === "string") {
|
|
18409
|
+
return type === "number";
|
|
18410
|
+
}
|
|
18411
|
+
if (typeof (type == null ? void 0 : type.name) === "string") {
|
|
18412
|
+
return (type == null ? void 0 : type.name) === "number";
|
|
18413
|
+
}
|
|
18414
|
+
return false;
|
|
18415
|
+
};
|
|
18416
|
+
var metadataKeys = {
|
|
18417
|
+
IDX: 0,
|
|
18418
|
+
RENDER_IDX: 1,
|
|
18419
|
+
IS_LEAF: 2,
|
|
18420
|
+
IS_EXPANDED: 3,
|
|
18421
|
+
DEPTH: 4,
|
|
18422
|
+
COUNT: 5,
|
|
18423
|
+
KEY: 6,
|
|
18424
|
+
SELECTED: 7,
|
|
18425
|
+
count: 8,
|
|
18426
|
+
// TODO following only used in datamodel
|
|
18427
|
+
PARENT_IDX: "parent_idx",
|
|
18428
|
+
IDX_POINTER: "idx_pointer",
|
|
18429
|
+
FILTER_COUNT: "filter_count",
|
|
18430
|
+
NEXT_FILTER_IDX: "next_filter_idx"
|
|
18431
|
+
};
|
|
18432
|
+
|
|
18433
|
+
// ../vuu-utils/src/DataWindow.ts
|
|
18434
|
+
var { KEY } = metadataKeys;
|
|
18435
|
+
|
|
18436
|
+
// ../vuu-utils/src/logging-utils.ts
|
|
18437
|
+
var NO_OP = () => void 0;
|
|
18438
|
+
var DEFAULT_DEBUG_LEVEL = false ? "error" : "info";
|
|
18439
|
+
var { loggingLevel = DEFAULT_DEBUG_LEVEL } = typeof loggingSettings !== "undefined" ? loggingSettings : {};
|
|
18440
|
+
var logger = (category) => {
|
|
18441
|
+
const debugEnabled2 = loggingLevel === "debug";
|
|
18442
|
+
const infoEnabled = debugEnabled2 || loggingLevel === "info";
|
|
18443
|
+
const warnEnabled = infoEnabled || loggingLevel === "warn";
|
|
18444
|
+
const errorEnabled = warnEnabled || loggingLevel === "error";
|
|
18445
|
+
const info = infoEnabled ? (message) => console.info(`[${category}] ${message}`) : NO_OP;
|
|
18446
|
+
const warn = warnEnabled ? (message) => console.warn(`[${category}] ${message}`) : NO_OP;
|
|
18447
|
+
const debug2 = debugEnabled2 ? (message) => console.debug(`[${category}] ${message}`) : NO_OP;
|
|
18448
|
+
const error = errorEnabled ? (message) => console.error(`[${category}] ${message}`) : NO_OP;
|
|
18449
|
+
if (false) {
|
|
18450
|
+
return {
|
|
18451
|
+
errorEnabled,
|
|
18452
|
+
error
|
|
18453
|
+
};
|
|
18454
|
+
} else {
|
|
18455
|
+
return {
|
|
18456
|
+
debugEnabled: debugEnabled2,
|
|
18457
|
+
infoEnabled,
|
|
18458
|
+
warnEnabled,
|
|
18459
|
+
errorEnabled,
|
|
18460
|
+
info,
|
|
18461
|
+
warn,
|
|
18462
|
+
debug: debug2,
|
|
18463
|
+
error
|
|
18464
|
+
};
|
|
18465
|
+
}
|
|
18466
|
+
};
|
|
18467
|
+
|
|
18468
|
+
// ../vuu-utils/src/debug-utils.ts
|
|
18469
|
+
var { debug, debugEnabled } = logger("range-monitor");
|
|
18470
|
+
|
|
18471
|
+
// ../vuu-utils/src/event-emitter.ts
|
|
18472
|
+
function isArrayOfListeners(listeners) {
|
|
18473
|
+
return Array.isArray(listeners);
|
|
18474
|
+
}
|
|
18475
|
+
function isOnlyListener(listeners) {
|
|
18476
|
+
return !Array.isArray(listeners);
|
|
18477
|
+
}
|
|
18478
|
+
var _events;
|
|
18479
|
+
var EventEmitter = class {
|
|
18480
|
+
constructor() {
|
|
18481
|
+
__privateAdd(this, _events, /* @__PURE__ */ new Map());
|
|
18482
|
+
}
|
|
18483
|
+
addListener(event, listener) {
|
|
18484
|
+
const listeners = __privateGet(this, _events).get(event);
|
|
18485
|
+
if (!listeners) {
|
|
18486
|
+
__privateGet(this, _events).set(event, listener);
|
|
18487
|
+
} else if (isArrayOfListeners(listeners)) {
|
|
18488
|
+
listeners.push(listener);
|
|
18489
|
+
} else if (isOnlyListener(listeners)) {
|
|
18490
|
+
__privateGet(this, _events).set(event, [listeners, listener]);
|
|
18491
|
+
}
|
|
18492
|
+
}
|
|
18493
|
+
removeListener(event, listener) {
|
|
18494
|
+
if (!__privateGet(this, _events).has(event)) {
|
|
18495
|
+
return;
|
|
18496
|
+
}
|
|
18497
|
+
const listenerOrListeners = __privateGet(this, _events).get(event);
|
|
18498
|
+
let position = -1;
|
|
18499
|
+
if (listenerOrListeners === listener) {
|
|
18500
|
+
__privateGet(this, _events).delete(event);
|
|
18501
|
+
} else if (Array.isArray(listenerOrListeners)) {
|
|
18502
|
+
for (let i = length; i-- > 0; ) {
|
|
18503
|
+
if (listenerOrListeners[i] === listener) {
|
|
18504
|
+
position = i;
|
|
18505
|
+
break;
|
|
18506
|
+
}
|
|
18507
|
+
}
|
|
18508
|
+
if (position < 0) {
|
|
18509
|
+
return;
|
|
18510
|
+
}
|
|
18511
|
+
if (listenerOrListeners.length === 1) {
|
|
18512
|
+
listenerOrListeners.length = 0;
|
|
18513
|
+
__privateGet(this, _events).delete(event);
|
|
18514
|
+
} else {
|
|
18515
|
+
listenerOrListeners.splice(position, 1);
|
|
18516
|
+
}
|
|
18517
|
+
}
|
|
18518
|
+
}
|
|
18519
|
+
removeAllListeners(event) {
|
|
18520
|
+
if (event && __privateGet(this, _events).has(event)) {
|
|
18521
|
+
__privateGet(this, _events).delete(event);
|
|
18522
|
+
} else if (event === void 0) {
|
|
18523
|
+
__privateGet(this, _events).clear();
|
|
18524
|
+
}
|
|
18525
|
+
}
|
|
18526
|
+
emit(event, ...args) {
|
|
18527
|
+
if (__privateGet(this, _events)) {
|
|
18528
|
+
const handler = __privateGet(this, _events).get(event);
|
|
18529
|
+
if (handler) {
|
|
18530
|
+
this.invokeHandler(handler, args);
|
|
18531
|
+
}
|
|
18532
|
+
}
|
|
18533
|
+
}
|
|
18534
|
+
once(event, listener) {
|
|
18535
|
+
const handler = (...args) => {
|
|
18536
|
+
this.removeListener(event, handler);
|
|
18537
|
+
listener(...args);
|
|
18538
|
+
};
|
|
18539
|
+
this.on(event, handler);
|
|
18540
|
+
}
|
|
18541
|
+
on(event, listener) {
|
|
18542
|
+
this.addListener(event, listener);
|
|
18543
|
+
}
|
|
18544
|
+
invokeHandler(handler, args) {
|
|
18545
|
+
if (isArrayOfListeners(handler)) {
|
|
18546
|
+
handler.slice().forEach((listener) => this.invokeHandler(listener, args));
|
|
18547
|
+
} else {
|
|
18548
|
+
switch (args.length) {
|
|
18549
|
+
case 0:
|
|
18550
|
+
handler();
|
|
18551
|
+
break;
|
|
18552
|
+
case 1:
|
|
18553
|
+
handler(args[0]);
|
|
18554
|
+
break;
|
|
18555
|
+
case 2:
|
|
18556
|
+
handler(args[0], args[1]);
|
|
18557
|
+
break;
|
|
18558
|
+
default:
|
|
18559
|
+
handler.call(null, ...args);
|
|
18560
|
+
}
|
|
18561
|
+
}
|
|
18562
|
+
}
|
|
18563
|
+
};
|
|
18564
|
+
_events = new WeakMap();
|
|
18565
|
+
|
|
18566
|
+
// ../vuu-utils/src/round-decimal.ts
|
|
18567
|
+
var PUNCTUATION_STR = String.fromCharCode(8200);
|
|
18568
|
+
var DIGIT_STR = String.fromCharCode(8199);
|
|
18569
|
+
var Space = {
|
|
18570
|
+
DIGIT: DIGIT_STR,
|
|
18571
|
+
TWO_DIGITS: DIGIT_STR + DIGIT_STR,
|
|
18572
|
+
THREE_DIGITS: DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
18573
|
+
FULL_PADDING: [
|
|
18574
|
+
null,
|
|
18575
|
+
PUNCTUATION_STR + DIGIT_STR,
|
|
18576
|
+
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR,
|
|
18577
|
+
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR,
|
|
18578
|
+
PUNCTUATION_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR
|
|
18579
|
+
]
|
|
18580
|
+
};
|
|
18581
|
+
var LEADING_FILL = DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR + DIGIT_STR;
|
|
18582
|
+
|
|
18583
|
+
// ../vuu-utils/src/input-utils.ts
|
|
18584
|
+
var actionKeys = {
|
|
18585
|
+
Enter: "Enter",
|
|
18586
|
+
Delete: "Delete"
|
|
18587
|
+
};
|
|
18588
|
+
var navigationKeys = {
|
|
18589
|
+
Home: "Home",
|
|
18590
|
+
End: "End",
|
|
18591
|
+
ArrowRight: "ArrowRight",
|
|
18592
|
+
ArrowLeft: "ArrowLeft",
|
|
18593
|
+
ArrowDown: "ArrowDown",
|
|
18594
|
+
ArrowUp: "ArrowUp",
|
|
18595
|
+
Tab: "Tab"
|
|
18596
|
+
};
|
|
18597
|
+
var functionKeys = {
|
|
18598
|
+
F1: "F1",
|
|
18599
|
+
F2: "F2",
|
|
18600
|
+
F3: "F3",
|
|
18601
|
+
F4: "F4",
|
|
18602
|
+
F5: "F5",
|
|
18603
|
+
F6: "F6",
|
|
18604
|
+
F7: "F7",
|
|
18605
|
+
F8: "F8",
|
|
18606
|
+
F9: "F9",
|
|
18607
|
+
F10: "F10",
|
|
18608
|
+
F11: "F11",
|
|
18609
|
+
F12: "F12"
|
|
18610
|
+
};
|
|
18611
|
+
var specialKeys = {
|
|
18612
|
+
...actionKeys,
|
|
18613
|
+
...navigationKeys,
|
|
18614
|
+
...functionKeys
|
|
18615
|
+
};
|
|
18616
|
+
|
|
18617
|
+
// ../vuu-utils/src/json-utils.ts
|
|
18618
|
+
var { COUNT: COUNT2 } = metadataKeys;
|
|
18619
|
+
|
|
18620
|
+
// src/suggestion-utils.ts
|
|
18621
|
+
var NO_OPTIONS = {};
|
|
18622
|
+
var toSuggestions = (values, options = NO_OPTIONS) => {
|
|
18623
|
+
const {
|
|
18624
|
+
prefix = "",
|
|
18625
|
+
quoted = false,
|
|
18626
|
+
suffix = " ",
|
|
18627
|
+
isIllustration = false
|
|
18628
|
+
} = options;
|
|
18629
|
+
const quote = quoted ? '"' : "";
|
|
18630
|
+
return values.map((value) => ({
|
|
18631
|
+
isIllustration,
|
|
18632
|
+
label: value,
|
|
18633
|
+
apply: isIllustration ? `${quote}${prefix}${quote}` : `${prefix}${quote}${value}${quote}${suffix}`
|
|
18634
|
+
}));
|
|
18635
|
+
};
|
|
18636
|
+
var asNameSuggestion = { label: "as", apply: "as ", boost: 1 };
|
|
18637
|
+
var booleanJoinSuggestions = [
|
|
18638
|
+
{ label: "and", apply: "and ", boost: 5 },
|
|
18639
|
+
{ label: "or", apply: "or ", boost: 3 }
|
|
18640
|
+
];
|
|
18641
|
+
var equalityOperators = [
|
|
18642
|
+
{ label: "=", boost: 10, type: "operator" },
|
|
18643
|
+
{ label: "!=", boost: 9, type: "operator" }
|
|
18644
|
+
];
|
|
18645
|
+
var stringOperators = [
|
|
18646
|
+
...equalityOperators,
|
|
18647
|
+
{ label: "in", boost: 6, type: "operator" },
|
|
18648
|
+
{ label: "starts", boost: 5, type: "operator" },
|
|
18649
|
+
{ label: "ends", boost: 4, type: "operator" }
|
|
18650
|
+
];
|
|
18651
|
+
var numericOperators = [
|
|
18652
|
+
...equalityOperators,
|
|
18653
|
+
{ label: ">", boost: 8, type: "operator" },
|
|
18654
|
+
{ label: "<", boost: 7, type: "operator" }
|
|
18655
|
+
];
|
|
18656
|
+
var getRelationalOperators = (column) => {
|
|
18657
|
+
if (column === void 0 || isNumericColumn(column)) {
|
|
18658
|
+
return numericOperators;
|
|
18659
|
+
} else {
|
|
18660
|
+
return equalityOperators;
|
|
18661
|
+
}
|
|
18662
|
+
};
|
|
18293
18663
|
//# sourceMappingURL=index.js.map
|