@electric-sql/pglite-repl 0.2.0 → 0.2.2
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/Repl.d.ts +3 -3
- package/dist/Repl.js +8 -3
- package/dist/Repl.js.map +1 -1
- package/dist/Repl.umd.cjs +9 -5
- package/dist/Repl.umd.cjs.map +1 -1
- package/dist-webcomponent/Repl.js +1070 -954
- package/dist-webcomponent/Repl.js.map +1 -1
- package/dist-webcomponent/src/Repl.d.ts +3 -3
- package/package.json +5 -4
|
@@ -23,7 +23,7 @@ var hasRequiredReact_production_min;
|
|
|
23
23
|
function requireReact_production_min() {
|
|
24
24
|
if (hasRequiredReact_production_min) return react_production_min;
|
|
25
25
|
hasRequiredReact_production_min = 1;
|
|
26
|
-
var l2 = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t2 = Symbol.for("react.provider"), u = Symbol.for("react.context"),
|
|
26
|
+
var l2 = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t2 = Symbol.for("react.provider"), u = Symbol.for("react.context"), v2 = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator;
|
|
27
27
|
function A2(a) {
|
|
28
28
|
if (null === a || "object" !== typeof a) return null;
|
|
29
29
|
a = z && a[z] || a["@@iterator"];
|
|
@@ -91,7 +91,7 @@ function requireReact_production_min() {
|
|
|
91
91
|
function Q2(a, b) {
|
|
92
92
|
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function R2(a, b, e2, d, c2) {
|
|
95
95
|
var k = typeof a;
|
|
96
96
|
if ("undefined" === k || "boolean" === k) a = null;
|
|
97
97
|
var h = false;
|
|
@@ -108,7 +108,7 @@ function requireReact_production_min() {
|
|
|
108
108
|
h = true;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
if (h) return h = a, c2 = c2(h), a = "" === d ? "." + Q2(h, 0) : d, I(c2) ? (e2 = "", null != a && (e2 = a.replace(P, "$&/") + "/"),
|
|
111
|
+
if (h) return h = a, c2 = c2(h), a = "" === d ? "." + Q2(h, 0) : d, I(c2) ? (e2 = "", null != a && (e2 = a.replace(P, "$&/") + "/"), R2(c2, b, e2, "", function(a2) {
|
|
112
112
|
return a2;
|
|
113
113
|
})) : null != c2 && (O(c2) && (c2 = N(c2, e2 + (!c2.key || h && h.key === c2.key ? "" : ("" + c2.key).replace(P, "$&/") + "/") + a)), b.push(c2)), 1;
|
|
114
114
|
h = 0;
|
|
@@ -116,16 +116,16 @@ function requireReact_production_min() {
|
|
|
116
116
|
if (I(a)) for (var g = 0; g < a.length; g++) {
|
|
117
117
|
k = a[g];
|
|
118
118
|
var f = d + Q2(k, g);
|
|
119
|
-
h +=
|
|
119
|
+
h += R2(k, b, e2, f, c2);
|
|
120
120
|
}
|
|
121
|
-
else if (f = A2(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, f = d + Q2(k, g++), h +=
|
|
121
|
+
else if (f = A2(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, f = d + Q2(k, g++), h += R2(k, b, e2, f, c2);
|
|
122
122
|
else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
|
|
123
123
|
return h;
|
|
124
124
|
}
|
|
125
125
|
function S(a, b, e2) {
|
|
126
126
|
if (null == a) return a;
|
|
127
127
|
var d = [], c2 = 0;
|
|
128
|
-
|
|
128
|
+
R2(a, d, "", "", function(a2) {
|
|
129
129
|
return b.call(e2, a2, c2++);
|
|
130
130
|
});
|
|
131
131
|
return d;
|
|
@@ -207,7 +207,7 @@ function requireReact_production_min() {
|
|
|
207
207
|
return { current: null };
|
|
208
208
|
};
|
|
209
209
|
react_production_min.forwardRef = function(a) {
|
|
210
|
-
return { $$typeof:
|
|
210
|
+
return { $$typeof: v2, render: a };
|
|
211
211
|
};
|
|
212
212
|
react_production_min.isValidElement = O;
|
|
213
213
|
react_production_min.lazy = function(a) {
|
|
@@ -3162,7 +3162,7 @@ function requireScheduler_production_min() {
|
|
|
3162
3162
|
return p.now() - q;
|
|
3163
3163
|
};
|
|
3164
3164
|
}
|
|
3165
|
-
var r = [], t2 = [], u = 1,
|
|
3165
|
+
var r = [], t2 = [], u = 1, v2 = null, y = 3, z = false, A2 = false, B = false, D2 = "function" === typeof setTimeout ? setTimeout : null, E = "function" === typeof clearTimeout ? clearTimeout : null, F2 = "undefined" !== typeof setImmediate ? setImmediate : null;
|
|
3166
3166
|
"undefined" !== typeof navigator && void 0 !== navigator.scheduling && void 0 !== navigator.scheduling.isInputPending && navigator.scheduling.isInputPending.bind(navigator.scheduling);
|
|
3167
3167
|
function G(a) {
|
|
3168
3168
|
for (var b = h(t2); null !== b; ) {
|
|
@@ -3188,19 +3188,19 @@ function requireScheduler_production_min() {
|
|
|
3188
3188
|
var c2 = y;
|
|
3189
3189
|
try {
|
|
3190
3190
|
G(b);
|
|
3191
|
-
for (
|
|
3192
|
-
var d =
|
|
3191
|
+
for (v2 = h(r); null !== v2 && (!(v2.expirationTime > b) || a && !M()); ) {
|
|
3192
|
+
var d = v2.callback;
|
|
3193
3193
|
if ("function" === typeof d) {
|
|
3194
|
-
|
|
3195
|
-
y =
|
|
3196
|
-
var e2 = d(
|
|
3194
|
+
v2.callback = null;
|
|
3195
|
+
y = v2.priorityLevel;
|
|
3196
|
+
var e2 = d(v2.expirationTime <= b);
|
|
3197
3197
|
b = exports.unstable_now();
|
|
3198
|
-
"function" === typeof e2 ?
|
|
3198
|
+
"function" === typeof e2 ? v2.callback = e2 : v2 === h(r) && k(r);
|
|
3199
3199
|
G(b);
|
|
3200
3200
|
} else k(r);
|
|
3201
|
-
|
|
3201
|
+
v2 = h(r);
|
|
3202
3202
|
}
|
|
3203
|
-
if (null !==
|
|
3203
|
+
if (null !== v2) var w = true;
|
|
3204
3204
|
else {
|
|
3205
3205
|
var m2 = h(t2);
|
|
3206
3206
|
null !== m2 && K2(H, m2.startTime - b);
|
|
@@ -3208,14 +3208,14 @@ function requireScheduler_production_min() {
|
|
|
3208
3208
|
}
|
|
3209
3209
|
return w;
|
|
3210
3210
|
} finally {
|
|
3211
|
-
|
|
3211
|
+
v2 = null, y = c2, z = false;
|
|
3212
3212
|
}
|
|
3213
3213
|
}
|
|
3214
3214
|
var N = false, O = null, L2 = -1, P = 5, Q2 = -1;
|
|
3215
3215
|
function M() {
|
|
3216
3216
|
return exports.unstable_now() - Q2 < P ? false : true;
|
|
3217
3217
|
}
|
|
3218
|
-
function
|
|
3218
|
+
function R2() {
|
|
3219
3219
|
if (null !== O) {
|
|
3220
3220
|
var a = exports.unstable_now();
|
|
3221
3221
|
Q2 = a;
|
|
@@ -3229,16 +3229,16 @@ function requireScheduler_production_min() {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
var S;
|
|
3231
3231
|
if ("function" === typeof F2) S = function() {
|
|
3232
|
-
F2(
|
|
3232
|
+
F2(R2);
|
|
3233
3233
|
};
|
|
3234
3234
|
else if ("undefined" !== typeof MessageChannel) {
|
|
3235
3235
|
var T = new MessageChannel(), U = T.port2;
|
|
3236
|
-
T.port1.onmessage =
|
|
3236
|
+
T.port1.onmessage = R2;
|
|
3237
3237
|
S = function() {
|
|
3238
3238
|
U.postMessage(null);
|
|
3239
3239
|
};
|
|
3240
3240
|
} else S = function() {
|
|
3241
|
-
D2(
|
|
3241
|
+
D2(R2, 0);
|
|
3242
3242
|
};
|
|
3243
3243
|
function I(a) {
|
|
3244
3244
|
O = a;
|
|
@@ -3880,7 +3880,7 @@ function requireReactDom_production_min() {
|
|
|
3880
3880
|
}
|
|
3881
3881
|
return false;
|
|
3882
3882
|
}
|
|
3883
|
-
function
|
|
3883
|
+
function v2(a, b, c2, d, e2, f, g) {
|
|
3884
3884
|
this.acceptsBooleans = 2 === b || 3 === b || 4 === b;
|
|
3885
3885
|
this.attributeName = d;
|
|
3886
3886
|
this.attributeNamespace = e2;
|
|
@@ -3892,32 +3892,32 @@ function requireReactDom_production_min() {
|
|
|
3892
3892
|
}
|
|
3893
3893
|
var z = {};
|
|
3894
3894
|
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a) {
|
|
3895
|
-
z[a] = new
|
|
3895
|
+
z[a] = new v2(a, 0, false, a, null, false, false);
|
|
3896
3896
|
});
|
|
3897
3897
|
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a) {
|
|
3898
3898
|
var b = a[0];
|
|
3899
|
-
z[b] = new
|
|
3899
|
+
z[b] = new v2(b, 1, false, a[1], null, false, false);
|
|
3900
3900
|
});
|
|
3901
3901
|
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a) {
|
|
3902
|
-
z[a] = new
|
|
3902
|
+
z[a] = new v2(a, 2, false, a.toLowerCase(), null, false, false);
|
|
3903
3903
|
});
|
|
3904
3904
|
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a) {
|
|
3905
|
-
z[a] = new
|
|
3905
|
+
z[a] = new v2(a, 2, false, a, null, false, false);
|
|
3906
3906
|
});
|
|
3907
3907
|
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a) {
|
|
3908
|
-
z[a] = new
|
|
3908
|
+
z[a] = new v2(a, 3, false, a.toLowerCase(), null, false, false);
|
|
3909
3909
|
});
|
|
3910
3910
|
["checked", "multiple", "muted", "selected"].forEach(function(a) {
|
|
3911
|
-
z[a] = new
|
|
3911
|
+
z[a] = new v2(a, 3, true, a, null, false, false);
|
|
3912
3912
|
});
|
|
3913
3913
|
["capture", "download"].forEach(function(a) {
|
|
3914
|
-
z[a] = new
|
|
3914
|
+
z[a] = new v2(a, 4, false, a, null, false, false);
|
|
3915
3915
|
});
|
|
3916
3916
|
["cols", "rows", "size", "span"].forEach(function(a) {
|
|
3917
|
-
z[a] = new
|
|
3917
|
+
z[a] = new v2(a, 6, false, a, null, false, false);
|
|
3918
3918
|
});
|
|
3919
3919
|
["rowSpan", "start"].forEach(function(a) {
|
|
3920
|
-
z[a] = new
|
|
3920
|
+
z[a] = new v2(a, 5, false, a.toLowerCase(), null, false, false);
|
|
3921
3921
|
});
|
|
3922
3922
|
var ra = /[\-:]([a-z])/g;
|
|
3923
3923
|
function sa(a) {
|
|
@@ -3928,22 +3928,22 @@ function requireReactDom_production_min() {
|
|
|
3928
3928
|
ra,
|
|
3929
3929
|
sa
|
|
3930
3930
|
);
|
|
3931
|
-
z[b] = new
|
|
3931
|
+
z[b] = new v2(b, 1, false, a, null, false, false);
|
|
3932
3932
|
});
|
|
3933
3933
|
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a) {
|
|
3934
3934
|
var b = a.replace(ra, sa);
|
|
3935
|
-
z[b] = new
|
|
3935
|
+
z[b] = new v2(b, 1, false, a, "http://www.w3.org/1999/xlink", false, false);
|
|
3936
3936
|
});
|
|
3937
3937
|
["xml:base", "xml:lang", "xml:space"].forEach(function(a) {
|
|
3938
3938
|
var b = a.replace(ra, sa);
|
|
3939
|
-
z[b] = new
|
|
3939
|
+
z[b] = new v2(b, 1, false, a, "http://www.w3.org/XML/1998/namespace", false, false);
|
|
3940
3940
|
});
|
|
3941
3941
|
["tabIndex", "crossOrigin"].forEach(function(a) {
|
|
3942
|
-
z[a] = new
|
|
3942
|
+
z[a] = new v2(a, 1, false, a.toLowerCase(), null, false, false);
|
|
3943
3943
|
});
|
|
3944
|
-
z.xlinkHref = new
|
|
3944
|
+
z.xlinkHref = new v2("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
|
|
3945
3945
|
["src", "href", "action", "formAction"].forEach(function(a) {
|
|
3946
|
-
z[a] = new
|
|
3946
|
+
z[a] = new v2(a, 1, false, a.toLowerCase(), null, true, true);
|
|
3947
3947
|
});
|
|
3948
3948
|
function ta(a, b, c2, d) {
|
|
3949
3949
|
var e2 = z.hasOwnProperty(b) ? z[b] : null;
|
|
@@ -6903,7 +6903,7 @@ function requireReactDom_production_min() {
|
|
|
6903
6903
|
c2 = { lane: d, action: c2, hasEagerState: false, eagerState: null, next: null };
|
|
6904
6904
|
if (zi2(a)) Ai2(b, c2);
|
|
6905
6905
|
else if (c2 = hh(a, b, c2, d), null !== c2) {
|
|
6906
|
-
var e2 =
|
|
6906
|
+
var e2 = R2();
|
|
6907
6907
|
gi2(c2, a, d, e2);
|
|
6908
6908
|
Bi2(c2, b, d);
|
|
6909
6909
|
}
|
|
@@ -6927,7 +6927,7 @@ function requireReactDom_production_min() {
|
|
|
6927
6927
|
} finally {
|
|
6928
6928
|
}
|
|
6929
6929
|
c2 = hh(a, b, e2, d);
|
|
6930
|
-
null !== c2 && (e2 =
|
|
6930
|
+
null !== c2 && (e2 = R2(), gi2(c2, a, d, e2), Bi2(c2, b, d));
|
|
6931
6931
|
}
|
|
6932
6932
|
}
|
|
6933
6933
|
function zi2(a) {
|
|
@@ -7080,14 +7080,14 @@ function requireReactDom_production_min() {
|
|
|
7080
7080
|
return (a = a._reactInternals) ? Vb(a) === a : false;
|
|
7081
7081
|
}, enqueueSetState: function(a, b, c2) {
|
|
7082
7082
|
a = a._reactInternals;
|
|
7083
|
-
var d =
|
|
7083
|
+
var d = R2(), e2 = yi2(a), f = mh(d, e2);
|
|
7084
7084
|
f.payload = b;
|
|
7085
7085
|
void 0 !== c2 && null !== c2 && (f.callback = c2);
|
|
7086
7086
|
b = nh(a, f, e2);
|
|
7087
7087
|
null !== b && (gi2(b, a, e2, d), oh(b, a, e2));
|
|
7088
7088
|
}, enqueueReplaceState: function(a, b, c2) {
|
|
7089
7089
|
a = a._reactInternals;
|
|
7090
|
-
var d =
|
|
7090
|
+
var d = R2(), e2 = yi2(a), f = mh(d, e2);
|
|
7091
7091
|
f.tag = 1;
|
|
7092
7092
|
f.payload = b;
|
|
7093
7093
|
void 0 !== c2 && null !== c2 && (f.callback = c2);
|
|
@@ -7095,7 +7095,7 @@ function requireReactDom_production_min() {
|
|
|
7095
7095
|
null !== b && (gi2(b, a, e2, d), oh(b, a, e2));
|
|
7096
7096
|
}, enqueueForceUpdate: function(a, b) {
|
|
7097
7097
|
a = a._reactInternals;
|
|
7098
|
-
var c2 =
|
|
7098
|
+
var c2 = R2(), d = yi2(a), e2 = mh(c2, d);
|
|
7099
7099
|
e2.tag = 2;
|
|
7100
7100
|
void 0 !== b && null !== b && (e2.callback = b);
|
|
7101
7101
|
b = nh(a, e2, d);
|
|
@@ -8836,7 +8836,7 @@ function requireReactDom_production_min() {
|
|
|
8836
8836
|
}
|
|
8837
8837
|
}
|
|
8838
8838
|
var lk = Math.ceil, mk = ua.ReactCurrentDispatcher, nk = ua.ReactCurrentOwner, ok = ua.ReactCurrentBatchConfig, K2 = 0, Q2 = null, Y = null, Z = 0, fj = 0, ej = Uf(0), T = 0, pk = null, rh = 0, qk = 0, rk = 0, sk = null, tk = null, fk = 0, Gj = Infinity, uk = null, Oi2 = false, Pi2 = null, Ri2 = null, vk = false, wk = null, xk = 0, yk = 0, zk = null, Ak = -1, Bk = 0;
|
|
8839
|
-
function
|
|
8839
|
+
function R2() {
|
|
8840
8840
|
return 0 !== (K2 & 6) ? B() : -1 !== Ak ? Ak : Ak = B();
|
|
8841
8841
|
}
|
|
8842
8842
|
function yi2(a) {
|
|
@@ -8937,7 +8937,7 @@ function requireReactDom_production_min() {
|
|
|
8937
8937
|
if (0 !== uc(a, 0)) break;
|
|
8938
8938
|
e2 = a.suspendedLanes;
|
|
8939
8939
|
if ((e2 & d) !== d) {
|
|
8940
|
-
|
|
8940
|
+
R2();
|
|
8941
8941
|
a.pingedLanes |= a.suspendedLanes & e2;
|
|
8942
8942
|
break;
|
|
8943
8943
|
}
|
|
@@ -9501,7 +9501,7 @@ function requireReactDom_production_min() {
|
|
|
9501
9501
|
b = Ji2(c2, b);
|
|
9502
9502
|
b = Ni2(a, b, 1);
|
|
9503
9503
|
a = nh(a, b, 1);
|
|
9504
|
-
b =
|
|
9504
|
+
b = R2();
|
|
9505
9505
|
null !== a && (Ac(a, 1, b), Dk(a, b));
|
|
9506
9506
|
}
|
|
9507
9507
|
function W2(a, b, c2) {
|
|
@@ -9516,7 +9516,7 @@ function requireReactDom_production_min() {
|
|
|
9516
9516
|
a = Ji2(c2, a);
|
|
9517
9517
|
a = Qi2(b, a, 1);
|
|
9518
9518
|
b = nh(b, a, 1);
|
|
9519
|
-
a =
|
|
9519
|
+
a = R2();
|
|
9520
9520
|
null !== b && (Ac(b, 1, a), Dk(b, a));
|
|
9521
9521
|
break;
|
|
9522
9522
|
}
|
|
@@ -9527,14 +9527,14 @@ function requireReactDom_production_min() {
|
|
|
9527
9527
|
function Ti2(a, b, c2) {
|
|
9528
9528
|
var d = a.pingCache;
|
|
9529
9529
|
null !== d && d.delete(b);
|
|
9530
|
-
b =
|
|
9530
|
+
b = R2();
|
|
9531
9531
|
a.pingedLanes |= a.suspendedLanes & c2;
|
|
9532
9532
|
Q2 === a && (Z & c2) === c2 && (4 === T || 3 === T && (Z & 130023424) === Z && 500 > B() - fk ? Kk(a, 0) : rk |= c2);
|
|
9533
9533
|
Dk(a, b);
|
|
9534
9534
|
}
|
|
9535
9535
|
function Yk(a, b) {
|
|
9536
9536
|
0 === b && (0 === (a.mode & 1) ? b = 1 : (b = sc, sc <<= 1, 0 === (sc & 130023424) && (sc = 4194304)));
|
|
9537
|
-
var c2 =
|
|
9537
|
+
var c2 = R2();
|
|
9538
9538
|
a = ih(a, b);
|
|
9539
9539
|
null !== a && (Ac(a, b, c2), Dk(a, c2));
|
|
9540
9540
|
}
|
|
@@ -9931,7 +9931,7 @@ function requireReactDom_production_min() {
|
|
|
9931
9931
|
a = bl(c2, d, true, a, e2, f, g, h, k);
|
|
9932
9932
|
a.context = dl(null);
|
|
9933
9933
|
c2 = a.current;
|
|
9934
|
-
d =
|
|
9934
|
+
d = R2();
|
|
9935
9935
|
e2 = yi2(c2);
|
|
9936
9936
|
f = mh(d, e2);
|
|
9937
9937
|
f.callback = void 0 !== b && null !== b ? b : null;
|
|
@@ -9942,7 +9942,7 @@ function requireReactDom_production_min() {
|
|
|
9942
9942
|
return a;
|
|
9943
9943
|
}
|
|
9944
9944
|
function fl(a, b, c2, d) {
|
|
9945
|
-
var e2 = b.current, f =
|
|
9945
|
+
var e2 = b.current, f = R2(), g = yi2(e2);
|
|
9946
9946
|
c2 = dl(c2);
|
|
9947
9947
|
null === b.context ? b.context = c2 : b.pendingContext = c2;
|
|
9948
9948
|
b = mh(f, g);
|
|
@@ -10080,7 +10080,7 @@ function requireReactDom_production_min() {
|
|
|
10080
10080
|
Rk(function() {
|
|
10081
10081
|
var b2 = ih(a, 1);
|
|
10082
10082
|
if (null !== b2) {
|
|
10083
|
-
var c3 =
|
|
10083
|
+
var c3 = R2();
|
|
10084
10084
|
gi2(b2, a, 1, c3);
|
|
10085
10085
|
}
|
|
10086
10086
|
}), il(a, 1);
|
|
@@ -10090,7 +10090,7 @@ function requireReactDom_production_min() {
|
|
|
10090
10090
|
if (13 === a.tag) {
|
|
10091
10091
|
var b = ih(a, 134217728);
|
|
10092
10092
|
if (null !== b) {
|
|
10093
|
-
var c2 =
|
|
10093
|
+
var c2 = R2();
|
|
10094
10094
|
gi2(b, a, 134217728, c2);
|
|
10095
10095
|
}
|
|
10096
10096
|
il(a, 134217728);
|
|
@@ -10100,7 +10100,7 @@ function requireReactDom_production_min() {
|
|
|
10100
10100
|
if (13 === a.tag) {
|
|
10101
10101
|
var b = yi2(a), c2 = ih(a, b);
|
|
10102
10102
|
if (null !== c2) {
|
|
10103
|
-
var d =
|
|
10103
|
+
var d = R2();
|
|
10104
10104
|
gi2(c2, a, b, d);
|
|
10105
10105
|
}
|
|
10106
10106
|
il(a, b);
|
|
@@ -31380,30 +31380,22 @@ if (define_process_env_default$1.NODE_ENV === "production") {
|
|
|
31380
31380
|
}
|
|
31381
31381
|
var reactExports = requireReact();
|
|
31382
31382
|
function _extends() {
|
|
31383
|
-
_extends = Object.assign ? Object.assign.bind() : function(
|
|
31384
|
-
for (var
|
|
31385
|
-
var
|
|
31386
|
-
for (var
|
|
31387
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
31388
|
-
target[key] = source[key];
|
|
31389
|
-
}
|
|
31390
|
-
}
|
|
31383
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
31384
|
+
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
31385
|
+
var t2 = arguments[e2];
|
|
31386
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
|
|
31391
31387
|
}
|
|
31392
|
-
return
|
|
31393
|
-
};
|
|
31394
|
-
|
|
31395
|
-
|
|
31396
|
-
|
|
31397
|
-
|
|
31398
|
-
var
|
|
31399
|
-
|
|
31400
|
-
|
|
31401
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
31402
|
-
key = sourceKeys[i];
|
|
31403
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
31404
|
-
target[key] = source[key];
|
|
31388
|
+
return n;
|
|
31389
|
+
}, _extends.apply(null, arguments);
|
|
31390
|
+
}
|
|
31391
|
+
function _objectWithoutPropertiesLoose(r, e2) {
|
|
31392
|
+
if (null == r) return {};
|
|
31393
|
+
var t2 = {};
|
|
31394
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
31395
|
+
if (e2.includes(n)) continue;
|
|
31396
|
+
t2[n] = r[n];
|
|
31405
31397
|
}
|
|
31406
|
-
return
|
|
31398
|
+
return t2;
|
|
31407
31399
|
}
|
|
31408
31400
|
class Text {
|
|
31409
31401
|
/**
|
|
@@ -33305,7 +33297,7 @@ function getAddr(state, addr) {
|
|
|
33305
33297
|
}
|
|
33306
33298
|
const languageData = /* @__PURE__ */ Facet.define();
|
|
33307
33299
|
const allowMultipleSelections = /* @__PURE__ */ Facet.define({
|
|
33308
|
-
combine: (values) => values.some((
|
|
33300
|
+
combine: (values) => values.some((v2) => v2),
|
|
33309
33301
|
static: true
|
|
33310
33302
|
});
|
|
33311
33303
|
const lineSeparator = /* @__PURE__ */ Facet.define({
|
|
@@ -33387,7 +33379,7 @@ class StateEffect {
|
|
|
33387
33379
|
removed.
|
|
33388
33380
|
*/
|
|
33389
33381
|
static define(spec = {}) {
|
|
33390
|
-
return new StateEffectType(spec.map || ((
|
|
33382
|
+
return new StateEffectType(spec.map || ((v2) => v2));
|
|
33391
33383
|
}
|
|
33392
33384
|
/**
|
|
33393
33385
|
Map an array of effects through a change set.
|
|
@@ -35208,14 +35200,16 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
35208
35200
|
}
|
|
35209
35201
|
}
|
|
35210
35202
|
}
|
|
35211
|
-
function
|
|
35212
|
-
let doc2 = dom.ownerDocument;
|
|
35203
|
+
function scrollableParents(dom) {
|
|
35204
|
+
let doc2 = dom.ownerDocument, x, y;
|
|
35213
35205
|
for (let cur2 = dom.parentNode; cur2; ) {
|
|
35214
|
-
if (cur2 == doc2.body) {
|
|
35206
|
+
if (cur2 == doc2.body || x && y) {
|
|
35215
35207
|
break;
|
|
35216
35208
|
} else if (cur2.nodeType == 1) {
|
|
35217
|
-
if (cur2.scrollHeight > cur2.clientHeight
|
|
35218
|
-
|
|
35209
|
+
if (!y && cur2.scrollHeight > cur2.clientHeight)
|
|
35210
|
+
y = cur2;
|
|
35211
|
+
if (!x && cur2.scrollWidth > cur2.clientWidth)
|
|
35212
|
+
x = cur2;
|
|
35219
35213
|
cur2 = cur2.assignedSlot || cur2.parentNode;
|
|
35220
35214
|
} else if (cur2.nodeType == 11) {
|
|
35221
35215
|
cur2 = cur2.host;
|
|
@@ -35223,7 +35217,7 @@ function scrollableParent(dom) {
|
|
|
35223
35217
|
break;
|
|
35224
35218
|
}
|
|
35225
35219
|
}
|
|
35226
|
-
return
|
|
35220
|
+
return { x, y };
|
|
35227
35221
|
}
|
|
35228
35222
|
class DOMSelectionState {
|
|
35229
35223
|
constructor() {
|
|
@@ -35539,11 +35533,11 @@ class ContentView {
|
|
|
35539
35533
|
dom.cmView = this;
|
|
35540
35534
|
}
|
|
35541
35535
|
get rootView() {
|
|
35542
|
-
for (let
|
|
35543
|
-
let parent =
|
|
35536
|
+
for (let v2 = this; ; ) {
|
|
35537
|
+
let parent = v2.parent;
|
|
35544
35538
|
if (!parent)
|
|
35545
|
-
return
|
|
35546
|
-
|
|
35539
|
+
return v2;
|
|
35540
|
+
v2 = parent;
|
|
35547
35541
|
}
|
|
35548
35542
|
}
|
|
35549
35543
|
replaceChildren(from, to2, children = noChildren) {
|
|
@@ -36147,6 +36141,249 @@ function getAttrs(dom) {
|
|
|
36147
36141
|
}
|
|
36148
36142
|
return attrs;
|
|
36149
36143
|
}
|
|
36144
|
+
class WidgetType {
|
|
36145
|
+
/**
|
|
36146
|
+
Compare this instance to another instance of the same type.
|
|
36147
|
+
(TypeScript can't express this, but only instances of the same
|
|
36148
|
+
specific class will be passed to this method.) This is used to
|
|
36149
|
+
avoid redrawing widgets when they are replaced by a new
|
|
36150
|
+
decoration of the same type. The default implementation just
|
|
36151
|
+
returns `false`, which will cause new instances of the widget to
|
|
36152
|
+
always be redrawn.
|
|
36153
|
+
*/
|
|
36154
|
+
eq(widget) {
|
|
36155
|
+
return false;
|
|
36156
|
+
}
|
|
36157
|
+
/**
|
|
36158
|
+
Update a DOM element created by a widget of the same type (but
|
|
36159
|
+
different, non-`eq` content) to reflect this widget. May return
|
|
36160
|
+
true to indicate that it could update, false to indicate it
|
|
36161
|
+
couldn't (in which case the widget will be redrawn). The default
|
|
36162
|
+
implementation just returns false.
|
|
36163
|
+
*/
|
|
36164
|
+
updateDOM(dom, view) {
|
|
36165
|
+
return false;
|
|
36166
|
+
}
|
|
36167
|
+
/**
|
|
36168
|
+
@internal
|
|
36169
|
+
*/
|
|
36170
|
+
compare(other) {
|
|
36171
|
+
return this == other || this.constructor == other.constructor && this.eq(other);
|
|
36172
|
+
}
|
|
36173
|
+
/**
|
|
36174
|
+
The estimated height this widget will have, to be used when
|
|
36175
|
+
estimating the height of content that hasn't been drawn. May
|
|
36176
|
+
return -1 to indicate you don't know. The default implementation
|
|
36177
|
+
returns -1.
|
|
36178
|
+
*/
|
|
36179
|
+
get estimatedHeight() {
|
|
36180
|
+
return -1;
|
|
36181
|
+
}
|
|
36182
|
+
/**
|
|
36183
|
+
For inline widgets that are displayed inline (as opposed to
|
|
36184
|
+
`inline-block`) and introduce line breaks (through `<br>` tags
|
|
36185
|
+
or textual newlines), this must indicate the amount of line
|
|
36186
|
+
breaks they introduce. Defaults to 0.
|
|
36187
|
+
*/
|
|
36188
|
+
get lineBreaks() {
|
|
36189
|
+
return 0;
|
|
36190
|
+
}
|
|
36191
|
+
/**
|
|
36192
|
+
Can be used to configure which kinds of events inside the widget
|
|
36193
|
+
should be ignored by the editor. The default is to ignore all
|
|
36194
|
+
events.
|
|
36195
|
+
*/
|
|
36196
|
+
ignoreEvent(event) {
|
|
36197
|
+
return true;
|
|
36198
|
+
}
|
|
36199
|
+
/**
|
|
36200
|
+
Override the way screen coordinates for positions at/in the
|
|
36201
|
+
widget are found. `pos` will be the offset into the widget, and
|
|
36202
|
+
`side` the side of the position that is being queried—less than
|
|
36203
|
+
zero for before, greater than zero for after, and zero for
|
|
36204
|
+
directly at that position.
|
|
36205
|
+
*/
|
|
36206
|
+
coordsAt(dom, pos, side) {
|
|
36207
|
+
return null;
|
|
36208
|
+
}
|
|
36209
|
+
/**
|
|
36210
|
+
@internal
|
|
36211
|
+
*/
|
|
36212
|
+
get isHidden() {
|
|
36213
|
+
return false;
|
|
36214
|
+
}
|
|
36215
|
+
/**
|
|
36216
|
+
@internal
|
|
36217
|
+
*/
|
|
36218
|
+
get editable() {
|
|
36219
|
+
return false;
|
|
36220
|
+
}
|
|
36221
|
+
/**
|
|
36222
|
+
This is called when the an instance of the widget is removed
|
|
36223
|
+
from the editor view.
|
|
36224
|
+
*/
|
|
36225
|
+
destroy(dom) {
|
|
36226
|
+
}
|
|
36227
|
+
}
|
|
36228
|
+
var BlockType = /* @__PURE__ */ function(BlockType2) {
|
|
36229
|
+
BlockType2[BlockType2["Text"] = 0] = "Text";
|
|
36230
|
+
BlockType2[BlockType2["WidgetBefore"] = 1] = "WidgetBefore";
|
|
36231
|
+
BlockType2[BlockType2["WidgetAfter"] = 2] = "WidgetAfter";
|
|
36232
|
+
BlockType2[BlockType2["WidgetRange"] = 3] = "WidgetRange";
|
|
36233
|
+
return BlockType2;
|
|
36234
|
+
}(BlockType || (BlockType = {}));
|
|
36235
|
+
class Decoration extends RangeValue {
|
|
36236
|
+
constructor(startSide, endSide, widget, spec) {
|
|
36237
|
+
super();
|
|
36238
|
+
this.startSide = startSide;
|
|
36239
|
+
this.endSide = endSide;
|
|
36240
|
+
this.widget = widget;
|
|
36241
|
+
this.spec = spec;
|
|
36242
|
+
}
|
|
36243
|
+
/**
|
|
36244
|
+
@internal
|
|
36245
|
+
*/
|
|
36246
|
+
get heightRelevant() {
|
|
36247
|
+
return false;
|
|
36248
|
+
}
|
|
36249
|
+
/**
|
|
36250
|
+
Create a mark decoration, which influences the styling of the
|
|
36251
|
+
content in its range. Nested mark decorations will cause nested
|
|
36252
|
+
DOM elements to be created. Nesting order is determined by
|
|
36253
|
+
precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with
|
|
36254
|
+
the higher-precedence decorations creating the inner DOM nodes.
|
|
36255
|
+
Such elements are split on line boundaries and on the boundaries
|
|
36256
|
+
of lower-precedence decorations.
|
|
36257
|
+
*/
|
|
36258
|
+
static mark(spec) {
|
|
36259
|
+
return new MarkDecoration(spec);
|
|
36260
|
+
}
|
|
36261
|
+
/**
|
|
36262
|
+
Create a widget decoration, which displays a DOM element at the
|
|
36263
|
+
given position.
|
|
36264
|
+
*/
|
|
36265
|
+
static widget(spec) {
|
|
36266
|
+
let side = Math.max(-1e4, Math.min(1e4, spec.side || 0)), block = !!spec.block;
|
|
36267
|
+
side += block && !spec.inlineOrder ? side > 0 ? 3e8 : -4e8 : side > 0 ? 1e8 : -1e8;
|
|
36268
|
+
return new PointDecoration(spec, side, side, block, spec.widget || null, false);
|
|
36269
|
+
}
|
|
36270
|
+
/**
|
|
36271
|
+
Create a replace decoration which replaces the given range with
|
|
36272
|
+
a widget, or simply hides it.
|
|
36273
|
+
*/
|
|
36274
|
+
static replace(spec) {
|
|
36275
|
+
let block = !!spec.block, startSide, endSide;
|
|
36276
|
+
if (spec.isBlockGap) {
|
|
36277
|
+
startSide = -5e8;
|
|
36278
|
+
endSide = 4e8;
|
|
36279
|
+
} else {
|
|
36280
|
+
let { start, end } = getInclusive(spec, block);
|
|
36281
|
+
startSide = (start ? block ? -3e8 : -1 : 5e8) - 1;
|
|
36282
|
+
endSide = (end ? block ? 2e8 : 1 : -6e8) + 1;
|
|
36283
|
+
}
|
|
36284
|
+
return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);
|
|
36285
|
+
}
|
|
36286
|
+
/**
|
|
36287
|
+
Create a line decoration, which can add DOM attributes to the
|
|
36288
|
+
line starting at the given position.
|
|
36289
|
+
*/
|
|
36290
|
+
static line(spec) {
|
|
36291
|
+
return new LineDecoration(spec);
|
|
36292
|
+
}
|
|
36293
|
+
/**
|
|
36294
|
+
Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
|
|
36295
|
+
decorated range or ranges. If the ranges aren't already sorted,
|
|
36296
|
+
pass `true` for `sort` to make the library sort them for you.
|
|
36297
|
+
*/
|
|
36298
|
+
static set(of, sort = false) {
|
|
36299
|
+
return RangeSet.of(of, sort);
|
|
36300
|
+
}
|
|
36301
|
+
/**
|
|
36302
|
+
@internal
|
|
36303
|
+
*/
|
|
36304
|
+
hasHeight() {
|
|
36305
|
+
return this.widget ? this.widget.estimatedHeight > -1 : false;
|
|
36306
|
+
}
|
|
36307
|
+
}
|
|
36308
|
+
Decoration.none = RangeSet.empty;
|
|
36309
|
+
class MarkDecoration extends Decoration {
|
|
36310
|
+
constructor(spec) {
|
|
36311
|
+
let { start, end } = getInclusive(spec);
|
|
36312
|
+
super(start ? -1 : 5e8, end ? 1 : -6e8, null, spec);
|
|
36313
|
+
this.tagName = spec.tagName || "span";
|
|
36314
|
+
this.class = spec.class || "";
|
|
36315
|
+
this.attrs = spec.attributes || null;
|
|
36316
|
+
}
|
|
36317
|
+
eq(other) {
|
|
36318
|
+
var _a2, _b;
|
|
36319
|
+
return this == other || other instanceof MarkDecoration && this.tagName == other.tagName && (this.class || ((_a2 = this.attrs) === null || _a2 === void 0 ? void 0 : _a2.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) && attrsEq(this.attrs, other.attrs, "class");
|
|
36320
|
+
}
|
|
36321
|
+
range(from, to2 = from) {
|
|
36322
|
+
if (from >= to2)
|
|
36323
|
+
throw new RangeError("Mark decorations may not be empty");
|
|
36324
|
+
return super.range(from, to2);
|
|
36325
|
+
}
|
|
36326
|
+
}
|
|
36327
|
+
MarkDecoration.prototype.point = false;
|
|
36328
|
+
class LineDecoration extends Decoration {
|
|
36329
|
+
constructor(spec) {
|
|
36330
|
+
super(-2e8, -2e8, null, spec);
|
|
36331
|
+
}
|
|
36332
|
+
eq(other) {
|
|
36333
|
+
return other instanceof LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
36334
|
+
}
|
|
36335
|
+
range(from, to2 = from) {
|
|
36336
|
+
if (to2 != from)
|
|
36337
|
+
throw new RangeError("Line decoration ranges must be zero-length");
|
|
36338
|
+
return super.range(from, to2);
|
|
36339
|
+
}
|
|
36340
|
+
}
|
|
36341
|
+
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
|
|
36342
|
+
LineDecoration.prototype.point = true;
|
|
36343
|
+
class PointDecoration extends Decoration {
|
|
36344
|
+
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
36345
|
+
super(startSide, endSide, widget, spec);
|
|
36346
|
+
this.block = block;
|
|
36347
|
+
this.isReplace = isReplace;
|
|
36348
|
+
this.mapMode = !block ? MapMode.TrackDel : startSide <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter;
|
|
36349
|
+
}
|
|
36350
|
+
// Only relevant when this.block == true
|
|
36351
|
+
get type() {
|
|
36352
|
+
return this.startSide != this.endSide ? BlockType.WidgetRange : this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter;
|
|
36353
|
+
}
|
|
36354
|
+
get heightRelevant() {
|
|
36355
|
+
return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
|
|
36356
|
+
}
|
|
36357
|
+
eq(other) {
|
|
36358
|
+
return other instanceof PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide;
|
|
36359
|
+
}
|
|
36360
|
+
range(from, to2 = from) {
|
|
36361
|
+
if (this.isReplace && (from > to2 || from == to2 && this.startSide > 0 && this.endSide <= 0))
|
|
36362
|
+
throw new RangeError("Invalid range for replacement decoration");
|
|
36363
|
+
if (!this.isReplace && to2 != from)
|
|
36364
|
+
throw new RangeError("Widget decorations can only have zero-length ranges");
|
|
36365
|
+
return super.range(from, to2);
|
|
36366
|
+
}
|
|
36367
|
+
}
|
|
36368
|
+
PointDecoration.prototype.point = true;
|
|
36369
|
+
function getInclusive(spec, block = false) {
|
|
36370
|
+
let { inclusiveStart: start, inclusiveEnd: end } = spec;
|
|
36371
|
+
if (start == null)
|
|
36372
|
+
start = spec.inclusive;
|
|
36373
|
+
if (end == null)
|
|
36374
|
+
end = spec.inclusive;
|
|
36375
|
+
return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };
|
|
36376
|
+
}
|
|
36377
|
+
function widgetsEq(a, b) {
|
|
36378
|
+
return a == b || !!(a && b && a.compare(b));
|
|
36379
|
+
}
|
|
36380
|
+
function addRange(from, to2, ranges, margin = 0) {
|
|
36381
|
+
let last = ranges.length - 1;
|
|
36382
|
+
if (last >= 0 && ranges[last] + margin >= from)
|
|
36383
|
+
ranges[last] = Math.max(ranges[last], to2);
|
|
36384
|
+
else
|
|
36385
|
+
ranges.push(from, to2);
|
|
36386
|
+
}
|
|
36150
36387
|
class LineView extends ContentView {
|
|
36151
36388
|
constructor() {
|
|
36152
36389
|
super(...arguments);
|
|
@@ -36283,8 +36520,8 @@ class LineView extends ContentView {
|
|
|
36283
36520
|
}
|
|
36284
36521
|
return rect;
|
|
36285
36522
|
}
|
|
36286
|
-
become(
|
|
36287
|
-
return
|
|
36523
|
+
become(other) {
|
|
36524
|
+
return other instanceof LineView && this.children.length == 0 && other.children.length == 0 && attrsEq(this.attrs, other.attrs) && this.breakAfter == other.breakAfter;
|
|
36288
36525
|
}
|
|
36289
36526
|
covers() {
|
|
36290
36527
|
return true;
|
|
@@ -36374,7 +36611,12 @@ class BlockWidgetView extends ContentView {
|
|
|
36374
36611
|
return true;
|
|
36375
36612
|
}
|
|
36376
36613
|
coordsAt(pos, side) {
|
|
36377
|
-
|
|
36614
|
+
let custom = this.widget.coordsAt(this.dom, pos, side);
|
|
36615
|
+
if (custom)
|
|
36616
|
+
return custom;
|
|
36617
|
+
if (this.widget instanceof BlockGapWidget)
|
|
36618
|
+
return null;
|
|
36619
|
+
return flattenRect(this.dom.getBoundingClientRect(), this.length ? pos == 0 : side <= 0);
|
|
36378
36620
|
}
|
|
36379
36621
|
destroy() {
|
|
36380
36622
|
super.destroy();
|
|
@@ -36386,248 +36628,33 @@ class BlockWidgetView extends ContentView {
|
|
|
36386
36628
|
return startSide == endSide ? false : side < 0 ? startSide < 0 : endSide > 0;
|
|
36387
36629
|
}
|
|
36388
36630
|
}
|
|
36389
|
-
class WidgetType {
|
|
36390
|
-
|
|
36391
|
-
|
|
36392
|
-
|
|
36393
|
-
specific class will be passed to this method.) This is used to
|
|
36394
|
-
avoid redrawing widgets when they are replaced by a new
|
|
36395
|
-
decoration of the same type. The default implementation just
|
|
36396
|
-
returns `false`, which will cause new instances of the widget to
|
|
36397
|
-
always be redrawn.
|
|
36398
|
-
*/
|
|
36399
|
-
eq(widget) {
|
|
36400
|
-
return false;
|
|
36401
|
-
}
|
|
36402
|
-
/**
|
|
36403
|
-
Update a DOM element created by a widget of the same type (but
|
|
36404
|
-
different, non-`eq` content) to reflect this widget. May return
|
|
36405
|
-
true to indicate that it could update, false to indicate it
|
|
36406
|
-
couldn't (in which case the widget will be redrawn). The default
|
|
36407
|
-
implementation just returns false.
|
|
36408
|
-
*/
|
|
36409
|
-
updateDOM(dom, view) {
|
|
36410
|
-
return false;
|
|
36411
|
-
}
|
|
36412
|
-
/**
|
|
36413
|
-
@internal
|
|
36414
|
-
*/
|
|
36415
|
-
compare(other) {
|
|
36416
|
-
return this == other || this.constructor == other.constructor && this.eq(other);
|
|
36631
|
+
class BlockGapWidget extends WidgetType {
|
|
36632
|
+
constructor(height) {
|
|
36633
|
+
super();
|
|
36634
|
+
this.height = height;
|
|
36417
36635
|
}
|
|
36418
|
-
|
|
36419
|
-
|
|
36420
|
-
|
|
36421
|
-
|
|
36422
|
-
|
|
36423
|
-
*/
|
|
36424
|
-
get estimatedHeight() {
|
|
36425
|
-
return -1;
|
|
36636
|
+
toDOM() {
|
|
36637
|
+
let elt = document.createElement("div");
|
|
36638
|
+
elt.className = "cm-gap";
|
|
36639
|
+
this.updateDOM(elt);
|
|
36640
|
+
return elt;
|
|
36426
36641
|
}
|
|
36427
|
-
|
|
36428
|
-
|
|
36429
|
-
`inline-block`) and introduce line breaks (through `<br>` tags
|
|
36430
|
-
or textual newlines), this must indicate the amount of line
|
|
36431
|
-
breaks they introduce. Defaults to 0.
|
|
36432
|
-
*/
|
|
36433
|
-
get lineBreaks() {
|
|
36434
|
-
return 0;
|
|
36642
|
+
eq(other) {
|
|
36643
|
+
return other.height == this.height;
|
|
36435
36644
|
}
|
|
36436
|
-
|
|
36437
|
-
|
|
36438
|
-
should be ignored by the editor. The default is to ignore all
|
|
36439
|
-
events.
|
|
36440
|
-
*/
|
|
36441
|
-
ignoreEvent(event) {
|
|
36645
|
+
updateDOM(elt) {
|
|
36646
|
+
elt.style.height = this.height + "px";
|
|
36442
36647
|
return true;
|
|
36443
36648
|
}
|
|
36444
|
-
/**
|
|
36445
|
-
Override the way screen coordinates for positions at/in the
|
|
36446
|
-
widget are found. `pos` will be the offset into the widget, and
|
|
36447
|
-
`side` the side of the position that is being queried—less than
|
|
36448
|
-
zero for before, greater than zero for after, and zero for
|
|
36449
|
-
directly at that position.
|
|
36450
|
-
*/
|
|
36451
|
-
coordsAt(dom, pos, side) {
|
|
36452
|
-
return null;
|
|
36453
|
-
}
|
|
36454
|
-
/**
|
|
36455
|
-
@internal
|
|
36456
|
-
*/
|
|
36457
|
-
get isHidden() {
|
|
36458
|
-
return false;
|
|
36459
|
-
}
|
|
36460
|
-
/**
|
|
36461
|
-
@internal
|
|
36462
|
-
*/
|
|
36463
36649
|
get editable() {
|
|
36464
|
-
return
|
|
36465
|
-
}
|
|
36466
|
-
/**
|
|
36467
|
-
This is called when the an instance of the widget is removed
|
|
36468
|
-
from the editor view.
|
|
36469
|
-
*/
|
|
36470
|
-
destroy(dom) {
|
|
36650
|
+
return true;
|
|
36471
36651
|
}
|
|
36472
|
-
|
|
36473
|
-
|
|
36474
|
-
BlockType2[BlockType2["Text"] = 0] = "Text";
|
|
36475
|
-
BlockType2[BlockType2["WidgetBefore"] = 1] = "WidgetBefore";
|
|
36476
|
-
BlockType2[BlockType2["WidgetAfter"] = 2] = "WidgetAfter";
|
|
36477
|
-
BlockType2[BlockType2["WidgetRange"] = 3] = "WidgetRange";
|
|
36478
|
-
return BlockType2;
|
|
36479
|
-
}(BlockType || (BlockType = {}));
|
|
36480
|
-
class Decoration extends RangeValue {
|
|
36481
|
-
constructor(startSide, endSide, widget, spec) {
|
|
36482
|
-
super();
|
|
36483
|
-
this.startSide = startSide;
|
|
36484
|
-
this.endSide = endSide;
|
|
36485
|
-
this.widget = widget;
|
|
36486
|
-
this.spec = spec;
|
|
36652
|
+
get estimatedHeight() {
|
|
36653
|
+
return this.height;
|
|
36487
36654
|
}
|
|
36488
|
-
|
|
36489
|
-
@internal
|
|
36490
|
-
*/
|
|
36491
|
-
get heightRelevant() {
|
|
36655
|
+
ignoreEvent() {
|
|
36492
36656
|
return false;
|
|
36493
36657
|
}
|
|
36494
|
-
/**
|
|
36495
|
-
Create a mark decoration, which influences the styling of the
|
|
36496
|
-
content in its range. Nested mark decorations will cause nested
|
|
36497
|
-
DOM elements to be created. Nesting order is determined by
|
|
36498
|
-
precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with
|
|
36499
|
-
the higher-precedence decorations creating the inner DOM nodes.
|
|
36500
|
-
Such elements are split on line boundaries and on the boundaries
|
|
36501
|
-
of lower-precedence decorations.
|
|
36502
|
-
*/
|
|
36503
|
-
static mark(spec) {
|
|
36504
|
-
return new MarkDecoration(spec);
|
|
36505
|
-
}
|
|
36506
|
-
/**
|
|
36507
|
-
Create a widget decoration, which displays a DOM element at the
|
|
36508
|
-
given position.
|
|
36509
|
-
*/
|
|
36510
|
-
static widget(spec) {
|
|
36511
|
-
let side = Math.max(-1e4, Math.min(1e4, spec.side || 0)), block = !!spec.block;
|
|
36512
|
-
side += block && !spec.inlineOrder ? side > 0 ? 3e8 : -4e8 : side > 0 ? 1e8 : -1e8;
|
|
36513
|
-
return new PointDecoration(spec, side, side, block, spec.widget || null, false);
|
|
36514
|
-
}
|
|
36515
|
-
/**
|
|
36516
|
-
Create a replace decoration which replaces the given range with
|
|
36517
|
-
a widget, or simply hides it.
|
|
36518
|
-
*/
|
|
36519
|
-
static replace(spec) {
|
|
36520
|
-
let block = !!spec.block, startSide, endSide;
|
|
36521
|
-
if (spec.isBlockGap) {
|
|
36522
|
-
startSide = -5e8;
|
|
36523
|
-
endSide = 4e8;
|
|
36524
|
-
} else {
|
|
36525
|
-
let { start, end } = getInclusive(spec, block);
|
|
36526
|
-
startSide = (start ? block ? -3e8 : -1 : 5e8) - 1;
|
|
36527
|
-
endSide = (end ? block ? 2e8 : 1 : -6e8) + 1;
|
|
36528
|
-
}
|
|
36529
|
-
return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);
|
|
36530
|
-
}
|
|
36531
|
-
/**
|
|
36532
|
-
Create a line decoration, which can add DOM attributes to the
|
|
36533
|
-
line starting at the given position.
|
|
36534
|
-
*/
|
|
36535
|
-
static line(spec) {
|
|
36536
|
-
return new LineDecoration(spec);
|
|
36537
|
-
}
|
|
36538
|
-
/**
|
|
36539
|
-
Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
|
|
36540
|
-
decorated range or ranges. If the ranges aren't already sorted,
|
|
36541
|
-
pass `true` for `sort` to make the library sort them for you.
|
|
36542
|
-
*/
|
|
36543
|
-
static set(of, sort = false) {
|
|
36544
|
-
return RangeSet.of(of, sort);
|
|
36545
|
-
}
|
|
36546
|
-
/**
|
|
36547
|
-
@internal
|
|
36548
|
-
*/
|
|
36549
|
-
hasHeight() {
|
|
36550
|
-
return this.widget ? this.widget.estimatedHeight > -1 : false;
|
|
36551
|
-
}
|
|
36552
|
-
}
|
|
36553
|
-
Decoration.none = RangeSet.empty;
|
|
36554
|
-
class MarkDecoration extends Decoration {
|
|
36555
|
-
constructor(spec) {
|
|
36556
|
-
let { start, end } = getInclusive(spec);
|
|
36557
|
-
super(start ? -1 : 5e8, end ? 1 : -6e8, null, spec);
|
|
36558
|
-
this.tagName = spec.tagName || "span";
|
|
36559
|
-
this.class = spec.class || "";
|
|
36560
|
-
this.attrs = spec.attributes || null;
|
|
36561
|
-
}
|
|
36562
|
-
eq(other) {
|
|
36563
|
-
var _a2, _b;
|
|
36564
|
-
return this == other || other instanceof MarkDecoration && this.tagName == other.tagName && (this.class || ((_a2 = this.attrs) === null || _a2 === void 0 ? void 0 : _a2.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) && attrsEq(this.attrs, other.attrs, "class");
|
|
36565
|
-
}
|
|
36566
|
-
range(from, to2 = from) {
|
|
36567
|
-
if (from >= to2)
|
|
36568
|
-
throw new RangeError("Mark decorations may not be empty");
|
|
36569
|
-
return super.range(from, to2);
|
|
36570
|
-
}
|
|
36571
|
-
}
|
|
36572
|
-
MarkDecoration.prototype.point = false;
|
|
36573
|
-
class LineDecoration extends Decoration {
|
|
36574
|
-
constructor(spec) {
|
|
36575
|
-
super(-2e8, -2e8, null, spec);
|
|
36576
|
-
}
|
|
36577
|
-
eq(other) {
|
|
36578
|
-
return other instanceof LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
36579
|
-
}
|
|
36580
|
-
range(from, to2 = from) {
|
|
36581
|
-
if (to2 != from)
|
|
36582
|
-
throw new RangeError("Line decoration ranges must be zero-length");
|
|
36583
|
-
return super.range(from, to2);
|
|
36584
|
-
}
|
|
36585
|
-
}
|
|
36586
|
-
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
|
|
36587
|
-
LineDecoration.prototype.point = true;
|
|
36588
|
-
class PointDecoration extends Decoration {
|
|
36589
|
-
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
36590
|
-
super(startSide, endSide, widget, spec);
|
|
36591
|
-
this.block = block;
|
|
36592
|
-
this.isReplace = isReplace;
|
|
36593
|
-
this.mapMode = !block ? MapMode.TrackDel : startSide <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter;
|
|
36594
|
-
}
|
|
36595
|
-
// Only relevant when this.block == true
|
|
36596
|
-
get type() {
|
|
36597
|
-
return this.startSide != this.endSide ? BlockType.WidgetRange : this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter;
|
|
36598
|
-
}
|
|
36599
|
-
get heightRelevant() {
|
|
36600
|
-
return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
|
|
36601
|
-
}
|
|
36602
|
-
eq(other) {
|
|
36603
|
-
return other instanceof PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide;
|
|
36604
|
-
}
|
|
36605
|
-
range(from, to2 = from) {
|
|
36606
|
-
if (this.isReplace && (from > to2 || from == to2 && this.startSide > 0 && this.endSide <= 0))
|
|
36607
|
-
throw new RangeError("Invalid range for replacement decoration");
|
|
36608
|
-
if (!this.isReplace && to2 != from)
|
|
36609
|
-
throw new RangeError("Widget decorations can only have zero-length ranges");
|
|
36610
|
-
return super.range(from, to2);
|
|
36611
|
-
}
|
|
36612
|
-
}
|
|
36613
|
-
PointDecoration.prototype.point = true;
|
|
36614
|
-
function getInclusive(spec, block = false) {
|
|
36615
|
-
let { inclusiveStart: start, inclusiveEnd: end } = spec;
|
|
36616
|
-
if (start == null)
|
|
36617
|
-
start = spec.inclusive;
|
|
36618
|
-
if (end == null)
|
|
36619
|
-
end = spec.inclusive;
|
|
36620
|
-
return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };
|
|
36621
|
-
}
|
|
36622
|
-
function widgetsEq(a, b) {
|
|
36623
|
-
return a == b || !!(a && b && a.compare(b));
|
|
36624
|
-
}
|
|
36625
|
-
function addRange(from, to2, ranges, margin = 0) {
|
|
36626
|
-
let last = ranges.length - 1;
|
|
36627
|
-
if (last >= 0 && ranges[last] + margin >= from)
|
|
36628
|
-
ranges[last] = Math.max(ranges[last], to2);
|
|
36629
|
-
else
|
|
36630
|
-
ranges.push(from, to2);
|
|
36631
36658
|
}
|
|
36632
36659
|
class ContentBuilder {
|
|
36633
36660
|
constructor(doc2, pos, end, disallowBlockEffectsFor) {
|
|
@@ -36912,9 +36939,9 @@ function computeCharTypes(line, rFrom, rTo, isolates, outerType) {
|
|
|
36912
36939
|
let end = i + 1;
|
|
36913
36940
|
while (end < to2 && types[end] == 64)
|
|
36914
36941
|
end++;
|
|
36915
|
-
let
|
|
36942
|
+
let replace2 = i && prev == 8 || end < rTo && types[end] == 8 ? prevStrong == 1 ? 1 : 8 : 256;
|
|
36916
36943
|
for (let j = i; j < end; j++)
|
|
36917
|
-
types[j] =
|
|
36944
|
+
types[j] = replace2;
|
|
36918
36945
|
i = end - 1;
|
|
36919
36946
|
} else if (type == 8 && prevStrong == 1) {
|
|
36920
36947
|
types[i] = 1;
|
|
@@ -36989,13 +37016,13 @@ function processNeutrals(rFrom, rTo, isolates, outerType) {
|
|
|
36989
37016
|
}
|
|
36990
37017
|
let beforeL = prev == 1;
|
|
36991
37018
|
let afterL = (end < rTo ? types[end] : outerType) == 1;
|
|
36992
|
-
let
|
|
37019
|
+
let replace2 = beforeL == afterL ? beforeL ? 1 : 2 : outerType;
|
|
36993
37020
|
for (let j = end, jI = iI, fromJ = jI ? isolates[jI - 1].to : rFrom; j > i; ) {
|
|
36994
37021
|
if (j == fromJ) {
|
|
36995
37022
|
j = isolates[--jI].from;
|
|
36996
37023
|
fromJ = jI ? isolates[jI - 1].to : rFrom;
|
|
36997
37024
|
}
|
|
36998
|
-
types[--j] =
|
|
37025
|
+
types[--j] = replace2;
|
|
36999
37026
|
}
|
|
37000
37027
|
i = end;
|
|
37001
37028
|
} else {
|
|
@@ -37973,34 +38000,6 @@ class DocView extends ContentView {
|
|
|
37973
38000
|
function betweenUneditable(pos) {
|
|
37974
38001
|
return pos.node.nodeType == 1 && pos.node.firstChild && (pos.offset == 0 || pos.node.childNodes[pos.offset - 1].contentEditable == "false") && (pos.offset == pos.node.childNodes.length || pos.node.childNodes[pos.offset].contentEditable == "false");
|
|
37975
38002
|
}
|
|
37976
|
-
class BlockGapWidget extends WidgetType {
|
|
37977
|
-
constructor(height) {
|
|
37978
|
-
super();
|
|
37979
|
-
this.height = height;
|
|
37980
|
-
}
|
|
37981
|
-
toDOM() {
|
|
37982
|
-
let elt = document.createElement("div");
|
|
37983
|
-
elt.className = "cm-gap";
|
|
37984
|
-
this.updateDOM(elt);
|
|
37985
|
-
return elt;
|
|
37986
|
-
}
|
|
37987
|
-
eq(other) {
|
|
37988
|
-
return other.height == this.height;
|
|
37989
|
-
}
|
|
37990
|
-
updateDOM(elt) {
|
|
37991
|
-
elt.style.height = this.height + "px";
|
|
37992
|
-
return true;
|
|
37993
|
-
}
|
|
37994
|
-
get editable() {
|
|
37995
|
-
return true;
|
|
37996
|
-
}
|
|
37997
|
-
get estimatedHeight() {
|
|
37998
|
-
return this.height;
|
|
37999
|
-
}
|
|
38000
|
-
ignoreEvent() {
|
|
38001
|
-
return false;
|
|
38002
|
-
}
|
|
38003
|
-
}
|
|
38004
38003
|
function findCompositionNode(view, headPos) {
|
|
38005
38004
|
let sel = view.observer.selectionRange;
|
|
38006
38005
|
if (!sel.focusNode)
|
|
@@ -38424,6 +38423,321 @@ function skipAtoms(view, oldPos, pos) {
|
|
|
38424
38423
|
let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map((f) => f(view)), pos.from, oldPos.head > pos.from ? -1 : 1);
|
|
38425
38424
|
return newPos == pos.from ? pos : EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1);
|
|
38426
38425
|
}
|
|
38426
|
+
const LineBreakPlaceholder = "";
|
|
38427
|
+
class DOMReader {
|
|
38428
|
+
constructor(points, state) {
|
|
38429
|
+
this.points = points;
|
|
38430
|
+
this.text = "";
|
|
38431
|
+
this.lineSeparator = state.facet(EditorState.lineSeparator);
|
|
38432
|
+
}
|
|
38433
|
+
append(text) {
|
|
38434
|
+
this.text += text;
|
|
38435
|
+
}
|
|
38436
|
+
lineBreak() {
|
|
38437
|
+
this.text += LineBreakPlaceholder;
|
|
38438
|
+
}
|
|
38439
|
+
readRange(start, end) {
|
|
38440
|
+
if (!start)
|
|
38441
|
+
return this;
|
|
38442
|
+
let parent = start.parentNode;
|
|
38443
|
+
for (let cur2 = start; ; ) {
|
|
38444
|
+
this.findPointBefore(parent, cur2);
|
|
38445
|
+
let oldLen = this.text.length;
|
|
38446
|
+
this.readNode(cur2);
|
|
38447
|
+
let next = cur2.nextSibling;
|
|
38448
|
+
if (next == end)
|
|
38449
|
+
break;
|
|
38450
|
+
let view = ContentView.get(cur2), nextView = ContentView.get(next);
|
|
38451
|
+
if (view && nextView ? view.breakAfter : (view ? view.breakAfter : isBlockElement(cur2)) || isBlockElement(next) && (cur2.nodeName != "BR" || cur2.cmIgnore) && this.text.length > oldLen)
|
|
38452
|
+
this.lineBreak();
|
|
38453
|
+
cur2 = next;
|
|
38454
|
+
}
|
|
38455
|
+
this.findPointBefore(parent, end);
|
|
38456
|
+
return this;
|
|
38457
|
+
}
|
|
38458
|
+
readTextNode(node) {
|
|
38459
|
+
let text = node.nodeValue;
|
|
38460
|
+
for (let point of this.points)
|
|
38461
|
+
if (point.node == node)
|
|
38462
|
+
point.pos = this.text.length + Math.min(point.offset, text.length);
|
|
38463
|
+
for (let off = 0, re2 = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
|
|
38464
|
+
let nextBreak = -1, breakSize = 1, m2;
|
|
38465
|
+
if (this.lineSeparator) {
|
|
38466
|
+
nextBreak = text.indexOf(this.lineSeparator, off);
|
|
38467
|
+
breakSize = this.lineSeparator.length;
|
|
38468
|
+
} else if (m2 = re2.exec(text)) {
|
|
38469
|
+
nextBreak = m2.index;
|
|
38470
|
+
breakSize = m2[0].length;
|
|
38471
|
+
}
|
|
38472
|
+
this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak));
|
|
38473
|
+
if (nextBreak < 0)
|
|
38474
|
+
break;
|
|
38475
|
+
this.lineBreak();
|
|
38476
|
+
if (breakSize > 1) {
|
|
38477
|
+
for (let point of this.points)
|
|
38478
|
+
if (point.node == node && point.pos > this.text.length)
|
|
38479
|
+
point.pos -= breakSize - 1;
|
|
38480
|
+
}
|
|
38481
|
+
off = nextBreak + breakSize;
|
|
38482
|
+
}
|
|
38483
|
+
}
|
|
38484
|
+
readNode(node) {
|
|
38485
|
+
if (node.cmIgnore)
|
|
38486
|
+
return;
|
|
38487
|
+
let view = ContentView.get(node);
|
|
38488
|
+
let fromView = view && view.overrideDOMText;
|
|
38489
|
+
if (fromView != null) {
|
|
38490
|
+
this.findPointInside(node, fromView.length);
|
|
38491
|
+
for (let i = fromView.iter(); !i.next().done; ) {
|
|
38492
|
+
if (i.lineBreak)
|
|
38493
|
+
this.lineBreak();
|
|
38494
|
+
else
|
|
38495
|
+
this.append(i.value);
|
|
38496
|
+
}
|
|
38497
|
+
} else if (node.nodeType == 3) {
|
|
38498
|
+
this.readTextNode(node);
|
|
38499
|
+
} else if (node.nodeName == "BR") {
|
|
38500
|
+
if (node.nextSibling)
|
|
38501
|
+
this.lineBreak();
|
|
38502
|
+
} else if (node.nodeType == 1) {
|
|
38503
|
+
this.readRange(node.firstChild, null);
|
|
38504
|
+
}
|
|
38505
|
+
}
|
|
38506
|
+
findPointBefore(node, next) {
|
|
38507
|
+
for (let point of this.points)
|
|
38508
|
+
if (point.node == node && node.childNodes[point.offset] == next)
|
|
38509
|
+
point.pos = this.text.length;
|
|
38510
|
+
}
|
|
38511
|
+
findPointInside(node, length) {
|
|
38512
|
+
for (let point of this.points)
|
|
38513
|
+
if (node.nodeType == 3 ? point.node == node : node.contains(point.node))
|
|
38514
|
+
point.pos = this.text.length + (isAtEnd(node, point.node, point.offset) ? length : 0);
|
|
38515
|
+
}
|
|
38516
|
+
}
|
|
38517
|
+
function isAtEnd(parent, node, offset) {
|
|
38518
|
+
for (; ; ) {
|
|
38519
|
+
if (!node || offset < maxOffset(node))
|
|
38520
|
+
return false;
|
|
38521
|
+
if (node == parent)
|
|
38522
|
+
return true;
|
|
38523
|
+
offset = domIndex(node) + 1;
|
|
38524
|
+
node = node.parentNode;
|
|
38525
|
+
}
|
|
38526
|
+
}
|
|
38527
|
+
class DOMPoint {
|
|
38528
|
+
constructor(node, offset) {
|
|
38529
|
+
this.node = node;
|
|
38530
|
+
this.offset = offset;
|
|
38531
|
+
this.pos = -1;
|
|
38532
|
+
}
|
|
38533
|
+
}
|
|
38534
|
+
class DOMChange {
|
|
38535
|
+
constructor(view, start, end, typeOver) {
|
|
38536
|
+
this.typeOver = typeOver;
|
|
38537
|
+
this.bounds = null;
|
|
38538
|
+
this.text = "";
|
|
38539
|
+
this.domChanged = start > -1;
|
|
38540
|
+
let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView;
|
|
38541
|
+
if (view.state.readOnly && start > -1) {
|
|
38542
|
+
this.newSel = null;
|
|
38543
|
+
} else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
|
|
38544
|
+
let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
|
|
38545
|
+
let reader = new DOMReader(selPoints, view.state);
|
|
38546
|
+
reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
|
|
38547
|
+
this.text = reader.text;
|
|
38548
|
+
this.newSel = selectionFromPoints(selPoints, this.bounds.from);
|
|
38549
|
+
} else {
|
|
38550
|
+
let domSel = view.observer.selectionRange;
|
|
38551
|
+
let head = iHead && iHead.node == domSel.focusNode && iHead.offset == domSel.focusOffset || !contains(view.contentDOM, domSel.focusNode) ? view.state.selection.main.head : view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);
|
|
38552
|
+
let anchor = iAnchor && iAnchor.node == domSel.anchorNode && iAnchor.offset == domSel.anchorOffset || !contains(view.contentDOM, domSel.anchorNode) ? view.state.selection.main.anchor : view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset);
|
|
38553
|
+
let vp = view.viewport;
|
|
38554
|
+
if ((browser.ios || browser.chrome) && view.state.selection.main.empty && head != anchor && (vp.from > 0 || vp.to < view.state.doc.length)) {
|
|
38555
|
+
let from = Math.min(head, anchor), to2 = Math.max(head, anchor);
|
|
38556
|
+
let offFrom = vp.from - from, offTo = vp.to - to2;
|
|
38557
|
+
if ((offFrom == 0 || offFrom == 1 || from == 0) && (offTo == 0 || offTo == -1 || to2 == view.state.doc.length)) {
|
|
38558
|
+
head = 0;
|
|
38559
|
+
anchor = view.state.doc.length;
|
|
38560
|
+
}
|
|
38561
|
+
}
|
|
38562
|
+
this.newSel = EditorSelection.single(anchor, head);
|
|
38563
|
+
}
|
|
38564
|
+
}
|
|
38565
|
+
}
|
|
38566
|
+
function applyDOMChange(view, domChange) {
|
|
38567
|
+
let change;
|
|
38568
|
+
let { newSel } = domChange, sel = view.state.selection.main;
|
|
38569
|
+
let lastKey = view.inputState.lastKeyTime > Date.now() - 100 ? view.inputState.lastKeyCode : -1;
|
|
38570
|
+
if (domChange.bounds) {
|
|
38571
|
+
let { from, to: to2 } = domChange.bounds;
|
|
38572
|
+
let preferredPos = sel.from, preferredSide = null;
|
|
38573
|
+
if (lastKey === 8 || browser.android && domChange.text.length < to2 - from) {
|
|
38574
|
+
preferredPos = sel.to;
|
|
38575
|
+
preferredSide = "end";
|
|
38576
|
+
}
|
|
38577
|
+
let diff = findDiff(view.state.doc.sliceString(from, to2, LineBreakPlaceholder), domChange.text, preferredPos - from, preferredSide);
|
|
38578
|
+
if (diff) {
|
|
38579
|
+
if (browser.chrome && lastKey == 13 && diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
38580
|
+
diff.toB--;
|
|
38581
|
+
change = {
|
|
38582
|
+
from: from + diff.from,
|
|
38583
|
+
to: from + diff.toA,
|
|
38584
|
+
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder))
|
|
38585
|
+
};
|
|
38586
|
+
}
|
|
38587
|
+
} else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
|
38588
|
+
newSel = null;
|
|
38589
|
+
}
|
|
38590
|
+
if (!change && !newSel)
|
|
38591
|
+
return false;
|
|
38592
|
+
if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) {
|
|
38593
|
+
change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) };
|
|
38594
|
+
} else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
|
|
38595
|
+
change = {
|
|
38596
|
+
from: sel.from,
|
|
38597
|
+
to: sel.to,
|
|
38598
|
+
insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
|
|
38599
|
+
};
|
|
38600
|
+
} else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
|
|
38601
|
+
if (newSel && change.insert.length == 2)
|
|
38602
|
+
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
38603
|
+
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
38604
|
+
} else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
|
|
38605
|
+
if (newSel)
|
|
38606
|
+
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
38607
|
+
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
38608
|
+
}
|
|
38609
|
+
if (change) {
|
|
38610
|
+
return applyDOMChangeInner(view, change, newSel, lastKey);
|
|
38611
|
+
} else if (newSel && !newSel.main.eq(sel)) {
|
|
38612
|
+
let scrollIntoView2 = false, userEvent = "select";
|
|
38613
|
+
if (view.inputState.lastSelectionTime > Date.now() - 50) {
|
|
38614
|
+
if (view.inputState.lastSelectionOrigin == "select")
|
|
38615
|
+
scrollIntoView2 = true;
|
|
38616
|
+
userEvent = view.inputState.lastSelectionOrigin;
|
|
38617
|
+
}
|
|
38618
|
+
view.dispatch({ selection: newSel, scrollIntoView: scrollIntoView2, userEvent });
|
|
38619
|
+
return true;
|
|
38620
|
+
} else {
|
|
38621
|
+
return false;
|
|
38622
|
+
}
|
|
38623
|
+
}
|
|
38624
|
+
function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
38625
|
+
if (browser.ios && view.inputState.flushIOSKey(change))
|
|
38626
|
+
return true;
|
|
38627
|
+
let sel = view.state.selection.main;
|
|
38628
|
+
if (browser.android && (change.to == sel.to && // GBoard will sometimes remove a space it just inserted
|
|
38629
|
+
// after a completion when you press enter
|
|
38630
|
+
(change.from == sel.from || change.from == sel.from - 1 && view.state.sliceDoc(change.from, sel.from) == " ") && change.insert.length == 1 && change.insert.lines == 2 && dispatchKey(view.contentDOM, "Enter", 13) || (change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 || lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) && dispatchKey(view.contentDOM, "Backspace", 8) || change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 && dispatchKey(view.contentDOM, "Delete", 46)))
|
|
38631
|
+
return true;
|
|
38632
|
+
let text = change.insert.toString();
|
|
38633
|
+
if (view.inputState.composing >= 0)
|
|
38634
|
+
view.inputState.composing++;
|
|
38635
|
+
let defaultTr;
|
|
38636
|
+
let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));
|
|
38637
|
+
if (!view.state.facet(inputHandler$1).some((h) => h(view, change.from, change.to, text, defaultInsert)))
|
|
38638
|
+
view.dispatch(defaultInsert());
|
|
38639
|
+
return true;
|
|
38640
|
+
}
|
|
38641
|
+
function applyDefaultInsert(view, change, newSel) {
|
|
38642
|
+
let tr, startState = view.state, sel = startState.selection.main;
|
|
38643
|
+
if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 && (!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) && view.inputState.composing < 0) {
|
|
38644
|
+
let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : "";
|
|
38645
|
+
let after = sel.to > change.to ? startState.sliceDoc(change.to, sel.to) : "";
|
|
38646
|
+
tr = startState.replaceSelection(view.state.toText(before + change.insert.sliceString(0, void 0, view.state.lineBreak) + after));
|
|
38647
|
+
} else {
|
|
38648
|
+
let changes = startState.changes(change);
|
|
38649
|
+
let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : void 0;
|
|
38650
|
+
if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 && change.to <= sel.to && change.to >= sel.to - 10) {
|
|
38651
|
+
let replaced = view.state.sliceDoc(change.from, change.to);
|
|
38652
|
+
let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head);
|
|
38653
|
+
if (composition) {
|
|
38654
|
+
let dLen = change.insert.length - (change.to - change.from);
|
|
38655
|
+
compositionRange = { from: composition.from, to: composition.to - dLen };
|
|
38656
|
+
} else {
|
|
38657
|
+
compositionRange = view.state.doc.lineAt(sel.head);
|
|
38658
|
+
}
|
|
38659
|
+
let offset = sel.to - change.to, size = sel.to - sel.from;
|
|
38660
|
+
tr = startState.changeByRange((range) => {
|
|
38661
|
+
if (range.from == sel.from && range.to == sel.to)
|
|
38662
|
+
return { changes, range: mainSel || range.map(changes) };
|
|
38663
|
+
let to2 = range.to - offset, from = to2 - replaced.length;
|
|
38664
|
+
if (range.to - range.from != size || view.state.sliceDoc(from, to2) != replaced || // Unfortunately, there's no way to make multiple
|
|
38665
|
+
// changes in the same node work without aborting
|
|
38666
|
+
// composition, so cursors in the composition range are
|
|
38667
|
+
// ignored.
|
|
38668
|
+
range.to >= compositionRange.from && range.from <= compositionRange.to)
|
|
38669
|
+
return { range };
|
|
38670
|
+
let rangeChanges = startState.changes({ from, to: to2, insert: change.insert }), selOff = range.to - sel.to;
|
|
38671
|
+
return {
|
|
38672
|
+
changes: rangeChanges,
|
|
38673
|
+
range: !mainSel ? range.map(rangeChanges) : EditorSelection.range(Math.max(0, mainSel.anchor + selOff), Math.max(0, mainSel.head + selOff))
|
|
38674
|
+
};
|
|
38675
|
+
});
|
|
38676
|
+
} else {
|
|
38677
|
+
tr = {
|
|
38678
|
+
changes,
|
|
38679
|
+
selection: mainSel && startState.selection.replaceRange(mainSel)
|
|
38680
|
+
};
|
|
38681
|
+
}
|
|
38682
|
+
}
|
|
38683
|
+
let userEvent = "input.type";
|
|
38684
|
+
if (view.composing || view.inputState.compositionPendingChange && view.inputState.compositionEndedAt > Date.now() - 50) {
|
|
38685
|
+
view.inputState.compositionPendingChange = false;
|
|
38686
|
+
userEvent += ".compose";
|
|
38687
|
+
if (view.inputState.compositionFirstChange) {
|
|
38688
|
+
userEvent += ".start";
|
|
38689
|
+
view.inputState.compositionFirstChange = false;
|
|
38690
|
+
}
|
|
38691
|
+
}
|
|
38692
|
+
return startState.update(tr, { userEvent, scrollIntoView: true });
|
|
38693
|
+
}
|
|
38694
|
+
function findDiff(a, b, preferredPos, preferredSide) {
|
|
38695
|
+
let minLen = Math.min(a.length, b.length);
|
|
38696
|
+
let from = 0;
|
|
38697
|
+
while (from < minLen && a.charCodeAt(from) == b.charCodeAt(from))
|
|
38698
|
+
from++;
|
|
38699
|
+
if (from == minLen && a.length == b.length)
|
|
38700
|
+
return null;
|
|
38701
|
+
let toA = a.length, toB = b.length;
|
|
38702
|
+
while (toA > 0 && toB > 0 && a.charCodeAt(toA - 1) == b.charCodeAt(toB - 1)) {
|
|
38703
|
+
toA--;
|
|
38704
|
+
toB--;
|
|
38705
|
+
}
|
|
38706
|
+
if (preferredSide == "end") {
|
|
38707
|
+
let adjust = Math.max(0, from - Math.min(toA, toB));
|
|
38708
|
+
preferredPos -= toA + adjust - from;
|
|
38709
|
+
}
|
|
38710
|
+
if (toA < from && a.length < b.length) {
|
|
38711
|
+
let move = preferredPos <= from && preferredPos >= toA ? from - preferredPos : 0;
|
|
38712
|
+
from -= move;
|
|
38713
|
+
toB = from + (toB - toA);
|
|
38714
|
+
toA = from;
|
|
38715
|
+
} else if (toB < from) {
|
|
38716
|
+
let move = preferredPos <= from && preferredPos >= toB ? from - preferredPos : 0;
|
|
38717
|
+
from -= move;
|
|
38718
|
+
toA = from + (toA - toB);
|
|
38719
|
+
toB = from;
|
|
38720
|
+
}
|
|
38721
|
+
return { from, toA, toB };
|
|
38722
|
+
}
|
|
38723
|
+
function selectionPoints(view) {
|
|
38724
|
+
let result = [];
|
|
38725
|
+
if (view.root.activeElement != view.contentDOM)
|
|
38726
|
+
return result;
|
|
38727
|
+
let { anchorNode, anchorOffset, focusNode, focusOffset } = view.observer.selectionRange;
|
|
38728
|
+
if (anchorNode) {
|
|
38729
|
+
result.push(new DOMPoint(anchorNode, anchorOffset));
|
|
38730
|
+
if (focusNode != anchorNode || focusOffset != anchorOffset)
|
|
38731
|
+
result.push(new DOMPoint(focusNode, focusOffset));
|
|
38732
|
+
}
|
|
38733
|
+
return result;
|
|
38734
|
+
}
|
|
38735
|
+
function selectionFromPoints(points, base2) {
|
|
38736
|
+
if (points.length == 0)
|
|
38737
|
+
return null;
|
|
38738
|
+
let anchor = points[0].pos, head = points.length == 2 ? points[1].pos : anchor;
|
|
38739
|
+
return anchor > -1 && head > -1 ? EditorSelection.single(anchor + base2, head + base2) : null;
|
|
38740
|
+
}
|
|
38427
38741
|
class InputState {
|
|
38428
38742
|
setSelectionOrigin(origin) {
|
|
38429
38743
|
this.lastSelectionOrigin = origin;
|
|
@@ -38617,7 +38931,7 @@ class MouseSelection {
|
|
|
38617
38931
|
this.scrollSpeed = { x: 0, y: 0 };
|
|
38618
38932
|
this.scrolling = -1;
|
|
38619
38933
|
this.lastEvent = startEvent;
|
|
38620
|
-
this.
|
|
38934
|
+
this.scrollParents = scrollableParents(view.contentDOM);
|
|
38621
38935
|
this.atoms = view.state.facet(atomicRanges).map((f) => f(view));
|
|
38622
38936
|
let doc2 = view.contentDOM.ownerDocument;
|
|
38623
38937
|
doc2.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
@@ -38631,23 +38945,26 @@ class MouseSelection {
|
|
|
38631
38945
|
this.select(event);
|
|
38632
38946
|
}
|
|
38633
38947
|
move(event) {
|
|
38634
|
-
var _a2;
|
|
38635
38948
|
if (event.buttons == 0)
|
|
38636
38949
|
return this.destroy();
|
|
38637
38950
|
if (this.dragging || this.dragging == null && dist(this.startEvent, event) < 10)
|
|
38638
38951
|
return;
|
|
38639
38952
|
this.select(this.lastEvent = event);
|
|
38640
38953
|
let sx = 0, sy = 0;
|
|
38641
|
-
let
|
|
38954
|
+
let left = 0, top2 = 0, right = this.view.win.innerWidth, bottom = this.view.win.innerHeight;
|
|
38955
|
+
if (this.scrollParents.x)
|
|
38956
|
+
({ left, right } = this.scrollParents.x.getBoundingClientRect());
|
|
38957
|
+
if (this.scrollParents.y)
|
|
38958
|
+
({ top: top2, bottom } = this.scrollParents.y.getBoundingClientRect());
|
|
38642
38959
|
let margins = getScrollMargins(this.view);
|
|
38643
|
-
if (event.clientX - margins.left <=
|
|
38644
|
-
sx = -dragScrollSpeed(
|
|
38645
|
-
else if (event.clientX + margins.right >=
|
|
38646
|
-
sx = dragScrollSpeed(event.clientX -
|
|
38647
|
-
if (event.clientY - margins.top <=
|
|
38648
|
-
sy = -dragScrollSpeed(
|
|
38649
|
-
else if (event.clientY + margins.bottom >=
|
|
38650
|
-
sy = dragScrollSpeed(event.clientY -
|
|
38960
|
+
if (event.clientX - margins.left <= left + dragScrollMargin)
|
|
38961
|
+
sx = -dragScrollSpeed(left - event.clientX);
|
|
38962
|
+
else if (event.clientX + margins.right >= right - dragScrollMargin)
|
|
38963
|
+
sx = dragScrollSpeed(event.clientX - right);
|
|
38964
|
+
if (event.clientY - margins.top <= top2 + dragScrollMargin)
|
|
38965
|
+
sy = -dragScrollSpeed(top2 - event.clientY);
|
|
38966
|
+
else if (event.clientY + margins.bottom >= bottom - dragScrollMargin)
|
|
38967
|
+
sy = dragScrollSpeed(event.clientY - bottom);
|
|
38651
38968
|
this.setScrollSpeed(sx, sy);
|
|
38652
38969
|
}
|
|
38653
38970
|
up(event) {
|
|
@@ -38675,12 +38992,17 @@ class MouseSelection {
|
|
|
38675
38992
|
}
|
|
38676
38993
|
}
|
|
38677
38994
|
scroll() {
|
|
38678
|
-
|
|
38679
|
-
|
|
38680
|
-
this.
|
|
38681
|
-
|
|
38682
|
-
|
|
38995
|
+
let { x, y } = this.scrollSpeed;
|
|
38996
|
+
if (x && this.scrollParents.x) {
|
|
38997
|
+
this.scrollParents.x.scrollLeft += x;
|
|
38998
|
+
x = 0;
|
|
38999
|
+
}
|
|
39000
|
+
if (y && this.scrollParents.y) {
|
|
39001
|
+
this.scrollParents.y.scrollTop += y;
|
|
39002
|
+
y = 0;
|
|
38683
39003
|
}
|
|
39004
|
+
if (x || y)
|
|
39005
|
+
this.view.win.scrollBy(x, y);
|
|
38684
39006
|
if (this.dragging === false)
|
|
38685
39007
|
this.select(this.lastEvent);
|
|
38686
39008
|
}
|
|
@@ -38864,8 +39186,7 @@ function rangeForClick(view, pos, bias, type) {
|
|
|
38864
39186
|
return EditorSelection.range(from, to2);
|
|
38865
39187
|
}
|
|
38866
39188
|
}
|
|
38867
|
-
let
|
|
38868
|
-
let inside = (x, y, rect) => insideY(y, rect) && x >= rect.left && x <= rect.right;
|
|
39189
|
+
let inside = (x, y, rect) => y >= rect.top && y <= rect.bottom && x >= rect.left && x <= rect.right;
|
|
38869
39190
|
function findPositionSide(view, pos, x, y) {
|
|
38870
39191
|
let line = LineView.find(view.docView, pos);
|
|
38871
39192
|
if (!line)
|
|
@@ -38881,7 +39202,7 @@ function findPositionSide(view, pos, x, y) {
|
|
|
38881
39202
|
let after = line.coordsAt(off, 1);
|
|
38882
39203
|
if (after && inside(x, y, after))
|
|
38883
39204
|
return 1;
|
|
38884
|
-
return before &&
|
|
39205
|
+
return before && before.bottom >= y ? -1 : 1;
|
|
38885
39206
|
}
|
|
38886
39207
|
function queryPos(view, event) {
|
|
38887
39208
|
let pos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
@@ -39143,12 +39464,21 @@ observers.contextmenu = (view) => {
|
|
|
39143
39464
|
view.inputState.lastContextMenu = Date.now();
|
|
39144
39465
|
};
|
|
39145
39466
|
handlers.beforeinput = (view, event) => {
|
|
39146
|
-
var _a2;
|
|
39467
|
+
var _a2, _b;
|
|
39468
|
+
if (event.inputType == "insertReplacementText" && view.observer.editContext) {
|
|
39469
|
+
let text = (_a2 = event.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.getData("text/plain"), ranges = event.getTargetRanges();
|
|
39470
|
+
if (text && ranges.length) {
|
|
39471
|
+
let r = ranges[0];
|
|
39472
|
+
let from = view.posAtDOM(r.startContainer, r.startOffset), to2 = view.posAtDOM(r.endContainer, r.endOffset);
|
|
39473
|
+
applyDOMChangeInner(view, { from, to: to2, insert: view.state.toText(text) }, null);
|
|
39474
|
+
return true;
|
|
39475
|
+
}
|
|
39476
|
+
}
|
|
39147
39477
|
let pending;
|
|
39148
39478
|
if (browser.chrome && browser.android && (pending = PendingKeys.find((key) => key.inputType == event.inputType))) {
|
|
39149
39479
|
view.observer.delayAndroidKey(pending.key, pending.keyCode);
|
|
39150
39480
|
if (pending.key == "Backspace" || pending.key == "Delete") {
|
|
39151
|
-
let startViewHeight = ((
|
|
39481
|
+
let startViewHeight = ((_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.height) || 0;
|
|
39152
39482
|
setTimeout(() => {
|
|
39153
39483
|
var _a3;
|
|
39154
39484
|
if ((((_a3 = window.visualViewport) === null || _a3 === void 0 ? void 0 : _a3.height) || 0) > startViewHeight + 10 && view.hasFocus) {
|
|
@@ -39177,6 +39507,10 @@ function firefoxCopyCutHack(doc2) {
|
|
|
39177
39507
|
}
|
|
39178
39508
|
}
|
|
39179
39509
|
const wrappingWhiteSpace = ["pre-wrap", "normal", "pre-line", "break-spaces"];
|
|
39510
|
+
let heightChangeFlag = false;
|
|
39511
|
+
function clearHeightChangeFlag() {
|
|
39512
|
+
heightChangeFlag = false;
|
|
39513
|
+
}
|
|
39180
39514
|
class HeightOracle {
|
|
39181
39515
|
constructor(lineWrapping) {
|
|
39182
39516
|
this.lineWrapping = lineWrapping;
|
|
@@ -39186,7 +39520,6 @@ class HeightOracle {
|
|
|
39186
39520
|
this.charWidth = 7;
|
|
39187
39521
|
this.textHeight = 14;
|
|
39188
39522
|
this.lineLength = 30;
|
|
39189
|
-
this.heightChanged = false;
|
|
39190
39523
|
}
|
|
39191
39524
|
heightForGap(from, to2) {
|
|
39192
39525
|
let lines = this.doc.lineAt(to2).number - this.doc.lineAt(from).number + 1;
|
|
@@ -39322,10 +39655,10 @@ class HeightMap {
|
|
|
39322
39655
|
set outdated(value) {
|
|
39323
39656
|
this.flags = (value ? 2 : 0) | this.flags & ~2;
|
|
39324
39657
|
}
|
|
39325
|
-
setHeight(
|
|
39658
|
+
setHeight(height) {
|
|
39326
39659
|
if (this.height != height) {
|
|
39327
39660
|
if (Math.abs(this.height - height) > Epsilon)
|
|
39328
|
-
|
|
39661
|
+
heightChangeFlag = true;
|
|
39329
39662
|
this.height = height;
|
|
39330
39663
|
}
|
|
39331
39664
|
}
|
|
@@ -39360,7 +39693,7 @@ class HeightMap {
|
|
|
39360
39693
|
fromB += start.from - fromA;
|
|
39361
39694
|
fromA = start.from;
|
|
39362
39695
|
let nodes = NodeBuilder.build(oracle.setDoc(doc2), decorations2, fromB, toB);
|
|
39363
|
-
me = me.replace(fromA, toA, nodes);
|
|
39696
|
+
me = replace(me, me.replace(fromA, toA, nodes));
|
|
39364
39697
|
}
|
|
39365
39698
|
return me.updateHeight(oracle, 0);
|
|
39366
39699
|
}
|
|
@@ -39417,6 +39750,13 @@ class HeightMap {
|
|
|
39417
39750
|
return new HeightMapBranch(HeightMap.of(nodes.slice(0, i)), brk, HeightMap.of(nodes.slice(j)));
|
|
39418
39751
|
}
|
|
39419
39752
|
}
|
|
39753
|
+
function replace(old, val) {
|
|
39754
|
+
if (old == val)
|
|
39755
|
+
return old;
|
|
39756
|
+
if (old.constructor != val.constructor)
|
|
39757
|
+
heightChangeFlag = true;
|
|
39758
|
+
return val;
|
|
39759
|
+
}
|
|
39420
39760
|
HeightMap.prototype.size = 1;
|
|
39421
39761
|
class HeightMapBlock extends HeightMap {
|
|
39422
39762
|
constructor(length, height, deco) {
|
|
@@ -39435,7 +39775,7 @@ class HeightMapBlock extends HeightMap {
|
|
|
39435
39775
|
}
|
|
39436
39776
|
updateHeight(oracle, offset = 0, _force = false, measured) {
|
|
39437
39777
|
if (measured && measured.from <= offset && measured.more)
|
|
39438
|
-
this.setHeight(
|
|
39778
|
+
this.setHeight(measured.heights[measured.index++]);
|
|
39439
39779
|
this.outdated = false;
|
|
39440
39780
|
return this;
|
|
39441
39781
|
}
|
|
@@ -39469,9 +39809,9 @@ class HeightMapText extends HeightMapBlock {
|
|
|
39469
39809
|
}
|
|
39470
39810
|
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
39471
39811
|
if (measured && measured.from <= offset && measured.more)
|
|
39472
|
-
this.setHeight(
|
|
39812
|
+
this.setHeight(measured.heights[measured.index++]);
|
|
39473
39813
|
else if (force || this.outdated)
|
|
39474
|
-
this.setHeight(
|
|
39814
|
+
this.setHeight(Math.max(this.widgetHeight, oracle.heightForLine(this.length - this.collapsed)) + this.breaks * oracle.lineHeight);
|
|
39475
39815
|
this.outdated = false;
|
|
39476
39816
|
return this;
|
|
39477
39817
|
}
|
|
@@ -39587,10 +39927,10 @@ class HeightMapGap extends HeightMap {
|
|
|
39587
39927
|
nodes.push(null, new HeightMapGap(end - pos).updateHeight(oracle, pos));
|
|
39588
39928
|
let result = HeightMap.of(nodes);
|
|
39589
39929
|
if (singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon || Math.abs(singleHeight - this.heightMetrics(oracle, offset).perLine) >= Epsilon)
|
|
39590
|
-
|
|
39591
|
-
return result;
|
|
39930
|
+
heightChangeFlag = true;
|
|
39931
|
+
return replace(this, result);
|
|
39592
39932
|
} else if (force || this.outdated) {
|
|
39593
|
-
this.setHeight(oracle
|
|
39933
|
+
this.setHeight(oracle.heightForGap(offset, offset + this.length));
|
|
39594
39934
|
this.outdated = false;
|
|
39595
39935
|
}
|
|
39596
39936
|
return this;
|
|
@@ -39689,9 +40029,9 @@ class HeightMapBranch extends HeightMap {
|
|
|
39689
40029
|
balanced(left, right) {
|
|
39690
40030
|
if (left.size > 2 * right.size || right.size > 2 * left.size)
|
|
39691
40031
|
return HeightMap.of(this.break ? [left, null, right] : [left, right]);
|
|
39692
|
-
this.left = left;
|
|
39693
|
-
this.right = right;
|
|
39694
|
-
this.
|
|
40032
|
+
this.left = replace(this.left, left);
|
|
40033
|
+
this.right = replace(this.right, right);
|
|
40034
|
+
this.setHeight(left.height + right.height);
|
|
39695
40035
|
this.outdated = left.outdated || right.outdated;
|
|
39696
40036
|
this.size = left.size + right.size;
|
|
39697
40037
|
this.length = left.length + this.break + right.length;
|
|
@@ -39873,7 +40213,7 @@ function visiblePixelRange(dom, paddingTop) {
|
|
|
39873
40213
|
left = Math.max(left, parentRect.left);
|
|
39874
40214
|
right = Math.min(right, parentRect.right);
|
|
39875
40215
|
top2 = Math.max(top2, parentRect.top);
|
|
39876
|
-
bottom = parent == dom.parentNode ?
|
|
40216
|
+
bottom = Math.min(parent == dom.parentNode ? win.innerHeight : bottom, parentRect.bottom);
|
|
39877
40217
|
}
|
|
39878
40218
|
parent = style.position == "absolute" || style.position == "fixed" ? elt.offsetParent : elt.parentNode;
|
|
39879
40219
|
} else if (parent.nodeType == 11) {
|
|
@@ -39968,7 +40308,7 @@ class ViewState {
|
|
|
39968
40308
|
this.defaultTextDirection = Direction.LTR;
|
|
39969
40309
|
this.visibleRanges = [];
|
|
39970
40310
|
this.mustEnforceCursorAssoc = false;
|
|
39971
|
-
let guessWrapping = state.facet(contentAttributes).some((
|
|
40311
|
+
let guessWrapping = state.facet(contentAttributes).some((v2) => typeof v2 != "function" && v2.class == "cm-lineWrapping");
|
|
39972
40312
|
this.heightOracle = new HeightOracle(guessWrapping);
|
|
39973
40313
|
this.stateDeco = state.facet(decorations).filter((d) => typeof d != "function");
|
|
39974
40314
|
this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle.setDoc(state.doc), [new ChangedRange(0, 0, 0, state.doc.length)]);
|
|
@@ -40013,8 +40353,9 @@ class ViewState {
|
|
|
40013
40353
|
let heightChanges = ChangedRange.extendWithRanges(contentChanges, heightRelevantDecoChanges(prevDeco, this.stateDeco, update ? update.changes : ChangeSet.empty(this.state.doc.length)));
|
|
40014
40354
|
let prevHeight = this.heightMap.height;
|
|
40015
40355
|
let scrollAnchor = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop);
|
|
40356
|
+
clearHeightChangeFlag();
|
|
40016
40357
|
this.heightMap = this.heightMap.applyChanges(this.stateDeco, update.startState.doc, this.heightOracle.setDoc(this.state.doc), heightChanges);
|
|
40017
|
-
if (this.heightMap.height != prevHeight)
|
|
40358
|
+
if (this.heightMap.height != prevHeight || heightChangeFlag)
|
|
40018
40359
|
update.flags |= 2;
|
|
40019
40360
|
if (scrollAnchor) {
|
|
40020
40361
|
this.scrollAnchorPos = update.changes.mapPos(scrollAnchor.from, -1);
|
|
@@ -40111,12 +40452,12 @@ class ViewState {
|
|
|
40111
40452
|
bias = Math.max(dTop, dBottom);
|
|
40112
40453
|
else if (dTop < 0 && dBottom < 0)
|
|
40113
40454
|
bias = Math.min(dTop, dBottom);
|
|
40114
|
-
|
|
40455
|
+
clearHeightChangeFlag();
|
|
40115
40456
|
for (let vp of this.viewports) {
|
|
40116
40457
|
let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);
|
|
40117
40458
|
this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
|
|
40118
40459
|
}
|
|
40119
|
-
if (
|
|
40460
|
+
if (heightChangeFlag)
|
|
40120
40461
|
result |= 2;
|
|
40121
40462
|
}
|
|
40122
40463
|
let viewportChange = !this.viewportIsAppropriate(this.viewport, bias) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to);
|
|
@@ -40493,7 +40834,8 @@ const baseTheme$1$3 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
|
|
|
40493
40834
|
height: "100%",
|
|
40494
40835
|
overflowX: "auto",
|
|
40495
40836
|
position: "relative",
|
|
40496
|
-
zIndex: 0
|
|
40837
|
+
zIndex: 0,
|
|
40838
|
+
overflowAnchor: "none"
|
|
40497
40839
|
},
|
|
40498
40840
|
".cm-content": {
|
|
40499
40841
|
margin: 0,
|
|
@@ -40634,7 +40976,8 @@ const baseTheme$1$3 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
|
|
|
40634
40976
|
boxSizing: "border-box",
|
|
40635
40977
|
position: "sticky",
|
|
40636
40978
|
left: 0,
|
|
40637
|
-
right: 0
|
|
40979
|
+
right: 0,
|
|
40980
|
+
zIndex: 300
|
|
40638
40981
|
},
|
|
40639
40982
|
"&light .cm-panels": {
|
|
40640
40983
|
backgroundColor: "#f5f5f5",
|
|
@@ -40717,321 +41060,6 @@ const baseTheme$1$3 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
|
|
|
40717
41060
|
backgroundColor: "inherit"
|
|
40718
41061
|
}
|
|
40719
41062
|
}, lightDarkIDs);
|
|
40720
|
-
const LineBreakPlaceholder = "";
|
|
40721
|
-
class DOMReader {
|
|
40722
|
-
constructor(points, state) {
|
|
40723
|
-
this.points = points;
|
|
40724
|
-
this.text = "";
|
|
40725
|
-
this.lineSeparator = state.facet(EditorState.lineSeparator);
|
|
40726
|
-
}
|
|
40727
|
-
append(text) {
|
|
40728
|
-
this.text += text;
|
|
40729
|
-
}
|
|
40730
|
-
lineBreak() {
|
|
40731
|
-
this.text += LineBreakPlaceholder;
|
|
40732
|
-
}
|
|
40733
|
-
readRange(start, end) {
|
|
40734
|
-
if (!start)
|
|
40735
|
-
return this;
|
|
40736
|
-
let parent = start.parentNode;
|
|
40737
|
-
for (let cur2 = start; ; ) {
|
|
40738
|
-
this.findPointBefore(parent, cur2);
|
|
40739
|
-
let oldLen = this.text.length;
|
|
40740
|
-
this.readNode(cur2);
|
|
40741
|
-
let next = cur2.nextSibling;
|
|
40742
|
-
if (next == end)
|
|
40743
|
-
break;
|
|
40744
|
-
let view = ContentView.get(cur2), nextView = ContentView.get(next);
|
|
40745
|
-
if (view && nextView ? view.breakAfter : (view ? view.breakAfter : isBlockElement(cur2)) || isBlockElement(next) && (cur2.nodeName != "BR" || cur2.cmIgnore) && this.text.length > oldLen)
|
|
40746
|
-
this.lineBreak();
|
|
40747
|
-
cur2 = next;
|
|
40748
|
-
}
|
|
40749
|
-
this.findPointBefore(parent, end);
|
|
40750
|
-
return this;
|
|
40751
|
-
}
|
|
40752
|
-
readTextNode(node) {
|
|
40753
|
-
let text = node.nodeValue;
|
|
40754
|
-
for (let point of this.points)
|
|
40755
|
-
if (point.node == node)
|
|
40756
|
-
point.pos = this.text.length + Math.min(point.offset, text.length);
|
|
40757
|
-
for (let off = 0, re2 = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
|
|
40758
|
-
let nextBreak = -1, breakSize = 1, m2;
|
|
40759
|
-
if (this.lineSeparator) {
|
|
40760
|
-
nextBreak = text.indexOf(this.lineSeparator, off);
|
|
40761
|
-
breakSize = this.lineSeparator.length;
|
|
40762
|
-
} else if (m2 = re2.exec(text)) {
|
|
40763
|
-
nextBreak = m2.index;
|
|
40764
|
-
breakSize = m2[0].length;
|
|
40765
|
-
}
|
|
40766
|
-
this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak));
|
|
40767
|
-
if (nextBreak < 0)
|
|
40768
|
-
break;
|
|
40769
|
-
this.lineBreak();
|
|
40770
|
-
if (breakSize > 1) {
|
|
40771
|
-
for (let point of this.points)
|
|
40772
|
-
if (point.node == node && point.pos > this.text.length)
|
|
40773
|
-
point.pos -= breakSize - 1;
|
|
40774
|
-
}
|
|
40775
|
-
off = nextBreak + breakSize;
|
|
40776
|
-
}
|
|
40777
|
-
}
|
|
40778
|
-
readNode(node) {
|
|
40779
|
-
if (node.cmIgnore)
|
|
40780
|
-
return;
|
|
40781
|
-
let view = ContentView.get(node);
|
|
40782
|
-
let fromView = view && view.overrideDOMText;
|
|
40783
|
-
if (fromView != null) {
|
|
40784
|
-
this.findPointInside(node, fromView.length);
|
|
40785
|
-
for (let i = fromView.iter(); !i.next().done; ) {
|
|
40786
|
-
if (i.lineBreak)
|
|
40787
|
-
this.lineBreak();
|
|
40788
|
-
else
|
|
40789
|
-
this.append(i.value);
|
|
40790
|
-
}
|
|
40791
|
-
} else if (node.nodeType == 3) {
|
|
40792
|
-
this.readTextNode(node);
|
|
40793
|
-
} else if (node.nodeName == "BR") {
|
|
40794
|
-
if (node.nextSibling)
|
|
40795
|
-
this.lineBreak();
|
|
40796
|
-
} else if (node.nodeType == 1) {
|
|
40797
|
-
this.readRange(node.firstChild, null);
|
|
40798
|
-
}
|
|
40799
|
-
}
|
|
40800
|
-
findPointBefore(node, next) {
|
|
40801
|
-
for (let point of this.points)
|
|
40802
|
-
if (point.node == node && node.childNodes[point.offset] == next)
|
|
40803
|
-
point.pos = this.text.length;
|
|
40804
|
-
}
|
|
40805
|
-
findPointInside(node, length) {
|
|
40806
|
-
for (let point of this.points)
|
|
40807
|
-
if (node.nodeType == 3 ? point.node == node : node.contains(point.node))
|
|
40808
|
-
point.pos = this.text.length + (isAtEnd(node, point.node, point.offset) ? length : 0);
|
|
40809
|
-
}
|
|
40810
|
-
}
|
|
40811
|
-
function isAtEnd(parent, node, offset) {
|
|
40812
|
-
for (; ; ) {
|
|
40813
|
-
if (!node || offset < maxOffset(node))
|
|
40814
|
-
return false;
|
|
40815
|
-
if (node == parent)
|
|
40816
|
-
return true;
|
|
40817
|
-
offset = domIndex(node) + 1;
|
|
40818
|
-
node = node.parentNode;
|
|
40819
|
-
}
|
|
40820
|
-
}
|
|
40821
|
-
class DOMPoint {
|
|
40822
|
-
constructor(node, offset) {
|
|
40823
|
-
this.node = node;
|
|
40824
|
-
this.offset = offset;
|
|
40825
|
-
this.pos = -1;
|
|
40826
|
-
}
|
|
40827
|
-
}
|
|
40828
|
-
class DOMChange {
|
|
40829
|
-
constructor(view, start, end, typeOver) {
|
|
40830
|
-
this.typeOver = typeOver;
|
|
40831
|
-
this.bounds = null;
|
|
40832
|
-
this.text = "";
|
|
40833
|
-
this.domChanged = start > -1;
|
|
40834
|
-
let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView;
|
|
40835
|
-
if (view.state.readOnly && start > -1) {
|
|
40836
|
-
this.newSel = null;
|
|
40837
|
-
} else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
|
|
40838
|
-
let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
|
|
40839
|
-
let reader = new DOMReader(selPoints, view.state);
|
|
40840
|
-
reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
|
|
40841
|
-
this.text = reader.text;
|
|
40842
|
-
this.newSel = selectionFromPoints(selPoints, this.bounds.from);
|
|
40843
|
-
} else {
|
|
40844
|
-
let domSel = view.observer.selectionRange;
|
|
40845
|
-
let head = iHead && iHead.node == domSel.focusNode && iHead.offset == domSel.focusOffset || !contains(view.contentDOM, domSel.focusNode) ? view.state.selection.main.head : view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);
|
|
40846
|
-
let anchor = iAnchor && iAnchor.node == domSel.anchorNode && iAnchor.offset == domSel.anchorOffset || !contains(view.contentDOM, domSel.anchorNode) ? view.state.selection.main.anchor : view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset);
|
|
40847
|
-
let vp = view.viewport;
|
|
40848
|
-
if ((browser.ios || browser.chrome) && view.state.selection.main.empty && head != anchor && (vp.from > 0 || vp.to < view.state.doc.length)) {
|
|
40849
|
-
let from = Math.min(head, anchor), to2 = Math.max(head, anchor);
|
|
40850
|
-
let offFrom = vp.from - from, offTo = vp.to - to2;
|
|
40851
|
-
if ((offFrom == 0 || offFrom == 1 || from == 0) && (offTo == 0 || offTo == -1 || to2 == view.state.doc.length)) {
|
|
40852
|
-
head = 0;
|
|
40853
|
-
anchor = view.state.doc.length;
|
|
40854
|
-
}
|
|
40855
|
-
}
|
|
40856
|
-
this.newSel = EditorSelection.single(anchor, head);
|
|
40857
|
-
}
|
|
40858
|
-
}
|
|
40859
|
-
}
|
|
40860
|
-
function applyDOMChange(view, domChange) {
|
|
40861
|
-
let change;
|
|
40862
|
-
let { newSel } = domChange, sel = view.state.selection.main;
|
|
40863
|
-
let lastKey = view.inputState.lastKeyTime > Date.now() - 100 ? view.inputState.lastKeyCode : -1;
|
|
40864
|
-
if (domChange.bounds) {
|
|
40865
|
-
let { from, to: to2 } = domChange.bounds;
|
|
40866
|
-
let preferredPos = sel.from, preferredSide = null;
|
|
40867
|
-
if (lastKey === 8 || browser.android && domChange.text.length < to2 - from) {
|
|
40868
|
-
preferredPos = sel.to;
|
|
40869
|
-
preferredSide = "end";
|
|
40870
|
-
}
|
|
40871
|
-
let diff = findDiff(view.state.doc.sliceString(from, to2, LineBreakPlaceholder), domChange.text, preferredPos - from, preferredSide);
|
|
40872
|
-
if (diff) {
|
|
40873
|
-
if (browser.chrome && lastKey == 13 && diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
40874
|
-
diff.toB--;
|
|
40875
|
-
change = {
|
|
40876
|
-
from: from + diff.from,
|
|
40877
|
-
to: from + diff.toA,
|
|
40878
|
-
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder))
|
|
40879
|
-
};
|
|
40880
|
-
}
|
|
40881
|
-
} else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
|
40882
|
-
newSel = null;
|
|
40883
|
-
}
|
|
40884
|
-
if (!change && !newSel)
|
|
40885
|
-
return false;
|
|
40886
|
-
if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) {
|
|
40887
|
-
change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) };
|
|
40888
|
-
} else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
|
|
40889
|
-
change = {
|
|
40890
|
-
from: sel.from,
|
|
40891
|
-
to: sel.to,
|
|
40892
|
-
insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
|
|
40893
|
-
};
|
|
40894
|
-
} else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
|
|
40895
|
-
if (newSel && change.insert.length == 2)
|
|
40896
|
-
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
40897
|
-
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
40898
|
-
} else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
|
|
40899
|
-
if (newSel)
|
|
40900
|
-
newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
40901
|
-
change = { from: sel.from, to: sel.to, insert: Text.of([" "]) };
|
|
40902
|
-
}
|
|
40903
|
-
if (change) {
|
|
40904
|
-
return applyDOMChangeInner(view, change, newSel, lastKey);
|
|
40905
|
-
} else if (newSel && !newSel.main.eq(sel)) {
|
|
40906
|
-
let scrollIntoView2 = false, userEvent = "select";
|
|
40907
|
-
if (view.inputState.lastSelectionTime > Date.now() - 50) {
|
|
40908
|
-
if (view.inputState.lastSelectionOrigin == "select")
|
|
40909
|
-
scrollIntoView2 = true;
|
|
40910
|
-
userEvent = view.inputState.lastSelectionOrigin;
|
|
40911
|
-
}
|
|
40912
|
-
view.dispatch({ selection: newSel, scrollIntoView: scrollIntoView2, userEvent });
|
|
40913
|
-
return true;
|
|
40914
|
-
} else {
|
|
40915
|
-
return false;
|
|
40916
|
-
}
|
|
40917
|
-
}
|
|
40918
|
-
function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
40919
|
-
if (browser.ios && view.inputState.flushIOSKey(change))
|
|
40920
|
-
return true;
|
|
40921
|
-
let sel = view.state.selection.main;
|
|
40922
|
-
if (browser.android && (change.to == sel.to && // GBoard will sometimes remove a space it just inserted
|
|
40923
|
-
// after a completion when you press enter
|
|
40924
|
-
(change.from == sel.from || change.from == sel.from - 1 && view.state.sliceDoc(change.from, sel.from) == " ") && change.insert.length == 1 && change.insert.lines == 2 && dispatchKey(view.contentDOM, "Enter", 13) || (change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 || lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) && dispatchKey(view.contentDOM, "Backspace", 8) || change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 && dispatchKey(view.contentDOM, "Delete", 46)))
|
|
40925
|
-
return true;
|
|
40926
|
-
let text = change.insert.toString();
|
|
40927
|
-
if (view.inputState.composing >= 0)
|
|
40928
|
-
view.inputState.composing++;
|
|
40929
|
-
let defaultTr;
|
|
40930
|
-
let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));
|
|
40931
|
-
if (!view.state.facet(inputHandler$1).some((h) => h(view, change.from, change.to, text, defaultInsert)))
|
|
40932
|
-
view.dispatch(defaultInsert());
|
|
40933
|
-
return true;
|
|
40934
|
-
}
|
|
40935
|
-
function applyDefaultInsert(view, change, newSel) {
|
|
40936
|
-
let tr, startState = view.state, sel = startState.selection.main;
|
|
40937
|
-
if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 && (!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) && view.inputState.composing < 0) {
|
|
40938
|
-
let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : "";
|
|
40939
|
-
let after = sel.to > change.to ? startState.sliceDoc(change.to, sel.to) : "";
|
|
40940
|
-
tr = startState.replaceSelection(view.state.toText(before + change.insert.sliceString(0, void 0, view.state.lineBreak) + after));
|
|
40941
|
-
} else {
|
|
40942
|
-
let changes = startState.changes(change);
|
|
40943
|
-
let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : void 0;
|
|
40944
|
-
if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 && change.to <= sel.to && change.to >= sel.to - 10) {
|
|
40945
|
-
let replaced = view.state.sliceDoc(change.from, change.to);
|
|
40946
|
-
let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head);
|
|
40947
|
-
if (composition) {
|
|
40948
|
-
let dLen = change.insert.length - (change.to - change.from);
|
|
40949
|
-
compositionRange = { from: composition.from, to: composition.to - dLen };
|
|
40950
|
-
} else {
|
|
40951
|
-
compositionRange = view.state.doc.lineAt(sel.head);
|
|
40952
|
-
}
|
|
40953
|
-
let offset = sel.to - change.to, size = sel.to - sel.from;
|
|
40954
|
-
tr = startState.changeByRange((range) => {
|
|
40955
|
-
if (range.from == sel.from && range.to == sel.to)
|
|
40956
|
-
return { changes, range: mainSel || range.map(changes) };
|
|
40957
|
-
let to2 = range.to - offset, from = to2 - replaced.length;
|
|
40958
|
-
if (range.to - range.from != size || view.state.sliceDoc(from, to2) != replaced || // Unfortunately, there's no way to make multiple
|
|
40959
|
-
// changes in the same node work without aborting
|
|
40960
|
-
// composition, so cursors in the composition range are
|
|
40961
|
-
// ignored.
|
|
40962
|
-
range.to >= compositionRange.from && range.from <= compositionRange.to)
|
|
40963
|
-
return { range };
|
|
40964
|
-
let rangeChanges = startState.changes({ from, to: to2, insert: change.insert }), selOff = range.to - sel.to;
|
|
40965
|
-
return {
|
|
40966
|
-
changes: rangeChanges,
|
|
40967
|
-
range: !mainSel ? range.map(rangeChanges) : EditorSelection.range(Math.max(0, mainSel.anchor + selOff), Math.max(0, mainSel.head + selOff))
|
|
40968
|
-
};
|
|
40969
|
-
});
|
|
40970
|
-
} else {
|
|
40971
|
-
tr = {
|
|
40972
|
-
changes,
|
|
40973
|
-
selection: mainSel && startState.selection.replaceRange(mainSel)
|
|
40974
|
-
};
|
|
40975
|
-
}
|
|
40976
|
-
}
|
|
40977
|
-
let userEvent = "input.type";
|
|
40978
|
-
if (view.composing || view.inputState.compositionPendingChange && view.inputState.compositionEndedAt > Date.now() - 50) {
|
|
40979
|
-
view.inputState.compositionPendingChange = false;
|
|
40980
|
-
userEvent += ".compose";
|
|
40981
|
-
if (view.inputState.compositionFirstChange) {
|
|
40982
|
-
userEvent += ".start";
|
|
40983
|
-
view.inputState.compositionFirstChange = false;
|
|
40984
|
-
}
|
|
40985
|
-
}
|
|
40986
|
-
return startState.update(tr, { userEvent, scrollIntoView: true });
|
|
40987
|
-
}
|
|
40988
|
-
function findDiff(a, b, preferredPos, preferredSide) {
|
|
40989
|
-
let minLen = Math.min(a.length, b.length);
|
|
40990
|
-
let from = 0;
|
|
40991
|
-
while (from < minLen && a.charCodeAt(from) == b.charCodeAt(from))
|
|
40992
|
-
from++;
|
|
40993
|
-
if (from == minLen && a.length == b.length)
|
|
40994
|
-
return null;
|
|
40995
|
-
let toA = a.length, toB = b.length;
|
|
40996
|
-
while (toA > 0 && toB > 0 && a.charCodeAt(toA - 1) == b.charCodeAt(toB - 1)) {
|
|
40997
|
-
toA--;
|
|
40998
|
-
toB--;
|
|
40999
|
-
}
|
|
41000
|
-
if (preferredSide == "end") {
|
|
41001
|
-
let adjust = Math.max(0, from - Math.min(toA, toB));
|
|
41002
|
-
preferredPos -= toA + adjust - from;
|
|
41003
|
-
}
|
|
41004
|
-
if (toA < from && a.length < b.length) {
|
|
41005
|
-
let move = preferredPos <= from && preferredPos >= toA ? from - preferredPos : 0;
|
|
41006
|
-
from -= move;
|
|
41007
|
-
toB = from + (toB - toA);
|
|
41008
|
-
toA = from;
|
|
41009
|
-
} else if (toB < from) {
|
|
41010
|
-
let move = preferredPos <= from && preferredPos >= toB ? from - preferredPos : 0;
|
|
41011
|
-
from -= move;
|
|
41012
|
-
toA = from + (toA - toB);
|
|
41013
|
-
toB = from;
|
|
41014
|
-
}
|
|
41015
|
-
return { from, toA, toB };
|
|
41016
|
-
}
|
|
41017
|
-
function selectionPoints(view) {
|
|
41018
|
-
let result = [];
|
|
41019
|
-
if (view.root.activeElement != view.contentDOM)
|
|
41020
|
-
return result;
|
|
41021
|
-
let { anchorNode, anchorOffset, focusNode, focusOffset } = view.observer.selectionRange;
|
|
41022
|
-
if (anchorNode) {
|
|
41023
|
-
result.push(new DOMPoint(anchorNode, anchorOffset));
|
|
41024
|
-
if (focusNode != anchorNode || focusOffset != anchorOffset)
|
|
41025
|
-
result.push(new DOMPoint(focusNode, focusOffset));
|
|
41026
|
-
}
|
|
41027
|
-
return result;
|
|
41028
|
-
}
|
|
41029
|
-
function selectionFromPoints(points, base2) {
|
|
41030
|
-
if (points.length == 0)
|
|
41031
|
-
return null;
|
|
41032
|
-
let anchor = points[0].pos, head = points.length == 2 ? points[1].pos : anchor;
|
|
41033
|
-
return anchor > -1 && head > -1 ? EditorSelection.single(anchor + base2, head + base2) : null;
|
|
41034
|
-
}
|
|
41035
41063
|
const observeOptions = {
|
|
41036
41064
|
childList: true,
|
|
41037
41065
|
characterData: true,
|
|
@@ -41070,7 +41098,8 @@ class DOMObserver {
|
|
|
41070
41098
|
else
|
|
41071
41099
|
this.flush();
|
|
41072
41100
|
});
|
|
41073
|
-
if (window.EditContext && view.constructor.EDIT_CONTEXT
|
|
41101
|
+
if (window.EditContext && view.constructor.EDIT_CONTEXT !== false && // Chrome <126 doesn't support inverted selections in edit context (#1392)
|
|
41102
|
+
!(browser.chrome && browser.chrome_version < 126)) {
|
|
41074
41103
|
this.editContext = new EditContextManager(view);
|
|
41075
41104
|
if (view.state.facet(editable))
|
|
41076
41105
|
view.contentDOM.editContext = this.editContext.editContext;
|
|
@@ -41139,7 +41168,7 @@ class DOMObserver {
|
|
|
41139
41168
|
}, 50);
|
|
41140
41169
|
}
|
|
41141
41170
|
onPrint(event) {
|
|
41142
|
-
if (event.type == "change" && !event.matches)
|
|
41171
|
+
if ((event.type == "change" || !event.type) && !event.matches)
|
|
41143
41172
|
return;
|
|
41144
41173
|
this.view.viewState.printing = true;
|
|
41145
41174
|
this.view.measure();
|
|
@@ -41400,9 +41429,12 @@ class DOMObserver {
|
|
|
41400
41429
|
}
|
|
41401
41430
|
addWindowListeners(win) {
|
|
41402
41431
|
win.addEventListener("resize", this.onResize);
|
|
41403
|
-
if (this.printQuery)
|
|
41404
|
-
this.printQuery.addEventListener
|
|
41405
|
-
|
|
41432
|
+
if (this.printQuery) {
|
|
41433
|
+
if (this.printQuery.addEventListener)
|
|
41434
|
+
this.printQuery.addEventListener("change", this.onPrint);
|
|
41435
|
+
else
|
|
41436
|
+
this.printQuery.addListener(this.onPrint);
|
|
41437
|
+
} else
|
|
41406
41438
|
win.addEventListener("beforeprint", this.onPrint);
|
|
41407
41439
|
win.addEventListener("scroll", this.onScroll);
|
|
41408
41440
|
win.document.addEventListener("selectionchange", this.onSelectionChange);
|
|
@@ -41410,9 +41442,12 @@ class DOMObserver {
|
|
|
41410
41442
|
removeWindowListeners(win) {
|
|
41411
41443
|
win.removeEventListener("scroll", this.onScroll);
|
|
41412
41444
|
win.removeEventListener("resize", this.onResize);
|
|
41413
|
-
if (this.printQuery)
|
|
41414
|
-
this.printQuery.removeEventListener
|
|
41415
|
-
|
|
41445
|
+
if (this.printQuery) {
|
|
41446
|
+
if (this.printQuery.removeEventListener)
|
|
41447
|
+
this.printQuery.removeEventListener("change", this.onPrint);
|
|
41448
|
+
else
|
|
41449
|
+
this.printQuery.removeListener(this.onPrint);
|
|
41450
|
+
} else
|
|
41416
41451
|
win.removeEventListener("beforeprint", this.onPrint);
|
|
41417
41452
|
win.document.removeEventListener("selectionchange", this.onSelectionChange);
|
|
41418
41453
|
}
|
|
@@ -41436,6 +41471,10 @@ class DOMObserver {
|
|
|
41436
41471
|
clearTimeout(this.resizeTimeout);
|
|
41437
41472
|
this.win.cancelAnimationFrame(this.delayedFlush);
|
|
41438
41473
|
this.win.cancelAnimationFrame(this.flushingAndroidKey);
|
|
41474
|
+
if (this.editContext) {
|
|
41475
|
+
this.view.contentDOM.editContext = null;
|
|
41476
|
+
this.editContext.destroy();
|
|
41477
|
+
}
|
|
41439
41478
|
}
|
|
41440
41479
|
}
|
|
41441
41480
|
function findChild(cView, dom, dir) {
|
|
@@ -41478,13 +41517,14 @@ class EditContextManager {
|
|
|
41478
41517
|
this.from = 0;
|
|
41479
41518
|
this.to = 0;
|
|
41480
41519
|
this.pendingContextChange = null;
|
|
41520
|
+
this.handlers = /* @__PURE__ */ Object.create(null);
|
|
41481
41521
|
this.resetRange(view.state);
|
|
41482
41522
|
let context = this.editContext = new window.EditContext({
|
|
41483
41523
|
text: view.state.doc.sliceString(this.from, this.to),
|
|
41484
41524
|
selectionStart: this.toContextPos(Math.max(this.from, Math.min(this.to, view.state.selection.main.anchor))),
|
|
41485
41525
|
selectionEnd: this.toContextPos(view.state.selection.main.head)
|
|
41486
41526
|
});
|
|
41487
|
-
|
|
41527
|
+
this.handlers.textupdate = (e2) => {
|
|
41488
41528
|
let { anchor } = view.state.selection.main;
|
|
41489
41529
|
let change = {
|
|
41490
41530
|
from: this.toEditorPos(e2.updateRangeStart),
|
|
@@ -41498,20 +41538,23 @@ class EditContextManager {
|
|
|
41498
41538
|
if (change.from == change.to && !change.insert.length)
|
|
41499
41539
|
return;
|
|
41500
41540
|
this.pendingContextChange = change;
|
|
41501
|
-
|
|
41502
|
-
|
|
41541
|
+
if (!view.state.readOnly)
|
|
41542
|
+
applyDOMChangeInner(view, change, EditorSelection.single(this.toEditorPos(e2.selectionStart), this.toEditorPos(e2.selectionEnd)));
|
|
41543
|
+
if (this.pendingContextChange) {
|
|
41503
41544
|
this.revertPending(view.state);
|
|
41504
|
-
|
|
41505
|
-
|
|
41545
|
+
this.setSelection(view.state);
|
|
41546
|
+
}
|
|
41547
|
+
};
|
|
41548
|
+
this.handlers.characterboundsupdate = (e2) => {
|
|
41506
41549
|
let rects = [], prev = null;
|
|
41507
41550
|
for (let i = this.toEditorPos(e2.rangeStart), end = this.toEditorPos(e2.rangeEnd); i < end; i++) {
|
|
41508
41551
|
let rect = view.coordsForChar(i);
|
|
41509
|
-
prev = rect && new DOMRect(rect.left, rect.
|
|
41552
|
+
prev = rect && new DOMRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top) || prev || new DOMRect();
|
|
41510
41553
|
rects.push(prev);
|
|
41511
41554
|
}
|
|
41512
41555
|
context.updateCharacterBounds(e2.rangeStart, rects);
|
|
41513
|
-
}
|
|
41514
|
-
|
|
41556
|
+
};
|
|
41557
|
+
this.handlers.textformatupdate = (e2) => {
|
|
41515
41558
|
let deco = [];
|
|
41516
41559
|
for (let format of e2.getTextFormats()) {
|
|
41517
41560
|
let lineStyle = format.underlineStyle, thickness = format.underlineThickness;
|
|
@@ -41521,17 +41564,19 @@ class EditContextManager {
|
|
|
41521
41564
|
}
|
|
41522
41565
|
}
|
|
41523
41566
|
view.dispatch({ effects: setEditContextFormatting.of(Decoration.set(deco)) });
|
|
41524
|
-
}
|
|
41525
|
-
|
|
41567
|
+
};
|
|
41568
|
+
this.handlers.compositionstart = () => {
|
|
41526
41569
|
if (view.inputState.composing < 0) {
|
|
41527
41570
|
view.inputState.composing = 0;
|
|
41528
41571
|
view.inputState.compositionFirstChange = true;
|
|
41529
41572
|
}
|
|
41530
|
-
}
|
|
41531
|
-
|
|
41573
|
+
};
|
|
41574
|
+
this.handlers.compositionend = () => {
|
|
41532
41575
|
view.inputState.composing = -1;
|
|
41533
41576
|
view.inputState.compositionFirstChange = null;
|
|
41534
|
-
}
|
|
41577
|
+
};
|
|
41578
|
+
for (let event in this.handlers)
|
|
41579
|
+
context.addEventListener(event, this.handlers[event]);
|
|
41535
41580
|
this.measureReq = { read: (view2) => {
|
|
41536
41581
|
this.editContext.updateControlBounds(view2.contentDOM.getBoundingClientRect());
|
|
41537
41582
|
let sel = getSelection(view2.root);
|
|
@@ -41549,6 +41594,7 @@ class EditContextManager {
|
|
|
41549
41594
|
if (pending.from == fromA && pending.to == toA && pending.insert.eq(insert2)) {
|
|
41550
41595
|
pending = this.pendingContextChange = null;
|
|
41551
41596
|
off += dLen;
|
|
41597
|
+
this.to += dLen;
|
|
41552
41598
|
return;
|
|
41553
41599
|
} else {
|
|
41554
41600
|
pending = null;
|
|
@@ -41575,12 +41621,13 @@ class EditContextManager {
|
|
|
41575
41621
|
return !abort;
|
|
41576
41622
|
}
|
|
41577
41623
|
update(update) {
|
|
41624
|
+
let reverted = this.pendingContextChange;
|
|
41578
41625
|
if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
|
|
41579
41626
|
this.pendingContextChange = null;
|
|
41580
41627
|
this.resetRange(update.state);
|
|
41581
41628
|
this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
|
|
41582
41629
|
this.setSelection(update.state);
|
|
41583
|
-
} else if (update.docChanged || update.selectionSet) {
|
|
41630
|
+
} else if (update.docChanged || update.selectionSet || reverted) {
|
|
41584
41631
|
this.setSelection(update.state);
|
|
41585
41632
|
}
|
|
41586
41633
|
if (update.geometryChanged || update.docChanged || update.selectionSet)
|
|
@@ -41602,7 +41649,7 @@ class EditContextManager {
|
|
|
41602
41649
|
revertPending(state) {
|
|
41603
41650
|
let pending = this.pendingContextChange;
|
|
41604
41651
|
this.pendingContextChange = null;
|
|
41605
|
-
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.
|
|
41652
|
+
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.from + pending.insert.length), state.doc.sliceString(pending.from, pending.to));
|
|
41606
41653
|
}
|
|
41607
41654
|
setSelection(state) {
|
|
41608
41655
|
let { main } = state.selection;
|
|
@@ -41621,6 +41668,10 @@ class EditContextManager {
|
|
|
41621
41668
|
toContextPos(editorPos) {
|
|
41622
41669
|
return editorPos - this.from;
|
|
41623
41670
|
}
|
|
41671
|
+
destroy() {
|
|
41672
|
+
for (let event in this.handlers)
|
|
41673
|
+
this.editContext.removeEventListener(event, this.handlers[event]);
|
|
41674
|
+
}
|
|
41624
41675
|
}
|
|
41625
41676
|
class EditorView {
|
|
41626
41677
|
/**
|
|
@@ -41692,6 +41743,7 @@ class EditorView {
|
|
|
41692
41743
|
view, so that the user can see the editor.
|
|
41693
41744
|
*/
|
|
41694
41745
|
constructor(config2 = {}) {
|
|
41746
|
+
var _a2;
|
|
41695
41747
|
this.plugins = [];
|
|
41696
41748
|
this.pluginMap = /* @__PURE__ */ new Map();
|
|
41697
41749
|
this.editorAttrs = {};
|
|
@@ -41732,6 +41784,8 @@ class EditorView {
|
|
|
41732
41784
|
this.updateAttrs();
|
|
41733
41785
|
this.updateState = 0;
|
|
41734
41786
|
this.requestMeasure();
|
|
41787
|
+
if ((_a2 = document.fonts) === null || _a2 === void 0 ? void 0 : _a2.ready)
|
|
41788
|
+
document.fonts.ready.then(() => this.requestMeasure());
|
|
41735
41789
|
}
|
|
41736
41790
|
dispatch(...input) {
|
|
41737
41791
|
let trs = input.length == 1 && input[0] instanceof Transaction ? input : input.length == 1 && Array.isArray(input[0]) ? input[0] : [this.state.update(...input)];
|
|
@@ -42172,7 +42226,7 @@ class EditorView {
|
|
|
42172
42226
|
/**
|
|
42173
42227
|
Find the line block around the given document position. A line
|
|
42174
42228
|
block is a range delimited on both sides by either a
|
|
42175
|
-
non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line
|
|
42229
|
+
non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line break, or the
|
|
42176
42230
|
start/end of the document. It will usually just hold a line of
|
|
42177
42231
|
text, but may be broken into multiple textblocks by block
|
|
42178
42232
|
widgets.
|
|
@@ -43012,7 +43066,7 @@ class LayerView {
|
|
|
43012
43066
|
const layerOrder = /* @__PURE__ */ Facet.define();
|
|
43013
43067
|
function layer(config2) {
|
|
43014
43068
|
return [
|
|
43015
|
-
ViewPlugin.define((
|
|
43069
|
+
ViewPlugin.define((v2) => new LayerView(v2, config2)),
|
|
43016
43070
|
layerOrder.of(config2)
|
|
43017
43071
|
];
|
|
43018
43072
|
}
|
|
@@ -43390,7 +43444,7 @@ function specialCharPlugin() {
|
|
|
43390
43444
|
}
|
|
43391
43445
|
}
|
|
43392
43446
|
}, {
|
|
43393
|
-
decorations: (
|
|
43447
|
+
decorations: (v2) => v2.decorations
|
|
43394
43448
|
}));
|
|
43395
43449
|
}
|
|
43396
43450
|
const DefaultPlaceholder = "•";
|
|
@@ -43470,7 +43524,7 @@ const activeLineHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
43470
43524
|
return Decoration.set(deco);
|
|
43471
43525
|
}
|
|
43472
43526
|
}, {
|
|
43473
|
-
decorations: (
|
|
43527
|
+
decorations: (v2) => v2.decorations
|
|
43474
43528
|
});
|
|
43475
43529
|
class Placeholder extends WidgetType {
|
|
43476
43530
|
constructor(content2) {
|
|
@@ -43512,7 +43566,7 @@ function placeholder(content2) {
|
|
|
43512
43566
|
get decorations() {
|
|
43513
43567
|
return this.view.state.doc.length ? Decoration.none : this.placeholder;
|
|
43514
43568
|
}
|
|
43515
|
-
}, { decorations: (
|
|
43569
|
+
}, { decorations: (v2) => v2.decorations });
|
|
43516
43570
|
}
|
|
43517
43571
|
const MaxOff = 2e3;
|
|
43518
43572
|
function rectangleFor(state, a, b) {
|
|
@@ -43867,7 +43921,7 @@ const tooltipPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
43867
43921
|
let arrowHeight = arrow ? 7 : 0;
|
|
43868
43922
|
let width = size.right - size.left, height = (_a2 = knownHeight.get(tView)) !== null && _a2 !== void 0 ? _a2 : size.bottom - size.top;
|
|
43869
43923
|
let offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR;
|
|
43870
|
-
let left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.min(pos.left - (arrow ? 14 : 0) + offset.x, space.right - width) : Math.max(space.left, pos.left - width + (arrow ? 14 : 0) - offset.x);
|
|
43924
|
+
let left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.max(space.left, Math.min(pos.left - (arrow ? 14 : 0) + offset.x, space.right - width)) : Math.min(Math.max(space.left, pos.left - width + (arrow ? 14 : 0) - offset.x), space.right - width);
|
|
43871
43925
|
let above = this.above[i];
|
|
43872
43926
|
if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset.y < space.top : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top)
|
|
43873
43927
|
above = this.above[i] = !above;
|
|
@@ -44217,7 +44271,7 @@ function hoverTooltip(source, options = {}) {
|
|
|
44217
44271
|
if (options.hideOnChange && (tr.docChanged || tr.selection))
|
|
44218
44272
|
value = [];
|
|
44219
44273
|
else if (options.hideOn)
|
|
44220
|
-
value = value.filter((
|
|
44274
|
+
value = value.filter((v2) => !options.hideOn(tr, v2));
|
|
44221
44275
|
if (tr.docChanged) {
|
|
44222
44276
|
let mapped = [];
|
|
44223
44277
|
for (let tooltip of value) {
|
|
@@ -44243,18 +44297,21 @@ function hoverTooltip(source, options = {}) {
|
|
|
44243
44297
|
},
|
|
44244
44298
|
provide: (f) => showHoverTooltip.from(f)
|
|
44245
44299
|
});
|
|
44246
|
-
return
|
|
44247
|
-
hoverState,
|
|
44248
|
-
|
|
44249
|
-
view,
|
|
44250
|
-
source,
|
|
44300
|
+
return {
|
|
44301
|
+
active: hoverState,
|
|
44302
|
+
extension: [
|
|
44251
44303
|
hoverState,
|
|
44252
|
-
|
|
44253
|
-
|
|
44254
|
-
|
|
44255
|
-
|
|
44256
|
-
|
|
44257
|
-
|
|
44304
|
+
ViewPlugin.define((view) => new HoverPlugin(
|
|
44305
|
+
view,
|
|
44306
|
+
source,
|
|
44307
|
+
hoverState,
|
|
44308
|
+
setHover,
|
|
44309
|
+
options.hoverTime || 300
|
|
44310
|
+
/* Hover.Time */
|
|
44311
|
+
)),
|
|
44312
|
+
showHoverTooltipHost
|
|
44313
|
+
]
|
|
44314
|
+
};
|
|
44258
44315
|
}
|
|
44259
44316
|
function getTooltip(view, tooltip) {
|
|
44260
44317
|
let plugin = view.plugin(tooltipPlugin);
|
|
@@ -44442,6 +44499,7 @@ GutterMarker.prototype.mapMode = MapMode.TrackBefore;
|
|
|
44442
44499
|
GutterMarker.prototype.startSide = GutterMarker.prototype.endSide = -1;
|
|
44443
44500
|
GutterMarker.prototype.point = true;
|
|
44444
44501
|
const gutterLineClass = /* @__PURE__ */ Facet.define();
|
|
44502
|
+
const gutterWidgetClass = /* @__PURE__ */ Facet.define();
|
|
44445
44503
|
const defaults$2 = {
|
|
44446
44504
|
class: "",
|
|
44447
44505
|
renderEmptyElements: false,
|
|
@@ -44623,9 +44681,14 @@ class UpdateContext {
|
|
|
44623
44681
|
this.addElement(view, line, localMarkers);
|
|
44624
44682
|
}
|
|
44625
44683
|
widget(view, block) {
|
|
44626
|
-
let marker = this.gutter.config.widgetMarker(view, block.widget, block);
|
|
44627
|
-
|
|
44628
|
-
|
|
44684
|
+
let marker = this.gutter.config.widgetMarker(view, block.widget, block), markers = marker ? [marker] : null;
|
|
44685
|
+
for (let cls of view.state.facet(gutterWidgetClass)) {
|
|
44686
|
+
let marker2 = cls(view, block.widget, block);
|
|
44687
|
+
if (marker2)
|
|
44688
|
+
(markers || (markers = [])).push(marker2);
|
|
44689
|
+
}
|
|
44690
|
+
if (markers)
|
|
44691
|
+
this.addElement(view, block, markers);
|
|
44629
44692
|
}
|
|
44630
44693
|
finish() {
|
|
44631
44694
|
let gutter2 = this.gutter;
|
|
@@ -44755,6 +44818,7 @@ function sameMarkers(a, b) {
|
|
|
44755
44818
|
return true;
|
|
44756
44819
|
}
|
|
44757
44820
|
const lineNumberMarkers = /* @__PURE__ */ Facet.define();
|
|
44821
|
+
const lineNumberWidgetMarker = /* @__PURE__ */ Facet.define();
|
|
44758
44822
|
const lineNumberConfig = /* @__PURE__ */ Facet.define({
|
|
44759
44823
|
combine(values) {
|
|
44760
44824
|
return combineConfig(values, { formatNumber: String, domEventHandlers: {} }, {
|
|
@@ -44795,7 +44859,14 @@ const lineNumberGutter = /* @__PURE__ */ activeGutters.compute([lineNumberConfig
|
|
|
44795
44859
|
return null;
|
|
44796
44860
|
return new NumberMarker(formatNumber(view, view.state.doc.lineAt(line.from).number));
|
|
44797
44861
|
},
|
|
44798
|
-
widgetMarker: () =>
|
|
44862
|
+
widgetMarker: (view, widget, block) => {
|
|
44863
|
+
for (let m2 of view.state.facet(lineNumberWidgetMarker)) {
|
|
44864
|
+
let result = m2(view, widget, block);
|
|
44865
|
+
if (result)
|
|
44866
|
+
return result;
|
|
44867
|
+
}
|
|
44868
|
+
return null;
|
|
44869
|
+
},
|
|
44799
44870
|
lineMarkerChange: (update) => update.startState.facet(lineNumberConfig) != update.state.facet(lineNumberConfig),
|
|
44800
44871
|
initialSpacer(view) {
|
|
44801
44872
|
return new NumberMarker(formatNumber(view, maxLineNumber(view.state.doc.lines)));
|
|
@@ -46453,23 +46524,27 @@ class Tag {
|
|
|
46453
46524
|
/**
|
|
46454
46525
|
@internal
|
|
46455
46526
|
*/
|
|
46456
|
-
constructor(set, base2, modified) {
|
|
46527
|
+
constructor(name2, set, base2, modified) {
|
|
46528
|
+
this.name = name2;
|
|
46457
46529
|
this.set = set;
|
|
46458
46530
|
this.base = base2;
|
|
46459
46531
|
this.modified = modified;
|
|
46460
46532
|
this.id = nextTagID++;
|
|
46461
46533
|
}
|
|
46462
|
-
|
|
46463
|
-
|
|
46464
|
-
|
|
46465
|
-
|
|
46466
|
-
|
|
46467
|
-
|
|
46468
|
-
|
|
46469
|
-
static define(parent) {
|
|
46534
|
+
toString() {
|
|
46535
|
+
let { name: name2 } = this;
|
|
46536
|
+
for (let mod of this.modified)
|
|
46537
|
+
if (mod.name)
|
|
46538
|
+
name2 = `${mod.name}(${name2})`;
|
|
46539
|
+
return name2;
|
|
46540
|
+
}
|
|
46541
|
+
static define(nameOrParent, parent) {
|
|
46542
|
+
let name2 = typeof nameOrParent == "string" ? nameOrParent : "?";
|
|
46543
|
+
if (nameOrParent instanceof Tag)
|
|
46544
|
+
parent = nameOrParent;
|
|
46470
46545
|
if (parent === null || parent === void 0 ? void 0 : parent.base)
|
|
46471
46546
|
throw new Error("Can not derive from a modified tag");
|
|
46472
|
-
let tag = new Tag([], null, []);
|
|
46547
|
+
let tag = new Tag(name2, [], null, []);
|
|
46473
46548
|
tag.set.push(tag);
|
|
46474
46549
|
if (parent)
|
|
46475
46550
|
for (let t2 of parent.set)
|
|
@@ -46488,8 +46563,8 @@ class Tag {
|
|
|
46488
46563
|
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
46489
46564
|
`m1(m3(t1)`, and so on.
|
|
46490
46565
|
*/
|
|
46491
|
-
static defineModifier() {
|
|
46492
|
-
let mod = new Modifier();
|
|
46566
|
+
static defineModifier(name2) {
|
|
46567
|
+
let mod = new Modifier(name2);
|
|
46493
46568
|
return (tag) => {
|
|
46494
46569
|
if (tag.modified.indexOf(mod) > -1)
|
|
46495
46570
|
return tag;
|
|
@@ -46499,7 +46574,8 @@ class Tag {
|
|
|
46499
46574
|
}
|
|
46500
46575
|
let nextModifierID = 0;
|
|
46501
46576
|
class Modifier {
|
|
46502
|
-
constructor() {
|
|
46577
|
+
constructor(name2) {
|
|
46578
|
+
this.name = name2;
|
|
46503
46579
|
this.instances = [];
|
|
46504
46580
|
this.id = nextModifierID++;
|
|
46505
46581
|
}
|
|
@@ -46509,7 +46585,7 @@ class Modifier {
|
|
|
46509
46585
|
let exists = mods[0].instances.find((t2) => t2.base == base2 && sameArray(mods, t2.modified));
|
|
46510
46586
|
if (exists)
|
|
46511
46587
|
return exists;
|
|
46512
|
-
let set = [], tag = new Tag(set, base2, mods);
|
|
46588
|
+
let set = [], tag = new Tag(base2.name, set, base2, mods);
|
|
46513
46589
|
for (let m2 of mods)
|
|
46514
46590
|
m2.instances.push(tag);
|
|
46515
46591
|
let configs = powerSet(mods);
|
|
@@ -46985,7 +47061,7 @@ const tags = {
|
|
|
46985
47061
|
*/
|
|
46986
47062
|
heading6: t(heading),
|
|
46987
47063
|
/**
|
|
46988
|
-
A prose separator (such as a horizontal rule).
|
|
47064
|
+
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
|
|
46989
47065
|
*/
|
|
46990
47066
|
contentSeparator: t(content),
|
|
46991
47067
|
/**
|
|
@@ -47058,31 +47134,31 @@ const tags = {
|
|
|
47058
47134
|
given element is being defined. Expected to be used with the
|
|
47059
47135
|
various [name](#highlight.tags.name) tags.
|
|
47060
47136
|
*/
|
|
47061
|
-
definition: Tag.defineModifier(),
|
|
47137
|
+
definition: Tag.defineModifier("definition"),
|
|
47062
47138
|
/**
|
|
47063
47139
|
[Modifier](#highlight.Tag^defineModifier) that indicates that
|
|
47064
47140
|
something is constant. Mostly expected to be used with
|
|
47065
47141
|
[variable names](#highlight.tags.variableName).
|
|
47066
47142
|
*/
|
|
47067
|
-
constant: Tag.defineModifier(),
|
|
47143
|
+
constant: Tag.defineModifier("constant"),
|
|
47068
47144
|
/**
|
|
47069
47145
|
[Modifier](#highlight.Tag^defineModifier) used to indicate that
|
|
47070
47146
|
a [variable](#highlight.tags.variableName) or [property
|
|
47071
47147
|
name](#highlight.tags.propertyName) is being called or defined
|
|
47072
47148
|
as a function.
|
|
47073
47149
|
*/
|
|
47074
|
-
function: Tag.defineModifier(),
|
|
47150
|
+
function: Tag.defineModifier("function"),
|
|
47075
47151
|
/**
|
|
47076
47152
|
[Modifier](#highlight.Tag^defineModifier) that can be applied to
|
|
47077
47153
|
[names](#highlight.tags.name) to indicate that they belong to
|
|
47078
47154
|
the language's standard environment.
|
|
47079
47155
|
*/
|
|
47080
|
-
standard: Tag.defineModifier(),
|
|
47156
|
+
standard: Tag.defineModifier("standard"),
|
|
47081
47157
|
/**
|
|
47082
47158
|
[Modifier](#highlight.Tag^defineModifier) that indicates a given
|
|
47083
47159
|
[names](#highlight.tags.name) is local to some scope.
|
|
47084
47160
|
*/
|
|
47085
|
-
local: Tag.defineModifier(),
|
|
47161
|
+
local: Tag.defineModifier("local"),
|
|
47086
47162
|
/**
|
|
47087
47163
|
A generic variant [modifier](#highlight.Tag^defineModifier) that
|
|
47088
47164
|
can be used to tag language-specific alternative variants of
|
|
@@ -47091,8 +47167,13 @@ const tags = {
|
|
|
47091
47167
|
[variable name](#highlight.tags.variableName) tags, since those
|
|
47092
47168
|
come up a lot.
|
|
47093
47169
|
*/
|
|
47094
|
-
special: Tag.defineModifier()
|
|
47170
|
+
special: Tag.defineModifier("special")
|
|
47095
47171
|
};
|
|
47172
|
+
for (let name2 in tags) {
|
|
47173
|
+
let val = tags[name2];
|
|
47174
|
+
if (val instanceof Tag)
|
|
47175
|
+
val.name = name2;
|
|
47176
|
+
}
|
|
47096
47177
|
tagHighlighter([
|
|
47097
47178
|
{ tag: tags.link, class: "tok-link" },
|
|
47098
47179
|
{ tag: tags.heading, class: "tok-heading" },
|
|
@@ -48367,7 +48448,7 @@ class TreeHighlighter {
|
|
|
48367
48448
|
}
|
|
48368
48449
|
}
|
|
48369
48450
|
const treeHighlighter = /* @__PURE__ */ Prec.high(/* @__PURE__ */ ViewPlugin.fromClass(TreeHighlighter, {
|
|
48370
|
-
decorations: (
|
|
48451
|
+
decorations: (v2) => v2.decorations
|
|
48371
48452
|
}));
|
|
48372
48453
|
const defaultHighlightStyle = /* @__PURE__ */ HighlightStyle.define([
|
|
48373
48454
|
{
|
|
@@ -50144,7 +50225,7 @@ const matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
50144
50225
|
return Decoration.set(deco);
|
|
50145
50226
|
}
|
|
50146
50227
|
}, {
|
|
50147
|
-
decorations: (
|
|
50228
|
+
decorations: (v2) => v2.decorations
|
|
50148
50229
|
});
|
|
50149
50230
|
const defaultTheme = /* @__PURE__ */ EditorView.baseTheme({
|
|
50150
50231
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
@@ -50429,7 +50510,7 @@ const searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
50429
50510
|
return builder.finish();
|
|
50430
50511
|
}
|
|
50431
50512
|
}, {
|
|
50432
|
-
decorations: (
|
|
50513
|
+
decorations: (v2) => v2.decorations
|
|
50433
50514
|
});
|
|
50434
50515
|
function searchCommand(f) {
|
|
50435
50516
|
return (view) => {
|
|
@@ -50794,11 +50875,13 @@ class CompletionContext {
|
|
|
50794
50875
|
completion sources—in the editor, the extension will create
|
|
50795
50876
|
these for you.)
|
|
50796
50877
|
*/
|
|
50797
|
-
constructor(state, pos, explicit) {
|
|
50878
|
+
constructor(state, pos, explicit, view) {
|
|
50798
50879
|
this.state = state;
|
|
50799
50880
|
this.pos = pos;
|
|
50800
50881
|
this.explicit = explicit;
|
|
50882
|
+
this.view = view;
|
|
50801
50883
|
this.abortListeners = [];
|
|
50884
|
+
this.abortOnDocChange = false;
|
|
50802
50885
|
}
|
|
50803
50886
|
/**
|
|
50804
50887
|
Get the extent, content, and (if there is a token) type of the
|
|
@@ -50837,10 +50920,21 @@ class CompletionContext {
|
|
|
50837
50920
|
Allows you to register abort handlers, which will be called when
|
|
50838
50921
|
the query is
|
|
50839
50922
|
[aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
|
|
50840
|
-
|
|
50841
|
-
|
|
50842
|
-
|
|
50923
|
+
|
|
50924
|
+
By default, running queries will not be aborted for regular
|
|
50925
|
+
typing or backspacing, on the assumption that they are likely to
|
|
50926
|
+
return a result with a
|
|
50927
|
+
[`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) field that
|
|
50928
|
+
allows the result to be used after all. Passing `onDocChange:
|
|
50929
|
+
true` will cause this query to be aborted for any document
|
|
50930
|
+
change.
|
|
50931
|
+
*/
|
|
50932
|
+
addEventListener(type, listener, options) {
|
|
50933
|
+
if (type == "abort" && this.abortListeners) {
|
|
50843
50934
|
this.abortListeners.push(listener);
|
|
50935
|
+
if (options && options.onDocChange)
|
|
50936
|
+
this.abortOnDocChange = true;
|
|
50937
|
+
}
|
|
50844
50938
|
}
|
|
50845
50939
|
}
|
|
50846
50940
|
function toSet(chars) {
|
|
@@ -51607,13 +51701,14 @@ function makeAttrs(id, selected) {
|
|
|
51607
51701
|
return result;
|
|
51608
51702
|
}
|
|
51609
51703
|
const none = [];
|
|
51610
|
-
function
|
|
51704
|
+
function getUpdateType(tr, conf) {
|
|
51611
51705
|
if (tr.isUserEvent("input.complete")) {
|
|
51612
51706
|
let completion = tr.annotation(pickedCompletion);
|
|
51613
51707
|
if (completion && conf.activateOnCompletion(completion))
|
|
51614
|
-
return
|
|
51708
|
+
return 4 | 8;
|
|
51615
51709
|
}
|
|
51616
|
-
|
|
51710
|
+
let typing = tr.isUserEvent("input.type");
|
|
51711
|
+
return typing && conf.activateOnTyping ? 4 | 1 : typing ? 1 : tr.isUserEvent("delete.backward") ? 2 : tr.selection ? 8 : tr.docChanged ? 16 : 0;
|
|
51617
51712
|
}
|
|
51618
51713
|
class ActiveSource {
|
|
51619
51714
|
constructor(source, state, explicitPos = -1) {
|
|
@@ -51625,17 +51720,20 @@ class ActiveSource {
|
|
|
51625
51720
|
return false;
|
|
51626
51721
|
}
|
|
51627
51722
|
update(tr, conf) {
|
|
51628
|
-
let
|
|
51629
|
-
if (
|
|
51630
|
-
value = value.handleUserEvent(tr, event, conf);
|
|
51631
|
-
else if (tr.docChanged)
|
|
51632
|
-
value = value.handleChange(tr);
|
|
51633
|
-
else if (tr.selection && value.state != 0)
|
|
51723
|
+
let type = getUpdateType(tr, conf), value = this;
|
|
51724
|
+
if (type & 8 || type & 16 && this.touches(tr))
|
|
51634
51725
|
value = new ActiveSource(
|
|
51635
51726
|
value.source,
|
|
51636
51727
|
0
|
|
51637
51728
|
/* State.Inactive */
|
|
51638
51729
|
);
|
|
51730
|
+
if (type & 4 && value.state == 0)
|
|
51731
|
+
value = new ActiveSource(
|
|
51732
|
+
this.source,
|
|
51733
|
+
1
|
|
51734
|
+
/* State.Pending */
|
|
51735
|
+
);
|
|
51736
|
+
value = value.updateFor(tr, type);
|
|
51639
51737
|
for (let effect of tr.effects) {
|
|
51640
51738
|
if (effect.is(startCompletionEffect))
|
|
51641
51739
|
value = new ActiveSource(value.source, 1, effect.value ? cur(tr.state) : -1);
|
|
@@ -51653,23 +51751,15 @@ class ActiveSource {
|
|
|
51653
51751
|
}
|
|
51654
51752
|
return value;
|
|
51655
51753
|
}
|
|
51656
|
-
|
|
51657
|
-
return
|
|
51658
|
-
this.source,
|
|
51659
|
-
1
|
|
51660
|
-
/* State.Pending */
|
|
51661
|
-
);
|
|
51662
|
-
}
|
|
51663
|
-
handleChange(tr) {
|
|
51664
|
-
return tr.changes.touchesRange(cur(tr.startState)) ? new ActiveSource(
|
|
51665
|
-
this.source,
|
|
51666
|
-
0
|
|
51667
|
-
/* State.Inactive */
|
|
51668
|
-
) : this.map(tr.changes);
|
|
51754
|
+
updateFor(tr, type) {
|
|
51755
|
+
return this.map(tr.changes);
|
|
51669
51756
|
}
|
|
51670
51757
|
map(changes) {
|
|
51671
51758
|
return changes.empty || this.explicitPos < 0 ? this : new ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));
|
|
51672
51759
|
}
|
|
51760
|
+
touches(tr) {
|
|
51761
|
+
return tr.changes.touchesRange(cur(tr.state));
|
|
51762
|
+
}
|
|
51673
51763
|
}
|
|
51674
51764
|
class ActiveResult extends ActiveSource {
|
|
51675
51765
|
constructor(source, explicitPos, result, from, to2) {
|
|
@@ -51681,17 +51771,19 @@ class ActiveResult extends ActiveSource {
|
|
|
51681
51771
|
hasResult() {
|
|
51682
51772
|
return true;
|
|
51683
51773
|
}
|
|
51684
|
-
|
|
51774
|
+
updateFor(tr, type) {
|
|
51685
51775
|
var _a2;
|
|
51776
|
+
if (!(type & 3))
|
|
51777
|
+
return this.map(tr.changes);
|
|
51686
51778
|
let result = this.result;
|
|
51687
51779
|
if (result.map && !tr.changes.empty)
|
|
51688
51780
|
result = result.map(result, tr.changes);
|
|
51689
51781
|
let from = tr.changes.mapPos(this.from), to2 = tr.changes.mapPos(this.to, 1);
|
|
51690
51782
|
let pos = cur(tr.state);
|
|
51691
|
-
if ((this.explicitPos < 0 ? pos <= from : pos < this.from) || pos > to2 || !result || type
|
|
51783
|
+
if ((this.explicitPos < 0 ? pos <= from : pos < this.from) || pos > to2 || !result || type & 2 && cur(tr.startState) == this.from)
|
|
51692
51784
|
return new ActiveSource(
|
|
51693
51785
|
this.source,
|
|
51694
|
-
type
|
|
51786
|
+
type & 4 ? 1 : 0
|
|
51695
51787
|
/* State.Inactive */
|
|
51696
51788
|
);
|
|
51697
51789
|
let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos);
|
|
@@ -51701,13 +51793,6 @@ class ActiveResult extends ActiveSource {
|
|
|
51701
51793
|
return new ActiveResult(this.source, explicitPos, result, result.from, (_a2 = result.to) !== null && _a2 !== void 0 ? _a2 : cur(tr.state));
|
|
51702
51794
|
return new ActiveSource(this.source, 1, explicitPos);
|
|
51703
51795
|
}
|
|
51704
|
-
handleChange(tr) {
|
|
51705
|
-
return tr.changes.touchesRange(this.from, this.to) ? new ActiveSource(
|
|
51706
|
-
this.source,
|
|
51707
|
-
0
|
|
51708
|
-
/* State.Inactive */
|
|
51709
|
-
) : this.map(tr.changes);
|
|
51710
|
-
}
|
|
51711
51796
|
map(mapping) {
|
|
51712
51797
|
if (mapping.empty)
|
|
51713
51798
|
return this;
|
|
@@ -51720,6 +51805,9 @@ class ActiveResult extends ActiveSource {
|
|
|
51720
51805
|
);
|
|
51721
51806
|
return new ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
51722
51807
|
}
|
|
51808
|
+
touches(tr) {
|
|
51809
|
+
return tr.changes.touchesRange(this.from, this.to);
|
|
51810
|
+
}
|
|
51723
51811
|
}
|
|
51724
51812
|
function checkValid(validFor, state, from, to2) {
|
|
51725
51813
|
if (!validFor)
|
|
@@ -51826,11 +51914,12 @@ const completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
51826
51914
|
if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState)
|
|
51827
51915
|
return;
|
|
51828
51916
|
let doesReset = update.transactions.some((tr) => {
|
|
51829
|
-
|
|
51917
|
+
let type = getUpdateType(tr, conf);
|
|
51918
|
+
return type & 8 || (tr.selection || tr.docChanged) && !(type & 3);
|
|
51830
51919
|
});
|
|
51831
51920
|
for (let i = 0; i < this.running.length; i++) {
|
|
51832
51921
|
let query = this.running[i];
|
|
51833
|
-
if (doesReset || query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {
|
|
51922
|
+
if (doesReset || query.context.abortOnDocChange && update.docChanged || query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {
|
|
51834
51923
|
for (let handler of query.context.abortListeners) {
|
|
51835
51924
|
try {
|
|
51836
51925
|
handler();
|
|
@@ -51852,7 +51941,7 @@ const completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
51852
51941
|
this.debounceUpdate = cState.active.some((a) => a.state == 1 && !this.running.some((q) => q.active.source == a.source)) ? setTimeout(() => this.startUpdate(), delay) : -1;
|
|
51853
51942
|
if (this.composing != 0)
|
|
51854
51943
|
for (let tr of update.transactions) {
|
|
51855
|
-
if (
|
|
51944
|
+
if (tr.isUserEvent("input.type"))
|
|
51856
51945
|
this.composing = 2;
|
|
51857
51946
|
else if (this.composing == 2 && tr.selection)
|
|
51858
51947
|
this.composing = 3;
|
|
@@ -51869,7 +51958,7 @@ const completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
51869
51958
|
}
|
|
51870
51959
|
startQuery(active) {
|
|
51871
51960
|
let { state } = this.view, pos = cur(state);
|
|
51872
|
-
let context = new CompletionContext(state, pos, active.explicitPos == pos);
|
|
51961
|
+
let context = new CompletionContext(state, pos, active.explicitPos == pos, this.view);
|
|
51873
51962
|
let pending = new RunningQuery(active, context);
|
|
51874
51963
|
this.running.push(pending);
|
|
51875
51964
|
Promise.resolve(active.source(context)).then((result) => {
|
|
@@ -52022,7 +52111,8 @@ const baseTheme$1 = /* @__PURE__ */ EditorView.baseTheme({
|
|
|
52022
52111
|
padding: "3px 9px",
|
|
52023
52112
|
width: "max-content",
|
|
52024
52113
|
maxWidth: `${400}px`,
|
|
52025
|
-
boxSizing: "border-box"
|
|
52114
|
+
boxSizing: "border-box",
|
|
52115
|
+
whiteSpace: "pre-line"
|
|
52026
52116
|
},
|
|
52027
52117
|
".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
|
|
52028
52118
|
".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
|
|
@@ -53345,7 +53435,8 @@ class Stack {
|
|
|
53345
53435
|
var _a2;
|
|
53346
53436
|
let depth = action >> 19, type = action & 65535;
|
|
53347
53437
|
let { parser: parser2 } = this.p;
|
|
53348
|
-
|
|
53438
|
+
let lookaheadRecord = this.reducePos < this.pos - 25;
|
|
53439
|
+
if (lookaheadRecord)
|
|
53349
53440
|
this.setLookAhead(this.pos);
|
|
53350
53441
|
let dPrec = parser2.dynamicPrecedence(type);
|
|
53351
53442
|
if (dPrec)
|
|
@@ -53353,7 +53444,7 @@ class Stack {
|
|
|
53353
53444
|
if (depth == 0) {
|
|
53354
53445
|
this.pushState(parser2.getGoto(this.state, type, true), this.reducePos);
|
|
53355
53446
|
if (type < parser2.minRepeatTerm)
|
|
53356
|
-
this.storeNode(type, this.reducePos, this.reducePos, 4, true);
|
|
53447
|
+
this.storeNode(type, this.reducePos, this.reducePos, lookaheadRecord ? 8 : 4, true);
|
|
53357
53448
|
this.reduceContext(type, this.reducePos);
|
|
53358
53449
|
return;
|
|
53359
53450
|
}
|
|
@@ -53392,7 +53483,7 @@ class Stack {
|
|
|
53392
53483
|
/**
|
|
53393
53484
|
@internal
|
|
53394
53485
|
*/
|
|
53395
|
-
storeNode(term, start, end, size = 4,
|
|
53486
|
+
storeNode(term, start, end, size = 4, mustSink = false) {
|
|
53396
53487
|
if (term == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
|
|
53397
53488
|
let cur2 = this, top2 = this.buffer.length;
|
|
53398
53489
|
if (top2 == 0 && cur2.parent) {
|
|
@@ -53408,20 +53499,29 @@ class Stack {
|
|
|
53408
53499
|
}
|
|
53409
53500
|
}
|
|
53410
53501
|
}
|
|
53411
|
-
if (!
|
|
53502
|
+
if (!mustSink || this.pos == end) {
|
|
53412
53503
|
this.buffer.push(term, start, end, size);
|
|
53413
53504
|
} else {
|
|
53414
53505
|
let index = this.buffer.length;
|
|
53415
|
-
if (index > 0 && this.buffer[index - 4] != 0)
|
|
53416
|
-
|
|
53417
|
-
|
|
53418
|
-
this.buffer[
|
|
53419
|
-
|
|
53420
|
-
|
|
53421
|
-
|
|
53422
|
-
if (size > 4)
|
|
53423
|
-
size -= 4;
|
|
53506
|
+
if (index > 0 && this.buffer[index - 4] != 0) {
|
|
53507
|
+
let mustMove = false;
|
|
53508
|
+
for (let scan = index; scan > 0 && this.buffer[scan - 2] > end; scan -= 4) {
|
|
53509
|
+
if (this.buffer[scan - 1] >= 0) {
|
|
53510
|
+
mustMove = true;
|
|
53511
|
+
break;
|
|
53512
|
+
}
|
|
53424
53513
|
}
|
|
53514
|
+
if (mustMove)
|
|
53515
|
+
while (index > 0 && this.buffer[index - 2] > end) {
|
|
53516
|
+
this.buffer[index] = this.buffer[index - 4];
|
|
53517
|
+
this.buffer[index + 1] = this.buffer[index - 3];
|
|
53518
|
+
this.buffer[index + 2] = this.buffer[index - 2];
|
|
53519
|
+
this.buffer[index + 3] = this.buffer[index - 1];
|
|
53520
|
+
index -= 4;
|
|
53521
|
+
if (size > 4)
|
|
53522
|
+
size -= 4;
|
|
53523
|
+
}
|
|
53524
|
+
}
|
|
53425
53525
|
this.buffer[index] = term;
|
|
53426
53526
|
this.buffer[index + 1] = start;
|
|
53427
53527
|
this.buffer[index + 2] = end;
|
|
@@ -53556,7 +53656,7 @@ class Stack {
|
|
|
53556
53656
|
if (this.stack.length < 120)
|
|
53557
53657
|
for (let i = 0; best.length < 4 << 1 && i < nextStates.length; i += 2) {
|
|
53558
53658
|
let s = nextStates[i + 1];
|
|
53559
|
-
if (!best.some((
|
|
53659
|
+
if (!best.some((v2, i2) => i2 & 1 && v2 == s))
|
|
53560
53660
|
best.push(nextStates[i], s);
|
|
53561
53661
|
}
|
|
53562
53662
|
nextStates = best;
|
|
@@ -54859,7 +54959,7 @@ class LRParser extends Parser {
|
|
|
54859
54959
|
}
|
|
54860
54960
|
if ((this.data[i + 2] & 65536 >> 16) == 0) {
|
|
54861
54961
|
let value = this.data[i + 1];
|
|
54862
|
-
if (!result.some((
|
|
54962
|
+
if (!result.some((v2, i2) => i2 & 1 && v2 == value))
|
|
54863
54963
|
result.push(this.data[i], value);
|
|
54864
54964
|
}
|
|
54865
54965
|
}
|
|
@@ -55132,6 +55232,7 @@ const defaults = {
|
|
|
55132
55232
|
operatorChars: "*+-%<>!=&|~^/",
|
|
55133
55233
|
specialVar: "?",
|
|
55134
55234
|
identifierQuotes: '"',
|
|
55235
|
+
caseInsensitiveIdentifiers: false,
|
|
55135
55236
|
words: /* @__PURE__ */ keywords(SQLKeywords, SQLTypes)
|
|
55136
55237
|
};
|
|
55137
55238
|
function dialect(spec, kws, types2, builtin) {
|
|
@@ -55385,8 +55486,9 @@ function isSelfTag(namespace) {
|
|
|
55385
55486
|
return namespace.self && typeof namespace.self.label == "string";
|
|
55386
55487
|
}
|
|
55387
55488
|
class CompletionLevel {
|
|
55388
|
-
constructor(idQuote) {
|
|
55489
|
+
constructor(idQuote, idCaseInsensitive) {
|
|
55389
55490
|
this.idQuote = idQuote;
|
|
55491
|
+
this.idCaseInsensitive = idCaseInsensitive;
|
|
55390
55492
|
this.list = [];
|
|
55391
55493
|
this.children = void 0;
|
|
55392
55494
|
}
|
|
@@ -55396,8 +55498,8 @@ class CompletionLevel {
|
|
|
55396
55498
|
if (found)
|
|
55397
55499
|
return found;
|
|
55398
55500
|
if (name2 && !this.list.some((c2) => c2.label == name2))
|
|
55399
|
-
this.list.push(nameCompletion(name2, "type", this.idQuote));
|
|
55400
|
-
return children[name2] = new CompletionLevel(this.idQuote);
|
|
55501
|
+
this.list.push(nameCompletion(name2, "type", this.idQuote, this.idCaseInsensitive));
|
|
55502
|
+
return children[name2] = new CompletionLevel(this.idQuote, this.idCaseInsensitive);
|
|
55401
55503
|
}
|
|
55402
55504
|
maybeChild(name2) {
|
|
55403
55505
|
return this.children ? this.children[name2] : null;
|
|
@@ -55411,7 +55513,7 @@ class CompletionLevel {
|
|
|
55411
55513
|
}
|
|
55412
55514
|
addCompletions(completions) {
|
|
55413
55515
|
for (let option of completions)
|
|
55414
|
-
this.addCompletion(typeof option == "string" ? nameCompletion(option, "property", this.idQuote) : option);
|
|
55516
|
+
this.addCompletion(typeof option == "string" ? nameCompletion(option, "property", this.idQuote, this.idCaseInsensitive) : option);
|
|
55415
55517
|
}
|
|
55416
55518
|
addNamespace(namespace) {
|
|
55417
55519
|
if (Array.isArray(namespace)) {
|
|
@@ -55440,15 +55542,15 @@ class CompletionLevel {
|
|
|
55440
55542
|
}
|
|
55441
55543
|
}
|
|
55442
55544
|
}
|
|
55443
|
-
function nameCompletion(label, type, idQuote) {
|
|
55444
|
-
if (
|
|
55545
|
+
function nameCompletion(label, type, idQuote, idCaseInsensitive) {
|
|
55546
|
+
if (new RegExp("^[a-z_][a-z_\\d]*$", idCaseInsensitive ? "i" : "").test(label))
|
|
55445
55547
|
return { label, type };
|
|
55446
55548
|
return { label, type, apply: idQuote + label + idQuote };
|
|
55447
55549
|
}
|
|
55448
55550
|
function completeFromSchema(schema, tables, schemas, defaultTableName, defaultSchemaName, dialect2) {
|
|
55449
55551
|
var _a2;
|
|
55450
55552
|
let idQuote = ((_a2 = dialect2 === null || dialect2 === void 0 ? void 0 : dialect2.spec.identifierQuotes) === null || _a2 === void 0 ? void 0 : _a2[0]) || '"';
|
|
55451
|
-
let top2 = new CompletionLevel(idQuote);
|
|
55553
|
+
let top2 = new CompletionLevel(idQuote, !!(dialect2 === null || dialect2 === void 0 ? void 0 : dialect2.spec.caseInsensitiveIdentifiers));
|
|
55452
55554
|
let defaultSchema = defaultSchemaName ? top2.child(defaultSchemaName) : null;
|
|
55453
55555
|
top2.addNamespace(schema);
|
|
55454
55556
|
if (tables)
|
|
@@ -55581,6 +55683,16 @@ const PostgreSQL = /* @__PURE__ */ SQLDialect.define({
|
|
|
55581
55683
|
keywords: SQLKeywords + "a abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom c cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion g generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull k key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower m mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner p parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time t table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes",
|
|
55582
55684
|
types: SQLTypes + "bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml"
|
|
55583
55685
|
});
|
|
55686
|
+
function v() {
|
|
55687
|
+
let t2 = reactExports.createContext(void 0);
|
|
55688
|
+
return { usePGlite: (e2) => {
|
|
55689
|
+
let n = reactExports.useContext(t2);
|
|
55690
|
+
if (e2) return e2;
|
|
55691
|
+
if (!n) throw new Error("No PGlite instance found, use PGliteProvider to provide one");
|
|
55692
|
+
return n;
|
|
55693
|
+
}, PGliteProvider: ({ children: e2, db: n }) => jsxRuntimeExports.jsx(t2.Provider, { value: n, children: e2 }) };
|
|
55694
|
+
}
|
|
55695
|
+
var { PGliteProvider: R, usePGlite: l$1 } = v();
|
|
55584
55696
|
const describeCompletions = [
|
|
55585
55697
|
{
|
|
55586
55698
|
label: "\\d",
|
|
@@ -55884,7 +55996,7 @@ function makeSqlExt(config2 = {}) {
|
|
|
55884
55996
|
]);
|
|
55885
55997
|
}
|
|
55886
55998
|
const Ua = "E", Pa = "b", ba = "i", ha = "a", Fa = "e", ya = "r", Ma = "S", Ha = "f", wa = "T", Ga = "n", Wa = "a", qa = "d", va = "s", re = "r", ge = "i", Ba = "S", ye = "t", Me = "v", oe = "m", an = "c", ce = "f", ae = "p", _e = "I";
|
|
55887
|
-
function describe(n, u, C2, U,
|
|
55999
|
+
function describe(n, u, C2, U, v2 = false, Y = null, x = 1, z = (X) => `https://www.postgresql.org/docs/current/${X}.html`) {
|
|
55888
56000
|
let X = false;
|
|
55889
56001
|
function me() {
|
|
55890
56002
|
X = true, U = () => {
|
|
@@ -55931,7 +56043,7 @@ URL: ${z(t2[2])}
|
|
|
55931
56043
|
}
|
|
55932
56044
|
}
|
|
55933
56045
|
const O = async (r, E = false) => {
|
|
55934
|
-
le(),
|
|
56046
|
+
le(), v2 && !E && U(`/******** QUERY *********/
|
|
55935
56047
|
${r}
|
|
55936
56048
|
/************************/`);
|
|
55937
56049
|
const t2 = await C2(r);
|
|
@@ -57021,7 +57133,7 @@ WHERE c.oid = '%s';`, s ? `pg_catalog.array_to_string(c.reloptions || array(sele
|
|
|
57021
57133
|
0,
|
|
57022
57134
|
14
|
|
57023
57135
|
)) : S.relam = null, _ = null, S.relkind == Ba) {
|
|
57024
|
-
let
|
|
57136
|
+
let R2 = null, I = p.popt, b = [null, null];
|
|
57025
57137
|
if (p.sversion >= 1e5 ? (L(a, `SELECT pg_catalog.format_type(seqtypid, NULL) AS "%s",
|
|
57026
57138
|
seqstart AS "%s",
|
|
57027
57139
|
seqmin AS "%s",
|
|
@@ -57055,17 +57167,17 @@ INNER JOIN pg_catalog.pg_attribute a ON (
|
|
|
57055
57167
|
WHERE d.classid='pg_catalog.pg_class'::pg_catalog.regclass
|
|
57056
57168
|
AND d.refclassid='pg_catalog.pg_class'::pg_catalog.regclass
|
|
57057
57169
|
AND d.objid='%s'
|
|
57058
|
-
AND d.deptype IN ('a', 'i')`, t2),
|
|
57059
|
-
if (W(
|
|
57170
|
+
AND d.deptype IN ('a', 'i')`, t2), R2 = await O(a.data), R2) {
|
|
57171
|
+
if (W(R2) == 1) switch (A(R2, 0, 1)[0]) {
|
|
57060
57172
|
case "a":
|
|
57061
57173
|
b[0] = ln(e("Owned by: %s"), A(
|
|
57062
|
-
|
|
57174
|
+
R2,
|
|
57063
57175
|
0,
|
|
57064
57176
|
0
|
|
57065
57177
|
));
|
|
57066
57178
|
break;
|
|
57067
57179
|
case "i":
|
|
57068
|
-
b[0] = ln(e("Sequence for identity column: %s"), A(
|
|
57180
|
+
b[0] = ln(e("Sequence for identity column: %s"), A(R2, 0, 0));
|
|
57069
57181
|
break;
|
|
57070
57182
|
}
|
|
57071
57183
|
} else return i;
|
|
@@ -57128,43 +57240,43 @@ ORDER BY a.attnum;`), _ = await O(a.data), !_) return i;
|
|
|
57128
57240
|
for (h = 0, m2[h++] = o("Column"), m2[h++] = o("Type"), Ke && (m2[h++] = o("Collation"), m2[h++] = o("Nullable"), m2[h++] = o("Default")), Ye >= 0 && (m2[h++] = o("Key?")), xe >= 0 && (m2[h++] = o("Definition")), Ve >= 0 && (m2[h++] = o("FDW options")), Xe >= 0 && (m2[h++] = o("Storage")), ke >= 0 && (m2[h++] = o("Compression")), je >= 0 && (m2[h++] = o("Stats target")), Je >= 0 && (m2[h++] = o("Description")), de(h <= Q(m2)), ve(N, g, f.data, h, nn), T = 0; T < h; T++) ie2(N, m2[T], true, "l");
|
|
57129
57241
|
for (T = 0; T < nn; T++) {
|
|
57130
57242
|
if (j(N, A(_, T, Ee), false), j(N, A(_, T, Z), false), Ke) {
|
|
57131
|
-
let
|
|
57132
|
-
j(N, A(_, T, Pe), false), j(N, F(A(_, T, Ue), "t") == 0 ? "not null" : "", false),
|
|
57243
|
+
let R2, I, b;
|
|
57244
|
+
j(N, A(_, T, Pe), false), j(N, F(A(_, T, Ue), "t") == 0 ? "not null" : "", false), R2 = A(_, T, be), I = A(_, T, he), R2[0] == Wa ? b = "generated always as identity" : R2[0] == qa ? b = "generated by default as identity" : I[0] == va ? (b = ln(
|
|
57133
57245
|
"generated always as (%s) stored",
|
|
57134
57246
|
A(_, T, w)
|
|
57135
57247
|
), true) : b = A(_, T, w), j(N, b, false);
|
|
57136
57248
|
}
|
|
57137
57249
|
if (Ye >= 0 && j(N, A(_, T, Ye), true), xe >= 0 && j(N, A(_, T, xe), false), Ve >= 0 && j(N, A(_, T, Ve), false), Xe >= 0) {
|
|
57138
|
-
let
|
|
57139
|
-
j(N,
|
|
57250
|
+
let R2 = A(_, T, Xe);
|
|
57251
|
+
j(N, R2[0] == "p" ? "plain" : R2[0] == "m" ? "main" : R2[0] == "x" ? "extended" : R2[0] == "e" ? "external" : "???", false);
|
|
57140
57252
|
}
|
|
57141
57253
|
if (ke >= 0) {
|
|
57142
|
-
let
|
|
57143
|
-
j(N,
|
|
57254
|
+
let R2 = A(_, T, ke);
|
|
57255
|
+
j(N, R2[0] == "p" ? "pglz" : R2[0] == "l" ? "lz4" : R2[0] == null ? "" : "???", false);
|
|
57144
57256
|
}
|
|
57145
57257
|
je >= 0 && j(N, A(_, T, je), false), Je >= 0 && j(N, A(_, T, Je), false);
|
|
57146
57258
|
}
|
|
57147
57259
|
if (S.ispartition) {
|
|
57148
|
-
let
|
|
57260
|
+
let R2;
|
|
57149
57261
|
if (L(a, `SELECT inhparent::pg_catalog.regclass,
|
|
57150
57262
|
pg_catalog.pg_get_expr(c.relpartbound, c.oid),
|
|
57151
57263
|
`), c(a, p.sversion >= 14e4 ? "inhdetachpending" : "false as inhdetachpending"), s && c(a, `,
|
|
57152
57264
|
pg_catalog.pg_get_partition_constraintdef(c.oid)`), l(a, `
|
|
57153
57265
|
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_inherits i ON c.oid = inhrelid
|
|
57154
|
-
WHERE c.oid = '%s';`, t2),
|
|
57155
|
-
if (W(
|
|
57156
|
-
let I = A(
|
|
57266
|
+
WHERE c.oid = '%s';`, t2), R2 = await O(a.data), !R2) return i;
|
|
57267
|
+
if (W(R2) > 0) {
|
|
57268
|
+
let I = A(R2, 0, 0), b = A(R2, 0, 1), H = A(R2, 0, 2);
|
|
57157
57269
|
if (L(y, e("Partition of: %s %s%s"), I, b, F(H, "t") == 0 ? " DETACH PENDING" : ""), M(N, y.data), s) {
|
|
57158
57270
|
let B = null;
|
|
57159
|
-
ee(
|
|
57271
|
+
ee(R2, 0, 3) || (B = A(R2, 0, 3)), B == null || B[0] == null ? L(y, e("No partition constraint")) : L(y, e("Partition constraint: %s"), B), M(N, y.data);
|
|
57160
57272
|
}
|
|
57161
57273
|
}
|
|
57162
57274
|
}
|
|
57163
57275
|
if (S.relkind == ae) {
|
|
57164
|
-
let
|
|
57165
|
-
if (L(a, "SELECT pg_catalog.pg_get_partkeydef('%s'::pg_catalog.oid);", t2),
|
|
57166
|
-
if (W(
|
|
57167
|
-
let I = A(
|
|
57276
|
+
let R2;
|
|
57277
|
+
if (L(a, "SELECT pg_catalog.pg_get_partkeydef('%s'::pg_catalog.oid);", t2), R2 = await O(a.data), !R2) return i;
|
|
57278
|
+
if (W(R2) == 1) {
|
|
57279
|
+
let I = A(R2, 0, 0);
|
|
57168
57280
|
L(
|
|
57169
57281
|
y,
|
|
57170
57282
|
e("Partition key: %s"),
|
|
@@ -57173,17 +57285,17 @@ WHERE c.oid = '%s';`, t2), R = await O(a.data), !R) return i;
|
|
|
57173
57285
|
}
|
|
57174
57286
|
}
|
|
57175
57287
|
if (S.relkind == ye) {
|
|
57176
|
-
let
|
|
57288
|
+
let R2;
|
|
57177
57289
|
if (L(a, `SELECT n.nspname, c.relname
|
|
57178
57290
|
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
|
|
57179
|
-
WHERE reltoastrelid = '%s';`, t2),
|
|
57180
|
-
if (W(
|
|
57181
|
-
let I = A(
|
|
57291
|
+
WHERE reltoastrelid = '%s';`, t2), R2 = await O(a.data), !R2) return i;
|
|
57292
|
+
if (W(R2) == 1) {
|
|
57293
|
+
let I = A(R2, 0, 0), b = A(R2, 0, 1);
|
|
57182
57294
|
L(y, e('Owning table: "%s.%s"'), I, b), M(N, y.data);
|
|
57183
57295
|
}
|
|
57184
57296
|
}
|
|
57185
57297
|
if (S.relkind == ge || S.relkind == _e) {
|
|
57186
|
-
let
|
|
57298
|
+
let R2;
|
|
57187
57299
|
if (L(a, `SELECT i.indisunique, i.indisprimary, i.indisclustered, i.indisvalid,
|
|
57188
57300
|
(NOT i.indimmediate) AND EXISTS (SELECT 1 FROM pg_catalog.pg_constraint WHERE conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x') AND condeferrable) AS condeferrable,
|
|
57189
57301
|
(NOT i.indimmediate) AND EXISTS (SELECT 1 FROM pg_catalog.pg_constraint WHERE conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x') AND condeferred) AS condeferred,
|
|
@@ -57194,14 +57306,14 @@ WHERE reltoastrelid = '%s';`, t2), R = await O(a.data), !R) return i;
|
|
|
57194
57306
|
`), l(a, ` a.amname, c2.relname, pg_catalog.pg_get_expr(i.indpred, i.indrelid, true)
|
|
57195
57307
|
FROM pg_catalog.pg_index i, pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_am a
|
|
57196
57308
|
WHERE i.indexrelid = c.oid AND c.oid = '%s' AND c.relam = a.oid
|
|
57197
|
-
AND i.indrelid = c2.oid;`, t2),
|
|
57198
|
-
if (W(
|
|
57309
|
+
AND i.indrelid = c2.oid;`, t2), R2 = await O(a.data), R2) {
|
|
57310
|
+
if (W(R2) != 1) return i;
|
|
57199
57311
|
{
|
|
57200
|
-
let I = A(
|
|
57201
|
-
|
|
57312
|
+
let I = A(R2, 0, 0), b = A(R2, 0, 1), H = A(R2, 0, 2), B = A(R2, 0, 3), k = A(
|
|
57313
|
+
R2,
|
|
57202
57314
|
0,
|
|
57203
57315
|
4
|
|
57204
|
-
), Te = A(
|
|
57316
|
+
), Te = A(R2, 0, 5), ne = A(R2, 0, 6), Fe = A(R2, 0, 7), Ca = A(R2, 0, 8), Da = A(R2, 0, 9), Tn = A(R2, 0, 10);
|
|
57205
57317
|
F(b, "t") == 0 ? L(y, e("primary key, ")) : F(
|
|
57206
57318
|
I,
|
|
57207
57319
|
"t"
|
|
@@ -57209,31 +57321,31 @@ AND i.indrelid = c2.oid;`, t2), R = await O(a.data), R) {
|
|
|
57209
57321
|
}
|
|
57210
57322
|
} else return i;
|
|
57211
57323
|
} else if (S.relkind == re || S.relkind == oe || S.relkind == ce || S.relkind == ae || S.relkind == _e || S.relkind == ye) {
|
|
57212
|
-
let
|
|
57324
|
+
let R2 = null, I = 0;
|
|
57213
57325
|
if (S.hasindex) {
|
|
57214
57326
|
if (L(a, `SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, i.indisvalid, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),
|
|
57215
57327
|
pg_catalog.pg_get_constraintdef(con.oid, true), contype, condeferrable, condeferred`), p.sversion >= 90400 ? c(a, ", i.indisreplident") : c(a, ", false AS indisreplident"), c(a, ", c2.reltablespace"), l(a, `
|
|
57216
57328
|
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
|
|
57217
57329
|
LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))
|
|
57218
57330
|
WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
|
|
57219
|
-
ORDER BY i.indisprimary DESC, c2.relname;`, t2),
|
|
57331
|
+
ORDER BY i.indisprimary DESC, c2.relname;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57220
57332
|
else return i;
|
|
57221
57333
|
if (I > 0) for (M(N, e("Indexes:")), T = 0; T < I; T++) {
|
|
57222
|
-
if (L(a, ' "%s"', A(
|
|
57334
|
+
if (L(a, ' "%s"', A(R2, T, 0)), F(A(R2, T, 7), "x") == 0) l(a, " %s", A(R2, T, 6));
|
|
57223
57335
|
else {
|
|
57224
57336
|
let b, H;
|
|
57225
|
-
F(A(
|
|
57337
|
+
F(A(R2, T, 1), "t") == 0 ? c(a, " PRIMARY KEY,") : F(A(R2, T, 2), "t") == 0 && (F(A(R2, T, 7), "u") == 0 ? c(a, " UNIQUE CONSTRAINT,") : c(a, " UNIQUE,")), b = A(R2, T, 5), H = Qe(b, " USING "), H != null && (b = b.slice(H + 7)), l(a, " %s", b), F(A(R2, T, 8), "t") == 0 && c(a, " DEFERRABLE"), F(A(R2, T, 9), "t") == 0 && c(a, " INITIALLY DEFERRED");
|
|
57226
57338
|
}
|
|
57227
|
-
F(A(
|
|
57339
|
+
F(A(R2, T, 3), "t") == 0 && c(a, " CLUSTER"), F(A(R2, T, 4), "t") != 0 && c(a, " INVALID"), F(A(R2, T, 10), "t") == 0 && c(a, " REPLICA IDENTITY"), M(N, a.data), await en(N, ge, sn(A(R2, T, 11)), false);
|
|
57228
57340
|
}
|
|
57229
57341
|
}
|
|
57230
57342
|
if (S.checks) {
|
|
57231
57343
|
if (L(a, `SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true)
|
|
57232
57344
|
FROM pg_catalog.pg_constraint r
|
|
57233
57345
|
WHERE r.conrelid = '%s' AND r.contype = 'c'
|
|
57234
|
-
ORDER BY 1;`, t2),
|
|
57346
|
+
ORDER BY 1;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57235
57347
|
else return i;
|
|
57236
|
-
if (I > 0) for (M(N, e("Check constraints:")), T = 0; T < I; T++) L(a, ' "%s" %s', A(
|
|
57348
|
+
if (I > 0) for (M(N, e("Check constraints:")), T = 0; T < I; T++) L(a, ' "%s" %s', A(R2, T, 0), A(R2, T, 1)), M(N, a.data);
|
|
57237
57349
|
}
|
|
57238
57350
|
if (S.hastriggers || S.relkind == ae) {
|
|
57239
57351
|
if (p.sversion >= 12e4 && (S.ispartition || S.relkind == ae) ? L(a, `SELECT conrelid = '%s'::pg_catalog.regclass AS sametable,
|
|
@@ -57249,14 +57361,14 @@ ORDER BY sametable DESC, conname;`, t2, t2) : (L(a, `SELECT true as sametable, c
|
|
|
57249
57361
|
FROM pg_catalog.pg_constraint r
|
|
57250
57362
|
WHERE r.conrelid = '%s' AND r.contype = 'f'
|
|
57251
57363
|
`, t2), p.sversion >= 12e4 && c(a, ` AND conparentid = 0
|
|
57252
|
-
`), c(a, "ORDER BY conname")),
|
|
57364
|
+
`), c(a, "ORDER BY conname")), R2 = await O(a.data), R2) I = W(R2);
|
|
57253
57365
|
else return i;
|
|
57254
57366
|
if (I > 0) {
|
|
57255
|
-
let b = fe(
|
|
57256
|
-
|
|
57367
|
+
let b = fe(R2, "sametable"), H = fe(R2, "conname"), B = fe(
|
|
57368
|
+
R2,
|
|
57257
57369
|
"condef"
|
|
57258
|
-
), k = fe(
|
|
57259
|
-
for (M(N, e("Foreign-key constraints:")), T = 0; T < I; T++) F(A(
|
|
57370
|
+
), k = fe(R2, "ontable");
|
|
57371
|
+
for (M(N, e("Foreign-key constraints:")), T = 0; T < I; T++) F(A(R2, T, b), "f") == 0 ? L(a, ' TABLE "%s" CONSTRAINT "%s" %s', A(R2, T, k), A(R2, T, H), A(R2, T, B)) : L(a, ' "%s" %s', A(R2, T, H), A(R2, T, B)), M(N, a.data);
|
|
57260
57372
|
}
|
|
57261
57373
|
}
|
|
57262
57374
|
if (S.hastriggers || S.relkind == ae) {
|
|
@@ -57270,11 +57382,11 @@ ORDER BY conname;`, t2, t2) : L(a, `SELECT conname, conrelid::pg_catalog.regclas
|
|
|
57270
57382
|
pg_catalog.pg_get_constraintdef(oid, true) AS condef
|
|
57271
57383
|
FROM pg_catalog.pg_constraint
|
|
57272
57384
|
WHERE confrelid = %s AND contype = 'f'
|
|
57273
|
-
ORDER BY conname;`, t2),
|
|
57385
|
+
ORDER BY conname;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57274
57386
|
else return i;
|
|
57275
57387
|
if (I > 0) {
|
|
57276
|
-
let b = fe(
|
|
57277
|
-
for (M(N, e("Referenced by:")), T = 0; T < I; T++) L(a, ' TABLE "%s" CONSTRAINT "%s" %s', A(
|
|
57388
|
+
let b = fe(R2, "conname"), H = fe(R2, "ontable"), B = fe(R2, "condef");
|
|
57389
|
+
for (M(N, e("Referenced by:")), T = 0; T < I; T++) L(a, ' TABLE "%s" CONSTRAINT "%s" %s', A(R2, T, H), A(R2, T, b), A(R2, T, B)), M(
|
|
57278
57390
|
N,
|
|
57279
57391
|
a.data
|
|
57280
57392
|
);
|
|
@@ -57293,19 +57405,19 @@ ORDER BY conname;`, t2), R = await O(a.data), R) I = W(R);
|
|
|
57293
57405
|
WHEN 'd' THEN 'DELETE'
|
|
57294
57406
|
END AS cmd
|
|
57295
57407
|
FROM pg_catalog.pg_policy pol
|
|
57296
|
-
WHERE pol.polrelid = '%s' ORDER BY 1;`, t2),
|
|
57408
|
+
WHERE pol.polrelid = '%s' ORDER BY 1;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57297
57409
|
else return i;
|
|
57298
57410
|
for (S.rowsecurity && !S.forcerowsecurity && I > 0 && M(N, e("Policies:")), S.rowsecurity && S.forcerowsecurity && I > 0 && M(N, e("Policies (forced row security enabled):")), S.rowsecurity && !S.forcerowsecurity && I == 0 && M(N, e("Policies (row security enabled): (none)")), S.rowsecurity && S.forcerowsecurity && I == 0 && M(
|
|
57299
57411
|
N,
|
|
57300
57412
|
e("Policies (forced row security enabled): (none)")
|
|
57301
|
-
), !S.rowsecurity && I > 0 && M(N, e("Policies (row security disabled):")), T = 0; T < I; T++) L(a, ' POLICY "%s"', A(
|
|
57302
|
-
|
|
57413
|
+
), !S.rowsecurity && I > 0 && M(N, e("Policies (row security disabled):")), T = 0; T < I; T++) L(a, ' POLICY "%s"', A(R2, T, 0)), A(R2, T, 1) == "f" && c(a, " AS RESTRICTIVE"), ee(R2, T, 5) || l(a, " FOR %s", A(R2, T, 5)), ee(
|
|
57414
|
+
R2,
|
|
57303
57415
|
T,
|
|
57304
57416
|
2
|
|
57305
57417
|
) || l(a, `
|
|
57306
|
-
TO %s`, A(
|
|
57307
|
-
USING (%s)`, A(
|
|
57308
|
-
WITH CHECK (%s)`, A(
|
|
57418
|
+
TO %s`, A(R2, T, 2)), ee(R2, T, 3) || l(a, `
|
|
57419
|
+
USING (%s)`, A(R2, T, 3)), ee(R2, T, 4) || l(a, `
|
|
57420
|
+
WITH CHECK (%s)`, A(R2, T, 4)), M(N, a.data);
|
|
57309
57421
|
}
|
|
57310
57422
|
if (p.sversion >= 14e4) {
|
|
57311
57423
|
if (L(a, `SELECT oid, stxrelid::pg_catalog.regclass, stxnamespace::pg_catalog.regnamespace::pg_catalog.text AS nsp, stxname,
|
|
@@ -57316,16 +57428,16 @@ pg_catalog.pg_get_statisticsobjdef_columns(oid) AS columns,
|
|
|
57316
57428
|
stxstattarget
|
|
57317
57429
|
FROM pg_catalog.pg_statistic_ext
|
|
57318
57430
|
WHERE stxrelid = '%s'
|
|
57319
|
-
ORDER BY nsp, stxname;`, t2),
|
|
57431
|
+
ORDER BY nsp, stxname;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57320
57432
|
else return i;
|
|
57321
57433
|
if (I > 0) for (M(N, e("Statistics objects:")), T = 0; T < I; T++) {
|
|
57322
57434
|
let b = false, H, B, k, Te, ne;
|
|
57323
|
-
H = F(A(
|
|
57324
|
-
|
|
57435
|
+
H = F(A(R2, T, 5), "t") == 0, B = F(A(R2, T, 6), "t") == 0, k = F(A(R2, T, 7), "t") == 0, L(a, " "), l(a, '"%s.%s"', A(R2, T, 2), A(
|
|
57436
|
+
R2,
|
|
57325
57437
|
T,
|
|
57326
57438
|
3
|
|
57327
|
-
)), Te = H && B && k, ne = H || B || k, ne && !Te && (c(a, " ("), H && (c(a, "ndistinct"), b = true), B && (l(a, "%sdependencies", b ? ", " : ""), b = true), k && l(a, "%smcv", b ? ", " : ""), V(a, ")")), l(a, " ON %s FROM %s", A(
|
|
57328
|
-
|
|
57439
|
+
)), Te = H && B && k, ne = H || B || k, ne && !Te && (c(a, " ("), H && (c(a, "ndistinct"), b = true), B && (l(a, "%sdependencies", b ? ", " : ""), b = true), k && l(a, "%smcv", b ? ", " : ""), V(a, ")")), l(a, " ON %s FROM %s", A(R2, T, 4), A(R2, T, 1)), F(A(R2, T, 8), "-1") != 0 && l(a, "; STATISTICS %s", A(
|
|
57440
|
+
R2,
|
|
57329
57441
|
T,
|
|
57330
57442
|
8
|
|
57331
57443
|
)), M(N, a.data);
|
|
@@ -57343,21 +57455,21 @@ ORDER BY nsp, stxname;`, t2), R = await O(a.data), R) I = W(R);
|
|
|
57343
57455
|
`) : c(a, ` -1 AS stxstattarget
|
|
57344
57456
|
`), l(a, `FROM pg_catalog.pg_statistic_ext
|
|
57345
57457
|
WHERE stxrelid = '%s'
|
|
57346
|
-
ORDER BY 1;`, t2),
|
|
57458
|
+
ORDER BY 1;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57347
57459
|
else return i;
|
|
57348
57460
|
if (I > 0) for (M(N, e("Statistics objects:")), T = 0; T < I; T++) {
|
|
57349
57461
|
let b = false;
|
|
57350
|
-
L(a, " "), l(a, '"%s.%s" (', A(
|
|
57351
|
-
|
|
57462
|
+
L(a, " "), l(a, '"%s.%s" (', A(R2, T, 2), A(R2, T, 3)), F(A(R2, T, 5), "t") == 0 && (c(a, "ndistinct"), b = true), F(A(R2, T, 6), "t") == 0 && (l(a, "%sdependencies", b ? ", " : ""), b = true), F(A(R2, T, 7), "t") == 0 && l(a, "%smcv", b ? ", " : ""), l(a, ") ON %s FROM %s", A(R2, T, 4), A(R2, T, 1)), F(A(
|
|
57463
|
+
R2,
|
|
57352
57464
|
T,
|
|
57353
57465
|
8
|
|
57354
|
-
), "-1") != 0 && l(a, "; STATISTICS %s", A(
|
|
57466
|
+
), "-1") != 0 && l(a, "; STATISTICS %s", A(R2, T, 8)), M(N, a.data);
|
|
57355
57467
|
}
|
|
57356
57468
|
}
|
|
57357
57469
|
if (S.hasrules && S.relkind != oe) {
|
|
57358
57470
|
if (L(a, `SELECT r.rulename, trim(trailing ';' from pg_catalog.pg_get_ruledef(r.oid, true)), ev_enabled
|
|
57359
57471
|
FROM pg_catalog.pg_rewrite r
|
|
57360
|
-
WHERE r.ev_class = '%s' ORDER BY 1;`, t2),
|
|
57472
|
+
WHERE r.ev_class = '%s' ORDER BY 1;`, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57361
57473
|
else return i;
|
|
57362
57474
|
if (I > 0) {
|
|
57363
57475
|
let b, H;
|
|
@@ -57365,16 +57477,16 @@ WHERE r.ev_class = '%s' ORDER BY 1;`, t2), R = await O(a.data), R) I = W(R);
|
|
|
57365
57477
|
let B, k = false;
|
|
57366
57478
|
switch (H) {
|
|
57367
57479
|
case 0:
|
|
57368
|
-
A(
|
|
57480
|
+
A(R2, T, 2) == "O" && (k = true);
|
|
57369
57481
|
break;
|
|
57370
57482
|
case 1:
|
|
57371
|
-
A(
|
|
57483
|
+
A(R2, T, 2) == "D" && (k = true);
|
|
57372
57484
|
break;
|
|
57373
57485
|
case 2:
|
|
57374
|
-
A(
|
|
57486
|
+
A(R2, T, 2) == "A" && (k = true);
|
|
57375
57487
|
break;
|
|
57376
57488
|
case 3:
|
|
57377
|
-
A(
|
|
57489
|
+
A(R2, T, 2) == "R" && (k = true);
|
|
57378
57490
|
break;
|
|
57379
57491
|
}
|
|
57380
57492
|
if (k) {
|
|
@@ -57395,7 +57507,7 @@ WHERE r.ev_class = '%s' ORDER BY 1;`, t2), R = await O(a.data), R) I = W(R);
|
|
|
57395
57507
|
}
|
|
57396
57508
|
M(N, a.data), b = true;
|
|
57397
57509
|
}
|
|
57398
|
-
B = A(
|
|
57510
|
+
B = A(R2, T, 1), B = B.slice(12), L(a, " %s", B), M(N, a.data);
|
|
57399
57511
|
}
|
|
57400
57512
|
}
|
|
57401
57513
|
}
|
|
@@ -57438,13 +57550,13 @@ SELECT pubname
|
|
|
57438
57550
|
, NULL
|
|
57439
57551
|
FROM pg_catalog.pg_publication p
|
|
57440
57552
|
WHERE p.puballtables AND pg_catalog.pg_relation_is_publishable('%s')
|
|
57441
|
-
ORDER BY 1;`, t2, t2),
|
|
57553
|
+
ORDER BY 1;`, t2, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57442
57554
|
else return i;
|
|
57443
57555
|
for (I > 0 && M(N, e("Publications:")), T = 0; T < I; T++) L(a, ' "%s"', A(
|
|
57444
|
-
|
|
57556
|
+
R2,
|
|
57445
57557
|
T,
|
|
57446
57558
|
0
|
|
57447
|
-
)), ee(
|
|
57559
|
+
)), ee(R2, T, 2) || l(a, " (%s)", A(R2, T, 2)), ee(R2, T, 1) || l(a, " WHERE %s", A(R2, T, 1)), M(N, a.data);
|
|
57448
57560
|
}
|
|
57449
57561
|
if (s) {
|
|
57450
57562
|
if (L(a, `SELECT co.conname, at.attname, co.connoinherit, co.conislocal,
|
|
@@ -57455,33 +57567,33 @@ pg_catalog.pg_attribute at ON
|
|
|
57455
57567
|
WHERE co.contype = 'n' AND
|
|
57456
57568
|
co.conrelid = '%s'::pg_catalog.regclass AND
|
|
57457
57569
|
at.attrelid = '%s'::pg_catalog.regclass
|
|
57458
|
-
ORDER BY at.attnum`, t2, t2),
|
|
57570
|
+
ORDER BY at.attnum`, t2, t2), R2 = await O(a.data), R2) I = W(R2);
|
|
57459
57571
|
else return i;
|
|
57460
57572
|
for (I > 0 && M(N, e("Not-null constraints:")), T = 0; T < I; T++) {
|
|
57461
|
-
let b = A(
|
|
57462
|
-
L(a, ' "%s" NOT NULL "%s"%s', A(
|
|
57573
|
+
let b = A(R2, T, 3)[0] == "t", H = A(R2, T, 4)[0] == "t";
|
|
57574
|
+
L(a, ' "%s" NOT NULL "%s"%s', A(R2, T, 0), A(R2, T, 1), A(R2, T, 2)[0] == "t" ? " NO INHERIT" : b && H ? e(" (local, inherited)") : H ? e(" (inherited)") : ""), M(N, a.data);
|
|
57463
57575
|
}
|
|
57464
57576
|
}
|
|
57465
57577
|
}
|
|
57466
57578
|
if ((S.relkind == Me || S.relkind == oe) && s) {
|
|
57467
|
-
let
|
|
57468
|
-
if (L(a, "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);", t2),
|
|
57469
|
-
W(
|
|
57579
|
+
let R2;
|
|
57580
|
+
if (L(a, "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);", t2), R2 = await O(a.data), !R2) return i;
|
|
57581
|
+
W(R2) > 0 && (d = Se(A(R2, 0, 0)));
|
|
57470
57582
|
}
|
|
57471
57583
|
if (d) {
|
|
57472
|
-
let
|
|
57584
|
+
let R2 = null;
|
|
57473
57585
|
if (M(N, e("View definition:")), M(N, d), S.hasrules) {
|
|
57474
57586
|
if (L(a, `SELECT r.rulename, trim(trailing ';' from pg_catalog.pg_get_ruledef(r.oid, true))
|
|
57475
57587
|
FROM pg_catalog.pg_rewrite r
|
|
57476
|
-
WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;`, t2),
|
|
57477
|
-
if (W(
|
|
57588
|
+
WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;`, t2), R2 = await O(a.data), !R2) return i;
|
|
57589
|
+
if (W(R2) > 0) for (M(N, e("Rules:")), T = 0; T < W(R2); T++) {
|
|
57478
57590
|
let I;
|
|
57479
|
-
I = A(
|
|
57591
|
+
I = A(R2, T, 1), I = I.slice(12), L(a, " %s", I), M(N, a.data);
|
|
57480
57592
|
}
|
|
57481
57593
|
}
|
|
57482
57594
|
}
|
|
57483
57595
|
if (S.hastriggers) {
|
|
57484
|
-
let
|
|
57596
|
+
let R2, I;
|
|
57485
57597
|
if (L(a, `SELECT t.tgname, pg_catalog.pg_get_triggerdef(t.oid, true), t.tgenabled, t.tgisinternal,
|
|
57486
57598
|
`), p.sversion >= 13e4 ? c(a, ` CASE WHEN t.tgparentid != 0 THEN
|
|
57487
57599
|
(SELECT u.tgrelid::pg_catalog.regclass
|
|
@@ -57496,13 +57608,13 @@ WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;`, t2), R = await
|
|
|
57496
57608
|
WHERE t.tgrelid = '%s' AND `, t2), p.sversion >= 11e4 && p.sversion < 15e4 ? c(a, `(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D')
|
|
57497
57609
|
OR EXISTS (SELECT 1 FROM pg_catalog.pg_depend WHERE objid = t.oid
|
|
57498
57610
|
AND refclassid = 'pg_catalog.pg_trigger'::pg_catalog.regclass))`) : c(a, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D'))"), c(a, `
|
|
57499
|
-
ORDER BY 1;`),
|
|
57611
|
+
ORDER BY 1;`), R2 = await O(a.data), R2) I = W(R2);
|
|
57500
57612
|
else return i;
|
|
57501
57613
|
if (I > 0) {
|
|
57502
57614
|
let b, H;
|
|
57503
57615
|
for (H = 0; H <= 4; H++) for (b = false, T = 0; T < I; T++) {
|
|
57504
57616
|
let B, k, Te, ne, Fe;
|
|
57505
|
-
switch (ne = A(
|
|
57617
|
+
switch (ne = A(R2, T, 2), Fe = A(R2, T, 3), B = false, H) {
|
|
57506
57618
|
case 0:
|
|
57507
57619
|
(ne == "O" || ne == "t") && (B = true);
|
|
57508
57620
|
break;
|
|
@@ -57543,18 +57655,18 @@ ORDER BY 1;`), R = await O(a.data), R) I = W(R);
|
|
|
57543
57655
|
}
|
|
57544
57656
|
M(N, a.data), b = true;
|
|
57545
57657
|
}
|
|
57546
|
-
k = A(
|
|
57547
|
-
|
|
57658
|
+
k = A(R2, T, 1), Te = Qe(k, " TRIGGER "), Te != null && (k = k.slice(Te + 9)), L(a, " %s", k), ee(
|
|
57659
|
+
R2,
|
|
57548
57660
|
T,
|
|
57549
57661
|
4
|
|
57550
|
-
) || l(a, ", ON TABLE %s", A(
|
|
57662
|
+
) || l(a, ", ON TABLE %s", A(R2, T, 4)), M(N, a.data);
|
|
57551
57663
|
}
|
|
57552
57664
|
}
|
|
57553
57665
|
}
|
|
57554
57666
|
}
|
|
57555
57667
|
if (S.relkind == re || S.relkind == oe || S.relkind == ce || S.relkind == ae || S.relkind == _e || S.relkind == ye) {
|
|
57556
|
-
let
|
|
57557
|
-
if (
|
|
57668
|
+
let R2, I, b;
|
|
57669
|
+
if (R2 = S.relkind == ae || S.relkind == _e, S.relkind == ce) {
|
|
57558
57670
|
let H;
|
|
57559
57671
|
if (L(a, `SELECT s.srvname,
|
|
57560
57672
|
pg_catalog.array_to_string(ARRAY(
|
|
@@ -57594,14 +57706,14 @@ WHERE c.oid = i.inhrelid AND i.inhparent = '%s'
|
|
|
57594
57706
|
ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;`,
|
|
57595
57707
|
t2
|
|
57596
57708
|
), I = await O(a.data), !I) return i;
|
|
57597
|
-
if (b = W(I),
|
|
57598
|
-
else if (!s) b > 0 && (
|
|
57709
|
+
if (b = W(I), R2 && b == 0) L(a, e("Number of partitions: %d"), b), M(N, a.data);
|
|
57710
|
+
else if (!s) b > 0 && (R2 ? L(a, e("Number of partitions: %d (Use \\d+ to list them.)"), b) : L(
|
|
57599
57711
|
a,
|
|
57600
57712
|
e("Number of child tables: %d (Use \\d+ to list them.)"),
|
|
57601
57713
|
b
|
|
57602
57714
|
), M(N, a.data));
|
|
57603
57715
|
else {
|
|
57604
|
-
let H = e(
|
|
57716
|
+
let H = e(R2 ? "Partitions" : "Child tables"), B = gn(
|
|
57605
57717
|
H,
|
|
57606
57718
|
pe(H),
|
|
57607
57719
|
p.encoding
|
|
@@ -57618,8 +57730,8 @@ ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;`,
|
|
|
57618
57730
|
s && S.relkind != oe && S.hasoids && M(N, e("Has OIDs: yes")), await en(N, S.relkind, S.tablespace, true), s && S.relam != null && !p.hide_tableam && (L(a, e("Access method: %s"), S.relam), M(N, a.data));
|
|
57619
57731
|
}
|
|
57620
57732
|
if (s && S.reloptions && S.reloptions[0] != null) {
|
|
57621
|
-
let
|
|
57622
|
-
L(a, "%s: %s",
|
|
57733
|
+
let R2 = e("Options");
|
|
57734
|
+
L(a, "%s: %s", R2, S.reloptions), M(N, a.data);
|
|
57623
57735
|
}
|
|
57624
57736
|
return Be(N, p.queryFout, false, p.logfile), i = true, i;
|
|
57625
57737
|
}
|
|
@@ -58657,20 +58769,20 @@ function Ce(n, u, C2) {
|
|
|
58657
58769
|
En(n, u, C2.encoding, C2.std_strings);
|
|
58658
58770
|
}
|
|
58659
58771
|
function $(n, ...u) {
|
|
58660
|
-
let C2 = "", U = 0,
|
|
58661
|
-
for (; (Y = n.indexOf("%",
|
|
58772
|
+
let C2 = "", U = 0, v2 = 0, Y;
|
|
58773
|
+
for (; (Y = n.indexOf("%", v2)) !== -1; ) {
|
|
58662
58774
|
let x = 0, z = false;
|
|
58663
|
-
C2 += n.slice(
|
|
58664
|
-
let X = n[
|
|
58775
|
+
C2 += n.slice(v2, Y), v2 = Y + 1;
|
|
58776
|
+
let X = n[v2++];
|
|
58665
58777
|
if (X === "%" && (C2 += "%"), X === "*" && (x = parseInt(
|
|
58666
58778
|
u[U++],
|
|
58667
58779
|
10
|
|
58668
|
-
), X = n[
|
|
58780
|
+
), X = n[v2++]), X === "-" && (z = true, X = n[v2++]), X >= "0" && X <= "9" && (x = parseInt(X, 10), X = n[v2++]), X === "s" || X === "c" || X === "d" || X === "u") {
|
|
58669
58781
|
const me = String(u[U++]), le = x - me.length;
|
|
58670
58782
|
z === false && le > 0 && (C2 += " ".repeat(le)), C2 += me, z === true && le > 0 && (C2 += " ".repeat(le));
|
|
58671
58783
|
}
|
|
58672
58784
|
}
|
|
58673
|
-
return C2 += n.slice(
|
|
58785
|
+
return C2 += n.slice(v2), C2;
|
|
58674
58786
|
}
|
|
58675
58787
|
const ln = $;
|
|
58676
58788
|
function Sn(n) {
|
|
@@ -58702,15 +58814,15 @@ function A(n, u, C2) {
|
|
|
58702
58814
|
return String(U === null ? "" : U);
|
|
58703
58815
|
}
|
|
58704
58816
|
function fe(n, u) {
|
|
58705
|
-
let C2, U,
|
|
58817
|
+
let C2, U, v2, Y, x;
|
|
58706
58818
|
if (!n || u == null || u[0] == null) return -1;
|
|
58707
|
-
for (C2 = false,
|
|
58819
|
+
for (C2 = false, v2 = "", U = 0, x = pe(u); U < x; U++) {
|
|
58708
58820
|
let z = u[U];
|
|
58709
|
-
C2 ? z == '"' ? u[U + 1] == '"' ? (
|
|
58821
|
+
C2 ? z == '"' ? u[U + 1] == '"' ? (v2 += '"', U++) : C2 = false : v2 += z : z == '"' ? C2 = true : (z = tn(
|
|
58710
58822
|
z
|
|
58711
|
-
),
|
|
58823
|
+
), v2 += z);
|
|
58712
58824
|
}
|
|
58713
|
-
for (Y = 0, x = On(n); Y < x; Y++) if (F(
|
|
58825
|
+
for (Y = 0, x = On(n); Y < x; Y++) if (F(v2, mn(n, Y)) == 0) return Y;
|
|
58714
58826
|
return -1;
|
|
58715
58827
|
}
|
|
58716
58828
|
function Ne(n, u, C2, U) {
|
|
@@ -58720,7 +58832,7 @@ function Ne(n, u, C2, U) {
|
|
|
58720
58832
|
}
|
|
58721
58833
|
function Oe(n, u, C2, U) {
|
|
58722
58834
|
if (u !== 0 && u !== 4) throw new Error(`scan type ${u} not implemented`);
|
|
58723
|
-
const
|
|
58835
|
+
const v2 = [], Y = /^(.*);*$/;
|
|
58724
58836
|
let x;
|
|
58725
58837
|
for (; ; ) {
|
|
58726
58838
|
if (x = n[0][n[1]], x == null)
|
|
@@ -58731,10 +58843,10 @@ function Oe(n, u, C2, U) {
|
|
|
58731
58843
|
if (u === 4) return n[0].slice(n[1], n[1] = n[0].length);
|
|
58732
58844
|
let z = "";
|
|
58733
58845
|
for (; ; ) {
|
|
58734
|
-
if (x = n[0][n[1]++], x == null) return
|
|
58735
|
-
if (ka(x)) x ===
|
|
58846
|
+
if (x = n[0][n[1]++], x == null) return v2.length > 0 ? null : z.match(Y)[1];
|
|
58847
|
+
if (ka(x)) x === v2[v2.length - 1] ? v2.pop() : v2.push(x), x === '"' && (z += x);
|
|
58736
58848
|
else {
|
|
58737
|
-
if (
|
|
58849
|
+
if (v2.length === 0 && Ln(x)) return z.match(Y)[1];
|
|
58738
58850
|
z += x;
|
|
58739
58851
|
}
|
|
58740
58852
|
}
|
|
@@ -62876,7 +62988,7 @@ function ReplTable({ result }) {
|
|
|
62876
62988
|
};
|
|
62877
62989
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
62878
62990
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "PGliteRepl-table-scroll", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "PGliteRepl-table", children: [
|
|
62879
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { children: result.fields.map((col
|
|
62991
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { children: result.fields.map((col) => /* @__PURE__ */ jsxRuntimeExports.jsx("th", { children: col.name }, col.name)) }) }),
|
|
62880
62992
|
/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: rows.map((row, i) => (
|
|
62881
62993
|
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
62882
62994
|
/* @__PURE__ */ jsxRuntimeExports.jsx("tr", { children: row.map((col, j) => (
|
|
@@ -62916,7 +63028,10 @@ function ReplResponse({
|
|
|
62916
63028
|
if (response.error) {
|
|
62917
63029
|
out = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "PGliteRepl-line PGliteRepl-error", children: response.error });
|
|
62918
63030
|
} else {
|
|
62919
|
-
out = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (_a2 = response.results) == null ? void 0 : _a2.map((result, i) =>
|
|
63031
|
+
out = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (_a2 = response.results) == null ? void 0 : _a2.map((result, i) => (
|
|
63032
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
63033
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OutLine, { result }, i)
|
|
63034
|
+
)) });
|
|
62920
63035
|
}
|
|
62921
63036
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
62922
63037
|
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "PGliteRepl-line PGliteRepl-query", children: response.query }),
|
|
@@ -63149,7 +63264,7 @@ const defaultLightTheme = githubLight;
|
|
|
63149
63264
|
const defaultDarkThemeInit = githubDarkInit;
|
|
63150
63265
|
const defaultDarkTheme = githubDark;
|
|
63151
63266
|
function Repl({
|
|
63152
|
-
pg,
|
|
63267
|
+
pg: pgProp,
|
|
63153
63268
|
border = false,
|
|
63154
63269
|
lightTheme = defaultLightTheme,
|
|
63155
63270
|
darkTheme: darkTheme2 = defaultDarkTheme,
|
|
@@ -63169,6 +63284,7 @@ function Repl({
|
|
|
63169
63284
|
theme2 === "dark" ? darkTheme2 : lightTheme
|
|
63170
63285
|
);
|
|
63171
63286
|
const [styles, setStyles] = reactExports.useState({});
|
|
63287
|
+
const pg = l$1(pgProp);
|
|
63172
63288
|
reactExports.useEffect(() => {
|
|
63173
63289
|
let ignore = false;
|
|
63174
63290
|
const init = async () => {
|