golden-logic-ui 1.3.19 → 1.3.21
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/dist/components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js +82 -72
- package/dist/components/GeneralComponents/GlCodeMirror.vue.js +137 -90
- package/dist/golden-logic-ui.css +1 -1
- package/dist/node_modules/@codemirror/lang-sql/dist/index.js +518 -0
- package/dist/node_modules/@codemirror/view/dist/index.js +434 -404
- package/package.json +2 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Facet as v, Prec as ki, EditorState as
|
|
1
|
+
import { Facet as v, Prec as ki, EditorState as Mt, StateEffect as Te, Transaction as Ms, Annotation as ks, EditorSelection as C, RangeSet as N, Text as W, ChangeSet as Ai, findClusterBreak as ft, codePointAt as As, codePointSize as Ds, combineConfig as Os, RangeValue as Di, findColumn as Ts, MapMode as kt, CharCategory as Es } from "../../state/dist/index.js";
|
|
2
2
|
import { StyleModule as gt } from "../../../style-mod/src/style-mod.js";
|
|
3
3
|
import { keyName as Rs, base as Bs, shift as Ls } from "../../../w3c-keyname/index.js";
|
|
4
|
-
function
|
|
4
|
+
function Ot(n) {
|
|
5
5
|
let t;
|
|
6
6
|
return n.nodeType == 11 ? t = n.getSelection ? n : n.ownerDocument : t = n, t.getSelection();
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function ce(n, t) {
|
|
9
9
|
return t ? n == t || n.contains(t.nodeType != 1 ? t.parentNode : t) : !1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Kt(n, t) {
|
|
12
12
|
if (!t.anchorNode)
|
|
13
13
|
return !1;
|
|
14
14
|
try {
|
|
15
|
-
return
|
|
15
|
+
return ce(n, t.anchorNode);
|
|
16
16
|
} catch {
|
|
17
17
|
return !1;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return n.nodeType == 3 ?
|
|
20
|
+
function pt(n) {
|
|
21
|
+
return n.nodeType == 3 ? lt(n, 0, n.nodeValue.length).getClientRects() : n.nodeType == 1 ? n.getClientRects() : [];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function At(n, t, e, i) {
|
|
24
24
|
return e ? ze(n, t, e, i, -1) || ze(n, t, e, i, 1) : !1;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ot(n) {
|
|
27
27
|
for (var t = 0; ; t++)
|
|
28
28
|
if (n = n.previousSibling, !n)
|
|
29
29
|
return t;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function $t(n) {
|
|
32
32
|
return n.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName);
|
|
33
33
|
}
|
|
34
34
|
function ze(n, t, e, i, s) {
|
|
@@ -41,7 +41,7 @@ function ze(n, t, e, i, s) {
|
|
|
41
41
|
let r = n.parentNode;
|
|
42
42
|
if (!r || r.nodeType != 1)
|
|
43
43
|
return !1;
|
|
44
|
-
t =
|
|
44
|
+
t = ot(n) + (s < 0 ? 0 : 1), n = r;
|
|
45
45
|
} else if (n.nodeType == 1) {
|
|
46
46
|
if (n = n.childNodes[t + (s < 0 ? -1 : 0)], n.nodeType == 1 && n.contentEditable == "false")
|
|
47
47
|
return !1;
|
|
@@ -53,7 +53,7 @@ function ze(n, t, e, i, s) {
|
|
|
53
53
|
function _(n) {
|
|
54
54
|
return n.nodeType == 3 ? n.nodeValue.length : n.childNodes.length;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Et(n, t) {
|
|
57
57
|
let e = t ? n.left : n.right;
|
|
58
58
|
return { left: e, right: e, top: n.top, bottom: n.bottom };
|
|
59
59
|
}
|
|
@@ -183,7 +183,7 @@ function Ti(n) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
let Ie;
|
|
186
|
-
function
|
|
186
|
+
function lt(n, t, e = t) {
|
|
187
187
|
let i = Ie || (Ie = document.createRange());
|
|
188
188
|
return i.setEnd(n, e), i.setStart(n, t), i;
|
|
189
189
|
}
|
|
@@ -220,7 +220,7 @@ function Ws(n, t) {
|
|
|
220
220
|
} else {
|
|
221
221
|
if (e == n)
|
|
222
222
|
return !0;
|
|
223
|
-
i =
|
|
223
|
+
i = ot(e), e = e.parentNode;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
function Ri(n) {
|
|
@@ -234,8 +234,8 @@ function Bi(n, t) {
|
|
|
234
234
|
if (e.contentEditable == "false")
|
|
235
235
|
return null;
|
|
236
236
|
e = e.childNodes[i - 1], i = _(e);
|
|
237
|
-
} else if (e.parentNode &&
|
|
238
|
-
i =
|
|
237
|
+
} else if (e.parentNode && !$t(e))
|
|
238
|
+
i = ot(e), e = e.parentNode;
|
|
239
239
|
else
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
@@ -248,24 +248,24 @@ function Li(n, t) {
|
|
|
248
248
|
if (e.contentEditable == "false")
|
|
249
249
|
return null;
|
|
250
250
|
e = e.childNodes[i], i = 0;
|
|
251
|
-
} else if (e.parentNode &&
|
|
252
|
-
i =
|
|
251
|
+
} else if (e.parentNode && !$t(e))
|
|
252
|
+
i = ot(e) + 1, e = e.parentNode;
|
|
253
253
|
else
|
|
254
254
|
return null;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class P {
|
|
258
258
|
constructor(t, e, i = !0) {
|
|
259
259
|
this.node = t, this.offset = e, this.precise = i;
|
|
260
260
|
}
|
|
261
261
|
static before(t, e) {
|
|
262
|
-
return new
|
|
262
|
+
return new P(t.parentNode, ot(t), e);
|
|
263
263
|
}
|
|
264
264
|
static after(t, e) {
|
|
265
|
-
return new
|
|
265
|
+
return new P(t.parentNode, ot(t) + 1, e);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const Ee = [];
|
|
269
269
|
class O {
|
|
270
270
|
constructor() {
|
|
271
271
|
this.parent = null, this.dom = null, this.flags = 2;
|
|
@@ -387,7 +387,7 @@ class O {
|
|
|
387
387
|
t = e;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
replaceChildren(t, e, i =
|
|
390
|
+
replaceChildren(t, e, i = Ee) {
|
|
391
391
|
this.markDirty();
|
|
392
392
|
for (let s = t; s < e; s++) {
|
|
393
393
|
let r = this.children[s];
|
|
@@ -487,23 +487,23 @@ function Ni(n, t, e, i, s, r) {
|
|
|
487
487
|
c += d.length;
|
|
488
488
|
n.length += c, Hi(n, f, a, l, h, i, 0, s, r);
|
|
489
489
|
}
|
|
490
|
-
let
|
|
491
|
-
const
|
|
490
|
+
let V = typeof navigator < "u" ? navigator : { userAgent: "", vendor: "", platform: "" }, de = typeof document < "u" ? document : { documentElement: { style: {} } };
|
|
491
|
+
const ue = /* @__PURE__ */ /Edge\/(\d+)/.exec(V.userAgent), Vi = /* @__PURE__ */ /MSIE \d/.test(V.userAgent), ge = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(V.userAgent), Zt = !!(Vi || ge || ue), qe = !Zt && /* @__PURE__ */ /gecko\/(\d+)/i.test(V.userAgent), ie = !Zt && /* @__PURE__ */ /Chrome\/(\d+)/.exec(V.userAgent), zs = "webkitFontSmoothing" in de.documentElement.style, Fi = !Zt && /* @__PURE__ */ /Apple Computer/.test(V.vendor), Ge = Fi && (/* @__PURE__ */ /Mobile\/\w+/.test(V.userAgent) || V.maxTouchPoints > 2);
|
|
492
492
|
var y = {
|
|
493
|
-
mac: Ge || /* @__PURE__ */ /Mac/.test(
|
|
494
|
-
windows: /* @__PURE__ */ /Win/.test(
|
|
495
|
-
linux: /* @__PURE__ */ /Linux|X11/.test(
|
|
493
|
+
mac: Ge || /* @__PURE__ */ /Mac/.test(V.platform),
|
|
494
|
+
windows: /* @__PURE__ */ /Win/.test(V.platform),
|
|
495
|
+
linux: /* @__PURE__ */ /Linux|X11/.test(V.platform),
|
|
496
496
|
ie: Zt,
|
|
497
|
-
ie_version: Vi ?
|
|
497
|
+
ie_version: Vi ? de.documentMode || 6 : ge ? +ge[1] : ue ? +ue[1] : 0,
|
|
498
498
|
gecko: qe,
|
|
499
|
-
gecko_version: qe ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(
|
|
500
|
-
chrome: !!
|
|
501
|
-
chrome_version:
|
|
499
|
+
gecko_version: qe ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(V.userAgent) || [0, 0])[1] : 0,
|
|
500
|
+
chrome: !!ie,
|
|
501
|
+
chrome_version: ie ? +ie[1] : 0,
|
|
502
502
|
ios: Ge,
|
|
503
|
-
android: /* @__PURE__ */ /Android\b/.test(
|
|
503
|
+
android: /* @__PURE__ */ /Android\b/.test(V.userAgent),
|
|
504
504
|
safari: Fi,
|
|
505
|
-
webkit_version: zs ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(
|
|
506
|
-
tabSize:
|
|
505
|
+
webkit_version: zs ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(V.userAgent) || [0, 0])[1] : 0,
|
|
506
|
+
tabSize: de.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"
|
|
507
507
|
};
|
|
508
508
|
const Is = 256;
|
|
509
509
|
class q extends O {
|
|
@@ -533,7 +533,7 @@ class q extends O {
|
|
|
533
533
|
return t == this.dom ? e : e ? this.text.length : 0;
|
|
534
534
|
}
|
|
535
535
|
domAtPos(t) {
|
|
536
|
-
return new
|
|
536
|
+
return new P(this.dom, t);
|
|
537
537
|
}
|
|
538
538
|
domBoundsAround(t, e, i) {
|
|
539
539
|
return { from: i, to: i + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling };
|
|
@@ -587,21 +587,21 @@ function Ks(n, t, e) {
|
|
|
587
587
|
t > i && (t = i);
|
|
588
588
|
let s = t, r = t, o = 0;
|
|
589
589
|
t == 0 && e < 0 || t == i && e >= 0 ? y.chrome || y.gecko || (t ? (s--, o = 1) : r < i && (r++, o = -1)) : e < 0 ? s-- : r < i && r++;
|
|
590
|
-
let l =
|
|
590
|
+
let l = lt(n, s, r).getClientRects();
|
|
591
591
|
if (!l.length)
|
|
592
592
|
return null;
|
|
593
593
|
let h = l[(o ? o < 0 : e >= 0) ? 0 : l.length - 1];
|
|
594
|
-
return y.safari && !o && h.width == 0 && (h = Array.prototype.find.call(l, (f) => f.width) || h), o ?
|
|
594
|
+
return y.safari && !o && h.width == 0 && (h = Array.prototype.find.call(l, (f) => f.width) || h), o ? Et(h, o < 0) : h || null;
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class rt extends O {
|
|
597
597
|
static create(t, e, i) {
|
|
598
|
-
return new
|
|
598
|
+
return new rt(t, e, i);
|
|
599
599
|
}
|
|
600
600
|
constructor(t, e, i) {
|
|
601
601
|
super(), this.widget = t, this.length = e, this.side = i, this.prevWidget = null;
|
|
602
602
|
}
|
|
603
603
|
split(t) {
|
|
604
|
-
let e =
|
|
604
|
+
let e = rt.create(this.widget, this.length - t, this.side);
|
|
605
605
|
return this.length -= t, e;
|
|
606
606
|
}
|
|
607
607
|
sync(t) {
|
|
@@ -611,10 +611,10 @@ class nt extends O {
|
|
|
611
611
|
return this.side;
|
|
612
612
|
}
|
|
613
613
|
merge(t, e, i, s, r, o) {
|
|
614
|
-
return i && (!(i instanceof
|
|
614
|
+
return i && (!(i instanceof rt) || !this.widget.compare(i.widget) || t > 0 && r <= 0 || e < this.length && o <= 0) ? !1 : (this.length = t + (i ? i.length : 0) + (this.length - e), !0);
|
|
615
615
|
}
|
|
616
616
|
become(t) {
|
|
617
|
-
return t instanceof
|
|
617
|
+
return t instanceof rt && t.side == this.side && this.widget.constructor == t.widget.constructor ? (this.widget.compare(t.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = t.widget, this.length = t.length, !0) : !1;
|
|
618
618
|
}
|
|
619
619
|
ignoreMutation() {
|
|
620
620
|
return !0;
|
|
@@ -632,7 +632,7 @@ class nt extends O {
|
|
|
632
632
|
return i ? i.slice(s, s + this.length) : W.empty;
|
|
633
633
|
}
|
|
634
634
|
domAtPos(t) {
|
|
635
|
-
return (this.length ? t == 0 : this.side > 0) ?
|
|
635
|
+
return (this.length ? t == 0 : this.side > 0) ? P.before(this.dom) : P.after(this.dom, t == this.length);
|
|
636
636
|
}
|
|
637
637
|
domBoundsAround() {
|
|
638
638
|
return null;
|
|
@@ -647,7 +647,7 @@ class nt extends O {
|
|
|
647
647
|
let o = this.side ? this.side < 0 : t > 0;
|
|
648
648
|
for (let l = o ? s.length - 1 : 0; r = s[l], !(t > 0 ? l == 0 : l == s.length - 1 || r.top < r.bottom); l += o ? -1 : 1)
|
|
649
649
|
;
|
|
650
|
-
return
|
|
650
|
+
return Et(r, !o);
|
|
651
651
|
}
|
|
652
652
|
get isEditable() {
|
|
653
653
|
return !1;
|
|
@@ -662,7 +662,7 @@ class nt extends O {
|
|
|
662
662
|
super.destroy(), this.dom && this.widget.destroy(this.dom);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
class
|
|
665
|
+
class mt extends O {
|
|
666
666
|
constructor(t) {
|
|
667
667
|
super(), this.side = t;
|
|
668
668
|
}
|
|
@@ -673,10 +673,10 @@ class pt extends O {
|
|
|
673
673
|
return !1;
|
|
674
674
|
}
|
|
675
675
|
become(t) {
|
|
676
|
-
return t instanceof
|
|
676
|
+
return t instanceof mt && t.side == this.side;
|
|
677
677
|
}
|
|
678
678
|
split() {
|
|
679
|
-
return new
|
|
679
|
+
return new mt(this.side);
|
|
680
680
|
}
|
|
681
681
|
sync() {
|
|
682
682
|
if (!this.dom) {
|
|
@@ -688,7 +688,7 @@ class pt extends O {
|
|
|
688
688
|
return this.side;
|
|
689
689
|
}
|
|
690
690
|
domAtPos(t) {
|
|
691
|
-
return this.side > 0 ?
|
|
691
|
+
return this.side > 0 ? P.before(this.dom) : P.after(this.dom);
|
|
692
692
|
}
|
|
693
693
|
localPosFromDOM() {
|
|
694
694
|
return 0;
|
|
@@ -706,7 +706,7 @@ class pt extends O {
|
|
|
706
706
|
return !0;
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
q.prototype.children =
|
|
709
|
+
q.prototype.children = rt.prototype.children = mt.prototype.children = Ee;
|
|
710
710
|
function Wi(n, t) {
|
|
711
711
|
let e = n.dom, { children: i } = n, s = 0;
|
|
712
712
|
for (let r = 0; s < i.length; s++) {
|
|
@@ -729,7 +729,7 @@ function Wi(n, t) {
|
|
|
729
729
|
if (o.dom.parentNode == e)
|
|
730
730
|
return o.domAtPos(0);
|
|
731
731
|
}
|
|
732
|
-
return new
|
|
732
|
+
return new P(e, 0);
|
|
733
733
|
}
|
|
734
734
|
function zi(n, t, e) {
|
|
735
735
|
let i, { children: s } = n;
|
|
@@ -751,20 +751,20 @@ function qs(n) {
|
|
|
751
751
|
let t = n.dom.lastChild;
|
|
752
752
|
if (!t)
|
|
753
753
|
return n.dom.getBoundingClientRect();
|
|
754
|
-
let e =
|
|
754
|
+
let e = pt(t);
|
|
755
755
|
return e[e.length - 1] || null;
|
|
756
756
|
}
|
|
757
757
|
function Gs(n, t) {
|
|
758
758
|
let e = n.coordsAt(0, 1), i = t.coordsAt(0, 1);
|
|
759
759
|
return e && i && i.top < e.bottom;
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function pe(n, t) {
|
|
762
762
|
for (let e in n)
|
|
763
763
|
e == "class" && t.class ? t.class += " " + n.class : e == "style" && t.style ? t.style += ";" + n.style : t[e] = n[e];
|
|
764
764
|
return t;
|
|
765
765
|
}
|
|
766
766
|
const je = /* @__PURE__ */ Object.create(null);
|
|
767
|
-
function
|
|
767
|
+
function Xt(n, t, e) {
|
|
768
768
|
if (n == t)
|
|
769
769
|
return !0;
|
|
770
770
|
n || (n = je), t || (t = je);
|
|
@@ -776,7 +776,7 @@ function $t(n, t, e) {
|
|
|
776
776
|
return !1;
|
|
777
777
|
return !0;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function me(n, t, e) {
|
|
780
780
|
let i = !1;
|
|
781
781
|
if (t)
|
|
782
782
|
for (let s in t)
|
|
@@ -794,7 +794,7 @@ function js(n) {
|
|
|
794
794
|
}
|
|
795
795
|
return t;
|
|
796
796
|
}
|
|
797
|
-
class
|
|
797
|
+
class te {
|
|
798
798
|
/**
|
|
799
799
|
Compare this instance to another instance of the same type.
|
|
800
800
|
(TypeScript can't express this, but only instances of the same
|
|
@@ -881,7 +881,7 @@ class Ee {
|
|
|
881
881
|
var z = /* @__PURE__ */ (function(n) {
|
|
882
882
|
return n[n.Text = 0] = "Text", n[n.WidgetBefore = 1] = "WidgetBefore", n[n.WidgetAfter = 2] = "WidgetAfter", n[n.WidgetRange = 3] = "WidgetRange", n;
|
|
883
883
|
})(z || (z = {}));
|
|
884
|
-
class
|
|
884
|
+
class B extends Di {
|
|
885
885
|
constructor(t, e, i, s) {
|
|
886
886
|
super(), this.startSide = t, this.endSide = e, this.widget = i, this.spec = s;
|
|
887
887
|
}
|
|
@@ -901,7 +901,7 @@ class F extends Di {
|
|
|
901
901
|
of lower-precedence decorations.
|
|
902
902
|
*/
|
|
903
903
|
static mark(t) {
|
|
904
|
-
return new
|
|
904
|
+
return new Rt(t);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
907
907
|
Create a widget decoration, which displays a DOM element at the
|
|
@@ -930,7 +930,7 @@ class F extends Di {
|
|
|
930
930
|
line starting at the given position.
|
|
931
931
|
*/
|
|
932
932
|
static line(t) {
|
|
933
|
-
return new
|
|
933
|
+
return new Bt(t);
|
|
934
934
|
}
|
|
935
935
|
/**
|
|
936
936
|
Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
|
|
@@ -938,7 +938,7 @@ class F extends Di {
|
|
|
938
938
|
pass `true` for `sort` to make the library sort them for you.
|
|
939
939
|
*/
|
|
940
940
|
static set(t, e = !1) {
|
|
941
|
-
return
|
|
941
|
+
return N.of(t, e);
|
|
942
942
|
}
|
|
943
943
|
/**
|
|
944
944
|
@internal
|
|
@@ -947,15 +947,15 @@ class F extends Di {
|
|
|
947
947
|
return this.widget ? this.widget.estimatedHeight > -1 : !1;
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
|
-
|
|
951
|
-
class
|
|
950
|
+
B.none = N.empty;
|
|
951
|
+
class Rt extends B {
|
|
952
952
|
constructor(t) {
|
|
953
953
|
let { start: e, end: i } = Ki(t);
|
|
954
954
|
super(e ? -1 : 5e8, i ? 1 : -6e8, null, t), this.tagName = t.tagName || "span", this.class = t.class || "", this.attrs = t.attributes || null;
|
|
955
955
|
}
|
|
956
956
|
eq(t) {
|
|
957
957
|
var e, i;
|
|
958
|
-
return this == t || t instanceof
|
|
958
|
+
return this == t || t instanceof Rt && this.tagName == t.tagName && (this.class || ((e = this.attrs) === null || e === void 0 ? void 0 : e.class)) == (t.class || ((i = t.attrs) === null || i === void 0 ? void 0 : i.class)) && Xt(this.attrs, t.attrs, "class");
|
|
959
959
|
}
|
|
960
960
|
range(t, e = t) {
|
|
961
961
|
if (t >= e)
|
|
@@ -963,13 +963,13 @@ class Et extends F {
|
|
|
963
963
|
return super.range(t, e);
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
|
-
|
|
967
|
-
class
|
|
966
|
+
Rt.prototype.point = !1;
|
|
967
|
+
class Bt extends B {
|
|
968
968
|
constructor(t) {
|
|
969
969
|
super(-2e8, -2e8, null, t);
|
|
970
970
|
}
|
|
971
971
|
eq(t) {
|
|
972
|
-
return t instanceof
|
|
972
|
+
return t instanceof Bt && this.spec.class == t.spec.class && Xt(this.spec.attributes, t.spec.attributes);
|
|
973
973
|
}
|
|
974
974
|
range(t, e = t) {
|
|
975
975
|
if (e != t)
|
|
@@ -977,11 +977,11 @@ class Rt extends F {
|
|
|
977
977
|
return super.range(t, e);
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
class et extends
|
|
980
|
+
Bt.prototype.mapMode = kt.TrackBefore;
|
|
981
|
+
Bt.prototype.point = !0;
|
|
982
|
+
class et extends B {
|
|
983
983
|
constructor(t, e, i, s, r, o) {
|
|
984
|
-
super(e, i, r, t), this.block = s, this.isReplace = o, this.mapMode = s ? e <= 0 ?
|
|
984
|
+
super(e, i, r, t), this.block = s, this.isReplace = o, this.mapMode = s ? e <= 0 ? kt.TrackBefore : kt.TrackAfter : kt.TrackDel;
|
|
985
985
|
}
|
|
986
986
|
// Only relevant when this.block == true
|
|
987
987
|
get type() {
|
|
@@ -1009,7 +1009,7 @@ function Ki(n, t = !1) {
|
|
|
1009
1009
|
function Ys(n, t) {
|
|
1010
1010
|
return n == t || !!(n && t && n.compare(t));
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function qt(n, t, e, i = 0) {
|
|
1013
1013
|
let s = e.length - 1;
|
|
1014
1014
|
s >= 0 && e[s] + i >= n ? e[s] = Math.max(e[s], t) : e.push(n, t);
|
|
1015
1015
|
}
|
|
@@ -1042,7 +1042,7 @@ class E extends O {
|
|
|
1042
1042
|
this.dom && (this.markDirty(), t.setDOM(this.dom), t.prevAttrs = this.prevAttrs === void 0 ? this.attrs : this.prevAttrs, this.prevAttrs = void 0, this.dom = null);
|
|
1043
1043
|
}
|
|
1044
1044
|
setDeco(t) {
|
|
1045
|
-
|
|
1045
|
+
Xt(this.attrs, t) || (this.dom && (this.prevAttrs = this.attrs, this.markDirty()), this.attrs = t);
|
|
1046
1046
|
}
|
|
1047
1047
|
append(t, e) {
|
|
1048
1048
|
zi(this, t, e);
|
|
@@ -1050,7 +1050,7 @@ class E extends O {
|
|
|
1050
1050
|
// Only called when building a line view in ContentBuilder
|
|
1051
1051
|
addLineDeco(t) {
|
|
1052
1052
|
let e = t.spec.attributes, i = t.spec.class;
|
|
1053
|
-
e && (this.attrs =
|
|
1053
|
+
e && (this.attrs = pe(e, this.attrs || {})), i && (this.attrs = pe({ class: i }, this.attrs || {}));
|
|
1054
1054
|
}
|
|
1055
1055
|
domAtPos(t) {
|
|
1056
1056
|
return Wi(this, t);
|
|
@@ -1060,7 +1060,7 @@ class E extends O {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
sync(t, e) {
|
|
1062
1062
|
var i;
|
|
1063
|
-
this.dom ? this.flags & 4 && (Ei(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), this.prevAttrs !== void 0 && (
|
|
1063
|
+
this.dom ? this.flags & 4 && (Ei(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), this.prevAttrs !== void 0 && (me(this.dom, this.prevAttrs, this.attrs), this.dom.classList.add("cm-line"), this.prevAttrs = void 0), super.sync(t, e);
|
|
1064
1064
|
let s = this.dom.lastChild;
|
|
1065
1065
|
for (; s && O.get(s) instanceof Q; )
|
|
1066
1066
|
s = s.lastChild;
|
|
@@ -1076,7 +1076,7 @@ class E extends O {
|
|
|
1076
1076
|
for (let i of this.children) {
|
|
1077
1077
|
if (!(i instanceof q) || /[^ -~]/.test(i.text))
|
|
1078
1078
|
return null;
|
|
1079
|
-
let s =
|
|
1079
|
+
let s = pt(i.dom);
|
|
1080
1080
|
if (s.length != 1)
|
|
1081
1081
|
return null;
|
|
1082
1082
|
t += s[0].width, e = s[0].height;
|
|
@@ -1099,7 +1099,7 @@ class E extends O {
|
|
|
1099
1099
|
return i;
|
|
1100
1100
|
}
|
|
1101
1101
|
become(t) {
|
|
1102
|
-
return t instanceof E && this.children.length == 0 && t.children.length == 0 &&
|
|
1102
|
+
return t instanceof E && this.children.length == 0 && t.children.length == 0 && Xt(this.attrs, t.attrs) && this.breakAfter == t.breakAfter;
|
|
1103
1103
|
}
|
|
1104
1104
|
covers() {
|
|
1105
1105
|
return !0;
|
|
@@ -1126,7 +1126,7 @@ class U extends O {
|
|
|
1126
1126
|
return i && (!(i instanceof U) || !this.widget.compare(i.widget) || t > 0 && r <= 0 || e < this.length && o <= 0) ? !1 : (this.length = t + (i ? i.length : 0) + (this.length - e), !0);
|
|
1127
1127
|
}
|
|
1128
1128
|
domAtPos(t) {
|
|
1129
|
-
return t == 0 ?
|
|
1129
|
+
return t == 0 ? P.before(this.dom) : P.after(this.dom, t == this.length);
|
|
1130
1130
|
}
|
|
1131
1131
|
split(t) {
|
|
1132
1132
|
let e = this.length - t;
|
|
@@ -1135,7 +1135,7 @@ class U extends O {
|
|
|
1135
1135
|
return i.breakAfter = this.breakAfter, i;
|
|
1136
1136
|
}
|
|
1137
1137
|
get children() {
|
|
1138
|
-
return
|
|
1138
|
+
return Ee;
|
|
1139
1139
|
}
|
|
1140
1140
|
sync(t) {
|
|
1141
1141
|
(!this.dom || !this.widget.updateDOM(this.dom, t)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(t)), this.widget.editable || (this.dom.contentEditable = "false"));
|
|
@@ -1163,7 +1163,7 @@ class U extends O {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
coordsAt(t, e) {
|
|
1165
1165
|
let i = this.widget.coordsAt(this.dom, t, e);
|
|
1166
|
-
return i || (this.widget instanceof
|
|
1166
|
+
return i || (this.widget instanceof be ? null : Et(this.dom.getBoundingClientRect(), this.length ? t == 0 : e <= 0));
|
|
1167
1167
|
}
|
|
1168
1168
|
destroy() {
|
|
1169
1169
|
super.destroy(), this.dom && this.widget.destroy(this.dom);
|
|
@@ -1173,7 +1173,7 @@ class U extends O {
|
|
|
1173
1173
|
return e == i ? !1 : t < 0 ? e < 0 : i > 0;
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
|
-
class
|
|
1176
|
+
class be extends te {
|
|
1177
1177
|
constructor(t) {
|
|
1178
1178
|
super(), this.height = t;
|
|
1179
1179
|
}
|
|
@@ -1197,7 +1197,7 @@ class me extends Ee {
|
|
|
1197
1197
|
return !1;
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
class
|
|
1200
|
+
class Dt {
|
|
1201
1201
|
constructor(t, e, i, s) {
|
|
1202
1202
|
this.doc = t, this.pos = e, this.end = i, this.disallowBlockEffectsFor = s, this.content = [], this.curLine = null, this.breakAtStart = 0, this.pendingBuffer = 0, this.bufferMarks = [], this.atCursorPos = !0, this.openStart = -1, this.openEnd = -1, this.text = "", this.textOff = 0, this.cursor = t.iter(), this.skip = e;
|
|
1203
1203
|
}
|
|
@@ -1211,7 +1211,7 @@ class At {
|
|
|
1211
1211
|
return this.curLine || (this.content.push(this.curLine = new E()), this.atCursorPos = !0), this.curLine;
|
|
1212
1212
|
}
|
|
1213
1213
|
flushBuffer(t = this.bufferMarks) {
|
|
1214
|
-
this.pendingBuffer && (this.curLine.append(
|
|
1214
|
+
this.pendingBuffer && (this.curLine.append(Lt(new mt(-1), t), t.length), this.pendingBuffer = 0);
|
|
1215
1215
|
}
|
|
1216
1216
|
addBlockWidget(t) {
|
|
1217
1217
|
this.flushBuffer(), this.curLine = null, this.content.push(t);
|
|
@@ -1237,7 +1237,7 @@ class At {
|
|
|
1237
1237
|
512
|
|
1238
1238
|
/* T.Chunk */
|
|
1239
1239
|
);
|
|
1240
|
-
this.flushBuffer(e.slice(e.length - i)), this.getLine().append(
|
|
1240
|
+
this.flushBuffer(e.slice(e.length - i)), this.getLine().append(Lt(new q(this.text.slice(this.textOff, this.textOff + s)), e), i), this.atCursorPos = !0, this.textOff += s, t -= s, i = 0;
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
1243
|
span(t, e, i, s) {
|
|
@@ -1253,25 +1253,25 @@ class At {
|
|
|
1253
1253
|
let l = e - t;
|
|
1254
1254
|
if (i instanceof et)
|
|
1255
1255
|
if (i.block)
|
|
1256
|
-
i.startSide > 0 && !this.posCovered() && this.getLine(), this.addBlockWidget(new U(i.widget ||
|
|
1256
|
+
i.startSide > 0 && !this.posCovered() && this.getLine(), this.addBlockWidget(new U(i.widget || bt.block, l, i));
|
|
1257
1257
|
else {
|
|
1258
|
-
let h =
|
|
1259
|
-
this.pendingBuffer == 2 && !f && !h.isEditable && (this.pendingBuffer = 0), this.flushBuffer(s), f && (c.append(
|
|
1258
|
+
let h = rt.create(i.widget || bt.inline, l, l ? 0 : i.startSide), f = this.atCursorPos && !h.isEditable && r <= s.length && (t < e || i.startSide > 0), a = !h.isEditable && (t < e || r > s.length || i.startSide <= 0), c = this.getLine();
|
|
1259
|
+
this.pendingBuffer == 2 && !f && !h.isEditable && (this.pendingBuffer = 0), this.flushBuffer(s), f && (c.append(Lt(new mt(1), s), r), r = s.length + Math.max(0, r - s.length)), c.append(Lt(h, s), r), this.atCursorPos = a, this.pendingBuffer = a ? t < e || r > s.length ? 1 : 2 : 0, this.pendingBuffer && (this.bufferMarks = s.slice());
|
|
1260
1260
|
}
|
|
1261
1261
|
else this.doc.lineAt(this.pos).from == this.pos && this.getLine().addLineDeco(i);
|
|
1262
1262
|
l && (this.textOff + l <= this.text.length ? this.textOff += l : (this.skip += l - (this.text.length - this.textOff), this.text = "", this.textOff = 0), this.pos = e), this.openStart < 0 && (this.openStart = r);
|
|
1263
1263
|
}
|
|
1264
1264
|
static build(t, e, i, s, r) {
|
|
1265
|
-
let o = new
|
|
1266
|
-
return o.openEnd =
|
|
1265
|
+
let o = new Dt(t, e, i, r);
|
|
1266
|
+
return o.openEnd = N.spans(s, e, i, o), o.openStart < 0 && (o.openStart = o.openEnd), o.finish(o.openEnd), o;
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function Lt(n, t) {
|
|
1270
1270
|
for (let e of t)
|
|
1271
1271
|
n = new Q(e, [n], n.length);
|
|
1272
1272
|
return n;
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class bt extends te {
|
|
1275
1275
|
constructor(t) {
|
|
1276
1276
|
super(), this.tag = t;
|
|
1277
1277
|
}
|
|
@@ -1288,22 +1288,22 @@ class mt extends Ee {
|
|
|
1288
1288
|
return !0;
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
var
|
|
1291
|
+
bt.inline = /* @__PURE__ */ new bt("span");
|
|
1292
|
+
bt.block = /* @__PURE__ */ new bt("div");
|
|
1293
|
+
var L = /* @__PURE__ */ (function(n) {
|
|
1294
1294
|
return n[n.LTR = 0] = "LTR", n[n.RTL = 1] = "RTL", n;
|
|
1295
|
-
})(
|
|
1296
|
-
const
|
|
1295
|
+
})(L || (L = {}));
|
|
1296
|
+
const ht = L.LTR, Re = L.RTL;
|
|
1297
1297
|
function qi(n) {
|
|
1298
1298
|
let t = [];
|
|
1299
1299
|
for (let e = 0; e < n.length; e++)
|
|
1300
1300
|
t.push(1 << +n[e]);
|
|
1301
1301
|
return t;
|
|
1302
1302
|
}
|
|
1303
|
-
const _s = /* @__PURE__ */ qi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), $s = /* @__PURE__ */ qi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),
|
|
1303
|
+
const _s = /* @__PURE__ */ qi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), $s = /* @__PURE__ */ qi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"), ye = /* @__PURE__ */ Object.create(null), j = [];
|
|
1304
1304
|
for (let n of ["()", "[]", "{}"]) {
|
|
1305
1305
|
let t = /* @__PURE__ */ n.charCodeAt(0), e = /* @__PURE__ */ n.charCodeAt(1);
|
|
1306
|
-
|
|
1306
|
+
ye[t] = e, ye[e] = -t;
|
|
1307
1307
|
}
|
|
1308
1308
|
function Gi(n) {
|
|
1309
1309
|
return n <= 247 ? _s[n] : 1424 <= n && n <= 1524 ? 2 : 1536 <= n && n <= 1785 ? $s[n - 1536] : 1774 <= n && n <= 2220 ? 4 : 8192 <= n && n <= 8204 ? 256 : 64336 <= n && n <= 65023 ? 4 : 1;
|
|
@@ -1314,7 +1314,7 @@ class tt {
|
|
|
1314
1314
|
The direction of this span.
|
|
1315
1315
|
*/
|
|
1316
1316
|
get dir() {
|
|
1317
|
-
return this.level % 2 ? Re :
|
|
1317
|
+
return this.level % 2 ? Re : ht;
|
|
1318
1318
|
}
|
|
1319
1319
|
/**
|
|
1320
1320
|
@internal
|
|
@@ -1392,7 +1392,7 @@ function Qs(n, t, e, i, s) {
|
|
|
1392
1392
|
for (let o = 0, l = 0, h = 0; o <= i.length; o++) {
|
|
1393
1393
|
let f = o ? i[o - 1].to : t, a = o < i.length ? i[o].from : e;
|
|
1394
1394
|
for (let c = f, d, u, g; c < a; c++)
|
|
1395
|
-
if (u =
|
|
1395
|
+
if (u = ye[d = n.charCodeAt(c)])
|
|
1396
1396
|
if (u < 0) {
|
|
1397
1397
|
for (let m = l - 3; m >= 0; m -= 3)
|
|
1398
1398
|
if (j[m + 1] == -u) {
|
|
@@ -1448,7 +1448,7 @@ function Js(n, t, e, i) {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function we(n, t, e, i, s, r, o) {
|
|
1452
1452
|
let l = i % 2 ? 2 : 1;
|
|
1453
1453
|
if (i % 2 == s % 2)
|
|
1454
1454
|
for (let h = t, f = 0; h < e; ) {
|
|
@@ -1479,8 +1479,8 @@ function ye(n, t, e, i, s, r, o) {
|
|
|
1479
1479
|
d.push(m);
|
|
1480
1480
|
else {
|
|
1481
1481
|
m.from > h && o.push(new tt(h, m.from, u));
|
|
1482
|
-
let b = m.direction ==
|
|
1483
|
-
|
|
1482
|
+
let b = m.direction == ht != !(u % 2);
|
|
1483
|
+
Se(n, b ? i + 1 : i, s, m.inner, m.from, m.to, o), h = m.to;
|
|
1484
1484
|
}
|
|
1485
1485
|
g = m.to;
|
|
1486
1486
|
} else {
|
|
@@ -1488,7 +1488,7 @@ function ye(n, t, e, i, s, r, o) {
|
|
|
1488
1488
|
break;
|
|
1489
1489
|
g++;
|
|
1490
1490
|
}
|
|
1491
|
-
d ?
|
|
1491
|
+
d ? we(n, h, g, i + 1, s, d, o) : h < g && o.push(new tt(h, g, u)), h = g;
|
|
1492
1492
|
}
|
|
1493
1493
|
else
|
|
1494
1494
|
for (let h = e, f = r.length; h > t; ) {
|
|
@@ -1519,8 +1519,8 @@ function ye(n, t, e, i, s, r, o) {
|
|
|
1519
1519
|
d.push(m);
|
|
1520
1520
|
else {
|
|
1521
1521
|
m.to < h && o.push(new tt(m.to, h, u));
|
|
1522
|
-
let b = m.direction ==
|
|
1523
|
-
|
|
1522
|
+
let b = m.direction == ht != !(u % 2);
|
|
1523
|
+
Se(n, b ? i + 1 : i, s, m.inner, m.from, m.to, o), h = m.from;
|
|
1524
1524
|
}
|
|
1525
1525
|
g = m.from;
|
|
1526
1526
|
} else {
|
|
@@ -1528,23 +1528,23 @@ function ye(n, t, e, i, s, r, o) {
|
|
|
1528
1528
|
break;
|
|
1529
1529
|
g--;
|
|
1530
1530
|
}
|
|
1531
|
-
d ?
|
|
1531
|
+
d ? we(n, g, h, i + 1, s, d, o) : g < h && o.push(new tt(g, h, u)), h = g;
|
|
1532
1532
|
}
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function Se(n, t, e, i, s, r, o) {
|
|
1535
1535
|
let l = t % 2 ? 2 : 1;
|
|
1536
|
-
Us(n, s, r, i, l), Qs(n, s, r, i, l), Js(s, r, i, l),
|
|
1536
|
+
Us(n, s, r, i, l), Qs(n, s, r, i, l), Js(s, r, i, l), we(n, s, r, t, e, i, o);
|
|
1537
1537
|
}
|
|
1538
1538
|
function Zs(n, t, e) {
|
|
1539
1539
|
if (!n)
|
|
1540
1540
|
return [new tt(0, 0, t == Re ? 1 : 0)];
|
|
1541
|
-
if (t ==
|
|
1541
|
+
if (t == ht && !e.length && !Xs.test(n))
|
|
1542
1542
|
return Yi(n.length);
|
|
1543
1543
|
if (e.length)
|
|
1544
1544
|
for (; n.length > D.length; )
|
|
1545
1545
|
D[D.length] = 256;
|
|
1546
|
-
let i = [], s = t ==
|
|
1547
|
-
return
|
|
1546
|
+
let i = [], s = t == ht ? 0 : 1;
|
|
1547
|
+
return Se(n, s, s, e, 0, n.length, i), i;
|
|
1548
1548
|
}
|
|
1549
1549
|
function Yi(n) {
|
|
1550
1550
|
return [new tt(0, n, 0)];
|
|
@@ -1568,13 +1568,13 @@ function en(n, t, e) {
|
|
|
1568
1568
|
for (let i = t; i < e; i++) {
|
|
1569
1569
|
let s = Gi(n.charCodeAt(i));
|
|
1570
1570
|
if (s == 1)
|
|
1571
|
-
return
|
|
1571
|
+
return ht;
|
|
1572
1572
|
if (s == 2 || s == 4)
|
|
1573
1573
|
return Re;
|
|
1574
1574
|
}
|
|
1575
|
-
return
|
|
1575
|
+
return ht;
|
|
1576
1576
|
}
|
|
1577
|
-
const $i = /* @__PURE__ */ v.define(), Xi = /* @__PURE__ */ v.define(), Ui = /* @__PURE__ */ v.define(), Qi = /* @__PURE__ */ v.define(),
|
|
1577
|
+
const $i = /* @__PURE__ */ v.define(), Xi = /* @__PURE__ */ v.define(), Ui = /* @__PURE__ */ v.define(), Qi = /* @__PURE__ */ v.define(), xe = /* @__PURE__ */ v.define(), Ji = /* @__PURE__ */ v.define(), Zi = /* @__PURE__ */ v.define(), Be = /* @__PURE__ */ v.define(), Le = /* @__PURE__ */ v.define(), ts = /* @__PURE__ */ v.define({
|
|
1578
1578
|
combine: (n) => n.some((t) => t)
|
|
1579
1579
|
}), sn = /* @__PURE__ */ v.define({
|
|
1580
1580
|
combine: (n) => n.some((t) => t)
|
|
@@ -1590,15 +1590,15 @@ class ut {
|
|
|
1590
1590
|
return this.range.to <= t.doc.length ? this : new ut(C.cursor(t.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot);
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
|
-
const
|
|
1593
|
+
const Pt = /* @__PURE__ */ Te.define({ map: (n, t) => n.map(t) }), is = /* @__PURE__ */ Te.define();
|
|
1594
1594
|
function X(n, t, e) {
|
|
1595
1595
|
let i = n.facet(Qi);
|
|
1596
1596
|
i.length ? i[0](t) : window.onerror ? window.onerror(String(t), e, void 0, void 0, t) : e ? console.error(e + ":", t) : console.error(t);
|
|
1597
1597
|
}
|
|
1598
1598
|
const $ = /* @__PURE__ */ v.define({ combine: (n) => n.length ? n[0] : !0 });
|
|
1599
1599
|
let nn = 0;
|
|
1600
|
-
const
|
|
1601
|
-
class
|
|
1600
|
+
const St = /* @__PURE__ */ v.define();
|
|
1601
|
+
class it {
|
|
1602
1602
|
constructor(t, e, i, s, r) {
|
|
1603
1603
|
this.id = t, this.create = e, this.domEventHandlers = i, this.domEventObservers = s, this.extension = r(this);
|
|
1604
1604
|
}
|
|
@@ -1608,11 +1608,11 @@ class ht {
|
|
|
1608
1608
|
*/
|
|
1609
1609
|
static define(t, e) {
|
|
1610
1610
|
const { eventHandlers: i, eventObservers: s, provide: r, decorations: o } = e || {};
|
|
1611
|
-
return new
|
|
1612
|
-
let h = [
|
|
1611
|
+
return new it(nn++, t, i, s, (l) => {
|
|
1612
|
+
let h = [St.of(l)];
|
|
1613
1613
|
return o && h.push(Tt.of((f) => {
|
|
1614
1614
|
let a = f.plugin(l);
|
|
1615
|
-
return a ? o(a) :
|
|
1615
|
+
return a ? o(a) : B.none;
|
|
1616
1616
|
})), r && h.push(r(l)), h;
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
@@ -1621,10 +1621,10 @@ class ht {
|
|
|
1621
1621
|
editor view as argument.
|
|
1622
1622
|
*/
|
|
1623
1623
|
static fromClass(t, e) {
|
|
1624
|
-
return
|
|
1624
|
+
return it.define((i) => new t(i), e);
|
|
1625
1625
|
}
|
|
1626
1626
|
}
|
|
1627
|
-
class
|
|
1627
|
+
class se {
|
|
1628
1628
|
constructor(t) {
|
|
1629
1629
|
this.spec = t, this.mustUpdate = null, this.value = null;
|
|
1630
1630
|
}
|
|
@@ -1671,7 +1671,7 @@ function Ye(n, t) {
|
|
|
1671
1671
|
if (!e.length)
|
|
1672
1672
|
return e;
|
|
1673
1673
|
let i = e.map((r) => r instanceof Function ? r(n) : r), s = [];
|
|
1674
|
-
return
|
|
1674
|
+
return N.spans(i, t.from, t.to, {
|
|
1675
1675
|
point() {
|
|
1676
1676
|
},
|
|
1677
1677
|
span(r, o, l, h) {
|
|
@@ -1697,7 +1697,7 @@ function Ne(n) {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
return { left: t, right: e, top: i, bottom: s };
|
|
1699
1699
|
}
|
|
1700
|
-
const
|
|
1700
|
+
const xt = /* @__PURE__ */ v.define();
|
|
1701
1701
|
class I {
|
|
1702
1702
|
constructor(t, e, i, s) {
|
|
1703
1703
|
this.fromA = t, this.toA = e, this.fromB = i, this.toB = s;
|
|
@@ -1735,7 +1735,7 @@ class I {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
class
|
|
1738
|
+
class Ut {
|
|
1739
1739
|
constructor(t, e, i) {
|
|
1740
1740
|
this.view = t, this.state = e, this.transactions = i, this.flags = 0, this.startState = t.state, this.changes = Ai.empty(this.startState.doc.length);
|
|
1741
1741
|
for (let r of i)
|
|
@@ -1747,7 +1747,7 @@ class Xt {
|
|
|
1747
1747
|
@internal
|
|
1748
1748
|
*/
|
|
1749
1749
|
static create(t, e, i) {
|
|
1750
|
-
return new
|
|
1750
|
+
return new Ut(t, e, i);
|
|
1751
1751
|
}
|
|
1752
1752
|
/**
|
|
1753
1753
|
Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or
|
|
@@ -1810,7 +1810,7 @@ class _e extends O {
|
|
|
1810
1810
|
return this.view.state.doc.length;
|
|
1811
1811
|
}
|
|
1812
1812
|
constructor(t) {
|
|
1813
|
-
super(), this.view = t, this.decorations = [], this.dynamicDecorationMap = [!1], this.domChanged = null, this.hasComposition = null, this.markedForComposition = /* @__PURE__ */ new Set(), this.editContextFormatting =
|
|
1813
|
+
super(), this.view = t, this.decorations = [], this.dynamicDecorationMap = [!1], this.domChanged = null, this.hasComposition = null, this.markedForComposition = /* @__PURE__ */ new Set(), this.editContextFormatting = B.none, this.lastCompositionAfterCursor = !1, this.minWidth = 0, this.minWidthFrom = 0, this.minWidthTo = 0, this.impreciseAnchor = null, this.impreciseHead = null, this.forceSelection = !1, this.lastUpdate = Date.now(), this.setDOM(t.contentDOM), this.children = [new E()], this.children[0].setParent(this), this.updateDeco(), this.updateInner([new I(0, 0, 0, t.state.doc.length)], 0, null);
|
|
1814
1814
|
}
|
|
1815
1815
|
// Update the document view to a given state.
|
|
1816
1816
|
update(t) {
|
|
@@ -1845,7 +1845,7 @@ class _e extends O {
|
|
|
1845
1845
|
let r = [];
|
|
1846
1846
|
if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length)
|
|
1847
1847
|
for (let o of this.children)
|
|
1848
|
-
o instanceof U && o.widget instanceof
|
|
1848
|
+
o instanceof U && o.widget instanceof be && r.push(o.dom);
|
|
1849
1849
|
s.updateGaps(r);
|
|
1850
1850
|
}
|
|
1851
1851
|
updateChildren(t, e, i) {
|
|
@@ -1856,12 +1856,12 @@ class _e extends O {
|
|
|
1856
1856
|
break;
|
|
1857
1857
|
let { fromA: h, toA: f, fromB: a, toB: c } = l, d, u, g, m;
|
|
1858
1858
|
if (i && i.range.fromB < c && i.range.toB > a) {
|
|
1859
|
-
let S =
|
|
1859
|
+
let S = Dt.build(this.view.state.doc, a, i.range.fromB, this.decorations, this.dynamicDecorationMap), A = Dt.build(this.view.state.doc, i.range.toB, c, this.decorations, this.dynamicDecorationMap);
|
|
1860
1860
|
u = S.breakAtStart, g = S.openStart, m = A.openEnd;
|
|
1861
1861
|
let M = this.compositionView(i);
|
|
1862
1862
|
A.breakAtStart ? M.breakAfter = 1 : A.content.length && M.merge(M.length, M.length, A.content[0], !1, A.openStart, 0) && (M.breakAfter = A.content[0].breakAfter, A.content.shift()), S.content.length && M.merge(0, 0, S.content[S.content.length - 1], !0, 0, S.openEnd) && S.content.pop(), d = S.content.concat(M).concat(A.content);
|
|
1863
1863
|
} else
|
|
1864
|
-
({ content: d, breakAtStart: u, openStart: g, openEnd: m } =
|
|
1864
|
+
({ content: d, breakAtStart: u, openStart: g, openEnd: m } = Dt.build(this.view.state.doc, a, c, this.decorations, this.dynamicDecorationMap));
|
|
1865
1865
|
let { i: b, off: p } = r.findPos(f, 1), { i: w, off: x } = r.findPos(h, -1);
|
|
1866
1866
|
Hi(this, w, x, b, p, d, u, g, m);
|
|
1867
1867
|
}
|
|
@@ -1897,7 +1897,7 @@ class _e extends O {
|
|
|
1897
1897
|
// Sync the DOM selection to this.state.selection
|
|
1898
1898
|
updateSelection(t = !1, e = !1) {
|
|
1899
1899
|
(t || !this.view.observer.selectionRange.focusNode) && this.view.observer.readSelectionRange();
|
|
1900
|
-
let i = this.view.root.activeElement, s = i == this.dom, r = !s && !(this.view.state.facet($) || this.dom.tabIndex > -1) &&
|
|
1900
|
+
let i = this.view.root.activeElement, s = i == this.dom, r = !s && !(this.view.state.facet($) || this.dom.tabIndex > -1) && Kt(this.dom, this.view.observer.selectionRange) && !(i && this.dom.contains(i));
|
|
1901
1901
|
if (!(s || e || r))
|
|
1902
1902
|
return;
|
|
1903
1903
|
let o = this.forceSelection;
|
|
@@ -1905,18 +1905,18 @@ class _e extends O {
|
|
|
1905
1905
|
let l = this.view.state.selection.main, h = this.moveToLine(this.domAtPos(l.anchor)), f = l.empty ? h : this.moveToLine(this.domAtPos(l.head));
|
|
1906
1906
|
if (y.gecko && l.empty && !this.hasComposition && rn(h)) {
|
|
1907
1907
|
let c = document.createTextNode("");
|
|
1908
|
-
this.view.observer.ignore(() => h.node.insertBefore(c, h.node.childNodes[h.offset] || null)), h = f = new
|
|
1908
|
+
this.view.observer.ignore(() => h.node.insertBefore(c, h.node.childNodes[h.offset] || null)), h = f = new P(c, 0), o = !0;
|
|
1909
1909
|
}
|
|
1910
1910
|
let a = this.view.observer.selectionRange;
|
|
1911
|
-
(o || !a.focusNode || (!
|
|
1911
|
+
(o || !a.focusNode || (!At(h.node, h.offset, a.anchorNode, a.anchorOffset) || !At(f.node, f.offset, a.focusNode, a.focusOffset)) && !this.suppressWidgetCursorChange(a, l)) && (this.view.observer.ignore(() => {
|
|
1912
1912
|
y.android && y.chrome && this.dom.contains(a.focusNode) && fn(a.focusNode, this.dom) && (this.dom.blur(), this.dom.focus({ preventScroll: !0 }));
|
|
1913
|
-
let c =
|
|
1913
|
+
let c = Ot(this.view.root);
|
|
1914
1914
|
if (c) if (l.empty) {
|
|
1915
1915
|
if (y.gecko) {
|
|
1916
1916
|
let d = ln(h.node, h.offset);
|
|
1917
1917
|
if (d && d != 3) {
|
|
1918
1918
|
let u = (d == 1 ? Bi : Li)(h.node, h.offset);
|
|
1919
|
-
u && (h = new
|
|
1919
|
+
u && (h = new P(u.node, u.offset));
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
1922
|
c.collapse(h.node, h.offset), l.bidiLevel != null && c.caretBidiLevel !== void 0 && (c.caretBidiLevel = l.bidiLevel);
|
|
@@ -1931,18 +1931,18 @@ class _e extends O {
|
|
|
1931
1931
|
l.anchor > l.head && ([h, f] = [f, h]), d.setEnd(f.node, f.offset), d.setStart(h.node, h.offset), c.removeAllRanges(), c.addRange(d);
|
|
1932
1932
|
}
|
|
1933
1933
|
r && this.view.root.activeElement == this.dom && (this.dom.blur(), i && i.focus());
|
|
1934
|
-
}), this.view.observer.setSelectionRange(h, f)), this.impreciseAnchor = h.precise ? null : new
|
|
1934
|
+
}), this.view.observer.setSelectionRange(h, f)), this.impreciseAnchor = h.precise ? null : new P(a.anchorNode, a.anchorOffset), this.impreciseHead = f.precise ? null : new P(a.focusNode, a.focusOffset);
|
|
1935
1935
|
}
|
|
1936
1936
|
// If a zero-length widget is inserted next to the cursor during
|
|
1937
1937
|
// composition, avoid moving it across it and disrupting the
|
|
1938
1938
|
// composition.
|
|
1939
1939
|
suppressWidgetCursorChange(t, e) {
|
|
1940
|
-
return this.hasComposition && e.empty &&
|
|
1940
|
+
return this.hasComposition && e.empty && At(t.focusNode, t.focusOffset, t.anchorNode, t.anchorOffset) && this.posFromDOM(t.focusNode, t.focusOffset) == e.head;
|
|
1941
1941
|
}
|
|
1942
1942
|
enforceCursorAssoc() {
|
|
1943
1943
|
if (this.hasComposition)
|
|
1944
1944
|
return;
|
|
1945
|
-
let { view: t } = this, e = t.state.selection.main, i =
|
|
1945
|
+
let { view: t } = this, e = t.state.selection.main, i = Ot(t.root), { anchorNode: s, anchorOffset: r } = t.observer.selectionRange;
|
|
1946
1946
|
if (!i || !e.empty || !e.assoc || !i.modify)
|
|
1947
1947
|
return;
|
|
1948
1948
|
let o = E.find(this, e.head);
|
|
@@ -1973,7 +1973,7 @@ class _e extends O {
|
|
|
1973
1973
|
let r = O.get(e.childNodes[s]);
|
|
1974
1974
|
r instanceof E && (i = r.domAtPos(r.length));
|
|
1975
1975
|
}
|
|
1976
|
-
return i ? new
|
|
1976
|
+
return i ? new P(i.node, i.offset, !0) : t;
|
|
1977
1977
|
}
|
|
1978
1978
|
nearest(t) {
|
|
1979
1979
|
for (let e = t; e; ) {
|
|
@@ -2036,7 +2036,7 @@ class _e extends O {
|
|
|
2036
2036
|
let r = ft(s.text, i);
|
|
2037
2037
|
if (r == i)
|
|
2038
2038
|
return null;
|
|
2039
|
-
let o =
|
|
2039
|
+
let o = lt(s.dom, i, r).getClientRects();
|
|
2040
2040
|
for (let l = 0; l < o.length; l++) {
|
|
2041
2041
|
let h = o[l];
|
|
2042
2042
|
if (l == o.length - 1 || h.top < h.bottom && h.left < h.right)
|
|
@@ -2045,7 +2045,7 @@ class _e extends O {
|
|
|
2045
2045
|
return null;
|
|
2046
2046
|
}
|
|
2047
2047
|
measureVisibleLineHeights(t) {
|
|
2048
|
-
let e = [], { from: i, to: s } = t, r = this.view.contentDOM.clientWidth, o = r > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, l = -1, h = this.view.textDirection ==
|
|
2048
|
+
let e = [], { from: i, to: s } = t, r = this.view.contentDOM.clientWidth, o = r > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, l = -1, h = this.view.textDirection == L.LTR;
|
|
2049
2049
|
for (let f = 0, a = 0; a < this.children.length; a++) {
|
|
2050
2050
|
let c = this.children[a], d = f + c.length;
|
|
2051
2051
|
if (d > s)
|
|
@@ -2053,7 +2053,7 @@ class _e extends O {
|
|
|
2053
2053
|
if (f >= i) {
|
|
2054
2054
|
let u = c.dom.getBoundingClientRect();
|
|
2055
2055
|
if (e.push(u.height), o) {
|
|
2056
|
-
let g = c.dom.lastChild, m = g ?
|
|
2056
|
+
let g = c.dom.lastChild, m = g ? pt(g) : [];
|
|
2057
2057
|
if (m.length) {
|
|
2058
2058
|
let b = m[m.length - 1], p = h ? b.right - u.left : u.right - b.left;
|
|
2059
2059
|
p > l && (l = p, this.minWidth = r, this.minWidthFrom = f, this.minWidthTo = d);
|
|
@@ -2066,7 +2066,7 @@ class _e extends O {
|
|
|
2066
2066
|
}
|
|
2067
2067
|
textDirectionAt(t) {
|
|
2068
2068
|
let { i: e } = this.childPos(t, 1);
|
|
2069
|
-
return getComputedStyle(this.children[e].dom).direction == "rtl" ?
|
|
2069
|
+
return getComputedStyle(this.children[e].dom).direction == "rtl" ? L.RTL : L.LTR;
|
|
2070
2070
|
}
|
|
2071
2071
|
measureTextSize() {
|
|
2072
2072
|
for (let r of this.children)
|
|
@@ -2078,7 +2078,7 @@ class _e extends O {
|
|
|
2078
2078
|
let t = document.createElement("div"), e, i, s;
|
|
2079
2079
|
return t.className = "cm-line", t.style.width = "99999px", t.style.position = "absolute", t.textContent = "abc def ghi jkl mno pqr stu", this.view.observer.ignore(() => {
|
|
2080
2080
|
this.dom.appendChild(t);
|
|
2081
|
-
let r =
|
|
2081
|
+
let r = pt(t.firstChild)[0];
|
|
2082
2082
|
e = t.getBoundingClientRect().height, i = r ? r.width / 27 : 7, s = r ? r.height : e, t.remove();
|
|
2083
2083
|
}), { lineHeight: e, charWidth: i, textHeight: s };
|
|
2084
2084
|
}
|
|
@@ -2092,8 +2092,8 @@ class _e extends O {
|
|
|
2092
2092
|
let r = s == e.viewports.length ? null : e.viewports[s], o = r ? r.from - 1 : this.length;
|
|
2093
2093
|
if (o > i) {
|
|
2094
2094
|
let l = (e.lineBlockAt(o).bottom - e.lineBlockAt(i).top) / this.view.scaleY;
|
|
2095
|
-
t.push(
|
|
2096
|
-
widget: new
|
|
2095
|
+
t.push(B.replace({
|
|
2096
|
+
widget: new be(l),
|
|
2097
2097
|
block: !0,
|
|
2098
2098
|
inclusive: !0,
|
|
2099
2099
|
isBlockGap: !0
|
|
@@ -2103,14 +2103,14 @@ class _e extends O {
|
|
|
2103
2103
|
break;
|
|
2104
2104
|
i = r.to + 1;
|
|
2105
2105
|
}
|
|
2106
|
-
return
|
|
2106
|
+
return B.set(t);
|
|
2107
2107
|
}
|
|
2108
2108
|
updateDeco() {
|
|
2109
2109
|
let t = 1, e = this.view.state.facet(Tt).map((r) => (this.dynamicDecorationMap[t++] = typeof r == "function") ? r(this.view) : r), i = !1, s = this.view.state.facet(ns).map((r, o) => {
|
|
2110
2110
|
let l = typeof r == "function";
|
|
2111
2111
|
return l && (i = !0), l ? r(this.view) : r;
|
|
2112
2112
|
});
|
|
2113
|
-
for (s.length && (this.dynamicDecorationMap[t++] = i, e.push(
|
|
2113
|
+
for (s.length && (this.dynamicDecorationMap[t++] = i, e.push(N.join(s))), this.decorations = [
|
|
2114
2114
|
this.editContextFormatting,
|
|
2115
2115
|
...e,
|
|
2116
2116
|
this.computeBlockGapDeco(),
|
|
@@ -2147,7 +2147,7 @@ class _e extends O {
|
|
|
2147
2147
|
right: i.right + r.right,
|
|
2148
2148
|
bottom: i.bottom + r.bottom
|
|
2149
2149
|
}, { offsetWidth: l, offsetHeight: h } = this.view.scrollDOM;
|
|
2150
|
-
Hs(this.view.scrollDOM, o, e.head < e.anchor ? -1 : 1, t.x, t.y, Math.max(Math.min(t.xMargin, l), -l), Math.max(Math.min(t.yMargin, h), -h), this.view.textDirection ==
|
|
2150
|
+
Hs(this.view.scrollDOM, o, e.head < e.anchor ? -1 : 1, t.x, t.y, Math.max(Math.min(t.xMargin, l), -l), Math.max(Math.min(t.yMargin, h), -h), this.view.textDirection == L.LTR);
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
2153
|
function rn(n) {
|
|
@@ -2188,7 +2188,7 @@ function on(n, t, e) {
|
|
|
2188
2188
|
if (d instanceof E || c.nodeName == "DIV" && c.parentNode == n.contentDOM)
|
|
2189
2189
|
return { range: f, text: s, marks: a, line: c };
|
|
2190
2190
|
if (c != n.contentDOM)
|
|
2191
|
-
a.push({ node: c, deco: new
|
|
2191
|
+
a.push({ node: c, deco: new Rt({
|
|
2192
2192
|
inclusive: !0,
|
|
2193
2193
|
attributes: js(c),
|
|
2194
2194
|
tagName: c.tagName.toLowerCase()
|
|
@@ -2206,18 +2206,18 @@ let hn = class {
|
|
|
2206
2206
|
this.changes = [];
|
|
2207
2207
|
}
|
|
2208
2208
|
compareRange(t, e) {
|
|
2209
|
-
|
|
2209
|
+
qt(t, e, this.changes);
|
|
2210
2210
|
}
|
|
2211
2211
|
comparePoint(t, e) {
|
|
2212
|
-
|
|
2212
|
+
qt(t, e, this.changes);
|
|
2213
2213
|
}
|
|
2214
2214
|
boundChange(t) {
|
|
2215
|
-
|
|
2215
|
+
qt(t, t, this.changes);
|
|
2216
2216
|
}
|
|
2217
2217
|
};
|
|
2218
2218
|
function an(n, t, e) {
|
|
2219
2219
|
let i = new hn();
|
|
2220
|
-
return
|
|
2220
|
+
return N.compare(n, t, e, i), i.changes;
|
|
2221
2221
|
}
|
|
2222
2222
|
function fn(n, t) {
|
|
2223
2223
|
for (let e = n; e && e != t; e = e.assignedSlot || e.parentNode)
|
|
@@ -2259,7 +2259,7 @@ function un(n, t) {
|
|
|
2259
2259
|
function gn(n, t) {
|
|
2260
2260
|
return t.top > n ? t.top - n : Math.max(0, n - t.bottom);
|
|
2261
2261
|
}
|
|
2262
|
-
function
|
|
2262
|
+
function ne(n, t) {
|
|
2263
2263
|
return n.top < t.bottom - 1 && n.bottom > t.top + 1;
|
|
2264
2264
|
}
|
|
2265
2265
|
function $e(n, t) {
|
|
@@ -2268,22 +2268,22 @@ function $e(n, t) {
|
|
|
2268
2268
|
function Xe(n, t) {
|
|
2269
2269
|
return t > n.bottom ? { top: n.top, left: n.left, right: n.right, bottom: t } : n;
|
|
2270
2270
|
}
|
|
2271
|
-
function
|
|
2271
|
+
function ve(n, t, e) {
|
|
2272
2272
|
let i, s, r, o, l = !1, h, f, a, c;
|
|
2273
2273
|
for (let g = n.firstChild; g; g = g.nextSibling) {
|
|
2274
|
-
let m =
|
|
2274
|
+
let m = pt(g);
|
|
2275
2275
|
for (let b = 0; b < m.length; b++) {
|
|
2276
2276
|
let p = m[b];
|
|
2277
|
-
s &&
|
|
2277
|
+
s && ne(s, p) && (p = $e(Xe(p, s.bottom), s.top));
|
|
2278
2278
|
let w = un(t, p), x = gn(e, p);
|
|
2279
2279
|
if (w == 0 && x == 0)
|
|
2280
|
-
return g.nodeType == 3 ? Ue(g, t, e) :
|
|
2280
|
+
return g.nodeType == 3 ? Ue(g, t, e) : ve(g, t, e);
|
|
2281
2281
|
if (!i || o > x || o == x && r > w) {
|
|
2282
2282
|
i = g, s = p, r = w, o = x;
|
|
2283
2283
|
let S = x ? e < p.top ? -1 : 1 : w ? t < p.left ? -1 : 1 : 0;
|
|
2284
2284
|
l = !S || (S > 0 ? b < m.length - 1 : b > 0);
|
|
2285
2285
|
}
|
|
2286
|
-
w == 0 ? e > p.bottom && (!a || a.bottom < p.bottom) ? (h = g, a = p) : e < p.top && (!c || c.top > p.top) && (f = g, c = p) : a &&
|
|
2286
|
+
w == 0 ? e > p.bottom && (!a || a.bottom < p.bottom) ? (h = g, a = p) : e < p.top && (!c || c.top > p.top) && (f = g, c = p) : a && ne(a, p) ? a = Xe(a, p.bottom) : c && ne(c, p) && (c = $e(c, p.top));
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
2289
|
if (a && a.bottom >= e ? (i = h, s = a) : c && c.top <= e && (i = f, s = c), !i)
|
|
@@ -2292,14 +2292,14 @@ function xe(n, t, e) {
|
|
|
2292
2292
|
if (i.nodeType == 3)
|
|
2293
2293
|
return Ue(i, d, e);
|
|
2294
2294
|
if (l && i.contentEditable != "false")
|
|
2295
|
-
return
|
|
2295
|
+
return ve(i, d, e);
|
|
2296
2296
|
let u = Array.prototype.indexOf.call(n.childNodes, i) + (t >= (s.left + s.right) / 2 ? 1 : 0);
|
|
2297
2297
|
return { node: n, offset: u };
|
|
2298
2298
|
}
|
|
2299
2299
|
function Ue(n, t, e) {
|
|
2300
2300
|
let i = n.nodeValue.length, s = -1, r = 1e9, o = 0;
|
|
2301
2301
|
for (let l = 0; l < i; l++) {
|
|
2302
|
-
let h =
|
|
2302
|
+
let h = lt(n, l, l + 1).getClientRects();
|
|
2303
2303
|
for (let f = 0; f < h.length; f++) {
|
|
2304
2304
|
let a = h[f];
|
|
2305
2305
|
if (a.top == a.bottom)
|
|
@@ -2308,7 +2308,7 @@ function Ue(n, t, e) {
|
|
|
2308
2308
|
let c = (a.top > e ? a.top - e : e - a.bottom) - 1;
|
|
2309
2309
|
if (a.left - 1 <= t && a.right + 1 >= t && c < r) {
|
|
2310
2310
|
let d = t >= (a.left + a.right) / 2, u = d;
|
|
2311
|
-
if ((y.chrome || y.gecko) &&
|
|
2311
|
+
if ((y.chrome || y.gecko) && lt(n, l).getBoundingClientRect().left == a.right && (u = !d), c <= 0)
|
|
2312
2312
|
return { node: n, offset: l + (u ? 1 : 0) };
|
|
2313
2313
|
s = l + (u ? 1 : 0), r = c;
|
|
2314
2314
|
}
|
|
@@ -2352,7 +2352,7 @@ function hs(n, t, e, i = -1) {
|
|
|
2352
2352
|
let S = E.find(n.docView, u);
|
|
2353
2353
|
if (!S)
|
|
2354
2354
|
return d > h.top + h.height / 2 ? h.to : h.from;
|
|
2355
|
-
({ node: p, offset: w } =
|
|
2355
|
+
({ node: p, offset: w } = ve(S.dom, a, c));
|
|
2356
2356
|
}
|
|
2357
2357
|
let x = n.docView.nearest(p);
|
|
2358
2358
|
if (!x)
|
|
@@ -2379,7 +2379,7 @@ function pn(n, t, e) {
|
|
|
2379
2379
|
for (let s = n.nextSibling; s; s = s.nextSibling)
|
|
2380
2380
|
if (s.nodeType != 1 || s.nodeName != "BR")
|
|
2381
2381
|
return !1;
|
|
2382
|
-
return
|
|
2382
|
+
return lt(n, i - 1, i).getBoundingClientRect().left > e;
|
|
2383
2383
|
}
|
|
2384
2384
|
function mn(n, t, e) {
|
|
2385
2385
|
if (t != 0)
|
|
@@ -2392,7 +2392,7 @@ function mn(n, t, e) {
|
|
|
2392
2392
|
break;
|
|
2393
2393
|
s = r;
|
|
2394
2394
|
}
|
|
2395
|
-
let i = n.nodeType == 1 ? n.getBoundingClientRect() :
|
|
2395
|
+
let i = n.nodeType == 1 ? n.getBoundingClientRect() : lt(n, 0, Math.max(n.nodeValue.length, 1)).getBoundingClientRect();
|
|
2396
2396
|
return e - i.left > 5;
|
|
2397
2397
|
}
|
|
2398
2398
|
function bn(n, t) {
|
|
@@ -2408,7 +2408,7 @@ function yn(n, t, e, i) {
|
|
|
2408
2408
|
let s = bn(n, t.head), r = !i || s.type != z.Text || !(n.lineWrapping || s.widgetLineBreaks) ? null : n.coordsAtPos(t.assoc < 0 && t.head > s.from ? t.head - 1 : t.head);
|
|
2409
2409
|
if (r) {
|
|
2410
2410
|
let o = n.dom.getBoundingClientRect(), l = n.textDirectionAt(s.from), h = n.posAtCoords({
|
|
2411
|
-
x: e == (l ==
|
|
2411
|
+
x: e == (l == L.LTR) ? o.right - 1 : o.left + 1,
|
|
2412
2412
|
y: (r.top + r.bottom) / 2
|
|
2413
2413
|
});
|
|
2414
2414
|
if (h != null)
|
|
@@ -2464,7 +2464,7 @@ function Sn(n, t, e, i) {
|
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function Gt(n, t, e) {
|
|
2468
2468
|
for (; ; ) {
|
|
2469
2469
|
let i = 0;
|
|
2470
2470
|
for (let s of n)
|
|
@@ -2478,20 +2478,20 @@ function qt(n, t, e) {
|
|
|
2478
2478
|
return t;
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
|
-
function
|
|
2482
|
-
let i =
|
|
2481
|
+
function re(n, t, e) {
|
|
2482
|
+
let i = Gt(n.state.facet(He).map((s) => s(n)), e.from, t.head > e.from ? -1 : 1);
|
|
2483
2483
|
return i == e.from ? e : C.cursor(i, i < e.from ? 1 : -1);
|
|
2484
2484
|
}
|
|
2485
|
-
const
|
|
2485
|
+
const vt = "";
|
|
2486
2486
|
class xn {
|
|
2487
2487
|
constructor(t, e) {
|
|
2488
|
-
this.points = t, this.text = "", this.lineSeparator = e.facet(
|
|
2488
|
+
this.points = t, this.text = "", this.lineSeparator = e.facet(Mt.lineSeparator);
|
|
2489
2489
|
}
|
|
2490
2490
|
append(t) {
|
|
2491
2491
|
this.text += t;
|
|
2492
2492
|
}
|
|
2493
2493
|
lineBreak() {
|
|
2494
|
-
this.text +=
|
|
2494
|
+
this.text += vt;
|
|
2495
2495
|
}
|
|
2496
2496
|
readRange(t, e) {
|
|
2497
2497
|
if (!t)
|
|
@@ -2505,7 +2505,7 @@ class xn {
|
|
|
2505
2505
|
if (o == e)
|
|
2506
2506
|
break;
|
|
2507
2507
|
let l = O.get(s), h = O.get(o);
|
|
2508
|
-
(l && h ? l.breakAfter : (l ? l.breakAfter :
|
|
2508
|
+
(l && h ? l.breakAfter : (l ? l.breakAfter : $t(s)) || $t(o) && (s.nodeName != "BR" || s.cmIgnore) && this.text.length > r) && this.lineBreak(), s = o;
|
|
2509
2509
|
}
|
|
2510
2510
|
return this.findPointBefore(i, e), this;
|
|
2511
2511
|
}
|
|
@@ -2548,7 +2548,7 @@ function vn(n, t, e) {
|
|
|
2548
2548
|
return !1;
|
|
2549
2549
|
if (t == n)
|
|
2550
2550
|
return !0;
|
|
2551
|
-
e =
|
|
2551
|
+
e = ot(t) + 1, t = t.parentNode;
|
|
2552
2552
|
}
|
|
2553
2553
|
}
|
|
2554
2554
|
class Ze {
|
|
@@ -2566,7 +2566,7 @@ class Cn {
|
|
|
2566
2566
|
let l = r || o ? [] : An(t), h = new xn(l, t.state);
|
|
2567
2567
|
h.readRange(this.bounds.startDOM, this.bounds.endDOM), this.text = h.text, this.newSel = Dn(l, this.bounds.from);
|
|
2568
2568
|
} else {
|
|
2569
|
-
let l = t.observer.selectionRange, h = r && r.node == l.focusNode && r.offset == l.focusOffset || !
|
|
2569
|
+
let l = t.observer.selectionRange, h = r && r.node == l.focusNode && r.offset == l.focusOffset || !ce(t.contentDOM, l.focusNode) ? t.state.selection.main.head : t.docView.posFromDOM(l.focusNode, l.focusOffset), f = o && o.node == l.anchorNode && o.offset == l.anchorOffset || !ce(t.contentDOM, l.anchorNode) ? t.state.selection.main.anchor : t.docView.posFromDOM(l.anchorNode, l.anchorOffset), a = t.viewport;
|
|
2570
2570
|
if ((y.ios || y.chrome) && t.state.selection.main.empty && h != f && (a.from > 0 || a.to < t.state.doc.length)) {
|
|
2571
2571
|
let c = Math.min(h, f), d = Math.max(h, f), u = a.from - c, g = a.to - d;
|
|
2572
2572
|
(u == 0 || u == 1 || c == 0) && (g == 0 || g == -1 || d == t.state.doc.length) && (h = 0, f = t.state.doc.length);
|
|
@@ -2580,11 +2580,11 @@ function as(n, t) {
|
|
|
2580
2580
|
if (t.bounds) {
|
|
2581
2581
|
let { from: o, to: l } = t.bounds, h = s.from, f = null;
|
|
2582
2582
|
(r === 8 || y.android && t.text.length < l - o) && (h = s.to, f = "end");
|
|
2583
|
-
let a = kn(n.state.doc.sliceString(o, l,
|
|
2584
|
-
a && (y.chrome && r == 13 && a.toB == a.from + 2 && t.text.slice(a.from, a.toB) ==
|
|
2583
|
+
let a = kn(n.state.doc.sliceString(o, l, vt), t.text, h - o, f);
|
|
2584
|
+
a && (y.chrome && r == 13 && a.toB == a.from + 2 && t.text.slice(a.from, a.toB) == vt + vt && a.toB--, e = {
|
|
2585
2585
|
from: o + a.from,
|
|
2586
2586
|
to: o + a.toA,
|
|
2587
|
-
insert: W.of(t.text.slice(a.from, a.toB).split(
|
|
2587
|
+
insert: W.of(t.text.slice(a.from, a.toB).split(vt))
|
|
2588
2588
|
});
|
|
2589
2589
|
} else i && (!n.hasFocus && n.state.facet($) || i.main.eq(s)) && (i = null);
|
|
2590
2590
|
if (!e && !i)
|
|
@@ -2789,8 +2789,8 @@ const fs = [
|
|
|
2789
2789
|
{ key: "Enter", keyCode: 13, inputType: "insertParagraph" },
|
|
2790
2790
|
{ key: "Enter", keyCode: 13, inputType: "insertLineBreak" },
|
|
2791
2791
|
{ key: "Delete", keyCode: 46, inputType: "deleteContentForward" }
|
|
2792
|
-
], En = "dthko", cs = [16, 17, 18, 20, 91, 92, 224, 225],
|
|
2793
|
-
function
|
|
2792
|
+
], En = "dthko", cs = [16, 17, 18, 20, 91, 92, 224, 225], Ht = 6;
|
|
2793
|
+
function Nt(n) {
|
|
2794
2794
|
return Math.max(0, n) * 0.7 + 8;
|
|
2795
2795
|
}
|
|
2796
2796
|
function Rn(n, t) {
|
|
@@ -2800,7 +2800,7 @@ class Bn {
|
|
|
2800
2800
|
constructor(t, e, i, s) {
|
|
2801
2801
|
this.view = t, this.startEvent = e, this.style = i, this.mustSelect = s, this.scrollSpeed = { x: 0, y: 0 }, this.scrolling = -1, this.lastEvent = e, this.scrollParents = Ns(t.contentDOM), this.atoms = t.state.facet(He).map((o) => o(t));
|
|
2802
2802
|
let r = t.contentDOM.ownerDocument;
|
|
2803
|
-
r.addEventListener("mousemove", this.move = this.move.bind(this)), r.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = e.shiftKey, this.multiple = t.state.facet(
|
|
2803
|
+
r.addEventListener("mousemove", this.move = this.move.bind(this)), r.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = e.shiftKey, this.multiple = t.state.facet(Mt.allowMultipleSelections) && Ln(t, e), this.dragging = Hn(t, e) && gs(e) == 1 ? null : !1;
|
|
2804
2804
|
}
|
|
2805
2805
|
start(t) {
|
|
2806
2806
|
this.dragging === !1 && this.select(t);
|
|
@@ -2814,7 +2814,7 @@ class Bn {
|
|
|
2814
2814
|
let e = 0, i = 0, s = 0, r = 0, o = this.view.win.innerWidth, l = this.view.win.innerHeight;
|
|
2815
2815
|
this.scrollParents.x && ({ left: s, right: o } = this.scrollParents.x.getBoundingClientRect()), this.scrollParents.y && ({ top: r, bottom: l } = this.scrollParents.y.getBoundingClientRect());
|
|
2816
2816
|
let h = Ne(this.view);
|
|
2817
|
-
t.clientX - h.left <= s +
|
|
2817
|
+
t.clientX - h.left <= s + Ht ? e = -Nt(s - t.clientX) : t.clientX + h.right >= o - Ht && (e = Nt(t.clientX - o)), t.clientY - h.top <= r + Ht ? i = -Nt(r - t.clientY) : t.clientY + h.bottom >= l - Ht && (i = Nt(t.clientY - l)), this.setScrollSpeed(e, i);
|
|
2818
2818
|
}
|
|
2819
2819
|
up(t) {
|
|
2820
2820
|
this.dragging == null && this.select(this.lastEvent), this.dragging || t.preventDefault(), this.destroy();
|
|
@@ -2836,10 +2836,10 @@ class Bn {
|
|
|
2836
2836
|
for (let i = 0; i < t.ranges.length; i++) {
|
|
2837
2837
|
let s = t.ranges[i], r = null;
|
|
2838
2838
|
if (s.empty) {
|
|
2839
|
-
let o =
|
|
2839
|
+
let o = Gt(this.atoms, s.from, 0);
|
|
2840
2840
|
o != s.from && (r = C.cursor(o, -1));
|
|
2841
2841
|
} else {
|
|
2842
|
-
let o =
|
|
2842
|
+
let o = Gt(this.atoms, s.from, -1), l = Gt(this.atoms, s.to, 1);
|
|
2843
2843
|
(o != s.from || l != s.to) && (r = C.range(s.from == s.anchor ? o : l, s.from == s.head ? o : l));
|
|
2844
2844
|
}
|
|
2845
2845
|
r && (e || (e = t.ranges.slice()), e[i] = r);
|
|
@@ -2869,7 +2869,7 @@ function Hn(n, t) {
|
|
|
2869
2869
|
let { main: e } = n.state.selection;
|
|
2870
2870
|
if (e.empty)
|
|
2871
2871
|
return !1;
|
|
2872
|
-
let i =
|
|
2872
|
+
let i = Ot(n.root);
|
|
2873
2873
|
if (!i || i.rangeCount == 0)
|
|
2874
2874
|
return !0;
|
|
2875
2875
|
let s = i.getRangeAt(0).getClientRects();
|
|
@@ -2900,15 +2900,15 @@ function Vn(n) {
|
|
|
2900
2900
|
n.focus(), e.remove(), us(n, e.value);
|
|
2901
2901
|
}, 50);
|
|
2902
2902
|
}
|
|
2903
|
-
function
|
|
2903
|
+
function ee(n, t, e) {
|
|
2904
2904
|
for (let i of n.facet(t))
|
|
2905
2905
|
e = i(e, n);
|
|
2906
2906
|
return e;
|
|
2907
2907
|
}
|
|
2908
2908
|
function us(n, t) {
|
|
2909
|
-
t =
|
|
2909
|
+
t = ee(n.state, Be, t);
|
|
2910
2910
|
let { state: e } = n, i, s = 1, r = e.toText(t), o = r.lines == e.selection.ranges.length;
|
|
2911
|
-
if (
|
|
2911
|
+
if (Ce != null && e.selection.ranges.every((h) => h.empty) && Ce == r.toString()) {
|
|
2912
2912
|
let h = -1;
|
|
2913
2913
|
i = e.changeByRange((f) => {
|
|
2914
2914
|
let a = e.doc.lineAt(f.from);
|
|
@@ -3035,11 +3035,11 @@ G.dragstart = (n, t) => {
|
|
|
3035
3035
|
}
|
|
3036
3036
|
}
|
|
3037
3037
|
let { inputState: i } = n;
|
|
3038
|
-
return i.mouseSelection && (i.mouseSelection.dragging = !0), i.draggedContent = e, t.dataTransfer && (t.dataTransfer.setData("Text",
|
|
3038
|
+
return i.mouseSelection && (i.mouseSelection.dragging = !0), i.draggedContent = e, t.dataTransfer && (t.dataTransfer.setData("Text", ee(n.state, Le, n.state.sliceDoc(e.from, e.to))), t.dataTransfer.effectAllowed = "copyMove"), !1;
|
|
3039
3039
|
};
|
|
3040
3040
|
G.dragend = (n) => (n.inputState.draggedContent = null, !1);
|
|
3041
3041
|
function li(n, t, e, i) {
|
|
3042
|
-
if (e =
|
|
3042
|
+
if (e = ee(n.state, Be, e), !e)
|
|
3043
3043
|
return;
|
|
3044
3044
|
let s = n.posAtCoords({ x: t.clientX, y: t.clientY }, !1), { draggedContent: r } = n.inputState, o = i && r && Pn(n, t) ? { from: r.from, to: r.to } : null, l = { from: s, insert: e }, h = n.state.changes(o ? [o, l] : l);
|
|
3045
3045
|
n.focus(), n.dispatch({
|
|
@@ -3100,14 +3100,14 @@ function qn(n) {
|
|
|
3100
3100
|
}
|
|
3101
3101
|
i = !0;
|
|
3102
3102
|
}
|
|
3103
|
-
return { text:
|
|
3103
|
+
return { text: ee(n, Le, t.join(n.lineBreak)), ranges: e, linewise: i };
|
|
3104
3104
|
}
|
|
3105
|
-
let
|
|
3105
|
+
let Ce = null;
|
|
3106
3106
|
G.copy = G.cut = (n, t) => {
|
|
3107
3107
|
let { text: e, ranges: i, linewise: s } = qn(n.state);
|
|
3108
3108
|
if (!e && !s)
|
|
3109
3109
|
return !1;
|
|
3110
|
-
|
|
3110
|
+
Ce = s ? e : null, t.type == "cut" && !n.state.readOnly && n.dispatch({
|
|
3111
3111
|
changes: i,
|
|
3112
3112
|
scrollIntoView: !0,
|
|
3113
3113
|
userEvent: "delete.cut"
|
|
@@ -3176,9 +3176,9 @@ function Gn(n) {
|
|
|
3176
3176
|
}));
|
|
3177
3177
|
}
|
|
3178
3178
|
const ai = ["pre-wrap", "normal", "pre-line", "break-spaces"];
|
|
3179
|
-
let
|
|
3179
|
+
let yt = !1;
|
|
3180
3180
|
function fi() {
|
|
3181
|
-
|
|
3181
|
+
yt = !1;
|
|
3182
3182
|
}
|
|
3183
3183
|
class jn {
|
|
3184
3184
|
constructor(t) {
|
|
@@ -3276,8 +3276,8 @@ class Y {
|
|
|
3276
3276
|
var T = /* @__PURE__ */ (function(n) {
|
|
3277
3277
|
return n[n.ByPos = 0] = "ByPos", n[n.ByHeight = 1] = "ByHeight", n[n.ByPosNoHeight = 2] = "ByPosNoHeight", n;
|
|
3278
3278
|
})(T || (T = {}));
|
|
3279
|
-
const
|
|
3280
|
-
class
|
|
3279
|
+
const jt = 1e-3;
|
|
3280
|
+
class H {
|
|
3281
3281
|
constructor(t, e, i = 2) {
|
|
3282
3282
|
this.length = t, this.height = e, this.flags = i;
|
|
3283
3283
|
}
|
|
@@ -3288,13 +3288,13 @@ class P {
|
|
|
3288
3288
|
this.flags = (t ? 2 : 0) | this.flags & -3;
|
|
3289
3289
|
}
|
|
3290
3290
|
setHeight(t) {
|
|
3291
|
-
this.height != t && (Math.abs(this.height - t) >
|
|
3291
|
+
this.height != t && (Math.abs(this.height - t) > jt && (yt = !0), this.height = t);
|
|
3292
3292
|
}
|
|
3293
3293
|
// Base case is to replace a leaf node, which simply builds a tree
|
|
3294
3294
|
// from the new nodes and returns that (HeightMapBranch and
|
|
3295
3295
|
// HeightMapGap override this to actually use from/to)
|
|
3296
3296
|
replace(t, e, i) {
|
|
3297
|
-
return
|
|
3297
|
+
return H.of(i);
|
|
3298
3298
|
}
|
|
3299
3299
|
// Again, these are base cases, and are overridden for branch and gap nodes.
|
|
3300
3300
|
decomposeLeft(t, e) {
|
|
@@ -3311,12 +3311,12 @@ class P {
|
|
|
3311
3311
|
h = s[l - 1].fromA, a = s[l - 1].fromB, l--, h < d.from && (d = r.lineAt(h, T.ByPosNoHeight, i, 0, 0));
|
|
3312
3312
|
a += d.from - h, h = d.from;
|
|
3313
3313
|
let g = Fe.build(i.setDoc(o), t, a, c);
|
|
3314
|
-
r =
|
|
3314
|
+
r = Qt(r, r.replace(h, f, g));
|
|
3315
3315
|
}
|
|
3316
3316
|
return r.updateHeight(i, 0);
|
|
3317
3317
|
}
|
|
3318
3318
|
static empty() {
|
|
3319
|
-
return new
|
|
3319
|
+
return new F(0, 0);
|
|
3320
3320
|
}
|
|
3321
3321
|
// nodes uses null values to indicate the position of line breaks.
|
|
3322
3322
|
// There are never line breaks at the start or end of the array, or
|
|
@@ -3344,14 +3344,14 @@ class P {
|
|
|
3344
3344
|
l && (r += l.size);
|
|
3345
3345
|
}
|
|
3346
3346
|
let o = 0;
|
|
3347
|
-
return t[e - 1] == null ? (o = 1, e--) : t[e] == null && (o = 1, i++), new _n(
|
|
3347
|
+
return t[e - 1] == null ? (o = 1, e--) : t[e] == null && (o = 1, i++), new _n(H.of(t.slice(0, e)), o, H.of(t.slice(i)));
|
|
3348
3348
|
}
|
|
3349
3349
|
}
|
|
3350
|
-
function
|
|
3351
|
-
return n == t ? n : (n.constructor != t.constructor && (
|
|
3350
|
+
function Qt(n, t) {
|
|
3351
|
+
return n == t ? n : (n.constructor != t.constructor && (yt = !0), t);
|
|
3352
3352
|
}
|
|
3353
|
-
|
|
3354
|
-
class ys extends
|
|
3353
|
+
H.prototype.size = 1;
|
|
3354
|
+
class ys extends H {
|
|
3355
3355
|
constructor(t, e, i) {
|
|
3356
3356
|
super(t, e), this.deco = i;
|
|
3357
3357
|
}
|
|
@@ -3371,7 +3371,7 @@ class ys extends P {
|
|
|
3371
3371
|
return `block(${this.length})`;
|
|
3372
3372
|
}
|
|
3373
3373
|
}
|
|
3374
|
-
class
|
|
3374
|
+
class F extends ys {
|
|
3375
3375
|
constructor(t, e) {
|
|
3376
3376
|
super(t, e, null), this.collapsed = 0, this.widgetHeight = 0, this.breaks = 0;
|
|
3377
3377
|
}
|
|
@@ -3380,7 +3380,7 @@ class V extends ys {
|
|
|
3380
3380
|
}
|
|
3381
3381
|
replace(t, e, i) {
|
|
3382
3382
|
let s = i[0];
|
|
3383
|
-
return i.length == 1 && (s instanceof
|
|
3383
|
+
return i.length == 1 && (s instanceof F || s instanceof R && s.flags & 4) && Math.abs(this.length - s.length) < 10 ? (s instanceof R ? s = new F(s.length, this.height) : s.height = this.height, this.outdated || (s.outdated = !1), s) : H.of(i);
|
|
3384
3384
|
}
|
|
3385
3385
|
updateHeight(t, e = 0, i = !1, s) {
|
|
3386
3386
|
return s && s.from <= e && s.more ? this.setHeight(s.heights[s.index++]) : (i || this.outdated) && this.setHeight(Math.max(this.widgetHeight, t.heightForLine(this.length - this.collapsed)) + this.breaks * t.lineHeight), this.outdated = !1, this;
|
|
@@ -3389,7 +3389,7 @@ class V extends ys {
|
|
|
3389
3389
|
return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
|
-
class R extends
|
|
3392
|
+
class R extends H {
|
|
3393
3393
|
constructor(t) {
|
|
3394
3394
|
super(t, 0);
|
|
3395
3395
|
}
|
|
@@ -3445,7 +3445,7 @@ class R extends P {
|
|
|
3445
3445
|
let r = i[0];
|
|
3446
3446
|
r instanceof R ? i[0] = new R(t + r.length) : i.unshift(new R(t - 1), null);
|
|
3447
3447
|
}
|
|
3448
|
-
return
|
|
3448
|
+
return H.of(i);
|
|
3449
3449
|
}
|
|
3450
3450
|
decomposeLeft(t, e) {
|
|
3451
3451
|
e.push(new R(t - 1), null);
|
|
@@ -3461,13 +3461,13 @@ class R extends P {
|
|
|
3461
3461
|
let a = t.doc.lineAt(l).length;
|
|
3462
3462
|
o.length && o.push(null);
|
|
3463
3463
|
let c = s.heights[s.index++];
|
|
3464
|
-
h == -1 ? h = c : Math.abs(c - h) >=
|
|
3465
|
-
let d = new
|
|
3464
|
+
h == -1 ? h = c : Math.abs(c - h) >= jt && (h = -2);
|
|
3465
|
+
let d = new F(a, c);
|
|
3466
3466
|
d.outdated = !1, o.push(d), l += a + 1;
|
|
3467
3467
|
}
|
|
3468
3468
|
l <= r && o.push(null, new R(r - l).updateHeight(t, l));
|
|
3469
|
-
let f =
|
|
3470
|
-
return (h < 0 || Math.abs(f.height - this.height) >=
|
|
3469
|
+
let f = H.of(o);
|
|
3470
|
+
return (h < 0 || Math.abs(f.height - this.height) >= jt || Math.abs(h - this.heightMetrics(t, e).perLine) >= jt) && (yt = !0), Qt(this, f);
|
|
3471
3471
|
} else (i || this.outdated) && (this.setHeight(t.heightForGap(e, e + this.length)), this.outdated = !1);
|
|
3472
3472
|
return this;
|
|
3473
3473
|
}
|
|
@@ -3475,7 +3475,7 @@ class R extends P {
|
|
|
3475
3475
|
return `gap(${this.length})`;
|
|
3476
3476
|
}
|
|
3477
3477
|
}
|
|
3478
|
-
class _n extends
|
|
3478
|
+
class _n extends H {
|
|
3479
3479
|
constructor(t, e, i) {
|
|
3480
3480
|
super(t.length + e + i.length, t.height + i.height, e | (t.outdated || i.outdated ? 2 : 0)), this.left = t, this.right = i, this.size = t.size + i.size;
|
|
3481
3481
|
}
|
|
@@ -3517,7 +3517,7 @@ class _n extends P {
|
|
|
3517
3517
|
let l = r.length;
|
|
3518
3518
|
this.decomposeRight(e, r), ci(r, l);
|
|
3519
3519
|
}
|
|
3520
|
-
return
|
|
3520
|
+
return H.of(r);
|
|
3521
3521
|
}
|
|
3522
3522
|
decomposeLeft(t, e) {
|
|
3523
3523
|
let i = this.left.length;
|
|
@@ -3532,7 +3532,7 @@ class _n extends P {
|
|
|
3532
3532
|
t < i && this.left.decomposeRight(t, e), this.break && t < s && e.push(null), e.push(this.right);
|
|
3533
3533
|
}
|
|
3534
3534
|
balanced(t, e) {
|
|
3535
|
-
return t.size > 2 * e.size || e.size > 2 * t.size ?
|
|
3535
|
+
return t.size > 2 * e.size || e.size > 2 * t.size ? H.of(this.break ? [t, null, e] : [t, e]) : (this.left = Qt(this.left, t), this.right = Qt(this.right, e), this.setHeight(t.height + e.height), this.outdated = t.outdated || e.outdated, this.size = t.size + e.size, this.length = t.length + this.break + e.length, this);
|
|
3536
3536
|
}
|
|
3537
3537
|
updateHeight(t, e = 0, i = !1, s) {
|
|
3538
3538
|
let { left: r, right: o } = this, l = e + r.length + this.break, h = null;
|
|
@@ -3557,7 +3557,7 @@ class Fe {
|
|
|
3557
3557
|
span(t, e) {
|
|
3558
3558
|
if (this.lineStart > -1) {
|
|
3559
3559
|
let i = Math.min(e, this.lineEnd), s = this.nodes[this.nodes.length - 1];
|
|
3560
|
-
s instanceof
|
|
3560
|
+
s instanceof F ? s.length += i - this.pos : (i > this.pos || !this.isCovered) && this.nodes.push(new F(i - this.pos, -1)), this.writtenTo = i, e > i && (this.nodes.push(null), this.writtenTo++, this.lineStart = -1);
|
|
3561
3561
|
}
|
|
3562
3562
|
this.pos = e;
|
|
3563
3563
|
}
|
|
@@ -3574,7 +3574,7 @@ class Fe {
|
|
|
3574
3574
|
if (this.lineStart > -1)
|
|
3575
3575
|
return;
|
|
3576
3576
|
let { from: t, to: e } = this.oracle.doc.lineAt(this.pos);
|
|
3577
|
-
this.lineStart = t, this.lineEnd = e, this.writtenTo < t && ((this.writtenTo < t - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, t - 1)), this.nodes.push(null)), this.pos > t && this.nodes.push(new
|
|
3577
|
+
this.lineStart = t, this.lineEnd = e, this.writtenTo < t && ((this.writtenTo < t - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, t - 1)), this.nodes.push(null)), this.pos > t && this.nodes.push(new F(this.pos - t, -1)), this.writtenTo = this.pos;
|
|
3578
3578
|
}
|
|
3579
3579
|
blankContent(t, e) {
|
|
3580
3580
|
let i = new R(e - t);
|
|
@@ -3583,9 +3583,9 @@ class Fe {
|
|
|
3583
3583
|
ensureLine() {
|
|
3584
3584
|
this.enterLine();
|
|
3585
3585
|
let t = this.nodes.length ? this.nodes[this.nodes.length - 1] : null;
|
|
3586
|
-
if (t instanceof
|
|
3586
|
+
if (t instanceof F)
|
|
3587
3587
|
return t;
|
|
3588
|
-
let e = new
|
|
3588
|
+
let e = new F(0, -1);
|
|
3589
3589
|
return this.nodes.push(e), e;
|
|
3590
3590
|
}
|
|
3591
3591
|
addBlock(t) {
|
|
@@ -3599,10 +3599,10 @@ class Fe {
|
|
|
3599
3599
|
}
|
|
3600
3600
|
finish(t) {
|
|
3601
3601
|
let e = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
|
|
3602
|
-
this.lineStart > -1 && !(e instanceof
|
|
3602
|
+
this.lineStart > -1 && !(e instanceof F) && !this.isCovered ? this.nodes.push(new F(0, -1)) : (this.writtenTo < this.pos || e == null) && this.nodes.push(this.blankContent(this.writtenTo, this.pos));
|
|
3603
3603
|
let i = t;
|
|
3604
3604
|
for (let s of this.nodes)
|
|
3605
|
-
s instanceof
|
|
3605
|
+
s instanceof F && s.updateHeight(this.oracle, i), i += s ? s.length : 1;
|
|
3606
3606
|
return this.nodes;
|
|
3607
3607
|
}
|
|
3608
3608
|
// Always called with a region that on both sides either stretches
|
|
@@ -3612,12 +3612,12 @@ class Fe {
|
|
|
3612
3612
|
// to each other.
|
|
3613
3613
|
static build(t, e, i, s) {
|
|
3614
3614
|
let r = new Fe(i, t);
|
|
3615
|
-
return
|
|
3615
|
+
return N.spans(e, i, s, r, 0), r.finish(i);
|
|
3616
3616
|
}
|
|
3617
3617
|
}
|
|
3618
3618
|
function Xn(n, t, e) {
|
|
3619
3619
|
let i = new Un();
|
|
3620
|
-
return
|
|
3620
|
+
return N.compare(n, t, e, i, 0), i.changes;
|
|
3621
3621
|
}
|
|
3622
3622
|
class Un {
|
|
3623
3623
|
constructor() {
|
|
@@ -3626,7 +3626,7 @@ class Un {
|
|
|
3626
3626
|
compareRange() {
|
|
3627
3627
|
}
|
|
3628
3628
|
comparePoint(t, e, i, s) {
|
|
3629
|
-
(t < e || i && i.heightRelevant || s && s.heightRelevant) &&
|
|
3629
|
+
(t < e || i && i.heightRelevant || s && s.heightRelevant) && qt(t, e, this.changes, 5);
|
|
3630
3630
|
}
|
|
3631
3631
|
}
|
|
3632
3632
|
function Qn(n, t) {
|
|
@@ -3663,7 +3663,7 @@ function Zn(n, t) {
|
|
|
3663
3663
|
bottom: e.bottom - (e.top + t)
|
|
3664
3664
|
};
|
|
3665
3665
|
}
|
|
3666
|
-
class
|
|
3666
|
+
class oe {
|
|
3667
3667
|
constructor(t, e, i, s) {
|
|
3668
3668
|
this.from = t, this.to = e, this.size = i, this.displaySize = s;
|
|
3669
3669
|
}
|
|
@@ -3678,12 +3678,12 @@ class re {
|
|
|
3678
3678
|
return !0;
|
|
3679
3679
|
}
|
|
3680
3680
|
draw(t, e) {
|
|
3681
|
-
return
|
|
3681
|
+
return B.replace({
|
|
3682
3682
|
widget: new tr(this.displaySize * (e ? t.scaleY : t.scaleX), e)
|
|
3683
3683
|
}).range(this.from, this.to);
|
|
3684
3684
|
}
|
|
3685
3685
|
}
|
|
3686
|
-
class tr extends
|
|
3686
|
+
class tr extends te {
|
|
3687
3687
|
constructor(t, e) {
|
|
3688
3688
|
super(), this.size = t, this.vertical = e;
|
|
3689
3689
|
}
|
|
@@ -3700,12 +3700,12 @@ class tr extends Ee {
|
|
|
3700
3700
|
}
|
|
3701
3701
|
class di {
|
|
3702
3702
|
constructor(t) {
|
|
3703
|
-
this.state = t, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = !0, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = !1, this.scaleX = 1, this.scaleY = 1, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = ui, this.scrollTarget = null, this.printing = !1, this.mustMeasureContent = !0, this.defaultTextDirection =
|
|
3703
|
+
this.state = t, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = !0, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = !1, this.scaleX = 1, this.scaleY = 1, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = ui, this.scrollTarget = null, this.printing = !1, this.mustMeasureContent = !0, this.defaultTextDirection = L.LTR, this.visibleRanges = [], this.mustEnforceCursorAssoc = !1;
|
|
3704
3704
|
let e = t.facet(Pe).some((i) => typeof i != "function" && i.class == "cm-lineWrapping");
|
|
3705
|
-
this.heightOracle = new jn(e), this.stateDeco = t.facet(Tt).filter((i) => typeof i != "function"), this.heightMap =
|
|
3705
|
+
this.heightOracle = new jn(e), this.stateDeco = t.facet(Tt).filter((i) => typeof i != "function"), this.heightMap = H.empty().applyChanges(this.stateDeco, W.empty, this.heightOracle.setDoc(t.doc), [new I(0, 0, 0, t.doc.length)]);
|
|
3706
3706
|
for (let i = 0; i < 2 && (this.viewport = this.getViewport(0, null), !!this.updateForViewport()); i++)
|
|
3707
3707
|
;
|
|
3708
|
-
this.updateViewportLines(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco =
|
|
3708
|
+
this.updateViewportLines(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco = B.set(this.lineGaps.map((i) => i.draw(this, !1))), this.computeVisibleRanges();
|
|
3709
3709
|
}
|
|
3710
3710
|
updateForViewport() {
|
|
3711
3711
|
let t = [this.viewport], { main: e } = this.state.selection;
|
|
@@ -3713,7 +3713,7 @@ class di {
|
|
|
3713
3713
|
let s = i ? e.head : e.anchor;
|
|
3714
3714
|
if (!t.some(({ from: r, to: o }) => s >= r && s <= o)) {
|
|
3715
3715
|
let { from: r, to: o } = this.lineBlockAt(s);
|
|
3716
|
-
t.push(new
|
|
3716
|
+
t.push(new Vt(r, o));
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
3719
|
return this.viewports = t.sort((i, s) => i.from - s.from), this.updateScaler();
|
|
@@ -3724,7 +3724,7 @@ class di {
|
|
|
3724
3724
|
}
|
|
3725
3725
|
updateViewportLines() {
|
|
3726
3726
|
this.viewportLines = [], this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, (t) => {
|
|
3727
|
-
this.viewportLines.push(
|
|
3727
|
+
this.viewportLines.push(Ct(t, this.scaler));
|
|
3728
3728
|
});
|
|
3729
3729
|
}
|
|
3730
3730
|
update(t, e = null) {
|
|
@@ -3732,7 +3732,7 @@ class di {
|
|
|
3732
3732
|
let i = this.stateDeco;
|
|
3733
3733
|
this.stateDeco = this.state.facet(Tt).filter((a) => typeof a != "function");
|
|
3734
3734
|
let s = t.changedRanges, r = I.extendWithRanges(s, Xn(i, this.stateDeco, t ? t.changes : Ai.empty(this.state.doc.length))), o = this.heightMap.height, l = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop);
|
|
3735
|
-
fi(), this.heightMap = this.heightMap.applyChanges(this.stateDeco, t.startState.doc, this.heightOracle.setDoc(this.state.doc), r), (this.heightMap.height != o ||
|
|
3735
|
+
fi(), this.heightMap = this.heightMap.applyChanges(this.stateDeco, t.startState.doc, this.heightOracle.setDoc(this.state.doc), r), (this.heightMap.height != o || yt) && (t.flags |= 2), l ? (this.scrollAnchorPos = t.changes.mapPos(l.from, -1), this.scrollAnchorHeight = l.top) : (this.scrollAnchorPos = -1, this.scrollAnchorHeight = this.heightMap.height);
|
|
3736
3736
|
let h = r.length ? this.mapViewport(this.viewport, t.changes) : this.viewport;
|
|
3737
3737
|
(e && (e.range.head < h.from || e.range.head > h.to) || !this.viewportIsAppropriate(h)) && (h = this.getViewport(0, e));
|
|
3738
3738
|
let f = h.from != this.viewport.from || h.to != this.viewport.to;
|
|
@@ -3740,7 +3740,7 @@ class di {
|
|
|
3740
3740
|
}
|
|
3741
3741
|
measure(t) {
|
|
3742
3742
|
let e = t.contentDOM, i = window.getComputedStyle(e), s = this.heightOracle, r = i.whiteSpace;
|
|
3743
|
-
this.defaultTextDirection = i.direction == "rtl" ?
|
|
3743
|
+
this.defaultTextDirection = i.direction == "rtl" ? L.RTL : L.LTR;
|
|
3744
3744
|
let o = this.heightOracle.mustRefreshForWrapping(r), l = e.getBoundingClientRect(), h = o || this.mustMeasureContent || this.contentDOMHeight != l.height;
|
|
3745
3745
|
this.contentDOMHeight = l.height, this.mustMeasureContent = !1;
|
|
3746
3746
|
let f = 0, a = 0;
|
|
@@ -3761,15 +3761,15 @@ class di {
|
|
|
3761
3761
|
if ((this.contentDOMWidth != w || this.editorHeight != t.scrollDOM.clientHeight) && (this.contentDOMWidth = l.width, this.editorHeight = t.scrollDOM.clientHeight, f |= 16), h) {
|
|
3762
3762
|
let S = t.docView.measureVisibleLineHeights(this.viewport);
|
|
3763
3763
|
if (s.mustRefreshForHeights(S) && (o = !0), o || s.lineWrapping && Math.abs(w - this.contentDOMWidth) > s.charWidth) {
|
|
3764
|
-
let { lineHeight: A, charWidth: M, textHeight:
|
|
3765
|
-
o = A > 0 && s.refresh(r, A, M,
|
|
3764
|
+
let { lineHeight: A, charWidth: M, textHeight: nt } = t.docView.measureTextSize();
|
|
3765
|
+
o = A > 0 && s.refresh(r, A, M, nt, w / M, S), o && (t.docView.minWidth = 0, f |= 16);
|
|
3766
3766
|
}
|
|
3767
3767
|
m > 0 && b > 0 ? a = Math.max(m, b) : m < 0 && b < 0 && (a = Math.min(m, b)), fi();
|
|
3768
3768
|
for (let A of this.viewports) {
|
|
3769
3769
|
let M = A.from == this.viewport.from ? S : t.docView.measureVisibleLineHeights(A);
|
|
3770
|
-
this.heightMap = (o ?
|
|
3770
|
+
this.heightMap = (o ? H.empty().applyChanges(this.stateDeco, W.empty, this.heightOracle, [new I(0, 0, 0, t.state.doc.length)]) : this.heightMap).updateHeight(s, 0, o, new Yn(A.from, M));
|
|
3771
3771
|
}
|
|
3772
|
-
|
|
3772
|
+
yt && (f |= 2);
|
|
3773
3773
|
}
|
|
3774
3774
|
let x = !this.viewportIsAppropriate(this.viewport, a) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to);
|
|
3775
3775
|
return x && (f & 2 && (f |= this.updateScaler()), this.viewport = this.getViewport(a, this.scrollTarget), f |= this.updateForViewport()), (f & 2 || x) && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 4e3) && this.updateLineGaps(this.ensureLineGaps(o ? [] : this.lineGaps, t)), f |= this.computeVisibleRanges(), this.mustEnforceCursorAssoc && (this.mustEnforceCursorAssoc = !1, t.docView.enforceCursorAssoc()), f;
|
|
@@ -3781,19 +3781,19 @@ class di {
|
|
|
3781
3781
|
return this.scaler.fromDOM(this.pixelViewport.bottom);
|
|
3782
3782
|
}
|
|
3783
3783
|
getViewport(t, e) {
|
|
3784
|
-
let i = 0.5 - Math.max(-0.5, Math.min(0.5, t / 1e3 / 2)), s = this.heightMap, r = this.heightOracle, { visibleTop: o, visibleBottom: l } = this, h = new
|
|
3784
|
+
let i = 0.5 - Math.max(-0.5, Math.min(0.5, t / 1e3 / 2)), s = this.heightMap, r = this.heightOracle, { visibleTop: o, visibleBottom: l } = this, h = new Vt(s.lineAt(o - i * 1e3, T.ByHeight, r, 0, 0).from, s.lineAt(l + (1 - i) * 1e3, T.ByHeight, r, 0, 0).to);
|
|
3785
3785
|
if (e) {
|
|
3786
3786
|
let { head: f } = e.range;
|
|
3787
3787
|
if (f < h.from || f > h.to) {
|
|
3788
3788
|
let a = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top), c = s.lineAt(f, T.ByPos, r, 0, 0), d;
|
|
3789
|
-
e.y == "center" ? d = (c.top + c.bottom) / 2 - a / 2 : e.y == "start" || e.y == "nearest" && f < h.from ? d = c.top : d = c.bottom - a, h = new
|
|
3789
|
+
e.y == "center" ? d = (c.top + c.bottom) / 2 - a / 2 : e.y == "start" || e.y == "nearest" && f < h.from ? d = c.top : d = c.bottom - a, h = new Vt(s.lineAt(d - 1e3 / 2, T.ByHeight, r, 0, 0).from, s.lineAt(d + a + 1e3 / 2, T.ByHeight, r, 0, 0).to);
|
|
3790
3790
|
}
|
|
3791
3791
|
}
|
|
3792
3792
|
return h;
|
|
3793
3793
|
}
|
|
3794
3794
|
mapViewport(t, e) {
|
|
3795
3795
|
let i = e.mapPos(t.from, -1), s = e.mapPos(t.to, 1);
|
|
3796
|
-
return new
|
|
3796
|
+
return new Vt(this.heightMap.lineAt(i, T.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(s, T.ByPos, this.heightOracle, 0, 0).to);
|
|
3797
3797
|
}
|
|
3798
3798
|
// Checks if a given viewport covers the visible part of the
|
|
3799
3799
|
// document and not too much beyond that.
|
|
@@ -3816,7 +3816,7 @@ class di {
|
|
|
3816
3816
|
return t;
|
|
3817
3817
|
let i = [];
|
|
3818
3818
|
for (let s of t)
|
|
3819
|
-
e.touchesRange(s.from, s.to) || i.push(new
|
|
3819
|
+
e.touchesRange(s.from, s.to) || i.push(new oe(e.mapPos(s.from), e.mapPos(s.to), s.size, s.displaySize));
|
|
3820
3820
|
return i;
|
|
3821
3821
|
}
|
|
3822
3822
|
// Computes positions in the viewport where the start or end of a
|
|
@@ -3828,7 +3828,7 @@ class di {
|
|
|
3828
3828
|
// the artifacts this might produce from the user.
|
|
3829
3829
|
ensureLineGaps(t, e) {
|
|
3830
3830
|
let i = this.heightOracle.lineWrapping, s = i ? 1e4 : 2e3, r = s >> 1, o = s << 1;
|
|
3831
|
-
if (this.defaultTextDirection !=
|
|
3831
|
+
if (this.defaultTextDirection != L.LTR && !i)
|
|
3832
3832
|
return [];
|
|
3833
3833
|
let l = [], h = (a, c, d, u) => {
|
|
3834
3834
|
if (c - a < r)
|
|
@@ -3847,7 +3847,7 @@ class di {
|
|
|
3847
3847
|
x > a && (c = x);
|
|
3848
3848
|
}
|
|
3849
3849
|
let p = this.gapSize(d, a, c, u), w = i || p < 2e6 ? p : 2e6;
|
|
3850
|
-
b = new
|
|
3850
|
+
b = new oe(a, c, p, w);
|
|
3851
3851
|
}
|
|
3852
3852
|
l.push(b);
|
|
3853
3853
|
}, f = (a) => {
|
|
@@ -3860,11 +3860,11 @@ class di {
|
|
|
3860
3860
|
if (i) {
|
|
3861
3861
|
let m = s / this.heightOracle.lineLength * this.heightOracle.lineHeight, b, p;
|
|
3862
3862
|
if (d != null) {
|
|
3863
|
-
let w =
|
|
3863
|
+
let w = Wt(c, d), x = ((this.visibleBottom - this.visibleTop) / 2 + m) / a.height;
|
|
3864
3864
|
b = w - x, p = w + x;
|
|
3865
3865
|
} else
|
|
3866
3866
|
b = (this.visibleTop - a.top - m) / a.height, p = (this.visibleBottom - a.top + m) / a.height;
|
|
3867
|
-
u =
|
|
3867
|
+
u = Ft(c, b), g = Ft(c, p);
|
|
3868
3868
|
} else {
|
|
3869
3869
|
let m = c.total * this.heightOracle.charWidth, b = s * this.heightOracle.charWidth, p = 0;
|
|
3870
3870
|
if (m > 2e6)
|
|
@@ -3872,11 +3872,11 @@ class di {
|
|
|
3872
3872
|
M.from >= a.from && M.from < a.to && M.size != M.displaySize && M.from * this.heightOracle.charWidth + p < this.pixelViewport.left && (p = M.size - M.displaySize);
|
|
3873
3873
|
let w = this.pixelViewport.left + p, x = this.pixelViewport.right + p, S, A;
|
|
3874
3874
|
if (d != null) {
|
|
3875
|
-
let M =
|
|
3876
|
-
S = M -
|
|
3875
|
+
let M = Wt(c, d), nt = ((x - w) / 2 + b) / m;
|
|
3876
|
+
S = M - nt, A = M + nt;
|
|
3877
3877
|
} else
|
|
3878
3878
|
S = (w - b) / m, A = (x + b) / m;
|
|
3879
|
-
u =
|
|
3879
|
+
u = Ft(c, S), g = Ft(c, A);
|
|
3880
3880
|
}
|
|
3881
3881
|
u > a.from && h(a.from, u, a, c), g < a.to && h(g, a.to, a, c);
|
|
3882
3882
|
};
|
|
@@ -3885,17 +3885,17 @@ class di {
|
|
|
3885
3885
|
return l;
|
|
3886
3886
|
}
|
|
3887
3887
|
gapSize(t, e, i, s) {
|
|
3888
|
-
let r =
|
|
3888
|
+
let r = Wt(s, i) - Wt(s, e);
|
|
3889
3889
|
return this.heightOracle.lineWrapping ? t.height * r : s.total * this.heightOracle.charWidth * r;
|
|
3890
3890
|
}
|
|
3891
3891
|
updateLineGaps(t) {
|
|
3892
|
-
|
|
3892
|
+
oe.same(t, this.lineGaps) || (this.lineGaps = t, this.lineGapDeco = B.set(t.map((e) => e.draw(this, this.heightOracle.lineWrapping))));
|
|
3893
3893
|
}
|
|
3894
3894
|
computeVisibleRanges(t) {
|
|
3895
3895
|
let e = this.stateDeco;
|
|
3896
3896
|
this.lineGaps.length && (e = e.concat(this.lineGapDeco));
|
|
3897
3897
|
let i = [];
|
|
3898
|
-
|
|
3898
|
+
N.spans(e, this.viewport.from, this.viewport.to, {
|
|
3899
3899
|
span(r, o) {
|
|
3900
3900
|
i.push({ from: r, to: o });
|
|
3901
3901
|
},
|
|
@@ -3913,17 +3913,17 @@ class di {
|
|
|
3913
3913
|
return this.visibleRanges = i, s;
|
|
3914
3914
|
}
|
|
3915
3915
|
lineBlockAt(t) {
|
|
3916
|
-
return t >= this.viewport.from && t <= this.viewport.to && this.viewportLines.find((e) => e.from <= t && e.to >= t) ||
|
|
3916
|
+
return t >= this.viewport.from && t <= this.viewport.to && this.viewportLines.find((e) => e.from <= t && e.to >= t) || Ct(this.heightMap.lineAt(t, T.ByPos, this.heightOracle, 0, 0), this.scaler);
|
|
3917
3917
|
}
|
|
3918
3918
|
lineBlockAtHeight(t) {
|
|
3919
|
-
return t >= this.viewportLines[0].top && t <= this.viewportLines[this.viewportLines.length - 1].bottom && this.viewportLines.find((e) => e.top <= t && e.bottom >= t) ||
|
|
3919
|
+
return t >= this.viewportLines[0].top && t <= this.viewportLines[this.viewportLines.length - 1].bottom && this.viewportLines.find((e) => e.top <= t && e.bottom >= t) || Ct(this.heightMap.lineAt(this.scaler.fromDOM(t), T.ByHeight, this.heightOracle, 0, 0), this.scaler);
|
|
3920
3920
|
}
|
|
3921
3921
|
scrollAnchorAt(t) {
|
|
3922
3922
|
let e = this.lineBlockAtHeight(t + 8);
|
|
3923
3923
|
return e.from >= this.viewport.from || this.viewportLines[0].top - t > 200 ? e : this.viewportLines[0];
|
|
3924
3924
|
}
|
|
3925
3925
|
elementAtHeight(t) {
|
|
3926
|
-
return
|
|
3926
|
+
return Ct(this.heightMap.blockAt(this.scaler.fromDOM(t), this.heightOracle, 0, 0), this.scaler);
|
|
3927
3927
|
}
|
|
3928
3928
|
get docHeight() {
|
|
3929
3929
|
return this.scaler.toDOM(this.heightMap.height);
|
|
@@ -3932,14 +3932,14 @@ class di {
|
|
|
3932
3932
|
return this.docHeight + this.paddingTop + this.paddingBottom;
|
|
3933
3933
|
}
|
|
3934
3934
|
}
|
|
3935
|
-
class
|
|
3935
|
+
class Vt {
|
|
3936
3936
|
constructor(t, e) {
|
|
3937
3937
|
this.from = t, this.to = e;
|
|
3938
3938
|
}
|
|
3939
3939
|
}
|
|
3940
3940
|
function er(n, t, e) {
|
|
3941
3941
|
let i = [], s = n, r = 0;
|
|
3942
|
-
return
|
|
3942
|
+
return N.spans(e, n, t, {
|
|
3943
3943
|
span() {
|
|
3944
3944
|
},
|
|
3945
3945
|
point(o, l) {
|
|
@@ -3947,7 +3947,7 @@ function er(n, t, e) {
|
|
|
3947
3947
|
}
|
|
3948
3948
|
}, 20), s < t && (i.push({ from: s, to: t }), r += t - s), { total: r, ranges: i };
|
|
3949
3949
|
}
|
|
3950
|
-
function
|
|
3950
|
+
function Ft({ total: n, ranges: t }, e) {
|
|
3951
3951
|
if (e <= 0)
|
|
3952
3952
|
return t[0].from;
|
|
3953
3953
|
if (e >= 1)
|
|
@@ -3960,7 +3960,7 @@ function Vt({ total: n, ranges: t }, e) {
|
|
|
3960
3960
|
i -= l;
|
|
3961
3961
|
}
|
|
3962
3962
|
}
|
|
3963
|
-
function
|
|
3963
|
+
function Wt(n, t) {
|
|
3964
3964
|
let e = 0;
|
|
3965
3965
|
for (let { from: i, to: s } of n.ranges) {
|
|
3966
3966
|
if (t <= s) {
|
|
@@ -4022,14 +4022,14 @@ class We {
|
|
|
4022
4022
|
return t instanceof We ? this.scale == t.scale && this.viewports.length == t.viewports.length && this.viewports.every((e, i) => e.from == t.viewports[i].from && e.to == t.viewports[i].to) : !1;
|
|
4023
4023
|
}
|
|
4024
4024
|
}
|
|
4025
|
-
function
|
|
4025
|
+
function Ct(n, t) {
|
|
4026
4026
|
if (t.scale == 1)
|
|
4027
4027
|
return n;
|
|
4028
4028
|
let e = t.toDOM(n.top), i = t.toDOM(n.bottom);
|
|
4029
|
-
return new Y(n.from, n.length, e, i - e, Array.isArray(n._content) ? n._content.map((s) =>
|
|
4029
|
+
return new Y(n.from, n.length, e, i - e, Array.isArray(n._content) ? n._content.map((s) => Ct(s, t)) : n._content);
|
|
4030
4030
|
}
|
|
4031
|
-
const
|
|
4032
|
-
function
|
|
4031
|
+
const zt = /* @__PURE__ */ v.define({ combine: (n) => n.join(" ") }), Me = /* @__PURE__ */ v.define({ combine: (n) => n.indexOf(!0) > -1 }), ke = /* @__PURE__ */ gt.newName(), ws = /* @__PURE__ */ gt.newName(), Ss = /* @__PURE__ */ gt.newName(), xs = { "&light": "." + ws, "&dark": "." + Ss };
|
|
4032
|
+
function Ae(n, t, e) {
|
|
4033
4033
|
return new gt(t, {
|
|
4034
4034
|
finish(i) {
|
|
4035
4035
|
return /&/.test(i) ? i.replace(/&\w*/, (s) => {
|
|
@@ -4042,7 +4042,7 @@ function ke(n, t, e) {
|
|
|
4042
4042
|
}
|
|
4043
4043
|
});
|
|
4044
4044
|
}
|
|
4045
|
-
const sr = /* @__PURE__ */
|
|
4045
|
+
const sr = /* @__PURE__ */ Ae("." + ke, {
|
|
4046
4046
|
"&": {
|
|
4047
4047
|
position: "relative !important",
|
|
4048
4048
|
boxSizing: "border-box",
|
|
@@ -4298,7 +4298,7 @@ const sr = /* @__PURE__ */ ke("." + Me, {
|
|
|
4298
4298
|
subtree: !0,
|
|
4299
4299
|
attributes: !0,
|
|
4300
4300
|
characterDataOldValue: !0
|
|
4301
|
-
},
|
|
4301
|
+
}, le = y.ie && y.ie_version <= 11;
|
|
4302
4302
|
class rr {
|
|
4303
4303
|
constructor(t) {
|
|
4304
4304
|
this.view = t, this.active = !1, this.editContext = null, this.selectionRange = new Vs(), this.selectionChanged = !1, this.delayedFlush = -1, this.resizeTimeout = -1, this.queue = [], this.delayedAndroidKey = null, this.flushingAndroidKey = -1, this.lastChange = 0, this.scrollTargets = [], this.intersection = null, this.resizeScroll = null, this.intersecting = !1, this.gapIntersection = null, this.gaps = [], this.printQuery = null, this.parentCheck = -1, this.dom = t.contentDOM, this.observer = new MutationObserver((e) => {
|
|
@@ -4306,7 +4306,7 @@ class rr {
|
|
|
4306
4306
|
this.queue.push(i);
|
|
4307
4307
|
(y.ie && y.ie_version <= 11 || y.ios && t.composing) && e.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
|
|
4308
4308
|
}), window.EditContext && t.constructor.EDIT_CONTEXT !== !1 && // Chrome <126 doesn't support inverted selections in edit context (#1392)
|
|
4309
|
-
!(y.chrome && y.chrome_version < 126) && (this.editContext = new lr(t), t.state.facet($) && (t.contentDOM.editContext = this.editContext.editContext)),
|
|
4309
|
+
!(y.chrome && y.chrome_version < 126) && (this.editContext = new lr(t), t.state.facet($) && (t.contentDOM.editContext = this.editContext.editContext)), le && (this.onCharData = (e) => {
|
|
4310
4310
|
this.queue.push({
|
|
4311
4311
|
target: e.target,
|
|
4312
4312
|
type: "characterData",
|
|
@@ -4350,7 +4350,7 @@ class rr {
|
|
|
4350
4350
|
if (!this.readSelectionRange() || this.delayedAndroidKey)
|
|
4351
4351
|
return;
|
|
4352
4352
|
let { view: i } = this, s = this.selectionRange;
|
|
4353
|
-
if (i.state.facet($) ? i.root.activeElement != this.dom : !
|
|
4353
|
+
if (i.state.facet($) ? i.root.activeElement != this.dom : !Kt(this.dom, s))
|
|
4354
4354
|
return;
|
|
4355
4355
|
let r = s.anchorNode && i.docView.nearest(s.anchorNode);
|
|
4356
4356
|
if (r && r.ignoreEvent(t)) {
|
|
@@ -4358,16 +4358,16 @@ class rr {
|
|
|
4358
4358
|
return;
|
|
4359
4359
|
}
|
|
4360
4360
|
(y.ie && y.ie_version <= 11 || y.android && y.chrome) && !i.state.selection.main.empty && // (Selection.isCollapsed isn't reliable on IE)
|
|
4361
|
-
s.focusNode &&
|
|
4361
|
+
s.focusNode && At(s.focusNode, s.focusOffset, s.anchorNode, s.anchorOffset) ? this.flushSoon() : this.flush(!1);
|
|
4362
4362
|
}
|
|
4363
4363
|
readSelectionRange() {
|
|
4364
|
-
let { view: t } = this, e =
|
|
4364
|
+
let { view: t } = this, e = Ot(t.root);
|
|
4365
4365
|
if (!e)
|
|
4366
4366
|
return !1;
|
|
4367
4367
|
let i = y.safari && t.root.nodeType == 11 && t.root.activeElement == this.dom && or(this.view, e) || e;
|
|
4368
4368
|
if (!i || this.selectionRange.eq(i))
|
|
4369
4369
|
return !1;
|
|
4370
|
-
let s =
|
|
4370
|
+
let s = Kt(this.dom, i);
|
|
4371
4371
|
return s && !this.selectionChanged && t.inputState.lastFocusTime > Date.now() - 200 && t.inputState.lastTouchTime < Date.now() - 300 && Ws(this.dom, i) ? (this.view.inputState.lastFocusTime = 0, t.docView.updateSelection(), !1) : (this.selectionRange.setRange(i), s && (this.selectionChanged = !0), !0);
|
|
4372
4372
|
}
|
|
4373
4373
|
setSelectionRange(t, e) {
|
|
@@ -4403,10 +4403,10 @@ class rr {
|
|
|
4403
4403
|
}
|
|
4404
4404
|
}
|
|
4405
4405
|
start() {
|
|
4406
|
-
this.active || (this.observer.observe(this.dom, nr),
|
|
4406
|
+
this.active || (this.observer.observe(this.dom, nr), le && this.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.active = !0);
|
|
4407
4407
|
}
|
|
4408
4408
|
stop() {
|
|
4409
|
-
this.active && (this.active = !1, this.observer.disconnect(),
|
|
4409
|
+
this.active && (this.active = !1, this.observer.disconnect(), le && this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData));
|
|
4410
4410
|
}
|
|
4411
4411
|
// Throw away any pending changes
|
|
4412
4412
|
clear() {
|
|
@@ -4466,7 +4466,7 @@ class rr {
|
|
|
4466
4466
|
return { from: e, to: i, typeOver: s };
|
|
4467
4467
|
}
|
|
4468
4468
|
readChange() {
|
|
4469
|
-
let { from: t, to: e, typeOver: i } = this.processRecords(), s = this.selectionChanged &&
|
|
4469
|
+
let { from: t, to: e, typeOver: i } = this.processRecords(), s = this.selectionChanged && Kt(this.dom, this.selectionRange);
|
|
4470
4470
|
if (t < 0 && !s)
|
|
4471
4471
|
return null;
|
|
4472
4472
|
t > -1 && (this.lastChange = Date.now()), this.view.inputState.lastFocusTime = 0, this.selectionChanged = !1;
|
|
@@ -4529,7 +4529,7 @@ function gi(n, t, e) {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
function pi(n, t) {
|
|
4531
4531
|
let e = t.startContainer, i = t.startOffset, s = t.endContainer, r = t.endOffset, o = n.docView.domAtPos(n.state.selection.main.anchor);
|
|
4532
|
-
return
|
|
4532
|
+
return At(o.node, o.offset, s, r) && ([e, i, s, r] = [s, r, e, i]), { anchorNode: e, anchorOffset: i, focusNode: s, focusOffset: r };
|
|
4533
4533
|
}
|
|
4534
4534
|
function or(n, t) {
|
|
4535
4535
|
if (t.getComposedRanges) {
|
|
@@ -4581,11 +4581,11 @@ class lr {
|
|
|
4581
4581
|
let h = this.toEditorPos(r.rangeStart), f = this.toEditorPos(r.rangeEnd);
|
|
4582
4582
|
if (h < f) {
|
|
4583
4583
|
let a = `text-decoration: underline ${o == "Dashed" ? "dashed " : o == "Squiggle" ? "wavy " : ""}${l == "Thin" ? 1 : 2}px`;
|
|
4584
|
-
s.push(
|
|
4584
|
+
s.push(B.mark({ attributes: { style: a } }).range(h, f));
|
|
4585
4585
|
}
|
|
4586
4586
|
}
|
|
4587
4587
|
}
|
|
4588
|
-
t.dispatch({ effects: is.of(
|
|
4588
|
+
t.dispatch({ effects: is.of(B.set(s)) });
|
|
4589
4589
|
}, this.handlers.compositionstart = () => {
|
|
4590
4590
|
t.inputState.composing < 0 && (t.inputState.composing = 0, t.inputState.compositionFirstChange = !0);
|
|
4591
4591
|
}, this.handlers.compositionend = () => {
|
|
@@ -4598,7 +4598,7 @@ class lr {
|
|
|
4598
4598
|
e.addEventListener(i, this.handlers[i]);
|
|
4599
4599
|
this.measureReq = { read: (i) => {
|
|
4600
4600
|
this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());
|
|
4601
|
-
let s =
|
|
4601
|
+
let s = Ot(i.root);
|
|
4602
4602
|
s && s.rangeCount && this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect());
|
|
4603
4603
|
} };
|
|
4604
4604
|
}
|
|
@@ -4744,7 +4744,7 @@ class k {
|
|
|
4744
4744
|
var e;
|
|
4745
4745
|
this.plugins = [], this.pluginMap = /* @__PURE__ */ new Map(), this.editorAttrs = {}, this.contentAttrs = {}, this.bidiCache = [], this.destroyed = !1, this.updateState = 2, this.measureScheduled = -1, this.measureRequests = [], this.contentDOM = document.createElement("div"), this.scrollDOM = document.createElement("div"), this.scrollDOM.tabIndex = -1, this.scrollDOM.className = "cm-scroller", this.scrollDOM.appendChild(this.contentDOM), this.announceDOM = document.createElement("div"), this.announceDOM.className = "cm-announced", this.announceDOM.setAttribute("aria-live", "polite"), this.dom = document.createElement("div"), this.dom.appendChild(this.announceDOM), this.dom.appendChild(this.scrollDOM), t.parent && t.parent.appendChild(this.dom);
|
|
4746
4746
|
let { dispatch: i } = t;
|
|
4747
|
-
this.dispatchTransactions = t.dispatchTransactions || i && ((s) => s.forEach((r) => i(r, this))) || ((s) => this.update(s)), this.dispatch = this.dispatch.bind(this), this._root = t.root || Fs(t.parent) || document, this.viewState = new di(t.state ||
|
|
4747
|
+
this.dispatchTransactions = t.dispatchTransactions || i && ((s) => s.forEach((r) => i(r, this))) || ((s) => this.update(s)), this.dispatch = this.dispatch.bind(this), this._root = t.root || Fs(t.parent) || document, this.viewState = new di(t.state || Mt.create(t)), t.scrollTo && t.scrollTo.is(Pt) && (this.viewState.scrollTarget = t.scrollTo.value.clip(this.viewState.state)), this.plugins = this.state.facet(St).map((s) => new se(s));
|
|
4748
4748
|
for (let s of this.plugins)
|
|
4749
4749
|
s.update(this);
|
|
4750
4750
|
this.observer = new rr(this), this.inputState = new On(this), this.inputState.ensureHandlers(this.plugins), this.docView = new _e(this), this.mountStyles(), this.updateAttrs(), this.updateState = 0, this.requestMeasure(), !((e = document.fonts) === null || e === void 0) && e.ready && document.fonts.ready.then(() => this.requestMeasure());
|
|
@@ -4777,9 +4777,9 @@ class k {
|
|
|
4777
4777
|
let o = this.hasFocus, l = 0, h = null;
|
|
4778
4778
|
t.some((d) => d.annotation(ps)) ? (this.inputState.notifiedFocused = o, l = 1) : o != this.inputState.notifiedFocused && (this.inputState.notifiedFocused = o, h = ms(r, o), h || (l = 1));
|
|
4779
4779
|
let f = this.observer.delayedAndroidKey, a = null;
|
|
4780
|
-
if (f ? (this.observer.clearDelayedAndroidKey(), a = this.observer.readChange(), (a && !this.state.doc.eq(r.doc) || !this.state.selection.eq(r.selection)) && (a = null)) : this.observer.clear(), r.facet(
|
|
4780
|
+
if (f ? (this.observer.clearDelayedAndroidKey(), a = this.observer.readChange(), (a && !this.state.doc.eq(r.doc) || !this.state.selection.eq(r.selection)) && (a = null)) : this.observer.clear(), r.facet(Mt.phrases) != this.state.facet(Mt.phrases))
|
|
4781
4781
|
return this.setState(r);
|
|
4782
|
-
s =
|
|
4782
|
+
s = Ut.create(this, r, t), s.flags |= l;
|
|
4783
4783
|
let c = this.viewState.scrollTarget;
|
|
4784
4784
|
try {
|
|
4785
4785
|
this.updateState = 2;
|
|
@@ -4789,14 +4789,14 @@ class k {
|
|
|
4789
4789
|
c = new ut(u.empty ? u : C.cursor(u.head, u.head > u.anchor ? -1 : 1));
|
|
4790
4790
|
}
|
|
4791
4791
|
for (let u of d.effects)
|
|
4792
|
-
u.is(
|
|
4792
|
+
u.is(Pt) && (c = u.value.clip(this.state));
|
|
4793
4793
|
}
|
|
4794
|
-
this.viewState.update(s, c), this.bidiCache =
|
|
4794
|
+
this.viewState.update(s, c), this.bidiCache = Jt.update(this.bidiCache, s.changes), s.empty || (this.updatePlugins(s), this.inputState.update(s)), e = this.docView.update(s), this.state.facet(xt) != this.styleModules && this.mountStyles(), i = this.updateAttrs(), this.showAnnouncements(t), this.docView.updateSelection(e, t.some((d) => d.isUserEvent("select.pointer")));
|
|
4795
4795
|
} finally {
|
|
4796
4796
|
this.updateState = 0;
|
|
4797
4797
|
}
|
|
4798
|
-
if (s.startState.facet(
|
|
4799
|
-
for (let d of this.state.facet(
|
|
4798
|
+
if (s.startState.facet(zt) != s.state.facet(zt) && (this.viewState.mustMeasureContent = !0), (e || i || c || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) && this.requestMeasure(), e && this.docViewUpdate(), !s.empty)
|
|
4799
|
+
for (let d of this.state.facet(xe))
|
|
4800
4800
|
try {
|
|
4801
4801
|
d(s);
|
|
4802
4802
|
} catch (u) {
|
|
@@ -4825,7 +4825,7 @@ class k {
|
|
|
4825
4825
|
try {
|
|
4826
4826
|
for (let i of this.plugins)
|
|
4827
4827
|
i.destroy(this);
|
|
4828
|
-
this.viewState = new di(t), this.plugins = t.facet(
|
|
4828
|
+
this.viewState = new di(t), this.plugins = t.facet(St).map((i) => new se(i)), this.pluginMap.clear();
|
|
4829
4829
|
for (let i of this.plugins)
|
|
4830
4830
|
i.update(this);
|
|
4831
4831
|
this.docView.destroy(), this.docView = new _e(this), this.inputState.ensureHandlers(this.plugins), this.mountStyles(), this.updateAttrs(), this.bidiCache = [];
|
|
@@ -4835,13 +4835,13 @@ class k {
|
|
|
4835
4835
|
e && this.focus(), this.requestMeasure();
|
|
4836
4836
|
}
|
|
4837
4837
|
updatePlugins(t) {
|
|
4838
|
-
let e = t.startState.facet(
|
|
4838
|
+
let e = t.startState.facet(St), i = t.state.facet(St);
|
|
4839
4839
|
if (e != i) {
|
|
4840
4840
|
let s = [];
|
|
4841
4841
|
for (let r of i) {
|
|
4842
4842
|
let o = e.indexOf(r);
|
|
4843
4843
|
if (o < 0)
|
|
4844
|
-
s.push(new
|
|
4844
|
+
s.push(new se(r));
|
|
4845
4845
|
else {
|
|
4846
4846
|
let l = this.plugins[o];
|
|
4847
4847
|
l.mustUpdate = t, s.push(l);
|
|
@@ -4906,7 +4906,7 @@ class k {
|
|
|
4906
4906
|
} catch (g) {
|
|
4907
4907
|
return X(this.state, g), mi;
|
|
4908
4908
|
}
|
|
4909
|
-
}), c =
|
|
4909
|
+
}), c = Ut.create(this, this.state, []), d = !1;
|
|
4910
4910
|
c.flags |= h, e ? e.flags |= h : e = c, this.updateState = 2, c.empty || (this.updatePlugins(c), this.inputState.update(c), this.updateAttrs(), d = this.docView.update(c), d && this.docViewUpdate());
|
|
4911
4911
|
for (let u = 0; u < f.length; u++)
|
|
4912
4912
|
if (a[u] != mi)
|
|
@@ -4935,14 +4935,14 @@ class k {
|
|
|
4935
4935
|
this.updateState = 0, this.measureScheduled = -1;
|
|
4936
4936
|
}
|
|
4937
4937
|
if (e && !e.empty)
|
|
4938
|
-
for (let l of this.state.facet(
|
|
4938
|
+
for (let l of this.state.facet(xe))
|
|
4939
4939
|
l(e);
|
|
4940
4940
|
}
|
|
4941
4941
|
/**
|
|
4942
4942
|
Get the CSS classes for the currently active editor themes.
|
|
4943
4943
|
*/
|
|
4944
4944
|
get themeClasses() {
|
|
4945
|
-
return
|
|
4945
|
+
return ke + " " + (this.state.facet(Me) ? Ss : ws) + " " + this.state.facet(zt);
|
|
4946
4946
|
}
|
|
4947
4947
|
updateAttrs() {
|
|
4948
4948
|
let t = bi(this, ss, {
|
|
@@ -4961,7 +4961,7 @@ class k {
|
|
|
4961
4961
|
};
|
|
4962
4962
|
this.state.readOnly && (e["aria-readonly"] = "true"), bi(this, Pe, e);
|
|
4963
4963
|
let i = this.observer.ignore(() => {
|
|
4964
|
-
let s =
|
|
4964
|
+
let s = me(this.contentDOM, this.contentAttrs, e), r = me(this.dom, this.editorAttrs, t);
|
|
4965
4965
|
return s || r;
|
|
4966
4966
|
});
|
|
4967
4967
|
return this.editorAttrs = t, this.contentAttrs = e, i;
|
|
@@ -4977,7 +4977,7 @@ class k {
|
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
4979
4979
|
mountStyles() {
|
|
4980
|
-
this.styleModules = this.state.facet(
|
|
4980
|
+
this.styleModules = this.state.facet(xt);
|
|
4981
4981
|
let t = this.state.facet(k.cspNonce);
|
|
4982
4982
|
gt.mount(this.root, this.styleModules.concat(sr).reverse(), t ? { nonce: t } : void 0);
|
|
4983
4983
|
}
|
|
@@ -5106,7 +5106,7 @@ class k {
|
|
|
5106
5106
|
whether it should also be moved over.
|
|
5107
5107
|
*/
|
|
5108
5108
|
moveByChar(t, e, i) {
|
|
5109
|
-
return
|
|
5109
|
+
return re(this, t, Je(this, t, e, i));
|
|
5110
5110
|
}
|
|
5111
5111
|
/**
|
|
5112
5112
|
Move a cursor position across the next group of either
|
|
@@ -5114,7 +5114,7 @@ class k {
|
|
|
5114
5114
|
non-whitespace characters.
|
|
5115
5115
|
*/
|
|
5116
5116
|
moveByGroup(t, e) {
|
|
5117
|
-
return
|
|
5117
|
+
return re(this, t, Je(this, t, e, (i) => wn(this, t.head, i)));
|
|
5118
5118
|
}
|
|
5119
5119
|
/**
|
|
5120
5120
|
Get the cursor position visually at the start or end of a line.
|
|
@@ -5150,7 +5150,7 @@ class k {
|
|
|
5150
5150
|
used.
|
|
5151
5151
|
*/
|
|
5152
5152
|
moveVertically(t, e, i) {
|
|
5153
|
-
return
|
|
5153
|
+
return re(this, t, Sn(this, t, e, i));
|
|
5154
5154
|
}
|
|
5155
5155
|
/**
|
|
5156
5156
|
Find the DOM parent node and offset (child offset if `node` is
|
|
@@ -5189,7 +5189,7 @@ class k {
|
|
|
5189
5189
|
if (!i || i.left == i.right)
|
|
5190
5190
|
return i;
|
|
5191
5191
|
let s = this.state.doc.lineAt(t), r = this.bidiSpans(s), o = r[tt.find(r, t - s.from, -1, e)];
|
|
5192
|
-
return
|
|
5192
|
+
return Et(i, o.dir == L.LTR == e > 0);
|
|
5193
5193
|
}
|
|
5194
5194
|
/**
|
|
5195
5195
|
Return the rectangle around a given character. If `pos` does not
|
|
@@ -5262,7 +5262,7 @@ class k {
|
|
|
5262
5262
|
return r.order;
|
|
5263
5263
|
i || (i = Ye(this, t));
|
|
5264
5264
|
let s = Zs(t.text, e, i);
|
|
5265
|
-
return this.bidiCache.push(new
|
|
5265
|
+
return this.bidiCache.push(new Jt(t.from, t.to, e, i, !0, s)), s;
|
|
5266
5266
|
}
|
|
5267
5267
|
/**
|
|
5268
5268
|
Check whether the editor has focus.
|
|
@@ -5304,7 +5304,7 @@ class k {
|
|
|
5304
5304
|
cause it to scroll the given position or range into view.
|
|
5305
5305
|
*/
|
|
5306
5306
|
static scrollIntoView(t, e = {}) {
|
|
5307
|
-
return
|
|
5307
|
+
return Pt.of(new ut(typeof t == "number" ? C.cursor(t) : t, e.y, e.x, e.yMargin, e.xMargin));
|
|
5308
5308
|
}
|
|
5309
5309
|
/**
|
|
5310
5310
|
Return an effect that resets the editor to its current (at the
|
|
@@ -5320,7 +5320,7 @@ class k {
|
|
|
5320
5320
|
*/
|
|
5321
5321
|
scrollSnapshot() {
|
|
5322
5322
|
let { scrollTop: t, scrollLeft: e } = this.scrollDOM, i = this.viewState.scrollAnchorAt(t);
|
|
5323
|
-
return
|
|
5323
|
+
return Pt.of(new ut(C.cursor(i.from), "start", "start", i.top - t, e, !0));
|
|
5324
5324
|
}
|
|
5325
5325
|
/**
|
|
5326
5326
|
Enable or disable tab-focus mode, which disables key bindings
|
|
@@ -5349,7 +5349,7 @@ class k {
|
|
|
5349
5349
|
its parent nodes is scrolled.
|
|
5350
5350
|
*/
|
|
5351
5351
|
static domEventHandlers(t) {
|
|
5352
|
-
return
|
|
5352
|
+
return it.define(() => ({}), { eventHandlers: t });
|
|
5353
5353
|
}
|
|
5354
5354
|
/**
|
|
5355
5355
|
Create an extension that registers DOM event observers. Contrary
|
|
@@ -5360,7 +5360,7 @@ class k {
|
|
|
5360
5360
|
call `preventDefault`.
|
|
5361
5361
|
*/
|
|
5362
5362
|
static domEventObservers(t) {
|
|
5363
|
-
return
|
|
5363
|
+
return it.define(() => ({}), { eventObservers: t });
|
|
5364
5364
|
}
|
|
5365
5365
|
/**
|
|
5366
5366
|
Create a theme extension. The first argument can be a
|
|
@@ -5381,8 +5381,8 @@ class k {
|
|
|
5381
5381
|
`&light` when a light theme is active).
|
|
5382
5382
|
*/
|
|
5383
5383
|
static theme(t, e) {
|
|
5384
|
-
let i = gt.newName(), s = [
|
|
5385
|
-
return e && e.dark && s.push(
|
|
5384
|
+
let i = gt.newName(), s = [zt.of(i), xt.of(Ae(`.${i}`, t))];
|
|
5385
|
+
return e && e.dark && s.push(Me.of(!0)), s;
|
|
5386
5386
|
}
|
|
5387
5387
|
/**
|
|
5388
5388
|
Create an extension that adds styles to the base theme. Like
|
|
@@ -5392,7 +5392,7 @@ class k {
|
|
|
5392
5392
|
target editors with a dark or light theme.
|
|
5393
5393
|
*/
|
|
5394
5394
|
static baseTheme(t) {
|
|
5395
|
-
return ki.lowest(
|
|
5395
|
+
return ki.lowest(xt.of(Ae("." + ke, t, xs)));
|
|
5396
5396
|
}
|
|
5397
5397
|
/**
|
|
5398
5398
|
Retrieve an editor view instance from the view's DOM
|
|
@@ -5404,7 +5404,7 @@ class k {
|
|
|
5404
5404
|
return ((e = s?.rootView) === null || e === void 0 ? void 0 : e.view) || null;
|
|
5405
5405
|
}
|
|
5406
5406
|
}
|
|
5407
|
-
k.styleModule =
|
|
5407
|
+
k.styleModule = xt;
|
|
5408
5408
|
k.inputHandler = Ji;
|
|
5409
5409
|
k.clipboardInputFilter = Be;
|
|
5410
5410
|
k.clipboardOutputFilter = Le;
|
|
@@ -5412,7 +5412,7 @@ k.scrollHandler = es;
|
|
|
5412
5412
|
k.focusChangeEffect = Zi;
|
|
5413
5413
|
k.perLineTextDirection = ts;
|
|
5414
5414
|
k.exceptionSink = Qi;
|
|
5415
|
-
k.updateListener =
|
|
5415
|
+
k.updateListener = xe;
|
|
5416
5416
|
k.editable = $;
|
|
5417
5417
|
k.mouseSelectionStyle = Ui;
|
|
5418
5418
|
k.dragMovesSelection = Xi;
|
|
@@ -5422,24 +5422,24 @@ k.outerDecorations = ns;
|
|
|
5422
5422
|
k.atomicRanges = He;
|
|
5423
5423
|
k.bidiIsolatedRanges = rs;
|
|
5424
5424
|
k.scrollMargins = os;
|
|
5425
|
-
k.darkTheme =
|
|
5425
|
+
k.darkTheme = Me;
|
|
5426
5426
|
k.cspNonce = /* @__PURE__ */ v.define({ combine: (n) => n.length ? n[0] : "" });
|
|
5427
5427
|
k.contentAttributes = Pe;
|
|
5428
5428
|
k.editorAttributes = ss;
|
|
5429
5429
|
k.lineWrapping = /* @__PURE__ */ k.contentAttributes.of({ class: "cm-lineWrapping" });
|
|
5430
|
-
k.announce = /* @__PURE__ */
|
|
5430
|
+
k.announce = /* @__PURE__ */ Te.define();
|
|
5431
5431
|
const hr = 4096, mi = {};
|
|
5432
|
-
class
|
|
5432
|
+
class Jt {
|
|
5433
5433
|
constructor(t, e, i, s, r, o) {
|
|
5434
5434
|
this.from = t, this.to = e, this.dir = i, this.isolates = s, this.fresh = r, this.order = o;
|
|
5435
5435
|
}
|
|
5436
5436
|
static update(t, e) {
|
|
5437
5437
|
if (e.empty && !t.some((r) => r.fresh))
|
|
5438
5438
|
return t;
|
|
5439
|
-
let i = [], s = t.length ? t[t.length - 1].dir :
|
|
5439
|
+
let i = [], s = t.length ? t[t.length - 1].dir : L.LTR;
|
|
5440
5440
|
for (let r = Math.max(0, t.length - 10); r < t.length; r++) {
|
|
5441
5441
|
let o = t[r];
|
|
5442
|
-
o.dir == s && !e.touchesRange(o.from, o.to) && i.push(new
|
|
5442
|
+
o.dir == s && !e.touchesRange(o.from, o.to) && i.push(new Jt(e.mapPos(o.from, 1), e.mapPos(o.to, -1), o.dir, o.isolates, !1, o.order));
|
|
5443
5443
|
}
|
|
5444
5444
|
return i;
|
|
5445
5445
|
}
|
|
@@ -5447,7 +5447,7 @@ class Qt {
|
|
|
5447
5447
|
function bi(n, t, e) {
|
|
5448
5448
|
for (let i = n.state.facet(t), s = i.length - 1; s >= 0; s--) {
|
|
5449
5449
|
let r = i[s], o = typeof r == "function" ? r(n) : r;
|
|
5450
|
-
o &&
|
|
5450
|
+
o && pe(o, e);
|
|
5451
5451
|
}
|
|
5452
5452
|
return e;
|
|
5453
5453
|
}
|
|
@@ -5474,7 +5474,7 @@ function fr(n, t) {
|
|
|
5474
5474
|
}
|
|
5475
5475
|
return s && (i = "Alt-" + i), r && (i = "Ctrl-" + i), l && (i = "Meta-" + i), o && (i = "Shift-" + i), i;
|
|
5476
5476
|
}
|
|
5477
|
-
function
|
|
5477
|
+
function It(n, t, e) {
|
|
5478
5478
|
return t.altKey && (n = "Alt-" + n), t.ctrlKey && (n = "Ctrl-" + n), t.metaKey && (n = "Meta-" + n), e !== !1 && t.shiftKey && (n = "Shift-" + n), n;
|
|
5479
5479
|
}
|
|
5480
5480
|
const cr = /* @__PURE__ */ ki.default(/* @__PURE__ */ k.domEventHandlers({
|
|
@@ -5528,7 +5528,7 @@ function pr(n, t = ar) {
|
|
|
5528
5528
|
a._any || (a._any = { preventDefault: !1, stopPropagation: !1, run: [] });
|
|
5529
5529
|
let { any: c } = o;
|
|
5530
5530
|
for (let d in a)
|
|
5531
|
-
a[d].run.push((u) => c(u,
|
|
5531
|
+
a[d].run.push((u) => c(u, De));
|
|
5532
5532
|
}
|
|
5533
5533
|
let h = o[t] || o.key;
|
|
5534
5534
|
if (h)
|
|
@@ -5537,10 +5537,10 @@ function pr(n, t = ar) {
|
|
|
5537
5537
|
}
|
|
5538
5538
|
return e;
|
|
5539
5539
|
}
|
|
5540
|
-
let
|
|
5540
|
+
let De = null;
|
|
5541
5541
|
function mr(n, t, e, i) {
|
|
5542
|
-
|
|
5543
|
-
let s = Rs(t), r =
|
|
5542
|
+
De = t;
|
|
5543
|
+
let s = Rs(t), r = As(s, 0), o = Ds(r) == s.length && s != " ", l = "", h = !1, f = !1, a = !1;
|
|
5544
5544
|
Z && Z.view == e && Z.scope == i && (l = Z.prefix + " ", cs.indexOf(t.keyCode) < 0 && (f = !0, Z = null));
|
|
5545
5545
|
let c = /* @__PURE__ */ new Set(), d = (b) => {
|
|
5546
5546
|
if (b) {
|
|
@@ -5551,11 +5551,40 @@ function mr(n, t, e, i) {
|
|
|
5551
5551
|
}
|
|
5552
5552
|
return !1;
|
|
5553
5553
|
}, u = n[i], g, m;
|
|
5554
|
-
return u && (d(u[l +
|
|
5555
|
-
!(y.windows && t.ctrlKey && t.altKey) && (g = Bs[t.keyCode]) && g != s ? (d(u[l +
|
|
5554
|
+
return u && (d(u[l + It(s, t, !o)]) ? h = !0 : o && (t.altKey || t.metaKey || t.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
|
|
5555
|
+
!(y.windows && t.ctrlKey && t.altKey) && (g = Bs[t.keyCode]) && g != s ? (d(u[l + It(g, t, !0)]) || t.shiftKey && (m = Ls[t.keyCode]) != s && m != g && d(u[l + It(m, t, !1)])) && (h = !0) : o && t.shiftKey && d(u[l + It(s, t, !0)]) && (h = !0), !h && d(u._any) && (h = !0)), f && (h = !0), h && a && t.stopPropagation(), De = null, h;
|
|
5556
|
+
}
|
|
5557
|
+
class br extends te {
|
|
5558
|
+
constructor(t) {
|
|
5559
|
+
super(), this.content = t;
|
|
5560
|
+
}
|
|
5561
|
+
toDOM(t) {
|
|
5562
|
+
let e = document.createElement("span");
|
|
5563
|
+
return e.className = "cm-placeholder", e.style.pointerEvents = "none", e.appendChild(typeof this.content == "string" ? document.createTextNode(this.content) : typeof this.content == "function" ? this.content(t) : this.content.cloneNode(!0)), typeof this.content == "string" ? e.setAttribute("aria-label", "placeholder " + this.content) : e.setAttribute("aria-hidden", "true"), e;
|
|
5564
|
+
}
|
|
5565
|
+
coordsAt(t) {
|
|
5566
|
+
let e = t.firstChild ? pt(t.firstChild) : [];
|
|
5567
|
+
if (!e.length)
|
|
5568
|
+
return null;
|
|
5569
|
+
let i = window.getComputedStyle(t.parentNode), s = Et(e[0], i.direction != "rtl"), r = parseInt(i.lineHeight);
|
|
5570
|
+
return s.bottom - s.top > r * 1.5 ? { left: s.left, right: s.right, top: s.top, bottom: s.top + r } : s;
|
|
5571
|
+
}
|
|
5572
|
+
ignoreEvent() {
|
|
5573
|
+
return !1;
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
function Vr(n) {
|
|
5577
|
+
return it.fromClass(class {
|
|
5578
|
+
constructor(t) {
|
|
5579
|
+
this.view = t, this.placeholder = n ? B.set([B.widget({ widget: new br(n), side: 1 }).range(0)]) : B.none;
|
|
5580
|
+
}
|
|
5581
|
+
get decorations() {
|
|
5582
|
+
return this.view.state.doc.length ? B.none : this.placeholder;
|
|
5583
|
+
}
|
|
5584
|
+
}, { decorations: (t) => t.decorations });
|
|
5556
5585
|
}
|
|
5557
|
-
const
|
|
5558
|
-
class
|
|
5586
|
+
const wt = "-10000px";
|
|
5587
|
+
class yr {
|
|
5559
5588
|
constructor(t, e, i, s) {
|
|
5560
5589
|
this.facet = e, this.createTooltipView = i, this.removeTooltipView = s, this.input = t.state.facet(e), this.tooltips = this.input.filter((o) => o);
|
|
5561
5590
|
let r = null;
|
|
@@ -5590,24 +5619,24 @@ class br {
|
|
|
5590
5619
|
return e && (l.forEach((h, f) => e[f] = h), e.length = l.length), this.input = s, this.tooltips = r, this.tooltipViews = o, !0;
|
|
5591
5620
|
}
|
|
5592
5621
|
}
|
|
5593
|
-
function
|
|
5622
|
+
function wr(n) {
|
|
5594
5623
|
let t = n.dom.ownerDocument.documentElement;
|
|
5595
5624
|
return { top: 0, left: 0, bottom: t.clientHeight, right: t.clientWidth };
|
|
5596
5625
|
}
|
|
5597
|
-
const
|
|
5626
|
+
const he = /* @__PURE__ */ v.define({
|
|
5598
5627
|
combine: (n) => {
|
|
5599
5628
|
var t, e, i;
|
|
5600
5629
|
return {
|
|
5601
5630
|
position: y.ios ? "absolute" : ((t = n.find((s) => s.position)) === null || t === void 0 ? void 0 : t.position) || "fixed",
|
|
5602
5631
|
parent: ((e = n.find((s) => s.parent)) === null || e === void 0 ? void 0 : e.parent) || null,
|
|
5603
|
-
tooltipSpace: ((i = n.find((s) => s.tooltipSpace)) === null || i === void 0 ? void 0 : i.tooltipSpace) ||
|
|
5632
|
+
tooltipSpace: ((i = n.find((s) => s.tooltipSpace)) === null || i === void 0 ? void 0 : i.tooltipSpace) || wr
|
|
5604
5633
|
};
|
|
5605
5634
|
}
|
|
5606
|
-
}), wi = /* @__PURE__ */ new WeakMap(), vs = /* @__PURE__ */
|
|
5635
|
+
}), wi = /* @__PURE__ */ new WeakMap(), vs = /* @__PURE__ */ it.fromClass(class {
|
|
5607
5636
|
constructor(n) {
|
|
5608
5637
|
this.view = n, this.above = [], this.inView = !0, this.madeAbsolute = !1, this.lastTransaction = 0, this.measureTimeout = -1;
|
|
5609
|
-
let t = n.state.facet(
|
|
5610
|
-
this.position = t.position, this.parent = t.parent, this.classes = n.themeClasses, this.createContainer(), this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }, this.resizeObserver = typeof ResizeObserver == "function" ? new ResizeObserver(() => this.measureSoon()) : null, this.manager = new
|
|
5638
|
+
let t = n.state.facet(he);
|
|
5639
|
+
this.position = t.position, this.parent = t.parent, this.classes = n.themeClasses, this.createContainer(), this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }, this.resizeObserver = typeof ResizeObserver == "function" ? new ResizeObserver(() => this.measureSoon()) : null, this.manager = new yr(n, vr, (e, i) => this.createTooltip(e, i), (e) => {
|
|
5611
5640
|
this.resizeObserver && this.resizeObserver.unobserve(e.dom), e.dom.remove();
|
|
5612
5641
|
}), this.above = this.manager.tooltips.map((e) => !!e.above), this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver((e) => {
|
|
5613
5642
|
Date.now() > this.lastTransaction - 50 && e.length > 0 && e[e.length - 1].intersectionRatio < 1 && this.measureSoon();
|
|
@@ -5632,7 +5661,7 @@ const le = /* @__PURE__ */ v.define({
|
|
|
5632
5661
|
n.transactions.length && (this.lastTransaction = Date.now());
|
|
5633
5662
|
let t = this.manager.update(n, this.above);
|
|
5634
5663
|
t && this.observeIntersection();
|
|
5635
|
-
let e = t || n.geometryChanged, i = n.state.facet(
|
|
5664
|
+
let e = t || n.geometryChanged, i = n.state.facet(he);
|
|
5636
5665
|
if (i.position != this.position && !this.madeAbsolute) {
|
|
5637
5666
|
this.position = i.position;
|
|
5638
5667
|
for (let s of this.manager.tooltipViews)
|
|
@@ -5653,7 +5682,7 @@ const le = /* @__PURE__ */ v.define({
|
|
|
5653
5682
|
let s = document.createElement("div");
|
|
5654
5683
|
s.className = "cm-tooltip-arrow", e.dom.appendChild(s);
|
|
5655
5684
|
}
|
|
5656
|
-
return e.dom.style.position = this.position, e.dom.style.top =
|
|
5685
|
+
return e.dom.style.position = this.position, e.dom.style.top = wt, e.dom.style.left = "0px", this.container.insertBefore(e.dom, i), e.mount && e.mount(this.view), this.resizeObserver && this.resizeObserver.observe(e.dom), e;
|
|
5657
5686
|
}
|
|
5658
5687
|
destroy() {
|
|
5659
5688
|
var n, t, e;
|
|
@@ -5668,7 +5697,7 @@ const le = /* @__PURE__ */ v.define({
|
|
|
5668
5697
|
let { dom: r } = this.manager.tooltipViews[0];
|
|
5669
5698
|
if (y.gecko)
|
|
5670
5699
|
e = r.offsetParent != this.container.ownerDocument.body;
|
|
5671
|
-
else if (r.style.top ==
|
|
5700
|
+
else if (r.style.top == wt && r.style.left == "0px") {
|
|
5672
5701
|
let o = r.getBoundingClientRect();
|
|
5673
5702
|
e = Math.abs(o.top + 1e4) > 1 || Math.abs(o.left) > 1;
|
|
5674
5703
|
}
|
|
@@ -5693,7 +5722,7 @@ const le = /* @__PURE__ */ v.define({
|
|
|
5693
5722
|
return l.getCoords ? l.getCoords(r.pos) : this.view.coordsAtPos(r.pos);
|
|
5694
5723
|
}),
|
|
5695
5724
|
size: this.manager.tooltipViews.map(({ dom: r }) => r.getBoundingClientRect()),
|
|
5696
|
-
space: this.view.state.facet(
|
|
5725
|
+
space: this.view.state.facet(he).tooltipSpace(this.view),
|
|
5697
5726
|
scaleX: n,
|
|
5698
5727
|
scaleY: t,
|
|
5699
5728
|
makeAbsolute: e
|
|
@@ -5710,34 +5739,34 @@ const le = /* @__PURE__ */ v.define({
|
|
|
5710
5739
|
for (let l = 0; l < this.manager.tooltips.length; l++) {
|
|
5711
5740
|
let h = this.manager.tooltips[l], f = this.manager.tooltipViews[l], { dom: a } = f, c = n.pos[l], d = n.size[l];
|
|
5712
5741
|
if (!c || h.clip !== !1 && (c.bottom <= Math.max(e.top, i.top) || c.top >= Math.min(e.bottom, i.bottom) || c.right < Math.max(e.left, i.left) - 0.1 || c.left > Math.min(e.right, i.right) + 0.1)) {
|
|
5713
|
-
a.style.top =
|
|
5742
|
+
a.style.top = wt;
|
|
5714
5743
|
continue;
|
|
5715
5744
|
}
|
|
5716
|
-
let u = h.arrow ? f.dom.querySelector(".cm-tooltip-arrow") : null, g = u ? 7 : 0, m = d.right - d.left, b = (t = wi.get(f)) !== null && t !== void 0 ? t : d.bottom - d.top, p = f.offset ||
|
|
5745
|
+
let u = h.arrow ? f.dom.querySelector(".cm-tooltip-arrow") : null, g = u ? 7 : 0, m = d.right - d.left, b = (t = wi.get(f)) !== null && t !== void 0 ? t : d.bottom - d.top, p = f.offset || xr, w = this.view.textDirection == L.LTR, x = d.width > i.right - i.left ? w ? i.left : i.right - d.width : w ? Math.max(i.left, Math.min(c.left - (u ? 14 : 0) + p.x, i.right - m)) : Math.min(Math.max(i.left, c.left - m + (u ? 14 : 0) - p.x), i.right - m), S = this.above[l];
|
|
5717
5746
|
!h.strictSide && (S ? c.top - b - g - p.y < i.top : c.bottom + b + g + p.y > i.bottom) && S == i.bottom - c.bottom > c.top - i.top && (S = this.above[l] = !S);
|
|
5718
5747
|
let A = (S ? c.top - i.top : i.bottom - c.bottom) - g;
|
|
5719
5748
|
if (A < b && f.resize !== !1) {
|
|
5720
5749
|
if (A < this.view.defaultLineHeight) {
|
|
5721
|
-
a.style.top =
|
|
5750
|
+
a.style.top = wt;
|
|
5722
5751
|
continue;
|
|
5723
5752
|
}
|
|
5724
5753
|
wi.set(f, b), a.style.height = (b = A) / r + "px";
|
|
5725
5754
|
} else a.style.height && (a.style.height = "");
|
|
5726
|
-
let M = S ? c.top - b - g - p.y : c.bottom + g + p.y,
|
|
5755
|
+
let M = S ? c.top - b - g - p.y : c.bottom + g + p.y, nt = x + m;
|
|
5727
5756
|
if (f.overlap !== !0)
|
|
5728
5757
|
for (let J of o)
|
|
5729
|
-
J.left <
|
|
5758
|
+
J.left < nt && J.right > x && J.top < M + b && J.bottom > M && (M = S ? J.top - b - 2 - g : J.bottom + g + 2);
|
|
5730
5759
|
if (this.position == "absolute" ? (a.style.top = (M - n.parent.top) / r + "px", Si(a, (x - n.parent.left) / s)) : (a.style.top = M / r + "px", Si(a, x / s)), u) {
|
|
5731
5760
|
let J = c.left + (w ? p.x : -p.x) - (x + 14 - 7);
|
|
5732
5761
|
u.style.left = J / s + "px";
|
|
5733
5762
|
}
|
|
5734
|
-
f.overlap !== !0 && o.push({ left: x, top: M, right:
|
|
5763
|
+
f.overlap !== !0 && o.push({ left: x, top: M, right: nt, bottom: M + b }), a.classList.toggle("cm-tooltip-above", S), a.classList.toggle("cm-tooltip-below", !S), f.positioned && f.positioned(n.space);
|
|
5735
5764
|
}
|
|
5736
5765
|
}
|
|
5737
5766
|
maybeMeasure() {
|
|
5738
5767
|
if (this.manager.tooltips.length && (this.view.inView && this.view.requestMeasure(this.measureReq), this.inView != this.view.inView && (this.inView = this.view.inView, !this.inView)))
|
|
5739
5768
|
for (let n of this.manager.tooltipViews)
|
|
5740
|
-
n.dom.style.top =
|
|
5769
|
+
n.dom.style.top = wt;
|
|
5741
5770
|
}
|
|
5742
5771
|
}, {
|
|
5743
5772
|
eventObservers: {
|
|
@@ -5750,7 +5779,7 @@ function Si(n, t) {
|
|
|
5750
5779
|
let e = parseInt(n.style.left, 10);
|
|
5751
5780
|
(isNaN(e) || Math.abs(t - e) > 1) && (n.style.left = t + "px");
|
|
5752
5781
|
}
|
|
5753
|
-
const
|
|
5782
|
+
const Sr = /* @__PURE__ */ k.baseTheme({
|
|
5754
5783
|
".cm-tooltip": {
|
|
5755
5784
|
zIndex: 500,
|
|
5756
5785
|
boxSizing: "border-box"
|
|
@@ -5811,17 +5840,17 @@ const wr = /* @__PURE__ */ k.baseTheme({
|
|
|
5811
5840
|
borderBottomColor: "transparent"
|
|
5812
5841
|
}
|
|
5813
5842
|
}
|
|
5814
|
-
}),
|
|
5815
|
-
enables: [vs,
|
|
5843
|
+
}), xr = { x: 0, y: 0 }, vr = /* @__PURE__ */ v.define({
|
|
5844
|
+
enables: [vs, Sr]
|
|
5816
5845
|
});
|
|
5817
|
-
function
|
|
5846
|
+
function Fr(n, t) {
|
|
5818
5847
|
let e = n.plugin(vs);
|
|
5819
5848
|
if (!e)
|
|
5820
5849
|
return null;
|
|
5821
5850
|
let i = e.manager.tooltips.indexOf(t);
|
|
5822
5851
|
return i < 0 ? null : e.manager.tooltipViews[i];
|
|
5823
5852
|
}
|
|
5824
|
-
class
|
|
5853
|
+
class st extends Di {
|
|
5825
5854
|
/**
|
|
5826
5855
|
@internal
|
|
5827
5856
|
*/
|
|
@@ -5841,22 +5870,22 @@ class it extends Di {
|
|
|
5841
5870
|
destroy(t) {
|
|
5842
5871
|
}
|
|
5843
5872
|
}
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
const
|
|
5873
|
+
st.prototype.elementClass = "";
|
|
5874
|
+
st.prototype.toDOM = void 0;
|
|
5875
|
+
st.prototype.mapMode = kt.TrackBefore;
|
|
5876
|
+
st.prototype.startSide = st.prototype.endSide = -1;
|
|
5877
|
+
st.prototype.point = !0;
|
|
5878
|
+
const Yt = /* @__PURE__ */ v.define(), Cr = /* @__PURE__ */ v.define(), _t = /* @__PURE__ */ v.define(), xi = /* @__PURE__ */ v.define({
|
|
5850
5879
|
combine: (n) => n.some((t) => t)
|
|
5851
5880
|
});
|
|
5852
|
-
function
|
|
5881
|
+
function Mr(n) {
|
|
5853
5882
|
return [
|
|
5854
|
-
|
|
5883
|
+
kr
|
|
5855
5884
|
];
|
|
5856
5885
|
}
|
|
5857
|
-
const
|
|
5886
|
+
const kr = /* @__PURE__ */ it.fromClass(class {
|
|
5858
5887
|
constructor(n) {
|
|
5859
|
-
this.view = n, this.prevViewport = n.viewport, this.dom = document.createElement("div"), this.dom.className = "cm-gutters", this.dom.setAttribute("aria-hidden", "true"), this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px", this.gutters = n.state.facet(
|
|
5888
|
+
this.view = n, this.prevViewport = n.viewport, this.dom = document.createElement("div"), this.dom.className = "cm-gutters", this.dom.setAttribute("aria-hidden", "true"), this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px", this.gutters = n.state.facet(_t).map((t) => new Ci(n, t));
|
|
5860
5889
|
for (let t of this.gutters)
|
|
5861
5890
|
this.dom.appendChild(t.dom);
|
|
5862
5891
|
this.fixed = !n.state.facet(xi), this.fixed && (this.dom.style.position = "sticky"), this.syncGutters(!1), n.scrollDOM.insertBefore(this.dom, n.contentDOM);
|
|
@@ -5871,13 +5900,13 @@ const Mr = /* @__PURE__ */ ht.fromClass(class {
|
|
|
5871
5900
|
syncGutters(n) {
|
|
5872
5901
|
let t = this.dom.nextSibling;
|
|
5873
5902
|
n && this.dom.remove();
|
|
5874
|
-
let e =
|
|
5903
|
+
let e = N.iter(this.view.state.facet(Yt), this.view.viewport.from), i = [], s = this.gutters.map((r) => new Ar(r, this.view.viewport, -this.view.documentPadding.top));
|
|
5875
5904
|
for (let r of this.view.viewportLineBlocks)
|
|
5876
5905
|
if (i.length && (i = []), Array.isArray(r.type)) {
|
|
5877
5906
|
let o = !0;
|
|
5878
5907
|
for (let l of r.type)
|
|
5879
5908
|
if (l.type == z.Text && o) {
|
|
5880
|
-
|
|
5909
|
+
Oe(e, i, l.from);
|
|
5881
5910
|
for (let h of s)
|
|
5882
5911
|
h.line(this.view, l, i);
|
|
5883
5912
|
o = !1;
|
|
@@ -5885,7 +5914,7 @@ const Mr = /* @__PURE__ */ ht.fromClass(class {
|
|
|
5885
5914
|
for (let h of s)
|
|
5886
5915
|
h.widget(this.view, l);
|
|
5887
5916
|
} else if (r.type == z.Text) {
|
|
5888
|
-
|
|
5917
|
+
Oe(e, i, r.from);
|
|
5889
5918
|
for (let o of s)
|
|
5890
5919
|
o.line(this.view, r, i);
|
|
5891
5920
|
} else if (r.widget)
|
|
@@ -5896,7 +5925,7 @@ const Mr = /* @__PURE__ */ ht.fromClass(class {
|
|
|
5896
5925
|
n && this.view.scrollDOM.insertBefore(this.dom, t);
|
|
5897
5926
|
}
|
|
5898
5927
|
updateGutters(n) {
|
|
5899
|
-
let t = n.startState.facet(
|
|
5928
|
+
let t = n.startState.facet(_t), e = n.state.facet(_t), i = n.docChanged || n.heightChanged || n.viewportChanged || !N.eq(n.startState.facet(Yt), n.state.facet(Yt), n.view.viewport.from, n.view.viewport.to);
|
|
5900
5929
|
if (t == e)
|
|
5901
5930
|
for (let s of this.gutters)
|
|
5902
5931
|
s.update(n) && (i = !0);
|
|
@@ -5923,19 +5952,19 @@ const Mr = /* @__PURE__ */ ht.fromClass(class {
|
|
|
5923
5952
|
}, {
|
|
5924
5953
|
provide: (n) => k.scrollMargins.of((t) => {
|
|
5925
5954
|
let e = t.plugin(n);
|
|
5926
|
-
return !e || e.gutters.length == 0 || !e.fixed ? null : t.textDirection ==
|
|
5955
|
+
return !e || e.gutters.length == 0 || !e.fixed ? null : t.textDirection == L.LTR ? { left: e.dom.offsetWidth * t.scaleX } : { right: e.dom.offsetWidth * t.scaleX };
|
|
5927
5956
|
})
|
|
5928
5957
|
});
|
|
5929
5958
|
function vi(n) {
|
|
5930
5959
|
return Array.isArray(n) ? n : [n];
|
|
5931
5960
|
}
|
|
5932
|
-
function
|
|
5961
|
+
function Oe(n, t, e) {
|
|
5933
5962
|
for (; n.value && n.from <= e; )
|
|
5934
5963
|
n.from == e && t.push(n.value), n.next();
|
|
5935
5964
|
}
|
|
5936
|
-
class
|
|
5965
|
+
class Ar {
|
|
5937
5966
|
constructor(t, e, i) {
|
|
5938
|
-
this.gutter = t, this.height = i, this.i = 0, this.cursor =
|
|
5967
|
+
this.gutter = t, this.height = i, this.i = 0, this.cursor = N.iter(t.markers, e.from);
|
|
5939
5968
|
}
|
|
5940
5969
|
addElement(t, e, i) {
|
|
5941
5970
|
let { gutter: s } = this, r = (e.top - this.height) / t.scaleY, o = e.height / t.scaleY;
|
|
@@ -5948,7 +5977,7 @@ class kr {
|
|
|
5948
5977
|
}
|
|
5949
5978
|
line(t, e, i) {
|
|
5950
5979
|
let s = [];
|
|
5951
|
-
|
|
5980
|
+
Oe(this.cursor, s, e.from), i.length && (s = s.concat(i));
|
|
5952
5981
|
let r = this.gutter.config.lineMarker(t, e, s);
|
|
5953
5982
|
r && s.unshift(r);
|
|
5954
5983
|
let o = this.gutter;
|
|
@@ -5956,7 +5985,7 @@ class kr {
|
|
|
5956
5985
|
}
|
|
5957
5986
|
widget(t, e) {
|
|
5958
5987
|
let i = this.gutter.config.widgetMarker(t, e.widget, e), s = i ? [i] : null;
|
|
5959
|
-
for (let r of t.state.facet(
|
|
5988
|
+
for (let r of t.state.facet(Cr)) {
|
|
5960
5989
|
let o = r(t, e.widget, e);
|
|
5961
5990
|
o && (s || (s = [])).push(o);
|
|
5962
5991
|
}
|
|
@@ -5995,7 +6024,7 @@ class Ci {
|
|
|
5995
6024
|
s != this.spacer.markers[0] && this.spacer.update(t.view, 0, 0, [s]);
|
|
5996
6025
|
}
|
|
5997
6026
|
let i = t.view.viewport;
|
|
5998
|
-
return !
|
|
6027
|
+
return !N.eq(this.markers, e, i.from, i.to) || (this.config.lineMarkerChange ? this.config.lineMarkerChange(t) : !1);
|
|
5999
6028
|
}
|
|
6000
6029
|
destroy() {
|
|
6001
6030
|
for (let t of this.elements)
|
|
@@ -6007,7 +6036,7 @@ class Cs {
|
|
|
6007
6036
|
this.height = -1, this.above = 0, this.markers = [], this.dom = document.createElement("div"), this.dom.className = "cm-gutterElement", this.update(t, e, i, s);
|
|
6008
6037
|
}
|
|
6009
6038
|
update(t, e, i, s) {
|
|
6010
|
-
this.height != e && (this.height = e, this.dom.style.height = e + "px"), this.above != i && (this.dom.style.marginTop = (this.above = i) ? i + "px" : ""),
|
|
6039
|
+
this.height != e && (this.height = e, this.dom.style.height = e + "px"), this.above != i && (this.dom.style.marginTop = (this.above = i) ? i + "px" : ""), Dr(this.markers, s) || this.setMarkers(t, s);
|
|
6011
6040
|
}
|
|
6012
6041
|
setMarkers(t, e) {
|
|
6013
6042
|
let i = "cm-gutterElement", s = this.dom.firstChild;
|
|
@@ -6041,7 +6070,7 @@ class Cs {
|
|
|
6041
6070
|
this.setMarkers(null, []);
|
|
6042
6071
|
}
|
|
6043
6072
|
}
|
|
6044
|
-
function
|
|
6073
|
+
function Dr(n, t) {
|
|
6045
6074
|
if (n.length != t.length)
|
|
6046
6075
|
return !1;
|
|
6047
6076
|
for (let e = 0; e < n.length; e++)
|
|
@@ -6049,9 +6078,9 @@ function Ar(n, t) {
|
|
|
6049
6078
|
return !1;
|
|
6050
6079
|
return !0;
|
|
6051
6080
|
}
|
|
6052
|
-
const
|
|
6081
|
+
const Or = /* @__PURE__ */ v.define(), Tr = /* @__PURE__ */ v.define(), ct = /* @__PURE__ */ v.define({
|
|
6053
6082
|
combine(n) {
|
|
6054
|
-
return
|
|
6083
|
+
return Os(n, { formatNumber: String, domEventHandlers: {} }, {
|
|
6055
6084
|
domEventHandlers(t, e) {
|
|
6056
6085
|
let i = Object.assign({}, t);
|
|
6057
6086
|
for (let s in e) {
|
|
@@ -6063,7 +6092,7 @@ const Dr = /* @__PURE__ */ v.define(), Or = /* @__PURE__ */ v.define(), ct = /*
|
|
|
6063
6092
|
});
|
|
6064
6093
|
}
|
|
6065
6094
|
});
|
|
6066
|
-
class
|
|
6095
|
+
class ae extends st {
|
|
6067
6096
|
constructor(t) {
|
|
6068
6097
|
super(), this.number = t;
|
|
6069
6098
|
}
|
|
@@ -6074,20 +6103,20 @@ class he extends it {
|
|
|
6074
6103
|
return document.createTextNode(this.number);
|
|
6075
6104
|
}
|
|
6076
6105
|
}
|
|
6077
|
-
function
|
|
6106
|
+
function fe(n, t) {
|
|
6078
6107
|
return n.state.facet(ct).formatNumber(t, n.state);
|
|
6079
6108
|
}
|
|
6080
|
-
const
|
|
6109
|
+
const Er = /* @__PURE__ */ _t.compute([ct], (n) => ({
|
|
6081
6110
|
class: "cm-lineNumbers",
|
|
6082
6111
|
renderEmptyElements: !1,
|
|
6083
6112
|
markers(t) {
|
|
6084
|
-
return t.state.facet(
|
|
6113
|
+
return t.state.facet(Or);
|
|
6085
6114
|
},
|
|
6086
6115
|
lineMarker(t, e, i) {
|
|
6087
|
-
return i.some((s) => s.toDOM) ? null : new
|
|
6116
|
+
return i.some((s) => s.toDOM) ? null : new ae(fe(t, t.state.doc.lineAt(e.from).number));
|
|
6088
6117
|
},
|
|
6089
6118
|
widgetMarker: (t, e, i) => {
|
|
6090
|
-
for (let s of t.state.facet(
|
|
6119
|
+
for (let s of t.state.facet(Tr)) {
|
|
6091
6120
|
let r = s(t, e, i);
|
|
6092
6121
|
if (r)
|
|
6093
6122
|
return r;
|
|
@@ -6096,19 +6125,19 @@ const Tr = /* @__PURE__ */ Yt.compute([ct], (n) => ({
|
|
|
6096
6125
|
},
|
|
6097
6126
|
lineMarkerChange: (t) => t.startState.facet(ct) != t.state.facet(ct),
|
|
6098
6127
|
initialSpacer(t) {
|
|
6099
|
-
return new
|
|
6128
|
+
return new ae(fe(t, Mi(t.state.doc.lines)));
|
|
6100
6129
|
},
|
|
6101
6130
|
updateSpacer(t, e) {
|
|
6102
|
-
let i =
|
|
6103
|
-
return i == t.number ? t : new
|
|
6131
|
+
let i = fe(e.view, Mi(e.view.state.doc.lines));
|
|
6132
|
+
return i == t.number ? t : new ae(i);
|
|
6104
6133
|
},
|
|
6105
6134
|
domEventHandlers: n.facet(ct).domEventHandlers
|
|
6106
6135
|
}));
|
|
6107
|
-
function
|
|
6136
|
+
function Wr(n = {}) {
|
|
6108
6137
|
return [
|
|
6109
6138
|
ct.of(n),
|
|
6110
|
-
|
|
6111
|
-
|
|
6139
|
+
Mr(),
|
|
6140
|
+
Er
|
|
6112
6141
|
];
|
|
6113
6142
|
}
|
|
6114
6143
|
function Mi(n) {
|
|
@@ -6117,41 +6146,42 @@ function Mi(n) {
|
|
|
6117
6146
|
t = t * 10 + 9;
|
|
6118
6147
|
return t;
|
|
6119
6148
|
}
|
|
6120
|
-
const
|
|
6149
|
+
const Rr = /* @__PURE__ */ new class extends st {
|
|
6121
6150
|
constructor() {
|
|
6122
6151
|
super(...arguments), this.elementClass = "cm-activeLineGutter";
|
|
6123
6152
|
}
|
|
6124
|
-
}(),
|
|
6153
|
+
}(), Br = /* @__PURE__ */ Yt.compute(["selection"], (n) => {
|
|
6125
6154
|
let t = [], e = -1;
|
|
6126
6155
|
for (let i of n.selection.ranges) {
|
|
6127
6156
|
let s = n.doc.lineAt(i.head).from;
|
|
6128
|
-
s > e && (e = s, t.push(
|
|
6157
|
+
s > e && (e = s, t.push(Rr.range(s)));
|
|
6129
6158
|
}
|
|
6130
|
-
return
|
|
6159
|
+
return N.of(t);
|
|
6131
6160
|
});
|
|
6132
|
-
function
|
|
6133
|
-
return
|
|
6161
|
+
function zr() {
|
|
6162
|
+
return Br;
|
|
6134
6163
|
}
|
|
6135
6164
|
export {
|
|
6136
6165
|
tt as BidiSpan,
|
|
6137
6166
|
Y as BlockInfo,
|
|
6138
6167
|
z as BlockType,
|
|
6139
|
-
|
|
6140
|
-
|
|
6168
|
+
B as Decoration,
|
|
6169
|
+
L as Direction,
|
|
6141
6170
|
k as EditorView,
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6171
|
+
st as GutterMarker,
|
|
6172
|
+
it as ViewPlugin,
|
|
6173
|
+
Ut as ViewUpdate,
|
|
6174
|
+
te as WidgetType,
|
|
6175
|
+
Fr as getTooltip,
|
|
6176
|
+
Yt as gutterLineClass,
|
|
6177
|
+
Cr as gutterWidgetClass,
|
|
6178
|
+
Mr as gutters,
|
|
6179
|
+
zr as highlightActiveLineGutter,
|
|
6151
6180
|
dr as keymap,
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6181
|
+
Or as lineNumberMarkers,
|
|
6182
|
+
Tr as lineNumberWidgetMarker,
|
|
6183
|
+
Wr as lineNumbers,
|
|
6155
6184
|
X as logException,
|
|
6156
|
-
|
|
6185
|
+
Vr as placeholder,
|
|
6186
|
+
vr as showTooltip
|
|
6157
6187
|
};
|