@marimo-team/islands 0.23.15-dev55 → 0.23.15-dev57
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/{ConnectedDataExplorerComponent-DMcymmpc.js → ConnectedDataExplorerComponent-CJaUI-S-.js} +3 -3
- package/dist/{any-language-editor-BfTj3PPF.js → any-language-editor-P9tjkj4n.js} +18 -18
- package/dist/{architectureDiagram-VXUJARFQ-B3jN8fkV.js → architectureDiagram-VXUJARFQ-DXwkyAaM.js} +5 -5
- package/dist/{blockDiagram-VD42YOAC-Dq_8lAbz.js → blockDiagram-VD42YOAC-CIOjvxeD.js} +5 -5
- package/dist/{c4Diagram-YG6GDRKO-BPzX9a9A.js → c4Diagram-YG6GDRKO-B6dZC_oU.js} +4 -4
- package/dist/{channel-D_qwSlm9.js → channel-BN070S0F.js} +1 -1
- package/dist/{chat-ui-CYGIiYqI.js → chat-ui-BdSDiVjk.js} +79 -74
- package/dist/{chunk-ABZYJK2D-CDSMdLBr.js → chunk-ABZYJK2D-BxBDji1u.js} +1 -1
- package/dist/{chunk-ATLVNIR6-BAW0e_d_.js → chunk-ATLVNIR6-qFiszptQ.js} +1 -1
- package/dist/{chunk-B4BG7PRW-CfEI05WL.js → chunk-B4BG7PRW-B_z2FEHm.js} +4 -4
- package/dist/{chunk-DI55MBZ5-CZS7hhjV.js → chunk-DI55MBZ5-D4Y8yV8B.js} +4 -4
- package/dist/{chunk-EXTU4WIE-DHwKB8ls.js → chunk-EXTU4WIE-BQPBhApE.js} +1 -1
- package/dist/{chunk-JA3XYJ7Z-Cy80gDpz.js → chunk-JA3XYJ7Z-CY4CRbV5.js} +2 -2
- package/dist/{chunk-JZLCHNYA-yfXq27Zq.js → chunk-JZLCHNYA-DWIR9m5O.js} +4 -4
- package/dist/{chunk-N4CR4FBY-C9D3Wsot.js → chunk-N4CR4FBY-Bw2HcMNc.js} +5 -5
- package/dist/{chunk-QN33PNHL-Bh2YDyg7.js → chunk-QN33PNHL-DPBNNzpR.js} +1 -1
- package/dist/{chunk-QXUST7PY-kDpsCDoY.js → chunk-QXUST7PY-DtC2t9Mk.js} +5 -5
- package/dist/{chunk-S3R3BYOJ-DkY8Kz3y.js → chunk-S3R3BYOJ-BdgLc8AM.js} +1 -1
- package/dist/{chunk-TZMSLE5B-CMZoW3vd.js → chunk-TZMSLE5B-BzSHcq-K.js} +1 -1
- package/dist/{classDiagram-2ON5EDUG-b2d3ZqfR.js → classDiagram-2ON5EDUG-BiQPjMNY.js} +10 -10
- package/dist/{classDiagram-v2-WZHVMYZB-RvnJbJ5M.js → classDiagram-v2-WZHVMYZB-YHdR8fqM.js} +10 -10
- package/dist/{code-visibility-6VwDeiPl.js → code-visibility-DDYb93Ql.js} +9 -9
- package/dist/{dagre-6UL2VRFP--ruFWg_S.js → dagre-6UL2VRFP-DpYjBqQs.js} +7 -7
- package/dist/{diagram-PSM6KHXK-CGakapLj.js → diagram-PSM6KHXK-D4ftnaua.js} +6 -6
- package/dist/{diagram-QEK2KX5R-CtqD8u_P.js → diagram-QEK2KX5R-DVlUOgs1.js} +4 -4
- package/dist/{diagram-S2PKOQOG-BS1wa35J.js → diagram-S2PKOQOG-CGh4OMEV.js} +4 -4
- package/dist/{dist-BGLXXYL4.js → dist-3NCqaWjt.js} +2 -2
- package/dist/{dist-95kpvRSY.js → dist-4lVIWUT3.js} +1 -1
- package/dist/dist-5o9uz19x.js +5 -0
- package/dist/{dist-B1k1NmGB.js → dist-B2jmQKKx.js} +2 -2
- package/dist/{dist-kcg3gjx6.js → dist-BCX980mU.js} +2 -2
- package/dist/{dist-c6wTyIhD.js → dist-BIEt-mlF.js} +1 -1
- package/dist/{dist-tJic1rC-.js → dist-BO5HRiTf.js} +2 -2
- package/dist/{dist-3MT9i_N5.js → dist-BOMbzyb3.js} +85 -85
- package/dist/{dist-Dx3eDsHX.js → dist-BP39XM8u.js} +1 -1
- package/dist/{dist-DijFs2Lk.js → dist-BPF0gTRZ.js} +6 -6
- package/dist/{dist-BvCrjp81.js → dist-BTdrwBWP.js} +22 -22
- package/dist/{dist-CLBjD8zw.js → dist-BdqCKQ1O.js} +2 -2
- package/dist/dist-BpDH0DEP.js +5 -0
- package/dist/dist-BpXhbQXO.js +8 -0
- package/dist/{dist-DgZczohI.js → dist-BpeiYpG2.js} +2 -2
- package/dist/{dist-Db1W16d-.js → dist-BwhXBwMd.js} +1 -1
- package/dist/dist-ByadAk_L.js +5 -0
- package/dist/{dist-B69xyr_D.js → dist-C18MUWTj.js} +2 -2
- package/dist/{dist-DPdzbDlL.js → dist-C2_4pjuS.js} +1 -1
- package/dist/{dist-B56Dml3A.js → dist-CFSb_Frm.js} +1 -1
- package/dist/dist-CK0g7JvP.js +8 -0
- package/dist/{dist-CNXNPADS.js → dist-CRmSjkLP.js} +2 -2
- package/dist/{dist-D3T8fCFo.js → dist-CSlJrrAw.js} +86 -81
- package/dist/dist-CfzCtiq2.js +5 -0
- package/dist/{dist-4-bJUNMb.js → dist-D3bdsa1d.js} +4 -4
- package/dist/dist-D8JtVFrW.js +8 -0
- package/dist/dist-DK2Oocpu.js +6 -0
- package/dist/{dist-DBN2w27P.js → dist-DZwp8lro.js} +3 -3
- package/dist/{dist-BFgLBSJb.js → dist-DaXJPX8F.js} +2 -2
- package/dist/{dist-U4F-tbMs.js → dist-De-GlSAs.js} +246 -184
- package/dist/{dist-DPH6RMhL.js → dist-DgjbnqTg.js} +125 -125
- package/dist/dist-DnSu977r.js +5 -0
- package/dist/{dist-e29IFSI0.js → dist-DviUBLUp.js} +4 -4
- package/dist/{dist-BIdzGb3O.js → dist-DwqBJ014.js} +2 -2
- package/dist/{dist-BGj6VvC-.js → dist-JGehap7K.js} +5 -5
- package/dist/{dist-BGtkYshf.js → dist-LpLXa9Lb.js} +2 -2
- package/dist/dist-UmxJm6sW.js +8 -0
- package/dist/dist-aYSBQSyM.js +5 -0
- package/dist/dist-kkZ1Ztlh.js +6 -0
- package/dist/dist-ngPczwNi.js +5 -0
- package/dist/{dist-C-RLuUaE.js → dist-pqIwD8VD.js} +2 -2
- package/dist/dist-wQRyxyTV.js +5 -0
- package/dist/{dist-DvOfvWFi.js → dist-w_gWE5Wf.js} +1 -1
- package/dist/{erDiagram-Q2GNP2WA-DmtIJBsT.js → erDiagram-Q2GNP2WA-BcKAHFqF.js} +10 -10
- package/dist/{esm-D6_uCZ4z.js → esm-DKOv6P2M.js} +341 -341
- package/dist/esm-k8PIvuZW.js +1180 -0
- package/dist/{extends-B88Yrunj.js → extends-Cq2JYHKy.js} +32 -16
- package/dist/{flowDiagram-NV44I4VS-DZsgBUcQ.js → flowDiagram-NV44I4VS-BRhSg-ro.js} +10 -10
- package/dist/{formats-DSfNdJLH.js → formats-BFhkZJwd.js} +1 -1
- package/dist/{ganttDiagram-JELNMOA3-CgFhg_6K.js → ganttDiagram-JELNMOA3-CXXCN7LN.js} +3 -3
- package/dist/{gitGraphDiagram-V2S2FVAM-DPInyn1F.js → gitGraphDiagram-V2S2FVAM-BOlkMSqK.js} +3 -3
- package/dist/{html-to-image-BoXPmWps.js → html-to-image-DDENewl2.js} +34 -34
- package/dist/{infoDiagram-HS3SLOUP-ETAzKIiE.js → infoDiagram-HS3SLOUP-D3TyKnL_.js} +3 -3
- package/dist/{journeyDiagram-XKPGCS4Q-Bc94zDj1.js → journeyDiagram-XKPGCS4Q-DEal0aT1.js} +3 -3
- package/dist/{kanban-definition-3W4ZIXB7-DSk8Ebci.js → kanban-definition-3W4ZIXB7-Dl90wENN.js} +7 -7
- package/dist/{loader-BUGT0KbC.js → loader-CTHCI-qe.js} +7 -7
- package/dist/main.js +31 -31
- package/dist/{mermaid-CYkbfJHW.js → mermaid-CdSvixW2.js} +36 -36
- package/dist/{mindmap-definition-VGOIOE7T-BYoCqVAJ.js → mindmap-definition-VGOIOE7T-CCDupjWW.js} +9 -9
- package/dist/{pieDiagram-ADFJNKIX-BaAU79Vb.js → pieDiagram-ADFJNKIX-JvXG_6hk.js} +4 -4
- package/dist/{process-output-CbRRhwQo.js → process-output-2QPcgBQg.js} +1 -1
- package/dist/purify.es-EnR5yhgI.js +783 -0
- package/dist/{quadrantDiagram-AYHSOK5B-BmTWJxzo.js → quadrantDiagram-AYHSOK5B-BqDB9tUC.js} +2 -2
- package/dist/{react-vega-DfJOSnj6.js → react-vega-BazDALhI.js} +633 -633
- package/dist/{requirementDiagram-UZGBJVZJ-Jrs04ua1.js → requirementDiagram-UZGBJVZJ-KbVt8SPH.js} +9 -9
- package/dist/{reveal-component-BF9bUh1w.js → reveal-component-C5pW80ik.js} +11 -11
- package/dist/{sankeyDiagram-TZEHDZUN-YJnhmG4N.js → sankeyDiagram-TZEHDZUN-DgkF38jx.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-D30L51Bn.js → sequenceDiagram-WL72ISMW-BDmx9n95.js} +4 -4
- package/dist/{stateDiagram-FKZM4ZOC-C0nZuUP8.js → stateDiagram-FKZM4ZOC-ByOvQf2n.js} +10 -10
- package/dist/{stateDiagram-v2-4FDKWEC3-BmovmS-G.js → stateDiagram-v2-4FDKWEC3-C3xqeavR.js} +10 -10
- package/dist/{timeline-definition-IT6M3QCI-DEoIEWAl.js → timeline-definition-IT6M3QCI-CkD_trIn.js} +2 -2
- package/dist/{vega-component-uL9ZaXcH.js → vega-component-CrFoZT1S.js} +4 -4
- package/dist/{vega-embed-container-DgZMMVL3.js → vega-embed-container-DAQAMjiO.js} +2 -2
- package/dist/vega-loader.browser-DmpxCJqx.js +1353 -0
- package/dist/{xychartDiagram-PRI3JC2R-iwKXEnYZ.js → xychartDiagram-PRI3JC2R-BSkNxYNw.js} +5 -5
- package/package.json +1 -1
- package/dist/dist-9yiSURLw.js +0 -6
- package/dist/dist-9zfbSqew.js +0 -8
- package/dist/dist-BZ_VEpg8.js +0 -8
- package/dist/dist-BdYVjH1C.js +0 -5
- package/dist/dist-BiIoKp92.js +0 -6
- package/dist/dist-Bow9AUXt.js +0 -5
- package/dist/dist-C8odMDp5.js +0 -8
- package/dist/dist-CLgjZx38.js +0 -5
- package/dist/dist-CnMOJtGP.js +0 -5
- package/dist/dist-D-5m1nDT.js +0 -5
- package/dist/dist-D8AXqiCV.js +0 -5
- package/dist/dist-DMuf8sZd.js +0 -5
- package/dist/dist-DszXOVSb.js +0 -5
- package/dist/dist-GW0m0q65.js +0 -8
- package/dist/esm-BxhNWHqh.js +0 -1171
- package/dist/purify.es-C-fIGuQm.js +0 -557
- package/dist/vega-loader.browser-IU8eTDwM.js +0 -1333
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
2
|
+
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
3
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
|
|
4
|
+
import { l as historyKeymap, o as defaultKeymap, r as lintKeymap, s as history, t as _extends, u as indentWithTab } from "./extends-Cq2JYHKy.js";
|
|
5
|
+
import { $ as EditorView, At as EditorState, C as foldKeymap, Ct as crelt, Dt as CharCategory, F as syntaxHighlighting, Ft as RangeSetBuilder, Gt as findClusterBreak, H as tags, Ht as codePointSize, Kt as fromCodePoint, Lt as StateEffect, Nt as Prec, Rt as StateField, Ut as combineConfig, Vt as codePointAt, Z as Decoration, _t as placeholder, a as HighlightStyle, at as drawSelection, bt as showDialog, dt as highlightActiveLineGutter, ft as highlightSpecialChars, g as defaultHighlightStyle, ht as lineNumbers, it as crosshairCursor, j as indentUnit, jt as Facet, k as indentOnInput, kt as EditorSelection, mt as keymap, ot as dropCursor, p as bracketMatching, st as getPanel, tt as ViewPlugin, ut as highlightActiveLine, vt as rectangularSelection, wt as Annotation, x as foldGutter, xt as showPanel, yt as runScopeHandlers } from "./dist-De-GlSAs.js";
|
|
6
|
+
import { a as closeBracketsKeymap, c as completionKeymap, i as closeBrackets, r as autocompletion } from "./dist-CSlJrrAw.js";
|
|
7
|
+
var basicNormalize = typeof String.prototype.normalize == "function" ? (e2) => e2.normalize("NFKD") : (e2) => e2, SearchCursor = class {
|
|
8
|
+
constructor(e2, y, b = 0, x = e2.length, S, C) {
|
|
9
|
+
this.test = C, this.value = {
|
|
10
|
+
from: 0,
|
|
11
|
+
to: 0,
|
|
12
|
+
precise: false
|
|
13
|
+
}, this.done = false, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e2.iterRange(b, x), this.bufferStart = b, this.normalize = S ? (e3) => S(basicNormalize(e3)) : basicNormalize, this.query = this.normalize(y);
|
|
14
|
+
}
|
|
15
|
+
peek() {
|
|
16
|
+
if (this.bufferPos == this.buffer.length) {
|
|
17
|
+
if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) return -1;
|
|
18
|
+
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
19
|
+
}
|
|
20
|
+
return codePointAt(this.buffer, this.bufferPos);
|
|
21
|
+
}
|
|
22
|
+
next() {
|
|
23
|
+
for (; this.matches.length; ) this.matches.pop();
|
|
24
|
+
return this.nextOverlapping();
|
|
25
|
+
}
|
|
26
|
+
nextOverlapping() {
|
|
27
|
+
for (; ; ) {
|
|
28
|
+
let e2 = this.peek();
|
|
29
|
+
if (e2 < 0) return this.done = true, this;
|
|
30
|
+
let y = fromCodePoint(e2), b = this.bufferStart + this.bufferPos;
|
|
31
|
+
this.bufferPos += codePointSize(e2);
|
|
32
|
+
let x = this.normalize(y);
|
|
33
|
+
if (x.length) for (let e3 = 0, S = b, C = true; ; e3++) {
|
|
34
|
+
let b2 = x.charCodeAt(e3), w = this.match(b2, S, C, this.bufferPos + this.bufferStart, e3 == x.length - 1);
|
|
35
|
+
if (w) return this.value = w, this;
|
|
36
|
+
if (e3 == x.length - 1) break;
|
|
37
|
+
C && e3 < y.length && y.charCodeAt(e3) == b2 ? S++ : C = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
match(e2, y, b, x, S) {
|
|
42
|
+
let C = null;
|
|
43
|
+
for (let y2 = 0; y2 < this.matches.length; ) {
|
|
44
|
+
let b2 = this.matches[y2], w = false;
|
|
45
|
+
this.query.charCodeAt(b2.index) == e2 && (b2.index == this.query.length - 1 ? C = {
|
|
46
|
+
from: b2.from,
|
|
47
|
+
to: x,
|
|
48
|
+
precise: S && b2.precise
|
|
49
|
+
} : (b2.index++, w = true)), w ? y2++ : this.matches.splice(y2, 1);
|
|
50
|
+
}
|
|
51
|
+
return this.query.charCodeAt(0) == e2 && (this.query.length == 1 ? C = {
|
|
52
|
+
from: y,
|
|
53
|
+
to: x,
|
|
54
|
+
precise: b && S
|
|
55
|
+
} : this.matches.push({
|
|
56
|
+
from: y,
|
|
57
|
+
index: 1,
|
|
58
|
+
precise: b
|
|
59
|
+
})), C && this.test && !this.test(C.from, C.to, this.buffer, this.bufferStart) && (C = null), C;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
typeof Symbol < "u" && (SearchCursor.prototype[Symbol.iterator] = function() {
|
|
63
|
+
return this;
|
|
64
|
+
});
|
|
65
|
+
var empty = {
|
|
66
|
+
from: -1,
|
|
67
|
+
to: -1,
|
|
68
|
+
match: /* @__PURE__ */ /.*/.exec(""),
|
|
69
|
+
precise: true
|
|
70
|
+
}, baseFlags = "gm" + (/x/.unicode == null ? "" : "u"), RegExpCursor = class {
|
|
71
|
+
constructor(e2, y, b, x = 0, S = e2.length) {
|
|
72
|
+
if (this.text = e2, this.to = S, this.curLine = "", this.done = false, this.value = empty, /\\[sWDnr]|\n|\r|\[\^/.test(y)) return new MultilineRegExpCursor(e2, y, b, x, S);
|
|
73
|
+
this.re = new RegExp(y, baseFlags + ((b == null ? void 0 : b.ignoreCase) ? "i" : "")), this.test = b == null ? void 0 : b.test, this.iter = e2.iter(), this.curLineStart = e2.lineAt(x).from, this.matchPos = toCharEnd(e2, x), this.getLine(this.curLineStart);
|
|
74
|
+
}
|
|
75
|
+
getLine(e2) {
|
|
76
|
+
this.iter.next(e2), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
77
|
+
}
|
|
78
|
+
nextLine() {
|
|
79
|
+
this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
|
|
80
|
+
}
|
|
81
|
+
next() {
|
|
82
|
+
for (let e2 = this.matchPos - this.curLineStart; ; ) {
|
|
83
|
+
this.re.lastIndex = e2;
|
|
84
|
+
let y = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
85
|
+
if (y) {
|
|
86
|
+
let b = this.curLineStart + y.index, x = b + y[0].length;
|
|
87
|
+
if (this.matchPos = toCharEnd(this.text, x + (b == x ? 1 : 0)), b == this.curLineStart + this.curLine.length && this.nextLine(), (b < x || b > this.value.to) && (!this.test || this.test(b, x, y))) return this.value = {
|
|
88
|
+
from: b,
|
|
89
|
+
to: x,
|
|
90
|
+
precise: true,
|
|
91
|
+
match: y
|
|
92
|
+
}, this;
|
|
93
|
+
e2 = this.matchPos - this.curLineStart;
|
|
94
|
+
} else if (this.curLineStart + this.curLine.length < this.to) this.nextLine(), e2 = 0;
|
|
95
|
+
else return this.done = true, this;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, flattened = /* @__PURE__ */ new WeakMap(), FlattenedDoc = class e {
|
|
99
|
+
constructor(e2, y) {
|
|
100
|
+
this.from = e2, this.text = y;
|
|
101
|
+
}
|
|
102
|
+
get to() {
|
|
103
|
+
return this.from + this.text.length;
|
|
104
|
+
}
|
|
105
|
+
static get(y, b, x) {
|
|
106
|
+
let S = flattened.get(y);
|
|
107
|
+
if (!S || S.from >= x || S.to <= b) {
|
|
108
|
+
let S2 = new e(b, y.sliceString(b, x));
|
|
109
|
+
return flattened.set(y, S2), S2;
|
|
110
|
+
}
|
|
111
|
+
if (S.from == b && S.to == x) return S;
|
|
112
|
+
let { text: C, from: w } = S;
|
|
113
|
+
return w > b && (C = y.sliceString(b, w) + C, w = b), S.to < x && (C += y.sliceString(S.to, x)), flattened.set(y, new e(w, C)), new e(b, C.slice(b - w, x - w));
|
|
114
|
+
}
|
|
115
|
+
}, MultilineRegExpCursor = class {
|
|
116
|
+
constructor(e2, y, b, x, S) {
|
|
117
|
+
this.text = e2, this.to = S, this.done = false, this.value = empty, this.matchPos = toCharEnd(e2, x), this.re = new RegExp(y, baseFlags + ((b == null ? void 0 : b.ignoreCase) ? "i" : "")), this.test = b == null ? void 0 : b.test, this.flat = FlattenedDoc.get(e2, x, this.chunkEnd(x + 5e3));
|
|
118
|
+
}
|
|
119
|
+
chunkEnd(e2) {
|
|
120
|
+
return e2 >= this.to ? this.to : this.text.lineAt(e2).to;
|
|
121
|
+
}
|
|
122
|
+
next() {
|
|
123
|
+
for (; ; ) {
|
|
124
|
+
let e2 = this.re.lastIndex = this.matchPos - this.flat.from, y = this.re.exec(this.flat.text);
|
|
125
|
+
if (y && !y[0] && y.index == e2 && (this.re.lastIndex = e2 + 1, y = this.re.exec(this.flat.text)), y) {
|
|
126
|
+
let e3 = this.flat.from + y.index, b = e3 + y[0].length;
|
|
127
|
+
if ((this.flat.to >= this.to || y.index + y[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e3, b, y))) return this.value = {
|
|
128
|
+
from: e3,
|
|
129
|
+
to: b,
|
|
130
|
+
precise: true,
|
|
131
|
+
match: y
|
|
132
|
+
}, this.matchPos = toCharEnd(this.text, b + (e3 == b ? 1 : 0)), this;
|
|
133
|
+
}
|
|
134
|
+
if (this.flat.to == this.to) return this.done = true, this;
|
|
135
|
+
this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
typeof Symbol < "u" && (RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = function() {
|
|
140
|
+
return this;
|
|
141
|
+
});
|
|
142
|
+
function validRegExp(e2) {
|
|
143
|
+
try {
|
|
144
|
+
return new RegExp(e2, baseFlags), true;
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function toCharEnd(e2, y) {
|
|
150
|
+
if (y >= e2.length) return y;
|
|
151
|
+
let b = e2.lineAt(y), x;
|
|
152
|
+
for (; y < b.to && (x = b.text.charCodeAt(y - b.from)) >= 56320 && x < 57344; ) y++;
|
|
153
|
+
return y;
|
|
154
|
+
}
|
|
155
|
+
var gotoLine = (e2) => {
|
|
156
|
+
let { state: y } = e2, b = String(y.doc.lineAt(e2.state.selection.main.head).number), { close: x, result: S } = showDialog(e2, {
|
|
157
|
+
label: y.phrase("Go to line"),
|
|
158
|
+
input: {
|
|
159
|
+
type: "text",
|
|
160
|
+
name: "line",
|
|
161
|
+
value: b
|
|
162
|
+
},
|
|
163
|
+
focus: true,
|
|
164
|
+
submitLabel: y.phrase("go")
|
|
165
|
+
});
|
|
166
|
+
return S.then((b2) => {
|
|
167
|
+
let S2 = b2 && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(b2.elements.line.value);
|
|
168
|
+
if (!S2) {
|
|
169
|
+
e2.dispatch({ effects: x });
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
let C = y.doc.lineAt(y.selection.main.head), [, w, T, E, O] = S2, k = E ? +E.slice(1) : 0, A = T ? +T : C.number;
|
|
173
|
+
if (T && O) {
|
|
174
|
+
let e3 = A / 100;
|
|
175
|
+
w && (e3 = e3 * (w == "-" ? -1 : 1) + C.number / y.doc.lines), A = Math.round(y.doc.lines * e3);
|
|
176
|
+
} else T && w && (A = A * (w == "-" ? -1 : 1) + C.number);
|
|
177
|
+
let j = y.doc.line(Math.max(1, Math.min(y.doc.lines, A))), M = EditorSelection.cursor(j.from + Math.max(0, Math.min(k, j.length)));
|
|
178
|
+
e2.dispatch({
|
|
179
|
+
effects: [x, EditorView.scrollIntoView(M.from, { y: "center" })],
|
|
180
|
+
selection: M
|
|
181
|
+
});
|
|
182
|
+
}), true;
|
|
183
|
+
}, defaultHighlightOptions = {
|
|
184
|
+
highlightWordAroundCursor: false,
|
|
185
|
+
minSelectionLength: 1,
|
|
186
|
+
maxMatches: 100,
|
|
187
|
+
wholeWords: false
|
|
188
|
+
}, highlightConfig = /* @__PURE__ */ Facet.define({ combine(e2) {
|
|
189
|
+
return combineConfig(e2, defaultHighlightOptions, {
|
|
190
|
+
highlightWordAroundCursor: (e3, y) => e3 || y,
|
|
191
|
+
minSelectionLength: Math.min,
|
|
192
|
+
maxMatches: Math.min
|
|
193
|
+
});
|
|
194
|
+
} });
|
|
195
|
+
function highlightSelectionMatches(e2) {
|
|
196
|
+
let y = [defaultTheme, matchHighlighter];
|
|
197
|
+
return e2 && y.push(highlightConfig.of(e2)), y;
|
|
198
|
+
}
|
|
199
|
+
var matchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch" }), mainMatchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
200
|
+
function insideWordBoundaries(e2, y, b, x) {
|
|
201
|
+
return (b == 0 || e2(y.sliceDoc(b - 1, b)) != CharCategory.Word) && (x == y.doc.length || e2(y.sliceDoc(x, x + 1)) != CharCategory.Word);
|
|
202
|
+
}
|
|
203
|
+
function insideWord(e2, y, b, x) {
|
|
204
|
+
return e2(y.sliceDoc(b, b + 1)) == CharCategory.Word && e2(y.sliceDoc(x - 1, x)) == CharCategory.Word;
|
|
205
|
+
}
|
|
206
|
+
var matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
207
|
+
constructor(e2) {
|
|
208
|
+
this.decorations = this.getDeco(e2);
|
|
209
|
+
}
|
|
210
|
+
update(e2) {
|
|
211
|
+
(e2.selectionSet || e2.docChanged || e2.viewportChanged) && (this.decorations = this.getDeco(e2.view));
|
|
212
|
+
}
|
|
213
|
+
getDeco(e2) {
|
|
214
|
+
let y = e2.state.facet(highlightConfig), { state: b } = e2, x = b.selection;
|
|
215
|
+
if (x.ranges.length > 1) return Decoration.none;
|
|
216
|
+
let S = x.main, C, w = null;
|
|
217
|
+
if (S.empty) {
|
|
218
|
+
if (!y.highlightWordAroundCursor) return Decoration.none;
|
|
219
|
+
let e3 = b.wordAt(S.head);
|
|
220
|
+
if (!e3) return Decoration.none;
|
|
221
|
+
w = b.charCategorizer(S.head), C = b.sliceDoc(e3.from, e3.to);
|
|
222
|
+
} else {
|
|
223
|
+
let e3 = S.to - S.from;
|
|
224
|
+
if (e3 < y.minSelectionLength || e3 > 200) return Decoration.none;
|
|
225
|
+
if (y.wholeWords) {
|
|
226
|
+
if (C = b.sliceDoc(S.from, S.to), w = b.charCategorizer(S.head), !(insideWordBoundaries(w, b, S.from, S.to) && insideWord(w, b, S.from, S.to))) return Decoration.none;
|
|
227
|
+
} else if (C = b.sliceDoc(S.from, S.to), !C) return Decoration.none;
|
|
228
|
+
}
|
|
229
|
+
let T = [];
|
|
230
|
+
for (let x2 of e2.visibleRanges) {
|
|
231
|
+
let e3 = new SearchCursor(b.doc, C, x2.from, x2.to);
|
|
232
|
+
for (; !e3.next().done; ) {
|
|
233
|
+
let { from: x3, to: C2 } = e3.value;
|
|
234
|
+
if ((!w || insideWordBoundaries(w, b, x3, C2)) && (S.empty && x3 <= S.from && C2 >= S.to ? T.push(mainMatchDeco.range(x3, C2)) : (x3 >= S.to || C2 <= S.from) && T.push(matchDeco.range(x3, C2)), T.length > y.maxMatches)) return Decoration.none;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return Decoration.set(T);
|
|
238
|
+
}
|
|
239
|
+
}, { decorations: (e2) => e2.decorations }), defaultTheme = /* @__PURE__ */ EditorView.baseTheme({
|
|
240
|
+
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
241
|
+
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
242
|
+
}), selectWord = ({ state: e2, dispatch: y }) => {
|
|
243
|
+
let { selection: b } = e2, x = EditorSelection.create(b.ranges.map((y2) => e2.wordAt(y2.head) || EditorSelection.cursor(y2.head)), b.mainIndex);
|
|
244
|
+
return x.eq(b) ? false : (y(e2.update({ selection: x })), true);
|
|
245
|
+
};
|
|
246
|
+
function findNextOccurrence(e2, y) {
|
|
247
|
+
let { main: b, ranges: x } = e2.selection, S = e2.wordAt(b.head), C = S && S.from == b.from && S.to == b.to;
|
|
248
|
+
for (let b2 = false, S2 = new SearchCursor(e2.doc, y, x[x.length - 1].to); ; ) if (S2.next(), S2.done) {
|
|
249
|
+
if (b2) return null;
|
|
250
|
+
S2 = new SearchCursor(e2.doc, y, 0, Math.max(0, x[x.length - 1].from - 1)), b2 = true;
|
|
251
|
+
} else {
|
|
252
|
+
if (b2 && x.some((e3) => e3.from == S2.value.from)) continue;
|
|
253
|
+
if (C) {
|
|
254
|
+
let y2 = e2.wordAt(S2.value.from);
|
|
255
|
+
if (!y2 || y2.from != S2.value.from || y2.to != S2.value.to) continue;
|
|
256
|
+
}
|
|
257
|
+
return S2.value;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
var selectNextOccurrence = ({ state: e2, dispatch: y }) => {
|
|
261
|
+
let { ranges: b } = e2.selection;
|
|
262
|
+
if (b.some((e3) => e3.from === e3.to)) return selectWord({
|
|
263
|
+
state: e2,
|
|
264
|
+
dispatch: y
|
|
265
|
+
});
|
|
266
|
+
let x = e2.sliceDoc(b[0].from, b[0].to);
|
|
267
|
+
if (e2.selection.ranges.some((y2) => e2.sliceDoc(y2.from, y2.to) != x)) return false;
|
|
268
|
+
let S = findNextOccurrence(e2, x);
|
|
269
|
+
return S ? (y(e2.update({
|
|
270
|
+
selection: e2.selection.addRange(EditorSelection.range(S.from, S.to), false),
|
|
271
|
+
effects: EditorView.scrollIntoView(S.to)
|
|
272
|
+
})), true) : false;
|
|
273
|
+
}, searchConfigFacet = /* @__PURE__ */ Facet.define({ combine(e2) {
|
|
274
|
+
return combineConfig(e2, {
|
|
275
|
+
top: false,
|
|
276
|
+
caseSensitive: false,
|
|
277
|
+
literal: false,
|
|
278
|
+
regexp: false,
|
|
279
|
+
wholeWord: false,
|
|
280
|
+
createPanel: (e3) => new SearchPanel(e3),
|
|
281
|
+
scrollToMatch: (e3) => EditorView.scrollIntoView(e3)
|
|
282
|
+
});
|
|
283
|
+
} }), SearchQuery = class {
|
|
284
|
+
constructor(e2) {
|
|
285
|
+
this.search = e2.search, this.caseSensitive = !!e2.caseSensitive, this.literal = !!e2.literal, this.regexp = !!e2.regexp, this.replace = e2.replace || "", this.valid = !!this.search && (!this.regexp || validRegExp(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e2.wholeWord, this.test = e2.test;
|
|
286
|
+
}
|
|
287
|
+
unquote(e2) {
|
|
288
|
+
return this.literal ? e2 : e2.replace(/\\([nrt\\])/g, (e3, y) => y == "n" ? "\n" : y == "r" ? "\r" : y == "t" ? " " : "\\");
|
|
289
|
+
}
|
|
290
|
+
eq(e2) {
|
|
291
|
+
return this.search == e2.search && this.replace == e2.replace && this.caseSensitive == e2.caseSensitive && this.regexp == e2.regexp && this.wholeWord == e2.wholeWord && this.test == e2.test;
|
|
292
|
+
}
|
|
293
|
+
create() {
|
|
294
|
+
return this.regexp ? new RegExpQuery(this) : new StringQuery(this);
|
|
295
|
+
}
|
|
296
|
+
getCursor(e2, y = 0, b) {
|
|
297
|
+
let x = e2.doc ? e2 : EditorState.create({ doc: e2 });
|
|
298
|
+
return b ?? (b = x.doc.length), this.regexp ? regexpCursor(this, x, y, b) : stringCursor(this, x, y, b);
|
|
299
|
+
}
|
|
300
|
+
}, QueryType = class {
|
|
301
|
+
constructor(e2) {
|
|
302
|
+
this.spec = e2;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
function wrapStringTest(e2, y, b) {
|
|
306
|
+
return (x, S, C, w) => b && !b(x, S, C, w) ? false : e2(x >= w && S <= w + C.length ? C.slice(x - w, S - w) : y.doc.sliceString(x, S), y, x, S);
|
|
307
|
+
}
|
|
308
|
+
function stringCursor(e2, y, b, x) {
|
|
309
|
+
let S;
|
|
310
|
+
return e2.wholeWord && (S = stringWordTest(y.doc, y.charCategorizer(y.selection.main.head))), e2.test && (S = wrapStringTest(e2.test, y, S)), new SearchCursor(y.doc, e2.unquoted, b, x, e2.caseSensitive ? void 0 : (e3) => e3.toLowerCase(), S);
|
|
311
|
+
}
|
|
312
|
+
function stringWordTest(e2, y) {
|
|
313
|
+
return (b, x, S, C) => ((C > b || C + S.length < x) && (C = Math.max(0, b - 2), S = e2.sliceString(C, Math.min(e2.length, x + 2))), (y(charBefore(S, b - C)) != CharCategory.Word || y(charAfter(S, b - C)) != CharCategory.Word) && (y(charAfter(S, x - C)) != CharCategory.Word || y(charBefore(S, x - C)) != CharCategory.Word));
|
|
314
|
+
}
|
|
315
|
+
var StringQuery = class extends QueryType {
|
|
316
|
+
constructor(e2) {
|
|
317
|
+
super(e2);
|
|
318
|
+
}
|
|
319
|
+
nextMatch(e2, y, b) {
|
|
320
|
+
let x = stringCursor(this.spec, e2, b, e2.doc.length).nextOverlapping();
|
|
321
|
+
if (x.done) {
|
|
322
|
+
let b2 = Math.min(e2.doc.length, y + this.spec.unquoted.length);
|
|
323
|
+
x = stringCursor(this.spec, e2, 0, b2).nextOverlapping();
|
|
324
|
+
}
|
|
325
|
+
return x.done || x.value.from == y && x.value.to == b ? null : x.value;
|
|
326
|
+
}
|
|
327
|
+
prevMatchInRange(e2, y, b) {
|
|
328
|
+
for (let x = b; ; ) {
|
|
329
|
+
let b2 = Math.max(y, x - 1e4 - this.spec.unquoted.length), S = stringCursor(this.spec, e2, b2, x), C = null;
|
|
330
|
+
for (; !S.nextOverlapping().done; ) C = S.value;
|
|
331
|
+
if (C) return C;
|
|
332
|
+
if (b2 == y) return null;
|
|
333
|
+
x -= 1e4;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
prevMatch(e2, y, b) {
|
|
337
|
+
let x = this.prevMatchInRange(e2, 0, y);
|
|
338
|
+
return x || (x = this.prevMatchInRange(e2, Math.max(0, b - this.spec.unquoted.length), e2.doc.length)), x && (x.from != y || x.to != b) ? x : null;
|
|
339
|
+
}
|
|
340
|
+
getReplacement(e2) {
|
|
341
|
+
return this.spec.unquote(this.spec.replace);
|
|
342
|
+
}
|
|
343
|
+
matchAll(e2, y) {
|
|
344
|
+
let b = stringCursor(this.spec, e2, 0, e2.doc.length), x = [];
|
|
345
|
+
for (; !b.next().done; ) {
|
|
346
|
+
if (x.length >= y) return null;
|
|
347
|
+
x.push(b.value);
|
|
348
|
+
}
|
|
349
|
+
return x;
|
|
350
|
+
}
|
|
351
|
+
highlight(e2, y, b, x) {
|
|
352
|
+
let S = stringCursor(this.spec, e2, Math.max(0, y - this.spec.unquoted.length), Math.min(b + this.spec.unquoted.length, e2.doc.length));
|
|
353
|
+
for (; !S.next().done; ) x(S.value.from, S.value.to);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
function wrapRegexpTest(e2, y, b) {
|
|
357
|
+
return (x, S, C) => (!b || b(x, S, C)) && e2(C[0], y, x, S);
|
|
358
|
+
}
|
|
359
|
+
function regexpCursor(e2, y, b, x) {
|
|
360
|
+
let S;
|
|
361
|
+
return e2.wholeWord && (S = regexpWordTest(y.charCategorizer(y.selection.main.head))), e2.test && (S = wrapRegexpTest(e2.test, y, S)), new RegExpCursor(y.doc, e2.search, {
|
|
362
|
+
ignoreCase: !e2.caseSensitive,
|
|
363
|
+
test: S
|
|
364
|
+
}, b, x);
|
|
365
|
+
}
|
|
366
|
+
function charBefore(e2, y) {
|
|
367
|
+
return e2.slice(findClusterBreak(e2, y, false), y);
|
|
368
|
+
}
|
|
369
|
+
function charAfter(e2, y) {
|
|
370
|
+
return e2.slice(y, findClusterBreak(e2, y));
|
|
371
|
+
}
|
|
372
|
+
function regexpWordTest(e2) {
|
|
373
|
+
return (y, b, x) => !x[0].length || (e2(charBefore(x.input, x.index)) != CharCategory.Word || e2(charAfter(x.input, x.index)) != CharCategory.Word) && (e2(charAfter(x.input, x.index + x[0].length)) != CharCategory.Word || e2(charBefore(x.input, x.index + x[0].length)) != CharCategory.Word);
|
|
374
|
+
}
|
|
375
|
+
var RegExpQuery = class extends QueryType {
|
|
376
|
+
nextMatch(e2, y, b) {
|
|
377
|
+
let x = regexpCursor(this.spec, e2, b, e2.doc.length).next();
|
|
378
|
+
return x.done && (x = regexpCursor(this.spec, e2, 0, y).next()), x.done ? null : x.value;
|
|
379
|
+
}
|
|
380
|
+
prevMatchInRange(e2, y, b) {
|
|
381
|
+
for (let x = 1; ; x++) {
|
|
382
|
+
let S = Math.max(y, b - x * 1e4), C = regexpCursor(this.spec, e2, S, b), w = null;
|
|
383
|
+
for (; !C.next().done; ) w = C.value;
|
|
384
|
+
if (w && (S == y || w.from > S + 10)) return w;
|
|
385
|
+
if (S == y) return null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
prevMatch(e2, y, b) {
|
|
389
|
+
return this.prevMatchInRange(e2, 0, y) || this.prevMatchInRange(e2, b, e2.doc.length);
|
|
390
|
+
}
|
|
391
|
+
getReplacement(e2) {
|
|
392
|
+
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (y, b) => {
|
|
393
|
+
if (b == "&") return e2.match[0];
|
|
394
|
+
if (b == "$") return "$";
|
|
395
|
+
for (let y2 = b.length; y2 > 0; y2--) {
|
|
396
|
+
let x = +b.slice(0, y2);
|
|
397
|
+
if (x > 0 && x < e2.match.length) return e2.match[x] + b.slice(y2);
|
|
398
|
+
}
|
|
399
|
+
return y;
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
matchAll(e2, y) {
|
|
403
|
+
let b = regexpCursor(this.spec, e2, 0, e2.doc.length), x = [];
|
|
404
|
+
for (; !b.next().done; ) {
|
|
405
|
+
if (x.length >= y) return null;
|
|
406
|
+
x.push(b.value);
|
|
407
|
+
}
|
|
408
|
+
return x;
|
|
409
|
+
}
|
|
410
|
+
highlight(e2, y, b, x) {
|
|
411
|
+
let S = regexpCursor(this.spec, e2, Math.max(0, y - 250), Math.min(b + 250, e2.doc.length));
|
|
412
|
+
for (; !S.next().done; ) x(S.value.from, S.value.to);
|
|
413
|
+
}
|
|
414
|
+
}, setSearchQuery = /* @__PURE__ */ StateEffect.define(), togglePanel = /* @__PURE__ */ StateEffect.define(), searchState = /* @__PURE__ */ StateField.define({
|
|
415
|
+
create(e2) {
|
|
416
|
+
return new SearchState(defaultQuery(e2).create(), null);
|
|
417
|
+
},
|
|
418
|
+
update(e2, y) {
|
|
419
|
+
for (let b of y.effects) b.is(setSearchQuery) ? e2 = new SearchState(b.value.create(), e2.panel) : b.is(togglePanel) && (e2 = new SearchState(e2.query, b.value ? createSearchPanel : null));
|
|
420
|
+
return e2;
|
|
421
|
+
},
|
|
422
|
+
provide: (e2) => showPanel.from(e2, (e3) => e3.panel)
|
|
423
|
+
}), SearchState = class {
|
|
424
|
+
constructor(e2, y) {
|
|
425
|
+
this.query = e2, this.panel = y;
|
|
426
|
+
}
|
|
427
|
+
}, matchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
428
|
+
constructor(e2) {
|
|
429
|
+
this.view = e2, this.decorations = this.highlight(e2.state.field(searchState));
|
|
430
|
+
}
|
|
431
|
+
update(e2) {
|
|
432
|
+
let y = e2.state.field(searchState);
|
|
433
|
+
(y != e2.startState.field(searchState) || e2.docChanged || e2.selectionSet || e2.viewportChanged) && (this.decorations = this.highlight(y));
|
|
434
|
+
}
|
|
435
|
+
highlight({ query: e2, panel: y }) {
|
|
436
|
+
if (!y || !e2.spec.valid) return Decoration.none;
|
|
437
|
+
let { view: b } = this, x = new RangeSetBuilder();
|
|
438
|
+
for (let y2 = 0, S = b.visibleRanges, C = S.length; y2 < C; y2++) {
|
|
439
|
+
let { from: w, to: T } = S[y2];
|
|
440
|
+
for (; y2 < C - 1 && T > S[y2 + 1].from - 500; ) T = S[++y2].to;
|
|
441
|
+
e2.highlight(b.state, w, T, (e3, y3) => {
|
|
442
|
+
let S2 = b.state.selection.ranges.some((b2) => b2.from == e3 && b2.to == y3);
|
|
443
|
+
x.add(e3, y3, S2 ? selectedMatchMark : matchMark);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return x.finish();
|
|
447
|
+
}
|
|
448
|
+
}, { decorations: (e2) => e2.decorations });
|
|
449
|
+
function searchCommand(e2) {
|
|
450
|
+
return (y) => {
|
|
451
|
+
let b = y.state.field(searchState, false);
|
|
452
|
+
return b && b.query.spec.valid ? e2(y, b) : openSearchPanel(y);
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
var findNext = /* @__PURE__ */ searchCommand((e2, { query: y }) => {
|
|
456
|
+
let { to: b } = e2.state.selection.main, x = y.nextMatch(e2.state, b, b);
|
|
457
|
+
if (!x) return false;
|
|
458
|
+
let S = EditorSelection.single(x.from, x.to), C = e2.state.facet(searchConfigFacet);
|
|
459
|
+
return e2.dispatch({
|
|
460
|
+
selection: S,
|
|
461
|
+
effects: [announceMatch(e2, x), C.scrollToMatch(S.main, e2)],
|
|
462
|
+
userEvent: "select.search"
|
|
463
|
+
}), selectSearchInput(e2), true;
|
|
464
|
+
}), findPrevious = /* @__PURE__ */ searchCommand((e2, { query: y }) => {
|
|
465
|
+
let { state: b } = e2, { from: x } = b.selection.main, S = y.prevMatch(b, x, x);
|
|
466
|
+
if (!S) return false;
|
|
467
|
+
let C = EditorSelection.single(S.from, S.to), w = e2.state.facet(searchConfigFacet);
|
|
468
|
+
return e2.dispatch({
|
|
469
|
+
selection: C,
|
|
470
|
+
effects: [announceMatch(e2, S), w.scrollToMatch(C.main, e2)],
|
|
471
|
+
userEvent: "select.search"
|
|
472
|
+
}), selectSearchInput(e2), true;
|
|
473
|
+
}), selectMatches = /* @__PURE__ */ searchCommand((e2, { query: y }) => {
|
|
474
|
+
let b = y.matchAll(e2.state, 1e3);
|
|
475
|
+
return !b || !b.length ? false : (e2.dispatch({
|
|
476
|
+
selection: EditorSelection.create(b.map((e3) => EditorSelection.range(e3.from, e3.to))),
|
|
477
|
+
userEvent: "select.search.matches"
|
|
478
|
+
}), true);
|
|
479
|
+
}), selectSelectionMatches = ({ state: e2, dispatch: y }) => {
|
|
480
|
+
let b = e2.selection;
|
|
481
|
+
if (b.ranges.length > 1 || b.main.empty) return false;
|
|
482
|
+
let { from: x, to: S } = b.main, C = [], w = 0;
|
|
483
|
+
for (let y2 = new SearchCursor(e2.doc, e2.sliceDoc(x, S)); !y2.next().done; ) {
|
|
484
|
+
if (C.length > 1e3) return false;
|
|
485
|
+
y2.value.from == x && (w = C.length), C.push(EditorSelection.range(y2.value.from, y2.value.to));
|
|
486
|
+
}
|
|
487
|
+
return y(e2.update({
|
|
488
|
+
selection: EditorSelection.create(C, w),
|
|
489
|
+
userEvent: "select.search.matches"
|
|
490
|
+
})), true;
|
|
491
|
+
}, replaceNext = /* @__PURE__ */ searchCommand((e2, { query: y }) => {
|
|
492
|
+
let { state: b } = e2, { from: x, to: S } = b.selection.main;
|
|
493
|
+
if (b.readOnly) return false;
|
|
494
|
+
let C = y.nextMatch(b, x, x);
|
|
495
|
+
if (!C) return false;
|
|
496
|
+
let w = C, T = [], E, O, k = [];
|
|
497
|
+
w.precise ? w.from == x && w.to == S && (O = b.toText(y.getReplacement(w)), T.push({
|
|
498
|
+
from: w.from,
|
|
499
|
+
to: w.to,
|
|
500
|
+
insert: O
|
|
501
|
+
}), w = y.nextMatch(b, w.from, w.to), k.push(EditorView.announce.of(b.phrase("replaced match on line $", b.doc.lineAt(x).number) + "."))) : w = y.nextMatch(b, w.from, w.to);
|
|
502
|
+
let A = e2.state.changes(T);
|
|
503
|
+
return w && (E = EditorSelection.single(w.from, w.to).map(A), k.push(announceMatch(e2, w)), k.push(b.facet(searchConfigFacet).scrollToMatch(E.main, e2))), e2.dispatch({
|
|
504
|
+
changes: A,
|
|
505
|
+
selection: E,
|
|
506
|
+
effects: k,
|
|
507
|
+
userEvent: "input.replace"
|
|
508
|
+
}), true;
|
|
509
|
+
}), replaceAll = /* @__PURE__ */ searchCommand((e2, { query: y }) => {
|
|
510
|
+
if (e2.state.readOnly) return false;
|
|
511
|
+
let b = [];
|
|
512
|
+
for (let x2 of y.matchAll(e2.state, 1e9)) {
|
|
513
|
+
let { from: e3, to: S, precise: C } = x2;
|
|
514
|
+
C && b.push({
|
|
515
|
+
from: e3,
|
|
516
|
+
to: S,
|
|
517
|
+
insert: y.getReplacement(x2)
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (!b.length) return false;
|
|
521
|
+
let x = e2.state.phrase("replaced $ matches", b.length) + ".";
|
|
522
|
+
return e2.dispatch({
|
|
523
|
+
changes: b,
|
|
524
|
+
effects: EditorView.announce.of(x),
|
|
525
|
+
userEvent: "input.replace.all"
|
|
526
|
+
}), true;
|
|
527
|
+
});
|
|
528
|
+
function createSearchPanel(e2) {
|
|
529
|
+
return e2.state.facet(searchConfigFacet).createPanel(e2);
|
|
530
|
+
}
|
|
531
|
+
function defaultQuery(e2, y) {
|
|
532
|
+
let b = e2.selection.main, x = b.empty || b.to > b.from + 100 ? "" : e2.sliceDoc(b.from, b.to);
|
|
533
|
+
if (y && !x) return y;
|
|
534
|
+
let S = e2.facet(searchConfigFacet);
|
|
535
|
+
return new SearchQuery({
|
|
536
|
+
search: (y == null ? void 0 : y.literal) ?? S.literal ? x : x.replace(/\n/g, "\\n"),
|
|
537
|
+
caseSensitive: (y == null ? void 0 : y.caseSensitive) ?? S.caseSensitive,
|
|
538
|
+
literal: (y == null ? void 0 : y.literal) ?? S.literal,
|
|
539
|
+
regexp: (y == null ? void 0 : y.regexp) ?? S.regexp,
|
|
540
|
+
wholeWord: (y == null ? void 0 : y.wholeWord) ?? S.wholeWord
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
function getSearchInput(e2) {
|
|
544
|
+
let y = getPanel(e2, createSearchPanel);
|
|
545
|
+
return y && y.dom.querySelector("[main-field]");
|
|
546
|
+
}
|
|
547
|
+
function selectSearchInput(e2) {
|
|
548
|
+
let y = getSearchInput(e2);
|
|
549
|
+
y && y == e2.root.activeElement && y.select();
|
|
550
|
+
}
|
|
551
|
+
var openSearchPanel = (e2) => {
|
|
552
|
+
let y = e2.state.field(searchState, false);
|
|
553
|
+
if (y && y.panel) {
|
|
554
|
+
let b = getSearchInput(e2);
|
|
555
|
+
if (b && b != e2.root.activeElement) {
|
|
556
|
+
let x = defaultQuery(e2.state, y.query.spec);
|
|
557
|
+
x.valid && e2.dispatch({ effects: setSearchQuery.of(x) }), b.focus(), b.select();
|
|
558
|
+
}
|
|
559
|
+
} else e2.dispatch({ effects: [togglePanel.of(true), y ? setSearchQuery.of(defaultQuery(e2.state, y.query.spec)) : StateEffect.appendConfig.of(searchExtensions)] });
|
|
560
|
+
return true;
|
|
561
|
+
}, closeSearchPanel = (e2) => {
|
|
562
|
+
let y = e2.state.field(searchState, false);
|
|
563
|
+
if (!y || !y.panel) return false;
|
|
564
|
+
let b = getPanel(e2, createSearchPanel);
|
|
565
|
+
return b && b.dom.contains(e2.root.activeElement) && e2.focus(), e2.dispatch({ effects: togglePanel.of(false) }), true;
|
|
566
|
+
}, searchKeymap = [
|
|
567
|
+
{
|
|
568
|
+
key: "Mod-f",
|
|
569
|
+
run: openSearchPanel,
|
|
570
|
+
scope: "editor search-panel"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
key: "F3",
|
|
574
|
+
run: findNext,
|
|
575
|
+
shift: findPrevious,
|
|
576
|
+
scope: "editor search-panel",
|
|
577
|
+
preventDefault: true
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
key: "Mod-g",
|
|
581
|
+
run: findNext,
|
|
582
|
+
shift: findPrevious,
|
|
583
|
+
scope: "editor search-panel",
|
|
584
|
+
preventDefault: true
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
key: "Escape",
|
|
588
|
+
run: closeSearchPanel,
|
|
589
|
+
scope: "editor search-panel"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
key: "Mod-Shift-l",
|
|
593
|
+
run: selectSelectionMatches
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: "Mod-Alt-g",
|
|
597
|
+
run: gotoLine
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
key: "Mod-d",
|
|
601
|
+
run: selectNextOccurrence,
|
|
602
|
+
preventDefault: true
|
|
603
|
+
}
|
|
604
|
+
], SearchPanel = class {
|
|
605
|
+
constructor(e2) {
|
|
606
|
+
this.view = e2;
|
|
607
|
+
let y = this.query = e2.state.field(searchState).query.spec;
|
|
608
|
+
this.commit = this.commit.bind(this), this.searchField = crelt("input", {
|
|
609
|
+
value: y.search,
|
|
610
|
+
placeholder: phrase(e2, "Find"),
|
|
611
|
+
"aria-label": phrase(e2, "Find"),
|
|
612
|
+
class: "cm-textfield",
|
|
613
|
+
name: "search",
|
|
614
|
+
form: "",
|
|
615
|
+
"main-field": "true",
|
|
616
|
+
onchange: this.commit,
|
|
617
|
+
onkeyup: this.commit
|
|
618
|
+
}), this.replaceField = crelt("input", {
|
|
619
|
+
value: y.replace,
|
|
620
|
+
placeholder: phrase(e2, "Replace"),
|
|
621
|
+
"aria-label": phrase(e2, "Replace"),
|
|
622
|
+
class: "cm-textfield",
|
|
623
|
+
name: "replace",
|
|
624
|
+
form: "",
|
|
625
|
+
onchange: this.commit,
|
|
626
|
+
onkeyup: this.commit
|
|
627
|
+
}), this.caseField = crelt("input", {
|
|
628
|
+
type: "checkbox",
|
|
629
|
+
name: "case",
|
|
630
|
+
form: "",
|
|
631
|
+
checked: y.caseSensitive,
|
|
632
|
+
onchange: this.commit
|
|
633
|
+
}), this.reField = crelt("input", {
|
|
634
|
+
type: "checkbox",
|
|
635
|
+
name: "re",
|
|
636
|
+
form: "",
|
|
637
|
+
checked: y.regexp,
|
|
638
|
+
onchange: this.commit
|
|
639
|
+
}), this.wordField = crelt("input", {
|
|
640
|
+
type: "checkbox",
|
|
641
|
+
name: "word",
|
|
642
|
+
form: "",
|
|
643
|
+
checked: y.wholeWord,
|
|
644
|
+
onchange: this.commit
|
|
645
|
+
});
|
|
646
|
+
function b(e3, y2, b2) {
|
|
647
|
+
return crelt("button", {
|
|
648
|
+
class: "cm-button",
|
|
649
|
+
name: e3,
|
|
650
|
+
onclick: y2,
|
|
651
|
+
type: "button"
|
|
652
|
+
}, b2);
|
|
653
|
+
}
|
|
654
|
+
this.dom = crelt("div", {
|
|
655
|
+
onkeydown: (e3) => this.keydown(e3),
|
|
656
|
+
class: "cm-search"
|
|
657
|
+
}, [
|
|
658
|
+
this.searchField,
|
|
659
|
+
b("next", () => findNext(e2), [phrase(e2, "next")]),
|
|
660
|
+
b("prev", () => findPrevious(e2), [phrase(e2, "previous")]),
|
|
661
|
+
b("select", () => selectMatches(e2), [phrase(e2, "all")]),
|
|
662
|
+
crelt("label", null, [this.caseField, phrase(e2, "match case")]),
|
|
663
|
+
crelt("label", null, [this.reField, phrase(e2, "regexp")]),
|
|
664
|
+
crelt("label", null, [this.wordField, phrase(e2, "by word")]),
|
|
665
|
+
...e2.state.readOnly ? [] : [
|
|
666
|
+
crelt("br"),
|
|
667
|
+
this.replaceField,
|
|
668
|
+
b("replace", () => replaceNext(e2), [phrase(e2, "replace")]),
|
|
669
|
+
b("replaceAll", () => replaceAll(e2), [phrase(e2, "replace all")])
|
|
670
|
+
],
|
|
671
|
+
crelt("button", {
|
|
672
|
+
name: "close",
|
|
673
|
+
onclick: () => closeSearchPanel(e2),
|
|
674
|
+
"aria-label": phrase(e2, "close"),
|
|
675
|
+
type: "button"
|
|
676
|
+
}, ["\xD7"])
|
|
677
|
+
]);
|
|
678
|
+
}
|
|
679
|
+
commit() {
|
|
680
|
+
let e2 = new SearchQuery({
|
|
681
|
+
search: this.searchField.value,
|
|
682
|
+
caseSensitive: this.caseField.checked,
|
|
683
|
+
regexp: this.reField.checked,
|
|
684
|
+
wholeWord: this.wordField.checked,
|
|
685
|
+
replace: this.replaceField.value
|
|
686
|
+
});
|
|
687
|
+
e2.eq(this.query) || (this.query = e2, this.view.dispatch({ effects: setSearchQuery.of(e2) }));
|
|
688
|
+
}
|
|
689
|
+
keydown(e2) {
|
|
690
|
+
runScopeHandlers(this.view, e2, "search-panel") ? e2.preventDefault() : e2.keyCode == 13 && e2.target == this.searchField ? (e2.preventDefault(), (e2.shiftKey ? findPrevious : findNext)(this.view)) : e2.keyCode == 13 && e2.target == this.replaceField && (e2.preventDefault(), replaceNext(this.view));
|
|
691
|
+
}
|
|
692
|
+
update(e2) {
|
|
693
|
+
for (let y of e2.transactions) for (let e3 of y.effects) e3.is(setSearchQuery) && !e3.value.eq(this.query) && this.setQuery(e3.value);
|
|
694
|
+
}
|
|
695
|
+
setQuery(e2) {
|
|
696
|
+
this.query = e2, this.searchField.value = e2.search, this.replaceField.value = e2.replace, this.caseField.checked = e2.caseSensitive, this.reField.checked = e2.regexp, this.wordField.checked = e2.wholeWord;
|
|
697
|
+
}
|
|
698
|
+
mount() {
|
|
699
|
+
this.searchField.select();
|
|
700
|
+
}
|
|
701
|
+
get pos() {
|
|
702
|
+
return 80;
|
|
703
|
+
}
|
|
704
|
+
get top() {
|
|
705
|
+
return this.view.state.facet(searchConfigFacet).top;
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
function phrase(e2, y) {
|
|
709
|
+
return e2.state.phrase(y);
|
|
710
|
+
}
|
|
711
|
+
var AnnounceMargin = 30, Break = /[\s\.,:;?!]/;
|
|
712
|
+
function announceMatch(e2, { from: y, to: b }) {
|
|
713
|
+
let x = e2.state.doc.lineAt(y), S = e2.state.doc.lineAt(b).to, C = Math.max(x.from, y - AnnounceMargin), w = Math.min(S, b + AnnounceMargin), T = e2.state.sliceDoc(C, w);
|
|
714
|
+
if (C != x.from) {
|
|
715
|
+
for (let e3 = 0; e3 < AnnounceMargin; e3++) if (!Break.test(T[e3 + 1]) && Break.test(T[e3])) {
|
|
716
|
+
T = T.slice(e3);
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if (w != S) {
|
|
721
|
+
for (let e3 = T.length - 1; e3 > T.length - AnnounceMargin; e3--) if (!Break.test(T[e3 - 1]) && Break.test(T[e3])) {
|
|
722
|
+
T = T.slice(0, e3);
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return EditorView.announce.of(`${e2.state.phrase("current match")}. ${T} ${e2.state.phrase("on line")} ${x.number}.`);
|
|
727
|
+
}
|
|
728
|
+
var baseTheme = /* @__PURE__ */ EditorView.baseTheme({
|
|
729
|
+
".cm-panel.cm-search": {
|
|
730
|
+
padding: "2px 6px 4px",
|
|
731
|
+
position: "relative",
|
|
732
|
+
"& [name=close]": {
|
|
733
|
+
position: "absolute",
|
|
734
|
+
top: "0",
|
|
735
|
+
right: "4px",
|
|
736
|
+
backgroundColor: "inherit",
|
|
737
|
+
border: "none",
|
|
738
|
+
font: "inherit",
|
|
739
|
+
padding: 0,
|
|
740
|
+
margin: 0
|
|
741
|
+
},
|
|
742
|
+
"& input, & button, & label": { margin: ".2em .6em .2em 0" },
|
|
743
|
+
"& input[type=checkbox]": { marginRight: ".2em" },
|
|
744
|
+
"& label": {
|
|
745
|
+
fontSize: "80%",
|
|
746
|
+
whiteSpace: "pre"
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
"&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
|
|
750
|
+
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
751
|
+
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
752
|
+
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
753
|
+
}), searchExtensions = [
|
|
754
|
+
searchState,
|
|
755
|
+
/* @__PURE__ */ Prec.low(searchHighlighter),
|
|
756
|
+
baseTheme
|
|
757
|
+
];
|
|
758
|
+
function _objectWithoutPropertiesLoose(e2, y) {
|
|
759
|
+
if (e2 == null) return {};
|
|
760
|
+
var b = {};
|
|
761
|
+
for (var x in e2) if ({}.hasOwnProperty.call(e2, x)) {
|
|
762
|
+
if (y.indexOf(x) !== -1) continue;
|
|
763
|
+
b[x] = e2[x];
|
|
764
|
+
}
|
|
765
|
+
return b;
|
|
766
|
+
}
|
|
767
|
+
var basicSetup = function(e2) {
|
|
768
|
+
e2 === void 0 && (e2 = {});
|
|
769
|
+
var { crosshairCursor: y = false } = e2, b = [];
|
|
770
|
+
e2.closeBracketsKeymap !== false && (b = b.concat(closeBracketsKeymap)), e2.defaultKeymap !== false && (b = b.concat(defaultKeymap)), e2.searchKeymap !== false && (b = b.concat(searchKeymap)), e2.historyKeymap !== false && (b = b.concat(historyKeymap)), e2.foldKeymap !== false && (b = b.concat(foldKeymap)), e2.completionKeymap !== false && (b = b.concat(completionKeymap)), e2.lintKeymap !== false && (b = b.concat(lintKeymap));
|
|
771
|
+
var T = [];
|
|
772
|
+
return e2.lineNumbers !== false && T.push(lineNumbers()), e2.highlightActiveLineGutter !== false && T.push(highlightActiveLineGutter()), e2.highlightSpecialChars !== false && T.push(highlightSpecialChars()), e2.history !== false && T.push(history()), e2.foldGutter !== false && T.push(foldGutter()), e2.drawSelection !== false && T.push(drawSelection()), e2.dropCursor !== false && T.push(dropCursor()), e2.allowMultipleSelections !== false && T.push(EditorState.allowMultipleSelections.of(true)), e2.indentOnInput !== false && T.push(indentOnInput()), e2.syntaxHighlighting !== false && T.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), e2.bracketMatching !== false && T.push(bracketMatching()), e2.closeBrackets !== false && T.push(closeBrackets()), e2.autocompletion !== false && T.push(autocompletion()), e2.rectangularSelection !== false && T.push(rectangularSelection()), y !== false && T.push(crosshairCursor()), e2.highlightActiveLine !== false && T.push(highlightActiveLine()), e2.highlightSelectionMatches !== false && T.push(highlightSelectionMatches()), e2.tabSize && typeof e2.tabSize == "number" && T.push(indentUnit.of(" ".repeat(e2.tabSize))), T.concat([keymap.of(b.flat())]).filter(Boolean);
|
|
773
|
+
}, minimalSetup = function(e2) {
|
|
774
|
+
e2 === void 0 && (e2 = {});
|
|
775
|
+
var y = [];
|
|
776
|
+
e2.defaultKeymap !== false && (y = y.concat(defaultKeymap)), e2.historyKeymap !== false && (y = y.concat(historyKeymap));
|
|
777
|
+
var b = [];
|
|
778
|
+
return e2.highlightSpecialChars !== false && b.push(highlightSpecialChars()), e2.history !== false && b.push(history()), e2.drawSelection !== false && b.push(drawSelection()), e2.syntaxHighlighting !== false && b.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), b.concat([keymap.of(y.flat())]).filter(Boolean);
|
|
779
|
+
}, chalky = "#e5c07b", coral = "#e06c75", cyan = "#56b6c2", invalid = "#ffffff", ivory = "#abb2bf", stone = "#7d8799", malibu = "#61afef", sage = "#98c379", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#2c313a", background = "#282c34", tooltipBackground = "#353a42", selection = "#3E4451", cursor = "#528bff", oneDark = [/* @__PURE__ */ EditorView.theme({
|
|
780
|
+
"&": {
|
|
781
|
+
color: ivory,
|
|
782
|
+
backgroundColor: background
|
|
783
|
+
},
|
|
784
|
+
".cm-content": { caretColor: cursor },
|
|
785
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
|
|
786
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
|
|
787
|
+
".cm-panels": {
|
|
788
|
+
backgroundColor: darkBackground,
|
|
789
|
+
color: ivory
|
|
790
|
+
},
|
|
791
|
+
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
792
|
+
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
793
|
+
".cm-searchMatch": {
|
|
794
|
+
backgroundColor: "#72a1ff59",
|
|
795
|
+
outline: "1px solid #457dff"
|
|
796
|
+
},
|
|
797
|
+
".cm-searchMatch.cm-searchMatch-selected": { backgroundColor: "#6199ff2f" },
|
|
798
|
+
".cm-activeLine": { backgroundColor: "#6699ff0b" },
|
|
799
|
+
".cm-selectionMatch": { backgroundColor: "#aafe661a" },
|
|
800
|
+
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bad0f847" },
|
|
801
|
+
".cm-gutters": {
|
|
802
|
+
backgroundColor: background,
|
|
803
|
+
color: stone,
|
|
804
|
+
border: "none"
|
|
805
|
+
},
|
|
806
|
+
".cm-activeLineGutter": { backgroundColor: highlightBackground },
|
|
807
|
+
".cm-foldPlaceholder": {
|
|
808
|
+
backgroundColor: "transparent",
|
|
809
|
+
border: "none",
|
|
810
|
+
color: "#ddd"
|
|
811
|
+
},
|
|
812
|
+
".cm-tooltip": {
|
|
813
|
+
border: "none",
|
|
814
|
+
backgroundColor: tooltipBackground
|
|
815
|
+
},
|
|
816
|
+
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
817
|
+
borderTopColor: "transparent",
|
|
818
|
+
borderBottomColor: "transparent"
|
|
819
|
+
},
|
|
820
|
+
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
821
|
+
borderTopColor: tooltipBackground,
|
|
822
|
+
borderBottomColor: tooltipBackground
|
|
823
|
+
},
|
|
824
|
+
".cm-tooltip-autocomplete": { "& > ul > li[aria-selected]": {
|
|
825
|
+
backgroundColor: highlightBackground,
|
|
826
|
+
color: ivory
|
|
827
|
+
} }
|
|
828
|
+
}, { dark: true }), /* @__PURE__ */ syntaxHighlighting(/* @__PURE__ */ HighlightStyle.define([
|
|
829
|
+
{
|
|
830
|
+
tag: tags.keyword,
|
|
831
|
+
color: violet
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
tag: [
|
|
835
|
+
tags.name,
|
|
836
|
+
tags.deleted,
|
|
837
|
+
tags.character,
|
|
838
|
+
tags.propertyName,
|
|
839
|
+
tags.macroName
|
|
840
|
+
],
|
|
841
|
+
color: coral
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
tag: [/* @__PURE__ */ tags.function(tags.variableName), tags.labelName],
|
|
845
|
+
color: malibu
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
tag: [
|
|
849
|
+
tags.color,
|
|
850
|
+
/* @__PURE__ */ tags.constant(tags.name),
|
|
851
|
+
/* @__PURE__ */ tags.standard(tags.name)
|
|
852
|
+
],
|
|
853
|
+
color: whiskey
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
tag: [/* @__PURE__ */ tags.definition(tags.name), tags.separator],
|
|
857
|
+
color: ivory
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
tag: [
|
|
861
|
+
tags.typeName,
|
|
862
|
+
tags.className,
|
|
863
|
+
tags.number,
|
|
864
|
+
tags.changed,
|
|
865
|
+
tags.annotation,
|
|
866
|
+
tags.modifier,
|
|
867
|
+
tags.self,
|
|
868
|
+
tags.namespace
|
|
869
|
+
],
|
|
870
|
+
color: chalky
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
tag: [
|
|
874
|
+
tags.operator,
|
|
875
|
+
tags.operatorKeyword,
|
|
876
|
+
tags.url,
|
|
877
|
+
tags.escape,
|
|
878
|
+
tags.regexp,
|
|
879
|
+
tags.link,
|
|
880
|
+
/* @__PURE__ */ tags.special(tags.string)
|
|
881
|
+
],
|
|
882
|
+
color: cyan
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
tag: [tags.meta, tags.comment],
|
|
886
|
+
color: stone
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
tag: tags.strong,
|
|
890
|
+
fontWeight: "bold"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
tag: tags.emphasis,
|
|
894
|
+
fontStyle: "italic"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
tag: tags.strikethrough,
|
|
898
|
+
textDecoration: "line-through"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
tag: tags.link,
|
|
902
|
+
color: stone,
|
|
903
|
+
textDecoration: "underline"
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
tag: tags.heading,
|
|
907
|
+
fontWeight: "bold",
|
|
908
|
+
color: coral
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
tag: [
|
|
912
|
+
tags.atom,
|
|
913
|
+
tags.bool,
|
|
914
|
+
/* @__PURE__ */ tags.special(tags.variableName)
|
|
915
|
+
],
|
|
916
|
+
color: whiskey
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
tag: [
|
|
920
|
+
tags.processingInstruction,
|
|
921
|
+
tags.string,
|
|
922
|
+
tags.inserted
|
|
923
|
+
],
|
|
924
|
+
color: sage
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
tag: tags.invalid,
|
|
928
|
+
color: invalid
|
|
929
|
+
}
|
|
930
|
+
]))], defaultLightThemeOption = EditorView.theme({ "&": { backgroundColor: "#fff" } }, { dark: false }), getDefaultExtensions = function(e2) {
|
|
931
|
+
e2 === void 0 && (e2 = {});
|
|
932
|
+
var { indentWithTab: y = true, editable: b = true, readOnly: x = false, theme: S = "light", placeholder: C = "", basicSetup: w = true } = e2, T = [];
|
|
933
|
+
switch (y && T.unshift(keymap.of([indentWithTab])), w && (typeof w == "boolean" ? T.unshift(basicSetup()) : T.unshift(basicSetup(w))), C && T.unshift(placeholder(C)), S) {
|
|
934
|
+
case "light":
|
|
935
|
+
T.push(defaultLightThemeOption);
|
|
936
|
+
break;
|
|
937
|
+
case "dark":
|
|
938
|
+
T.push(oneDark);
|
|
939
|
+
break;
|
|
940
|
+
case "none":
|
|
941
|
+
break;
|
|
942
|
+
default:
|
|
943
|
+
T.push(S);
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
946
|
+
return b === false && T.push(EditorView.editable.of(false)), x && T.push(EditorState.readOnly.of(true)), [...T];
|
|
947
|
+
}, getStatistics = (e2) => ({
|
|
948
|
+
line: e2.state.doc.lineAt(e2.state.selection.main.from),
|
|
949
|
+
lineCount: e2.state.doc.lines,
|
|
950
|
+
lineBreak: e2.state.lineBreak,
|
|
951
|
+
length: e2.state.doc.length,
|
|
952
|
+
readOnly: e2.state.readOnly,
|
|
953
|
+
tabSize: e2.state.tabSize,
|
|
954
|
+
selection: e2.state.selection,
|
|
955
|
+
selectionAsSingle: e2.state.selection.asSingle().main,
|
|
956
|
+
ranges: e2.state.selection.ranges,
|
|
957
|
+
selectionCode: e2.state.sliceDoc(e2.state.selection.main.from, e2.state.selection.main.to),
|
|
958
|
+
selections: e2.state.selection.ranges.map((y) => e2.state.sliceDoc(y.from, y.to)),
|
|
959
|
+
selectedText: e2.state.selection.ranges.some((e3) => !e3.empty)
|
|
960
|
+
}), TimeoutLatch = class {
|
|
961
|
+
constructor(e2, y) {
|
|
962
|
+
this.timeLeftMS = void 0, this.timeoutMS = void 0, this.isCancelled = false, this.isTimeExhausted = false, this.callbacks = [], this.timeLeftMS = y, this.timeoutMS = y, this.callbacks.push(e2);
|
|
963
|
+
}
|
|
964
|
+
tick() {
|
|
965
|
+
if (!this.isCancelled && !this.isTimeExhausted && (this.timeLeftMS--, this.timeLeftMS <= 0)) {
|
|
966
|
+
this.isTimeExhausted = true;
|
|
967
|
+
var e2 = this.callbacks.slice();
|
|
968
|
+
this.callbacks.length = 0, e2.forEach((e3) => {
|
|
969
|
+
try {
|
|
970
|
+
e3();
|
|
971
|
+
} catch (e4) {
|
|
972
|
+
console.error("TimeoutLatch callback error:", e4);
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
cancel() {
|
|
978
|
+
this.isCancelled = true, this.callbacks.length = 0;
|
|
979
|
+
}
|
|
980
|
+
reset() {
|
|
981
|
+
this.timeLeftMS = this.timeoutMS, this.isCancelled = false, this.isTimeExhausted = false;
|
|
982
|
+
}
|
|
983
|
+
get isDone() {
|
|
984
|
+
return this.isCancelled || this.isTimeExhausted;
|
|
985
|
+
}
|
|
986
|
+
}, Scheduler = class {
|
|
987
|
+
constructor() {
|
|
988
|
+
this.interval = null, this.latches = /* @__PURE__ */ new Set();
|
|
989
|
+
}
|
|
990
|
+
add(e2) {
|
|
991
|
+
this.latches.add(e2), this.start();
|
|
992
|
+
}
|
|
993
|
+
remove(e2) {
|
|
994
|
+
this.latches.delete(e2), this.latches.size === 0 && this.stop();
|
|
995
|
+
}
|
|
996
|
+
start() {
|
|
997
|
+
this.interval === null && (this.interval = setInterval(() => {
|
|
998
|
+
this.latches.forEach((e2) => {
|
|
999
|
+
e2.tick(), e2.isDone && this.remove(e2);
|
|
1000
|
+
});
|
|
1001
|
+
}, 1));
|
|
1002
|
+
}
|
|
1003
|
+
stop() {
|
|
1004
|
+
this.interval !== null && (clearInterval(this.interval), this.interval = null);
|
|
1005
|
+
}
|
|
1006
|
+
}, globalScheduler = null, getScheduler = () => typeof window > "u" ? new Scheduler() : (globalScheduler || (globalScheduler = new Scheduler()), globalScheduler), import_react = /* @__PURE__ */ __toESM(require_react()), ExternalChange = Annotation.define(), TYPING_TIMOUT = 200, emptyExtensions = [];
|
|
1007
|
+
function useCodeMirror(e2) {
|
|
1008
|
+
var { value: y, selection: b, onChange: x, onStatistics: S, onCreateEditor: C, onUpdate: w, extensions: T = emptyExtensions, autoFocus: E, theme: k = "light", height: A = null, minHeight: j = null, maxHeight: M = null, width: N = null, minWidth: P = null, maxWidth: F = null, placeholder: I = "", editable: L = true, readOnly: z = false, indentWithTab: B = true, basicSetup: V = true, root: H, initialState: U } = e2, [W, G] = (0, import_react.useState)(), [K, q] = (0, import_react.useState)(), [J, Y] = (0, import_react.useState)(), X = (0, import_react.useState)(() => ({ current: null }))[0], Z = (0, import_react.useState)(() => ({ current: null }))[0], Q = EditorView.theme({
|
|
1009
|
+
"&": {
|
|
1010
|
+
height: A,
|
|
1011
|
+
minHeight: j,
|
|
1012
|
+
maxHeight: M,
|
|
1013
|
+
width: N,
|
|
1014
|
+
minWidth: P,
|
|
1015
|
+
maxWidth: F
|
|
1016
|
+
},
|
|
1017
|
+
"& .cm-scroller": { height: "100% !important" }
|
|
1018
|
+
}), $ = [
|
|
1019
|
+
EditorView.updateListener.of((e3) => {
|
|
1020
|
+
e3.docChanged && typeof x == "function" && !e3.transactions.some((e4) => e4.annotation(ExternalChange)) && (X.current ? X.current.reset() : (X.current = new TimeoutLatch(() => {
|
|
1021
|
+
if (Z.current) {
|
|
1022
|
+
var e4 = Z.current;
|
|
1023
|
+
Z.current = null, e4();
|
|
1024
|
+
}
|
|
1025
|
+
X.current = null;
|
|
1026
|
+
}, TYPING_TIMOUT), getScheduler().add(X.current)), x(e3.state.doc.toString(), e3)), S && S(getStatistics(e3));
|
|
1027
|
+
}),
|
|
1028
|
+
Q,
|
|
1029
|
+
...getDefaultExtensions({
|
|
1030
|
+
theme: k,
|
|
1031
|
+
editable: L,
|
|
1032
|
+
readOnly: z,
|
|
1033
|
+
placeholder: I,
|
|
1034
|
+
indentWithTab: B,
|
|
1035
|
+
basicSetup: V
|
|
1036
|
+
})
|
|
1037
|
+
];
|
|
1038
|
+
return w && typeof w == "function" && $.push(EditorView.updateListener.of(w)), $ = $.concat(T), (0, import_react.useLayoutEffect)(() => {
|
|
1039
|
+
if (W && !J) {
|
|
1040
|
+
var e3 = {
|
|
1041
|
+
doc: y,
|
|
1042
|
+
selection: b,
|
|
1043
|
+
extensions: $
|
|
1044
|
+
}, x2 = U ? EditorState.fromJSON(U.json, e3, U.fields) : EditorState.create(e3);
|
|
1045
|
+
if (Y(x2), !K) {
|
|
1046
|
+
var S2 = new EditorView({
|
|
1047
|
+
state: x2,
|
|
1048
|
+
parent: W,
|
|
1049
|
+
root: H
|
|
1050
|
+
});
|
|
1051
|
+
q(S2), C && C(S2, x2);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return () => {
|
|
1055
|
+
K && (Y(void 0), q(void 0));
|
|
1056
|
+
};
|
|
1057
|
+
}, [W, J]), (0, import_react.useEffect)(() => {
|
|
1058
|
+
e2.container && G(e2.container);
|
|
1059
|
+
}, [e2.container]), (0, import_react.useEffect)(() => () => {
|
|
1060
|
+
K && (K.destroy(), q(void 0)), X.current && (X.current = (X.current.cancel(), null));
|
|
1061
|
+
}, [K]), (0, import_react.useEffect)(() => {
|
|
1062
|
+
E && K && K.focus();
|
|
1063
|
+
}, [E, K]), (0, import_react.useEffect)(() => {
|
|
1064
|
+
K && K.dispatch({ effects: StateEffect.reconfigure.of($) });
|
|
1065
|
+
}, [
|
|
1066
|
+
k,
|
|
1067
|
+
T,
|
|
1068
|
+
A,
|
|
1069
|
+
j,
|
|
1070
|
+
M,
|
|
1071
|
+
N,
|
|
1072
|
+
P,
|
|
1073
|
+
F,
|
|
1074
|
+
I,
|
|
1075
|
+
L,
|
|
1076
|
+
z,
|
|
1077
|
+
B,
|
|
1078
|
+
V,
|
|
1079
|
+
x,
|
|
1080
|
+
w
|
|
1081
|
+
]), (0, import_react.useEffect)(() => {
|
|
1082
|
+
if (y !== void 0) {
|
|
1083
|
+
var e3 = K ? K.state.doc.toString() : "";
|
|
1084
|
+
if (K && y !== e3) {
|
|
1085
|
+
var b2 = X.current && !X.current.isDone, x2 = () => {
|
|
1086
|
+
K && y !== K.state.doc.toString() && K.dispatch({
|
|
1087
|
+
changes: {
|
|
1088
|
+
from: 0,
|
|
1089
|
+
to: K.state.doc.toString().length,
|
|
1090
|
+
insert: y || ""
|
|
1091
|
+
},
|
|
1092
|
+
annotations: [ExternalChange.of(true)]
|
|
1093
|
+
});
|
|
1094
|
+
};
|
|
1095
|
+
b2 ? Z.current = x2 : x2();
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}, [y, K]), {
|
|
1099
|
+
state: J,
|
|
1100
|
+
setState: Y,
|
|
1101
|
+
view: K,
|
|
1102
|
+
setView: q,
|
|
1103
|
+
container: W,
|
|
1104
|
+
setContainer: G
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime()), _excluded = [
|
|
1108
|
+
"className",
|
|
1109
|
+
"value",
|
|
1110
|
+
"selection",
|
|
1111
|
+
"extensions",
|
|
1112
|
+
"onChange",
|
|
1113
|
+
"onStatistics",
|
|
1114
|
+
"onCreateEditor",
|
|
1115
|
+
"onUpdate",
|
|
1116
|
+
"autoFocus",
|
|
1117
|
+
"theme",
|
|
1118
|
+
"height",
|
|
1119
|
+
"minHeight",
|
|
1120
|
+
"maxHeight",
|
|
1121
|
+
"width",
|
|
1122
|
+
"minWidth",
|
|
1123
|
+
"maxWidth",
|
|
1124
|
+
"basicSetup",
|
|
1125
|
+
"placeholder",
|
|
1126
|
+
"indentWithTab",
|
|
1127
|
+
"editable",
|
|
1128
|
+
"readOnly",
|
|
1129
|
+
"root",
|
|
1130
|
+
"initialState"
|
|
1131
|
+
], ReactCodeMirror = /* @__PURE__ */ (0, import_react.forwardRef)((e2, y) => {
|
|
1132
|
+
var { className: b, value: x = "", selection: S, extensions: C = [], onChange: w, onStatistics: E, onCreateEditor: D, onUpdate: O, autoFocus: k, theme: A = "light", height: j, minHeight: M, maxHeight: N, width: P, minWidth: F, maxWidth: I, basicSetup: L, placeholder: R, indentWithTab: z, editable: B, readOnly: V, root: H, initialState: U } = e2, W = _objectWithoutPropertiesLoose(e2, _excluded), G = (0, import_react.useRef)(null), { state: K, view: q, container: J, setContainer: Y } = useCodeMirror({
|
|
1133
|
+
root: H,
|
|
1134
|
+
value: x,
|
|
1135
|
+
autoFocus: k,
|
|
1136
|
+
theme: A,
|
|
1137
|
+
height: j,
|
|
1138
|
+
minHeight: M,
|
|
1139
|
+
maxHeight: N,
|
|
1140
|
+
width: P,
|
|
1141
|
+
minWidth: F,
|
|
1142
|
+
maxWidth: I,
|
|
1143
|
+
basicSetup: L,
|
|
1144
|
+
placeholder: R,
|
|
1145
|
+
indentWithTab: z,
|
|
1146
|
+
editable: B,
|
|
1147
|
+
readOnly: V,
|
|
1148
|
+
selection: S,
|
|
1149
|
+
onChange: w,
|
|
1150
|
+
onStatistics: E,
|
|
1151
|
+
onCreateEditor: D,
|
|
1152
|
+
onUpdate: O,
|
|
1153
|
+
extensions: C,
|
|
1154
|
+
initialState: U
|
|
1155
|
+
});
|
|
1156
|
+
(0, import_react.useImperativeHandle)(y, () => ({
|
|
1157
|
+
editor: G.current,
|
|
1158
|
+
state: K,
|
|
1159
|
+
view: q
|
|
1160
|
+
}), [
|
|
1161
|
+
G,
|
|
1162
|
+
J,
|
|
1163
|
+
K,
|
|
1164
|
+
q
|
|
1165
|
+
]);
|
|
1166
|
+
var X = (0, import_react.useCallback)((e3) => {
|
|
1167
|
+
G.current = e3, Y(e3);
|
|
1168
|
+
}, [Y]);
|
|
1169
|
+
if (typeof x != "string") throw Error("value must be typeof string but got " + typeof x);
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", _extends({
|
|
1171
|
+
ref: X,
|
|
1172
|
+
className: (typeof A == "string" ? "cm-theme-" + A : "cm-theme") + (b ? " " + b : "")
|
|
1173
|
+
}, W));
|
|
1174
|
+
});
|
|
1175
|
+
ReactCodeMirror.displayName = "CodeMirror";
|
|
1176
|
+
var esm_default = ReactCodeMirror;
|
|
1177
|
+
export {
|
|
1178
|
+
minimalSetup as n,
|
|
1179
|
+
esm_default as t
|
|
1180
|
+
};
|